|
|
|
|
|
by Symbiote
2964 days ago
|
|
Since discovering them, I use Emacs keyboard macros all the time. Let's say I have: key value
salt pepper
fish chips
vodka orange
rum cola
and I want the second column in uppercase.<F3> to start recording a macro. Alt →, → to position the cursor at "v" (or just →→→→→→ if this is a fixed width column), then Alt U to uppercase the next word. → to move the cursor one forward, to the start of the next line. <F4> to finish recording the macro. Then press <F4> five times to run the macro five times. (Explanation intended for users who've never used Emacs before. Of course, there are optimizations.) |
|
• qq to start recording a macro in register q,
• w to jump to the second word,
• gUaw to "go uppercase a word",
• j to move to next line (↓ works as well),
• q to stop recording,
• 5@q to apply macro in register q five times.
But in this example I would have probably used ex command:
(for every line do as if I had typed wgUaw) or visualy selected the second column as a block and just pressed U.I'm genuinely interested in someone showing how to do this kind of trasformation in popular modern editors such as Atom and VSCode. Is there such a flexible way as in the classic editors?