Binding a key to a command
The command that gets executed when you hit :
is evil-ex
, as you can find out by running:
:describe-key<CR>
:
(i.e. run Emacs' describe-key
command, then hit the key you want info on).
So you can just bind ;
to also run evil-ex
.
(define-key evil-normal-state-map (kbd ";") 'evil-ex)
(define-key evil-visual-state-map (kbd ";") 'evil-ex)
(define-key evil-motion-state-map (kbd ";") 'evil-ex)
Binding one key sequence to another
In Emacs, just generally, you can define keyboard macros, which are basically the same as how Vim handles mappings:
(global-set-key (kbd ";") (kbd ":"))
In evil-mode, you need to add them to the relevant keymap for the state:
(define-key evil-normal-state-map (kbd ";") (kbd ":"))
(define-key evil-visual-state-map (kbd ";") (kbd ":"))
(define-key evil-motion-state-map (kbd ";") (kbd ":"))
However, for some reason that does bizarre things in this case. It's the first binding I've seen fail in that way. Just use the first version.