Skip to content
Andy Stewart edited this page Aug 11, 2022 · 9 revisions

English | 简体中文

evil-mode 集成

开启办法:

Spacemacs 用户

(require 'eaf-evil)

(setq eaf-evil-leader-keymap  spacemacs-cmds) 

(define-key key-translation-map (kbd "SPC")
    (lambda (prompt)
      (if (derived-mode-p 'eaf-mode)
          (pcase eaf--buffer-app-name
            ("browser" (if eaf-buffer-input-focus
                           (kbd "SPC")
                         (kbd eaf-evil-leader-key)))
            ("pdf-viewer" (kbd eaf-evil-leader-key))
            ("image-viewer" (kbd eaf-evil-leader-key))
            (_  (kbd "SPC")))
        (kbd "SPC"))))

Doom-emacs 用户

(require 'eaf-evil)
;; eaf会把C-SPC当成evil的leader-key,在你加载'eaf-evil之后使用eaf时就需要在eaf中键入C-SPC使用evil leader下的键。
;; 我们只需要将这个键设置为 SPC或你自己的evil-leader-key即可
(setq eaf-evil-leader-key "SPC")



;; 以下是过时的代码,不需要也能正常使用
(define-key key-translation-map (kbd "SPC")
    (lambda (prompt)
      (if (derived-mode-p 'eaf-mode)
          (pcase eaf--buffer-app-name
            ("browser" (if eaf-buffer-input-focus
                           (kbd "SPC")
                         (kbd eaf-evil-leader-key)))
            ("pdf-viewer" (kbd eaf-evil-leader-key))
            ("image-viewer" (kbd eaf-evil-leader-key))
            (_  (kbd "SPC")))
        (kbd "SPC")))

eaf-evil 会动态查询 eaf 应用的按键绑定, 使得 evil-modenormal 模式下也能够很好的支持 eaf 应用。

Clone this wiki locally