-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfigure_syntastic.vim
172 lines (142 loc) · 4.75 KB
/
configure_syntastic.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
" configure_syntastic.vim
" Append the Syntastic-specific pieces of the status line.
"
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_mode_map = { 'mode': 'active' }
" Always stick any detected errors into the location list.
"
let g:syntastic_always_populate_loc_list = 1
" Automatically open the error window when errors are detected,
" and close it when none are detected.
"
let g:syntastic_auto_loc_list = 1
" In active mode, run syntax checks when buffers are first
" loaded, as well as on save.
"
let g:syntastic_check_on_open = 1
" In active mode, run syntax checks before quitting.
"
let g:syntastic_check_on_wq = 1
" Experiment with some better error and warning markers.
"
" syntastic_error_symbol - For syntax errors, defaults to ">>"
" syntastic_style_error_symbol - For style errors, defaults to "S>"
" syntastic_warning_symbol - For syntax warnings, defaults to ">>"
" syntastic_style_warning_symbol - For style warnings, defaults to "S>"
"
" NOTE: The leading spaces below are non-breaking spaces (ASCII
" 160 vs ASCII 32). Normal spaces cause errors.
"
let g:syntastic_error_symbol = ' »'
let g:syntastic_warning_symbol = ' »'
let g:syntastic_style_error_symbol = ' ›'
let g:syntastic_style_warning_symbol = ' ›'
" Dial back the size of the error window.
"
let g:syntastic_loc_list_height = 5
""
"" Configuration for specific syntax checkers
""
" TypeScript (using Tsuquyomi)
"
"let g:tsuquyomi_disable_quickfix = 1
" Don't use the default Tsuquyomi key mappings, since they break
" Control+6 and that's maddening.
"
" XXX: This doesn't really belong in this file, since it's
" specific to Tsuquyomi and doesn't affect Syntastic.
"
"let g:tsuquyomi_disable_default_mappings = 1
" Use this for tsuquyomi:
"let g:syntastic_typescript_checkers = ['tsuquyomi'] " instead of 'tsc'
" Use these for tsc:
"let g:syntastic_typescript_checkers = ['tsc']
let g:syntastic_typescript_tsc_fname = ''
" HTML with Angular syntax
" let g:syntastic_html_tidy_blocklevel_tags = ['myCustomTag']
" let g:syntastic_html_tidy_inline_tags = []
" Build the list of regexes for HTML Tidy error messages we want
" Syntastic to ignore. ('s:qmr' stands for 'list of HTML Tidy
" quiet message regexes'; I just didn't want to repeat a long
" variable name several times.)
"
" We're going to build it with several calls to add() and
" extend(), so each block of regexes can be documented.
"
let s:qmr = []
" Allow (what HTML Tidy thinks are) invalid attribute names.
" Explicitly allow [prop], (event), and [(bananasInABox)],
" along with #refs (template reference variables) and
" *ngIf / *ngFor / etc. structural directives.
"
" Essentially, this pattern matches messages like...
"
" attribute name "FOO" (value="...") is invalid
"
" ...but tries to narrow FOO down to only the error messages
" that are generated by a valid Angular template, so any
" other messages make it through.
"
call extend(s:qmr, [
\ 'attribute name "\('
\ . '\|' . '\[\w\+\]'
\ . '\|' . '(\w\+)'
\ . '\|' . '\[(\w\+)\]'
\ . '\|' . '#\w\+'
\ . '\|' . '\*ng\(for\|if\|switch\(when\|default\)\)'
\ . '\)" (value=".\+") is invalid',
\ ])
" Allow all unrecognized element and attribute names.
"
" TODO: I'd prefer to be much more surgical about this, but that
" would require calling Angular's own template parser, and I
" haven't gotten that far just yet. Not even sure it's possible
" yet.
"
" When it *is* possible, explicitly allow attribute names
" that start with these prefixes:
"
" '\(bind\|bindon\|let\|on\|ref\|\)-'
"
call extend(s:qmr, [
\ '> proprietary attribute "',
\ '> is not recognized!',
\ 'discarding unexpected <',
\ ])
" Allow empty elements, since they might be bound with, for
" example, [textContent] or [innerHtml].
"
call add(s:qmr, 'trimming empty <')
" Allow #templateReferenceVariable attributes without values.
"
call add(s:qmr, '> attribute "#\w\+" lacks value')
" Allow *ngSwitchDefault without a value.
"
" TODO: Add any others that make sense here.
"
call add(s:qmr, 'attribute "\*ngswitchdefault" lacks value')
" Allow <input>, <select>, etc., without an explicit <form>.
"
call extend(s:qmr, [
\ 'inserting implicit <form>',
\ 'missing </form> before <',
\ "<input> isn't allowed in <body> elements",
\ ])
" Allow images without alt or src attributes, since the
" values for alt and src might be specified programmatically.
"
call add(s:qmr, '<img> lacks "\(alt\|src\)" attribute')
" XXX: A couple more I might add later, as mentioned in
" <https://github.com/scrooloose/syntastic/issues/612>:
"
" 'unescaped &'
" 'lacks "action'
"
" Prepend all regexes with the 'magic' and 'case insensitive'
" markers.
"
call map(s:qmr, ' ''\m\c'' . v:val ')
let g:syntastic_html_tidy_quiet_messages = { 'regex': s:qmr }
" end configure_syntastic.vim