Using Vim Macros to Undo Shortened URLs
I’ve been tinkering with my blog setup. I use Instapaper to do most of my reading on the internet. As I find links that intrigue me, I add them to my Instapaper queue. Once upon a time, every link that I starred in Instapaper got immediately posted to twitter… which explains most of my tweet count.
I have decided to be a little more thoughtful. Rather than blasting the interent, now when I like a link on Instapaper, I use an IFTTT applet to save the title and link to my personal wiki on dropbox, in a folder marked links. I have been manually copying the interesting ones out of that folder to build my monthly link posts. I just wrote a little script that grabs all the links for the current month, and outputs my preferred markdown format so that I can generate a link post at any point. I have also started pulling quotes and commentary out of the link into the saved text file, both in terms of generating the blog post and summarizing what I thought was important about it for my personal knowledge base.
One thing that bugged me about my applet was that it was saving all the links with ifttt’s link shortener… While I just discovered that you can turn that off (read the docs, right?), last month I spent a lot of time opening each link, copying the original URL, and putting it back in the blog post. Yucky.
In preparation for this month I was cleaning up the URLs I had “liked” before turning off the link shortener, and I realized that the way I was using vim was a great example of the power of Vim: movement, magic, and macros… so I humblebragged on Slack and stopped to recreate the edit as a demo:
A “real” version of this macro would have also probably saved the file and
automatically gone to the next file in the list using
:bn, but this was a
quick and dirty version for internet fame. It’ll
I’m always telling people it’s worth the effort to learn their preferred editor well. Maybe this task demonstrates why Vim is a good option. I didn’t even stop to think what I was doing until I was done, and I had accomplished a fairly complex and repetitive task with speed and efficiency.
2019-03-08 16:07:02 -0600
Remove dumb duplicate title.
2019-03-08 15:30:30 -0600
Post: Vim Macros example