Created
August 20, 2013 00:18
-
-
Save jkburges/6275722 to your computer and use it in GitHub Desktop.
My .emacs file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(electric-indent-mode t) | |
(setq-default tab-width 4) | |
(setq-default indent-tabs-mode nil) | |
(setq indent-line-function 'insert-tab) | |
(setq tabify nil) | |
(setq-default c-basic-offset 4) | |
(delete-selection-mode 1) | |
(set-default-font "-apple-Bitstream_Vera_Sans_Mono-medium-normal-normal-*-*-*-*-*-m-0-iso10646-1") | |
(setq load-path (cons "~/.emacs.d/" load-path)) | |
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/") | |
(setq whitespace-action '(auto-cleanup)) ;; automatically clean up bad whitespace | |
(setq whitespace-style '(trailing space-before-tab indentation empty space-after-tab)) ;; only show bad whitespace | |
;;; delete trailing whitespace | |
(add-hook 'before-save-hook 'delete-trailing-whitespace) | |
;;; turn on syntax highlighting | |
(global-font-lock-mode 1) | |
;;; xml-mode for gsp files. | |
(autoload 'xml-mode "psgml" "Major mode to edit XML files." t) | |
(setq auto-mode-alist | |
(nconc | |
'(("\\.gsp$" . xml-mode)) | |
auto-mode-alist)) | |
;;; use groovy-mode when file ends in .groovy or has #!/bin/groovy at start | |
(autoload 'groovy-mode "groovy-mode" "Major mode for editing Groovy code." t) | |
(add-to-list 'auto-mode-alist '("\.groovy$" . groovy-mode)) | |
(add-to-list 'interpreter-mode-alist '("groovy" . groovy-mode)) | |
;;; make Groovy mode electric by default. | |
(add-hook 'groovy-mode-hook | |
'(lambda () | |
(require 'groovy-electric) | |
(groovy-electric-mode))) | |
(add-hook 'groovy-mode-hook | |
(lambda () | |
(c-set-offset 'label 4))) | |
(setq linum-format " %d") | |
(global-linum-mode 1) | |
(set-cursor-color "slategrey") | |
(global-set-key "\M-g" 'goto-line) | |
(setq frame-title-format | |
(list (format "%s %%S: %%j " (system-name)) | |
'(buffer-file-name "%f" (dired-directory dired-directory "%b")))) | |
;; Auto-complete | |
(add-to-list 'load-path "~/.emacs.d/") | |
(require 'auto-complete-config) | |
(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict") | |
(ac-config-default) | |
(require 'ido) | |
(ido-mode t) | |
(setq path-to-ctags "/usr/local/bin/ctags") ;; <- your ctags path here | |
(defun create-tags (dir-name) | |
"Create tags file." | |
(interactive "DDirectory: ") | |
(shell-command | |
(format "%s -f %s/TAGS -e -R %s" path-to-ctags dir-name (directory-file-name dir-name))) | |
) | |
;; Ruby flymake. | |
(require 'flymake) | |
;; I don't like the default colors :) | |
;;(set-face-background 'flymake-errline "red4") | |
;;(set-face-background 'flymake-warnline "dark slate blue") | |
;; Invoke ruby with '-c' to get syntax checking | |
(defun flymake-ruby-init () | |
(let* ((temp-file (flymake-init-create-temp-buffer-copy | |
'flymake-create-temp-inplace)) | |
(local-file (file-relative-name | |
temp-file | |
(file-name-directory buffer-file-name)))) | |
(list "ruby" (list "-c" local-file)))) | |
(push '(".+\\.rb$" flymake-ruby-init) flymake-allowed-file-name-masks) | |
(push '("Berksfile$" flymake-ruby-init) flymake-allowed-file-name-masks) | |
(push '("Cheffile$" flymake-ruby-init) flymake-allowed-file-name-masks) | |
(push '("Gemfile$" flymake-ruby-init) flymake-allowed-file-name-masks) | |
(push '("Guardfile$" flymake-ruby-init) flymake-allowed-file-name-masks) | |
(push '("Rakefile$" flymake-ruby-init) flymake-allowed-file-name-masks) | |
(push '("Thorfile$" flymake-ruby-init) flymake-allowed-file-name-masks) | |
(push '("Vagrantfile$" flymake-ruby-init) flymake-allowed-file-name-masks) | |
(push '("^\\(.*\\):\\([0-9]+\\): \\(.*\\)$" 1 2 nil 3) flymake-err-line-patterns) | |
(add-to-list 'auto-mode-alist '("\\.rake$" . ruby-mode)) | |
(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode)) | |
(add-to-list 'auto-mode-alist '("\\.gemspec$" . ruby-mode)) | |
(add-to-list 'auto-mode-alist '("\\.ru$" . ruby-mode)) | |
(add-to-list 'auto-mode-alist '("Gemfile$" . ruby-mode)) | |
(add-to-list 'auto-mode-alist '("Guardfile$" . ruby-mode)) | |
(add-to-list 'auto-mode-alist '("Guardfile$" . ruby-mode)) | |
(add-to-list 'auto-mode-alist '("Guardfile$" . ruby-mode)) | |
(add-to-list 'auto-mode-alist '("Guardfile$" . ruby-mode)) | |
(add-hook 'ruby-mode-hook | |
'(lambda () | |
;; Don't want flymake mode for ruby regions in rhtml files and also on read only files | |
(if (and (not (null buffer-file-name)) (file-writable-p buffer-file-name)) | |
(flymake-mode)) | |
)) | |
(custom-set-faces | |
'(diff-added ((t (:foreground "forest green"))) 'now) | |
'(diff-removed ((t (:foreground "firebrick"))) 'now) | |
) | |
(if (window-system) | |
(set-frame-size (selected-frame) 129 76)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment