From cc2cd38d2405dc50bdc7184516fd0b8e0e71ade0 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 19 Jun 2019 17:02:21 +1200 Subject: Set filetype-appropriate 'foldlevel' --- vim/after/ftplugin/c.vim | 5 +++-- vim/after/ftplugin/perl.vim | 5 +++-- vim/after/ftplugin/php.vim | 5 +++-- vim/after/ftplugin/sh.vim | 5 +++-- vim/after/ftplugin/vim.vim | 5 +++-- vim/after/ftplugin/zsh.vim | 5 +++-- 6 files changed, 18 insertions(+), 12 deletions(-) (limited to 'vim/after') diff --git a/vim/after/ftplugin/c.vim b/vim/after/ftplugin/c.vim index ea220e65..bc531a61 100644 --- a/vim/after/ftplugin/c.vim +++ b/vim/after/ftplugin/c.vim @@ -6,9 +6,10 @@ let b:undo_ftplugin .= '|setlocal commentstring< define< include<' setlocal complete+=d let b:undo_ftplugin .= '|setlocal complete<' -" Fold based on indent level +" Fold based on indent level, and start with all folds closed setlocal foldmethod=indent -let b:undo_ftplugin .= '|setlocal foldmethod<' +setlocal foldlevel=0 +let b:undo_ftplugin .= '|setlocal foldmethod< foldlevel<' " Include system headers on UNIX if has('unix') diff --git a/vim/after/ftplugin/perl.vim b/vim/after/ftplugin/perl.vim index e780bed5..5c9cf8a0 100644 --- a/vim/after/ftplugin/perl.vim +++ b/vim/after/ftplugin/perl.vim @@ -4,9 +4,10 @@ setlocal equalprg=perltidy let b:undo_ftplugin .= '|unlet b:current_compiler' \ . '|setlocal equalprg< errorformat< makeprg<' -" Fold based on indent level +" Fold based on indent level, but start with all folds open setlocal foldmethod=indent -let b:undo_ftplugin .= '|setlocal foldmethod<' +setlocal foldlevel=99 +let b:undo_ftplugin .= '|setlocal foldmethod< foldlevel<' " Add angle brackets to pairs of matched characters for q<...> setlocal matchpairs+=<:> diff --git a/vim/after/ftplugin/php.vim b/vim/after/ftplugin/php.vim index 7bb20f99..3b023f9e 100644 --- a/vim/after/ftplugin/php.vim +++ b/vim/after/ftplugin/php.vim @@ -8,9 +8,10 @@ setlocal comments=s1:/*,m:*,ex:*/,://,:# setlocal formatoptions+=or let b:undo_ftplugin .= '|setlocal comments< formatoptions<' -" Fold based on indent level +" Fold based on indent level, but start with all folds open setlocal foldmethod=indent -let b:undo_ftplugin .= '|setlocal foldmethod<' +setlocal foldlevel=99 +let b:undo_ftplugin .= '|setlocal foldmethod< foldlevel<' " Use pman as 'keywordprg' setlocal keywordprg=pman diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim index 2c68d83a..39b8d0d6 100644 --- a/vim/after/ftplugin/sh.vim +++ b/vim/after/ftplugin/sh.vim @@ -3,9 +3,10 @@ setlocal comments=:# setlocal formatoptions+=or let b:undo_ftplugin .= '|setlocal comments< formatoptions<' -" Fold based on indent level +" Fold based on indent level, but start with all folds open setlocal foldmethod=indent -let b:undo_ftplugin .= '|setlocal foldmethod<' +setlocal foldlevel=99 +let b:undo_ftplugin .= '|setlocal foldmethod< foldlevel<' " If subtype is Bash, set 'keywordprg' to han(1df) if exists('b:is_bash') diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim index 01f971b9..481af0ec 100644 --- a/vim/after/ftplugin/vim.vim +++ b/vim/after/ftplugin/vim.vim @@ -9,9 +9,10 @@ endif let b:regex_escape_flavor = 'vim' let b:undo_ftplugin .= '|unlet b:regex_escape_flavor' -" Fold based on indent level +" Fold based on indent level, but start with all folds open setlocal foldmethod=indent -let b:undo_ftplugin .= '|setlocal foldmethod<' +setlocal foldlevel=99 +let b:undo_ftplugin .= '|setlocal foldmethod< foldlevel<' " Use :help as 'keywordprg' if not already set; this is the default since Vim " v8.1.1290 diff --git a/vim/after/ftplugin/zsh.vim b/vim/after/ftplugin/zsh.vim index 6b5a389c..880c2c39 100644 --- a/vim/after/ftplugin/zsh.vim +++ b/vim/after/ftplugin/zsh.vim @@ -3,6 +3,7 @@ compiler zsh let b:undo_ftplugin .= '|unlet b:current_compiler' \ . '|setlocal errorformat< makeprg<' -" Fold based on indent level +" Fold based on indent level, but start with all folds open setlocal foldmethod=indent -let b:undo_ftplugin .= '|setlocal foldmethod<' +setlocal foldlevel=99 +let b:undo_ftplugin .= '|setlocal foldmethod< foldlevel<' -- cgit v1.2.3