Compare commits

..

3 Commits

Author SHA1 Message Date
f7ba06bdbb configure lsp-ui extensions 2026-07-28 23:46:59 +02:00
015ddf877f better aliases (rg + fd) 2026-07-28 23:46:36 +02:00
3b0e07a3cd turn revert lambda into defun 2026-07-28 23:46:19 +02:00
3 changed files with 116 additions and 17 deletions

View File

@@ -10,26 +10,110 @@
("pyls.plugins.pyls_isort.enabled" t t)))
;; disable infantile nonsense
(setq lsp-headerline-breadcrumb-enable nil
(setq lsp-headerline-breadcrumb-enable t
lsp-modeline-code-actions-enable nil)
;; (lsp-enable-which-key-integration t)
:bind
; same prefix space as dumpjump (C-c)
("C-c r" . #'lsp-find-references) ; default: C-c C-l g r
("C-c d" . #'lsp-find-definition) ; default: C-c C-l g g
("C-c n". #'lsp-rename)
;; I am using lsp-ui for this, see below
;; ("C-c r" . #'lsp-find-references) ; default: C-c C-l g r
;; ("C-c d" . #'lsp-find-definition) ; default: C-c C-l g g
;; ;; same as above, but directly within prefix, not 'g neede
;; ("C-c C-l r" . #'lsp-find-references) ; default: C-c C-l g r
;; ("C-c C-l d" . #'lsp-find-definition) ; default: C-c C-l g g
:init
;; I'm not using any of th lsp commands, but better define a prefix
;; than being unable to reach it
;; FIXME: add at least lsp-find-definition
(setq lsp-keymap-prefix "C-c C-l")
(setq lsp-keymap-prefix "C-c C-l"
lsp-log-io nil
lsp-enable-indentation t
lsp-enable-imenu t
lsp-file-watch-threshold 500
lsp-prefer-flymake nil)
:commands lsp)
;; I use ivy
;; (use-package lsp-ivy
;; :commands lsp-ivy-global-workspace-symbol)
;; for lsp code lenses etc
;; https://emacs-lsp.github.io/lsp-ui/
;; FIXME: ⛔ Error (use-package): Failed to install lsp-ui: https://melpa.org/packages/lsp-ui-20250804.2109.tar: Not found
;; manually installed using package-install
(use-package lsp-ui
:ensure t
:after (lsp-mode)
:commands lsp-ui-doc-hide
:bind (:map lsp-ui-mode-map
("C-c d" . #'lsp-ui-peek-find-definitions)
("C-c r" . #'lsp-ui-peek-find-references)
([remap xref-find-definitions] . lsp-ui-peek-find-definitions)
([remap xref-find-references] . lsp-ui-peek-find-references)
;;; ("C-c u" . lsp-ui-imenu) ;; using treemacs for this
("C-c D" . tvd-lsp-doc-toggle))
:init
(setq lsp-ui-doc-enable nil ;; enable on the fly with "C-c D"
lsp-ui-doc-use-webkit nil
lsp-ui-doc-header t
lsp-ui-doc-delay 0.2
lsp-ui-doc-position 'top
lsp-ui-doc-side 'right
lsp-ui-doc-include-signature t
lsp-ui-doc-alignment 'at-point
lsp-ui-doc-use-childframe t
lsp-ui-doc-border (face-foreground 'default)
;; C-c r
lsp-ui-peek-enable t
lsp-ui-peek-show-directory t
lsp-ui-peek-peek-height 40
;; FIXME: maybe this is too much, check at work
lsp-ui-sideline-enable t
lsp-ui-sideline-update-mode 'point
lsp-ui-sideline-show-code-actions nil
lsp-ui-sideline-show-hover t
lsp-ui-sideline-delay 2
lsp-ui-sideline-show-diagnostics nil
lsp-ui-sideline-diagnostic-max-lines t
lsp-ui-sideline-ignore-duplicate t)
:config
(add-to-list 'lsp-ui-doc-frame-parameters '(right-fringe . 8))
(defun tvd-lsp-doc-toggle()
"Toggle lsp-ui-doc, takes effect only on buffer start.
So in order to change in a buffer, reload the buffer after
the toggle with shift-F5."
(interactive)
(setq lsp-ui-doc-enable (not lsp-ui-doc-enable))
(tvd-buffer-reload))
;; `C-g'to close doc
(advice-add #'keyboard-quit :before #'lsp-ui-doc-hide))
;; better recursive refs, symbols, etc
;; see also https://github.com/Alexander-Miller/treemacs
(use-package lsp-treemacs
:after lsp
:bind
("C-c u" . #'lsp-treemacs-symbols)
("C-c C-l c" . #'lsp-treemacs-call-hierarchy))
(use-package treemacs
:bind
("C-c t" . #'treemacs)
:init
(setq
treemacs-project-follow-mode t
treemacs-extra-wide-toggle t
treemacs-follow-mode t))
(provide 'init-lsp)
;;; init-lsp.el ends here

View File

@@ -195,7 +195,8 @@ a remote file anytime and from everywhere I am by just entering :"
(push consult--source-perspective consult-buffer-sources)))
;; needs to be defined outside
(defalias 'egrep 'consult-ripgrep)
(defalias 'rg 'consult-ripgrep)
(defalias 'fd 'consult-fd)
;; change directory while opening a file etc
(use-package consult-dir

View File

@@ -79,17 +79,31 @@
;; F5 == reload file if it has been modified by another process, shift
;; because Xmonad
(global-set-key (kbd "S-<f5>") ; re-read a buffer from disk (revert)
(lambda (&optional force-reverting)
"Interactive call to revert-buffer. Ignoring the auto-save
(defun tvd-buffer-reload(&optional force-reverting)
"Interactive call to revert-buffer. Ignoring the auto-save
file and not requesting for confirmation. When the current buffer
is modified, the command refuses to revert it, unless you specify
the optional argument: force-reverting to true."
(interactive "P")
;;(message "force-reverting value is %s" force-reverting)
(if (or force-reverting (not (buffer-modified-p)))
(revert-buffer :ignore-auto :noconfirm)
(error "The buffer has been modified"))))
(interactive "P")
;;(message "force-reverting value is %s" force-reverting)
(if (or force-reverting (not (buffer-modified-p)))
(revert-buffer :ignore-auto :noconfirm)
(error "The buffer has been modified")))
;; re-read a buffer from disk (revert)
(global-set-key (kbd "S-<f5>") 'tvd-buffer-reload)
;; (lambda (&optional force-reverting)
;; "Interactive call to revert-buffer. Ignoring the auto-save
;; file and not requesting for confirmation. When the current buffer
;; is modified, the command refuses to revert it, unless you specify
;; the optional argument: force-reverting to true."
;; (interactive "P")
;; ;;(message "force-reverting value is %s" force-reverting)
;; (if (or force-reverting (not (buffer-modified-p)))
;; (revert-buffer :ignore-auto :noconfirm)
;; (error "The buffer has been modified"))))