From e404a658b1647fad396a954776eda0bdabf8353c Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 20 Dec 2016 20:57:20 +0100 Subject: Update --- ftplugin/rust.vim | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'ftplugin/rust.vim') diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim index 3faa9dfb..b945fab7 100644 --- a/ftplugin/rust.vim +++ b/ftplugin/rust.vim @@ -112,16 +112,6 @@ xnoremap ]] :call rust#Jump('v', 'Forward') onoremap [[ :call rust#Jump('o', 'Back') onoremap ]] :call rust#Jump('o', 'Forward') -" %-matching. <:> is handy for generics. -set matchpairs+=<:> -" There are two minor issues with it; (a) comparison operators in expressions, -" where a less-than may match a greater-than later on—this is deemed a trivial -" issue—and (b) `Fn() -> X` syntax. This latter issue is irremediable from the -" highlighting perspective (built into Vim), but the actual % functionality -" can be fixed by this use of matchit.vim. -let b:match_skip = 's:comment\|string\|rustArrow' -source $VIMRUNTIME/macros/matchit.vim - " Commands {{{1 " See |:RustRun| for docs @@ -142,6 +132,9 @@ command! -range=% RustPlay :call rust#Play(, , , ) " See |:RustFmt| for docs command! -buffer RustFmt call rustfmt#Format() +" See |:RustFmtRange| for docs +command! -range -buffer RustFmtRange call rustfmt#FormatRange(, ) + " Mappings {{{1 " Bind ⌘R in MacVim to :RustRun @@ -189,18 +182,27 @@ let b:undo_ftplugin = " \|ounmap ]] \|set matchpairs-=<:> \|unlet b:match_skip - \|augroup! rust.vim \" " }}}1 " Code formatting on save if get(g:, "rustfmt_autosave", 0) - autocmd BufWritePre *.rs call rustfmt#Format() + autocmd BufWritePre *.rs silent! call rustfmt#Format() endif augroup END +" %-matching. <:> is handy for generics. +set matchpairs+=<:> +" There are two minor issues with it; (a) comparison operators in expressions, +" where a less-than may match a greater-than later on—this is deemed a trivial +" issue—and (b) `Fn() -> X` syntax. This latter issue is irremediable from the +" highlighting perspective (built into Vim), but the actual % functionality +" can be fixed by this use of matchit.vim. +let b:match_skip = 's:comment\|string\|rustArrow' +source $VIMRUNTIME/macros/matchit.vim + let &cpo = s:save_cpo unlet s:save_cpo -- cgit v1.2.3