aboutsummaryrefslogtreecommitdiff
path: root/vim/autoload/indent.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-12-18 17:32:18 +1300
committerTom Ryder <tom@sanctum.geek.nz>2019-12-18 17:32:18 +1300
commitc978da17884ef456cb41d28133790550f98b6ae8 (patch)
treecc8580f3d91f32367b08b5f6d194d705961de71a /vim/autoload/indent.vim
parentMerge branch 'release/v8.5.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-c978da17884ef456cb41d28133790550f98b6ae8.tar.gz
dotfiles-c978da17884ef456cb41d28133790550f98b6ae8.zip
Merge branch 'release/v8.6.0'v8.6.0
* release/v8.6.0: Refactor indent macros into autoload function Fix indentation of a Makefile line Put common indent setting patterns in macros
Diffstat (limited to 'vim/autoload/indent.vim')
-rw-r--r--vim/autoload/indent.vim32
1 files changed, 32 insertions, 0 deletions
diff --git a/vim/autoload/indent.vim b/vim/autoload/indent.vim
new file mode 100644
index 00000000..3e850c63
--- /dev/null
+++ b/vim/autoload/indent.vim
@@ -0,0 +1,32 @@
+function! indent#spaces(...) abort
+ setlocal expandtab
+ let &l:shiftwidth = a:0
+ \ ? a:1
+ \ : 0
+ let &l:softtabstop = has#('patch-7.3.693')
+ \ ? -1
+ \ : &l:shiftwidth
+ call indent#undo()
+endfunction
+
+function! indent#tabs() abort
+ setlocal noexpandtab shiftwidth< softtabstop<
+ call indent#undo()
+endfunction
+
+function! indent#undo() abort
+ if exists('b:undo_indent_set')
+ return
+ endif
+ let l:undo = 'call indent#reset()'
+ if exists('b:undo_indent')
+ let b:undo_indent .= '|'.l:undo
+ else
+ let b:undo_indent = l:undo
+ endif
+ let b:undo_indent_set = 1
+endfunction
+
+function! indent#reset() abort
+ setlocal expandtab< shiftwidth< softtabstop< tabstop<
+endfunction