-
Notifications
You must be signed in to change notification settings - Fork 0
/
.emacs
218 lines (177 loc) · 6.91 KB
/
.emacs
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
216
217
218
;; Remove startup screen from emacs
;; (setq inhibit-startup-screen t)
;; start package.el with emacs
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; initialize package.el
(package-initialize)
;; start emacs with a full screen
(add-to-list 'default-frame-alist '(fullscreen . maximized))
;; start auto-complete with emacs
;; package-install: auto-complete
(require 'auto-complete)
;; do default config for auto-complete
(require 'auto-complete-config)
(ac-config-default)
;; start yasnippet with emacs
;; package-install: yasnippet
(require 'yasnippet)
(yas-global-mode t)
(defun my:ac-c-header-init ()
;; (require 'auto-complete-c-header)
;; (add-to-list 'ac-sources 'ac-source-c-headers))
(require 'auto-complete-c-headers)
(add-to-list 'ac-sources 'ac-source-c-headers)
(setq achead:include-directories
(append '("/usr/include/c++/4.8"
"/usr/include/x86_64-linux-gnu/c++/4.8"
"/usr/include/c++/4.8/backward"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/include"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed"
"/usr/include/x86_64-linux-gnu")
achead:include-directories)))
;; now let's call this function from c/c++ hooks
(add-hook 'c++-mode-hook 'my:ac-c-header-init)
(add-hook 'c-mode-hook 'my:ac-c-header-init)
;; Relative line numbers!
;; (require 'linum-relative)
;; (linum-mode)
;; Multiple cursors!!!
;; package-install: multiple-cursors
(require 'multiple-cursors)
(global-set-key (kbd "C-S-v") 'mc/edit-lines)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
;; (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
;; Expand region
;; package-install: expand-region
(require 'expand-region)
(global-set-key (kbd "C-;") 'er/expand-region)
(setq shift-select-mode nil)
;; Aggressive Indent
;; package-install: aggressive-indent
(add-hook 'emacs-lisp-mode-hook #'aggressive-indent-mode)
(add-hook 'css-mode-hook #'aggressive-indent-mode)
;; Windmove (S-up, S-down etc.)
(windmove-default-keybindings)
;; Get rid of ~ files
(setq make-backup-files nil)
;; Ace-Jump-Mode
;; package-install: ace-jump-mode
(require 'ace-jump-mode)
(define-key global-map (kbd "C-'") 'ace-jump-mode)
;; Enable Flycheck
;; package-install: flycheck
(add-hook 'after-init-hook #'global-flycheck-mode)
;; Comment / Uncomment Region key binding
;; package-install: use-package
(bind-keys*
("C-c C-c" . comment-region)
("C-u C-u" . uncomment-region))
;; Keybindings for goto-last-change
(bind-keys*
("C-." . goto-last-change))
;; Keybindings for highlight changes or view whitespacen
;; (bind-keys*
;; ("C-," . minimap-mode))
;; ("C-[" . blank-mode))
;; ("C-," . highlight-changes-mode))
;; minimap on the right
;; (setq minimap-window-location 'right)
;; Turn off scrollbar
(scroll-bar-mode -1)
;; Set Transparency
(set-frame-parameter (selected-frame) 'alpha '(92 . 92))
(add-to-list 'default-frame-alist '(alpha . (92 . 92)))
;; package-install: beacon
(beacon-mode 1)
;; package-install: indent-guide
(indent-guide-global-mode)
;; electric pair
(electric-pair-mode)
;; Better minimize / maximize
(bind-keys*
("C--" . text-scale-decrease)
("C-=" . text-scale-increase))
;; Better minimize / maximize
(bind-keys*
("C-x n" . buffer-menu))
;; set PATH environment variables to match shell
(defun set-exec-path-from-shell-PATH ()
"Set up Emacs' `exec-path' and PATH environment variable to match
that used by the user's shell.
This is particularly useful under Mac OS X and macOS, where GUI
apps are not started from a shell."
(interactive)
(let ((path-from-shell (replace-regexp-in-string
"[ \t\n]*$" "" (shell-command-to-string
"$SHELL --login -c 'echo $PATH'"
))))
(setenv "PATH" path-from-shell)
(setq exec-path (split-string path-from-shell path-separator))))
(set-exec-path-from-shell-PATH)
;; Tide for typescript
(defun setup-tide-mode ()
(interactive)
(tide-setup)
(flycheck-mode +1)
(setq flycheck-check-syntax-automatically '(save mode-enabled))
(eldoc-mode +1)
(tide-hl-identifier-mode +1)
(company-mode +1))
(setq company-tooltip-align-annotations t)
;; formats the buffer before saving
(add-hook 'before-save-hook 'tide-format-before-save)
(add-hook 'typescript-mode-hook #'setup-tide-mode)
;; From M-x customize
(custom-set-variables
;; custom-set-variables 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.
'(ansi-color-faces-vector
[default default default italic underline success warning error])
'(ansi-color-names-vector
["black" "red3" "ForestGreen" "yellow3" "blue" "magenta3" "DeepSkyBlue" "gray50"])
'(beacon-blink-delay 0.15)
'(beacon-blink-duration 0.35)
'(beacon-mode t)
'(beacon-size 50)
'(blink-cursor-mode nil)
'(cursor-type 'box)
'(custom-enabled-themes '(manoj-dark))
'(menu-bar-mode nil)
'(package-selected-packages
'(prettier company tide typescript-mode cmake-mode vterm js2-refactor eslint-fix vue-html-mode vue-mode dumb-jump lorem-ipsum rjsx-mode js2-mode auto-complete-c-headers web-mode-edit-element web-mode elpy indent-guide beacon focus rainbow-delimiters redo+ blank-mode flycheck-color-mode-line flycheck-pycheckers evil-surround evil-magit powerline evil-escape evil evil-visual-mark-mode use-package php-mode magit pkgbuild-mode multi-term paradox racket-mode emmet-mode sed-mode sml-mode tronesque-theme 2048-game chess zone-rainbow zone-nyan rainbow-mode pacmacs flycheck yasnippet multiple-cursors linum-relative expand-region emojify disable-mouse auto-complete aggressive-indent ace-jump-mode))
'(paradox-github-token t)
'(tool-bar-mode nil))
(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.
'(default ((t (:inherit nil :stipple nil :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "PfEd" :family "DejaVu Sans Mono"))))
'(minimap-active-region-background ((t (:background "gray15")))))
;; Set font size
(set-face-attribute 'default nil :height 115)
;; Set Internal Window Borders
(set-fringe-mode 0)
;; Set highlight to cyan
(set-face-attribute 'region nil :background "#00ffff" :foreground "#000000")
;; Set cursor color to orange
(set-cursor-color "#ffa500")
;; Remove bottom mode line
(setq-default mode-line-format nil)
;; Turn on IDO mode
(require 'ido)
(ido-mode t)
;; No tabs
(setq-default indent-tabs-mode nil)
;; Other goodies
;; package-install: pacmacs
;; : zone-rainbow
;; : zone-nyan
;; : 2048-game
;; dumb-jump
;; package-install: dumb-jump
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)