diff options
Diffstat (limited to '.vim/functions/set-indent.vim')
-rw-r--r-- | .vim/functions/set-indent.vim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/.vim/functions/set-indent.vim b/.vim/functions/set-indent.vim new file mode 100644 index 0000000..8fdc308 --- /dev/null +++ b/.vim/functions/set-indent.vim @@ -0,0 +1,19 @@ +" SetIndent +" +" Set the size of indents and whether to use tabs or spaces. +" +" @param int size The width of the indents. +" @param bool tabs Whether to use hard tabs or not. Defaults to 1. +function SetIndent (...) + let size = get(a:, 1) + let tabs = get(a:, 2, 1) + + if (tabs) + set noet + else + set et + endif + + exe "set sw=" . size + exe "set ts=" . size +endfunction |