zsh.vim (1501B)
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: 2025 Jul 23 6 " License: Vim (see :h license) 7 " Repository: https://github.com/chrisbra/vim-zsh 8 9 if exists("b:did_ftplugin") 10 finish 11 endif 12 let b:did_ftplugin = 1 13 14 let s:cpo_save = &cpo 15 set cpo&vim 16 17 setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql 18 19 let b:undo_ftplugin = "setl com< cms< fo< " 20 21 if get(g:, 'zsh_fold_enable', 0) 22 setlocal foldmethod=syntax 23 let b:undo_ftplugin .= "fdm< " 24 endif 25 26 if executable('zsh') && &shell !~# '/\%(nologin\|false\)$' 27 if exists(':terminal') == 2 28 command! -buffer -nargs=1 ZshKeywordPrg silent exe ':hor :term zsh -c "autoload -Uz run-help; run-help <args>"' 29 else 30 command! -buffer -nargs=1 ZshKeywordPrg echo system('MANPAGER= zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null"') 31 endif 32 setlocal keywordprg=:ZshKeywordPrg 33 let b:undo_ftplugin .= '| setl keywordprg< | sil! delc -buffer ZshKeywordPrg' 34 35 if !exists('current_compiler') 36 compiler zsh 37 endif 38 let b:undo_ftplugin .= ' | compiler make' 39 endif 40 41 let b:match_words = '\<if\>:\<elif\>:\<else\>:\<fi\>' 42 \ . ',\<case\>:^\s*([^)]*):\<esac\>' 43 \ . ',\<\%(select\|while\|until\|repeat\|for\%(each\)\=\)\>:\<done\>' 44 let b:match_skip = 's:comment\|string\|heredoc\|subst' 45 46 let &cpo = s:cpo_save 47 unlet s:cpo_save