From fd4454502e7718cb224f636860ddd5133f6e388f Mon Sep 17 00:00:00 2001 From: Marin Marusic Date: Sun, 29 Sep 2013 13:19:22 +0200 Subject: [PATCH 1/6] =?UTF-8?q?Changed=20git.plugin.zsh=20>=20added=20an?= =?UTF-8?q?=20in=5Fgit=20function=20Added=20a=20netpunk.zsh-theme=20?= =?UTF-8?q?=E2=80=A6=20displays=20battery=20charge=20remaining=20using=20b?= =?UTF-8?q?atcharge.py,=20date,=20ruby=20version=20via=20rbenv,=20points?= =?UTF-8?q?=20out=20werther=20you're=20in=20a=20GIT=20or=20HG=20repository?= =?UTF-8?q?,=20has=20improved=20HG=20functions,=20but=20requires=20hg=20pl?= =?UTF-8?q?ugins=20prompt,=20tasks=20and=20mq.=20I=20built=20it,=20and=20n?= =?UTF-8?q?ow=20it's=20up=20for=20grabs=20:)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/git/git.plugin.zsh | 7 +++++ themes/netpunk.zsh-theme | 52 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 themes/netpunk.zsh-theme diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index d8ea3ae0c..50f443e9b 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -97,6 +97,13 @@ compdef git-svn-dcommit-push=git alias gsr='git svn rebase' alias gsd='git svn dcommit' + +function in_git { + if $(git status > /dev/null 2>&1); then + echo 1 + fi +} + # # Will return the current branch name # Usage example: git pull origin $(current_branch) diff --git a/themes/netpunk.zsh-theme b/themes/netpunk.zsh-theme new file mode 100644 index 000000000..fb985a83a --- /dev/null +++ b/themes/netpunk.zsh-theme @@ -0,0 +1,52 @@ +function prompt_char { + git branch >/dev/null 2>/dev/null && echo 'GIT ☢ ↪' && return + hg root >/dev/null 2>/dev/null && echo 'HG ☢ ↪' && return + echo ' ☣ ↪' +} +function battery_charge() { + if [ -e /usr/local/bin/batcharge.py ] + then + echo `python /usr/local/bin/batcharge.py` + else + echo ''; + fi +} + +function hg_prompt_info { + if [ $(in_hg) ]; then + hg prompt "{rev}:{node|short} on {root|basename}:{branch} {task} {status|modified} {patch|count|unapplied} {incoming changes{incoming|count}} {update}" 2>/dev/null + fi +} + +function get_pwd() { + echo "${PWD/$HOME/~}" +} + +function virtualenv_info { + [ $VIRTUAL_ENV ] && echo '('on `basename $VIRTUAL_ENV`') ' +} +function spacing { + local spacing="" + for i in {1..$termwidth}; do + spacing="${spacing} " + done + echo $spacing +} +function collapse_pwd { + echo $(pwd | sed -e "s,^$HOME,~,") +} + +if which rbenv &> /dev/null; then + PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%} %~ %{$reset_color%}$(hg_prompt_info)$(git_prompt_info)%{$reset_color%} + $(prompt_char) ' + RPROMPT='using %{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%}$(virtualenv_info) %{$fg[magenta]%}$(date "+%Y-%m-%d")%{$reset_color%} BAT: $(battery_charge)' + +fi + + + +ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%} " +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[white]%}%{$bg[red]%} ✖ " +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[white]%}%{$bg[magenta]%} ◘ " +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ✔ " From 8e53e2e5a1e2fb538a9e578b13f3389543b01e6b Mon Sep 17 00:00:00 2001 From: Marin Marusic Date: Sun, 29 Sep 2013 13:36:44 +0200 Subject: [PATCH 2/6] =?UTF-8?q?done=20a=20bit=20of=20refactoring,=20moved?= =?UTF-8?q?=20out=20some=20stuff=20I=20don't=20need=20like=20virtual=5Fenv?= =?UTF-8?q?=20checks=20and=20so=20on.=20Also=20put=20up=20a=20header=20and?= =?UTF-8?q?=20license=20(MIT)=20=E2=80=A6=20'tis=20changeable=20to=20=20wh?= =?UTF-8?q?atever=20as=20long=20as=20it's=20free=20to=20use/modify/redistr?= =?UTF-8?q?ibute.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/netpunk.zsh-theme | 41 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/themes/netpunk.zsh-theme b/themes/netpunk.zsh-theme index fb985a83a..3b42d8714 100644 --- a/themes/netpunk.zsh-theme +++ b/themes/netpunk.zsh-theme @@ -1,9 +1,24 @@ +## +# Developed by NETPUNK#, software services +# http://www.netpunk.net (not up ATM) +# +# License: MIT +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +## + function prompt_char { git branch >/dev/null 2>/dev/null && echo 'GIT ☢ ↪' && return hg root >/dev/null 2>/dev/null && echo 'HG ☢ ↪' && return - echo ' ☣ ↪' + echo ' ☢ ↪' } -function battery_charge() { +function battery_charge { if [ -e /usr/local/bin/batcharge.py ] then echo `python /usr/local/bin/batcharge.py` @@ -18,33 +33,13 @@ function hg_prompt_info { fi } -function get_pwd() { - echo "${PWD/$HOME/~}" -} - -function virtualenv_info { - [ $VIRTUAL_ENV ] && echo '('on `basename $VIRTUAL_ENV`') ' -} -function spacing { - local spacing="" - for i in {1..$termwidth}; do - spacing="${spacing} " - done - echo $spacing -} -function collapse_pwd { - echo $(pwd | sed -e "s,^$HOME,~,") -} - if which rbenv &> /dev/null; then PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%} %~ %{$reset_color%}$(hg_prompt_info)$(git_prompt_info)%{$reset_color%} $(prompt_char) ' - RPROMPT='using %{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%}$(virtualenv_info) %{$fg[magenta]%}$(date "+%Y-%m-%d")%{$reset_color%} BAT: $(battery_charge)' + RPROMPT='using %{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%} %{$fg[magenta]%}$(date "+%Y-%m-%d")%{$reset_color%} BAT: $(battery_charge)' fi - - ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%} " ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[white]%}%{$bg[red]%} ✖ " From a28e653d570589e3b7c7176e59be4d951690b63f Mon Sep 17 00:00:00 2001 From: Marin Marusic Date: Sun, 29 Sep 2013 14:02:36 +0200 Subject: [PATCH 3/6] - added rvm support - hg prompt counts only unapplied patches and incoming does only count, not display the incoming changes --- themes/netpunk.zsh-theme | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/themes/netpunk.zsh-theme b/themes/netpunk.zsh-theme index 3b42d8714..cd740abe2 100644 --- a/themes/netpunk.zsh-theme +++ b/themes/netpunk.zsh-theme @@ -29,14 +29,17 @@ function battery_charge { function hg_prompt_info { if [ $(in_hg) ]; then - hg prompt "{rev}:{node|short} on {root|basename}:{branch} {task} {status|modified} {patch|count|unapplied} {incoming changes{incoming|count}} {update}" 2>/dev/null + hg prompt "{rev}:{node|short} on {root|basename}/{branch} {task} {status} {update} {patch|count|unapplied} {incoming changes{incoming}} " 2>/dev/null fi } - -if which rbenv &> /dev/null; then +if which rvm-prompt &> /dev/null; then PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%} %~ %{$reset_color%}$(hg_prompt_info)$(git_prompt_info)%{$reset_color%} $(prompt_char) ' - RPROMPT='using %{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%} %{$fg[magenta]%}$(date "+%Y-%m-%d")%{$reset_color%} BAT: $(battery_charge)' + RPROMPT='%{$fg[red]%}RB $(~/.rvm/bin/rvm-prompt)%{$reset_color%} %{$fg[magenta]%}$(date "+%Y-%m-%d")%{$reset_color%} %{$fg[green]%} BAT: %{$reset_color%} $(battery_charge)' +elif which rbenv &> /dev/null; then + PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%} %~ %{$reset_color%}$(hg_prompt_info)$(git_prompt_info)%{$reset_color%} + $(prompt_char) ' + RPROMPT='%{$fg[red]%}RB $(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%} %{$fg[magenta]%}$(date "+%Y-%m-%d")%{$reset_color%} %{$fg[green]%} BAT: %{$reset_color%} $(battery_charge)' fi From 473dc4eeb017f7ce6c7057da588bf39337beb4be Mon Sep 17 00:00:00 2001 From: Marin Marusic Date: Sun, 29 Sep 2013 14:04:34 +0200 Subject: [PATCH 4/6] - forgot to save the incoming|count part --- themes/netpunk.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/netpunk.zsh-theme b/themes/netpunk.zsh-theme index cd740abe2..249edd9ec 100644 --- a/themes/netpunk.zsh-theme +++ b/themes/netpunk.zsh-theme @@ -29,7 +29,7 @@ function battery_charge { function hg_prompt_info { if [ $(in_hg) ]; then - hg prompt "{rev}:{node|short} on {root|basename}/{branch} {task} {status} {update} {patch|count|unapplied} {incoming changes{incoming}} " 2>/dev/null + hg prompt "{rev}:{node|short} on {root|basename}/{branch} {task} {status} {update} {patch|count|unapplied} {incoming changes{incoming|count}} " 2>/dev/null fi } if which rvm-prompt &> /dev/null; then From 2ffe60ac85a7aff438de53690866840e3f45d81e Mon Sep 17 00:00:00 2001 From: Marin Marusic Date: Tue, 22 Oct 2013 11:54:50 +0200 Subject: [PATCH 5/6] n3tpunk edit --- plugins/battery/battery.plugin.zsh | 2 +- plugins/cp/cp.plugin.zsh | 2 +- plugins/mercurial/mercurial.plugin.zsh | 2 +- themes/netpunk.zsh-theme | 40 ++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 themes/netpunk.zsh-theme diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh index 66bf46d13..42fc61f04 100644 --- a/plugins/battery/battery.plugin.zsh +++ b/plugins/battery/battery.plugin.zsh @@ -46,7 +46,7 @@ if [[ $(uname) == "Darwin" ]] ; then fi echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}" else - echo "∞" + echo "⚡" fi } diff --git a/plugins/cp/cp.plugin.zsh b/plugins/cp/cp.plugin.zsh index 7355a9990..231759efc 100644 --- a/plugins/cp/cp.plugin.zsh +++ b/plugins/cp/cp.plugin.zsh @@ -11,4 +11,4 @@ # -e /dev/null - only work on local files # -- - everything after this is an argument, even if it looks like an option -alias cpv="rsync -poghb --backup-dir=/tmp/rsync -e /dev/null --progress --" +alias cpv="rsync -phb --backup-dir=/tmp/rsync -e /dev/null --progress --" diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index c18aa726c..399ffa440 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -32,7 +32,7 @@ function hg_prompt_info { if [ $(in_hg) ]; then _DISPLAY=$(hg_get_branch_name) echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_PREFIX\ -$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(hg_dirty)$ZSH_PROMPT_BASE_COLOR" +$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR $fg_bold[red]%}$(hgic)%{$reset_color%}%{$fg_bold[blue]%}$(hgoc)%{$reset_color%}$ZSH_THEME_HG_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(hg_dirty)$ZSH_PROMPT_BASE_COLOR" unset _DISPLAY fi } diff --git a/themes/netpunk.zsh-theme b/themes/netpunk.zsh-theme new file mode 100644 index 000000000..ec1a1f64c --- /dev/null +++ b/themes/netpunk.zsh-theme @@ -0,0 +1,40 @@ +## +# Developed by NETPUNK#, software services +# http://www.netpunk.net (not up ATM) +# +# Depends on rbenv/rvm, git, mercurial and battery plugins +# +# License: MIT +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +## + + +function prompt_char { + git branch >/dev/null 2>/dev/null && echo 'GIT ☢ ↪' && return + hg root >/dev/null 2>/dev/null && echo 'HG ☢ ↪' && return + echo ' ☢ ↪' +} + +if which rvm-prompt &> /dev/null; then + PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%} %~ %{$reset_color%}$(hg_prompt_info)$(git_prompt_info)%{$reset_color%} + $(prompt_char) ' + RPROMPT='%{$fg[red]%}RB $(~/.rvm/bin/rvm-prompt)%{$reset_color%} %{$fg[magenta]%}$(date "+%Y-%m-%d")%{$reset_color%} %{$fg[green]%} BAT: %{$reset_color%} $(battery_charge)' +elif which rbenv &> /dev/null; then + PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%} %~ %{$reset_color%}$(hg_prompt_info)$(git_prompt_info)%{$reset_color%} + $(prompt_char) ' + RPROMPT='%{$fg[red]%}RB $(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%} %{$fg[magenta]%}$(date "+%Y-%m-%d")%{$reset_color%} $(battery_pct_prompt)' + +fi + +ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%} " +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[white]%}%{$bg[red]%} ✖ " +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[white]%}%{$bg[magenta]%} ◘ " +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ✔ " From 3a8912529b6206965d766c806cd833ac5ee11722 Mon Sep 17 00:00:00 2001 From: Marin Marusic Date: Tue, 22 Oct 2013 12:52:31 +0200 Subject: [PATCH 6/6] nest nest --- themes/netpunk.zsh-theme | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/themes/netpunk.zsh-theme b/themes/netpunk.zsh-theme index 638044c58..ec1a1f64c 100644 --- a/themes/netpunk.zsh-theme +++ b/themes/netpunk.zsh-theme @@ -2,11 +2,8 @@ # Developed by NETPUNK#, software services # http://www.netpunk.net (not up ATM) # -<<<<<<< HEAD # Depends on rbenv/rvm, git, mercurial and battery plugins # -======= ->>>>>>> 473dc4eeb017f7ce6c7057da588bf39337beb4be # License: MIT # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR @@ -18,33 +15,13 @@ # THE SOFTWARE. ## -<<<<<<< HEAD -======= ->>>>>>> 473dc4eeb017f7ce6c7057da588bf39337beb4be function prompt_char { git branch >/dev/null 2>/dev/null && echo 'GIT ☢ ↪' && return hg root >/dev/null 2>/dev/null && echo 'HG ☢ ↪' && return echo ' ☢ ↪' } -<<<<<<< HEAD -======= -function battery_charge { - if [ -e /usr/local/bin/batcharge.py ] - then - echo `python /usr/local/bin/batcharge.py` - else - echo ''; - fi -} - -function hg_prompt_info { - if [ $(in_hg) ]; then - hg prompt "{rev}:{node|short} on {root|basename}/{branch} {task} {status} {update} {patch|count|unapplied} {incoming changes{incoming|count}} " 2>/dev/null - fi -} ->>>>>>> 473dc4eeb017f7ce6c7057da588bf39337beb4be if which rvm-prompt &> /dev/null; then PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%} %~ %{$reset_color%}$(hg_prompt_info)$(git_prompt_info)%{$reset_color%} $(prompt_char) ' @@ -52,11 +29,7 @@ if which rvm-prompt &> /dev/null; then elif which rbenv &> /dev/null; then PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%} %~ %{$reset_color%}$(hg_prompt_info)$(git_prompt_info)%{$reset_color%} $(prompt_char) ' -<<<<<<< HEAD RPROMPT='%{$fg[red]%}RB $(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%} %{$fg[magenta]%}$(date "+%Y-%m-%d")%{$reset_color%} $(battery_pct_prompt)' -======= - RPROMPT='%{$fg[red]%}RB $(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%} %{$fg[magenta]%}$(date "+%Y-%m-%d")%{$reset_color%} %{$fg[green]%} BAT: %{$reset_color%} $(battery_charge)' ->>>>>>> 473dc4eeb017f7ce6c7057da588bf39337beb4be fi