6406633
# This will avoid user defined aliases and possibly stuff defined earlier in the PATH.
6406633
# Redirecting is for the case when the binary is missing.
4e95433
set vim_cond (command -v vim)
4e95433
set vi_cond (command -v vi)
6406633
6406633
switch "$vim_cond-$vi_cond"
6406633
  case /usr/bin/vim-/usr/bin/vi
6406633
      # apply only if founded vim and vi are in the expected dir from distro
6406633
      function vi
6406633
        command vim $argv
6406633
      end
6406633
6406633
      function view
6406633
        command vim -R $argv
6406633
      end
6406633
  case -/usr/bin/vi
6406633
      # apply only when no vim is installed and founded vi is in the expected dir from distro
6406633
      function vim
6406633
        command read -p 'No vim found, using vi, press ENTER to continue' -n1 -t 20 -s && vi $argv
6406633
      end
6406633
end
6406633
6406633
# just in case
6406633
set -e vim_cond
6406633
set -e vi_cond