-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.emacs.old
224 lines (187 loc) · 7.76 KB
/
.emacs.old
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
219
220
221
222
223
224
(require 'package)
;(require 'quelpa-use-package)
; List the packages you want
(setq package-list '(evil
evil-leader))
; Add Melpa as the default Emacs Package repository
; only contains a very limited number of packages
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
; Activate all the packages (in particular autoloads)
(package-initialize)
; Update your local package index
(unless package-archive-contents
(package-refresh-contents))
;; use-package precheck
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(require 'use-package)
(setq use-package-verbose t)
; Install all missing packages
(dolist (package package-list)
(unless (package-installed-p package)
(package-install package)))
;; ------------------ GLOBAL CONFIG ----------------------------
(global-undo-tree-mode 1)
(global-nlinum-mode 1)
(setq nlinum-format "%d ")
(electric-indent-mode nil)
;; ------------------- REQURE PACKAGES -------------------------
(setq column-number-mode t)
(setq evil-want-C-u-scroll t)
(require 'evil)
(evil-mode t)
(setq evil-want-fine-undo 'fine)
(require 'evil-leader)
(global-evil-leader-mode)
(evil-leader/set-leader ",")
(evil-leader/set-key
"b" 'switch-to-buffer
"w" 'save-buffer
"W" 'save-buffer)
(define-key evil-insert-state-map (kbd "C-c") 'evil-normal-state) ;; TODO: change this to something different if it breaks main functionality
(define-key evil-normal-state-map (kbd "C-c") 'evil-normal-state) ;; TODO: change this to something different if it breaks main functionality
;; Fix for $ not going to newline
(define-key evil-visual-state-map (kbd "$")
(lambda() (interactive)
(evil-end-of-line) ; to end of line (including newline)
(evil-backward-char) ; back to second to last visible character (weird)
(evil-forward-char))) ; forward to last visible character
;;(define-key evil-insert-state-map (kbd "TAB") 'tab-to-tab-stop)
;; Global Key Settings
(global-set-key (kbd "C-c") nil) ;; TODO: remove me if you notice any weird behaviour related to Ctrl
(global-set-key (kbd "C-x f") 'ido-find-file)
;; Evil-Mode word in vim is not capturing underscores (the following entries are the fix
(defadvice evil-inner-word (around underscore-as-word1 activate)
(let ((table (copy-syntax-table (syntax-table))))
(modify-syntax-entry ?_ "w" table)
(with-syntax-table table
ad-do-it)))
(defadvice evil-forward-word-begin (around underscore-as-word2 activate)
(let ((table (copy-syntax-table (syntax-table))))
(modify-syntax-entry ?_ "w" table)
(with-syntax-table table
ad-do-it)))
(defadvice evil-forward-word-end (around underscore-as-word3 activate)
(let ((table (copy-syntax-table (syntax-table))))
(modify-syntax-entry ?_ "w" table)
(with-syntax-table table
ad-do-it)))
(defadvice evil-backward-word-end (around underscore-as-word4 activate)
(let ((table (copy-syntax-table (syntax-table))))
(modify-syntax-entry ?_ "w" table)
(with-syntax-table table
ad-do-it)))
(defadvice evil-backward-word-end (around underscore-as-word5 activate)
(let ((table (copy-syntax-table (syntax-table))))
(modify-syntax-entry ?_ "w" table)
(with-syntax-table table
ad-do-it)))
(defadvice evil-a-word (around underscore-as-word6 activate)
(let ((table (copy-syntax-table (syntax-table))))
(modify-syntax-entry ?_ "w" table)
(with-syntax-table table
ad-do-it)))
(evil-ex-define-cmd "W" #'evil-write)
(evil-ex-define-cmd "Q" #'evil-quit)
;; ------------------ USE-PACKAGE MODULES -----------------------
;; Major mode for OCaml programming
;;(use-package tuareg
;; :ensure t
;; :mode (("\\.ocamlinit\\'" . tuareg-mode)))
;; Major mode for editing Dune project files
(use-package dune
:ensure t)
;; Merlin provides advanced IDE features
;;(use-package merlin
;; :ensure t
;; :config
;; (add-hook 'tuareg-mode-hook #'merlin-mode)
;; (add-hook 'merlin-mode-hook #'company-mode)
;; ;; we're using flycheck instead
;; (setq merlin-error-after-save nil)
;; (setq merlin-command "<PREFIX>/bin/ocamlmerlin"))
(use-package merlin-eldoc
:ensure t
:hook ((reason-mode tuareg-mode caml-mode) . merlin-eldoc-setup))
;; This uses Merlin internally
(use-package flycheck-ocaml
:ensure t
:config
(flycheck-ocaml-setup))
(use-package idomenu
:ensure t
:config
(setq ido-enable-flex-matching t)
(setq ido-everywhere t))
(ido-mode 1)
;; better Vim-like undo
(use-package undo-tree
:config
(undo-tree-mode 1))
(define-key evil-normal-state-map (kbd "u") 'undo-tree-undo)
(define-key evil-normal-state-map (kbd "C-r") 'undo-tree-redo)
;; --------------- GENERATED CONFIGS ------------------------
(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.
'(company-minimum-prefix-length 100)
'(eldoc-idle-delay 0.5)
'(package-selected-packages
'(ocamlformat editorconfig quelpa-use-package quelpa eglot docker haskell-emacs yaml-pro proof-general coq-commenter blacken jedi python-mode markdown-mode yaml yaml-mode haskell-tab-indent haskell-mode tmux-pane merlin-eldoc company idomenu flycheck-ocaml merlin dune tuareg cmake-mode use-package undo-tree nlinum evil-leader)))
(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.
'(merlin-eldoc-occurrences-face ((t (:background "dim gray" :inverse-video t)))))
;; ## added by OPAM user-setup for emacs / base ## 56ab50dc8996d2bb95e7856a6eddb17b ## you can edit, but keep this line
(require 'opam-user-setup "~/.emacs.d/opam-user-setup.el")
;; ## end of OPAM user-setup addition for emacs / base ## keep this line
;; ------------------- EXTRA ---------------------------------
(add-hook 'tuareg-mode-hook 'merlin-eldoc-setup)
;; sending reload objects to tmux for OCAML dev
(defvar load_command "#use \"bin/main.ml\";;" "")
(defun load_main_to_utop () "Run rake routes under Zeus" (interactive)
(shell-command (format "tmux send-keys -t bottom '%s;'; tmux send-keys -t bottom Enter" load_command)))
(defun save_and_exit_evil_mode ()
"save and exit evil mode insert"
(interactive)
(save-buffer)
(evil-normal-state))
(global-set-key [f8] 'save_and_exit_evil_mode)
(global-set-key [f9] 'load_main_to_utop)
(add-to-list 'load-path "/Users/darchitect/.opam/default/share/emacs/site-lisp")
(require 'ocp-indent)
;; comment out both of these if you want more modern autocomplete on every char instead of TAB
(global-set-key (kbd "TAB") 'company-complete-common-or-cycle)
(let ((map company-active-map))
(define-key map (kbd "TAB") 'company-complete-common-or-cycle))
;; clean whitespace when saving except fundamental mode
(add-hook 'before-save-hook
(lambda ()
(unless (eq major-mode 'fundamental-mode)
(delete-trailing-whitespace))))
(add-to-list 'default-frame-alist '(background-color . "gray8"))
(add-hook 'before-save-hook 'ocp-indent-buffer
(merlin-mode))
;; setup python stuff
(add-hook 'python-mode-hook
(lambda ()
(setq indent-tabs-mode t)
(setq tab-width 4)
(setq python-indent-offset 4)))
(defun my-python-mode-action ()
(make-local-variable 'before-save-hook)
(add-hook 'before-save-hook (lambda ()
(save-restriction
(widen)
(untabify (point-min) (point-max))))))
(add-hook 'python-mode-hook 'my-python-mode-action)
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; underscore is a word
(modify-syntax-entry ?_ "w")