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 01/27] 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 02/27] 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 03/27] 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 04/27] 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 05/27] 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 06/27] 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 07/27] 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 08/27] 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 09/27] 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 10/27] 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 11/27] 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 12/27] 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 13/27] 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 14/27] 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 15/27] 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 16/27] 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 17/27] 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 18/27] 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 19/27] 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 20/27] 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 21/27] 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 22/27] 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 23/27] 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 24/27] 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 25/27] 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 26/27] 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 27/27] 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 +}