2012-02-02 362 views
1

我正在使用以下.bashrc文件。選項卡完成工作正常。然而。 #show分支的第二段代碼不太好。當我第一次設置並採購它時,它運行良好。我的終端窗口是在家裏的位置看起來像這樣[~]$,當它在一個分支像[direcorty (master)]$然而,當我打開一個新的終端標籤窗口它回到像Anders-imac:~ anderskitson$這樣的東西我如何獲得顯示分支在狀態線留下。#使用.bashrc在終端中顯示分支

#Git tab completion 
source ~/git-completion.bash 
# Show branch in status line 
PS1='[\W$(__git_ps1 " (%s)")]\$ ' 
export PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/~}\007"' 

回答

1

它不停留的原因可能是因爲您的終端使用的是.bash_profile而不是您的.bashrc

我想創建一個鏈接到您的.bashrc文件,使所有新的終端窗口將使用代碼從一個單一的.bashrc文件:如果

mv ~/.bash_profile ~/.bash_profile.bak 
ln -s ~/.bashrc ~/.bash_profile 

mv =舉動,這將備份當前的.bash_profile你在那裏有重要的東西,你想保持。 ln -s =創建從.bashrc到.bash_profile的符號鏈接。

0

也許你的shell是登錄shell?如果是,.bashrc不一定會被讀取。嘗試在您的.bash_profile中進行類似的更改,或者只需從.bash_profile發送.bashrc即可。