Shortcut for "go to parent" row?

I’m trying to use the mouse less with OmniOutliner, but don’t see a keyboard shortcut to Shortcut for moving the cursor to a row’s parent.

Am I missing something? If there’s not a shortcut, have you seen anything someone’s done with Keyboard Maestro or the new Omni Automation scripting?

I think I found the answer myself. The View > Collapse Row Completely command not only collapses the row the cursor is in—it collapses everything up to the parent, which, of course, leaves the cursor on that parent row.

I’d just assumed Collapse Row Completely did exactly what it said, but it does something more!

To experiment with a plugin you could:

  • Drag the file below onto the Automation > Plugins window,
  • and then drag the select-parent button from Customize Toolbar onto the toolbar,
  • or in Keyboard Maestro (assuming a macOS context), assign a keystroke to the OmniOutliner > Automation > select parent menu item.

select-parent.omnijs (1.6 KB)

JS Source
/*{
    "author": "Rob Trew @2020",
    "targets": ["omnioutliner"],
    "type": "action",
    "version": "0.1",
    "description": "Select parent", 
    "label": "Select parent",
    "mediumLabel": "Select parent",
    "paletteLabel": "Select parent",
}*/
(() => Object.assign(
    new PlugIn.Action(seln => {
        const main = () =>
            bindMay(
                headMay(seln.nodes)
            )(
                x => seln.editor.select(
                    x.parent.isRootNode ? (
                        [x]
                    ) : [x.parent]
                )
            );

        // -------------------- GENERIC --------------------
        // https://github.com/RobTrew/prelude-jxa

        // Just :: a -> Maybe a
        const Just = x => ({
            type: 'Maybe',
            Nothing: false,
            Just: x
        });


        // Nothing :: Maybe a
        const Nothing = () => ({
            type: 'Maybe',
            Nothing: true,
        });


        // bindMay (>>=) :: Maybe a -> 
        // (a -> Maybe b) -> Maybe b
        const bindMay = mb =>
            // Nothing if mb is Nothing, 
            // or the application of the
            // (a -> Maybe b) function mf 
            // to the contents of mb.
            mf => mb.Nothing ? (
                mb
            ) : mf(mb.Just);


        // headMay :: [a] -> Maybe a
        const headMay = xs =>
            // Just the first item of xs, or
            // Nothing if xs is an empty list.
            0 < xs.length ? (
                Just(xs[0])
            ) : Nothing();

        return main();
    }), {
        validate: seln => true
    }))();
1 Like

That does exactly what I want, selecting the parent without collapsing everything below it. Thanks!

1 Like