From 21fd31d52bc1c2dd8b90f81a560a0bf16556b8db Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Wed, 13 Nov 2013 17:21:04 +0100 Subject: [Prompt] Trick or treat ? --- net:foret/Internal.zsh | 22 ++++++++++++++++++++++ net:foret/Prompts.zsh | 23 ----------------------- 2 files changed, 22 insertions(+), 23 deletions(-) create mode 100644 net:foret/Internal.zsh diff --git a/net:foret/Internal.zsh b/net:foret/Internal.zsh new file mode 100644 index 0000000..3bf6c65 --- /dev/null +++ b/net:foret/Internal.zsh @@ -0,0 +1,22 @@ + +__get_git_fullstatus () +{ + [ -n "$1" ] && pushd $1 >/dev/null + + local _branch _status _tracking _stashes + + _branch=$(__get_git_branch) + + if [ -n "$_branch" ] + then + _status=$(__get_git_branch_status) + _branch=$C_$_prompt_colors[soft_generic]$_C${${_branch/→/$C_$_status$_C}/←/$C_$_prompt_colors[soft_generic]$_C}$C_$color[none]$_C + _tracking=$(__get_git_tracking_status) + _stashes=$(__get_git_stashes) + fi + + [ -n "$1" ] && popd >/dev/null + + echo $_branch${_tracking:+ $_tracking}${_stashes:+ $_stashes} | sed 's/_for_\(ixm\|df\)/’/g' + +} diff --git a/net:foret/Prompts.zsh b/net:foret/Prompts.zsh index ec93403..a7d6722 100644 --- a/net:foret/Prompts.zsh +++ b/net:foret/Prompts.zsh @@ -82,26 +82,3 @@ __makeflags () PS1_TASKBAR+=(__makeflags __verbose_compilation __nproc_compilation __static_dynamic __compilation_os __compilation_arch __compilation_target) PS1_EXTRA_INFO+=() - -__subvcsbranches () { - local GITBRANCH - - GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) - [ "$( ( git ls-files ; git ls-tree HEAD . ) 2>&- | head -n1)" = "" -a \ - \( ! -d .git -o -z "$GIT_DIR" \) -a \ - "$(git rev-parse --is-inside-git-dir 2>&-)" != "true" ] && return - - # Get recursive submodules statuses - for SUBMODULE in $(git config --get zsh.recurse-dirs) - do - if [ -d $(dirname $GIT_DIR)/$SUBMODULE ] - then - GITBRANCH+=${GITBRANCH:+$(tput cuf1)} - GITBRANCH+=$C_$_prompt_colors[bar]$_C"[%{%B%}$SUBMODULE%{%b%}:" - GITBRANCH+=$(__get_git_fullstatus $(dirname $GIT_DIR)/$SUBMODULE | sed 's/_for_\(ixm\|df\)/’/g') - GITBRANCH+=$C_$_prompt_colors[bar]$_C"]" - fi - done - echo $GITBRANCH - -} -- cgit v1.2.3