heyman / heynote

A dedicated scratchpad for developers
https://heynote.com
Other
3.76k stars 183 forks source link

Document Emacs keybinds #226

Open MajorDallas opened 4 months ago

MajorDallas commented 4 months ago

The README lists the default keybinds for both Mac and non-Mac keyboards, but to see what the emacs keybinds are one has to read code. Within the code, one also to figure out exactly what Mod and Meta refer to, as both are used, eg. Meta-w for copy, or Mod-ArrowUp for going to the previous block. Complicating this further, some of the default keybinds on Alt appear to take precedent over the emacs keybinds on Mod, eg. Alt-ArrowUp for moving a line up is what happens on my Windows machine, where "Mod" is typically Alt and "Meta" is typically Windows. (Naturally, Windows' own keybinds on Meta take precedent over Heynote's.)

I started writing the following list to submit for use in the README, but the confusion around meta/mod/alt stopped me short of offering a complete and correct list:

# Basic editing
Mod-a           emacsSelectAll
Ctrl-y          paste
Ctrl-w          cut
Meta-w          copy

Ctrl-Shift--        undo
Ctrl-.          redo

Ctrl-d          deleteCharForward
Ctrl-h          deleteCharBackward
Ctrl-k          deleteToLineEnd
Ctrl-o          splitLine
Ctrl-t          transposeChars

# Single cursor movement
ArrowLeft       cursorCharLeft
Ctrl-b          cursorCharLeft
ArrowRight      cursorCharRight
Ctrl-f          cursorCharRight
ArrowUp         cursorLineUp
Ctrl-p          cursorLineUp
ArrowDown       cursorLineDown
Ctrl-n          cursorLineDown
Ctrl-a          cursorLineStart
Ctrl-e          cursorLineEnd
Ctrl-v          cursorPageDown

## Select mode
ArrowLeft       selectCharLeft
Ctrl-b          selectCharLeft
ArrowRight      selectCharRight
Ctrl-f          selectCharRight
ArrowUp         selectLineUp
Ctrl-p          selectLineUp
ArrowDown       selectLineDown
Ctrl-n          selectLineDown
Ctrl-a          selectLineStart
Ctrl-e          selectLineEnd

# Cursor group movement
Ctrl-ArrowLeft      cursorGroupLeft
Ctrl-ArrowRight cursorGroupRight
Mod-ArrowUp     gotoPreviousBlock
Mod-ArrowDown   gotoNextBlock
Ctrl-ArrowUp        gotoPreviousParagraph
Ctrl-ArrowDown  gotoNextParagraph

## Select mode
Ctrl-ArrowLeft  selectGroupLeft
Ctrl-ArrowRight selectGroupRight
Mod-ArrowUp selectPreviousBlock
Mod-ArrowDown   selectNextBlock
Ctrl-ArrowUp    selectPreviousParagraph
Ctrl-ArrowDown  selectNextParagraph

Ctrl-g          emacsCancel
Ctrl-Space      toggle emacsDarkMode