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