在linux emacs中使用consult搜索中文时,搜索结果无法实时反馈,需要按下方向键、空格键才刷新,但是输入英文就可以实时刷新。大家知道如何解决吗?
相关信息:
- Emacs版本:GNU Emacs 30.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.51, cairo version 1.18.4) of 2025-12-07
- 配置用的是Purcell的,作了一点点小修改,如下:
;;; init-minibuffer.el --- Config for minibuffer completion -*- lexical-binding: t; -*-
;;; Commentary: 迷你缓冲区补全配置
;;; Code:
(when (maybe-require-package 'vertico)
(add-hook 'after-init-hook 'vertico-mode)
(when (maybe-require-package 'embark)
(with-eval-after-load 'vertico
(define-key vertico-map (kbd "C-c C-o") 'embark-export)
(define-key vertico-map (kbd "C-c C-c") 'embark-act)))
(with-eval-after-load 'embark
(push 'embark--mark-target
(alist-get 'whole-line-or-region-delete-region
embark-around-action-hooks)))
(when (maybe-require-package 'consult)
(defmacro sanityinc/no-consult-preview (&rest cmds)
`(with-eval-after-load 'consult
(consult-customize ,@cmds :preview-key "M-P")))
(sanityinc/no-consult-preview
consult-ripgrep
consult-git-grep consult-grep
consult-bookmark consult-recent-file consult-xref
consult--source-recent-file consult--source-project-recent-file consult--source-bookmark)
(defun sanityinc/consult-ripgrep-at-point (&optional dir initial)
(interactive (list current-prefix-arg
(if (use-region-p)
(buffer-substring-no-properties
(region-beginning) (region-end))
(if-let ((s (symbol-at-point)))
(symbol-name s)))))
(consult-ripgrep dir initial))
(sanityinc/no-consult-preview sanityinc/consult-ripgrep-at-point)
(when (and (executable-find "rg"))
(global-set-key (kbd "M-?") 'sanityinc/consult-ripgrep-at-point))
(global-set-key [remap switch-to-buffer] 'consult-buffer)
(global-set-key [remap switch-to-buffer-other-window] 'consult-buffer-other-window)
(global-set-key [remap switch-to-buffer-other-frame] 'consult-buffer-other-frame)
(global-set-key [remap goto-line] 'consult-goto-line)
;;; 以下为自己添加的设置
(global-set-key (kbd "C-s") 'consult-line)
(global-set-key (kbd "M-s") 'consult-line-multi)
(global-set-key (kbd "C-c r") 'consult-history)
;; ;; ;; ;; (global-set-key (kbd "C-y") 'consult-yank-from-kill-ring)
(global-set-key (kbd "M-y") 'consult-yank-pop)
;; ;; (global-set-key (kbd "C-x M-:") 'consult-complex-command)
(global-set-key (kbd "C-x p b") 'consult-project-buffer)
;; (global-set-key (kbd "M-g o") 'consult-outline)
;; (global-set-key (kbd "M-g m") 'consult-mark)
;; (global-set-key (kbd "M-g k") 'consult-global-mark)
;; (global-set-key (kbd "M-g i") 'consult-imenu)
;; (global-set-key (kbd "M-g I") 'consult-imenu-multi)
;; (global-set-key (kbd "M-s f") 'consult-find)
;; (global-set-key (kbd "M-s l") 'consult-locate)
;; (global-set-key (kbd "M-s g") 'consult-grep)
;; (global-set-key (kbd "M-s r") 'consult-ripgrep)
;; (setq xref-show-xrefs-function #'consult-xref
;; xref-show-definitions-function #'consult-xref)
;;; 以上为自己添加的设置
(when (maybe-require-package 'embark-consult)
(require 'embark-consult))))
(when (maybe-require-package 'marginalia)
(add-hook 'after-init-hook 'marginalia-mode))
(provide 'init-minibuffer)
;;; init-minibuffer.el ends here
动图如下:
