on eba0bbd help sign in
helix/book/src/usage.md
42 lines 1.7 kB history raw
1# Usage
3(Currently not fully documented, see the [keymappings](./keymap.md) list for more.)
5## Surround
7Functionality similar to [vim-surround](https://github.com/tpope/vim-surround) is built into
8helix. The keymappings have been inspired from [vim-sandwich](https://github.com/machakann/vim-sandwich):
10![surround demo](https://user-images.githubusercontent.com/23398472/122865801-97073180-d344-11eb-8142-8f43809982c6.gif)
12- `ms` - Add surround characters
13- `mr` - Replace surround characters
14- `md` - Delete surround characters
16`ms` acts on a selection, so select the text first and use `ms<char>`. `mr` and `md` work
17on the closest pairs found and selections are not required; use counts to act in outer pairs.
19It can also act on multiple seletions (yay!). For example, to change every occurance of `(use)` to `[use]`:
21- `%` to select the whole file
22- `s` to split the selections on a search term
23- Input `use` and hit Enter
24- `mr([` to replace the parens with square brackets
26Multiple characters are currently not supported, but planned.
28## Textobjects
30Currently supported: `word`, `surround`.
32![textobject-demo](https://user-images.githubusercontent.com/23398472/124231131-81a4bb00-db2d-11eb-9d10-8e577ca7b177.gif)
34- `ma` - Select around the object (`va` in vim, `<alt-a>` in kakoune)
35- `mi` - Select inside the object (`vi` in vim, `<alt-i>` in kakoune)
37| Key after `mi` or `ma` | Textobject selected |
38| --- | --- |
39| `w` | Word |
40| `(`, `[`, `'`, etc | Specified surround pairs |
42Textobjects based on treesitter, like `function`, `class`, etc are planned.