Created
May 28, 2012 04:16
-
-
Save Gowiem/2817195 to your computer and use it in GitHub Desktop.
Critique my .emacs, Thanks!
This file contains hidden or 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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Gowie's .emacs file ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Directory for my installed packages | |
(add-to-list 'load-path "~/.emacs.d/") | |
;; Not sure why I have to add these to the path? | |
(add-to-list 'load-path "~/.emacs.d/scala") | |
(add-to-list 'load-path "~/.emacs.d/coffee-mode") | |
;; (add-to-list 'load-path "~/.emacs.d/ensime/elisp/") | |
;; Requiring installed packages | |
(require 'maxframe) ; https://github.com/rmm5t/maxframe.el | |
(require 'window-numbering) ; http://nschum.de/src/emacs/window-numbering-mode | |
(require 'smart-tab) ; https://github.com/genehack/smart-tab | |
(require 'ruby-electric) ; https://github.com/qoobaa/ruby-electric | |
(require 'git) ; https://github.com/tsgates/git-emacs | |
(require 'git-blame) | |
(require 'haml-mode) ; https://github.com/nex3/haml-mode | |
(require 'scala-mode-auto) ; https://github.com/scala/scala-dist/ | |
;; (require 'ensime) ; https://github.com/aemoncannon/ensime | |
(require 'coffee-mode) ; https://github.com/defunkt/coffee-mode | |
;; Cosmetic stuff | |
(display-time) | |
(set-background-color "black") | |
(set-foreground-color "white") | |
(set-cursor-color "white") | |
(setq mf-max-width 1366) | |
;; Dont need these | |
(tool-bar-mode -1) | |
(scroll-bar-mode -1) | |
(menu-bar-mode -1) | |
;; Automatically open the following files with their given mode | |
(add-to-list 'auto-mode-alist '("README" . text-mode)) | |
(add-to-list 'auto-mode-alist '("Gemfile" . ruby-mode)) | |
(add-to-list 'auto-mode-alist '("Guardfile" . ruby-mode)) | |
;; Some randoms | |
(setq x-select-enable-clipboard t ; Copy and Cut to clipboard | |
inhibit-startup-message t ; Don't start with ugly splash screen | |
initial-scratch-message nil ; blank scratch page | |
auto-save-default nil | |
make-backup-files nil) | |
(setq-default indent-tabs-mode nil) | |
;; Save backups to ~/.saves directory | |
(setq backup-by-copying t ; don't clobber symlinks | |
backup-directory-alist '(("." . "~/.saves")) ; no litter | |
delete-old-versions t | |
kept-new-versions 6 | |
kept-old-versions 2 | |
version-control t) | |
;; Removed custom-variables/face from file | |
(setq custom-file (expand-file-name "~/.emacs.d/.custom.el")) | |
(load custom-file) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Hooks ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(add-hook 'ruby-mode-hook (lambda() (ruby-electric-mode t))) | |
(add-hook 'window-setup-hook 'maximize-frame t) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Minor Modes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(window-numbering-mode t) ; Number windows | |
(global-smart-tab-mode t) ; Tab completion | |
(global-font-lock-mode t) ; Syntax highlight | |
(global-linum-mode t) ; Line numbers | |
(delete-selection-mode t) ; Allow for region to be deleted | |
(show-paren-mode t) ; Highlight matching parens | |
(column-number-mode t) ; Column number in modeline | |
;; Turning off default minor modes | |
(font-lock-mode nil) | |
(file-name-shadow-mode nil) | |
(tooltip-mode nil) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; My Key Bindings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(global-set-key (kbd "C-i") 'goto-lin) ; C-i : Goto line number <input> | |
(global-set-key (kbd "C-x #") ; C-x | Shift-3 : comment/uncomment region | |
'comment-or-uncomment-region) | |
(global-set-key (kbd "<f5>") ; F5 : open .emacs | |
(lambda() (interactive) (find-file "~/.emacs"))) | |
(global-set-key (kbd "<f6>") ; F6 : load .emacs | |
(lambda() (interactive) (load-file "~/.emacs"))) | |
(global-set-key (kbd "<f7>") ; F7 : open ~/.bashrc | |
(lambda() (interactive) (find-file "~/.bashrc"))) | |
(global-set-key (kbd "<f8>") ; F8 : open ~/.bash_aliases | |
(lambda() (interactive) (find-file "~/.bash_aliases"))) | |
(global-set-key (kbd "M-<right>") ; Meta-right : Next-window | |
(lambda() (interactive) (select-window (next-window)))) | |
(global-set-key (kbd "M-<left>") ; Meta-left : Previous-window | |
(lambda() (interactive) (select-window (previous-window)))) | |
(defun delete-this-buffer-and-file () | |
"Removes file connected to current buffer and kills buffer." | |
(interactive) | |
(let ((filename (buffer-file-name)) | |
(buffer (current-buffer)) | |
(name (buffer-name))) | |
(if (not (and filename (file-exists-p filename))) | |
(error "Buffer '%s' is not visiting a file!" name) | |
(when (yes-or-no-p "Are you sure you want to remove this file? ") | |
(delete-file filename) | |
(kill-buffer buffer) | |
(message "File '%s' successfully removed" filename))))) | |
(global-set-key (kbd "C-c k") 'delete-this-buffer-and-file) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; i-do ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(ido-mode 'both) ; ido mode on for buffer/file lookup | |
;; some tweaks | |
(setq | |
ido-ignore-buffers | |
'("\\` " "^\*Mess" "^\*Back" ".*Completion" "^\*Ido" "^\*trace" | |
"^\*compilation" "^\*GTAGS" "^session\.*" "^\*") | |
ido-work-directory-list '("~/Workspace") | |
ido-case-fold t ; case insensitive | |
ido-enable-last-directory-history t ; Remeber latest directories | |
ido-enable-flex-matching -1 ; dont be too smart | |
ido-max-prospects 8 ; don't spam my minibuffer | |
ido-confirm-unique-completion t ; wait for RET, even with unique completion | |
confirm-nonexistent-file-or-buffer nil); remove confirmation | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Git ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(add-to-list 'vc-handled-backends 'GIT) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Ruby On Rails ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Inf-Ruby ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(autoload 'inf-ruby "inf-ruby" "Run an inferior Ruby process" t) | |
(autoload 'inf-ruby-keys "inf-ruby" "" t) | |
(require 'inf-ruby) ; https://github.com/nonsequitur/inf-ruby | |
(eval-after-load 'ruby-mode | |
'(add-hook 'ruby-mode-hook 'inf-ruby-keys)) | |
;; Emacs-Rails ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(setq load-path (cons (expand-file-name "~/.emacs.d/emacs-rails") load-path)) | |
(require 'rails-autoload) ; https://github.com/remvee/emacs-rails | |
;; RHTML ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(add-to-list 'load-path "~/.emacs.d/rhtml") | |
(require 'rhtml-mode) ; https://github.com/eschulte/rhtml | |
(setq auto-mode-alist (cons '("\\.erb$" . rhtml-mode) auto-mode-alist)) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Theme ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(add-to-list 'load-path "~/.emacs.d/color-theme-6.6.0") | |
(require 'color-theme) | |
(add-to-list 'load-path "~/.emacs.d/solarized-color-theme") | |
(require 'color-theme-solarized) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Ruby/Rails ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Auto indent on new line for ruby files | |
;; (add-hook 'ruby-mode-hook | |
;; (lambda() | |
;; (add-hook 'local-write-file-hooks | |
;; '(lambda() | |
;; (save-excursion | |
;; (untabify (point-min) (point-max)) | |
;; (delete-trailing-whitespace)))))) | |
;; (set (make-local-variable 'indent-tabs-mode) 'nil) | |
;; (set (make-local-variable 'tab-width) 2) | |
;; (autoload 'ruby-mode "ruby-mode" | |
;; "Mode for editing ruby source files" t) | |
;; (setq auto-mode-alist | |
;; (append '(("\\.rb$" . ruby-mode)) auto-mode-alist)) | |
;; (setq interpreter-mode-alist (append '(("ruby" . ruby-mode)) | |
;; interpreter-mode-alist)) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Sass ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(setq exec-path (cons (expand-file-name "~/.rvm/gems/ruby-1.9.3-p125@global") exec-path)) | |
(autoload 'scss-mode "scss-mode") | |
(add-to-list 'auto-mode-alist '("\\.scss\\'" . scss-mode)) | |
(setq scss-compile-at-save nil) | |
;;; This was installed by package-install.el. | |
;;; This provides support for the package system and | |
;;; interfacing with ELPA, the package archive. | |
;;; Move this code earlier if you want to reference | |
;;; packages in your .emacs. | |
(when | |
(load | |
(expand-file-name "~/.emacs.d/elpa/package.el")) | |
(package-initialize)) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Scala ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment