From 6b25a521b6f0d97b44716a4f2cae7174015c7184 Mon Sep 17 00:00:00 2001 From: Pablo Lalloni Date: Wed, 9 Jan 2013 00:08:13 -0300 Subject: [PATCH 1/8] Agrego mi tema --- themes/mortalscumbag-pil.zsh-theme | 60 ++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 themes/mortalscumbag-pil.zsh-theme diff --git a/themes/mortalscumbag-pil.zsh-theme b/themes/mortalscumbag-pil.zsh-theme new file mode 100644 index 000000000..706078d50 --- /dev/null +++ b/themes/mortalscumbag-pil.zsh-theme @@ -0,0 +1,60 @@ +function my_git_prompt() { + tester=$(git rev-parse --git-dir 2> /dev/null) || return + + INDEX=$(git status --porcelain 2> /dev/null) + STATUS="" + + # is branch ahead? + if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" + fi + + # is anything staged? + if $(echo "$INDEX" | grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED" + fi + + # is anything unstaged? + if $(echo "$INDEX" | grep -E -e '^[ MARC][MD] ' &> /dev/null); then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" + fi + + # is anything untracked? + if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" + fi + + # is anything unmerged? + if $(echo "$INDEX" | grep -E -e '^(A[AU]|D[DU]|U[ADU]) ' &> /dev/null); then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" + fi + + if [[ -n $STATUS ]]; then + STATUS=" $STATUS" + fi + + echo "$ZSH_THEME_GIT_PROMPT_PREFIX$(my_current_branch)$STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX" +} + +function my_current_branch() { + echo $(current_branch || echo "(no branch)") +} + +function ssh_connection() { + if [[ -n $SSH_CONNECTION ]]; then + echo "%{$fg_bold[red]%}(ssh) " + fi +} + +psep="%{$reset_color%}$fg_bold[white]:%{$reset_color%}" + +PROMPT=$'$(ssh_connection)%{$fg_bold[green]%}%n@%m %{$psep%} $fg_bold[cyan]%*%{$reset_color%} %{$psep%}$(my_git_prompt) %~\n%(?//%{$fg_bold[red]%}%? )%#%{$reset_color%} ' + +ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}" +ZSH_THEME_GIT_PROMPT_PREFIX=" $fg_bold[white]‹ %{$fg_bold[yellow]%}" +ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[magenta]%}↑" +ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●" +ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[red]%}●" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[white]%}●" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[red]%}✕" +ZSH_THEME_GIT_PROMPT_SUFFIX=" $fg_bold[white]›%{$reset_color%}" From bc976745094b471827376a9cfe98c608e91a9532 Mon Sep 17 00:00:00 2001 From: Pablo Lalloni Date: Thu, 17 Jan 2013 08:14:42 -0300 Subject: [PATCH 2/8] Fixes gd completion --- plugins/git/git.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 154aa6db1..241ad6797 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -10,6 +10,7 @@ compdef _git gup=git-fetch alias gp='git push' compdef _git gp=git-push alias gd='git diff' +compdef _git gd=git-diff gdv() { git diff -w "$@" | view - } compdef _git gdv=git-diff alias gc='git commit -v' From cec6a9c6da2caf66a291caa6f921c5271181a96f Mon Sep 17 00:00:00 2001 From: Pablo Lalloni Date: Thu, 17 Jan 2013 08:15:04 -0300 Subject: [PATCH 3/8] Adds gds alias for "git diff --staged" --- plugins/git/git.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 241ad6797..582e390d0 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -11,6 +11,8 @@ alias gp='git push' compdef _git gp=git-push alias gd='git diff' compdef _git gd=git-diff +alias gds='git diff --staged' +compdef _git gds=git-diff gdv() { git diff -w "$@" | view - } compdef _git gdv=git-diff alias gc='git commit -v' From 44919560e155ae5159be230e327e2730392e3d74 Mon Sep 17 00:00:00 2001 From: Pablo Lalloni Date: Mon, 25 Mar 2013 11:04:18 -0300 Subject: [PATCH 4/8] correcti_all => correct by default --- lib/correction.zsh | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/correction.zsh b/lib/correction.zsh index fc60dcdbd..37db6bbbb 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -1,10 +1 @@ -setopt correct_all - -alias man='nocorrect man' -alias mv='nocorrect mv' -alias mysql='nocorrect mysql' -alias mkdir='nocorrect mkdir' -alias gist='nocorrect gist' -alias heroku='nocorrect heroku' -alias ebuild='nocorrect ebuild' -alias hpodder='nocorrect hpodder' +setopt correct From 74c6a566d14d1bc5aa2f4fdca975b244f1c981a5 Mon Sep 17 00:00:00 2001 From: Pablo Lalloni Date: Mon, 25 Mar 2013 11:08:09 -0300 Subject: [PATCH 5/8] Adds "gds" --- plugins/git/git.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 154aa6db1..16db65797 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -10,8 +10,11 @@ compdef _git gup=git-fetch alias gp='git push' compdef _git gp=git-push alias gd='git diff' +compdef _git gd=git-diff gdv() { git diff -w "$@" | view - } compdef _git gdv=git-diff +alias gds='git diff --staged' +compdef _git gds=git-diff alias gc='git commit -v' compdef _git gc=git-commit alias gca='git commit -v -a' From f95dfcd6e84b1f4f6878fe365a2b5075236670e6 Mon Sep 17 00:00:00 2001 From: Pablo Lalloni Date: Sat, 1 Jun 2013 19:41:11 -0300 Subject: [PATCH 6/8] Renames customized mortalscumbag theme as pilantropy --- themes/{mortalscumbag-pil.zsh-theme => pilantropy.zsh-theme} | 1 + 1 file changed, 1 insertion(+) rename themes/{mortalscumbag-pil.zsh-theme => pilantropy.zsh-theme} (97%) diff --git a/themes/mortalscumbag-pil.zsh-theme b/themes/pilantropy.zsh-theme similarity index 97% rename from themes/mortalscumbag-pil.zsh-theme rename to themes/pilantropy.zsh-theme index 706078d50..73a6f5e04 100644 --- a/themes/mortalscumbag-pil.zsh-theme +++ b/themes/pilantropy.zsh-theme @@ -1,3 +1,4 @@ +# Mostly borrowed from mortalscumbag theme function my_git_prompt() { tester=$(git rev-parse --git-dir 2> /dev/null) || return From 4a6662785221fcd7fd593d0f80d25743c7e152aa Mon Sep 17 00:00:00 2001 From: Pablo Lalloni Date: Sat, 1 Jun 2013 19:55:34 -0300 Subject: [PATCH 7/8] Back to original correct_all and omit "aptitude" from it --- lib/correction.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/correction.zsh b/lib/correction.zsh index 16fcdf6a5..1c5b59b27 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -1,7 +1,7 @@ if [[ "$DISABLE_CORRECTION" == "true" ]]; then return else - setopt correct + setopt correct_all alias man='nocorrect man' alias mv='nocorrect mv' alias mysql='nocorrect mysql' @@ -11,4 +11,5 @@ else alias ebuild='nocorrect ebuild' alias hpodder='nocorrect hpodder' alias sudo='nocorrect sudo' + alias aptitude='nocorrect aptitude' fi From 035c144f71c2070ce5bbdd59f3bf4e5a1345ff4e Mon Sep 17 00:00:00 2001 From: Pablo Lalloni Date: Sun, 22 Sep 2013 17:40:50 -0300 Subject: [PATCH 8/8] Moves exit status code to first prompt line --- themes/pilantropy.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/pilantropy.zsh-theme b/themes/pilantropy.zsh-theme index 73a6f5e04..392220209 100644 --- a/themes/pilantropy.zsh-theme +++ b/themes/pilantropy.zsh-theme @@ -49,7 +49,7 @@ function ssh_connection() { psep="%{$reset_color%}$fg_bold[white]:%{$reset_color%}" -PROMPT=$'$(ssh_connection)%{$fg_bold[green]%}%n@%m %{$psep%} $fg_bold[cyan]%*%{$reset_color%} %{$psep%}$(my_git_prompt) %~\n%(?//%{$fg_bold[red]%}%? )%#%{$reset_color%} ' +PROMPT=$'%(?//%{$fg_bold[red]%}= %?\n)$(ssh_connection)%{$fg_bold[green]%}%n@%m %{$psep%} $fg_bold[cyan]%*%{$reset_color%} %{$psep%}$(my_git_prompt) %~\n%#%{$reset_color%} ' ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}" ZSH_THEME_GIT_PROMPT_PREFIX=" $fg_bold[white]‹ %{$fg_bold[yellow]%}"