aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-06-22 21:54:41 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-06-22 21:54:41 +1200
commit9931b35cc197c76350b2e22e0a1fe6536888ac53 (patch)
tree420c1bba0de3f0d781680c2ca3ed5345662144e0
parent9487591c0cfaf509318fd9c14d3d2209c641c6fd (diff)
downloaddotfiles-9931b35cc197c76350b2e22e0a1fe6536888ac53.tar.gz
dotfiles-9931b35cc197c76350b2e22e0a1fe6536888ac53.zip
Correct indent settings
-rw-r--r--vim/after/indent/c.vim14
-rw-r--r--vim/after/indent/gitconfig.vim12
-rw-r--r--vim/after/indent/make.vim18
-rw-r--r--vim/indent/csv.vim10
-rw-r--r--vim/indent/help.vim16
5 files changed, 52 insertions, 18 deletions
diff --git a/vim/after/indent/c.vim b/vim/after/indent/c.vim
index ad01aceb..9cea0a2d 100644
--- a/vim/after/indent/c.vim
+++ b/vim/after/indent/c.vim
@@ -1,9 +1,15 @@
-" Use hard tabs for C
+" Use plain old tabs for indent in C files
setlocal noexpandtab
-setlocal shiftwidth=0
-let b:undo_indent .= '|setlocal expandtab< shiftwidth<'
+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 &softtabstop = &shiftwidth
+ let &l:softtabstop = &l:shiftwidth
let b:undo_indent .= '|setlocal softtabstop<'
endif
diff --git a/vim/after/indent/gitconfig.vim b/vim/after/indent/gitconfig.vim
index ff1654e5..943e78ea 100644
--- a/vim/after/indent/gitconfig.vim
+++ b/vim/after/indent/gitconfig.vim
@@ -1,9 +1,15 @@
" Use tabs for indent in Git config files, rather than fighting with the
" frontend tool
setlocal noexpandtab
-setlocal shiftwidth=0
-let b:undo_indent .= '|setlocal expandtab< shiftwidth<'
+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 &softtabstop = &shiftwidth
+ let &l:softtabstop = &l:shiftwidth
let b:undo_indent .= '|setlocal softtabstop<'
endif
diff --git a/vim/after/indent/make.vim b/vim/after/indent/make.vim
index 341cd7f6..d45487b4 100644
--- a/vim/after/indent/make.vim
+++ b/vim/after/indent/make.vim
@@ -1,4 +1,14 @@
-" Use 'tabstop' (8 columns, a full tab) for indent operations in Makefiles.
-" It seems odd that the stock plugin doesn't force this on its own.
-setlocal shiftwidth=0
-let b:undo_indent = 'setlocal shiftwidth<'
+" 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/indent/csv.vim b/vim/indent/csv.vim
index a9aba056..e97ab29e 100644
--- a/vim/indent/csv.vim
+++ b/vim/indent/csv.vim
@@ -10,8 +10,14 @@ let b:undo_indent = 'setlocal autoindent<'
" Literal tabs
setlocal noexpandtab
-setlocal shiftwidth=0
-let b:undo_indent = 'setlocal expandtab< shiftwidth<'
+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<'
diff --git a/vim/indent/help.vim b/vim/indent/help.vim
index c49e1ced..78de85d0 100644
--- a/vim/indent/help.vim
+++ b/vim/indent/help.vim
@@ -4,11 +4,17 @@ if exists('b:did_indent')
endif
let b:did_indent = 1
-" Use hard tabs for editing Vim help files
+" Literal tabs
setlocal noexpandtab
-setlocal shiftwidth=0
-let b:undo_indent = 'setlocal expandtab< shiftwidth<'
+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 &softtabstop = &shiftwidth
- let b:undo_indent = 'setlocal softtabstop<'
+ let &l:softtabstop = &l:shiftwidth
+ let b:undo_indent .= '|setlocal softtabstop<'
endif