blob: cae2e517e354bc1a4959ee4b7d88ae6d4e6315af [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
Doug Kearns408281e2024-04-04 22:00:58 +02005" 2024 Apr 03 by The Vim Project (removed :CompilerSet definition)
Bram Moolenaar3c2881d2017-03-21 19:18:29 +01006" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
7
8if exists('current_compiler')
Gregory Andersfc935942023-09-12 13:23:38 -05009 finish
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010010endif
11runtime compiler/rustc.vim
12let current_compiler = "cargo"
13
Gregory Andersfc935942023-09-12 13:23:38 -050014" vint: -ProhibitAbbreviationOption
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010015let s:save_cpo = &cpo
16set cpo&vim
Gregory Andersfc935942023-09-12 13:23:38 -050017" vint: +ProhibitAbbreviationOption
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010018
19if exists(':CompilerSet') != 2
Gregory Andersfc935942023-09-12 13:23:38 -050020 command -nargs=* CompilerSet setlocal <args>
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010021endif
22
23if exists('g:cargo_makeprg_params')
Gregory Andersfc935942023-09-12 13:23:38 -050024 execute 'CompilerSet makeprg=cargo\ '.escape(g:cargo_makeprg_params, ' \|"').'\ $*'
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010025else
Gregory Andersfc935942023-09-12 13:23:38 -050026 CompilerSet makeprg=cargo\ $*
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010027endif
28
Gregory Andersfc935942023-09-12 13:23:38 -050029augroup RustCargoQuickFixHooks
30 autocmd!
31 autocmd QuickFixCmdPre make call cargo#quickfix#CmdPre()
32 autocmd QuickFixCmdPost make call cargo#quickfix#CmdPost()
33augroup END
34
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010035" Ignore general cargo progress messages
36CompilerSet errorformat+=
Gregory Andersfc935942023-09-12 13:23:38 -050037 \%-G%\\s%#Downloading%.%#,
38 \%-G%\\s%#Checking%.%#,
39 \%-G%\\s%#Compiling%.%#,
40 \%-G%\\s%#Finished%.%#,
41 \%-G%\\s%#error:\ Could\ not\ compile\ %.%#,
42 \%-G%\\s%#To\ learn\ more\\,%.%#,
43 \%-G%\\s%#For\ more\ information\ about\ this\ error\\,%.%#,
44 \%-Gnote:\ Run\ with\ \`RUST_BACKTRACE=%.%#,
45 \%.%#panicked\ at\ \\'%m\\'\\,\ %f:%l:%c
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010046
Gregory Andersfc935942023-09-12 13:23:38 -050047" vint: -ProhibitAbbreviationOption
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010048let &cpo = s:save_cpo
49unlet s:save_cpo
Gregory Andersfc935942023-09-12 13:23:38 -050050" vint: +ProhibitAbbreviationOption
51
52" vim: set et sw=4 sts=4 ts=8: