Hey gang, I’m trying to get some minor highlighting support for Nushell in Kakoune, and I’m getting nothing. I have the following for a file nu.kak
in my $KAK_CONFIG/rc/filetypes
:
# === Nushell filetype support for Kakoune ===
provide-module nu %@
# --- Highlighters (region-based) ---
add-highlighter shared/nu regions
# Code region (default)
add-highlighter shared/nu/code default-region group
# Interpolated double-quoted strings: $"..."
add-highlighter shared/nu/interp_double_string region '\$"' '"' fill string
# Interpolated single-quoted strings: $'...'
add-highlighter shared/nu/interp_single_string region "\\$'" "'" fill string
# Regular double-quoted strings
add-highlighter shared/nu/double_string region '"' (?<!\\)(?:\\\\)*" fill string
# Regular single-quoted strings
add-highlighter shared/nu/single_string region "'" (?<!\\)(?:\\\\)*' fill string
# Comments
add-highlighter shared/nu/comment region '#' $ fill comment
add-highlighter shared/nu/code/keyword regex '\b(def|let|if|else|for|while|match|return|break|continue|try|catch|module|export|use|source|mut|const|true|false|nothing|int|float|bool|str|list|record|table|closure|binary|glob|cell-path)\b' 0:keyword
add-highlighter shared/nu/code/value regex '\b([0-9]+)\b' 0:value
# add more eventually
@
# --- Filetype detection and hook ---
hook global BufCreate .*\.nu$ %{
set-option buffer filetype nu
}
hook global WinSetOption filetype=nu %{
set-option window tabstop 2
set-option window indentwidth 2
# --- Lint ---
set-option window lintcmd 'sleep 0.2; nu-check $kak_buffile'
hook window -group lint BufWritePost .* lint
hook -once window WinSetOption filetype=.* %{
unset-option window lintcmd
}
# Optionally enable rainbow parentheses if you use that plugin
# rainbow-enable-window
}
hook -group nu-highlight global WinSetOption filetype=nu %{
add-highlighter window/nu ref nu
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/nu }
}
But no highlighting ever gets applied.
I also get nothing from kak-tree-sitter with the following in my configuration:
# nu
[grammar.nu.source.git ]
url = "https://github.com/nushell/tree-sitter-nu"
pin = "358c4f509eb97f0148bbd25ad36acc729819b9c1"
[language.nu]
aliases = [ "nu", "nushell" ]
[language.nu.queries.source.git]
url = "https://github.com/helix-editor/helix"
pin = "7275b7f85014aad7e15d4987ec4f2249572eecfb"
So I don’t quite know what is going wrong where.
Kakoune version: Kakoune 2025.06.03-41-gcfa40b71
OS: MacOS
Installation method: brew install kakoune --HEAD