Lokaltog/vim-powerline — Issue #6: Error detected while processing function Stl_GetSyntaxErrors
Author: mbadran
Created: 2011-12-02 01:14:57+00:00
State: open

Error detected while processing function Stl_GetSyntaxErrors:
E121: Undefined variable: g:syntastic_stl_format
E15: Invalid expression: g:syntastic_stl_format
Error detected while processing function Stl_GetSyntaxErrors:
E121: Undefined variable: old_stl_format
Error detected while processing function Stl_GetSyntaxErrors:
E15: Invalid expression: old_stl_format

This occurs in the distinguished.vim file, and only when I start up MacVim. It happens because ```g:syntastic_stl_format``` has not yet been set. When I open a new buffer/tab, the problem doesn't occur. It may be because Syntastic is taking too long to start up, as per issue #3.

I worked around the problem by wrapping a couple of if exists("var_name") conditions around the variables:

```VimL
function! Stl_GetSyntaxErrors(line_symbol) " {{{
" Temporarily change syntastic output format
if exists("g:syntastic_stl_format")
let old_stl_format = g:syntastic_stl_format
endif

let g:syntastic_stl_format = '╱╱╱%E{ ERRORS (%e) '. a:line_symbol .' %fe }%W{ WARNINGS (%w) '. a:line_symbol .' %fw }╱╱╱'

let ret = SyntasticStatuslineFlag()

if exists("old_stl_format")
let g:syntastic_stl_format = old_stl_format
endif

return ret
endfunction " }}}
```