What's the Evil Mode equivalent of these Vim commands?
nnoremap : ;
nnoremap ; :
vnoremap : ;
vnoremap ; :
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityWhat's the Evil Mode equivalent of these Vim commands?
nnoremap : ;
nnoremap ; :
vnoremap : ;
vnoremap ; :
First of all, in Emacs one thinks in keymaps and commands, not so much keys in their (original) context. Your first step would be figuring out how the commands are named in Evil's normal and visual state (F1 k
), then what keymap they're bound to (just look through evil-maps.el
with M-x find-library
). Armed with this knowledge, accomplishing this is fairly simple:
(with-eval-after-load 'evil-maps
(define-key evil-motion-state-map (kbd ":") 'evil-repeat-find-char)
(define-key evil-motion-state-map (kbd ";") 'evil-ex))
If you for whatever reason are still on Emacs 24.3:
(eval-after-load 'evil-maps
'(progn
(define-key evil-motion-state-map (kbd ":") 'evil-repeat-find-char)
(define-key evil-motion-state-map (kbd ";") 'evil-ex)))
You might wonder why I'm defining a remapping for motion state only, it's because Evil only maps these keys in that state, so applying your suggested changes as is would be unnecessary.
evil-maps.el
... Am I missing something??
dotspacemacs/user-init
inside the dotfile, but the behaviour is still the same - both semi-colon and colon bring up the ":"