Some people don't like to press ESC first to move the cursor
while they're using vi
. These keymaps change CTRL-h,
CTRL-j, CTRL-k, and CTRL-l to do the same things
during input mode as the commands
do in command mode.
erase character set to CTRL-h (5.9
? If it is, mapping CTRL-h (usually labeled
BACKSPACE on your keyboard) will change the way CTRL-h
works during text-input mode: Instead of erasing the characters you've
typed since you entered text-input mode, now CTRL-h will move
backwards over what you type without erasing it.
One workaround is to change your UNIX erase character to the DELETE
or RUBOUT key by typing the command
stty erase '?'
you start vi
Then your DELETE key will erase what you type and the BACKSPACE key will
jump back over it without deleting.
||The lines for your
map! H [i
map! K [ka
map! L [la
" Note: the two lines above map J (LINEFEED)
That last map takes two lines; it's tricky and may not work right on
all versions of vi
No, it isn't a map for CTRL-v, though that's what it looks like.
, the LINEFEED key.
comes at the very end of its line.
When you're entering that keymap, type CTRL-v and then
press LINEFEED or CTRL-j.
The cursor will move to the start of the next line; type a SPACE
and the rest of the macro.
It's a good idea to add the reminder comment (starting with the comment
character, a double quote (
)), on the line below the map.
This map for CTRL-j is pretty obviously something that the
people who wrote my version of vi
didn't plan for.
For example, look at the mess it makes when I ask for a list of my text-input
H H [i
K K [ka
L L [la
Before you use this map on important files, you should probably test it