开发者

Get colors using Mac OS X terminal when editing source code in remote linux machines

开发者 https://www.devze.com 2022-12-22 11:42 出处:网络
I use terminal from Mac OS X Leopard to开发者_JAVA技巧 connect to remote Linux machines and edit C++ code there using VI.

I use terminal from Mac OS X Leopard to开发者_JAVA技巧 connect to remote Linux machines and edit C++ code there using VI.

What determines that in some machines, using the same MACOSX terminal settings, the source code gets colorized and in other not?

Thanks


Have you used :syntax enable in vim on the remote machine? Just asking, since on the ones that are working it could be in .vimrc or similar.


Usually, the $TERM environment variable determines whether the terminal is capable of color.

$TERM is set upon connection to the remote terminal. From there, you can try export TERM='xterm-color' and see what happens.


Setting the .vimrc with

set term=xterm-color

worked for me in OS X tiger server. I put this at the top of the .vimrc. I also set the term app on OS X El capitan host to xterm in the preferences. I have syntax highlighting over ssh. Thanks again


In my case, these "remote linux machines" usually have a 'small' or 'tiny' version of vim installed which does not have syntax highlighting. When in vim, enter the command :version, and see if you have +syntax or -syntax in the feature list. If you don't have +syntax, then vim has been compiled without syntax support and you need to recompile vim on that machine.

0

精彩评论

暂无评论...
验证码 换一张
取 消