aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-06-19 17:02:21 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-06-19 17:02:21 +1200
commitcc2cd38d2405dc50bdc7184516fd0b8e0e71ade0 (patch)
treea69f9172f593bb9b5172d93741d00ce38e5ae249
parentSet 'shiftwidth' to 4 for C Vim sources (diff)
downloaddotfiles-cc2cd38d2405dc50bdc7184516fd0b8e0e71ade0.tar.gz
dotfiles-cc2cd38d2405dc50bdc7184516fd0b8e0e71ade0.zip
Set filetype-appropriate 'foldlevel'
-rw-r--r--vim/after/ftplugin/c.vim5
-rw-r--r--vim/after/ftplugin/perl.vim5
-rw-r--r--vim/after/ftplugin/php.vim5
-rw-r--r--vim/after/ftplugin/sh.vim5
-rw-r--r--vim/after/ftplugin/vim.vim5
-rw-r--r--vim/after/ftplugin/zsh.vim5
-rw-r--r--vim/ftplugin/awk.vim5
-rw-r--r--vim/ftplugin/markdown.vim4
-rw-r--r--vim/ftplugin/sed.vim5
9 files changed, 27 insertions, 17 deletions
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<'