Skip to content

Commit 917d720

Browse files
committed
rustc compiler config for Vim.
Note that this is not actually *used* by default; it is a matter of configuration still, because you might want to: - Compile all .rs files with `rustc %` (where each can be built itself) - Compile all .rs files with `rustc some-file.rs` (where you are editing part of a crate) - Compile with a different tool, such as `make`. (In this case you might put a `~/.vim/after/compiler/rustc.vim` to match such cases, set makeprg and extend errorformat as appropriate. That should probably go in a different compiler mode, e.g. make-rustc.) To try using it, `:compiler rustc`. Then, `:make` on a file you would run `rustc` on will work its magic, invoking rustc. To automate this, you could have something like `autocmd FileType rust compiler rustc` in your Vim config.
1 parent f679352 commit 917d720

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/etc/vim/compiler/rustc.vim

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
" Vim compiler file
2+
" Compiler: Rust Compiler
3+
" Maintainer: Chris Morgan <[email protected]>
4+
" Latest Revision: 2013 Jul 12
5+
6+
if exists("current_compiler")
7+
finish
8+
endif
9+
let current_compiler = "rustc"
10+
11+
let s:cpo_save = &cpo
12+
set cpo&vim
13+
14+
if exists(":CompilerSet") != 2
15+
command -nargs=* CompilerSet setlocal <args>
16+
endif
17+
18+
if exists("g:rustc_makeprg_no_percent") && g:rustc_makeprg_no_percent == 1
19+
CompilerSet makeprg=rustc
20+
else
21+
CompilerSet makeprg=rustc\ \%
22+
endif
23+
24+
CompilerSet errorformat=
25+
\%f:%l:%c:\ %t%*[^:]:\ %m,
26+
\%f:%l:%c:\ %*\\d:%*\\d\ %t%*[^:]:\ %m,
27+
\%-G%f:%l\ %s,
28+
\%-G%*[\ ]^,
29+
\%-G%*[\ ]^%*[~],
30+
\%-G%*[\ ]...
31+
32+
let &cpo = s:cpo_save
33+
unlet s:cpo_save

0 commit comments

Comments
 (0)