diff options
Diffstat (limited to 'docs/typ/cheatsheet.typ')
| -rw-r--r-- | docs/typ/cheatsheet.typ | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/docs/typ/cheatsheet.typ b/docs/typ/cheatsheet.typ new file mode 100644 index 00000000..43162f52 --- /dev/null +++ b/docs/typ/cheatsheet.typ @@ -0,0 +1,159 @@ +// The pardes cheatsheet: the facts only, an index into the docs, not a copy. +// cheatsheet-a4.typ lays it out; style.typ says how each element looks. +// config.zig's "docs/typ" test checks every #word, #key and #tag here +// against the registry, the keymap and the default tags. +#import "style.typ": key, keys, btn, chord, word, tag, addr, file, cmd, doc, pairs, fstree + +== The mouse +#pairs( + btn("B1"), [select, and focus the pane. On a tag: type there.], + btn("B2"), [#word("Exec") the word or selection: a builtin, else a shell line.], + btn("B3"), [#word("Look"): open the file, address, directory or URL, else find the word's next place. Resting the pointer tints what #btn("B3") would take.], + [sweep], [drag #btn("B2") or #btn("B3") to #word("Exec") or #word("Look") exactly what you swept.], + [grip], [drag the box left of a tag: up/down resizes, onto another column moves the pane. A column's right edge drags its width.], +) +=== Chords: hold the first, click the next +#pairs( + chord("B1", "B2"), [cut the #btn("B1") selection], + chord("B1", "B3"), [paste over it], + chord("B1", "B2", "B3"), [copy: cut, then paste back, #btn("B1") still down], + chord("B2", "B1"), [#word("Exec") the word with the #btn("B1") selection as argument (#word("Grep") on a selected name)], + chord("B2", "B3"), [cancel the sweep (#chord("B3", "B2") too)], +) +Over a program that takes the mouse, Shift swaps: #btn("B1", shift: true) selects, #btn("B2", shift: true) goes to the program. +One button: Alt/Option-click is #btn("B2"), Cmd/Super-click #btn("B3"), sweeps too (a terminal passes only Alt); Ctrl-click is a definition; a program that takes the mouse gets the plain click. + +== Tags +#tag("Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit") +#tag("New Tty Find Grep Joincol Delcol") +#tag("Save Tty Collapse Del", path: "/home/me/notes.txt") +#tag("Tty+bash Save Mode Filter Collapse Del", path: "/home/me/src") +#tag("Tty PdfSections PdfTint PdfFit Collapse Del", path: "manual.pdf [1/12]") +- #word("Del") over unsaved text refuses once; again discards. #word("Del") `j`: rows below. #key("SPC d") between two panes takes #key("k") (rows above) or #key("j") (below), asking only if you pause. +- #word("Undo") #word("Redo") #word("Edit") #word("Mode") work typed anywhere. #doc("tags") + +== #word("Look") addresses +Typed anywhere, then #btn("B3") or #key("Enter"): +#pairs( + addr("file:12"), [line 12], + addr("file:12:5"), [line 12, byte column 5], + addr("file:/re/"), [next match after the selection (`file:0/re/`: first)], + addr(":40"), [the pane looked from, line 40 (`:40:5`, any address after `:`)], + addr("~/x"), [home; also in #word("Save"), #word("Restore"), `pardes ~/x`], + addr("@p3:12"), [pane 3 by serial, a terminal's lines too], + addr("src/"), [a directory: a pane listing it; `Get` reads it again], +) +Addresses are sam's: `#n`, `/re/`, `?re?`, `$`, `a,b`. #doc("fs", section: "look-and-exec") + +== Keys: normal mode +Helix-style: motions *select*, then an edit acts on the selection. Mode box: blank normal, `^` insert, `$` raw terminal. Every helix key: #link("https://docs.helix-editor.com/keymap.html")[its keymap]. +#pairs( + [#keys("h", "j", "k", "l") #keys("w", "b", "e")], [move; words select], + [#keys("g g", "g e")], [first line, last line], + [#keys("g h", "g l", "^")], [line start, end, first non-blank], + [#keys("x", "v", "%")], [line, character select, all], + [#key(";")], [collapse to the cursor], + [#keys("d", "c", "y")], [delete, change, yank], + [#keys("p", "P", "R")], [paste after, before, replace], + [#keys("u", "U")], [undo, redo], + [#keys("i", "a", "I", "A", "o", "O")], [insert; #key("Esc") back to normal], + [#keys("s", "S")], [regex: a cursor per match, split], + [#keys("C", ",")], [cursor on next line; keep primary], + [#keys("/", "n", "N")], [search (a query pane), next, previous], + [#keys("m i", "m m")], [textobject, matching bracket], + [#key("|")], [pipe each selection through the shell], + [#keys("g d", "g r")], [definition, references (language server)], + [#keys("Ctrl-d", "Ctrl-u")], [half page down, up], + [#keys("Enter", "Tab")], [#word("Look"), #word("Exec") the selection (like #btn("B3"), #btn("B2"))], + [#key(":")], [to the pane's tag and back], +) +#doc("keys") + +== Keys: panes +#pairs( + [#key("Ctrl-w")], [window mode: #keys("h", "j", "k", "l") move the outline, #key("d") deletes it (then #key("k")/#key("j") between two), #key("c") collapses it, #key("Enter")/#key("Esc") or a pane's letter focuses (not in insert or raw `$`)], + [#key("Esc")], [back to the previous pane (insert: to normal)], + [#key("Shift-Esc")], [back to the previous pane from any mode but raw, where it is the program's Esc; needs the kitty keyboard protocol or the GUI, elsewhere a plain Esc], + [#keys("Ctrl-o", "Ctrl-i")], [jump history back, forward; this file first. #key("Ctrl-i") is #key("Tab") without the kitty protocol: #key("SPC j i")], + [#key("Alt-n")], [new terminal below], + [#key("Alt-c")], [move the pane to a new column], +) + +== The leader: #key("SPC") in normal mode +#pairs(split: 2, + key("SPC ?"), [#word("Help"): every builtin], + key("SPC f s"), word("Save"), + key("SPC f n"), word("New"), + key("SPC f f"), word("Find"), + key("SPC f g"), word("Grep"), + key("SPC f r"), word("Recent"), + key("SPC b b"), word("Panes"), + key("SPC s s"), [declarations], + key("SPC f c"), word("Config"), + key("SPC d"), word("Del"), + key("SPC n t"), word("Tty"), + key("SPC n 9"), word("Tty9p"), + key("SPC w"), word("Window"), + key("SPC j j"), word("Last"), + key("SPC j l"), word("Jumplist"), + key("SPC y"), [clip yank], + key("SPC p"), [clip paste], + key("SPC t t"), word("Themes"), + key("SPC t n"), word("NextColor"), + key("SPC t w"), word("Wrap"), + key("SPC c n"), word("Newcol"), + key("SPC c p"), word("Placement"), + key("SPC s d"), word("Dump"), + key("SPC s r"), word("Restore"), + key("SPC s a"), word("Attach"), + key("SPC s D"), word("Detach"), + key("SPC h t"), word("Tutor"), + key("SPC h m"), word("Messages"), + key("SPC q"), word("Exit"), +) + +== Terminals and commands +- #key("Ctrl-b"): raw (`$`) or normal. #word("Mode") cycles raw, normal, insert. #word("Filter"), #word("Tty+bash"). +- #btn("B2") on a non-builtin line runs it in a *command pane*: #tag("Kill Save Collapse Del", path: "/home/me/src (make) exit 0") +- #word("Kill") `make` stops it; #word("Exit") quits. #word("Repl") `python`: `.py` clicks go to it. + +== Reviewing diffs +`git diff` output is a diff: #btn("B3") on a file line, an `@@` or a line's `+`/`-` jumps there. #doc("tags", section: "reviewing-diffs") + +== Finding things +- A query pane under the pane: line 1 the query, its first word the source: `/pat`, `Find name` (fuzzy), `Grep text` (literal), `Recent`, `Panes`, `Symbols`, `All`. #keys("Ctrl-n", "Ctrl-p") step, #key("Enter") lands and keeps the rows, #key("Esc") puts things back. #word("Help"), #word("Tutor"). + +== Sessions +`pardes --detach=work`; `--attach=work` or #word("Attach") `work`; #word("Detach") leaves it running. #doc("detached") + +== Config +#word("Config") (#key("SPC f c")): `~/.config/pardes/init`, a builtin a line (#word("Theme") `atelier`). #word("DumpConfig"): every setting. #word("Dump") / #word("Restore"): the workspace. #doc("config") + +== Themes +#word("Themes") lists them; #word("Theme") `name`; #word("NextColor"); #word("ThemeFile") `x.zon`. #doc("themes") + +== The virtual filesystem (9P) +Pane shells get `$PARDES_9P` (the socket) and `$PARDES_PANE` (their own pane); a command clicked in a pane also gets `$winid`, the pane it was clicked in. +#cmd("9ns --mntgen # then m=$PARDES_MOUNT in every pane") +#cmd("9p -a \"unix!$PARDES_9P\" read index") +#fstree(``` +index a line per pane @rules +look write: a #word("Look") @look-and-exec +exec write: an #word("Exec") @look-and-exec +log events; follow waits @log +pane/ + new open: a new pane @panes + <n>/ + addr where data reads, writes @addresses + ctl builtins: #word("Save"), #word("Edit") … @panes + body its text (>> appends) @panes + data the text at addr @addresses + look a #word("Look") here @look-and-exec + exec an #word("Exec") here @look-and-exec +```) +#cmd("echo notes.txt:12 > $m/pane/$n/look") +#cmd("echo /foo/ > $m/pane/$n/addr; printf bar > $m/pane/$n/data") +#cmd("echo 'Edit ,x/foo/c/bar/' > $m/pane/$n/ctl") +#cmd("exec 3<>$m/log; echo follow >&3; cat <&3") +`pardes FILE` opens it here; `EDITOR='pardes --wait'`. #doc("fs") + |
