blob: aa9b01e93c03d9854a98c7239f70304729029d38 [file] [log] [blame]
Bram Moolenaar3c2881d2017-03-21 19:18:29 +01001" Vim compiler file
2" Compiler: Cargo Compiler
3" Maintainer: Damien Radtke <damienradtke@gmail.com>
Gregory Andersfc935942023-09-12 13:23:38 -05004" Latest Revision: 2023-09-11
Bram Moolenaar3c2881d2017-03-21 19:18:29 +01005" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
6
7if exists('current_compiler')
Gregory Andersfc935942023-09-12 13:23:38 -05008 finish
Bram Moolenaar3c2881d2017-03-21 19:18:29 +01009endif
10runtime compiler/rustc.vim
11let current_compiler = "cargo"
12
Gregory Andersfc935942023-09-12 13:23:38 -050013" vint: -ProhibitAbbreviationOption
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010014let s:save_cpo = &cpo
15set cpo&vim
Gregory Andersfc935942023-09-12 13:23:38 -050016" vint: +ProhibitAbbreviationOption
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010017
18if exists(':CompilerSet') != 2
Gregory Andersfc935942023-09-12 13:23:38 -050019 command -nargs=* CompilerSet setlocal <args>
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010020endif
21
22if exists('g:cargo_makeprg_params')
Gregory Andersfc935942023-09-12 13:23:38 -050023 execute 'CompilerSet makeprg=cargo\ '.escape(g:cargo_makeprg_params, ' \|"').'\ $*'
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010024else
Gregory Andersfc935942023-09-12 13:23:38 -050025 CompilerSet makeprg=cargo\ $*
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010026endif
27
Gregory Andersfc935942023-09-12 13:23:38 -050028augroup RustCargoQuickFixHooks
29 autocmd!
30 autocmd QuickFixCmdPre make call cargo#quickfix#CmdPre()
31 autocmd QuickFixCmdPost make call cargo#quickfix#CmdPost()
32augroup END
33
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010034" Ignore general cargo progress messages
35CompilerSet errorformat+=
Gregory Andersfc935942023-09-12 13:23:38 -050036 \%-G%\\s%#Downloading%.%#,
37 \%-G%\\s%#Checking%.%#,
38 \%-G%\\s%#Compiling%.%#,
39 \%-G%\\s%#Finished%.%#,
40 \%-G%\\s%#error:\ Could\ not\ compile\ %.%#,
41 \%-G%\\s%#To\ learn\ more\\,%.%#,
42 \%-G%\\s%#For\ more\ information\ about\ this\ error\\,%.%#,
43 \%-Gnote:\ Run\ with\ \`RUST_BACKTRACE=%.%#,
44 \%.%#panicked\ at\ \\'%m\\'\\,\ %f:%l:%c
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010045
Gregory Andersfc935942023-09-12 13:23:38 -050046" vint: -ProhibitAbbreviationOption
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010047let &cpo = s:save_cpo
48unlet s:save_cpo
Gregory Andersfc935942023-09-12 13:23:38 -050049" vint: +ProhibitAbbreviationOption
50
51" vim: set et sw=4 sts=4 ts=8: