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 () 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 () the current cursor position as "m"-nothing useful, but it keeps vi quiet.

- JP