- commit
- be13ac3dff973f58ec261441a27b28207b06a24a
- parent
- 0e786d6f9456103428c113f777ecd25b80fd98ad
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2023-06-13 19:33
refactor CalcTS to return list
Diffstat
| M | plugin/fets.vim | 18 | +++++++++++++----- |
1 files changed, 13 insertions, 5 deletions
diff --git a/plugin/fets.vim b/plugin/fets.vim
@@ -27,21 +27,29 @@ 27 27 " [1]: http://nickgravgaard.com/elastic-tabstops/ 28 28 29 29 function! s:CalcTS()30 -1 let l:max = 0-1 30 let l:tabs = [0] 31 31 32 32 for l:line in getline(0, "$") -1 33 let l:i = 0 -1 34 33 35 for l:item in split(l:line, '\t')[:-2]34 -1 if len(l:item) > l:max35 -1 let l:max = len(l:item)-1 36 let l:len = len(l:item) + 1 -1 37 -1 38 if len(l:tabs) <= l:i -1 39 call add(l:tabs, l:len) -1 40 elseif l:len > l:tabs[l:i] -1 41 let l:tabs[l:i] = l:len 36 42 endif -1 43 -1 44 let l:i += 1 37 45 endfor 38 46 endfor 39 4740 -1 return l:max + 1-1 48 return l:tabs 41 49 endfunction 42 50 43 51 function! FETS()44 -1 let l:fets = s:CalcTS()-1 52 let l:fets = max(s:CalcTS()) 45 53 46 54 if l:fets == &l:tabstop 47 55 let &l:tabstop = &g:tabstop