syntax highlighting in vim over ssh
xterm-color
is probably not a supported terminfo description on your work computers. You can verify this is the case by running infocmp
. You'll likely get an error of infocmp: couldn't open terminfo file
.
The fix for this is to set your TERM
variable to something more common, for example just 'xterm' (in fact on my own system, the xterm terminfo description has more capabilities than the xterm-color description anyway).
I'm guessing you've got a bash profile/rc script which is setting this, as xterm does not set TERM=xterm-color
by default. If so, just change it to xterm
instead. If you don't have this set anywhere, just add export TERM=xterm
to your ~/.bashrc
(this is assuming you're using bash).
Related videos on Youtube
Xurtio
BS Physics MS Computational Neuroscience PhD Theoretical Neuroscience (pursuing)
Updated on September 18, 2022Comments
-
Xurtio over 1 year
When I ssh from work to the local network, I can turn syntax on in my vim instance and it works. When I go home and ssh in, I turn on syntax highlighting and nothing happens. While at home, if I use my local vim, I have syntax highlighting.
This leads me to believe it's something to do with ssh. In my ssh session, folders still have a different color than files.
echo $term
for work computer:xterm-color
echo $term
when ssh from work computer:xterm-color
echo $term
when ssh from home computer:xterm
echo $term
from home computer:xterm
(will add the others when I get home)
.vimrc:
colorscheme elflord set number syntax on
-
user over 10 years
echo $TERM
and see what differs... -
Admin over 10 yearsPost your
~/.vimrc
files.
-
-
Xurtio over 10 yearsI'm not sure I follow. When I ssh from work, I get xterm-color on the remote machine. When I xterm from home, I get xterm. So I think xterm-color is supported and my home computer just isn't defaulting to xterm-color.
-
Xurtio over 10 yearsOk, I tried the opposite of your suggestion. I set my home computer to TERM=xterm-color and all is fine now! Thanks for leading me to the answer! If you edit your answer to reflect my modification to it, I will accept it. Thanks again.