From d917381b7c3b6ea98da1b292ac6822fb7796d811 Mon Sep 17 00:00:00 2001 From: JuanPablo Date: Sun, 12 Jun 2011 11:58:57 -0400 Subject: [PATCH 01/13] add Makefile for install with ln --- Makefile | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..8e683ab09 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +install: + [ -f $(HOME)/.oh-my-zsh ] || ln -v -s $(PWD) $(HOME)/.oh-my-zsh + [ -f $(HOME)/.zshrc ] || ln -v -s $(PWD)/templates/zshrc.zsh-template $(HOME)/.zshrc From 97323235dd9f54c6786fa108d0ad518310544031 Mon Sep 17 00:00:00 2001 From: JuanPablo Date: Sun, 31 Jul 2011 21:02:02 -0400 Subject: [PATCH 02/13] Makefile condicional a directorio --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8e683ab09..bd264eb8c 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,3 @@ install: - [ -f $(HOME)/.oh-my-zsh ] || ln -v -s $(PWD) $(HOME)/.oh-my-zsh + [ -d $(HOME)/.oh-my-zsh ] || ln -v -s $(PWD) $(HOME)/.oh-my-zsh [ -f $(HOME)/.zshrc ] || ln -v -s $(PWD)/templates/zshrc.zsh-template $(HOME)/.zshrc From 2e635f36976ebfbb9db9dcbccce1fd93003e5ac7 Mon Sep 17 00:00:00 2001 From: JuanPablo Date: Mon, 1 Aug 2011 01:04:15 -0400 Subject: [PATCH 03/13] added pixelmuerto theme + git_remote function --- themes/pixelmuerto.zsh-theme | 64 ++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 themes/pixelmuerto.zsh-theme diff --git a/themes/pixelmuerto.zsh-theme b/themes/pixelmuerto.zsh-theme new file mode 100644 index 000000000..175113e89 --- /dev/null +++ b/themes/pixelmuerto.zsh-theme @@ -0,0 +1,64 @@ +# inspirated in { kolo alanpeabody microtech }.zsh-theme +autoload -U colors && colors + +autoload -Uz vcs_info + +local localDate='%{$fg[white]%}$(date +%H:%M)%{$reset_color%}' +local userHost= #'[%n@%m] ' + +zstyle ':vcs_info:*' stagedstr '%F{green}●' +zstyle ':vcs_info:*' unstagedstr '%F{yellow}●' +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r' +zstyle ':vcs_info:*' enable git svn + +# check remote branch +function git_remotes() { + remotes="" + if [[ -d .git ]]; then + if [[ $(git branch | awk '{ print $2}') == "master" ]]; then + git_dir="$PWD/.git" + fetchUpdate=3600 + remotes=() + for remote in $(git remote) + do + if [[ ! -e $git_dir/FETCH_HEAD ]]; then + ( git fetch $remote >& /dev/null &) + else + # with date (GNU coreutils) + fetchDate=$(date --utc --reference=$git_dir/FETCH_HEAD +%s) + now=$(date --utc +%s) + delta=$(( $now - $fetchDate )) + # if last update to .git/FETCH_HEAD file + if [[ $delta -gt $fetchUpdate ]]; then + ( git fetch $remote >& /dev/null &) + fi + fi + if [[ $(git branch -a | grep $remote) != "" ]]; then + nRemoteCommit=$(git log --oneline HEAD..$remote/master | wc -l) + if [[ -f $git_dir/FETCH_HEAD && $nRemoteCommit != "0" ]]; then + remotes+=" "${remote/origin/o}:$nRemoteCommit + fi + else + (git fetch $remote >& /dev/null &) + fi + done + fi + fi + echo $remotes +} +local remotes='%B%F{blue}$(git_remotes)%{$reset_color%}' + +precmd () { + if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] { + zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{white}]' + } else { + zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{red}●%F{white}]' + } + + vcs_info +} + +setopt prompt_subst +PROMPT='%B%F{white}${userHost}%~%B%F{white}${vcs_info_msg_0_}%B%F{magenta}%{$reset_color%}$ ' +RPROMPT="${remotes} ${localDate}" From ab0284b508c4ebb2e2adea4a9f67640fb68a0e03 Mon Sep 17 00:00:00 2001 From: JuanPablo Date: Wed, 3 Aug 2011 15:21:03 -0400 Subject: [PATCH 04/13] change utf8 symbols for screen terminal --- themes/pixelmuerto.zsh-theme | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/themes/pixelmuerto.zsh-theme b/themes/pixelmuerto.zsh-theme index 175113e89..7637286d9 100644 --- a/themes/pixelmuerto.zsh-theme +++ b/themes/pixelmuerto.zsh-theme @@ -6,8 +6,8 @@ autoload -Uz vcs_info local localDate='%{$fg[white]%}$(date +%H:%M)%{$reset_color%}' local userHost= #'[%n@%m] ' -zstyle ':vcs_info:*' stagedstr '%F{green}●' -zstyle ':vcs_info:*' unstagedstr '%F{yellow}●' +zstyle ':vcs_info:*' stagedstr '%F{green}+' +zstyle ':vcs_info:*' unstagedstr '%F{yellow}*' zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r' zstyle ':vcs_info:*' enable git svn @@ -17,7 +17,7 @@ function git_remotes() { remotes="" if [[ -d .git ]]; then if [[ $(git branch | awk '{ print $2}') == "master" ]]; then - git_dir="$PWD/.git" + git_dir=$(git rev-parse --git-dir) fetchUpdate=3600 remotes=() for remote in $(git remote) @@ -51,14 +51,14 @@ local remotes='%B%F{blue}$(git_remotes)%{$reset_color%}' precmd () { if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] { - zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{white}]' + zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]' } else { - zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{red}●%F{white}]' + zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{red}?%F{green}]' } vcs_info } setopt prompt_subst -PROMPT='%B%F{white}${userHost}%~%B%F{white}${vcs_info_msg_0_}%B%F{magenta}%{$reset_color%}$ ' +PROMPT='%B%F{white}${userHost}%~%B%F{green}${vcs_info_msg_0_}%B%F{magenta}%{$reset_color%}$ ' RPROMPT="${remotes} ${localDate}" From 185eb8f8079649906d56c52c6f244c3d2007caa4 Mon Sep 17 00:00:00 2001 From: JuanPablo Date: Wed, 3 Aug 2011 17:55:53 -0400 Subject: [PATCH 05/13] git_dir from rev-parse --git-dir --- themes/pixelmuerto.zsh-theme | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/pixelmuerto.zsh-theme b/themes/pixelmuerto.zsh-theme index 7637286d9..dc89fde15 100644 --- a/themes/pixelmuerto.zsh-theme +++ b/themes/pixelmuerto.zsh-theme @@ -12,12 +12,12 @@ zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r' zstyle ':vcs_info:*' enable git svn -# check remote branch +# check new commits in remote branchs function git_remotes() { + git_dir=$(git rev-parse --git-dir 2> /dev/null ) || return remotes="" - if [[ -d .git ]]; then + if [[ -n $git_dir ]]; then if [[ $(git branch | awk '{ print $2}') == "master" ]]; then - git_dir=$(git rev-parse --git-dir) fetchUpdate=3600 remotes=() for remote in $(git remote) @@ -47,7 +47,7 @@ function git_remotes() { fi echo $remotes } -local remotes='%B%F{blue}$(git_remotes)%{$reset_color%}' +local remotes='%B%F{green}$(git_remotes)%{$reset_color%}' precmd () { if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] { From a2ab3b857072bdcd8d6f589ea281e0d5d53c01ef Mon Sep 17 00:00:00 2001 From: JuanPablo Date: Wed, 3 Aug 2011 19:16:23 -0400 Subject: [PATCH 06/13] return of utf8 colors dot --- themes/pixelmuerto.zsh-theme | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/pixelmuerto.zsh-theme b/themes/pixelmuerto.zsh-theme index dc89fde15..107fd89fc 100644 --- a/themes/pixelmuerto.zsh-theme +++ b/themes/pixelmuerto.zsh-theme @@ -6,8 +6,8 @@ autoload -Uz vcs_info local localDate='%{$fg[white]%}$(date +%H:%M)%{$reset_color%}' local userHost= #'[%n@%m] ' -zstyle ':vcs_info:*' stagedstr '%F{green}+' -zstyle ':vcs_info:*' unstagedstr '%F{yellow}*' +zstyle ':vcs_info:*' stagedstr '%F{green}●' +zstyle ':vcs_info:*' unstagedstr '%F{yellow}●' zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r' zstyle ':vcs_info:*' enable git svn @@ -53,7 +53,7 @@ precmd () { if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] { zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]' } else { - zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{red}?%F{green}]' + zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{red}●%F{green}]' } vcs_info From 651720a8334165f2d4a9e6d0c073154f60acfe47 Mon Sep 17 00:00:00 2001 From: JuanPablo Date: Fri, 5 Aug 2011 02:26:04 -0400 Subject: [PATCH 07/13] un~ ; un recordatorio de push necesario --- .gitignore | 1 + themes/pixelmuerto.zsh-theme | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 2e8db7341..ee26199aa 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ custom/* !custom/example.zsh cache *.swp +*un~ diff --git a/themes/pixelmuerto.zsh-theme b/themes/pixelmuerto.zsh-theme index 107fd89fc..3614167f4 100644 --- a/themes/pixelmuerto.zsh-theme +++ b/themes/pixelmuerto.zsh-theme @@ -47,6 +47,7 @@ function git_remotes() { fi echo $remotes } +# TODO if commits to push show this number local remotes='%B%F{green}$(git_remotes)%{$reset_color%}' precmd () { From 4dfc1a087ca6448f91f3323ea6caf92157ff3be1 Mon Sep 17 00:00:00 2001 From: JuanPablo Date: Fri, 5 Aug 2011 13:31:38 -0400 Subject: [PATCH 08/13] remember add arrow --- themes/pixelmuerto.zsh-theme | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/pixelmuerto.zsh-theme b/themes/pixelmuerto.zsh-theme index 3614167f4..831c38d00 100644 --- a/themes/pixelmuerto.zsh-theme +++ b/themes/pixelmuerto.zsh-theme @@ -48,6 +48,7 @@ function git_remotes() { echo $remotes } # TODO if commits to push show this number +# TODO show arrow when push is necessary local remotes='%B%F{green}$(git_remotes)%{$reset_color%}' precmd () { From e7b4dac58d95d37d20a8644970d7646d7f342244 Mon Sep 17 00:00:00 2001 From: JuanPablo Date: Sun, 7 Aug 2011 16:29:55 -0400 Subject: [PATCH 09/13] show arrow when exist local commits to push --- themes/pixelmuerto.zsh-theme | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/themes/pixelmuerto.zsh-theme b/themes/pixelmuerto.zsh-theme index 831c38d00..21694af7a 100644 --- a/themes/pixelmuerto.zsh-theme +++ b/themes/pixelmuerto.zsh-theme @@ -1,4 +1,5 @@ -# inspirated in { kolo alanpeabody microtech }.zsh-theme +# inspirated in { kolo alanpeabody nanotech }.zsh-theme +# inspirated in https://github.com/lvv/git-prompt autoload -U colors && colors autoload -Uz vcs_info @@ -43,12 +44,12 @@ function git_remotes() { (git fetch $remote >& /dev/null &) fi done + pushed=$(git log --oneline origin/master..HEAD | wc -l ) + [ "$pushed" -gt "0" ] && remotes+="↑:"$pushed fi fi echo $remotes } -# TODO if commits to push show this number -# TODO show arrow when push is necessary local remotes='%B%F{green}$(git_remotes)%{$reset_color%}' precmd () { From 62d6014d1461f770961657c477874b1dd6e4ba10 Mon Sep 17 00:00:00 2001 From: Bradley Priest Date: Sun, 14 Aug 2011 20:35:03 +1200 Subject: [PATCH 10/13] Added a z plugin https://github.com/rupa/z --- plugins/z/z.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 plugins/z/z.plugin.zsh diff --git a/plugins/z/z.plugin.zsh b/plugins/z/z.plugin.zsh new file mode 100644 index 000000000..f31ccd576 --- /dev/null +++ b/plugins/z/z.plugin.zsh @@ -0,0 +1,6 @@ +if [ -f `brew --prefix`/etc/profile.d/z.sh ]; then + . `brew --prefix`/etc/profile.d/z.sh + function precmd () { + z --add "$(pwd -P)" + } +fi From a4591962aa7baf661bb44390fac45909389d689a Mon Sep 17 00:00:00 2001 From: JuanPablo Date: Tue, 16 Aug 2011 17:34:05 -0400 Subject: [PATCH 11/13] if exist brew add z --- plugins/z/z.plugin.zsh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/z/z.plugin.zsh b/plugins/z/z.plugin.zsh index f31ccd576..c970fd585 100644 --- a/plugins/z/z.plugin.zsh +++ b/plugins/z/z.plugin.zsh @@ -1,6 +1,8 @@ -if [ -f `brew --prefix`/etc/profile.d/z.sh ]; then - . `brew --prefix`/etc/profile.d/z.sh - function precmd () { - z --add "$(pwd -P)" - } +if [ $( which brew ) ]; then + if [ -f `brew --prefix`/etc/profile.d/z.sh ]; then + . `brew --prefix`/etc/profile.d/z.sh + function precmd () { + z --add "$(pwd -P)" + } + fi fi From b39770cc89ab56a06d5fb4c01b37a15a08cd15ac Mon Sep 17 00:00:00 2001 From: JuanPablo Date: Fri, 2 Sep 2011 20:25:49 -0300 Subject: [PATCH 12/13] show new commits in submodules --- themes/pixelmuerto.zsh-theme | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/themes/pixelmuerto.zsh-theme b/themes/pixelmuerto.zsh-theme index 21694af7a..9fac1c2cb 100644 --- a/themes/pixelmuerto.zsh-theme +++ b/themes/pixelmuerto.zsh-theme @@ -45,7 +45,10 @@ function git_remotes() { fi done pushed=$(git log --oneline origin/master..HEAD | wc -l ) - [ "$pushed" -gt "0" ] && remotes+="↑:"$pushed + [ "$pushed" -gt "0" ] && remotes+=" ↑:"$pushed + # submodules commints + submod=$(git status | grep "new commits" | wc -l) + [ "$submod" -gt "0" ] && remotes+=" _:"$submod fi fi echo $remotes From b72a37528c2a54309e2fbca1bd57e36eeb9d28ce Mon Sep 17 00:00:00 2001 From: JuanPablo Date: Tue, 13 Sep 2011 12:56:22 -0300 Subject: [PATCH 13/13] pixelmuerto theme : git status not in .git dir --- themes/pixelmuerto.zsh-theme | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/themes/pixelmuerto.zsh-theme b/themes/pixelmuerto.zsh-theme index 9fac1c2cb..3e52a090d 100644 --- a/themes/pixelmuerto.zsh-theme +++ b/themes/pixelmuerto.zsh-theme @@ -46,9 +46,11 @@ function git_remotes() { done pushed=$(git log --oneline origin/master..HEAD | wc -l ) [ "$pushed" -gt "0" ] && remotes+=" ↑:"$pushed - # submodules commints - submod=$(git status | grep "new commits" | wc -l) - [ "$submod" -gt "0" ] && remotes+=" _:"$submod + if [[ "$git_dir" != "." ]]; then + # submodules commits + submod=$(git status | grep "new commits" | wc -l) + [ "$submod" -gt "0" ] && remotes+=" _:"$submod + fi fi fi echo $remotes