From c8e173c4efb30c47237d6da374322c6894933637 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 28 Oct 2013 08:20:21 +0200 Subject: [PATCH] Make g:syntastic_filetype_map apply to composite filetypes. Normally composite types are handled by splitting them into simple components, and applying the corresponding (simple) checkers. This behaviour can now be disabled, by mapping composite types to a simple ones. --- doc/syntastic.txt | 45 ++++++++++++++++++++++++++++++++------------ plugin/syntastic.vim | 2 +- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 86cb68a9..2537e611 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -19,16 +19,18 @@ ============================================================================== CONTENTS *syntastic-contents* - 1.Intro...................................|syntastic-intro| - 2.Functionality provided..................|syntastic-functionality| - 2.1.The statusline flag...............|syntastic-statusline-flag| - 2.2.Error signs.......................|syntastic-error-signs| - 2.3.Error window......................|syntastic-error-window| - 3.Commands................................|syntastic-commands| - 4.Global Options..........................|syntastic-global-options| - 5.Checker Options.........................|syntastic-checker-options| - 6.About...................................|syntastic-about| - 7.License.................................|syntastic-license| + 1.Intro........................................|syntastic-intro| + 2.Functionality provided.......................|syntastic-functionality| + 2.1.The statusline flag....................|syntastic-statusline-flag| + 2.2.Error signs............................|syntastic-error-signs| + 2.3.Error window...........................|syntastic-error-window| + 3.Commands.....................................|syntastic-commands| + 4.Global Options...............................|syntastic-global-options| + 5.Checker Options..............................|syntastic-checker-options| + 6.Notes........................................|syntastic-notes| + 6.1.Handling of composite filetypes........|syntastic-composite| + 7.About........................................|syntastic-about| + 8.License......................................|syntastic-license| ============================================================================== @@ -286,6 +288,11 @@ non-standard filetypes: > \ 'gentoo-metadata': 'xml' } < +Composite filetypes can also be mapped to simple types, which disables the +default behaviour of running both checkers against the input file: > + let g:syntastic_filetype_map = { 'handlebars.html': 'handlebars' } +< + *'syntastic_mode_map'* Default: { "mode": "active", "active_filetypes": [], @@ -450,7 +457,21 @@ specific options that can be set, these are usually documented in the wiki: https://github.com/scrooloose/syntastic/wiki/Syntaxcheckers ============================================================================== -6. About *syntastic-about* +6. Notes *syntastic-notes* + +------------------------------------------------------------------------------ +6.1. Handling of composite filetypes *syntastic-composite* + +Some Vim plugins use composite filetypes, such as 'django.python' or +'handlebars.html'. Normally, syntastic deals with this situation by splitting +the filetype in its simple components, and calling all checkers that apply. +If this behaviour is not desirable, you can disable it by mapping the +composite filetypes to a simple ones using |syntastic_filetype_map|, e.g.: > + let g:syntastic_filetype_map = { 'handlebars.html': 'handlebars' } +< + +============================================================================== +7. About *syntastic-about* The core maintainers of syntastic are: Martin Grenfell (github: scrooloose) @@ -460,7 +481,7 @@ Find the latest version of syntastic here: http://github.com/scrooloose/syntastic ============================================================================== -7. License *syntastic-license* +8. License *syntastic-license* Syntastic is released under the wtfpl. See http://sam.zoy.org/wtfpl/COPYING. diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index ac4f6d7a..adca392a 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -179,7 +179,7 @@ function! s:ClearCache() endfunction function! s:CurrentFiletypes() - return split(&filetype, '\m\.') + return split( get(g:syntastic_filetype_map, &filetype, &filetype), '\m\.' ) endfunction "detect and cache all syntax errors in this buffer