commit
c037462c8e
@ -0,0 +1,23 @@ |
||||
Copyright (c) {{{year}}}, {{{fullname}}} |
||||
All rights reserved. |
||||
|
||||
Redistribution and use in source and binary forms, with or without |
||||
modification, are permitted provided that the following conditions are met: |
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this |
||||
list of conditions and the following disclaimer. |
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, |
||||
this list of conditions and the following disclaimer in the documentation |
||||
and/or other materials provided with the distribution. |
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
@ -0,0 +1,25 @@ |
||||
require "formula" |
||||
|
||||
class BashGitPrompt < Formula |
||||
homepage "https://github.com/magicmonty/bash-git-prompt" |
||||
url "https://github.com/magicmonty/bash-git-prompt/archive/2.3.5.tar.gz" |
||||
sha1 "16e1a9ab0ac711de79fd3b823138c16fadb3d5de" |
||||
head "https://github.com/magicmonty/bash-git-prompt.git" |
||||
|
||||
def install |
||||
share.install "gitprompt.sh", "gitprompt.fish", "git-prompt-help.sh", |
||||
"gitstatus.sh", "prompt-colors.sh" |
||||
|
||||
(share/"themes").install Dir["themes/*.bgptheme"], "themes/Custom.bgptemplate" |
||||
doc.install "README.md" |
||||
end |
||||
|
||||
def caveats; <<-EOS.undent |
||||
You should add the following to your .bashrc (or equivalent): |
||||
if [ -f "$(brew --prefix bash-git-prompt)/share/gitprompt.sh" ]; then |
||||
GIT_PROMPT_THEME=Default |
||||
source "$(brew --prefix bash-git-prompt)/share/gitprompt.sh" |
||||
fi |
||||
EOS |
||||
end |
||||
end |
||||
@ -0,0 +1,76 @@ |
||||
%global START_TOKEN ### Generated by %{name} rpm package |
||||
%global END_TOKEN ### Generated by %{name} rpm package |
||||
|
||||
Name: bash-git-prompt |
||||
Version: 1.0 |
||||
Release: 1%{?dist} |
||||
Summary: Informative git prompt for bash and fish |
||||
|
||||
Group: Development/Tools |
||||
License: GPL |
||||
URL: https://github.com/magicmonty/bash-git-prompt.git |
||||
Source0: https://github.com/magicmonty/bash-git-prompt/archive/%{name}-%{version}.tgz |
||||
Requires: git |
||||
BuildArch: noarch |
||||
|
||||
%description |
||||
A bash prompt that displays information about the current git repository. In particular the branch name, difference with remote branch, number of files staged, changed, etc. |
||||
|
||||
This package will automatically enable the git prompt for bash after |
||||
install. It will disable the prompt accordingly after uninstall. |
||||
|
||||
%prep |
||||
%setup -q |
||||
|
||||
|
||||
%build |
||||
|
||||
|
||||
%install |
||||
rm -rf %{buildroot} |
||||
|
||||
install -d 755 %{buildroot}%{_datadir}/%{name} |
||||
install -pm 755 *.sh %{buildroot}%{_datadir}/%{name} |
||||
#install -pm 755 *.py %{buildroot}%{_datadir}/%{name} |
||||
install -pm 755 *.fish %{buildroot}%{_datadir}/%{name} |
||||
install -pm 644 README.md %{buildroot}%{_datadir}/%{name} |
||||
install -d 755 %{buildroot}%{_datadir}/%{name}/themes |
||||
install -pm 644 themes/*.bgptheme %{buildroot}%{_datadir}/%{name}/themes |
||||
install -pm 644 themes/*.bgptemplate %{buildroot}%{_datadir}/%{name}/themes |
||||
|
||||
# never include compiled Python program |
||||
#rm -fr %{buildroot}%{_datadir}/%{name}/*.pyo |
||||
#rm -fr %{buildroot}%{_datadir}/%{name}/*.pyc |
||||
|
||||
|
||||
%clean |
||||
rm -rf %{buildroot} |
||||
|
||||
|
||||
%files |
||||
%defattr(-,root,root,-) |
||||
%{_datadir}/%{name} |
||||
|
||||
|
||||
%post |
||||
# enable bash-git-prompt |
||||
cat << EOF >> /etc/bashrc |
||||
%{START_TOKEN} |
||||
if [ -f %{_datadir}/%{name}/gitprompt.sh ]; then |
||||
# Set config variables first |
||||
|
||||
GIT_PROMPT_ONLY_IN_REPO=1 |
||||
GIT_PROMPT_THEME=Default |
||||
source %{_datadir}/%{name}/gitprompt.sh |
||||
fi |
||||
%{END_TOKEN} |
||||
EOF |
||||
|
||||
%postun |
||||
# remove bash-git-prompt setup |
||||
sed -i -e '/^%{START_TOKEN}/, /^%{END_TOKEN}/{d}' /etc/bashrc |
||||
|
||||
|
||||
%changelog |
||||
* Fri Aug 08 2014 Justin Zhang <schnell18@gmail.com - 1.0.1-1 |
||||
- Initial version of package |
||||
@ -1,27 +0,0 @@ |
||||
local Time12a="\$(date +%H:%M)" |
||||
local PathShort="\w" |
||||
|
||||
# These are the color definitions used by gitprompt.sh |
||||
GIT_PROMPT_PREFIX="[" # start of the git info string |
||||
GIT_PROMPT_SUFFIX="]" # the end of the git info string |
||||
GIT_PROMPT_SEPARATOR="|" # separates each item |
||||
|
||||
GIT_PROMPT_BRANCH="${Magenta}" # the git branch that is active in the current directory |
||||
GIT_PROMPT_STAGED="${Red}●" # the number of staged files/directories |
||||
GIT_PROMPT_CONFLICTS="${Red}✖" # the number of files in conflict |
||||
GIT_PROMPT_CHANGED="${Blue}✚" # the number of changed files |
||||
|
||||
GIT_PROMPT_REMOTE=" " # the remote branch name (if any) and the symbols for ahead and behind |
||||
GIT_PROMPT_UNTRACKED="${Cyan}…" # the number of untracked files/dirs |
||||
GIT_PROMPT_STASHED="${BoldBlue}⚑" # the number of stashed files/dir |
||||
GIT_PROMPT_CLEAN="${BoldGreen}✔" # a colored flag indicating a "clean" repo |
||||
|
||||
GIT_PROMPT_START_USER="${Yellow}${PathShort}${ResetColor}" |
||||
GIT_PROMPT_START_ROOT="${Yellow}${PathShort}${ResetColor}" |
||||
GIT_PROMPT_END_USER=" \n${White}${Time12a}${ResetColor} $ " |
||||
GIT_PROMPT_END_ROOT=" \n${White}${Time12a}${ResetColor} # " |
||||
|
||||
# Please do not add colors to these symbols |
||||
GIT_PROMPT_SYMBOLS_AHEAD="↑·" # The symbol for "n versions ahead of origin" |
||||
GIT_PROMPT_SYMBOLS_BEHIND="↓·" # The symbol for "n versions behind of origin" |
||||
GIT_PROMPT_SYMBOLS_PREHASH=":" # Written before hash of commit, if no name could be found |
||||
@ -0,0 +1,86 @@ |
||||
# prompt-colors.sh |
||||
# |
||||
# source this file to get color definitions |
||||
# if $debug or $verbose is set, the definitions |
||||
# are also printed to STDERR. |
||||
|
||||
define_color_names() { |
||||
|
||||
ColorNames=( Black Red Green Yellow Blue Magenta Cyan White ) |
||||
FgColors=( 30 31 32 33 34 35 36 37 ) |
||||
BgColors=( 40 41 42 43 44 45 46 47 ) |
||||
|
||||
local AttrNorm=0 |
||||
local AttrBright=1 |
||||
local AttrDim=2 |
||||
local AttrUnder=4 |
||||
local AttrBlink=5 |
||||
local AttrRev=7 |
||||
local AttrHide=8 |
||||
|
||||
# define "BoldCOLOR", "BrightCOLOR", and "DimCOLOR" names |
||||
|
||||
# _map_colors ATTRNAME ATTRVALUE |
||||
# |
||||
# Defines three names for every color, attribute combintaion: |
||||
# {ATTRNAME}{COLORNAME} |
||||
# {ATTRNAME}{COLORNAME}Fg |
||||
# {ATTRNAME}{COLORNAME}Bg |
||||
# |
||||
# Example: BoldRed, BoldRedFg, BoldRedBg |
||||
|
||||
_map_colors() { |
||||
local x=0 |
||||
local attrname="$1" |
||||
local attrcode=$2 |
||||
while (( x < 8 )) ; do |
||||
local colorname=${ColorNames[x]} |
||||
local fgcolorcode=${FgColors[x]} |
||||
local bgcolorcode=${BgColors[x]} |
||||
longcolorname="${attrname}${colorname}" |
||||
_def_color $longcolorname $attrcode $fgcolorcode |
||||
_def_color ${longcolorname}Fg $attrcode $fgcolorcode |
||||
_def_color ${longcolorname}Bg $attrcode $bgcolorcode |
||||
(( x++ )) |
||||
done |
||||
} |
||||
|
||||
# _term_color [ N | N M ] |
||||
_term_color() { |
||||
local cv |
||||
if (( $# > 1 )); then |
||||
cv="${1};${2}" |
||||
else |
||||
cv="${1}" |
||||
fi |
||||
echo "\[\033[${cv}m\]" |
||||
} |
||||
|
||||
# def_color NAME ATTRCODE COLORCODE |
||||
_def_color() { |
||||
local def="$1=\"\`_term_color $2 $3\`\"" |
||||
if [[ -n "$debug$verbose" ]]; then |
||||
echo 1>&2 "+ $def" |
||||
fi |
||||
eval "$def" |
||||
} |
||||
|
||||
#ResetColor="`_term_color 0`" # Text reset |
||||
|
||||
_map_colors Bold $AttrBright |
||||
_map_colors Bright $AttrBright |
||||
_map_colors Dim $AttrDim |
||||
_map_colors '' $AttrNorm |
||||
|
||||
_def_color IntenseBlack 0 90 |
||||
_def_color ResetColor 0 0 |
||||
|
||||
} |
||||
|
||||
# do the color definitions only once |
||||
if [[ ${#ColorNames[*]} = 0 || -z "$IntenseBlack" || -z "$ResetColor" ]]; then |
||||
define_color_names |
||||
fi |
||||
|
||||
# end of prompt-colors.sh |
||||
# vim: set ai sw=2 |
||||
@ -0,0 +1,34 @@ |
||||
# This theme for gitprompt.sh is designed for dark color schemes |
||||
# it is clone of oh-my-zsh crunch theme style with exit status |
||||
|
||||
override_git_prompt_colors() { |
||||
if [ -e ~/.rvm/bin/rvm-prompt ]; then |
||||
RUBY_PROMPT='{$(~/.rvm/bin/rvm-prompt i v)}' |
||||
else |
||||
if command -v rbenv > /dev/null; then |
||||
RUBY_PROMPT='{$(rbenv version | sed -e "s/ (set.*$//")}' |
||||
fi |
||||
fi |
||||
Time12a="\$(date +%H:%M)" |
||||
|
||||
GIT_PROMPT_THEME_NAME="Crunch" |
||||
GIT_PROMPT_STAGED="${Yellow}● " |
||||
GIT_PROMPT_UNTRACKED="${Cyan}… " |
||||
GIT_PROMPT_STASHED="${BoldMagenta}⚑ " |
||||
GIT_PROMPT_CLEAN="${Green}✔ " |
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ " |
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘ " |
||||
|
||||
KERNEL_PROMPT='‹$(uname -r)›' |
||||
|
||||
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_${White}{${Yellow}${Time12a}${White}}[${Magenta}${RUBY_PROMPT}${White}]${Cyan}${PathShort}${White}:" |
||||
GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}" |
||||
GIT_PROMPT_END_USER="${BoldBlue} ➭ ${ResetColor}" |
||||
GIT_PROMPT_END_ROOT="${BoldRed} # ${ResetColor}" |
||||
GIT_PROMPT_LEADING_SPACE=0 |
||||
GIT_PROMPT_PREFIX="${Green}[" |
||||
GIT_PROMPT_SUFFIX="${Green}]" |
||||
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="✭" |
||||
} |
||||
|
||||
reload_git_prompt_colors "Crunch" |
||||
@ -0,0 +1,53 @@ |
||||
# This is the custom theme template for gitprompt.sh |
||||
|
||||
# These are the defaults from the "Default" theme |
||||
# You just need to override what you want to have changed |
||||
override_git_prompt_colors() { |
||||
GIT_PROMPT_THEME_NAME="Custom" |
||||
|
||||
# Time12a="\$(date +%H:%M)" |
||||
# PathShort="\w"; |
||||
|
||||
## These are the color definitions used by gitprompt.sh |
||||
# GIT_PROMPT_PREFIX="[" # start of the git info string |
||||
# GIT_PROMPT_SUFFIX="]" # the end of the git info string |
||||
# GIT_PROMPT_SEPARATOR="|" # separates each item |
||||
|
||||
# GIT_PROMPT_BRANCH="${Magenta}" # the git branch that is active in the current directory |
||||
# GIT_PROMPT_STAGED="${Red}●" # the number of staged files/directories |
||||
# GIT_PROMPT_CONFLICTS="${Red}✖ " # the number of files in conflict |
||||
# GIT_PROMPT_CHANGED="${Blue}✚ " # the number of changed files |
||||
|
||||
# GIT_PROMPT_REMOTE=" " # the remote branch name (if any) and the symbols for ahead and behind |
||||
# GIT_PROMPT_UNTRACKED="${Cyan}…" # the number of untracked files/dirs |
||||
# GIT_PROMPT_STASHED="${BoldBlue}⚑ " # the number of stashed files/dir |
||||
# GIT_PROMPT_CLEAN="${BoldGreen}✔" # a colored flag indicating a "clean" repo |
||||
|
||||
## For the command indicator, the placeholder _LAST_COMMAND_STATE_ |
||||
## will be replaced with the exit code of the last command |
||||
## e.g. |
||||
## GIT_PROMPT_COMMAND_OK="${Green}✔-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of 0 |
||||
## GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of other than 0 |
||||
|
||||
# GIT_PROMPT_COMMAND_OK="${Green}✔" # indicator if the last command returned with an exit code of 0 |
||||
# GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_" # indicator if the last command returned with an exit code of other than 0 |
||||
|
||||
## template for displaying the current virtual environment |
||||
## use the placeholder _VIRTUALENV_ will be replaced with |
||||
## the name of the current virtual environment (currently CONDA and VIRTUAL_ENV) |
||||
# GIT_PROMPT_VIRTUALENV="(${Blue}_VIRTUALENV_${ResetColor}) " |
||||
|
||||
## _LAST_COMMAND_INDICATOR_ will be replaced by the appropriate GIT_PROMPT_COMMAND_OK OR GIT_PROMPT_COMMAND_FAIL |
||||
# GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${Yellow}${PathShort}${ResetColor}" |
||||
# GIT_PROMPT_START_ROOT="_LAST_COMMAND_INDICATOR_ ${GIT_PROMPT_START_USER}" |
||||
# GIT_PROMPT_END_USER=" \n${White}${Time12a}${ResetColor} $ " |
||||
# GIT_PROMPT_END_ROOT=" \n${White}${Time12a}${ResetColor} # " |
||||
|
||||
## Please do not add colors to these symbols |
||||
# GIT_PROMPT_SYMBOLS_AHEAD="↑·" # The symbol for "n versions ahead of origin" |
||||
# GIT_PROMPT_SYMBOLS_BEHIND="↓·" # The symbol for "n versions behind of origin" |
||||
# GIT_PROMPT_SYMBOLS_PREHASH=":" # Written before hash of commit, if no name could be found |
||||
# GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="L" # This symbol is written after the branch, if the branch is not tracked |
||||
} |
||||
|
||||
reload_git_prompt_colors "Custom" |
||||
@ -0,0 +1,94 @@ |
||||
# This is the default theme for gitprompt.sh |
||||
|
||||
unset_git_prompt_colors() { |
||||
unset Time12a |
||||
unset PathShort |
||||
unset GIT_PROMPT_PREFIX |
||||
unset GIT_PROMPT_SUFFIX |
||||
unset GIT_PROMPT_SEPARATOR |
||||
unset GIT_PROMPT_BRANCH |
||||
unset GIT_PROMPT_STAGED |
||||
unset GIT_PROMPT_CONFLICTS |
||||
unset GIT_PROMPT_CHANGED |
||||
unset GIT_PROMPT_REMOTE |
||||
unset GIT_PROMPT_UNTRACKED |
||||
unset GIT_PROMPT_STASHED |
||||
unset GIT_PROMPT_CLEAN |
||||
unset GIT_PROMPT_COMMAND_OK |
||||
unset GIT_PROMPT_COMMAND_FAIL |
||||
unset GIT_PROMPT_VIRTUALENV |
||||
unset GIT_PROMPT_START_USER |
||||
unset GIT_PROMPT_START_ROOT |
||||
unset GIT_PROMPT_END_USER |
||||
unset GIT_PROMPT_END_ROOT |
||||
unset GIT_PROMPT_SYMBOLS_AHEAD |
||||
unset GIT_PROMPT_SYMBOLS_BEHIND |
||||
unset GIT_PROMPT_SYMBOLS_PREHASH |
||||
unset GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING |
||||
} |
||||
|
||||
define_helpers() |
||||
{ |
||||
Time12a="\$(date +%H:%M)" |
||||
PathShort="\w"; |
||||
} |
||||
|
||||
define_undefined_git_prompt_colors() { |
||||
if [[ -z ${GIT_PROMPT_THEME_NAME} ]]; then GIT_PROMPT_THEME_NAME="Default"; fi |
||||
|
||||
# These are the color definitions used by gitprompt.sh |
||||
if [[ -z ${GIT_PROMPT_PREFIX} ]]; then GIT_PROMPT_PREFIX="["; fi # start of the git info string |
||||
if [[ -z ${GIT_PROMPT_SUFFIX} ]]; then GIT_PROMPT_SUFFIX="]"; fi # the end of the git info string |
||||
if [[ -z ${GIT_PROMPT_SEPARATOR} ]]; then GIT_PROMPT_SEPARATOR="|"; fi # separates each item |
||||
|
||||
if [[ -z ${GIT_PROMPT_BRANCH} ]]; then GIT_PROMPT_BRANCH="${Magenta}"; fi # the git branch that is active in the current directory |
||||
if [[ -z ${GIT_PROMPT_STAGED} ]]; then GIT_PROMPT_STAGED="${Red}●"; fi # the number of staged files/directories |
||||
if [[ -z ${GIT_PROMPT_CONFLICTS} ]]; then GIT_PROMPT_CONFLICTS="${Red}✖ "; fi # the number of files in conflict |
||||
if [[ -z ${GIT_PROMPT_CHANGED} ]]; then GIT_PROMPT_CHANGED="${Blue}✚ "; fi # the number of changed files |
||||
|
||||
if [[ -z ${GIT_PROMPT_REMOTE} ]]; then GIT_PROMPT_REMOTE=" "; fi # the remote branch name (if any) and the symbols for ahead and behind |
||||
if [[ -z ${GIT_PROMPT_UNTRACKED} ]]; then GIT_PROMPT_UNTRACKED="${Cyan}…"; fi # the number of untracked files/dirs |
||||
if [[ -z ${GIT_PROMPT_STASHED} ]]; then GIT_PROMPT_STASHED="${BoldBlue}⚑ "; fi # the number of stashed files/dir |
||||
if [[ -z ${GIT_PROMPT_CLEAN} ]]; then GIT_PROMPT_CLEAN="${BoldGreen}✔"; fi # a colored flag indicating a "clean" repo |
||||
|
||||
# For the command indicator, the placeholder _LAST_COMMAND_STATE_ |
||||
# will be replaced with the exit code of the last command |
||||
# e.g. |
||||
# GIT_PROMPT_COMMAND_OK="${Green}✔-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of 0 |
||||
# GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of other than 0 |
||||
|
||||
if [[ -z ${GIT_PROMPT_COMMAND_OK} ]]; then GIT_PROMPT_COMMAND_OK="${Green}✔"; fi # indicator if the last command returned with an exit code of 0 |
||||
if [[ -z ${GIT_PROMPT_COMMAND_FAIL} ]]; then GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_"; fi # indicator if the last command returned with an exit code of other than 0 |
||||
|
||||
# template for displaying the current virtual environment |
||||
# use the placeholder _VIRTUALENV_ will be replaced with |
||||
# the name of the current virtual environment (currently CONDA and VIRTUAL_ENV) |
||||
if [[ -z ${GIT_PROMPT_VIRTUALENV} ]]; then GIT_PROMPT_VIRTUALENV="(${Blue}_VIRTUALENV_${ResetColor}) "; fi |
||||
|
||||
# _LAST_COMMAND_INDICATOR_ will be replaced by the appropriate GIT_PROMPT_COMMAND_OK OR GIT_PROMPT_COMMAND_FAIL |
||||
if [[ -z ${GIT_PROMPT_START_USER} ]]; then GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${Yellow}${PathShort}${ResetColor}"; fi |
||||
if [[ -z ${GIT_PROMPT_START_ROOT} ]]; then GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}"; fi |
||||
if [[ -z ${GIT_PROMPT_END_USER} ]]; then GIT_PROMPT_END_USER=" \n${White}${Time12a}${ResetColor} $ "; fi |
||||
if [[ -z ${GIT_PROMPT_END_ROOT} ]]; then GIT_PROMPT_END_ROOT=" \n${White}${Time12a}${ResetColor} # "; fi |
||||
|
||||
# Please do not add colors to these symbols |
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_AHEAD} ]]; then GIT_PROMPT_SYMBOLS_AHEAD="↑·"; fi # The symbol for "n versions ahead of origin" |
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_BEHIND} ]]; then GIT_PROMPT_SYMBOLS_BEHIND="↓·"; fi # The symbol for "n versions behind of origin" |
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_PREHASH} ]]; then GIT_PROMPT_SYMBOLS_PREHASH=":"; fi # Written before hash of commit, if no name could be found |
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING} ]]; then GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="L"; fi # This symbol is written after the branch, if the branch is not tracked |
||||
} |
||||
|
||||
# call only from theme file |
||||
reload_git_prompt_colors() { |
||||
if [[ "${GIT_PROMPT_THEME_NAME}" != $1 ]]; then |
||||
unset_git_prompt_colors |
||||
define_helpers |
||||
override_git_prompt_colors |
||||
define_undefined_git_prompt_colors |
||||
fi |
||||
} |
||||
|
||||
if [[ "${GIT_PROMPT_THEME}" == "Default" && "${GIT_PROMPT_THEME_NAME}" != "Default" ]]; then |
||||
define_helpers |
||||
define_undefined_git_prompt_colors |
||||
fi |
||||
@ -0,0 +1,11 @@ |
||||
# This is the default theme for gitprompt.sh |
||||
# without the indicator of the last command state |
||||
|
||||
override_git_prompt_colors() { |
||||
GIT_PROMPT_THEME_NAME="Default NoExitState" |
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘" # indicator if the last command returned with an exit code of other than 0 |
||||
GIT_PROMPT_START_USER="${Yellow}${PathShort}${ResetColor}" |
||||
GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}" |
||||
} |
||||
|
||||
reload_git_prompt_colors "Default NoExitState" |
||||
@ -0,0 +1,16 @@ |
||||
# This is the default theme for gitprompt.sh |
||||
# without the indicator of the last command state |
||||
# tweaked for Ubuntu terminal fonts |
||||
|
||||
override_git_prompt_colors() { |
||||
GIT_PROMPT_THEME_NAME="Default NoExitState Ubuntu" |
||||
GIT_PROMPT_STAGED="${Red}● " # the number of staged files/directories |
||||
GIT_PROMPT_UNTRACKED="${Cyan}… " # the number of untracked files/dirs |
||||
GIT_PROMPT_CLEAN="${BoldGreen}✔ " # a colored flag indicating a "clean" repo |
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ " # indicator if the last command returned with an exit code of 0 |
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘ " # indicator if the last command returned with an exit code of other than 0 |
||||
GIT_PROMPT_START_USER="${Yellow}${PathShort}${ResetColor}" |
||||
GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}" |
||||
} |
||||
|
||||
reload_git_prompt_colors "Default NoExitState Ubuntu" |
||||
@ -0,0 +1,12 @@ |
||||
# This is the default theme for gitprompt.sh |
||||
# tweaked for Ubuntu terminal fonts |
||||
|
||||
override_git_prompt_colors() { |
||||
GIT_PROMPT_THEME_NAME="Default Ubuntu" |
||||
GIT_PROMPT_STAGED="${Red}● " # the number of staged files/directories |
||||
GIT_PROMPT_UNTRACKED="${Cyan}… " # the number of untracked files/dirs |
||||
GIT_PROMPT_CLEAN="${BoldGreen}✔ " # a colored flag indicating a "clean" repo |
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ " # indicator if the last command returned with an exit code of 0 |
||||
} |
||||
|
||||
reload_git_prompt_colors "Default Ubuntu" |
||||
@ -0,0 +1,94 @@ |
||||
# This is an alternative approach. Single line in git repo. |
||||
|
||||
unset_git_prompt_colors() { |
||||
unset Time12a |
||||
unset PathShort |
||||
unset GIT_PROMPT_PREFIX |
||||
unset GIT_PROMPT_SUFFIX |
||||
unset GIT_PROMPT_SEPARATOR |
||||
unset GIT_PROMPT_BRANCH |
||||
unset GIT_PROMPT_STAGED |
||||
unset GIT_PROMPT_CONFLICTS |
||||
unset GIT_PROMPT_CHANGED |
||||
unset GIT_PROMPT_REMOTE |
||||
unset GIT_PROMPT_UNTRACKED |
||||
unset GIT_PROMPT_STASHED |
||||
unset GIT_PROMPT_CLEAN |
||||
unset GIT_PROMPT_COMMAND_OK |
||||
unset GIT_PROMPT_COMMAND_FAIL |
||||
unset GIT_PROMPT_VIRTUALENV |
||||
unset GIT_PROMPT_START_USER |
||||
unset GIT_PROMPT_START_ROOT |
||||
unset GIT_PROMPT_END_USER |
||||
unset GIT_PROMPT_END_ROOT |
||||
unset GIT_PROMPT_SYMBOLS_AHEAD |
||||
unset GIT_PROMPT_SYMBOLS_BEHIND |
||||
unset GIT_PROMPT_SYMBOLS_PREHASH |
||||
unset GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING |
||||
} |
||||
|
||||
define_helpers() |
||||
{ |
||||
Time12a="\$(date +%H:%M)" |
||||
PathShort="\w"; |
||||
} |
||||
|
||||
define_undefined_git_prompt_colors() { |
||||
if [[ -z ${GIT_PROMPT_THEME_NAME} ]]; then GIT_PROMPT_THEME_NAME="Single_line"; fi |
||||
|
||||
# These are the color definitions used by gitprompt.sh |
||||
if [[ -z ${GIT_PROMPT_PREFIX} ]]; then GIT_PROMPT_PREFIX="["; fi # start of the git info string |
||||
if [[ -z ${GIT_PROMPT_SUFFIX} ]]; then GIT_PROMPT_SUFFIX="]"; fi # the end of the git info string |
||||
if [[ -z ${GIT_PROMPT_SEPARATOR} ]]; then GIT_PROMPT_SEPARATOR="|"; fi # separates each item |
||||
|
||||
if [[ -z ${GIT_PROMPT_BRANCH} ]]; then GIT_PROMPT_BRANCH="${Magenta}"; fi # the git branch that is active in the current directory |
||||
if [[ -z ${GIT_PROMPT_STAGED} ]]; then GIT_PROMPT_STAGED="${Red}●"; fi # the number of staged files/directories |
||||
if [[ -z ${GIT_PROMPT_CONFLICTS} ]]; then GIT_PROMPT_CONFLICTS="${Red}✖ "; fi # the number of files in conflict |
||||
if [[ -z ${GIT_PROMPT_CHANGED} ]]; then GIT_PROMPT_CHANGED="${Blue}✚ "; fi # the number of changed files |
||||
|
||||
if [[ -z ${GIT_PROMPT_REMOTE} ]]; then GIT_PROMPT_REMOTE=" "; fi # the remote branch name (if any) and the symbols for ahead and behind |
||||
if [[ -z ${GIT_PROMPT_UNTRACKED} ]]; then GIT_PROMPT_UNTRACKED="${Cyan}…"; fi # the number of untracked files/dirs |
||||
if [[ -z ${GIT_PROMPT_STASHED} ]]; then GIT_PROMPT_STASHED="${BoldBlue}⚑ "; fi # the number of stashed files/dir |
||||
if [[ -z ${GIT_PROMPT_CLEAN} ]]; then GIT_PROMPT_CLEAN="${BoldGreen}✔"; fi # a colored flag indicating a "clean" repo |
||||
|
||||
# For the command indicator, the placeholder _LAST_COMMAND_STATE_ |
||||
# will be replaced with the exit code of the last command |
||||
# e.g. |
||||
# GIT_PROMPT_COMMAND_OK="${Green}✔-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of 0 |
||||
# GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of other than 0 |
||||
|
||||
if [[ -z ${GIT_PROMPT_COMMAND_OK} ]]; then GIT_PROMPT_COMMAND_OK="${Green}✔"; fi # indicator if the last command returned with an exit code of 0 |
||||
if [[ -z ${GIT_PROMPT_COMMAND_FAIL} ]]; then GIT_PROMPT_COMMAND_FAIL="${Red}✘"; fi # indicator if the last command returned with an exit code of other than 0 |
||||
|
||||
# template for displaying the current virtual environment |
||||
# use the placeholder _VIRTUALENV_ will be replaced with |
||||
# the name of the current virtual environment (currently CONDA and VIRTUAL_ENV) |
||||
if [[ -z ${GIT_PROMPT_VIRTUALENV} ]]; then GIT_PROMPT_VIRTUALENV="(${Blue}_VIRTUALENV_${ResetColor}) "; fi |
||||
|
||||
# _LAST_COMMAND_INDICATOR_ will be replaced by the appropriate GIT_PROMPT_COMMAND_OK OR GIT_PROMPT_COMMAND_FAIL |
||||
if [[ -z ${GIT_PROMPT_START_USER} ]]; then GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${White}${Time12a}${ResetColor} ${BoldYellow}${PathShort}${ResetColor}"; fi |
||||
if [[ -z ${GIT_PROMPT_START_ROOT} ]]; then GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}"; fi |
||||
if [[ -z ${GIT_PROMPT_END_USER} ]]; then GIT_PROMPT_END_USER="${ResetColor} $ "; fi |
||||
if [[ -z ${GIT_PROMPT_END_ROOT} ]]; then GIT_PROMPT_END_ROOT="${BoldRed} # "; fi |
||||
|
||||
# Please do not add colors to these symbols |
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_AHEAD} ]]; then GIT_PROMPT_SYMBOLS_AHEAD="↑·"; fi # The symbol for "n versions ahead of origin" |
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_BEHIND} ]]; then GIT_PROMPT_SYMBOLS_BEHIND="↓·"; fi # The symbol for "n versions behind of origin" |
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_PREHASH} ]]; then GIT_PROMPT_SYMBOLS_PREHASH=":"; fi # Written before hash of commit, if no name could be found |
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING} ]]; then GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="L"; fi # This symbol is written after the branch, if the branch is not tracked |
||||
} |
||||
|
||||
# call only from theme file |
||||
reload_git_prompt_colors() { |
||||
if [[ "${GIT_PROMPT_THEME_NAME}" != $1 ]]; then |
||||
unset_git_prompt_colors |
||||
define_helpers |
||||
override_git_prompt_colors |
||||
define_undefined_git_prompt_colors |
||||
fi |
||||
} |
||||
|
||||
if [[ "${GIT_PROMPT_THEME}" == "Single_line" && "${GIT_PROMPT_THEME_NAME}" != "Single_line" ]]; then |
||||
define_helpers |
||||
define_undefined_git_prompt_colors |
||||
fi |
||||
@ -0,0 +1,19 @@ |
||||
# This is a theme for gitprompt.sh, |
||||
# it uses the default openSUSE bash prompt style |
||||
|
||||
override_git_prompt_colors() { |
||||
GIT_PROMPT_THEME_NAME="Single_line_NoExitState_openSUSE" |
||||
GIT_PROMPT_BRANCH="${Cyan}" |
||||
GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}" |
||||
GIT_PROMPT_CHANGED="${Yellow}✚ " |
||||
GIT_PROMPT_STAGED="${Magenta}●" |
||||
|
||||
GIT_PROMPT_START_USER="\u@\h:\w" |
||||
GIT_PROMPT_START_ROOT="${BoldRed}\h:\w" |
||||
|
||||
GIT_PROMPT_END_USER="> " |
||||
GIT_PROMPT_END_ROOT=" # ${ResetColor}" |
||||
} |
||||
|
||||
reload_git_prompt_colors "Single_line_NoExitState_openSUSE" |
||||
|
||||
@ -0,0 +1,102 @@ |
||||
# This is an alternative approach. Single line in git repo. |
||||
# Theme optimised for Terminus and PowerLine compatible fonts. |
||||
# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes |
||||
# without the indicator of the last command state |
||||
# tweaked for Ubuntu terminal fonts |
||||
|
||||
unset_git_prompt_colors() { |
||||
unset Time12a |
||||
unset PathShort |
||||
unset GIT_PROMPT_PREFIX |
||||
unset GIT_PROMPT_SUFFIX |
||||
unset GIT_PROMPT_SEPARATOR |
||||
unset GIT_PROMPT_BRANCH |
||||
unset GIT_PROMPT_STAGED |
||||
unset GIT_PROMPT_CONFLICTS |
||||
unset GIT_PROMPT_CHANGED |
||||
unset GIT_PROMPT_REMOTE |
||||
unset GIT_PROMPT_UNTRACKED |
||||
unset GIT_PROMPT_STASHED |
||||
unset GIT_PROMPT_CLEAN |
||||
unset GIT_PROMPT_COMMAND_OK |
||||
unset GIT_PROMPT_COMMAND_FAIL |
||||
unset GIT_PROMPT_VIRTUALENV |
||||
unset GIT_PROMPT_START_USER |
||||
unset GIT_PROMPT_START_ROOT |
||||
unset GIT_PROMPT_END_USER |
||||
unset GIT_PROMPT_END_ROOT |
||||
unset GIT_PROMPT_SYMBOLS_AHEAD |
||||
unset GIT_PROMPT_SYMBOLS_BEHIND |
||||
unset GIT_PROMPT_SYMBOLS_PREHASH |
||||
unset GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING |
||||
} |
||||
|
||||
define_helpers() |
||||
{ |
||||
PathShort="${BoldBlue}\u:${Cyan}\W" |
||||
} |
||||
|
||||
define_undefined_git_prompt_colors() { |
||||
if [[ -z ${GIT_PROMPT_THEME_NAME} ]]; then GIT_PROMPT_THEME_NAME="Single_line_Solarized"; fi |
||||
|
||||
# These are the color definitions used by gitprompt.sh |
||||
if [[ -z ${GIT_PROMPT_PREFIX} ]]; then GIT_PROMPT_PREFIX="[ "; fi # start of the git info string |
||||
if [[ -z ${GIT_PROMPT_SUFFIX} ]]; then GIT_PROMPT_SUFFIX=" ]"; fi # the end of the git info string |
||||
if [[ -z ${GIT_PROMPT_SEPARATOR} ]]; then GIT_PROMPT_SEPARATOR=" |"; fi # separates each item |
||||
|
||||
if [[ -z ${GIT_PROMPT_BRANCH} ]]; then GIT_PROMPT_BRANCH="${Magenta}"; fi # the git branch that is active in the current directory |
||||
if [[ -z ${GIT_PROMPT_STAGED} ]]; then GIT_PROMPT_STAGED=" ${Yellow}●${ResetColor}"; fi # the number of staged files/directories |
||||
if [[ -z ${GIT_PROMPT_CONFLICTS} ]]; then GIT_PROMPT_CONFLICTS=" ${Red}✖ ${ResetColor}"; fi # the number of files in conflict |
||||
if [[ -z ${GIT_PROMPT_CHANGED} ]]; then GIT_PROMPT_CHANGED=" ${Blue}✚ ${ResetColor}"; fi # the number of changed files |
||||
|
||||
if [[ -z ${GIT_PROMPT_REMOTE} ]]; then GIT_PROMPT_REMOTE=" "; fi # the remote branch name (if any) and the symbols for ahead and behind |
||||
if [[ -z ${GIT_PROMPT_UNTRACKED} ]]; then GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}"; fi # the number of untracked files/dirs |
||||
if [[ -z ${GIT_PROMPT_STASHED} ]]; then GIT_PROMPT_STASHED=" ${BoldMagenta}⚑ ${ResetColor}"; fi # the number of stashed files/dir |
||||
if [[ -z ${GIT_PROMPT_CLEAN} ]]; then GIT_PROMPT_CLEAN=" ${Green}✔ ${ResetColor}"; fi # a colored flag indicating a "clean" repo |
||||
|
||||
# For the command indicator, the placeholder _LAST_COMMAND_STATE_ |
||||
# will be replaced with the exit code of the last command |
||||
# e.g. |
||||
# GIT_PROMPT_COMMAND_OK="${Green}✔-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of 0 |
||||
# GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of other than 0 |
||||
|
||||
if [[ -z ${GIT_PROMPT_COMMAND_OK} ]]; then GIT_PROMPT_COMMAND_OK="${Green}✔"; fi # indicator if the last command returned with an exit code of 0 |
||||
if [[ -z ${GIT_PROMPT_COMMAND_FAIL} ]]; then GIT_PROMPT_COMMAND_FAIL="${Red}✘"; fi # indicator if the last command returned with an exit code of other than 0 |
||||
|
||||
# template for displaying the current virtual environment |
||||
# use the placeholder _VIRTUALENV_ will be replaced with |
||||
# the name of the current virtual environment (currently CONDA and VIRTUAL_ENV) |
||||
if [[ -z ${GIT_PROMPT_VIRTUALENV} ]]; then GIT_PROMPT_VIRTUALENV="(${Blue}_VIRTUALENV_${ResetColor}) "; fi |
||||
|
||||
# _LAST_COMMAND_INDICATOR_ will be replaced by the appropriate GIT_PROMPT_COMMAND_OK OR GIT_PROMPT_COMMAND_FAIL |
||||
if [[ -z ${GIT_PROMPT_START_USER} ]]; then GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${Yellow}${PathShort}${ResetColor}"; fi |
||||
|
||||
if [[ -z ${GIT_PROMPT_START_ROOT} ]]; then GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}"; fi |
||||
if [[ -z ${GIT_PROMPT_END_USER} ]]; then GIT_PROMPT_END_USER="${BoldBlue} ➭ ${ResetColor}"; fi # Reset color for user |
||||
if [[ -z ${GIT_PROMPT_END_ROOT} ]]; then GIT_PROMPT_END_ROOT="${BoldRed} # "; fi # Bright red for Root |
||||
|
||||
# Please do not add colors to these symbols |
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_AHEAD} ]]; then GIT_PROMPT_SYMBOLS_AHEAD="↑·"; fi # The symbol for "n versions ahead of origin" |
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_BEHIND} ]]; then GIT_PROMPT_SYMBOLS_BEHIND="↓·"; fi # The symbol for "n versions behind of origin" |
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_PREHASH} ]]; then GIT_PROMPT_SYMBOLS_PREHASH=":"; fi # Written before hash of commit, if no name could be found |
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING} ]]; then GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="✭"; fi # This symbol is written after the branch, if the branch is not tracked |
||||
} |
||||
|
||||
# call only from theme file |
||||
reload_git_prompt_colors() { |
||||
if [[ "${GIT_PROMPT_THEME_NAME}" != $1 ]]; then |
||||
unset_git_prompt_colors |
||||
define_helpers |
||||
override_git_prompt_colors |
||||
define_undefined_git_prompt_colors |
||||
fi |
||||
} |
||||
|
||||
if [[ "${GIT_PROMPT_THEME}" == "Single_line_Solarized" && "${GIT_PROMPT_THEME_NAME}" != "Single_line_Solarized" ]]; then |
||||
define_helpers |
||||
define_undefined_git_prompt_colors |
||||
fi |
||||
|
||||
overide_git_prompt_colors() { |
||||
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="✭" |
||||
} |
||||
@ -0,0 +1,96 @@ |
||||
# This is an alternative approach. Single line in git repo. |
||||
# Theme optimised for Terminus and PowerLine compatible fonts. |
||||
|
||||
unset_git_prompt_colors() { |
||||
unset Time12a |
||||
unset PathShort |
||||
unset GIT_PROMPT_PREFIX |
||||
unset GIT_PROMPT_SUFFIX |
||||
unset GIT_PROMPT_SEPARATOR |
||||
unset GIT_PROMPT_BRANCH |
||||
unset GIT_PROMPT_STAGED |
||||
unset GIT_PROMPT_CONFLICTS |
||||
unset GIT_PROMPT_CHANGED |
||||
unset GIT_PROMPT_REMOTE |
||||
unset GIT_PROMPT_UNTRACKED |
||||
unset GIT_PROMPT_STASHED |
||||
unset GIT_PROMPT_CLEAN |
||||
unset GIT_PROMPT_COMMAND_OK |
||||
unset GIT_PROMPT_COMMAND_FAIL |
||||
unset GIT_PROMPT_VIRTUALENV |
||||
unset GIT_PROMPT_START_USER |
||||
unset GIT_PROMPT_START_ROOT |
||||
unset GIT_PROMPT_END_USER |
||||
unset GIT_PROMPT_END_ROOT |
||||
unset GIT_PROMPT_SYMBOLS_AHEAD |
||||
unset GIT_PROMPT_SYMBOLS_BEHIND |
||||
unset GIT_PROMPT_SYMBOLS_PREHASH |
||||
unset GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING |
||||
} |
||||
|
||||
define_helpers() |
||||
{ |
||||
Time12a="\$(date +%H:%M)" |
||||
PathShort="\w"; |
||||
} |
||||
|
||||
define_undefined_git_prompt_colors() { |
||||
if [[ -z ${GIT_PROMPT_THEME_NAME} ]]; then GIT_PROMPT_THEME_NAME="Single_line_Ubuntu"; fi |
||||
|
||||
# These are the color definitions used by gitprompt.sh |
||||
if [[ -z ${GIT_PROMPT_PREFIX} ]]; then GIT_PROMPT_PREFIX="[ "; fi # start of the git info string |
||||
if [[ -z ${GIT_PROMPT_SUFFIX} ]]; then GIT_PROMPT_SUFFIX=" ]"; fi # the end of the git info string |
||||
if [[ -z ${GIT_PROMPT_SEPARATOR} ]]; then GIT_PROMPT_SEPARATOR=" |"; fi # separates each item |
||||
|
||||
if [[ -z ${GIT_PROMPT_BRANCH} ]]; then GIT_PROMPT_BRANCH="${Magenta}"; fi # the git branch that is active in the current directory |
||||
if [[ -z ${GIT_PROMPT_STAGED} ]]; then GIT_PROMPT_STAGED=" ${Red}●${ResetColor}"; fi # the number of staged files/directories |
||||
if [[ -z ${GIT_PROMPT_CONFLICTS} ]]; then GIT_PROMPT_CONFLICTS=" ${Red}✖ ${ResetColor}"; fi # the number of files in conflict |
||||
if [[ -z ${GIT_PROMPT_CHANGED} ]]; then GIT_PROMPT_CHANGED=" ${Blue}✚ ${ResetColor}"; fi # the number of changed files |
||||
|
||||
if [[ -z ${GIT_PROMPT_REMOTE} ]]; then GIT_PROMPT_REMOTE=" "; fi # the remote branch name (if any) and the symbols for ahead and behind |
||||
if [[ -z ${GIT_PROMPT_UNTRACKED} ]]; then GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}"; fi # the number of untracked files/dirs |
||||
if [[ -z ${GIT_PROMPT_STASHED} ]]; then GIT_PROMPT_STASHED=" ${BoldBlue}⚑ ${ResetColor}"; fi # the number of stashed files/dir |
||||
if [[ -z ${GIT_PROMPT_CLEAN} ]]; then GIT_PROMPT_CLEAN=" ${BoldGreen}✔ ${ResetColor}"; fi # a colored flag indicating a "clean" repo |
||||
|
||||
# For the command indicator, the placeholder _LAST_COMMAND_STATE_ |
||||
# will be replaced with the exit code of the last command |
||||
# e.g. |
||||
# GIT_PROMPT_COMMAND_OK="${Green}✔-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of 0 |
||||
# GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of other than 0 |
||||
|
||||
if [[ -z ${GIT_PROMPT_COMMAND_OK} ]]; then GIT_PROMPT_COMMAND_OK="${Green}✔"; fi # indicator if the last command returned with an exit code of 0 |
||||
if [[ -z ${GIT_PROMPT_COMMAND_FAIL} ]]; then GIT_PROMPT_COMMAND_FAIL="${Red}✘"; fi # indicator if the last command returned with an exit code of other than 0 |
||||
|
||||
# template for displaying the current virtual environment |
||||
# use the placeholder _VIRTUALENV_ will be replaced with |
||||
# the name of the current virtual environment (currently CONDA and VIRTUAL_ENV) |
||||
if [[ -z ${GIT_PROMPT_VIRTUALENV} ]]; then GIT_PROMPT_VIRTUALENV="(${Blue}_VIRTUALENV_${ResetColor}) "; fi |
||||
|
||||
# _LAST_COMMAND_INDICATOR_ will be replaced by the appropriate GIT_PROMPT_COMMAND_OK OR GIT_PROMPT_COMMAND_FAIL |
||||
if [[ -z ${GIT_PROMPT_START_USER} ]]; then GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${White}${Time12a}${ResetColor} ${Cyan}${PathShort}${ResetColor}"; fi |
||||
|
||||
if [[ -z ${GIT_PROMPT_START_ROOT} ]]; then GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}"; fi |
||||
if [[ -z ${GIT_PROMPT_END_USER} ]]; then GIT_PROMPT_END_USER="${ResetColor} $ "; fi # Reset color for user |
||||
if [[ -z ${GIT_PROMPT_END_ROOT} ]]; then GIT_PROMPT_END_ROOT="${BoldRed} # "; fi # Bright red for Root |
||||
|
||||
# Please do not add colors to these symbols |
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_AHEAD} ]]; then GIT_PROMPT_SYMBOLS_AHEAD="↑·"; fi # The symbol for "n versions ahead of origin" |
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_BEHIND} ]]; then GIT_PROMPT_SYMBOLS_BEHIND="↓·"; fi # The symbol for "n versions behind of origin" |
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_PREHASH} ]]; then GIT_PROMPT_SYMBOLS_PREHASH=":"; fi # Written before hash of commit, if no name could be found |
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING} ]]; then GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="L"; fi # This symbol is written after the branch, if the branch is not tracked |
||||
} |
||||
|
||||
# call only from theme file |
||||
reload_git_prompt_colors() { |
||||
if [[ "${GIT_PROMPT_THEME_NAME}" != $1 ]]; then |
||||
unset_git_prompt_colors |
||||
define_helpers |
||||
override_git_prompt_colors |
||||
define_undefined_git_prompt_colors |
||||
fi |
||||
} |
||||
|
||||
if [[ "${GIT_PROMPT_THEME}" == "Single_line_Ubuntu" && "${GIT_PROMPT_THEME_NAME}" != "Single_line_Ubuntu" ]]; then |
||||
define_helpers |
||||
define_undefined_git_prompt_colors |
||||
fi |
||||
@ -0,0 +1,19 @@ |
||||
# This is a theme for gitprompt.sh, |
||||
# it uses the default openSUSE bash prompt style with exit status |
||||
|
||||
override_git_prompt_colors() { |
||||
GIT_PROMPT_THEME_NAME="Single_line_openSUSE" |
||||
GIT_PROMPT_BRANCH="${Cyan}" |
||||
GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}" |
||||
GIT_PROMPT_CHANGED="${Yellow}✚ " |
||||
GIT_PROMPT_STAGED="${Magenta}●" |
||||
|
||||
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${ResetColor}\u@\h:\w" |
||||
GIT_PROMPT_START_ROOT="_LAST_COMMAND_INDICATOR_ ${BoldRed}\h:\w" |
||||
|
||||
GIT_PROMPT_END_USER="${ResetColor}> " |
||||
GIT_PROMPT_END_ROOT=" # ${ResetColor}" |
||||
} |
||||
|
||||
reload_git_prompt_colors "Single_line_openSUSE" |
||||
|
||||
@ -0,0 +1,13 @@ |
||||
# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes |
||||
# tweaked for Ubuntu terminal fonts |
||||
|
||||
override_git_prompt_colors() { |
||||
GIT_PROMPT_THEME_NAME="Solarized" |
||||
GIT_PROMPT_STAGED="${Yellow}●" |
||||
GIT_PROMPT_STASHED="${BoldMagenta}⚑ " |
||||
GIT_PROMPT_CLEAN="${Green}✔" |
||||
GIT_PROMPT_END_USER=" \n${BoldBlue}${Time12a}${ResetColor} $ " |
||||
GIT_PROMPT_END_ROOT=" \n${BoldBlue}${Time12a}${ResetColor} # " |
||||
} |
||||
|
||||
reload_git_prompt_colors "Solarized" |
||||
@ -0,0 +1,41 @@ |
||||
# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes |
||||
# tweaked for Ubuntu terminal fonts |
||||
# some modifications on colors |
||||
# added ruby prompt, and kernel version as well |
||||
|
||||
override_git_prompt_colors() { |
||||
if [ -e ~/.rvm/bin/rvm-prompt ]; then |
||||
RUBY_PROMPT='{$(~/.rvm/bin/rvm-prompt i v)}' |
||||
else |
||||
if command -v rbenv > /dev/null; then |
||||
RUBY_PROMPT='{$(rbenv version | sed -e "s/ (set.*$//")}' |
||||
fi |
||||
fi |
||||
Time12a="\$(date +%H:%M:%S)" |
||||
|
||||
GIT_PROMPT_THEME_NAME="Solarized Extravagant" |
||||
GIT_PROMPT_STAGED="${Yellow}● " |
||||
GIT_PROMPT_UNTRACKED="${Cyan}… " |
||||
GIT_PROMPT_STASHED="${BoldMagenta}⚑ " |
||||
GIT_PROMPT_CLEAN="${Green}✔ " |
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ " |
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘ " |
||||
|
||||
KERNEL_PROMPT='‹$(uname -r)›' |
||||
|
||||
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${BoldBlueFg}${Time12a} ${Green}${KERNEL_PROMPT} ${Cyan}${RUBY_PROMPT} ${Yellow}${PathShort}" |
||||
GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}" |
||||
if [ -n "$SSH_CLIENT" ]; then |
||||
GIT_PROMPT_END_USER="\n${BoldRed} ➤ ${ResetColor}" |
||||
GIT_PROMPT_END_ROOT="\n${BoldRed} » ${ResetColor}" |
||||
else |
||||
GIT_PROMPT_END_USER="\n${BoldBlue} ➭ ${ResetColor}" |
||||
GIT_PROMPT_END_ROOT="\n${BoldRed} # ${ResetColor}" |
||||
fi |
||||
GIT_PROMPT_LEADING_SPACE=1 |
||||
GIT_PROMPT_PREFIX="${Cyan}[" |
||||
GIT_PROMPT_SUFFIX="${Cyan}]" |
||||
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="✭" |
||||
} |
||||
|
||||
reload_git_prompt_colors "Solarized Extravagant" |
||||
@ -0,0 +1,16 @@ |
||||
# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes |
||||
# without the indicator of the last command state |
||||
|
||||
override_git_prompt_colors() { |
||||
GIT_PROMPT_THEME_NAME="Solarized NoExitState" |
||||
GIT_PROMPT_STAGED="${Yellow}●" |
||||
GIT_PROMPT_STASHED="${BoldMagenta}⚑ " |
||||
GIT_PROMPT_CLEAN="${Green}✔" |
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘" |
||||
GIT_PROMPT_START_USER="${Yellow}${PathShort}${ResetColor}" |
||||
GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}" |
||||
GIT_PROMPT_END_USER=" \n${BoldBlue}${Time12a}${ResetColor} $ " |
||||
GIT_PROMPT_END_ROOT=" \n${BoldBlue}${Time12a}${ResetColor} # " |
||||
} |
||||
|
||||
reload_git_prompt_colors "Solarized NoExitState" |
||||
@ -0,0 +1,19 @@ |
||||
# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes |
||||
# without the indicator of the last command state |
||||
# tweaked for Ubuntu terminal fonts |
||||
|
||||
override_git_prompt_colors() { |
||||
GIT_PROMPT_THEME_NAME="Solarized NoExitState Ubuntu" |
||||
GIT_PROMPT_STAGED="${Yellow}● " |
||||
GIT_PROMPT_UNTRACKED="${Cyan}… " |
||||
GIT_PROMPT_STASHED="${BoldMagenta}⚑ " |
||||
GIT_PROMPT_CLEAN="${Green}✔ " |
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ " |
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘ " |
||||
GIT_PROMPT_START_USER="${Yellow}${PathShort}${ResetColor}" |
||||
GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}" |
||||
GIT_PROMPT_END_USER=" \n${BoldBlue}${Time12a}${ResetColor} $ " |
||||
GIT_PROMPT_END_ROOT=" \n${BoldBlue}${Time12a}${ResetColor} # " |
||||
} |
||||
|
||||
reload_git_prompt_colors "Solarized NoExitState Ubuntu" |
||||
@ -0,0 +1,15 @@ |
||||
# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes |
||||
# tweaked for Ubuntu terminal fonts |
||||
|
||||
override_git_prompt_colors() { |
||||
GIT_PROMPT_THEME_NAME="Solarized Ubuntu" |
||||
GIT_PROMPT_STAGED="${Yellow}● " |
||||
GIT_PROMPT_UNTRACKED="${Cyan}… " |
||||
GIT_PROMPT_STASHED="${BoldMagenta}⚑ " |
||||
GIT_PROMPT_CLEAN="${Green}✔ " |
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ " |
||||
GIT_PROMPT_END_USER=" \n${BoldBlue}${Time12a}${ResetColor} $ " |
||||
GIT_PROMPT_END_ROOT=" \n${BoldBlue}${Time12a}${ResetColor} # " |
||||
} |
||||
|
||||
reload_git_prompt_colors "Solarized Ubuntu" |
||||
Loading…
Reference in new issue