aboutsummaryrefslogtreecommitdiff
path: root/vim/after
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-06-30 00:51:23 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-06-30 00:51:23 +1200
commitd115ba06a04b0772246da35af8e9dad87933a0d1 (patch)
tree9ef9586b95aef46781ae656372330de79cb3cb9c /vim/after
parentRefactor ftplugins into single files (diff)
downloaddotfiles-d115ba06a04b0772246da35af8e9dad87933a0d1.tar.gz
dotfiles-d115ba06a04b0772246da35af8e9dad87933a0d1.zip
Review vim/ftplugin and vim/indent files
Diffstat (limited to 'vim/after')
-rw-r--r--vim/after/ftplugin/php.vim12
-rw-r--r--vim/after/indent/vim.vim12
2 files changed, 20 insertions, 4 deletions
diff --git a/vim/after/ftplugin/php.vim b/vim/after/ftplugin/php.vim
index 4521ba7d..f9ff008f 100644
--- a/vim/after/ftplugin/php.vim
+++ b/vim/after/ftplugin/php.vim
@@ -16,6 +16,18 @@ let b:undo_ftplugin = b:undo_ftplugin
\ . '|setlocal comments<'
\ . '|setlocal formatoptions<'
+" Define keywords for matchit.vim
+if exists('g:loaded_matchit')
+ let b:match_words = '<?php:?>'
+ \ . ',\<do\>:\<while\>'
+ \ . ',\<for\>:\<endfor\>'
+ \ . ',\<foreach\>:\<endforeach\>'
+ \ . ',\<if\>:\<elseif\>:\<else\>:\<endif\>'
+ \ . ',\<switch\>:\<endswitch\>'
+ \ . ',\<while\>:\<endwhile\>'
+ let b:undo_ftplugin = 'unlet b:match_words'
+endif
+
" Stop here if the user doesn't want ftplugin mappings
if exists('g:no_plugin_maps') || exists('g:no_php_maps')
finish
diff --git a/vim/after/indent/vim.vim b/vim/after/indent/vim.vim
index bfd92aeb..e46aae54 100644
--- a/vim/after/indent/vim.vim
+++ b/vim/after/indent/vim.vim
@@ -1,7 +1,11 @@
" Observe VimL conventions for two-space indents
setlocal shiftwidth=2
-setlocal softtabstop=2
-if exists('b:undo_indent')
- let s:ui = '|setlocal shiftwidth< softtabstop<'
- let b:undo_indent = b:undo_indent . s:ui
+let b:undo_indent = b:undo_indent . '|setlocal shiftwidth<'
+
+" If we need to set 'softtabstop' too, do it
+if &softtabstop == -1
+ setlocal softtabstop=2
+ if exists('b:undo_indent')
+ let b:undo_indent = b:undo_indent . '|setlocal softtabstop<'
+ endif
endif