Skip to content

Commit 606237f

Browse files
authored
Merge pull request magicmonty#248 from imbibinebe/master
Minimal theme based on TruncatedPwd_WindowTitle
2 parents e6708c3 + 88fae61 commit 606237f

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

themes/Minimal.bgptheme

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
##############################################################################
2+
# Changes the prompt to a Debian-style one that truncates pwd to a max length
3+
# depending on the terminal column width. Also uses the prompt_callback
4+
# function of bash-git-prompt to set the window title to almost the same
5+
# Debian-style. This version has been tweaked for Ubuntu standard terminal
6+
# fonts.
7+
#
8+
# The prompt will use a Debian-style on the form
9+
#
10+
# relative-path-from-git-toplevel-dir bash-git-prompt-info <exit status>
11+
# HH:MM:SS ▶
12+
#
13+
# The window title will have the form
14+
# relative-path-from-git-toplevel-dir
15+
#
16+
# Example usage:
17+
# if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then
18+
# GIT_PROMPT_THEME=Minimal
19+
# source ~/.bash-git-prompt/gitprompt.sh
20+
# fi
21+
#
22+
# Imbibinebe <[email protected]> [https://github.com/imbibinebe]
23+
##############################################################################
24+
override_git_prompt_colors() {
25+
GIT_PROMPT_THEME_NAME="Minimal"
26+
27+
#Overrides the prompt_callback function used by bash-git-prompt
28+
function prompt_callback {
29+
GIT_CONTAINER_FOLDER_FULLPATH=$(git rev-parse --show-toplevel 2> /dev/null)
30+
GIT_CONTAINER_FOLDER=$(basename $GIT_CONTAINER_FOLDER_FULLPATH 2> /dev/null)
31+
CURRENT_FULLPATH=$(pwd)
32+
local PS1=$GIT_CONTAINER_FOLDER${CURRENT_FULLPATH#$GIT_CONTAINER_FOLDER_FULLPATH}
33+
gp_set_window_title "$PS1"
34+
echo -n "${BoldYellow}${PS1}${ResetColor}"
35+
}
36+
37+
Time12a="\$(date +%H:%M:%S)"
38+
GIT_PROMPT_BRANCH="${BoldMagenta}" # the git branch that is active in the current directory
39+
GIT_PROMPT_PREFIX="" # start of the git info string
40+
GIT_PROMPT_SUFFIX="" # the end of the git info string
41+
GIT_PROMPT_SEPARATOR="" # separates each item
42+
GIT_PROMPT_STAGED=" ${Green}●" # the number of staged files/directories
43+
GIT_PROMPT_CONFLICTS=" ${BoldRed}✖" # the number of files in conflict
44+
GIT_PROMPT_CHANGED=" ${BoldBlue}✚" # the number of changed files
45+
46+
# GIT_PROMPT_REMOTE=" " # the remote branch name (if any) and the symbols for ahead and behind
47+
GIT_PROMPT_UNTRACKED=" ${Cyan}…" # the number of untracked files/dirs
48+
GIT_PROMPT_STASHED=" ${BoldCyan}⚑" # the number of stashed files/dir
49+
GIT_PROMPT_CLEAN=" ${BoldGreen}✔" # a colored flag indicating a "clean" repo
50+
51+
local gp_end="_LAST_COMMAND_INDICATOR_\n${White}${Time12a}${ResetColor}"
52+
53+
GIT_PROMPT_START_USER=""
54+
GIT_PROMPT_END_USER="${gp_end} ▶ "
55+
GIT_PROMPT_END_ROOT="${gp_end} /!!!\ "
56+
57+
GIT_PROMPT_COMMAND_OK="${Green} ✔ " # indicator if the last command returned with an exit code of 0
58+
GIT_PROMPT_COMMAND_FAIL="${BoldRed} ✘-_LAST_COMMAND_STATE_" # indicator if the last command returned with an exit code of other than 0
59+
}
60+
61+
reload_git_prompt_colors "Minimal"

0 commit comments

Comments
 (0)