From dbe1459fb12b7f063fae78b8be03f01994d46109 Mon Sep 17 00:00:00 2001 From: fleaz Date: Mon, 2 Jun 2025 17:29:41 +0200 Subject: [PATCH] zsh: Alias k9s and add indicator for NOHIST mode Triggered via "unset HISTFILE" --- home-manager/modules/zsh.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/home-manager/modules/zsh.nix b/home-manager/modules/zsh.nix index cd92958..4f69133 100644 --- a/home-manager/modules/zsh.nix +++ b/home-manager/modules/zsh.nix @@ -21,9 +21,11 @@ "watch" = "watch "; # https://unix.stackexchange.com/a/25329 "kge" = "kubectl get events --sort-by='.lastTimestamp'"; "devcontainer" = "docker compose -f docker-compose.yml -f .devcontainer/docker-compose.yml"; # Poor mans devcontainer + "k9s" = "k9s -c pods --splashless --logoless"; }; initExtra = '' setopt APPEND_HISTORY # Append history to global histfile on exit + setopt HIST_IGNORE_SPACE # dont save commands starting with a whitespace autoload -U colors && colors @@ -35,8 +37,13 @@ function get_k8s_info(){ kubectl config get-contexts| grep "*" | awk '{print $3"/"$5}' } + function secret_sesion(){ + if ! test -v HISTFILE; then + echo %{$fg[red]%}NOHIST%{$reset_color%} + fi + } - RPS1='$(is_ssh) $(get_k8s_info)' + RPS1='$(secret_sesion) $(is_ssh) $(get_k8s_info)' export EDITOR="nvim"; export PATH="$PATH:$HOME/.krew/bin:$HOME/bin:$HOME/go/bin"; source <(kubectl completion zsh)