Document not found (404)
+This URL is invalid, sorry. Please use the navigation bar or search to continue.
+ +diff --git a/master/.nojekyll b/master/.nojekyll new file mode 100644 index 000000000..f17311098 --- /dev/null +++ b/master/.nojekyll @@ -0,0 +1 @@ +This file makes sure that Github Pages doesn't process mdBook's output. diff --git a/master/404.html b/master/404.html new file mode 100644 index 000000000..f2703df49 --- /dev/null +++ b/master/404.html @@ -0,0 +1,170 @@ + + +
+ + +This URL is invalid, sorry. Please use the navigation bar or search to continue.
+ +Command mode can be activated by pressing :
, similar to vim. Built-in commands:
Name | Description |
---|---|
:quit , :q | Close the current view. |
:quit! , :q! | Close the current view forcefully (ignoring unsaved changes). |
:open , :o | Open a file from disk into the current view. |
:buffer-close , :bc , :bclose | Close the current buffer. |
:buffer-close! , :bc! , :bclose! | Close the current buffer forcefully (ignoring unsaved changes). |
:buffer-close-others , :bco , :bcloseother | Close all buffers but the currently focused one. |
:buffer-close-others! , :bco! , :bcloseother! | Close all buffers but the currently focused one. |
:buffer-close-all , :bca , :bcloseall | Close all buffers, without quiting. |
:buffer-close-all! , :bca! , :bcloseall! | Close all buffers forcefully (ignoring unsaved changes), without quiting. |
:write , :w | Write changes to disk. Accepts an optional path (:write some/path.txt) |
:new , :n | Create a new scratch buffer. |
:format , :fmt | Format the file using the LSP formatter. |
:indent-style | Set the indentation style for editing. ('t' for tabs or 1-8 for number of spaces.) |
:line-ending | Set the document's default line ending. Options: crlf, lf, cr, ff, nel. |
:earlier , :ear | Jump back to an earlier point in edit history. Accepts a number of steps or a time span. |
:later , :lat | Jump to a later point in edit history. Accepts a number of steps or a time span. |
:write-quit , :wq , :x | Write changes to disk and close the current view. Accepts an optional path (:wq some/path.txt) |
:write-quit! , :wq! , :x! | Write changes to disk and close the current view forcefully. Accepts an optional path (:wq! some/path.txt) |
:write-all , :wa | Write changes from all views to disk. |
:write-quit-all , :wqa , :xa | Write changes from all views to disk and close all views. |
:write-quit-all! , :wqa! , :xa! | Write changes from all views to disk and close all views forcefully (ignoring unsaved changes). |
:quit-all , :qa | Close all views. |
:quit-all! , :qa! | Close all views forcefully (ignoring unsaved changes). |
:cquit , :cq | Quit with exit code (default 1). Accepts an optional integer exit code (:cq 2). |
:cquit! , :cq! | Quit with exit code (default 1) forcefully (ignoring unsaved changes). Accepts an optional integer exit code (:cq! 2). |
:theme | Change the editor theme. |
:clipboard-yank | Yank main selection into system clipboard. |
:clipboard-yank-join | Yank joined selections into system clipboard. A separator can be provided as first argument. Default value is newline. |
:primary-clipboard-yank | Yank main selection into system primary clipboard. |
:primary-clipboard-yank-join | Yank joined selections into system primary clipboard. A separator can be provided as first argument. Default value is newline. |
:clipboard-paste-after | Paste system clipboard after selections. |
:clipboard-paste-before | Paste system clipboard before selections. |
:clipboard-paste-replace | Replace selections with content of system clipboard. |
:primary-clipboard-paste-after | Paste primary clipboard after selections. |
:primary-clipboard-paste-before | Paste primary clipboard before selections. |
:primary-clipboard-paste-replace | Replace selections with content of system primary clipboard. |
:show-clipboard-provider | Show clipboard provider name in status bar. |
:change-current-directory , :cd | Change the current working directory. |
:show-directory , :pwd | Show the current working directory. |
:encoding | Set encoding based on https://encoding.spec.whatwg.org |
:reload | Discard changes and reload from the source file. |
:tree-sitter-scopes | Display tree sitter scopes, primarily for theming and development. |
:debug-start , :dbg | Start a debug session from a given template with given parameters. |
:debug-remote , :dbg-tcp | Connect to a debug adapter by TCP address and start a debugging session from a given template with given parameters. |
:debug-eval | Evaluate expression in current debug context. |
:vsplit , :vs | Open the file in a vertical split. |
:vsplit-new , :vnew | Open a scratch buffer in a vertical split. |
:hsplit , :hs , :sp | Open the file in a horizontal split. |
:hsplit-new , :hnew | Open a scratch buffer in a horizontal split. |
:tutor | Open the tutorial. |
:goto , :g | Go to line number. |
:set-option , :set | Set a config option at runtime |
:sort | Sort ranges in selection. |
:rsort | Sort ranges in selection in reverse order. |
:tree-sitter-subtree , :ts-subtree | Display tree sitter subtree under cursor, primarily for debugging queries. |
:config-reload | Refreshes helix's config. |
:config-open | Open the helix config.toml file. |
To override global configuration parameters, create a config.toml
file located in your config directory:
~/.config/helix/config.toml
%AppData%\helix\config.toml
++Hint: You can easily open the config file by typing
+:config-open
within Helix normal mode.
Example config:
+theme = "onedark"
+
+[editor]
+line-number = "relative"
+mouse = false
+
+[editor.cursor-shape]
+insert = "bar"
+normal = "block"
+select = "underline"
+
+[editor.file-picker]
+hidden = false
+
+[editor]
SectionKey | Description | Default |
---|---|---|
scrolloff | Number of lines of padding around the edge of the screen when scrolling. | 3 |
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"] |
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 |
auto-completion | Enable automatic pop up of auto-completion. | true |
idle-timeout | Time in milliseconds since last keypress before idle timers trigger. Used for autocompletion, set to 0 for instant. | 400 |
completion-trigger-len | The min-length of word under cursor to trigger autocompletion | 2 |
auto-info | Whether to display infoboxes | true |
true-color | Set to true to override automatic detection of terminal truecolor support in the event of a false negative. | false |
[editor.lsp]
SectionKey | Description | Default |
---|---|---|
display-messages | Display LSP progress messages below statusline1 | false |
A progress spinner is always shown in the statusline beside the file path.
+[editor.cursor-shape]
SectionDefines the shape of cursor in each mode. Note that due to limitations +of the terminal environment, only the primary cursor can change shape.
+Key | Description | Default |
---|---|---|
normal | Cursor shape in normal mode | block |
insert | Cursor shape in insert mode | block |
select | Cursor shape in select mode | block |
[editor.file-picker]
SectionSets options for file picker and global search. All but the last key listed in
+the default file-picker configuration below are IgnoreOptions: whether hidden
+files and files listed within ignore files are ignored by (not visible in) the
+helix file picker and global search. There is also one other key, max-depth
+available, which is not defined by default.
Key | Description | Default |
---|---|---|
hidden | Enables ignoring hidden files. | true |
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 . |
[editor.auto-pairs]
SectionEnable automatic insertion of pairs to parentheses, brackets, etc. Can be +a simple boolean value, or a specific mapping of pairs of single characters.
+Key | Description |
---|---|
false | Completely disable auto pairing, regardless of language-specific settings |
true | Use the default pairs: (){}[]''""`` |
Mapping of pairs | e.g. { "(" = ")", "{" = "}", ... } |
Example
+[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 ''
[[language]]
+name = "rust"
+
+[language.auto-pairs]
+'(' = ')'
+'{' = '}'
+'[' = ']'
+'"' = '"'
+'`' = '`'
+'<' = '>'
+
+[editor.search]
SectionSearch specific options.
+Key | Description | Default |
---|---|---|
smart-case | Enable smart case regex searching (case insensitive unless pattern contains upper case characters) | true |
wrap-around | Whether the search should wrap after depleting the matches | true |
Helix's editing model is strongly inspired from vim and kakoune, and a notable
+difference from vim (and the most striking similarity to kakoune) is that Helix
+follows the selection → action
model. This means that the whatever you are
+going to act on (a word, a paragraph, a line, etc) is selected first and the
+action itself (delete, change, yank, etc) comes second. A cursor is simply a
+single width selection.
See also Kakoune's Migrating from Vim.
+++ +TODO: Mention texobjects, surround, registers
+
To add a new language, you need to add a language
entry to the
+languages.toml
found in the root of the repository;
+this languages.toml
file is included at compilation time, and is
+distinct from the languages.toml
file in the user's configuration
+directory.
[[language]]
+name = "mylang"
+scope = "scope.mylang"
+injection-regex = "^mylang$"
+file-types = ["mylang", "myl"]
+comment-token = "#"
+indent = { tab-width = 2, unit = " " }
+
+These are the available keys and descriptions for the file.
+Key | Description |
---|---|
name | The name of the language |
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"] . Extensions and full file names are supported. |
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 tab-width and unit |
config | Language server configuration |
grammar | The tree-sitter grammar to use (defaults to the value of name ) |
If a tree-sitter grammar is available for the language, add a new grammar
+entry to languages.toml
.
[[grammar]]
+name = "mylang"
+source = { git = "https://github.com/example/mylang", rev = "a250c4582510ff34767ec3b7dcdd3c24e8c8aa68" }
+
+Grammar configuration takes these keys:
+Key | Description |
---|---|
name | The name of the tree-sitter grammar |
source | The method of fetching the grammar - a table with a schema defined below |
Where source
is a table with either these keys when using a grammar from a
+git repository:
Key | Description |
---|---|
git | A git remote URL from which the grammar should be cloned |
rev | The revision (commit hash or tag) which should be fetched |
subpath | A path within the grammar directory which should be built. Some grammar repositories host multiple grammars (for example tree-sitter-typescript and tree-sitter-ocaml ) in subdirectories. This key is used to point hx --grammar build to the correct path for compilation. When omitted, the root of repository is used |
Or a path
key with an absolute path to a locally available grammar directory.
For a language to have syntax-highlighting and indentation among
+other things, you have to add queries. Add a directory for your
+language with the path runtime/queries/<name>/
. The tree-sitter
+website
+gives more info on how to write queries.
++NOTE: When evaluating queries, the first matching query takes +precedence, which is different from other editors like neovim where +the last matching query supersedes the ones before it. See +this issue for an example.
+
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.
If a parser is segfaulting or you want to remove the parser, make sure to remove the compiled parser in runtime/grammar/<name>.so
The indents query is indents.toml
, not indents.scm
. See this issue for more information.
This section contains guides for adding new language server configurations, +tree-sitter grammers, textobject queries, etc.
+ +Textobjects that are language specific (like functions, classes, etc)
+require an accompanying tree-sitter grammar and a textobjects.scm
query file
+to work properly. Tree-sitter allows us to query the source code syntax tree
+and capture specific parts of it. The queries are written in a lisp dialect.
+More information on how to write queries can be found in the official tree-sitter
+documentation.
Query files should be placed in runtime/queries/{language}/textobjects.scm
+when contributing. Note that to test the query files locally you should put
+them under your local runtime directory (~/.config/helix/runtime
on Linux
+for example).
The following captures are recognized:
+Capture Name |
---|
function.inside |
function.around |
class.inside |
class.around |
parameter.inside |
comment.inside |
comment.around |
Example query files can be found in the helix GitHub repository.
+Tree-sitter based navigation is done using captures in the +following order:
+object.movement
object.around
object.inside
For example if a function.around
capture has been already defined for a language
+in it's textobjects.scm
file, function navigation should also work automatically.
+function.movement
should be defined only if the node captured by function.around
+doesn't make sense in a navigation context.