Skip to content
TerryTsao edited this page Mar 29, 2022 · 8 revisions

English | 简体中文

Evil integration

Spacemacs users

Enable with

(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-call-sync "execute_function" eaf--buffer-id "is_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 users

(require 'eaf-evil)

(define-key key-translation-map (kbd "SPC")
    (lambda (prompt)
      (if (derived-mode-p 'eaf-mode)
          (pcase eaf--buffer-app-name
            ("browser" (if  (eaf-call-sync "execute_function" eaf--buffer-id "is_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 will dynamically rebind eaf keybindings so that evil-mode works nicely in normal state.

Clone this wiki locally