Vim and ctags

Today's post is random Vim trivia, featuring ctags!

If you've used Vim casually or been around the UNIX world for a bit, you may have heard of ctags, but not really been sure what it was good for.  Well, ctags is a code indexing tool.  It scans a bunch of source code and creates an index of it.  The goal is the same as creating a  database index - to allow you to look up specific things quickly.

That's straight-forward enough, right?  But what the heck do you do with the index once you create it?  Well...nothing.  At least, not directly.  Sure, you can manually create and query the tag index from the command line, but you wouldn't really want to.  Following the UNIX way, ctags is really just one part of the pipeline.  It creates the index and it's your editor that queries it and does stuff with the result.

If you want to use Vim for any non-trivial development, then you really want to be using ctags.  It provides you with a handy way to jump between definitions of classes, functions, and so forth, much like you get with Visual Studio or PHPStorm.  It makes your life significantly easier.

The only problem is that there's a little setup that needs to be done.  Reading the ctags index doesn't require anything special if you're using the default "tags" files for the index.  However, generating that file takes a little more effort.  You can do it manually, but really you want it to happen automatically in the background.  Luckily, there's a plugin for that - Gutentags.  This plugin will basically just update your tags file in the background at appropriate intervals.  Although it has some options available, there's not really anything you need to configure for it - it just works out of the box.

Once you've got your tags file auto-updating, the next thing is to figure out how you want to browse tags.  The workflow that works best depends on your preferences, and I can't claim to have mastered it.  This page gives a good overview of the different commands and default keybindings that are available for tag browsing.  As with everything else in Vim, there are a lot of options available, but you can get by with just a few to start.  Personally, I find that just ctrl+] and :tselect work for 80% of my needs, but your mileage may vary.

How about some flowers?

It's a long weekend for Memorial Day.  I spent most of yesterday and this morning cleaning.  And I had a late and very large lunch of braised pork ribs, which was delicious but filling.  So I just don't feel like coming up with anything substantial right now.  So how about some flowers?

The lilac trees from my yard are starting to bloom

Since the Rochester Lilac Festival was postponed this year, here's a picture of the lilac trees from my side yard.  They've got quite a few flowers this year.  Last year they didn't do as well because I didn't prune them sufficiently the previous season.  However, I did a better job last season.

Actually, it's just as well the festival was postponed.  The blossoms have only come out in the last week or so, and the festival is normally early in May.  So it probably would have been a lilac festival without many actual lilacs.  Though it still would have been nice to get out and roam around the park....

Making the best of quarantine

So what do you do when there's a pandemic on and you can't really leave the house?  Fix up the house, of course!

Actually, I had been planning to take a week off to work on my house before the pandemic hit.  Our floors were in very bad need of refinishing.  And since we had to sand them down for that anyway, my decided to stain them as well.  And since we were doing that, we figured we might as well paint the walls and ceiling too.

Unfortunately I can't find a good picture of the floor, but this one has a cat in it, so that makes up for it.  As you can see, it was that light, honey color.  What you can't see is that in many place the finish had worn completely off.

My living room (and cat), before the refresh.

Here's the "after" picture of that same corner of the living room.  We stained it an "espresso" brown.  It was a slow job - two coats of stain at about six hours per coat to apply - but I think it turned out really well.  

My living room after the refresh.

The new paint is a brownish-gray color called "armadillo".  We also got some new lamps for the living room and put the "daylight" LED bulbs in them.  The old paint and soft lighting made the room very yellow.  The whiter light and new paint actually make it feel brighter.

Of course, there's always more work to do, but we're making progress.  Being stuck at home sucks, but at least we're doing something productive with the time.

Working from home

As everyone continues to work from home, I figured I'd share what my workspace looks like.  As I mentioned in a previous entry, I've been using the desk I have set up in the basement that I've barely touched in several years.

Unlike one of my co-workers, who on the last day in the office brought home his mounted entire four-screen setup, I didn't bring back everything I had on my desk.  However, I did bring the important things: my laptop and my UHK.  After a day or two of working with just the laptop screen, I then proceeded to scavenge a couple of monitors to get back to a three-screen setup.  One of them is actually my main desktop monitor, which was still hooked up to the KVM switch that I used years ago when I worked from home for deviantART.

My work-from-home space.My work-from-home space, with improvised three-monitor setup.

So far this setup is working pretty well for me. That's a good thing, because it's going to be at least another two weeks - the state is still on "pause" until May 15th, assuming they don't extend the "pause" again.  And even then we probably won't go back to the office right away.

Thinking about DNS over HTTPS

I read an interesting article on the drawbacks of DNS over HTTPS (DoH) the other day.  This comes on the heels of the news that Mozilla is rolling out DoH to all Firefox users by default

I'd never really thought too much about DoH.  In general, more encryption is usually better, so my initial thought was "it's probably a good thing", but that's about as deep as it went.  After reading a little more about the down sides, I'm less convinced.  I still think it's a probably good thing that DoH exists, but I'm note so sure that it's a good idea to push everyone toward it.

My main reservation at this point is that DoH seems architecturally wrong.  It introduces a way to do DNS queries that's not really compatible with the old way and it's not clear to me that it offers any really big wins.

Of course, I'm not saying that DoH has no benefits or use-cases.  There are definitely cases where it can be useful and add another layer of privacy.  But it kind of reminds me of PHP "security" features like safe_mode in the sense that it does solve a legitimate problem, and does so in a way that "works" (for certain definitions of "works"), but solves it at the wrong layer and in a way that can interfere with other legitimate things.

As this blog from the PowerDNS team discusses, DoH is not a panacea in terms of privacy.  Yes, it adds a layer of encryption, and that is definitely useful in some cases.  But it doesn't do anything to address the myriad other ways in which your online activity can be tracked.

Of course, that depends very much on whom you want to stop from tracking you.  Obviously it does zero to stop advertisers or website operators from tracking you - they do their tracking at a much higher level.  It also doesn't stop your ISP from tracking you - even if everything else is encrypted, you can't stop your ISP from knowing the IP addresses you visit.  I mean, that's just how the web works.  And from an IP address, you can usually determine the website pretty easily.  And, of course, your DoH provider still has access to all your DNS requests, so you better make sure you trust them.

For me, personally, the bottom line is that DoH doesn't give you anything that you don't already get with a half-way decent VPN provider.  Granted, the VPN provider is then your single point of privacy failure, so you better make sure you pick a reputable on (I like and recommend Private Internet Access).  But a VPN covers pretty much everything you can do at the network level, not just DNS for web requests.  Of course, you still need browser privacy plugins to block tracking at higher levels in the stack, but sadly that's necessary either way.