如果您实际上不需要更改tabstops并且只需插入正确数量的空格就可以逃脱,我建议您编写脚本.这是一个快速而肮脏的版本,可能会做你想要的:
原文链接:https://www.f2er.com/bash/384248.htmllet s:tabstops = [0,5,80] fun! Find_next(pos) if a:pos > min(s:tabstops) && a:pos < max(s:tabstops) let my_count = 0 while my_count < len(s:tabstops) - 1 if a:pos > get(s:tabstops,my_count) && a:pos < get(s:tabstops,my_count+1) return get(s:tabstops,my_count+1) endif let my_count = my_count + 1 endwhile return -1 endif return -1 endfun fun! Tabbing() let pos = col('.') let next_stop = Find_next(pos) let the_command = "normal i" let my_count = 0 while my_count < next_stop - pos let the_command = the_command . " " let my_count = my_count + 1 endwhile let the_command = the_command . "" execute the_command endfun imap <TAB> j<ESC>:call Tabbing()<CR>lxi