add powerlevel10k

This commit is contained in:
vincent 2020-06-11 16:41:32 +02:00
parent 8cc6dfa595
commit 537a63d601
220 changed files with 5815 additions and 5976 deletions

View File

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

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.**
<!-- The name of the plugin or theme you'd like us to improve. -->
The name of the plugin or theme that you would like us to improve. [...]
**Is your feature request related to a problem? Please describe.**
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
A description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
<!-- A clear and concise description of what you want to happen. -->
A description of what you want to happen.
**Describe alternatives you've considered**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
A description of any alternative solutions or features you've considered. This can also include other plugins or aliases.
**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->
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.

View File

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

View File

@ -1,36 +0,0 @@
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.
![Check Suite](https://github.com/ohmyzsh/ohmyzsh/workflows/Check%20Suite/badge.svg)
[![CI](https://github.com/ohmyzsh/ohmyzsh/workflows/CI/badge.svg)](https://github.com/ohmyzsh/ohmyzsh/actions?query=workflow%3ACI)
[![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/bpXWhnN)
[![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/ohmyzsh)
## 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.
* [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
* `git` should be installed
* `git` should be installed (recommended v1.7.2 or higher)
### Basic Installation
@ -133,6 +133,12 @@ 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
If you have some more questions or issues, you might find a solution in our [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ).

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

View File

@ -3,10 +3,23 @@
# This file has support for doing system clipboard copy and paste operations
# from the command line in a generic cross-platform fashion.
#
# On OS X and Windows, the main system clipboard or "pasteboard" is used. On other
# Unix-like OSes, this considers the X Windows CLIPBOARD selection to be the
# "system clipboard", and the X Windows `xclip` command must be installed.
# This is uses essentially the same heuristic as neovim, with the additional
# special support for Cygwin.
# See: https://github.com/neovim/neovim/blob/e682d799fa3cf2e80a02d00c6ea874599d58f0e7/runtime/autoload/provider/clipboard.vim#L55-L121
#
# - 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
#
# Usage:
@ -15,41 +28,8 @@
#
# 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
#
# Usage:
@ -67,20 +47,61 @@ function clipcopy() {
#
# # Paste to a file
# clippaste > file.txt
function clippaste() {
#
function detect-clipboard() {
emulate -L zsh
if [[ $OSTYPE == darwin* ]]; then
pbpaste
elif [[ $OSTYPE == (cygwin|msys)* ]]; then
cat /dev/clipboard
if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then
function clipcopy() { pbcopy < "${1:-/dev/stdin}"; }
function clippaste() { pbpaste; }
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
if (( $+commands[xclip] )); then
xclip -out -selection clipboard
elif (( $+commands[xsel] )); then
xsel --clipboard --output
function _retry_clipboard_detection_or_fail() {
local clipcmd="${1}"; shift
if detect-clipboard; then
"${clipcmd}" "$@"
else
print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
print "${clipcmd}: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
return 1
fi
}
function clipcopy() { _retry_clipboard_detection_or_fail clipcopy "$@"; }
function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; }
return 1
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
# Use caching so that commands like apt and dpkg complete are useable
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path $ZSH_CACHE_DIR
zstyle ':completion:*' use-cache yes
zstyle ':completion:*' cache-path $ZSH_CACHE_DIR
# Don't complete uninteresting users
zstyle ':completion:*:*:*:users' ignored-patterns \
@ -71,3 +71,6 @@ if [[ $COMPLETION_WAITING_DOTS = true ]]; then
zle -N expand-or-complete-with-dots
bindkey "^I" expand-or-complete-with-dots
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*
builtin echo
builtin echo oh-my-zsh git state:
(cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]")
(builtin cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]")
if [[ $verbose -ge 1 ]]; then
(cd $ZSH && git reflog --date=default | command grep pull)
(builtin cd $ZSH && git reflog --date=default | command grep pull)
fi
builtin echo
if [[ -e $ZSH_CUSTOM ]]; then
local custom_dir=$ZSH_CUSTOM
if [[ -h $custom_dir ]]; then
custom_dir=$(cd $custom_dir && pwd -P)
custom_dir=$(builtin cd $custom_dir && pwd -P)
fi
builtin echo "oh-my-zsh custom dir:"
builtin echo " $ZSH_CUSTOM ($custom_dir)"
(cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print)
(builtin cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print)
builtin echo
fi

View File

@ -3,11 +3,12 @@ function zsh_stats() {
}
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() {
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() {
@ -88,7 +89,7 @@ function default() {
# 0 if the env variable exists, 3 if it was set
#
function env_default() {
(( ${${(@f):-$(typeset +xg)}[(I)$1]} )) && return 0
[[ ${parameters[$1]} = *-export* ]] && return 0
export "$1=$2" && return 3
}

View File

@ -199,3 +199,12 @@ function git_current_user_name() {
function git_current_user_email() {
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,28 +1,41 @@
# is x grep argument available?
grep-flag-available() {
echo | grep $1 "" >/dev/null 2>&1
}
__GREP_CACHE_FILE="$ZSH_CACHE_DIR"/grep-alias
GREP_OPTIONS=""
# See if there's a cache file modified in the last day
__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 <<< ""
}
# color grep results
if grep-flag-available --color=auto; then
GREP_OPTIONS+=" --color=auto"
# Ignore these folders (if the necessary grep flags are available)
EXC_FOLDERS="{.bzr,CVS,.git,.hg,.svn,.idea,.tox}"
# 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
# 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
unset __GREP_CACHE_FILE __GREP_ALIAS_CACHES

View File

@ -27,8 +27,8 @@ esac
## History file configuration
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
HISTSIZE=50000
SAVEHIST=10000
[ "$HISTSIZE" -lt 50000 ] && HISTSIZE=50000
[ "$SAVEHIST" -lt 10000 ] && SAVEHIST=10000
## History command configuration
setopt extended_history # record timestamp of command in HISTFILE
@ -36,5 +36,4 @@ setopt hist_expire_dups_first # delete duplicates first when HISTFILE size excee
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
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

View File

@ -25,7 +25,7 @@ env_default 'LESS' '-R'
alias _='sudo '
## more intelligent acking for ubuntu users
if which ack-grep &> /dev/null; then
if (( $+commands[ack-grep] )); then
alias afind='ack-grep -il'
else
alias afind='ack -il'

View File

@ -1,4 +1,3 @@
#! /bin/zsh
# A script to make using 256 colors in zsh less painful.
# P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
@ -19,19 +18,18 @@ for color in {000..255}; do
BG[$color]="%{[48;5;${color}m%}"
done
ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
# Show all 256 colors with color number
function spectrum_ls() {
local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
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
}
# Show all 256 colors where the background is set to specific color
function spectrum_bls() {
local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
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
}

View File

@ -17,7 +17,7 @@ function title {
: ${2=$1}
case "$TERM" in
cygwin|xterm*|putty*|rxvt*|ansi)
cygwin|xterm*|putty*|rxvt*|konsole*|ansi)
print -Pn "\e]2;$2:q\a" # set window name
print -Pn "\e]1;$1:q\a" # set tab name
;;
@ -50,22 +50,52 @@ fi
# Runs before showing the prompt
function omz_termsupport_precmd {
emulate -L zsh
if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
return
fi
[[ "$DISABLE_AUTO_TITLE" == true ]] && return
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
}
# Runs before executing the command
function omz_termsupport_preexec {
[[ "$DISABLE_AUTO_TITLE" == true ]] && return
emulate -L zsh
setopt extended_glob
if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
return
# split command into array of arguments
local -a cmdargs
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
# cmd name only, or if this is sudo or ssh, the next cmd
@ -91,12 +121,13 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
function update_terminalapp_cwd() {
emulate -L zsh
# Percent-encode the pathname.
local URL_PATH="$(omz_urlencode -P $PWD)"
[[ $? != 0 ]] && return 1
# Percent-encode the host and path names.
local URL_HOST URL_PATH
URL_HOST="$(omz_urlencode -P $HOST)" || return 1
URL_PATH="$(omz_urlencode -P $PWD)" || return 1
# Undocumented Terminal.app-specific control sequence
printf '\e]7;%s\a' "file://$HOST$URL_PATH"
printf '\e]7;%s\a' "file://$URL_HOST$URL_PATH"
}
# Use a precmd hook instead of a chpwd hook to avoid contaminating output

View File

@ -4,11 +4,6 @@ if [[ -z "$ZSH_CACHE_DIR" ]]; then
ZSH_CACHE_DIR="$ZSH/cache"
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...
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
@ -61,6 +56,17 @@ if [ -z "$ZSH_COMPDUMP" ]; then
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
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
source $ZSH/lib/compfix.zsh
# If completion insecurities exist, warn the user
@ -72,6 +78,19 @@ else
compinit -u -C -d "${ZSH_COMPDUMP}"
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
# TIP: Add files you don't want in git to .gitignore
@ -97,19 +116,7 @@ done
unset config_file
# Load the theme
if [[ "$ZSH_THEME" == "random" ]]; then
if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = "array" ]] && [[ "${#ZSH_THEME_RANDOM_CANDIDATES[@]}" -gt 0 ]]; then
themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDIDATES}.zsh-theme)
else
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 [ ! "$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
@ -117,5 +124,4 @@ else
else
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
fi
fi
fi

View File

@ -1,19 +1,21 @@
## 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:
### FEATURES
```zsh
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 |
|----------------|-----------------------------------------|-----------------------|
| 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,5 +1,41 @@
## arcanist
**Maintainer:** [@emzar](https://github.com/emzar)
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,13 +9,29 @@ alias arco='arc cover'
alias arci='arc commit'
alias ard='arc diff'
alias ardc='arc diff --create'
alias ardnu='arc diff --nounit'
alias ardnupc='arc diff --nounit --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 arh='arc help'
alias arl='arc land'
alias arli='arc lint'
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,5 +1,13 @@
# 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
#### YAY
@ -119,7 +127,7 @@
| pacupg | 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 |
| pacfiles | pacman -Fs | Search package file names for matching strings |
| pacfiles | pacman -F | Search package file names for matching strings |
| pacls | pacman -Ql | List files in a package |
| 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 pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
alias pacfileupg='sudo pacman -Fy'
alias pacfiles='pacman -Fs'
alias pacfiles='pacman -F'
alias pacls='pacman -Ql'
alias pacown='pacman -Qo'
@ -208,7 +208,7 @@ function pacmansignkeys() {
if (( $+commands[xdg-open] )); then
function pacweb() {
pkg="$1"
infos="$(pacman -Si "$pkg")"
infos="$(LANG=C pacman -Si "$pkg")"
if [[ -z "$infos" ]]; then
return
fi

View File

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

View File

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

View File

@ -1,12 +1,39 @@
# Activates autoenv or reports its failure
# Initialization: activate autoenv or report its absence
() {
local d autoenv_dir install_locations
if ! type autoenv_init >/dev/null; then
for d (~/.autoenv ~/.local/bin /usr/local/opt/autoenv /usr/local/bin); do
# Check if activate.sh is in $PATH
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
autoenv_dir=$d
fi
fi
# Complain if autoenv is not installed
if [[ -z $autoenv_dir ]]; then
cat <<END >&2
-------- AUTOENV ---------
@ -17,6 +44,7 @@ In the meantime the autoenv plugin is DISABLED.
END
return 1
fi
# Load autoenv
source $autoenv_dir/activate.sh
fi
}
@ -27,7 +55,7 @@ fi
# It only performs an action if the requested virtualenv is not the current one.
use_env() {
typeset venv
local venv
venv="$1"
if [[ "${VIRTUAL_ENV:t}" != "$venv" ]]; then
if workon | grep -q "$venv"; then

View File

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

View File

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

View File

@ -31,12 +31,12 @@ function aws_change_access_key() {
echo Insert the credentials when asked.
asp "$1" || return 1
aws iam create-access-key
aws configure --profile "$1"
AWS_PAGER="" aws iam create-access-key
AWS_PAGER="" 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 Your current keys are:
aws iam list-access-keys
AWS_PAGER="" aws iam list-access-keys
}
function aws_profiles() {
@ -62,7 +62,12 @@ fi
# Load awscli completions
function _awscli-homebrew-installed() {
# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back
if [[ -x /usr/local/bin/aws_completer ]]; then
autoload -Uz bashcompinit && bashcompinit
complete -C aws_completer aws
else
function _awscli-homebrew-installed() {
# check if Homebrew is installed
(( $+commands[brew] )) || return 1
@ -74,24 +79,28 @@ function _awscli-homebrew-installed() {
# this call to brew is expensive (about 400 ms), so at least let's make it only once
_brew_prefix=$(brew --prefix awscli)
fi
}
}
# get aws_zsh_completer.sh location from $PATH
_aws_zsh_completer_path="$commands[aws_zsh_completer.sh]"
# 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
# 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
unset _aws_zsh_completer_path _brew_prefix
[[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path
unset _aws_zsh_completer_path _brew_prefix
fi

View File

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

View File

@ -3,19 +3,27 @@
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:
```
```zsh
plugins=(... brew)
```
## Aliases
| Alias | Command | Description |
|--------|----------------------|---------------|
| 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, one entry per line, or the installed files for a given formulae. |
| 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` | Fetch the newest version of Homebrew and all formulae, then list outdated formulae. |
| 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` | Updates Homebrew, lists outdated formulae, upgrades oudated and unpinned formulae, and removes stale and outdated downloads and versions. |
| 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` | Updates outdated casks, then runs cleanup. |
|----------|-------------------------------------------------------------|---------------------------------------------------------------------|
| `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. |
| `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. |
| `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. |
| `bubo` | `brew update && brew outdated` | Update Homebrew and all formulae, then list outdated formulae. |
| `bubc` | `brew upgrade && brew cleanup` | Upgrade outdated formulae, then run cleanup. |
| `bubu` | `bubo && bubc` | Do the last two operations above. |
| `bcubo` | `brew update && brew cask outdated` | Update Homebrew and alll formulae, then list outdated casks. |
| `bcubc` | `brew cask reinstall $(brew cask outdated) && brew cleanup` | Update outdated casks, then run 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,19 +6,3 @@ alias bubc='brew upgrade && brew cleanup'
alias bubu='bubo && bubc'
alias bcubo='brew update && brew cask outdated'
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,7 +1,9 @@
# Bundler
- adds completion for basic bundler commands
- adds short aliases for common bundler commands
- Adds completion for basic bundler commands
- Adds short aliases for common bundler commands
- `ba` aliased to `bundle add`
- `be` aliased to `bundle exec`.
It also supports aliases (if `rs` is `rails server`, `be rs` will bundle-exec `rails server`).
- `bl` aliased to `bundle list`
@ -10,9 +12,12 @@
- `bout` aliased to `bundle outdated`
- `bu` aliased to `bundle update`
- `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`)
- adds a wrapper for common gems:
- looks for a binstub under `./bin/` and executes it (if present)
- calls `bundle exec <gem executable>` otherwise
- `bcn` aliased to `bundle clean`
- `bck` aliased to `bundle check`
- 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):
`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`.
@ -24,20 +29,24 @@ Please use the exact name of the executable and not the gem name.
### Add additional gems to be wrapped
Add this before the plugin-list in your `.zshrc`:
```sh
BUNDLED_COMMANDS=(rubocop)
plugins=(... bundler ...)
```
This will add the wrapper for the `rubocop` gem (i.e. the executable).
### Exclude gems from being wrapped
Add this before the plugin-list in your `.zshrc`:
```sh
UNBUNDLED_COMMANDS=(foreman spin)
plugins=(... bundler ...)
```
This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped.
## Excluded gems

View File

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

View File

@ -2,28 +2,16 @@
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
- `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
| Function | Description |

View File

@ -1,6 +1,6 @@
# chucknorris
Chuck Norris fortunes plugin for oh-my-zsh
Chuck Norris fortunes plugin for oh-my-zsh. Perfectly suitable as MOTD.
**Maintainers**: [apjanke](https://github.com/apjanke) [maff](https://github.com/maff)
@ -10,11 +10,31 @@ To use it add `chucknorris` to the plugins array in you zshrc file.
plugins=(... chucknorris)
```
Depends on fortune (and cowsay if using chuck_cow) being installed (available via homebrew, apt, ...). Perfectly suitable as MOTD.
## Usage
| Command | Description |
| ----------- | ------------------------------- |
| `chuck` | Print random Chuck Norris quote |
| `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:
```
plugins=(... dash)
```zsh
plugins=(... cloudapp)
```
## Requirements

View File

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

View File

@ -8,6 +8,9 @@ To use it, add `colored-man-pages` to the plugins array in your zshrc file:
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`:
```zsh

View File

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

View File

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

View File

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

View File

@ -3,6 +3,7 @@
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:
```
```zsh
plugins=(... compleat)
```

View File

@ -13,17 +13,19 @@ plugins=(... composer)
## Aliases
| Alias | Command | Description |
| ------ | -------------------------------------------- | -------------------------------------------------------------------------------------- |
| `c` | composer | Starts composer |
| `csu` | composer self-update | Updates composer to the latest version |
| `cu` | composer update | Updates composer dependencies and `composer.lock` file |
| `cr` | composer require | Adds new packages to `composer.json` |
| `crm` | composer remove | Removes packages from `composer.json` |
| `ci` | composer install | Resolves and installs dependencies from `composer.json` |
| `ccp` | composer create-project | Create new project from an existing package |
| `cdu` | composer dump-autoload | Updates the autoloader |
| `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 |
| `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 |
| ------ | ------------------------------------------- | --------------------------------------------------------------------------------------- |
| `c` | `composer` | Starts composer |
| `csu` | `composer self-update` | Updates composer to the latest version |
| `cu` | `composer update` | Updates composer dependencies and `composer.lock` file |
| `cr` | `composer require` | Adds new packages to `composer.json` |
| `crm` | `composer remove` | Removes packages from `composer.json` |
| `ci` | `composer install` | Resolves and installs dependencies from `composer.json` |
| `ccp` | `composer create-project` | Create new project from an existing package |
| `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) |
| `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 |
| `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 |
| `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

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

View File

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

View File

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

View File

@ -4,6 +4,6 @@ This plugin provides completion for [Cpanm](https://github.com/miyagawa/cpanminu
To use it add cpanm to the plugins array in your zshrc file.
```bash
```zsh
plugins=(... cpanm)
```

View File

@ -7,6 +7,7 @@ To use it, add `dirhistory` to the plugins array in your zshrc file:
```zsh
plugins=(... dirhistory)
```
## Keyboard Shortcuts
| Shortcut | Description |
@ -15,3 +16,24 @@ plugins=(... dirhistory)
| <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>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,6 +1,7 @@
# Dirpersist plugin
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.
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.
To use it, add `dirpersist` to the plugins array in your zshrc file:

View File

@ -34,23 +34,3 @@ runfcgi -- run this project as a fastcgi
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,10 +1,14 @@
## Description
# dnf plugin
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

View File

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

View File

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

View File

@ -9,6 +9,7 @@
# - Felix Riedel
# - Steve Durrheimer
# - Vincent Bernat
# - Rohan Verma
#
# license:
#
@ -604,6 +605,7 @@ __docker_container_subcommand() {
"($help)*--blkio-weight-device=[Block IO (relative device weight)]:device:Block IO weight: "
"($help)*--cap-add=[Add 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)--cidfile=[Write the container ID to the file]:CID file:_files"
"($help)--cpus=[Number of CPUs (default 0.000)]:cpus: "
@ -676,6 +678,7 @@ __docker_container_subcommand() {
"($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: "
"($help)--memory-reservation=[Memory soft limit]: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)"
)
opts_help=("(: -)--help[Print usage]")
@ -801,7 +804,7 @@ __docker_container_subcommand() {
"($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)--no-trunc[Do not truncate output]" \
"($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \
"($help -q --quiet)"{-q,--quiet}"[Only show container IDs]" \
"($help -s --size)"{-s,--size}"[Display total file sizes]" \
"($help)--since=[Show only containers created since...]:containers:__docker_complete_containers" && ret=0
;;
@ -832,7 +835,7 @@ __docker_container_subcommand() {
_arguments $(__docker_arguments) \
$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 -)*:containers:__docker_complete_containers_ids" && ret=0
"($help -)*:containers:__docker_complete_containers" && ret=0
;;
(rm)
local state
@ -1024,7 +1027,7 @@ __docker_image_subcommand() {
$opts_help \
"($help -H --human)"{-H,--human}"[Print sizes and dates in human readable format]" \
"($help)--no-trunc[Do not truncate output]" \
"($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \
"($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \
"($help -)*: :__docker_complete_images" && ret=0
;;
(import)
@ -1056,7 +1059,7 @@ __docker_image_subcommand() {
"($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_images_filters" \
"($help)--format=[Pretty-print images using a Go template]:template: " \
"($help)--no-trunc[Do not truncate output]" \
"($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \
"($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \
"($help -): :__docker_complete_repositories" && ret=0
;;
(prune)
@ -1076,6 +1079,7 @@ __docker_image_subcommand() {
(push)
_arguments $(__docker_arguments) \
$opts_help \
"($help -a --all-tags)"{-a,--all-tags}"[Push all tagged images in the repository]" \
"($help)--disable-content-trust[Skip image signing]" \
"($help -): :__docker_complete_images" && ret=0
;;
@ -1286,7 +1290,7 @@ __docker_network_subcommand() {
"($help)--no-trunc[Do not truncate the output]" \
"($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_network_complete_ls_filters" \
"($help)--format=[Pretty-print networks using a Go template]:template: " \
"($help -q --quiet)"{-q,--quiet}"[Only display numeric IDs]" && ret=0
"($help -q --quiet)"{-q,--quiet}"[Only display network IDs]" && ret=0
;;
(prune)
_arguments $(__docker_arguments) \
@ -2214,7 +2218,6 @@ __docker_stack_subcommand() {
(deploy|up)
_arguments $(__docker_arguments) \
$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)--with-registry-auth[Send registry authentication details to Swarm agents]" \
"($help -):stack:__docker_complete_stacks" && ret=0
@ -2668,6 +2671,7 @@ __docker_subcommand() {
"($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-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)--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" \
@ -2783,7 +2787,7 @@ __docker_subcommand() {
$opts_help \
"($help -p --password)"{-p=,--password=}"[Password]:password: " \
"($help)--password-stdin[Read password from stdin]" \
"($help -u --user)"{-u=,--user=}"[Username]:username: " \
"($help -u --username)"{-u=,--username=}"[Username]:username: " \
"($help -)1:server: " && ret=0
;;
(logout)

View File

@ -4,9 +4,7 @@ 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.
## Installation
Just add the plugin to your `.zshrc`:
To use it, add `dotenv` to the plugins array in your zshrc file:
```sh
plugins=(... dotenv)
@ -17,32 +15,63 @@ plugins=(... dotenv)
Create `.env` file inside your project root directory and put your ENV variables there.
For example:
```sh
export AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a
export SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
export MONGO_URI=mongodb://127.0.0.1:27017
export PORT=3001
```
`export` is optional. This format works as well:
```sh
AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a
SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
MONGO_URI=mongodb://127.0.0.1:27017
PORT=3001
```
You can even mix both formats, although it's probably a bad idea.
## Settings
### 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`.
For example, this will make the plugin look for files named `.dotenv` and load them:
```
```zsh
# in ~/.zshrc, before Oh My Zsh is sourced:
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
**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.
@ -52,5 +81,6 @@ ZSH_DOTENV_FILE=.dotenv
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:
* [direnv](https://github.com/direnv/direnv)
* [zsh-autoenv](https://github.com/Tarrasch/zsh-autoenv)

View File

@ -1,23 +1,46 @@
## 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() {
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
zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2
if [[ -o a ]]; then
setopt localoptions allexport
source $ZSH_DOTENV_FILE
else
set -a
source $ZSH_DOTENV_FILE
set +a
fi
fi
}
autoload -U add-zsh-hook
add-zsh-hook chpwd source_env
if [[ -z $ZSH_DOTENV_FILE ]]; then
ZSH_DOTENV_FILE=.env
fi
source_env

View File

@ -11,10 +11,12 @@ plugins=(... dotnet)
## Aliases
| Alias | Command | Description |
|-------|--------------|-------------------------------------------------------------------|
|-------|------------------|-------------------------------------------------------------------|
| dn | dotnet new | Create a new .NET project or file. |
| 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. |
| dw | dotnet watch | Watch for source file changes and restart the dotnet command. |
| dwr | dotnet watch run | Watch for source file changes and restart the `run` command. |
| ds | dotnet sln | Modify Visual Studio solution files. |
| da | dotnet add | Add a package or reference to a .NET project. |
| dp | dotnet pack | Create a NuGet package. |

View File

@ -1,116 +1,31 @@
# --------------------------------------------------------------------- #
# Aliases and Completions for .NET Core (https://dotnet.microsoft.com/) #
# Author: Shaun Tabone (https://github.com/xontab) #
# --------------------------------------------------------------------- #
# This scripts is copied from (MIT License):
# https://github.com/dotnet/toolset/blob/master/scripts/register-completions.zsh
# Helper function to cache and load completions
local cache_base_path="${ZSH_CACHE_DIR}/dotnet_"
_dotnet_cache_completion() {
local cache="${cache_base_path}$(echo $1)_completion"
if [[ ! -f $cache ]]; then
$2 $cache
_dotnet_zsh_complete()
{
local completions=("$(dotnet complete "$words")")
# If the completion list is empty, just continue with filename selection
if [ -z "$completions" ]
then
_arguments '*::arguments: _normal'
return
fi
[[ -f $cache ]] && cat $cache
# This is not a variable assigment, don't remove spaces!
_values = "${(ps:\n:)completions}"
}
_dotnet_cache_completion_cleanup() {
local cache="${cache_base_path}$(echo $1)_completion"
rm -f $cache
}
compdef _dotnet_zsh_complete dotnet
# --------------------------------------------------------------------- #
# 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'
# Aliases bellow are here for backwards compatibility
# added by Shaun Tabone (https://github.com/xontab)
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 dt='dotnet test'
alias dw='dotnet watch'
alias dwr='dotnet watch run'
alias ds='dotnet sln'
alias da='dotnet add'
alias dp='dotnet pack'

View File

@ -1,6 +1,12 @@
# 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
@ -9,23 +15,6 @@ Alias plugin for encoding or decoding using `base64` command
| `encode64` | `e64` | Encodes given data to 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
### 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.
```bash
```zsh
plugins=(... fabric)
```

View File

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

View File

@ -1,12 +1,16 @@
if [ $commands[fasd] ]; then # check if fasd is installed
fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache"
if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
fasd --init auto >| "$fasd_cache"
fi
source "$fasd_cache"
unset fasd_cache
alias v='f -e "$EDITOR"'
alias o='a -e xdg-open'
alias j='zz'
# check if fasd is installed
if (( ! ${+commands[fasd]} )); then
return
fi
fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache"
if [[ "$commands[fasd]" -nt "$fasd_cache" || ! -s "$fasd_cache" ]]; then
fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install \
zsh-wcomp zsh-wcomp-install >| "$fasd_cache"
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
# overwritten with their default values
default fastfile_dir "${HOME}/.fastfile/"
default fastfile_dir "${HOME}/.fastfile"
default fastfile_var_prefix "§"
###########################
@ -78,7 +78,7 @@ function fastfile_print() {
# (=> fastfle_print) for each shortcut
#
function fastfile_ls() {
for f in "${fastfile_dir}"/*; do
for f in "${fastfile_dir}"/*(NF); do
file=`basename "$f"` # To enable simpler handeling of spaces in file names
varkey=`echo "$file" | tr " " "_"`
@ -104,7 +104,7 @@ function fastfile_rm() {
# Generate the aliases for the shortcuts
#
function fastfile_sync() {
for f in "${fastfile_dir}"/*; do
for f in "${fastfile_dir}"/*(NF); do
file=`basename "$f"` # To enable simpler handeling of spaces in file names
varkey=`echo "$file" | tr " " "_"`

View File

@ -3,7 +3,8 @@
This plugin automatically starts [fbterm](https://github.com/zhangyuanwei/fbterm)
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)
```

View File

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

View File

@ -0,0 +1,3 @@
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

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

View File

@ -1,6 +1,7 @@
# Open folder in ForkLift.app or ForkLift2.app from console
# 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 from Setapp by Paul Rudkin
#
# Usage:
# fl [<folder>]
@ -24,6 +25,13 @@ function fl {
fi
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
tell application "Finder"
set forkLift3 to name of application file id "com.binarynights.ForkLift-3"
@ -46,7 +54,12 @@ function fl {
set forkLift to null
end try
if forkLift3 is not null and application forkLift3 is running then
if forkLiftSetapp is not null and application forkLiftSetapp 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
activate
set forkLiftVersion to version
@ -62,7 +75,9 @@ function fl {
set forkLiftVersion to version
end tell
else
if forkLift3 is not null then
if forkLiftSetapp is not null then
set appName to forkLiftSetapp
else if forkLift3 is not null then
set appName to forkLift3
else if forkLift2 is not null then
set appName to forkLift2

View File

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

View File

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

View File

@ -19,6 +19,7 @@ alias lodash='frontend lodash'
alias mdn='frontend mdn'
alias nodejs='frontend nodejs'
alias npmjs='frontend npmjs'
alias packagephobia='frontend packagephobia'
alias qunit='frontend qunit'
alias reactjs='frontend reactjs'
alias smacss='frontend smacss'
@ -65,6 +66,7 @@ function frontend() {
mdn 'https://developer.mozilla.org/search?q='
nodejs $(_frontend_fallback 'nodejs.org/en/docs/')
npmjs 'https://www.npmjs.com/search?q='
packagephobia 'https://packagephobia.now.sh/result?p='
qunit 'https://api.qunitjs.com/?s='
reactjs $(_frontend_fallback 'reactjs.org/')
smacss $(_frontend_fallback 'smacss.com')
@ -82,7 +84,7 @@ function frontend() {
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 ""
print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow,"
print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
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 ""
@ -98,7 +100,7 @@ function frontend() {
echo ""
echo "Valid contexts are:"
echo ""
echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow,"
echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash,"
echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
echo ""

View File

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

View File

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

View File

@ -1,12 +1,10 @@
## ZSH-Geeknote
# Geeknote plugin
[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for oh-my-zsh.
This plugin provides autocompletion for [Geeknote](https://github.com/VitaliyRodnenko/geeknote)
and an alias for `geeknote` called `gn`.
Plugins provides:
To use it, add `geeknote` to the plugins array in your zshrc file:
- auto completion of commands and their options
- 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))
```zsh
plugins=( ... geeknote ...)
```

View File

@ -1,34 +1,118 @@
#compdef geeknote
# --------------- ------------------------------------------------------------
# Name : _geeknote
# Synopsis : zsh completion for geeknote
# Author : Ján Koščo <3k.stanley@gmail.com>
# HomePage : http://www.geeknote.me
# Version : 0.1
# Tag : [ shell, zsh, completion, evernote ]
# Copyright : © 2014 by Ján Koščo,
# Released under current GPL license.
# --------------- ------------------------------------------------------------
# Geeknote Autocomplete plugin for Zsh
# Requires: Geeknote installed
# Author : Ján Koščo (@s7anley)
__login() {
# no arguments
}
__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
_1st_arguments=(
'login'
'logout'
'settings'
'create'
'edit'
'find'
'show'
'remove'
'notebook-list'
'notebook-create'
'notebook-edit'
'tag-list'
'tag-create'
'tag-edit'
'tag-remove'
'gnsync'
'user'
'login':'Authorize in Evernote.'
'logout':'Logout from Evernote.'
'settings':'Show and edit current settings.'
'create':'Create note in Evernote.'
'edit':'Edit note in Evernote.'
'find':'Search notes in Evernote.'
'show':'Output note in the terminal.'
'remove':'Remove note from Evernote.'
'notebook-list':'Show the list of existing notebooks in your Evernote.'
'notebook-create':'Create new notebook.'
'notebook-edit':'Edit/rename notebook.'
'tag-list':'Show the list of existing tags in your Evernote.'
'tag-create':'Create new tag.'
'tag-edit':'Edit/rename tag.'
'user':'Show information about active user.'
)
_arguments '*:: :->command'
@ -40,97 +124,34 @@ fi
local -a _command_args
case "$words[1]" in
user)
_command_args=(
'(--full)--full' \
)
;;
login)
__login ;;
logout)
_command_args=(
'(--force)--force' \
)
;;
__logout ;;
settings)
_command_args=(
'(--editor)--editor' \
)
;;
__settings ;;
create)
_command_args=(
'(-t|--title)'{-t,--title}'[note title]' \
'(-c|--content)'{-c,--content}'[note content]' \
'(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
)
;;
__create ;;
edit)
_command_args=(
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
'(-t|--title)'{-t,--title}'[note title]' \
'(-c|--content)'{-c,--content}'[note content]' \
'(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
)
;;
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]' \
)
;;
__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]' \
)
;;
__find ;;
show)
__show ;;
remove)
__remove ;;
notebook-list)
__notebook-list ;;
notebook-create)
_command_args=(
'(-t|--title)'{-t,--title}'[notebook title]' \
)
;;
__notebook-create ;;
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' \
)
;;
__notebook-edit ;;
tag-list)
__tag-list ;;
tag-create)
_command_args=(
'(-t|--title)'{-t,--title}'[title of tag]' \
)
;;
__tag-create ;;
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
__tag-edit ;;
user)
__user ;;
esac

View File

@ -2,10 +2,16 @@
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:
```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.
### OS X Homebrew Setup
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.
**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.~~

View File

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

@ -1,14 +0,0 @@
# 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

@ -1,19 +0,0 @@
_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

@ -11,7 +11,7 @@ plugins=(... git)
## Aliases
| Alias | Command |
|:---------------------|:------------------------------------------------------------------------------------------------------------------------------|
|:---------------------|:---------------------------------------------------------------------------------------------------------------------------------|
| g | git |
| ga | git add |
| gaa | git add --all |
@ -19,10 +19,11 @@ plugins=(... git)
| gau | git add --update |
| gav | git add --verbose |
| gap | git apply |
| gapt | git apply --3way |
| gb | git branch |
| gba | git branch -a |
| 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 |
| gbl | git blame -b -w |
| gbnm | git branch --no-merged |
@ -45,7 +46,7 @@ plugins=(... git)
| gcf | git config --list |
| gcl | git clone --recurse-submodules |
| gclean | git clean -id |
| gpristine | git reset --hard && git clean -dfx |
| gpristine | git reset --hard && git clean -dffx |
| gcm | git checkout master |
| gcd | git checkout develop |
| gcmsg | git commit -m |
@ -61,6 +62,7 @@ plugins=(... git)
| gdct | git describe --tags $(git rev-list --tags --max-count=1) |
| gds | git diff --staged |
| gdt | git diff-tree --no-commit-id --name-only -r |
| gdnolock | git diff $@ ":(exclude)package-lock.json" ":(exclude)&ast;.lock" |
| gdv | git diff -w $@ \| view - |
| gdw | git diff --word-diff |
| gf | git fetch |
@ -100,7 +102,7 @@ plugins=(... git)
| glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all |
| glog | git log --oneline --decorate --graph |
| gloga | git log --oneline --decorate --graph --all |
| glp | `_git_log_prettily` |
| glp | git log --pretty=\<format\> |
| gm | git merge |
| gmom | git merge origin/master |
| gmt | git mergetool --no-prompt |
@ -154,6 +156,7 @@ plugins=(... git)
| gstl | git stash list |
| gstp | git stash pop |
| gsts | git stash show --text |
| gstu | git stash --include-untracked |
| gstall | git stash --all |
| gsu | git submodule update |
| gsw | git switch |
@ -170,31 +173,37 @@ plugins=(... git)
| 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
### Deprecated aliases
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 |
| :----- | :----------------------------------------------------------------------------------| --------------------------------------------------------------------------------------------------- |
| gap | git add --patch | new alias `gapa` |
| gcl | git config --list | new alias `gcf` |
| gdc | git diff --cached | new alias `gdca` |
| gdt | git difftool | no replacement |
| 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) |
| 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` |
| 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` |
| gwc | git whatchanged -p --abbrev-commit --pretty = medium | new alias `gwch` |
| :----- | :----------------------------------------------------- | :----------------------------------------------------- |
| gap | `git add --patch` | new alias `gapa` |
| gcl | `git config --list` | new alias `gcf` |
| gdc | `git diff --cached` | new alias `gdca` |
| gdt | `git difftool` | no replacement |
| 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) |
| 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` |
| 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` |
| gwc | `git whatchanged -p --abbrev-commit --pretty = medium` | new alias `gwch` |
## Functions
### Current
| Command | Description |
|:-----------------------|:----------------------------------------|
|:-----------------------|:---------------------------------------------------------|
| `grename <old> <new>` | Rename `old` branch to `new`, including in origin remote |
| current_branch | Return the name of the current branch |
| git_current_user_name | Returns the `user.name` config value |
| git_current_user_email | Returns the `user.email` config value |
@ -209,7 +218,7 @@ These features allow to pause a branch development and switch to another one (_"
| gwip | Commit wip branch |
| gunwip | Uncommit wip branch |
### Deprecated
### Deprecated functions
| Command | Description | Reason |
|:-----------------------|:----------------------------------------|:----------------------------------------------------------------|

View File

@ -38,11 +38,12 @@ alias gapa='git add --patch'
alias gau='git add --update'
alias gav='git add --verbose'
alias gap='git apply'
alias gapt='git apply --3way'
alias gb='git branch'
alias gba='git branch -a'
alias gbd='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 gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*(master|development|develop|devel|dev)\s*$)" | command xargs -n 1 git branch -d'
alias gbD='git branch -D'
alias gbl='git blame -b -w'
alias gbnm='git branch --no-merged'
@ -66,7 +67,7 @@ alias gcb='git checkout -b'
alias gcf='git config --list'
alias gcl='git clone --recurse-submodules'
alias gclean='git clean -id'
alias gpristine='git reset --hard && git clean -dfx'
alias gpristine='git reset --hard && git clean -dffx'
alias gcm='git checkout master'
alias gcd='git checkout develop'
alias gcmsg='git commit -m'
@ -85,6 +86,11 @@ alias gds='git diff --staged'
alias gdt='git diff-tree --no-commit-id --name-only -r'
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 - }
compdef _git gdv=git-diff
@ -236,6 +242,7 @@ alias gstd='git stash drop'
alias gstl='git stash list'
alias gstp='git stash pop'
alias gsts='git stash show --text'
alias gstu='git stash --include-untracked'
alias gstall='git stash --all'
alias gsu='git submodule update'
alias gsw='git switch'
@ -255,3 +262,23 @@ alias glum='git pull upstream master'
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 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
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:

View File

@ -30,7 +30,7 @@ if [ -z "$script" ]; then
local -a locations
local e
locations=(
$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
"$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash"
'/etc/bash_completion.d/git' # fedora, old debian
'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
'/usr/share/bash-completion/git' # gentoo
@ -39,7 +39,7 @@ if [ -z "$script" ]; then
test -f $e && script="$e" && break
done
fi
GIT_SOURCING_ZSH_COMPLETION=y . "$script"
ZSH_VERSION='' . "$script"
__gitcomp ()
{
@ -93,22 +93,13 @@ __gitcomp_nl_append ()
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 ()
{
emulate -L zsh
local IFS=$'\n'
compset -P '*[=:]'
compadd -p "${2-}" -f -- ${=1} && _ret=0
compadd -Q -p "${2-}" -f -- ${=1} && _ret=0
}
__git_zsh_bash_func ()
@ -232,8 +223,10 @@ _git ()
if (( $+functions[__${service}_zsh_main] )); then
__${service}_zsh_main
else
elif (( $+functions[__${service}_main] )); then
emulate ksh -c __${service}_main
elif (( $+functions[_${service}] )); then
emulate ksh -c _${service}
fi
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
__git_ps1_upstream_name=$(git rev-parse \
--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}"
else
p="$p ${__git_ps1_upstream_name}"
@ -237,7 +237,7 @@ __git_ps1_show_upstream ()
# to build a gitstring.
__git_ps1_colorize_gitstring ()
{
if [[ -n "${ZSH_VERSION-}" ]]; then
if [[ -n ${ZSH_VERSION-} ]]; then
local c_red='%F{red}'
local c_green='%F{green}'
local c_lblue='%F{blue}'
@ -255,7 +255,7 @@ __git_ps1_colorize_gitstring ()
local flags_color="$c_lblue"
local branch_color=""
if [ "$detached" = no ]; then
if [ $detached = no ]; then
branch_color="$ok_color"
else
branch_color="$bad_color"
@ -508,13 +508,13 @@ __git_ps1 ()
# NO color option unless in PROMPT_COMMAND mode or it's Zsh
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
if [ "$pcmode" = yes ] || [ -n "${ZSH_VERSION-}" ]; then
if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then
__git_ps1_colorize_gitstring
fi
fi
b=${b##refs/heads/}
if [ "$pcmode" = yes ] && [ "$ps1_expanded" = yes ]; then
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
__git_ps1_branch_name=$b
b="\${__git_ps1_branch_name}"
fi
@ -522,7 +522,7 @@ __git_ps1 ()
local f="$w$i$s$u"
local gitstring="$c$b${f:+$z$f}$r$p"
if [ "$pcmode" = yes ]; then
if [ $pcmode = yes ]; then
if [ "${__git_printf_supports_v-}" != yes ]; then
gitstring=$(printf -- "$printf_format" "$gitstring")
else

View File

@ -1,4 +1,4 @@
# github
# github plugin
This plugin supports working with GitHub from the command line. It provides a few things:

View File

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

View File

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

View File

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

View File

@ -0,0 +1,3 @@
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

@ -3,6 +3,7 @@
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:
```
```zsh
plugins=(... gpg-agent)
```

View File

@ -1,4 +1,4 @@
## Gradle Plugin
# Gradle plugin
This plugin adds completions and aliases for [Gradle](https://gradle.org/).
@ -10,9 +10,15 @@ plugins=(... gradle)
## Usage
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`
This plugin creates a function called `gradle-or-gradlew`, which is aliased
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:
```zsh
gradle test
gradle build
@ -20,4 +26,5 @@ gradle build
## 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.
This plugin uses [the completion from the Gradle project](https://github.com/gradle/gradle-completion),
which is distributed under the MIT license.

View File

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

View File

@ -0,0 +1,420 @@
#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

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

View File

@ -1,184 +1,26 @@
##############################################################################
# A descriptive listing of core Gradle commands
############################################################################
# Looks for a gradlew file in the current working directory
# or any of its parent directories, and executes it if found.
# 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
gradle-or-gradlew() {
if [ -f ./gradlew ] ; then
echo "executing gradlew instead of gradle";
./gradlew "$@";
# if gradlew found, run it instead of gradle
if [[ -f "$project_root/gradlew" ]]; then
echo "executing gradlew instead of gradle"
"$project_root/gradlew" "$@"
else
gradle "$@";
command 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
}
_gradlew_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 "$(./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
alias gradle=gradle-or-gradlew
compdef _gradle gradle-or-gradlew

View File

@ -14,58 +14,3 @@ It looks for scripts in the following paths:
- `~/.grails/scripts`
- `./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`

View File

@ -1,25 +1,44 @@
zsh-history-substring-search
==============================================================================
# zsh-history-substring-search
This is a clean-room implementation of the [Fish shell][1]'s history search
feature, where you can type in any part of any previously entered command
and press the UP and DOWN arrow keys to cycle through the matching commands.
You can also use K and J in VI mode or ^P and ^N in EMACS mode for the same.
feature, where you can type in any part of any command from history and then
press chosen keys, such as the UP and DOWN arrows, to cycle through matches.
[1]: https://fishshell.com
[2]: https://www.zsh.org/mla/users/2009/msg00818.html
[3]: https://sourceforge.net/projects/fizsh/
[4]: https://github.com/ohmyzsh/ohmyzsh/pull/215
[1]: http://fishshell.com
[2]: http://www.zsh.org/mla/users/2009/msg00818.html
[3]: http://sourceforge.net/projects/fizsh/
[4]: https://github.com/robbyrussell/oh-my-zsh/pull/215
[5]: https://github.com/zsh-users/zsh-history-substring-search
[6]: https://github.com/zsh-users/zsh-syntax-highlighting
------------------------------------------------------------------------------
Requirements
------------------------------------------------------------------------------
* [ZSH](http://zsh.sourceforge.net) 4.3 or newer
Install
------------------------------------------------------------------------------
Using the [Homebrew]( https://brew.sh ) package manager:
brew install zsh-history-substring-search
echo 'source /usr/local/share/zsh-history-substring-search/zsh-history-substring-search.zsh' >> ~/.zshrc
Using [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh):
1. Clone this repository in oh-my-zsh's plugins directory:
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
2. Activate the plugin in `~/.zshrc`:
plugins=( [plugins...] history-substring-search)
3. Source `~/.zshrc` to take changes into account:
source ~/.zshrc
Usage
------------------------------------------------------------------------------
@ -33,98 +52,128 @@ Usage
% source zsh-syntax-highlighting.zsh
% source zsh-history-substring-search.zsh
2. Bind keyboard shortcuts to this script's functions:
2. Bind keyboard shortcuts to this script's functions.
# bind UP and DOWN arrow keys
zmodload zsh/terminfo
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
Users typically bind their UP and DOWN arrow keys to this script, thus:
* Run `cat -v` in your favorite terminal emulator to observe key codes.
     (**NOTE:** In some cases, `cat -v` shows the wrong key codes. If the
key codes shown by `cat -v` don't work for you, press `<C-v><UP>` and
`<C-v><DOWN>` at your ZSH command line prompt for correct key codes.)
* Press the UP arrow key and observe what is printed in your terminal.
* Press the DOWN arrow key and observe what is printed in your terminal.
* Press the Control and C keys simultaneously to terminate the `cat -v`.
* Use your observations from the previous steps to create key bindings.
For example, if you observed `^[[A` for UP and `^[[B` for DOWN, then:
# bind UP and DOWN arrow keys (compatibility fallback
# for Ubuntu 12.04, Fedora 21, and MacOSX 10.9 users)
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
# bind P and N for EMACS mode
However, if the observed values don't work, you can try using terminfo:
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
You might also want to bind the Control-P/N keys for use in EMACS mode:
bindkey -M emacs '^P' history-substring-search-up
bindkey -M emacs '^N' history-substring-search-down
# bind k and j for VI mode
You might also want to bind the `k` and `j` keys for use in VI mode:
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
3. Type any part of any previous command and then:
* Press the UP arrow key to select the nearest command that (1) contains
your query and (2) is older than the current command in the command
history.
* Press the `history-substring-search-up` key, which was configured in
step 2 above, to select the nearest command that (1) contains your query
and (2) is also older than the current command in your command history.
* Press the DOWN arrow key to select the nearest command that (1)
contains your query and (2) is newer than the current command in the
command history.
* Press the `history-substring-search-down` key, which was configured in
step 2 above, to select the nearest command that (1) contains your query
and (2) is also newer than the current command in your command history.
* Press ^U (the Control and U keys simultaneously) to abort the search.
* Press `^U` the Control and U keys simultaneously to abort the search.
4. If a matching command spans more than one line of text, press the LEFT
arrow key to move the cursor away from the end of the command, and then:
* Press the UP arrow key to move the cursor to the line above. When the
cursor reaches the first line of the command, pressing the UP arrow
key again will cause this script to perform another search.
* Press the `history-substring-search-up` key, which was configured in
step 2 above, to move the cursor to the line above the cursored line.
When the cursor reaches the first line of the command, pressing the
`history-substring-search-up` key again will cause this script to
perform another search.
* Press the `history-substring-search-down` key, which was configured in
step 2 above, to move the cursor to the line below the cursored line.
When the cursor reaches the last line of the command, pressing the
`history-substring-search-down` key, which was configured in step 2
above, again will cause this script to perform another search.
* Press the DOWN arrow key to move the cursor to the line below. When
the cursor reaches the last line of the command, pressing the DOWN
arrow key again will cause this script to perform another search.
------------------------------------------------------------------------------
Configuration
------------------------------------------------------------------------------
This script defines the following global variables. You may override their
default values only after having loaded this script into your ZSH session.
* HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND is a global variable that defines
* `HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND` is a global variable that defines
how the query should be highlighted inside a matching command. Its default
value causes this script to highlight using bold, white text on a magenta
background. See the "Character Highlighting" section in the zshzle(1) man
page to learn about the kinds of values you may assign to this variable.
* HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND is a global variable that
* `HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND` is a global variable that
defines how the query should be highlighted when no commands in the
history match it. Its default value causes this script to highlight using
bold, white text on a red background. See the "Character Highlighting"
section in the zshzle(1) man page to learn about the kinds of values you
may assign to this variable.
* HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS is a global variable that defines
* `HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS` is a global variable that defines
how the command history will be searched for your query. Its default value
causes this script to perform a case-insensitive search. See the "Globbing
Flags" section in the zshexpn(1) man page to learn about the kinds of
values you may assign to this variable.
To always receive _unique_ search results, use `setopt HIST_IGNORE_ALL_DUPS`.
Alternatively, use `setopt HIST_FIND_NO_DUPS` which makes this plugin skip
duplicate _adjacent_ search results as you cycle through them---however, this
does not guarantee that search results are unique: if your search results were
"Dog", "Dog", "HotDog", "Dog", then cycling them gives "Dog", "HotDog", "Dog".
Notice that the "Dog" search result appeared twice as you cycled through them!
If you wish to avoid this limitation, then use `setopt HIST_IGNORE_ALL_DUPS`.
* `HISTORY_SUBSTRING_SEARCH_FUZZY` is a global variable that defines
how the command history will be searched for your query. If set to a non-empty
value, causes this script to perform a fuzzy search by words, matching in
given order e.g. `ab c` will match `*ab*c*`
* `HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE` is a global variable that defines
whether all search results returned are _unique_. If set to a non-empty
value, then only unique search results are presented. This behaviour is off
by default. An alternative way to ensure that search results are unique is
to use `setopt HIST_IGNORE_ALL_DUPS`. If this configuration variable is off
and `setopt HIST_IGNORE_ALL_DUPS` is unset, then `setopt HIST_FIND_NO_DUPS`
is still respected and it makes this script skip duplicate _adjacent_ search
results as you cycle through them, but this does not guarantee that search
results are unique: if your search results were "Dog", "Dog", "HotDog",
"Dog", then cycling them gives "Dog", "HotDog", "Dog". Notice that the "Dog"
search result appeared twice as you cycled through them. If you wish to
receive globally unique search results only once, then use this
configuration variable, or use `setopt HIST_IGNORE_ALL_DUPS`.
------------------------------------------------------------------------------
History
------------------------------------------------------------------------------
This script was originally written by [Peter Stephenson][2], who published it
to the ZSH users mailing list (thereby making it public domain) in September
2009. It was later revised by Guido van Steen and released under the BSD
license (see below) as part of [the fizsh project][3] in January 2011.
* September 2009: [Peter Stephenson][2] originally wrote this script and it
published to the zsh-users mailing list.
It was later extracted from fizsh release 1.0.1, refactored heavily, and
repackaged as both an [oh-my-zsh plugin][4] and as an independently loadable
[ZSH script][5] by Suraj N. Kurapati in 2011.
* January 2011: Guido van Steen (@guidovansteen) revised this script and
released it under the 3-clause BSD license as part of [fizsh][3], the
Friendly Interactive ZSHell.
It was [further developed][4] by Guido van Steen, Suraj N. Kurapati, Sorin
Ionescu, and Vincent Guerci in 2011.
* January 2011: Suraj N. Kurapati (@sunaku) extracted this script from
[fizsh][3] 1.0.1, refactored it heavily, and finally repackaged it as an
[oh-my-zsh plugin][4] and as an independently loadable [ZSH script][5].
* July 2011: Guido van Steen, Suraj N. Kurapati, and Sorin Ionescu
(@sorin-ionescu) [further developed it][4] with Vincent Guerci (@vguerci).
* March 2016: Geza Lore (@gezalore) greatly refactored it in pull request #55.
------------------------------------------------------------------------------
Oh My Zsh Distribution Notes
@ -138,8 +187,8 @@ https://github.com/zsh-users/zsh-history-substring-search.
This downstream copy was last updated from the following upstream commit:
SHA: 2c295432175990c1bb4e90bc13f609daa67a25d6
Commit date: 2015-09-28 10:47:34 -0700
SHA: 0f80b8eb3368b46e5e573c1d91ae69eb095db3fb
Commit date: 2019-05-12 17:35:54 -0700
Everything above this section is a copy of the original upstream's README, so things
may differ slightly when you're using this inside OMZ. In particular, you do not

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