Created
February 27, 2012 15:26
-
-
Save chenqj/1924654 to your computer and use it in GitHub Desktop.
动态更改iTerm的tab title
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############################## | |
| # 在通过cd命令更改目录时,可动态将iTerm的tab title改为当前的目录(只取最近的目录名) | |
| # Usage:加入到~/.bash_profile,并重新source使其生效 | |
| ############################## | |
| # change tab title | |
| settitle() { printf '\e]0;'${@}'\a' ; return ; } | |
| # rewrite cd | |
| cd() { command cd "$@"; settitle $(basename $(pwd)); return ; } | |
| settitle $(basename $(pwd)) | |
| ############################## | |
| # 更简单的版本 | |
| # Usage:加入到~/.bash_profile,并重新source使其生效 | |
| ############################## | |
| export PROMPT_COMMAND='echo -ne "\033]0;$(basename $(PWD))\007"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment