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 Code:
"test.txt" [New] 0,0-1 All Code:
-- INSERT -- 0,1 All Code:
-- INSERT -- 1,2test.txt + (~) 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 :) |
It sounds like it might be referencing a different. '.vimrc' file ?
(Incidentally, a leading dot makes the file hidden to 'ls' - use 'ls -a' ) I'd at least start by checking the PATH in each case to see exactly which copy of vim it's referencing. HTH |
Thanks for the quick reply.
Running echo $PATH: As normal user inside rxvt in openbox 'echo $PATH': Code:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin Code:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin Code:
/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin I searched for all .vimrc files ('find / -name "*.vimrc") in the system found only the one inside the user homedir with the following content: Code:
set expandtab |
Well, there can be multiple '.vimrc' and also system level 'vimrc' files - note no leading 'dot' for the system level ones.
This page shows how to find them https://stackoverflow.com/questions/...ing-vimrc-file Also, within each env, run Code:
which vim 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. ;) HTH |
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. |
Code:
which vim I also did a search for vimrc-files with Code:
find / -name "*vimrc" |
What yields
echo $TERM inside and outside of Openbox? |
In rxvt inside Openbox, logged in as user:
Code:
echo $TERM = rxvt Code:
echo $TERM = linux Code:
echo $TERM = linux |
see the last post here: https://askubuntu.com/questions/9209...nside-a-script (and the link)
|
Maybe a problem with TERM=rxvt
Try to start vim with another TERM environment. Command line (in a rxvt): Code:
env TERM=linux vim filename Code:
env TERM=xterm vim filename |
After reading pan64's link and trying out
Code:
env TERM=linux vim test.txt When running Code:
env TERM=linux vim test.txt I feel like we're going in the right direction :) |
would be nice to explain all the details. Is it a console, a terminal emulator, or what? How did you enter into it?
|
I'm running vim inside a terminal emulator 'rxvt' window in Openbox.
|
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: Code:
toe /usr/share/terminfo |
/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. Running Code:
env TERM=rxvt-unicode vim test.txt Code:
env TERM=rxvt-unicode-256color vim test.txt |
All times are GMT -5. The time now is 05:35 AM. |