run-vim 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. #
  3. # Run a "bare" Vim with just vim-go and ignoring ~/.vim
  4. #
  5. set -euC
  6. vimgodir=$(cd -P "$(dirname "$0")/.." > /dev/null && pwd)
  7. cd "$vimgodir"
  8. coverage=0
  9. while getopts "c" option; do
  10. case "$option" in
  11. c) coverage=1; ;;
  12. esac
  13. done
  14. shift $((OPTIND - 1))
  15. if [ -z "${1:-}" ]; then
  16. echo "unknown version: '${1:-}'"
  17. echo "First argument must be 'vim-7.4', 'vim-8.0', or 'nvim'."
  18. exit 1
  19. fi
  20. dir="/tmp/vim-go-test/$1-install"
  21. export GOPATH=$dir
  22. export PATH=${GOPATH}/bin:$PATH
  23. shift
  24. if [ ! -f "$dir/bin/vim" ]; then
  25. echo "$dir/bin/vim doesn't exist; did you install it with the install-vim script?"
  26. exit 1
  27. fi
  28. if [ $coverage -eq 1 ]; then
  29. covimerage -q run --report-file /tmp/vim-go-test/cov-profile.txt --append \
  30. $dir/bin/vim --noplugin -u NONE -N \
  31. +"set shm+=WAFI rtp=$dir/share/vim/vimgo packpath=$dir/share/vim/vimgo,$vimgodir" \
  32. +'filetype plugin indent on' \
  33. +'packloadall!' \
  34. "$@"
  35. else
  36. $dir/bin/vim --noplugin -u NONE -N \
  37. +"set shm+=WAFI rtp=$dir/share/vim/vimgo packpath=$dir/share/vim/vimgo,$vimgodir" \
  38. +'filetype plugin indent on' \
  39. +'packloadall!' \
  40. "$@"
  41. fi
  42. # vim:ts=2:sts=2:sw=2:et