Полезная информация

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 30.29 Setting Multiple tags Files Chapter 30
vi Tips and Tricks
Next: 30.31 vi Word Abbreviation
 

30.30 vi Outsmarts Dual-Function Function Keys

[This tip is about a Digital Equipment VT220 terminal, specifically, but you can probably use the same idea on other terminals. -JP]

I worked at a university with labs full of VT220 terminals. VT220s can be set to act as either VT220s or VT100s. The top row on the keyboard has a key marked ESC, for "escape." Unfortunately, the key sends a real ESC character only when the terminal is in its VT100 mode. As a VT220, that function key sends ESC followed by the four characters "[23~"-these make vi beep and change character case.

You can solve that problem by putting this command in your .exrc (30.6) file:

map [23~ mm

Then, whenever you press that key in the VT220 mode, the ESC character will do what ESC should and the [23~ will execute the vi command mm. That command marks (30.38) the current cursor position as "m"-nothing useful, but it keeps vi quiet.

- JP


Previous: 30.29 Setting Multiple tags Files UNIX Power ToolsNext: 30.31 vi Word Abbreviation
30.29 Setting Multiple tags Files Book Index30.31 vi Word Abbreviation

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