replacer.vim and 2021 updates

Published 3rd January 2022 at 01:31am UTC 

The last twelve months have probably been the busiest I've ever been so I haven't had time to post much lately. Hopefully I'll make up for that this year as things settle down somewhat.


replacer.vim


First things first, I made a vim plugin called replacer.vim whilst I was in between jobs and forgot to tell anyone about it. I needed a way to find and replace words within files and filenames in a given folder for another project I was working on. Because I'm a deeply annoying person, the plugin's name just reminds me of this.


In the past I've used plugins like far.vim which is usually fine but hasn't been great on my current laptop. I'm using a refurbished ASUS TUF Gaming laptop mostly as a temporary replacement for my desktop whilst I've been...abroad. They say it's a "gaming" laptop but I've seen it heat up and die whilst I've been looking through my emails (in particular when the battery's charging...and when I have, like, 375 tabs open in Firefox). Suffice it to say, my machine really struggled when I tried to run a find and replace in the project I was working on.


So I wrote the replacer.vim plugin which at the moment provides the following commands:


:FindAndReplace "old_term", "new_term", "./path/to/file/"
:RenameFiles "old_file", "new_file", "./path/to/file/"
:RenameDirs "old_directory", "new_directory", "./path/to/directory/"


Note, the last argument in each of these commands is optional as "." is used as the default when it isn't supplied. By default, the changes are applied to the current project directory and the contents of its subdirectories.


I've never actually written a vim plugin before so it's pretty basic - the plugin runs the UNIX find command to find and replace terms. I've heard that this is typically avoided because of performance issues but honestly, it's worked ok on my laptop so far. YMMV.


replacer.vim can be found in the github link above and a .zip version has also been uploaded to vim.org. Feel free to provide feedback or contribute!


In other news...


In 2021, I finally did the thing I've wanted to do for most of the last decade - I moved to Berlin! I'm too late of course; I'm not a wide-eyed twenty-year-old any more and the era of cheap rents is well and truly over. But still, after the ordeal that was the flat search in Berlin (which itself was complicated by last year's travel ban), I found a new place in the end. It's a little cheaper than my flat in Stepney was if you convert to pounds and much fancier too. The pipes don't leak whenever it snows. I actually don't mind going outside as much because the streets in central Berlin don't make me want to die inside the way that British architecture typically does.


So that's nice.


What isn't nice is trying to navigate the immigration process post-Brexit. Nobody seems to know what the rules are for us any more - nobody except maybe the police. I wound up travelling to, like, four different countries in November just to get around the 90/180 rule and the pet embargoes (and also to make it to my sister's graduation), only to be told that, no, British citizens can't apply for short stay Schengen visas but also, no, the Germans won't actually apply the 90/180 rule to Brits anyway. I'm allowed to stay without a visa if I leave every 89 days but earning is obviously more awkward. Not to be some irritating remoaner or whatever but, it would have been nice if Brexit hadn't significantly increased my carbon footprint on the same week as COP26.


(And I swear, if I see one more person smugly declare that "Brexit means Brexit", I may punch them)


I had to give up my job at FutureLearn. It was pretty much the first place I've ever worked where I felt like I fit in and I wasn't being screwed over in some really obvious way. And I gave it up because....because I couldn't bear to go flat hunting in London again? Because I hate the Old Country more than I could ever enjoy anything? Or because FL was simply the right place at the wrong time? I was pretty exhausted from moving around so much when I resigned - I ran out of words to describe it all. I suppose feeling the way I did was a little silly as it was ultimately just a job (and I'm anti-work anyways☭). But there were times, in 2020 in particular, when that job was the only thing that seemed to be going well for me. I'll really miss my old team.


I started a new job in December but it's been a bit of a culture shock so far so I honestly don't know. Outside of work, I must have sprained my knee from, er, shopping too much a few weeks ago but it's better now. Even got my booster shot the other day. Had a quiet Christmas with the cat and saw pretty fireworks on New Years. Life in the (new) big city.

Post a comment