Vim shows somewhat broken representation but the actual output to file is correct, terminal issue?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Vim shows somewhat broken representation but the actual output to file is correct, terminal issue?
My Vim has recently started acting strange.
I open a new file in Vim as a normal user,
Code:
vim test.txt
and the bottom line shows
Code:
"test.txt" [New] 0,0-1 All
all normal. I then press 'I' (for insert mode) and the bottom line shows
Code:
-- INSERT -- 0,1 All
all normal. Now, when I press the first (any) key to insert a character the cursor seems to first be jumping down a line before it inserts the character. At the bottom line (statusline) I now get 2 lines.
Code:
-- INSERT -- 1,2test.txt + (~)
- VIM
If I just ignore that fact that it automatically seems to do a CR or LF and enter whatever characters/text I want and save the file, the actual output to the file seems to be correct (no extra CR or LF). From what I can think of it seems like some kind of "render" issue.
This happens when I run vim inside rxvt as well as xterm in openbox as a normal user.
It does not happen if I run 'sudo vim' or 'su - root' and then 'vim'.
It does not happen if I run it from another non-graphic tty, like tty3 as a normal user.
I'm running bash as the shell but I also tried switching to sh but the issue is the same.
Since vim seems to work fine outside of X I believe the issue is not with vim itself but rather some terminal settings that may have changed or similarly.
Any ideas that could potentially point me in the right direction is much appreciated
to see where it's getting the prog from.
Note that one of them could easily be eg a shell script that does something funky, then calls vim on your behalf.
Basically, assume nothing(!); check all cfgs and vim 'programs' in each env.
vim does not depend on X, it does not use any X related settings (that is gvim).
From the other hand vim uses a lot of terminal commands (like cursor movement, scroll, .....). All these commands depend on the type of the terminal. vim tries to detect it (to identify the available commands) and also you can set TERM, but anyway, if it is not set properly it may cause issues like that.
Basically, opening a terminal emulator will set this TERM variable, which should work, but can be overridden.
points to the binary file /usr/bin/vim in all environments.
I also did a search for vimrc-files with
Code:
find / -name "*vimrc"
which gave me two results; /home/user/.vimrc and /usr/share/vim/vimrc. I am still not sure that the issue is in any of those files since I would guess /usr/share/vim/vimrc is loaded by all users or at least users that don't have their own .vimrc. In my case the root user doesn't have its own .vimrc so I would assume that it is using /usr/share/vim/vimrc. Also the reason I don't think there is an issue with /home/user/.vimrc is that there are no issues when running vim as the user from a ttyX outside of Openbox/X.
the issue seems to be gone. So why is it working when running as root while TERM=rxvt but not as the user when TERM=rxvt? Are there some settings that are being applied with 'rxvt' on a per user basis somewhere that might have gone rogue?
I feel like we're going in the right direction
I guess there is something wrong in your /usr/share/terminfo/r/rxvt (binary terminfo file compiled by tic).
(Well, another reason could be a bad rxvt entry in the legacy /etc/termcap (text file).)
You can try to set TERM to other rxvt variants in /usr/share/terminfo/r/
Command to list all terminal types along with a short description:
/usr/share/terminfo/r/rxvt does not exist but rxvt-unicode and rxvt-unicode-256color does and they are the only files in that directory.
/etc/termcap does not exist on my system. Unfortunatly 'toe' does not exist either since this is a pretty minimalistic system.
Inside /usr/share/terminfo there only exist the directory 'r' which contains the two binaries mentioned above.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.