This repository has been archived by the owner on Nov 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
init.el
382 lines (346 loc) · 8.96 KB
/
init.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
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
;; init.el --- Initialization file for Emacs
;; Author: Mike Wall
;; URL: https://github.com/mjwall/emacs.d
;;; Commentary:
;; File loads init-min.el then adds packages
;;; Code:
;; load the minimum config file
(load (expand-file-name "init-min.el" user-emacs-directory))
;; Now add some packages
(package-initialize)
;; https://debbugs.gnu.org/34341, fixed in 26.3
;; uncomment and C-x C-e to eval
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
;; use-package - https://github.com/jwiegley/use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
;; To debug any macro (including the use-package expandsion)
;; go the end of the macro, then run `eval-last-sexp' (C-x C-e) which
;; will expand that macro, then run `pp-macroexpand-last-sexp' which
;; writes the output to a new buffer
;;(setq
;; use-package-verbose 'debug
;; use-package-expand-minimally nil)
(require 'cl)
(use-package company
:ensure t
)
(use-package flycheck
:ensure t
)
(use-package lsp-mode
:ensure t
:init
(setq
lsp-enable-snippet nil
lsp-session-file (expand-file-name ".lsp-session-v1" temp-dir))
)
(use-package company-lsp
:ensure t
)
(use-package dap-mode
:ensure t)
;; java
;; can run the following if you need a .project
;; mvn org.apache.maven.plugins:maven-eclipse-plugin:2.10:eclipse
;; To start lsp, M-x lsp-workspace-folder-add (first time) then
;; C-u M-x lsp
;; choose jdtls
(use-package lsp-java
:ensure t
:after lsp
:init
(setq
lsp-java-server-install-dir (expand-file-name "lsp/jdtls" user-emacs-directory)
dap-java-test-runner (expand-file-name "lsp/jdtls/eclipse.jdt.ls/test-runner/junit-platform-console-standalone.jar" user-emacs-directory)
)
)
;; C-u M-x lsp, choose jdtls
;;:hook
;;(java-mode . lsp)
(use-package autodisass-java-bytecode
:ensure t
)
;; python
;;(use-package python
;; :ensure t
;; )
(setq python-indent-offset 2)
(when (executable-find "ipython")
(setq
python-shell-interpreter "ipython"
python-shell-interpreter-args "--simple-prompt -i"
))
(use-package pyenv-mode
:ensure t
:config
(pyenv-mode)
)
(use-package virtualenvwrapper
:ensure t
:config
(venv-initialize-interactive-shells)
(venv-initialize-eshell)
;; note that setting `venv-location` is not necessary if you
;; use the default location (`~/.virtualenvs`), or if the
;; the environment variable `WORKON_HOME` points to the right place
;; (setq venv-location "/path/to/your/virtualenvs/")
;:after (pyenv-mode)
)
(use-package cython-mode
:ensure t
:mode (("\\.py[xdi]" . cython-mode))
)
(use-package lsp-python-ms
:ensure t
:init
(setq
lsp-python-ms-dir (expand-file-name "lsp/mspyls/" user-emacs-directory)
)
)
;; C-u M-x lsp and choose lsp-python-ms
;; could also add auto hook
;;:hook
;; (python-mode .
;; (lambda () (require 'lsp-python-ms) (lsp))
;; )
;; golang
;; - https://github.com/dominikh/go-mode.el (guru and rename too)
(use-package go-mode
;; go get -u -v golang.org/x/tools/cmd/goimports
;; go get -u -v github.com/rogpeppe/godef
;; go get -u -v https://github.com/zmb3/gogetdoc
:ensure nil
:config
(setq
gofmt-command "goimports"
;; https://github.com/dominikh/go-mode.el/issues/262
godoc-at-point-function 'godoc-gogetdoc
imenu-generic-expression
'(("type" "^type *\\([^ \t\n\r\f]*\\)" 1)
("func" "^func *\\(.*\\) {" 1)))
(speedbar-add-supported-extension ".go")
:bind
(:map go-mode-map
([remap find-tag] . godef-jump)
("C-c d" . godoc-at-point)
("C-c g" . godoc))
:hook
((go-mode . electric-pair-mode)
(before-save . gofmt-before-save)))
(use-package gotest
:ensure nil
:bind
(:map go-test-mode-map
("C-c ," . go-test-current-file)
("C-c C-," . go-test-current-file)
))
;; go get golang.org/x/tools/gopls, then
;; C-u M-x lsp and select gopls
;; js2 and json
;; - https://github.com/mooz/js2-mode
;; - https://github.com/joshwnj/json-mode
(use-package js2-mode
:ensure t
:mode "\\.js\\'"
:interpreter "node"
:init
(setq js-indent-level 2) ;; defalias js2-basic-off in > 25.0
:config
)
(use-package json-mode
:ensure t
)
;; lsp use typescript-language-server
;; typescript
;; - https://github.com/ananthakumaran/typescript.el
;; - https://github.com/AdamNiederer/ng2-mode
(use-package typescript-mode
:ensure t
:defer t
:init
(setf typescript-indent-level js-indent-level)
)
(use-package ng2-mode
:ensure t
:after (typescript-mode)
)
;; npm i -g typescript-language-server; npm i -g typescript
;; kotlin
;; - https://github.com/Emacs-Kotlin-Mode-Maintainers/kotlin-mode
(use-package kotlin-mode
:ensure t
)
;; git submodule update to checkout https://github.com/fwcd/kotlin-language-server
;; then
;; ./gradlew :server:installDist
;; then add ~/.emacs.d/lsp/kotlin-language-server/server/build/install/server/bin to PATH
;; bash
(use-package sh-script
:init
(setq sh-basic-offset 2))
;; c/c++
;; for c++ 14 look at cquery, for c++ 17 look at ccls
(use-package cc-mode
:init
(setq tab-width 2
c-basic-offset 2))
;; sudo apt install clang-tools-7
;; which clangd-7
(setq lsp-clients-clangd-executable "clangd-7")
;; too much setup, but looked like a nicer option
;; (use-package ccls
;; :init
;; (setq ccls-executable (expand-file-name "lsp/ccls/bin/ccls" user-emacs-directory))
;; :config
;; ;;:hook ((c-mode c++-mode objc-mode) .
;; ;; (lambda () (require 'ccls) (lsp)))
;; )
;; make/cmake
;; - https://melpa.org/#/cmake-mode
;; which points inside https://github.com/Kitware/CMake/
(use-package cmake-mode
:ensure t
)
;; docker
;; derived from http://manuel-uberti.github.io/emacs/2017/10/19/docker/
;; - https://github.com/spotify/dockerfile-mode
(use-package dockerfile-mode
:ensure t
)
;; - https://github.com/meqif/docker-compose-mode
(use-package docker-compose-mode
:ensure t
)
;; - https://github.com/emacs-pe/docker-tramp.el
(use-package docker-tramp
:ensure t
)
;; ruby
;; derived https://github.com/howardabrams/dot-files/blob/master/emacs-ruby.org
(use-package ruby-mode
:mode "\\.rb\\'"
:mode "Rakefile\\'"
:mode "Gemfile\\'"
:mode "Berksfile\\'"
:mode "Vagrantfile\\'"
:interpreter "ruby"
:init
(setq ruby-indent-level 2
ruby-indent-tabs-mode nil))
;; - https://github.com/senny/rvm.el
(use-package rvm
:ensure t
:config
(rvm-use-default))
;; - https://github.com/fxbois/web-mode
(use-package web-mode
:ensure t
:mode "\\.erb\\'")
;; - https://github.com/nonsequitur/inf-ruby
(use-package inf-ruby
:ensure t
:init
(add-hook 'ruby-mode-hook 'inf-ruby-minor-mode))
;; ruby lsp uses https://github.com/castwide/solargraph
;; xml/html
(use-package nxml-mode
:init
(setq nxml-slash-auto-complete-flag t)
(fset 'html-mode 'nxml-mode))
;; julia
;; - https://github.com/JuliaEditorSupport/julia-emacs
(use-package julia-mode
:ensure t
)
;; scala
;; - https://github.com/ensime/emacs-scala-mode
(use-package scala-mode
:ensure t
)
;; clojure
;; - https://github.com/clojure-emacs/clojure-mode
(use-package clojure-mode
:ensure t
)
;; lua
;; - https://github.com/immerrr/lua-mode
(use-package lua-mode
:ensure t
)
;; elisp - built in
(use-package emacs-lisp-mode
:init
(setq lisp-indent-offset 2)
:bind (("M-." . find-function-at-point)
("M-&" . complete-symbol))
:interpreter (("emacs" . emacs-lisp-mode)))
(use-package eldoc
:hook ((emacs-lisp-mode . turn-on-eldoc-mode)))
(use-package ert
:init
(add-to-list 'emacs-lisp-mode-hook 'ert--activate-font-lock-keywords))
;; octave - built in
(use-package octave)
;; R
;; - https://ess.r-project.org/
(use-package ess
:ensure t
:defer t
;;:init (require 'ess-site)
)
;; thrift
;; - https://github.com/davidmiller/thrift-mode
(use-package thrift
:ensure t
)
;; protobuf
;; - https://melpa.org/#/protobuf-mode
;; which points inside https://github.com/protocolbuffers/protobuf
(use-package protobuf-mode
:ensure t
)
;; groovy
;; - https://github.com/Groovy-Emacs-Modes/groovy-emacs-modes
(use-package groovy-mode
:ensure t
:config
(setq groovy-indent-offset 2))
;; gradle
;; - https://github.com/jacobono/emacs-gradle-mode
;;(use-package gradle-mode
;; :ensure nil
;; :init
;; (setq gradle-use-gradlew 1))
;; my-gradle
;; in site-lisp but copied from emacs-gradle-mode in elpa
(use-package my-gradle-mode
:init
(set-variable 'gradle-use-gradlew 1))
(use-package flycheck-gradle
:ensure nil
:commands (flycheck-gradle-setup)
:init
(mapc
(lambda (x)
(add-hook x #'flycheck-gradle-setup))
'(java-mode-hook kotlin-mode-hook)))
;; yaml
;; - https://github.com/yoshiki/yaml-mode
(use-package yaml-mode
:ensure t
)
;; jflex
;; in site-lisp from http://jflex.de/jflex-mode.el
(use-package jflex-mode)
;; markdown
;; - https://github.com/jrblevin/markdown-mode
(use-package markdown-mode
:ensure t
)
(provide 'init)
;;; init.el ends here