From 3c49e4a5c7d9b4723e13bb7e43e1bf0eb845371e Mon Sep 17 00:00:00 2001 From: Peter Yates Date: Fri, 17 Feb 2012 09:17:03 +0000 Subject: [PATCH 1/3] Update to make the svn plugin work correctly with subversion 1.7 upwards. Subversion 1.7 centralises metadata into a single location - a single .svn directory in the project's root, rather than one for every directory in the working copy. This change utilises 'svn info' to work out whether or not the pwd is under subversion, so oh-my-zsh's svn plugin will work regardless of the svn version. --- plugins/svn/svn.plugin.zsh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index e2cf96ca3..30b21ba86 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -1,13 +1,14 @@ function svn_prompt_info { if [ $(in_svn) ]; then echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\ -$ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR" +$ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name):$(svn_get_rev_nr)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR" fi } function in_svn() { - if [[ -d .svn ]]; then + info=$(svn info 2> /dev/null) || return + if [ $info ]; then echo 1 fi } From 7f8217294cce60cf425e7d34ae1719309a8f171b Mon Sep 17 00:00:00 2001 From: Peter Yates Date: Mon, 20 Feb 2012 14:57:05 +0000 Subject: [PATCH 2/3] Make the branch display correctly --- plugins/svn/svn.plugin.zsh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index 30b21ba86..3c26d0bfb 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -1,7 +1,7 @@ function svn_prompt_info { if [ $(in_svn) ]; then echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\ -$ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name):$(svn_get_rev_nr)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR" +$ZSH_THEME_REPO_NAME_COLOR$(svn_get_branch_name):$(svn_get_rev_nr)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR" fi } @@ -21,6 +21,14 @@ function svn_get_repo_name { fi } +function svn_get_branch_name { + if [ $(in_svn) ]; then + svn info | sed -n 's/URL:\ .*\///p' | read SVN_URL + + basename $SVN_URL + fi +} + function svn_get_rev_nr { if [ $(in_svn) ]; then svn info 2> /dev/null | sed -n s/Revision:\ //p From 396755f04456dfc75979fd3ccc1f81f6a5a07af3 Mon Sep 17 00:00:00 2001 From: Peter Yates Date: Sat, 10 Mar 2012 11:25:10 +0000 Subject: [PATCH 3/3] Updates to style and svn plugin (correct branch display) --- .gitmodules | 3 +++ lib/theme-and-appearance.zsh | 2 +- plugins/ls_colors | 1 + plugins/svn/svn.plugin.zsh | 13 ++----------- plugins/zsh-syntax-highlighting | 1 + themes/maran.zsh-theme | 7 ++++++- 6 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 .gitmodules create mode 160000 plugins/ls_colors create mode 160000 plugins/zsh-syntax-highlighting diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..0a81941f2 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "plugins/zsh-syntax-highlighting"] + path = plugins/zsh-syntax-highlighting + url = https://github.com/zsh-users/zsh-syntax-highlighting.git diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index aec67721a..92ccd1c1d 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -1,6 +1,6 @@ # ls colors autoload colors; colors; -export LSCOLORS="Gxfxcxdxbxegedabagacad" +#export LSCOLORS="Gxfxcxdxbxegedabagacad" #export LS_COLORS # Enable ls colors diff --git a/plugins/ls_colors b/plugins/ls_colors new file mode 160000 index 000000000..093797575 --- /dev/null +++ b/plugins/ls_colors @@ -0,0 +1 @@ +Subproject commit 0937975751f0a957228c3fbb4d6b4a181d40f073 diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index 3c26d0bfb..89b00dd4b 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -13,19 +13,10 @@ function in_svn() { fi } -function svn_get_repo_name { - if [ $(in_svn) ]; then - svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT - - svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//" - fi -} - function svn_get_branch_name { if [ $(in_svn) ]; then - svn info | sed -n 's/URL:\ .*\///p' | read SVN_URL - - basename $SVN_URL + svn info | grep '^URL:' | egrep -o '(tags|branches)/[^/]+|trunk' | egrep -o '[^/]+$' | read SVN_URL + echo $SVN_URL fi } diff --git a/plugins/zsh-syntax-highlighting b/plugins/zsh-syntax-highlighting new file mode 160000 index 000000000..bb0d57594 --- /dev/null +++ b/plugins/zsh-syntax-highlighting @@ -0,0 +1 @@ +Subproject commit bb0d575942760fe483790fe878ea43b1f781e2ca diff --git a/themes/maran.zsh-theme b/themes/maran.zsh-theme index 6fba04688..cc66770ef 100644 --- a/themes/maran.zsh-theme +++ b/themes/maran.zsh-theme @@ -1,6 +1,11 @@ # Theme with full path names and hostname # Handy if you work on different servers all the time; -PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@%{$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) ' +PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@%{$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%}%{$fg[cyan]%}$(svn_prompt_info)%{$reset_color%}$(git_prompt_info)%(!.#.%{$fg[yellow]%}$%{$reset_color%}) ' ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}git:(" ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" + +ZSH_THEME_SVN_PROMPT_PREFIX=" svn:(" +ZSH_THEME_SVN_PROMPT_SUFFIX=")" +ZSH_THEME_SVN_PROMPT_DIRTY="%{$fg[red]%}!%{$reset_color%}" +ZSH_THEME_SVN_PROMPT_CLEAN=""