diff --git a/lib/aliases.zsh b/lib/aliases.zsh index b47de5bde..8c510e0ef 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -16,8 +16,9 @@ alias history='fc -l 1' # List direcory contents alias lsa='ls -lah' -alias l='ls -la' +alias l='ls -lA1' alias ll='ls -l' +alias la='ls -lA' alias sl=ls # often screw this up alias afind='ack-grep -il' diff --git a/lib/directories.zsh b/lib/directories.zsh index bb114f615..7f74d924f 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -37,8 +37,3 @@ cd () { alias md='mkdir -p' alias rd=rmdir alias d='dirs -v' - -# mkdir & cd to it -function mcd() { - mkdir -p "$1" && cd "$1"; -} \ No newline at end of file diff --git a/lib/git.zsh b/lib/git.zsh index ce4de5598..a5a7d2e84 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -5,7 +5,7 @@ function git_prompt_info() { } # Checks if working tree is dirty -parse_git_dirty() { +function parse_git_dirty() { if [[ -n $(git status -s 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else @@ -15,11 +15,17 @@ parse_git_dirty() { # Checks if there are commits ahead from remote function git_prompt_ahead() { - if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + if $(echo "$(git log $(git_current_remote)/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then echo "$ZSH_THEME_GIT_PROMPT_AHEAD" fi } +function git_prompt_behind() { + if $(echo "$(git log HEAD..$(git_current_remote)/$(current_branch) 2> /dev/null)" | grep '^commit' &> /dev/null); then + echo "$ZSH_THEME_GIT_PROMPT_BEHIND" + fi +} + # Formats prompt string for current git commit short SHA function git_prompt_short_sha() { SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" @@ -31,7 +37,7 @@ function git_prompt_long_sha() { } # Get the status of the working tree -git_prompt_status() { +function git_prompt_status() { INDEX=$(git status --porcelain 2> /dev/null) STATUS="" if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then @@ -60,3 +66,12 @@ git_prompt_status() { fi echo $STATUS } + +function git_current_remote() { + remote=$(git config --get "branch.$(current_branch).remote") + if [ -z "$remote" ]; then + echo 'origin' + else + echo "$remote" + fi +}