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.
extraSpecialArgs
.import = [...];
.programs.kak-tree-sitter-helix.enable = true;
This will:
kak-tree-sitter
package to your home.packages
.$XDG_CONFIG_HOME/kak-tree-sitter/config.toml
file.$XDG_CONFIG_HOME/kak/colors
dir with themes.$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;
};
}
];
};
}
}
# flake.nix
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
kak-tree-sitter-helix.url = "github:igor-ramazanov/kak-tree-sitter-helix";
kak-tree-sitter-helix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nixpkgs, home-manager, kak-tree-sitter-helix, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
homeConfigurations."username" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home.nix
];
extraSpecialArgs = {
inherit (kak-tree-sitter-helix.homeManagerModules.x86_64-linux) kak-tree-sitter-helix;
};
};
};
{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
or in $XDG_CONFIG_DIR/kak/kakrc
:
eval %sh{ kak-tree-sitter -dks --init $kak_session }
colorscheme termcolors # Unnecessary, read below.
colorscheme catppuccin-latte # Or any other theme from $XDG_CONFIG_DIR/kak/colors.
For more information on kak-tree-sitter flags visit usage manual.
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.
nord
:
catpuccin-macchiato
:
everforest-dark
: