diff options
Diffstat (limited to 'ftplugin/rust.vim')
-rw-r--r-- | ftplugin/rust.vim | 44 |
1 files changed, 16 insertions, 28 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: |