This repository has been archived by the owner on Dec 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
init.el
165 lines (126 loc) · 4.06 KB
/
init.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
;; My Emacs.d
;;
;; Intended to be robust and usable across platforms
;; from emacs-starter-kit
(progn
;; Turn off mouse interface early in startup to avoid momentary display
(dolist (mode '(menu-bar-mode tool-bar-mode scroll-bar-mode))
(when (fboundp mode) (funcall mode -1))))
;; add my custom hook
(defvar bw-after-custom-load-hook nil
"Hook called after the custom file is loaded")
;; annoying, a lot of stuff uses this
(require 'cl)
;; Load external files
(setq
dotfiles-dir
(file-name-directory
(or (buffer-file-name) load-file-name)))
(add-to-list 'load-path dotfiles-dir)
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp")
;; vendor files
(setq
vendor-dotfiles-dir
(concat dotfiles-dir "/vendor"))
(add-to-list 'load-path vendor-dotfiles-dir)
;; tmp directory for storing stupid crap
(setq
tmp-local-dir
(concat dotfiles-dir "/.tmp"))
;; kill all start up stuff
(setq inhibit-startup-screen t)
(setq initial-buffer-choice t)
;; always highlight syntax
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
;; Save a list of recent files visited.
;; disable auto-clean before we start recentf so Tramp doesn't block emacs
(require 'recentf)
(setq recentf-auto-cleanup 'never)
(recentf-mode 1)
;; Highlight matching parentheses when the point is on them.
(show-paren-mode 1)
(setq show-paren-style 'parenthesis)
;; show lines after end of buffer
(setq indicate-empty-lines t)
;; Hippie expand: at times perhaps too hip
(delete
'try-expand-line hippie-expand-try-functions-list)
(delete
'try-expand-list hippie-expand-try-functions-list)
;; I got sick of typing "yes"
(defalias 'yes-or-no-p 'y-or-n-p)
;; No tabs
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
;; UTF-8 please!
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
;; Stop autosaves and backups from littering the filesystem
;; Keep backups in same dir
(setq
backup-by-copying t ; Don't clobber symlinks
backup-directory-alist `((".*" . ,(concat tmp-local-dir "/backups")))
auto-save-file-name-transforms `((".*" ,(concat tmp-local-dir "/autosaves") t))
delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t) ; Use versioned backups
;; Whitespace mode
(require 'whitespace)
;; Whitespace mode from:
;; http://ruslanspivak.com/2010/09/27/keep-track-of-whitespaces-and-column-80-overflow/
;; nuke trailing whitespaces when writing to a file
(add-hook 'write-file-hooks 'delete-trailing-whitespace)
;; display only tails of lines longer than 80 columns, tabs and
;; trailing whitespaces
;; style information is here: http://www.emacswiki.org/emacs/WhiteSpace
(setq whitespace-line-column 80
whitespace-style '(face tabs trailing lines-tail))
;; face for long lines' tails
(set-face-attribute 'whitespace-line nil)
;; enable whitespace mode
(global-whitespace-mode t)
(whitespace-mode t)
(require 'uniquify)
;; this shows foo/bar and baz/bar when two files are named bar
(setq uniquify-buffer-name-style 'forward)
;; strip common suffixes
(setq uniquify-strip-common-suffix t)
;; show keystrokes immediately
(setq echo-keystrokes 0.1)
;; Fuck auto fill
(setq auto-fill-mode nil)
;; Show line-number in the mode line
(line-number-mode 1)
;; Show column-number in the mode line
(column-number-mode 1)
;; My functions
(load "elisp")
;; update PATH, because Darwin Emacs doesn't get PATH from bash
(setenv-from-shell-environment)
;; My keyboard shortcuts
(load "keys")
;; start a server
(load "server")
(unless (server-running-p)
(server-start))
;; packages
(load "packages")
;; we load modes last, because things above might have changed how we load them
;; Major/minor modes
(load "modes")
;; load generic GUI configuration
(load "gui")
;; OSX specific code
(when (eq system-type 'darwin)
(org-babel-load-file (expand-file-name "darwin.org" dotfiles-dir))
(if (display-graphic-p)
(load "darwin-gui")
(load "darwin-cli")))
;; Load custom file last
(setq custom-file (concat dotfiles-dir "custom.el"))
(load custom-file 'noerror)
;; load my custom hooks
(run-hooks 'bw-after-custom-load-hook)