vim-auto-tabstop

A Vim plugin for automatically setting tabstop size
git clone https://git.ce9e.org/vim-auto-tabstop.git

commit
0e786d6f9456103428c113f777ecd25b80fd98ad
parent
ef1ee2c5b6de4343e95da68cd96e1a38f40a9882
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-06-13 19:23
simplify

Diffstat

M plugin/fets.vim 24 ++----------------------

1 files changed, 2 insertions, 22 deletions


diff --git a/plugin/fets.vim b/plugin/fets.vim

@@ -26,33 +26,13 @@
   26    26 "
   27    27 " [1]: http://nickgravgaard.com/elastic-tabstops/
   28    28 
   29    -1 function! s:MaxTabCount()
   30    -1 	let l:max = 0
   31    -1 
   32    -1 	for l:line in getline(0, "$")
   33    -1 		let l:tab_count = len(split(l:line, '\t')) - 1
   34    -1 		if l:tab_count > l:max
   35    -1 			let l:max = l:tab_count
   36    -1 		endif
   37    -1 	endfor
   38    -1 
   39    -1 	return l:max
   40    -1 endfunction
   41    -1 
   42    29 function! s:CalcTS()
   43    30 	let l:max = 0
   44    -1 	let l:tab_count = s:MaxTabCount()
   45    31 
   46    32 	for l:line in getline(0, "$")
   47    -1 		let l:i = 0
   48    -1 
   49    33 		for l:item in split(l:line, '\t')[:-2]
   50    -1 			if l:i < l:tab_count
   51    -1 				if len(l:item) > l:max
   52    -1 					let l:max = len(l:item)
   53    -1 				endif
   54    -1 
   55    -1 				let l:i += 1
   -1    34 			if len(l:item) > l:max
   -1    35 				let l:max = len(l:item)
   56    36 			endif
   57    37 		endfor
   58    38 	endfor