diff options
Diffstat (limited to 'functions')
-rw-r--r-- | functions/utilities.zsh | 3 | ||||
-rw-r--r-- | functions/vcs.zsh | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/functions/utilities.zsh b/functions/utilities.zsh index dcbca3c6..5ca5b431 100644 --- a/functions/utilities.zsh +++ b/functions/utilities.zsh @@ -27,6 +27,9 @@ function set_default() { } # Converts large memory values into a human-readable unit (e.g., bytes --> GB) +# Takes two arguments: +# * $size - The number which should be prettified +# * $base - The base of the number (default Bytes) printSizeHumanReadable() { typeset -F 2 size size="$1"+0.00001 diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 3eec5dfd..7f0b9dea 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -6,13 +6,18 @@ # https://github.com/bhilburn/powerlevel9k ################################################################ +set_default POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY true function +vi-git-untracked() { + # TODO: check git >= 1.7.2 - see function git_compare_version() local FLAGS FLAGS=('--porcelain') - # TODO: check git >= 1.7.2 - see function git_compare_version() - FLAGS+='--ignore-submodules=dirty' + + if [[ "$POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY" == "false" ]]; then + FLAGS+='--ignore-submodules=dirty' + fi + if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' && \ - -n $(git status ${FLAGS} | grep '^??' 2> /dev/null | tail -n1) ]]; then + -n $(git status ${FLAGS} | grep -E '^??' 2> /dev/null | tail -n1) ]]; then hook_com[unstaged]+=" %F{$POWERLEVEL9K_VCS_FOREGROUND}$(print_icon 'VCS_UNTRACKED_ICON')%f" VCS_WORKDIR_HALF_DIRTY=true else |