aboutsummaryrefslogtreecommitdiff
path: root/vim/compiler
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-05-29 03:00:30 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-05-29 03:00:30 +1200
commit52a44874f805cad8d51474d905ced6494af53229 (patch)
tree5ba60edaf11e566dbee3d75d53f9676d632a3d01 /vim/compiler
parentRemove vim-cmdwin-ctrlc plugin (diff)
downloaddotfiles-52a44874f805cad8d51474d905ced6494af53229.tar.gz
dotfiles-52a44874f805cad8d51474d905ced6494af53229.zip
Overhaul Vim :compiler scripts
* Drop support for everything before Vim 8.0; this is mostly because of the requirement of %:S for safe 'makeprg' handling; it's not likely that I'll do much development on anything older than v8.0 anymore * Remove :CompilerSet definition for ancient Vims * Add brief comments and URLs to top of file
Diffstat (limited to 'vim/compiler')
-rw-r--r--vim/compiler/bash.vim16
-rw-r--r--vim/compiler/ksh.vim16
-rw-r--r--vim/compiler/perlcritic.vim17
-rw-r--r--vim/compiler/php.vim18
-rw-r--r--vim/compiler/sh.vim16
-rw-r--r--vim/compiler/shellcheck.vim19
-rw-r--r--vim/compiler/vint.vim17
-rw-r--r--vim/compiler/zsh.vim16
8 files changed, 28 insertions, 107 deletions
diff --git a/vim/compiler/bash.vim b/vim/compiler/bash.vim
index 13271e2b..aca87eb7 100644
--- a/vim/compiler/bash.vim
+++ b/vim/compiler/bash.vim
@@ -1,18 +1,8 @@
-if exists('current_compiler')
+" :compiler support for GNU Bash syntax checking with `bash -n`
+if exists('current_compiler') || &compatible || v:version < 800
finish
endif
let current_compiler = 'bash'
-if exists(':CompilerSet') != 2
- command -nargs=* CompilerSet setlocal <args>
-endif
-
-" 7.4.191 is the earliest version with the :S file name modifier, which we
-" really should use if we can
-if v:version >= 704
- \ || v:version == 704 && has('patch191')
- CompilerSet makeprg=bash\ -n\ --\ %:S
-else
- CompilerSet makeprg=bash\ -n\ --\ %
-endif
+CompilerSet makeprg=bash\ -n\ --\ %:S
CompilerSet errorformat=%f:\ line\ %l:\ %m
diff --git a/vim/compiler/ksh.vim b/vim/compiler/ksh.vim
index 5dbff5a1..9ee21748 100644
--- a/vim/compiler/ksh.vim
+++ b/vim/compiler/ksh.vim
@@ -1,18 +1,8 @@
-if exists('current_compiler')
+" :compiler support for Korn shell syntax checking with `ksh -n`
+if exists('current_compiler') || &compatible || v:version < 800
finish
endif
let current_compiler = 'ksh'
-if exists(':CompilerSet') != 2
- command -nargs=* CompilerSet setlocal <args>
-endif
-
-" 7.4.191 is the earliest version with the :S file name modifier, which we
-" really should use if we can
-if v:version >= 704
- \ || v:version == 704 && has('patch191')
- CompilerSet makeprg=ksh\ -n\ --\ %:S
-else
- CompilerSet makeprg=ksh\ -n\ --\ %
-endif
+CompilerSet makeprg=ksh\ -n\ --\ %:S
CompilerSet errorformat=%f:\ %l:\ %m
diff --git a/vim/compiler/perlcritic.vim b/vim/compiler/perlcritic.vim
index b89ee76b..f0d100b6 100644
--- a/vim/compiler/perlcritic.vim
+++ b/vim/compiler/perlcritic.vim
@@ -1,18 +1,9 @@
-if exists('current_compiler')
+" :compiler support for Perl::Critic
+" <https://metacpan.org/pod/Perl::Critic>
+if exists('current_compiler') || &compatible || v:version < 800
finish
endif
let current_compiler = 'perlcritic'
-if exists(':CompilerSet') != 2
- command -nargs=* CompilerSet setlocal <args>
-endif
-
-" 7.4.191 is the earliest version with the :S file name modifier, which we
-" really should use if we can
-if v:version >= 704
- \ || v:version == 704 && has('patch191')
- CompilerSet makeprg=perlcritic\ --verbose\ 1\ --\ %:S
-else
- CompilerSet makeprg=perlcritic\ --verbose\ 1\ --\ %
-endif
+CompilerSet makeprg=perlcritic\ --verbose\ 1\ --\ %:S
CompilerSet errorformat=%f:%l:%c:%m
diff --git a/vim/compiler/php.vim b/vim/compiler/php.vim
index be4283ef..c0c626ec 100644
--- a/vim/compiler/php.vim
+++ b/vim/compiler/php.vim
@@ -1,22 +1,10 @@
-if exists('current_compiler') || &compatible
+" :compiler support for PHP syntax checking with `php -l`
+if exists('current_compiler') || &compatible || v:version < 800
finish
endif
let current_compiler = 'php'
-if exists(':CompilerSet') != 2
- command -nargs=* CompilerSet setlocal <args>
-endif
-
-" 7.4.191 is the earliest version with the :S file name modifier, which we
-" really should use if we can
-if v:version >= 704
- \ || v:version == 704 && has('patch191')
- CompilerSet makeprg=php\ -lq\ -f\ %:S
-else
- CompilerSet makeprg=php\ -lq\ -f\ %
-endif
-
-" Here be copy-pasted dragons
+CompilerSet makeprg=php\ -lq\ -f\ %:S
CompilerSet errorformat=
\%E<b>%.%#Parse\ error</b>:
\\ %m\ in\ <b>%f</b>\ on\ line\ <b>%l</b><br\ />,
diff --git a/vim/compiler/sh.vim b/vim/compiler/sh.vim
index 5e7bc3ba..6abb715e 100644
--- a/vim/compiler/sh.vim
+++ b/vim/compiler/sh.vim
@@ -1,18 +1,8 @@
-if exists('current_compiler')
+" :compiler support for POSIX sh syntax checking with `sh -n`
+if exists('current_compiler') || &compatible || v:version < 800
finish
endif
let current_compiler = 'sh'
-if exists(':CompilerSet') != 2
- command -nargs=* CompilerSet setlocal <args>
-endif
-
-" 7.4.191 is the earliest version with the :S file name modifier, which we
-" really should use if we can
-if v:version >= 704
- \ || v:version == 704 && has('patch191')
- CompilerSet makeprg=sh\ -n\ --\ %:S
-else
- CompilerSet makeprg=sh\ -n\ --\ %
-endif
+CompilerSet makeprg=sh\ -n\ --\ %:S
CompilerSet errorformat=%f:\ %l:\ %m
diff --git a/vim/compiler/shellcheck.vim b/vim/compiler/shellcheck.vim
index fa5db235..f440a23d 100644
--- a/vim/compiler/shellcheck.vim
+++ b/vim/compiler/shellcheck.vim
@@ -1,13 +1,11 @@
-if exists('current_compiler')
+" :compiler support for shell script linting with ShellCheck
+" <https://www.shellcheck.net/>
+if exists('current_compiler') || &compatible || v:version < 800
finish
endif
let current_compiler = 'shellcheck'
-if exists(':CompilerSet') != 2
- command -nargs=* CompilerSet setlocal <args>
-endif
-
-" Build :CompilerSet command based on buffer shell type
+" Build 'makeprg' command line based on this buffer's shell script type
let s:set = 'CompilerSet makeprg=shellcheck\ -e\ SC1090\ -f\ gcc'
if exists('b:is_bash')
let s:set = s:set . '\ -s\ bash'
@@ -16,13 +14,6 @@ elseif exists('b:is_kornshell')
else
let s:set = s:set . '\ -s\ sh'
endif
+execute s:set . '\ --\ %:S'
-" 7.4.191 is the earliest version with the :S file name modifier, which we
-" really should use if we can
-if v:version >= 704
- \ || v:version == 704 && has('patch191')
- execute s:set . '\ --\ %:S'
-else
- execute s:set . '\ --\ %'
-endif
CompilerSet errorformat=%f:%l:%c:\ %m\ [SC%n]
diff --git a/vim/compiler/vint.vim b/vim/compiler/vint.vim
index 35819ae3..8cd35cf1 100644
--- a/vim/compiler/vint.vim
+++ b/vim/compiler/vint.vim
@@ -1,18 +1,9 @@
-if exists('current_compiler')
+" :compiler support for Vim script linting with Vint
+" <https://github.com/Kuniwak/vint>
+if exists('current_compiler') || &compatible || v:version < 800
finish
endif
let current_compiler = 'vimlint'
-if exists(':CompilerSet') != 2
- command -nargs=* CompilerSet setlocal <args>
-endif
-
-" 7.4.191 is the earliest version with the :S file name modifier, which we
-" really should use if we can
-if v:version >= 704
- \ || v:version == 704 && has('patch191')
- CompilerSet makeprg=vint\ --\ %:S
-else
- CompilerSet makeprg=vint\ --\ %
-endif
+CompilerSet makeprg=vint\ --\ %:S
CompilerSet errorformat=%f:%l:%c:\ %m
diff --git a/vim/compiler/zsh.vim b/vim/compiler/zsh.vim
index ad82cc3b..bb8802c9 100644
--- a/vim/compiler/zsh.vim
+++ b/vim/compiler/zsh.vim
@@ -1,18 +1,8 @@
-if exists('current_compiler')
+" :compiler support for Z Shell syntax checking with `zsh -n`
+if exists('current_compiler') || &compatible || v:version < 800
finish
endif
let current_compiler = 'zsh'
-if exists(':CompilerSet') != 2
- command -nargs=* CompilerSet setlocal <args>
-endif
-
-" 7.4.191 is the earliest version with the :S file name modifier, which we
-" really should use if we can
-if v:version >= 704
- \ || v:version == 704 && has('patch191')
- CompilerSet makeprg=zsh\ -n\ --\ %:S
-else
- CompilerSet makeprg=zsh\ -n\ --\ %
-endif
+CompilerSet makeprg=zsh\ -n\ --\ %:S
CompilerSet errorformat=%f:%l:\ %m