vim: how to specify arrow keys
In vim, when using map
commands you must specify keys. For example <CR> <ESC> <F1>
. What are the corresponding ones for the arrow keys?
Solution 1:
If you don't know the internal code for a certain key, type CtrlK and then the function key. For example, this sequence followed by the up arrow key will output:
<Up>
You can learn more about this command in the documentation for both insert
and command mode. The specific ways to map a special key are given in the
documentation with the tag :map-special-keys
. Additionally, you can find a
handy table with :h key-notation
.
Solution 2:
Quite literal:
<Left>
<Right>
<Up>
<Down>
As noted in the comments, find this and more in this tutorial.