(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