1 ;; ~/.emacs |
1 ;; ~/.emacs |
2 ;; Luke Hoersten <[email protected]> |
2 ;; Luke Hoersten <[email protected]> |
3 |
3 |
4 ;; general |
4 ;; general |
5 (setq-default load-path (cons "~/.emacs.d/" load-path)) ; set default emacs load path |
5 (add-to-list 'load-path "~/.emacs.d/") ; set default emacs load path |
6 |
6 |
7 (setq-default ediff-split-window-function 'split-window-horizontally) ; diff horizontally |
7 (setq-default |
8 (setq-default x-select-enable-clipboard t) ; paste from X buffer |
8 ediff-split-window-function 'split-window-horizontally ; diff horizontally |
9 (setq-default inhibit-splash-screen t) ; disable splash screen |
9 x-select-enable-clipboard t ; paste from X buffer |
10 (setq-default truncate-lines t) |
10 inhibit-splash-screen t ; disable splash screen |
11 (put 'set-goal-column 'disabled nil) ; enable goal column setting |
11 truncate-lines t ; truncate, not wrap, lines |
12 (put 'narrow-to-region 'disabled nil) ; enable hiding |
12 indent-tabs-mode nil) ; mouse hover variables |
13 |
13 |
14 (menu-bar-mode nil) ; remove menu bar |
14 (put 'set-goal-column 'disabled nil) ; enable goal column setting |
15 (display-time-mode t) ; show clock |
15 (put 'narrow-to-region 'disabled nil) ; enable hiding |
16 (column-number-mode t) ; show column numbers |
16 |
17 (delete-selection-mode t) ; replace highlighted text |
17 (menu-bar-mode nil) ; remove menu bar |
18 (windmove-default-keybindings) ; move between windows with shift-arrow |
18 (display-time-mode t) ; show clock |
19 (setq-default indent-tabs-mode nil) ; mouse hover variables |
19 (column-number-mode t) ; show column numbers |
20 (ido-mode t) ; file/buffer selector |
20 (delete-selection-mode t) ; replace highlighted text |
21 (setq-default ido-enable-flex-matching t) ; fuzzy matching for ido mode |
21 (windmove-default-keybindings) ; move between windows with shift-arrow |
22 (add-hook 'text-mode-hook 'flyspell-mode t) ; spellcheck text |
22 (ido-mode t) ; file/buffer selector |
|
23 (setq-default ido-enable-flex-matching t) ; fuzzy matching for ido mode |
|
24 (add-hook 'text-mode-hook 'flyspell-mode t) ; spellcheck text |
|
25 (add-hook 'text-mode-hook 'turn-on-aut-fill) ; autofill text |
23 |
26 |
24 ;; whitespace |
27 ;; whitespace |
25 (global-whitespace-mode t) ; show whitespace |
28 (global-whitespace-mode t) ; show whitespace |
26 (add-hook 'before-save-hook 'whitespace-cleanup) ; cleanup whitespace on exit |
29 (add-hook 'before-save-hook 'whitespace-cleanup) ; cleanup whitespace on exit |
27 (setq-default whitespace-line-column 120) ; column width |
30 (setq-default |
28 (setq-default whitespace-style |
31 whitespace-line-column 120 ; column width |
29 '(tabs tab-mark trailing lines-tail |
32 whitespace-style ; whitespace elements to show |
30 space-before-tab indentation empty)) ; what whitespace elements to show |
33 '(tabs tab-mark trailing lines-tail |
|
34 space-before-tab indentation empty)) |
31 |
35 |
32 ;; coding |
36 ;; coding |
33 (which-func-mode t) ; show current function |
37 (which-func-mode t) ; show current function |
34 (show-paren-mode t) ; show matching paren |
38 (show-paren-mode t) ; show matching paren |
35 (transient-mark-mode t) ; show highlighting |
39 (transient-mark-mode t) ; show highlighting |
36 (global-font-lock-mode t) ; syntax highlighting |
40 (global-font-lock-mode t) ; syntax highlighting |
37 (global-set-key (kbd "C-c c") 'compile) ; compile |
41 (global-set-key (kbd "C-c c") 'compile) ; compile |
38 (global-set-key (kbd "C-c r") 'recompile) ; recompile |
42 (global-set-key (kbd "C-c r") 'recompile) ; recompile |
39 |
43 |
40 ;; includes |
44 ;; includes |
41 (require 'hoersten-pastebin-region) ; send selected text to pastebin |
45 (require 'hoersten-pastebin-region) ; send selected text to pastebin |
42 (require 'mercurial) ; load mercurial mode |
46 (require 'mercurial) ; load mercurial mode |
43 (require 'nav) ; load nav bar |
47 (require 'nav) ; load nav bar |
44 (require 'hoersten-c-style) ; load c specific lisp |
48 (require 'hoersten-c-style) ; load c specific lisp |
45 |
49 |
46 ;; unicode |
50 ;; unicode |
47 (require 'pretty-mode) |
51 (require 'pretty-mode) |
48 (global-pretty-mode t) |
52 (global-pretty-mode t) |
49 (setq haskell-font-lock-symbols 'unicode) |
53 (setq haskell-font-lock-symbols 'unicode) |
51 ;; snippets |
55 ;; snippets |
52 (require 'yasnippet) |
56 (require 'yasnippet) |
53 (yas/initialize) |
57 (yas/initialize) |
54 (yas/load-directory "~/.emacs.d/snippets/") |
58 (yas/load-directory "~/.emacs.d/snippets/") |
55 |
59 |
56 ;; shell |
60 ;; zencoding html |
57 (global-set-key (kbd "C-c s") 'shell) ; start shell |
61 (require 'zencoding-mode) |
58 (ansi-color-for-comint-mode-on) ; color in shell buffer |
62 (add-hook 'sgml-mode-hook 'zencoding-mode) ; Auto-start on any markup modes |
59 (setq-default comint-scroll-to-bottom-on-input t) ; only type on prompt |
|
60 (setq-default comint-scroll-show-maximum-output t) ; place text at bottom |
|
61 |
|
62 ;; org mode |
|
63 (add-hook 'org-mode-hook |
|
64 '(lambda () |
|
65 (local-set-key (kbd "M-p") 'org-move-item-up) |
|
66 (local-set-key (kbd "M-S-p") 'org-move-subtree-up) |
|
67 (local-set-key (kbd "M-n") 'org-move-item-down) |
|
68 (local-set-key (kbd "M-S-n") 'org-move-subtree-down))) |
|
69 |
63 |
70 ;; unique buffer names with dirs |
64 ;; unique buffer names with dirs |
71 (require 'uniquify) |
65 (require 'uniquify) |
72 (setq |
66 (setq |
73 uniquify-buffer-name-style 'post-forward |
67 uniquify-buffer-name-style 'post-forward |
74 uniquify-separator ":") |
68 uniquify-separator ":") |
75 |
69 |
|
70 ;; shell |
|
71 (global-set-key (kbd "C-c s") 'shell) ; start shell |
|
72 (ansi-color-for-comint-mode-on) ; color in shell buffer |
|
73 (setq-default |
|
74 comint-scroll-to-bottom-on-input t ; only type on prompt |
|
75 comint-scroll-show-maximum-output t) ; place text at bottom |
|
76 |
|
77 ;; org mode |
|
78 (add-hook |
|
79 'org-mode-hook |
|
80 '(lambda () |
|
81 (local-set-key (kbd "M-p") 'org-move-item-up) |
|
82 (local-set-key (kbd "M-S-p") 'org-move-subtree-up) |
|
83 (local-set-key (kbd "M-n") 'org-move-item-down) |
|
84 (local-set-key (kbd "M-S-n") 'org-move-subtree-down))) |
|
85 |
76 ;; line numbers |
86 ;; line numbers |
77 ;;(global-linum-mode t) |
87 ;;(global-linum-mode t) |
78 (mapc (lambda (x) |
88 (mapc |
79 (add-hook x 'linum-mode)) |
89 (lambda (x) |
80 '(text-mode-hook |
90 (add-hook x 'linum-mode)) |
81 c-mode-common-hook |
91 '(text-mode-hook |
82 python-mode-hook |
92 c-mode-common-hook |
83 haskell-mode-hook |
93 python-mode-hook |
84 emacs-lisp-mode-hook)) |
94 haskell-mode-hook |
|
95 emacs-lisp-mode-hook)) |
85 |
96 |
86 ;; use only spaces for alignment |
97 ;; use only spaces for alignment |
87 (global-set-key (kbd "C-c a") 'align-with-spaces) ; align |
98 (global-set-key (kbd "C-c a") 'align-with-spaces) |
88 (defun align-with-spaces (beg end pattern) |
99 (defun align-with-spaces (beg end pattern) |
89 "Align selected using only spaces for whitespace." |
100 "Align selected using only spaces for whitespace." |
90 (interactive "r\nsAlign by: ") |
101 (interactive "r\nsAlign by: ") |
91 (let ((indent-tabs-mode nil)) |
102 (let ((indent-tabs-mode nil)) |
92 (align-string beg end pattern 1) |
103 (align-string beg end pattern 1) |