diff options
Diffstat (limited to '')
-rw-r--r-- | autoload/rust.vim | 4 | ||||
-rw-r--r-- | autoload/rust/debugging.vim | 6 | ||||
-rw-r--r-- | autoload/rust/tags.vim | 21 | ||||
-rw-r--r-- | autoload/rustfmt.vim | 7 |
4 files changed, 33 insertions, 5 deletions
diff --git a/autoload/rust.vim b/autoload/rust.vim index c513f03f..7aff515b 100644 --- a/autoload/rust.vim +++ b/autoload/rust.vim @@ -509,7 +509,7 @@ function! rust#Test(all, options) abort return rust#Run(1, '--test ' . a:options) endif - if exists(':terminal') + if has('terminal') || has('nvim') let cmd = 'terminal ' else let cmd = '!' @@ -530,7 +530,7 @@ function! rust#Test(all, options) abort let func_name = s:SearchTestFunctionNameUnderCursor() if func_name ==# '' echohl ErrorMsg - echo 'No test function was found under the cursor. Please add ! to command if you want to run all tests' + echomsg 'No test function was found under the cursor. Please add ! to command if you want to run all tests' echohl None return endif diff --git a/autoload/rust/debugging.vim b/autoload/rust/debugging.vim index caeef712..6392a024 100644 --- a/autoload/rust/debugging.vim +++ b/autoload/rust/debugging.vim @@ -5,6 +5,7 @@ endif " For debugging, inspired by https://github.com/w0rp/rust/blob/master/autoload/rust/debugging.vim let s:global_variable_list = [ + \ '_rustfmt_autosave_because_of_config', \ 'ftplugin_rust_source_path', \ 'loaded_syntastic_rust_cargo_checker', \ 'loaded_syntastic_rust_filetype', @@ -32,7 +33,6 @@ let s:global_variable_list = [ \ 'rustc_makeprg_no_percent', \ 'rustc_path', \ 'rustfmt_autosave', - \ 'rustfmt_autosave_because_of_config', \ 'rustfmt_autosave_if_config_present', \ 'rustfmt_command', \ 'rustfmt_emit_files', @@ -48,7 +48,9 @@ endfunction function! s:EchoGlobalVariables() abort for l:key in s:global_variable_list - call s:Echo('let g:' . l:key . ' = ' . string(get(g:, l:key, v:null))) + if l:key !~# '^_' + call s:Echo('let g:' . l:key . ' = ' . string(get(g:, l:key, v:null))) + endif if has_key(b:, l:key) call s:Echo('let b:' . l:key . ' = ' . string(b:[l:key])) diff --git a/autoload/rust/tags.vim b/autoload/rust/tags.vim new file mode 100644 index 00000000..74e2f9f0 --- /dev/null +++ b/autoload/rust/tags.vim @@ -0,0 +1,21 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'rust') != -1 + finish +endif + +" Tagbar support code, for the sake of not automatically overriding its +" configuration in case Universal Ctags is detected. + +let s:ctags_is_uctags = 0 +let s:checked_ctags = 0 + +function! rust#tags#IsUCtags() abort + if s:checked_ctags == 0 + if system('ctags --version') =~? 'universal ctags' + let s:ctags_is_uctags = 1 + endif + let s:checked_ctags = 1 + endif + return s:ctags_is_uctags +endfunction + +" vim: set et sw=4 sts=4 ts=8: diff --git a/autoload/rustfmt.vim b/autoload/rustfmt.vim index 908eb325..f469ac13 100644 --- a/autoload/rustfmt.vim +++ b/autoload/rustfmt.vim @@ -246,7 +246,12 @@ function! rustfmt#PreWrite() if rust#GetConfigVar('rustfmt_autosave_if_config_present', 0) if findfile('rustfmt.toml', '.;') !=# '' || findfile('.rustfmt.toml', '.;') !=# '' let b:rustfmt_autosave = 1 - let b:rustfmt_autosave_because_of_config = 1 + let b:_rustfmt_autosave_because_of_config = 1 + endif + else + if has_key(b:, '_rustfmt_autosave_because_of_config') + unlet b:_rustfmt_autosave_because_of_config + unlet b:rustfmt_autosave endif endif |