From e5f77b8f0496e5915383f2f456f91a20f5ff4ace Mon Sep 17 00:00:00 2001 From: Justin Riley Date: Thu, 28 Apr 2011 15:05:52 -0400 Subject: [PATCH 001/113] add git-prompt plugin from olivierverdier/zsh-git-prompt --- plugins/git-prompt/git-prompt.plugin.zsh | 60 +++++++++++++++++++++ plugins/git-prompt/gitstatus.py | 68 ++++++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 plugins/git-prompt/git-prompt.plugin.zsh create mode 100644 plugins/git-prompt/gitstatus.py diff --git a/plugins/git-prompt/git-prompt.plugin.zsh b/plugins/git-prompt/git-prompt.plugin.zsh new file mode 100644 index 000000000..01b8a88d9 --- /dev/null +++ b/plugins/git-prompt/git-prompt.plugin.zsh @@ -0,0 +1,60 @@ +# ZSH Git Prompt Plugin from: +# http://github.com/olivierverdier/zsh-git-prompt +# +export __GIT_PROMPT_DIR=$ZSH/plugins/git-prompt +# Initialize colors. +autoload -U colors +colors + +# Allow for functions in the prompt. +setopt PROMPT_SUBST + +## Enable auto-execution of functions. +typeset -ga preexec_functions +typeset -ga precmd_functions +typeset -ga chpwd_functions + +# Append git functions needed for prompt. +preexec_functions+='preexec_update_git_vars' +precmd_functions+='precmd_update_git_vars' +chpwd_functions+='chpwd_update_git_vars' + +## Function definitions +function preexec_update_git_vars() { + case "$2" in + git*) + __EXECUTED_GIT_COMMAND=1 + ;; + esac +} + +function precmd_update_git_vars() { + if [ -n "$__EXECUTED_GIT_COMMAND" ]; then + update_current_git_vars + unset __EXECUTED_GIT_COMMAND + fi +} + +function chpwd_update_git_vars() { + update_current_git_vars +} + +function update_current_git_vars() { + unset __CURRENT_GIT_STATUS + + local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py" + _GIT_STATUS=`python ${gitstatus}` + __CURRENT_GIT_STATUS=("${(f)_GIT_STATUS}") +} + +function prompt_git_info() { + if [ -n "$__CURRENT_GIT_STATUS" ]; then + echo "(%{${fg[red]}%}$__CURRENT_GIT_STATUS[1]%{${fg[default]}%}$__CURRENT_GIT_STATUS[2]%{${fg[magenta]}%}$__CURRENT_GIT_STATUS[3]%{${fg[default]}%})" + fi +} + +# Set the prompt. +#PROMPT='%B%m%~%b$(prompt_git_info) %# ' +# for a right prompt: +#RPROMPT='%b$(prompt_git_info)' +RPROMPT='$(prompt_git_info)' diff --git a/plugins/git-prompt/gitstatus.py b/plugins/git-prompt/gitstatus.py new file mode 100644 index 000000000..ee6fab9bd --- /dev/null +++ b/plugins/git-prompt/gitstatus.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# -*- coding: UTF-8 -*- + +# change those symbols to whatever you prefer +symbols = {'ahead of': '↑', 'behind': '↓', 'staged':'♦', 'changed':'‣', 'untracked':'…', 'clean':'⚡', 'unmerged':'≠', 'sha1':':'} + +from subprocess import Popen, PIPE + +output,error = Popen(['git','status'], stdout=PIPE, stderr=PIPE).communicate() + +if error: + import sys + sys.exit(0) +lines = output.splitlines() + +import re +behead_re = re.compile(r"^# Your branch is (ahead of|behind) '(.*)' by (\d+) commit") +diverge_re = re.compile(r"^# and have (\d+) and (\d+) different") + +status = '' +staged = re.compile(r'^# Changes to be committed:$', re.MULTILINE) +changed = re.compile(r'^# Changed but not updated:$', re.MULTILINE) +untracked = re.compile(r'^# Untracked files:$', re.MULTILINE) +unmerged = re.compile(r'^# Unmerged paths:$', re.MULTILINE) + +def execute(*command): + out, err = Popen(stdout=PIPE, stderr=PIPE, *command).communicate() + if not err: + nb = len(out.splitlines()) + else: + nb = '?' + return nb + +if staged.search(output): + nb = execute(['git','diff','--staged','--name-only','--diff-filter=ACDMRT']) + status += '%s%s' % (symbols['staged'], nb) +if unmerged.search(output): + nb = execute(['git','diff', '--staged','--name-only', '--diff-filter=U']) + status += '%s%s' % (symbols['unmerged'], nb) +if changed.search(output): + nb = execute(['git','diff','--name-only', '--diff-filter=ACDMRT']) + status += '%s%s' % (symbols['changed'], nb) +if untracked.search(output): +## nb = len(Popen(['git','ls-files','--others','--exclude-standard'],stdout=PIPE).communicate()[0].splitlines()) +## status += "%s" % (symbols['untracked']*(nb//3 + 1), ) + status += symbols['untracked'] +if status == '': + status = symbols['clean'] + +remote = '' + +bline = lines[0] +if bline.find('Not currently on any branch') != -1: + branch = symbols['sha1']+ Popen(['git','rev-parse','--short','HEAD'], stdout=PIPE).communicate()[0][:-1] +else: + branch = bline.split(' ')[3] + bstatusline = lines[1] + match = behead_re.match(bstatusline) + if match: + remote = symbols[match.groups()[0]] + remote += match.groups()[2] + elif lines[2:]: + div_match = diverge_re.match(lines[2]) + if div_match: + remote = "{behind}{1}{ahead of}{0}".format(*div_match.groups(), **symbols) + +print '\n'.join([branch,remote,status]) + From f20cfc68e81be754521672541fd6ff25983f402c Mon Sep 17 00:00:00 2001 From: Randy Hancock Date: Mon, 1 Aug 2011 10:10:42 -0500 Subject: [PATCH 002/113] Fix edit-command-line binding This binding doesn't work when the edit-command-line.zsh file is loaded after the key-bindings.zsh file because 'bindkey -e' in key-bindings.zsh resets the binding. Moving the bindings to they key-bindings.zsh file and removing edit-command-line.zsh. --- lib/edit-command-line.zsh | 3 --- lib/key-bindings.zsh | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) delete mode 100644 lib/edit-command-line.zsh diff --git a/lib/edit-command-line.zsh b/lib/edit-command-line.zsh deleted file mode 100644 index db2000325..000000000 --- a/lib/edit-command-line.zsh +++ /dev/null @@ -1,3 +0,0 @@ -autoload -U edit-command-line -zle -N edit-command-line -bindkey '\C-x\C-e' edit-command-line diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 9c2dda35a..d9611b557 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -26,6 +26,11 @@ bindkey "^[[3~" delete-char bindkey "^[3;5~" delete-char bindkey "\e[3~" delete-char +# Edit the current command line in $EDITOR +autoload -U edit-command-line +zle -N edit-command-line +bindkey '\C-x\C-e' edit-command-line + # consider emacs keybindings: #bindkey -e ## emacs key bindings From deb8543bb48eb8bde85e2285ac9ce276113c433b Mon Sep 17 00:00:00 2001 From: "Marco A. Peraza" Date: Thu, 29 Sep 2011 14:39:09 -0400 Subject: [PATCH 003/113] Show if you're ahead of remote in the wedisagree theme --- themes/wedisagree.zsh-theme | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/themes/wedisagree.zsh-theme b/themes/wedisagree.zsh-theme index 7cb27934d..9bdbce40d 100644 --- a/themes/wedisagree.zsh-theme +++ b/themes/wedisagree.zsh-theme @@ -25,7 +25,7 @@ PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}' # The right-hand prompt -RPROMPT='${time} %{$fg[magenta]%}$(git_prompt_info)%{$reset_color%}$(git_prompt_status)%{$reset_color%}' +RPROMPT='${time} %{$fg[magenta]%}$(git_prompt_info)%{$reset_color%}$(git_prompt_status)%{$reset_color%}$(git_prompt_ahead)%{$reset_color%}' # Add this at the start of RPROMPT to include rvm info showing ruby-version@gemset-name # %{$fg[yellow]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%} @@ -46,6 +46,7 @@ ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ⚡" # ⓜ ⑁ ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" # ⓧ ⑂ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➜" # ⓡ ⑄ ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ♒" # ⓤ ⑊ +ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[blue]%} 𝝙" # More symbols to choose from: # ☀ ✹ ☄ ♆ ♀ ♁ ♐ ♇ ♈ ♉ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♣ ⚢ ⚲ ⚳ ⚴ ⚥ ⚤ ⚦ ⚒ ⚑ ⚐ ♺ ♻ ♼ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷ @@ -104,4 +105,4 @@ function git_time_since_commit() { echo "($(rvm_gemset)$COLOR~|" fi fi -} \ No newline at end of file +} From 9e3776f1ecbaa29d646cdfe8fc204597ca98746c Mon Sep 17 00:00:00 2001 From: Max Masnick Date: Sun, 30 Oct 2011 21:43:53 -0400 Subject: [PATCH 004/113] update fino theme to work with rbenv also fix bug where prompt char did not reflect whether or not you were in a git repo. --- themes/fino.zsh-theme | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/themes/fino.zsh-theme b/themes/fino.zsh-theme index 17cf59708..a7a63f661 100644 --- a/themes/fino.zsh-theme +++ b/themes/fino.zsh-theme @@ -1,7 +1,7 @@ # Fino theme by Max Masnick (http://max.masnick.me) # Use with a dark background and 256-color terminal! -# Meant for people with RVM and git. Tested only on OS X 10.7. +# Meant for people with rbenv and git. Tested only on OS X 10.7. # You can set your computer name in the ~/.box-name file if you want. @@ -11,27 +11,24 @@ # # Also borrowing from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/ -function virtualenv_info { - [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' -} function prompt_char { - git branch >/dev/null 2>/dev/null && echo '±' && return - echo '○' + git branch >/dev/null 2>/dev/null && echo "±" && return + echo '○' } function box_name { [ -f ~/.box-name ] && cat ~/.box-name || hostname -s } - -local rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}' local current_dir='${PWD/#$HOME/~}' local git_info='$(git_prompt_info)' +local prompt_char='$(prompt_char)' +local rbenv_version='$(rbenv version-name)' -PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}using%{$FG[243]%} ${rvm_ruby} -╰─$(virtualenv_info)$(prompt_char) " +PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}using%{$FG[243]%} ‹${rbenv_version}›%{$reset_color%} +╰─${prompt_char} " ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" From 77045230f4e2c80f4f312fbbeeb8583a41aa5a92 Mon Sep 17 00:00:00 2001 From: Philip Hofstetter Date: Wed, 28 Dec 2011 15:54:47 +0100 Subject: [PATCH 005/113] make pygmalion theme use two lines when needed if the length of the prompt (excluding color escapes) exceeds 40 characters, emit the arrow prompt on its own line This helps a lot on smaller terminals --- themes/pygmalion.zsh-theme | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/themes/pygmalion.zsh-theme b/themes/pygmalion.zsh-theme index cf3bb908f..435c05830 100644 --- a/themes/pygmalion.zsh-theme +++ b/themes/pygmalion.zsh-theme @@ -1,9 +1,34 @@ # Yay! High voltage and arrows! -ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="" +prompt_setup_pygmalion(){ + ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " + ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + base_prompt='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}' + post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} ' + + base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") + post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g") + + add-zsh-hook precmd prompt_pygmalion_precmd +} + +prompt_pygmalion_precmd(){ + local gitinfo=$(git_prompt_info) + local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g") + local exp_nocolor=$(print -P "$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor") + local prompt_length=${#exp_nocolor} + + local nl="" + + if [[ $prompt_length -gt 40 ]]; then + nl=$'\n%{\r%}'; + fi + PROMPT="$base_prompt$gitinfo$nl$post_prompt" +} + +prompt_setup_pygmalion -PROMPT='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}$(git_prompt_info)%{$fg[cyan]%}⇒%{$reset_color%} ' From 3445dada95f7d5c4730b73ebb8b3abb0e5723e26 Mon Sep 17 00:00:00 2001 From: Philip Hofstetter Date: Thu, 29 Dec 2011 14:35:38 +0100 Subject: [PATCH 006/113] correctly handle path names with spaces --- themes/pygmalion.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/pygmalion.zsh-theme b/themes/pygmalion.zsh-theme index 435c05830..654e0fc37 100644 --- a/themes/pygmalion.zsh-theme +++ b/themes/pygmalion.zsh-theme @@ -18,7 +18,7 @@ prompt_setup_pygmalion(){ prompt_pygmalion_precmd(){ local gitinfo=$(git_prompt_info) local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g") - local exp_nocolor=$(print -P "$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor") + local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")" local prompt_length=${#exp_nocolor} local nl="" From ff7e0648965e027d1b8c995065b5152333a82b7a Mon Sep 17 00:00:00 2001 From: Rach Belaid Date: Sun, 19 Feb 2012 19:54:33 +0000 Subject: [PATCH 007/113] change the color of arrow when the command line return an error --- themes/robbyrussell.zsh-theme | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme index 7b524e82d..24e1e8c52 100644 --- a/themes/robbyrussell.zsh-theme +++ b/themes/robbyrussell.zsh-theme @@ -1,4 +1,5 @@ -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)" +PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" From bcd5b3b52b35a458df87b204119eb18a264a580b Mon Sep 17 00:00:00 2001 From: John Barker Date: Mon, 20 Feb 2012 19:05:27 -0500 Subject: [PATCH 008/113] Added a peepcode theme --- themes/peepcode.zsh-theme | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 themes/peepcode.zsh-theme diff --git a/themes/peepcode.zsh-theme b/themes/peepcode.zsh-theme new file mode 100644 index 000000000..ca2a8862f --- /dev/null +++ b/themes/peepcode.zsh-theme @@ -0,0 +1,44 @@ +# +# Based on Geoffrey Grosenbach's peepcode zsh theme from +# https://github.com/topfunky/zsh-simple +# + +git_repo_path() { + git rev-parse --git-dir 2>/dev/null +} + +git_commit_id() { + git rev-parse --short HEAD 2>/dev/null +} + +git_mode() { + if [[ -e "$repo_path/BISECT_LOG" ]]; then + echo "+bisect" + elif [[ -e "$repo_path/MERGE_HEAD" ]]; then + echo "+merge" + elif [[ -e "$repo_path/rebase" || -e "$repo_path/rebase-apply" || -e "$repo_path/rebase-merge" || -e "$repo_path/../.dotest" ]]; then + echo "+rebase" + fi +} + +git_dirty() { + if [[ "$repo_path" != '.' && `git ls-files -m` != "" ]]; then + echo " %{$fg_bold[grey]%}✗%{$reset_color%}" + fi +} + +git_prompt() { + local cb=$(current_branch) + if [ -n "$cb" ]; then + local repo_path=$(git_repo_path) + echo " %{$fg_bold[grey]%}$cb %{$fg[white]%}$(git_commit_id)%{$reset_color%}$(git_mode)$(git_dirty)" + fi +} + +local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})" + +PROMPT=' +%~ +${smiley} %{$reset_color%}' + +RPROMPT='%{$fg[white]%} $(~/.rvm/bin/rvm-prompt)$(git_prompt)%{$reset_color%}' From 6272b4854c0b13fa778fe7d4f6f9bb12d716299f Mon Sep 17 00:00:00 2001 From: Jeff McClure Date: Mon, 20 Feb 2012 22:37:23 -0500 Subject: [PATCH 009/113] Added New Theme: sonicradish (256 colors) Forked from muse theme and inspired by mustang vim theme Dark Background and Solarized Dark look great [ tested on OS X ] Screenshot: https://img.skitch.com/20120221-eb1cxey5aun84tb1ak7fm376k.png muse: https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/muse.zsh-theme mustang: http://hcalves.deviantart.com/art/Mustang-Vim-Colorscheme-98974484http://hcalves.deviantart.com/art/Mustang-Vim-Colorscheme-98974484 --- themes/sonicradish.zsh-theme | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 themes/sonicradish.zsh-theme diff --git a/themes/sonicradish.zsh-theme b/themes/sonicradish.zsh-theme new file mode 100644 index 000000000..cc7ba1c76 --- /dev/null +++ b/themes/sonicradish.zsh-theme @@ -0,0 +1,39 @@ +#!/usr/bin/env zsh +#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +setopt promptsubst + +autoload -U add-zsh-hook +ROOT_ICON_COLOR=$FG[111] +MACHINE_NAME_COLOR=$FG[208] +PROMPT_SUCCESS_COLOR=$FG[103] +PROMPT_FAILURE_COLOR=$FG[124] +PROMPT_VCS_INFO_COLOR=$FG[242] +PROMPT_PROMPT=$FG[208] +GIT_DIRTY_COLOR=$FG[124] +GIT_CLEAN_COLOR=$FG[148] +GIT_PROMPT_INFO=$FG[148] + +# Hash +ROOT_ICON="# " +if [[ $EUID -ne 0 ]] ; then + ROOT_ICON="" +fi + +PROMPT='%{$ROOT_ICON_COLOR%}$ROOT_ICON%{$reset_color%}%{$MACHINE_NAME_COLOR%}%m➜ %{$reset_color%}%{$PROMPT_SUCCESS_COLOR%}%c%{$reset_color%} %{$GIT_PROMPT_INFO%}$(git_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ %{$reset_color%} ' + +#RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX=": " +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%} :" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔" + +ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[103]%}✚%{$rset_color%}" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[103]%}✹%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[103]%}✖%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[103]%}➜%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[103]%}═%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[103]%}✭%{$reset_color%}" + +export LSCOLORS=dxfxcxdxbxexexabagacad From 867cb3f511fe8d0cad04ae799b595d7b0c86746a Mon Sep 17 00:00:00 2001 From: Jeff McClure Date: Tue, 21 Feb 2012 00:45:33 -0500 Subject: [PATCH 010/113] [JM] Removed LSCOLOR Declaration for Wider Support --- themes/sonicradish.zsh-theme | 2 -- 1 file changed, 2 deletions(-) diff --git a/themes/sonicradish.zsh-theme b/themes/sonicradish.zsh-theme index cc7ba1c76..508611830 100644 --- a/themes/sonicradish.zsh-theme +++ b/themes/sonicradish.zsh-theme @@ -35,5 +35,3 @@ ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[103]%}✖%{$reset_color%}" ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[103]%}➜%{$reset_color%}" ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[103]%}═%{$reset_color%}" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[103]%}✭%{$reset_color%}" - -export LSCOLORS=dxfxcxdxbxexexabagacad From d49e98267a741075f889808b04b1f0c699917f8a Mon Sep 17 00:00:00 2001 From: Max Masnick Date: Sat, 25 Feb 2012 16:16:43 -0500 Subject: [PATCH 011/113] clean up rbenv support for 'fino' theme --- themes/fino.zsh-theme | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/themes/fino.zsh-theme b/themes/fino.zsh-theme index 2159e54a8..4c7aabcff 100644 --- a/themes/fino.zsh-theme +++ b/themes/fino.zsh-theme @@ -21,22 +21,21 @@ function box_name { [ -f ~/.box-name ] && cat ~/.box-name || hostname -s } -local rvm_ruby='' +local ruby_env='' if which rvm-prompt &> /dev/null; then - rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}' + ruby_env=' ‹$(rvm-prompt i v g)›%{$reset_color%}' else if which rbenv &> /dev/null; then - rvm_ruby='‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}' + ruby_env=' ‹$(rbenv version-name)›%{$reset_color%}' fi fi local current_dir='${PWD/#$HOME/~}' local git_info='$(git_prompt_info)' local prompt_char='$(prompt_char)' -local rbenv_version='$(rbenv version-name)' -PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}using%{$FG[243]%} ‹${rbenv_version}›%{$reset_color%} +PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}using%{$FG[243]%}${ruby_env} ╰─${prompt_char} " ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}" From ce6a21c3b3c6b0fb6a8b8a2cb20991fec91ec86a Mon Sep 17 00:00:00 2001 From: Piotr Solnica Date: Fri, 23 Mar 2012 20:31:13 +0100 Subject: [PATCH 012/113] [themes/josh] Use $(current_branch) in prompt --- themes/josh.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/josh.zsh-theme b/themes/josh.zsh-theme index 142e76838..12dfe4069 100644 --- a/themes/josh.zsh-theme +++ b/themes/josh.zsh-theme @@ -31,7 +31,7 @@ function josh_prompt { prompt=" $prompt" done - prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(git_prompt_info)" + prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(current_branch)" echo $prompt } From dbef8b1a92f789f4109435a3b7278f899e328767 Mon Sep 17 00:00:00 2001 From: mapc Date: Sat, 5 May 2012 10:39:05 +0200 Subject: [PATCH 013/113] Add helper to get the value of an alias only --- lib/functions.zsh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lib/functions.zsh b/lib/functions.zsh index d2dcadd0c..b4d89a64a 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -15,3 +15,33 @@ function take() { cd $1 } +# +# Get the value of an alias. +# +# Arguments: +# 1. alias - The alias to get its value from +# STDOUT: +# The value of alias $1 (if it has one). +# Return value: +# 0 if the alias was found, +# 1 if it does not exist +# +function alias_value() { + alias "$1" | sed "s/^$1='\(.*\)'$/\1/" + test $(alias "$1") +} + +# +# Try to get the value of an alias, +# otherwise return the input. +# +# Arguments: +# 1. alias - The alias to get its value from +# STDOUT: +# The value of alias $1, or $1 if there is no alias $1. +# Return value: +# Always 0 +# +function try_alias_value() { + alias_value "$1" || echo "$1" +} \ No newline at end of file From 8f71efc09b42d69cc053649fade92485d282a561 Mon Sep 17 00:00:00 2001 From: mapc Date: Sat, 5 May 2012 10:39:31 +0200 Subject: [PATCH 014/113] Add helper to easily define default values for variables and env variables. --- lib/functions.zsh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/functions.zsh b/lib/functions.zsh index b4d89a64a..3770d4e82 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -44,4 +44,32 @@ function alias_value() { # function try_alias_value() { alias_value "$1" || echo "$1" +} + +# +# Set variable "$1" to default value "$2" if "$1" is not yet defined. +# +# Arguments: +# 1. name - The variable to set +# 2. val - The default value +# Return value: +# 0 if the variable exists, 3 if it was set +# +function default() { + test `typeset +m "$1"` && return 0 + typeset -g "$1"="$2" && return 3 +} + +# +# Set enviroment variable "$1" to default value "$2" if "$1" is not yet defined. +# +# Arguments: +# 1. name - The env variable to set +# 2. val - The default value +# Return value: +# 0 if the env variable exists, 3 if it was set +# +function env_default() { + env | grep -q "^$1=" && return 0 + export "$1=$2" && return 3 } \ No newline at end of file From fcb153c2e32641bb13649bfdd8d3bbe8c17798c8 Mon Sep 17 00:00:00 2001 From: mapc Date: Sat, 5 May 2012 00:05:50 +0200 Subject: [PATCH 015/113] Add the singlechar plugin --- plugins/singlechar/singlechar.plugin.zsh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 plugins/singlechar/singlechar.plugin.zsh diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh new file mode 100644 index 000000000..1440a6237 --- /dev/null +++ b/plugins/singlechar/singlechar.plugin.zsh @@ -0,0 +1,24 @@ +########################### +# Settings +# +# These can be overwritten any time. +# If they are not set yet, they will be +# overwritten with their default values + +default GREP grep +default ROOT sudo + +########################### +# Alias + +alias y='"$GREP" -i' +alias n='"$GREP" -vi' + +alias x='xargs' +alias xy='xargs "$GREP" -i' +alias xn='xargs "$GREP" -iv' + +alias s='"$ROOT"' +alias sx='"$ROOT" xargs' +alias sxy='"$ROOT" xargs "$GREP" -i' +alias sxn='"$ROOT" xargs "$GREP" -iv' \ No newline at end of file From f970d8206e9245eb2f78728623fdfff354402644 Mon Sep 17 00:00:00 2001 From: mapc Date: Sat, 5 May 2012 10:52:46 +0200 Subject: [PATCH 016/113] Add cat (+write, +append), enhance formatting --- plugins/singlechar/singlechar.plugin.zsh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh index 1440a6237..3635dd19a 100644 --- a/plugins/singlechar/singlechar.plugin.zsh +++ b/plugins/singlechar/singlechar.plugin.zsh @@ -11,14 +11,35 @@ default ROOT sudo ########################### # Alias +# CAT, GREP + alias y='"$GREP" -i' alias n='"$GREP" -vi' +alias c='cat' +alias w='cat >' +alias a='cat >>' + +# XARGS + alias x='xargs' + alias xy='xargs "$GREP" -i' alias xn='xargs "$GREP" -iv' +alias xc='xargs cat' +alias xw='xargs cat >' +alias xa='xargs cat >>' + +# SUDO + alias s='"$ROOT"' + alias sx='"$ROOT" xargs' + alias sxy='"$ROOT" xargs "$GREP" -i' -alias sxn='"$ROOT" xargs "$GREP" -iv' \ No newline at end of file +alias sxn='"$ROOT" xargs "$GREP" -iv' + +alias sxc='"$ROOT" xargs cat' +alias sxw='"$ROOT" xargs cat >' +alias sxa='"$ROOT" xargs cat >>' From 4c0b5c71d5332f6961156fc1cda0ab9cc54b8787 Mon Sep 17 00:00:00 2001 From: mapc Date: Sat, 5 May 2012 10:58:55 +0200 Subject: [PATCH 017/113] Add a description --- plugins/singlechar/singlechar.plugin.zsh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh index 3635dd19a..06fa78b9c 100644 --- a/plugins/singlechar/singlechar.plugin.zsh +++ b/plugins/singlechar/singlechar.plugin.zsh @@ -1,6 +1,16 @@ +################################################################################ +# FILE: singlechar.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Michael Varner (musikmichael@web.de) +# VERSION: 1.0.0 +# +# This plugin adds single char shortcuts (and combinations) for some commands. +# +################################################################################ + ########################### # Settings -# + # These can be overwritten any time. # If they are not set yet, they will be # overwritten with their default values From e0b271264460219e624ac378c40421490a8e193c Mon Sep 17 00:00:00 2001 From: mapc Date: Sat, 5 May 2012 16:03:48 +0200 Subject: [PATCH 018/113] Add download shortcuts --- plugins/singlechar/singlechar.plugin.zsh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh index 06fa78b9c..f4517d274 100644 --- a/plugins/singlechar/singlechar.plugin.zsh +++ b/plugins/singlechar/singlechar.plugin.zsh @@ -17,11 +17,13 @@ default GREP grep default ROOT sudo +default WGET wget +default CURL curl ########################### # Alias -# CAT, GREP +# CAT, GREP, CURL, WGET alias y='"$GREP" -i' alias n='"$GREP" -vi' @@ -30,6 +32,9 @@ alias c='cat' alias w='cat >' alias a='cat >>' +alias d='"$WGET"' +alias u='"$CURL"' + # XARGS alias x='xargs' @@ -41,6 +46,9 @@ alias xc='xargs cat' alias xw='xargs cat >' alias xa='xargs cat >>' +alias xd='xargs "$WGET"' +alias xu='xargs "$CURL"' + # SUDO alias s='"$ROOT"' @@ -53,3 +61,6 @@ alias sxn='"$ROOT" xargs "$GREP" -iv' alias sxc='"$ROOT" xargs cat' alias sxw='"$ROOT" xargs cat >' alias sxa='"$ROOT" xargs cat >>' + +alias sxd='"$ROOT" xargs "$WGET"' +alias sxu='"$ROOT" xargs "$CURL"' \ No newline at end of file From 712f850f3a860e87458d35a7d8ebba13b9975a06 Mon Sep 17 00:00:00 2001 From: mapc Date: Sat, 5 May 2012 16:07:05 +0200 Subject: [PATCH 019/113] Add pager shortcuts --- plugins/singlechar/singlechar.plugin.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh index f4517d274..aadcde423 100644 --- a/plugins/singlechar/singlechar.plugin.zsh +++ b/plugins/singlechar/singlechar.plugin.zsh @@ -20,6 +20,8 @@ default ROOT sudo default WGET wget default CURL curl +env_defaul PAGER less + ########################### # Alias @@ -32,6 +34,8 @@ alias c='cat' alias w='cat >' alias a='cat >>' +alias p='"$PAGER"' + alias d='"$WGET"' alias u='"$CURL"' @@ -46,6 +50,8 @@ alias xc='xargs cat' alias xw='xargs cat >' alias xa='xargs cat >>' +alias xp='xargs "$PAGER"' + alias xd='xargs "$WGET"' alias xu='xargs "$CURL"' @@ -62,5 +68,7 @@ alias sxc='"$ROOT" xargs cat' alias sxw='"$ROOT" xargs cat >' alias sxa='"$ROOT" xargs cat >>' +alias sxp='"$ROOT" xargs "$PAGER"' + alias sxd='"$ROOT" xargs "$WGET"' alias sxu='"$ROOT" xargs "$CURL"' \ No newline at end of file From 6f5599474f31516cec641242c0bdb391d8930cf2 Mon Sep 17 00:00:00 2001 From: mapc Date: Sat, 5 May 2012 16:08:40 +0200 Subject: [PATCH 020/113] Add sudo without xargs shortcuts --- plugins/singlechar/singlechar.plugin.zsh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh index aadcde423..0a815736d 100644 --- a/plugins/singlechar/singlechar.plugin.zsh +++ b/plugins/singlechar/singlechar.plugin.zsh @@ -59,6 +59,19 @@ alias xu='xargs "$CURL"' alias s='"$ROOT"' +alias sy='"$ROOT" "$GREP" -i' +alias sn='"$ROOT" "$GREP" -iv' + +alias sc='"$ROOT" cat' +alias sw='"$ROOT" cat >' +alias sa='"$ROOT" cat >>' + +alias sp='"$ROOT" "$PAGER"' + +alias sd='"$ROOT" "$WGET"' + +# SUDO-XARGS + alias sx='"$ROOT" xargs' alias sxy='"$ROOT" xargs "$GREP" -i' From 88f3f28e8c634e54e68769d72f2ec40f7c5d35f9 Mon Sep 17 00:00:00 2001 From: mapc Date: Sat, 5 May 2012 16:10:52 +0200 Subject: [PATCH 021/113] env_defaul=>env_default --- plugins/singlechar/singlechar.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh index 0a815736d..b6c9665c5 100644 --- a/plugins/singlechar/singlechar.plugin.zsh +++ b/plugins/singlechar/singlechar.plugin.zsh @@ -20,7 +20,7 @@ default ROOT sudo default WGET wget default CURL curl -env_defaul PAGER less +env_default PAGER less ########################### # Alias From 67290ffca93d3fb7ebeb9253cc551a5632299c16 Mon Sep 17 00:00:00 2001 From: mapc Date: Sat, 5 May 2012 16:17:26 +0200 Subject: [PATCH 022/113] Enhance writing routines --- plugins/singlechar/singlechar.plugin.zsh | 40 ++++++++++++++++-------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh index b6c9665c5..ea9b34324 100644 --- a/plugins/singlechar/singlechar.plugin.zsh +++ b/plugins/singlechar/singlechar.plugin.zsh @@ -30,15 +30,20 @@ env_default PAGER less alias y='"$GREP" -i' alias n='"$GREP" -vi' -alias c='cat' -alias w='cat >' -alias a='cat >>' +alias w='echo >' +alias a='echo >>' +alias c='cat' alias p='"$PAGER"' alias d='"$WGET"' alias u='"$CURL"' +# enhanced writeing + +alias w:='cat >' +alias a:='cat >>' + # XARGS alias x='xargs' @@ -46,15 +51,18 @@ alias x='xargs' alias xy='xargs "$GREP" -i' alias xn='xargs "$GREP" -iv' -alias xc='xargs cat' -alias xw='xargs cat >' -alias xa='xargs cat >>' +alias xw='xargs echo >' +alias xa='xargs echo >>' +alias xc='xargs cat' alias xp='xargs "$PAGER"' alias xd='xargs "$WGET"' alias xu='xargs "$CURL"' +alias xw:='xargs cat >' +alias xa:='xargs >>' + # SUDO alias s='"$ROOT"' @@ -62,14 +70,17 @@ alias s='"$ROOT"' alias sy='"$ROOT" "$GREP" -i' alias sn='"$ROOT" "$GREP" -iv' -alias sc='"$ROOT" cat' -alias sw='"$ROOT" cat >' -alias sa='"$ROOT" cat >>' +alias sw='"$ROOT" echo >' +alias sa='"$ROOT" echo >>' +alias sc='"$ROOT" cat' alias sp='"$ROOT" "$PAGER"' alias sd='"$ROOT" "$WGET"' +alias sw:='"$ROOT" cat >' +alias sa:='"$ROOT" cat >>' + # SUDO-XARGS alias sx='"$ROOT" xargs' @@ -77,11 +88,14 @@ alias sx='"$ROOT" xargs' alias sxy='"$ROOT" xargs "$GREP" -i' alias sxn='"$ROOT" xargs "$GREP" -iv' -alias sxc='"$ROOT" xargs cat' -alias sxw='"$ROOT" xargs cat >' -alias sxa='"$ROOT" xargs cat >>' +alias sxw='"$ROOT" xargs echo >' +alias sxa='"$ROOT" xargs echo >>' +alias sxc='"$ROOT" xargs cat' alias sxp='"$ROOT" xargs "$PAGER"' alias sxd='"$ROOT" xargs "$WGET"' -alias sxu='"$ROOT" xargs "$CURL"' \ No newline at end of file +alias sxu='"$ROOT" xargs "$CURL"' + +alias sxw:='"$ROOT" xargs cat >' +alias sxa:='"$ROOT" xargs cat >>' \ No newline at end of file From 3af5cf3b1d40312101dae89c1d43c9d6afef8fcd Mon Sep 17 00:00:00 2001 From: mapc Date: Thu, 10 May 2012 09:21:50 +0200 Subject: [PATCH 023/113] Add file finders --- plugins/singlechar/singlechar.plugin.zsh | 26 +++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh index ea9b34324..cd5191cbd 100644 --- a/plugins/singlechar/singlechar.plugin.zsh +++ b/plugins/singlechar/singlechar.plugin.zsh @@ -30,6 +30,12 @@ env_default PAGER less alias y='"$GREP" -i' alias n='"$GREP" -vi' +alias f.='find .' +alias f:='find' + +alias f='"$GREP" -li' +alias fn='"$GREP" -lvi' + alias w='echo >' alias a='echo >>' @@ -39,7 +45,7 @@ alias p='"$PAGER"' alias d='"$WGET"' alias u='"$CURL"' -# enhanced writeing +# enhanced writing alias w:='cat >' alias a:='cat >>' @@ -51,6 +57,12 @@ alias x='xargs' alias xy='xargs "$GREP" -i' alias xn='xargs "$GREP" -iv' +alias xf.='xargs find .' +alias xf:='xargs find' + +alias xf='xargs "$GREP" -li' +alias xfn='xargs "$GREP" -lvi' + alias xw='xargs echo >' alias xa='xargs echo >>' @@ -70,6 +82,12 @@ alias s='"$ROOT"' alias sy='"$ROOT" "$GREP" -i' alias sn='"$ROOT" "$GREP" -iv' +alias xf.='"$ROOT" find .' +alias xf:='"$ROOT" find' + +alias xf='"$ROOT" "$GREP" -li' +alias xfn='"$ROOT" "$GREP" -lvi' + alias sw='"$ROOT" echo >' alias sa='"$ROOT" echo >>' @@ -88,6 +106,12 @@ alias sx='"$ROOT" xargs' alias sxy='"$ROOT" xargs "$GREP" -i' alias sxn='"$ROOT" xargs "$GREP" -iv' +alias sxf.='"$ROOT" xargs find .' +alias sxf:='"$ROOT" xargs find' + +alias sxf='"$ROOT" xargs "$GREP" -li' +alias sxfn='"$ROOT" xargs "$GREP" -lvi' + alias sxw='"$ROOT" xargs echo >' alias sxa='"$ROOT" xargs echo >>' From 7a338ab6a5208a9f9b9fcbf69d225159fc4ae600 Mon Sep 17 00:00:00 2001 From: mapc Date: Thu, 10 May 2012 09:35:29 +0200 Subject: [PATCH 024/113] Add Man --- plugins/singlechar/singlechar.plugin.zsh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh index cd5191cbd..d44a0e80f 100644 --- a/plugins/singlechar/singlechar.plugin.zsh +++ b/plugins/singlechar/singlechar.plugin.zsh @@ -42,6 +42,8 @@ alias a='echo >>' alias c='cat' alias p='"$PAGER"' +alias m='man' + alias d='"$WGET"' alias u='"$CURL"' @@ -69,6 +71,8 @@ alias xa='xargs echo >>' alias xc='xargs cat' alias xp='xargs "$PAGER"' +alias xm='xargs man' + alias xd='xargs "$WGET"' alias xu='xargs "$CURL"' @@ -82,11 +86,11 @@ alias s='"$ROOT"' alias sy='"$ROOT" "$GREP" -i' alias sn='"$ROOT" "$GREP" -iv' -alias xf.='"$ROOT" find .' -alias xf:='"$ROOT" find' +alias sf.='"$ROOT" find .' +alias sf:='"$ROOT" find' -alias xf='"$ROOT" "$GREP" -li' -alias xfn='"$ROOT" "$GREP" -lvi' +alias sf='"$ROOT" "$GREP" -li' +alias sfn='"$ROOT" "$GREP" -lvi' alias sw='"$ROOT" echo >' alias sa='"$ROOT" echo >>' @@ -94,6 +98,8 @@ alias sa='"$ROOT" echo >>' alias sc='"$ROOT" cat' alias sp='"$ROOT" "$PAGER"' +alias sm='"$ROOT" man' + alias sd='"$ROOT" "$WGET"' alias sw:='"$ROOT" cat >' @@ -118,6 +124,8 @@ alias sxa='"$ROOT" xargs echo >>' alias sxc='"$ROOT" xargs cat' alias sxp='"$ROOT" xargs "$PAGER"' +alias sxm='"$ROOT" xargs man' + alias sxd='"$ROOT" xargs "$WGET"' alias sxu='"$ROOT" xargs "$CURL"' From d573cddcc937be8c253b97b7343a0670aea3e9b7 Mon Sep 17 00:00:00 2001 From: mapc Date: Tue, 29 May 2012 03:07:15 +0200 Subject: [PATCH 025/113] Enhance file find --- plugins/singlechar/singlechar.plugin.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh index d44a0e80f..4d3e16b12 100644 --- a/plugins/singlechar/singlechar.plugin.zsh +++ b/plugins/singlechar/singlechar.plugin.zsh @@ -30,7 +30,7 @@ env_default PAGER less alias y='"$GREP" -i' alias n='"$GREP" -vi' -alias f.='find .' +alias f.='find . | "$GREP"' alias f:='find' alias f='"$GREP" -li' @@ -59,7 +59,7 @@ alias x='xargs' alias xy='xargs "$GREP" -i' alias xn='xargs "$GREP" -iv' -alias xf.='xargs find .' +alias xf.='xargs find . | "$GREP"' alias xf:='xargs find' alias xf='xargs "$GREP" -li' @@ -86,7 +86,7 @@ alias s='"$ROOT"' alias sy='"$ROOT" "$GREP" -i' alias sn='"$ROOT" "$GREP" -iv' -alias sf.='"$ROOT" find .' +alias sf.='"$ROOT" find . | "$GREP"' alias sf:='"$ROOT" find' alias sf='"$ROOT" "$GREP" -li' @@ -112,7 +112,7 @@ alias sx='"$ROOT" xargs' alias sxy='"$ROOT" xargs "$GREP" -i' alias sxn='"$ROOT" xargs "$GREP" -iv' -alias sxf.='"$ROOT" xargs find .' +alias sxf.='"$ROOT" xargs find . | "$GREP"' alias sxf:='"$ROOT" xargs find' alias sxf='"$ROOT" xargs "$GREP" -li' From b1977d4049cbb7fd203f53511c1067a17150d3e4 Mon Sep 17 00:00:00 2001 From: mapc Date: Sun, 13 May 2012 10:22:45 +0200 Subject: [PATCH 026/113] Make grep recoursive --- plugins/singlechar/singlechar.plugin.zsh | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh index 4d3e16b12..58837407d 100644 --- a/plugins/singlechar/singlechar.plugin.zsh +++ b/plugins/singlechar/singlechar.plugin.zsh @@ -27,14 +27,14 @@ env_default PAGER less # CAT, GREP, CURL, WGET -alias y='"$GREP" -i' -alias n='"$GREP" -vi' +alias y='"$GREP" -Ri' +alias n='"$GREP" -Rvi' alias f.='find . | "$GREP"' alias f:='find' -alias f='"$GREP" -li' -alias fn='"$GREP" -lvi' +alias f='"$GREP" -Rli' +alias fn='"$GREP" -Rlvi' alias w='echo >' alias a='echo >>' @@ -56,14 +56,14 @@ alias a:='cat >>' alias x='xargs' -alias xy='xargs "$GREP" -i' -alias xn='xargs "$GREP" -iv' +alias xy='xargs "$GREP" -Ri' +alias xn='xargs "$GREP" -Riv' alias xf.='xargs find . | "$GREP"' alias xf:='xargs find' -alias xf='xargs "$GREP" -li' -alias xfn='xargs "$GREP" -lvi' +alias xf='xargs "$GREP" -Rli' +alias xfn='xargs "$GREP" -Rlvi' alias xw='xargs echo >' alias xa='xargs echo >>' @@ -83,14 +83,14 @@ alias xa:='xargs >>' alias s='"$ROOT"' -alias sy='"$ROOT" "$GREP" -i' -alias sn='"$ROOT" "$GREP" -iv' +alias sy='"$ROOT" "$GREP" -Ri' +alias sn='"$ROOT" "$GREP" -Riv' alias sf.='"$ROOT" find . | "$GREP"' alias sf:='"$ROOT" find' -alias sf='"$ROOT" "$GREP" -li' -alias sfn='"$ROOT" "$GREP" -lvi' +alias sf='"$ROOT" "$GREP" -Rli' +alias sfn='"$ROOT" "$GREP" -Rlvi' alias sw='"$ROOT" echo >' alias sa='"$ROOT" echo >>' @@ -109,8 +109,8 @@ alias sa:='"$ROOT" cat >>' alias sx='"$ROOT" xargs' -alias sxy='"$ROOT" xargs "$GREP" -i' -alias sxn='"$ROOT" xargs "$GREP" -iv' +alias sxy='"$ROOT" xargs "$GREP" -Ri' +alias sxn='"$ROOT" xargs "$GREP" -Riv' alias sxf.='"$ROOT" xargs find . | "$GREP"' alias sxf:='"$ROOT" xargs find' From 0f35726a003e133daf8879aa05ba276ed565c0dd Mon Sep 17 00:00:00 2001 From: mapc Date: Sun, 13 May 2012 10:23:20 +0200 Subject: [PATCH 027/113] Make (s)xf not search in current dir --- plugins/singlechar/singlechar.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh index 58837407d..44bd998aa 100644 --- a/plugins/singlechar/singlechar.plugin.zsh +++ b/plugins/singlechar/singlechar.plugin.zsh @@ -59,7 +59,7 @@ alias x='xargs' alias xy='xargs "$GREP" -Ri' alias xn='xargs "$GREP" -Riv' -alias xf.='xargs find . | "$GREP"' +alias xf.='xargs find | "$GREP"' alias xf:='xargs find' alias xf='xargs "$GREP" -Rli' @@ -112,7 +112,7 @@ alias sx='"$ROOT" xargs' alias sxy='"$ROOT" xargs "$GREP" -Ri' alias sxn='"$ROOT" xargs "$GREP" -Riv' -alias sxf.='"$ROOT" xargs find . | "$GREP"' +alias sxf.='"$ROOT" xargs find | "$GREP"' alias sxf:='"$ROOT" xargs find' alias sxf='"$ROOT" xargs "$GREP" -li' From b7bad0f69b064225a4557667eb1e95d3df8ad819 Mon Sep 17 00:00:00 2001 From: mapc Date: Sun, 6 May 2012 00:05:22 +0200 Subject: [PATCH 028/113] Add the fastfile plugin --- plugins/fastfile/fastfile.plugin.zsh | 128 +++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 plugins/fastfile/fastfile.plugin.zsh diff --git a/plugins/fastfile/fastfile.plugin.zsh b/plugins/fastfile/fastfile.plugin.zsh new file mode 100644 index 000000000..51e48df5b --- /dev/null +++ b/plugins/fastfile/fastfile.plugin.zsh @@ -0,0 +1,128 @@ +################################################################################ +# FILE: fastfile.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Michael Varner (musikmichael@web.de) +# VERSION: 1.0.0 +# +# This plugin adds the ability to on the fly generate and access file shortcuts. +# +################################################################################ + +########################### +# Settings + +# These can be overwritten any time. +# If they are not set yet, they will be +# overwritten with their default values + +default fastfile_dir "${HOME}/.fastfile/" +default fastfile_var_prefix "§" + +########################### +# Impl + +# +# Generate a shortcut +# +# Arguments: +# 1. name - The name of the shortcut (default: name of the file) +# 2. file - The file or directory to make the shortcut for +# STDOUT: +# => fastfle_print +# +function fastfile() { + test "$2" || 2="." + 2=$(readlink -f "$2") + test "$1" || 1="$(basename "$2")" + + mkdir -p "${fastfile_dir}" + echo "$2" > "$(fastfile_resolv "$1")" + + fastfile_sync + fastfile_print "$1" +} + +# +# Resolve the location of a shortcut file (the database file, where the value is written!) +# +# Arguments: +# 1. name - The name of the shortcut +# STDOUT: +# The path +# +function fastfile_resolv() { + echo "${fastfile_dir}${1}" +} + +# +# Get the real path of a shortcut +# +# Arguments: +# 1. name - The name of the shortcut +# STDOUT: +# The path +# +function fastfile_get() { + cat "$(fastfile_resolv "$1")" +} + +# +# Print a shortcut +# +# Arguments: +# 1. name - The name of the shortcut +# STDOUT: +# Name and value of the shortcut +# +function fastfile_print() { + echo "${fastfile_var_prefix}${1} -> $(fastfile_get "$1")" +} + +# +# List all shortcuts +# +# STDOUT: +# (=> fastfle_print) for each shortcut +# +function fastfile_ls() { + for f in $(ls "${fastfile_dir}"); do + fastfile_print "$f" + done | column -t +} + +# +# Remove a shortcut +# +# Arguments: +# 1. name - The name of the shortcut (default: name of the file) +# 2. file - The file or directory to make the shortcut for +# STDOUT: +# => fastfle_print +# +function fastfile_rm() { + fastfile_print "$1" + rm "$(fastfile_resolv "$1")" +} + +# +# Generate the aliases for the shortcuts +# +function fastfile_sync() { + for f in $(ls "${fastfile_dir}"); do + alias -g "${fastfile_var_prefix}${f}"="$(fastfile_get "$f")" + done +} + +################################## +# Shortcuts + +alias ff=fastfile +alias ffp=fastfile_print +alias ffrm=fastfile_rm +alias ffls=fastfile_ls +alias ffsync=fastfile_sync + +################################## +# Init + +fastfile_sync \ No newline at end of file From 8c18f007131eb242eacae16db85b07f986b08063 Mon Sep 17 00:00:00 2001 From: mapc Date: Sun, 6 May 2012 22:26:12 +0200 Subject: [PATCH 029/113] Enhance handleing of spaces in filenames --- plugins/fastfile/fastfile.plugin.zsh | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/plugins/fastfile/fastfile.plugin.zsh b/plugins/fastfile/fastfile.plugin.zsh index 51e48df5b..775e9483e 100644 --- a/plugins/fastfile/fastfile.plugin.zsh +++ b/plugins/fastfile/fastfile.plugin.zsh @@ -32,14 +32,17 @@ default fastfile_var_prefix "§" # function fastfile() { test "$2" || 2="." - 2=$(readlink -f "$2") - test "$1" || 1="$(basename "$2")" + file=$(readlink -f "$2") + + test "$1" || 1="$(basename "$file")" + name=$(echo "$1" | tr " " "_") + mkdir -p "${fastfile_dir}" - echo "$2" > "$(fastfile_resolv "$1")" + echo "$file" > "$(fastfile_resolv "$name")" fastfile_sync - fastfile_print "$1" + fastfile_print "$name" } # @@ -85,9 +88,13 @@ function fastfile_print() { # (=> fastfle_print) for each shortcut # function fastfile_ls() { - for f in $(ls "${fastfile_dir}"); do - fastfile_print "$f" - done | column -t + for f in "${fastfile_dir}"/*; do + file=`basename "$f"` # To enable simpler handeling of spaces in file names + varkey=`echo "$file" | tr " " "_"` + + # Special format for colums + echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")" + done | column -t -s "|" } # @@ -108,8 +115,11 @@ function fastfile_rm() { # Generate the aliases for the shortcuts # function fastfile_sync() { - for f in $(ls "${fastfile_dir}"); do - alias -g "${fastfile_var_prefix}${f}"="$(fastfile_get "$f")" + for f in "${fastfile_dir}"/*; do + file=`basename "$f"` # To enable simpler handeling of spaces in file names + varkey=`echo "$file" | tr " " "_"` + + alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'" done } From 0aa4456d5657c957eaf0c54f6eb24e58b9149d4b Mon Sep 17 00:00:00 2001 From: mapc Date: Sat, 30 Jun 2012 01:42:35 +0200 Subject: [PATCH 030/113] Add completion instructions for apt/aptitude commands --- plugins/debian/debian.plugin.zsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index 39d3ef36a..22803ee1b 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -107,6 +107,20 @@ else ?not(~n`uname -r`))'\'' root' fi +# Completion ################################################################ + +# TODO: These definitions won't change between apt-get and uptitude automaticaly +compdef _apt aac="$apt_pref autoclean" +compdef _apt abd="$apt_pref build-dep" +compdef _apt ac="$apt_pref clean" +compdef _apt ad="$apt_pref update" +compdef _apt afu="$apt_pref update" +compdef _apt ag="$apt_pref upgrade" +compdef _apt ai="$apt_pref install" +compdef _apt ail="$apt_pref install" +compdef _apt ap="$apt_pref purge" +compdef _apt ar="$apt_pref remove" +compdef _apt ads="apt-get dselect-upgrade" # Misc. ##################################################################### # print all installed packages From 7d24f4cd407d61a17bd88157c594215ecc3b0bcd Mon Sep 17 00:00:00 2001 From: mapc Date: Sat, 30 Jun 2012 01:42:47 +0200 Subject: [PATCH 031/113] Use a static apt-get where only apt-get works --- plugins/debian/debian.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index 22803ee1b..55e2be06c 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -56,7 +56,7 @@ if [[ $use_sudo -eq 1 ]]; then alias ar='sudo $apt_pref remove' # apt-get only - alias ads='sudo $apt_pref dselect-upgrade' + alias ads='sudo apt-get dselect-upgrade' # Install all .deb files in the current directory. # Warning: you will need to put the glob in single quotes if you use: From e3c87611fc75ff5149b13fdd84ee8c87c7c1d129 Mon Sep 17 00:00:00 2001 From: mapc Date: Sat, 30 Jun 2012 01:44:08 +0200 Subject: [PATCH 032/113] Add myself to the authors list --- plugins/debian/debian.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index 55e2be06c..c556cb0b5 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -1,6 +1,7 @@ # Authors: # https://github.com/AlexBio # https://github.com/dbb +# https://github.com/Mappleconfusers # # Debian-related zsh aliases and functions for zsh From 5f37649508f6b6323e78249671d7897af8076886 Mon Sep 17 00:00:00 2001 From: mapc Date: Sat, 30 Jun 2012 04:44:26 +0200 Subject: [PATCH 033/113] Dynamicly generate completion functions to support changing apt_pref --- plugins/debian/debian.plugin.zsh | 45 +++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index c556cb0b5..b6f9fd2bf 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -110,18 +110,39 @@ fi # Completion ################################################################ -# TODO: These definitions won't change between apt-get and uptitude automaticaly -compdef _apt aac="$apt_pref autoclean" -compdef _apt abd="$apt_pref build-dep" -compdef _apt ac="$apt_pref clean" -compdef _apt ad="$apt_pref update" -compdef _apt afu="$apt_pref update" -compdef _apt ag="$apt_pref upgrade" -compdef _apt ai="$apt_pref install" -compdef _apt ail="$apt_pref install" -compdef _apt ap="$apt_pref purge" -compdef _apt ar="$apt_pref remove" -compdef _apt ads="apt-get dselect-upgrade" +# +# Registers a compdef for $1 that calls $apt_pref with the commands $2 +# To do that it creates a new completion function called _apt_pref_$2 +# +apt_pref_compdef() { + local f fb + f="_apt_pref_${2}" + + fb="function ${f}() { + shift words; + service=\"\$apt_pref\"; + words=(\"\$apt_pref\" '$2' \$words); + ((CURRENT++)) + test \"\${apt_pref}\" = 'aptitude' && _aptitude || _apt + }" + + eval "$fb" + echo "$fb" + + compdef "$f" "$1" +} + +apt_pref_compdef aac "autoclean" +apt_pref_compdef abd "build-dep" +apt_pref_compdef ac "clean" +apt_pref_compdef ad "update" +apt_pref_compdef afu "update" +apt_pref_compdef ag "upgrade" +apt_pref_compdef ai "install" +apt_pref_compdef ail "install" +apt_pref_compdef ap "purge" +apt_pref_compdef ar "remove" +apt_pref_compdef ads "dselect-upgrade" # Misc. ##################################################################### # print all installed packages From 1b36c1beae21dafead692f83a099bdd69a0c6e50 Mon Sep 17 00:00:00 2001 From: mapc Date: Sat, 30 Jun 2012 05:37:10 +0200 Subject: [PATCH 034/113] Remove debug info --- plugins/debian/debian.plugin.zsh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index b6f9fd2bf..722b83c30 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -118,16 +118,13 @@ apt_pref_compdef() { local f fb f="_apt_pref_${2}" - fb="function ${f}() { + eval "function ${f}() { shift words; service=\"\$apt_pref\"; words=(\"\$apt_pref\" '$2' \$words); ((CURRENT++)) test \"\${apt_pref}\" = 'aptitude' && _aptitude || _apt }" - - eval "$fb" - echo "$fb" compdef "$f" "$1" } From e7f24a831990f7dc87b7931aac2a3c2cd6b6c7e8 Mon Sep 17 00:00:00 2001 From: Jack Henahan Date: Mon, 24 Dec 2012 13:43:45 -0500 Subject: [PATCH 035/113] add symbol in darcs repos to match git and mercurial --- themes/smt.zsh-theme | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/smt.zsh-theme b/themes/smt.zsh-theme index 7a287523e..bbd1031e1 100644 --- a/themes/smt.zsh-theme +++ b/themes/smt.zsh-theme @@ -29,6 +29,7 @@ ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}" function prompt_char() { git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return + darcs show repo >/dev/null 2>/dev/null && echo "%{$fg_bold[green]%}❉%{$reset_color%}" && return echo "%{$fg[cyan]%}◯%{$reset_color%}" } From 76e828691bedc345904716b04cfa746fd043e0e7 Mon Sep 17 00:00:00 2001 From: Adolfo Benedetti Date: Wed, 30 Jan 2013 18:58:58 +0100 Subject: [PATCH 036/113] updated adben theme: added offline content, subversion support, refactored prompt --- themes/adben.zsh-theme | 145 ++++++++++++++++++++++++++++++++++------- 1 file changed, 120 insertions(+), 25 deletions(-) diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme index 9f777e847..b64714f32 100644 --- a/themes/adben.zsh-theme +++ b/themes/adben.zsh-theme @@ -1,26 +1,121 @@ #!/usr/bin/env zsh -local USER_HOST='%{$terminfo[bold]$fg[yellow]%}%n@%m%{$reset_color%}' -local RETURN_CODE="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -local GIT_BRANCH='%{$terminfo[bold]$fg[red]%}$(git_prompt_info)%{$reset_color%}' -local CURRENT_DIR='%{$terminfo[bold]$fg[green]%} %~%{$reset_color%}' -local RUBY_RVM='%{$fg[gray]%}‹$(rvm-prompt i v g)›%{$reset_color%}' -local COMMAND_TIP='%{$terminfo[bold]$fg[blue]%}$(wget -qO - http://www.commandlinefu.com/commands/random/plaintext | sed 1d | sed '/^$/d' | sed 's/^/║/g')%{$reset_color%}' -######### PROMPT ######### -PROMPT="%{$terminfo[bold]$fg[blue]%}╔═ %{$reset_color%}${USER_HOST} ${CURRENT_DIR} ${RUBY_RVM} ${GIT_BRANCH} -${COMMAND_TIP} -%{$terminfo[bold]$fg[blue]%}╚═ %{$reset_color%}%B%{$terminfo[bold]$fg[white]%}$%b%{$reset_color%} " -RPS1='${RETURN_CODE}' -RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' -######### PROMPT ######### -########## GIT ########### -ZSH_THEME_GIT_PROMPT_PREFIX="‹" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%}›" -ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘" -ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔" -ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[082]%}✚%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[166]%}✹%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[160]%}✖%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[220]%}➜%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[082]%}═%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[190]%}✭%{$reset_color%}" -########## GIT ########### +# # +# # #README +# # +# # This theme provides two customizable header functionalities : +# # a) displaying a pseudo-random message from a database of quotations +# # (https://en.wikipedia.org/wiki/Fortune_%28Unix%29) +# # b) displaying randomly command line tips from The command line fu +# # (http://www.commandlinefu.com) community: in order to make use of this functionality +# # you will need Internet connection. +# # This theme provides as well information for the current user's context, like; +# # branch and status for the current version control system (git and svn currently +# # supported) and time, presented to the user in a non invasive volatile way. +# # +# # #REQUIREMENTS +# # This theme requires wget:: +# # -Homebrew-osx- brew install wget +# # -Debian/Ubuntu- apt-get install wget +# # and fortune :: +# # -Homebrew-osx- brew install fortune +# # -Debian/Ubuntu- apt-get install fortune +# # +# # optionally: +# # -Oh-myzsh vcs plug-ins git and svn. +# # -Solarized theme (https://github.com/altercation/solarized/) +# # -OS X: iTerm 2 (http://www.iterm2.com/) +# # -font Source code pro (https://github.com/adobe/source-code-pro) +# # +# # Author: Adolfo Benedetti +# # email: adolfo.benedetti@gmail.com +# # License: Public Domain +# # This theme's look and feel is based on the Aaron Toponce's zsh theme , more info: +# # http://pthree.org/2008/11/23/727/ +# # enjoy! +########## COLOR ########### +for COLOR in CYAN WHITE YELLOW MAGENTA BLACK BLUE RED DEFAULT GREEN GREY; do + eval PR_$COLOR='%{$fg[${(L)COLOR}]%}' + eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}' +done +PR_RESET="%{$reset_color%}" +RED_START="${PR_RESET}${PR_GREY}<${PR_RESET}${PR_RED}<${PR_BRIGHT_RED}<${PR_RESET} " +RED_END="${PR_RESET}${PR_BRIGHT_RED}>${PR_RESET}${PR_RED}>${PR_GREY}>${PR_RESET} " +GREEN_END="${PR_RESET}${PR_BRIGHT_GREEN}>${PR_RESET}${PR_GREEN}>${PR_GREY}>${PR_RESET} " +GREEN_BASE_START="${PR_RESET}${PR_GREY}>${PR_RESET}${PR_GREEN}>${PR_BRIGHT_GREEN}>${PR_RESET}" +GREEN_START_P1="${PR_RESET}${GREEN_BASE_START}${PR_RESET} " +DIVISION="${PR_RESET}${PR_RED} < ${PR_RESET}" +VCS_DIRTY_COLOR="${PR_RESET}${PR_YELLOW}" +Vcs_CLEAN_COLOR="${PR_RESET}${PR_GREEN}" +VCS_SUFIX_COLOR="${PR_RESET}${PR_RED}› ${PR_RESET}" +# ########## COLOR ########### +# ########## SVN ########### +ZSH_THEME_SVN_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹svn:" +ZSH_THEME_SVN_PROMPT_SUFFIX="" +ZSH_THEME_SVN_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}" +ZSH_THEME_SVN_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}" +# ########## SVN ########### +# ########## GIT ########### +ZSH_THEME_GIT_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹git:" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}" +ZSH_THEME_GIT_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}" +ZSH_THEME_GIT_PROMPT_ADDED="${PR_RESET}${PR_YELLOW} ✚${PR_RESET}" +ZSH_THEME_GIT_PROMPT_MODIFIED="${PR_RESET}${PR_YELLOW} ✹${PR_RESET}" +ZSH_THEME_GIT_PROMPT_DELETED="${PR_RESET}${PR_YELLOW} ✖${PR_RESET}" +ZSH_THEME_GIT_PROMPT_RENAMED="${PR_RESET}${PR_YELLOW} ➜${PR_RESET}" +ZSH_THEME_GIT_PROMPT_UNMERGED="${PR_RESET}${PR_YELLOW} ═${PR_RESET}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="${PR_RESET}${PR_YELLOW} ✭${PR_RESET}" +# ########## GIT ########### +function precmd { + #gets the fortune + ps1_fortune () { + #Choose from all databases, regardless of whether they are considered "offensive" + fortune -a + } + #obtains the tip + ps1_command_tip () { + wget -qO - http://www.commandlinefu.com/commands/random/plaintext | sed 1d | sed '/^$/d' + } + prompt_header () { + if [[ "true" == "$ENABLE_COMMAND_TIP" ]]; then + ps1_command_tip + else + ps1_fortune + fi + } + PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}" + # set a simple variable to show when in screen + if [[ -n "${WINDOW}" ]]; then + SCREEN="" + fi +} + +# Context: user@directory or just directory +prompt_context () { + local user=`whoami` + if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then + echo -n "${PR_RESET}${PR_RED}$user@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" + else + echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" + fi +} + +set_prompt () { + # required for the prompt + setopt prompt_subst + autoload colors zsh/terminfo + if [[ "$terminfo[colors]" -gt 8 ]]; then + colors + fi + + # ######### PROMPT ######### + PROMPT='${PROMPT_HEAD} +${RED_START}$(prompt_context) +${GREEN_START_P1}' + RPROMPT='${PR_RESET}$(git_prompt_info)$(svn_prompt_info)${PR_YELLOW}%D{%R.%S %a %b %d %Y} ${GREEN_END}${PR_RESET}' + # Matching continuation prompt + PROMPT2='${GREEN_BASE_START}${PR_RESET} %_ ${GREEN_BASE_START}${PR_RESET} ' + # ######### PROMPT ######### +} + +set_prompt From f358f614149e4f25b53abe140e0d0b8bc46928d6 Mon Sep 17 00:00:00 2001 From: Nicolas Jeker Date: Tue, 2 Apr 2013 12:33:06 +0300 Subject: [PATCH 037/113] use hostname instead of hostname -s hostname -s is not available on every implementation of hostname, e.g. Cygwin uses hostname from coreutils which doesn't work. --- themes/ys.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme index 3d316390e..43c101c2a 100644 --- a/themes/ys.zsh-theme +++ b/themes/ys.zsh-theme @@ -8,7 +8,7 @@ # Machine name. function box_name { - [ -f ~/.box-name ] && cat ~/.box-name || hostname -s + [ -f ~/.box-name ] && cat ~/.box-name || hostname } # Directory info. From 3f44f51e9ca1b196e4c3caa439558996abdac273 Mon Sep 17 00:00:00 2001 From: Gaetan Semet Date: Tue, 11 Jun 2013 14:50:32 +0200 Subject: [PATCH 038/113] source ~/.profile for upgrading (to source the proxy configuration) Signed-off-by: Gaetan Semet --- tools/check_for_upgrade.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 581f03a07..14d294328 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -20,6 +20,8 @@ if [[ -z "$epoch_target" ]]; then epoch_target=13 fi +[ ~/.profile ] && source ~/.profile + if [ -f ~/.zsh-update ] then . ~/.zsh-update From b832ec92086df4648e270b3d44a10fe058ffd8f4 Mon Sep 17 00:00:00 2001 From: Gaetan Semet Date: Tue, 11 Jun 2013 14:58:25 +0200 Subject: [PATCH 039/113] New plugin 'common-aliases' for optional cutting edge zsh aliases Signed-off-by: Gaetan Semet --- .../common-aliases/common-aliases.plugin.zsh | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 plugins/common-aliases/common-aliases.plugin.zsh diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh new file mode 100644 index 000000000..4ac8178b6 --- /dev/null +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -0,0 +1,94 @@ +# Advanced Aliases. +# Use with caution +# + +# ls, the common ones I use a lot shortened for rapid fire usage +alias ls='ls --color' #I like color +alias l='ls -lFh' #size,show type,human readable +alias la='ls -lAFh' #long list,show almost all,show type,human readable +alias lr='ls -tRFh' #sorted by date,recursive,show type,human readable +alias lt='ls -ltFh' #long list,sorted by date,show type,human readable +alias ll='ls -l' #long list +alias ldot='ls -ld .*' +alias lS='ls -1FSsh' +alias lart='ls -1Fcart' +alias lrt='ls -1Fcrt' + +alias zshrc='vim ~/.zshrc' # Quick access to the ~/.zshrc file + +alias grep='grep --color' +alias sgrep='grep -R -n -H -C 5' + +alias t='tail -f' + +# because typing 'cd' is A LOT of work!! +alias ..='cd ../' +alias ...='cd ../../' +alias ....='cd ../../../' +alias .....='cd ../../../../' + +# Command line head / tail shortcuts +alias -g H='| head' +alias -g T='| tail' +alias -g G='| grep' +alias -g L="| less" +alias -g M="| most" +alias -g LL="2>&1 | less" +alias -g CA="2>&1 | cat -A" +alias -g NE="2> /dev/null" +alias -g NUL="> /dev/null 2>&1" +alias -g P="2>&1| pygmentize -l pytb" + +alias dud='du --max-depth=1 -h' +alias duf='du -sh *' +alias fd='find . -type d -name' +alias ff='find . -type f -name' + +alias h='history' +alias hgrep="fc -El 0 | grep" +alias help='man' +alias j='jobs' +alias p='ps -f' +alias sortnr='sort -n -r' +alias unexport='unset' + +alias whereami=display_info + +alias rm='rm -i' +alias cp='cp -i' +alias mv='mv -i' + +# zsh is able to auto-do some kungfoo +# depends on the SUFFIX :) +if [ ${ZSH_VERSION//\./} -ge 420 ]; then + # open browser on urls + _browser_fts=(htm html de org net com at cx nl se dk dk php) + for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done + + _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex) + for ft in $_editor_fts ; do alias -s $ft=$EDITOR ; done + + _image_fts=(jpg jpeg png gif mng tiff tif xpm) + for ft in $_image_fts ; do alias -s $ft=$XIVIEWER; done + + _media_fts=(avi mpg mpeg ogm mp3 wav ogg ape rm mov mkv) + for ft in $_media_fts ; do alias -s $ft=mplayer ; done + + #read documents + alias -s pdf=acroread + alias -s ps=gv + alias -s dvi=xdvi + alias -s chm=xchm + alias -s djvu=djview + + #list whats inside packed file + alias -s zip="unzip -l" + alias -s rar="unrar l" + alias -s tar="tar tf" + alias -s tar.gz="echo " + alias -s ace="unace l" +fi + +# Make zsh know about hosts already accessed by SSH +zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })' + From dbcaafd03b084b94ebef9b04e91b3f04ad05d374 Mon Sep 17 00:00:00 2001 From: Gaetan Semet Date: Wed, 12 Jun 2013 11:54:08 +0200 Subject: [PATCH 040/113] Better super-grep Signed-off-by: Gaetan Semet --- plugins/common-aliases/common-aliases.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index 4ac8178b6..75899ca2c 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -17,7 +17,7 @@ alias lrt='ls -1Fcrt' alias zshrc='vim ~/.zshrc' # Quick access to the ~/.zshrc file alias grep='grep --color' -alias sgrep='grep -R -n -H -C 5' +alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} ' alias t='tail -f' From 15509ce0472a431867cc2ff21ca5ef0a1c1e855f Mon Sep 17 00:00:00 2001 From: dongweiming Date: Sun, 30 Jun 2013 17:29:02 +0800 Subject: [PATCH 041/113] Update gem completion --- plugins/gem/_gem | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/gem/_gem b/plugins/gem/_gem index 83cba40d1..279181e70 100644 --- a/plugins/gem/_gem +++ b/plugins/gem/_gem @@ -4,11 +4,13 @@ # gem zsh completion, based on homebrew completion _gem_installed() { - installed_gems=(`gem list --local --no-versions`) + installed_gems=(${(f)"$(gem list --local --no-versions)"}) } local -a _1st_arguments + _1st_arguments=( + 'build:Build a gem from a gemspec' 'cert:Manage RubyGems certificates and signing settings' 'check:Check installed gems' 'cleanup:Clean up old versions of installed gems in the local repository' @@ -37,6 +39,7 @@ _1st_arguments=( 'unpack:Unpack an installed gem to the current directory' 'update:Update the named gems (or all installed gems) in the local repository' 'which:Find the location of a library file you can require' + 'yank:Remove a specific gem version release from RubyGems.org' ) local expl From d4a9467f89115c1e60b51d8c068ec4e5e1c5b195 Mon Sep 17 00:00:00 2001 From: dongweiming Date: Sun, 30 Jun 2013 18:08:48 +0800 Subject: [PATCH 042/113] Modify determine the oh-my-zsh installed in non-default path of the installed --- tools/install.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index a2bd5665a..5af038fd9 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -1,6 +1,11 @@ -if [ -d ~/.oh-my-zsh ] +ZSH=`/usr/bin/env|grep 'ZSH='|cut -d '=' -f 2` +if [ -d "$ZSH" ] then - echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove ~/.oh-my-zsh if you want to install" + echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove $ZSH if you want to install" + exit +elif [ -d ~/.oh-my-zsh ] +then + echo "\033[0;33mYou already have One Oh My Zsh Directory.\033[0m You'll need to remove ~/.oh-my-zsh if you want to clone" exit fi From 77cf8696053d5256b4deb7cddc79c31d26158451 Mon Sep 17 00:00:00 2001 From: dongweiming Date: Sun, 30 Jun 2013 20:46:10 +0800 Subject: [PATCH 043/113] Add option for show in the command execution time stamp in the history --- lib/aliases.zsh | 14 ++++++++++++-- templates/zshrc.zsh-template | 5 +++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 9b3709172..b279bf855 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -13,8 +13,18 @@ alias please='sudo' #alias g='grep -in' # Show history -alias history='fc -l 1' - +if [ "$HIST_STAMPS" = "mm/dd/yyyy" ] +then + alias history='fc -fl 1' +elif [ "$HIST_STAMPS" = "dd.mm.yyyy" ] +then + alias history='fc -El 1' +elif [ "$HIST_STAMPS" = "yyyy-mm-dd" ] +then + alias history='fc -il 1' +else + alias history='fc -l 1' +fi # List direcory contents alias lsa='ls -lah' alias l='ls -la' diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index d4dded73a..3135df882 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -37,6 +37,11 @@ ZSH_THEME="robbyrussell" # much faster. # DISABLE_UNTRACKED_FILES_DIRTY="true" +# Uncomment following line if you want to shown in the command execution time stamp +# in the history command output. The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"| +# yyyy-mm-dd +# HIST_STAMPS="mm/dd/yyyy" + # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) From c164f2aab693f4b32c209cb34784818fba434b2d Mon Sep 17 00:00:00 2001 From: dongweiming Date: Tue, 2 Jul 2013 00:22:25 +0800 Subject: [PATCH 044/113] Add shell built method --- plugins/urltools/urltools.plugin.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/urltools/urltools.plugin.zsh b/plugins/urltools/urltools.plugin.zsh index 4ddfff8ce..22327334d 100644 --- a/plugins/urltools/urltools.plugin.zsh +++ b/plugins/urltools/urltools.plugin.zsh @@ -14,6 +14,9 @@ if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD elif [[ $(whence python) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"' alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"' +elif [[ $(whence xxd) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xshell" ) ]]; then + function urlencode() {echo $@ | tr -d "\n" | xxd -plain | sed "s/\(..\)/%\1/g"} + function urldecode() {printf $(echo -n $@ | sed 's/\\/\\\\/g;s/\(%\)\([0-9a-fA-F][0-9a-fA-F]\)/\\x\2/g')"\n"} elif [[ $(whence ruby) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xruby" ) ]]; then alias urlencode='ruby -r cgi -e "puts CGI.escape(ARGV[0])"' alias urldecode='ruby -r cgi -e "puts CGI.unescape(ARGV[0])"' @@ -33,4 +36,4 @@ elif [[ $(whence perl) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHO fi fi -unset URLTOOLS_METHOD \ No newline at end of file +unset URLTOOLS_METHOD From 44a26df8fdd85c3eeb774a6913b9102106228ebb Mon Sep 17 00:00:00 2001 From: dongweiming Date: Wed, 3 Jul 2013 11:57:31 +0800 Subject: [PATCH 045/113] Add version option --- plugins/supervisor/_supervisord | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/supervisor/_supervisord b/plugins/supervisor/_supervisord index 34d27805d..e0cb670e1 100644 --- a/plugins/supervisor/_supervisord +++ b/plugins/supervisor/_supervisord @@ -7,6 +7,7 @@ _arguments \ {--configuration,-c}"[configuration file]:FILENAME:_files" \ {--nodaemon,-n}"[run in the foreground (same as 'nodaemon true' in config file)]" \ {--help,-h}"[print this usage message and exit]:" \ + {--version,-v}"[print supervisord version number and exit]:" \ {--user,-u}"[run supervisord as this user]:USER:_users" \ {--umask,-m}"[use this umask for daemon subprocess (default is 022)]" \ {--directory,-d}"[directory to chdir to when daemonized]" \ From 426f5f483925f5bd9d3f78fa03d6f7d9818bb288 Mon Sep 17 00:00:00 2001 From: dongweiming Date: Wed, 3 Jul 2013 22:29:42 +0800 Subject: [PATCH 046/113] Update powify for displayed parameter is not enough, and when there is no directory error --- plugins/powify/_powify | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/powify/_powify b/plugins/powify/_powify index d23c46513..9507f400e 100644 --- a/plugins/powify/_powify +++ b/plugins/powify/_powify @@ -1,7 +1,7 @@ #compdef powify _powify_all_servers() { - all_servers=(`ls $HOME/.pow/`) + all_servers=(`ls $HOME/.pow/ 2>/dev/null`) } local -a all_servers @@ -30,7 +30,7 @@ fi case "$words[1]" in server) - _values \ + _values , \ 'install[install pow server]' \ 'reinstall[reinstall pow server]' \ 'update[update pow server]' \ @@ -45,7 +45,7 @@ case "$words[1]" in 'config[print the current server configuration]' \ 'logs[tails the pow server logs]' ;; utils) - _values \ + _values , \ 'install[install powify.dev server management tool]' \ 'reinstall[reinstall powify.dev server management tool]' \ 'uninstall[uninstall powify.dev server management tool]' ;; From 744f3654e2bfb4806381ca4f0a5dfcfa5b1c3b83 Mon Sep 17 00:00:00 2001 From: dongweiming Date: Thu, 4 Jul 2013 19:18:52 +0800 Subject: [PATCH 047/113] Add sudo plugin --- plugins/sudo/sudo.zsh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 plugins/sudo/sudo.zsh diff --git a/plugins/sudo/sudo.zsh b/plugins/sudo/sudo.zsh new file mode 100644 index 000000000..d12e06853 --- /dev/null +++ b/plugins/sudo/sudo.zsh @@ -0,0 +1,22 @@ +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# sudo will be inserted before the command +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Dongweiming +# +# ------------------------------------------------------------------------------ + +sudo-command-line() { +[[ -z $BUFFER ]] && zle up-history +[[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER" +zle end-of-line +} +zle -N sudo-command-line +# Defined shortcut keys: [Esc] [Esc] +bindkey "\e\e" sudo-command-line From 4d6b59f041f2d5eb9b61608a0ff33160faf48afa Mon Sep 17 00:00:00 2001 From: dongweiming Date: Fri, 5 Jul 2013 19:27:43 +0800 Subject: [PATCH 048/113] Add a plugin for systemadmin ops and developer --- plugins/systemadmin/systemadmin.zsh | 159 ++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 plugins/systemadmin/systemadmin.zsh diff --git a/plugins/systemadmin/systemadmin.zsh b/plugins/systemadmin/systemadmin.zsh new file mode 100644 index 000000000..f5e44c66f --- /dev/null +++ b/plugins/systemadmin/systemadmin.zsh @@ -0,0 +1,159 @@ +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# This is one for the system administrator, operation and maintenance. +# Some of which come from http://justinlilly.com/dotfiles/zsh.html +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Dongweiming +# +# ------------------------------------------------------------------------------ + +function retval() { + if [[ -z $1 ]];then + echo '.' + else + echo $1 + fi +} + +function retlog() { + if [[ -z $1 ]];then + echo '/var/log/nginx/access.log' + else + echo $1 + fi +} + +alias ping='ping -c 5' +alias clr='clear;echo "Currently logged in on $(tty), as $(whoami) in directory $(pwd)."' +alias path='echo -e ${PATH//:/\\n}' +alias mkdir='mkdir -pv' +# get top process eating memory +alias psmem='ps -e -orss=,args= | sort -b -k1,1n' +alias psmem10='ps -e -orss=,args= | sort -b -k1,1n| head -10' +# get top process eating cpu if not work try excute : export LC_ALL='C' +alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1 -nr' +alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1 -nr | head -10' +# top10 of the history +alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10' + +# directory LS +dls () { + ls -l | grep "^d" | awk '{ print $9 }' | tr -d "/" +} +psgrep() { + ps aux | grep "$(retval $1)" | grep -v grep +} +# Kills any process that matches a regexp passed to it +killit() { + ps aux | grep -v "grep" | grep "$@" | awk '{print $2}' | xargs sudo kill +} + +# list contents of directories in a tree-like format +if [ -z "\${which tree}" ]; then + tree () { + find $@ -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' + } +fi + +# Sort connection state +sortcons() { + netstat -nat |awk '{print $6}'|sort|uniq -c|sort -rn +} + +# View all 80 Port Connections +con80() { + netstat -nat|grep -i ":80"|wc -l +} + +# On the connected IP sorted by the number of connections +sortconip() { + netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n +} + +# top20 of Find the number of requests on 80 port +req20() { + netstat -anlp|grep 80|grep tcp|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -n20 +} + +# top20 of Using tcpdump port 80 access to view +http20() { + sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -20 +} + +# top20 of Find time_wait connection +timewait20() { + netstat -n|grep TIME_WAIT|awk '{print $5}'|sort|uniq -c|sort -rn|head -n20 +} + +# top20 of Find SYN connection +syn20() { + netstat -an | grep SYN | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr|head -n20 +} + +# Printing process according to the port number +port_pro() { + netstat -ntlp | grep "$(retval $1)" | awk '{print $7}' | cut -d/ -f1 +} + +# top10 of gain access to the ip address +accessip10() { + awk '{counts[$(11)]+=1}; END {for(url in counts) print counts[url], url}' "$(retlog)" +} + +# top20 of Most Visited file or page +visitpage20() { + awk '{print $11}' "$(retlog)"|sort|uniq -c|sort -nr|head -20 +} + +# top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences +consume100() { + awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -100 + # if django website or other webiste make by no suffix language + # awk '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -100 +} + +# Website traffic statistics (G) +webtraffic() { + awk "{sum+=$10} END {print sum/1024/1024/1024}" "$(retlog)" +} + +# Statistical connections 404 +c404() { + awk '($9 ~/404/)' "$(retlog)" | awk '{print $9,$7}' | sort +} + +# Statistical http status. +httpstatus() { + awk '{counts[$(9)]+=1}; END {for(code in counts) print code, counts[code]}' "$(retlog)" +} + +# Delete 0 byte file +d0() { + find "$(retval $1)" -type f -size 0 -exec rm -rf {} \; +} + +# gather external ip address +geteip() { + curl http://ifconfig.me +} + +# determine local IP address +getip() { + ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}' +} + +# Clear zombie processes +clrz() { + ps -eal | awk '{ if ($2 == "Z") {print $4}}' | kill -9 +} + +# Second concurrent +conssec() { + awk '{if($9~/200|30|404/)COUNT[$4]++}END{for( a in COUNT) print a,COUNT[a]}' "$(retlog)"|sort -k 2 -nr|head -n10 +} From 2defe0b5c54b08fc599005197761edf162600c78 Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 8 Jul 2013 01:17:33 +0200 Subject: [PATCH 049/113] Update jonathan.zsh-theme Made it work with UTF-8 Console. Thanks goes to http://blog.ganneff.de/blog/2013/03/zsh-config---and-prompt.html --- themes/jonathan.zsh-theme | 59 ++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme index 9f0f30271..bca92970c 100644 --- a/themes/jonathan.zsh-theme +++ b/themes/jonathan.zsh-theme @@ -71,17 +71,30 @@ setprompt () { ### # See if we can use extended characters to look nicer. + # UTF-8 Fixed - typeset -A altchar - set -A altchar ${(s..)terminfo[acsc]} - PR_SET_CHARSET="%{$terminfo[enacs]%}" - PR_SHIFT_IN="%{$terminfo[smacs]%}" - PR_SHIFT_OUT="%{$terminfo[rmacs]%}" - PR_HBAR=${altchar[q]:--} - PR_ULCORNER=${altchar[l]:--} - PR_LLCORNER=${altchar[m]:--} - PR_LRCORNER=${altchar[j]:--} - PR_URCORNER=${altchar[k]:--} + if [[ $(locale charmap) == "UTF-8" ]]; then + PR_SET_CHARSET="" + PR_SHIFT_IN="" + PR_SHIFT_OUT="" + PR_HBAR="─" + PR_ULCORNER="┌" + PR_LLCORNER="└" + PR_LRCORNER="┘" + PR_URCORNER="┐" + else + typeset -A altchar + set -A altchar ${(s..)terminfo[acsc]} + # Some stuff to help us draw nice lines + PR_SET_CHARSET="%{$terminfo[enacs]%}" + PR_SHIFT_IN="%{$terminfo[smacs]%}" + PR_SHIFT_OUT="%{$terminfo[rmacs]%}" + PR_HBAR='$PR_SHIFT_IN${altchar[q]:--}$PR_SHIFT_OUT' + PR_ULCORNER='$PR_SHIFT_IN${altchar[l]:--}$PR_SHIFT_OUT' + PR_LLCORNER='$PR_SHIFT_IN${altchar[m]:--}$PR_SHIFT_OUT' + PR_LRCORNER='$PR_SHIFT_IN${altchar[j]:--}$PR_SHIFT_OUT' + PR_URCORNER='$PR_SHIFT_IN${altchar[k]:--}$PR_SHIFT_OUT' + fi ### @@ -113,31 +126,31 @@ setprompt () { # Finally, the prompt. PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ -$PR_CYAN$PR_SHIFT_IN$PR_ULCORNER$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\ +$PR_CYAN$PR_ULCORNER$PR_HBAR$PR_GREY(\ $PR_GREEN%$PR_PWDLEN<...<%~%<<\ -$PR_GREY)`rvm_prompt_info || rbenv_prompt_info`$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\ +$PR_GREY)`rvm_prompt_info || rbenv_prompt_info`$PR_CYAN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_GREY(\ $PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\ -$PR_GREY)$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_URCORNER$PR_SHIFT_OUT\ +$PR_GREY)$PR_CYAN$PR_HBAR$PR_URCORNER\ -$PR_CYAN$PR_SHIFT_IN$PR_LLCORNER$PR_BLUE$PR_HBAR$PR_SHIFT_OUT(\ +$PR_CYAN$PR_LLCORNER$PR_BLUE$PR_HBAR(\ $PR_YELLOW%D{%H:%M:%S}\ -$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_SHIFT_IN$PR_HBAR\ -$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ +$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_HBAR\ +$PR_HBAR\ >$PR_NO_COLOUR ' # display exitcode on the right when >0 return_code="%(?..%{$fg[red]%}%? ↵ %{$reset_color%})" - RPROMPT=' $return_code$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_BLUE$PR_HBAR$PR_SHIFT_OUT\ -($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_SHIFT_OUT$PR_NO_COLOUR' + RPROMPT=' $return_code$PR_CYAN$PR_HBAR$PR_BLUE$PR_HBAR\ +($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_NO_COLOUR' - PS2='$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ -$PR_BLUE$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT(\ -$PR_LIGHT_GREEN%_$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ -$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR ' + PS2='$PR_CYAN$PR_HBAR\ +$PR_BLUE$PR_HBAR(\ +$PR_LIGHT_GREEN%_$PR_BLUE)$PR_HBAR\ +$PR_CYAN$PR_HBAR$PR_NO_COLOUR ' } setprompt autoload -U add-zsh-hook add-zsh-hook precmd theme_precmd -add-zsh-hook preexec theme_preexec \ No newline at end of file +add-zsh-hook preexec theme_preexec From 5bad3f890de691194b77cfc33846e2102e21ea93 Mon Sep 17 00:00:00 2001 From: Steven De Coeyer Date: Mon, 5 Aug 2013 21:15:28 +0200 Subject: [PATCH 050/113] Updates Zhann theme --- themes/zhann.zsh-theme | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/themes/zhann.zsh-theme b/themes/zhann.zsh-theme index 5c49fe79b..5c0854730 100644 --- a/themes/zhann.zsh-theme +++ b/themes/zhann.zsh-theme @@ -1,15 +1,25 @@ -PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +autoload -U colors && colors -if [ -e ~/.rvm/bin/rvm-prompt ]; then - RPROMPT='%{$reset_color%} %{$fg[red]%}$(~/.rvm/bin/rvm-prompt i v g) %{$reset_color%}' -else - if which rbenv &> /dev/null; then - RPROMPT='%{$reset_color%} %{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//") %{$reset_color%}' - fi -fi +autoload -Uz vcs_info +zstyle ':vcs_info:*' stagedstr '%F{green}●' +zstyle ':vcs_info:*' unstagedstr '%F{yellow}●' +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r' +zstyle ':vcs_info:*' enable git svn +theme_precmd () { + if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] { + zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]' + } else { + zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{red}●%F{green}]' + } + + vcs_info +} + +setopt prompt_subst +PROMPT='%B%F{blue}%c%B%F{green}${vcs_info_msg_0_}%B%F{magenta} %{$reset_color%}% ' + +autoload -U add-zsh-hook +add-zsh-hook precmd theme_precmd -ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" From 2c56345917624bd94bfc05fe7bdbb2051421d5e7 Mon Sep 17 00:00:00 2001 From: Kasper Kronborg Isager Date: Sat, 10 Aug 2013 19:19:30 -0400 Subject: [PATCH 051/113] Add Pure theme --- themes/pure.zsh-theme | 128 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 themes/pure.zsh-theme diff --git a/themes/pure.zsh-theme b/themes/pure.zsh-theme new file mode 100644 index 000000000..d7ed624e4 --- /dev/null +++ b/themes/pure.zsh-theme @@ -0,0 +1,128 @@ +#!/usr/bin/env zsh + +# ------------------------------------------------------------------------------ +# +# Pure - A minimal and beautiful theme for oh-my-zsh +# +# Based on the custom Zsh-prompt of the same name by Sindre Sorhus. A huge +# thanks goes out to him for designing the fantastic Pure prompt in the first +# place! I'd also like to thank Julien Nicoulaud for his "nicoulaj" theme from +# which I've borrowed both some ideas and some actual code. You can find out +# more about both of these fantastic two people here: +# +# Sindre Sorhus +# Github: https://github.com/sindresorhus +# Twitter: https://twitter.com/sindresorhus +# +# Julien Nicoulaud +# Github: https://github.com/nicoulaj +# Twitter: https://twitter.com/nicoulaj +# +# License +# +# Copyright (c) 2013 Kasper Kronborg Isager +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# ------------------------------------------------------------------------------ + +# Set required options +# +setopt prompt_subst + +# Load required modules +# +autoload -Uz vcs_info + +# Set vcs_info parameters +# +zstyle ':vcs_info:*' enable hg bzr git +zstyle ':vcs_info:*:*' unstagedstr '!' +zstyle ':vcs_info:*:*' stagedstr '+' +zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%%u%c" +zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%u%c (%a)" +zstyle ':vcs_info:*:*' nvcsformats "%~" "" "" + +# Fastest possible way to check if repo is dirty +# +git_dirty() { + # Check if we're in a git repo + command git rev-parse --is-inside-work-tree &>/dev/null || return + # Check if it's dirty + command git diff --quiet --ignore-submodules HEAD &>/dev/null; [ $? -eq 1 ] && echo "*" +} + +# Display information about the current repository +# +repo_information() { + echo "%F{blue}${vcs_info_msg_0_%%/.} %F{8}$vcs_info_msg_1_`git_dirty` $vcs_info_msg_2_%f" +} + +# Displays the exec time of the last command if set threshold was exceeded +# +cmd_exec_time() { + local stop=`date +%s` + local start=${cmd_timestamp:-$stop} + let local elapsed=$stop-$start + [ $elapsed -gt 5 ] && echo ${elapsed}s +} + +# Get the intial timestamp for cmd_exec_time +# +preexec() { + cmd_timestamp=`date +%s` +} + +# Output additional information about paths, repos and exec time +# +precmd() { + vcs_info # Get version control info before we start outputting stuff + print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f" +} + +# Define prompts +# +PROMPT="%(?.%F{magenta}.%F{red})❯%f " # Display a red prompt char on failure +RPROMPT="%F{8}${SSH_TTY:+%n@%m}%f" # Display username if connected via SSH + +# ------------------------------------------------------------------------------ +# +# List of vcs_info format strings: +# +# %b => current branch +# %a => current action (rebase/merge) +# %s => current version control system +# %r => name of the root directory of the repository +# %S => current path relative to the repository root directory +# %m => in case of Git, show information about stashes +# %u => show unstaged changes in the repository +# %c => show staged changes in the repository +# +# List of prompt format strings: +# +# prompt: +# %F => color dict +# %f => reset color +# %~ => current path +# %* => time +# %n => username +# %m => shortname host +# %(?..) => prompt conditional - %(condition.true.false) +# +# ------------------------------------------------------------------------------ From f6fb34845d31a840c73416f138dae1761ea4adb9 Mon Sep 17 00:00:00 2001 From: Alexandre Joly Date: Tue, 10 Sep 2013 09:14:24 +0200 Subject: [PATCH 052/113] updated the arguments list to the newest version (0.24.0) of cocoapods --- plugins/pod/_pod | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/pod/_pod b/plugins/pod/_pod index 563fa5e66..6dd8b6371 100644 --- a/plugins/pod/_pod +++ b/plugins/pod/_pod @@ -3,18 +3,19 @@ # ----------------------------------------------------------------------------- # FILE: _pod -# DESCRIPTION: Cocoapods autocomplete plugin for Oh-My-Zsh +# DESCRIPTION: Cocoapods (0.24.0) autocomplete plugin for Oh-My-Zsh # http://cocoapods.org # AUTHOR: Alexandre Joly (alexandre.joly@mekanics.ch) # GITHUB: https://github.com/mekanics # TWITTER: @jolyAlexandre -# VERSION: 0.0.1 +# VERSION: 0.0.2 # LICENSE: MIT # ----------------------------------------------------------------------------- local -a _1st_arguments _1st_arguments=( 'help:Show help for the given command.' + 'init:Generate a Podfile for the current directory.' 'install:Install project dependencies' 'ipc:Inter-process communication' 'list:List pods' From bdb2cabaa68a8c3af72df5a10bb3925fe1eda45e Mon Sep 17 00:00:00 2001 From: Alexandre Joly Date: Tue, 10 Sep 2013 09:17:09 +0200 Subject: [PATCH 053/113] typo --- plugins/pod/_pod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/pod/_pod b/plugins/pod/_pod index 6dd8b6371..745e9b15d 100644 --- a/plugins/pod/_pod +++ b/plugins/pod/_pod @@ -14,8 +14,8 @@ local -a _1st_arguments _1st_arguments=( - 'help:Show help for the given command.' - 'init:Generate a Podfile for the current directory.' + 'help:Show help for the given command' + 'init:Generate a Podfile for the current directory' 'install:Install project dependencies' 'ipc:Inter-process communication' 'list:List pods' From 8735dfd87e98d79aa3a809117630cec907c1a86d Mon Sep 17 00:00:00 2001 From: Gaetan Semet Date: Tue, 10 Sep 2013 11:19:00 +0200 Subject: [PATCH 054/113] New aliases for repo plugin This helps a lot in day to day android development: - rs: repo sync (git fetch on all projects) - rra: auto rebase for all projet without loosing uncommited changes - rsrra: do both steps at once Signed-off-by: Gaetan Semet --- plugins/repo/repo.plugin.zsh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/repo/repo.plugin.zsh b/plugins/repo/repo.plugin.zsh index 9cc336959..d690a9d22 100644 --- a/plugins/repo/repo.plugin.zsh +++ b/plugins/repo/repo.plugin.zsh @@ -1,2 +1,12 @@ # Aliases alias r='repo' +compdef _repo r=repo + +alias rra='repo rebase --auto-stash' +compdef _repo rra='repo rebase --auto-stash' + +alias rs='repo sync' +compdef _repo rs='repo sync' + +alias rsrra='repo sync ; repo rebase --auto-stash' +compdef _repo rsrra='repo sync ; repo rebase --auto-stash' From 45438528761b0bbc143f8f2f013ee01917eb48cc Mon Sep 17 00:00:00 2001 From: Gaetan Semet Date: Tue, 10 Sep 2013 11:33:58 +0200 Subject: [PATCH 055/113] Completion for python, pep8, autopep8 and pylint Signed-off-by: Gaetan Semet --- plugins/autopep8/_autopep8 | 32 +++++++++++++++++ plugins/autopep8/autopep8.plugin.zsh | 0 plugins/pep8/_pep8 | 34 ++++++++++++++++++ plugins/pylint/_pylint | 31 ++++++++++++++++ plugins/pylint/pylint.plugin.zsh | 3 ++ plugins/python/_python | 54 ++++++++++++++++++++++++++++ plugins/python/python.plugin.zsh | 1 + 7 files changed, 155 insertions(+) create mode 100644 plugins/autopep8/_autopep8 create mode 100644 plugins/autopep8/autopep8.plugin.zsh create mode 100644 plugins/pep8/_pep8 create mode 100644 plugins/pylint/_pylint create mode 100644 plugins/pylint/pylint.plugin.zsh create mode 100644 plugins/python/_python diff --git a/plugins/autopep8/_autopep8 b/plugins/autopep8/_autopep8 new file mode 100644 index 000000000..c14d06d66 --- /dev/null +++ b/plugins/autopep8/_autopep8 @@ -0,0 +1,32 @@ +#compdef autopep8 +# +# this is zsh completion function file. +# generated by genzshcomp(ver: 0.5.1) +# + +typeset -A opt_args +local context state line + +_arguments -s -S \ + "--help[show this help message and exit]:" \ + "-h[show this help message and exit]:" \ + "--version[show program's version number and exit]:" \ + "--verbose[print verbose messages; multiple -v result in more verbose messages]" \ + "-v[print verbose messages; multiple -v result in more verbose messages]" \ + "--diff[print the diff for the fixed source]" \ + "-d[print the diff for the fixed source]" \ + "--in-place[make changes to files in place]" \ + "-i[make changes to files in place]" \ + "--recursive[run recursively; must be used with --in-place or --diff]" \ + "-r[run recursively; must be used with --in-place or --diff]" \ + "--jobs[number of parallel jobs; match CPU count if value is less than 1]::n number of parallel jobs; match CPU count if value is:_files" \ + "-j[number of parallel jobs; match CPU count if value is less than 1]::n number of parallel jobs; match CPU count if value is:_files" \ + "--pep8-passes[maximum number of additional pep8 passes (default: 100)]::n:_files" \ + "-p[maximum number of additional pep8 passes (default: 100)]::n:_files" \ + "-a[-a result in more aggressive changes]::result:_files" \ + "--exclude[exclude files/directories that match these comma- separated globs]::globs:_files" \ + "--list-fixes[list codes for fixes; used by --ignore and --select]" \ + "--ignore[do not fix these errors/warnings (default E226,E24)]::errors:_files" \ + "--select[fix only these errors/warnings (e.g. E4,W)]::errors:_files" \ + "--max-line-length[set maximum allowed line length (default: 79)]::n:_files" \ + "*::args:_files" diff --git a/plugins/autopep8/autopep8.plugin.zsh b/plugins/autopep8/autopep8.plugin.zsh new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/pep8/_pep8 b/plugins/pep8/_pep8 new file mode 100644 index 000000000..ce19951dc --- /dev/null +++ b/plugins/pep8/_pep8 @@ -0,0 +1,34 @@ +#compdef pep8 +# +# this is zsh completion function file. +# generated by genzshcomp(ver: 0.5.1) +# + +typeset -A opt_args +local context state line + +_arguments -s -S \ + "--help[show this help message and exit]:" \ + "-h[show this help message and exit]:" \ + "--version[show program's version number and exit]:" \ + "--verbose[print status messages, or debug with -vv]" \ + "-v[print status messages, or debug with -vv]" \ + "--quiet[report only file names, or nothing with -qq]" \ + "-q[report only file names, or nothing with -qq]" \ + "--repeat[(obsolete) show all occurrences of the same error]" \ + "-r[(obsolete) show all occurrences of the same error]" \ + "--first[show first occurrence of each error]" \ + "--exclude[exclude files or directories which match these comma separated patterns (default: .svn,CVS,.bzr,.hg,.git,__pycache__)]::patterns:_files" \ + "--filename[when parsing directories, only check filenames matching these comma separated patterns (default: *.py)]::patterns:_files" \ + "--select[select errors and warnings (e.g. E,W6)]::errors:_files" \ + "--ignore[skip errors and warnings (e.g. E4,W)]::errors:_files" \ + "--show-source[show source code for each error]" \ + "--show-pep8[show text of PEP 8 for each error (implies --first)]" \ + "--statistics[count errors and warnings]" \ + "--count[print total number of errors and warnings to standard error and set exit code to 1 if total is not null]" \ + "--max-line-length[set maximum allowed line length (default: 79)]::n:_files" \ + "--format[set the error format \[default|pylint|\]]::format:_files" \ + "--diff[report only lines changed according to the unified diff received on STDIN]" \ + "--benchmark[measure processing speed are read from the \[pep8\] section of the tox.ini fg file located in any parent folder of the path(s) llowed options are: exclude, filename, select, ngth, count, format, quiet, show-pep8, show-source, .]" \ + "--config[user config file location (default: /home/gsemet/.config/pep8)]::path:_files" \ + "*::args:_files" diff --git a/plugins/pylint/_pylint b/plugins/pylint/_pylint new file mode 100644 index 000000000..e466d051b --- /dev/null +++ b/plugins/pylint/_pylint @@ -0,0 +1,31 @@ +#compdef pylint +# +# this is zsh completion function file. +# generated by genzshcomp(ver: 0.5.1) +# + +typeset -A opt_args +local context state line + +_arguments -s -S \ + "--help[show this help message and exit]:" \ + "-h[show this help message and exit]:" \ + "--version[show program's version number and exit]:" \ + "--long-help[more verbose help.]" \ + "--rcfile[Specify a configuration file.]:::_files" \ + "--errors-only[In error mode, checkers without error messages are disabled and for others, only the ERROR messages are displayed, and no reports are done by default]" \ + "-E[In error mode, checkers without error messages are disabled and for others, only the ERROR messages are displayed, and no reports are done by default]" \ + "--ignore[Add files or directories to the blacklist. They should be base names, not paths. \[current: CVS\]]::[,...]:_files" \ + "--help-msg[Display a help message for the given message id and exit. The value may be a comma separated list of message ids.]:::_files" \ + "--generate-rcfile[Generate a sample configuration file according to the current configuration. You can put other options before this one to get them in the generated configuration.]" \ + "--enable[Enable the message, report, category or checker with the given id(s). You can either give multiple identifier separated by comma (,) or put this option multiple time.]:::_files" \ + "-e[Enable the message, report, category or checker with the given id(s). You can either give multiple identifier separated by comma (,) or put this option multiple time.]:::_files" \ + "--disable[Disable the message, report, category or checker with the given id(s). You can either give multiple identifier separated by comma (,) or put this option multiple time (only on the command line, not in the configuration file where it should appear only once).]:::_files" \ + "-d[Disable the message, report, category or checker with the given id(s). You can either give multiple identifier separated by comma (,) or put this option multiple time (only on the command line, not in the configuration file where it should appear only once).]:::_files" \ + "--output-format[Set the output format. Available formats are text, parseable, colorized, msvs (visual studio) and html \[current: text\]]:::_files" \ + "-f[Set the output format. Available formats are text, parseable, colorized, msvs (visual studio) and html \[current: text\]]:::_files" \ + "--include-ids[Include message's id in output \[current: no\]]:::_files" \ + "-i[Include message's id in output \[current: no\]]:::_files" \ + "--reports[Tells whether to display a full report or only the messages \[current: yes\]]:::_files" \ + "-r[Tells whether to display a full report or only the messages \[current: yes\]]:::_files" \ + "*::args:_files" diff --git a/plugins/pylint/pylint.plugin.zsh b/plugins/pylint/pylint.plugin.zsh new file mode 100644 index 000000000..6760c67b0 --- /dev/null +++ b/plugins/pylint/pylint.plugin.zsh @@ -0,0 +1,3 @@ +# Aliases +alias pylint-quick='pylint --reports=n --include-ids=y' +compdef _pylint-quick pylint-quick='pylint --reports=n --include-ids=y' \ No newline at end of file diff --git a/plugins/python/_python b/plugins/python/_python new file mode 100644 index 000000000..f517d4806 --- /dev/null +++ b/plugins/python/_python @@ -0,0 +1,54 @@ +#compdef python + +# Python 2.6 +# Python 3.0 + +local curcontext="$curcontext" state line expl +typeset -A opt_args + +local -a args + +if _pick_variant python3=Python\ 3 python2 --version; then + args=( + '(-bb)-b[issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]' + '(-b)-bb[issue errors about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]' + ) +else + args=( + '-Q+[division options]:division option:(old warn warnall new)' + '(-tt)-t[issue warnings about inconsistent tab usage]' + '(-t)-tt[issue errors about inconsistent tab usage]' + '-3[warn about Python 3.x incompatibilities]' + ) +fi + +_arguments -C -s -S "$args[@]" \ + "-B[don't write .py\[co\] files on import]" \ + '(1 -)-c+[program passed in as string (terminates option list)]:python command:' \ + '-d[debug output from parser]' \ + '-E[ignore PYTHON* environment variables (such as PYTHONPATH)]' \ + '(1 * -)-h[display help information]' \ + '-i[inspect interactively after running script]' \ + '(1 * -)-m[run library module as a script (terminates option list)]:module:->modules' \ + '-O[optimize generated bytecode slightly]' \ + '-OO[remove doc-strings in addition to the -O optimizations]' \ + "-s[don't add user site directory to sys.path]" \ + "-S[don't imply 'import site' on initialization]" \ + '-u[unbuffered binary stdout and stderr]' \ + '-v[verbose (trace import statements)]' \ + '(1 * -)'{-V,--version}'[display version information]' \ + '-W+[warning control]:warning filter (action\:message\:category\:module\:lineno):(default always ignore module once error)' \ + '-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \ + '(-)1:script file:_files -g "*.py(|c|o)(-.)"' \ + '*::script argument: _normal' && return + +if [[ "$state" = modules ]]; then + local -a modules + modules=( + ${${=${(f)"$(_call_program modules $words[1] -c \ + 'from\ pydoc\ import\ help\;\ help\(\"modules\"\)')"}[2,-3]}:#\(package\)} + ) + _wanted modules expl module compadd -a modules && return +fi + +return 1 diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh index 852c8b919..319bf0bf0 100644 --- a/plugins/python/python.plugin.zsh +++ b/plugins/python/python.plugin.zsh @@ -10,3 +10,4 @@ function pyclean() { # Grep among .py files alias pygrep='grep --include="*.py"' + From 40b1cf01035a3d74395b5d9def4f79af17fca4c8 Mon Sep 17 00:00:00 2001 From: Alexandre Joly Date: Tue, 10 Sep 2013 15:20:57 +0200 Subject: [PATCH 056/113] repo list search one level deeper the folder structure changed '.cocoapods/' -> '.cocoapods/repos' --- plugins/pod/_pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/pod/_pod b/plugins/pod/_pod index 745e9b15d..ba0c9ab30 100644 --- a/plugins/pod/_pod +++ b/plugins/pod/_pod @@ -159,7 +159,7 @@ __first_command_list () } __repo_list() { - _wanted application expl 'repo' compadd $(command ls -1 ~/.cocoapods 2>/dev/null | sed -e 's/ /\\ /g') + _wanted application expl 'repo' compadd $(command ls -1 ~/.cocoapods/repos 2>/dev/null | sed -e 's/ /\\ /g') } __pod-repo() { From dfe36d7b7b6d70e5179f57afadfd923a36b3ff5a Mon Sep 17 00:00:00 2001 From: Nathan Cox Date: Wed, 18 Sep 2013 08:09:15 -0700 Subject: [PATCH 057/113] Added virtualenv plugin data to af-magic theme. --- themes/af-magic.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/af-magic.zsh-theme b/themes/af-magic.zsh-theme index c1b00c62b..4cf282590 100644 --- a/themes/af-magic.zsh-theme +++ b/themes/af-magic.zsh-theme @@ -27,7 +27,7 @@ eval my_gray='$FG[237]' eval my_orange='$FG[214]' # right prompt -RPROMPT='$my_gray%n@%m%{$reset_color%}%' +PROMPT='$(virtualenv_prompt_info)$my_gray%n@%m%{$reset_color%}%' # git settings ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075](branch:" From 05b3ea342ad581d02ed652a4bbe29786026a5b50 Mon Sep 17 00:00:00 2001 From: Steven Schmid Date: Tue, 1 Oct 2013 18:08:15 +0200 Subject: [PATCH 058/113] Fix work_in_progress in empty git repos I noticed that the function ``work_in_progress``, which is used in the "gallois"-theme, would print ``fatal: bad default revision 'HEAD'`` in a new folder after ``git init``. This is the fix. --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index d8ea3ae0c..14172b881 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -138,7 +138,7 @@ compdef _git glp=git-log # # 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 + if $(git log -n 1 2>/dev/null | grep -q -c wip); then echo "WIP!!" fi } From 1dddec6f0f947ed80eed128033e4ebc4d4448138 Mon Sep 17 00:00:00 2001 From: Puneet Goyal Date: Sat, 12 Oct 2013 07:30:16 +0530 Subject: [PATCH 059/113] removing a github redirect during install --- README.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.textile b/README.textile index 86dd5da22..810569486 100644 --- a/README.textile +++ b/README.textile @@ -14,11 +14,11 @@ You can install this via the command line with either `curl` or `wget`. h4. via `curl` -@curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh@ +@curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh@ h4. via `wget` -@wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@ +@wget --no-check-certificate https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh@ h3. The manual way From c0c9fc02543eb14de49b0416e3df1100845633d8 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 16 Oct 2013 15:44:49 +0800 Subject: [PATCH 060/113] Add support .venv folder as virtual env --- plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh index 670c287bd..16f32da6e 100644 --- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh +++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh @@ -17,6 +17,8 @@ if (( $+commands[$virtualenvwrapper] )); then # Check for virtualenv name override if [[ -f "$PROJECT_ROOT/.venv" ]]; then ENV_NAME=`cat "$PROJECT_ROOT/.venv"` + elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]];then + ENV_NAME="$PROJECT_ROOT/.venv" elif [[ "$PROJECT_ROOT" != "." ]]; then ENV_NAME=`basename "$PROJECT_ROOT"` else @@ -27,6 +29,8 @@ if (( $+commands[$virtualenvwrapper] )); then if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME" + elif [[ -e "$ENV_NAME/bin/activate" ]]; then + source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME" fi fi elif [ $CD_VIRTUAL_ENV ]; then From f057737e57b3e3acbd32614b4f4f03103ce764aa Mon Sep 17 00:00:00 2001 From: dejan Date: Wed, 16 Oct 2013 12:36:48 +0200 Subject: [PATCH 061/113] Added the spectrum_bls function, which prints all 256 colors set as the background. We can easily see which color we want to set when changing the PS1 shell variable, since the colors are more distinctive. --- lib/spectrum.zsh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh index 2fdf537ef..166c942fb 100644 --- a/lib/spectrum.zsh +++ b/lib/spectrum.zsh @@ -26,3 +26,10 @@ function spectrum_ls() { done } +# Show all 256 colors where the background is set to specific color +function spectrum_bls() { + for code in {000..255}; do + ((cc = code + 1)) + print -P -- "$BG[$code]$code: Test %{$reset_color%}" + done +} From e3c489bd08236828286e01b4561e6b73b5e518bd Mon Sep 17 00:00:00 2001 From: Kaiwen Xu Date: Fri, 25 Oct 2013 01:40:55 -0400 Subject: [PATCH 062/113] Minor gitignore fix. (Sorry my bad). --- .gitignore | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index c2b47bba7..51a5ee6c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,9 @@ locals.zsh log/.zsh_history projects.zsh --custom/* --!custom/example --!custom/example.zsh +custom/* +!custom/example +!custom/example.zsh *.swp !custom/example.zshcache cache/ From 03dc3a84630a1e3227bd0e772cca5d5f1fd4a9d4 Mon Sep 17 00:00:00 2001 From: Kevin Bongart Date: Fri, 25 Oct 2013 11:54:56 -0400 Subject: [PATCH 063/113] Add command blacklist support to bundler plugin --- plugins/bundler/bundler.plugin.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 5bd28cbdc..9b589c5a8 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -13,9 +13,13 @@ fi 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 taps thin thor unicorn unicorn_rails puma) +# Remove $UNBUNDLED_COMMANDS from the bundled_commands list +for cmd in $UNBUNDLED_COMMANDS; do + bundled_commands=(${bundled_commands#$cmd}); +done + ## Functions _bundler-installed() { From 7567fd7f27f80bb6f168cd8fcf589157348b069f Mon Sep 17 00:00:00 2001 From: Kevin Bongart Date: Fri, 25 Oct 2013 12:01:28 -0400 Subject: [PATCH 064/113] Re-add whitespace --- plugins/bundler/bundler.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 9b589c5a8..10b1e21cf 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -13,6 +13,7 @@ fi 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 taps thin thor unicorn unicorn_rails puma) # Remove $UNBUNDLED_COMMANDS from the bundled_commands list From 1e9f55f09ddae273836ad1a69a0068b039de9fcd Mon Sep 17 00:00:00 2001 From: Andrew Vit Date: Mon, 23 Apr 2012 14:03:26 -0700 Subject: [PATCH 065/113] Add configuration placeholders to installer template Although the zshrc template adds a PATH= string, this is overwritten by the installer script. This allows it to be placed anywhere in the file instead of having to append at the end. --- templates/zshrc.zsh-template | 19 ++++++++++++++++++- tools/install.sh | 5 ++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 1dfb6998c..2ebfaf3e7 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -44,4 +44,21 @@ plugins=(git) source $ZSH/oh-my-zsh.sh -# Customize to your needs... +# User configuration + +export PATH=$HOME/bin:/usr/local/bin:$PATH +# export MANPATH="/usr/local/man:$MANPATH" + +# # Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='mvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# ssh +# export SSH_KEY_PATH="~/.ssh/dsa_id" + diff --git a/tools/install.sh b/tools/install.sh index a2bd5665a..9017bd302 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -21,7 +21,9 @@ echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[ cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" -echo "export PATH=\$PATH:$PATH" >> ~/.zshrc +sed -i -e "/export PATH=/ c\\ +export PATH=\"$PATH\" +" ~/.zshrc echo "\033[0;34mTime to change your default shell to zsh!\033[0m" chsh -s `which zsh` @@ -34,5 +36,6 @@ echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m echo "\033[0;32m"' /____/ '"\033[0m" echo "\n\n \033[0;32m....is now installed.\033[0m" +echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m" /usr/bin/env zsh source ~/.zshrc From 103fc334d6ccb04120b87596e82b5ddaca6d6d44 Mon Sep 17 00:00:00 2001 From: Adrien Dudouit-Exposito Date: Sat, 26 Oct 2013 11:43:59 +0200 Subject: [PATCH 066/113] Add "options" as a valide 1st argument --- plugins/brew/_brew | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/brew/_brew b/plugins/brew/_brew index bf0a286c1..a25caf40c 100644 --- a/plugins/brew/_brew +++ b/plugins/brew/_brew @@ -26,6 +26,7 @@ _1st_arguments=( 'list:list files in a formula or not-installed formulae' 'log:git commit log for a formula' 'missing:check all installed formuale for missing dependencies.' + 'options:display install options specific to formula.' 'outdated:list formulas for which a newer version is available' 'prune:remove dead links' 'reinstall:reinstall a formula' From f731d6c16fd49e8140250a90e91d01f49d13da17 Mon Sep 17 00:00:00 2001 From: Kaiwen Xu Date: Mon, 28 Oct 2013 11:06:10 -0400 Subject: [PATCH 067/113] themes plugin now picks a random theme if no argument is provided. --- plugins/themes/themes.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/themes/themes.plugin.zsh b/plugins/themes/themes.plugin.zsh index 8bab257ea..7519b0253 100644 --- a/plugins/themes/themes.plugin.zsh +++ b/plugins/themes/themes.plugin.zsh @@ -1,6 +1,6 @@ function theme { - if [ "$1" = "random" ]; then + if [ -z "$1" ] || [ "$1" = "random" ]; then themes=($ZSH/themes/*zsh-theme) N=${#themes[@]} ((N=(RANDOM%N)+1)) From 0eb86f82d6d3a6cf05b11818bb69ba4de80124da Mon Sep 17 00:00:00 2001 From: Alexandre Joly Date: Tue, 29 Oct 2013 10:33:37 +0100 Subject: [PATCH 068/113] updated to the latest version of cocoapods 0.27.1 --- plugins/pod/_pod | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/pod/_pod b/plugins/pod/_pod index ba0c9ab30..8c0f4460f 100644 --- a/plugins/pod/_pod +++ b/plugins/pod/_pod @@ -3,12 +3,12 @@ # ----------------------------------------------------------------------------- # FILE: _pod -# DESCRIPTION: Cocoapods (0.24.0) autocomplete plugin for Oh-My-Zsh +# DESCRIPTION: Cocoapods (0.27.1) autocomplete plugin for Oh-My-Zsh # http://cocoapods.org # AUTHOR: Alexandre Joly (alexandre.joly@mekanics.ch) # GITHUB: https://github.com/mekanics # TWITTER: @jolyAlexandre -# VERSION: 0.0.2 +# VERSION: 0.0.3 # LICENSE: MIT # ----------------------------------------------------------------------------- @@ -33,6 +33,7 @@ local -a _repo_arguments _repo_arguments=( 'add:Add a spec repo' 'lint:Validates all specs in a repo' + 'remove:Remove a spec repo.' 'update:Update a spec repo' ) @@ -194,6 +195,12 @@ __pod-repo() { (add) _arguments \ $_inherited_options + + (remove) + _arguments \ + $_inherited_options \ + ':feature:__repo_list' + ;; esac ;; esac From c81e42f050b9b7152d9ebfa4a3d5a0442159b8d1 Mon Sep 17 00:00:00 2001 From: onemouth Date: Wed, 30 Oct 2013 11:05:35 +0800 Subject: [PATCH 069/113] Update git.plugin.zsh add command to ignore changes to file temporarily --- plugins/git/git.plugin.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index c7e98654a..d0b51434d 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -149,3 +149,12 @@ function work_in_progress() { # 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' + +# these alias ignore changes to file +alias gignore='git update-index --assume-unchanged' +alias gunignore='git update-index --no-assume-unchanged' +# list temporarily ignored files +alias gignored='git ls-files -v | grep "^[[:lower:]]"' + + + From 78df6e96f5ad2d6df77af39f70f4906a09700849 Mon Sep 17 00:00:00 2001 From: Brandon W Maister Date: Tue, 29 Oct 2013 23:02:44 -0400 Subject: [PATCH 070/113] pip: successfully cache all the packages Switch to using curl and regular expressions to generate a local cache file so that we don't need to hit pypi.python.org every time. This (obviously) results in a massive speed improvement, especially if you spawn new shells frequently. This also makes the autocompletion work for me, it didn't before. (pip would always time out.) And, also, for fun: This allows you to explicitly set which pip indexes to use. Technically the old version of the plugin should have had this behavior automatically -- without having to do more than configure pip -- but the install completion never worked for me so this is a net gain in functionality. --- plugins/pip/_pip | 4 ++-- plugins/pip/pip.plugin.zsh | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 plugins/pip/pip.plugin.zsh diff --git a/plugins/pip/_pip b/plugins/pip/_pip index fb8765c7e..967da48ca 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]')) + zsh-pip-cache-packages + piplist=($(cat $ZSH_PIP_CACHE_FILE)) fi } diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh new file mode 100644 index 000000000..78532a6d3 --- /dev/null +++ b/plugins/pip/pip.plugin.zsh @@ -0,0 +1,37 @@ +# Usage: +# Just add pip to your installed plugins. + +# If you would like to change the cheeseshops used for autocomplete set +# ZSH_PIP_INDEXES in your zshrc. If one of your indexes are bogus you won't get +# any kind of error message, pip will just not autocomplete from them. Double +# check! +# +# If you would like to clear your cache, go ahead and do a +# "zsh-pip-clear-cache". + +ZSH_PIP_CACHE_FILE=~/.pip/zsh-cache +ZSH_PIP_INDEXES=(https://pypi.python.org/simple/) + +zsh-pip-clear-cache() { + rm $ZSH_PIP_CACHE_FILE + unset piplist +} + +zsh-pip-cache-packages() { + if [[ ! -d ${PIP_CACHE_FILE:h} ]]; then + mkdir -p ${PIP_CACHE_FILE:h} + fi + + if [[ ! -f $ZSH_PIP_CACHE_FILE ]]; then + echo -n "(...caching package index...)" + tmp_cache=/tmp/zsh_tmp_cache + for index in $ZSH_PIP_INDEXES ; do + # well... I've already got two problems + curl $index 2>/dev/null | \ + sed -nr '/^([^<]+).*/\1/p' \ + >> $tmp_cache + done + sort $tmp_cache | uniq | tr '\n' ' ' > $ZSH_PIP_CACHE_FILE + rm $tmp_cache + fi +} From 008e57aa5aec0f38445785da58a11462ef9451f9 Mon Sep 17 00:00:00 2001 From: Brandon W Maister Date: Wed, 30 Oct 2013 21:00:08 -0400 Subject: [PATCH 071/113] Make the pip cache work with djangopypi2 Also add a test function that allows messing with the cache-creating regex with some assurance that you're not trampling other people's index-parsing. --- plugins/pip/pip.plugin.zsh | 43 +++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh index 78532a6d3..71f977bbf 100644 --- a/plugins/pip/pip.plugin.zsh +++ b/plugins/pip/pip.plugin.zsh @@ -17,6 +17,10 @@ zsh-pip-clear-cache() { unset piplist } +zsh-pip-clean-packages() { + sed -nr '/([^<]+).*/\1/p' +} + zsh-pip-cache-packages() { if [[ ! -d ${PIP_CACHE_FILE:h} ]]; then mkdir -p ${PIP_CACHE_FILE:h} @@ -28,10 +32,47 @@ zsh-pip-cache-packages() { for index in $ZSH_PIP_INDEXES ; do # well... I've already got two problems curl $index 2>/dev/null | \ - sed -nr '/^([^<]+).*/\1/p' \ + zsh-pip-clean-packages \ >> $tmp_cache done sort $tmp_cache | uniq | tr '\n' ' ' > $ZSH_PIP_CACHE_FILE rm $tmp_cache fi } + +# A test function that validates the regex against known forms of the simple +# index. If you modify the regex to make it work for you, you should add a test +# case in here and make sure that your changes don't break things for someone +# else. +zsh-pip-test-clean-packages() { + local expected + local actual + expected="0x10c-asm +1009558_nester" + + actual=$(echo -n "Simple Index +0x10c-asm
+1009558_nester
+" | zsh-pip-clean-packages) + + if [[ $actual != $expected ]] ; then + echo -e "python's simple index is broken:\n$actual\n !=\n$expected" + else + echo "python's simple index is fine" + fi + + actual=$(echo -n ' + + Simple Package Index + + + 0x10c-asm
+ 1009558_nester
+' | zsh-pip-clean-packages) + + if [[ $actual != $expected ]] ; then + echo -e "the djangopypi2 index is broken:\n$actual\n !=\n$expected" + else + echo "the djangopypi2 index is fine" + fi +} From 37be62ffb7856cda96a187f4acf79afe2fed2514 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 31 Oct 2013 13:38:12 +0100 Subject: [PATCH 072/113] randquote plugin correcting an issue about encoding some people was having added a message when the user doesn't have curl added varibles for colors->easier to customize --- plugins/rand-quote/rand-quote.plugin.zsh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/rand-quote/rand-quote.plugin.zsh b/plugins/rand-quote/rand-quote.plugin.zsh index 5544ca565..c3bf6234e 100644 --- a/plugins/rand-quote/rand-quote.plugin.zsh +++ b/plugins/rand-quote/rand-quote.plugin.zsh @@ -5,13 +5,24 @@ # Don't remove this header, thank you # Usage: quote +WHO_COLOR="\e[0;33m" +TEXT_COLOR="\e[0;35m" +COLON_COLOR="\e[0;35m" +END_COLOR="\e[m" + if [[ -x `which curl` ]]; then function quote() { - Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php3" | grep -m 1 "dt ") + Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php3" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ") TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g') W=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g') - echo "\e[0;33m${W}\e[0;30m: \e[0;35m“${TXT}”\e[m" + if [ "$W" -a "$TXT" ]; then + echo "${WHO_COLOR}${W}${COLON_COLOR}: ${TEXT_COLOR}“${TXT}”${END_COLOR}" + else + quote + fi } #quote +else + echo "rand-quote plugin needs curl to work" >&2 fi From 7eb2f528a65a45b88fdda6bdeb76ceb5ea16f5e3 Mon Sep 17 00:00:00 2001 From: Wari Wahab Date: Mon, 4 Nov 2013 23:20:12 +0800 Subject: [PATCH 073/113] `linuxonly` doesn't work unless renamed properly Unlike all other files listed in the themes directory, this file is the only one that's "doing it's own thing" --- themes/{linuxonly => linuxonly.zsh-theme} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename themes/{linuxonly => linuxonly.zsh-theme} (100%) diff --git a/themes/linuxonly b/themes/linuxonly.zsh-theme similarity index 100% rename from themes/linuxonly rename to themes/linuxonly.zsh-theme From 5718d2b688e1711cdc571fa0ab39871dd4e5bb48 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Mon, 4 Nov 2013 23:35:42 +0100 Subject: [PATCH 074/113] Forgot one symbol for hg. --- themes/agnoster.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 7df4ec1e8..54916a95d 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -124,7 +124,7 @@ prompt_hg() { else prompt_segment green black fi - echo -n " $rev@$branch" $st + echo -n "☿ $rev@$branch" $st fi fi } From 8cfc7d66774e12c8502b63ed0c48f3a216c33acf Mon Sep 17 00:00:00 2001 From: James Seward Date: Mon, 4 Nov 2013 21:00:11 -0500 Subject: [PATCH 075/113] Prevent errors in prompts if no info available. Define empty functions instead of none at all if we can't figure out the platform. --- plugins/battery/battery.plugin.zsh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh index 66bf46d13..9f053383a 100644 --- a/plugins/battery/battery.plugin.zsh +++ b/plugins/battery/battery.plugin.zsh @@ -79,4 +79,14 @@ elif [[ $(uname) == "Linux" ]] ; then echo "∞" fi } +else + # Empty functions so we don't cause errors in prompts + function battery_pct_remaining() { + } + + function battery_time_remaining() { + } + + function battery_pct_prompt() { + } fi From efc37c1f715eb77be5f30411fa36589727643126 Mon Sep 17 00:00:00 2001 From: Pablo Rubianes Date: Wed, 6 Nov 2013 20:10:59 -0200 Subject: [PATCH 076/113] Modification to the frisk theme to work with the BZR lib --- lib/bzr.zsh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lib/bzr.zsh diff --git a/lib/bzr.zsh b/lib/bzr.zsh new file mode 100644 index 000000000..005a16500 --- /dev/null +++ b/lib/bzr.zsh @@ -0,0 +1,10 @@ +## Bazaar integration +## Just works with the GIT integration just add $(bzr_prompt_info) to the PROMPT +function bzr_prompt_info() { + BZR_CB=`bzr nick 2> /dev/null | grep -v "ERROR" | cut -d ":" -f2 | awk -F / '{print "bzr::"$1}'` + if [ -n "$BZR_CB" ]; then + BZR_DIRTY="" + [[ -n `bzr status` ]] && BZR_DIRTY=" %{$fg[red]%} * %{$fg[green]%}" + echo "$ZSH_THEME_SCM_PROMPT_PREFIX$BZR_CB$BZR_DIRTY$ZSH_THEME_GIT_PROMPT_SUFFIX" + fi +} \ No newline at end of file From 248890b6e699365dee469178ec96f5d1fad91871 Mon Sep 17 00:00:00 2001 From: Pablo Rubianes Date: Wed, 6 Nov 2013 20:16:09 -0200 Subject: [PATCH 077/113] Modification to the frisk theme to work with the BZR lib --- themes/frisk.zsh-theme | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/themes/frisk.zsh-theme b/themes/frisk.zsh-theme index 2c999a6a6..653c7461f 100644 --- a/themes/frisk.zsh-theme +++ b/themes/frisk.zsh-theme @@ -10,13 +10,3 @@ ZSH_THEME_GIT_PROMPT_PREFIX=$ZSH_THEME_SCM_PROMPT_PREFIX$GIT_CB ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} " ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}" ZSH_THEME_GIT_PROMPT_CLEAN="" - -## Bazaar integration -bzr_prompt_info() { - BZR_CB=`bzr nick 2> /dev/null | grep -v "ERROR" | cut -d ":" -f2 | awk -F / '{print "bzr::"$1}'` - if [ -n "$BZR_CB" ]; then - BZR_DIRTY="" - [[ -n `bzr status` ]] && BZR_DIRTY="%{$fg[red]%} *%{$reset_color%}" - echo "$ZSH_THEME_SCM_PROMPT_PREFIX$BZR_CB$BZR_DIRTY$ZSH_THEME_GIT_PROMPT_SUFFIX" - fi -} From 5c73cb671bde7a151a7a36fe782ce44dba1b0531 Mon Sep 17 00:00:00 2001 From: isquariel Date: Fri, 8 Nov 2013 23:26:05 +0400 Subject: [PATCH 078/113] Added nvm.zsh to detect current Node.js version --- lib/nvm.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 lib/nvm.zsh diff --git a/lib/nvm.zsh b/lib/nvm.zsh new file mode 100644 index 000000000..5cadf7061 --- /dev/null +++ b/lib/nvm.zsh @@ -0,0 +1,9 @@ +# get the node.js version +function nvm_prompt_info() { + [ -f $HOME/.nvm/nvm.sh ] || return + local nvm_prompt + nvm_prompt=$(node -v 2>/dev/null) + [[ "${nvm_prompt}x" == "x" ]] && return + nvm_prompt=${nvm_prompt:1} + echo "${ZSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt}${ZSH_THEME_NVM_PROMPT_SUFFIX}" +} From d34ab7f3732b49fd624c80e950aae3f166800a24 Mon Sep 17 00:00:00 2001 From: isquariel Date: Fri, 8 Nov 2013 23:26:25 +0400 Subject: [PATCH 079/113] Added the Bureau theme --- themes/bureau.zsh-theme | 113 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 themes/bureau.zsh-theme diff --git a/themes/bureau.zsh-theme b/themes/bureau.zsh-theme new file mode 100644 index 000000000..1d88f54d0 --- /dev/null +++ b/themes/bureau.zsh-theme @@ -0,0 +1,113 @@ +# oh-my-zsh Bureau Theme + +### NVM + +ZSH_THEME_NVM_PROMPT_PREFIX="%B⬡%b " +ZSH_THEME_NVM_PROMPT_SUFFIX="" + +### Git [±master ▾●] + +ZSH_THEME_GIT_PROMPT_PREFIX="[%{$fg_bold[green]%}±%{$reset_color%}%{$fg_bold[white]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}]" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[cyan]%}▴%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg[magenta]%}▾%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[yellow]%}●%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}●%{$reset_color%}" + +bureau_git_branch () { + ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ + ref=$(command git rev-parse --short HEAD 2> /dev/null) || return + echo "${ref#refs/heads/}" +} + +bureau_git_status () { + _INDEX=$(command git status --porcelain -b 2> /dev/null) + _STATUS="" + if $(echo "$_INDEX" | grep '^[AMRD]. ' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED" + fi + if $(echo "$_INDEX" | grep '^.[MTD] ' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" + fi + if $(echo "$_INDEX" | grep -E '^\?\? ' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" + fi + if $(echo "$_INDEX" | grep '^UU ' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" + fi + if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED" + fi + if $(echo "$_INDEX" | grep '^## .*ahead' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" + fi + if $(echo "$_INDEX" | grep '^## .*behind' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" + fi + if $(echo "$_INDEX" | grep '^## .*diverged' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED" + fi + + echo $_STATUS +} + +bureau_git_prompt () { + local _branch=$(bureau_git_branch) + local _status=$(bureau_git_status) + local _result="" + if [[ "${_branch}x" != "x" ]]; then + _result="$ZSH_THEME_GIT_PROMPT_PREFIX$_branch" + if [[ "${_status}x" != "x" ]]; then + _result="$_result $_status" + fi + _result="$_result$ZSH_THEME_GIT_PROMPT_SUFFIX" + fi + echo $_result +} + + +_PATH="%{$fg_bold[white]%}%~%{$reset_color%}" + +if [[ "%#" == "#" ]]; then + _USERNAME="%{$fg_bold[red]%}%n" + _LIBERTY="%{$fg[red]%}#" +else + _USERNAME="%{$fg_bold[white]%}%n" + _LIBERTY="%{$fg[green]%}$" +fi +_USERNAME="$_USERNAME%{$reset_color%}@%m" +_LIBERTY="$_LIBERTY%{$reset_color%}" + + +get_space () { + local STR=$1$2 + local zero='%([BSUbfksu]|([FB]|){*})' + local LENGTH=${#${(S%%)STR//$~zero/}} + local SPACES="" + (( LENGTH = ${COLUMNS} - $LENGTH - 1)) + + for i in {0..$LENGTH} + do + SPACES="$SPACES " + done + + echo $SPACES +} + +_1LEFT="$_USERNAME $_PATH" +_1RIGHT="[%*] " + +bureau_precmd () { + _1SPACES=`get_space $_1LEFT $_1RIGHT` + echo +} + +setopt prompt_subst +PROMPT='$_1LEFT$_1SPACES$_1RIGHT +> $_LIBERTY ' +RPROMPT='$(nvm_prompt_info) $(bureau_git_prompt)' + +autoload -U add-zsh-hook +add-zsh-hook precmd bureau_precmd From 009b906111ba0c71d3b2a5c6dd7a8f68ce3f521f Mon Sep 17 00:00:00 2001 From: Leonardo Santagada Date: Sat, 9 Nov 2013 13:02:38 -0200 Subject: [PATCH 080/113] agnoster theme not showing virtualenv status agnoster theme was checking if the default virtualenv prompt was turned off and not showing its own... so there was no way to see which virtualenv was selected. --- themes/agnoster.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 2db565266..2836de4b7 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -137,7 +137,7 @@ prompt_dir() { # Virtualenv: current working virtualenv prompt_virtualenv() { local virtualenv_path="$VIRTUAL_ENV" - if [[ -n $virtualenv_path && -z $VIRTUAL_ENV_DISABLE_PROMPT ]]; then + if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then prompt_segment blue black "(`basename $virtualenv_path`)" fi } From 96798c42f046fec7f01f53d10dd63f30ed6a1e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zsolt=20Sz=2E=20Sztup=C3=A1k?= Date: Mon, 11 Nov 2013 18:09:33 +0000 Subject: [PATCH 081/113] Fix issues with special characters when running mvn Setting the locale to C will stabilize sed, so it won't stop processing the mvn output when it encounters invalid characters (like binary data) This makes it also more viable to add the `alias mvn='mvn-color`, as the coloring is less obtrusive, and there won't be any issues with sed breaking because of an invalid character inside the stream --- plugins/mvn/mvn.plugin.zsh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 799f6fc8c..0c9141907 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -24,16 +24,18 @@ export RESET_FORMATTING=`tput sgr0` # Wrapper function for Maven's mvn command. mvn-color() { - # Filter mvn output using sed - mvn $@ | sed -e "s/\(\[INFO\]\ \-.*\)/${TEXT_BLUE}${BOLD}\1/g" \ - -e "s/\(\[INFO\]\ \[.*\)/${RESET_FORMATTING}${BOLD}\1${RESET_FORMATTING}/g" \ + ( + # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations + unset LANG + LC_CTYPE=C mvn $@ | sed -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[WARNING\].*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[ERROR\].*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}/g" \ + -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \ -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g" # Make sure formatting is reset echo -ne ${RESET_FORMATTING} + ) } # Override the mvn command with the colorized one. From 27f9747143e421e6908e9c2d0eb6247df4a3af8c Mon Sep 17 00:00:00 2001 From: Sabarish Kumar R Date: Tue, 12 Nov 2013 12:31:13 +0530 Subject: [PATCH 082/113] bundle plugin throwing error when bundle is not in path while initializing --- plugins/bundler/bundler.plugin.zsh | 44 ++++++++++++++++-------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 2e657e5a8..e390f8620 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -4,18 +4,6 @@ alias bp="bundle package" alias bo="bundle open" alias bu="bundle update" -bundler_version=`bundle version | cut -d' ' -f3` -if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then - if [[ "$(uname)" == 'Darwin' ]] - then - local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" - else - local cores_num="$(nproc)" - fi - eval "alias bi='bundle install --jobs=$cores_num'" -else - alias bi='bundle install' -fi # The following is based on https://github.com/gma/bundler-exec @@ -44,14 +32,28 @@ _run-with-bundler() { fi } -## Main program -for cmd in $bundled_commands; do - eval "function unbundled_$cmd () { $cmd \$@ }" - eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" - alias $cmd=bundled_$cmd +if _bundler-installed; then + bundler_version=`bundle version | cut -d' ' -f3` + if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then + if [[ "$(uname)" == 'Darwin' ]] + then + local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" + else + local cores_num="$(nproc)" + fi + eval "alias bi='bundle install --jobs=$cores_num'" + else + alias bi='bundle install' + fi - if which _$cmd > /dev/null 2>&1; then - compdef _$cmd bundled_$cmd=$cmd - fi -done + ## Main program + for cmd in $bundled_commands; do + eval "function unbundled_$cmd () { $cmd \$@ }" + eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" + alias $cmd=bundled_$cmd + if which _$cmd > /dev/null 2>&1; then + compdef _$cmd bundled_$cmd=$cmd + fi + done +fi From bb2064e92bdb2f64dfeb148bc0b9a61dfeff8f43 Mon Sep 17 00:00:00 2001 From: Marco Chan Date: Tue, 12 Nov 2013 15:55:16 +0800 Subject: [PATCH 083/113] Use environment specific open command when creating a new Jira issue. --- plugins/jira/jira.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 9aa192c1e..739ee7142 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -31,7 +31,7 @@ open_jira_issue () { if [ -z "$1" ]; then echo "Opening new issue" - `open $jira_url/secure/CreateIssue!default.jspa` + $open_cmd "$jira_url/secure/CreateIssue!default.jspa" else echo "Opening issue #$1" if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then From 4e7b0fe083ecc99c1ea8c250d8b9cfcde09f2cd3 Mon Sep 17 00:00:00 2001 From: Amila Perera Date: Wed, 13 Nov 2013 00:35:19 +0530 Subject: [PATCH 084/113] getting the projects name correctly and making compdef to work with mux alias --- plugins/tmuxinator/_tmuxinator | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/tmuxinator/_tmuxinator b/plugins/tmuxinator/_tmuxinator index f0ff304dd..117685279 100644 --- a/plugins/tmuxinator/_tmuxinator +++ b/plugins/tmuxinator/_tmuxinator @@ -1,4 +1,4 @@ -#compdef tmuxinator +#compdef tmuxinator mux #autoload local curcontext="$curcontext" state line ret=1 @@ -25,7 +25,7 @@ case $state in args) case $line[1] in start|open|copy|delete) - _configs=(`tmuxinator list | sed -n 's/^[ \t]\+//p'`) + _configs=(`find ~/.tmuxinator/ -name \*.yml | cut -d/ -f5 | sed s:.yml::g`) _values 'configs' $_configs ret=0 ;; @@ -33,4 +33,4 @@ case $state in ;; esac -return ret \ No newline at end of file +return ret From a7540844d5142d0ab3fae38b660c690859435bb5 Mon Sep 17 00:00:00 2001 From: Petter Abrahamsson Date: Thu, 14 Nov 2013 07:06:54 -0500 Subject: [PATCH 085/113] Add support for colored ls output on OpenBSD --- lib/theme-and-appearance.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 2677615c0..0353f9db4 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -11,6 +11,10 @@ then # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); # otherwise, leave ls as is, because NetBSD's ls doesn't support -G gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty' + elif [[ "$(uname -s)" == "OpenBSD" ]]; then + # On OpenBSD, test if "colorls" is installed (this one supports colors); + # otherwise, leave ls as is, because OpenBSD's ls doesn't support -G + colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G' else ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' fi From ae6b26327a01211e7109c00c36650db05be75a55 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Passalini Date: Thu, 14 Nov 2013 14:30:21 -0200 Subject: [PATCH 086/113] add new alias to zeus --- plugins/zeus/zeus.plugin.zsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/zeus/zeus.plugin.zsh b/plugins/zeus/zeus.plugin.zsh index eddfb4f94..5ec9fa579 100644 --- a/plugins/zeus/zeus.plugin.zsh +++ b/plugins/zeus/zeus.plugin.zsh @@ -53,3 +53,17 @@ alias zall='zeus test test/unit/*; zeus test test/functional/; zeus cucumber' # Clean up crashed zeus instances. alias zsw='rm .zeus.sock' alias zweep='rm .zeus.sock' + +# Reset database +alias zdbr='zeus rake db:reset db:test:prepare' +alias zdbreset='zeus rake db:reset db:test:prepare' + +# Migrate and prepare database +alias zdbm='zeus rake db:migrate db:test:prepare' +alias zdbmigrate='zeus rake db:migrate db:test:prepare' + +# Create database +alias zdbc='zeus rake db:create' + +# Create, migrate and prepare database +alias zdbcm='zeus rake db:create db:migrate db:test:prepare' \ No newline at end of file From dcf7c7cce0c4824a728de9ed0cabdfa073829e8d Mon Sep 17 00:00:00 2001 From: Pedro Henrique Passalini Date: Thu, 14 Nov 2013 14:36:20 -0200 Subject: [PATCH 087/113] add aliases to readme --- plugins/zeus/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/zeus/README.md b/plugins/zeus/README.md index d7c2aef80..8964eaaec 100644 --- a/plugins/zeus/README.md +++ b/plugins/zeus/README.md @@ -41,3 +41,13 @@ * `zsw` aliases `rm .zeus.sock` * `zweep` aliases `rm .zeus.sock` + +`zdbr` aliases `zeus rake db:reset db:test:prepare` +`zdbreset` aliases `zeus rake db:reset db:test:prepare` + +`zdbm` aliases `zeus rake db:migrate db:test:prepare` +`zdbmigrate` aliases `zeus rake db:migrate db:test:prepare` + +`zdbc` aliases `zeus rake db:create` + +`zdbcm` aliases `zeus rake db:create db:migrate db:test:prepare` From 51b273a66f0b99202e79807c0651e2afd2399d1b Mon Sep 17 00:00:00 2001 From: Chris Martin Date: Thu, 14 Nov 2013 16:04:38 -0800 Subject: [PATCH 088/113] basic command line xcode functionality --- plugins/xcode/xcode.plugin.zsh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 plugins/xcode/xcode.plugin.zsh diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh new file mode 100644 index 000000000..f137253f3 --- /dev/null +++ b/plugins/xcode/xcode.plugin.zsh @@ -0,0 +1,18 @@ +#xc function courtesy of http://gist.github.com/subdigital/5420709 +function xc { + xcode_proj=`find . -name "*.xc*" -d 1 | sort -r | head -1` + if [[ `echo -n $xcode_proj | wc -m` == 0 ]] + then + echo "No xcworkspace/xcodeproj file found in the current directory." + else + echo "Found $xcode_proj" + open "$xcode_proj" + fi +} + +function xcsel { + sudo xcode-select --switch "$*" +} + +alias xcb='xcodebuild' +alias xcp='xcode-select --print-path' From 3930a63253c08eafb5baf73508031932e0ed7437 Mon Sep 17 00:00:00 2001 From: Eddie Monge Date: Thu, 14 Nov 2013 16:17:23 -0800 Subject: [PATCH 089/113] no tabs in a space-d file --- themes/agnoster.zsh-theme | 64 +++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 762f63c5b..01cdc80e5 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -95,38 +95,38 @@ prompt_git() { } prompt_hg() { - local rev status - if $(hg id >/dev/null 2>&1); then - if $(hg prompt >/dev/null 2>&1); then - if [[ $(hg prompt "{status|unknown}") = "?" ]]; then - # if files are not added - prompt_segment red white - st='±' - elif [[ -n $(hg prompt "{status|modified}") ]]; then - # if any modification - prompt_segment yellow black - st='±' - else - # if working copy is clean - prompt_segment green black - fi - echo -n $(hg prompt "☿ {rev}@{branch}") $st - else - st="" - rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g') - branch=$(hg id -b 2>/dev/null) - if `hg st | grep -Eq "^\?"`; then - prompt_segment red black - st='±' - elif `hg st | grep -Eq "^(M|A)"`; then - prompt_segment yellow black - st='±' - else - prompt_segment green black - fi - echo -n "☿ $rev@$branch" $st - fi - fi + local rev status + if $(hg id >/dev/null 2>&1); then + if $(hg prompt >/dev/null 2>&1); then + if [[ $(hg prompt "{status|unknown}") = "?" ]]; then + # if files are not added + prompt_segment red white + st='±' + elif [[ -n $(hg prompt "{status|modified}") ]]; then + # if any modification + prompt_segment yellow black + st='±' + else + # if working copy is clean + prompt_segment green black + fi + echo -n $(hg prompt "☿ {rev}@{branch}") $st + else + st="" + rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g') + branch=$(hg id -b 2>/dev/null) + if `hg st | grep -Eq "^\?"`; then + prompt_segment red black + st='±' + elif `hg st | grep -Eq "^(M|A)"`; then + prompt_segment yellow black + st='±' + else + prompt_segment green black + fi + echo -n "☿ $rev@$branch" $st + fi + fi } # Dir: current working directory From 1f334ba66053038bfd5236ffa8e1000c5adf1b44 Mon Sep 17 00:00:00 2001 From: Atem18 Date: Fri, 15 Nov 2013 02:36:15 +0100 Subject: [PATCH 090/113] Rebranded plugin according to Zypper's official alias --- plugins/suse/suse.plugin.zsh | 68 ++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 7 deletions(-) diff --git a/plugins/suse/suse.plugin.zsh b/plugins/suse/suse.plugin.zsh index d46286948..3fdb8a032 100644 --- a/plugins/suse/suse.plugin.zsh +++ b/plugins/suse/suse.plugin.zsh @@ -1,7 +1,61 @@ -alias zi='sudo zypper install' -alias zrf='sudo zypper refresh' -alias zs='zypper search' -alias zup='sudo zypper dist-upgrade' -alias zrm='sudo zypper remove' -alias zp='sudo zypper patch' -alias zps='sudo zypper ps' +#Alias for Zypper according to the offical Zypper's alias + +#Main commands +alias z='sudo zypper' #call zypper +alias zh='sudo zypper -h' #print help +alias zhse='sudo zypper -h se' #print help for the search command +alias zlicenses='sudo zypper licenses' #prints a report about licenses and EULAs of installed packages +alias zps='sudo zypper ps' #list process using deleted files +alias zshell='sudo zypper shell' #open a zypper shell session +alias zsource-download='sudo zypper source-download' #download source rpms for all installed packages +alias ztos='sudo zypper tos' #shows the ID string of the target operating system +alias zvcmp='sudo zypper vcmp' #tell whether version1 is older or newer than version2 + +#Packages commands +alias zin='sudo zypper in' #install packages +alias zinr='sudo zypper inr' #install newly added packages recommended by already installed ones +alias zrm='sudo zypper rm' #remove packages +alias zsi='sudo zypper si' #install source of a package +alias zve='sudo zypper ve' #verify dependencies of installed packages + +#Updates commands +alias zdup='sudo zypper dup' #upgrade packages +alias zlp='sudo zypper lp' #list necessary patchs +alias zlu='sudo zypper lu' #list updates +alias zpchk='sudo zypper pchk' #check for patches +alias zup='sudo zypper up' #update packages +alias zpatch='sudo zypper patch' #install patches + +#Request commands +alias zif='sudo zypper if' #display info about packages +alias zpa='sudo zypper pa' #list packages +alias zpatch-info='sudo zyper patch-info' #display info about patches +alias zpattern-info='sudo zyper patch-info' #display info about patterns +alias zproduct-info='sudo zyper patch-info' #display info about products +alias zpch='sudo zypper pch' #list all patches +alias zpd='sudo zypper pd' #list products +alias zpt='sudo zypper pt' #list patterns +alias zse='sudo zypper se' #search for packages +alias zwp='sudo zypper wp' #list all packages providing the specified capability + +#Repositories commands +alias zar='sudo zypper ar' #add a repository +alias zcl='sudo zypper clean' #clean cache +alias zlr='sudo zypper lr' #list repositories +alias zmr='sudo zypper mr' #modify repositories +alias znr='sudo zypper nr' #rename repositories (for the alias only) +alias zref='sudo zypper ref' #refresh repositories +alias zrr='sudo zypper rr' #remove repositories + +#Services commands +alias zas='sudo zypper as' #adds a service specified by URI to the system +alias zms='sudo zypper ms' #modify properties of specified services +alias zrefs='sudo zypper refs' #refreshing a service mean executing the service's special task +alias zrs='sudo zypper rs' #remove specified repository index service from the sytem +alias zls='sudo zypper ls' #list services defined on the system + +#Package Locks Management commands +alias zal='sudo zypper al' #add a package lock +alias zcl='sudo zypper cl' #Remove unused locks +alias zll='sudo zypper ll' #list currently active package locks +alias zrl='sudo zypper rl' #remove specified package lock From 6f48f586ba55507bb90fa8dd078b01c0333b907d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20F=C3=A6revaag?= Date: Sat, 16 Nov 2013 02:15:17 +0100 Subject: [PATCH 091/113] Added wd plugin --- plugins/wd2/wd2/wd.plugin.zsh | 9 ++ plugins/wd2/wd2/wd.sh | 201 ++++++++++++++++++++++++++++++++++ 2 files changed, 210 insertions(+) create mode 100755 plugins/wd2/wd2/wd.plugin.zsh create mode 100755 plugins/wd2/wd2/wd.sh diff --git a/plugins/wd2/wd2/wd.plugin.zsh b/plugins/wd2/wd2/wd.plugin.zsh new file mode 100755 index 000000000..e0846ffd9 --- /dev/null +++ b/plugins/wd2/wd2/wd.plugin.zsh @@ -0,0 +1,9 @@ +#!/bin/zsh + +# WARP +# ==== +# oh-my-zsh plugin +# +# @github.com/mfaerevaag/wd + +alias wd='. ~/.oh-my-zsh/plugins/wd/wd.sh' diff --git a/plugins/wd2/wd2/wd.sh b/plugins/wd2/wd2/wd.sh new file mode 100755 index 000000000..7852028c0 --- /dev/null +++ b/plugins/wd2/wd2/wd.sh @@ -0,0 +1,201 @@ +#!/bin/zsh + +# WARP +# ==== +# Jump to custom directories in terminal +# because `cd` takes too long... +# +# @github.com/mfaerevaag/wd + + +## variables +CONFIG=$HOME/.warprc + +## colors +BLUE="\033[96m" +GREEN="\033[92m" +YELLOW="\033[93m" +RED="\033[91m" +NOC="\033[m" + + +## load warp points +typeset -A points +while read line +do + arr=(${(s,:,)line}) + key=${arr[1]} + val=${arr[2]} + + points[$key]=$val +done < $CONFIG + + +## functions +# prepended wd_ to not conflict with your environment (no sub shell) + +wd_warp() +{ + if [[ $1 =~ "^\.+$" ]] + then + if [[ $#1 < 2 ]] + then + wd_print_msg $YELLOW "Warping to current directory?" + else + (( n = $#1 - 1 )) + wd_print_msg $BLUE "Warping..." + cd -$n > /dev/null + fi + elif [[ ${points[$1]} != "" ]] + then + wd_print_msg $BLUE "Warping..." + cd ${points[$1]} + else + wd_print_msg $RED "Unkown warp point '$1'" + fi +} + +wd_add() +{ + if [[ $1 =~ "^\.+$" ]] + then + wd_print_msg $RED "Illeagal warp point (see README)." + elif [[ ${points[$1]} == "" ]] || $2 + then + wd_remove $1 > /dev/null + print "$1:$PWD" >> $CONFIG + wd_print_msg $GREEN "Warp point added" + else + wd_print_msg $YELLOW "Warp point '$1' alredy exists. Use 'add!' to overwrite." + fi +} + +wd_remove() +{ + if [[ ${points[$1]} != "" ]] + then + if wd_tmp=`sed "/^$1:/d" $CONFIG` + then + echo $wd_tmp > $CONFIG + wd_print_msg $GREEN "Warp point removed" + else + wd_print_msg $RED "Warp point unsuccessfully removed. Sorry!" + fi + else + wd_print_msg $RED "Warp point was not found" + fi +} + +wd_show() +{ + wd_print_msg $BLUE "Warp points to current directory:" + wd_list_all | grep $PWD$ +} + +wd_list_all() +{ + wd_print_msg $BLUE "All warp points:" + while read line + do + if [[ $line != "" ]] + then + arr=(${(s,:,)line}) + key=${arr[1]} + val=${arr[2]} + + print "\t" $key "\t -> \t" $val + fi + done < $CONFIG +} + +wd_print_msg() +{ + if [[ $1 == "" || $2 == "" ]] + then + print " $RED*$NOC Could not print message. Sorry!" + else + print " $1*$NOC $2" + fi +} + +wd_print_usage() +{ + print "Usage: wd [add|-a|--add] [rm|-r|--remove] [ls|-l|--list] " + print "\nCommands:" + print "\t add \t Adds the current working directory to your warp points" + print "\t add! \t Overwrites existing warp point" + print "\t remove Removes the given warp point" + print "\t list \t Outputs all stored warp points" + print "\t help \t Show this extremely helpful text" +} + + +## run + +# get opts +args=`getopt -o a:r:lhs -l add:,remove:,list,help,show -- $*` + +if [[ $? -ne 0 || $#* -eq 0 ]] +then + wd_print_usage +else + # can't exit, as this would exit the excecuting shell + # e.i. your terminal + + #set -- $args # WTF + + for i + do + case "$i" + in + -a|--add|add) + wd_add $2 false + shift + shift + break + ;; + -a!|--add!|add!) + wd_add $2 true + shift + shift + break + ;; + -r|--remove|rm) + wd_remove $2 + shift + shift + break + ;; + -l|--list|ls) + wd_list_all + shift + break + ;; + -h|--help|help) + wd_print_usage + shift + break + ;; + -s|--show|show) + wd_show + shift + break + ;; + *) + wd_warp $i + shift + break + ;; + --) + shift; break;; + esac + done +fi + + +## garbage collection +# if not, next time warp will pick up variables from this run +# remember, there's no sub shell +points="" +args="" +unhash -d val &> /dev/null # fixes issue #1 From 81192343568b924c901e260f7b6beda887e43fff Mon Sep 17 00:00:00 2001 From: Eddie Monge Date: Sat, 16 Nov 2013 11:59:15 -0800 Subject: [PATCH 092/113] standardize logic blocks --- oh-my-zsh.sh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 15c1dce44..2ae07668c 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,6 +1,5 @@ # Check for updates on initial load... -if [ "$DISABLE_AUTO_UPDATE" != "true" ] -then +if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then /usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh $ZSH/tools/check_for_upgrade.sh fi @@ -69,8 +68,7 @@ done unset config_file # Load the theme -if [ "$ZSH_THEME" = "random" ] -then +if [ "$ZSH_THEME" = "random" ]; then themes=($ZSH/themes/*zsh-theme) N=${#themes[@]} ((N=(RANDOM%N)+1)) @@ -78,13 +76,10 @@ then source "$RANDOM_THEME" echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." else - if [ ! "$ZSH_THEME" = "" ] - then - if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ] - then + if [ ! "$ZSH_THEME" = "" ]; then + if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" - elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ] - then + elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" else source "$ZSH/themes/$ZSH_THEME.zsh-theme" From ae1fe0029c63debfe44dcba52761389c6c876b31 Mon Sep 17 00:00:00 2001 From: Gaetan Semet Date: Sun, 17 Nov 2013 00:03:16 +0100 Subject: [PATCH 093/113] Add support for sublime 3 Signed-off-by: Gaetan Semet --- plugins/sublime/sublime.plugin.zsh | 38 ++++++++++++++++-------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh index 72f56754c..566279183 100755 --- a/plugins/sublime/sublime.plugin.zsh +++ b/plugins/sublime/sublime.plugin.zsh @@ -2,30 +2,32 @@ local _sublime_darwin_paths > /dev/null 2>&1 _sublime_darwin_paths=( - "/usr/local/bin/subl" - "$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" - "$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" - "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" - "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" + "/usr/local/bin/subl" + "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl" + "$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" + "$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" + "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl" + "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" + "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ) if [[ $('uname') == 'Linux' ]]; then - if [ -f '/usr/bin/sublime_text' ]; then - st_run() { nohup /usr/bin/sublime_text $@ > /dev/null & } - else - st_run() { nohup /usr/bin/sublime-text $@ > /dev/null & } - fi - alias st=st_run + if [ -f '/usr/bin/sublime_text' ]; then + st_run() { nohup /usr/bin/sublime_text $@ > /dev/null & } + else + st_run() { nohup /usr/bin/sublime-text $@ > /dev/null & } + fi + alias st=st_run elif [[ $('uname') == 'Darwin' ]]; then - for _sublime_path in $_sublime_darwin_paths; do - if [[ -a $_sublime_path ]]; then - alias subl="'$_sublime_path'" - alias st=subl - break - fi - done + for _sublime_path in $_sublime_darwin_paths; do + if [[ -a $_sublime_path ]]; then + alias subl="'$_sublime_path'" + alias st=subl + break + fi + done fi alias stt='st .' From 037b39a8172b8a268ca5c857e5badee047b32929 Mon Sep 17 00:00:00 2001 From: Sean Escriva Date: Sat, 16 Nov 2013 15:39:01 -0800 Subject: [PATCH 094/113] Add simple plugin for chruby ruby version manager --- plugins/chruby/chruby.plugin.zsh | 99 ++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 plugins/chruby/chruby.plugin.zsh diff --git a/plugins/chruby/chruby.plugin.zsh b/plugins/chruby/chruby.plugin.zsh new file mode 100644 index 000000000..2a2c80cf6 --- /dev/null +++ b/plugins/chruby/chruby.plugin.zsh @@ -0,0 +1,99 @@ +# +# INSTRUCTIONS +# +# With either a manual or brew installed chruby things should just work. +# +# If you'd prefer to specify an explicit path to load chruby from +# you can set variables like so: +# +# zstyle :omz:plugins:chruby path /local/path/to/chruby.sh +# zstyle :omz:plugins:chruby auto /local/path/to/auto.sh +# +# TODO +# - autodetermine correct source path on non OS X systems +# - completion if ruby-install exists + +# rvm and rbenv plugins also provide this alias +alias rubies='chruby' + +local _chruby_path +local _chruby_auto + +_homebrew-installed() { + whence brew &> /dev/null +} + +_chruby-from-homebrew-installed() { + brew --prefix chruby &> /dev/null +} + +_ruby-build_installed() { + whence ruby-build &> /dev/null +} + +_ruby-install-installed() { + whence ruby-install &> /dev/null +} + +# Simple definition completer for ruby-build +if _ruby-build_installed; then + _ruby-build() { compadd $(ruby-build --definitions) } + compdef _ruby-build ruby-build +fi + +_source_from_omz_settings() { + zstyle -s :omz:plugins:chruby path _chruby_path + zstyle -s :omz:plugins:chruby auto _chruby_auto + + if _chruby_path && [[ -r _chruby_path ]]; then + source ${_chruby_path} + fi + + if _chruby_auto && [[ -r _chruby_auto ]]; then + source ${_chruby_auto} + fi +} + +_chruby_dirs() { + chrubydirs=($HOME/.rubies/ $PREFIX/opt/rubies) + for dir in chrubydirs; do + if [[ -d $dir ]]; then + RUBIES+=$dir + fi + done +} + +if _homebrew-installed && _chruby-from-homebrew-installed ; then + source $(brew --prefix chruby)/share/chruby/chruby.sh + source $(brew --prefix chruby)/share/chruby/auto.sh + _chruby_dirs +elif [[ -r "/usr/local/share/chruby/chruby.sh" ]] ; then + source /usr/local/share/chruby/chruby.sh + source /usr/local/share/chruby/auto.sh + _chruby_dirs +else + _source_from_omz_settings + _chruby_dirs +fi + +function ensure_chruby() { + $(whence chruby) +} + +function current_ruby() { + local _ruby + _ruby="$(chruby |grep \* |tr -d '* ')" + if [[ $(chruby |grep -c \*) -eq 1 ]]; then + echo ${_ruby} + else + echo "system" + fi +} + +function chruby_prompt_info() { + echo "$(current_ruby)" +} + +# complete on installed rubies +_chruby() { compadd $(chruby | tr -d '* ') } +compdef _chruby chruby From 613d116cda381b9747e22d13ed1381cec26eb8e3 Mon Sep 17 00:00:00 2001 From: Stig Sandbeck Mathisen Date: Tue, 19 Nov 2013 09:12:05 +0100 Subject: [PATCH 095/113] Add pyenv plugin --- plugins/pyenv/pyenv.plugin.zsh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 plugins/pyenv/pyenv.plugin.zsh diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh new file mode 100644 index 000000000..b3dc7aa17 --- /dev/null +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -0,0 +1,31 @@ +_homebrew-installed() { + type brew &> /dev/null +} + +_pyenv-from-homebrew-installed() { + brew --prefix pyenv &> /dev/null +} + +FOUND_PYENV=0 +pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv") +if _homebrew-installed && _pyenv-from-homebrew-installed ; then + pyenvdirs=($(brew --prefix pyenv) "${pyenvdirs[@]}") +fi + +for pyenvdir in "${pyenvdirs[@]}" ; do + if [ -d $pyenvdir/bin -a $FOUND_PYENV -eq 0 ] ; then + FOUND_PYENV=1 + export PYENV_ROOT=$pyenvdir + export PATH=${pyenvdir}/bin:$PATH + eval "$(pyenv init --no-rehash - zsh)" + + function pyenv_prompt_info() { + echo "$(pyenv version-name)" + } + fi +done +unset pyenvdir + +if [ $FOUND_PYENV -eq 0 ] ; then + function pyenv_prompt_info() { echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')" } +fi From 9b37fcba5e350d049d4bbf145672cecd37356c23 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Tue, 19 Nov 2013 17:05:48 +0100 Subject: [PATCH 096/113] unified and improved Rails plugin --- plugins/{rails3/_rails3 => rails/_rails} | 17 ++++-- plugins/rails/rails.plugin.zsh | 68 ++++++++++++++++++++---- plugins/rails3/rails3.plugin.zsh | 32 ----------- plugins/rails4/rails4.plugin.zsh | 32 ----------- 4 files changed, 71 insertions(+), 78 deletions(-) rename plugins/{rails3/_rails3 => rails/_rails} (80%) delete mode 100644 plugins/rails3/rails3.plugin.zsh delete mode 100644 plugins/rails4/rails4.plugin.zsh diff --git a/plugins/rails3/_rails3 b/plugins/rails/_rails similarity index 80% rename from plugins/rails3/_rails3 rename to plugins/rails/_rails index 97915e68b..96f57ce64 100644 --- a/plugins/rails3/_rails3 +++ b/plugins/rails/_rails @@ -1,10 +1,6 @@ #compdef rails #autoload -# rails 3 zsh completion, based on homebrew completion -# Extracted from https://github.com/robbyrussell/oh-my-zsh/blob/30620d463850c17f86e7a56fbf6a8b5e793a4e07/plugins/rails3/_rails3 -# Published by Christopher Chow - local -a _1st_arguments _1st_arguments=( 'generate:Generate new code (short-cut alias: "g")' @@ -14,14 +10,20 @@ _1st_arguments=( 'new:Create a new Rails application. "rails new my_app" creates a new application called MyApp in "./my_app"' 'application:Generate the Rails application code' 'destroy:Undo code generated with "generate"' + 'benchmarker:See how fast a piece of code runs' 'profiler:Get profile information from a piece of code' 'plugin:Install a plugin' + + 'plugin new:Generates skeleton for developing a Rails plugin' + 'runner:Run a piece of code in the application environment (short-cut alias: "r")' ) _rails_generate_arguments() { generate_arguments=( + assets controller + decorator generator helper integration_test @@ -36,9 +38,11 @@ _rails_generate_arguments() { scaffold_controller session_migration stylesheets + task ) } + _arguments \ '(--version)--version[show version]' \ '(--help)--help[show help]' \ @@ -50,7 +54,10 @@ if (( CURRENT == 1 )); then fi case "$words[1]" in - generate) + g|generate) + _rails_generate_arguments + _wanted generate_arguments expl 'all generate' compadd -a generate_arguments ;; + d|destroy) _rails_generate_arguments _wanted generate_arguments expl 'all generate' compadd -a generate_arguments ;; esac diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index dd8b174b2..23d15a9a1 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -1,20 +1,70 @@ +function _rails_command () { + if [ -e "script/server" ]; then + ruby script/$@ + elif [ -e "script/rails" ]; then + ruby script/rails $@ + elif [ -e "bin/rails" ]; then + bin/rails $@ + else + rails $@ + fi +} + +function _rake_command () { + if [ -e "bin/rake" ]; then + bin/rake $@ + else + rake $@ + fi +} + +alias rails='_rails_command' +compdef _rails_command=rails + +alias rake='_rake_command' +compdef _rake_command=rake + +alias devlog='tail -f log/development.log' +alias prodlog='tail -f log/production.log' +alias testlog='tail -f log/test.log' + +alias -g RED='RAILS_ENV=development' +alias -g REP='RAILS_ENV=production' +alias -g RET='RAILS_ENV=test' + +# Rails aliases +alias rc='rails console' +alias rd='rails destroy' +alias rdb='rails dbconsole' +alias rg='rails generate' +alias rgm='rails generate migration' +alias rp='rails plugin' +alias ru='rails runner' +alias rs='rails server' +alias rsd='rails server --debugger' + +# Rake aliases +alias rdm='rake db:migrate' +alias rdr='rake db:rollback' +alias rdc='rake db:create' +alias rds='rake db:seed' +alias rdd='rake db:drop' +alias rdtc='rake db:test:clone' +alias rdtp='rake db:test:prepare' + +alias rlc='rake log:clear' +alias rn='rake notes' +alias rr='rake routes' + +# legacy stuff alias ss='thin --stats "/thin/stats" start' alias sg='ruby script/generate' alias sd='ruby script/destroy' alias sp='ruby script/plugin' alias sr='ruby script/runner' alias ssp='ruby script/spec' -alias rdbm='rake db:migrate' -alias rdbtp='rake db:test:prepare' -alias migrate='rake db:migrate && rake db:test:prepare' alias sc='ruby script/console' alias sd='ruby script/server --debugger' -alias devlog='tail -f log/development.log' -alias testlog='tail -f log/test.log' -alias prodlog='tail -f log/production.log' -alias -g RET='RAILS_ENV=test' -alias -g REP='RAILS_ENV=production' -alias -g RED='RAILS_ENV=development' function remote_console() { /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )" diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh deleted file mode 100644 index b53d18d08..000000000 --- a/plugins/rails3/rails3.plugin.zsh +++ /dev/null @@ -1,32 +0,0 @@ -# Rails 3 aliases, backwards-compatible with Rails 2. - -function _rails_command () { - if [ -e "script/server" ]; then - ruby script/$@ - else - if [ -e "bin/rails" ]; then - bin/rails $@ - else - rails $@ - fi - fi -} - -alias rc='_rails_command console' -alias rd='_rails_command destroy' -alias rdb='_rails_command dbconsole' -alias rdbm='rake db:migrate db:test:clone' -alias rg='_rails_command generate' -alias rgm='_rails_command generate migration' -alias rp='_rails_command plugin' -alias ru='_rails_command runner' -alias rs='_rails_command server' -alias rsd='_rails_command server --debugger' -alias devlog='tail -f log/development.log' -alias testlog='tail -f log/test.log' -alias prodlog='tail -f log/production.log' -alias rdm='rake db:migrate' -alias rdr='rake db:rollback' -alias -g RET='RAILS_ENV=test' -alias -g REP='RAILS_ENV=production' -alias -g RED='RAILS_ENV=development' diff --git a/plugins/rails4/rails4.plugin.zsh b/plugins/rails4/rails4.plugin.zsh deleted file mode 100644 index cb6cf816d..000000000 --- a/plugins/rails4/rails4.plugin.zsh +++ /dev/null @@ -1,32 +0,0 @@ -# Rails 4 aliases - -function _rails_command () { - if [ -e "script/server" ]; then - ruby script/$@ - elif [ -e "script/rails" ]; then - ruby script/rails $@ - else - ruby bin/rails $@ - fi -} - -alias rc='_rails_command console' -alias rd='_rails_command destroy' -alias rdb='_rails_command dbconsole' -alias rdbm='rake db:migrate db:test:clone' -alias rg='_rails_command generate' -alias rgm='_rails_command generate migration' -alias rp='_rails_command plugin' -alias ru='_rails_command runner' -alias rs='_rails_command server' -alias rsd='_rails_command server --debugger' -alias devlog='tail -f log/development.log' -alias testlog='tail -f log/test.log' -alias prodlog='tail -f log/production.log' -alias rdm='rake db:migrate' -alias rdc='rake db:create' -alias rdr='rake db:rollback' -alias rds='rake db:seed' -alias rlc='rake log:clear' -alias rn='rake notes' -alias rr='rake routes' From fbd479b68e2c58068666f738a009ef7a1ca8abde Mon Sep 17 00:00:00 2001 From: Michael Orr Date: Wed, 20 Nov 2013 12:30:55 -0500 Subject: [PATCH 097/113] adding a check for git config option to disable git_prompt_info() on a per repo basis --- lib/git.zsh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index df0fcedbb..305a77aff 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -1,8 +1,10 @@ # get the name of the branch we are on function git_prompt_info() { - ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ - ref=$(command git rev-parse --short HEAD 2> /dev/null) || return - echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" + if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then + ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ + ref=$(command git rev-parse --short HEAD 2> /dev/null) || return + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" + fi } From 4d3fb286d84846b2c64368c38dd8b728da466eac Mon Sep 17 00:00:00 2001 From: aph Date: Thu, 21 Nov 2013 16:58:57 +0000 Subject: [PATCH 098/113] fix pip plugin --- plugins/pip/pip.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh index 71f977bbf..b5433ae9d 100644 --- a/plugins/pip/pip.plugin.zsh +++ b/plugins/pip/pip.plugin.zsh @@ -18,12 +18,12 @@ zsh-pip-clear-cache() { } zsh-pip-clean-packages() { - sed -nr '/([^<]+).*/\1/p' + sed -n '/\([^<]\{1,\}\).*/\1/p' } zsh-pip-cache-packages() { - if [[ ! -d ${PIP_CACHE_FILE:h} ]]; then - mkdir -p ${PIP_CACHE_FILE:h} + if [[ ! -d ${ZSH_PIP_CACHE_FILE:h} ]]; then + mkdir -p ${ZSH_PIP_CACHE_FILE:h} fi if [[ ! -f $ZSH_PIP_CACHE_FILE ]]; then From 7c56364dc4a432a0ef2972ea1a6043e6154499df Mon Sep 17 00:00:00 2001 From: Valentin Shevko Date: Fri, 22 Nov 2013 02:34:33 +0300 Subject: [PATCH 099/113] Add update statistics After the upgrade is interesting to know what's new. --- tools/upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/upgrade.sh b/tools/upgrade.sh index e04fc672f..9a8497d96 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -1,6 +1,6 @@ printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh" cd "$ZSH" -if git pull --rebase origin master +if git pull --rebase --stat origin master then printf '\033[0;32m%s\033[0m\n' ' __ __ ' printf '\033[0;32m%s\033[0m\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' From b5b3519ac7c163b62bfc01a42a87a7a745d9df6d Mon Sep 17 00:00:00 2001 From: Thibaud Guillaume-Gentil Date: Fri, 22 Nov 2013 09:48:51 +0100 Subject: [PATCH 100/113] Update _heroku config arguments (Heroku Client v3) --- plugins/heroku/_heroku | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/heroku/_heroku b/plugins/heroku/_heroku index a95c38647..46663303a 100644 --- a/plugins/heroku/_heroku +++ b/plugins/heroku/_heroku @@ -23,8 +23,10 @@ _1st_arguments=( "auth\:login":"log in with your heroku credentials" "auth\:logout":"clear local authentication credentials" "config":"display the config vars for an app" - "config\:add":"add one or more config vars" - "config\:remove":"remove a config var" + "config\:pull":"pull heroku config vars down to the local environment" + "config\:push":"push local config vars to heroku" + "config\:set":"set one or more config vars" + "config\:unset":"unset one or more config vars" "db\:push":"push local data up to your app" "db\:pull":"pull heroku data down into your local database" "domains":"list custom domains for an app" From d12113a9e89fed866db625f7e110fb62333b2746 Mon Sep 17 00:00:00 2001 From: Johann Visagie Date: Fri, 22 Nov 2013 14:59:04 +0100 Subject: [PATCH 101/113] Use precmd hook for updating OS X proxy icon Using the chpwd hook function causes some junk to be printed to STDOUT after returning from a subshell wherein the working directory was changed. In rare cases, this can cause issues with 3rd party tools. An example is this issue with the Python virtualenvwrapper tool: https://bitbucket.org/dhellmann/virtualenvwrapper/issue/216/lsvirtualenv-and-workon-output-broken-in --- plugins/terminalapp/terminalapp.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/terminalapp/terminalapp.plugin.zsh b/plugins/terminalapp/terminalapp.plugin.zsh index 2249b1e2f..6e47ee188 100644 --- a/plugins/terminalapp/terminalapp.plugin.zsh +++ b/plugins/terminalapp/terminalapp.plugin.zsh @@ -32,7 +32,7 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then # Register the function so it is called whenever the working # directory changes. autoload add-zsh-hook - add-zsh-hook chpwd update_terminal_cwd + add-zsh-hook precmd update_terminal_cwd # Tell the terminal about the initial directory. update_terminal_cwd From ec779d5f737f0f70a7353bb0e78dc2d38606c8d9 Mon Sep 17 00:00:00 2001 From: christianschmidt Date: Sat, 23 Nov 2013 15:32:22 +0100 Subject: [PATCH 102/113] Update _pass to follow symlinks for completion Based on: http://comments.gmane.org/gmane.comp.encryption.pass/235 --- plugins/pass/_pass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/pass/_pass b/plugins/pass/_pass index f6c1a6c4b..d8ec38828 100644 --- a/plugins/pass/_pass +++ b/plugins/pass/_pass @@ -101,7 +101,7 @@ _pass_cmd_show () { _pass_complete_entries_helper () { local IFS=$'\n' local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}" - _values -C 'passwords' $(find "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort) + _values -C 'passwords' $(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort) } _pass_complete_entries_with_subdirs () { From 240b25daaaee81ccdb9e6e2016667a60f5241f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20F=C3=A6revaag?= Date: Tue, 26 Nov 2013 00:45:24 +0100 Subject: [PATCH 103/113] wd.plugin: Fixed nested dirs --- plugins/{wd2/wd2 => wd}/wd.plugin.zsh | 2 +- plugins/{wd2/wd2 => wd}/wd.sh | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) rename plugins/{wd2/wd2 => wd}/wd.plugin.zsh (63%) rename plugins/{wd2/wd2 => wd}/wd.sh (88%) diff --git a/plugins/wd2/wd2/wd.plugin.zsh b/plugins/wd/wd.plugin.zsh similarity index 63% rename from plugins/wd2/wd2/wd.plugin.zsh rename to plugins/wd/wd.plugin.zsh index e0846ffd9..bbec4a715 100755 --- a/plugins/wd2/wd2/wd.plugin.zsh +++ b/plugins/wd/wd.plugin.zsh @@ -6,4 +6,4 @@ # # @github.com/mfaerevaag/wd -alias wd='. ~/.oh-my-zsh/plugins/wd/wd.sh' +alias wd='. $ZSH/plugins/wd/wd.sh' diff --git a/plugins/wd2/wd2/wd.sh b/plugins/wd/wd.sh similarity index 88% rename from plugins/wd2/wd2/wd.sh rename to plugins/wd/wd.sh index 7852028c0..744f58bc2 100755 --- a/plugins/wd2/wd2/wd.sh +++ b/plugins/wd/wd.sh @@ -19,6 +19,13 @@ RED="\033[91m" NOC="\033[m" +# check if config file exists +if [[ ! -a $CONFIG ]] +then + # if not: create config file + touch $CONFIG +fi + ## load warp points typeset -A points while read line @@ -120,11 +127,12 @@ wd_print_msg() wd_print_usage() { - print "Usage: wd [add|-a|--add] [rm|-r|--remove] [ls|-l|--list] " + print "Usage: wd [add|-a|--add] [rm|-r|--remove] [ls|-l|--list] " print "\nCommands:" print "\t add \t Adds the current working directory to your warp points" print "\t add! \t Overwrites existing warp point" print "\t remove Removes the given warp point" + print "\t show \t Outputs warp points to current directory" print "\t list \t Outputs all stored warp points" print "\t help \t Show this extremely helpful text" } @@ -135,13 +143,20 @@ wd_print_usage() # get opts args=`getopt -o a:r:lhs -l add:,remove:,list,help,show -- $*` +# check if no arguments were given if [[ $? -ne 0 || $#* -eq 0 ]] then wd_print_usage -else - # can't exit, as this would exit the excecuting shell - # e.i. your terminal +# check if config file is writeable +elif [[ ! -w $CONFIG ]] +then + wd_print_msg $RED "\'$CONFIG\' is not writeable." + # do nothing => exit + # can't run `exit`, as this would exit the executing shell + # i.e. your terminal + +else #set -- $args # WTF for i From b4ffe5cf0a9e0a076fc1c52f6a46eefe05ad5627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20F=C3=A6revaag?= Date: Tue, 26 Nov 2013 00:46:13 +0100 Subject: [PATCH 104/113] wd.plugin: Added checks, readme and completion --- plugins/wd/README.md | 38 +++++++++++++++++++++++++++++++++++ plugins/wd/_wd.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 plugins/wd/README.md create mode 100644 plugins/wd/_wd.sh diff --git a/plugins/wd/README.md b/plugins/wd/README.md new file mode 100644 index 000000000..f9f4e7ac1 --- /dev/null +++ b/plugins/wd/README.md @@ -0,0 +1,38 @@ +## wd + +**Maintainer:** [mfaerevaag](https://github.com/mfaerevaag) + +`wd` (warp directory) lets you jump to custom directories in zsh, without using cd. Why? Because cd seems ineffecient when the folder is frequently visited or has a long path. [Source](https://github.com/mfaerevaag/wd) + +### Usage + + * Add warp point to current working directory: + + wd add test + + If a warp point with the same name exists, use `add!` to overwrite it. + + * From an other directory, warp to test with: + + wd test + + * You can warp back to previous directory, and so on, with the puncticulation syntax: + + wd .. + wd ... + + This is a wrapper for the zsh `dirs` function. + + * Remove warp point test point: + + wd rm test + + * List warp points to current directory (stored in `~/.warprc`): + + wd show + + * List all warp points (stored in `~/.warprc`): + + wd ls + + * Print usage with no opts or the `help` argument. diff --git a/plugins/wd/_wd.sh b/plugins/wd/_wd.sh new file mode 100644 index 000000000..950564435 --- /dev/null +++ b/plugins/wd/_wd.sh @@ -0,0 +1,48 @@ +#compdef wd.sh + +zstyle ":completion:*:descriptions" format "%B%d%b" + +CONFIG=$HOME/.warprc + +local -a main_commands +main_commands=( + add:'Adds the current working directory to your warp points' + #add'\!':'Overwrites existing warp point' # TODO: Fix + rm:'Removes the given warp point' + ls:'Outputs all stored warp points' + show:'Outputs warp points to current directory' +) + +local -a points +while read line +do + points+=$(awk "{ gsub(/\/Users\/$USER|\/home\/$USER/,\"~\"); print }" <<< $line) +done < $CONFIG + +_wd() +{ + # init variables + local curcontext="$curcontext" state line + typeset -A opt_args + + # init state + _arguments \ + '1: :->command' \ + '2: :->argument' + + case $state in + command) + compadd "$@" add rm ls show + _describe -t warp-points 'Warp points:' points && ret=0 + ;; + argument) + case $words[2] in + rm|add!) + _describe -t warp-points 'warp points' points && ret=0 + ;; + *) + esac + esac +} + +_wd "$@" From 3d851daf456f4ba418fb00eccb20ea2f4f7dd4b5 Mon Sep 17 00:00:00 2001 From: Dhruva Sagar Date: Fri, 29 Nov 2013 12:28:52 +0530 Subject: [PATCH 105/113] Added Amuse zsh theme --- themes/amuse.zsh-theme | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 themes/amuse.zsh-theme diff --git a/themes/amuse.zsh-theme b/themes/amuse.zsh-theme new file mode 100644 index 000000000..548f6d39d --- /dev/null +++ b/themes/amuse.zsh-theme @@ -0,0 +1,21 @@ +# vim:ft=zsh ts=2 sw=2 sts=2 + +rvm_current() { + rvm current 2>/dev/null +} + +rbenv_version() { + rbenv version 2>/dev/null | awk '{print $1}' +} + +PROMPT=' +%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%} +$ ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}⭠ " +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +RPROMPT='%{$fg_bold[red]%}$(rbenv_version)%{$reset_color%}' From 699c82eb89094e3c2ca81dfd96b44d155bca6fba Mon Sep 17 00:00:00 2001 From: ych Date: Fri, 29 Nov 2013 18:34:12 +0800 Subject: [PATCH 106/113] Add FreeBSD support for autojump plugin --- plugins/autojump/autojump.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh index f856f2f01..0aa14959d 100644 --- a/plugins/autojump/autojump.plugin.zsh +++ b/plugins/autojump/autojump.plugin.zsh @@ -5,6 +5,8 @@ if [ $commands[autojump] ]; then # check if autojump is installed . /etc/profile.d/autojump.zsh elif [ -f /etc/profile.d/autojump.sh ]; then # gentoo installation . /etc/profile.d/autojump.sh + elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation + . /usr/local/share/autojump/autojump.zsh elif [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation . $HOME/.autojump/etc/profile.d/autojump.zsh elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports From 1493d88e3f92c7034da5c1b1638ba19544aa3ccb Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Sun, 1 Dec 2013 15:31:48 +0100 Subject: [PATCH 107/113] Added migration notification for rails plugin --- plugins/rails3/rails3.plugin.zsh | 4 ++++ plugins/rails4/rails4.plugin.zsh | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 plugins/rails3/rails3.plugin.zsh create mode 100644 plugins/rails4/rails4.plugin.zsh diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh new file mode 100644 index 000000000..261b92108 --- /dev/null +++ b/plugins/rails3/rails3.plugin.zsh @@ -0,0 +1,4 @@ +echo "It looks like you have been using the 'rails3' plugin," +echo "which has been deprecated in favor of a newly consolidated 'rails' plugin." +echo "You will want to modify your ~/.zshrc configuration to begin using it." +echo "Learn more at https://github.com/robbyrussell/oh-my-zsh/pull/2240" diff --git a/plugins/rails4/rails4.plugin.zsh b/plugins/rails4/rails4.plugin.zsh new file mode 100644 index 000000000..5452c242c --- /dev/null +++ b/plugins/rails4/rails4.plugin.zsh @@ -0,0 +1,4 @@ +echo "It looks like you have been using the 'rails4' plugin," +echo "which has been deprecated in favor of a newly consolidated 'rails' plugin." +echo "You will want to modify your ~/.zshrc configuration to begin using it." +echo "Learn more at https://github.com/robbyrussell/oh-my-zsh/pull/2240" From 96bd365542dd9df0afe37e944996936bdaa17969 Mon Sep 17 00:00:00 2001 From: Jens Tinfors Date: Sun, 1 Dec 2013 15:33:23 +0100 Subject: [PATCH 108/113] Adds the hgsl alias for one-line shortlog convenience --- plugins/mercurial/mercurial.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index c18aa726c..d2db89d04 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -13,6 +13,7 @@ alias hglr='hg pull --rebase' alias hgo='hg outgoing' alias hgp='hg push' alias hgs='hg status' +alias hgsl='log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n" ' # this is the 'git commit --amend' equivalent alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip' From 84e178fa3d5e6e5bc36cb353c5c051d4f12ec35d Mon Sep 17 00:00:00 2001 From: Kevin Messer Date: Sun, 1 Dec 2013 23:29:55 +0100 Subject: [PATCH 109/113] Fixed lines 32, 33, 34 where one 'p' was missing in 'zypper' command. --- plugins/suse/suse.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/suse/suse.plugin.zsh b/plugins/suse/suse.plugin.zsh index 3fdb8a032..afd8ecabd 100644 --- a/plugins/suse/suse.plugin.zsh +++ b/plugins/suse/suse.plugin.zsh @@ -29,9 +29,9 @@ alias zpatch='sudo zypper patch' #install patches #Request commands alias zif='sudo zypper if' #display info about packages alias zpa='sudo zypper pa' #list packages -alias zpatch-info='sudo zyper patch-info' #display info about patches -alias zpattern-info='sudo zyper patch-info' #display info about patterns -alias zproduct-info='sudo zyper patch-info' #display info about products +alias zpatch-info='sudo zypper patch-info' #display info about patches +alias zpattern-info='sudo zypper patch-info' #display info about patterns +alias zproduct-info='sudo zypper patch-info' #display info about products alias zpch='sudo zypper pch' #list all patches alias zpd='sudo zypper pd' #list products alias zpt='sudo zypper pt' #list patterns From 22c0db64eed9b771a4d83abfd6f4cb8980d82229 Mon Sep 17 00:00:00 2001 From: Brandon Siegel Date: Wed, 30 Oct 2013 11:01:49 -0400 Subject: [PATCH 110/113] Change `bi` alias to a function Only check the bundler version when we call bi. This fixes two issues: First, if there is no bundler available system-wide this will cause an error each time zsh loads. Second, if new bundler is installed system-wide but you change into an rbenv with an older version, the alias will no longer work. --- plugins/bundler/bundler.plugin.zsh | 52 ++++++++++++++++-------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index e390f8620..4c3580cac 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -4,13 +4,31 @@ alias bp="bundle package" alias bo="bundle open" alias bu="bundle update" - # 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 taps thin thor unicorn unicorn_rails puma) ## Functions +bi() { + if _bundler-installed && _within-bundled-project; then + local bundler_version=`bundle version | cut -d' ' -f3` + if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then + if [[ "$(uname)" == 'Darwin' ]] + then + local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" + else + local cores_num="$(nproc)" + fi + bundle install --jobs=$cores_num $@ + else + bundle install $@ + fi + else + echo "Can't 'bundle install' outside a bundled project" + fi +} + _bundler-installed() { which bundle > /dev/null 2>&1 } @@ -32,28 +50,14 @@ _run-with-bundler() { fi } -if _bundler-installed; then - bundler_version=`bundle version | cut -d' ' -f3` - if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then - if [[ "$(uname)" == 'Darwin' ]] - then - local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" - else - local cores_num="$(nproc)" - fi - eval "alias bi='bundle install --jobs=$cores_num'" - else - alias bi='bundle install' - fi +## Main program +for cmd in $bundled_commands; do + eval "function unbundled_$cmd () { $cmd \$@ }" + eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" + alias $cmd=bundled_$cmd - ## Main program - for cmd in $bundled_commands; do - eval "function unbundled_$cmd () { $cmd \$@ }" - eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" - alias $cmd=bundled_$cmd + if which _$cmd > /dev/null 2>&1; then + compdef _$cmd bundled_$cmd=$cmd + fi +done - if which _$cmd > /dev/null 2>&1; then - compdef _$cmd bundled_$cmd=$cmd - fi - done -fi From 858c515df2d8ce1f75ac3d505f77a71984653929 Mon Sep 17 00:00:00 2001 From: Patrick Stadler Date: Tue, 3 Dec 2013 09:52:51 +0100 Subject: [PATCH 111/113] source ~/.profile only if it exists --- tools/check_for_upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 14d294328..0f8c9c391 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -20,7 +20,7 @@ if [[ -z "$epoch_target" ]]; then epoch_target=13 fi -[ ~/.profile ] && source ~/.profile +[ -f ~/.profile ] && source ~/.profile if [ -f ~/.zsh-update ] then From 2ffca0680623d2a3875ac6a8bb9458a06aa57938 Mon Sep 17 00:00:00 2001 From: Peter van der Does Date: Tue, 3 Dec 2013 08:56:18 -0500 Subject: [PATCH 112/113] Update git-flow-avh 1.7.0 --- plugins/git-flow-avh/git-flow-avh.plugin.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/git-flow-avh/git-flow-avh.plugin.zsh b/plugins/git-flow-avh/git-flow-avh.plugin.zsh index d76f55ef6..ba98fff01 100644 --- a/plugins/git-flow-avh/git-flow-avh.plugin.zsh +++ b/plugins/git-flow-avh/git-flow-avh.plugin.zsh @@ -41,6 +41,9 @@ _git-flow () 'hotfix:Manage your hotfix branches.' 'support:Manage your support branches.' 'version:Shows version information.' + 'finish:Finish the branch you are currently on.' + 'delete:Delete the branch you are currently on.' + 'publish:Publish the branch you are currently on.' ) _describe -t commands 'git flow' subcommands ;; @@ -95,7 +98,7 @@ __git-flow-release () 'list:List all your release branches. (Alias to `git flow release`)' 'publish:Publish release branch to remote.' 'track:Checkout remote release branch.' - 'delet:Delete a release branch.' + 'delete:Delete a release branch.' ) _describe -t commands 'git flow release' subcommands _arguments \ From f082d7a245da8767a11dcc20a7e68ababefa5f34 Mon Sep 17 00:00:00 2001 From: Bob Bonifield Date: Wed, 4 Dec 2013 20:59:57 -0700 Subject: [PATCH 113/113] Making auto-correction off by default - Allows for the user to turn on auto-correction using the $ENABLE_CORRECTION variable - Adds aliases regardless of variable assignment to aid users that use setopt to turn correction back on in their zshrc --- lib/correction.zsh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/correction.zsh b/lib/correction.zsh index 436446101..47eb83b1d 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -1,14 +1,13 @@ -if [[ "$DISABLE_CORRECTION" == "true" ]]; then - return -else +alias man='nocorrect man' +alias mv='nocorrect mv' +alias mysql='nocorrect mysql' +alias mkdir='nocorrect mkdir' +alias gist='nocorrect gist' +alias heroku='nocorrect heroku' +alias ebuild='nocorrect ebuild' +alias hpodder='nocorrect hpodder' +alias sudo='nocorrect sudo' + +if [[ "$ENABLE_CORRECTION" == "true" ]]; then setopt correct_all - alias man='nocorrect man' - alias mv='nocorrect mv' - alias mysql='nocorrect mysql' - alias mkdir='nocorrect mkdir' - alias gist='nocorrect gist' - alias heroku='nocorrect heroku' - alias ebuild='nocorrect ebuild' - alias hpodder='nocorrect hpodder' - alias sudo='nocorrect sudo' fi