Skip to content

Commit cf38aef

Browse files
committed
Make prompt flatter.
- Fixes problems with history searching.
1 parent e453f25 commit cf38aef

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

dotfiles/bashrc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ source ~/bin/git-completion.bash
4141

4242
export GIT_PS1_SHOWDIRTYSTATE=1
4343

44-
# Define the prompt
45-
PS1='\[\033[00;35m\][\A] ${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;38m\]\w\[\033[00m\]$(__git_ps1 " (%s)")\n\$ '
46-
4744
# If this is an xterm set the title to user@host:dir
4845
case "$TERM" in
4946
xterm*|rxvt*)
@@ -144,18 +141,22 @@ else
144141
esac
145142
fi
146143

144+
SUFFIX=""
147145
if [ "$SESSION_TYPE" != "local" ]; then
148-
PS1="${PS1::-2}[\033[01;31m\](ssh session)\[\033[00m\]$ ";
146+
SUFFIX="${SUFFIX}(ssh session)";
149147
fi
150148

151149
if [ -n "$STY" ]; then
152-
PS1="${PS1::-2}[\033[01;34m\](screen)\[\033[00m\]$ ";
150+
SUFFIX="${SUFFIX}(screen)";
153151
fi
154152

155153
if [ -n "$TMUX" ]; then
156-
PS1="${PS1::-2}[\033[01;36m\](tmux)\[\033[00m\]$ ";
154+
SUFFIX="${SUFFIX}(tmux)";
157155
fi
158156

157+
# Define the prompt
158+
PS1='\[\033[00;35m\][\A] ${debian_chroot:+($debian_chroot)} \[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;31m\]${SUFFIX}\[\033[00m\]:\[\033[01;38m\]\w\[\033[00m\]$(__git_ps1 " (%s)")\n\$ '
159+
159160
# Ruby in the path
160161
if which ruby >/dev/null && which gem >/dev/null; then
161162
PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH"

0 commit comments

Comments
 (0)