mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -60,18 +60,19 @@ function! s:RustfmtWriteMode()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:RustfmtConfig()
|
||||
function! s:RustfmtConfigOptions()
|
||||
let l:rustfmt_toml = findfile('rustfmt.toml', expand('%:p:h') . ';')
|
||||
if l:rustfmt_toml !=# ''
|
||||
return '--config-path '.l:rustfmt_toml
|
||||
return '--config-path '.fnamemodify(l:rustfmt_toml, ":p")
|
||||
endif
|
||||
|
||||
let l:_rustfmt_toml = findfile('.rustfmt.toml', expand('%:p:h') . ';')
|
||||
if l:_rustfmt_toml !=# ''
|
||||
return '--config-path '.l:_rustfmt_toml
|
||||
return '--config-path '.fnamemodify(l:_rustfmt_toml, ":p")
|
||||
endif
|
||||
|
||||
return ''
|
||||
" Default to edition 2018 in case no rustfmt.toml was found.
|
||||
return '--edition 2018'
|
||||
endfunction
|
||||
|
||||
function! s:RustfmtCommandRange(filename, line1, line2)
|
||||
@ -82,7 +83,7 @@ function! s:RustfmtCommandRange(filename, line1, line2)
|
||||
|
||||
let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]}
|
||||
let l:write_mode = s:RustfmtWriteMode()
|
||||
let l:rustfmt_config = s:RustfmtConfig()
|
||||
let l:rustfmt_config = s:RustfmtConfigOptions()
|
||||
|
||||
" FIXME: When --file-lines gets to be stable, add version range checking
|
||||
" accordingly.
|
||||
@ -96,14 +97,9 @@ function! s:RustfmtCommandRange(filename, line1, line2)
|
||||
endfunction
|
||||
|
||||
function! s:RustfmtCommand()
|
||||
if g:rustfmt_emit_files
|
||||
let l:write_mode = "--emit=stdout"
|
||||
else
|
||||
let l:write_mode = "--write-mode=display"
|
||||
endif
|
||||
" rustfmt will pick on the right config on its own due to the
|
||||
" current directory change.
|
||||
return g:rustfmt_command . " ". l:write_mode . " " . g:rustfmt_options
|
||||
let write_mode = g:rustfmt_emit_files ? '--emit=stdout' : '--write-mode=display'
|
||||
let config = s:RustfmtConfigOptions()
|
||||
return join([g:rustfmt_command, write_mode, config, g:rustfmt_options])
|
||||
endfunction
|
||||
|
||||
function! s:DeleteLines(start, end) abort
|
||||
|
Reference in New Issue
Block a user