about summary refs log tree commit diff stats
path: root/bash/prompt.bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash/prompt.bash')
-rw-r--r--bash/prompt.bash25
1 files changed, 25 insertions, 0 deletions
diff --git a/bash/prompt.bash b/bash/prompt.bash new file mode 100644 index 0000000..c61266b --- /dev/null +++ b/bash/prompt.bash
@@ -0,0 +1,25 @@
1# bash prompt
2
3PS1=
4
5# user, host, and cwd
6PROMPT_DIRTRIM=3 # how many dirs above current to print (rest are '...')
7PS1+='\[\e[36m\]\u@\h \w'
8
9# git bit
10source /usr/share/git/git-prompt.sh &&
11 PS1+='\[\e[35m\]$(__git_ps1)'
12
13# newline
14PS1+='\[\e[0m\]\n'
15
16# exit code (only if error)
17__prompt_exit_code() {
18 local ec=$?
19 (( $ec > 0 )) &&
20 printf "$ec"
21}
22PS1+='\[\e[31m\]$(__prompt_exit_code)\[\e[0m\]'
23
24# delimiter
25PS1+='; '