diff options
| author | Kevin Ballard <kevin@sb.org> | 2014-08-15 16:37:51 -0700 |
|---|---|---|
| committer | Kevin Ballard <kevin@sb.org> | 2014-08-15 16:41:07 -0700 |
| commit | ab65869c9d67bdc9d7ca9e7c80bb9a4460f1029e (patch) | |
| tree | 2fcdac13cb807c308f4e3f612c1ce83b37b594cb | |
| parent | 02f9fd87ec56b1e84d45c96abe388f555e28faed (diff) | |
| download | rust-ab65869c9d67bdc9d7ca9e7c80bb9a4460f1029e.tar.gz rust-ab65869c9d67bdc9d7ca9e7c80bb9a4460f1029e.zip | |
vim: Don't set foldmethod in the syntax file either
We shouldn't be setting any settings in the syntax file. Better to put them in the ftplugin, where they won't be pulled in by :syn-include and can be cleaned up when changing the filetype.
| -rw-r--r-- | src/etc/vim/ftplugin/rust.vim | 14 | ||||
| -rw-r--r-- | src/etc/vim/syntax/rust.vim | 11 |
2 files changed, 14 insertions, 11 deletions
diff --git a/src/etc/vim/ftplugin/rust.vim b/src/etc/vim/ftplugin/rust.vim index 8a538177403..09eaf62daf9 100644 --- a/src/etc/vim/ftplugin/rust.vim +++ b/src/etc/vim/ftplugin/rust.vim @@ -56,6 +56,16 @@ if exists("g:loaded_delimitMate") let b:delimitMate_excluded_regions = delimitMate#Get("excluded_regions") . ',rustLifetimeCandidate,rustGenericLifetimeCandidate' endif +if has("folding") && exists('g:rust_fold') && g:rust_fold != 0 + let b:rust_set_foldmethod=1 + setlocal foldmethod=syntax + if g:rust_fold == 2 + setlocal foldlevel< + else + setlocal foldlevel=99 + endif +endif + if has('conceal') && exists('g:rust_conceal') let b:rust_set_conceallevel=1 setlocal conceallevel=2 @@ -108,6 +118,10 @@ let b:undo_ftplugin = " \|else \|unlet! b:delimitMate_excluded_regions \|endif + \|if exists('b:rust_set_foldmethod') + \|setlocal foldmethod< foldlevel< + \|unlet b:rust_set_foldmethod + \|endif \|if exists('b:rust_set_conceallevel') \|setlocal conceallevel< \|unlet b:rust_set_conceallevel diff --git a/src/etc/vim/syntax/rust.vim b/src/etc/vim/syntax/rust.vim index d8330b84f31..544c938dd73 100644 --- a/src/etc/vim/syntax/rust.vim +++ b/src/etc/vim/syntax/rust.vim @@ -11,17 +11,6 @@ elseif exists("b:current_syntax") finish endif -" Fold settings {{{1 - -if has("folding") && exists('g:rust_fold') && g:rust_fold != 0 - setlocal foldmethod=syntax - if g:rust_fold == 2 - setlocal foldlevel< - else - setlocal foldlevel=99 - endif -endif - " Syntax definitions {{{1 " Basic keywords {{{2 syn keyword rustConditional match if else |
