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.