1

I need to pass a paramter (-extract) to the jshint syntax checker such that it extracts JavaScript from HTML before checking. Unfortunatly I have no idea how to do that for syntastic.

2

Syntastic allows passing arguments directly to the checkers using the syntastic_<filetype>_<checker>_<option> variable name format. It supports global (g:) and buffer (b:) variants with the buffer having preference over the global one. filetype and checker are obvious so I won't get in detail. option is what interests you. It can be exe, args, fname, post_args or tail. Put one after another they build the command that syntastic will execute. See the help "link" below for more details.

In your case you probably want to modify args for (I assume) the html filetype. You can put this global variable in your vimrc file to pass the command line parameter:

let g:syntastic_html_jshint_args="-extract"

Or using an auto command set it for a specific buffer. Examples:

autocmd FileType html let b:syntastic_html_jshint_args="-extract"
autocmd BufNewFile,BufRead file.html,another_file.html let b:syntastic_html_jshint_args="-extract"

You can check more details with :help syntastic-config-makeprg or online at the github repo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.