Nimbin[12]?Mirrors & Forks / syntastic / commits / eff1f1b6

syntastic git · master

syntastic vim plugin (fork)

vim fork · first commit 2009-07-10 · last commit 2022-07-10 (4 years ago) · synced 3 days ago · upstream: github.com/vim-syntastic/syntastic

Vim Script 99%
git clone https://git.christianimmanuel.de/mirrors-forks/syntastic.gitwget https://git.christianimmanuel.de/mirrors-forks/syntastic/archive/syntastic.tar.gz

New checker for sh: shfmt.

LCD 47 · 2019-10-23 06:23 · eff1f1b67971f144165dd009cd895b241ec66a0c

 doc/syntastic-checkers.txt   | 17 +++++++++++++++++
 plugin/syntastic.vim         |  2 +-
 syntax_checkers/sh/shfmt.vim | 40 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/doc/syntastic-checkers.txt b/doc/syntastic-checkers.txt
index 64d51e41..8fcbe8bb 100644
--- a/doc/syntastic-checkers.txt
+++ b/doc/syntastic-checkers.txt
@@ -6304,6 +6304,7 @@ The following checkers are available for Sh (filetype "sh"):
     2. checkbashisms............|syntastic-sh-checkbashisms|
     3. sh.......................|syntastic-sh-sh|
     4. ShellCheck...............|syntastic-sh-shellcheck|
+    5. shfmt....................|syntastic-sh-shfmt|
 
 ------------------------------------------------------------------------------
 1. Bashate                                              *syntastic-sh-bashate*
@@ -6371,6 +6372,22 @@ Checker options~
 This checker is initialised using the "makeprgBuild()" function and thus it
 accepts the standard options described at |syntastic-config-makeprg|.
 
+------------------------------------------------------------------------------
+5. shfmt                                                  *syntastic-sh-shfmt*
+
+Name:        shfmt
+Maintainer:  LCD 47 <lcd047@gmail.com>
+
+"shfmt" is a parser, formatter, and interpreter for sh/bash/mksh. See the
+project's page at GitHub for details:
+
+    https://github.com/mvdan/sh
+
+Checker options~
+
+This checker is initialised using the "makeprgBuild()" function and thus it
+accepts the standard options described at |syntastic-config-makeprg|.
+
 ==============================================================================
 SYNTAX CHECKERS FOR SLIM                             *syntastic-checkers-slim*
 
diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim
index 589be3c8..c2ef4ad3 100644
--- a/plugin/syntastic.vim
+++ b/plugin/syntastic.vim
@@ -19,7 +19,7 @@ if has('reltime')
     lockvar! g:_SYNTASTIC_START
 endif
 
-let g:_SYNTASTIC_VERSION = '3.10.0-1'
+let g:_SYNTASTIC_VERSION = '3.10.0-2'
 lockvar g:_SYNTASTIC_VERSION
 
 " Sanity checks {{{1
diff --git a/syntax_checkers/sh/shfmt.vim b/syntax_checkers/sh/shfmt.vim
new file mode 100644
index 00000000..77435f36
--- /dev/null
+++ b/syntax_checkers/sh/shfmt.vim
@@ -0,0 +1,40 @@
+"============================================================================
+"File:        shfmt.vim
+"Description: Syntax checking plugin for syntastic
+"Maintainer:  LCD 47 <lcd047 at gmail dot com>
+"License:     This program is free software. It comes without any warranty,
+"             to the extent permitted by applicable law. You can redistribute
+"             it and/or modify it under the terms of the Do What The Fuck You
+"             Want To Public License, Version 2, as published by Sam Hocevar.
+"             See http://sam.zoy.org/wtfpl/COPYING for more details.
+"
+"============================================================================
+
+if exists('g:loaded_syntastic_sh_shfmt_checker')
+    finish
+endif
+let g:loaded_syntastic_sh_shfmt_checker = 1
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+function! SyntaxCheckers_sh_shfmt_GetLocList() dict
+    let makeprg = self.makeprgBuild({})
+
+    let errorformat =
+        \ '%f:%l:%c: %m'
+
+    return SyntasticMake({
+        \ 'makeprg': makeprg,
+        \ 'errorformat': errorformat,
+        \ 'returns': [0, 1] })
+endfunction
+
+call g:SyntasticRegistry.CreateAndRegisterChecker({
+    \ 'filetype': 'sh',
+    \ 'name': 'shfmt'})
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
+
+" vim: set sw=4 sts=4 et fdm=marker: