Skip to content

Support various common navigation commands in the editor #32

Closed as duplicate

Description

@jamescrosswell

Navigate to:

  • Start of word/line/document: Ctrl ←, HOME, Ctrl HOME
  • End of word/line/document: Ctrl →, END, Ctrl END
  • Previous cursor location: Ctrl -
    • (requires some kind of cursor location history stack)
  • Next cursor location: Ctrl Shift -
    • (requires some kind of cursor location history stack)
  • line:column: Ctrl: L

Select:

  • From cursor until start of word/line/document: Same as the navigate shortcuts, with the Shift modifier
  • From cursor until end of word/line/document: Same as the navigate shortcuts, with the Shift modifier

Research

Turns out this is actually quite difficult.

TTY

After reading a brief history of TTY it becomes apparent that terminal applications (including TUI applications) have quite a few constraints as a result of historical baggage.

For example:

$ stty -a
speed 38400 baud; rows 73; columns 238; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q;

The second line of stty -a output lists all the special characters.

So depending on which characters are reserved by the TTY config, various characters may simply be unavailable for use.

OS Shortcut Keys

The OS can also capture various keys. By default, macOS swallows Ctrl + ← and Ctrl + → as these are mapped to Mission Control shortcuts.

This makes it very difficult to map common shortcuts used in modern OSX or Windows applications to do what people familiar with those OS conventions might expect in a TUI application...

Activity

  1. jamescrosswell commented on May 30, 2026

    @jamescrosswell
    ContributorAuthor

    Already got this working locally/manually in iTerm2:

    Needs a Homebrew package for that to be properly distributed to users:

    Closing this issue then as essentially a duplicate of #40

  2. added a commit that references this issue on May 30, 2026
    c4d6b71
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions