When I create the following key mapping via the command buffer it works as expected moving the cursor 5 lines down:
map ^[[1;3B 5<Down>
When I add it to my .vimrc file so that it works across sessions, pressing Alt+Down moves backwards 1 line (to somewhere not vertically above - maybe it's going to a previous sentence). My :map output is this:
0 ^
^[[1;3B 5<Down>
n gx <Plug>NetrwBrowseX
n <Plug>NetrwBrowseX * :call netrw#NetrwBrowseX(expand("<cWORD>"),0)<CR>
Press ENTER or type command to continue
Why doesn't this vimrc mapping work similarly to what I type in the command buffer?
My version of vim is:
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 10 2014 00:22:49)
Included patches: 1-135
Compiled by <cygwin@cygwin.com>
UPDATE
There are 2 issues.
map <M-Down> 5<Down>
but does understand map <M-Down> 5j
map <M-Down> 5j
from working. I had to put a bunch of hacks in to get "normal" vim behavior in my Cygwin environment: "================== " Keyboard trouble "================= " Every so often I am using a system that inserts a A, B, C, or D " when using the arrow keys within the Vim editors insert mode. " Vim is for VI Improved. While I did not dig into the exact reasons " as to why (terminal emulation?) it happens, it is quite annoying. set nocompatible "set term=cons25 " This fixes Cygwin's vim's page up, home, end etc. keys " http://superuser.com/questions/480215/ " how-to-map-pagedown-and-pageup-keys-to-function-normally set term=mintty set backspace=2 " backspace on Cygwin Windows Objy was not deleting properly. " But this doesn't solve other cursor movements like "home and end "source /home/sarnobat/.vim/cscope_maps.vim "g:CCTreeCscopeDb = "/home/sarnobat/cscope/cscope.files" "============================== " Key bindings "============================== map 0 ^
I don't understand those characters: ^[[1;3B
. In vim you can choose the Alt
key as letter M
and the arrow letter as down
, so:
map <M-down> 5<Down>
will work in either command-line and from your vimrc
file.
you could try the following:
map <M-down> 5j
Tried it on cygwin and it worked. hjkl is the preferred method of navigating left, down, up and right.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.