customize ex commands

Frank Fischer frank.fischer at
Sun Dec 18 22:39:22 CET 2011

Am Sun, 18 Dec 2011 20:58:31 +0000
schrieb Jim Green <student.northwestern at>:

> Hi: Frank and List:
> I have this snipped of code in my .emacs and I want to use :A instead
> of \c-ct for eassist-switch-h-cpp.
> (require 'eassist)
> (defun c-mode-cedet-hook ()
>   (local-set-key "." 'semantic-complete-self-insert)
>   (local-set-key ">" 'semantic-complete-self-insert)
>   (local-set-key "\C-ct" 'eassist-switch-h-cpp) ;; switch between
> corresponding h and cpp files
>   (local-set-key "\C-xt" 'eassist-switch-h-cpp)
>   (local-set-key "\C-ce" 'eassist-list-methods)
>   (local-set-key "\C-c\C-r" 'semantic-symref)
>   )
> (add-hook 'c-mode-common-hook 'c-mode-cedet-hook)
> I added  (local-set-key ":A" 'eassist-switch-h-cpp) to the .emacs but
> it doesn't work..

Well, ex-mode is something special. The ":" key calls an evil-function
`evil-ex-read-command' and the rest is done within a minibuffer.

You can use 

(evil-define-ex-cmd "A" 'eassist-switch-h-cpp) 

to define a new ex-command (see "evil-maps.el" for all other bindings).
But note that currently evil has only the global namespace for
ex-commands. Of course there should be a buffer-local solution or
something equivalent to `evil-declare-key' for ex commands, but this is
still on the TODO list.


PS: If you need local ex-commands, file a request in the bug-tracker,
otherwise it remains on my list as low-priority ;)

PPS: Of course, this holds for *all* feature request. Mails on the list
are easily forgotten ...

More information about the implementations-list mailing list