Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions autoload/rustfmt.vim
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,26 @@ function! s:RustfmtConfigOptions()
return '--config-path '.shellescape(fnamemodify(l:_rustfmt_toml, ":p"))
endif

let l:rustfmt_toml = findfile(expand('$HOME/rustfmt.toml'), expand('%:p:h') . ';')
if l:rustfmt_toml !=# ''
return '--config-path '.shellescape(fnamemodify(l:rustfmt_toml, ":p"))
endif

let l:rustfmt_toml = findfile(expand('$HOME/.rustfmt.toml'), expand('%:p:h') . ';')
if l:rustfmt_toml !=# ''
return '--config-path '.shellescape(fnamemodify(l:rustfmt_toml, ":p"))
endif

let l:rustfmt_toml = findfile(expand('$HOME/.config/rustfmt/rustfmt.toml'), expand('%:p:h') . ';')
if l:rustfmt_toml !=# ''
return '--config-path '.shellescape(fnamemodify(l:rustfmt_toml, ":p"))
endif

let l:rustfmt_toml = findfile(expand('$HOME/.config/rustfmt/.rustfmt.toml'), expand('%:p:h') . ';')
if l:rustfmt_toml !=# ''
return '--config-path '.shellescape(fnamemodify(l:rustfmt_toml, ":p"))
endif

" Default to edition 2018 in case no rustfmt.toml was found.
return '--edition 2018'
endfunction
Expand Down