- commit
- 183262b3d711401df8c3e3900e8193667d20bf11
- parent
- f2445a75172e024a46050b28ea760a0ef296426b
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2016-09-11 23:15
default parameters
Diffstat
| M | plugin/detectindent.vim | 30 | ++++++++++++++++++++++-------- |
1 files changed, 22 insertions, 8 deletions
diff --git a/plugin/detectindent.vim b/plugin/detectindent.vim
@@ -1,11 +1,23 @@1 -1 function! SetIndent(expand, width)2 -1 let &l:expandtab = a:expand3 -1 let &l:tabstop = a:width4 -1 let &l:shiftwidth = a:width5 -1 let &l:softtabstop = a:width6 -1 endfunction-1 1 let g:detectindent_preferred_indent = 2 -1 2 let g:detectindent_preferred_expandtab = 0 -1 3 -1 4 function! SetIndent(...) -1 5 if a:0 < 1 -1 6 let &l:expandtab = g:detectindent_preferred_expandtab -1 7 else -1 8 let &l:expandtab = a:1 -1 9 endif 7 108 -1 call SetIndent(0, 2)-1 11 if a:0 < 2 -1 12 let width = g:detectindent_preferred_indent -1 13 else -1 14 let width = a:2 -1 15 endif -1 16 -1 17 let &l:tabstop = width -1 18 let &l:shiftwidth = width -1 19 let &l:softtabstop = width -1 20 endfunction 9 21 10 22 function! MatchIndent() 11 23 let n = 1 @@ -14,7 +26,7 @@ function! MatchIndent() 14 26 let cur_line = getline(n) 15 27 16 28 if cur_line =~ '^ '17 -1 call SetIndent(0, 2)-1 29 call SetIndent(0) 18 30 return 19 31 elseif cur_line =~ '^ ' 20 32 call SetIndent(1, 4) @@ -26,6 +38,8 @@ function! MatchIndent() 26 38 27 39 let n = n + 1 28 40 endwhile -1 41 -1 42 call SetIndent() 29 43 endfunction 30 44 31 45 command! Tabs call SetIndent(0, 2)