syntax checking using vim's compiler architecture

This commit is contained in:
Dag Odenhall 2013-06-04 10:59:49 +02:00
parent ad16f711f9
commit 525e2b47b7
4 changed files with 17 additions and 2 deletions

View file

@ -17,6 +17,7 @@ Features aplenty
* Searching for definitions including sourced files using commands like `[i`.
* Keyword lookup that includes pages for fish builtins using the `K` command.
* Completions from fish using the `^X^O` command.
* Syntax checking with quickfix using the `:make` command.
* Improved `funced` experience to instantly start typing commands in the
function body.
* Mimics `funced` when manually creating new functions.
@ -29,6 +30,9 @@ some Vim features turned on:
syntax enable
filetype plugin indent on
" Set up :make to use fish for syntax checking.
compiler! fish
" Set this to have long lines wrap inside comments.
set textwidth=79

View file

@ -60,3 +60,7 @@ function! fish#Complete(findstart, base)
return l:results
endif
endfunction
function! fish#errorformat()
return '%Afish: %m,%-Z%f (line %l):%s'
endfunction

7
compiler/fish.vim Normal file
View file

@ -0,0 +1,7 @@
if exists('current_compiler')
finish
endif
let current_compiler = 'fish'
CompilerSet makeprg=fish\ --no-execute\ %
execute 'CompilerSet errorformat='.escape(fish#errorformat(), ' ')

View file

@ -11,8 +11,8 @@ function! SyntaxCheckers_fish_fish_GetLocList()
let l:makeprg = syntastic#makeprg#build({'exe': 'fish',
\'args': '--no-execute',
\'subchecker': 'fish'})
let l:errorformat = '%Afish: %m,%-Z%f (line %l):%s'
return SyntasticMake({'makeprg': l:makeprg, 'errorformat': l:errorformat})
return SyntasticMake({'makeprg': l:makeprg,
\'errorformat': fish#errorformat()})
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({'filetype': 'fish',