diff options
Diffstat (limited to 'ftplugin/rust.vim')
-rw-r--r-- | ftplugin/rust.vim | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim index cdc318f1..fa9e1562 100644 --- a/ftplugin/rust.vim +++ b/ftplugin/rust.vim @@ -5,7 +5,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1 " Maintainer: Chris Morgan <me@chrismorgan.info> " Maintainer: Kevin Ballard <kevin@sb.org> " Last Change: June 08, 2016 -" For bugs, patches and license go to https://github.com/rust-lang/rust.vim +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim if exists("b:did_ftplugin") finish @@ -54,8 +54,8 @@ if get(g:, 'rust_recommended_style', 1) setlocal textwidth=99 endif -" This includeexpr isn't perfect, but it's a good start -setlocal includeexpr=substitute(v:fname,'::','/','g') +setlocal include=\\v^\\s*(pub\\s+)?use\\s+\\zs(\\f\|:)+ +setlocal includeexpr=rust#IncludeExpr(v:fname) setlocal suffixesadd=.rs @@ -149,7 +149,7 @@ endif " Cleanup {{{1 let b:undo_ftplugin = " - \ setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd< + \ setlocal formatoptions< comments< commentstring< include< includeexpr< suffixesadd< \|if exists('b:rust_set_style') \|setlocal tabstop< shiftwidth< softtabstop< expandtab< textwidth< \|endif @@ -188,7 +188,7 @@ let b:undo_ftplugin = " " Code formatting on save augroup rust.vim.PreWrite autocmd! - autocmd BufWritePre <buffer> silent! call rustfmt#PreWrite() + autocmd BufWritePre *.rs silent! call rustfmt#PreWrite() augroup END setlocal matchpairs+=<:> |