From b75529727569fb3d7d982664ae69ec243ab06dca Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Sat, 19 Mar 2022 00:23:47 +0800 Subject: Improve consult-mode (emacs) --- .emacs.d/lisp/init-minibuffer.el | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.emacs.d/lisp/init-minibuffer.el b/.emacs.d/lisp/init-minibuffer.el index 5ed684b..a0a5c98 100644 --- a/.emacs.d/lisp/init-minibuffer.el +++ b/.emacs.d/lisp/init-minibuffer.el @@ -7,21 +7,25 @@ vertico-count 20 vertico-cycle t) -(defun gx/setup-completion-in-minibuffer () - (setq-local completion-styles '(substring orderless) - completion-category-defaults nil - completion-category-overrides '((file (styles partial-completion))))) - (when (gx/maybe-require-package 'orderless) + (defun gx/setup-completion-in-minibuffer () + (setq-local completion-styles '(substring orderless) + completion-category-defaults nil + completion-category-overrides '((file (styles partial-completion))))) (add-hook 'minibuffer-setup-hook #'gx/setup-completion-in-minibuffer)) -(with-eval-after-load 'evil - (when (gx/maybe-require-package 'consult) +(when (gx/maybe-require-package 'consult) + (with-eval-after-load 'evil (evil-define-key 'normal 'global (kbd "fb") 'consult-buffer (kbd "fm") 'consult-recent-file (kbd "fc") 'execute-extended-command - (kbd "fl") 'consult-line))) + (kbd "fl") 'consult-line + (kbd "fs") 'consult-imenu) + (evil-define-key 'normal 'eglot--managed-mode + (kbd "fS") 'consult-eglot-symbols))) + +(setq consult-preview-key (kbd "C-c C-p")) (when (gx/maybe-require-package 'savehist) (add-hook 'after-init-hook #'savehist-mode)) -- cgit v1.2.3