diff options
-rw-r--r-- | functions/icons.zsh | 7 | ||||
-rw-r--r-- | functions/vcs.zsh | 18 | ||||
-rwxr-xr-x | powerlevel9k.zsh-theme | 4 |
3 files changed, 26 insertions, 3 deletions
diff --git a/functions/icons.zsh b/functions/icons.zsh index c2565f26..3542ce81 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -69,6 +69,7 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON ' '$'\UE804 ' # VCS_GIT_ICON $'\UE20E ' # VCS_HG_ICON $'\UE1C3 ' # + VCS_SVN_ICON '(svn) ' RUST_ICON '' PYTHON_ICON $'\U1F40D' # 🐍 ) @@ -122,7 +123,8 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON ' '$'\UF204 ' # VCS_GIT_ICON $'\UF113 ' # VCS_HG_ICON $'\UF0C3 ' # - RUST_ICON $'\UE6A8' # + VCS_SVN_ICON '(svn) ' + RUST_ICON $'\UE6A8' # PYTHON_ICON $'\U1F40D' # 🐍 ) ;; @@ -175,7 +177,8 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON $'\u2192' # → VCS_GIT_ICON '' VCS_HG_ICON '' - RUST_ICON '' + VCS_SVN_ICON '' + RUST_ICON '' PYTHON_ICON '' ) ;; diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 657a0f3f..9418df81 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -113,6 +113,8 @@ function +vi-vcs-detect-changes() { vcs_visual_identifier='VCS_GIT_ICON' elif [[ "${hook_com[vcs]}" == "hg" ]]; then vcs_visual_identifier='VCS_HG_ICON' + elif [[ "${hook_com[vcs]}" == "svn" ]]; then + vcs_visual_identifier='VCS_SVN_ICON' fi if [[ -n "${hook_com[staged]}" ]] || [[ -n "${hook_com[unstaged]}" ]]; then @@ -121,3 +123,19 @@ function +vi-vcs-detect-changes() { VCS_WORKDIR_DIRTY=false fi } + +function +vi-svn-detect-changes() { + local svn_status=$(svn status) + if [[ -n "$(echo "$svn_status" | grep \^\?)" ]]; then + hook_com[unstaged]+=" $(print_icon 'VCS_UNTRACKED_ICON')" + VCS_WORKDIR_HALF_DIRTY=true + fi + if [[ -n "$(echo "$svn_status" | grep \^\M)" ]]; then + hook_com[unstaged]+=" $(print_icon 'VCS_UNSTAGED_ICON')" + VCS_WORKDIR_DIRTY=true + fi + if [[ -n "$(echo "$svn_status" | grep \^\A)" ]]; then + hook_com[staged]+=" $(print_icon 'VCS_STAGED_ICON')" + VCS_WORKDIR_DIRTY=true + fi +} diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index b9af0cfa..e81aa6f2 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -862,7 +862,7 @@ prompt_vcs() { VCS_CHANGESET_PREFIX="$(print_icon 'VCS_COMMIT_ICON')%0.$POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH""i " fi - zstyle ':vcs_info:*' enable git hg + zstyle ':vcs_info:*' enable git hg svn zstyle ':vcs_info:*' check-for-changes true VCS_DEFAULT_FORMAT="$VCS_CHANGESET_PREFIX%b%c%u%m" @@ -877,6 +877,8 @@ prompt_vcs() { zstyle ':vcs_info:git*+set-message:*' hooks $POWERLEVEL9K_VCS_GIT_HOOKS defined POWERLEVEL9K_VCS_HG_HOOKS || POWERLEVEL9K_VCS_HG_HOOKS=(vcs-detect-changes) zstyle ':vcs_info:hg*+set-message:*' hooks $POWERLEVEL9K_VCS_HG_HOOKS + defined POWERLEVEL9K_VCS_SVN_HOOKS || POWERLEVEL9K_VCS_SVN_HOOKS=(vcs-detect-changes svn-detect-changes) + zstyle ':vcs_info:svn*+set-message:*' hooks $POWERLEVEL9K_VCS_SVN_HOOKS # For Hg, only show the branch name zstyle ':vcs_info:hg*:*' branchformat "$(print_icon 'VCS_BRANCH_ICON')%b" |