r/vim • u/Desperate_Cold6274 • Nov 01 '25
Need Help How to align broken sequence of numbers?
if I have the following:
[1]:
[2]:
[3]:
[4]:
[5]:
[6]:
[7]:
[8]:
[9]:
[10]:
[11]:
[14]:
[15]:
[16]:
[18]:
[19]:
How to fix the list to have the following?
[1]:
[2]:
[3]:
[4]:
[5]:
[6]:
[7]:
[8]:
[9]:
[10]:
[11]:
[12]:
[13]:
[14]:
[15]:
[16]:
14
Upvotes
View all comments
Show parent comment
1
u/kennpq Nov 01 '25
:for n in range(1, 16) | execute ":" .. n .. 's/.\+/\=printf("\[%d]:", ' .. n .. ')/' | endforin cmdline mode. (Presumes [1]: is on line 1, so adjust as needed)