Skip to content

Commit

Permalink
vim: Don't set foldmethod in the syntax file either
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lilyball committed Aug 15, 2014
1 parent 02f9fd8 commit ab65869
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
14 changes: 14 additions & 0 deletions src/etc/vim/ftplugin/rust.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 0 additions & 11 deletions src/etc/vim/syntax/rust.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ab65869

Please sign in to comment.