3(Currently not fully documented, see the [keymappings](./keymap.md) list for more.)
5See [tutor.txt](https://github.com/helix-editor/helix/blob/master/runtime/tutor.txt) (accessible via `hx --tutor` or `:tutor`) for a vimtutor-like introduction.
9Vim-like registers can be used to yank and store text to be pasted later. Usage is similar, with `"` being used to select a register:
11- `"ay` - Yank the current selection to register `a`.
12- `"op` - Paste the text in register `o` after the selection.
14If 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:
16- `"hc` - Store the selection in register `h` and then change it (delete and enter insert mode).
17- `"md` - Store the selection in register `m` and delete it.
21| Register character | Contains |
24| `:` | Last executed command |
25| `"` | Last yanked text |
28> 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.
29> The black hole register works as a no-op register, meaning no data will be written to / read from it.
33Functionality similar to [vim-surround](https://github.com/tpope/vim-surround) is built into
34helix. The keymappings have been inspired from [vim-sandwich](https://github.com/machakann/vim-sandwich):
36
38- `ms` - Add surround characters
39- `mr` - Replace surround characters
40- `md` - Delete surround characters
42`ms` acts on a selection, so select the text first and use `ms<char>`. `mr` and `md` work
43on the closest pairs found and selections are not required; use counts to act in outer pairs.
45It can also act on multiple selections (yay!). For example, to change every occurrence of `(use)` to `[use]`:
47- `%` to select the whole file
48- `s` to split the selections on a search term
49- Input `use` and hit Enter
50- `mr([` to replace the parens with square brackets
52Multiple characters are currently not supported, but planned.
56`A-p`, `A-o`, `A-i`, and `A-n` (or `Alt` and arrow keys) move the primary
57selection according to the selection's place in the syntax tree. Let's walk
58through an example to get familiar with them. Many languages have a syntax like
65A function call might be parsed by tree-sitter into a tree like the following.
69 function: (identifier) ; func
71 (arguments ; (arg1, arg2, arg3)
77Use `:tree-sitter-subtree` to view the syntax tree of the primary selection. In
78a more intuitive tree format:
85┌─────▼────┐ ┌────▼────┐
86│identifier│ │arguments│
87│ "func" │ ┌────┴───┬─────┴───┐
90 ┌─────────▼┐ ┌────▼─────┐ ┌▼─────────┐
91 │identifier│ │identifier│ │identifier│
92 │ "arg1" │ │ "arg2" │ │ "arg3" │
93 └──────────┘ └──────────┘ └──────────┘
96Say we have a selection that wraps `arg1`. The selection is on the `arg1` leaf
100func([arg1], arg2, arg3)
103Using `A-n` would select the next sibling in the syntax tree: `arg2`.
106func(arg1, [arg2], arg3)
109While `A-o` would expand the selection to the parent node. In the tree above we
110can see that we would select the `arguments` node.
113func[(arg1, arg2, arg3)]
116There is also some nuanced behavior that prevents you from getting stuck on a
117node with no sibling. If we have a selection on `arg1`, `A-p` would bring us
118to the previous child node. Since `arg1` doesn't have a sibling to its left,
119though, we climb the syntax tree and then take the previous selection. So `A-p`
120will move the selection over to the "func" `identifier`.
123[func](arg1, arg2, arg3)
128Currently supported: `word`, `surround`, `function`, `class`, `parameter`.
130
131
133- `ma` - Select around the object (`va` in vim, `<alt-a>` in kakoune)
134- `mi` - Select inside the object (`vi` in vim, `<alt-i>` in kakoune)
136| Key after `mi` or `ma` | Textobject selected |
140| `(`, `[`, `'`, etc | Specified surround pairs |
141| `m` | Closest surround pair |
144| `a` | Argument/parameter |
147> NOTE: `f`, `c`, etc need a tree-sitter grammar active for the current
148document and a special tree-sitter query file to work properly. [Only
149some grammars][lang-support] currently have the query file implemented.
150Contributions are welcome!
152## Tree-sitter Textobject Based Navigation
154Navigating between functions, classes, parameters, etc is made
155possible by leveraging tree-sitter and textobjects queries. For
156example to move to the next function use `]f`, to move to previous
157class use `[c`, and so on.
159![tree-sitter-nav-demo][tree-sitter-nav-demo]
161See the [unimpaired][unimpaired-keybinds] section of the keybind
162documentation for the full reference.
164> NOTE: This feature is dependent on tree-sitter based textobjects
165and therefore requires the corresponding query file to work properly.
167[lang-support]: ./lang-support.md
168[unimpaired-keybinds]: ./keymap.md#unimpaired
169[tree-sitter-nav-demo]: https://user-images.githubusercontent.com/23398472/152332550-7dfff043-36a2-4aec-b8f2-77c13eb56d6f.gif
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list