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