Am Di, den 22.02.2005 schrieb H. Crissman um 20:13:
When I "vi example.file" the text inside the file is color coded based on format (ie. commented out lines are blue). But when I "sudo vi example.file" that color coding is lost. How can I enable that when I edit a file using sudo? It really helps when you are looking at a long config file.
H. Crissman
vi is not vim. vi is just an alias to vim. So if you use "sudo" you invoke vi instead of vim. vi has no highlighting capabilities, which is even a feature provided by the vim-enhanced package.
sudo vim <file>
and you have back your syntax highlighting.
Yup. Remember, "sudo" changes your UID, but does NOT give you the same
environment (variables, aliases, etc.), since the user's login scripts
aren't run. In fact, "su username" doesn't give you "username's"
environment either. "su - username" DOES give you the environment (the "-" makes it look like a login, so the login scripts are run).
Just one of the subtle differences. ---------------------------------------------------------------------- - Rick Stevens, Senior Systems Engineer rstevens@xxxxxxxxxxxxxxx - - VitalStream, Inc. http://www.vitalstream.com - - - - A day for firm decisions!!! Well, then again, maybe not! - ----------------------------------------------------------------------