Keys in Zed
In Org files the commands are in the code actions (editor: toggle code
actions, ctrl-. or cmd-.), which list what applies where the cursor is,
and Org's keys run them too once the two files of keys through tasks are
pasted:
- In an Org file: change the TODO state (the next one, the previous one, or one picked from a list), the priority, the timestamp under the cursor; toggle a checkbox; a new heading, item or table row (as M-RET, M-S-RET, C-RET and C-S-RET make them), the cursor then in it; clock in and out; refile; archive; open the agenda (this week, the TODO list, or the agenda menu); capture.
- In a capture buffer: file the entry, give up, or refile it.
Bind editor::ToggleCodeActions to a key of your own if the menu is too far
away.
What a command asks for is asked with buttons: a TODO state, a priority, a
refile target, a capture template, yes or no. Zed has no box of its own
for a server to ask for typed text, so the commands that want a date
(schedule, deadline) or text (a template's %^{…} prompts, a tags search)
say what they ask for and answer with a rename at the cursor: rename at
the cursor (F2) and type the answer (+2d, fri 10:00, a search) for
the new name. Zed sends no empty new name: - alone is the empty answer,
the prompt's default (Insert link (default …), Table size Columns x Rows
(empty for Org's default), today for a date). Until then a rename answers
the question, not renames.
zed.org says how to install and set up the extension.
Keys through tasks#
An extension cannot bind keys, and a key of Zed's cannot run a language server's command, but it can run a task. Two files of the extension set that up, once (and again when they change, after an update):
- tasks.json: a task for each command (Org: … and Org agenda: …).
Paste its entries into your tasks (zed: open tasks,
~/.config/zed/tasks.json). - keymap.json: binds the agenda's keys, and Org's keys in Org files and
capture buffers (
ctrl-c ctrl-t,ctrl-c ctrl-c,ctrl-c ,,alt-enter,ctrl-c a,ctrl-c cand the rest), to those tasks. Paste its blocks into your keymap (zed: open keymap).
The tasks use none of Zed's $ZED_FILE or $ZED_ROW: Zed offers no task that
uses them in a file outside the project, which the agenda and a capture
buffer are. The server follows the cursor itself instead (from the
highlights Zed asks for as it moves), and a task runs its command where the
cursor last was: on the agenda's line in the agenda, at the cursor in an
Org file. A key that means one thing in a capture buffer and another
elsewhere, as ctrl-c ctrl-c files the capture there and toggles a checkbox
or updates a block elsewhere, runs the command of the buffer the cursor is
in.
ctrl-c ctrl-c in a capture buffer files the entry, ctrl-c ctrl-k gives up
and ctrl-c ctrl-w refiles it. Its tab stays open afterwards, as Zed lets
no server close one; close it with ctrl-w and do not save it.
Opening the agenda#
The agenda, the TODO list, the agenda menu and capture need no Org file
open: run them from the task picker (task: spawn, alt-shift-t on Linux;
type Org:) anywhere, or with ctrl-c a and ctrl-c c in an Org file or the
agenda. When no server runs yet, the task opens the Org file you last
opened, in its folder, with Zed's command line (found beside Zed, or zed
or zeditor on PATH; on macOS run cli: install once), which starts one,
and then runs the command there.
The agenda is a file the server writes,
~/.local/state/org-lsp/agenda/…/Agenda.org-agenda (the same one for the
same project folders), opened as Org; the server writes it again when it
changes. It is not read-only, as Zed refuses a rename in a read-only file,
and a rename answers what the agenda's commands ask; text typed in it by
mistake keeps Zed from reading it again (undo it). When Zed starts again with the agenda's tab open, the new server
takes the tab over: it shows the agenda of the current week, and its keys
work.
How the tasks run#
A task's terminal stays out of sight unless the command fails.
The tasks are yours rather than the extension's because Zed offers an
extension's tasks only in files of the project's folders, and the agenda is
a file of the server's own, elsewhere: a key bound to one would open the
task picker instead. Each task runs
~/.local/state/org-lsp/agenda-command, a script the server writes, which
runs the command where the cursor is: the server follows the cursor
through the document highlights Zed asks for when it moves (after
lsp_highlight_debounce, 75 milliseconds). With agendas open in several
windows, the keys act on the one the cursor was last in. The script stays
when Zed quits, so that the tasks can start a server.
On Windows, where the script is agenda-command.cmd under your user folder
and the shell is PowerShell, make each task's command
& "$HOME/.local/state/org-lsp/agenda-command.cmd" org.agenda.later (with
its own command at the end).
The keys#
The agenda has the same keys as in every editor, Emacs's agenda keys, with
J for a date and the views under v (v d, v w), so that Vim mode keeps
its motions.
In the agenda#
| Keys | Command or Zed action | What it does |
|---|---|---|
q | pane::CloseActiveItem | Close the agenda |
enter | editor::GoToDefinition | Go to the entry of the line |
tab | editor::GoToDefinitionSplit | Show the entry of the line in a split |
s, ctrl-x ctrl-s | workspace::SaveAll | |
f | org.agenda.later | Agenda: go forward in time |
b | org.agenda.earlier | Agenda: go backward in time |
. | org.agenda.today | Agenda: go to today |
[ | org.agenda.query.add | Agenda: search for another word, or show inactive timestamps |
] | org.agenda.query.subtract | Agenda: search without a word, or show inactive timestamps |
{ | org.agenda.query.add.regexp | Agenda: search for another regexp, or show inactive timestamps |
} | org.agenda.query.subtract.regexp | Agenda: search without a regexp, or show inactive timestamps |
shift-j | org.agenda.goto.date | Agenda: go to a date |
v d | org.agenda.day | Agenda: day view |
v w | org.agenda.week | Agenda: week view |
v t | org.agenda.fortnight | Agenda: fortnight view |
v m | org.agenda.month | Agenda: month view |
v y | org.agenda.year | Agenda: year view |
r | org.agenda.redo | Agenda: rebuild |
v l | org.agenda.log | Agenda: log mode, what was closed and clocked |
shift-k | org.agenda.habits | Agenda: show or hide habits |
ctrl-x ctrl-w | org.agenda.write | Agenda: write it to a file |
ctrl-c ctrl-x ctrl-c | org.agenda.columns | Agenda: column view |
shift-r, v shift-r | org.agenda.clockreport | Agenda: the clock report |
shift-e, v shift-e | org.agenda.entry.text | Agenda: entry text mode, some text of each entry under its line |
shift-f | org.agenda.follow | Agenda: follow mode, the cursor's entry in another window |
m | org.agenda.bulk.mark | Agenda: mark the entry for a bulk action |
u | org.agenda.bulk.unmark | Agenda: unmark the entry |
shift-u | org.agenda.bulk.unmark.all | Agenda: unmark all entries |
alt-m | org.agenda.bulk.toggle | Agenda: toggle the mark of the entry |
* | org.agenda.bulk.mark.all | Agenda: mark all entries |
alt-* | org.agenda.bulk.toggle.all | Agenda: toggle the marks of all entries |
% | org.agenda.bulk.mark.regexp | Agenda: mark the entries matching a regexp |
shift-b | org.agenda.bulk.action | Agenda: an action on the marked entries |
/ | org.agenda.filter | Agenda: filter by tags, categories, effort and regexps |
\ | org.agenda.filter.tag | Agenda: filter by tag |
< | org.agenda.filter.category | Agenda: filter by the line's category |
= | org.agenda.filter.regexp | Agenda: filter by a regexp |
_ | org.agenda.filter.effort | Agenda: filter by effort |
^ | org.agenda.filter.top.headline | Agenda: filter by the line's top headline |
¦ | org.agenda.filter.remove | Agenda: remove all filters |
v a | org.agenda.archives | Agenda: include archived trees |
v [ | org.agenda.inactive | Agenda: show inactive timestamps once |
v shift-a | org.agenda.archives.files | Agenda: include archived trees and archive files |
shift-i | org.clock.in | Clock in |
shift-o | org.clock.out | Clock out |
shift-x | org.clock.cancel | Cancel the clock |
t | org.todo | Change the TODO state |
ctrl-shift-right | org.todo.nextset | Switch to the next TODO keyword set |
ctrl-shift-left | org.todo.previousset | Switch to the previous TODO keyword set |
+, shift-up | org.priority.up | Raise the priority |
-, shift-down | org.priority.down | Lower the priority |
, | org.priority | Set the priority |
ctrl-c ctrl-x p | org.property.set | Set a property of the entry |
e | org.effort.set | Set the effort of the entry |
:, ctrl-c ctrl-q | org.tags.set | Set the tags of the headline |
ctrl-c ctrl-w | org.refile | Refile the entry |
z | org.add.note | Add a note to the entry |
ctrl-c ctrl-o | org.open | Open the link or thing at the cursor |
ctrl-c l | org.link.store | Store a link to the place at the cursor |
$, ctrl-c ctrl-x ctrl-s, ctrl-c $ | org.archive.subtree | Archive the subtree |
ctrl-c ctrl-x shift-a | org.archive.sibling | Archive the subtree under its Archive sibling |
ctrl-c ctrl-x a | org.archive.tag | Toggle the ARCHIVE tag |
ctrl-c ctrl-x ctrl-a | org.archive.default | Archive with the default command |
a | org.archive.confirm | Archive with the default command, once confirmed |
shift-right | org.date.later | Move the date one day later |
shift-left | org.date.earlier | Move the date one day earlier |
ctrl-c ctrl-s | org.schedule | Schedule the entry |
ctrl-c ctrl-d | org.deadline | Set the deadline of the entry |
ctrl-c a | org.agenda.dispatch | Agenda commands |
ctrl-c c | org.capture | Capture |
ctrl-c n f | org.roam.node.find | Roam: find a node |
ctrl-c n c | org.roam.capture | Roam: capture to a node |
ctrl-c n d n | org.roam.dailies.capture.today | Roam: capture to today's daily note |
ctrl-c n d d | org.roam.dailies.goto.today | Roam: go to today's daily note |
ctrl-c n d t | org.roam.dailies.goto.tomorrow | Roam: go to tomorrow's daily note |
ctrl-c n d y | org.roam.dailies.goto.yesterday | Roam: go to yesterday's daily note |
ctrl-c n d v | org.roam.dailies.capture.date | Roam: capture to the daily note of a date |
ctrl-c n d c | org.roam.dailies.goto.date | Roam: go to the daily note of a date |
ctrl-c n d . | org.roam.dailies.find.directory | Roam: open the directory of the daily notes |
ctrl-c n l | org.roam.buffer.toggle | Roam: show or hide the org-roam buffer |
ctrl-c j j | org.journal.new.entry | Journal: new entry |
¦ stands for |, which an Org table cannot hold.
In Org files#
| Keys | Command or Zed action | What it does |
|---|---|---|
ctrl-c ctrl-c | key:C-c C-c | In a capture buffer: finish; elsewhere: toggle the checkbox |
ctrl-c ctrl-w | key:C-c C-w | Refile the entry |
ctrl-c ctrl-x ctrl-i | org.clock.in | Clock in |
ctrl-c ctrl-x ctrl-x | org.clock.in.last | Clock in the last clocked task |
ctrl-c ctrl-x ctrl-z | org.clock.resolve | Resolve open clocks |
ctrl-c ctrl-x ctrl-o | org.clock.out | Clock out |
ctrl-c ctrl-x ctrl-q | org.clock.cancel | Cancel the clock |
ctrl-c ctrl-x ctrl-j | org.clock.goto | Go to the clocked entry |
ctrl-c ctrl-x ctrl-d | org.clock.display | Show the time clocked under each headline |
ctrl-c ctrl-x ctrl-r | org.clock.report | Insert or update a clock table |
ctrl-c ctrl-x ctrl-u | org.dblock.update | Update the dynamic block |
ctrl-c ctrl-x x | org.dblock.insert | Insert a dynamic block |
ctrl-c ctrl-a | org.attach | Attachments of the entry |
ctrl-c ctrl-t | org.todo | Change the TODO state |
ctrl-c , | org.priority | Set the priority |
ctrl-c ctrl-x p | org.property.set | Set a property of the entry |
ctrl-c ctrl-x e | org.effort.set | Set the effort of the entry |
ctrl-c ctrl-x shift-e | org.effort.increase | Set the effort to the next allowed value |
ctrl-c ctrl-x o | org.ordered.toggle | Toggle whether subtasks must be done in order (ORDERED) |
ctrl-c ctrl-x @ | org.cite.insert | Insert a citation, or edit the one at the cursor |
ctrl-c ctrl-q | org.tags.set | Set the tags of the headline |
alt-enter | org.meta.return | New heading, item or table row |
alt-shift-enter | org.insert.todo.heading | New TODO heading, or item with a checkbox |
ctrl-enter | org.insert.heading.after | New heading after the subtree |
ctrl-shift-enter | org.insert.todo.heading.after | New TODO heading after the subtree |
ctrl-c ctrl-x t | org.inlinetask.insert | Insert an inline task |
ctrl-o | org.open.line | Open a line, or in a table insert a row |
ctrl-c - | org.table.hline | Insert a rule below the table row |
ctrl-c enter | org.table.hline.move | Insert a rule below the table row and go below it |
ctrl-c ^ | org.sort | Sort the entries, the items or the table rows |
ctrl-c / | org.sparse.tree | Show a sparse tree |
ctrl-c ctrl-r | org.reveal | Show the context of the cursor |
ctrl-c ctrl-x ctrl-w | org.cut.subtree | Cut the subtree |
ctrl-c ctrl-x alt-w | org.copy.subtree | Copy the subtree |
ctrl-c ctrl-x ctrl-y | org.paste.subtree | Paste the subtree |
ctrl-c alt-w | org.refile.copy | Copy the entry to a refile target |
ctrl-c ctrl-z | org.add.note | Add a note to the entry |
ctrl-c ctrl-v t, ctrl-c ctrl-v ctrl-t | org.babel.tangle | Tangle the file's code blocks |
ctrl-c ctrl-v e, ctrl-c ctrl-v ctrl-e | org.babel.execute | Evaluate the code block or call at the cursor through Emacs |
ctrl-c ctrl-v b, ctrl-c ctrl-v ctrl-b | org.babel.execute.buffer | Evaluate the file's code blocks through Emacs |
ctrl-c ctrl-v s, ctrl-c ctrl-v ctrl-s | org.babel.execute.subtree | Evaluate the subtree's code blocks through Emacs |
ctrl-c ctrl-v k | org.babel.remove_result | Remove the results of the code block at the cursor |
ctrl-c ctrl-n | org.heading.next | Move to the next heading |
ctrl-c ctrl-p | org.heading.previous | Move to the previous heading |
ctrl-c ctrl-f | org.heading.forward | Move to the next heading of the same level |
ctrl-c ctrl-b | org.heading.backward | Move to the previous heading of the same level |
ctrl-c ctrl-u | org.heading.up | Move to the parent heading |
ctrl-c ctrl-x ctrl-n | org.link.next | Move to the next link |
ctrl-c ctrl-x ctrl-p | org.link.previous | Move to the previous link |
ctrl-c ctrl-j | org.goto | Go to a heading of the file |
ctrl-c ctrl-x f | org.footnote.action | Make a footnote, or go between a footnote and its definition |
ctrl-c ; | org.toggle.comment | Toggle the COMMENT keyword of the heading |
ctrl-c ctrl-x ctrl-f | org.emphasize | Insert emphasis markers |
ctrl-c ctrl-, | org.structure.template | Insert a block (structure template) |
ctrl-c ctrl-x d | org.drawer.insert | Insert a drawer |
ctrl-c ctrl-x c | org.subtree.clone | Clone the subtree, shifting its dates |
ctrl-c + | org.table.sum | Sum the numbers of the table column |
ctrl-c ? | org.table.field.info | Show the references of the table field |
ctrl-c ¦ | org.table.create | Insert an empty table |
ctrl-c " g | org.plot.gnuplot | Plot the table with gnuplot |
ctrl-c " a | org.table.ascii.plot | Draw the column at the cursor as bars |
ctrl-c ctrl-v n, ctrl-c ctrl-v ctrl-n | org.babel.next | Move to the next code block |
ctrl-c ctrl-v p, ctrl-c ctrl-v ctrl-p | org.babel.previous | Move to the previous code block |
ctrl-c ctrl-v g | org.babel.goto | Go to a named code block |
ctrl-c ctrl-v i | org.babel.lob.ingest | Add the file's named code blocks to the Library of Babel |
ctrl-c alt-f | org.block.next | Move to the next block |
ctrl-c alt-b | org.block.previous | Move to the previous block |
ctrl-c ' | org.edit.special | Edit the block in a file of its own |
ctrl-x n s | org.narrow.subtree | Narrow to the subtree: it in a file of its own |
ctrl-x n b | org.narrow.block | Narrow to the block: it in a file of its own |
ctrl-x n w | org.narrow.widen | Widen: the narrowed file written back and closed |
ctrl-c ctrl-x b | org.tree.indirect | Show the subtree in a file of its own |
ctrl-c ` | org.table.edit.field | Edit the table field in a file of its own |
ctrl-c ctrl-x ctrl-c | org.columns | Column view |
ctrl-c ctrl-x ctrl-v | org.link.preview | Preview the images of links |
ctrl-c ctrl-x ctrl-l | org.latex.preview | Preview LaTeX fragments |
ctrl-c ctrl-x 0 | org.timer.start | Start the relative timer |
ctrl-c ctrl-x . | org.timer.insert | Insert the timer's value |
ctrl-c ctrl-x - | org.timer.item | Insert a list item with the timer's value |
ctrl-c ctrl-x , | org.timer.pause | Pause or continue the timer |
ctrl-c ctrl-x _ | org.timer.stop | Stop the timer |
ctrl-c ctrl-x ; | org.timer.set | Set a countdown timer |
ctrl-c ctrl-e | org.export.dispatch | Export the file through Emacs |
ctrl-c tab | org.table.toggle.column.width | Shrink or expand the table column |
ctrl-c * | org.table.recalculate.line | Recalculate the table's current line |
ctrl-c { | org.table.formula.debugger | Turn the formula debugger on or off |
ctrl-c ctrl-o | org.open | Open the link or thing at the cursor |
ctrl-c l | org.link.store | Store a link to the place at the cursor |
ctrl-c ctrl-l | org.link.insert | Insert a link, or edit the one at the cursor |
ctrl-c alt-l | org.link.insert.last | Insert the last stored link |
ctrl-c ctrl-alt-l | org.link.insert.all | Insert all stored links |
ctrl-c ctrl-x ctrl-s, ctrl-c $ | org.archive.subtree | Archive the subtree |
ctrl-c ctrl-x shift-a | org.archive.sibling | Archive the subtree under its Archive sibling |
ctrl-c ctrl-x a | org.archive.tag | Toggle the ARCHIVE tag |
ctrl-c ctrl-x ctrl-a | org.archive.default | Archive with the default command |
ctrl-c n i | org.roam.node.insert | Roam: insert a link to a node |
ctrl-c n d f | org.roam.dailies.goto.next | Roam: go to the next daily note |
ctrl-c n d b | org.roam.dailies.goto.previous | Roam: go to the previous daily note |
ctrl-c j f | org.journal.next.entry | Journal: next entry |
ctrl-c j b | org.journal.previous.entry | Journal: previous entry |
ctrl-c j s | org.journal.search | Journal: search between two dates |
ctrl-c ctrl-k | org.capture.abort | Capture: abort |
ctrl-c ctrl-s | org.schedule | Schedule the entry |
ctrl-c ctrl-d | org.deadline | Set the deadline of the entry |
ctrl-c . | org.timestamp.insert | Insert or change a timestamp |
ctrl-c ! | org.timestamp.insert.inactive | Insert or change an inactive timestamp |
ctrl-c ctrl-x ctrl-t | org.timestamp.overlays.toggle | Show timestamps in the custom formats, or not |
ctrl-c > | org.goto.calendar | Show the calendar at the date of the line |
ctrl-c a | org.agenda.dispatch | Agenda commands |
ctrl-c c | org.capture | Capture |
ctrl-c n f | org.roam.node.find | Roam: find a node |
ctrl-c n c | org.roam.capture | Roam: capture to a node |
ctrl-c n d n | org.roam.dailies.capture.today | Roam: capture to today's daily note |
ctrl-c n d d | org.roam.dailies.goto.today | Roam: go to today's daily note |
ctrl-c n d t | org.roam.dailies.goto.tomorrow | Roam: go to tomorrow's daily note |
ctrl-c n d y | org.roam.dailies.goto.yesterday | Roam: go to yesterday's daily note |
ctrl-c n d v | org.roam.dailies.capture.date | Roam: capture to the daily note of a date |
ctrl-c n d c | org.roam.dailies.goto.date | Roam: go to the daily note of a date |
ctrl-c n d . | org.roam.dailies.find.directory | Roam: open the directory of the daily notes |
ctrl-c n l | org.roam.buffer.toggle | Roam: show or hide the org-roam buffer |
ctrl-c j j | org.journal.new.entry | Journal: new entry |
¦ stands for |, which an Org table cannot hold.