aboutsummaryrefslogtreecommitdiff
path: root/vim/after
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-12-08 22:57:01 +1300
committerTom Ryder <tom@sanctum.geek.nz>2019-12-08 22:57:01 +1300
commit8490630ee7ce6baf14d784676a16321931c7b899 (patch)
tree25160b0b980a8ac534579382e9e4dc0dda415ab4 /vim/after
parentDon't use cache for phpcsff(1df) (diff)
downloaddotfiles-8490630ee7ce6baf14d784676a16321931c7b899.tar.gz
dotfiles-8490630ee7ce6baf14d784676a16321931c7b899.zip
Switch to default tabs, spaces for some filetypes
Lately I've been cooperating a lot with other administrators in managing some config files, and because they all use Vim with no configuration or nearly no configuration, they use tabs for indentation everywhere. This is showing up particularly often in configuration files. It now seems like a good idea to use tabs as the default so I don't have to keep cleaning up these files afterwards. For most of the languages in which I write actual programs, however, I'm sticking with spaces for now.
Diffstat (limited to 'vim/after')
-rw-r--r--vim/after/indent/c.vim15
-rw-r--r--vim/after/indent/gitconfig.vim15
-rw-r--r--vim/after/indent/html.vim9
-rw-r--r--vim/after/indent/make.vim14
-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.vim3
8 files changed, 35 insertions, 45 deletions
diff --git a/vim/after/indent/c.vim b/vim/after/indent/c.vim
index 9cea0a2d..45db2ebc 100644
--- a/vim/after/indent/c.vim
+++ b/vim/after/indent/c.vim
@@ -1,18 +1,3 @@
-" Use plain old tabs for indent in C files
-setlocal noexpandtab
-let b:undo_indent .= '|setlocal expandtab<'
-if v:version > 703
- \ || v:version == 703 && has('patch629')
- setlocal shiftwidth=0
-else
- let &l:shiftwidth = &l:tabstop
-endif
-let b:undo_indent .= '|setlocal shiftwidth<'
-if &softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_indent .= '|setlocal softtabstop<'
-endif
-
" If the path to the file looks like the Vim sources, set 'shiftwidth' to 4
if expand('%:p') =~# '/vim.*src/'
setlocal shiftwidth=4
diff --git a/vim/after/indent/gitconfig.vim b/vim/after/indent/gitconfig.vim
deleted file mode 100644
index 943e78ea..00000000
--- a/vim/after/indent/gitconfig.vim
+++ /dev/null
@@ -1,15 +0,0 @@
-" Use tabs for indent in Git config files, rather than fighting with the
-" frontend tool
-setlocal noexpandtab
-let b:undo_indent .= '|setlocal expandtab<'
-if v:version > 703
- \ || v:version == 703 && has('patch629')
- setlocal shiftwidth=0
-else
- let &l:shiftwidth = &l:tabstop
-endif
-let b:undo_indent .= '|setlocal shiftwidth<'
-if &softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_indent .= '|setlocal softtabstop<'
-endif
diff --git a/vim/after/indent/html.vim b/vim/after/indent/html.vim
index a7a085fe..72c92d21 100644
--- a/vim/after/indent/html.vim
+++ b/vim/after/indent/html.vim
@@ -4,3 +4,12 @@ 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/make.vim b/vim/after/indent/make.vim
deleted file mode 100644
index 116ea25c..00000000
--- a/vim/after/indent/make.vim
+++ /dev/null
@@ -1,14 +0,0 @@
-" Use plain old tabs for Makefiles (of course)
-setlocal noexpandtab
-let b:undo_indent = 'setlocal expandtab<'
-if v:version > 703
- \ || v:version == 703 && has('patch629')
- setlocal shiftwidth=0
-else
- let &l:shiftwidth = &l:tabstop
-endif
-let b:undo_indent .= '|setlocal shiftwidth<'
-if &softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_indent .= '|setlocal softtabstop<'
-endif
diff --git a/vim/after/indent/perl.vim b/vim/after/indent/perl.vim
new file mode 100644
index 00000000..ba6dfdeb
--- /dev/null
+++ b/vim/after/indent/perl.vim
@@ -0,0 +1,8 @@
+" 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/php.vim b/vim/after/indent/php.vim
new file mode 100644
index 00000000..ba6dfdeb
--- /dev/null
+++ b/vim/after/indent/php.vim
@@ -0,0 +1,8 @@
+" 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/sh.vim b/vim/after/indent/sh.vim
new file mode 100644
index 00000000..ba6dfdeb
--- /dev/null
+++ b/vim/after/indent/sh.vim
@@ -0,0 +1,8 @@
+" 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/vim.vim b/vim/after/indent/vim.vim
index 0767bca0..320e5d7d 100644
--- a/vim/after/indent/vim.vim
+++ b/vim/after/indent/vim.vim
@@ -6,8 +6,9 @@ if !exists('b:undo_indent')
endif
" Observe VimL conventions for two-space indents
+setlocal expandtab
setlocal shiftwidth=2
-let b:undo_indent .= '|setlocal shiftwidth<'
+let b:undo_indent .= '|setlocal expandtab< shiftwidth<'
if &softtabstop != -1
let &l:softtabstop = &l:shiftwidth
let b:undo_indent .= '|setlocal softtabstop<'