Helix: Difference between revisions

From NixOS Wiki
imported>Mbwk
Initial article on Helix
 
Klinger (talk | contribs)
m short example about tree-sitter integration
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[https://helix-editor.com/ Helix] is a modal text-editor inspired by [[Neovim]] and [[Kakoune]], written in Rust.
[https://helix-editor.com/ Helix] is a modal text-editor inspired by [[Neovim]] and [[Kakoune]], written in Rust. Compared to neovim, it is preconfigured with the functions that most people need (for example tree-sitter for syntax highlighting). It has no plugin system. It uses (neo-)vim motions keybindings, but it uses the object-verb approach (visually highlighting text and then executing a function on it). It is intended for people who like to use a modal text editor but don't want to spend a lot of time configuring it.


== Installation ==
== Installation ==
Line 5: Line 5:
<syntaxhighlight lang=nix>
<syntaxhighlight lang=nix>
environment.systemPackages = [ pkgs.helix ];
environment.systemPackages = [ pkgs.helix ];
</syntaxhighlight>
</syntaxhighlight>Depending on the programming languages it is helpful to install additional packages from nixpgks. To show what packages are needed, it is helpful to check <code>hx --health</code>.
 
=== With Home Manager ===
=== With Home Manager ===
[[Home Manager]] provides a module for configuring helix.
[[Home Manager]] provides a module for configuring helix.
<syntaxhighlight lang=nix>
<syntaxhighlight lang="nix">
programs.helix = {
programs.helix = {
   enable = true;
   enable = true;
Line 23: Line 22:
     name = "nix";
     name = "nix";
     auto-format = true;
     auto-format = true;
     formatter.command = "${pkgs.nixfmt}/bin/nixfmt";
     formatter.command = lib.getExe pkgs.nixfmt-rfc-style;
   }];
   }];
   themes = {
   themes = {
Line 33: Line 32:
};
};
</syntaxhighlight>
</syntaxhighlight>
== Configuration ==
The configuration is stored in two files: <code>~/.config/helix/config.toml</code> and <code>~/.config/helix/language.toml</code>.
* The full configuration options are described on the [https://docs.helix-editor.com/ Helix documentation].
* For programming languages (LSP, formatter, ..) see the [https://github.com/helix-editor/helix/wiki/Language-Server-Configurations Helix wiki].
[[Category:Applications]]
[[Category:Text Editor]]

Latest revision as of 18:46, 25 June 2024

Helix is a modal text-editor inspired by Neovim and Kakoune, written in Rust. Compared to neovim, it is preconfigured with the functions that most people need (for example tree-sitter for syntax highlighting). It has no plugin system. It uses (neo-)vim motions keybindings, but it uses the object-verb approach (visually highlighting text and then executing a function on it). It is intended for people who like to use a modal text editor but don't want to spend a lot of time configuring it.

Installation

Helix can be installed system-wide on NixOS with the helix package:

environment.systemPackages = [ pkgs.helix ];

Depending on the programming languages it is helpful to install additional packages from nixpgks. To show what packages are needed, it is helpful to check hx --health.

With Home Manager

Home Manager provides a module for configuring helix.

programs.helix = {
  enable = true;
  settings = {
    theme = "autumn_night_transparent";
    editor.cursor-shape = {
      normal = "block";
      insert = "bar";
      select = "underline";
    };
  };
  languages.language = [{
    name = "nix";
    auto-format = true;
    formatter.command = lib.getExe pkgs.nixfmt-rfc-style;
  }];
  themes = {
    autumn_night_transparent = {
      "inherits" = "autumn_night";
      "ui.background" = { };
    };
  };
};

Configuration

The configuration is stored in two files: ~/.config/helix/config.toml and ~/.config/helix/language.toml.