1

I want to map

  • semicolon (;) to Escape
  • Ctrl+semicolon to semicolon

and wrote the following in my .vmrc

  1. inoremap ; <ESC>

  2. inoremap <C-;> ;

(1) allows me to escape from the insert mode, but (2) also behaves like Escape rather than giving ;.

What am I missing here? Any help is appreciated.

  • 6
    I suspect <c-;> is the same as ; in your terminal. Press Ctrl-V and then Ctrl-;, you'll likely see just ;. – muru May 17 '16 at 1:19
  • Ctrl-V and then Ctrl+; give ;, indeed. Ctrl-V and then ; also give ;. Isn't Ctrl-V the blockwise-visual mode? – T_T May 17 '16 at 4:24
  • :help i_ctrl-v… Vim is a modal editor. – romainl May 17 '16 at 5:10
  • 1
    @muru: confirmed here in iterm2, tmux, zsh, as well as the macvim gui. – nobe4 May 17 '16 at 8:23
3

It looks like <C-;> does not work in vim. Might I suggest using <A-;> (Alt) instead? That one seems to work for me.

  • Thanks for the suggestion, but I want to use Ctrl+; to type ;. – T_T May 18 '16 at 1:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.