Python and Nix scripts to generate kak-tree-sitter grammars, queries and themes by relying on Helix repository.
Nix flakes + home-manager
module only for now, because that's what I use.
- Add the this flake to flake inputs.
- Pass the home-manager module to
extraSpecialArgs
. - Import it:
import = [...];
. programs.kak-tree-sitter-helix.enable = true;
This will:
- Add
kak-tree-sitter
package to yourhome.packages
. - Create
$XDG_CONFIG_HOME/kak-tree-sitter/config.toml
file. - Create
$XDG_CONFIG_HOME/kak/colors
dir with themes. - Create
$XDG_DATA_DIR/kak-tree-sitter
dir with grammars and queries.
# flake.nix
{
inputs = {
home-manager.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
kak-tree-sitter-helix.inputs.nixpkgs.follows = "nixpkgs";
kak-tree-sitter-helix.url = "github:igor-ramazanov/kak-tree-sitter-helix";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = {
home-manager,
kak-tree-sitter-helix,
nixpkgs,
self,
}: {
nixosConfigurations.MY_PC_HOSTNAME = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager = {
extraSpecialArgs = {
inherit (kak-tree-sitter-helix.homeManagerModules.x86_64-linux) kak-tree-sitter-helix;
};
users.MY_USERNAME = import ./home-manager.nix;
};
}
];
};
}
}
# home-manager.nix
{kak-tree-sitter-helix,...}: {
imports = [kak-tree-sitter-helix];
programs.kak-tree-sitter-helix.enable = true;
}
Make sure you have the following code somewhere in $XDG_CONFIG_DIR/kak/autoload
:
eval %sh{ kak-tree-sitter --kakoune --daemonize --server --session $kak_session }
colorscheme termcolors # Unnecessary, read below.
colorscheme catppuccin-latte # Or any other theme from $XDG_CONFIG_DIR/kak/colors.
The $XDG_CONFIG_DIR/kak/colors/termcolors.kak
opinionatedly sets default Kakoune faces using ANSI terminal colors.
The reason is that I use Stylix to have consistent theming across the whole NixOS, and termcolors.kak
makes the Kakoune UI bit more consistent with the terminal colors.
I'll remove it in the future once I figure out mapping from Helix to Kakoune's default and UI faces.
kak-tree-sitter
is an amazing tool that brings the power of tree-sitter to Kakoune.
However, it requires laboursome configuration to define grammars and themes.
I would like to recreate Helix-like experience with minimal configuration.
This repo is in a heavy work-in-progress state, consult with the source code first.