blob: 741f31b42cb5e2182b27611e2f8933e1250036c4 [file] [log] [blame]
Bram Moolenaar42eeac32005-06-29 22:40:58 +00001" Vim filetype plugin file
Bram Moolenaarf55e4c82017-08-01 20:44:53 +02002" Language: Zsh shell script
3" Maintainer: Christian Brabandt <cb@256bit.org>
4" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
Bram Moolenaarb17893a2020-03-14 08:19:51 +01005" Latest Revision: 2020-01-10
Bram Moolenaarf55e4c82017-08-01 20:44:53 +02006" License: Vim (see :h license)
7" Repository: https://github.com/chrisbra/vim-zsh
Bram Moolenaar42eeac32005-06-29 22:40:58 +00008
9if exists("b:did_ftplugin")
10 finish
11endif
12let b:did_ftplugin = 1
13
Bram Moolenaare37d50a2008-08-06 17:06:04 +000014let s:cpo_save = &cpo
15set cpo&vim
16
Bram Moolenaar0dc065e2005-07-04 22:49:24 +000017setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
Bram Moolenaare37d50a2008-08-06 17:06:04 +000018
Bram Moolenaarb17893a2020-03-14 08:19:51 +010019let 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 '!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 setlocal keywordprg=:RunHelp
30 setlocal makeprg=zsh\ -n\ --\ %:S
31 setlocal errorformat=%f:\ line\ %l:\ %m
32 let b:undo_ftplugin .= 'keywordprg< errorformat< makeprg<'
33endif
34
Bram Moolenaar2f058492017-11-30 20:27:52 +010035let b:match_words = ',\<if\>:\<elif\>:\<else\>:\<fi\>'
Bram Moolenaard58e9292011-02-09 17:07:58 +010036 \ . ',\<case\>:^\s*([^)]*):\<esac\>'
37 \ . ',\<\%(select\|while\|until\|repeat\|for\%(each\)\=\)\>:\<done\>'
38let b:match_skip = 's:comment\|string\|heredoc\|subst'
39
Bram Moolenaare37d50a2008-08-06 17:06:04 +000040let &cpo = s:cpo_save
41unlet s:cpo_save