Editor shortcuts, tabs, and reference ids

Public · https://markedb.in/ttscoff/editor-improvements

Editor shortcuts, tabs, and reference ids

A few editor habits that should have worked like a normal Mac text field now do.

Move and indent without leaving the page

Control-Command-Up and Control-Command-Down move the current line. Control-Command-Left and Control-Command-Right indent it. On Windows and Linux those are Ctrl-Alt with the same arrows.

Command-[ and Command-] outdent and indent too. They used to step through browser history, because the browser treats those chords as back and forward. In the editor they stay on the line you are editing.

Tab inserts a real tab, lined up on a 4-column stop, instead of two spaces.

Refresh after someone else saved

If the note was updated elsewhere, the status bar says to refresh. That reload used to get stuck behind unsaved changes in the tab you were looking at. Refresh now drops that stale buffer and loads the newer copy, so you can keep going.

Complete a reference id

Reference-style links can be filled in from the document itself.

With the cursor inside the id of a link, [the spec][|], the list is every [id]: url definition in the note. The same list opens for an image, ![diagram][|]. Typing narrows it.

The other direction is the definition you have not written yet. A [ within three spaces of the start of a line lists ids used in the text that still need a URL. That includes [label][id], image references, and a collapsed link like [CommonMark][], whose id is the link text. Ids that already have a definition stay off that list. Fenced code is ignored.

See [the spec][spec] and [CommonMark][].

[spec]: https://example.com/spec

Drop [some claim][src] in a paragraph, then later type [ at the start of a line and pick src when you are ready to paste the URL.