在emacs中加载EVIL进行vim仿真之前,我在.emacs
文件中有以下内容:
(activate-input-method "english-dvorak")
(setq default-input-method "english-dvorak")
但是,当我键入/
以使用EVIL开始增量搜索时,不使用默认输入法。为什么是这样?我怎么能这样做,所以当我在屏幕上输入字母时EVIL使用default-input-method?
我能够通过在执行这些函数代码的其余部分之前将qwerty字符映射到dvorak来破解对f
和t
命令的适当支持,但我仍然无法使用使用/
进行搜索以使用dvorak。
答案 0 :(得分:2)
我已经在我的电脑上测试了以下配置,它似乎让Dvorak在Emacs的任何地方出现:
;; Main setup for all the buffers
(defadvice switch-to-buffer (after activate-input-method activate)
(activate-input-method "english-dvorak"))
;; Sets up Dvorak for the minibuffer
(add-hook 'minibuffer-setup-hook (lambda () (set-input-method "english-dvorak")))
;; Sets up Dvorak for *scratch* buffer (used Qwerty on my PC otherwise)
(save-excursion
(set-buffer (get-buffer "*scratch*"))
(set-input-method "english-dvorak"))
答案 1 :(得分:0)
问题是 Evil 的增量搜索是在正常状态下执行的,据我所知,这不能与输入法一起使用。这是一个快速入侵,在执行搜索之前切换到插入状态以允许使用输入方法。由于它在搜索完成后立即切换回正常状态,因此在执行搜索时,唯一的怪癖是缓冲区中的不同光标。
(evil-define-motion evil-search-forward ()
(format "Search forward for user-entered text.
Searches for regular expression if `evil-regexp-search' is t.%s"
(if (and (fboundp 'isearch-forward)
(documentation 'isearch-forward))
(format "\n\nBelow is the documentation string \
for `isearch-forward',\nwhich lists available keys:\n\n%s"
(documentation 'isearch-forward)) ""))
:jump t
:type exclusive
:repeat evil-repeat-search
(progn ;MADE CHANGES HERE
(evil-insert-state)
(evil-search-incrementally t evil-regexp-search)
(evil-normal-state)
))
(evil-define-motion evil-search-backward ()
(format "Search forward for user-entered text.
Searches for regular expression if `evil-regexp-search' is t.%s"
(if (and (fboundp 'isearch-forward)
(documentation 'isearch-forward))
(format "\n\nBelow is the documentation string \
for `isearch-forward',\nwhich lists available keys:\n\n%s"
(documentation 'isearch-forward)) ""))
:jump t
:type exclusive
:repeat evil-repeat-search
(progn ;MADE CHANGES HERE
(evil-insert-state)
(evil-search-incrementally nil evil-regexp-search)
(evil-normal-state)
))