Fix tramp eglot stuff
This commit is contained in:
parent
89e010474f
commit
b374fc57e2
49
init.el
49
init.el
@ -268,6 +268,12 @@ Interactively, force the recompile if called with a prefix."
|
||||
(connection-local-set-profile-variables
|
||||
'error-only
|
||||
'((tramp-verbose . 1)))
|
||||
(connection-local-set-profile-variables
|
||||
'enable-dir-locals
|
||||
'((enable-remote-dir-locals . t)))
|
||||
(connection-local-set-profile-variables
|
||||
'apheleia-remote-local
|
||||
'((apheleia-remote-algorithm . local)))
|
||||
(dolist (method '("podman" "docker" "ssh" "sshx" "sudo" "su" "doas"
|
||||
"sudoedit" "run0" "kubernetes" "dockercp" "podmancp"
|
||||
"distrobox" "toolbox" "flatpak" "apptainer" "nspawn"))
|
||||
@ -276,7 +282,8 @@ Interactively, force the recompile if called with a prefix."
|
||||
(tramp-enable-method (intern method)))
|
||||
(connection-local-set-profiles
|
||||
`(:method ,method)
|
||||
'error-only 'direct-async)))
|
||||
'error-only 'direct-async 'enable-dir-locals
|
||||
'apheleia-remote-local)))
|
||||
|
||||
(use-package midnight
|
||||
:ensure nil
|
||||
@ -727,8 +734,7 @@ With NO-EWW, don't update eww's state."
|
||||
'evil-cp-insert-at-end-of-form)
|
||||
(keymap-unset evil-cleverparens-mode-map "<normal-state> M-o" t)
|
||||
(defun my/-enable-evil-cleverparens ()
|
||||
(if (member major-mode '(lisp-mode emacs-lisp-mode
|
||||
lisp-interaction-mode))
|
||||
(if (derived-mode-p 'lisp-data-mode)
|
||||
(evil-cleverparens-mode 1)
|
||||
(electric-pair-local-mode 1)))
|
||||
(cl-defun my/range-inside-thing-p (thing beg end &optional no-edge)
|
||||
@ -781,7 +787,7 @@ With NO-EDGE, return nil if beg or end fall on the edge of the range."
|
||||
|
||||
;; better lisp editing
|
||||
(use-package adjust-parens
|
||||
:hook (prog-mode . adjust-parens-mode)
|
||||
:hook (lisp-data-mode . adjust-parens-mode)
|
||||
:config
|
||||
(defun my/lisp-indent-adjust-parens ()
|
||||
"Like `lisp-indent-adjust-parens', but got to first char on line first.
|
||||
@ -1428,6 +1434,20 @@ With PROJECT, give diagnostics for all buffers in the current project."
|
||||
(setq eglot-autoshutdown t
|
||||
eglot-ignored-server-capabilities '(:documentOnTypeFormattingProvider))
|
||||
:config
|
||||
;; Fix directory local variables in remote buffers
|
||||
(defun my/-eglot-fix-dir-locals-in-remote-dirs (oldfun server &optional path)
|
||||
(if (not (file-remote-p (or path default-directory)))
|
||||
(funcall oldfun server path)
|
||||
(cl-letf (((default-value 'enable-remote-dir-locals)
|
||||
(let ((default-directory (if path (if (file-directory-p path)
|
||||
(file-name-as-directory path)
|
||||
(file-name-directory path))
|
||||
default-directory)))
|
||||
(connection-local-value enable-remote-dir-locals))))
|
||||
(funcall oldfun server path))))
|
||||
(advice-add 'eglot--workspace-configuration-plist :around
|
||||
#'my/-eglot-fix-dir-locals-in-remote-dirs)
|
||||
|
||||
(add-to-list 'eglot-server-programs
|
||||
(cons '(c-mode c-ts-mode c++-mode c++-ts-mode objc-mode)
|
||||
'("clangd" "--all-scopes-completion" "--background-index"
|
||||
@ -1449,6 +1469,8 @@ With PROJECT, give diagnostics for all buffers in the current project."
|
||||
(use-package apheleia
|
||||
:defer nil
|
||||
:bind ("C-c o" . apheleia-format-buffer)
|
||||
:custom
|
||||
(apheleia-formatters-respect-fill-column t)
|
||||
:init
|
||||
(add-to-list 'auto-mode-alist `(,(rx "/.clang-format" eos) . yaml-ts-mode))
|
||||
(defun my/apheleia-disable-in-current-buffer ()
|
||||
@ -1825,9 +1847,13 @@ otherwise, call `bibtex-find-text'."
|
||||
:after eglot)
|
||||
|
||||
;; python-ts-mode
|
||||
(use-package python-ts-mode
|
||||
(use-package python
|
||||
:ensure nil
|
||||
:hook (python-ts-mode . my/eglot-if-trusted))
|
||||
:hook ((python-ts-mode . my/eglot-if-trusted)
|
||||
(python-ts-mode . my/-setup-python-ts-mode))
|
||||
:config
|
||||
(defun my/-setup-python-ts-mode ()
|
||||
(setq-local fill-column 79)))
|
||||
;; python virtual environments
|
||||
(use-package pyvenv)
|
||||
(use-package pyenv-mode)
|
||||
@ -1965,6 +1991,7 @@ otherwise, call `bibtex-find-text'."
|
||||
(require 'cmake-mode)
|
||||
(require 'cmake-ts-mode)
|
||||
(with-eval-after-load 'cmake-mode
|
||||
(add-hook 'cmake-ts-mode-hook #'my/eglot-if-trusted)
|
||||
(setq cmake-ts-mode-indent-offset tab-width))
|
||||
|
||||
;; kdl
|
||||
@ -2498,12 +2525,20 @@ Actually, return the method name."
|
||||
("M-o" . ace-window)
|
||||
:map eat-eshell-semi-char-mode-map
|
||||
("M-o" . ace-window))
|
||||
:hook
|
||||
(eat-mode . my/-setup-eat-mode)
|
||||
:init
|
||||
(evil-define-key 'insert eat-semi-char-mode-map
|
||||
(kbd "<escape>") #'eat-self-input
|
||||
(kbd "C-S-n") #'evil-normal-state
|
||||
(kbd "C-y") #'eat-yank)
|
||||
(kbd "C-y") #'eat-yank
|
||||
(kbd "C-u") #'universal-argument
|
||||
(kbd "C-w") evil-window-map)
|
||||
:config
|
||||
(defun my/-setup-eat-mode ()
|
||||
(visual-wrap-prefix-mode -1)
|
||||
(visual-line-mode -1))
|
||||
|
||||
;; The below makes sure that the first time the ESC key is pressed, it does
|
||||
;; what it is supposed to
|
||||
(add-hook 'eat--semi-char-mode-hook #'evil-normalize-keymaps)
|
||||
|
Loading…
x
Reference in New Issue
Block a user