Skip to content

Setting Plugin Options

Screwtapello edited this page Jan 19, 2020 · 1 revision

Many Kakoune plugins, both third-party and ones that come with Kakoune, can be configured by setting options in your kakrc. However, sometimes when you add something to your kakrc like:

set-option global termcmd "gnome-terminal -e"

...Kakoune will throw an error at startup like:

'set-option' option not found: 'termcmd'. Use declare-option first

This might be because you've mistyped the option name, but it's also possible that the plugin is a module, which is especially likely if the plugin isn't always applicable - for example, a plugin for a specific filetype might not be loaded until a file of that type is opened, and a plugin to integrate with an external tool might not be loaded unless that tool is available. The termcmd option in the example above is created by the x11 plugin, which isn't loaded unless Kakoune is running inside an X11 windowing environment.

If this is the case, the first thing you need to do is figure out the name of the module that defines the option you want to set. That information should be listed in the documentation for the plugin, but as a last resort you can search through all your plugins to find the .kak file that defines the option, then search within that file for the provide-module command that defines the module.

Once you know the name of the module you'll need, you'll need to add a hook to set the option once the module is loaded. Following our example above, the termcmd option is set in the x11 module, so we would add the following snippet to our kakrc:

hook global ModuleLoaded x11 %{
    set-option global termcmd "gnome-terminal -e"
}
Clone this wiki locally