1835989 Members
3393 Online
110088 Solutions
New Discussion

.exrc keymapping for vi

 
SOLVED
Go to solution
Tim Nelson
Honored Contributor

.exrc keymapping for vi

keymapping in .exrc for vi does not seem to work right.

The issue seems to only exist on my 11.11 servers as the 11.23 installs work great.

Any ideas ?

8 REPLIES 8
Tim Nelson
Honored Contributor

Re: .exrc keymapping for vi

I should elaborate:

:map shows that the mappings were loaded.

For example:
map #5 :set number

On 11.11
when I hit F5 I get garbage.

On 11.23
Same emulator
F5 works.

Matti_Kurkela
Honored Contributor

Re: .exrc keymapping for vi

What's your terminal type (value of the TERM environment variable) in both 11.11 and 11.23?

What terminal emulator are you using and what kind of terminal it is configured to emulate?
MK
Tim Nelson
Honored Contributor

Re: .exrc keymapping for vi

The term type does not seem to matter. Tried a number of different ones through different packages and different user profiles ( putty, Reflection, hyperterm ) They all work on 11.23 but not 11.11.

Doublechecked stty and such as well.

Bill Hassell
Honored Contributor
Solution

Re: .exrc keymapping for vi

The .exrc supplied by HP for the last 15 years (including 11.23) only works with HP terminals and other than actual glass terminals, the only emulators for HP terminals are WRQ's Reflection for HP (*not* Reflection/X) and the free emulator QCterm. You can verify that the .exrc file if for HP terminals by looking at the code for G which is:

map ^[P x

which means: ESC P (typed very quickly) will be interpreted by vi as x, and the x command deletes 1 character. The curses name for this code is dch1 (man terminfo) but for a vt100, the code is ^[E[1P. So by looking at the vi command in .exrc, you can reverse engineer the terminal type by the mapped keystrokes. The untic command will show the codes for the various keys:

untic vt220
untic hp

Someone may have replaced yojur $HOME/.exrc with one that matches your terminal. The standard .exrc file is found in /usr/newconfig/etc/skel


Bill Hassell, sysadmin
Tim Nelson
Honored Contributor

Re: .exrc keymapping for vi

Thanks for the info Bill.

Here is the scenario.

copy /etc/newconfig/etc/skel/.exrc to $HOME on both an PA and IA server ( both newly installed resently ).

edit .exrc and add "map #5 :set nu" in both .

On the IA all works.
On the PA no luck.

I do see that the untick info on the PA is different from the untick info on the IA.



Bill Hassell
Honored Contributor

Re: .exrc keymapping for vi

> edit .exrc and add "map #5 :set nu" in both .

> On the IA all works.
> On the PA no luck.

> I do see that the untick info on the PA is different from the untick info on the IA.

The map #5 directive is used to set the action based on softkey f5 on the keyboard. What the f5 key transmits is VERY dependent on whether the emulator had it's f-keys reprogrammed (like Glance and SAM and swinstall may do). I believe most of the menu tools mentioned leave the keys in their default state, so vi's ability to recognize the f5 key depends on what it sees for the curses code kf5. The default softkey codes for all HP terminals are:

ESC followed by p q r s t u v w for keys 1 2 3 4 5 6 7 8 respectively. So untic hp | grep kf5 shows ESC t. Now vi is looking at the $TERM value when it searches for keymapping. If TERM=hp (or any of the HP terminals), then pressing f5 sends ESC t and vi sees the two letter code for the kf5 curses code, then uses map #5 to select the action.

Now very important: are you testing on a normal connection, Xwindows or using the console? The console (unfortunately) has been really messed up with GSP/MP code in the last couple of years. No matter what model the console terminal is, the GSP/MP overrides TERM.


Bill Hassell, sysadmin
Tim Nelson
Honored Contributor

Re: .exrc keymapping for vi

Thanks for the info everyone.. Unfortunatly this was one of those had time to investigate and now I do not..

Tim Nelson
Honored Contributor

Re: .exrc keymapping for vi

Thanks.