blob: 5e69336aad9039e5dc36dea4ad06056b2f3c65a6 [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>
Konfekt41c7bba2024-09-19 18:19:43 +02005" Latest Revision: 2024 Sep 19
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
Bram Moolenaarfa3b7232021-12-24 13:18:38 +000021if executable('zsh') && &shell !~# '/\%(nologin\|false\)$'
Bram Moolenaar23515b42020-11-29 14:36:24 +010022 if !has('gui_running') && executable('less')
Enno1e33cd72023-10-08 19:14:07 +020023 command! -buffer -nargs=1 ZshKeywordPrg silent exe '!MANPAGER= zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null | LESS= less"' | redraw!
Bram Moolenaar23515b42020-11-29 14:36:24 +010024 elseif has('terminal')
Enno1e33cd72023-10-08 19:14:07 +020025 command! -buffer -nargs=1 ZshKeywordPrg silent exe ':term zsh -c "autoload -Uz run-help; run-help <args>"'
Bram Moolenaar23515b42020-11-29 14:36:24 +010026 else
D. Ben Knoble8d8cb452024-05-06 19:52:53 +020027 command! -buffer -nargs=1 ZshKeywordPrg echo system('MANPAGER= zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null"')
Bram Moolenaar23515b42020-11-29 14:36:24 +010028 endif
Konfekt41c7bba2024-09-19 18:19:43 +020029 setlocal keywordprg=:ZshKeywordPrg
30 let b:undo_ftplugin .= '| setl keywordprg< | sil! delc -buffer ZshKeywordPrg'
31
Bram Moolenaar23515b42020-11-29 14:36:24 +010032 if !exists('current_compiler')
33 compiler zsh
34 endif
Konfekt41c7bba2024-09-19 18:19:43 +020035 let b:undo_ftplugin .= ' | compiler make'
Bram Moolenaarb17893a2020-03-14 08:19:51 +010036endif
37
Bram Moolenaar23515b42020-11-29 14:36:24 +010038let b:match_words = '\<if\>:\<elif\>:\<else\>:\<fi\>'
Bram Moolenaard58e9292011-02-09 17:07:58 +010039 \ . ',\<case\>:^\s*([^)]*):\<esac\>'
40 \ . ',\<\%(select\|while\|until\|repeat\|for\%(each\)\=\)\>:\<done\>'
41let b:match_skip = 's:comment\|string\|heredoc\|subst'
42
Bram Moolenaare37d50a2008-08-06 17:06:04 +000043let &cpo = s:cpo_save
44unlet s:cpo_save