vim/vim.csh
Troy Dawson 964c29439c RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/vim#64066330a22b17c25467dffb1d58f7f56c40128a
2020-10-15 13:25:22 -07:00

21 lines
657 B
Tcsh

# 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`
switch ( $vim_cond-$vi_cond )
case /usr/bin/vim-/usr/bin/vi:
# apply only when founded vim and vi are in expected dirs from distro
alias vi vim
alias view 'vim -R'
breaksw
case -/usr/bin/vi:
# apply only if founded vi is in expected dir from distro
alias vim "read -rep 'No vim found, using vi, press ENTER to continue' -n1 -t 20 -s && vi"
breaksw
endsw
# just in case
unset vim_cond
unset vi_cond