Question

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.

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

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.

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

Was it helpful?

Solution

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

  • (evil-ex-define-cmd "b[uffer]" 'helm-buffers-list)
  • (evil-ex-define-cmd "e[dit]" 'find-file)

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)
  • (define-key evil-ex-map "e" 'find-file)

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top