重新绑定:b和:e in evil-normal-state-map。

时间:2023-01-02 19:44:10

I can't figure out how to rebind the :b and :e commands in evil-mode for Emacs. Google isn't much of a help either.

我不知道如何重新绑定:b和:e命令在Emacs的evil模式中。谷歌也没什么帮助。

I have tried (define-key evil-normal-state-map ":b" 'helm-buffers-list) but that screws up the : key for entering commands.

我已经尝试过了(定义-关键的-正常-状态-状态映射“:b”的“helm-buffers-list”),但是它会破坏:输入命令的关键。

Currently I'm using (define-key evil-normal-state-map ",b" 'helm-buffers-list) and (define-key evil-normal-state-map ",e" 'find-file) but I'd prefer to have them on :b and :e so the motions would be the same when using real Vim.

目前我使用的是(定义-关键的-正常-状态-状态映射,b的“helm-buffer -list”)和(定义-关键的-正常-状态映射“,e”的“find-file”),但是我更喜欢它们在:b和:e,所以在使用真正的Vim时,它们的运动是相同的。

Please don't mention remapping to ,b and ,e in Vim. :-)

请不要提到在Vim中对b和e进行重新映射。:-)

1 个解决方案

#1


13  

Okey, one needs to (re)define an evil-ex-define-cmd:

Okey,你需要定义一个邪恶的定义-cmd:

  • (evil-ex-define-cmd "b[uffer]" 'helm-buffers-list)
  • (evil-ex-define-cmd“b(藏)”“helm-buffers-list)
  • (evil-ex-define-cmd "e[dit]" 'find-file)
  • (evil-ex-define-cmd“e[说]“查找文件)

Except now they need an <enter> after :<cmd>.

除了现在他们需要一个 <进入> 之后:

Right, after some more trawling through the source I found the solution:

对,在经过了一些搜索之后我找到了解决方案:

  • (define-key evil-ex-map "b" 'helm-buffers-list)
  • (定义关键evil-ex-map“b”helm-buffers-list)
  • (define-key evil-ex-map "e" 'find-file)
  • (定义关键evil-ex-map“e”的查找文件)

Now no <enter> is needed after entering f.e. :b.

输入f.e后,现在不需要 <输入> 。

#1


13  

Okey, one needs to (re)define an evil-ex-define-cmd:

Okey,你需要定义一个邪恶的定义-cmd:

  • (evil-ex-define-cmd "b[uffer]" 'helm-buffers-list)
  • (evil-ex-define-cmd“b(藏)”“helm-buffers-list)
  • (evil-ex-define-cmd "e[dit]" 'find-file)
  • (evil-ex-define-cmd“e[说]“查找文件)

Except now they need an <enter> after :<cmd>.

除了现在他们需要一个 <进入> 之后:

Right, after some more trawling through the source I found the solution:

对,在经过了一些搜索之后我找到了解决方案:

  • (define-key evil-ex-map "b" 'helm-buffers-list)
  • (定义关键evil-ex-map“b”helm-buffers-list)
  • (define-key evil-ex-map "e" 'find-file)
  • (定义关键evil-ex-map“e”的查找文件)

Now no <enter> is needed after entering f.e. :b.

输入f.e后,现在不需要 <输入> 。