2015-07-18 17:05:45 -04:00
|
|
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
|
|
|
|
2014-11-10 20:37:21 -05:00
|
|
|
" Vim compiler file
|
|
|
|
" Compiler: Cargo Compiler
|
|
|
|
" Maintainer: Damien Radtke <damienradtke@gmail.com>
|
2014-12-09 17:09:20 -05:00
|
|
|
" Latest Revision: 2014 Sep 24
|
2017-09-27 13:57:29 -04:00
|
|
|
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
|
2014-11-10 20:37:21 -05:00
|
|
|
|
2014-12-09 17:09:20 -05:00
|
|
|
if exists('current_compiler')
|
2017-09-27 13:57:29 -04:00
|
|
|
finish
|
2014-11-10 20:37:21 -05:00
|
|
|
endif
|
2014-12-09 17:09:20 -05:00
|
|
|
runtime compiler/rustc.vim
|
2014-11-10 20:37:21 -05:00
|
|
|
let current_compiler = "cargo"
|
|
|
|
|
2017-09-27 13:57:29 -04:00
|
|
|
let s:save_cpo = &cpo
|
|
|
|
set cpo&vim
|
|
|
|
|
2014-12-09 17:09:20 -05:00
|
|
|
if exists(':CompilerSet') != 2
|
2017-09-27 13:57:29 -04:00
|
|
|
command -nargs=* CompilerSet setlocal <args>
|
2014-11-10 20:37:21 -05:00
|
|
|
endif
|
|
|
|
|
2014-12-09 17:09:20 -05:00
|
|
|
if exists('g:cargo_makeprg_params')
|
2017-09-27 13:57:29 -04:00
|
|
|
execute 'CompilerSet makeprg=cargo\ '.escape(g:cargo_makeprg_params, ' \|"').'\ $*'
|
2014-12-09 17:09:20 -05:00
|
|
|
else
|
2017-09-27 13:57:29 -04:00
|
|
|
CompilerSet makeprg=cargo\ $*
|
2014-12-09 17:09:20 -05:00
|
|
|
endif
|
2014-11-10 20:37:21 -05:00
|
|
|
|
2016-12-20 14:57:20 -05:00
|
|
|
" Ignore general cargo progress messages
|
|
|
|
CompilerSet errorformat+=
|
|
|
|
\%-G%\\s%#Downloading%.%#,
|
|
|
|
\%-G%\\s%#Compiling%.%#,
|
|
|
|
\%-G%\\s%#Finished%.%#,
|
|
|
|
\%-G%\\s%#error:\ Could\ not\ compile\ %.%#,
|
2017-09-27 13:57:29 -04:00
|
|
|
\%-G%\\s%#To\ learn\ more\\,%.%#,
|
|
|
|
\%-Gnote:\ Run\ with\ \`RUST_BACKTRACE=%.%#,
|
|
|
|
\%.%#panicked\ at\ \\'%m\\'\\,\ %f:%l
|
|
|
|
|
|
|
|
let &cpo = s:save_cpo
|
|
|
|
unlet s:save_cpo
|
2015-07-18 17:05:45 -04:00
|
|
|
|
|
|
|
endif
|