Skip to content

Commit

Permalink
zsh: fix terminal title, to not expand %xyz from the typed cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
bew committed Nov 11, 2020
1 parent abea890 commit ccea7f1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions zsh/rc/terminal_title.zsh
@@ -1,6 +1,4 @@
# Sets the status line (title bar for most terminal emulator)
#
# The argument will be expanded like a prompt string
function term::set_status_line
{
local text="$1"
Expand All @@ -9,14 +7,15 @@ function term::set_status_line
# fsl (from_status_line): Move cursor from status line
if [[ -n "$terminfo[tsl]" ]] && [[ -n "$terminfo[fsl]" ]]; then
echoti tsl # to status line
print -Pn "$text"
print -n "$text"
echoti fsl # from status line
fi
}

function set_title_on_idle
{
term::set_status_line 'term - %~'
# expand the current directory like a prompt first!
term::set_status_line "$(print -Pn "term - %~")"
}
hooks-add-hook precmd_hook set_title_on_idle

Expand Down

0 comments on commit ccea7f1

Please sign in to comment.