[ACCEPTED]-is it possible to mapping Alt-hjkl in Insert mode?-vi

Accepted answer
Score: 27

It's easier to map what your key combination 3 does. Alt+something generally results in a character, differently 2 from Ctrl+something.

For example, on my Mac Alt plus hjkl generates 1 ˙∆˚¬. So:

imap ˙ <Left>
imap ∆ <Down>
imap ˚ <Up>
imap ¬ <Right>

would do it.

Score: 15

For arrow keys:

Start by viewing the key code your terminal 6 is sending to vim:

$ sed -n l
^[[1;9D 

In the above example, i 5 ran the sed command and pressed Alt + Left.

The ^[[1;9D is 4 the escaped sequence being sent to vim, so 3 we can user that for our mapping.

Add this 2 to your .vimrc

map <Esc>[1;9D :tabn<CR>

Now we can cycle through vim 1 tabs by using Alt + Left

More Related questions