on master help sign in
Add docs for registers, multi key remaps (#557)
b59b248Gokul Soumya
book/src/SUMMARY.md+1
@@ -2,6 +2,7 @@
2
2
3- [Installation](./install.md)
3- [Installation](./install.md)
4- [Usage](./usage.md)
4- [Usage](./usage.md)
5+- [Migrating from Vim](./from-vim.md)
5- [Configuration](./configuration.md)
6- [Configuration](./configuration.md)
6 - [Themes](./themes.md)
7 - [Themes](./themes.md)
7 - [Keymap](./keymap.md)
8 - [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 @@
59| `y` | Yank selection |
59| `y` | Yank selection |
60| `p` | Paste after selection |
60| `p` | Paste after selection |
61| `P` | Paste before selection |
61| `P` | Paste before selection |
62+| `"` `<reg>` | Select a register to yank to or paste from |
62| `>` | Indent selection |
63| `>` | Indent selection |
63| `<` | Unindent selection |
64| `<` | Unindent selection |
64| `=` | Format selection |
65| `=` | Format selection |
book/src/remapping.md+4−2
@@ -13,10 +13,12 @@ this:
13[keys.normal]
13[keys.normal]
14a = "move_char_left" # Maps the 'a' key to the move_char_left command
14a = "move_char_left" # Maps the 'a' key to the move_char_left command
15w = "move_line_up" # Maps the 'w' key move_line_up
15w = "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
17
18
18[keys.insert]
19[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
20```
22```
21
23
22Control, Shift and Alt modifiers are encoded respectively with the prefixes
24Control, Shift and Alt modifiers are encoded respectively with the prefixes
book/src/usage.md+22
@@ -2,6 +2,28 @@
2
2
3(Currently not fully documented, see the [keymappings](./keymap.md) list for more.)
3(Currently not fully documented, see the [keymappings](./keymap.md) list for more.)
4
4
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+
5## Surround
27## Surround
6
28
7Functionality similar to [vim-surround](https://github.com/tpope/vim-surround) is built into
29Functionality similar to [vim-surround](https://github.com/tpope/vim-surround) is built into