summaryrefslogtreecommitdiff
path: root/init.el
blob: 060d108b0b177aaec2b6b359bb7f837a128b6f66 (about) (plain)
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
;; No splash screen please ...
(setq inhibit-startup-message t)

;; display tool tips in echo area only
(tooltip-mode -1)
(setq tooltip-use-echo-area t)
(setq frame-resize-pixelwise t)

;; disable mouse scrolling
(mouse-wheel-mode -1)

(add-to-list 'load-path (concat user-emacs-directory "/lisp/"))
(add-to-list 'load-path "/usr/share/emacs/site-lisp/")
(add-to-list 'load-path "~/.guix-profile/share/emacs/site-lisp/mu4e/")

(load "init-package.el")

;; better defaults, includes hiding the GUI
(require 'better-defaults)
(require 'paren-face)
(global-paren-face-mode 1)

(require 'projectile)
(projectile-global-mode)

(require 'guide-key)
(setq guide-key/guide-key-sequence '("C-x r" "C-x 4" "C-c p"))
(guide-key-mode)

;; Keep emacs Custom-settings in separate file
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(load custom-file)

;; sublime-themes must be installed
(load-theme 'spolsky t)
(set-cursor-color "White")
(setq cursor-type 'box)
(setq evil-default-cursor '("white" box))
(set-background-color "#181818")



(require 'visual-regexp-steroids)
(define-key global-map (kbd "C-c r") 'vr/replace)
(define-key global-map (kbd "C-c q") 'vr/query-replace)

;; use visual-regexp-steroids's isearch instead of the built-in regexp
;; isearch
(define-key esc-map (kbd "C-r") 'vr/isearch-backward) ;; C-M-r
(define-key esc-map (kbd "C-s") 'vr/isearch-forward) ;; C-M-s

(add-hook 'haskell-mode-hook
          (lambda ()
            (turn-on-haskell-indentation)
            (turn-on-haskell-doc)))

(load "init-dired.el")
(require 'tramp)
(setq tramp-default-method "ssh")

;; for root connections to remote hosts, log in via ssh with normal
;; user account first, then su/sudo to root
(add-to-list 'tramp-default-proxies-alist
             '(nil "\\`root\\'" "/ssh:%h:"))
(add-to-list 'tramp-default-proxies-alist
             '((regexp-quote (system-name)) nil nil))

;; respect the PATH variable on the remote machine
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)

;; Backup (file~) disabled and auto-save (#file#) locally to prevent delays in editing remote files
(add-to-list 'backup-directory-alist
             (cons tramp-file-name-regexp nil))
(setq tramp-auto-save-directory temporary-file-directory)
(setq tramp-verbose 3)

;; Write backup files to own directory
;; TODO: conflicts with previous manipulation of backup-directory-alist
(setq backup-directory-alist
      `(("." . ,(expand-file-name
                 (concat user-emacs-directory "backups")))))

;; Make backups of files, even when they're in version control
(setq vc-make-backup-files t)

(autoload 'markdown-mode "markdown-mode"
  "Major mode for editing Markdown files" t)
(autoload 'js2-mode "js2-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))

;; fullscreen mode with F11
(fullscreen-mode 1)
(global-set-key (kbd "<f11>") 'fullscreen-mode-fullscreen-toggle)

(setq scss-compile-at-save nil)

;; (setq whitespace-global-modes '(not erc-mode))
;; (global-whitespace-mode 1)
;; (set-face-attribute 'whitespace-space nil :background nil :foreground "gray20")
;; (set-face-attribute 'whitespace-newline nil :background nil :foreground "gray20")
;; (setq whitespace-style
;;       '(face spaces tabs newline space-mark tab-mark newline-mark))
;; (setq whitespace-display-mappings
;;       ;; all numbers are Unicode codepoint in decimal. try
;;       ;; (insert-char 182 ) to see it
;;       '(
;;         (space-mark 32 [183] [46]) ; 32 SPACE, 183 MIDDLE DOT 「·」,
;;                                    ; 46 FULL STOP 「.」
;;         (newline-mark 10 [182 10]) ; 10 LINE FEED
;;         (tab-mark 9 [9655 9] [92 9]) ; 9 TAB, 9655 WHITE
;;                                      ; RIGHT-POINTING TRIANGLE 「▷」
;;         ))

(desktop-save-mode t)

;; ediff settings
(setq ediff-diff-options "-w")

;; cause Emacs to fully redraw the display *before* it processes queued input events.
(setq redisplay-dont-pause t)

;; fewer backslashes in regexp builder
(require 're-builder)
(setq reb-re-syntax 'string)

;; remove prompt on killing process buffer
(setq kill-buffer-query-functions
      (remq 'process-kill-buffer-query-function
            kill-buffer-query-functions))

;; enable features that are disabled by default
(put 'narrow-to-region 'disabled nil)
(put 'erase-buffer     'disabled nil)
(put 'narrow-to-page   'disabled nil)

(require 'company)
(add-hook 'after-init-hook 'global-company-mode)
(setq company-idle-delay nil)
(define-key company-mode-map (kbd "C-c <tab>") 'company-complete)

(require 'fill-column-indicator)
(add-hook 'prog-mode-hook 'fci-mode)

;; keep the cursor centered to avoid sudden scroll jumps
(require 'centered-cursor-mode)

;; disable in terminal modes
;; http://stackoverflow.com/a/6849467/519736
;; also disable in Info mode, because it breaks going back with the backspace key
(define-global-minor-mode my-global-centered-cursor-mode centered-cursor-mode
  (lambda ()
    (when (not (memq major-mode
                     (list 'Info-mode 'term-mode 'eshell-mode 'shell-mode 'erc-mode)))
      (centered-cursor-mode))))
(my-global-centered-cursor-mode 1)

;; expand region
(global-set-key (kbd "M-@") 'er/expand-region)

;; Swap C-t and C-x, so it's easier to type on Dvorak layout
;; `keyboard-translate` does not work when attaching an emacsclient to
;; a running emacs in daemon mode, so instead we define the key in the
;; key-translation-map.
;; http://lists.gnu.org/archive/html/help-gnu-emacs/2009-10/msg00505.html
(define-key key-translation-map [?\C-x] [?\C-t])
(define-key key-translation-map [?\C-t] [?\C-x])

(load "email.el")
(load "init-org.el")
(load "init-ido.el")
(load "init-geiser.el")
(load "init-god-mode.el")
(load "init-gnus.el")
(load "init-magit.el")
(load "init-eshell.el")
(load "init-smex.el")
(load "init-modeline.el")
(load "init-typopunct.el")
(load "init-my-stuff.el")
(load "init-paredit.el")

;; start in fullscreen mode
(add-hook 'emacs-startup-hook (lambda () (fullscreen-mode-fullscreen)))
(add-hook 'doc-view-mode-hook 'auto-revert-mode)

(page-break-lines-mode 1)
(global-set-key (kbd "<C-prior>") 'backward-page)
(global-set-key (kbd "<C-next>") 'forward-page)

(require 'info+)
(setq Info-fontify-quotations-flag t)
(setq Info-fontify-single-quote-flag t)

(add-to-list 'auto-mode-alist '("\\.html\\'" . sgml-mode))
(eval-after-load "sgml-mode"
  '(progn
     (require 'tagedit)
     (tagedit-add-paredit-like-keybindings)
     (tagedit-add-experimental-features)
     (add-hook 'html-mode-hook (lambda () (tagedit-mode 1)))))

(global-prettify-symbols-mode)

(delete-selection-mode 1) ; delete seleted text when typing

(global-hl-line-mode 1) ; turn on highlighting current line
(set-face-background 'hl-line "#222")
(set-face-attribute hl-line-face nil :underline nil)
(global-undo-tree-mode 1)

(setq debbugs-gnu-default-packages '("emacs" "guix"))
(setq erc-join-buffer 'bury)
(savehist-mode)