aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-06-19 15:24:01 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-06-19 15:24:01 +1200
commit352e2b820167ff2377350683a88a69af803be78c (patch)
treedd579c6f2170b8dcb5191101c69f97e0d6e12206 /vim
parentInline option resets and undos in Vim C ftplugin (diff)
downloaddotfiles-352e2b820167ff2377350683a88a69af803be78c.tar.gz
dotfiles-352e2b820167ff2377350683a88a69af803be78c.zip
Move 'foldmethod' definitions out to filetypes
Diffstat (limited to 'vim')
-rw-r--r--vim/after/ftplugin/c.vim4
-rw-r--r--vim/after/ftplugin/perl.vim4
-rw-r--r--vim/after/ftplugin/php.vim4
-rw-r--r--vim/after/ftplugin/sh.vim4
-rw-r--r--vim/after/ftplugin/vim.vim4
-rw-r--r--vim/after/ftplugin/zsh.vim4
-rw-r--r--vim/ftplugin/awk.vim4
-rw-r--r--vim/ftplugin/sed.vim4
-rw-r--r--vim/vimrc18
9 files changed, 32 insertions, 18 deletions
diff --git a/vim/after/ftplugin/c.vim b/vim/after/ftplugin/c.vim
index dd99e81f..ea220e65 100644
--- a/vim/after/ftplugin/c.vim
+++ b/vim/after/ftplugin/c.vim
@@ -6,6 +6,10 @@ let b:undo_ftplugin .= '|setlocal commentstring< define< include<'
setlocal complete+=d
let b:undo_ftplugin .= '|setlocal complete<'
+" Fold based on indent level
+setlocal foldmethod=indent
+let b:undo_ftplugin .= '|setlocal foldmethod<'
+
" Include system headers on UNIX
if has('unix')
setlocal path+=/usr/include
diff --git a/vim/after/ftplugin/perl.vim b/vim/after/ftplugin/perl.vim
index a303fa75..e780bed5 100644
--- a/vim/after/ftplugin/perl.vim
+++ b/vim/after/ftplugin/perl.vim
@@ -4,6 +4,10 @@ setlocal equalprg=perltidy
let b:undo_ftplugin .= '|unlet b:current_compiler'
\ . '|setlocal equalprg< errorformat< makeprg<'
+" Fold based on indent level
+setlocal foldmethod=indent
+let b:undo_ftplugin .= '|setlocal foldmethod<'
+
" Add angle brackets to pairs of matched characters for q<...>
setlocal matchpairs+=<:>
let b:undo_ftplugin .= '|setlocal matchpairs<'
diff --git a/vim/after/ftplugin/php.vim b/vim/after/ftplugin/php.vim
index 58d83c49..7bb20f99 100644
--- a/vim/after/ftplugin/php.vim
+++ b/vim/after/ftplugin/php.vim
@@ -8,6 +8,10 @@ setlocal comments=s1:/*,m:*,ex:*/,://,:#
setlocal formatoptions+=or
let b:undo_ftplugin .= '|setlocal comments< formatoptions<'
+" Fold based on indent level
+setlocal foldmethod=indent
+let b:undo_ftplugin .= '|setlocal foldmethod<'
+
" Use pman as 'keywordprg'
setlocal keywordprg=pman
let b:undo_ftplugin .= '|setlocal keywordprg<'
diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim
index 8468b133..2c68d83a 100644
--- a/vim/after/ftplugin/sh.vim
+++ b/vim/after/ftplugin/sh.vim
@@ -3,6 +3,10 @@ setlocal comments=:#
setlocal formatoptions+=or
let b:undo_ftplugin .= '|setlocal comments< formatoptions<'
+" Fold based on indent level
+setlocal foldmethod=indent
+let b:undo_ftplugin .= '|setlocal foldmethod<'
+
" If subtype is Bash, set 'keywordprg' to han(1df)
if exists('b:is_bash')
setlocal keywordprg=han
diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim
index 30182bba..01f971b9 100644
--- a/vim/after/ftplugin/vim.vim
+++ b/vim/after/ftplugin/vim.vim
@@ -9,6 +9,10 @@ endif
let b:regex_escape_flavor = 'vim'
let b:undo_ftplugin .= '|unlet b:regex_escape_flavor'
+" Fold based on indent level
+setlocal foldmethod=indent
+let b:undo_ftplugin .= '|setlocal foldmethod<'
+
" Use :help as 'keywordprg' if not already set; this is the default since Vim
" v8.1.1290
if &keywordprg !=# ':help'
diff --git a/vim/after/ftplugin/zsh.vim b/vim/after/ftplugin/zsh.vim
index 5aa2600a..6b5a389c 100644
--- a/vim/after/ftplugin/zsh.vim
+++ b/vim/after/ftplugin/zsh.vim
@@ -2,3 +2,7 @@
compiler zsh
let b:undo_ftplugin .= '|unlet b:current_compiler'
\ . '|setlocal errorformat< makeprg<'
+
+" Fold based on indent level
+setlocal foldmethod=indent
+let b:undo_ftplugin .= '|setlocal foldmethod<'
diff --git a/vim/ftplugin/awk.vim b/vim/ftplugin/awk.vim
index 663ba810..310534ac 100644
--- a/vim/ftplugin/awk.vim
+++ b/vim/ftplugin/awk.vim
@@ -9,6 +9,10 @@ setlocal comments=:#
setlocal formatoptions+=or
let b:undo_ftplugin = 'setlocal comments< formatoptions<'
+" Fold based on indent level
+setlocal foldmethod=indent
+let b:undo_ftplugin .= '|setlocal foldmethod<'
+
" Specify ERE flavor for regex_escape.vim
let b:regex_escape_flavor = 'ere'
let b:undo_ftplugin .= '|unlet b:regex_escape_flavor'
diff --git a/vim/ftplugin/sed.vim b/vim/ftplugin/sed.vim
index 9627941d..b154eadf 100644
--- a/vim/ftplugin/sed.vim
+++ b/vim/ftplugin/sed.vim
@@ -8,3 +8,7 @@ let b:did_ftplugin = 1
setlocal comments=:#
setlocal formatoptions+=or
let b:undo_ftplugin = 'setlocal comments< formatoptions<'
+
+" Fold based on indent level
+setlocal foldmethod=indent
+let b:undo_ftplugin .= '|setlocal foldmethod<'
diff --git a/vim/vimrc b/vim/vimrc
index 3bc765b7..165322ac 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -584,24 +584,6 @@ set confirm
"
set noesckeys
-" By default, I prefer that figuring out where a region of text to fold away
-" should be done by the indent level of its lines, since I tend to be careful
-" about my indentation even in languages where it has no semantic meaning.
-"
-set foldmethod=indent
-
-" That said, I don't want any of these indent-based folds to start off closed.
-" Therefore, we set the depth level at which folds should automatically start
-" as closed to a rather high number, per the documentation's recommendations.
-"
-" I think of a Vim window with a file buffer loaded into it as
-" a two-dimensional, planar view of the file, so that moving down one screen
-" line means moving down one buffer line, at least when 'wrap' is unset.
-" Folds break that mental model, and so I usually enable them explicitly only
-" when I'm struggling to grasp some code with very long functions or loops.
-"
-set foldlevelstart=99
-
" Automatic text wrapping options using flags in the 'formatoptions' option
" begin here. I rely on the filetype plugins to set the 't' and 'c' flags for
" this option to configure whether text or comments should be wrapped, as