commit 8c55b6bcd0cd79fb7d01fb315ff9f0069b05dbf6 parent 97196525df23b2dc4f51c76cf8d51182f048e55d Author: Vincent Demeester <vincent@sbr.pm> Date: Thu, 25 Jun 2020 06:50:22 +0200 tools/emacs: fix imenu Signed-off-by: Vincent Demeester <vincent@sbr.pm> Diffstat:
M | tools/emacs/config/config-navigating.el | | | 16 | ++++++++++++++-- |
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/tools/emacs/config/config-navigating.el b/tools/emacs/config/config-navigating.el @@ -46,7 +46,7 @@ (setq-default dumb-jump-use-visible-window t dumb-jump-prefer-searcher 'rg)) -(use-package +(use-package imenu :config (setq-default imenu-use-markers t imenu-auto-rescan t @@ -57,12 +57,24 @@ imenu-space-replacement " " imenu-level-separator "/") + (defun prot/imenu-vertical () + "Use a vertical Icomplete layout for `imenu'. +Also configure the value of `orderless-matching-styles' to avoid +aggressive fuzzy-style matching for this particular command." + (interactive) + (let ((orderless-matching-styles ; make sure to check `orderless' + '(orderless-literal + orderless-regexp + orderless-prefixes))) + (icomplete-vertical-do (:height (/ (frame-height) 4)) + (call-interactively 'imenu)))) + :hook ((imenu-after-jump-hook . (lambda () (when (and (eq major-mode 'org-mode) (org-at-heading-p)) (org-show-entry) (org-reveal t))))) - :bind ("C-'" . imenu)) + :bind ("C-'" . prot/imenu-vertical)) (use-package flimenu :config