diff options
author | Roman Kamyk <roman.kamyk@gmail.com> | 2011-05-12 13:40:07 +0200 |
---|---|---|
committer | Roman Kamyk <roman.kamyk@gmail.com> | 2011-05-12 13:40:07 +0200 |
commit | f71647fa85267d558d0d69034902f53aeeed67ad (patch) | |
tree | e48c05b9de6c435ccb5df37c6d0a5b4c351b380e /lib | |
parent | dccfdf7dbf707b2e860fde1b6540e66ec6bda207 (diff) | |
parent | 0365ef0529ddfb912ca8202773e45916c55fdf4f (diff) | |
download | zsh-f71647fa85267d558d0d69034902f53aeeed67ad.tar.gz zsh-f71647fa85267d558d0d69034902f53aeeed67ad.tar.bz2 zsh-f71647fa85267d558d0d69034902f53aeeed67ad.zip |
Merge branch 'master' of http://github.com/robbyrussell/oh-my-zsh
Diffstat (limited to 'lib')
-rw-r--r-- | lib/completion.zsh | 3 | ||||
-rw-r--r-- | lib/git.zsh | 24 | ||||
-rw-r--r-- | lib/key-bindings.zsh | 2 | ||||
-rw-r--r-- | lib/termsupport.zsh | 13 |
4 files changed, 29 insertions, 13 deletions
diff --git a/lib/completion.zsh b/lib/completion.zsh index 9c2dfecca..fdd0a8536 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -8,9 +8,6 @@ setopt always_to_end WORDCHARS='' -autoload -U compinit -compinit -i - zmodload -i zsh/complist ## case-insensitive (all),partial-word and then substring completion diff --git a/lib/git.zsh b/lib/git.zsh index 8512de8a4..e96f075be 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -4,7 +4,8 @@ function git_prompt_info() { echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" } -parse_git_dirty () { +# Checks if working tree is dirty +parse_git_dirty() { if [[ -n $(git status -s 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else @@ -12,7 +13,24 @@ parse_git_dirty () { fi } -# get the status of the working tree +# Checks if there are commits ahead from remote +function git_prompt_ahead() { + if $(echo "$(git log origin/master..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + echo "$ZSH_THEME_GIT_PROMPT_AHEAD" + 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" +} + +# Formats prompt string for current git commit long SHA +function git_prompt_long_sha() { + SHA=$(git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" +} + +# Get the status of the working tree git_prompt_status() { INDEX=$(git status --porcelain 2> /dev/null) STATUS="" @@ -41,4 +59,4 @@ git_prompt_status() { STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" fi echo $STATUS -} +}
\ No newline at end of file diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 7196a88ff..c7ad907d7 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -1,6 +1,4 @@ # TODO: Explain what some of this does.. -autoload -U compinit -compinit -i bindkey -e bindkey '\ew' kill-region diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index e1e536690..22e7f372f 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -3,11 +3,12 @@ #Fully support screen, iterm, and probably most modern xterm and rxvt #Limited support for Apple Terminal (Terminal can't set window or tab separately) function title { - if [[ "$TERM" == "screen" ]]; then - print -Pn "\ek$1\e\\" #set screen hardstatus, usually truncated at 20 chars - elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then - print -Pn "\e]2;$2\a" #set window name - print -Pn "\e]1;$1\a" #set icon (=tab) name (will override window name on broken terminal) + [ "$DISABLE_AUTO_TITLE" != "true" ] || return + if [[ "$TERM" == screen* ]]; then + print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars + elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + print -Pn "\e]2;$2:q\a" #set window name + print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal) fi } @@ -21,6 +22,8 @@ function precmd { #Appears at the beginning of (and during) of command execution function preexec { + emulate -L zsh + setopt extended_glob local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd title "$CMD" "%100>...>$2%<<" } |