3 ms·
I had a recent refactor which was basically "take a 5-argument function call split over many lines and replace it with a different 1-argument call". I made a ma
by ThrustVectoring 10y ago
I had a recent refactor which was basically "take a 5-argument function call split over many lines and replace it with a different 1-argument call". I made a macro that found the code block I wanted, edited it to the desired syntax, saved the file, and opened the next file in the list I had opened. I opened vim for this occasion with `vim $(ag -l STRING_IN_REFACTORED_CODE)`, which used search results as a list of files to open with vim.
The most fun vim macro I've made solved a "solve this puzzle before we want to interview you" question. The problem was a URL to request that gave you a response to parse into the next URL, chained about 100 times. The vim macro took the URL in the current line, shelled out to make a network request for the result of `curl` with that line as an argument, and edited the result into the next URL to fetch.
- asymmetric 10y agoWas the puzzle for Rainforest?