From 0467a5fd6ff7380a11a25885de3ae8adb7a7cc7f Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 11 Apr 2021 16:13:15 +0530 Subject: delete rust.vim, add quickfix support for clippy and cargo --- ftplugin/rust.vim | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'ftplugin') 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 @@ setlocal ts=4 sts=4 sw=4 expandtab + +set formatprg=rustfmt + +" set makeprg=cargo\ clippy +set errorformat= + \%-G, + \%-Gerror:\ aborting\ %.%#, + \%-Gerror:\ Could\ not\ compile\ %.%#, + \%Eerror:\ %m, + \%Eerror[E%n]:\ %m, + \%Wwarning:\ %m, + \%Inote:\ %m, + \%C\ %#-->\ %f:%l:%c, + \%E\ \ left:%m,%C\ right:%m\ %f:%l:%c,%Z + +function! RustMake() abort + set makeprg=nix-shell\ --run\ \"cargo\ build\" + silent! make + set makeprg=nix-shell\ --run\ \"cargo\ clippy\" + silent! make +endfunction + +nnoremap r :call RustMake() silent! redraw cwindow + +augroup RustFmt + autocmd! + autocmd BufWritePost *.rs | silent exec "!cargo fmt" | bufdo edit | silent! redraw +augroup END -- cgit v1.2.3