vim-polyglot/compiler/cargo.vim

54 lines
1.5 KiB
VimL
Raw Normal View History

if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'rust') != -1
finish
endif
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')
2018-07-08 09:16:28 -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"
2018-10-08 13:00:59 -04:00
" vint: -ProhibitAbbreviationOption
2017-09-27 13:57:29 -04:00
let s:save_cpo = &cpo
set cpo&vim
2018-10-08 13:00:59 -04:00
" vint: +ProhibitAbbreviationOption
2017-09-27 13:57:29 -04:00
2014-12-09 17:09:20 -05:00
if exists(':CompilerSet') != 2
2018-07-08 09:16:28 -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')
2018-07-08 09:16:28 -04:00
execute 'CompilerSet makeprg=cargo\ '.escape(g:cargo_makeprg_params, ' \|"').'\ $*'
2014-12-09 17:09:20 -05:00
else
2018-07-08 09:16:28 -04:00
CompilerSet makeprg=cargo\ $*
2014-12-09 17:09:20 -05:00
endif
2014-11-10 20:37:21 -05:00
2018-07-08 09:16:28 -04:00
augroup RustCargoQuickFixHooks
autocmd!
autocmd QuickFixCmdPre make call cargo#quickfix#CmdPre()
autocmd QuickFixCmdPost make call cargo#quickfix#CmdPost()
augroup END
2016-12-20 14:57:20 -05:00
" Ignore general cargo progress messages
CompilerSet errorformat+=
2018-07-08 09:16:28 -04:00
\%-G%\\s%#Downloading%.%#,
\%-G%\\s%#Compiling%.%#,
\%-G%\\s%#Finished%.%#,
\%-G%\\s%#error:\ Could\ not\ compile\ %.%#,
\%-G%\\s%#To\ learn\ more\\,%.%#,
\%-Gnote:\ Run\ with\ \`RUST_BACKTRACE=%.%#,
\%.%#panicked\ at\ \\'%m\\'\\,\ %f:%l:%c
2017-09-27 13:57:29 -04:00
2018-10-08 13:00:59 -04:00
" vint: -ProhibitAbbreviationOption
2017-09-27 13:57:29 -04:00
let &cpo = s:save_cpo
unlet s:save_cpo
2018-10-08 13:00:59 -04:00
" vint: +ProhibitAbbreviationOption
2018-07-08 09:16:28 -04:00
" vim: set et sw=4 sts=4 ts=8: