blob: ed75d040036e41187f4cb9dc464016bf37a2bf40 [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 Moolenaar71b6d332022-09-10 13:13:14 +01005" Latest Revision: 2021-04-03
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')
Bram Moolenaarfa3b7232021-12-24 13:18:38 +000023 command! -buffer -nargs=1 RunHelp 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')
Bram Moolenaarfa3b7232021-12-24 13:18:38 +000025 command! -buffer -nargs=1 RunHelp silent exe ':term zsh -c "autoload -Uz run-help; run-help <args>"'
Bram Moolenaar23515b42020-11-29 14:36:24 +010026 else
Bram Moolenaarfa3b7232021-12-24 13:18:38 +000027 command! -buffer -nargs=1 RunHelp echo system('zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null"')
Bram Moolenaar23515b42020-11-29 14:36:24 +010028 endif
29 if !exists('current_compiler')
30 compiler zsh
31 endif
Bram Moolenaarb17893a2020-03-14 08:19:51 +010032 setlocal keywordprg=:RunHelp
Enno9d8ef7c2023-08-30 16:37:05 +020033 let b:undo_ftplugin .= 'keywordprg< | sil! delc -buffer RunHelp'
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