blob: bbea45dee73b76dbc25ce8ba9756f8e55055bc68 [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
Yinzuo Jiangcec44ea2024-04-06 01:59:39 +08005" 2024 Apr 05 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
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010019if exists('g:cargo_makeprg_params')
Gregory Andersfc935942023-09-12 13:23:38 -050020 execute 'CompilerSet makeprg=cargo\ '.escape(g:cargo_makeprg_params, ' \|"').'\ $*'
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010021else
Gregory Andersfc935942023-09-12 13:23:38 -050022 CompilerSet makeprg=cargo\ $*
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010023endif
24
Gregory Andersfc935942023-09-12 13:23:38 -050025augroup RustCargoQuickFixHooks
26 autocmd!
27 autocmd QuickFixCmdPre make call cargo#quickfix#CmdPre()
28 autocmd QuickFixCmdPost make call cargo#quickfix#CmdPost()
29augroup END
30
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010031" Ignore general cargo progress messages
32CompilerSet errorformat+=
Gregory Andersfc935942023-09-12 13:23:38 -050033 \%-G%\\s%#Downloading%.%#,
34 \%-G%\\s%#Checking%.%#,
35 \%-G%\\s%#Compiling%.%#,
36 \%-G%\\s%#Finished%.%#,
37 \%-G%\\s%#error:\ Could\ not\ compile\ %.%#,
38 \%-G%\\s%#To\ learn\ more\\,%.%#,
39 \%-G%\\s%#For\ more\ information\ about\ this\ error\\,%.%#,
40 \%-Gnote:\ Run\ with\ \`RUST_BACKTRACE=%.%#,
41 \%.%#panicked\ at\ \\'%m\\'\\,\ %f:%l:%c
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010042
Gregory Andersfc935942023-09-12 13:23:38 -050043" vint: -ProhibitAbbreviationOption
Bram Moolenaar3c2881d2017-03-21 19:18:29 +010044let &cpo = s:save_cpo
45unlet s:save_cpo
Gregory Andersfc935942023-09-12 13:23:38 -050046" vint: +ProhibitAbbreviationOption
47
48" vim: set et sw=4 sts=4 ts=8: