Revisiting TagFiler and Vitag
I haven’t mentioned this setup for a while and thought I’d remind everyone, especially newer readers, about a rabbit hole they might choose to go down. I haven’t updated or changed any of these scripts since posting, and they’re all still working well.
Part 1: TagFiler
First up, I’ll mention TagFiler. This is a single script that runs via Hazel, sorting files into a shallow filesystem using Finder tags. You set up “context” folders which are tagged with =Context
, e.g. =Work
or =Personal
. Then you create a shallow system of subfolders tagged with relevant keywords, preceded with @
, e.g. @nvultra
or @dimspirations
. You can nest those @
folders as deep as you like, but the idea is to make it easy to target them. Then you tag individual files with #Context :subtopic
, and subtopics can be nested like #Projects :nvultra:marketing:source
to file in ~/Projects/nvultra/marketing/source files
.
The nice thing about these tags with punctuation is they create something like nested tagging, which Finder lacks. When searching with Spotlight (or HoudahSpot), you can search any part of a colon-separated tag (this works for any punctuation, TagFiler just uses colons). So with the above example, I can search for tag:nvultra tag:source
and get the tagged file as a result. Then, when tagging files in Finder (or, again, HoudahSpot as it has great autocompletion for tagging), the tags will autocomplete as if they were nested, and just typing nvultra
will bring up all of the colon-separated versions of the tag.
This tagging system has been working perfectly for me for years now. I collect all my files throughout the day on my Desktop and in my Downloads folder. Hazel tags new files with Purple
, and then at the end of the day (or the beginning of the next one) I open up a saved search in HoudahSpot that shows me all Purple
files in my main “inbox” folders. I can then use HoudahSpot’s autocompletion to tag the files appropriately, and Hazel just whisks them off to their target folder. This saved search could also just be a Smart Folder in Finder, but Smart Folders can’t narrow down to multiple specific directories. In HoudahSpot this can be accomplished using saved searches and filtering.
The nice thing about this system is that I can also find any TagFiler-tagged file using Spotlight without digging through the folders. But if anything ever happened to my tags (a metadata disaster…), I’d still have a reasonable folder structure for finding all of my files. It’s also nice when archiving projects to a NAS or other storage system that doesn’t have Spotlight searching.
Side Note: cdt
I have a little Bash function called cdt (with a fish companion function) for navigating TagFiler-tagged directories from Terminal. I don’t actually use it much as I have fuzzy_cd in my Fish setup and it’s a bit smarter in general. I can’t vouch that it still works as is, but if you wanted to dig in, let me know if you find issues.
Part 2: Vitag
So I do a majority of my tagging in Finder or HoudahSpot. But when I’m faced with a large number of files and want to tag them quickly and easily, I use vitag.
By the way, if you do your tagging in Finder, you can add a keyboard shortcut to make popping up the tag dialog keyboard-accessible.
Vitag loads up a list of files for the current directory (and optionally subdirectories) with bracketed tags after each filename in your editor of choice. I usually use Sublime Text with -e 'subl -w'
, but you can use Vim, NeoVim, BBEdit, VS Code, or any editor that has a CLI tool and the ability to wait
on the command for the window to close (usually -w
, but see the --help
for your tool). You just edit the tags as plain text and when you save and close the file, all of the tags are changed on the files.
There’s no autocomplete by default, although I have written a Sublime package (which I haven’t shared because it’s very custom) which helps me out with syntax highlighting, snippets, and autocomplete. For the most part, though, I rely on TextExpander snippets for contexts and common sub-tags.
Then I can just copy/paste as needed to fill out the whole batch, along with the search tools in the editor (at the end of a day most of my files in my inboxes will relate to just a couple of projects, so I can copy and paste many of the tags, sometimes modifying just the last element of a colon-separated tag).
For example, the first thing I do on a batch of “inbox” files is search for Purple
and ⌘G through the results to add my tags. You could also remove any line that didn’t contain a tag like Purple
— as long as the filename remains unchanged, deleting a line will have no effect in Vitag. Unlike tools like Vidir, Vitag only deals with tags.
You’ll notice a couple of files tagged with
#x#
. This is a special tag that I search for with Hazel, which deletes any file containing it. It’s my solution for deleting unneeded files when doing my cleanup. It actually moves to Trash rather than outright deleting as you’d get in Vidir, which provides the option for undoing.
So, to wrap up, there’s nothing new here. I’ve been using these tools for years. I just thought I’d share them again in case I first talked about them before you started reading. Let me know what innovations you have with your own tagging systems!