Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'use this for zsh' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
use this for zsh
Authored by: sapporo on Oct 20, '03 11:56:04AM
function precmd(){ echo -n "^[]0;$PWD^G" }
Note that ^[ is actually the esc character and ^G is ctrl-G. To enter these characters in zsh, use the following sequences for each (as mentioned here):
^[   ctrl-v followed by esc  
^G   ctrl-v followed by ctrl-g  


[ Reply to This | # ]
I use this little shell script
Authored by: semios on Oct 20, '03 06:29:03PM
Use the instructions in the parent comment to insert the "^[" and the "^G". Or just download it here and don't bother trying to coerce vi into making funny control characters.
#!/bin/sh
# title
#
# Shane Celis <shane@gnufoo.org>

if [ $# -eq 0 ] || [ "$1" == "-h" ]; then
	echo "usage: title <string>" >&2
	echo "sets the title for the terminal window" >&2
	exit 2;
fi
title="$@";
echo -n "^[]0;$title^G"


[ Reply to This | # ]
use this for zsh
Authored by: juggularity on Feb 24, '09 11:43:21AM
You can use something like this instead
function chpwd(){ echo -ne "e]0;$PWD}a" }
which is cut/paste safe. I prefer having just the current directory displayed instead of the whole pathname. To do this replace
$PWD
with
${PWD##/*/}


[ Reply to This | # ]