From b6538e6139f0158099bd407bb737ed7b9af26e67 Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Sun, 6 Nov 2016 02:57:14 +0100 Subject: Move preexec to theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- zsh/aliases.zsh | 11 ----------- zsh/themes/prompt_kyrias_setup | 11 ++++++++++- 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'zsh') diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 85b7a35..4b9ad55 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -47,17 +47,6 @@ sp() { printf '%s' "$@"; printf '\n'; } have() { command -v "$1" >&/dev/null; } -# Print basic prompt to the window title -function precmd { - print -Pn "\e];%n %~\a" -} - -# Print the current running command's name to the window title -function preexec { - local cmd=${1[(wr)^(*=*|sudo|exec|ssh|-*)]} - print -Pn "\e];$cmd:q\a" -} - # service management if have systemctl && [[ -d /run/systemd/system ]]; then alias ssctl='sudo systemctl' diff --git a/zsh/themes/prompt_kyrias_setup b/zsh/themes/prompt_kyrias_setup index 68dbfd8..7082677 100644 --- a/zsh/themes/prompt_kyrias_setup +++ b/zsh/themes/prompt_kyrias_setup @@ -19,13 +19,22 @@ venv_prompt() { } prompt_kyrias_precmd() { - print -Pn "\e];%n %~\a" + # Print line to the window title + print -P "\e];%n %~\a" +} + +prompt_kyrias_preexec() { + # Print currently running command name to the window title + print -P "\e];$1:q\a" } prompt_kyrias_setup() { setopt prompt_subst autoload -U colors && colors + add-zsh-hook precmd prompt_kyrias_precmd + add-zsh-hook preexec prompt_kyrias_preexec + PROMPT='%{$bg[$(prompt_user_color)]$fg[white] %m %k%f$bg[white]$fg[$(prompt_user_color)] %~ %f%k$(venv_prompt) $bg[blue]%} λ %k %}' } -- cgit v1.2.3-70-g09d2