WILT: Finding specific lines that do not contain words

Using https://stackoverflow.com/questions/406230/regular-expression-to-match-a-line-that-doesnt-contain-a-word#406408 and adding in https://marketplace.visualstudio.com/items?itemName=geddski.macros I can now automatically search my Zettelkasten for jobs that are not done.

Background: I'm using Zettelkasten for my work life. All notes, all the time. Projects have a #project tag, operational work has an #operational tag. Things I need to do have a #todo tag and a #notdone or #done tag. But now I've got a big area full of STUFF. With metadata though. I know regex, I know it's power. Can I harness it? Yes.

1/---\n^# .*\n^((?!(#deferred|#done|#cancelled)).)*$/

Where:

  • ---\n is a boundary between Metadata and Markdown
  • # .*\n matches the Title I have for all work - there's only one H1 per file and that's at the top
  • ^((?!(#deferred|#done|#cancelled)).)*$ immediately after are the tags for my project. Breaking this down further
    • ^ Start of the line
    • ((?!....)* Match things that DON'T MATCH THIS
    • (#deferred|#done|#cancelled) THIS is any of these three options

It's working. I need to clean this up, I think, so that #done is always #done, and #deferred and #cancelled are special extra cases... but I don't like that as they're not really done are they? And I don't want to remove the #todo task as that indicates something that was assigned to me rather than informational. Advise welcomed.

I then used the Macros extension to give me a keybinding to a macro command

settings.json

1"macros": {
2        "findOpenJobs": [
3            {"command": "workbench.action.findInFiles", "args": {"query":"---\n^# .*\n^((?!(#deferred|#done|#cancelled)).)*$", "isRegex": true}}
4        ]
5    }

keybindings.json

1[
2    {
3        "key": "ctrl+cmd+/",
4        "command": "macros.findOpenJobs"
5    }
6]

And now I can go ctrl-cmd-/ and it pops up the FindInFiles dialog pre-filled with the regular expression and I can easilly find my work list. HANDY