diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/aliases.zsh | 3 | ||||
-rw-r--r-- | lib/directories.zsh | 5 | ||||
-rw-r--r-- | lib/functions.zsh | 2 | ||||
-rw-r--r-- | lib/git.zsh | 19 | ||||
-rw-r--r-- | lib/misc.zsh | 4 | ||||
-rw-r--r-- | lib/rvm.zsh | 11 | ||||
-rw-r--r-- | lib/termsupport.zsh | 4 |
7 files changed, 33 insertions, 15 deletions
diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 0555be264..14f6ad289 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 a787db9eb..e445eb84c 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 | head -10' - -# mkdir & cd to it -function mcd() { - mkdir -p "$1" && cd "$1"; -} diff --git a/lib/functions.zsh b/lib/functions.zsh index d2dcadd0c..63ab755cf 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -1,5 +1,5 @@ function zsh_stats() { - history | awk '{print $2}' | sort | uniq -c | sort -rn | head + history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20 } function uninstall_oh_my_zsh() { diff --git a/lib/git.zsh b/lib/git.zsh index fb4ad8ca6..258b1df8f 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -18,6 +18,25 @@ parse_git_dirty() { fi } +# get the difference between the local and remote branches +git_remote_status() { + remote=${$(git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/} + if [[ -n ${remote} ]] ; then + ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l) + behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l) + + if [ $ahead -eq 0 ] && [ $behind -gt 0 ] + then + echo "$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE" + elif [ $ahead -gt 0 ] && [ $behind -eq 0 ] + then + echo "$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE" + elif [ $ahead -gt 0 ] && [ $behind -gt 0 ] + then + echo "$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE" + fi + fi +} # Checks if there are commits ahead from remote function git_prompt_ahead() { diff --git a/lib/misc.zsh b/lib/misc.zsh index 0f7e7e925..a8678b8ec 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -9,5 +9,7 @@ bindkey "^[m" copy-prev-shell-word setopt long_list_jobs ## pager -export PAGER="less -R" +export PAGER="less" +export LESS="-R" + export LC_CTYPE=$LANG diff --git a/lib/rvm.zsh b/lib/rvm.zsh index 597be1b33..e8744e61e 100644 --- a/lib/rvm.zsh +++ b/lib/rvm.zsh @@ -1,7 +1,8 @@ -# get the name of the branch we are on +# get the name of the ruby version function rvm_prompt_info() { - ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null) || return - echo "($ruby_version)" + [ -f $HOME/.rvm/bin/rvm-prompt ] || return + local rvm_prompt + rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null) + [[ "${rvm_prompt}x" == "x" ]] && return + echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}" } - - diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index e26fef6d3..c056989eb 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -26,8 +26,8 @@ function omz_termsupport_precmd { function omz_termsupport_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%<<" + local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd + title "$CMD" "%100>...>${2:gs/%/%%}%<<" } autoload -U add-zsh-hook |