diff --git a/master/configuration.html b/master/configuration.html
index e51cb19d2..692d5e957 100644
--- a/master/configuration.html
+++ b/master/configuration.html
@@ -189,16 +189,16 @@
๐ก You can easily open the config file by typing :config-open
within Helix normal mode.
Example config:
-theme = "onedark"
+theme = "onedark"
[editor]
-line-number = "relative"
+line-number = "relative"
mouse = false
[editor.cursor-shape]
-insert = "bar"
-normal = "block"
-select = "underline"
+insert = "bar"
+normal = "block"
+select = "underline"
[editor.file-picker]
hidden = false
@@ -216,11 +216,11 @@ Its settings will be merged with the configuration directory config.toml
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"] Windows: ["cmd", "/C"] |
+shell | Shell to use when running external commands | Unix: ["sh", "-c"] 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 |
-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"] |
+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"] |
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 from your terminal | false |
@@ -249,23 +249,23 @@ Its settings will be merged with the configuration directory config.toml
[ ... ... LEFT ... ... | ... ... ... ... CENTER ... ... ... ... | ... ... RIGHT ... ... ]
Statusline elements can be defined as follows:
[editor.statusline]
-left = ["mode", "spinner"]
-center = ["file-name"]
-right = ["diagnostics", "selections", "position", "file-encoding", "file-line-ending", "file-type"]
-separator = "โ"
-mode.normal = "NORMAL"
-mode.insert = "INSERT"
-mode.select = "SELECT"
+left = ["mode", "spinner"]
+center = ["file-name"]
+right = ["diagnostics", "selections", "position", "file-encoding", "file-line-ending", "file-type"]
+separator = "โ"
+mode.normal = "NORMAL"
+mode.insert = "INSERT"
+mode.select = "SELECT"
The [editor.statusline]
key takes the following sub-keys:
Key | Description | Default |
-left | A list of elements aligned to the left of the statusline | ["mode", "spinner", "file-name", "read-only-indicator", "file-modification-indicator"] |
+left | A list of elements aligned to the left of the statusline | ["mode", "spinner", "file-name", "read-only-indicator", "file-modification-indicator"] |
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", "register", "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" |
+right | A list of elements aligned to the right of the statusline | ["diagnostics", "selections", "register", "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:
@@ -286,7 +286,7 @@ mode.select = "SELECT"
primary-selection-length | The number of characters currently in primary selection |
position | The cursor position |
position-percentage | The cursor position as a percentage of the total number of lines |
-separator | The string defined in editor.statusline.separator (defaults to "โ" ) |
+separator | The string defined in editor.statusline.separator (defaults to "โ" ) |
spacer | Inserts a space between elements (multiple/contiguous spacers may be specified) |
version-control | The current branch name or detached commit hash of the opened workspace |
register | The current selected register |
@@ -357,13 +357,13 @@ simple boolean value, or a specific mapping of pairs of single characters.
[editor]
auto-pairs = false # defaults to `true`
-The default pairs are (){}[]''""``
, but these can be customized by
+
The default pairs are (){}[]''""``
, but these can be customized by
setting auto-pairs
to a TOML table:
[editor.auto-pairs]
'(' = ')'
'{' = '}'
'[' = ']'
-'"' = '"'
+'"' = '"'
'`' = '`'
'<' = '>'
@@ -372,13 +372,13 @@ the editor setting is false
, this will override the editor config i
documents with this language.
Example languages.toml
that adds <> and removes ''
[[language]]
-name = "rust"
+name = "rust"
[language.auto-pairs]
'(' = ')'
'{' = '}'
'[' = ']'
-'"' = '"'
+'"' = '"'
'`' = '`'
'<' = '>'
@@ -392,25 +392,25 @@ name = "rust"
Options for rendering whitespace with visible characters. Use :set whitespace.render all
to temporarily enable visible whitespace.
Key | Description | Default |
-render | Whether to render whitespace. May either be "all" or "none" , or a table with sub-keys space , nbsp , tab , and newline | "none" |
+render | Whether to render whitespace. May either be "all" or "none" , or a table with sub-keys space , nbsp , tab , and newline | "none" |
characters | Literal characters to use when rendering whitespace. Sub-keys may be any of tab , space , nbsp , newline or tabpad | See example below |
Example
[editor.whitespace]
-render = "all"
+render = "all"
# or control each character
[editor.whitespace.render]
-space = "all"
-tab = "all"
-newline = "none"
+space = "all"
+tab = "all"
+newline = "none"
[editor.whitespace.characters]
-space = "ยท"
-nbsp = "โฝ"
-tab = "โ"
-newline = "โ"
-tabpad = "ยท" # Tabs will look like "โยทยทยท" (depending on tab width)
+space = "ยท"
+nbsp = "โฝ"
+tab = "โ"
+newline = "โ"
+tabpad = "ยท" # Tabs will look like "โยทยทยท" (depending on tab width)
Options for rendering vertical indent guides.
@@ -423,25 +423,25 @@ tabpad = "ยท" # Tabs will look like "โยทยทยท" (depending o
Example:
[editor.indent-guides]
render = true
-character = "โ" # Some characters that work well: "โ", "โ", "โ", "โธฝ"
+character = "โ" # Some characters that work well: "โ", "โ", "โ", "โธฝ"
skip-levels = 1
For simplicity, editor.gutters
accepts an array of gutter types, which will
use default settings for all gutter components.
[editor]
-gutters = ["diff", "diagnostics", "line-numbers", "spacer"]
+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
specific gutter components as subsections.
Key | Description | Default |
-layout | A vector of gutters to display | ["diagnostics", "spacer", "line-numbers", "spacer", "diff"] |
+layout | A vector of gutters to display | ["diagnostics", "spacer", "line-numbers", "spacer", "diff"] |
Example:
[editor.gutters]
-layout = ["diff", "diagnostics", "line-numbers", "spacer"]
+layout = ["diff", "diagnostics", "line-numbers", "spacer"]
Options for the line number gutter
@@ -474,7 +474,7 @@ min-width = 1
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
+wrap-indicator = "" # set wrap-indicator to "" to hide it
Key | Description | Default |
diff --git a/master/guides/indent.html b/master/guides/indent.html
index 58824e75c..0d6b14275 100644
--- a/master/guides/indent.html
+++ b/master/guides/indent.html
@@ -291,7 +291,7 @@ actually have been extended).
// 3x @outdent
}
((block) @indent)
-["}" ")"] @outdent
+["}" ")"] @outdent
Note how on the second line, we have two blocks begin on the same line. In this
case, since both captures occur on the same line, they are combined and only
@@ -331,7 +331,7 @@ whitespace-sensitive.
the cursor on a line feed ends up being the entire inside of the class. Because
of this, it will miss the entire function node and its indent capture, leading
to an indent level one too small.
-To address this case, @extend
tells helix to "extend" the captured node's span
+
To address this case, @extend
tells helix to "extend" the captured node's span
to the line feed and every consecutive line that has a greater indent level than
the line of the node.
(parenthesized_expression) @indent
@@ -439,7 +439,7 @@ similar to how #set!
declarations work:
)
The number of arguments depends on the predicate that's used.
-Each argument is either a capture (@name
) or a string ("some string"
).
+Each argument is either a capture (@name
) or a string ("some string"
).
The following predicates are supported by tree-sitter:
-
@@ -491,21 +491,21 @@ This scope applies to the whole captured node. This is only different from
#![allow(unused)]
fn main() {
fn aha() { // โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
- let take = "on me"; // โโโโโโโโโโโโโโโโฎ scope: โ
- let take = "me on"; // โโ "tail" โโ (block) @indent
+ let take = "on me"; // โโโโโโโโโโโโโโโโฎ scope: โ
+ let take = "me on"; // โโ "tail" โโ (block) @indent
let ill = be_gone_days(1 || 2); // โ โ
-} // โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโ "}" @outdent
- // scope: "all"
+} // โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโ "}" @outdent
+ // scope: "all"
}
We can write the following query with the #set!
declaration:
((block) @indent
- (#set! "scope" "tail"))
-("}" @outdent
- (#set! "scope" "all"))
+ (#set! "scope" "tail"))
+("}" @outdent
+ (#set! "scope" "all"))
-As we can see, the "tail" scope covers the node, except for the first line.
+
As we can see, the "tail" scope covers the node, except for the first line.
Everything up to and including the closing brace gets an indent level of 1.
-Then, on the closing brace, we encounter an outdent with a scope of "all", which
+Then, on the closing brace, we encounter an outdent with a scope of "all", which
means the first line is included, and the indent level is cancelled out on this
line. (Note these scopes are the defaults for @indent
and @outdent
โthey are
written explicitly for demonstration.)
diff --git a/master/guides/injection.html b/master/guides/injection.html
index 3535352ee..301f576e1 100644
--- a/master/guides/injection.html
+++ b/master/guides/injection.html
@@ -185,7 +185,7 @@ In addition to the ((string_expression (string_fragment) @injection.content)
- (#set! injection.language "bash"))
+ (#set! injection.language "bash"))
diff --git a/master/install.html b/master/install.html
index c250bdb8e..4009216ac 100644
--- a/master/install.html
+++ b/master/install.html
@@ -324,7 +324,7 @@ Linux and macOS, or %userprofile%\src\
on Windows.
- A C++14 compatible compiler to build the tree-sitter grammars, for example GCC or Clang
If you are using the musl-libc
standard library instead of glibc
the following environment variable must be set during the build to ensure tree-sitter grammars can be loaded correctly:
-RUSTFLAGS="-C target-feature=-crt-static"
+RUSTFLAGS="-C target-feature=-crt-static"
-
@@ -366,7 +366,7 @@ your
~/.bashrc
or equivalent:
Either set the HELIX_RUNTIME
environment variable to point to the runtime files using the Windows setting (search for
Edit environment variables for your account
) or use the setx
command in
Cmd:
-setx HELIX_RUNTIME "%userprofile%\source\repos\helix\runtime"
+setx HELIX_RUNTIME "%userprofile%\source\repos\helix\runtime"
๐ก %userprofile%
resolves to your user directory like
@@ -374,8 +374,8 @@ Cmd:
Or, create a symlink in %appdata%\helix\
that links to the source code directory:
Method | Command |
-PowerShell | New-Item -ItemType Junction -Target "runtime" -Path "$Env:AppData\helix\runtime" |
-Cmd | cd %appdata%\helix mklink /D runtime "%userprofile%\src\helix\runtime" |
+PowerShell | New-Item -ItemType Junction -Target "runtime" -Path "$Env:AppData\helix\runtime" |
+Cmd | cd %appdata%\helix mklink /D runtime "%userprofile%\src\helix\runtime" |
@@ -429,8 +429,8 @@ cp contrib/helix.png ~/.icons # or ~/.local/share/icons
To use another terminal than the system default, you can modify the .desktop
file. For example, to use kitty
:
-sed -i "s|Exec=hx %F|Exec=kitty hx %F|g" ~/.local/share/applications/Helix.desktop
-sed -i "s|Terminal=true|Terminal=false|g" ~/.local/share/applications/Helix.desktop
+sed -i "s|Exec=hx %F|Exec=kitty hx %F|g" ~/.local/share/applications/Helix.desktop
+sed -i "s|Terminal=true|Terminal=false|g" ~/.local/share/applications/Helix.desktop
diff --git a/master/keymap.html b/master/keymap.html
index 53a3cc397..13b18cbbf 100644
--- a/master/keymap.html
+++ b/master/keymap.html
@@ -273,7 +273,7 @@
y | Yank selection | yank |
p | Paste after selection | paste_after |
P | Paste before selection | paste_before |
-" <reg> | Select a register to yank to or paste from | select_register |
+" <reg> | Select a register to yank to or paste from | select_register |
> | Indent selection | indent |
< | Unindent selection | unindent |
= | Format selection (currently nonfunctional/disabled) (LSP) | format_selections |
@@ -332,7 +332,7 @@
-Search commands all operate on the /
register by default. To use a different register, use "<char>
.
+Search commands all operate on the /
register by default. To use a different register, use "<char>
.
Key | Description | Command |
/ | Search for regex pattern | search |
? | Search for previous pattern | rsearch |
@@ -359,7 +359,7 @@
Accessed by typing z
in normal mode.
View mode is intended for scrolling and manipulating the view without changing
-the selection. The "sticky" variant of this mode (accessed by typing Z
in
+the selection. The "sticky" variant of this mode (accessed by typing Z
in
normal mode) is persistent and can be exited using the escape key. This is
useful when you're simply looking over text and not actively editing it.
Key | Description | Command |
@@ -541,14 +541,14 @@ with modal editors.
As you become more comfortable with modal editing, you may want to disable some
insert mode bindings. You can do this by editing your config.toml
file.
[keys.insert]
-up = "no_op"
-down = "no_op"
-left = "no_op"
-right = "no_op"
-pageup = "no_op"
-pagedown = "no_op"
-home = "no_op"
-end = "no_op"
+up = "no_op"
+down = "no_op"
+left = "no_op"
+right = "no_op"
+pageup = "no_op"
+pagedown = "no_op"
+home = "no_op"
+end = "no_op"
Accessed by typing v
in normal mode.
diff --git a/master/languages.html b/master/languages.html
index 045767091..c2e41af2c 100644
--- a/master/languages.html
+++ b/master/languages.html
@@ -197,10 +197,10 @@ auto-LSP-formatting in Rust:
# in <config_dir>/helix/languages.toml
[language-server.mylang-lsp]
-command = "mylang-lsp"
+command = "mylang-lsp"
[[language]]
-name = "rust"
+name = "rust"
auto-format = false
@@ -215,14 +215,14 @@ in the configuration directory and the built-in configuration.
Each language is configured by adding a [[language]]
section to a
languages.toml
file. For example:
[[language]]
-name = "mylang"
-scope = "source.mylang"
-injection-regex = "mylang"
-file-types = ["mylang", "myl"]
-comment-token = "#"
-indent = { tab-width = 2, unit = " " }
-formatter = { command = "mylang-formatter" , args = ["--stdin"] }
-language-servers = [ "mylang-lsp" ]
+name = "mylang"
+scope = "source.mylang"
+injection-regex = "mylang"
+file-types = ["mylang", "myl"]
+comment-token = "#"
+indent = { tab-width = 2, unit = " " }
+formatter = { command = "mylang-formatter" , args = ["--stdin"] }
+language-servers = [ "mylang-lsp" ]
These configuration keys are available:
Key | Description |
@@ -230,13 +230,13 @@ language-servers = [ "mylang-lsp" ]
language-id | The language-id for language servers, checkout the table at TextDocumentItem for the right id |
scope | A string like source.js that identifies the language. Currently, we strive to match the scope names used by popular TextMate grammars and by the Linguist library. Usually source.<name> or text.<name> in case of markup languages |
injection-regex | regex pattern that will be tested against a language name in order to determine whether this language should be used for a potential language injection site. |
-file-types | The filetypes of the language, for example ["yml", "yaml"] . See the file-type detection section below. |
-shebangs | The interpreters from the shebang line, for example ["sh", "bash"] |
+file-types | The filetypes of the language, for example ["yml", "yaml"] . See the file-type detection section below. |
+shebangs | The interpreters from the shebang line, for example ["sh", "bash"] |
roots | A set of marker files to look for when trying to find the workspace root. For example Cargo.lock , yarn.lock |
auto-format | Whether to autoformat this language when saving |
diagnostic-severity | Minimal severity of diagnostic for it to be displayed. (Allowed values: Error , Warning , Info , Hint ) |
comment-token | The token to use as a comment-token |
-indent | The indent to use. Has sub keys unit (the text inserted into the document when indenting; usually set to N spaces or "\t" for tabs) and tab-width (the number of spaces rendered for a tab) |
+indent | The indent to use. Has sub keys unit (the text inserted into the document when indenting; usually set to N spaces or "\t" for tabs) and tab-width (the number of spaces rendered for a tab) |
language-servers | The Language Servers used for this language. See below for more information in the section Configuring Language Servers for a language |
grammar | The tree-sitter grammar to use (defaults to the value of name ) |
formatter | The formatter for the language, it will take precedence over the lsp when defined. The formatter must be able to take the original file as input from stdin and write the formatted file to stdout |
@@ -250,20 +250,20 @@ language-servers = [ "mylang-lsp" ]
Helix determines which language configuration to use based on the file-types
key
from the above section. file-types
is a list of strings or tables, for
example:
-file-types = ["Makefile", "toml", { suffix = ".git/config" }]
+file-types = ["Makefile", "toml", { suffix = ".git/config" }]
When determining a language configuration to use, Helix searches the file-types
with the following priorities:
- Exact match: if the filename of a file is an exact match of a string in a
-
file-types
list, that language wins. In the example above, "Makefile"
+file-types
list, that language wins. In the example above, "Makefile"
will match against Makefile
files.
- Extension: if there are no exact matches, any
file-types
string that
matches the file extension of a given file wins. In the example above, the
-"toml"
matches files like Cargo.toml
or languages.toml
.
+"toml"
matches files like Cargo.toml
or languages.toml
.
- Suffix: if there are still no matches, any values in
suffix
tables
are checked against the full path of the given file. In the example above,
-the { suffix = ".git/config" }
would match against any config
files
+the { suffix = ".git/config" }
would match against any config
files
in .git
directories. Note: /
is used as the directory separator but is
replaced at runtime with the appropriate path separator for the operating
system, so this rule would match against .git\config
files on Windows.
@@ -272,17 +272,17 @@ system, so this rule would match against .git\config
files on Windo
Language servers are configured separately in the table language-server
in the same file as the languages languages.toml
For example:
[language-server.mylang-lsp]
-command = "mylang-lsp"
-args = ["--stdio"]
+command = "mylang-lsp"
+args = ["--stdio"]
config = { provideFormatter = true }
-environment = { "ENV1" = "value1", "ENV2" = "value2" }
+environment = { "ENV1" = "value1", "ENV2" = "value2" }
[language-server.efm-lsp-prettier]
-command = "efm-langserver"
+command = "efm-langserver"
[language-server.efm-lsp-prettier.config]
documentFormatting = true
-languages = { typescript = [ { formatCommand ="prettier --stdin-filepath ${INPUT}", formatStdin = true } ] }
+languages = { typescript = [ { formatCommand ="prettier --stdin-filepath ${INPUT}", formatStdin = true } ] }
These are the available options for a language server.
Key | Description |
@@ -290,15 +290,15 @@ languages = { typescript = [ { formatCommand ="prettier --stdin-filepath ${
args | A list of arguments to pass to the language server binary |
config | LSP initialization options |
timeout | The maximum time a request to the language server may take, in seconds. Defaults to 20 |
-environment | Any environment variables that will be used when starting the language server { "KEY1" = "Value1", "KEY2" = "Value2" } |
+environment | Any environment variables that will be used when starting the language server { "KEY1" = "Value1", "KEY2" = "Value2" } |
A format
sub-table within config
can be used to pass extra formatting options to
Document Formatting Requests.
For example, with typescript:
[language-server.typescript-language-server]
-# pass format options according to https://github.com/typescript-language-server/typescript-language-server#workspacedidchangeconfiguration omitting the "[language].format." prefix.
-config = { format = { "semicolons" = "insert", "insertSpaceBeforeFunctionParenthesis" = true } }
+# pass format options according to https://github.com/typescript-language-server/typescript-language-server#workspacedidchangeconfiguration omitting the "[language].format." prefix.
+config = { format = { "semicolons" = "insert", "insertSpaceBeforeFunctionParenthesis" = true } }
The language-servers
attribute in a language tells helix which language servers are used for this language.
@@ -310,13 +310,13 @@ it's often useful to only enable/disable certain language-server features for th
so everything else should be handled by the typescript-language-server
(which is configured by default).
The language configuration for typescript could look like this:
[[language]]
-name = "typescript"
-language-servers = [ { name = "efm-lsp-prettier", only-features = [ "format" ] }, "typescript-language-server" ]
+name = "typescript"
+language-servers = [ { name = "efm-lsp-prettier", only-features = [ "format" ] }, "typescript-language-server" ]
or equivalent:
[[language]]
-name = "typescript"
-language-servers = [ { name = "typescript-language-server", except-features = [ "format" ] }, "efm-lsp-prettier" ]
+name = "typescript"
+language-servers = [ { name = "typescript-language-server", except-features = [ "format" ] }, "efm-lsp-prettier" ]
Each requested LSP feature is prioritized in the order of the language-servers
array.
For example, the first goto-definition
supported language server (in this case typescript-language-server
) will be taken for the relevant LSP request (command goto_definition
).
@@ -347,8 +347,8 @@ If a language server itself doesn't support a feature, the next language server
The source for a language's tree-sitter grammar is specified in a [[grammar]]
section in languages.toml
. For example:
[[grammar]]
-name = "mylang"
-source = { git = "https://github.com/example/mylang", rev = "a250c4582510ff34767ec3b7dcdd3c24e8c8aa68" }
+name = "mylang"
+source = { git = "https://github.com/example/mylang", rev = "a250c4582510ff34767ec3b7dcdd3c24e8c8aa68" }
Grammar configuration takes these keys:
Key | Description |
@@ -368,9 +368,9 @@ git repository:
You may use a top-level use-grammars
key to control which grammars are
fetched and built when using hx --grammar fetch
and hx --grammar build
.
# Note: this key must come **before** the [[language]] and [[grammar]] sections
-use-grammars = { only = [ "rust", "c", "cpp" ] }
+use-grammars = { only = [ "rust", "c", "cpp" ] }
# or
-use-grammars = { except = [ "yaml", "json" ] }
+use-grammars = { except = [ "yaml", "json" ] }
When omitted, all grammars are fetched and built.
diff --git a/master/print.html b/master/print.html
index deb7cffdd..2829337a6 100644
--- a/master/print.html
+++ b/master/print.html
@@ -330,7 +330,7 @@ Linux and macOS, or %userprofile%\src\
on Windows.
- A C++14 compatible compiler to build the tree-sitter grammars, for example GCC or Clang
If you are using the musl-libc
standard library instead of glibc
the following environment variable must be set during the build to ensure tree-sitter grammars can be loaded correctly:
-RUSTFLAGS="-C target-feature=-crt-static"
+RUSTFLAGS="-C target-feature=-crt-static"
-
@@ -372,7 +372,7 @@ your
~/.bashrc
or equivalent:
Either set the HELIX_RUNTIME
environment variable to point to the runtime files using the Windows setting (search for
Edit environment variables for your account
) or use the setx
command in
Cmd:
-setx HELIX_RUNTIME "%userprofile%\source\repos\helix\runtime"
+setx HELIX_RUNTIME "%userprofile%\source\repos\helix\runtime"
๐ก %userprofile%
resolves to your user directory like
@@ -380,8 +380,8 @@ Cmd:
Or, create a symlink in %appdata%\helix\
that links to the source code directory:
Method | Command |
-PowerShell | New-Item -ItemType Junction -Target "runtime" -Path "$Env:AppData\helix\runtime" |
-Cmd | cd %appdata%\helix mklink /D runtime "%userprofile%\src\helix\runtime" |
+PowerShell | New-Item -ItemType Junction -Target "runtime" -Path "$Env:AppData\helix\runtime" |
+Cmd | cd %appdata%\helix mklink /D runtime "%userprofile%\src\helix\runtime" |
@@ -435,8 +435,8 @@ cp contrib/helix.png ~/.icons # or ~/.local/share/icons
To use another terminal than the system default, you can modify the .desktop
file. For example, to use kitty
:
-sed -i "s|Exec=hx %F|Exec=kitty hx %F|g" ~/.local/share/applications/Helix.desktop
-sed -i "s|Terminal=true|Terminal=false|g" ~/.local/share/applications/Helix.desktop
+sed -i "s|Exec=hx %F|Exec=kitty hx %F|g" ~/.local/share/applications/Helix.desktop
+sed -i "s|Terminal=true|Terminal=false|g" ~/.local/share/applications/Helix.desktop
@@ -463,19 +463,19 @@ can be accessed via the command hx --tutor
or :tutor
.<
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
+to the clipboard in other text editors. Usage is similar to Vim, with "
being
used to select a register.
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.
+"ay
- Yank the current selection to register a
.
+"op
- Paste the text in register o
after the selection.
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.
+"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.
Commands that use registers, like yank (y
), use a default register if none is specified.
@@ -483,7 +483,7 @@ These registers are used as defaults:
Register character | Contains |
/ | Last search |
: | Last executed command |
-" | Last yanked text |
+" | Last yanked text |
@ | Last recorded macro |
@@ -565,7 +565,7 @@ documentation.
and requires the corresponding query file to work properly.
-Alt-p
, Alt-o
, Alt-i
, and Alt-n
(or Alt
and arrow keys) allow you to move the
+
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:
func(arg1, arg2, arg3);
@@ -587,12 +587,12 @@ a more intuitive tree format:
โ โ
โโโโโโโผโโโโโ โโโโโโผโโโโโ
โidentifierโ โargumentsโ
-โ "func" โ โโโโโโดโโโโฌโโโโโโดโโโโ
+โ "func" โ โโโโโโดโโโโฌโโโโโโดโโโโ
โโโโโโโโโโโโ โ โ โ
โ โ โ
โโโโโโโโโโโผโ โโโโโโผโโโโโโ โโผโโโโโโโโโโ
โidentifierโ โidentifierโ โidentifierโ
- โ "arg1" โ โ "arg2" โ โ "arg3" โ
+ โ "arg1" โ โ "arg2" โ โ "arg3" โ
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
If you have a selection that wraps arg1
(see the tree above), and you use
@@ -611,7 +611,7 @@ node with no sibling. When using Alt-p
with a selection on ar
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
.
+selection to the "func" identifier
.
- Normal mode
@@ -706,7 +706,7 @@ selection to the "func"
identifier
.
y | Yank selection | yank |
p | Paste after selection | paste_after |
P | Paste before selection | paste_before |
-" <reg> | Select a register to yank to or paste from | select_register |
+" <reg> | Select a register to yank to or paste from | select_register |
> | Indent selection | indent |
< | Unindent selection | unindent |
= | Format selection (currently nonfunctional/disabled) (LSP) | format_selections |
@@ -765,7 +765,7 @@ selection to the "func" identifier
.
-Search commands all operate on the /
register by default. To use a different register, use "<char>
.
+Search commands all operate on the /
register by default. To use a different register, use "<char>
.
Key | Description | Command |
/ | Search for regex pattern | search |
? | Search for previous pattern | rsearch |
@@ -792,7 +792,7 @@ selection to the "func" identifier
.
Accessed by typing z
in normal mode.
View mode is intended for scrolling and manipulating the view without changing
-the selection. The "sticky" variant of this mode (accessed by typing Z
in
+the selection. The "sticky" variant of this mode (accessed by typing Z
in
normal mode) is persistent and can be exited using the escape key. This is
useful when you're simply looking over text and not actively editing it.
Key | Description | Command |
@@ -974,14 +974,14 @@ with modal editors.
As you become more comfortable with modal editing, you may want to disable some
insert mode bindings. You can do this by editing your config.toml
file.
[keys.insert]
-up = "no_op"
-down = "no_op"
-left = "no_op"
-right = "no_op"
-pageup = "no_op"
-pagedown = "no_op"
-home = "no_op"
-end = "no_op"
+up = "no_op"
+down = "no_op"
+left = "no_op"
+right = "no_op"
+pageup = "no_op"
+pagedown = "no_op"
+home = "no_op"
+end = "no_op"
Accessed by typing v
in normal mode.
@@ -1348,16 +1348,16 @@ single width selection.
๐ก You can easily open the config file by typing :config-open
within Helix normal mode.
Example config:
-theme = "onedark"
+theme = "onedark"
[editor]
-line-number = "relative"
+line-number = "relative"
mouse = false
[editor.cursor-shape]
-insert = "bar"
-normal = "block"
-select = "underline"
+insert = "bar"
+normal = "block"
+select = "underline"
[editor.file-picker]
hidden = false
@@ -1375,11 +1375,11 @@ Its settings will be merged with the configuration directory config.toml
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"] Windows: ["cmd", "/C"] |
+shell | Shell to use when running external commands | Unix: ["sh", "-c"] 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 |
-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"] |
+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"] |
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 from your terminal | false |
@@ -1408,23 +1408,23 @@ Its settings will be merged with the configuration directory config.toml
[ ... ... LEFT ... ... | ... ... ... ... CENTER ... ... ... ... | ... ... RIGHT ... ... ]
Statusline elements can be defined as follows:
[editor.statusline]
-left = ["mode", "spinner"]
-center = ["file-name"]
-right = ["diagnostics", "selections", "position", "file-encoding", "file-line-ending", "file-type"]
-separator = "โ"
-mode.normal = "NORMAL"
-mode.insert = "INSERT"
-mode.select = "SELECT"
+left = ["mode", "spinner"]
+center = ["file-name"]
+right = ["diagnostics", "selections", "position", "file-encoding", "file-line-ending", "file-type"]
+separator = "โ"
+mode.normal = "NORMAL"
+mode.insert = "INSERT"
+mode.select = "SELECT"
The [editor.statusline]
key takes the following sub-keys:
Key | Description | Default |
-left | A list of elements aligned to the left of the statusline | ["mode", "spinner", "file-name", "read-only-indicator", "file-modification-indicator"] |
+left | A list of elements aligned to the left of the statusline | ["mode", "spinner", "file-name", "read-only-indicator", "file-modification-indicator"] |
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", "register", "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" |
+right | A list of elements aligned to the right of the statusline | ["diagnostics", "selections", "register", "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:
@@ -1445,7 +1445,7 @@ mode.select = "SELECT"
primary-selection-length | The number of characters currently in primary selection |
position | The cursor position |
position-percentage | The cursor position as a percentage of the total number of lines |
-separator | The string defined in editor.statusline.separator (defaults to "โ" ) |
+separator | The string defined in editor.statusline.separator (defaults to "โ" ) |
spacer | Inserts a space between elements (multiple/contiguous spacers may be specified) |
version-control | The current branch name or detached commit hash of the opened workspace |
register | The current selected register |
@@ -1516,13 +1516,13 @@ simple boolean value, or a specific mapping of pairs of single characters.
[editor]
auto-pairs = false # defaults to `true`
-The default pairs are (){}[]''""``
, but these can be customized by
+
The default pairs are (){}[]''""``
, but these can be customized by
setting auto-pairs
to a TOML table:
[editor.auto-pairs]
'(' = ')'
'{' = '}'
'[' = ']'
-'"' = '"'
+'"' = '"'
'`' = '`'
'<' = '>'
@@ -1531,13 +1531,13 @@ the editor setting is false
, this will override the editor config i
documents with this language.
Example languages.toml
that adds <> and removes ''
[[language]]
-name = "rust"
+name = "rust"
[language.auto-pairs]
'(' = ')'
'{' = '}'
'[' = ']'
-'"' = '"'
+'"' = '"'
'`' = '`'
'<' = '>'
@@ -1551,25 +1551,25 @@ name = "rust"
Options for rendering whitespace with visible characters. Use :set whitespace.render all
to temporarily enable visible whitespace.
Key | Description | Default |
-render | Whether to render whitespace. May either be "all" or "none" , or a table with sub-keys space , nbsp , tab , and newline | "none" |
+render | Whether to render whitespace. May either be "all" or "none" , or a table with sub-keys space , nbsp , tab , and newline | "none" |
characters | Literal characters to use when rendering whitespace. Sub-keys may be any of tab , space , nbsp , newline or tabpad | See example below |
Example
[editor.whitespace]
-render = "all"
+render = "all"
# or control each character
[editor.whitespace.render]
-space = "all"
-tab = "all"
-newline = "none"
+space = "all"
+tab = "all"
+newline = "none"
[editor.whitespace.characters]
-space = "ยท"
-nbsp = "โฝ"
-tab = "โ"
-newline = "โ"
-tabpad = "ยท" # Tabs will look like "โยทยทยท" (depending on tab width)
+space = "ยท"
+nbsp = "โฝ"
+tab = "โ"
+newline = "โ"
+tabpad = "ยท" # Tabs will look like "โยทยทยท" (depending on tab width)
Options for rendering vertical indent guides.
@@ -1582,25 +1582,25 @@ tabpad = "ยท" # Tabs will look like "โยทยทยท" (depending o
Example:
[editor.indent-guides]
render = true
-character = "โ" # Some characters that work well: "โ", "โ", "โ", "โธฝ"
+character = "โ" # Some characters that work well: "โ", "โ", "โ", "โธฝ"
skip-levels = 1
For simplicity, editor.gutters
accepts an array of gutter types, which will
use default settings for all gutter components.
[editor]
-gutters = ["diff", "diagnostics", "line-numbers", "spacer"]
+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
specific gutter components as subsections.
Key | Description | Default |
-layout | A vector of gutters to display | ["diagnostics", "spacer", "line-numbers", "spacer", "diff"] |
+layout | A vector of gutters to display | ["diagnostics", "spacer", "line-numbers", "spacer", "diff"] |
Example:
[editor.gutters]
-layout = ["diff", "diagnostics", "line-numbers", "spacer"]
+layout = ["diff", "diagnostics", "line-numbers", "spacer"]
Options for the line number gutter
@@ -1633,7 +1633,7 @@ min-width = 1
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
+wrap-indicator = "" # set wrap-indicator to "" to hide it
Key | Description | Default |
@@ -1641,23 +1641,23 @@ wrap-indicator = "" # set wrap-indicator to "" to hide it
supersede-menu | Normally, when a menu is on screen, such as when auto complete is triggered, the tab key is bound to cycling through the items. This means when menus are on screen, one cannot use the tab key to trigger the smart-tab command. If this option is set to true, the smart-tab command always takes precedence, which means one cannot use the tab key to cycle through menu items. One of the other bindings must be used instead, such as arrow keys or C-n /C-p . | false |
-To use a theme add theme = "<name>"
to the top of your config.toml
file, or select it during runtime using :theme <name>
.
+To use a theme add theme = "<name>"
to the top of your config.toml
file, or select it during runtime using :theme <name>
.
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.
-๐ก The names "default" and "base16_default" are reserved for built-in themes
+
๐ก The names "default" and "base16_default" are reserved for built-in themes
and cannot be overridden by user-defined themes.
Each line in the theme file is specified as below:
-key = { fg = "#ffffff", bg = "#000000", underline = { color = "#ff0000", style = "curl"}, modifiers = ["bold", "italic"] }
+key = { fg = "#ffffff", bg = "#000000", underline = { color = "#ff0000", style = "curl"}, modifiers = ["bold", "italic"] }
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.
To specify only the foreground color:
-key = "#ffffff"
+key = "#ffffff"
If the key contains a dot '.'
, it must be quoted to prevent it being parsed as a dotted key.
-"key.key" = "#ffffff"
+"key.key" = "#ffffff"
For inspiration, you can find the default theme.toml
here and
@@ -1672,12 +1672,12 @@ user-submitted themes
It's recommended to define a palette of named colors, and refer to them in the
configuration values in your theme. To do this, add a table called
palette
to your theme file:
-"ui.background" = "white"
-"ui.text" = "black"
+"ui.background" = "white"
+"ui.text" = "black"
[palette]
-white = "#ffffff"
-black = "#000000"
+white = "#ffffff"
+black = "#000000"
Keep in mind that the [palette]
table includes all keys after its header,
so it should be defined after the normal theme options.
@@ -1721,7 +1721,7 @@ your terminal emulator.
๐ก The underlined
modifier is deprecated and only available for backwards compatibility.
-Its behavior is equivalent to setting underline.style="line"
.
+Its behavior is equivalent to setting underline.style="line"
.
One of the following values may be used as a value for underline.style
, providing it is
@@ -1736,14 +1736,14 @@ supported by your terminal emulator.
Extend other themes by setting the inherits
property to an existing theme.
-inherits = "boo_berry"
+inherits = "boo_berry"
-# Override the theming for "keyword"s:
-"keyword" = { fg = "gold" }
+# Override the theming for "keyword"s:
+"keyword" = { fg = "gold" }
# Override colors in the palette:
[palette]
-berry = "#2A2A4D"
+berry = "#2A2A4D"
The following is a list of scopes available to use for styling:
@@ -2047,59 +2047,59 @@ directory (default ~/.config/helix
on Linux systems) with a structu
this:
# At most one section each of 'keys.normal', 'keys.insert' and 'keys.select'
[keys.normal]
-C-s = ":w" # Maps Ctrl-s to the typable command :w which is an alias for :write (save file)
-C-o = ":open ~/.config/helix/config.toml" # Maps Ctrl-o to opening of the helix config file
-a = "move_char_left" # Maps the 'a' key to the move_char_left command
-w = "move_line_up" # Maps the 'w' key move_line_up
-"C-S-esc" = "extend_line" # Maps Ctrl-Shift-Escape to extend_line
-g = { a = "code_action" } # Maps `ga` to show possible code actions
-"ret" = ["open_below", "normal_mode"] # Maps the enter key to open_below then re-enter normal mode
+C-s = ":w" # Maps Ctrl-s to the typable command :w which is an alias for :write (save file)
+C-o = ":open ~/.config/helix/config.toml" # Maps Ctrl-o to opening of the helix config file
+a = "move_char_left" # Maps the 'a' key to the move_char_left command
+w = "move_line_up" # Maps the 'w' key move_line_up
+"C-S-esc" = "extend_line" # Maps Ctrl-Shift-Escape to extend_line
+g = { a = "code_action" } # Maps `ga` to show possible code actions
+"ret" = ["open_below", "normal_mode"] # Maps the enter key to open_below then re-enter normal mode
[keys.insert]
-"A-x" = "normal_mode" # Maps Alt-X to enter normal mode
-j = { k = "normal_mode" } # Maps `jk` to exit insert mode
+"A-x" = "normal_mode" # Maps Alt-X to enter normal mode
+j = { k = "normal_mode" } # Maps `jk` to exit insert mode
Minor modes are accessed by pressing a key (usually from normal mode), giving access to dedicated bindings. Bindings
can be modified or added by nesting definitions.
[keys.insert.j]
-k = "normal_mode" # Maps `jk` to exit insert mode
+k = "normal_mode" # Maps `jk` to exit insert mode
[keys.normal.g]
-a = "code_action" # Maps `ga` to show possible code actions
+a = "code_action" # Maps `ga` to show possible code actions
# invert `j` and `k` in view mode
[keys.normal.z]
-j = "scroll_up"
-k = "scroll_down"
+j = "scroll_up"
+k = "scroll_down"
# create a new minor mode bound to `+`
-[keys.normal."+"]
-m = ":run-shell-command make"
-c = ":run-shell-command cargo build"
-t = ":run-shell-command cargo test"
+[keys.normal."+"]
+m = ":run-shell-command make"
+c = ":run-shell-command cargo build"
+t = ":run-shell-command cargo test"
Ctrl, Shift and Alt modifiers are encoded respectively with the prefixes
C-
, S-
and A-
. Special keys are encoded as follows:
Key name | Representation |
-Backspace | "backspace" |
-Space | "space" |
-Return/Enter | "ret" |
-- | "minus" |
-Left | "left" |
-Right | "right" |
-Up | "up" |
-Down | "down" |
-Home | "home" |
-End | "end" |
-Page Up | "pageup" |
-Page Down | "pagedown" |
-Tab | "tab" |
-Delete | "del" |
-Insert | "ins" |
-Null | "null" |
-Escape | "esc" |
+Backspace | "backspace" |
+Space | "space" |
+Return/Enter | "ret" |
+- | "minus" |
+Left | "left" |
+Right | "right" |
+Up | "up" |
+Down | "down" |
+Home | "home" |
+End | "end" |
+Page Up | "pageup" |
+Page Down | "pagedown" |
+Tab | "tab" |
+Delete | "del" |
+Insert | "ins" |
+Null | "null" |
+Escape | "esc" |
Keys can be disabled by binding them to the no_op
command.
@@ -2123,10 +2123,10 @@ auto-LSP-formatting in Rust:
# in <config_dir>/helix/languages.toml
[language-server.mylang-lsp]
-command = "mylang-lsp"
+command = "mylang-lsp"
[[language]]
-name = "rust"
+name = "rust"
auto-format = false
@@ -2141,14 +2141,14 @@ in the configuration directory and the built-in configuration.
Each language is configured by adding a [[language]]
section to a
languages.toml
file. For example:
[[language]]
-name = "mylang"
-scope = "source.mylang"
-injection-regex = "mylang"
-file-types = ["mylang", "myl"]
-comment-token = "#"
-indent = { tab-width = 2, unit = " " }
-formatter = { command = "mylang-formatter" , args = ["--stdin"] }
-language-servers = [ "mylang-lsp" ]
+name = "mylang"
+scope = "source.mylang"
+injection-regex = "mylang"
+file-types = ["mylang", "myl"]
+comment-token = "#"
+indent = { tab-width = 2, unit = " " }
+formatter = { command = "mylang-formatter" , args = ["--stdin"] }
+language-servers = [ "mylang-lsp" ]
These configuration keys are available:
Key | Description |
@@ -2156,13 +2156,13 @@ language-servers = [ "mylang-lsp" ]
language-id | The language-id for language servers, checkout the table at TextDocumentItem for the right id |
scope | A string like source.js that identifies the language. Currently, we strive to match the scope names used by popular TextMate grammars and by the Linguist library. Usually source.<name> or text.<name> in case of markup languages |
injection-regex | regex pattern that will be tested against a language name in order to determine whether this language should be used for a potential language injection site. |
-file-types | The filetypes of the language, for example ["yml", "yaml"] . See the file-type detection section below. |
-shebangs | The interpreters from the shebang line, for example ["sh", "bash"] |
+file-types | The filetypes of the language, for example ["yml", "yaml"] . See the file-type detection section below. |
+shebangs | The interpreters from the shebang line, for example ["sh", "bash"] |
roots | A set of marker files to look for when trying to find the workspace root. For example Cargo.lock , yarn.lock |
auto-format | Whether to autoformat this language when saving |
diagnostic-severity | Minimal severity of diagnostic for it to be displayed. (Allowed values: Error , Warning , Info , Hint ) |
comment-token | The token to use as a comment-token |
-indent | The indent to use. Has sub keys unit (the text inserted into the document when indenting; usually set to N spaces or "\t" for tabs) and tab-width (the number of spaces rendered for a tab) |
+indent | The indent to use. Has sub keys unit (the text inserted into the document when indenting; usually set to N spaces or "\t" for tabs) and tab-width (the number of spaces rendered for a tab) |
language-servers | The Language Servers used for this language. See below for more information in the section Configuring Language Servers for a language |
grammar | The tree-sitter grammar to use (defaults to the value of name ) |
formatter | The formatter for the language, it will take precedence over the lsp when defined. The formatter must be able to take the original file as input from stdin and write the formatted file to stdout |
@@ -2176,20 +2176,20 @@ language-servers = [ "mylang-lsp" ]
Helix determines which language configuration to use based on the file-types
key
from the above section. file-types
is a list of strings or tables, for
example:
-file-types = ["Makefile", "toml", { suffix = ".git/config" }]
+file-types = ["Makefile", "toml", { suffix = ".git/config" }]
When determining a language configuration to use, Helix searches the file-types
with the following priorities:
- Exact match: if the filename of a file is an exact match of a string in a
-
file-types
list, that language wins. In the example above, "Makefile"
+file-types
list, that language wins. In the example above, "Makefile"
will match against Makefile
files.
- Extension: if there are no exact matches, any
file-types
string that
matches the file extension of a given file wins. In the example above, the
-"toml"
matches files like Cargo.toml
or languages.toml
.
+"toml"
matches files like Cargo.toml
or languages.toml
.
- Suffix: if there are still no matches, any values in
suffix
tables
are checked against the full path of the given file. In the example above,
-the { suffix = ".git/config" }
would match against any config
files
+the { suffix = ".git/config" }
would match against any config
files
in .git
directories. Note: /
is used as the directory separator but is
replaced at runtime with the appropriate path separator for the operating
system, so this rule would match against .git\config
files on Windows.
@@ -2198,17 +2198,17 @@ system, so this rule would match against .git\config
files on Windo
Language servers are configured separately in the table language-server
in the same file as the languages languages.toml
For example:
[language-server.mylang-lsp]
-command = "mylang-lsp"
-args = ["--stdio"]
+command = "mylang-lsp"
+args = ["--stdio"]
config = { provideFormatter = true }
-environment = { "ENV1" = "value1", "ENV2" = "value2" }
+environment = { "ENV1" = "value1", "ENV2" = "value2" }
[language-server.efm-lsp-prettier]
-command = "efm-langserver"
+command = "efm-langserver"
[language-server.efm-lsp-prettier.config]
documentFormatting = true
-languages = { typescript = [ { formatCommand ="prettier --stdin-filepath ${INPUT}", formatStdin = true } ] }
+languages = { typescript = [ { formatCommand ="prettier --stdin-filepath ${INPUT}", formatStdin = true } ] }
These are the available options for a language server.
Key | Description |
@@ -2216,15 +2216,15 @@ languages = { typescript = [ { formatCommand ="prettier --stdin-filepath ${
args | A list of arguments to pass to the language server binary |
config | LSP initialization options |
timeout | The maximum time a request to the language server may take, in seconds. Defaults to 20 |
-environment | Any environment variables that will be used when starting the language server { "KEY1" = "Value1", "KEY2" = "Value2" } |
+environment | Any environment variables that will be used when starting the language server { "KEY1" = "Value1", "KEY2" = "Value2" } |
A format
sub-table within config
can be used to pass extra formatting options to
Document Formatting Requests.
For example, with typescript:
[language-server.typescript-language-server]
-# pass format options according to https://github.com/typescript-language-server/typescript-language-server#workspacedidchangeconfiguration omitting the "[language].format." prefix.
-config = { format = { "semicolons" = "insert", "insertSpaceBeforeFunctionParenthesis" = true } }
+# pass format options according to https://github.com/typescript-language-server/typescript-language-server#workspacedidchangeconfiguration omitting the "[language].format." prefix.
+config = { format = { "semicolons" = "insert", "insertSpaceBeforeFunctionParenthesis" = true } }
The language-servers
attribute in a language tells helix which language servers are used for this language.
@@ -2236,13 +2236,13 @@ it's often useful to only enable/disable certain language-server features for th
so everything else should be handled by the typescript-language-server
(which is configured by default).
The language configuration for typescript could look like this:
[[language]]
-name = "typescript"
-language-servers = [ { name = "efm-lsp-prettier", only-features = [ "format" ] }, "typescript-language-server" ]
+name = "typescript"
+language-servers = [ { name = "efm-lsp-prettier", only-features = [ "format" ] }, "typescript-language-server" ]
or equivalent:
[[language]]
-name = "typescript"
-language-servers = [ { name = "typescript-language-server", except-features = [ "format" ] }, "efm-lsp-prettier" ]
+name = "typescript"
+language-servers = [ { name = "typescript-language-server", except-features = [ "format" ] }, "efm-lsp-prettier" ]
Each requested LSP feature is prioritized in the order of the language-servers
array.
For example, the first goto-definition
supported language server (in this case typescript-language-server
) will be taken for the relevant LSP request (command goto_definition
).
@@ -2273,8 +2273,8 @@ If a language server itself doesn't support a feature, the next language server
The source for a language's tree-sitter grammar is specified in a [[grammar]]
section in languages.toml
. For example:
[[grammar]]
-name = "mylang"
-source = { git = "https://github.com/example/mylang", rev = "a250c4582510ff34767ec3b7dcdd3c24e8c8aa68" }
+name = "mylang"
+source = { git = "https://github.com/example/mylang", rev = "a250c4582510ff34767ec3b7dcdd3c24e8c8aa68" }
Grammar configuration takes these keys:
Key | Description |
@@ -2294,9 +2294,9 @@ git repository:
You may use a top-level use-grammars
key to control which grammars are
fetched and built when using hx --grammar fetch
and hx --grammar build
.
# Note: this key must come **before** the [[language]] and [[grammar]] sections
-use-grammars = { only = [ "rust", "c", "cpp" ] }
+use-grammars = { only = [ "rust", "c", "cpp" ] }
# or
-use-grammars = { except = [ "yaml", "json" ] }
+use-grammars = { except = [ "yaml", "json" ] }
When omitted, all grammars are fetched and built.
@@ -2507,7 +2507,7 @@ actually have been extended).
// 3x @outdent
}
((block) @indent)
-["}" ")"] @outdent
+["}" ")"] @outdent
Note how on the second line, we have two blocks begin on the same line. In this
case, since both captures occur on the same line, they are combined and only
@@ -2547,7 +2547,7 @@ whitespace-sensitive.
the cursor on a line feed ends up being the entire inside of the class. Because
of this, it will miss the entire function node and its indent capture, leading
to an indent level one too small.
-To address this case, @extend
tells helix to "extend" the captured node's span
+
To address this case, @extend
tells helix to "extend" the captured node's span
to the line feed and every consecutive line that has a greater indent level than
the line of the node.
(parenthesized_expression) @indent
@@ -2655,7 +2655,7 @@ similar to how #set!
declarations work:
)
The number of arguments depends on the predicate that's used.
-Each argument is either a capture (@name
) or a string ("some string"
).
+Each argument is either a capture (@name
) or a string ("some string"
).
The following predicates are supported by tree-sitter:
-
@@ -2707,21 +2707,21 @@ This scope applies to the whole captured node. This is only different from
#![allow(unused)]
fn main() {
fn aha() { // โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
- let take = "on me"; // โโโโโโโโโโโโโโโโฎ scope: โ
- let take = "me on"; // โโ "tail" โโ (block) @indent
+ let take = "on me"; // โโโโโโโโโโโโโโโโฎ scope: โ
+ let take = "me on"; // โโ "tail" โโ (block) @indent
let ill = be_gone_days(1 || 2); // โ โ
-} // โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโ "}" @outdent
- // scope: "all"
+} // โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโ "}" @outdent
+ // scope: "all"
}
We can write the following query with the #set!
declaration:
((block) @indent
- (#set! "scope" "tail"))
-("}" @outdent
- (#set! "scope" "all"))
+ (#set! "scope" "tail"))
+("}" @outdent
+ (#set! "scope" "all"))
-As we can see, the "tail" scope covers the node, except for the first line.
+
As we can see, the "tail" scope covers the node, except for the first line.
Everything up to and including the closing brace gets an indent level of 1.
-Then, on the closing brace, we encounter an outdent with a scope of "all", which
+Then, on the closing brace, we encounter an outdent with a scope of "all", which
means the first line is included, and the indent level is cancelled out on this
line. (Note these scopes are the defaults for @indent
and @outdent
โthey are
written explicitly for demonstration.)
@@ -2731,7 +2731,7 @@ In addition to the ((string_expression (string_fragment) @injection.content)
- (#set! injection.language "bash"))
+ (#set! injection.language "bash"))
diff --git a/master/remapping.html b/master/remapping.html
index b0baaad16..ee6e966a4 100644
--- a/master/remapping.html
+++ b/master/remapping.html
@@ -188,59 +188,59 @@ directory (default ~/.config/helix
on Linux systems) with a structu
this:
# At most one section each of 'keys.normal', 'keys.insert' and 'keys.select'
[keys.normal]
-C-s = ":w" # Maps Ctrl-s to the typable command :w which is an alias for :write (save file)
-C-o = ":open ~/.config/helix/config.toml" # Maps Ctrl-o to opening of the helix config file
-a = "move_char_left" # Maps the 'a' key to the move_char_left command
-w = "move_line_up" # Maps the 'w' key move_line_up
-"C-S-esc" = "extend_line" # Maps Ctrl-Shift-Escape to extend_line
-g = { a = "code_action" } # Maps `ga` to show possible code actions
-"ret" = ["open_below", "normal_mode"] # Maps the enter key to open_below then re-enter normal mode
+C-s = ":w" # Maps Ctrl-s to the typable command :w which is an alias for :write (save file)
+C-o = ":open ~/.config/helix/config.toml" # Maps Ctrl-o to opening of the helix config file
+a = "move_char_left" # Maps the 'a' key to the move_char_left command
+w = "move_line_up" # Maps the 'w' key move_line_up
+"C-S-esc" = "extend_line" # Maps Ctrl-Shift-Escape to extend_line
+g = { a = "code_action" } # Maps `ga` to show possible code actions
+"ret" = ["open_below", "normal_mode"] # Maps the enter key to open_below then re-enter normal mode
[keys.insert]
-"A-x" = "normal_mode" # Maps Alt-X to enter normal mode
-j = { k = "normal_mode" } # Maps `jk` to exit insert mode
+"A-x" = "normal_mode" # Maps Alt-X to enter normal mode
+j = { k = "normal_mode" } # Maps `jk` to exit insert mode
Minor modes are accessed by pressing a key (usually from normal mode), giving access to dedicated bindings. Bindings
can be modified or added by nesting definitions.
[keys.insert.j]
-k = "normal_mode" # Maps `jk` to exit insert mode
+k = "normal_mode" # Maps `jk` to exit insert mode
[keys.normal.g]
-a = "code_action" # Maps `ga` to show possible code actions
+a = "code_action" # Maps `ga` to show possible code actions
# invert `j` and `k` in view mode
[keys.normal.z]
-j = "scroll_up"
-k = "scroll_down"
+j = "scroll_up"
+k = "scroll_down"
# create a new minor mode bound to `+`
-[keys.normal."+"]
-m = ":run-shell-command make"
-c = ":run-shell-command cargo build"
-t = ":run-shell-command cargo test"
+[keys.normal."+"]
+m = ":run-shell-command make"
+c = ":run-shell-command cargo build"
+t = ":run-shell-command cargo test"
Ctrl, Shift and Alt modifiers are encoded respectively with the prefixes
C-
, S-
and A-
. Special keys are encoded as follows:
Key name | Representation |
-Backspace | "backspace" |
-Space | "space" |
-Return/Enter | "ret" |
-- | "minus" |
-Left | "left" |
-Right | "right" |
-Up | "up" |
-Down | "down" |
-Home | "home" |
-End | "end" |
-Page Up | "pageup" |
-Page Down | "pagedown" |
-Tab | "tab" |
-Delete | "del" |
-Insert | "ins" |
-Null | "null" |
-Escape | "esc" |
+Backspace | "backspace" |
+Space | "space" |
+Return/Enter | "ret" |
+- | "minus" |
+Left | "left" |
+Right | "right" |
+Up | "up" |
+Down | "down" |
+Home | "home" |
+End | "end" |
+Page Up | "pageup" |
+Page Down | "pagedown" |
+Tab | "tab" |
+Delete | "del" |
+Insert | "ins" |
+Null | "null" |
+Escape | "esc" |
Keys can be disabled by binding them to the no_op
command.
diff --git a/master/searcher.js b/master/searcher.js
index d2b0aeed3..dc03e0a02 100644
--- a/master/searcher.js
+++ b/master/searcher.js
@@ -316,7 +316,7 @@ window.search = window.search || {};
// Eventhandler for keyevents on `document`
function globalKeyHandler(e) {
- if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || e.target.type === 'textarea' || e.target.type === 'text') { return; }
+ if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || e.target.type === 'textarea' || e.target.type === 'text' || !hasFocus() && /^(?:input|select|textarea)$/i.test(e.target.nodeName)) { return; }
if (e.keyCode === ESCAPE_KEYCODE) {
e.preventDefault();
diff --git a/master/themes.html b/master/themes.html
index 8d60bfd09..5064e6a00 100644
--- a/master/themes.html
+++ b/master/themes.html
@@ -180,23 +180,23 @@
-To use a theme add theme = "<name>"
to the top of your config.toml
file, or select it during runtime using :theme <name>
.
+To use a theme add theme = "<name>"
to the top of your config.toml
file, or select it during runtime using :theme <name>
.
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.
-๐ก The names "default" and "base16_default" are reserved for built-in themes
+
๐ก The names "default" and "base16_default" are reserved for built-in themes
and cannot be overridden by user-defined themes.
Each line in the theme file is specified as below:
-key = { fg = "#ffffff", bg = "#000000", underline = { color = "#ff0000", style = "curl"}, modifiers = ["bold", "italic"] }
+key = { fg = "#ffffff", bg = "#000000", underline = { color = "#ff0000", style = "curl"}, modifiers = ["bold", "italic"] }
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.
To specify only the foreground color:
-key = "#ffffff"
+key = "#ffffff"
If the key contains a dot '.'
, it must be quoted to prevent it being parsed as a dotted key.
-"key.key" = "#ffffff"
+"key.key" = "#ffffff"
For inspiration, you can find the default theme.toml
here and
@@ -211,12 +211,12 @@ user-submitted themes
It's recommended to define a palette of named colors, and refer to them in the
configuration values in your theme. To do this, add a table called
palette
to your theme file:
-"ui.background" = "white"
-"ui.text" = "black"
+"ui.background" = "white"
+"ui.text" = "black"
[palette]
-white = "#ffffff"
-black = "#000000"
+white = "#ffffff"
+black = "#000000"
Keep in mind that the [palette]
table includes all keys after its header,
so it should be defined after the normal theme options.
@@ -260,7 +260,7 @@ your terminal emulator.
๐ก The underlined
modifier is deprecated and only available for backwards compatibility.
-Its behavior is equivalent to setting underline.style="line"
.
+Its behavior is equivalent to setting underline.style="line"
.
One of the following values may be used as a value for underline.style
, providing it is
@@ -275,14 +275,14 @@ supported by your terminal emulator.
Extend other themes by setting the inherits
property to an existing theme.
-inherits = "boo_berry"
+inherits = "boo_berry"
-# Override the theming for "keyword"s:
-"keyword" = { fg = "gold" }
+# Override the theming for "keyword"s:
+"keyword" = { fg = "gold" }
# Override colors in the palette:
[palette]
-berry = "#2A2A4D"
+berry = "#2A2A4D"
The following is a list of scopes available to use for styling:
diff --git a/master/usage.html b/master/usage.html
index ea09cc633..d2ff68a18 100644
--- a/master/usage.html
+++ b/master/usage.html
@@ -204,19 +204,19 @@ can be accessed via the command hx --tutor
or :tutor
.<
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
+to the clipboard in other text editors. Usage is similar to Vim, with "
being
used to select a register.
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.
+"ay
- Yank the current selection to register a
.
+"op
- Paste the text in register o
after the selection.
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.
+"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.
Commands that use registers, like yank (y
), use a default register if none is specified.
@@ -224,7 +224,7 @@ These registers are used as defaults:
Register character | Contains |
/ | Last search |
: | Last executed command |
-" | Last yanked text |
+" | Last yanked text |
@ | Last recorded macro |
@@ -306,7 +306,7 @@ documentation.
and requires the corresponding query file to work properly.
-Alt-p
, Alt-o
, Alt-i
, and Alt-n
(or Alt
and arrow keys) allow you to move the
+
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:
func(arg1, arg2, arg3);
@@ -328,12 +328,12 @@ a more intuitive tree format:
โ โ
โโโโโโโผโโโโโ โโโโโโผโโโโโ
โidentifierโ โargumentsโ
-โ "func" โ โโโโโโดโโโโฌโโโโโโดโโโโ
+โ "func" โ โโโโโโดโโโโฌโโโโโโดโโโโ
โโโโโโโโโโโโ โ โ โ
โ โ โ
โโโโโโโโโโโผโ โโโโโโผโโโโโโ โโผโโโโโโโโโโ
โidentifierโ โidentifierโ โidentifierโ
- โ "arg1" โ โ "arg2" โ โ "arg3" โ
+ โ "arg1" โ โ "arg2" โ โ "arg3" โ
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
If you have a selection that wraps arg1
(see the tree above), and you use
@@ -352,7 +352,7 @@ node with no sibling. When using Alt-p
with a selection on ar
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
.
+selection to the "func" identifier
.