{ config, lib, options, pkgs, ... }: { config.programs.kakoune = lib.mkIf config.editors.kakoune.enable { enable = true; colorSchemePackage = pkgs.kakounePlugins.kakoune-catppuccin; config = { alignWithTabs = true; colorScheme = "catppuccin_mocha"; hooks = [ { commands = "set window tabstop 2"; group = "set-indentwidth"; name = "WinSetOption"; option = "filetype=(nix)"; } { commands = "lsp-enable-window"; name = "WinSetOption"; option = "filetype=(css|html|java|zig)"; } { commands = "set buffer filetype json"; name = "BufCreate"; option = ".*\.mcmeta"; } { commands = '' set buffer lsp_servers %{ [vscode-json-language-server] args = ["--stdio"] root_globs = [".git"] settings_section = "_" [[vscode-json-language-server.settings._]] provideFormatter = true json.format.enable = true json.validate.enabble = true [[vscode-json-language-server.settings._.json.schemas]] fileMatch = ["fabric.mod.json"] url = "https://www.schemastore.org/fabric.mod.json" } ''; name = "BufSetOption"; option = "filetype=json"; } ]; indentWidth = 0; keyMappings = [ { docstring = "Open a new window"; effect = ":new"; key = ""; mode = "normal"; } { docstring = "Open a new file"; effect = ":e %sh{${pkgs.fd}/bin/fd -tf | fuzzel --prompt=\"open: \" --dmenu --minimal-lines --width=60}"; key = ""; mode = "normal"; } { docstring = "Comment the selected line(s)"; effect = ":comment-line"; key = ""; mode = "normal"; } { docstring = "Rename the symbol below the cursor"; effect = ":lsp-rename-prompt"; key = ""; mode = "normal"; } { docstring = "Create a new file"; effect = ":e %sh{${(pkgs.writeShellScript "newfile" (builtins.readFile ./newfile.sh))}}"; key = ""; mode = "normal"; } ]; numberLines = { enable = true; highlightCursor = true; relative = true; }; tabStop = 4; ui.assistant = "cat"; }; defaultEditor = true; extraConfig = builtins.readFile ./kakrc; plugins = with pkgs.kakounePlugins; [ auto-pairs-kak kakoune-extra-filetypes kakoune-lsp ]; }; options.editors.kakoune.enable = lib.mkEnableOption "rosa's kakoune setup"; }