2021-04-05 15:18:43 +09:00
|
|
|
# Usage
|
2021-06-22 10:36:29 +05:30
|
|
|
|
|
|
|
(Currently not fully documented, see the [keymappings](./keymap.md) list for more.)
|
|
|
|
|
|
|
|
## Surround
|
|
|
|
|
|
|
|
Functionality similar to [vim-surround](https://github.com/tpope/vim-surround) is built into
|
|
|
|
helix. The keymappings have been inspired from [vim-sandwich](https://github.com/machakann/vim-sandwich):
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
- `ms` - Add surround characters
|
|
|
|
- `mr` - Replace surround characters
|
|
|
|
- `md` - Delete surround characters
|
|
|
|
|
|
|
|
`ms` acts on a selection, so select the text first and use `ms<char>`. `mr` and `md` work
|
|
|
|
on the closest pairs found and selections are not required; use counts to act in outer pairs.
|
|
|
|
|
|
|
|
It can also act on multiple seletions (yay!). For example, to change every occurance of `(use)` to `[use]`:
|
|
|
|
|
|
|
|
- `%` to select the whole file
|
|
|
|
- `s` to split the selections on a search term
|
|
|
|
- Input `use` and hit Enter
|
|
|
|
- `mr([` to replace the parens with square brackets
|
|
|
|
|
|
|
|
Multiple characters are currently not supported, but planned.
|
2021-07-03 06:37:49 +05:30
|
|
|
|
|
|
|
## Textobjects
|
|
|
|
|
|
|
|
Currently supported: `word`, `surround`.
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
- `ma` - Select around the object (`va` in vim, `<alt-a>` in kakoune)
|
|
|
|
- `mi` - Select inside the object (`vi` in vim, `<alt-i>` in kakoune)
|
|
|
|
|
|
|
|
| Key after `mi` or `ma` | Textobject selected |
|
|
|
|
| --- | --- |
|
|
|
|
| `w` | Word |
|
|
|
|
| `(`, `[`, `'`, etc | Specified surround pairs |
|
|
|
|
|
|
|
|
Textobjects based on treesitter, like `function`, `class`, etc are planned.
|