For years, I kept track of random notes by creating a text or Markdown file on my desktop. And at the end of the day, I would delete that file and start over again the next day. Inspired by the minimalism of todo-txt-cli, I created a similar system to manage my own notes.
Keep reading for more details or skip to the code: github.com/hachibu/note.sh.
As I mentioned before, I used to keep a single notes file on my desktop, and I would delete it everyday. I would use this notes file to keep track of random thoughts and details related to my work and personal life. My notes file might contain code snippets from work, inspirational quotes, or it might have my latest and greatest open-source software idea, or maybe even the beginning of a new blog post. Anyway, I loved the simplicity of it, and I didn’t want any more apps, databases or logins in my life.
But it wasn’t until I started using todo-txt-cli
that I considered writing a script to manage my own notes. The brilliant part
todo-txt-cli is that it’s just text files stored in my Dropbox and a
small shell script to interface with those files.
Inspired by the minimalism of
todo-txt-cli, I built note.sh.
In total, the entire project consists of 1 Bash script, 1 environment variable
to configure the notes directory and 1 symlink to install it to your
The way it works is that every time I run the script, it opens the note for that
day in my editor of choice. For example, if today was December 2, 2020 then the
script would open a file named
2020-12-02.md in the notes directory.
I use Vim as my editor, and I have my notes stored on Dropbox so I can access them on all of my computers. So, my shell RC file looks like this.
export EDITOR="vim" export NOTE_DIR="$HOME/Dropbox/Notes"
And my Dropbox directory looks like this.
For searching, the script accepts a pattern and runs a recursive grep over the notes directory. I chose grep because I use this script on both Mac and Linux, and I wanted the script to be as portable as possible.
I’ve been using this script for several months across several computers, and I
still love it. I don’t search as often as I thought I would, but it’s comforting
to know it’s all there if I need it. I also ended up creating an alias for my
script so all I need to type is the letter
n to run the script.
In the future, I’d like to add a test suite to the code base, figure out how to create a Homebrew formula, and add archiving for older notes.