Revert "add powerlevel10k"

This reverts commit 537a63d601.
This commit is contained in:
vincent 2020-06-11 16:59:30 +02:00
parent 92e3a7a5ff
commit 341b34f8fa
220 changed files with 5956 additions and 5795 deletions

View File

@ -1,7 +1,6 @@
--- ---
name: Bug report name: Bug report
about: Create a report to help us improve Oh My Zsh about: Create a report to help us improve
labels: 'Type: support'
--- ---
@ -11,26 +10,29 @@ an issue where no sections have been filled will be deleted without comment.
--> -->
**Describe the bug** **Describe the bug**
A clear description of what the bug is. <!-- A clear and concise description of what the bug is. -->
**To Reproduce** **To Reproduce**
Steps to reproduce the behavior, for example: <!--
1. Enable this plugin '...' Steps to reproduce the behavior:
2. Run command '...' or try the autocomplete command '...' 1. Enable plugin '...'
2. Run command '...', _or_ try to complete command '...', _etc._
3. See error 3. See error
-->
**Expected behavior** **Expected behavior**
A brief description of what should happen. <!-- A clear and concise description of what you expected to happen. -->
**Screenshots and/or Recordings** **Screenshots or recordings**
If applicable, add screenshots to help explain your problem. <!--
You can also record an asciinema session: https://asciinema.org/ If applicable, add screenshots or record an asciinema session (https://asciinema.org/)
to help explain your problem.
-->
**Desktop (please complete the following information):** **System:**
- OS / Distro: [e.g. Arch Linux, macOS] - OS: [e.g. macOS]
- Latest ohmyzsh Update?: [e.g. Yes/No] - Zsh version [e.g. 5.6]
- ZSH Version: [e.g. 5.6]
- Terminal emulator [e.g. iTerm2] - Terminal emulator [e.g. iTerm2]
**Additional context** **Additional context**
Add any other context about the problem here. This can be themes, plugins, custom configs. <!-- Add any other context about the problem here. -->

View File

@ -11,16 +11,16 @@ an issue where no sections have been filled will be deleted without comment.
--> -->
**Is your feature request related to a particular plugin or theme? If so, specify it.** **Is your feature request related to a particular plugin or theme? If so, specify it.**
The name of the plugin or theme that you would like us to improve. [...] <!-- The name of the plugin or theme you'd like us to improve. -->
**Is your feature request related to a problem? Please describe.** **Is your feature request related to a problem? Please describe.**
A description of what the problem is. Ex. I'm always frustrated when [...] <!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
**Describe the solution you'd like** **Describe the solution you'd like**
A description of what you want to happen. <!-- A clear and concise description of what you want to happen. -->
**Describe alternatives you've considered** **Describe alternatives you've considered**
A description of any alternative solutions or features you've considered. This can also include other plugins or aliases. <!-- A clear and concise description of any alternative solutions or features you've considered. -->
**Additional context** **Additional context**
Add any other context or screenshots about the feature request here. Also if you have any PRs related to this issue that are already open that you would like us to look at. <!-- Add any other context or screenshots about the feature request here. -->

View File

@ -5,6 +5,8 @@ labels: 'Type: support'
--- ---
<!--
1. Look for similar issues already posted (including closed ones) 1. Look for similar issues already posted (including closed ones)
2. Include as much relevant information as possible 2. Include as much relevant information as possible
3. Try to make sure the issue is due to Oh My Zsh 3. Try to make sure the issue is due to Oh My Zsh
-->

View File

