zsh.vim 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. " Vim filetype plugin file
  2. " Language: Zsh shell script
  3. " Maintainer: Christian Brabandt <cb@256bit.org>
  4. " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
  5. " Latest Revision: 2021-04-03
  6. " License: Vim (see :h license)
  7. " Repository: https://github.com/chrisbra/vim-zsh
  8. if exists("b:did_ftplugin")
  9. finish
  10. endif
  11. let b:did_ftplugin = 1
  12. let s:cpo_save = &cpo
  13. set cpo&vim
  14. setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
  15. let b:undo_ftplugin = "setl com< cms< fo< "
  16. if executable('zsh') && &shell !~# '/\%(nologin\|false\)$'
  17. if !has('gui_running') && executable('less')
  18. command! -buffer -nargs=1 RunHelp silent exe '!MANPAGER= zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null | LESS= less"' | redraw!
  19. elseif has('terminal')
  20. command! -buffer -nargs=1 RunHelp silent exe ':term zsh -c "autoload -Uz run-help; run-help <args>"'
  21. else
  22. command! -buffer -nargs=1 RunHelp echo system('zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null"')
  23. endif
  24. if !exists('current_compiler')
  25. compiler zsh
  26. endif
  27. setlocal keywordprg=:RunHelp
  28. let b:undo_ftplugin .= 'keywordprg<'
  29. endif
  30. let b:match_words = '\<if\>:\<elif\>:\<else\>:\<fi\>'
  31. \ . ',\<case\>:^\s*([^)]*):\<esac\>'
  32. \ . ',\<\%(select\|while\|until\|repeat\|for\%(each\)\=\)\>:\<done\>'
  33. let b:match_skip = 's:comment\|string\|heredoc\|subst'
  34. let &cpo = s:cpo_save
  35. unlet s:cpo_save