You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
helix/book/src/usage.md

193 lines
7.9 KiB
Markdown

Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
# Using Helix
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
<!--toc:start-->
- [Registers](#registers)
- [User-defined registers](#user-defined-registers)
- [Special registers](#special-registers)
- [Surround](#surround)
- [Selecting and manipulating text with textobjects](#selecting-and-manipulating-text-with-textobjects)
- [Navigating using tree-sitter textobjects](#navigating-using-tree-sitter-textobjects)
- [Moving the selection with syntax-aware motions](#moving-the-selection-with-syntax-aware-motions)
<!--toc:end-->
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
For a full interactive introduction to Helix, refer to the
[tutor](https://github.com/helix-editor/helix/blob/master/runtime/tutor) which
can be accessed via the command `hx --tutor` or `:tutor`.
> 💡 Currently, not all functionality is fully documented, please refer to the
> [key mappings](./keymap.md) list.
## Registers
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
In Helix, registers are storage locations for text and other data, such as the
result of a search. Registers can be used to cut, copy, and paste text, similar
to the clipboard in other text editors. Usage is similar to Vim, with `"` being
used to select a register.
### User-defined registers
Helix allows you to create your own named registers for storing text, for
example:
- `"ay` - Yank the current selection to register `a`.
- `"op` - Paste the text in register `o` after the selection.
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
If a register is selected 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.
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
### Special registers
| Register character | Contains |
| --- | --- |
| `/` | Last search |
| `:` | Last executed command |
| `"` | Last yanked text |
| `_` | Black hole |
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
The system clipboard is not directly supported by a special register. Instead, special commands and keybindings are provided. Refer to the
[key map](keymap.md#space-mode) for more details.
The black hole register is a no-op register, meaning that no data will be read or written to it.
## Surround
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
Helix includes built-in functionality similar to [vim-surround](https://github.com/tpope/vim-surround).
The keymappings have been inspired from [vim-sandwich](https://github.com/machakann/vim-sandwich):
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
![Surround demo](https://user-images.githubusercontent.com/23398472/122865801-97073180-d344-11eb-8142-8f43809982c6.gif)
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
| Key Sequence | Action |
| --------------------------------- | --------------------------------------- |
| `ms<char>` (after selecting text) | Add surround characters to selection |
| `mr<char_to_replace><new_char>` | Replace the closest surround characters |
| `md<char_to_delete>` | Delete the closest surround characters |
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
You can use counts to act on outer pairs.
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
Surround can also act on multiple selections. For example, to change every occurrence of `(use)` to `[use]`:
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
1. `%` to select the whole file
2. `s` to split the selections on a search term
3. Input `use` and hit Enter
4. `mr([` to replace the parentheses with square brackets
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
Multiple characters are currently not supported, but planned for future release.
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
## Selecting and manipulating text with textobjects
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
In Helix, textobjects are a way to select, manipulate and operate on a piece of
text in a structured way. They allow you to refer to blocks of text based on
their structure or purpose, such as a word, sentence, paragraph, or even a
function or block of code.
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
![Textobject demo](https://user-images.githubusercontent.com/23398472/124231131-81a4bb00-db2d-11eb-9d10-8e577ca7b177.gif)
![Textobject tree-sitter demo](https://user-images.githubusercontent.com/23398472/132537398-2a2e0a54-582b-44ab-a77f-eb818942203d.gif)
- `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 |
| `W` | WORD |
| `p` | Paragraph |
| `(`, `[`, `'`, etc. | Specified surround pairs |
| `m` | The closest surround pair |
| `f` | Function |
| `t` | Type (or Class) |
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
| `a` | Argument/parameter |
| `c` | Comment |
| `T` | Test |
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
| `g` | Change |
> 💡 `f`, `t`, etc. need a tree-sitter grammar active for the current
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
document and a special tree-sitter query file to work properly. [Only
some grammars][lang-support] currently have the query file implemented.
Contributions are welcome!
## Navigating using tree-sitter textobjects
Navigating between functions, classes, parameters, and other elements is
possible using tree-sitter and textobject queries. For
example to move to the next function use `]f`, to move to previous
type use `[t`, and so on.
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
![Tree-sitter-nav-demo][tree-sitter-nav-demo]
For the full reference see the [unimpaired][unimpaired-keybinds] section of the key bind
documentation.
> 💡 This feature relies on tree-sitter textobjects
> and requires the corresponding query file to work properly.
## Moving the selection with syntax-aware motions
`Alt-p`, `Alt-o`, `Alt-i`, and `Alt-n` (or `Alt` and arrow keys) allow you to move the
selection according to its location in the syntax tree. For example, many languages have the
following syntax for function calls:
```js
func(arg1, arg2, arg3);
```
A function call might be parsed by tree-sitter into a tree like the following.
```tsq
(call
function: (identifier) ; func
arguments:
(arguments ; (arg1, arg2, arg3)
(identifier) ; arg1
(identifier) ; arg2
(identifier))) ; arg3
```
Use `:tree-sitter-subtree` to view the syntax tree of the primary selection. In
a more intuitive tree format:
```
┌────┐
│call│
┌─────┴────┴─────┐
│ │
┌─────▼────┐ ┌────▼────┐
│identifier│ │arguments│
│ "func" │ ┌────┴───┬─────┴───┐
└──────────┘ │ │ │
│ │ │
┌─────────▼┐ ┌────▼─────┐ ┌▼─────────┐
│identifier│ │identifier│ │identifier│
│ "arg1" │ │ "arg2" │ │ "arg3" │
└──────────┘ └──────────┘ └──────────┘
```
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
If you have a selection that wraps `arg1` (see the tree above), and you use
`Alt-n`, it will select the next sibling in the syntax tree: `arg2`.
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
```js
// before
func([arg1], arg2, arg3)
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
// after
func(arg1, [arg2], arg3);
```
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
Similarly, `Alt-o` will expand the selection to the parent node, in this case, the
arguments node.
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
```js
func[(arg1, arg2, arg3)];
```
There is also some nuanced behavior that prevents you from getting stuck on a
Rewrite and refactor all documentation (#5534) * Rewrite and refactor all documentation * Rewrite and refactor the guides * update runtime directory instructions for windows * Update the Ubuntu 3rd party repo section with 22.10 * Merge from upstream * Rewrite and refactor all documentation * Apply suggestions from code review Apply the suggestions that can be committed from the GitHub web interface. Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Add Windows themes folder Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com> * Apply the rest of the suggestions from the code review * Revert "Apply the rest of the suggestions from the code review" This reverts commit 498be1b7a1aec3ff567b95130148628beeef9b77. * Revert "Merge branch 'rewrite-and-refactor-all-documentation' of github.com:David-Else/helix into rewrite-and-refactor-all-documentation" This reverts commit 7c8404248ffef73b80b9051d5a4359c5bcfa5d1a, reversing changes made to d932969cfc9fadda12a74cc01665919dee7152fb. * Apply code review suggestions * Changes after re-reading all documents * Missed a full stop * Code review suggestions and remove macOS and Windows specific sections * Add OpenBSD to heading * Add back macOS and Windows sections and further simplify and improve * Change wording to nightly * Remove README installation section and turn into a link * Simplify building from source and follow code review suggestions * Code review revisions * Fix copy paste mistake * Apply the latest code review suggestions * More small code review items * Change minor modes for code review * Fix link and typos * Add note that you need a c++ compiler to install the tree-sitter grammars * Add pacman example * Make sure all headings are lower case * Revert to the original passage adding a reference to Windows that was missing * Update book/src/guides/adding_languages.md Fix grammar typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update book/src/install.md Fix tree sitter typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove TOC links to main heading --------- Co-authored-by: CptPotato <3957610+CptPotato@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: digidoor <37601466+digidoor@users.noreply.github.com>
1 year ago
node with no sibling. When using `Alt-p` with a selection on `arg1`, the previous
child node will be selected. In the event that `arg1` does not have a previous
sibling, the selection will move up the syntax tree and select the previous
element. As a result, using `Alt-p` with a selection on `arg1` will move the
selection to the "func" `identifier`.
[lang-support]: ./lang-support.md
[unimpaired-keybinds]: ./keymap.md#unimpaired
[tree-sitter-nav-demo]: https://user-images.githubusercontent.com/23398472/152332550-7dfff043-36a2-4aec-b8f2-77c13eb56d6f.gif