I tried export EDITOR=/usr/bin/vim
but maybe the “nano-default-editor” rpm installed by default has a higher priority or smt?
The only thing that should matter is the $EDITOR
variable.
I have added this in my .zshrc
:
if [ "$EDITOR" = "/usr/bin/nano" ]; then
export EDITOR=vim
fi
I am using bash (the default) and I have added the following four lines to the end of $HOME/.bashrc
file:
# Set default text editor
if [ -f /usr/bin/vim ]; then
export EDITOR=/usr/bin/vim
fi
If statement checks if vim program is installed and export does sets the default text editor variable to vim.
Save the file and in terminal:
source $HOME/.bashrc
or logout of Blufin (or other variant) and log back in.
Check if setting is correct:
echo $EDITOR
and it should be displayed: /usr/bin/vim
EDIT: Some tools may not respect this, because they sanitize environment variables. For example sudo visudo
still opens in Nano. To open visudo in vim then start visudo with: sudo EDITOR=vim visudo
and I suggest to also add the following at the end of opened config file:
## Default text editor
Defaults editor=/usr/bin/vim
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.