mirror of
https://github.com/narrrl/narl-workspace.git
synced 2026-11-03 16:41:27 +01:00
editor: one editor, and everything written saves itself
TextEditor.svelte is folded into Editor.svelte. A card's description and a note in the scratchpad are written in the same editor as a document, with the same `[[` completion, and kept the same way: a new Writing (writing.svelte.ts) stashes each change in localStorage and sends it to the server once the typing stops, retrying a server that cannot be reached and recovering a draft a dead tab left behind. The keys out are the same everywhere: `:w` saves sooner, `:q` or Esc in normal mode leaves with what is waiting written first, and stays where that fails; `:q!` lets go of what is not saved. The store's describing and scratch-editing flags are getters over the one `writing`.
This commit is contained in:
1 parent
b8b3641e6e
commit
ccc91028e7
13 files changed
+426
-360
No files matched your search
@@ -93,9 +93,10 @@ as they do on the board.
|
||||
| `q`, `Esc` | close the back, back to the board |
|
||||
|
||||
The description is markdown, written in the same editor as a document, vim
|
||||
and all: `:w` writes it to the card, `:q` or `Esc` in normal mode leaves, and
|
||||
`:q!` throws away what was not written. Leaving the tile while writing keeps
|
||||
what is written. A fenced block in a language is
|
||||
and all. It saves itself as the typing stops, as a document does; `:q` or `Esc`
|
||||
in normal mode leaves, and `:q!` lets go of what is not saved yet. Leaving the
|
||||
tile while writing keeps what is written. `[[` links a document by its title,
|
||||
and the card then shows among that document's cards. A fenced block in a language is
|
||||
coloured the way nvim colours it, written and read.
|
||||
|
||||
Labels are lower case, and each name keeps its colour on every card and every
|
||||
|
||||
@@ -99,7 +99,7 @@ The first list is the inbox, the last list is done.
|
||||
| `r` | reword the step |
|
||||
| `J / K` | move the step down / up |
|
||||
| `dd` | drop the step |
|
||||
| `e · i · Enter` | write the description, in the editor — :w writes it, :q or Esc in normal mode leaves |
|
||||
| `e · i · Enter` | write the description, in the editor — it saves itself, :q or Esc in normal mode leaves |
|
||||
| `a` | put on a label, or take it off — :label on the line, Tab offers the board's |
|
||||
| `R · D` | rename the card, its due date |
|
||||
| `H / L` | send the card to the list left / right |
|
||||
@@ -209,12 +209,12 @@ do: `:w!`, `:space! <name>`, `:import!`.
|
||||
|
||||
| command | what it does |
|
||||
| --- | --- |
|
||||
| `:write, :w` | save the open document — or the card's description being written |
|
||||
| `:write, :w` | save what is being written — the open document, a card's description, a note — rather than in a moment |
|
||||
| `:write!` | save even over a newer version saved somewhere else since this one was opened |
|
||||
| `:wq, :x` | save and leave insert/editor mode |
|
||||
| `:wq, :x` | leave the editor with everything written, as :q does |
|
||||
| `:wq!` | save over a newer version, as :w! does, and leave the editor |
|
||||
| `:quit, :q` | close the editor, or the document when already reading |
|
||||
| `:quit!` | discard changes and close the editor |
|
||||
| `:quit, :q` | leave the editor with what is waiting written first, or close the document when already reading |
|
||||
| `:quit!` | leave the editor, letting go of what is not saved yet |
|
||||
| `:edit, :e [id]` | edit the open document, or open a node by id |
|
||||
| `:edit!` | throw away the draft and re-read the document from the server |
|
||||
| `:name, :title, :rename <text>` | rename what is under the cursor — document, folder, or card on a board; bare, while writing, into the title |
|
||||
|
||||
+2
-2
@@ -64,8 +64,8 @@ its tiles, so switching away and back finds them as they were. More in
|
||||
### Writing
|
||||
|
||||
`i` edits the open document. The editor is CodeMirror with real vim keys:
|
||||
`ciw`, `dd`, visual mode, macros, `.` and the rest. `Esc` leaves insert mode,
|
||||
and `:q` leaves the editor.
|
||||
`ciw`, `dd`, visual mode, macros, `.` and the rest. What you write saves itself.
|
||||
`Esc` leaves insert mode, and `Esc` again or `:q` leaves the editor.
|
||||
|
||||

|
||||
|
||||
|
||||
+15
-5
@@ -4,7 +4,15 @@
|
||||
|
||||
`i` or `a` on an open document edits it. The editor is CodeMirror 6 with the
|
||||
vim keymap: motions, operators, text objects, visual mode, registers, macros
|
||||
and `.` all work, and `:w`, `:wq` and `:q!` do what they do in vim.
|
||||
and `.` all work. It is the one editor in the app: a card's description and a
|
||||
note in the scratchpad are written in it too, and behave the same way.
|
||||
|
||||
- What is written saves itself (see [Saving](#saving)); `:w` saves sooner.
|
||||
- `:q`, or `Esc` in normal mode, leaves the editor with what is still waiting
|
||||
written first. Where that fails, the text stays on screen. `:wq` is the same.
|
||||
- `:q!` leaves and lets go of what is not saved yet.
|
||||
- `[[` offers the titles of documents as you type, in a description or a note
|
||||
as well as a document.
|
||||
|
||||

|
||||
|
||||
@@ -27,7 +35,9 @@ copies its address.
|
||||
## Saving
|
||||
|
||||
There is nothing to remember. Each change goes to the browser's storage as it is
|
||||
typed, and to the server a couple of seconds after typing stops.
|
||||
typed, and to the server a couple of seconds after typing stops. A card's
|
||||
description and a note are kept the same way, and the first three cases below
|
||||
hold for them too.
|
||||
|
||||
- When the server cannot be reached, the draft stays in the browser and the
|
||||
save is tried again, less often the longer it fails, and at once when the
|
||||
@@ -60,9 +70,9 @@ a body and the time it was last touched, newest on top.
|
||||
| `dd` | drop the note (asks y/N) |
|
||||
| `Q`, `q`, `Esc` | raise the scratchpad |
|
||||
|
||||
A note is written in the same editor as a document, and saves itself a moment
|
||||
after each change: there is nothing to `:w`, though it does no harm. `Esc` in
|
||||
normal mode, or `:q`, goes back to the notes; a note left empty is not kept.
|
||||
A note is written in the same editor as a document, and saves itself the same
|
||||
way. `Esc` in normal mode, or `:q`, goes back to the notes; a note left empty is
|
||||
not kept.
|
||||
`:scratch <text>` takes a note from the command line without lowering the
|
||||
drawer.
|
||||
|
||||
|
||||
Reference in new issue
Block a user