on master help sign in
Add docs for registers, multi key remaps (#557)
commitb59b2485613089595522377c87a392c859ee31a0 authorGokul Soumya <gokulps15@gmail.com> dateWed 18 Aug 2021, 06:23 (5 years ago) parentfdd6530
5 files changed+38−2
book/src/SUMMARY.md+1 book/src/from-vim.md+10 book/src/keymap.md+1 book/src/remapping.md+4−2 book/src/usage.md+22
book/src/SUMMARY.md+1
@@ -2,6 +2,7 @@
22
33- [Installation](./install.md)
44- [Usage](./usage.md)
5+- [Migrating from Vim](./from-vim.md)
56- [Configuration](./configuration.md)
67 - [Themes](./themes.md)
78 - [Keymap](./keymap.md)
book/src/from-vim.mdnew file+10
@@ -0,0 +1,10 @@
1+# Migrating from Vim
2+
3+Helix's editing model is strongly inspired from vim and kakoune, and a notable
4+difference from vim (and the most striking similarity to kakoune) is that Helix
5+follows the `selection → action` model. This means that the whatever you are
6+going to act on (a word, a paragraph, a line, etc) is selected first and the
7+action itself (delete, change, yank, etc) comes second. A cursor is simply a
8+single width selection.
9+
10+> TODO: Mention texobjects, surround, registers
book/src/keymap.md+1
@@ -59,6 +59,7 @@
5959| `y` | Yank selection |
6060| `p` | Paste after selection |
6161| `P` | Paste before selection |
62+| `"` `<reg>` | Select a register to yank to or paste from |
6263| `>` | Indent selection |
6364| `<` | Unindent selection |
6465| `=` | Format selection |
book/src/remapping.md+4−2
@@ -13,10 +13,12 @@ this:
1313[keys.normal]
1414a = "move_char_left" # Maps the 'a' key to the move_char_left command
1515w = "move_line_up" # Maps the 'w' key move_line_up
16−C-S-esc = "extend_line" # Maps Control-Shift-Escape to extend_line
16+"C-S-esc" = "extend_line" # Maps Control-Shift-Escape to extend_line
17+g = { a = "code_action" } # Maps `ga` to show possible code actions
1718
1819[keys.insert]
19−A-x = "normal_mode" # Maps Alt-X to enter normal mode
20+"A-x" = "normal_mode" # Maps Alt-X to enter normal mode
21+j = { k = "normal_mode" } # Maps `jk` to exit insert mode
2022```
2123
2224Control, Shift and Alt modifiers are encoded respectively with the prefixes
book/src/usage.md+22
@@ -2,6 +2,28 @@
22
33(Currently not fully documented, see the [keymappings](./keymap.md) list for more.)
44
5+## Registers
6+
7+Vim-like registers can be used to yank and store text to be pasted later. Usage is similar, with `"` being used to select a register:
8+
9+- `"ay` - Yank the current selection to register `a`.
10+- `"op` - Paste the text in register `o` after the selection.
11+
12+If there is a selected register before invoking a change or delete command, the selection will be stored in the register and the action will be carried out:
13+
14+- `"hc` - Store the selection in register `h` and then change it (delete and enter insert mode).
15+- `"md` - Store the selection in register `m` and delete it.
16+
17+### Special Registers
18+
19+| Register character | Contains |
20+| --- | --- |
21+| `/` | Last search |
22+| `:` | Last executed command |
23+| `"` | Last yanked text |
24+
25+> There is no special register for copying to system clipboard, instead special commands and keybindings are provided. See the [keymap](keymap.md#space-mode) for the specifics.
26+
527## Surround
628
729Functionality similar to [vim-surround](https://github.com/tpope/vim-surround) is built into