From a3b73b945d5309afe9759b8f8c8de35a2b57a345 Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Fri, 25 Jan 2008 13:13:16 +0000 Subject: [PATCH] Clear the [vim] mark from the window title when exiting a vim window. git-svn-id: https://svn.cambridge.iain.cx/profile/trunk@98 6be0d1a5-5cfe-0310-89b6-964be062b18b --- .profile.d/prompt.bashrc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.profile.d/prompt.bashrc b/.profile.d/prompt.bashrc index c21a031..e6a8236 100644 --- a/.profile.d/prompt.bashrc +++ b/.profile.d/prompt.bashrc @@ -4,21 +4,23 @@ # SSH_FORWARDED=$(get_remote_ip -n) -if [ ! -z "$SSH_FORWARDED" -a ! "$SSH_ORIGINAL_COMMAND" = "/usr/NX/bin/nxnode" ]; then +if [ ! -z "$SSH_FORWARDED" ]; then if [ ! "$SSH_FORWARDED" = "62.189.242.202" -a ! "$SSH_FORWARDED" = "62.189.241.202" ]; then SSH_FORWARDED=" (from $SSH_FORWARDED)" else SSH_FORWARDED= fi -else - SSH_FORWARDED="" fi + +info="$HOSTNAME$SSH_FORWARDED" + +# Check for vim. +vimchild=" [vim]" if ps -o comm= -p $PPID 2>/dev/null | grep '^vim*$' &>/dev/null; then - VIMCHILD=" [vim]" -else - VIMCHILD= + # Clear [vim] when exiting. + trap "echo -ne '\\033]0;$info\\007'" exit + info="$info$vimchild" fi -info="$HOSTNAME$SSH_FORWARDED$VIMCHILD" -blank=$(echo $info | sed 's/./ /g') -export PROMPT_COMMAND="echo -ne '\033]0;$info\007\r$blank\r'" -unset info blank SSH_FORWARDED VIMCHILD +blank=$(echo "$info" | sed 's/./ /g') +export PROMPT_COMMAND="echo -ne '\033]0;$info\007\r$blank \r'" +unset blank info vimchild SSH_FORWARDED -- 2.7.4