Operating System - HP-UX
1833758 Members
2961 Online
110063 Solutions
New Discussion

Re: Strange behavior in vi

 
Don Bentz
Regular Advisor

Strange behavior in vi

I am running HPUX 11.0 on a G50. When in "vi" I note that using the cursor movement keys manifests "overwriting" of characters on the line with characters fromn the same or other lines. Are there configuration files I can check or other settings (besides stty, etc., which I have confirmed are identical to settings on my N4000). I also note that the "errant" characters apparently do not really exist as evidenced by doing a 'cat' or 'more' command on the file.
Insecurity is our friend. It keeps you dependent.
9 REPLIES 9
Robert Gamble
Respected Contributor

Re: Strange behavior in vi

Make sure your $TERM is set correctly.
Sometimes that will happen if the shell does not recognize the term, so try:

# TERM=vt100 ; export TERM
# echo $TERM

(or put in the correct type of TERM you may happen to be using)

Good Luck!
Jeff Schussele
Honored Contributor

Re: Strange behavior in vi

Also check your KBD_LANG...
#echo $KBD_LANG

Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
S.K. Chan
Honored Contributor

Re: Strange behavior in vi

I think your keys are not mapped correctly. A few things you need to check .. (assuming you're on hpterm)
# untic hpterm
==> will give you list of terminfo vars
==> find out the escape sequence of the keys you want to map (eg: the arrow keys) by checking terminfo (4) man page.
===> Once you know what the escape sequence is for the particular key you want to map, you can map it either from vi or include $HOME/.exrc
Sanjay_6
Honored Contributor

Re: Strange behavior in vi

Hi Don,

Check your TERM setting and match them to the type of interface you are using. exceed / xterm / hpterm.

Hope this helps.

Regds
Uday_S_Ankolekar
Honored Contributor

Re: Strange behavior in vi

Hi,

This could be due to Display setting. Try setting display with appropriate TERM.
You can check this with the command
# env | grep -i term on the other servers where you think vi its functioning properly . Try to set the same settings in this box too.

TERM=hp, xterm ansi, vt100, vt220 any one of this then export it

-USA
Good Luck..
Don Bentz
Regular Advisor

Re: Strange behavior in vi

TERM=vt220, KBD_LANG="" (when echoed and piped through "od -xc" it returns only a new line.
The untic of vt220, when "diffed" with the untic of vt220 on the system that's working yields no differences. This is why I am so puzzled by it. The only differences I can see are some things in the stty settings. I am looking at the man page for stty now to see if I can determine if these are related or not.
Insecurity is our friend. It keeps you dependent.
Patrick Wallek
Honored Contributor

Re: Strange behavior in vi

I've always preferred using the h, j, k, and l keys for moving around in vi. I've never had any problems with those working.

h = move left
j = move down
k = move up
l = move right
Don Bentz
Regular Advisor

Re: Strange behavior in vi

I am using these keys. Always do. The problem is not with the cursor movement, but rather what happens to the characters the cursor passes over as it moves... The behavior differs when I am using (for example) the 'e' key, or the 'b' key. The display straightens out whenever I scroll a "page" down and then back up again.
Insecurity is our friend. It keeps you dependent.
Bill Hassell
Honored Contributor

Re: Strange behavior in vi

Sounds very much like a mismatch between the terminal emulator and the environment settings. vt220 is an emulation mode since 'real' vt220's are really hard to find. I suspect that that LINES and COLUMNS have not been set correctly and vi is critically dependent on knowing exactly exactly what your screen looks like.

Start by checking:

echo $LINES $COLUMNS

The best way to set $TERM is by using ttytype in /etc/profile or .profile. However, there is a little secret about telnet: it can propagate $TERM from a remote system, and will generate a SIGWINCH which updates the values of LINES and COLUMNS, sometimes incorrectly. So to avoid problems like this, run the ttytype command in /etc/profile:

eval $(/usr/bin/ttytype -s)

Sometimes, /etc/profile may bypass this test by checking if $TERM is already set. Be sure by always running ttytype.


Bill Hassell, sysadmin