Unverified Commit 8c95c523 authored by Kozlov Alexander's avatar Kozlov Alexander Committed by GitHub

Merge branch 'master' into master

parents dd30cf10 3d8f2bda
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2009-2017 Robby Russell and contributors Copyright (c) 2009-2018 Robby Russell and contributors
See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh"> <img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh">
</p> </p>
Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration. Oh My Zsh is an open source, community-driven framework for managing your [zsh](https://www.zsh.org/) configuration.
Sounds boring. Let's try again. Sounds boring. Let's try again.
...@@ -12,7 +12,7 @@ Once installed, your terminal shell will become the talk of the town _or your mo ...@@ -12,7 +12,7 @@ Once installed, your terminal shell will become the talk of the town _or your mo
Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often. 😬 Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often. 😬
To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. To learn more, visit [ohmyz.sh](https://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.
## Getting Started ## Getting Started
...@@ -21,7 +21,7 @@ To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://t ...@@ -21,7 +21,7 @@ To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://t
__Disclaimer:__ _Oh My Zsh works best on macOS and Linux._ __Disclaimer:__ _Oh My Zsh works best on macOS and Linux._
* Unix-like operating system (macOS or Linux) * Unix-like operating system (macOS or Linux)
* [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH) * [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH)
* `curl` or `wget` should be installed * `curl` or `wget` should be installed
* `git` should be installed * `git` should be installed
...@@ -141,7 +141,7 @@ export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubus ...@@ -141,7 +141,7 @@ export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubus
##### 1. Clone the repository: ##### 1. Clone the repository:
```shell ```shell
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
``` ```
##### 2. *Optionally*, backup your existing `~/.zshrc` file: ##### 2. *Optionally*, backup your existing `~/.zshrc` file:
...@@ -215,7 +215,7 @@ If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the co ...@@ -215,7 +215,7 @@ If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the co
## Contributing ## Contributing
I'm far from being a [Zsh](http://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests! I'm far from being a [Zsh](https://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/robbyrussell/oh-my-zsh/issues) and help where you can. We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/robbyrussell/oh-my-zsh/issues) and help where you can.
...@@ -238,7 +238,7 @@ We're on the social media. ...@@ -238,7 +238,7 @@ We're on the social media.
## Merchandise ## Merchandise
We have [stickers](https://shop.planetargon.com/products/ohmyzsh-stickers-set-of-3-stickers) and [shirts](http://shop.planetargon.com/products/ohmyzsh-t-shirts) for you to show off your love of Oh My Zsh. Again, this will help you become the talk of the town! We have [stickers](https://shop.planetargon.com/products/ohmyzsh-stickers-set-of-3-stickers) and [shirts](https://shop.planetargon.com/products/ohmyzsh-t-shirts) for you to show off your love of Oh My Zsh. Again, this will help you become the talk of the town!
## License ## License
...@@ -248,4 +248,4 @@ Oh My Zsh is released under the [MIT license](LICENSE.txt). ...@@ -248,4 +248,4 @@ Oh My Zsh is released under the [MIT license](LICENSE.txt).
![Planet Argon](https://pa-github-assets.s3.amazonaws.com/PARGON_logo_digital_COL-small.jpg) ![Planet Argon](https://pa-github-assets.s3.amazonaws.com/PARGON_logo_digital_COL-small.jpg)
Oh My Zsh was started by the team at [Planet Argon](https://www.planetargon.com/?utm_source=github), a [Ruby on Rails development agency](https://www.planetargon.com/skills/ruby-on-rails-development?utm_source=github). Oh My Zsh was started by the team at [Planet Argon](https://www.planetargon.com/?utm_source=github), a [Ruby on Rails development agency](https://www.planetargon.com/skills/ruby-on-rails-development?utm_source=github). Check out our [other open source projects](https://www.planetargon.com/open-source?utm_source=github).
# Found on the ZshWiki # Put your custom themes in this folder.
# http://zshwiki.org/home/config/prompt # Example:
#
PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% " PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "
\ No newline at end of file
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
# insecure ownership or permissions) by: # insecure ownership or permissions) by:
# #
# * Human-readably notifying the user of these insecurities. # * Human-readably notifying the user of these insecurities.
# * Moving away all existing completion caches to a temporary directory. Since
# any of these caches may have been generated from insecure directories, they
# are all suspect now. Failing to do so typically causes subsequent compinit()
# calls to fail with "command not found: compdef" errors. (That's bad.)
function handle_completion_insecurities() { function handle_completion_insecurities() {
# List of the absolute paths of all unique insecure directories, split on # List of the absolute paths of all unique insecure directories, split on
# newline from compaudit()'s output resembling: # newline from compaudit()'s output resembling:
...@@ -22,39 +18,27 @@ function handle_completion_insecurities() { ...@@ -22,39 +18,27 @@ function handle_completion_insecurities() {
insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} ) insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
# If no such directories exist, get us out of here. # If no such directories exist, get us out of here.
if (( ! ${#insecure_dirs} )); then (( ! ${#insecure_dirs} )) && return
print "[oh-my-zsh] No insecure completion-dependent directories detected."
return
fi
# List ownership and permissions of all insecure directories. # List ownership and permissions of all insecure directories.
print "[oh-my-zsh] Insecure completion-dependent directories detected:" print "[oh-my-zsh] Insecure completion-dependent directories detected:"
ls -ld "${(@)insecure_dirs}" ls -ld "${(@)insecure_dirs}"
print "[oh-my-zsh] For safety, completions will be disabled until you manually fix all"
print "[oh-my-zsh] insecure directory permissions and ownership and restart oh-my-zsh."
print "[oh-my-zsh] See the above list for directories with group or other writability.\n"
# Locally enable the "NULL_GLOB" option, thus removing unmatched filename cat <<EOD
# globs from argument lists *AND* printing no warning when doing so. Failing
# to do so prints an unreadable warning if no completion caches exist below.
setopt local_options null_glob
# List of the absolute paths of all unique existing completion caches. [oh-my-zsh] For safety, we will not load completions from these directories until
local -aU zcompdump_files [oh-my-zsh] you fix their permissions and ownership and restart zsh.
zcompdump_files=( "${ZSH_COMPDUMP}"(.) "${ZDOTDIR:-${HOME}}"/.zcompdump* ) [oh-my-zsh] See the above list for directories with group or other writability.
# Move such caches to a temporary directory. [oh-my-zsh] To fix your permissions you can do so by disabling
if (( ${#zcompdump_files} )); then [oh-my-zsh] the write permission of "group" and "others" and making sure that the
# Absolute path of the directory to which such files will be moved. [oh-my-zsh] owner of these directories is either root or your current user.
local ZSH_ZCOMPDUMP_BAD_DIR="${ZSH_CACHE_DIR}/zcompdump-bad" [oh-my-zsh] The following command may help:
[oh-my-zsh] compaudit | xargs chmod g-w,o-w
# List such files first. [oh-my-zsh] If the above didn't help or you want to skip the verification of
print "[oh-my-zsh] Insecure completion caches also detected:" [oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
ls -l "${(@)zcompdump_files}" [oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.
# For safety, move rather than permanently remove such files. EOD
print "[oh-my-zsh] Moving to \"${ZSH_ZCOMPDUMP_BAD_DIR}/\"...\n"
mkdir -p "${ZSH_ZCOMPDUMP_BAD_DIR}"
mv "${(@)zcompdump_files}" "${ZSH_ZCOMPDUMP_BAD_DIR}/"
fi
} }
...@@ -25,6 +25,9 @@ else ...@@ -25,6 +25,9 @@ else
fi fi
unset CASE_SENSITIVE HYPHEN_INSENSITIVE unset CASE_SENSITIVE HYPHEN_INSENSITIVE
# Complete . and .. special directories
zstyle ':completion:*' special-dirs true
zstyle ':completion:*' list-colors '' zstyle ':completion:*' list-colors ''
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
......
if [[ "$ENABLE_CORRECTION" == "true" ]]; then if [[ "$ENABLE_CORRECTION" == "true" ]]; then
alias cp='nocorrect cp'
alias ebuild='nocorrect ebuild' alias ebuild='nocorrect ebuild'
alias gist='nocorrect gist' alias gist='nocorrect gist'
alias heroku='nocorrect heroku' alias heroku='nocorrect heroku'
......
...@@ -28,7 +28,3 @@ alias lsa='ls -lah' ...@@ -28,7 +28,3 @@ alias lsa='ls -lah'
alias l='ls -lah' alias l='ls -lah'
alias ll='ls -lh' alias ll='ls -lh'
alias la='ls -lAh' alias la='ls -lAh'
# Push and pop directories on directory stack
alias pu='pushd'
alias po='popd'
...@@ -11,21 +11,20 @@ function upgrade_oh_my_zsh() { ...@@ -11,21 +11,20 @@ function upgrade_oh_my_zsh() {
} }
function take() { function take() {
mkdir -p $1 mkdir -p $@ && cd ${@:$#}
cd $1
} }
function open_command() { function open_command() {
emulate -L zsh
setopt shwordsplit
local open_cmd local open_cmd
# define the open command # define the open command
case "$OSTYPE" in case "$OSTYPE" in
darwin*) open_cmd='open' ;; darwin*) open_cmd='open' ;;
cygwin*) open_cmd='cygstart' ;; cygwin*) open_cmd='cygstart' ;;
linux*) open_cmd='xdg-open' ;; linux*) ! [[ $(uname -a) =~ "Microsoft" ]] && open_cmd='xdg-open' || {
open_cmd='cmd.exe /c start ""'
[[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
} ;;
msys*) open_cmd='start ""' ;; msys*) open_cmd='start ""' ;;
*) echo "Platform $OSTYPE not supported" *) echo "Platform $OSTYPE not supported"
return 1 return 1
...@@ -34,9 +33,9 @@ function open_command() { ...@@ -34,9 +33,9 @@ function open_command() {
# don't use nohup on OSX # don't use nohup on OSX
if [[ "$OSTYPE" == darwin* ]]; then if [[ "$OSTYPE" == darwin* ]]; then
$open_cmd "$@" &>/dev/null ${=open_cmd} "$@" &>/dev/null
else else
nohup $open_cmd "$@" &>/dev/null nohup ${=open_cmd} "$@" &>/dev/null
fi fi
} }
...@@ -52,8 +51,7 @@ function open_command() { ...@@ -52,8 +51,7 @@ function open_command() {
# 1 if it does not exist # 1 if it does not exist
# #
function alias_value() { function alias_value() {
alias "$1" | sed "s/^$1='\(.*\)'$/\1/" (( $+aliases[$1] )) && echo $aliases[$1]
test $(alias "$1")
} }
# #
......
...@@ -77,8 +77,8 @@ function git_current_branch() { ...@@ -77,8 +77,8 @@ function git_current_branch() {
# Gets the number of commits ahead from remote # Gets the number of commits ahead from remote
function git_commits_ahead() { function git_commits_ahead() {
if command git rev-parse --git-dir &>/dev/null; then if command git rev-parse --git-dir &>/dev/null; then
local commits="$(git rev-list --count @{upstream}..HEAD)" local commits="$(git rev-list --count @{upstream}..HEAD 2>/dev/null)"
if [[ "$commits" != 0 ]]; then if [[ -n "$commits" && "$commits" != 0 ]]; then
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX" echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
fi fi
fi fi
...@@ -87,8 +87,8 @@ function git_commits_ahead() { ...@@ -87,8 +87,8 @@ function git_commits_ahead() {
# Gets the number of commits behind remote # Gets the number of commits behind remote
function git_commits_behind() { function git_commits_behind() {
if command git rev-parse --git-dir &>/dev/null; then if command git rev-parse --git-dir &>/dev/null; then
local commits="$(git rev-list --count HEAD..@{upstream})" local commits="$(git rev-list --count HEAD..@{upstream} 2>/dev/null)"
if [[ "$commits" != 0 ]]; then if [[ -n "$commits" && "$commits" != 0 ]]; then
echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX" echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX"
fi fi
fi fi
...@@ -141,11 +141,15 @@ function git_prompt_status() { ...@@ -141,11 +141,15 @@ function git_prompt_status() {
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
elif $(echo "$INDEX" | grep '^MM ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
fi fi
if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
elif $(echo "$INDEX" | grep '^MM ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
fi fi
...@@ -181,7 +185,7 @@ function git_prompt_status() { ...@@ -181,7 +185,7 @@ function git_prompt_status() {
# Outputs -1, 0, or 1 if the installed version is less than, equal to, or # Outputs -1, 0, or 1 if the installed version is less than, equal to, or
# greater than the input version, respectively. # greater than the input version, respectively.
function git_compare_version() { function git_compare_version() {
local INPUT_GIT_VERSION INSTALLED_GIT_VERSION local INPUT_GIT_VERSION INSTALLED_GIT_VERSION i
INPUT_GIT_VERSION=(${(s/./)1}) INPUT_GIT_VERSION=(${(s/./)1})
INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null)) INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null))
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]}) INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]})
......
## Command history configuration ## History wrapper
if [ -z "$HISTFILE" ]; then function omz_history {
HISTFILE=$HOME/.zsh_history local clear list
fi zparseopts -E c=clear l=list
HISTSIZE=10000 if [[ -n "$clear" ]]; then
SAVEHIST=10000 # if -c provided, clobber the history file
echo -n >| "$HISTFILE"
echo >&2 History file deleted. Reload the session to see its effects.
elif [[ -n "$list" ]]; then
# if -l provided, run as if calling `fc' directly
builtin fc "$@"
else
# unless a number is provided, show all history events (starting from 1)
[[ ${@[-1]} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
fi
}
# Show history # Timestamp format
case $HIST_STAMPS in case $HIST_STAMPS in
"mm/dd/yyyy") alias history='fc -fl 1' ;; "mm/dd/yyyy") alias history='omz_history -f' ;;
"dd.mm.yyyy") alias history='fc -El 1' ;; "dd.mm.yyyy") alias history='omz_history -E' ;;
"yyyy-mm-dd") alias history='fc -il 1' ;; "yyyy-mm-dd") alias history='omz_history -i' ;;
*) alias history='fc -l 1' ;; "") alias history='omz_history' ;;
*) alias history="omz_history -t '$HIST_STAMPS'" ;;
esac esac
setopt append_history ## History file configuration
setopt extended_history [ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
setopt hist_expire_dups_first HISTSIZE=50000
setopt hist_ignore_dups # ignore duplication command history list SAVEHIST=10000
setopt hist_ignore_space
setopt hist_verify ## History command configuration
setopt inc_append_history setopt extended_history # record timestamp of command in HISTFILE
setopt share_history # share command history data setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
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
...@@ -18,9 +18,8 @@ fi ...@@ -18,9 +18,8 @@ fi
## jobs ## jobs
setopt long_list_jobs setopt long_list_jobs
## pager env_default 'PAGER' 'less'
env_default PAGER 'less' env_default 'LESS' '-R'
env_default LESS '-R'
## super user alias ## super user alias
alias _='sudo' alias _='sudo'
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# Real implementations will be used when the respective plugins are loaded # Real implementations will be used when the respective plugins are loaded
function chruby_prompt_info hg_prompt_info pyenv_prompt_info \ function chruby_prompt_info hg_prompt_info pyenv_prompt_info \
rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \ rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \
virtualenv_prompt_info { virtualenv_prompt_info jenv_prompt_info {
return 1 return 1
} }
......
#! /bin/zsh #! /bin/zsh
# A script to make using 256 colors in zsh less painful. # A script to make using 256 colors in zsh less painful.
# P.C. Shyamshankar <sykora@lucentbeing.com> # P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ # Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
typeset -AHg FX FG BG typeset -AHg FX FG BG
......
...@@ -80,7 +80,7 @@ preexec_functions+=(omz_termsupport_preexec) ...@@ -80,7 +80,7 @@ preexec_functions+=(omz_termsupport_preexec)
# Keep Apple Terminal.app's current working directory updated # Keep Apple Terminal.app's current working directory updated
# Based on this answer: http://superuser.com/a/315029 # Based on this answer: https://superuser.com/a/315029
# With extra fixes to handle multibyte chars and non-UTF-8 locales # With extra fixes to handle multibyte chars and non-UTF-8 locales
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
......
# Set ZSH_CACHE_DIR to the path where cache files should be created
# or else we will use the default cache/
if [[ -z "$ZSH_CACHE_DIR" ]]; then
ZSH_CACHE_DIR="$ZSH/cache"
fi
# Migrate .zsh-update file to $ZSH_CACHE_DIR
if [ -f ~/.zsh-update ] && [ ! -f ${ZSH_CACHE_DIR}/.zsh-update ]; then
mv ~/.zsh-update ${ZSH_CACHE_DIR}/.zsh-update
fi
# Check for updates on initial load... # Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh env ZSH=$ZSH ZSH_CACHE_DIR=$ZSH_CACHE_DIR DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
fi fi
# Initializes Oh My Zsh # Initializes Oh My Zsh
...@@ -11,20 +22,12 @@ fpath=($ZSH/functions $ZSH/completions $fpath) ...@@ -11,20 +22,12 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
# Load all stock functions (from $fpath files) called below. # Load all stock functions (from $fpath files) called below.
autoload -U compaudit compinit autoload -U compaudit compinit
: ${ZSH_DISABLE_COMPFIX:=true}
# Set ZSH_CUSTOM to the path where your custom config files # Set ZSH_CUSTOM to the path where your custom config files
# and plugins exists, or else we will use the default custom/ # and plugins exists, or else we will use the default custom/
if [[ -z "$ZSH_CUSTOM" ]]; then if [[ -z "$ZSH_CUSTOM" ]]; then
ZSH_CUSTOM="$ZSH/custom" ZSH_CUSTOM="$ZSH/custom"
fi fi
# Set ZSH_CACHE_DIR to the path where cache files should be created
# or else we will use the default cache/
if [[ -z "$ZSH_CACHE_DIR" ]]; then
ZSH_CACHE_DIR="$ZSH/cache"
fi
# Load all of the config files in ~/oh-my-zsh that end in .zsh # Load all of the config files in ~/oh-my-zsh that end in .zsh
# TIP: Add files you don't want in git to .gitignore # TIP: Add files you don't want in git to .gitignore
...@@ -65,16 +68,15 @@ if [ -z "$ZSH_COMPDUMP" ]; then ...@@ -65,16 +68,15 @@ if [ -z "$ZSH_COMPDUMP" ]; then
fi fi
if [[ $ZSH_DISABLE_COMPFIX != true ]]; then if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
# If completion insecurities exist, warn the user without enabling completions. # If completion insecurities exist, warn the user
if ! compaudit &>/dev/null; then if ! compaudit &>/dev/null; then
# This function resides in the "lib/compfix.zsh" script sourced above.
handle_completion_insecurities handle_completion_insecurities
# Else, enable and cache completions to the desired file.
else
compinit -d "${ZSH_COMPDUMP}"
fi fi
else # Load only from secure directories
compinit -i -d "${ZSH_COMPDUMP}" compinit -i -d "${ZSH_COMPDUMP}"
else
# If the user wants it, load from all found directories
compinit -u -d "${ZSH_COMPDUMP}"
fi fi
# Load all of the plugins that were defined in ~/.zshrc # Load all of the plugins that were defined in ~/.zshrc
......
...@@ -48,8 +48,8 @@ _arguments \ ...@@ -48,8 +48,8 @@ _arguments \
case "$state" in case "$state" in
specify_device) specify_device)
_values 'devices' $(adb devices -l|awk 'NR>1&& $1 ~ /^[a-zA-Z0-9].*$/ \ _values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \
{printf "%s[%s] ",$1,$6 }') {sub(/ +/," ",$0);gsub(":","\\:",$1); printf "%s[%s] ",$1, $NF}'):-""}
return return
;; ;;
esac esac
......
# Ant
This plugin provides completion for [Ant](https://ant.apache.org/).
To use it add ant to the plugins array in your zshrc file.
```bash
plugins=(... ant)
```
It caches ant targets in a file named `.ant_targets`, you might want to add that to
your `.gitignore` file.
...@@ -2,6 +2,51 @@ ...@@ -2,6 +2,51 @@
## Features ## Features
#### YAY
| Alias | Command | Description |
|---------|------------------------------------|---------------------------------------------------------------------|
| yaconf | yay -Pg | Print current configuration |
| yain | yay -S | Install packages from the repositories |
| yains | yay -U | Install a package from a local file |
| yainsd | yay -S --asdeps | Install packages as dependencies of another package |
| yaloc | yay -Qi | Display information about a package in the local database |
| yalocs | yay -Qs | Search for packages in the local database |
| yalst | yay -Qe | List installed packages including from AUR (tagged as "local") |
| yamir | yay -Syy | Force refresh of all package lists after updating mirrorlist |
| yaorph | yay -Qtd | Remove orphans using yaourt |
| yare | yay -R | Remove packages, keeping its settings and dependencies |
| yarem | yay -Rns | Remove packages, including its settings and unneeded dependencies |
| yarep | yay -Si | Display information about a package in the repositories |
| yareps | yay -Ss | Search for packages in the repositories |
| yaupg | yay -Syu | Sync with repositories before upgrading packages |
| yasu | yay -Syu --no-confirm | Same as `yaupg`, but without confirmation |
#### TRIZEN
| Alias | Command | Description |
|---------|------------------------------------|---------------------------------------------------------------------|
| trconf | trizen -C | Fix all configuration files with vimdiff |
| trin | trizen -S | Install packages from the repositories |
| trins | trizen -U | Install a package from a local file |
| trinsd | trizen -S --asdeps | Install packages as dependencies of another package |
| trloc | trizen -Qi | Display information about a package in the local database |
| trlocs | trizen -Qs | Search for packages in the local database |
| trlst | trizen -Qe | List installed packages including from AUR (tagged as "local") |
| trmir | trizen -Syy | Force refresh of all package lists after updating mirrorlist |
| trorph | trizen -Qtd | Remove orphans using yaourt |
| trre | trizen -R | Remove packages, keeping its settings and dependencies |
| trrem | trizen -Rns | Remove packages, including its settings and unneeded dependencies |
| trrep | trizen -Si | Display information about a package in the repositories |
| trreps | trizen -Ss | Search for packages in the repositories |
| trupd | trizen -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases |
| trupd | trizen -Sy && sudo abs | Update and refresh the local package and ABS databases |
| trupd | trizen -Sy && sudo aur | Update and refresh the local package and AUR databases |
| trupd | trizen -Sy | Update and refresh the local package database |
| trupg | trizen -Syua | Sync with repositories before upgrading all packages (from AUR too) |
| trsu | trizen -Syua --no-confirm | Same as `trupg`, but without confirmation |
| upgrade | trizen -Syu | Sync with repositories before upgrading packages |
#### YAOURT #### YAOURT
| Alias | Command | Description | | Alias | Command | Description |
...@@ -27,7 +72,7 @@ ...@@ -27,7 +72,7 @@
| yasu | yaourt -Syua --no-confirm | Same as `yaupg`, but without confirmation | | yasu | yaourt -Syua --no-confirm | Same as `yaupg`, but without confirmation |
| upgrade | yaourt -Syu | Sync with repositories before upgrading packages | | upgrade | yaourt -Syu | Sync with repositories before upgrading packages |
### PACAUR #### PACAUR
| Alias | Command | Description | | Alias | Command | Description |
|---------|------------------------------------|---------------------------------------------------------------------| |---------|------------------------------------|---------------------------------------------------------------------|
...@@ -74,7 +119,9 @@ ...@@ -74,7 +119,9 @@
| pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages | | pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages |
| upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages | | upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages |
| pacfileupg | sudo pacman -Fy | Download fresh package databases from the server | | pacfileupg | sudo pacman -Fy | Download fresh package databases from the server |
| pacfiles | pacman -Fs | Search package file names for matching strings. | | pacfiles | pacman -Fs | Search package file names for matching strings |
| pacls | pacman -Ql | List files in a package |
| pacown | pacman -Qo | Show which package owns a file |
| Function | Description | | Function | Description |
|----------------|------------------------------------------------------| |----------------|------------------------------------------------------|
...@@ -82,6 +129,7 @@ ...@@ -82,6 +129,7 @@
| paclist | List all installed packages with a short description | | paclist | List all installed packages with a short description |
| pacmanallkeys | Get all keys for developers and trusted users | | pacmanallkeys | Get all keys for developers and trusted users |
| pacmansignkeys | Locally trust all keys passed as parameters | | pacmansignkeys | Locally trust all keys passed as parameters |
| pacweb | Open the website of an ArchLinux package |
--- ---
...@@ -95,3 +143,4 @@ ...@@ -95,3 +143,4 @@
- ornicar - thibault.duplessis@gmail.com - ornicar - thibault.duplessis@gmail.com
- Juraj Fiala - doctorjellyface@riseup.net - Juraj Fiala - doctorjellyface@riseup.net
- Majora320 (Moses Miller) - Majora320@gmail.com - Majora320 (Moses Miller) - Majora320@gmail.com
- Ybalrid (Arthur Brainville) - ybalrid@ybalrid.info
if (( $+commands[trizen] )); then
alias trconf='trizen -C'
alias trupg='trizen -Syua'
alias trsu='trizen -Syua --noconfirm'
alias trin='trizen -S'
alias trins='trizen -U'
alias trre='trizen -R'
alias trrem='trizen -Rns'
alias trrep='trizen -Si'
alias trreps='trizen -Ss'
alias trloc='trizen -Qi'
alias trlocs='trizen -Qs'
alias trlst='trizen -Qe'
alias trorph='trizen -Qtd'
alias trinsd='trizen -S --asdeps'
alias trmir='trizen -Syy'
if (( $+commands[abs] && $+commands[aur] )); then
alias trupd='trizen -Sy && sudo abs && sudo aur'
elif (( $+commands[abs] )); then
alias trupd='trizen -Sy && sudo abs'
elif (( $+commands[aur] )); then
alias trupd='trizen -Sy && sudo aur'
else
alias trupd='trizen -Sy'
fi
fi
if (( $+commands[yaourt] )); then if (( $+commands[yaourt] )); then
alias yaconf='yaourt -C' alias yaconf='yaourt -C'
alias yaupg='yaourt -Syua' alias yaupg='yaourt -Syua'
...@@ -27,6 +56,35 @@ if (( $+commands[yaourt] )); then ...@@ -27,6 +56,35 @@ if (( $+commands[yaourt] )); then
fi fi
fi fi
if (( $+commands[yay] )); then
alias yaconf='yay -Pg'
alias yaupg='yay -Syu'
alias yasu='yay -Syu --noconfirm'
alias yain='yay -S'
alias yains='yay -U'
alias yare='yay -R'
alias yarem='yay -Rns'
alias yarep='yay -Si'
alias yareps='yay -Ss'
alias yaloc='yay -Qi'
alias yalocs='yay -Qs'
alias yalst='yay -Qe'
alias yaorph='yay -Qtd'
alias yainsd='yay -S --asdeps'
alias yamir='yay -Syy'
if (( $+commands[abs] && $+commands[aur] )); then
alias yaupd='yay -Sy && sudo abs && sudo aur'
elif (( $+commands[abs] )); then
alias yaupd='yay -Sy && sudo abs'
elif (( $+commands[aur] )); then
alias yaupd='yay -Sy && sudo aur'
else
alias yaupd='yay -Sy'
fi
fi
if (( $+commands[pacaur] )); then if (( $+commands[pacaur] )); then
alias paupg='pacaur -Syu' alias paupg='pacaur -Syu'
alias pasu='pacaur -Syu --noconfirm' alias pasu='pacaur -Syu --noconfirm'
...@@ -54,16 +112,24 @@ if (( $+commands[pacaur] )); then ...@@ -54,16 +112,24 @@ if (( $+commands[pacaur] )); then
fi fi
fi fi
if (( $+commands[pacaur] )); then if (( $+commands[trizen] )); then
upgrade() { function upgrade() {
trizen -Syu
}
elif (( $+commands[pacaur] )); then
function upgrade() {
pacaur -Syu pacaur -Syu
} }
elif (( $+commands[yaourt] )); then elif (( $+commands[yaourt] )); then
upgrade() { function upgrade() {
yaourt -Syu yaourt -Syu
} }
elif (( $+commands[yay] )); then
function upgrade() {
yay -Syu
}
else else
upgrade() { function upgrade() {
sudo pacman -Syu sudo pacman -Syu
} }
fi fi
...@@ -83,7 +149,9 @@ alias pacmir='sudo pacman -Syy' ...@@ -83,7 +149,9 @@ alias pacmir='sudo pacman -Syy'
alias paclsorphans='sudo pacman -Qdt' alias paclsorphans='sudo pacman -Qdt'
alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
alias pacfileupg='sudo pacman -Fy' alias pacfileupg='sudo pacman -Fy'
alias pacfiles='pacman tFs' alias pacfiles='pacman -Fs'
alias pacls='pacman -Ql'
alias pacown='pacman -Qo'
if (( $+commands[abs] && $+commands[aur] )); then if (( $+commands[abs] && $+commands[aur] )); then
...@@ -96,13 +164,13 @@ else ...@@ -96,13 +164,13 @@ else
alias pacupd='sudo pacman -Sy' alias pacupd='sudo pacman -Sy'
fi fi
paclist() { function paclist() {
# Source: https://bbs.archlinux.org/viewtopic.php?id=93683 # Source: https://bbs.archlinux.org/viewtopic.php?id=93683
LC_ALL=C pacman -Qei $(pacman -Qu | cut -d " " -f 1) | \ LC_ALL=C pacman -Qei $(pacman -Qu | cut -d " " -f 1) | \
awk 'BEGIN {FS=":"} /^Name/{printf("\033[1;36m%s\033[1;37m", $2)} /^Description/{print $2}' awk 'BEGIN {FS=":"} /^Name/{printf("\033[1;36m%s\033[1;37m", $2)} /^Description/{print $2}'
} }
pacdisowned() { function pacdisowned() {
emulate -L zsh emulate -L zsh
tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$ tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
...@@ -120,14 +188,14 @@ pacdisowned() { ...@@ -120,14 +188,14 @@ pacdisowned() {
comm -23 "$fs" "$db" comm -23 "$fs" "$db"
} }
pacmanallkeys() { function pacmanallkeys() {
emulate -L zsh emulate -L zsh
curl -s https://www.archlinux.org/people/{developers,trustedusers}/ | \ curl -s https://www.archlinux.org/people/{developers,trustedusers}/ | \
awk -F\" '(/pgp.mit.edu/) { sub(/.*search=0x/,""); print $1}' | \ awk -F\" '(/pgp.mit.edu/) { sub(/.*search=0x/,""); print $1}' | \
xargs sudo pacman-key --recv-keys xargs sudo pacman-key --recv-keys
} }
pacmansignkeys() { function pacmansignkeys() {
emulate -L zsh emulate -L zsh
for key in $*; do for key in $*; do
sudo pacman-key --recv-keys $key sudo pacman-key --recv-keys $key
...@@ -136,3 +204,16 @@ pacmansignkeys() { ...@@ -136,3 +204,16 @@ pacmansignkeys() {
--no-permission-warning --command-fd 0 --edit-key $key --no-permission-warning --command-fd 0 --edit-key $key
done done
} }
if (( $+commands[xdg-open] )); then
function pacweb() {
pkg="$1"
infos="$(pacman -Si "$pkg")"
if [[ -z "$infos" ]]; then
return
fi
repo="$(grep '^Repo' <<< "$infos" | grep -oP '[^ ]+$')"
arch="$(grep '^Arch' <<< "$infos" | grep -oP '[^ ]+$')"
xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null
}
fi
# Find where asdf should be installed. # Find where asdf should be installed
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}" ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
# Load asdf, if found. # If not found, check for Homebrew package
if [ -f $ASDF_DIR/asdf.sh ]; then if [[ ! -d $ASDF_DIR ]] && (( $+commands[brew] )); then
. $ASDF_DIR/asdf.sh ASDF_DIR="$(brew --prefix asdf)"
fi
# Load command
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
. "$ASDF_DIR/asdf.sh"
# Load completions
if [[ -f "$ASDF_DIR/completions/asdf.bash" ]]; then
. "$ASDF_DIR/completions/asdf.bash"
fi
fi fi
# Autojump plugin
This plugin loads the [autojump navigation tool](https://github.com/wting/autojump).
To use it, add `autojump` to the plugins array in your zshrc file:
```zsh
plugins=(... autojump)
```
More info on the usage: https://github.com/wting/autojump
...@@ -15,8 +15,8 @@ if [ $commands[autojump] ]; then # check if autojump is installed ...@@ -15,8 +15,8 @@ if [ $commands[autojump] ]; then # check if autojump is installed
. /etc/profile.d/autojump.sh . /etc/profile.d/autojump.sh
elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation
. /usr/local/share/autojump/autojump.zsh . /usr/local/share/autojump/autojump.zsh
elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports elif [ -f /opt/local/etc/profile.d/autojump.sh ]; then # mac os x with ports
. /opt/local/etc/profile.d/autojump.zsh . /opt/local/etc/profile.d/autojump.sh
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.sh ]; then # mac os x with brew elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.sh ]; then # mac os x with brew
. `brew --prefix`/etc/autojump.sh . `brew --prefix`/etc/autojump.sh
fi fi
......
# autopep8 plugin
This plugin adds completion for [autopep8](https://pypi.org/project/autopep8/), a tool that automatically formats Python code to conform to the [PEP 8](http://www.python.org/dev/peps/pep-0008/) style guide.
To use it, add autopep8 to the plugins array of your zshrc file:
```
plugins=(... autopep8)
```
# aws
This plugin provides completion support for [awscli](https://docs.aws.amazon.com/cli/latest/reference/index.html)
and a few utilities to manage AWS profiles: a function to change profiles with autocompletion support
and a function to get the current AWS profile. The current AWS profile is also displayed in `RPROMPT`.
To use it, add `aws` to the plugins array in your zshrc file.
```zsh
plugins=(... aws)
```
## Plugin commands
* `asp <profile>`: Sets `AWS_PROFILE` and `AWS_DEFAULT_PROFILE` (legacy) to `<profile>`.
It also adds it to your RPROMPT.
* `agp`: Gets the current value of `AWS_PROFILE`.
* `aws_profiles`: Lists the available profiles in the file referenced in `AWS_CONFIG_FILE` (default: ~/.aws/config). Used to provide completion for the `asp` function.
...@@ -21,10 +21,8 @@ _awscli-homebrew-installed() { ...@@ -21,10 +21,8 @@ _awscli-homebrew-installed() {
[ -r $_brew_prefix/libexec/bin/aws_zsh_completer.sh ] &> /dev/null [ -r $_brew_prefix/libexec/bin/aws_zsh_completer.sh ] &> /dev/null
} }
export AWS_HOME=~/.aws
function agp { function agp {
echo $AWS_DEFAULT_PROFILE echo $AWS_PROFILE
} }
function asp { function asp {
...@@ -33,20 +31,19 @@ function asp { ...@@ -33,20 +31,19 @@ function asp {
export AWS_DEFAULT_PROFILE=$1 export AWS_DEFAULT_PROFILE=$1
export AWS_PROFILE=$1 export AWS_PROFILE=$1
export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>$rprompt" export RPROMPT="<aws:$AWS_PROFILE>$rprompt"
} }
function aws_profiles { function aws_profiles {
reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/')) reply=($(grep profile "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/'))
} }
compctl -K aws_profiles asp compctl -K aws_profiles asp
if _homebrew-installed && _awscli-homebrew-installed ; then if which aws_zsh_completer.sh &>/dev/null; then
_aws_zsh_completer_path=$(which aws_zsh_completer.sh 2>/dev/null)
elif _homebrew-installed && _awscli-homebrew-installed; then
_aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
else
_aws_zsh_completer_path=$(which aws_zsh_completer.sh)
fi fi
[ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path [ -n "$_aws_zsh_completer_path" ] && [ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path
unset _aws_zsh_completer_path unset _aws_zsh_completer_path
# Battery Plugin
This plugin adds some functions you can use to display battery information in your custom theme.
To use, add `battery` to the list of plugins in your `.zshrc` file:
`plugins=(... battery)`
Then, add the `battery_pct_prompt` function to your custom theme. For example:
```
RPROMPT='$(battery_pct_prompt)'
```
## bbedit ## bbedit
Plugin for BBEdit, an HTML and text editor for Mac OS X Plugin for BBEdit, an HTML and text editor for Mac OS X
### Requirements ### Requirements
* [BBEdit](http://www.barebones.com/products/bbedit/) * [BBEdit](https://www.barebones.com/products/bbedit/)
* [BBEdit Command-Line Tools](http://www.barebones.com/support/bbedit/cmd-line-tools.html) * [BBEdit Command-Line Tools](https://www.barebones.com/support/bbedit/cmd-line-tools.html)
### Usage ### Usage
......
...@@ -10,10 +10,10 @@ Standalone homepage: [t413/zsh-background-notify](https://github.com/t413/zsh-ba ...@@ -10,10 +10,10 @@ Standalone homepage: [t413/zsh-background-notify](https://github.com/t413/zsh-ba
Just add bgnotify to your plugins list in your `.zshrc` Just add bgnotify to your plugins list in your `.zshrc`
- On OS X you'll need [terminal-notifer](https://github.com/alloy/terminal-notifier) - On OS X you'll need [terminal-notifier](https://github.com/alloy/terminal-notifier)
* `brew install terminal-notifier` (or `gem install terminal-notifier`) * `brew install terminal-notifier` (or `gem install terminal-notifier`)
- On ubuntu you're already all set! - On ubuntu you're already all set!
- On windows you can use [notifu](http://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package - On windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
## Screenshots ## Screenshots
......
...@@ -42,7 +42,7 @@ bgnotify () { ## args: (title, subtitle) ...@@ -42,7 +42,7 @@ bgnotify () { ## args: (title, subtitle)
elif hash notify-send 2>/dev/null; then #ubuntu gnome! elif hash notify-send 2>/dev/null; then #ubuntu gnome!
notify-send "$1" "$2" notify-send "$1" "$2"
elif hash kdialog 2>/dev/null; then #ubuntu kde! elif hash kdialog 2>/dev/null; then #ubuntu kde!
kdialog -title "$1" --passivepopup "$2" 5 kdialog --title "$1" --passivepopup "$2" 5
elif hash notifu 2>/dev/null; then #cygwyn support! elif hash notifu 2>/dev/null; then #cygwyn support!
notifu /m "$2" /p "$1" notifu /m "$2" /p "$1"
fi fi
......
# Bower plugin
This plugin adds completion for [Bower](https://bower.io/) and a few useful aliases for common Bower commands.
To use it, add `bower` to the plugins array in your zshrc file:
```
plugins=(... bower)
```
## Aliases
| Alias | Command | Description |
|-------|-----------------|--------------------------------------------------------|
| 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. |
# brew plugin
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:
```
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. |
alias brewp='brew pin'
alias brews='brew list -1' alias brews='brew list -1'
alias brewsp='brew list --pinned'
alias bubo='brew update && brew outdated' alias bubo='brew update && brew outdated'
alias bubc='brew upgrade && brew cleanup' alias bubc='brew upgrade && brew cleanup'
alias bubu='bubo && bubc' alias bubu='bubo && bubc'
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
- adds completion for basic bundler commands - adds completion for basic bundler commands
- adds short aliases for common bundler commands - adds short aliases for common bundler commands
- `be` aliased to `bundle exec` - `be` aliased to `bundle exec`.
It also supports aliases (if `rs` is `rails server`, `be rs` will bundle-exec `rails server`).
- `bl` aliased to `bundle list` - `bl` aliased to `bundle list`
- `bp` aliased to `bundle package` - `bp` aliased to `bundle package`
- `bo` aliased to `bundle open` - `bo` aliased to `bundle open`
...@@ -13,7 +14,8 @@ ...@@ -13,7 +14,8 @@
- looks for a binstub under `./bin/` and executes it (if present) - looks for a binstub under `./bin/` and executes it (if present)
- calls `bundle exec <gem executable>` otherwise - calls `bundle exec <gem executable>` otherwise
For a full list of *common gems* being wrapped by default please look at the `bundler.plugin.zsh` file. 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`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`.
## Configuration ## Configuration
......
...@@ -14,6 +14,7 @@ bundled_commands=( ...@@ -14,6 +14,7 @@ bundled_commands=(
cucumber cucumber
foodcritic foodcritic
guard guard
hanami
irb irb
jekyll jekyll
kitchen kitchen
...@@ -53,10 +54,14 @@ done ...@@ -53,10 +54,14 @@ done
## Functions ## Functions
bundle_install() { bundle_install() {
if _bundler-installed && _within-bundled-project; then if ! _bundler-installed; then
echo "Bundler is not installed"
elif ! _within-bundled-project; then
echo "Can't 'bundle install' outside a bundled project"
else
local bundler_version=`bundle version | cut -d' ' -f3` local bundler_version=`bundle version | cut -d' ' -f3`
if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
if [[ "$OSTYPE" = darwin* ]] if [[ "$OSTYPE" = (darwin|freebsd)* ]]
then then
local cores_num="$(sysctl -n hw.ncpu)" local cores_num="$(sysctl -n hw.ncpu)"
else else
...@@ -66,8 +71,6 @@ bundle_install() { ...@@ -66,8 +71,6 @@ bundle_install() {
else else
bundle install $@ bundle install $@
fi fi
else
echo "Can't 'bundle install' outside a bundled project"
fi fi
} }
......
# Bwana
This plugin provides a function to open `man` pages directly with [Bwana](https://www.bruji.com/bwana/).
To use it add bwana to the plugins array in your zshrc file.
```bash
plugins=(... bwana)
```
# #
# Requires http://www.bruji.com/bwana/ # Requires https://www.bruji.com/bwana/
# #
if [[ -e /Applications/Bwana.app ]] || if [[ -e /Applications/Bwana.app ]] ||
( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana ) ( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana )
...@@ -9,5 +9,5 @@ then ...@@ -9,5 +9,5 @@ then
} }
else else
echo "Bwana lets you read man files in Safari through a man: URI scheme" echo "Bwana lets you read man files in Safari through a man: URI scheme"
echo "To use it within Zsh, install it from http://www.bruji.com/bwana/" echo "To use it within Zsh, install it from https://www.bruji.com/bwana/"
fi fi
# Cabal
This plugin provides completion for [Cabal](https://www.haskell.org/cabal/), a build tool for Haskell. It
also provides a function `cabal_sandbox_info` that prints whether the current working directory is in a sandbox.
To use it, add cabal to the plugins array of your zshrc file:
```
plugins=(... cabal)
```
# Capistrano
This plugin provides completion for [Capistrano](https://capistranorb.com/).
To use it add capistrano to the plugins array in your zshrc file.
```bash
plugins=(... capistrano)
```
For a working completion use the `capit` command instead of `cap`, because cap is a
[reserved word in zsh](http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module).
`capit` automatically runs cap with bundler if a Gemfile is found.
# Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work. # Added `capit` because `cap` is a reserved word. `cap` completion doesn't work.
# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module # http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module
func capit() { function capit() {
if [ -f Gemfile ] if [ -f Gemfile ]
then then
bundle exec cap $* bundle exec cap $*
......
# catimg
Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/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. Reload the source file or restart your Terminal session:
```console
$ source ~/.zshrc
$
```
## Functions
| Function | Description |
| -------- | ---------------------------------------- |
| `catimg` | Displays the given image on the terminal |
## Usage examples
[![asciicast](https://asciinema.org/a/204702.png)](https://asciinema.org/a/204702)
################################################################################ ################################################################################
# catimg script by Eduardo San Martin Morote aka Posva # # catimg script by Eduardo San Martin Morote aka Posva #
# http://posva.net # # https://posva.net #
# # # #
# Ouput the content of an image to the stdout using the 256 colors of the # # Ouput the content of an image to the stdout using the 256 colors of the #
# terminal. # # terminal. #
......
################################################################################ ################################################################################
# catimg script by Eduardo San Martin Morote aka Posva # # catimg script by Eduardo San Martin Morote aka Posva #
# http://posva.net # # https://posva.net #
# # # #
# Ouput the content of an image to the stdout using the 256 colors of the # # Ouput the content of an image to the stdout using the 256 colors of the #
# terminal. # # terminal. #
......
# Celery
This plugin provides completion for [Celery](http://www.celeryproject.org/).
To use it add celery to the plugins array in your zshrc file.
```bash
plugins=(... celery)
```
...@@ -111,5 +111,11 @@ function chruby_prompt_info() { ...@@ -111,5 +111,11 @@ function chruby_prompt_info() {
} }
# complete on installed rubies # complete on installed rubies
_chruby() { compadd $(chruby | tr -d '* ') } _chruby() {
compadd $(chruby | tr -d '* ')
local default_path='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
if PATH=${default_path} type ruby &> /dev/null; then
compadd system
fi
}
compdef _chruby chruby compdef _chruby chruby
License: GPL v2
Thanks to http://www.k-lug.org/~kessler/projects.html for the fortune file.
# chucknorris
Chuck Norris fortunes plugin for oh-my-zsh
**Maintainers**: [apjanke](https://github.com/apjanke) [maff](https://github.com/maff)
To use it add `chucknorris` to the plugins array in you zshrc file.
```zsh
plugins=(... chucknorris)
```
Depends on fortune (and cowsay if using chuck_cow) being installed (available via homebrew, apt, ...). Perfectly suitable as MOTD.
| Command | Description |
| ----------- | ------------------------------- |
| `chuck` | Print random Chuck Norris quote |
| `chuck_cow` | Print quote in cowthink |
This source diff could not be displayed because it is too large. You can view the blob instead.
# Cloudfoundry Plugin
This plugin is intended to offer a few simple aliases for regular users of the [Cloud Foundry Cli][1]. Most are just simple aliases that will save a bit of typing. Others include mini functions and or accept parameters. Take a look at the table below for details.
| Alias | Command | Description |
|----------|-----------------------------|--------------------------------------------------------------------------|
| cfl | `cf login` | Login to Cloud Foundry |
| cft | `cf target` | Target the cli at a specific Org/Space in Cloud Foundry |
| cfa | `cf apps` | List all applications in the current Org/Space |
| cfs | `cf services` | List all services in the current Org/Space |
| cfm | `cf marketplace` | List the services available in the Marketplace |
| cfp | `cf push` | Push your application code to Cloud Foundry |
| cfcs | `cf create-service` | Create a service based on a Marketplace offering |
| cfbs | `cf bind-service` | Bind an application to a service you created |
| cfus | `cf unbind-service` | Unbind a service from an application |
| cfds | `cf delete-service` | Delete a service you no longer have bound |
| cfup | `cf cups` | Create a "user-provided-service" |
| cflg | `cf logs` | Tail the logs of an application (requires <APP_NAME>) |
| cfr | `cf routes` | List all the routes in the current Space |
| cfe | `cf env` | Show the environment variables for an application (requires <APP_NAME>) |
| cfsh | `cf ssh` | Attach to a running container (requires an <APP_NAME> etc.) |
| cfsc | `cf scale` | Scale an application (requires an <APP_NAME> etc.) |
| cfev | `cf events` | Show the application events (requires <APP_NAME>) |
| cfdor | `cf delete-orphaned-routes` | Delete routes that are no longer bound to applications |
| cfbpk | `cf buildpacks` | List the available buildpacks |
| cfdm | `cf domains` | List the domains associates with this Cloud Foundry foundation |
| cfsp | `cf spaces` | List all the Spaces in the current Org |
| cfap | `cf app` | Show the details of a deployed application (requires <APP_NAME>) |
| cfh. | `export CF_HOME=$PWD/.cf` | Set the current directory as CF_HOME |
| cfh~ | `export CF_HOME=~/.cf` | Set the user's root directory as CF_HOME |
| cfhu | `unset CF_HOME` | Unsets CF_HOME |
| cfpm | `cf push -f` | Push an application using a manifest (requires <MANIFEST_FILE> location) |
| cflr | `cf logs --recent` | Show the recent logs (requires <APP_NAME>) |
| cfsrt | `cf start` | Start an application (requires <APP_NAME>) |
| cfstp | `cf stop` | Stop an application (requires <APP_NAME>) |
| cfstg | `cf restage` | Restage an application (requires <APP_NAME>) |
| cfdel | `cf delete` | Delete an application (requires <APP_NAME>) |
| cfsrtall | - | Start all apps that are currently in the "Stopped" state |
| cfstpall | - | Stop all apps that are currently in the "Started" state |
For help and advice on what any of the commands does, consult the built in `cf` help functions as follows:-
```bash
cf help # List the most popular and commonly used commands
cf help -a # Complete list of all possible commands
cf <COMMAND_NAME> --help # Help on a specific command including arguments and examples
```
Alternatively, seek out the [online documentation][3]. And don't forget, there are loads of great [community plugins for the cf-cli][4] command line tool that can greatly extend its power and usefulness.
## Contributors
Contributed to `oh_my_zsh` by [benwilcock][2].
[1]: https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
[2]: https://github.com/benwilcock
[3]: https://docs.cloudfoundry.org/cf-cli/getting-started.html
[4]: https://plugins.cloudfoundry.org/
# Some Useful CloudFoundry Aliases & Functions
alias cfl="cf login"
alias cft="cf target"
alias cfa="cf apps"
alias cfs="cf services"
alias cfm="cf marketplace"
alias cfp="cf push"
alias cfcs="cf create-service"
alias cfbs="cf bind-service"
alias cfus="cf unbind-service"
alias cfds="cf delete-service"
alias cfup="cf cups"
alias cflg="cf logs"
alias cfr="cf routes"
alias cfe="cf env"
alias cfsh="cf ssh"
alias cfsc="cf scale"
alias cfev="cf events"
alias cfdor="cf delete-orphaned-routes"
alias cfbpk="cf buildpacks"
alias cfdm="cf domains"
alias cfsp="cf spaces"
function cfap() { cf app $1 }
function cfh.() { export CF_HOME=$PWD/.cf }
function cfh~() { export CF_HOME=~/.cf }
function cfhu() { unset CF_HOME }
function cfpm() { cf push -f $1 }
function cflr() { cf logs $1 --recent }
function cfsrt() { cf start $1 }
function cfstp() { cf stop $1 }
function cfstg() { cf restage $1 }
function cfdel() { cf delete $1 }
function cfsrtall() {cf apps | awk '/stopped/ { system("cf start " $1)}'}
function cfstpall() {cf apps | awk '/started/ { system("cf stop " $1)}'}
#compdef coffee #compdef coffee
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users # Copyright (c) 2011 Github zsh-users - https://github.com/zsh-users
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
# Description # Description
# ----------- # -----------
# #
# Completion script for Coffee.js v0.6.11 (http://coffeejs.org) # Completion script for Coffee.js v0.6.11 (https://coffeescript.org)
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Authors # Authors
......
# colorize
With this plugin you can syntax-highlight file contents of over 300 supported languages and other text formats.
To use it, add colorize to the plugins array of your zshrc file:
```
plugins=(... colorize)
```
## Usage
* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided). If no arguments are passed it will colorize the standard input or stdin.
Colorize will highlight the content based on the filename extension. If it can't find a syntax-highlighting method for a given extension, it will try to find one by looking at the file contents. If no highlight method is found it will just cat the file normally, without syntax highlighting.
## Requirements
You have to install Pygments first: [pygments.org](http://pygments.org/download/)
# Plugin for highlighting file content # easier alias to use the plugin
# Plugin highlights file content based on the filename extension. alias ccat='colorize_via_pygmentize'
# If no highlighting method supported for given extension then it tries
# guess it by looking for file content.
alias colorize='colorize_via_pygmentize'
colorize_via_pygmentize() { colorize_via_pygmentize() {
if [ ! -x "$(which pygmentize)" ]; then if ! (( $+commands[pygmentize] )); then
echo "package \'pygmentize\' is not installed!" echo "package 'Pygments' is not installed!"
return -1 return 1
fi fi
# pygmentize stdin if no arguments passed
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
pygmentize -g $@ pygmentize -g
return $?
fi fi
# guess lexer from file extension, or
# guess it from file contents if unsuccessful
local FNAME lexer
for FNAME in $@ for FNAME in $@
do do
filename=$(basename "$FNAME") lexer=$(pygmentize -N "$FNAME")
lexer=`pygmentize -N \"$filename\"` if [[ $lexer != text ]]; then
if [ "Z$lexer" != "Ztext" ]; then pygmentize -l "$lexer" "$FNAME"
pygmentize -l $lexer "$FNAME"
else else
pygmentize -g "$FNAME" pygmentize -g "$FNAME"
fi fi
......
# command-not-found plugin
This plugin uses the command-not-found package for zsh to provide suggested packages to be installed if a command cannot be found.
To use it, add `command-not-found` to the plugins array of your zshrc file:
```zsh
plugins=(... command-not-found)
```
An example of how this plugin works in Ubuntu:
```
$ mutt
The program 'mutt' can be found in the following packages:
* mutt
* mutt-kz
* mutt-patched
Try: sudo apt install <selected package>
```
### Supported platforms
It works out of the box with the command-not-found packages for:
- [Ubuntu](https://www.porcheron.info/command-not-found-for-zsh/)
- [Debian](https://packages.debian.org/search?keywords=command-not-found)
- [Arch Linux](https://wiki.archlinux.org/index.php/Pkgfile#Command_not_found)
- [macOS (Homebrew)](https://github.com/Homebrew/homebrew-command-not-found)
- [Fedora](https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound)
You can add support for other platforms by submitting a Pull Request.
# Uses the command-not-found package zsh support # Uses the command-not-found package zsh support
# as seen in http://www.porcheron.info/command-not-found-for-zsh/ # as seen in https://www.porcheron.info/command-not-found-for-zsh/
# this is installed in Ubuntu # this is installed in Ubuntu
[[ -e /etc/zsh_command_not_found ]] && source /etc/zsh_command_not_found [[ -e /etc/zsh_command_not_found ]] && source /etc/zsh_command_not_found
......
...@@ -13,7 +13,7 @@ alias lS='ls -1FSsh' ...@@ -13,7 +13,7 @@ alias lS='ls -1FSsh'
alias lart='ls -1Fcart' alias lart='ls -1Fcart'
alias lrt='ls -1Fcrt' alias lrt='ls -1Fcrt'
alias zshrc='$EDITOR ~/.zshrc' # Quick access to the ~/.zshrc file alias zshrc='${=EDITOR} ~/.zshrc' # Quick access to the ~/.zshrc file
alias grep='grep --color' alias grep='grep --color'
alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} ' alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
...@@ -44,8 +44,6 @@ alias p='ps -f' ...@@ -44,8 +44,6 @@ alias p='ps -f'
alias sortnr='sort -n -r' alias sortnr='sort -n -r'
alias unexport='unset' alias unexport='unset'
alias whereami=display_info
alias rm='rm -i' alias rm='rm -i'
alias cp='cp -i' alias cp='cp -i'
alias mv='mv -i' alias mv='mv -i'
......
# composer
This plugin provides completion for [composer](https://getcomposer.org/), as well as aliases
for frequent composer commands. It also adds Composer's global binaries to the PATH, using
Composer if available.
To use it add `composer` to the plugins array in your zshrc file.
```zsh
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 |
| `cget` | `curl -s https://getcomposer.org/installer` | Installs composer in the current directory |
...@@ -51,5 +51,10 @@ alias cgrm='composer global remove' ...@@ -51,5 +51,10 @@ alias cgrm='composer global remove'
# install composer in the current directory # install composer in the current directory
alias cget='curl -s https://getcomposer.org/installer | php' alias cget='curl -s https://getcomposer.org/installer | php'
# Add Composer's global binaries to PATH # Add Composer's global binaries to PATH, using Composer if available.
export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null) if (( $+commands[composer] )); then
export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null)
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
fi
# copydir plugin
Copies the path of your current folder to the system clipboard.
To use, add `copydir` to your plugins array:
```
plugins=(... copydir)
```
Then use the command `copydir` to copy the $PWD.
# copyfile plugin
Puts the contents of a file in your system clipboard so you can paste it anywhere.
To use, add `copyfile` to your plugins array:
```
plugins=(... copyfile)
```
Then you can run the command `copyfile <filename>` to copy the file named `filename`.
# Cpanm
This plugin provides completion for [Cpanm](https://github.com/miyagawa/cpanminus) ([docs](https://metacpan.org/pod/App::cpanminus)).
To use it add cpanm to the plugins array in your zshrc file.
```bash
plugins=(... cpanm)
```
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
# #
# Current supported cpanm version: 1.4000 (Tue Mar 8 01:00:49 PST 2011) # Current supported cpanm version: 1.4000 (Tue Mar 8 01:00:49 PST 2011)
# #
# The latest code is always located at:
# https://github.com/rshhh/cpanminus/blob/master/etc/_cpanm
#
local arguments curcontext="$curcontext" local arguments curcontext="$curcontext"
typeset -A opt_args typeset -A opt_args
......
# Usage: dash [keyword:]query
dash() { open dash://"$*" }
compdef _dash dash
_dash() {
# No sense doing this for anything except the 2nd position and if we haven't
# specified which docset to query against
if [[ $CURRENT -eq 2 && ! "$words[2]" =~ ":" ]]; then
local -a _all_docsets
_all_docsets=()
# Use defaults to get the array of docsets from preferences
# Have to smash it into one big line so that each docset is an element of
# our DOCSETS array
DOCSETS=("${(@f)$(defaults read com.kapeli.dashdoc docsets | tr -d '\n' | grep -oE '\{.*?\}')}")
# remove all newlines since defaults prints so pretty like
# Now get each docset and output each on their own line
for doc in "$DOCSETS[@]"; do
# Only output docsets that are actually enabled
if [[ "`echo $doc | grep -Eo \"isEnabled = .*?;\" | sed 's/[^01]//g'`" == "0" ]]; then
continue
fi
keyword=''
# Order of preference as explained to me by @kapeli via email
KEYWORD_LOCATORS=(keyword suggestedKeyword platform)
for locator in "$KEYWORD_LOCATORS[@]"; do
# Echo the docset, try to find the appropriate keyword
# Strip doublequotes and colon from any keyword so that everything has the
# same format when output (we'll add the colon in the completion)
keyword=`echo $doc | grep -Eo "$locator = .*?;" | sed -e "s/$locator = \(.*\);/\1/" -e "s/[\":]//g"`
if [[ ! -z "$keyword" ]]; then
# if we fall back to platform, we should do some checking per @kapeli
if [[ "$locator" == "platform" ]]; then
# Since these are the only special cases right now, let's not do the
# expensive processing unless we have to
if [[ "$keyword" == "python" || "$keyword" == "java" || \
"$keyword" == "qt" || "$keyword" == "cocs2d" ]]; then
docsetName=`echo $doc | grep -Eo "docsetName = .*?;" | sed -e "s/docsetName = \(.*\);/\1/" -e "s/[\":]//g"`
if [[ "$keyword" == "python" ]]; then
if [[ "$docsetName" == "Python 2" ]]; then
keyword="python2"
elif [[ "$docsetName" == "Python 3" ]]; then
keyword="python3"
fi
elif [[ "$keyword" == "java" ]]; then
if [[ "$docsetName" == "Java SE7" ]]; then
keyword="java7"
elif [[ "$docsetName" == "Java SE6" ]]; then
keyword="java6"
elif [[ "$docsetName" == "Java SE8" ]]; then
keyword="java8"
fi
elif [[ "$keyword" == "qt" ]]; then
if [[ "$docsetName" == "Qt 5" ]]; then
keyword="qt5"
elif [[ "$docsetName" == "Qt 4" ]]; then
keyword="qt4"
elif [[ "$docsetName" == "Qt" ]]; then
keyword="qt4"
fi
elif [[ "$keyword" == "cocos2d" ]]; then
if [[ "$docsetName" == "Cocos3D" ]]; then
keyword="cocos3d"
fi
fi
fi
fi
# Bail once we have a match
break
fi
done
# If we have a keyword, add it to the list!
if [[ ! -z "$keyword" ]]; then
_all_docsets+=($keyword)
fi
done
# special thanks to [arx] on #zsh for getting me sorted on this piece
compadd -qS: -- "$_all_docsets[@]"
return
fi
}
...@@ -5,9 +5,12 @@ ...@@ -5,9 +5,12 @@
# #
# Debian-related zsh aliases and functions for zsh # Debian-related zsh aliases and functions for zsh
# Use aptitude if installed, or apt-get if not. # Use apt or aptitude if installed, fallback is apt-get
# You can just set apt_pref='apt-get' to override it. # You can just set apt_pref='apt-get' to override it.
if [[ -e $( which -p aptitude 2>&1 ) ]]; then if [[ -e $( which -p apt 2>&1 ) ]]; then
apt_pref='apt'
apt_upgr='upgrade'
elif [[ -e $( which -p aptitude 2>&1 ) ]]; then
apt_pref='aptitude' apt_pref='aptitude'
apt_upgr='safe-upgrade' apt_upgr='safe-upgrade'
else else
...@@ -176,7 +179,7 @@ apt-copy() { ...@@ -176,7 +179,7 @@ apt-copy() {
# apt-history remove # apt-history remove
# apt-history rollback # apt-history rollback
# apt-history list # apt-history list
# Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html # Based On: https://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html
apt-history () { apt-history () {
case "$1" in case "$1" in
install) install)
......
# dircycle
Plugin for cycling through the directory stack
This plugin enables directory navigation similar to using back and forward on browsers or common file explorers like Finder or Nautilus. It uses a small zle trick that lets you cycle through your directory stack left or right using <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> / <kbd>Right</kbd> . This is useful when moving back and forth between directories in development environments, and can be thought of as kind of a nondestructive pushd/popd.
## Enabling the plugin
1. Open your `.zshrc` file and add `dircycle` in the plugins section:
```zsh
plugins=(
# all your enabled plugins
dircycle
)
```
2. Reload the source file or restart your Terminal session:
```console
$ source ~/.zshrc
$
```
## Usage Examples
Say you opened these directories on the terminal:
```console
~$ cd Projects
~/Projects$ cd Hacktoberfest
~/Projects/Hacktoberfest$ cd oh-my-zsh
~/Projects/Hacktoberfest/oh-my-zsh$ dirs -v
0 ~/Projects/Hacktoberfest/oh-my-zsh
1 ~/Projects/Hacktoberfest
2 ~/Projects
3 ~
```
By pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd>, the current working directory or `$CWD` will be from `oh-my-zsh` to `Hacktoberfest`. Press it again and it will be at `Projects`.
And by pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd>, the `$CWD` will be from `Projects` to `Hacktoberfest`. Press it again and it will be at `oh-my-zsh`.
Here's a example history table with the same accessed directories like above:
| Current `$CWD` | Key press | New `$CWD` |
| --------------- | ----------------------------------------------------- | --------------- |
| `oh-my-zsh` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> | `Hacktoberfest` |
| `Hacktoberfest` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> | `Projects` |
| `Projects` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> | `~` |
| `~` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `Projects` |
| `Projects` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `Hacktoberfest` |
| `Hacktoberfest` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `oh-my-zsh` |
| `oh-my-zsh` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `~` |
Note the last traversal, when pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> on a last known `$CWD`, it will change back to the first known `$CWD`, which in the example is `~`.
Here's an asciinema cast demonstrating the example above:
[![asciicast](https://asciinema.org/a/204406.png)](https://asciinema.org/a/204406)
## Functions
| Function | Description |
| -------------------- | --------------------------------------------------------------------------------------------------------- |
| `insert-cycledleft` | Change `$CWD` to the previous known stack, binded on <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> |
| `insert-cycledright` | Change `$CWD` to the next known stack, binded on <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> |
## Rebinding keys
You can bind these functions to other key sequences, as long as you know the bindkey sequence. For example, these commands bind to <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> / <kbd>Right</kbd> in `xterm-256color`:
```zsh
bindkey '^[[1;4D' insert-cycledleft
bindkey '^[[1;4C' insert-cycledright
```
You can get the bindkey sequence by pressing <kbd>Ctrl</kbd> + <kbd>V</kbd>, then pressing the keyboard shortcut you want to use.
...@@ -9,31 +9,36 @@ ...@@ -9,31 +9,36 @@
# pushd -N: start counting from right of `dirs' output # pushd -N: start counting from right of `dirs' output
switch-to-dir () { switch-to-dir () {
[[ ${#dirstack} -eq 0 ]] && return setopt localoptions nopushdminus
[[ ${#dirstack} -eq 0 ]] && return 1
while ! builtin pushd -q $1 &>/dev/null; do while ! builtin pushd -q $1 &>/dev/null; do
# We found a missing directory: pop it out of the dir stack # We found a missing directory: pop it out of the dir stack
builtin popd -q $1 builtin popd -q $1
# Stop trying if there are no more directories in the dir stack # Stop trying if there are no more directories in the dir stack
[[ ${#dirstack} -eq 0 ]] && break [[ ${#dirstack} -eq 0 ]] && return 1
done done
} }
insert-cycledleft () { insert-cycledleft () {
emulate -L zsh switch-to-dir +1 || return
setopt nopushdminus
switch-to-dir +1 local fn
for fn (chpwd $chpwd_functions precmd $precmd_functions); do
(( $+functions[$fn] )) && $fn
done
zle reset-prompt zle reset-prompt
} }
zle -N insert-cycledleft zle -N insert-cycledleft
insert-cycledright () { insert-cycledright () {
emulate -L zsh switch-to-dir -0 || return
setopt nopushdminus
switch-to-dir -0 local fn
for fn (chpwd $chpwd_functions precmd $precmd_functions); do
(( $+functions[$fn] )) && $fn
done
zle reset-prompt zle reset-prompt
} }
zle -N insert-cycledright zle -N insert-cycledright
......
# Dirhistory plugin
This plugin adds keyboard shortcuts for navigating directory history and hierarchy.
To use it, add `dirhistory` to the plugins array in your zshrc file:
```zsh
plugins=(... dirhistory)
```
## Keyboard Shortcuts
| Shortcut | Description |
|-----------------------------------|-----------------------------------------------------------|
| <kbd>alt</kbd> + <kbd>left</kbd> | Go to previous directory |
| <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 |
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
# Navigate directory history using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories # Navigate directory history 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. # that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT.
# #
# Navigate directory hierarchy using ALT-UP and ALT-DOWN. (mac keybindings not yet implemented)
# ALT-UP moves to higher hierarchy (cd ..)
# ALT-DOWN moves into the first directory found in alphabetical order
#
dirhistory_past=($PWD) dirhistory_past=($PWD)
dirhistory_future=() dirhistory_future=()
...@@ -119,6 +123,10 @@ zle -N dirhistory_zle_dirhistory_back ...@@ -119,6 +123,10 @@ zle -N dirhistory_zle_dirhistory_back
# xterm in normal mode # xterm in normal mode
bindkey "\e[3D" dirhistory_zle_dirhistory_back bindkey "\e[3D" dirhistory_zle_dirhistory_back
bindkey "\e[1;3D" dirhistory_zle_dirhistory_back bindkey "\e[1;3D" dirhistory_zle_dirhistory_back
# Mac teminal (alt+left/right)
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
bindkey "^[b" dirhistory_zle_dirhistory_back
fi
# Putty: # Putty:
bindkey "\e\e[D" dirhistory_zle_dirhistory_back bindkey "\e\e[D" dirhistory_zle_dirhistory_back
# GNU screen: # GNU screen:
...@@ -127,7 +135,56 @@ bindkey "\eO3D" dirhistory_zle_dirhistory_back ...@@ -127,7 +135,56 @@ bindkey "\eO3D" dirhistory_zle_dirhistory_back
zle -N dirhistory_zle_dirhistory_future zle -N dirhistory_zle_dirhistory_future
bindkey "\e[3C" dirhistory_zle_dirhistory_future bindkey "\e[3C" dirhistory_zle_dirhistory_future
bindkey "\e[1;3C" dirhistory_zle_dirhistory_future bindkey "\e[1;3C" dirhistory_zle_dirhistory_future
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
bindkey "^[f" dirhistory_zle_dirhistory_future
fi
bindkey "\e\e[C" dirhistory_zle_dirhistory_future bindkey "\e\e[C" dirhistory_zle_dirhistory_future
bindkey "\eO3C" dirhistory_zle_dirhistory_future bindkey "\eO3C" dirhistory_zle_dirhistory_future
#
# HIERARCHY Implemented in this section, in case someone wants to split it to another plugin if it clashes bindings
#
# Move up in hierarchy
function dirhistory_up() {
cd .. || return 1
}
# Move down in hierarchy
function dirhistory_down() {
cd "$(find . -mindepth 1 -maxdepth 1 -type d | sort -n | head -n 1)" || return 1
}
# Bind keys to hierarchy navigation
function dirhistory_zle_dirhistory_up() {
zle kill-buffer # Erase current line in buffer
dirhistory_up
zle accept-line
}
function dirhistory_zle_dirhistory_down() {
zle kill-buffer # Erase current line in buffer
dirhistory_down
zle accept-line
}
zle -N dirhistory_zle_dirhistory_up
# xterm in normal mode
bindkey "\e[3A" dirhistory_zle_dirhistory_up
bindkey "\e[1;3A" dirhistory_zle_dirhistory_up
# Mac teminal (alt+up)
#bindkey "^[?" dirhistory_zle_dirhistory_up #dont know it
# Putty:
bindkey "\e\e[A" dirhistory_zle_dirhistory_up
# GNU screen:
bindkey "\eO3A" dirhistory_zle_dirhistory_up
zle -N dirhistory_zle_dirhistory_down
bindkey "\e[3B" dirhistory_zle_dirhistory_down
bindkey "\e[1;3B" dirhistory_zle_dirhistory_down
# Mac teminal (alt+down)
#bindkey "^[?" dirhistory_zle_dirhistory_down #dont know it
bindkey "\e\e[B" dirhistory_zle_dirhistory_down
bindkey "\eO3B" dirhistory_zle_dirhistory_down
# 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.
To use it, add `dirpersist` to the plugins array in your zshrc file:
```zsh
plugins=(... dirpersist)
```
# Django plugin
This plugin adds completion and hints for the [Django Project](https://www.djangoproject.com/) `manage.py` commands
and options.
To use it, add `django` to the plugins array in your zshrc file:
```zsh
plugins=(... django)
```
## Usage
```zsh
$> python manage.py (press <TAB> here)
```
Would result in:
```zsh
cleanup -- remove old data from the database
compilemessages -- compile .po files to .mo for use with gettext
createcachetable -- creates table for SQL cache backend
createsuperuser -- create a superuser
dbshell -- run command-line client for the current database
diffsettings -- display differences between the current settings and Django defaults
dumpdata -- output contents of database as a fixture
flush -- execute 'sqlflush' on the current database
inspectdb -- output Django model module for tables in database
loaddata -- install the named fixture(s) in the database
makemessages -- pull out all strings marked for translation
reset -- executes 'sqlreset' for the given app(s)
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
...
```
...@@ -349,6 +349,7 @@ _managepy-commands() { ...@@ -349,6 +349,7 @@ _managepy-commands() {
'runfcgi:Run this project as a fastcgi (or some other protocol supported by flup) application,' 'runfcgi:Run this project as a fastcgi (or some other protocol supported by flup) application,'
'runserver:Starts a lightweight Web server for development.' 'runserver:Starts a lightweight Web server for development.'
'shell:Runs a Python interactive interpreter.' 'shell:Runs a Python interactive interpreter.'
'showmigrations:Shows all available migrations for the current project.'
'sql:Prints the CREATE TABLE SQL statements for the given app name(s).' 'sql:Prints the CREATE TABLE SQL statements for the given app name(s).'
'sqlall:Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).' 'sqlall:Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).'
'sqlclear:Prints the DROP TABLE SQL statements for the given app name(s).' 'sqlclear:Prints the DROP TABLE SQL statements for the given app name(s).'
......
File mode changed from 100755 to 100644
# Docker-compose plugin for oh my zsh # Docker-compose
A copy of the completion script from the [docker-compose](https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose) git repo. This plugin provides completion for [docker-compose](https://docs.docker.com/compose/) as well as some
aliases for frequent docker-compose commands.
To use it, add docker-compose to the plugins array of your zshrc file:
```
plugins=(... docker-compose)
```
## Aliases
| Alias | Command | Description |
|-----------|--------------------------|------------------------------------------------------------------|
| dco | `docker-compose` | Docker-compose main command |
| dcb | `docker-compose build` | Build containers |
| dce | `docker-compose exec` | Execute command inside a container |
| dcps | `docker-compose ps` | List containers |
| dcrestart | `docker-compose restart` | Restart container |
| dcrm | `docker-compose rm` | Remove container |
| dcr | `docker-compose run` | Run a command in container |
| dcstop | `docker-compose stop` | Stop a container |
| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service |
| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon |
| dcdn | `docker-compose down` | Stop and remove containers |
| dcl | `docker-compose logs` | Show logs of container |
| dclf | `docker-compose logs -f` | Show logs and follow output |
| dcpull | `docker-compose pull` | Pull image of a service |
| dcstart | `docker-compose start` | Start a container |
...@@ -3,11 +3,6 @@ ...@@ -3,11 +3,6 @@
# Description # Description
# ----------- # -----------
# zsh completion for docker-compose # zsh completion for docker-compose
# https://github.com/sdurrheimer/docker-compose-zsh-completion
# -------------------------------------------------------------------------
# Version
# -------
# 1.5.0
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# Authors # Authors
# ------- # -------
...@@ -199,7 +194,9 @@ __docker-compose_subcommand() { ...@@ -199,7 +194,9 @@ __docker-compose_subcommand() {
(build) (build)
_arguments \ _arguments \
$opts_help \ $opts_help \
"*--build-arg=[Set build-time variables for one service.]:<varname>=<value>: " \
'--force-rm[Always remove intermediate containers.]' \ '--force-rm[Always remove intermediate containers.]' \
'--memory[Memory limit for the build container.]' \
'--no-cache[Do not use cache when building the image.]' \ '--no-cache[Do not use cache when building the image.]' \
'--pull[Always attempt to pull a newer version of the image.]' \ '--pull[Always attempt to pull a newer version of the image.]' \
'*:services:__docker-compose_services_from_build' && ret=0 '*:services:__docker-compose_services_from_build' && ret=0
...@@ -207,13 +204,16 @@ __docker-compose_subcommand() { ...@@ -207,13 +204,16 @@ __docker-compose_subcommand() {
(bundle) (bundle)
_arguments \ _arguments \
$opts_help \ $opts_help \
'--push-images[Automatically push images for any services which have a `build` option specified.]' \
'(--output -o)'{--output,-o}'[Path to write the bundle file to. Defaults to "<project name>.dab".]:file:_files' && ret=0 '(--output -o)'{--output,-o}'[Path to write the bundle file to. Defaults to "<project name>.dab".]:file:_files' && ret=0
;; ;;
(config) (config)
_arguments \ _arguments \
$opts_help \ $opts_help \
'(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \ '(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \
'--services[Print the service names, one per line.]' && ret=0 '--resolve-image-digests[Pin image tags to digests.]' \
'--services[Print the service names, one per line.]' \
'--volumes[Print the volume names, one per line.]' && ret=0
;; ;;
(create) (create)
_arguments \ _arguments \
...@@ -242,7 +242,7 @@ __docker-compose_subcommand() { ...@@ -242,7 +242,7 @@ __docker-compose_subcommand() {
$opts_help \ $opts_help \
'-d[Detached mode: Run command in the background.]' \ '-d[Detached mode: Run command in the background.]' \
'--privileged[Give extended privileges to the process.]' \ '--privileged[Give extended privileges to the process.]' \
'--user=[Run the command as this user.]:username:_users' \ '(-u --user)'{-u,--user=}'[Run the command as this user.]:username:_users' \
'-T[Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY.]' \ '-T[Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY.]' \
'--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \ '--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \
'(-):running services:__docker-compose_runningservices' \ '(-):running services:__docker-compose_runningservices' \
...@@ -252,6 +252,12 @@ __docker-compose_subcommand() { ...@@ -252,6 +252,12 @@ __docker-compose_subcommand() {
(help) (help)
_arguments ':subcommand:__docker-compose_commands' && ret=0 _arguments ':subcommand:__docker-compose_commands' && ret=0
;; ;;
(images)
_arguments \
$opts_help \
'-q[Only display IDs]' \
'*:services:__docker-compose_services_all' && ret=0
;;
(kill) (kill)
_arguments \ _arguments \
$opts_help \ $opts_help \
...@@ -308,16 +314,17 @@ __docker-compose_subcommand() { ...@@ -308,16 +314,17 @@ __docker-compose_subcommand() {
(run) (run)
_arguments \ _arguments \
$opts_help \ $opts_help \
$opts_no_deps \
'-d[Detached mode: Run container in the background, print new container name.]' \ '-d[Detached mode: Run container in the background, print new container name.]' \
'*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \ '*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \
'--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \ '--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \
'--name=[Assign a name to the container]:name: ' \ '--name=[Assign a name to the container]:name: ' \
$opts_no_deps \
'(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \ '(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \
'--rm[Remove container after run. Ignored in detached mode.]' \ '--rm[Remove container after run. Ignored in detached mode.]' \
"--service-ports[Run command with the service's ports enabled and mapped to the host.]" \ "--service-ports[Run command with the service's ports enabled and mapped to the host.]" \
'-T[Disable pseudo-tty allocation. By default `docker-compose run` allocates a TTY.]' \ '-T[Disable pseudo-tty allocation. By default `docker-compose run` allocates a TTY.]' \
'(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \ '(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \
'(-v --volume)*'{-v,--volume=}'[Bind mount a volume]:volume: ' \
'(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \ '(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \
'(-):services:__docker-compose_services' \ '(-):services:__docker-compose_services' \
'(-):command: _command_names -e' \ '(-):command: _command_names -e' \
...@@ -340,6 +347,11 @@ __docker-compose_subcommand() { ...@@ -340,6 +347,11 @@ __docker-compose_subcommand() {
$opts_timeout \ $opts_timeout \
'*:running services:__docker-compose_runningservices' && ret=0 '*:running services:__docker-compose_runningservices' && ret=0
;; ;;
(top)
_arguments \
$opts_help \
'*:running services:__docker-compose_runningservices' && ret=0
;;
(unpause) (unpause)
_arguments \ _arguments \
$opts_help \ $opts_help \
...@@ -385,9 +397,17 @@ _docker-compose() { ...@@ -385,9 +397,17 @@ _docker-compose() {
integer ret=1 integer ret=1
typeset -A opt_args typeset -A opt_args
local file_description
if [[ -n ${words[(r)-f]} || -n ${words[(r)--file]} ]] ; then
file_description="Specify an override docker-compose file (default: docker-compose.override.yml)"
else
file_description="Specify an alternate docker-compose file (default: docker-compose.yml)"
fi
_arguments -C \ _arguments -C \
'(- :)'{-h,--help}'[Get help]' \ '(- :)'{-h,--help}'[Get help]' \
'(-f --file)'{-f,--file}'[Specify an alternate docker-compose file (default: docker-compose.yml)]:file:_files -g "*.yml"' \ '*'{-f,--file}"[${file_description}]:file:_files -g '*.yml'" \
'(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \ '(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \
'--verbose[Show more output]' \ '--verbose[Show more output]' \
'(- :)'{-v,--version}'[Print version and exit]' \ '(- :)'{-v,--version}'[Print version and exit]' \
......
...@@ -18,6 +18,9 @@ alias dcrm='docker-compose rm' ...@@ -18,6 +18,9 @@ alias dcrm='docker-compose rm'
alias dcr='docker-compose run' alias dcr='docker-compose run'
alias dcstop='docker-compose stop' alias dcstop='docker-compose stop'
alias dcup='docker-compose up' alias dcup='docker-compose up'
alias dcupd='docker-compose up -d'
alias dcdn='docker-compose down' alias dcdn='docker-compose down'
alias dcl='docker-compose logs' alias dcl='docker-compose logs'
alias dclf='docker-compose logs -f' alias dclf='docker-compose logs -f'
alias dcpull='docker-compose pull'
alias dcstart='docker-compose start'
#compdef docker-machine
# Description
# -----------
# zsh completion for docker-machine
# https://github.com/leonhartX/docker-machine-zsh-completion
# -------------------------------------------------------------------------
# Version
# -------
# 0.1.1
# -------------------------------------------------------------------------
# Authors
# -------
# * Ke Xu <leonhartx.k@gmail.com>
# -------------------------------------------------------------------------
# Inspiration
# -----------
# * @sdurrheimer docker-compose-zsh-completion https://github.com/sdurrheimer/docker-compose-zsh-completion
# * @ilkka _docker-machine
__docker-machine_get_hosts() {
[[ $PREFIX = -* ]] && return 1
local state
declare -a hosts
state=$1; shift
if [[ $state != all ]]; then
hosts=(${(f)"$(_call_program commands docker-machine ls -q --filter state=$state)"})
else
hosts=(${(f)"$(_call_program commands docker-machine ls -q)"})
fi
_describe 'host' hosts "$@" && ret=0
return ret
}
__docker-machine_hosts_with_state() {
declare -a hosts
hosts=(${(f)"$(_call_program commands docker-machine ls -f '{{.Name}}\:{{.DriverName}}\({{.State}}\)\ {{.URL}}')"})
_describe 'host' hosts
}
__docker-machine_hosts_all() {
__docker-machine_get_hosts all "$@"
}
__docker-machine_hosts_running() {
__docker-machine_get_hosts Running "$@"
}
__docker-machine_get_swarm() {
declare -a swarms
swarms=(${(f)"$(_call_program commands docker-machine ls -f {{.Swarm}} | awk '{print $1}')"})
_describe 'swarm' swarms
}
__docker-machine_hosts_and_files() {
_alternative "hosts:host:__docker-machine_hosts_all -qS ':'" 'files:files:_path_files'
}
__docker-machine_filters() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
if compset -P '*='; then
case "${${words[-1]%=*}#*=}" in
(driver)
_describe -t driver-filter-opts "driver filter" opts_driver && ret=0
;;
(swarm)
__docker-machine_get_swarm && ret=0
;;
(state)
opts_state=('Running' 'Paused' 'Saved' 'Stopped' 'Stopping' 'Starting' 'Error')
_describe -t state-filter-opts "state filter" opts_state && ret=0
;;
(name)
__docker-machine_hosts_all && ret=0
;;
(label)
_message 'label' && ret=0
;;
*)
_message 'value' && ret=0
;;
esac
else
opts=('driver' 'swarm' 'state' 'name' 'label')
_describe -t filter-opts "filter" opts -qS "=" && ret=0
fi
return ret
}
__get_swarm_discovery() {
declare -a masters serivces
local service
services=()
masters=($(docker-machine ls -f {{.Swarm}} |grep '(master)' |awk '{print $1}'))
for master in $masters; do
service=${${${(f)"$(_call_program commands docker-machine inspect -f '{{.HostOptions.SwarmOptions.Discovery}}:{{.Name}}' $master)"}/:/\\:}}
services=($services $service)
done
_describe -t services "swarm service" services && ret=0
return ret
}
__get_create_argument() {
typeset -g docker_machine_driver
if [[ CURRENT -le 2 ]]; then
docker_machine_driver="none"
elif [[ CURRENT > 2 && $words[CURRENT-2] = '-d' || $words[CURRENT-2] = '--driver' ]]; then
docker_machine_driver=$words[CURRENT-1]
elif [[ $words[CURRENT-1] =~ '^(-d|--driver)=' ]]; then
docker_machine_driver=${${words[CURRENT-1]}/*=/}
fi
local driver_opt_cmd
local -a opts_provider opts_common opts_read_argument
opts_read_argument=(
": :->argument"
)
opts_common=(
$opts_help \
'(--driver -d)'{--driver=,-d=}'[Driver to create machine with]:dirver:->driver-option' \
'--engine-install-url=[Custom URL to use for engine installation]:url' \
'*--engine-opt=[Specify arbitrary flags to include with the created engine in the form flag=value]:flag' \
'*--engine-insecure-registry=[Specify insecure registries to allow with the created engine]:registry' \
'*--engine-registry-mirror=[Specify registry mirrors to use]:mirror' \
'*--engine-label=[Specify labels for the created engine]:label' \
'--engine-storage-driver=[Specify a storage driver to use with the engine]:storage-driver:->storage-driver-option' \
'*--engine-env=[Specify environment variables to set in the engine]:environment' \
'--swarm[Configure Machine with Swarm]' \
'--swarm-image=[Specify Docker image to use for Swarm]:image' \
'--swarm-master[Configure Machine to be a Swarm master]' \
'--swarm-discovery=[Discovery service to use with Swarm]:service:->swarm-service' \
'--swarm-strategy=[Define a default scheduling strategy for Swarm]:strategy:(spread binpack random)' \
'*--swarm-opt=[Define arbitrary flags for swarm]:flag' \
'*--swarm-join-opt=[Define arbitrary flags for Swarm join]:flag' \
'--swarm-host=[ip/socket to listen on for Swarm master]:host' \
'--swarm-addr=[addr to advertise for Swarm (default: detect and use the machine IP)]:address' \
'--swarm-experimental[Enable Swarm experimental features]' \
'*--tls-san=[Support extra SANs for TLS certs]:option'
)
driver_opt_cmd="docker-machine create -d $docker_machine_driver | grep $docker_machine_driver | sed -e 's/\(--.*\)\ *\[\1[^]]*\]/*\1/g' -e 's/\(\[[^]]*\)/\\\\\\1\\\\/g' -e 's/\".*\"\(.*\)/\1/g' | awk '{printf \"%s[\", \$1; for(i=2;i<=NF;i++) {printf \"%s \", \$i}; print \"]\"}'"
if [[ $docker_machine_driver != "none" ]]; then
opts_provider=(${(f)"$(_call_program commands $driver_opt_cmd)"})
_arguments \
$opts_provider \
$opts_read_argument \
$opts_common && ret=0
else
_arguments $opts_common && ret=0
fi
case $state in
(driver-option)
_describe -t driver-option "driver" opts_driver && ret=0
;;
(storage-driver-option)
_describe -t storage-driver-option "storage driver" opts_storage_driver && ret=0
;;
(swarm-service)
__get_swarm_discovery && ret=0
;;
(argument)
ret=0
;;
esac
return ret
}
__docker-machine_subcommand() {
local -a opts_help
opts_help=("(- :)--help[Print usage]")
local -a opts_only_host opts_driver opts_storage_driver opts_stragery
opts_only_host=(
"$opts_help"
"*:host:__docker-machine_hosts_all"
)
opts_driver=('amazonec2' 'azure' 'digitalocean' 'exoscale' 'generic' 'google' 'hyperv' 'none' 'openstack' 'rackspace' 'softlayer' 'virtualbox' 'vmwarefusion' 'vmwarevcloudair' 'vmwarevsphere')
opts_storage_driver=('overlay' 'aufs' 'btrfs' 'devicemapper' 'vfs' 'zfs')
integer ret=1
case "$words[1]" in
(active)
_arguments \
$opts_help \
'(--timeout -t)'{--timeout=,-t=}'[Timeout in seconds, default to 10s]:seconds' && ret=0
;;
(config)
_arguments \
$opts_help \
'--swarm[Display the Swarm config instead of the Docker daemon]' \
"*:host:__docker-machine_hosts_all" && ret=0
;;
(create)
__get_create_argument
;;
(env)
_arguments \
$opts_help \
'--swarm[Display the Swarm config instead of the Docker daemon]' \
'--shell=[Force environment to be configured for a specified shell: \[fish, cmd, powershell\], default is auto-detect]:shell' \
'(--unset -u)'{--unset,-u}'[Unset variables instead of setting them]' \
'--no-proxy[Add machine IP to NO_PROXY environment variable]' \
'*:host:__docker-machine_hosts_running' && ret=0
;;
(help)
_arguments ':subcommand:__docker-machine_commands' && ret=0
;;
(inspect)
_arguments \
$opts_help \
'(--format -f)'{--format=,-f=}'[Format the output using the given go template]:template' \
'*:host:__docker-machine_hosts_all' && ret=0
;;
(ip)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_running' && ret=0
;;
(kill)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_with_state' && ret=0
;;
(ls)
_arguments \
$opts_help \
'(--quiet -q)'{--quiet,-q}'[Enable quiet mode]' \
'*--filter=[Filter output based on conditions provided]:filter:->filter-options' \
'(--timeout -t)'{--timeout=,-t=}'[Timeout in seconds, default to 10s]:seconds' \
'(--format -f)'{--format=,-f=}'[Pretty-print machines using a Go template]:template' && ret=0
case $state in
(filter-options)
__docker-machine_filters && ret=0
;;
esac
;;
(provision)
_arguments $opts_only_host && ret=0
;;
(regenerate-certs)
_arguments \
$opts_help \
'(--force -f)'{--force,-f}'[Force rebuild and do not prompt]' \
'*:host:__docker-machine_hosts_all' && ret=0
;;
(restart)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_with_state' && ret=0
;;
(rm)
_arguments \
$opts_help \
'(--force -f)'{--force,-f}'[Remove local configuration even if machine cannot be removed, also implies an automatic yes (`-y`)]' \
'-y[Assumes automatic yes to proceed with remove, without prompting further user confirmation]' \
'*:host:__docker-machine_hosts_with_state' && ret=0
;;
(scp)
_arguments \
$opts_help \
'(--recursive -r)'{--recursive,-r}'[Copy files recursively (required to copy directories))]' \
'*:files:__docker-machine_hosts_and_files' && ret=0
;;
(ssh)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_running' && ret=0
;;
(start)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_with_state' && ret=0
;;
(status)
_arguments $opts_only_host && ret=0
;;
(stop)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_with_state' && ret=0
;;
(upgrade)
_arguments $opts_only_host && ret=0
;;
(url)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_running' && ret=0
;;
esac
return ret
}
__docker-machine_commands() {
local cache_policy
zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
if [[ -z "$cache_policy" ]]; then
zstyle ":completion:${curcontext}:" cache-policy __docker-machine_caching_policy
fi
if ( [[ ${+_docker_machine_subcommands} -eq 0 ]] || _cache_invalid docker_machine_subcommands) \
&& ! _retrieve_cache docker_machine_subcommands;
then
local -a lines
lines=(${(f)"$(_call_program commands docker-machine 2>&1)"})
_docker_machine_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/$'\t'##/:})
(( $#_docker_machine_subcommands > 0 )) && _store_cache docker_machine_subcommands _docker_machine_subcommands
fi
_describe -t docker-machine-commands "docker-machine command" _docker_machine_subcommands
}
__docker-machine_caching_policy() {
oldp=( "$1"(Nmh+1) )
(( $#oldp ))
}
_docker-machine() {
if [[ $service != docker-machine ]]; then
_call_function - _$service
return
fi
local curcontext="$curcontext" state line
integer ret=1
typeset -A opt_args
_arguments -C \
"(- :)"{-h,--help}"[Show help]" \
"(-D --debug)"{-D,--debug}"[Enable debug mode]" \
'(-s --stroage-path)'{-s,--storage-path}'[Configures storage path]:file:_files' \
'--tls-ca-cert[CA to verify remotes against]:file:_files' \
'--tls-ca-key[Private key to generate certificates]:file:_files' \
'--tls-client-cert[Client cert to use for TLS]:file:_files' \
'--tls-client-key[Private key used in client TLS auth]:file:_files' \
'--github-api-token[Token to use for requests to the Github API]' \
'--native-ssh[Use the native (Go-based) SSH implementation.]' \
'--bugsnag-api-token[BugSnag API token for crash reporting]' \
'(- :)'{-v,--version}'[Print the version]' \
"(-): :->command" \
"(-)*:: :->option-or-argument" && ret=0
case $state in
(command)
__docker-machine_commands && ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*:*}:docker-machine-$words[1]:
__docker-machine_subcommand && ret=0
ret=0
;;
esac
return ret
}
_docker-machine "$@"
#compdef docker dockerd #compdef docker dockerd
# #
# zsh completion for docker (http://docker.com) # zsh completion for docker (https://docker.com)
# #
# version: 0.3.0 # version: 0.3.0
# github: https://github.com/felixr/docker-zsh-completion # github: https://github.com/felixr/docker-zsh-completion
...@@ -226,7 +226,7 @@ __docker_get_log_options() { ...@@ -226,7 +226,7 @@ __docker_get_log_options() {
common_options=("max-buffer-size" "mode") common_options=("max-buffer-size" "mode")
common_options2=("env" "env-regex" "labels") common_options2=("env" "env-regex" "labels")
awslogs_options=($common_options "awslogs-create-group" "awslogs-datetime-format" "awslogs-group" "awslogs-multiline-pattern" "awslogs-region" "awslogs-stream" "tag") awslogs_options=($common_options "awslogs-create-group" "awslogs-datetime-format" "awslogs-group" "awslogs-multiline-pattern" "awslogs-region" "awslogs-stream" "tag")
fluentd_options=($common_options $common_options2 "fluentd-address" "fluentd-async-connect" "fluentd-buffer-limit" "fluentd-retry-wait" "fluentd-max-retries" "tag") fluentd_options=($common_options $common_options2 "fluentd-address" "fluentd-async-connect" "fluentd-buffer-limit" "fluentd-retry-wait" "fluentd-max-retries" "fluentd-sub-second-precision" "tag")
gcplogs_options=($common_options $common_options2 "gcp-log-cmd" "gcp-meta-id" "gcp-meta-name" "gcp-meta-zone" "gcp-project") gcplogs_options=($common_options $common_options2 "gcp-log-cmd" "gcp-meta-id" "gcp-meta-name" "gcp-meta-zone" "gcp-project")
gelf_options=($common_options $common_options2 "gelf-address" "gelf-compression-level" "gelf-compression-type" "tag") gelf_options=($common_options $common_options2 "gelf-address" "gelf-compression-level" "gelf-compression-type" "tag")
journald_options=($common_options $common_options2 "tag") journald_options=($common_options $common_options2 "tag")
...@@ -431,7 +431,7 @@ __docker_complete_events_filter() { ...@@ -431,7 +431,7 @@ __docker_complete_events_filter() {
integer ret=1 integer ret=1
declare -a opts declare -a opts
opts=('container' 'daemon' 'event' 'image' 'label' 'network' 'type' 'volume') opts=('container' 'daemon' 'event' 'image' 'label' 'network' 'scope' 'type' 'volume')
if compset -P '*='; then if compset -P '*='; then
case "${${words[-1]%=*}#*=}" in case "${${words[-1]%=*}#*=}" in
...@@ -450,9 +450,9 @@ __docker_complete_events_filter() { ...@@ -450,9 +450,9 @@ __docker_complete_events_filter() {
;; ;;
(event) (event)
local -a event_opts local -a event_opts
event_opts=('attach' 'commit' 'connect' 'copy' 'create' 'delete' 'destroy' 'detach' 'die' 'disconnect' 'exec_create' 'exec_detach' event_opts=('attach' 'commit' 'connect' 'copy' 'create' 'delete' 'destroy' 'detach' 'die' 'disable' 'disconnect' 'enable' 'exec_create' 'exec_detach'
'exec_start' 'export' 'health_status' 'import' 'kill' 'load' 'mount' 'oom' 'pause' 'pull' 'push' 'reload' 'rename' 'resize' 'restart' 'save' 'start' 'exec_start' 'export' 'health_status' 'import' 'install' 'kill' 'load' 'mount' 'oom' 'pause' 'pull' 'push' 'reload' 'remove' 'rename' 'resize'
'stop' 'tag' 'top' 'unmount' 'unpause' 'untag' 'update') 'restart' 'save' 'start' 'stop' 'tag' 'top' 'unmount' 'unpause' 'untag' 'update')
_describe -t event-filter-opts "event filter options" event_opts && ret=0 _describe -t event-filter-opts "event filter options" event_opts && ret=0
;; ;;
(image) (image)
...@@ -461,6 +461,11 @@ __docker_complete_events_filter() { ...@@ -461,6 +461,11 @@ __docker_complete_events_filter() {
(network) (network)
__docker_complete_networks && ret=0 __docker_complete_networks && ret=0
;; ;;
(scope)
local -a scope_opts
scope_opts=('local' 'swarm')
_describe -t scope-filter-opts "scope filter options" scope_opts && ret=0
;;
(type) (type)
local -a type_opts local -a type_opts
type_opts=('container' 'daemon' 'image' 'network' 'volume') type_opts=('container' 'daemon' 'image' 'network' 'volume')
...@@ -745,6 +750,7 @@ __docker_container_subcommand() { ...@@ -745,6 +750,7 @@ __docker_container_subcommand() {
"($help)--privileged[Give extended Linux capabilities to the command]" \ "($help)--privileged[Give extended Linux capabilities to the command]" \
"($help -t --tty)"{-t,--tty}"[Allocate a pseudo-tty]" \ "($help -t --tty)"{-t,--tty}"[Allocate a pseudo-tty]" \
"($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users" \ "($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users" \
"($help -w --workdir)"{-w=,--workdir=}"[Working directory inside the container]:directory:_directories" \
"($help -):containers:__docker_complete_running_containers" \ "($help -):containers:__docker_complete_running_containers" \
"($help -)*::command:->anycommand" && ret=0 "($help -)*::command:->anycommand" && ret=0
case $state in case $state in
...@@ -888,7 +894,7 @@ __docker_container_subcommand() { ...@@ -888,7 +894,7 @@ __docker_container_subcommand() {
$opts_help \ $opts_help \
$opts_attach_exec_run_start \ $opts_attach_exec_run_start \
"($help -a --attach)"{-a,--attach}"[Attach container's stdout/stderr and forward all signals]" \ "($help -a --attach)"{-a,--attach}"[Attach container's stdout/stderr and forward all signals]" \
"($help -i --interactive)"{-i,--interactive}"[Attach container's stding]" \ "($help -i --interactive)"{-i,--interactive}"[Attach container's stdin]" \
"($help -)*:containers:__docker_complete_stopped_containers" && ret=0 "($help -)*:containers:__docker_complete_stopped_containers" && ret=0
;; ;;
(stats) (stats)
...@@ -922,7 +928,7 @@ __docker_container_subcommand() { ...@@ -922,7 +928,7 @@ __docker_container_subcommand() {
local state local state
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
opts_create_run_update \ $opts_create_run_update \
"($help -)*: :->values" && ret=0 "($help -)*: :->values" && ret=0
case $state in case $state in
(values) (values)
...@@ -1393,7 +1399,7 @@ __docker_nodes() { ...@@ -1393,7 +1399,7 @@ __docker_nodes() {
# Names # Names
if [[ $type = (names|all) ]]; then if [[ $type = (names|all) ]]; then
for line in $lines; do for line in $lines; do
s="${line[${begin[NAME]},${end[NAME]}]%% ##}" s="${line[${begin[HOSTNAME]},${end[HOSTNAME]}]%% ##}"
nodes=($nodes $s) nodes=($nodes $s)
done done
fi fi
...@@ -1955,6 +1961,7 @@ __docker_service_subcommand() { ...@@ -1955,6 +1961,7 @@ __docker_service_subcommand() {
"($help)--health-retries=[Consecutive failures needed to report unhealthy]:retries:(1 2 3 4 5)" "($help)--health-retries=[Consecutive failures needed to report unhealthy]:retries:(1 2 3 4 5)"
"($help)--health-timeout=[Maximum time to allow one check to run]:time: " "($help)--health-timeout=[Maximum time to allow one check to run]:time: "
"($help)--hostname=[Service container hostname]:hostname: " \ "($help)--hostname=[Service container hostname]:hostname: " \
"($help)--isolation=[Service container isolation mode]:isolation:(default process hyperv)" \
"($help)*--label=[Service labels]:label: " "($help)*--label=[Service labels]:label: "
"($help)--limit-cpu=[Limit CPUs]:value: " "($help)--limit-cpu=[Limit CPUs]:value: "
"($help)--limit-memory=[Limit Memory]:value: " "($help)--limit-memory=[Limit Memory]:value: "
...@@ -2168,9 +2175,9 @@ __docker_stacks() { ...@@ -2168,9 +2175,9 @@ __docker_stacks() {
end[${header[$i,$((j-1))]}]=-1 end[${header[$i,$((j-1))]}]=-1
lines=(${lines[2,-1]}) lines=(${lines[2,-1]})
# Service ID # Service NAME
for line in $lines; do for line in $lines; do
s="${line[${begin[ID]},${end[ID]}]%% ##}" s="${line[${begin[NAME]},${end[NAME]}]%% ##}"
stacks=($stacks $s) stacks=($stacks $s)
done done
...@@ -2631,7 +2638,6 @@ __docker_subcommand() { ...@@ -2631,7 +2638,6 @@ __docker_subcommand() {
"($help)--default-gateway-v6[Container default gateway IPv6 address]:IPv6 address: " \ "($help)--default-gateway-v6[Container default gateway IPv6 address]:IPv6 address: " \
"($help)--default-shm-size=[Default shm size for containers]:size:" \ "($help)--default-shm-size=[Default shm size for containers]:size:" \
"($help)*--default-ulimit=[Default ulimits for containers]:ulimit: " \ "($help)*--default-ulimit=[Default ulimits for containers]:ulimit: " \
"($help)--disable-legacy-registry[Disable contacting legacy registries (default true)]" \
"($help)*--dns=[DNS server to use]:DNS: " \ "($help)*--dns=[DNS server to use]:DNS: " \
"($help)*--dns-opt=[DNS options to use]:DNS option: " \ "($help)*--dns-opt=[DNS options to use]:DNS option: " \
"($help)*--dns-search=[DNS search domains to use]:DNS search: " \ "($help)*--dns-search=[DNS search domains to use]:DNS search: " \
......
# Doctl
This plugin provides completion for [Doctl](https://github.com/digitalocean/doctl).
To use it add doctl to the plugins array in your zshrc file.
```bash
plugins=(... doctl)
```
# Autocompletion for doctl, the command line tool for DigitalOcean service
#
# doctl project: https://github.com/digitalocean/doctl
#
# Author: https://github.com/HalisCz
if [ $commands[doctl] ]; then
source <(doctl completion zsh)
fi
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
Automatically load your project ENV variables from `.env` file when you `cd` into project root directory. Automatically load your project ENV variables from `.env` file when you `cd` into project root directory.
Storing configuration in the environment is one of the tenets of a [twelve-factor app](http://www.12factor.net). Anything that is likely to change between deployment environments–such as resource handles for databases or credentials for external services–should be extracted from the code into environment variables. Storing configuration in the environment is one of the tenets of a [twelve-factor app](https://www.12factor.net). Anything that is likely to change between deployment environments, such as resource handles for databases or credentials for external services, should be extracted from the code into environment variables.
## Installation ## Installation
Just add the plugin to your `.zshrc`: Just add the plugin to your `.zshrc`:
```sh ```sh
plugins=(git man dotenv) plugins=(... dotenv)
``` ```
## Usage ## Usage
Create `.env` file inside your project directory and put your local ENV variables there. Create `.env` file inside your project root directory and put your ENV variables there.
For example: For example:
```sh ```sh
...@@ -30,5 +30,16 @@ SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f ...@@ -30,5 +30,16 @@ SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
MONGO_URI=mongodb://127.0.0.1:27017 MONGO_URI=mongodb://127.0.0.1:27017
PORT=3001 PORT=3001
``` ```
You can even mix both formats, although it's probably a bad idea.
**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 supposed to be local only. ## 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.
## Disclaimer
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)
#!/bin/zsh
source_env() { source_env() {
if [[ -f .env ]]; then if [[ -f .env ]]; then
source .env # test .env syntax
zsh -fn .env || echo 'dotenv: error when sourcing `.env` file' >&2
if [[ -o a ]]; then
source .env
else
set -a
source .env
set +a
fi
fi fi
} }
autoload -U add-zsh-hook autoload -U add-zsh-hook
add-zsh-hook chpwd source_env add-zsh-hook chpwd source_env
source_env
...@@ -16,4 +16,4 @@ Author: [Fabio Fernandes](https://github.com/fabiofl) ...@@ -16,4 +16,4 @@ Author: [Fabio Fernandes](https://github.com/fabiofl)
- Upload a file: `droplr ./path/to/file/` - Upload a file: `droplr ./path/to/file/`
- Shorten a link: `droplr http://example.com` - Shorten a link: `droplr https://example.com`
# ExpressionEngine CMS basic command completion
_eecms_console () {
echo "php $(find . -maxdepth 3 -mindepth 1 -name 'eecms' -type f | head -n 1)"
}
_eecms_get_command_list () {
`_eecms_console` | sed "/Available commands/,/^/d" | sed "s/[[:space:]].*//g"
}
_eecms () {
compadd `_eecms_get_command_list`
}
compdef _eecms '`_eecms_console`'
compdef _eecms 'system/ee/eecms'
compdef _eecms eecms
#Alias
alias eecms='`_eecms_console`'
# Emacs plugin
This plugin utilizes the Emacs daemon capability, allowing the user to quickly open frames, whether they are opened in a terminal via a ssh connection, or X frames opened on the same host. The plugin also provides some aliases for such operations.
- You don't have the cost of starting Emacs all the time anymore
- Opening a file is as fast as Emacs does not have anything else to do.
- You can share opened buffered across opened frames.
- Configuration changes made at runtime are applied to all frames.
**NOTE:** requires Emacs 24 and newer.
To use it, add emacs to the plugins array in your zshrc file:
```zsh
plugins=(... emacs)
```
## Aliases
The plugin uses a custom launcher (which we'll call here `$EMACS_LAUNCHER`) that is just a wrapper around [`emacsclient`](https://www.emacswiki.org/emacs/EmacsClient).
| Alias | Command | Description |
|--------|----------------------------------------------------|----------------------------------------------------------------|
| emacs | `$EMACS_LAUNCHER --no-wait` | Opens a temporary emacsclient frame |
| e | `emacs` | Same as emacs alias |
| te | `$EMACS_LAUNCHER -nw` | Open terminal emacsclient |
| eeval | `$EMACS_LAUNCHER --eval` | Same as `M-x eval` but from outside Emacs |
| eframe | `emacsclient --alternate-editor "" --create-frame` | Create new X frame |
| efile | - | Print the path to the file open in the current buffer |
| ecd | - | Print the directory of the file open in the the current buffer |
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# - Configuration changes made at runtime are applied to all frames. # - Configuration changes made at runtime are applied to all frames.
if "$ZSH/tools/require_tool.sh" emacs 24 2>/dev/null ; then if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then
export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh" export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh"
# set EDITOR if not already defined. # set EDITOR if not already defined.
......
# Ember CLI # Ember CLI
**Maintainers:** [BilalBudhani](http://www.github.com/BilalBudhani), [eubenesa](http://www.github.com/eubenesa) **Maintainers:** [BilalBudhani](https://github.com/BilalBudhani), [eubenesa](https://github.com/eubenesa), [scottkidder](https://github.com/scottkidder]
Ember CLI (http://www.ember-cli.com/) Ember CLI (https://www.ember-cli.com/)
### List of Aliases ### List of Aliases
...@@ -17,5 +17,6 @@ Alias | Ember-CLI command ...@@ -17,5 +17,6 @@ Alias | Ember-CLI command
**ein** | *ember init* **ein** | *ember init*
**ei** | *ember install* **ei** | *ember install*
**et** | *ember test* **et** | *ember test*
**ets** | *ember test --serve*
**eu** | *ember update* **eu** | *ember update*
**ev** | *ember version* **ev** | *ember version*
# Ember CLI # Ember CLI
# Visit http://www.ember-cli.com/ to view user guide # Visit https://www.ember-cli.com/ to view user guide
alias es='ember serve' alias es='ember serve'
alias ea='ember addon' alias ea='ember addon'
...@@ -10,6 +10,7 @@ alias eh='ember help' ...@@ -10,6 +10,7 @@ alias eh='ember help'
alias ein='ember init' alias ein='ember init'
alias ei='ember install' alias ei='ember install'
alias et='ember test' alias et='ember test'
alias ets='ember test --serve'
alias eu='ember update' alias eu='ember update'
# version # version
......
# emoji-clock
The plugin displays current time as an emoji symbol with half hour accuracy.
To use it, add `emoji-clock` to the plugins array of your zshrc file:
```
plugins=(... emoji-clock)
```
## Features
| Function | Description |
|-------------------|----------------------------------------------------------------------|
| `emoji-clock` | Displays current time in clock emoji symbol with half hour accuracy |
...@@ -71,7 +71,7 @@ PROMPT="$surfer > " ...@@ -71,7 +71,7 @@ PROMPT="$surfer > "
## Technical Details ## Technical Details
The emoji names and codes are sourced from Unicode Technical Report \#51, which provides information on emoji support in Unicode. It can be found at http://www.unicode.org/reports/tr51/index.html. The emoji names and codes are sourced from Unicode Technical Report \#51, which provides information on emoji support in Unicode. It can be found at https://www.unicode.org/reports/tr51/index.html.
The group definitions are added by this OMZ plugin. They are not based on external definitions. (As far as I can tell. -apjanke) The group definitions are added by this OMZ plugin. They are not based on external definitions. (As far as I can tell. -apjanke)
...@@ -108,7 +108,7 @@ The `$emoji_skintone` associative array maps skin tone IDs to the variation sele ...@@ -108,7 +108,7 @@ The `$emoji_skintone` associative array maps skin tone IDs to the variation sele
echo "$emoji[smiling_face_with_open_mouth]$emoji_skintone[4]" echo "$emoji[smiling_face_with_open_mouth]$emoji_skintone[4]"
``` ```
Note that `$emoji_skintone` is an associative array, and its keys are the *names* of "Fitzpatrick Skin Type" groups, not linear indexes into a normal array. The names are `1_2`, `3`, `4`, `5`, and `6`. (Types 1 and 2 are combined into a single color.) See the [Diversity section in Unicode TR 51](http://www.unicode.org/reports/tr51/index.html#Diversity) for details. Note that `$emoji_skintone` is an associative array, and its keys are the *names* of "Fitzpatrick Skin Type" groups, not linear indexes into a normal array. The names are `1_2`, `3`, `4`, `5`, and `6`. (Types 1 and 2 are combined into a single color.) See the [Diversity section in Unicode TR 51](https://www.unicode.org/reports/tr51/index.html#Diversity) for details.
## TODO ## TODO
...@@ -130,6 +130,6 @@ This does *not* mean that it should use Gemoji at run time. None of the `zsh` pl ...@@ -130,6 +130,6 @@ This does *not* mean that it should use Gemoji at run time. None of the `zsh` pl
#### ZWJ combining function #### ZWJ combining function
One of the newer features of Unicode emoji is the ability to use the "Zero-Width Joiner" character to compose multiple emoji characters in to a single "emoji ligature" glyph. For example, this is [how Apple supports "family" emoji with various genders and skin tones](http://www.unicode.org/reports/tr51/index.html#ZWJ_Sequences). One of the newer features of Unicode emoji is the ability to use the "Zero-Width Joiner" character to compose multiple emoji characters in to a single "emoji ligature" glyph. For example, this is [how Apple supports "family" emoji with various genders and skin tones](https://www.unicode.org/reports/tr51/index.html#ZWJ_Sequences).
These are a pain to write out (and probably worse to read), and it might be convenient to have a couple functions for concisely composing them, if wider support for them appears. These are a pain to write out (and probably worse to read), and it might be convenient to have a couple functions for concisely composing them, if wider support for them appears.
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
# none: not applicable # none: not applicable
# Field 4 — Emoji_Sources: # Field 4 — Emoji_Sources:
# one or more values from {z, a, j, w, x} # one or more values from {z, a, j, w, x}
# see the key in http://www.unicode.org/draft/reports/tr51/tr51.html#Major_Sources # see the key in https://www.unicode.org/draft/reports/tr51/tr51.html#Major_Sources
# NA: not applicable # NA: not applicable
# Comment — currently contains the version where the character was first encoded, # Comment — currently contains the version where the character was first encoded,
# followed by: # followed by:
...@@ -1200,7 +1200,7 @@ ...@@ -1200,7 +1200,7 @@
1F1F2 1F1ED ; emoji ; L2 ; none ; x # V6.0 (🇲🇭) flag for Marshall Islands 1F1F2 1F1ED ; emoji ; L2 ; none ; x # V6.0 (🇲🇭) flag for Marshall Islands
1F1F2 1F1F0 ; emoji ; L2 ; none ; x # V6.0 (🇲🇰) flag for Macedonia 1F1F2 1F1F0 ; emoji ; L2 ; none ; x # V6.0 (🇲🇰) flag for Macedonia
1F1F2 1F1F1 ; emoji ; L2 ; none ; x # V6.0 (🇲🇱) flag for Mali 1F1F2 1F1F1 ; emoji ; L2 ; none ; x # V6.0 (🇲🇱) flag for Mali
1F1F2 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇲🇲) flag for Myanmar 1F1F2 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇲🇲) flag for Myanmar
1F1F2 1F1F3 ; emoji ; L2 ; none ; x # V6.0 (🇲🇳) flag for Mongolia 1F1F2 1F1F3 ; emoji ; L2 ; none ; x # V6.0 (🇲🇳) flag for Mongolia
1F1F2 1F1F4 ; emoji ; L2 ; none ; x # V6.0 (🇲🇴) flag for Macau 1F1F2 1F1F4 ; emoji ; L2 ; none ; x # V6.0 (🇲🇴) flag for Macau
1F1F2 1F1F5 ; emoji ; L2 ; none ; x # V6.0 (🇲🇵) flag for Northern Mariana Islands 1F1F2 1F1F5 ; emoji ; L2 ; none ; x # V6.0 (🇲🇵) flag for Northern Mariana Islands
......
...@@ -5,15 +5,15 @@ ...@@ -5,15 +5,15 @@
# This script generates the emoji.plugin.zsh emoji definitions from the Unicode # This script generates the emoji.plugin.zsh emoji definitions from the Unicode
# character data for the emoji characters. # character data for the emoji characters.
# #
# The data file can be found at http://unicode.org/Public/emoji/latest/emoji-data.txt # The data file can be found at https://unicode.org/Public/emoji/latest/emoji-data.txt
# as referenced in Unicode TR51 (http://www.unicode.org/reports/tr51/index.html). # as referenced in Unicode TR51 (https://www.unicode.org/reports/tr51/index.html).
# #
# This is known to work with the data file from version 1.0. It may not work with later # This is known to work with the data file from version 1.0. It may not work with later
# versions if the format changes. In particular, this reads line comments to get the # versions if the format changes. In particular, this reads line comments to get the
# emoji character name and unicode version. # emoji character name and unicode version.
# #
# Country names have punctuation and other non-letter characters removed from their name, # Country names have punctuation and other non-letter characters removed from their name,
# to avoid possible complications with having to escape the strings when using them as # to avoid possible complications with having to escape the strings when using them as
# array subscripts. The definition file seems to use some combining characters like accents # array subscripts. The definition file seems to use some combining characters like accents
# that get stripped during this process. # that get stripped during this process.
...@@ -41,7 +41,7 @@ sub process_emoji_data_file { ...@@ -41,7 +41,7 @@ sub process_emoji_data_file {
# #
# This contains the definition for: # This contains the definition for:
# \$emoji - which maps character names to Unicode characters # \$emoji - which maps character names to Unicode characters
# \$emoji_flags - maps country names to Unicode flag characters using region indicators # \$emoji_flags - maps country names to Unicode flag characters using region indicators
# Main emoji # Main emoji
typeset -gAH emoji typeset -gAH emoji
...@@ -63,7 +63,7 @@ typeset -gAH emoji_mod ...@@ -63,7 +63,7 @@ typeset -gAH emoji_mod
next if /^\s*#/ or /^\s*$/; next if /^\s*#/ or /^\s*$/;
if (/^(\S.*?\S)\s*;\s*(\w+)\s*;\s*(\w+)\s*;\s*(\w+)\s*;\s*(\w.*?)\s*#\s*V(\S+)\s\(.*?\)\s*(\w.*\S)\s*$/) { if (/^(\S.*?\S)\s*;\s*(\w+)\s*;\s*(\w+)\s*;\s*(\w+)\s*;\s*(\w.*?)\s*#\s*V(\S+)\s\(.*?\)\s*(\w.*\S)\s*$/) {
my ($code, $style, $level, $modifier_status, $sources, $version, $keycap_name) my ($code, $style, $level, $modifier_status, $sources, $version, $keycap_name)
= ($1, $2, $3, $4, $5, $6, $7); = ($1, $2, $3, $4, $5, $6, $7);
#print "code=$code style=$style level=$level modifier_status=$modifier_status sources=$sources version=$version name=$keycap_name\n"; #print "code=$code style=$style level=$level modifier_status=$modifier_status sources=$sources version=$version name=$keycap_name\n";
my @code_points = split /\s+/, $code; my @code_points = split /\s+/, $code;
...@@ -84,7 +84,7 @@ typeset -gAH emoji_mod ...@@ -84,7 +84,7 @@ typeset -gAH emoji_mod
if ($flag_country) { if ($flag_country) {
$outfh->print("emoji_flags[$zsh_flag_country]=\$'$zsh_code'\n"); $outfh->print("emoji_flags[$zsh_flag_country]=\$'$zsh_code'\n");
} else { } else {
$outfh->print("emoji[$omz_name]=\$'$zsh_code'\n"); $outfh->print("emoji[$omz_name]=\$'$zsh_code'\n");
} }
# Modifiers are included in both the main set and their separate map, # Modifiers are included in both the main set and their separate map,
# because they have a standalone representation as a color swatch. # because they have a standalone representation as a color swatch.
......
...@@ -26,13 +26,14 @@ function emotty() { ...@@ -26,13 +26,14 @@ function emotty() {
# Use emotty set defined by user, fallback to default # Use emotty set defined by user, fallback to default
local emotty=${_emotty_sets[${emotty_set:-$emotty_default_set}]} local emotty=${_emotty_sets[${emotty_set:-$emotty_default_set}]}
# Parse $TTY number, normalizing it to an emotty set index # Parse $TTY number, normalizing it to an emotty set index
(( tty = (${TTY##/dev/ttys} % ${#${=emotty}}) + 1 )) (( tty = (${TTY##/dev/tty} % ${#${=emotty}}) + 1 ))
local character_name=${${=emotty}[tty]} local character_name=${${=emotty}[tty]}
echo "${emoji[${character_name}]}${emoji2[emoji_style]}" echo "${emoji[${character_name}]}${emoji2[emoji_style]}"
} }
function display_emotty() { function display_emotty() {
local name=$1 local name=${1:-$emotty_set}
echo $name
for i in ${=_emotty_sets[$name]}; do for i in ${=_emotty_sets[$name]}; do
printf "${emoji[$i]}${emoji2[emoji_style]} " printf "${emoji[$i]}${emoji2[emoji_style]} "
done done
......
# encode64
Alias plugin for encoding or decoding using `base64` command
## Functions and Aliases
| Function | Alias | Description |
| ---------- | ----- | ------------------------------ |
| `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 reload configuration by running:
```sh
source ~/.zshrc
```
## Usage and examples
### Encoding
- From parameter
```console
$ encode64 "oh-my-zsh"
b2gtbXktenNo
$ e64 "oh-my-zsh"
b2gtbXktenNo
```
- From piping
```console
$ echo "oh-my-zsh" | encode64
b2gtbXktenNo==
$ echo "oh-my-zsh" | e64
b2gtbXktenNo==
```
### Decoding
- From parameter
```console
$ decode64 b2gtbXktenNo
oh-my-zsh%
$ d64 b2gtbXktenNo
oh-my-zsh%
```
- From piping
```console
$ echo "b2gtbXktenNoCg==" | decode64
oh-my-zsh
$ echo "b2gtbXktenNoCg==" | decode64
oh-my-zsh
```
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
_arguments \ _arguments \
'(-r --remove)'{-r,--remove}'[Remove archive.]' \ '(-r --remove)'{-r,--remove}'[Remove archive.]' \
"*::archive file:_files -g '(#i)*.(7z|Z|apk|bz2|deb|gz|ipsw|jar|lzma|rar|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|xpi|xz|zip)(-.)'" \ "*::archive file:_files -g '(#i)*.(7z|Z|apk|bz2|deb|gz|ipsw|jar|lzma|rar|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|whl|xpi|xz|zip)(-.)'" \
&& return 0 && return 0
...@@ -10,7 +10,7 @@ extract() { ...@@ -10,7 +10,7 @@ extract() {
Usage: extract [-option] [file ...] Usage: extract [-option] [file ...]
Options: Options:
-r, --remove Remove archive. -r, --remove Remove archive after unpacking.
EOF EOF
fi fi
...@@ -29,7 +29,7 @@ extract() { ...@@ -29,7 +29,7 @@ extract() {
success=0 success=0
extract_dir="${1:t:r}" extract_dir="${1:t:r}"
case "$1" in case "${1:l}" in
(*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$1" | tar xv } || tar zxvf "$1" ;; (*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$1" | tar xv } || tar zxvf "$1" ;;
(*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
(*.tar.xz|*.txz) (*.tar.xz|*.txz)
...@@ -45,8 +45,8 @@ extract() { ...@@ -45,8 +45,8 @@ extract() {
(*.bz2) bunzip2 "$1" ;; (*.bz2) bunzip2 "$1" ;;
(*.xz) unxz "$1" ;; (*.xz) unxz "$1" ;;
(*.lzma) unlzma "$1" ;; (*.lzma) unlzma "$1" ;;
(*.Z) uncompress "$1" ;; (*.z) uncompress "$1" ;;
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk) unzip "$1" -d $extract_dir ;; (*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.whl) unzip "$1" -d $extract_dir ;;
(*.rar) unrar x -ad "$1" ;; (*.rar) unrar x -ad "$1" ;;
(*.7z) 7za x "$1" ;; (*.7z) 7za x "$1" ;;
(*.deb) (*.deb)
......
# Fabric
This plugin provides completion for [Fabric](https://www.fabfile.org/).
To use it add fabric to the plugins array in your zshrc file.
```bash
plugins=(... fabric)
```
# DECLARION: This plugin was created by vhbit. What I did is just making a portal from https://github.com/vhbit/fabric-zsh-autocomplete.
...@@ -6,6 +6,7 @@ if [ $commands[fasd] ]; then # check if fasd is installed ...@@ -6,6 +6,7 @@ if [ $commands[fasd] ]; then # check if fasd is installed
source "$fasd_cache" source "$fasd_cache"
unset fasd_cache unset fasd_cache
alias v="f -e $EDITOR" alias v="f -e \"$EDITOR\""
alias o='a -e open_command' alias o='a -e xdg-open'
alias j='zz'
fi fi
This is a plugin based on yum plugin, but using dnf as main frontend The fedora plugin is deprecated. Use the [dnf plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/dnf) instead.
(from Fedora 22 onwards, yum is deprecated in favor of dnf).
## Aliases
alias dnfs="dnf search" # search package
alias dnfp="dnf info" # show package info
alias dnfl="dnf list" # list packages
alias dnfgl="dnf grouplist" # list package groups
alias dnfli="dnf list installed" # print all installed packages
alias dnfmc="dnf makecache" # rebuilds the dnf package list
alias dnfu="sudo dnf upgrade" # upgrade packages
alias dnfi="sudo dnf install" # install package
alias dnfgi="sudo dnf groupinstall" # install package group
alias dnfr="sudo dnf remove" # remove package
alias dnfgr="sudo dnf groupremove" # remove pagage group
alias dnfrl="sudo dnf remove --remove-leaves" # remove package and leaves
alias dnfc="sudo dnf clean all" # clean cache
../dnf/dnf.plugin.zsh
\ No newline at end of file
...@@ -6,7 +6,7 @@ alias fwrp="sudo firewall-cmd --runtime-to-permanent" ...@@ -6,7 +6,7 @@ alias fwrp="sudo firewall-cmd --runtime-to-permanent"
function fwl () { function fwl () {
# converts output to zsh array () # converts output to zsh array ()
# @f flag split on new line # @f flag split on new line
zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v interfaces)}") zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v 'interfaces\|sources')}")
for i in $zones; do for i in $zones; do
sudo firewall-cmd --zone $i --list-all sudo firewall-cmd --zone $i --list-all
......
...@@ -4,7 +4,7 @@ Plugin for ForkLift, an FTP application for OS X. ...@@ -4,7 +4,7 @@ Plugin for ForkLift, an FTP application for OS X.
### Requirements ### Requirements
* [ForkLift](http://www.binarynights.com/forklift/) * [ForkLift](https://binarynights.com/)
### Usage ### Usage
......
# Open folder in ForkLift.app or ForkLift2.app from console # Open folder in ForkLift.app or ForkLift2.app from console
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de # Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
# Updated to support ForkLift2 by Johan Kaving # Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving
# #
# Usage: # Usage:
# fl [<folder>] # fl [<folder>]
...@@ -24,46 +24,84 @@ function fl { ...@@ -24,46 +24,84 @@ function fl {
fi fi
osascript 2>&1 1>/dev/null <<END osascript 2>&1 1>/dev/null <<END
try try
tell application "Finder" tell application "Finder"
set appName to name of application file id "com.binarynights.ForkLift2" set forkLift3 to name of application file id "com.binarynights.ForkLift-3"
end tell end tell
on error err_msg number err_num on error err_msg number err_num
tell application "Finder" set forkLift3 to null
set appName to name of application file id "com.binarynights.ForkLift" end try
end tell try
end try tell application "Finder"
set forkLift2 to name of application file id "com.binarynights.ForkLift2"
end tell
on error err_msg number err_num
set forkLift2 to null
end try
try
tell application "Finder"
set forkLift to name of application file id "com.binarynights.ForkLift"
end tell
on error err_msg number err_num
set forkLift to null
end try
if application appName is running if forkLift3 is not null and application forkLift3 is running then
tell application appName tell application forkLift3
activate activate
end tell set forkLiftVersion to version
else end tell
tell application appName else if forkLift2 is not null and application forkLift2 is running then
tell application forkLift2
activate activate
end tell set forkLiftVersion to version
repeat until application appName is running end tell
delay 1 else if forkLift is not null and application forkLift is running then
end repeat tell application forkLift
tell application appName
activate activate
end tell set forkLiftVersion to version
end tell
else
if forkLift3 is not null then
set appName to forkLift3
else if forkLift2 is not null then
set appName to forkLift2
else if forkLift is not null then
set appName to forkLift
end if end if
tell application appName
activate
set forkLiftVersion to version
end tell
repeat until application appName is running
delay 1
end repeat
tell application appName
activate
end tell
end if
tell application "System Events" tell application "System Events"
tell application process "ForkLift" tell application process "ForkLift"
try try
set topWindow to window 1 set topWindow to window 1
on error on error
keystroke "n" using command down keystroke "n" using command down
set topWindow to window 1 set topWindow to window 1
end try end try
keystroke "g" using {command down, shift down} keystroke "g" using {command down, shift down}
tell sheet 1 of topWindow if forkLiftVersion starts with "3" then
set value of text field 1 to "$PWD" tell pop over of list of group of splitter group of splitter group of topWindow
keystroke return set value of text field 1 to "$PWD"
end tell end tell
end tell else
tell sheet 1 of topWindow
set value of text field 1 to "$PWD"
end tell
end if
keystroke return
end tell end tell
end tell
END END
} }
...@@ -35,13 +35,13 @@ Available search contexts are: ...@@ -35,13 +35,13 @@ Available search contexts are:
| angularjs | `https://google.com/search?as_sitesearch=angularjs.org&as_q=` | | angularjs | `https://google.com/search?as_sitesearch=angularjs.org&as_q=` |
| aurajs | `http://aurajs.com/api/#stq=` | | aurajs | `http://aurajs.com/api/#stq=` |
| bem | `https://google.com/search?as_sitesearch=bem.info&as_q=` | | bem | `https://google.com/search?as_sitesearch=bem.info&as_q=` |
| bootsnipp | `http://bootsnipp.com/search?q=` | | bootsnipp | `https://bootsnipp.com/search?q=` |
| caniuse | `http://caniuse.com/#search=` | | caniuse | `https://caniuse.com/#search=` |
| codepen | `http://codepen.io/search?q=` | | codepen | `https://codepen.io/search?q=` |
| compassdoc | `http://compass-style.org/search?q=` | | compassdoc | `http://compass-style.org/search?q=` |
| cssflow | `http://www.cssflow.com/search?q=` | | cssflow | `http://www.cssflow.com/search?q=` |
| dartlang | `https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:` | | dartlang | `https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:` |
| emberjs | `http://emberjs.com/api/#stp=1&stq=` | | emberjs | `https://emberjs.com/api/#stp=1&stq=` |
| fontello | `http://fontello.com/#search=` | | fontello | `http://fontello.com/#search=` |
| html5please | `http://html5please.com/#` | | html5please | `http://html5please.com/#` |
| jquery | `https://api.jquery.com/?s=` | | jquery | `https://api.jquery.com/?s=` |
...@@ -51,7 +51,7 @@ Available search contexts are: ...@@ -51,7 +51,7 @@ Available search contexts are:
| qunit | `https://api.qunitjs.com/?s=` | | qunit | `https://api.qunitjs.com/?s=` |
| reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` | | reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` |
| smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` | | smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` |
| stackoverflow | `http://stackoverflow.com/search?q=` | | stackoverflow | `https://stackoverflow.com/search?q=` |
| unheap | `http://www.unheap.com/?s=` | | unheap | `http://www.unheap.com/?s=` |
If you want to have another context, open an Issue and tell us! If you want to have another context, open an Issue and tell us!
...@@ -62,4 +62,4 @@ If you want to have another context, open an Issue and tell us! ...@@ -62,4 +62,4 @@ If you want to have another context, open an Issue and tell us!
**Wilson Mendes (willmendesneto)** **Wilson Mendes (willmendesneto)**
+ <https://plus.google.com/+WilsonMendes> + <https://plus.google.com/+WilsonMendes>
+ <https://twitter.com/willmendesneto> + <https://twitter.com/willmendesneto>
+ <http://github.com/willmendesneto> + <https://github.com/willmendesneto>
...@@ -29,13 +29,13 @@ function frontend() { ...@@ -29,13 +29,13 @@ function frontend() {
angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q=' angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q='
aurajs 'http://aurajs.com/api/#stq=' aurajs 'http://aurajs.com/api/#stq='
bem 'https://google.com/search?as_sitesearch=bem.info&as_q=' bem 'https://google.com/search?as_sitesearch=bem.info&as_q='
bootsnipp 'http://bootsnipp.com/search?q=' bootsnipp 'https://bootsnipp.com/search?q='
caniuse 'http://caniuse.com/#search=' caniuse 'https://caniuse.com/#search='
codepen 'http://codepen.io/search?q=' codepen 'https://codepen.io/search?q='
compassdoc 'http://compass-style.org/search?q=' compassdoc 'http://compass-style.org/search?q='
cssflow 'http://www.cssflow.com/search?q=' cssflow 'http://www.cssflow.com/search?q='
dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:' dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:'
emberjs 'http://emberjs.com/api/#stp=1&stq=' emberjs 'https://emberjs.com/api/#stp=1&stq='
fontello 'http://fontello.com/#search=' fontello 'http://fontello.com/#search='
html5please 'http://html5please.com/#' html5please 'http://html5please.com/#'
jquery 'https://api.jquery.com/?s=' jquery 'https://api.jquery.com/?s='
...@@ -45,7 +45,7 @@ function frontend() { ...@@ -45,7 +45,7 @@ function frontend() {
qunit 'https://api.qunitjs.com/?s=' qunit 'https://api.qunitjs.com/?s='
reactjs 'https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=' reactjs 'https://google.com/search?as_sitesearch=facebook.github.io/react&as_q='
smacss 'https://google.com/search?as_sitesearch=smacss.com&as_q=' smacss 'https://google.com/search?as_sitesearch=smacss.com&as_q='
stackoverflow 'http://stackoverflow.com/search?q=' stackoverflow 'https://stackoverflow.com/search?q='
unheap 'http://www.unheap.com/?s=' unheap 'http://www.unheap.com/?s='
) )
......
# fzf
This plugin enables [junegunn's fzf](https://github.com/junegunn/fzf) fuzzy auto-completion and key bindings
```zsh
# Set fzf installation directory path
export FZF_BASE=/path/to/fzf/install/dir
# Uncomment the following line to disable fuzzy completion
# export DISABLE_FZF_AUTO_COMPLETION="true"
# Uncomment the following line to disable key bindings (CTRL-T, CTRL-R, ALT-C)
# export DISABLE_FZF_KEY_BINDINGS="true"
plugins=(
...
fzf
)
```
test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}"
if [[ -z "${fzf_base}" ]]; then
fzfdirs=(
"${HOME}/.fzf"
"/usr/local/opt/fzf"
"/usr/share/fzf"
)
for dir in ${fzfdirs}; do
if [[ -d "${dir}" ]]; then
fzf_base="${dir}"
break
fi
done
if [[ -z "${fzf_base}" ]]; then
if (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
if [[ -d "${dir}" ]]; then
fzf_base="${dir}"
fi
fi
fi
fi
if [[ -n "${fzf_base}" ]]; then
# Fix fzf shell directory for Archlinux package
if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then
fzf_shell="${fzf_base}"
else
fzf_shell="${fzf_base}/shell"
fi
# Setup fzf
# ---------
if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then
export PATH="$PATH:$fzf_base/bin"
fi
# Auto-completion
# ---------------
if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then
[[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null
fi
# Key bindings
# ------------
if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
source "${fzf_shell}/key-bindings.zsh"
fi
else
print "[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.\n"\
"Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2
fi
unset fzf_base fzf_shell dir fzfdirs
## ZSH-Geeknote ## ZSH-Geeknote
[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for [oh-my-zsh framework](http://github.com/robbyrussell/oh-my-zsh). [Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for oh-my-zsh.
Plugins provides: Plugins provides:
......
# Gem plugin
This plugin adds completions and aliases for [Gem](https://rubygems.org/). The completions include the common `gem` subcommands as well as the installed gems in the current directory.
To use it, add `gem` to the plugins array in your zshrc file:
```zsh
plugins=(... gem)
```
## Aliases
| Alias | Command | Description |
|----------------------|-------------------------------|--------------------------------------------|
| gemb | `gem build *.gemspec` | Build a gem from a gemspec |
| gemp | `gem push *.gem` | Push a gem up to the gem server |
| gemy [gem] [version] | `gem yank [gem] -v [version]` | Remove a pushed gem version from the index |
# Git auto-fetch
Automatically fetches all changes from all remotes while you are working in git-initialized directory.
#### Usage
Add `git-auto-fetch` to the plugins array in your zshrc file:
```shell
plugins=(... git-auto-fetch)
```
Every time you launch a command in your shell all remotes will be fetched in background.
By default autofetch will be triggered only if last fetch was done at least 60 seconds ago.
You can change fetch interval in your .zshrc:
```
GIT_AUTO_FETCH_INTERVAL=1200 #in seconds
```
Log of `git fetch --all` will be saved into `.git/FETCH_LOG`
#### Toggle auto fetch per folder
If you are using mobile connection or for any other reason you can disable git-auto-fetch for any folder:
```shell
$ cd to/your/project
$ git-auto-fetch
disabled
$ git-auto-fetch
enabled
```
GIT_AUTO_FETCH_INTERVAL=${GIT_AUTO_FETCH_INTERVAL:=60}
function git-fetch-all {
(`git rev-parse --is-inside-work-tree 2>/dev/null` &&
dir=`git rev-parse --git-dir` &&
[[ ! -f $dir/NO_AUTO_FETCH ]] &&
(( `date +%s` - `date -r $dir/FETCH_LOG +%s 2>/dev/null || echo 0` > $GIT_AUTO_FETCH_INTERVAL )) &&
git fetch --all &>! $dir/FETCH_LOG &)
}
function git-auto-fetch {
`git rev-parse --is-inside-work-tree 2>/dev/null` || return
guard="`git rev-parse --git-dir`/NO_AUTO_FETCH"
(rm $guard 2>/dev/null &&
echo "${fg_bold[green]}enabled${reset_color}") ||
(touch $guard &&
echo "${fg_bold[red]}disabled${reset_color}")
}
eval "override-git-auto-fetch-$(declare -f zle-line-init)"
function zle-line-init () {
git-fetch-all
override-git-auto-fetch-zle-line-init
}
zle -N zle-line-init
# git-extras # git-extras
This plugin provides completion definitions for some of the commands defined by [git-extras](http://github.com/tj/git-extras). This plugin provides completion definitions for some of the commands defined by [git-extras](https://github.com/tj/git-extras).
## Setup notes ## Setup notes
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Description # Description
# ----------- # -----------
# #
# Completion script for git-extras (http://github.com/tj/git-extras). # Completion script for git-extras (https://github.com/tj/git-extras).
# #
# This depends on and reuses some of the internals of the _git completion # This depends on and reuses some of the internals of the _git completion
# function that ships with zsh itself. It will not work with the _git that ships # function that ships with zsh itself. It will not work with the _git that ships
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
# Inspirations # Inspirations
# ----------- # -----------
# #
# * git-extras (http://github.com/tj/git-extras) # * git-extras (https://github.com/tj/git-extras)
# * git-flow-completion (http://github.com/bobthecow/git-flow-completion) # * git-flow-completion (https://github.com/bobthecow/git-flow-completion)
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
...@@ -47,6 +47,14 @@ __gitex_commits() { ...@@ -47,6 +47,14 @@ __gitex_commits() {
_describe -t commits commit commits && ret=0 _describe -t commits commit commits && ret=0
} }
__gitex_remote_names() {
local expl
declare -a remote_names
remote_names=(${(f)"$(_call_program remotes git remote 2>/dev/null)"})
__git_command_successful || return
_wanted remote-names expl remote-name compadd $* - $remote_names
}
__gitex_tag_names() { __gitex_tag_names() {
local expl local expl
declare -a tag_names declare -a tag_names
...@@ -69,7 +77,11 @@ __gitex_specific_branch_names() { ...@@ -69,7 +77,11 @@ __gitex_specific_branch_names() {
declare -a branch_names declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/}) branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/})
__git_command_successful || return __git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names _wanted branch-names expl branch-name compadd - $branch_names
}
__gitex_chore_branch_names() {
__gitex_specific_branch_names 'chore'
} }
__gitex_feature_branch_names() { __gitex_feature_branch_names() {
...@@ -102,6 +114,11 @@ __gitex_author_names() { ...@@ -102,6 +114,11 @@ __gitex_author_names() {
} }
# subcommands # subcommands
_git-authors() {
_arguments -C \
'(--list -l)'{--list,-l}'[show authors]' \
'--no-email[without email]' \
}
_git-bug() { _git-bug() {
local curcontext=$curcontext state line ret=1 local curcontext=$curcontext state line ret=1
...@@ -126,8 +143,16 @@ _git-bug() { ...@@ -126,8 +143,16 @@ _git-bug() {
_arguments -C \ _arguments -C \
':branch-name:__gitex_bug_branch_names' ':branch-name:__gitex_bug_branch_names'
;; ;;
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac esac
return 0
esac esac
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
} }
...@@ -136,6 +161,40 @@ _git-changelog() { ...@@ -136,6 +161,40 @@ _git-changelog() {
'(-l --list)'{-l,--list}'[list commits]' \ '(-l --list)'{-l,--list}'[list commits]' \
} }
_git-chore() {
local curcontext=$curcontext state line ret=1
declare -A opt_args
_arguments -C \
': :->command' \
'*:: :->option-or-argument' && ret=0
case $state in
(command)
declare -a commands
commands=(
'finish:merge and delete the chore branch'
)
_describe -t commands command commands && ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
(finish)
_arguments -C \
':branch-name:__gitex_chore_branch_names'
;;
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac
return 0
esac
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
}
_git-contrib() { _git-contrib() {
...@@ -149,6 +208,27 @@ _git-count() { ...@@ -149,6 +208,27 @@ _git-count() {
'--all[detailed commit count]' '--all[detailed commit count]'
} }
_git-create-branch() {
local curcontext=$curcontext state line
_arguments -C \
': :->command' \
'*:: :->option-or-argument'
case "$state" in
(command)
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac
esac
}
_git-delete-branch() { _git-delete-branch() {
_arguments \ _arguments \
...@@ -220,10 +300,17 @@ _git-feature() { ...@@ -220,10 +300,17 @@ _git-feature() {
_arguments -C \ _arguments -C \
':branch-name:__gitex_feature_branch_names' ':branch-name:__gitex_feature_branch_names'
;; ;;
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac esac
return 0
esac esac
}
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
}
_git-graft() { _git-graft() {
_arguments \ _arguments \
...@@ -231,14 +318,39 @@ _git-graft() { ...@@ -231,14 +318,39 @@ _git-graft() {
':dest-branch-name:__gitex_branch_names' ':dest-branch-name:__gitex_branch_names'
} }
_git-guilt() {
_arguments -C \
'(--email -e)'{--email,-e}'[display author emails instead of names]' \
'(--ignore-whitespace -w)'{--ignore-whitespace,-w}'[ignore whitespace only changes]' \
'(--debug -d)'{--debug,-d}'[output debug information]' \
'-h[output usage information]'
}
_git-ignore() { _git-ignore() {
_arguments -C \ _arguments -C \
'(--local -l)'{--local,-l}'[show local gitignore]' \ '(--local -l)'{--local,-l}'[show local gitignore]' \
'(--global -g)'{--global,-g}'[show global gitignore]' '(--global -g)'{--global,-g}'[show global gitignore]' \
'(--private -p)'{--private,-p}'[show repo gitignore]'
} }
_git-ignore() {
_arguments -C \
'(--append -a)'{--append,-a}'[append .gitignore]' \
'(--replace -r)'{--replace,-r}'[replace .gitignore]' \
'(--list-in-table -l)'{--list-in-table,-l}'[print available types in table format]' \
'(--list-alphabetically -L)'{--list-alphabetically,-L}'[print available types in alphabetical order]' \
'(--search -s)'{--search,-s}'[search word in available types]'
}
_git-merge-into() {
_arguments '--ff-only[merge only fast-forward]'
_arguments \
':src:__gitex_branch_names' \
':dest:__gitex_branch_names'
}
_git-missing() { _git-missing() {
_arguments \ _arguments \
':first-branch-name:__gitex_branch_names' \ ':first-branch-name:__gitex_branch_names' \
...@@ -269,8 +381,16 @@ _git-refactor() { ...@@ -269,8 +381,16 @@ _git-refactor() {
_arguments -C \ _arguments -C \
':branch-name:__gitex_refactor_branch_names' ':branch-name:__gitex_refactor_branch_names'
;; ;;
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac esac
return 0
esac esac
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
} }
...@@ -279,6 +399,23 @@ _git-squash() { ...@@ -279,6 +399,23 @@ _git-squash() {
':branch-name:__gitex_branch_names' ':branch-name:__gitex_branch_names'
} }
_git-stamp() {
_arguments -C \
'(--replace -r)'{--replace,-r}'[replace stamps with same id]'
}
_git-standup() {
_arguments -C \
'-a[Specify the author of commits. Use "all" to specify all authors.]' \
'-d[Show history since N days ago]' \
'-D[Specify the date format displayed in commit history]' \
'-f[Fetch commits before showing history]' \
'-g[Display GPG signed info]' \
'-h[Display help message]' \
'-L[Enable the inclusion of symbolic links]' \
'-m[The depth of recursive directory search]'
}
_git-summary() { _git-summary() {
_arguments '--line[summarize with lines rather than commits]' _arguments '--line[summarize with lines rather than commits]'
__gitex_commits __gitex_commits
...@@ -291,45 +428,71 @@ _git-undo(){ ...@@ -291,45 +428,71 @@ _git-undo(){
'(--hard -h)'{--hard,-h}'[wipes your commit(s)]' '(--hard -h)'{--hard,-h}'[wipes your commit(s)]'
} }
zstyle ':completion:*:*:git:*' user-commands \ zstyle -g existing_user_commands ':completion:*:*:git:*' user-commands
zstyle ':completion:*:*:git:*' user-commands $existing_user_commands \
alias:'define, search and show aliases' \ alias:'define, search and show aliases' \
archive-file:'export the current HEAD of the git repository to a archive' \ archive-file:'export the current head of the git repository to an archive' \
authors:'generate authors report' \
back:'undo and stage latest commits' \ back:'undo and stage latest commits' \
bug:'create a bug branch' \ bug:'create bug branch' \
changelog:'populate changelog file with commits since the previous tag' \ bulk:'run bulk commands' \
commits-since:'list commits since a given date' \ changelog:'generate a changelog report' \
contrib:'display author contributions' \ chore:'create chore branch' \
count:'count commits' \ clear-soft:'soft clean up a repository' \
create-branch:'create local and remote branch' \ clear:'rigorously clean up a repository' \
delete-branch:'delete local and remote branch' \ commits-since:'show commit logs since some date' \
delete-merged-branches:'delete merged branches'\ contrib:'show user contributions' \
delete-submodule:'delete submodule' \ count:'show commit count' \
delete-tag:'delete local and remote tag' \ create-branch:'create branches' \
effort:'display effort statistics' \ delete-branch:'delete branches' \
extras:'git-extras' \ delete-merged-branches:'delete merged branches' \
feature:'create a feature branch' \ delete-submodule:'delete submodules' \
delete-tag:'delete tags' \
delta:'lists changed files' \
effort:'show effort statistics on file(s)' \
extras:'awesome git utilities' \
feature:'create/merge feature branch' \
force-clone:'overwrite local repositories with clone' \
fork:'fork a repo on github' \ fork:'fork a repo on github' \
fresh-branch:'create empty local branch' \ fresh-branch:'create fresh branches' \
gh-pages:'create the GitHub Pages branch' \ gh-pages:'create the github pages branch' \
graft:'merge commits from source branch to destination branch' \ graft:'merge and destroy a given branch' \
ignore:'add patterns to .gitignore' \ guilt:'calculate change between two revisions' \
info:'show info about the repository' \ ignore-io:'get sample gitignore file' \
local-commits:'list unpushed commits on the local branch' \ ignore:'add .gitignore patterns' \
info:'returns information on current repository' \
local-commits:'list local commits' \
lock:'lock a file excluded from version control' \ lock:'lock a file excluded from version control' \
locked:'ls files that have been locked' \ locked:'ls files that have been locked' \
merge-into:'merge one branch into another' \
merge-repo:'merge two repo histories' \
missing:'show commits missing from another branch' \ missing:'show commits missing from another branch' \
mr:'checks out a merge request locally' \
obliterate:'rewrite past commits to remove some files' \
pr:'checks out a pull request locally' \ pr:'checks out a pull request locally' \
psykorebase:'rebase a branch with a merge commit' \
pull-request:'create pull request to GitHub project' \
reauthor:'replace the author and/or committer identities in commits and tags' \
rebase-patch:'rebases a patch' \ rebase-patch:'rebases a patch' \
refactor:'create a refactor branch' \ refactor:'create refactor branch' \
release:'commit, tag and push changes to the repository' \ release:'commit, tag and push changes to the repository' \
rename-branch:'rename a branch' \
rename-tag:'rename a tag' \ rename-tag:'rename a tag' \
repl:'read-eval-print-loop' \ repl:'git read-eval-print-loop' \
reset-file:'reset one file' \ reset-file:'reset one file' \
root:'show path of root' \ root:'show path of root' \
setup:'setup a git repository' \ scp:'copy files to ssh compatible `git-remote`' \
sed:'replace patterns in git-controlled files' \
setup:'set up a git repository' \
show-merged-branches:'show merged branches' \
show-tree:'show branch tree of commit history' \ show-tree:'show branch tree of commit history' \
squash:'merge commits from source branch into the current one as a single commit' \ show-unmerged-branches:'show unmerged branches' \
summary:'repository summary' \ squash:'import changes from a branch' \
touch:'one step creation of new files' \ stamp:'stamp the last commit message' \
undo:'remove the latest commit' \ standup:'recall the commit history' \
summary:'show repository summary' \
sync:'sync local branch with remote branch' \
touch:'touch and add file to the index' \
undo:'remove latest commits' \
unlock:'unlock a file excluded from version control' unlock:'unlock a file excluded from version control'
# git-flow (AVH Edition) plugin
This plugin adds completion for the [git-flow (AVH Edition)](https://github.com/petervanderdoes/gitflow-avh).
The AVH Edition of the git extensions that provides high-level repository operations for [Vincent Driessen's branching model](https://nvie.com/posts/a-successful-git-branching-model/).
To use it, add `git-flow-avh` to the plugins array in your zshrc file:
```zsh
plugins=(... git-flow-avh)
```
## Requirements
1. The git-flow tool has to be [installed](https://github.com/petervanderdoes/gitflow-avh#installing-git-flow)
separately.
2. You have to use zsh's git completion instead of the git project's git completion. This is typically
done by default so you don't need to do anything else. If you installed git with Homebrew you
might have to uninstall the git completion it's bundled with.
#!zsh
#
# Installation
# ------------
#
# To achieve git-flow completion nirvana:
#
# 0. Update your zsh's git-completion module to the newest verion.
# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
#
# 1. Install this file. Either:
#
# a. Place it in your .zshrc:
#
# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.zsh) and put the following line in
# your .zshrc:
#
# source ~/.git-flow-completion.zsh
#
# c. Or, use this file as a oh-my-zsh plugin.
#
_git-flow () _git-flow ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \
'*::options:->options' '*::options:->options'
case $state in case $state in
(command) (command)
local -a subcommands local -a subcommands
subcommands=( subcommands=(
'init:Initialize a new git repo with support for the branching model.' 'init:Initialize a new git repo with support for the branching model.'
'feature:Manage your feature branches.' 'feature:Manage your feature branches.'
'config:Manage your configuration.' 'bugfix:Manage your bugfix branches.'
'release:Manage your release branches.' 'config:Manage your configuration.'
'hotfix:Manage your hotfix branches.' 'release:Manage your release branches.'
'support:Manage your support branches.' 'hotfix:Manage your hotfix branches.'
'version:Shows version information.' 'support:Manage your support branches.'
'finish:Finish the branch you are currently on.' 'version:Shows version information.'
'delete:Delete the branch you are currently on.' 'finish:Finish the branch you are currently on.'
'publish:Publish the branch you are currently on.' 'delete:Delete the branch you are currently on.'
) 'publish:Publish the branch you are currently on.'
_describe -t commands 'git flow' subcommands 'rebase:Rebase the branch you are currently on.'
;; )
_describe -t commands 'git flow' subcommands
(options) ;;
case $line[1] in
(options)
(init) case $line[1] in
_arguments \
-f'[Force setting of gitflow branches, even if already configured]' (init)
;; _arguments \
-f'[Force setting of gitflow branches, even if already configured]'
(version) ;;
;;
(version)
(hotfix) ;;
__git-flow-hotfix
;; (hotfix)
__git-flow-hotfix
(release) ;;
__git-flow-release
;; (release)
__git-flow-release
(feature) ;;
__git-flow-feature
;; (feature)
(config) __git-flow-feature
__git-flow-config ;;
;; (bugfix)
__git-flow-bugfix
esac ;;
;;
esac (config)
__git-flow-config
;;
esac
;;
esac
} }
__git-flow-release () __git-flow-release ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \
'*::options:->options' '*::options:->options'
case $state in case $state in
(command) (command)
local -a subcommands local -a subcommands
subcommands=( subcommands=(
'start:Start a new release branch.' 'start:Start a new release branch.'
'finish:Finish a release branch.' 'finish:Finish a release branch.'
'list:List all your release branches. (Alias to `git flow release`)' 'list:List all your release branches. (Alias to `git flow release`)'
'publish:Publish release branch to remote.' 'publish:Publish release branch to remote.'
'track:Checkout remote release branch.' 'track:Checkout remote release branch.'
'delete:Delete a release branch.' 'rebase:Rebase from integration branch.'
) 'delete:Delete a release branch.'
_describe -t commands 'git flow release' subcommands )
_arguments \ _describe -t commands 'git flow release' subcommands
-v'[Verbose (more) output]' _arguments \
;; -v'[Verbose (more) output]'
;;
(options)
case $line[1] in (options)
case $line[1] in
(start)
_arguments \ (start)
-F'[Fetch from origin before performing finish]'\ _arguments \
':version:__git_flow_version_list' -F'[Fetch from origin before performing finish]'\
;; ':version:__git_flow_version_list'
;;
(finish)
_arguments \ (finish)
-F'[Fetch from origin before performing finish]' \ _arguments \
-s'[Sign the release tag cryptographically]'\ -F'[Fetch from origin before performing finish]' \
-u'[Use the given GPG-key for the digital signature (implies -s)]'\ -s'[Sign the release tag cryptographically]'\
-m'[Use the given tag message]'\ -u'[Use the given GPG-key for the digital signature (implies -s)]'\
-p'[Push to $ORIGIN after performing finish]'\ -m'[Use the given tag message]'\
':version:__git_flow_version_list' -p'[Push to $ORIGIN after performing finish]'\
;; ':version:__git_flow_version_list'
;;
(delete)
_arguments \ (delete)
-f'[Force deletion]' \ _arguments \
-r'[Delete remote branch]' \ -f'[Force deletion]' \
':version:__git_flow_version_list' -r'[Delete remote branch]' \
;; ':version:__git_flow_version_list'
;;
(publish)
_arguments \ (publish)
':version:__git_flow_version_list' _arguments \
;; ':version:__git_flow_version_list'
;;
(track)
_arguments \ (track)
':version:__git_flow_version_list' _arguments \
;; ':version:__git_flow_version_list'
;;
*)
_arguments \ (rebase)
-v'[Verbose (more) output]' _arguments \
;; -i'[Do an interactive rebase]' \
esac ':branch:__git_branch_names'
;; ;;
esac
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
} }
__git-flow-hotfix () __git-flow-hotfix ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \
'*::options:->options' '*::options:->options'
case $state in case $state in
(command) (command)
local -a subcommands local -a subcommands
subcommands=( subcommands=(
'start:Start a new hotfix branch.' 'start:Start a new hotfix branch.'
'finish:Finish a hotfix branch.' 'finish:Finish a hotfix branch.'
'delete:Delete a hotfix branch.' 'delete:Delete a hotfix branch.'
'list:List all your hotfix branches. (Alias to `git flow hotfix`)' 'rebase:Rebase from integration branch.'
) 'list:List all your hotfix branches. (Alias to `git flow hotfix`)'
_describe -t commands 'git flow hotfix' subcommands 'rename:Rename a hotfix branch.'
_arguments \ )
-v'[Verbose (more) output]' _describe -t commands 'git flow hotfix' subcommands
;; _arguments \
-v'[Verbose (more) output]'
(options) ;;
case $line[1] in
(options)
(start) case $line[1] in
_arguments \
-F'[Fetch from origin before performing finish]'\ (start)
':hotfix:__git_flow_version_list'\ _arguments \
':branch-name:__git_branch_names' -F'[Fetch from origin before performing finish]'\
;; ':hotfix:__git_flow_version_list'\
':branch-name:__git_branch_names'
(finish) ;;
_arguments \
-F'[Fetch from origin before performing finish]' \ (finish)
-s'[Sign the release tag cryptographically]'\ _arguments \
-u'[Use the given GPG-key for the digital signature (implies -s)]'\ -F'[Fetch from origin before performing finish]' \
-m'[Use the given tag message]'\ -s'[Sign the release tag cryptographically]'\
-p'[Push to $ORIGIN after performing finish]'\ -u'[Use the given GPG-key for the digital signature (implies -s)]'\
':hotfix:__git_flow_hotfix_list' -m'[Use the given tag message]'\
;; -p'[Push to $ORIGIN after performing finish]'\
':hotfix:__git_flow_hotfix_list'
(delete) ;;
_arguments \
-f'[Force deletion]' \ (delete)
-r'[Delete remote branch]' \ _arguments \
':hotfix:__git_flow_hotfix_list' -f'[Force deletion]' \
;; -r'[Delete remote branch]' \
':hotfix:__git_flow_hotfix_list'
*) ;;
_arguments \
-v'[Verbose (more) output]' (rebase)
;; _arguments \
esac -i'[Do an interactive rebase]' \
;; ':branch:__git_branch_names'
esac ;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
} }
__git-flow-feature () __git-flow-feature ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \
'*::options:->options' '*::options:->options'
case $state in case $state in
(command) (command)
local -a subcommands local -a subcommands
subcommands=( subcommands=(
'start:Start a new feature branch.' 'start:Start a new feature branch.'
'finish:Finish a feature branch.' 'finish:Finish a feature branch.'
'delete:Delete a feature branch.' 'delete:Delete a feature branch.'
'list:List all your feature branches. (Alias to `git flow feature`)' 'list:List all your feature branches. (Alias to `git flow feature`)'
'publish:Publish feature branch to remote.' 'publish:Publish feature branch to remote.'
'track:Checkout remote feature branch.' 'track:Checkout remote feature branch.'
'diff:Show all changes.' 'diff:Show all changes.'
'rebase:Rebase from integration branch.' 'rebase:Rebase from integration branch.'
'checkout:Checkout local feature branch.' 'checkout:Checkout local feature branch.'
'pull:Pull changes from remote.' 'pull:Pull changes from remote.'
) 'rename:Rename a feature branch.'
_describe -t commands 'git flow feature' subcommands )
_arguments \ _describe -t commands 'git flow feature' subcommands
-v'[Verbose (more) output]' _arguments \
;; -v'[Verbose (more) output]'
;;
(options)
case $line[1] in (options)
case $line[1] in
(start)
_arguments \ (start)
-F'[Fetch from origin before performing finish]'\ _arguments \
':feature:__git_flow_feature_list'\ -F'[Fetch from origin before performing finish]'\
':branch-name:__git_branch_names' ':feature:__git_flow_feature_list'\
;; ':branch-name:__git_branch_names'
;;
(finish)
_arguments \ (finish)
-F'[Fetch from origin before performing finish]' \ _arguments \
-r'[Rebase instead of merge]'\ -F'[Fetch from origin before performing finish]' \
':feature:__git_flow_feature_list' -r'[Rebase instead of merge]'\
;; ':feature:__git_flow_feature_list'
;;
(delete)
_arguments \ (delete)
-f'[Force deletion]' \ _arguments \
-r'[Delete remote branch]' \ -f'[Force deletion]' \
':feature:__git_flow_feature_list' -r'[Delete remote branch]' \
;; ':feature:__git_flow_feature_list'
;;
(publish)
_arguments \ (publish)
':feature:__git_flow_feature_list'\ _arguments \
;; ':feature:__git_flow_feature_list'\
;;
(track)
_arguments \ (track)
':feature:__git_flow_feature_list'\ _arguments \
;; ':feature:__git_flow_feature_list'\
;;
(diff)
_arguments \ (diff)
':branch:__git_branch_names'\ _arguments \
;; ':branch:__git_branch_names'\
;;
(rebase)
_arguments \ (rebase)
-i'[Do an interactive rebase]' \ _arguments \
':branch:__git_branch_names' -i'[Do an interactive rebase]' \
;; ':branch:__git_branch_names'
;;
(checkout)
_arguments \ (checkout)
':branch:__git_flow_feature_list'\ _arguments \
;; ':branch:__git_flow_feature_list'\
;;
(pull)
_arguments \ (pull)
':remote:__git_remotes'\ _arguments \
':branch:__git_branch_names' ':remote:__git_remotes'\
;; ':branch:__git_branch_names'
;;
*)
_arguments \ *)
-v'[Verbose (more) output]' _arguments \
;; -v'[Verbose (more) output]'
esac ;;
;; esac
esac ;;
esac
}
__git-flow-bugfix ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new bugfix branch.'
'finish:Finish a bugfix branch.'
'delete:Delete a bugfix branch.'
'list:List all your bugfix branches. (Alias to `git flow bugfix`)'
'publish:Publish bugfix branch to remote.'
'track:Checkout remote bugfix branch.'
'diff:Show all changes.'
'rebase:Rebase from integration branch.'
'checkout:Checkout local bugfix branch.'
'pull:Pull changes from remote.'
'rename:Rename a bugfix branch.'
)
_describe -t commands 'git flow bugfix' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':bugfix:__git_flow_bugfix_list'\
':branch-name:__git_branch_names'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-r'[Rebase instead of merge]'\
':bugfix:__git_flow_bugfix_list'
;;
(delete)
_arguments \
-f'[Force deletion]' \
-r'[Delete remote branch]' \
':bugfix:__git_flow_bugfix_list'
;;
(publish)
_arguments \
':bugfix:__git_flow_bugfix_list'\
;;
(track)
_arguments \
':bugfix:__git_flow_bugfix_list'\
;;
(diff)
_arguments \
':branch:__git_branch_names'\
;;
(rebase)
_arguments \
-i'[Do an interactive rebase]' \
':branch:__git_branch_names'
;;
(checkout)
_arguments \
':branch:__git_flow_bugfix_list'\
;;
(pull)
_arguments \
':remote:__git_remotes'\
':branch:__git_branch_names'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
} }
__git-flow-config () __git-flow-config ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \
'*::options:->options' '*::options:->options'
case $state in case $state in
(command) (command)
local -a subcommands local -a subcommands
subcommands=( subcommands=(
'list:List the configuration. (Alias to `git flow config`)' 'list:List the configuration. (Alias to `git flow config`)'
'set:Set the configuration option' 'set:Set the configuration option'
) )
_describe -t commands 'git flow config' subcommands _describe -t commands 'git flow config' subcommands
;; ;;
(options) (options)
case $line[1] in case $line[1] in
(set) (set)
_arguments \ _arguments \
--local'[Use repository config file]' \ --local'[Use repository config file]' \
--global'[Use global config file]'\ --global'[Use global config file]'\
--system'[Use system config file]'\ --system'[Use system config file]'\
--file'[Use given config file]'\ --file'[Use given config file]'\
':option:(master develop feature hotfix release support versiontagprefix)' ':option:(master develop feature hotfix release support versiontagprefix)'
;; ;;
*) *)
_arguments \ _arguments \
--local'[Use repository config file]' \ --local'[Use repository config file]' \
--global'[Use global config file]'\ --global'[Use global config file]'\
--system'[Use system config file]'\ --system'[Use system config file]'\
--file'[Use given config file]' --file'[Use given config file]'
;; ;;
esac esac
;; ;;
esac esac
} }
__git_flow_version_list () __git_flow_version_list ()
{ {
local expl local expl
declare -a versions declare -a versions
versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}}) versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return __git_command_successful || return
_wanted versions expl 'version' compadd $versions _wanted versions expl 'version' compadd $versions
} }
__git_flow_feature_list () __git_flow_feature_list ()
{ {
local expl local expl
declare -a features declare -a features
features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted features expl 'feature' compadd $features
}
__git_flow_bugfix_list ()
{
local expl
declare -a bugfixes
features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}}) bugfixes=(${${(f)"$(_call_program bugfixes git flow bugfix list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return __git_command_successful || return
_wanted features expl 'feature' compadd $features _wanted bugfixes expl 'bugfix' compadd $bugfixes
} }
__git_remotes () { __git_remotes () {
local expl gitdir remotes local expl gitdir remotes
gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
__git_command_successful || return __git_command_successful || return
remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]}) remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]})
__git_command_successful || return __git_command_successful || return
# TODO: Should combine the two instead of either or. # TODO: Should combine the two instead of either or.
if (( $#remotes > 0 )); then if (( $#remotes > 0 )); then
_wanted remotes expl remote compadd $* - $remotes _wanted remotes expl remote compadd $* - $remotes
else else
_wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*" _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*"
fi fi
} }
__git_flow_hotfix_list () __git_flow_hotfix_list ()
{ {
local expl local expl
declare -a hotfixes declare -a hotfixes
hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}}) hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return __git_command_successful || return
_wanted hotfixes expl 'hotfix' compadd $hotfixes _wanted hotfixes expl 'hotfix' compadd $hotfixes
} }
__git_branch_names () { __git_branch_names () {
local expl local expl
declare -a branch_names declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
__git_command_successful || return __git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names _wanted branch-names expl branch-name compadd $* - $branch_names
} }
__git_command_successful () { __git_command_successful () {
if (( ${#pipestatus:#0} > 0 )); then if (( ${#pipestatus:#0} > 0 )); then
_message 'not a git repository' _message 'not a git repository'
return 1 return 1
fi fi
return 0 return 0
} }
zstyle ':completion:*:*:git:*' user-commands flow:'provide high-level repository operations' zstyle ':completion:*:*:git:*' user-commands flow:'provide high-level repository operations'
...@@ -10,22 +10,23 @@ plugins=(... git-flow) ...@@ -10,22 +10,23 @@ plugins=(... git-flow)
## Aliases ## Aliases
More information about `git-flow` commands: More information about `git-flow` commands:
https://github.com/nvie/gitflow/wiki/Command-Line-Arguments https://github.com/nvie/gitflow/wiki/Command-Line-Arguments
| Alias | Command | Description | | Alias | Command | Description |
|---------|---------------------------|----------------------------------------| |---------|----------------------------|----------------------------------------|
| `gfl` | `git flow` | Git-Flow command | | `gfl` | `git flow` | Git-Flow command |
| `gfli` | `git flow init` | Initialize git-flow repository | | `gfli` | `git flow init` | Initialize git-flow repository |
| `gcd` | `git checkout develop` | Check out develop branch | | `gcd` | `git checkout develop` | Check out develop branch |
| `gch` | `git checkout hotfix` | Check out hotfix branch | | `gch` | `git checkout hotfix` | Check out hotfix branch |
| `gcr` | `git checkout release` | Check out release branch | | `gcr` | `git checkout release` | Check out release branch |
| `gflf` | `git flow feature` | List existing feature branches | | `gflf` | `git flow feature` | List existing feature branches |
| `gflh` | `git flow hotfix` | List existing hotfix branches | | `gflh` | `git flow hotfix` | List existing hotfix branches |
| `gflr` | `git flow release` | List existing release branches | | `gflr` | `git flow release` | List existing release branches |
| `gflfs` | `git flow feature start` | Start a new feature: `gflfs <name>` | | `gflfs` | `git flow feature start` | Start a new feature: `gflfs <name>` |
| `gflhs` | `git flow hotfix start` | Start a new hotfix: `gflhs <version>` | | `gflhs` | `git flow hotfix start` | Start a new hotfix: `gflhs <version>` |
| `gflrs` | `git flow release start` | Start a new release: `gflrs <version>` | | `gflrs` | `git flow release start` | Start a new release: `gflrs <version>` |
| `gflff` | `git flow feature finish` | Finish feature: `gflff <name>` | | `gflff` | `git flow feature finish` | Finish feature: `gflff <name>` |
| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` | | `gflfp` | `git flow feature publish` | Publish feature: `gflfp <name>` |
| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` | | `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` |
| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` |
...@@ -33,6 +33,7 @@ alias gflfs='git flow feature start' ...@@ -33,6 +33,7 @@ alias gflfs='git flow feature start'
alias gflhs='git flow hotfix start' alias gflhs='git flow hotfix start'
alias gflrs='git flow release start' alias gflrs='git flow release start'
alias gflff='git flow feature finish' alias gflff='git flow feature finish'
alias gflfp='git flow feature publish'
alias gflhf='git flow hotfix finish' alias gflhf='git flow hotfix finish'
alias gflrf='git flow release finish' alias gflrf='git flow release finish'
alias gflfp='git flow feature publish' alias gflfp='git flow feature publish'
......
# git-hubflow plugin
This plugin adds completion for [HubFlow](https://datasift.github.io/gitflow/) (GitFlow for GitHub), as well as some
aliases for common commands. HubFlow is a git extension to make it easy to use GitFlow with GitHub. Based on the
original gitflow extension for git.
The hubflow tool has to be [installed](https://github.com/datasift/gitflow#installation) separately.
To use it, add `git-hubflow` to the plugins array in your zshrc file:
```zsh
plugins=(... git-hubflow)
```
## Aliases
| Alias | Command | Description |
|-------|------------------|------------------------------------------------------------------|
| ghf | `git hf` | Print command overview |
| ghff | `git hf feature` | Manage your feature branches |
| ghfr | `git hf release` | Manage your release branches |
| ghfh | `git hf hotfix` | Manage your hotfix branches |
| ghfs | `git hf support` | Manage your support branches |
| ghfu | `git hf update` | Pull upstream changes down into your master and develop branches |
#!zsh
#
# Installation
# ------------
#
# To achieve git-hubflow completion nirvana:
#
# 0. Update your zsh's git-completion module to the newest version.
# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
#
# 1. Install this file. Either:
#
# a. Place it in your .zshrc:
#
# b. Or, copy it somewhere (e.g. ~/.git-hubflow-completion.zsh) and put the following line in
# your .zshrc:
#
# source ~/.git-hubflow-completion.zsh
#
# c. Or, use this file as an oh-my-zsh plugin.
#
alias ghf='git hf' alias ghf='git hf'
alias ghff='git hf feature' alias ghff='git hf feature'
alias ghfr='git hf release' alias ghfr='git hf release'
......
# ZSH Git Prompt Plugin from: # ZSH Git Prompt Plugin from:
# http://github.com/olivierverdier/zsh-git-prompt # https://github.com/olivierverdier/zsh-git-prompt
__GIT_PROMPT_DIR="${0:A:h}" __GIT_PROMPT_DIR="${0:A:h}"
......
...@@ -22,7 +22,7 @@ def get_tagname_or_hash(): ...@@ -22,7 +22,7 @@ def get_tagname_or_hash():
tagname = 'tags/' + output[m.start()+len('tag: '): m.end()-1] tagname = 'tags/' + output[m.start()+len('tag: '): m.end()-1]
if tagname: if tagname:
return tagname return tagname.replace(' ', '')
elif hash_: elif hash_:
return hash_ return hash_
return None return None
...@@ -41,7 +41,7 @@ ahead, behind = 0, 0 ...@@ -41,7 +41,7 @@ ahead, behind = 0, 0
status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()] status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()]
for st in status: for st in status:
if st[0] == '#' and st[1] == '#': if st[0] == '#' and st[1] == '#':
if re.search('Initial commit on', st[2]): if re.search('Initial commit on', st[2]) or re.search('No commits yet on', st[2]):
branch = st[2].split(' ')[-1] branch = st[2].split(' ')[-1]
elif re.search('no branch', st[2]): # detached status elif re.search('no branch', st[2]): # detached status
branch = get_tagname_or_hash() branch = get_tagname_or_hash()
......
...@@ -44,12 +44,14 @@ alias ga='git add' ...@@ -44,12 +44,14 @@ alias ga='git add'
alias gaa='git add --all' alias gaa='git add --all'
alias gapa='git add --patch' alias gapa='git add --patch'
alias gau='git add --update' alias gau='git add --update'
alias gav='git add --verbose'
alias gap='git apply' alias gap='git apply'
alias gb='git branch' alias gb='git branch'
alias gba='git branch -a' alias gba='git branch -a'
alias gbd='git branch -d' alias gbd='git branch -d'
alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d' alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d'
alias gbD='git branch -D'
alias gbl='git blame -b -w' alias gbl='git blame -b -w'
alias gbnm='git branch --no-merged' alias gbnm='git branch --no-merged'
alias gbr='git branch --remote' alias gbr='git branch --remote'
...@@ -70,7 +72,7 @@ alias gcam='git commit -a -m' ...@@ -70,7 +72,7 @@ alias gcam='git commit -a -m'
alias gcsm='git commit -s -m' alias gcsm='git commit -s -m'
alias gcb='git checkout -b' alias gcb='git checkout -b'
alias gcf='git config --list' alias gcf='git config --list'
alias gcl='git clone --recursive' alias gcl='git clone --recurse-submodules'
alias gclean='git clean -fd' alias gclean='git clean -fd'
alias gpristine='git reset --hard && git clean -dfx' alias gpristine='git reset --hard && git clean -dfx'
alias gcm='git checkout master' alias gcm='git checkout master'
...@@ -88,6 +90,7 @@ alias gd='git diff' ...@@ -88,6 +90,7 @@ alias gd='git diff'
alias gdca='git diff --cached' alias gdca='git diff --cached'
alias gdcw='git diff --cached --word-diff' alias gdcw='git diff --cached --word-diff'
alias gdct='git describe --tags `git rev-list --tags --max-count=1`' alias gdct='git describe --tags `git rev-list --tags --max-count=1`'
alias gds='git diff --staged'
alias gdt='git diff-tree --no-commit-id --name-only -r' alias gdt='git diff-tree --no-commit-id --name-only -r'
alias gdw='git diff --word-diff' alias gdw='git diff --word-diff'
...@@ -180,8 +183,11 @@ alias glgg='git log --graph' ...@@ -180,8 +183,11 @@ alias glgg='git log --graph'
alias glgga='git log --graph --decorate --all' alias glgga='git log --graph --decorate --all'
alias glgm='git log --graph --max-count=10' alias glgm='git log --graph --max-count=10'
alias glo='git log --oneline --decorate' alias glo='git log --oneline --decorate'
alias glol="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" alias glol="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'"
alias glola="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all" alias glols="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat"
alias glod="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'"
alias glods="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"
alias glola="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all"
alias glog='git log --oneline --decorate --graph' alias glog='git log --oneline --decorate --graph'
alias gloga='git log --oneline --decorate --graph --all' alias gloga='git log --oneline --decorate --graph --all'
alias glp="_git_log_prettily" alias glp="_git_log_prettily"
...@@ -196,6 +202,8 @@ alias gma='git merge --abort' ...@@ -196,6 +202,8 @@ alias gma='git merge --abort'
alias gp='git push' alias gp='git push'
alias gpd='git push --dry-run' alias gpd='git push --dry-run'
alias gpf='git push --force-with-lease'
alias gpf!='git push --force'
alias gpoat='git push origin --all && git push origin --tags' alias gpoat='git push origin --all && git push origin --tags'
compdef _git gpoat=git-push compdef _git gpoat=git-push
alias gpu='git push upstream' alias gpu='git push upstream'
...@@ -206,11 +214,14 @@ alias gra='git remote add' ...@@ -206,11 +214,14 @@ alias gra='git remote add'
alias grb='git rebase' alias grb='git rebase'
alias grba='git rebase --abort' alias grba='git rebase --abort'
alias grbc='git rebase --continue' alias grbc='git rebase --continue'
alias grbd='git rebase develop'
alias grbi='git rebase -i' alias grbi='git rebase -i'
alias grbm='git rebase master' alias grbm='git rebase master'
alias grbs='git rebase --skip' alias grbs='git rebase --skip'
alias grh='git reset HEAD' alias grh='git reset'
alias grhh='git reset HEAD --hard' alias grhh='git reset --hard'
alias grm='git rm'
alias grmc='git rm --cached'
alias grmv='git remote rename' alias grmv='git remote rename'
alias grrm='git remote remove' alias grrm='git remote remove'
alias grset='git remote set-url' alias grset='git remote set-url'
...@@ -221,6 +232,7 @@ alias grv='git remote -v' ...@@ -221,6 +232,7 @@ alias grv='git remote -v'
alias gsb='git status -sb' alias gsb='git status -sb'
alias gsd='git svn dcommit' alias gsd='git svn dcommit'
alias gsh='git show'
alias gsi='git submodule init' alias gsi='git submodule init'
alias gsps='git show --pretty=short --show-signature' alias gsps='git show --pretty=short --show-signature'
alias gsr='git svn rebase' alias gsr='git svn rebase'
...@@ -233,6 +245,7 @@ alias gstd='git stash drop' ...@@ -233,6 +245,7 @@ alias gstd='git stash drop'
alias gstl='git stash list' alias gstl='git stash list'
alias gstp='git stash pop' alias gstp='git stash pop'
alias gsts='git stash show --text' alias gsts='git stash show --text'
alias gstall='git stash --all'
alias gsu='git submodule update' alias gsu='git submodule update'
alias gts='git tag -s' alias gts='git tag -s'
...@@ -242,6 +255,8 @@ alias gunignore='git update-index --no-assume-unchanged' ...@@ -242,6 +255,8 @@ alias gunignore='git update-index --no-assume-unchanged'
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
alias gup='git pull --rebase' alias gup='git pull --rebase'
alias gupv='git pull --rebase -v' alias gupv='git pull --rebase -v'
alias gupa='git pull --rebase --autostash'
alias gupav='git pull --rebase --autostash -v'
alias glum='git pull upstream master' alias glum='git pull upstream master'
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
......
# 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..
To use it, add `gitfast` to the plugins array in your zshrc file:
```zsh
plugins=(... gitfast)
```
## Aliases
| Alias | Command |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| g | `git` |
| ga | `git add` |
| gaa | `git add --all` |
| gapa | `git add --patch` |
| gau | `git add --update` |
| 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` |
| gbl | `git blame -b -w` |
| gbnm | `git branch --no-merged` |
| gbr | `git branch --remote` |
| gbs | `git bisect` |
| gbsb | `git bisect bad` |
| gbsg | `git bisect good` |
| gbsr | `git bisect reset` |
| gbss | `git bisect start` |
| gc | `git commit -v` |
| gc! | `git commit -v --amend` |
| gca | `git commit -v -a` |
| gca! | `git commit -v -a --amend` |
| gcam | `git commit -a -m` |
| gcan! | `git commit -v -a --no-edit --amend` |
| gcans! | `git commit -v -a -s --no-edit --amend` |
| gcb | `git checkout -b` |
| gcd | `git checkout develop` |
| gcf | `git config --list` |
| gcl | `git clone --recursive` |
| gclean | `git clean -fd` |
| gcm | `git checkout master` |
| gcmsg | `git commit -m` |
| gcn! | `git commit -v --no-edit --amend` |
| gco | `git checkout` |
| gcount | `git shortlog -sn` |
| gcp | `git cherry-pick` |
| gcpa | `git cherry-pick --abort` |
| gcpc | `git cherry-pick --continue` |
| gcs | `git commit -S` |
| gcsm | `git commit -s -m` |
| gd | `git diff` |
| gdca | `git diff --cached` |
| gdct | `` git describe --tags `git rev-list --tags --max-count=1` `` |
| gdt | `git diff-tree --no-commit-id --name-only -r` |
| gdw | `git diff --word-diff` |
| gf | `git fetch` |
| gfa | `git fetch --all --prune` |
| gfo | `git fetch origin` |
| gg | `git gui citool` |
| gga | `git gui citool --amend` |
| ggpull | `git pull origin $(git_current_branch)` |
| ggpur | `ggu` |
| ggpush | `git push origin $(git_current_branch)` |
| ggsup | `git branch --set-upstream-to=origin/$(git_current_branch)` |
| ghh | `git help` |
| gignore | `git update-index --assume-unchanged` |
| gignored | `git ls-files -v | grep "^[[:lower:]]"` |
| git-svn-dcommit-push | `git svn dcommit && git push github master:svntrunk` |
| gk | `\gitk --all --branches` |
| gke | `\gitk --all $(git log -g --pretty=%h)` |
| gl | `git pull` |
| glg | `git log --stat` |
| glgg | `git log --graph` |
| glgga | `git log --graph --decorate --all` |
| glgm | `git log --graph --max-count=10` |
| glgp | `git log --stat -p` |
| glo | `git log --oneline --decorate` |
| glog | `git log --oneline --decorate --graph` |
| gloga | `git log --oneline --decorate --graph --all` |
| glol | `git log --graph --pretty='\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit` |
| glola | `git log --graph --pretty='\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit --all` |
| glp | `_git_log_prettily` |
| glum | `git pull upstream master` |
| gm | `git merge` |
| gmom | `git merge origin/master` |
| gmt | `git mergetool --no-prompt` |
| gmtvim | `git mergetool --no-prompt --tool=vimdiff` |
| gmum | `git merge upstream/master` |
| gp | `git push` |
| gpd | `git push --dry-run` |
| gpoat | `git push origin --all && git push origin --tags` |
| gpristine | `git reset --hard && git clean -dfx` |
| gpsup | `git push --set-upstream origin $(git_current_branch)` |
| gpu | `git push upstream` |
| gpv | `git push -v` |
| gr | `git remote` |
| gra | `git remote add` |
| grb | `git rebase` |
| grba | `git rebase --abort` |
| grbc | `git rebase --continue` |
| grbi | `git rebase -i` |
| grbm | `git rebase master` |
| grbs | `git rebase --skip` |
| grh | `git reset HEAD` |
| grhh | `git reset HEAD --hard` |
| grmv | `git remote rename` |
| grrm | `git remote remove` |
| grset | `git remote set-url` |
| grt | `cd $(git rev-parse --show-toplevel || echo ".")` |
| gru | `git reset --` |
| grup | `git remote update` |
| grv | `git remote -v` |
| gsb | `git status -sb` |
| gsd | `git svn dcommit` |
| gsi | `git submodule init` |
| gsps | `git show --pretty=short --show-signature` |
| gsr | `git svn rebase` |
| gss | `git status -s` |
| gst | `git status` |
| gsta | `git stash save` |
| gstaa | `git stash apply` |
| gstc | `git stash clear` |
| gstd | `git stash drop` |
| gstl | `git stash list` |
| gstp | `git stash pop` |
| gsts | `git stash show --text` |
| gsu | `git submodule update` |
| gts | `git tag -s` |
| gtv | `git tag | sort -V` |
| gunignore | `git update-index --no-assume-unchanged` |
| gunwip | `git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1` |
| gup | `git pull --rebase` |
| gupv | `git pull --rebase -v` |
| 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 -m "--wip-- [skip ci]"` |
...@@ -11,14 +11,14 @@ This plugin supports working with GitHub from the command line. It provides a fe ...@@ -11,14 +11,14 @@ This plugin supports working with GitHub from the command line. It provides a fe
* `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub * `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub
* `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub * `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub
* `exist_gh` - Takes an existing repo and pushes it to GitHub * `exist_gh` - Takes an existing repo and pushes it to GitHub
* `git.io` - Shortens a URL using [git.io](http://git.io) * `git.io` - Shortens a URL using [git.io](https://git.io)
## Installation ## Installation
[Hub](http://github.com/github/hub) needs to be installed if you want to use it. On OS X with Homebrew, this can be done with `brew install hub`. The `hub` completion definition needs to be added to your `$FPATH` before initializing OMZ. [Hub](https://github.com/github/hub) needs to be installed if you want to use it. On OS X with Homebrew, this can be done with `brew install hub`. The `hub` completion definition needs to be added to your `$FPATH` before initializing OMZ.
The [`github` Ruby gem](http://github.com/defunkt/github-gem) needs to be installed if you want to use it. The [`github` Ruby gem](https://github.com/defunkt/github-gem) needs to be installed if you want to use it.
### Configuration ### Configuration
......
...@@ -89,6 +89,7 @@ __hub_setup_zsh_fns () { ...@@ -89,6 +89,7 @@ __hub_setup_zsh_fns () {
browse:'browse the project on GitHub' browse:'browse the project on GitHub'
compare:'open GitHub compare view' compare:'open GitHub compare view'
ci-status:'lookup commit in GitHub Status API' ci-status:'lookup commit in GitHub Status API'
sync:'update local branches from upstream'
) )
_describe -t hub-commands 'hub command' hub_commands && ret=0 _describe -t hub-commands 'hub command' hub_commands && ret=0
...@@ -115,6 +116,7 @@ create ...@@ -115,6 +116,7 @@ create
browse browse
compare compare
ci-status ci-status
sync
EOF EOF
__git_list_all_commands_without_hub __git_list_all_commands_without_hub
} }
......
# Set up hub wrapper for git, if it is available; http://github.com/github/hub # Set up hub wrapper for git, if it is available; https://github.com/github/hub
if [ "$commands[(I)hub]" ]; then if (( $+commands[hub] )); then
if hub --version &>/dev/null; then alias git=hub
eval $(hub alias -s zsh)
fi
fi fi
# Functions ################################################################# # Functions #################################################################
...@@ -38,7 +36,7 @@ new_gh() { # [DIRECTORY] ...@@ -38,7 +36,7 @@ new_gh() { # [DIRECTORY]
print '.*'"\n"'*~' >> .gitignore print '.*'"\n"'*~' >> .gitignore
git add [^.]* \ git add [^.]* \
|| return || return
git add .gitignore \ git add -f .gitignore \
|| return || return
git commit -m 'Initial commit.' \ git commit -m 'Initial commit.' \
|| return || return
...@@ -65,7 +63,7 @@ exist_gh() { # [DIRECTORY] ...@@ -65,7 +63,7 @@ exist_gh() { # [DIRECTORY]
# git.io "GitHub URL" # git.io "GitHub URL"
# #
# Shorten GitHub url, example: # Shorten GitHub url, example:
# https://github.com/nvogel/dotzsh > http://git.io/8nU25w # https://github.com/nvogel/dotzsh > https://git.io/8nU25w
# source: https://github.com/nvogel/dotzsh # source: https://github.com/nvogel/dotzsh
# documentation: https://github.com/blog/985-git-io-github-url-shortener # documentation: https://github.com/blog/985-git-io-github-url-shortener
# #
......
# gitignore
This plugin enables you the use of [gitignore.io](https://www.gitignore.io/) from the command line. You need an active internet connection.
To use it, add `gitignore` to the plugins array in your zshrc file:
```zsh
plugins=(... gitignore)
```
## Plugin commands
* `gi list`: List all the currently supported gitignore.io templates.
* `gi [TEMPLATENAME]`: Show git-ignore output on the command line, e.g. `gi java` to exclude class and package files.
* `gi [TEMPLATENAME] >> .gitignore`: Appending programming language settings to your projects .gitignore.
function gi() { curl -sL https://www.gitignore.io/api/${(j:,:)@} } function gi() { curl -fL https://www.gitignore.io/api/${(j:,:)@} }
_gitignoreio_get_command_list() { _gitignoreio_get_command_list() {
curl -sL https://www.gitignore.io/api/list | tr "," "\n" curl -sfL https://www.gitignore.io/api/list | tr "," "\n"
} }
_gitignoreio () { _gitignoreio () {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Expands all glob expressions, subcommands and aliases (including global). Expands all glob expressions, subcommands and aliases (including global).
Idea from: http://blog.patshead.com/2012/11/automatically-expaning-zsh-global-aliases---simplified.html. Idea from: https://blog.patshead.com/2012/11/automatically-expaning-zsh-global-aliases---simplified.html.
## Usage ## Usage
......
The go plugin is deprecated. Use the [golang plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/golang) instead.
# Golang plugin
This plugin adds completion for the [Go Programming Language](https://golang.org/),
as well as some aliases for common Golang commands.
To use it, add `golang` to the plugins array in your zshrc file:
```zsh
plugins=(... golang)
```
## Aliases
| Alias | Command | Description |
| ------- | ----------------------- | ------------------------------------------------------------- |
| gob | `go build` | Build your code |
| goc | `go clean` | Removes object files from package source directories |
| god | `go doc` | Prints documentation comments |
| gof | `go fmt` | Gofmt formats (aligns and indents) Go programs. |
| gofa | `go fmt ./...` | Run go fmt for all packages in current directory, recursively |
| gog | `go get` | Downloads packages and then installs them to $GOPATH |
| goi | `go install` | Compiles and installs packages to $GOPATH |
| gol | `go list` | Lists Go packages |
| gop | `cd $GOPATH` | Takes you to $GOPATH |
| gopb | `cd $GOPATH/bin` | Takes you to $GOPATH/bin |
| gops | `cd $GOPATH/src` | Takes you to $GOPATH/src |
| gor | `go run` | Compiles and runs your code |
| got | `go test` | Runs tests |
| gov | `go vet` | Vet examines Go source code and reports suspicious constructs |
...@@ -135,7 +135,7 @@ __go_tool_complete() { ...@@ -135,7 +135,7 @@ __go_tool_complete() {
run) run)
_arguments -s -w : \ _arguments -s -w : \
${build_flags[@]} \ ${build_flags[@]} \
'*:file:_path_files -g "*.go"' '*:file:_files -g "*.go"'
;; ;;
tool) tool)
if (( CURRENT == 3 )); then if (( CURRENT == 3 )); then
...@@ -184,10 +184,13 @@ alias gob='go build' ...@@ -184,10 +184,13 @@ alias gob='go build'
alias goc='go clean' alias goc='go clean'
alias god='go doc' alias god='go doc'
alias gof='go fmt' alias gof='go fmt'
alias gofa='go fmt . ./...' alias gofa='go fmt ./...'
alias gog='go get' alias gog='go get'
alias goi='go install' alias goi='go install'
alias gol='go list' alias gol='go list'
alias gop='cd $GOPATH'
alias gopb='cd $GOPATH/bin'
alias gops='cd $GOPATH/src'
alias gor='go run' alias gor='go run'
alias got='go test' alias got='go test'
alias gov='go vet' alias gov='go vet'
# gpg-agent
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:
```
plugins=(... gpg-agent)
```
# Enable gpg-agent if it is not running # Enable gpg-agent if it is not running-
GPG_AGENT_SOCKET="${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.ssh" # --use-standard-socket will work from version 2 upwards
if [ ! -S $GPG_AGENT_SOCKET ]; then
gpg-agent --daemon >/dev/null 2>&1 AGENT_SOCK=$(gpgconf --list-dirs | grep agent-socket | cut -d : -f 2)
export GPG_TTY=$(tty)
if [[ ! -S $AGENT_SOCK ]]; then
gpg-agent --daemon --use-standard-socket &>/dev/null
fi fi
export GPG_TTY=$TTY
# Set SSH to use gpg-agent if it is configured to do so # Set SSH to use gpg-agent if it's enabled
GNUPGCONFIG="${GNUPGHOME:-"$HOME/.gnupg"}/gpg-agent.conf" GNUPGCONFIG="${GNUPGHOME:-"$HOME/.gnupg"}/gpg-agent.conf"
if [ -r "$GNUPGCONFIG" ] && grep -q enable-ssh-support "$GNUPGCONFIG"; then if [[ -r $GNUPGCONFIG ]] && command grep -q enable-ssh-support "$GNUPGCONFIG"; then
export SSH_AUTH_SOCK="$AGENT_SOCK.ssh"
unset SSH_AGENT_PID unset SSH_AGENT_PID
export SSH_AUTH_SOCK=$GPG_AGENT_SOCKET
fi fi
## Gradle Plugin
This plugin adds completions and aliases for [Gradle](https://gradle.org/).
To use it, add `gradle` to the plugins array in your zshrc file:
```zsh
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`
Examples:
```zsh
gradle test
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.
############################################################################## ##############################################################################
# A descriptive listing of core Gradle commands # A descriptive listing of core Gradle commands
############################################################################ ############################################################################
gradle-or-gradlew() {
if [ -f ./gradlew ] ; then
echo "executing gradlew instead of gradle";
./gradlew "$@";
else
gradle "$@";
fi
}
alias gradle=gradle-or-gradlew;
function _gradle_core_commands() { function _gradle_core_commands() {
local ret=1 state local ret=1 state
_arguments ':subcommand:->subcommand' && ret=0 _arguments ':subcommand:->subcommand' && ret=0
...@@ -88,7 +100,7 @@ function _gradle_arguments() { ...@@ -88,7 +100,7 @@ function _gradle_arguments() {
# and if so, regenerate the .gradle_tasks cache file # and if so, regenerate the .gradle_tasks cache file
############################################################################ ############################################################################
_gradle_does_task_list_need_generating () { _gradle_does_task_list_need_generating () {
[[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache ]] [[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache || build.gradle.kts -nt .gradletasknamecache ]]
} }
############## ##############
...@@ -144,7 +156,7 @@ _gradle_parse_and_extract_tasks () { ...@@ -144,7 +156,7 @@ _gradle_parse_and_extract_tasks () {
# Discover the gradle tasks by running "gradle tasks --all" # Discover the gradle tasks by running "gradle tasks --all"
############################################################################ ############################################################################
_gradle_tasks () { _gradle_tasks () {
if [[ -f build.gradle ]]; then if [[ -f build.gradle || -f build.gradle.kts ]]; then
_gradle_arguments _gradle_arguments
if _gradle_does_task_list_need_generating; then if _gradle_does_task_list_need_generating; then
_gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache _gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache
...@@ -154,7 +166,7 @@ _gradle_tasks () { ...@@ -154,7 +166,7 @@ _gradle_tasks () {
} }
_gradlew_tasks () { _gradlew_tasks () {
if [[ -f build.gradle ]]; then if [[ -f build.gradle || -f build.gradle.kts ]]; then
_gradle_arguments _gradle_arguments
if _gradle_does_task_list_need_generating; then if _gradle_does_task_list_need_generating; then
_gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache _gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache
......
# Grails plugin
This plugin adds completion for the [Grails 2 CLI](https://grails.github.io/grails2-doc/2.5.x/guide/commandLine.html)
To use it, add `grails` to the plugins array in your zshrc file:
```zsh
plugins=(... grails)
```
It looks for scripts in the following paths:
- `$GRAILS_HOME/scripts`
- `~/.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`
# grunt plugin
This plugin adds completions for [grunt](https://github.com/gruntjs/grunt).
To use it, add `grunt` to the plugins array of your `.zshrc` file:
```zsh
plugins=(... grunt)
```
## Enable caching
If you want to use the cache, set the following in your `.zshrc`:
```zsh
zstyle ':completion:*' use-cache yes
```
## Settings
* Show grunt file path:
```zsh
zstyle ':completion::complete:grunt::options:' show_grunt_path yes
```
* Cache expiration days (default: 7):
```zsh
zstyle ':completion::complete:grunt::options:' expire 1
```
* Not update options cache if target gruntfile is changed.
```zsh
zstyle ':completion::complete:grunt::options:' no_update_options yes
```
Note that if you change the zstyle settings, you should delete the cache file and restart zsh.
```zsh
$ rm ~/.zcompcache/grunt
$ exec zsh
```
# gulp plugin
This plugin adds autocompletion for your [`gulp`](https://gulpjs.com/) tasks. It grabs all available tasks from the `gulpfile.js` in the current directory.
To use it, add `gulp` to the plugins array of your `.zshrc` file:
```
plugins=(... gulp)
```
# Hanami Plugin #
This plugin adds convenient ways to work with [Hanami](https://hanamirb.org/) via console.
It's inspired by Rails plugin, so if you've used it, you'll feel like home.
## Usage ##
For example, type `hc` into your console when you're within Hanami project directory to run
the application console. Have a look at available shortcuts below. You can read more about
these commands [on the official website](https://hanamirb.org/guides/command-line/applications/).
## Aliases ##
| Alias | Command | Description |
|-------|---------------------------|---------------------------------------------------------|
| HED | HANAMI_ENV=development | Set environment variable HANAMI_ENV to development |
| HEP | HANAMI_ENV=production | Set environment variable HANAMI_ENV to production |
| HET | HANAMI_ENV=test | Set environment variable HANAMI_ENV to test |
| hc | hanami console | Run application console |
| hd | hanami destroy | Remove specified hanami resource |
| hg | hanami generate | Create specified hanami resource |
| hgm | hanami generate migration | Create migration file |
| hs | hanami server | Launch server with hanami application |
| hsp | hanami server -p | Launch server with specified port |
| hr | hanami routes | List application routes |
| hdc | hanami db create | Create application database |
| hdd | hanami db drop | Delete application database |
| hdp | hanami db prepare | Prepare database for the current environment |
| hda | hanami db apply | Recreates a fresh schema after migrations (destructive) |
| hdv | hanami db version | Print current database version |
| hdrs | hdd && hdp | Drop and recreate application database |
| hdtp | HET hdp | Actualize test environment database |
| hrg | hr &#124; grep | Grep hanami routes with specified pattern |
alias -g HED='HANAMI_ENV=development'
alias -g HEP='HANAMI_ENV=production'
alias -g HET='HANAMI_ENV=test'
alias hc='hanami console'
alias hd='hanami destroy'
alias hg='hanami generate'
alias hgm='hanami generate migration'
alias hs='hanami server'
alias hsp='hanami server -p'
alias hr='hanami routes'
alias hdc='hanami db create'
alias hdd='hanami db drop'
alias hdp='hanami db prepare'
alias hda='hanami db apply'
alias hdv='hanami db version'
alias hdrs='hdd && hdp'
alias hdtp='HET hdp'
alias hrg='hr | grep'
# Helm plugin
This plugin adds completion for [Helm](https://helm.sh/), the Kubernetes package manager.
To use it, add `helm` to the plugins array in your zshrc file:
```zsh
plugins=(... helm)
```
# Heroku
This plugin provides completion for the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli).
To use it add heroku to the plugins array in your zshrc file:
```bash
plugins=(... heroku)
```
#compdef heroku
# Heroku Autocomplete plugin for Oh-My-Zsh
# Requires: The Heroku client gem (https://github.com/heroku/heroku)
# Author: Ali B. (http://awhitebox.com)
local -a _1st_arguments
_1st_arguments=(
"account\:confirm_billing":"Confirm that your account can be billed at the end of the month"
"addons":"list installed addons"
"addons\:list":"list all available addons"
"addons\:add":"install an addon"
"addons\:upgrade":"upgrade an existing addon"
"addons\:downgrade":"downgrade an existing addon"
"addons\:remove":"uninstall an addon"
"addons\:open":"open an addon's dashboard in your browser"
"apps":"list your apps"
"apps\:info":"show detailed app information"
"apps\:create":"create a new app"
"apps\:rename":"rename the app"
"apps\:open":"open the app in a web browser"
"apps\:destroy":"permanently destroy an app"
"auth\:login":"log in with your heroku credentials"
"auth\:logout":"clear local authentication credentials"
"config":"display the config vars for an app"
"config\:pull":"pull heroku config vars down to the local environment"
"config\:push":"push local config vars to heroku"
"config\:set":"set one or more config vars"
"config\:unset":"unset one or more config vars"
"domains":"list custom domains for an app"
"domains\:add":"add a custom domain to an app"
"domains\:remove":"remove a custom domain from an app"
"domains\:clear":"remove all custom domains from an app"
"features":"list available app features"
"features\:disable":"disables a feature"
"features\:enable":"enables an feature"
"features\:info":"displays additional information about feature"
"help":"list available commands or display help for a specific command"
"keys":"display keys for the current user"
"keys\:add":"add a key for the current user"
"keys\:remove":"remove a key from the current user"
"keys\:clear":"remove all authentication keys from the current user"
"logs":"display recent log output"
"logs\:cron":"DEPRECATED: display cron logs from legacy logging"
"logs\:drains":"manage syslog drains"
"maintenance\:on":"put the app into maintenance mode"
"maintenance\:off":"take the app out of maintenance mode"
"pg\:credentials":"display the DATABASE credentials"
"pg\:diagnose":"run diagnostics report on DATABASE"
"pg\:info":"display database information"
"pg\:kill":"kill a query"
"pg\:killall":"terminates ALL connections"
"pg\:maintenance":"manage maintenance for DATABASE"
"pg\:promote":"sets DATABASE as your DATABASE_URL"
"pg\:ps":"view active queries with execution time"
"pg\:psql":"open a psql shell to the database"
"pg\:pull":"pull from REMOTE_SOURCE_DATABASE to LOCAL_TARGET_DATABASE"
"pg\:push":"push from LOCAL_SOURCE_DATABASE to REMOTE_TARGET_DATABASE"
"pg\:reset":"delete all data in DATABASE"
"pg\:unfollow":"stop a replica from following and make it a read/write database"
"pg\:upgrade":"unfollow a database and upgrade it to the latest PostgreSQL version"
"pg\:wait":"monitor database creation, exit when complete"
"pgbackups":"list captured backups"
"pgbackups\:url":"get a temporary URL for a backup"
"pgbackups\:capture":"capture a backup from a database id"
"pgbackups\:restore":"restore a backup to a database"
"pgbackups\:destroy":"destroys a backup"
"plugins":"list installed plugins"
"plugins\:install":"install a plugin"
"plugins\:uninstall":"uninstall a plugin"
"ps\:dynos":"scale to QTY web processes"
"ps\:workers":"scale to QTY background processes"
"ps":"list processes for an app"
"ps\:restart":"restart an app process"
"ps\:scale":"scale processes by the given amount"
"releases":"list releases"
"releases\:info":"view detailed information for a release"
"rollback":"roll back to an older release"
"run":"run an attached process"
"run\:rake":"remotely execute a rake command"
"run\:console":"open a remote console session"
"sharing":"list collaborators on an app"
"sharing\:add":"add a collaborator to an app"
"sharing\:remove":"remove a collaborator from an app"
"sharing\:transfer":"transfer an app to a new owner"
"ssl":"list certificates for an app"
"ssl\:add":"add an ssl certificate to an app"
"ssl\:remove":"remove an ssl certificate from an app"
"ssl\:clear":"remove all ssl certificates from an app"
"stack":"show the list of available stacks"
"stack\:migrate":"prepare migration of this app to a new stack"
"version":"show heroku client version"
)
_arguments '*:: :->command'
if (( CURRENT == 1 )); then
_describe -t commands "heroku command" _1st_arguments
return
fi
local -a _command_args
case "$words[1]" in
apps:info)
_command_args=(
'(-r|--raw)'{-r,--raw}'[output info as raw key/value pairs]' \
)
;;
apps:create)
_command_args=(
'(-a|--addons)'{-a,--addons}'[a list of addons to install]' \
'(-r|--remote)'{-r,--remote}'[the git remote to create, default "heroku"]' \
'(-s|--stack)'{-s,--stack}'[the stack on which to create the app]' \
)
;;
config)
_command_args=(
'(-s|--shell)'{-s,--shell}'[output config vars in shell format]' \
)
;;
keys)
_command_args=(
'(-l|--long)'{-l,--long}'[display extended information for each key]' \
)
;;
logs)
_command_args=(
'(-n|--num)'{-n,--num}'[the number of lines to display]' \
'(-p|--ps)'{-p,--ps}'[only display logs from the given process]' \
'(-s|--source)'{-s,--source}'[only display logs from the given source]' \
'(-t|--tail)'{-t,--tail}'[continually stream logs]' \
)
;;
pgbackups:capture)
_command_args=(
'(-e|--expire)'{-e,--expire}'[if no slots are available to capture, delete the oldest backup to make room]' \
)
;;
stack)
_command_args=(
'(-a|--all)'{-a,--all}'[include deprecated stacks]' \
)
;;
esac
_arguments \
$_command_args \
'(--app)--app[the app name]' \
'(--remote)--remote[the remote name]' \
'(--help)--help[help about the current command]' \
&& return 0
HEROKU_AC_CACHE_DIR="$HOME/.cache"
if [ "$(uname -s)" = "Darwin" ]; then
HEROKU_AC_CACHE_DIR="$HOME/Library/Caches"
fi
if [ ! -z "$XDG_CACHE_HOME" ]; then
HEROKU_AC_CACHE_DIR="$XDG_CACHE_DIR"
fi
HEROKU_AC_ZSH_SETUP_PATH=$HEROKU_AC_CACHE_DIR/heroku/autocomplete/zsh_setup
[ -f $HEROKU_AC_ZSH_SETUP_PATH ] && source $HEROKU_AC_ZSH_SETUP_PATH
...@@ -6,9 +6,9 @@ feature, where you can type in any part of any previously entered command ...@@ -6,9 +6,9 @@ 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. 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. You can also use K and J in VI mode or ^P and ^N in EMACS mode for the same.
[1]: http://fishshell.com [1]: https://fishshell.com
[2]: http://www.zsh.org/mla/users/2009/msg00818.html [2]: https://www.zsh.org/mla/users/2009/msg00818.html
[3]: http://sourceforge.net/projects/fizsh/ [3]: https://sourceforge.net/projects/fizsh/
[4]: https://github.com/robbyrussell/oh-my-zsh/pull/215 [4]: https://github.com/robbyrussell/oh-my-zsh/pull/215
[5]: https://github.com/zsh-users/zsh-history-substring-search [5]: https://github.com/zsh-users/zsh-history-substring-search
[6]: https://github.com/zsh-users/zsh-syntax-highlighting [6]: https://github.com/zsh-users/zsh-syntax-highlighting
......
# Homestead
This plugin provides completion for [Homestead](https://laravel.com/docs/homestead).
To use it add homestead to the plugins array in your zshrc file.
```bash
plugins=(... homestead)
```
# Homestead basic command completion
_homestead_get_command_list () {
homestead --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z]+/ { print $1 }'
}
_homestead () {
compadd `_homestead_get_command_list`
}
compdef _homestead homestead
## HTTPie ## HTTPie
**Maintainer:** [lululau](https://github.com/lululau) **Maintainer:** [lululau](https://github.com/lululau)
This plugin adds completion for HTTPie, which is a command line HTTP client, a user-friendly cURL replacement. This plugin adds completion for HTTPie, which is a command line HTTP client, a user-friendly cURL replacement.
[HTTPie Homepage](http://httpie.org) [HTTPie Homepage](https://httpie.org)
# iTerm2 plugin
This plugin adds a few functions that are useful when using [iTerm2](https://www.iterm2.com/).
To use it, add _iterm2_ to the plugins array of your zshrc file:
```
plugins=(... iterm2)
```
## Plugin commands
* `_iterm2_command <iterm2-command>`
executes an arbitrary iTerm2 command via an escape code sequence.
See https://iterm2.com/documentation-escape-codes.html for all supported commands.
* `iterm2_profile <profile-name>`
changes the current terminal window's profile (colors, fonts, settings, etc).
`profile-name` is the name of another iTerm2 profile. The profile name can contain spaces.
* `iterm2_tab_color <red> <green> <blue>`
changes the color of iTerm2's currently active tab.
`red`/`green`/`blue` are on the range 0-255.
* `iterm2_tab_color_reset`
resets the color of iTerm2's current tab back to default.
## Contributors
- [Aviv Rosenberg](https://github.com/avivrosenberg)
# iwhois
Provides a whois command with a more accurate and up-to-date list of whois servers
using CNAMES, via [whois.geek.nz](https://github.com/iwantmyname/whois.geek.nz).
To use it, add iwhois to the plugins array of your zshrc file:
```
plugins=(... iwhois)
```
### Usage
The plugin defines the function `iwhois` that takes a domain name as an argument:
```
$ iwhois github.com
Domain Name: GITHUB.COM
Registry Domain ID: 1264983250_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.markmonitor.com
Registrar URL: http://www.markmonitor.com
Updated Date: 2017-06-26T16:02:39Z
Creation Date: 2007-10-09T18:20:50Z
...
```
# provide a whois command with a more accurate and up to date list of whois
# servers using CNAMES via whois.geek.nz
function iwhois() { function iwhois() {
resolver="whois.geek.nz" resolver="whois.geek.nz"
tld=`echo ${@: -1} | awk -F "." '{print $NF}'` tld=`echo ${@: -1} | awk -F "." '{print $NF}'`
......
# Jake
This plugin provides completion for [Jake](http://jakejs.com/).
To use it add jake-node to the plugins array in your zshrc file.
```bash
plugins=(... jake-node)
```
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Warning : Jakefile should have the right case : Jakefile or jakefile # Warning : Jakefile should have the right case : Jakefile or jakefile
# Tested on : MacOSX 10.7 (Lion), Ubuntu 11.10 # Tested on : MacOSX 10.7 (Lion), Ubuntu 11.10
# Author : Alexandre Lacheze (@al3xstrat) # Author : Alexandre Lacheze (@al3xstrat)
# Inspiration : http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh # Inspiration : https://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh
function _jake () { function _jake () {
if [ -f Jakefile ]||[ -f jakefile ]; then if [ -f Jakefile ]||[ -f jakefile ]; then
...@@ -11,4 +11,4 @@ function _jake () { ...@@ -11,4 +11,4 @@ function _jake () {
fi fi
} }
compdef _jake jake compdef _jake jake
\ No newline at end of file
# jenv plugin
[jenv](https://www.jenv.be/) is a Java version manager similiar to [rbenv](https://github.com/rbenv/rbenv)
and [pyenv](https://github.com/yyuu/pyenv).
This plugin initializes jenv and provides the `jenv_prompt_info` function to add Java
version information to prompts.
To use, add `jenv` to your plugins array in your zshrc file:
```zsh
plugins=(... jenv)
```
## Theme example
You can modify your `$PROMPT` or `$RPROMPT` variables to run `jenv_prompt_info`.
For example:
```
PROMPT="%~$ "
RPROMPT='$(jenv_prompt_info)'
```
changes your prompt to:
```
~/java/project$ ▋ oracle64-1.6.0.39
```
jenvdirs=("$HOME/.jenv" "/usr/local/jenv" "/opt/jenv")
FOUND_JENV=0
for jenvdir in $jenvdirs; do
if [[ -d "${jenvdir}/bin" ]]; then
FOUND_JENV=1
break
fi
done
if [[ $FOUND_JENV -eq 0 ]]; then
if (( $+commands[brew] )) && jenvdir="$(brew --prefix jenv)"; then
[[ -d "${jenvdir}/bin" ]] && FOUND_JENV=1
fi
fi
if [[ $FOUND_JENV -eq 1 ]]; then
export PATH="${jenvdir}/bin:$PATH"
eval "$(jenv init - zsh)"
function jenv_prompt_info() { jenv version-name 2>/dev/null }
if [[ -d "${jenvdir}/versions" ]]; then
export JENV_ROOT=$jenvdir
fi
else
function jenv_prompt_info() { echo "system: $(java -version 2>&1 | cut -f 2 -d ' ')" }
fi
unset jenvdir jenvdirs FOUND_JENV
...@@ -21,6 +21,7 @@ jira new # opens a new issue ...@@ -21,6 +21,7 @@ jira new # opens a new issue
jira dashboard # opens your JIRA dashboard jira dashboard # opens your JIRA dashboard
jira reported [username] # queries for issues reported by a user jira reported [username] # queries for issues reported by a user
jira assigned [username] # queries for issues assigned to a user jira assigned [username] # queries for issues assigned to a user
jira branch # opens an existing issue matching the current branch name
jira ABC-123 # opens an existing issue jira ABC-123 # opens an existing issue
jira ABC-123 m # opens an existing issue for adding a comment jira ABC-123 m # opens an existing issue for adding a comment
``` ```
......
...@@ -7,7 +7,7 @@ _1st_arguments=( ...@@ -7,7 +7,7 @@ _1st_arguments=(
'dashboard:open the dashboard' 'dashboard:open the dashboard'
'reported:search for issues reported by a user' 'reported:search for issues reported by a user'
'assigned:search for issues assigned to a user' 'assigned:search for issues assigned to a user'
'br:open the issue named after the git branch of the current directory' 'branch:open the issue named after the git branch of the current directory'
'dumpconfig:display effective jira configuration' 'dumpconfig:display effective jira configuration'
) )
......
...@@ -60,7 +60,7 @@ function jira() { ...@@ -60,7 +60,7 @@ function jira() {
else else
# Anything that doesn't match a special action is considered an issue name # Anything that doesn't match a special action is considered an issue name
# but `branch` is a special case that will parse the current git branch # but `branch` is a special case that will parse the current git branch
if [[ "$action" == "br" ]]; then if [[ "$action" == "branch" ]]; then
local issue_arg=$(git rev-parse --abbrev-ref HEAD) local issue_arg=$(git rev-parse --abbrev-ref HEAD)
local issue="${jira_prefix}${issue_arg}" local issue="${jira_prefix}${issue_arg}"
else else
......
# Jump plugin
This plugin allows to easily jump around the file system by manually adding marks.
Those marks are stored as symbolic links in the directory `$MARKPATH` (default `$HOME/.marks`)
To use it, add `jump` to the plugins array in your zshrc file:
```zsh
plugins=(... jump)
```
## Commands
| Command | Description |
|----------------------|-------------------------------------------------------------------------------------------------|
| `jump <mark-name>` | Jump to the given mark |
| `mark [mark-name]` | Create a mark with the given name or with the name of the current directory if none is provided |
| `unmark <mark-name>` | Remove the given mark |
| `marks` | List the existing marks and the directories they point to |
...@@ -19,7 +19,7 @@ mark() { ...@@ -19,7 +19,7 @@ mark() {
MARK="$1" MARK="$1"
fi fi
if read -q \?"Mark $PWD as ${MARK}? (y/n) "; then if read -q \?"Mark $PWD as ${MARK}? (y/n) "; then
mkdir -p "$MARKPATH"; ln -s "$PWD" "$MARKPATH/$MARK" mkdir -p "$MARKPATH"; ln -sfn "$PWD" "$MARKPATH/$MARK"
fi fi
} }
...@@ -32,7 +32,7 @@ marks() { ...@@ -32,7 +32,7 @@ marks() {
local markname="$fg[cyan]${link:t}$reset_color" local markname="$fg[cyan]${link:t}$reset_color"
local markpath="$fg[blue]$(readlink $link)$reset_color" local markpath="$fg[blue]$(readlink $link)$reset_color"
printf "%s\t" $markname printf "%s\t" $markname
printf "-> %s \t\n" $markpath printf -- "-> %s \t\n" $markpath
done done
} }
......
# Kate plugin
This plugin adds aliases for the [Kate editor](https://kate-editor.org).
To use it, add kate to the plugins array of your zshrc file:
```
plugins=(... kate)
```
## Aliases
| Alias | Command | Description |
|-------|------------------------|---------------------|
| kate | `kate >/dev/null 2>&1` | Start kate silently |
## Functions
| Function | Description |
|------------|------------------------------------------|
| `kt <dir>` | Change to directory and start kate there |
# kitchen plugin
This plugin adds completion support for the [Test Kitchen](https://kitchen.ci).
To use it, add `kitchen` to the plugins array in your zshrc file:
```zsh
plugins=(... kitchen)
```
#compdef kitchen #compdef kitchen
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Copyright (c) 2014 Github zsh-users - http://github.com/zsh-users # Copyright (c) 2014 Github zsh-users - https://github.com/zsh-users
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
# Description # Description
# ----------- # -----------
# #
# Completion script for Test Kitchen (http://kitchen.ci/). # Completion script for Test Kitchen (https://kitchen.ci/).
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Authors # Authors
......
# kops
This plugin provides completion for [kops](https://github.com/kubernetes/kops) (Kubernetes Operations),
the command line interface to get a production grade Kubernetes cluster up and running.
To use it, add `kops` to the plugins array in your zshrc file.
```
plugins=(... kops)
```
**Author:** [@nmrony](https://github.com/nmrony)
# Autocompletion for kops (Kubernetes Operations),
# the command line interface to get a production grade
# Kubernetes cluster up and running
# Author: https://github.com/nmrony
if [ $commands[kops] ]; then if [ $commands[kops] ]; then
source <(kops completion zsh) source <(kops completion zsh)
fi fi
# Kubernetes prompt for zsh
A Kubernetes zsh prompt that displays the current cluster cluster
and the namespace.
Inspired by several tools used to simplify usage of kubectl
NOTE: If you are not using zsh, check out [kube-ps1](https://github.com/jonmosco/kube-ps1)
designed for bash as well as zsh.
## Requirements
The default prompt assumes you have the kubectl command line utility installed. It
can be obtained here:
[Install and Set up kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
If using this with OpenShift, the oc tool needs installed. It can be obtained from here:
[OC Client Tools](https://www.openshift.org/download.html)
## Helper utilities
There are several great tools that make using kubectl very enjoyable.
[kubectx and kubenx](https://github.com/ahmetb/kubectx) are great for
fast switching between clusters and namespaces.
## Prompt Structure
The prompt layout is:
```
(<symbol>|<cluster>:<namespace>)
```
## Enabling
In order to use kube-ps1 with Oh My Zsh, you'll need to enable them in the
.zshrc file. You'll find the zshrc file in your $HOME directory. Open it with
your favorite text editor and you'll see a spot to list all the plugins you
want to load.
```shell
vim $HOME/.zshrc
```
Add kube-ps1 to the list of enabled plugins:
```shell
plugins=(
git
kube-ps1
)
```
## Colors
Blue was used as the prefix to match the Kubernetes color as closely as
possible. Red was chosen as the cluster name to stand out, and cyan
for the namespace. These can of course be changed.
## Customization
The default settings can be overridden in ~/.zshrc
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `KUBE_PS1_BINARY` | `kubectl` | Default Kubernetes binary |
| `KUBE_PS1_PREFIX` | `(` | Prompt opening character |
| `KUBE_PS1_SYMBOL_ENABLE` | `true ` | Display the prompt Symbol. If set to `false`, this will also disable `KUBE_PS1_SEPARATOR` |
| `KUBE_PS1_SYMBOL_DEFAULT` | `⎈ ` | Default prompt symbol. Unicode `\u2388` |
| `KUBE_PS1_SYMBOL_USE_IMG` | `false` | ☸️ , Unicode `\u2638` as the prompt symbol |
| `KUBE_PS1_NS_ENABLE` | `true` | Display the namespace. If set to `false`, this will also disable `KUBE_PS1_DIVIDER` |
| `KUBE_PS1_SEPERATOR` | `\|` | Separator between symbol and cluster name |
| `KUBE_PS1_DIVIDER` | `:` | Separator between cluster and namespace |
| `KUBE_PS1_SUFFIX` | `)` | Prompt closing character |
## Contributors
Jared Yanovich
#!/bin/zsh
# Kubernetes prompt helper for bash/zsh
# ported to oh-my-zsh
# Displays current context and namespace
# Copyright 2018 Jon Mosco
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Debug
[[ -n $DEBUG ]] && set -x
setopt PROMPT_SUBST
autoload -U add-zsh-hook
add-zsh-hook precmd _kube_ps1_update_cache
zmodload zsh/stat
zmodload zsh/datetime
# Default values for the prompt
# Override these values in ~/.zshrc
KUBE_PS1_BINARY="${KUBE_PS1_BINARY:-kubectl}"
KUBE_PS1_SYMBOL_ENABLE="${KUBE_PS1_SYMBOL_ENABLE:-true}"
KUBE_PS1_SYMBOL_DEFAULT="${KUBE_PS1_SYMBOL_DEFAULT:-\u2388 }"
KUBE_PS1_SYMBOL_USE_IMG="${KUBE_PS1_SYMBOL_USE_IMG:-false}"
KUBE_PS1_NS_ENABLE="${KUBE_PS1_NS_ENABLE:-true}"
KUBE_PS1_SEPARATOR="${KUBE_PS1_SEPARATOR-|}"
KUBE_PS1_DIVIDER="${KUBE_PS1_DIVIDER-:}"
KUBE_PS1_PREFIX="${KUBE_PS1_PREFIX-(}"
KUBE_PS1_SUFFIX="${KUBE_PS1_SUFFIX-)}"
KUBE_PS1_LAST_TIME=0
_kube_ps1_binary_check() {
command -v "$1" >/dev/null
}
_kube_ps1_symbol() {
[[ "${KUBE_PS1_SYMBOL_ENABLE}" == false ]] && return
KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_DEFAULT}"
KUBE_PS1_SYMBOL_IMG="\u2638 "
if [[ "${KUBE_PS1_SYMBOL_USE_IMG}" == true ]]; then
KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_IMG}"
fi
echo "${KUBE_PS1_SYMBOL}"
}
_kube_ps1_split() {
type setopt >/dev/null 2>&1 && setopt SH_WORD_SPLIT
local IFS=$1
echo $2
}
_kube_ps1_file_newer_than() {
local mtime
local file=$1
local check_time=$2
zmodload -e "zsh/stat"
if [[ "$?" -eq 0 ]]; then
mtime=$(stat +mtime "${file}")
elif stat -c "%s" /dev/null &> /dev/null; then
# GNU stat
mtime=$(stat -c %Y "${file}")
else
# BSD stat
mtime=$(stat -f %m "$file")
fi
[[ "${mtime}" -gt "${check_time}" ]]
}
_kube_ps1_update_cache() {
KUBECONFIG="${KUBECONFIG:=$HOME/.kube/config}"
if ! _kube_ps1_binary_check "${KUBE_PS1_BINARY}"; then
# No ability to fetch context/namespace; display N/A.
KUBE_PS1_CONTEXT="BINARY-N/A"
KUBE_PS1_NAMESPACE="N/A"
return
fi
if [[ "${KUBECONFIG}" != "${KUBE_PS1_KUBECONFIG_CACHE}" ]]; then
# User changed KUBECONFIG; unconditionally refetch.
KUBE_PS1_KUBECONFIG_CACHE=${KUBECONFIG}
_kube_ps1_get_context_ns
return
fi
# kubectl will read the environment variable $KUBECONFIG
# otherwise set it to ~/.kube/config
local conf
for conf in $(_kube_ps1_split : "${KUBECONFIG:-${HOME}/.kube/config}"); do
[[ -r "${conf}" ]] || continue
if _kube_ps1_file_newer_than "${conf}" "${KUBE_PS1_LAST_TIME}"; then
_kube_ps1_get_context_ns
return
fi
done
}
_kube_ps1_get_context_ns() {
# Set the command time
KUBE_PS1_LAST_TIME=$EPOCHSECONDS
KUBE_PS1_CONTEXT="$(${KUBE_PS1_BINARY} config current-context 2>/dev/null)"
if [[ -z "${KUBE_PS1_CONTEXT}" ]]; then
KUBE_PS1_CONTEXT="N/A"
KUBE_PS1_NAMESPACE="N/A"
return
elif [[ "${KUBE_PS1_NS_ENABLE}" == true ]]; then
KUBE_PS1_NAMESPACE="$(${KUBE_PS1_BINARY} config view --minify --output 'jsonpath={..namespace}' 2>/dev/null)"
# Set namespace to 'default' if it is not defined
KUBE_PS1_NAMESPACE="${KUBE_PS1_NAMESPACE:-default}"
fi
}
# Build our prompt
kube_ps1 () {
local reset_color="%f"
local blue="%F{blue}"
local red="%F{red}"
local cyan="%F{cyan}"
KUBE_PS1="${reset_color}$KUBE_PS1_PREFIX"
KUBE_PS1+="${blue}$(_kube_ps1_symbol)"
KUBE_PS1+="${reset_color}$KUBE_PS1_SEPERATOR"
KUBE_PS1+="${red}$KUBE_PS1_CONTEXT${reset_color}"
KUBE_PS1+="$KUBE_PS1_DIVIDER"
KUBE_PS1+="${cyan}$KUBE_PS1_NAMESPACE${reset_color}"
KUBE_PS1+="$KUBE_PS1_SUFFIX"
echo "${KUBE_PS1}"
}
# Kubectl plugin
This plugin adds completion for the [Kubernetes cluster manager](https://kubernetes.io/docs/reference/kubectl/kubectl/),
as well as some aliases for common kubectl commands.
To use it, add `kubectl` to the plugins array in your zshrc file:
```zsh
plugins=(... kubectl)
```
## Aliases
| Alias | Command | Description |
|:--------|:------------------------------------|:-------------------------------------------------------------------------------------------------|
| k | `kubectl` | The kubectl command |
| kaf | `kubectl apply -f` | Apply a YML file |
| keti | `kubectl exec -ti` | Drop into an interactive terminal on a container |
| | | **Manage configuration quickly to switch contexts between local, dev and staging** |
| kcuc | `kubectl config use-context` | Set the current-context in a kubeconfig file |
| kcsc | `kubectl config set-context` | Set a context entry in kubeconfig |
| kcdc | `kubectl config delete-context` | Delete the specified context from the kubeconfig |
| kccc | `kubectl config current-context` | Display the current-context |
| | | **General aliases** |
| kdel | `kubectl delete` | Delete resources by filenames, stdin, resources and names, or by resources and label selector |
| kdelf | `kubectl delete -f` | Delete a pod using the type and name specified in -f argument |
| | | **Pod management** |
| kgp | `kubectl get pods` | List all pods in ps output format |
| kgpw | `kgp --watch` | After listing/getting the requested object, watch for changes |
| kgpwide | `kgp -o wide` | Output in plain-text format with any additional information. For pods, the node name is included |
| kep | `kubectl edit pods` | Edit pods from the default editor |
| kdp | `kubectl describe pods` | Describe all pods |
| kdelp | `kubectl delete pods` | Delete all pods matching passed arguments |
| kgpl | `kgp -l` | Get pod by label. Example: `kgpl "app=myapp" -n myns` |
| | | **Service management** |
| kgs | `kubectl get svc` | List all services in ps output format |
| kgsw | `kgs --watch` | After listing all services, watch for changes |
| kgswide | `kgs -o wide` | After listing all services, output in plain-text format with any additional information |
| kes | `kubectl edit svc` | Edit services(svc) from the default editor |
| kds | `kubectl describe svc` | Describe all services in detail |
| kdels | `kubectl delete svc` | Delete all services matching passed argument |
| | | **Ingress management** |
| kgi | `kubectl get ingress` | List ingress resources in ps output format |
| kei | `kubectl edit ingress` | Edit ingress resource from the default editor |
| kdi | `kubectl describe ingress` | Describe ingress resource in detail |
| kdeli | `kubectl delete ingress` | Delete ingress resources matching passed argument |
| | | **Namespace management** |
| kgns | `kubectl get namespaces` | List the current namespaces in a cluster |
| kens | `kubectl edit namespace` | Edit namespace resource from the default editor |
| kdns | `kubectl describe namespace` | Describe namespace resource in detail |
| kdelns | `kubectl delete namespace` | Delete the namespace. WARNING! This deletes everything in the namespace |
| | | **ConfigMap management** |
| kgcm | `kubectl get configmaps` | List the configmaps in ps output format |
| kecm | `kubectl edit configmap` | Edit configmap resource from the default editor |
| kdcm | `kubectl describe configmap` | Describe configmap resource in detail |
| kdelcm | `kubectl delete configmap` | Delete the configmap |
| | | **Secret management** |
| kgsec | `kubectl get secret` | Get secret for decoding |
| kdsec | `kubectl describe secret` | Describe secret resource in detail |
| kdelsec | `kubectl delete secret` | Delete the secret |
| | | **Deployment management** |
| kgd | `kubectl get deployment` | Get the deployment |
| kgdw | `kgd --watch` | After getting the deployment, watch for changes |
| kgdwide | `kgd -o wide` | After getting the deployment, output in plain-text format with any additional information |
| ked | `kubectl edit deployment` | Edit deployment resource from the default editor |
| kdd | `kubectl describe deployment` | Describe deployment resource in detail |
| kdeld | `kubectl delete deployment` | Delete the deployment |
| ksd | `kubectl scale deployment` | Scale a deployment |
| krsd | `kubectl rollout status deployment` | Check the rollout status of a deployment |
| | | **Rollout management** |
| kgrs | `kubectl get rs` | To see the ReplicaSet `rs` created by the deployment |
| krh | `kubectl rollout history` | Check the revisions of this deployment |
| kru | `kubectl rollout undo` | Rollback to the previous revision |
| | | **Port forwarding** |
| kpf | `kubectl port-forward` | Forward one or more local ports to a pod |
| | | **Tools for accessing all information** |
| kga | `kubectl get all` | List all resources in ps format |
| kgaa | `kubectl get all --all-namespaces` | List the requested object(s) across all namespaces |
| | | **Logs** |
| kl | `kubectl logs` | Print the logs for a container or resource |
| klf | `kubectl logs -f` | Stream the logs for a container or resource (follow) |
| | | **File copy** |
| kcp | `kubectl cp` | Copy files and directories to and from containers |
| | | **Node management** |
| kgno | `kubectl get nodes` | List the nodes in ps output format |
| keno | `kubectl edit node` | Edit nodes resource from the default editor |
| kdno | `kubectl describe node` | Describe node resource in detail |
| kdelno | `kubectl delete node` | Delete the node |
# Autocompletion for kubectl, the command line interface for Kubernetes if (( $+commands[kubectl] )); then
# __KUBECTL_COMPLETION_FILE="${ZSH_CACHE_DIR}/kubectl_completion"
# Author: https://github.com/pstadler
if [ $commands[kubectl] ]; then if [[ ! -f $__KUBECTL_COMPLETION_FILE ]]; then
source <(kubectl completion zsh) kubectl completion zsh >! $__KUBECTL_COMPLETION_FILE
fi
[[ -f $__KUBECTL_COMPLETION_FILE ]] && source $__KUBECTL_COMPLETION_FILE
unset __KUBECTL_COMPLETION_FILE
fi fi
# This command is used ALOT both below and in daily life # This command is used a LOT both below and in daily life
alias k=kubectl alias k=kubectl
# Apply a YML file
alias kaf='kubectl apply -f'
# Drop into an interactive terminal on a container # Drop into an interactive terminal on a container
alias keti='k exec -ti' alias keti='kubectl exec -ti'
# Manage configuration quickly to switch contexts between local, dev ad staging. # Manage configuration quickly to switch contexts between local, dev ad staging.
alias kcuc='k config use-context' alias kcuc='kubectl config use-context'
alias kcsc='k config set-context' alias kcsc='kubectl config set-context'
alias kcdc='k config delete-context' alias kcdc='kubectl config delete-context'
alias kccc='k config current-context' alias kccc='kubectl config current-context'
# General aliases
alias kdel='kubectl delete'
alias kdelf='kubectl delete -f'
# Pod management. # Pod management.
alias kgp='k get pods' alias kgp='kubectl get pods'
alias klp='k logs pods' alias kgpw='kgp --watch'
alias kep='k edit pods' alias kgpwide='kgp -o wide'
alias kdp='k describe pods' alias kep='kubectl edit pods'
alias kdelp='k delete pods' alias kdp='kubectl describe pods'
alias kdelp='kubectl delete pods'
alias kgpall='k get pods --all-namespaces -o wide' alias kgpall='k get pods --all-namespaces -o wide'
# get pod by label: kgpl "app=myapp" -n myns
alias kgpl='kgp -l'
# Service management. # Service management.
alias kgs='k get svc' alias kgs='kubectl get svc'
alias kes='k edit svc' alias kgsw='kgs --watch'
alias kds='k describe svc' alias kgswide='kgs -o wide'
alias kdels='k delete svc' alias kes='kubectl edit svc'
alias kds='kubectl describe svc'
alias kdels='kubectl delete svc'
# Ingress management
alias kgi='kubectl get ingress'
alias kei='kubectl edit ingress'
alias kdi='kubectl describe ingress'
alias kdeli='kubectl delete ingress'
# Namespace management
alias kgns='kubectl get namespaces'
alias kens='kubectl edit namespace'
alias kdns='kubectl describe namespace'
alias kdelns='kubectl delete namespace'
# ConfigMap management
alias kgcm='kubectl get configmaps'
alias kecm='kubectl edit configmap'
alias kdcm='kubectl describe configmap'
alias kdelcm='kubectl delete configmap'
# Secret management # Secret management
alias kgsec='k get secret' alias kgsec='kubectl get secret'
alias kdsec='k describe secret' alias kdsec='kubectl describe secret'
alias kdelsec='k delete secret' alias kdelsec='kubectl delete secret'
# Deployment management. # Deployment management.
alias kgd='k get deployment' alias kgd='kubectl get deployment'
alias ked='k edit deployment' alias kgdw='kgd --watch'
alias kdd='k describe deployment' alias kgdwide='kgd -o wide'
alias kdeld='k delete deployment' alias ked='kubectl edit deployment'
alias ksd='k scale deployment' alias kdd='kubectl describe deployment'
alias krsd='k rollout status deployment' alias kdeld='kubectl delete deployment'
alias ksd='kubectl scale deployment'
alias krsd='kubectl rollout status deployment'
# Rollout management. # Rollout management.
alias kgrs='k get rs' alias kgrs='kubectl get rs'
alias krh='k rollout history' alias krh='kubectl rollout history'
alias kru='k rollout undo' alias kru='kubectl rollout undo'
# Port forwarding
alias kpf="kubectl port-forward"
# Tools for accessing all information
alias kga='kubectl get all'
alias kgaa='kubectl get all --all-namespaces'
# Logs
alias kl='kubectl logs'
alias klf='kubectl logs -f'
# File copy
alias kcp='kubectl cp'
# Node Management
alias kgno='kubectl get nodes'
alias keno='kubectl edit node'
alias kdno='kubectl describe node'
alias kdelno='kubectl delete node'
# Laravel plugin
This plugin adds aliases and autocompletion for Laravel [Artisan](https://laravel.com/docs/artisan) and [Bob](http://daylerees.github.io/laravel-bob/) command-line interfaces.
**NOTE:** completion might not work for recent Laravel versions since it hasn't been updated since 2012.
In that case, check out plugins `laravel4` and `laravel5`.
To use it, add `laravel` to the plugins array in your zshrc file:
```zsh
plugins=(... laravel)
```
## Aliases
| Alias | Command | Description |
|-----------|--------------------------|----------------------|
| artisan | `php artisan` | Main Artisan command |
| bob | `php artisan bob::build` | Main Bob command |
# Laravel 4 plugin
This plugin adds some aliases for common [Laravel 4](https://laravel.com/docs/4.2) commands.
To use it, add `laravel4` to the plugins array in your zshrc file:
```zsh
plugins=(... laravel4)
```
## Aliases
| Alias | Command | Description |
|-----------|-------------------------------------------|-------------------------------------------------------------|
| la4 | `php artisan` | Main Artisan command |
| la4dump | `php artisan dump-autoload` | Regenerate framework autoload files |
| la4cache | `php artisan cache:clear` | Flush the application cache |
| la4routes | `php artisan routes` | List all registered routes |
# Laravel 5 plugin
This plugin adds some aliases for common [Laravel 5](https://laravel.com/docs) commands.
To use it, add `laravel5` to the plugins array in your zshrc file:
```zsh
plugins=(... laravel5)
```
## Aliases
| Alias | Command | Description |
|-----------|------------------------------|----------------------------------------------------|
| la5 | `php artisan` | Main Artisan command |
| la5cache | `php artisan cache:clear` | Flush the application cache |
| la5routes | `php artisan route:list` | List all registered routes |
| la5vendor | `php artisan vendor:publish` | Publish any publishable assets from vendor package |
...@@ -4,8 +4,10 @@ typeset -g ZSH_LAST_WORKING_DIRECTORY ...@@ -4,8 +4,10 @@ typeset -g ZSH_LAST_WORKING_DIRECTORY
# Updates the last directory once directory is changed # Updates the last directory once directory is changed
chpwd_functions+=(chpwd_last_working_dir) chpwd_functions+=(chpwd_last_working_dir)
chpwd_last_working_dir() { chpwd_last_working_dir() {
local cache_file="$ZSH_CACHE_DIR/last-working-dir" if [ "$ZSH_SUBSHELL" = 0 ]; then
pwd >| "$cache_file" local cache_file="$ZSH_CACHE_DIR/last-working-dir"
pwd >| "$cache_file"
fi
} }
# Changes directory to the last working directory # Changes directory to the last working directory
......
#compdef lein
# Lein ZSH completion function
# Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions)
# and rename it _lein
_lein() {
if (( CURRENT > 2 )); then
# shift words so _arguments doesn't have to be concerned with second command
(( CURRENT-- ))
shift words
# use _call_function here in case it doesn't exist
_call_function 1 _lein_${words[1]}
else
_values "lein command" \
"change[Rewrite project.clj by applying a function.]" \
"check[Check syntax and warn on reflection.]" \
"classpath[Print the classpath of the current project.]" \
"clean[Remove all files from project's target-path.]" \
"compile[Compile Clojure source into .class files.]" \
"deploy[Build and deploy jar to remote repository.]" \
"deps[Download all dependencies.]" \
"do[Higher-order task to perform other tasks in succession.]" \
"help[Display a list of tasks or help for a given task.]" \
"install[Install the current project to the local repository.]" \
"jar[Package up all the project's files into a jar file.]" \
"javac[Compile Java source files.]" \
"new[Generate project scaffolding based on a template.]" \
"plugin[DEPRECATED. Please use the :user profile instead.]" \
"pom[Write a pom.xml file to disk for Maven interoperability.]" \
"release[Perform :release-tasks.]" \
"repl[Start a repl session either with the current project or standalone.]" \
"retest[Run only the test namespaces which failed last time around.]" \
"run[Run a -main function with optional command-line arguments.]" \
"search[Search remote maven repositories for matching jars.]" \
"show-profiles[List all available profiles or display one if given an argument.]" \
"test[Run the project's tests.]" \
"trampoline[Run a task without nesting the project's JVM inside Leiningen's.]" \
"uberjar[Package up the project files and dependencies into a jar file.]" \
"update-in[Perform arbitrary transformations on your project map.]" \
"upgrade[Upgrade Leiningen to specified version or latest stable.]" \
"vcs[Interact with the version control system.]" \
"version[Print version for Leiningen and the current JVM.]" \
"with-profile[Apply the given task with the profile(s) specified.]"
fi
}
_lein_plugin() {
_values "lein plugin commands" \
"install[Download, package, and install plugin jarfile into ~/.lein/plugins]" \
"uninstall[Delete the plugin jarfile: \[GROUP/\]ARTIFACT-ID VERSION]"
}
_lein_namespaces() {
if [ -f "./project.clj" -a -d "$1" ]; then
_values "lein valid namespaces" \
$(find "$1" -type f -name "*.clj" -exec awk '/^\(ns */ {gsub("\\)", "", $2); print $2}' '{}' '+')
fi
}
_lein_run() {
_lein_namespaces "src/"
}
_lein_test() {
_lein_namespaces "test/"
}
function _lein_commands() {
local ret=1 state
_arguments ':subcommand:->subcommand' && ret=0
case $state in
subcommand)
subcommands=(
"classpath:print the classpath of the current project"
"clean:remove compiled files and dependencies from project"
"compile:ahead-of-time compile the project"
"deploy:build jar and deploy to remote repository"
"deps:download and install all dependencies"
"help:display a list of tasks or help for a given task"
"install:install the project and its dependencies in your local repository"
"int:enter an interactive task shell"
"interactive:enter an interactive task shell"
"jack-in:jack in to a clojure slime session from emacs."
"jar:create a jar file containing the compiled .class files"
"javac:compile java source files"
"new:create a new project skeleton"
"plugin:manage user-level plugins"
"pom:write a pom.xml file to disk for maven interop"
"repl:start a repl session either with the current project or standalone"
"retest:run only the test namespaces which failed last time around"
"run:run the project's -main function"
"search:search remote maven repositories for matching jars"
"swank:launch swank server for Emacs to connect"
"test:run the project's tests"
"test!:run a project's tests after cleaning and fetching dependencies"
"trampoline:run a task without nesting the project's JVM inside Leiningen's."
"uberjar:Create a jar including the contents of each of deps"
"upgrade:upgrade leiningen to the latest stable release"
"version:print leiningen's version"
)
_describe -t subcommands 'leiningen subcommands' subcommands && ret=0
;;
*) _files
esac
return ret
}
compdef _lein_commands lein
# To use: add a .lighthouse file into your directory with the URL to the # To use: add a .lighthouse file into your directory with the URL to the
# individual project. For example: # individual project. For example:
# https://rails.lighthouseapp.com/projects/8994 # https://rails.lighthouseapp.com/projects/8994
# Example usage: http://screencast.com/t/ZDgwNDUwNT # Example usage: https://screencast.com/t/ZDgwNDUwNT
open_lighthouse_ticket () { open_lighthouse_ticket () {
if [ ! -f .lighthouse-url ]; then if [ ! -f .lighthouse-url ]; then
echo "There is no .lighthouse-url file in the current directory..." echo "There is no .lighthouse-url file in the current directory..."
......
# lol
Plugin for adding catspeak aliases, because why not
## Enabling the plugin
1. Open your `.zshrc` file and add `lol` in the plugins section:
```zsh
plugins=(
# all your enabled plugins
lol
)
```
2. Reload the source file or restart your Terminal session:
```console
$ source ~/.zshrc
$
```
## Aliases
| Alias | Command |
| ------------ | ---------------------------------------------------------------- |
| `:3` | `echo` |
| `alwayz` | `tail -f` |
| `bringz` | `git pull` |
| `btw` | `nice` |
| `byes` | `exit` |
| `chicken` | `git add` |
| `cya` | `reboot` |
| `donotwant` | `rm` |
| `dowant` | `cp` |
| `gimmeh` | `touch` |
| `gtfo` | `mv` |
| `hackzor` | `git init` |
| `hai` | `cd` |
| `icanhas` | `mkdir` |
| `ihasbucket` | `df -h` |
| `iminurbase` | `finger` |
| `inur` | `locate` |
| `invisible` | `cat` |
| `iz` | `ls` |
| `kthxbai` | `halt` |
| `letcat` | `git checkout` |
| `moar` | `more` |
| `nomnom` | `killall` |
| `nomz` | `ps aux` |
| `nowai` | `chmod` |
| `oanward` | `git commit -m` |
| `obtw` | `nohup` |
| `onoz` | `cat /var/log/errors.log` |
| `ooanward` | `git commit -am` |
| `plz` | `pwd` |
| `pwned` | `ssh` |
| `rtfm` | `man` |
| `rulz` | `git push` |
| `tldr` | `less` |
| `violenz` | `git rebase` |
| `visible` | `echo` |
| `wtf` | `dmesg` |
| `yolo` | `git commit -m "$(curl -s https://whatthecommit.com/index.txt)"` |
## Usage Examples
```sh
# mkdir new-directory
icanhas new-directory
# killall firefox
nomnom firefox
# chmod u=r,go= some.file
nowai u=r,go= some.file
# ssh root@catserver.org
pwned root@catserver.org
# git commit -m "$(curl -s https://whatthecommit.com/index.txt)"
yolo
```
# LOL!!1 # LOL!!1
# Source: http://aur.archlinux.org/packages/lolbash/lolbash/lolbash.sh # Source: https://aur.archlinux.org/packages/lolbash/lolbash/lolbash.sh
alias wtf='dmesg' alias wtf='dmesg'
alias onoz='cat /var/log/errors.log' alias onoz='cat /var/log/errors.log'
...@@ -45,6 +45,7 @@ alias bringz='git pull' ...@@ -45,6 +45,7 @@ alias bringz='git pull'
alias chicken='git add' alias chicken='git add'
alias oanward='git commit -m' alias oanward='git commit -m'
alias ooanward='git commit -am' alias ooanward='git commit -am'
alias yolo='git commit -m "$(curl -s https://whatthecommit.com/index.txt)"'
alias letcat='git checkout' alias letcat='git checkout'
alias violenz='git rebase' alias violenz='git rebase'
# Macports plugin
This plugin adds completion for the package manager [Macports](https://macports.com/),
as well as some aliases for common Macports commands.
To use it, add `macports` to the plugins array in your zshrc file:
```zsh
plugins=(... macports)
```
## Aliases
| Alias | Command | Description |
|-------|------------------------------------|--------------------------------------------------------------|
| pc | `sudo port clean --all installed` | Clean up intermediate installation files for installed ports |
| pi | `sudo port install` | Install package given as argument |
| psu | `sudo port selfupdate` | Update ports tree with MacPorts repository |
| puni | `sudo port uninstall inactive` | Uninstall inactive ports |
| puo | `sudo port upgrade outdated` | Upgrade ports with newer versions available |
| pup | `psu && puo` | Update ports tree, then upgrade ports to newest versions |
#Aliases
alias pc="sudo port clean --all installed" alias pc="sudo port clean --all installed"
alias pi="sudo port install $1" alias pi="sudo port install"
alias psu="sudo port selfupdate" alias psu="sudo port selfupdate"
alias puni="sudo port uninstall inactive" alias puni="sudo port uninstall inactive"
alias puo="sudo port upgrade outdated" alias puo="sudo port upgrade outdated"
alias pup="psu && puo" alias pup="psu && puo"
## Magic Enter
**Maintainer:** [@dufferzafar](https://github.com/dufferzafar)
Makes your enter key magical, by binding commonly used commands to it.
You can set the commands to be run in your .zshrc, before the line containing plugins!
```bash
MAGIC_ENTER_GIT_COMMAND='git status -u .'
MAGIC_ENTER_OTHER_COMMAND='ls -lh .'
plugins=(magic-enter)
```
# Bind quick stuff to enter!
#
# Pressing enter in a git directory runs `git status`
# in other directories `ls`
magic-enter () {
# If commands are not already set, use the defaults
[ -z "$MAGIC_ENTER_GIT_COMMAND" ] && MAGIC_ENTER_GIT_COMMAND="git status -u ."
[ -z "$MAGIC_ENTER_OTHER_COMMAND" ] && MAGIC_ENTER_OTHER_COMMAND="ls -lh ."
if [[ -z $BUFFER ]]; then
echo ""
if git rev-parse --is-inside-work-tree &>/dev/null; then
eval "$MAGIC_ENTER_GIT_COMMAND"
else
eval "$MAGIC_ENTER_OTHER_COMMAND"
fi
zle redisplay
else
zle accept-line
fi
}
zle -N magic-enter
bindkey "^M" magic-enter
# Man plugin
This plugin adds a shortcut to insert man before the previous command.
To use it, add `man` to the plugins array in your zshrc file:
```zsh
plugins=(... man)
```
# Keyboard Shortcuts
| Shortcut | Description |
|-----------------------------------|------------------------------------------------------------------------|
| <kbd>Esc</kbd> + man | add man before the previous command to see the manual for this command |
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# * Jerry Ling<jerryling315@gmail.com> # * Jerry Ling<jerryling315@gmail.com>
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Usgae # Usage
# ----- # -----
# #
# man will be inserted before the command # man will be inserted before the command
...@@ -24,4 +24,4 @@ bindkey "\e"man man-command-line ...@@ -24,4 +24,4 @@ bindkey "\e"man man-command-line
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Also, you might want to use man-preview included in 'osx' plugin # Also, you might want to use man-preview included in 'osx' plugin
# just substitute "man" in the function with "man-preview" after you included OS X in # just substitute "man" in the function with "man-preview" after you included OS X in
# the .zshrc # the .zshrc
\ No newline at end of file
# Mercurial # Mercurial
alias hga='hg add'
alias hgc='hg commit' alias hgc='hg commit'
alias hgb='hg branch' alias hgb='hg branch'
alias hgba='hg branches' alias hgba='hg branches'
......
...@@ -13,19 +13,38 @@ _meteor_installed_packages() { ...@@ -13,19 +13,38 @@ _meteor_installed_packages() {
local -a _1st_arguments local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'run:[Default] Run this project in local development mode' "add-platform:Add a platform to this project."
'create:Create a new project' "add:Add a package to this project."
'update:Upgrade this project to the latest version of Meteor' "admin:Administrative commands."
'add:Add a package to this project' "authorized:View or change authorized users and organizations for a site."
'remove:Remove a package from this project' "build:Build this project for all platforms."
'list:List available packages' "claim:Claim a site deployed with an old Meteor version."
'help:Display Meteor help' "configure-android:Run the Android configuration tool from Meteor's ADK environment."
'bundle:Pack this project up into a tarball' "create:Create a new project."
'mongo:Connect to the Mongo database for the specified site' "debug:Run the project, but suspend the server process for debugging."
'deploy:Deploy this project to Meteor' "deploy:Deploy this project to Meteor."
'logs:Show logs for specified site' "install-sdk:Installs SDKs for a platform."
'reset:Reset the project state. Erases the local database.' "lint:Build this project and run the linters printing all errors and warnings."
'test-packages:Test one or more packages' "list-platforms:List the platforms added to your project."
"list-sites:List sites for which you are authorized."
"list:List the packages explicitly used by your project."
"login:Log in to your Meteor developer account."
"logout:Log out of your Meteor developer account."
"logs:Show logs for specified site."
"mongo:Connect to the Mongo database for the specified site."
"publish-for-arch:Builds an already-published package for a new platform."
"publish-release:Publish a new meteor release to the package server."
"publish:Publish a new version of a package to the package server."
"remove-platform:Remove a platform from this project."
"remove:Remove a package from this project."
"reset:Reset the project state. Erases the local database."
"run:[default] Run this project in local development mode."
"search:Search through the package server database."
"shell:Launch a Node REPL for interactively evaluating server-side code."
"show:Show detailed information about a release or package."
"test-packages:Test one or more packages."
"update:Upgrade this project's dependencies to their latest versions."
"whoami:Prints the username of your Meteor developer account."
) )
local expl local expl
...@@ -45,4 +64,4 @@ case "$words[2]" in ...@@ -45,4 +64,4 @@ case "$words[2]" in
add) add)
_meteor_all_packages _meteor_all_packages
_wanted packages expl 'all packages' compadd -a packages ;; _wanted packages expl 'all packages' compadd -a packages ;;
esac esac
\ No newline at end of file
# minikube
This plugin provides completion for [minikube](https://github.com/kubernetes/minikube).
To use it, add `minikube` to the plugins array in your zshrc file.
```
plugins=(... minikube)
```
# Autocompletion for Minikube.
#
if [ $commands[minikube] ]; then
source <(minikube completion zsh)
fi
...@@ -8,7 +8,7 @@ to update cache you should remove .mix_tasks file ...@@ -8,7 +8,7 @@ to update cache you should remove .mix_tasks file
Inspired by and based on rake-fast zsh plugin. Inspired by and based on rake-fast zsh plugin.
This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/), which is inspired by [this Ruby on Rails trick from 2006](http://weblog.rubyonrails.org/2006/3/9/fast-mix-task-completion-for-zsh/). This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/), which is inspired by [this Ruby on Rails trick from 2006](https://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh/).
## Installation ## Installation
...@@ -25,4 +25,4 @@ You might consider adding `.mix_tasks` to your [global .gitignore](https://help. ...@@ -25,4 +25,4 @@ You might consider adding `.mix_tasks` to your [global .gitignore](https://help.
`mix`, then press tab `mix`, then press tab
Currently maintained by [styx](https://github.com/styx/) Currently maintained by [styx](https://github.com/styx/)
\ No newline at end of file
...@@ -12,7 +12,7 @@ _mix_does_task_list_need_generating () { ...@@ -12,7 +12,7 @@ _mix_does_task_list_need_generating () {
} }
_mix_generate () { _mix_generate () {
mix --help | grep -v 'iex -S' | tail -n +2 | cut -d " " -f 2 > .mix_tasks mix help | grep -v 'iex -S' | tail -n +2 | cut -d " " -f 2 > .mix_tasks
} }
_mix () { _mix () {
......
# Mix plugin
This plugin adds completions for the [Elixir's Mix build tool](https://hexdocs.pm/mix/Mix.html).
To use it, add `mix` to the plugins array in your zshrc file:
```zsh
plugins=(... mix)
```
## Supported Task Types
| Task Type | Documentation |
|-------------------------|----------------------------------------------------------|
| Elixir | [Elixir Lang](https://elixir-lang.org/) |
| Phoenix v1.2.1 and below| [Phoenix](https://hexdocs.pm/phoenix/1.2.1/Phoenix.html) |
| Phoenix v1.3.0 and above| [Phoenix](https://hexdocs.pm/phoenix/Phoenix.html) |
| Ecto | [Ecto](https://hexdocs.pm/ecto/Ecto.html) |
| Hex | [Hex](https://hex.pm/) |
| Nerves | [Nerves](https://nerves-project.org/) |
...@@ -21,7 +21,19 @@ _1st_arguments=( ...@@ -21,7 +21,19 @@ _1st_arguments=(
'deps.unlock:Unlock the given dependencies' 'deps.unlock:Unlock the given dependencies'
'deps.update:Update the given dependencies' 'deps.update:Update the given dependencies'
'do:Executes the tasks separated by comma' 'do:Executes the tasks separated by comma'
'ecto.create:Create Ecto database'
'ecto.drop:Drop the storage for the given repository'
'ecto.dump:Dumps the current environment’s database structure'
'ecto.gen.migration:Generates a migration'
'ecto.gen.repo:Generates a new repository'
'ecto.load:Loads the current environment’s database structure'
'ecto.migrate:Runs Ecto migration'
'ecto.migrations:Displays the up / down migration status'
'ecto.rollback:Reverts applied migrations'
'escript.build:Builds an escript for the project' 'escript.build:Builds an escript for the project'
'firmware:Nerves - Build a firmware image for the selected target platform'
'firmware.burn:Nerves - Writes the generated firmware image to an attached SDCard or file'
'firmware.image:Nerves - Create a firmware image file that can be copied byte-for-byte'
'help:Print help information for tasks' 'help:Print help information for tasks'
'hex:Print hex help information' 'hex:Print hex help information'
'hex.config:Read or update hex config' 'hex.config:Read or update hex config'
...@@ -39,6 +51,11 @@ _1st_arguments=( ...@@ -39,6 +51,11 @@ _1st_arguments=(
'local.phoenix:Updates Phoenix locally' 'local.phoenix:Updates Phoenix locally'
'local.phx:Updates the Phoenix project generator locally' 'local.phx:Updates the Phoenix project generator locally'
'local.rebar:Install rebar locally' 'local.rebar:Install rebar locally'
'nerves.artifact:Create an artifact for a specified Nerves package'
'nerves.artifact.get:Nerves get artifacts'
'nerves.info:Prints Nerves system information'
'nerves.new:Create a new Nerves application'
'nerves.release.init:Prepare a new Nerves project for use with releases'
'new:Create a new Elixir project' 'new:Create a new Elixir project'
'phoenix.digest:Digests and compress static files' 'phoenix.digest:Digests and compress static files'
'phoenix.gen.channel:Generates a Phoenix channel' 'phoenix.gen.channel:Generates a Phoenix channel'
......
# Mosh Plugin
This plugin allows SSH tab completion for [mosh](https://mosh.org/) hostnames.
To use it, add `mosh` to the plugins array in your zshrc file:
```
plugins=(... mosh)
```
...@@ -20,6 +20,15 @@ BACKGROUND_CYAN=$(tput setab 6) ...@@ -20,6 +20,15 @@ BACKGROUND_CYAN=$(tput setab 6)
BACKGROUND_WHITE=$(tput setab 7) BACKGROUND_WHITE=$(tput setab 7)
RESET_FORMATTING=$(tput sgr0) RESET_FORMATTING=$(tput sgr0)
# if found an executable ./mvnw file execute it otherwise execute orignal mvn
mvn-or-mvnw() {
if [ -x ./mvnw ] ; then
echo "executing mvnw instead of mvn"
./mvnw "$@";
else
mvn "$@";
fi
}
# Wrapper function for Maven's mvn command. # Wrapper function for Maven's mvn command.
mvn-color() { mvn-color() {
...@@ -40,6 +49,9 @@ mvn-color() { ...@@ -40,6 +49,9 @@ mvn-color() {
# Override the mvn command with the colorized one. # Override the mvn command with the colorized one.
#alias mvn="mvn-color" #alias mvn="mvn-color"
# either use orignal mvn oder the mvn wrapper
alias mvn="mvn-or-mvnw"
# aliases # aliases
alias mvncie='mvn clean install eclipse:eclipse' alias mvncie='mvn clean install eclipse:eclipse'
alias mvnci='mvn clean install' alias mvnci='mvn clean install'
...@@ -59,11 +71,13 @@ alias mvn-updates='mvn versions:display-dependency-updates' ...@@ -59,11 +71,13 @@ alias mvn-updates='mvn versions:display-dependency-updates'
alias mvntc7='mvn tomcat7:run' alias mvntc7='mvn tomcat7:run'
alias mvntc='mvn tomcat:run' alias mvntc='mvn tomcat:run'
alias mvnjetty='mvn jetty:run' alias mvnjetty='mvn jetty:run'
alias mvnboot='mvn spring-boot:run'
alias mvndt='mvn dependency:tree' alias mvndt='mvn dependency:tree'
alias mvns='mvn site' alias mvns='mvn site'
alias mvnsrc='mvn dependency:sources' alias mvnsrc='mvn dependency:sources'
alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc'
function listMavenCompletions { function listMavenCompletions {
reply=( reply=(
# common lifecycle # common lifecycle
...@@ -274,3 +288,5 @@ function listMavenCompletions { ...@@ -274,3 +288,5 @@ function listMavenCompletions {
} }
compctl -K listMavenCompletions mvn compctl -K listMavenCompletions mvn
compctl -K listMavenCompletions mvn-or-mvnw
File mode changed from 100755 to 100644
# Nanoc plugin
This plugin adds some aliases and autocompletion for common [Nanoc](https://nanoc.ws) commands.
To use it, add `nanoc` to the plugins array in your zshrc file:
```zsh
plugins=(... nanoc)
```
## Aliases
| Alias | Command | Description |
|-------|-----------------------|-----------------------------------------------------------------------------------|
| n | `nanoc` | Main Nanoc command |
| nco | `nanoc compile` | Compile all items of the current site |
| ncs | `nanoc create-site` | Create a new site at the given path. The site will use the filesystem data source |
| nd | `nanoc deploy` | Deploy the compiled site to the destination (specified with `--target`) |
| np | `nanoc prune` | Remove files not managed by Nanoc from the output directory |
| nv | `nanoc view` | Start the static web server (on port 3000 and all IP addresses, unless specified) |
#compdef nanoc #compdef nanoc
#autoload #autoload
# nanoc zsh completion - based on the homebrew zsh completion
# requires the 'nanoc' gem to be installed # requires the 'nanoc' gem to be installed
local -a _1st_arguments local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'autocompile:start the autocompiler' 'check:run issue checks'
'compile:compile items of this site' 'compile:compile items of this site'
'create-item:create an item'
'create-layout:create a layout'
'create-site:create a site' 'create-site:create a site'
'deploy:deploy the compiled site' 'deploy:deploy the compiled site'
'help:show help' 'help:show help'
'prune:remove files not managed by nanoc from the output directory' 'prune:remove files not managed by nanoc from the output directory'
'shell:open a shell on the Nanoc environment'
'show-data:show data in this site' 'show-data:show data in this site'
'show-plugins:show all available plugins' 'show-plugins:show all available plugins'
'show-rules:describe the rules for each item' 'show-rules:describe the rules for each item'
'update:update the data stored by the data source to a newer version'
'validate-css:validate the site’s CSS'
'validate-html:validate the site’s HTML'
'validate-links:validate links in site'
'view:start the web server that serves static files' 'view:start the web server that serves static files'
'watch:start the watcher'
) )
local expl local expl
...@@ -31,13 +24,68 @@ local -a pkgs installed_pkgs ...@@ -31,13 +24,68 @@ local -a pkgs installed_pkgs
_arguments \ _arguments \
'(--color)--color[enable color]' \ '(--color)--color[enable color]' \
'(--debug)--debug[enable debugging]' \ '(--debug)--debug[enable debugging]' \
'(--env)--env[set environment]' \
'(--help)--help[show the help message and quit]' \ '(--help)--help[show the help message and quit]' \
'(--no-color)--no-color[disable color]' \ '(--no-color)--no-color[disable color]' \
'(--verbose)--verbose[make nanoc output more detailed]' \ '(--verbose)--verbose[make output more detailed]' \
'(--version)--version[show version information and quit]' \ '(--version)--version[show version information and quit]' \
'(--warn)--warn[enable warnings]' \ '(--warn)--warn[enable warnings]' \
'*:: :->subcmds' && return 0 '*:: :->subcmds' && return 0
case "$state" in
subcmds)
case $words[1] in
check)
_arguments \
'(--preprocess)--preprocess[run preprocessor]'
;;
compile)
_arguments \
'(--diff)--diff[generate diff]'
;;
compile)
_arguments \
'(--diff)--diff[generate diff]'
;;
create-site)
_arguments \
'(--force)--force[force creation of new site]'
;;
deploy)
_arguments \
'(--target)--target[specify the location to deploy to (default: `default`)]' \
'(--no-check)--no-check[do not run the issue checks marked for deployment]' \
'(--list)--list[list available locations to deploy to]' \
'(--list-deployers)--list-deployers[list available deployers]' \
'(--dry-run)--dry-run[show what would be deployed]'
;;
prune)
_arguments \
'(--yes)--yes[confirm deletion]' \
'(--dry-run)--dry-run[print files to be deleted instead of actually deleting them]'
;;
shell)
_arguments \
'(--preprocess)--preprocess[run preprocessor]'
;;
view)
_arguments \
'(--handler)--handler[specify the handler to use (webrick/mongrel/...)]' \
'(--host)--host[specify the host to listen on (default: 127.0.0.1)]' \
'(--port)--port[specify the port to listen on (default: 3000]' \
'(--live-reload)--live-reload[reload on changes]'
;;
esac
;;
esac
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then
_describe -t commands "nanoc subcommand" _1st_arguments _describe -t commands "nanoc subcommand" _1st_arguments
return return
......
alias n='nanoc' alias n='nanoc'
alias na='nanoc autocompile'
alias nco='nanoc compile' alias nco='nanoc compile'
alias nci='nanoc create_item' alias ncs='nanoc create-site'
alias ncl='nanoc create_layout'
alias ncs='nanoc create_site'
alias nd='nanoc deploy' alias nd='nanoc deploy'
alias np='nanoc prune'
alias nv='nanoc view' alias nv='nanoc view'
alias nw='nanoc watch'
ng_opts='addon asset-sizes b build completion d destroy doc e2e g generate get github-pages:deploy gh-pages:deploy h help i init install lint make-this-awesome new s serve server set t test v version -h --help' ng_opts='addon asset-sizes b build completion d destroy doc e2e g generate get github-pages:deploy gh-pages:deploy h help i init install lint make-this-awesome new s serve server set t test update v version -h --help'
_ng_completion () { _ng_completion () {
local words cword opts local words cword opts
...@@ -55,6 +55,10 @@ _ng_completion () { ...@@ -55,6 +55,10 @@ _ng_completion () {
t | test ) t | test )
opts='--browsers --colors --config-file --environment --filter --host --launch --log-level --module --path --port --query --reporter --server --silent --test-page --test-port --watch -H -c -cf -e -f -m -r -s -tp -w' opts='--browsers --colors --config-file --environment --filter --host --launch --log-level --module --path --port --query --reporter --server --silent --test-page --test-port --watch -H -c -cf -e -f -m -r -s -tp -w'
;; ;;
update )
opts='--all --dryRun --force --from --migrate-only --next --registry --to -d'
;;
v | version ) v | version )
opts='--verbose' opts='--verbose'
......
...@@ -13,20 +13,20 @@ ...@@ -13,20 +13,20 @@
# -O - enable OS detection # -O - enable OS detection
# -sA - TCP ACK scan # -sA - TCP ACK scan
# -F - fast scan # -F - fast scan
# --script=vulscan - also access vulnerabilities in target # --script=vuln - also access vulnerabilities in target
alias nmap_open_ports="nmap --open" alias nmap_open_ports="nmap --open"
alias nmap_list_interfaces="nmap --iflist" alias nmap_list_interfaces="nmap --iflist"
alias nmap_slow="nmap -sS -v -T1" alias nmap_slow="sudo nmap -sS -v -T1"
alias nmap_fin="nmap -sF -v" alias nmap_fin="sudo nmap -sF -v"
alias nmap_full="nmap -sS -T4 -PE -PP -PS80,443 -PY -g 53 -A -p1-65535 -v" alias nmap_full="sudo nmap -sS -T4 -PE -PP -PS80,443 -PY -g 53 -A -p1-65535 -v"
alias nmap_check_for_firewall="nmap -sA -p1-65535 -v -T4" alias nmap_check_for_firewall="sudo nmap -sA -p1-65535 -v -T4"
alias nmap_ping_through_firewall="nmap -PS -PA" alias nmap_ping_through_firewall="nmap -PS -PA"
alias nmap_fast="nmap -F -T5 --version-light --top-ports 300" alias nmap_fast="nmap -F -T5 --version-light --top-ports 300"
alias nmap_detect_versions="nmap -sV -p1-65535 -O --osscan-guess -T4 -Pn" alias nmap_detect_versions="sudo nmap -sV -p1-65535 -O --osscan-guess -T4 -Pn"
alias nmap_check_for_vulns="nmap --script=vulscan" alias nmap_check_for_vulns="nmap --script=vuln"
alias nmap_full_udp="nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443,3389 " alias nmap_full_udp="sudo nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443,3389 "
alias nmap_traceroute="nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute " alias nmap_traceroute="sudo nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute "
alias nmap_full_with_scripts="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all " alias nmap_full_with_scripts="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all "
alias nmap_web_safe_osscan="sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy " alias nmap_web_safe_osscan="sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy "
# node plugin
To use it, add `node` to the plugins array of your zshrc file:
```zsh
plugins=(... node)
```
This plugin adds `node-docs` function that open specific section in [Node.js](https://nodejs.org) documentation (depending on the installed version).
For example:
```zsh
# Opens https://nodejs.org/docs/latest-v10.x/api/fs.html
$ node-docs fs
# Opens https://nodejs.org/docs/latest-v10.x/api/path.html
$ node-docs path
```
## npm plugin
The npm plugin provides completion as well as adding many useful aliases.
To use it, add npm to the plugins array of your zshrc file:
```
plugins=(... npm)
```
## Aliases
| Alias | Command | Descripton |
|:------ |:-----------------------------|:----------------------------------------------------------------|
| `npmg` | `npm i -g` | Install dependencies globally |
| `npmS` | `npm i -S` | Install and save to dependencies in your package.json |
| `npmD` | `npm i -D` | Install and save to dev-dependencies in your package.json |
| `npmE` | `PATH="$(npm bin)":"$PATH"` | Run command from node_modules folder based on current directory |
| `npmO` | `npm outdated` | Check which npm modules are outdated |
| `npmV` | `npm -v` | Check package versions |
| `npmL` | `npm list` | List installed packages |
| `npmL0` | `npm ls --depth=0` | List top-level installed packages |
| `npmst` | `npm start` | Run npm start |
| `npmt` | `npm test` | Run npm test |
| `npmR` | `npm run` | Run npm scripts |
| `npmP` | `npm publish` | Run npm publish |
| `npmI` | `npm init` | Run npm init |
(( $+commands[npm] )) && { (( $+commands[npm] )) && {
__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion" __NPM_COMPLETION_FILE="${ZSH_CACHE_DIR:-$ZSH/cache}/npm_completion"
if [[ ! -f $__NPM_COMPLETION_FILE ]]; then if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
npm completion >! $__NPM_COMPLETION_FILE 2>/dev/null npm completion >! $__NPM_COMPLETION_FILE 2>/dev/null
...@@ -51,4 +51,7 @@ alias npmt="npm test" ...@@ -51,4 +51,7 @@ alias npmt="npm test"
alias npmR="npm run" alias npmR="npm run"
# Run npm publish # Run npm publish
alias npmP="npm publish" alias npmP="npm publish"
\ No newline at end of file
# Run npm init
alias npmI="npm init"
...@@ -11,7 +11,21 @@ This plugin automatically registers npx command-not-found handler if `npx` exist ...@@ -11,7 +11,21 @@ This plugin automatically registers npx command-not-found handler if `npx` exist
plugins=(.... npx) plugins=(.... npx)
``` ```
- Globally install npx binary (you need node.js installed too!) - Globally install npx binary (npx will be auto installed with recent versions of Node.js)
```bash ```bash
sudo npm install -g npx sudo npm install -g npx
``` ```
\ No newline at end of file
## Note
The shell auto-fallback doesn't auto-install plain packages. In order to get it to install something, you need to add `@`:
```
➜ jasmine@latest # or just `jasmine@`
npx: installed 13 in 1.896s
Randomized with seed 54385
Started
```
It does it this way so folks using the fallback don't accidentally try to install regular typoes.
# nvm plugin
This plugin adds autocompletions for [nvm](https://github.com/creationix/nvm) — a Node.js version manager.
It also automatically sources nvm, so you don't need to do it manually in your `.zshrc`.
To use it, add `nvm` to the plugins array of your zshrc file:
```zsh
plugins=(... nvm)
```
...@@ -6,16 +6,23 @@ ...@@ -6,16 +6,23 @@
local -a _1st_arguments local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'help:show help' 'help:show help'
'install:download and install a version' '--version:print out the latest released version of nvm'
'install:download and install a version in <node|iojs|node version number>'
'uninstall:uninstall a version' 'uninstall:uninstall a version'
'use:modify PATH to use version' 'use:modify PATH to use <version>. Uses .nvmrc if available'
'run:run version with given arguments' 'exec:run <command> on <version>. Uses .nvmrc if available'
'run:run `node` on <version> with <args> as arguments. Uses .nvmrc if available'
'current:list installed versions'
'ls:list installed versions or versions matching a given description' 'ls:list installed versions or versions matching a given description'
'version:resolve the given description to a single local version'
'version-remote:resolve the given description to a single remote version'
'ls-remote:list remote versions available for install' 'ls-remote:list remote versions available for install'
'deactivate:undo effects of NVM on current shell' 'deactivate:undo effects of `nvm` on current shell'
'alias:show or set aliases' 'alias:show or set aliases'
'unalias:deletes an alias' 'unalias:deletes an alias'
'copy-packages:install global NPM packages to current version' 'reinstall-packages:reinstall global `npm` packages contained in <version> to current version'
'unload:unload `nvm` from shell'
'which:display path to installed node version. Uses .nvmrc if available'
) )
_arguments -C '*:: :->subcmds' && return 0 _arguments -C '*:: :->subcmds' && return 0
...@@ -23,4 +30,4 @@ _arguments -C '*:: :->subcmds' && return 0 ...@@ -23,4 +30,4 @@ _arguments -C '*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then
_describe -t commands "nvm subcommand" _1st_arguments _describe -t commands "nvm subcommand" _1st_arguments
return return
fi fi
\ No newline at end of file
# Nyan plugin
This plugin adds a command to display [Nyan Cat](https://en.wikipedia.org/wiki/Nyan_Cat) right inside your terminal.
**Plugin is deprecated**. Check [official repo](https://github.com/klange/nyancat) for more information.
\ No newline at end of file
if [[ -x `which nc` ]]; then print -Pn '%F{yellow}'
alias nyan='nc -v nyancat.dakko.us 23' # nyan cat cat >&2 <<-EOD
fi nyan plugin:
The nyancat server used by this plugin was shut down due to increased
bandwidth costs, so the nyan plugin no longer works. You can get the
same functionality in some distributions by installing the nyancat package,
or you can compile it yourself.
See https://github.com/klange/nyancat for more information.
EOD
print -Pn '%f'
...@@ -42,19 +42,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ...@@ -42,19 +42,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## Commands ## Commands
| Command | Description | | Command | Description |
| :-------------- | :----------------------------------------------- | | :-------------- | :-------------------------------------------------- |
| `tab` | Open the current directory in a new tab | | `tab` | Open the current directory in a new tab |
| `split_tab` | Split the current terminal tab horizontally | | `split_tab` | Split the current terminal tab horizontally |
| `vsplit_tab` | Split the current terminal tab vertically | | `vsplit_tab` | Split the current terminal tab vertically |
| `ofd` | Open the current directory in a Finder window | | `ofd` | Open the current directory in a Finder window |
| `pfd` | Return the path of the frontmost Finder window | | `pfd` | Return the path of the frontmost Finder window |
| `pfs` | Return the current Finder selection | | `pfs` | Return the current Finder selection |
| `cdf` | `cd` to the current Finder directory | | `cdf` | `cd` to the current Finder directory |
| `pushdf` | `pushd` to the current Finder directory | | `pushdf` | `pushd` to the current Finder directory |
| `quick-look` | Quick-Look a specified file | | `quick-look` | Quick-Look a specified file |
| `man-preview` | Open a specified man page in Preview app | | `man-preview` | Open a specified man page in Preview app |
| `showfiles` | Show hidden files | | `showfiles` | Show hidden files |
| `hidefiles` | Hide the hidden files | | `hidefiles` | Hide the hidden files |
| `itunes` | Control iTunes. User `itunes -h` for usage details | | `itunes` | Control iTunes. Use `itunes -h` for usage details |
| `spotify` | Control Spotify and search by artist, album, track and etc.| | `spotify` | Control Spotify and search by artist, album, track… |
| `rmdsstore` | Remove .DS\_Store files recursively in a directory |
...@@ -209,7 +209,7 @@ if [[ ! -z "$playlist" ]]; then ...@@ -209,7 +209,7 @@ if [[ ! -z "$playlist" ]]; then
opt="play" opt="play"
else else
opt="stop" opt="stop"
fi fi
else else
opt="set allPlaylists to (get name of every playlist)" opt="set allPlaylists to (get name of every playlist)"
fi fi
...@@ -241,7 +241,7 @@ if [[ ! -z "$playlist" ]]; then ...@@ -241,7 +241,7 @@ if [[ ! -z "$playlist" ]]; then
case "$state" in case "$state" in
on|off) on|off)
# Inspired by: http://stackoverflow.com/a/14675583 # Inspired by: https://stackoverflow.com/a/14675583
osascript 1>/dev/null 2>&1 <<-EOF osascript 1>/dev/null 2>&1 <<-EOF
tell application "System Events" to perform action "AXPress" of (menu item "${state}" of menu "Shuffle" of menu item "Shuffle" of menu "Controls" of menu bar item "Controls" of menu bar 1 of application process "iTunes" ) tell application "System Events" to perform action "AXPress" of (menu item "${state}" of menu "Shuffle" of menu item "Shuffle" of menu "Controls" of menu bar item "Controls" of menu bar 1 of application process "iTunes" )
EOF EOF
...@@ -282,3 +282,8 @@ source ${ZSH}/plugins/osx/spotify ...@@ -282,3 +282,8 @@ source ${ZSH}/plugins/osx/spotify
# Show/hide hidden files in the Finder # Show/hide hidden files in the Finder
alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
# Remove .DS_Store files recursively in a directory, default .
rmdsstore() {
find "${@:-.}" -type f -name .DS_Store -delete
}
...@@ -408,7 +408,7 @@ while [ $# -gt 0 ]; do ...@@ -408,7 +408,7 @@ while [ $# -gt 0 ]; do
uri=`osascript -e 'tell application "Spotify" to spotify url of current track'`; uri=`osascript -e 'tell application "Spotify" to spotify url of current track'`;
remove='spotify:track:' remove='spotify:track:'
url=${uri#$remove} url=${uri#$remove}
url="http://open.spotify.com/track/$url" url="https://open.spotify.com/track/$url"
if [ "$2" = "" ]; then if [ "$2" = "" ]; then
cecho "Spotify URL: $url" cecho "Spotify URL: $url"
......
...@@ -6,11 +6,17 @@ ...@@ -6,11 +6,17 @@
# Brian Mattern <rephorm@rephorm.com> # Brian Mattern <rephorm@rephorm.com>
# Jason A. Donenfeld <Jason@zx2c4.com>. # Jason A. Donenfeld <Jason@zx2c4.com>.
# All Rights Reserved. # All Rights Reserved.
#
# This file is licensed under the GPLv2+. # This file is licensed under the GPLv2+.
# Please visit http://git.zx2c4.com/password-store/tree/COPYING for more information. # Please visit https://git.zx2c4.com/password-store/tree/COPYING for more information.
# If you use multiple repositories, you can configure completion like this:
# #
# Oh my zsh plugin maintainer: Santiago Borrazás <sanbor@gmail.com> # compdef _pass workpass
# zstyle ':completion::complete:workpass::' prefix "$HOME/work/pass"
# workpass() {
# PASSWORD_STORE_DIR=$HOME/work/pass pass $@
# }
_pass () { _pass () {
...@@ -117,8 +123,9 @@ _pass_cmd_show () { ...@@ -117,8 +123,9 @@ _pass_cmd_show () {
} }
_pass_complete_entries_helper () { _pass_complete_entries_helper () {
local IFS=$'\n' local IFS=$'\n'
local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}" local prefix
_values -C 'passwords' ${$(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print 2>/dev/null | sed -e "s#${prefix}/\{0,1\}##" -e 's#\.gpg##' | sort):-""} zstyle -s ":completion:${curcontext}:" prefix prefix || prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
_values -C 'passwords' ${$(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print 2>/dev/null | sed -e "s#${prefix}/\{0,1\}##" -e 's#\.gpg##' -e 's#\\#\\\\#' | sort):-""}
} }
_pass_complete_entries_with_subdirs () { _pass_complete_entries_with_subdirs () {
......
# pep8 plugin
This plugin adds completion for [pep8](https://pep8.readthedocs.io/en/release-1.7.x/#), a tool to check your Python code against some of the style conventions in [PEP 8](http://www.python.org/dev/peps/pep-0008/).
To use it, add pep8 to the plugins array of your zshrc file:
```
plugins=(... pep8)
```
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
Per directory history for zsh, as well as global history, and the Per directory history for zsh, as well as global history, and the
ability to toggle between them with ^G. ability to toggle between them with ^G.
This is a implementation of per directory history for zsh, some This is a implementation of per directory history for zsh, some
implementations of which exist in bash[1][],[2][]. It also implements implementations of which exist in bash[1][],[2][]. It also implements
a per-directory-history-toggle-history function to change from using the a per-directory-history-toggle-history function to change from using the
directory history to using the global history. In both cases the history is directory history to using the global history. In both cases the history is
always saved to both the global history and the directory history, so the always saved to both the global history and the directory history, so the
toggle state will not effect the saved histories. Being able to switch toggle state will not effect the saved histories. Being able to switch
between global and directory histories on the fly is a novel feature as far between global and directory histories on the fly is a novel feature as far
as I am aware. as I am aware.
This is a standalone repository for the script, however it is also included in This is a standalone repository for the script, however it is also included in
...@@ -34,7 +34,7 @@ Usage ...@@ -34,7 +34,7 @@ Usage
Configuration Configuration
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
* HISTORY_BASE a global variable that defines the base directory in which the * HISTORY_BASE a global variable that defines the base directory in which the
directory histories are stored directory histories are stored
* per-directory-history-toggle-history is the function to toggle the history * per-directory-history-toggle-history is the function to toggle the history
...@@ -42,14 +42,14 @@ Configuration ...@@ -42,14 +42,14 @@ Configuration
History History
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
The idea/inspiration for a per directory history is from [Stewart MacArthur][1] The idea/inspiration for a per directory history is from [Stewart MacArthur][1]
and [Dieter][2], the implementation idea is from [Bart Schaefer][3]. The and [Dieter][2], the implementation idea is from [Bart Schaefer][3]. The
implementation is by [Jim Hester][5] in September 2012. implementation is by [Jim Hester][5] in September 2012.
[1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html [1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html
[2]: http://dieter.plaetinck.be/per_directory_bash [2]: http://dieter.plaetinck.be/per_directory_bash
[3]: http://www.zsh.org/mla/users/1997/msg00226.html [3]: https://www.zsh.org/mla/users/1997/msg00226.html
[4]: https://github.com/robbyrussell/oh-my-zsh [4]: https://github.com/robbyrussell/oh-my-zsh
[5]: http://jimhester.com [5]: http://jimhester.com
[6]: http://github.com/jimhester/per-directory-history [6]: https://github.com/jimhester/per-directory-history
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
# #
# [1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html # [1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html
# [2]: http://dieter.plaetinck.be/per_directory_bash # [2]: http://dieter.plaetinck.be/per_directory_bash
# [3]: http://www.zsh.org/mla/users/1997/msg00226.html # [3]: https://www.zsh.org/mla/users/1997/msg00226.html
# #
################################################################################ ################################################################################
# #
......
## percol
Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and [jump plugin](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh)
### Requirements
```shell
pip install percol
```
And [jump](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh) for `oh-my-zsh` is a optional requirement.
### Usage
For default
- `^-r` bind to `percol_select_history`.You can use it to grep your history with percol.
- `^-b` bind to `percol_select_marks`.You can use it to grep your bookmarks with percol.
if which percol &> /dev/null; then
function percol_select_history() {
local tac
which gtac &> /dev/null && tac="gtac" || { which tac &> /dev/null && tac="tac" || { tac="tail -r" } }
BUFFER=$(fc -l -n 1 | eval $tac | percol --query "$LBUFFER")
CURSOR=$#BUFFER
zle -R -c
}
zle -N percol_select_history
bindkey '^R' percol_select_history
if which marks &> /dev/null; then
function percol_select_marks() {
BUFFER=$(marks | percol --query "$LBUFFER" | awk '{print $3}')
CURSOR=$#BUFFER # move cursor
zle -R -c # refresh
}
zle -N percol_select_marks
bindkey '^B' percol_select_marks
fi
fi
...@@ -21,7 +21,7 @@ alias pd='perldoc' ...@@ -21,7 +21,7 @@ alias pd='perldoc'
alias ple='perl -wlne' alias ple='perl -wlne'
# show the latest stable release of Perl # show the latest stable release of Perl
alias latest-perl='curl -s http://www.perl.org/get.html | perl -wlne '\''if (/perl\-([\d\.]+)\.tar\.gz/) { print $1; exit;}'\' alias latest-perl='curl -s https://www.perl.org/get.html | perl -wlne '\''if (/perl\-([\d\.]+)\.tar\.gz/) { print $1; exit;}'\'
......
...@@ -4,6 +4,6 @@ Plugin to handle some unix filesystem permissions quickly ...@@ -4,6 +4,6 @@ Plugin to handle some unix filesystem permissions quickly
### Usage ### Usage
* `set755` recursively sets all directories located within the current working directory and sub directories to octal 755. * `set755` recursively sets all given directories (default to .) to octal 755.
* `set644` recursively sets all files located within the current working directory and sub directories to octal 644. * `set644` recursively sets all given files (default to .) to octal 644.
* `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases. * `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases.
\ No newline at end of file
...@@ -6,10 +6,14 @@ ...@@ -6,10 +6,14 @@
### Aliases ### Aliases
# Set all files' permissions to 644 recursively in a directory # Set all files' permissions to 644 recursively in a directory
alias set644='find . -type f ! -perm 644 -print0 | xargs -0 chmod 644' set644() {
find "${@:-.}" -type f ! -perm 644 -print0 | xargs -0 chmod 644
}
# Set all directories' permissions to 755 recursively in a directory # Set all directories' permissions to 755 recursively in a directory
alias set755='find . -type d ! -perm 755 -print0 | xargs -0 chmod 755' set755() {
find "${@:-.}" -type d ! -perm 755 -print0 | xargs -0 chmod 755
}
### Functions ### Functions
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# FILE: _pod # FILE: _pod
# DESCRIPTION: Cocoapods (0.33.1) autocomplete plugin for Oh-My-Zsh # DESCRIPTION: Cocoapods (0.33.1) autocomplete plugin for Oh-My-Zsh
# http://cocoapods.org # https://cocoapods.org
# Generated with `pod --completion-script # Generated with `pod --completion-script
# AUTHOR: Alexandre Joly (alexandre.joly@mekanics.ch) # AUTHOR: Alexandre Joly (alexandre.joly@mekanics.ch)
# GITHUB: https://github.com/mekanics # GITHUB: https://github.com/mekanics
......
# Postgres plugin
This plugin adds some aliases for useful Postgres commands.
:warning: this plugin works exclusively with Postgres installed via Homebrew on OSX
because Postgres paths are hardcoded to `/usr/local/var/postgres`.
To use it, add `postgres` to the plugins array in your zshrc file:
```zsh
plugins=(... postgres)
```
## Aliases
| Alias | Command | Description |
|-------------|---------------------------------------------------------------------------------|-------------------------------------------------------------|
| startpost | `pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start` | Start postgres server |
| stoppost | `pg_ctl -D /usr/local/var/postgres stop -s -m fast` | Stop postgres server |
| restartpost | `stoppost && sleep 1 && startpost` | Restart (calls stop, then start) |
| reloadpost | `pg_ctl reload -D /usr/local/var/postgres -s` | Reload postgres configuration (some setting require restart)|
| statuspost | `pg_ctl status -D /usr/local/var/postgres -s` | Check startus of postgres server (running, stopped) |
...@@ -73,7 +73,7 @@ powed(){ ...@@ -73,7 +73,7 @@ powed(){
} }
# Restart pow process # Restart pow process
# taken from http://www.matthewratzloff.com/blog/2011/12/23/restarting-pow-when-dns-stops-responding # taken from https://www.matthewratzloff.com
repow(){ repow(){
lsof | grep 20560 | awk '{print $2}' | xargs kill -9 lsof | grep 20560 | awk '{print $2}' | xargs kill -9
launchctl unload ~/Library/LaunchAgents/cx.pow.powd.plist launchctl unload ~/Library/LaunchAgents/cx.pow.powd.plist
......
_homebrew-installed() { # This plugin loads pyenv into the current shell and provides prompt info via
type brew &> /dev/null # the 'pyenv_prompt_info' function. Also loads pyenv-virtualenv if available.
}
FOUND_PYENV=$+commands[pyenv]
_pyenv-from-homebrew-installed() {
brew --prefix pyenv &> /dev/null if [[ $FOUND_PYENV -ne 1 ]]; then
} pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv")
for dir in $pyenvdirs; do
FOUND_PYENV=0 if [[ -d $dir/bin ]]; then
pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv") export PATH="$PATH:$dir/bin"
FOUND_PYENV=1
for pyenvdir in "${pyenvdirs[@]}" ; do break
if [ -d $pyenvdir/bin -a $FOUND_PYENV -eq 0 ] ; then
FOUND_PYENV=1
export PYENV_ROOT=$pyenvdir
export PATH=${pyenvdir}/bin:$PATH
eval "$(pyenv init - zsh)"
if pyenv commands | command grep -q virtualenv-init; then
eval "$(pyenv virtualenv-init - zsh)"
fi fi
done
fi
function pyenv_prompt_info() { if [[ $FOUND_PYENV -ne 1 ]]; then
echo "$(pyenv version-name)" if (( $+commands[brew] )) && dir=$(brew --prefix pyenv 2>/dev/null); then
} if [[ -d $dir/bin ]]; then
fi export PATH="$PATH:$dir/bin"
done FOUND_PYENV=1
unset pyenvdir
if [ $FOUND_PYENV -eq 0 ] ; then
pyenvdir=$(brew --prefix pyenv 2> /dev/null)
if [ $? -eq 0 -a -d $pyenvdir/bin ] ; then
FOUND_PYENV=1
export PYENV_ROOT=$pyenvdir
export PATH=${pyenvdir}/bin:$PATH
eval "$(pyenv init - zsh)"
if pyenv commands | command grep -q virtualenv-init; then
eval "$(pyenv virtualenv-init - zsh)"
fi fi
function pyenv_prompt_info() {
echo "$(pyenv version-name)"
}
fi fi
fi fi
if [ $FOUND_PYENV -eq 0 ] ; then if [[ $FOUND_PYENV -eq 1 ]]; then
function pyenv_prompt_info() { echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')" } eval "$(pyenv init - zsh)"
if (( $+commands[pyenv-virtualenv-init] )); then
eval "$(pyenv virtualenv-init - zsh)"
fi
function pyenv_prompt_info() {
echo "$(pyenv version-name)"
}
else
# fallback to system python
function pyenv_prompt_info() {
echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')"
}
fi fi
unset FOUND_PYENV dir
# pylint
This plugin adds code analysis for python through [Pylint](https://www.pylint.org/).
To use it, add `pylint` to the plugins array in your zshrc file:
```zsh
plugins=(... pylint)
```
## Aliases
| Alias | Command | Description |
| -------------| -------------------- | -------------------------------------------------------------------------------------------------------------------------|
| pylint-quick | `pylint --reports=n` | Displays a set of reports each one focusing on a particular aspect of the project, default set `no` for multiple reports | |
# python plugin
The plugin adds several aliases for useful [python](https://www.python.org/) commands.
To use it, add `python` to the plugins array of your zshrc file:
```
plugins=(... python)
```
## Aliases
| Command | Description |
|------------------|---------------------------------------------------------------------------------|
| `pyfind` | Finds .py files recursively in the current directory |
| `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one |
| `pygrep <text>` | Looks for `text` in .py files |
#compdef python
# Python 2.6
# Python 3.0
local curcontext="$curcontext" state line expl
typeset -A opt_args
local -a args
if _pick_variant python3=Python\ 3 python2 --version; then
args=(
'(-bb)-b[issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]'
'(-b)-bb[issue errors about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]'
)
else
args=(
'-Q+[division options]:division option:(old warn warnall new)'
'(-tt)-t[issue warnings about inconsistent tab usage]'
'(-t)-tt[issue errors about inconsistent tab usage]'
'-3[warn about Python 3.x incompatibilities]'
)
fi
_arguments -C -s -S "$args[@]" \
"-B[don't write .py\[co\] files on import]" \
'(1 -)-c+[program passed in as string (terminates option list)]:python command:' \
'-d[debug output from parser]' \
'-E[ignore PYTHON* environment variables (such as PYTHONPATH)]' \
'(1 * -)-h[display help information]' \
'-i[inspect interactively after running script]' \
'(1 * -)-m[run library module as a script (terminates option list)]:module:->modules' \
'-O[optimize generated bytecode slightly]' \
'-OO[remove doc-strings in addition to the -O optimizations]' \
"-s[don't add user site directory to sys.path]" \
"-S[don't imply 'import site' on initialization]" \
'-u[unbuffered binary stdout and stderr]' \
'-v[verbose (trace import statements)]' \
'(1 * -)'{-V,--version}'[display version information]' \
'-W+[warning control]:warning filter (action\:message\:category\:module\:lineno):(default always ignore module once error)' \
'-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \
'(-)1:script file:_files -g "*.py(|c|o)(-.)"' \
'*::script argument: _normal' && return
if [[ "$state" = modules ]]; then
local -a modules
modules=(
${${=${(f)"$(_call_program modules $words[1] -c \
'from\ pydoc\ import\ help\;\ help\(\"modules\"\)')"}[2,-3]}:#\(package\)}
)
_wanted modules expl module compadd -a modules && return
fi
return 1
# Find python file # Find python file
alias pyfind='find . -name "*.py"' alias pyfind='find . -name "*.py"'
# Remove python compiled byte-code in either current directory or in a # Remove python compiled byte-code and mypy cache in either current directory or in a
# list of specified directories # list of specified directories
function pyclean() { function pyclean() {
ZSH_PYCLEAN_PLACES=${*:-'.'} ZSH_PYCLEAN_PLACES=${*:-'.'}
find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete
find ${ZSH_PYCLEAN_PLACES} -type d -name "__pycache__" -delete find ${ZSH_PYCLEAN_PLACES} -type d -name "__pycache__" -delete
find ${ZSH_PYCLEAN_PLACES} -type d -name ".mypy_cache" -delete
} }
# Grep among .py files # Grep among .py files
......
...@@ -51,6 +51,9 @@ _arguments \ ...@@ -51,6 +51,9 @@ _arguments \
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then
_describe -t commands "rails subcommand" _1st_arguments _describe -t commands "rails subcommand" _1st_arguments
return return
else
_files
return
fi fi
case "$words[1]" in case "$words[1]" in
......
...@@ -8,7 +8,7 @@ checks the file modification time to see if it needs to regenerate the cache ...@@ -8,7 +8,7 @@ checks the file modification time to see if it needs to regenerate the cache
file. file.
This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/), This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/),
which is inspired by [this Ruby on Rails trick from 2006](http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh/). which is inspired by [this Ruby on Rails trick from 2006](https://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh/).
Think about that. 2006. Think about that. 2006.
......
# rand-quote plugin
Displays a random quote taken from [quotationspage.com](http://www.quotationspage.com/random.php)
Created by [Eduardo San Martin Morote, aka Posva](https://posva.github.io)
## Usage
Add the plugin to the plugins array in your zshrc file and restart zsh:
```zsh
plugins=(... rand-quote)
```
Then, run `quote` to get a new random quote.
# Get a random quote fron the site http://www.quotationspage.com/random.php3 if ! (( $+commands[curl] )); then
# Created by Eduardo San Martin Morote aka Posva
# http://posva.github.io
# Sun Jun 09 10:59:36 CEST 2013
# Don't remove this header, thank you
# Usage: quote
WHO_COLOR="\e[0;33m"
TEXT_COLOR="\e[0;35m"
COLON_COLOR="\e[0;35m"
END_COLOR="\e[m"
if [[ -x `which curl` ]]; then
function quote()
{
Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php3" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ")
TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g')
W=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g')
if [ "$W" -a "$TXT" ]; then
echo "${WHO_COLOR}${W}${COLON_COLOR}: ${TEXT_COLOR}${TXT}${END_COLOR}"
fi
}
#quote
else
echo "rand-quote plugin needs curl to work" >&2 echo "rand-quote plugin needs curl to work" >&2
return
fi fi
function quote {
emulate -L zsh
Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ")
TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g')
WHO=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g')
[[ -n "$WHO" && -n "$TXT" ]] && print -P "%F{3}${WHO}%f: “%F{5}${TXT}%f”"
}
...@@ -11,19 +11,28 @@ plugins=(... react-native) ...@@ -11,19 +11,28 @@ plugins=(... react-native)
## Aliases ## Aliases
| Alias | React Native command | | Alias | React Native command |
|:------------|:-----------------------------------------------| | :------------ | :------------------------------------------------- |
| **rn** | `react-native` | | **rn** | `react-native` |
| **rns** | `react-native start` | | **rns** | `react-native start` |
| **rnlink** | `react-native link` | | **rnlink** | `react-native link` |
| _App testing_ | | _App testing_ |
| **rnand** | `react-native run-android` | | **rnand** | `react-native run-android` |
| **rnios** | `react-native run-ios` | | **rnios** | `react-native run-ios` |
| **rnios4s** | `react-native run-ios --simulator "iPhone 4s"` | | **rnios4s** | `react-native run-ios --simulator "iPhone 4s"` |
| **rnios5** | `react-native run-ios --simulator "iPhone 5"` | | **rnios5** | `react-native run-ios --simulator "iPhone 5"` |
| **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` | | **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` |
| **rnios6** | `react-native run-ios --simulator "iPhone 6"` | | **rnios6** | `react-native run-ios --simulator "iPhone 6"` |
| **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` | | **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` |
| _Logging_ | | **rnios7** | `react-native run-ios --simulator "iPhone7"` |
| **rnland** | `react-native log-android` | | **rnios7p** | `react-native run-ios --simulator "iPhone 7 Plus"` |
| **rnlios** | `react-native log-ios` | | **rnios8** | `react-native run-ios --simulator "iPhone 8"` |
| **rnios8p** | `react-native run-ios --simulator "iPhone 8 Plus"` |
| **rniosse** | `react-native run-ios --simulator "iPhone SE"` |
| **rniosx** | `react-native run-ios --simulator "iPhone X"` |
| **rniosxs** | `react-native run-ios --simulator "iPhone XS"` |
| **rniosxsm** | `react-native run-ios --simulator "iPhone XS Max"` |
| **rniosxr** | `react-native run-ios --simulator "iPhone XR"` |
| _Logging_ |
| **rnland** | `react-native log-android` |
| **rnlios** | `react-native log-ios` |
...@@ -9,6 +9,15 @@ alias rnios5='react-native run-ios --simulator "iPhone 5"' ...@@ -9,6 +9,15 @@ alias rnios5='react-native run-ios --simulator "iPhone 5"'
alias rnios5s='react-native run-ios --simulator "iPhone 5s"' alias rnios5s='react-native run-ios --simulator "iPhone 5s"'
alias rnios6='react-native run-ios --simulator "iPhone 6"' alias rnios6='react-native run-ios --simulator "iPhone 6"'
alias rnios6s='react-native run-ios --simulator "iPhone 6s"' alias rnios6s='react-native run-ios --simulator "iPhone 6s"'
alias rnios7='react-native run-ios --simulator "iPhone 7"'
alias rnios7p='react-native run-ios --simulator "iPhone 7 Plus"'
alias rnios8='react-native run-ios --simulator "iPhone 8"'
alias rnios8p='react-native run-ios --simulator "iPhone 8 Plus"'
alias rniosse='react-native run-ios --simulator "iPhone SE"'
alias rniosx='react-native run-ios --simulator "iPhone X"'
alias rniosxs='react-native run-ios --simulator "iPhone XS"'
alias rniosxsm='react-native run-ios --simulator "iPhone XS Max"'
alias rniosxr='react-native run-ios --simulator "iPhone XR"'
alias rnland='react-native log-android' alias rnland='react-native log-android'
alias rnlios='react-native log-ios' alias rnlios='react-native log-ios'
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
**Maintainer:** [Stibbons](https://github.com/Stibbons) **Maintainer:** [Stibbons](https://github.com/Stibbons)
This plugin mainly add support automatic completion for the repo command line tool: This plugin mainly add support automatic completion for the repo command line tool:
http://code.google.com/p/git-repo/ https://code.google.com/p/git-repo/
* `r` aliases `repo` * `r` aliases `repo`
# rsync
This plugin adds aliases for frequent [rsync](https://rsync.samba.org/) commands.
To use it add `rsync` to the plugins array in you zshrc file.
```zsh
plugins=(... rsync)
```
| Alias | Command |
| ------------------- | ------------------------------------------------ |
| *rsync-copy* | `rsync -avz --progress -h` |
| *rsync-move* | `rsync -avz --progress -h --remove-source-files` |
| *rsync-update* | `rsync -avzu --progress -h` |
| *rsync-synchronize* | `rsync -avzu --delete --progress -h` |
# Ruby plugin
This plugin adds aliases for common commands used in dealing with [Ruby](https://www.ruby-lang.org/en/) and [gem packages](https://rubygems.org/).
To use it, add `ruby` to the plugins array in your zshrc file:
```zsh
plugins=(... ruby)
```
## Aliases
| Alias | Command | Description |
|-------|----------------------------------------|------------------------------------------------------|
| rb | `ruby` | The Ruby command |
| sgem | `sudo gem` | Run sudo gem on the system ruby, not the active ruby |
| rfind | `find . -name "*.rb" \| xargs grep -n` | Find ruby file |
| gin | `gem install` | Install a gem into the local repository |
| gun | `gem uninstall` | Uninstall gems from the local repository |
| gli | `gem list` | Display gems installed locally |
...@@ -88,14 +88,14 @@ _rustc_opts_vals=( ...@@ -88,14 +88,14 @@ _rustc_opts_vals=(
--pretty='[Pretty-print the input instead of compiling]::TYPE:_values "TYPES" "$_rustc_pretty_types[@]"' --pretty='[Pretty-print the input instead of compiling]::TYPE:_values "TYPES" "$_rustc_pretty_types[@]"'
--unpretty='[Present the input source, unstable (and less-pretty)]::TYPE:_values "TYPES" "$_rustc_unpretty_types[@]"' --unpretty='[Present the input source, unstable (and less-pretty)]::TYPE:_values "TYPES" "$_rustc_unpretty_types[@]"'
--color='[Configure coloring of output]:CONF:_values "COLORS" "$_rustc_color_types[@]"' --color='[Configure coloring of output]:CONF:_values "COLORS" "$_rustc_color_types[@]"'
{-v,--version}'[Print version info and exit]::VERBOSE:(verbose)'
) )
_rustc_opts_switches=( _rustc_opts_switches=(
-g'[Equivalent to --debuginfo=2]' -g'[Equivalent to --debuginfo=2]'
-O'[Equivalent to --opt-level=2]' -O'[Equivalent to --opt-level=2]'
--test'[Build a test harness]' --test'[Build a test harness]'
--verbose'[Use verbose output]' {-v,--verbose}'[Use verbose output]'
{-V,--version}'[Print version info and exit]'
{-h,--help}'[Display this message]' {-h,--help}'[Display this message]'
--no-analysis'[Parse and expand the output, but run no analysis or produce output]' --no-analysis'[Parse and expand the output, but run no analysis or produce output]'
--no-trans'[Run all passes except translation; no output]' --no-trans'[Run all passes except translation; no output]'
......
# Code from Mikael Magnusson: http://www.zsh.org/mla/users/2011/msg00367.html # Code from Mikael Magnusson: https://www.zsh.org/mla/users/2011/msg00367.html
# #
# Requires xterm, urxvt, iTerm2 or any other terminal that supports bracketed # Requires xterm, urxvt, iTerm2 or any other terminal that supports bracketed
# paste mode as documented: http://www.xfree86.org/current/ctlseqs.html # paste mode as documented: https://www.xfree86.org/current/ctlseqs.html
# create a new keymap to use while pasting # create a new keymap to use while pasting
bindkey -N paste bindkey -N paste
......
## Salt autocomplete plugin
A copy of the completion script from the
[salt](https://github.com/saltstack/salt/blob/develop/pkg/zsh_completion.zsh)
git repo.
#compdef salt salt-call salt-cp salt-run salt-key
# The use-cache style is checked in a few places to allow caching minions, modules,
# or the directory salt is installed in.
# you can cache those three with:
# zstyle ':completion:*:salt(|-cp|-call|-run|-key):*' use-cache true
# and/or selectively:
# zstyle ':completion::complete:salt-key:set-option-a-1:' use-cache false
# zstyle ':completion::complete:salt(|-cp|-call):minions:' use-cache true
# zstyle ':completion::complete:salt(|-call):modules:' use-cache true
# zstyle ':completion::complete:salt(|-cp|-call|-run|-key):salt_dir:' use-cache true
#
# cache validation can be controled with the style cache-ttl.
# it expects two arguments: number (days|hours|weeks|months)
# to invalidate the minion cache after four days:
# zstyle ':completion::complete:salt(|-cp|-call):minions:' cache-ttl 4 days
local state line curcontext="$curcontext" salt_dir
_modules(){
local _funcs expl curcontext=${curcontext%:*}:modules
if ! zstyle -m ":completion:$curcontext:" cache-policy '*'; then
zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
fi
if _cache_invalid salt/modules || ! _retrieve_cache salt/modules; then
_funcs=( ${${(Q)${${(s. .)"$(_call_program salt-call-cmd salt-call --local --log-level error --out txt sys.list_functions)"}%%[],]##}#\[}:#local:} )
_store_cache salt/modules _funcs
fi
_wanted modules expl modules _multi_parts "$@" . _funcs
}
_runners(){
local _runs expl curcontext=${curcontext%:*}:runners
if ! zstyle -m ":completion:$curcontext:" cache-policy '*'; then
zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
fi
if _cache_invalid salt/runners || ! _retrieve_cache salt/runners; then
_runs=( ${${(Q)${${(s. .)"$(_call_program salt-call-cmd salt-call --local --log-level error --out txt sys.list_runner_functions)"}%%[],]##}#\[}:#local:} )
_store_cache salt/runners _runs
fi
_wanted modules expl runners _multi_parts "$@" . _runs
}
_minions(){
local type requested_type include_all key expl; typeset -A _peons
# when completing the minion argument for salt and salt-cp, set the argument section
# of the context to `minion' not `argument-1'
if [[ $service = salt(|-cp) ]]; then
curcontext=${curcontext%:*}:minions
fi
# only pass the argument accepted, unaccepted, rejected, denied or all to -t/-T
# the argument is used as part of an tag, accepted-minions, rejected-minions, etc.
# while un, acc, den, etc will work, you will possibly ignore user customized tags.
zparseopts -D -E 't+:=requested_type' 'T+:=include_all'
if ! zstyle -m ":completion:$curcontext:" cache-policy '*'; then
zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
fi
if _cache_invalid salt/minions || ! _retrieve_cache salt/minions; then
# it would be awesome if salt-key could prefix or suffix a word to denote
# the key's state. It would remove the need for this loop, calling salt-key N times.
for type in accepted unaccepted rejected denied; do
salt-key -l $type 2>/dev/null | while read -r key; do
[[ $key == *' Keys:' ]] && continue
_peons+=( "$key" $type )
done
done
_store_cache salt/minions _peons
fi
# if salt-key's --include-all option isn't on the line, ignore the -T options
(( words[(I)--include-all] )) || unset include_all
if (( requested_type[(I)all] )); then
requested_type=( -t accepted -t unaccepted -t rejected -t denied )
unset include_all
fi
for type in ${${requested_type:#-t}:-accepted} ${include_all:#-T}; do
_wanted $type-minions expl minion compadd "$@" -M 'r:|.=* r:|=*' ${(k)_peons[(R)$~type]}
done
}
(( $+functions[_salt_caching_policy] )) ||
_salt_caching_policy() {
local oldp ttl d t
zstyle -a ":completion:$curcontext:" cache-ttl ttl
if (( $#ttl >= 2 )); then
[[ $ttl[1] == <-> ]] && integer t=$ttl[1]
case $ttl[2] in
seconds#)d=s;;
months#) d=M;;
weeks#) d=w;;
hours#) d=h;;
*) d=d;;
esac
fi
oldp=( "$1"(Nm${d:-d}+${t:-1}) )
(( $#oldp ))
}
local -a _{target,master,logging,minion}_options _{common,out}_opts _target_opt_pat
_target_opt_pat=(
'(-[ELGNRCIS]|--(pcre|list|grain(|-pcre)|nodegroup|range|compound|pillar|ipcidr))'
'(-E --pcre -L --list -G --grain --grain-pcre -N --nodegroup -R --range -C --compound -I --pillar -S --ipcidr)'
)
_target_options=(
"$_target_opt_pat[2]"{-E,--pcre}'[use pcre regular expressions]:pcre:'
"$_target_opt_pat[2]"{-L,--list}'[take a comma or whitespace delimited list of servers.]:list:'
"$_target_opt_pat[2]"{-G,--grain}'[use a grain value to identify targets]:Grains:'
"$_target_opt_pat[2]--grain-pcre[use a grain value to identify targets.]:pcre:"
"$_target_opt_pat[2]"{-N,--nodegroup}'[use one of the predefined nodegroups to identify a list of targets.]:Nodegroup:'
"$_target_opt_pat[2]"{-R,--range}'[use a range expression to identify targets.]:Range:'
"$_target_opt_pat[2]"{-C,--compound}'[Use multiple targeting options.]:Compound:'
"$_target_opt_pat[2]"{-I,--pillar}'[use a pillar value to identify targets.]:Pillar:'
"$_target_opt_pat[2]"{-S,--ipcidr}'[Match based on Subnet (CIDR notation) or IPv4 address.]:Cidr:'
)
_common_opts=(
"--version[show program's version number and exit]"
"--versions-report[show program's dependencies version number and exit]"
'(-h --help)'{-h,--help}'[show this help message and exit]'
'(-c --config-dir)'{-c,--config-dir}'[Pass in an alternative configuration directory.(default: /etc/salt/)]:Config Directory:_files -/'
'(-t --timeout)'{-t,--timeout}'[Change the timeout for the running command; default=5]:Timeout (seconds):'
)
_master_options=(
'(-s --static)'{-s,--static}'[Return the data from minions as a group after they all return.]'
"--async[Run the salt command but don't wait for a reply]"
'(--state-output --state_output)'{--state-output,--state_output}'[Override the configured state_output value for minion output. Default: full]:Outputs:(full terse mixed changes)'
'--subset[Execute the routine on a random subset of the targeted minions]:Subset:'
'(-v --verbose)'{-v,--verbose}'[Turn on command verbosity, display jid and active job queries]'
'--hide-timeout[Hide minions that timeout]'
'(-b --batch --batch-size)'{-b,--batch,--batch-size}'[Execute the salt job in batch mode, pass number or percentage to batch.]:Batch Size:'
'(-a --auth --eauth --extrenal-auth)'{-a,--auth,--eauth,--external-auth}'[Specify an external authentication system to use.]:eauth:'
'(-T --make-token)'{-T,--make-token}'[Generate and save an authentication token for re-use.]'
'--return[Set an alternative return method.]:Returners:_path_files -W "$salt_dir/returners" -g "[^_]*.py(\:r)"'
'(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]'
'--args-separator[Set the special argument used as a delimiter between command arguments of compound commands.]:Arg separator:'
)
_minion_options=(
'--return[Set an alternative return method.]:Returners:_path_files -W "$salt_dir"/returners" -g "[^_]*.py(\:r)"'
'(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]'
'(-g --grains)'{-g,--grains}'[Return the information generated by the salt grains]'
{*-m,*--module-dirs}'[Specify an additional directory to pull modules from.]:Module Dirs:_files -/'
'--master[Specify the master to use.]:Master:'
'--local[Run salt-call locally, as if there was no master running.]'
'--file-root[Set this directory as the base file root.]:File Root:_files -/'
'--pillar-root[Set this directory as the base pillar root.]:Pillar Root:_files -/'
'--retcode-passthrough[Exit with the salt call retcode and not the salt binary retcode]'
'--id[Specify the minion id to use.]:Minion ID:'
'--skip-grains[Do not load grains.]'
'--refresh-grains-cache[Force a refresh of the grains cache]'
)
_runner_options=(
'--hard-crash[raise any original exception rather than exiting gracefully]'
'(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]'
)
_key_options=(
'(-u --user)'{-u+,--user=}'[specify user to run salt-key]:user:_users'
'--hard-crash[raise any original exception rather than exiting gracefully]'
'(-q --quiet)'{-q,--quiet}'[quiet mode]'
'(-y --yes)'{-y,--yes}'[assume yes]'
'--rotate-aes-key[prevents the master from refreshing the key session when keys are deleted or rejected]:boolean:(true false)'
'--gen-keys=[set a name to generate a keypair for use with salt]:key name'
'--gen-keys-dir=[set the directory to save the generated keypair]: : _directories'
'--keysize=[set the size for keypair]:key size'
'--gen-signature[create a signature file of the masters public-key]'
'--priv=[the private-key file to create a signature with]:private key:_files'
'--signature-path=[the path where the signature file should be written]: : _directories'
'--pub=[the public-key file to create a signature for]:public key:_files'
'--auto-create[auto-create a signing key-pair if it does not yet exist]'
'--include-all[include non-pending keys when accepting/rejecting]'
- '(set)'
{-l+,--list=}'[list public keys]:key type:((
preaccepted\:"unaccepted/unsigned keys" unaccepted\:"unaccepted/unsigned keys" un\:"unaccepted/unsigned keys"
accepted\:"accepted/signed keys" acc\:"accepted/signed keys"
rejected\:"rejected keys" rej\:"rejected keys"
den\:"denied keys" denied\:"denied keys" all
))'
{-a+,--accept=}'[accept key]:key:_minions -t unaccepted -T rejected'
{-A,--accept-all}'[accept all keys]'
{-r+,--reject=}'[reject key]:key:_minions -t rejected -T accepted'
{-p+,--print=}'[print the specified public key]:key:_minions -t all'
{-P,--print-all}'[print all public keys]'
{-d+,--delete=}'[delete the specified public key]:key:_minions -t all'
{-D,--delete-all}'[delete all public keys]'
{-f+,--finger=}'[print the specified key'\''s fingerprint]:key:_minions -t all'
{-F,--finger-all}'[print the fingerprint of all keys]'
)
_logging_options=(
'(-l --log-level)'{-l,--log-level}'[Console logging log level.(default: warning)]:Log Level:(all garbage trace debug info warning error critical quiet)'
'--log-file[Log file path. Default: /var/log/salt/master.]:Log File:_files'
'--log-file-level=[Logfile logging log level.Default: warning]:Log Level:(all garbage trace debug info warning error critical quiet)'
)
_out_opts=(
'(--out --output)'{--out,--output}'[Print the output using the specified outputter.]:Outputters:_path_files -W "$salt_dir/output" -g "[^_]*.py(\:r)"'
'(--out-indent --output-indent)'{--out-indent,--output-indent}'[Print the output indented by the provided value in spaces.]:Number:'
'(--out-file --output-file)'{--out-file,--output-file}'[Write the output to the specified file]:Output File:_files'
'(--no-color --no-colour)'{--no-color,--no-colour}'[Disable all colored output]'
'(--force-color --force-colour)'{--force-color,--force-colour}'[Force colored output]'
)
_salt_comp(){
case "$service" in
salt)
_arguments -C \
"${words[(r)$_target_opt_pat[1]]+!}:minions:_minions" \
':modules:_modules' \
"$_target_options[@]" \
"$_common_opts[@]" \
"$_master_options[@]" \
"$_logging_options[@]" \
"$_out_opts[@]"
;;
salt-call)
_arguments -C \
':modules:_modules' \
"$_minion_options[@]" \
"$_common_opts[@]" \
"$_logging_options[@]" \
"$_out_opts[@]"
;;
salt-cp)
_arguments -C \
"${words[(r)$_target_opt_pat[1]]+!}:minions:_minions" \
"$_target_options[@]" \
"$_common_opts[@]" \
"$_logging_options[@]" \
':Source File:_files' \
':Destination File:_files'
;;
salt-run)
_arguments -C \
":runners:_runners" \
"$_runner_options[@]" \
"$_common_opts[@]" \
"$_logging_options[@]"
;;
salt-key)
_arguments -C \
"$_key_options[@]" \
"${_common_opts[@]:#'-t --timeout\)'*}" \
"${_logging_options[@]:#'(-l --log-level)'*}"
;;
esac
}
() {
local curcontext=${curcontext%:*}:salt_dir
if ! zstyle -m ":completion:$curcontext:" cache-policy '*'; then
zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
fi
if _cache_invalid salt/salt_dir || ! _retrieve_cache salt/salt_dir; then
salt_dir="${$(python2 -c 'import salt; print(salt.__file__);')%__init__*}"
_store_cache salt/salt_dir salt_dir
fi
}
_salt_comp "$@"
# sbt plugin
This plugin adds completion for the [sbt, the interactive build tool](https://scala-sbt.org/),
as well as some aliases for common sbt commands.
To use it, add `sbt` to the plugins array in your zshrc file:
```zsh
plugins=(... sbt)
```
## Aliases
| Alias | Command | Description |
|-------|-----------------------|--------------------------------------------------------------|
| sbc | `sbt compile` | Compiles the main sources |
| sbcln | `sbt clean` | Deletes all generated files |
| sbcc | `sbt clean compile` | Deletes generated files, compiles the main sources |
| sbco | `sbt console` | Starts Scala with the compiled sources and all dependencies |
| sbcq | `sbt console-quick` | Starts Scala with all dependencies |
| sbcp | `sbt console-project` | Starts Scala with sbt and the build definitions |
| sbd | `sbt doc` | Generates API documentation for Scala source files |
| sbdc | `sbt dist:clean` | Deletes the distribution packages |
| sbdi | `sbt dist` | Creates the distribution packages |
| sbgi | `sbt gen-idea` | Create Idea project files |
| sbp | `sbt publish` | Publishes artifacts to the repository |
| sbpl | `sbt publish-local` | Publishes artifacts to the local Ivy repository |
| sbr | `sbt run` | Runs the main class for the project |
| sbrm | `sbt run-main` | Runs the specified main class for the project |
| sbu | `sbt update` | Resolves and retrieves external dependencies |
| sbx | `sbt test` | Compiles and runs all tests |
| sba | `sbt assembly` | Create a fat JAR with all dependencies |
...@@ -17,6 +17,7 @@ _sbt_commands=( ...@@ -17,6 +17,7 @@ _sbt_commands=(
'package-src:produce a source artifact, such as a jar containing sources' 'package-src:produce a source artifact, such as a jar containing sources'
'publish:publish artifacts to a repository' 'publish:publish artifacts to a repository'
'publish-local:publish artifacts to the local repository' 'publish-local:publish artifacts to the local repository'
'publish-m2:publish artifacts to the local Maven 2 repository'
'run:run a main class' 'run:run a main class'
'run-main:run the main class selected by the first argument' 'run-main:run the main class selected by the first argument'
'test:execute all tests' 'test:execute all tests'
......
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
# aliases - mnemonic: prefix is 'sb' # aliases - mnemonic: prefix is 'sb'
alias sbc='sbt compile' alias sbc='sbt compile'
alias sbcc='sbt clean compile'
alias sbco='sbt console' alias sbco='sbt console'
alias sbcq='sbt console-quick' alias sbcq='sbt console-quick'
alias sbcl='sbt clean' alias sbcln='sbt clean'
alias sbcp='sbt console-project' alias sbcp='sbt console-project'
alias sbd='sbt doc' alias sbd='sbt doc'
alias sbdc='sbt dist:clean' alias sbdc='sbt dist:clean'
......
## Scala plugin
Completion script for [scala and scalac](https://www.scala-lang.org/) commands.
To use it, add `scala` to the plugins array of your zshrc file:
```
plugins=(... scala)
```
## Aliases
| Command | Description |
|------------------|---------------------------------------------------------------------------------|
| `scala` | Run code in the Scala language |
| `scalac` | Compiler for the Scala language |
#compdef scala scalac #compdef scala scalac
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Copyright (c) 2012 Github zsh-users - http://github.com/zsh-users # Copyright (c) 2012 Github zsh-users - https://github.com/zsh-users
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
# Description # Description
# ----------- # -----------
# #
# Completion script for scala and scalac (http://www.scala-lang.org/). # Completion script for scala and scalac (https://www.scala-lang.org/).
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Authors # Authors
......
...@@ -14,8 +14,8 @@ directory aliases, which appear as named directories in zsh session. ...@@ -14,8 +14,8 @@ directory aliases, which appear as named directories in zsh session.
## INSTALLATION NOTES ## INSTALLATION NOTES
Besides oh-my-zsh, `scd` can be used with *bash*, *dash* or *tcsh* Besides oh-my-zsh, `scd` can be used with *bash*, *dash* or *tcsh*
shells and is also available as [Vim](http://www.vim.org/) plugin and shells and is also available as [Vim](https://www.vim.org/) plugin and
[IPython](http://ipython.org/) extension. For installation details, see [IPython](https://ipython.org/) extension. For installation details, see
https://github.com/pavoljuhas/smart-change-directory. https://github.com/pavoljuhas/smart-change-directory.
## SYNOPSIS ## SYNOPSIS
......
File mode changed from 100755 to 100644
#compdef scw #compdef scw
# #
# zsh completion for scw (http://scaleway.com) # zsh completion for scw (https://www.scaleway.com)
# #
# Inspired by https://github.com/felixr/docker-zsh-completion # Inspired by https://github.com/felixr/docker-zsh-completion
......
...@@ -57,10 +57,10 @@ supported. ...@@ -57,10 +57,10 @@ supported.
Copyright (C) 2008 by Daniel Friesel <derf@xxxxxxxxxxxxxxxxxx> Copyright (C) 2008 by Daniel Friesel <derf@xxxxxxxxxxxxxxxxxx>
License: WTFPL <http://sam.zoy.org/wtfpl> License: WTFPL <http://www.wtfpl.net>
Ref: http://www.zsh.org/mla/workers/2009/msg00415.html Ref: https://www.zsh.org/mla/workers/2009/msg00415.html
http://www.zsh.org/mla/workers/2009/msg00419.html https://www.zsh.org/mla/workers/2009/msg00419.html
## Misc ## Misc
......
...@@ -24,10 +24,10 @@ ...@@ -24,10 +24,10 @@
# Keywords: prompt directory truncate shrink collapse fish # Keywords: prompt directory truncate shrink collapse fish
# #
# Copyright (C) 2008 by Daniel Friesel <derf@xxxxxxxxxxxxxxxxxx> # Copyright (C) 2008 by Daniel Friesel <derf@xxxxxxxxxxxxxxxxxx>
# License: WTFPL <http://sam.zoy.org/wtfpl> # License: WTFPL <http://www.wtfpl.net>
# #
# Ref: http://www.zsh.org/mla/workers/2009/msg00415.html # Ref: https://www.zsh.org/mla/workers/2009/msg00415.html
# http://www.zsh.org/mla/workers/2009/msg00419.html # https://www.zsh.org/mla/workers/2009/msg00419.html
shrink_path () { shrink_path () {
setopt localoptions setopt localoptions
...@@ -88,19 +88,18 @@ shrink_path () { ...@@ -88,19 +88,18 @@ shrink_path () {
if (( named )) { if (( named )) {
for part in ${(k)nameddirs}; { for part in ${(k)nameddirs}; {
[[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/${nameddirs[$part]}/\~$part} [[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/#${nameddirs[$part]}/\~$part}
} }
} }
(( tilde )) && dir=${dir/$HOME/\~} (( tilde )) && dir=${dir/#$HOME/\~}
tree=(${(s:/:)dir}) tree=(${(s:/:)dir})
( (
unfunction chpwd 2> /dev/null
if [[ $tree[1] == \~* ]] { if [[ $tree[1] == \~* ]] {
cd ${~tree[1]} cd -q ${~tree[1]}
result=$tree[1] result=$tree[1]
shift tree shift tree
} else { } else {
cd / cd -q /
} }
for dir in $tree; { for dir in $tree; {
if (( lastfull && $#tree == 1 )) { if (( lastfull && $#tree == 1 )) {
...@@ -117,7 +116,7 @@ shrink_path () { ...@@ -117,7 +116,7 @@ shrink_path () {
(( short )) && break (( short )) && break
done done
result+="/$part" result+="/$part"
cd $dir cd -q $dir
shift tree shift tree
} }
echo ${result:-/} echo ${result:-/}
......
...@@ -10,16 +10,16 @@ oh-my-zsh Spring Boot plugin ...@@ -10,16 +10,16 @@ oh-my-zsh Spring Boot plugin
$ cd ~/.oh-my-zsh/plugins $ cd ~/.oh-my-zsh/plugins
$ git clone git@github.com:linux-china/oh-my-zsh-spring-boot-plugin.git spring $ git clone git@github.com:linux-china/oh-my-zsh-spring-boot-plugin.git spring
Adjust your .zshrc file and add spring to plugins=(...) Adjust your .zshrc file and add spring to plugins=(...)
## Tips ## Tips
* Install Spring Cloud plugin: spring install org.springframework.cloud:spring-cloud-cli:1.0.2.RELEASE * Install Spring Cloud plugin: spring install org.springframework.cloud:spring-cloud-cli:1.0.2.RELEASE
## Reference ## Reference
* Spring Boot: http://projects.spring.io/spring-boot/ * Spring Boot: https://spring.io/projects/spring-boot
* Spring Boot CLI: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#cli * Spring Boot CLI: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#cli
Maintainer : linux_china ([@linux_china](https://twitter.com/linux_china)) Maintainer : linux_china ([@linux_china](https://twitter.com/linux_china))
# Contributed and SLIGHTLY modded by Matt Parnell/ilikenwf <parwok -at- gmail> # Contributed and SLIGHTLY modded by Matt Parnell/ilikenwf <parwok -at- gmail>
# Created by the blogger at the URL below...I don't know where to find his/her name # Created by the blogger at the URL below...I don't know where to find his/her name
# Original found at http://www.shellperson.net/sprunge-pastebin-script/ # Original found at https://www.shellperson.net/sprunge-pastebin-script/
usage() { usage() {
description | fmt -s >&2 description | fmt -s >&2
} }
description() { description() {
cat << HERE cat << HERE
DESCRIPTION DESCRIPTION
Upload data and fetch URL from the pastebin http://sprunge.us Upload data and fetch URL from the pastebin http://sprunge.us
USAGE USAGE
$0 filename.txt $0 filename.txt
$0 text string $0 text string
$0 < filename.txt $0 < filename.txt
piped_data | $0 piped_data | $0
NOTES NOTES
-------------------------------------------------------------------------- --------------------------------------------------------------------------
* INPUT METHODS * * INPUT METHODS *
$0 can accept piped data, STDIN redirection [<filename.txt], text strings following the command as arguments, or filenames as arguments. Only one of these methods can be used at a time, so please see the note on precedence. Also, note that using a pipe or STDIN redirection will treat tabs as spaces, or disregard them entirely (if they appear at the beginning of a line). So I suggest using a filename as an argument if tabs are important either to the function or readability of the code. $0 can accept piped data, STDIN redirection [<filename.txt], text strings following the command as arguments, or filenames as arguments. Only one of these methods can be used at a time, so please see the note on precedence. Also, note that using a pipe or STDIN redirection will treat tabs as spaces, or disregard them entirely (if they appear at the beginning of a line). So I suggest using a filename as an argument if tabs are important either to the function or readability of the code.
* PRECEDENCE * * PRECEDENCE *
STDIN redirection has precedence, then piped input, then a filename as an argument, and finally text strings as an arguments. STDIN redirection has precedence, then piped input, then a filename as an argument, and finally text strings as an arguments.
EXAMPLE: EXAMPLE:
echo piped | "$0" arguments.txt < stdin_redirection.txt echo piped | "$0" arguments.txt < stdin_redirection.txt
In this example, the contents of file_as_stdin_redirection.txt would be uploaded. Both the piped_text and the file_as_argument.txt are ignored. If there is piped input and arguments, the arguments will be ignored, and the piped input uploaded. In this example, the contents of file_as_stdin_redirection.txt would be uploaded. Both the piped_text and the file_as_argument.txt are ignored. If there is piped input and arguments, the arguments will be ignored, and the piped input uploaded.
* FILENAMES * * FILENAMES *
If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but will instead treat it as a text string and upload it. If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but will instead treat it as a text string and upload it.
-------------------------------------------------------------------------- --------------------------------------------------------------------------
HERE HERE
exit exit
} }
......
...@@ -11,6 +11,8 @@ plugins=(... ssh-agent) ...@@ -11,6 +11,8 @@ plugins=(... ssh-agent)
## Instructions ## Instructions
**IMPORTANT: put these settings _before_ the line that sources oh-my-zsh**
To enable **agent forwarding support** add the following to your zshrc file: To enable **agent forwarding support** add the following to your zshrc file:
```zsh ```zsh
...@@ -33,6 +35,6 @@ zstyle :omz:plugins:ssh-agent lifetime 4h ...@@ -33,6 +35,6 @@ zstyle :omz:plugins:ssh-agent lifetime 4h
## Credits ## Credits
Based on code from Joseph M. Reagle: http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html Based on code from Joseph M. Reagle: https://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
Agent-forwarding support based on ideas from Florent Thoumie and Jonas Pfenniger Agent-forwarding support based on ideas from Florent Thoumie and Jonas Pfenniger
...@@ -30,7 +30,12 @@ if [[ $_agent_forwarding == "yes" && -n "$SSH_AUTH_SOCK" ]]; then ...@@ -30,7 +30,12 @@ if [[ $_agent_forwarding == "yes" && -n "$SSH_AUTH_SOCK" ]]; then
elif [[ -f "$_ssh_env_cache" ]]; then elif [[ -f "$_ssh_env_cache" ]]; then
# Source SSH settings, if applicable # Source SSH settings, if applicable
. $_ssh_env_cache > /dev/null . $_ssh_env_cache > /dev/null
ps x | grep ssh-agent | grep -q $SSH_AGENT_PID || { if [[ $USER == "root" ]]; then
FILTER="ax"
else
FILTER="x"
fi
ps $FILTER | grep ssh-agent | grep -q $SSH_AGENT_PID || {
_start_agent _start_agent
} }
else else
......
# Stack
This plugin provides completion for [Stack](https://haskellstack.org).
To use it add stack to the plugins array in your zshrc file.
```bash
plugins=(... stack)
```
...@@ -4,7 +4,7 @@ Plugin for Sublime Text, a cross platform text and code editor, available for Li ...@@ -4,7 +4,7 @@ Plugin for Sublime Text, a cross platform text and code editor, available for Li
### Requirements ### Requirements
* [Sublime Text](http://www.sublimetext.com/) * [Sublime Text](https://www.sublimetext.com/)
### Usage ### Usage
...@@ -19,3 +19,7 @@ Plugin for Sublime Text, a cross platform text and code editor, available for Li ...@@ -19,3 +19,7 @@ Plugin for Sublime Text, a cross platform text and code editor, available for Li
* If `sst` command is called, it is like `sudo st`, opening the file or folder in Sublime Text. Useful for editing system protected files. * If `sst` command is called, it is like `sudo st`, opening the file or folder in Sublime Text. Useful for editing system protected files.
* If `stp` command is called, it find a `.sublime-project` file by traversing up the directory structure. If there is no `.sublime-project` file, but if the current folder is a Git repo, opens up the root directory of the repo. If the current folder is not a Git repo, then opens up the current directory. * If `stp` command is called, it find a `.sublime-project` file by traversing up the directory structure. If there is no `.sublime-project` file, but if the current folder is a Git repo, opens up the root directory of the repo. If the current folder is not a Git repo, then opens up the current directory.
* If `stn` command is called without an argument, create a stub `.sublime-project` file in the current working directory if one does not already exist
* If `stn` is passed a directory, create a stub `.sublime-project` file in it
# Sublime Text Aliases
() {
if [[ "$OSTYPE" == linux* ]]; then if [[ "$OSTYPE" == linux* ]]; then
local _sublime_linux_paths > /dev/null 2>&1 local _sublime_linux_paths
_sublime_linux_paths=( _sublime_linux_paths=(
"$HOME/bin/sublime_text" "$HOME/bin/sublime_text"
"/opt/sublime_text/sublime_text" "/opt/sublime_text/sublime_text"
...@@ -19,9 +23,8 @@ if [[ "$OSTYPE" == linux* ]]; then ...@@ -19,9 +23,8 @@ if [[ "$OSTYPE" == linux* ]]; then
break break
fi fi
done done
elif [[ "$OSTYPE" = darwin* ]]; then elif [[ "$OSTYPE" = darwin* ]]; then
local _sublime_darwin_paths > /dev/null 2>&1 local _sublime_darwin_paths
_sublime_darwin_paths=( _sublime_darwin_paths=(
"/usr/local/bin/subl" "/usr/local/bin/subl"
"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
...@@ -38,9 +41,8 @@ elif [[ "$OSTYPE" = darwin* ]]; then ...@@ -38,9 +41,8 @@ elif [[ "$OSTYPE" = darwin* ]]; then
break break
fi fi
done done
elif [[ "$OSTYPE" = 'cygwin' ]]; then elif [[ "$OSTYPE" = 'cygwin' ]]; then
local _sublime_cygwin_paths > /dev/null 2>&1 local _sublime_cygwin_paths
_sublime_cygwin_paths=( _sublime_cygwin_paths=(
"$(cygpath $ProgramW6432/Sublime\ Text\ 2)/sublime_text.exe" "$(cygpath $ProgramW6432/Sublime\ Text\ 2)/sublime_text.exe"
"$(cygpath $ProgramW6432/Sublime\ Text\ 3)/sublime_text.exe" "$(cygpath $ProgramW6432/Sublime\ Text\ 3)/sublime_text.exe"
...@@ -52,9 +54,10 @@ elif [[ "$OSTYPE" = 'cygwin' ]]; then ...@@ -52,9 +54,10 @@ elif [[ "$OSTYPE" = 'cygwin' ]]; then
break break
fi fi
done done
fi fi
}
alias stt='st .' alias stt='st .'
find_project() find_project()
...@@ -84,4 +87,35 @@ find_project() ...@@ -84,4 +87,35 @@ find_project()
st $FINAL_DEST st $FINAL_DEST
} }
function create_project() {
local _target=$1
if [[ "${_target}" == "" ]]; then
_target=$(pwd);
elif [[ ! -d ${_target} ]]; then
echo "${_target} is not a valid directory"
return 1
fi
local _sublime_project_file=$_target/$(basename $_target).sublime-project
if [[ ! -f $_sublime_project_file ]]; then
touch $_sublime_project_file
echo -e "{" >> $_sublime_project_file
echo -e "\t\"folders\":" >> $_sublime_project_file
echo -e "\t\t[{" >> $_sublime_project_file
echo -e "\t\t\t\"path\": \".\"," >> $_sublime_project_file
echo -e "\t\t\t\"file_exclude_patterns\": []" >> $_sublime_project_file
echo -e "\t\t}]" >> $_sublime_project_file
echo -e "}" >> $_sublime_project_file
echo -e "New Sublime Text project created:\n\t${_sublime_project_file}"
fi
}
alias stp=find_project alias stp=find_project
alias stn=create_project
# sudo
Easily prefix your current or previous commands with `sudo` by pressing <kbd>esc</kbd> twice
## Enabling the plugin
1. Open your `.zshrc` file and add `sudo` in the plugins section:
```zsh
plugins=(
# all your enabled plugins
sudo
)
```
2. Reload the source file or restart your Terminal session:
```console
$ source ~/.zshrc
$
```
## Usage examples
### Current typed commands
Say you have typed a long command and forgot to add `sudo` in front:
```console
$ apt-get install build-essential
```
By pressing the <kbd>esc</kbd> key twice, you will have the same command with `sudo` prefixed without typing:
```console
$ sudo apt-get install build-essential
```
### Previous executed commands
Say you want to delete a system file and denied:
```console
$ rm some-system-file.txt
-su: some-system-file.txt: Permission denied
$
```
By pressing the <kbd>esc</kbd> key twice, you will have the same command with `sudo` prefixed without typing:
```console
$ rm some-system-file.txt
-su: some-system-file.txt: Permission denied
$ sudo rm some-system-file.txt
Password:
$
```
# suse
**Maintainer**: [r-darwish](https://github.com/r-darwish)
Alias for Zypper according to the official Zypper's alias
To use it add `suse` to the plugins array in you zshrc file.
```zsh
plugins=(... suse)
```
## Main commands
| Alias | Commands | Description |
| ---------------- | ----------------------------- | -------------------------------------------------------------- |
| z | `sudo zypper` | call zypper |
| zh | `sudo zypper -h` | print help |
| zhse | `sudo zypper -h se` | print help for the search command |
| zlicenses | `sudo zypper licenses` | prints a report about licenses and EULAs of installed packages |
| zps | `sudo zypper ps` | list process using deleted files |
| zshell | `sudo zypper shell` | open a zypper shell session |
| zsource-download | `sudo zypper source-download` | download source rpms for all installed packages |
| ztos | `sudo zypper tos` | shows the ID string of the target operating system |
| zvcmp | `sudo zypper vcmp` | tell whether version1 is older or newer than version2 |
## Packages commands
| Alias | Commands | Description |
| ----- | ----------------- | ------------------------------------------------------------------ |
| zin | `sudo zypper in` | install packages |
| zinr | `sudo zypper inr` | install newly added packages recommended by already installed ones |
| zrm | `sudo zypper rm` | remove packages |
| zsi | `sudo zypper si` | install source of a package |
| zve | `sudo zypper ve` | verify dependencies of installed packages |
## Updates commands
| Alias | Commands | Description |
| ------ | ------------------- | ---------------------- |
| zdup | `sudo zypper dup` | upgrade packages |
| zlp | `sudo zypper lp` | list necessary patches |
| zlu | `sudo zypper lu` | list updates |
| zpchk | `sudo zypper pchk` | check for patches |
| zup | `sudo zypper up` | update packages |
| zpatch | `sudo zypper patch` | install patches |
## Request commands
| Alias | Commands | Description |
| ------------- | -------------------------- | ---------------------------------------------------- |
| zif | `sudo zypper if` | display info about packages |
| zpa | `sudo zypper pa` | list packages |
| zpatch-info | `sudo zypper patch-info` | display info about patches |
| zpattern-info | `sudo zypper pattern-info` | display info about patterns |
| zproduct-info | `sudo zypper product-info` | display info about products |
| zpch | `sudo zypper pch` | list all patches |
| zpd | `sudo zypper pd` | list products |
| zpt | `sudo zypper pt` | list patterns |
| zse | `sudo zypper se` | search for packages |
| zwp | `sudo zypper wp` | list all packages providing the specified capability |
## Repositories commands
| Alias | Commands | Description |
| ----- | ------------------- | ---------------------------------------- |
| zar | `sudo zypper ar` | add a repository |
| zcl | `sudo zypper clean` | clean cache |
| zlr | `sudo zypper lr` | list repositories |
| zmr | `sudo zypper mr` | modify repositories |
| znr | `sudo zypper nr` | rename repositories (for the alias only) |
| zref | `sudo zypper ref` | refresh repositories |
| zrr | `sudo zypper rr` | remove repositories |
## Services commands
| Alias | Commands | Description |
| ----- | ------------------ | -------------------------------------------------------------- |
| zas | `sudo zypper as` | adds a service specified by URI to the system |
| zms | `sudo zypper ms` | modify properties of specified services |
| zrefs | `sudo zypper refs` | refreshing a service mean executing the service's special task |
| zrs | `sudo zypper rs` | remove specified repository index service from the system |
| zls | `sudo zypper ls` | list services defined on the system |
## Package Locks Management commands
| Alias | Commands | Description |
| ----- | ---------------- | ----------------------------------- |
| zal | `sudo zypper al` | add a package lock |
| zcl | `sudo zypper cl` | remove unused locks |
| zll | `sudo zypper ll` | list currently active package locks |
| zrl | `sudo zypper rl` | remove specified package lock |
#Alias for Zypper according to the official Zypper's alias
#Main commands #Main commands
alias z='sudo zypper' #call zypper alias z='sudo zypper'
alias zh='sudo zypper -h' #print help alias zh='sudo zypper -h'
alias zhse='sudo zypper -h se' #print help for the search command alias zhse='sudo zypper -h se'
alias zlicenses='sudo zypper licenses' #prints a report about licenses and EULAs of installed packages alias zlicenses='sudo zypper licenses'
alias zps='sudo zypper ps' #list process using deleted files alias zps='sudo zypper ps'
alias zshell='sudo zypper shell' #open a zypper shell session alias zshell='sudo zypper shell'
alias zsource-download='sudo zypper source-download' #download source rpms for all installed packages alias zsource-download='sudo zypper source-download'
alias ztos='sudo zypper tos' #shows the ID string of the target operating system alias ztos='sudo zypper tos'
alias zvcmp='sudo zypper vcmp' #tell whether version1 is older or newer than version2 alias zvcmp='sudo zypper vcmp'
#Packages commands #Packages commands
alias zin='sudo zypper in' #install packages alias zin='sudo zypper in'
alias zinr='sudo zypper inr' #install newly added packages recommended by already installed ones alias zinr='sudo zypper inr'
alias zrm='sudo zypper rm' #remove packages alias zrm='sudo zypper rm'
alias zsi='sudo zypper si' #install source of a package alias zsi='sudo zypper si'
alias zve='sudo zypper ve' #verify dependencies of installed packages alias zve='sudo zypper ve'
#Updates commands #Updates commands
alias zdup='sudo zypper dup' #upgrade packages alias zdup='sudo zypper dup'
alias zlp='sudo zypper lp' #list necessary patchs alias zlp='sudo zypper lp'
alias zlu='sudo zypper lu' #list updates alias zlu='sudo zypper lu'
alias zpchk='sudo zypper pchk' #check for patches alias zpchk='sudo zypper pchk'
alias zup='sudo zypper up' #update packages alias zup='sudo zypper up'
alias zpatch='sudo zypper patch' #install patches alias zpatch='sudo zypper patch'
#Request commands #Request commands
alias zif='sudo zypper if' #display info about packages alias zif='sudo zypper if'
alias zpa='sudo zypper pa' #list packages alias zpa='sudo zypper pa'
alias zpatch-info='sudo zypper patch-info' #display info about patches alias zpatch-info='sudo zypper patch-info'
alias zpattern-info='sudo zypper patch-info' #display info about patterns alias zpattern-info='sudo zypper pattern-info'
alias zproduct-info='sudo zypper patch-info' #display info about products alias zproduct-info='sudo zypper product-info'
alias zpch='sudo zypper pch' #list all patches alias zpch='sudo zypper pch'
alias zpd='sudo zypper pd' #list products alias zpd='sudo zypper pd'
alias zpt='sudo zypper pt' #list patterns alias zpt='sudo zypper pt'
alias zse='sudo zypper se' #search for packages alias zse='sudo zypper se'
alias zwp='sudo zypper wp' #list all packages providing the specified capability alias zwp='sudo zypper wp'
#Repositories commands #Repositories commands
alias zar='sudo zypper ar' #add a repository alias zar='sudo zypper ar'
alias zcl='sudo zypper clean' #clean cache alias zcl='sudo zypper clean'
alias zlr='sudo zypper lr' #list repositories alias zlr='sudo zypper lr'
alias zmr='sudo zypper mr' #modify repositories alias zmr='sudo zypper mr'
alias znr='sudo zypper nr' #rename repositories (for the alias only) alias znr='sudo zypper nr'
alias zref='sudo zypper ref' #refresh repositories alias zref='sudo zypper ref'
alias zrr='sudo zypper rr' #remove repositories alias zrr='sudo zypper rr'
#Services commands #Services commands
alias zas='sudo zypper as' #adds a service specified by URI to the system alias zas='sudo zypper as'
alias zms='sudo zypper ms' #modify properties of specified services alias zms='sudo zypper ms'
alias zrefs='sudo zypper refs' #refreshing a service mean executing the service's special task alias zrefs='sudo zypper refs'
alias zrs='sudo zypper rs' #remove specified repository index service from the system alias zrs='sudo zypper rs'
alias zls='sudo zypper ls' #list services defined on the system alias zls='sudo zypper ls'
#Package Locks Management commands #Package Locks Management commands
alias zal='sudo zypper al' #add a package lock alias zal='sudo zypper al'
alias zcl='sudo zypper cl' #Remove unused locks alias zcl='sudo zypper cl'
alias zll='sudo zypper ll' #list currently active package locks alias zll='sudo zypper ll'
alias zrl='sudo zypper rl' #remove specified package lock alias zrl='sudo zypper rl'
# `svn` plugin # `svn` plugin
This plugin adds some utility functions to display additional information regarding your current This plugin adds some utility functions to display additional information regarding your current
svn repository. See http://subversion.apache.org/ for the full svn documentation. svn repository. See https://subversion.apache.org/ for the full svn documentation.
To use it, add `svn` to your plugins array: To use it, add `svn` to your plugins array:
......
#compdef swift
local context state state_descr line
typeset -A opt_args
_swift() {
_arguments -C \
'(- :)--help[prints the synopsis and a list of the most commonly used commands]: :->arg' \
'(-): :->command' \
'(-)*:: :->arg' && return
case $state in
(command)
local tools
tools=(
'build:build sources into binary products'
'run:build and run an executable product'
'package:perform operations on Swift packages'
'test:build and run tests'
)
_alternative \
'tools:common:{_describe "tool" tools }' \
'compiler: :_swift_compiler' && _ret=0
;;
(arg)
case ${words[1]} in
(build)
_swift_build
;;
(run)
_swift_run
;;
(package)
_swift_package
;;
(test)
_swift_test
;;
(*)
_swift_compiler
;;
esac
;;
esac
}
_swift_dependency() {
local dependencies
dependencies=( $(swift package completion-tool list-dependencies) )
_describe '' dependencies
}
_swift_executable() {
local executables
executables=( $(swift package completion-tool list-executables) )
_describe '' executables
}
# Generates completions for swift build
#
# In the final compdef file, set the following file header:
#
# #compdef _swift_build
# local context state state_descr line
# typeset -A opt_args
_swift_build() {
arguments=(
"-Xcc[Pass flag through to all C compiler invocations]:Pass flag through to all C compiler invocations: "
"-Xswiftc[Pass flag through to all Swift compiler invocations]:Pass flag through to all Swift compiler invocations: "
"-Xlinker[Pass flag through to all linker invocations]:Pass flag through to all linker invocations: "
"-Xcxx[Pass flag through to all C++ compiler invocations]:Pass flag through to all C++ compiler invocations: "
"(--configuration -c)"{--configuration,-c}"[Build with configuration (debug|release) ]: :{_values '' 'debug[build with DEBUG configuration]' 'release[build with RELEASE configuration]'}"
"--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
"(--chdir -C)"{--chdir,-C}"[]: :_files"
"--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
"--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}"
"--disable-prefetching[]"
"--skip-update[Skip updating dependencies from their remote during a resolution]"
"--disable-sandbox[Disable using the sandbox when executing subprocesses]"
"--version[]"
"--destination[]: :_files"
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
"--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
"--build-tests[Build both source and test targets]"
"--product[Build the specified product]:Build the specified product: "
"--target[Build the specified target]:Build the specified target: "
"--show-bin-path[Print the binary output path]"
)
_arguments $arguments && return
}
# Generates completions for swift run
#
# In the final compdef file, set the following file header:
#
# #compdef _swift_run
# local context state state_descr line
# typeset -A opt_args
_swift_run() {
arguments=(
":The executable to run:_swift_executable"
"-Xcc[Pass flag through to all C compiler invocations]:Pass flag through to all C compiler invocations: "
"-Xswiftc[Pass flag through to all Swift compiler invocations]:Pass flag through to all Swift compiler invocations: "
"-Xlinker[Pass flag through to all linker invocations]:Pass flag through to all linker invocations: "
"-Xcxx[Pass flag through to all C++ compiler invocations]:Pass flag through to all C++ compiler invocations: "
"(--configuration -c)"{--configuration,-c}"[Build with configuration (debug|release) ]: :{_values '' 'debug[build with DEBUG configuration]' 'release[build with RELEASE configuration]'}"
"--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
"(--chdir -C)"{--chdir,-C}"[]: :_files"
"--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
"--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}"
"--disable-prefetching[]"
"--skip-update[Skip updating dependencies from their remote during a resolution]"
"--disable-sandbox[Disable using the sandbox when executing subprocesses]"
"--version[]"
"--destination[]: :_files"
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
"--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
"--skip-build[Skip building the executable product]"
)
_arguments $arguments && return
}
# Generates completions for swift package
#
# In the final compdef file, set the following file header:
#
# #compdef _swift_package
# local context state state_descr line
# typeset -A opt_args
_swift_package() {
arguments=(
"-Xcc[Pass flag through to all C compiler invocations]:Pass flag through to all C compiler invocations: "
"-Xswiftc[Pass flag through to all Swift compiler invocations]:Pass flag through to all Swift compiler invocations: "
"-Xlinker[Pass flag through to all linker invocations]:Pass flag through to all linker invocations: "
"-Xcxx[Pass flag through to all C++ compiler invocations]:Pass flag through to all C++ compiler invocations: "
"(--configuration -c)"{--configuration,-c}"[Build with configuration (debug|release) ]: :{_values '' 'debug[build with DEBUG configuration]' 'release[build with RELEASE configuration]'}"
"--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
"(--chdir -C)"{--chdir,-C}"[]: :_files"
"--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
"--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}"
"--disable-prefetching[]"
"--skip-update[Skip updating dependencies from their remote during a resolution]"
"--disable-sandbox[Disable using the sandbox when executing subprocesses]"
"--version[]"
"--destination[]: :_files"
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
"--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
'(-): :->command'
'(-)*:: :->arg'
)
_arguments $arguments && return
case $state in
(command)
local modes
modes=(
'edit:Put a package in editable mode'
'clean:Delete build artifacts'
'init:Initialize a new package'
'dump-package:Print parsed Package.swift as JSON'
'describe:Describe the current package'
'unedit:Remove a package from editable mode'
'update:Update package dependencies'
'completion-tool:Completion tool (for shell completions)'
'tools-version:Manipulate tools version of the current package'
'reset:Reset the complete cache/build directory'
'resolve:Resolve package dependencies'
'generate-xcodeproj:Generates an Xcode project'
'fetch:'
'show-dependencies:Print the resolved dependency graph'
)
_describe "mode" modes
;;
(arg)
case ${words[1]} in
(edit)
_swift_package_edit
;;
(clean)
_swift_package_clean
;;
(init)
_swift_package_init
;;
(dump-package)
_swift_package_dump-package
;;
(describe)
_swift_package_describe
;;
(unedit)
_swift_package_unedit
;;
(update)
_swift_package_update
;;
(completion-tool)
_swift_package_completion-tool
;;
(tools-version)
_swift_package_tools-version
;;
(reset)
_swift_package_reset
;;
(resolve)
_swift_package_resolve
;;
(generate-xcodeproj)
_swift_package_generate-xcodeproj
;;
(fetch)
_swift_package_fetch
;;
(show-dependencies)
_swift_package_show-dependencies
;;
esac
;;
esac
}
_swift_package_edit() {
arguments=(
":The name of the package to edit:_swift_dependency"
"--revision[The revision to edit]:The revision to edit: "
"--branch[The branch to create]:The branch to create: "
"--path[Create or use the checkout at this path]:Create or use the checkout at this path:_files"
)
_arguments $arguments && return
}
_swift_package_clean() {
arguments=(
)
_arguments $arguments && return
}
_swift_package_init() {
arguments=(
"--type[empty|library|executable|system-module]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}"
)
_arguments $arguments && return
}
_swift_package_dump-package() {
arguments=(
)
_arguments $arguments && return
}
_swift_package_describe() {
arguments=(
"--type[json|text]: :{_values '' 'text[describe using text format]' 'json[describe using JSON format]'}"
)
_arguments $arguments && return
}
_swift_package_unedit() {
arguments=(
":The name of the package to unedit:_swift_dependency"
"--force[Unedit the package even if it has uncommited and unpushed changes.]"
)
_arguments $arguments && return
}
_swift_package_update() {
arguments=(
)
_arguments $arguments && return
}
_swift_package_completion-tool() {
arguments=(
": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}"
)
_arguments $arguments && return
}
_swift_package_tools-version() {
arguments=(
"--set[Set tools version of package to the given value]:Set tools version of package to the given value: "
"--set-current[Set tools version of package to the current tools version in use]"
)
_arguments $arguments && return
}
_swift_package_reset() {
arguments=(
)
_arguments $arguments && return
}
_swift_package_resolve() {
arguments=(
":The name of the package to resolve:_swift_dependency"
"--version[The version to resolve at]:The version to resolve at: "
"--branch[The branch to resolve at]:The branch to resolve at: "
"--revision[The revision to resolve at]:The revision to resolve at: "
)
_arguments $arguments && return
}
_swift_package_generate-xcodeproj() {
arguments=(
"--xcconfig-overrides[Path to xcconfig file]:Path to xcconfig file:_files"
"--enable-code-coverage[Enable code coverage in the generated project]"
"--output[Path where the Xcode project should be generated]:Path where the Xcode project should be generated:_files"
"--legacy-scheme-generator[Use the legacy scheme generator]"
"--watch[Watch for changes to the Package manifest to regenerate the Xcode project]"
)
_arguments $arguments && return
}
_swift_package_fetch() {
arguments=(
)
_arguments $arguments && return
}
_swift_package_show-dependencies() {
arguments=(
"--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}"
)
_arguments $arguments && return
}
# Generates completions for swift test
#
# In the final compdef file, set the following file header:
#
# #compdef _swift_test
# local context state state_descr line
# typeset -A opt_args
_swift_test() {
arguments=(
"-Xcc[Pass flag through to all C compiler invocations]:Pass flag through to all C compiler invocations: "
"-Xswiftc[Pass flag through to all Swift compiler invocations]:Pass flag through to all Swift compiler invocations: "
"-Xlinker[Pass flag through to all linker invocations]:Pass flag through to all linker invocations: "
"-Xcxx[Pass flag through to all C++ compiler invocations]:Pass flag through to all C++ compiler invocations: "
"(--configuration -c)"{--configuration,-c}"[Build with configuration (debug|release) ]: :{_values '' 'debug[build with DEBUG configuration]' 'release[build with RELEASE configuration]'}"
"--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
"(--chdir -C)"{--chdir,-C}"[]: :_files"
"--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
"--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}"
"--disable-prefetching[]"
"--skip-update[Skip updating dependencies from their remote during a resolution]"
"--disable-sandbox[Disable using the sandbox when executing subprocesses]"
"--version[]"
"--destination[]: :_files"
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
"--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
"--skip-build[Skip building the test target]"
"(--list-tests -l)"{--list-tests,-l}"[Lists test methods in specifier format]"
"--generate-linuxmain[Generate LinuxMain.swift entries for the package]"
"--parallel[Run the tests in parallel.]"
"(--specifier -s)"{--specifier,-s}"[]: : "
"--xunit-output[]: :_files"
"--filter[Run test cases matching regular expression, Format: <test-target>.<test-case> or <test-target>.<test-case>/<test>]:Run test cases matching regular expression, Format: <test-target>.<test-case> or <test-target>.<test-case>/<test>: "
)
_arguments $arguments && return
}
_swift_compiler() {
}
_swift
# Symfony
This plugin provides completion for [Symfony](https://symfony.com/).
To use it add symfony to the plugins array in your zshrc file.
```bash
plugins=(... symfony)
```
# Symfony2
This plugin provides completion for [Symfony 2](https://symfony.com/), as well as aliases for frequent Symfony commands.
To use it add symfony2 to the plugins array in your zshrc file.
```bash
plugins=(... symfony2)
```
## Aliases
| Alias | Command | Description |
|---------------|------------------------------|-------------------------------|
| `sf` | php app/console | Start the symfony console |
| `sfcl` | sf cache:clear | Clear the cache |
| `sfsr` | sf server:run | Run the dev server |
| `sfcw` | sf cache:warmup | Use the Bundles warmer |
| `sfroute` | sf debug:router | Show the different routes |
| `sfcontainer` | sf debug:contaner | List the different services |
| `sfgb` | sf generate:bundle | Generate a bundle |
| `sfgc` | sf generate:controller | Generate a controller |
| `sfgcom` | sf generate:command | Generate a command |
| `sfge` | sf doctrine:generate:entity | Generate an entity |
| `sfsu` | sf doctrine:schema:update | Update the schema in Database |
| `sfdc` | sf doctrine:database:create | Create the Database |
| `sfdev` | sf --env=dev | Update environment to `dev` |
| `sfprod` | sf --env=prod | Update environment to `prod` |
...@@ -25,5 +25,10 @@ alias sfcw='sf cache:warmup' ...@@ -25,5 +25,10 @@ alias sfcw='sf cache:warmup'
alias sfroute='sf debug:router' alias sfroute='sf debug:router'
alias sfcontainer='sf debug:container' alias sfcontainer='sf debug:container'
alias sfgb='sf generate:bundle' alias sfgb='sf generate:bundle'
alias sfgc='sf generate:controller'
alias sfgcom='sf generate:command'
alias sfge='sf doctrine:generate:entity'
alias sfsu='sf doctrine:schema:update'
alias sfdc='sf doctrine:database:create'
alias sfdev='sf --env=dev' alias sfdev='sf --env=dev'
alias sfprod='sf --env=prod' alias sfprod='sf --env=prod'
# Systemadmin plugin
This plugin adds a series of aliases and functions which make a System Administrator's life easier.
To use it, add `systemadmin` to the plugins array in your zshrc file:
```zsh
plugins=(... systemadmin)
```
## Aliases
| Alias | Command | Description |
|---------|------------------------------------------------------------------------|--------------------------------------------------------------------|
| ping | `ping -c 5` | Sends only 5 ICMP Messages |
| clr | `clear; echo Currently logged in on $TTY, as $USER in directory $PWD.` | Clears the screen and prints the current user, TTY, and directory |
| path | `print -l $path` | Displays PATH with each entry on a separate line |
| mkdir | `mkdir -pv` | Automatically create parent directories and display verbose output |
| psmem | `ps -e -orss=,args= \| sort -b -k1,1n` | Display the processes using the most memory |
| psmem10 | `ps -e -orss=,args= \| sort -b -k1,1n \| head -10` | Display the top 10 processes using the most memory |
| pscpu | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr` | Display the top processes using the most CPU |
| pscpu10 | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr \| head -10` | Display the top 10 processes using the most CPU |
| hist10 | `print -l ${(o)history%% *} \| uniq -c \| sort -nr \| head -n 10` | Display the top 10 most used commands in the history |
## Functions
| Function | Description |
|-------------|-----------------------------------------------------------------------------------------------------------------------|
| dls | List only directories in the current directory |
| psgrep | List all processes that match the pattern input after the command |
| killit | Kills any process that matches a regular expression passed to it |
| tree | List contents of directories in a tree-like format (if tree isn't installed) |
| sortcons | Sort connections by state |
| con80 | View all 80 Port Connections |
| sortconip | On the connected IP sorted by the number of connections |
| req20 | List the top 20 requests on port 80 |
| http20 | List the top 20 connections to port 80 based on tcpdump data |
| timewait20 | List the top 20 time_wait connections |
| syn20 | List the top 20 SYN connections |
| port_pro | Output all processes according to the port number |
| accessip10 | List the top 10 accesses to the ip address in the nginx/access.log file or another log file if specified |
| visitpage20 | List the top 20 most visited files or pages in the nginx/access.log file or another log file if specified |
| consume100 | List the 100 most time-consuming Page lists (more than 60 seconds) as well as the corresponding number of occurrences |
| webtraffic | List website traffic statistics in GB from tne nginx/access.log file or another log file if specified |
| c404 | List statistics on 404 connections in the nginx/access.log file or another log file if specified |
| httpstatus | List statistics based on http status in the nginx/access.log file or another log file if specified |
| d0 | Delete 0 byte files recursively in the current directory or another if specified |
| geteip | Gather information regarding an external IP address using [icanhazip.com](https://icanhazip.com) |
| getip | Determine the local IP Address with `ip addr` or `ifconfig` |
| clrz | Clear zombie processes |
| conssec | Show number of concurrent connections per second based on ngnix/access.log file or another log file if specified |
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
# ----------- # -----------
# #
# This is one for the system administrator, operation and maintenance. # This is one for the system administrator, operation and maintenance.
# Some of which come from http://justinlilly.com/dotfiles/zsh.html
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Authors # Authors
...@@ -13,14 +12,6 @@ ...@@ -13,14 +12,6 @@
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
function retval() {
if [[ -z $1 ]];then
echo '.'
else
echo $1
fi
}
function retlog() { function retlog() {
if [[ -z $1 ]];then if [[ -z $1 ]];then
echo '/var/log/nginx/access.log' echo '/var/log/nginx/access.log'
...@@ -30,8 +21,8 @@ function retlog() { ...@@ -30,8 +21,8 @@ function retlog() {
} }
alias ping='ping -c 5' alias ping='ping -c 5'
alias clr='clear;echo "Currently logged in on $(tty), as $USER in directory $PWD."' alias clr='clear; echo Currently logged in on $TTY, as $USER in directory $PWD.'
alias path='echo -e ${PATH//:/\\n}' alias path='print -l $path'
alias mkdir='mkdir -pv' alias mkdir='mkdir -pv'
# get top process eating memory # get top process eating memory
alias psmem='ps -e -orss=,args= | sort -b -k1,1n' alias psmem='ps -e -orss=,args= | sort -b -k1,1n'
...@@ -44,10 +35,10 @@ alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10' ...@@ -44,10 +35,10 @@ alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
# directory LS # directory LS
dls () { dls () {
ls -l | grep "^d" | awk '{ print $9 }' | tr -d "/" print -l *(/)
} }
psgrep() { psgrep() {
ps aux | grep "$(retval $1)" | grep -v grep ps aux | grep "${1:-.}" | grep -v grep
} }
# Kills any process that matches a regexp passed to it # Kills any process that matches a regexp passed to it
killit() { killit() {
...@@ -55,10 +46,10 @@ killit() { ...@@ -55,10 +46,10 @@ killit() {
} }
# list contents of directories in a tree-like format # list contents of directories in a tree-like format
if [ -z "\${which tree}" ]; then if ! (( $+commands[tree] )); then
tree () { tree () {
find $@ -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' find $@ -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
} }
fi fi
# Sort connection state # Sort connection state
...@@ -98,7 +89,7 @@ syn20() { ...@@ -98,7 +89,7 @@ syn20() {
# Printing process according to the port number # Printing process according to the port number
port_pro() { port_pro() {
netstat -ntlp | grep "$(retval $1)" | awk '{print $7}' | cut -d/ -f1 netstat -ntlp | grep "${1:-.}" | awk '{print $7}' | cut -d/ -f1
} }
# top10 of gain access to the ip address # top10 of gain access to the ip address
...@@ -135,7 +126,7 @@ httpstatus() { ...@@ -135,7 +126,7 @@ httpstatus() {
# Delete 0 byte file # Delete 0 byte file
d0() { d0() {
find "$(retval $1)" -type f -size 0 -exec rm -rf {} \; find "${1:-.}" -type f -size 0 -exec rm -rf {} \;
} }
# gather external ip address # gather external ip address
...@@ -143,12 +134,12 @@ geteip() { ...@@ -143,12 +134,12 @@ geteip() {
curl -s -S https://icanhazip.com curl -s -S https://icanhazip.com
} }
# determine local IP address # determine local IP address(es)
getip() { getip() {
if (( ${+commands[ip]} )); then if (( ${+commands[ip]} )); then
ip addr | grep "inet " | grep -v '127.0.0.1' | awk '{print $2}' ip addr | awk '/inet /{print $2}' | command grep -v 127.0.0.1
else else
ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}' ifconfig | awk '/inet /{print $2}' | command grep -v 127.0.0.1
fi fi
} }
......
# Systemd plugin
The systemd plugin provides many useful aliases for systemd.
To use it, add systemd to the plugins array of your zshrc file:
```
plugins=(... systemd)
```
## Aliases
| Alias | Command | Description |
|:-----------------------|:-----------------------------------|:-----------------------------------------------------------------|
| `sc-list-units` | `systemctl list-units` | List all units systemd has in memory |
| `sc-is-active` | `systemctl is-active` | Show whether a unit is active |
| `sc-status` | `systemctl status` | Show terse runtime status information about one or more units |
| `sc-show` | `systemctl show` | Show properties of units, jobs, or the manager itself |
| `sc-help` | `systemctl help` | Show man page of units |
| `sc-list-unit-files` | `systemctl list-unit-files` | List unit files installed on the system |
| `sc-is-enabled` | `systemctl is-enabled` | Checks whether any of the specified unit files are enabled |
| `sc-list-jobs` | `systemctl list-jobs` | List jobs that are in progress |
| `sc-show-environment` | `systemctl show-environment` | Dump the systemd manager environment block |
| `sc-cat` | `systemctl cat` | Show backing files of one or more units |
| `sc-list-timers` | `systemctl list-timers` | List timer units currently in memory |
| **Aliases with sudo** |
| `sc-start` | `sudo systemctl start` | Start Unit(s) |
| `sc-stop` | `sudo systemctl stop` | Stop Unit(s) |
| `sc-reload` | `sudo systemctl reload` | Reload Unit(s) |
| `sc-restart` | `sudo systemctl restart` | Restart Unit(s) |
| `sc-try-restart` | `sudo systemctl try-restart` | Restart Unit(s) |
| `sc-isolate` | `sudo systemctl isolate` | Start a unit and its dependencies and stop all others |
| `sc-kill` | `sudo systemctl kill` | Kill unit(s) |
| `sc-reset-failed` | `sudo systemctl reset-failed` | Reset the "failed" state of the specified units, |
| `sc-enable` | `sudo systemctl enable` | Enable unit(s) |
| `sc-disable` | `sudo systemctl disable` | Disable unit(s) |
| `sc-reenable` | `sudo systemctl reenable` | Reenable unit(s) |
| `sc-preset` | `sudo systemctl preset` | Reset the enable/disable status one or more unit files |
| `sc-mask` | `sudo systemctl mask` | Mask unit(s) |
| `sc-unmask` | `sudo systemctl unmask` | Unmask unit(s) |
| `sc-link` | `sudo systemctl link` | Link a unit file into the unit file search path |
| `sc-load` | `sudo systemctl load` | Load unit(s) |
| `sc-cancel` | `sudo systemctl cancel` | Cancel job(s) |
| `sc-set-environment` | `sudo systemctl set-environment` | Set one or more systemd manager environment variables |
| `sc-unset-environment` | `sudo systemctl unset-environment` | Unset one or more systemd manager environment variables |
| `sc-edit` | `sudo systemctl edit` | Edit a drop-in snippet or a whole replacement file with `--full` |
| `sc-enable-now` | `sudo systemctl enable --now` | Enable and start unit(s) |
| `sc-disable-now` | `sudo systemctl disable --now` | Disable and stop unit(s) |
| `sc-mask-now` | `sudo systemctl mask --now` | Mask and stop unit(s) |
### User aliases
You can use the above aliases as `--user` by using the prefix `scu` instead of `sc`.
For example: `scu-list-units` will be aliased to `systemctl --user list-units`.
...@@ -10,7 +10,13 @@ sudo_commands=( ...@@ -10,7 +10,13 @@ sudo_commands=(
for c in $user_commands; do; alias sc-$c="systemctl $c"; done for c in $user_commands; do; alias sc-$c="systemctl $c"; done
for c in $sudo_commands; do; alias sc-$c="sudo systemctl $c"; done for c in $sudo_commands; do; alias sc-$c="sudo systemctl $c"; done
for c in $user_commands; do; alias scu-$c="systemctl --user $c"; done
for c in $sudo_commands; do; alias scu-$c="systemctl --user $c"; done
alias sc-enable-now="sc-enable --now" alias sc-enable-now="sc-enable --now"
alias sc-disable-now="sc-disable --now" alias sc-disable-now="sc-disable --now"
alias sc-mask-now="sc-mask --now" alias sc-mask-now="sc-mask --now"
alias scu-enable-now="scu-enable --now"
alias scu-disable-now="scu-disable --now"
alias scu-mask-now="scu-mask --now"
# taskwarrior # taskwarrior
This plugin adds smart tab completion for [TaskWarrior](http://taskwarrior.org/). This plugin adds smart tab completion for [TaskWarrior](https://taskwarrior.org/).
It uses the zsh tab completion script (`_task`) shipped with TaskWarrior for the It uses the zsh tab completion script (`_task`) shipped with TaskWarrior for the
completion definitions. completion definitions.
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.
# #
# http://www.opensource.org/licenses/mit-license.php # https://www.opensource.org/licenses/mit-license.php
# #
typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers
_task_projects=($(task _projects)) _task_projects=($(task _projects))
......
## atom ## Terraform oh-my-zsh plugin
Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely and efficiently. Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely and efficiently.
Current as of Terraform v0.11.7
### Requirements ### Requirements
* [Terraform](https://terraform.io/) * [Terraform](https://terraform.io/)
...@@ -12,8 +14,8 @@ Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely a ...@@ -12,8 +14,8 @@ Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely a
### Expanding ZSH prompt with current Terraform workspace name ### Expanding ZSH prompt with current Terraform workspace name
If you want to get current Terraform workspace name in your ZSH prompt open If you want to get current Terraform workspace name in your ZSH prompt open
your .zsh-theme file and in a choosen place insert: your .zsh-theme file and in a chosen place insert:
``` ```
$FG[045]\ $FG[045]\
......
...@@ -3,90 +3,151 @@ ...@@ -3,90 +3,151 @@
local -a _terraform_cmds local -a _terraform_cmds
_terraform_cmds=( _terraform_cmds=(
'apply:Builds or changes infrastructure' 'apply:Builds or changes infrastructure'
'console:Interactive console for Terraform interpolations'
'destroy:Destroy Terraform-managed infrastructure' 'destroy:Destroy Terraform-managed infrastructure'
'fmt:Rewrites config files to canonical format'
'get:Download and install modules for the configuration' 'get:Download and install modules for the configuration'
'graph:Create a visual graph of Terraform resources' 'graph:Create a visual graph of Terraform resources'
'init:Initializes Terraform configuration from a module' 'import:Import existing infrastructure into Terraform'
'init:Initialize a Terraform working directory'
'output:Read an output from a state file' 'output:Read an output from a state file'
'plan:Generate and show an execution plan' 'plan:Generate and show an execution plan'
'pull:Refreshes the local state copy from the remote server' 'providers:Prints a tree of the providers used in the configuration'
'push:Uploads the local state to the remote server' 'push:Upload this Terraform module to Atlas to run'
'refresh:Update local state file against real resources' 'refresh:Update local state file against real resources'
'remote:Configures remote state management'
'show:Inspect Terraform state or plan' 'show:Inspect Terraform state or plan'
'taint:Manually forcing a destroy and recreate on the next plan/apply' 'taint:Manually mark a resource for recreation'
'untaint:Manually unmark a resource as tainted'
'validate:Validates the Terraform files'
'version:Prints the Terraform version' 'version:Prints the Terraform version'
'workspace:Workspace management'
) )
__apply() { __apply() {
_arguments \ _arguments \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-auto-approve[Skip interactive approval of plan before applying.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-input=[(true) Ask for input for variables if not directly set.]' \ '-input=[(true) Ask for input for variables if not directly set.]' \
'-no-color[If specified, output will not contain any color.]' \ '-no-color[If specified, output wil be colorless.]' \
'-parallelism=[(10) Limit the number of parallel resource operations.]' \
'-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \ '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ '-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]' \
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \ '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
'-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \ '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' '-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
}
__console() {
_arguments \
'-state=[(terraform.tfstate) Path to read state.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
} }
__destroy() { __destroy() {
_arguments \ _arguments \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-force[If set, then the destroy confirmation will not be shown.]' \ '-auto-approve[Skip interactive approval before destroying.]' \
'-input=[(true) Ask for input for variables if not directly set.]' \ '-force[Deprecated: same as auto-approve.]' \
'-no-color[If specified, output will not contain any color.]' \ '-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-no-color[If specified, output will contain no color.]' \
'-parallelism=[(10) Limit the number of concurrent operations.]' \
'-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \ '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ '-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]' \
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \ '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
'-target=[(resource) Instead of affecting "dependencies" will instead also destroy any resources that depend on the target(s) specified.]' \ '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' '-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
}
__fmt() {
_arguments \
'-list=[(true) List files whose formatting differs (always false if using STDIN)]' \
'-write=[(true) Write result to source file instead of STDOUT (always false if using STDIN or -check)]' \
'-diff=[(false) Display diffs of formatting changes]' \
'-check=[(false) Check if the input is formatted. Exit status will be 0 if all input is properly formatted and non-zero otherwise.]'
} }
__get() { __get() {
_arguments \ _arguments \
'-update=[(false) If true, modules already downloaded will be checked for updates and updated if necessary.]' '-update=[(false) If true, modules already downloaded will be checked for updates and updated if necessary.]' \
'-no-color[If specified, output will contain no color.]'
} }
__graph() { __graph() {
_arguments \ _arguments \
'-draw-cycles[Highlight any cycles in the graph with colored edges. This helps when diagnosing cycle errors.]' \ '-draw-cycles[Highlight any cycles in the graph with colored edges. This helps when diagnosing cycle errors.]' \
'-module-depth=[(n) The maximum depth to expand modules. By default this is zero, which will not expand modules at all.]' \ '-no-color[If specified, output will contain no color.]' \
'-verbose[Generate a verbose, "worst-case" graph, with all nodes for potential operations in place.]' '-type=[(plan) Type of graph to output. Can be: plan, plan-destroy, apply, validate, input, refresh.]'
}
__import() {
_arguments \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-config=[(path) Path to a directory of Terraform configuration files to use to configure the provider. Defaults to pwd. If no config files are present, they must be provided via the input prompts or env vars.]' \
'-allow-missing-config[Allow import when no resource configuration block exists.]' \
'-input=[(true) Ask for input for variables if not directly set.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-no-color[If specified, output will contain no color.]' \
'-provider=[(provider) Specific provider to use for import. This is used for specifying aliases, such as "aws.eu". Defaults to the normal provider prefix of the resource being imported.]' \
'-state=[(PATH) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]' \
'-state-out=[(PATH) Path to the destination state file to write to. If this is not specified, the source state file will be used. This can be a new or existing path.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times. This is only useful with the "-config" flag.]' \
'-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
} }
__init() { __init() {
_arguments \ _arguments \
'-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \ '-backend=[(true) Configure the backend for this configuration.]' \
'-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \ '-backend-config=[This can be either a path to an HCL file with key/value assignments (same format as terraform.tfvars) or a 'key=value' format. This is merged with what is in the configuration file. This can be specified multiple times. The backend type must be in the configuration itself.]' \
'-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \ '-force-copy[Suppress prompts about copying state data. This is equivalent to providing a "yes" to all confirmation prompts.]' \
'-backend-config=[(path) Specifies the path to remote backend config file.]' \ '-from-module=[Copy the contents of the given module into the target directory before initialization.]' \
'-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \ '-get=[(true) Download any modules for this configuration.]' \
'-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]' '-get-plugins=[(true) Download any missing plugins for this configuration.]' \
'-input=[(true) Ask for input if necessary. If false, will error if input was required.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-no-color[If specified, output will contain no color.]' \
'-plugin-dir[Directory containing plugin binaries. This overrides all default search paths for plugins, and prevents the automatic installation of plugins. This flag can be used multiple times.]' \
'-reconfigure[Reconfigure the backend, ignoring any saved configuration.]' \
'-upgrade=[(false) If installing modules (-get) or plugins (-get-plugins), ignore previously-downloaded objects and install the latest version allowed within configured constraints.]' \
'-verify-plugins=[(true) Verify the authenticity and integrity of automatically downloaded plugins.]'
} }
__output() { __output() {
_arguments \ _arguments \
'-state=[(path) Path to the state file to read. Defaults to "terraform.tfstate".]' \ '-state=[(path) Path to the state file to read. Defaults to "terraform.tfstate".]' \
'-module=[(module_name) The module path which has needed output. By default this is the root path. Other modules can be specified by a period-separated list.]' '-no-color[ If specified, output will contain no color.]' \
'-module=[(name) If specified, returns the outputs for a specific module]' \
'-json[If specified, machine readable output will be printed in JSON format]'
} }
__plan() { __plan() {
_arguments \ _arguments \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with" .backup" extension. Set to "-" to disable backup.]' \ '-destroy[() If set, a plan will be generated to destroy all resources managed by the given configuration and state.]' \
'-destroy[If set, a plan will be generated to destroy all resources managed by the given configuration and state.]' \ '-detailed-exitcode[() Return detailed exit codes when the command exits. This will change the meaning of exit codes to: 0 - Succeeded, diff is empty (no changes); 1 - Errored, 2 - Succeeded; there is a diff]' \
'-detailed-exitcode[Return a detailed exit code when the command exits. When provided, this argument changes the exit codes and their meanings to provide more granular information about what the resulting plan contains]' \
'-input=[(true) Ask for input for variables if not directly set.]' \ '-input=[(true) Ask for input for variables if not directly set.]' \
'-module-depth=[(n) Specifies the depth of modules to show in the output. This does not affect the plan itself, only the output shown. By default, this is zero. -1 will expand all.]' \ '-lock=[(true) Lock the state file when locking is supported.]' \
'-no-color[If specified, output will not contain any color.]' \ '-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-module-depth=[(n) Specifies the depth of modules to show in the output. This does not affect the plan itself, only the output shown. By default, this is -1, which will expand all.]' \
'-no-color[() If specified, output will contain no color.]' \
'-out=[(path) Write a plan file to the given path. This can be used as input to the "apply" command.]' \ '-out=[(path) Write a plan file to the given path. This can be used as input to the "apply" command.]' \
'-parallelism=[(10) Limit the number of concurrent operations.]' \
'-refresh=[(true) Update state prior to checking for differences.]' \ '-refresh=[(true) Update state prior to checking for differences.]' \
'-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]' \ '-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]' \
'-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \ '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' '-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]' \
}
__providers() {
_arguments \
} }
__push() { __push() {
...@@ -105,6 +166,9 @@ __push() { ...@@ -105,6 +166,9 @@ __push() {
__refresh() { __refresh() {
_arguments \ _arguments \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-input=[(true) Ask for input for variables if not directly set.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-no-color[If specified, output will not contain any color.]' \ '-no-color[If specified, output will not contain any color.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \ '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
...@@ -113,19 +177,6 @@ __refresh() { ...@@ -113,19 +177,6 @@ __refresh() {
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' '-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]'
} }
__remote() {
_arguments \
'-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \
'-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \
'-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-disable[Disables remote state management and migrates the state to the -state path.]' \
'-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \
'-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]' \
'-pull=[(true) Controls if the remote state is pulled before disabling. This defaults to true to ensure the latest state is cached before disabling.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]'
}
__show() { __show() {
_arguments \ _arguments \
'-module-depth=[(n) The maximum depth to expand modules. By default this is zero, which will not expand modules at all.]' \ '-module-depth=[(n) The maximum depth to expand modules. By default this is zero, which will not expand modules at all.]' \
...@@ -136,12 +187,46 @@ __taint() { ...@@ -136,12 +187,46 @@ __taint() {
_arguments \ _arguments \
'-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \ '-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \ '-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \
'-no-color[If specified, output will not contain any color.]' \ '-no-color[If specified, output will not contain any color.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
'-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]' '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]'
} }
__untaint() {
_arguments \
'-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \
'-no-color[If specified, output will not contain any color.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
'-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]'
}
__validate() {
_arguments \
'-check-variables=[(true) If set to true (default), the command will check whether all required variables have been specified.]' \
'-no-color[If specified, output will not contain any color.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]'
}
__workspace() {
local -a __workspace_cmds
__workspace_cmds=(
'delete:Delete a workspace'
'list:List Workspaces'
'new:Create a new workspace'
'select:Select a workspace'
'show:Show the name of the current workspace'
)
_describe -t workspace "workspace commands" __workspace_cmds
}
_arguments '*:: :->command' _arguments '*:: :->command'
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then
...@@ -153,26 +238,38 @@ local -a _command_args ...@@ -153,26 +238,38 @@ local -a _command_args
case "$words[1]" in case "$words[1]" in
apply) apply)
__apply ;; __apply ;;
console)
__console;;
destroy) destroy)
__destroy ;; __destroy ;;
fmt)
__fmt;;
get) get)
__get ;; __get ;;
graph) graph)
__graph ;; __graph ;;
import)
__import;;
init) init)
__init ;; __init ;;
output) output)
__output ;; __output ;;
plan) plan)
__plan ;; __plan ;;
providers)
__providers ;;
push) push)
__push ;; __push ;;
refresh) refresh)
__refresh ;; __refresh ;;
remote)
__remote ;;
show) show)
__show ;; __show ;;
taint) taint)
__taint ;; __taint ;;
untaint)
__untaint ;;
validate)
__validate ;;
workspace)
test $CURRENT -lt 3 && __workspace ;;
esac esac
function tf_prompt_info() { function tf_prompt_info() {
# dont show 'default' workspace in home dir
[[ "$PWD" == ~ ]] && return
# check if in terraform dir # check if in terraform dir
if [ -d .terraform ]; then if [ -d .terraform ]; then
workspace=$(terraform workspace show 2> /dev/null) || return workspace=$(terraform workspace show 2> /dev/null) || return
......
## textastic ## textastic
Plugin for Textastic, a text and code editor for Mac OS X Plugin for Textastic, a text and code editor for Mac OS X
### Requirements ### Requirements
* [Textastic](http://www.textasticapp.com/mac.html) * [Textastic](https://www.textasticapp.com/mac.html)
### Usage ### Usage
......
# TextMate plugin
The plugin adds a function for the [TextMate](https://macromates.com) editor.
To use it, add `textmate` to the plugins array of your zshrc file:
```
plugins=(... textmate)
```
## Function
The `tm` function provides the following options:
- No arguments: Run `mate` in the current directory.
- Argument that is a directory: Run `mate` in the given directory and cd to it.
- Other arguments: Pass all arguments to `mate`. This allows for easy opening of multiple files.
if [[ -z $commands[thefuck] ]]; then if [[ -z $commands[thefuck] ]]; then
echo 'thefuck is not installed, you should "pip install thefuck" first' echo 'thefuck is not installed, you should "pip install thefuck" or "brew install thefuck" first.'
return -1 echo 'See https://github.com/nvbn/thefuck#installation'
return 1
fi fi
# Register alias # Register alias
......
# Themes Plugin
This plugin allows you to change ZSH theme on the go.
To use it, add `themes` to the plugins array in your zshrc file:
```
plugins=(... themes)
```
## Usage
`theme <theme_name>` - Changes the ZSH theme to specified theme.
`theme ` - Changes the ZSH theme to some random theme.
`lstheme ` - Lists installed ZSH themes.
...@@ -8,9 +8,9 @@ function theme ...@@ -8,9 +8,9 @@ function theme
source "$RANDOM_THEME" source "$RANDOM_THEME"
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
else else
if [ -f "$ZSH_CUSTOM/$1.zsh-theme" ] if [ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ]
then then
source "$ZSH_CUSTOM/$1.zsh-theme" source "$ZSH_CUSTOM/themes/$1.zsh-theme"
else else
source "$ZSH/themes/$1.zsh-theme" source "$ZSH/themes/$1.zsh-theme"
fi fi
...@@ -19,6 +19,8 @@ function theme ...@@ -19,6 +19,8 @@ function theme
function lstheme function lstheme
{ {
cd $ZSH/themes # Resources:
ls *zsh-theme | sed 's,\.zsh-theme$,,' # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Modifiers
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Qualifiers
print -l {$ZSH,$ZSH_CUSTOM}/themes/*.zsh-theme(N:t:r)
} }
# tmux
This plugin provides aliases for [tmux](http://tmux.github.io/), the terminal multiplexer.
To use it add `tmux` to the plugins array in your zshrc file.
```zsh
plugins=(... tmux)
```
The plugin also supports the following -
- determines if tmux is installed or not, if not, prompts user to install tmux
- determines if the terminal supports the 256 colors or not, sets the appropriate configuration variable
- sets the correct local config file to use
## Aliases
| Alias | Command | Description |
| ------ | -----------------------|---------------------------------------------------------- |
| `ta` | tmux attach -t | Attach new tmux session to already running named session |
| `tad` | tmux attach -d -t | Detach named tmux session |
| `ts` | tmux new-session -s | Create a new named tmux session |
| `tl` | tmux list-sessions | Displays a list of running tmux sessions |
| `tksv` | tmux kill-server | Terminate all running tmux sessions |
| `tkss` | tmux kill-session -t | Terminate named running tmux session |
| `tmux` | `_zsh_tmux_plugin_run` | Start a new tmux session |
## Configuration Variables
| Variable | Description |
|-------------------------------------|-------------------------------------------------------------------------------|
| `ZSH_TMUX_AUTOSTART` | Automatically starts tmux (default: `false`) |
| `ZSH_TMUX_AUTOSTART_ONCE` | Autostart only if tmux hasn't been started previously (default: `true`) |
| `ZSH_TMUX_AUTOCONNECT` | Automatically connect to a previous session if it exits (default: `true`) |
| `ZSH_TMUX_AUTOQUIT` | Automatically closes terminal once tmux exits (default: `ZSH_TMUX_AUTOSTART`) |
| `ZSH_TMUX_FIXTERM` | Sets `$TERM` to 256-color term or not based on current terminal support |
| `ZSH_TMUX_ITERM2` | Sets the `-CC` option for iTerm2 tmux integration (default: `false`) |
| `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `screen`) |
| `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `screen-256color` |
# if ! (( $+commands[tmux] )); then
# Aliases print "zsh tmux plugin: tmux not found. Please install tmux before using this plugin." >&2
# return 1
fi
# ALIASES
alias ta='tmux attach -t' alias ta='tmux attach -t'
alias tad='tmux attach -d -t' alias tad='tmux attach -d -t'
...@@ -9,90 +12,78 @@ alias tl='tmux list-sessions' ...@@ -9,90 +12,78 @@ alias tl='tmux list-sessions'
alias tksv='tmux kill-server' alias tksv='tmux kill-server'
alias tkss='tmux kill-session -t' alias tkss='tmux kill-session -t'
# Only run if tmux is actually installed # CONFIGURATION VARIABLES
if which tmux &> /dev/null # Automatically start tmux
then : ${ZSH_TMUX_AUTOSTART:=false}
# Configuration variables # Only autostart once. If set to false, tmux will attempt to
# # autostart every time your zsh configs are reloaded.
# Automatically start tmux : ${ZSH_TMUX_AUTOSTART_ONCE:=true}
[[ -n "$ZSH_TMUX_AUTOSTART" ]] || ZSH_TMUX_AUTOSTART=false # Automatically connect to a previous session if it exists
# Only autostart once. If set to false, tmux will attempt to : ${ZSH_TMUX_AUTOCONNECT:=true}
# autostart every time your zsh configs are reloaded. # Automatically close the terminal when tmux exits
[[ -n "$ZSH_TMUX_AUTOSTART_ONCE" ]] || ZSH_TMUX_AUTOSTART_ONCE=true : ${ZSH_TMUX_AUTOQUIT:=$ZSH_TMUX_AUTOSTART}
# Automatically connect to a previous session if it exists # Set term to screen or screen-256color based on current terminal support
[[ -n "$ZSH_TMUX_AUTOCONNECT" ]] || ZSH_TMUX_AUTOCONNECT=true : ${ZSH_TMUX_FIXTERM:=true}
# Automatically close the terminal when tmux exits # Set '-CC' option for iTerm2 tmux integration
[[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT=$ZSH_TMUX_AUTOSTART : ${ZSH_TMUX_ITERM2:=false}
# Set term to screen or screen-256color based on current terminal support # The TERM to use for non-256 color terminals.
[[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true # Tmux states this should be screen, but you may need to change it on
# Set '-CC' option for iTerm2 tmux integration # systems without the proper terminfo
[[ -n "$ZSH_TMUX_ITERM2" ]] || ZSH_TMUX_ITERM2=false : ${ZSH_TMUX_FIXTERM_WITHOUT_256COLOR:=screen}
# The TERM to use for non-256 color terminals. # The TERM to use for 256 color terminals.
# Tmux states this should be screen, but you may need to change it on # Tmux states this should be screen-256color, but you may need to change it on
# systems without the proper terminfo # systems without the proper terminfo
[[ -n "$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITHOUT_256COLOR="screen" : ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color}
# The TERM to use for 256 color terminals.
# Tmux states this should be screen-256color, but you may need to change it on # Determine if the terminal supports 256 colors
# systems without the proper terminfo if [[ $(tput colors) == 256 ]]; then
[[ -n "$ZSH_TMUX_FIXTERM_WITH_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITH_256COLOR="screen-256color" export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR
else
export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR
fi
# Set the correct local config file to use.
if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$HOME/.tmux.conf" ]]; then
export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.extra.conf"
else
export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.only.conf"
fi
# Get the absolute path to the current directory # Wrapper function for tmux.
local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)" function _zsh_tmux_plugin_run() {
if [[ -n "$@" ]]; then
command tmux "$@"
return $?
fi
# Determine if the terminal supports 256 colors local -a tmux_cmd
if [[ `tput colors` == "256" ]] tmux_cmd=(command tmux)
then [[ "$ZSH_TMUX_ITERM2" == "true" ]] && tmux_cmd+=(-CC)
export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR
else
export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR
fi
# Set the correct local config file to use. # Try to connect to an existing session.
if [[ "$ZSH_TMUX_ITERM2" == "false" ]] && [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach
then
#use this when they have a ~/.tmux.conf
export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.extra.conf"
else
#use this when they don't have a ~/.tmux.conf
export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.only.conf"
fi
# Wrapper function for tmux. # If failed, just run tmux, fixing the TERM variable if requested.
function _zsh_tmux_plugin_run() if [[ $? -ne 0 ]]; then
{ [[ "$ZSH_TMUX_FIXTERM" == "true" ]] && tmux_cmd+=(-f "$_ZSH_TMUX_FIXED_CONFIG")
# We have other arguments, just run them $tmux_cmd new-session
if [[ -n "$@" ]] fi
then
\tmux $@
# Try to connect to an existing session.
elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]]
then
\tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` attach || \tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session
[[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
# Just run tmux, fixing the TERM variable if requested.
else
\tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG`
[[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
fi
}
# Use the completions for tmux for our function if [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]]; then
compdef _tmux _zsh_tmux_plugin_run exit
fi
}
# Alias tmux to our wrapper function. # Use the completions for tmux for our function
alias tmux=_zsh_tmux_plugin_run compdef _tmux _zsh_tmux_plugin_run
# Alias tmux to our wrapper function.
alias tmux=_zsh_tmux_plugin_run
# Autostart if not already in tmux and enabled. # Autostart if not already in tmux and enabled.
if [[ ! -n "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" ]] if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z "$EMACS" && -z "$VIM" ]]; then
then # Actually don't autostart if we already did and multiple autostarts are disabled.
# Actually don't autostart if we already did and multiple autostarts are disabled. if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]]; then
if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]] export ZSH_TMUX_AUTOSTARTED=true
then _zsh_tmux_plugin_run
export ZSH_TMUX_AUTOSTARTED=true fi
_zsh_tmux_plugin_run
fi
fi
else
print "zsh tmux plugin: tmux not found. Please install tmux before using this plugin."
fi fi
# Tmuxinator plugin
This plugin provides completion for [tmuxinator](https://github.com/tmuxinator/tmuxinator),
as well as aliases for frequent tmuxinator commands.
To use it add `tmuxinator` to the plugins array in your zshrc file.
```zsh
plugins=(... tmuxinator)
```
## Aliases
| Alias | Command | Description |
| ------ | ---------------- | ------------------------ |
| `txs ` | tmuxinator start | Start Tmuxinator |
| `txo ` | tmuxinator open | Open project for editing |
| `txn ` | tmuxinator new | Create project |
| `txl ` | tmuxinator list | List projects |
#compdef tmuxinator mux _tmuxinator() {
#autoload local commands projects
commands=(${(f)"$(tmuxinator commands zsh)"})
projects=(${(f)"$(tmuxinator completions start)"})
local curcontext="$curcontext" state line ret=1 if (( CURRENT == 2 )); then
local -a _configs _describe -t commands "tmuxinator subcommands" commands
_describe -t projects "tmuxinator projects" projects
_arguments -C \ elif (( CURRENT == 3)); then
'1: :->cmds' \ case $words[2] in
'2:: :->args' && ret=0 copy|debug|delete|open|start)
_arguments '*:projects:($projects)'
_configs=(${$(echo ~/.tmuxinator/*.yml):r:t}) ;;
case $state in
cmds)
_values "tmuxinator command" \
"new[create a new project file and open it in your editor]" \
"start[start a tmux session using project's tmuxinator config]" \
"open[create a new project file and open it in your editor]" \
"copy[copy source_project project file to a new project called new_project]" \
"delete[deletes the project called project_name]" \
"debug[output the shell commands generated by a projet]" \
"implode[deletes all existing projects!]" \
"list[list all existing projects]" \
"doctor[look for problems in your configuration]" \
"help[shows this help document]" \
"version[shows tmuxinator version number]" \
$_configs
ret=0
;;
args)
case $line[1] in
start|open|copy|delete|debug)
[[ -n "$_configs" ]] && _values 'configs' $_configs
ret=0
;;
esac esac
;; fi
esac
return
}
return ret compdef _tmuxinator tmuxinator mux
alias mux="tmuxinator"
# aliases
alias txs='tmuxinator start'
alias txo='tmuxinator open'
alias txn='tmuxinator new'
alias txl='tmuxinator list'
# `transfer` plugin
[`transfer.sh`](https://transfer.sh) is an easy to use file sharing service from the command line
## Usage
Add `transfer` to your plugins array in your zshrc file:
```zsh
plugins=(... transfer)
```
Then you can:
- transfer a file:
```zsh
transfer file.txt
```
- transfer a whole directory (it will be automatically compressed):
```zsh
transfer directory/
```
# transfer.sh Easy file sharing from the command line
# transfer Plugin
# Usage Example :
# > transfer file.txt
# > transfer directory/
# Author:
# Remco Verhoef <remco@dutchcoders.io>
# https://gist.github.com/nl5887/a511f172d3fb3cd0e42d
# Modified to use tar command instead of zip
#
curl --version 2>&1 > /dev/null
if [ $? -ne 0 ]; then
echo "Could not find curl."
return 1
fi
transfer() {
# check arguments
if [ $# -eq 0 ];
then
echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
return 1
fi
# get temporarily filename, output is written to this file show progress can be showed
tmpfile=$( mktemp -t transferXXX )
# upload stdin or file
file=$1
if tty -s;
then
basefile=$(basename "$file" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
if [ ! -e $file ];
then
echo "File $file doesn't exists."
return 1
fi
if [ -d $file ];
then
echo $file
# tar directory and transfer
tarfile=$( mktemp -t transferXXX.tar.gz )
cd $(dirname $file) && tar -czf $tarfile $(basename $file)
curl --progress-bar --upload-file "$tarfile" "https://transfer.sh/$basefile.tar.gz" >> $tmpfile
rm -f $tarfile
else
# transfer file
curl --progress-bar --upload-file "$file" "https://transfer.sh/$basefile" >> $tmpfile
fi
else
# transfer pipe
curl --progress-bar --upload-file "-" "https://transfer.sh/$file" >> $tmpfile
fi
# cat output link
cat $tmpfile
# cleanup
rm -f $tmpfile
}
\ No newline at end of file
# Ubuntu plugin
This plugin adds completions and aliases for [Ubuntu](https://www.ubuntu.com/).
To use it, add `ubuntu` to the plugins array in your zshrc file:
```zsh
plugins=(... ubuntu)
```
## Aliases
Commands that use `$APT` will use apt if installed or defer to apt-get otherwise.
| Alias | Command | Description |
|---------|------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| acs | `apt-cache search` | Search the apt-cache with the specified criteria |
| acp | `apt-cache policy` | Display the package source priorities |
| afs | `apt-file search --regexp` | Perform a regular expression apt-file search |
| afu | `sudo apt-file update` | Generates or updates the apt-file package database |
| ag | `sudo $APT` | Run apt-get with sudo |
| aga | `sudo $APT autoclean` | Clears out the local reposityory of retrieved package files that can no longer be downloaded |
| agb | `sudo $APT build-dep <source_pkg>` | Installs/Removes packages to satisfy the dependencies of a specified build pkg |
| agc | `sudo $APT clean` | Clears out the local repository of retrieved package files leaving everything from the lock files |
| agd | `sudo $APT dselect-upgrade` | Follows dselect choices for package installation |
| agi | `sudo $APT install <pkg>` | Install the specified package |
| agli | `apt list --installed` | List the installed packages |
| aglu | `sudo apt-get -u upgrade --assume-no` | Run an apt-get upgrade assuming no to all prompts |
| agp | `sudo $APT purge <pkg>` | Remove a package including any configuration files |
| agr | `sudo $APT remove <pkg>` | Remove a package |
| ags | `$APT source <pkg>` | Fetch the source for the specified package |
| agu | `sudo $APT update` | Update package list |
| agud | `sudo $APT update && sudo $APT dist-upgrade` | Update packages list and perform a distribution upgrade |
| agug | `sudo $APT upgrade` | Upgrade available packages |
| agar | `sudo $APT autoremove` | Remove automatically installed packages no longer needed |
| aguu | `sudo $APT update && sudo $APT upgrade` | Update packages list and upgrade available packages |
| allpkgs | `dpkg --get-selections \| grep -v deinstall` | Print all installed packages |
| kclean | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` |Remove ALL kernel images and headers EXCEPT the one in use |
| mydeb | `time dpkg-buildpackage -rfakeroot -us -uc` | Create a basic .deb package |
| ppap | `sudo ppa-purge <ppa>` | Remove the specified PPA |
## Functions
| Function | Usage |Description |
|-------------------|---------------------------------------|--------------------------------------------------------------------------|
| aar | `aar ppa:xxxxxx/xxxxxx [packagename]` | apt-add-repository with automatic install/upgrade of the desired package |
| apt-history | `apt-history <action>` | Prints the Apt history of the specified action |
| apt-list-packages | `apt-list-packages` | List packages by size |
| kerndeb | `kerndeb` | Kernel-package building shortcut |
This plugin was created because the aliases in the debian plugin are inconsistent and hard to remember. Also this apt-priority detection that switched between apt-get and aptitude was dropped to keep it simpler. This plugin uses apt-get for everything but a few things that are only possible with aptitude I guess. Ubuntu does not have aptitude installed by default.
acs = Apt-Cache Search
acp = Apt-Cache Policy
ag = sudo Apt-Get
agi = sudo Apt-Get Install
agd = sudo Apt-Get Dselect-upgrade
By now you already can guess almost all aliases
There are two exeptions since ...
agu = sudo Apt-Get Update - we have ...
agug = sudo Apt-Get UpGrade - as the exceptional 4 letter alias for a single command.
afs = Apt-File Search --regexp - this has the regexp switch on without being represented in the alias, I guess this makes sense since the debian plugin has it, I never used that command.
Then there are the 2 other 4 letter aliases for combined commands, that are straight forward and easy to remember.
aguu = sudo Apt-Get Update && sudo apt-get Upgrade - better then adg or not?
agud = sudo Apt-Get Update && sudo apt-get full-upgrade
For a full list aliases and the functions just watch the plugins code https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/ubuntu/ubuntu.plugin.zsh, look at the comments if you want to switch from the debian plugin. Ubuntu, Mint and & co users will like the new aar function to install packages from ppas with a single command.
...@@ -5,18 +5,21 @@ ...@@ -5,18 +5,21 @@
# https://github.com/trinaldi # https://github.com/trinaldi
# Nicolas Jonas nextgenthemes.com # Nicolas Jonas nextgenthemes.com
# https://github.com/loctauxphilippe # https://github.com/loctauxphilippe
# https://github.com/HaraldNordgren
# #
# Debian, Ubuntu and friends related zsh aliases and functions for zsh # Debian, Ubuntu and friends related zsh aliases and functions for zsh
(( $+commands[apt] )) && APT=apt || APT=apt-get
alias acs='apt-cache search' alias acs='apt-cache search'
compdef _acs acs='apt-cache search' compdef _acs acs='apt-cache search'
alias afs='apt-file search --regexp' alias afs='apt-file search --regexp'
compdef _afs afs='apt-file search --regexp' compdef _afs afs='apt-file search --regexp'
# These are apt-get only # These are apt/apt-get only
alias ags='apt-get source' # asrc alias ags="$APT source" # asrc
compdef _ags ags='apt-get source' compdef _ags ags="$APT source"
alias acp='apt-cache policy' # app alias acp='apt-cache policy' # app
compdef _acp acp='apt-cache policy' compdef _acp acp='apt-cache policy'
...@@ -37,33 +40,33 @@ compdef _afu afu='sudo apt-file update' ...@@ -37,33 +40,33 @@ compdef _afu afu='sudo apt-file update'
alias ppap='sudo ppa-purge' alias ppap='sudo ppa-purge'
compdef _ppap ppap='sudo ppa-purge' compdef _ppap ppap='sudo ppa-purge'
alias apg='sudo apt-get' # age - but without sudo alias ag="sudo $APT" # age - but without sudo
alias aga='sudo apt-get autoclean' # aac alias aga="sudo $APT autoclean" # aac
alias agb='sudo apt-get build-dep' # abd alias agb="sudo $APT build-dep" # abd
alias agc='sudo apt-get clean' # adc alias agc="sudo $APT clean" # adc
alias agd='sudo apt-get dselect-upgrade' # ads alias agd="sudo $APT dselect-upgrade" # ads
alias agi='sudo apt-get install' # ai alias agi="sudo $APT install" # ai
alias agp='sudo apt-get purge' # ap alias agp="sudo $APT purge" # ap
alias agr='sudo apt-get remove' # ar alias agr="sudo $APT remove" # ar
alias agu='sudo apt-get update' # ad alias agu="sudo $APT update" # ad
alias agud='sudo apt-get update && sudo apt-get full-upgrade' #adu alias agud="sudo $APT update && sudo $APT dist-upgrade" #adu
alias agug='sudo apt-get upgrade' # ag alias agug="sudo $APT upgrade" # ag
alias aguu='sudo apt-get update && sudo apt-get upgrade' #adg alias aguu="sudo $APT update && sudo $APT upgrade" #adg
alias agar='sudo apt-get autoremove' alias agar="sudo $APT autoremove"
compdef _ag apg='sudo apt-get' compdef _ag ag="sudo $APT"
compdef _aga aga='sudo apt-get autoclean' compdef _aga aga="sudo $APT autoclean"
compdef _agb agb='sudo apt-get build-dep' compdef _agb agb="sudo $APT build-dep"
compdef _agc agc='sudo apt-get clean' compdef _agc agc="sudo $APT clean"
compdef _agd agd='sudo apt-get dselect-upgrade' compdef _agd agd="sudo $APT dselect-upgrade"
compdef _agi agi='sudo apt-get install' compdef _agi agi="sudo $APT install"
compdef _agp agp='sudo apt-get purge' compdef _agp agp="sudo $APT purge"
compdef _agr agr='sudo apt-get remove' compdef _agr agr="sudo $APT remove"
compdef _agu agu='sudo apt-get update' compdef _agu agu="sudo $APT update"
compdef _agud agud='sudo apt-get update && sudo apt-get full-upgrade' compdef _agud agud="sudo $APT update && sudo $APT dist-upgrade"
compdef _agug agug='sudo apt-get upgrade' compdef _agug agug="sudo $APT upgrade"
compdef _aguu aguu='sudo apt-get update && sudo apt-get upgrade' compdef _aguu aguu="sudo $APT update && sudo $APT upgrade"
compdef _agar agar='sudo apt-get autoremove' compdef _agar agar="sudo $APT autoremove"
# Remove ALL kernel images and headers EXCEPT the one in use # Remove ALL kernel images and headers EXCEPT the one in use
alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \ alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
...@@ -91,8 +94,8 @@ aar() { ...@@ -91,8 +94,8 @@ aar() {
PACKAGE=${1##*/} PACKAGE=${1##*/}
fi fi
sudo apt-add-repository $1 && sudo apt-get update sudo apt-add-repository $1 && sudo $APT update
sudo apt-get install $PACKAGE sudo $APT install $PACKAGE
} }
# Prints apt history # Prints apt history
...@@ -102,7 +105,7 @@ aar() { ...@@ -102,7 +105,7 @@ aar() {
# apt-history remove # apt-history remove
# apt-history rollback # apt-history rollback
# apt-history list # apt-history list
# Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html # Based On: https://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html
apt-history () { apt-history () {
case "$1" in case "$1" in
install) install)
......
#compdef ufw
#autoload
typeset -A opt_args
function _ufw_delete_rules {
if ufw status &> /dev/null ; then
ufw status numbered \
| perl -n -e'/\[ +(\d+)\] +([^ ].+)/ && print "\"$1\[$2\]\" "'
fi
}
function _ufw_app_profiles {
grep -rhoP "(?<=\[)[^\]]+" /etc/ufw/applications.d/ \
| awk '{ print "\""$0"\""}' \
| tr '\n' ' '
}
local -a _1st_arguments
_1st_arguments=(
'allow:add allow rule'
'app:Application profile commands'
'default:set default policy'
'delete:delete RULE'
'deny:add deny rule'
'disable:disables the firewall'
'enable:enables the firewall'
'insert:insert RULE at NUM'
'limit:add limit rule'
'logging:set logging to LEVEL'
'reject:add reject rule'
'reload:reloads firewall'
'reset:reset firewall'
'show:show firewall report'
'status:show firewall status'
'version:display version information'
)
local context state line curcontext="$curcontext"
_arguments -C \
'(--dry-run)--dry-run[dry run]' \
'1:: :->cmds' \
'2:: :->subcmds' \
'3:: :->subsubcmds' \
&& return 0
local rules
case "$state" in
(cmds)
_describe -t commands "ufw commands" _1st_arguments
return 0
;;
(subcmds)
case "$line[1]" in
(app)
_values 'app' \
'list[list application profiles]' \
'info[show information on PROFILE]' \
'update[update PROFILE]' \
'default[set default application policy]' \
&& ret=0
;;
(status)
_values 'status' \
'numbered[show firewall status as numbered list of RULES]' \
'verbose[show verbose firewall status]' \
&& ret=0
;;
(logging)
_values 'logging' \
'on' 'off' 'low' 'medium' 'high' 'full' \
&& ret=0
;;
(default)
_values 'default' \
'allow' 'deny' 'reject' \
&& ret=0
;;
(show)
_values 'show' \
'raw' 'builtins' 'before-rules' 'user-rules' 'after-rules' 'logging-rules' 'listening' 'added' \
&& ret=0
;;
(delete)
rules="$(_ufw_delete_rules)"
if [[ -n "$rules" ]] ; then
_values 'delete' \
${(Q)${(z)"$(_ufw_delete_rules)"}} \
&& ret=0
fi
;;
esac
;;
(subsubcmds)
case "$line[1]" in
(app)
case "$line[2]" in
(info|update)
_values 'profiles' \
${(Q)${(z)"$(_ufw_app_profiles)"}} \
&& ret=0
;;
esac
;;
(default)
_values 'default-direction' \
'incoming' 'outgoing' \
&& ret=0
;;
esac
esac
return
# URLTools plugin
This plugin provides two aliases to URL-encode and URL-decode strings.
To start using it, add the `urltools` plugin to your plugins array in `~/.zshrc`:
```zsh
plugins=(... urltools)
```
Original author: [Ian Chesal](https://github.com/ianchesal)
Original idea and aliases: [Ruslan Spivak](https://ruslanspivak.wordpress.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/)
## Commands
| Command | Description |
| :---------- | :--------------------------- |
| `urlencode` | URL-encodes the given string |
| `urldecode` | URL-decodes the given string |
## Examples
```zsh
urlencode 'https://github.com/robbyrussell/oh-my-zsh/search?q=urltools&type=Code'
# returns https%3A%2F%2Fgithub.com%2Frobbyrussell%2Foh-my-zsh%2Fsearch%3Fq%3Durltools%26type%3DCode
urldecode 'https%3A%2F%2Fgithub.com%2Frobbyrussell%2Foh-my-zsh%2Fsearch%3Fq%3Durltools%26type%3DCode'
# returns https://github.com/robbyrussell/oh-my-zsh/search?q=urltools&type=Code
```
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Adds handy command line aliases useful for dealing with URLs # Adds handy command line aliases useful for dealing with URLs
# #
# Taken from: # Taken from:
# http://ruslanspivak.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/ # https://ruslanspivak.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/
if [[ $(whence $URLTOOLS_METHOD) = "" ]]; then if [[ $(whence $URLTOOLS_METHOD) = "" ]]; then
URLTOOLS_METHOD="" URLTOOLS_METHOD=""
......
This plugin prompts the status of the Vagrant VMs. It supports single-host and
multi-host configurations as well.
Look inside the source for documentation about custom variables.
Alberto Re <alberto.re@gmail.com>
# vim:ft=zsh ts=2 sw=2 sts=2
#
# To display Vagrant infos on your prompt add the vagrant_prompt_info to the
# $PROMPT variable in your theme. Example:
#
# PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(vagrant_prompt_info)$(svn_prompt_info)$(git_prompt_info)%(!.#.$) '
#
# `vagrant_prompt_info` makes use of some custom variables. This is an example
# definition:
#
# ZSH_THEME_VAGRANT_PROMPT_PREFIX="%{$fg_bold[blue]%}["
# ZSH_THEME_VAGRANT_PROMPT_SUFFIX="%{$fg_bold[blue]%}]%{$reset_color%} "
# ZSH_THEME_VAGRANT_PROMPT_RUNNING="%{$fg_no_bold[green]%}●"
# ZSH_THEME_VAGRANT_PROMPT_POWEROFF="%{$fg_no_bold[red]%}●"
# ZSH_THEME_VAGRANT_PROMPT_SUSPENDED="%{$fg_no_bold[yellow]%}●"
# ZSH_THEME_VAGRANT_PROMPT_NOT_CREATED="%{$fg_no_bold[white]%}○"
function vagrant_prompt_info() {
test -d .vagrant && test -f Vagrantfile
if [[ "$?" == "0" ]]; then
statuses=$(vagrant status 2> /dev/null | grep -P "\w+\s+[\w\s]+\s\(\w+\)")
statuses=("${(f)statuses}")
printf '%s' $ZSH_THEME_VAGRANT_PROMPT_PREFIX
for vm_details in $statuses; do
vm_state=$(echo $vm_details | grep -o -E "saved|poweroff|not created|running")
if [[ "$vm_state" == "running" ]]; then
printf '%s' $ZSH_THEME_VAGRANT_PROMPT_RUNNING
elif [[ "$vm_state" == "saved" ]]; then
printf '%s' $ZSH_THEME_VAGRANT_PROMPT_SUSPENDED
elif [[ "$vm_state" == "not created" ]]; then
printf '%s' $ZSH_THEME_VAGRANT_PROMPT_NOT_CREATED
elif [[ "$vm_state" == "poweroff" ]]; then
printf '%s' $ZSH_THEME_VAGRANT_PROMPT_POWEROFF
fi
done
printf '%s' $ZSH_THEME_VAGRANT_PROMPT_SUFFIX
fi
}
# Vagrant plugin
This plugin adds autocompletion for [Vagrant](https://www.vagrantup.com/) commands, task names, box names and built-in handy documentation.
To use it, add `vagrant` to the plugins array in your zshrc file:
```zsh
plugins=(... vagrant)
```
...@@ -22,7 +22,7 @@ _1st_arguments=( ...@@ -22,7 +22,7 @@ _1st_arguments=(
'push:Deploys code in this environment to a configured destination' 'push:Deploys code in this environment to a configured destination'
'rdp:Connects to machine via RDP' 'rdp:Connects to machine via RDP'
'reload:Reload the vagrant environment' 'reload:Reload the vagrant environment'
'resume:Resumes a suspend vagrant environment' 'resume:Resumes a suspended vagrant environment'
'rsync:Syncs rsync synced folders to remote machine' 'rsync:Syncs rsync synced folders to remote machine'
'rsync-auto:Syncs rsync synced folders automatically when files change' 'rsync-auto:Syncs rsync synced folders automatically when files change'
'share:Shares your Vagrant environment with anyone in the world' 'share:Shares your Vagrant environment with anyone in the world'
...@@ -81,7 +81,7 @@ __vagrant-box () ...@@ -81,7 +81,7 @@ __vagrant-box ()
case $state in case $state in
(command) (command)
_describe -t commands "gem subcommand" _box_arguments _describe -t commands "vagrant subcommand" _box_arguments
return return
;; ;;
...@@ -110,7 +110,7 @@ _arguments -C \ ...@@ -110,7 +110,7 @@ _arguments -C \
case $state in case $state in
(command) (command)
_describe -t commands "gem subcommand" _1st_arguments _describe -t commands "vagrant subcommand" _1st_arguments
return return
;; ;;
......
...@@ -3,16 +3,16 @@ ...@@ -3,16 +3,16 @@
- Adds autocomplete options for all vault commands. - Adds autocomplete options for all vault commands.
####Show help for all commands ####Show help for all commands
![General Help](http://i.imgur.com/yv5Db1r.png "Help for all commands") ![General Help](https://i.imgur.com/yv5Db1r.png "Help for all commands")
####Create new Vault token ####Create new Vault token
![Create token](http://i.imgur.com/xMegNgh.png "Create token") ![Create token](https://i.imgur.com/xMegNgh.png "Create token")
####Enable audit backends ####Enable audit backends
![Audit backends](http://i.imgur.com/fKLeiSF.png "Audit backends") ![Audit backends](https://i.imgur.com/fKLeiSF.png "Audit backends")
Crafted with <3 by Valentin Bud ([@valentinbud](https://twitter.com/valentinbud)) Crafted with <3 by Valentin Bud ([@valentinbud](https://twitter.com/valentinbud))
\ No newline at end of file
...@@ -6,7 +6,7 @@ function zle-keymap-select() { ...@@ -6,7 +6,7 @@ function zle-keymap-select() {
# Ensure that the prompt is redrawn when the terminal size changes. # Ensure that the prompt is redrawn when the terminal size changes.
TRAPWINCH() { TRAPWINCH() {
zle && zle -R zle && { zle -R; zle reset-prompt }
} }
zle -N zle-keymap-select zle -N zle-keymap-select
......
...@@ -8,10 +8,11 @@ function callvim ...@@ -8,10 +8,11 @@ function callvim
{ {
if [[ $# == 0 ]]; then if [[ $# == 0 ]]; then
cat <<EOH cat <<EOH
usage: callvim [-b cmd] [-a cmd] [file ... fileN] usage: callvim [-b cmd] [-a cmd] [-n name] [file ... fileN]
-b cmd Run this command in GVIM before editing the first file -b cmd Run this command in GVIM before editing the first file
-a cmd Run this command in GVIM after editing the first file -a cmd Run this command in GVIM after editing the first file
-n name Name of the GVIM server to connect to
file The file to edit file The file to edit
... fileN The other files to add to the argslist ... fileN The other files to add to the argslist
EOH EOH
...@@ -21,13 +22,16 @@ EOH ...@@ -21,13 +22,16 @@ EOH
local cmd="" local cmd=""
local before="<esc>" local before="<esc>"
local after="" local after=""
while getopts ":b:a:" option local name="GVIM"
while getopts ":b:a:n:" option
do do
case $option in case $option in
a) after="$OPTARG" a) after="$OPTARG"
;; ;;
b) before="$OPTARG" b) before="$OPTARG"
;; ;;
n) name="$OPTARG"
;;
esac esac
done done
shift $((OPTIND-1)) shift $((OPTIND-1))
...@@ -43,7 +47,7 @@ EOH ...@@ -43,7 +47,7 @@ EOH
files=':args! '"${@:A:q}<cr>" files=':args! '"${@:A:q}<cr>"
fi fi
cmd="$before$files$after" cmd="$before$files$after"
gvim --remote-send "$cmd" gvim --servername "$name" --remote-send "$cmd"
if typeset -f postCallVim > /dev/null; then if typeset -f postCallVim > /dev/null; then
postCallVim postCallVim
fi fi
......
# virtualenv
The plugin displays information of the created virtual container and allows background theming.
To use it, add `virtualenv` to the plugins array of your zshrc file:
```
plugins=(... virtualenv)
```
The plugin creates a `virtualenv_prompt_info` function that you can use in your theme, which displays
the basename of the current `$VIRTUAL_ENV`. It uses two variables to control how that is shown:
- `ZSH_THEME_VIRTUALENV_PREFIX`: sets the prefix of the VIRTUAL_ENV. Defaults to `[`.
- `ZSH_THEME_VIRTUALENV_SUFFIX`: sets the suffix of the VIRTUAL_ENV. Defaults to `]`.
virtualenvwrapper='virtualenvwrapper.sh' virtualenvwrapper='virtualenvwrapper.sh'
virtualenvwrapper_lazy='virtualenvwrapper_lazy.sh'
if (( $+commands[$virtualenvwrapper] )); then if (( $+commands[$virtualenvwrapper_lazy] )); then
function {
setopt local_options
unsetopt equals
virtualenvwrapper=${${virtualenvwrapper_lazy}:c}
source ${${virtualenvwrapper_lazy}:c}
[[ -z "$WORKON_HOME" ]] && WORKON_HOME="$HOME/.virtualenvs"
}
elif (( $+commands[$virtualenvwrapper] )); then
function { function {
setopt local_options setopt local_options
unsetopt equals unsetopt equals
source ${${virtualenvwrapper}:c} source ${${virtualenvwrapper}:c}
} }
elif [[ -f "/usr/local/bin/virtualenvwrapper.sh" ]]; then
function {
setopt local_options
unsetopt equals
virtualenvwrapper="/usr/local/bin/virtualenvwrapper.sh"
source "/usr/local/bin/virtualenvwrapper.sh"
}
elif [[ -f "/etc/bash_completion.d/virtualenvwrapper" ]]; then elif [[ -f "/etc/bash_completion.d/virtualenvwrapper" ]]; then
function { function {
setopt local_options setopt local_options
......
# VS code
This plugin makes interaction between the command line and the code editor easier.
To start using it, add the `vscode` plugin to your `plugins` array in `~/.zshrc`:
```zsh
plugins=(... vscode)
```
## Common aliases
| Alias | Command | Description |
| ----------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------- |
| vsc | code . | Open the current folder in VS code |
| vsca `dir` | code --add `dir` | Add folder(s) to the last active window |
| vscd `file` `file` | code --diff `file` `file` | Compare two files with each other. |
| vscg `file:line[:char]` | code --goto `file:line[:char]` | Open a file at the path on the specified line and character position. |
| vscn | code --new-window | Force to open a new window. |
| vscr | code --reuse-window | Force to open a file or folder in the last active window. |
| vscw | code --wait | Wait for the files to be closed before returning. |
| vscu `dir` | code --user-data-dir `dir` | Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code. |
## Extensions aliases
| Alias | Command | Description |
| ----------------------- | ---------------------------------------------------------------- | --------------------------------- |
| vsced `dir` | code --extensions-dir `dir` | Set the root path for extensions. |
| vscie `id or vsix-path` | code --install-extension `extension-id> or <extension-vsix-path` | Installs an extension. |
| vscue `id or vsix-path` | code --uninstall-extension `id or vsix-path` | Uninstalls an extension. |
## Other options:
| Alias | Command | Description |
| ------------ | ------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| vscv | code --verbose | Print verbose output (implies --wait). |
| vscl `level` | code --log `level` | Log level to use. Default is 'info'. Allowed values are 'critical', 'error', 'warn', 'info', 'debug', 'trace', 'off'. |
| vscde | code --disable-extensions | Disable all installed extensions. |
# VScode zsh plugin
# author: https://github.com/MarsiBarsi
alias vsc='code .'
alias vsca='code --add'
alias vscd='code --diff'
alias vscg='code --goto'
alias vscn='code --new-window'
alias vscr='code --reuse-window'
alias vscw='code --wait'
alias vscu='code --user-data-dir'
alias vsced='code --extensions-dir'
alias vscie='code --install-extension'
alias vscue='code --uninstall-extension'
alias vscv='code --verbose'
alias vscl='code --log'
alias vscde='code --disable-extensions'
# Vundle plugin
This plugin adds functions to control [vundle](https://github.com/VundleVim/Vundle.vim) plug-in manager for vim.
To use it, add `vundle` to the plugins array in your zshrc file:
```zsh
plugins=(... vundle)
```
## Functions
| Function | Usage | Description |
|---------------|-----------------|----------------------------------------------------------------------------|
| vundle-init | `vundle-init` | Install vundle by cloning git repository into ~/.vim folder |
| vundle | `vundle` | Install plugins set in .vimrc (equals `:PluginInstall`) |
| vundle-update | `vundle-update` | Update plugins set in .vimrc (equals `:PluginInstall!`) |
| vundle-clean | `vundle-clean` | Delete plugins that have been removed from .vimrc (equals `:PluginClean!`) |
...@@ -6,7 +6,7 @@ function vundle-init () { ...@@ -6,7 +6,7 @@ function vundle-init () {
if [ ! -d ~/.vim/bundle/Vundle.vim/.git ] && [ ! -f ~/.vim/bundle/Vundle.vim/.git ] if [ ! -d ~/.vim/bundle/Vundle.vim/.git ] && [ ! -f ~/.vim/bundle/Vundle.vim/.git ]
then then
git clone git://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
echo "\n\tRead about vim configuration for vundle at https://github.com/VundleVim/Vundle.vim\n" echo "\n\tRead about vim configuration for vundle at https://github.com/VundleVim/Vundle.vim\n"
fi fi
} }
......
File mode changed from 100755 to 100644
# web-search plugin
This plugin adds aliases for searching with Google, Wiki, Bing, YouTube and other popular services.
Open your `~/.zshrc` file and enable the `web-search` plugin:
```zsh
plugins=( ... web-search)
```
## Usage
You can use the `web-search` plugin in these two forms:
* `web_search <context> <term> [more terms if you want]`
* `<context> <term> [more terms if you want]`
For example, these two are equivalent:
```zsh
$ web_search google oh-my-zsh
$ google oh-my-zsh
```
Available search contexts are:
| Context | URL |
|-----------------------|------------------------------------------|
| `bing` | `https://www.bing.com/search?q=` |
| `google` | `https://www.google.com/search?q=` |
| `yahoo` | `https://search.yahoo.com/search?p=` |
| `ddg` or `duckduckgo` | `https://www.duckduckgo.com/?q=` |
| `sp` or `startpage` | `https://www.startpage.com/do/search?q=` |
| `yandex` | `https://yandex.ru/yandsearch?text=` |
| `github` | `https://github.com/search?q=` |
| `baidu` | `https://www.baidu.com/s?wd=` |
| `ecosia` | `https://www.ecosia.org/search?q=` |
| `goodreads` | `https://www.goodreads.com/search?q=` |
| `qwant` | `https://www.qwant.com/?q=` |
Also there are aliases for bang-searching DuckDuckGo:
| Context | Bang |
|-----------|-------|
| `wiki` | `!w` |
| `news` | `!n` |
| `youtube` | `!yt` |
| `map` | `!m` |
| `image` | `!i` |
| `ducky` | `!` |
...@@ -16,6 +16,7 @@ function web_search() { ...@@ -16,6 +16,7 @@ function web_search() {
baidu "https://www.baidu.com/s?wd=" baidu "https://www.baidu.com/s?wd="
ecosia "https://www.ecosia.org/search?q=" ecosia "https://www.ecosia.org/search?q="
goodreads "https://www.goodreads.com/search?q=" goodreads "https://www.goodreads.com/search?q="
qwant "https://www.qwant.com/?q="
) )
# check whether the search engine is supported # check whether the search engine is supported
...@@ -49,6 +50,7 @@ alias github='web_search github' ...@@ -49,6 +50,7 @@ alias github='web_search github'
alias baidu='web_search baidu' alias baidu='web_search baidu'
alias ecosia='web_search ecosia' alias ecosia='web_search ecosia'
alias goodreads='web_search goodreads' alias goodreads='web_search goodreads'
alias qwant='web_search qwant'
#add your own !bang searches here #add your own !bang searches here
alias wiki='web_search duckduckgo \!w' alias wiki='web_search duckduckgo \!w'
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
**Maintainer:** [joshmedeski](https://github.com/joshmedeski) **Maintainer:** [joshmedeski](https://github.com/joshmedeski)
WordPress Command Line Interface (http://wp-cli.org/) WordPress Command Line Interface (https://wp-cli.org/)
WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser. WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser.
This plugin adds [tab completion](http://wp-cli.org/#complete) for `wp-cli` as well as several aliases. This plugin adds [tab completion](https://wp-cli.org/#tab-completions) for `wp-cli` as well as several aliases.
## List of Aliases ## List of Aliases
...@@ -75,7 +75,7 @@ This plugin adds [tab completion](http://wp-cli.org/#complete) for `wp-cli` as w ...@@ -75,7 +75,7 @@ This plugin adds [tab completion](http://wp-cli.org/#complete) for `wp-cli` as w
- wptp='wp theme path' - wptp='wp theme path'
- wpts='wp theme search' - wpts='wp theme search'
- wptst='wp theme status' - wptst='wp theme status'
- wptu='wp theme updatet' - wptu='wp theme update'
### User ### User
- wpuac='wp user add-cap' - wpuac='wp user add-cap'
...@@ -101,7 +101,7 @@ This plugin adds [tab completion](http://wp-cli.org/#complete) for `wp-cli` as w ...@@ -101,7 +101,7 @@ This plugin adds [tab completion](http://wp-cli.org/#complete) for `wp-cli` as w
- wpwm='wp widget move' - wpwm='wp widget move'
- wpwu='wp widget update' - wpwu='wp widget update'
The entire list of wp-cli commands can be found here: http://wp-cli.org/commands/ The entire list of wp-cli commands can be found here: https://wp-cli.org/commands/
I only included the commands that are most used. Please feel free to contribute to this project if you want more commands. I only included the commands that are most used. Please feel free to contribute to this project if you want more commands.
# WP-CLI # WP-CLI
# A command line interface for WordPress # A command line interface for WordPress
# http://wp-cli.org/ # https://wp-cli.org/
# Cache # Cache
......
...@@ -19,7 +19,7 @@ plugins=(... xcode) ...@@ -19,7 +19,7 @@ plugins=(... xcode)
| xcdd | Purge all temporary build information | rm -rf ~/Library/Developer/Xcode/DerivedData/* | | xcdd | Purge all temporary build information | rm -rf ~/Library/Developer/Xcode/DerivedData/* |
| xcp | Show currently selected Xcode directory | xcode-select --print-path | | xcp | Show currently selected Xcode directory | xcode-select --print-path |
| xcsel | Select different Xcode directory by path | sudo xcode-select --switch | | xcsel | Select different Xcode directory by path | sudo xcode-select --switch |
| xx | Opens the files listed in Xcode | open -a "Xcode.app" |
## Functions ## Functions
...@@ -29,6 +29,10 @@ plugins=(... xcode) ...@@ -29,6 +29,10 @@ plugins=(... xcode)
Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory. You can also specify a directory to look in for the Xcode files. Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory. You can also specify a directory to look in for the Xcode files.
Returns 1 if it didn't find any relevant files. Returns 1 if it didn't find any relevant files.
### `xx`
Opens the files listed in Xcode, multiple files are opened in a multi-file browser.
### `simulator` ### `simulator`
Opens the iOS Simulator from your command line, dependent on whichever is the active developer directory for Xcode. (That is, it respects the `xcsel` setting.) Opens the iOS Simulator from your command line, dependent on whichever is the active developer directory for Xcode. (That is, it respects the `xcsel` setting.)
......
...@@ -4,7 +4,7 @@ alias xcp='xcode-select --print-path' ...@@ -4,7 +4,7 @@ alias xcp='xcode-select --print-path'
alias xcsel='sudo xcode-select --switch' alias xcsel='sudo xcode-select --switch'
# original author: @subdigital # original author: @subdigital
# source: http://gist.github.com/subdigital/5420709 # source: https://gist.github.com/subdigital/5420709
function xc { function xc {
local xcode_proj local xcode_proj
if [[ $# == 0 ]]; then if [[ $# == 0 ]]; then
...@@ -22,11 +22,25 @@ function xc { ...@@ -22,11 +22,25 @@ function xc {
fi fi
return 1 return 1
else else
echo "Found ${xcode_proj[1]}" local active_path
open "${xcode_proj[1]}" active_path=$(xcode-select -p)
active_path=${active_path%%/Contents/Developer*}
echo "Found ${xcode_proj[1]}. Opening with ${active_path}"
open -a "$active_path" "${xcode_proj[1]}"
fi fi
} }
# Opens a file or files in the Xcode IDE. Multiple files are opened in multi-file browser
# original author: @possen
function xx {
if [[ $# == 0 ]]; then
echo "Specify file(s) to open in xcode."
return 1
fi
echo "${xcode_files}"
open -a "Xcode.app" "$@"
}
# "XCode-SELect by Version" - select Xcode by just version number # "XCode-SELect by Version" - select Xcode by just version number
# Uses naming convention: # Uses naming convention:
# - different versions of Xcode are named Xcode-<version>.app or stored # - different versions of Xcode are named Xcode-<version>.app or stored
...@@ -70,7 +84,7 @@ function xcselv { ...@@ -70,7 +84,7 @@ function xcselv {
function _omz_xcode_print_xcselv_usage { function _omz_xcode_print_xcselv_usage {
cat << EOF >&2 cat << EOF >&2
Usage: Usage:
xcselv <version> xcselv <version>
xcselv [options] xcselv [options]
......
# Yarn plugin
This plugin adds completion for the [Yarn package manager](https://yarnpkg.com/en/),
as well as some aliases for common Yarn commands.
To use it, add `yarn` to the plugins array in your zshrc file:
```zsh
plugins=(... yarn)
```
## Aliases
| Alias | Command | Description |
|-------|-------------------------------------------|-------------------------------------------------------------|
| y | `yarn` | The Yarn command |
| ya | `yarn add` | Install a package in dependencies (`package.json`) |
| yad | `yarn add --dev` | Install a package in devDependencies (`package.json`) |
| yap | `yarn add --peer` | Install a package in peerDependencies (`package.json`) |
| yb | `yarn build` | Run the build script defined in `package.json` |
| ycc | `yarn cache clean` | Clean yarn's global cache of packages |
| yga | `yarn global add` | Install packages globally on your operating system |
| ygls | `yarn global list` | Lists global installed packages |
| ygrm | `yarn global remove` | Remove global installed packages from your OS |
| ygu | `yarn global upgrade` | Upgrade packages installed globally to their latest version |
| yh | `yarn help` | Show help for a yarn command |
| yi | `yarn init` | Interactively creates or updates a package.json file |
| yin | `yarn install` | Install dependencies defined in `package.json` |
| yls | `yarn list` | List installed packages |
| yout | `yarn outdated` | Check for outdated package dependencies |
| yp | `yarn pack` | Create a compressed gzip archive of package dependencies |
| yrm | `yarn remove` | Remove installed packages |
| yrun | `yarn run` | Run a defined package script |
| ys | `yarn serve` | Start the dev server |
| yst | `yarn start` | Run the start script defined in `package.json` |
| yt | `yarn test` | Run the test script defined in `package.json` |
| yuc | `yarn global upgrade && yarn cache clean` | Upgrade global packages and clean yarn's global cache |
| yui | `yarn upgrade-interactive` | Prompt for which outdated packages to upgrade |
| yup | `yarn upgrade` | Upgrade packages to their latest version |
#compdef yarn
# ------------------------------------------------------------------------------
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for yarn (https://yarnpkg.com/)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
#
# ------------------------------------------------------------------------------
_commands=(
'access'
'autoclean:Clean and remove unnecessary files from package dependencies'
'cache:List or clean every cached package'
"check:Verify package dependencies agains yarn's lock file"
'config:Manages the yarn configuration files'
'generate-lock-entry:Generates a lock file entry'
'global:Install packages globally on your operating system'
'help:Show information about a command'
'import:Generate yarn.lock from an existing npm-installed node_modules folder'
'info:Show information about a package'
'init:Interactively creates or updates a package.json file'
'install:Install all the dependencies listed within package.json'
'licenses:List licenses for installed packages'
'link:Symlink a package folder during development'
'list:List installed packages'
'login:Store registry username and email'
'logout:Clear registry username and email'
'outdated:Check for outdated package dependencies'
'owner:Manage package owners'
'pack:Create a compressed gzip archive of package dependencies'
'publish:Publish a package to the npm registry'
'run:Run a defined package script'
'tag:Add, remove, or list tags on a package'
'team:Maintain team memberships'
'unlink:Unlink a previously created symlink for a package'
'version:Update the package version'
'versions:Display version information of currently installed Yarn, Node.js, and its dependencies'
'why:Show information about why a package is installed'
)
_global_commands=(
'add:Installs a package and any packages that it depends on'
'bin:Displays the location of the yarn bin folder'
'remove:Remove installed package from dependencies updating package.json'
'upgrade:Upgrades packages to their latest version based on the specified range'
'upgrade-interactive'
)
_yarn_commands_scripts() {
local -a scripts
scripts=($(yarn run --json 2>/dev/null | sed -E '/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n' | sed -e 's/:/\\:/g'))
_describe 'command or script' _commands -- _global_commands -- scripts
}
_yarn_scripts() {
local -a scripts
scripts=($(yarn run --json 2>/dev/null | sed -E '/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n' | sed -e 's/:/\\:/g'))
_describe 'script' scripts
}
_yarn_global_commands() {
local -a cmds
cmds=('ls:List installed packages')
_describe 'command' _global_commands
}
_yarn_commands() {
_describe 'command' _commands -- _global_commands
}
_yarn() {
local context state state_descr line
typeset -A opt_args
_arguments \
'(-h --help)'{-h,--help}'[output usage information]' \
'(-V --version)'{-V,--version}'[output the version number]' \
'--verbose[output verbose messages on internal operations]' \
'--offline[trigger an error if any required dependencies are not available in local cache]' \
'--prefer-offline[use network only if dependencies are not available in local cache]' \
'--strict-semver' \
'--json' \
"--ignore-scripts[don't run lifecycle scripts]" \
'--har[save HAR output of network traffic]' \
'--ignore-platform[ignore platform checks]' \
'--ignore-engines[ignore engines check]' \
'--ignore-optional[ignore optional dependencies]' \
'--force[install and build packages even if they were built before, overwrite lockfile]' \
'--skip-integrity-check[run install without checking if node_modules is installed]' \
'--check-files[install will verify file tree of packages for consistency]' \
"--no-bin-links[don't generate bin links when setting up packages]" \
'--flat[only allow one version of a package]' \
'(--prod --production)'{--prod,--production} \
"--no-lockfile[don't read or generate a lockfile]" \
"--pure-lockfile[don't generate a lockfile]" \
"--frozen-lockfile[don't generate a lockfile and fail if an update is needed]" \
'--link-duplicates[create hardlinks to the repeated modules in node_modules]' \
'--global-folder=[modules folder]:folder:_files -/' \
'--modules-folder=[rather than installing modules into the node_modules folder relative to the cwd, output them here]:folder:_files -/' \
'--cache-folder=[specify a custom folder to store the yarn cache]:folder:_files -/' \
'--mutex=[use a mutex to ensure only one yarn instance is executing]:type[\:specifier]' \
'--no-emoji[disable emoji in output]' \
'(-s --silent)'{-s,--silent}'[skip Yarn console logs, other types of logs (script output) will be printed]' \
'--proxy=:host:_hosts' \
'--https-proxy=:host:_hosts' \
'--no-progress[disable progress bar]' \
'--network-concurrency=[maximum number of concurrent network requests]:number' \
'--network-timeout=[TCP timeout for network requests]:milliseconds' \
'--non-interactive[do not show interactive prompts]' \
'1: :_yarn_commands_scripts' \
'*:: :->command_args'
case $state in
command_args)
case $words[1] in
help)
_arguments \
'1: :_yarn_commands' \
;;
access)
_arguments \
'1: :(public restricted grant revoke ls-packages ls-collaborators edit)'
;;
add)
_arguments \
'(-D --dev)'{-D,--dev}'[install packages in devDependencies]' \
'(-P --peer)'{-P,--peer}'[install packages in peerDependencies]' \
'(-O --optional)'{-O,--optional}'[install packages in optionalDependencies]' \
'(-E --exact)'{-E,--exact}'[install packages as exact versions]' \
'(-T --tilde)'{-T,--tilde}'[install the most recent release of the packages that have the same minor version]' \
'*:package-name:'
;;
cache)
_arguments \
'1: :(ls dir clean)'
;;
check)
_arguments \
'--integrity' \
'--verify-tree'
;;
config)
_arguments \
'1: :(set get delete list)' \
'*:: :->config_args'
;;
global)
_arguments \
'--prefix=[bin prefix to use to install binaries]' \
'1: :_yarn_global_commands' \
'*:: :->command_args'
;;
info)
_arguments \
'1:package:' \
'2:field'
;;
init)
_arguments \
'(-y --yes)'{-y,--yes}'[install packages in devDependencies]'
;;
licenses)
_arguments \
'1: :(ls generate-disclaimer)' \
;;
link|unlink|outdated)
_arguments \
'1:package' \
;;
list)
_arguments \
'--depth[Limit the depth of the shown dependencies]:depth'
;;
owner)
_arguments \
'1: :(ls add rm)' \
'*:: :->owner_args'
;;
pack)
_arguments \
'(-f --filename)'{-f,--filename}':filename:_files'
;;
publish)
_arguments \
'--new-version:version:' \
'--message:message:' \
'--no-git-tag-version' \
'--access:access:' \
'--tag:tag:' \
'1: :_files'
;;
remove|upgrade)
_arguments \
'*:package:'
;;
run)
_arguments \
'1: :_yarn_scripts'
;;
tag)
_arguments \
'1: :(ls add rm)' \
'*:: :->tag_args'
;;
team)
_arguments \
'1: :(create destroy add rm ls)' \
'*:: :->team_args'
;;
version)
_arguments \
'--new-version:version:' \
'--message:message:' \
'--no-git-tag-version'
;;
why)
_arguments \
'1:query:_files'
;;
esac
;;
esac
case $state in
config_args)
case $words[1] in
get|delete)
_arguments \
'1:key:'
;;
set)
_arguments \
'(-g --global)'{-g,--global} \
'1:key:' \
'2:value:'
;;
esac
;;
owner_args)
case $words[1] in
ls)
_arguments \
'1:package:'
;;
add|rm)
_arguments \
'1:user:' \
'2:package:'
;;
esac
;;
tag_args)
case $words[1] in
ls)
_arguments \
'1:package'
;;
add|rm)
_arguments \
'1:package:' \
'2:tag:'
;;
esac
;;
team_args)
case $words[1] in
create|destroy|ls)
_arguments \
'1:scope\:team:'
;;
add|rm)
_arguments \
'1:scope\:team:' \
'2:user:'
;;
esac
;;
esac
}
_yarn "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et
# Alias sorted alphabetically alias y="yarn"
alias y="yarn "
alias ya="yarn add" alias ya="yarn add"
alias yad="yarn add --dev"
alias yap="yarn add --peer"
alias yb="yarn build"
alias ycc="yarn cache clean" alias ycc="yarn cache clean"
alias yga="yarn global add"
alias ygls="yarn global list"
alias ygrm="yarn global remove"
alias ygu="yarn global upgrade"
alias yh="yarn help" alias yh="yarn help"
alias yo="yarn outdated" alias yi="yarn init"
alias yin="yarn install"
alias yls="yarn list"
alias yout="yarn outdated"
alias yp="yarn pack"
alias yrm="yarn remove"
alias yrun="yarn run"
alias ys="yarn serve"
alias yst="yarn start"
alias yt="yarn test"
alias yuc="yarn global upgrade && yarn cache clean"
alias yui="yarn upgrade-interactive" alias yui="yarn upgrade-interactive"
alias yup="yarn upgrade"
_yarn ()
{
local -a _1st_arguments _dopts _dev _production
local expl
typeset -A opt_args
_dopts=(
'(--force)--force[This refetches all packages, even ones that were previously installed.]'
)
_installopts=(
'(--flat)--flat[Only allow one version of a package. On the first run this will prompt you to choose a single version for each package that is depended on at multiple version ranges.]'
'(--har)--har[Outputs an HTTP archive from all the network requests performed during the installation.]'
'(--no-lockfile)--no-lockfile[Don’t read or generate a yarn.lock lockfile.]'
'(--pure-lockfile)--pure-lockfile[Don’t generate a yarn.lock lockfile.]'
)
_dev=('(--dev)--dev[Save installed packages into the project"s package.json devDependencies]')
_production=('(--production)--production[Do not install project devDependencies]')
_1st_arguments=(
'help:Display help information about yarn' \
'init:Initialize for the development of a package.' \
'add:Add a package to use in your current package.' \
'install:Install all the dependencies listed within package.json in the local node_modules folder.' \
'publish:Publish a package to a package manager.' \
'remove:Remove a package that will no longer be used in your current package.' \
'cache:Clear the local cache. It will be populated again the next time yarn or yarn install is run.' \
'clean:Frees up space by removing unnecessary files and folders from dependencies.' \
'check:Verifies that versions of the package dependencies in the current project’s package.json matches that of yarn’s lock file.' \
'ls:List all installed packages.' \
'global:Makes binaries available to use on your operating system.' \
'info:<package> [<field>] - fetch information about a package and return it in a tree format.' \
'outdated:Checks for outdated package dependencies.' \
'run:Runs a defined package script.' \
'self-update:Updates Yarn to the latest version.' \
'upgrade:Upgrades packages to their latest version based on the specified range.' \
'why:<query> - Show information about why a package is installed.'
)
_arguments \
'*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "yarn subcommand" _1st_arguments
return
fi
case "$words[1]" in
add)
_arguments \
$_dopts \
$_dev \
$_production
;;
install)
_arguments \
$_installopts \
$_dopts \
$_dev \
$_no_color \
$_production
;;
update)
_arguments \
$_dopts
;;
remove)
_arguments \
$_dopts
;;
*)
_arguments \
;;
esac
}
compdef _yarn yarn
# Yum plugin
This plugin adds useful aliases for common [Yum](http://yum.baseurl.org/) commands.
To use it, add `yum` to the plugins array in your zshrc file:
```
plugins=(... yum)
```
## Aliases
| Alias | Command | Description |
|-------|-----------------------------------|------------------------------|
| ys | `yum search` | Search package |
| yp | `yum info` | Show package info |
| yl | `yum list` | List packages |
| ygl | `yum grouplist` | List package groups |
| yli | `yum list installed` | Print all installed packages |
| ymc | `yum makecache` | Rebuild the yum package list |
| yu | `sudo yum update` | Upgrade packages |
| yi | `sudo yum install` | Install package |
| ygi | `sudo yum groupinstall` | Install package group |
| yr | `sudo yum remove` | Remove package |
| ygr | `sudo yum groupremove` | Remove pagage group |
| yrl | `sudo yum remove --remove-leaves` | Remove package and leaves |
| yc | `sudo yum clean all` | Clean yum cache |
...@@ -22,6 +22,9 @@ OPTIONS ...@@ -22,6 +22,9 @@ OPTIONS
\fB\-c\fR \fB\-c\fR
restrict matches to subdirectories of the current directory restrict matches to subdirectories of the current directory
.TP .TP
\fB\-e\fR
echo the best match, don't cd
.TP
\fB\-h\fR \fB\-h\fR
show a brief help message show a brief help message
.TP .TP
...@@ -90,7 +93,8 @@ Set \fB$_Z_OWNER\fR to allow usage when in 'sudo -s' mode. ...@@ -90,7 +93,8 @@ Set \fB$_Z_OWNER\fR to allow usage when in 'sudo -s' mode.
(These settings should go in .bashrc/.zshrc before the line added above.) (These settings should go in .bashrc/.zshrc before the line added above.)
.RE .RE
.RS .RS
Install the provided man page \fBz.1\fR somewhere like \fB/usr/local/man/man1\fR. Install the provided man page \fBz.1\fR somewhere in your \f$MANPATH, like
\fB/usr/local/man/man1\fR.
.RE .RE
.SS .SS
Aging: Aging:
......
# Copyright (c) 2009 rupa deadwyler under the WTFPL license # Copyright (c) 2009 rupa deadwyler. Licensed under the WTFPL license, Version 2
# maintains a jump-list of the directories you actually use # maintains a jump-list of the directories you actually use
# #
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
# * z -r foo # cd to highest ranked dir matching foo # * z -r foo # cd to highest ranked dir matching foo
# * z -t foo # cd to most recently accessed dir matching foo # * z -t foo # cd to most recently accessed dir matching foo
# * z -l foo # list matches instead of cd # * z -l foo # list matches instead of cd
# * z -e foo # echo the best match, don't cd
# * z -c foo # restrict matches to subdirs of $PWD # * z -c foo # restrict matches to subdirs of $PWD
[ -d "${_Z_DATA:-$HOME/.z}" ] && { [ -d "${_Z_DATA:-$HOME/.z}" ] && {
...@@ -31,9 +32,21 @@ _z() { ...@@ -31,9 +32,21 @@ _z() {
local datafile="${_Z_DATA:-$HOME/.z}" local datafile="${_Z_DATA:-$HOME/.z}"
# if symlink, dereference
[ -h "$datafile" ] && datafile=$(readlink "$datafile")
# bail if we don't own ~/.z and $_Z_OWNER not set # bail if we don't own ~/.z and $_Z_OWNER not set
[ -z "$_Z_OWNER" -a -f "$datafile" -a ! -O "$datafile" ] && return [ -z "$_Z_OWNER" -a -f "$datafile" -a ! -O "$datafile" ] && return
_z_dirs () {
local line
while read line; do
# only count directories
[ -d "${line%%\|*}" ] && echo "$line"
done < "$datafile"
return 0
}
# add entries # add entries
if [ "$1" = "--add" ]; then if [ "$1" = "--add" ]; then
shift shift
...@@ -49,10 +62,7 @@ _z() { ...@@ -49,10 +62,7 @@ _z() {
# maintain the data file # maintain the data file
local tempfile="$datafile.$RANDOM" local tempfile="$datafile.$RANDOM"
while read line; do _z_dirs | awk -v path="$*" -v now="$(date +%s)" -F"|" '
# only count directories
[ -d "${line%%\|*}" ] && echo $line
done < "$datafile" | awk -v path="$*" -v now="$(date +%s)" -F"|" '
BEGIN { BEGIN {
rank[path] = 1 rank[path] = 1
time[path] = now time[path] = now
...@@ -75,7 +85,7 @@ _z() { ...@@ -75,7 +85,7 @@ _z() {
} else for( x in rank ) print x "|" rank[x] "|" time[x] } else for( x in rank ) print x "|" rank[x] "|" time[x]
} }
' 2>/dev/null >| "$tempfile" ' 2>/dev/null >| "$tempfile"
# do our best to avoid clobbering the datafile in a race condition # do our best to avoid clobbering the datafile in a race condition.
if [ $? -ne 0 -a -f "$datafile" ]; then if [ $? -ne 0 -a -f "$datafile" ]; then
env rm -f "$tempfile" env rm -f "$tempfile"
else else
...@@ -85,17 +95,15 @@ _z() { ...@@ -85,17 +95,15 @@ _z() {
# tab completion # tab completion
elif [ "$1" = "--complete" -a -s "$datafile" ]; then elif [ "$1" = "--complete" -a -s "$datafile" ]; then
while read line; do _z_dirs | awk -v q="$2" -F"|" '
[ -d "${line%%\|*}" ] && echo $line
done < "$datafile" | awk -v q="$2" -F"|" '
BEGIN { BEGIN {
if( q == tolower(q) ) imatch = 1
q = substr(q, 3) q = substr(q, 3)
gsub(" ", ".*", q) if( q == tolower(q) ) imatch = 1
gsub(/ /, ".*", q)
} }
{ {
if( imatch ) { if( imatch ) {
if( tolower($1) ~ tolower(q) ) print $1 if( tolower($1) ~ q ) print $1
} else if( $1 ~ q ) print $1 } else if( $1 ~ q ) print $1
} }
' 2>/dev/null ' 2>/dev/null
...@@ -106,11 +114,12 @@ _z() { ...@@ -106,11 +114,12 @@ _z() {
--) while [ "$1" ]; do shift; local fnd="$fnd${fnd:+ }$1";done;; --) while [ "$1" ]; do shift; local fnd="$fnd${fnd:+ }$1";done;;
-*) local opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in -*) local opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in
c) local fnd="^$PWD $fnd";; c) local fnd="^$PWD $fnd";;
h) echo "${_Z_CMD:-z} [-chlrtx] args" >&2; return;; e) local echo=1;;
x) sed -i -e "\:^${PWD}|.*:d" "$datafile";; h) echo "${_Z_CMD:-z} [-cehlrtx] args" >&2; return;;
l) local list=1;; l) local list=1;;
r) local typ="rank";; r) local typ="rank";;
t) local typ="recent";; t) local typ="recent";;
x) sed -i -e "\:^${PWD}|.*:d" "$datafile";;
esac; opt=${opt:1}; done;; esac; opt=${opt:1}; done;;
*) local fnd="$fnd${fnd:+ }$1";; *) local fnd="$fnd${fnd:+ }$1";;
esac; local last=$1; [ "$#" -gt 0 ] && shift; done esac; local last=$1; [ "$#" -gt 0 ] && shift; done
...@@ -119,16 +128,14 @@ _z() { ...@@ -119,16 +128,14 @@ _z() {
# if we hit enter on a completion just go there # if we hit enter on a completion just go there
case "$last" in case "$last" in
# completions will always start with / # completions will always start with /
/*) [ -z "$list" -a -d "$last" ] && cd "$last" && return;; /*) [ -z "$list" -a -d "$last" ] && builtin cd "$last" && return;;
esac esac
# no file yet # no file yet
[ -f "$datafile" ] || return [ -f "$datafile" ] || return
local cd local cd
cd="$(while read line; do cd="$( < <( _z_dirs ) awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" '
[ -d "${line%%\|*}" ] && echo $line
done < "$datafile" | awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" '
function frecent(rank, time) { function frecent(rank, time) {
# relate frequency and time # relate frequency and time
dx = t - time dx = t - time
...@@ -137,19 +144,21 @@ _z() { ...@@ -137,19 +144,21 @@ _z() {
if( dx < 604800 ) return rank / 2 if( dx < 604800 ) return rank / 2
return rank / 4 return rank / 4
} }
function output(files, out, common) { function output(matches, best_match, common) {
# list or return the desired directory # list or return the desired directory
if( list ) { if( list ) {
cmd = "sort -n >&2" cmd = "sort -n >&2"
for( x in files ) { for( x in matches ) {
if( files[x] ) printf "%-10s %s\n", files[x], x | cmd if( matches[x] ) {
printf "%-10s %s\n", matches[x], x | cmd
}
} }
if( common ) { if( common ) {
printf "%-10s %s\n", "common:", common > "/dev/stderr" printf "%-10s %s\n", "common:", common > "/dev/stderr"
} }
} else { } else {
if( common ) out = common if( common ) best_match = common
print out print best_match
} }
} }
function common(matches) { function common(matches) {
...@@ -160,11 +169,9 @@ _z() { ...@@ -160,11 +169,9 @@ _z() {
} }
} }
if( short == "/" ) return if( short == "/" ) return
# use a copy to escape special characters, as we want to return for( x in matches ) if( matches[x] && index(x, short) != 1 ) {
# the original. yeah, this escaping is awful. return
clean_short = short }
gsub(/\[\(\)\[\]\|\]/, "\\\\&", clean_short)
for( x in matches ) if( matches[x] && x !~ clean_short ) return
return short return short
} }
BEGIN { BEGIN {
...@@ -197,8 +204,10 @@ _z() { ...@@ -197,8 +204,10 @@ _z() {
} }
} }
')" ')"
[ $? -gt 0 ] && return
[ "$cd" ] && cd "$cd" [ $? -eq 0 ] && [ "$cd" ] && {
if [ "$echo" ]; then echo "$cd"; else builtin cd "$cd"; fi
}
fi fi
} }
...@@ -212,11 +221,11 @@ if type compctl >/dev/null 2>&1; then ...@@ -212,11 +221,11 @@ if type compctl >/dev/null 2>&1; then
# populate directory list, avoid clobbering any other precmds. # populate directory list, avoid clobbering any other precmds.
if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then
_z_precmd() { _z_precmd() {
_z --add "${PWD:a}" (_z --add "${PWD:a}" &)
} }
else else
_z_precmd() { _z_precmd() {
_z --add "${PWD:A}" (_z --add "${PWD:A}" &)
} }
fi fi
[[ -n "${precmd_functions[(r)_z_precmd]}" ]] || { [[ -n "${precmd_functions[(r)_z_precmd]}" ]] || {
...@@ -237,7 +246,7 @@ elif type complete >/dev/null 2>&1; then ...@@ -237,7 +246,7 @@ elif type complete >/dev/null 2>&1; then
[ "$_Z_NO_PROMPT_COMMAND" ] || { [ "$_Z_NO_PROMPT_COMMAND" ] || {
# populate directory list. avoid clobbering other PROMPT_COMMANDs. # populate directory list. avoid clobbering other PROMPT_COMMANDs.
grep "_z --add" <<< "$PROMPT_COMMAND" >/dev/null || { grep "_z --add" <<< "$PROMPT_COMMAND" >/dev/null || {
PROMPT_COMMAND="$PROMPT_COMMAND"$'\n''_z --add "$(command pwd '$_Z_RESOLVE_SYMLINKS' 2>/dev/null)" 2>/dev/null;' PROMPT_COMMAND="$PROMPT_COMMAND"$'\n''(_z --add "$(command pwd '$_Z_RESOLVE_SYMLINKS' 2>/dev/null)" 2>/dev/null &);'
} }
} }
fi fi
...@@ -2,33 +2,97 @@ ...@@ -2,33 +2,97 @@
#autoload #autoload
# in order to make this work, you will need to have the gem zeus installed # in order to make this work, you will need to have the gem zeus installed
# zeus zsh completion
# zeus zsh completion, based on adb completion
local -a _1st_arguments local -a _1st_arguments
_1st_arguments=( if [[ -e .zeus.sock ]]; then
'console:Lets you interact with your Rails application from the command line. (alias = c)' _1st_arguments=(
'cucumber:Runs cucumber.' 'console:Lets you interact with your Rails application from the command line. (alias = c)'
'dbconsole:Figures out which database you are using and drops you into whichever command line interface.' 'cucumber:Runs cucumber.'
'destroy:Figures out what generate did, and undoes it. (alias = d)' 'dbconsole:Figures out which database you are using and drops you into whichever command line interface.'
'generate:Uses templates to create a whole lot of things. (alias = g)' 'destroy:Figures out what generate did, and undoes it. (alias = d)'
'rake:Execute rake tasks.' 'generate:Uses templates to create a whole lot of things. (alias = g)'
'runner:Runs Ruby code in the context of Rails non-interactively. (alias = r)' 'rake:Execute rake tasks.'
'server:Launches a small web server named WEBrick which comes bundled with Ruby. (alias = s)' 'runner:Runs Ruby code in the context of Rails non-interactively. (alias = r)'
'start:Preloads the zeus environment' 'server:Launches a small web server named WEBrick which comes bundled with Ruby. (alias = s)'
'test:Runs RSpec tests. (alias = rspec, testrb)' 'test:Runs RSpec tests. (alias = rspec, testrb)'
'version:Shows the version number.' 'version:Shows the version number.'
) )
else
_1st_arguments=(
'start:Preloads the zeus environment'
'init:Generate a zeus.json file'
)
fi
_rails_generate_arguments() {
generate_arguments=(
controller
generator
helper
integration_test
mailer
migration
model
observer
performance_test
plugin
resource
scaffold
scaffold_controller
session_migration
stylesheets
)
}
_rake_does_task_list_need_generating () {
if [ ! -f .rake_tasks ]; then return 0;
else
accurate=$(stat -f%m .rake_tasks)
changed=$(stat -f%m Rakefile)
return $(expr $accurate '>=' $changed)
fi
}
_zrake ()
{
local expl
declare -a tasks
if [ -f Rakefile ]; then
if _rake_does_task_list_need_generating; then
echo "\nGenerating .rake_tasks..." > /dev/stderr
rake --silent --tasks | cut -d " " -f 2 > .rake_tasks
fi
tasks=(`cat .rake_tasks`)
_wanted tasks expl 'rake' compadd $tasks
fi
}
local expl local expl
local -a pkgs installed_pkgs local curcontext="$curcontext" state line
typeset -A opt_args
_arguments \ _arguments -C \
'*:: :->subcmds' && return 0 ':command:->command' \
'*::options:->options'
if (( CURRENT == 1 )); then
_describe -t commands "zeus subcommand" _1st_arguments
return
fi
_files case $state in
(command)
_describe -t commands "zeus subcommand" _1st_arguments
return
;;
(options)
case $line[1] in
(rake)
_zrake
;;
(generate|g|destroy|d)
_rails_generate_arguments
_wanted generate_arguments expl 'all generate' compadd -a generate_arguments
;;
esac
;;
esac
...@@ -27,7 +27,7 @@ GPLv3 License ...@@ -27,7 +27,7 @@ GPLv3 License
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007 Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
...@@ -671,7 +671,7 @@ the "copyright" line and a pointer to where the full notice is found. ...@@ -671,7 +671,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail. Also add information on how to contact you by electronic and paper mail.
...@@ -690,11 +690,11 @@ might be different; for a GUI interface, you would use an "about box". ...@@ -690,11 +690,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school, You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary. if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>. <https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>. <https://www.gnu.org/philosophy/why-not-lgpl.html>.
File mode changed from 100755 to 100644
# zsh_reload plugin
The zsh_reload plugin defines a function to reload the zsh session with
just a few keystrokes.
To use it, add `zsh_reload` to the plugins array in your zshrc file:
```zsh
plugins=(... zsh_reload)
```
## Usage
To reload the zsh session, just run `src`:
```zsh
$ vim ~/.zshrc # enabled a plugin
$ src
re-compiling /home/user/.zshrc.zwc: succeeded
re-compiling /home/user/.oh-my-zsh/cache/zcomp-host.zwc: succeeded
# you now have a fresh zsh session. happy hacking!
```
# reload zshrc src() {
function src() local cache="$ZSH_CACHE_DIR"
{ autoload -U compinit zrecompile
local cache=$ZSH_CACHE_DIR compinit -i -d "$cache/zcomp-$HOST"
autoload -U compinit zrecompile
compinit -d "$cache/zcomp-$HOST"
for f in ~/.zshrc "$cache/zcomp-$HOST"; do for f in ~/.zshrc "$cache/zcomp-$HOST"; do
zrecompile -p $f && command rm -f $f.zwc.old zrecompile -p $f && command rm -f $f.zwc.old
done done
source ~/.zshrc # Use $SHELL if available; remove leading dash if login shell
[[ -n "$SHELL" ]] && exec ${SHELL#-} || exec zsh
} }
...@@ -4,23 +4,23 @@ ...@@ -4,23 +4,23 @@
# Path to your oh-my-zsh installation. # Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random" # Set name of the theme to load --- if set to "random", it will
# it'll load a random theme each time that oh-my-zsh is loaded. # load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell" ZSH_THEME="robbyrussell"
# Set list of themes to load # Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random # Setting this variable when ZSH_THEME=random will cause zsh to load
# cause zsh load theme from this variable instead of # a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# looking in ~/.oh-my-zsh/themes/ # If set to an empty array, this variable will have no effect.
# An empty array have no effect
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion. # Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true" # CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case # Uncomment the following line to use hyphen-insensitive completion.
# sensitive completion must be off. _ and - will be interchangeable. # Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true" # HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks. # Uncomment the following line to disable bi-weekly auto-update checks.
...@@ -48,13 +48,17 @@ ZSH_THEME="robbyrussell" ...@@ -48,13 +48,17 @@ ZSH_THEME="robbyrussell"
# Uncomment the following line if you want to change the command execution time # Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output. # stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" # You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy" # HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom? # Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder # ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse) # Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup. # Add wisely, as too many plugins slow down shell startup.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# # a) displaying a pseudo-random message from a database of quotations # # a) displaying a pseudo-random message from a database of quotations
# # (https://en.wikipedia.org/wiki/Fortune_%28Unix%29) # # (https://en.wikipedia.org/wiki/Fortune_%28Unix%29)
# # b) displaying randomly command line tips from The command line fu # # b) displaying randomly command line tips from The command line fu
# # (http://www.commandlinefu.com) community: in order to make use of this functionality # # (https://www.commandlinefu.com) community: in order to make use of this functionality
# # you will need Internet connection. # # you will need Internet connection.
# # This theme provides as well information for the current user's context, like; # # This theme provides as well information for the current user's context, like;
# # branch and status for the current version control system (git and svn currently # # branch and status for the current version control system (git and svn currently
...@@ -23,11 +23,11 @@ ...@@ -23,11 +23,11 @@
# # optionally: # # optionally:
# # -Oh-myzsh vcs plug-ins git and svn. # # -Oh-myzsh vcs plug-ins git and svn.
# # -Solarized theme (https://github.com/altercation/solarized/) # # -Solarized theme (https://github.com/altercation/solarized/)
# # -OS X: iTerm 2 (http://www.iterm2.com/) # # -OS X: iTerm 2 (https://iterm2.com/)
# # -font Source code pro (https://github.com/adobe/source-code-pro) # # -font Source code pro (https://github.com/adobe/source-code-pro)
# # # #
# # This theme's look and feel is based on the Aaron Toponce's zsh theme, more info: # # This theme's look and feel is based on the Aaron Toponce's zsh theme, more info:
# # http://pthree.org/2008/11/23/727/ # # https://pthree.org/2008/11/23/727/
# # enjoy! # # enjoy!
########## COLOR ########### ########## COLOR ###########
for COLOR in CYAN WHITE YELLOW MAGENTA BLACK BLUE RED DEFAULT GREEN GREY; do for COLOR in CYAN WHITE YELLOW MAGENTA BLACK BLUE RED DEFAULT GREEN GREY; do
......
...@@ -13,9 +13,13 @@ ...@@ -13,9 +13,13 @@
# #
# In addition, I recommend the # In addition, I recommend the
# [Solarized theme](https://github.com/altercation/solarized/) and, if you're # [Solarized theme](https://github.com/altercation/solarized/) and, if you're
# using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over Terminal.app - # using it on Mac OS X, [iTerm 2](https://iterm2.com/) over Terminal.app -
# it has significantly better color fidelity. # it has significantly better color fidelity.
# #
# If using with "light" variant of the Solarized color schema, set
# SOLARIZED_THEME variable to "light". If you don't specify, we'll assume
# you're using the "dark" variant.
#
# # Goals # # Goals
# #
# The aim of this theme is to only show you *relevant* information. Like most # The aim of this theme is to only show you *relevant* information. Like most
...@@ -30,6 +34,11 @@ ...@@ -30,6 +34,11 @@
CURRENT_BG='NONE' CURRENT_BG='NONE'
case ${SOLARIZED_THEME:-dark} in
light) CURRENT_FG='white';;
*) CURRENT_FG='black';;
esac
# Special Powerline characters # Special Powerline characters
() { () {
...@@ -80,28 +89,31 @@ prompt_end() { ...@@ -80,28 +89,31 @@ prompt_end() {
# Context: user@hostname (who am I and where am I) # Context: user@hostname (who am I and where am I)
prompt_context() { prompt_context() {
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m" prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m"
fi fi
} }
# Git: branch/detached head, dirty status # Git: branch/detached head, dirty status
prompt_git() { prompt_git() {
(( $+commands[git] )) || return (( $+commands[git] )) || return
if [[ "$(git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]]; then
return
fi
local PL_BRANCH_CHAR local PL_BRANCH_CHAR
() { () {
local LC_ALL="" LC_CTYPE="en_US.UTF-8" local LC_ALL="" LC_CTYPE="en_US.UTF-8"
PL_BRANCH_CHAR=$'\ue0a0' #  PL_BRANCH_CHAR=$'\ue0a0' # 
} }
local ref dirty mode repo_path local ref dirty mode repo_path
repo_path=$(git rev-parse --git-dir 2>/dev/null)
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
repo_path=$(git rev-parse --git-dir 2>/dev/null)
dirty=$(parse_git_dirty) dirty=$(parse_git_dirty)
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)" ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
if [[ -n $dirty ]]; then if [[ -n $dirty ]]; then
prompt_segment yellow black prompt_segment yellow black
else else
prompt_segment green black prompt_segment green $CURRENT_FG
fi fi
if [[ -e "${repo_path}/BISECT_LOG" ]]; then if [[ -e "${repo_path}/BISECT_LOG" ]]; then
...@@ -151,7 +163,7 @@ prompt_bzr() { ...@@ -151,7 +163,7 @@ prompt_bzr() {
prompt_hg() { prompt_hg() {
(( $+commands[hg] )) || return (( $+commands[hg] )) || return
local rev status local rev st branch
if $(hg id >/dev/null 2>&1); then if $(hg id >/dev/null 2>&1); then
if $(hg prompt >/dev/null 2>&1); then if $(hg prompt >/dev/null 2>&1); then
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
...@@ -164,7 +176,7 @@ prompt_hg() { ...@@ -164,7 +176,7 @@ prompt_hg() {
st='±' st='±'
else else
# if working copy is clean # if working copy is clean
prompt_segment green black prompt_segment green $CURRENT_FG
fi fi
echo -n $(hg prompt "☿ {rev}@{branch}") $st echo -n $(hg prompt "☿ {rev}@{branch}") $st
else else
...@@ -178,7 +190,7 @@ prompt_hg() { ...@@ -178,7 +190,7 @@ prompt_hg() {
prompt_segment yellow black prompt_segment yellow black
st='±' st='±'
else else
prompt_segment green black prompt_segment green $CURRENT_FG
fi fi
echo -n "☿ $rev@$branch" $st echo -n "☿ $rev@$branch" $st
fi fi
...@@ -187,7 +199,7 @@ prompt_hg() { ...@@ -187,7 +199,7 @@ prompt_hg() {
# Dir: current working directory # Dir: current working directory
prompt_dir() { prompt_dir() {
prompt_segment blue black '%~' prompt_segment blue $CURRENT_FG '%~'
} }
# Virtualenv: current working virtualenv # Virtualenv: current working virtualenv
...@@ -203,8 +215,8 @@ prompt_virtualenv() { ...@@ -203,8 +215,8 @@ prompt_virtualenv() {
# - am I root # - am I root
# - are there background jobs? # - are there background jobs?
prompt_status() { prompt_status() {
local symbols local -a symbols
symbols=()
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘" [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘"
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙" [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
......
...@@ -9,7 +9,7 @@ rbenv_version() { ...@@ -9,7 +9,7 @@ rbenv_version() {
} }
PROMPT=' PROMPT='
%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%} %{$fg_bold[green]%}%~%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%}
$ ' $ '
# Must use Powerline font, for \uE0A0 to render. # Must use Powerline font, for \uE0A0 to render.
......
...@@ -8,7 +8,7 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="" ...@@ -8,7 +8,7 @@ ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="*" ZSH_THEME_GIT_PROMPT_DIRTY="*"
ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_CLEAN=""
# See http://geoff.greer.fm/lscolors/ # See https://geoff.greer.fm/lscolors/
export LSCOLORS="exfxcxdxbxbxbxbxbxbxbx" export LSCOLORS="exfxcxdxbxbxbxbxbxbxbx"
export LS_COLORS="di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=31;40:cd=31;40:su=31;40:sg=31;40:tw=31;40:ow=31;40:" export LS_COLORS="di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=31;40:cd=31;40:su=31;40:sg=31;40:tw=31;40:ow=31;40:"
...@@ -50,9 +50,7 @@ function _ruby_version() { ...@@ -50,9 +50,7 @@ function _ruby_version() {
# use a neutral color, otherwise colors will vary according to time. # use a neutral color, otherwise colors will vary according to time.
function _git_time_since_commit() { function _git_time_since_commit() {
# Only proceed if there is actually a commit. # Only proceed if there is actually a commit.
if git log -1 > /dev/null 2>&1; then if last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null); then
# Get the last commit.
last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null)
now=$(date +%s) now=$(date +%s)
seconds_since_last_commit=$((now-last_commit)) seconds_since_last_commit=$((now-last_commit))
...@@ -65,7 +63,7 @@ function _git_time_since_commit() { ...@@ -65,7 +63,7 @@ function _git_time_since_commit() {
sub_hours=$((hours % 24)) sub_hours=$((hours % 24))
sub_minutes=$((minutes % 60)) sub_minutes=$((minutes % 60))
if [ $hours -gt 24 ]; then if [ $hours -ge 24 ]; then
commit_age="${days}d" commit_age="${days}d"
elif [ $minutes -gt 60 ]; then elif [ $minutes -gt 60 ]; then
commit_age="${sub_hours}h${sub_minutes}m" commit_age="${sub_hours}h${sub_minutes}m"
...@@ -104,7 +102,7 @@ ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" ...@@ -104,7 +102,7 @@ ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[white]%}" ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[white]%}"
# LS colors, made with http://geoff.greer.fm/lscolors/ # LS colors, made with https://geoff.greer.fm/lscolors/
export LSCOLORS="exfxcxdxbxegedabagacad" export LSCOLORS="exfxcxdxbxegedabagacad"
export LS_COLORS='di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:' export LS_COLORS='di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:'
export GREP_COLOR='1;33' export GREP_COLOR='1;33'
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png # ZSH Theme - Preview: https://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
......
...@@ -17,7 +17,7 @@ function box_name { ...@@ -17,7 +17,7 @@ function box_name {
} }
PROMPT=' PROMPT='
%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}$(box_name)%{$reset_color%}:%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(hg_prompt_info)$(git_prompt_info) %{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}$(box_name)%{$reset_color%}:%{$fg_bold[green]%}%~%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)
%(?,,%{${fg_bold[white]}%}[%?]%{$reset_color%} )$ ' %(?,,%{${fg_bold[white]}%}[%?]%{$reset_color%} )$ '
ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[magenta]%}branch: " ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[magenta]%}branch: "
......
...@@ -9,6 +9,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} " ...@@ -9,6 +9,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✗" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✗"
# LS colors, made with http://geoff.greer.fm/lscolors/ # LS colors, made with https://geoff.greer.fm/lscolors/
export LSCOLORS="Gxfxcxdxbxegedabagacad" export LSCOLORS="Gxfxcxdxbxegedabagacad"
export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:'
...@@ -6,5 +6,5 @@ PROMPT='%{$fg_bold[cyan]%}$ZSH_THEME_CLOUD_PREFIX %{$fg_bold[green]%}%p %{$fg[gr ...@@ -6,5 +6,5 @@ PROMPT='%{$fg_bold[cyan]%}$ZSH_THEME_CLOUD_PREFIX %{$fg_bold[green]%}%p %{$fg[gr
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$fg[cyan]%}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$fg[cyan]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}] %{$fg[yellow]%}⚡%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}] %{$fg[yellow]%}⚡ %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]"
\ No newline at end of file
...@@ -9,7 +9,7 @@ function virtualenv_info { ...@@ -9,7 +9,7 @@ function virtualenv_info {
} }
PROMPT=' PROMPT='
%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) %{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}%~%{$reset_color%}$(git_prompt_info)
$(virtualenv_info)$(prompt_char) ' $(virtualenv_info)$(prompt_char) '
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}"
......
# user, host, full path, and time/date # user, host, full path, and time/date
# on two lines for easier vgrepping # on two lines for easier vgrepping
# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 # entry in a nice long thread on the Arch Linux forums: https://bbs.archlinux.org/viewtopic.php?pid=521888#p521888
PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;34m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}%!%{\e[0;34m%}%B]%b%{\e[0m%} PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;34m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}%!%{\e[0;34m%}%B]%b%{\e[0m%}
%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]%{\e[0m%}%b ' %{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]%{\e[0m%}%b '
RPROMPT='[%*]' RPROMPT='[%*]'
......
...@@ -68,6 +68,10 @@ prompt_glyph="%{%(#.${root_prompt}.${user_prompt}) %2G%}" ...@@ -68,6 +68,10 @@ prompt_glyph="%{%(#.${root_prompt}.${user_prompt}) %2G%}"
setopt promptsubst setopt promptsubst
# Workaround for zsh 5.2 release (kudos to @timothybasanov)
autoload +X VCS_INFO_nvcsformats
functions[VCS_INFO_nvcsformats]=${functions[VCS_INFO_nvcsformats]/local -a msgs/}
autoload -U add-zsh-hook autoload -U add-zsh-hook
autoload -Uz vcs_info autoload -Uz vcs_info
......
...@@ -25,12 +25,15 @@ function box_name { ...@@ -25,12 +25,15 @@ function box_name {
} }
local rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}' rvm_ruby=''
local current_dir='${PWD/#$HOME/~}' if type rvm-prompt &>/dev/null; then
rvm_ruby='using%{$FG[243]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
fi
local git_info='$(git_prompt_info)' local git_info='$(git_prompt_info)'
PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}using%{$FG[243]%} ${rvm_ruby} %D - %* PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}%~%{$reset_color%}${git_info} %{$FG[239]%}${rvm_ruby} %D - %*
╰─$(virtualenv_info)$(prompt_char) " ╰─$(virtualenv_info)$(prompt_char) "
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}" ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}"
......
...@@ -22,19 +22,18 @@ function box_name { ...@@ -22,19 +22,18 @@ function box_name {
local ruby_env='' local ruby_env=''
if which rvm-prompt &> /dev/null; then if which rvm-prompt &> /dev/null; then
ruby_env=' ‹$(rvm-prompt i v g)›%{$reset_color%}' ruby_env='using%{$FG[243]%} ‹$(rvm-prompt i v g)›%{$reset_color%}'
else else
if which rbenv &> /dev/null; then if which rbenv &> /dev/null; then
ruby_env=' ‹$(rbenv version-name)›%{$reset_color%}' ruby_env='using%{$FG[243]%} ‹$(rbenv version-name)›%{$reset_color%}'
fi fi
fi fi
local current_dir='${PWD/#$HOME/~}'
local git_info='$(git_prompt_info)' local git_info='$(git_prompt_info)'
local prompt_char='$(prompt_char)' local prompt_char='$(prompt_char)'
PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}using%{$FG[243]%}${ruby_env} PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}%~%{$reset_color%}${git_info} %{$FG[239]%}${ruby_env}
╰─${prompt_char}%{$reset_color%} " ╰─${prompt_char}%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}" ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}"
......
# Taken from Tassilo's Blog # Taken from Tassilo's Blog
# http://tsdh.wordpress.com/2007/12/06/my-funky-zsh-prompt/ # https://tsdh.wordpress.com/2007/12/06/my-funky-zsh-prompt/
local blue_op="%{$fg[blue]%}[%{$reset_color%}" local blue_op="%{$fg[blue]%}[%{$reset_color%}"
local blue_cp="%{$fg[blue]%}]%{$reset_color%}" local blue_cp="%{$fg[blue]%}]%{$reset_color%}"
...@@ -11,4 +11,4 @@ local smiley="%(?,%{$fg[green]%}:%)%{$reset_color%},%{$fg[red]%}:(%{$reset_color ...@@ -11,4 +11,4 @@ local smiley="%(?,%{$fg[green]%}:%)%{$reset_color%},%{$fg[red]%}:(%{$reset_color
PROMPT="╭─${path_p}─${user_host}─${ret_status}─${hist_no} PROMPT="╭─${path_p}─${user_host}─${ret_status}─${hist_no}
╰─${blue_op}${smiley}${blue_cp} %# " ╰─${blue_op}${smiley}${blue_cp} %# "
local cur_cmd="${blue_op}%_${blue_cp}" local cur_cmd="${blue_op}%_${blue_cp}"
PROMPT2="${cur_cmd}> " PROMPT2="${cur_cmd}> "
\ No newline at end of file
# ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png
# Based on bira theme # Based on bira theme
setopt prompt_subst setopt prompt_subst
......
# prompt style and colors based on Steve Losh's Prose theme: # prompt style and colors based on Steve Losh's Prose theme:
# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme # https://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme
# #
# vcs_info modifications from Bart Trojanowski's zsh prompt: # vcs_info modifications from Bart Trojanowski's zsh prompt:
# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt # http://www.jukie.net/bart/blog/pimping-out-zsh-prompt
# #
# git untracked files modification from Brian Carper: # git untracked files modification from Brian Carper:
# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt # https://briancarper.net/blog/570/git-info-in-your-zsh-prompt
function virtualenv_info { function virtualenv_info {
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
...@@ -60,7 +60,7 @@ zstyle ':vcs_info:*:prompt:*' nvcsformats "" ...@@ -60,7 +60,7 @@ zstyle ':vcs_info:*:prompt:*' nvcsformats ""
function steeef_preexec { function steeef_preexec {
case "$(history $HISTCMD)" in case "$2" in
*git*) *git*)
PR_GIT_UPDATE=1 PR_GIT_UPDATE=1
;; ;;
......
# Inspired by http://peepcode.com/blog/2012/my-command-line-prompt
local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})" local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})"
local user="%{$fg[cyan]%}%n%{$reset_color%}" local user="%{$fg[cyan]%}%n%{$reset_color%}"
......
# ZSH Theme - Preview: http://dl.dropbox.com/u/1552408/Screenshots/2010-04-08-oh-my-zsh.png
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
......
# ZSH Theme - Preview: http://cl.ly/350F0F0k1M2y3A2i3p1S
PROMPT='λ %~/ $(git_prompt_info)%{$reset_color%}' PROMPT='λ %~/ $(git_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
......
# ZSH Theme - Preview: http://cl.ly/f701d00760f8059e06dc # ZSH Theme - Preview: https://cl.ly/f701d00760f8059e06dc
# Thanks to gallifrey, upon whose theme this is based # Thanks to gallifrey, upon whose theme this is based
local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})" local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})"
......
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png # ZSH Theme - Preview: https://i.gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
if [ -e ~/.rvm/bin/rvm-prompt ]; then if [ -e ~/.rvm/bin/rvm-prompt ]; then
......
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png # ZSH Theme - Preview: https://i.gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
if [ -e ~/.rvm/bin/rvm-prompt ]; then if [ -e ~/.rvm/bin/rvm-prompt ]; then
......
# mh theme # mh theme
# preview: http://cl.ly/1y2x0W0E3t2C0F29043z # preview: https://cl.ly/1y2x0W0E3t2C0F29043z
# features: # features:
# path is autoshortened to ~30 characters # path is autoshortened to ~30 characters
...@@ -19,6 +19,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[gray]%})%{$reset_color%} " ...@@ -19,6 +19,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[gray]%})%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✱" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✱"
# LS colors, made with http://geoff.greer.fm/lscolors/ # LS colors, made with https://geoff.greer.fm/lscolors/
export LSCOLORS="Gxfxcxdxbxegedabagacad" export LSCOLORS="Gxfxcxdxbxegedabagacad"
export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:'
# Michele Bologna's theme # Michele Bologna's theme
# http://michelebologna.net # https://www.michelebologna.net
# #
# This a theme for oh-my-zsh. Features a colored prompt with: # This a theme for oh-my-zsh. Features a colored prompt with:
# * username@host: [jobs] [git] workdir % # * username@host: [jobs] [git] workdir %
# * hostname color is based on hostname characters. When using as root, the # * hostname color is based on hostname characters. When using as root, the
# prompt shows only the hostname in red color. # prompt shows only the hostname in red color.
# * [jobs], if applicable, counts the number of suspended jobs tty # * [jobs], if applicable, counts the number of suspended jobs tty
# * [git], if applicable, represents the status of your git repo (more on that # * [git], if applicable, represents the status of your git repo (more on that
# later) # later)
# * '%' prompt will be green if last command return value is 0, yellow otherwise. # * '%' prompt will be green if last command return value is 0, yellow otherwise.
# #
# git prompt is inspired by official git contrib prompt: # git prompt is inspired by official git contrib prompt:
# https://github.com/git/git/tree/master/contrib/completion/git-prompt.sh # https://github.com/git/git/tree/master/contrib/completion/git-prompt.sh
# and it adds: # and it adds:
# * the current branch # * the current branch
......
...@@ -15,7 +15,7 @@ mikeh_precmd() { ...@@ -15,7 +15,7 @@ mikeh_precmd() {
# user, host, full path, and time/date # user, host, full path, and time/date
# on two lines for easier vgrepping # on two lines for easier vgrepping
# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 # entry in a nice long thread on the Arch Linux forums: https://bbs.archlinux.org/viewtopic.php?pid=521888#p521888
PROMPT=$'%{\e[0;34m%}%B..[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} PROMPT=$'%{\e[0;34m%}%B..[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%}
%{\e[0;34m%}%B..%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <($vcs_info_msg_0_)>%{\e[0m%}%b ' %{\e[0;34m%}%B..%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <($vcs_info_msg_0_)>%{\e[0m%}%b '
PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '
\ No newline at end of file
...@@ -9,6 +9,11 @@ function my_git_prompt() { ...@@ -9,6 +9,11 @@ function my_git_prompt() {
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
fi fi
# is branch behind?
if $(echo "$(git log HEAD..origin/$(git_current_branch) 2> /dev/null)" | grep '^commit' &> /dev/null); then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND"
fi
# is anything staged? # is anything staged?
if $(echo "$INDEX" | command grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then if $(echo "$INDEX" | command grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED" STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED"
...@@ -52,6 +57,7 @@ PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_pro ...@@ -52,6 +57,7 @@ PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_pro
ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}" ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}"
ZSH_THEME_GIT_PROMPT_PREFIX=" $fg[white]‹ %{$fg_bold[yellow]%}" ZSH_THEME_GIT_PROMPT_PREFIX=" $fg[white]‹ %{$fg_bold[yellow]%}"
ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[magenta]%}↑" ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[magenta]%}↑"
ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg_bold[green]%}↓"
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●" ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●"
ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[red]%}●" ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[red]%}●"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[white]%}●" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[white]%}●"
......
...@@ -9,6 +9,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} " ...@@ -9,6 +9,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_DIRTY="*" ZSH_THEME_GIT_PROMPT_DIRTY="*"
# LS colors, made with http://geoff.greer.fm/lscolors/ # LS colors, made with https://geoff.greer.fm/lscolors/
export LSCOLORS="Gxfxcxdxbxegedabagacad" export LSCOLORS="Gxfxcxdxbxegedabagacad"
export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:*.patch=00;34:*.o=00;32:*.so=01;35:*.ko=01;31:*.la=00;33' export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:*.patch=00;34:*.o=00;32:*.so=01;35:*.ko=01;31:*.la=00;33'
...@@ -11,6 +11,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " ...@@ -11,6 +11,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}*" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}*"
# LS colors, made with http://geoff.greer.fm/lscolors/ # LS colors, made with https://geoff.greer.fm/lscolors/
export LSCOLORS="Gxfxcxdxbxegedabagacad" export LSCOLORS="Gxfxcxdxbxegedabagacad"
export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:'
# user, host, full path, and time/date # user, host, full path, and time/date on two lines for easier vgrepping
# on two lines for easier vgrepping
# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888
function hg_prompt_info { function hg_prompt_info {
if (( $+commands[hg] )) && grep -q "prompt" ~/.hgrc; then
hg prompt --angle-brackets "\ hg prompt --angle-brackets "\
<hg:%{$fg[magenta]%}<branch>%{$reset_color%}><:%{$fg[magenta]%}<bookmark>%{$reset_color%}>\ <hg:%{$fg[magenta]%}<branch>%{$reset_color%}><:%{$fg[magenta]%}<bookmark>%{$reset_color%}>\
</%{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\ </%{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\
%{$fg[red]%}<status|modified|unknown><update>%{$reset_color%}< %{$fg[red]%}<status|modified|unknown><update>%{$reset_color%}<
patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null
fi
} }
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+" ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+"
...@@ -33,4 +33,3 @@ function retcode() {} ...@@ -33,4 +33,3 @@ function retcode() {}
PROMPT=$'%{$fg_bold[blue]%}┌─[%{$fg_bold[green]%}%n%b%{$fg[black]%}@%{$fg[cyan]%}%m%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%{$fg_bold[white]%}%~%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%b%{$fg[yellow]%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{$fg_bold[blue]%}] PROMPT=$'%{$fg_bold[blue]%}┌─[%{$fg_bold[green]%}%n%b%{$fg[black]%}@%{$fg[cyan]%}%m%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%{$fg_bold[white]%}%~%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%b%{$fg[yellow]%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{$fg_bold[blue]%}]
%{$fg_bold[blue]%}└─[%{$fg_bold[magenta]%}%?$(retcode)%{$fg_bold[blue]%}] <$(mygit)$(hg_prompt_info)>%{$reset_color%} ' %{$fg_bold[blue]%}└─[%{$fg_bold[magenta]%}%?$(retcode)%{$fg_bold[blue]%}] <$(mygit)$(hg_prompt_info)>%{$reset_color%} '
PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '
# user, host, full path, and time/date # user, host, full path, and time/date
# on two lines for easier vgrepping # on two lines for easier vgrepping
# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 # entry in a nice long thread on the Arch Linux forums: https://bbs.archlinux.org/viewtopic.php?pid=521888#p521888
function retcode() {} function retcode() {}
......
PROMPT='%{$fg[green]%}%~%{$fg_bold[blue]%}$(git_prompt_info)%{$reset_color%} ' PROMPT='%(!.%{$fg[red]%}.%{$fg[green]%})%~%{$fg_bold[blue]%}$(git_prompt_info)%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="(" ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=")" ZSH_THEME_GIT_PROMPT_SUFFIX=")"
......
# sorin.zsh-theme # sorin.zsh-theme
# screenshot: http://i.imgur.com/aipDQ.png # screenshot: https://i.imgur.com/aipDQ.png
if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then
MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}"
local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}" local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}"
PROMPT='%{$fg[cyan]%}%c$(git_prompt_info) %(!.%{$fg_bold[red]%}#.%{$fg_bold[green]%}❯)%{$reset_color%} ' PROMPT='%{$fg[cyan]%}%c$(git_prompt_info) %(!.%{$fg_bold[red]%}#.%{$fg_bold[green]%}❯)%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}git%{$reset_color%}:%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}git%{$reset_color%}:%{$fg[red]%}"
...@@ -20,10 +20,10 @@ if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then ...@@ -20,10 +20,10 @@ if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
else else
MODE_INDICATOR="❮❮❮" MODE_INDICATOR="❮❮❮"
local return_status="%(?::⏎)" local return_status="%(?::⏎)"
PROMPT='%c$(git_prompt_info) %(!.#.❯) ' PROMPT='%c$(git_prompt_info) %(!.#.❯) '
ZSH_THEME_GIT_PROMPT_PREFIX=" git:" ZSH_THEME_GIT_PROMPT_PREFIX=" git:"
......
# zsh theme requires 256 color enabled terminal # zsh theme requires 256 color enabled terminal
# i.e TERM=xterm-256color # i.e TERM=xterm-256color
# Preview - http://www.flickr.com/photos/adelcampo/4556482563/sizes/o/ # Preview - https://www.flickr.com/photos/adelcampo/4556482563/sizes/o/
# based on robbyrussell's shell but louder! # based on robbyrussell's shell but louder!
PROMPT='%{$fg_bold[blue]%}$(git_prompt_info) %F{208}%c%f PROMPT='%{$fg_bold[blue]%}$(git_prompt_info) %F{208}%c%f
......
# prompt style and colors based on Steve Losh's Prose theme: # prompt style and colors based on Steve Losh's Prose theme:
# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme # https://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme
# #
# vcs_info modifications from Bart Trojanowski's zsh prompt: # vcs_info modifications from Bart Trojanowski's zsh prompt:
# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt # http://www.jukie.net/bart/blog/pimping-out-zsh-prompt
# #
# git untracked files modification from Brian Carper: # git untracked files modification from Brian Carper:
# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt # https://briancarper.net/blog/570/git-info-in-your-zsh-prompt
export VIRTUAL_ENV_DISABLE_PROMPT=1 export VIRTUAL_ENV_DISABLE_PROMPT=1
...@@ -62,10 +62,13 @@ zstyle ':vcs_info:*:prompt:*' nvcsformats "" ...@@ -62,10 +62,13 @@ zstyle ':vcs_info:*:prompt:*' nvcsformats ""
function steeef_preexec { function steeef_preexec {
case "$(history $HISTCMD)" in case "$2" in
*git*) *git*)
PR_GIT_UPDATE=1 PR_GIT_UPDATE=1
;; ;;
*hub*)
PR_GIT_UPDATE=1
;;
*svn*) *svn*)
PR_GIT_UPDATE=1 PR_GIT_UPDATE=1
;; ;;
......
# Git-centric variation of the "fishy" theme. # Git-centric variation of the "fishy" theme.
# See screenshot at http://ompldr.org/vOHcwZg
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}+" ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}+"
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[magenta]%}!" ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[magenta]%}!"
......
...@@ -7,6 +7,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="" ...@@ -7,6 +7,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[blue]%})" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[blue]%})"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[yellow]%}✗%{$fg_bold[blue]%})" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[yellow]%}✗%{$fg_bold[blue]%})"
# LS colors, made with http://geoff.greer.fm/lscolors/ # LS colors, made with https://geoff.greer.fm/lscolors/
export LSCOLORS="Gxfxcxdxbxegedabagacad" export LSCOLORS="Gxfxcxdxbxegedabagacad"
export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:'
\ No newline at end of file
# trapd00r.zsh-theme # trapd00r.zsh-theme
# #
# This theme needs a terminal supporting 256 colors as well as unicode. It also # This theme needs a terminal supporting 256 colors as well as unicode.
# needs the script that splits up the current path and makes it fancy as located # In order to avoid external dependencies, it also has a zsh version of
# here: https://github.com/trapd00r/utils/blob/master/zsh_path # the perl script at https://github.com/trapd00r/utils/blob/master/zsh_path,
# which splits up the current path and makes it fancy.
# #
# By default it spans over two lines like so: # By default it spans over two lines like so:
# #
...@@ -20,37 +21,77 @@ ...@@ -20,37 +21,77 @@
autoload -U add-zsh-hook autoload -U add-zsh-hook
autoload -Uz vcs_info autoload -Uz vcs_info
local c0=$( printf "\e[m") local c0=$'\e[m'
local c1=$( printf "\e[38;5;245m") local c1=$'\e[38;5;245m'
local c2=$( printf "\e[38;5;250m") local c2=$'\e[38;5;250m'
local c3=$( printf "\e[38;5;242m") local c3=$'\e[38;5;242m'
local c4=$( printf "\e[38;5;197m") local c4=$'\e[38;5;197m'
local c5=$( printf "\e[38;5;225m") local c5=$'\e[38;5;225m'
local c6=$( printf "\e[38;5;240m") local c6=$'\e[38;5;240m'
local c7=$( printf "\e[38;5;242m") local c7=$'\e[38;5;242m'
local c8=$( printf "\e[38;5;244m") local c8=$'\e[38;5;244m'
local c9=$( printf "\e[38;5;162m") local c9=$'\e[38;5;162m'
local c10=$(printf "\e[1m") local c10=$'\e[1m'
local c11=$(printf "\e[38;5;208m\e[1m") local c11=$'\e[38;5;208m\e[1m'
local c12=$(printf "\e[38;5;142m\e[1m") local c12=$'\e[38;5;142m\e[1m'
local c13=$(printf "\e[38;5;196m\e[1m") local c13=$'\e[38;5;196m\e[1m'
# We don't want to use the extended colorset in the TTY / VC. zsh_path() {
if [ "$TERM" = "linux" ]; then local colors
c1=$( printf "\e[34;1m") colors=$(echoti colors)
c2=$( printf "\e[35m")
c3=$( printf "\e[31m") local -A yellow
c4=$( printf "\e[31;1m") yellow=(
c5=$( printf "\e[32m") 1 '%F{228}' 2 '%F{222}' 3 '%F{192}' 4 '%F{186}'
c6=$( printf "\e[32;1m") 5 '%F{227}' 6 '%F{221}' 7 '%F{191}' 8 '%F{185}'
c7=$( printf "\e[33m") 9 '%F{226}' 10 '%F{220}' 11 '%F{190}' 12 '%F{184}'
c8=$( printf "\e[33;1m") 13 '%F{214}' 14 '%F{178}' 15 '%F{208}' 16 '%F{172}'
c9=$( printf "\e[34m") 17 '%F{202}' 18 '%F{166}'
)
local dir i=1
for dir (${(s:/:)PWD}); do
if [[ $i -eq 1 ]]; then
if [[ $colors -ge 256 ]]; then
print -Pn "%F{065}%B /%b"
else
print -Pn "\e[31;1m /"
fi
else
if [[ $colors -ge 256 ]]; then
print -Pn "${yellow[$i]:-%f} » "
else
print -Pn "%F{yellow} > "
fi
fi
(( i++ ))
if [[ $colors -ge 256 ]]; then
print -Pn "%F{065}$dir"
else
print -Pn "%F{blue}$dir"
fi
done
print -Pn "%f"
}
c11=$(printf "\e[35;1m")
c12=$(printf "\e[36m") # We don't want to use the extended colorset in the TTY / VC.
c13=$(printf "\e[31;1m") if [ "$TERM" = linux ]; then
c1=$'\e[34;1m'
c2=$'\e[35m'
c3=$'\e[31m'
c4=$'\e[31;1m'
c5=$'\e[32m'
c6=$'\e[32;1m'
c7=$'\e[33m'
c8=$'\e[33;1m'
c9=$'\e[34m'
c11=$'\e[35;1m'
c12=$'\e[36m'
c13=$'\e[31;1m'
fi fi
zstyle ':vcs_info:*' actionformats \ zstyle ':vcs_info:*' actionformats \
...@@ -70,14 +111,12 @@ prompt_jnrowe_precmd () { ...@@ -70,14 +111,12 @@ prompt_jnrowe_precmd () {
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%}
> ' > '
# modified, to be committed
# modified, to be committed
elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%} PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%}
%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} %{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
> ' > '
elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%} PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%}
...@@ -88,7 +127,5 @@ prompt_jnrowe_precmd () { ...@@ -88,7 +127,5 @@ prompt_jnrowe_precmd () {
PROMPT='${vcs_info_msg_0_} PROMPT='${vcs_info_msg_0_}
%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} %{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
> ' > '
fi fi
} }
# vim: set ft=zsh sw=2 et tw=0:
# user, host, full path, and time/date # user, host, full path, and time/date
# on two lines for easier vgrepping # on two lines for easier vgrepping
# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 # entry in a nice long thread on the Arch Linux forums: https://bbs.archlinux.org/viewtopic.php?pid=521888#p521888
PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %H:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %H:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%}
%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(git_prompt_info)>%{\e[0m%}%b ' %{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(git_prompt_info)>%{\e[0m%}%b '
PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '
# user, host, full path, and time/date # user, host, full path, and time/date
# on two lines for easier vgrepping # on two lines for easier vgrepping
# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 # entry in a nice long thread on the Arch Linux forums: https://bbs.archlinux.org/viewtopic.php?pid=521888#p521888
PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %H:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %H:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%}
%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]>%{\e[0m%}%b ' %{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]>%{\e[0m%}%b '
PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '
...@@ -7,7 +7,7 @@ function _current_epoch() { ...@@ -7,7 +7,7 @@ function _current_epoch() {
} }
function _update_zsh_update() { function _update_zsh_update() {
echo "LAST_EPOCH=$(_current_epoch)" >! ~/.zsh-update echo "LAST_EPOCH=$(_current_epoch)" >! ${ZSH_CACHE_DIR}/.zsh-update
} }
function _upgrade_zsh() { function _upgrade_zsh() {
...@@ -30,11 +30,11 @@ fi ...@@ -30,11 +30,11 @@ fi
whence git >/dev/null || return 0 whence git >/dev/null || return 0
if mkdir "$ZSH/log/update.lock" 2>/dev/null; then if mkdir "$ZSH/log/update.lock" 2>/dev/null; then
if [ -f ~/.zsh-update ]; then if [ -f ${ZSH_CACHE_DIR}/.zsh-update ]; then
. ~/.zsh-update . ${ZSH_CACHE_DIR}/.zsh-update
if [[ -z "$LAST_EPOCH" ]]; then if [[ -z "$LAST_EPOCH" ]]; then
_update_zsh_update && return 0; _update_zsh_update && return 0
fi fi
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH)) epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
...@@ -42,7 +42,7 @@ if mkdir "$ZSH/log/update.lock" 2>/dev/null; then ...@@ -42,7 +42,7 @@ if mkdir "$ZSH/log/update.lock" 2>/dev/null; then
if [ "$DISABLE_UPDATE_PROMPT" = "true" ]; then if [ "$DISABLE_UPDATE_PROMPT" = "true" ]; then
_upgrade_zsh _upgrade_zsh
else else
echo "[Oh My Zsh] Would you like to check for updates? [Y/n]: \c" echo "[Oh My Zsh] Would you like to update? [Y/n]: \c"
read line read line
if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then
_upgrade_zsh _upgrade_zsh
......
...@@ -24,12 +24,10 @@ main() { ...@@ -24,12 +24,10 @@ main() {
# which may fail on systems lacking tput or terminfo # which may fail on systems lacking tput or terminfo
set -e set -e
CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l) if ! command -v zsh >/dev/null 2>&1; then
if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then
printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n" printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n"
exit exit
fi fi
unset CHECK_ZSH_INSTALLED
if [ ! -n "$ZSH" ]; then if [ ! -n "$ZSH" ]; then
ZSH=~/.oh-my-zsh ZSH=~/.oh-my-zsh
...@@ -49,7 +47,7 @@ main() { ...@@ -49,7 +47,7 @@ main() {
umask g-w,o-w umask g-w,o-w
printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n" printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n"
hash git >/dev/null 2>&1 || { command -v git >/dev/null 2>&1 || {
echo "Error: git is not installed" echo "Error: git is not installed"
exit 1 exit 1
} }
...@@ -61,7 +59,7 @@ main() { ...@@ -61,7 +59,7 @@ main() {
exit 1 exit 1
fi fi
fi fi
env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git "$ZSH" || {
printf "Error: git clone of oh-my-zsh repo failed\n" printf "Error: git clone of oh-my-zsh repo failed\n"
exit 1 exit 1
} }
...@@ -74,9 +72,9 @@ main() { ...@@ -74,9 +72,9 @@ main() {
fi fi
printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n" printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n"
cp $ZSH/templates/zshrc.zsh-template ~/.zshrc cp "$ZSH"/templates/zshrc.zsh-template ~/.zshrc
sed "/^export ZSH=/ c\\ sed "/^export ZSH=/ c\\
export ZSH=$ZSH export ZSH=\"$ZSH\"
" ~/.zshrc > ~/.zshrc-omztemp " ~/.zshrc > ~/.zshrc-omztemp
mv -f ~/.zshrc-omztemp ~/.zshrc mv -f ~/.zshrc-omztemp ~/.zshrc
...@@ -110,7 +108,7 @@ main() { ...@@ -110,7 +108,7 @@ main() {
echo 'p.p.s. Get stickers and t-shirts at https://shop.planetargon.com.' echo 'p.p.s. Get stickers and t-shirts at https://shop.planetargon.com.'
echo '' echo ''
printf "${NORMAL}" printf "${NORMAL}"
env zsh env zsh -l
} }
main main
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# the extent permitted by applicable law. You can redistribute it # the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want # and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See # To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details. # http://www.wtfpl.net/txt/copying/ for more details.
THEMES_DIR="$ZSH/themes" THEMES_DIR="$ZSH/themes"
FAVLIST="${HOME}/.zsh_favlist" FAVLIST="${HOME}/.zsh_favlist"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment