A nice ~/.emacs file

Submitted by Fekete Zoltán on
(require 'package)

(add-to-list 'package-archives
         '("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives
         '("gnu" . "http://elpa.gnu.org/packages/") t)
(package-initialize)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-faces-vector
   [default default default italic underline success warning error])
 '(ansi-color-names-vector
   ["black" "#d55e00" "#009e73" "#f8ec59" "#0072b2" "#cc79a7" "#56b4e9" "white"])
 '(blink-cursor-mode t)
 '(column-number-mode t)
 '(compilation-auto-jump-to-first-error t)
 '(compilation-scroll-output (quote first-error))
 '(current-language-environment "UTF-8")
 '(custom-enabled-themes (quote (tsdh-dark)))
 '(electric-pair-mode nil)
 '(electric-pair-text-pairs (quote ((34 . 34) (40 . 41) (60 . 62) (123 . 125))))
 '(grep-command "grep -n -I -r ")
 '(inhibit-startup-screen t)
 '(package-selected-packages
   (quote
    (web-mode-edit-element multi-web-mode anaconda-mode tabbar web-mode ggtags)))
 '(save-place t)
 '(scroll-bar-mode nil)
 '(show-paren-mode t)
 '(size-indication-mode t)
 '(tool-bar-mode nil))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

;;(set-default-font "fixed 14")

(prefer-coding-system 'utf-8)

(global-set-key [f1] 'delete-other-windows)
(global-set-key [f2] 'save-buffer)
(global-set-key [f3] 'find-file)
(global-set-key [f4] 'goto-line)
(global-set-key [f5] 'compile)
(global-set-key [f6] 'visit-tags-table)
(global-set-key [f8] 'next-error)
(global-set-key [f12] 'describe-bindings)

(global-set-key [\C-z] 'undo)
(global-set-key [insert] 'other-window)
(global-set-key [C-x C-b] 'buffer-menu)
(global-set-key [C-tab] 'dabbrev-expand)
(global-set-key [C-c i] 'ispell-buffer)

;;(display-time-mode)
(line-number-mode 1)
(column-number-mode 1)
(menu-bar-mode 0)

;;(defun tabbar-buffer-groups ()
;;  (list (cond ((string-equal "*" (substring (buffer-name) 0 1)) "emacs")
;;          (t "user"))))
;; (tabbar-mode 't)

(add-hook 'python-mode-hook 'anaconda-mode)
(add-hook 'html-mode-hook 'web-mode)

(require 'web-mode-edit-element)
(add-hook 'web-mode-hook 'web-mode-edit-element-minor-mode)
(add-to-list 'auto-mode-alist '("\\.php\\'" . web-mode))

(setq web-mode-markup-indent-offset 3)
(setq web-mode-css-indent-offset 3)
(setq web-mode-code-indent-offset 3)
(defun add-mode-line-dirtrack ()
    "When editing a file, show the last 2 directories of the current path in the mode line."
    (add-to-list 'mode-line-buffer-identification 
                 '(:eval (substring default-directory 
                                    (+ 1 (string-match "/[^/]+/[^/]+/$" default-directory)) nil))))
  (add-hook 'find-file-hook 'add-mode-line-dirtrack)

Tags