3

在为 emacs 中的 vim 仿真加载 EVIL 之前,我的.emacs文件中有以下内容:

(activate-input-method "english-dvorak")
(setq default-input-method "english-dvorak")

但是,当我键入/以 EVIL 启动增量搜索时,并没有使用默认输入法。为什么是这样?每当我在屏幕上输入字母时,我怎样才能使 EVIL 使用默认输入方法?

在执行这些函数的其余代码之前,我能够通过将 qwerty 字符映射到 dvorak 来正确支持fandt命令,但是我仍然无法/使用 dvorak 进行搜索。

4

2 回答 2

2

我已经在我的 PC 上测试了以下配置,它似乎使 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"))
于 2013-04-04T01:42:15.853 回答
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)
    ))
于 2013-04-27T15:29:23.717 回答