From 11f606f0dd9cec978d305414af0687a320214883 Mon Sep 17 00:00:00 2001 From: Malte Tammena Date: Sat, 14 May 2022 15:15:32 +0200 Subject: [PATCH] [user/malte] Improve kakoune theme --- users/malte/kakoune.nix | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/users/malte/kakoune.nix b/users/malte/kakoune.nix index f7d5205..d76b569 100644 --- a/users/malte/kakoune.nix +++ b/users/malte/kakoune.nix @@ -166,27 +166,41 @@ lightModeConfig = let bg62 = col.bg.rgbWithAlpha 0.62; fg1 = col.light1.rgb; - in '' + in pkgs.writeText "lightmoderc" '' colorscheme gruvbox-light face global PrimarySelection rgba:${bg62},rgba:8ec07c40 face global SecondarySelection rgba:${bg62},rgba:83a59840 face global MatchingChar rgb:${col.bg.rgb},rgb:${fg1}+bf face global Reference rgb:${fg1} + face global Information Default + remove-hooks global theme + # FZF + hook global -group theme ModuleLoaded fzf %{ + set-option global fzf_default_opts '--color=light,gutter:-1' + } + try %{ set-option global fzf_default_opts '--color=light,gutter:-1' } ''; darkModeConfig = let fg62 = col.fg.rgbWithAlpha 0.62; bg1 = col.dark1.rgb; - in '' + in pkgs.writeText "darkmoderc" '' colorscheme gruvbox-dark face global PrimarySelection rgba:${fg62},rgba:8ec07c40 face global SecondarySelection rgba:${fg62},rgba:83a59840 face global MatchingChar rgb:${col.fg.rgb},rgb:${bg1}+bf face global Reference rgb:${bg1} - ''; - linkTheme = theme: '' - ln -sf ~/${config.xdg.configFile."kak/${theme}".target} ${currentThemeFile} + face global Information Default + remove-hooks global theme + # FZF + hook global -group theme ModuleLoaded fzf %{ + set-option global fzf_default_opts '--color=dark,gutter:-1' + } + try %{ set-option global fzf_default_opts '--color=dark,gutter:-1' } ''; currentThemeFile = "${configDir}/theme"; + linkTheme = theme: '' + ln -sf ${theme} ${currentThemeFile} + ''; # Configuration for kakoune LSP # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ @@ -336,29 +350,27 @@ in { }; xdg.configFile."kak-lsp/kak-lsp.toml".source = kakLspConfigGen.generate "kak-lsp.toml" kakLspConfig; - xdg.configFile."kak/light-moderc".text = lightModeConfig; - xdg.configFile."kak/dark-moderc".text = darkModeConfig; services.darkman.scripts."kakoune.sh" = { onLight = pkgs.writeScript "kakoune-light" '' #!${pkgs.runtimeShell} for id in $(${kakBin} -l); do - echo 'source ~/${config.xdg.configFile."kak/light-moderc".target}' | ${kakBin} -p $id + echo 'source ${lightModeConfig}' | ${kakBin} -p $id done - ${linkTheme "light-moderc"} + ${linkTheme lightModeConfig} ''; onDark = pkgs.writeScript "kakoune-dark" '' #!${pkgs.runtimeShell} for id in $(${kakBin} -l); do - echo 'source ~/${config.xdg.configFile."kak/dark-moderc".target}' | ${kakBin} -p $id + echo 'source ${darkModeConfig}' | ${kakBin} -p $id done - ${linkTheme "dark-moderc"} + ${linkTheme darkModeConfig} ''; initialize = pkgs.writeScript "kakoune-initialize" '' # Create the folder mkdir -p ${configDir} - if [[ ! -e ${configDir}/${currentThemeFile} ]]; then - ${linkTheme "light-moderc"} + if [[ ! -e ${currentThemeFile} ]]; then + ${linkTheme lightModeConfig} fi ''; };