Vim - tips and tricks
Record a macro that will delete everything after matching character and repeat it N-times.
In this example we’re going to use =
as the matching character.
qaf=D⏎q
Where:
qa
- to start recording and save it under ‘a’ bufferf=
- find ‘=’ characterD
- Delete everything to the EOL⏎
- press ’enter’ to go to the beginning of next lineq
- to stop recording the macro then to repeat the macro N-times, i.e. repeat it 5 times:
5@a
5
- the number of times you’d like to repeat the macro@a
- play macro recorded undera
buffer