Products Resources Support About Us

Unexpected command line position after closing vim

I’m running Ubuntu 20.04 on Windows 10 under the Windows Linux Subsystem. When I ssh into USS on the mainframe, vim works fine, except that upon exit the command line and cursor go to the top of the display, overwriting what was there before. The rest of the data on the screen is left behind.

What can I do to make the command line redisplay directly under the vim invocation, as expected? Thanks!

Hello tony.vitonis,
We can’t reproduce this issue. Can you give us some details

  1. fully described steps
  2. “env | sort” output from both systems
  3. screenshots will be helpful
  4. .vimrc content
  5. which terminal are you using

Thanks,
Alex

Reproduce

  1. ssh to z/OS.
  2. Enter a vim command.
  3. Quit out of vim.
  4. Note that the command line is redrawn at the top, and that the rest of the screen is still there.

Before entering vim

After exiting vim

For some reason, I can’t put a second screenshot here because I’m a “new user”. I’ll add it in a following post.

env | sort from z/os

EDITOR=vim -p
GIT_EXEC_PATH=/usr/lpp/Rocket_Tools/libexec/git-core
GIT_SHELL=/usr/lpp/Rocket_Tools/bin/bash
GIT_TEMPLATE_DIR=/usr/lpp/Rocket_Tools/share/git-core/templates
HISTCONTROL=ignoreboth:erasedups
HISTFILE=/u/btjv1/tmp/.bash_history
HISTFILESIZE=500
HISTIGNORE=?:??:exit:clear
HISTTIMEFORMAT=%F %T
HOME=/u/btjv1
LANG=C
LIBPATH=/usr/lpp/Rocket_Tools/lib/perl5/5.24.0/os390/CORE:/lib:/usr/lib:.
LOGNAME=BTJV1
MAIL=/usr/mail/BTJV1
MANPATH=/usr/lpp/Rocket_Tools/man:/usr/man/%L
MYPATH=/u/btjv1/git/scripts:/u/btjv1/git/scripts/funcs
NLSPATH=/usr/lib/nls/msg/%L/%N
PATH=/usr/lpp/Rocket_Tools/bin:/bin:/usr/sbin:/u/btjv1/git/scripts:/u/btjv1/git/scripts/funcs
PERL5LIB=/usr/lpp/Rocket_Tools/lib/perl5
PORTED_TOOLS=/usr/lpp/Rocket_Tools
PS1=$(ps1)
PWD=/u/btjv1
SHELL=/u/btmf1/shared/git/bin/bash
SHLVL=1
SSH_CLIENT=172.22.151.106 52355 22
SSH_CONNECTION=172.22.151.106 52355 10.0.1.3 22
SSH_TTY=/dev/ttyp0002
STEPLIB=none
TERM=xterm
TZ=CST6CDT
USER=BTJV1
VIMRUNTIME=/usr/lpp/Rocket_Tools/share/vim/vim80
_=/bin/env
_BPXK_AUTOCVT=ON
_CEE_RUNOPTS=FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)
_EDC_ZERO_RECLEN=Y
_TAG_REDIR_ERR=txt
_TAG_REDIR_IN=txt
_TAG_REDIR_OUT=txt
s=/u/btjv1/git/scripts

env | sort from Linux

DISPLAY=localhost:0.0
EDITOR=vim
GIT_EDITOR=vim
HISTFILE=/home/tony/loc/temp/.zhistory
HISTORY_IGNORE=(exit|clear|x)
HISTSIZE=500
HOME=/home/tony
HOSTTYPE=x86_64
JAVA_HOME=/usr/lib/jvm/default-java
LANG=C.UTF-8
LESS=-F
LESSHISTFILE=/dev/null
LOGNAME=tony
NAME=A000403
OLDPWD=/home/tony
PAGER=less
PATH=/home/tony/loc/src:/home/tony/shr/src:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files (x86)/Common Files/Acronis/VirtualFile/:/mnt/c/Program Files (x86)/Common Files/Acronis/VirtualFile64/:/mnt/c/Program Files (x86)/Common Files/Acronis/FileProtector/:/mnt/c/Program Files (x86)/Common Files/Acronis/FileProtector64/:/mnt/c/Program Files (x86)/Common Files/Acronis/SnapAPI/:/mnt/c/Program Files/rexx.org/Regina:/mnt/c/Program Files (x86)/PuTTY/:/mnt/c/Program Files/Intel/WiFi/bin/:/mnt/c/Program Files/Common Files/Intel/WirelessCommon/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/sds/repos/steven:/mnt/c/Users/btjv1/OneDrive/scripts:/mnt/c/Users/btjv1/AppData/Local/Microsoft/WindowsApps:/mnt/c/sds/repos/factory:/mnt/c/Program Files (x86)/CVSNT/
PS1=%B%F{white}%T%b %F{214}laptop%f %16<..<%~%<<% $(gitps1) >
PWD=/home/tony
PYTHONIOENCODING=utf_8
PYTHONSTARTUP=/home/tony/shr/.start.py
RLWRAP_HOME=/home/tony/loc/temp/rlwrap
SAVEHIST=500
SHELL=/usr/bin/zsh
SHLVL=1
SSH_AGENT_PID=8663
SSH_AUTH_SOCK=/tmp/ssh-xru1WDoECl31/agent.8662
TERM=xterm-256color
TZ=America/New_York
USER=tony
VISUAL=vim
WSLENV=
WSL_DISTRO_NAME=Ubuntu
_=/usr/bin/env

I’m using the terminal that’s automatically invoked by the Windows 10 Ubuntu app. As for my .vimrc content, it’s largish and works in every other environment I’ve tried it. Is there something specific that you’re looking for in there? Values of settings?

After exiting vim

Aha! My vimrc file did have some “special” screen-related code in it:

if &term =~ "xterm"
   let &t_Co = 256
   let &t_ti = "\<Esc>7\<Esc>[r\<Esc>[?47h"
   let &t_te = "\<Esc>[?47l\<Esc>8"
   if has("terminfo")
      let &t_Sf = "\<Esc>[3%p1%dm"
      let &t_Sb = "\<Esc>[4%p1%dm"
   else
      let &t_Sf = "\<Esc>[3%dm"
      let &t_Sb = "\<Esc>[4%dm"
   endif
endif

Apparently at some time in the past I had tried (and failed) to address the problem. Anyway, the symptom now is that when I exit vim, the final contents of the vim session remain visible and the previous terminal session lines are scrolled off:

My ultimate goal is to have vim on z/OS behave as it does in other places, meaning that I want it to restore the screen as I saw it when I invoked vim and put a new command line at the bottom. How can I accomplish that?

I knew that all of this sounded familiar! I found an old forum post of mine and followed the instructions there. Everything’s good now. Thanks.

1 Like