diff options
| author | bors <bors@rust-lang.org> | 2014-11-21 16:56:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-11-21 16:56:47 +0000 |
| commit | f530aa08dfcdaeb249341bdd1a9797780b4294c2 (patch) | |
| tree | 0fb65c40324a612f8adb2da89181bef23c627cce | |
| parent | 9efa23e9c0d98d47612eb6cf40fdf405f9c98b65 (diff) | |
| parent | 62a2a1d5cf4af0307f538a9bedb40e5756e89fb6 (diff) | |
| download | rust-f530aa08dfcdaeb249341bdd1a9797780b4294c2.tar.gz rust-f530aa08dfcdaeb249341bdd1a9797780b4294c2.zip | |
auto merge of #19095 : juxiliary/rust/master, r=bstrie
Vim plugins shouldn't override user settings unless they ask! Stops the plugin from modifying the users settings by default instead makes them opt-in with `g:rust_recommended_style`
| -rw-r--r-- | src/etc/vim/doc/rust.txt | 9 | ||||
| -rw-r--r-- | src/etc/vim/ftplugin/rust.vim | 7 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/etc/vim/doc/rust.txt b/src/etc/vim/doc/rust.txt index 80f8c3ca5e1..0295d68d97e 100644 --- a/src/etc/vim/doc/rust.txt +++ b/src/etc/vim/doc/rust.txt @@ -53,6 +53,15 @@ g:rust_conceal_pub~ let g:rust_conceal_pub = 1 < + *g:rust_recommended_style* +g:rust_recommended_style~ + Set this option to enable vim indentation and textwidth settings to + conform to style conventions of the rust standard library (i.e. use 4 + spaces for indents and sets 'textwidth' to 99). This option is enabled + by default. To disable it: > + let g:rust_recommended_style = 0 +< + *g:rust_fold* g:rust_fold~ Set this option to turn on |folding|: > diff --git a/src/etc/vim/ftplugin/rust.vim b/src/etc/vim/ftplugin/rust.vim index 09eaf62daf9..5d5569945f5 100644 --- a/src/etc/vim/ftplugin/rust.vim +++ b/src/etc/vim/ftplugin/rust.vim @@ -35,9 +35,10 @@ silent! setlocal formatoptions+=j " otherwise it's better than nothing. setlocal smartindent nocindent -setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab - -setlocal textwidth=99 +if !exists("g:rust_recommended_style") || g:rust_recommended_style == 1 + setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab + setlocal textwidth=99 +endif " This includeexpr isn't perfect, but it's a good start setlocal includeexpr=substitute(v:fname,'::','/','g') |
