Hacker News new | ask | show | jobs
by faxmeyourcode 483 days ago
I've got something very similar as a function in my ~/.zshrc, except instead of days separated by lines I start a new file for each topic.

Most of my notes are write-only for a day or so but I keep the old ones around just in case I need to grep through everything (and I've saved myself doing this a few times).

    function notes {
      THIS_MONTH="$(date '+%Y-%m')"

      mkdir -p "$NOTES_FOLDER/$THIS_MONTH" # create folder if it doesn't exist.
      cd "$NOTES_FOLDER/$THIS_MONTH"

      if [ -z "$1" ]; then
        return 0
      fi

      vim $1
      cd -
    }
Running `notes` will take you to today's directory to poke around, and `notes file.md` will open file.md in the appropriate dir.
1 comments

I do something very similar for my public notes as well! I have `tn` to search for a note and open it in a browser, and `tne foo` to open my `foo.md` note in my editor, which in this case is not vim. I then commit them to git, where a post-commit hook uses mkdocs to build them, and gh-deploy to publish them EG https://danielhoherd.com/tech-notes/exiftool/ is the output of my exiftool.md note.