Document not found (404)
+This URL is invalid, sorry. Please use the navigation bar or search to continue.
+ +diff --git a/22.08.1/.nojekyll b/22.08.1/.nojekyll new file mode 100644 index 000000000..f17311098 --- /dev/null +++ b/22.08.1/.nojekyll @@ -0,0 +1 @@ +This file makes sure that Github Pages doesn't process mdBook's output. diff --git a/22.08.1/404.html b/22.08.1/404.html new file mode 100644 index 000000000..8a4116191 --- /dev/null +++ b/22.08.1/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! | Force close the current view, 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! | Force close all buffers but the currently focused one. |
:buffer-close-all , :bca , :bcloseall | Close all buffers without quitting. |
:buffer-close-all! , :bca! , :bcloseall! | Force close all buffers ignoring unsaved changes without quitting. |
:buffer-next , :bn , :bnext | Goto next buffer. |
:buffer-previous , :bp , :bprev | Goto previous buffer. |
:write , :w | Write changes to disk. Accepts an optional path (:write some/path.txt) |
:write! , :w! | Force write changes to disk creating necessary subdirectories. 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. |
: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 buffers to disk. |
:write-quit-all , :wqa , :xa | Write changes from all buffers to disk and close all views. |
:write-quit-all! , :wqa! , :xa! | Write changes from all buffers to disk and close all views forcefully (ignoring unsaved changes). |
:quit-all , :qa | Close all views. |
:quit-all! , :qa! | Force close all views ignoring unsaved changes. |
:cquit , :cq | Quit with exit code (default 1). Accepts an optional integer exit code (:cq 2). |
:cquit! , :cq! | Force quit with exit code (default 1) 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 | Goto line number. |
:set-language , :lang | Set the language of current buffer. |
:set-option , :set | Set a config option at runtime. For example to disable smart case search, use :set search.smart-case false . |
:get-option , :get | Get the current value of a config option. |
:sort | Sort ranges in selection. |
:rsort | Sort ranges in selection in reverse order. |
:reflow | Hard-wrap the current selection of lines to a given width. |
:tree-sitter-subtree , :ts-subtree | Display tree sitter subtree under cursor, primarily for debugging queries. |
:config-reload | Refresh user config. |
:config-open | Open the user config.toml file. |
:log-open | Open the helix log file. |
:insert-output | Run shell command, inserting output after each selection. |
:append-output | Run shell command, appending output after each selection. |
:pipe | Pipe each selection to the shell command. |
:run-shell-command , :sh | Run a shell command |
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
+
+You may also specify a file to use for configuration with the -c
or
+--config
CLI argument: hx -c path/to/custom-config.toml
.
[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 |
cursorline | Highlight all lines with a cursor. | false |
gutters | Gutters to display: Available are diagnostics 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", "line-numbers"] |
auto-completion | Enable automatic pop up of auto-completion. | true |
auto-format | Enable automatic formatting on save. | 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 |
rulers | List of column positions at which to display the rulers. Can be overridden by language specific rulers in languages.toml file. | [] |
color-modes | Whether to color the mode indicator with different colors depending on the mode itself | false |
[editor.statusline]
SectionAllows 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:
+[editor.statusline]
+left = ["mode", "spinner"]
+center = ["file-name"]
+right = ["diagnostics", "selections", "position", "file-encoding", "file-line-ending", "file-type"]
+separator = "│"
+
+The following elements can be configured:
+Key | Description |
---|---|
mode | The current editor mode (NOR /INS /SEL ) |
spinner | A progress spinner indicating LSP activity |
file-name | The path/name of the opened file |
file-encoding | The encoding of the opened file if it differs from UTF-8 |
file-line-ending | The file line endings (CRLF or LF) |
file-type | The type of the opened file |
diagnostics | The number of warnings and/or errors |
selections | The number of active selections |
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 "│" ) |
spacer | Inserts a space between elements (multiple/contiguous spacers may be specified) |
[editor.lsp]
SectionKey | Description | Default |
---|---|---|
display-messages | Display LSP progress messages below statusline1 | false |
auto-signature-help | Enable automatic popup of signature help (parameter hints) | true |
display-signature-help-docs | Display docs under signature help popup | true |
By default, a progress spinner is 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.
+Valid values for these options are block
, bar
, underline
, or hidden
.
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.
All git related options are only enabled in a git repository.
+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]
SectionEnables automatic insertion of pairs to parentheses, brackets, etc. Can be a +simple boolean value, or a specific mapping of pairs of single characters.
+To disable auto-pairs altogether, set auto-pairs
to false
:
[editor]
+auto-pairs = false # defaults to `true`
+
+The default pairs are (){}[]''""``
, but these can be customized by
+setting auto-pairs
to a TOML table:
[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 |
[editor.whitespace]
SectionOptions 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 , 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"
+# or control each character
+[editor.whitespace.render]
+space = "all"
+tab = "all"
+newline = "none"
+
+[editor.whitespace.characters]
+space = "·"
+nbsp = "⍽"
+tab = "→"
+newline = "⏎"
+tabpad = "·" # Tabs will look like "→···" (depending on tab width)
+
+[editor.indent-guides]
SectionOptions for rendering vertical indent guides.
+Key | Description | Default |
---|---|---|
render | Whether to render indent guides. | false |
character | Literal character to use for rendering the indent guide | │ |
Example:
+[editor.indent-guides]
+render = true
+character = "╎"
+
+
+ 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 and Helix's Migrating from Vim.
+++ +TODO: Mention textobjects, surround, registers
+
To add a new language, you need to add a [[language]]
entry to the
+languages.toml
(see the language configuration section).
When adding a new language or Language Server configuration for an existing
+language, run cargo xtask docgen
to add the new configuration to the
+Language Support docs before creating a pull request.
+When adding a Language Server configuration, be sure to update the
+Language Server Wiki with installation notes.
If a tree-sitter grammar is available for the language, add a new [[grammar]]
+entry to languages.toml
.
You may use the source.path
key rather than source.git
with an absolute path
+to a locally available grammar for testing, but switch to source.git
before
+submitting a pull request.
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
Helix uses tree-sitter to correctly indent new lines. This requires
+a tree-sitter grammar and an indent.scm
query file placed in
+runtime/queries/{language}/indents.scm
. The indentation for a line
+is calculated by traversing the syntax tree from the lowest node at the
+beginning of the new line. Each of these nodes contributes to the total
+indent when it is captured by the query (in what way depends on the name
+of the capture).
Note that it matters where these added indents begin. For example, +multiple indent level increases that start on the same line only increase +the total indent level by 1.
+Added indents don't always apply to the whole node. For example, in most +cases when a node should be indented, we actually only want everything +except for its first line to be indented. For this, there are several +scopes (more scopes may be added in the future if required):
+all
:
+This scope applies to the whole captured node. This is only different from
+tail
when the captured node is the first node on its line.
tail
:
+This scope applies to everything except for the first line of the
+captured node.
Every capture type has a default scope which should do the right thing
+in most situations. When a different scope is required, this can be
+changed by using a #set!
declaration anywhere in the pattern:
(assignment_expression
+ right: (_) @indent
+ (#set! "scope" "all"))
+
+@indent
(default scope tail
):
+Increase the indent level by 1. Multiple occurrences in the same line
+don't stack. If there is at least one @indent
and one @outdent
+capture on the same line, the indent level isn't changed at all.
@outdent
(default scope all
):
+Decrease the indent level by 1. The same rules as for @indent
apply.
In some cases, an S-expression cannot express exactly what pattern should be matched.
+For that, tree-sitter allows for predicates to appear anywhere within a pattern,
+similar to how #set!
declarations work:
(some_kind
+ (child_kind) @indent
+ (#predicate? arg1 arg2 ...)
+)
+
+The number of arguments depends on the predicate that's used.
+Each argument is either a capture (@name
) or a string ("some string"
).
+The following predicates are supported by tree-sitter:
#eq?
/#not-eq?
:
+The first argument (a capture) must/must not be equal to the second argument
+(a capture or a string).
#match?
/#not-match?
:
+The first argument (a capture) must/must not match the regex given in the
+second argument (a string).
Additionally, we support some custom predicates for indent queries:
+#not-kind-eq?
:
+The kind of the first argument (a capture) must not be equal to the second
+argument (a string).
#same-line?
/#not-same-line?
:
+The captures given by the 2 arguments must/must not start on the same line.
This section contains guides for adding new language server configurations, +tree-sitter grammars, 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 |
test.inside |
test.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.