2
~ $ 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
srghma
  • 249
  • 2
  • 10

1 Answers1

2

visudo and

Defaults env_keep += "EDITOR"

thanks to Sato Katsura for pointing me out

srghma
  • 249
  • 2
  • 10
  • I hurried with the answer, but now it's correct – srghma Jun 13 '17 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 May 06 '22 at 22:57