Move vim option select to execute logic at alias def time

Using the function would cause problems when trying to perform a `sudo
vim`. The sudo command would run in a root shell which does not have my
shells functions (but does have it's aliases) so then any attempt to
sudo vim would fail with "vim_option_select: command not found"
This commit is contained in:
Andrew R. M. 2024-07-03 20:16:09 -04:00
parent ec19718182
commit f64da797ce
2 changed files with 8 additions and 10 deletions

View File

@ -5,6 +5,14 @@
# Allow alias expansion for commands executed with sudo
alias sudo="sudo "
#{- VIM OPTION SELECT -}#
if which nvim &> /dev/null; then
export PREFERRED_VIM=nvim
else
export PREFERRED_VIM=vim
fi
alias vim="$PREFERRED_VIM "
#{- GNU COREUTILS -}#
# Sort directories first and colorize output

View File

@ -21,13 +21,3 @@ cat_with_newline()
cat "$@" && echo
}
alias cat="cat_with_newline"
vim_option_select()
{
if which nvim &> /dev/null; then
nvim "$@"
else
vim "$@"
fi
}
alias vim="vim_option_select "