-
Notifications
You must be signed in to change notification settings - Fork 0
/
lsp_emacs.el
322 lines (280 loc) · 8.55 KB
/
lsp_emacs.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
;;; Package --- Summary
;;; Code:
;;; Commentary:
;; __ _ __ _
;; / _| | _____ __ ___ ___ _ __ / _(_) __ _
;; | |_| |/ _ \ \/ / / __/ _ \| '_ \| |_| |/ _` |
;; | _| | __/> < | (_| (_) | | | | _| | (_| |
;; |_| |_|\___/_/\_\ \___\___/|_| |_|_| |_|\__, |
;; |___/
;; Felix Valentini
;; Emcas configuration v.2
;; last update 2024-02-12
(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.
'(aw-leading-char-face ((t (:inherit ace-jump-face-foreground :height 3.0)))))
;; start package.el eith Emacs
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/"))
;; initialize package.el
(package-initialize)
(setq inhibit-startup-screen t)
;; Disable tool-bar
(tool-bar-mode -1)
;; enable whitespace-mode
;; (require 'whitespace)
;; (global-whitespace-mode 1)
(transient-mark-mode 1) ;; No region when it is not highlighted
(delete-selection-mode 1)
(global-set-key (kbd "C-;") 'comment-or-uncomment-region)
;; save annoying backupfiles outside of the working directories
(setq backup-directory-alist '(("." . "~/.emacs.d/backup")))
(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)
(add-to-list 'image-types 'svg)
;; use spaces instead of tab, to convert tabbed document to spaced one selct the whole doc (C-x h; M-x unatbify)
(setq-default indent-tabs-mode nil)
;; Editor plug ins
(use-package counsel
:ensure t)
(use-package swiper
:ensure t
:config
(progn
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
;; enable this if you want `swiper' to use it
;; (setq search-default-mode #'char-fold-to-regexp)
(global-set-key "\C-s" 'swiper)
(global-set-key (kbd "C-c C-r") 'ivy-resume)
(global-set-key (kbd "<f6>") 'ivy-resume)
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
(global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
(global-set-key (kbd "C-c g") 'counsel-git)
(global-set-key (kbd "C-c j") 'counsel-git-grep)
(global-set-key (kbd "C-c k") 'counsel-ag)
(global-set-key (kbd "C-x l") 'counsel-locate)
(global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)))
;; theme
(use-package doom-themes
:ensure t
:config
;; Global settings (defaults)
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
doom-themes-enable-italic t) ; if nil, italics is universally disabled
(load-theme 'doom-one t)
;; Enable flashing mode-line on errors
(doom-themes-visual-bell-config)
;; or for treemacs users
(setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme
(doom-themes-treemacs-config)
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config))
;; M-x all-the-icons-fonts to install them!
(use-package all-the-icons
:ensure t)
;; disable scroll-bar
(scroll-bar-mode -1)
(menu-bar-mode -1)
;; Mod line configuration, used package: spaceline
(use-package spaceline
:ensure t
:config
(require 'spaceline-config)
(spaceline-emacs-theme))
;; nyan-mode for mod line
(use-package nyan-mode
:ensure t
:config
(require 'nyan-mode)
(nyan-mode t))
;; font scaling
(use-package default-text-scale
:ensure t
:config
(global-set-key (kbd "C-M-=") 'default-text-scale-increase)
(global-set-key (kbd "C-M--") 'default-text-scale-decrease))
(define-key ctl-x-map [(control ?0)] 'zoom-in/out)
;; line numeration
(use-package linum-relative
:ensure t
:config
(require 'linum-relative)
(linum-relative-global-mode t)
(setq linum-relative-backend 'display-line-numbers-mode))
;; window management
(use-package ace-window
:ensure t
:init
(progn
(global-set-key [remap other-window] 'ace-window)
(custom-set-faces
'(aw-leading-char-face
((t (:inherit ace-jump-face-foreground :height 3.0))))) 121))
(use-package highlight-numbers
:ensure t
:hook (prog-mode-hook . highlight-numbers-mode))
(use-package emojify
:ensure t
:hook (after-init-hook #'global-emojify-mode))
(use-package smartparens
:ensure t
:hook (prog-mode . smartparens-mode)
:config
(smartparens-global-mode t)
(show-smartparens-global-mode t)
(require 'smartparens-config))
(use-package rainbow-delimiters
:ensure t
:hook (prog-mode . rainbow-delimiters-mode))
;; shows directories
(use-package neotree
:ensure t
:config
(require 'neotree)
(global-set-key [f8] 'neotree-toggle)
(setq neo-theme (if (display-graphic-p) 'icons 'arrow)))
(setq-default indent-tabs-mode nil)
;; shows bindings options
(use-package which-key
:ensure t
:config
(which-key-mode))
(use-package multiple-cursors
:ensure t
:config
(require 'multiple-cursors)
(global-set-key (kbd "C-S-c C-S-c") '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))
;; Programming plug-ins
;; git interface
(use-package magit
:ensure t)
;; project manager
(use-package projectile
:ensure t
:config
(projectile-mode +1)
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(define-key projectile-mode-map (kbd "C-c f") 'projectile-find-file))
;; syntax checker
(use-package flycheck
:ensure t
:init
(global-flycheck-mode t)
:config
;; customize flycheck temp file prefix
(setq-default flycheck-temp-prefix ".flycheck")
;; disable json-jsonlist checking for json files
(setq-default flycheck-disabled-checkers
(append flycheck-disabled-checkers
'(json-jsonlist))))
(use-package highlight-indentation
:ensure t
:config
(set-face-background 'highlight-indentation-face "#536878")
(set-face-background 'highlight-indentation-current-column-face "#657E91"))
;; synatx templates
(use-package yasnippet
:ensure t
:init
(yas-global-mode 1))
(use-package yasnippet-snippets
:ensure t)
;; lisp flavoured python
(use-package hy-mode
:ensure t
:mode "\\.hy\\'")
;; javascript stuff
;; rest api tester
(use-package restclient
:ensure t
:mode (("\\.http\\'" . restclient-mode)))
(use-package prettier-js
:ensure t
:after (rjsx-mode)
:hook (rjsx-mode . prettier-js-mode))
;; json utilities
(use-package json-snatcher
:ensure t
:config
(require 'json-snatcher))
(use-package json-mode
:ensure t
:mode "\\.json\\'")
;; yaml utilities
(use-package yaml-mode
:ensure t
:mode "\\.yml\\'"
:config
(add-hook 'yaml-mode-hook 'highlight-indentation-mode))
;; Dockerfile mode
(use-package dockerfile-mode
:ensure t
:config
(require 'dockerfile-mode)
(add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)))
(use-package geiser
:ensure t)
;; modern list API fir emacs-lisp
(use-package dash
:ensure t)
;; string manipulation API for emacs-lisp
(use-package s
:ensure t)
(use-package f
:ensure t)
;; lisp utility
(use-package paredit
:ensure t)
;; Text manipulation and utilities
;; org-mode stuff
(use-package org-bullets
:ensure t
:config
(require 'org-bullets)
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
(use-package dart-mode
:ensure t)
(use-package company
:ensure t)
(use-package protobuf-mode
:ensure t)
(use-package vue-mode
:mode "\\.vue\\'")
(use-package kotlin-mode
:ensure t)
(use-package eglot
:ensure t
:hook ((dart-mode . eglot-ensure))
:custom
(eglot-ignored-server-capabilities
'(:inlayHintProvider)))
(use-package jenkins
:ensure t)
;;; .emacs ends here