I am a system administrator and not a programmer. I frequently su to different system users for task so a .vimrc file for each system user is cumbersome. I need to be able to read the comments in config files and VIM syntax highlighting gets in the way for me.
How does one globally turn off syntax highlighting in VIM on Ubuntu systems?
The downside of using a .vimrc however is, as long as you aren't using a central home directory that is mounted via NFS on all your hosts, you have to do this on every host you work on.
There is another option: vim also takes settings from environment variables.
This becomes interesting along with another tidbit that is not so widely known: SSH clients can set environment variables on the host you connect to.
On Unix/Linux you can configure this in
~/.ssh/environment
:If you are using PuTTy on Windows there is also a way to set environment variables:
(Don't forget to save this to your default settings.)
With this setting the SSH client will set the environment variable on the host when you connect (if the host permits it), vim will read the variable on startup and use it as a configuration.
Sadly this will not work out of the box since SSH daemons are usally configured to accept only very few environment variables from the client. A default configuration from Ubuntu looks like this:
It only allows the variable
LANG
and all variables that start withLC_
, allowing you to set the language of the output regardless on what language is configured as default on the server. To allow the vim configuration variables you have to extend this:Of course, this will have to be done again once on every server you work on, but if you are using a configuration management environment like ansible, puppet or such this can be deployed easily and everybody working on the servers can benefit from it.
You see, there are various ways to do this, what's the best way to do it depends on your environment.
I think you probably don’t need to disable syntax highlighting, the issue is mainly that the default theme colors make comments too hard to read...
I would try to solve the UI issue as in general syntax highlighting will improve your productivity IMHO.
http://dag.wiee.rs/blog/content/improving-putty-settings-on-windows
The advantage of that is you don’t need to adjust anything on the servers you access. A simple change on your workstation alone and maximum return.
Other terminal emulators will usually also allow you to adjust the color scheme.
Note: this is applicable for Ubuntu and probably Debian
Edit
/etc/vim/vimrc
find this line
change to
This will turn off syntax highlighting globally. This can be undone on a per user basis by adding a
.vimrc
file in user homedirs with the commandsyntax on
Hope this is helpful.