-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.el
55 lines (45 loc) · 1.7 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
(use-package! lsp-bridge
:config
;; for muscle memory to save buffer
(defun my/save-buffer ()
(interactive)
(if lsp-bridge-remote-file-flag
(call-interactively #'lsp-bridge-remote-save-buffer)
(call-interactively #'save-buffer)))
(map! "C-x C-s" #'my/save-buffer))
(use-package! flymake-bridge
:after lsp-bridge
:hook (lsp-bridge-mode . flymake-bridge-setup))
(map! :after flymake
"M-n" #'flymake-goto-next-error
"M-p" #'flymake-goto-prev-error)
(after! tramp
(add-to-list 'tramp-remote-path "~/.nix-profile/bin")
(add-to-list 'tramp-remote-path 'tramp-own-remote-path))
(use-package! apheleia
:after lsp-bridge
:config
;; don't mess up with lsp-mode
(setq +format-with-lsp nil)
(setq apheleia-remote-algorithm 'remote))
(use-package! topsy
:after lsp-bridge
:config
;; display a bar to remind editing remote file
(setcdr (assoc nil topsy-mode-functions)
(lambda ()
(when (lsp-bridge-is-remote-file) "[LBR] REMOTE FILE")))
;; do not activate when the current major mode is org-mode
(add-hook 'lsp-bridge-mode-hook (lambda ()
(unless (derived-mode-p 'org-mode)
(topsy-mode 1)))))
(after! vterm
(defun my/set-vterm-shell ()
(when (string-prefix-p "/docker:" (file-remote-p default-directory))
(when (eq major-mode 'vterm-mode)
(let ((shell (if (string-prefix-p "/docker:" (file-remote-p default-directory))
"/bin/bash"
(or (getenv "SHELL") "/bin/bash"))))
(vterm-send-string (format "exec %s\n" shell))
(vterm-send-string "clear\n")))))
(add-hook 'vterm-mode-hook #'my/set-vterm-shell))