aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-12-18 17:05:08 +1300
committerTom Ryder <tom@sanctum.geek.nz>2019-12-18 17:05:08 +1300
commit4a4341936d2911820abddd67882f9b867496abbb (patch)
tree39378e9e5c72cac5fa3015895aca205951664bf7 /vim
parentMerge branch 'release/v8.5.0' into develop (diff)
downloaddotfiles-4a4341936d2911820abddd67882f9b867496abbb.tar.gz
dotfiles-4a4341936d2911820abddd67882f9b867496abbb.zip
Put common indent setting patterns in macros
Diffstat (limited to 'vim')
-rw-r--r--vim/after/indent/awk.vim8
-rw-r--r--vim/after/indent/css.vim8
-rw-r--r--vim/after/indent/html.vim12
-rw-r--r--vim/after/indent/javascript.vim8
-rw-r--r--vim/after/indent/mail.vim8
-rw-r--r--vim/after/indent/perl.vim8
-rw-r--r--vim/after/indent/php.vim8
-rw-r--r--vim/after/indent/sh.vim8
-rw-r--r--vim/after/indent/vim.vim12
-rw-r--r--vim/macros/indent/spaces.vim7
-rw-r--r--vim/macros/indent/spaces/2.vim3
-rw-r--r--vim/macros/indent/spaces/4.vim3
12 files changed, 26 insertions, 67 deletions
diff --git a/vim/after/indent/awk.vim b/vim/after/indent/awk.vim
index ba6dfdeb..951c830a 100644
--- a/vim/after/indent/awk.vim
+++ b/vim/after/indent/awk.vim
@@ -1,8 +1,2 @@
" Use four spaces for indentation
-setlocal expandtab
-setlocal shiftwidth=4
-let b:undo_ftplugin .= '|setlocal expandtab< shiftwidth<'
-if &l:softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_ftplugin .= '|setlocal softtabstop<'
-endif
+runtime macros/indent/spaces/4.vim
diff --git a/vim/after/indent/css.vim b/vim/after/indent/css.vim
index ba6dfdeb..951c830a 100644
--- a/vim/after/indent/css.vim
+++ b/vim/after/indent/css.vim
@@ -1,8 +1,2 @@
" Use four spaces for indentation
-setlocal expandtab
-setlocal shiftwidth=4
-let b:undo_ftplugin .= '|setlocal expandtab< shiftwidth<'
-if &l:softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_ftplugin .= '|setlocal softtabstop<'
-endif
+runtime macros/indent/spaces/4.vim
diff --git a/vim/after/indent/html.vim b/vim/after/indent/html.vim
index 72c92d21..fb7f4127 100644
--- a/vim/after/indent/html.vim
+++ b/vim/after/indent/html.vim
@@ -1,15 +1,9 @@
+" Use four spaces for indentation
+runtime macros/indent/spaces/4.vim
+
" Clear away the flag we set to indent after paragraphs
unlet html_indent_inctags
" Don't re-indent lines on right-angle-bracket or enter
setlocal indentkeys-=<>>,<Return>
let b:undo_ftplugin .= '|setlocal indentkeys<'
-
-" Use four spaces for indentation
-setlocal expandtab
-setlocal shiftwidth=4
-let b:undo_ftplugin .= '|setlocal expandtab< shiftwidth<'
-if &l:softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_ftplugin .= '|setlocal softtabstop<'
-endif
diff --git a/vim/after/indent/javascript.vim b/vim/after/indent/javascript.vim
index ba6dfdeb..951c830a 100644
--- a/vim/after/indent/javascript.vim
+++ b/vim/after/indent/javascript.vim
@@ -1,8 +1,2 @@
" Use four spaces for indentation
-setlocal expandtab
-setlocal shiftwidth=4
-let b:undo_ftplugin .= '|setlocal expandtab< shiftwidth<'
-if &l:softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_ftplugin .= '|setlocal softtabstop<'
-endif
+runtime macros/indent/spaces/4.vim
diff --git a/vim/after/indent/mail.vim b/vim/after/indent/mail.vim
index ba6dfdeb..951c830a 100644
--- a/vim/after/indent/mail.vim
+++ b/vim/after/indent/mail.vim
@@ -1,8 +1,2 @@
" Use four spaces for indentation
-setlocal expandtab
-setlocal shiftwidth=4
-let b:undo_ftplugin .= '|setlocal expandtab< shiftwidth<'
-if &l:softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_ftplugin .= '|setlocal softtabstop<'
-endif
+runtime macros/indent/spaces/4.vim
diff --git a/vim/after/indent/perl.vim b/vim/after/indent/perl.vim
index ba6dfdeb..951c830a 100644
--- a/vim/after/indent/perl.vim
+++ b/vim/after/indent/perl.vim
@@ -1,8 +1,2 @@
" Use four spaces for indentation
-setlocal expandtab
-setlocal shiftwidth=4
-let b:undo_ftplugin .= '|setlocal expandtab< shiftwidth<'
-if &l:softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_ftplugin .= '|setlocal softtabstop<'
-endif
+runtime macros/indent/spaces/4.vim
diff --git a/vim/after/indent/php.vim b/vim/after/indent/php.vim
index ba6dfdeb..951c830a 100644
--- a/vim/after/indent/php.vim
+++ b/vim/after/indent/php.vim
@@ -1,8 +1,2 @@
" Use four spaces for indentation
-setlocal expandtab
-setlocal shiftwidth=4
-let b:undo_ftplugin .= '|setlocal expandtab< shiftwidth<'
-if &l:softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_ftplugin .= '|setlocal softtabstop<'
-endif
+runtime macros/indent/spaces/4.vim
diff --git a/vim/after/indent/sh.vim b/vim/after/indent/sh.vim
index ba6dfdeb..951c830a 100644
--- a/vim/after/indent/sh.vim
+++ b/vim/after/indent/sh.vim
@@ -1,8 +1,2 @@
" Use four spaces for indentation
-setlocal expandtab
-setlocal shiftwidth=4
-let b:undo_ftplugin .= '|setlocal expandtab< shiftwidth<'
-if &l:softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_ftplugin .= '|setlocal softtabstop<'
-endif
+runtime macros/indent/spaces/4.vim
diff --git a/vim/after/indent/vim.vim b/vim/after/indent/vim.vim
index 320e5d7d..59179225 100644
--- a/vim/after/indent/vim.vim
+++ b/vim/after/indent/vim.vim
@@ -1,15 +1,9 @@
+" Use two (not four!) spaces for indentation, per convention
+runtime macros/indent/spaces/2.vim
+
" Remove inapplicable defaults from 'indentkeys'; we should only need to undo
" this if the stock plugin didn't already arrange that (before v7.3.539)
setlocal indentkeys-=0#,0{,0},0),:
if !exists('b:undo_indent')
let b:undo_indent = 'setlocal indentkeys<'
endif
-
-" Observe VimL conventions for two-space indents
-setlocal expandtab
-setlocal shiftwidth=2
-let b:undo_indent .= '|setlocal expandtab< shiftwidth<'
-if &softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_indent .= '|setlocal softtabstop<'
-endif
diff --git a/vim/macros/indent/spaces.vim b/vim/macros/indent/spaces.vim
new file mode 100644
index 00000000..d4b36afe
--- /dev/null
+++ b/vim/macros/indent/spaces.vim
@@ -0,0 +1,7 @@
+" Use spaces for current buffer's indentation (set 'shiftwidth' first)
+setlocal expandtab
+let b:undo_ftplugin .= '|setlocal expandtab< shiftwidth<'
+if &l:softtabstop != -1
+ let &l:softtabstop = &l:shiftwidth
+ let b:undo_ftplugin .= '|setlocal softtabstop<'
+endif
diff --git a/vim/macros/indent/spaces/2.vim b/vim/macros/indent/spaces/2.vim
new file mode 100644
index 00000000..a0f847ae
--- /dev/null
+++ b/vim/macros/indent/spaces/2.vim
@@ -0,0 +1,3 @@
+" Use two spaces for current buffer's indentation
+setlocal shiftwidth=2
+runtime macros/indent/spaces.vim
diff --git a/vim/macros/indent/spaces/4.vim b/vim/macros/indent/spaces/4.vim
new file mode 100644
index 00000000..13ac5258
--- /dev/null
+++ b/vim/macros/indent/spaces/4.vim
@@ -0,0 +1,3 @@
+" Use four spaces for current buffer's indentation
+setlocal shiftwidth=4
+runtime macros/indent/spaces.vim