Forked from reinvanoyen/terminal-prompt-git-branch-zsh.md
Created
January 25, 2022 00:51
-
-
Save Hearsch-Jariwala/b662859950c18c5cc0e7a3e2d25c43b4 to your computer and use it in GitHub Desktop.
Revisions
-
reinvanoyen revised this gist
Dec 20, 2019 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,8 @@ # Add Git Branch Name to Terminal Prompt (MacOS Catalina zsh) <img width="822" alt="screenshot" src="https://user-images.githubusercontent.com/513140/71285442-13d6db00-235d-11ea-8ba6-5bfe45739888.png"> Open `~/.zshrc` in your favorite editor and add the following content to the bottom. ```sh function parse_git_branch() { -
reinvanoyen revised this gist
Dec 20, 2019 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,6 @@ # Add Git Branch Name to Terminal Prompt (MacOS Catalina zsh) <img width="822" alt="screenshot" src="https://user-images.githubusercontent.com/513140/71285442-13d6db00-235d-11ea-8ba6-5bfe45739888.png"> Open ~/.zshrc in your favorite editor and add the following content to the bottom. ```sh -
reinvanoyen revised this gist
Dec 20, 2019 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ # Add Git Branch Name to Terminal Prompt (MacOS Catalina zsh)  Open ~/.zshrc in your favorite editor and add the following content to the bottom. ```sh @@ -11,4 +15,6 @@ 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} $ ' ``` Original gist for Bash by Jose Quintana: https://gist.github.com/joseluisq/1e96c54fa4e1e5647940 -
reinvanoyen revised this gist
Dec 20, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ Open ~/.zshrc in your favorite editor and add the following content to the bottom. ```sh function parse_git_branch() { git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p' } -
reinvanoyen created this gist
Dec 20, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ Open ~/.zshrc in your favorite editor and add the following content to the bottom. ```ssh 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} $ ' ```