@@ -17,7 +17,7 @@ if exists("g:loaded_syntastic_plugin")
17
17
endif
18
18
let g: loaded_syntastic_plugin = 1
19
19
20
- let s: running_windows = has (" win16" ) || has (" win32" ) || has ( " win64 " )
20
+ let s: running_windows = has (" win16" ) || has (" win32" )
21
21
22
22
if ! s: running_windows
23
23
let s: uname = system (' uname' )
26
26
if ! exists (" g:syntastic_enable_signs" )
27
27
let g: syntastic_enable_signs = 1
28
28
endif
29
+
30
+ if ! exists (" g:syntastic_error_symbol" )
31
+ let g: syntastic_error_symbol = ' >>'
32
+ endif
33
+
34
+ if ! exists (" g:syntastic_warning_symbol" )
35
+ let g: syntastic_warning_symbol = ' >>'
36
+ endif
37
+
38
+ if ! exists (" g:syntastic_style_error_symbol" )
39
+ let g: syntastic_style_error_symbol = ' S>'
40
+ endif
41
+
42
+ if ! exists (" g:syntastic_style_warning_symbol" )
43
+ let g: syntastic_style_warning_symbol = ' S>'
44
+ endif
45
+
29
46
if ! has (' signs' )
30
47
let g: syntastic_enable_signs = 0
31
48
endif
@@ -115,9 +132,7 @@ function! s:UpdateErrors(auto_invoked)
115
132
call s: CacheErrors ()
116
133
end
117
134
118
- if s: BufHasErrorsOrWarningsToDisplay ()
119
- call setloclist (0 , s: LocList ())
120
- endif
135
+ call setloclist (0 , s: LocList ())
121
136
122
137
if g: syntastic_enable_balloons
123
138
call s: RefreshBalloons ()
@@ -185,6 +200,8 @@ function! s:CacheErrors()
185
200
for ft in split (fts, ' \.' )
186
201
if s: Checkable (ft )
187
202
let errors = SyntaxCheckers_{ft }_GetLocList ()
203
+ " keep only lines that effectively match an error/warning
204
+ let errors = s: FilterLocList ({' valid' : 1 }, errors)
188
205
" make errors have type "E" by default
189
206
call SyntasticAddToErrors (errors, {' type' : ' E' })
190
207
call extend (s: LocList (), errors)
@@ -272,10 +289,10 @@ endfunction
272
289
273
290
if g: syntastic_enable_signs
274
291
" define the signs used to display syntax and style errors/warns
275
- sign define SyntasticError text= >> texthl= error
276
- sign define SyntasticWarning text= >> texthl= todo
277
- sign define SyntasticStyleError text= S > texthl= error
278
- sign define SyntasticStyleWarning text= S > texthl= todo
292
+ exe ' sign define SyntasticError text=' . g: syntastic_error_symbol . ' texthl=error'
293
+ exe ' sign define SyntasticWarning text=' . g: syntastic_warning_symbol . ' texthl=todo'
294
+ exe ' sign define SyntasticStyleError text=' . g: syntastic_style_error_symbol . ' texthl=error'
295
+ exe ' sign define SyntasticStyleWarning text=' . g: syntastic_style_warning_symbol . ' texthl=todo'
279
296
endif
280
297
281
298
" start counting sign ids at 5000, start here to hopefully avoid conflicting
@@ -346,6 +363,7 @@ endfunction
346
363
" display the cached errors for this buf in the location list
347
364
function ! s: ShowLocList ()
348
365
if ! empty (s: LocList ())
366
+ call setloclist (0 , s: LocList ())
349
367
let num = winnr ()
350
368
exec " lopen " . g: syntastic_loc_list_height
351
369
if num != winnr ()
@@ -470,6 +488,15 @@ function! s:LoadChecker(checker, ft)
470
488
exec " runtime syntax_checkers/" . a: ft . " /" . a: checker . " .vim"
471
489
endfunction
472
490
491
+ " the script changes &shellpipe and &shell to stop the screen flicking when
492
+ " shelling out to syntax checkers. Not all OSs support the hacks though
493
+ function ! s: OSSupportsShellpipeHack ()
494
+ if ! exists (" s:os_supports_shellpipe_hack" )
495
+ let s: os_supports_shellpipe_hack = ! s: running_windows && (s: uname !~ " FreeBSD" ) && (s: uname !~ " OpenBSD" )
496
+ endif
497
+ return s: os_supports_shellpipe_hack
498
+ endfunction
499
+
473
500
" return a string representing the state of buffer according to
474
501
" g:syntastic_stl_format
475
502
"
@@ -529,36 +556,36 @@ endfunction
529
556
" 'subtype' - all errors will be assigned the given subtype
530
557
function ! SyntasticMake (options )
531
558
let old_loclist = getloclist (0 )
532
- let old_makeprg = &makeprg
559
+ let old_makeprg = &l: makeprg
533
560
let old_shellpipe = &shellpipe
534
561
let old_shell = &shell
535
- let old_errorformat = &errorformat
562
+ let old_errorformat = &l: errorformat
536
563
537
- if ! s: running_windows && ( s: uname !~ " FreeBSD " )
564
+ if s: OSSupportsShellpipeHack ( )
538
565
" this is a hack to stop the screen needing to be ':redraw'n when
539
566
" when :lmake is run. Otherwise the screen flickers annoyingly
540
567
let &shellpipe = ' &>'
541
568
let &shell = ' /bin/bash'
542
569
endif
543
570
544
571
if has_key (a: options , ' makeprg' )
545
- let &makeprg = a: options [' makeprg' ]
572
+ let &l: makeprg = a: options [' makeprg' ]
546
573
endif
547
574
548
575
if has_key (a: options , ' errorformat' )
549
- let &errorformat = a: options [' errorformat' ]
576
+ let &l: errorformat = a: options [' errorformat' ]
550
577
endif
551
578
552
579
silent lmake !
553
580
let errors = getloclist (0 )
554
581
555
582
call setloclist (0 , old_loclist)
556
- let &makeprg = old_makeprg
557
- let &errorformat = old_errorformat
583
+ let &l: makeprg = old_makeprg
584
+ let &l: errorformat = old_errorformat
558
585
let &shellpipe = old_shellpipe
559
586
let &shell = old_shell
560
587
561
- if ! s: running_windows && s: uname = ~ " FreeBSD "
588
+ if s: OSSupportsShellpipeHack ()
562
589
redraw !
563
590
endif
564
591
@@ -611,7 +638,7 @@ function! SyntasticLoadChecker(checkers, ft)
611
638
612
639
if exists (opt_name)
613
640
let opt_val = {opt_name}
614
- if index (a: checkers , opt_val) != -1 && executable (opt_val)
641
+ if index (a: checkers , opt_val) != -1
615
642
call s: LoadChecker (opt_val, a: ft )
616
643
else
617
644
echoerr &ft . " syntax not supported or not installed."
0 commit comments