New row with child/outdent?

Hey, I’m loving how Bike is developing! I’m trying to re-simplify my life and getting back to outlining, and wanted to suggest two keyboard shortcuts that I depended on heavily as an OmniOutliner user back in the day: create a new row as a child of the current row, and create a new row, outdented. I know it’s only two moves in Bike, but they’re a really nice ergonomic for outlining.

Thanks I’ve added to my list.

Not sure if I am doing this quite right yet, but I find that for the current Bike 2.0 preview (234), I can add:

  • Add Inside ⌘} to give the selected row a new child, at the head of any existing children
  • Add Outside ⌘{ To give the parent of the selected row (if it has one) a new following sibling

by defining functions for them,

Expand disclosure triangle to view addInside() & addOutside()
function addInside(): boolean {
  // New child for selection,
  // at head of any existing children.
  const
    editor = bike.frontmostOutlineEditor,
    row = editor?.selection?.row;

  return (undefined === row) || editor.transaction(
    { animate: 'default' }, () => editor.selectCaret(
      editor.outline.insertRows(
        [{ text: "" }], row, row.firstChild
      )[0],
      0
    )
  ) || true;
}

function addOutside(): boolean {
  // New following sibling for parent
  // of selection, if it has one.
  const
    editor = bike.frontmostOutlineEditor,
    row = editor?.selection?.row,
    outline = editor?.outline,
    parent = row?.parent;

  return (undefined === row || parent.id === outline.root.id) || (
    editor.transaction(
      { animate: 'default' }, () => editor.selectCaret(
        editor.outline.insertRows(
          [{ text: "" }], parent.parent, parent.nextSibling
        )[0],
        0
      )
    )
  ) || true;
}

making those functions available as commands, by adding the following to the activate function of, for example, a !startup extension,

  bike.commands.addCommands({
    commands: {
      "!startup:addInside": addInside,
      "!startup:addOutside": addOutside
    },
  })

and binding those commands to keystrokes, for text mode, or block mode, or both.

Expand disclosure triangle to view binding of keys to commands
  bike.keybindings.addKeybindings({
    keymap: "text-mode",
    keybindings: {
      "Command-Shift-}": "!startup:addInside",
      "Command-Shift-{": "!startup:addOutside"
    }
  });

  bike.keybindings.addKeybindings({
    keymap: "block-mode",
    keybindings: {
      "Command-Shift-}": "!startup:addInside",
      "Command-Shift-{": "!startup:addOutside"
    }
  });
1 Like

Thanks! I somehow forgot that all these things can be implemented in extension system pretty well.

@bck and others…

Currently using this code requires a some setup. The story is the extension system is (I think) currently quite complete for developers, but is missing lots of ease of use affordances for non-developers.

To use this code you will need:

  1. To get bike-extension-kit installed and able to build.
  2. Once you’ve done that, then you can paste the provided code into the startup extension. Built. And install the built extension.

Hope that makes sense, let me know if you have questions.