From 5fa4d9d7606057ccb8e39a452db9a656b5f3caed Mon Sep 17 00:00:00 2001 From: wangzengdi Date: Tue, 31 May 2016 09:57:36 +0800 Subject: [PATCH 01/53] add alias gh=git help --- plugins/git/git.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index eb7bc8034..3187cab74 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -137,6 +137,8 @@ compdef _git ggu=git-checkout alias ggpur='ggu' compdef _git ggpur=git-checkout +alias gh='git help' + alias gignore='git update-index --assume-unchanged' alias gignored='git ls-files -v | grep "^[[:lower:]]"' alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' From 0181fe497040b4cc7739fbb0da5bfdf8dcc568c2 Mon Sep 17 00:00:00 2001 From: Aaron Decker Date: Fri, 12 Aug 2016 23:49:42 -0400 Subject: [PATCH 02/53] add npm aliases (#5290) --- plugins/npm/npm.plugin.zsh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index 38e699ea0..422d81ceb 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -20,3 +20,10 @@ alias npmE='PATH="$(npm bin)":"$PATH"' # Check which npm modules are outdated alias npmO="npm outdated" + +# Run npm start +alias npmst="npm start" + +# Run npm test +alias npmt="npm test" + From 906a7731af7499a9e5fa8795f0427180904d9122 Mon Sep 17 00:00:00 2001 From: Daniel Grove Date: Fri, 12 Aug 2016 20:50:09 -0700 Subject: [PATCH 03/53] Add tmux attach -d alias (#5285) --- plugins/tmux/tmux.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index bc32c8907..fb514a44c 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -3,6 +3,7 @@ # alias ta='tmux attach -t' +alias tad='tmux attach -d -t' alias ts='tmux new-session -s' alias tl='tmux list-sessions' alias tksv='tmux kill-server' From 51c10783e1f09d72dfd0d8d4b6301974919ed0e4 Mon Sep 17 00:00:00 2001 From: Aleksey Ivanov Date: Sat, 13 Aug 2016 21:47:43 +0300 Subject: [PATCH 04/53] refresh .rake_tasks when lib/tasks changed (#5111) --- plugins/rake-fast/rake-fast.plugin.zsh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/rake-fast/rake-fast.plugin.zsh b/plugins/rake-fast/rake-fast.plugin.zsh index d305eb1f0..57d699abc 100644 --- a/plugins/rake-fast/rake-fast.plugin.zsh +++ b/plugins/rake-fast/rake-fast.plugin.zsh @@ -8,7 +8,19 @@ _rake_refresh () { } _rake_does_task_list_need_generating () { - [[ ! -f .rake_tasks ]] || [[ Rakefile -nt .rake_tasks ]] + [[ ! -f .rake_tasks ]] || [[ Rakefile -nt .rake_tasks ]] || (_is_rails_app && _tasks_changed) +} + +_is_rails_app () { + [[ -e "bin/rails" ]] || [ -e "script/rails" ] +} + +_tasks_changed () { + local is_changed=1 + for file in lib/tasks/**/*.rake; do + if [[ $file -nt .rake_tasks ]]; then is_changed=0; fi + done + return is_changed } _rake_generate () { From f19b6b24d3a88d72c5d62c0ef47d3b384f06d06f Mon Sep 17 00:00:00 2001 From: Patrick Stadler Date: Mon, 15 Aug 2016 02:30:55 +0200 Subject: [PATCH 05/53] add kubectl plugin (#5298) --- plugins/kubectl/kubectl.plugin.zsh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 plugins/kubectl/kubectl.plugin.zsh diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh new file mode 100644 index 000000000..51ae142a2 --- /dev/null +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -0,0 +1,7 @@ +# Autocompletion for kubectl, the command line interface for Kubernetes +# +# Author: https://github.com/pstadler + +if [ $commands[kubectl] ]; then + source <(kubectl completion zsh) +fi From 1e9084c3c77b5b9e95c2d75cb08f88078853bd6d Mon Sep 17 00:00:00 2001 From: Arz Yu Date: Mon, 15 Aug 2016 08:33:48 +0800 Subject: [PATCH 06/53] muse theme: Remove extra spaces for none git/virtualenv prompt (#5278) * muse theme: Remove a extra space for none git prompt * muse theme: Remove a extra space for none virtualenv prompt --- themes/muse.zsh-theme | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/themes/muse.zsh-theme b/themes/muse.zsh-theme index 55a375747..c7cd9ee30 100644 --- a/themes/muse.zsh-theme +++ b/themes/muse.zsh-theme @@ -13,11 +13,11 @@ GIT_DIRTY_COLOR=$FG[133] GIT_CLEAN_COLOR=$FG[118] GIT_PROMPT_INFO=$FG[012] -PROMPT='%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%} %{$GIT_PROMPT_INFO%}$(git_prompt_info) $(virtualenv_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ%{$reset_color%} ' +PROMPT='%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%}%{$GIT_PROMPT_INFO%}$(git_prompt_info)$(virtualenv_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_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%}✔" @@ -28,3 +28,6 @@ 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%}" + +ZSH_THEME_VIRTUALENV_PREFIX=" [" +ZSH_THEME_VIRTUALENV_SUFFIX="]" From 40a9d9cb913d113d0606b121ea0d8d570e84c539 Mon Sep 17 00:00:00 2001 From: $ea Date: Mon, 15 Aug 2016 08:43:23 +0800 Subject: [PATCH 07/53] plugins/urltools: add suport for python 3 (#5039) Python 3!!!! --- plugins/urltools/urltools.plugin.zsh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/urltools/urltools.plugin.zsh b/plugins/urltools/urltools.plugin.zsh index 22327334d..fa337acba 100644 --- a/plugins/urltools/urltools.plugin.zsh +++ b/plugins/urltools/urltools.plugin.zsh @@ -11,9 +11,12 @@ fi if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xnode" ) ]]; then alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"' alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"' -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 python3) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then + alias urlencode='python3 -c "import sys, urllib.parse as up; print(up.quote_plus(sys.argv[1]))"' + alias urldecode='python3 -c "import sys, urllib.parse as up; print(up.unquote_plus(sys.argv[1]))"' +elif [[ $(whence python2) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then + alias urlencode='python2 -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"' + alias urldecode='python2 -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"} From 341e83f6f2b45c80a4c555f1a0f04ff6acbc15b9 Mon Sep 17 00:00:00 2001 From: naegi Date: Mon, 15 Aug 2016 02:45:00 +0200 Subject: [PATCH 08/53] Plugin : Sudo - Add support of sudoedit (#5035) * Add sudoedit support * change describtion of sudo plugin --- plugins/sudo/sudo.plugin.zsh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/sudo/sudo.plugin.zsh b/plugins/sudo/sudo.plugin.zsh index 0ba8bed5b..0b843822e 100644 --- a/plugins/sudo/sudo.plugin.zsh +++ b/plugins/sudo/sudo.plugin.zsh @@ -2,7 +2,7 @@ # Description # ----------- # -# sudo will be inserted before the command +# sudo or sudoedit will be inserted before the command # # ------------------------------------------------------------------------------ # Authors @@ -16,6 +16,12 @@ sudo-command-line() { [[ -z $BUFFER ]] && zle up-history if [[ $BUFFER == sudo\ * ]]; then LBUFFER="${LBUFFER#sudo }" + elif [[ $BUFFER == $EDITOR\ * ]]; then + LBUFFER="${LBUFFER#$EDITOR }" + LBUFFER="sudoedit $LBUFFER" + elif [[ $BUFFER == sudoedit\ * ]]; then + LBUFFER="${LBUFFER#sudoedit }" + LBUFFER="$EDITOR $LBUFFER" else LBUFFER="sudo $LBUFFER" fi From 5d6c3501663e4a2779e3c529a8940da0d16dd115 Mon Sep 17 00:00:00 2001 From: Ahmad Awais Date: Mon, 15 Aug 2016 05:55:02 +0500 Subject: [PATCH 09/53] =?UTF-8?q?Enhancement:=20Show/Hide=20OSX=20hidden?= =?UTF-8?q?=20files=20=F0=9F=92=AF=20(#5275)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/osx/README.md | 22 ++++++++++++---------- plugins/osx/osx.plugin.zsh | 4 ++++ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/plugins/osx/README.md b/plugins/osx/README.md index a06184a45..6de2b061e 100644 --- a/plugins/osx/README.md +++ b/plugins/osx/README.md @@ -15,13 +15,15 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu) ## Commands -| Command | Description | -|:--------------|:-----------------------------------------------| -| `tab` | Open the current directory in a new tab | -| `ofd` | Open the current directory in a Finder window | -| `pfd` | Return the path of the frontmost Finder window | -| `pfs` | Return the current Finder selection | -| `cdf` | `cd` to the current Finder directory | -| `pushdf` | `pushd` to the current Finder directory | -| `quick-look` | Quick-Look a specified file | -| `man-preview` | Open a specified man page in Preview app | +| Command | Description | +| :-------------- | :----------------------------------------------- | +| `tab` | Open the current directory in a new tab | +| `ofd` | Open the current directory in a Finder window | +| `pfd` | Return the path of the frontmost Finder window | +| `pfs` | Return the current Finder selection | +| `cdf` | `cd` to the current Finder directory | +| `pushdf` | `pushd` to the current Finder directory | +| `quick-look` | Quick-Look a specified file | +| `man-preview` | Open a specified man page in Preview app | +| `showfiles` | Show hidden files | +| `hidefiles` | Hide the hidden files | diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 4dbc75787..f69bd7e5d 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -260,3 +260,7 @@ EOF esac osascript -e "tell application \"iTunes\" to $opt" } + +# Show/hide hidden files in the Finder +alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" +alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" From 95371afdd8e94bc9130b6b323a8eecb63a3c71e6 Mon Sep 17 00:00:00 2001 From: Dzianis Dashkevich Date: Mon, 15 Aug 2016 03:58:11 +0300 Subject: [PATCH 10/53] Add gcpa and gcpc aliases to git plugin (#5271) --- plugins/git/git.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 0deee9fa2..554dcbfbe 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -75,6 +75,8 @@ alias gco='git checkout' alias gcount='git shortlog -sn' compdef gcount=git alias gcp='git cherry-pick' +alias gcpa='git cherry-pick --abort' +alias gcpc='git cherry-pick --continue' alias gcs='git commit -S' alias gd='git diff' From 073ea01ccec5dc70bb2e998372d69d893509f2d0 Mon Sep 17 00:00:00 2001 From: Peter Han Date: Sun, 14 Aug 2016 18:00:19 -0700 Subject: [PATCH 11/53] Create an alias to open up sublime project (#5258) * Adding an alias to open up the sublime project * README update for stp command --- plugins/sublime/README.md | 6 ++++-- plugins/sublime/sublime.plugin.zsh | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/plugins/sublime/README.md b/plugins/sublime/README.md index e1e666f05..7b02d8428 100644 --- a/plugins/sublime/README.md +++ b/plugins/sublime/README.md @@ -15,5 +15,7 @@ Plugin for Sublime Text, a cross platform text and code editor, available for Li * If `st` is passed a file, open it in Sublime Text * If `stt` command is called, it is equivalent to `st .`, opening the current folder in Sublime Text - - * If `sst` command is called, it is like `sudo st`, opening the file or folder in Sublime Text. Useful for editing system protected files. \ No newline at end of file + + * If `sst` command is called, it is like `sudo st`, opening the file or folder in Sublime Text. Useful for editing system protected files. + + * If `stp` command is called, it find a `.sublime-project` file by traversing up the directory structure. If there is no `.sublime-project` file, but if the current folder is a Git repo, opens up the root directory of the repo. If the current folder is not a Git repo, then opens up the current directory. diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh index a5d63cde6..75a39eab1 100644 --- a/plugins/sublime/sublime.plugin.zsh +++ b/plugins/sublime/sublime.plugin.zsh @@ -56,3 +56,32 @@ elif [[ "$OSTYPE" = 'cygwin' ]]; then fi alias stt='st .' + +find_project() +{ + local PROJECT_ROOT="${PWD}" + local FINAL_DEST="." + + while [[ $PROJECT_ROOT != "/" && ! -d "$PROJECT_ROOT/.git" ]]; do + PROJECT_ROOT=$(dirname $PROJECT_ROOT) + done + + if [[ $PROJECT_ROOT != "/" ]]; then + local PROJECT_NAME="${PROJECT_ROOT##*/}" + + local SUBL_DIR=$PROJECT_ROOT + while [[ $SUBL_DIR != "/" && ! -f "$SUBL_DIR/$PROJECT_NAME.sublime-project" ]]; do + SUBL_DIR=$(dirname $SUBL_DIR) + done + + if [[ $SUBL_DIR != "/" ]]; then + FINAL_DEST="$SUBL_DIR/$PROJECT_NAME.sublime-project" + else + FINAL_DEST=$PROJECT_ROOT + fi + fi + + st $FINAL_DEST +} + +alias stp=find_project From 75f2f4e027802d6c71d5a38f5c6f938d82e6bb39 Mon Sep 17 00:00:00 2001 From: Thiago Leite Luiz Date: Sun, 14 Aug 2016 22:01:13 -0300 Subject: [PATCH 12/53] Adding alias to rake db:schema:load command. (#5281) --- plugins/rails/rails.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index 5dfca49e9..e532639b5 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -57,6 +57,7 @@ alias rdrs='rake db:reset' alias rdtc='rake db:test:clone' alias rdtp='rake db:test:prepare' alias rdmtc='rake db:migrate db:test:clone' +alias rdsl='rake db:schema:load' alias rlc='rake log:clear' alias rn='rake notes' alias rr='rake routes' From 525ee5081583f5c7681104d21796e35fe41afd5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 10 Aug 2016 13:35:40 +0200 Subject: [PATCH 13/53] Clean up comments in pj plugin file and reorganise --- plugins/pj/pj.plugin.zsh | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh index 1572e9363..8b1bc883f 100644 --- a/plugins/pj/pj.plugin.zsh +++ b/plugins/pj/pj.plugin.zsh @@ -1,19 +1,6 @@ -#!/bin/zsh +alias pjo="pj open" -# -# Original idea by DefV (Jan De Poorter) -# Source: https://gist.github.com/pjaspers/368394#comment-1016 -# -# Usage: -# - Set `$PROJECT_PATHS` in your ~/.zshrc -# e.g.: PROJECT_PATHS=(~/src ~/work) -# - In ZSH you now can open a project directory with the command: `pj my-project` -# the plugin will locate the `my-project` directory in one of the $PROJECT_PATHS -# Also tab completion is supported. -# - `pjo my-project` will open the directory in $EDITOR -# - -function pj() { +function pj () { cmd="cd" file=$1 @@ -36,8 +23,6 @@ function pj() { echo "No such project $1" } -alias pjo="pj open" - function _pj () { # might be possible to improve this using glob, without the basename trick typeset -a projects @@ -45,5 +30,4 @@ function _pj () { projects=$projects:t _arguments "*:file:($projects)" } - compdef _pj pj From 26bef0942ba8acbe3ad2005500efd8f47e1edc36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 11 Aug 2016 01:19:19 +0200 Subject: [PATCH 14/53] Add Readme to pj plugin --- plugins/pj/README.md | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 plugins/pj/README.md diff --git a/plugins/pj/README.md b/plugins/pj/README.md new file mode 100644 index 000000000..27e5638ec --- /dev/null +++ b/plugins/pj/README.md @@ -0,0 +1,45 @@ +# pj + +The `pj` plugin (short for `Project Jump`) allows you to define several +folders where you store your projects, so that you can jump there directly +by just using the name of the project directory. + +Original idea and code by Jan De Poorter ([@DefV](https://github.com/DefV)) +Source: https://gist.github.com/pjaspers/368394#gistcomment-1016 + +## Usage + +1. Enable the `pj` plugin: + + ```zsh + plugins=(... pj) + ``` + +2. Set `$PROJECT_PATHS` in your ~/.zshrc: + + ```zsh + PROJECT_PATHS=(~/src ~/work ~/"dir with spaces") + ``` + +You can now use one of the following commands: + +##### `pj my-project`: + +`cd` to the directory named "my-project" found in one of the `$PROJECT_PATHS` +directories. If there are several directories named the same, the first one +to appear in `$PROJECT_PATHS` has preference. + +For example: +```zsh +PROJECT_PATHS=(~/code ~/work) +$ ls ~/code # ~/code/blog ~/code/react +$ ls ~/work # ~/work/blog ~/work/project +$ pj blog # <-- will cd to ~/code/blog +``` + +##### `pjo my-project` + +Open the project directory with your defined `$EDITOR`. This follows the same +directory rules as the `pj` command above. + +Note: `pjo` is an alias of `pj open`. From c9c11d605f28c0a93ad34ba2a40120ea6e0f9dc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 11 Aug 2016 01:35:45 +0200 Subject: [PATCH 15/53] Fix _pj completion function - `$PROJECT_PATHS/*` wasn't working correctly. You have to iterate over its elements in order to use globbing with it. - The `$projects:t` line wasn't necessary if we used `compadd`. - `compadd` better supports destructuring an array with spaces in some of its elements. --- plugins/pj/pj.plugin.zsh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh index 8b1bc883f..1d89af00b 100644 --- a/plugins/pj/pj.plugin.zsh +++ b/plugins/pj/pj.plugin.zsh @@ -24,10 +24,13 @@ function pj () { } function _pj () { - # might be possible to improve this using glob, without the basename trick + emulate -L zsh + typeset -a projects - projects=($PROJECT_PATHS/*) - projects=$projects:t - _arguments "*:file:($projects)" + for basedir ($PROJECT_PATHS); do + projects+=(${basedir}/*(/N)) + done + + compadd ${projects:t} } compdef _pj pj From 7f8851f52f9ebb03bc5be0246ee2b591196bdd16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 11 Aug 2016 01:33:36 +0200 Subject: [PATCH 16/53] Refactor pj function - Use `emulate -L zsh` to make all variables local. - Use `shwordsplit` to interpret `$cmd` spaces correctly. - Rename `$project` and `$file` variables to the more appropriate `$basedir` and `$project`. --- plugins/pj/pj.plugin.zsh | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh index 1d89af00b..f9d7f8e27 100644 --- a/plugins/pj/pj.plugin.zsh +++ b/plugins/pj/pj.plugin.zsh @@ -1,29 +1,31 @@ alias pjo="pj open" -function pj () { - cmd="cd" - file=$1 +pj () { + emulate -L zsh + setopt shwordsplit - if [[ "open" == "$file" ]] then + cmd="cd" + project=$1 + + if [[ "open" == "$project" ]]; then shift - file=$* - cmd=(${(s: :)EDITOR}) + project=$* + cmd=$EDITOR else - file=$* + project=$* fi - for project in $PROJECT_PATHS; do - if [[ -d $project/$file ]] then - $cmd "$project/$file" - unset project # Unset project var + for basedir ($PROJECT_PATHS); do + if [[ -d "$basedir/$project" ]]; then + $cmd "$basedir/$project" return fi done - echo "No such project $1" + echo "No such project '${project}'." } -function _pj () { +_pj () { emulate -L zsh typeset -a projects From 7d298a3059f4df72866b4ef649675b594120f453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 11 Aug 2016 01:44:14 +0200 Subject: [PATCH 17/53] Fix pj() function when no project has been specified --- plugins/pj/pj.plugin.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh index f9d7f8e27..bb3d9c058 100644 --- a/plugins/pj/pj.plugin.zsh +++ b/plugins/pj/pj.plugin.zsh @@ -15,6 +15,11 @@ pj () { project=$* fi + if [[ -z "$project" ]]; then + echo "You have to specify a project name." + return + fi + for basedir ($PROJECT_PATHS); do if [[ -d "$basedir/$project" ]]; then $cmd "$basedir/$project" From bec53135e4e826e204c3d11df9854a53403d11e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 11 Aug 2016 01:55:38 +0200 Subject: [PATCH 18/53] Fix shwordsplit bug when a basedir contains spaces The `shwordsplit` option affects all variables and we only need to split the `$EDITOR` variable. Because of that, using `${=spec}` is a much better alternative. More info at http://zsh.sourceforge.net/Doc/Release/Expansion.html#index-SH_005fWORD_005fSPLIT_002c-toggle --- plugins/pj/pj.plugin.zsh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh index bb3d9c058..84d0cfa65 100644 --- a/plugins/pj/pj.plugin.zsh +++ b/plugins/pj/pj.plugin.zsh @@ -2,7 +2,6 @@ alias pjo="pj open" pj () { emulate -L zsh - setopt shwordsplit cmd="cd" project=$1 @@ -10,7 +9,7 @@ pj () { if [[ "open" == "$project" ]]; then shift project=$* - cmd=$EDITOR + cmd=${=EDITOR} else project=$* fi From 0615dfe32c93bd5c7b78631d383edc9eb9db47d4 Mon Sep 17 00:00:00 2001 From: Fumseck Date: Wed, 17 Aug 2016 22:26:13 +0200 Subject: [PATCH 19/53] Add alias and README to git-flow plugin (#5129) --- plugins/git-flow/README.md | 36 ++++++++++++++++++++++++++++ plugins/git-flow/git-flow.plugin.zsh | 10 ++++++++ 2 files changed, 46 insertions(+) create mode 100644 plugins/git-flow/README.md diff --git a/plugins/git-flow/README.md b/plugins/git-flow/README.md new file mode 100644 index 000000000..d4cde34aa --- /dev/null +++ b/plugins/git-flow/README.md @@ -0,0 +1,36 @@ +# Git flow plugin installation + +```bash +git clone https://github.com/robbyrussell/oh-my-zsh.git + +cp oh-my-zsh/plugins/git-flow/git-flow.plugin.zsh ~/.git-flow-completion.zsh + +vim ~/.zshrc + +# 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) +# Add wisely, as too many plugins slow down shell startup. + +plugins=(git git-flow) + +source ~/.git-flow-completion.zsh +``` +## Your new git-flow alias + +```bash +alias gfl='git flow' +alias gfli='git flow init' +alias gcd='git checkout develop' +alias gch='git checkout hotfix' +alias gcr='git checkout release' +alias gflf='git flow feature' +alias gflh='git flow hotfix' +alias gflr='git flow release' +alias gflfs='git flow feature start' +alias gflhs='git flow hotfix start' +alias gflrs='git flow release start' +alias gflff='git flow feature finish' +alias gflhf='git flow hotfix finish' +alias gflrf='git flow release finish' +``` diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh index a8386cb19..bda050725 100644 --- a/plugins/git-flow/git-flow.plugin.zsh +++ b/plugins/git-flow/git-flow.plugin.zsh @@ -22,9 +22,19 @@ #Alias alias gfl='git flow' +alias gfli='git flow init' alias gcd='git checkout develop' alias gch='git checkout hotfix' alias gcr='git checkout release' +alias gflf='git flow feature' +alias gflh='git flow hotfix' +alias gflr='git flow release' +alias gflfs='git flow feature start' +alias gflhs='git flow hotfix start' +alias gflrs='git flow release start' +alias gflff='git flow feature finish' +alias gflhf='git flow hotfix finish' +alias gflrf='git flow release finish' _git-flow () { From 66179bdab86227d924cd9e4c4b307be6465f09cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 17 Aug 2016 22:39:41 +0200 Subject: [PATCH 20/53] Fix git-flow README - Fix "installation" information - Add links to github project - Transform list of aliases into table with descriptions --- plugins/git-flow/README.md | 59 +++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/plugins/git-flow/README.md b/plugins/git-flow/README.md index d4cde34aa..f37f418db 100644 --- a/plugins/git-flow/README.md +++ b/plugins/git-flow/README.md @@ -1,36 +1,31 @@ -# Git flow plugin installation +# Git-Flow plugin -```bash -git clone https://github.com/robbyrussell/oh-my-zsh.git +This plugin adds completion and aliases for the `git-flow` command. More information +at https://github.com/nvie/gitflow. -cp oh-my-zsh/plugins/git-flow/git-flow.plugin.zsh ~/.git-flow-completion.zsh - -vim ~/.zshrc - -# 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) -# Add wisely, as too many plugins slow down shell startup. - -plugins=(git git-flow) - -source ~/.git-flow-completion.zsh +Enable git-flow plugin in your zshrc file: +``` +plugins=(... git-flow) ``` -## Your new git-flow alias -```bash -alias gfl='git flow' -alias gfli='git flow init' -alias gcd='git checkout develop' -alias gch='git checkout hotfix' -alias gcr='git checkout release' -alias gflf='git flow feature' -alias gflh='git flow hotfix' -alias gflr='git flow release' -alias gflfs='git flow feature start' -alias gflhs='git flow hotfix start' -alias gflrs='git flow release start' -alias gflff='git flow feature finish' -alias gflhf='git flow hotfix finish' -alias gflrf='git flow release finish' -``` +## Aliases + +More information about `git-flow` commands: +https://github.com/nvie/gitflow/wiki/Command-Line-Arguments + +| Alias | Command | Description | +|---------|---------------------------|----------------------------------------| +| `gfl` | `git flow` | Git-Flow command | +| `gfli` | `git flow init` | Initialize git-flow repository | +| `gcd` | `git checkout develop` | Check out develop branch | +| `gch` | `git checkout hotfix` | Check out hotfix branch | +| `gcr` | `git checkout release` | Check out release branch | +| `gflf` | `git flow feature` | List existing feature branches | +| `gflh` | `git flow hotfix` | List existing hotfix branches | +| `gflr` | `git flow release` | List existing release branches | +| `gflfs` | `git flow feature start` | Start a new feature: `gflfs ` | +| `gflhs` | `git flow hotfix start` | Start a new hotfix: `gflhs ` | +| `gflrs` | `git flow release start` | Start a new release: `gflrs ` | +| `gflff` | `git flow feature finish` | Finish feature: `gflff ` | +| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf ` | +| `gflrf` | `git flow release finish` | Finish release: `gflrf ` | From 9981214437d97ae2a599f032f88f37f3e44da9a3 Mon Sep 17 00:00:00 2001 From: Emmanuel Isaac Date: Thu, 18 Aug 2016 08:22:21 +0100 Subject: [PATCH 21/53] Add git alias to clear entire stash (#5306) Using the "gstc" alias runs "git stash clear" that clears every stash index --- plugins/git/git.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 554dcbfbe..66f63d817 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -217,6 +217,7 @@ alias gss='git status -s' alias gst='git status' alias gsta='git stash save' alias gstaa='git stash apply' +alias gstc='git stash clear' alias gstd='git stash drop' alias gstl='git stash list' alias gstp='git stash pop' From 76821f506c5f252b9542c1d168e6f30874e5c68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 20 Aug 2016 23:53:12 +0200 Subject: [PATCH 22/53] Rename `gh` alias (git help) to `ghh` This conflicts with several tools, including NodeGH [1] and scm_breeze [2]. [1] https://github.com/robbyrussell/oh-my-zsh/issues/5313 [2] https://github.com/robbyrussell/oh-my-zsh/issues/5321 Related: #5130 --- 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 66f63d817..ae2a07f80 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -151,7 +151,7 @@ compdef _git ggpush=git-checkout alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' alias gpsup='git push --set-upstream origin $(git_current_branch)' -alias gh='git help' +alias ghh='git help' alias gignore='git update-index --assume-unchanged' alias gignored='git ls-files -v | grep "^[[:lower:]]"' From 24ac1aa3481e4c81411fc9462c3cd4a9b25e9da7 Mon Sep 17 00:00:00 2001 From: Piotr Gaczkowski Date: Sun, 21 Aug 2016 00:02:58 +0200 Subject: [PATCH 23/53] Clobber ssh environment regardless of setopt (#5322) --- plugins/ssh-agent/ssh-agent.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 610ad34dc..b77b9ee78 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -37,7 +37,7 @@ function _plugin__start_agent() zstyle -s :omz:plugins:ssh-agent lifetime lifetime # start ssh-agent and setup environment - /usr/bin/env ssh-agent ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' > ${_plugin__ssh_env} + /usr/bin/env ssh-agent ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' >! ${_plugin__ssh_env} chmod 600 ${_plugin__ssh_env} . ${_plugin__ssh_env} > /dev/null From 774c4eca6f166be554baf33ff48de9e90e98f16a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 21 Aug 2016 00:09:59 +0200 Subject: [PATCH 24/53] Revert "Fix pj() function when no project has been specified" This reverts commit 7d298a3059f4df72866b4ef649675b594120f453. --- plugins/pj/pj.plugin.zsh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh index 84d0cfa65..e36d49204 100644 --- a/plugins/pj/pj.plugin.zsh +++ b/plugins/pj/pj.plugin.zsh @@ -14,11 +14,6 @@ pj () { project=$* fi - if [[ -z "$project" ]]; then - echo "You have to specify a project name." - return - fi - for basedir ($PROJECT_PATHS); do if [[ -d "$basedir/$project" ]]; then $cmd "$basedir/$project" From 292a62e3abf1bc0e87c3e1ff0012ebf6e03eb241 Mon Sep 17 00:00:00 2001 From: khenarghot Date: Sun, 21 Aug 2016 20:40:34 +0400 Subject: [PATCH 25/53] Fix git emptiness check in dogenpunk theme (#5329) The parsing output for full git log output too slow so it replaced with last commit show request, wich cause error if repository is empty --- themes/dogenpunk.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/dogenpunk.zsh-theme b/themes/dogenpunk.zsh-theme index d6719281d..6a9921288 100644 --- a/themes/dogenpunk.zsh-theme +++ b/themes/dogenpunk.zsh-theme @@ -37,7 +37,7 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" function git_time_since_commit() { if git rev-parse --git-dir > /dev/null 2>&1; then # Only proceed if there is actually a commit. - if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then + if git log -n 1 > /dev/null 2>&1; then # Get the last commit. last_commit=`git log --pretty=format:'%at' -1 2> /dev/null` now=`date +%s` From b9c3e862c72c059ce167827a87fbeccd8b3579fc Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 21 Aug 2016 19:46:37 +0200 Subject: [PATCH 26/53] Add alias for checking out develop branch (#5307) --- plugins/git/git.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index ae2a07f80..ef7cb94b0 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -70,6 +70,7 @@ alias gcl='git clone --recursive' alias gclean='git clean -fd' alias gpristine='git reset --hard && git clean -dfx' alias gcm='git checkout master' +alias gcd='git checkout develop' alias gcmsg='git commit -m' alias gco='git checkout' alias gcount='git shortlog -sn' From 4b9772fffecf15f293881db0bd1432bfda270055 Mon Sep 17 00:00:00 2001 From: Shubham Chaudhary Date: Sun, 21 Aug 2016 23:36:47 +0530 Subject: [PATCH 27/53] Add more go aliases (#5259) * Also gfa conflicts with git shortcut --- plugins/golang/golang.plugin.zsh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/golang/golang.plugin.zsh b/plugins/golang/golang.plugin.zsh index 1ce3cea58..d9d450690 100644 --- a/plugins/golang/golang.plugin.zsh +++ b/plugins/golang/golang.plugin.zsh @@ -179,5 +179,15 @@ __go_tool_complete() { compdef __go_tool_complete go -# aliases -alias gfa='go fmt . ./...' +# aliases: go<~> +alias gob='go build' +alias goc='go clean' +alias god='go doc' +alias gof='go fmt' +alias gofa='go fmt . ./...' +alias gog='go get' +alias goi='go install' +alias gol='go list' +alias gor='go run' +alias got='go test' +alias gov='go vet' From 7c1ca0e4d85e0de75a3eb8c23b4e799454e0f390 Mon Sep 17 00:00:00 2001 From: Philipp Wahala Date: Mon, 29 Feb 2016 10:16:26 +0100 Subject: [PATCH 28/53] Create and cache npm completion on first run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc Cornellà --- plugins/npm/npm.plugin.zsh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index 422d81ceb..ec595e74d 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -1,4 +1,10 @@ -eval "$(npm completion 2>/dev/null)" +__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion" + +if [[ ! -f $__NPM_COMPLETION_FILE ]]; then + npm completion >! $__NPM_COMPLETION_FILE || rm -f $__NPM_COMPLETION_FILE +fi + +source $__NPM_COMPLETION_FILE # Install dependencies globally alias npmg="npm i -g " From 251bc2d38050f54f85f730bb9e0dd1399e5c3067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 17 Jun 2016 10:44:52 +0200 Subject: [PATCH 29/53] dircycle: keep switch until a directory is found This fixes the use case where a directory in the dir stack doesn't exist anymore, so the keystroke doesn't appear to do anything. It will keep trying to switch to the n-est directory in the stack until it founds an available directory or the dirstack has no more directories to switch to. --- plugins/dircycle/dircycle.plugin.zsh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/dircycle/dircycle.plugin.zsh b/plugins/dircycle/dircycle.plugin.zsh index 8a406b54d..2f32277cf 100644 --- a/plugins/dircycle/dircycle.plugin.zsh +++ b/plugins/dircycle/dircycle.plugin.zsh @@ -8,11 +8,21 @@ # pushd +N: start counting from left of `dirs' output # pushd -N: start counting from right of `dirs' output +switch-to-dir () { + while ! builtin pushd -q $1 &>/dev/null; do + # We found a missing directory: pop it out of the dir stack + builtin popd -q $1 + + # Stop trying if there are no more directories in the dir stack + [[ ${#dirstack} -eq 0 ]] && break + done +} + insert-cycledleft () { emulate -L zsh setopt nopushdminus - builtin pushd -q +1 &>/dev/null || true + switch-to-dir +1 zle reset-prompt } zle -N insert-cycledleft @@ -21,7 +31,7 @@ insert-cycledright () { emulate -L zsh setopt nopushdminus - builtin pushd -q -0 &>/dev/null || true + switch-to-dir -0 zle reset-prompt } zle -N insert-cycledright From 3b8d0ad9d0431bb76235f255458e43b2ab51b13b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Madsen?= Date: Thu, 18 Jun 2015 11:24:17 +0200 Subject: [PATCH 30/53] archlinux: Update yasu alias MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc Cornellà --- plugins/archlinux/README.md | 2 +- plugins/archlinux/archlinux.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md index ad42d4cd2..67595f9e9 100644 --- a/plugins/archlinux/README.md +++ b/plugins/archlinux/README.md @@ -37,7 +37,7 @@ | yarem | yaourt -Rns | Remove the specified package(s), its configuration(s) and unneeded dependencies | | yarep | yaourt -Si | Display information about a given package in the repositories | | yareps | yaourt -Ss | Search for package(s) in the repositories | -| yasu | yaourt --sucre | Same as yaupg, but without confirmation | +| yasu | yaourt -Syua --no-confirm | Same as yaupg, but without confirmation | | yaupd | yaourt -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases against repositories | | yaupd | yaourt -Sy && sudo abs | Update and refresh the local package and ABS databases against repositories | | yaupd | yaourt -Sy && sudo aur | Update and refresh the local package and AUR databases against repositories | diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index 99de5b936..f68443285 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -9,7 +9,7 @@ if (( $+commands[yaourt] )); then alias yaconf='yaourt -C' # Fix all configuration files with vimdiff # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips alias yaupg='yaourt -Syua' # Synchronize with repositories before upgrading packages (AUR packages too) that are out of date on the local system. - alias yasu='yaourt --sucre' # Same as yaupg, but without confirmation + alias yasu='yaourt --Syua --no-confirm' # Same as yaupg, but without confirmation alias yain='yaourt -S' # Install specific package(s) from the repositories alias yains='yaourt -U' # Install specific package not from the repositories but from a file alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies From 136a83433ad5214eb3d5a0ca3c799be8fc9cb1aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 23 Aug 2016 09:31:29 +0200 Subject: [PATCH 31/53] npm: only load completion if npm exists --- plugins/npm/npm.plugin.zsh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index ec595e74d..480e92a91 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -1,8 +1,10 @@ -__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion" +(( $+commands[npm] )) && { + __NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion" -if [[ ! -f $__NPM_COMPLETION_FILE ]]; then - npm completion >! $__NPM_COMPLETION_FILE || rm -f $__NPM_COMPLETION_FILE -fi + if [[ ! -f $__NPM_COMPLETION_FILE ]]; then + npm completion >! $__NPM_COMPLETION_FILE || rm -f $__NPM_COMPLETION_FILE + fi +} source $__NPM_COMPLETION_FILE From 9e81b79d90606bc0afb6ce17867ff4d42df3ab37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 16 Jun 2016 21:14:51 +0200 Subject: [PATCH 32/53] Reorder zshrc template --- templates/zshrc.zsh-template | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 632490132..00d25bc93 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -1,10 +1,12 @@ +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:/usr/local/bin:$PATH + # Path to your oh-my-zsh installation. export ZSH=$HOME/.oh-my-zsh -# Set name of the theme to load. -# Look in ~/.oh-my-zsh/themes/ -# Optionally, if you set this to "random", it'll load a random theme each -# time that oh-my-zsh is loaded. +# Set name of the theme to load. Optionally, if you set this to "random" +# it'll load a random theme each time that oh-my-zsh is loaded. +# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes ZSH_THEME="robbyrussell" # Uncomment the following line to use case-sensitive completion. @@ -51,13 +53,12 @@ ZSH_THEME="robbyrussell" # Add wisely, as too many plugins slow down shell startup. plugins=(git) +source $ZSH/oh-my-zsh.sh + # User configuration -# export PATH="/usr/bin:/bin:/usr/sbin:/sbin:$PATH" # export MANPATH="/usr/local/man:$MANPATH" -source $ZSH/oh-my-zsh.sh - # You may need to manually set your language environment # export LANG=en_US.UTF-8 From 4f15bd15e5df830c27a35740f046ade81ba9efb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 24 Aug 2016 00:13:24 +0200 Subject: [PATCH 33/53] Properly fix npm completion source Problem introduced in 136a834. --- plugins/npm/npm.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index 480e92a91..30b91ec9c 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -4,9 +4,9 @@ if [[ ! -f $__NPM_COMPLETION_FILE ]]; then npm completion >! $__NPM_COMPLETION_FILE || rm -f $__NPM_COMPLETION_FILE fi -} -source $__NPM_COMPLETION_FILE + source $__NPM_COMPLETION_FILE +} # Install dependencies globally alias npmg="npm i -g " From 65f16fb64b77754386f34d207e073ee457afb0e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 24 Aug 2016 08:08:55 +0200 Subject: [PATCH 34/53] archlinux: remove comments, format functions better --- plugins/archlinux/archlinux.plugin.zsh | 124 ++++++++++++------------- 1 file changed, 60 insertions(+), 64 deletions(-) diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index f68443285..ef862f14c 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -1,74 +1,72 @@ -# Archlinux zsh aliases and functions -# Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins - -# Look for yaourt, and add some useful functions if we have it. -if (( $+commands[yaourt] )); then +if ! (( $+commands[yaourt] )); then + upgrade() { + sudo pacman -Syu + } +else upgrade () { yaourt -Syu } - alias yaconf='yaourt -C' # Fix all configuration files with vimdiff - # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips - alias yaupg='yaourt -Syua' # Synchronize with repositories before upgrading packages (AUR packages too) that are out of date on the local system. - alias yasu='yaourt --Syua --no-confirm' # Same as yaupg, but without confirmation - alias yain='yaourt -S' # Install specific package(s) from the repositories - alias yains='yaourt -U' # Install specific package not from the repositories but from a file - alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies - alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies - alias yarep='yaourt -Si' # Display information about a given package in the repositories - alias yareps='yaourt -Ss' # Search for package(s) in the repositories - alias yaloc='yaourt -Qi' # Display information about a given package in the local database - alias yalocs='yaourt -Qs' # Search for package(s) in the local database - alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local") - alias yaorph='yaourt -Qtd' # Remove orphans using yaourt - # Additional yaourt alias examples + + alias yaconf='yaourt -C' + alias yaupg='yaourt -Syua' + alias yasu='yaourt --Syua --no-confirm' + alias yain='yaourt -S' + alias yains='yaourt -U' + alias yare='yaourt -R' + alias yarem='yaourt -Rns' + alias yarep='yaourt -Si' + alias yareps='yaourt -Ss' + alias yaloc='yaourt -Qi' + alias yalocs='yaourt -Qs' + alias yalst='yaourt -Qe' + alias yaorph='yaourt -Qtd' + alias yainsd='yaourt -S --asdeps' + alias yamir='yaourt -Syy' + + if (( $+commands[abs] && $+commands[aur] )); then - alias yaupd='yaourt -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories + alias yaupd='yaourt -Sy && sudo abs && sudo aur' elif (( $+commands[abs] )); then - alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories + alias yaupd='yaourt -Sy && sudo abs' elif (( $+commands[aur] )); then - alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories + alias yaupd='yaourt -Sy && sudo aur' else - alias yaupd='yaourt -Sy' # Update and refresh the local package database against repositories + alias yaupd='yaourt -Sy' fi - alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package - alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist -else - upgrade() { - sudo pacman -Syu - } fi # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips -alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. -alias pacin='sudo pacman -S' # Install specific package(s) from the repositories -alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file -alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies -alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies -alias pacrep='pacman -Si' # Display information about a given package in the repositories -alias pacreps='pacman -Ss' # Search for package(s) in the repositories -alias pacloc='pacman -Qi' # Display information about a given package in the local database -alias paclocs='pacman -Qs' # Search for package(s) in the local database -# Additional pacman alias examples -if (( $+commands[abs] && $+commands[aur] )); then - alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories -elif (( $+commands[abs] )); then - alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories -elif (( $+commands[aur] )); then - alias pacupd='sudo pacman -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories -else - alias pacupd='sudo pacman -Sy' # Update and refresh the local package database against repositories -fi -alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package -alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist - -# https://bbs.archlinux.org/viewtopic.php?id=93683 -paclist() { - LC_ALL=C pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}' -} - +alias pacupg='sudo pacman -Syu' +alias pacin='sudo pacman -S' +alias pacins='sudo pacman -U' +alias pacre='sudo pacman -R' +alias pacrem='sudo pacman -Rns' +alias pacrep='pacman -Si' +alias pacreps='pacman -Ss' +alias pacloc='pacman -Qi' +alias paclocs='pacman -Qs' +alias pacinsd='sudo pacman -S --asdeps' +alias pacmir='sudo pacman -Syy' alias paclsorphans='sudo pacman -Qdt' alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' + +if (( $+commands[abs] && $+commands[aur] )); then + alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' +elif (( $+commands[abs] )); then + alias pacupd='sudo pacman -Sy && sudo abs' +elif (( $+commands[aur] )); then + alias pacupd='sudo pacman -Sy && sudo aur' +else + alias pacupd='sudo pacman -Sy' +fi + +paclist() { + # Source: https://bbs.archlinux.org/viewtopic.php?id=93683 + LC_ALL=C pacman -Qei $(pacman -Qu | cut -d " " -f 1) | \ + awk 'BEGIN {FS=":"} /^Name/{printf("\033[1;36m%s\033[1;37m", $2)} /^Description/{print $2}' +} + pacdisowned() { tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$ db=$tmp/db @@ -79,18 +77,16 @@ pacdisowned() { pacman -Qlq | sort -u > "$db" - find /bin /etc /lib /sbin /usr \ - ! -name lost+found \ - \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" + find /bin /etc /lib /sbin /usr ! -name lost+found \ + \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" comm -23 "$fs" "$db" } pacmanallkeys() { - # Get all keys for developers and trusted users - curl https://www.archlinux.org/{developers,trustedusers}/ | - awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' | - xargs sudo pacman-key --recv-keys + curl https://www.archlinux.org/{developers,trustedusers}/ | \ + awk -F\" '(/pgp.mit.edu/) { sub(/.*search=0x/,""); print $1}' | \ + xargs sudo pacman-key --recv-keys } pacmansignkeys() { From 98ea6414d8a5973ef499ac0b8c4a2e48abe46851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 24 Aug 2016 08:48:03 +0200 Subject: [PATCH 35/53] archlinux: reword and simplify README --- plugins/archlinux/README.md | 123 +++++++++++++++++++----------------- 1 file changed, 64 insertions(+), 59 deletions(-) diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md index 67595f9e9..785538a56 100644 --- a/plugins/archlinux/README.md +++ b/plugins/archlinux/README.md @@ -1,64 +1,69 @@ -## ARCHLINUX PLUGIN +# Archlinux plugin +## Features + +#### YAOURT + +| Alias | Command | Description | +|---------|------------------------------------|---------------------------------------------------------------------| +| yaconf | yaourt -C | Fix all configuration files with vimdiff | +| yain | yaourt -S | Install packages from the repositories | +| yains | yaourt -U | Install a package from a local file | +| yainsd | yaourt -S --asdeps | Install packages as dependencies of another package | +| yaloc | yaourt -Qi | Display information about a package in the local database | +| yalocs | yaourt -Qs | Search for packages in the local database | +| yalst | yaourt -Qe | List installed packages including from AUR (tagged as "local") | +| yamir | yaourt -Syy | Force refresh of all package lists after updating mirrorlist | +| yaorph | yaourt -Qtd | Remove orphans using yaourt | +| yare | yaourt -R | Remove packages, keeping its settings and dependencies | +| yarem | yaourt -Rns | Remove packages, including its settings and unneeded dependencies | +| yarep | yaourt -Si | Display information about a package in the repositories | +| yareps | yaourt -Ss | Search for packages in the repositories | +| yaupd | yaourt -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases | +| yaupd | yaourt -Sy && sudo abs | Update and refresh the local package and ABS databases | +| yaupd | yaourt -Sy && sudo aur | Update and refresh the local package and AUR databases | +| yaupd | yaourt -Sy | Update and refresh the local package database | +| yaupg | yaourt -Syua | Sync with repositories before upgrading all packages (from AUR too) | +| yasu | yaourt -Syua --no-confirm | Same as `yaupg`, but without confirmation | +| upgrade | yaourt -Syu | Sync with repositories before upgrading packages | + +#### PACMAN + +| Alias | Command | Description | +|--------------|-----------------------------------------|--------------------------------------------------------------| +| pacin | sudo pacman -S | Install packages from the repositories | +| pacins | sudo pacman -U | Install a package from a local file | +| pacinsd | sudo pacman -S --asdeps | Install packages as dependencies of another package | +| pacloc | pacman -Qi | Display information about a package in the local database | +| paclocs | pacman -Qs | Search for packages in the local database | +| paclsorphans | sudo pacman -Qdt | List all orphaned packages | +| pacmir | sudo pacman -Syy | Force refresh of all package lists after updating mirrorlist | +| pacre | sudo pacman -R | Remove packages, keeping its settings and dependencies | +| pacrem | sudo pacman -Rns | Remove packages, including its settings and dependencies | +| pacrep | pacman -Si | Display information about a package in the repositories | +| pacreps | pacman -Ss | Search for packages in the repositories | +| pacrmorphans | sudo pacman -Rs $(pacman -Qtdq) | Delete all orphaned packages | +| pacupd | sudo pacman -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases | +| pacupd | sudo pacman -Sy && sudo abs | Update and refresh the local package and ABS databases | +| pacupd | sudo pacman -Sy && sudo aur | Update and refresh the local package and AUR databases | +| pacupd | sudo pacman -Sy | Update and refresh the local package database | +| pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages | +| upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages | + +| Function | Description | +|----------------|------------------------------------------------------| +| pacdisowned | List all disowned files in your system | +| paclist | List all installed packages with a short description | +| pacmanallkeys | Get all keys for developers and trusted users | +| pacmansignkeys | Locally trust all keys passed as parameters | --- -### FEATURES +## Contributors -| Alias | Function | Description | -|:------------:|-----------------------------------------|:--------------------------------------------------------------------------------------------------------------------| -| pacin | sudo pacman -S | Install specific package(s) from the repositories | -| pacins | sudo pacman -U | Install specific package not from the repositories but from a file | -| pacinsd | sudo pacman -S --asdeps | Install given package(s) as dependencies of another package | -| pacloc | pacman -Qi | Display information about a given package in the local database | -| paclocs | pacman -Qs | Search for package(s) in the local database | -| paclsorphans | sudo pacman -Qdt' | List all orphaned packages | -| pacmir | sudo pacman -Syy | Force refresh of all package lists after updating /etc/pacman.d/mirrorlist | -| pacre | sudo pacman -R | Remove the specified package(s), retaining its configuration(s) and required dependencies | -| pacrem | sudo pacman -Rns | Remove the specified package(s), its configuration(s) and unneeded dependencies | -| pacrep | pacman -Si | Display information about a given package in the repositories | -| pacreps | pacman -Ss | Search for package(s) in the repositories | -| pacrmorphans | sudo pacman -Rs $(pacman -Qtdq)' | Delete all orphaned packages | -| pacupd | sudo pacman -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases against repositories | -| pacupd | sudo pacman -Sy && sudo abs | Update and refresh the local package and ABS databases against repositories | -| pacupd | sudo pacman -Sy && sudo aur | Update and refresh the local package and AUR databases against repositories | -| pacupd | sudo pacman -Sy | Update and refresh the local package database against repositories | -| pacupg | sudo pacman -Syu | Synchronize with repositories before upgrading packages that are out of date on the local system. | -| yaconf | yaourt -C | Fix all configuration files with vimdiff | -| yain | yaourt -S | Install specific package(s) from the repositories | -| yains | yaourt -U | Install specific package not from the repositories but from a file | -| yainsd | yaourt -S --asdeps | Install given package(s) as dependencies of another package | -| yaloc | yaourt -Qi | Display information about a given package in the local database | -| yalocs | yaourt -Qs | Search for package(s) in the local database | -| yalst | yaourt -Qe | List installed packages, even those installed from AUR (they're tagged as "local") | -| yamir | yaourt -Syy | Force refresh of all package lists after updating /etc/pacman.d/mirrorlist | -| yaorph | yaourt -Qtd | Remove orphans using yaourt | -| yare | yaourt -R | Remove the specified package(s), retaining its configuration(s) and required dependencies | -| yarem | yaourt -Rns | Remove the specified package(s), its configuration(s) and unneeded dependencies | -| yarep | yaourt -Si | Display information about a given package in the repositories | -| yareps | yaourt -Ss | Search for package(s) in the repositories | -| yasu | yaourt -Syua --no-confirm | Same as yaupg, but without confirmation | -| yaupd | yaourt -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases against repositories | -| yaupd | yaourt -Sy && sudo abs | Update and refresh the local package and ABS databases against repositories | -| yaupd | yaourt -Sy && sudo aur | Update and refresh the local package and AUR databases against repositories | -| yaupd | yaourt -Sy | Update and refresh the local package database against repositories | -| yaupg | yaourt -Syua | Synchronize with repositories before upgrading packages (AUR packages too) that are out of date on the local system | - -| Function | Description | -|----------------|:------------------------------------------------------------------------------------------------------------------| -| pacdisowned | List all disowned files in your system | -| paclist | List all installed packages with a short description - [Source](https://bbs.archlinux.org/viewtopic.php?id=93683) | -| pacmanallkeys | Get all keys for developers and trusted users | -| pacmansignkeys | | - ---- - -### CONTRIBUTORS - - Benjamin Boudreau - dreurmail@gmail.com - - Celso Miranda - contacto@celsomiranda.net - - KhasMek - Boushh@gmail.com - - Martin Putniorz - mputniorz@gmail.com - - MatthR3D - matthr3d@gmail.com - - ornicar - thibault.duplessis@gmail.com - ---- +- Benjamin Boudreau - dreurmail@gmail.com +- Celso Miranda - contacto@celsomiranda.net +- KhasMek - Boushh@gmail.com +- Martin Putniorz - mputniorz@gmail.com +- MatthR3D - matthr3d@gmail.com +- ornicar - thibault.duplessis@gmail.com From b90c8944b4827ceaa3872e16c006bd1a375015d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 24 Aug 2016 08:51:06 +0200 Subject: [PATCH 36/53] archlinux: fix pacmanallkeys URL, make curl silent Also make all functions local as to not spill variables into the global namespace. --- plugins/archlinux/archlinux.plugin.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index ef862f14c..9c8c984b1 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -68,6 +68,8 @@ paclist() { } pacdisowned() { + emulate -L zsh + tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$ db=$tmp/db fs=$tmp/fs @@ -84,12 +86,14 @@ pacdisowned() { } pacmanallkeys() { - curl https://www.archlinux.org/{developers,trustedusers}/ | \ + emulate -L zsh + curl -s https://www.archlinux.org/people/{developers,trustedusers}/ | \ awk -F\" '(/pgp.mit.edu/) { sub(/.*search=0x/,""); print $1}' | \ xargs sudo pacman-key --recv-keys } pacmansignkeys() { + emulate -L zsh for key in $*; do sudo pacman-key --recv-keys $key sudo pacman-key --lsign-key $key From cbd9d0403e7cbc06b96d91f8c7e96a80b07705d0 Mon Sep 17 00:00:00 2001 From: Ivan Eisenberg Date: Wed, 24 Aug 2016 13:02:27 -0500 Subject: [PATCH 37/53] Added documentation for undocumented OSX plugin commands (#5338) * updated OSX plugin docs --- plugins/osx/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/osx/README.md b/plugins/osx/README.md index 6de2b061e..0fcd23dd5 100644 --- a/plugins/osx/README.md +++ b/plugins/osx/README.md @@ -18,6 +18,8 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu) | Command | Description | | :-------------- | :----------------------------------------------- | | `tab` | Open the current directory in a new tab | +| `split_tab` | Split the current terminal tab horizontally | +| `vsplit_tab` | Split the current terminal tab vertically | | `ofd` | Open the current directory in a Finder window | | `pfd` | Return the path of the frontmost Finder window | | `pfs` | Return the current Finder selection | @@ -27,3 +29,4 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu) | `man-preview` | Open a specified man page in Preview app | | `showfiles` | Show hidden files | | `hidefiles` | Hide the hidden files | +| `itunes` | Control iTunes. User `itunes -h` for usage details | From 6e33095a7d61bc16fafec6952c531f6cc1e138fc Mon Sep 17 00:00:00 2001 From: Multilul Date: Wed, 24 Aug 2016 21:15:12 +0200 Subject: [PATCH 38/53] iTerm2 v3 tab commands fixes (#5336) Fixes the "syntax error: expected line end ..." (-2741) when using the tab, split_tab and vsplit_tab commands in iTerm2 v3 --- plugins/osx/osx.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index f69bd7e5d..a3e550972 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -44,7 +44,7 @@ EOF elif [[ "$the_app" == 'iTerm2' ]]; then osascript < Date: Mon, 28 Apr 2014 09:00:52 +0200 Subject: [PATCH 39/53] adding tig plugin for oh-my-zsh --- plugins/tig/tig.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 plugins/tig/tig.plugin.zsh diff --git a/plugins/tig/tig.plugin.zsh b/plugins/tig/tig.plugin.zsh new file mode 100644 index 000000000..1d2a4d5c9 --- /dev/null +++ b/plugins/tig/tig.plugin.zsh @@ -0,0 +1,6 @@ +alias tis='tig status' +alias til='tig log' + +# blame a single file and list commits +alias tib='tig blame -C' + From 04dd97783e251c795314c6fca70b14062274ff9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 24 Aug 2016 21:27:18 +0200 Subject: [PATCH 40/53] Add README to tig plugin --- plugins/tig/README.md | 16 ++++++++++++++++ plugins/tig/tig.plugin.zsh | 3 --- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 plugins/tig/README.md diff --git a/plugins/tig/README.md b/plugins/tig/README.md new file mode 100644 index 000000000..bb24cd147 --- /dev/null +++ b/plugins/tig/README.md @@ -0,0 +1,16 @@ +# `tig` plugin + +This plugin adds some aliases for people who work with `tig` in +a regular basis. To use it, add `tig` to your plugins array: + +```zsh +plugins=(... tig) +``` + +## Features + +| Alias | Command | Description | +|-------|----------------|-------------------------------------------------| +| `tis` | `tig status` | Show git status | +| `til` | `tig log` | Show git log | +| `tib` | `tig blame -C` | `git-blame` a file detecting copies and renames | diff --git a/plugins/tig/tig.plugin.zsh b/plugins/tig/tig.plugin.zsh index 1d2a4d5c9..7e0c530ac 100644 --- a/plugins/tig/tig.plugin.zsh +++ b/plugins/tig/tig.plugin.zsh @@ -1,6 +1,3 @@ alias tis='tig status' alias til='tig log' - -# blame a single file and list commits alias tib='tig blame -C' - From d8b03f3f95c10b61f7a9d4bd690f6cb429fb6ae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 25 Aug 2016 02:05:25 +0200 Subject: [PATCH 41/53] init script: remove trailing slash from $ZSH_CACHE_DIR --- oh-my-zsh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 6cc5ac630..ed258f0ea 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -22,7 +22,7 @@ fi # Set ZSH_CACHE_DIR to the path where cache files should be created # or else we will use the default cache/ if [[ -z "$ZSH_CACHE_DIR" ]]; then - ZSH_CACHE_DIR="$ZSH/cache/" + ZSH_CACHE_DIR="$ZSH/cache" fi From e1e3acc722133a50fba7aeee224244c499fbcdb2 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Tue, 24 Feb 2015 12:12:33 -0500 Subject: [PATCH 42/53] cask: check for Homebrew path for completion file --- plugins/cask/cask.plugin.zsh | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/plugins/cask/cask.plugin.zsh b/plugins/cask/cask.plugin.zsh index c55862924..bc0006d9f 100644 --- a/plugins/cask/cask.plugin.zsh +++ b/plugins/cask/cask.plugin.zsh @@ -1,5 +1,21 @@ -if which cask &> /dev/null; then - source $(dirname $(which cask))/../etc/cask_completion.zsh -else - print "zsh cask plugin: cask not found" -fi +() { + if which cask &> /dev/null; then + local cask_bin cask_base f comp_files + cask_bin=$(which cask) + cask_base=${cask_bin:h:h} + # Plain cask installation location (for Cask 0.7.2 and earlier) + comp_files=( $cask_base/etc/cask_completion.zsh ) + # Mac Homebrew installs the completion in a different location + if which brew &> /dev/null; then + comp_files+=`brew --prefix`/share/zsh/site-functions/cask_completion.zsh + fi + for f in $comp_files; do + if [[ -f $f ]]; then + source $f; + break; + fi + done + else + print "zsh cask plugin: cask not found" + fi +} \ No newline at end of file From a7e60e4a9367117fa39ecf1de9ce63383878538b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 12 Feb 2016 18:55:53 +0100 Subject: [PATCH 43/53] Style fixes and shorter command lookup --- plugins/cask/cask.plugin.zsh | 43 ++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/plugins/cask/cask.plugin.zsh b/plugins/cask/cask.plugin.zsh index bc0006d9f..29120b306 100644 --- a/plugins/cask/cask.plugin.zsh +++ b/plugins/cask/cask.plugin.zsh @@ -1,21 +1,26 @@ () { - if which cask &> /dev/null; then - local cask_bin cask_base f comp_files - cask_bin=$(which cask) - cask_base=${cask_bin:h:h} - # Plain cask installation location (for Cask 0.7.2 and earlier) - comp_files=( $cask_base/etc/cask_completion.zsh ) - # Mac Homebrew installs the completion in a different location - if which brew &> /dev/null; then - comp_files+=`brew --prefix`/share/zsh/site-functions/cask_completion.zsh - fi - for f in $comp_files; do - if [[ -f $f ]]; then - source $f; - break; - fi - done - else - print "zsh cask plugin: cask not found" + emulate -L zsh + + if ! (( $+commands[cask] )); then + print "zsh cask plugin: cask command not found" >&2 + return fi -} \ No newline at end of file + + cask_base=${commands[cask]:h:h} + + # Plain cask installation location (for Cask 0.7.2 and earlier) + comp_files=($cask_base/etc/cask_completion.zsh) + + # Mac Homebrew installs the completion in a different location + if (( $+commands[brew] )); then + comp_files+=($(brew --prefix)/share/zsh/site-functions/cask_completion.zsh) + fi + + # Load first found file + for f in $comp_files; do + if [[ -f "$f" ]]; then + source "$f" + break + fi + done +} From cf4da1b7ac69505105e7e0b36155f1664f760d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 25 Aug 2016 18:33:15 +0200 Subject: [PATCH 44/53] Add README to cask plugin --- plugins/cask/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 plugins/cask/README.md diff --git a/plugins/cask/README.md b/plugins/cask/README.md new file mode 100644 index 000000000..6457fd858 --- /dev/null +++ b/plugins/cask/README.md @@ -0,0 +1,11 @@ +# cask plugin + +Loads `cask` completion from non-standard locations, such as if installed +via Homebrew or others. To enable it, add `cask` to your plugins array: + +```zsh +plugins=(... cask) +``` + +Make sure you have the `cask` directory in your `$PATH` before loading +Oh My Zsh, otherwise you'll get the "command not found" error. From deadc369bf1f8286bed883420975096c2c3a32d9 Mon Sep 17 00:00:00 2001 From: Kevin Ndung'u Date: Fri, 26 Aug 2016 22:41:16 +0300 Subject: [PATCH 45/53] Disable zsh file globbing when running pip (#5348) --- plugins/pip/pip.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh index b5433ae9d..d7236b02a 100644 --- a/plugins/pip/pip.plugin.zsh +++ b/plugins/pip/pip.plugin.zsh @@ -76,3 +76,6 @@ zsh-pip-test-clean-packages() { echo "the djangopypi2 index is fine" fi } + +alias pip="noglob pip" # allows square brackets for pip command invocation + From 2ab67382e7b6892a745f02ec4c8f84e6ac632204 Mon Sep 17 00:00:00 2001 From: Rory Hardy Date: Fri, 26 Aug 2016 15:05:33 -0500 Subject: [PATCH 46/53] Added perms plugin (#1752) * Added perms plugin * HTTPS -> HTTP for comment URL * Added a README * Updated TOF comment * Pulled in updates by apjanke with minor tweaks --- plugins/perms/README.md | 9 ++++ plugins/perms/perms.plugin.zsh | 78 ++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 plugins/perms/README.md create mode 100644 plugins/perms/perms.plugin.zsh diff --git a/plugins/perms/README.md b/plugins/perms/README.md new file mode 100644 index 000000000..873c21d42 --- /dev/null +++ b/plugins/perms/README.md @@ -0,0 +1,9 @@ +## Perms + +Plugin to handle some unix filesystem permissions quickly + +### Usage + +* `set755` recursively sets all directories located within the current working directory and sub directories to octal 755. +* `set644` recursively sets all files located within the current working directory and sub directories to octal 644. +* `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases. \ No newline at end of file diff --git a/plugins/perms/perms.plugin.zsh b/plugins/perms/perms.plugin.zsh new file mode 100644 index 000000000..81f56d577 --- /dev/null +++ b/plugins/perms/perms.plugin.zsh @@ -0,0 +1,78 @@ +# Some useful commands for setting permissions. +# +# Rory Hardy [GneatGeek] +# Andrew Janke [apjanke] + +### Aliases + +# Set all files' permissions to 644 recursively in a directory +alias set644='find . -type f -print0 | xargs -0 chmod 644' + +# Set all directories' permissions to 755 recursively in a directory +alias set755='find . -type d -print0 | xargs -0 chmod 755' + +### Functions + +# fixperms - fix permissions on files and directories, with confirmation +# Returns 0 on success, nonzero if any errors occurred +fixperms () { + local opts confirm target exit_status chmod_opts use_slow_mode + zparseopts -E -D -a opts -help -slow v+=chmod_opts + if [[ $# > 1 || -n "${opts[(r)--help]}" ]]; then + cat < 1 )) + return $exit_status + fi + + if [[ $# == 0 ]]; then + target="." + else + target="$1" + fi + if [[ -n ${opts[(r)--slow]} ]]; then use_slow=true; else use_slow=false; fi + + # Because this requires confirmation, bail in noninteractive shells + if [[ ! -o interactive ]]; then + echo "fixperms: cannot run in noninteractive shell" + return 1 + fi + + echo "Fixing perms on $target?" + printf '%s' "Proceed? (y|n) " + read confirm + if [[ "$confirm" != y ]]; then + # User aborted + return 1 + fi + + # This xargs form is faster than -exec chmod {} \; but will encounter + # issues if the directories themselves have permissions such that you can't + # recurse in to them. If that happens, just rerun this a few times. + exit_status=0; + if [[ $use_slow == true ]]; then + # Process directories first so non-traversable ones are fixed as we go + find "$target" -type d -exec chmod $chmod_opts 755 {} \; + if [[ $? != 0 ]]; then exit_status=$?; fi + find "$target" -type f -exec chmod $chmod_opts 644 {} \; + if [[ $? != 0 ]]; then exit_status=$?; fi + else + find "$target" -type d -print0 | xargs -0 chmod $chmod_opts 755 + if [[ $? != 0 ]]; then exit_status=$?; fi + find "$target" -type f -print0 | xargs -0 chmod $chmod_opts 644 + if [[ $? != 0 ]]; then exit_status=$?; fi + fi + echo "Complete" + return $exit_status +} From 2277967ecf7656fa2fc03b8ae5f23a3cf92beb33 Mon Sep 17 00:00:00 2001 From: Aleksey Ivanov Date: Sun, 21 Aug 2016 19:50:44 +0200 Subject: [PATCH 47/53] Fix _tasks_changed algorithm in rake-fast plugin --- plugins/rake-fast/rake-fast.plugin.zsh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/rake-fast/rake-fast.plugin.zsh b/plugins/rake-fast/rake-fast.plugin.zsh index 57d699abc..411d25726 100644 --- a/plugins/rake-fast/rake-fast.plugin.zsh +++ b/plugins/rake-fast/rake-fast.plugin.zsh @@ -16,11 +16,16 @@ _is_rails_app () { } _tasks_changed () { - local is_changed=1 - for file in lib/tasks/**/*.rake; do - if [[ $file -nt .rake_tasks ]]; then is_changed=0; fi + local -a paths + paths=(lib/tasks lib/tasks/**/*(N)) + + for path in $paths; do + if [[ "$path" -nt .rake_tasks ]]; then + return 0 + fi done - return is_changed + + return 1 } _rake_generate () { From 81ca3182a126025638d61d590df2f58cb6c5dc37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 21 Aug 2016 19:51:08 +0200 Subject: [PATCH 48/53] Fix syntax and formatting of rake-fast plugin --- plugins/rake-fast/rake-fast.plugin.zsh | 29 ++++++++++++-------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/plugins/rake-fast/rake-fast.plugin.zsh b/plugins/rake-fast/rake-fast.plugin.zsh index 411d25726..a594ca923 100644 --- a/plugins/rake-fast/rake-fast.plugin.zsh +++ b/plugins/rake-fast/rake-fast.plugin.zsh @@ -1,18 +1,9 @@ -_rake_refresh () { - if [ -f .rake_tasks ]; then - rm .rake_tasks - fi - echo "Generating .rake_tasks..." > /dev/stderr - _rake_generate - cat .rake_tasks -} - _rake_does_task_list_need_generating () { - [[ ! -f .rake_tasks ]] || [[ Rakefile -nt .rake_tasks ]] || (_is_rails_app && _tasks_changed) + [[ ! -f .rake_tasks ]] || [[ Rakefile -nt .rake_tasks ]] || { _is_rails_app && _tasks_changed } } _is_rails_app () { - [[ -e "bin/rails" ]] || [ -e "script/rails" ] + [[ -e "bin/rails" ]] || [[ -e "script/rails" ]] } _tasks_changed () { @@ -33,14 +24,20 @@ _rake_generate () { } _rake () { - if [ -f Rakefile ]; then + if [[ -f Rakefile ]]; then if _rake_does_task_list_need_generating; then - echo "\nGenerating .rake_tasks..." > /dev/stderr + echo "\nGenerating .rake_tasks..." >&2 _rake_generate fi - compadd `cat .rake_tasks` + compadd $(cat .rake_tasks) fi } - compdef _rake rake -alias rake_refresh='_rake_refresh' + +rake_refresh () { + [[ -f .rake_tasks ]] && rm -f .rake_tasks + + echo "Generating .rake_tasks..." >&2 + _rake_generate + cat .rake_tasks +} From 59fdb2b505bc415738dc92f6188453e54bf0c45c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 21 Aug 2016 20:02:55 +0200 Subject: [PATCH 49/53] Reword rake-fast README, add `lib/tasks` information --- plugins/rake-fast/README.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/plugins/rake-fast/README.md b/plugins/rake-fast/README.md index f56142f69..1417befa1 100644 --- a/plugins/rake-fast/README.md +++ b/plugins/rake-fast/README.md @@ -2,22 +2,34 @@ Fast rake autocompletion plugin. -This script caches the output for later usage and significantly speeds it up. It generates a .rake_tasks cache file in parallel to the Rakefile. It also checks the file modification dates to see if it needs to regenerate the cache file. +This plugin caches the output for later usage and significantly speeds it up. +It generates a `.rake_tasks` cache file in parallel to the Rakefile. It also +checks the file modification time to see if it needs to regenerate the cache +file. -This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/), which is inspired by [this Ruby on Rails trick from 2006](http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh/). +This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/), +which is inspired by [this Ruby on Rails trick from 2006](http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh/). Think about that. 2006. +---------- + +Since August of 2016, it also checks if it's in a Rails project and looks at +rake files inside `lib/tasks` and their modification time to know if the +cache file needs to be regenerated. + ## Installation Just add the plugin to your `.zshrc`: -```bash -plugins=(foo bar rake-fast) +```zsh +plugins=(... rake-fast) ``` You might consider adding `.rake_tasks` to your [global .gitignore](https://help.github.com/articles/ignoring-files#global-gitignore) ## Usage -`rake`, then press tab +Type `rake`, then press tab. + +If you want to force the regeneration of the `.rake_tasks` file, run `rake_refresh`. From abf73bb626cbe645e23f205583631330c9fbabd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 29 Aug 2016 08:37:09 +0200 Subject: [PATCH 50/53] rake-fast: change variable name from `$path' to `$file' This solves a problem of using the variable name `$path' which then smashes the environment variable `$PATH' and messes up the session. See https://github.com/robbyrussell/oh-my-zsh/pull/5343#issuecomment-243043098 --- plugins/rake-fast/rake-fast.plugin.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/rake-fast/rake-fast.plugin.zsh b/plugins/rake-fast/rake-fast.plugin.zsh index a594ca923..ca80d86e1 100644 --- a/plugins/rake-fast/rake-fast.plugin.zsh +++ b/plugins/rake-fast/rake-fast.plugin.zsh @@ -7,11 +7,11 @@ _is_rails_app () { } _tasks_changed () { - local -a paths - paths=(lib/tasks lib/tasks/**/*(N)) + local -a files + files=(lib/tasks lib/tasks/**/*(N)) - for path in $paths; do - if [[ "$path" -nt .rake_tasks ]]; then + for file in $files; do + if [[ "$file" -nt .rake_tasks ]]; then return 0 fi done From 1af4e9c521d82068871956dc4cf172a262827520 Mon Sep 17 00:00:00 2001 From: Fabio Fernandes Date: Sat, 13 Jul 2013 05:27:37 -0300 Subject: [PATCH 51/53] Add Droplr plugin --- plugins/droplr/droplr.plugin.zsh | 3 +++ plugins/droplr/droplr.rb | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 plugins/droplr/droplr.plugin.zsh create mode 100755 plugins/droplr/droplr.rb diff --git a/plugins/droplr/droplr.plugin.zsh b/plugins/droplr/droplr.plugin.zsh new file mode 100644 index 000000000..a20ca9368 --- /dev/null +++ b/plugins/droplr/droplr.plugin.zsh @@ -0,0 +1,3 @@ +#!/bin/zsh + +alias droplr=$ZSH/plugins/droplr/droplr.rb \ No newline at end of file diff --git a/plugins/droplr/droplr.rb b/plugins/droplr/droplr.rb new file mode 100755 index 000000000..38751dfcb --- /dev/null +++ b/plugins/droplr/droplr.rb @@ -0,0 +1,25 @@ +#!/usr/bin/env ruby +# +# droplr +# Fabio Fernandes | http://fabiofl.me +# +# Use Droplr from the comand line to upload files and shorten links. +# +# Examples: +# +# droplr ./path/to/file/ +# droplr http://example.com +# +# This needs Droplr.app to be installed and loged in. +# Also, Mac only. + +if ARGV[0].nil? + puts "You need to specify a parameter." + exit!(1) +end + +if ARGV[0][%r{^http[|s]://}i] + `osascript -e 'tell app "Droplr" to shorten "#{ARGV[0]}"'` +else + `open -ga /Applications/Droplr.app "#{ARGV[0]}"` +end \ No newline at end of file From 864887388758b615d15a3f30a461aff1a7711d0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 2 Sep 2016 20:25:28 +0200 Subject: [PATCH 52/53] Add Droplr README --- plugins/droplr/README.md | 19 +++++++++++++++++++ plugins/droplr/droplr.plugin.zsh | 4 +--- plugins/droplr/droplr.rb | 15 +-------------- 3 files changed, 21 insertions(+), 17 deletions(-) create mode 100644 plugins/droplr/README.md diff --git a/plugins/droplr/README.md b/plugins/droplr/README.md new file mode 100644 index 000000000..cfbec25ed --- /dev/null +++ b/plugins/droplr/README.md @@ -0,0 +1,19 @@ +# droplr + +Use [Droplr](https://droplr.com/) from the comand line to upload files and shorten +links. It needs to have [Droplr.app](https://droplr.com/apps) installed and logged +in. MacOS only. + +To use it, add `droplr` to the `$plugins` variable in your zshrc file: + +```zsh +plugins=(... droplr) +``` + +Author: [Fabio Fernandes](https://github.com/fabiofl) + +## Examples + +- Upload a file: `droplr ./path/to/file/` + +- Shorten a link: `droplr http://example.com` diff --git a/plugins/droplr/droplr.plugin.zsh b/plugins/droplr/droplr.plugin.zsh index a20ca9368..2a2ec227c 100644 --- a/plugins/droplr/droplr.plugin.zsh +++ b/plugins/droplr/droplr.plugin.zsh @@ -1,3 +1 @@ -#!/bin/zsh - -alias droplr=$ZSH/plugins/droplr/droplr.rb \ No newline at end of file +alias droplr=$ZSH/plugins/droplr/droplr.rb diff --git a/plugins/droplr/droplr.rb b/plugins/droplr/droplr.rb index 38751dfcb..00300198e 100755 --- a/plugins/droplr/droplr.rb +++ b/plugins/droplr/droplr.rb @@ -1,17 +1,4 @@ #!/usr/bin/env ruby -# -# droplr -# Fabio Fernandes | http://fabiofl.me -# -# Use Droplr from the comand line to upload files and shorten links. -# -# Examples: -# -# droplr ./path/to/file/ -# droplr http://example.com -# -# This needs Droplr.app to be installed and loged in. -# Also, Mac only. if ARGV[0].nil? puts "You need to specify a parameter." @@ -22,4 +9,4 @@ if ARGV[0][%r{^http[|s]://}i] `osascript -e 'tell app "Droplr" to shorten "#{ARGV[0]}"'` else `open -ga /Applications/Droplr.app "#{ARGV[0]}"` -end \ No newline at end of file +end From 7a32a98ced7817c4c4f178cb80c2c39d4957ea59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 2 Sep 2016 21:01:31 +0200 Subject: [PATCH 53/53] droplr: convert ruby file into zsh --- plugins/droplr/droplr.plugin.zsh | 16 +++++++++++++++- plugins/droplr/droplr.rb | 12 ------------ 2 files changed, 15 insertions(+), 13 deletions(-) delete mode 100755 plugins/droplr/droplr.rb diff --git a/plugins/droplr/droplr.plugin.zsh b/plugins/droplr/droplr.plugin.zsh index 2a2ec227c..296a8b98b 100644 --- a/plugins/droplr/droplr.plugin.zsh +++ b/plugins/droplr/droplr.plugin.zsh @@ -1 +1,15 @@ -alias droplr=$ZSH/plugins/droplr/droplr.rb +# Only compatible with MacOS +[[ "$OSTYPE" == darwin* ]] || return + +droplr() { + if [[ $# -eq 0 ]]; then + echo You need to specify a parameter. >&2 + return 1 + fi + + if [[ "$1" =~ ^http[|s]:// ]]; then + osascript -e "tell app 'Droplr' to shorten '$1'" + else + open -ga /Applications/Droplr.app "$1" + fi +} diff --git a/plugins/droplr/droplr.rb b/plugins/droplr/droplr.rb deleted file mode 100755 index 00300198e..000000000 --- a/plugins/droplr/droplr.rb +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env ruby - -if ARGV[0].nil? - puts "You need to specify a parameter." - exit!(1) -end - -if ARGV[0][%r{^http[|s]://}i] - `osascript -e 'tell app "Droplr" to shorten "#{ARGV[0]}"'` -else - `open -ga /Applications/Droplr.app "#{ARGV[0]}"` -end