From 8ec5790d6c5eb9f833f1bb3c0e36c578c419a70d Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Sat, 10 Nov 2007 15:22:54 +0000 Subject: [PATCH] Add [vim] to prompt when the shell is a child of the editor. git-svn-id: https://svn.cambridge.iain.cx/profile/trunk@83 6be0d1a5-5cfe-0310-89b6-964be062b18b --- .profile.d/prompt.bashrc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.profile.d/prompt.bashrc b/.profile.d/prompt.bashrc index 58c2222..6c2e2bb 100644 --- a/.profile.d/prompt.bashrc +++ b/.profile.d/prompt.bashrc @@ -4,14 +4,22 @@ # SSH_FORWARDED=$(get_remote_ip -n) -if [ ! -z "$SSH_FORWARDED" ]; then - if [ ! "$SSH_FORWARDED" = "10.99.10.121" -a ! "$SSH_FORWARDED" = "ip01pc" ]; then +if [ ! -z "$SSH_FORWARDED" -a ! "$SSH_ORIGINAL_COMMAND" = "/usr/NX/bin/nxnode" ]; 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 fi -info="$HOSTNAME$SSH_FORWARDED" +else + SSH_FORWARDED="" +fi +if ps -o comm= -p $PPID 2>/dev/null | grep '^vim*$' &>/dev/null; then + VIMCHILD=" [vim]" +else + 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 +unset info blank SSH_FORWARDED VIMCHILD -- 2.20.1