Zettelkasten Forum


Poor Man's Roam-Style Contextual Backlinks (Keyboard Maestro)

When this script is triggered, it creates a new note with all paragraphs that contain the search term, with a link to original document. It's very helpful when I'm trying to get a quick overview of what I've said about a topic.

Probably easier to see a visual. So this query (in the KM Marco):

Produces this file:

Here's the macro:


You of course need to update the path to your Zettelkasten Notes Folder.

Download Macro

Hope it's helpful to somebody.

Comments

  • Sweet! Mind posting it to the macro collection thread with a short description? https://forum.zettelkasten.de/discussion/213/the-archive-keyboard-maestro-alfred-macros

    Author at Zettelkasten.de • https://christiantietze.de/

  • edited February 2020

    VERY nice, though I will have to change "buffer" or it will drive me nuts. But each to their own! Thank you for posting this.

    Edit: though I find that on my machine it does not produce any results. Will have to investigate. I'm presently on Catalina, which might be part of the problem. It seems to break all sorts of stuff.

    Post edited by MartinBB on
  • @MartinBB I had the same reaction. Sounds great but it showed nothing in the note. A few small changes and its work wonderful.

    1. Had to brew install findutils to get gxargs
    2. Had to be sure gxargs is in Keyboard Maestro's path - path added to Keyboard Maestro variable 'ENV_PATH` = /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
    3. Still investigating the 2 sed commands. I'd like to have the [[202001261947 Broken Top Reviewed]] transformed into [[202001261947]] Broken Top Reviewed

    Will Simpson
    My zettelkasten is for my ideas, not the ideas of others. I don’t want to waste my time tinkering with my ZK; I’d rather dive into the work itself. My peak cognition is behind me. One day soon, I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
    kestrelcreek.com

  • Meh, I know there's a way to do this in just one sed with multiple capture groups, but how escapes me at the moment. Hackish solution:

    echo "[[202001261947 Broken Top Reviewed]]" | sed 's/\[\[\([0-9]*\) /[[\1]] /g' | sed 's/\]\]$//'
    
  • @msteffens provided this a while ago in https://forum.zettelkasten.de/discussion/comment/3372#Comment_3372

    Adding the title back after the link with another capture group:

    ls | sed -E -e 's/.[^.]*$//' -e 's!^([0-9]+)[[:space:]-]+(.+)![[\1]] \2!' 
    

    Instead of the ls as input, you take the previous macro step.

    Author at Zettelkasten.de • https://christiantietze.de/

  • @ctietze said:
    Sweet! Mind posting it to the macro collection thread with a short description? https://forum.zettelkasten.de/discussion/213/the-archive-keyboard-maestro-alfred-macros

    Yes absolutely!

  • @Will said:
    @MartinBB I had the same reaction. Sounds great but it showed nothing in the note. A few small changes and its work wonderful.

    1. Had to brew install findutils to get gxargs
    2. Had to be sure gxargs is in Keyboard Maestro's path - path added to Keyboard Maestro variable 'ENV_PATH` = /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

    Totally spaced about gxargs, you're exactly right, apologies and thanks for pointing this out.

  • @mleo2003 said:
    Meh, I know there's a way to do this in just one sed with multiple capture groups, but how escapes me at the moment.

    Did you just 'Meh' my beautiful script?! Kidding. The sed command is obviously much simpler but I wanted the contents of my 'search results note' to be sorted by "Title, Z First" so the results would be in the same sort order as my archive.

  • I've tried to install this macro, and follow the other amends above, and it creates the buffer search document but I get results [blank], lines processed 0. Any ideas what I'm doing wrong, please?

Sign In or Register to comment.