Jujutsu integration for Kakoune
plugin kakoune
README.md

kak-jj #

A plugin providing Jujutsu integration for Kakoune.

Installation #

kak-jj is quite simple to install.

  1. Clone this repository into your plugins directory.
  2. Source the rc/jj.kak file in your kakrc, or load it by any other method you want.

Usage #

kak-jj currently provides command integration and highlighting.

Command Integration #

Command integration allows you to execute Jujutsu commands directly from Kakoune, and is highly customisable.

To run a Jujutsu command, you can use the jj-run-command command. This command accepts a single string argument containing the Jujutsu command to execute. For example, to run jj status, you would use jj-run-command status. The output of any Jujutsu commands is shown in a buffer with the filetype jj-output.

kak-jj provides sevaral common Jujutsu commands directly as Kakoune commands. Currently, these are jj-status and jj-log, but their code can easily serve as a basic template for defining your own.

Options #

kak-jj exposes several options as part of command integration.

  • jj_output_readonly: a boolean value indicating whether the jj-output buffer is readonly. This defaults to false.
  • jj_default_arguments: a string value containing default arguments to pass to Jujutsu. This defaults to --no-pager.

Color #

Kakoune cannot show color in Jujutsu output buffers by default. Since color is quite important, there is a solution for this.

The kak-ansi plugin provides ANSI color highlighting for Kakoune buffers.

After installing this plugin, you can quickly enable color integration for jj-output buffers by adding a hook to your kakrc. For example:

hook global WinSetOption filetype=jj-output %{
    ansi-render
    ansi-enable
}

In addition to this, you may need to enable color output from Jujutsu, as this is disabled by default when the output is piped. You can utilise the jj_default_arguments option for this. For example, in your kakrc:

set-option global jj_default_arguments "--no-pager --config ui.color=always"

With this, you should be able to get color output.

Highlighting #

Highlighting is done on all .jjdescription files by default, and currently supports a basic feature set including comments and status lines.