summaryrefslogtreecommitdiff
path: root/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_git.fish
diff options
context:
space:
mode:
Diffstat (limited to '.config/fisher/github.com/matchai/spacefish/functions/__sf_section_git.fish')
-rw-r--r--.config/fisher/github.com/matchai/spacefish/functions/__sf_section_git.fish35
1 files changed, 35 insertions, 0 deletions
diff --git a/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_git.fish b/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_git.fish
new file mode 100644
index 00000000..ea3c390e
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_git.fish
@@ -0,0 +1,35 @@
+#
+# Git
+#
+
+function __sf_section_git -d "Display the git branch and status"
+ # ------------------------------------------------------------------------------
+ # Configuration
+ # ------------------------------------------------------------------------------
+
+ __sf_util_set_default SPACEFISH_GIT_SHOW true
+ __sf_util_set_default SPACEFISH_GIT_PREFIX "on "
+ __sf_util_set_default SPACEFISH_GIT_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
+ __sf_util_set_default 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 (__sf_section_git_status)
+
+ [ -z $git_branch ]; and return
+
+ __sf_lib_section \
+ fff \
+ $SPACEFISH_GIT_PREFIX \
+ "$git_branch$git_status" \
+ $SPACEFISH_GIT_SUFFIX
+end