config/modules/kak/kakrc.nix

73 lines
1.4 KiB
Nix
Raw Normal View History

2022-05-15 23:32:21 +02:00
# Defines the kakrc.
{
# Feature flags
typescript ? false,
haskell ? false,
python ? false,
rust ? false,
nix ? true,
# Color theme
theme,
# Build tools
pkgs,
lib,
}:
# If any of the language features are enabled, enable the
# extra language server-related keybinds and options.
let ide = typescript || haskell || python || rust || nix;
# Generic keybinds
keybinds = ''
'';
# IDE mode enables the language server protocol client
# and adds keybinds for lsp-hover and lsp-code-actions.
# If `rust` is enabled, lsp-semantic-tokens is also used.
ide-config = (lib.optionalString ide ''
'');
# Sometimes work requires me to touch the frontend. Ew
typescript-config = (lib.optionalString typescript ''
'');
# Haskell development
haskell-config = (lib.optionalString haskell ''
'');
# Python-related config
python-config = (lib.optionalString python ''
'');
# Rust development
rust-config = (lib.optionalString rust ''
'');
# Nix hacking-related configuration
nix-config = (lib.optionalString nix ''
'');
in pkgs.writeTextFile (rec {
name = "kakrc.kak";
destination = "/share/kak/autoload/${name}";
text = with theme; ''
'' ++ keybinds
++ typescript-config
++ haskell-config
++ python-config
++ rust-config
++ nix-config;
})