Created
November 21, 2019 21:18
-
-
Save alber70g/b6bd57db85ecea7bd3c39eb630a06b07 to your computer and use it in GitHub Desktop.
my fish_git
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 characters
# | |
# Git | |
# | |
function __sf_section_git_albert -d "Display the git branch and status in Alberts way" | |
# ------------------------------------------------------------------------------ | |
# Configuration __fish_git_prompt | |
# ------------------------------------------------------------------------------ | |
set -g __fish_git_prompt_showcolorhints 'yes' | |
set -g __fish_git_prompt_show_informative_status 'yes' | |
set -g __fish_git_prompt_showupstream 'verbose' | |
set -g __fish_git_prompt_char_upstream_prefix ' ' | |
__sf_util_set_default SPACEFISH_GIT_SHOW true | |
__sf_util_set_default SPACEFISH_GIT_PREFIX "" | |
__sf_util_set_default SPACEFISH_GIT_SUFFIX " " | |
# __sf_util_set_default SPACEFISH_GIT_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX | |
__sf_util_set_default SPACEFISH_GIT_SYMBOL "" | |
__sf_util_set_default SPACEFISH_GIT_BRANCH_PREFIX $SPACEFISH_GIT_SYMBOL | |
# ------------------------------------------------------------------------------ | |
# Section | |
# ------------------------------------------------------------------------------ | |
# Show both git branch and git status: | |
# spacefish_git_branch | |
# spacefish_git_status | |
[ $SPACEFISH_GIT_SHOW = false ]; and return | |
set -l git_branch (__sf_section_git_branch) | |
set -l git_status (__fish_git_prompt) | |
# string match -q -- "*$git_branch" $git_status; and set -l git_status (__fish_git_prompt_informative_status) | |
[ -z $git_branch ]; and return | |
__sf_lib_section \ | |
normal \ | |
$SPACEFISH_GIT_PREFIX \ | |
$SPACEFISH_GIT_BRANCH_PREFIX"$git_status" \ | |
$SPACEFISH_GIT_SUFFIX | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment