vim.sh, vim.csh, vim.fish - drop 'which', use 'command'

This commit is contained in:
Zdenek Dohnal 2020-10-19 09:48:46 +02:00
parent 64066330a2
commit 4e95433cde
4 changed files with 8 additions and 9 deletions

View File

@ -1,7 +1,7 @@
# we need to use which twice - first for checking if
# the command doesn't fail, the use it if doesn't fail
set vim_cond = `which vim >& /dev/null && which vim`
set vi_cond = `which vi >& /dev/null && which vi`
set vim_cond = `command -v vim`
set vi_cond = `command -v vi`
switch ( $vim_cond-$vi_cond )
case /usr/bin/vim-/usr/bin/vi:

View File

@ -1,7 +1,7 @@
# This will avoid user defined aliases and possibly stuff defined earlier in the PATH.
# Redirecting is for the case when the binary is missing.
set vim_cond (which vim 2> /dev/null)
set vi_cond (which vi 2> /dev/null)
set vim_cond (command -v vim)
set vi_cond (command -v vi)
switch "$vim_cond-$vi_cond"
case /usr/bin/vim-/usr/bin/vi

2
vim.sh
View File

@ -1,6 +1,6 @@
if [ -n "${BASH_VERSION-}" -o -n "${KSH_VERSION-}" -o -n "${ZSH_VERSION-}" ]; then
# This will avoid user defined aliases and possibly stuff defined earlier in the PATH.
case "$(which vim 2> /dev/null)-$(which vi 2> /dev/null)" in
case "$(command -v vim)-$(command -v vi)" in
/usr/bin/vim-/usr/bin/vi)
# apply only when founded vim and vi are in expected dirs from distro
alias vi=vim

View File

@ -129,8 +129,6 @@ Conflicts: %{name}-common < %{epoch}:8.1.1-1
Conflicts: vim-enhanced < 2:8.2.1815-2
Provides: vi
Provides: %{_bindir}/vi
# needed for profile script
Requires: which
%description minimal
VIM (VIsual editor iMproved) is an updated and improved version of the
@ -152,8 +150,6 @@ Provides: vim
Provides: %{_bindir}/mergetool
Provides: %{_bindir}/vim
Requires: vim-common = %{epoch}:%{version}-%{release} which
# needed for profile script
Requires: which
# suggest python3, python2, lua, ruby and perl packages because of their
# embedded functionality in Vim/GVim
Suggests: python3 python3-libs
@ -827,6 +823,9 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags
%config(noreplace) %{_sysconfdir}/profile.d/vim-default-editor.*
%changelog
* Mon Oct 19 2020 Zdenek Dohnal <zdohnal@redhat.com> - 2:8.2.1815-2
- vim.sh, vim.csh, vim.fish - drop 'which', use 'command'
* Thu Oct 15 2020 Zdenek Dohnal <zdohnal@redhat.com> - 2:8.2.1815-2
- vim-default-editor.fish - dont give EDITOR universal scope
- vim.sh, vim.csh - set aliases only for OS default vi and vim