Improve usability of lsp-peek

Add keybinds and theme
This commit is contained in:
outfoxxed 2022-12-01 02:29:19 -08:00
parent 2c12aec78d
commit e39ef67ce2
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
2 changed files with 28 additions and 6 deletions

20
init.el
View file

@ -176,14 +176,26 @@
(setq lsp-headerline-breadcrumb-enable nil) (setq lsp-headerline-breadcrumb-enable nil)
(setq lsp-signature-auto-activate nil) (setq lsp-signature-auto-activate nil)
(setq lsp-signature-doc-lines 0) (setq lsp-signature-doc-lines 0)
(setq lsp-ui-doc-show-with-cursor t)
(setq lsp-ui-doc-position 'top)
(setq lsp-ui-doc-delay 0.5)
:config :config
(evil-define-key 'normal lsp-mode-map (kbd "SPC l") lsp-command-map) (evil-define-key 'normal lsp-mode-map (kbd "SPC l") lsp-command-map)
(add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration) (add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration)
(add-hook 'evil-insert-state-entry-hook #'lsp-signature-activate) (add-hook 'evil-insert-state-entry-hook #'lsp-signature-activate)
(add-hook 'evil-insert-state-exit-hook #'lsp-signature-stop)) (add-hook 'evil-insert-state-exit-hook #'lsp-signature-stop))
(use-package lsp-ui) (use-package lsp-ui
:init
(setq lsp-ui-doc-show-with-cursor t)
(setq lsp-ui-doc-position 'top)
(setq lsp-ui-doc-delay 0.5)
:config
(define-key lsp-ui-mode-map [remap xref-find-definitions] #'lsp-ui-peek-find-definitions)
(define-key lsp-ui-mode-map [remap xref-find-references] #'lsp-ui-peek-find-references)
(define-key evil-normal-state-map (kbd "SPC d") #'lsp-ui-peek-find-definitions)
(define-key evil-normal-state-map (kbd "SPC r") #'lsp-ui-peek-find-references)
;; Controls inside references popup
(define-key lsp-ui-peek-mode-map (kbd "j") #'lsp-ui-peek--select-next)
(define-key lsp-ui-peek-mode-map (kbd "k") #'lsp-ui-peek--select-prev)
(define-key lsp-ui-peek-mode-map (kbd "J") #'lsp-ui-peek--select-next-file)
(define-key lsp-ui-peek-mode-map (kbd "K") #'lsp-ui-peek--select-prev-file)
(define-key lsp-ui-peek-mode-map (kbd "o") #'lsp-ui-peek--goto-xref))
(setq gc-cons-threshold (* 1024 1024 100)) (setq gc-cons-threshold (* 1024 1024 100))
(setq read-process-output-max (* 1024 1024)) (setq read-process-output-max (* 1024 1024))

View file

@ -53,6 +53,7 @@
(common-fg '("#b7c9ee" "white" "white")) (common-fg '("#b7c9ee" "white" "white"))
(common-bg '("#0d1017" "black" "black")) (common-bg '("#0d1017" "black" "black"))
(modeline '("#156570" nil nil)) (modeline '("#156570" nil nil))
(highlight (funcall brighten-first common-bg 0.15))
(comment '("#384345" nil nil)) (comment '("#384345" nil nil))
(doc '("#6a866f" nil nil)) (doc '("#6a866f" nil nil))
(keyword '("#349672" nil nil)) (keyword '("#349672" nil nil))
@ -64,6 +65,8 @@
(lsp-hover-highlight (funcall brighten-first common-bg 0.05)) (lsp-hover-highlight (funcall brighten-first common-bg 0.05))
(company-bg (funcall brighten-first common-bg 0.1)) (company-bg (funcall brighten-first common-bg 0.1))
(peek-code '("#0e151a" nil nil))
;; Extra colors #1fa345 ;; Extra colors #1fa345
) )
(custom-theme-set-faces (custom-theme-set-faces
@ -75,7 +78,7 @@
(funcall face 'mode-line-inactive :bg (funcall darken-first common-bg 0.35) :fg common-fg) (funcall face 'mode-line-inactive :bg (funcall darken-first common-bg 0.35) :fg common-fg)
(funcall face 'mode-line :bg modeline :fg common-fg) (funcall face 'mode-line :bg modeline :fg common-fg)
(funcall face 'hl-line :bg (funcall darken-first common-bg 0.15)) (funcall face 'hl-line :bg (funcall darken-first common-bg 0.15))
(funcall face 'region :bg (funcall brighten-first common-bg 0.15)) (funcall face 'region :bg highlight)
(funcall face 'font-lock-comment-face :fg comment) (funcall face 'font-lock-comment-face :fg comment)
(funcall face 'font-lock-doc-face :fg doc) (funcall face 'font-lock-doc-face :fg doc)
(funcall face 'font-lock-keyword-face :fg keyword) (funcall face 'font-lock-keyword-face :fg keyword)
@ -90,7 +93,14 @@
(funcall face 'lsp-face-highlight-read :bg lsp-hover-highlight) (funcall face 'lsp-face-highlight-read :bg lsp-hover-highlight)
(funcall face 'lsp-face-highlight-write :bg lsp-hover-highlight) (funcall face 'lsp-face-highlight-write :bg lsp-hover-highlight)
;; company (funcall face 'lsp-ui-peek-filename :fg common-fg)
(funcall face 'lsp-ui-peek-header :bg modeline)
(funcall face 'lsp-ui-peek-peek :bg peek-code)
(funcall face 'lsp-ui-peek-list :bg peek-code)
(funcall face 'lsp-ui-peek-selection :bg highlight)
(funcall face 'lsp-ui-peek-highlight :bg highlight)
;; Company
(funcall face 'company-tooltip :bg company-bg) (funcall face 'company-tooltip :bg company-bg)
(funcall face 'company-tooltip-selection :bg (funcall brighten-first company-bg 0.15)) (funcall face 'company-tooltip-selection :bg (funcall brighten-first company-bg 0.15))
(funcall face 'company-scrollbar-fg :bg (funcall brighten-first company-bg 0.3)) (funcall face 'company-scrollbar-fg :bg (funcall brighten-first company-bg 0.3))