GNU/Linux
•
xterm-256color
•
bash
26 views
As much as possible let me walk through the more important step
-
Use
ctrl vwithGto replaced every column with|so that the delimiter is consistent, as opposed to having random|in the columns -
Start the macro with
qq. There’s many things to consider when recording a macro, because you’re trying to ensure the same key bindings work for all cases. Perfect practice make perfect. Craft your macro slowly -
As a good habit, press
0to go to front of line. I think I used_ -
Yank the first column into the register
a-
wto advance to the first word -
vt|to highlight till the end of delimiter -
geto backtrack until the end of word -
"ayto yank intoaregister - The reason for such weird moves is just to handle the case when the column has more than one word
-
-
f|to advance to second column -
Repeat the steps as before to yank second column into
b -
0to go back to start of line -
c2f|to change the first 2 columns.-
ctrl rfollowed byato insert content of registera(replace theawithbto insert content of registerb) -
Format the line however u want, then
escwhen done
-
-
jto go down next line -
ctrl v,/---<enter>to select the correct number of rows.f|then;to select the correct number of columns. Presscto change into desired value. -
gvfollowed byescto end up on the row divider.0Dto clear the line. -
jto go to next line (not required but QoL things) -
qto stop recording -
@qto replay macro, then@@to replay the previous macro. Keep pressing@@until desired changes are made