Keyboard shortcuts for Outline navigation and same level branch creation

I was thinking of some handy keyboard shortcut/functionality that I got used to in Org-mode. Just throwing them there to see if there’s any interest in implementing or maybe they’re just too esoteric.

One is C-RET and it insert new branch at the current level after subtree if you have something like this and you are standing on Banana (|<1), you can hit C-RET go to the end of the subtree at the same level of Banana (|<2) and create a new fruit let say Orange.

Fruit
  Banana |<1 
     Shape elongated and bent
     Very sweet
         But not always
     Works well with milkshakes
  |<2

The other shortcut would instead allow you to go to the next/previous branch at the same level, so that if you are standing on Orange you can quickly navigate to Banana without having to manually skip all the lines in the middle (or collapse).

Fruit
  Banana |<2
     Shape elongated and bent
     Very sweet
         But not always
     Works well with milkshakes
  Orange |<1
     Does not work well in milkshakes

I strongly recommend this keyboard shortcuts too, they feel pretty handy when you write a outline with key point<==>supporting argument structure

1 Like

For select next sibling:

you could use something like Keyboard Maestro or FastScripts to bind a keyboard shortcut to the script below:

Expand disclosure triangle to view JS source
(() => {
    "use strict";

    // Select PREV or NEXT sibling for selected row in Bike.
    // Or (create a next sibling if none found)

    // Ver 0.2

    // Rob Trew @2023

    // false for the PREVIOUS sibling
    // true for the NEXT sibling
    const isForward = true;

    const
        bike = Application("Bike"),
        doc = bike.documents.at(0);

    return doc.exists()
        ? (() => {
            const
                k = isForward
                    ? "next"
                    : "prev",
                row = doc.selectionRow(),
                sibling = row[`${k}SiblingRow`];

            return sibling.exists()
                ? (
                    doc.select({at: sibling()}),
                    sibling.name()
                )
                : isForward
                    ? (() => {
                        const
                            parent = row.container(),
                            newSibling = new bike.Row(),
                            newRow = (
                                parent.rows.push(newSibling),
                                parent.rows.at(-1)
                            );

                        return (
                            doc.select({at: newRow}),
                            "(New row created & selected)"
                        );
                    })()
                    : `No prev sibling for "${row.name()}"`;
        })()
        : "No document open in Bike.";
})();

For a copy which selects the previous sibling, edit the line near the top, changing true to false.

    // false for the PREVIOUS sibling
    // true for the NEXT sibling
    const isForward = true;

To test in Script Editor, set the language selector at top left to JavaScript rather than AppleScript.

See: Using Scripts - Bike

2 Likes

thanks!

I think for now @complexpoint’s scripts are the best way to do this.

Eventually I would like to add built in commands and shortcuts, but I want to do that when I’m really focused on thinking about keyboard shortcuts… not just adding what seems to make sense. I expect I’ll focus in on keyboard shortcuts eventually when I give more attention to outline mode.