~hadronized/kak-tree-sitter

#Welcome!

Welcome! This wiki is there to help users navigating around the project.

For contributors, please refer to the contributing guide instead.

#Getting started

#What is this?

This project bridges tree-sitter and Kakoune via a server, that can be run on the CLI or inside Kakoune as a daemon. The server is unique to your machine, so it doesn’t matter that you start it from several Kakoune sessions, only one server will be up. When the server is up, it remains up until the last session exits (if started from within Kakoune), or when you send it the SIGINT signal (Ctrl-C) if started on the CLI.

When the server is started from Kakoune, it will install some commands and hooks to be able to communicate with the server. The configuration allows to decide which commands, hooks, user-modes etc. you want to have installed.

A running server will wait for a session to send requests, and will reply asynchronously. That prevents your editor from freezing and allows the server to maintain a state / view of your per-session buffers. Because it uses tree-sitter under the hood, it will parse the content of your buffers as trees, allowing for fast operations.

Several features are supported / will be supported. You can refer to the Features document to know more about what you can do with the tree-sitter integration.

In order to work, the server requires some runtime resources to be available. This project doesn’t ship with any of such resources, and you are free to use whichever sources you want. Two main kinds of resources are needed:

  • Grammars, which are C dynamic libraries loaded at runtime by the server and used to parse your buffers and operate on trees.
  • Queries, which are scm strings allowing to query parsed trees with a Lisp-like syntax. We use those to, mostly, unify the type of queries to all languages/grammars, such as highlighting, text-objects, indents, etc.

You can either find those resources yourself, or use the provided controller companion of the server that provides that for free. See the ktsctl section.

#Prerequisites

You must have Kakoune installed. The rest is handled by this project.

#What you should expect

The project was made in a way that supports most of the features that are natively available in other editors regarding tree-sitter, such as Helix. It tries to be frustration-free, shipping with a default sane configuration; you should — and will probably — never modify the configuration, but if you need to, you can. The server and the Kakoune side of the project is made in a way that puts performance at top priority. Because we are using a UNIX approach, we try to minimize as much as possible process starts, memory writes, etc., approaching as near as possible memory-to-memory communication. Finally, the controller should do everything for you, provided you instruct what you want. You are not required to know anything about tree-sitter, nor how a query works or even how to compile a grammar. We do that for you. Just focus on what’s important; your own projects.

#What you should not expect

The server is mostly about transformations. It doesn’t ship with data. Hence, you will not get grammars and queries shipped with the binary by default. It is important that you understand that; it works out of the box, but you still need to tell it what you want first.

Colorscheme support is hard. Using this project won’t automatically make your colorscheme look super nice. You will have to adapt or use a new, tree-sitter-powered colorscheme. The community tries its best to provide more and more colorschemes. You shall want to visit the Highlighting document for further information.

#Install

Refer to the Install page.

#Configuration

Refer to the Configuration page.

#Features

Refer to the Features page.

#Using kak-tree-sitter

Refer to the Using kak-tree-sitter page.

#Using ktsctl

Refer to the Using ktsctl page.

#Completions

Refer to the Completions page.

#Frequently Asked Questions

FAQ.

About this wiki

commit 0afe974335db3491a7e34ad6a3a38cca97616c9b
Author: Dimitri Sabadie <hadronized@strongly-typed-thoughts.net>
Date:   2026-03-06T09:54:50+01:00

Add notes on $XDG_RUNTIME_DIR and log files.
Clone this wiki ("wiki" branch)
https://git.sr.ht/~hadronized/kak-tree-sitter (read-only)
git@git.sr.ht:~hadronized/kak-tree-sitter (read/write)