Last active
August 11, 2017 17:35
-
-
Save itsthatguy/db2a8d6ebed178b66abef8a2e861a366 to your computer and use it in GitHub Desktop.
Revisions
-
itsthatguy revised this gist
Aug 11, 2017 . 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 @@ -7,8 +7,7 @@ function git_dir_helper() { cd $git_dir_cdup > /dev/null echo ${PWD##*/} )" current_dir="$git_dir_top/${git_dir_path%/}" fi echo -n $current_dir } -
itsthatguy revised this gist
Aug 11, 2017 . 1 changed file with 2 additions 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 @@ -7,15 +7,15 @@ function git_dir_helper() { cd $git_dir_cdup > /dev/null echo ${PWD##*/} )" current_dir="$git_dir_top/$git_dir_path" current_dir=${current_dir%/} fi echo -n $current_dir } function bash_prompt_command() { current_dir=$(git_dir_helper) PS1="$current_dir" } # Using with bash -
itsthatguy revised this gist
Aug 11, 2017 . 1 changed file with 2 additions 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 @@ -13,13 +13,13 @@ function git_dir_helper() { echo -n $current_dir } function bash_prompt_command() { current_dir=$(git_dir_helper) PS1="$git_dir_helper" } # Using with bash PROMPT_COMMAND=bash_prompt_command # Using with zsh function precmd { -
itsthatguy created this gist
Aug 11, 2017 .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,27 @@ function git_dir_helper() { current_dir=${PWD##*/} if git rev-parse --git-dir > /dev/null 2>&1 && [ ! -d .git ]; then git_dir_cdup=$(git rev-parse --show-cdup) git_dir_path=$(git rev-parse --show-prefix) git_dir_top="$( cd $git_dir_cdup > /dev/null echo ${PWD##*/} )" current_dir="$git_dir_top/${git_dir_path}" current_dir=${current_dir%/} fi echo -n $current_dir } function my_prompt_command() { current_dir=$(git_dir_helper) PS1="$git_dir_helper" } # Using with bash PROMPT_COMMAND=itg_dir # Using with zsh function precmd { PROMPT="$(itg_dir)" }