2021-04-05 10:18:43 +04:00
# Configuration
2021-06-06 16:45:59 +04:00
2021-08-16 16:19:05 +04:00
To override global configuration parameters, create a `config.toml` file located in your config directory:
2023-03-06 13:27:17 +04:00
- Linux and Mac: `~/.config/helix/config.toml`
- Windows: `%AppData%\helix\config.toml`
2021-06-19 15:19:31 +04:00
2023-03-06 13:27:17 +04:00
> 💡 You can easily open the config file by typing `:config-open` within Helix normal mode.
2022-03-09 22:34:12 +04:00
2021-11-24 10:47:41 +04:00
Example config:
```toml
theme = "onedark"
[editor]
line-number = "relative"
mouse = false
[editor.cursor-shape]
2021-11-29 09:39:04 +04:00
insert = "bar"
normal = "block"
select = "underline"
2021-11-24 10:47:41 +04:00
[editor.file-picker]
hidden = false
```
2023-03-06 13:27:17 +04:00
You can use a custom configuration file by specifying it with the `-c` or
`--config` command line argument, for example `hx -c path/to/custom-config.toml` .
Additionally, you can reload the configuration file by sending the USR1
signal to the Helix process on Unix operating systems, such as by using the command `pkill -USR1 hx` .
2022-10-03 19:08:32 +04:00
2021-09-07 08:00:52 +04:00
## Editor
2021-11-24 10:47:41 +04:00
### `[editor]` Section
2021-09-07 08:00:52 +04:00
| Key | Description | Default |
|--|--|---------|
2023-03-06 13:27:17 +04:00
| `scrolloff` | Number of lines of padding around the edge of the screen when scrolling | `5` |
| `mouse` | Enable mouse mode | `true` |
| `middle-click-paste` | Middle click paste support | `true` |
| `scroll-lines` | Number of lines to scroll per scroll wheel step | `3` |
| `shell` | Shell to use when running external commands | Unix: `["sh", "-c"]` < br /> Windows: `["cmd", "/C"]` |
| `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` |
| `cursorline` | Highlight all lines with a cursor | `false` |
| `cursorcolumn` | Highlight all columns with a cursor | `false` |
2022-12-01 12:35:23 +04:00
| `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"]` |
2023-03-06 13:27:17 +04:00
| `auto-completion` | Enable automatic pop up of auto-completion | `true` |
| `auto-format` | Enable automatic formatting on save | `true` |
| `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` |
| `idle-timeout` | Time in milliseconds since last keypress before idle timers trigger. Used for autocompletion, set to 0 for instant | `400` |
2021-10-18 10:14:50 +04:00
| `completion-trigger-len` | The min-length of word under cursor to trigger autocompletion | `2` |
2023-03-10 02:21:02 +04:00
| `completion-replace` | Set to `true` to make completions always replace the entire word and not just the part before the cursor | `false` |
2023-03-06 13:27:17 +04:00
| `auto-info` | Whether to display info boxes | `true` |
| `true-color` | Set to `true` to override automatic detection of terminal truecolor support in the event of a false negative | `false` |
| `rulers` | List of column positions at which to display the rulers. Can be overridden by language specific `rulers` in `languages.toml` file | `[]` |
2022-09-02 06:39:38 +04:00
| `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` |
2022-06-30 13:26:00 +04:00
| `color-modes` | Whether to color the mode indicator with different colors depending on the mode itself | `false` |
2023-03-08 06:02:11 +04:00
| `text-width` | Maximum line length. Used for the `:reflow` command and soft-wrapping if `soft-wrap.wrap_at_text_width` is set | `80` |
2021-09-07 08:00:52 +04:00
2022-07-18 04:57:01 +04:00
### `[editor.statusline]` Section
Allows configuring the statusline at the bottom of the editor.
The configuration distinguishes between three areas of the status line:
`[ ... ... LEFT ... ... | ... ... ... ... CENTER ... ... ... ... | ... ... RIGHT ... ... ]`
Statusline elements can be defined as follows:
```toml
[editor.statusline]
left = ["mode", "spinner"]
center = ["file-name"]
2022-07-21 08:03:12 +04:00
right = ["diagnostics", "selections", "position", "file-encoding", "file-line-ending", "file-type"]
2022-07-27 03:47:22 +04:00
separator = "│"
2022-10-03 18:45:32 +04:00
mode.normal = "NORMAL"
mode.insert = "INSERT"
mode.select = "SELECT"
2022-07-18 04:57:01 +04:00
```
2022-10-03 18:45:32 +04:00
The `[editor.statusline]` key takes the following sub-keys:
2022-07-18 04:57:01 +04:00
2022-10-03 18:45:32 +04:00
| Key | Description | Default |
| --- | --- | --- |
| `left` | A list of elements aligned to the left of the statusline | `["mode", "spinner", "file-name"]` |
| `center` | A list of elements aligned to the middle of the statusline | `[]` |
| `right` | A list of elements aligned to the right of the statusline | `["diagnostics", "selections", "position", "file-encoding"]` |
| `separator` | The character used to separate elements in the statusline | `"│"` |
| `mode.normal` | The text shown in the `mode` element for normal mode | `"NOR"` |
| `mode.insert` | The text shown in the `mode` element for insert mode | `"INS"` |
| `mode.select` | The text shown in the `mode` element for select mode | `"SEL"` |
The following statusline elements can be configured:
2022-07-18 04:57:01 +04:00
| Key | Description |
| ------ | ----------- |
2022-10-03 18:45:32 +04:00
| `mode` | The current editor mode (`mode.normal`/`mode.insert`/`mode.select`) |
2022-07-18 04:57:01 +04:00
| `spinner` | A progress spinner indicating LSP activity |
| `file-name` | The path/name of the opened file |
2022-12-31 18:18:14 +04:00
| `file-base-name` | The basename of the opened file |
2023-03-04 21:34:17 +04:00
| `file-modification-indicator` | The indicator to show whether the file is modified (a `[+]` appears when there are unsaved changes) |
2022-07-18 04:57:01 +04:00
| `file-encoding` | The encoding of the opened file if it differs from UTF-8 |
2022-07-21 08:03:12 +04:00
| `file-line-ending` | The file line endings (CRLF or LF) |
2022-10-03 18:54:00 +04:00
| `total-line-numbers` | The total line numbers of the opened file |
2022-07-18 04:57:01 +04:00
| `file-type` | The type of the opened file |
| `diagnostics` | The number of warnings and/or errors |
2022-11-15 05:46:07 +04:00
| `workspace-diagnostics` | The number of warnings and/or errors on workspace |
2022-07-18 04:57:01 +04:00
| `selections` | The number of active selections |
2022-11-12 21:31:09 +04:00
| `primary-selection-length` | The number of characters currently in primary selection |
2022-07-18 04:57:01 +04:00
| `position` | The cursor position |
2022-07-26 10:05:12 +04:00
| `position-percentage` | The cursor position as a percentage of the total number of lines |
2022-07-27 03:47:22 +04:00
| `separator` | The string defined in `editor.statusline.separator` (defaults to `"│"` ) |
2022-07-26 05:07:59 +04:00
| `spacer` | Inserts a space between elements (multiple/contiguous spacers may be specified) |
2023-03-11 02:42:42 +04:00
| `version-control` | The current branch name or detached commit hash of the opened workspace |
2022-07-18 04:57:01 +04:00
2022-03-28 05:11:52 +04:00
### `[editor.lsp]` Section
2022-07-19 06:28:24 +04:00
| Key | Description | Default |
| --- | ----------- | ------- |
2022-08-16 18:58:13 +04:00
| `enable` | Enables LSP integration. Setting to false will completely disable language servers regardless of language settings.| `true` |
2022-07-19 06:28:24 +04:00
| `display-messages` | Display LSP progress messages below statusline[^1] | `false` |
| `auto-signature-help` | Enable automatic popup of signature help (parameter hints) | `true` |
| `display-signature-help-docs` | Display docs under signature help popup | `true` |
2022-03-28 05:11:52 +04:00
2022-07-18 04:57:01 +04:00
[^1]: By default, a progress spinner is shown in the statusline beside the file path.
2022-03-28 05:11:52 +04:00
2021-11-24 10:47:41 +04:00
### `[editor.cursor-shape]` Section
2023-03-06 13:27:17 +04:00
Defines the shape of cursor in each mode.
2022-07-15 18:51:34 +04:00
Valid values for these options are `block` , `bar` , `underline` , or `hidden` .
2021-11-24 10:47:41 +04:00
2023-03-06 13:27:17 +04:00
> 💡 Due to limitations of the terminal environment, only the primary cursor can
> change shape.
2021-11-29 09:39:04 +04:00
| Key | Description | Default |
| --- | ----------- | ------- |
| `normal` | Cursor shape in [normal mode][normal mode] | `block` |
| `insert` | Cursor shape in [insert mode][insert mode] | `block` |
| `select` | Cursor shape in [select mode][select mode] | `block` |
2021-11-24 10:47:41 +04:00
[normal mode]: ./keymap.md#normal-mode
[insert mode]: ./keymap.md#insert-mode
[select mode]: ./keymap.md#select--extend-mode
2022-01-09 09:08:58 +04:00
### `[editor.file-picker]` Section
2021-11-24 10:47:41 +04:00
2023-03-06 13:27:17 +04:00
Set options for file picker and global search. Ignoring a file means it is
not visible in the Helix file picker and global search.
2021-11-20 18:23:36 +04:00
2022-08-14 22:36:08 +04:00
All git related options are only enabled in a git repository.
2021-11-20 18:23:36 +04:00
| Key | Description | Default |
|--|--|---------|
2023-03-06 13:27:17 +04:00
|`hidden` | Enables ignoring hidden files | true
2023-02-02 21:14:02 +04:00
|`follow-links` | Follow symlinks instead of ignoring them | true
|`deduplicate-links` | Ignore symlinks that point at files already shown in the picker | true
2023-03-06 13:27:17 +04:00
|`parents` | Enables reading ignore files from parent directories | true
|`ignore` | Enables reading `.ignore` files | true
|`git-ignore` | Enables reading `.gitignore` files | true
|`git-global` | Enables reading global `.gitignore` , whose path is specified in git's config: `core.excludefile` option | true
|`git-exclude` | Enables reading `.git/info/exclude` files | true
|`max-depth` | Set with an integer value for maximum depth to recurse | Defaults to `None` .
2021-11-20 18:23:36 +04:00
2022-02-25 12:36:54 +04:00
### `[editor.auto-pairs]` Section
2022-05-04 06:16:34 +04:00
Enables automatic insertion of pairs to parentheses, brackets, etc. Can be a
simple boolean value, or a specific mapping of pairs of single characters.
2022-02-25 12:36:54 +04:00
2022-05-04 06:16:34 +04:00
To disable auto-pairs altogether, set `auto-pairs` to `false` :
2022-02-25 12:36:54 +04:00
2022-05-04 06:16:34 +04:00
```toml
[editor]
auto-pairs = false # defaults to `true`
```
The default pairs are < code > (){}[]''""``< / code > , but these can be customized by
setting `auto-pairs` to a TOML table:
2022-02-25 12:36:54 +04:00
```toml
[editor.auto-pairs]
'(' = ')'
'{' = '}'
'[' = ']'
'"' = '"'
'`' = '`'
'< ' = '>'
```
Additionally, this setting can be used in a language config. Unless
the editor setting is `false` , this will override the editor config in
documents with this language.
Example `languages.toml` that adds < > and removes ''
```toml
[[language]]
name = "rust"
[language.auto-pairs]
'(' = ')'
'{' = '}'
'[' = ']'
'"' = '"'
'`' = '`'
'< ' = '>'
```
2022-03-01 05:06:14 +04:00
### `[editor.search]` Section
Search specific options.
| Key | Description | Default |
|--|--|---------|
2023-03-06 13:27:17 +04:00
| `smart-case` | Enable smart case regex searching (case-insensitive unless pattern contains upper case characters) | `true` |
2022-03-01 05:06:14 +04:00
| `wrap-around` | Whether the search should wrap after depleting the matches | `true` |
2021-12-02 02:59:23 +04:00
### `[editor.whitespace]` Section
Options for rendering whitespace with visible characters. Use `:set whitespace.render all` to temporarily enable visible whitespace.
| Key | Description | Default |
|-----|-------------|---------|
2023-03-06 13:27:17 +04:00
| `render` | Whether to render whitespace. May either be `"all"` or `"none"` , or a table with sub-keys `space` , `nbsp` , `tab` , and `newline` | `"none"` |
2022-08-21 08:54:02 +04:00
| `characters` | Literal characters to use when rendering whitespace. Sub-keys may be any of `tab` , `space` , `nbsp` , `newline` or `tabpad` | See example below |
2021-12-02 02:59:23 +04:00
Example
```toml
[editor.whitespace]
render = "all"
# or control each character
[editor.whitespace.render]
space = "all"
tab = "all"
newline = "none"
[editor.whitespace.characters]
space = "·"
2022-04-30 04:48:52 +04:00
nbsp = "⍽"
2021-12-02 02:59:23 +04:00
tab = "→"
newline = "⏎"
2022-08-21 08:54:02 +04:00
tabpad = "·" # Tabs will look like "→···" (depending on tab width)
2021-12-02 02:59:23 +04:00
```
2022-05-31 21:13:08 +04:00
### `[editor.indent-guides]` Section
Options for rendering vertical indent guides.
2022-10-03 19:07:04 +04:00
| Key | Description | Default |
| --- | --- | --- |
2023-03-06 13:27:17 +04:00
| `render` | Whether to render indent guides | `false` |
2022-10-03 19:07:04 +04:00
| `character` | Literal character to use for rendering the indent guide | `│` |
| `skip-levels` | Number of indent levels to skip | `0` |
2022-05-31 21:13:08 +04:00
Example:
```toml
[editor.indent-guides]
render = true
2022-10-11 01:23:14 +04:00
character = "╎" # Some characters that work well: "▏", "┆", "┊", "⸽"
2022-10-03 19:07:04 +04:00
skip-levels = 1
2022-05-31 21:13:08 +04:00
```
2023-01-22 00:20:59 +04:00
### `[editor.gutters]` Section
For simplicity, `editor.gutters` accepts an array of gutter types, which will
use default settings for all gutter components.
```toml
[editor]
gutters = ["diff", "diagnostics", "line-numbers", "spacer"]
```
To customize the behavior of gutters, the `[editor.gutters]` section must
be used. This section contains top level settings, as well as settings for
2023-03-06 13:27:17 +04:00
specific gutter components as subsections.
2023-01-22 00:20:59 +04:00
| Key | Description | Default |
| --- | --- | --- |
| `layout` | A vector of gutters to display | `["diagnostics", "spacer", "line-numbers", "spacer", "diff"]` |
Example:
```toml
[editor.gutters]
layout = ["diff", "diagnostics", "line-numbers", "spacer"]
```
#### `[editor.gutters.line-numbers]` Section
Options for the line number gutter
| Key | Description | Default |
| --- | --- | --- |
| `min-width` | The minimum number of characters to use | `3` |
Example:
```toml
[editor.gutters.line-numbers]
min-width = 1
```
#### `[editor.gutters.diagnotics]` Section
Currently unused
#### `[editor.gutters.diff]` Section
Currently unused
#### `[editor.gutters.spacer]` Section
2023-01-31 21:03:19 +04:00
Currently unused
### `[editor.soft-wrap]` Section
2023-03-06 13:27:17 +04:00
Options for soft wrapping lines that exceed the view width:
2023-01-31 21:03:19 +04:00
2023-03-08 06:02:11 +04:00
| Key | Description | Default |
| --- | --- | --- |
| `enable` | Whether soft wrapping is enabled. | `false` |
| `max-wrap` | Maximum free space left at the end of the line. | `20` |
| `max-indent-retain` | Maximum indentation to carry over when soft wrapping a line. | `40` |
| `wrap-indicator` | Text inserted before soft wrapped lines, highlighted with `ui.virtual.wrap` | `↪ ` |
| `wrap-at-text-width` | Soft wrap at `text-width` instead of using the full viewport size. | `false` |
2023-01-31 21:03:19 +04:00
Example:
```toml
[editor.soft-wrap]
enable = true
max-wrap = 25 # increase value to reduce forced mid-word wrapping
max-indent-retain = 0
wrap-indicator = "" # set wrap-indicator to "" to hide it
```