-
Notifications
You must be signed in to change notification settings - Fork 2
/
emacs.minimal
145 lines (117 loc) · 3.91 KB
/
emacs.minimal
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
;;;; Section 1: Configuring emacs options
(setq ring-bell-function 'ignore)
(setq tramp-default-method "ssh")
(menu-bar-mode -1) ;Removes menu bar
(tool-bar-mode -1) ;Removes tool bar
(scroll-bar-mode -1) ; Removes scroll bar
(setq-default indent-tabs-mode nil) ;Tabs auto indent
(global-auto-revert-mode 1)
(setq
; show warning instead of following
vc-follow-symlinks t
; Remove the new line character
kill-whole-line t
; No annoying messages
initial-scratch-message nil
inhibit-startup-message nil
inhibit-splash-screen t
garbage-collection-messages nil
; No more empty lines and spaces
indicate-empty-lines t
indicate-buffer-boundaries t
; No more beeping
visual-bell t
visible-bell t
default-major-mode 'text-mode
; Formatting
search-highlight t
query-replace-highlight t
require-final-newline t
; No new lines when scrolling down
next-line-add-newlines nil
; Scrolling
scroll-step 1
scroll-preserve-screen-position t
scroll-margin 0
next-screen-context-lines 0
scroll-error-top-bottom t
; Case insensitive search
case-fold-search t
; Copy pasting this for safety ?
revert-without-query '("\\.log$")
; Here be backups
; http://stackoverflow.com/questions/2680389/how-to-remove-all-files-ending-with-made-by-emacs
backup-directory-alist `(("." . "~/.emacs.d/backup"))
backup-by-copying t
delete-old-versions t
kept-new-versions 5
kept-old-versions 5
; Compilation commands
compile-command "make -j4"
compilation-scroll-output t
compilation-read-command nil
compilation-ask-about-save nil
compilation-window-height nil
compilation-process-setup-function nil
)
(delete-selection-mode 1) ; Can replace selected area by typing
(which-func-mode 1) ; Displays the current function name beside major mode
(setq which-func-unknown "n/a")
(add-hook 'before-save-hook 'delete-trailing-whitespace) ; Delete trailing whitespace before save
(savehist-mode 1)
(setq savehist-file "~/.emacs.d/history") ; Define history location
(setq tramp-histfile-override "~/.emacs.d/tramp_history")
; Customize some shortcuts
(define-key global-map (kbd "C-c e") 'eval-buffer)
; Navigate
(windmove-default-keybindings 'meta)
; C/C++ style hook
(defun my-c-mode-common-hook ()
"Custom C mode hooks. BSD style braces."
(interactive)
(c-set-style "bsd")
(setq c-basic-offset 4)
(setq c++-basic-offset 4)
)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
; Tab width hook
(defun my-tab-width-hook ()
"Set tab width to 4."
(setq
default-tab-width 4
tab-width 4
indent-tabs-mode nil)
)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
; Display trailing whitespace hook
(defun my-whitespace-hook ()
"Show trailing whitespace."
(setq
show-trailing-whitespace t)
)
(add-hook 'c-mode-common-hook 'my-tab-width-hook)
(defun my-custom-build-bindings ()
"My custom bindings."
(local-set-key "\C-c\C-c" 'compile)
(local-set-key "\C-cc" 'comment-region)
(local-set-key "\C-x\C-n" 'next-error)
(local-set-key "\C-x\C-p" 'previous-error)
)
(add-hook 'c-mode-hook 'my-custom-build-bindings)
(add-hook 'c++-mode-hook 'my-custom-build-bindings)
(add-hook 'python-mode-hook 'my-custom-build-bindings)
;; Customizing modeline colors
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(helm-ff-directory ((t (:background "black" :foreground "deep sky blue"))))
'(helm-ff-dotted-symlink-directory ((t (:background "black" :foreground "DarkOrange"))))
'(helm-ff-file ((t (:inherit font-lock-builtin-face :foreground "white"))))
'(mode-line ((t (:foreground "Red"))))
'(mode-line-buffer-id ((t (:weight bold))))
'(mode-line-inactive ((t (:foreground "DarkRed"))))
'(mode-line-misc-info ((t (:foreground "yellow"))))
'(term-color-blue ((t (:background "magenta" :foreground "dark violet"))))
'(which-func ((t (:foreground "gold")))))