{ config, lib, pkgs, ... }: let nixpkgs = import {}; in { home.packages = with pkgs; [ kak-lsp rnix-lsp gocode gogetdoc jq aspell aspellDicts.it aspellDicts.en aspellDicts.en-computers aspellDicts.en-science ]; programs.kakoune = { enable = true; config = { colorScheme = "nord"; tabStop = 2; indentWidth = 2; scrollOff = { lines = 5; columns = 3; }; ui = { setTitle = true; changeColors = true; enableMouse = true; }; wrapLines = { enable = true; word = true; }; numberLines = { enable = true; highlightCursor = true; }; keyMappings = [ { mode = "normal"; docstring = "Open file"; key = ""; effect = ":edit"; } { mode = "user"; docstring = "Comment block"; key = "b"; effect = ":comment-block"; } { mode = "user"; docstring = "Comment line"; key = "l"; effect = ":comment-line"; } { mode = "user"; docstring = "Show hover info"; key = "q"; effect = ":lsp-hover"; } { mode = "user"; docstring = "Jump to definition"; key = "d"; effect = ":lsp-definition"; } { mode = "user"; docstring = "List project diagnostics"; key = "i"; effect = ":lsp-diagnostics"; } { mode = "user"; docstring = "Jump to type definition"; key = "t"; effect = ":lsp-type-definition"; } { mode = "user"; docstring = "Code actions"; key = "a"; effect = ":lsp-code-actions"; } { mode = "user"; docstring = "Format code"; key = "F"; effect = ":lsp-formatting-sync"; } { mode = "user"; docstring = "Spellcheck"; key = "s"; effect = ":spell "; } { mode = "user"; docstring = "Spellcheck English"; key = "S"; effect = ":spell en"; } { mode = "user"; docstring = "Copy to clipboard"; key = "y"; effect = "${pkgs.xclip}/bin/xclip -i -selection clipboard"; } { mode = "user"; docstring = "Paste from clipboard (before)"; key = "p"; effect = "!${pkgs.xclip}/bin/xclip -selection clipboard -o"; } { mode = "user"; docstring = "Paste from clipboard (after)"; key = "P"; effect = "${pkgs.xclip}/bin/xclip -selection clipboard -o"; } ]; hooks = [ { name = "WinSetOption"; option = "filetype=(rust|python|c|cpp|latex|javascript|go)"; commands = builtins.concatStringsSep "\n" [ "lsp-enable-window" ]; } { name = "BufCreate"; option = ".*"; commands = "editorconfig-load"; } { name = "ModuleLoaded"; option = "powerline"; commands = builtins.concatStringsSep "\n" [ "powerline-enable" ]; } { name = "ModuleLoaded"; option = "auto-pairs"; commands = "auto-pairs-enable"; } { name = "InsertCompletionShow"; option = ".*"; commands = builtins.concatStringsSep "\n" [ "map window insert " "map window insert " ]; } { name = "InsertCompletionHide"; option = ".*"; commands = builtins.concatStringsSep "\n" [ "unmap window insert " "unmap window insert " ]; } ]; }; extraConfig = builtins.concatStringsSep "\n" [ "# Extra" "define-command -docstring 'save and quit' x 'write-all; quit'" "add-highlighter global/ regex \\h+$ 0:Error # " "eval %sh{kak-lsp --kakoune -s \$kak_session} # Start kak-lsp" "require-module auto-pairs" "require-module powerline" ]; plugins = (with pkgs.kakounePlugins; [ kak-auto-pairs ]) ++ (with nixpkgs; [ kakounePlugins.prelude-kak kakounePlugins.powerline-kak ]); }; xdg.configFile."kak-lsp/kak-lsp.toml".source = ../configs/kak-lsp/kak-lsp.toml; }