inspiration from the terminalparty
theme of OMZ
and the need for a minimalistic "git" prompt for version control , were the main two forces that drove me to create this. Also this too "Ooga-chaka, ooga-ooga" ;)
a fully functional git repo - 17710 commits, on branch v4-dev, 1 unstaged, 6192 commits ahead, 333 behind and 1 untracked file
the normal prompt - prompt in non-git directories
master i
: on branchmaster
, in its "i"nitial stage , where no remote has been added yetmaster 2↑ 1✚
: on branchmaster
, ahead of remote by 2 commits, 1 file changed but not stagedmaster 6?
: on branchmaster
, 6 files files untrackedmaster 2✖ 3✚
: on branchmaster
, 2 unstaged, 3 files modifiedmaster ✓
: on branchmaster
, is cleanmine 2↓ 3↑
: on branchmine
; your branch is behind by 2 and ahead by 3 commits; the repository is otherwise clean~/bashed-on-a-feeling 39 ♥
: the fire has been lit , the repo has a total of 39 commitsgit
: you're in git repository↕
: you're in git repository which has been diverged
in the above examples I've made use of the Hasklug nerd font, a patched variant of Hasklig and Font Awesome fonts.
the user is required to install and use any of the nerd fonts and Font Awesome font, inorder to render those fancy symbols that i've used.
the simplest way to install the fonts on a Linux distro would be to :
- choose any one of the nerd fonts and the full font awesome set from this link font awesome to use it
- download and copy all the fonts files(.ttf/.otf) to
~/.fonts
for current user or to /usr/share/fonts/[T/O]TF directory for all - run
fc-cache -fv ~/.fonts
or if the downloaded files are in/usr/local/share/fonts/
thenfc-cache -fv
to let freetype2 know of those fonts - you can confirm they are installed correctly by running fc-list | grep "your font name"
on your terminal:
cd ~ && git clone https://github.com/yedhink/bashed-on-a-feeling.git
cd ~/bashed-on-a-feeling
./install.sh
then restart your terminal. BOOM!
note that the editing , after installation, should be done on .bashed-gitprompt.sh
file in your home(~) directory for the changes to take place
you can easily change any symbols used by the prompt. take a look to the file .bashed-gitprompt.sh . you will find a bunch of variables, each of them with its default value. the variable names were meant to be auto-explanatory. Something like
: ${untracked_files:='?'}
you can change the symbols with your custom ones , just by editing the line(s) like above one and replacing current symbol with yours. say for common dejavu sans fonts you can use:
: ${no_remote_added:='✘'}
: ${commiticon:='♥'}
: ${added_but_not_committed:='♡'}
: ${committed_and_clean:='✔'}
: ${ahead:='⬆'}
: ${behind:='⬇'}
: ${committed_but_modified_before_push:='✚'}
: ${untracked_files:='⁇'}
: ${gitprompt_normal:='☮'}
: ${gitprompt_diverged:='☢'}
you can make use of gucharmap
or https://char-map.herokuapp.com/
to check for glyphs support of the font of your choice.
the prompt works in a way that it shows a git prompt only when you're in a git repo , otherwise a normal prompt of your choice will be displayed. inorder to customize the normal prompt , edit the line export PS1=
inside the function gitprompt()
in your .bashrc
after installation.
now it's possible to choose colors of your choice for both the normal and git prompts. your preferred colors can be set through the .bashrc
file in your home directory.
editing should be done on these lines by referring to the available colors:
# # # # # # # # # # # # # # # # # #
# SET COLORS FOR THE PROMPT HERE #
# # # # # # # # # # # # # # # # # #
# Edit Normal Prompt Colors Here
normalHeart=$Red # Color for the heart
normalCDire=$Red # Color for the current directory
normalDolar=$Yellow # Color for primary prompt string $
# Edit Git Prompt Colors Here
gpDir=$Yellow # Color for current git directory
gpBrn=$White # Color for current git branch
gpAMa=$Green # Color for both total commits and check mark
# this variable takes only background colors. so use colors like bgRed or bgBlue etc
gpBck=$bgBlue # Background color for the box in which git or the diverged symbol is shown
say for example , if you want to change the color of the heart symbol in normal prompt to yellow and the git/diverged symbol background in git prompt to red color:
normalHeart=$Yellow
gpBck=$Red
the available color variables like Red,Yellow etc will be available in your .bashrc
after installation. after changing the colors either source the file or restart your terminal emulator to see the changes
- just comment out
PROMPT_COMMAND="gitprompt"
in your.bashrc
to disable this prompt - (optionally) remove the files
.bashed-gitprompt.sh
and.cal.sh
from home - (optionally) also remove the lines of code under the heading
bashed-on-a-feeling
in your.bashrc
i meant these lines :
# # # # # # # # # # # #
# bashed-on-a-feeling #
# # # # # # # # # # # #
# git prompt will be shown only when you move to a git dir
gitprompt(){
if `git status &> /dev/null`; then
declare -i cno=0
source ~/.bashed-gitprompt.sh
else
export PS1='\[$normalHeart\]♥ \[$normalCDire\]\W \[$Yellow\]\$\[\e[0m\] '
gbranch=""
fi
}
PROMPT_COMMAND="gitprompt"
although i made this for my personal use , i believe , others might find it useful and could get involved and contribute their ideas. i will happily take them into account!
you've to follow the Contribution Guidelines while you're at it though.
A: it's because you/a program changed the color palette of your terminal to something different than the default one.
run this piece of code to check out your colorscheme :
for fg_color in {0..7}; do
set_foreground=$(tput setaf $fg_color)
for bg_color in {0..7}; do
set_background=$(tput setab $bg_color)
echo -n $set_background$set_foreground
printf ' F:%s B:%s ' $fg_color $bg_color
done
echo $(tput sgr0)
done
A: you need an unicode font (Font Awesome is a must and also a primary font for your terminal ,
like Awesome Terminal Fonts or nerd fonts like Hasklug for Linux or Sauce Code Pro, Menlo or Monaco on Mac OS X, or Monospace on Ubuntu etc) installed on your system for rendering the glyphs properly. refer to font installation on how to install the font.
"use this repo in the name of open source and freeeedoooom!!!"
refer to License for more details. :)
Hope you liked this project, don't forget to give it a star ⭐