diff options
Diffstat (limited to '')
-rw-r--r-- | ftplugin/rust.vim | 44 | ||||
-rw-r--r-- | ftplugin/rust/tagbar.vim | 32 |
2 files changed, 35 insertions, 41 deletions
diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim index acf4d71d..ead86d13 100644 --- a/ftplugin/rust.vim +++ b/ftplugin/rust.vim @@ -12,8 +12,10 @@ if exists("b:did_ftplugin") endif let b:did_ftplugin = 1 +" vint: -ProhibitAbbreviationOption let s:save_cpo = &cpo set cpo&vim +" vint: +ProhibitAbbreviationOption augroup rust.vim autocmd! @@ -69,32 +71,13 @@ augroup rust.vim let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions endif - let s:delimitMate_extra_excluded_regions = ',rustLifetimeCandidate,rustGenericLifetimeCandidate' - - " For this buffer, when delimitMate issues the `User delimitMate_map` - " event in the autocommand system, add the above-defined extra excluded - " regions to delimitMate's state, if they have not already been added. - autocmd User <buffer> - \ if expand('<afile>') ==# 'delimitMate_map' && match( - \ delimitMate#Get("excluded_regions"), - \ s:delimitMate_extra_excluded_regions) == -1 - \| let b:delimitMate_excluded_regions = - \ delimitMate#Get("excluded_regions") - \ . s:delimitMate_extra_excluded_regions - \|endif + autocmd User delimitMate_map :call rust#delimitmate#onMap() + autocmd User delimitMate_unmap :call rust#delimitmate#onUnmap() + endif - " For this buffer, when delimitMate issues the `User delimitMate_unmap` - " event in the autocommand system, delete the above-defined extra excluded - " regions from delimitMate's state (the deletion being idempotent and - " having no effect if the extra excluded regions are not present in the - " targeted part of delimitMate's state). - autocmd User <buffer> - \ if expand('<afile>') ==# 'delimitMate_unmap' - \| let b:delimitMate_excluded_regions = substitute( - \ delimitMate#Get("excluded_regions"), - \ '\C\V' . s:delimitMate_extra_excluded_regions, - \ '', 'g') - \|endif + " Integration with auto-pairs (https://github.com/jiangmiao/auto-pairs) + if exists("g:AutoPairsLoaded") && !get(g:, 'rust_keep_autopairs_default', 0) + let b:AutoPairs = {'(':')', '[':']', '{':'}','"':'"', '`':'`'} endif if has("folding") && get(g:, 'rust_fold', 0) @@ -154,6 +137,9 @@ augroup rust.vim " See |:RustInfoToFile| for docs command! -bar -nargs=1 RustInfoToFile call rust#debugging#InfoToFile(<f-args>) + " See |:RustTest| for docs + command! -buffer -nargs=* -bang RustTest call rust#Test(<bang>0, <q-args>) + if !exists("b:rust_last_rustc_args") || !exists("b:rust_last_args") let b:rust_last_rustc_args = [] let b:rust_last_args = [] @@ -192,23 +178,25 @@ augroup rust.vim \|xunmap <buffer> ]] \|ounmap <buffer> [[ \|ounmap <buffer> ]] - \|set matchpairs-=<:> + \|setlocal matchpairs-=<:> \|unlet b:match_skip \" " }}}1 " Code formatting on save - autocmd BufWritePre *.rs silent! call rustfmt#PreWrite() + autocmd BufWritePre <buffer> silent! call rustfmt#PreWrite() augroup END -set matchpairs+=<:> +setlocal matchpairs+=<:> " For matchit.vim (rustArrow stops `Fn() -> X` messing things up) let b:match_skip = 's:comment\|string\|rustArrow' +" vint: -ProhibitAbbreviationOption let &cpo = s:save_cpo unlet s:save_cpo +" vint: +ProhibitAbbreviationOption " vim: set et sw=4 sts=4 ts=8: diff --git a/ftplugin/rust/tagbar.vim b/ftplugin/rust/tagbar.vim index 5c95f357..d30dd7d7 100644 --- a/ftplugin/rust/tagbar.vim +++ b/ftplugin/rust/tagbar.vim @@ -7,30 +7,36 @@ if !exists(':Tagbar') finish endif +" vint: -ProhibitAbbreviationOption let s:save_cpo = &cpo set cpo&vim +" vint: +ProhibitAbbreviationOption -let g:tagbar_type_rust = { - \ 'ctagstype' : 'rust', - \ 'kinds' : [ - \'T:types', - \'f:functions', - \'g:enumerations', - \'s:structures', - \'m:modules', - \'c:constants', - \'t:traits', - \'i:trait implementations', - \ ] - \ } +if !exists('g:tagbar_type_rust') + let g:tagbar_type_rust = { + \ 'ctagstype' : 'rust', + \ 'kinds' : [ + \'T:types', + \'f:functions', + \'g:enumerations', + \'s:structures', + \'m:modules', + \'c:constants', + \'t:traits', + \'i:trait implementations', + \ ] + \ } +endif " In case you've updated/customized your ~/.ctags and prefer to use it. if !get(g:, 'rust_use_custom_ctags_defs', 0) let g:tagbar_type_rust.deffile = expand('<sfile>:p:h:h:h') . '/ctags/rust.ctags' endif +" vint: -ProhibitAbbreviationOption let &cpo = s:save_cpo unlet s:save_cpo +" vint: +ProhibitAbbreviationOption " vim: set et sw=4 sts=4 ts=8: |