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 256colors patch)
kent$ echo $TERM
rxvt-256color
screen: Screen version 4.00.03 (FAU) 23-Oct-06
I run vim in terminal. I want to move cursor in INSERT mode by pressing ALT-hjkl, after the cursor moved, stay in INSERT mode, so that I could continue typing words.
articles I found:
http://vim.wikia.com/wiki/Mapping_fast_keycodes_in_terminal_Vim
http://vim.wikia.com/wiki/Get_Alt_key_to_work_in_terminal
what I tried:
in .vimrc do a keyCode mapping with ttimeoutlen=50 like this: ( only alt-j mapping was pasted as example):
set timeout ttimeoutlen=50
set <F13>=^[j "ctrl-v alt-j
imap <F13> <down>
with this conf, moving cursor in INSERT mode was ok. If I press <ESC>
and j. Vim brings me back to insert Mode. I don't know why the ttimeoutlen=50
didn't work.
also tried:
set timeout ttimeoutlen=50
set <M-j>=^[j
With this setting, when I pressed ALT-j, a "e" with an accent mark was typed.
Can you guys give me any hints how should I map the ALT-hjkl in terminal ?
Thanks in advance
Kent
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With