Just how to deal with Ctrl + arrowheads in Vim?

I am making use of Putty -> Suse box -> vim 7.2 combination for editing and enhancing and also intend to remap Ctrl + arrowheads combo to a certain job. But also for some factor, Vim overlooks the faster way and also enters into insert setting and also inserts personality "D" (for left) of "C" (for appropriate).

Which component of my keyboard/terminal arrangement is at fault and also just how to repair it?

2019-05-07 01:07:13
Source Share
Answers: 2

Figure out specifically what retreat series your incurable sends out for Ctrl+arrowhead by keying Ctrl+V, Ctrl+arrowhead in insert setting : this will certainly insert the leading ESC personality (revealed as ^[ in vim) essentially, adhered to by the remainder of the retreat series. After that inform vim concerning these retreat series with something like

map <ESC>[5D <C-Left>
map <ESC>[5C <C-Right>
map! <ESC>[5D <C-Left>
map! <ESC>[5C <C-Right>

I appear to remember that Putty has a default setup for Application Cursor Keys mode that's bothersome (I neglect why), you could intend to toggle this setup first.

Keep in mind that although retreat series range terminals, problems (i.e. a retreat series that represents various type in various terminals) are uncommon, so there's no certain demand to attempt to use the mappings just on a certain incurable type.

2019-05-08 22:20:17

Your best choice is possibly to consider PuTTY's Application Cursor Keys mode arrangement.

The default series send ESC as a prefix and also [ adhered to by Append or Change or various other points tossing you right into insert setting.

included, adhering to Gilles

A a little more specific variation of the ^ V retreat can be seen with od (1 ). Below is me keying ^ Up, ^ Down, ^ Right, ^ Left at my incurable :

$ od -a
0000000 esc   [   1   ;   5   A esc   [   1   ;   5   B esc   [   1   ;
0000020   5   C esc   [   1   ;   5   D

So my incurable sends out ^[[1;5A when I push Ctrl+

2019-05-08 22:14:43