|
Zdenek Dohnal |
17062c |
# we need to use which twice - first for checking if
|
|
Zdenek Dohnal |
17062c |
# the command doesn't fail, the use it if doesn't fail
|
|
Zdenek Dohnal |
4e9543 |
set vim_cond = `command -v vim`
|
|
Zdenek Dohnal |
4e9543 |
set vi_cond = `command -v vi`
|
|
Karsten Hopp |
82a60b |
|
|
Zdenek Dohnal |
17062c |
switch ( $vim_cond-$vi_cond )
|
|
Zdenek Dohnal |
17062c |
case /usr/bin/vim-/usr/bin/vi:
|
|
Zdenek Dohnal |
17062c |
# apply only when founded vim and vi are in expected dirs from distro
|
|
Zdenek Dohnal |
17062c |
alias vi vim
|
|
Zdenek Dohnal |
17062c |
alias view 'vim -R'
|
|
Zdenek Dohnal |
17062c |
breaksw
|
|
Zdenek Dohnal |
17062c |
case -/usr/bin/vi:
|
|
Zdenek Dohnal |
17062c |
# apply only if founded vi is in expected dir from distro
|
|
Zdenek Dohnal |
17062c |
alias vim "read -rep 'No vim found, using vi, press ENTER to continue' -n1 -t 20 -s && vi"
|
|
Zdenek Dohnal |
17062c |
breaksw
|
|
Zdenek Dohnal |
17062c |
endsw
|
|
Zdenek Dohnal |
17062c |
|
|
Zdenek Dohnal |
17062c |
# just in case
|
|
Zdenek Dohnal |
17062c |
unset vim_cond
|
|
Zdenek Dohnal |
17062c |
unset vi_cond
|