evil-leader 在插入模式下被激活了.求教,怎么设置?

模式下,输入"," 激活了evil-leader. 想请教下.如何修改才能不激活leader.?

    (use-package evil-leader
  :init
  (global-evil-leader-mode)
  (transient-define-prefix my/lsp-command
    "LSP"
    [["Find"
      ("d" "Definition" lsp-find-definition)
      ("r" "References" lsp-find-references)
      ("i" "Implementation" lsp-find-implementation)
      ("c" "Call hierarchy" lsp-treemacs-call-hierarchy)]
     ["Other"
      ("t" "Desc thing" lsp-describe-thing-at-point)
      ("s" "Desc session" lsp-describe-session)
      ("m" "Imenu" my/toggle-treemacs-symbols)
      ("f" "Quick fix" lsp-execute-code-action)
      ("l" "List error" flycheck-list-errors)]
     ["Rust"
      ("e" "Macroexpand" lsp-rust-analyzer-expand-macro)]])

  :custom ((evil-leader/leader ",")
           (evil-leader/no-prefix-mode-rx '(".*"))
           ;; (evil-leader/in-all-states t)
           )

  :config
  (require 'matcha-me)
  (defun my/insert-comma ()
    (interactive)
    (insert-char (char-from-name "COMMA")))

  (evil-leader/set-key
    "c" 'compile
    "s" 'swiper-isearch
    "f" 'counsel-find-file
    "b" 'counsel-bookmark
    "r" 'counsel-switch-buffer
    "l" 'my/lsp-command

    "o" 'counsel-git
    "a" 'counsel-git-grep
    "w" 'counsel-rg
    "k" 'kill-buffer
    "d" 'counsel-dired
    "j" 'hydra-prog-menu/body
    "m" 'hydra-multiple-cursors/body
    "SPC" 'avy-goto-word-1
    "e" 'tiny-expand

    "," 'matcha-me-space
    "p" 'matcha-projectile
    "g" 'matcha-magit
    "v" 'matcha-vc-dir
    "x" 'matcha-me-files

    "." 'my/insert-comma
    "h" 'my/major-mode-keymap

    "0" 'select-window-0
    "1" 'select-window-1
    "2" 'select-window-2
    "3" 'select-window-3
    "4" 'select-window-4
    "8" 'cfw:open-calendar-buffer
    "9" 'calendar
    ))

完整配置在:

(在完整配置里面,我将 “,” 改成了 " ".)

原始配置: https://github.com/jiacai2050/dotfiles 库的 .emacs.d

啊,我的配置仅供参考,你这么直接拿过来肯定有问题呀。去掉下面这行就可以了

           (evil-leader/no-prefix-mode-rx '(".*"))
1 个赞

谢谢啦. 我自己网上各种copy的配置, emacs有时候卡死. 所以还是用大神的比较好.

其实我这种做法不一定差,逗号的输入是比较低频的,所以在所有模式下开启 leader 模式问题不大,需要输入逗号时,按两下逗号就好了,可以看我最新的 commit

1 个赞