Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rebinding :b and :e in evil-normal-state-map

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. :-)

like image 339
aerique Avatar asked Oct 16 '12 11:10

aerique


1 Answers

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.

like image 155
aerique Avatar answered Oct 04 '22 04:10

aerique