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

Unix Power ToolsUnix Power ToolsSearch this book

18.10. Typing in Uppercase Without CAPS LOCK

You may want to input text in all uppercase letters. 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.

Try putting this in your .exrc (Section 17.5) 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 (Section 18.2) to :source this.

[After that, anywhere you want a lowercase letter, type CTRL-v first to cancel the map temporarily. 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



Library Navigation Links

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