# Chapter 18. Creating Custom Commands in vi

#### Contents:

Why Type More Than You Have To?
Save Time and Typing with the vi map Commands
What You Lose When You Use map!
vi @-Functions
Keymaps for Pasting into a Window Running vi
Protecting Keys from Interpretation by ex
Maps for Repeated Edits
More Examples of Mapping Keys in vi
Repeating a vi Keymap
Typing in Uppercase Without CAPS LOCK
Text-Input Mode Cursor Motion with No Arrow Keys
Don't Lose Important Functions with vi Maps: Use noremap
vi Macro for Splitting Long Lines
File-Backup Macros

## 18.1. Why Type More Than You Have To?

> #### Summary Box Keymapping -- storing complex command sequences so that they can be executed with a single keystroke -- is one of my favorite timesavers. There's nothing like typing one key and watching a whole string of work take place. For repetitive edits (e.g., font changes) it's a real wrist-saver, too. In this chapter we show you how to: Save time by mapping keys: Section 18.2, Section 18.4, Section 18.7, and Section 18.8. Know when to map a key and when not to: Section 18.3. Map keys like ESC and RETURN: Section 18.6. Move around the file without leaving text-input mode: Section 18.11 Protect the text you're pasting in from another window: Section 18.5. Put custom commands in your .exrc file: Section 18.9 and Section 18.12. Break long lines of text: Section 18.13. -- EK

Copyright © 2003 O'Reilly & Associates. All rights reserved.