2023-01-24 02:24:40 +07:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
|
|
wrapKakoune = { extraPackages ? [] , withPython3 ? true, extraPython3Packages ? (_: []) }:
|
|
|
|
pkgs.symlinkJoin {
|
|
|
|
postBuild = ''
|
|
|
|
rm $out/bin/kak
|
|
|
|
makeWrapper ${lib.escapeShellArgs (
|
|
|
|
[ "${pkgs.kakoune-unwrapped}/bin/kak" "${placeholder "out"}/bin/kak" ]
|
|
|
|
++ [ "--suffix" "PATH" ":" (lib.makeBinPath (extraPackages ++ [(pkgs.python3.withPackages extraPython3Packages)])) ]
|
|
|
|
)}
|
|
|
|
'';
|
|
|
|
buildInputs = [ pkgs.makeWrapper ]; preferLocalBuild = true;
|
|
|
|
name = "kakoune${pkgs.kakoune-unwrapped.version}"; paths = [ pkgs.kakoune-unwrapped ];
|
|
|
|
passthru.unwrapped = pkgs.kakoune-unwrapped; meta = pkgs.kakoune-unwrapped.meta; version = pkgs.kakoune-unwrapped.version;
|
|
|
|
};
|
|
|
|
in {
|
|
|
|
programs.kakoune = {
|
|
|
|
enable = true;
|
|
|
|
package = wrapKakoune {
|
|
|
|
extraPackages = with pkgs; [
|
|
|
|
rust-analyzer
|
|
|
|
nodePackages.bash-language-server shellcheck
|
|
|
|
nodePackages.typescript-language-server
|
2023-03-16 23:37:57 +07:00
|
|
|
clang-tools_latest
|
2023-01-24 02:24:40 +07:00
|
|
|
nodePackages.vscode-langservers-extracted
|
|
|
|
nil
|
|
|
|
marksman
|
|
|
|
taplo
|
|
|
|
];
|
|
|
|
extraPython3Packages = (pypkgs: with pypkgs; [ python-lsp-server ]);
|
|
|
|
};
|
|
|
|
config = {
|
|
|
|
# colorScheme
|
|
|
|
ui.changeColors = false;
|
|
|
|
};
|
|
|
|
extraConfig = ''
|
|
|
|
eval %sh{kak-lsp --kakoune -s $kak_session}
|
|
|
|
lsp-enable
|
2023-02-03 13:07:57 +07:00
|
|
|
hook global BufOpenFile .* autoconfigtab
|
|
|
|
hook global BufNewFile .* autoconfigtab
|
2023-01-24 02:24:40 +07:00
|
|
|
'';
|
2023-02-03 13:07:57 +07:00
|
|
|
plugins = with pkgs.kakounePlugins; [ kak-lsp smarttab-kak tabs-kak ];
|
2023-01-24 02:24:40 +07:00
|
|
|
};
|
2023-01-25 01:33:07 +07:00
|
|
|
xdg.configFile."kak-lsp/kak-lsp.toml".text = ''
|
2023-01-24 02:24:40 +07:00
|
|
|
# bash, clangd, json, html, css, python work out of the box
|
|
|
|
[language.rust]
|
|
|
|
filetypes = ["rust"]
|
|
|
|
roots = ["rust-toolchain.toml", "rust-toolchain", "Cargo.toml"]
|
|
|
|
command = "rust-analyzer"
|
|
|
|
[language.typescript]
|
|
|
|
filetypes = ["typescript"]
|
|
|
|
roots = ["package.json"]
|
|
|
|
command = "typescript-language-server"
|
|
|
|
args = ["--stdio"]
|
|
|
|
[language.nix]
|
|
|
|
filetypes = ["nix"]
|
|
|
|
roots = ["flake.nix"]
|
|
|
|
command = "nil"
|
|
|
|
[language.markdown]
|
|
|
|
filetypes = ["markdown"]
|
|
|
|
roots = []
|
|
|
|
command = "marksman"
|
|
|
|
[language.toml]
|
|
|
|
filetypes = ["toml"]
|
|
|
|
roots = []
|
|
|
|
command = "taplo"
|
|
|
|
'';
|
|
|
|
}
|