is it possible to mapping Alt-hjkl in Insert mode?

前端 未结 2 1565
一整个雨季
一整个雨季 2020-12-14 11:42

before describing my problem, I\'d list the env. applications here:

OS:linux 2.6.37-ARCH  (archlinux i686)
vim: 7.2.436
Terminal emulator: urxvt (with 256co         


        
相关标签:
2条回答
  • 2020-12-14 11:53

    For arrow keys:

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

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

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

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

    Add this to your .vimrc

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

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

    0 讨论(0)
  • 2020-12-14 11:56

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

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

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

    would do it.

    0 讨论(0)
提交回复
热议问题