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 +++-- vim/ftplugin/awk.vim | 5 +++-- vim/ftplugin/markdown.vim | 4 +++- vim/ftplugin/sed.vim | 5 +++-- 9 files changed, 27 insertions(+), 17 deletions(-) (limited to 'vim') 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<' diff --git a/vim/ftplugin/awk.vim b/vim/ftplugin/awk.vim index 310534ac..dbefa5cd 100644 --- a/vim/ftplugin/awk.vim +++ b/vim/ftplugin/awk.vim @@ -9,9 +9,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<' " Specify ERE flavor for regex_escape.vim let b:regex_escape_flavor = 'ere' diff --git a/vim/ftplugin/markdown.vim b/vim/ftplugin/markdown.vim index d119e599..da2228b3 100644 --- a/vim/ftplugin/markdown.vim +++ b/vim/ftplugin/markdown.vim @@ -39,9 +39,11 @@ function! MarkdownFold() return '=' endfunction +let b:undo_ftplugin .= '|delfunction MarkdownFold' setlocal foldexpr=MarkdownFold() setlocal foldmethod=expr -let b:undo_ftplugin .= '|delfunction MarkdownFold|setlocal foldexpr< foldmethod<' +setlocal foldlevel=99 +let b:undo_ftplugin .= '|setlocal foldexpr< foldmethod< foldlevel<' " Spellcheck documents we're actually editing (not just viewing) if &modifiable && !&readonly diff --git a/vim/ftplugin/sed.vim b/vim/ftplugin/sed.vim index b154eadf..35e705a4 100644 --- a/vim/ftplugin/sed.vim +++ b/vim/ftplugin/sed.vim @@ -9,6 +9,7 @@ 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<' -- cgit v1.2.3