~ $ echo $EDITOR
/usr/bin/kak
~ $ sudo echo $EDITOR
/usr/bin/kak
~ $ su
Password:
/home/myusername $ echo $EDITOR
/usr/bin/kak
/home/myusername $ cat ~/.profile
# nvim editor config
# export EDITOR='/usr/bin/nvim'
# kakoune editor config
export EDITOR='/usr/bin/kak'
export PAGER=$HOME/.bin/kakpager
export MANPAGER=$HOME/.bin/kakmanpager
/home/myusername cat ~/.zshenv
# nvim editor config
# export EDITOR='/usr/bin/nvim'
# kakoune editor config
export EDITOR='/usr/bin/kak'
export PAGER=$HOME/.bin/kakpager
export MANPAGER=$HOME/.bin/kakmanpager
...
/home/myusername $
but it still nano
Add a comment
|
1 Answer
visudo and
Defaults env_keep += "EDITOR"
thanks to Sato Katsura for pointing me out
-
I hurried with the answer, but now it's correctsrghma– srghma2017-06-13 18:27:21 +00:00Commented Jun 13, 2017 at 18:27
-
I think something should be said abut why this is. There are security risks associated with keeping environment variables - e.g.: the user could set their EDITOR variable to
/bin/bash, then they would get a shell when executing anything that uses $EDITOR to spawn what it thinks is an editor.Henrik supports the community– Henrik supports the community2022-05-06 22:57:32 +00:00Commented May 6, 2022 at 22:57