I have some code in my ~/.vimrc
that (simplified) looks like this:
function! SomeAppendFunction()
let failed = append(0, ["Some header text"])
endfunction
command SomeAppendFunction :call SomeAppendFunction()
The intent is to provide a command that prepends some fixed text to any file I wish. I don't really care too much about handling errors from the append()
function.
When I run Syntastic over this, which uses vimlint to check it, it quite rightly warns that I'm not using the return variable failed
:
/Users/xyz/.vimrc|255 col 9 warning| [EVL102] unused variable `l:failed`
However, if I remove the let failed =
from the line inside the function, so it looks like this:
function! SomeAppendFunction()
append(0, ["Some header text"])
endfunction
command SomeAppendFunction :call SomeAppendFunction()
... I instead now see: ...
line 301:
E126: Missing :endfunction
... when I start vim.
How can I avoid the warning about the unused variable, but also have a syntactically correct function?
call append(...)
; (2) put" @vimlint(EVL102, 1, l:failed)
and" @vimlint(EVL102, 0, l:failed)
around your function; (3)let g:syntastic_vimlint_options = { 'EVL102': 1 }
; (4) useg:syntastic_quiet_messages
; (5) useg:syntastic_vim_vimlint_quiet_messages
.