]> git.lizzy.rs Git - rust.git/blob - src/etc/vim/syntax_checkers/rust/rustc.vim
Add a Syntastic plugin for Rust.
[rust.git] / src / etc / vim / syntax_checkers / rust / rustc.vim
1 " Vim syntastic plugin
2 " Language:     Rust
3 " Maintainer:   Andrew Gallant <jamslam@gmail.com>
4 "
5 " See for details on how to add an external Syntastic checker:
6 " https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide#external
7
8 if exists("g:loaded_syntastic_rust_rustc_checker")
9     finish
10 endif
11 let g:loaded_syntastic_rust_rustc_checker = 1
12
13 let s:save_cpo = &cpo
14 set cpo&vim
15
16 function! SyntaxCheckers_rust_rustc_GetLocList() dict
17     let makeprg = self.makeprgBuild({ 'args': '--parse-only' })
18
19     let errorformat  =
20         \ '%E%f:%l:%c: %\d%#:%\d%# %.%\{-}error:%.%\{-} %m,'   .
21         \ '%W%f:%l:%c: %\d%#:%\d%# %.%\{-}warning:%.%\{-} %m,' .
22         \ '%C%f:%l %m,' .
23         \ '%-Z%.%#'
24
25     return SyntasticMake({
26         \ 'makeprg': makeprg,
27         \ 'errorformat': errorformat })
28 endfunction
29
30 call g:SyntasticRegistry.CreateAndRegisterChecker({
31     \ 'filetype': 'rust',
32     \ 'name': 'rustc'})
33
34 let &cpo = s:save_cpo
35 unlet s:save_cpo