Gå till sidans huvudinnehåll Gå till sidans meny
Kontakt
Lyssna

Archive nvALT notes with Hazel

MPU tip 1

Introduction

After having tried a bunch of applications for notes I found nvALT (by the eminent, one and only, Brett Terpstra) and has stuck to it since then, for the fastest note taking possible.  In combination with TextExpander, HazelAlfred and Keyboard Maestro, this beautifully pure text editor has become even more powerful. E.g.

  • Double tap ⌘ and a pre-filled note with an Event with When, Where, Who, What, Why and How is ready to receive further notes from a meeting—planned in advance or just a sudden interruption. (The event is later either moved to Day One, converted to tasks in OmniFocus or a reference or discarded.)
  • Double tap ⌥ and a simple date stamped note is created to take som short idea on the fly (without having to type a title, similar to above and Drafts on iOS, a kind of inbox to capture ideas for further reference—but not yet a task in OmniFocus).
  • Selecting some text and pressing ⌘! (actually ⌘⇧1 on my Swedish keyboard) adds the snippet with a date stamp and a link to the original source, formatted as Markdown, to my ongoing file ”! Argument” in nvALT. (Since it is better to use many small files in nvALT rather than a few big ones, Hazel watches the file size and simply rename the file to ”! Argument [date]”, where [date] is the date of the last note, when the size exceeds 30 kB, and then starts a new file ”! Argument”.

Now, to the specific tip for today (as a tiny part of my eco system of structure, scripts, workflows and apps).

Problem

Some notes in nvALT become obsolete but I still want to keep them for future reference without cluttering the current notes. After experimenting with tagging, exporting and even manually removing those notes I got tired and asked myself:

What is the simplest solution with the tools I have available?

Solution

The answer turned out to be Hazel.

  • Put a tag #Archive somewhere inside the note, usually at the end.
  • Let Hazel scan my Notes folder (on Dropbox) and put notes containing that tag into the folder Archive—inside the notes folder.
    • nvALT will detect that the note is not available anymore and will ask me to delete it depending on the preferences.
    • Restoring the note is of no uses since Hazel will immediately remove it again if it still contains the tag. (Use a simple Alfred file action to remove the tag instead. See below.)
    • You may skip this dialog for en even more efficient workflow by unchecking ”Confirm note deletion” in the preferences under ”General”. The note will then be immediately moved to the trash which is a sufficiently safe option for my needs.
  • Also, another Hazel rule will scan the Archive folder and move notes, without the #Archive tag, out of the Archive folder, back into the Notes folder, one level up.
    • Recently I added an Alfred workflow to remove the tag #Archive in a note to have it automatically restored as a current note by Hazel, already scanning the Archive folder.
    • The file action is a simple one-liner bash script: sed -i.bak /#Archive/d $1

Of course, you may easily customize the hashtag to whatever works for you and locate your archive folder wherever you want. Please, feel free to contact me if you need some further explanation. Any tips or improvements would also be appreciated.

The rules in Hazel are extremely simple and not much to publish but I just found out I was not allowed to publish them here for security reasons. However, you may recreate them yourself from these images.

Archive

Un-Archive

So, my “secret” is simply to let Hazel move files around depending on the content. The consequences so far has been a faster growing number of notes in the Archive folder than in the Notes folder itself, which is kept clear, current and complete. (It is also very easy to search for notes—including the Archive folder—using Alfred, Spotlight, TextWrangler, Tembo, HoudahSpot, Terminal, etc. but Alfred is probably the best option if you want to follow up with a file action like Un-Archive.)

Good luck!

P-D

Uppdaterad 5 juli, 2016 kl 11:49 av Per-Daniel Liljegren