From ed58c47bf44edf94813d658b00222847ec75d73e Mon Sep 17 00:00:00 2001 From: Crony Akatsuki Date: Tue, 29 Apr 2025 12:24:43 +0200 Subject: [PATCH] feat(zsh): update zsh config to use new options. --- modules/cross-platform/home-manager/zsh.nix | 47 ++++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/modules/cross-platform/home-manager/zsh.nix b/modules/cross-platform/home-manager/zsh.nix index ebc48fb..7eaebaa 100644 --- a/modules/cross-platform/home-manager/zsh.nix +++ b/modules/cross-platform/home-manager/zsh.nix @@ -8,6 +8,32 @@ crony.zsh.enable = lib.mkEnableOption "Enable zsh and customize it."; }; + imports = [ + ({lib, ...}: { + programs.zsh.initContent = lib.mkBefore '' + # Tmux autostart + if [ -x "$(command -v tmux)" ] && [ -n "$DISPLAY" ] && [ -z "$TMUX" ]; then + exec tmux new-session -A -s default >/dev/null 2>&1 + fi + ''; + }) + ({...}: { + programs.zsh.initContent = '' + ${pkgs.nerdfetch}/bin/nerdfetch + # VI Mode escape timeout fix + export KEYTIMEOUT=1 + + # Substring search settings + export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="bg=blue,fg=black,bold" + export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=black,bold' + bindkey -M vicmd 'k' history-substring-search-up + bindkey -M vicmd 'j' history-substring-search-down + + [[ -f "$HOME/.config/zsh/functions.zsh" ]] && source "$HOME/.config/zsh/functions.zsh" + ''; + }) + ]; + config = lib.mkIf config.crony.zsh.enable { # Setup zsh programs.zsh = { @@ -35,27 +61,6 @@ vif = ''nvim $(fzf --preview="bat --color=always {}")''; }; - initExtra = '' - ${pkgs.nerdfetch}/bin/nerdfetch - # VI Mode escape timeout fix - export KEYTIMEOUT=1 - - # Substring search settings - export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="bg=blue,fg=black,bold" - export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=black,bold' - bindkey -M vicmd 'k' history-substring-search-up - bindkey -M vicmd 'j' history-substring-search-down - - [[ -f "$HOME/.config/zsh/functions.zsh" ]] && source "$HOME/.config/zsh/functions.zsh" - ''; - - initExtraFirst = '' - # Tmux autostart - if [ -x "$(command -v tmux)" ] && [ -n "$DISPLAY" ] && [ -z "$TMUX" ]; then - exec tmux new-session -A -s default >/dev/null 2>&1 - fi - ''; - antidote = { enable = true; plugins = [