How to change key mappings in Cygwin's Vim
Posted
by Boldewyn
on Super User
See other posts from Super User
or by Boldewyn
Published on 2010-04-30T20:17:59Z
Indexed on
2010/04/30
20:38 UTC
Read the original article
Hit count: 338
I'm using Vim under Debian, Win Vista and WinXP (the latter two with Cygwin).
To handle tabs more easily, I mapped <C-Left>
and <C-Right>
to :tab(prev|next)
. This mapping works like a charm on the Debian machine.
On the Windows machines, however, pressing <C-Left>
deletes 5 lines, as far as I can tell, and meddles with cursor position, while <C-Right>
does this, too, and additionally enters Insert mode.
Question: To put it in a nutshell, how can I find out, why Vim behaves as it does? Is there a way to backtrace the active commands and keystrokes? Could there be a plugin the culprit? (I didn't install one, perhaps a default include by the Cygwin distro...) If so, how can I find it?
Edit 1: OK, it seems, that I got a first trace: The terminal sends for <C-Left>
'^[[1;5D
', and for right '^[[1;5C
' (evaluated with the <C-V><C-Left>
trick). If vim interprets this literally and discards the first characters, it explains the strange behaviour. Any ideas, how I could change this key mapping?
Additional Diagnosis:
This behaviour occurs regardless of any existing
~/.vimrc
file (is therefore not related to my above mentioned mapings) and is not inherited of some/etc/vim/vimrc
, since this doesn't exist in the default Cygwin installation.:verbose map
doesn't yield any new insights. Either nothing or my mentioned mappings appear, based on the existence of the .vimrc file:help <C-Left>
suggests, that the default would be a simple cursor movement, which is apparently not the case.Vim's version under Cygwin:
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Feb 11 2010 17:36:58) Included patches: 1-264 Compiled by http://cygwin.com/ Huge version without GUI. Features included (+) or not (-): +arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent -clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +cryptv +cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap +menu +mksession +modify_fname +mouse -mouseshape +mouse_dec -mouse_gpm -mouse_jsbterm +mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte +multi_lang -mzscheme -netbeans_intg -osfiletype +path_extra -perl +postscript +printer +profile -python +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" user exrc file: "$HOME/.exrc" fall-back for $VIM: "/usr/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -D_FORTIFY_SOURCE=1 Linking: gcc -L/usr/local/lib -o vim.exe -lm -lncurses -liconv
© Super User or respective owner