You are not logged in.
Pages: 1
Topic closed
Hi
I have a color scheme in vim that I really like and everything works perfect as normal user, but as soon as I start vim with sudo (to edit some configs for example), I get a totally different color scheme that's pretty hard on the eyes. I've (soft)linked .vim .vimrc .viminfo .bashrc .themes .icons and .Xdefaults from /root/ to the ones in my home directory but it wont work...
Does anyone know where this stuff is configured?
Offline
maybe /etc/vimrc ?
A w e s o m e
r
c
h
Offline
That should be read by root and normal users in the same way, doesn't it?
Offline
think so, test it out
A w e s o m e
r
c
h
Offline
I've got a /etc/vimrc and a /etc/virc but none of them has any user-specific rules. All home folders and such are referred with $HOME...
I have no clue how these files could cause a difference between root and others. And as said, all config files from /root/ are linked to the working ones in my home directory, which root should be able to read.
Offline
try to put 'sudoedit' into your sudoers (just that command, no path). Then sudoedit normally should open vim with your user environment but root privileges. (I have put some 0-byte vimrc/gvimrc files into /etc so that they don't mess up my setup, and there's no .vimanything in /root)
Last edited by awagner (2007-10-29 21:01:04)
Offline
You might also want to try "sudo -E" to preserve your environment...not sure if it will work the way you think though.
Offline
Thanks for the replies
When I try to use the "-E" option I get this:
sudo -E vim
Password:
sudo: sorry, you are not allowed to preserve the environment
I've got full sudo privileges (ALL=(ALL) ALL).
And I tried adding "sudoedit" in /etc/sudoers through visudo but wherever I place it (defaults line, alias line, privilege specification line) I get a syntax error complaint...
Offline
And I tried adding "sudoedit" in /etc/sudoers through visudo but wherever I place it (defaults line, alias line, privilege specification line) I get a syntax error complaint...
I have something along the lines of:
MyUsername ALL = (ALL) PASSWD: /usr/sbin/visudo, /bin/echo, sudoedit
Offline
This is allowed by visudo:
username ALL=(ALL) ALL,sudoedit
But it doesn't fix the color scheme problem...
I appreciate your input though!
Last edited by Ramses de Norre (2007-10-29 22:35:44)
Offline
I found that when I add the "sudoedit" option, I can edit files through sudo -e filename.
It's done by copying the edited files to a temp file, editing that file as regular user and then moving that file back to the original destination. The editor used is defined by setting the EDITOR env variable.
I'll use this method if I don't find a better option
Offline
sorry, I didn't see your last posting.
But what you have described is what I have been after. Actually sudoedit filename should be doing that same thing.
Offline
Ow, nice
Thanks for the help, I'll use this if I can't find a way to make vim act normal.
Offline
I don't know if your issue is still open, but here is the solution. vim takes certain settings from the color settings that you use in your console. If you enter the root console via 'su', you'll see that the colors are different. What you can do is copy your .bashrc file, or parts of it, to /root/ and then vi will show the same colors.
Offline
sudo visudo, and add this
Defaults !env_reset
this work well for me.
Offline
thisiskun, please don't necrobump https://wiki.archlinux.org/index.php/Fo … Bumping.22
The information you posted is included in the wiki page...
Closing
Offline
Pages: 1
Topic closed