blob: 5d4f4fe256e5aa3784401a1c6946b405035e9262 [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\)$'
Konfektf86568f2024-09-19 19:34:40 +020022 if exists(':terminal') == 2
Enno1e33cd72023-10-08 19:14:07 +020023 command! -buffer -nargs=1 ZshKeywordPrg silent exe ':term zsh -c "autoload -Uz run-help; run-help <args>"'
Bram Moolenaar23515b42020-11-29 14:36:24 +010024 else
D. Ben Knoble8d8cb452024-05-06 19:52:53 +020025 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 +010026 endif
Konfekt41c7bba2024-09-19 18:19:43 +020027 setlocal keywordprg=:ZshKeywordPrg
28 let b:undo_ftplugin .= '| setl keywordprg< | sil! delc -buffer ZshKeywordPrg'
29
Bram Moolenaar23515b42020-11-29 14:36:24 +010030 if !exists('current_compiler')
31 compiler zsh
32 endif
Konfekt41c7bba2024-09-19 18:19:43 +020033 let b:undo_ftplugin .= ' | compiler make'
Bram Moolenaarb17893a2020-03-14 08:19:51 +010034endif
35
Bram Moolenaar23515b42020-11-29 14:36:24 +010036let b:match_words = '\<if\>:\<elif\>:\<else\>:\<fi\>'
Bram Moolenaard58e9292011-02-09 17:07:58 +010037 \ . ',\<case\>:^\s*([^)]*):\<esac\>'
38 \ . ',\<\%(select\|while\|until\|repeat\|for\%(each\)\=\)\>:\<done\>'
39let b:match_skip = 's:comment\|string\|heredoc\|subst'
40
Bram Moolenaare37d50a2008-08-06 17:06:04 +000041let &cpo = s:cpo_save
42unlet s:cpo_save