14 Nov 2014 →
If you’re like me, you take notes in various different ways. Evernote. Notational Velocity. Random text files on the desktop—usually named something like
lkajsdflkajsdf.md. A notebook (those things with paper pages that you operate by dragging a pen across its surface). And if you’re really like me, you have notes scattered among all these different repositories. These tools are all great, but none of them have ever stuck for me. And when you go to look for something, you have to look in several places. Blech.
When I started my new job a few months ago, I decided to just to ditch the notebook and Evernote. Returning to a developer role, I found myself spending most of my time with my old friends, vim and the command line.
For simplicity’s sake, I started with a directory called
Notes in my Dropbox that served as a bucket of markdown files. Each file followed the naming convention:
I searched existing notes with
To speed things up a bit, I plopped an alias in my
cd to this directory and pop open MacVim. I find it useful to have NERDTree open alongside the new note because I often want to look back at the last note I took for a standing meeting. This alias sped up getting into the note itself, but I found myself often leaving these in unnamed vim tabs and then closing them without saving. It seemed to be time for a proper bash script.
I also realized that re-typing the name of a recurring meeting was a waste of time and prone to typos. I knew that bash completion could be used here reflect on previous note titles. So when I sit down for my next biweekly check-in with Kemal, I’d love to just type
note kTAB and have my terminal autocomplete to
A bash script would also easily fill in the current date for me. Typing
20141114 before the note title is annoying and something that can be easily grabbed from the
So here’s what I ended up with:
Completion is initialized in my
.bash_profile like so:
Just two lines of bash to toss this into my dotfiles repo so it’s always available. For now at least, this seems to works pretty well.
Note that you can easily replace
mvim with your editor of choice.
atom work just as well.