From 09f16a6255ebd12bfab271c34edb4a2cdf0079f4 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Thu, 28 Feb 2013 17:19:38 -0800 Subject: [PATCH 01/33] Adding copy of agnoster theme for Powerline beta support --- themes/agnoster_beta.zsh-theme | 115 +++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 themes/agnoster_beta.zsh-theme diff --git a/themes/agnoster_beta.zsh-theme b/themes/agnoster_beta.zsh-theme new file mode 100644 index 000000000..c3107c06c --- /dev/null +++ b/themes/agnoster_beta.zsh-theme @@ -0,0 +1,115 @@ +# vim:ft=zsh ts=2 sw=2 sts=2 +# +# agnoster's Theme - https://gist.github.com/3712874 +# A Powerline-inspired theme for ZSH +# +# # README +# +# In order for this theme to render correctly, you will need a +# [Powerline-patched font](https://gist.github.com/1595572). +# +# In addition, I recommend the +# [Solarized theme](https://github.com/altercation/solarized/) and, if you're +# using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over Terminal.app - +# it has significantly better color fidelity. +# +# # Goals +# +# The aim of this theme is to only show you *relevant* information. Like most +# prompts, it will only show git information when in a git working directory. +# However, it goes a step further: everything from the current user and +# hostname to whether the last call exited with an error to whether background +# jobs are running in this shell will all be displayed automatically when +# appropriate. + +### Segment drawing +# A few utility functions to make it easy and re-usable to draw segmented prompts + +CURRENT_BG='NONE' +SEGMENT_SEPARATOR='⮀' + +# Begin a segment +# Takes two arguments, background and foreground. Both can be omitted, +# rendering default background/foreground. +prompt_segment() { + local bg fg + [[ -n $1 ]] && bg="%K{$1}" || bg="%k" + [[ -n $2 ]] && fg="%F{$2}" || fg="%f" + if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then + echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} " + else + echo -n "%{$bg%}%{$fg%} " + fi + CURRENT_BG=$1 + [[ -n $3 ]] && echo -n $3 +} + +# End the prompt, closing any open segments +prompt_end() { + if [[ -n $CURRENT_BG ]]; then + echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR" + else + echo -n "%{%k%}" + fi + echo -n "%{%f%}" + CURRENT_BG='' +} + +### Prompt components +# Each component will draw itself, and hide itself if no information needs to be shown + +# Context: user@hostname (who am I and where am I) +prompt_context() { + local user=`whoami` + + if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then + prompt_segment black default "%(!.%{%F{yellow}%}.)$user@%m" + fi +} + +# Git: branch/detached head, dirty status +prompt_git() { + local ref dirty + if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then + ZSH_THEME_GIT_PROMPT_DIRTY='±' + dirty=$(parse_git_dirty) + ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)" + if [[ -n $dirty ]]; then + prompt_segment yellow black + else + prompt_segment green black + fi + echo -n "${ref/refs\/heads\//⭠ }$dirty" + fi +} + +# Dir: current working directory +prompt_dir() { + prompt_segment blue black '%~' +} + +# Status: +# - was there an error +# - am I root +# - are there background jobs? +prompt_status() { + local symbols + symbols=() + [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘" + [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" + [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙" + + [[ -n "$symbols" ]] && prompt_segment black default "$symbols" +} + +## Main prompt +build_prompt() { + RETVAL=$? + prompt_status + prompt_context + prompt_dir + prompt_git + prompt_end +} + +PROMPT='%{%f%b%k%}$(build_prompt) ' From a1352456bc13bd2d892c36aa7ed17e63c1e0d775 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Thu, 28 Feb 2013 17:22:39 -0800 Subject: [PATCH 02/33] Fixing glyphs for new Powerline characters (Lokaltog/powerline) Latest patched fonts do not support previous agnoster theme. This patch repalces them with the new unicode glyphs. --- themes/agnoster_beta.zsh-theme | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/themes/agnoster_beta.zsh-theme b/themes/agnoster_beta.zsh-theme index c3107c06c..4f832ec97 100644 --- a/themes/agnoster_beta.zsh-theme +++ b/themes/agnoster_beta.zsh-theme @@ -26,7 +26,8 @@ # A few utility functions to make it easy and re-usable to draw segmented prompts CURRENT_BG='NONE' -SEGMENT_SEPARATOR='⮀' +SEGMENT_SEPARATOR='' +BRANCH_SYMBOL='' # Begin a segment # Takes two arguments, background and foreground. Both can be omitted, @@ -79,7 +80,7 @@ prompt_git() { else prompt_segment green black fi - echo -n "${ref/refs\/heads\//⭠ }$dirty" + echo -n "${ref/refs\/heads\//$BRANCH_SYMBOL }$dirty" fi } From 0fe05e24db1584feb98b389f7613b70c233ecd2a Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Sun, 31 Mar 2013 08:21:47 +0400 Subject: [PATCH 03/33] Adding basic fortune plugin --- plugins/fortune/fortune.plugin.zsh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 plugins/fortune/fortune.plugin.zsh diff --git a/plugins/fortune/fortune.plugin.zsh b/plugins/fortune/fortune.plugin.zsh new file mode 100644 index 000000000..25a7c5193 --- /dev/null +++ b/plugins/fortune/fortune.plugin.zsh @@ -0,0 +1,4 @@ +if type fortune &> /dev/null; then + fortune + echo +fi From b6299678b26b193a59f00f9dd8688f1039fea726 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Sun, 31 Mar 2013 08:23:06 +0400 Subject: [PATCH 04/33] Adding gnu-colors plugin for dir_colors and list-colors --- plugins/gnu-colors/gnu-colors.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 plugins/gnu-colors/gnu-colors.plugin.zsh diff --git a/plugins/gnu-colors/gnu-colors.plugin.zsh b/plugins/gnu-colors/gnu-colors.plugin.zsh new file mode 100644 index 000000000..fe5293eef --- /dev/null +++ b/plugins/gnu-colors/gnu-colors.plugin.zsh @@ -0,0 +1,6 @@ +if type dircolors &> /dev/null; then + eval `dircolors ~/.dir_colors` +fi + +# Temporary workaround for tab completion LS_COLORS; Issue #1563 +zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} From f29f4a0b77a74cf2540480529addf9d7a04fa340 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Sun, 31 Mar 2013 09:39:16 +0400 Subject: [PATCH 05/33] Updating to use xterm-256color --- plugins/tmux/tmux.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 465f5b053..4091fae35 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -21,7 +21,7 @@ if which tmux &> /dev/null # The TERM to use for 256 color terminals. # Tmux states this should be screen-256color, but you may need to change it on # systems without the proper terminfo - [[ -n "$ZSH_TMUX_FIXTERM_WITH_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITH_256COLOR="screen-256color" + [[ -n "$ZSH_TMUX_FIXTERM_WITH_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITH_256COLOR="xterm-256color" # Get the absolute path to the current directory From 8c52395c5168fe9c8a0f8c784cb46c4ef06ed104 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Sat, 15 Jun 2013 00:07:01 +0400 Subject: [PATCH 06/33] Implementing debian plugin fix by blopker Could not cherry-pick as blopker deleted his repo Fix found here: https://github.com/robbyrussell/oh-my-zsh/commit/01af87a1f7d8ae5dcd68213bdc8b46047611583a --- plugins/debian/debian.plugin.zsh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index 55b90e379..b60f9f6e2 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -4,16 +4,26 @@ # # Debian-related zsh aliases and functions for zsh +# Function to check if a command exists +exists() { + if command -v $1 >/dev/null 2>&1 + then + return 0 + else + return 1 + fi +} + # Use aptitude if installed, or apt-get if not. # You can just set apt_pref='apt-get' to override it. -if [[ -e $( which aptitude 2>&1 ) ]]; then +if exists aptitude; then apt_pref='aptitude' else apt_pref='apt-get' fi # Use sudo by default if it's installed -if [[ -e $( which sudo 2>&1 ) ]]; then +if exists sudo; then use_sudo=1 fi From ea7e22cadf36d81a0e16420f4eaf0efedffb3322 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Thu, 27 Jun 2013 13:34:24 -0700 Subject: [PATCH 07/33] Fixing ITERM2 default; remove backslashes; test file with '-a' --- plugins/tmux/tmux.plugin.zsh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 4ed07b128..1d1ad33d3 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -15,7 +15,7 @@ if which tmux &> /dev/null # Set term to screen or screen-256color based on current terminal support [[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true # Set '-CC' option for iTerm2 tmux integration - [[ -n "$$ZSH_TMUX_ITERM2" ]] || ZSH_TMUX_ITERM2=false + [[ -n "$ZSH_TMUX_ITERM2" ]] || ZSH_TMUX_ITERM2=false # The TERM to use for non-256 color terminals. # Tmux states this should be screen, but you may need to change it on # systems without the proper terminfo @@ -38,7 +38,7 @@ if which tmux &> /dev/null fi # Set the correct local config file to use. - if [[ "$ZSH_TMUX_ITERM2" == "false" ]] && (( [[ -f $HOME/.tmux.conf ]] || -h $HOME/.tmux.conf ]] )) + if [[ -a $HOME/.tmux.conf && "$ZSH_TMUX_ITERM2" == "false" ]] then #use this when they have a ~/.tmux.conf export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.extra.conf" @@ -53,15 +53,15 @@ if which tmux &> /dev/null # We have other arguments, just run them if [[ -n "$@" ]] then - \tmux $@ + tmux $@ # Try to connect to an existing session. elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] then - \tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` attach || \tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session + tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` attach || tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit # Just run tmux, fixing the TERM variable if requested. else - \tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` + tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit fi } From 2d38e4909623f32ef6982bce202448cad70c3e2c Mon Sep 17 00:00:00 2001 From: Joni Chandra Date: Fri, 26 Apr 2013 11:31:02 +0700 Subject: [PATCH 08/33] Update the wrong variable used in rb20 function. Fixes #1762 Signed-off-by: Joni Chandra --- plugins/rvm/rvm.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index e6ad6450d..3bde154df 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -31,7 +31,7 @@ compdef _rb19 rb19 function rb20 { if [ -z "$1" ]; then - rvm use "$ruby" + rvm use "$ruby20" else rvm use "$ruby20@$1" fi From ba760f4f8da4bfca49ca9da5d2786e547617fb50 Mon Sep 17 00:00:00 2001 From: yleo77 Date: Fri, 17 May 2013 17:48:06 +0800 Subject: [PATCH 09/33] add search by filename and file content feature --- .gitignore | 5 ++--- custom/plugins/sfffe/sfffe.plugin.zsh | 28 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 custom/plugins/sfffe/sfffe.plugin.zsh diff --git a/.gitignore b/.gitignore index 51a5ee6c3..5db11ce5c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,8 @@ locals.zsh log/.zsh_history projects.zsh -custom/* -!custom/example -!custom/example.zsh +custom/example +custom/example.zsh *.swp !custom/example.zshcache cache/ diff --git a/custom/plugins/sfffe/sfffe.plugin.zsh b/custom/plugins/sfffe/sfffe.plugin.zsh new file mode 100644 index 000000000..a0f034908 --- /dev/null +++ b/custom/plugins/sfffe/sfffe.plugin.zsh @@ -0,0 +1,28 @@ +# ------------------------------------------------------------------------------ +# FILE: sfffe.plugin.zsh +# DESCRIPTION: search file for FE +# AUTHOR: yleo77 (ylep77@gmail.com) +# VERSION: 0.1 +# REQUIRE: ack +# ------------------------------------------------------------------------------ + +if [ ! -x $(which ack) ]; then + echo \'ack\' is not installed! + exit -1 +fi + +ajs() { + ack "$@" --type js +} + +acss() { + ack "$@" --type css +} + +fjs() { + find ./ -name "$@*" -type f | grep '\.js' +} + +fcss() { + find ./ -name "$@*" -type f | grep '\.css' +} From 9b007d71e05015ef3b1a1738cb6e017cef6af77a Mon Sep 17 00:00:00 2001 From: yleo77 Date: Wed, 22 May 2013 17:00:08 +0800 Subject: [PATCH 10/33] add gf alias for git flow --- plugins/git-flow/git-flow.plugin.zsh | 3 +++ plugins/git/git.plugin.zsh | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh index ab9c0c848..58c31d756 100644 --- a/plugins/git-flow/git-flow.plugin.zsh +++ b/plugins/git-flow/git-flow.plugin.zsh @@ -20,6 +20,9 @@ # c. Or, use this file as a oh-my-zsh plugin. # +#Alias +alias gf='git flow' + _git-flow () { local curcontext="$curcontext" state line diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 6b91b4a72..0f06547d1 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -72,7 +72,10 @@ alias grh='git reset HEAD' alias grhh='git reset HEAD --hard' alias gclean='git reset --hard && git clean -dfx' alias gwc='git whatchanged -p --abbrev-commit --pretty=medium' -alias gf='git ls-files | grep' + +#remove the gf alias +#alias gf='git ls-files | grep' + alias gpoat='git push origin --all && git push origin --tags' alias gmt='git mergetool --no-prompt' compdef _git gm=git-mergetool From c514d390ec8fd0bc57cb1a0d90f44081d8b94f01 Mon Sep 17 00:00:00 2001 From: yleo77 Date: Thu, 6 Jun 2013 12:39:14 +0800 Subject: [PATCH 11/33] add some alias for git flow --- plugins/git-flow/git-flow.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh index 58c31d756..b9ea06844 100644 --- a/plugins/git-flow/git-flow.plugin.zsh +++ b/plugins/git-flow/git-flow.plugin.zsh @@ -22,6 +22,9 @@ #Alias alias gf='git flow' +alias gcd='git checkout develop' +alias gch='git checkout hotfix' +alias gcr='git checkout release' _git-flow () { From 923335c820729a9e94afaee2561b921fe34c2cdc Mon Sep 17 00:00:00 2001 From: Tehmasp Chaudhri Date: Fri, 12 Jul 2013 12:03:44 -0600 Subject: [PATCH 12/33] Added a 'git diff --cached' alias -> 'gdc' --- 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 0f06547d1..f24059c54 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -5,6 +5,8 @@ alias gst='git status' compdef _git gst=git-status alias gd='git diff' compdef _git gd=git-diff +alias gdc='git diff --cached' +compdef _git gdc=git-diff alias gl='git pull' compdef _git gl=git-pull alias gup='git pull --rebase' From e8abe81aed2df2db44b2b9904c94daac30006dbb Mon Sep 17 00:00:00 2001 From: yleo77 Date: Tue, 16 Jul 2013 16:54:54 +0800 Subject: [PATCH 13/33] set default value `--max-count=10` --- plugins/git/git.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index f24059c54..822c0916e 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -56,9 +56,9 @@ compdef gcount=git alias gcl='git config --list' alias gcp='git cherry-pick' compdef _git gcp=git-cherry-pick -alias glg='git log --stat --max-count=5' +alias glg='git log --stat --max-count=10' compdef _git glg=git-log -alias glgg='git log --graph --max-count=5' +alias glgg='git log --graph --max-count=10' compdef _git glgg=git-log alias glgga='git log --graph --decorate --all' compdef _git glgga=git-log From 564a4011e1637724e805f57f7f05eaa578730e05 Mon Sep 17 00:00:00 2001 From: Brandon W Maister Date: Wed, 14 Aug 2013 23:19:16 -0400 Subject: [PATCH 14/33] Improve pip plugin options support * -r, --record now looks for a local file instead of trying to cache the entire package index * add --editable because it's useful * add --single-version-externally-managed because it is too long * add --record and --root because they're required by --single-version-externally-managed --- plugins/pip/_pip | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/pip/_pip b/plugins/pip/_pip index df53ba5ce..fb8765c7e 100644 --- a/plugins/pip/_pip +++ b/plugins/pip/_pip @@ -6,8 +6,8 @@ _pip_all() { # we cache the list of packages (originally from the macports plugin) if (( ! $+piplist )); then - echo -n " (caching package index...)" - piplist=($(pip search * | cut -d ' ' -f 1 | tr '[A-Z]' '[a-z]')) + echo -n " (caching package index...)" + piplist=($(pip search * | cut -d ' ' -f 1 | tr '[A-Z]' '[a-z]')) fi } @@ -62,8 +62,13 @@ case "$words[1]" in '(--no-install)--no-install[only download packages]' \ '(--no-download)--no-download[only install downloaded packages]' \ '(--install-option)--install-option[extra arguments to be supplied to the setup.py]' \ + '(--single-version-externally-managed)--single-version-externally-managed[do not download/install dependencies. requires --record or --root]'\ + '(--root)--root[treat this path as a fake chroot, installing into it. implies --single-version-externally-managed]'\ + '(--record)--record[file to record all installed files to.]'\ + '(-r --requirement)'{-r,--requirement}'[requirements file]: :_files'\ + '(-e --editable)'{-e,--editable}'[path of or url to source to link to instead of installing.]: :_files -/'\ '1: :->packages' && return 0 - + if [[ "$state" == packages ]]; then _pip_all _wanted piplist expl 'packages' compadd -a piplist From 8d4293facd3fe8caa0c6e6b508a41a1c59510c6b Mon Sep 17 00:00:00 2001 From: Aaron Mills Date: Mon, 19 Aug 2013 16:28:09 -0600 Subject: [PATCH 15/33] Add support for mosh (remote-shell) tab completion. --- plugins/mosh/mosh.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 plugins/mosh/mosh.plugin.zsh diff --git a/plugins/mosh/mosh.plugin.zsh b/plugins/mosh/mosh.plugin.zsh new file mode 100644 index 000000000..ea36b7ee9 --- /dev/null +++ b/plugins/mosh/mosh.plugin.zsh @@ -0,0 +1,2 @@ +# Allow SSH tab completion for mosh hostnames +compdef mosh=ssh From ada59c81dd4b3d669c43fd6faed218c82469e0fc Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Sat, 24 Aug 2013 13:12:03 +0400 Subject: [PATCH 16/33] Fixed opening documentation on Linux (node) --- plugins/node/node.plugin.zsh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh index 3bbed6f04..2d78f2b4c 100644 --- a/plugins/node/node.plugin.zsh +++ b/plugins/node/node.plugin.zsh @@ -1,5 +1,13 @@ # Open the node api for your current version to the optional section. # TODO: Make the section part easier to use. function node-docs { - open "http://nodejs.org/docs/$(node --version)/api/all.html#all_$1" + # get the open command + local open_cmd + if [[ $(uname -s) == 'Darwin' ]]; then + open_cmd='open' + else + open_cmd='xdg-open' + fi + + $open_cmd "http://nodejs.org/docs/$(node --version)/api/all.html#all_$1" } From 85eb7d6d5233aaa24ab01d71b9b1addab55a25ec Mon Sep 17 00:00:00 2001 From: Mr Prud Date: Thu, 29 Aug 2013 14:07:09 +0200 Subject: [PATCH 17/33] Replace no unicode glyph on hexa string --- themes/agnoster.zsh-theme | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index c7a59ad0d..8b5f4ef7a 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -26,7 +26,7 @@ # A few utility functions to make it easy and re-usable to draw segmented prompts CURRENT_BG='NONE' -SEGMENT_SEPARATOR='' +SEGMENT_SEPARATOR='\u2b80' # Begin a segment # Takes two arguments, background and foreground. Both can be omitted, @@ -90,7 +90,7 @@ prompt_git() { zstyle ':vcs_info:*' formats ' %u%c' zstyle ':vcs_info:*' actionformats '%u%c' vcs_info - echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_}" + echo -n "${ref/refs\/heads\//\u2b60 }${vcs_info_msg_0_}" fi } @@ -110,7 +110,7 @@ prompt_hg() { # if working copy is clean prompt_segment green black fi - echo -n $(hg prompt " {rev}@{branch}") $st + echo -n $(hg prompt "\u2b60 {rev}@{branch}") $st else st="" rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g') @@ -124,7 +124,7 @@ prompt_hg() { else prompt_segment green black fi - echo -n " $rev@$branch" $st + echo -n "\u2b60 $rev@$branch" $st fi fi } From 1b0346fa1763ba057703bed10ca4524ad00226d2 Mon Sep 17 00:00:00 2001 From: Alexander Gronemann Date: Thu, 29 Aug 2013 16:20:40 +0200 Subject: [PATCH 18/33] Update bundler.plugin.zsh Added taps to bundled_commands --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 1e70db6af..5bd28cbdc 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -14,7 +14,7 @@ eval "alias bi='bundle install --jobs=$cores_num'" # The following is based on https://github.com/gma/bundler-exec -bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard jekyll kitchen knife middleman nanoc rackup rainbows rake rspec ruby shotgun spec spin spork strainer tailor thin thor unicorn unicorn_rails puma) +bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard jekyll kitchen knife middleman nanoc rackup rainbows rake rspec ruby shotgun spec spin spork strainer tailor taps thin thor unicorn unicorn_rails puma) ## Functions From 89ed36595db99fe6a081d62b934493514f2daa00 Mon Sep 17 00:00:00 2001 From: Paul Melnikow Date: Wed, 4 Sep 2013 18:07:58 -0400 Subject: [PATCH 19/33] Plugin for Node Version Manager --- plugins/nvm/_nvm | 24 ++++++++++++++++++++++++ plugins/nvm/nvm.plugin.zsh | 3 +++ 2 files changed, 27 insertions(+) create mode 100644 plugins/nvm/_nvm create mode 100644 plugins/nvm/nvm.plugin.zsh diff --git a/plugins/nvm/_nvm b/plugins/nvm/_nvm new file mode 100644 index 000000000..038196a6e --- /dev/null +++ b/plugins/nvm/_nvm @@ -0,0 +1,24 @@ +#compdef nvm +#autoload + +local -a _1st_arguments +_1st_arguments=( + 'help:show help' + 'install:download and install a version' + 'uninstall:uninstall a version' + 'use:modify PATH to use version' + 'run:run version with given arguments' + 'ls:list installed versions or versions matching a given description' + 'ls-remote:list remote versions available for install' + 'deactivate:undo effects of NVM on current shell' + 'alias:show or set aliases' + 'unalias:deletes an alias' + 'copy-packages:install global NPM packages to current version' +) + +_arguments -C '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "nvm subcommand" _1st_arguments + return +fi \ No newline at end of file diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh new file mode 100644 index 000000000..9709719fe --- /dev/null +++ b/plugins/nvm/nvm.plugin.zsh @@ -0,0 +1,3 @@ +# The addition 'nvm install' attempts in ~/.profile + +[[ -s ~/.nvm/nvm.sh ]] && . ~/.nvm/nvm.sh From 5b36ff40731e0a8733d19a320230e7cb81655518 Mon Sep 17 00:00:00 2001 From: Paul Melnikow Date: Thu, 5 Sep 2013 10:09:19 -0400 Subject: [PATCH 20/33] NVM: Avoid providing completions when nvm is not installed --- plugins/nvm/_nvm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/nvm/_nvm b/plugins/nvm/_nvm index 038196a6e..a95c9e375 100644 --- a/plugins/nvm/_nvm +++ b/plugins/nvm/_nvm @@ -1,6 +1,8 @@ #compdef nvm #autoload +[[ -s ~/.nvm/nvm.sh ]] || return 0 + local -a _1st_arguments _1st_arguments=( 'help:show help' From 65d1ebd493639e20cc1addae8649f74068c9bfc0 Mon Sep 17 00:00:00 2001 From: Paul Melnikow Date: Thu, 5 Sep 2013 10:12:12 -0400 Subject: [PATCH 21/33] Sublime Text: Harmonize alias with the Sublime Text install instructions The typical command is `subl`, not `st`. Leaving both for backward compatibility. See http://www.sublimetext.com/docs/2/osx_command_line.html --- plugins/sublime/sublime.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh index 82faf87c9..72f56754c 100755 --- a/plugins/sublime/sublime.plugin.zsh +++ b/plugins/sublime/sublime.plugin.zsh @@ -21,7 +21,8 @@ elif [[ $('uname') == 'Darwin' ]]; then for _sublime_path in $_sublime_darwin_paths; do if [[ -a $_sublime_path ]]; then - alias st="'$_sublime_path'" + alias subl="'$_sublime_path'" + alias st=subl break fi done From 053544da1c364dd8faf3baa6ffeb8531806fd6f7 Mon Sep 17 00:00:00 2001 From: Gaetan Semet Date: Tue, 10 Sep 2013 11:28:31 +0200 Subject: [PATCH 22/33] Display right prompt in theme chooser I didn't found the way to right-align the right prompt properly. Signed-off-by: Gaetan Semet --- tools/theme_chooser.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/theme_chooser.sh b/tools/theme_chooser.sh index 4d7047444..2c2a379ba 100755 --- a/tools/theme_chooser.sh +++ b/tools/theme_chooser.sh @@ -24,7 +24,8 @@ function theme_preview() { THEME_NAME=`echo $THEME | sed s/\.zsh-theme$//` print "$fg[blue]${(l.((${COLUMNS}-${#THEME_NAME}-5))..─.)}$reset_color $THEME_NAME $fg[blue]───$reset_color" source "$THEMES_DIR/$THEME" - print -P $PROMPT + cols=$(tput cols) + print -P "$PROMPT $RPROMPT" } function banner() { From bf9bdec336427d9603ff14df51ecddd133fa5ec4 Mon Sep 17 00:00:00 2001 From: David Strawn Date: Sat, 14 Sep 2013 12:26:33 -0600 Subject: [PATCH 23/33] Fixed comments in zshrc.zsh-template about disabling auto updates. Previously they did not make sense nor were they accurate. --- templates/zshrc.zsh-template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index d4dded73a..1dfb6998c 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -14,7 +14,7 @@ ZSH_THEME="robbyrussell" # Set to this to use case-sensitive completion # CASE_SENSITIVE="true" -# Comment this out to disable bi-weekly auto-update checks +# Uncomment this to disable bi-weekly auto-update checks # DISABLE_AUTO_UPDATE="true" # Uncomment to change how often before auto-updates occur? (in days) From b1a4c437e04abb6f09c50abae11e244abeb99705 Mon Sep 17 00:00:00 2001 From: Thomas Hipp Date: Wed, 18 Sep 2013 13:37:36 +0200 Subject: [PATCH 24/33] jump plugin: fix autocompletion with single mark Autocompletion fails if there's only one mark, since the ls command will not display the parent directory with the trailing colon. Handling the single mark case separately and validating the symlink explicitly, resolves the issue. --- plugins/jump/jump.plugin.zsh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh index a3c5cf8c3..5096879d8 100644 --- a/plugins/jump/jump.plugin.zsh +++ b/plugins/jump/jump.plugin.zsh @@ -38,7 +38,13 @@ marks() { } _completemarks() { - reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_\da-zA-Z\-]*):$/\2/g')) + if [[ $(ls "${MARKPATH}" | wc -l) -gt 1 ]]; then + reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_\da-zA-Z\-]*):$/\2/g')) + else + if readlink -e "${MARKPATH}"/* &>/dev/null; then + reply=($(ls "${MARKPATH}")) + fi + fi } compctl -K _completemarks jump compctl -K _completemarks unmark From 241966f2ae9c4fb97d04d578b2d4822923d6b9ec Mon Sep 17 00:00:00 2001 From: Maxime Chaisse-Leal Date: Wed, 18 Sep 2013 21:54:23 +0200 Subject: [PATCH 25/33] Added WIP (work in progress) feature to git.plugin --- plugins/git/git.plugin.zsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 822c0916e..104b4a55a 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -131,3 +131,17 @@ function _git_log_prettily(){ } alias glp="_git_log_prettily" compdef _git glp=git-log + +# Work In Progress (wip) +# These features allow to pause a branch development and switch to another one (wip) +# When you want to go back to work, just unwip it +# +# This function return a warning if the current branch is a wip +function work_in_progress() { + if $(git log -n 1 | grep -q -c wip); then + echo "WIP!!" + fi +} +# these alias commit and uncomit wip branches +alias gwip='git add -A; git ls-files --deleted -z | xargs -0 git rm; git commit -m "wip"' +alias gunwip='git log -n 1 | grep -q -c wip && git reset HEAD~1' \ No newline at end of file From 482dadf727da4f47edca436904adbc3f57418133 Mon Sep 17 00:00:00 2001 From: Maxime Chaisse-Leal Date: Wed, 18 Sep 2013 21:56:10 +0200 Subject: [PATCH 26/33] Added WIP alert to the gallois' theme --- themes/gallois.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/gallois.zsh-theme b/themes/gallois.zsh-theme index 3eac14867..d624e3afc 100644 --- a/themes/gallois.zsh-theme +++ b/themes/gallois.zsh-theme @@ -7,12 +7,12 @@ ZSH_THEME_GIT_PROMPT_CLEAN="" git_custom_status() { local cb=$(current_branch) if [ -n "$cb" ]; then - echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" + echo "$(parse_git_dirty)%{$fg_bold[yellow]%}$(work_in_progress)%{$reset_color%}$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" fi } #RVM and git settings -if [[ -s ~/.rvm/scripts/rvm ]] ; then +if [[ -s ~/.rvm/scripts/rvm ]] ; then RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1' else if which rbenv &> /dev/null; then From a7b2ca50abf712604ae2911ae7786263ec11c693 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 19 Sep 2013 13:18:16 -0700 Subject: [PATCH 27/33] Revert "Replace no unicode glyph on hexa string" This reverts commit baffc3b0bd2594b789316cb135ba84fb54f50dd9. --- themes/agnoster.zsh-theme | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 8b5f4ef7a..c7a59ad0d 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -26,7 +26,7 @@ # A few utility functions to make it easy and re-usable to draw segmented prompts CURRENT_BG='NONE' -SEGMENT_SEPARATOR='\u2b80' +SEGMENT_SEPARATOR='' # Begin a segment # Takes two arguments, background and foreground. Both can be omitted, @@ -90,7 +90,7 @@ prompt_git() { zstyle ':vcs_info:*' formats ' %u%c' zstyle ':vcs_info:*' actionformats '%u%c' vcs_info - echo -n "${ref/refs\/heads\//\u2b60 }${vcs_info_msg_0_}" + echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_}" fi } @@ -110,7 +110,7 @@ prompt_hg() { # if working copy is clean prompt_segment green black fi - echo -n $(hg prompt "\u2b60 {rev}@{branch}") $st + echo -n $(hg prompt " {rev}@{branch}") $st else st="" rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g') @@ -124,7 +124,7 @@ prompt_hg() { else prompt_segment green black fi - echo -n "\u2b60 $rev@$branch" $st + echo -n " $rev@$branch" $st fi fi } From 0d5981a1ad51ef429b2cfbc787f973af2a2fc00e Mon Sep 17 00:00:00 2001 From: kaving Date: Wed, 2 Oct 2013 10:51:21 +0200 Subject: [PATCH 28/33] Add support for ForkLift 2 to the ForkLift plugin The ForkLift plugin now supports ForkLift 2 as well as ForkLift 1. If ForkLift is not running it also waits for it to be running before trying to switch to the specified directory --- plugins/forklift/forklift.plugin.zsh | 35 ++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/plugins/forklift/forklift.plugin.zsh b/plugins/forklift/forklift.plugin.zsh index 056069d36..b0e60a434 100644 --- a/plugins/forklift/forklift.plugin.zsh +++ b/plugins/forklift/forklift.plugin.zsh @@ -1,5 +1,6 @@ -# Open folder in ForkLift.app from console +# Open folder in ForkLift.app of ForkLift2.app from console # Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de +# Updated to support ForkLift2 by Johan Kaving # # Usage: # fl [] @@ -22,9 +23,33 @@ function fl { fi fi osascript 2>&1 1>/dev/null < Date: Thu, 3 Oct 2013 09:48:49 +0300 Subject: [PATCH 29/33] Added '.war' extension to unzip --- plugins/extract/extract.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 23e86c593..6e26b54c0 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -52,7 +52,7 @@ function extract() { (*.xz) unxz "$1" ;; (*.lzma) unlzma "$1" ;; (*.Z) uncompress "$1" ;; - (*.zip) unzip "$1" -d $extract_dir ;; + (*.zip|*.war) unzip "$1" -d $extract_dir ;; (*.rar) unrar x -ad "$1" ;; (*.7z) 7za x "$1" ;; (*.deb) From a27160a623ade6a1919629c166e4715efc408d0d Mon Sep 17 00:00:00 2001 From: Timo Sand Date: Thu, 3 Oct 2013 13:00:12 +0300 Subject: [PATCH 30/33] Added '.jar' --- plugins/extract/extract.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 6e26b54c0..7352e5bad 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -52,7 +52,7 @@ function extract() { (*.xz) unxz "$1" ;; (*.lzma) unlzma "$1" ;; (*.Z) uncompress "$1" ;; - (*.zip|*.war) unzip "$1" -d $extract_dir ;; + (*.zip|*.war|*.jar) unzip "$1" -d $extract_dir ;; (*.rar) unrar x -ad "$1" ;; (*.7z) 7za x "$1" ;; (*.deb) From f05b1f07387fed5b7418995df19989b301f3cd9c Mon Sep 17 00:00:00 2001 From: futjikato Date: Fri, 4 Oct 2013 22:29:33 +0200 Subject: [PATCH 31/33] Added gitignore plugin ( for gitignore.io ) --- custom/plugins/gitignore/gitignore.plugin.zsh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 custom/plugins/gitignore/gitignore.plugin.zsh diff --git a/custom/plugins/gitignore/gitignore.plugin.zsh b/custom/plugins/gitignore/gitignore.plugin.zsh new file mode 100644 index 000000000..1b866c0d0 --- /dev/null +++ b/custom/plugins/gitignore/gitignore.plugin.zsh @@ -0,0 +1,11 @@ +function gi() { curl http://gitignore.io/api/$@ ;} + +_gitignireio_get_command_list() { + curl -s http://gitignore.io/api/list | tr "," "\n" +} + +_gitignireio () { + compadd `_gitignireio_get_command_list` +} + +compdef _gitignireio gi \ No newline at end of file From 7e452c41c0b87b8c2046f81e371a3d72f4ba490f Mon Sep 17 00:00:00 2001 From: futjikato Date: Sat, 5 Oct 2013 00:56:17 +0200 Subject: [PATCH 32/33] Updated completion to work with comma seperated list --- custom/plugins/gitignore/gitignore.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom/plugins/gitignore/gitignore.plugin.zsh b/custom/plugins/gitignore/gitignore.plugin.zsh index 1b866c0d0..332497cec 100644 --- a/custom/plugins/gitignore/gitignore.plugin.zsh +++ b/custom/plugins/gitignore/gitignore.plugin.zsh @@ -5,7 +5,8 @@ _gitignireio_get_command_list() { } _gitignireio () { - compadd `_gitignireio_get_command_list` + compset -P '*,' + compadd -S '' `_gitignireio_get_command_list` } compdef _gitignireio gi \ No newline at end of file From 3da5eb59b720e871cdd531bcc3c5ad018c52923e Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Sat, 18 Jan 2014 12:45:41 -0800 Subject: [PATCH 33/33] Fixes for iTerm2 Tmux integration --- plugins/tmux/tmux.plugin.zsh | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index a3f64a8e7..9eec74bbd 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -46,7 +46,7 @@ if which tmux &> /dev/null fi # Set the correct local config file to use. - if [[ "$ZSH_TMUX_ITERM2" == "false" ]] && [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] + if [[ "$ZSH_TMUX_ITERM2" == "false" ]] && [[ -e "$HOME/.tmux.conf" ]] then #use this when they have a ~/.tmux.conf export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.extra.conf" @@ -58,19 +58,37 @@ if which tmux &> /dev/null # Wrapper function for tmux. function _zsh_tmux_plugin_run() { + if [[ "$ZSH_TMUX_ITERM2" == "true" ]] + then _fix='-CC' + else _fix='' + fi + if [[ "$ZSH_TMUX_FIXTERM" == "true" && "$ZSH_TMUX_ITERM2" == "false" ]] + then _file="-f $_ZSH_TMUX_FIXED_CONFIG" + else _file='' # Can't use -f with -CC + fi + if [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] + then _exit='exit' + else _exit='' + fi # We have other arguments, just run them if [[ -n "$@" ]] then - tmux $@ + tmux "$@" # Try to connect to an existing session. elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] then - tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` attach || tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session - [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit + if (tmux has) + then + \tmux $_fix attach + $_exit + else + \tmux $_fix $_file new + $_exit + fi # Just run tmux, fixing the TERM variable if requested. else - tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` - [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit + \tmux $_fix $_file new + $_exit fi }