about summary refs log tree commit diff
path: root/src/etc/vim/ftplugin/rust.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/etc/vim/ftplugin/rust.vim')
-rw-r--r--src/etc/vim/ftplugin/rust.vim14
1 files changed, 14 insertions, 0 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