diff --git a/lib/correction.zsh b/lib/correction.zsh index 436446101..1c5b59b27 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -11,4 +11,5 @@ else alias ebuild='nocorrect ebuild' alias hpodder='nocorrect hpodder' alias sudo='nocorrect sudo' + alias aptitude='nocorrect aptitude' fi diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 7b3cec27d..f43c626b6 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -14,8 +14,13 @@ compdef _git gup=git-fetch 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 gds='git diff --staged' +compdef _git gds=git-diff alias gc='git commit -v' compdef _git gc=git-commit alias gc!='git commit -v --amend' diff --git a/themes/pilantropy.zsh-theme b/themes/pilantropy.zsh-theme new file mode 100644 index 000000000..392220209 --- /dev/null +++ b/themes/pilantropy.zsh-theme @@ -0,0 +1,61 @@ +# Mostly borrowed from mortalscumbag theme +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=$'%(?//%{$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]%}" +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%}"