2013-03-02 46 views
3

之前在Emacs加載惡vim的仿真,我有我的.emacs下列文件:在EVIL中進行增量搜索時,使用default-input-method?

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

但是,當我輸入/開始與邪惡的漸進式搜索,不使用默認的輸入法。爲什麼是這樣?我怎麼能這樣做,所以每當我在屏幕上輸入字母時,EVIL都會使用默認輸入法?

我能夠通過映射QWERTY鍵盤字符執行這些功能的代碼的其餘部分之前,德沃夏克在爲ft命令適當的支持破解,但我還是一直沒能得到我的搜索與/到使用dvorak。

+0

C-h f切換輸入法應該有所幫助。 – aartist 2013-04-03 14:17:44

+0

這對我來說很好。你在使用香草搜索嗎?如果您使用'-Q'啓動emacs,它會起作用嗎? – Thomas 2013-04-04 01:01:58

+0

@Thomas我道歉,我的問題實際上更復雜,我想,我已經更新了這個問題來反映這一點。上面的解決方案在vanilla emacs中確實工作正常,但它在EVIL中不起作用。 – 2013-04-04 17:28:37

回答

2

我測試過我的PC上進行如下配置,它似乎使德沃夏克是在無處不在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")) 
+0

我很抱歉,我的問題實際上更復雜,我想,我已經更新了這個問題來反映這一點。我遵循了我原先概述的程序,問題消失了,儘管看起來你的建議也可以做到。 :) – 2013-04-04 17:24:33

0

的問題是,邪惡的增量搜索是在正 - 執行狀態,據我所知,它不能用於輸入法。這是一種快速入侵,在執行搜索之前切換到插入狀態以允許使用輸入方法。由於搜索結束後立即切換回正常狀態,因此在執行搜索時,唯一的怪癖是緩衝區中的不同光標。

(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) 
    ))