initial commit
This commit is contained in:
commit
161d91f995
166
README.md
Normal file
166
README.md
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
## Bash git prompt for Ubuntu desktop 22.04 and 24.04
|
||||||
|
|
||||||
|
This is a bash git prompt with theme support that displays usefull information about the current git repository.
|
||||||
|
|
||||||
|
This prompt is a fork of magicmonty git prompt located [\[here\]](https://github.com/magicmonty/bash-git-prompt) which again is a port of this one located [\[here\]](https://github.com/olivierverdier/zsh-git-prompt) I suspect none of the ports are maintained anlylonger and this is why I decided to fork it. Besides a few changes to the original port new themes has been created and some themes has been removed.
|
||||||
|
|
||||||
|
### Prompt Structure.
|
||||||
|
The default "Out Of The Box" theme appearance of the prompt looks like this. I removed the time stamp from the default theme btw.
|
||||||
|
|
||||||
|
```plaintext
|
||||||
|
<last status><working dir><branch><upstream branch>|<branch tracking>
|
||||||
|
```
|
||||||
|
|
||||||
|
### And it looks like this with the default theme.
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-theme-default.png" alt="default theme"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
### Theme symbols used with the default theme.
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-default-symbols.png" alt="default symbols"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
### Theme symbols used with the additional themes provided requires DejaVuSansMono Nerd Font Mono to be present.
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-extended-symbols.png" alt="extended symbols"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
### Install via git clone
|
||||||
|
```
|
||||||
|
git clone https://git.x-files.dk/ubuntu-desktop/bash-git-prompt.git ~/.bash-git-prompt
|
||||||
|
```
|
||||||
|
|
||||||
|
### Install the required fonts needed for all other themes exept the deafault theme.
|
||||||
|
```bash
|
||||||
|
cd ~/.bash-git-prompt
|
||||||
|
./install-fonts.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Next set your terminal to use the DejaVuSansMono Nerd Font Mono as shown below.
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-terminal.png" alt="Terminal font settings"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
### Getting everything up and running.
|
||||||
|
|
||||||
|
**Important:** Remove all references for other git prompts you may have running. Then add the following to your ~/.bashrc file.
|
||||||
|
```bash
|
||||||
|
if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then
|
||||||
|
GIT_PROMPT_THEME=default
|
||||||
|
alias gpchange="bash $HOME/.bash-git-prompt/gpchange.sh"
|
||||||
|
alias gpthemes="bash $HOME/.bash-git-prompt/gpthemes.sh"
|
||||||
|
source "$HOME/.bash-git-prompt/gitprompt.sh"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
### Changing themes method 1
|
||||||
|
Edit your ~/.bashrc file and change the line GIT_PROMPT_THEME=theme with another theme. For example to change the default theme to something else change.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then
|
||||||
|
GIT_PROMPT_THEME=default
|
||||||
|
alias gpchange="bash $HOME/.bash-git-prompt/gpchange.sh"
|
||||||
|
alias gpthemes="bash $HOME/.bash-git-prompt/gpthemes.sh"
|
||||||
|
source "$HOME/.bash-git-prompt/gitprompt.sh"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
To
|
||||||
|
```bash
|
||||||
|
if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then
|
||||||
|
GIT_PROMPT_THEME=fancy-white
|
||||||
|
alias gpchange="bash $HOME/.bash-git-prompt/gpchange.sh"
|
||||||
|
alias gpthemes="bash $HOME/.bash-git-prompt/gpthemes.sh"
|
||||||
|
source "$HOME/.bash-git-prompt/gitprompt.sh"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
Then close and reopen your terminal.
|
||||||
|
|
||||||
|
### Changing themes method 2
|
||||||
|
In your terminal type gpchange and type name of the theme you would like to use. Then close and reopen your terminal. The following themes are currently provided and can be added to your ~/.bashrc file as shown above or using the gpchange command.
|
||||||
|
|
||||||
|
default\
|
||||||
|
fancy-orange\
|
||||||
|
fancy-white\
|
||||||
|
fancy-gold\
|
||||||
|
half-life\
|
||||||
|
hazard\
|
||||||
|
robby-russell\
|
||||||
|
this-way\
|
||||||
|
two-liner\
|
||||||
|
two-liner-time\
|
||||||
|
x-files\
|
||||||
|
x-files-time
|
||||||
|
|
||||||
|
### Display all themes in the terminal.
|
||||||
|
You can run the command gpthemes in your terminal in order to get a showcase of all available themes.
|
||||||
|
|
||||||
|
### Screenshot of the additional themes currently provided.
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-theme-x-files.png" alt="x-files theme"/><br>Theme name: x-files
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-theme-x-files-time.png" alt="x-files-time theme"/><br>Theme name: x-files-time
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-theme-robby-russel.png" alt="robby-russel theme"/><br>Theme name: robby-russel
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-theme-this-way.png" alt="this-way theme"/><br>Theme name: this way
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-theme-two-liner.png" alt="two-liner theme"/><br>Theme name: two-liner
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-theme-two-liner-time.png" alt="two-liner-time theme"/><br>Theme name: two-liner-time
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-theme-fancy-white.png" alt="fancy-white theme"/><br>Theme name: fancy-white
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-theme-fancy-gold.png" alt="fancy-gold theme"/><br>Theme name: fancy-gold
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-theme-fancy-orange.png" alt="fancy-orange theme"/><br>Theme name: fancy-orange
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-theme-half-life.png" alt="half-life theme"/><br>Theme name: half-life
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-theme-hazard.png" alt="hazard theme"/><br>Theme name: hazard
|
||||||
|
</p>
|
||||||
|
|
||||||
|
### Note on VS Code
|
||||||
|
In order to get this to work in the VS Code terminal you will have to adjust a few settings for the symbols to render correctly. Open "File -> Preferences -> Settings" then adjust the following.
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-vscode1.png" alt="vscode settings"/><br>Search for <b><i>Terminal Font Family</i></b> and insert the following <b><i>DejaVuSansMono Nerd Font</i></b>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-vscode2.png" alt="vscode settings"/><br>Search for <b><i>Gpu Acceleration</i></b> and set it to <b><i>on</i></b>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="left" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/bgp-vscode3.png" alt="vscode settings"/><br>Search for <b><i>Editor Font Family</i></b> and insert the following <b><i>'DejaVuSansMono Nerd Font', 'monospace', monospace</i></b>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
### More guides
|
||||||
|
More guides can be found on [\[wiki.x-files.dk\]](https://wiki.x-files.dk)
|
||||||
|
|
||||||
|
### Last tested
|
||||||
|
January 8th 2025 on Ubuntu 24.04.
|
BIN
fonts/DejaVu-Sans-Mono-Nerd-Font-Complete-Mono.ttf
Normal file
BIN
fonts/DejaVu-Sans-Mono-Nerd-Font-Complete-Mono.ttf
Normal file
Binary file not shown.
114
fonts/DejaVu-Sans-Mono-Nerd-Font-Symbols.txt
Normal file
114
fonts/DejaVu-Sans-Mono-Nerd-Font-Symbols.txt
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
###########################################################################################################
|
||||||
|
# First Created: 14012025 Author: Allan #
|
||||||
|
# For your convenience this file displays all symbols for DejaVu-Sans-Mono-Nerd-Font-Complete-Mono.ttf #
|
||||||
|
# For the symbols to render DejaVu-Sans-Mono-Nerd-Font-Complete-Mono need to be installed on your systenm #
|
||||||
|
###########################################################################################################
|
||||||
|
▲ △ ▴ ▵ ▶ ▷ ▸ ▹ ► ▻ ▼ ▽ ▾ ▿ ◀ ◁ ◂ ◃ ◄ ◅ ◆ ◇ ◈ ◉ ◊ ○ ◌ ◍ ◎ ● ◐ ◑ ◒ ◓ ◔ ◕ ◖ ◗ ◘ ◙
|
||||||
|
◚ ◛ ◜ ◝ ◞ ◟ ◠ ◡ ◢ ◣ ◤ ◥ ◦ ◧ ◨ ◩ ◪ ◫ ◬ ◭ ◮ ◯ ◰ ◱ ◲ ◳ ◴ ◵ ◶ ◷ ◸ ◹ ◺ ◻ ◼ ◽ ◾ ◿ ☀ ☁
|
||||||
|
☂ ☃ ☄ ★ ☆ ☇ ☈ ☉ ☊ ☋ ☌ ☍ ☎ ☏ ☐ ☑ ☒ ☓ ☔ ☕ ☖ ☗ ☘ ☙ ☚ ☛ ☜ ☝ ☞ ☟ ☠ ☡ ☢ ☣ ☤ ☥ ☦ ☧ ☨
|
||||||
|
☩ ☪ ☫ ☬ ☭ ☮ ☯ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷ ☸ ☹ ☺ ☻ ☼ ☽ ☾ ☿ ♀ ♁ ♂ ♃ ♄ ♅ ♆ ♇ ♈ ♉ ♊ ♋ ♌ ♍ ♎ ♏ ♐
|
||||||
|
♑ ♒ ♓ ♔ ♕ ♖ ♗ ♘ ♙ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♡ ♢ ♣ ♤ ♥ ♦ ♧ ♨ ♩ ♪ ♫ ♬ ♭ ♮ ♯ ♰ ♱ ♲ ♳ ♴ ♵ ♶ ♷ ♸
|
||||||
|
♹ ♺ ♻ ♼ ♽ ♾ ♿ ⚀ ⚁ ⚂ ⚃ ⚄ ⚅ ⚆ ⚇ ⚈ ⚉ ⚊ ⚋ ⚐ ⚑ ⚒ ⚓ ⚔ ⚕ ⚖ ⚗ ⚘ ⚙ ⚚ ⚛ ⚜ ⚠ ⚡ ⚰ ⚱ ✁ ✂ ✃
|
||||||
|
✄ ✆ ✇ ✈ ✉ ✌ ✍ ✎ ✏ ✐ ✑ ✒ ✓ ✔ ✕ ✖ ✗ ✘ ✙ ✚ ✛ ✜ ✝ ✞ ✟ ✠ ✡ ✢ ✣ ✤ ✥ ✦ ✧ ✩ ✪ ✫ ✬ ✭ ✮ ✯
|
||||||
|
✰ ✱ ✲ ✳ ✴ ✵ ✶ ✷ ✸ ✹ ✺ ✻ ✼ ✽ ✾ ✿ ❀ ❁ ❂ ❃ ❄ ❅ ❆ ❇ ❈ ❉ ❊ ❋ ❍ ❏ ❐ ❑ ❒ ❖ ❘ ❙ ❚ ❛ ❜ ❝
|
||||||
|
❞ ❡ ❢ ❣ ❤ ❥ ❦ ❧ ❨ ❩ ❪ ❫ ❬ ❭ ❮ ❯ ❰ ❱ ❲ ❳ ❴ ❵ ➔ ➘ ➙ ➚ ➛ ➜ ➝ ➞ ➟ ➠ ➡ ➢ ➣ ➤ ➥ ➦ ➧ ➨
|
||||||
|
➩ ➪ ➫ ➬ ➭ ➮ ➯ ➱ ➲ ➳ ➴ ➵ ➶ ➷ ➸ ➹ ➺ ➻ ➼ ➽ ➾ ⟂ ⟅ ⟆ ⟜ ⟠ ⟦ ⟧ ⟨ ⟩ ⟪ ⟫ ⟵ ⟶ ⟷ ⦇ ⦈ ⦗ ⦘
|
||||||
|
⧫ ⧺ ⧻ ⨀ ⨯ ⩪ ⩫ ⬅ ⬆ ⬇ ⬈ ⬉ ⬊ ⬋ ⬌ ⬍ ⬒ ⬓ ⬔ ⬕ ⬖ ⬗ ⬘ ⬙ ⬚ ⭘ Ɽ Ɑ Ɱ Ɐ Ɒ Ⱶ ⱶ ⱷ ⱹ ⱺ ⱼ ⱽ Ȿ Ɀ
|
||||||
|
⸘ ⸟ ⸢ ⸣ ⸤ ⸥ ⸮ ꜈ ꜉ ꜊ ꜋ ꜌ ꜍ ꜎ ꜏ ꜐ ꜑ ꜒ ꜓ ꜔ ꜕ ꜖ ꜛ ꜜ ꜝ ꜞ ꜟ Ꜣ ꜣ Ꜥ ꜥ Ꜧ ꜧ ꞉ ꞊ Ꞌ ꞌ Ɥ ꞎ Ꞑ
|
||||||
|
ꞑ Ɦ ꟸ ꟹ
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
豈 更 車 賈 滑 串 句 龜 龜 契 金 喇 奈 懶 癩 羅 蘿
|
||||||
|
螺 裸 邏 樂 洛 烙 珞 落 酪 駱 亂 卵 欄 爛 蘭 鸞 嵐 濫 藍 襤 拉 臘 蠟 廊 朗 浪 狼 郎 來 冷 勞 擄 櫓 爐 盧 老 蘆 虜 路 露
|
||||||
|
魯 鷺 碌 祿 綠 菉 錄 鹿 論 壟 弄 籠 聾 牢 磊 賂 雷 壘 屢 樓 淚 漏 累 縷 陋 勒 肋 凜 凌 稜 綾 菱 陵 讀 拏 樂 諾 丹 寧
|
||||||
|
怒 率 異 北 磻 便 復 不 泌 數 索 參 塞 省 葉 說 殺 辰 沈 拾 若 掠 略 亮 兩 凉 梁 糧 良 諒 量 勵 呂 女 廬 旅 濾 礪 閭 驪
|
||||||
|
麗 黎 力 曆 歷 轢 年 憐 戀 撚 漣 煉 璉 秊 練 聯 輦 蓮 連 鍊 列 劣 咽 烈 裂 說 廉 念 捻 殮 簾 獵 令 囹 寧 嶺 怜 玲 瑩 羚
|
||||||
|
聆 鈴 零 靈 領 例 禮 醴 隸 惡 了 僚 寮 尿 料 樂 燎 療 蓼 遼 龍 暈 阮 劉 杻 柳 流 溜 琉 留 硫 紐 類 六 戮 陸 倫 崙 淪 輪
|
||||||
|
律 慄 栗 率 隆 利 吏 履 易 李 梨 泥 理 痢 罹 裏 裡 里 離 匿 溺 吝 燐 璘 藺 隣 鱗 麟 林 淋 臨 立 笠 粒 狀 炙 識 什 茶
|
||||||
|
刺 切 度 拓 糖 宅 洞 暴 輻 行 降 見 廓 兀 嗀 﨎 﨏 塚 﨑 晴 﨓 﨔 凞 猪 益 礼 神 祥 福 靖 精 羽 﨟 蘒 﨡 諸 﨣 﨤 逸 都
|
||||||
|
﨧 﨨 﨩 飯 飼 館 鶴 郞 隷 侮 僧 免 勉 勤 卑 喝 嘆 器 塀 墨 層 屮 悔 慨 憎 懲 敏 既 暑 梅 海 渚 漢 煮 爫 琢 碑 社 祉 祈
|
||||||
|
祐 祖 祝 禍 禎 穀 突 節 練 縉 繁 署 者 臭 艹 艹 著 褐 視 謁 謹 賓 贈 辶 逸 難 響 頻 恵 𤋮 舘 並 况 全 侀 充 冀
|
||||||
|
勇 勺 喝 啕 喙 嗢 塚 墳 奄 奔 婢 嬨 廒 廙 彩 徭 惘 慎 愈 憎 慠 懲 戴 揄 搜 摒 敖 晴 朗 望 杖 歹 殺 流 滛 滋 漢 瀞 煮 瞧
|
||||||
|
爵 犯 猪 瑱 甆 画 瘝 瘟 益 盛 直 睊 着 磌 窱 節 类 絛 練 缾 者 荒 華 蝹 襁 覆 視 調 諸 請 謁 諾 諭 謹 變 贈 輸 遲 醙 鉶
|
||||||
|
陼 難 靖 韛 響 頋 頻 鬒 龜 𢡊 𢡄 𣏕 㮝 䀘 䀹 𥉉 𥳐 𧻓 齃 龎
|
||||||
|
ff fi fl ffi ffl ſt st ﬓ ﬔ
|
||||||
|
ﬕ ﬖ ﬗ יִ ﬞ ײַ ﬠ ﬡ ﬢ ﬣ ﬤ ﬥ ﬦ ﬧ ﬨ ﬩ שׁ שׂ שּׁ שּׂ אַ אָ אּ בּ גּ דּ הּ וּ זּ טּ יּ ךּ כּ לּ
|
||||||
|
מּ נּ סּ ףּ פּ צּ קּ רּ שּ תּ וֹ בֿ כֿ פֿ ﭏ ﭐ ﭑ ﭒ ﭓ ﭔ ﭕ ﭖ ﭗ ﭘ ﭙ ﭚ ﭛ ﭜ ﭝ ﭞ ﭟ ﭠ ﭡ ﭢ ﭣ ﭤ
|
||||||
|
ﭥ ﭦ ﭧ ﭨ ﭩ ﭪ ﭫ ﭬ ﭭ ﭮ ﭯ ﭰ ﭱ ﭲ ﭳ ﭴ ﭵ ﭶ ﭷ ﭸ ﭹ ﭺ ﭻ ﭼ ﭽ ﭾ ﭿ ﮀ ﮁ ﮂ ﮃ ﮄ ﮅ ﮆ ﮇ ﮈ ﮉ ﮊ ﮋ
|
||||||
|
ﮌ ﮍ ﮎ ﮏ ﮐ ﮑ ﮒ ﮓ ﮔ ﮕ ﮖ ﮗ ﮘ ﮙ ﮚ ﮛ ﮜ ﮝ ﮞ ﮟ ﮠ ﮡ ﮢ ﮣ ﮤ ﮥ ﮦ ﮧ ﮨ ﮩ ﮪ ﮫ ﮬ ﮭ ﮮ ﮯ ﮰ ﮱ ﮲ ﮳
|
||||||
|
﮴ ﮵ ﮶ ﮷ ﮸ ﮹ ﮺ ﮻ ﮼ ﮽ ﮾ ﮿ ﯀ ﯁ ﯂ ﯓ ﯔ ﯕ ﯖ ﯗ ﯘ ﯙ ﯚ ﯛ
|
||||||
|
ﯜ ﯝ ﯞ ﯟ ﯠ ﯡ ﯢ ﯣ ﯤ ﯥ ﯦ ﯧ ﯨ ﯩ ﯪ ﯫ ﯬ ﯭ ﯮ ﯯ ﯰ ﯱ ﯲ ﯳ ﯴ ﯵ ﯶ ﯷ ﯸ ﯹ ﯺ ﯻ ﯼ ﯽ ﯾ ﯿ ﰀ ﰁ ﰂ ﰃ
|
||||||
|
ﰄ ﰅ ﰆ ﰇ ﰈ ﰉ ﰊ ﰋ ﰌ ﰍ ﰎ ﰏ ﰐ ﰑ ﰒ ﰓ ﰔ ﰕ ﰖ ﰗ ﰘ ﰙ ﰚ ﰛ ﰜ ﰝ ﰞ ﰟ ﰠ ﰡ ﰢ ﰣ ﰤ ﰥ ﰦ ﰧ ﰨ ﰩ ﰪ
|
||||||
|
ﰫ ﰬ ﰭ ﰮ ﰯ ﰰ ﰱ ﰲ ﰳ ﰴ ﰵ ﰶ ﰷ ﰸ ﰹ ﰺ ﰻ ﰼ ﰽ ﰾ ﰿ ﱀ ﱁ ﱂ ﱃ ﱄ ﱅ ﱆ ﱇ ﱈ ﱉ ﱊ ﱋ ﱌ ﱍ ﱎ ﱏ ﱐ ﱑ ﱒ
|
||||||
|
ﱓ ﱔ ﱕ ﱖ ﱗ ﱘ ﱙ ﱚ ﱛ ﱜ ﱝ ﱞ ﱟ ﱠ ﱡ ﱢ ﱣ ﱤ ﱥ ﱦ ﱧ ﱨ ﱩ ﱪ ﱫ ﱬ ﱭ ﱮ ﱯ ﱰ ﱱ ﱲ ﱳ ﱴ ﱵ ﱶ ﱷ ﱸ ﱹ ﱺ
|
||||||
|
ﱻ ﱼ ﱽ ﱾ ﱿ ﲀ ﲁ ﲂ ﲃ ﲄ ﲅ ﲆ ﲇ ﲈ ﲉ ﲊ ﲋ ﲌ ﲍ ﲎ ﲏ ﲐ ﲑ ﲒ ﲓ ﲔ ﲕ ﲖ ﲗ ﲘ ﲙ ﲚ ﲛ ﲜ ﲝ ﲞ ﲟ ﲠ ﲡ
|
||||||
|
ﲢ ﲣ ﲤ ﲥ ﲦ ﲧ ﲨ ﲩ ﲪ ﲫ ﲬ ﲭ ﲮ ﲯ ﲰ ﲱ ﲲ ﲳ ﲴ ﲵ ﲶ ﲷ ﲸ ﲹ ﲺ ﲻ ﲼ ﲽ ﲾ ﲿ ﳀ ﳁ ﳂ ﳃ ﳄ ﳅ ﳆ ﳇ ﳈ ﳉ
|
||||||
|
ﳊ ﳋ ﳌ ﳍ ﳎ ﳏ ﳐ ﳑ ﳒ ﳓ ﳔ ﳕ ﳖ ﳗ ﳘ ﳙ ﳚ ﳛ ﳜ ﳝ ﳞ ﳟ ﳠ ﳡ ﳢ ﳣ ﳤ ﳥ ﳦ ﳧ ﳨ ﳩ ﳪ ﳫ ﳬ ﳭ ﳮ ﳯ ﳰ ﳱ
|
||||||
|
ﳲ ﳳ ﳴ ﳵ ﳶ ﳷ ﳸ ﳹ ﳺ ﳻ ﳼ ﳽ ﳾ ﳿ ﴀ ﴁ ﴂ ﴃ ﴄ ﴅ ﴆ ﴇ ﴈ ﴉ ﴊ ﴋ ﴌ ﴍ ﴎ ﴏ ﴐ ﴑ ﴒ ﴓ ﴔ ﴕ ﴖ ﴗ ﴘ ﴙ
|
||||||
|
ﴚ ﴛ ﴜ ﴝ ﴞ ﴟ ﴠ ﴡ ﴢ ﴣ ﴤ ﴥ ﴦ ﴧ ﴨ ﴩ ﴪ ﴫ ﴬ ﴭ ﴮ ﴯ ﴰ ﴱ ﴲ ﴳ ﴴ ﴵ ﴶ ﴷ ﴸ ﴹ ﴺ ﴻ ﴼ ﴽ ﴾ ﴿ ﵀
|
||||||
|
﵁ ﵂ ﵃ ﵄ ﵅ ﵆ ﹰ ﹱ ﹲ ﹳ ﹴ ﹶ ﹷ ﹸ ﹹ ﹺ ﹻ ﹼ ﹽ ﹾ ﹿ ﺀ ﺁ ﺂ ﺃ ﺄ ﺅ ﺆ ﺇ ﺈ ﺉ ﺊ ﺋ ﺌ ﺍ ﺎ ﺏ ﺐ ﺑ ﺒ
|
||||||
|
ﺓ ﺔ ﺕ ﺖ ﺗ ﺘ ﺙ ﺚ ﺛ ﺜ ﺝ ﺞ ﺟ ﺠ ﺡ ﺢ ﺣ ﺤ ﺥ ﺦ ﺧ ﺨ ﺩ ﺪ ﺫ ﺬ ﺭ ﺮ ﺯ ﺰ ﺱ ﺲ ﺳ ﺴ ﺵ ﺶ ﺷ ﺸ ﺹ ﺺ
|
||||||
|
ﺻ ﺼ ﺽ ﺾ ﺿ ﻀ ﻁ ﻂ ﻃ ﻄ ﻅ ﻆ ﻇ ﻈ ﻉ ﻊ ﻋ ﻌ ﻍ ﻎ ﻏ ﻐ ﻑ ﻒ ﻓ ﻔ ﻕ ﻖ ﻗ ﻘ ﻙ ﻚ ﻛ ﻜ ﻝ ﻞ ﻟ ﻠ ﻡ ﻢ
|
||||||
|
ﻣ ﻤ ﻥ ﻦ ﻧ ﻨ ﻩ ﻪ ﻫ ﻬ ﻭ ﻮ ﻯ ﻰ ﻱ ﻲ ﻳ ﻴ ﻵ ﻶ ﻷ ﻸ ﻹ ﻺ ﻻ ﻼ
|
771
gitprompt.sh
Executable file
771
gitprompt.sh
Executable file
@ -0,0 +1,771 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# bash/zsh cross compatibility notes:
|
||||||
|
# - always use ${array[@]:offset:length} syntax for array indexing
|
||||||
|
|
||||||
|
function async_run() {
|
||||||
|
{
|
||||||
|
eval "$@" &> /dev/null
|
||||||
|
}&
|
||||||
|
}
|
||||||
|
|
||||||
|
function async_run_zsh() {
|
||||||
|
{
|
||||||
|
eval "$@" &> /dev/null
|
||||||
|
|
||||||
|
# `true` is used here to allow bash to parse the script, as the zsh `&!` syntax will otherwise stop parsing prior to any execution.
|
||||||
|
}&! true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function set_git_prompt_dir() {
|
||||||
|
# code thanks to http://stackoverflow.com/questions/59895
|
||||||
|
if [ -z "$__GIT_PROMPT_DIR" ]; then
|
||||||
|
__GIT_PROMPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function echoc() {
|
||||||
|
echo -e "${1}${2}${ResetColor}" | sed 's/\\\]//g' | sed 's/\\\[//g'
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_theme() {
|
||||||
|
local CUSTOM_THEME_FILE="${HOME}/.git-prompt-colors.sh"
|
||||||
|
if [[ ! (-z "${GIT_PROMPT_THEME_FILE:+x}" ) ]]; then
|
||||||
|
CUSTOM_THEME_FILE="${GIT_PROMPT_THEME_FILE}"
|
||||||
|
fi
|
||||||
|
local DEFAULT_THEME_FILE="${__GIT_PROMPT_DIR}/themes/default.bgptheme"
|
||||||
|
|
||||||
|
if [[ -z "${GIT_PROMPT_THEME+x}" ]]; then
|
||||||
|
if [[ -r "${CUSTOM_THEME_FILE}" ]]; then
|
||||||
|
GIT_PROMPT_THEME="Custom"
|
||||||
|
__GIT_PROMPT_THEME_FILE="${CUSTOM_THEME_FILE}"
|
||||||
|
else
|
||||||
|
GIT_PROMPT_THEME="default"
|
||||||
|
__GIT_PROMPT_THEME_FILE="${DEFAULT_THEME_FILE}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ "${GIT_PROMPT_THEME}" = "Custom" ]]; then
|
||||||
|
GIT_PROMPT_THEME="Custom"
|
||||||
|
__GIT_PROMPT_THEME_FILE="${CUSTOM_THEME_FILE}"
|
||||||
|
|
||||||
|
if [[ ! (-r "${__GIT_PROMPT_THEME_FILE}") ]]; then
|
||||||
|
GIT_PROMPT_THEME="default"
|
||||||
|
__GIT_PROMPT_THEME_FILE="${DEFAULT_THEME_FILE}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
local theme=""
|
||||||
|
|
||||||
|
# use default theme, if theme was not found
|
||||||
|
for themefile in "${__GIT_PROMPT_DIR}/themes/"*.bgptheme; do
|
||||||
|
local basename=${themefile##*/}
|
||||||
|
if [[ "${basename%.bgptheme}" = "${GIT_PROMPT_THEME}" ]]; then
|
||||||
|
theme="${GIT_PROMPT_THEME}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${theme}" = "" ]]; then
|
||||||
|
GIT_PROMPT_THEME="default"
|
||||||
|
fi
|
||||||
|
|
||||||
|
__GIT_PROMPT_THEME_FILE="${__GIT_PROMPT_DIR}/themes/${GIT_PROMPT_THEME}.bgptheme"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function git_prompt_load_colors() {
|
||||||
|
if gp_set_file_var __PROMPT_COLORS_FILE prompt-colors.sh ; then
|
||||||
|
# outsource the color defs
|
||||||
|
source "${__PROMPT_COLORS_FILE}"
|
||||||
|
else
|
||||||
|
echo 1>&2 "Cannot find prompt-colors.sh!"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function git_prompt_load_theme() {
|
||||||
|
get_theme
|
||||||
|
local DEFAULT_THEME_FILE="${__GIT_PROMPT_DIR}/themes/default.bgptheme"
|
||||||
|
source "${DEFAULT_THEME_FILE}"
|
||||||
|
source "${__GIT_PROMPT_THEME_FILE}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function git_prompt_list_themes() {
|
||||||
|
git_prompt_load_colors
|
||||||
|
get_theme
|
||||||
|
|
||||||
|
for themefile in "${__GIT_PROMPT_DIR}/themes/"*.bgptheme; do
|
||||||
|
local basename="${themefile##*/}"
|
||||||
|
local theme="${basename%.bgptheme}"
|
||||||
|
if [[ "${GIT_PROMPT_THEME}" = "${theme}" ]]; then
|
||||||
|
echoc "${Red}" "*${theme}"
|
||||||
|
else
|
||||||
|
echo "${theme}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# if [[ "${GIT_PROMPT_THEME}" = "Custom" ]]; then
|
||||||
|
# echoc "${Magenta}" "*Custom"
|
||||||
|
# else
|
||||||
|
# echoc "${Blue}" "Custom"
|
||||||
|
# fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# function git_prompt_make_custom_theme() {
|
||||||
|
# if [[ -r "${HOME}/.git-prompt-colors.sh" ]]; then
|
||||||
|
# echoc "${Red}" "You have already created a custom theme!"
|
||||||
|
# else
|
||||||
|
# local base="Default"
|
||||||
|
# if [[ -n "${1}" && -r "${__GIT_PROMPT_DIR}/themes/${1}.bgptheme" ]]; then
|
||||||
|
# base="${1}"
|
||||||
|
# echoc "${Green}" "Using theme ${Magenta}\"${base}\"${Green} as base theme!"
|
||||||
|
# else
|
||||||
|
# echoc "${Green}" "Using theme ${Magenta}\"Default\"${Green} as base theme!"
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# if [[ "${base}" = "Custom" ]]; then
|
||||||
|
# echoc "${Red}" "You cannot use the custom theme as base"
|
||||||
|
# else
|
||||||
|
# echoc "${Green}" "Creating new custom theme in \"${HOME}/.git-prompt-colors.sh\""
|
||||||
|
# echoc "${DimYellow}" "Please add ${Magenta}\"GIT_PROMPT_THEME=Custom\"${DimYellow} to your .bashrc to use this theme"
|
||||||
|
# if [[ "${base}" == "Default" ]]; then
|
||||||
|
# cp "${__GIT_PROMPT_DIR}/themes/Custom.bgptemplate" "${HOME}/.git-prompt-colors.sh"
|
||||||
|
# else
|
||||||
|
# cp "${__GIT_PROMPT_DIR}/themes/${base}.bgptheme" "${HOME}/.git-prompt-colors.sh"
|
||||||
|
# fi
|
||||||
|
# fi
|
||||||
|
# fi
|
||||||
|
# }
|
||||||
|
|
||||||
|
# gp_set_file_var ENVAR SOMEFILE
|
||||||
|
#
|
||||||
|
# If ENVAR is set, check that it's value exists as a readable file. Otherwise,
|
||||||
|
# Set ENVAR to the path to SOMEFILE, based on $HOME, $__GIT_PROMPT_DIR, and the
|
||||||
|
# directory of the current script. The SOMEFILE can be prefixed with '.', or
|
||||||
|
# not.
|
||||||
|
#
|
||||||
|
# Return 0 (success) if ENVAR not already defined, 1 (failure) otherwise.
|
||||||
|
|
||||||
|
function gp_set_file_var() {
|
||||||
|
local envar="${1}"
|
||||||
|
local file="${2}"
|
||||||
|
if eval "[[ -n \"\${${envar}+x}\" && -r \"\${${envar}+x}\" ]]" ; then # is envar set to a readable file?
|
||||||
|
local basefile
|
||||||
|
eval "basefile=\"\`basename \\\"\${${envar}}\\\"\`\"" # assign basefile
|
||||||
|
if [[ "${basefile}" = "${file}" || "${basefile}" = ".${file}" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
else # envar is not set, or it's set to a different file than requested
|
||||||
|
eval "${envar}=" # set empty envar
|
||||||
|
gp_maybe_set_envar_to_path "${envar}" "${HOME}/.${file}" "${HOME}/${file}" "${HOME}/lib/${file}" && return 0
|
||||||
|
gp_maybe_set_envar_to_path "${envar}" "${__GIT_PROMPT_DIR}/${file}" "${0##*/}/${file}" && return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# gp_maybe_set_envar_to_path ENVAR FILEPATH ...
|
||||||
|
#
|
||||||
|
# return 0 (true) if any FILEPATH is readable, set ENVAR to it
|
||||||
|
# return 1 (false) if not
|
||||||
|
|
||||||
|
function gp_maybe_set_envar_to_path() {
|
||||||
|
local envar="${1}"
|
||||||
|
shift
|
||||||
|
local file
|
||||||
|
for file in "${@}" ; do
|
||||||
|
if [[ -r "${file}" ]]; then
|
||||||
|
eval "${envar}=\"${file}\""
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# git_prompt_reset
|
||||||
|
#
|
||||||
|
# unsets selected GIT_PROMPT variables, causing the next prompt callback to
|
||||||
|
# recalculate them from scratch.
|
||||||
|
|
||||||
|
git_prompt_reset() {
|
||||||
|
local var
|
||||||
|
for var in GIT_PROMPT_DIR __GIT_PROMPT_COLORS_FILE __PROMPT_COLORS_FILE __GIT_STATUS_CMD GIT_PROMPT_THEME_NAME; do
|
||||||
|
unset ${var}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# gp_format_exit_status RETVAL
|
||||||
|
#
|
||||||
|
# echos the symbolic signal name represented by RETVAL if the process was
|
||||||
|
# signalled, otherwise echos the original value of RETVAL
|
||||||
|
|
||||||
|
gp_format_exit_status() {
|
||||||
|
local RETVAL="${1}"
|
||||||
|
local SIGNAL
|
||||||
|
# Suppress STDERR in case RETVAL is not an integer (in such cases, RETVAL
|
||||||
|
# is echoed verbatim)
|
||||||
|
if [[ "${RETVAL}" -gt 128 ]] 2>/dev/null; then
|
||||||
|
SIGNAL=$(( RETVAL - 128 ))
|
||||||
|
kill -l "${SIGNAL}" 2>/dev/null || echo "${RETVAL}"
|
||||||
|
else
|
||||||
|
echo "${RETVAL}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function gp_format_username_repo() {
|
||||||
|
git config --get remote.origin.url | sed 's|^.*//||; s/.*@//; s/[^:/]\+[:/]//; s/.git$//'
|
||||||
|
}
|
||||||
|
|
||||||
|
function git_prompt_config() {
|
||||||
|
#Checking if root to change output
|
||||||
|
_isroot=false
|
||||||
|
[[ "${UID}" -eq 0 ]] && _isroot=true
|
||||||
|
|
||||||
|
# There are two files related to colors:
|
||||||
|
#
|
||||||
|
# prompt-colors.sh -- sets generic color names suitable for bash 'PS1' prompt
|
||||||
|
# git-prompt-colors.sh -- sets the GIT_PROMPT color scheme, using names from prompt-colors.sh
|
||||||
|
git_prompt_load_colors
|
||||||
|
|
||||||
|
# source the user's ~/.git-prompt-colors.sh file, or the one that should be
|
||||||
|
# sitting in the same directory as this script
|
||||||
|
git_prompt_load_theme
|
||||||
|
|
||||||
|
if is_function prompt_callback; then
|
||||||
|
prompt_callback="prompt_callback"
|
||||||
|
else
|
||||||
|
prompt_callback="prompt_callback_default"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${GIT_PROMPT_LAST_COMMAND_STATE:-0}" = 0 ]]; then
|
||||||
|
LAST_COMMAND_INDICATOR="${GIT_PROMPT_COMMAND_OK}";
|
||||||
|
else
|
||||||
|
LAST_COMMAND_INDICATOR="${GIT_PROMPT_COMMAND_FAIL}";
|
||||||
|
fi
|
||||||
|
|
||||||
|
# replace _LAST_COMMAND_STATE_ token with the actual state
|
||||||
|
GIT_PROMPT_LAST_COMMAND_STATE=$(gp_format_exit_status "${GIT_PROMPT_LAST_COMMAND_STATE}")
|
||||||
|
LAST_COMMAND_INDICATOR="${LAST_COMMAND_INDICATOR//_LAST_COMMAND_STATE_/${GIT_PROMPT_LAST_COMMAND_STATE}}"
|
||||||
|
|
||||||
|
# Do this only once to define PROMPT_START and PROMPT_END
|
||||||
|
|
||||||
|
if [[ -z "${PROMPT_START:+x}" || -z "${PROMPT_END:+x}" ]]; then
|
||||||
|
|
||||||
|
if [[ -z "${GIT_PROMPT_START:+x}" ]] ; then
|
||||||
|
if ${_isroot}; then
|
||||||
|
PROMPT_START="${GIT_PROMPT_START_ROOT-}"
|
||||||
|
else
|
||||||
|
PROMPT_START="${GIT_PROMPT_START_USER-}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
PROMPT_START="${GIT_PROMPT_START-}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${GIT_PROMPT_END:+x}" ]] ; then
|
||||||
|
if $_isroot; then
|
||||||
|
PROMPT_END="${GIT_PROMPT_END_ROOT-}"
|
||||||
|
else
|
||||||
|
PROMPT_END="${GIT_PROMPT_END_USER-}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
PROMPT_END="${GIT_PROMPT_END-}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set GIT_PROMPT_LEADING_SPACE to 0 if you want to have no leading space in front of the GIT prompt
|
||||||
|
if [[ "${GIT_PROMPT_LEADING_SPACE:-1}" = "0" ]]; then
|
||||||
|
PROMPT_LEADING_SPACE=""
|
||||||
|
else
|
||||||
|
PROMPT_LEADING_SPACE=" "
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${GIT_PROMPT_ONLY_IN_REPO:-0}" == 1 ]]; then
|
||||||
|
EMPTY_PROMPT="${OLD_GITPROMPT}"
|
||||||
|
elif [[ "${GIT_PROMPT_WITH_VIRTUAL_ENV:-1}" == 1 ]]; then
|
||||||
|
if [[ "${GIT_PROMPT_VIRTUAL_ENV_AFTER_PROMPT:-0}" == "0" ]]; then
|
||||||
|
local ps="$(gp_add_virtualenv_to_prompt)${PROMPT_START}$(${prompt_callback})${PROMPT_END}"
|
||||||
|
else
|
||||||
|
local ps="${PROMPT_START}$(${prompt_callback})$(gp_add_virtualenv_to_prompt)${PROMPT_END}"
|
||||||
|
fi
|
||||||
|
EMPTY_PROMPT="${ps//_LAST_COMMAND_INDICATOR_/${LAST_COMMAND_INDICATOR}}"
|
||||||
|
else
|
||||||
|
local ps="${PROMPT_START}$(${prompt_callback})${PROMPT_END}"
|
||||||
|
EMPTY_PROMPT="${ps//_LAST_COMMAND_INDICATOR_/${LAST_COMMAND_INDICATOR}}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# fetch remote revisions every other $GIT_PROMPT_FETCH_TIMEOUT (default 5) minutes
|
||||||
|
if [[ -z "${GIT_PROMPT_FETCH_TIMEOUT:+x}" ]]; then
|
||||||
|
GIT_PROMPT_FETCH_TIMEOUT="5"
|
||||||
|
fi
|
||||||
|
if [[ -z "${__GIT_STATUS_CMD:+x}" ]] ; then # if GIT_STATUS_CMD not defined..
|
||||||
|
if ! gp_maybe_set_envar_to_path __GIT_STATUS_CMD "${__GIT_PROMPT_DIR}/${GIT_PROMPT_STATUS_COMMAND}" ; then
|
||||||
|
echo 1>&2 "Cannot find ${GIT_PROMPT_STATUS_COMMAND}!"
|
||||||
|
fi
|
||||||
|
# __GIT_STATUS_CMD defined
|
||||||
|
fi
|
||||||
|
unset GIT_BRANCH
|
||||||
|
}
|
||||||
|
|
||||||
|
function setLastCommandState() {
|
||||||
|
GIT_PROMPT_LAST_COMMAND_STATE="${?}"
|
||||||
|
return ${GIT_PROMPT_LAST_COMMAND_STATE}
|
||||||
|
}
|
||||||
|
|
||||||
|
function we_are_on_repo() {
|
||||||
|
if [[ -e "$(git rev-parse --git-dir 2> /dev/null)" ]]; then
|
||||||
|
echo 1
|
||||||
|
else
|
||||||
|
echo 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_old_git_prompt() {
|
||||||
|
if [[ "${GIT_PROMPT_OLD_DIR_WAS_GIT:-0}" = 0 ]]; then
|
||||||
|
OLD_PROMPT_START="${PROMPT_START}"
|
||||||
|
OLD_PROMPT_END="${PROMPT_END}"
|
||||||
|
OLD_GITPROMPT="${PS1}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
GIT_PROMPT_OLD_DIR_WAS_GIT=$(we_are_on_repo)
|
||||||
|
}
|
||||||
|
|
||||||
|
function setGitPrompt() {
|
||||||
|
update_old_git_prompt
|
||||||
|
|
||||||
|
local repo=$(git rev-parse --show-toplevel 2> /dev/null)
|
||||||
|
if [[ ! -e "${repo}" ]] && [[ "${GIT_PROMPT_ONLY_IN_REPO-}" = 1 ]]; then
|
||||||
|
# we do not permit bash-git-prompt outside git repos, so nothing to do
|
||||||
|
PROMPT_START=${OLD_PROMPT_START}
|
||||||
|
PROMPT_END=${OLD_PROMPT_END}
|
||||||
|
PS1="${OLD_GITPROMPT}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local EMPTY_PROMPT
|
||||||
|
local __GIT_STATUS_CMD
|
||||||
|
|
||||||
|
git_prompt_config
|
||||||
|
|
||||||
|
if [[ ! -e "${repo}" ]] || [[ "${GIT_PROMPT_DISABLE-}" = 1 ]]; then
|
||||||
|
PS1="${EMPTY_PROMPT}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local FETCH_REMOTE_STATUS=1
|
||||||
|
if [[ "${GIT_PROMPT_FETCH_REMOTE_STATUS}" = 0 ]]; then
|
||||||
|
FETCH_REMOTE_STATUS=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset GIT_PROMPT_IGNORE
|
||||||
|
OLD_GIT_PROMPT_SHOW_UNTRACKED_FILES="${GIT_PROMPT_SHOW_UNTRACKED_FILES}"
|
||||||
|
unset GIT_PROMPT_SHOW_UNTRACKED_FILES
|
||||||
|
|
||||||
|
OLD_GIT_PROMPT_IGNORE_SUBMODULES="${GIT_PROMPT_IGNORE_SUBMODULES}"
|
||||||
|
unset GIT_PROMPT_IGNORE_SUBMODULES
|
||||||
|
|
||||||
|
OLD_GIT_PROMPT_SHOW_TRACKING=${GIT_PROMPT_SHOW_TRACKING}
|
||||||
|
unset GIT_PROMPT_SHOW_TRACKING
|
||||||
|
|
||||||
|
if [[ -e "${repo}/.bash-git-rc" ]]; then
|
||||||
|
# The config file can only contain variable declarations on the form A_B=0 or G_P=all
|
||||||
|
local CONFIG_SYNTAX="^(FETCH_REMOTE_STATUS|GIT_PROMPT_SHOW_UNTRACKED_FILES|GIT_PROMPT_IGNORE_SUBMODULES|GIT_PROMPT_SHOW_TRACKING|GIT_PROMPT_IGNORE)=[0-9a-z]+$"
|
||||||
|
if grep -q -v -E "${CONFIG_SYNTAX}" "${repo}/.bash-git-rc"; then
|
||||||
|
echo ".bash-git-rc can only contain variable values on the form NAME=value. Ignoring file." >&2
|
||||||
|
else
|
||||||
|
source "${repo}/.bash-git-rc"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${GIT_PROMPT_SHOW_UNTRACKED_FILES+x}" ]]; then
|
||||||
|
GIT_PROMPT_SHOW_UNTRACKED_FILES="${OLD_GIT_PROMPT_SHOW_UNTRACKED_FILES}"
|
||||||
|
fi
|
||||||
|
unset OLD_GIT_PROMPT_SHOW_UNTRACKED_FILES
|
||||||
|
|
||||||
|
if [[ -z "${GIT_PROMPT_IGNORE_SUBMODULES+x}" ]]; then
|
||||||
|
GIT_PROMPT_IGNORE_SUBMODULES="${OLD_GIT_PROMPT_IGNORE_SUBMODULES}"
|
||||||
|
fi
|
||||||
|
unset OLD_GIT_PROMPT_IGNORE_SUBMODULES
|
||||||
|
|
||||||
|
if [[ -z "${GIT_PROMPT_SHOW_TRACKING+x}" ]]; then
|
||||||
|
GIT_PROMPT_SHOW_TRACKING=${OLD_GIT_PROMPT_SHOW_TRACKING}
|
||||||
|
fi
|
||||||
|
unset OLD_GIT_PROMPT_SHOW_TRACKING
|
||||||
|
|
||||||
|
if [[ "${GIT_PROMPT_IGNORE-}" = 1 ]]; then
|
||||||
|
PS1="${EMPTY_PROMPT}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${FETCH_REMOTE_STATUS}" = 1 ]]; then
|
||||||
|
checkUpstream
|
||||||
|
fi
|
||||||
|
|
||||||
|
updatePrompt
|
||||||
|
}
|
||||||
|
|
||||||
|
# some versions of find do not have -mmin
|
||||||
|
_have_find_mmin=1
|
||||||
|
|
||||||
|
function olderThanMinutes() {
|
||||||
|
local matches
|
||||||
|
local find_exit_code
|
||||||
|
|
||||||
|
if [[ -z "${_find_command+x}" ]]; then
|
||||||
|
if command -v gfind > /dev/null; then
|
||||||
|
_find_command="gfind"
|
||||||
|
else
|
||||||
|
_find_command="find"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${_have_find_mmin}" = 1 ]]; then
|
||||||
|
matches=$("${_find_command}" "${1}" -mmin +"${2}" 2> /dev/null)
|
||||||
|
find_exit_code="${?}"
|
||||||
|
if [[ -n "${matches}" ]]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
if [[ "${find_exit_code}" != 0 ]]; then
|
||||||
|
_have_find_mmin=0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# try perl, solaris ships with perl
|
||||||
|
if command -v perl > /dev/null; then
|
||||||
|
perl -e '((time - (stat("'"${1}"'"))[9]) / 60) > '"${2}"' && exit(0) || exit(1)'
|
||||||
|
return "${?}"
|
||||||
|
else
|
||||||
|
echo >&2
|
||||||
|
echo "[1;31mWARNING[0m: neither a find that supports -mmin (such as GNU find) or perl is available, disabling remote status checking. Install GNU find as gfind or perl to enable this feature, or set GIT_PROMPT_FETCH_REMOTE_STATUS=0 to disable this warning." >&2
|
||||||
|
echo >&2
|
||||||
|
GIT_PROMPT_FETCH_REMOTE_STATUS=0
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkUpstream() {
|
||||||
|
local GIT_PROMPT_FETCH_TIMEOUT
|
||||||
|
git_prompt_config
|
||||||
|
|
||||||
|
local FETCH_HEAD="${repo}/.git/FETCH_HEAD"
|
||||||
|
# Fech repo if local is stale for more than $GIT_FETCH_TIMEOUT minutes
|
||||||
|
if [[ ! -e "${FETCH_HEAD}" ]] || olderThanMinutes "${FETCH_HEAD}" "${GIT_PROMPT_FETCH_TIMEOUT}"
|
||||||
|
then
|
||||||
|
if [[ -n $(git remote show) ]]; then
|
||||||
|
(
|
||||||
|
if [ -n "$ZSH_VERSION" ]; then
|
||||||
|
async_run_zsh "GIT_TERMINAL_PROMPT=0 git fetch --quiet"
|
||||||
|
else
|
||||||
|
async_run "GIT_TERMINAL_PROMPT=0 git fetch --quiet"
|
||||||
|
disown -h
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function replaceSymbols() {
|
||||||
|
# Disable globbing, so a * could be used as symbol here
|
||||||
|
set -f
|
||||||
|
|
||||||
|
if [[ -z ${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING+x} ]]; then
|
||||||
|
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING=L
|
||||||
|
fi
|
||||||
|
|
||||||
|
local VALUE="${1//_AHEAD_/${GIT_PROMPT_SYMBOLS_AHEAD}}"
|
||||||
|
local VALUE1="${VALUE//_BEHIND_/${GIT_PROMPT_SYMBOLS_BEHIND}}"
|
||||||
|
local VALUE2="${VALUE1//_NO_REMOTE_TRACKING_/${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING}}"
|
||||||
|
local VALUE3="${VALUE2//_PRETAG_/${GIT_PROMPT_SYMBOLS_PRETAG}}"
|
||||||
|
|
||||||
|
echo "${VALUE3//_PREHASH_/${GIT_PROMPT_SYMBOLS_PREHASH}}"
|
||||||
|
|
||||||
|
# reenable globbing symbols
|
||||||
|
set +f
|
||||||
|
}
|
||||||
|
|
||||||
|
function createPrivateIndex {
|
||||||
|
# Create a copy of the index to avoid conflicts with parallel git commands, e.g. git rebase.
|
||||||
|
local __GIT_INDEX_FILE
|
||||||
|
local __GIT_INDEX_PRIVATE
|
||||||
|
if [[ -z "${GIT_INDEX_FILE+x}" ]]; then
|
||||||
|
__GIT_INDEX_FILE="$(git rev-parse --git-dir)/index"
|
||||||
|
else
|
||||||
|
__GIT_INDEX_FILE="${GIT_INDEX_FILE}"
|
||||||
|
fi
|
||||||
|
__GIT_INDEX_PRIVATE="${TMPDIR:-/tmp}/git-index-private$$"
|
||||||
|
command cp "${__GIT_INDEX_FILE}" "${__GIT_INDEX_PRIVATE}" 2>/dev/null
|
||||||
|
echo "${__GIT_INDEX_PRIVATE}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_branch_prefix() {
|
||||||
|
local GIT_BRANCH="${1}"
|
||||||
|
local DETACHED_HEAD="${2}"
|
||||||
|
|
||||||
|
case "$GIT_BRANCH" in
|
||||||
|
${GIT_PROMPT_MASTER_BRANCHES})
|
||||||
|
local IS_MASTER_BRANCH=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
local IS_MASTER_BRANCH=0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ "$IS_MASTER_BRANCH" == "1" ]]; then
|
||||||
|
echo "$GIT_PROMPT_MASTER_BRANCH"
|
||||||
|
elif [[ "$DETACHED_HEAD" = "1" ]]; then
|
||||||
|
echo "$GIT_PROMPT_DETACHED_HEAD"
|
||||||
|
else
|
||||||
|
echo "$GIT_PROMPT_BRANCH"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function updatePrompt() {
|
||||||
|
local LAST_COMMAND_INDICATOR
|
||||||
|
local PROMPT_LEADING_SPACE
|
||||||
|
local PROMPT_START
|
||||||
|
local PROMPT_END
|
||||||
|
local EMPTY_PROMPT
|
||||||
|
local Blue="\[\033[0;34m\]"
|
||||||
|
if [ -n "$ZSH_VERSION" ]; then
|
||||||
|
Blue='%{fg[blue]%}'
|
||||||
|
fi
|
||||||
|
|
||||||
|
git_prompt_config
|
||||||
|
|
||||||
|
export __GIT_PROMPT_IGNORE_STASH="${GIT_PROMPT_IGNORE_STASH:-0}"
|
||||||
|
export __GIT_PROMPT_SHOW_UPSTREAM="${GIT_PROMPT_SHOW_UPSTREAM:-0}"
|
||||||
|
export __GIT_PROMPT_IGNORE_SUBMODULES="${GIT_PROMPT_IGNORE_SUBMODULES:-0}"
|
||||||
|
export __GIT_PROMPT_WITH_USERNAME_AND_REPO="${GIT_PROMPT_WITH_USERNAME_AND_REPO:-0}"
|
||||||
|
export __GIT_PROMPT_SHOW_TRACKING=${GIT_PROMPT_SHOW_TRACKING:-1}
|
||||||
|
export __GIT_PROMPT_SHOW_UNTRACKED_FILES="${GIT_PROMPT_SHOW_UNTRACKED_FILES-normal}"
|
||||||
|
export __GIT_PROMPT_SHOW_CHANGED_FILES_COUNT="${GIT_PROMPT_SHOW_CHANGED_FILES_COUNT:-1}"
|
||||||
|
|
||||||
|
local GIT_INDEX_PRIVATE="$(createPrivateIndex)"
|
||||||
|
#important to define GIT_INDEX_FILE as local: This way it only affects this function (and below) - even with the export afterwards
|
||||||
|
local GIT_INDEX_FILE
|
||||||
|
export GIT_INDEX_FILE="${GIT_INDEX_PRIVATE}"
|
||||||
|
|
||||||
|
local -a git_status_fields
|
||||||
|
while IFS=$'\n' read -r line; do git_status_fields+=("${line}"); done < <("${__GIT_STATUS_CMD}" 2>/dev/null)
|
||||||
|
|
||||||
|
export GIT_BRANCH=$(replaceSymbols "${git_status_fields[@]:0:1}")
|
||||||
|
if [[ $__GIT_PROMPT_SHOW_TRACKING != "0" ]]; then
|
||||||
|
local GIT_REMOTE="$(replaceSymbols "${git_status_fields[@]:1:1}")"
|
||||||
|
if [[ "." == "${GIT_REMOTE}" ]]; then
|
||||||
|
unset GIT_REMOTE
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
local GIT_REMOTE_USERNAME_REPO="$(replaceSymbols "${git_status_fields[@]:2:1}")"
|
||||||
|
if [[ "." == "${GIT_REMOTE_USERNAME_REPO}" ]]; then
|
||||||
|
unset GIT_REMOTE_USERNAME_REPO
|
||||||
|
fi
|
||||||
|
|
||||||
|
local GIT_FORMATTED_UPSTREAM
|
||||||
|
local GIT_UPSTREAM_PRIVATE="${git_status_fields[@]:3:1}"
|
||||||
|
if [[ "${__GIT_PROMPT_SHOW_UPSTREAM:-0}" != "1" || "^" == "${GIT_UPSTREAM_PRIVATE}" ]]; then
|
||||||
|
unset GIT_FORMATTED_UPSTREAM
|
||||||
|
else
|
||||||
|
GIT_FORMATTED_UPSTREAM="${GIT_PROMPT_UPSTREAM//_UPSTREAM_/${GIT_UPSTREAM_PRIVATE}}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local GIT_STAGED="${git_status_fields[@]:4:1}"
|
||||||
|
local GIT_CONFLICTS="${git_status_fields[@]:5:1}"
|
||||||
|
local GIT_CHANGED="${git_status_fields[@]:6:1}"
|
||||||
|
local GIT_UNTRACKED="${git_status_fields[@]:7:1}"
|
||||||
|
local GIT_STASHED="${git_status_fields[@]:8:1}"
|
||||||
|
local GIT_CLEAN="${git_status_fields[@]:9:1}"
|
||||||
|
local GIT_DETACHED_HEAD="${git_status_fields[@]:10:1}"
|
||||||
|
|
||||||
|
local NEW_PROMPT="${EMPTY_PROMPT}"
|
||||||
|
if [[ "${#git_status_fields[@]}" -gt 0 ]]; then
|
||||||
|
|
||||||
|
if [[ -z "${GIT_REMOTE_USERNAME_REPO+x}" ]]; then
|
||||||
|
local GIT_PROMPT_PREFIX_FINAL="${GIT_PROMPT_PREFIX//_USERNAME_REPO_/${ResetColor}}"
|
||||||
|
else
|
||||||
|
if [[ -z "${GIT_PROMPT_USERNAME_REPO_SEPARATOR+x}" ]]; then
|
||||||
|
local GIT_PROMPT_PREFIX_FINAL="${GIT_PROMPT_PREFIX//_USERNAME_REPO_/${GIT_REMOTE_USERNAME_REPO}${ResetColor}}"
|
||||||
|
else
|
||||||
|
local GIT_PROMPT_PREFIX_FINAL="${GIT_PROMPT_PREFIX//_USERNAME_REPO_/${GIT_REMOTE_USERNAME_REPO}${ResetColor}${GIT_PROMPT_USERNAME_REPO_SEPARATOR}}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
local BRANCH_PREFIX="$(get_branch_prefix $GIT_BRANCH $GIT_DETACHED_HEAD)"
|
||||||
|
local STATUS_PREFIX="${PROMPT_LEADING_SPACE}${GIT_PROMPT_PREFIX_FINAL}${BRANCH_PREFIX}\${GIT_BRANCH}${ResetColor}${GIT_FORMATTED_UPSTREAM}"
|
||||||
|
local STATUS=""
|
||||||
|
|
||||||
|
# __add_status KIND VALEXPR INSERT
|
||||||
|
# eg: __add_status 'STAGED' '-ne 0'
|
||||||
|
|
||||||
|
__chk_gitvar_status() {
|
||||||
|
local v
|
||||||
|
if [[ "${2-}" = "-n" ]] ; then
|
||||||
|
v="${2} \"\${GIT_${1}-}\""
|
||||||
|
else
|
||||||
|
v="\${GIT_${1}-} ${2}"
|
||||||
|
fi
|
||||||
|
if eval "[[ ${v} ]]" ; then
|
||||||
|
if [[ "${3-}" != '-' ]] && [[ "${__GIT_PROMPT_SHOW_CHANGED_FILES_COUNT}" == "1" || "${1-}" == "REMOTE" ]]; then
|
||||||
|
__add_status "\${GIT_PROMPT_${1}}\${GIT_${1}}\${ResetColor}"
|
||||||
|
else
|
||||||
|
__add_status "\${GIT_PROMPT_${1}}\${ResetColor}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
__add_gitvar_status() {
|
||||||
|
__add_status "\${GIT_PROMPT_${1}}\${GIT_${1}}\${ResetColor}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# __add_status SOMETEXT
|
||||||
|
__add_status() {
|
||||||
|
eval "STATUS=\"${STATUS}${1}\""
|
||||||
|
}
|
||||||
|
|
||||||
|
__chk_gitvar_status 'REMOTE' '-n'
|
||||||
|
if [[ "${GIT_CLEAN}" -eq 0 ]] || [[ "${GIT_PROMPT_CLEAN}" != "" ]]; then
|
||||||
|
__add_status "${GIT_PROMPT_SEPARATOR}"
|
||||||
|
__chk_gitvar_status 'STAGED' '!= "0" && ${GIT_STAGED-} != "^"'
|
||||||
|
__chk_gitvar_status 'CONFLICTS' '!= "0"'
|
||||||
|
__chk_gitvar_status 'CHANGED' '!= "0"'
|
||||||
|
__chk_gitvar_status 'UNTRACKED' '!= "0"'
|
||||||
|
__chk_gitvar_status 'STASHED' '!= "0"'
|
||||||
|
__chk_gitvar_status 'CLEAN' '= "1"' -
|
||||||
|
fi
|
||||||
|
__add_status "${ResetColor}${GIT_PROMPT_SUFFIX}"
|
||||||
|
|
||||||
|
if [[ "${GIT_PROMPT_VIRTUAL_ENV_AFTER_PROMPT:-0}" == "0" ]]; then
|
||||||
|
NEW_PROMPT="$(gp_add_virtualenv_to_prompt)${PROMPT_START}$(${prompt_callback})${STATUS_PREFIX}${STATUS}${PROMPT_END}"
|
||||||
|
else
|
||||||
|
NEW_PROMPT="${PROMPT_START}$(${prompt_callback})$(gp_add_virtualenv_to_prompt)${STATUS_PREFIX}${STATUS}${PROMPT_END}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
NEW_PROMPT="${EMPTY_PROMPT}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PS1="${NEW_PROMPT//_LAST_COMMAND_INDICATOR_/${LAST_COMMAND_INDICATOR}${ResetColor}}"
|
||||||
|
command rm "${GIT_INDEX_PRIVATE}" 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Helper function that returns virtual env information to be set in prompt
|
||||||
|
# Honors virtualenvs own setting VIRTUAL_ENV_DISABLE_PROMPT
|
||||||
|
function gp_add_virtualenv_to_prompt {
|
||||||
|
local ACCUMULATED_VENV_PROMPT=""
|
||||||
|
local VENV=""
|
||||||
|
if [[ -n "${VIRTUAL_ENV-}" && -z "${VIRTUAL_ENV_DISABLE_PROMPT+x}" ]]; then
|
||||||
|
if [[ -n "${VIRTUAL_ENV_PROMPT-}" ]]; then
|
||||||
|
# first trim any starting white space and parenthesis, and then do the same to the end
|
||||||
|
VENV="${VIRTUAL_ENV_PROMPT#"${VIRTUAL_ENV_PROMPT%%[![:space:]]*}("}"
|
||||||
|
VENV="${VENV%")${VENV##*[![:space:]]}"}"
|
||||||
|
else
|
||||||
|
VENV=$(basename "${VIRTUAL_ENV}")
|
||||||
|
fi
|
||||||
|
ACCUMULATED_VENV_PROMPT="${ACCUMULATED_VENV_PROMPT}${GIT_PROMPT_VIRTUALENV//_VIRTUALENV_/${VENV}}"
|
||||||
|
fi
|
||||||
|
if [[ -n "${NODE_VIRTUAL_ENV-}" && -z "${NODE_VIRTUAL_ENV_DISABLE_PROMPT+x}" ]]; then
|
||||||
|
VENV=$(basename "${NODE_VIRTUAL_ENV}")
|
||||||
|
ACCUMULATED_VENV_PROMPT="${ACCUMULATED_VENV_PROMPT}${GIT_PROMPT_VIRTUALENV//_VIRTUALENV_/${VENV}}"
|
||||||
|
fi
|
||||||
|
if [[ -n "${CONDA_DEFAULT_ENV-}" ]]; then
|
||||||
|
VENV=$(basename "${CONDA_DEFAULT_ENV}")
|
||||||
|
ACCUMULATED_VENV_PROMPT="${ACCUMULATED_VENV_PROMPT}${GIT_PROMPT_VIRTUALENV//_VIRTUALENV_/${VENV}}"
|
||||||
|
fi
|
||||||
|
echo "${ACCUMULATED_VENV_PROMPT}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Use exit status from declare command to determine whether input argument is a
|
||||||
|
# bash function
|
||||||
|
function is_function {
|
||||||
|
declare -Ff "${1}" >/dev/null;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Helper function that truncates $PWD depending on window width
|
||||||
|
# Optionally specify maximum length as parameter (defaults to 1/3 of terminal)
|
||||||
|
function gp_truncate_pwd {
|
||||||
|
local tilde="~"
|
||||||
|
local newPWD="${PWD/#${HOME}/${tilde}}"
|
||||||
|
local pwdmaxlen="${1:-$((${COLUMNS:-80}/3))}"
|
||||||
|
[[ "${#newPWD}" -gt "${pwdmaxlen}" ]] && newPWD="...${newPWD:3-$pwdmaxlen}"
|
||||||
|
echo -n "${newPWD}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Sets the window title to the given argument string
|
||||||
|
function gp_set_window_title {
|
||||||
|
echo -ne "\[\033]0;$1\007\]"
|
||||||
|
}
|
||||||
|
|
||||||
|
function prompt_callback_default {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# toggle gitprompt
|
||||||
|
function git_prompt_toggle() {
|
||||||
|
if [[ "${GIT_PROMPT_DISABLE:-0}" = 1 ]]; then
|
||||||
|
GIT_PROMPT_DISABLE=0
|
||||||
|
else
|
||||||
|
GIT_PROMPT_DISABLE=1
|
||||||
|
fi
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
function make_prompt_command_clean() {
|
||||||
|
PROMPT_COMMAND="${PROMPT_COMMAND//$'\n'/;}" # convert all new lines to semi-colons
|
||||||
|
PROMPT_COMMAND="${PROMPT_COMMAND#\;}" # remove leading semi-colon
|
||||||
|
PROMPT_COMMAND="${PROMPT_COMMAND%% }" # remove trailing spaces
|
||||||
|
PROMPT_COMMAND="${PROMPT_COMMAND%\;}" # remove trailing semi-colon
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_prompt_command() {
|
||||||
|
local new_entry="$1"
|
||||||
|
local insert_before="$2"
|
||||||
|
|
||||||
|
if [[ ";${PROMPT_COMMAND};" == *";${new_entry};"* ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$PROMPT_COMMAND" ]]; then
|
||||||
|
PROMPT_COMMAND="$new_entry"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$insert_before" == "true" ]]; then
|
||||||
|
PROMPT_COMMAND="${new_entry};${PROMPT_COMMAND}"
|
||||||
|
else
|
||||||
|
PROMPT_COMMAND="${PROMPT_COMMAND};${new_entry}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_to_beginning_of_prompt_command() {
|
||||||
|
add_prompt_command "$1" "true"
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_to_end_of_prompt_command() {
|
||||||
|
add_prompt_command "$1" "false"
|
||||||
|
}
|
||||||
|
|
||||||
|
function gp_install_prompt {
|
||||||
|
# 5.1 supports PROMPT_COMMAND as an array
|
||||||
|
if ((BASH_VERSINFO[0] > 5 || BASH_VERSINFO[0] == 5 && BASH_VERSINFO[1] >= 1)); then
|
||||||
|
if [[ $(declare -p PROMPT_COMMAND 2>/dev/null) == "declare --"* ]]; then
|
||||||
|
make_prompt_command_clean
|
||||||
|
add_to_end_of_prompt_command "setGitPrompt"
|
||||||
|
add_to_beginning_of_prompt_command "setLastCommandState"
|
||||||
|
else
|
||||||
|
if [[ "${PROMPT_COMMAND[*]}" != *setGitPrompt* ]]; then
|
||||||
|
PROMPT_COMMAND+=(setGitPrompt)
|
||||||
|
fi
|
||||||
|
if [[ "${PROMPT_COMMAND[*]}" != *setLastCommandState* ]]; then
|
||||||
|
PROMPT_COMMAND=(setLastCommandState "${PROMPT_COMMAND[@]}")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
make_prompt_command_clean
|
||||||
|
add_to_end_of_prompt_command "setGitPrompt"
|
||||||
|
add_to_beginning_of_prompt_command "setLastCommandState"
|
||||||
|
fi
|
||||||
|
|
||||||
|
set_git_prompt_dir
|
||||||
|
# source "${__GIT_PROMPT_DIR}/git-prompt-help.sh"
|
||||||
|
}
|
||||||
|
|
||||||
|
gp_install_prompt
|
204
gitstatus.sh
Executable file
204
gitstatus.sh
Executable file
@ -0,0 +1,204 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# gitstatus.sh -- produce the current git repo status on STDOUT
|
||||||
|
# Functionally equivalent to 'gitstatus.py', but written in bash (not python).
|
||||||
|
#
|
||||||
|
# Alan K. Stebbens <aks@stebbens.org> [http://github.com/aks]
|
||||||
|
|
||||||
|
set -u
|
||||||
|
|
||||||
|
if [[ -z "${__GIT_PROMPT_DIR:+x}" ]]; then
|
||||||
|
SOURCE="${BASH_SOURCE[0]}"
|
||||||
|
while [[ -h "${SOURCE}" ]]; do
|
||||||
|
DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
|
||||||
|
SOURCE="$(readlink "${SOURCE}")"
|
||||||
|
[[ "${SOURCE}" != /* ]] && SOURCE="${DIR}/${SOURCE}"
|
||||||
|
done
|
||||||
|
__GIT_PROMPT_DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${__GIT_PROMPT_IGNORE_SUBMODULES:-0}" == "1" ]]; then
|
||||||
|
_ignore_submodules="--ignore-submodules"
|
||||||
|
else
|
||||||
|
_ignore_submodules=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${__GIT_PROMPT_WITH_USERNAME_AND_REPO:-0}" == "1" ]]; then
|
||||||
|
# returns "user/repo" from remote.origin.url git variable
|
||||||
|
#
|
||||||
|
# supports urls:
|
||||||
|
# https://user@bitbucket.org/user/repo.git
|
||||||
|
# https://github.com/user/repo.git
|
||||||
|
# git@github.com:user/repo.git
|
||||||
|
#
|
||||||
|
remote_url=$(git config --get remote.origin.url | sed 's|^.*//||; s/.*@//; s/[^:/]\+[:/]//; s/.git$//')
|
||||||
|
else
|
||||||
|
remote_url='.'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
gitstatus=$( LC_ALL=C git --no-optional-locks status ${_ignore_submodules} --untracked-files="${__GIT_PROMPT_SHOW_UNTRACKED_FILES:-normal}" --porcelain --branch )
|
||||||
|
|
||||||
|
# if the status is fatal, exit now
|
||||||
|
[[ ! "${?}" ]] && exit 0
|
||||||
|
|
||||||
|
git_dir="$(git rev-parse --git-dir 2>/dev/null)"
|
||||||
|
[[ -z "${git_dir:+x}" ]] && exit 0
|
||||||
|
|
||||||
|
__git_prompt_read ()
|
||||||
|
{
|
||||||
|
local f="${1}"
|
||||||
|
shift
|
||||||
|
[[ -r "${f}" ]] && read -r "${@}" <"${f}"
|
||||||
|
}
|
||||||
|
|
||||||
|
state=""
|
||||||
|
step=""
|
||||||
|
total=""
|
||||||
|
if [[ -d "${git_dir}/rebase-merge" ]]; then
|
||||||
|
__git_prompt_read "${git_dir}/rebase-merge/msgnum" step
|
||||||
|
__git_prompt_read "${git_dir}/rebase-merge/end" total
|
||||||
|
if [[ -f "${git_dir}/rebase-merge/interactive" ]]; then
|
||||||
|
state="|REBASE-i"
|
||||||
|
else
|
||||||
|
state="|REBASE-m"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ -d "${git_dir}/rebase-apply" ]]; then
|
||||||
|
__git_prompt_read "${git_dir}/rebase-apply/next" step
|
||||||
|
__git_prompt_read "${git_dir}/rebase-apply/last" total
|
||||||
|
if [[ -f "${git_dir}/rebase-apply/rebasing" ]]; then
|
||||||
|
state="|REBASE"
|
||||||
|
elif [[ -f "${git_dir}/rebase-apply/applying" ]]; then
|
||||||
|
state="|AM"
|
||||||
|
else
|
||||||
|
state="|AM/REBASE"
|
||||||
|
fi
|
||||||
|
elif [[ -f "${git_dir}/MERGE_HEAD" ]]; then
|
||||||
|
state="|MERGING"
|
||||||
|
elif [[ -f "${git_dir}/CHERRY_PICK_HEAD" ]]; then
|
||||||
|
state="|CHERRY-PICKING"
|
||||||
|
elif [[ -f "${git_dir}/REVERT_HEAD" ]]; then
|
||||||
|
state="|REVERTING"
|
||||||
|
elif [[ -f "${git_dir}/BISECT_LOG" ]]; then
|
||||||
|
state="|BISECTING"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${step}" ]] && [[ -n "${total}" ]]; then
|
||||||
|
state="${state} ${step}/${total}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
num_staged=0
|
||||||
|
num_changed=0
|
||||||
|
num_conflicts=0
|
||||||
|
num_untracked=0
|
||||||
|
while IFS='' read -r line || [[ -n "${line}" ]]; do
|
||||||
|
status="${line:0:2}"
|
||||||
|
while [[ -n ${status} ]]; do
|
||||||
|
case "${status}" in
|
||||||
|
#two fixed character matches, loop finished
|
||||||
|
\#\#) branch_line="${line/\.\.\./^}"; break ;;
|
||||||
|
\?\?) ((num_untracked++)); break ;;
|
||||||
|
U?) ((num_conflicts++)); break;;
|
||||||
|
?U) ((num_conflicts++)); break;;
|
||||||
|
DD) ((num_conflicts++)); break;;
|
||||||
|
AA) ((num_conflicts++)); break;;
|
||||||
|
#two character matches, first loop
|
||||||
|
?M) ((num_changed++)) ;;
|
||||||
|
?\ ) ;;
|
||||||
|
#single character matches, second loop
|
||||||
|
U) ((num_conflicts++)) ;;
|
||||||
|
\ ) ;;
|
||||||
|
*) ((num_staged++)) ;;
|
||||||
|
esac
|
||||||
|
status="${status:0:(${#status}-1)}"
|
||||||
|
done
|
||||||
|
done <<< "${gitstatus}"
|
||||||
|
|
||||||
|
num_stashed=0
|
||||||
|
if [[ "${__GIT_PROMPT_IGNORE_STASH:-0}" != "1" ]]; then
|
||||||
|
stash_file="${git_dir}/logs/refs/stash"
|
||||||
|
if [[ -e "${stash_file}" ]]; then
|
||||||
|
while IFS='' read -r wcline || [[ -n "${wcline}" ]]; do
|
||||||
|
((num_stashed++))
|
||||||
|
done < "${stash_file}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
clean=0
|
||||||
|
if (( num_changed == 0 && num_staged == 0 && num_untracked == 0 && num_stashed == 0 && num_conflicts == 0)) ; then
|
||||||
|
clean=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
IFS="^" read -ra branch_fields <<< "${branch_line/\#\# }"
|
||||||
|
branch="${branch_fields[@]:0:1}"
|
||||||
|
remote=""
|
||||||
|
upstream=""
|
||||||
|
|
||||||
|
detached_head=0
|
||||||
|
|
||||||
|
if [[ "${branch}" == *"Initial commit on"* ]]; then
|
||||||
|
IFS=" " read -ra fields <<< "${branch}"
|
||||||
|
branch="${fields[@]:3:1}"
|
||||||
|
remote="_NO_REMOTE_TRACKING_"
|
||||||
|
remote_url='.'
|
||||||
|
elif [[ "${branch}" == *"No commits yet on"* ]]; then
|
||||||
|
IFS=" " read -ra fields <<< "${branch}"
|
||||||
|
branch="${fields[@]:4:1}"
|
||||||
|
remote="_NO_REMOTE_TRACKING_"
|
||||||
|
remote_url='.'
|
||||||
|
elif [[ "${branch}" == *"no branch"* ]]; then
|
||||||
|
tag=$( git describe --tags --exact-match )
|
||||||
|
if [[ -n "${tag}" ]]; then
|
||||||
|
branch="_PRETAG_${tag}"
|
||||||
|
detached_head=1
|
||||||
|
else
|
||||||
|
branch="_PREHASH_$( git rev-parse --short HEAD )"
|
||||||
|
detached_head=1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ "${#branch_fields[@]}" -eq 1 ]]; then
|
||||||
|
remote="_NO_REMOTE_TRACKING_"
|
||||||
|
remote_url='.'
|
||||||
|
else
|
||||||
|
IFS="[,]" read -ra remote_fields <<< "${branch_fields[1]}"
|
||||||
|
upstream="${remote_fields[@]:0:1}"
|
||||||
|
for remote_field in "${remote_fields[@]}"; do
|
||||||
|
if [[ "${remote_field}" == "ahead "* ]]; then
|
||||||
|
num_ahead="${remote_field:6}"
|
||||||
|
ahead="_AHEAD_${num_ahead}"
|
||||||
|
fi
|
||||||
|
if [[ "${remote_field}" == "behind "* ]] || [[ "${remote_field}" == " behind "* ]]; then
|
||||||
|
num_behind="${remote_field:7}"
|
||||||
|
behind="_BEHIND_${num_behind# }"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
remote="${behind-}${ahead-}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${remote:+x}" ]] ; then
|
||||||
|
remote='.'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${upstream:+x}" ]] ; then
|
||||||
|
upstream='^'
|
||||||
|
fi
|
||||||
|
|
||||||
|
UPSTREAM_TRIMMED=$(echo $upstream | xargs)
|
||||||
|
|
||||||
|
printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
|
||||||
|
"${branch}${state}" \
|
||||||
|
"${remote}" \
|
||||||
|
"${remote_url}" \
|
||||||
|
"${UPSTREAM_TRIMMED}" \
|
||||||
|
"${num_staged}" \
|
||||||
|
"${num_conflicts}" \
|
||||||
|
"${num_changed}" \
|
||||||
|
"${num_untracked}" \
|
||||||
|
"${num_stashed}" \
|
||||||
|
"${clean}" \
|
||||||
|
"${detached_head}"
|
||||||
|
|
||||||
|
exit
|
43
gpchange.sh
Executable file
43
gpchange.sh
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#####################################################################################
|
||||||
|
# First Created: 14012025 Author: Allan Desc: Changes the theme for bash-git-prompt #
|
||||||
|
#####################################################################################
|
||||||
|
|
||||||
|
#
|
||||||
|
# Define variables and functions
|
||||||
|
#
|
||||||
|
themedir="$HOME/.bash-git-prompt/themes"
|
||||||
|
allthemes=$(ls -la $themedir |grep "bgptheme" |sed s'/.bgptheme//g' |awk '{print $9}')
|
||||||
|
activetheme=$(cat /$HOME/.bashrc |grep "GIT_PROMPT_THEME" |awk -F'=' '{print $2}')
|
||||||
|
#
|
||||||
|
# Define colors
|
||||||
|
#
|
||||||
|
redbc=$(echo "\e[38;5;196;1m")
|
||||||
|
cyanbc=$(echo "\e[38;5;117;1m")
|
||||||
|
resetc=$(echo "\e[0m")
|
||||||
|
|
||||||
|
clear
|
||||||
|
cd $themedir
|
||||||
|
|
||||||
|
if [ -z "$activetheme" ] ; then printf "\n${redbc}Error! ${resetc}GIT_PROMPT_THEME not found in .bashrc\n\n" ; exit ; fi
|
||||||
|
|
||||||
|
printf "Bash Git Promt Theme Changer - Use CTRL+C to quit...\n\n"
|
||||||
|
printf "Current Theme = ${cyanbc}$activetheme${resetc}\n\n"
|
||||||
|
printf "Available Themes:\n\n"
|
||||||
|
printf '%s\n' "${allthemes[@]}"
|
||||||
|
printf "\n"
|
||||||
|
|
||||||
|
read -p "Enter Theme Name To Use: " themename
|
||||||
|
|
||||||
|
if [[ ${allthemes[*]} =~ (^|[[:space:]])"$themename"($|[[:space:]]) ]] ; then proceed="yes" ; else proceed="no" ; fi
|
||||||
|
if [[ $proceed == "no" ]] ; then printf "\n${redbc}Error! ${resetc}The theme ${redbc}$themename${resetc} does not exist...\n\n" ; exit ; fi
|
||||||
|
|
||||||
|
if [[ $themename == "$activetheme" ]] ; then printf "\nYou are allready using the theme ${cyanbc}$themename${resetc} nothing to do...\n\n" ; exit ; fi
|
||||||
|
|
||||||
|
sed -i "s/THEME=.*$/THEME=$themename/" $HOME/.bashrc
|
||||||
|
|
||||||
|
printf "\nTheme changed to ${cyanbc}$themename${resetc} please close and reopen all your terminals for changes to take effect.\n\n"
|
||||||
|
#
|
||||||
|
# End of script
|
||||||
|
#
|
116
gpthemes.sh
Executable file
116
gpthemes.sh
Executable file
@ -0,0 +1,116 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#################################################################################################
|
||||||
|
# First Created: 14012025 Author: Allan Desc: Displays the available themes for bash-git-prompt #
|
||||||
|
#################################################################################################
|
||||||
|
|
||||||
|
#
|
||||||
|
# Define variables and functions
|
||||||
|
#
|
||||||
|
themedir="$HOME/.bash-git-prompt/themes"
|
||||||
|
allthemes=$(ls -la $themedir |grep "bgptheme" |sed s'/.bgptheme//g' |awk '{print $9}')
|
||||||
|
activetheme=$(cat /$HOME/.bashrc |grep "GIT_PROMPT_THEME" |awk -F'=' '{print $2}')
|
||||||
|
#
|
||||||
|
# Define colors
|
||||||
|
#
|
||||||
|
|
||||||
|
# Arrow Color
|
||||||
|
arrow_black_blue=$(echo "\e[30;48;5;25m")
|
||||||
|
arrow_blue_white=$(echo "\e[38;5;25;107m")
|
||||||
|
arrow_white_black=$(echo "\e[97;40m")
|
||||||
|
arrow_blue_gold=$(echo "\e[38;5;25;48;5;178m")
|
||||||
|
arrow_gold_black=$(echo "\e[38;5;178;40m")
|
||||||
|
arrow_blue_orange=$(echo "\e[38;5;25;48;5;208m")
|
||||||
|
arrow_orange_black=$(echo "\e[38;5;208;40m")
|
||||||
|
|
||||||
|
# Half Circle Color
|
||||||
|
circle_orange_black=$(echo "\e[38;5;208;40m")
|
||||||
|
circle_black_orange=$(echo "\e[30;48;5;208m")
|
||||||
|
circle_yellow_black=$(echo "\e[38;5;226;40m")
|
||||||
|
circle_black_yellow=$(echo "\e[30;48;5;226m")
|
||||||
|
yellow_black=$(echo "\e[38;5;226;40m")
|
||||||
|
orange_orange=$(echo "\e[38;5;208;48;5;208m")
|
||||||
|
yellow_yellow=$(echo "\e[38;5;226;48;5;226m")
|
||||||
|
lambda_symbol=$(echo "\e[38;5;208;40;1m")
|
||||||
|
hazard_symbol=$(echo "\e[38;5;226;40m")
|
||||||
|
|
||||||
|
redc=$(echo "\e[38;5;196m")
|
||||||
|
redbc=$(echo "\e[38;5;196;1m")
|
||||||
|
bluec=$(echo "\e[38;5;69m")
|
||||||
|
bluebc=$(echo "\e[38;5;69;1m")
|
||||||
|
greenc=$(echo "\e[38;5;41m")
|
||||||
|
greenbc=$(echo "\e[38;5;41;1m")
|
||||||
|
yellowc=$(echo "\e[38;5;226m")
|
||||||
|
yellowbc=$(echo "\e[38;5;226;1m")
|
||||||
|
purplec=$(echo "\e[38;5;170m")
|
||||||
|
purplebc=$(echo "\e[38;5;170;1m")
|
||||||
|
cyanc=$(echo "\e[38;5;117m")
|
||||||
|
cyanbc=$(echo "\e[38;5;117;1m")
|
||||||
|
goldc=$(echo "\e[38;5;178m")
|
||||||
|
goldbc=$(echo "\e[38;5;178;1m")
|
||||||
|
whitec=$(echo "\e[97m")
|
||||||
|
whitebc=$(echo "\e[97;1m")
|
||||||
|
white_goldc=$(echo "\e[97;48;5;178m")
|
||||||
|
white_goldbc=$(echo "\e[97;48;5;178;1m")
|
||||||
|
white_bluec=$(echo "\e[97;48;5;25m")
|
||||||
|
white_bluebc=$(echo "\e[97;48;5;25;1m")
|
||||||
|
white_blackc=$(echo "\e[30;107m")
|
||||||
|
white_blackbc=$(echo "\e[30;107;1m")
|
||||||
|
black_orangec=$(echo "\e[30;48;5;208m")
|
||||||
|
black_orangebc=$(echo "\e[30;48;5;208;1m")
|
||||||
|
black_yellowc=$(echo "\e[30;48;5;226m")
|
||||||
|
black_yellowbc=$(echo "\e[30;48;5;226;1m")
|
||||||
|
white_redc=$(echo "\e[97;48;5;196m")
|
||||||
|
white_redbc=$(echo "\e[97;48;5;196;1m")
|
||||||
|
resetc=$(echo "\e[0m")
|
||||||
|
|
||||||
|
# Arrow Color
|
||||||
|
arrow_black_blue=$(echo "\e[30;48;5;25m")
|
||||||
|
arrow_blue_white=$(echo "\e[38;5;25;107m")
|
||||||
|
arrow_white_black=$(echo "\e[97;40m")
|
||||||
|
arrow_blue_gold=$(echo "\e[38;5;25;48;5;178m")
|
||||||
|
arrow_gold_black=$(echo "\e[38;5;178;40m")
|
||||||
|
arrow_blue_orange=$(echo "\e[38;5;25;48;5;208m")
|
||||||
|
arrow_orange_black=$(echo "\e[38;5;208;40m")
|
||||||
|
|
||||||
|
# Half Circle Color
|
||||||
|
circle_orange_black=$(echo "\e[38;5;208;40m")
|
||||||
|
circle_black_orange=$(echo "\e[30;48;5;208m")
|
||||||
|
circle_yellow_black=$(echo "\e[38;5;226;40m")
|
||||||
|
circle_black_yellow=$(echo "\e[30;48;5;226m")
|
||||||
|
yellow_black=$(echo "\e[38;5;226;40m")
|
||||||
|
orange_orange=$(echo "\e[38;5;208;48;5;208m")
|
||||||
|
yellow_yellow=$(echo "\e[38;5;226;48;5;226m")
|
||||||
|
lambda_symbol=$(echo "\e[38;5;208;40;1m")
|
||||||
|
hazard_symbol=$(echo "\e[38;5;226;40m")
|
||||||
|
|
||||||
|
clear ; printf "\n"
|
||||||
|
|
||||||
|
printf "Bash Git Promt Themes.........................................\n\n"
|
||||||
|
|
||||||
|
printf " ${goldc}~/work/somedir ${whitec}[${purplec}main ${redc}●3 ${bluec}✚1 ${cyanc}…1${whitec}]${resetc}\t\t\tdefault\n\n"
|
||||||
|
|
||||||
|
printf " [${cyanc} main ${redc}3 ${bluec}+1 ${greenc}1${whitec}]${goldc} ~/work/somedir${whitec} $ ${resetc}\t\tx-files\n\n"
|
||||||
|
|
||||||
|
printf " ${whitec}[23:44][${cyanc} main ${redc}3 ${bluec}+1 ${greenc}1${whitec}]${goldc} ~/work/somedir${whitec} $ ${resetc}\tx-files-time\n\n"
|
||||||
|
|
||||||
|
printf " ${greenc}➜ ${goldc}somedir ${whitec}[${cyanc} main ${redc}3 ${bluec}+1 ${greenc}1${whitec}]${resetc}\t\t\trobby-russell\n\n"
|
||||||
|
|
||||||
|
printf " ${greenc}❯❯ ${whitec}[${cyanc} main ${redc}3 ${bluec}+1 ${greenc}1${whitec}]${goldc} ~/work/somedir${whitec} ❯❯ ${resetc}\tthis-way\n\n"
|
||||||
|
|
||||||
|
printf " ${whitec}┌──[${goldc}~/work/somedir ${cyanc} main ${redc}3 ${bluec}+1 ${greenc}1${resetc}]\t\ttwo-liner\n └─$ \n\n"
|
||||||
|
|
||||||
|
printf " ${whitec}┌──[23:44${goldc} ~/work/somedir ${cyanc} main ${redc}3 ${bluec}+1 ${greenc}1${resetc}]\ttwo-liner-time\n └─$ \n\n"
|
||||||
|
|
||||||
|
printf " ${arrow_black_blue}${white_bluec} main 3 +1 1${arrow_blue_white}${white_blackc}~/work/somedir${arrow_white_black}${resetc}\t\tfancy-white\n\n"
|
||||||
|
|
||||||
|
printf " ${arrow_black_blue}${white_bluec} main 3 +1 1${arrow_blue_orange}${black_orangec}~/work/somedir${arrow_orange_black}${resetc}\t\tfancy-orange\n\n"
|
||||||
|
|
||||||
|
printf " ${arrow_black_blue}${white_bluec} main 3 +1 1${arrow_blue_gold}${white_goldc}~/work/somedir${arrow_gold_black}${resetc}\t\tfancy-gold\n\n"
|
||||||
|
|
||||||
|
printf " ${circle_orange_black}${circle_black_orange} ${lambda_symbol}λ${resetc}${circle_black_orange}${xf_reset}${black_orangec} main 3 +1 1 ~/work/somedir${circle_orange_black}${resetc}\t\thalf-life\n\n"
|
||||||
|
|
||||||
|
printf " ${circle_yellow_black}${circle_black_yellow} ${hazard_symbol}${circle_black_yellow}${resetc}${circle_black_yellow} main 3 +1 1 ~/work/somedir${circle_yellow_black}${resetc}\t\thazard\n\n"
|
||||||
|
#
|
||||||
|
# End of script
|
||||||
|
#
|
9
install-fonts.sh
Executable file
9
install-fonts.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
##################################################################################
|
||||||
|
# First Created: 03012025 Author: Allan Desc: Installs fonts for bash-git-prompt #
|
||||||
|
##################################################################################
|
||||||
|
|
||||||
|
mkdir -p $HOME/.local/share/fonts
|
||||||
|
cp $HOME/.bash-git-prompt/fonts/*.ttf $HOME/.local/share/fonts
|
||||||
|
fc-cache -f
|
114
prompt-colors.sh
Normal file
114
prompt-colors.sh
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# prompt-colors.sh
|
||||||
|
#
|
||||||
|
# source this file to get color definitions
|
||||||
|
# are also printed to STDERR.
|
||||||
|
|
||||||
|
# bash/zsh cross compatibility notes:
|
||||||
|
# - using colors modules to set colors in zsh, please autoload it
|
||||||
|
# - Dim colors, Intense Black not supported in zsh
|
||||||
|
|
||||||
|
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:1}"
|
||||||
|
local fgcolorcode="${FgColors[@]:$x:1}"
|
||||||
|
local bgcolorcode="${BgColors[@]:$x:1}"
|
||||||
|
longcolorname="${attrname}${colorname}"
|
||||||
|
|
||||||
|
if [ -n "$ZSH_VERSION" ]; then
|
||||||
|
# zsh
|
||||||
|
lowercolorname=$(echo $colorname | tr '[A-Z]' '[a-z]')
|
||||||
|
_def_color_zsh "${longcolorname}" "${attrcode}" "${lowercolorname}" "fg"
|
||||||
|
_def_color_zsh "${longcolorname}Fg" "${attrcode}" "${lowercolorname}" "fg"
|
||||||
|
_def_color_zsh "${longcolorname}Bg" "${attrcode}" "${lowercolorname}" "bg"
|
||||||
|
else
|
||||||
|
# bash
|
||||||
|
_def_color "${longcolorname}" "${attrcode}" "${fgcolorcode}"
|
||||||
|
_def_color "${longcolorname}Fg" "${attrcode}" "${fgcolorcode}"
|
||||||
|
_def_color "${longcolorname}Bg" "${attrcode}" "${bgcolorcode}"
|
||||||
|
fi
|
||||||
|
(( x++ ))
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# _term_color [ N | N M ]
|
||||||
|
_term_color() {
|
||||||
|
local cv
|
||||||
|
if [[ "${#}" -gt 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}\`\""
|
||||||
|
eval "${def}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# def_color_zsh NAME ATTRCODE COLORNAME FG|BG
|
||||||
|
_def_color_zsh() {
|
||||||
|
if [ "${3}" = "0" ]; then
|
||||||
|
local def="${1}=\"%{\$reset_color%}\""
|
||||||
|
else
|
||||||
|
case ${2} in
|
||||||
|
1) # bold color
|
||||||
|
local def="${1}=\"%{\$${4}_bold[${3}]%}\""
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
local def="${1}=\"%{\$${4}[${3}]%}\""
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
eval "${def}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_map_colors Bold ${AttrBright}
|
||||||
|
_map_colors Bright ${AttrBright}
|
||||||
|
_map_colors Dim ${AttrDim}
|
||||||
|
_map_colors '' ${AttrNorm}
|
||||||
|
|
||||||
|
if [ -n "$ZSH_VERSION" ]; then
|
||||||
|
_def_color_zsh IntenseBlack 0 90
|
||||||
|
_def_color_zsh ResetColor 0 0
|
||||||
|
else
|
||||||
|
_def_color IntenseBlack 0 90
|
||||||
|
_def_color ResetColor 0 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# do the color definitions only once
|
||||||
|
if [[ -z "${ColorNames+x}" || "${#ColorNames[*]}" = 0 || -z "${IntenseBlack:+x}" || -z "${ResetColor:+x}" ]]; then
|
||||||
|
define_color_names
|
||||||
|
fi
|
124
themes/default.bgptheme
Normal file
124
themes/default.bgptheme
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
# 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_DETACHED_HEAD
|
||||||
|
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_UPSTREAM
|
||||||
|
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_PRETAG
|
||||||
|
unset GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING
|
||||||
|
}
|
||||||
|
|
||||||
|
define_helpers() {
|
||||||
|
Time12a="\$(date +%H:%M)"
|
||||||
|
PathShort="\w";
|
||||||
|
NewLine="\n"
|
||||||
|
|
||||||
|
if [ -n "$ZSH_VERSION" ]; then
|
||||||
|
Time12a="%T"
|
||||||
|
PathShort="%~"
|
||||||
|
NewLine=$'\n'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
define_undefined_git_prompt_colors() {
|
||||||
|
if [ -z ${GIT_PROMPT_THEME_NAME:+x} ]; then GIT_PROMPT_THEME_NAME="default"; fi
|
||||||
|
|
||||||
|
# These are the color definitions used by gitprompt.sh
|
||||||
|
if [ -z "${GIT_PROMPT_PREFIX+x}" ]; then GIT_PROMPT_PREFIX="["; fi # start of the git info string
|
||||||
|
if [ -z "${GIT_PROMPT_SUFFIX+x}" ]; then GIT_PROMPT_SUFFIX="]"; fi # the end of the git info string
|
||||||
|
if [ -z "${GIT_PROMPT_SEPARATOR+x}" ]; then GIT_PROMPT_SEPARATOR="|"; fi # separates each item
|
||||||
|
|
||||||
|
if [ -z "${GIT_PROMPT_BRANCH+x}" ]; then GIT_PROMPT_BRANCH="${Magenta}"; fi # the git branch that is active in the current directory
|
||||||
|
if [ -z "${GIT_PROMPT_MASTER_BRANCH+x}" ]; then GIT_PROMPT_MASTER_BRANCH="${GIT_PROMPT_BRANCH}"; fi # used if the git branch that is active in the current directory is $GIT_PROMPT_MASTER_BRANCHES
|
||||||
|
if [ -z "${GIT_PROMPT_DETACHED_HEAD+x}" ]; then GIT_PROMPT_DETACHED_HEAD="${GIT_PROMPT_BRANCH}"; fi # used if the repo is in a detached head state
|
||||||
|
if [ -z "${GIT_PROMPT_STAGED+x}" ]; then GIT_PROMPT_STAGED="${Red} ●"; fi # the number of staged files/directories
|
||||||
|
if [ -z "${GIT_PROMPT_CONFLICTS+x}" ]; then GIT_PROMPT_CONFLICTS="${Red}✖ "; fi # the number of files in conflict
|
||||||
|
if [ -z "${GIT_PROMPT_CHANGED+x}" ]; then GIT_PROMPT_CHANGED="${Blue} ✚"; fi # the number of changed files
|
||||||
|
|
||||||
|
if [ -z "${GIT_PROMPT_REMOTE+x}" ]; then GIT_PROMPT_REMOTE=" "; fi # the remote branch name (if any) and the symbols for ahead and behind
|
||||||
|
if [ -z "${GIT_PROMPT_UNTRACKED+x}" ]; then GIT_PROMPT_UNTRACKED="${Cyan} …"; fi # the number of untracked files/dirs
|
||||||
|
if [ -z "${GIT_PROMPT_STASHED+x}" ]; then GIT_PROMPT_STASHED="${BoldGreen} ⚑"; fi # the number of stashed files/dir
|
||||||
|
if [ -z "${GIT_PROMPT_CLEAN+x}" ]; 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+x}" ]; 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+x}" ]; then GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_"; fi # indicator if the last command returned with an exit code of other than 0
|
||||||
|
|
||||||
|
# Possible to change which command is used to create git status information
|
||||||
|
# There are three options:
|
||||||
|
# 1) gitstatus.sh (uses git status --branch --porcelain - fast, requires git > 1.7.10)
|
||||||
|
# 2) gitstatus_pre-1.7.10.sh (Uses a variety of git commands and pipes - slower, works with older git clients)
|
||||||
|
# 3) gitstatus.py (Unsupported, lack features found in the bash versions)
|
||||||
|
if [ -z "${GIT_PROMPT_STATUS_COMMAND+x}" ]; then GIT_PROMPT_STATUS_COMMAND="gitstatus.sh"; fi # Point out the command to get the git status from
|
||||||
|
|
||||||
|
# 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+x}" ]; then GIT_PROMPT_VIRTUALENV="(${Blue}_VIRTUALENV_${ResetColor}) "; fi
|
||||||
|
|
||||||
|
# template for displaying the current remote tracking branch
|
||||||
|
# use the placeholder _UPSTREAM_ will be replaced with
|
||||||
|
# the name of the current remote tracking branch
|
||||||
|
if [ -z "${GIT_PROMPT_UPSTREAM+x}" ]; then GIT_PROMPT_UPSTREAM=" {${Blue}_UPSTREAM_${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+x}" ]; then GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${Yellow}${PathShort}${ResetColor}"; fi
|
||||||
|
if [ -z "${GIT_PROMPT_START_ROOT+x}" ]; then GIT_PROMPT_START_ROOT="_LAST_COMMAND_INDICATOR_ ${Yellow}${PathShort}${ResetColor}"; fi
|
||||||
|
if [ -z "${GIT_PROMPT_END_USER+x}" ]; then GIT_PROMPT_END_USER=" $ "; fi
|
||||||
|
if [ -z "${GIT_PROMPT_END_ROOT+x}" ]; then GIT_PROMPT_END_ROOT=" # "; fi
|
||||||
|
|
||||||
|
# Please do not add colors to these symbols
|
||||||
|
if [ -z ${GIT_PROMPT_SYMBOLS_AHEAD+x} ]; then GIT_PROMPT_SYMBOLS_AHEAD="↑·"; fi # The symbol for "n versions ahead of origin"
|
||||||
|
if [ -z ${GIT_PROMPT_SYMBOLS_BEHIND+x} ]; then GIT_PROMPT_SYMBOLS_BEHIND="↓·"; fi # The symbol for "n versions behind of origin"
|
||||||
|
if [ -z ${GIT_PROMPT_SYMBOLS_PREHASH+x} ]; then GIT_PROMPT_SYMBOLS_PREHASH=":"; fi # Written before hash of commit, if no name could be found
|
||||||
|
if [ -z ${GIT_PROMPT_SYMBOLS_PRETAG+x} ]; then GIT_PROMPT_SYMBOLS_PRETAG=""; fi # Written before tag name
|
||||||
|
if [ -z ${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING+x} ]; then GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="L"; fi # This symbol is written after the branch, if the branch is not tracked
|
||||||
|
|
||||||
|
# branch name(s) that will use $GIT_PROMPT_MASTER_BRANCH color
|
||||||
|
# To specify multiple branches, use
|
||||||
|
# shopt -s extglob
|
||||||
|
# GIT_PROMPT_MASTER_BRANCHES='@(master|production)'
|
||||||
|
if [ -z ${GIT_PROMPT_MASTER_BRANCHES+x} ]; then GIT_PROMPT_MASTER_BRANCHES="master"; fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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
|
55
themes/fancy-gold.bgptheme
Normal file
55
themes/fancy-gold.bgptheme
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#######################################################
|
||||||
|
# Fancy Gold bash-git-prompt theme. #
|
||||||
|
# This theme is using symbols from the font: #
|
||||||
|
# DejaVuSansMono Nerd Font included in the repositoty #
|
||||||
|
#######################################################
|
||||||
|
|
||||||
|
override_git_prompt_colors() {
|
||||||
|
|
||||||
|
local redc=$(echo -e "\e[38;5;196m")
|
||||||
|
local greenc=$(echo -e "\e[38;5;41m")
|
||||||
|
|
||||||
|
local white_goldc=$(echo -e "\e[97;48;5;178m")
|
||||||
|
local white_bluec=$(echo -e "\e[97;48;5;25m")
|
||||||
|
local white_redc=$(echo -e "\e[97;48;5;196m")
|
||||||
|
|
||||||
|
local arrow_black_blue=$(echo -e "\e[30;48;5;25m")
|
||||||
|
local arrow_blue_gold=$(echo -e "\e[38;5;25;48;5;178m")
|
||||||
|
local arrow_gold_black=$(echo -e "\e[38;5;178;40m")
|
||||||
|
local arrow_blue_red=$(echo -e "\e[38;5;25;48;5;196m")
|
||||||
|
local arrow_red_black=$(echo -e "\e[38;5;196;40m")
|
||||||
|
|
||||||
|
Time12a="\$(date +%H:%M)"
|
||||||
|
|
||||||
|
GIT_PROMPT_THEME_NAME="fancy-gold"
|
||||||
|
GIT_PROMPT_ONLY_IN_REPO=1
|
||||||
|
GIT_PROMPT_LEADING_SPACE=0
|
||||||
|
GIT_PROMPT_REMOTE=""
|
||||||
|
|
||||||
|
GIT_PROMPT_BRANCH="${white_bluec} "
|
||||||
|
|
||||||
|
GIT_PROMPT_PREFIX=""
|
||||||
|
GIT_PROMPT_SUFFIX=""
|
||||||
|
GIT_PROMPT_SEPARATOR=""
|
||||||
|
GIT_PROMPT_STAGED="${white_bluec} "
|
||||||
|
GIT_PROMPT_CONFLICTS="${white_bluec} ✗"
|
||||||
|
GIT_PROMPT_CHANGED="${white_bluec} +"
|
||||||
|
GIT_PROMPT_UNTRACKED="${white_bluec} "
|
||||||
|
GIT_PROMPT_STASHED="${white_bluec} "
|
||||||
|
GIT_PROMPT_CLEAN="${white_bluec} ✔"
|
||||||
|
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="${white_bluec} "
|
||||||
|
|
||||||
|
GIT_PROMPT_COMMAND_OK="${greenc}✔ "
|
||||||
|
GIT_PROMPT_COMMAND_FAIL="${redc}✗ "
|
||||||
|
|
||||||
|
GIT_PROMPT_START_USER="${arrow_black_blue}${ResetColor}"
|
||||||
|
GIT_PROMPT_START_ROOT="${arrow_black_blue}${ResetColor}"
|
||||||
|
GIT_PROMPT_END_USER="${arrow_blue_gold}${white_goldc}${PathShort}${arrow_gold_black}${ResetColor} "
|
||||||
|
GIT_PROMPT_END_ROOT="${arrow_blue_red}${white_redc}${PathShort}${arrow_red_black}${ResetColor} "
|
||||||
|
|
||||||
|
GIT_PROMPT_SYMBOLS_AHEAD="${white_bluec} "
|
||||||
|
GIT_PROMPT_SYMBOLS_BEHIND="${white_bluec} "
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_git_prompt_colors "fancy-gold"
|
55
themes/fancy-orange.bgptheme
Normal file
55
themes/fancy-orange.bgptheme
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#######################################################
|
||||||
|
# Fancy Orange bash-git-prompt theme. #
|
||||||
|
# This theme is using symbols from the font: #
|
||||||
|
# DejaVuSansMono Nerd Font included in the repositoty #
|
||||||
|
#######################################################
|
||||||
|
|
||||||
|
override_git_prompt_colors() {
|
||||||
|
|
||||||
|
local redc=$(echo -e "\e[38;5;196m")
|
||||||
|
local greenc=$(echo -e "\e[38;5;41m")
|
||||||
|
|
||||||
|
local white_bluec=$(echo -e "\e[97;48;5;25m")
|
||||||
|
local black_orangec=$(echo -e "\e[30;48;5;208m")
|
||||||
|
local white_redc=$(echo -e "\e[97;48;5;196m")
|
||||||
|
|
||||||
|
local arrow_black_blue=$(echo -e "\e[30;48;5;25m")
|
||||||
|
local arrow_blue_orange=$(echo -e "\e[38;5;25;48;5;208m")
|
||||||
|
local arrow_orange_black=$(echo -e "\e[38;5;208;40m")
|
||||||
|
local arrow_blue_red=$(echo -e "\e[38;5;25;48;5;196m")
|
||||||
|
local arrow_red_black=$(echo -e "\e[38;5;196;40m")
|
||||||
|
|
||||||
|
Time12a="\$(date +%H:%M)"
|
||||||
|
|
||||||
|
GIT_PROMPT_THEME_NAME="fancy-orange"
|
||||||
|
GIT_PROMPT_ONLY_IN_REPO=1
|
||||||
|
GIT_PROMPT_LEADING_SPACE=0
|
||||||
|
GIT_PROMPT_REMOTE=""
|
||||||
|
|
||||||
|
GIT_PROMPT_BRANCH="${white_bluec} "
|
||||||
|
|
||||||
|
GIT_PROMPT_PREFIX=""
|
||||||
|
GIT_PROMPT_SUFFIX=""
|
||||||
|
GIT_PROMPT_SEPARATOR=""
|
||||||
|
GIT_PROMPT_STAGED="${white_bluec} "
|
||||||
|
GIT_PROMPT_CONFLICTS="${white_bluec} ✗"
|
||||||
|
GIT_PROMPT_CHANGED="${white_bluec} +"
|
||||||
|
GIT_PROMPT_UNTRACKED="${white_bluec} "
|
||||||
|
GIT_PROMPT_STASHED="${white_bluec} "
|
||||||
|
GIT_PROMPT_CLEAN="${white_bluec} ✔"
|
||||||
|
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="${white_bluec} "
|
||||||
|
|
||||||
|
GIT_PROMPT_COMMAND_OK="${greenc}✔ "
|
||||||
|
GIT_PROMPT_COMMAND_FAIL="${redc}✗ "
|
||||||
|
|
||||||
|
GIT_PROMPT_START_USER="${arrow_black_blue}${ResetColor}"
|
||||||
|
GIT_PROMPT_START_ROOT="${arrow_black_blue}${ResetColor}"
|
||||||
|
GIT_PROMPT_END_USER="${arrow_blue_orange}${black_orangec}${PathShort}${arrow_orange_black}${ResetColor} "
|
||||||
|
GIT_PROMPT_END_ROOT="${arrow_blue_red}${white_redc}${PathShort}${arrow_red_black}${ResetColor} "
|
||||||
|
|
||||||
|
GIT_PROMPT_SYMBOLS_AHEAD="${white_bluec} "
|
||||||
|
GIT_PROMPT_SYMBOLS_BEHIND="${white_bluec} "
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_git_prompt_colors "fancy-orange"
|
55
themes/fancy-white.bgptheme
Normal file
55
themes/fancy-white.bgptheme
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#######################################################
|
||||||
|
# Fancy White bash-git-prompt theme. #
|
||||||
|
# This theme is using symbols from the font: #
|
||||||
|
# DejaVuSansMono Nerd Font included in the repositoty #
|
||||||
|
#######################################################
|
||||||
|
|
||||||
|
override_git_prompt_colors() {
|
||||||
|
|
||||||
|
local redc=$(echo -e "\e[38;5;196m")
|
||||||
|
local greenc=$(echo -e "\e[38;5;41m")
|
||||||
|
|
||||||
|
local white_bluec=$(echo -e "\e[97;48;5;25m")
|
||||||
|
local black_whitec=$(echo -e "\e[30;107m")
|
||||||
|
local white_redc=$(echo -e "\e[97;48;5;196m")
|
||||||
|
|
||||||
|
local arrow_black_blue=$(echo -e "\e[30;48;5;25m")
|
||||||
|
local arrow_blue_white=$(echo -e "\e[38;5;25;107m")
|
||||||
|
local arrow_white_black=$(echo -e "\e[97;40m")
|
||||||
|
local arrow_blue_red=$(echo -e "\e[38;5;25;48;5;196m")
|
||||||
|
local arrow_red_black=$(echo -e "\e[38;5;196;40m")
|
||||||
|
|
||||||
|
Time12a="\$(date +%H:%M)"
|
||||||
|
|
||||||
|
GIT_PROMPT_THEME_NAME="fancy-white"
|
||||||
|
GIT_PROMPT_ONLY_IN_REPO=1
|
||||||
|
GIT_PROMPT_LEADING_SPACE=0
|
||||||
|
GIT_PROMPT_REMOTE=""
|
||||||
|
|
||||||
|
GIT_PROMPT_BRANCH="${white_bluec} "
|
||||||
|
|
||||||
|
GIT_PROMPT_PREFIX=""
|
||||||
|
GIT_PROMPT_SUFFIX=""
|
||||||
|
GIT_PROMPT_SEPARATOR=""
|
||||||
|
GIT_PROMPT_STAGED="${white_bluec} "
|
||||||
|
GIT_PROMPT_CONFLICTS="${white_bluec} ✗"
|
||||||
|
GIT_PROMPT_CHANGED="${white_bluec} +"
|
||||||
|
GIT_PROMPT_UNTRACKED="${white_bluec} "
|
||||||
|
GIT_PROMPT_STASHED="${white_bluec} "
|
||||||
|
GIT_PROMPT_CLEAN="${white_bluec} ✔"
|
||||||
|
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="${white_bluec} "
|
||||||
|
|
||||||
|
GIT_PROMPT_COMMAND_OK="${greenc}✔ "
|
||||||
|
GIT_PROMPT_COMMAND_FAIL="${redc}✗ "
|
||||||
|
|
||||||
|
GIT_PROMPT_START_USER="${arrow_black_blue}${ResetColor}"
|
||||||
|
GIT_PROMPT_START_ROOT="${arrow_black_blue}${ResetColor}"
|
||||||
|
GIT_PROMPT_END_USER="${arrow_blue_white}${black_whitec}${PathShort}${arrow_white_black}${ResetColor} "
|
||||||
|
GIT_PROMPT_END_ROOT="${arrow_blue_red}${white_redc}${PathShort}${arrow_red_black}${ResetColor} "
|
||||||
|
|
||||||
|
GIT_PROMPT_SYMBOLS_AHEAD="${white_bluec} "
|
||||||
|
GIT_PROMPT_SYMBOLS_BEHIND="${white_bluec} "
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_git_prompt_colors "fancy-white"
|
51
themes/half-life.bgptheme
Normal file
51
themes/half-life.bgptheme
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#######################################################
|
||||||
|
# Half-Life bash-git-prompt theme. #
|
||||||
|
# This theme is using symbols from the font: #
|
||||||
|
# DejaVuSansMono Nerd Font included in the repositoty #
|
||||||
|
#######################################################
|
||||||
|
|
||||||
|
override_git_prompt_colors() {
|
||||||
|
|
||||||
|
local black_orangec=$(echo -e "\e[30;48;5;208m")
|
||||||
|
local black_orangebc=$(echo -e "\e[30;48;5;208;1m")
|
||||||
|
|
||||||
|
local circle_orange_black=$(echo -e "\e[38;5;208;40m")
|
||||||
|
local circle_black_orange=$(echo -e "\e[30;48;5;208m")
|
||||||
|
local orange_orange=$(echo -e "\e[38;5;208;48;5;208m")
|
||||||
|
local lambda_symbol=$(echo -e "\e[38;5;208;40;1m")
|
||||||
|
local clean_symbol=$(echo -e "\e[38;5;41;40m")
|
||||||
|
|
||||||
|
Time12a="\$(date +%H:%M)"
|
||||||
|
|
||||||
|
GIT_PROMPT_THEME_NAME="half-life"
|
||||||
|
GIT_PROMPT_ONLY_IN_REPO=1
|
||||||
|
GIT_PROMPT_LEADING_SPACE=0
|
||||||
|
GIT_PROMPT_REMOTE=""
|
||||||
|
|
||||||
|
GIT_PROMPT_BRANCH="${circle_black_orange} ${lambda_symbol}λ${ResetColor}${circle_black_orange} "
|
||||||
|
|
||||||
|
GIT_PROMPT_PREFIX=""
|
||||||
|
GIT_PROMPT_SUFFIX=""
|
||||||
|
GIT_PROMPT_SEPARATOR=""
|
||||||
|
GIT_PROMPT_STAGED="${black_orangec} "
|
||||||
|
GIT_PROMPT_CONFLICTS="${black_orangec} ✗"
|
||||||
|
GIT_PROMPT_CHANGED="${black_orangec} +"
|
||||||
|
GIT_PROMPT_UNTRACKED="${black_orangec} "
|
||||||
|
GIT_PROMPT_STASHED="${black_orangec} "
|
||||||
|
GIT_PROMPT_CLEAN="${circle_black_orange} ${clean_symbol}${circle_black_orange}"
|
||||||
|
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="${black_orangec} "
|
||||||
|
|
||||||
|
GIT_PROMPT_COMMAND_OK="${black_orangec}✔ "
|
||||||
|
GIT_PROMPT_COMMAND_FAIL="${black_orangec}✗ "
|
||||||
|
|
||||||
|
GIT_PROMPT_START_USER="${circle_orange_black}${ResetColor}"
|
||||||
|
GIT_PROMPT_START_ROOT="${circle_orange_black}${ResetColor}"
|
||||||
|
GIT_PROMPT_END_USER="${black_orangec} ${PathShort}${circle_orange_black}${ResetColor} "
|
||||||
|
GIT_PROMPT_END_ROOT="${black_orangec} ${PathShort}${circle_black_orange} ${root_symbol}#${ResetColor}${circle_black_orange} ${circle_orange_black} ${ResetColor}"
|
||||||
|
|
||||||
|
GIT_PROMPT_SYMBOLS_AHEAD="${black_orangec} "
|
||||||
|
GIT_PROMPT_SYMBOLS_BEHIND="${black_orangec} "
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_git_prompt_colors "half-life"
|
51
themes/hazard.bgptheme
Normal file
51
themes/hazard.bgptheme
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#######################################################
|
||||||
|
# Hazard bash-git-prompt theme. #
|
||||||
|
# This theme is using symbols from the font: #
|
||||||
|
# DejaVuSansMono Nerd Font included in the repositoty #
|
||||||
|
#######################################################
|
||||||
|
|
||||||
|
override_git_prompt_colors() {
|
||||||
|
|
||||||
|
local black_yellowc=$(echo -e "\e[30;48;5;226m")
|
||||||
|
local black_yellowbc=$(echo -e "\e[30;48;5;226;1m")
|
||||||
|
|
||||||
|
local circle_yellow_black=$(echo -e "\e[38;5;226;40m")
|
||||||
|
local circle_black_yellow=$(echo -e "\e[30;48;5;226m")
|
||||||
|
local yellow_black=$(echo -e "\e[38;5;226;40m")
|
||||||
|
local yellow_yellow=$(echo -e "\e[38;5;226;48;5;226m")
|
||||||
|
local hazard_symbol=$(echo -e "\e[38;5;226;40m")
|
||||||
|
|
||||||
|
Time12a="\$(date +%H:%M)"
|
||||||
|
|
||||||
|
GIT_PROMPT_THEME_NAME="hazard"
|
||||||
|
GIT_PROMPT_ONLY_IN_REPO=1
|
||||||
|
GIT_PROMPT_LEADING_SPACE=0
|
||||||
|
GIT_PROMPT_REMOTE=""
|
||||||
|
|
||||||
|
GIT_PROMPT_BRANCH="${circle_black_yellow} ${hazard_symbol}${circle_black_yellow} "
|
||||||
|
|
||||||
|
GIT_PROMPT_PREFIX=""
|
||||||
|
GIT_PROMPT_SUFFIX=""
|
||||||
|
GIT_PROMPT_SEPARATOR=""
|
||||||
|
GIT_PROMPT_STAGED="${black_yellowc} "
|
||||||
|
GIT_PROMPT_CONFLICTS="${hazard_yellow_red} ✗"
|
||||||
|
GIT_PROMPT_CHANGED="${black_yellowc} +"
|
||||||
|
GIT_PROMPT_UNTRACKED="${black_yellowc} "
|
||||||
|
GIT_PROMPT_STASHED="${black_yellowc} "
|
||||||
|
GIT_PROMPT_CLEAN="${yellow_yellow} ${hazard_yellow_green}✔"
|
||||||
|
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="${black_yellowc} "
|
||||||
|
|
||||||
|
GIT_PROMPT_COMMAND_OK="${black_yellowc}✔ "
|
||||||
|
GIT_PROMPT_COMMAND_FAIL="${black_yellowc}✗ "
|
||||||
|
|
||||||
|
GIT_PROMPT_START_USER="${circle_yellow_black}${ResetColor}"
|
||||||
|
GIT_PROMPT_START_ROOT="${circle_yellow_black}${ResetColor}"
|
||||||
|
GIT_PROMPT_END_USER="${black_yellowc} ${PathShort}${circle_yellow_black}${ResetColor} "
|
||||||
|
GIT_PROMPT_END_ROOT="${black_yellowc} ${PathShort}${circle_black_yellow} ${root_symbol}#${ResetColor}${circle_black_yellow} ${circle_yellow_black} ${ResetColor}"
|
||||||
|
|
||||||
|
GIT_PROMPT_SYMBOLS_AHEAD="${black_yellowc} "
|
||||||
|
GIT_PROMPT_SYMBOLS_BEHIND="${black_yellowc} "
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_git_prompt_colors "hazard"
|
57
themes/robby-russell.bgptheme
Normal file
57
themes/robby-russell.bgptheme
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#######################################################
|
||||||
|
# Robby Russell bash-git-prompt theme. #
|
||||||
|
# This theme is using symbols from the font: #
|
||||||
|
# DejaVuSansMono Nerd Font included in the repositoty #
|
||||||
|
#######################################################
|
||||||
|
|
||||||
|
override_git_prompt_colors() {
|
||||||
|
|
||||||
|
function prompt_callback {
|
||||||
|
local PS1="$(gp_truncate_pwd)"
|
||||||
|
gp_set_window_title "$PS1"
|
||||||
|
}
|
||||||
|
|
||||||
|
local redc=$(echo -e "\e[38;5;196m")
|
||||||
|
local bluec=$(echo -e "\e[38;5;69m")
|
||||||
|
local greenc=$(echo -e "\e[38;5;41m")
|
||||||
|
local yellowc=$(echo -e "\e[38;5;226m")
|
||||||
|
local cyanc=$(echo -e "\e[38;5;117m")
|
||||||
|
local goldc=$(echo -e "\e[38;5;178m")
|
||||||
|
local greyc=$(echo -e "\e[38;5;250m")
|
||||||
|
local whitec=$(echo -e "\e[97m")
|
||||||
|
|
||||||
|
Time12a="\$(date +%H:%M)"
|
||||||
|
PathShort="\W";
|
||||||
|
|
||||||
|
GIT_PROMPT_THEME_NAME="robby-russell"
|
||||||
|
GIT_PROMPT_ONLY_IN_REPO=1
|
||||||
|
GIT_PROMPT_LEADING_SPACE=0
|
||||||
|
GIT_PROMPT_REMOTE=""
|
||||||
|
|
||||||
|
GIT_PROMPT_BRANCH="${cyanc} "
|
||||||
|
|
||||||
|
GIT_PROMPT_PREFIX="["
|
||||||
|
GIT_PROMPT_SUFFIX="]"
|
||||||
|
GIT_PROMPT_SEPARATOR=" "
|
||||||
|
GIT_PROMPT_STAGED="${redc}"
|
||||||
|
GIT_PROMPT_CONFLICTS=" ${redc}✗"
|
||||||
|
GIT_PROMPT_CHANGED=" ${bluec}+"
|
||||||
|
GIT_PROMPT_UNTRACKED=" ${greenc}"
|
||||||
|
GIT_PROMPT_STASHED=" ${yellowc}"
|
||||||
|
GIT_PROMPT_CLEAN="${greenc}✔"
|
||||||
|
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="${greyc} "
|
||||||
|
|
||||||
|
GIT_PROMPT_COMMAND_OK="${greenc}➜ "
|
||||||
|
GIT_PROMPT_COMMAND_FAIL="${redc}➜ "
|
||||||
|
|
||||||
|
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_${goldc}${PathShort}${ResetColor} "
|
||||||
|
GIT_PROMPT_START_ROOT="_LAST_COMMAND_INDICATOR_${goldc}${PathShort}${ResetColor} "
|
||||||
|
GIT_PROMPT_END_USER="${ResetColor} "
|
||||||
|
GIT_PROMPT_END_ROOT="${redc} # ${ResetColor}"
|
||||||
|
|
||||||
|
GIT_PROMPT_SYMBOLS_AHEAD="${whitec} "
|
||||||
|
GIT_PROMPT_SYMBOLS_BEHIND="${whitec} "
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_git_prompt_colors "robby-russell"
|
51
themes/this-way.bgptheme
Normal file
51
themes/this-way.bgptheme
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#######################################################
|
||||||
|
# This Way bash-git-prompt theme. #
|
||||||
|
# This theme is using symbols from the font: #
|
||||||
|
# DejaVuSansMono Nerd Font included in the repositoty #
|
||||||
|
#######################################################
|
||||||
|
|
||||||
|
override_git_prompt_colors() {
|
||||||
|
|
||||||
|
local redc=$(echo -e "\e[38;5;196m")
|
||||||
|
local bluec=$(echo -e "\e[38;5;69m")
|
||||||
|
local greenc=$(echo -e "\e[38;5;41m")
|
||||||
|
local yellowc=$(echo -e "\e[38;5;226m")
|
||||||
|
local cyanc=$(echo -e "\e[38;5;117m")
|
||||||
|
local goldc=$(echo -e "\e[38;5;178m")
|
||||||
|
local greyc=$(echo -e "\e[38;5;250m")
|
||||||
|
local whitec=$(echo -e "\e[97m")
|
||||||
|
|
||||||
|
Time12a="\$(date +%H:%M)"
|
||||||
|
|
||||||
|
GIT_PROMPT_THEME_NAME="this-way"
|
||||||
|
GIT_PROMPT_ONLY_IN_REPO=1
|
||||||
|
GIT_PROMPT_LEADING_SPACE=0
|
||||||
|
GIT_PROMPT_REMOTE=""
|
||||||
|
|
||||||
|
GIT_PROMPT_BRANCH="${cyanc} "
|
||||||
|
|
||||||
|
GIT_PROMPT_PREFIX="["
|
||||||
|
GIT_PROMPT_SUFFIX="]"
|
||||||
|
GIT_PROMPT_SEPARATOR=" "
|
||||||
|
GIT_PROMPT_STAGED="${redc}"
|
||||||
|
GIT_PROMPT_CONFLICTS="${redc}✗"
|
||||||
|
GIT_PROMPT_CHANGED=" ${bluec}+"
|
||||||
|
GIT_PROMPT_UNTRACKED=" ${greenc}"
|
||||||
|
GIT_PROMPT_STASHED=" ${yellowc}"
|
||||||
|
GIT_PROMPT_CLEAN="${greenc}❯❯"
|
||||||
|
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="${greyc} "
|
||||||
|
|
||||||
|
GIT_PROMPT_COMMAND_OK="${greenc}❯❯ "
|
||||||
|
GIT_PROMPT_COMMAND_FAIL="${redc}❮❮ "
|
||||||
|
|
||||||
|
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_"
|
||||||
|
GIT_PROMPT_START_ROOT="_LAST_COMMAND_INDICATOR_"
|
||||||
|
GIT_PROMPT_END_USER="${goldc} ${PathShort}${whitec} ❯❯ ${ResetColor}"
|
||||||
|
GIT_PROMPT_END_ROOT="${goldc} ${PathShort}${redc} ❯❯ ${ResetColor}"
|
||||||
|
|
||||||
|
GIT_PROMPT_SYMBOLS_AHEAD="${whitec} "
|
||||||
|
GIT_PROMPT_SYMBOLS_BEHIND="${whitec} "
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_git_prompt_colors "this-way"
|
51
themes/two-liner-time.bgptheme
Normal file
51
themes/two-liner-time.bgptheme
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#######################################################
|
||||||
|
# Two Liner Time bash-git-prompt theme. #
|
||||||
|
# This theme is using symbols from the font: #
|
||||||
|
# DejaVuSansMono Nerd Font included in the repositoty #
|
||||||
|
#######################################################
|
||||||
|
|
||||||
|
override_git_prompt_colors() {
|
||||||
|
|
||||||
|
local redc=$(echo -e "\e[38;5;196m")
|
||||||
|
local bluec=$(echo -e "\e[38;5;69m")
|
||||||
|
local greenc=$(echo -e "\e[38;5;41m")
|
||||||
|
local yellowc=$(echo -e "\e[38;5;226m")
|
||||||
|
local cyanc=$(echo -e "\e[38;5;117m")
|
||||||
|
local goldc=$(echo -e "\e[38;5;178m")
|
||||||
|
local greyc=$(echo -e "\e[38;5;250m")
|
||||||
|
local whitec=$(echo -e "\e[97m")
|
||||||
|
|
||||||
|
Time12a="\$(date +%H:%M)"
|
||||||
|
|
||||||
|
GIT_PROMPT_THEME_NAME="two-liner-time"
|
||||||
|
GIT_PROMPT_ONLY_IN_REPO=1
|
||||||
|
GIT_PROMPT_LEADING_SPACE=0
|
||||||
|
GIT_PROMPT_REMOTE=""
|
||||||
|
|
||||||
|
GIT_PROMPT_BRANCH="${cyanc} "
|
||||||
|
|
||||||
|
GIT_PROMPT_PREFIX=""
|
||||||
|
GIT_PROMPT_SUFFIX=""
|
||||||
|
GIT_PROMPT_SEPARATOR=" "
|
||||||
|
GIT_PROMPT_STAGED="${redc}"
|
||||||
|
GIT_PROMPT_CONFLICTS=" ${redc}✗"
|
||||||
|
GIT_PROMPT_CHANGED=" ${bluec}+"
|
||||||
|
GIT_PROMPT_UNTRACKED=" ${greenc}"
|
||||||
|
GIT_PROMPT_STASHED=" ${yellowc}"
|
||||||
|
GIT_PROMPT_CLEAN="${greenc}✔"
|
||||||
|
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="${greyc} "
|
||||||
|
|
||||||
|
GIT_PROMPT_COMMAND_OK="${greenc}✔ "
|
||||||
|
GIT_PROMPT_COMMAND_FAIL="${redc}✗ "
|
||||||
|
|
||||||
|
GIT_PROMPT_START_USER="${whitec}┌──[${Time12a} ${goldc}${PathShort}${ResetColor} "
|
||||||
|
GIT_PROMPT_START_ROOT="${whitec}┌──[${Time12a} ${goldc}${PathShort}${ResetColor} "
|
||||||
|
GIT_PROMPT_END_USER="]\n└─$ "
|
||||||
|
GIT_PROMPT_END_ROOT="]\n└─# "
|
||||||
|
|
||||||
|
GIT_PROMPT_SYMBOLS_AHEAD="${whitec} "
|
||||||
|
GIT_PROMPT_SYMBOLS_BEHIND="${whitec} "
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_git_prompt_colors "two-liner-time"
|
51
themes/two-liner.bgptheme
Normal file
51
themes/two-liner.bgptheme
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#######################################################
|
||||||
|
# Two Liner bash-git-prompt theme. #
|
||||||
|
# This theme is using symbols from the font: #
|
||||||
|
# DejaVuSansMono Nerd Font included in the repositoty #
|
||||||
|
#######################################################
|
||||||
|
|
||||||
|
override_git_prompt_colors() {
|
||||||
|
|
||||||
|
local redc=$(echo -e "\e[38;5;196m")
|
||||||
|
local bluec=$(echo -e "\e[38;5;69m")
|
||||||
|
local greenc=$(echo -e "\e[38;5;41m")
|
||||||
|
local yellowc=$(echo -e "\e[38;5;226m")
|
||||||
|
local cyanc=$(echo -e "\e[38;5;117m")
|
||||||
|
local goldc=$(echo -e "\e[38;5;178m")
|
||||||
|
local greyc=$(echo -e "\e[38;5;250m")
|
||||||
|
local whitec=$(echo -e "\e[97m")
|
||||||
|
|
||||||
|
Time12a="\$(date +%H:%M)"
|
||||||
|
|
||||||
|
GIT_PROMPT_THEME_NAME="two-liner"
|
||||||
|
GIT_PROMPT_ONLY_IN_REPO=1
|
||||||
|
GIT_PROMPT_LEADING_SPACE=0
|
||||||
|
GIT_PROMPT_REMOTE=""
|
||||||
|
|
||||||
|
GIT_PROMPT_BRANCH="${cyanc} "
|
||||||
|
|
||||||
|
GIT_PROMPT_PREFIX=""
|
||||||
|
GIT_PROMPT_SUFFIX=""
|
||||||
|
GIT_PROMPT_SEPARATOR=" "
|
||||||
|
GIT_PROMPT_STAGED="${redc}"
|
||||||
|
GIT_PROMPT_CONFLICTS=" ${redc}✗"
|
||||||
|
GIT_PROMPT_CHANGED=" ${bluec}+"
|
||||||
|
GIT_PROMPT_UNTRACKED=" ${greenc}"
|
||||||
|
GIT_PROMPT_STASHED=" ${yellowc}"
|
||||||
|
GIT_PROMPT_CLEAN="${greenc}✔"
|
||||||
|
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="${greyc} "
|
||||||
|
|
||||||
|
GIT_PROMPT_COMMAND_OK="${greenc}✔ "
|
||||||
|
GIT_PROMPT_COMMAND_FAIL="${redc}✗ "
|
||||||
|
|
||||||
|
GIT_PROMPT_START_USER="┌──[${goldc}${PathShort}${ResetColor} "
|
||||||
|
GIT_PROMPT_START_ROOT="┌──[${goldc}${PathShort}${ResetColor} "
|
||||||
|
GIT_PROMPT_END_USER="]\n└─$ "
|
||||||
|
GIT_PROMPT_END_ROOT="]\n└─# "
|
||||||
|
|
||||||
|
GIT_PROMPT_SYMBOLS_AHEAD="${whitec} "
|
||||||
|
GIT_PROMPT_SYMBOLS_BEHIND="${whitec} "
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_git_prompt_colors "two-liner"
|
51
themes/x-files-time.bgptheme
Normal file
51
themes/x-files-time.bgptheme
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#######################################################
|
||||||
|
# X-Files Time bash-git-prompt theme. #
|
||||||
|
# This theme is using symbols from the font: #
|
||||||
|
# DejaVuSansMono Nerd Font included in the repositoty #
|
||||||
|
#######################################################
|
||||||
|
|
||||||
|
override_git_prompt_colors() {
|
||||||
|
|
||||||
|
local redc=$(echo -e "\e[38;5;196m")
|
||||||
|
local bluec=$(echo -e "\e[38;5;69m")
|
||||||
|
local greenc=$(echo -e "\e[38;5;41m")
|
||||||
|
local yellowc=$(echo -e "\e[38;5;226m")
|
||||||
|
local cyanc=$(echo -e "\e[38;5;117m")
|
||||||
|
local goldc=$(echo -e "\e[38;5;178m")
|
||||||
|
local greyc=$(echo -e "\e[38;5;250m")
|
||||||
|
local whitec=$(echo -e "\e[97m")
|
||||||
|
|
||||||
|
Time12a="\$(date +%H:%M)"
|
||||||
|
|
||||||
|
GIT_PROMPT_THEME_NAME="x-files-time"
|
||||||
|
GIT_PROMPT_ONLY_IN_REPO=1
|
||||||
|
GIT_PROMPT_LEADING_SPACE=0
|
||||||
|
GIT_PROMPT_REMOTE=""
|
||||||
|
|
||||||
|
GIT_PROMPT_BRANCH="${cyanc} "
|
||||||
|
|
||||||
|
GIT_PROMPT_PREFIX="${whitec}[${Time12a}]["
|
||||||
|
GIT_PROMPT_SUFFIX="]"
|
||||||
|
GIT_PROMPT_SEPARATOR=" "
|
||||||
|
GIT_PROMPT_STAGED="${redc}"
|
||||||
|
GIT_PROMPT_CONFLICTS=" ${redc}✗"
|
||||||
|
GIT_PROMPT_CHANGED=" ${bluec}+"
|
||||||
|
GIT_PROMPT_UNTRACKED=" ${greenc}"
|
||||||
|
GIT_PROMPT_STASHED=" ${yellowc}"
|
||||||
|
GIT_PROMPT_CLEAN="${greenc}✔"
|
||||||
|
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="${greyc} "
|
||||||
|
|
||||||
|
GIT_PROMPT_COMMAND_OK="${greenc}✔ "
|
||||||
|
GIT_PROMPT_COMMAND_FAIL="${redc}✗ "
|
||||||
|
|
||||||
|
GIT_PROMPT_START_USER=""
|
||||||
|
GIT_PROMPT_START_ROOT=""
|
||||||
|
GIT_PROMPT_END_USER="${goldc} ${PathShort}${whitec} $ ${ResetColor}"
|
||||||
|
GIT_PROMPT_END_ROOT="${goldc} ${PathShort}${redc} # ${ResetColor}"
|
||||||
|
|
||||||
|
GIT_PROMPT_SYMBOLS_AHEAD="${whitec} "
|
||||||
|
GIT_PROMPT_SYMBOLS_BEHIND="${whitec} "
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_git_prompt_colors "x-files-time"
|
51
themes/x-files.bgptheme
Normal file
51
themes/x-files.bgptheme
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#######################################################
|
||||||
|
# X-Files bash-git-prompt theme. #
|
||||||
|
# This theme is using symbols from the font: #
|
||||||
|
# DejaVuSansMono Nerd Font included in the repositoty #
|
||||||
|
#######################################################
|
||||||
|
|
||||||
|
override_git_prompt_colors() {
|
||||||
|
|
||||||
|
local redc=$(echo -e "\e[38;5;196m")
|
||||||
|
local bluec=$(echo -e "\e[38;5;69m")
|
||||||
|
local greenc=$(echo -e "\e[38;5;41m")
|
||||||
|
local yellowc=$(echo -e "\e[38;5;226m")
|
||||||
|
local cyanc=$(echo -e "\e[38;5;117m")
|
||||||
|
local goldc=$(echo -e "\e[38;5;178m")
|
||||||
|
local greyc=$(echo -e "\e[38;5;250m")
|
||||||
|
local whitec=$(echo -e "\e[97m")
|
||||||
|
|
||||||
|
Time12a="\$(date +%H:%M)"
|
||||||
|
|
||||||
|
GIT_PROMPT_THEME_NAME="x-files"
|
||||||
|
GIT_PROMPT_ONLY_IN_REPO=1
|
||||||
|
GIT_PROMPT_LEADING_SPACE=0
|
||||||
|
GIT_PROMPT_REMOTE=""
|
||||||
|
|
||||||
|
GIT_PROMPT_BRANCH="${cyanc} "
|
||||||
|
|
||||||
|
GIT_PROMPT_PREFIX="["
|
||||||
|
GIT_PROMPT_SUFFIX="]"
|
||||||
|
GIT_PROMPT_SEPARATOR=" "
|
||||||
|
GIT_PROMPT_STAGED="${redc}"
|
||||||
|
GIT_PROMPT_CONFLICTS=" ${redc}✗"
|
||||||
|
GIT_PROMPT_CHANGED=" ${bluec}+"
|
||||||
|
GIT_PROMPT_UNTRACKED=" ${greenc}"
|
||||||
|
GIT_PROMPT_STASHED=" ${yellowc}"
|
||||||
|
GIT_PROMPT_CLEAN="${greenc}✔"
|
||||||
|
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="${greyc} "
|
||||||
|
|
||||||
|
GIT_PROMPT_COMMAND_OK="${greenc}✔ "
|
||||||
|
GIT_PROMPT_COMMAND_FAIL="${redc}✗ "
|
||||||
|
|
||||||
|
GIT_PROMPT_START_USER=""
|
||||||
|
GIT_PROMPT_START_ROOT=""
|
||||||
|
GIT_PROMPT_END_USER="${goldc} ${PathShort}${whitec} $ ${ResetColor}"
|
||||||
|
GIT_PROMPT_END_ROOT="${goldc} ${PathShort}${redc} # ${ResetColor}"
|
||||||
|
|
||||||
|
GIT_PROMPT_SYMBOLS_AHEAD="${whitec} "
|
||||||
|
GIT_PROMPT_SYMBOLS_BEHIND="${whitec} "
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_git_prompt_colors "x-files"
|
Loading…
Reference in New Issue
Block a user