on master help sign in
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>

commit707457c632e3b79f71d6b7ad2f62716e98080af2 authorDavid Else <12832280+David-Else@users.noreply.github.com> dateMon 6 Mar 2023, 09:27 (4 years ago) parent5ebe101
15 files changed+465−471
README.md+1−83 book/src/SUMMARY.md+5−5 book/src/commands.md+1−1 book/src/configuration.md+43−46 book/src/guides/README.md+1−1 book/src/guides/adding_languages.md+42−35 book/src/guides/indent.md+2−2 book/src/guides/textobject.md+7−9 book/src/install.md+152−109 book/src/keymap.md+20−20 book/src/lang-support.md+2−2 book/src/languages.md+13−11 book/src/remapping.md+9−10 book/src/themes.md+53−45 book/src/usage.md+114−92
README.md+1−83
@@ -45,92 +45,10 @@ Note: Only certain languages have indentation definitions at the moment. Check
4545
4646# Installation
4747
48−Packages are available for various distributions (see [Installation docs](https://docs.helix-editor.com/install.html)).
49−
50−If you would like to build from source:
51−
52−```shell
53−git clone https://github.com/helix-editor/helix
54−cd helix
55−cargo install --locked --path helix-term
56−```
57−
58−This will install the `hx` binary to `$HOME/.cargo/bin` and build tree-sitter grammars in `./runtime/grammars`.
59−
60−Helix needs its runtime files so make sure to copy/symlink the `runtime/` directory into the
61−config directory (for example `~/.config/helix/runtime` on Linux/macOS, or `%AppData%/helix/runtime` on Windows).
62−
63−| OS | Command |
64−| -------------------- | ------------------------------------------------ |
65−| Windows (Cmd) | `xcopy /e /i runtime %AppData%\helix\runtime` |
66−| Windows (PowerShell) | `xcopy /e /i runtime $Env:AppData\helix\runtime` |
67−| Linux / macOS | `ln -s $PWD/runtime ~/.config/helix/runtime` |
68−
69−Starting with Windows Vista you can also create symbolic links on Windows. Note that this requires
70−elevated privileges - i.e. PowerShell or Cmd must be run as administrator.
71−
72−**PowerShell:**
73−
74−```powershell
75−New-Item -ItemType Junction -Target "runtime" -Path "$Env:AppData\helix\runtime"
76−```
77−Note: "runtime" must be absolute path to the runtime directory.
78−
79−**Cmd:**
80−
81−```cmd
82−cd %appdata%\helix
83−mklink /D runtime "<helix-repo>\runtime"
84−```
85−
86−The runtime location can be overridden via the `HELIX_RUNTIME` environment variable.
87−
88−> NOTE: if `HELIX_RUNTIME` is set prior to calling `cargo install --locked --path helix-term`,
89−> tree-sitter grammars will be built in `$HELIX_RUNTIME/grammars`.
90−
91−If you plan on keeping the repo locally, an alternative to copying/symlinking
92−runtime files is to set `HELIX_RUNTIME=/path/to/helix/runtime`
93−(`HELIX_RUNTIME=$PWD/runtime` if you're in the helix repo directory).
94−
95−Packages already solve this for you by wrapping the `hx` binary with a wrapper
96−that sets the variable to the install dir.
97−
98−> NOTE: running via cargo also doesn't require setting explicit `HELIX_RUNTIME` path, it will automatically
99−> detect the `runtime` directory in the project root.
100−
101−If you want to customize your `languages.toml` config,
102−tree-sitter grammars may be manually fetched and built with `hx --grammar fetch` and `hx --grammar build`.
103−
104−In order to use LSP features like auto-complete, you will need to
105−[install the appropriate Language Server](https://github.com/helix-editor/helix/wiki/How-to-install-the-default-language-servers)
106−for a language.
48+[Installation documentation](https://docs.helix-editor.com/install.html).
10749
10850[![Packaging status](https://repology.org/badge/vertical-allrepos/helix.svg)](https://repology.org/project/helix/versions)
10951
110−## Adding Helix to your desktop environment
111−
112−If installing from source, to use Helix in desktop environments that supports [XDG desktop menu](https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html), including Gnome and KDE, copy the provided `.desktop` file to the correct folder:
113−
114−```bash
115−cp contrib/Helix.desktop ~/.local/share/applications
116−cp contrib/helix.png ~/.local/share/icons
117−```
118−
119−To use another terminal than the default, you will need to modify the `.desktop` file. For example, to use `kitty`:
120−
121−```bash
122−sed -i "s|Exec=hx %F|Exec=kitty hx %F|g" ~/.local/share/applications/Helix.desktop
123−sed -i "s|Terminal=true|Terminal=false|g" ~/.local/share/applications/Helix.desktop
124−```
125−
126−## macOS
127−
128−Helix can be installed on macOS through homebrew:
129−
130−```
131−brew install helix
132−```
133−
13452# Contributing
13553
13654Contributing guidelines can be found [here](./docs/CONTRIBUTING.md).
book/src/SUMMARY.md+5−5
@@ -6,13 +6,13 @@
66- [Usage](./usage.md)
77 - [Keymap](./keymap.md)
88 - [Commands](./commands.md)
9− - [Language Support](./lang-support.md)
9+ - [Language support](./lang-support.md)
1010- [Migrating from Vim](./from-vim.md)
1111- [Configuration](./configuration.md)
1212 - [Themes](./themes.md)
13− - [Key Remapping](./remapping.md)
13+ - [Key remapping](./remapping.md)
1414 - [Languages](./languages.md)
1515- [Guides](./guides/README.md)
16− - [Adding Languages](./guides/adding_languages.md)
17− - [Adding Textobject Queries](./guides/textobject.md)
18− - [Adding Indent Queries](./guides/indent.md)
16+ - [Adding languages](./guides/adding_languages.md)
17+ - [Adding textobject queries](./guides/textobject.md)
18+ - [Adding indent queries](./guides/indent.md)
book/src/commands.md+1−1
@@ -1,5 +1,5 @@
11# Commands
22
3−Command mode can be activated by pressing `:`, similar to Vim. Built-in commands:
3+Command mode can be activated by pressing `:`. The built-in commands are:
44
55{{#include ./generated/typable-cmd.md}}
book/src/configuration.md+43−46
@@ -2,10 +2,10 @@
22
33To override global configuration parameters, create a `config.toml` file located in your config directory:
44
5−* Linux and Mac: `~/.config/helix/config.toml`
6−* Windows: `%AppData%\helix\config.toml`
5+- Linux and Mac: `~/.config/helix/config.toml`
6+- Windows: `%AppData%\helix\config.toml`
77
8−> Hint: You can easily open the config file by typing `:config-open` within Helix normal mode.
8+> 💡 You can easily open the config file by typing `:config-open` within Helix normal mode.
99
1010Example config:
1111
@@ -25,12 +25,10 @@ select = "underline"
2525hidden = false
2626```
2727
28−You may also specify a file to use for configuration with the `-c` or
29−`--config` CLI argument: `hx -c path/to/custom-config.toml`.
30−
31−It is also possible to trigger configuration file reloading by sending the `USR1`
32−signal to the helix process, e.g. via `pkill -USR1 hx`. This is only supported
33−on unix operating systems.
28+You can use a custom configuration file by specifying it with the `-c` or
29+`--config` command line argument, for example `hx -c path/to/custom-config.toml`.
30+Additionally, you can reload the configuration file by sending the USR1
31+signal to the Helix process on Unix operating systems, such as by using the command `pkill -USR1 hx`.
3432
3533## Editor
3634
@@ -38,23 +36,23 @@ on unix operating systems.
3836
3937| Key | Description | Default |
4038|--|--|---------|
41−| `scrolloff` | Number of lines of padding around the edge of the screen when scrolling. | `5` |
42−| `mouse` | Enable mouse mode. | `true` |
43−| `middle-click-paste` | Middle click paste support. | `true` |
44−| `scroll-lines` | Number of lines to scroll per scroll wheel step. | `3` |
45−| `shell` | Shell to use when running external commands. | Unix: `["sh", "-c"]`<br/>Windows: `["cmd", "/C"]` |
46−| `line-number` | Line number display: `absolute` simply shows each line's number, while `relative` shows the distance from the current line. When unfocused or in insert mode, `relative` will still show absolute line numbers. | `absolute` |
47−| `cursorline` | Highlight all lines with a cursor. | `false` |
48−| `cursorcolumn` | Highlight all columns with a cursor. | `false` |
39+| `scrolloff` | Number of lines of padding around the edge of the screen when scrolling | `5` |
40+| `mouse` | Enable mouse mode | `true` |
41+| `middle-click-paste` | Middle click paste support | `true` |
42+| `scroll-lines` | Number of lines to scroll per scroll wheel step | `3` |
43+| `shell` | Shell to use when running external commands | Unix: `["sh", "-c"]`<br/>Windows: `["cmd", "/C"]` |
44+| `line-number` | Line number display: `absolute` simply shows each line's number, while `relative` shows the distance from the current line. When unfocused or in insert mode, `relative` will still show absolute line numbers | `absolute` |
45+| `cursorline` | Highlight all lines with a cursor | `false` |
46+| `cursorcolumn` | Highlight all columns with a cursor | `false` |
4947| `gutters` | Gutters to display: Available are `diagnostics` and `diff` and `line-numbers` and `spacer`, note that `diagnostics` also includes other features like breakpoints, 1-width padding will be inserted if gutters is non-empty | `["diagnostics", "spacer", "line-numbers", "spacer", "diff"]` |
50−| `auto-completion` | Enable automatic pop up of auto-completion. | `true` |
51−| `auto-format` | Enable automatic formatting on save. | `true` |
52−| `auto-save` | Enable automatic saving on focus moving away from Helix. Requires [focus event support](https://github.com/helix-editor/helix/wiki/Terminal-Support) from your terminal. | `false` |
53−| `idle-timeout` | Time in milliseconds since last keypress before idle timers trigger. Used for autocompletion, set to 0 for instant. | `400` |
48+| `auto-completion` | Enable automatic pop up of auto-completion | `true` |
49+| `auto-format` | Enable automatic formatting on save | `true` |
50+| `auto-save` | Enable automatic saving on the focus moving away from Helix. Requires [focus event support](https://github.com/helix-editor/helix/wiki/Terminal-Support) from your terminal | `false` |
51+| `idle-timeout` | Time in milliseconds since last keypress before idle timers trigger. Used for autocompletion, set to 0 for instant | `400` |
5452| `completion-trigger-len` | The min-length of word under cursor to trigger autocompletion | `2` |
55−| `auto-info` | Whether to display infoboxes | `true` |
56−| `true-color` | Set to `true` to override automatic detection of terminal truecolor support in the event of a false negative. | `false` |
57−| `rulers` | List of column positions at which to display the rulers. Can be overridden by language specific `rulers` in `languages.toml` file. | `[]` |
53+| `auto-info` | Whether to display info boxes | `true` |
54+| `true-color` | Set to `true` to override automatic detection of terminal truecolor support in the event of a false negative | `false` |
55+| `rulers` | List of column positions at which to display the rulers. Can be overridden by language specific `rulers` in `languages.toml` file | `[]` |
5856| `bufferline` | Renders a line at the top of the editor displaying open buffers. Can be `always`, `never` or `multiple` (only shown if more than one buffer is in use) | `never` |
5957| `color-modes` | Whether to color the mode indicator with different colors depending on the mode itself | `false` |
6058
@@ -125,10 +123,12 @@ The following statusline elements can be configured:
125123
126124### `[editor.cursor-shape]` Section
127125
128−Defines the shape of cursor in each mode. Note that due to limitations
129−of the terminal environment, only the primary cursor can change shape.
126+Defines the shape of cursor in each mode.
130127Valid values for these options are `block`, `bar`, `underline`, or `hidden`.
131128
129+> 💡 Due to limitations of the terminal environment, only the primary cursor can
130+> change shape.
131+
132132| Key | Description | Default |
133133| --- | ----------- | ------- |
134134| `normal` | Cursor shape in [normal mode][normal mode] | `block` |
@@ -141,25 +141,22 @@ Valid values for these options are `block`, `bar`, `underline`, or `hidden`.
141141
142142### `[editor.file-picker]` Section
143143
144−Sets options for file picker and global search. All but the last key listed in
145−the default file-picker configuration below are IgnoreOptions: whether hidden
146−files and files listed within ignore files are ignored by (not visible in) the
147−helix file picker and global search. There is also one other key, `max-depth`
148−available, which is not defined by default.
144+Set options for file picker and global search. Ignoring a file means it is
145+not visible in the Helix file picker and global search.
149146
150147All git related options are only enabled in a git repository.
151148
152149| Key | Description | Default |
153150|--|--|---------|
154−|`hidden` | Enables ignoring hidden files. | true
151+|`hidden` | Enables ignoring hidden files | true
155152|`follow-links` | Follow symlinks instead of ignoring them | true
156153|`deduplicate-links` | Ignore symlinks that point at files already shown in the picker | true
157−|`parents` | Enables reading ignore files from parent directories. | true
158−|`ignore` | Enables reading `.ignore` files. | true
159−|`git-ignore` | Enables reading `.gitignore` files. | true
160−|`git-global` | Enables reading global .gitignore, whose path is specified in git's config: `core.excludefile` option. | true
161−|`git-exclude` | Enables reading `.git/info/exclude` files. | true
162−|`max-depth` | Set with an integer value for maximum depth to recurse. | Defaults to `None`.
154+|`parents` | Enables reading ignore files from parent directories | true
155+|`ignore` | Enables reading `.ignore` files | true
156+|`git-ignore` | Enables reading `.gitignore` files | true
157+|`git-global` | Enables reading global `.gitignore`, whose path is specified in git's config: `core.excludefile` option | true
158+|`git-exclude` | Enables reading `.git/info/exclude` files | true
159+|`max-depth` | Set with an integer value for maximum depth to recurse | Defaults to `None`.
163160
164161### `[editor.auto-pairs]` Section
165162
@@ -211,7 +208,7 @@ Search specific options.
211208
212209| Key | Description | Default |
213210|--|--|---------|
214−| `smart-case` | Enable smart case regex searching (case insensitive unless pattern contains upper case characters) | `true` |
211+| `smart-case` | Enable smart case regex searching (case-insensitive unless pattern contains upper case characters) | `true` |
215212| `wrap-around`| Whether the search should wrap after depleting the matches | `true` |
216213
217214### `[editor.whitespace]` Section
@@ -220,7 +217,7 @@ Options for rendering whitespace with visible characters. Use `:set whitespace.r
220217
221218| Key | Description | Default |
222219|-----|-------------|---------|
223−| `render` | Whether to render whitespace. May either be `"all"` or `"none"`, or a table with sub-keys `space`, `nbsp`, `tab`, and `newline`. | `"none"` |
220+| `render` | Whether to render whitespace. May either be `"all"` or `"none"`, or a table with sub-keys `space`, `nbsp`, `tab`, and `newline` | `"none"` |
224221| `characters` | Literal characters to use when rendering whitespace. Sub-keys may be any of `tab`, `space`, `nbsp`, `newline` or `tabpad` | See example below |
225222
226223Example
@@ -248,7 +245,7 @@ Options for rendering vertical indent guides.
248245
249246| Key | Description | Default |
250247| --- | --- | --- |
251−| `render` | Whether to render indent guides. | `false` |
248+| `render` | Whether to render indent guides | `false` |
252249| `character` | Literal character to use for rendering the indent guide | `│` |
253250| `skip-levels` | Number of indent levels to skip | `0` |
254251
@@ -273,7 +270,7 @@ gutters = ["diff", "diagnostics", "line-numbers", "spacer"]
273270
274271To customize the behavior of gutters, the `[editor.gutters]` section must
275272be used. This section contains top level settings, as well as settings for
276−specific gutter components as sub-sections.
273+specific gutter components as subsections.
277274
278275| Key | Description | Default |
279276| --- | --- | --- |
@@ -315,13 +312,13 @@ Currently unused
315312
316313### `[editor.soft-wrap]` Section
317314
318−Options for soft wrapping lines that exceed the view width
315+Options for soft wrapping lines that exceed the view width:
319316
320317| Key | Description | Default |
321318| --- | --- | --- |
322−| `enable` | Whether soft wrapping is enabled. | `false` |
323−| `max-wrap` | Maximum free space left at the end of the line. | `20` |
324−| `max-indent-retain` | Maximum indentation to carry over when soft wrapping a line. | `40` |
319+| `enable` | Whether soft wrapping is enabled | `false` |
320+| `max-wrap` | Maximum free space left at the end of the line | `20` |
321+| `max-indent-retain` | Maximum indentation to carry over when soft wrapping a line | `40` |
325322| `wrap-indicator` | Text inserted before soft wrapped lines, highlighted with `ui.virtual.wrap` | `↪ ` |
326323
327324Example:
book/src/guides/README.md+1−1
@@ -1,4 +1,4 @@
11# Guides
22
33This section contains guides for adding new language server configurations,
4−tree-sitter grammars, textobject queries, etc.
4+tree-sitter grammars, textobject queries, and other similar items.
book/src/guides/adding_languages.md+42−35
@@ -1,45 +1,52 @@
1−# Adding languages
1+# Adding new languages to Helix
2+
3+In order to add a new language to Helix, you will need to follow the steps
4+below.
25
36## Language configuration
47
5−To add a new language, you need to add a `[[language]]` entry to the
6−`languages.toml` (see the [language configuration section]).
8+1. Add a new `[[language]]` entry in the `languages.toml` file and provide the
9+ necessary configuration for the new language. For more information on
10+ language configuration, refer to the
11+ [language configuration section](../languages.md) of the documentation.
12+2. If you are adding a new language or updating an existing language server
13+ configuration, run the command `cargo xtask docgen` to update the
14+ [Language Support](../lang-support.md) documentation.
715
8−When adding a new language or Language Server configuration for an existing
9−language, run `cargo xtask docgen` to add the new configuration to the
10−[Language Support][lang-support] docs before creating a pull request.
11−When adding a Language Server configuration, be sure to update the
12−[Language Server Wiki][install-lsp-wiki] with installation notes.
16+> 💡 If you are adding a new Language Server configuration, make sure to update
17+> the
18+> [Language Server Wiki](https://github.com/helix-editor/helix/wiki/How-to-install-the-default-language-servers)
19+> with the installation instructions.
1320
1421## Grammar configuration
1522
16−If a tree-sitter grammar is available for the language, add a new `[[grammar]]`
17−entry to `languages.toml`.
18−
19−You may use the `source.path` key rather than `source.git` with an absolute path
20−to a locally available grammar for testing, but switch to `source.git` before
21−submitting a pull request.
23+1. If a tree-sitter grammar is available for the new language, add a new
24+ `[[grammar]]` entry to the `languages.toml` file.
25+2. If you are testing the grammar locally, you can use the `source.path` key
26+ with an absolute path to the grammar. However, before submitting a pull
27+ request, make sure to switch to using `source.git`.
2228
2329## Queries
2430
25−For a language to have syntax-highlighting and indentation among
26−other things, you have to add queries. Add a directory for your
27−language with the path `runtime/queries/<name>/`. The tree-sitter
28−[website](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#queries)
29−gives more info on how to write queries.
30−
31−> NOTE: When evaluating queries, the first matching query takes
32−precedence, which is different from other editors like Neovim where
33−the last matching query supersedes the ones before it. See
34−[this issue][neovim-query-precedence] for an example.
35−
36−## Common Issues
37−
38−- If you get errors when running after switching branches, you may have to update the tree-sitter grammars. Run `hx --grammar fetch` to fetch the grammars and `hx --grammar build` to build any out-of-date grammars.
39−
40−- If a parser is segfaulting or you want to remove the parser, make sure to remove the compiled parser in `runtime/grammar/<name>.so`
41−
42−[language configuration section]: ../languages.md
43−[neovim-query-precedence]: https://github.com/helix-editor/helix/pull/1170#issuecomment-997294090
44−[install-lsp-wiki]: https://github.com/helix-editor/helix/wiki/How-to-install-the-default-language-servers
45−[lang-support]: ../lang-support.md
31+1. In order to provide syntax highlighting and indentation for the new language,
32+ you will need to add queries.
33+2. Create a new directory for the language with the path
34+ `runtime/queries/<name>/`.
35+3. Refer to the
36+ [tree-sitter website](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#queries)
37+ for more information on writing queries.
38+
39+> 💡 In Helix, the first matching query takes precedence when evaluating
40+> queries, which is different from other editors such as Neovim where the last
41+> matching query supersedes the ones before it. See
42+> [this issue](https://github.com/helix-editor/helix/pull/1170#issuecomment-997294090)
43+> for an example.
44+
45+## Common issues
46+
47+- If you encounter errors when running Helix after switching branches, you may
48+ need to update the tree-sitter grammars. Run the command `hx --grammar fetch`
49+ to fetch the grammars and `hx --grammar build` to build any out-of-date
50+ grammars.
51+- If a parser is causing a segfault, or you want to remove it, make sure to
52+ remove the compiled parser located at `runtime/grammars/<name>.so`.
book/src/guides/indent.md+2−2
@@ -1,4 +1,4 @@
1−# Adding Indent Queries
1+# Adding indent queries
22
33Helix uses tree-sitter to correctly indent new lines. This requires
44a tree-sitter grammar and an `indent.scm` query file placed in
@@ -36,7 +36,7 @@ changed by using a `#set!` declaration anywhere in the pattern:
3636 (#set! "scope" "all"))
3737```
3838
39−## Capture Types
39+## Capture types
4040
4141- `@indent` (default scope `tail`):
4242Increase the indent level by 1. Multiple occurrences in the same line
book/src/guides/textobject.md+7−9
@@ -1,14 +1,14 @@
1−# Adding Textobject Queries
1+# Adding textobject queries
22
3−Textobjects that are language specific ([like functions, classes, etc][textobjects])
4−require an accompanying tree-sitter grammar and a `textobjects.scm` query file
3+Helix supports textobjects that are language specific, such as functions, classes, etc.
4+These textobjects require an accompanying tree-sitter grammar and a `textobjects.scm` query file
55to work properly. Tree-sitter allows us to query the source code syntax tree
66and capture specific parts of it. The queries are written in a lisp dialect.
77More information on how to write queries can be found in the [official tree-sitter
88documentation][tree-sitter-queries].
99
1010Query files should be placed in `runtime/queries/{language}/textobjects.scm`
11−when contributing. Note that to test the query files locally you should put
11+when contributing to Helix. Note that to test the query files locally you should put
1212them under your local runtime directory (`~/.config/helix/runtime` on Linux
1313for example).
1414
@@ -28,9 +28,9 @@ The following [captures][tree-sitter-captures] are recognized:
2828
2929[Example query files][textobject-examples] can be found in the helix GitHub repository.
3030
31−## Queries for Textobject Based Navigation
31+## Queries for textobject based navigation
3232
33−[Tree-sitter based navigation][textobjects-nav] is done using captures in the
33+Tree-sitter based navigation in Helix is done using captures in the
3434following order:
3535
3636- `object.movement`
@@ -38,12 +38,10 @@ following order:
3838- `object.inside`
3939
4040For example if a `function.around` capture has been already defined for a language
41−in it's `textobjects.scm` file, function navigation should also work automatically.
41+in its `textobjects.scm` file, function navigation should also work automatically.
4242`function.movement` should be defined only if the node captured by `function.around`
4343doesn't make sense in a navigation context.
4444
45−[textobjects]: ../usage.md#textobjects
46−[textobjects-nav]: ../usage.md#tree-sitter-textobject-based-navigation
4745[tree-sitter-queries]: https://tree-sitter.github.io/tree-sitter/using-parsers#query-syntax
4846[tree-sitter-captures]: https://tree-sitter.github.io/tree-sitter/using-parsers#capturing-nodes
4947[textobject-examples]: https://github.com/search?q=repo%3Ahelix-editor%2Fhelix+filename%3Atextobjects.scm&type=Code&ref=advsearch&l=&l=
book/src/install.md+152−109
@@ -1,180 +1,223 @@
1−# Installation
2−
3−We provide pre-built binaries on the [GitHub Releases page](https://github.com/helix-editor/helix/releases).
1+# Installing Helix
2+
3+<!--toc:start-->
4+- [Pre-built binaries](#pre-built-binaries)
5+- [Linux, macOS, Windows and OpenBSD packaging status](#linux-macos-windows-and-openbsd-packaging-status)
6+- [Linux](#linux)
7+ - [Ubuntu](#ubuntu)
8+ - [Fedora/RHEL](#fedorarhel)
9+ - [Arch Linux community](#arch-linux-community)
10+ - [NixOS](#nixos)
11+- [macOS](#macos)
12+ - [Homebrew Core](#homebrew-core)
13+- [Windows](#windows)
14+ - [Scoop](#scoop)
15+ - [Chocolatey](#chocolatey)
16+ - [MSYS2](#msys2)
17+- [Building from source](#building-from-source)
18+ - [Configuring Helix's runtime files](#configuring-helixs-runtime-files)
19+ - [Validating the installation](#validating-the-installation)
20+ - [Configure the desktop shortcut](#configure-the-desktop-shortcut)
21+<!--toc:end-->
22+
23+To install Helix, follow the instructions specific to your operating system.
24+Note that:
25+
26+- To get the latest nightly version of Helix, you need to
27+ [build from source](#building-from-source).
28+
29+- To take full advantage of Helix, install the language servers for your
30+ preferred programming languages. See the
31+ [wiki](https://github.com/helix-editor/helix/wiki/How-to-install-the-default-language-servers)
32+ for instructions.
33+
34+## Pre-built binaries
35+
36+Download pre-built binaries from the
37+[GitHub Releases page](https://github.com/helix-editor/helix/releases). Add the binary to your system's `$PATH` to use it from the command
38+line.
39+
40+## Linux, macOS, Windows and OpenBSD packaging status
41+
42+Helix is available for Linux, macOS and Windows via the official repositories listed below.
443
544[![Packaging status](https://repology.org/badge/vertical-allrepos/helix.svg)](https://repology.org/project/helix/versions)
645
7−## OSX
46+## Linux
847
9−Helix is available in homebrew-core:
48+The following third party repositories are available:
1049
11−```
12−brew install helix
13−```
50+### Ubuntu
1451
15−## Linux
52+Helix is available via [Maveonair's PPA](https://launchpad.net/~maveonair/+archive/ubuntu/helix-editor):
1653
17−### NixOS
54+```sh
55+sudo add-apt-repository ppa:maveonair/helix-editor
56+sudo apt update
57+sudo apt install helix
58+```
1859
19−A [flake](https://nixos.wiki/wiki/Flakes) containing the package is available in
20−the project root. The flake can also be used to spin up a reproducible development
21−shell for working on Helix with `nix develop`.
60+### Fedora/RHEL
2261
23−Flake outputs are cached for each push to master using
24−[Cachix](https://www.cachix.org/). The flake is configured to
25−automatically make use of this cache assuming the user accepts
26−the new settings on first use.
62+Helix is available via `copr`:
2763
28−If you are using a version of Nix without flakes enabled you can
29−[install Cachix cli](https://docs.cachix.org/installation); `cachix use helix` will
30−configure Nix to use cached outputs when possible.
64+```sh
65+sudo dnf copr enable varlad/helix
66+sudo dnf install helix
67+```
3168
32−### Arch Linux
69+### Arch Linux community
3370
34−Releases are available in the `community` repository.
71+Releases are available in the `community` repository:
3572
36−A [helix-git](https://aur.archlinux.org/packages/helix-git/) package is also available on the AUR, which builds the master branch.
73+```sh
74+sudo pacman -S helix
75+```
76+Additionally, a [helix-git](https://aur.archlinux.org/packages/helix-git/) package is available
77+in the AUR, which builds the master branch.
3778
38−### Fedora Linux
79+### NixOS
3980
40−You can install the COPR package for Helix via
81+Helix is available as a [flake](https://nixos.wiki/wiki/Flakes) in the project
82+root. Use `nix develop` to spin up a reproducible development shell. Outputs are
83+cached for each push to master using [Cachix](https://www.cachix.org/). The
84+flake is configured to automatically make use of this cache assuming the user
85+accepts the new settings on first use.
4186
42−```
43−sudo dnf copr enable varlad/helix
44−sudo dnf install helix
45−```
87+If you are using a version of Nix without flakes enabled,
88+[install Cachix CLI](https://docs.cachix.org/installation) and use
89+`cachix use helix` to configure Nix to use cached outputs when possible.
90+
91+## macOS
4692
47−### Void Linux
93+### Homebrew Core
4894
49−```
50−sudo xbps-install helix
95+```sh
96+brew install helix
5197```
5298
5399## Windows
54100
55−Helix can be installed using [Scoop](https://scoop.sh/), [Chocolatey](https://chocolatey.org/)
101+Install on Windows using [Scoop](https://scoop.sh/), [Chocolatey](https://chocolatey.org/)
56102or [MSYS2](https://msys2.org/).
57103
58−**Scoop:**
104+### Scoop
59105
60−```
106+```sh
61107scoop install helix
62108```
63109
64−**Chocolatey:**
110+### Chocolatey
65111
66−```
112+```sh
67113choco install helix
68114```
69115
70−**MSYS2:**
71−
72−Choose the [proper command](https://www.msys2.org/docs/package-naming/) for your system from below:
73−
74− - For 32 bit Windows 7 or above:
75−
76−```
77−pacman -S mingw-w64-i686-helix
78−```
79−
80− - For 64 bit Windows 7 or above:
81−
82−```
83−pacman -S mingw-w64-x86_64-helix
84−```
116+### MSYS2
85117
86− - For 64 bit Windows 8.1 or above:
118+For 64-bit Windows 8.1 or above:
87119
88−```
120+```sh
89121pacman -S mingw-w64-ucrt-x86_64-helix
90122```
91123
92−## Build from source
124+## Building from source
93125
94−```
126+Clone the repository:
127+
128+```sh
95129git clone https://github.com/helix-editor/helix
96130cd helix
97−cargo install --path helix-term --locked
98131```
99132
100−This will install the `hx` binary to `$HOME/.cargo/bin` and build tree-sitter grammars in `./runtime/grammars`.
101−
102−If you are using the musl-libc instead of glibc the following environment variable must be set during the build
103−to ensure tree sitter grammars can be loaded correctly:
133+Compile from source:
104134
135+```sh
136+cargo install --path helix-term --locked
105137```
106−RUSTFLAGS="-C target-feature=-crt-static"
107−```
108−
109138
110−Helix also needs its runtime files so make sure to copy/symlink the `runtime/` directory into the
111−config directory (for example `~/.config/helix/runtime` on Linux/macOS). This location can be overridden
112−via the `HELIX_RUNTIME` environment variable.
139+This command will create the `hx` executable and construct the tree-sitter
140+grammars either in the `runtime` folder, or in the folder specified in `HELIX_RUNTIME`
141+(as described below). To build the tree-sitter grammars requires a c++ compiler to be installed, for example `gcc-c++`.
113142
114−| OS | Command |
115−| -------------------- | ------------------------------------------------ |
116−| Windows (Cmd) | `xcopy /e /i runtime %AppData%\helix\runtime` |
117−| Windows (PowerShell) | `xcopy /e /i runtime $Env:AppData\helix\runtime` |
118−| Linux / macOS | `ln -s $PWD/runtime ~/.config/helix/runtime` |
143+> 💡 If you are using the musl-libc instead of glibc the following environment variable must be set during the build
144+> to ensure tree-sitter grammars can be loaded correctly:
145+>
146+> ```sh
147+> RUSTFLAGS="-C target-feature=-crt-static"
148+> ```
119149
120−Starting with Windows Vista you can also create symbolic links on Windows. Note that this requires
121−elevated privileges - i.e. PowerShell or Cmd must be run as administrator.
150+> 💡 Tree-sitter grammars can be fetched and compiled if not pre-packaged. Fetch
151+> grammars with `hx --grammar fetch` (requires `git`) and compile them with
152+> `hx --grammar build` (requires a C++ compiler).
122153
123−**PowerShell:**
154+### Configuring Helix's runtime files
124155
125−```powershell
126−New-Item -ItemType Junction -Target "runtime" -Path "$Env:AppData\helix\runtime"
127−```
128−Note: "runtime" must be the absolute path to the runtime directory.
156+- **Linux and macOS**
129157
130−**Cmd:**
158+Either set the `HELIX_RUNTIME` environment variable to point to the runtime files and add it to your `~/.bashrc` or equivalent:
131159
132−```cmd
133−cd %appdata%\helix
134−mklink /D runtime "<helix-repo>\runtime"
160+```sh
161+HELIX_RUNTIME=/home/user-name/src/helix/runtime
135162```
136163
137−The runtime location can be overridden via the `HELIX_RUNTIME` environment variable.
164+Or, create a symlink in `~/.config/helix` that links to the source code directory:
138165
139−> NOTE: if `HELIX_RUNTIME` is set prior to calling `cargo install --path helix-term --locked`,
140−> tree-sitter grammars will be built in `$HELIX_RUNTIME/grammars`.
166+```sh
167+ln -s $PWD/runtime ~/.config/helix/runtime
168+```
141169
142−If you plan on keeping the repo locally, an alternative to copying/symlinking
143−runtime files is to set `HELIX_RUNTIME=/path/to/helix/runtime`
144−(`HELIX_RUNTIME=$PWD/runtime` if you're in the helix repo directory).
170+- **Windows**
145171
146−To use Helix in desktop environments that supports [XDG desktop menu](https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html), including Gnome and KDE, copy the provided `.desktop` file to the correct folder:
172+Either set the `HELIX_RUNTIME` environment variable to point to the runtime files using the Windows setting (search for
173+`Edit environment variables for your account`) or use the `setx` command in
174+Cmd:
147175
148−```bash
149−cp contrib/Helix.desktop ~/.local/share/applications
176+```sh
177+setx HELIX_RUNTIME "%userprofile%\source\repos\helix\runtime"
150178```
151179
152−To use another terminal than the default, you will need to modify the `.desktop` file. For example, to use `kitty`:
180+> 💡 `%userprofile%` resolves to your user directory like
181+> `C:\Users\Your-Name\` for example.
153182
154−```bash
155−sed -i "s|Exec=hx %F|Exec=kitty hx %F|g" ~/.local/share/applications/Helix.desktop
156−sed -i "s|Terminal=true|Terminal=false|g" ~/.local/share/applications/Helix.desktop
157−```
183+Or, create a symlink in `%appdata%\helix\` that links to the source code directory:
158184
159−Please note: there is no icon for Helix yet, so the system default will be used.
185+ | Method | Command |
186+ | ---------- | -------------------------------------------------------------------------------------- |
187+ | PowerShell | `New-Item -ItemType Junction -Target "runtime" -Path "$Env:AppData\helix\runtime"` |
188+ | Cmd | `cd %appdata%\helix` <br/> `mklink /D runtime "%userprofile%\src\helix\runtime"` |
160189
161−## Finishing up the installation
190+ > 💡 On Windows, creating a symbolic link may require running PowerShell or
191+ > Cmd as an administrator.
162192
163−To make sure everything is set up as expected you should finally run the helix healthcheck via
193+### Validating the installation
164194
165−```
195+To make sure everything is set up as expected you should run the Helix health
196+check:
197+
198+```sh
166199hx --health
167200```
168201
169−For more information on the information displayed in the health check results refer to [Healthcheck](https://github.com/helix-editor/helix/wiki/Healthcheck).
202+For more information on the health check results refer to
203+[Health check](https://github.com/helix-editor/helix/wiki/Healthcheck).
170204
171−### Building tree-sitter grammars
205+### Configure the desktop shortcut
172206
173−Tree-sitter grammars must be fetched and compiled if not pre-packaged.
174−Fetch grammars with `hx --grammar fetch` (requires `git`) and compile them
175−with `hx --grammar build` (requires a C++ compiler).
207+If your desktop environment supports the
208+[XDG desktop menu](https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html)
209+you can configure Helix to show up in the application menu by copying the
210+provided `.desktop` and icon files to their correct folders:
176211
177−### Installing language servers
212+```sh
213+cp contrib/Helix.desktop ~/.local/share/applications
214+cp contrib/helix.png ~/.icons # or ~/.local/share/icons
215+```
216+
217+To use another terminal than the system default, you can modify the `.desktop`
218+file. For example, to use `kitty`:
178219
179−Language servers can optionally be installed if you want their features (auto-complete, diagnostics etc.).
180−Follow the [instructions on the wiki page](https://github.com/helix-editor/helix/wiki/How-to-install-the-default-language-servers) to add your language servers of choice.
220+```sh
221+sed -i "s|Exec=hx %F|Exec=kitty hx %F|g" ~/.local/share/applications/Helix.desktop
222+sed -i "s|Terminal=true|Terminal=false|g" ~/.local/share/applications/Helix.desktop
223+```
book/src/keymap.md+20−20
@@ -14,14 +14,14 @@
1414 - [Space mode](#space-mode)
1515 - [Popup](#popup)
1616 - [Unimpaired](#unimpaired)
17−- [Insert Mode](#insert-mode)
18−- [Select / extend mode](#select--extend-mode)
17+- [Insert mode](#insert-mode)
18+- [Select / extend mode](#select-extend-mode)
1919- [Picker](#picker)
2020- [Prompt](#prompt)
2121
2222> 💡 Mappings marked (**LSP**) require an active language server for the file.
2323
24−> 💡 Mappings marked (**TS**) require a tree-sitter grammar for the filetype.
24+> 💡 Mappings marked (**TS**) require a tree-sitter grammar for the file type.
2525
2626## Normal mode
2727
@@ -109,7 +109,7 @@
109109| Key | Description | Command |
110110| ----- | ----------- | ------- |
111111| `s` | Select all regex matches inside selections | `select_regex` |
112−| `S` | Split selection into subselections on regex matches | `split_selection` |
112+| `S` | Split selection into sub selections on regex matches | `split_selection` |
113113| `Alt-s` | Split selection on newlines | `split_selection_on_newline` |
114114| `Alt-_ ` | Merge consecutive selections | `merge_consecutive_selections` |
115115| `&` | Align selection in columns | `align_selections` |
@@ -141,7 +141,7 @@
141141
142142### Search
143143
144−Search commands all operate on the `/` register by default. Use `"<char>` to operate on a different one.
144+Search commands all operate on the `/` register by default. To use a different register, use `"<char>`.
145145
146146| Key | Description | Command |
147147| ----- | ----------- | ------- |
@@ -175,9 +175,8 @@ Accessed by typing `z` in [normal mode](#normal-mode).
175175
176176View mode is intended for scrolling and manipulating the view without changing
177177the selection. The "sticky" variant of this mode (accessed by typing `Z` in
178−normal mode) is persistent; use the Escape key to return to normal mode after
179−usage (useful when you're simply looking over text and not actively editing
180−it).
178+normal mode) is persistent and can be exited using the escape key. This is
179+useful when you're simply looking over text and not actively editing it.
181180
182181
183182| Key | Description | Command |
@@ -225,7 +224,7 @@ Jumps to various locations.
225224Accessed by typing `m` in [normal mode](#normal-mode).
226225
227226See the relevant section in [Usage](./usage.md) for an explanation about
228−[surround](./usage.md#surround) and [textobject](./usage.md#textobjects) usage.
227+[surround](./usage.md#surround) and [textobject](./usage.md#navigating-using-tree-sitter-textobjects) usage.
229228
230229| Key | Description | Command |
231230| ----- | ----------- | ------- |
@@ -242,7 +241,7 @@ TODO: Mappings for selecting syntax nodes (a superset of `[`).
242241
243242Accessed by typing `Ctrl-w` in [normal mode](#normal-mode).
244243
245−This layer is similar to Vim keybindings as Kakoune does not support window.
244+This layer is similar to Vim keybindings as Kakoune does not support windows.
246245
247246| Key | Description | Command |
248247| ----- | ------------- | ------- |
@@ -293,7 +292,7 @@ This layer is a kludge of mappings, mostly pickers.
293292| `/` | Global search in workspace folder | `global_search` |
294293| `?` | Open command palette | `command_palette` |
295294
296−> TIP: Global search displays results in a fuzzy picker, use `Space + '` to bring it back up after opening a file.
295+> 💡 Global search displays results in a fuzzy picker, use `Space + '` to bring it back up after opening a file.
297296
298297##### Popup
299298
@@ -306,7 +305,7 @@ Displays documentation for item under cursor.
306305
307306#### Unimpaired
308307
309−Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaired).
308+These mappings are in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaired).
310309
311310| Key | Description | Command |
312311| ----- | ----------- | ------- |
@@ -335,12 +334,13 @@ Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaire
335334
336335## Insert mode
337336
338−Insert mode bindings are somewhat minimal by default. Helix is designed to
337+Insert mode bindings are minimal by default. Helix is designed to
339338be a modal editor, and this is reflected in the user experience and internal
340−mechanics. For example, changes to the text are only saved for undos when
341−escaping from insert mode to normal mode. For this reason, new users are
342−strongly encouraged to learn the modal editing paradigm to get the smoothest
343−experience.
339+mechanics. Changes to the text are only saved for undos when
340+escaping from insert mode to normal mode.
341+
342+> 💡 New users are strongly encouraged to learn the modal editing paradigm
343+> to get the smoothest experience.
344344
345345| Key | Description | Command |
346346| ----- | ----------- | ------- |
@@ -370,8 +370,8 @@ with modal editors.
370370| `Home` | Move to line start | `goto_line_start` |
371371| `End` | Move to line end | `goto_line_end_newline` |
372372
373−If you want to disable them in insert mode as you become more comfortable with modal editing, you can use
374−the following in your `config.toml`:
373+As you become more comfortable with modal editing, you may want to disable some
374+insert mode bindings. You can do this by editing your `config.toml` file.
375375
376376```toml
377377[keys.insert]
@@ -387,7 +387,7 @@ end = "no_op"
387387
388388## Select / extend mode
389389
390−This mode echoes Normal mode, but changes any movements to extend
390+Select mode echoes Normal mode, but changes any movements to extend
391391selections rather than replace them. Goto motions are also changed to
392392extend, so that `vgl` for example extends the selection to the end of
393393the line.
book/src/lang-support.md+2−2
@@ -1,10 +1,10 @@
11# Language Support
22
3−The following languages and Language Servers are supported. In order to use
3+The following languages and Language Servers are supported. To use
44Language Server features, you must first [install][lsp-install-wiki] the
55appropriate Language Server.
66
7−Check the language support in your installed helix version with `hx --health`.
7+You can check the language support in your installed helix version with `hx --health`.
88
99Also see the [Language Configuration][lang-config] docs and the [Adding
1010Languages][adding-languages] guide for more language configuration information.
book/src/languages.md+13−11
@@ -5,13 +5,15 @@ in `languages.toml` files.
55
66## `languages.toml` files
77
8−There are three possible `languages.toml` files. The first is compiled into
9−Helix and lives in the [Helix repository](https://github.com/helix-editor/helix/blob/master/languages.toml).
10−This provides the default configurations for languages and language servers.
8+There are three possible locations for a `languages.toml` file:
119
12−You may define a `languages.toml` in your [configuration directory](./configuration.md)
13−which overrides values from the built-in language configuration. For example
14−to disable auto-LSP-formatting in Rust:
10+1. In the Helix source code, this lives in the
11+ [Helix repository](https://github.com/helix-editor/helix/blob/master/languages.toml).
12+ It provides the default configurations for languages and language servers.
13+
14+2. In your [configuration directory](./configuration.md). This overrides values
15+ from the built-in language configuration. For example to disable
16+ auto-LSP-formatting in Rust:
1517
1618```toml
1719# in <config_dir>/helix/languages.toml
@@ -21,10 +23,10 @@ name = "rust"
2123auto-format = false
2224```
2325
24−Language configuration may also be overridden local to a project by creating
25−a `languages.toml` file under a `.helix` directory. Its settings will be merged
26−with the language configuration in the configuration directory and the built-in
27−configuration.
26+3. In a `.helix` folder in your project. Language configuration may also be
27+ overridden local to a project by creating a `languages.toml` file in a
28+ `.helix` folder. Its settings will be merged with the language configuration
29+ in the configuration directory and the built-in configuration.
2830
2931## Language configuration
3032
@@ -65,7 +67,7 @@ These configuration keys are available:
6567
6668### File-type detection and the `file-types` key
6769
68−Helix determines which language configuration to use with the `file-types` key
70+Helix determines which language configuration to use based on the `file-types` key
6971from the above section. `file-types` is a list of strings or tables, for
7072example:
7173
book/src/remapping.md+9−10
@@ -1,18 +1,18 @@
1−# Key Remapping
1+# Key remapping
22
3−One-way key remapping is temporarily supported via a simple TOML configuration
3+Helix currently supports one-way key remapping through a simple TOML configuration
44file. (More powerful solutions such as rebinding via commands will be
55available in the future).
66
7−To remap keys, write a `config.toml` file in your `helix` configuration
8−directory (default `~/.config/helix` in Linux systems) with a structure like
7+To remap keys, create a `config.toml` file in your `helix` configuration
8+directory (default `~/.config/helix` on Linux systems) with a structure like
99this:
1010
1111```toml
1212# At most one section each of 'keys.normal', 'keys.insert' and 'keys.select'
1313[keys.normal]
14−C-s = ":w" # Maps the Ctrl-s to the typable command :w which is an alias for :write (save file)
15−C-o = ":open ~/.config/helix/config.toml" # Maps the Ctrl-o to opening of the helix config file
14+C-s = ":w" # Maps Ctrl-s to the typable command :w which is an alias for :write (save file)
15+C-o = ":open ~/.config/helix/config.toml" # Maps Ctrl-o to opening of the helix config file
1616a = "move_char_left" # Maps the 'a' key to the move_char_left command
1717w = "move_line_up" # Maps the 'w' key move_line_up
1818"C-S-esc" = "extend_line" # Maps Ctrl-Shift-Escape to extend_line
@@ -20,10 +20,9 @@ g = { a = "code_action" } # Maps `ga` to show possible code actions
2020"ret" = ["open_below", "normal_mode"] # Maps the enter key to open_below then re-enter normal mode
2121
2222[keys.insert]
23−"A-x" = "normal_mode" # Maps Alt-X to enter normal mode
23+"A-x" = "normal_mode" # Maps Alt-X to enter normal mode
2424j = { k = "normal_mode" } # Maps `jk` to exit insert mode
2525```
26−> NOTE: Typable commands can also be remapped, remember to keep the `:` prefix to indicate it's a typable command.
2726
2827## Minor modes
2928
@@ -76,5 +75,5 @@ Ctrl, Shift and Alt modifiers are encoded respectively with the prefixes
7675
7776Keys can be disabled by binding them to the `no_op` command.
7877
79−Commands can be found at [Keymap](https://docs.helix-editor.com/keymap.html) Commands.
80−> Commands can also be found in the source code at [`helix-term/src/commands.rs`](https://github.com/helix-editor/helix/blob/master/helix-term/src/commands.rs) at the invocation of `static_commands!` macro and the `TypableCommandList`.
78+A list of commands is available in the [Keymap](https://docs.helix-editor.com/keymap.html) documentation
79+ and in the source code at [`helix-term/src/commands.rs`](https://github.com/helix-editor/helix/blob/master/helix-term/src/commands.rs) at the invocation of `static_commands!` macro and the `TypableCommandList`.
book/src/themes.md+53−45
@@ -1,14 +1,15 @@
11# Themes
22
3−To use a theme add `theme = "<name>"` to your [`config.toml`](./configuration.md) at the very top of the file before the first section or select it during runtime using `:theme <name>`.
3+To use a theme add `theme = "<name>"` to the top of your [`config.toml`](./configuration.md) file, or select it during runtime using `:theme <name>`.
44
55## Creating a theme
66
7−Create a file with the name of your theme as file name (i.e `mytheme.toml`) and place it in your `themes` directory (i.e `~/.config/helix/themes`). The directory might have to be created beforehand.
7+Create a file with the name of your theme as the file name (i.e `mytheme.toml`) and place it in your `themes` directory (i.e `~/.config/helix/themes` or `%AppData%\helix\themes` on Windows). The directory might have to be created beforehand.
88
9−The names "default" and "base16_default" are reserved for the builtin themes and cannot be overridden by user defined themes.
9+> 💡 The names "default" and "base16_default" are reserved for built-in themes
10+> and cannot be overridden by user-defined themes.
1011
11−The default theme.toml can be found [here](https://github.com/helix-editor/helix/blob/master/theme.toml), and user submitted themes [here](https://github.com/helix-editor/helix/blob/master/runtime/themes).
12+### Overview
1213
1314Each line in the theme file is specified as below:
1415
@@ -16,7 +17,7 @@ Each line in the theme file is specified as below:
1617key = { fg = "#ffffff", bg = "#000000", underline = { color = "#ff0000", style = "curl"}, modifiers = ["bold", "italic"] }
1718```
1819
19−where `key` represents what you want to style, `fg` specifies the foreground color, `bg` the background color, `underline` the underline `style`/`color`, and `modifiers` is a list of style modifiers. `bg`, `underline` and `modifiers` can be omitted to defer to the defaults.
20+Where `key` represents what you want to style, `fg` specifies the foreground color, `bg` the background color, `underline` the underline `style`/`color`, and `modifiers` is a list of style modifiers. `bg`, `underline` and `modifiers` can be omitted to defer to the defaults.
2021
2122To specify only the foreground color:
2223
@@ -24,15 +25,30 @@ To specify only the foreground color:
2425key = "#ffffff"
2526```
2627
27−if the key contains a dot `'.'`, it must be quoted to prevent it being parsed as a [dotted key](https://toml.io/en/v1.0.0#keys).
28+If the key contains a dot `'.'`, it must be quoted to prevent it being parsed as a [dotted key](https://toml.io/en/v1.0.0#keys).
2829
2930```toml
3031"key.key" = "#ffffff"
3132```
3233
34+For inspiration, you can find the default `theme.toml`
35+[here](https://github.com/helix-editor/helix/blob/master/theme.toml) and
36+user-submitted themes
37+[here](https://github.com/helix-editor/helix/blob/master/runtime/themes).
38+
39+### Using the linter
40+
41+Use the supplied linting tool to check for errors and missing scopes:
42+
43+```sh
44+cargo xtask themelint onedark # replace onedark with <name>
45+```
46+
47+## The details of theme creation
48+
3349### Color palettes
3450
35−It's recommended define a palette of named colors, and refer to them from the
51+It's recommended to define a palette of named colors, and refer to them in the
3652configuration values in your theme. To do this, add a table called
3753`palette` to your theme file:
3854
@@ -45,8 +61,8 @@ white = "#ffffff"
4561black = "#000000"
4662```
4763
48−Remember that the `[palette]` table includes all keys after its header,
49−so you should define the palette after normal theme options.
64+Keep in mind that the `[palette]` table includes all keys after its header,
65+so it should be defined after the normal theme options.
5066
5167The default palette uses the terminal's default 16 colors, and the colors names
5268are listed below. The `[palette]` section in the config file takes precedence
@@ -73,9 +89,8 @@ over it and is merged into the default palette.
7389
7490### Modifiers
7591
76−The following values may be used as modifiers.
77−
78−Less common modifiers might not be supported by your terminal emulator.
92+The following values may be used as modifier, provided they are supported by
93+your terminal emulator.
7994
8095| Modifier |
8196| --- |
@@ -89,14 +104,13 @@ Less common modifiers might not be supported by your terminal emulator.
89104| `hidden` |
90105| `crossed_out` |
91106
92−> Note: The `underlined` modifier is deprecated and only available for backwards compatibility.
107+> 💡 The `underlined` modifier is deprecated and only available for backwards compatibility.
93108> Its behavior is equivalent to setting `underline.style="line"`.
94109
95−### Underline Style
96−
97−One of the following values may be used as a value for `underline.style`.
110+### Underline style
98111
99−Some styles might not be supported by your terminal emulator.
112+One of the following values may be used as a value for `underline.style`, providing it is
113+supported by your terminal emulator.
100114
101115| Modifier |
102116| --- |
@@ -109,7 +123,7 @@ Some styles might not be supported by your terminal emulator.
109123
110124### Inheritance
111125
112−Extend upon other themes by setting the `inherits` property to an existing theme.
126+Extend other themes by setting the `inherits` property to an existing theme.
113127
114128```toml
115129inherits = "boo_berry"
@@ -124,19 +138,19 @@ berry = "#2A2A4D"
124138
125139### Scopes
126140
127−The following is a list of scopes available to use for styling.
141+The following is a list of scopes available to use for styling:
128142
129143#### Syntax highlighting
130144
131145These keys match [tree-sitter scopes](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#theme).
132146
133−For a given highlight produced, styling will be determined based on the longest matching theme key. For example, the highlight `function.builtin.static` would match the key `function.builtin` rather than `function`.
147+When determining styling for a highlight, the longest matching theme key will be used. For example, if the highlight is `function.builtin.static`, the key `function.builtin` will be used instead of `function`.
134148
135149We use a similar set of scopes as
136−[SublimeText](https://www.sublimetext.com/docs/scope_naming.html). See also
150+[Sublime Text](https://www.sublimetext.com/docs/scope_naming.html). See also
137151[TextMate](https://macromates.com/manual/en/language_grammars) scopes.
138152
139−- `attribute` - Class attributes, html tag attributes
153+- `attribute` - Class attributes, HTML tag attributes
140154
141155- `type` - Types
142156 - `builtin` - Primitive types provided by the language (`int`, `usize`)
@@ -144,7 +158,7 @@ We use a similar set of scopes as
144158 - `variant`
145159- `constructor`
146160
147−- `constant` (TODO: constant.other.placeholder for %v)
161+- `constant` (TODO: constant.other.placeholder for `%v`)
148162 - `builtin` Special constants provided by the language (`true`, `false`, `nil` etc)
149163 - `boolean`
150164 - `character`
@@ -162,11 +176,11 @@ We use a similar set of scopes as
162176
163177- `comment` - Code comments
164178 - `line` - Single line comments (`//`)
165− - `block` - Block comments (e.g. (`/* */`)
179+ - `block` - Block comments (e.g. (`/* */`)
166180 - `documentation` - Documentation comments (e.g. `///` in Rust)
167181
168182- `variable` - Variables
169− - `builtin` - Reserved language variables (`self`, `this`, `super`, etc)
183+ - `builtin` - Reserved language variables (`self`, `this`, `super`, etc.)
170184 - `parameter` - Function parameters
171185 - `other`
172186 - `member` - Fields of composite data types (e.g. structs, unions)
@@ -186,10 +200,10 @@ We use a similar set of scopes as
186200 - `return`
187201 - `exception`
188202 - `operator` - `or`, `in`
189− - `directive` - Preprocessor directives (`#if` in C)
203+ - `directive` - Preprocessor directives (`#if` in C)
190204 - `function` - `fn`, `func`
191205 - `storage` - Keywords describing how things are stored
192− - `type` - The type of something, `class`, `function`, `var`, `let`, etc.
206+ - `type` - The type of something, `class`, `function`, `var`, `let`, etc.
193207 - `modifier` - Storage modifiers like `static`, `mut`, `const`, `ref`, etc.
194208
195209- `operator` - `||`, `+=`, `>`
@@ -216,9 +230,9 @@ We use a similar set of scopes as
216230 - `bold`
217231 - `italic`
218232 - `link`
219− - `url` - urls pointed to by links
220− - `label` - non-url link references
221− - `text` - url and image descriptions in links
233+ - `url` - URLs pointed to by links
234+ - `label` - non-URL link references
235+ - `text` - URL and image descriptions in links
222236 - `quote`
223237 - `raw`
224238 - `inline`
@@ -232,19 +246,19 @@ We use a similar set of scopes as
232246
233247#### Interface
234248
235−These scopes are used for theming the editor interface.
249+These scopes are used for theming the editor interface:
236250
237251- `markup`
238252 - `normal`
239− - `completion` - for completion doc popup ui
240− - `hover` - for hover popup ui
253+ - `completion` - for completion doc popup UI
254+ - `hover` - for hover popup UI
241255 - `heading`
242− - `completion` - for completion doc popup ui
243− - `hover` - for hover popup ui
256+ - `completion` - for completion doc popup UI
257+ - `hover` - for hover popup UI
244258 - `raw`
245259 - `inline`
246− - `completion` - for completion doc popup ui
247− - `hover` - for hover popup ui
260+ - `completion` - for completion doc popup UI
261+ - `hover` - for hover popup UI
248262
249263
250264| Key | Notes |
@@ -270,9 +284,9 @@ These scopes are used for theming the editor interface.
270284| `ui.statusline.insert` | Statusline mode during insert mode ([only if `editor.color-modes` is enabled][editor-section]) |
271285| `ui.statusline.select` | Statusline mode during select mode ([only if `editor.color-modes` is enabled][editor-section]) |
272286| `ui.statusline.separator` | Separator character in statusline |
273−| `ui.popup` | Documentation popups (e.g Space + k) |
287+| `ui.popup` | Documentation popups (e.g. Space + k) |
274288| `ui.popup.info` | Prompt for multiple key options |
275−| `ui.window` | Border lines separating splits |
289+| `ui.window` | Borderlines separating splits |
276290| `ui.help` | Description box for commands |
277291| `ui.text` | Command prompts, popup text, etc. |
278292| `ui.text.focus` | |
@@ -301,10 +315,4 @@ These scopes are used for theming the editor interface.
301315| `diagnostic.warning` | Diagnostics warning (editing area) |
302316| `diagnostic.error` | Diagnostics error (editing area) |
303317
304−You can check compliance to spec with
305−
306−```shell
307−cargo xtask themelint onedark # replace onedark with <name>
308−```
309−
310318[editor-section]: ./configuration.md#editor-section
book/src/usage.md+114−92
@@ -1,22 +1,43 @@
1−# Usage
1+# Using Helix
22
3−(Currently not fully documented, see the [keymappings](./keymap.md) list for more.)
3+<!--toc:start-->
4+- [Registers](#registers)
5+ - [User-defined registers](#user-defined-registers)
6+ - [Special registers](#special-registers)
7+- [Surround](#surround)
8+- [Selecting and manipulating text with textobjects](#selecting-and-manipulating-text-with-textobjects)
9+- [Navigating using tree-sitter textobjects](#navigating-using-tree-sitter-textobjects)
10+- [Moving the selection with syntax-aware motions](#moving-the-selection-with-syntax-aware-motions)
11+<!--toc:end-->
412
5−See [tutor](https://github.com/helix-editor/helix/blob/master/runtime/tutor) (accessible via `hx --tutor` or `:tutor`) for a vimtutor-like introduction.
13+For a full interactive introduction to Helix, refer to the
14+[tutor](https://github.com/helix-editor/helix/blob/master/runtime/tutor) which
15+can be accessed via the command `hx --tutor` or `:tutor`.
16+
17+> 💡 Currently, not all functionality is fully documented, please refer to the
18+> [key mappings](./keymap.md) list.
619
720## Registers
821
9−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:
22+In Helix, registers are storage locations for text and other data, such as the
23+result of a search. Registers can be used to cut, copy, and paste text, similar
24+to the clipboard in other text editors. Usage is similar to Vim, with `"` being
25+used to select a register.
26+
27+### User-defined registers
28+
29+Helix allows you to create your own named registers for storing text, for
30+example:
1031
1132- `"ay` - Yank the current selection to register `a`.
1233- `"op` - Paste the text in register `o` after the selection.
1334
14−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:
35+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:
1536
1637- `"hc` - Store the selection in register `h` and then change it (delete and enter insert mode).
1738- `"md` - Store the selection in register `m` and delete it.
1839
19−### Special Registers
40+### Special registers
2041
2142| Register character | Contains |
2243| --- | --- |
@@ -25,41 +46,90 @@ If there is a selected register before invoking a change or delete command, the
2546| `"` | Last yanked text |
2647| `_` | Black hole |
2748
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.
49+The system clipboard is not directly supported by a special register. Instead, special commands and keybindings are provided. Refer to the
50+[key map](keymap.md#space-mode) for more details.
51+
52+The black hole register is a no-op register, meaning that no data will be read or written to it.
3053
3154## Surround
3255
33−Functionality similar to [vim-surround](https://github.com/tpope/vim-surround) is built into
34−helix. The keymappings have been inspired from [vim-sandwich](https://github.com/machakann/vim-sandwich):
56+Helix includes built-in functionality similar to [vim-surround](https://github.com/tpope/vim-surround).
57+The keymappings have been inspired from [vim-sandwich](https://github.com/machakann/vim-sandwich):
3558
36−![surround demo](https://user-images.githubusercontent.com/23398472/122865801-97073180-d344-11eb-8142-8f43809982c6.gif)
59+![Surround demo](https://user-images.githubusercontent.com/23398472/122865801-97073180-d344-11eb-8142-8f43809982c6.gif)
3760
38−- `ms` - Add surround characters
39−- `mr` - Replace surround characters
40−- `md` - Delete surround characters
61+| Key Sequence | Action |
62+| --------------------------------- | --------------------------------------- |
63+| `ms<char>` (after selecting text) | Add surround characters to selection |
64+| `mr<char_to_replace><new_char>` | Replace the closest surround characters |
65+| `md<char_to_delete>` | Delete the closest surround characters |
4166
42−`ms` acts on a selection, so select the text first and use `ms<char>`. `mr` and `md` work
43−on the closest pairs found and selections are not required; use counts to act in outer pairs.
67+You can use counts to act on outer pairs.
4468
45−It can also act on multiple selections (yay!). For example, to change every occurrence of `(use)` to `[use]`:
69+Surround can also act on multiple selections. For example, to change every occurrence of `(use)` to `[use]`:
4670
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
71+1. `%` to select the whole file
72+2. `s` to split the selections on a search term
73+3. Input `use` and hit Enter
74+4. `mr([` to replace the parentheses with square brackets
5175
52−Multiple characters are currently not supported, but planned.
76+Multiple characters are currently not supported, but planned for future release.
5377
54−## Syntax-tree Motions
78+## Selecting and manipulating text with textobjects
5579
56−`Alt-p`, `Alt-o`, `Alt-i`, and `Alt-n` (or `Alt` and arrow keys) move the primary
57−selection according to the selection's place in the syntax tree. Let's walk
58−through an example to get familiar with them. Many languages have a syntax like
59−so for function calls:
80+In Helix, textobjects are a way to select, manipulate and operate on a piece of
81+text in a structured way. They allow you to refer to blocks of text based on
82+their structure or purpose, such as a word, sentence, paragraph, or even a
83+function or block of code.
6084
61−```
62−func(arg1, arg2, arg3)
85+![Textobject demo](https://user-images.githubusercontent.com/23398472/124231131-81a4bb00-db2d-11eb-9d10-8e577ca7b177.gif)
86+![Textobject tree-sitter demo](https://user-images.githubusercontent.com/23398472/132537398-2a2e0a54-582b-44ab-a77f-eb818942203d.gif)
87+
88+- `ma` - Select around the object (`va` in Vim, `<alt-a>` in Kakoune)
89+- `mi` - Select inside the object (`vi` in Vim, `<alt-i>` in Kakoune)
90+
91+| Key after `mi` or `ma` | Textobject selected |
92+| --- | --- |
93+| `w` | Word |
94+| `W` | WORD |
95+| `p` | Paragraph |
96+| `(`, `[`, `'`, etc. | Specified surround pairs |
97+| `m` | The closest surround pair |
98+| `f` | Function |
99+| `c` | Class |
100+| `a` | Argument/parameter |
101+| `o` | Comment |
102+| `t` | Test |
103+| `g` | Change |
104+
105+> 💡 `f`, `c`, etc. need a tree-sitter grammar active for the current
106+document and a special tree-sitter query file to work properly. [Only
107+some grammars][lang-support] currently have the query file implemented.
108+Contributions are welcome!
109+
110+## Navigating using tree-sitter textobjects
111+
112+Navigating between functions, classes, parameters, and other elements is
113+possible using tree-sitter and textobject queries. For
114+example to move to the next function use `]f`, to move to previous
115+class use `[c`, and so on.
116+
117+![Tree-sitter-nav-demo][tree-sitter-nav-demo]
118+
119+For the full reference see the [unimpaired][unimpaired-keybinds] section of the key bind
120+documentation.
121+
122+> 💡 This feature relies on tree-sitter textobjects
123+> and requires the corresponding query file to work properly.
124+
125+## Moving the selection with syntax-aware motions
126+
127+`Alt-p`, `Alt-o`, `Alt-i`, and `Alt-n` (or `Alt` and arrow keys) allow you to move the
128+selection according to its location in the syntax tree. For example, many languages have the
129+following syntax for function calls:
130+
131+```js
132+func(arg1, arg2, arg3);
63133```
64134
65135A function call might be parsed by tree-sitter into a tree like the following.
@@ -93,77 +163,29 @@ a more intuitive tree format:
93163 └──────────┘ └──────────┘ └──────────┘
94164```
95165
96−Say we have a selection that wraps `arg1`. The selection is on the `arg1` leaf
97−in the tree above.
166+If you have a selection that wraps `arg1` (see the tree above), and you use
167+`Alt-n`, it will select the next sibling in the syntax tree: `arg2`.
98168
99−```
169+```js
170+// before
100171func([arg1], arg2, arg3)
172+// after
173+func(arg1, [arg2], arg3);
101174```
102175
103−Using `Alt-n` would select the next sibling in the syntax tree: `arg2`.
176+Similarly, `Alt-o` will expand the selection to the parent node, in this case, the
177+arguments node.
104178
105−```
106−func(arg1, [arg2], arg3)
107−```
108−
109−While `Alt-o` would expand the selection to the parent node. In the tree above we
110−can see that we would select the `arguments` node.
111−
112−```
113−func[(arg1, arg2, arg3)]
179+```js
180+func[(arg1, arg2, arg3)];
114181```
115182
116183There is also some nuanced behavior that prevents you from getting stuck on a
117−node with no sibling. If we have a selection on `arg1`, `Alt-p` would bring us
118−to the previous child node. Since `arg1` doesn't have a sibling to its left,
119−though, we climb the syntax tree and then take the previous selection. So
120−`Alt-p` will move the selection over to the "func" `identifier`.
121−
122−```
123−[func](arg1, arg2, arg3)
124−```
125−
126−## Textobjects
127−
128−![textobject-demo](https://user-images.githubusercontent.com/23398472/124231131-81a4bb00-db2d-11eb-9d10-8e577ca7b177.gif)
129−![textobject-treesitter-demo](https://user-images.githubusercontent.com/23398472/132537398-2a2e0a54-582b-44ab-a77f-eb818942203d.gif)
130−
131−- `ma` - Select around the object (`va` in Vim, `<alt-a>` in Kakoune)
132−- `mi` - Select inside the object (`vi` in Vim, `<alt-i>` in Kakoune)
133−
134−| Key after `mi` or `ma` | Textobject selected |
135−| --- | --- |
136−| `w` | Word |
137−| `W` | WORD |
138−| `p` | Paragraph |
139−| `(`, `[`, `'`, etc | Specified surround pairs |
140−| `m` | Closest surround pair |
141−| `f` | Function |
142−| `c` | Class |
143−| `a` | Argument/parameter |
144−| `o` | Comment |
145−| `t` | Test |
146−| `g` | Change |
147−
148−> NOTE: `f`, `c`, etc need a tree-sitter grammar active for the current
149−document and a special tree-sitter query file to work properly. [Only
150−some grammars][lang-support] currently have the query file implemented.
151−Contributions are welcome!
152−
153−## Tree-sitter Textobject Based Navigation
154−
155−Navigating between functions, classes, parameters, etc is made
156−possible by leveraging tree-sitter and textobjects queries. For
157−example to move to the next function use `]f`, to move to previous
158−class use `[c`, and so on.
159−
160−![tree-sitter-nav-demo][tree-sitter-nav-demo]
161−
162−See the [unimpaired][unimpaired-keybinds] section of the keybind
163−documentation for the full reference.
164−
165−> NOTE: This feature is dependent on tree-sitter based textobjects
166−and therefore requires the corresponding query file to work properly.
184+node with no sibling. When using `Alt-p` with a selection on `arg1`, the previous
185+child node will be selected. In the event that `arg1` does not have a previous
186+sibling, the selection will move up the syntax tree and select the previous
187+element. As a result, using `Alt-p` with a selection on `arg1` will move the
188+selection to the "func" `identifier`.
167189
168190[lang-support]: ./lang-support.md
169191[unimpaired-keybinds]: ./keymap.md#unimpaired