From 303b3f1b434f26f936c241789c84dca6e2f50df2 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Sun, 6 Dec 2015 11:31:38 +0100 Subject: Update all bundles --- ftplugin/rust.vim | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'ftplugin/rust.vim') diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim index ace67889..e7c604ec 100644 --- a/ftplugin/rust.vim +++ b/ftplugin/rust.vim @@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1 " Description: Vim syntax file for Rust " Maintainer: Chris Morgan " Maintainer: Kevin Ballard -" Last Change: Jul 07, 2014 +" Last Change: January 29, 2015 if exists("b:did_ftplugin") finish @@ -20,7 +20,7 @@ set cpo&vim " comments, so we'll use that as our default, but make it easy to switch. " This does not affect indentation at all (I tested it with and without " leader), merely whether a leader is inserted by default or not. -if exists("g:rust_bang_comment_leader") && g:rust_bang_comment_leader == 1 +if exists("g:rust_bang_comment_leader") && g:rust_bang_comment_leader != 0 " Why is the `,s0:/*,mb:\ ,ex:*/` there, you ask? I don't understand why, " but without it, */ gets indented one space even if there were no " leaders. I'm fairly sure that's a Vim bug. @@ -37,7 +37,7 @@ silent! setlocal formatoptions+=j " otherwise it's better than nothing. setlocal smartindent nocindent -if !exists("g:rust_recommended_style") || g:rust_recommended_style == 1 +if !exists("g:rust_recommended_style") || g:rust_recommended_style != 0 setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab setlocal textwidth=99 endif @@ -69,7 +69,7 @@ if has("folding") && exists('g:rust_fold') && g:rust_fold != 0 endif endif -if has('conceal') && exists('g:rust_conceal') +if has('conceal') && exists('g:rust_conceal') && g:rust_conceal != 0 let b:rust_set_conceallevel=1 setlocal conceallevel=2 endif @@ -84,19 +84,35 @@ 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 -command! -nargs=* -complete=file -bang -bar -buffer RustRun call rust#Run(0, []) +command! -nargs=* -complete=file -bang -buffer RustRun call rust#Run(0, ) " See |:RustExpand| for docs -command! -nargs=* -complete=customlist,rust#CompleteExpand -bang -bar -buffer RustExpand call rust#Expand(0, []) +command! -nargs=* -complete=customlist,rust#CompleteExpand -bang -buffer RustExpand call rust#Expand(0, ) " See |:RustEmitIr| for docs -command! -nargs=* -bar -buffer RustEmitIr call rust#Emit("ir", []) +command! -nargs=* -buffer RustEmitIr call rust#Emit("llvm-ir", ) " See |:RustEmitAsm| for docs -command! -nargs=* -bar -buffer RustEmitAsm call rust#Emit("asm", []) +command! -nargs=* -buffer RustEmitAsm call rust#Emit("asm", ) + +" See |:RustPlay| for docs +command! -range=% RustPlay :call rust#Play(, , , ) + +" See |:RustFmt| for docs +command! -buffer RustFmt call rustfmt#Format() " Mappings {{{1 @@ -134,6 +150,7 @@ let b:undo_ftplugin = " \|delcommand RustExpand \|delcommand RustEmitIr \|delcommand RustEmitAsm + \|delcommand RustPlay \|nunmap \|nunmap \|nunmap [[ @@ -142,6 +159,8 @@ let b:undo_ftplugin = " \|xunmap ]] \|ounmap [[ \|ounmap ]] + \|set matchpairs-=<:> + \|unlet b:match_skip \" " }}}1 -- cgit v1.2.3