@ -0,0 +1,36 @@
name: Check Suite
on:
pull_request:
types:
- opened
- synchronize
branches:
- master
push:
branches:
- master
jobs:
tests:
name: Run tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Set up git repository
uses: actions/checkout@v2
- name: Install zsh
if: runner.os == 'Linux'
run: sudo apt-get update; sudo apt-get install zsh
- name: Test installer
run: sh ./tools/install.sh
- name: Check syntax
run: |
for file in ./oh-my-zsh.sh \
./lib/*.zsh \
./plugins/*/*.plugin.zsh \
./plugins/*/_* \
./themes/*.zsh-theme; do
zsh -n "$file" || return 1
done

View File

@ -14,9 +14,9 @@ Finally, you'll begin to get the sort of attention that you have always felt you
To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter, and/or join us on Discord. To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter, and/or join us on Discord.
[![CI](https://github.com/ohmyzsh/ohmyzsh/workflows/CI/badge.svg)](https://github.com/ohmyzsh/ohmyzsh/actions?query=workflow%3ACI) ![Check Suite](https://github.com/ohmyzsh/ohmyzsh/workflows/Check%20Suite/badge.svg)
[![Follow @ohmyzsh](https://img.shields.io/twitter/follow/ohmyzsh?label=Follow+@ohmyzsh&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh) [![Follow @ohmyzsh](https://img.shields.io/twitter/follow/ohmyzsh?label=Follow+@ohmyzsh&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh)
[![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/ohmyzsh) [![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/bpXWhnN)
## Getting Started ## Getting Started
@ -25,7 +25,7 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi
* A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL is preferred, but cygwin or msys also mostly work. * A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL is preferred, but cygwin or msys also mostly work.
* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (run `zsh --version` to confirm), check the following instructions here: [Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH) * [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (run `zsh --version` to confirm), check the following instructions here: [Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH)
* `curl` or `wget` should be installed * `curl` or `wget` should be installed
* `git` should be installed (recommended v1.7.2 or higher) * `git` should be installed
### Basic Installation ### Basic Installation
@ -133,12 +133,6 @@ ZSH_THEME_RANDOM_CANDIDATES=(
) )
``` ```
If you only know which themes you don't like, you can add them similarly to a blacklist:
```shell
ZSH_THEME_RANDOM_BLACKLIST=(pygmalion tjkirch_mod)
```
### FAQ ### FAQ
If you have some more questions or issues, you might find a solution in our [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ). If you have some more questions or issues, you might find a solution in our [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ).

@ -1 +0,0 @@
Subproject commit 05eaf8162c0a83c38bb210e888358d5bdc3aef90

View File

@ -3,23 +3,10 @@
# This file has support for doing system clipboard copy and paste operations # This file has support for doing system clipboard copy and paste operations
# from the command line in a generic cross-platform fashion. # from the command line in a generic cross-platform fashion.
# #
# This is uses essentially the same heuristic as neovim, with the additional # On OS X and Windows, the main system clipboard or "pasteboard" is used. On other
# special support for Cygwin. # Unix-like OSes, this considers the X Windows CLIPBOARD selection to be the
# See: https://github.com/neovim/neovim/blob/e682d799fa3cf2e80a02d00c6ea874599d58f0e7/runtime/autoload/provider/clipboard.vim#L55-L121 # "system clipboard", and the X Windows `xclip` command must be installed.
#
# - pbcopy, pbpaste (macOS)
# - cygwin (Windows running Cygwin)
# - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)
# - xclip (if $DISPLAY is set)
# - xsel (if $DISPLAY is set)
# - lemonade (for SSH) https://github.com/pocke/lemonade
# - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
# - win32yank (Windows)
# - tmux (if $TMUX is set)
#
# Defines two functions, clipcopy and clippaste, based on the detected platform.
##
#
# clipcopy - Copy data to clipboard # clipcopy - Copy data to clipboard
# #
# Usage: # Usage:
@ -28,8 +15,41 @@
# #
# clipcopy <file> - copies a file's contents to clipboard # clipcopy <file> - copies a file's contents to clipboard
# #
## function clipcopy() {
# emulate -L zsh
local file=$1
if [[ $OSTYPE == darwin* ]]; then
if [[ -z $file ]]; then
pbcopy
else
cat $file | pbcopy
fi
elif [[ $OSTYPE == (cygwin|msys)* ]]; then
if [[ -z $file ]]; then
cat > /dev/clipboard
else
cat $file > /dev/clipboard
fi
else
if (( $+commands[xclip] )); then
if [[ -z $file ]]; then
xclip -in -selection clipboard
else
xclip -in -selection clipboard $file
fi
elif (( $+commands[xsel] )); then
if [[ -z $file ]]; then
xsel --clipboard --input
else
cat "$file" | xsel --clipboard --input
fi
else
print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
return 1
fi
fi
}
# clippaste - "Paste" data from clipboard to stdout # clippaste - "Paste" data from clipboard to stdout
# #
# Usage: # Usage:
@ -47,61 +67,20 @@
# #
# # Paste to a file # # Paste to a file
# clippaste > file.txt # clippaste > file.txt
# function clippaste() {
function detect-clipboard() {
emulate -L zsh emulate -L zsh
if [[ $OSTYPE == darwin* ]]; then
if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then pbpaste
function clipcopy() { pbcopy < "${1:-/dev/stdin}"; } elif [[ $OSTYPE == (cygwin|msys)* ]]; then
function clippaste() { pbpaste; } cat /dev/clipboard
elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then
function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; }
function clippaste() { cat /dev/clipboard; }
elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
function clipcopy() { wl-copy < "${1:-/dev/stdin}"; }
function clippaste() { wl-paste; }
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then
function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}"; }
function clippaste() { xclip -out -selection clipboard; }
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then
function clipcopy() { xsel --clipboard --input < "${1:-/dev/stdin}"; }
function clippaste() { xsel --clipboard --output; }
elif (( ${+commands[lemonade]} )); then
function clipcopy() { lemonade copy < "${1:-/dev/stdin}"; }
function clippaste() { lemonade paste; }
elif (( ${+commands[doitclient]} )); then
function clipcopy() { doitclient wclip < "${1:-/dev/stdin}"; }
function clippaste() { doitclient wclip -r; }
elif (( ${+commands[win32yank]} )); then
function clipcopy() { win32yank -i < "${1:-/dev/stdin}"; }
function clippaste() { win32yank -o; }
elif [[ $OSTYPE == linux-android* ]] && (( $+commands[termux-clipboard-set] )); then
function clipcopy() { termux-clipboard-set "${1:-/dev/stdin}"; }
function clippaste() { termux-clipboard-get; }
elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then
function clipcopy() { tmux load-buffer "${1:--}"; }
function clippaste() { tmux save-buffer -; }
elif [[ $(uname -r) = *icrosoft* ]]; then
function clipcopy() { clip.exe < "${1:-/dev/stdin}"; }
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
else else
function _retry_clipboard_detection_or_fail() { if (( $+commands[xclip] )); then
local clipcmd="${1}"; shift xclip -out -selection clipboard
if detect-clipboard; then elif (( $+commands[xsel] )); then
"${clipcmd}" "$@" xsel --clipboard --output
else else
print "${clipcmd}: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
return 1 return 1
fi fi
}
function clipcopy() { _retry_clipboard_detection_or_fail clipcopy "$@"; }
function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; }
return 1
fi fi
} }
# Detect at startup. A non-zero exit here indicates that the dummy clipboards were set,
# which is not really an error. If the user calls them, they will attempt to redetect
# (for example, perhaps the user has now installed xclip) and then either print an error
# or proceed successfully.
detect-clipboard || true

View File

@ -41,8 +41,8 @@ fi
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
# Use caching so that commands like apt and dpkg complete are useable # Use caching so that commands like apt and dpkg complete are useable
zstyle ':completion:*' use-cache yes zstyle ':completion::complete:*' use-cache 1
zstyle ':completion:*' cache-path $ZSH_CACHE_DIR zstyle ':completion::complete:*' cache-path $ZSH_CACHE_DIR
# Don't complete uninteresting users # Don't complete uninteresting users
zstyle ':completion:*:*:*:users' ignored-patterns \ zstyle ':completion:*:*:*:users' ignored-patterns \
@ -71,6 +71,3 @@ if [[ $COMPLETION_WAITING_DOTS = true ]]; then
zle -N expand-or-complete-with-dots zle -N expand-or-complete-with-dots
bindkey "^I" expand-or-complete-with-dots bindkey "^I" expand-or-complete-with-dots
fi fi
# automatically load bash completion functions
autoload -U +X bashcompinit && bashcompinit

View File

@ -192,19 +192,19 @@ function _omz_diag_dump_one_big_text() {
command ls -ld ~/.oh* command ls -ld ~/.oh*
builtin echo builtin echo
builtin echo oh-my-zsh git state: builtin echo oh-my-zsh git state:
(builtin cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]") (cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]")
if [[ $verbose -ge 1 ]]; then if [[ $verbose -ge 1 ]]; then
(builtin cd $ZSH && git reflog --date=default | command grep pull) (cd $ZSH && git reflog --date=default | command grep pull)
fi fi
builtin echo builtin echo
if [[ -e $ZSH_CUSTOM ]]; then if [[ -e $ZSH_CUSTOM ]]; then
local custom_dir=$ZSH_CUSTOM local custom_dir=$ZSH_CUSTOM
if [[ -h $custom_dir ]]; then if [[ -h $custom_dir ]]; then
custom_dir=$(builtin cd $custom_dir && pwd -P) custom_dir=$(cd $custom_dir && pwd -P)
fi fi
builtin echo "oh-my-zsh custom dir:" builtin echo "oh-my-zsh custom dir:"
builtin echo " $ZSH_CUSTOM ($custom_dir)" builtin echo " $ZSH_CUSTOM ($custom_dir)"
(builtin cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print) (cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print)
builtin echo builtin echo
fi fi

View File

@ -3,12 +3,11 @@ function zsh_stats() {
} }
function uninstall_oh_my_zsh() { function uninstall_oh_my_zsh() {
env ZSH="$ZSH" sh "$ZSH/tools/uninstall.sh" env ZSH=$ZSH sh $ZSH/tools/uninstall.sh
} }
function upgrade_oh_my_zsh() { function upgrade_oh_my_zsh() {
env ZSH="$ZSH" sh "$ZSH/tools/upgrade.sh" env ZSH=$ZSH sh $ZSH/tools/upgrade.sh
command rm -rf "$ZSH/log/update.lock"
} }
function take() { function take() {
@ -89,7 +88,7 @@ function default() {
# 0 if the env variable exists, 3 if it was set # 0 if the env variable exists, 3 if it was set
# #
function env_default() { function env_default() {
[[ ${parameters[$1]} = *-export* ]] && return 0 (( ${${(@f):-$(typeset +xg)}[(I)$1]} )) && return 0
export "$1=$2" && return 3 export "$1=$2" && return 3
} }

View File

@ -199,12 +199,3 @@ function git_current_user_name() {
function git_current_user_email() { function git_current_user_email() {
command git config user.email 2>/dev/null command git config user.email 2>/dev/null
} }
# Output the name of the root directory of the git repository
# Usage example: $(git_repo_name)
function git_repo_name() {
local repo_path
if repo_path="$(git rev-parse --show-toplevel 2>/dev/null)" && [[ -n "$repo_path" ]]; then
echo ${repo_path:t}
fi
}

View File

@ -1,41 +1,28 @@
__GREP_CACHE_FILE="$ZSH_CACHE_DIR"/grep-alias # is x grep argument available?
grep-flag-available() {
echo | grep $1 "" >/dev/null 2>&1
}
# See if there's a cache file modified in the last day GREP_OPTIONS=""
__GREP_ALIAS_CACHES=("$__GREP_CACHE_FILE"(Nm-1))
if [[ -n "$__GREP_ALIAS_CACHES" ]]; then
source "$__GREP_CACHE_FILE"
else
grep-flags-available() {
command grep "$@" "" &>/dev/null <<< ""
}
# Ignore these folders (if the necessary grep flags are available) # color grep results
EXC_FOLDERS="{.bzr,CVS,.git,.hg,.svn,.idea,.tox}" if grep-flag-available --color=auto; then
GREP_OPTIONS+=" --color=auto"
# Check for --exclude-dir, otherwise check for --exclude. If --exclude
# isn't available, --color won't be either (they were released at the same
# time (v2.5): https://git.savannah.gnu.org/cgit/grep.git/tree/NEWS?id=1236f007
if grep-flags-available --color=auto --exclude-dir=.cvs; then
GREP_OPTIONS="--color=auto --exclude-dir=$EXC_FOLDERS"
elif grep-flags-available --color=auto --exclude=.cvs; then
GREP_OPTIONS="--color=auto --exclude=$EXC_FOLDERS"
fi
if [[ -n "$GREP_OPTIONS" ]]; then
# export grep, egrep and fgrep settings
alias grep="grep $GREP_OPTIONS"
alias egrep="egrep $GREP_OPTIONS"
alias fgrep="fgrep $GREP_OPTIONS"
# write to cache file if cache directory is writable
if [[ -w "$ZSH_CACHE_DIR" ]]; then
alias -L grep egrep fgrep >| "$__GREP_CACHE_FILE"
fi
fi
# Clean up
unset GREP_OPTIONS EXC_FOLDERS
unfunction grep-flags-available
fi fi
unset __GREP_CACHE_FILE __GREP_ALIAS_CACHES # ignore VCS folders (if the necessary grep flags are available)
VCS_FOLDERS="{.bzr,CVS,.git,.hg,.svn}"
if grep-flag-available --exclude-dir=.cvs; then
GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS"
elif grep-flag-available --exclude=.cvs; then
GREP_OPTIONS+=" --exclude=$VCS_FOLDERS"
fi
# export grep settings
alias grep="grep $GREP_OPTIONS"
# clean up
unset GREP_OPTIONS
unset VCS_FOLDERS
unfunction grep-flag-available

View File

@ -27,8 +27,8 @@ esac
## History file configuration ## History file configuration
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history" [ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
[ "$HISTSIZE" -lt 50000 ] && HISTSIZE=50000 HISTSIZE=50000
[ "$SAVEHIST" -lt 10000 ] && SAVEHIST=10000 SAVEHIST=10000
## History command configuration ## History command configuration
setopt extended_history # record timestamp of command in HISTFILE setopt extended_history # record timestamp of command in HISTFILE
@ -36,4 +36,5 @@ setopt hist_expire_dups_first # delete duplicates first when HISTFILE size excee
setopt hist_ignore_dups # ignore duplicated commands history list setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it setopt hist_verify # show command with history expansion to user before running it
setopt inc_append_history # add commands to HISTFILE in order of execution
setopt share_history # share command history data setopt share_history # share command history data

View File

@ -3,15 +3,15 @@ autoload -Uz is-at-least
# *-magic is known buggy in some versions; disable if so # *-magic is known buggy in some versions; disable if so
if [[ $DISABLE_MAGIC_FUNCTIONS != true ]]; then if [[ $DISABLE_MAGIC_FUNCTIONS != true ]]; then
for d in $fpath; do for d in $fpath; do
if [[ -e "$d/url-quote-magic" ]]; then if [[ -e "$d/url-quote-magic" ]]; then
if is-at-least 5.1; then if is-at-least 5.1; then
autoload -Uz bracketed-paste-magic autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic zle -N bracketed-paste bracketed-paste-magic
fi fi
autoload -Uz url-quote-magic autoload -Uz url-quote-magic
zle -N self-insert url-quote-magic zle -N self-insert url-quote-magic
break break
fi fi
done done
fi fi
@ -25,7 +25,7 @@ env_default 'LESS' '-R'
alias _='sudo ' alias _='sudo '
## more intelligent acking for ubuntu users ## more intelligent acking for ubuntu users
if (( $+commands[ack-grep] )); then if which ack-grep &> /dev/null; then
alias afind='ack-grep -il' alias afind='ack-grep -il'
else else
alias afind='ack -il' alias afind='ack -il'

View File

@ -1,3 +1,4 @@
#! /bin/zsh
# A script to make using 256 colors in zsh less painful. # A script to make using 256 colors in zsh less painful.
# P.C. Shyamshankar <sykora@lucentbeing.com> # P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ # Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
@ -5,31 +6,32 @@
typeset -AHg FX FG BG typeset -AHg FX FG BG
FX=( FX=(
reset "%{%}" reset "%{%}"
bold "%{%}" no-bold "%{%}" bold "%{%}" no-bold "%{%}"
italic "%{%}" no-italic "%{%}" italic "%{%}" no-italic "%{%}"
underline "%{%}" no-underline "%{%}" underline "%{%}" no-underline "%{%}"
blink "%{%}" no-blink "%{%}" blink "%{%}" no-blink "%{%}"
reverse "%{%}" no-reverse "%{%}" reverse "%{%}" no-reverse "%{%}"
) )
for color in {000..255}; do for color in {000..255}; do
FG[$color]="%{[38;5;${color}m%}" FG[$color]="%{[38;5;${color}m%}"
BG[$color]="%{[48;5;${color}m%}" BG[$color]="%{[48;5;${color}m%}"
done done
ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
# Show all 256 colors with color number # Show all 256 colors with color number
function spectrum_ls() { function spectrum_ls() {
local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
for code in {000..255}; do for code in {000..255}; do
print -P -- "$code: $FG[$code]$ZSH_SPECTRUM_TEXT%{$reset_color%}" print -P -- "$code: %{$FG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"
done done
} }
# Show all 256 colors where the background is set to specific color # Show all 256 colors where the background is set to specific color
function spectrum_bls() { function spectrum_bls() {
local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
for code in {000..255}; do for code in {000..255}; do
print -P -- "$code: $BG[$code]$ZSH_SPECTRUM_TEXT%{$reset_color%}" print -P -- "$code: %{$BG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"
done done
} }

View File

@ -17,7 +17,7 @@ function title {
: ${2=$1} : ${2=$1}
case "$TERM" in case "$TERM" in
cygwin|xterm*|putty*|rxvt*|konsole*|ansi) cygwin|xterm*|putty*|rxvt*|ansi)
print -Pn "\e]2;$2:q\a" # set window name print -Pn "\e]2;$2:q\a" # set window name
print -Pn "\e]1;$1:q\a" # set tab name print -Pn "\e]1;$1:q\a" # set tab name
;; ;;
@ -32,10 +32,10 @@ function title {
# Try to use terminfo to set the title # Try to use terminfo to set the title
# If the feature is available set title # If the feature is available set title
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
echoti tsl echoti tsl
print -Pn "$1" print -Pn "$1"
echoti fsl echoti fsl
fi fi
fi fi
;; ;;
esac esac
@ -50,52 +50,22 @@ fi
# Runs before showing the prompt # Runs before showing the prompt
function omz_termsupport_precmd { function omz_termsupport_precmd {
[[ "$DISABLE_AUTO_TITLE" == true ]] && return emulate -L zsh
if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
return
fi
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
} }
# Runs before executing the command # Runs before executing the command
function omz_termsupport_preexec { function omz_termsupport_preexec {
[[ "$DISABLE_AUTO_TITLE" == true ]] && return
emulate -L zsh emulate -L zsh
setopt extended_glob setopt extended_glob
# split command into array of arguments if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
local -a cmdargs return
cmdargs=("${(z)2}")
# if running fg, extract the command from the job description
if [[ "${cmdargs[1]}" = fg ]]; then
# get the job id from the first argument passed to the fg command
local job_id jobspec="${cmdargs[2]#%}"
# logic based on jobs arguments:
# http://zsh.sourceforge.net/Doc/Release/Jobs-_0026-Signals.html#Jobs
# https://www.zsh.org/mla/users/2007/msg00704.html
case "$jobspec" in
<->) # %number argument:
# use the same <number> passed as an argument
job_id=${jobspec} ;;
""|%|+) # empty, %% or %+ argument:
# use the current job, which appears with a + in $jobstates:
# suspended:+:5071=suspended (tty output)
job_id=${(k)jobstates[(r)*:+:*]} ;;
-) # %- argument:
# use the previous job, which appears with a - in $jobstates:
# suspended:-:6493=suspended (signal)
job_id=${(k)jobstates[(r)*:-:*]} ;;
[?]*) # %?string argument:
# use $jobtexts to match for a job whose command *contains* <string>
job_id=${(k)jobtexts[(r)*${(Q)jobspec}*]} ;;
*) # %string argument:
# use $jobtexts to match for a job whose command *starts with* <string>
job_id=${(k)jobtexts[(r)${(Q)jobspec}*]} ;;
esac
# override preexec function arguments with job command
if [[ -n "${jobtexts[$job_id]}" ]]; then
1="${jobtexts[$job_id]}"
2="${jobtexts[$job_id]}"
fi
fi fi
# cmd name only, or if this is sudo or ssh, the next cmd # cmd name only, or if this is sudo or ssh, the next cmd
@ -121,13 +91,12 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
function update_terminalapp_cwd() { function update_terminalapp_cwd() {
emulate -L zsh emulate -L zsh
# Percent-encode the host and path names. # Percent-encode the pathname.
local URL_HOST URL_PATH local URL_PATH="$(omz_urlencode -P $PWD)"
URL_HOST="$(omz_urlencode -P $HOST)" || return 1 [[ $? != 0 ]] && return 1
URL_PATH="$(omz_urlencode -P $PWD)" || return 1
# Undocumented Terminal.app-specific control sequence # Undocumented Terminal.app-specific control sequence
printf '\e]7;%s\a' "file://$URL_HOST$URL_PATH" printf '\e]7;%s\a' "file://$HOST$URL_PATH"
} }
# Use a precmd hook instead of a chpwd hook to avoid contaminating output # Use a precmd hook instead of a chpwd hook to avoid contaminating output

View File

@ -4,6 +4,11 @@ if [[ -z "$ZSH_CACHE_DIR" ]]; then
ZSH_CACHE_DIR="$ZSH/cache" ZSH_CACHE_DIR="$ZSH/cache"
fi fi
# Migrate .zsh-update file to $ZSH_CACHE_DIR
if [ -f ~/.zsh-update ] && [ ! -f ${ZSH_CACHE_DIR}/.zsh-update ]; then
mv ~/.zsh-update ${ZSH_CACHE_DIR}/.zsh-update
fi
# Check for updates on initial load... # Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
env ZSH=$ZSH ZSH_CACHE_DIR=$ZSH_CACHE_DIR DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh env ZSH=$ZSH ZSH_CACHE_DIR=$ZSH_CACHE_DIR DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
@ -56,17 +61,6 @@ if [ -z "$ZSH_COMPDUMP" ]; then
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
fi fi
# Construct zcompdump OMZ metadata
zcompdump_revision="#omz revision: $(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)"
zcompdump_fpath="#omz fpath: $fpath"
# Delete the zcompdump file if OMZ zcompdump metadata changed
if ! command grep -q -Fx "$zcompdump_revision" "$ZSH_COMPDUMP" 2>/dev/null \
|| ! command grep -q -Fx "$zcompdump_fpath" "$ZSH_COMPDUMP" 2>/dev/null; then
command rm -f "$ZSH_COMPDUMP"
zcompdump_refresh=1
fi
if [[ $ZSH_DISABLE_COMPFIX != true ]]; then if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
source $ZSH/lib/compfix.zsh source $ZSH/lib/compfix.zsh
# If completion insecurities exist, warn the user # If completion insecurities exist, warn the user
@ -78,19 +72,6 @@ else
compinit -u -C -d "${ZSH_COMPDUMP}" compinit -u -C -d "${ZSH_COMPDUMP}"
fi fi
# Append zcompdump metadata if missing
if (( $zcompdump_refresh )); then
# Use `tee` in case the $ZSH_COMPDUMP filename is invalid, to silence the error
# See https://github.com/ohmyzsh/ohmyzsh/commit/dd1a7269#commitcomment-39003489
tee -a "$ZSH_COMPDUMP" &>/dev/null <<EOF
$zcompdump_revision
$zcompdump_fpath
EOF
fi
unset zcompdump_revision zcompdump_fpath zcompdump_refresh
# Load all of the config files in ~/oh-my-zsh that end in .zsh # Load all of the config files in ~/oh-my-zsh that end in .zsh
# TIP: Add files you don't want in git to .gitignore # TIP: Add files you don't want in git to .gitignore
@ -116,12 +97,25 @@ done
unset config_file unset config_file
# Load the theme # Load the theme
if [ ! "$ZSH_THEME" = "" ]; then if [[ "$ZSH_THEME" == "random" ]]; then
if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = "array" ]] && [[ "${#ZSH_THEME_RANDOM_CANDIDATES[@]}" -gt 0 ]]; then
source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDIDATES}.zsh-theme)
elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then
source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme"
else else
source "$ZSH/themes/$ZSH_THEME.zsh-theme" themes=($ZSH/themes/*zsh-theme)
fi
N=${#themes[@]}
((N=(RANDOM%N)+1))
RANDOM_THEME=${themes[$N]}
source "$RANDOM_THEME"
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
else
if [ ! "$ZSH_THEME" = "" ]; then
if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then
source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then
source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme"
else
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
fi
fi fi
fi fi

View File

@ -1,21 +1,19 @@
# apache2-macports plugin ## APACHE2 MACPORTS PLUGIN
Enables aliases to control a local Apache2 installed via [MacPorts](https://www.macports.org/).
To use it, add `apache2-macports` to the plugins array in your zshrc file: ---
```zsh ### FEATURES
plugins=(... apache2-macports)
```
## Aliases | Alias | Function | Description |
|:--------------:|:-------------------------------------------------------------------------------|----------------------:|
| apache2restart | sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart | Restart apache daemon |
| apache2start | sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start | Start apache daemon |
| apache2stop | sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop | Stop apache daemon |
| Alias | Function | Description | ---
|----------------|-----------------------------------------|-----------------------|
| apache2restart | `sudo /path/to/apache2.wrapper restart` | Restart apache daemon |
| apache2start | `sudo /path/to/apache2.wrapper start` | Start apache daemon |
| apache2stop | `sudo /path/to/apache2.wrapper stop` | Stop apache daemon |
## Contributors ### CONTRIBUTORS
- Alexander Rinass (alex@rinass.net)
- Alexander Rinass (alex@rinass.net) ---

View File

@ -1,41 +1,5 @@
## arcanist ## arcanist
**Maintainer:** [@emzar](https://github.com/emzar)
This plugin adds many useful aliases for [arcanist](https://github.com/phacility/arcanist). This plugin adds many useful aliases for [arcanist](https://github.com/phacility/arcanist).
To use it, add `arcanist` to the plugins array of your zshrc file:
```zsh
plugins=(... arcanist)
```
## Aliases
| Alias | Command |
| ------- | ---------------------------------- |
| ara | `arc amend` |
| arb | `arc branch` |
| arco | `arc cover` |
| arci | `arc commit` |
| ard | `arc diff` |
| ardc | `arc diff --create` |
| ardp | `arc diff --preview` |
| ardnu | `arc diff --nounit` |
| ardnupc | `arc diff --nounit --plan-changes` |
| ardpc | `arc diff --plan-changes` |
| are | `arc export` |
| arh | `arc help` |
| arl | `arc land` |
| arli | `arc lint` |
| arls | `arc list` |
| arpa | `arc patch` |
## Functions
The following functions make copy pasting revision ids from the URL bar of your browser
easier, as they allow for copy pasting the whole URL. For example: `ardu` accepts
both `https://arcanist-url.com/<REVISION>` as well as `<REVISION>`.
| Function | Command |
| ------------------------- | --------------------------------- |
| ardu [URL or revision_id] | `arc diff --update` [revision_id] |
| arpa [URL or revision_id] | `arc patch` [revision_id] |

View File

@ -9,29 +9,13 @@ alias arco='arc cover'
alias arci='arc commit' alias arci='arc commit'
alias ard='arc diff' alias ard='arc diff'
alias ardc='arc diff --create'
alias ardnu='arc diff --nounit' alias ardnu='arc diff --nounit'
alias ardnupc='arc diff --nounit --plan-changes' alias ardnupc='arc diff --nounit --plan-changes'
alias ardpc='arc diff --plan-changes' alias ardpc='arc diff --plan-changes'
alias ardp='arc diff --preview' # creates a new diff in the phab interface
alias are='arc export' alias are='arc export'
alias arh='arc help' alias arh='arc help'
alias arl='arc land' alias arl='arc land'
alias arli='arc lint' alias arli='arc lint'
alias arls='arc list' alias arls='arc list'
alias arpa='arc patch'
#
# Functions
# (sorted alphabetically)
#
ardu() {
# Both `ardu https://arcanist-url.com/<REVISION>`, and `ardu <REVISION>` work.
arc diff --update "${1:t}"
}
arpa() {
# Both `arpa https://arcanist-url.com/<REVISION>`, and `arpa <REVISION>` work.
arc patch "${1:t}"
}

View File

@ -1,13 +1,5 @@
# Archlinux plugin # Archlinux plugin
This plugin adds some aliases and functions to work with Arch Linux.
To use it, add `archlinux` to the plugins array in your zshrc file:
```zsh
plugins=(... archlinux)
```
## Features ## Features
#### YAY #### YAY
@ -127,7 +119,7 @@ plugins=(... archlinux)
| pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages | | pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages |
| upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages | | upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages |
| pacfileupg | sudo pacman -Fy | Download fresh package databases from the server | | pacfileupg | sudo pacman -Fy | Download fresh package databases from the server |
| pacfiles | pacman -F | Search package file names for matching strings | | pacfiles | pacman -Fs | Search package file names for matching strings |
| pacls | pacman -Ql | List files in a package | | pacls | pacman -Ql | List files in a package |
| pacown | pacman -Qo | Show which package owns a file | | pacown | pacman -Qo | Show which package owns a file |

View File

@ -149,7 +149,7 @@ alias pacmir='sudo pacman -Syy'
alias paclsorphans='sudo pacman -Qdt' alias paclsorphans='sudo pacman -Qdt'
alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
alias pacfileupg='sudo pacman -Fy' alias pacfileupg='sudo pacman -Fy'
alias pacfiles='pacman -F' alias pacfiles='pacman -Fs'
alias pacls='pacman -Ql' alias pacls='pacman -Ql'
alias pacown='pacman -Qo' alias pacown='pacman -Qo'
@ -208,7 +208,7 @@ function pacmansignkeys() {
if (( $+commands[xdg-open] )); then if (( $+commands[xdg-open] )); then
function pacweb() { function pacweb() {
pkg="$1" pkg="$1"
infos="$(LANG=C pacman -Si "$pkg")" infos="$(pacman -Si "$pkg")"
if [[ -z "$infos" ]]; then if [[ -z "$infos" ]]; then
return return
fi fi

View File

@ -3,7 +3,7 @@ ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
ASDF_COMPLETIONS="$ASDF_DIR/completions" ASDF_COMPLETIONS="$ASDF_DIR/completions"
# If not found, check for Homebrew package # If not found, check for Homebrew package
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && (( $+commands[brew] )); then if [[ ! -f "$ASDF_DIR/asdf.sh" ]] && (( $+commands[brew] )); then
ASDF_DIR="$(brew --prefix asdf)" ASDF_DIR="$(brew --prefix asdf)"
ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d" ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d"
fi fi

View File

@ -7,14 +7,8 @@ To use it, add `autoenv` to the plugins array in your zshrc file:
```zsh ```zsh
plugins=(... autoenv) plugins=(... autoenv)
``` ```
## Functions
* `use_env()`: creates and/or activates a virtualenv. For use in `.env` files.
See the source code for details.
## Requirements ## Requirements
In order to make this work, you will need to have the autoenv installed. In order to make this work, you will need to have the autoenv installed.
More info on the usage and install at [the project's homepage](https://github.com/inishchith/autoenv). More info on the usage and install: https://github.com/inishchith/autoenv

View File

@ -1,39 +1,12 @@
# Initialization: activate autoenv or report its absence # Activates autoenv or reports its failure
() { () {
local d autoenv_dir install_locations
if ! type autoenv_init >/dev/null; then if ! type autoenv_init >/dev/null; then
# Check if activate.sh is in $PATH for d (~/.autoenv ~/.local/bin /usr/local/opt/autoenv /usr/local/bin); do
if (( $+commands[activate.sh] )); then
autoenv_dir="${commands[activate.sh]:h}"
fi
# Locate autoenv installation
if [[ -z $autoenv_dir ]]; then
install_locations=(
~/.autoenv
~/.local/bin
/usr/local/opt/autoenv
/usr/local/bin
/usr/share/autoenv-git
~/Library/Python/bin
)
for d ( $install_locations ); do
if [[ -e $d/activate.sh ]]; then
autoenv_dir=$d
break
fi
done
fi
# Look for Homebrew path as a last resort
if [[ -z "$autoenv_dir" ]] && (( $+commands[brew] )); then
d=$(brew --prefix)/opt/autoenv
if [[ -e $d/activate.sh ]]; then if [[ -e $d/activate.sh ]]; then
autoenv_dir=$d autoenv_dir=$d
break
fi fi
fi done
# Complain if autoenv is not installed
if [[ -z $autoenv_dir ]]; then if [[ -z $autoenv_dir ]]; then
cat <<END >&2 cat <<END >&2
-------- AUTOENV --------- -------- AUTOENV ---------
@ -44,7 +17,6 @@ In the meantime the autoenv plugin is DISABLED.
END END
return 1 return 1
fi fi
# Load autoenv
source $autoenv_dir/activate.sh source $autoenv_dir/activate.sh
fi fi
} }
@ -55,17 +27,17 @@ fi
# It only performs an action if the requested virtualenv is not the current one. # It only performs an action if the requested virtualenv is not the current one.
use_env() { use_env() {
local venv typeset venv
venv="$1" venv="$1"
if [[ "${VIRTUAL_ENV:t}" != "$venv" ]]; then if [[ "${VIRTUAL_ENV:t}" != "$venv" ]]; then
if workon | grep -q "$venv"; then if workon | grep -q "$venv"; then
workon "$venv" workon "$venv"
else else
echo -n "Create virtualenv $venv now? (Yn) " echo -n "Create virtualenv $venv now? (Yn) "
read answer read answer
if [[ "$answer" == "Y" ]]; then if [[ "$answer" == "Y" ]]; then
mkvirtualenv "$venv" mkvirtualenv "$venv"
fi fi
fi
fi fi
fi
} }

View File

@ -8,4 +8,4 @@ To use it, add `autojump` to the plugins array in your zshrc file:
plugins=(... autojump) plugins=(... autojump)
``` ```
**Note:** you have to [install autojump](https://github.com/wting/autojump#installation) first. More info on the usage: https://github.com/wting/autojump

View File

@ -29,6 +29,6 @@ if (( ! found && $+commands[brew] )); then
fi fi
fi fi
(( ! found )) && echo '[oh-my-zsh] autojump not found. Please install it first.' (( ! found )) && echo '[oh-my-zsh] autojump script not found'
unset autojump_paths file found unset autojump_paths file found

View File

@ -31,12 +31,12 @@ function aws_change_access_key() {
echo Insert the credentials when asked. echo Insert the credentials when asked.
asp "$1" || return 1 asp "$1" || return 1
AWS_PAGER="" aws iam create-access-key aws iam create-access-key
AWS_PAGER="" aws configure --profile "$1" aws configure --profile "$1"
echo You can now safely delete the old access key running \`aws iam delete-access-key --access-key-id ID\` echo You can now safely delete the old access key running \`aws iam delete-access-key --access-key-id ID\`
echo Your current keys are: echo Your current keys are:
AWS_PAGER="" aws iam list-access-keys aws iam list-access-keys
} }
function aws_profiles() { function aws_profiles() {
@ -62,45 +62,36 @@ fi
# Load awscli completions # Load awscli completions
# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back function _awscli-homebrew-installed() {
if [[ -x /usr/local/bin/aws_completer ]]; then # check if Homebrew is installed
autoload -Uz bashcompinit && bashcompinit (( $+commands[brew] )) || return 1
complete -C aws_completer aws
else
function _awscli-homebrew-installed() {
# check if Homebrew is installed
(( $+commands[brew] )) || return 1
# speculatively check default brew prefix # speculatively check default brew prefix
if [ -h /usr/local/opt/awscli ]; then if [ -h /usr/local/opt/awscli ]; then
_brew_prefix=/usr/local/opt/awscli _brew_prefix=/usr/local/opt/awscli
else else
# ok, it is not in the default prefix # ok, it is not in the default prefix
# this call to brew is expensive (about 400 ms), so at least let's make it only once # this call to brew is expensive (about 400 ms), so at least let's make it only once
_brew_prefix=$(brew --prefix awscli) _brew_prefix=$(brew --prefix awscli)
fi
}
# get aws_zsh_completer.sh location from $PATH
_aws_zsh_completer_path="$commands[aws_zsh_completer.sh]"
# otherwise check common locations
if [[ -z $_aws_zsh_completer_path ]]; then
# Homebrew
if _awscli-homebrew-installed; then
_aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
# Ubuntu
elif [[ -e /usr/share/zsh/vendor-completions/_awscli ]]; then
_aws_zsh_completer_path=/usr/share/zsh/vendor-completions/_awscli
# NixOS
elif [[ -e "${commands[aws]:P:h:h}/share/zsh/site-functions/aws_zsh_completer.sh" ]]; then
_aws_zsh_completer_path="${commands[aws]:P:h:h}/share/zsh/site-functions/aws_zsh_completer.sh"
# RPM
else
_aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh
fi
fi fi
}
[[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path # get aws_zsh_completer.sh location from $PATH
unset _aws_zsh_completer_path _brew_prefix _aws_zsh_completer_path="$commands[aws_zsh_completer.sh]"
# otherwise check common locations
if [[ -z $_aws_zsh_completer_path ]]; then
# Homebrew
if _awscli-homebrew-installed; then
_aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
# Ubuntu
elif [[ -e /usr/share/zsh/vendor-completions/_awscli ]]; then
_aws_zsh_completer_path=/usr/share/zsh/vendor-completions/_awscli
# RPM
else
_aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh
fi
fi fi
[[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path
unset _aws_zsh_completer_path _brew_prefix

View File

@ -11,21 +11,22 @@
# Modified to add support for FreeBSD # # Modified to add support for FreeBSD #
########################################### ###########################################
if [[ "$OSTYPE" = darwin* ]]; then if [[ "$OSTYPE" = darwin* ]] ; then
function battery_is_charging() {
ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ Yes'
}
function battery_pct() { function battery_pct() {
local battery_status="$(ioreg -rc AppleSmartBattery)" local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
local -i capacity=$(sed -n -e '/MaxCapacity/s/^.*"MaxCapacity"\ =\ //p' <<< $battery_status) typeset -F maxcapacity=$(echo $smart_battery_status | grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //')
local -i current=$(sed -n -e '/CurrentCapacity/s/^.*"CurrentCapacity"\ =\ //p' <<< $battery_status) typeset -F currentcapacity=$(echo $smart_battery_status | grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //')
echo $(( current * 100 / capacity )) integer i=$(((currentcapacity/maxcapacity) * 100))
echo $i
}
function plugged_in() {
[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ Yes') -eq 1 ]
} }
function battery_pct_remaining() { function battery_pct_remaining() {
if battery_is_charging; then if plugged_in ; then
echo "External Power" echo "External Power"
else else
battery_pct battery_pct
@ -34,9 +35,9 @@ if [[ "$OSTYPE" = darwin* ]]; then
function battery_time_remaining() { function battery_time_remaining() {
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")" local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
if [[ $(echo $smart_battery_status | command grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]]; then if [[ $(echo $smart_battery_status | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
timeremaining=$(echo $smart_battery_status | command grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //') timeremaining=$(echo $smart_battery_status | grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
if [ $timeremaining -gt 720 ]; then if [ $timeremaining -gt 720 ] ; then
echo "::" echo "::"
else else
echo "~$((timeremaining / 60)):$((timeremaining % 60))" echo "~$((timeremaining / 60)):$((timeremaining % 60))"
@ -47,36 +48,39 @@ if [[ "$OSTYPE" = darwin* ]]; then
} }
function battery_pct_prompt () { function battery_pct_prompt () {
local battery_pct color if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ No'; then b=$(battery_pct_remaining)
battery_pct=$(battery_pct_remaining) if [ $b -gt 50 ] ; then
if [[ $battery_pct -gt 50 ]]; then
color='green' color='green'
elif [[ $battery_pct -gt 20 ]]; then elif [ $b -gt 20 ] ; then
color='yellow' color='yellow'
else else
color='red' color='red'
fi fi
echo "%{$fg[$color]%}[${battery_pct}%%]%{$reset_color%}" echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
else else
echo "∞" echo "∞"
fi fi
} }
elif [[ "$OSTYPE" = freebsd* ]]; then function battery_is_charging() {
[[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]]
}
elif [[ "$OSTYPE" = freebsd* ]] ; then
function battery_is_charging() { function battery_is_charging() {
[[ $(sysctl -n hw.acpi.battery.state) -eq 2 ]] [[ $(sysctl -n hw.acpi.battery.state) -eq 2 ]]
} }
function battery_pct() { function battery_pct() {
if (( $+commands[sysctl] )); then if (( $+commands[sysctl] )) ; then
sysctl -n hw.acpi.battery.life echo "$(sysctl -n hw.acpi.battery.life)"
fi fi
} }
function battery_pct_remaining() { function battery_pct_remaining() {
if ! battery_is_charging; then if [ ! $(battery_is_charging) ] ; then
battery_pct battery_pct
else else
echo "External Power" echo "External Power"
@ -84,46 +88,45 @@ elif [[ "$OSTYPE" = freebsd* ]]; then
} }
function battery_time_remaining() { function battery_time_remaining() {
local remaining_time
remaining_time=$(sysctl -n hw.acpi.battery.time) remaining_time=$(sysctl -n hw.acpi.battery.time)
if [[ $remaining_time -ge 0 ]]; then if [[ $remaining_time -ge 0 ]] ; then
((hour = $remaining_time / 60 )) # calculation from https://www.unix.com/shell-programming-and-scripting/23695-convert-minutes-hours-minutes-seconds.html
((minute = $remaining_time % 60 )) ((hour=$remaining_time/60))
printf %02d:%02d $hour $minute ((minute=$remaining_time-$hour*60))
echo $hour:$minute
fi fi
} }
function battery_pct_prompt() { function battery_pct_prompt() {
local battery_pct color b=$(battery_pct_remaining)
battery_pct=$(battery_pct_remaining) if [ ! $(battery_is_charging) ] ; then
if battery_is_charging; then if [ $b -gt 50 ] ; then
echo "∞"
else
if [[ $battery_pct -gt 50 ]]; then
color='green' color='green'
elif [[ $battery_pct -gt 20 ]]; then elif [ $b -gt 20 ] ; then
color='yellow' color='yellow'
else else
color='red' color='red'
fi fi
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}" echo "%{$fg[$color]%}$(battery_pct_remaining)%%%{$reset_color%}"
else
echo "∞"
fi fi
} }
elif [[ "$OSTYPE" = linux* ]]; then elif [[ "$OSTYPE" = linux* ]] ; then
function battery_is_charging() { function battery_is_charging() {
! acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -q '^Battery.*Discharging' ! [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]]
} }
function battery_pct() { function battery_pct() {
if (( $+commands[acpi] )); then if (( $+commands[acpi] )) ; then
acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -E '^Battery.*(Full|(Disc|C)harging)' | cut -f2 -d ',' | tr -cd '[:digit:]' echo "$(acpi 2>/dev/null | cut -f2 -d ',' | tr -cd '[:digit:]')"
fi fi
} }
function battery_pct_remaining() { function battery_pct_remaining() {
if ! battery_is_charging; then if [ ! $(battery_is_charging) ] ; then
battery_pct battery_pct
else else
echo "External Power" echo "External Power"
@ -131,81 +134,76 @@ elif [[ "$OSTYPE" = linux* ]]; then
} }
function battery_time_remaining() { function battery_time_remaining() {
if ! battery_is_charging; then if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
acpi 2>/dev/null | command grep -v "rate information unavailable" | cut -f3 -d ',' echo $(acpi 2>/dev/null | cut -f3 -d ',')
fi fi
} }
function battery_pct_prompt() { function battery_pct_prompt() {
local battery_pct color b=$(battery_pct_remaining)
battery_pct=$(battery_pct_remaining) if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
if battery_is_charging; then if [ $b -gt 50 ] ; then
echo "∞"
else
if [[ $battery_pct -gt 50 ]]; then
color='green' color='green'
elif [[ $battery_pct -gt 20 ]]; then elif [ $b -gt 20 ] ; then
color='yellow' color='yellow'
else else
color='red' color='red'
fi fi
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}" echo "%{$fg[$color]%}$(battery_pct_remaining)%%%{$reset_color%}"
else
echo "∞"
fi fi
} }
else else
# Empty functions so we don't cause errors in prompts # Empty functions so we don't cause errors in prompts
function battery_is_charging { false } function battery_pct_remaining() {
function battery_pct \ }
battery_pct_remaining \
battery_time_remaining \ function battery_time_remaining() {
battery_pct_prompt { } }
function battery_pct_prompt() {
}
fi fi
function battery_level_gauge() { function battery_level_gauge() {
local gauge_slots=${BATTERY_GAUGE_SLOTS:-10} local gauge_slots=${BATTERY_GAUGE_SLOTS:-10};
local green_threshold=${BATTERY_GREEN_THRESHOLD:-$(( gauge_slots * 0.6 ))} local green_threshold=${BATTERY_GREEN_THRESHOLD:-6};
local yellow_threshold=${BATTERY_YELLOW_THRESHOLD:-$(( gauge_slots * 0.4 ))} local yellow_threshold=${BATTERY_YELLOW_THRESHOLD:-4};
local color_green=${BATTERY_COLOR_GREEN:-%F{green}} local color_green=${BATTERY_COLOR_GREEN:-%F{green}};
local color_yellow=${BATTERY_COLOR_YELLOW:-%F{yellow}} local color_yellow=${BATTERY_COLOR_YELLOW:-%F{yellow}};
local color_red=${BATTERY_COLOR_RED:-%F{red}} local color_red=${BATTERY_COLOR_RED:-%F{red}};
local color_reset=${BATTERY_COLOR_RESET:-%{%f%k%b%}} local color_reset=${BATTERY_COLOR_RESET:-%{%f%k%b%}};
local battery_prefix=${BATTERY_GAUGE_PREFIX:-'['} local battery_prefix=${BATTERY_GAUGE_PREFIX:-'['};
local battery_suffix=${BATTERY_GAUGE_SUFFIX:-']'} local battery_suffix=${BATTERY_GAUGE_SUFFIX:-']'};
local filled_symbol=${BATTERY_GAUGE_FILLED_SYMBOL:-'▶'} local filled_symbol=${BATTERY_GAUGE_FILLED_SYMBOL:-'▶'};
local empty_symbol=${BATTERY_GAUGE_EMPTY_SYMBOL:-'▷'} local empty_symbol=${BATTERY_GAUGE_EMPTY_SYMBOL:-'▷'};
local charging_color=${BATTERY_CHARGING_COLOR:-$color_yellow} local charging_color=${BATTERY_CHARGING_COLOR:-$color_yellow};
local charging_symbol=${BATTERY_CHARGING_SYMBOL:-'⚡'} local charging_symbol=${BATTERY_CHARGING_SYMBOL:-'⚡'};
local battery_remaining_percentage=$(battery_pct) local battery_remaining_percentage=$(battery_pct);
local filled empty gauge_color
if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then
filled=$(( ($battery_remaining_percentage * $gauge_slots) / 100 )) local filled=$(((( $battery_remaining_percentage + $gauge_slots - 1) / $gauge_slots)));
empty=$(( $gauge_slots - $filled )) local empty=$(($gauge_slots - $filled));
if [[ $filled -gt $green_threshold ]]; then if [[ $filled -gt $green_threshold ]]; then local gauge_color=$color_green;
gauge_color=$color_green elif [[ $filled -gt $yellow_threshold ]]; then local gauge_color=$color_yellow;
elif [[ $filled -gt $yellow_threshold ]]; then else local gauge_color=$color_red;
gauge_color=$color_yellow
else
gauge_color=$color_red
fi fi
else else
filled=$gauge_slots local filled=$gauge_slots;
empty=0 local empty=0;
filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'} filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'};
fi fi
local charging=' ' local charging=' ' && battery_is_charging && charging=$charging_symbol;
battery_is_charging && charging=$charging_symbol
# Charging status and prefix printf ${charging_color//\%/\%\%}$charging${color_reset//\%/\%\%}${battery_prefix//\%/\%\%}${gauge_color//\%/\%\%}
print -n ${charging_color}${charging}${color_reset}${battery_prefix}${gauge_color} printf ${filled_symbol//\%/\%\%}'%.0s' {1..$filled}
# Filled slots
[[ $filled -gt 0 ]] && printf ${filled_symbol//\%/\%\%}'%.0s' {1..$filled}
# Empty slots
[[ $filled -lt $gauge_slots ]] && printf ${empty_symbol//\%/\%\%}'%.0s' {1..$empty} [[ $filled -lt $gauge_slots ]] && printf ${empty_symbol//\%/\%\%}'%.0s' {1..$empty}
# Suffix printf ${color_reset//\%/\%\%}${battery_suffix//\%/\%\%}${color_reset//\%/\%\%}
print -n ${color_reset}${battery_suffix}${color_reset}
} }

View File

@ -4,7 +4,7 @@ This plugin adds completion for [Bower](https://bower.io/) and a few useful alia
To use it, add `bower` to the plugins array in your zshrc file: To use it, add `bower` to the plugins array in your zshrc file:
```zsh ```
plugins=(... bower) plugins=(... bower)
``` ```
@ -15,3 +15,4 @@ plugins=(... bower)
| bi | `bower install` | Installs the project dependencies listed in bower.json | | bi | `bower install` | Installs the project dependencies listed in bower.json |
| bl | `bower list` | List local packages and possible updates | | bl | `bower list` | List local packages and possible updates |
| bs | `bower search` | Finds all packages or a specific package. | | bs | `bower search` | Finds all packages or a specific package. |

View File

@ -3,27 +3,19 @@
The plugin adds several aliases for common [brew](https://brew.sh) commands. The plugin adds several aliases for common [brew](https://brew.sh) commands.
To use it, add `brew` to the plugins array of your zshrc file: To use it, add `brew` to the plugins array of your zshrc file:
```
```zsh
plugins=(... brew) plugins=(... brew)
``` ```
## Aliases ## Aliases
| Alias | Command | Description | | Alias | Command | Description |
|----------|-------------------------------------------------------------|---------------------------------------------------------------------| |--------|----------------------|---------------|
| `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. | | brewp | `brew pin` | Pin a specified formulae, preventing them from being upgraded when issuing the brew upgrade <formulae> command. |
| `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. | | brews | `brew list -1` | List installed formulae, one entry per line, or the installed files for a given formulae. |
| `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. | | brewsp | `brew list --pinned` | Show the versions of pinned formulae, or only the specified (pinned) formulae if formulae are given. |
| `bubo` | `brew update && brew outdated` | Update Homebrew and all formulae, then list outdated formulae. | | bubo | `brew update && brew outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated formulae. |
| `bubc` | `brew upgrade && brew cleanup` | Upgrade outdated formulae, then run cleanup. | | bubc | `brew upgrade && brew cleanup` | Upgrade outdated, unpinned brews (with existing install options), then removes stale lock files and outdated downloads for formulae and casks, and removes old versions of installed formulae. |
| `bubu` | `bubo && bubc` | Do the last two operations above. | | bubu | `bubo && bubc` | Updates Homebrew, lists outdated formulae, upgrades oudated and unpinned formulae, and removes stale and outdated downloads and versions. |
| `bcubo` | `brew update && brew cask outdated` | Update Homebrew and alll formulae, then list outdated casks. | | bcubo | `brew update && brew cask outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated casks. |
| `bcubc` | `brew cask reinstall $(brew cask outdated) && brew cleanup` | Update outdated casks, then run cleanup. | | bcubc | `brew cask reinstall $(brew cask outdated) && brew cleanup` | Updates outdated casks, then runs cleanup. |
## Completion
With the release of Homebrew 1.0, they decided to bundle the zsh completion as part of the
brew installation, so we no longer ship it with the brew plugin; now it only has brew
aliases. If you find that brew completion no longer works, make sure you have your Homebrew
installation fully up to date.

View File

@ -6,3 +6,19 @@ alias bubc='brew upgrade && brew cleanup'
alias bubu='bubo && bubc' alias bubu='bubo && bubc'
alias bcubo='brew update && brew cask outdated' alias bcubo='brew update && brew cask outdated'
alias bcubc='brew cask reinstall $(brew cask outdated) && brew cleanup' alias bcubc='brew cask reinstall $(brew cask outdated) && brew cleanup'
if command mkdir "$ZSH_CACHE_DIR/.brew-completion-message" 2>/dev/null; then
print -P '%F{yellow}'Oh My Zsh brew plugin:
cat <<-'EOF'
With the advent of their 1.0 release, Homebrew has decided to bundle
the zsh completion as part of the brew installation, so we no longer
ship it with the brew plugin; now it only has brew aliases.
If you find that brew completion no longer works, make sure you have
your Homebrew installation fully up to date.
You will only see this message once.
EOF
print -P '%f'
fi

View File

@ -1,9 +1,7 @@
# Bundler # Bundler
- Adds completion for basic bundler commands - adds completion for basic bundler commands
- adds short aliases for common bundler commands
- Adds short aliases for common bundler commands
- `ba` aliased to `bundle add`
- `be` aliased to `bundle exec`. - `be` aliased to `bundle exec`.
It also supports aliases (if `rs` is `rails server`, `be rs` will bundle-exec `rails server`). It also supports aliases (if `rs` is `rails server`, `be rs` will bundle-exec `rails server`).
- `bl` aliased to `bundle list` - `bl` aliased to `bundle list`
@ -12,12 +10,9 @@
- `bout` aliased to `bundle outdated` - `bout` aliased to `bundle outdated`
- `bu` aliased to `bundle update` - `bu` aliased to `bundle update`
- `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`) - `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`)
- `bcn` aliased to `bundle clean` - adds a wrapper for common gems:
- `bck` aliased to `bundle check` - looks for a binstub under `./bin/` and executes it (if present)
- calls `bundle exec <gem executable>` otherwise
- Adds a wrapper for common gems:
- Looks for a binstub under `./bin/` and executes it (if present)
- Calls `bundle exec <gem executable>` otherwise
Common gems wrapped by default (by name of the executable): Common gems wrapped by default (by name of the executable):
`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `rubocop`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`. `annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `rubocop`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`.
@ -29,24 +24,20 @@ Please use the exact name of the executable and not the gem name.
### Add additional gems to be wrapped ### Add additional gems to be wrapped
Add this before the plugin-list in your `.zshrc`: Add this before the plugin-list in your `.zshrc`:
```sh ```sh
BUNDLED_COMMANDS=(rubocop) BUNDLED_COMMANDS=(rubocop)
plugins=(... bundler ...) plugins=(... bundler ...)
``` ```
This will add the wrapper for the `rubocop` gem (i.e. the executable). This will add the wrapper for the `rubocop` gem (i.e. the executable).
### Exclude gems from being wrapped ### Exclude gems from being wrapped
Add this before the plugin-list in your `.zshrc`: Add this before the plugin-list in your `.zshrc`:
```sh ```sh
UNBUNDLED_COMMANDS=(foreman spin) UNBUNDLED_COMMANDS=(foreman spin)
plugins=(... bundler ...) plugins=(... bundler ...)
``` ```
This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped. This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped.
## Excluded gems ## Excluded gems

View File

@ -1,4 +1,3 @@
alias ba="bundle add"
alias be="bundle exec" alias be="bundle exec"
alias bl="bundle list" alias bl="bundle list"
alias bp="bundle package" alias bp="bundle package"
@ -7,7 +6,6 @@ alias bout="bundle outdated"
alias bu="bundle update" alias bu="bundle update"
alias bi="bundle_install" alias bi="bundle_install"
alias bcn="bundle clean" alias bcn="bundle clean"
alias bck="bundle check"
bundled_commands=( bundled_commands=(
annotate annotate

View File

@ -10,6 +10,6 @@ plugins=(... cake)
## Note ## Note
This plugin generates a cache file of the cake tasks found, named `.cake_task_cache`, in the current working directory. This plugin generates a cache file of the cake tasks found, named `.cake_task_cache`, in the current working directory.
It is regenerated when the Cakefile is newer than the cache file. It is advised that you add the cake file to your It is regenerated when the Cakefile is newer than the cache file. It is advised that you add the cake file to your
`.gitignore` files. `.gitignore` files.

View File

@ -2,16 +2,28 @@
Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/catimg) Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
To use it, add `catimg` to the plugins array in your zshrc file:
```zsh
plugins=(... catimg)
```
## Requirements ## Requirements
- `convert` (ImageMagick) - `convert` (ImageMagick)
## Enabling the plugin
1. Open your `.zshrc` file and add `catimg` in the plugins section:
```zsh
plugins=(
# all your enabled plugins
catimg
)
```
2. Restart the shell or restart your Terminal session:
```console
$ exec zsh
$
```
## Functions ## Functions
| Function | Description | | Function | Description |

View File

@ -1,6 +1,6 @@
# chucknorris # chucknorris
Chuck Norris fortunes plugin for oh-my-zsh. Perfectly suitable as MOTD. Chuck Norris fortunes plugin for oh-my-zsh
**Maintainers**: [apjanke](https://github.com/apjanke) [maff](https://github.com/maff) **Maintainers**: [apjanke](https://github.com/apjanke) [maff](https://github.com/maff)
@ -10,31 +10,11 @@ To use it add `chucknorris` to the plugins array in you zshrc file.
plugins=(... chucknorris) plugins=(... chucknorris)
``` ```
## Usage
Depends on fortune (and cowsay if using chuck_cow) being installed (available via homebrew, apt, ...). Perfectly suitable as MOTD.
| Command | Description | | Command | Description |
| ----------- | ------------------------------- | | ----------- | ------------------------------- |
| `chuck` | Print random Chuck Norris quote | | `chuck` | Print random Chuck Norris quote |
| `chuck_cow` | Print quote in cowthink | | `chuck_cow` | Print quote in cowthink |
Example: output of `chuck_cow`:
```
Last login: Fri Jan 30 23:12:26 on ttys001
______________________________________
( When Chuck Norris plays Monopoly, it )
( affects the actual world economy. )
--------------------------------------
o ^__^
o (oo)\_______
(__)\ )\/\
||----w |
|| ||
```
## Requirements
- `fortune`
- `cowsay` if using `chuck_cow`
Available via homebrew, apt, ...

File diff suppressed because it is too large Load Diff

View File

@ -4,8 +4,8 @@
To use it, add `cloudapp` to the plugins array of your `~/.zshrc` file: To use it, add `cloudapp` to the plugins array of your `~/.zshrc` file:
```zsh ```
plugins=(... cloudapp) plugins=(... dash)
``` ```
## Requirements ## Requirements

View File

@ -1,4 +1,4 @@
# Coffeescript Plugin ## Coffeescript Plugin
This plugin provides aliases for quickly compiling and previewing your This plugin provides aliases for quickly compiling and previewing your
coffeescript code. coffeescript code.

View File

@ -8,9 +8,6 @@ To use it, add `colored-man-pages` to the plugins array in your zshrc file:
plugins=(... colored-man-pages) plugins=(... colored-man-pages)
``` ```
It will also automatically colorize man pages displayed by `dman` or `debman`,
from [`debian-goodies`](https://packages.debian.org/stable/debian-goodies).
You can also try to color other pages by prefixing the respective command with `colored`: You can also try to color other pages by prefixing the respective command with `colored`:
```zsh ```zsh

View File

@ -31,9 +31,6 @@ function colored() {
"$@" "$@"
} }
# Colorize man and dman/debman (from debian-goodies) function man() {
function man \ colored man "$@"
dman \
debman {
colored $0 "$@"
} }

View File

@ -26,8 +26,10 @@ fi
# OSX command-not-found support # OSX command-not-found support
# https://github.com/Homebrew/homebrew-command-not-found # https://github.com/Homebrew/homebrew-command-not-found
if [[ -s '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh' ]]; then if type brew &> /dev/null; then
source '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh' if brew command command-not-found-init > /dev/null 2>&1; then
eval "$(brew command-not-found-init)";
fi
fi fi
# NixOS command-not-found support # NixOS command-not-found support

View File

@ -13,7 +13,7 @@ alias lS='ls -1FSsh'
alias lart='ls -1Fcart' alias lart='ls -1Fcart'
alias lrt='ls -1Fcrt' alias lrt='ls -1Fcrt'
alias zshrc='${=EDITOR} ${ZDOTDIR:-$HOME}/.zshrc' # Quick access to the .zshrc file alias zshrc='${=EDITOR} ~/.zshrc' # Quick access to the ~/.zshrc file
alias grep='grep --color' alias grep='grep --color'
alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} ' alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
@ -50,7 +50,6 @@ alias mv='mv -i'
# zsh is able to auto-do some kungfoo # zsh is able to auto-do some kungfoo
# depends on the SUFFIX :) # depends on the SUFFIX :)
autoload -Uz is-at-least
if is-at-least 4.2.0; then if is-at-least 4.2.0; then
# open browser on urls # open browser on urls
if [[ -n "$BROWSER" ]]; then if [[ -n "$BROWSER" ]]; then

View File

@ -3,7 +3,6 @@
This plugin looks for [compleat](https://github.com/mbrubeck/compleat) and loads its completion. This plugin looks for [compleat](https://github.com/mbrubeck/compleat) and loads its completion.
To use it, add compleat to the plugins array in your zshrc file: To use it, add compleat to the plugins array in your zshrc file:
```
```zsh
plugins=(... compleat) plugins=(... compleat)
``` ```

View File

@ -12,20 +12,18 @@ plugins=(... composer)
## Aliases ## Aliases
| Alias | Command | Description | | Alias | Command | Description |
| ------ | ------------------------------------------- | --------------------------------------------------------------------------------------- | | ------ | -------------------------------------------- | -------------------------------------------------------------------------------------- |
| `c` | `composer` | Starts composer | | `c` | composer | Starts composer |
| `csu` | `composer self-update` | Updates composer to the latest version | | `csu` | composer self-update | Updates composer to the latest version |
| `cu` | `composer update` | Updates composer dependencies and `composer.lock` file | | `cu` | composer update | Updates composer dependencies and `composer.lock` file |
| `cr` | `composer require` | Adds new packages to `composer.json` | | `cr` | composer require | Adds new packages to `composer.json` |
| `crm` | `composer remove` | Removes packages from `composer.json` | | `crm` | composer remove | Removes packages from `composer.json` |
| `ci` | `composer install` | Resolves and installs dependencies from `composer.json` | | `ci` | composer install | Resolves and installs dependencies from `composer.json` |
| `ccp` | `composer create-project` | Create new project from an existing package | | `ccp` | composer create-project | Create new project from an existing package |
| `cdu` | `composer dump-autoload` | Updates the autoloader | | `cdu` | composer dump-autoload | Updates the autoloader |
| `cdo` | `composer dump-autoload -o` | Converts PSR-0/4 autoloading to classmap for a faster autoloader (good for production) | | `cdo` | composer dump-autoload --optimize-autoloader | Converts PSR-0/4 autoloading to classmap for a faster autoloader (good for production) |
| `cgu` | `composer global update` | Allows update command to run on COMPOSER_HOME directory | | `cgu` | composer global update | Allows update command to run on COMPOSER_HOME directory |
| `cgr` | `composer global require` | Allows require command to run on COMPOSER_HOME directory | | `cgr` | composer global require | Allows require command to run on COMPOSER_HOME directory |
| `cgrm` | `composer global remove` | Allows remove command to run on COMPOSER_HOME directory | | `cgrm` | composer global remove | Allows remove command to run on COMPOSER_HOME directory |
| `cget` | `curl -s https://getcomposer.org/installer` | Installs composer in the current directory | | `cget` | `curl -s https://getcomposer.org/installer` | Installs composer in the current directory |
| `co` | `composer outdated` | Shows a list of installed packages with available updates |
| `cod` | `composer outdated --direct` | Shows a list of installed packages with available updates which are direct dependencies |

View File

@ -15,16 +15,20 @@ _composer_get_required_list () {
} }
_composer () { _composer () {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments \ _arguments \
'*:: :->subcmds' '1: :->command'\
'*: :->args'
if (( CURRENT == 1 )) || ( ((CURRENT == 2)) && [ "$words[1]" = "global" ] ) ; then case $state in
compadd $(_composer_get_command_list) command)
else compadd $(_composer_get_command_list)
compadd $(_composer_get_required_list) ;;
fi *)
compadd $(_composer_get_required_list)
;;
esac
} }
compdef _composer composer compdef _composer composer
@ -39,29 +43,17 @@ alias crm='composer remove'
alias ci='composer install' alias ci='composer install'
alias ccp='composer create-project' alias ccp='composer create-project'
alias cdu='composer dump-autoload' alias cdu='composer dump-autoload'
alias cdo='composer dump-autoload -o' alias cdo='composer dump-autoload --optimize-autoloader'
alias cgu='composer global update' alias cgu='composer global update'
alias cgr='composer global require' alias cgr='composer global require'
alias cgrm='composer global remove' alias cgrm='composer global remove'
alias co='composer outdated'
alias cod='composer outdated --direct'
# install composer in the current directory # install composer in the current directory
alias cget='curl -s https://getcomposer.org/installer | php' alias cget='curl -s https://getcomposer.org/installer | php'
# Add Composer's global binaries to PATH, using Composer if available. # Add Composer's global binaries to PATH, using Composer if available.
if (( $+commands[composer] )); then if (( $+commands[composer] )); then
_retrieve_cache composer export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null)
if [[ -z $__composer_bin_dir ]]; then
__composer_bin_dir=$(composer global config bin-dir --absolute 2>/dev/null)
_store_cache composer __composer_bin_dir
fi
# Add Composer's global binaries to PATH
export PATH="$PATH:$__composer_bin_dir"
unset __composer_bin_dir
else else
[ -d $HOME/.composer/vendor/bin ] && export PATH=$PATH:$HOME/.composer/vendor/bin [ -d $HOME/.composer/vendor/bin ] && export PATH=$PATH:$HOME/.composer/vendor/bin
[ -d $HOME/.config/composer/vendor/bin ] && export PATH=$PATH:$HOME/.config/composer/vendor/bin [ -d $HOME/.config/composer/vendor/bin ] && export PATH=$PATH:$HOME/.config/composer/vendor/bin

View File

@ -1,9 +1,9 @@
# copy the active line from the command line buffer # copy the active line from the command line buffer
# onto the system clipboard # onto the system clipboard (requires clipcopy plugin)
copybuffer () { copybuffer () {
if which clipcopy &>/dev/null; then if which clipcopy &>/dev/null; then
printf "%s" "$BUFFER" | clipcopy echo $BUFFER | clipcopy
else else
echo "clipcopy function not found. Please make sure you have Oh My Zsh installed correctly." echo "clipcopy function not found. Please make sure you have Oh My Zsh installed correctly."
fi fi

View File

@ -3,8 +3,7 @@
Puts the contents of a file in your system clipboard so you can paste it anywhere. Puts the contents of a file in your system clipboard so you can paste it anywhere.
To use, add `copyfile` to your plugins array: To use, add `copyfile` to your plugins array:
```
```zsh
plugins=(... copyfile) plugins=(... copyfile)
``` ```

View File

@ -1,9 +1,9 @@
# Cpanm # Cpanm
This plugin provides completion for [Cpanm](https://github.com/miyagawa/cpanminus) ([docs](https://metacpan.org/pod/App::cpanminus)). This plugin provides completion for [Cpanm](https://github.com/miyagawa/cpanminus) ([docs](https://metacpan.org/pod/App::cpanminus)).
To use it add cpanm to the plugins array in your zshrc file. To use it add cpanm to the plugins array in your zshrc file.
```zsh ```bash
plugins=(... cpanm) plugins=(... cpanm)
``` ```

View File

@ -7,7 +7,6 @@ To use it, add `dirhistory` to the plugins array in your zshrc file:
```zsh ```zsh
plugins=(... dirhistory) plugins=(... dirhistory)
``` ```
## Keyboard Shortcuts ## Keyboard Shortcuts
| Shortcut | Description | | Shortcut | Description |
@ -16,24 +15,3 @@ plugins=(... dirhistory)
| <kbd>alt</kbd> + <kbd>right</kbd> | Undo <kbd>alt</kbd> + <kbd>left</kbd> | | <kbd>alt</kbd> + <kbd>right</kbd> | Undo <kbd>alt</kbd> + <kbd>left</kbd> |
| <kbd>alt</kbd> + <kbd>up</kbd> | Move into the parent directory | | <kbd>alt</kbd> + <kbd>up</kbd> | Move into the parent directory |
| <kbd>alt</kbd> + <kbd>down</kbd> | Move into the first child directory by alphabetical order | | <kbd>alt</kbd> + <kbd>down</kbd> | Move into the first child directory by alphabetical order |
## Usage
This plugin allows you to navigate the history of previous current-working-directories using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT. MAC users may alternately use OPT-LEFT and OPT-RIGHT.
Also, navigate directory **hierarchy** using ALT-UP and ALT-DOWN. (mac keybindings not yet implemented). ALT-UP moves to higher hierarchy (shortcut for 'cd ..'). ALT-DOWN moves into the first directory found in alphabetical order (useful to navigate long empty directories e.g. java packages)
For example, if the shell was started, and the following commands were entered:
```shell
cd ~
cd /usr
cd share
cd doc
```
Then entering ALT-LEFT at the prompt would change directory from /usr/share/doc to /usr/share, then if pressed again to /usr/, then ~. If ALT-RIGHT were pressed the directory would be changed to /usr/ again.
After that, ALT-DOWN will probably go to /usr/bin (depends on your /usr structure), ALT-UP will return to /usr, then ALT-UP will get you to /
**Currently the max history size is 30**. The navigation should work for xterm, PuTTY xterm mode, GNU screen, and on MAC with alternate keys as mentioned above.

View File

@ -1,7 +1,6 @@
# Dirpersist plugin # Dirpersist plugin
This plugin keeps a running tally of the previous 20 unique directories in the `$HOME/.zdirs` file. This plugin keeps a running tally of the previous 20 unique directories in the $HOME/.zdirs file. When you cd to a new directory, it is prepended to the beginning of the file.
When you cd to a new directory, it is prepended to the beginning of the file.
To use it, add `dirpersist` to the plugins array in your zshrc file: To use it, add `dirpersist` to the plugins array in your zshrc file:

View File

@ -34,3 +34,23 @@ runfcgi -- run this project as a fastcgi
runserver -- start a lightweight web server for development runserver -- start a lightweight web server for development
... ...
``` ```
If you want to see the options available for a specific command, try:
```zsh
$> python manage.py makemessages (press <TAB> here)
```
And that would result in:
```zsh
--all -a -- re-examine all code and templates
--domain -d -- domain of the message files (default: "django")
--extensions -e -- file extension(s) to examine (default: ".html")
--help -- display help information
--locale -l -- locale to process (default: all)
--pythonpath -- directory to add to the Python path
--settings -- python path to settings module
...
```

View File

@ -1,14 +1,10 @@
# dnf plugin ## Description
This plugin makes `dnf` usage easier by adding aliases for the most common commands. This plugin makes `dnf` usage easier by adding aliases for the most
common commands.
`dnf` is the new package manager for RPM-based distributions, which replaces `yum`. `dnf` is the new package manager for RPM-based distributions, which
replaces `yum`.
To use it, add `dnf` to the plugins array in your zshrc file:
```zsh
plugins=(... dnf)
```
## Aliases ## Aliases

View File

@ -4,8 +4,7 @@ This plugin provides completion for [docker-compose](https://docs.docker.com/com
aliases for frequent docker-compose commands. aliases for frequent docker-compose commands.
To use it, add docker-compose to the plugins array of your zshrc file: To use it, add docker-compose to the plugins array of your zshrc file:
```
```zsh
plugins=(... docker-compose) plugins=(... docker-compose)
``` ```

View File

@ -3,7 +3,6 @@
This plugin adds auto-completion for [docker](https://www.docker.com/). This plugin adds auto-completion for [docker](https://www.docker.com/).
To use it add `docker` to the plugins array in your zshrc file. To use it add `docker` to the plugins array in your zshrc file.
```zsh ```zsh
plugins=(... docker) plugins=(... docker)
``` ```

View File

@ -9,7 +9,6 @@
# - Felix Riedel # - Felix Riedel
# - Steve Durrheimer # - Steve Durrheimer
# - Vincent Bernat # - Vincent Bernat
# - Rohan Verma
# #
# license: # license:
# #
@ -605,7 +604,6 @@ __docker_container_subcommand() {
"($help)*--blkio-weight-device=[Block IO (relative device weight)]:device:Block IO weight: " "($help)*--blkio-weight-device=[Block IO (relative device weight)]:device:Block IO weight: "
"($help)*--cap-add=[Add Linux capabilities]:capability: " "($help)*--cap-add=[Add Linux capabilities]:capability: "
"($help)*--cap-drop=[Drop Linux capabilities]:capability: " "($help)*--cap-drop=[Drop Linux capabilities]:capability: "
"($help)--cgroupns=[Cgroup namespace mode to use]:cgroup namespace mode: "
"($help)--cgroup-parent=[Parent cgroup for the container]:cgroup: " "($help)--cgroup-parent=[Parent cgroup for the container]:cgroup: "
"($help)--cidfile=[Write the container ID to the file]:CID file:_files" "($help)--cidfile=[Write the container ID to the file]:CID file:_files"
"($help)--cpus=[Number of CPUs (default 0.000)]:cpus: " "($help)--cpus=[Number of CPUs (default 0.000)]:cpus: "
@ -678,7 +676,6 @@ __docker_container_subcommand() {
"($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: " "($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: "
"($help)--memory-reservation=[Memory soft limit]:Memory limit: " "($help)--memory-reservation=[Memory soft limit]:Memory limit: "
"($help)--memory-swap=[Total memory limit with swap]:Memory limit: " "($help)--memory-swap=[Total memory limit with swap]:Memory limit: "
"($help)--pids-limit[Tune container pids limit (set -1 for unlimited)]"
"($help)--restart=[Restart policy]:restart policy:(no on-failure always unless-stopped)" "($help)--restart=[Restart policy]:restart policy:(no on-failure always unless-stopped)"
) )
opts_help=("(: -)--help[Print usage]") opts_help=("(: -)--help[Print usage]")
@ -804,7 +801,7 @@ __docker_container_subcommand() {
"($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \ "($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \
"($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \ "($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \
"($help)--no-trunc[Do not truncate output]" \ "($help)--no-trunc[Do not truncate output]" \
"($help -q --quiet)"{-q,--quiet}"[Only show container IDs]" \ "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \
"($help -s --size)"{-s,--size}"[Display total file sizes]" \ "($help -s --size)"{-s,--size}"[Display total file sizes]" \
"($help)--since=[Show only containers created since...]:containers:__docker_complete_containers" && ret=0 "($help)--since=[Show only containers created since...]:containers:__docker_complete_containers" && ret=0
;; ;;
@ -835,7 +832,7 @@ __docker_container_subcommand() {
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
"($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \ "($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \
"($help -)*:containers:__docker_complete_containers" && ret=0 "($help -)*:containers:__docker_complete_containers_ids" && ret=0
;; ;;
(rm) (rm)
local state local state
@ -1027,7 +1024,7 @@ __docker_image_subcommand() {
$opts_help \ $opts_help \
"($help -H --human)"{-H,--human}"[Print sizes and dates in human readable format]" \ "($help -H --human)"{-H,--human}"[Print sizes and dates in human readable format]" \
"($help)--no-trunc[Do not truncate output]" \ "($help)--no-trunc[Do not truncate output]" \
"($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \ "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \
"($help -)*: :__docker_complete_images" && ret=0 "($help -)*: :__docker_complete_images" && ret=0
;; ;;
(import) (import)
@ -1059,7 +1056,7 @@ __docker_image_subcommand() {
"($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_images_filters" \ "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_images_filters" \
"($help)--format=[Pretty-print images using a Go template]:template: " \ "($help)--format=[Pretty-print images using a Go template]:template: " \
"($help)--no-trunc[Do not truncate output]" \ "($help)--no-trunc[Do not truncate output]" \
"($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \ "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \
"($help -): :__docker_complete_repositories" && ret=0 "($help -): :__docker_complete_repositories" && ret=0
;; ;;
(prune) (prune)
@ -1079,7 +1076,6 @@ __docker_image_subcommand() {
(push) (push)
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
"($help -a --all-tags)"{-a,--all-tags}"[Push all tagged images in the repository]" \
"($help)--disable-content-trust[Skip image signing]" \ "($help)--disable-content-trust[Skip image signing]" \
"($help -): :__docker_complete_images" && ret=0 "($help -): :__docker_complete_images" && ret=0
;; ;;
@ -1290,7 +1286,7 @@ __docker_network_subcommand() {
"($help)--no-trunc[Do not truncate the output]" \ "($help)--no-trunc[Do not truncate the output]" \
"($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_network_complete_ls_filters" \ "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_network_complete_ls_filters" \
"($help)--format=[Pretty-print networks using a Go template]:template: " \ "($help)--format=[Pretty-print networks using a Go template]:template: " \
"($help -q --quiet)"{-q,--quiet}"[Only display network IDs]" && ret=0 "($help -q --quiet)"{-q,--quiet}"[Only display numeric IDs]" && ret=0
;; ;;
(prune) (prune)
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
@ -2218,6 +2214,7 @@ __docker_stack_subcommand() {
(deploy|up) (deploy|up)
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
"($help)--bundle-file=[Path to a Distributed Application Bundle file]:dab:_files -g \"*.dab\"" \
"($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file, or '-' to read from stdin]:compose file:_files -g \"*.(yml|yaml)\"" \ "($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file, or '-' to read from stdin]:compose file:_files -g \"*.(yml|yaml)\"" \
"($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \ "($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \
"($help -):stack:__docker_complete_stacks" && ret=0 "($help -):stack:__docker_complete_stacks" && ret=0
@ -2671,7 +2668,6 @@ __docker_subcommand() {
"($help)*--log-opt=[Default log driver options for containers]:log driver options:__docker_complete_log_options" \ "($help)*--log-opt=[Default log driver options for containers]:log driver options:__docker_complete_log_options" \
"($help)--max-concurrent-downloads[Set the max concurrent downloads for each pull]" \ "($help)--max-concurrent-downloads[Set the max concurrent downloads for each pull]" \
"($help)--max-concurrent-uploads[Set the max concurrent uploads for each push]" \ "($help)--max-concurrent-uploads[Set the max concurrent uploads for each push]" \
"($help)--max-download-attempts[Set the max download attempts for each pull]" \
"($help)--mtu=[Network MTU]:mtu:(0 576 1420 1500 9000)" \ "($help)--mtu=[Network MTU]:mtu:(0 576 1420 1500 9000)" \
"($help)--oom-score-adjust=[Set the oom_score_adj for the daemon]:oom-score:(-500)" \ "($help)--oom-score-adjust=[Set the oom_score_adj for the daemon]:oom-score:(-500)" \
"($help -p --pidfile)"{-p=,--pidfile=}"[Path to use for daemon PID file]:PID file:_files" \ "($help -p --pidfile)"{-p=,--pidfile=}"[Path to use for daemon PID file]:PID file:_files" \
@ -2787,7 +2783,7 @@ __docker_subcommand() {
$opts_help \ $opts_help \
"($help -p --password)"{-p=,--password=}"[Password]:password: " \ "($help -p --password)"{-p=,--password=}"[Password]:password: " \
"($help)--password-stdin[Read password from stdin]" \ "($help)--password-stdin[Read password from stdin]" \
"($help -u --username)"{-u=,--username=}"[Username]:username: " \ "($help -u --user)"{-u=,--user=}"[Username]:username: " \
"($help -)1:server: " && ret=0 "($help -)1:server: " && ret=0
;; ;;
(logout) (logout)

View File

@ -4,7 +4,9 @@ Automatically load your project ENV variables from `.env` file when you `cd` int
Storing configuration in the environment is one of the tenets of a [twelve-factor app](https://www.12factor.net). Anything that is likely to change between deployment environments, such as resource handles for databases or credentials for external services, should be extracted from the code into environment variables. Storing configuration in the environment is one of the tenets of a [twelve-factor app](https://www.12factor.net). Anything that is likely to change between deployment environments, such as resource handles for databases or credentials for external services, should be extracted from the code into environment variables.
To use it, add `dotenv` to the plugins array in your zshrc file: ## Installation
Just add the plugin to your `.zshrc`:
```sh ```sh
plugins=(... dotenv) plugins=(... dotenv)
@ -15,63 +17,32 @@ plugins=(... dotenv)
Create `.env` file inside your project root directory and put your ENV variables there. Create `.env` file inside your project root directory and put your ENV variables there.
For example: For example:
```sh ```sh
export AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a export AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a
export SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f export SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
export MONGO_URI=mongodb://127.0.0.1:27017 export MONGO_URI=mongodb://127.0.0.1:27017
export PORT=3001 export PORT=3001
``` ```
`export` is optional. This format works as well: `export` is optional. This format works as well:
```sh ```sh
AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a
SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
MONGO_URI=mongodb://127.0.0.1:27017 MONGO_URI=mongodb://127.0.0.1:27017
PORT=3001 PORT=3001
``` ```
You can even mix both formats, although it's probably a bad idea. You can even mix both formats, although it's probably a bad idea.
## Settings
### ZSH_DOTENV_FILE ### ZSH_DOTENV_FILE
You can also modify the name of the file to be loaded with the variable `ZSH_DOTENV_FILE`. You can also modify the name of the file to be loaded with the variable `ZSH_DOTENV_FILE`.
If the variable isn't set, the plugin will default to use `.env`. If the variable isn't set, the plugin will default to use `.env`.
For example, this will make the plugin look for files named `.dotenv` and load them: For example, this will make the plugin look for files named `.dotenv` and load them:
```zsh ```
# in ~/.zshrc, before Oh My Zsh is sourced: # in ~/.zshrc, before Oh My Zsh is sourced:
ZSH_DOTENV_FILE=.dotenv ZSH_DOTENV_FILE=.dotenv
``` ```
### ZSH_DOTENV_PROMPT
Set `ZSH_DOTENV_PROMPT=false` in your zshrc file if you don't want the confirmation message.
You can also choose the `Always` option when prompted to always allow sourcing the .env file
in that directory. See the next section for more details.
### ZSH_DOTENV_ALLOWED_LIST
The default behavior of the plugin is to always ask whether to source a dotenv file. There's
a **Y**es, **N**o, and **A**lways option. If you choose Always, the directory of the .env file
will be added to an allowed list. If a directory is found in this list, the plugin won't ask
for confirmation and will instead source the .env file directly.
This allowed list is saved by default in `$ZSH_CACHE_DIR/dotenv-allowed.list`. If you want
to change that location, change the `$ZSH_DOTENV_ALLOWED_LIST` variable, like so:
```zsh
# in ~/.zshrc, before Oh My Zsh is sourced:
ZSH_DOTENV_ALLOWED_LIST=/path/to/dotenv/allowed/list
```
This file is just a list of directories allowed, separated by a newline character. If you want
to disallow a directory, just edit this file and remove the line for the directory you want to
disallow.
## Version Control ## Version Control
**It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it's supposed to be local only. **It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it's supposed to be local only.
@ -81,6 +52,5 @@ disallow.
This plugin only sources the `.env` file. Nothing less, nothing more. It doesn't do any checks. It's designed to be the fastest and simplest option. You're responsible for the `.env` file content. You can put some code (or weird symbols) there, but do it on your own risk. `dotenv` is the basic tool, yet it does the job. This plugin only sources the `.env` file. Nothing less, nothing more. It doesn't do any checks. It's designed to be the fastest and simplest option. You're responsible for the `.env` file content. You can put some code (or weird symbols) there, but do it on your own risk. `dotenv` is the basic tool, yet it does the job.
If you need more advanced and feature-rich ENV management, check out these awesome projects: If you need more advanced and feature-rich ENV management, check out these awesome projects:
* [direnv](https://github.com/direnv/direnv) * [direnv](https://github.com/direnv/direnv)
* [zsh-autoenv](https://github.com/Tarrasch/zsh-autoenv) * [zsh-autoenv](https://github.com/Tarrasch/zsh-autoenv)

View File

@ -1,46 +1,23 @@
## Settings
# Filename of the dotenv file to look for
: ${ZSH_DOTENV_FILE:=.env}
# Path to the file containing allowed paths
: ${ZSH_DOTENV_ALLOWED_LIST:="${ZSH_CACHE_DIR:-$ZSH/cache}/dotenv-allowed.list"}
## Functions
source_env() { source_env() {
if [[ -f $ZSH_DOTENV_FILE ]]; then if [[ -f $ZSH_DOTENV_FILE ]]; then
if [[ "$ZSH_DOTENV_PROMPT" != false ]]; then
local confirmation dirpath="${PWD:A}"
# make sure there is an allowed file
touch "$ZSH_DOTENV_ALLOWED_LIST"
# check if current directory's .env file is allowed or ask for confirmation
if ! grep -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then
# print same-line prompt and output newline character if necessary
echo -n "dotenv: found '$ZSH_DOTENV_FILE' file. Source it? ([Y]es/[n]o/[a]lways) "
read -k 1 confirmation; [[ "$confirmation" != $'\n' ]] && echo
# check input
case "$confirmation" in
[nN]) return ;;
[aA]) echo "$dirpath" >> "$ZSH_DOTENV_ALLOWED_LIST" ;;
*) ;; # interpret anything else as a yes
esac
fi
fi
# test .env syntax # test .env syntax
zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2 zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2
setopt localoptions allexport if [[ -o a ]]; then
source $ZSH_DOTENV_FILE source $ZSH_DOTENV_FILE
else
set -a
source $ZSH_DOTENV_FILE
set +a
fi
fi fi
} }
autoload -U add-zsh-hook autoload -U add-zsh-hook
add-zsh-hook chpwd source_env add-zsh-hook chpwd source_env
if [[ -z $ZSH_DOTENV_FILE ]]; then
ZSH_DOTENV_FILE=.env
fi
source_env source_env

View File

@ -10,14 +10,12 @@ plugins=(... dotnet)
## Aliases ## Aliases
| Alias | Command | Description | | Alias | Command | Description |
|-------|------------------|-------------------------------------------------------------------| |-------|--------------|-------------------------------------------------------------------|
| dn | dotnet new | Create a new .NET project or file. | | dn | dotnet new | Create a new .NET project or file. |
| dr | dotnet run | Build and run a .NET project output. | | dr | dotnet run | Build and run a .NET project output. |
| dt | dotnet test | Run unit tests using the test runner specified in a .NET project. | | dt | dotnet test | Run unit tests using the test runner specified in a .NET project. |
| dw | dotnet watch | Watch for source file changes and restart the dotnet command. | | ds | dotnet sln | Modify Visual Studio solution files. |
| dwr | dotnet watch run | Watch for source file changes and restart the `run` command. | | da | dotnet add | Add a package or reference to a .NET project. |
| ds | dotnet sln | Modify Visual Studio solution files. | | dp | dotnet pack | Create a NuGet package. |
| da | dotnet add | Add a package or reference to a .NET project. | | dng | dotnet nuget | Provides additional NuGet commands. |
| dp | dotnet pack | Create a NuGet package. |
| dng | dotnet nuget | Provides additional NuGet commands. |

View File

@ -1,31 +1,116 @@
# This scripts is copied from (MIT License): # --------------------------------------------------------------------- #
# https://github.com/dotnet/toolset/blob/master/scripts/register-completions.zsh # Aliases and Completions for .NET Core (https://dotnet.microsoft.com/) #
# Author: Shaun Tabone (https://github.com/xontab) #
# --------------------------------------------------------------------- #
_dotnet_zsh_complete() # Helper function to cache and load completions
{ local cache_base_path="${ZSH_CACHE_DIR}/dotnet_"
local completions=("$(dotnet complete "$words")") _dotnet_cache_completion() {
local cache="${cache_base_path}$(echo $1)_completion"
if [[ ! -f $cache ]]; then
$2 $cache
fi
# If the completion list is empty, just continue with filename selection [[ -f $cache ]] && cat $cache
if [ -z "$completions" ]
then
_arguments '*::arguments: _normal'
return
fi
# This is not a variable assigment, don't remove spaces!
_values = "${(ps:\n:)completions}"
} }
compdef _dotnet_zsh_complete dotnet _dotnet_cache_completion_cleanup() {
local cache="${cache_base_path}$(echo $1)_completion"
rm -f $cache
}
# Aliases bellow are here for backwards compatibility # --------------------------------------------------------------------- #
# added by Shaun Tabone (https://github.com/xontab) # dotnet new #
# ALIAS: dn #
# --------------------------------------------------------------------- #
_dotnet_new_completion() {
if [ $commands[dotnet] ]; then
dotnet new -l | tail -n +21 | sed 's/ \+/:/g' | cut -d : -f 2 >$1
fi
}
_dotnet_new_completion_cached() {
_dotnet_cache_completion 'new' _dotnet_new_completion
}
_dotnet_cache_completion_cleanup 'new'
alias dn='dotnet new' alias dn='dotnet new'
# --------------------------------------------------------------------- #
# dotnet #
# --------------------------------------------------------------------- #
_dotnet() {
if [ $CURRENT -eq 2 ]; then
_arguments \
'--diagnostics[Enable diagnostic output.]' \
'--help[Show command line help.]' \
'--info[Display .NET Core information.]' \
'--list-runtimes[Display the installed runtimes.]' \
'--list-sdks[Display the installed SDKs.]' \
'--version[Display .NET Core SDK version in use.]'
_values \
'add[Add a package or reference to a .NET project.]' \
'build[Build a .NET project.]' \
'build-server[Interact with servers started by a build.]' \
'clean[Clean build outputs of a .NET project.]' \
'help[Show command line help.]' \
'list[List project references of a .NET project.]' \
'msbuild[Run Microsoft Build Engine (MSBuild) commands.]' \
'new[Create a new .NET project or file.]' \
'nuget[Provides additional NuGet commands.]' \
'pack[Create a NuGet package.]' \
'publish[Publish a .NET project for deployment.]' \
'remove[Remove a package or reference from a .NET project.]' \
'restore[Restore dependencies specified in a .NET project.]' \
'run[Build and run a .NET project output.]' \
'sln[Modify Visual Studio solution files.]' \
'store[Store the specified assemblies in the runtime package store.]' \
'test[Run unit tests using the test runner specified in a .NET project.]' \
'tool[Install or manage tools that extend the .NET experience.]' \
'vstest[Run Microsoft Test Engine (VSTest) commands.]' \
'dev-certs[Create and manage development certificates.]' \
'fsi[Start F# Interactive / execute F# scripts.]' \
'sql-cache[SQL Server cache command-line tools.]' \
'user-secrets[Manage development user secrets.]' \
'watch[Start a file watcher that runs a command when files change.]'
return
fi
if [ $CURRENT -eq 3 ]; then
case ${words[2]} in
"new")
compadd -X ".NET Installed Templates" $(_dotnet_new_completion_cached)
return
;;
"sln")
_values \
'add[Add one or more projects to a solution file.]' \
'list[List all projects in a solution file.]' \
'remove[Remove one or more projects from a solution file.]'
return
;;
"nuget")
_values \
'delete[Deletes a package from the server.]' \
'locals[Clears or lists local NuGet resources such as http requests cache, packages folder, plugin operations cache or machine-wide global packages folder.]' \
'push[Pushes a package to the server and publishes it.]'
return
;;
esac
fi
_arguments '*::arguments: _normal'
}
compdef _dotnet dotnet
# --------------------------------------------------------------------- #
# Other Aliases #
# --------------------------------------------------------------------- #
alias dr='dotnet run' alias dr='dotnet run'
alias dt='dotnet test' alias dt='dotnet test'
alias dw='dotnet watch'
alias dwr='dotnet watch run'
alias ds='dotnet sln' alias ds='dotnet sln'
alias da='dotnet add' alias da='dotnet add'
alias dp='dotnet pack' alias dp='dotnet pack'

View File

@ -1,12 +1,6 @@
# encode64 # encode64
Alias plugin for encoding or decoding using `base64` command. Alias plugin for encoding or decoding using `base64` command
To use it, add `encode64` to the plugins array in your zshrc file:
```zsh
plugins=(... encode64)
```
## Functions and Aliases ## Functions and Aliases
@ -15,6 +9,23 @@ plugins=(... encode64)
| `encode64` | `e64` | Encodes given data to base64 | | `encode64` | `e64` | Encodes given data to base64 |
| `decode64` | `d64` | Decodes given data from base64 | | `decode64` | `d64` | Decodes given data from base64 |
## Enabling plugin
1. Edit your `.zshrc` file and add `encode64` to the list of plugins:
```sh
plugins=(
# ...other enabled plugins
encode64
)
```
2. Restart your terminal session or restart the shell:
```sh
exec zsh
```
## Usage and examples ## Usage and examples
### Encoding ### Encoding

View File

@ -4,6 +4,6 @@ This plugin provides completion for [Fabric](https://www.fabfile.org/).
To use it add fabric to the plugins array in your zshrc file. To use it add fabric to the plugins array in your zshrc file.
```zsh ```bash
plugins=(... fabric) plugins=(... fabric)
``` ```

View File

@ -1,10 +1,10 @@
fancy-ctrl-z () { fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then if [[ $#BUFFER -eq 0 ]]; then
BUFFER="fg" BUFFER="fg"
zle accept-line -w zle accept-line
else else
zle push-input -w zle push-input
zle clear-screen -w zle clear-screen
fi fi
} }
zle -N fancy-ctrl-z zle -N fancy-ctrl-z

View File

@ -1,16 +1,12 @@
# check if fasd is installed if [ $commands[fasd] ]; then # check if fasd is installed
if (( ! ${+commands[fasd]} )); then fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache"
return if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
fi fasd --init auto >| "$fasd_cache"
fi
source "$fasd_cache"
unset fasd_cache
fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache" alias v='f -e "$EDITOR"'
if [[ "$commands[fasd]" -nt "$fasd_cache" || ! -s "$fasd_cache" ]]; then alias o='a -e xdg-open'
fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install \ alias j='zz'
zsh-wcomp zsh-wcomp-install >| "$fasd_cache"
fi fi
source "$fasd_cache"
unset fasd_cache
alias v='f -e "$EDITOR"'
alias o='a -e xdg-open'
alias j='zz'

View File

@ -5,7 +5,7 @@
# If they are not set yet, they will be # If they are not set yet, they will be
# overwritten with their default values # overwritten with their default values
default fastfile_dir "${HOME}/.fastfile" default fastfile_dir "${HOME}/.fastfile/"
default fastfile_var_prefix "§" default fastfile_var_prefix "§"
########################### ###########################
@ -78,7 +78,7 @@ function fastfile_print() {
# (=> fastfle_print) for each shortcut # (=> fastfle_print) for each shortcut
# #
function fastfile_ls() { function fastfile_ls() {
for f in "${fastfile_dir}"/*(NF); do for f in "${fastfile_dir}"/*; do
file=`basename "$f"` # To enable simpler handeling of spaces in file names file=`basename "$f"` # To enable simpler handeling of spaces in file names
varkey=`echo "$file" | tr " " "_"` varkey=`echo "$file" | tr " " "_"`
@ -104,7 +104,7 @@ function fastfile_rm() {
# Generate the aliases for the shortcuts # Generate the aliases for the shortcuts
# #
function fastfile_sync() { function fastfile_sync() {
for f in "${fastfile_dir}"/*(NF); do for f in "${fastfile_dir}"/*; do
file=`basename "$f"` # To enable simpler handeling of spaces in file names file=`basename "$f"` # To enable simpler handeling of spaces in file names
varkey=`echo "$file" | tr " " "_"` varkey=`echo "$file" | tr " " "_"`

View File

@ -3,8 +3,7 @@
This plugin automatically starts [fbterm](https://github.com/zhangyuanwei/fbterm) This plugin automatically starts [fbterm](https://github.com/zhangyuanwei/fbterm)
if on a real TTY (`/dev/tty*`). if on a real TTY (`/dev/tty*`).
To use it, add `fbterm` to the plugins array of your zshrc file: To use it, add fbterm to the plugins array of your zshrc file:
```
```zsh
plugins=(... fbterm) plugins=(... fbterm)
``` ```

View File

@ -1,3 +0,0 @@
print -P "%F{yellow}The 'fedora' plugin is deprecated. Use the '%Udnf%u' plugin instead.%f"
source "$ZSH/plugins/dnf/dnf.plugin.zsh"

View File

@ -0,0 +1 @@
../dnf/dnf.plugin.zsh

View File

@ -1,23 +1,15 @@
# forklift ## forklift
Plugin for ForkLift, an FTP application for OS X. Plugin for ForkLift, an FTP application for OS X.
To use it, add `forklift` to the plugins array in your zshrc file: ### Requirements
```zsh
plugins=(... forklift)
```
## Requirements
* [ForkLift](https://binarynights.com/) * [ForkLift](https://binarynights.com/)
## Usage ### Usage
`fl [<file_or_folder>]` <code>fl [*file_or_folder*]</code>
* If `fl` is called without arguments then the current folder is opened in ForkLift. This is equivalent to `fl .`. * If `fl` is called without arguments then the current folder is opened in ForkLift. This is equivalent to `fl .`.
* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift * If `fl` is called with a directory as the argument, then that directory is opened in ForkLift. If called with a non-directory file as the argument, then the file's parent directory is opened.
* If `fl` is called with a non-directory file as the argument, then the file's parent directory is opened.

View File

@ -1,7 +1,6 @@
# Open folder in ForkLift.app or ForkLift2.app from console # Open folder in ForkLift.app or ForkLift2.app from console
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de # Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
# Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving # Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving
# Updated to support ForkLift from Setapp by Paul Rudkin
# #
# Usage: # Usage:
# fl [<folder>] # fl [<folder>]
@ -25,13 +24,6 @@ function fl {
fi fi
osascript 2>&1 1>/dev/null <<END osascript 2>&1 1>/dev/null <<END
try
tell application "Finder"
set forkLiftSetapp to name of application file id "com.binarynights.forklift-setapp"
end tell
on error err_msg number err_num
set forkLiftSetapp to null
end try
try try
tell application "Finder" tell application "Finder"
set forkLift3 to name of application file id "com.binarynights.ForkLift-3" set forkLift3 to name of application file id "com.binarynights.ForkLift-3"
@ -54,12 +46,7 @@ function fl {
set forkLift to null set forkLift to null
end try end try
if forkLiftSetapp is not null and application forkLiftSetapp is running then if forkLift3 is not null and application forkLift3 is running then
tell application forkLiftSetapp
activate
set forkLiftVersion to version
end tell
else if forkLift3 is not null and application forkLift3 is running then
tell application forkLift3 tell application forkLift3
activate activate
set forkLiftVersion to version set forkLiftVersion to version
@ -75,9 +62,7 @@ function fl {
set forkLiftVersion to version set forkLiftVersion to version
end tell end tell
else else
if forkLiftSetapp is not null then if forkLift3 is not null then
set appName to forkLiftSetapp
else if forkLift3 is not null then
set appName to forkLift3 set appName to forkLift3
else if forkLift2 is not null then else if forkLift2 is not null then
set appName to forkLift2 set appName to forkLift2

View File

@ -52,7 +52,6 @@ Available search contexts are:
| mdn | `https://developer.mozilla.org/search?q=` | | mdn | `https://developer.mozilla.org/search?q=` |
| nodejs | `https://www.google.com/search?as_sitesearch=nodejs.org/en/docs/&as_q=` | | nodejs | `https://www.google.com/search?as_sitesearch=nodejs.org/en/docs/&as_q=` |
| npmjs | `https://www.npmjs.com/search?q=` | | npmjs | `https://www.npmjs.com/search?q=` |
| packagephobia | `https://packagephobia.now.sh/result?p=` |
| qunit | `https://api.qunitjs.com/?s=` | | qunit | `https://api.qunitjs.com/?s=` |
| reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` | | reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` |
| smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` | | smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` |

View File

@ -38,7 +38,6 @@ function _frontend() {
'mdn: Search in MDN website' 'mdn: Search in MDN website'
'nodejs: Search in NodeJS website' 'nodejs: Search in NodeJS website'
'npmjs: Search in NPMJS website' 'npmjs: Search in NPMJS website'
'packagephobia: Search in Packagephobia website'
'qunit: Search in Qunit website' 'qunit: Search in Qunit website'
'reactjs: Search in React website' 'reactjs: Search in React website'
'smacss: Search in SMACSS website' 'smacss: Search in SMACSS website'
@ -125,9 +124,6 @@ function _frontend() {
bundlephobia) bundlephobia)
_describe -t points "Warp points" frontend_points && ret=0 _describe -t points "Warp points" frontend_points && ret=0
;; ;;
packagephobia)
_describe -t points "Warp points" frontend_points && ret=0
;;
flowtype) flowtype)
_describe -t points "Warp points" frontend_points && ret=0 _describe -t points "Warp points" frontend_points && ret=0
;; ;;

View File

@ -19,7 +19,6 @@ alias lodash='frontend lodash'
alias mdn='frontend mdn' alias mdn='frontend mdn'
alias nodejs='frontend nodejs' alias nodejs='frontend nodejs'
alias npmjs='frontend npmjs' alias npmjs='frontend npmjs'
alias packagephobia='frontend packagephobia'
alias qunit='frontend qunit' alias qunit='frontend qunit'
alias reactjs='frontend reactjs' alias reactjs='frontend reactjs'
alias smacss='frontend smacss' alias smacss='frontend smacss'
@ -66,7 +65,6 @@ function frontend() {
mdn 'https://developer.mozilla.org/search?q=' mdn 'https://developer.mozilla.org/search?q='
nodejs $(_frontend_fallback 'nodejs.org/en/docs/') nodejs $(_frontend_fallback 'nodejs.org/en/docs/')
npmjs 'https://www.npmjs.com/search?q=' npmjs 'https://www.npmjs.com/search?q='
packagephobia 'https://packagephobia.now.sh/result?p='
qunit 'https://api.qunitjs.com/?s=' qunit 'https://api.qunitjs.com/?s='
reactjs $(_frontend_fallback 'reactjs.org/') reactjs $(_frontend_fallback 'reactjs.org/')
smacss $(_frontend_fallback 'smacss.com') smacss $(_frontend_fallback 'smacss.com')
@ -84,7 +82,7 @@ function frontend() {
print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website," print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website,"
print -P "and %Ucontext%u is one of the following:" print -P "and %Ucontext%u is one of the following:"
print -P "" print -P ""
print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia" print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow,"
print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash," print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash,"
print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia" print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
print -P "" print -P ""
@ -100,7 +98,7 @@ function frontend() {
echo "" echo ""
echo "Valid contexts are:" echo "Valid contexts are:"
echo "" echo ""
echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia" echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow,"
echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash," echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash,"
echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia" echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
echo "" echo ""

View File

@ -10,7 +10,6 @@ function setup_using_base_dir() {
if [[ -z "${fzf_base}" ]]; then if [[ -z "${fzf_base}" ]]; then
fzfdirs=( fzfdirs=(
"${HOME}/.fzf" "${HOME}/.fzf"
"${HOME}/.nix-profile/share/fzf"
"/usr/local/opt/fzf" "/usr/local/opt/fzf"
"/usr/share/fzf" "/usr/share/fzf"
"/usr/local/share/examples/fzf" "/usr/local/share/examples/fzf"
@ -32,8 +31,8 @@ function setup_using_base_dir() {
fi fi
if [[ -d "${fzf_base}" ]]; then if [[ -d "${fzf_base}" ]]; then
# Fix fzf shell directory for Arch Linux, NixOS or Void Linux packages # Fix fzf shell directory for Archlinux package
if [[ ! -d "${fzf_base}/shell" ]]; then if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then
fzf_shell="${fzf_base}" fzf_shell="${fzf_base}"
else else
fzf_shell="${fzf_base}/shell" fzf_shell="${fzf_base}/shell"

View File

@ -4,7 +4,6 @@ This plugin adds autocompletion for the [gas](http://walle.github.com/gas) comma
a utility to manage Git authors. a utility to manage Git authors.
To use it, add `gas` to the plugins array of your zshrc file: To use it, add `gas` to the plugins array of your zshrc file:
```zsh ```zsh
plugins=(... gas) plugins=(... gas)
``` ```

View File

@ -1,10 +1,12 @@
# Geeknote plugin ## ZSH-Geeknote
This plugin provides autocompletion for [Geeknote](https://github.com/VitaliyRodnenko/geeknote) [Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for oh-my-zsh.
and an alias for `geeknote` called `gn`.
To use it, add `geeknote` to the plugins array in your zshrc file: Plugins provides:
```zsh - auto completion of commands and their options
plugins=( ... geeknote ...) - alias `gn`
```
You can find information how to install Geeknote and it's available commands on the [project website](http://www.geeknote.me/).
Maintainer : Ján Koščo ([@s7anley](https://twitter.com/s7anley))

View File

@ -1,157 +1,136 @@
#compdef geeknote #compdef geeknote
# --------------- ------------------------------------------------------------
# Geeknote Autocomplete plugin for Zsh # Name : _geeknote
# Requires: Geeknote installed # Synopsis : zsh completion for geeknote
# Author : Ján Koščo (@s7anley) # Author : Ján Koščo <3k.stanley@gmail.com>
# HomePage : http://www.geeknote.me
__login() { # Version : 0.1
# no arguments # Tag : [ shell, zsh, completion, evernote ]
} # Copyright : © 2014 by Ján Koščo,
# Released under current GPL license.
__logout() { # --------------- ------------------------------------------------------------
_arguments \
'--force[Do not ask about logging out.]'
}
__settings() {
_arguments \
"--editor+[Set the editor, which use to edit and create notes.]::"
}
__create() {
_arguments \
'--title+[The note title.]::' \
'--content+[The note content.]::' \
'--tags+[One tag or the list of tags which will be added to the note.]::' \
'--notebook+[Set the notebook where to save note.]::' \
'--resource+[Add a resource to the note.]::'
}
__edit() {
_arguments \
'--note+[The name or ID from the previous search of a note to edit.]::' \
'--title+[Set new title of the note.]::' \
'--content+[Set new content of the note.]::' \
'--tags+[Set new list o tags for the note.]::' \
'--notebook+[Assign new notebook for the note.]::' \
'--resource+[Add a resource to the note.]::'
}
__find() {
_arguments \
'--search+[Text to search.]::' \
'--tags+[Notes with which tag/tags to search.]::' \
'--notebook+[In which notebook search the note.]::' \
'--date+[Set date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy.]::' \
'--count+[How many notes show in the result list.]::' \
'--with-url[Add direct url of each note in results to Evernote web-version.]' \
'--content-search[Search by content, not by title.]' \
'--exact-entry[Search for exact entry of the request.]'
}
__show() {
_arguments \
'--note+[The name or ID from the previous search of a note to show.]::' \
'--raw[Show the raw note body.]'
}
__remove() {
_arguments \
'--note+[The name or ID from the previous search of a note to remove.]::' \
'--force[Do not ask about removing.]'
}
__notebook-list() {
# no arguments
}
__notebook-create() {
_arguments \
'--title+[Set the title of new notebook.]::'
}
__notebook-edit() {
_arguments \
'--title+[Set the title of new notebook.]::' \
'--notebook+[The name of a notebook to rename.]::'
}
__tag-list() {
# no arguments
}
__tag-create() {
_arguments \
'--title+[Set the title of new tag.]::'
}
__tag-edit() {
_arguments \
'--tagname+[The name of a tag to rename.]::' \
'--title+[Set the new name of tag.]::'
}
__user() {
_arguments \
'--full[Show full information.]'
}
local -a _1st_arguments local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'login':'Authorize in Evernote.' 'login'
'logout':'Logout from Evernote.' 'logout'
'settings':'Show and edit current settings.' 'settings'
'create':'Create note in Evernote.' 'create'
'edit':'Edit note in Evernote.' 'edit'
'find':'Search notes in Evernote.' 'find'
'show':'Output note in the terminal.' 'show'
'remove':'Remove note from Evernote.' 'remove'
'notebook-list':'Show the list of existing notebooks in your Evernote.' 'notebook-list'
'notebook-create':'Create new notebook.' 'notebook-create'
'notebook-edit':'Edit/rename notebook.' 'notebook-edit'
'tag-list':'Show the list of existing tags in your Evernote.' 'tag-list'
'tag-create':'Create new tag.' 'tag-create'
'tag-edit':'Edit/rename tag.' 'tag-edit'
'user':'Show information about active user.' 'tag-remove'
'gnsync'
'user'
) )
_arguments '*:: :->command' _arguments '*:: :->command'
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then
_describe -t commands "geeknote command" _1st_arguments _describe -t commands "geeknote command" _1st_arguments
return return
fi fi
local -a _command_args local -a _command_args
case "$words[1]" in case "$words[1]" in
login) user)
__login ;; _command_args=(
logout) '(--full)--full' \
__logout ;; )
settings) ;;
__settings ;; logout)
create) _command_args=(
__create ;; '(--force)--force' \
edit) )
__edit ;; ;;
find) settings)
__find ;; _command_args=(
show) '(--editor)--editor' \
__show ;; )
remove) ;;
__remove ;; create)
notebook-list) _command_args=(
__notebook-list ;; '(-t|--title)'{-t,--title}'[note title]' \
notebook-create) '(-c|--content)'{-c,--content}'[note content]' \
__notebook-create ;; '(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
notebook-edit) '(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
__notebook-edit ;; )
tag-list) ;;
__tag-list ;; edit)
tag-create) _command_args=(
__tag-create ;; '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
tag-edit) '(-t|--title)'{-t,--title}'[note title]' \
__tag-edit ;; '(-c|--content)'{-c,--content}'[note content]' \
user) '(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
__user ;; '(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
esac )
;;
remove)
_command_args=(
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
'(--force)--force' \
)
;;
show)
_command_args=(
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
)
;;
find)
_command_args=(
'(-s|--search)'{-s,--search}'[text to search]' \
'(-tg|--tags)'{-tg,--tags}'[notes with which tag/tags to search]' \
'(-nb|--notebook)'{-nb,--notebook}'[in which notebook search the note]' \
'(-d|--date)'{-d,--date}'[date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy]' \
'(-cn|--count)'{-cn,--count}'[how many notes show in the result list]' \
'(-uo|--url-only)'{-uo,--url-only}'[add direct url of each note in results to Evernote web-version]' \
'(-ee|--exact-entry)'{-ee,--exact-entry}'[search for exact entry of the request]' \
'(-cs|--content-search)'{-cs,--content-search}'[search by content, not by title]' \
)
;;
notebook-create)
_command_args=(
'(-t|--title)'{-t,--title}'[notebook title]' \
)
;;
notebook-edit)
_command_args=(
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook to rename]' \
'(-t|--title)'{-t,--title}'[new notebook title]' \
)
;;
notebook-remove)
_command_args=(
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook to remove]' \
'(--force)--force' \
)
;;
tag-create)
_command_args=(
'(-t|--title)'{-t,--title}'[title of tag]' \
)
;;
tag-edit)
_command_args=(
'(-tgn|--tagname)'{-tgn,--tagname}'[tag to edit]' \
'(-t|--title)'{-t,--title}'[new tag name]' \
)
;;
tag-remove)
_command_args=(
'(-tgn|--tagname)'{-tgn,--tagname}'[tag to remove]' \
'(--force)--force' \
)
;;
esac
_arguments \
$_command_args \
&& return 0

View File

@ -2,16 +2,10 @@
This plugin provides completion definitions for some of the commands defined by [git-extras](https://github.com/tj/git-extras). This plugin provides completion definitions for some of the commands defined by [git-extras](https://github.com/tj/git-extras).
To use it, add `git-extras` to the plugins array in your zshrc file: ## Setup notes
```zsh
plugins=(... git-extras)
```
## Setup notes
The completions work by augmenting the `_git` completion provided by `zsh`. This only works with the `zsh`-provided `_git`, not the `_git` provided by `git` itself. If you have both `zsh` and `git` installed, you need to make sure that the `zsh`-provided `_git` takes precedence. The completions work by augmenting the `_git` completion provided by `zsh`. This only works with the `zsh`-provided `_git`, not the `_git` provided by `git` itself. If you have both `zsh` and `git` installed, you need to make sure that the `zsh`-provided `_git` takes precedence.
### OS X Homebrew Setup ### OS X Homebrew Setup
**NOTE:** this no longer works on current Homebrew distributions of git. ~~On OS X with Homebrew, you need to install `git` with `brew install git --without-completions`. Otherwise, `git`'s `_git` will take precedence, and you won't see the completions for `git-extras` commands.~~ On OS X with Homebrew, you need to install `git` with `brew install git --without-completions`. Otherwise, `git`'s `_git` will take precedence, and you won't see the completions for `git-extras` commands.

View File

@ -1,15 +1,18 @@
# Git-Flow plugin # Git-Flow plugin
This plugin adds completion and aliases for the [`git-flow` command](https://github.com/nvie/gitflow). This plugin adds completion and aliases for the `git-flow` command. More information
at https://github.com/nvie/gitflow.
To use it, add `git-flow` to the plugins array in your zshrc file: Enable git-flow plugin in your zshrc file:
```
```zsh
plugins=(... git-flow) plugins=(... git-flow)
``` ```
## Aliases ## Aliases
More information about `git-flow` commands:
https://github.com/nvie/gitflow/wiki/Command-Line-Arguments
| Alias | Command | Description | | Alias | Command | Description |
|---------|----------------------------|----------------------------------------| |---------|----------------------------|----------------------------------------|
| `gfl` | `git flow` | Git-Flow command | | `gfl` | `git flow` | Git-Flow command |
@ -27,5 +30,3 @@ plugins=(... git-flow)
| `gflfp` | `git flow feature publish` | Publish feature: `gflfp <name>` | | `gflfp` | `git flow feature publish` | Publish feature: `gflfp <name>` |
| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` | | `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` |
| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` | | `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` |
[More information about `git-flow` commands](https://github.com/nvie/gitflow/wiki/Command-Line-Arguments).

View File

@ -0,0 +1,14 @@
# git-remote-branch plugin
This plugin adds completion for [`grb`](https://github.com/webmat/git_remote_branch),
or `git_remote_branch`.
To use it, add `git-remote-branch` to the plugins array of your `.zshrc` file:
```
plugins=(... git-remote-branch)
```
## Deprecation
[git_remote_branch was archived in 2018](https://github.com/webmat/git_remote_branch#archived),
meaning it's not actively maintained anymore. Use at your own risk.

View File

@ -0,0 +1,19 @@
_git_remote_branch() {
ref=$(git symbolic-ref HEAD 2> /dev/null)
if [[ -n $ref ]]; then
if (( CURRENT == 2 )); then
# first arg: operation
compadd create publish rename delete track
elif (( CURRENT == 3 )); then
# second arg: remote branch name
remotes=`git remote | tr '\n' '|' | sed "s/\|$//g"`
compadd `git branch -r | grep -v HEAD | sed "s/$remotes\///" | sed "s/ //g"`
elif (( CURRENT == 4 )); then
# third arg: remote name
compadd `git remote`
fi
else;
_files
fi
}
compdef _git_remote_branch grb

View File

@ -10,203 +10,194 @@ plugins=(... git)
## Aliases ## Aliases
| Alias | Command | | Alias | Command |
|:---------------------|:---------------------------------------------------------------------------------------------------------------------------------| |:---------------------|:------------------------------------------------------------------------------------------------------------------------------|
| g | git | | g | git |
| ga | git add | | ga | git add |
| gaa | git add --all | | gaa | git add --all |
| gapa | git add --patch | | gapa | git add --patch |
| gau | git add --update | | gau | git add --update |
| gav | git add --verbose | | gav | git add --verbose |
| gap | git apply | | gap | git apply |
| gapt | git apply --3way | | gb | git branch |
| gb | git branch | | gba | git branch -a |
| gba | git branch -a | | gbd | git branch -d |
| gbd | git branch -d | | gbda | git branch --no-color --merged \| command grep -vE "^(\+|\*\|\s*(master\|develop\|dev)\s*$)" \| command xargs -n 1 git branch -d |
| gbda | git branch --no-color --merged \| command grep -vE "^(\+\|\*\|\s*(master\|development\|develop\|devel\|dev)\s*$)" \| command xargs -n 1 git branch -d | | gbD | git branch -D |
| gbD | git branch -D | | gbl | git blame -b -w |
| gbl | git blame -b -w | | gbnm | git branch --no-merged |
| gbnm | git branch --no-merged | | gbr | git branch --remote |
| gbr | git branch --remote | | gbs | git bisect |
| gbs | git bisect | | gbsb | git bisect bad |
| gbsb | git bisect bad | | gbsg | git bisect good |
| gbsg | git bisect good | | gbsr | git bisect reset |
| gbsr | git bisect reset | | gbss | git bisect start |
| gbss | git bisect start | | gc | git commit -v |
| gc | git commit -v | | gc! | git commit -v --amend |
| gc! | git commit -v --amend | | gcn! | git commit -v --no-edit --amend |
| gcn! | git commit -v --no-edit --amend | | gca | git commit -v -a |
| gca | git commit -v -a | | gca! | git commit -v -a --amend |
| gca! | git commit -v -a --amend | | gcan! | git commit -v -a --no-edit --amend |
| gcan! | git commit -v -a --no-edit --amend | | gcans! | git commit -v -a -s --no-edit --amend |
| gcans! | git commit -v -a -s --no-edit --amend | | gcam | git commit -a -m |
| gcam | git commit -a -m | | gcsm | git commit -s -m |
| gcsm | git commit -s -m | | gcb | git checkout -b |
| gcb | git checkout -b | | gcf | git config --list |
| gcf | git config --list | | gcl | git clone --recurse-submodules |
| gcl | git clone --recurse-submodules | | gclean | git clean -id |
| gclean | git clean -id | | gpristine | git reset --hard && git clean -dfx |
| gpristine | git reset --hard && git clean -dffx | | gcm | git checkout master |
| gcm | git checkout master | | gcd | git checkout develop |
| gcd | git checkout develop | | gcmsg | git commit -m |
| gcmsg | git commit -m | | gco | git checkout |
| gco | git checkout | | gcount | git shortlog -sn |
| gcount | git shortlog -sn | | gcp | git cherry-pick |
| gcp | git cherry-pick | | gcpa | git cherry-pick --abort |
| gcpa | git cherry-pick --abort | | gcpc | git cherry-pick --continue |
| gcpc | git cherry-pick --continue | | gcs | git commit -S |
| gcs | git commit -S | | gd | git diff |
| gd | git diff | | gdca | git diff --cached |
| gdca | git diff --cached | | gdcw | git diff --cached --word-diff |
| gdcw | git diff --cached --word-diff | | gdct | git describe --tags $(git rev-list --tags --max-count=1) |
| gdct | git describe --tags $(git rev-list --tags --max-count=1) | | gds | git diff --staged |
| gds | git diff --staged | | gdt | git diff-tree --no-commit-id --name-only -r |
| gdt | git diff-tree --no-commit-id --name-only -r | | gdv | git diff -w $@ \| view - |
| gdnolock | git diff $@ ":(exclude)package-lock.json" ":(exclude)&ast;.lock" | | gdw | git diff --word-diff |
| gdv | git diff -w $@ \| view - | | gf | git fetch |
| gdw | git diff --word-diff | | gfa | git fetch --all --prune |
| gf | git fetch | | gfg | git ls-files \| grep |
| gfa | git fetch --all --prune | | gfo | git fetch origin |
| gfg | git ls-files \| grep | | gg | git gui citool |
| gfo | git fetch origin | | gga | git gui citool --amend |
| gg | git gui citool | | ggf | git push --force origin $(current_branch) |
| gga | git gui citool --amend | | ggfl | git push --force-with-lease origin $(current_branch) |
| ggf | git push --force origin $(current_branch) | | ggl | git pull origin $(current_branch) |
| ggfl | git push --force-with-lease origin $(current_branch) | | ggp | git push origin $(current_branch) |
| ggl | git pull origin $(current_branch) | | ggpnp | ggl && ggp |
| ggp | git push origin $(current_branch) | | ggpull | git pull origin "$(git_current_branch)" |
| ggpnp | ggl && ggp | | ggpur | ggu |
| ggpull | git pull origin "$(git_current_branch)" | | ggpush | git push origin "$(git_current_branch)" |
| ggpur | ggu | | ggsup | git branch --set-upstream-to=origin/$(git_current_branch) |
| ggpush | git push origin "$(git_current_branch)" | | ggu | git pull --rebase origin $(current_branch) |
| ggsup | git branch --set-upstream-to=origin/$(git_current_branch) | | gpsup | git push --set-upstream origin $(git_current_branch) |
| ggu | git pull --rebase origin $(current_branch) | | ghh | git help |
| gpsup | git push --set-upstream origin $(git_current_branch) | | gignore | git update-index --assume-unchanged |
| ghh | git help | | gignored | git ls-files -v \| grep "^[[:lower:]]" |
| gignore | git update-index --assume-unchanged | | git-svn-dcommit-push | git svn dcommit && git push github master:svntrunk |
| gignored | git ls-files -v \| grep "^[[:lower:]]" | | gk | gitk --all --branches |
| git-svn-dcommit-push | git svn dcommit && git push github master:svntrunk | | gke | gitk --all $(git log -g --pretty=%h) |
| gk | gitk --all --branches | | gl | git pull |
| gke | gitk --all $(git log -g --pretty=%h) | | glg | git log --stat |
| gl | git pull | | glgp | git log --stat -p |
| glg | git log --stat | | glgg | git log --graph |
| glgp | git log --stat -p | | glgga | git log --graph --decorate --all |
| glgg | git log --graph | | glgm | git log --graph --max-count=10 |
| glgga | git log --graph --decorate --all | | glo | git log --oneline --decorate |
| glgm | git log --graph --max-count=10 | | glol | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' |
| glo | git log --oneline --decorate | | glols | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat |
| glol | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' | | glod | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' |
| glols | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat | | glods | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short |
| glod | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' | | glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all |
| glods | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short | | glog | git log --oneline --decorate --graph |
| glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all | | gloga | git log --oneline --decorate --graph --all |
| glog | git log --oneline --decorate --graph | | glp | `_git_log_prettily` |
| gloga | git log --oneline --decorate --graph --all | | gm | git merge |
| glp | git log --pretty=\<format\> | | gmom | git merge origin/master |
| gm | git merge | | gmt | git mergetool --no-prompt |
| gmom | git merge origin/master | | gmtvim | git mergetool --no-prompt --tool=vimdiff |
| gmt | git mergetool --no-prompt | | gmum | git merge upstream/master |
| gmtvim | git mergetool --no-prompt --tool=vimdiff | | gma | git merge --abort |
| gmum | git merge upstream/master | | gp | git push |
| gma | git merge --abort | | gpd | git push --dry-run |
| gp | git push | | gpf | git push --force-with-lease |
| gpd | git push --dry-run | | gpf! | git push --force |
| gpf | git push --force-with-lease | | gpoat | git push origin --all && git push origin --tags |
| gpf! | git push --force | | gpu | git push upstream |
| gpoat | git push origin --all && git push origin --tags | | gpv | git push -v |
| gpu | git push upstream | | gr | git remote |
| gpv | git push -v | | gra | git remote add |
| gr | git remote | | grb | git rebase |
| gra | git remote add | | grba | git rebase --abort |
| grb | git rebase | | grbc | git rebase --continue |
| grba | git rebase --abort | | grbd | git rebase develop |
| grbc | git rebase --continue | | grbi | git rebase -i |
| grbd | git rebase develop | | grbm | git rebase master |
| grbi | git rebase -i | | grbs | git rebase --skip |
| grbm | git rebase master | | grev | git revert |
| grbs | git rebase --skip | | grh | git reset |
| grev | git revert | | grhh | git reset --hard |
| grh | git reset | | groh | git reset origin/$(git_current_branch) --hard |
| grhh | git reset --hard | | grm | git rm |
| groh | git reset origin/$(git_current_branch) --hard | | grmc | git rm --cached |
| grm | git rm | | grmv | git remote rename |
| grmc | git rm --cached | | grrm | git remote remove |
| grmv | git remote rename | | grs | git restore |
| grrm | git remote remove | | grset | git remote set-url |
| grs | git restore | | grss | git restore --source |
| grset | git remote set-url | | grt | cd "$(git rev-parse --show-toplevel \|\| echo .)" |
| grss | git restore --source | | gru | git reset -- |
| grt | cd "$(git rev-parse --show-toplevel \|\| echo .)" | | grup | git remote update |
| gru | git reset -- | | grv | git remote -v |
| grup | git remote update | | gsb | git status -sb |
| grv | git remote -v | | gsd | git svn dcommit |
| gsb | git status -sb | | gsh | git show |
| gsd | git svn dcommit | | gsi | git submodule init |
| gsh | git show | | gsps | git show --pretty=short --show-signature |
| gsi | git submodule init | | gsr | git svn rebase |
| gsps | git show --pretty=short --show-signature | | gss | git status -s |
| gsr | git svn rebase | | gst | git status |
| gss | git status -s | | gsta | git stash push |
| gst | git status | | gsta | git stash save |
| gsta | git stash push | | gstaa | git stash apply |
| gsta | git stash save | | gstc | git stash clear |
| gstaa | git stash apply | | gstd | git stash drop |
| gstc | git stash clear | | gstl | git stash list |
| gstd | git stash drop | | gstp | git stash pop |
| gstl | git stash list | | gsts | git stash show --text |
| gstp | git stash pop | | gstall | git stash --all |
| gsts | git stash show --text | | gsu | git submodule update |
| gstu | git stash --include-untracked | | gsw | git switch |
| gstall | git stash --all | | gswc | git switch -c |
| gsu | git submodule update | | gts | git tag -s |
| gsw | git switch | | gtv | git tag \| sort -V |
| gswc | git switch -c | | gtl | gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl |
| gts | git tag -s | | gunignore | git update-index --no-assume-unchanged |
| gtv | git tag \| sort -V | | gunwip | git log -n 1 \| grep -q -c "\-\-wip\-\-" && git reset HEAD~1 |
| gtl | gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl | | gup | git pull --rebase |
| gunignore | git update-index --no-assume-unchanged | | gupv | git pull --rebase -v |
| gunwip | git log -n 1 \| grep -q -c "\-\-wip\-\-" && git reset HEAD~1 | | gupa | git pull --rebase --autostash |
| gup | git pull --rebase | | gupav | git pull --rebase --autostash -v |
| gupv | git pull --rebase -v | | glum | git pull upstream master |
| gupa | git pull --rebase --autostash | | gwch | git whatchanged -p --abbrev-commit --pretty=medium |
| gupav | git pull --rebase --autostash -v | | gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" |
| glum | git pull upstream master |
| gwch | git whatchanged -p --abbrev-commit --pretty=medium |
| gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" |
| gam | git am |
| gamc | git am --continue |
| gams | git am --skip |
| gama | git am --abort |
| gamscp | git am --show-current-patch |
### Deprecated aliases ### Deprecated
These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not, receive further support. These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not, receive further support.
| Alias | Command | Modification | | Alias | Command | Modification |
| :----- | :----------------------------------------------------- | :----------------------------------------------------- | | :----- | :----------------------------------------------------------------------------------| --------------------------------------------------------------------------------------------------- |
| gap | `git add --patch` | new alias `gapa` | | gap | git add --patch | new alias `gapa` |
| gcl | `git config --list` | new alias `gcf` | | gcl | git config --list | new alias `gcf` |
| gdc | `git diff --cached` | new alias `gdca` | | gdc | git diff --cached | new alias `gdca` |
| gdt | `git difftool` | no replacement | | gdt | git difftool | no replacement |
| ggpull | `git pull origin $(current_branch)` | new alias `ggl` (`ggpull` still exists for now though) | | ggpull | git pull origin $(current_branch) | new alias `ggl` (`ggpull` still exists for now though) |
| ggpur | `git pull --rebase origin $(current_branch)` | new alias `ggu` (`ggpur` still exists for now though) | | ggpur | git pull --rebase origin $(current_branch) | new alias `ggu` (`ggpur` still exists for now though) |
| ggpush | `git push origin $(current_branch)` | new alias `ggp` (`ggpush` still exists for now though) | | ggpush | git push origin $(current_branch) | new alias `ggp` (`ggpush` still exists for now though) |
| gk | `gitk --all --branches` | now aliased to `gitk --all --branches` | | gk | gitk --all --branches | now aliased to `gitk --all --branches` |
| glg | `git log --stat --max-count = 10` | now aliased to `git log --stat --color` | | glg | git log --stat --max-count = 10 | now aliased to `git log --stat --color` |
| glgg | `git log --graph --max-count = 10` | now aliased to `git log --graph --color` | | glgg | git log --graph --max-count = 10 | now aliased to `git log --graph --color` |
| gwc | `git whatchanged -p --abbrev-commit --pretty = medium` | new alias `gwch` | | gwc | git whatchanged -p --abbrev-commit --pretty = medium | new alias `gwch` |
## Functions ## Functions
### Current ### Current
| Command | Description | | Command | Description |
|:-----------------------|:---------------------------------------------------------| |:-----------------------|:----------------------------------------|
| `grename <old> <new>` | Rename `old` branch to `new`, including in origin remote | | current_branch | Return the name of the current branch |
| current_branch | Return the name of the current branch | | git_current_user_name | Returns the `user.name` config value |
| git_current_user_name | Returns the `user.name` config value | | git_current_user_email | Returns the `user.email` config value |
| git_current_user_email | Returns the `user.email` config value |
### Work in Progress (WIP) ### Work in Progress (WIP)
@ -218,7 +209,7 @@ These features allow to pause a branch development and switch to another one (_"
| gwip | Commit wip branch | | gwip | Commit wip branch |
| gunwip | Uncommit wip branch | | gunwip | Uncommit wip branch |
### Deprecated functions ### Deprecated
| Command | Description | Reason | | Command | Description | Reason |
|:-----------------------|:----------------------------------------|:----------------------------------------------------------------| |:-----------------------|:----------------------------------------|:----------------------------------------------------------------|

View File

@ -38,12 +38,11 @@ alias gapa='git add --patch'
alias gau='git add --update' alias gau='git add --update'
alias gav='git add --verbose' alias gav='git add --verbose'
alias gap='git apply' alias gap='git apply'
alias gapt='git apply --3way'
alias gb='git branch' alias gb='git branch'
alias gba='git branch -a' alias gba='git branch -a'
alias gbd='git branch -d' alias gbd='git branch -d'
alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*(master|development|develop|devel|dev)\s*$)" | command xargs -n 1 git branch -d' alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d'
alias gbD='git branch -D' alias gbD='git branch -D'
alias gbl='git blame -b -w' alias gbl='git blame -b -w'
alias gbnm='git branch --no-merged' alias gbnm='git branch --no-merged'
@ -67,7 +66,7 @@ alias gcb='git checkout -b'
alias gcf='git config --list' alias gcf='git config --list'
alias gcl='git clone --recurse-submodules' alias gcl='git clone --recurse-submodules'
alias gclean='git clean -id' alias gclean='git clean -id'
alias gpristine='git reset --hard && git clean -dffx' alias gpristine='git reset --hard && git clean -dfx'
alias gcm='git checkout master' alias gcm='git checkout master'
alias gcd='git checkout develop' alias gcd='git checkout develop'
alias gcmsg='git commit -m' alias gcmsg='git commit -m'
@ -86,11 +85,6 @@ alias gds='git diff --staged'
alias gdt='git diff-tree --no-commit-id --name-only -r' alias gdt='git diff-tree --no-commit-id --name-only -r'
alias gdw='git diff --word-diff' alias gdw='git diff --word-diff'
function gdnolock() {
git diff "$@" ":(exclude)package-lock.json" ":(exclude)*.lock"
}
compdef _git gdnolock=git-diff
function gdv() { git diff -w "$@" | view - } function gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff compdef _git gdv=git-diff
@ -242,7 +236,6 @@ alias gstd='git stash drop'
alias gstl='git stash list' alias gstl='git stash list'
alias gstp='git stash pop' alias gstp='git stash pop'
alias gsts='git stash show --text' alias gsts='git stash show --text'
alias gstu='git stash --include-untracked'
alias gstall='git stash --all' alias gstall='git stash --all'
alias gsu='git submodule update' alias gsu='git submodule update'
alias gsw='git switch' alias gsw='git switch'
@ -262,23 +255,3 @@ alias glum='git pull upstream master'
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"' alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"'
alias gam='git am'
alias gamc='git am --continue'
alias gams='git am --skip'
alias gama='git am --abort'
alias gamscp='git am --show-current-patch'
function grename() {
if [[ -z "$1" || -z "$2" ]]; then
echo "Usage: $0 old_branch new_branch"
return 1
fi
# Rename branch locally
git branch -m "$1" "$2"
# Rename branch in origin remote
if git push origin :"$1"; then
git push --set-upstream origin "$2"
fi
}

View File

@ -1,6 +1,6 @@
# Gitfast plugin # Gitfast plugin
This plugin adds completion for Git, using the zsh completion from git.git folks, which is much faster than the official one from zsh. A lot of zsh-specific features are not supported, like descriptions for every argument, but everything the bash completion has, this one does too (as it is using it behind the scenes). Not only is it faster, it should be more robust, and updated regularly to the latest git upstream version. This plugin adds completion for Git, using the zsh completion from git.git folks, which is much faster than the official one from zsh. A lot of zsh-specific features are not supported, like descriptions for every argument, but everything the bash completion has, this one does too (as it is using it behind the scenes). Not only is it faster, it should be more robust, and updated regularly to the latest git upstream version..
To use it, add `gitfast` to the plugins array in your zshrc file: To use it, add `gitfast` to the plugins array in your zshrc file:

View File

@ -30,7 +30,7 @@ if [ -z "$script" ]; then
local -a locations local -a locations
local e local e
locations=( locations=(
"$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash" $(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
'/etc/bash_completion.d/git' # fedora, old debian '/etc/bash_completion.d/git' # fedora, old debian
'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian '/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
'/usr/share/bash-completion/git' # gentoo '/usr/share/bash-completion/git' # gentoo
@ -39,7 +39,7 @@ if [ -z "$script" ]; then
test -f $e && script="$e" && break test -f $e && script="$e" && break
done done
fi fi
ZSH_VERSION='' . "$script" GIT_SOURCING_ZSH_COMPLETION=y . "$script"
__gitcomp () __gitcomp ()
{ {
@ -93,13 +93,22 @@ __gitcomp_nl_append ()
compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0 compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
} }
__gitcomp_file_direct ()
{
emulate -L zsh
local IFS=$'\n'
compset -P '*[=:]'
compadd -f -- ${=1} && _ret=0
}
__gitcomp_file () __gitcomp_file ()
{ {
emulate -L zsh emulate -L zsh
local IFS=$'\n' local IFS=$'\n'
compset -P '*[=:]' compset -P '*[=:]'
compadd -Q -p "${2-}" -f -- ${=1} && _ret=0 compadd -p "${2-}" -f -- ${=1} && _ret=0
} }
__git_zsh_bash_func () __git_zsh_bash_func ()
@ -223,10 +232,8 @@ _git ()
if (( $+functions[__${service}_zsh_main] )); then if (( $+functions[__${service}_zsh_main] )); then
__${service}_zsh_main __${service}_zsh_main
elif (( $+functions[__${service}_main] )); then else
emulate ksh -c __${service}_main emulate ksh -c __${service}_main
elif (( $+functions[_${service}] )); then
emulate ksh -c _${service}
fi fi
let _ret && _default && _ret=0 let _ret && _default && _ret=0

File diff suppressed because it is too large Load Diff

View File

@ -219,7 +219,7 @@ __git_ps1_show_upstream ()
if [[ -n "$count" && -n "$name" ]]; then if [[ -n "$count" && -n "$name" ]]; then
__git_ps1_upstream_name=$(git rev-parse \ __git_ps1_upstream_name=$(git rev-parse \
--abbrev-ref "$upstream" 2>/dev/null) --abbrev-ref "$upstream" 2>/dev/null)
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then if [ "$pcmode" = yes ] && [ "$ps1_expanded" = yes ]; then
p="$p \${__git_ps1_upstream_name}" p="$p \${__git_ps1_upstream_name}"
else else
p="$p ${__git_ps1_upstream_name}" p="$p ${__git_ps1_upstream_name}"
@ -237,7 +237,7 @@ __git_ps1_show_upstream ()
# to build a gitstring. # to build a gitstring.
__git_ps1_colorize_gitstring () __git_ps1_colorize_gitstring ()
{ {
if [[ -n ${ZSH_VERSION-} ]]; then if [[ -n "${ZSH_VERSION-}" ]]; then
local c_red='%F{red}' local c_red='%F{red}'
local c_green='%F{green}' local c_green='%F{green}'
local c_lblue='%F{blue}' local c_lblue='%F{blue}'
@ -255,7 +255,7 @@ __git_ps1_colorize_gitstring ()
local flags_color="$c_lblue" local flags_color="$c_lblue"
local branch_color="" local branch_color=""
if [ $detached = no ]; then if [ "$detached" = no ]; then
branch_color="$ok_color" branch_color="$ok_color"
else else
branch_color="$bad_color" branch_color="$bad_color"
@ -508,13 +508,13 @@ __git_ps1 ()
# NO color option unless in PROMPT_COMMAND mode or it's Zsh # NO color option unless in PROMPT_COMMAND mode or it's Zsh
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then if [ "$pcmode" = yes ] || [ -n "${ZSH_VERSION-}" ]; then
__git_ps1_colorize_gitstring __git_ps1_colorize_gitstring
fi fi
fi fi
b=${b##refs/heads/} b=${b##refs/heads/}
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then if [ "$pcmode" = yes ] && [ "$ps1_expanded" = yes ]; then
__git_ps1_branch_name=$b __git_ps1_branch_name=$b
b="\${__git_ps1_branch_name}" b="\${__git_ps1_branch_name}"
fi fi
@ -522,7 +522,7 @@ __git_ps1 ()
local f="$w$i$s$u" local f="$w$i$s$u"
local gitstring="$c$b${f:+$z$f}$r$p" local gitstring="$c$b${f:+$z$f}$r$p"
if [ $pcmode = yes ]; then if [ "$pcmode" = yes ]; then
if [ "${__git_printf_supports_v-}" != yes ]; then if [ "${__git_printf_supports_v-}" != yes ]; then
gitstring=$(printf -- "$printf_format" "$gitstring") gitstring=$(printf -- "$printf_format" "$gitstring")
else else

View File

@ -1,4 +1,4 @@
# github plugin # github
This plugin supports working with GitHub from the command line. It provides a few things: This plugin supports working with GitHub from the command line. It provides a few things:
@ -6,7 +6,7 @@ This plugin supports working with GitHub from the command line. It provides a fe
* Completion for the `github` Ruby gem. * Completion for the `github` Ruby gem.
* Convenience functions for working with repos and URLs. * Convenience functions for working with repos and URLs.
### Functions ### Functions
* `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub * `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub
* `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub * `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub
@ -14,13 +14,13 @@ This plugin supports working with GitHub from the command line. It provides a fe
* `git.io` - Shortens a URL using [git.io](https://git.io) * `git.io` - Shortens a URL using [git.io](https://git.io)
## Installation ## Installation
[Hub](https://github.com/github/hub) needs to be installed if you want to use it. On OS X with Homebrew, this can be done with `brew install hub`. The `hub` completion definition needs to be added to your `$FPATH` before initializing OMZ. [Hub](https://github.com/github/hub) needs to be installed if you want to use it. On OS X with Homebrew, this can be done with `brew install hub`. The `hub` completion definition needs to be added to your `$FPATH` before initializing OMZ.
The [`github` Ruby gem](https://github.com/defunkt/github-gem) needs to be installed if you want to use it. The [`github` Ruby gem](https://github.com/defunkt/github-gem) needs to be installed if you want to use it.
### Configuration ### Configuration
These settings affect `github`'s behavior. These settings affect `github`'s behavior.
@ -35,7 +35,7 @@ These settings affect `github`'s behavior.
See `man hub` for more details. See `man hub` for more details.
### Homebrew installation note ### Homebrew installation note
If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which will be on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`. If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which will be on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`.

View File

@ -1,4 +1,4 @@
function gi() { curl -fLw '\n' https://www.gitignore.io/api/"${(j:,:)@}" } function gi() { curl -fL https://www.gitignore.io/api/${(j:,:)@} }
_gitignoreio_get_command_list() { _gitignoreio_get_command_list() {
curl -sfL https://www.gitignore.io/api/list | tr "," "\n" curl -sfL https://www.gitignore.io/api/list | tr "," "\n"

View File

@ -36,7 +36,7 @@ __gnu_utils() {
gcmds+=('gfind' 'gxargs' 'glocate') gcmds+=('gfind' 'gxargs' 'glocate')
# Not part of either coreutils or findutils, installed separately. # Not part of either coreutils or findutils, installed separately.
gcmds+=('gsed' 'gtar' 'gtime' 'gmake') gcmds+=('gsed' 'gtar' 'gtime')
for gcmd in "${gcmds[@]}"; do for gcmd in "${gcmds[@]}"; do
# Do nothing if the command isn't found # Do nothing if the command isn't found

View File

@ -1,3 +0,0 @@
print -P "%F{yellow}The 'go' plugin is deprecated. Use the '%Ugolang%u' plugin instead.%f"
source "$ZSH/plugins/golang/golang.plugin.zsh"

View File

@ -0,0 +1 @@
../golang/golang.plugin.zsh

View File

@ -3,7 +3,6 @@
Enables [GPG's gpg-agent](https://www.gnupg.org/documentation/manuals/gnupg/) if it is not running. Enables [GPG's gpg-agent](https://www.gnupg.org/documentation/manuals/gnupg/) if it is not running.
To use it, add gpg-agent to the plugins array of your zshrc file: To use it, add gpg-agent to the plugins array of your zshrc file:
```
```zsh
plugins=(... gpg-agent) plugins=(... gpg-agent)
``` ```

View File

@ -1,4 +1,4 @@
# Gradle plugin ## Gradle Plugin
This plugin adds completions and aliases for [Gradle](https://gradle.org/). This plugin adds completions and aliases for [Gradle](https://gradle.org/).
@ -10,15 +10,9 @@ plugins=(... gradle)
## Usage ## Usage
This plugin creates a function called `gradle-or-gradlew`, which is aliased This plugin creates an alias `gradle` which is used to determine whether the current working directory has a gradlew file. If gradlew is present it will be used otherwise `gradle` is used directly. Gradle tasks can be executed directly without regard for whether it is `gradle` or `gradlew`
to `gradle`, which is used to determine whether the current project directory
has a gradlew file. If `gradlew` is present it will be used, otherwise `gradle`
is used instead. Gradle tasks can be executed directly without regard for
whether it is `gradle` or `gradlew`. It also supports being called from
any directory inside the root project directory.
Examples: Examples:
```zsh ```zsh
gradle test gradle test
gradle build gradle build
@ -26,5 +20,4 @@ gradle build
## Completion ## Completion
This plugin uses [the completion from the Gradle project](https://github.com/gradle/gradle-completion), The completion provided for this plugin caches the parsed tasks into a file named `.gradletasknamecache` in the current working directory, so you might want to add that to your `.gitignore` file so that it's not accidentally committed.
which is distributed under the MIT license.

View File

@ -1,420 +0,0 @@
#compdef gradle gradlew gw
#
# Taken from https://github.com/gradle/gradle-completion
# Copyright (c) 2017 Eric Wendelin
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# Terms
__gradle-set-project-root-dir() {
local dir=`pwd`
project_root_dir=`pwd`
while [[ $dir != '/' ]]; do
if [[ -f "$dir/settings.gradle" || -f "$dir/settings.gradle.kts" || -f "$dir/gradlew" ]]; then
project_root_dir=$dir
return 0
fi
dir="$(dirname "$dir")"
done
return 1
}
__gradle-init-cache-dir() {
cache_dir="$HOME/.gradle/completion"
mkdir -p $cache_dir
}
__gradle-set-settings-file() {
# In order of precedence: --settings-file=filename, settings.gradle, settings.gradle.kts
local default_gradle_settings_file="$project_root_dir/settings.gradle"
if [[ ! -f $default_gradle_settings_file ]]; then
default_gradle_settings_file="$project_root_dir/settings.gradle.kts"
fi
gradle_settings_file=${${(v)opt_args[(i)-c|--settings-file]}:-$default_gradle_settings_file}
}
__gradle-set-build-file() {
__gradle-set-settings-file
# In order of precedence: --build-file=filename, rootProject.buildFileName, build.gradle, build.gradle.kts
local default_gradle_build_file_name="build.gradle"
if [[ -r $gradle_settings_file ]]; then
default_gradle_build_file_name=${$(grep "^rootProject\.buildFileName" $gradle_settings_file | \
sed -n -e "s/rootProject\.buildFileName = [\'\"]\(.*\)[\'\"]/\1/p")}
default_gradle_build_file_name="${default_gradle_build_file:-build.gradle}"
fi
local default_gradle_build_file="$project_root_dir/$default_gradle_build_file_name"
if [[ ! -f $default_gradle_build_file ]]; then
default_gradle_build_file="$project_root_dir/build.gradle.kts"
fi
# If a build file is specified after '-b' or '--build-file', use this file.
gradle_build_file=${${(v)opt_args[(i)-b|--build-file]}:-$default_gradle_build_file}
}
__gradle-set-cache-name() {
# Cache name is constructed from the absolute path of the build file.
cache_name=${${gradle_build_file:a}//[^[:alnum:]]/_}
}
__gradle-set-files-checksum() {
# Cache MD5 sum of all Gradle scripts and modified timestamps
if builtin command -v md5 > /dev/null; then
gradle_files_checksum=( $(md5 -q -s "$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null)") )
elif builtin command -v md5sum > /dev/null; then
gradle_files_checksum=( $(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null | md5sum | awk '{print $1}') )
else
_message 'Cannot generate completions as neither md5 nor md5sum exist on \$PATH'
return 1
fi
}
__gradle-generate-script-cache() {
# Invalidate cache after 3 weeks by default
local cache_ttl_mins=${$(echo $GRADLE_CACHE_TTL_MINUTES):-30240}
local script_exclude_pattern=${$(echo $GRADLE_COMPLETION_EXCLUDE_PATTERN):-"/(.git|build|integTest|samples|templates|smokeTest|testFixtures|out)/"}
if [[ ! $(find $cache_dir/$cache_name -mmin -$cache_ttl_mins 2>/dev/null) ]]; then
zle -R "Generating Gradle build script cache"
# Cache all Gradle scripts
local -a gradle_build_scripts
gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | egrep -v "$script_exclude_pattern") )
printf "%s\n" "${gradle_build_scripts[@]}" >| $cache_dir/$cache_name
fi
}
__gradle-generate-tasks-cache() {
__gradle-set-files-checksum
# Use Gradle wrapper when it exists.
local gradle_cmd="gradle"
if [[ -x "$project_root_dir/gradlew" ]]; then
gradle_cmd="$project_root_dir/gradlew"
fi
zle -R "Generating Gradle task cache from $gradle_build_file"
# Run gradle to retrieve possible tasks and cache.
# Reuse Gradle Daemon if IDLE but don't start a new one.
local gradle_tasks_output
if [[ ! -z "$($gradle_cmd --status 2>/dev/null | grep IDLE)" ]]; then
gradle_tasks_output="$($gradle_cmd --daemon --build-file $gradle_build_file -q tasks --all 2>/dev/null)"
else
gradle_tasks_output="$($gradle_cmd --no-daemon --build-file $gradle_build_file -q tasks --all 2>/dev/null)"
fi
local gradle_all_tasks="" root_tasks="" subproject_tasks="" output_line
local -a match
for output_line in ${(f)"$(printf "%s\n" "${gradle_tasks_output[@]}")"}; do
if [[ $output_line =~ ^([[:lower:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then
local task_name="${match[1]}"
local task_description="${match[3]}"
# Completion for subproject tasks with ':' prefix
if [[ $task_name =~ ^([[:alnum:][:punct:]]+):([[:alnum:]]+) ]]; then
gradle_all_tasks+="${task_name//:/\\:}:$task_description\n\\:${task_name//:/\\:}:$task_description\n"
subproject_tasks+="${match[2]}\n"
else
gradle_all_tasks+="${task_name//:/\\:}:$task_description\n"
root_tasks+="$task_name\n"
fi
fi
done
# subproject tasks can be referenced implicitly from root project
if [[ $GRADLE_COMPLETION_UNQUALIFIED_TASKS == "true" ]]; then
local -a implicit_tasks
implicit_tasks=( $(comm -23 <(echo $subproject_tasks | sort) <(echo $root_tasks | sort)) )
for task in $(printf "%s\n" "${implicit_tasks[@]}"); do
gradle_all_tasks+="$task\n"
done
fi
echo $gradle_all_tasks >| $cache_dir/$gradle_files_checksum
echo $gradle_files_checksum >| $cache_dir/$cache_name.md5
}
__gradle-completion-init() {
local cache_dir cache_name gradle_build_file gradle_files_checksum project_root_dir
__gradle-init-cache-dir
__gradle-set-project-root-dir
__gradle-set-build-file
if [[ -f $gradle_build_file ]]; then
__gradle-set-cache-name
__gradle-generate-script-cache
__gradle-set-files-checksum
__gradle-generate-tasks-cache
fi
return 0
}
__gradle_tasks() {
local cache_dir cache_name gradle_build_file gradle_files_checksum project_root_dir
__gradle-init-cache-dir
__gradle-set-project-root-dir
__gradle-set-build-file
if [[ -f $gradle_build_file ]]; then
__gradle-set-cache-name
__gradle-generate-script-cache
__gradle-set-files-checksum
# The cache key is md5 sum of all gradle scripts, so it's valid if it exists.
if [[ -f $cache_dir/$cache_name.md5 ]]; then
local cached_checksum="$(cat $cache_dir/$cache_name.md5)"
local -a cached_tasks
if [[ -z $cur ]]; then
cached_tasks=(${(f)"$(cat $cache_dir/$cached_checksum)"})
else
cached_tasks=(${(f)"$(grep "^${cur//:/\\\\:}" $cache_dir/$cached_checksum)"})
fi
_describe 'all tasks' cached_tasks && ret=0
else
__gradle-generate-tasks-cache
fi
# Regenerate tasks cache in the background
if [[ $gradle_files_checksum != "$(cat $cache_dir/$cache_name.md5)" || ! -f $cache_dir/$gradle_files_checksum || $(wc -c < $cache_dir/$gradle_files_checksum) -le 1 ]]; then
$(__gradle-generate-tasks-cache 1>&2 2>/dev/null &)
fi
else
_describe 'built-in tasks' '(
"buildEnvironment:Displays all buildscript dependencies declared in root project."
"components:Displays the components produced by root project."
"dependencies:Displays all dependencies declared in root project."
"dependencyInsight:Displays the insight into a specific dependency in root project."
"dependentComponents:Displays the dependent components of components in root project."
"help:Displays a help message."
"init:Initializes a new Gradle build."
"model:Displays the configuration model of root project."
"projects:Displays the sub-projects of root project."
"properties:Displays the properties of root project."
"tasks:Displays the tasks runnable from root project."
"wrapper:Generates Gradle wrapper files."
)' && ret=0
fi
}
__gradle_subcommand() {
integer ret=1
case "$words[1]" in
(dependencies)
_arguments \
'--configuration=[The configuration to generate the report for.]:dependency configuration:_gradle_dependency_configurations' && ret=0
;;
(dependencyInsight)
_arguments \
'--dependency=[Shows the details of given dependency.]' \
'--configuration=[Looks for the dependency in given configuration.]:dependency configuration:_gradle_dependency_configurations' && ret=0
;;
(help)
_arguments \
'--task[The task to show help for.]' && ret=0
;;
(init)
_arguments \
'--dsl=[DSL to be used in generated scripts.]:dsl:(groovy kotlin)' \
'--package=[Package for the generated source.]' \
'--project-name=[Name of the generated project.]' \
'--test-framework=[Test framework to be used.]:test framework:(junit kotlintest scalatest spock testng)' \
'--type=[Project type to generate.]:project type:(basic cpp-application cpp-library groovy-application groovy-library java-application java-library kotlin-application kotlin-library pom scala-library)' && ret=0
;;
(tasks)
_arguments \
'--all[List all tasks, including subproject tasks.]' \
'--group=[Show tasks only from given task group.]' && ret=0
;;
(test)
_arguments -C \
'--debug-jvm[Enable debugging for the test process. The process is started suspended and listening on port 5005. Requires the "java" plugin.]' \
'--fail-fast[Stops test execution after the first failed test. Requires the "java" plugin.]' \
'--tests=[Sets test class or method name to be included, * is supported. Requires the "java" plugin.]' \
'(-)*:: :->task-or-option' && ret=0
;;
(wrapper)
_arguments \
'--distribution-type=[Binary-only or all with docs and sources]:*:distribution type:(bin all)' \
'--gradle-version=[Set Gradle version for wrapper]' \
'--gradle-distribution-sha256-sum=[SHA-256 checksum]' \
'--gradle-distribution-url=[Set Gradle distribution URL]' && ret=0
;;
(*)
_arguments -C \
{-a,--no-rebuild}'[Do not rebuild project dependencies.]' \
'(--no-build-cache)--build-cache[Enable the Gradle build cache.]' \
{-b,--build-file}'[Specifies the build file.]:build script:_files -g \*.gradle' \
{-C,--cache}'[Specifies how compiled build scripts should be cached.]:cache policy:(on rebuild)' \
{-c,--settings-file}'[Specifies the settings file.]:settings file:_files -g \*.gradle' \
'(--no-configure-on-demand)--configure-on-demand[Only relevant projects are configured in this build run.]' \
'--console=[Specifies which type of console output to generate.]:console output type:(plain auto rich verbose)' \
'--continue[Continues task execution after a task failure.]' \
'-Dorg.gradle.cache.reserved.mb=[Reserve Gradle Daemon memory for operations.]' \
'-Dorg.gradle.caching=[Set true to enable Gradle build cache.]:enable build cache:(true false)' \
'-Dorg.gradle.console=[Set type of console output to generate.]:console output type:(plain auto rich verbose)' \
'-Dorg.gradle.daemon.debug=[Set true to debug Gradle Daemon.]:enable daemon debug:(true false)' \
'-Dorg.gradle.daemon.idletimeout=[Kill Gradle Daemon after # idle millis.]' \
'-Dorg.gradle.debug=[Set true to debug Gradle Client.]' \
'-Dorg.gradle.jvmargs=[Set JVM arguments.]' \
'-Dorg.gradle.java.home=[Set JDK home dir.]' \
'-Dorg.gradle.logging.level=[Set default Gradle log level.]:log level:(quiet warn lifecycle info debug)' \
'-Dorg.gradle.parallel=[Set true to enable parallel project builds.]:enable parallel build:(true false)' \
'-Dorg.gradle.priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \
'-Dorg.gradle.warning.mode=[Set types of warnings to log.]:warning level:(all summary none)' \
'-Dorg.gradle.workers.max=[Set the number of workers Gradle is allowed to use.]' \
'(-i --info -w --warn -q --quiet)'{-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \
'(--no-daemon)--daemon[Uses the Gradle daemon to run the build. Starts the daemon if not running.]' \
'--foreground[Starts the Gradle daemon in the foreground.]' \
{-g,--gradle-user-home}'[Specifies the gradle user home directory.]:file:_directories' \
\*--include-build'[Includes the specified build in the composite.]:file:_directories' \
\*{-I,--init-script}'[Specifies an initialization script.]:init script:_files -g \*.gradle' \
'(-d --debug -w --warn -q --quiet)'{-i,--info}'[Set log level to info.]' \
'--max-workers[Set the maximum number of concurrent workers that Gradle may use.]:number workers' \
{-m,--dry-run}'[Runs the builds with all task actions disabled.]' \
'--no-color[Do not use color in the console output. (Removed in Gradle 3.0)]' \
'(--build-cache)--no-build-cache[Do not use the Gradle build cache.]' \
'(--configure-on-demand)--no-configure-on-demand[Disables configuration on demand.]' \
'(--daemon)--no-daemon[Do not use the Gradle daemon to run the build.]' \
'(--parallel)--no-parallel[Disables parallel execution to build projects.]' \
'(--scan)--no-scan[Do not create a build scan.]' \
'--offline[The build should operate without accessing network resources.]' \
\*{-P+,--project-prop}'[Set project property for the build script (e.g. -Pmyprop=myvalue).]:project property (prop=val):' \
{-p,--project-dir}'[Specifies the start directory for Gradle.]:start directory:_directories' \
'(--no-parallel)--parallel[Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]' \
'--profile[Profiles build execution time and generates a report in the <build_dir>/reports/profile directory.]' \
'--priority[Set priority for Gradle worker processes.]:priority:(low normal)' \
'--project-cache-dir[Specifies the project-specific cache directory.]:cache directory:_directories' \
'(-d --debug -w --warn -i --info)'{-q,--quiet}'[Log errors only.]' \
'--recompile-scripts[Force build script recompiling.]' \
'--refresh[Refresh the state of resources of the type(s) specified.]:refresh policy:(dependencies)' \
'--refresh-dependencies[Refresh the state of dependencies.]' \
'--rerun-tasks[Ignore previously cached task results.]' \
'(--no-scan)--scan[Create a build scan.]' \
'(-S --full-stacktrace)'{-s,--stacktrace}'[Print out the stacktrace for all exceptions.]' \
'(-s --stacktrace)'{-S,--full-stacktrace}'[Print out the full (very verbose) stacktrace for all exceptions.]' \
'--system-prop[system property (prop=val)]' \
{-t,--continuous}'[Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.]' \
{-u,--no-search-upward}"[Don't search in parent folders for a settings.gradle file.]" \
'(--write-locks)--update-locks[Perform a partial update of the dependency lock.]' \
'(-d --debug -q --quiet -i --info)'{-w,--warn}'[Log warnings and errors only.]' \
'--warning-mode=[Set types of warnings to log.]:warning mode:(all summary none)' \
'(--update-locks)--write-locks[Persists dependency resolution for locked configurations.]' \
{-x,--exclude-task}'[Specify a task to be excluded from execution.]' && ret=0
;;
esac
return ret
}
(( $+functions[_gradle_dependency_configurations] )) ||
_gradle_dependency_configurations() {
local configurations
configurations=(
'compileClasspath'
'runtimeClasspath'
'testCompileClasspath'
'testRuntimeClasspath'
)
_describe -t 'dependency configurations' "dependency configuration" configurations
}
_gradle() {
local cur=${words[CURRENT]}
local curcontext="$curcontext" state
integer ret=1
typeset -A opt_args
_arguments -C \
'(-)'{-\?,-h,--help}'[Shows a help message.]' \
{-a,--no-rebuild}'[Do not rebuild project dependencies.]' \
'(--no-build-cache)--build-cache[Enable the Gradle build cache.]' \
{-b,--build-file}'[Specifies the build file.]:build script:_files -g \*.gradle' \
{-C,--cache}'[Specifies how compiled build scripts should be cached.]:cache policy:(on rebuild)' \
{-c,--settings-file}'[Specifies the settings file.]:settings file:_files -g \*.gradle:->argument-expected' \
'(--no-configure-on-demand)--configure-on-demand[Only relevant projects are configured in this build run.]' \
'--console=[Specifies which type of console output to generate.]:console output type:(plain auto rich verbose)' \
'--continue[Continues task execution after a task failure.]' \
'-Dorg.gradle.cache.reserved.mb=[Reserve Gradle Daemon memory for operations.]' \
'-Dorg.gradle.caching=[Set true to enable Gradle build cache.]' \
'-Dorg.gradle.console=[Set type of console output to generate.]:console output type:(plain auto rich verbose)' \
'-Dorg.gradle.daemon.debug=[Set true to debug Gradle Daemon.]' \
'-Dorg.gradle.daemon.idletimeout=[Kill Gradle Daemon after # idle millis.]' \
'-Dorg.gradle.debug=[Set true to debug Gradle Client.]' \
'-Dorg.gradle.jvmargs=[Set JVM arguments.]' \
'-Dorg.gradle.java.home=[Set JDK home dir.]' \
'-Dorg.gradle.logging.level=[Set default Gradle log level.]:log level:(quiet warn lifecycle info debug)' \
'-Dorg.gradle.parallel=[Set true to enable parallel project builds.]:(true false)' \
'-Dorg.gradle.priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \
'-Dorg.gradle.warning.mode=[Set types of warnings to log.]:warning level:(all summary none)' \
'-Dorg.gradle.workers.max=[Set the number of workers Gradle is allowed to use.]' \
'(-i --info -w --warn -q --quiet)'{-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \
'(--no-daemon)--daemon[Uses the Gradle daemon to run the build. Starts the daemon if not running.]' \
'--foreground[Starts the Gradle daemon in the foreground.]' \
{-g,--gradle-user-home}'[Specifies the gradle user home directory.]:home directory:_directories:->argument-expected' \
'(-)--gui[Launches the Gradle GUI. (Removed in Gradle 4.0)]' \
\*--include-build'[Includes the specified build in the composite.]:file:_directories:->argument-expected' \
\*{-I,--init-script}'[Specifies an initialization script.]:init script:_files -g \*.gradle:->argument-expected' \
'(-d --debug -w --warn -q --quiet)'{-i,--info}'[Set log level to info.]' \
'--max-workers[Set the maximum number of concurrent workers that Gradle may use.]:number workers:->argument-expected' \
{-m,--dry-run}'[Runs the builds with all task actions disabled.]' \
'--no-color[Do not use color in the console output. (Removed in Gradle 3.0)]' \
'(--build-cache)--no-build-cache[Do not use the Gradle build cache.]' \
'(--configure-on-demand)--no-configure-on-demand[Disables configuration on demand.]' \
'(--daemon)--no-daemon[Do not use the Gradle daemon to run the build.]' \
'(--parallel)--no-parallel[Disables parallel execution to build projects.]' \
'(--scan)--no-scan[Do not create a build scan.]' \
'--offline[The build should operate without accessing network resources.]' \
\*{-P+,--project-prop}'[Set project property for the build script (e.g. -Pmyprop=myvalue).]:project property (prop=val):->argument-expected' \
{-p,--project-dir}'[Specifies the start directory for Gradle.]:start directory:_directories:->argument-expected' \
'(--no-parallel)--parallel[Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]' \
'--priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \
'--profile[Profiles build execution time and generates a report in the <build_dir>/reports/profile directory.]' \
'--project-cache-dir=[Specifies the project-specific cache directory.]:cache directory:_directories:->argument-expected' \
'(-d --debug -w --warn -i --info)'{-q,--quiet}'[Log errors only.]' \
'--recompile-scripts[Force build script recompiling.]' \
'--refresh[Refresh the state of resources of the type(s) specified.]:refresh policy:(dependencies)' \
'--refresh-dependencies[Refresh the state of dependencies.]' \
'--rerun-tasks[Ignore previously cached task results.]' \
'(--no-scan)--scan[Create a build scan.]' \
'(-S --full-stacktrace)'{-s,--stacktrace}'[Print out the stacktrace for all exceptions.]' \
'(-s --stacktrace)'{-S,--full-stacktrace}'[Print out the full (very verbose) stacktrace for all exceptions.]' \
'(-)--status[Shows status of running and recently stopped Gradle Daemons.]' \
'(-)--stop[Stops all Gradle daemons.]' \
'--system-prop[system property (prop=val)]' \
{-t,--continuous}'[Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.]' \
{-u,--no-search-upward}"[Don't search in parent folders for a settings.gradle file.]" \
'(--write-locks)--update-locks[Perform a partial update of the dependency lock.]' \
'(-)'{-v,--version}'[Print version info.]' \
'(-d --debug -q --quiet -i --info)'{-w,--warn}'[Log warnings and errors only.]' \
'--warning-mode=[Set types of warnings to log.]:warning mode:(all summary none)' \
'(--update-locks)--write-locks[Persists dependency resolution for locked configurations.]' \
{-x,--exclude-task}'[Specify a task to be excluded from execution.]' \
'(-)*:: :->task-or-option' && ret=0
if [[ $words[CURRENT] != -* && $state != "argument-expected" ]]; then
__gradle_tasks && ret=0
else
curcontext=${curcontext%:*:*}:gradle-$words[1]:
__gradle_subcommand && ret=0
fi
return ret
}
_gradle "$@"

View File

@ -0,0 +1 @@
gradle.plugin.zsh

View File

@ -0,0 +1 @@
gradle.plugin.zsh

View File

@ -1,26 +1,184 @@
# Looks for a gradlew file in the current working directory ##############################################################################
# or any of its parent directories, and executes it if found. # A descriptive listing of core Gradle commands
# Otherwise it will call gradle directly. ############################################################################
function gradle-or-gradlew() {
# find project root
# taken from https://github.com/gradle/gradle-completion
local dir="$PWD" project_root="$PWD"
while [[ "$dir" != / ]]; do
if [[ -f "$dir/settings.gradle" || -f "$dir/settings.gradle.kts" || -f "$dir/gradlew" ]]; then
project_root="$dir"
break
fi
dir="${dir:h}"
done
# if gradlew found, run it instead of gradle gradle-or-gradlew() {
if [[ -f "$project_root/gradlew" ]]; then if [ -f ./gradlew ] ; then
echo "executing gradlew instead of gradle" echo "executing gradlew instead of gradle";
"$project_root/gradlew" "$@" ./gradlew "$@";
else else
command gradle "$@" gradle "$@";
fi
}
alias gradle=gradle-or-gradlew;
function _gradle_core_commands() {
local ret=1 state
_arguments ':subcommand:->subcommand' && ret=0
case $state in
subcommand)
subcommands=(
"properties:Display all project properties"
"tasks:Calculate and display all tasks"
"dependencies:Calculate and display all dependencies"
"projects:Discover and display all sub-projects"
"build:Build the project"
"help:Display help"
)
_describe -t subcommands 'gradle subcommands' subcommands && ret=0
esac
return ret
}
function _gradle_arguments() {
_arguments -C \
'-a[Do not rebuild project dependencies]' \
'-b[Specifies the build file]' \
'-c[Specifies the settings file]' \
'-d[Log at the debug level]' \
'-g[Specifies the Gradle user home directory]' \
'-h[Shows a help message]' \
'-i[Set log level to INFO]' \
'-m[Runs the build with all task actions disabled]' \
'-p[Specifies the start directory for Gradle]' \
'-q[Log errors only]' \
'-s[Print out the stacktrace also for user exceptions]' \
'-t[Continuous mode. Automatically re-run build after changes]' \
'-u[Don''t search in parent directories for a settings.gradle file]' \
'-v[Prints Gradle version info]' \
'-x[Specify a task to be excluded]' \
'-D[Set a system property]' \
'-I[Specifies an initialization script]' \
'-P[Sets a project property of the root project]' \
'-S[Print out the full (very verbose) stacktrace]' \
'--build-file[Specifies the build file]' \
'--configure-on-demand[Only relevant projects are configured]' \
'--console[Type of console output to generate (plain, auto, or rich)]' \
'--continue[Continues task execution after a task failure]' \
'--continuous[Continuous mode. Automatically re-run build after changes]' \
'--daemon[Use the Gradle Daemon]' \
'--debug[Log at the debug level]' \
'--dry-run[Runs the build with all task actions disabled]' \
'--exclude-task[Specify a task to be excluded]' \
'--full-stacktrace[Print out the full (very verbose) stacktrace]' \
'--gradle-user-home[Specifies the Gradle user home directory]' \
'--gui[Launches the Gradle GUI app (Deprecated)]' \
'--help[Shows a help message]' \
'--include-build[Run the build as a composite, including the specified build]' \
'--info[Set log level to INFO]' \
'--init-script[Specifies an initialization script]' \
'--max-workers[Set the maximum number of workers that Gradle may use]' \
'--no-daemon[Do not use the Gradle Daemon]' \
'--no-rebuild[Do not rebuild project dependencies]' \
'--no-search-upwards[Don''t search in parent directories for a settings.gradle file]' \
'--offline[Build without accessing network resources]' \
'--parallel[Build projects in parallel]' \
'--profile[Profile build time and create report]' \
'--project-cache-dir[Specifies the project-specific cache directory]' \
'--project-dir[Specifies the start directory for Gradle]' \
'--project-prop[Sets a project property of the root project]' \
'--quiet[Log errors only]' \
'--recompile-scripts[Forces scripts to be recompiled, bypassing caching]' \
'--refresh-dependencies[Refresh the state of dependencies]' \
'--rerun-task[Specifies that any task optimization is ignored]' \
'--settings-file[Specifies the settings file]' \
'--stacktrace[Print out the stacktrace also for user exceptions]' \
'--status[Print Gradle Daemon status]' \
'--stop[Stop all Gradle Daemons]' \
'--system-prop[Set a system property]' \
'--version[Prints Gradle version info]' \
'*::command:->command' \
&& return 0
}
##############################################################################
# Examine the build.gradle file to see if its timestamp has changed;
# and if so, regenerate the .gradle_tasks cache file
############################################################################
_gradle_does_task_list_need_generating () {
[[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache || build.gradle.kts -nt .gradletasknamecache ]]
}
##############
# Parse the tasks from `gradle(w) tasks --all` and return them to the calling function.
# All lines in the output from gradle(w) that are between /^-+$/ and /^\s*$/
# are considered to be tasks. If and when gradle adds support for listing tasks
# for programmatic parsing, this method can be deprecated.
##############
_gradle_parse_tasks () {
lines_might_be_tasks=false
task_name_buffer=""
while read -r line; do
if [[ $line =~ ^-+$ ]]; then
lines_might_be_tasks=true
# Empty buffer, because it contains items that are not tasks
task_name_buffer=""
elif [[ $line =~ ^\s*$ ]]; then
if [[ "$lines_might_be_tasks" = true ]]; then
# If a newline is found, echo the buffer to the calling function
while read -r task; do
echo $task | awk '/[a-zA-Z0-9:-]+/ {print $1}'
done <<< "$task_name_buffer"
# Empty buffer, because we are done with the tasks
task_name_buffer=""
fi
lines_might_be_tasks=false
elif [[ "$lines_might_be_tasks" = true ]]; then
task_name_buffer="${task_name_buffer}\n${line}"
fi
done <<< "$1"
}
##############
# Gradle tasks from subprojects are allowed to be executed without specifying
# the subproject; that task will then be called on all subprojects.
# gradle(w) tasks --all only lists tasks per subproject, but when autocompleting
# we often want to be able to run a specific task on all subprojects, e.g.
# "gradle clean".
# This function uses the list of tasks from "gradle tasks --all", and for each
# line grabs everything after the last ":" and combines that output with the original
# output. The combined list is returned as the result of this function.
##############
_gradle_parse_and_extract_tasks () {
# All tasks
tasks=$(_gradle_parse_tasks "$1")
# Task name without sub project(s) prefix
simple_tasks=$(echo $tasks | awk 'BEGIN { FS = ":" } { print $NF }')
echo "$tasks\n$simple_tasks"
}
##############################################################################
# Discover the gradle tasks by running "gradle tasks --all"
############################################################################
_gradle_tasks () {
if [[ -f build.gradle || -f build.gradle.kts || -f settings.gradle || -f settings.gradle.kts ]]; then
_gradle_arguments
if _gradle_does_task_list_need_generating; then
_gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache
fi
compadd -X "==== Gradle Tasks ====" $(cat .gradletasknamecache)
fi fi
} }
alias gradle=gradle-or-gradlew _gradlew_tasks () {
compdef _gradle gradle-or-gradlew if [[ -f build.gradle || -f build.gradle.kts || -f settings.gradle || -f settings.gradle.kts ]]; then
_gradle_arguments
if _gradle_does_task_list_need_generating; then
_gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache
fi
compadd -X "==== Gradlew Tasks ====" $(cat .gradletasknamecache)
fi
}
##############################################################################
# Register the completions against the gradle and gradlew commands
############################################################################
compdef _gradle_tasks gradle
compdef _gradlew_tasks gradlew
compdef _gradlew_tasks gw

View File

@ -14,3 +14,58 @@ It looks for scripts in the following paths:
- `~/.grails/scripts` - `~/.grails/scripts`
- `./scripts` - `./scripts`
- `./plugins/*/scripts` - `./plugins/*/scripts`
## Grails Commands
- `add-proxy`
- `alias`
- `bootstrap`
- `bug-report`
- `clean`
- `clean-all`
- `clear-proxy`
- `compile`
- `console`
- `create-app`
- `create-controller`
- `create-domain-class`
- `create-filters`
- `create-integration-test`
- `create-multi-project-build`
- `create-plugin`
- `create-pom`
- `create-script`
- `create-service`
- `create-tag-lib`
- `create-unit-test`
- `dependency-report`
- `doc`
- `help`
- `init`
- `install-app-templates`
- `install-dependency`
- `install-plugin`
- `install-templates`
- `integrate-with`
- `interactive`
- `list-plugin-updates`
- `list-plugins`
- `migrate-docs`
- `package`
- `package-plugin`
- `plugin-info`
- `refresh-dependencies`
- `remove-proxy`
- `run-app`
- `run-script`
- `run-war`
- `set-grails-version`
- `set-proxy`
- `set-version`
- `shell`
- `stats`
- `stop-app`
- `test-app`
- `uninstall-plugin`
- `url-mappings-report`
- `war`
- `wrapper`

Some files were not shown because too many files have changed in this diff Show More