Installation
We provide pre-built binaries on the GitHub Releases page.
OSX
A Homebrew tap is available:
brew tap helix-editor/helix
brew install helix
Linux
NixOS
A flake containing the package is available in the project root. The flake can also be used to spin up a reproducible development shell for working on Helix.
Arch Linux
Binary packages are available on AUR:
Build from source
git clone --recurse-submodules --shallow-submodules -j8 https://github.com/helix-editor/helix
cd helix
cargo install --path helix-term
This will install the hx
binary to $HOME/.cargo/bin
.
Now copy the runtime/
directory somewhere. Helix will by default look for the
runtime inside the same folder as the executable, but that can be overriden via
the HELIX_RUNTIME
environment variable.
If you want to embed the runtime/
directory into the Helix binary you can build
it with:
cargo install --path helix-term --features "embed_runtime"
Usage
(Currently not fully documented, see the keymappings list for more.)
Surround
Functionality similar to vim-surround is built into helix. The keymappings have been inspired from vim-sandwich:
ms
- Add surround charactersmr
- Replace surround charactersmd
- Delete surround characters
ms
acts on a selection, so select the text first and use ms<char>
. mr
and md
work
on the closest pairs found and selections are not required; use counts to act in outer pairs.
It can also act on multiple seletions (yay!). For example, to change every occurance of (use)
to [use]
:
%
to select the whole files
to split the selections on a search term- Input
use
and hit Enter mr([
to replace the parens with square brackets
Multiple characters are currently not supported, but planned.
Configuration
To override global configuration parameters create a config.toml
file located in your config directory (i.e ~/.config/helix/config.toml
).
LSP
To display all language server messages in the status line add the following to your config.toml
:
[lsp]
display-messages = true
Themes
First you'll need to place selected themes in your themes
directory (i.e ~/.config/helix/themes
), the directory might have to be created beforehand.
To use a custom theme add theme = <name>
to your config.toml
or override it during runtime using :theme <name>
.
The default theme.toml can be found here, and user submitted themes here.
Creating a theme
First create a file with the name of your theme as file name (i.e mytheme.toml
) and place it in your themes
directory (i.e ~/.config/helix/themes
).
Each line in the theme file is specified as below:
key = { fg = "#ffffff", bg = "#000000", modifiers = ["bold", "italic"] }
where key
represents what you want to style, fg
specifies the foreground color, bg
the background color, and modifiers
is a list of style modifiers. bg
and modifiers
can be omitted to defer to the defaults.
To specify only the foreground color:
key = "#ffffff"
if the key contains a dot '.'
, it must be quoted to prevent it being parsed as a dotted key.
"key.key" = "#ffffff"
Possible modifiers:
Modifier |
---|
bold |
dim |
italic |
underlined |
slow\_blink |
rapid\_blink |
reversed |
hidden |
crossed\_out |
Possible keys:
Key | Notes |
---|---|
attribute | |
keyword | |
keyword.directive | Preprocessor directives (#if in C) |
namespace | |
punctuation | |
punctuation.delimiter | |
operator | |
special | |
property | |
variable | |
variable.parameter | |
type | |
type.builtin | |
constructor | |
function | |
function.macro | |
function.builtin | |
comment | |
variable.builtin | |
constant | |
constant.builtin | |
string | |
number | |
escape | Escaped characters |
label | For lifetimes |
module | |
ui.background | |
ui.cursor | |
ui.cursor.insert | |
ui.cursor.select | |
ui.cursor.match | Matching bracket etc. |
ui.cursor.primary | Cursor with primary selection |
ui.linenr | |
ui.statusline | |
ui.statusline.inactive | |
ui.popup | |
ui.window | |
ui.help | |
ui.text | |
ui.text.focus | |
ui.menu.selected | |
ui.selection | For selections in the editing area |
ui.selection.primary | |
warning | LSP warning |
error | LSP error |
info | LSP info |
hint | LSP hint |
These keys match tree-sitter scopes. We half-follow the common scopes from macromates language grammars with some differences.
For a given highlight produced, styling will be determined based on the longest matching theme key. So it's enough to provide function to highlight function.macro
and function.builtin
as well, but you can use more specific scopes to highlight specific cases differently.
Keymap
Normal mode
Movement
NOTE:
f
,F
,t
andT
are not confined to the current line.
Key | Description |
---|---|
h , Left | Move left |
j , Down | Move down |
k , Up | Move up |
l , Right | Move right |
w | Move next word start |
b | Move previous word start |
e | Move next word end |
t | Find 'till next char |
f | Find next char |
T | Find 'till previous char |
F | Find previous char |
Home | Move to the start of the line |
End | Move to the end of the line |
PageUp | Move page up |
PageDown | Move page down |
Ctrl-u | Move half page up |
Ctrl-d | Move half page down |
Ctrl-i | Jump forward on the jumplist TODO: conflicts tab |
Ctrl-o | Jump backward on the jumplist |
v | Enter select (extend) mode |
g | Enter goto mode |
m | Enter match mode |
: | Enter command mode |
z | Enter view mode |
Ctrl-w | Enter window mode (maybe will be remove for spc w w later) |
Space | Enter space mode |
K | Show documentation for the item under the cursor |
Changes
Key | Description |
---|---|
r | Replace with a character |
R | Replace with yanked text |
i | Insert before selection |
a | Insert after selection (append) |
I | Insert at the start of the line |
A | Insert at the end of the line |
o | Open new line below selection |
o | Open new line above selection |
u | Undo change |
U | Redo change |
y | Yank selection |
p | Paste after selection |
P | Paste before selection |
> | Indent selection |
< | Unindent selection |
= | Format selection |
d | Delete selection |
c | Change selection (delete and enter insert mode) |
Selection manipulation
Key | Description |
---|---|
s | Select all regex matches inside selections |
S | Split selection into subselections on regex matches |
Alt-s | Split selection on newlines |
; | Collapse selection onto a single cursor |
Alt-; | Flip selection cursor and anchor |
% | Select entire file |
x | Select current line, if already selected, extend to next line |
Expand selection to parent syntax node TODO: pick a key | |
J | join lines inside selection |
K | keep selections matching the regex TODO: overlapped by hover help |
Space | keep only the primary selection TODO: overlapped by space mode |
Ctrl-c | Comment/uncomment the selections |
Search
TODO: The search implementation isn't ideal yet -- we don't support searching in reverse, or searching via smartcase.
Key | Description |
---|---|
/ | Search for regex pattern |
n | Select next search match |
N | Add next search match to selection |
* | Use current selection as the search pattern |
Diagnostics
NOTE:
[
and]
will likely contain more pair mappings in the style of vim-unimpaired
Key | Description |
---|---|
[d | Go to previous diagnostic |
]d | Go to next diagnostic |
[D | Go to first diagnostic in document |
]D | Go to last diagnostic in document |
Select / extend mode
I'm still pondering whether to keep this mode or not. It changes movement commands to extend the existing selection instead of replacing it.
NOTE: It's a bit confusing at the moment because extend hasn't been implemented for all movement commands yet.
View mode
View mode is intended for scrolling and manipulating the view without changing the selection.
Key | Description |
---|---|
z , c | Vertically center the line |
t | Align the line to the top of the screen |
b | Align the line to the bottom of the screen |
m | Align the line to the middle of the screen (horizontally) |
j | Scroll the view downwards |
k | Scroll the view upwards |
Goto mode
Jumps to various locations.
NOTE: Some of these features are only available with the LSP present.
Key | Description |
---|---|
g | Go to the start of the file |
e | Go to the end of the file |
h | Go to the start of the line |
l | Go to the end of the line |
s | Go to first non-whitespace character of the line |
t | Go to the top of the screen |
m | Go to the middle of the screen |
b | Go to the bottom of the screen |
d | Go to definition |
y | Go to type definition |
r | Go to references |
i | Go to implementation |
a | Go to the last accessed/alternate file |
Match mode
Enter this mode using m
from normal mode. See the relavant section
in Usage for an explanation about surround usage.
Key | Description |
---|---|
m | Goto matching bracket |
s <char> | Surround current selection with <char> |
r <from><to> | Replace surround character <from> with <to> |
d <char> | Delete surround character <char> |
Object mode
TODO: Mappings for selecting syntax nodes (a superset of [
).
Window mode
This layer is similar to vim keybindings as kakoune does not support window.
Key | Description |
---|---|
w , Ctrl-w | Switch to next window |
v , Ctrl-v | Vertical right split |
h , Ctrl-h | Horizontal bottom split |
q , Ctrl-q | Close current window |
Space mode
This layer is a kludge of mappings I had under leader key in neovim.
Key | Description |
---|---|
f | Open file picker |
b | Open buffer picker |
s | Open symbol picker (current document) |
w | Enter window mode |
space | Keep primary selection TODO: it's here because space mode replaced it |
p | paste system clipboard after selections |
P | paste system clipboard before selections |
y | join and yank selections to clipboard |
Y | yank main selection to clipboard |
R | replace selections by clipboard contents |
Picker
Keys to use within picker.
Key | Description |
---|---|
Up , Ctrl-p | Previous entry |
Down , Ctrl-n | Next entry |
Ctrl-space | Filter options |
Enter | Open selected |
Ctrl-h | Open horizontally |
Ctrl-v | Open vertically |
Escape , Ctrl-c | Close picker |
Key Remapping
One-way key remapping is temporarily supported via a simple TOML configuration file. (More powerful solutions such as rebinding via commands will be available in the feature).
To remap keys, write a config.toml
file in your helix
configuration
directory (default ~/.config/helix
in Linux systems) with a structure like
this:
# At most one section each of 'keys.normal', 'keys.insert' and 'keys.select'
[keys.normal]
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 Control-Shift-Escape to extend_line
[keys.insert]
A-x = "normal_mode" # Maps Alt-X to enter normal mode
Control, 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" |
< | "lt" |
> | "gt" |
+ | "plus" |
- | "minus" |
; | "semicolon" |
% | "percent" |
Left | "left" |
Right | "right" |
Up | "up" |
Home | "home" |
End | "end" |
Page | "pageup" |
Page | "pagedown" |
Tab | "tab" |
Back | "backtab" |
Delete | "del" |
Insert | "ins" |
Null | "null" |
Escape | "esc" |
Commands can be found in the source code at helix-term/src/commands.rs