From 52c4f6469f7aa62702d51c6997c675b0a6e3ce42 Mon Sep 17 00:00:00 2001 From: staticsafe Date: Thu, 8 Mar 2012 11:42:00 -0500 Subject: [PATCH] adding some hooks --- .zshrc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.zshrc b/.zshrc index 0c53fd5..ff9a6fa 100644 --- a/.zshrc +++ b/.zshrc @@ -36,3 +36,25 @@ alias stripext="ls -1 | sed 's/\(.*\)\..*/\1/'" #default apps export EDITOR="vim" + +#hooks +function precmd { + # vcs_info + # Put the string "hostname::/full/directory/path" in the title bar: + echo -ne "\e]2;$PWD\a" + + # Put the parentdir/currentdir in the tab + echo -ne "\e]1;$PWD:h:t/$PWD:t\a" +} + +function set_running_app { + printf "\e]1; $PWD:t:$(history $HISTCMD | cut -b7- ) \a" +} + +function preexec { + set_running_app +} + +function postexec { + set_running_app +}