diff options
author | Akshay <[email protected]> | 2021-04-11 11:43:15 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2021-04-11 11:43:15 +0100 |
commit | 0467a5fd6ff7380a11a25885de3ae8adb7a7cc7f (patch) | |
tree | 8b5c5a3c5cad33c56a794f9143eaa8fbc038a250 /ftplugin | |
parent | 808539a80f123df92600aeaaa499614a4d102613 (diff) |
delete rust.vim, add quickfix support for clippy and cargo
Diffstat (limited to 'ftplugin')
-rw-r--r-- | ftplugin/rust.vim | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim index cfd90ec..7443f9d 100644 --- a/ftplugin/rust.vim +++ b/ftplugin/rust.vim | |||
@@ -1 +1,29 @@ | |||
1 | setlocal ts=4 sts=4 sw=4 expandtab | 1 | setlocal ts=4 sts=4 sw=4 expandtab |
2 | |||
3 | set formatprg=rustfmt | ||
4 | |||
5 | " set makeprg=cargo\ clippy | ||
6 | set errorformat= | ||
7 | \%-G, | ||
8 | \%-Gerror:\ aborting\ %.%#, | ||
9 | \%-Gerror:\ Could\ not\ compile\ %.%#, | ||
10 | \%Eerror:\ %m, | ||
11 | \%Eerror[E%n]:\ %m, | ||
12 | \%Wwarning:\ %m, | ||
13 | \%Inote:\ %m, | ||
14 | \%C\ %#-->\ %f:%l:%c, | ||
15 | \%E\ \ left:%m,%C\ right:%m\ %f:%l:%c,%Z | ||
16 | |||
17 | function! RustMake() abort | ||
18 | set makeprg=nix-shell\ --run\ \"cargo\ build\" | ||
19 | silent! make | ||
20 | set makeprg=nix-shell\ --run\ \"cargo\ clippy\" | ||
21 | silent! make | ||
22 | endfunction | ||
23 | |||
24 | nnoremap <leader>r :call RustMake() <bar> silent! redraw <bar> cwindow<cr> | ||
25 | |||
26 | augroup RustFmt | ||
27 | autocmd! | ||
28 | autocmd BufWritePost *.rs | silent exec "!cargo fmt" | bufdo edit | silent! redraw | ||
29 | augroup END | ||