start page | rating of books | rating of authors | reviews | copyrights

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 31.10 Repeating a vi Keymap Chapter 31
Creating Custom Commands in vi
Next: 31.12 Text-Input Mode Cursor Motion with No Arrow Keys
 

31.11 Typing in Uppercase Without CAPS LOCK

[You may want to input text in all uppercase letters - maybe for a FORTRAN program. Using CAPS LOCK in vi can be a pain because you have to release CAPS LOCK almost every time you want to type a vi command. Here's a nice way to type lowercase letters during input and ex modes; they'll be mapped to uppercase automatically. -JP]

Try putting this in your .exrc (30.6) file:

map! a A
map! b B
map! c C
  ...
map! z Z

Anytime you type (during text-input mode) an a, the editor will map it into A. What's that you say? You don't want this all the time? Just put it in a file called .f (for FORTRAN), and type:

:source .f

when you want FORTRAN mode. Of course, you can define a function key (31.2) to :source this.

[After that, anywhere you want a lowercase letter, type CTRL-v first to temporarily cancel the map. For example, to type the command :w, type [:] [CTRL-v] [w]

You can also go into the ex command mode by typing the vi command Q. That takes you to the ex colon (:) prompt - where the map! macros won't affect what you type. To return to vi mode from ex command mode, type :vi. -JP ]

- BB in net.unix on Usenet, 9 October 1986


Previous: 31.10 Repeating a vi Keymap UNIX Power ToolsNext: 31.12 Text-Input Mode Cursor Motion with No Arrow Keys
31.10 Repeating a vi Keymap Book Index31.12 Text-Input Mode Cursor Motion with No Arrow Keys

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System