On 1 Oct 2009, at 15:44, Arthur D. wrote:
...
I just installed VIM with emerge, and removed nano because I
considered
it to be absolutely unnecessary in my system. Why I need nano? I am
a VIM
fan. And here the troubles begin...
Run "sudo visudo" and you get this:
~ $ sudo visudo
visudo: no editor found (editor path = /bin/nano)
~ $ env | grep -i edit
EDITOR=/usr/bin/vim
You seem to have alienated some responses with your posting manner,
but it seems that folks are replying without reading the above.
Here, as user stroller, `sudo visudo` runs nano. If I `su` to root,
then vi is used.
In both environments `echo $EDITOR` now returns "/usr/bin/vim".
(previously user stroller had just "vi" set as editor, but changing it
& sourcing .bashrc doesn't make any difference)
I'm unclear why the user preference of editor seems to be ignored here.
If I `touch /etc/sudoers.tmp && touch /etc/sudoers.tmp && chmod 777 /
etc/sudoers.tmp /etc/sudoers` then `visudo` does indeed seem to use vi.
So it seems to me that you're right. It appears like maybe when `sudo`
detects that it's running `visudo` it does seem to ignore $EDITOR. I,
too, disagree with this behaviour. IMO the ebuild ("--with-editor=/bin/
nano") take the editor from "/etc/rc.conf", but I'm extremely curious
why upstream makes this behaviour, anyway.
Stroller.