How to get Syntastic to load another check based on the existence of files in the root?

At work, we use a different syntax check than when working with open source. Is there a way Syntasticto specify a default check and change the checkers if a file is found in the project root rc?

Example: if found .eslintrc, use eslint. If not .eslintrc, use standard.

Thank!

edit: the problem also opened on scrooloose / syntastic .

+4
source share
2 answers

Yes, you can do something like this:

autocmd FileType javascript let b:syntastic_checkers = findfile('.eslintrc', '.;') != '' ? ['eslint'] : ['standard']

: , :

  • autocmd FileType javascript - , filetype javascript ( )
  • b:syntastic_checkers , , g:syntastic_javascript_checkers
  • findfile('.eslintrc', ...) - .eslintrc...
  • .; -...
  • != '' ? - ...
  • ['eslint'] -... b:syntastic_checkers ['eslint']
  • : ['standard'] -... ['standard']

, .

+14

, , , .vimrc:

if findfile('.lvimrc','.') != ''
    source .lvimrc
endif

, - , .lvimrc , .

0

All Articles