diff options
author | Timo Wilken | 2023-04-26 14:06:44 +0200 |
---|---|---|
committer | Timo Wilken | 2023-04-26 14:06:44 +0200 |
commit | aa126f50d98cc46a73d584639e23a6a31f2856ee (patch) | |
tree | ddef046bdd1a2c34786afdc52be8531d66253432 /tw | |
parent | a7a140850a4d621e91df4c1511d30cd658825159 (diff) |
Improve counsel-dash handling
Diffstat (limited to 'tw')
-rw-r--r-- | tw/home/files/emacs-init.el | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/tw/home/files/emacs-init.el b/tw/home/files/emacs-init.el index 0662b914..9091cd6a 100644 --- a/tw/home/files/emacs-init.el +++ b/tw/home/files/emacs-init.el @@ -138,17 +138,33 @@ (defun tw/counsel-dash-is-help () "Install `counsel-dash-at-point' as `evil-lookup-func'." - (setq-local evil-lookup-func #'counsel-dash-at-point)) + ;; Note: `evil-lookup-func' is already set to something else by + ;; `tw/help-is-eldoc' for `eglot-mode'. + (setq-local evil-lookup-func #'counsel-dash-at-point + counsel-dash-docsets + (cl-case major-mode + (python-mode '("Python 3")) + (c++-mode '("C++")) + (cmake-mode '("CMake")) + (puppet-mode '("Puppet")) + (tcl-mode '("Tcl")) + (common-lisp-mode '("Common Lisp"))))) (use-package counsel-dash - :after (dash-docs) + :after (dash-docs which-key) :commands (counsel-dash-at-point) :demand t - :bind (("<leader>K" . counsel-dash-at-point) ; TODO: just install as `evil-lookup-func'? + :init (which-key-add-key-based-replacements + "<leader>d" '("docs" . "Documentation")) + :bind (("<leader>K" . counsel-dash-at-point) ("<leader>dK" . counsel-dash) ("<leader>di" . counsel-dash-install-docset) ("<leader>da" . counsel-dash-activate-docset) ("<leader>dd" . counsel-dash-deactivate-docset)) - :hook (python-mode . tw/counsel-dash-is-help) + :hook ((python-mode cmake-mode c++-mode puppet-mode tcl-mode common-lisp-mode) + . tw/counsel-dash-is-help) + :config + ;; Activate all installed docsets by default. + (setq counsel-dash-common-docsets (dash-docs-installed-docsets)) :custom (counsel-dash-docsets-path (tw/xdg-emacs-subdir 'data "dash-docsets/") "Store docsets in the XDG data directory.") (counsel-dash-browser-func 'eww "Open documentation pages using `eww' instead of an external browser.") |