Chapter 18. Creating Custom Commands in vi
Why Type More Than You Have To?
Save Time and Typing with the vi map Commands
While
you’re editing, you may
find that you are using a command sequence frequently, or you may occasionally
use a very complex command sequence. To save yourself keystrokes — or the time
it takes to remember the sequence — assign the sequence to an unused key by
using the map and map! commands.
Command Mode Maps
The
map command acts a lot like ab (Section
17.23) except that you define a macro for command mode instead of
text-input mode. The map! command works
during text-input mode; see the following list.
mapx sequenceDefine x as a sequence of editing commands.
unmapxDisable the x definition.
mapList the characters ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access