mirror of
https://github.com/helix-editor/helix.git
synced 2025-01-19 13:37:06 +04:00
Add docs for registers, multi key remaps (#557)
This commit is contained in:
parent
fdd6530df7
commit
b59b248561
@ -2,6 +2,7 @@ # Summary
|
|||||||
|
|
||||||
- [Installation](./install.md)
|
- [Installation](./install.md)
|
||||||
- [Usage](./usage.md)
|
- [Usage](./usage.md)
|
||||||
|
- [Migrating from Vim](./from-vim.md)
|
||||||
- [Configuration](./configuration.md)
|
- [Configuration](./configuration.md)
|
||||||
- [Themes](./themes.md)
|
- [Themes](./themes.md)
|
||||||
- [Keymap](./keymap.md)
|
- [Keymap](./keymap.md)
|
||||||
|
10
book/src/from-vim.md
Normal file
10
book/src/from-vim.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Migrating from Vim
|
||||||
|
|
||||||
|
Helix's editing model is strongly inspired from vim and kakoune, and a notable
|
||||||
|
difference from vim (and the most striking similarity to kakoune) is that Helix
|
||||||
|
follows the `selection → action` model. This means that the whatever you are
|
||||||
|
going to act on (a word, a paragraph, a line, etc) is selected first and the
|
||||||
|
action itself (delete, change, yank, etc) comes second. A cursor is simply a
|
||||||
|
single width selection.
|
||||||
|
|
||||||
|
> TODO: Mention texobjects, surround, registers
|
@ -59,6 +59,7 @@ ### Changes
|
|||||||
| `y` | Yank selection |
|
| `y` | Yank selection |
|
||||||
| `p` | Paste after selection |
|
| `p` | Paste after selection |
|
||||||
| `P` | Paste before selection |
|
| `P` | Paste before selection |
|
||||||
|
| `"` `<reg>` | Select a register to yank to or paste from |
|
||||||
| `>` | Indent selection |
|
| `>` | Indent selection |
|
||||||
| `<` | Unindent selection |
|
| `<` | Unindent selection |
|
||||||
| `=` | Format selection |
|
| `=` | Format selection |
|
||||||
|
@ -13,10 +13,12 @@ # At most one section each of 'keys.normal', 'keys.insert' and 'keys.select'
|
|||||||
[keys.normal]
|
[keys.normal]
|
||||||
a = "move_char_left" # Maps the 'a' key to the move_char_left command
|
a = "move_char_left" # Maps the 'a' key to the move_char_left command
|
||||||
w = "move_line_up" # Maps the 'w' key move_line_up
|
w = "move_line_up" # Maps the 'w' key move_line_up
|
||||||
C-S-esc = "extend_line" # Maps Control-Shift-Escape to extend_line
|
"C-S-esc" = "extend_line" # Maps Control-Shift-Escape to extend_line
|
||||||
|
g = { a = "code_action" } # Maps `ga` to show possible code actions
|
||||||
|
|
||||||
[keys.insert]
|
[keys.insert]
|
||||||
A-x = "normal_mode" # Maps Alt-X to enter normal mode
|
"A-x" = "normal_mode" # Maps Alt-X to enter normal mode
|
||||||
|
j = { k = "normal_mode" } # Maps `jk` to exit insert mode
|
||||||
```
|
```
|
||||||
|
|
||||||
Control, Shift and Alt modifiers are encoded respectively with the prefixes
|
Control, Shift and Alt modifiers are encoded respectively with the prefixes
|
||||||
|
@ -2,6 +2,28 @@ # Usage
|
|||||||
|
|
||||||
(Currently not fully documented, see the [keymappings](./keymap.md) list for more.)
|
(Currently not fully documented, see the [keymappings](./keymap.md) list for more.)
|
||||||
|
|
||||||
|
## Registers
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
- `"ay` - Yank the current selection to register `a`.
|
||||||
|
- `"op` - Paste the text in register `o` after the selection.
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
- `"hc` - Store the selection in register `h` and then change it (delete and enter insert mode).
|
||||||
|
- `"md` - Store the selection in register `m` and delete it.
|
||||||
|
|
||||||
|
### Special Registers
|
||||||
|
|
||||||
|
| Register character | Contains |
|
||||||
|
| --- | --- |
|
||||||
|
| `/` | Last search |
|
||||||
|
| `:` | Last executed command |
|
||||||
|
| `"` | Last yanked text |
|
||||||
|
|
||||||
|
> 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.
|
||||||
|
|
||||||
## Surround
|
## Surround
|
||||||
|
|
||||||
Functionality similar to [vim-surround](https://github.com/tpope/vim-surround) is built into
|
Functionality similar to [vim-surround](https://github.com/tpope/vim-surround) is built into
|
||||||
|
Loading…
Reference in New Issue
Block a user