]> ruderich.org/simon Gitweb - config/dotfiles.git/blobdiff - zsh/rc
zsh/rc: Add new section custom commands.
[config/dotfiles.git] / zsh / rc
diff --git a/zsh/rc b/zsh/rc
index 5e2c06c87b48d4533bbc2dd6baaf86291603a4aa..f246528163262626d3a3b737f67b7f689f99ecd7 100644 (file)
--- a/zsh/rc
+++ b/zsh/rc
@@ -317,7 +317,8 @@ add-zsh-hook precmd prompt_precmd
 # currently running program.
 #
 # When a program is started preexec() sets the window's name to it; when it
-# stops precmd() resets the window's name to 'zsh'.
+# stops precmd() resets the window's name to 'zsh'. 'fg' is supported and sets
+# the window's name to the resumed job.
 #
 # It works with screen, xterm and rxvt.
 #
@@ -350,6 +351,14 @@ if [[ $TERM == screen* || $TERM == xterm* || $TERM == rxvt* ]]; then
             program_name=${program_name#sudo }
             program_sudo=yes
         fi
+
+        # Replace fg with the resumed job name.
+        if [[ $program_name == fg ]]; then
+            program_name=${jobtexts[%+]}
+        elif [[ $program_name == fg* ]]; then
+            program_name=${jobtexts[${program_name#fg }]}
+        fi
+
         # Remove all arguments from the program name.
         program_name=${program_name%% *}
 
@@ -615,6 +624,9 @@ if [[ -n $window_reset ]]; then
     alias clear='clear; window_reset=yes; window_precmd reset'
 fi
 
+
+# CUSTOM COMMANDS
+
 # Display all branches (except stash) in gitk but only 200 commits as this is
 # much faster. Also put in the background and disown. Thanks to sitaram in
 # #git on Freenode (2009-04-20 15:51).