Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

Add Git Branch Name to Terminal Prompt (zsh)

function parse_git_branch() {
    git branch 2> /dev/null | sed -n -e 's/^* (.*)/[1]/p'
}

COLOR_DEF=$'e[0m'
COLOR_USR=$'e[38;5;243m'
COLOR_DIR=$'e[38;5;197m'
COLOR_GIT=$'e[38;5;39m'
setopt PROMPT_SUBST
export PROMPT='${COLOR_USR}%n ${COLOR_DIR}%~ ${COLOR_GIT}$(parse_git_branch)${COLOR_DEF} $ '
Comment

PREVIOUS NEXT
Code Example
Shell :: install mariadb ubuntu linixize 
Shell :: what is --save-dev check when we install a pachage 
Shell :: where is zshrc in big sur 
Shell :: my ubuntu software center has disppeared 
Shell :: git edit hunk how to remove + lines 
Shell :: install sapper 
Shell :: how to show freeswitch user accounts from fs_cli 
Shell :: two sed command together 
Shell :: script to delete a range of history in terminal mac 
Shell :: telnet test port udp 
Shell :: exclude host in ansible adhoc command 
Shell :: To exclude files with patterns containing preceding and trailing characters : 
Shell :: linux poid dossier 
Shell :: awk last match 
Shell :: install scratchpad jupyter notebook 
Shell :: making password sensitive/hide in terraform 
Shell :: ssh welcome message ubuntu 
Shell :: Err:15 http://ppa.launchpad.net/gnome-terminator/ppa/ubuntu bionic Release 404 Not Found [IP: 91.189.95.83 80] 
Shell :: linux vga wake up screen 
Shell :: open gas less example 
Shell :: r install packages ERROR exporting to client 
Shell :: resolve symlinks mac 
Shell :: GHDB categories 
Shell :: angular cli ng clear cache cmd 
Shell :: shell script runner software for linux 
Shell :: nasa-ingenuity-helicopter github 
Shell :: How to open a file from terminal in libre writer 
Shell :: install matlab on ubuntu 18.04 
Shell :: sqlmap enumerate databases for login page 
Shell :: Error: error modifying EC2 Volume "vol-04e2b1a2d03860650": InvalidParameterValue: New size cannot be smaller than existing size 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =