Open nemumaru opened 1 year ago
This is not a bug of micro
and no bug at all.
By invoking sudo
the default behavior is to ignore the environment of the invoking user. This can be changed by using sudo -E [COMMAND]
.
So in your scenario you've to add -config-dir=
with sudo
or using sudo -E
, which will then respect $MICRO_CONFIG_HOME
.
Or set "autosu": true,
in ~/.config/micro/settings.json
to avoid sudo
command. The sudo prompt will be appears when you save file.
Or set
"autosu": true
Yes, this can be a further solution, but many users are already familiar with the invocation of sudo
or sudoedit
and they need to preserve the environment to user their normal user settings.
Description of the problem or steps to reproduce
On an up to date system run
sudo apt install
followed bysudo apt update
andsudo apt upgrade
. Download dracula theme to ~/.config/micro/colorschemes. I also gave catppuccin themes a try, same results.Specifications
Third party colorschemes do not work under sudo. They do as a regular user and the themes provided by micro itself can be changed under sudo. Regarding Issue 2201 I went into .bashrc and added the line
export MICRO_CONFIG_HOME=/home/myusername/.config/micro/
. I also gave the value "~/.config/micro/" a try, both times with and without quotation marks. Everytime I did a change, I saved the file, backed out of it, closed alacritty, restarted alacritty, ransudo micro
and tried to set a scheme with CTRL+E->set colorscheme dracula->Enter. Unfortunately I get faced with "dracula is not a valid colorscheme". Everything works fine when using micro without sudo privs.I also ran
sudo micro -config-dir /home/myusername/.config/micro/
again, once with and once without quotation marks. After both runs a blank file opened and I hit CTRL+E->set colorscheme dracula->Enter. No Error-Message, but also no change in the visuals. When backing out of the file and runningsudo micro
, there still is no change in the visuals, when now trying to change the scheme again, I am hit with "dracula is not a valid colorscheme".The export which is set in the .bashrc itself seems to work though as there are now a folder called buffers, a bindings.json and settings.json file in the /.config/micro/ folder. The settings.json file does hold the data
colorscheme "dracula"
as expected.Commit hash: 2.0.11 OS: Debian 12 Terminal: Alacritty Shell: bash 5.2.15