Jelajahi Sumber

Use prompts w/o full path in dumb terminals

George Jones 8 bulan lalu
induk
melakukan
5c8099cedc
1 mengubah file dengan 9 tambahan dan 0 penghapusan
  1. 9 0
      .bashrc

+ 9 - 0
.bashrc

@@ -179,6 +179,15 @@ else
     export PROMPT_COMMAND="history -a; history -c; history -r;echo -ne \"\033]0;\`whoami\`@\`hostname -s\`:\`pwd\`\007\""
 fi
 
+
+# for working in emacs shell
+if [[ "$TERM" == "dumb" ]]; then
+    # No terminal escape characters for color, etc.
+    # only include final element of pwd
+    export PROMPT_COMMAND='echo -ne ${WINDOW_NAME} $USER@$HOSTNAME:`pwd | sed s#\.\*/##g`'
+    export PS1=" \u@\$(prompt-hostname) \W $(git-branch-prompt) \$ "
+fi
+
 # modern GPG setup
 # https://stackoverflow.com/questions/17769831/how-to-make-gpg-prompt-for-passphrase-on-cli
 #