Screen blanks when exiting vi and more

I have just installed AIX 7.1 on a new system, and find that it displays the same annoying behaviour the you find in Linux:

In an xterm, when you quit vim or less, the file listed in the terminal window is blanked out and replaced with whatever was there before.

In vim there is a couple of settings in the config file (.vimrc) and less can be controlled with an environment variable. However, according to the output from truss, vi in AIX does not look for .vimrc or anything similar, so how can I stop this behaviour?

This is only a partial solution but you might be interested in this thread.

I am still looking for a solution for vim, if not for AIX then for Linux as i find that behavior equally annoying.

I hope this helps.

bakunin

Thanks! I know how to do in Linux:

for vim, add the following to your ~/.vimrc:

set t_ti= t_te=

and for less, the following env var:

LESS=X
  • similar to what you describe for more

vi looks for .exrc

Phantastic! Many thanks for this, it will become perhaps the first line in my "~/.exrc".

I have noticed, though, that the overwhelming majority of lines in my vim-configuration deal with switching off all the annoying default of this "emacs in disguise". If i ever want to play video games i'll buy a C64, my editor only needs to edit files, mumble, grumble, ...

bakunin

You're welcome :slight_smile:

One of the very first things I do on a new installation is to simply remove everything in vimrc, set it to compatible (because I work on many different UNIXes) and turn off the $&�&^�%^� screen blanking. This is my usual system wide vimrc:

set t_ti= t_te=
set compatible
syntax off

Sometimes it seems the screen blanking settings in the system wide vimrc don't work - but they seem to always work in ~/.vimrc.

OK. I mentioned .exrc and tried the set commands you are mentioning for vim, but I do not seem to get the expected results with "plain" vi (MORE works, but when in /etc/environment the line should be

MORE=-W notite

i.e., no dblQuote "

Without double quotes, that attempts to run the notite command after exporting MORE=-W. I really think the quotes are necessary!

For "vi" and "more" it works for me when I set the TERM-Variable to "xterm-r5".
Have a look at the above link from bakunin.

But I noticed in the thread you referred me to, somebody replied, saying that the problem goes away if you set TERM=xterm-r5. I have tried that, and it works for me. Alternatively, I suppose one can replace the native vi with vim, but personally I don't like vim all that much with the extra features.

If you put the definition in a .profile or a .kshrc or /etc/profile that gets interpreted by the ksh. However, if you put in in /etc/environment it is just assigned.

So, in /etc/environment
MORE=-W notite
and in /etc/profile
export MORE="-W notite"

The reason is when ksh interperts it you do not want it to assign only -W
an alternative would probably work
export MORE=-W\ notite

As a test, compare the output of
set | grep MORE
and compare the result of MORE=-W notite and MORE="-W notite"

I am getting - on AIX 6.1

michael@x054:[/home/michael]. /etc/environment
michael@x054:[/home/michael]set | grep MORE
MORE='-W notite'
michael@x054:[/home/michael]grep MORE /etc/environment
MORE="-W notite"

and on AIX 7.1

root@x107:[/home/root]. /etc/environment
root@x107:[/home/root]set | grep MORE
MORE="-W notite"
root@x107:[/home/root]grep MORE /etc/environment
MORE="-W notite"

And, it works even with the quotes on AIX 6.1, but only without the quotes on AIX 7.1

Hope this clarifies any misunderstanding.

last update: seems the issue is a lot less on AIX 6.1 - because fewer programs are using the alternate window approach.

---------- Post updated at 09:51 PM ---------- Previous update was at 09:46 PM ----------

Thank you -=XrAy=- and jandersen.

My personal preference is to not change my term definition to something it is not. However, will adding my comments above and thinking about the vim comments I nee to read the string/command options -W notite as -W no ti te so I shall look into the terminal definitions and vi documentation (if I can find any) telling me how to disable the termcap variables ti and te as I am assuming this is why the definition xterm-r5 is working - the two variables are not defined.

---------- Post updated at 10:14 PM ---------- Previous update was at 09:51 PM ----------

My solution - thank you all for the discussion - is to redefine the terminal emulation my ssh client is reporting. It was saying xterm (forget when I changed that). It is now back to vt320 as default.

p.s. found a very good article on terminfo and termcap here: Fixing the alternate screen problem - Sec, blogmal! - tidbits/titeinhibit.story

Very good information, Michael. Thank you for sharing.

Regarding the /etc/environment -file: i never bothered to find out how they do it exactly, but it is perhaps not simply dot-executed but parsed somehow.

The reason why your two posts became one is a feature in our forum. If you post several posts into the same thread without a post in between they will be combined into one with a separator line in between.

bakunin

It is not executed. an "export", and/or backquote command will not function. So parse is a very good term.