69 lines
2.7 KiB
Markdown
69 lines
2.7 KiB
Markdown
# NotesCraft Vim cheatsheet
|
|
|
|
Vim mode is opt-in: Settings > Editor > Vim, or the command `editor.toggle_vim` (`Space v`). Press `?` anywhere (no text field focused) for the same list inside the app.
|
|
|
|
## Move
|
|
|
|
| Keys | Action |
|
|
|---|---|
|
|
| `h j k l` | left, down, up, right |
|
|
| `w b e` | word forward, back, end |
|
|
| `W B E` | WORD forward, back, end |
|
|
| `0 ^ $` | line start, first character, line end |
|
|
| `gg G` | first, last line |
|
|
| `{ }` | paragraph back, forward |
|
|
| `%` | matching bracket |
|
|
| `f F t T` | to / before a character; `;` repeats, `,` reverses |
|
|
| `H M L` | screen top, middle, bottom |
|
|
| `Ctrl-d Ctrl-u` | half page down, up |
|
|
|
|
## Edit
|
|
|
|
| Keys | Action |
|
|
|---|---|
|
|
| `i a I A` | insert, append, insert at line start, append at line end |
|
|
| `o O` | open a line below, above |
|
|
| `x X` | delete character under, before the cursor |
|
|
| `s S` | substitute character, line |
|
|
| `r R` | replace one character, replace mode |
|
|
| `J` | join lines |
|
|
| `~` | toggle case |
|
|
| `p P` | paste after, before |
|
|
| `.` | repeat the last change |
|
|
| `u Ctrl-r` | undo, redo |
|
|
|
|
## Operators and text objects
|
|
|
|
Operators: `d` delete, `c` change, `y` yank, `>` `<` indent, `g~` toggle case, `gu` lower, `gU` upper. Double the key for the whole line (`dd`, `cc`, `yy`). Combine with a count, a motion or a text object: `iw aw`, `ip ap`, `i( a( i[ a[ i{ a{`, `i" a" i'`. `v` and `V` start a character or line selection, then press an operator.
|
|
|
|
## Registers, marks, search
|
|
|
|
`"a` to `"z` named registers, `"+` the system clipboard, `ma` set mark a, `'a` jump to it. `/` `?` search forward and back, `n` `N` next and previous, `*` the word under the cursor.
|
|
|
|
## Ex line (`:`)
|
|
|
|
`:w` save, `:q` close, `:wq`, `:e name` open a note, `:bn` `:bp` next and previous buffer, `:s/a/b/` and `:%s/a/b/` replace, `:noh` clear highlight, `:set`. Any engine command works by its id, for example `:note.create`.
|
|
|
|
## Markdown
|
|
|
|
`gx` follows the link under the cursor, `gf` opens the `[[wikilink]]`, `za` folds the heading.
|
|
|
|
## App navigation (no text field focused)
|
|
|
|
| Keys | Action |
|
|
|---|---|
|
|
| `j k` | move in lists and trees |
|
|
| `h l` | collapse, expand a folder |
|
|
| `Enter` | open the selected row |
|
|
| `o` | open the selected folder as a folder view |
|
|
| `gt gT` | next, previous tab |
|
|
| `Ctrl-w h` / `Ctrl-w l` | focus the previous, next card |
|
|
| `Space` then `f` `/` `g` `b` `t` `e` `s` `v` | leader: quick switcher, search, source control, buffers, tags, explorer, settings, toggle Vim |
|
|
| `:` | command line at the bottom of the window |
|
|
| `?` | key help card |
|
|
| `Esc` | cancel a pending key, close an overlay |
|
|
|
|
## Folder view
|
|
|
|
`h j k l` move over the cards (`j` `k` step by a whole row in the grid), `gg` `G` jump to the first and last item, `Enter` opens a note or a folder, `-` goes up to the parent folder.
|