From 80a80a0706d80161cd6d99226a0f34718e99ab33 Mon Sep 17 00:00:00 2001 From: sterni Date: Thu, 26 May 2022 13:42:52 +0200 Subject: feat(sterni/emacs): configure lsp-ui add proper lsp bindings Change-Id: I1a81feca1bde663d1fbea1e2520f25f0bb57453c Reviewed-on: https://cl.tvl.fyi/c/depot/+/5679 Autosubmit: sterni Tested-by: BuildkiteCI Reviewed-by: sterni --- users/sterni/emacs/default.nix | 1 + users/sterni/emacs/init.el | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'users') diff --git a/users/sterni/emacs/default.nix b/users/sterni/emacs/default.nix index 1200fefe4790..69d1d4ef41bc 100644 --- a/users/sterni/emacs/default.nix +++ b/users/sterni/emacs/default.nix @@ -23,6 +23,7 @@ let epkgs.melpaPackages.languagetool epkgs.melpaPackages.lsp-haskell epkgs.melpaPackages.lsp-mode + epkgs.melpaPackages.lsp-ui epkgs.melpaPackages.magit epkgs.melpaPackages.markdown-mode epkgs.melpaPackages.meson-mode diff --git a/users/sterni/emacs/init.el b/users/sterni/emacs/init.el index 38a87a286417..17b3f3573689 100644 --- a/users/sterni/emacs/init.el +++ b/users/sterni/emacs/init.el @@ -252,7 +252,27 @@ (use-package haskell-mode) (use-package lsp-mode :hook ((haskell-mode . lsp-deferred)) - :commands (lsp lsp-deferred)) + :commands (lsp lsp-deferred) + :config + (evil-define-key 'normal 'global + (kbd "lwr") 'lsp-workspace-restart + (kbd "lwq") 'lsp-workspace-shutdown + (kbd "la=") 'lsp-format-buffer + (kbd "lar") 'lsp-rename + (kbd "laa") 'lsp-execute-code-action)) +(use-package lsp-ui + :after lsp-mode + :custom + lsp-ui-doc-enable t + lsp-ui-doc-border "DimGray" + lsp-ui-doc-delay 0.5 + :config + (set-face-background 'lsp-ui-doc-background "WhiteSmoke") + (evil-define-key 'normal lsp-ui-mode-map + ;; TODO(sterni): emulate using xref for non-lsp? + (kbd "lgr") 'lsp-ui-peek-find-references + (kbd "lgd") 'lsp-ui-peek-find-definitions + (kbd "lc") 'lsp-ui-flycheck-list)) (use-package lsp-haskell :after lsp-mode :custom -- cgit 1.4.1