How is a shellscript syntax checker invoked (by/with syntastic and pathogen)?

1.6k Views Asked by At

When I work on a bash/sh script, pathogen kicks in and correctly loads everything that's in ~/.vim/bundle/syntastic/syntax_checkers/sh/. I checked with :scriptnames in command-line mode. Included are shellcheck.vim, checkbashism.vim, bashate.vim etc.

Starting a vim session filetype is correctly detected and the corresponding bundled syntax-checking scripts are loaded.

But how does syntastic invoke /usr/bin/shellcheck or bashate or checkbashism? There is nothing immediately obvious for it in ~/.vimrc.

Can more than one syntax checker be invoked at the same time? E.g. can shellcheck AND bashate work alongside one another? Thanks.

2

There are 2 best solutions below

2
On BEST ANSWER

The only role of pathogen in your setup is to append the path and subpaths of each of your plugins to the 'runtimepath' option when Vim starts up. Nothing more, nothing less.

As for Syntastic, the default checkers for shell scripts are sh and shellcheck. Read :help syntastic-checker-options to learn how to define your own list of checkers.

0
On

From what romainl only linked to (the relevant parts of links should be quoted when answering):

You can tell syntastic which checkers to run for a given filetype by setting a variable 'g:syntastic__checkers' to a list of checkers, e.g.

let g:syntastic_php_checkers = ["php", "phpcs", "phpmd"]

As for your question about invocation: according to the FAQ, the "command line is constructed using an internal function named makeprgBuild(), which provides a number of options that allow you to customise every part of the command that gets run. You can set these options using global variables". (See this answer.)