forked from ianyepan/yay-evil-emacs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.el
177 lines (140 loc) · 5.64 KB
/
config.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
166
167
168
169
170
171
172
173
174
175
176
177
;(setq evil-want-C-u-scroll t) ; use C-u to scroll up half a page
;(evil-mode 1)
;(evil-ex-define-cmd "q" 'kill-this-buffer) ; prevent accidentally killing the frame
;(defun ian/save-and-kill-this-buffer ()
; (interactive)
; (save-buffer)
; (kill-this-buffer))
;(evil-ex-define-cmd "wq" 'ian/save-and-kill-this-buffer)
(add-hook 'prog-mode-hook 'company-mode)
(setq company-minimum-prefix-length 1)
(setq company-idle-delay 0)
(with-eval-after-load 'company
(define-key company-active-map (kbd "C-n") 'company-select-next)
(define-key company-active-map (kbd "C-p") 'company-select-previous))
(yas-global-mode 1)
(advice-add 'company-complete-common
:before
(lambda ()
(setq my-company-point (point))))
(advice-add 'company-complete-common
:after
(lambda ()
(when (equal my-company-point (point))
(yas-expand))))
(add-hook 'after-init-hook 'global-flycheck-mode)
(setq ispell-program-name "/usr/local/bin/aspell")
;; Core Ido
(ido-mode 1)
(setq ido-everywhere t)
(setq ido-enable-flex-matching t)
(setq ido-vertical-define-keys 'C-n-C-p-up-and-down)
;; Vertical (for better visibility)
(ido-vertical-mode 1)
(setq-default tab-width 4)
(setq-default indent-tabs-mode nil)
(setq js-indent-level 4)
(setq c-default-style
'((java-mode . "java")
(awk-mode . "awk")
(other . "k&r")))
(setq-default c-basic-offset 4)
(defun ian/newline-and-push-brace ()
"`newline-and-indent', but bracket aware."
(interactive)
(insert "\n")
(when (looking-at "}")
(insert "\n")
(indent-according-to-mode)
(forward-line -1))
(indent-according-to-mode))
(global-set-key (kbd "RET") 'ian/newline-and-push-brace)
(defun ian/load-init()
"Reload .emacs.d/init.el"
(interactive)
(load-file "~/.emacs.d/init.el"))
(global-set-key (kbd "C-x g") 'magit-status)
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
(add-hook 'org-mode-hook 'visual-line-mode)
(add-hook 'org-mode-hook 'org-indent-mode)
(setq scroll-margin 0
scroll-conservatively 10000
scroll-preserve-screen-position t
auto-window-vscroll nil)
(setq initial-frame-alist (quote ((fullscreen . maximized))))
(dashboard-setup-startup-hook)
(setq dashboard-startup-banner 'logo)
(setq dashboard-banner-logo-title "Happy Hacking!")
(setq dashboard-items nil)
(setq dashboard-set-footer nil)
(set-frame-font "Menlo-11" nil t)
(add-hook 'prog-mode-hook 'electric-pair-mode)
(setq inhibit-splash-screen t)
(setq ring-bell-function 'ignore)
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(blink-cursor-mode t)
(setq blink-cursor-blinks 0) ;; blink forever
(setq-default indicate-empty-lines t)
(setq-default line-spacing 3)
(setq frame-title-format '("Emacs"))
(add-hook 'prog-mode-hook 'highlight-numbers-mode)
(add-hook 'prog-mode-hook 'highlight-operators-mode)
(add-hook 'prog-mode-hook 'hes-mode) ;; highlight escape sequences
(set-face-attribute 'mode-line nil :font "Roboto-12")
(require 'powerline)
(powerline-center-theme)
(require 'treemacs)
(set-face-attribute 'treemacs-directory-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-directory-collapsed-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-file-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-directory-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-directory-collapsed-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-file-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-root-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-root-unreadable-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-root-remote-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-root-remote-unreadable-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-root-remote-disconnected-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-tags-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-help-title-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-help-column-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-term-node-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-on-success-pulse-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-on-failure-pulse-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-git-unmodified-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-git-modified-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-git-renamed-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-git-ignored-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-git-untracked-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-git-added-face nil :font "Roboto-12")
(set-face-attribute 'treemacs-git-conflict-face nil :font "Roboto-12")
(setq make-backup-files nil)
(setq show-paren-delay 0)
(show-paren-mode 1)
(setq initial-scratch-message nil)
(setq initial-major-mode 'org-mode)
(defun ian/split-and-follow-horizontally ()
"Split window below"
(interactive)
(split-window-below)
(other-window 1))
(defun ian/split-and-follow-vertically ()
"Split window right"
(interactive)
(split-window-right)
(other-window 1))
(global-set-key (kbd "C-x 2") 'ian/split-and-follow-horizontally)
(global-set-key (kbd "C-x 3") 'ian/split-and-follow-vertically)
(which-key-mode t)
(setq which-key-idle-delay 0.4)
(setq which-key-idle-secondary-delay 0.4)
(add-hook 'before-save-hook 'whitespace-cleanup)
(require 'centaur-tabs)
(global-set-key [C-tab] 'centaur-tabs-forward)
(global-set-key [C-S-tab] 'centaur-tabs-backward)
(global-linum-mode 1)
(set-frame-parameter nil 'undecorated t)
(setq auto-save-file-name-transforms
`(("\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'" "~/.emacs-saves/\\2" t)))