Wednesday, November 7, 2012

Commands from insert mode

I want to issue commands from the insert mode. I am aware that a lot of people tried it before me, but I could not find a satisfactory answer in discussion lists.

I don't like to use the arrows to move the cursor, since they are somewhat out of reach. My idea is to maintain the control key down, and press the HJKL keys. Therefore, I prepared the following imap calls:

:imap <C-h> <Left>
:imap <C-j> <Down>
:imap <C-k> <Up>
:imap <C-l> <Right>

These mappings worked as expected. Then I decided to add a few erase operations. I thought it would be simple. The first two trials worked perfectly well:

:imap <C-x> <Delete>
:imap <C-z> <BS>

However, I would like to have the command mode X, that erases the character before the cursor. I tried:

:imap <C-X> <BS>

It seems that vim considers <C-x> and <C-X> to be the same key. Of course, <C-X> is pretty tough to press, but I would like to keep it for symmetry.

My question is: How to make insertion mode <C-X> work like normal mode X?


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: