diff options
446 files changed, 14628 insertions, 3710 deletions
diff --git a/.github/main.workflow b/.github/main.workflow new file mode 100644 index 000000000..0dbb0247a --- /dev/null +++ b/.github/main.workflow @@ -0,0 +1,17 @@ +workflow "Triage Pull Request" { + on = "pull_request" + resolves = ["Triage"] +} + +# Only act if there are code changes: if the pull_request +# event's action is either 'opened' (new PR) or 'synchronize' (new commits) +action "Filter actions" { + uses = "actions/bin/filter@0ac6d44" + args = "action 'opened|synchronize'" +} + +action "Triage" { + needs = ["Filter actions"] + uses = "ohmyzsh/github-actions/pull-request-triage@master" + secrets = ["GITHUB_TOKEN"] +} diff --git a/.gitignore b/.gitignore index b2022081a..87a79cdae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ # custom files custom/ -!custom/plugins/example -!custom/example.zsh # temp files directories cache/ diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..20ad1ccee --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies within all project spaces, and it also applies when +an individual is representing the project or its community in public spaces. +Examples of representing a project or community include using an official +project e-mail address, posting via an official social media account, or acting +as an appointed representative at an online or offline event. Representation of +a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ohmyzsh@planetargon.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ac263fd18..f575157c2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,10 @@ # CONTRIBUTING GUIDELINES -Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged and appreciated. +Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged, and appreciated. It is also essential for the development of the project. +First, please take a moment to review our [code of conduct](CODE_OF_CONDUCT.md). + These guidelines are an attempt at better addressing the huge amount of pending issues and pull requests. Please read them closely. diff --git a/LICENSE.txt b/LICENSE.txt index 7af38f217..4d465b1c3 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2009-2018 Robby Russell and contributors +Copyright (c) 2009-2019 Robby Russell and 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 @@ -2,7 +2,7 @@ <img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh"> </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. @@ -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. 😬 -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 @@ -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._ * 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 * `git` should be installed @@ -75,7 +75,7 @@ Most plugins (should! we're working on this) include a __README__, which documen ### Themes -We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://wiki.github.com/robbyrussell/oh-my-zsh/themes) on the wiki. Check them out! +We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes) on the wiki. Check them out! #### Selecting a Theme @@ -141,7 +141,7 @@ export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubus ##### 1. Clone the repository: ```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: @@ -163,6 +163,7 @@ cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc ```shell chsh -s /bin/zsh ``` +You must log out and log back in to see this change. ##### 5. Initialize your new zsh configuration @@ -213,12 +214,16 @@ Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy b If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the command-line. It will remove itself and revert your previous `bash` or `zsh` configuration. -## Contributing +## How do I contribute to Oh My Zsh? -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! +Before you participate in our delightful community, please read the [code of conduct](CODE_OF_CONDUCT.md). + +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. +See [Contributing](CONTRIBUTING.md) for more details. + ### Do NOT send us themes We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes) wiki page. @@ -238,7 +243,7 @@ We're on the social media. ## 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, shirts, and coffee mugs available](https://shop.planetargon.com/collections/oh-my-zsh?utm_source=github) for you to show off your love of Oh My Zsh. Again, you will become the talk of the town! ## License diff --git a/custom/themes/example.zsh-theme b/custom/themes/example.zsh-theme new file mode 100644 index 000000000..ef8f1c630 --- /dev/null +++ b/custom/themes/example.zsh-theme @@ -0,0 +1,4 @@ +# Put your custom themes in this folder. +# Example: + +PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% " diff --git a/lib/compfix.zsh b/lib/compfix.zsh index 208aaadb1..b09b283f2 100644 --- a/lib/compfix.zsh +++ b/lib/compfix.zsh @@ -2,10 +2,6 @@ # insecure ownership or permissions) by: # # * 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() { # List of the absolute paths of all unique insecure directories, split on # newline from compaudit()'s output resembling: @@ -22,39 +18,27 @@ function handle_completion_insecurities() { insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} ) # If no such directories exist, get us out of here. - if (( ! ${#insecure_dirs} )); then - print "[oh-my-zsh] No insecure completion-dependent directories detected." - return - fi + [[ -z "${insecure_dirs}" ]] && return # List ownership and permissions of all insecure directories. print "[oh-my-zsh] Insecure completion-dependent directories detected:" 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 - # 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 + cat <<EOD - # List of the absolute paths of all unique existing completion caches. - local -aU zcompdump_files - zcompdump_files=( "${ZSH_COMPDUMP}"(.) "${ZDOTDIR:-${HOME}}"/.zcompdump* ) +[oh-my-zsh] For safety, we will not load completions from these directories until +[oh-my-zsh] you fix their permissions and ownership and restart zsh. +[oh-my-zsh] See the above list for directories with group or other writability. - # Move such caches to a temporary directory. - if (( ${#zcompdump_files} )); then - # Absolute path of the directory to which such files will be moved. - local ZSH_ZCOMPDUMP_BAD_DIR="${ZSH_CACHE_DIR}/zcompdump-bad" +[oh-my-zsh] To fix your permissions you can do so by disabling +[oh-my-zsh] the write permission of "group" and "others" and making sure that the +[oh-my-zsh] owner of these directories is either root or your current user. +[oh-my-zsh] The following command may help: +[oh-my-zsh] compaudit | xargs chmod g-w,o-w - # List such files first. - print "[oh-my-zsh] Insecure completion caches also detected:" - ls -l "${(@)zcompdump_files}" +[oh-my-zsh] If the above didn't help or you want to skip the verification of +[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to +[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file. - # For safety, move rather than permanently remove such files. - 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 +EOD } diff --git a/lib/completion.zsh b/lib/completion.zsh index a1e934315..c7db2eb7b 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -25,6 +25,9 @@ else fi unset CASE_SENSITIVE HYPHEN_INSENSITIVE +# Complete . and .. special directories +zstyle ':completion:*' special-dirs true + zstyle ':completion:*' list-colors '' zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' diff --git a/lib/correction.zsh b/lib/correction.zsh index 3e1415a0b..c635236b5 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -1,4 +1,5 @@ if [[ "$ENABLE_CORRECTION" == "true" ]]; then + alias cp='nocorrect cp' alias ebuild='nocorrect ebuild' alias gist='nocorrect gist' alias heroku='nocorrect heroku' diff --git a/lib/directories.zsh b/lib/directories.zsh index a50a692c8..cf87bd7e4 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -21,14 +21,18 @@ alias 9='cd -9' alias md='mkdir -p' alias rd=rmdir -alias d='dirs -v | head -10' + +function d () { + if [[ -n $1 ]]; then + dirs "$@" + else + dirs -v | head -10 + fi +} +compdef _dirs d # List directory contents alias lsa='ls -lah' alias l='ls -lah' alias ll='ls -lh' alias la='ls -lAh' - -# Push and pop directories on directory stack -alias pu='pushd' -alias po='popd' diff --git a/lib/functions.zsh b/lib/functions.zsh index f30653784..9f8736bd7 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -11,21 +11,20 @@ function upgrade_oh_my_zsh() { } function take() { - mkdir -p $1 - cd $1 + mkdir -p $@ && cd ${@:$#} } function open_command() { - emulate -L zsh - setopt shwordsplit - local open_cmd # define the open command case "$OSTYPE" in darwin*) open_cmd='open' ;; 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 ""' ;; *) echo "Platform $OSTYPE not supported" return 1 @@ -34,9 +33,9 @@ function open_command() { # don't use nohup on OSX if [[ "$OSTYPE" == darwin* ]]; then - $open_cmd "$@" &>/dev/null + ${=open_cmd} "$@" &>/dev/null else - nohup $open_cmd "$@" &>/dev/null + nohup ${=open_cmd} "$@" &>/dev/null fi } @@ -52,8 +51,7 @@ function open_command() { # 1 if it does not exist # function alias_value() { - alias "$1" | sed "s/^$1='\(.*\)'$/\1/" - test $(alias "$1") + (( $+aliases[$1] )) && echo $aliases[$1] } # @@ -81,7 +79,7 @@ function try_alias_value() { # 0 if the variable exists, 3 if it was set # function default() { - test `typeset +m "$1"` && return 0 + (( $+parameters[$1] )) && return 0 typeset -g "$1"="$2" && return 3 } @@ -95,8 +93,8 @@ function default() { # 0 if the env variable exists, 3 if it was set # function env_default() { - env | grep -q "^$1=" && return 0 - export "$1=$2" && return 3 + (( ${${(@f):-$(typeset +xg)}[(I)$1]} )) && return 0 + export "$1=$2" && return 3 } diff --git a/lib/git.zsh b/lib/git.zsh index 9b0f6e36f..640561e97 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -10,13 +10,10 @@ function git_prompt_info() { # Checks if working tree is dirty function parse_git_dirty() { - local STATUS='' + local STATUS local -a FLAGS - FLAGS=('--porcelain') + FLAGS=('--porcelain' '--ignore-submodules=dirty') if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then - if [[ $POST_1_7_2_GIT -gt 0 ]]; then - FLAGS+='--ignore-submodules=dirty' - fi if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then FLAGS+='--untracked-files=no' fi @@ -77,8 +74,8 @@ function git_current_branch() { # Gets the number of commits ahead from remote function git_commits_ahead() { if command git rev-parse --git-dir &>/dev/null; then - local commits="$(git rev-list --count @{upstream}..HEAD)" - if [[ "$commits" != 0 ]]; then + local commits="$(git rev-list --count @{upstream}..HEAD 2>/dev/null)" + if [[ -n "$commits" && "$commits" != 0 ]]; then echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX" fi fi @@ -87,8 +84,8 @@ function git_commits_ahead() { # Gets the number of commits behind remote function git_commits_behind() { if command git rev-parse --git-dir &>/dev/null; then - local commits="$(git rev-list --count HEAD..@{upstream})" - if [[ "$commits" != 0 ]]; then + local commits="$(git rev-list --count HEAD..@{upstream} 2>/dev/null)" + if [[ -n "$commits" && "$commits" != 0 ]]; then echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX" fi fi @@ -181,28 +178,6 @@ function git_prompt_status() { echo $STATUS } -# Compares the provided version of git to the version installed and on path -# Outputs -1, 0, or 1 if the installed version is less than, equal to, or -# greater than the input version, respectively. -function git_compare_version() { - local INPUT_GIT_VERSION INSTALLED_GIT_VERSION - INPUT_GIT_VERSION=(${(s/./)1}) - INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null)) - INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]}) - - for i in {1..3}; do - if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then - echo 1 - return 0 - fi - if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then - echo -1 - return 0 - fi - done - echo 0 -} - # Outputs the name of the current user # Usage example: $(git_current_user_name) function git_current_user_name() { @@ -214,8 +189,3 @@ function git_current_user_name() { function git_current_user_email() { command git config user.email 2>/dev/null } - -# This is unlikely to change so make it all statically assigned -POST_1_7_2_GIT=$(git_compare_version "1.7.2") -# Clean up the namespace slightly by removing the checker function -unfunction git_compare_version diff --git a/lib/history.zsh b/lib/history.zsh index 5de71c2d3..52e45bf4c 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -1,24 +1,40 @@ -## Command history configuration -if [ -z "$HISTFILE" ]; then - HISTFILE=$HOME/.zsh_history -fi +## History wrapper +function omz_history { + local clear list + zparseopts -E c=clear l=list -HISTSIZE=10000 -SAVEHIST=10000 + if [[ -n "$clear" ]]; then + # 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 -case $HIST_STAMPS in - "mm/dd/yyyy") alias history='fc -fl 1' ;; - "dd.mm.yyyy") alias history='fc -El 1' ;; - "yyyy-mm-dd") alias history='fc -il 1' ;; - *) alias history='fc -l 1' ;; +# Timestamp format +case ${HIST_STAMPS-} in + "mm/dd/yyyy") alias history='omz_history -f' ;; + "dd.mm.yyyy") alias history='omz_history -E' ;; + "yyyy-mm-dd") alias history='omz_history -i' ;; + "") alias history='omz_history' ;; + *) alias history="omz_history -t '$HIST_STAMPS'" ;; esac -setopt append_history -setopt extended_history -setopt hist_expire_dups_first -setopt hist_ignore_dups # ignore duplication command history list -setopt hist_ignore_space -setopt hist_verify -setopt inc_append_history -setopt share_history # share command history data +## History file configuration +[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history" +HISTSIZE=50000 +SAVEHIST=10000 + +## History command configuration +setopt extended_history # record timestamp of command in HISTFILE +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 diff --git a/lib/misc.zsh b/lib/misc.zsh index 3052b7710..b30822b50 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -18,13 +18,11 @@ fi ## jobs setopt long_list_jobs -## pager -env_default PAGER 'less' -env_default LESS '-R' +env_default 'PAGER' 'less' +env_default 'LESS' '-R' ## super user alias alias _='sudo' -alias please='sudo' ## more intelligent acking for ubuntu users if which ack-grep &> /dev/null; then diff --git a/lib/prompt_info_functions.zsh b/lib/prompt_info_functions.zsh index 335c02a3d..5069c4b21 100644 --- a/lib/prompt_info_functions.zsh +++ b/lib/prompt_info_functions.zsh @@ -10,9 +10,15 @@ # Dummy implementations that return false to prevent command_not_found # errors with themes, that implement these functions # Real implementations will be used when the respective plugins are loaded -function chruby_prompt_info hg_prompt_info pyenv_prompt_info \ - rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \ - virtualenv_prompt_info { +function chruby_prompt_info \ + rbenv_prompt_info \ + hg_prompt_info \ + pyenv_prompt_info \ + svn_prompt_info \ + vi_mode_prompt_info \ + virtualenv_prompt_info \ + jenv_prompt_info \ +{ return 1 } @@ -22,10 +28,13 @@ function rvm_prompt_info() { [ -f $HOME/.rvm/bin/rvm-prompt ] || return 1 local rvm_prompt rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${=ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null) - [[ "${rvm_prompt}x" == "x" ]] && return 1 - echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}" + [[ -z "${rvm_prompt}" ]] && return 1 + echo "${ZSH_THEME_RUBY_PROMPT_PREFIX}${rvm_prompt}${ZSH_THEME_RUBY_PROMPT_SUFFIX}" } +ZSH_THEME_RVM_PROMPT_OPTIONS="i v g" + + # use this to enable users to see their ruby version, no matter which # version management system they use function ruby_prompt_info() { diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh index 87092d8ae..312ab2248 100644 --- a/lib/spectrum.zsh +++ b/lib/spectrum.zsh @@ -1,7 +1,7 @@ #! /bin/zsh # A script to make using 256 colors in zsh less painful. # 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 diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 871ab28df..aa14f3f07 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -21,7 +21,7 @@ function title { print -Pn "\e]2;$2:q\a" # set window name print -Pn "\e]1;$1:q\a" # set tab name ;; - screen*) + screen*|tmux*) print -Pn "\ek$1:q\e\\" # set screen hardstatus ;; *) @@ -80,7 +80,7 @@ preexec_functions+=(omz_termsupport_preexec) # 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 if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 96f34aa81..5016d86ca 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -19,7 +19,7 @@ if [[ "$DISABLE_LS_COLORS" != "true" ]]; then # coreutils, so prefer it to "gls". gls --color -d . &>/dev/null && alias ls='gls --color=tty' colorls -G -d . &>/dev/null && alias ls='colorls -G' - elif [[ "$OSTYPE" == darwin* ]]; then + elif [[ "$OSTYPE" == (darwin|freebsd)* ]]; then # this is a good alias, it works by default just using $LSCOLORS ls -G . &>/dev/null && alias ls='ls -G' @@ -45,11 +45,10 @@ setopt prompt_subst [[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO="" -# Apply theming defaults -PS1="%n@%m:%~%# " - # git theming default: Variables for theming the git info prompt ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean +ZSH_THEME_RUBY_PROMPT_PREFIX="(" +ZSH_THEME_RUBY_PROMPT_SUFFIX=")" diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 7f78e4140..6b2662d5e 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,6 +1,17 @@ +# 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... 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 # Initializes Oh My Zsh @@ -11,29 +22,12 @@ fpath=($ZSH/functions $ZSH/completions $fpath) # Load all stock functions (from $fpath files) called below. autoload -U compaudit compinit -: ${ZSH_DISABLE_COMPFIX:=true} - # Set ZSH_CUSTOM to the path where your custom config files # and plugins exists, or else we will use the default custom/ if [[ -z "$ZSH_CUSTOM" ]]; then ZSH_CUSTOM="$ZSH/custom" 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 -# TIP: Add files you don't want in git to .gitignore -for config_file ($ZSH/lib/*.zsh); do - custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}" - [ -f "${custom_config_file}" ] && config_file=${custom_config_file} - source $config_file -done - is_plugin() { local base_dir=$1 @@ -41,6 +35,7 @@ is_plugin() { test -f $base_dir/plugins/$name/$name.plugin.zsh \ || test -f $base_dir/plugins/$name/_$name } + # Add all defined plugins to fpath. This must be done # before running compinit. for plugin ($plugins); do @@ -48,6 +43,8 @@ for plugin ($plugins); do fpath=($ZSH_CUSTOM/plugins/$plugin $fpath) elif is_plugin $ZSH $plugin; then fpath=($ZSH/plugins/$plugin $fpath) + else + echo "[oh-my-zsh] plugin '$plugin' not found" fi done @@ -65,18 +62,25 @@ if [ -z "$ZSH_COMPDUMP" ]; then fi if [[ $ZSH_DISABLE_COMPFIX != true ]]; then - # If completion insecurities exist, warn the user without enabling completions. - if ! compaudit &>/dev/null; then - # This function resides in the "lib/compfix.zsh" script sourced above. - handle_completion_insecurities - # Else, enable and cache completions to the desired file. - else - compinit -d "${ZSH_COMPDUMP}" - fi + source $ZSH/lib/compfix.zsh + # If completion insecurities exist, warn the user + handle_completion_insecurities + # Load only from secure directories + compinit -i -C -d "${ZSH_COMPDUMP}" else - compinit -i -d "${ZSH_COMPDUMP}" + # If the user wants it, load from all found directories + compinit -u -C -d "${ZSH_COMPDUMP}" fi + +# 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 +for config_file ($ZSH/lib/*.zsh); do + custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}" + [ -f "${custom_config_file}" ] && config_file=${custom_config_file} + source $config_file +done + # Load all of the plugins that were defined in ~/.zshrc for plugin ($plugins); do if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then diff --git a/plugins/adb/_adb b/plugins/adb/_adb index 8cbf6593c..78c457746 100644 --- a/plugins/adb/_adb +++ b/plugins/adb/_adb @@ -48,8 +48,13 @@ _arguments \ case "$state" in specify_device) - _values 'devices' $(adb devices -l|awk 'NR>1&& $1 ~ /^[a-zA-Z0-9].*$/ \ - {printf "%s[%s] ",$1,$6 }') + _values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \ + {sub(/ +/," ",$0); \ + gsub(":","\\:",$1); \ + for(i=1;i<=NF;i++) { + if($i ~ /model:/) { split($i,m,":") } \ + else if($i ~ /product:/) { split($i,p,":") } } \ + printf "%s[%s(%s)] ",$1, p[2], m[2]}'):-""} return ;; esac @@ -59,4 +64,4 @@ if (( CURRENT == 1 )); then return fi -_files
\ No newline at end of file +_files diff --git a/plugins/ansible/README.md b/plugins/ansible/README.md new file mode 100644 index 000000000..e0e6a19bb --- /dev/null +++ b/plugins/ansible/README.md @@ -0,0 +1,34 @@ +# ansible plugin + +## Introduction + +The `ansible plugin` adds several aliases for useful [ansible](https://docs.ansible.com/ansible/latest/index.html) commands and [aliases](#aliases). + +To use it, add `ansible` to the plugins array of your zshrc file: + +``` +plugins=(... ansible) +``` + +## Aliases + +| Command | Description | +|:-------------------------------------------|:--------------------------------------------------------------------| +| `ansible-version` / `aver` | Show the version on ansible installed in this host | +| `ansible-role-init <role name>` / `arinit` | Creates the Ansible Role as per Ansible Galaxy standard | +| `a` | command `ansible` | +| `aconf` | command `ansible-config` | +| `acon` | command `ansible-console` | +| `ainv` | command `ansible-inventory` | +| `aplaybook` | command `ansible-playbook` | +| `ainv` | command `ansible-inventory` | +| `adoc` | command `ansible-doc` | +| `agal` | command `ansible-galaxy` | +| `apull` | command `ansible-pull` | +| `aval` | command `ansible-vault` | + +## Maintainer + +### [Deepankumar](https://github.com/deepan10) + +[https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin](https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin) diff --git a/plugins/ansible/ansible.plugin.zsh b/plugins/ansible/ansible.plugin.zsh new file mode 100644 index 000000000..f68ff23a5 --- /dev/null +++ b/plugins/ansible/ansible.plugin.zsh @@ -0,0 +1,28 @@ +# Functions +function ansible-version(){ + ansible --version +} + +function ansible-role-init(){ + if ! [ -z $1] ; then + echo "Ansible Role : $1 Creating...." + ansible-galaxy init $1 + tree $1 + else + echo "Usage : ansible-role-init <role name>" + echo "Example : ansible-role-init role1" + fi +} + +# Alias +alias a='ansible ' +alias aconf='ansible-config ' +alias acon='ansible-console ' +alias aver='ansible-version' +alias arinit='ansible-role-init' +alias aplaybook='ansible-playbook ' +alias ainv='ansible-inventory ' +alias adoc='ansible-doc ' +alias agal='ansible-galaxy ' +alias apull='ansible-pull ' +alias aval='ansible-vault'
\ No newline at end of file diff --git a/plugins/ant/README.md b/plugins/ant/README.md new file mode 100644 index 000000000..5f88984ac --- /dev/null +++ b/plugins/ant/README.md @@ -0,0 +1,12 @@ +# 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. diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md index e408db13d..ff2b6a4c4 100644 --- a/plugins/archlinux/README.md +++ b/plugins/archlinux/README.md @@ -2,6 +2,51 @@ ## 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 yay | +| 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 | Alias | Command | Description | @@ -27,7 +72,7 @@ | yasu | yaourt -Syua --no-confirm | Same as `yaupg`, but without confirmation | | upgrade | yaourt -Syu | Sync with repositories before upgrading packages | -### PACAUR +#### PACAUR | Alias | Command | Description | |---------|------------------------------------|---------------------------------------------------------------------| @@ -74,7 +119,9 @@ | pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages | | upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages | | pacfileupg | sudo pacman -Fy | Download fresh package databases from the server | -| pacfiles | pacman -Fs | Search package file names for matching strings. | +| pacfiles | pacman -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 | |----------------|------------------------------------------------------| @@ -82,6 +129,7 @@ | paclist | List all installed packages with a short description | | pacmanallkeys | Get all keys for developers and trusted users | | pacmansignkeys | Locally trust all keys passed as parameters | +| pacweb | Open the website of an ArchLinux package | --- @@ -95,3 +143,4 @@ - ornicar - thibault.duplessis@gmail.com - Juraj Fiala - doctorjellyface@riseup.net - Majora320 (Moses Miller) - Majora320@gmail.com +- Ybalrid (Arthur Brainville) - ybalrid@ybalrid.info diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index 0fab1252b..e0101c7eb 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -1,3 +1,32 @@ +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 alias yaconf='yaourt -C' alias yaupg='yaourt -Syua' @@ -27,6 +56,35 @@ if (( $+commands[yaourt] )); then 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 alias paupg='pacaur -Syu' alias pasu='pacaur -Syu --noconfirm' @@ -54,16 +112,24 @@ if (( $+commands[pacaur] )); then fi fi -if (( $+commands[pacaur] )); then - upgrade() { +if (( $+commands[trizen] )); then + function upgrade() { + trizen -Syu + } +elif (( $+commands[pacaur] )); then + function upgrade() { pacaur -Syu } elif (( $+commands[yaourt] )); then - upgrade() { + function upgrade() { yaourt -Syu } +elif (( $+commands[yay] )); then + function upgrade() { + yay -Syu + } else - upgrade() { + function upgrade() { sudo pacman -Syu } fi @@ -83,7 +149,9 @@ alias pacmir='sudo pacman -Syy' alias paclsorphans='sudo pacman -Qdt' alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' alias pacfileupg='sudo pacman -Fy' -alias pacfiles='pacman tFs' +alias pacfiles='pacman -Fs' +alias pacls='pacman -Ql' +alias pacown='pacman -Qo' if (( $+commands[abs] && $+commands[aur] )); then @@ -96,13 +164,13 @@ else alias pacupd='sudo pacman -Sy' fi -paclist() { +function paclist() { # Source: https://bbs.archlinux.org/viewtopic.php?id=93683 LC_ALL=C pacman -Qei $(pacman -Qu | cut -d " " -f 1) | \ awk 'BEGIN {FS=":"} /^Name/{printf("\033[1;36m%s\033[1;37m", $2)} /^Description/{print $2}' } -pacdisowned() { +function pacdisowned() { emulate -L zsh tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$ @@ -120,14 +188,14 @@ pacdisowned() { comm -23 "$fs" "$db" } -pacmanallkeys() { +function pacmanallkeys() { emulate -L zsh curl -s https://www.archlinux.org/people/{developers,trustedusers}/ | \ awk -F\" '(/pgp.mit.edu/) { sub(/.*search=0x/,""); print $1}' | \ xargs sudo pacman-key --recv-keys } -pacmansignkeys() { +function pacmansignkeys() { emulate -L zsh for key in $*; do sudo pacman-key --recv-keys $key @@ -136,3 +204,16 @@ pacmansignkeys() { --no-permission-warning --command-fd 0 --edit-key $key 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 diff --git a/plugins/asdf/asdf.plugin.zsh b/plugins/asdf/asdf.plugin.zsh index 8736d2ff8..38b225538 100644 --- a/plugins/asdf/asdf.plugin.zsh +++ b/plugins/asdf/asdf.plugin.zsh @@ -1,7 +1,19 @@ -# Find where asdf should be installed. +# Find where asdf should be installed ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}" +ASDF_COMPLETIONS="$ASDF_DIR/completions" -# Load asdf, if found. -if [ -f $ASDF_DIR/asdf.sh ]; then - . $ASDF_DIR/asdf.sh +# If not found, check for Homebrew package +if [[ ! -f "$ASDF_DIR/asdf.sh" ]] && (( $+commands[brew] )); then + ASDF_DIR="$(brew --prefix asdf)" + ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d" +fi + +# Load command +if [[ -f "$ASDF_DIR/asdf.sh" ]]; then + . "$ASDF_DIR/asdf.sh" + + # Load completions + if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then + . "$ASDF_COMPLETIONS/asdf.bash" + fi fi diff --git a/plugins/autojump/README.md b/plugins/autojump/README.md new file mode 100644 index 000000000..18ff793cd --- /dev/null +++ b/plugins/autojump/README.md @@ -0,0 +1,11 @@ +# 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 diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh index 7339fad9e..13c1d00ed 100644 --- a/plugins/autojump/autojump.plugin.zsh +++ b/plugins/autojump/autojump.plugin.zsh @@ -1,23 +1,39 @@ -if [ $commands[autojump] ]; then # check if autojump is installed - if [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation - . $HOME/.autojump/etc/profile.d/autojump.zsh - elif [ -f $HOME/.autojump/share/autojump/autojump.zsh ]; then # another manual user-local installation - . $HOME/.autojump/share/autojump/autojump.zsh - elif [ -f $HOME/.nix-profile/etc/profile.d/autojump.zsh ]; then # nix installation - . $HOME/.nix-profile/etc/profile.d/autojump.zsh - elif [ -f /run/current-system/sw/share/autojump/autojump.zsh ]; then # nixos installation - . /run/current-system/sw/share/autojump/autojump.zsh - elif [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package - . /usr/share/autojump/autojump.zsh - elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation - . /etc/profile.d/autojump.zsh - elif [ -f /etc/profile.d/autojump.sh ]; then # gentoo installation - . /etc/profile.d/autojump.sh - elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation - . /usr/local/share/autojump/autojump.zsh - elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports - . /opt/local/etc/profile.d/autojump.zsh - elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.sh ]; then # mac os x with brew - . `brew --prefix`/etc/autojump.sh +(( $+commands[autojump] )) || { + echo '[oh-my-zsh] Please install autojump first (https://github.com/wting/autojump)' + return +} + +declare -a autojump_paths +autojump_paths=( + $HOME/.autojump/etc/profile.d/autojump.zsh # manual installation + $HOME/.autojump/share/autojump/autojump.zsh # manual installation + $HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation + /run/current-system/sw/share/autojump/autojump.zsh # NixOS installation + /usr/share/autojump/autojump.zsh # Debian and Ubuntu package + /etc/profile.d/autojump.zsh # manual installation + /etc/profile.d/autojump.sh # Gentoo installation + /usr/local/share/autojump/autojump.zsh # FreeBSD installation + /opt/local/etc/profile.d/autojump.sh # macOS with MacPorts + /usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default) +) + +for file in $autojump_paths; do + if [[ -f "$file" ]]; then + source "$file" + found=1 + break + fi +done + +# if no path found, try Homebrew +if (( ! found && $+commands[brew] )); then + file=$(brew --prefix)/etc/profile.d/autojump.sh + if [[ -f "$file" ]]; then + source "$file" + found=1 fi fi + +(( ! found )) && echo '[oh-my-zsh] autojump script not found' + +unset autojump_paths file found diff --git a/plugins/autopep8/README.md b/plugins/autopep8/README.md new file mode 100644 index 000000000..02bbb9af4 --- /dev/null +++ b/plugins/autopep8/README.md @@ -0,0 +1,8 @@ +# 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) +``` diff --git a/plugins/autopep8/autopep8.plugin.zsh b/plugins/autopep8/autopep8.plugin.zsh deleted file mode 100644 index e69de29bb..000000000 --- a/plugins/autopep8/autopep8.plugin.zsh +++ /dev/null diff --git a/plugins/aws/README.md b/plugins/aws/README.md new file mode 100644 index 000000000..57c3b54ac --- /dev/null +++ b/plugins/aws/README.md @@ -0,0 +1,38 @@ +# 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 and display them in the prompt. + +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 sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI. + Run `asp` without arguments to clear the profile. + +* `agp`: gets the current value of `$AWS_PROFILE`. + +* `aws_change_access_key`: changes the AWS access key of a profile. + +* `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`). + Used to provide completion for the `asp` function. + +## Plugin options + +* Set `SHOW_AWS_PROMPT=false` in your zshrc file if you want to prevent the plugin from modifying your RPROMPT. + Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to + see the AWS profile prompt. + +## Theme + +The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays +the current `$AWS_PROFILE`. It uses two variables to control how that is shown: + +- ZSH_THEME_AWS_PREFIX: sets the prefix of the AWS_PROFILE. Defaults to `<aws:`. + +- ZSH_THEME_AWS_SUFFIX: sets the suffix of the AWS_PROFILE. Defaults to `>`. diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index 6a0e04add..4bec30490 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -1,52 +1,85 @@ -_homebrew-installed() { - type brew &> /dev/null - _xit=$? - if [ $_xit -eq 0 ];then - # ok , we have brew installed - # speculatively we check default brew prefix - if [ -h /usr/local/opt/awscli ];then - _brew_prefix="/usr/local/opt/awscli" - else - # ok , it is not default prefix - # this call to brew is expensive ( about 400 ms ), so at least let's make it only once - _brew_prefix=$(brew --prefix awscli) - fi - return 0 - else - return $_xit - fi -} - -_awscli-homebrew-installed() { - [ -r $_brew_prefix/libexec/bin/aws_zsh_completer.sh ] &> /dev/null -} - -export AWS_HOME=~/.aws +# AWS profile selection function agp { - echo $AWS_DEFAULT_PROFILE + echo $AWS_PROFILE } function asp { - local rprompt=${RPROMPT/<aws:$(agp)>/} - export AWS_DEFAULT_PROFILE=$1 export AWS_PROFILE=$1 + export AWS_EB_PROFILE=$1 - export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>$rprompt" + if [[ -z "$1" ]]; then + echo AWS profile cleared. + fi +} + +function aws_change_access_key { + if [[ -z "$1" ]] then + echo "usage: $0 <profile>" + return 1 + fi + + echo Insert the credentials when asked. + asp "$1" + aws iam create-access-key + aws configure --profile "$1" + + echo You can now safely delete the old access key running \`aws iam delete-access-key --access-key-id ID\` + echo Your current keys are: + aws iam list-access-keys } 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 aws_change_access_key + + +# AWS prompt + +function aws_prompt_info() { + [[ -z $AWS_PROFILE ]] && return + echo "${ZSH_THEME_AWS_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_SUFFIX:=>}" +} + +if [ "$SHOW_AWS_PROMPT" != false ]; then + RPROMPT='$(aws_prompt_info)'"$RPROMPT" +fi + + +# Load awscli completions + +_awscli-homebrew-installed() { + # check if Homebrew is installed + (( $+commands[brew] )) || return 1 + + # speculatively check default brew prefix + if [ -h /usr/local/opt/awscli ]; then + _brew_prefix=/usr/local/opt/awscli + else + # ok, it is not in the default prefix + # this call to brew is expensive (about 400 ms), so at least let's make it only once + _brew_prefix=$(brew --prefix awscli) + fi } -compctl -K aws_profiles asp +# get aws_zsh_completer.sh location from $PATH +_aws_zsh_completer_path="$commands[aws_zsh_completer.sh]" -if _homebrew-installed && _awscli-homebrew-installed ; then - _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh -else - _aws_zsh_completer_path=$(which aws_zsh_completer.sh) +# otherwise check common locations +if [[ -z $_aws_zsh_completer_path ]]; then + # Homebrew + if _awscli-homebrew-installed; then + _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh + # Ubuntu + elif [[ -e /usr/share/zsh/vendor-completions/_awscli ]]; then + _aws_zsh_completer_path=/usr/share/zsh/vendor-completions/_awscli + # RPM + else + _aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh + fi fi -[ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path -unset _aws_zsh_completer_path +[[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path +unset _aws_zsh_completer_path _brew_prefix diff --git a/plugins/battery/README.md b/plugins/battery/README.md new file mode 100644 index 000000000..b7a13a7ec --- /dev/null +++ b/plugins/battery/README.md @@ -0,0 +1,13 @@ +# 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)' +``` diff --git a/plugins/bbedit/README.md b/plugins/bbedit/README.md index ec2b743d6..263c54c47 100644 --- a/plugins/bbedit/README.md +++ b/plugins/bbedit/README.md @@ -1,11 +1,11 @@ ## 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 - * [BBEdit](http://www.barebones.com/products/bbedit/) - * [BBEdit Command-Line Tools](http://www.barebones.com/support/bbedit/cmd-line-tools.html) + * [BBEdit](https://www.barebones.com/products/bbedit/) + * [BBEdit Command-Line Tools](https://www.barebones.com/support/bbedit/cmd-line-tools.html) ### Usage diff --git a/plugins/bgnotify/README.md b/plugins/bgnotify/README.md index fad299159..1d8fac54d 100644 --- a/plugins/bgnotify/README.md +++ b/plugins/bgnotify/README.md @@ -13,7 +13,7 @@ Just add bgnotify to your plugins list in your `.zshrc` - On OS X you'll need [terminal-notifier](https://github.com/alloy/terminal-notifier) * `brew install terminal-notifier` (or `gem install terminal-notifier`) - 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 diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh index 459f5214e..b3a6890b8 100755..100644 --- a/plugins/bgnotify/bgnotify.plugin.zsh +++ b/plugins/bgnotify/bgnotify.plugin.zsh @@ -42,7 +42,7 @@ bgnotify () { ## args: (title, subtitle) elif hash notify-send 2>/dev/null; then #ubuntu gnome! notify-send "$1" "$2" 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! notifu /m "$2" /p "$1" fi diff --git a/plugins/bower/README.md b/plugins/bower/README.md new file mode 100644 index 000000000..743b6a0ea --- /dev/null +++ b/plugins/bower/README.md @@ -0,0 +1,18 @@ +# 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. | + diff --git a/plugins/brew/README.md b/plugins/brew/README.md new file mode 100644 index 000000000..c129a7652 --- /dev/null +++ b/plugins/brew/README.md @@ -0,0 +1,21 @@ +# 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. | +| bcubo | `brew update && brew cask outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated casks. | +| bcubc | `brew cask reinstall $(brew cask outdated) && brew cleanup` | Updates outdated casks, then runs cleanup. |
\ No newline at end of file diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index 6fb7f3453..cfbaa3480 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -1,7 +1,11 @@ +alias brewp='brew pin' alias brews='brew list -1' +alias brewsp='brew list --pinned' alias bubo='brew update && brew outdated' alias bubc='brew upgrade && brew cleanup' alias bubu='bubo && bubc' +alias bcubo='brew update && brew cask outdated' +alias bcubc='brew cask reinstall $(brew cask outdated) && brew cleanup' if command mkdir "$ZSH_CACHE_DIR/.brew-completion-message" 2>/dev/null; then print -P '%F{yellow}'Oh My Zsh brew plugin: diff --git a/plugins/bundler/README.md b/plugins/bundler/README.md index 04d551447..dc2f17008 100644 --- a/plugins/bundler/README.md +++ b/plugins/bundler/README.md @@ -2,7 +2,8 @@ - adds completion for basic 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` - `bp` aliased to `bundle package` - `bo` aliased to `bundle open` @@ -13,7 +14,8 @@ - looks for a binstub under `./bin/` and executes it (if present) - 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 diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 6b10b78d1..668e15d2f 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -54,10 +54,14 @@ done ## Functions 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` if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then - if [[ "$OSTYPE" = darwin* ]] + if [[ "$OSTYPE" = (darwin|freebsd)* ]] then local cores_num="$(sysctl -n hw.ncpu)" else @@ -67,8 +71,6 @@ bundle_install() { else bundle install $@ fi - else - echo "Can't 'bundle install' outside a bundled project" fi } diff --git a/plugins/bwana/README.md b/plugins/bwana/README.md new file mode 100644 index 000000000..dd4fe9f9c --- /dev/null +++ b/plugins/bwana/README.md @@ -0,0 +1,12 @@ +# 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) +``` + +The `bwana` function opens the man page of the passed argument in the Bwana app. +For example: `bwana ln` opens the man page for `ln` in Bwana. diff --git a/plugins/bwana/bwana.plugin.zsh b/plugins/bwana/bwana.plugin.zsh index 455da8621..71c9eb18d 100644 --- a/plugins/bwana/bwana.plugin.zsh +++ b/plugins/bwana/bwana.plugin.zsh @@ -1,13 +1,13 @@ # -# Requires http://www.bruji.com/bwana/ +# Requires https://www.bruji.com/bwana/ # if [[ -e /Applications/Bwana.app ]] || ( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana ) then - function man() { + function bwana() { open "man:$1" } else - 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 "Bwana lets you read man files in Safari through a man: URI scheme" + echo "To use it within Zsh, install it from https://www.bruji.com/bwana/" fi diff --git a/plugins/cabal/README.md b/plugins/cabal/README.md new file mode 100644 index 000000000..b1106c40f --- /dev/null +++ b/plugins/cabal/README.md @@ -0,0 +1,9 @@ +# 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) +``` diff --git a/plugins/cake/README.md b/plugins/cake/README.md new file mode 100644 index 000000000..aad92a3ec --- /dev/null +++ b/plugins/cake/README.md @@ -0,0 +1,15 @@ +# Cake + +This plugin provides completion for [CakePHP](https://cakephp.org/). + +To use it add cake to the plugins array in your zshrc file. + +```bash +plugins=(... cake) +``` + +## Note + +This plugin generates a cache file of the cake tasks found, named `.cake_task_cache`, in the current working directory. +It is regenerated when the Cakefile is newer than the cache file. It is advised that you add the cake file to your +`.gitignore` files. diff --git a/plugins/capistrano/README.md b/plugins/capistrano/README.md new file mode 100644 index 000000000..335b794fa --- /dev/null +++ b/plugins/capistrano/README.md @@ -0,0 +1,14 @@ +# 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. diff --git a/plugins/capistrano/capistrano.plugin.zsh b/plugins/capistrano/capistrano.plugin.zsh index 0b5559791..819572825 100644 --- a/plugins/capistrano/capistrano.plugin.zsh +++ b/plugins/capistrano/capistrano.plugin.zsh @@ -1,7 +1,7 @@ -# 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 -func capit() { +function capit() { if [ -f Gemfile ] then bundle exec cap $* diff --git a/plugins/cargo/README.md b/plugins/cargo/README.md index 5fa688d21..31bae4efe 100644 --- a/plugins/cargo/README.md +++ b/plugins/cargo/README.md @@ -1,6 +1,6 @@ # cargo -This plugin adds completion for the Rust build tool [`cargo`](https://github.com/rust-lang/cargo). +This plugin adds completion for the Rust build tool [`Cargo`](https://github.com/rust-lang/cargo). To use it, add `cargo` to the plugins array in your zshrc file: @@ -8,4 +8,4 @@ To use it, add `cargo` to the plugins array in your zshrc file: plugins=(... cargo) ``` -Updated on October 4th, 2016. +Updated on March 3rd, 2019, from [Cargo 0.34.0](https://github.com/rust-lang/cargo/releases/tag/0.34.0). diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo index 54e709ca0..395c517cd 100644 --- a/plugins/cargo/_cargo +++ b/plugins/cargo/_cargo @@ -1,23 +1,37 @@ #compdef cargo -typeset -A opt_args autoload -U regexp-replace +zstyle -T ':completion:*:*:cargo:*' tag-order && \ + zstyle ':completion:*:*:cargo:*' tag-order 'common-commands' + _cargo() { +local context state state_descr line +typeset -A opt_args +# leading items in parentheses are an exclusion list for the arguments following that arg +# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions +# - => exclude all other options +# 1 => exclude positional arg 1 +# * => exclude all other args +# +blah => exclude +blah _arguments \ '(- 1 *)'{-h,--help}'[show help message]' \ + '(- 1 *)--list[list installed commands]' \ '(- 1 *)'{-V,--version}'[show version information]' \ - '(- 1 *)'--list'[list installed commands]' \ - '(- 1 *)'--explain'[Run `rustc --explain CODE`]' \ - '(- 1 *)'{-v,--verbose}'[use verbose output]' \ - '(- 1 *)'--color'[colorization option]' \ - '(- 1 *)'--frozen'[Require Cargo.lock and cache are up to date]' \ - '(- 1 *)'--locked'[Require Cargo.lock is up to date]' \ - '1: :_cargo_cmds' \ + {-v,--verbose}'[use verbose output]' \ + --color'[colorization option]' \ + '(+beta +nightly)+stable[use the stable toolchain]' \ + '(+stable +nightly)+beta[use the beta toolchain]' \ + '(+stable +beta)+nightly[use the nightly toolchain]' \ + '1: :->command' \ '*:: :->args' case $state in + command) + _alternative 'common-commands:common:_cargo_cmds' 'all-commands:all:_cargo_all_cmds' + ;; + args) case $words[1] in bench) @@ -54,6 +68,23 @@ case $state in '--color=:colorization option:(auto always never)' \ ;; + check) + _arguments \ + '--features=[space separated feature list]' \ + '--all-features[enable all available features]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ + "${command_scope_spec[@]}" \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--no-default-features[do not check the default features]' \ + '(-p,--package)'{-p=,--package=}'[package to check]:packages:_get_package_names' \ + '--release=[check in release mode]' \ + '--target=[target triple]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--color=:colorization option:(auto always never)' \ + ;; + clean) _arguments \ '(-h, --help)'{-h,--help}'[show help message]' \ @@ -105,7 +136,7 @@ case $state in git-checkout) _arguments \ '(-h, --help)'{-h,--help}'[show help message]' \ - 'q(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--reference=[REF]' \ '--url=[URL]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ @@ -142,10 +173,10 @@ case $state in '(-h, --help)'{-h,--help}'[show help message]' \ '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ '--no-default-features[do not build the default features]' \ - '--path=[local filesystem path to crate to install]' \ + '--path=[local filesystem path to crate to install]: :_files -/' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--rev=[specific commit to use when installing from git]' \ - '--root=[directory to install packages into]' \ + '--root=[directory to install packages into]: :_files -/' \ '--tag=[tag to use when installing from git]' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '--vers=[version to install from crates.io]' \ @@ -270,7 +301,7 @@ case $state in '--all-features[enable all available features]' \ '(-h, --help)'{-h,--help}'[show help message]' \ '(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \ - '--manifest-path=[path to the manifest to fetch dependencies for]' \ + '--manifest-path=[path to the manifest to fetch dependencies for]: :_files -/' \ '--no-default-features[do not compile default features for the package]' \ '(-p, --package)'{-p,--package}'=[profile to compile for]' \ '--profile=[profile to build the selected target for]' \ @@ -288,7 +319,7 @@ case $state in '--all-features[enable all available features]' \ '(-h, --help)'{-h,--help}'[show help message]' \ '(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \ - '--manifest-path=[path to the manifest to document]' \ + '--manifest-path=[path to the manifest to document]: :_files -/' \ '--no-default-features[do not build the `default` feature]' \ '--open[open the docs in a browser after the operation]' \ '(-p, --package)'{-p,--package}'=[package to document]' \ @@ -327,6 +358,15 @@ case $state in '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '--color=:colorization option:(auto always never)' \ '1: :_test_names' \ + '(--doc --bin --example --test --bench)--lib[only test library]' \ + '(--lib --bin --example --test --bench)--doc[only test documentation]' \ + '(--lib --doc --example --test --bench)--bin=[binary name]' \ + '(--lib --doc --bin --test --bench)--example=[example name]' \ + '(--lib --doc --bin --example --bench)--test=[test name]' \ + '(--lib --doc --bin --example --test)--bench=[benchmark name]' \ + '--message-format:error format:(human json short)' \ + '--frozen[require lock and cache up to date]' \ + '--locked[require lock up to date]' ;; uninstall) @@ -335,7 +375,7 @@ case $state in '--color=:colorization option:(auto always never)' \ '(-h, --help)'{-h,--help}'[show help message]' \ '(-q, --quiet)'{-q,--quiet}'[less output printed to stdout]' \ - '--root=[directory to uninstall packages from]' \ + '--root=[directory to uninstall packages from]: :_files -/' \ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ ;; @@ -386,19 +426,20 @@ esac _cargo_cmds(){ local -a commands;commands=( 'bench:execute all benchmarks of a local package' -'build:compile the current project' +'build:compile the current package' +'check:check the current package without compiling' 'clean:remove generated artifacts' 'doc:build package documentation' 'fetch:fetch package dependencies' 'generate-lockfile:create lockfile' 'git-checkout:git checkout' 'help:get help for commands' -'init:create new project in current directory' +'init:create new package in current directory' 'install:install a Rust binary' 'locate-project:print "Cargo.toml" location' 'login:login to remote server' -'metadata:the metadata for a project in json' -'new:create a new project' +'metadata:the metadata for a package in json' +'new:create a new package' 'owner:manage the owners of a crate on the registry' 'package:assemble local package into a distributable tarball' 'pkgid:print a fully qualified package specification' @@ -415,8 +456,12 @@ local -a commands;commands=( 'version:show version information' 'yank:remove pushed file from index' ) -_describe 'command' commands +_describe -t common-commands 'common commands' commands +} +_cargo_all_cmds(){ +local -a commands;commands=($(cargo --list)) +_describe -t all-commands 'all commands' commands } @@ -484,7 +529,7 @@ _benchmark_names() _get_names_from_array "bench" } -# These flags are mutally exclusive specifiers for the scope of a command; as +# These flags are mutually exclusive specifiers for the scope of a command; as # they are used in multiple places without change, they are expanded into the # appropriate command's `_arguments` where appropriate. set command_scope_spec @@ -496,5 +541,4 @@ command_scope_spec=( '(--bench --bin --example --lib)--test=[test name]' ) - _cargo diff --git a/plugins/catimg/README.md b/plugins/catimg/README.md new file mode 100644 index 000000000..2fc28a1c6 --- /dev/null +++ b/plugins/catimg/README.md @@ -0,0 +1,35 @@ +# 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) diff --git a/plugins/catimg/catimg.plugin.zsh b/plugins/catimg/catimg.plugin.zsh index cb92f5986..ca46444cc 100644 --- a/plugins/catimg/catimg.plugin.zsh +++ b/plugins/catimg/catimg.plugin.zsh @@ -1,10 +1,10 @@ ################################################################################ # 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 # # terminal. # -# Github: https://github.com/posva/catimg # +# GitHub: https://github.com/posva/catimg # ################################################################################ diff --git a/plugins/catimg/catimg.sh b/plugins/catimg/catimg.sh index cd0f2e333..713a03291 100755..100644 --- a/plugins/catimg/catimg.sh +++ b/plugins/catimg/catimg.sh @@ -1,10 +1,10 @@ ################################################################################ # 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 # # terminal. # -# Github: https://github.com/posva/catimg # +# GitHub: https://github.com/posva/catimg # ################################################################################ function help() { diff --git a/plugins/celery/README.md b/plugins/celery/README.md new file mode 100644 index 000000000..d2597f702 --- /dev/null +++ b/plugins/celery/README.md @@ -0,0 +1,9 @@ +# 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) +``` diff --git a/plugins/chruby/chruby.plugin.zsh b/plugins/chruby/chruby.plugin.zsh index 998d92098..f7fedb5f2 100644 --- a/plugins/chruby/chruby.plugin.zsh +++ b/plugins/chruby/chruby.plugin.zsh @@ -111,5 +111,11 @@ function chruby_prompt_info() { } # 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 diff --git a/plugins/chucknorris/LICENSE b/plugins/chucknorris/LICENSE deleted file mode 100644 index 5f40edd1e..000000000 --- a/plugins/chucknorris/LICENSE +++ /dev/null @@ -1,2 +0,0 @@ -License: GPL v2 -Thanks to http://www.k-lug.org/~kessler/projects.html for the fortune file. diff --git a/plugins/chucknorris/README.md b/plugins/chucknorris/README.md new file mode 100644 index 000000000..be7b97e24 --- /dev/null +++ b/plugins/chucknorris/README.md @@ -0,0 +1,20 @@ +# 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 | diff --git a/plugins/chucknorris/fortunes/chucknorris b/plugins/chucknorris/fortunes/chucknorris index e705d1c13..2a13b060f 100644 --- a/plugins/chucknorris/fortunes/chucknorris +++ b/plugins/chucknorris/fortunes/chucknorris @@ -1,907 +1,2544 @@ -Chuck Norris' tears cure cancer. Too bad he has never cried. Ever. +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. % -Chuck Norris does not sleep. He waits. +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. % -Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. % -The chief export of Chuck Norris is pain. +Outer space exists because it's afraid to be on the same planet with Chuck Norris. % -If you can see Chuck Norris, he can see you. If you can't see Chuck Norris, you may be only seconds away from death. +Chuck Norris does not sleep. He waits. % -Chuck Norris has counted to infinity. Twice. +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. % -Chuck Norris does not hunt because the word hunting implies the probability of failure. Chuck Norris goes killing. +Chuck Norris is the reason why Waldo is hiding. % -Chuck Norris' blood type is AK+. Ass-Kicking Positive. It is compatible only with heavy construction equipment, tanks, and fighter jets. +Chuck Norris counted to infinity - twice. % -Chuck Norris is 1/8th Cherokee. This has nothing to do with ancestry, the man ate a fucking Indian. +There is no chin behind Chuck Norris’ beard. There is only another fist. % -In fine print on the last page of the Guinness Book of World Records it notes that all world records are held by Chuck Norris, and those listed in the book are simply the closest anyone else has ever gotten. +In fine print on the last page of the Guinness Book of World Records it notes that all world records are held by Chuck Norris, and those listed in the book are simply the closest anyone else has ever gotten. % There is no chin behind Chuck Norris' beard. There is only another fist. % -Chuck Norris does not teabag the ladies. He potato-sacks them. +Chuck Norris does not teabag the ladies. He potato-sacks them. % -Pluto is actually an orbiting group of British soldiers from the American Revolution who entered space after the Chuck gave them a roundhouse kick to the face. +Pluto is actually an orbiting group of British soldiers from the American Revolution who entered space after the Chuck gave them a roundhouse kick to the face. % -When Chuck Norris goes to donate blood, he declines the syringe, and instead requests a hand gun and a bucket. +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. % -There are no steroids in baseball. Just players Chuck Norris has breathed on. +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. % -Chuck Norris once challenged Lance Armstrong in a "Who has more testicles?" contest. Chuck Norris won by 5. +Chuck Norris' hand is the only hand that can beat a Royal Flush. % -Chuck Norris was the fourth wise man, who gave baby Jesus the gift of beard, which he carried with him until he died. The other three wise men were enraged by the preference that Jesus showed to Chuck's gift, and arranged to have him written out of the bible. All three died soon after of mysterious roundhouse-kick related injuries. +Chuck Norris can lead a horse to water AND make it drink. % -Chuck Norris sheds his skin twice a year. +Chuck Norris doesn’t wear a watch. HE decides what time it is. % -When Chuck Norris calls 1-900 numbers, he doesnt get charged. He holds up the phone and money falls out. +Chuck Norris can slam a revolving door. % -Chuck Norris once ate a whole cake before his friends could tell him there was a stripper in it. +Chuck Norris does not get frostbite. Chuck Norris bites frost. % -Some people like to eat frogs' legs. Chuck Norris likes to eat lizard legs. Hence, snakes. +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. % -There are no races, only countries of people Chuck Norris has beaten to different shades of black and blue. +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. % -When Chuck Norris was denied an Egg McMuffin at McDonald's because it was 10:35, he roundhouse kicked the store so hard it became a Wendy's. +If you spell Chuck Norris in Scrabble, you win. Forever. % -Chuck Norris can't finish a "color by numbers" because his markers are filled with the blood of his victims. Unfortunately, all blood is dark red. +Guns don't kill people. Chuck Norris kills people. % -A Chuck Norris-delivered Roundhouse Kick is the preferred method of execution in 16 states. +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. % -When Chuck Norris falls in water, Chuck Norris doesn't get wet. Water gets Chuck Norris. +The chief export of Chuck Norris is Pain. % -Scientists have estimated that the energy given off during the Big Bang is roughly equal to 1CNRhK (Chuck Norris Roundhouse Kick) +Chuck Norris has two speeds. Walk, and Kill. % -Chuck Norris' house has no doors, only walls that he walks through. +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. % -When Chuck Norris has sex with a man, it won't be because he is gay. It will be because he has run out of women. +Chuck Norris drives an ice cream truck covered in human skulls. % -How much wood would a woodchuck chuck if a woodchuck could Chuck Norris? ...All of it. +Chuck Norris is my Homeboy. % -Chuck Norris doesn't actually write books, the words assemble themselves out of fear. +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. % -In honor of Chuck Norris, all McDonald's in Texas have an even larger size than the super-size. When ordering, just ask to be "Norrisized". +Chuck Norris uses pepper spray to spice up his steaks. % -Chuck Norris CAN believe it's not butter. +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. % -If tapped, a Chuck Norris roundhouse kick could power the country of Australia for 44 minutes. +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. % -Chuck Norris can divide by zero. +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. % -The grass is always greener on the other side, unless Chuck Norris has been there. In that case the grass is most likely soaked in blood and tears. +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. % -A picture is worth a thousand words. A Chuck Norris is worth 1 billion words. +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. % -Newton's Third Law is wrong: Although it states that for each action, there is an equal and opposite reaction, there is no force equal in reaction to a Chuck Norris roundhouse kick. +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. % -Chuck Norris invented his own type of karate. It's called Chuck-Will-Kill. +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. % -When an episode of Walker Texas Ranger was aired in France, the French surrendered to Chuck Norris just to be on the safe side. +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. % -While urinating, Chuck Norris is easily capable of welding titanium. +The quickest way to a man's heart is with Chuck Norris' fist. % -Chuck Norris once sued the Houghton-Mifflin textbook company when it became apparent that their account of the war of 1812 was plagiarized from his autobiography. +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. % -When Chuck Norris talks, everybody listens. And dies. +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. % -When Steven Seagal kills a ninja, he only takes its hide. When Chuck Norris kills a ninja, he uses every part. +Chuck Norris can win a game of Connect Four in only three moves. % -Wilt Chamberlain claims to have slept with more than 20,000 women in his lifetime. Chuck Norris calls this "a slow Tuesday." +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. % -Contrary to popular belief, there is indeed enough Chuck Norris to go around. +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. % -Chuck Norris doesnt shave; he kicks himself in the face. The only thing that can cut Chuck Norris is Chuck Norris. +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. % -For some, the left testicle is larger than the right one. For Chuck Norris, each testicle is larger than the other one. +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. % -Chuck Norris always knows the EXACT location of Carmen SanDiego. +Chuck Norris doesn’t wash his clothes, he disembowels them. % -When taking the SAT, write "Chuck Norris" for every answer. You will score over 8000. +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. % -Chuck Norris invented black. In fact, he invented the entire spectrum of visible light. Except pink. Tom Cruise invented pink. +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. % -When you're Chuck Norris, anything + anything is equal to 1. One roundhouse kick to the face. +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. % -Chuck Norris has the greatest Poker-Face of all time. He won the 1983 World Series of Poker, despite holding only a Joker, a Get out of Jail Free Monopoloy card, a 2 of clubs, 7 of spades and a green #4 card from the game UNO. +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." % -On his birthday, Chuck Norris randomly selects one lucky child to be thrown into the sun. +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. % -Nobody doesn't like Sara Lee. Except Chuck Norris. +Chuck Norris can win in a top spinning tournament with a cube % -Chuck Norris doesn't throw up if he drinks too much. Chuck Norris throws down! +Beware of dogs... Dogs, beware of Chuck Norris. % -In the beginning there was nothing...then Chuck Norris Roundhouse kicked that nothing in the face and said "Get a job". That is the story of the universe. +Chuck Norris can dig a hole in air. % -Chuck Norris has 12 moons. One of those moons is the Earth. +The apple falls far from the tree, when a roundhouse kick is taken to the trunk. % -Chuck Norris grinds his coffee with his teeth and boils the water with his own rage. +Chuck Norris - the new standard. % -Archeologists unearthed an old english dictionary dating back to the year 1236. It defined "victim" as "one who has encountered Chuck Norris" +Chuck Norris told me to put this here. % -Chuck Norris ordered a Big Mac at Burger King, and got one. +Chuck Norris doesn't exhale. The air runs desperately scared out of his lungs. % -Chuck Norris and Mr. T walked into a bar. The bar was instantly destroyed, as that level of awesome cannot be contained in one building. +Fear of spiders is aracnaphobia, fear of tight spaces is chlaustraphobia, fear of Chuck Norris is called Logic % -If you Google search "Chuck Norris getting his ass kicked" you will generate zero results. It just doesn't happen. +When Chuck Norris goes to rodeos, bulls ride him. % -Chuck Norris can drink an entire gallon of milk in thirty-seven seconds. +Chuck Norris once walked down a street with his fists in his pockets. He was then arrested for concealing two deadly weapons. % -Little known medical fact: Chuck Norris invented the Caesarean section when he roundhouse-kicked his way out of his monther's womb. +The meaning of life is Chuck Norris % -Chuck Norris doesn't bowl strikes, he just knocks down one pin and the other nine faint. +Chuck Norris is the meaning of life. Too bad he's also the meaning of death. % -The show Survivor had the original premise of putting people on an island with Chuck Norris. There were no survivors, and nobody is brave enough to go to the island to retrieve the footage. +If God doesn't know, Chuck does % -It takes Chuck Norris 20 minutes to watch 60 Minutes. +Chuck Norris doesn't bowl strikes, he just knocks down one pin and the other nine faint. % -You know how they say if you die in your dream then you will die in real life? In actuality, if you dream of death then Chuck Norris will find you and kill you. +The show Survivor had the original premise of putting people on an island with Chuck Norris. There were no survivors, and nobody is brave enough to go to the island to retrieve the footage. % -Chuck Norris has a deep and abiding respect for human life... unless it gets in his way. +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. % -The Bermuda Triangle used to be the Bermuda Square, until Chuck Norris Roundhouse kicked one of the corners off. +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. % -There are no weapons of mass destruction in Iraq, Chuck Norris lives in Oklahoma. +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. % -Chuck Norris doesn't believe in Germany. +Outer space exists because it's afraid to be on the same planet with Chuck Norris. % -When Chuck Norris is in a crowded area, he doesn't walk around people. He walks through them. +Chuck Norris does not sleep. He waits. % -Chuck Norris once ate an entire bottle of sleeping pills. They made him blink. +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. % -James Cameron wanted Chuck Norris to play the Terminator. However, upon reflection, he realized that would have turned his movie into a documentary, so he went with Arnold Schwarzenegger. +Chuck Norris is the reason why Waldo is hiding. % -Chuck Norris can touch MC Hammer. +Chuck Norris counted to infinity - twice. % -Thousands of years ago Chuck Norris came across a bear. It was so terrified that it fled north into the arctic. It was also so terrified that all of its decendents now have white hair. +There is no chin behind Chuck Norris’ beard. There is only another fist. % -Chuck Norris played Russian Roulette with a fully loaded gun and won. +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. % -It takes 14 puppeteers to make Chuck Norris smile, but only 2 to make him destroy an orphanage. +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. % -Chuck Norris is responsible for China's over-population. He hosted a Karate tournament in Beijing and all women within 1,000 miles became pregnant instantly. +Chuck Norris' hand is the only hand that can beat a Royal Flush. % -Some people wear Superman pajamas. Superman wears Chuck Norris pajamas. +Chuck Norris can lead a horse to water AND make it drink. % -Chuck Norris once worked as a weatherman for the San Diego evening news. Every night he would make the same forecast: Partly cloudy with a 75% chance of Pain. +Chuck Norris doesn’t wear a watch. HE decides what time it is. % -Simply by pulling on both ends, Chuck Norris can stretch diamonds back into coal. +Chuck Norris can slam a revolving door. % -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. +Chuck Norris does not get frostbite. Chuck Norris bites frost. % -Chuck Norris invented the bolt-action rifle, liquor, sexual intercourse, and football-- in that order. +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. % -A high tide means Chuck Norris is flying over your coast. The tide is caused by God pissing his pants. +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. % -Chuck Norris keeps his friends close and his enemies closer. Close enough to drop them with one round house kick to the face. +If you spell Chuck Norris in Scrabble, you win. Forever. % -There is in fact an "I" in Norris, but there is no "team"? not even close. +Guns don't kill people. Chuck Norris kills people. % -Scotty in Star Trek often says "Ye cannae change the laws of physics." This is untrue. Chuck Norris can change the laws of physics. With his fists. +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. % -An anagram for Walker Texas Ranger is KARATE WRANGLER SEX. I don't know what that is, but it sounds AWESOME. +The chief export of Chuck Norris is Pain. % -Chuck Norris doesn't stub his toes. He accidentally destroys chairs, bedframes, and sidewalks. +Chuck Norris has two speeds. Walk, and Kill. % -Using his trademark roundhouse kick, Chuck Norris once made a fieldgoal in RJ Stadium in Tampa Bay from the 50 yard line of Qualcomm stadium in San Diego. +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. % -Chuck Norris roundhouse kicks don't really kill people. They wipe out their entire existence from the space-time continuum. +Chuck Norris drives an ice cream truck covered in human skulls. % -Chuck Norris does not own a stove, oven, or microwave , because revenge is a dish best served cold. +Chuck Norris is my Homeboy. % -Tom Clancy has to pay royalties to Chuck Norris because "The Sum of All Fears" is the name of Chuck Norris' autobiography. +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. % -Chuck Norris can slam a revolving door. +Chuck Norris uses pepper spray to spice up his steaks. % -Chuck Norris is expected to win gold in every swimming competition at the 2008 Beijing Olympics, even though Chuck Norris does not swim. This is because when Chuck Norris enters the water, the water gets out of his way and Chuck Norris simply walks across the pool floor. +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. % -Chuck Norris built a better mousetrap, but the world was too frightened to beat a path to his door. +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. % -The original draft of The Lord of the Rings featured Chuck Norris instead of Frodo Baggins. It was only 5 pages long, as Chuck roundhouse-kicked Sauron's ass halfway through the first chapter. +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. % -Hellen Keller's favorite color is Chuck Norris. +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. % -Chuck Norris eats beef jerky and craps gunpowder. Then, he uses that gunpowder to make a bullet, which he uses to kill a cow and make more beef jerky. Some people refer to this as the "Circle of Life." +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. % -If, by some incredible space-time paradox, Chuck Norris would ever fight himself, he'd win. Period. +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. % -Chuck Norris is currently suing myspace for taking the name of what he calls everything around you. +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. % -The crossing lights in Chuck Norris's home town say "Die slowly" and "die quickly". They each have a picture of Chuck Norris punching or kicking a pedestrian. +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. % -Science Fact: Roundhouse kicks are comprised primarily of an element called Chucktanium. +The quickest way to a man's heart is with Chuck Norris' fist. % -The Sherman tank was originaly called the Norris tank until Chuck Norris decided it wasn't tough enough to be associated with him. The Army, for fear of Chuck Norris, renamed the tank and promised to develop a weapon more fitting of his name. To date, no weapon created has been badass enough to be named after Chuck Norris. +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. % -Chuck Norris proved that we are alone in the universe. We weren't before his first space expedition. +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. % -Superman once watched an episode of Walker, Texas Ranger. He then cried himself to sleep. +Chuck Norris can win a game of Connect Four in only three moves. % -Chuck Norris doesn't step on toes. Chuck Norris steps on necks. +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. % -The movie "Delta Force" was extremely hard to make because Chuck had to downplay his abilities. The first few cuts were completely unbelievable. +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. % -Movie trivia: The movie "Invasion U.S.A." is, in fact, a documentary. +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. % -Chuck Norris does not "style" his hair. It lays perfectly in place out of sheer terror. +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. % -There is no such thing as global warming. Chuck Norris was cold, so he turned the sun up. +Chuck Norris doesn’t wash his clothes, he disembowels them. % -A study showed the leading causes of death in the United States are: -1:Heart disease -2:Chuck Norris -3:Cancer +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. % -It's widely believed that Jesus was Chuck Norris' stunt double for crucifixion due to the fact that it is impossible for nails to pierce Chuck Norris' skin. +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. % -Chuck Norris did in fact, build Rome in a day. +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. % -Along with his black belt, Chuck Norris often chooses to wear brown shoes. No one has DARED call him on it. Ever. +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." % -Anytime someone is elected president in the United States, they must ask permission from Chuck Norris to live in the White House. The reason for this is because Chuck Norris had won every Federal, State, and Local election since 1777. He just allows others to run the country in his place. +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. % -Once you go Norris, you are physically unable to go back. +When God said "Let there be light!", Chuck Norris said "Only for half the day % -Ninjas want to grow up to be just like Chuck Norris. But usually they grow up just to be killed by Chuck Norris. +Chuck Norris went up the creek without a paddle... or a canoe % -Chuck Norris once sued Burger King after they refused to put razor wire in his Whopper Jr, insisting that that actually is "his" way. +Chuck Norris once asked a man to turn down his music, he refused, that man's baby was born deaf. % -The last thing you hear before Chuck Norris gives you a roundhouse kick? No one knows because dead men tell no tales. +Chuck Norris found the hay in the needle stack. % -Chuck Norris doesn't play god. Playing is for children. +Chuck Norris doesn't need to brush his teeth, his spit acts as a bleach. % -As a teen, Chuck Norris had sex with every nun in a convent tucked away in the hills of Tuscany. Nine months later the nuns gave birth to the 1972 Miami Dolphins, the only undefeated and untied team in professional football history. +Chuck Norris once had a street named after him. But the name removed at once, because nobody crosses Chuck Norris, and lives % -Chuck Norris is the only person in the world that can actually email a roundhouse kick. +The planes in 9/11 were not hijacked. Chuck Norris was just playing with his old radio controller. % -Chuck Norris won super bowls VII and VIII singlehandedly before unexpectedly retiring to pursue a career in ass-kicking. +Machiavelli said it is better to be feared than loved because he was inspired by Chuck Norris. % -Wo hu cang long. The translation from Mandarin Chinese reads: "Crouching Chuck, Hidden Norris" +Chuck Norris Can Play the Theme from the Twilight Zone with His Beard % -Chuck Norris can set ants on fire with a magnifying glass. At night. +Chuck Norris pees Adamantium % -Some kids play Kick the can. Chuck Norris played Kick the keg. +The Beatles are on iTunes because Chuck Norris bought a Mac. % -'Icy-Hot' is too weak for Chuck Norris. After a workout, Chuck Norris rubs his muscles down with liquid-hot MAGMA. +Chuck Norris once rounhouse kicked a football ...... it is now considered as a planet % -Chuck Norris cannot love, he can only not kill. +Chuck Norris yells at Drill Sergeants % -When Chuck Norris was a baby, he didn't suck his mother's breast. His mother served him whiskey, straight out of the bottle. +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. % -According to Einstein's theory of relativity, Chuck Norris can actually roundhouse kick you yesterday. +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. % -Chuck Norris once pulled out a single hair from his beard and skewered three men through the heart with it. +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. % -In an act of great philanthropy, Chuck made a generous donation to the American Cancer Society. He donated 6,000 dead bodies for scientific research. +Outer space exists because it's afraid to be on the same planet with Chuck Norris. % -Chuck Norris' favourite cut of meat is the roundhouse. +Chuck Norris does not sleep. He waits. % -When J. Robert Oppenheimer said "I am become death, the destroyer Of worlds", He was not referring to the atomic bomb. He was referring to the Chuck Norris halloween costume he was wearing. +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. % -Chuck Norris recently had the idea to sell his urine as a canned beverage. We know this beverage as Red Bull. +Chuck Norris is the reason why Waldo is hiding. % -In a recent survey it was discovered the 94% of American women lost their virginity to Chuck Norris. The other 6% were incredibly fat or ugly. +Chuck Norris counted to infinity - twice. % -Chuck Norris invented a language that incorporates karate and roundhouse kicks. So next time Chuck Norris is kicking your ass, don't be offended or hurt, he may be just trying to tell you he likes your hat. +There is no chin behind Chuck Norris’ beard. There is only another fist. % -If at first you don't succeed, you're not Chuck Norris. +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. % -If Chuck Norris were a calendar, every month would be named Chucktober, and every day he'd kick your ass. +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. % -Fear is not the only emotion Chuck Norris can smell. He can also detect hope, as in "I hope I don't get a roundhouse kick from Chuck Norris." -Too late, asshole. +Chuck Norris' hand is the only hand that can beat a Royal Flush. % -Chuck Norris's show is called Walker: Texas Ranger, because Chuck Norris doesn't run. +If at first you don't succeed, you're not Chuck Norris. % -MacGyver can build an airplane out of gum and paper clips, but Chuck Norris can roundhouse-kick his head through a wall and take it. +If Chuck Norris were a calendar, every month would be named Chucktober, and every day he'd kick your ass. % -Behind every successful man, there is a woman. Behind every dead man, there is Chuck Norris. +Chuck Norris can lead a horse to water AND make it drink. % -What's known as the UFC, or Ultimate Fighting Championship, doesn't use its full name, which happens to be "Ultimate Fighting Championship, Non-Chuck-Norris-Division". +Chuck Norris doesn’t wear a watch. HE decides what time it is. % -Chuck Norris brushes his teeth with a mixture of iron shavings, industrial paint remover, and wood-grain alcohol. +Chuck Norris can slam a revolving door. % -The easiest way to determine Chuck Norris' age is to cut him in half and count the rings. +Chuck Norris does not get frostbite. Chuck Norris bites frost. % -There is endless debate about the existence of the human soul. Well it does exist, and Chuck Norris finds it delicious. +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. % -Most boots are made for walkin'. Chuck Norris' boots ain't that merciful. +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. % -The US did not boycott the 1980 Summer Olympics in Moscow due to political reasons: Chuck Norris killed the entire US team with a single round-house kick during TaeKwonDo practice. +If you spell Chuck Norris in Scrabble, you win. Forever. % -Chuck Norris wears a live rattlesnake as a condom. +Guns don't kill people. Chuck Norris kills people. % -When the movie Pulp Fiction was filmed they had to borrow Chuck Norris's wallet... It's the one that says "Bad Mother Fucker" on it +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. % -The Bible was originally titled "Chuck Norris and Friends" +The chief export of Chuck Norris is Pain. % -Chuck Norris began selling the Total Gym as an ill-fated attempt to make his day-to-day opponents less laughably pathetic. +Chuck Norris has two speeds. Walk, and Kill. % -Do you know why Baskin Robbins only has 31 flavors? Because Chuck Norris doesn't like Fudge Ripple. +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. % -When Chuck Norris says "More cowbell", he fucking MEANS it. +Chuck Norris drives an ice cream truck covered in human skulls. % -On the set of Walker Texas Ranger Chuck Norris brought a dying lamb back to life by nuzzling it with his beard. As the onlookers gathered, the lamb sprang to life. Chuck Norris then roundhouse kicked it, killing it instantly. This was just to prove that the good Chuck giveth, and the good Chuck, he taketh away. +Chuck Norris is my Homeboy. % -Chuck Norris was what Willis was talkin' about. +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. % -Google won't search for Chuck Norris because it knows you don't find Chuck Norris, he finds you. +Chuck Norris uses pepper spray to spice up his steaks. % -Chuck Norris can lead a horse to water AND make it drink. +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. % -Nagasaki never had a bomb dropped on it. Chuck Norris jumped out of a plane and punched the ground. +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. % -It is scientifically impossible for Chuck Norris to have had a mortal father. The most popular theory is that he went back in time and fathered himself. +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. % -Chuck Norris destroyed the periodic table, because Chuck Norris only recognizes the element of surprise. +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. % -It is believed dinosaurs are extinct due to a giant meteor. That's true if you want to call Chuck Norris a giant meteor. +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. % -Chuck Norris shot the sheriff, but he round house kicked the deputy. +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. % -That's not Chuck Norris doing push-ups -- that's Chuck Norris moving the Earth away from the path of a deadly asteroid. +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. % -Chuck Norris can judge a book by its cover. +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. % -Nothing can escape the gravity of a black hole, except for Chuck Norris. Chuck Norris eats black holes. They taste like chicken. +The quickest way to a man's heart is with Chuck Norris' fist. % -Chuck Norris does not play the lottery. It doesn't have nearly enough balls. +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. % -Q: How many Chuck Norris' does it take to change a light bulb? -A: None, Chuck Norris prefers to kill in the dark. +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. % -As President Roosevelt said: "We have nothing to fear but fear itself. And Chuck Norris." +Chuck Norris can win a game of Connect Four in only three moves. % -Chuck Norris just says "no" to drugs. If he said "yes", it would collapse Colombia's infrastructure. +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. % -Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent.? +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. % -Crime does not pay - unless you are an undertaker following Walker, Texas Ranger, on a routine patrol. +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. % -Chuck Norris invented the internet? just so he had a place to store his porn. +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. % -Chuck Norris does not own a house. He walks into random houses and people move. +Chuck Norris doesn’t wash his clothes, he disembowels them. % -It is better to give than to receive. This is especially true of a Chuck Norris roundhouse kick. +Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent.? % -Chuck Norris is the only person to ever win a staring contest against Ray Charles and Stevie Wonder at the same time. +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. % -Industrial logging isn't the cause of deforestation. Chuck Norris needs toothpicks. +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. % -Chuck Norris smells what the Rock is cooking... because the Rock is Chuck Norris' personal chef. +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. % -When Chuck Norris plays Oregon Trail, his family does not die from cholera or dysentery, but rather, roundhouse kicks to the face. He also requires no wagon, since he carries the oxen, axels, and buffalo meat on his back. He always makes it to Oregon before you. +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." % -Chuck Norris is the reason why Waldo is hiding. +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. % -"Brokeback Mountain" is not just a movie. It's also what Chuck Norris calls the pile of dead ninjas in his front yard. +There is no such thing as being hard its called the Chuck Norris factor. % -When God said, "let there be light", Chuck Norris said, "say 'please'." +When Chuck Norris goes to the library, he looks for the guinness book of records in the comedy section. % -Chuck Norris does not eat. Food understands that the only safe haven from Chuck Norris' fists is inside his own body. +Chuck Norris can shoot a person 28 times with an unloaded gun. % -One day Chuck Norris walked down the street with a massive erection. There were no survivors. +Chuck Norris' personal airplane is called Air Force Chuck % -Chuck Norris built a time machine and went back in time to stop the JFK assassination. As Oswald shot, Chuck met all three bullets with his beard, deflecting them. JFK's head exploded out of sheer amazement. +The letters in Chuck Norris cannot be unscrambled. % -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. +Cops don't need a badges in their wallets but only a picture of Chuck Norris. % -Chuck Norris uses a night light. Not because Chuck Norris is afraid of the dark, but the dark is afraid of Chuck Norris. +Chuck Norris was the reason why the Great Wall of China was constructed. It failed miserably. % -Chuck Norris is not capable of hitting a target on the broad side of a barn. Every time he tries, the whole damn barn falls down. +If you see a man in the street who looks like Chuck Norris, but isn't, run: you don't want to be caught in the resulting roundhouse kick to his face. % -Before each filming of Walker: Texas Ranger, Chuck Norris is injected with fourteen times the lethal dose of elephant tranquilzer. This is, of course, to limit his strength and mobility, in an attempt to lower the fatality rate of the actors he fights. +The red phone in the oval office...Rings directly to Chuck Norris Cell Phone % -When Bruce Banner gets mad, he turns into the Hulk. When the Hulk gets mad, he turns into Chuck Norris. +The only way sharks will come near CN underwater is when CN is inside of a cage. % -Chuck Norris kills anyone that asks, "You want fries with that" because by now everyone should know that Chuck doesn't ever want fries with anything. Ever. +Chuck Norris uses a real mouse to move the cursor, type on the keyboard, write e-mails, code entire websites, use photoshop, bring coffee. % -Chuck Norris once kicked a horse in the chin. Its decendants are known today as Giraffes. +If Chuck Norris were to get into a fight with another Chuck Norris, Chuck Norris would win. % -Sticks and stones may break your bones, but a Chuck Norris glare will liquefy your kidneys. +"2012" is code for, Chuck Norris when he is pissed. % -Human cloning is outlawed because if Chuck Norris were cloned, then it would be possible for a Chuck Norris roundhouse kick to meet another chuck Norris roundhouse kick. Physicists theorize that this contact would end the universe. +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. % -Chuck Norris once went skydiving, but promised never to do it again. One Grand Canyon is enough. +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. % -Chuck Norris's version of a "chocolate milkshake" is a raw porterhouse wrapped around ten Hershey bars, and doused in diesel fuel. +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. % -If Chuck Norris round-house kicks you, you will die. If Chuck Norris' misses you with the round-house kick, the wind behind the kick will tear out your pancreas. +Outer space exists because it's afraid to be on the same planet with Chuck Norris. % -In a fight between Batman and Darth Vader, the winner would be Chuck Norris. +Chuck Norris does not sleep. He waits. % -Chuck Norris puts his pants on one leg at a time, just like the rest of us. The only difference is, then he fucking kills people. +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. % -Everybody loves Raymond. Except Chuck Norris. +Chuck Norris is the reason why Waldo is hiding. % -Contrary to popular belief, the Titanic didn't hit an iceberg. The ship was off course and accidentally ran into Chuck Norris while he was doing the backstroke across the Atlantic. +Chuck Norris counted to infinity - twice. % -Chuck Norris got his drivers license at the age of 16. Seconds. +There is no chin behind Chuck Norris’ beard. There is only another fist. % -The original title for Alien vs. Predator was Alien and Predator vs Chuck Norris. The film was cancelled shortly after going into preproduction. No one would pay nine dollars to see a movie fourteen seconds long. +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. % -Chuck Norris' sperm is so badass, he had sex with Nicole Kidman, and 7 months later she prematurely gave birth to a Ford Excursion. +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. % -Chuck Norris can win at solitaire with only 18 cards. +Chuck Norris' hand is the only hand that can beat a Royal Flush. % -Chuck Norris once shat blood - the blood of 11,940 natives he had killed and eaten. +Chuck Norris can lead a horse to water AND make it drink. % -Maslow's theory of higher needs does not apply to Chuck Norris. He only has two needs: killing people and finding people to kill. +Chuck Norris doesn’t wear a watch. HE decides what time it is. % -The truth will set you free. Unless Chuck Norris has you, in which case, forget it buddy! +Chuck Norris can slam a revolving door. % -For most people, home is where the heart is. For Chuck Norris, home is where he stores his collection of human skulls. +Chuck Norris does not get frostbite. Chuck Norris bites frost. % -Kryptonite has been found to contain trace elements of Chuck Norris roundhouse kicks to the face. This is why it is so deadly to Superman. +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. % -Saddam Hussein was not found hiding in a "hole." Saddam was roundhouse-kicked in the head by Chuck Norris in Kansas, which sent him through the earth, stopping just short of the surface of Iraq. +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. % -Coroners refer to dead people as "ABC's". Already Been Chucked. +If you spell Chuck Norris in Scrabble, you win. Forever. % -Chuck Norris doesn't look both ways before he crosses the street... he just roundhouses any cars that get too close. +Guns don't kill people. Chuck Norris kills people. % -Chuck Norris does not have to answer the phone. His beard picks up the incoming electrical impulses and translates them into audible sound. +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. % -How many roundhouse kicks does it take to get to the center of a tootsie pop? Just one. From Chuck Norris. +The chief export of Chuck Norris is Pain. % -Chuck Norris doesnt wear a watch, HE decides what time it is. +Chuck Norris has two speeds. Walk, and Kill. % -The phrase 'break a leg' was originally coined by Chuck Norris's co-stars in Walker, Texas Ranger as a good luck charm, indicating that a broken leg might be the worst extent of their injuries. This never proved to be the case. +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. % -When chuck Norris does division, there are no remainders. +Chuck Norris drives an ice cream truck covered in human skulls. % -If you rearrange the letters in "Chuck Norris", they also spell "Crush Rock In". The words "with his fists" are understood. +Chuck Norris is my Homeboy. % -Never look a gift Chuck Norris in the mouth, because he will bite your damn eyes off. +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. % -Give a man a fish, and you will feed him for a day. Give a man anything that is better than a fish, and Chuck Norris will beat his ass and take it. +Chuck Norris uses pepper spray to spice up his steaks. % -Chuck Norris used to play baseball. When Babe Ruth was hailed as the better player, Chuck Norris killed him with a baseball bat to the throat. Lou Gehrig got off easy. +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. % -The original title for Star Wars was "Skywalker: Texas Ranger". Starring Chuck Norris. +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. % -Guantuanamo Bay, Cuba, is the military code-word for "Chuck Norris' basement". +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. % -The phrase 'balls to the wall' was originally conceived to describe Chuck Norris entering any building smaller than an aircraft hangar. +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. % -Chuck Norris' roundhouse kick is so powerful, it can be seen from outer space by the naked eye. +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. % -Ozzy Osbourne bites the heads off of bats. Chuck Norris bites the heads off of Siberian Tigers. +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. % -He who lives by the sword, dies by the sword. He who lives by Chuck Norris, dies by the roundhouse kick. +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. % -The best-laid plans of mice and men often go awry. Even the worst-laid plans of Chuck Norris come off without a hitch. +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. % -The phrase 'dead ringer' refers to someone who sits behind Chuck Norris in a movie theater and forgets to turn their cell phone off. +The quickest way to a man's heart is with Chuck Norris' fist. % -Chuck Norris' Roundhouse kick is so powerful, that on the set of Sidekicks he single-footedly destroyed Jonathan Brandis' Career. +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. % -Staring at Chuck Norris for extended periods of time without proper eye protection will cause blindess, and possibly foot sized brusies on the face. +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. % -Chuck Norris can taste lies. +Chuck Norris can win a game of Connect Four in only three moves. % -Chuck Norris does not kick ass and take names. In fact, Chuck Norris kicks ass and assigns the corpse a number. It is currently recorded to be in the billions. +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. % -One time, Chuck Norris accidentally stubbed his toe. It destroyed the entire state of Ohio. +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. % -Little Miss Muffet sat on her tuffet, until Chuck Norris roundhouse kicked her into a glacier. +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. % -In 1990, Chuck Norris founded the non-profit organization "Kick Drugs Out of America". If the organization's name were "Roundhouse Kick Drugs out of America", there wouldn't be any drugs in the Western Hemisphere. Anywhere. +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. % -Chuck Norris can blow bubbles with beef jerky. +Chuck Norris doesn’t wash his clothes, he disembowels them. % -They had to edit the first ending of 'Lone Wolf McQuade' after Chuck Norris kicked David Carradine's ass, then proceeded to barbecue and eat him. +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. % -Chuck Norris does, in fact, live in a round house. +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. % -Chuck Norris was once on Jeopardy. This show is notable in that it was the first occasion in Jeopardy history that Alex Trebek had appeared without a mustache. And a head. +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. % -When Chuck Norris works out on the Total Gym, the Total Gym feels like it's been raped. +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." % -4 out of 5 doctors fail to recommend Chuck Norris as a solution to most problems. Also, 80% of doctors die unexplained, needlessly brutal deaths. +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. % -Chuck Norris can skeletize a cow in two minutes. +In the back of the book of world records, it says "All records are held by Chuck Norris. The ones listed are in second place." +% +The only place where the Starship Enterprise refuses to boldly go is Chuck Norris' planet...which is all of them. +% +Chuck Norris once had a pet monkey........his name was KING KONG +% +Chuck Norris can make his own megazord "The Chuck Norris Roundhouse Kickers Ultimate Super Awesome Megazord" +% +Simon doesn't say...Chuck Norris says. +% +When does Chuck Norris run out of shotgun bullets?.....whenever he wants to. % The only sure things are Death and Taxes, and when Chuck Norris goes to work for the IRS, they'll be the same thing. % -Chuck Norris' first job was as a paperboy. There were no survivors. +Chuck Norris' first job was as a paperboy. There were no survivors. +% +Chuck Norris can turn toast back into bread +% +Chuck Norris started Chuck Norris. +% +Ever wonder what really happened to the dinosaurs? They all dug their own graves when they heard Chuck Norris was coming +% +Chuck Norris killed Kemper +% +Did you here about the boy who cried Chuck Norris? +% +Chuck Norris can't perform Hadoukens, he IS a Hadouken +% +Behind every successful man is Chuck Norris +% +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. +% +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. +% +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. +% +Outer space exists because it's afraid to be on the same planet with Chuck Norris. +% +Chuck Norris does not sleep. He waits. +% +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. +% +Chuck Norris is the reason why Waldo is hiding. +% +Chuck Norris counted to infinity - twice. +% +MacGyver immediately tried to make a bomb out of some Q-Tips and Gatorade, but Chuck Norris roundhouse-kicked him in the solar plexus. MacGyver promptly threw up his own heart. +% +There is no chin behind Chuck Norris’ beard. There is only another fist. +% +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. +% +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. +% +Chuck Norris' hand is the only hand that can beat a Royal Flush. +% +Chuck Norris can lead a horse to water AND make it drink. +% +Chuck Norris doesn’t wear a watch. HE decides what time it is. +% +Chuck Norris can slam a revolving door. +% +Chuck Norris does not get frostbite. Chuck Norris bites frost. +% +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. +% +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. +% +If you spell Chuck Norris in Scrabble, you win. Forever. +% +Guns don't kill people. Chuck Norris kills people. +% +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. +% +The chief export of Chuck Norris is Pain. +% +Chuck Norris has two speeds. Walk, and Kill. +% +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. +% +Chuck Norris drives an ice cream truck covered in human skulls. +% +Chuck Norris is my Homeboy. +% +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. +% +Chuck Norris uses pepper spray to spice up his steaks. +% +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. +% +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. +% +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. +% +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. +% +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. +% +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. +% +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. +% +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. +% +The quickest way to a man's heart is with Chuck Norris' fist. +% +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. +% +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. +% +Chuck Norris can win a game of Connect Four in only three moves. +% +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. +% +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. +% +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. +% +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. +% +Chuck Norris doesn’t wash his clothes, he disembowels them. +% +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. +% +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. +% +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. +% +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." +% +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. +% +The square root of Chuck Norris is pain. Do not try to square Chuck Norris. The result is death +% +Chuck Norris doesn't read. He just stares at the book until he gets the information he wants. +% +Why didn't the chicken cross the road? Because Chuck Norris got to it first. +% +When taking the SAT, write "Chuck Norris" for every answer. You will score over 8000. +% +Chuck Norris can milk an alligator +% +Chuck Norris doesn't eat, he just sucks the energy out of food by staring at it +% +Chuck Norris once proved p^~p by induction on his beard hairs. +% +The reason why batman only comes out at night is because he's afraid he might encounter Chuck Norris in the Morning and afternoon. +% +Chuck Norris can bake in a Freezer. +% +Chuck Norris is currently suing any broadway theater that plays "The Nutcracker". He claims its an infringement on his "other" roundhouse kick. +% +Chuck Norris once had a weak moment, just to know what it felt like. +% +Note to everyone: Please do not give beans to Chuck Norris or do you want another atombomb on hiroshima? +% +Chuck Norris has made a 148 break a snooker. +% +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. +% +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. +% +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. +% +Outer space exists because it's afraid to be on the same planet with Chuck Norris. +% +Chuck Norris does not sleep. He waits. +% +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. +% +Chuck Norris is the reason why Waldo is hiding. +% +Chuck Norris counted to infinity - twice. +% +There is no chin behind Chuck Norris’ beard. There is only another fist. +% +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. +% +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. +% +Chuck Norris' hand is the only hand that can beat a Royal Flush. +% +Chuck Norris can lead a horse to water AND make it drink. +% +Chuck Norris doesn’t wear a watch. HE decides what time it is. +% +Chuck Norris can slam a revolving door. +% +Chuck Norris does not get frostbite. Chuck Norris bites frost. +% +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. +% +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. +% +If you spell Chuck Norris in Scrabble, you win. Forever. +% +Guns don't kill people. Chuck Norris kills people. +% +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. +% +The chief export of Chuck Norris is Pain. +% +Chuck Norris has two speeds. Walk, and Kill. +% +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. +% +Chuck Norris drives an ice cream truck covered in human skulls. +% +Chuck Norris is my Homeboy. +% +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. +% +Chuck Norris uses pepper spray to spice up his steaks. +% +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. +% +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. +% +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. +% +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. +% +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. +% +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. +% +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. +% +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. +% +The quickest way to a man's heart is with Chuck Norris' fist. +% +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. +% +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. +% +Chuck Norris can win a game of Connect Four in only three moves. +% +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. +% +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. +% +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. +% +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. +% +Chuck Norris doesn’t wash his clothes, he disembowels them. +% +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. +% +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. +% +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. +% +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." +% +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. +% +http://chucknorrisfacts.com/ is built in Drupal because Chuck Norris knows a good CMS when he sees one. +% +The producers of the movie "The Last Airbender" are now in talks with Chuck Norris in Order to star him in their next sequal "The Last Skull Bender". +% +Some boots were made for walking. Some boots may walk all over you, but Chuck Norris' boot walk THROUGH you. +% +World War II began because Chuck Norris took a nap. When he woke up, Hitler found out and killed himself out of fear Chuck Norris would kill him. +% +The best part of waking up is not Folgers in your cup, it's knowing that Chuck Norris let you live. +% +Only Chuck Norris can win the mind game, 'cause he never minds. +% +Do you know why Chuck Norris didn't star in The Expandebles? Because all the others guys would have surrended at the beginning. +% +Bruce Lee didn't defeat Chuck Norris. Chuck hit Bruce with a Delayed roundhouse kick that was so fast that Lee only felt the impact a year later! +% +Chuck Norris doesn't need a bulletproof vest to be bulletproof +% +When Chuck Norris goes to Vegas, he doesn't have to gamble. The casinos just give him stacks of money. +% +Merlin was Chuck Norris' assistant. +% +If you put in the correct cheat code in Halo 2, you can have Master Cheif play without his helmet; revealing to be Chuck Norris. +% +Those who ignore history, are doomed by Chuck Norris. +% +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. +% +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. +% +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. +% +Outer space exists because it's afraid to be on the same planet with Chuck Norris. +% +Chuck Norris does not sleep. He waits. +% +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. +% +Chuck Norris is the reason why Waldo is hiding. +% +Chuck Norris counted to infinity - twice. +% +There is no chin behind Chuck Norris’ beard. There is only another fist. +% +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. +% +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. +% +Chuck Norris' hand is the only hand that can beat a Royal Flush. +% +Chuck Norris can lead a horse to water AND make it drink. +% +Chuck Norris doesn’t wear a watch. HE decides what time it is. +% +Chuck Norris can slam a revolving door. +% +Chuck Norris does not get frostbite. Chuck Norris bites frost. +% +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. +% +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. +% +If you spell Chuck Norris in Scrabble, you win. Forever. +% +Guns don't kill people. Chuck Norris kills people. +% +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. +% +The chief export of Chuck Norris is Pain. +% +Chuck Norris has two speeds. Walk, and Kill. +% +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. +% +Chuck Norris drives an ice cream truck covered in human skulls. +% +Chuck Norris is my Homeboy. +% +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. +% +Chuck Norris uses pepper spray to spice up his steaks. +% +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. +% +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. +% +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. +% +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. +% +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. +% +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. +% +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. +% +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. +% +The quickest way to a man's heart is with Chuck Norris' fist. +% +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. +% +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. +% +Chuck Norris can win a game of Connect Four in only three moves. +% +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. +% +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. +% +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. +% +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. +% +Chuck Norris doesn’t wash his clothes, he disembowels them. +% +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. +% +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. +% +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. +% +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." +% +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. +% +Some kids pee their name in snow. Chuck Norris pees his name in concrete. +% +The Matrix Trilogy would have ended on the first movie if Keanu Reeves said, “I know Chuck Norris.” +% +Chuck Norris created Heavy Metal when he was upset +% +Some people ask for a Kleenex when they sneeze, Chuck Norris asks for a body bag. +% +When things go bump in the night.... it's Chuck Norris +% +Chuck Norris fed the Hunger Games +% +Chuck Norris played "Got your Nose" with Voldemort and won. +% +Chuck Norris had a knife thrown at him............ the knife didn't impale him, he impaled the knife +% +Chuck Norris doesn't let it go. +% +You know Chuck Norris' pet lizard, right? Last I heard, he was in the movie "Godzilla". Oh, and his pet turtle starred in "Gamera" as well. +% +Whatever Chuck Norris wants, it will instantly appear. +% +Chuck Norris once cut a knife with a stick of butter. +% +Chuck Norris shops at Sam's Club, but leaves without having his receipt checked +% +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. +% +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. +% +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. +% +Outer space exists because it's afraid to be on the same planet with Chuck Norris. +% +Chuck Norris does not sleep. He waits. +% +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. +% +Chuck Norris is the reason why Waldo is hiding. +% +Chuck Norris counted to infinity - twice. +% +There is no chin behind Chuck Norris’ beard. There is only another fist. +% +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. +% +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. +% +Chuck Norris' hand is the only hand that can beat a Royal Flush. +% +Chuck Norris can lead a horse to water AND make it drink. +% +Chuck Norris doesn’t wear a watch. HE decides what time it is. +% +Chuck Norris can slam a revolving door. +% +Chuck Norris does not get frostbite. Chuck Norris bites frost. +% +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. +% +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. +% +If you spell Chuck Norris in Scrabble, you win. Forever. +% +Guns don't kill people. Chuck Norris kills people. +% +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. +% +The chief export of Chuck Norris is Pain. +% +Chuck Norris has two speeds. Walk, and Kill. +% +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. +% +Chuck Norris drives an ice cream truck covered in human skulls. +% +Chuck Norris is my Homeboy. +% +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. +% +Chuck Norris uses pepper spray to spice up his steaks. +% +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. +% +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. +% +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. +% +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. +% +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. +% +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. +% +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. +% +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. +% +The quickest way to a man's heart is with Chuck Norris' fist. +% +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. +% +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. +% +Chuck Norris can win a game of Connect Four in only three moves. +% +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. +% +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. +% +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. +% +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. +% +Chuck Norris doesn’t wash his clothes, he disembowels them. +% +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. +% +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. +% +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. +% +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." +% +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. +% +In 1945 The US army asked if they could clone Chuck Norris. instead he said he could sort out the Japanese. +% +One glance from Chuck Norris and snow turns itself yellow. +% +Chuck Norris checks under his bed for Fedor Emelianenko because he takes Fedor to the vet regularly. +% +Chuck Norris was the image used for Papa Smurf. +% +Chuck Norris is so scary he makes Sharks swim backwards away from him +% +When Chuck Norris tosses a coin, it lands on both head and tail. +% +Chuck Norris found the last digit of pie +% +Chuck Norris Watches "the Nat.Geo. Specials" on Discovery Channel +% +James Bond has a license to kill. He got it from Chuck Norris. +% +Chuck Norris is Chuck Norris +% +"The Big Chuck Norris Roundhouse-Kick Theory" +% +That's not an eclipse....that's the sun hiding from Chuck Norris. +% +Chuck Norris doesn't like Mudkipz +% +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. +% +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. +% +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. +% +Outer space exists because it's afraid to be on the same planet with Chuck Norris. +% +Chuck Norris does not sleep. He waits. +% +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. +% +Chuck Norris is the reason why Waldo is hiding. +% +Chuck Norris counted to infinity - twice. +% +There is no chin behind Chuck Norris’ beard. There is only another fist. +% +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. +% +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. +% +Chuck Norris' hand is the only hand that can beat a Royal Flush. +% +Chuck Norris can lead a horse to water AND make it drink. +% +Chuck Norris doesn’t wear a watch. HE decides what time it is. +% +Chuck Norris can slam a revolving door. +% +Chuck Norris does not get frostbite. Chuck Norris bites frost. +% +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. +% +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. +% +If you spell Chuck Norris in Scrabble, you win. Forever. +% +Guns don't kill people. Chuck Norris kills people. +% +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. +% +The chief export of Chuck Norris is Pain. +% +Chuck Norris has two speeds. Walk, and Kill. +% +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. +% +Chuck Norris drives an ice cream truck covered in human skulls. +% +Chuck Norris is my Homeboy. +% +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. +% +Chuck Norris uses pepper spray to spice up his steaks. +% +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. +% +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. +% +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. +% +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. +% +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. +% +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. +% +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. +% +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. +% +The quickest way to a man's heart is with Chuck Norris' fist. +% +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. +% +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. +% +Chuck Norris can win a game of Connect Four in only three moves. +% +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. +% +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. +% +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. +% +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. +% +Chuck Norris doesn’t wash his clothes, he disembowels them. +% +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. +% +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. +% +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. +% +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." +% +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. +% +Chuck Norris doesn’t eat salad, he eats vegetarians +% +Every time there's an earthquake, you know Chuck Norris is hungry. The earthquake is caused by his stomach growling. +% +Chuck Norris wasn't born on his birthday +% +One time a test cheated on Chuck Norris. +% +Chuck Norris won a stepdance contest by standing on his hands +% +Chuck Norris thretened to kill Michael Jackson, MJ got so scared to turned white. +% +When Steven Seagal kills a ninja, he only takes its hide. When Chuck Norris kills a ninja, he uses every part. +% +Chuck Norris is the life of parties he dosen't attend +% +Chuck Norris can rub two fires together and make a stick! +% +Contrary to popular beleif, Rome WAS built in a day, by Chuck Norris. +% +Chuck Norris rolled a 20 on a 6 sided die. +% +When chuck Norris was in school, he made his PE teacher run laps. +% +Chuck Norris wins NASCAR races with all right turns. +% +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. +% +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. +% +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. +% +Outer space exists because it's afraid to be on the same planet with Chuck Norris. +% +Chuck Norris does not sleep. He waits. +% +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. +% +Chuck Norris is the reason why Waldo is hiding. +% +Chuck Norris counted to infinity - twice. +% +There is no chin behind Chuck Norris’ beard. There is only another fist. +% +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. +% +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. +% +Chuck Norris' hand is the only hand that can beat a Royal Flush. +% +Chuck Norris can lead a horse to water AND make it drink. +% +Chuck Norris doesn’t wear a watch. HE decides what time it is. +% +Chuck Norris can slam a revolving door. +% +Chuck Norris does not get frostbite. Chuck Norris bites frost. +% +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. +% +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. +% +If you spell Chuck Norris in Scrabble, you win. Forever. +% +Guns don't kill people. Chuck Norris kills people. +% +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. +% +The chief export of Chuck Norris is Pain. +% +Chuck Norris has two speeds. Walk, and Kill. +% +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. +% +Chuck Norris drives an ice cream truck covered in human skulls. +% +Chuck Norris is my Homeboy. +% +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. +% +Chuck Norris uses pepper spray to spice up his steaks. +% +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. +% +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. +% +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. +% +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. +% +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. +% +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. +% +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. +% +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. +% +The quickest way to a man's heart is with Chuck Norris' fist. +% +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. +% +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. +% +Chuck Norris can win a game of Connect Four in only three moves. +% +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. +% +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. +% +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. +% +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. +% +Chuck Norris doesn’t wash his clothes, he disembowels them. +% +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. +% +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. +% +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. +% +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." +% +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. +% +Chuck Norris is waiting for Mt. St. Helens to erupt again. He's hoping the lava is hot enough to soften his beard so he can shave for the first time. +% +Chuck Norris is overra... +% +Chuck Norris was originally in Mortal Kombat, but that version was deleted because no one can beat Chuck Norris in a fight. +% +Chuck Norris likes everyone on the earth, cause everyone he didn't like... Is dead... +% +Chunk Norris can make sour milk turn fresh +% +There is no limbo, only a world that doesn't know of Chuck Norris +% +Chuck Norris CAN believe it's not butter +% +Dog the Bounty Hunter can't track Chuck Norris down. +% +Abraham Lincoln didn't die because he was shot, Chuck Norris roundhouse-kicked so fast his foot went back in time and killed Abraham Lincoln. +% +When Chuck Norris inhales helium, his voice doesn't change. +% +When Chuck Norris drinks water, the water automatically pasteurized. +% +Chuck Norris once punched the ground to stop an earthquake. The resulting aftershock caused the BP oil spill +% +Chuck Norris can play the death waltz with his chin. +% +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. +% +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. +% +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. +% +Outer space exists because it's afraid to be on the same planet with Chuck Norris. +% +Chuck Norris does not sleep. He waits. +% +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. +% +Chuck Norris is the reason why Waldo is hiding. +% +Chuck Norris counted to infinity - twice. +% +There is no chin behind Chuck Norris’ beard. There is only another fist. +% +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. +% +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. +% +Chuck Norris' hand is the only hand that can beat a Royal Flush. +% +Chuck Norris can lead a horse to water AND make it drink. +% +Chuck Norris doesn’t wear a watch. HE decides what time it is. +% +Chuck Norris can slam a revolving door. +% +Chuck Norris does not get frostbite. Chuck Norris bites frost. +% +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. +% +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. +% +If you spell Chuck Norris in Scrabble, you win. Forever. +% +Guns don't kill people. Chuck Norris kills people. +% +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. +% +The chief export of Chuck Norris is Pain. +% +Chuck Norris has two speeds. Walk, and Kill. +% +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. +% +Chuck Norris drives an ice cream truck covered in human skulls. +% +Chuck Norris is my Homeboy. +% +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. +% +Chuck Norris uses pepper spray to spice up his steaks. +% +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. +% +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. +% +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. +% +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. +% +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. +% +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. +% +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. +% +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. +% +The quickest way to a man's heart is with Chuck Norris' fist. +% +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. +% +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. +% +Chuck Norris can win a game of Connect Four in only three moves. +% +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. +% +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. +% +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. +% +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. +% +Chuck Norris doesn’t wash his clothes, he disembowels them. +% +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. +% +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. +% +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. +% +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." +% +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. +% +More of a question than a fact: in a fight between Chuck Norris and Gordan Freeman who would win? +% +Chuck Norris once round-house kicked a salesman. Over the phone. +% +Chuck Norris can grill a popsicle +% +Chuck Norris' films are factual documentaries. +% +Casinos pay Chuck Norris not to play at anything or wish anyone good luck. +% +Chuck Norris once got a 200 yard punt return +% +Every line in a Chuck Norris haiku is "A roundhouse kick to the face." And they all have the correct number of syllables. +% +An angry glare from Chuck Norris is known to kill on the spot. +% +Evolution's driving mechanism is nature's desperate attempt to escape Chuck Norris. +% +When President Roosevelt dropped the atomic bomb on Hiroshima, he did so only because it was more human then sending Chuck Norris. +% +Don't get Chuck Norris angry, last time somebody did that Chuck Norris made the Grand Canyon. +% +In Texas, there are five sizes for fountain drinks: small, medium, large, Texas sized, and Chuck Norris Sized. It is a cup made of a human skull. +% +After Chuck counted to infinity the first time, he vowed to count to infinity a second time....by counting the bodies of those previously roundhoused. +% +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. +% +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. +% +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. +% +Outer space exists because it's afraid to be on the same planet with Chuck Norris. +% +Chuck Norris does not sleep. He waits. +% +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. +% +Chuck Norris is the reason why Waldo is hiding. +% +Chuck Norris counted to infinity - twice. +% +There is no chin behind Chuck Norris’ beard. There is only another fist. +% +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. +% +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. +% +Chuck Norris' hand is the only hand that can beat a Royal Flush. +% +Chuck Norris can lead a horse to water AND make it drink. +% +Chuck Norris doesn’t wear a watch. HE decides what time it is. +% +Chuck Norris can slam a revolving door. +% +Chuck Norris does not get frostbite. Chuck Norris bites frost. +% +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. +% +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. +% +If you spell Chuck Norris in Scrabble, you win. Forever. +% +Guns don't kill people. Chuck Norris kills people. +% +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. +% +The chief export of Chuck Norris is Pain. +% +Chuck Norris has two speeds. Walk, and Kill. +% +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. +% +Chuck Norris drives an ice cream truck covered in human skulls. +% +Chuck Norris is my Homeboy. +% +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. +% +Chuck Norris uses pepper spray to spice up his steaks. +% +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. +% +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. +% +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. +% +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. +% +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. +% +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. +% +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. +% +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. +% +The quickest way to a man's heart is with Chuck Norris' fist. +% +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. +% +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. +% +Chuck Norris can win a game of Connect Four in only three moves. +% +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. +% +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. +% +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. +% +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. +% +Chuck Norris doesn’t wash his clothes, he disembowels them. +% +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. +% +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. +% +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. +% +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." +% +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. +% +Taking Karate Lessons = $100, Buying MMA DVD's= $150, Subscribing to a UFC event = $50, Getting a Roundhouse Kick from Chuck Norris = PRICELESS +% +Chuck Norris played the game of thrones and won +% +Chuck Norris doesn't need sunglasses, the sun needs Chuck Norris glasses +% +Chuck Norris doesn't call the wrong number, you just answer the wrong phone. +% +Chuck Norris once won the tour de france riding a " big wheel" +% +May the Force be with Chuck Norris... for it's own good. +% +Chuck Norris once played Duck Duck Goose with a group of Kindergarteners. Only one kid made it to first grade +% +During the Civil War Chuck Norris was a slave, his master would often beg him for mercy +% +Chuck Norris' glass is never half full or half empty. It stays full even after he takes a drink. +% + King Kong climbed the Empire State building in fear of Chuck Norris who was downstairs at the time. +% +Chuck Norris can French kiss his elbow. +% +Chuck Norris never trains, because he's Chuck Norris. +% +Every phobia known to man has a phobia of Chuck Norris +% +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. +% +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. +% +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. +% +Outer space exists because it's afraid to be on the same planet with Chuck Norris. +% +Chuck Norris does not sleep. He waits. +% +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. +% +Chuck Norris is the reason why Waldo is hiding. +% +Chuck Norris counted to infinity - twice. +% +There is no chin behind Chuck Norris’ beard. There is only another fist. +% +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. +% +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. +% +Chuck Norris' hand is the only hand that can beat a Royal Flush. +% +Chuck Norris can lead a horse to water AND make it drink. +% +Chuck Norris doesn’t wear a watch. HE decides what time it is. +% +Chuck Norris can slam a revolving door. +% +Chuck Norris does not get frostbite. Chuck Norris bites frost. +% +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. +% +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. +% +If you spell Chuck Norris in Scrabble, you win. Forever. +% +Guns don't kill people. Chuck Norris kills people. +% +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. +% +The chief export of Chuck Norris is Pain. +% +Chuck Norris has two speeds. Walk, and Kill. +% +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. +% +Chuck Norris drives an ice cream truck covered in human skulls. +% +Chuck Norris is my Homeboy. +% +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. +% +Chuck Norris uses pepper spray to spice up his steaks. +% +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. +% +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. +% +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. +% +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. +% +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. +% +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. +% +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. +% +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. +% +The quickest way to a man's heart is with Chuck Norris' fist. +% +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. +% +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. +% +Chuck Norris can win a game of Connect Four in only three moves. +% +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. +% +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. +% +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. +% +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. +% +Chuck Norris doesn’t wash his clothes, he disembowels them. +% +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. +% +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. +% +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. +% +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." +% +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. +% +Once upon a time, Chuck Norris found himself in a town called Shit Creek.....He opened a Paddle Store. +% +Chuck Norris Can Power Solar Panels. At Night. +% +When Betty White gets angry, she turns into the Hulk. When Valerie Bertinelli gets mad, she turns into Chuck Norris. +% +Chuck Norris is so hard, he uses diamonds as stress balls. +% +Chuck Norris can roundhouse kick someone through a window without breaking the glass +% +Chuck Norris. Enough said. +% +The letters in Chuck Norris cannot be unscrambled. +% +Chuck Norris once taught a class of martial arts.Unfortunately Chuck had forgiven to take elephant tranquilizers and killed every one just by saluting +% +Chuck Norris was heard in a soundproof room! +% +Chuck Norris can see in 3D with just one eye. +% +Chuck Norris owns all number 1 pencils. +% +Staring at Chuck Norris for extended periods of time without proper eye protection will cause blindess, and possibly foot sized brusies on the face. +% +Chuck Norris doesn’t brew up tea. He sucks the bag. +% +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. +% +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. +% +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. +% +Outer space exists because it's afraid to be on the same planet with Chuck Norris. +% +Chuck Norris does not sleep. He waits. +% +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. +% +Chuck Norris is the reason why Waldo is hiding. +% +Chuck Norris counted to infinity - twice. +% +There is no chin behind Chuck Norris’ beard. There is only another fist. +% +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. +% +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. +% +Chuck Norris' hand is the only hand that can beat a Royal Flush. +% +Chuck Norris can lead a horse to water AND make it drink. +% +Chuck Norris doesn’t wear a watch. HE decides what time it is. +% +Chuck Norris can slam a revolving door. +% +Chuck Norris does not get frostbite. Chuck Norris bites frost. +% +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. +% +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. +% +If you spell Chuck Norris in Scrabble, you win. Forever. +% +Guns don't kill people. Chuck Norris kills people. +% +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. +% +The chief export of Chuck Norris is Pain. +% +Chuck Norris has two speeds. Walk, and Kill. +% +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. +% +Chuck Norris drives an ice cream truck covered in human skulls. +% +Chuck Norris is my Homeboy. +% +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. +% +Chuck Norris uses pepper spray to spice up his steaks. +% +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. +% +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. +% +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. +% +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. +% +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. +% +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. +% +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. +% +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. +% +The quickest way to a man's heart is with Chuck Norris' fist. +% +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. +% +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. +% +Chuck Norris can win a game of Connect Four in only three moves. +% +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. +% +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. +% +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. +% +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. +% +Chuck Norris doesn’t wash his clothes, he disembowels them. +% +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. +% +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. +% +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. +% +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." +% +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. +% +They say death by a 1000 lashes was the most painful way to die, that was before they got roundhouse kicked in the face by Chuck Norris +% +Chuck Norris made a statue bleed. +% +Dead bodies were found of people that are still alive. These people will cross Chuck Norris in the future and will be round-house kicked back in time. +% +The reason why batman only comes out at night is because he's afraid he might encounter Chuck Norris in the Morning and afternoon. +% +The kids said when Chuck was eating Trix cereal ´´silly Chuck, Trix are for kids´´...what happened next?..............................Darfur happened. +% +Chuck Norris can roundhouse-kick round houses into squares. +% +Chuck Norris is allowed two carry-ons. +% +Chuck Norris can divide by zero. +% +Chuck Norris does not have a cell phone because he hears everything +% +Chuck Norris isn't appropriate...appropriate isn't Chuck Norris +% +Earth's rotation is purely governed by the direction that Chuck Norris is walking. +% +Chuck Norris drowned a man ON LAND. +% +The Jone's are trying to keep up with Chuck Norris +% +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. +% +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. +% +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. +% +Outer space exists because it's afraid to be on the same planet with Chuck Norris. +% +Chuck Norris does not sleep. He waits. +% +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. +% +Chuck Norris is the reason why Waldo is hiding. +% +Chuck Norris counted to infinity - twice. +% +There is no chin behind Chuck Norris’ beard. There is only another fist. +% +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. +% +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. +% +Chuck Norris' hand is the only hand that can beat a Royal Flush. +% +Chuck Norris can lead a horse to water AND make it drink. +% +Chuck Norris doesn’t wear a watch. HE decides what time it is. +% +Chuck Norris can slam a revolving door. +% +Chuck Norris does not get frostbite. Chuck Norris bites frost. +% +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. +% +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. +% +If you spell Chuck Norris in Scrabble, you win. Forever. +% +Guns don't kill people. Chuck Norris kills people. +% +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. +% +The chief export of Chuck Norris is Pain. +% +Chuck Norris has two speeds. Walk, and Kill. +% +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. +% +Chuck Norris drives an ice cream truck covered in human skulls. +% +Chuck Norris is my Homeboy. +% +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. +% +Chuck Norris uses pepper spray to spice up his steaks. +% +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. +% +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. +% +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. +% +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. +% +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. +% +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. +% +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. +% +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. +% +The quickest way to a man's heart is with Chuck Norris' fist. +% +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. +% +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. +% +Chuck Norris can win a game of Connect Four in only three moves. +% +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. +% +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. +% +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. +% +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. +% +Chuck Norris doesn’t wash his clothes, he disembowels them. +% +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. +% +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. +% +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. +% +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." +% +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. +% +Chuck Norris bowled a 301 after constructing another pin out of his beard hair +% +The only reason that USA lost the 2011 world cup to Japan is because Chuck Norris wasn't there. +% +Unlike Jack Bauer, Chuck Norris doesn't need bullets. A quick roundhouse to the face kills twice as fast. +% +There is no such thing as global warming. Chuck Norris was cold, so he turned the sun up. +% +Chuck Norris' dog pick up after him. +% +Jedis are now taught to use the "Chuck" +% +Chuck Norris dosent carry a list. He always knows what to do. +% +When Chuck Norris performs a roundhouse kick, he's actually measuring the circumference of the universe. +% +Walker: Texas Ranger went into syndication before the first episode was shot. +% +Chuck Norris doesn't throw up if he drinks too much. Chuck Norris throws down! +% +"Walker Texas Ranger: The Movie 3-D" was considered by Warner Brothers; however the technology to create the visual effects will never be possible. +% +When Chuck Norris creates a login, it tells him "password not strong enough", he types in his name and it tells him "password too strong." +% +Chuck Norris isn't allowed at the zoo because when he's there the animals are terriefied to come out their cages +% +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. +% +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. +% +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. +% +Outer space exists because it's afraid to be on the same planet with Chuck Norris. +% +Chuck Norris does not sleep. He waits. +% +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. +% +Chuck Norris is the reason why Waldo is hiding. +% +Chuck Norris counted to infinity - twice. +% +There is no chin behind Chuck Norris’ beard. There is only another fist. +% +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. +% +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. +% +Chuck Norris' hand is the only hand that can beat a Royal Flush. +% +Chuck Norris can lead a horse to water AND make it drink. +% +Chuck Norris doesn’t wear a watch. HE decides what time it is. +% +Chuck Norris can slam a revolving door. +% +Chuck Norris does not get frostbite. Chuck Norris bites frost. +% +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. +% +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. +% +If you spell Chuck Norris in Scrabble, you win. Forever. +% +Guns don't kill people. Chuck Norris kills people. +% +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. +% +The chief export of Chuck Norris is Pain. +% +Chuck Norris has two speeds. Walk, and Kill. +% +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. +% +Chuck Norris drives an ice cream truck covered in human skulls. +% +Chuck Norris is my Homeboy. +% +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. +% +Chuck Norris uses pepper spray to spice up his steaks. +% +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. +% +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. +% +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. +% +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. +% +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. +% +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. +% +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. +% +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. +% +The quickest way to a man's heart is with Chuck Norris' fist. +% +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. +% +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. +% +Chuck Norris can win a game of Connect Four in only three moves. +% +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. +% +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. +% +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. +% +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. +% +Chuck Norris doesn’t wash his clothes, he disembowels them. +% +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. +% +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. +% +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. +% +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." +% +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. +% +Aliens fear that Chuck Norris might abduct them. +% +Chuck Norris splattered tiger blood and Adonis' dna on Charlie Sheen with 1 roundhouse kick! +% +How much wood could a woodchuck chuck if a woodchuck could chuck wood? No woodchuck could chuck Chuck's wood! +% +The sun only rises every morning because Chuck Norris allows it to. +% +Chuck Norris can do a regime change with a roundhouse kick. +% +Chuck Norris CAN spell with an I before E even after C. +% +Ghosts can see Chuck Norris +% +The answer to life, the universe and everything isnt 42. It's Chuck Norris. +% +When Chuck Norris pokes the Pillsbury Doughboy, it's not a laughing matter. +% +Chuck Norris once thought he was wrong. He was, however, mistaken. +% +Ever wonder what really happened to the dinosaurs? They all dug their own graves when they heard Chuck Norris was coming +% +"The wind cries Chuck Norris" +% +Chuck Norris doesn't need a bulletproof vest. He catches them with his bare hands. +% +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. +% +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. +% +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. +% +Outer space exists because it's afraid to be on the same planet with Chuck Norris. +% +Chuck Norris does not sleep. He waits. +% +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. +% +Chuck Norris is the reason why Waldo is hiding. +% +Chuck Norris counted to infinity - twice. +% +There is no chin behind Chuck Norris’ beard. There is only another fist. +% +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. +% +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. +% +Chuck Norris' hand is the only hand that can beat a Royal Flush. +% +Chuck Norris can lead a horse to water AND make it drink. +% +Chuck Norris doesn’t wear a watch. HE decides what time it is. +% +Chuck Norris can slam a revolving door. +% +Chuck Norris does not get frostbite. Chuck Norris bites frost. +% +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. +% +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. +% +If you spell Chuck Norris in Scrabble, you win. Forever. +% +Guns don't kill people. Chuck Norris kills people. +% +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. +% +The chief export of Chuck Norris is Pain. +% +Chuck Norris has two speeds. Walk, and Kill. +% +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. +% +Chuck Norris drives an ice cream truck covered in human skulls. +% +Chuck Norris is my Homeboy. +% +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. +% +Chuck Norris uses pepper spray to spice up his steaks. +% +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. +% +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. +% +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. +% +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. +% +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. +% +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. +% +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. +% +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. +% +The quickest way to a man's heart is with Chuck Norris' fist. +% +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. +% +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. +% +Chuck Norris can win a game of Connect Four in only three moves. +% +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. +% +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. +% +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. +% +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. +% +Chuck Norris doesn’t wash his clothes, he disembowels them. +% +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. +% +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. +% +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. +% +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." +% +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. +% +Chuck Norris: even Naruto can't believe it +% +Chuck Norris can fit 10 gallons of water in a 5 gallon water bucket % -With the rising cost of gasoline, Chuck Norris is beginning to worry about his drinking habit. +Chuck Norris roundhouse kicks people in the face first and asks questions later. % -The square root of Chuck Norris is pain. Do not try to square Chuck Norris, the result is death. +Chuck Norris is the only one who can tear a facebook page! % -Chuck Norris' testicles do not produce sperm. They produce tiny white ninjas that recognize only one mission: seek and destroy. +Chuck Norris doesn't need air, he is air % -To be or not to be? That is the question. The answer? Chuck Norris. +Chuck Norris once tried to teach a fat, stupid kid Martial Arts. Unsuccessfully. The kid grew up to be Steven Seagal. % -Chuck Norris has never been in a fight, ever. Do you call one roundhouse kick to the face a fight? +Achievement Unlocked: Chuck Norris of Death % -There are two types of people in the world... people that suck, and Chuck Norris. +Chuck Norris is the ghost in paranormal activity. % -Chuck Norris never wet his bed as a child. The bed wet itself out of fear. +Chuck Norris can't get fired by Donald Trump % -If you were somehow able to land a punch on Chuck Norris your entire arm would shatter upon impact. This is only in theory, since, come on, who in their right mind would try this? +Ozzy Osbourne once accidentally bit the head off a live bat - Chuck Norris once deliberately bit the head off a live pterodactyl. % -70% of a human's weight is water. 70% of Chuck Norris' weight is his dick. +Note to self: Don’t be the cashier to tell Chuck Norris his coupons have expired. % -Jean-Claude Van Damme once kicked Chuck Norris' ass. He was then awakened from his dream by a roundhouse kick to the face. +Chuck Norris was what Willis was talking about. % -The pie scene in "American Pie" is based on a dare Chuck Norris took when he was younger. However, in Chuck Norris' case, the "pie" was the molten crater of an active volcano. +Chuck Norris is entitiled to his own facts. % -Chuck Norris uses 8'x10' sheets of plywood as toilet paper. +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. % -Noah was the only man notified before Chuck Norris relieved himself in the Atlantic Ocean. +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. % -Chuck Norris once invited all of the other badasses from TV to duke it out in order to see who was the supreme badass. Only two showed up-- Jack Bauer and MacGyver. +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. % -MacGyver immediately tried to make a bomb out of some Q-Tips and Gatorade, but Chuck Norris roundhouse-kicked him in the solar plexus. MacGyver promptly threw up his own heart. +Outer space exists because it's afraid to be on the same planet with Chuck Norris. % -Jack Bauer tried to use his detailed knowledge of torture techniques, but to no avail: Chuck Norris thrives on pain. Chuck Norris then ripped off Jack Bauer's arm and beat him to death with it. Game, set, match. +Chuck Norris does not sleep. He waits. % -Chuck Norris eats steak for every single meal. Most times he forgets to kill the cow. +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. % -The First Law of Thermodynamics states that energy can neither be created nor destroyed... unless it meets Chuck Norris. +Chuck Norris is the reason why Waldo is hiding. % -Chuck Norris doesn't go on the internet, he has every internet site stored in his memory. He refreshes webpages by blinking. +Chuck Norris counted to infinity - twice. % -Fact: Chuck Norris doesn't consider it sex if the woman survives. +There is no chin behind Chuck Norris’ beard. There is only another fist. % -It is said that looking into Chuck Norris' eyes will reveal your future. Unfortunately, everybody's future is always the same: death by a roundhouse-kick to the face. +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. % -Chuck Norris knows everything there is to know - Except for the definition of mercy. +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. % -Scientifically speaking, it is impossible to charge Chuck Norris with "obstruction of justice." This is because even Chuck Norris cannot be in two places at the same time. +Chuck Norris' hand is the only hand that can beat a Royal Flush. % -Chuck Norris never has to wax his skis because they're always slick with blood. +Chuck Norris can lead a horse to water AND make it drink. % -When you say "no one's perfect", Chuck Norris takes this as a personal insult. +Chuck Norris doesn’t wear a watch. HE decides what time it is. % -Chuck Norris can win a game of Trivial Pursuit with one roll of the dice, and without answering a single question... just a nod of the head, and a stroke of the beard. +Chuck Norris can slam a revolving door. % -182,000 Americans die from Chuck Norris-related accidents every year. +Chuck Norris does not get frostbite. Chuck Norris bites frost. % -Paper beats rock, rock beats scissors, and scissors beats paper, but Chuck Norris beats all 3 at the same time. +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. % -Jesus can walk on water, but Chuck Norris can walk on Jesus. +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. % -All roads lead to Chuck Norris. And by the transitive property, a roundhouse kick to the face. +If you spell Chuck Norris in Scrabble, you win. Forever. % -If you're driving down the road and you think Chuck Norris just cut you off, you better thank your lucky stars it wasn't the other way around. +Guns don't kill people. Chuck Norris kills people. % -July 4th is Independence day. And the day Chuck Norris was born. Coincidence? i think not. +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. % -Chuck Norris never goes to the dentist because his teeth are unbreakable. His enemies never go to the dentist because they have no teeth. +The chief export of Chuck Norris is Pain. % -In the medical community, death is referred to as "Chuck Norris Disease" +Chuck Norris has two speeds. Walk, and Kill. % -Chuck Norris was once in a knife fight, and the knife lost. +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. % -If you work in an office with Chuck Norris, don't ask him for his three-hole-punch. +Chuck Norris drives an ice cream truck covered in human skulls. % -In the Words of Julius Caesar, "Veni, Vidi, Vici, Chuck Norris". Translation: I came, I saw, and I was roundhouse-kicked inthe face by Chuck Norris. +Chuck Norris is my Homeboy. % -The First rule of Chuck Norris is: you do not talk about Chuck Norris. +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. % -Chuck Norris is widely predicted to be first black president. If you're thinking to yourself, "But Chuck Norris isn't black", then you are dead wrong. And stop being a racist. +Chuck Norris uses pepper spray to spice up his steaks. % -When Chuck Norris plays Monopoly, it affects the actual world economy. +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. % -Chuck Norris can be unlocked on the hardest level of Tekken. But only Chuck Norris is skilled enough to unlock himself. Then he roundhouse kicks the Playstation back to Japan. +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. % -Chuck Norris drinks napalm to quell his heartburn. +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. % -Every time someone uses the word "intense", Chuck Norris always replies "you know what else is intense?" followed by a roundhouse kick to the face. +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. % -As an infant, Chuck Norris' parents gave him a toy hammer. He gave the world Stonehenge. +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. % -Chuck Norris once ordered a steak in a restaurant. The steak did what it was told. +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. % -Most people fear the Reaper. Chuck Norris considers him "a promising Rookie". +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. % -There are only two things that can cut diamonds: other diamonds, and Chuck Norris. +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. % -President Roosevelt once rode his horse 100 miles. Chuck Norris carried his the same distance in half the time. +The quickest way to a man's heart is with Chuck Norris' fist. % -Chuck Norris once ate four 30lb bowling balls without chewing. +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. % -What many people dont know is chuck norris is the founder of planned parenthood. Not even unborn children can escape his wrath. +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. % -Chuck Norris was banned from competitive bullriding after a 1992 exhibition in San Antonio, when he rode the bull 1,346 miles from Texas to Milwaukee Wisconsin to pick up his dry cleaning. +Chuck Norris can win a game of Connect Four in only three moves. % -Chuck Norris qualified with a top speed of 324 mph at the Daytona 500, without a car. +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. % -Chuck Norris likes his coffee half and half: half coffee grounds, half wood-grain alcohol. +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. % -Chuck Norris uses tabasco sauce instead of visine. +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. % -The chemical formula for the highly toxic cyanide ion is CN-. These are also Chuck Norris' initials. This is not a coincidence. +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. % -Chuck Norris' credit cards have no limit. Last weekend, he maxed them out. +Chuck Norris doesn’t wash his clothes, he disembowels them. % -Think of a hot woman. Chuck Norris did her. +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. % -A man once claimed Chuck Norris kicked his ass twice, but it was promptly dismissed as false - no one could survive it the first time. +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. % -Chuck Norris sleeps with a pillow under his gun. +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. % -Chuck Norris owns a chain of fast-food restaurants throughout the southwest. They serve nothing but barbecue-flavored ice cream and Hot Pockets. +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." % -Chuck Norris doesn't chew gum. Chuck Norris chews tin foil. +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. % -Aliens DO indeed exist. They just know better than to visit a planet that Chuck Norris is on. +While visiting the hexagon, Chuck Norris was asked to demonstrate his famous roundhouse kick. Henceforth, it has been known as the Pentagon. % -When in a bar, you can order a drink called a "Chuck Norris". It is also known as a "Bloody Mary", if your name happens to be Mary. +When Chuck Norris played the card game War with a friend, France surrendered. % -Every time Chuck Norris smiles, someone dies. Unless he smiles while he's roundhouse kicking someone in the face. Then two people die. +If Goliath listened to Chuck Norris he would have won. % -Some people ask for a Kleenex when they sneeze, Chuck Norris asks for a body bag. +Chuck Norris can defuse bomb even if he cut the wrong wire % -There's an order to the universe: space, time, Chuck Norris.... Just kidding, Chuck Norris is first. +Chuck Norris sleeps in Seattle. % -A man once asked Chuck Norris if his real name is "Charles". Chuck Norris did not respond, he simply stared at him until he exploded. +Chuck Norris shot a man with a knife % -Chuck Norris starts everyday with a protein shake made from Carnation Instant Breakfast, one dozen eggs, pure Colombian cocaine, and rattlesnake venom. He injects it directly into his neck with a syringe. +The dictionary references Chuck Norris several times, he is metioned under Fear, Law, Order and Chucktatorship. % -In a tagteam match, Chuck Norris was teamed with Hulk Hogan against King Kong Bundy and Andre The Giant. He pinned all 3 at the same time. +Chuck Norris CAN balance the light-switch between ON and OFF. % -Chuck Norris doesn't see dead people. He makes people dead. +If Chuck was ever captured, he could win a game of Russian Roulette with six bullets in the revolver, he would shoot everyone else! % -Chuck Norris is the only person who can simultaneously hold and fire FIVE Uzis: One in each hand, one in each foot -- and the 5th one he roundhouse-kicks into the air, so that it sprays bullets. +In a rain storm Chuck Norris stays dry. Rain drops are scared to hit him. % -For undercover police work, Chuck Norris pins his badge underneath his shirt, directly into his chest. +Chuck Norris is the reason tumbleweeds tumble % -In the X-Men movies, none of the X-Men super-powers are done with special effects. Chuck Norris is the stuntman for every character. +The Earth was almost destroyed by a 50 km wide asteroid in 1984, but Chuck Norris roundhouse kicked it into the Sun. % -We live in an expanding universe. All of it is trying to get away from Chuck Norris. +Chuck Norris can terminate a repeating decimal. % -Chuck Norris went looking for a bar but couldn't find one. He walked to a vacant lot and sat there. Sure enough within an hour an a half someone constructed a bar around him. He then ordered a shot, drank it, and then burned the place to the ground. Chuck Norris yelled over the roar of the flames, "always leave things the way you found em!" +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. % -It is said that every time you masturbate, God kills a kitten. Every time God masturbates, Chuck Norris kills a lion. +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. % -The word 'Kill' was invented by Chuck Norris. Other words were 'Die', 'Beer', and 'What'. +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. % -Chuck Norris is a vegetarian. Meaning, he does not eat animals until first he puts them into vegetative state with his fists. +Outer space exists because it's afraid to be on the same planet with Chuck Norris. % -The 11th commandment is "Thou shalt not piss off Chuck Norris" This commandment is rarely enforced, as it is impossible to accomplish. +Chuck Norris does not sleep. He waits. % -Chuck Norris is his own line at the DMV. +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. % -Two wrongs don't make a right. Unless you're Chuck Norris. Then two wrongs make a roundhouse kick to the face. +Chuck Norris is the reason why Waldo is hiding. % -Who let the dogs out? Chuck Norris let the dogs out... and then roundhouse kicked them through an Oldsmobile. +Chuck Norris counted to infinity - twice. % -Chuck Norris can do a roundhouse kick faster than the speed of light. This means that if you turn on a light switch, you will be dead before the lightbulb turns on. +There is no chin behind Chuck Norris’ beard. There is only another fist. % -When Chuck Norris goes to out to eat, he orders a whole chicken, but he only eats its soul. +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. % -Chuck Norris sold his soul to the devil for his rugged good looks and unparalleled martial arts ability. Shortly after the transaction was finalized, Chuck roundhouse-kicked the devil in the face and took his soul back. The devil, who appreciates irony, couldn't stay mad and admitted he should have seen it coming. They now play poker every second Wednesday of the month. +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. % -Chuck Norris has never won an Academy Award for acting... because he's not acting. +Chuck Norris' hand is the only hand that can beat a Royal Flush. % -If Chuck Norris wants your opinion, he'll beat it into you. +Chuck Norris can lead a horse to water AND make it drink. % -Not everyone that Chuck Norris is mad at gets killed. Some get away. They are called astronauts. +Chuck Norris doesn’t wear a watch. HE decides what time it is. % -Chuck Norris has to register every part of his body as a separate lethal weapon. His spleen is considered a concealed weapon in over 50 states. +Chuck Norris can slam a revolving door. % -A movie scene depicting Chuck Norris losing a fight with Bruce Lee was the product of history's most expensive visual effect. When adjusted for inflation, the effect cost more than the Gross National Product of Paraguay. +Chuck Norris does not get frostbite. Chuck Norris bites frost. % -Godzilla is a Japanese rendition of Chuck Norris' first visit to Tokyo. +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. % -They once made a Chuck Norris toilet paper, but there was a problem-- It wouldn't take shit from anybody. +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. % -Chuck Norris once rode a nine foot grizzly bear through an automatic car wash, instead of taking a shower. +If you spell Chuck Norris in Scrabble, you win. Forever. % -"Sweating bullets" is literally what happens when Chuck Norris gets too hot. +Guns don't kill people. Chuck Norris kills people. % -Chuck Norris' sperm can be seen with the naked eye. Each one is the size of a quarter. +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. % -After taking a steroids test doctors informed Chuck Norris that he had tested positive. He laughed upon receiving this information, and said "of course my urine tested positive, what do you think they make steroids from?" +The chief export of Chuck Norris is Pain. % -Chuck Norris doesn't daydream. He's too busy giving other people nightmares. +Chuck Norris has two speeds. Walk, and Kill. % -When Arnold says the line "I'll be back" in the first Terminator movie it is implied that is he going to ask Chuck Norris for help. +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. % -There are no such things as tornados. Chuck Norris just hates trailer parks. +Chuck Norris drives an ice cream truck covered in human skulls. % -Chuck Norris' Penis is a third degree blackbelt, and an honorable 32nd-degree mason. +Chuck Norris is my Homeboy. % -Chuck Norris does not follow fashion trends, they follow him. But then he turns around and kicks their ass. Nobody follows Chuck Norris. +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. % -The phrase 'break a leg' was originally coined by Chuck Norris's co-stars in Walker, Texas Ranger as a good luck charm indicating that a broken leg might be the worst extent of their injuries. This never proved to be the case. +Chuck Norris uses pepper spray to spice up his steaks. % -Chuck Norris' roundhouse kick is so powerful, it can be seen from outer space by the naked eye. +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. % -Diamonds are not, despite popular belief, carbon. They are, in fact, Chuck Norris fecal matter. This was proven a recently, when scientific analysis revealed what appeared to be Jean-Claude Van Damme bone fragments inside the Hope Diamond. +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. % -Chuck Norris once participated in the running of the bulls. He walked. +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. % -The Drummer for Def Leppard's only got one arm. Chuck Norris needed a back scratcher. +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. % -Chuck Norris was the orginal sculptor of Mount Rushmore. He completed the entire project using only a bottle opener and a drywall trowel. +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. % -Chuck Norris once rode a bull, and nine months later it had a calf. +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. % -Chuck Norris once lost the remote, but maintained control of the TV by yelling at it in between bites of his "Filet of Child" sandwich. +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. % -For Spring Break '05, Chuck Norris drove to Madagascar, riding a chariot pulled by two electric eels. +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. % -The Manhattan Project was not intended to create nuclear weapons, it was meant to recreate the destructive power in a Chuck Norris Roundhouse Kick. They didn't even come close. +The quickest way to a man's heart is with Chuck Norris' fist. % -Chuck Norris has banned rainbows from the state of North Dakota. +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. % -Divide Chuck Norris by zero and you will in fact get one........one bad-ass motherfucker that is. +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. % -TNT was originally developed by Chuck Norris to cure indigestion. +Chuck Norris can win a game of Connect Four in only three moves. % -After returning from World War 2 unscathed, Bob Dole was congratulated by Chuck Norris with a handshake. The rest is history. +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. % -Chuck Norris runs on batteries. Specifically, Die Hards. +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. % -"Let the Bodies Hit the Floor" was originally written as Chuck Norris' theme song. +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. % -Chuck Norris will never have a heart attack. His heart isn't nearly foolish enough to attack him. +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. % -Only Chuck Norris can prevent forest fires. +Chuck Norris doesn’t wash his clothes, he disembowels them. % -When Chuck Norris makes a burrito, its main ingredient is real toes. +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. % -Chuck Norris is not Irish. His hair is soaked in the blood of his victims. +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. % -In the movie "The Matrix", Chuck Norris is the Matrix. If you pay close attention in the green "falling code" scenes, you can make out the faint texture of his beard. +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. % -Chuck Norris' dick is so big, it has it's own dick, and that dick is still bigger than yours. +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." % -They say curiosity killed the cat. This is false. Chuck Norris killed the cat. Every single one of them. +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. % -There is no such thing as a lesbian, just a woman who has never met Chuck Norris. +Chuck Norris doesn't look for fun. The fun looks for Chuck Norris. % -Chuck Norris crossed the road. No one has ever dared question his motives. +Chuck Norris starts his day with 6 live chickens two cows, three pigs and a boiling hot cup of pure fury % -When Chuck Norris was born, he immediately had sex with the first nurse he saw. He was her first. She was his third. That afternoon. +The only word that rhymes with orange is Chuck Norris % -One time, at band camp, Chuck Norris ate a percussionist. +Everyone is so scared of Chuck Norris that they kiss his arse by writing these facts, too right they should % -Chuck Norris doesn't say "who's your daddy", because he knows the answer. +gmail@chucknorris.com % -Chuck Norris originally wrote the first dictionary. The definition for each word is as follows - A swift roundhouse kick to the face. +Chuck Norris play's Texas hold em with Zeus, every second Wednesday of the month % -Love does not hurt. Chuck Norris does. +Chuck Norris has killed the Dead Sea % -The term "Cleveland Steamer" got its name from Chuck Norris, when he took a dump while visiting the Rock and Roll Hall of fame and buried northern Ohio under a glacier of fecal matter. +On the keyboard there is no control button because Chuck Norris is always in control. % -Chuck Norris once round-house kicked a salesman. Over the phone. +The truth hurts dosen't it, Chuck Norris' truth kills. % -The pen is mighter than the sword, but only if the pen is held by Chuck Norris. +Chuck Norris sent a BBM to an iphone. % -Chuck Norris doesn't kill two birds with one stone. Chuck Norris kills all birds, with two stones. The ones in his pants. +When Presidents speak, their nation listens. When Chuck Norris blinks, the whole World listens. % -Chuck Norris knows the last digit of pi. +Chuck Norris once cried just to see what it was like. The end result was the creation of life. % -Those aren't credits that roll after Walker Texas Ranger. It is actually a list of fatalities that occurred during the making of the episode. +Chuck Norris is the reason that the world will end in 2012. He was getting bored with the Earth % -The air around Chuck Norris is always a balmy 78 degrees. +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. % -When Chuck Norris wants an egg, he cracks open a chicken. +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. % -Chuck Norris plays racquetball with a waffle iron and a bowling ball. +There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. % -According to the Bible, God created the universe in six days. Before that, Chuck Norris created God by snapping his fingers. +Outer space exists because it's afraid to be on the same planet with Chuck Norris. % -Chuck Norris doesn't believe in ravioli. He stuffs a live turtle with beef and smothers it in pig's blood. +Chuck Norris does not sleep. He waits. % -Count from one to ten. That's how long it would take Chuck Norris to kill you...Fourty seven times. +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. % -The 1972 Miami Dolphins lost one game, it was an exhibition game vs. Chuck Norris and three seven year old girls. Chuck Norris won with a roundhouse-kick to the face in overtime. +Chuck Norris is the reason why Waldo is hiding. % -Chuck Norris is not Politically Correct. He is just Correct. Always. +Chuck Norris counted to infinity - twice. % -Mr. T pities the fool. Chuck Norris rips the fool's fucking head off. +There is no chin behind Chuck Norris’ beard. There is only another fist. % -Chuck Norris had to stop washing his clothes in the ocean. The tsunamis were killing people. +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. % -Chuck Norris has volunteered to remain on earth after the Rapture; he will spend his time fighting the Anti-Christ. +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. % -They were going to release a Chuck Norris edition of Clue, but the answer always turns out to be "Chuck Norris. In The Library. With a Roundhouse Kick." +Chuck Norris' hand is the only hand that can beat a Royal Flush. % -Chuck Norris is the only known mammal in history to have an opposable thumb. On his penis. +Chuck Norris can lead a horse to water AND make it drink. % -A man once taunted Chuck Norris with a bag of Lay's potato chips, saying "Betcha can't eat just one!" Chuck Norris proceeded to eat the chips, the bag, and the man in one deft move. +Chuck Norris doesn’t wear a watch. HE decides what time it is. % -Chuck Norris' favorite cereal is Kellogg's Nails 'N' Gravel. +Chuck Norris can slam a revolving door. % -In the first Jurassic Park movie, the Tyrannosaurus Rex wasn't chasing the jeep. Chuck Norris was chasing the Tyrannosaurus AND the jeep. +Chuck Norris does not get frostbite. Chuck Norris bites frost. % -Chuck Norris has never been accused of murder for the simple fact that his roundhouse kicks are recognized world-wide as "acts of God." +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. % -"Brokeback Mountain" is not just a movie. It's also what Chuck Norris calls the pile of dead ninjas in his front yard. +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. % -Chuck Norris does not wear a condom. Because there is no such thing as protection from Chuck Norris. +If you spell Chuck Norris in Scrabble, you win. Forever. % -Chuck Norris once had sex with a cigarette machine in the Osaka airport. +Guns don't kill people. Chuck Norris kills people. % -Rules of fighting: 1) Don't bring a knife to a gun fight. 2) Don't bring a gun to a Chuck Norris fight. +There is no theory of evolution. Just a list of animals Chuck Norris allows to live. % -Chuck Norris is the only man who has, literally, beaten the odds. With his fists. +The chief export of Chuck Norris is Pain. % -In ancient China there is a legend that one day a child will be born from a dragon, grow to be a man, and vanquish evil from the land. That man is not Chuck Norris, because Chuck Norris killed that man. +Chuck Norris has two speeds. Walk, and Kill. % -Chuck Norris wipes his ass with chain mail and sandpaper. +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. % -When you play Monopoly with Chuck Norris, you do not pass go, and you do not collect two hundred dollars. You will be lucky if you make it out alive. +Chuck Norris drives an ice cream truck covered in human skulls. % -Chuck Norris describes human beings as "a sociable holder for blood and guts". +Chuck Norris is my Homeboy. % -Chuck Norris once got into a fight with a one-armed Ninja. Seeing that he had an unfair advantage, Chuck Norris ripped both of his arms off and one of his legs. He then roundhouse-kicked the ninja in the head, killing him instantly, and proceeded to sow his limbs back on using only a rusty tent spike and bailing wire. +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. % -Chuck Norris likes his ice like he likes his skulls: crushed. +Chuck Norris uses pepper spray to spice up his steaks. % -Chuck Norris can kick through all 6 degrees of separation, hitting anyone, anywhere, in the face, at any time. +Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. % -Most tough men eat nails for breakfast. chuck Norris does all of his grocery shopping at Home Depot. +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. % -Chuck Norris did not "lose" his virginity, he stalked it and then destroyed it with extreme prejudice. +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. % -Everything King Midas touches turnes to gold. Everything Chuck Norris touches turns up dead. +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. % -Chuck Norris' pulse is measured on the richter scale. +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. % -Most people know that Descarte said, "I think, therefore I am." What most people don't know is that that quote continues, "...afraid of Chuck Norris." +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. % -Chuck Norris once roundhouse-kicked a ten dollar bill into 200 nickels. +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. % -For every movie about Vietnam starring Chuck Norris, the historical duration of the war decreases. Just 3 more "Missing in Action" sequels, and that war will have never actually existed. +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. % -Chuck Norris' penis has a Hemi. +The quickest way to a man's heart is with Chuck Norris' fist. % -Chuck Norris enjoys a good practical joke. His favorite is where he removes your lower intestine and pretends to make a balloon animal out of it. Then he cracks your skull open with a Volvo for not complimenting him on his balloon animal. +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. % -Chuck Norris CAN in fact 'raise the roof'. And he can do it with one hand. +CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. % -Kenny G is allowed to live because Chuck Norris doesn't kill women. +Chuck Norris can win a game of Connect Four in only three moves. % -Life is not, in fact, like a box of chocolates. It is more like a box of Chuck Norris, roundhouse kicking you in the face. And if you receive a box of Chuck Norris, you ALWAYS know what you are going to get. +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. % -For Chuck Norris, every street is "one way". HIS WAY. +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. % -There are now five cup sizes at Starbucks: Short, Tall, Grande, Venti, and Chuck Norris. +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. % -During the Vietnam War, Chuck Norris allowed himself to be captured. For torture, they made him eat his own entrails. He asked for seconds. +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. % -Chuck Norris once created a flamethrower by urinating into a lighter. +Chuck Norris doesn’t wash his clothes, he disembowels them. % -Instead of having a cigarette after sex, Chuck Norris heads outside and brands his cattle. +A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. % -Chuck Norris actually built the stairway to heaven. +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. % -Whoever said "only the good die young" was probably in Chuck Norris's kindergarten class. +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. % -Chuck Norris once skewered a man with the Eiffel tower. +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." % -The best part of waking up, is not Folgers in your cup, but knowing that Chuck Norris didn't kill you in your sleep. +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. % -Chuck Norris doesn't own a can opener, he just chews through the can. +Only Chuck Norris is stronger than an Altoid. % -Occam's Razor says that the simplest answer tends to be the correct one. Norris' Razor involves a flick of the wrist and a Columbian Necktie. +Chuck Norris has a battlecruiser AND a car. % -Chuck Norris needs a monkeywrench and a blowtorch to masturbate. +Chuck Norris burnt a fire proof vest, UNDERWATER! % -Proponents of higher-order theories of consciousness argue that consciousness is explained by the relation between two levels of mental states in which a higher-order mental state takes another mental state. If you mention this to Chuck Norris, expect an explosive roundhouse kick to the face for spouting too much fancy-talk. +Chuck Norris was once turned down for American Idol. When Simon was questioned about it, he replied "I'm retiring after this season". I wonder why? % -Chuck Norris invented all 32 letters of the alphabet. +Chuck Norris doesn't cheat death, he beats it fair and square. % -Remember The Ultimate Warrior? He quit wrestling because Chuck Norris wanted his nickname back. +When Chuck Norris roundhouse-kicks you HE decides when you will feel the impact . % -If a tree falls in the forest, does anybody hear? Yes. Chuck Norris hears it. Chuck Norris can hear everything. Chuck Norris can hear the shrieking terror in your soul. +Chuck Norris made the big bang just by clicking his fingers % -Chuck Norris actually owns IBM. It was an extremely hostile takeover. +Trick me once, shame on you, trick Chuck Norris.....rest in peace. % -He, who laughs last, laughs best. He who laughs at Chuck Norris ? dies. +Chuck Norris doesn't fight. He gives motivational seminars to die on their own to avoid a roundhouse kick to the face. % -Chuck Norris is like a dog, not only because he can smell fear, but because he can piss on whatever the fuck he wants. +This one time at band camp... BAM! Chuck Norris. % -Chuck Norris can jump-start a car using jumper cables attached to his nipples. +Chuck Norris protects his body guards. % -Chuck Norris neither melts in your mouth nor in your hand. He shreds your trachea before ravaging your soul with a combination of chocolate, whickey, roundhouse kicks and death. Oh, and pain. Lots of pain. +Chuck Norris watched the first steps on the moon... From his summer home on Mars % -Chuck Norris doesn't have blood. He is filled with magma. +The Earth is made up of two-thirds water and one-third Chuck Norris. % diff --git a/plugins/cloudapp/cloudapp.plugin.zsh b/plugins/cloudapp/cloudapp.plugin.zsh index 99252f690..3b363c81b 100644 --- a/plugins/cloudapp/cloudapp.plugin.zsh +++ b/plugins/cloudapp/cloudapp.plugin.zsh @@ -1,2 +1,6 @@ -#!/bin/zsh -alias cloudapp=$ZSH/plugins/cloudapp/cloudapp.rb +alias cloudapp="${0:a:h}/cloudapp.rb" + +# Ensure only the owner can access the credentials file +if [[ -f ~/.cloudapp ]]; then + chmod 600 ~/.cloudapp +fi diff --git a/plugins/cloudfoundry/README.md b/plugins/cloudfoundry/README.md new file mode 100644 index 000000000..89dd9d1ce --- /dev/null +++ b/plugins/cloudfoundry/README.md @@ -0,0 +1,58 @@ +# 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/ diff --git a/plugins/cloudfoundry/cloudfoundry.plugin.zsh b/plugins/cloudfoundry/cloudfoundry.plugin.zsh new file mode 100644 index 000000000..b6715787e --- /dev/null +++ b/plugins/cloudfoundry/cloudfoundry.plugin.zsh @@ -0,0 +1,34 @@ +# 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)}'} diff --git a/plugins/coffee/_coffee b/plugins/coffee/_coffee index 10b6b8164..5e52b30e6 100644 --- a/plugins/coffee/_coffee +++ b/plugins/coffee/_coffee @@ -1,6 +1,6 @@ #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. # # Redistribution and use in source and binary forms, with or without @@ -28,7 +28,7 @@ # Description # ----------- # -# Completion script for Coffee.js v0.6.11 (http://coffeejs.org) +# Completion script for Coffee.js v0.6.11 (https://coffeescript.org) # # ------------------------------------------------------------------------------ # Authors diff --git a/plugins/colorize/README.md b/plugins/colorize/README.md new file mode 100644 index 000000000..71fa87861 --- /dev/null +++ b/plugins/colorize/README.md @@ -0,0 +1,29 @@ +# colorize + +With this plugin you can syntax-highlight file contents of over 300 supported languages and other text formats. + +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. + +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. + +* `cless <file> [files]`: colorize the contents of the file (or files, if more than one are provided) and + open less. If no arguments are passed it will colorize the standard input or stdin. + +Note that `cless` will behave as less when provided more than one file: you have to navigate files with +the commands `:n` for next and `:p` for previous. The downside is that less options are not supported. +But you can circumvent this by either using the LESS environment variable, or by running `ccat file1 file2|less --opts`. +In the latter form, the file contents will be concatenated and presented by less as a single file. + +## Requirements + +You have to install Pygments first: [pygments.org](http://pygments.org/download/) diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh index b97dffe43..bec9a2ac6 100644 --- a/plugins/colorize/colorize.plugin.zsh +++ b/plugins/colorize/colorize.plugin.zsh @@ -1,29 +1,49 @@ -# Plugin for highlighting file content -# Plugin highlights file content based on the filename extension. -# If no highlighting method supported for given extension then it tries -# guess it by looking for file content. - -#easier alias to use plugin +# easier alias to use the plugin alias ccat='colorize_via_pygmentize' +alias cless='colorize_via_pygmentize_less' colorize_via_pygmentize() { - if [ ! -x "$(which pygmentize)" ]; then - echo "package \'Pygments\' is not installed!" - return -1 + if ! (( $+commands[pygmentize] )); then + echo "package 'Pygments' is not installed!" + return 1 fi + # pygmentize stdin if no arguments passed if [ $# -eq 0 ]; then - pygmentize -g $@ + pygmentize -g + return $? fi - for FNAME in $@ + # guess lexer from file extension, or + # guess it from file contents if unsuccessful + local FNAME lexer + for FNAME in "$@" do - filename=$(basename "$FNAME") - lexer=`pygmentize -N \"$filename\"` - if [ "Z$lexer" != "Ztext" ]; then - pygmentize -l $lexer "$FNAME" + lexer=$(pygmentize -N "$FNAME") + if [[ $lexer != text ]]; then + pygmentize -l "$lexer" "$FNAME" else pygmentize -g "$FNAME" fi done } + +colorize_via_pygmentize_less() ( + # this function is a subshell so tmp_files can be shared to cleanup function + declare -a tmp_files + + cleanup () { + [[ ${#tmp_files} -gt 0 ]] && rm -f "${tmp_files[@]}" + exit + } + trap 'cleanup' EXIT HUP TERM INT + + while (( $# != 0 )); do #TODO: filter out less opts + tmp_file="$(mktemp -t "tmp.colorize.XXXX.$(sed 's/\//./g' <<< "$1")")" + tmp_files+=("$tmp_file") + colorize_via_pygmentize "$1" > "$tmp_file" + shift 1 + done + + less -f "${tmp_files[@]}" +) diff --git a/plugins/command-not-found/README.md b/plugins/command-not-found/README.md new file mode 100644 index 000000000..1cf4ba66e --- /dev/null +++ b/plugins/command-not-found/README.md @@ -0,0 +1,32 @@ +# 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) +- [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found) + +You can add support for other platforms by submitting a Pull Request. diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh index 0e2f2133f..dd1186e44 100644 --- a/plugins/command-not-found/command-not-found.plugin.zsh +++ b/plugins/command-not-found/command-not-found.plugin.zsh @@ -1,5 +1,5 @@ # 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 [[ -e /etc/zsh_command_not_found ]] && source /etc/zsh_command_not_found @@ -31,3 +31,10 @@ if type brew &> /dev/null; then eval "$(brew command-not-found-init)"; fi fi + +# NixOS command-not-found support +if [ -x /run/current-system/sw/bin/command-not-found ]; then + command_not_found_handler () { + /run/current-system/sw/bin/command-not-found $@ + } +fi diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index 742798f27..785a09c63 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -13,7 +13,7 @@ alias lS='ls -1FSsh' alias lart='ls -1Fcart' alias lrt='ls -1Fcrt' -alias zshrc='$EDITOR ~/.zshrc' # Quick access to the ~/.zshrc file +alias zshrc='${=EDITOR} ~/.zshrc' # Quick access to the ~/.zshrc file alias grep='grep --color' alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} ' @@ -44,8 +44,6 @@ alias p='ps -f' alias sortnr='sort -n -r' alias unexport='unset' -alias whereami=display_info - alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' diff --git a/plugins/composer/README.md b/plugins/composer/README.md new file mode 100644 index 000000000..2b4bae579 --- /dev/null +++ b/plugins/composer/README.md @@ -0,0 +1,29 @@ +# 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 | diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh index d00813e39..634961023 100644 --- a/plugins/composer/composer.plugin.zsh +++ b/plugins/composer/composer.plugin.zsh @@ -51,5 +51,10 @@ alias cgrm='composer global remove' # install composer in the current directory alias cget='curl -s https://getcomposer.org/installer | php' -# Add Composer's global binaries to PATH -export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null) +# Add Composer's global binaries to PATH, using Composer if available. +if (( $+commands[composer] )); then + export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null) +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 diff --git a/plugins/copydir/README.md b/plugins/copydir/README.md new file mode 100644 index 000000000..594bf1065 --- /dev/null +++ b/plugins/copydir/README.md @@ -0,0 +1,10 @@ +# 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. diff --git a/plugins/copyfile/README.md b/plugins/copyfile/README.md new file mode 100644 index 000000000..53138ad06 --- /dev/null +++ b/plugins/copyfile/README.md @@ -0,0 +1,10 @@ +# 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`. diff --git a/plugins/cpanm/README.md b/plugins/cpanm/README.md new file mode 100644 index 000000000..3803e3e00 --- /dev/null +++ b/plugins/cpanm/README.md @@ -0,0 +1,9 @@ +# 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) +``` diff --git a/plugins/cpanm/_cpanm b/plugins/cpanm/_cpanm index 58451d35a..ff9ae1c15 100644 --- a/plugins/cpanm/_cpanm +++ b/plugins/cpanm/_cpanm @@ -6,9 +6,6 @@ # # 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" typeset -A opt_args diff --git a/plugins/dash/dash.plugin.zsh b/plugins/dash/dash.plugin.zsh new file mode 100644 index 000000000..b00d4877e --- /dev/null +++ b/plugins/dash/dash.plugin.zsh @@ -0,0 +1,86 @@ +# 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 +} diff --git a/plugins/debian/README.md b/plugins/debian/README.md new file mode 100644 index 000000000..a676674dc --- /dev/null +++ b/plugins/debian/README.md @@ -0,0 +1,75 @@ +# debian + +This plugin provides debian related zsh aliases. +To use it add `debian` to the plugins array in your zshrc file. + +```zsh +plugins=(... debian) +``` + +## Common Aliases + +| Alias | Command | Description | +| -------- | ------------------------------------------------------------------------------|--------------------------------------------------------------------------- | +| `age` | apt-get | Command line tool for handling packages | +| `api` | aptitude | Same functionality as `apt-get`, provides extra options while installation | +| `acs` | apt-cache search | Command line tool for searching apt software package cache | +| `aps` | aptitude search | Searches installed packages using aptitude | +| `as` | aptitude -F \"* %p -> %d \n(%v/%V)\" \ -no-gui --disable-columns search | - | +| `afs` | apt-file search --regexp | Search file in packages | +| `asrc` | apt-get source | Fetch source packages through `apt-get` | +| `app` | apt-cache policy | Displays priority of package sources | + +## Superuser Operations Aliases + +| Alias | Command | Description | +| -------- | -------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------- | +| `aac` | sudo $apt_pref autoclean | Clears out the local repository of retrieved package files | +| `abd` | sudo $apt_pref build-dep | Installs all dependencies for building packages | +| `ac` | sudo $apt_pref clean | Clears out the local repository of retrieved package files except lock files | +| `ad` | sudo $apt_pref update | Updates the package lists for upgrades for packages | +| `adg` | sudo $apt_pref update && sudo $apt_pref $apt_upgr | Update and upgrade packages | +| `adu` | sudo $apt_pref update && sudo $apt_pref dist-upgrade | Smart upgrade that handles dependencies | +| `afu` | sudo apt-file update | Update the files in packages | +| `au` | sudo $apt_pref $apt_upgr | - | +| `ai` | sudo $apt_pref install | Command-line tool to install package | +| `ail` | sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | "' xargs sudo $apt_pref install | Install all packages given on the command line while using only the first word of each line | +| `ap` | sudo $apt_pref purge | Removes packages along with configuration files | +| `ar` | sudo $apt_pref remove | Removes packages, keeps the configuration files | +| `ads` | sudo apt-get dselect-upgrade | Installs packages from list and removes all not in the list | +| `dia` | sudo dpkg -i ./*.deb | Install all .deb files in the current directory | +| `di` | sudo dpkg -i | Install all .deb files in the current directory | +| `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 | + +- `$apt_pref` - Use apt or aptitude if installed, fallback is apt-get. +- `$apt_upgr` - Use upgrade. + +## Aliases - Commands using `su` + +| Alias | Command | +| -------- | ------------------------------------------------------------------------------| +| `aac` | su -ls \'$apt_pref autoclean\' root | +| `ac` | su -ls \'$apt_pref clean\' root | +| `ad` | su -lc \'$apt_pref update\' root | +| `adg` | su -lc \'$apt_pref update && aptitude $apt_upgr\' root | +| `adu` | su -lc \'$apt_pref update && aptitude dist-upgrade\' root | +| `afu` | su -lc "apt-file update | +| `ag` | su -lc \'$apt_pref $apt_upgr\' root | +| `dia` | su -lc "dpkg -i ./*.deb" root | + +## Miscellaneous Aliases + +| Alias | Command | Description | +| -------- | -------------------------------------------------|---------------------------------------- | +| `allpkgs`| aptitude search -F "%p" --disable-columns ~i | Display all installed packages | +| `mydeb` | time dpkg-buildpackage -rfakeroot -us -uc | Create a basic .deb package | + +## Functions + +| Fucntion | Description | +|-----------------------|-------------------------------------------------------------------------------| +| `apt-copy` | Create a simple script that can be used to 'duplicate' a system | +| `apt-history` | Displays apt history for a command | +| `kerndeb` | Builds kernel packages | +| `apt-list-packages` | List packages by size | + diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index 19966b6ac..654b692d2 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -5,9 +5,12 @@ # # 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. -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_upgr='safe-upgrade' else @@ -176,7 +179,7 @@ apt-copy() { # apt-history remove # apt-history rollback # 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 () { case "$1" in install) diff --git a/plugins/dircycle/README.md b/plugins/dircycle/README.md new file mode 100644 index 000000000..3ac162f05 --- /dev/null +++ b/plugins/dircycle/README.md @@ -0,0 +1,78 @@ +# 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. diff --git a/plugins/dircycle/dircycle.plugin.zsh b/plugins/dircycle/dircycle.plugin.zsh index 8c58cab4c..bb69f6b3f 100644 --- a/plugins/dircycle/dircycle.plugin.zsh +++ b/plugins/dircycle/dircycle.plugin.zsh @@ -9,31 +9,36 @@ # pushd -N: start counting from right of `dirs' output switch-to-dir () { - [[ ${#dirstack} -eq 0 ]] && return + setopt localoptions nopushdminus + [[ ${#dirstack} -eq 0 ]] && return 1 while ! builtin pushd -q $1 &>/dev/null; do # We found a missing directory: pop it out of the dir stack builtin popd -q $1 # Stop trying if there are no more directories in the dir stack - [[ ${#dirstack} -eq 0 ]] && break + [[ ${#dirstack} -eq 0 ]] && return 1 done } insert-cycledleft () { - emulate -L zsh - setopt nopushdminus + switch-to-dir +1 || return - switch-to-dir +1 + local fn + for fn (chpwd $chpwd_functions precmd $precmd_functions); do + (( $+functions[$fn] )) && $fn + done zle reset-prompt } zle -N insert-cycledleft insert-cycledright () { - emulate -L zsh - setopt nopushdminus + switch-to-dir -0 || return - switch-to-dir -0 + local fn + for fn (chpwd $chpwd_functions precmd $precmd_functions); do + (( $+functions[$fn] )) && $fn + done zle reset-prompt } zle -N insert-cycledright diff --git a/plugins/dirhistory/README.md b/plugins/dirhistory/README.md new file mode 100644 index 000000000..511f2be17 --- /dev/null +++ b/plugins/dirhistory/README.md @@ -0,0 +1,17 @@ +# 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 | diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh index 8138872bc..239915e48 100644 --- a/plugins/dirhistory/dirhistory.plugin.zsh +++ b/plugins/dirhistory/dirhistory.plugin.zsh @@ -2,6 +2,10 @@ # 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. # +# 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_future=() @@ -120,7 +124,9 @@ zle -N dirhistory_zle_dirhistory_back bindkey "\e[3D" dirhistory_zle_dirhistory_back bindkey "\e[1;3D" dirhistory_zle_dirhistory_back # Mac teminal (alt+left/right) -bindkey "^[b" dirhistory_zle_dirhistory_back +if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then + bindkey "^[b" dirhistory_zle_dirhistory_back +fi # Putty: bindkey "\e\e[D" dirhistory_zle_dirhistory_back # GNU screen: @@ -129,8 +135,56 @@ bindkey "\eO3D" dirhistory_zle_dirhistory_back zle -N dirhistory_zle_dirhistory_future bindkey "\e[3C" dirhistory_zle_dirhistory_future bindkey "\e[1;3C" dirhistory_zle_dirhistory_future -bindkey "^[f" 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 "\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 diff --git a/plugins/dirpersist/README.md b/plugins/dirpersist/README.md new file mode 100644 index 000000000..9880bc563 --- /dev/null +++ b/plugins/dirpersist/README.md @@ -0,0 +1,9 @@ +# 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) +``` diff --git a/plugins/django/README.md b/plugins/django/README.md new file mode 100644 index 000000000..415f6b7ea --- /dev/null +++ b/plugins/django/README.md @@ -0,0 +1,56 @@ +# 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 +... +``` + diff --git a/plugins/django/django.plugin.zsh b/plugins/django/django.plugin.zsh index 29a51d29d..86558ff2e 100644 --- a/plugins/django/django.plugin.zsh +++ b/plugins/django/django.plugin.zsh @@ -154,7 +154,7 @@ _managepy-makemessages(){ "--no-default-ignore[Don't ignore the common glob-style patterns 'CVS', '.*', '*~' and '*.pyc'.]" \ "--no-wrap[Don't break long message lines into several lines.]" \ "--no-location[Don't write '#: filename:line' lines.]" \ - '--no-obsolete[emove obsolete message strings.]' \ + '--no-obsolete[Remove obsolete message strings.]' \ '--keep-pot[Keep .pot file after making messages.]' \ $nul_args && ret=0 } diff --git a/plugins/dnf/README.md b/plugins/dnf/README.md index f9ef496fa..f9ef496fa 100755..100644 --- a/plugins/dnf/README.md +++ b/plugins/dnf/README.md diff --git a/plugins/docker-compose/README.md b/plugins/docker-compose/README.md index d3fcb29fe..07a87bc81 100644 --- a/plugins/docker-compose/README.md +++ b/plugins/docker-compose/README.md @@ -1,4 +1,29 @@ -# 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 | diff --git a/plugins/docker-compose/_docker-compose b/plugins/docker-compose/_docker-compose index c0a54cced..808b068a3 100644 --- a/plugins/docker-compose/_docker-compose +++ b/plugins/docker-compose/_docker-compose @@ -23,7 +23,7 @@ __docker-compose_all_services_in_compose_file() { local already_selected local -a services already_selected=$(echo $words | tr " " "|") - __docker-compose_q config --services \ + __docker-compose_q ps --services "$@" \ | grep -Ev "^(${already_selected})$" } @@ -31,125 +31,42 @@ __docker-compose_all_services_in_compose_file() { __docker-compose_services_all() { [[ $PREFIX = -* ]] && return 1 integer ret=1 - services=$(__docker-compose_all_services_in_compose_file) + services=$(__docker-compose_all_services_in_compose_file "$@") _alternative "args:services:($services)" && ret=0 return ret } -# All services that have an entry with the given key in their docker-compose.yml section -__docker-compose_services_with_key() { - local already_selected - local -a buildable - already_selected=$(echo $words | tr " " "|") - # flatten sections to one line, then filter lines containing the key and return section name. - __docker-compose_q config \ - | sed -n -e '/^services:/,/^[^ ]/p' \ - | sed -n 's/^ //p' \ - | awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' \ - | grep " \+$1:" \ - | cut -d: -f1 \ - | grep -Ev "^(${already_selected})$" -} - # All services that are defined by a Dockerfile reference __docker-compose_services_from_build() { [[ $PREFIX = -* ]] && return 1 - integer ret=1 - buildable=$(__docker-compose_services_with_key build) - _alternative "args:buildable services:($buildable)" && ret=0 - - return ret + __docker-compose_services_all --filter source=build } # All services that are defined by an image __docker-compose_services_from_image() { [[ $PREFIX = -* ]] && return 1 - integer ret=1 - pullable=$(__docker-compose_services_with_key image) - _alternative "args:pullable services:($pullable)" && ret=0 - - return ret -} - -__docker-compose_get_services() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - local kind - declare -a running paused stopped lines args services - - docker_status=$(docker ps > /dev/null 2>&1) - if [ $? -ne 0 ]; then - _message "Error! Docker is not running." - return 1 - fi - - kind=$1 - shift - [[ $kind =~ (stopped|all) ]] && args=($args -a) - - lines=(${(f)"$(_call_program commands docker $docker_options ps $args)"}) - services=(${(f)"$(_call_program commands docker-compose 2>/dev/null $compose_options ps -q)"}) - - # Parse header line to find columns - local i=1 j=1 k header=${lines[1]} - declare -A begin end - while (( j < ${#header} - 1 )); do - i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) - j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) - k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) - begin[${header[$i,$((j-1))]}]=$i - end[${header[$i,$((j-1))]}]=$k - done - lines=(${lines[2,-1]}) - - # Container ID - local line s name - local -a names - for line in $lines; do - if [[ ${services[@]} == *"${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"* ]]; then - names=(${(ps:,:)${${line[${begin[NAMES]},-1]}%% *}}) - for name in $names; do - s="${${name%_*}#*_}:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}" - s="$s, ${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}" - s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}" - if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = Exit* ]]; then - stopped=($stopped $s) - else - if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = *\(Paused\)* ]]; then - paused=($paused $s) - fi - running=($running $s) - fi - done - fi - done - - [[ $kind =~ (running|all) ]] && _describe -t services-running "running services" running "$@" && ret=0 - [[ $kind =~ (paused|all) ]] && _describe -t services-paused "paused services" paused "$@" && ret=0 - [[ $kind =~ (stopped|all) ]] && _describe -t services-stopped "stopped services" stopped "$@" && ret=0 - - return ret + __docker-compose_services_all --filter source=image } __docker-compose_pausedservices() { [[ $PREFIX = -* ]] && return 1 - __docker-compose_get_services paused "$@" + __docker-compose_services_all --filter status=paused } __docker-compose_stoppedservices() { [[ $PREFIX = -* ]] && return 1 - __docker-compose_get_services stopped "$@" + __docker-compose_services_all --filter status=stopped } __docker-compose_runningservices() { [[ $PREFIX = -* ]] && return 1 - __docker-compose_get_services running "$@" + __docker-compose_services_all --filter status=running } __docker-compose_services() { [[ $PREFIX = -* ]] && return 1 - __docker-compose_get_services all "$@" + __docker-compose_services_all } __docker-compose_caching_policy() { @@ -196,9 +113,12 @@ __docker-compose_subcommand() { $opts_help \ "*--build-arg=[Set build-time variables for one service.]:<varname>=<value>: " \ '--force-rm[Always remove intermediate containers.]' \ - '--memory[Memory limit for the build container.]' \ + '(--quiet -q)'{--quiet,-q}'[Curb build output]' \ + '(--memory -m)'{--memory,-m}'[Memory limit for the build container.]' \ '--no-cache[Do not use cache when building the image.]' \ '--pull[Always attempt to pull a newer version of the image.]' \ + '--compress[Compress the build context using gzip.]' \ + '--parallel[Build images in parallel.]' \ '*:services:__docker-compose_services_from_build' && ret=0 ;; (bundle) @@ -213,7 +133,8 @@ __docker-compose_subcommand() { '(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \ '--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 + '--volumes[Print the volume names, one per line.]' \ + '--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' \ && ret=0 ;; (create) _arguments \ @@ -222,11 +143,12 @@ __docker-compose_subcommand() { $opts_no_recreate \ $opts_no_build \ "(--no-build)--build[Build images before creating containers.]" \ - '*:services:__docker-compose_services_all' && ret=0 + '*:services:__docker-compose_services' && ret=0 ;; (down) _arguments \ $opts_help \ + $opts_timeout \ "--rmi[Remove images. Type must be one of: 'all': Remove all images used by any service. 'local': Remove only images that don't have a custom tag set by the \`image\` field.]:type:(all local)" \ '(-v --volumes)'{-v,--volumes}"[Remove named volumes declared in the \`volumes\` section of the Compose file and anonymous volumes attached to containers.]" \ $opts_remove_orphans && ret=0 @@ -235,16 +157,18 @@ __docker-compose_subcommand() { _arguments \ $opts_help \ '--json[Output events as a stream of json objects]' \ - '*:services:__docker-compose_services_all' && ret=0 + '*:services:__docker-compose_services' && ret=0 ;; (exec) _arguments \ $opts_help \ '-d[Detached mode: Run command in the background.]' \ '--privileged[Give extended privileges to the process.]' \ - '(-u --user)'{-u,--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.]' \ '--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \ + '*'{-e,--env}'[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \ + '(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \ '(-):running services:__docker-compose_runningservices' \ '(-):command: _command_names -e' \ '*::arguments: _normal' && ret=0 @@ -252,12 +176,12 @@ __docker-compose_subcommand() { (help) _arguments ':subcommand:__docker-compose_commands' && ret=0 ;; - (images) - _arguments \ - $opts_help \ - '-q[Only display IDs]' \ - '*:services:__docker-compose_services_all' && ret=0 - ;; + (images) + _arguments \ + $opts_help \ + '-q[Only display IDs]' \ + '*:services:__docker-compose_services' && ret=0 + ;; (kill) _arguments \ $opts_help \ @@ -271,7 +195,7 @@ __docker-compose_subcommand() { $opts_no_color \ '--tail=[Number of lines to show from the end of the logs for each container.]:number of lines: ' \ '(-t --timestamps)'{-t,--timestamps}'[Show timestamps]' \ - '*:services:__docker-compose_services_all' && ret=0 + '*:services:__docker-compose_services' && ret=0 ;; (pause) _arguments \ @@ -290,12 +214,16 @@ __docker-compose_subcommand() { _arguments \ $opts_help \ '-q[Only display IDs]' \ - '*:services:__docker-compose_services_all' && ret=0 + '--filter KEY=VAL[Filter services by a property]:<filtername>=<value>:' \ + '*:services:__docker-compose_services' && ret=0 ;; (pull) _arguments \ $opts_help \ '--ignore-pull-failures[Pull what it can and ignores images with pull failures.]' \ + '--no-parallel[Disable parallel pulling]' \ + '(-q --quiet)'{-q,--quiet}'[Pull without printing progress information]' \ + '--include-deps[Also pull services declared as dependencies]' \ '*:services:__docker-compose_services_from_image' && ret=0 ;; (push) @@ -317,6 +245,7 @@ __docker-compose_subcommand() { $opts_no_deps \ '-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: ' \ + '*'{-l,--label}'[KEY=VAL Add or override a label (can be used multiple times)]:label KEY=VAL: ' \ '--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \ '--name=[Assign a name to the container]:name: ' \ '(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \ @@ -326,6 +255,7 @@ __docker-compose_subcommand() { '(-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: ' \ + "--use-aliases[Use the services network aliases in the network(s) the container connects to]" \ '(-):services:__docker-compose_services' \ '(-):command: _command_names -e' \ '*::arguments: _normal' && ret=0 @@ -369,8 +299,10 @@ __docker-compose_subcommand() { "(--no-build)--build[Build images before starting containers.]" \ "(-d)--abort-on-container-exit[Stops all containers if any container was stopped. Incompatible with -d.]" \ '(-t --timeout)'{-t,--timeout}"[Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)]:seconds: " \ + '--scale[SERVICE=NUM Scale SERVICE to NUM instances. Overrides the `scale` setting in the Compose file if present.]:service scale SERVICE=NUM: ' \ + '--exit-code-from=[Return the exit code of the selected service container. Implies --abort-on-container-exit]:service:__docker-compose_services' \ $opts_remove_orphans \ - '*:services:__docker-compose_services_all' && ret=0 + '*:services:__docker-compose_services' && ret=0 ;; (version) _arguments \ @@ -409,8 +341,11 @@ _docker-compose() { '(- :)'{-h,--help}'[Get help]' \ '*'{-f,--file}"[${file_description}]:file:_files -g '*.yml'" \ '(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \ - '--verbose[Show more output]' \ + "--compatibility[If set, Compose will attempt to convert keys in v3 files to their non-Swarm equivalent]" \ '(- :)'{-v,--version}'[Print version and exit]' \ + '--verbose[Show more output]' \ + '--log-level=[Set log level]:level:(DEBUG INFO WARNING ERROR CRITICAL)' \ + '--no-ansi[Do not print ANSI control characters]' \ '(-H --host)'{-H,--host}'[Daemon socket to connect to]:host:' \ '--tls[Use TLS; implied by --tlsverify]' \ '--tlscacert=[Trust certs signed only by this CA]:ca path:' \ @@ -421,7 +356,7 @@ _docker-compose() { '(-): :->command' \ '(-)*:: :->option-or-argument' && ret=0 - local -a relevant_compose_flags relevant_docker_flags compose_options docker_options + local -a relevant_compose_flags relevant_compose_repeatable_flags relevant_docker_flags compose_options docker_options relevant_compose_flags=( "--file" "-f" @@ -435,6 +370,10 @@ _docker-compose() { "--skip-hostname-check" ) + relevant_compose_repeatable_flags=( + "--file" "-f" + ) + relevant_docker_flags=( "--host" "-H" "--tls" @@ -452,9 +391,18 @@ _docker-compose() { fi fi if [[ -n "${relevant_compose_flags[(r)$k]}" ]]; then - compose_options+=$k - if [[ -n "$opt_args[$k]" ]]; then - compose_options+=$opt_args[$k] + if [[ -n "${relevant_compose_repeatable_flags[(r)$k]}" ]]; then + values=("${(@s/:/)opt_args[$k]}") + for value in $values + do + compose_options+=$k + compose_options+=$value + done + else + compose_options+=$k + if [[ -n "$opt_args[$k]" ]]; then + compose_options+=$opt_args[$k] + fi fi fi done diff --git a/plugins/docker-compose/docker-compose.plugin.zsh b/plugins/docker-compose/docker-compose.plugin.zsh index 24bea318b..9ffe1edf6 100644 --- a/plugins/docker-compose/docker-compose.plugin.zsh +++ b/plugins/docker-compose/docker-compose.plugin.zsh @@ -18,6 +18,7 @@ alias dcrm='docker-compose rm' alias dcr='docker-compose run' alias dcstop='docker-compose stop' alias dcup='docker-compose up' +alias dcupd='docker-compose up -d' alias dcdn='docker-compose down' alias dcl='docker-compose logs' alias dclf='docker-compose logs -f' diff --git a/plugins/docker-machine/_docker-machine b/plugins/docker-machine/_docker-machine new file mode 100644 index 000000000..7c19ba8e7 --- /dev/null +++ b/plugins/docker-machine/_docker-machine @@ -0,0 +1,359 @@ +#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 "$@" diff --git a/plugins/docker/_docker b/plugins/docker/_docker index 0c20cf28e..54b5e59c5 100644 --- a/plugins/docker/_docker +++ b/plugins/docker/_docker @@ -431,7 +431,7 @@ __docker_complete_events_filter() { integer ret=1 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 case "${${words[-1]%=*}#*=}" in @@ -450,9 +450,9 @@ __docker_complete_events_filter() { ;; (event) local -a event_opts - event_opts=('attach' 'commit' 'connect' 'copy' 'create' 'delete' 'destroy' 'detach' 'die' 'disconnect' 'exec_create' 'exec_detach' - 'exec_start' 'export' 'health_status' 'import' 'kill' 'load' 'mount' 'oom' 'pause' 'pull' 'push' 'reload' 'rename' 'resize' 'restart' 'save' 'start' - 'stop' 'tag' 'top' 'unmount' 'unpause' 'untag' 'update') + event_opts=('attach' 'commit' 'connect' 'copy' 'create' 'delete' 'destroy' 'detach' 'die' 'disable' 'disconnect' 'enable' 'exec_create' 'exec_detach' + 'exec_start' 'export' 'health_status' 'import' 'install' 'kill' 'load' 'mount' 'oom' 'pause' 'pull' 'push' 'reload' 'remove' 'rename' 'resize' + 'restart' 'save' 'start' 'stop' 'tag' 'top' 'unmount' 'unpause' 'untag' 'update') _describe -t event-filter-opts "event filter options" event_opts && ret=0 ;; (image) @@ -461,6 +461,11 @@ __docker_complete_events_filter() { (network) __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) local -a type_opts type_opts=('container' 'daemon' 'image' 'network' 'volume') @@ -612,6 +617,7 @@ __docker_container_subcommand() { "($help)*--dns=[Custom DNS servers]:DNS server: " "($help)*--dns-option=[Custom DNS options]:DNS option: " "($help)*--dns-search=[Custom DNS search domains]:DNS domains: " + "($help)*--domainname=[Container NIS domain name]:domainname:_hosts" "($help)*"{-e=,--env=}"[Environment variables]:environment variable: " "($help)--entrypoint=[Overwrite the default entrypoint of the image]:entry point: " "($help)*--env-file=[Read environment variables from a file]:environment file:_files" @@ -889,7 +895,7 @@ __docker_container_subcommand() { $opts_help \ $opts_attach_exec_run_start \ "($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 ;; (stats) @@ -923,7 +929,7 @@ __docker_container_subcommand() { local state _arguments $(__docker_arguments) \ $opts_help \ - opts_create_run_update \ + $opts_create_run_update \ "($help -)*: :->values" && ret=0 case $state in (values) @@ -2209,7 +2215,7 @@ __docker_stack_subcommand() { _arguments $(__docker_arguments) \ $opts_help \ "($help)--bundle-file=[Path to a Distributed Application Bundle file]:dab:_files -g \"*.dab\"" \ - "($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file]:compose file:_files -g \"*.(yml|yaml)\"" \ + "($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file, or '-' to read from stdin]:compose file:_files -g \"*.(yml|yaml)\"" \ "($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \ "($help -):stack:__docker_complete_stacks" && ret=0 ;; @@ -2280,6 +2286,9 @@ __docker_swarm_subcommand() { $opts_help \ "($help)--advertise-addr=[Advertised address]:ip\:port: " \ "($help)--data-path-addr=[Data path IP or interface]:ip " \ + "($help)--data-path-port=[Data Path Port]:port " \ + "($help)--default-addr-pool=[Default address pool]" \ + "($help)--default-addr-pool-mask-length=[Default address pool subnet mask length]" \ "($help)--autolock[Enable manager autolocking]" \ "($help)--availability=[Availability of the node]:availability:(active drain pause)" \ "($help)--cert-expiry=[Validity period for node certificates]:duration: " \ @@ -3024,4 +3033,4 @@ _docker "$@" # indent-tabs-mode: nil # sh-basic-offset: 4 # End: -# vim: ft=zsh sw=4 ts=4 et
\ No newline at end of file +# vim: ft=zsh sw=4 ts=4 et diff --git a/plugins/doctl/README.md b/plugins/doctl/README.md new file mode 100644 index 000000000..a81e90b0a --- /dev/null +++ b/plugins/doctl/README.md @@ -0,0 +1,9 @@ +# 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) +``` diff --git a/plugins/doctl/doctl.plugin.zsh b/plugins/doctl/doctl.plugin.zsh new file mode 100644 index 000000000..d23ed085c --- /dev/null +++ b/plugins/doctl/doctl.plugin.zsh @@ -0,0 +1,9 @@ +# 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 diff --git a/plugins/dotenv/README.md b/plugins/dotenv/README.md index ade09fbb2..e880e9d69 100644 --- a/plugins/dotenv/README.md +++ b/plugins/dotenv/README.md @@ -2,19 +2,19 @@ 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 Just add the plugin to your `.zshrc`: ```sh -plugins=(git man dotenv) +plugins=(... dotenv) ``` ## 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: ```sh @@ -30,5 +30,16 @@ SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f MONGO_URI=mongodb://127.0.0.1:27017 PORT=3001 ``` +You can even mix both formats, although it's probably a bad idea. -**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) diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh index 9dd784229..b701b5596 100644 --- a/plugins/dotenv/dotenv.plugin.zsh +++ b/plugins/dotenv/dotenv.plugin.zsh @@ -1,10 +1,19 @@ -#!/bin/zsh - source_env() { 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 } autoload -U add-zsh-hook add-zsh-hook chpwd source_env + +source_env diff --git a/plugins/droplr/README.md b/plugins/droplr/README.md index 25cf61db7..6daa2540d 100644 --- a/plugins/droplr/README.md +++ b/plugins/droplr/README.md @@ -16,4 +16,4 @@ Author: [Fabio Fernandes](https://github.com/fabiofl) - Upload a file: `droplr ./path/to/file/` -- Shorten a link: `droplr http://example.com` +- Shorten a link: `droplr https://example.com` diff --git a/plugins/drush/README.md b/plugins/drush/README.md new file mode 100644 index 000000000..df7b82bdd --- /dev/null +++ b/plugins/drush/README.md @@ -0,0 +1,83 @@ +# Drush + +## Description +This plugin offers aliases and functions to make the work with drush easier and more productive. + +To enable it, add the `drush` to your `plugins` array in `~/.zshrc`: + +``` +plugins=(... drush) +``` + +## Aliases +| Alias | Description | Command | +|-------|-----------------------------------------------------------------------|-----------------------------| +| dr | Display drush help | drush | +| drca | Clear all drupal caches. | drush cc all | +| drcb | Clear block cache. | drush cc block | +| drcg | Clear registry cache. | drush cc registry | +| drcj | Clear css-js cache. | drush cc css-js | +| drcm | Clear menu cache. | drush cc menu | +| drcml | Clear module-list cache. | drush cc module-list | +| drcr | Run all cron hooks in all active modules for specified site. | drush core-cron | +| drct | Clear theme-registry cache. | drush cc theme-registry | +| drcv | Clear views cache. (Make sure that the views module is enabled) | drush cc views | +| drdmp | Backup database in a new dump.sql file | drush drush sql-dump --ordered-dump --result-file=dump.sql| +| drf | Display features status | drush features | +| drfr | Revert a feature module on your site. | drush features-revert -y | +| drfu | Update a feature module on your site. | drush features-update -y | +| drfra | Revert all enabled feature module on your site. | drush features-revert-all | +| drif | Flush all derived images. | drush image-flush --all | +| drpm | Show a list of available modules. | drush pm-list --type=module | +| drst | Provides a birds-eye view of the current Drupal installation, if any. | drush core-status | +| drup | Apply any database updates required (as with running update.php). | drush updatedb | +| drups | List any pending database updates. | drush updatedb-status | +| drv | Show drush version. | drush version | +| drvd | Delete a variable. | drush variable-del | +| drvg | Get a list of some or all site variables and values. | drush variable-get | +| drvs | Set a variable. | drush variable-set | + +## Functions + +### dren +Download and enable one or more extensions (modules or themes). +Must be invoked with one or more parameters. e.g.: +`dren devel` or `dren devel module_filter views` + +### drf +Edit drushrc, site alias, and Drupal settings.php files. +Can be invoked with one or without parameters. e.g.: +`drf 1` + +### dris +Disable one or more extensions (modules or themes) +Must be invoked with one or more parameters. e.g.: +`dris devel` or `dris devel module_filter views` + +### drpu +Uninstall one or more modules. +Must be invoked with one or more parameters. e.g.: +`drpu devel` or `drpu devel module_filter views` + +### drnew +Creates a brand new drupal website. +Note: As soon as the installation is complete, drush will print a username and a random password into the terminal: +``` +Installation complete. User name: admin User password: cf7t8yqNEm +``` + +## Additional features + +### Autocomplete +The [completion script for drush](https://github.com/drush-ops/drush/blob/8.0.1/drush.complete.sh) comes enabled with this plugin. +So, it is possible to type a command: +``` +drush sql +``` + +And as soon as the tab key is pressed, the script will display the available commands: +``` +drush sql +sqlc sql-conf sql-create sql-dump sql-query sql-sanitize +sql-cli sql-connect sql-drop sqlq sqlsan sql-sync +``` diff --git a/plugins/drush/drush.complete.sh b/plugins/drush/drush.complete.sh new file mode 100644 index 000000000..38b882ec3 --- /dev/null +++ b/plugins/drush/drush.complete.sh @@ -0,0 +1,50 @@ +# BASH completion script for Drush. +# +# Place this in your /etc/bash_completion.d/ directory or source it from your +# ~/.bash_completion or ~/.bash_profile files. Alternatively, source +# examples/example.bashrc instead, as it will automatically find and source +# this file. +# +# If you're using ZSH instead of BASH, add the following to your ~/.zshrc file +# and source it. +# +# autoload bashcompinit +# bashcompinit +# source /path/to/your/drush.complete.sh + +# Ensure drush is available. +which drush > /dev/null || alias drush &> /dev/null || return + +__drush_ps1() { + f="${TMPDIR:-/tmp/}/drush-env-${USER}/drush-drupal-site-$$" + if [ -f $f ] + then + __DRUPAL_SITE=$(cat "$f") + else + __DRUPAL_SITE="$DRUPAL_SITE" + fi + + # Set DRUSH_PS1_SHOWCOLORHINTS to a non-empty value and define a + # __drush_ps1_colorize_alias() function for color hints in your Drush PS1 + # prompt. See example.prompt.sh for an example implementation. + if [ -n "${__DRUPAL_SITE-}" ] && [ -n "${DRUSH_PS1_SHOWCOLORHINTS-}" ]; then + __drush_ps1_colorize_alias + fi + + [[ -n "$__DRUPAL_SITE" ]] && printf "${1:- (%s)}" "$__DRUPAL_SITE" +} + +# Completion function, uses the "drush complete" command to retrieve +# completions for a specific command line COMP_WORDS. +_drush_completion() { + # Set IFS to newline (locally), since we only use newline separators, and + # need to retain spaces (or not) after completions. + local IFS=$'\n' + # The '< /dev/null' is a work around for a bug in php libedit stdin handling. + # Note that libedit in place of libreadline in some distributions. See: + # https://bugs.launchpad.net/ubuntu/+source/php5/+bug/322214 + COMPREPLY=( $(drush --early=includes/complete.inc "${COMP_WORDS[@]}" < /dev/null 2> /dev/null) ) +} + +# Register our completion function. We include common short aliases for Drush. +complete -o bashdefault -o default -o nospace -F _drush_completion d dr drush drush5 drush6 drush7 drush8 drush.php diff --git a/plugins/drush/drush.plugin.zsh b/plugins/drush/drush.plugin.zsh new file mode 100644 index 000000000..8a20d79f2 --- /dev/null +++ b/plugins/drush/drush.plugin.zsh @@ -0,0 +1,104 @@ +# Drush support. + +function dren() { + drush en $@ -y +} + +function dris() { + drush pm-disable $@ -y +} + +function drpu() { + drush pm-uninstall $@ -y +} + +function drf() { + if [[ $1 == "" ]] then + drush core-config + else + drush core-config --choice=$1 + fi +} + +function drfi() { + if [[ $1 == "fields" ]]; then + drush field-info fields + elif [[ $1 == "types" ]]; then + drush field-info types + else + drush field-info + fi +} + +function drnew() { + + cd ~ + echo "Website's name: " + read WEBSITE_NAME + + HOST=http://$(hostname -i)/ + + if [[ $WEBSITE_NAME == "" ]] then + MINUTES=$(date +%M:%S) + WEBSITE_NAME="Drupal-$MINUTES" + echo "Your website will be named: $WEBSITE_NAME" + fi + + drush dl drupal --drupal-project-rename=$WEBSITE_NAME + + echo "Type your localhost directory: (Leave empty for /var/www/html/)" + read DIRECTORY + + if [[ $DIRECTORY == "" ]] then + DIRECTORY="/var/www/html/" + fi + + echo "Moving to $DIRECTORY$WEBSITE_NAME" + sudo mv $WEBSITE_NAME $DIRECTORY + cd $DIRECTORY$WEBSITE_NAME + + echo "Database's user: " + read DATABASE_USR + echo "Database's password: " + read -s DATABASE_PWD + echo "Database's name for your project: " + read DATABASE + + DB_URL="mysql://$DATABASE_USR:$DATABASE_PWD@localhost/$DATABASE" + drush site-install standard --db-url=$DB_URL --site-name=$WEBSITE_NAME + + open_command $HOST$WEBSITE_NAME + echo "Done" + +} + +# Aliases, sorted alphabetically. +alias dr="drush" +alias drca="drush cc all" # Deprecated for Drush 8 +alias drcb="drush cc block" # Deprecated for Drush 8 +alias drcg="drush cc registry" # Deprecated for Drush 8 +alias drcj="drush cc css-js" +alias drcm="drush cc menu" +alias drcml="drush cc module-list" +alias drcr="drush core-cron" +alias drct="drush cc theme-registry" +alias drcv="drush cc views" +alias drdmp="drush sql-dump --ordered-dump --result-file=dump.sql" +alias drf="drush features" +alias drfr="drush features-revert -y" +alias drfu="drush features-update -y" +alias drfra="drush features-revert-all" +alias drif="drush image-flush --all" +alias drpm="drush pm-list --type=module" +alias drst="drush core-status" +alias drup="drush updatedb" +alias drups="drush updatedb-status" +alias drv="drush version" +alias drvd="drush variable-del" +alias drvg="drush variable-get" +alias drvs="drush variable-set" + +# Enable drush autocomplete support +autoload bashcompinit +bashcompinit +source $(dirname $0)/drush.complete.sh diff --git a/plugins/emacs/README.md b/plugins/emacs/README.md new file mode 100644 index 000000000..c8e33b5ab --- /dev/null +++ b/plugins/emacs/README.md @@ -0,0 +1,30 @@ +# 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 | diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh index c102a5a1e..db0ab13af 100644 --- a/plugins/emacs/emacs.plugin.zsh +++ b/plugins/emacs/emacs.plugin.zsh @@ -10,7 +10,7 @@ # - 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" # set EDITOR if not already defined. diff --git a/plugins/ember-cli/README.md b/plugins/ember-cli/README.md index 1f92bba32..b46373619 100644 --- a/plugins/ember-cli/README.md +++ b/plugins/ember-cli/README.md @@ -1,8 +1,8 @@ # 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 @@ -17,5 +17,6 @@ Alias | Ember-CLI command **ein** | *ember init* **ei** | *ember install* **et** | *ember test* +**ets** | *ember test --serve* **eu** | *ember update* **ev** | *ember version* diff --git a/plugins/ember-cli/ember-cli.plugin.zsh b/plugins/ember-cli/ember-cli.plugin.zsh index a0f346829..67842c120 100644 --- a/plugins/ember-cli/ember-cli.plugin.zsh +++ b/plugins/ember-cli/ember-cli.plugin.zsh @@ -1,5 +1,5 @@ # 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 ea='ember addon' @@ -10,6 +10,7 @@ alias eh='ember help' alias ein='ember init' alias ei='ember install' alias et='ember test' +alias ets='ember test --serve' alias eu='ember update' # version diff --git a/plugins/emoji-clock/README.md b/plugins/emoji-clock/README.md new file mode 100644 index 000000000..4934f380b --- /dev/null +++ b/plugins/emoji-clock/README.md @@ -0,0 +1,14 @@ +# 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 | diff --git a/plugins/emoji/README.md b/plugins/emoji/README.md index 889e567e6..8b8860a86 100644 --- a/plugins/emoji/README.md +++ b/plugins/emoji/README.md @@ -71,7 +71,7 @@ PROMPT="$surfer > " ## 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) @@ -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]" ``` -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 @@ -130,6 +130,6 @@ This does *not* mean that it should use Gemoji at run time. None of the `zsh` pl #### 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. diff --git a/plugins/emoji/emoji-data.txt b/plugins/emoji/emoji-data.txt index 7b4c015f7..2d6d64e2b 100644 --- a/plugins/emoji/emoji-data.txt +++ b/plugins/emoji/emoji-data.txt @@ -17,7 +17,7 @@ # none: not applicable # Field 4 — Emoji_Sources: # 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 # Comment — currently contains the version where the character was first encoded, # followed by: @@ -1200,7 +1200,7 @@ 1F1F2 1F1ED ; emoji ; L2 ; none ; x # V6.0 (🇲🇭) flag for Marshall Islands 1F1F2 1F1F0 ; emoji ; L2 ; none ; x # V6.0 (🇲🇰) flag for Macedonia 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 1F1F4 ; emoji ; L2 ; none ; x # V6.0 (🇲🇴) flag for Macau 1F1F2 1F1F5 ; emoji ; L2 ; none ; x # V6.0 (🇲🇵) flag for Northern Mariana Islands diff --git a/plugins/emoji/update_emoji.pl b/plugins/emoji/update_emoji.pl index 04f3ce8e7..8034052b7 100644 --- a/plugins/emoji/update_emoji.pl +++ b/plugins/emoji/update_emoji.pl @@ -5,15 +5,15 @@ # This script generates the emoji.plugin.zsh emoji definitions from the Unicode # character data for the emoji characters. # -# The data file can be found at http://unicode.org/Public/emoji/latest/emoji-data.txt -# as referenced in Unicode TR51 (http://www.unicode.org/reports/tr51/index.html). +# The data file can be found at https://unicode.org/Public/emoji/latest/emoji-data.txt +# 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 # versions if the format changes. In particular, this reads line comments to get the # emoji character name and unicode version. # # 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 # that get stripped during this process. @@ -41,7 +41,7 @@ sub process_emoji_data_file { # # This contains the definition for: # \$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 typeset -gAH emoji @@ -63,7 +63,7 @@ typeset -gAH emoji_mod 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*$/) { - 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); #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; @@ -84,7 +84,7 @@ typeset -gAH emoji_mod if ($flag_country) { $outfh->print("emoji_flags[$zsh_flag_country]=\$'$zsh_code'\n"); } 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, # because they have a standalone representation as a color swatch. diff --git a/plugins/emotty/emotty.plugin.zsh b/plugins/emotty/emotty.plugin.zsh index b32dd1a4c..b0d24c322 100644 --- a/plugins/emotty/emotty.plugin.zsh +++ b/plugins/emotty/emotty.plugin.zsh @@ -26,13 +26,14 @@ function emotty() { # Use emotty set defined by user, fallback to default local emotty=${_emotty_sets[${emotty_set:-$emotty_default_set}]} # 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]} echo "${emoji[${character_name}]}${emoji2[emoji_style]}" } function display_emotty() { - local name=$1 + local name=${1:-$emotty_set} + echo $name for i in ${=_emotty_sets[$name]}; do printf "${emoji[$i]}${emoji2[emoji_style]} " done diff --git a/plugins/encode64/README.md b/plugins/encode64/README.md new file mode 100644 index 000000000..9850da85f --- /dev/null +++ b/plugins/encode64/README.md @@ -0,0 +1,69 @@ +# 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 + ``` diff --git a/plugins/extract/README.md b/plugins/extract/README.md index c6bdd36dd..83b878c32 100644 --- a/plugins/extract/README.md +++ b/plugins/extract/README.md @@ -19,6 +19,7 @@ plugins=(... extract) | `7z` | 7zip file | | `Z` | Z archive (LZW) | | `apk` | Android app file | +| `aar` | Android library file | | `bz2` | Bzip2 file | | `deb` | Debian package | | `gz` | Gzip file | diff --git a/plugins/extract/_extract b/plugins/extract/_extract index 172425d2c..33d49fcc5 100644 --- a/plugins/extract/_extract +++ b/plugins/extract/_extract @@ -3,5 +3,5 @@ _arguments \ '(-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|aar|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 diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 34f8d8710..5e9b9ff24 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -29,7 +29,7 @@ extract() { success=0 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.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; (*.tar.xz|*.txz) @@ -45,8 +45,8 @@ extract() { (*.bz2) bunzip2 "$1" ;; (*.xz) unxz "$1" ;; (*.lzma) unlzma "$1" ;; - (*.Z) uncompress "$1" ;; - (*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk) unzip "$1" -d $extract_dir ;; + (*.z) uncompress "$1" ;; + (*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;; (*.rar) unrar x -ad "$1" ;; (*.7z) 7za x "$1" ;; (*.deb) diff --git a/plugins/fabric/README.md b/plugins/fabric/README.md new file mode 100644 index 000000000..cf0fa81f4 --- /dev/null +++ b/plugins/fabric/README.md @@ -0,0 +1,9 @@ +# 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) +``` diff --git a/plugins/fabric/fabric.plugin.zsh b/plugins/fabric/fabric.plugin.zsh index aca411329..e69de29bb 100644 --- a/plugins/fabric/fabric.plugin.zsh +++ b/plugins/fabric/fabric.plugin.zsh @@ -1 +0,0 @@ -# DECLARION: This plugin was created by vhbit. What I did is just making a portal from https://github.com/vhbit/fabric-zsh-autocomplete. diff --git a/plugins/fancy-ctrl-z/README.md b/plugins/fancy-ctrl-z/README.md index a7670fa2c..f1b1dfa5c 100644 --- a/plugins/fancy-ctrl-z/README.md +++ b/plugins/fancy-ctrl-z/README.md @@ -1,10 +1,10 @@ # Use Ctrl-Z to switch back to Vim -I frequently need to execute random command in my shell. To achieve it I pause +I frequently need to execute random commands in my shell. To achieve it I pause Vim by pressing Ctrl-z, type command and press fg<Enter> to switch back to Vim. -The fg part really hurt sme. I just wanted to hit Ctrl-z once again to get back +The fg part really hurts me. I just wanted to hit Ctrl-z once again to get back to Vim. I could not find a solution, so I developed one on my own that -works wonderfully with ZSH +works wonderfully with ZSH. Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/ diff --git a/plugins/fasd/fasd.plugin.zsh b/plugins/fasd/fasd.plugin.zsh index 2c302f74d..36a0428a7 100644 --- a/plugins/fasd/fasd.plugin.zsh +++ b/plugins/fasd/fasd.plugin.zsh @@ -6,6 +6,7 @@ if [ $commands[fasd] ]; then # check if fasd is installed source "$fasd_cache" unset fasd_cache - alias v="f -e $EDITOR" - alias o='a -e open_command' + alias v="f -e \"$EDITOR\"" + alias o='a -e xdg-open' + alias j='zz' fi diff --git a/plugins/fd/README.md b/plugins/fd/README.md new file mode 100644 index 000000000..aabd624b8 --- /dev/null +++ b/plugins/fd/README.md @@ -0,0 +1,13 @@ +# fd + +This plugin adds completion for the file search tool [`fd`](https://github.com/sharkdp/fd), also known as `fd-find`. + +To use it, add `fd` to the plugins array in your zshrc file: + +```zsh +plugins=(... fd) +``` + +Completion is taken from the fd release [`7.3.0`](https://github.com/sharkdp/fd/releases/tag/v7.3.0). + +Updated on Febrary 13th, 2019. diff --git a/plugins/fd/_fd b/plugins/fd/_fd new file mode 100644 index 000000000..7a4c38753 --- /dev/null +++ b/plugins/fd/_fd @@ -0,0 +1,83 @@ +#compdef fd fdfind + +autoload -U is-at-least + +_fd() { + typeset -A opt_args + typeset -a _arguments_options + local ret=1 + + if is-at-least 5.2; then + _arguments_options=(-s -S -C) + else + _arguments_options=(-s -C) + fi + + local context curcontext="$curcontext" state line + _arguments "${_arguments_options[@]}" \ +'-d+[Set maximum search depth (default: none)]' \ +'--max-depth=[Set maximum search depth (default: none)]' \ +'--maxdepth=[See --max-depth]' \ +'*-t+[Filter by type: file (f), directory (d), symlink (l), +executable (x), empty (e)]: :(f file d directory l symlink x executable e empty)' \ +'*--type=[Filter by type: file (f), directory (d), symlink (l), +executable (x), empty (e)]: :(f file d directory l symlink x executable e empty)' \ +'*-e+[Filter by file extension]' \ +'*--extension=[Filter by file extension]' \ +'-x+[Execute a command for each search result]' \ +'--exec=[Execute a command for each search result]' \ +'(-x --exec)-X+[Execute a command with all search results at once]' \ +'(-x --exec)--exec-batch=[Execute a command with all search results at once]' \ +'*-E+[Exclude entries that match the given glob pattern]' \ +'*--exclude=[Exclude entries that match the given glob pattern]' \ +'*--ignore-file=[Add a custom ignore-file in .gitignore format]' \ +'-c+[When to use colors: never, *auto*, always]: :(never auto always)' \ +'--color=[When to use colors: never, *auto*, always]: :(never auto always)' \ +'-j+[Set number of threads to use for searching & executing]' \ +'--threads=[Set number of threads to use for searching & executing]' \ +'*-S+[Limit results based on the size of files.]' \ +'*--size=[Limit results based on the size of files.]' \ +'--max-buffer-time=[the time (in ms) to buffer, before streaming to the console]' \ +'--changed-within=[Filter by file modification time (newer than)]' \ +'--changed-before=[Filter by file modification time (older than)]' \ +'*--search-path=[(hidden)]' \ +'-H[Search hidden files and directories]' \ +'--hidden[Search hidden files and directories]' \ +'-I[Do not respect .(git|fd)ignore files]' \ +'--no-ignore[Do not respect .(git|fd)ignore files]' \ +'--no-ignore-vcs[Do not respect .gitignore files]' \ +'*-u[Alias for no-ignore and/or hidden]' \ +'-s[Case-sensitive search (default: smart case)]' \ +'--case-sensitive[Case-sensitive search (default: smart case)]' \ +'-i[Case-insensitive search (default: smart case)]' \ +'--ignore-case[Case-insensitive search (default: smart case)]' \ +'-F[Treat the pattern as a literal string]' \ +'--fixed-strings[Treat the pattern as a literal string]' \ +'-a[Show absolute instead of relative paths]' \ +'--absolute-path[Show absolute instead of relative paths]' \ +'-L[Follow symbolic links]' \ +'--follow[Follow symbolic links]' \ +'-p[Search full path (default: file-/dirname only)]' \ +'--full-path[Search full path (default: file-/dirname only)]' \ +'-0[Separate results by the null character]' \ +'--print0[Separate results by the null character]' \ +'--show-errors[Enable display of filesystem errors]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::pattern -- the search pattern, a regular expression (optional):_files' \ +'::path -- the root directory for the filesystem search (optional):_files' \ +&& ret=0 + +} + +(( $+functions[_fd_commands] )) || +_fd_commands() { + local commands; commands=( + + ) + _describe -t commands 'fd commands' commands "$@" +} + +_fd "$@" diff --git a/plugins/fedora/README.md b/plugins/fedora/README.md index f384b0ffd..6594799b3 100644 --- a/plugins/fedora/README.md +++ b/plugins/fedora/README.md @@ -1,3 +1 @@ -This is a plugin based on yum plugin, but using dnf as main frontend -(from Fedora 22 onwards, yum is deprecated in favor of dnf). - +The fedora plugin is deprecated. Use the [dnf plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/dnf) instead. diff --git a/plugins/fedora/fedora.plugin.zsh b/plugins/fedora/fedora.plugin.zsh index eddc3627b..16a214313 100644..120000 --- a/plugins/fedora/fedora.plugin.zsh +++ b/plugins/fedora/fedora.plugin.zsh @@ -1,16 +1 @@ -## 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 diff --git a/plugins/firewalld/firewalld.plugin.zsh b/plugins/firewalld/firewalld.plugin.zsh index bfbf6f48f..5b1090636 100644 --- a/plugins/firewalld/firewalld.plugin.zsh +++ b/plugins/firewalld/firewalld.plugin.zsh @@ -6,7 +6,7 @@ alias fwrp="sudo firewall-cmd --runtime-to-permanent" function fwl () { # converts output to zsh array () # @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 sudo firewall-cmd --zone $i --list-all diff --git a/plugins/forklift/README.md b/plugins/forklift/README.md index 6c5cbab23..6c4ce1e81 100644 --- a/plugins/forklift/README.md +++ b/plugins/forklift/README.md @@ -4,7 +4,7 @@ Plugin for ForkLift, an FTP application for OS X. ### Requirements -* [ForkLift](http://www.binarynights.com/forklift/) +* [ForkLift](https://binarynights.com/) ### Usage diff --git a/plugins/forklift/forklift.plugin.zsh b/plugins/forklift/forklift.plugin.zsh index 692ca5790..274c4a822 100644 --- a/plugins/forklift/forklift.plugin.zsh +++ b/plugins/forklift/forklift.plugin.zsh @@ -1,6 +1,6 @@ # Open folder in ForkLift.app or ForkLift2.app from console # 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: # fl [<folder>] @@ -24,46 +24,84 @@ function fl { fi osascript 2>&1 1>/dev/null <<END - try - tell application "Finder" - set appName to name of application file id "com.binarynights.ForkLift2" - end tell - on error err_msg number err_num - tell application "Finder" - set appName to name of application file id "com.binarynights.ForkLift" - end tell - end try + try + tell application "Finder" + set forkLift3 to name of application file id "com.binarynights.ForkLift-3" + end tell + on error err_msg number err_num + set forkLift3 to null + end try + 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 - tell application appName + if forkLift3 is not null and application forkLift3 is running then + tell application forkLift3 activate - end tell - else - tell application appName + set forkLiftVersion to version + end tell + else if forkLift2 is not null and application forkLift2 is running then + tell application forkLift2 activate - end tell - repeat until application appName is running - delay 1 - end repeat - tell application appName + set forkLiftVersion to version + end tell + else if forkLift is not null and application forkLift is running then + tell application forkLift 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 + + 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 process "ForkLift" + tell application "System Events" + tell application process "ForkLift" try - set topWindow to window 1 + set topWindow to window 1 on error - keystroke "n" using command down - set topWindow to window 1 + keystroke "n" using command down + set topWindow to window 1 end try keystroke "g" using {command down, shift down} - tell sheet 1 of topWindow - set value of text field 1 to "$PWD" - keystroke return - end tell - end tell + if forkLiftVersion starts with "3" then + tell pop over of list of group of splitter group of splitter group of topWindow + set value of text field 1 to "$PWD" + 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 } diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md index 4d956e38f..24f82b262 100644 --- a/plugins/frontend-search/README.md +++ b/plugins/frontend-search/README.md @@ -32,16 +32,17 @@ Available search contexts are: | context | URL | |---------------|--------------------------------------------------------------------------| -| angularjs | `https://google.com/search?as_sitesearch=angularjs.org&as_q=` | +| angular(>=2.0)| `https://angular.io/?search=` | +| angularjs(1.x)| `https://google.com/search?as_sitesearch=angularjs.org&as_q=` | aurajs | `http://aurajs.com/api/#stq=` | | bem | `https://google.com/search?as_sitesearch=bem.info&as_q=` | -| bootsnipp | `http://bootsnipp.com/search?q=` | -| caniuse | `http://caniuse.com/#search=` | -| codepen | `http://codepen.io/search?q=` | +| bootsnipp | `https://bootsnipp.com/search?q=` | +| caniuse | `https://caniuse.com/#search=` | +| codepen | `https://codepen.io/search?q=` | | compassdoc | `http://compass-style.org/search?q=` | | cssflow | `http://www.cssflow.com/search?q=` | | 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=` | | html5please | `http://html5please.com/#` | | jquery | `https://api.jquery.com/?s=` | @@ -51,7 +52,7 @@ Available search contexts are: | qunit | `https://api.qunitjs.com/?s=` | | reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` | | smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` | -| stackoverflow | `http://stackoverflow.com/search?q=` | +| stackoverflow | `https://stackoverflow.com/search?q=` | | unheap | `http://www.unheap.com/?s=` | If you want to have another context, open an Issue and tell us! @@ -62,4 +63,4 @@ If you want to have another context, open an Issue and tell us! **Wilson Mendes (willmendesneto)** + <https://plus.google.com/+WilsonMendes> + <https://twitter.com/willmendesneto> -+ <http://github.com/willmendesneto> ++ <https://github.com/willmendesneto> diff --git a/plugins/frontend-search/_frontend-search.sh b/plugins/frontend-search/_frontend-search.sh index 9aad76f76..573aa3aae 100644 --- a/plugins/frontend-search/_frontend-search.sh +++ b/plugins/frontend-search/_frontend-search.sh @@ -33,7 +33,8 @@ function _frontend() { 'unheap: Search in unheap website' 'bem: Search in BEM website' 'smacss: Search in SMACSS website' - 'angularjs: Search in Angular website' + 'angular: Search in Angular website for Angular 2.x' + 'angularjs: Search in Angular website for Angular 1.x' 'reactjs: Search in React website' 'emberjs: Search in Ember website' 'stackoverflow: Search in StackOverflow website' @@ -99,6 +100,9 @@ function _frontend() { smacss) _describe -t points "Warp points" frontend_points && ret=0 ;; + angular) + _describe -t points "Warp points" frontend_points && ret=0 + ;; angularjs) _describe -t points "Warp points" frontend_points && ret=0 ;; diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh index 3fd49ab8e..bef5992a3 100644 --- a/plugins/frontend-search/frontend-search.plugin.zsh +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -1,3 +1,4 @@ +alias angular='frontend angular' alias angularjs='frontend angularjs' alias aurajs='frontend aurajs' alias bem='frontend bem' @@ -26,16 +27,17 @@ function frontend() { # define search context URLS typeset -A urls urls=( + angular 'https://angular.io/?search=' angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q=' aurajs 'http://aurajs.com/api/#stq=' bem 'https://google.com/search?as_sitesearch=bem.info&as_q=' - bootsnipp 'http://bootsnipp.com/search?q=' - caniuse 'http://caniuse.com/#search=' - codepen 'http://codepen.io/search?q=' + bootsnipp 'https://bootsnipp.com/search?q=' + caniuse 'https://caniuse.com/#search=' + codepen 'https://codepen.io/search?q=' compassdoc 'http://compass-style.org/search?q=' cssflow 'http://www.cssflow.com/search?q=' 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=' html5please 'http://html5please.com/#' jquery 'https://api.jquery.com/?s=' @@ -45,7 +47,7 @@ function frontend() { qunit 'https://api.qunitjs.com/?s=' reactjs 'https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=' smacss 'https://google.com/search?as_sitesearch=smacss.com&as_q=' - stackoverflow 'http://stackoverflow.com/search?q=' + stackoverflow 'https://stackoverflow.com/search?q=' unheap 'http://www.unheap.com/?s=' ) @@ -57,9 +59,9 @@ function frontend() { print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website," print -P "and %Ucontext%u is one of the following:" print -P "" - print -P " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow," - print -P " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs," - print -P " qunit, reactjs, smacss, stackoverflow, unheap" + print -P " angular (>= 2.0), angularjs (1.x), aurajs, bem, bootsnipp, caniuse, codepen," + print -P " compassdoc, cssflow, dartlang, emberjs, fontello, html5please, jquery," + print -P " lodash, mdn, npmjs, qunit, reactjs, smacss, stackoverflow, unheap" print -P "" print -P "For example: frontend npmjs mocha (or just: npmjs mocha)." print -P "" @@ -73,17 +75,17 @@ function frontend() { echo "" echo "Valid contexts are:" echo "" - echo " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, " - echo " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs, " - echo " qunit, reactjs, smacss, stackoverflow, unheap" + echo " angular (>= 2.0), angularjs (1.x), aurajs, bem, bootsnipp, caniuse, codepen," + echo " compassdoc, cssflow, dartlang, emberjs, fontello, html5please, jquery," + echo " lodash, mdn, npmjs, qunit, reactjs, smacss, stackoverflow, unheap" echo "" return 1 fi # build search url: - # join arguments passed with '+', then append to search context URL + # join arguments passed with '%20', then append to search context URL # TODO substitute for proper urlencode method - url="${urls[$1]}${(j:+:)@[2,-1]}" + url="${urls[$1]}${(j:%20:)@[2,-1]}" echo "Opening $url ..." diff --git a/plugins/fzf/README.md b/plugins/fzf/README.md new file mode 100644 index 000000000..b3a434347 --- /dev/null +++ b/plugins/fzf/README.md @@ -0,0 +1,19 @@ +# 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 +) +``` diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh new file mode 100644 index 000000000..27e2d9246 --- /dev/null +++ b/plugins/fzf/fzf.plugin.zsh @@ -0,0 +1,57 @@ +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 diff --git a/plugins/geeknote/README.md b/plugins/geeknote/README.md index a6b50e27f..3f2353112 100644 --- a/plugins/geeknote/README.md +++ b/plugins/geeknote/README.md @@ -1,6 +1,6 @@ ## 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: diff --git a/plugins/gem/README.md b/plugins/gem/README.md new file mode 100644 index 000000000..decd87ba3 --- /dev/null +++ b/plugins/gem/README.md @@ -0,0 +1,17 @@ +# 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 | diff --git a/plugins/git-auto-fetch/README.md b/plugins/git-auto-fetch/README.md new file mode 100644 index 000000000..35f3c2f71 --- /dev/null +++ b/plugins/git-auto-fetch/README.md @@ -0,0 +1,31 @@ +# 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 +``` diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh new file mode 100644 index 000000000..1d20bc04b --- /dev/null +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -0,0 +1,27 @@ +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 diff --git a/plugins/git-extras/README.md b/plugins/git-extras/README.md index 8f12e297e..987f0d800 100644 --- a/plugins/git-extras/README.md +++ b/plugins/git-extras/README.md @@ -1,6 +1,6 @@ # 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 diff --git a/plugins/git-extras/git-extras.plugin.zsh b/plugins/git-extras/git-extras.plugin.zsh index 0dcd630e8..b86d7c5b6 100644 --- a/plugins/git-extras/git-extras.plugin.zsh +++ b/plugins/git-extras/git-extras.plugin.zsh @@ -2,7 +2,7 @@ # 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 # function that ships with zsh itself. It will not work with the _git that ships @@ -19,8 +19,8 @@ # Inspirations # ----------- # -# * git-extras (http://github.com/tj/git-extras) -# * git-flow-completion (http://github.com/bobthecow/git-flow-completion) +# * git-extras (https://github.com/tj/git-extras) +# * git-flow-completion (https://github.com/bobthecow/git-flow-completion) # # ------------------------------------------------------------------------------ @@ -47,6 +47,14 @@ __gitex_commits() { _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() { local expl declare -a tag_names @@ -69,7 +77,11 @@ __gitex_specific_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/}) __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() { @@ -102,6 +114,11 @@ __gitex_author_names() { } # subcommands +_git-authors() { + _arguments -C \ + '(--list -l)'{--list,-l}'[show authors]' \ + '--no-email[without email]' \ +} _git-bug() { local curcontext=$curcontext state line ret=1 @@ -126,8 +143,16 @@ _git-bug() { _arguments -C \ ':branch-name:__gitex_bug_branch_names' ;; + -r|--remote ) + _arguments -C \ + ':remote-name:__gitex_remote_names' + ;; esac + return 0 esac + + _arguments \ + '(--remote -r)'{--remote,-r}'[setup remote tracking branch]' } @@ -136,6 +161,40 @@ _git-changelog() { '(-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() { @@ -149,6 +208,27 @@ _git-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() { _arguments \ @@ -220,10 +300,17 @@ _git-feature() { _arguments -C \ ':branch-name:__gitex_feature_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-graft() { _arguments \ @@ -231,14 +318,39 @@ _git-graft() { ':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() { _arguments -C \ '(--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() { _arguments \ ':first-branch-name:__gitex_branch_names' \ @@ -269,8 +381,16 @@ _git-refactor() { _arguments -C \ ':branch-name:__gitex_refactor_branch_names' ;; + -r|--remote ) + _arguments -C \ + ':remote-name:__gitex_remote_names' + ;; esac + return 0 esac + + _arguments \ + '(--remote -r)'{--remote,-r}'[setup remote tracking branch]' } @@ -279,6 +399,23 @@ _git-squash() { ':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() { _arguments '--line[summarize with lines rather than commits]' __gitex_commits @@ -291,45 +428,71 @@ _git-undo(){ '(--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' \ - 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' \ - bug:'create a bug branch' \ - changelog:'populate changelog file with commits since the previous tag' \ - commits-since:'list commits since a given date' \ - contrib:'display author contributions' \ - count:'count commits' \ - create-branch:'create local and remote branch' \ - delete-branch:'delete local and remote branch' \ - delete-merged-branches:'delete merged branches'\ - delete-submodule:'delete submodule' \ - delete-tag:'delete local and remote tag' \ - effort:'display effort statistics' \ - extras:'git-extras' \ - feature:'create a feature branch' \ - fork:'fork a repo on github' \ - fresh-branch:'create empty local branch' \ - gh-pages:'create the GitHub Pages branch' \ - graft:'merge commits from source branch to destination branch' \ - ignore:'add patterns to .gitignore' \ - info:'show info about the repository' \ - local-commits:'list unpushed commits on the local branch' \ + bug:'create bug branch' \ + bulk:'run bulk commands' \ + changelog:'generate a changelog report' \ + chore:'create chore branch' \ + clear-soft:'soft clean up a repository' \ + clear:'rigorously clean up a repository' \ + commits-since:'show commit logs since some date' \ + contrib:'show user contributions' \ + count:'show commit count' \ + create-branch:'create branches' \ + delete-branch:'delete branches' \ + delete-merged-branches:'delete merged branches' \ + 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' \ + fresh-branch:'create fresh branches' \ + gh-pages:'create the GitHub pages branch' \ + graft:'merge and destroy a given branch' \ + guilt:'calculate change between two revisions' \ + ignore-io:'get sample gitignore file' \ + ignore:'add .gitignore patterns' \ + info:'returns information on current repository' \ + local-commits:'list local commits' \ lock:'lock a file excluded from version control' \ 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' \ + mr:'checks out a merge request locally' \ + obliterate:'rewrite past commits to remove some files' \ 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' \ - refactor:'create a refactor branch' \ + refactor:'create refactor branch' \ release:'commit, tag and push changes to the repository' \ + rename-branch:'rename a branch' \ rename-tag:'rename a tag' \ - repl:'read-eval-print-loop' \ + repl:'git read-eval-print-loop' \ reset-file:'reset one file' \ 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' \ - squash:'merge commits from source branch into the current one as a single commit' \ - summary:'repository summary' \ - touch:'one step creation of new files' \ - undo:'remove the latest commit' \ + show-unmerged-branches:'show unmerged branches' \ + squash:'import changes from a branch' \ + stamp:'stamp the last commit message' \ + 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' diff --git a/plugins/git-flow-avh/README.md b/plugins/git-flow-avh/README.md new file mode 100644 index 000000000..0768d93ea --- /dev/null +++ b/plugins/git-flow-avh/README.md @@ -0,0 +1,19 @@ +# 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. diff --git a/plugins/git-flow-avh/git-flow-avh.plugin.zsh b/plugins/git-flow-avh/git-flow-avh.plugin.zsh index ba98fff01..860ca55c5 100644 --- a/plugins/git-flow-avh/git-flow-avh.plugin.zsh +++ b/plugins/git-flow-avh/git-flow-avh.plugin.zsh @@ -1,419 +1,526 @@ -#!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 () { - local curcontext="$curcontext" state line - typeset -A opt_args - - _arguments -C \ - ':command:->command' \ - '*::options:->options' - - case $state in - (command) - - local -a subcommands - subcommands=( - 'init:Initialize a new git repo with support for the branching model.' - 'feature:Manage your feature branches.' - 'config:Manage your configuration.' - 'release:Manage your release branches.' - 'hotfix:Manage your hotfix branches.' - 'support:Manage your support branches.' - 'version:Shows version information.' - 'finish:Finish 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 - ;; - - (options) - case $line[1] in - - (init) - _arguments \ - -f'[Force setting of gitflow branches, even if already configured]' - ;; - - (version) - ;; - - (hotfix) - __git-flow-hotfix - ;; - - (release) - __git-flow-release - ;; - - (feature) - __git-flow-feature - ;; - (config) - __git-flow-config - ;; - - esac - ;; - esac + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'init:Initialize a new git repo with support for the branching model.' + 'feature:Manage your feature branches.' + 'bugfix:Manage your bugfix branches.' + 'config:Manage your configuration.' + 'release:Manage your release branches.' + 'hotfix:Manage your hotfix branches.' + 'support:Manage your support branches.' + 'version:Shows version information.' + 'finish:Finish the branch you are currently on.' + 'delete:Delete the branch you are currently on.' + 'publish:Publish the branch you are currently on.' + 'rebase:Rebase the branch you are currently on.' + ) + _describe -t commands 'git flow' subcommands + ;; + + (options) + case $line[1] in + + (init) + _arguments \ + -f'[Force setting of gitflow branches, even if already configured]' + ;; + + (version) + ;; + + (hotfix) + __git-flow-hotfix + ;; + + (release) + __git-flow-release + ;; + + (feature) + __git-flow-feature + ;; + (bugfix) + __git-flow-bugfix + ;; + + (config) + __git-flow-config + ;; + + esac + ;; + esac } __git-flow-release () { - 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 release branch.' - 'finish:Finish a release branch.' - 'list:List all your release branches. (Alias to `git flow release`)' - 'publish:Publish release branch to remote.' - 'track:Checkout remote release branch.' - 'delete:Delete a release branch.' - ) - _describe -t commands 'git flow release' subcommands - _arguments \ - -v'[Verbose (more) output]' - ;; - - (options) - case $line[1] in - - (start) - _arguments \ - -F'[Fetch from origin before performing finish]'\ - ':version:__git_flow_version_list' - ;; - - (finish) - _arguments \ - -F'[Fetch from origin before performing finish]' \ - -s'[Sign the release tag cryptographically]'\ - -u'[Use the given GPG-key for the digital signature (implies -s)]'\ - -m'[Use the given tag message]'\ - -p'[Push to $ORIGIN after performing finish]'\ - ':version:__git_flow_version_list' - ;; - - (delete) - _arguments \ - -f'[Force deletion]' \ - -r'[Delete remote branch]' \ - ':version:__git_flow_version_list' - ;; - - (publish) - _arguments \ - ':version:__git_flow_version_list' - ;; - - (track) - _arguments \ - ':version:__git_flow_version_list' - ;; - - *) - _arguments \ - -v'[Verbose (more) output]' - ;; - esac - ;; - esac + 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 release branch.' + 'finish:Finish a release branch.' + 'list:List all your release branches. (Alias to `git flow release`)' + 'publish:Publish release branch to remote.' + 'track:Checkout remote release branch.' + 'rebase:Rebase from integration branch.' + 'delete:Delete a release branch.' + ) + _describe -t commands 'git flow release' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':version:__git_flow_version_list' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + ':version:__git_flow_version_list' + ;; + + (delete) + _arguments \ + -f'[Force deletion]' \ + -r'[Delete remote branch]' \ + ':version:__git_flow_version_list' + ;; + + (publish) + _arguments \ + ':version:__git_flow_version_list' + ;; + + (track) + _arguments \ + ':version:__git_flow_version_list' + ;; + + (rebase) + _arguments \ + -i'[Do an interactive rebase]' \ + ':branch:__git_branch_names' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac } __git-flow-hotfix () { - 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 hotfix branch.' - 'finish:Finish a hotfix branch.' - 'delete:Delete a hotfix branch.' - 'list:List all your hotfix branches. (Alias to `git flow hotfix`)' - ) - _describe -t commands 'git flow hotfix' subcommands - _arguments \ - -v'[Verbose (more) output]' - ;; - - (options) - case $line[1] in - - (start) - _arguments \ - -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]' \ - -s'[Sign the release tag cryptographically]'\ - -u'[Use the given GPG-key for the digital signature (implies -s)]'\ - -m'[Use the given tag message]'\ - -p'[Push to $ORIGIN after performing finish]'\ - ':hotfix:__git_flow_hotfix_list' - ;; - - (delete) - _arguments \ - -f'[Force deletion]' \ - -r'[Delete remote branch]' \ - ':hotfix:__git_flow_hotfix_list' - ;; - - *) - _arguments \ - -v'[Verbose (more) output]' - ;; - esac - ;; - esac + 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 hotfix branch.' + 'finish:Finish a hotfix branch.' + 'delete:Delete a hotfix branch.' + 'rebase:Rebase from integration branch.' + 'list:List all your hotfix branches. (Alias to `git flow hotfix`)' + 'rename:Rename a hotfix branch.' + ) + _describe -t commands 'git flow hotfix' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -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]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + ':hotfix:__git_flow_hotfix_list' + ;; + + (delete) + _arguments \ + -f'[Force deletion]' \ + -r'[Delete remote branch]' \ + ':hotfix:__git_flow_hotfix_list' + ;; + + (rebase) + _arguments \ + -i'[Do an interactive rebase]' \ + ':branch:__git_branch_names' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac } __git-flow-feature () { - 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 feature branch.' - 'finish:Finish a feature branch.' - 'delete:Delete a feature branch.' - 'list:List all your feature branches. (Alias to `git flow feature`)' - 'publish:Publish feature branch to remote.' - 'track:Checkout remote feature branch.' - 'diff:Show all changes.' - 'rebase:Rebase from integration branch.' - 'checkout:Checkout local feature branch.' - 'pull:Pull changes from remote.' - ) - _describe -t commands 'git flow feature' subcommands - _arguments \ - -v'[Verbose (more) output]' - ;; - - (options) - case $line[1] in - - (start) - _arguments \ - -F'[Fetch from origin before performing finish]'\ - ':feature:__git_flow_feature_list'\ - ':branch-name:__git_branch_names' - ;; - - (finish) - _arguments \ - -F'[Fetch from origin before performing finish]' \ - -r'[Rebase instead of merge]'\ - ':feature:__git_flow_feature_list' - ;; - - (delete) - _arguments \ - -f'[Force deletion]' \ - -r'[Delete remote branch]' \ - ':feature:__git_flow_feature_list' - ;; - - (publish) - _arguments \ - ':feature:__git_flow_feature_list'\ - ;; - - (track) - _arguments \ - ':feature:__git_flow_feature_list'\ - ;; - - (diff) - _arguments \ - ':branch:__git_branch_names'\ - ;; - - (rebase) - _arguments \ - -i'[Do an interactive rebase]' \ - ':branch:__git_branch_names' - ;; - - (checkout) - _arguments \ - ':branch:__git_flow_feature_list'\ - ;; - - (pull) - _arguments \ - ':remote:__git_remotes'\ - ':branch:__git_branch_names' - ;; - - *) - _arguments \ - -v'[Verbose (more) output]' - ;; - esac - ;; - esac + 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 feature branch.' + 'finish:Finish a feature branch.' + 'delete:Delete a feature branch.' + 'list:List all your feature branches. (Alias to `git flow feature`)' + 'publish:Publish feature branch to remote.' + 'track:Checkout remote feature branch.' + 'diff:Show all changes.' + 'rebase:Rebase from integration branch.' + 'checkout:Checkout local feature branch.' + 'pull:Pull changes from remote.' + 'rename:Rename a feature branch.' + ) + _describe -t commands 'git flow feature' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':feature:__git_flow_feature_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -r'[Rebase instead of merge]'\ + ':feature:__git_flow_feature_list' + ;; + + (delete) + _arguments \ + -f'[Force deletion]' \ + -r'[Delete remote branch]' \ + ':feature:__git_flow_feature_list' + ;; + + (publish) + _arguments \ + ':feature:__git_flow_feature_list'\ + ;; + + (track) + _arguments \ + ':feature:__git_flow_feature_list'\ + ;; + + (diff) + _arguments \ + ':branch:__git_branch_names'\ + ;; + + (rebase) + _arguments \ + -i'[Do an interactive rebase]' \ + ':branch:__git_branch_names' + ;; + + (checkout) + _arguments \ + ':branch:__git_flow_feature_list'\ + ;; + + (pull) + _arguments \ + ':remote:__git_remotes'\ + ':branch:__git_branch_names' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + 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 () { - local curcontext="$curcontext" state line - typeset -A opt_args - - _arguments -C \ - ':command:->command' \ - '*::options:->options' - - case $state in - (command) - - local -a subcommands - subcommands=( - 'list:List the configuration. (Alias to `git flow config`)' - 'set:Set the configuration option' - ) - _describe -t commands 'git flow config' subcommands - ;; - - (options) - case $line[1] in - - (set) - _arguments \ - --local'[Use repository config file]' \ - --global'[Use global config file]'\ - --system'[Use system config file]'\ - --file'[Use given config file]'\ - ':option:(master develop feature hotfix release support versiontagprefix)' - ;; - - *) - _arguments \ - --local'[Use repository config file]' \ - --global'[Use global config file]'\ - --system'[Use system config file]'\ - --file'[Use given config file]' - ;; - esac - ;; - esac + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'list:List the configuration. (Alias to `git flow config`)' + 'set:Set the configuration option' + ) + _describe -t commands 'git flow config' subcommands + ;; + + (options) + case $line[1] in + + (set) + _arguments \ + --local'[Use repository config file]' \ + --global'[Use global config file]'\ + --system'[Use system config file]'\ + --file'[Use given config file]'\ + ':option:(master develop feature hotfix release support versiontagprefix)' + ;; + + *) + _arguments \ + --local'[Use repository config file]' \ + --global'[Use global config file]'\ + --system'[Use system config file]'\ + --file'[Use given config file]' + ;; + esac + ;; + esac } __git_flow_version_list () { - local expl - declare -a versions + local expl + declare -a versions - versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}}) - __git_command_successful || return + versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return - _wanted versions expl 'version' compadd $versions + _wanted versions expl 'version' compadd $versions } __git_flow_feature_list () { - local expl - declare -a features + local expl + 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 ' |*')"}}) - __git_command_successful || return + bugfixes=(${${(f)"$(_call_program bugfixes git flow bugfix list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return - _wanted features expl 'feature' compadd $features + _wanted bugfixes expl 'bugfix' compadd $bugfixes } __git_remotes () { - local expl gitdir remotes + local expl gitdir remotes - gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) - __git_command_successful || return + gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) + __git_command_successful || return - remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]}) - __git_command_successful || return + remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]}) + __git_command_successful || return - # TODO: Should combine the two instead of either or. - if (( $#remotes > 0 )); then - _wanted remotes expl remote compadd $* - $remotes - else - _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*" - fi + # TODO: Should combine the two instead of either or. + if (( $#remotes > 0 )); then + _wanted remotes expl remote compadd $* - $remotes + else + _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*" + fi } __git_flow_hotfix_list () { - local expl - declare -a hotfixes + local expl + declare -a hotfixes - hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}}) - __git_command_successful || return + hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return - _wanted hotfixes expl 'hotfix' compadd $hotfixes + _wanted hotfixes expl 'hotfix' compadd $hotfixes } __git_branch_names () { - local expl - declare -a branch_names + local expl + declare -a branch_names - branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) - __git_command_successful || return + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) + __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 () { - if (( ${#pipestatus:#0} > 0 )); then - _message 'not a git repository' - return 1 - fi - return 0 + if (( ${#pipestatus:#0} > 0 )); then + _message 'not a git repository' + return 1 + fi + return 0 } zstyle ':completion:*:*:git:*' user-commands flow:'provide high-level repository operations' diff --git a/plugins/git-flow/README.md b/plugins/git-flow/README.md index f37f418db..5d8049e3b 100644 --- a/plugins/git-flow/README.md +++ b/plugins/git-flow/README.md @@ -10,22 +10,23 @@ plugins=(... git-flow) ## Aliases -More information about `git-flow` commands: +More information about `git-flow` commands: https://github.com/nvie/gitflow/wiki/Command-Line-Arguments -| Alias | Command | Description | -|---------|---------------------------|----------------------------------------| -| `gfl` | `git flow` | Git-Flow command | -| `gfli` | `git flow init` | Initialize git-flow repository | -| `gcd` | `git checkout develop` | Check out develop branch | -| `gch` | `git checkout hotfix` | Check out hotfix branch | -| `gcr` | `git checkout release` | Check out release branch | -| `gflf` | `git flow feature` | List existing feature branches | -| `gflh` | `git flow hotfix` | List existing hotfix branches | -| `gflr` | `git flow release` | List existing release branches | -| `gflfs` | `git flow feature start` | Start a new feature: `gflfs <name>` | -| `gflhs` | `git flow hotfix start` | Start a new hotfix: `gflhs <version>` | -| `gflrs` | `git flow release start` | Start a new release: `gflrs <version>` | -| `gflff` | `git flow feature finish` | Finish feature: `gflff <name>` | -| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` | -| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` | +| Alias | Command | Description | +|---------|----------------------------|----------------------------------------| +| `gfl` | `git flow` | Git-Flow command | +| `gfli` | `git flow init` | Initialize git-flow repository | +| `gcd` | `git checkout develop` | Check out develop branch | +| `gch` | `git checkout hotfix` | Check out hotfix branch | +| `gcr` | `git checkout release` | Check out release branch | +| `gflf` | `git flow feature` | List existing feature branches | +| `gflh` | `git flow hotfix` | List existing hotfix branches | +| `gflr` | `git flow release` | List existing release branches | +| `gflfs` | `git flow feature start` | Start a new feature: `gflfs <name>` | +| `gflhs` | `git flow hotfix start` | Start a new hotfix: `gflhs <version>` | +| `gflrs` | `git flow release start` | Start a new release: `gflrs <version>` | +| `gflff` | `git flow feature finish` | Finish feature: `gflff <name>` | +| `gflfp` | `git flow feature publish` | Publish feature: `gflfp <name>` | +| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` | +| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` | diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh index 5f5e4aa73..eab969d8a 100644 --- a/plugins/git-flow/git-flow.plugin.zsh +++ b/plugins/git-flow/git-flow.plugin.zsh @@ -33,6 +33,7 @@ alias gflfs='git flow feature start' alias gflhs='git flow hotfix start' alias gflrs='git flow release start' alias gflff='git flow feature finish' +alias gflfp='git flow feature publish' alias gflhf='git flow hotfix finish' alias gflrf='git flow release finish' alias gflfp='git flow feature publish' diff --git a/plugins/git-hubflow/README.md b/plugins/git-hubflow/README.md new file mode 100644 index 000000000..dada60d78 --- /dev/null +++ b/plugins/git-hubflow/README.md @@ -0,0 +1,24 @@ +# 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 | diff --git a/plugins/git-hubflow/git-hubflow.plugin.zsh b/plugins/git-hubflow/git-hubflow.plugin.zsh index b0157c7a1..50d7b23ce 100644 --- a/plugins/git-hubflow/git-hubflow.plugin.zsh +++ b/plugins/git-hubflow/git-hubflow.plugin.zsh @@ -1,25 +1,3 @@ -#!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 ghff='git hf feature' alias ghfr='git hf release' @@ -97,8 +75,8 @@ __git-hf-release () 'finish:Finish a release branch.' 'list:List all your release branches. (Alias to `git hf release`)' 'cancel:Cancel release' - 'push:Push release to github' - 'pull:Pull release from github' + 'push:Push release to GitHub' + 'pull:Pull release from GitHub' 'track:Track release' ) _describe -t commands 'git hf release' subcommands @@ -155,8 +133,8 @@ __git-hf-hotfix () 'list:List all your hotfix branches. (Alias to `git hf hotfix`)' 'publish:Publish the hotfix branch.' 'track:Track the hotfix branch.' - 'pull:Pull the hotfix from github.' - 'push:Push the hotfix to github.' + 'pull:Pull the hotfix from GitHub.' + 'push:Push the hotfix to GitHub.' 'cancel:Cancel the hotfix.' ) _describe -t commands 'git hf hotfix' subcommands @@ -217,8 +195,8 @@ __git-hf-feature () 'diff:Diff' 'rebase:Rebase feature branch against develop' 'checkout:Checkout feature' - 'pull:Pull feature branch from github' - 'push:Push feature branch to github' + 'pull:Pull feature branch from GitHub' + 'push:Push feature branch to GitHub' 'cancel:Cancel feature' ) _describe -t commands 'git hf feature' subcommands diff --git a/plugins/git-prompt/README.md b/plugins/git-prompt/README.md new file mode 100644 index 000000000..e3b2d623a --- /dev/null +++ b/plugins/git-prompt/README.md @@ -0,0 +1,61 @@ +# git-prompt plugin + +A `zsh` prompt that displays information about the current git repository. In particular: +the branch name, difference with remote branch, number of files staged or changed, etc. + +To use it, add `git-prompt` to the plugins array in your zshrc file: + +```zsh +plugins=(... git-prompt) +``` + +See the [original repository](https://github.com/olivierverdier/zsh-git-prompt). + +## Examples + +The prompt may look like the following: + +- `(master↑3|✚1)`: on branch `master`, ahead of remote by 3 commits, 1 file changed but not staged +- `(status|●2)`: on branch `status`, 2 files staged +- `(master|✚7…)`: on branch `master`, 7 files changed, some files untracked +- `(master|✖2✚3)`: on branch `master`, 2 conflicts, 3 files changed +- `(experimental↓2↑3|✔)`: on branch `experimental`; your branch has diverged by 3 commits, remote by 2 commits; the repository is otherwise clean +- `(:70c2952|✔)`: not on any branch; parent commit has hash `70c2952`; the repository is otherwise clean + +## Prompt Structure + +By default, the general appearance of the prompt is: + +``` +(<branch><branch tracking>|<local status>) +``` + +The symbols are as follows: + +### Local Status Symbols + +| Symbol | Meaning | +|--------|--------------------------------| +| ✔ | repository clean | +| ●n | there are `n` staged files | +| ✖n | there are `n` unmerged files | +| ✚n | there are `n` unstaged files | +| … | there are some untracked files | + +### Branch Tracking Symbols + +| Symbol | Meaning | +|--------|---------------------------------------------------------------| +| ↑n | ahead of remote by `n` commits | +| ↓n | behind remote by `n` commits | +| ↓m↑n | branches diverged: other by `m` commits, yours by `n` commits | + +## Customisation + +- Set the variable `ZSH_THEME_GIT_PROMPT_CACHE` to any value in order to enable caching. +- You may also change a number of variables (whose name start with `ZSH_THEME_GIT_PROMPT_`) + to change the appearance of the prompt. Take a look at the bottom of the [plugin file](git-prompt.plugin.zsh)` + to see what variables are available. + + +**Enjoy!** diff --git a/plugins/git-prompt/git-prompt.plugin.zsh b/plugins/git-prompt/git-prompt.plugin.zsh index 5175bf70f..76ac2e62b 100644 --- a/plugins/git-prompt/git-prompt.plugin.zsh +++ b/plugins/git-prompt/git-prompt.plugin.zsh @@ -1,6 +1,3 @@ -# ZSH Git Prompt Plugin from: -# http://github.com/olivierverdier/zsh-git-prompt - __GIT_PROMPT_DIR="${0:A:h}" ## Hook function definitions diff --git a/plugins/git-prompt/gitstatus.py b/plugins/git-prompt/gitstatus.py index a8eb8284b..390a50a6f 100644 --- a/plugins/git-prompt/gitstatus.py +++ b/plugins/git-prompt/gitstatus.py @@ -1,6 +1,7 @@ #!/usr/bin/env python from __future__ import print_function +import os import sys import re import shlex @@ -22,7 +23,7 @@ def get_tagname_or_hash(): tagname = 'tags/' + output[m.start()+len('tag: '): m.end()-1] if tagname: - return tagname + return tagname.replace(' ', '') elif hash_: return hash_ return None @@ -30,7 +31,7 @@ def get_tagname_or_hash(): # `git status --porcelain --branch` can collect all information # branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind -po = Popen(['git', 'status', '--porcelain', '--branch'], stdout=PIPE, stderr=PIPE) +po = Popen(['git', 'status', '--porcelain', '--branch'], env=dict(os.environ, LANG="C"), stdout=PIPE, stderr=PIPE) stdout, sterr = po.communicate() if po.returncode != 0: sys.exit(0) # Not a git repository @@ -41,7 +42,7 @@ ahead, behind = 0, 0 status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()] for st in status: 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] elif re.search('no branch', st[2]): # detached status branch = get_tagname_or_hash() diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index fa0c06500..b82d49b5e 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -44,12 +44,14 @@ alias ga='git add' alias gaa='git add --all' alias gapa='git add --patch' alias gau='git add --update' +alias gav='git add --verbose' alias gap='git apply' alias gb='git branch' alias gba='git branch -a' alias gbd='git branch -d' alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d' +alias gbD='git branch -D' alias gbl='git blame -b -w' alias gbnm='git branch --no-merged' alias gbr='git branch --remote' @@ -70,8 +72,8 @@ alias gcam='git commit -a -m' alias gcsm='git commit -s -m' alias gcb='git checkout -b' alias gcf='git config --list' -alias gcl='git clone --recursive' -alias gclean='git clean -fd' +alias gcl='git clone --recurse-submodules' +alias gclean='git clean -id' alias gpristine='git reset --hard && git clean -dfx' alias gcm='git checkout master' alias gcd='git checkout develop' @@ -88,6 +90,7 @@ alias gd='git diff' alias gdca='git diff --cached' alias gdcw='git diff --cached --word-diff' 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 gdw='git diff --word-diff' @@ -109,8 +112,8 @@ ggf() { git push --force origin "${b:=$1}" } ggfl() { -[[ "$#" != 1 ]] && local b="$(git_current_branch)" -git push --force-with-lease origin "${b:=$1}" + [[ "$#" != 1 ]] && local b="$(git_current_branch)" + git push --force-with-lease origin "${b:=$1}" } compdef _git ggf=git-checkout @@ -152,10 +155,10 @@ compdef _git ggu=git-checkout alias ggpur='ggu' compdef _git ggpur=git-checkout -alias ggpull='git pull origin $(git_current_branch)' +alias ggpull='git pull origin "$(git_current_branch)"' compdef _git ggpull=git-checkout -alias ggpush='git push origin $(git_current_branch)' +alias ggpush='git push origin "$(git_current_branch)"' compdef _git ggpush=git-checkout alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' @@ -180,8 +183,11 @@ alias glgg='git log --graph' alias glgga='git log --graph --decorate --all' alias glgm='git log --graph --max-count=10' 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 glola="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all" +alias glol="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'" +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 gloga='git log --oneline --decorate --graph --all' alias glp="_git_log_prettily" @@ -196,6 +202,8 @@ alias gma='git merge --abort' alias gp='git push' 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' compdef _git gpoat=git-push alias gpu='git push upstream' @@ -206,43 +214,58 @@ alias gra='git remote add' alias grb='git rebase' alias grba='git rebase --abort' alias grbc='git rebase --continue' +alias grbd='git rebase develop' alias grbi='git rebase -i' alias grbm='git rebase master' alias grbs='git rebase --skip' -alias grh='git reset HEAD' -alias grhh='git reset HEAD --hard' +alias grh='git reset' +alias grhh='git reset --hard' +alias groh='git reset origin/$(git_current_branch) --hard' +alias grm='git rm' +alias grmc='git rm --cached' alias grmv='git remote rename' alias grrm='git remote remove' alias grset='git remote set-url' -alias grt='cd $(git rev-parse --show-toplevel || echo ".")' +alias grt='cd "$(git rev-parse --show-toplevel || echo .)"' alias gru='git reset --' alias grup='git remote update' alias grv='git remote -v' alias gsb='git status -sb' alias gsd='git svn dcommit' +alias gsh='git show' alias gsi='git submodule init' alias gsps='git show --pretty=short --show-signature' alias gsr='git svn rebase' alias gss='git status -s' alias gst='git status' -alias gsta='git stash save' + +# use the default stash push on git 2.13 and newer +autoload -Uz is-at-least +is-at-least 2.13 "$(git --version 2>/dev/null | awk '{print $3}')" \ + && alias gsta='git stash push' \ + || alias gsta='git stash save' + alias gstaa='git stash apply' alias gstc='git stash clear' alias gstd='git stash drop' alias gstl='git stash list' alias gstp='git stash pop' alias gsts='git stash show --text' +alias gstall='git stash --all' alias gsu='git submodule update' alias gts='git tag -s' alias gtv='git tag | sort -V' +alias gtl='gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl' alias gunignore='git update-index --no-assume-unchanged' alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' alias gup='git pull --rebase' 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 gwch='git whatchanged -p --abbrev-commit --pretty=medium' -alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip-- [skip ci]"' +alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"' diff --git a/plugins/gitfast/README.md b/plugins/gitfast/README.md new file mode 100644 index 000000000..84e35d77c --- /dev/null +++ b/plugins/gitfast/README.md @@ -0,0 +1,15 @@ +# 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 + +An earlier version of the plugin also loaded the git plugin. If you want to keep those +aliases enable the [git plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/git) +as well. diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git index 6d1b4ecc7..78a6dbb3d 100644 --- a/plugins/gitfast/_git +++ b/plugins/gitfast/_git @@ -9,7 +9,7 @@ # # If your script is somewhere else, you can configure it on your ~/.zshrc: # -# zstyle ':completion:*:*:git:*' script ~/.git-completion.sh +# zstyle ':completion:*:*:git:*' script ~/.git-completion.zsh # # The recommended way to install this script is to copy to '~/.zsh/_git', and # then add the following to your ~/.zshrc file: @@ -67,6 +67,15 @@ __gitcomp () esac } +__gitcomp_direct () +{ + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -Q -- ${=1} && _ret=0 +} + __gitcomp_nl () { emulate -L zsh diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash index 8ce6b5c5f..d93441747 100644 --- a/plugins/gitfast/git-completion.bash +++ b/plugins/gitfast/git-completion.bash @@ -28,27 +28,55 @@ # completion style. For example '!f() { : git commit ; ... }; f' will # tell the completion to use commit completion. This also works with aliases # of form "!sh -c '...'". For example, "!sh -c ': git commit ; ... '". +# +# You can set the following environment variables to influence the behavior of +# the completion routines: +# +# GIT_COMPLETION_CHECKOUT_NO_GUESS +# +# When set to "1", do not include "DWIM" suggestions in git-checkout +# completion (e.g., completing "foo" when "origin/foo" exists). case "$COMP_WORDBREAKS" in *:*) : great ;; *) COMP_WORDBREAKS="$COMP_WORDBREAKS:" esac +# Discovers the path to the git repository taking any '--git-dir=<path>' and +# '-C <path>' options into account and stores it in the $__git_repo_path +# variable. +__git_find_repo_path () +{ + if [ -n "$__git_repo_path" ]; then + # we already know where it is + return + fi + + if [ -n "${__git_C_args-}" ]; then + __git_repo_path="$(git "${__git_C_args[@]}" \ + ${__git_dir:+--git-dir="$__git_dir"} \ + rev-parse --absolute-git-dir 2>/dev/null)" + elif [ -n "${__git_dir-}" ]; then + test -d "$__git_dir" && + __git_repo_path="$__git_dir" + elif [ -n "${GIT_DIR-}" ]; then + test -d "${GIT_DIR-}" && + __git_repo_path="$GIT_DIR" + elif [ -d .git ]; then + __git_repo_path=.git + else + __git_repo_path="$(git rev-parse --git-dir 2>/dev/null)" + fi +} + +# Deprecated: use __git_find_repo_path() and $__git_repo_path instead # __gitdir accepts 0 or 1 arguments (i.e., location) # returns location of .git repo __gitdir () { if [ -z "${1-}" ]; then - if [ -n "${__git_dir-}" ]; then - echo "$__git_dir" - elif [ -n "${GIT_DIR-}" ]; then - test -d "${GIT_DIR-}" || return 1 - echo "$GIT_DIR" - elif [ -d .git ]; then - echo .git - else - git rev-parse --git-dir 2>/dev/null - fi + __git_find_repo_path || return 1 + echo "$__git_repo_path" elif [ -d "$1/.git" ]; then echo "$1/.git" else @@ -56,6 +84,14 @@ __gitdir () fi } +# Runs git with all the options given as argument, respecting any +# '--git-dir=<path>' and '-C <path>' options present on the command line +__git () +{ + git ${__git_C_args:+"${__git_C_args[@]}"} \ + ${__git_dir:+--git-dir="$__git_dir"} "$@" 2>/dev/null +} + # The following function is based on code from: # # bash_completion - programmable completion functions for bash 3.2+ @@ -185,6 +221,20 @@ _get_comp_words_by_ref () } fi +# Fills the COMPREPLY array with prefiltered words without any additional +# processing. +# Callers must take care of providing only words that match the current word +# to be completed and adding any prefix and/or suffix (trailing space!), if +# necessary. +# 1: List of newline-separated matching completion words, complete with +# prefix and suffix. +__gitcomp_direct () +{ + local IFS=$'\n' + + COMPREPLY=($1) +} + __gitcompappend () { local x i=${#COMPREPLY[@]} @@ -283,11 +333,11 @@ __gitcomp_file () __git_ls_files_helper () { if [ "$2" == "--committable" ]; then - git -C "$1" diff-index --name-only --relative HEAD + __git -C "$1" diff-index --name-only --relative HEAD else # NOTE: $2 is not quoted in order to support multiple options - git -C "$1" ls-files --exclude-standard $2 - fi 2>/dev/null + __git -C "$1" ls-files --exclude-standard $2 + fi } @@ -299,99 +349,195 @@ __git_ls_files_helper () # slash. __git_index_files () { - local dir="$(__gitdir)" root="${2-.}" file + local root="${2-.}" file - if [ -d "$dir" ]; then - __git_ls_files_helper "$root" "$1" | - while read -r file; do - case "$file" in - ?*/*) echo "${file%%/*}" ;; - *) echo "$file" ;; - esac - done | sort | uniq - fi + __git_ls_files_helper "$root" "$1" | + while read -r file; do + case "$file" in + ?*/*) echo "${file%%/*}" ;; + *) echo "$file" ;; + esac + done | sort | uniq } +# Lists branches from the local repository. +# 1: A prefix to be added to each listed branch (optional). +# 2: List only branches matching this word (optional; list all branches if +# unset or empty). +# 3: A suffix to be appended to each listed branch (optional). __git_heads () { - local dir="$(__gitdir)" - if [ -d "$dir" ]; then - git --git-dir="$dir" for-each-ref --format='%(refname:short)' \ - refs/heads - return - fi + local pfx="${1-}" cur_="${2-}" sfx="${3-}" + + __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ + "refs/heads/$cur_*" "refs/heads/$cur_*/**" } +# Lists tags from the local repository. +# Accepts the same positional parameters as __git_heads() above. __git_tags () { - local dir="$(__gitdir)" - if [ -d "$dir" ]; then - git --git-dir="$dir" for-each-ref --format='%(refname:short)' \ - refs/tags - return - fi + local pfx="${1-}" cur_="${2-}" sfx="${3-}" + + __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ + "refs/tags/$cur_*" "refs/tags/$cur_*/**" } -# __git_refs accepts 0, 1 (to pass to __gitdir), or 2 arguments -# presence of 2nd argument means use the guess heuristic employed -# by checkout for tracking branches +# Lists refs from the local (by default) or from a remote repository. +# It accepts 0, 1 or 2 arguments: +# 1: The remote to list refs from (optional; ignored, if set but empty). +# Can be the name of a configured remote, a path, or a URL. +# 2: In addition to local refs, list unique branches from refs/remotes/ for +# 'git checkout's tracking DWIMery (optional; ignored, if set but empty). +# 3: A prefix to be added to each listed ref (optional). +# 4: List only refs matching this word (optional; list all refs if unset or +# empty). +# 5: A suffix to be appended to each listed ref (optional; ignored, if set +# but empty). +# +# Use __git_complete_refs() instead. __git_refs () { - local i hash dir="$(__gitdir "${1-}")" track="${2-}" + local i hash dir track="${2-}" + local list_refs_from=path remote="${1-}" local format refs - if [ -d "$dir" ]; then - case "$cur" in + local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}" + local match="${4-}" + local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers + + __git_find_repo_path + dir="$__git_repo_path" + + if [ -z "$remote" ]; then + if [ -z "$dir" ]; then + return + fi + else + if __git_is_configured_remote "$remote"; then + # configured remote takes precedence over a + # local directory with the same name + list_refs_from=remote + elif [ -d "$remote/.git" ]; then + dir="$remote/.git" + elif [ -d "$remote" ]; then + dir="$remote" + else + list_refs_from=url + fi + fi + + if [ "$list_refs_from" = path ]; then + if [[ "$cur_" == ^* ]]; then + pfx="$pfx^" + fer_pfx="$fer_pfx^" + cur_=${cur_#^} + match=${match#^} + fi + case "$cur_" in refs|refs/*) format="refname" - refs="${cur%/*}" + refs=("$match*" "$match*/**") track="" ;; *) for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do - if [ -e "$dir/$i" ]; then echo $i; fi + case "$i" in + $match*) + if [ -e "$dir/$i" ]; then + echo "$pfx$i$sfx" + fi + ;; + esac done - format="refname:short" - refs="refs/tags refs/heads refs/remotes" + format="refname:strip=2" + refs=("refs/tags/$match*" "refs/tags/$match*/**" + "refs/heads/$match*" "refs/heads/$match*/**" + "refs/remotes/$match*" "refs/remotes/$match*/**") ;; esac - git --git-dir="$dir" for-each-ref --format="%($format)" \ - $refs + __git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" \ + "${refs[@]}" if [ -n "$track" ]; then # employ the heuristic used by git checkout # Try to find a remote branch that matches the completion word # but only output if the branch name is unique - local ref entry - git --git-dir="$dir" for-each-ref --shell --format="ref=%(refname:short)" \ - "refs/remotes/" | \ - while read -r entry; do - eval "$entry" - ref="${ref#*/}" - if [[ "$ref" == "$cur"* ]]; then - echo "$ref" - fi - done | sort | uniq -u + __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \ + --sort="refname:strip=3" \ + "refs/remotes/*/$match*" "refs/remotes/*/$match*/**" | \ + uniq -u fi return fi - case "$cur" in + case "$cur_" in refs|refs/*) - git ls-remote "$dir" "$cur*" 2>/dev/null | \ + __git ls-remote "$remote" "$match*" | \ while read -r hash i; do case "$i" in *^{}) ;; - *) echo "$i" ;; + *) echo "$pfx$i$sfx" ;; esac done ;; *) - echo "HEAD" - git for-each-ref --format="%(refname:short)" -- \ - "refs/remotes/$dir/" 2>/dev/null | sed -e "s#^$dir/##" + if [ "$list_refs_from" = remote ]; then + case "HEAD" in + $match*) echo "${pfx}HEAD$sfx" ;; + esac + __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \ + "refs/remotes/$remote/$match*" \ + "refs/remotes/$remote/$match*/**" + else + local query_symref + case "HEAD" in + $match*) query_symref="HEAD" ;; + esac + __git ls-remote "$remote" $query_symref \ + "refs/tags/$match*" "refs/heads/$match*" \ + "refs/remotes/$match*" | + while read -r hash i; do + case "$i" in + *^{}) ;; + refs/*) echo "$pfx${i#refs/*/}$sfx" ;; + *) echo "$pfx$i$sfx" ;; # symbolic refs + esac + done + fi ;; esac } +# Completes refs, short and long, local and remote, symbolic and pseudo. +# +# Usage: __git_complete_refs [<option>]... +# --remote=<remote>: The remote to list refs from, can be the name of a +# configured remote, a path, or a URL. +# --track: List unique remote branches for 'git checkout's tracking DWIMery. +# --pfx=<prefix>: A prefix to be added to each ref. +# --cur=<word>: The current ref to be completed. Defaults to the current +# word to be completed. +# --sfx=<suffix>: A suffix to be appended to each ref instead of the default +# space. +__git_complete_refs () +{ + local remote track pfx cur_="$cur" sfx=" " + + while test $# != 0; do + case "$1" in + --remote=*) remote="${1##--remote=}" ;; + --track) track="yes" ;; + --pfx=*) pfx="${1##--pfx=}" ;; + --cur=*) cur_="${1##--cur=}" ;; + --sfx=*) sfx="${1##--sfx=}" ;; + *) return 1 ;; + esac + shift + done + + __gitcomp_direct "$(__git_refs "$remote" "$track" "$pfx" "$cur_" "$sfx")" +} + # __git_refs2 requires 1 argument (to pass to __git_refs) +# Deprecated: use __git_complete_fetch_refspecs() instead. __git_refs2 () { local i @@ -400,11 +546,29 @@ __git_refs2 () done } +# Completes refspecs for fetching from a remote repository. +# 1: The remote repository. +# 2: A prefix to be added to each listed refspec (optional). +# 3: The ref to be completed as a refspec instead of the current word to be +# completed (optional) +# 4: A suffix to be appended to each listed refspec instead of the default +# space (optional). +__git_complete_fetch_refspecs () +{ + local i remote="$1" pfx="${2-}" cur_="${3-$cur}" sfx="${4- }" + + __gitcomp_direct "$( + for i in $(__git_refs "$remote" "" "" "$cur_") ; do + echo "$pfx$i:$i$sfx" + done + )" +} + # __git_refs_remotes requires 1 argument (to pass to ls-remote) __git_refs_remotes () { local i hash - git ls-remote "$1" 'refs/heads/*' 2>/dev/null | \ + __git ls-remote "$1" 'refs/heads/*' | \ while read -r hash i; do echo "$i:refs/remotes/$1/${i#refs/heads/}" done @@ -412,9 +576,21 @@ __git_refs_remotes () __git_remotes () { - local d="$(__gitdir)" - test -d "$d/remotes" && ls -1 "$d/remotes" - git --git-dir="$d" remote + __git_find_repo_path + test -d "$__git_repo_path/remotes" && ls -1 "$__git_repo_path/remotes" + __git remote +} + +# Returns true if $1 matches the name of a configured remote, false otherwise. +__git_is_configured_remote () +{ + local remote + for remote in $(__git_remotes); do + if [ "$remote" = "$1" ]; then + return 0 + fi + done + return 1 } __git_list_merge_strategies () @@ -468,7 +644,7 @@ __git_complete_revlist_file () *) pfx="$ref:$pfx" ;; esac - __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" 2>/dev/null \ + __gitcomp_nl "$(__git ls-tree "$ls" \ | sed '/^100... blob /{ s,^.* ,, s,$, , @@ -487,15 +663,15 @@ __git_complete_revlist_file () *...*) pfx="${cur_%...*}..." cur_="${cur_#*...}" - __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" + __git_complete_refs --pfx="$pfx" --cur="$cur_" ;; *..*) pfx="${cur_%..*}.." cur_="${cur_#*..}" - __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" + __git_complete_refs --pfx="$pfx" --cur="$cur_" ;; *) - __gitcomp_nl "$(__git_refs)" + __git_complete_refs ;; esac } @@ -541,6 +717,7 @@ __git_complete_remote_or_refspec () i="${words[c]}" case "$i" in --mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;; + -d|--delete) [ "$cmd" = "push" ] && lhs=0 ;; --all) case "$cmd" in push) no_complete_refspec=1 ;; @@ -580,23 +757,23 @@ __git_complete_remote_or_refspec () case "$cmd" in fetch) if [ $lhs = 1 ]; then - __gitcomp_nl "$(__git_refs2 "$remote")" "$pfx" "$cur_" + __git_complete_fetch_refspecs "$remote" "$pfx" "$cur_" else - __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" + __git_complete_refs --pfx="$pfx" --cur="$cur_" fi ;; pull|remote) if [ $lhs = 1 ]; then - __gitcomp_nl "$(__git_refs "$remote")" "$pfx" "$cur_" + __git_complete_refs --remote="$remote" --pfx="$pfx" --cur="$cur_" else - __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" + __git_complete_refs --pfx="$pfx" --cur="$cur_" fi ;; push) if [ $lhs = 1 ]; then - __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" + __git_complete_refs --pfx="$pfx" --cur="$cur_" else - __gitcomp_nl "$(__git_refs "$remote")" "$pfx" "$cur_" + __git_complete_refs --remote="$remote" --pfx="$pfx" --cur="$cur_" fi ;; esac @@ -746,7 +923,7 @@ __git_compute_porcelain_commands () __git_get_config_variables () { local section="$1" i IFS=$'\n' - for i in $(git --git-dir="$(__gitdir)" config --name-only --get-regexp "^$section\..*" 2>/dev/null); do + for i in $(__git config --name-only --get-regexp "^$section\..*"); do echo "${i#$section.}" done } @@ -764,8 +941,7 @@ __git_aliases () # __git_aliased_command requires 1 argument __git_aliased_command () { - local word cmdline=$(git --git-dir="$(__gitdir)" \ - config --get "alias.$1") + local word cmdline=$(__git config --get "alias.$1") for word in $cmdline; do case "$word" in \!gitk|gitk) @@ -803,6 +979,50 @@ __git_find_on_cmdline () done } +# Echo the value of an option set on the command line or config +# +# $1: short option name +# $2: long option name including = +# $3: list of possible values +# $4: config string (optional) +# +# example: +# result="$(__git_get_option_value "-d" "--do-something=" \ +# "yes no" "core.doSomething")" +# +# result is then either empty (no option set) or "yes" or "no" +# +# __git_get_option_value requires 3 arguments +__git_get_option_value () +{ + local c short_opt long_opt val + local result= values config_key word + + short_opt="$1" + long_opt="$2" + values="$3" + config_key="$4" + + ((c = $cword - 1)) + while [ $c -ge 0 ]; do + word="${words[c]}" + for val in $values; do + if [ "$short_opt$val" = "$word" ] || + [ "$long_opt$val" = "$word" ]; then + result="$val" + break 2 + fi + done + ((c--)) + done + + if [ -n "$config_key" ] && [ -z "$result" ]; then + result="$(__git config "$config_key")" + fi + + echo "$result" +} + __git_has_doubledash () { local c=1 @@ -856,8 +1076,8 @@ __git_whitespacelist="nowarn warn error error-all fix" _git_am () { - local dir="$(__gitdir)" - if [ -d "$dir"/rebase-apply ]; then + __git_find_repo_path + if [ -d "$__git_repo_path"/rebase-apply ]; then __gitcomp "--skip --continue --resolved --abort" return fi @@ -891,6 +1111,7 @@ _git_apply () --apply --no-add --exclude= --ignore-whitespace --ignore-space-change --whitespace= --inaccurate-eof --verbose + --recount --directory= " return esac @@ -902,13 +1123,17 @@ _git_add () --*) __gitcomp " --interactive --refresh --patch --update --dry-run - --ignore-errors --intent-to-add + --ignore-errors --intent-to-add --force --edit --chmod= " return esac - # XXX should we check for --update and --all options ? - __git_complete_index_file "--others --modified --directory --no-empty-directory" + local complete_opt="--others --modified --directory --no-empty-directory" + if test -n "$(__git_find_on_cmdline "-u --update")" + then + complete_opt="--modified" + fi + __git_complete_index_file "$complete_opt" } _git_archive () @@ -925,7 +1150,7 @@ _git_archive () --*) __gitcomp " --format= --list --verbose - --prefix= --remote= --exec= + --prefix= --remote= --exec= --output " return ;; @@ -940,7 +1165,8 @@ _git_bisect () local subcommands="start bad good skip reset visualize replay log run" local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then - if [ -f "$(__gitdir)"/BISECT_START ]; then + __git_find_repo_path + if [ -f "$__git_repo_path"/BISECT_START ]; then __gitcomp "$subcommands" else __gitcomp "replay start" @@ -950,7 +1176,7 @@ _git_bisect () case "$subcommand" in bad|good|reset|skip|start) - __gitcomp_nl "$(__git_refs)" + __git_complete_refs ;; *) ;; @@ -964,29 +1190,30 @@ _git_branch () while [ $c -lt $cword ]; do i="${words[c]}" case "$i" in - -d|-m) only_local_ref="y" ;; - -r) has_r="y" ;; + -d|--delete|-m|--move) only_local_ref="y" ;; + -r|--remotes) has_r="y" ;; esac ((c++)) done case "$cur" in --set-upstream-to=*) - __gitcomp_nl "$(__git_refs)" "" "${cur##--set-upstream-to=}" + __git_complete_refs --cur="${cur##--set-upstream-to=}" ;; --*) __gitcomp " --color --no-color --verbose --abbrev= --no-abbrev - --track --no-track --contains --merged --no-merged + --track --no-track --contains --no-contains --merged --no-merged --set-upstream-to= --edit-description --list - --unset-upstream + --unset-upstream --delete --move --remotes + --column --no-column --sort= --points-at " ;; *) if [ $only_local_ref = "y" -a $has_r = "n" ]; then - __gitcomp_nl "$(__git_heads)" + __gitcomp_direct "$(__git_heads "" "$cur" " ")" else - __gitcomp_nl "$(__git_refs)" + __git_complete_refs fi ;; esac @@ -1029,24 +1256,25 @@ _git_checkout () *) # check if --track, --no-track, or --no-guess was specified # if so, disable DWIM mode - local flags="--track --no-track --no-guess" track=1 - if [ -n "$(__git_find_on_cmdline "$flags")" ]; then - track='' + local flags="--track --no-track --no-guess" track_opt="--track" + if [ "$GIT_COMPLETION_CHECKOUT_NO_GUESS" = "1" ] || + [ -n "$(__git_find_on_cmdline "$flags")" ]; then + track_opt='' fi - __gitcomp_nl "$(__git_refs '' $track)" + __git_complete_refs $track_opt ;; esac } _git_cherry () { - __gitcomp_nl "$(__git_refs)" + __git_complete_refs } _git_cherry_pick () { - local dir="$(__gitdir)" - if [ -f "$dir"/CHERRY_PICK_HEAD ]; then + __git_find_repo_path + if [ -f "$__git_repo_path"/CHERRY_PICK_HEAD ]; then __gitcomp "--continue --quit --abort" return fi @@ -1055,7 +1283,7 @@ _git_cherry_pick () __gitcomp "--edit --no-commit --signoff --strategy= --mainline" ;; *) - __gitcomp_nl "$(__git_refs)" + __git_complete_refs ;; esac } @@ -1091,18 +1319,24 @@ _git_clone () --template= --depth --single-branch + --no-tags --branch + --recurse-submodules + --no-single-branch + --shallow-submodules " return ;; esac } +__git_untracked_file_modes="all no normal" + _git_commit () { case "$prev" in -c|-C) - __gitcomp_nl "$(__git_refs)" "" "${cur}" + __git_complete_refs return ;; esac @@ -1115,11 +1349,11 @@ _git_commit () ;; --reuse-message=*|--reedit-message=*|\ --fixup=*|--squash=*) - __gitcomp_nl "$(__git_refs)" "" "${cur#*=}" + __git_complete_refs --cur="${cur#*=}" return ;; --untracked-files=*) - __gitcomp "all no normal" "" "${cur##--untracked-files=}" + __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}" return ;; --*) @@ -1131,11 +1365,12 @@ _git_commit () --reset-author --file= --message= --template= --cleanup= --untracked-files --untracked-files= --verbose --quiet --fixup= --squash= + --patch --short --date --allow-empty " return esac - if git rev-parse --verify --quiet HEAD >/dev/null; then + if __git rev-parse --verify --quiet HEAD >/dev/null; then __git_complete_index_file "--committable" else # This is the first commit @@ -1149,15 +1384,18 @@ _git_describe () --*) __gitcomp " --all --tags --contains --abbrev= --candidates= - --exact-match --debug --long --match --always + --exact-match --debug --long --match --always --first-parent + --exclude " return esac - __gitcomp_nl "$(__git_refs)" + __git_complete_refs } __git_diff_algorithms="myers minimal patience histogram" +__git_diff_submodule_formats="diff log short" + __git_diff_common_options="--stat --numstat --shortstat --summary --patch-with-stat --name-only --name-status --color --no-color --color-words --no-renames --check @@ -1173,6 +1411,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --dirstat --dirstat= --dirstat-by-file --dirstat-by-file= --cumulative --diff-algorithm= + --submodule --submodule= " _git_diff () @@ -1184,6 +1423,10 @@ _git_diff () __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" return ;; + --submodule=*) + __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}" + return + ;; --*) __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex --base --ours --theirs --no-index @@ -1225,6 +1468,7 @@ __git_fetch_recurse_submodules="yes on-demand no" __git_fetch_options=" --quiet --verbose --append --upload-pack --force --keep --depth= --tags --no-tags --all --prune --dry-run --recurse-submodules= + --unshallow --update-shallow " _git_fetch () @@ -1274,7 +1518,7 @@ _git_fsck () --*) __gitcomp " --tags --root --unreachable --cache --no-reflogs --full - --strict --verbose --lost-found + --strict --verbose --lost-found --name-objects " return ;; @@ -1296,8 +1540,43 @@ _git_gitk () _gitk } -__git_match_ctag() { - awk "/^${1//\//\\/}/ { print \$1 }" "$2" +# Lists matching symbol names from a tag (as in ctags) file. +# 1: List symbol names matching this word. +# 2: The tag file to list symbol names from. +# 3: A prefix to be added to each listed symbol name (optional). +# 4: A suffix to be appended to each listed symbol name (optional). +__git_match_ctag () { + awk -v pfx="${3-}" -v sfx="${4-}" " + /^${1//\//\\/}/ { print pfx \$1 sfx } + " "$2" +} + +# Complete symbol names from a tag file. +# Usage: __git_complete_symbol [<option>]... +# --tags=<file>: The tag file to list symbol names from instead of the +# default "tags". +# --pfx=<prefix>: A prefix to be added to each symbol name. +# --cur=<word>: The current symbol name to be completed. Defaults to +# the current word to be completed. +# --sfx=<suffix>: A suffix to be appended to each symbol name instead +# of the default space. +__git_complete_symbol () { + local tags=tags pfx="" cur_="${cur-}" sfx=" " + + while test $# != 0; do + case "$1" in + --tags=*) tags="${1##--tags=}" ;; + --pfx=*) pfx="${1##--pfx=}" ;; + --cur=*) cur_="${1##--cur=}" ;; + --sfx=*) sfx="${1##--sfx=}" ;; + *) return 1 ;; + esac + shift + done + + if test -r "$tags"; then + __gitcomp_direct "$(__git_match_ctag "$cur_" "$tags" "$pfx" "$sfx")" + fi } _git_grep () @@ -1318,6 +1597,8 @@ _git_grep () --max-depth --count --and --or --not --all-match + --break --heading --show-function --function-context + --untracked --no-index " return ;; @@ -1325,29 +1606,26 @@ _git_grep () case "$cword,$prev" in 2,*|*,-*) - if test -r tags; then - __gitcomp_nl "$(__git_match_ctag "$cur" tags)" - return - fi + __git_complete_symbol && return ;; esac - __gitcomp_nl "$(__git_refs)" + __git_complete_refs } _git_help () { case "$cur" in --*) - __gitcomp "--all --info --man --web" + __gitcomp "--all --guides --info --man --web" return ;; esac __git_compute_all_commands __gitcomp "$__git_all_commands $(__git_aliases) attributes cli core-tutorial cvs-migration - diffcore gitk glossary hooks ignore modules - namespaces repository-layout tutorial tutorial-2 + diffcore everyday gitk glossary hooks ignore modules + namespaces repository-layout revisions tutorial tutorial-2 workflows " } @@ -1390,6 +1668,12 @@ _git_ls_files () _git_ls_remote () { + case "$cur" in + --*) + __gitcomp "--heads --tags --refs --get-url --symref" + return + ;; + esac __gitcomp_nl "$(__git_remotes)" } @@ -1427,12 +1711,25 @@ __git_log_date_formats="relative iso8601 rfc2822 short local default raw" _git_log () { __git_has_doubledash && return + __git_find_repo_path - local g="$(git rev-parse --git-dir 2>/dev/null)" local merge="" - if [ -f "$g/MERGE_HEAD" ]; then + if [ -f "$__git_repo_path/MERGE_HEAD" ]; then merge="--merge" fi + case "$prev,$cur" in + -L,:*:*) + return # fall back to Bash filename completion + ;; + -L,:*) + __git_complete_symbol --cur="${cur#:}" --sfx=":" + return + ;; + -G,*|-S,*) + __git_complete_symbol + return + ;; + esac case "$cur" in --pretty=*|--format=*) __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) @@ -1447,6 +1744,14 @@ _git_log () __gitcomp "full short no" "" "${cur##--decorate=}" return ;; + --diff-algorithm=*) + __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" + return + ;; + --submodule=*) + __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}" + return + ;; --*) __gitcomp " $__git_log_common_options @@ -1458,6 +1763,7 @@ _git_log () --relative-date --date= --pretty= --format= --oneline --show-signature + --cherry-mark --cherry-pick --graph --decorate --decorate= @@ -1469,6 +1775,21 @@ _git_log () " return ;; + -L:*:*) + return # fall back to Bash filename completion + ;; + -L:*) + __git_complete_symbol --cur="${cur#-L:}" --sfx=":" + return + ;; + -G*) + __git_complete_symbol --pfx="-G" --cur="${cur#-G}" + return + ;; + -S*) + __git_complete_symbol --pfx="-S" --cur="${cur#-S}" + return + ;; esac __git_complete_revlist } @@ -1488,10 +1809,10 @@ _git_merge () case "$cur" in --*) __gitcomp "$__git_merge_options - --rerere-autoupdate --no-rerere-autoupdate --abort" + --rerere-autoupdate --no-rerere-autoupdate --abort --continue" return esac - __gitcomp_nl "$(__git_refs)" + __git_complete_refs } _git_mergetool () @@ -1502,7 +1823,7 @@ _git_mergetool () return ;; --*) - __gitcomp "--tool=" + __gitcomp "--tool= --prompt --no-prompt" return ;; esac @@ -1516,7 +1837,7 @@ _git_merge_base () return ;; esac - __gitcomp_nl "$(__git_refs)" + __git_complete_refs } _git_mv () @@ -1554,7 +1875,7 @@ _git_notes () ,*) case "$prev" in --ref) - __gitcomp_nl "$(__git_refs)" + __git_complete_refs ;; *) __gitcomp "$subcommands --ref" @@ -1563,7 +1884,7 @@ _git_notes () ;; add,--reuse-message=*|append,--reuse-message=*|\ add,--reedit-message=*|append,--reedit-message=*) - __gitcomp_nl "$(__git_refs)" "" "${cur#*=}" + __git_complete_refs --cur="${cur#*=}" ;; add,--*|append,--*) __gitcomp '--file= --message= --reedit-message= @@ -1582,7 +1903,7 @@ _git_notes () -m|-F) ;; *) - __gitcomp_nl "$(__git_refs)" + __git_complete_refs ;; esac ;; @@ -1610,7 +1931,7 @@ _git_pull () __git_complete_remote_or_refspec } -__git_push_recurse_submodules="check on-demand" +__git_push_recurse_submodules="check on-demand only" __git_complete_force_with_lease () { @@ -1620,10 +1941,10 @@ __git_complete_force_with_lease () --*=) ;; *:*) - __gitcomp_nl "$(__git_refs)" "" "${cur_#*:}" + __git_complete_refs --cur="${cur_#*:}" ;; *) - __gitcomp_nl "$(__git_refs)" "" "$cur_" + __git_complete_refs --cur="$cur_" ;; esac } @@ -1668,12 +1989,13 @@ _git_push () _git_rebase () { - local dir="$(__gitdir)" - if [ -f "$dir"/rebase-merge/interactive ]; then - __gitcomp "--continue --skip --abort --edit-todo" + __git_find_repo_path + if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then + __gitcomp "--continue --skip --abort --quit --edit-todo" return - elif [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then - __gitcomp "--continue --skip --abort" + elif [ -d "$__git_repo_path"/rebase-apply ] || \ + [ -d "$__git_repo_path"/rebase-merge ]; then + __gitcomp "--continue --skip --abort --quit" return fi __git_complete_strategy && return @@ -1698,7 +2020,7 @@ _git_rebase () return esac - __gitcomp_nl "$(__git_refs)" + __git_complete_refs } _git_reflog () @@ -1709,7 +2031,7 @@ _git_reflog () if [ -z "$subcommand" ]; then __gitcomp "$subcommands" else - __gitcomp_nl "$(__git_refs)" + __git_complete_refs fi } @@ -1720,9 +2042,7 @@ _git_send_email () { case "$prev" in --to|--cc|--bcc|--from) - __gitcomp " - $(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null) - " + __gitcomp "$(__git send-email --dump-aliases)" return ;; esac @@ -1752,9 +2072,7 @@ _git_send_email () return ;; --to=*|--cc=*|--bcc=*|--from=*) - __gitcomp " - $(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null) - " "" "${cur#--*=}" + __gitcomp "$(__git send-email --dump-aliases)" "" "${cur#--*=}" return ;; --*) @@ -1779,6 +2097,56 @@ _git_stage () _git_add } +_git_status () +{ + local complete_opt + local untracked_state + + case "$cur" in + --ignore-submodules=*) + __gitcomp "none untracked dirty all" "" "${cur##--ignore-submodules=}" + return + ;; + --untracked-files=*) + __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}" + return + ;; + --column=*) + __gitcomp " + always never auto column row plain dense nodense + " "" "${cur##--column=}" + return + ;; + --*) + __gitcomp " + --short --branch --porcelain --long --verbose + --untracked-files= --ignore-submodules= --ignored + --column= --no-column + " + return + ;; + esac + + untracked_state="$(__git_get_option_value "-u" "--untracked-files=" \ + "$__git_untracked_file_modes" "status.showUntrackedFiles")" + + case "$untracked_state" in + no) + # --ignored option does not matter + complete_opt= + ;; + all|normal|*) + complete_opt="--cached --directory --no-empty-directory --others" + + if [ -n "$(__git_find_on_cmdline "--ignored")" ]; then + complete_opt="$complete_opt --ignored --exclude=*" + fi + ;; + esac + + __git_complete_index_file "$complete_opt" +} + __git_config_get_set_variables () { local prevword word config_file= c=$cword @@ -1798,7 +2166,7 @@ __git_config_get_set_variables () c=$((--c)) done - git --git-dir="$(__gitdir)" config $config_file --name-only --list 2>/dev/null + __git config $config_file --name-only --list } _git_config () @@ -1809,7 +2177,7 @@ _git_config () return ;; branch.*.merge) - __gitcomp_nl "$(__git_refs)" + __git_complete_refs return ;; branch.*.rebase) @@ -1833,9 +2201,8 @@ _git_config () remote.*.push) local remote="${prev#remote.}" remote="${remote%.push}" - __gitcomp_nl "$(git --git-dir="$(__gitdir)" \ - for-each-ref --format='%(refname):%(refname)' \ - refs/heads)" + __gitcomp_nl "$(__git for-each-ref \ + --format='%(refname):%(refname)' refs/heads)" return ;; pull.twohead|pull.octopus) @@ -1914,7 +2281,7 @@ _git_config () ;; branch.*) local pfx="${cur%.*}." cur_="${cur#*.}" - __gitcomp_nl "$(__git_heads)" "$pfx" "$cur_" "." + __gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")" __gitcomp_nl_append $'autosetupmerge\nautosetuprebase\n' "$pfx" "$cur_" return ;; @@ -1969,14 +2336,23 @@ _git_config () esac __gitcomp " add.ignoreErrors + advice.amWorkDir advice.commitBeforeMerge advice.detachedHead advice.implicitIdentity - advice.pushNonFastForward + advice.pushAlreadyExists + advice.pushFetchFirst + advice.pushNeedsForce + advice.pushNonFFCurrent + advice.pushNonFFMatching + advice.pushUpdateRejected advice.resolveConflict + advice.rmHints advice.statusHints + advice.statusUoption alias. am.keepcr + am.threeWay apply.ignorewhitespace apply.whitespace branch.autosetupmerge @@ -2021,19 +2397,26 @@ _git_config () color.status.added color.status.changed color.status.header + color.status.localBranch color.status.nobranch + color.status.remoteBranch color.status.unmerged color.status.untracked color.status.updated color.ui + commit.cleanup + commit.gpgSign commit.status commit.template + commit.verbose core.abbrev core.askpass core.attributesfile core.autocrlf core.bare core.bigFileThreshold + core.checkStat + core.commentChar core.compression core.createObject core.deltaBaseCacheLimit @@ -2043,6 +2426,8 @@ _git_config () core.fileMode core.fsyncobjectfiles core.gitProxy + core.hideDotFiles + core.hooksPath core.ignoreStat core.ignorecase core.logAllRefUpdates @@ -2050,20 +2435,30 @@ _git_config () core.notesRef core.packedGitLimit core.packedGitWindowSize + core.packedRefsTimeout core.pager + core.precomposeUnicode core.preferSymlinkRefs core.preloadindex + core.protectHFS + core.protectNTFS core.quotepath core.repositoryFormatVersion core.safecrlf core.sharedRepository core.sparseCheckout + core.splitIndex + core.sshCommand core.symlinks core.trustctime core.untrackedCache core.warnAmbiguousRefs core.whitespace core.worktree + credential.helper + credential.useHttpPath + credential.username + credentialCache.ignoreSIGHUP diff.autorefreshindex diff.external diff.ignoreSubmodules @@ -2084,6 +2479,7 @@ _git_config () format.attach format.cc format.coverLetter + format.from format.headers format.numbered format.pretty @@ -2094,15 +2490,19 @@ _git_config () format.thread format.to gc. + gc.aggressiveDepth gc.aggressiveWindow gc.auto + gc.autoDetach gc.autopacklimit + gc.logExpiry gc.packrefs gc.pruneexpire gc.reflogexpire gc.reflogexpireunreachable gc.rerereresolved gc.rerereunresolved + gc.worktreePruneExpire gitcvs.allbinary gitcvs.commitmsgannotation gitcvs.dbTableNamePrefix @@ -2241,6 +2641,8 @@ _git_config () sendemail.thread sendemail.to sendemail.validate + sendemail.smtpbatchsize + sendemail.smtprelogindelay showbranch.default status.relativePaths status.showUntrackedFiles @@ -2259,31 +2661,79 @@ _git_config () _git_remote () { - local subcommands="add rename remove set-head set-branches set-url show prune update" + local subcommands=" + add rename remove set-head set-branches + get-url set-url show prune update + " local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then - __gitcomp "$subcommands" + case "$cur" in + --*) + __gitcomp "--verbose" + ;; + *) + __gitcomp "$subcommands" + ;; + esac return fi - case "$subcommand" in - rename|remove|set-url|show|prune) - __gitcomp_nl "$(__git_remotes)" + case "$subcommand,$cur" in + add,--*) + __gitcomp "--track --master --fetch --tags --no-tags --mirror=" + ;; + add,*) + ;; + set-head,--*) + __gitcomp "--auto --delete" + ;; + set-branches,--*) + __gitcomp "--add" ;; - set-head|set-branches) + set-head,*|set-branches,*) __git_complete_remote_or_refspec ;; - update) + update,--*) + __gitcomp "--prune" + ;; + update,*) __gitcomp "$(__git_get_config_variables "remotes")" ;; + set-url,--*) + __gitcomp "--push --add --delete" + ;; + get-url,--*) + __gitcomp "--push --all" + ;; + prune,--*) + __gitcomp "--dry-run" + ;; *) + __gitcomp_nl "$(__git_remotes)" ;; esac } _git_replace () { - __gitcomp_nl "$(__git_refs)" + case "$cur" in + --*) + __gitcomp "--edit --graft --format= --list --delete" + return + ;; + esac + __git_complete_refs +} + +_git_rerere () +{ + local subcommands="clear forget diff remaining status gc" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if test -z "$subcommand" + then + __gitcomp "$subcommands" + return + fi } _git_reset () @@ -2292,27 +2742,30 @@ _git_reset () case "$cur" in --*) - __gitcomp "--merge --mixed --hard --soft --patch" + __gitcomp "--merge --mixed --hard --soft --patch --keep" return ;; esac - __gitcomp_nl "$(__git_refs)" + __git_complete_refs } _git_revert () { - local dir="$(__gitdir)" - if [ -f "$dir"/REVERT_HEAD ]; then + __git_find_repo_path + if [ -f "$__git_repo_path"/REVERT_HEAD ]; then __gitcomp "--continue --quit --abort" return fi case "$cur" in --*) - __gitcomp "--edit --mainline --no-edit --no-commit --signoff" + __gitcomp " + --edit --mainline --no-edit --no-commit --signoff + --strategy= --strategy-option= + " return ;; esac - __gitcomp_nl "$(__git_refs)" + __git_complete_refs } _git_rm () @@ -2336,7 +2789,7 @@ _git_shortlog () __gitcomp " $__git_log_common_options $__git_log_shortlog_options - --numbered --summary + --numbered --summary --email " return ;; @@ -2358,6 +2811,10 @@ _git_show () __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" return ;; + --submodule=*) + __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}" + return + ;; --*) __gitcomp "--pretty= --format= --abbrev-commit --oneline --show-signature @@ -2388,7 +2845,7 @@ _git_show_branch () _git_stash () { local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked' - local subcommands='save list show apply clear drop pop create branch' + local subcommands='push save list show apply clear drop pop create branch' local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then case "$cur" in @@ -2403,6 +2860,9 @@ _git_stash () esac else case "$subcommand,$cur" in + push,--*) + __gitcomp "$save_opts --message" + ;; save,--*) __gitcomp "$save_opts" ;; @@ -2416,14 +2876,14 @@ _git_stash () ;; branch,*) if [ $cword -eq 3 ]; then - __gitcomp_nl "$(__git_refs)"; + __git_complete_refs else - __gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \ + __gitcomp_nl "$(__git stash list \ | sed -n -e 's/:.*//p')" fi ;; show,*|apply,*|drop,*|pop,*) - __gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \ + __gitcomp_nl "$(__git stash list \ | sed -n -e 's/:.*//p')" ;; *) @@ -2437,10 +2897,11 @@ _git_submodule () __git_has_doubledash && return local subcommands="add status init deinit update summary foreach sync" - if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then case "$cur" in --*) - __gitcomp "--quiet --cached" + __gitcomp "--quiet" ;; *) __gitcomp "$subcommands" @@ -2448,6 +2909,33 @@ _git_submodule () esac return fi + + case "$subcommand,$cur" in + add,--*) + __gitcomp "--branch --force --name --reference --depth" + ;; + status,--*) + __gitcomp "--cached --recursive" + ;; + deinit,--*) + __gitcomp "--force --all" + ;; + update,--*) + __gitcomp " + --init --remote --no-fetch + --recommend-shallow --no-recommend-shallow + --force --rebase --merge --reference --depth --recursive --jobs + " + ;; + summary,--*) + __gitcomp "--cached --files --summary-limit" + ;; + foreach,--*|sync,--*) + __gitcomp "--recursive" + ;; + *) + ;; + esac } _git_svn () @@ -2468,14 +2956,14 @@ _git_svn () --no-metadata --use-svm-props --use-svnsync-props --log-window-size= --no-checkout --quiet --repack-flags --use-log-author --localtime + --add-author-from --ignore-paths= --include-paths= $remote_opts " local init_opts=" --template= --shared= --trunk= --tags= --branches= --stdlayout --minimize-url --no-metadata --use-svm-props --use-svnsync-props - --rewrite-root= --prefix= --use-log-author - --add-author-from $remote_opts + --rewrite-root= --prefix= $remote_opts " local cmt_opts=" --edit --rmdir --find-copies-harder --copy-similarity= @@ -2555,7 +3043,7 @@ _git_tag () i="${words[c]}" case "$i" in -d|-v) - __gitcomp_nl "$(__git_tags)" + __gitcomp_direct "$(__git_tags "" "$cur" " ")" return ;; -f) @@ -2570,11 +3058,11 @@ _git_tag () ;; -*|tag) if [ $f = 1 ]; then - __gitcomp_nl "$(__git_tags)" + __gitcomp_direct "$(__git_tags "" "$cur" " ")" fi ;; *) - __gitcomp_nl "$(__git_refs)" + __git_complete_refs ;; esac @@ -2582,8 +3070,8 @@ _git_tag () --*) __gitcomp " --list --delete --verify --annotate --message --file - --sign --cleanup --local-user --force --column --sort - --contains --points-at + --sign --cleanup --local-user --force --column --sort= + --contains --no-contains --points-at --merged --no-merged --create-reflog " ;; esac @@ -2594,9 +3082,36 @@ _git_whatchanged () _git_log } +_git_worktree () +{ + local subcommands="add list lock prune unlock" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + else + case "$subcommand,$cur" in + add,--*) + __gitcomp "--detach" + ;; + list,--*) + __gitcomp "--porcelain" + ;; + lock,--*) + __gitcomp "--reason" + ;; + prune,--*) + __gitcomp "--dry-run --expire --verbose" + ;; + *) + ;; + esac + fi +} + __git_main () { - local i c=1 command __git_dir + local i c=1 command __git_dir __git_repo_path + local __git_C_args C_args_count=0 while [ $c -lt $cword ]; do i="${words[c]}" @@ -2606,6 +3121,10 @@ __git_main () --bare) __git_dir="." ;; --help) command="help"; break ;; -c|--work-tree|--namespace) ((c++)) ;; + -C) __git_C_args[C_args_count++]=-C + ((c++)) + __git_C_args[C_args_count++]="${words[c]}" + ;; -*) ;; *) command="$i"; break ;; esac @@ -2613,6 +3132,17 @@ __git_main () done if [ -z "$command" ]; then + case "$prev" in + --git-dir|-C|--work-tree) + # these need a path argument, let's fall back to + # Bash filename completion + return + ;; + -c|--namespace) + # we don't support completing these options' arguments + return + ;; + esac case "$cur" in --*) __gitcomp " --paginate @@ -2638,13 +3168,13 @@ __git_main () fi local completion_func="_git_${command//-/_}" - declare -f $completion_func >/dev/null && $completion_func && return + declare -f $completion_func >/dev/null 2>/dev/null && $completion_func && return local expansion=$(__git_aliased_command "$command") if [ -n "$expansion" ]; then words[1]=$expansion completion_func="_git_${expansion//-/_}" - declare -f $completion_func >/dev/null && $completion_func + declare -f $completion_func >/dev/null 2>/dev/null && $completion_func fi } @@ -2652,9 +3182,11 @@ __gitk_main () { __git_has_doubledash && return - local g="$(__gitdir)" + local __git_repo_path + __git_find_repo_path + local merge="" - if [ -f "$g/MERGE_HEAD" ]; then + if [ -f "$__git_repo_path/MERGE_HEAD" ]; then merge="--merge" fi case "$cur" in @@ -2701,6 +3233,15 @@ if [[ -n ${ZSH_VERSION-} ]]; then esac } + __gitcomp_direct () + { + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -Q -- ${=1} && _ret=0 + } + __gitcomp_nl () { emulate -L zsh @@ -2771,6 +3312,6 @@ __git_complete gitk __gitk_main # when the user has tab-completed the executable name and consequently # included the '.exe' suffix. # -if [[ "$OSTYPE" = cygwin* ]]; then +if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then __git_complete git.exe __git_main fi diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh index 0da14eee9..cd905759e 100644 --- a/plugins/gitfast/git-prompt.sh +++ b/plugins/gitfast/git-prompt.sh @@ -82,6 +82,7 @@ # contains relative to newer annotated tag (v1.6.3.2~35) # branch relative to newer tag or branch (master~4) # describe relative to older annotated tag (v1.6.3.1-13-gdd42c2f) +# tag relative to any older tag (v1.6.3.1-13-gdd42c2f) # default exactly matching tag # # If you would like a colored hint about the current dirty state, set @@ -355,8 +356,8 @@ __git_ps1 () # incorrect.) # local ps1_expanded=yes - [ -z "$ZSH_VERSION" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no - [ -z "$BASH_VERSION" ] || shopt -q promptvars || ps1_expanded=no + [ -z "${ZSH_VERSION-}" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no + [ -z "${BASH_VERSION-}" ] || shopt -q promptvars || ps1_expanded=no local repo_info rev_parse_exit_code repo_info="$(git rev-parse --git-dir --is-inside-git-dir \ @@ -368,7 +369,7 @@ __git_ps1 () return $exit fi - local short_sha + local short_sha="" if [ "$rev_parse_exit_code" = "0" ]; then short_sha="${repo_info##*$'\n'}" repo_info="${repo_info%$'\n'*}" @@ -443,6 +444,8 @@ __git_ps1 () git describe --contains HEAD ;; (branch) git describe --contains --all HEAD ;; + (tag) + git describe --tags HEAD ;; (describe) git describe HEAD ;; (* | default) diff --git a/plugins/gitfast/gitfast.plugin.zsh b/plugins/gitfast/gitfast.plugin.zsh index dba1b1315..8c2aea497 100644 --- a/plugins/gitfast/gitfast.plugin.zsh +++ b/plugins/gitfast/gitfast.plugin.zsh @@ -1,8 +1,9 @@ -dir=$(dirname $0) -source $dir/../git/git.plugin.zsh -source $dir/git-prompt.sh +dir="${0:A:h}" +source "$dir/git-prompt.sh" function git_prompt_info() { dirty="$(parse_git_dirty)" __git_ps1 "${ZSH_THEME_GIT_PROMPT_PREFIX//\%/%%}%s${dirty//\%/%%}${ZSH_THEME_GIT_PROMPT_SUFFIX//\%/%%}" } + +unset dir diff --git a/plugins/github/README.md b/plugins/github/README.md index fea607876..2b66e390f 100644 --- a/plugins/github/README.md +++ b/plugins/github/README.md @@ -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 * `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 -* `git.io` - Shortens a URL using [git.io](http://git.io) +* `git.io` - Shortens a URL using [git.io](https://git.io) ## 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 diff --git a/plugins/github/_hub b/plugins/github/_hub index 3a6493878..209a3df9e 100644 --- a/plugins/github/_hub +++ b/plugins/github/_hub @@ -58,6 +58,7 @@ __hub_setup_zsh_fns () { - set1 \ '-m[message]' \ '-F[file]' \ + '--no-edit[use first commit message for pull request title/description]' \ '-a[user]' \ '-M[milestone]' \ '-l[labels]' \ @@ -84,11 +85,16 @@ __hub_setup_zsh_fns () { hub_commands=( alias:'show shell instructions for wrapping git' pull-request:'open a pull request on GitHub' + pr:'list or checkout a GitHub pull request' + issue:'list or create a GitHub issue' + release:'list or create a GitHub release' fork:'fork origin repo on GitHub' create:'create new repo on GitHub for the current project' + delete:'delete a GitHub repo' browse:'browse the project on GitHub' compare:'open GitHub compare view' - ci-status:'lookup commit in GitHub Status API' + ci-status:'show status of GitHub checks for a commit' + sync:'update local branches from upstream' ) _describe -t hub-commands 'hub command' hub_commands && ret=0 @@ -110,11 +116,16 @@ __hub_setup_bash_fns () { cat <<-EOF alias pull-request +pr +issue +release fork create +delete browse compare ci-status +sync EOF __git_list_all_commands_without_hub } diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 0ab399c97..8e4b97352 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -1,8 +1,6 @@ -# Set up hub wrapper for git, if it is available; http://github.com/github/hub -if [ "$commands[(I)hub]" ]; then - if hub --version &>/dev/null; then - eval $(hub alias -s zsh) - fi +# Set up hub wrapper for git, if it is available; https://github.com/github/hub +if (( $+commands[hub] )); then + alias git=hub fi # Functions ################################################################# @@ -38,7 +36,7 @@ new_gh() { # [DIRECTORY] print '.*'"\n"'*~' >> .gitignore git add [^.]* \ || return - git add .gitignore \ + git add -f .gitignore \ || return git commit -m 'Initial commit.' \ || return @@ -65,7 +63,7 @@ exist_gh() { # [DIRECTORY] # git.io "GitHub URL" # # 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 # documentation: https://github.com/blog/985-git-io-github-url-shortener # diff --git a/plugins/gitignore/README.md b/plugins/gitignore/README.md new file mode 100644 index 000000000..753dd31fd --- /dev/null +++ b/plugins/gitignore/README.md @@ -0,0 +1,17 @@ +# 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. diff --git a/plugins/gitignore/gitignore.plugin.zsh b/plugins/gitignore/gitignore.plugin.zsh index ba1b38711..15e38d3b7 100644 --- a/plugins/gitignore/gitignore.plugin.zsh +++ b/plugins/gitignore/gitignore.plugin.zsh @@ -1,7 +1,7 @@ -function gi() { curl -sL https://www.gitignore.io/api/${(j:,:)@} } +function gi() { curl -fL https://www.gitignore.io/api/${(j:,:)@} } _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 () { diff --git a/plugins/globalias/README.md b/plugins/globalias/README.md index ba9888ccb..0b064105d 100644 --- a/plugins/globalias/README.md +++ b/plugins/globalias/README.md @@ -2,7 +2,7 @@ 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 diff --git a/plugins/go/README.md b/plugins/go/README.md new file mode 100644 index 000000000..6ce6f4ee2 --- /dev/null +++ b/plugins/go/README.md @@ -0,0 +1 @@ +The go plugin is deprecated. Use the [golang plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/golang) instead. diff --git a/plugins/golang/README.md b/plugins/golang/README.md new file mode 100644 index 000000000..72845b2a1 --- /dev/null +++ b/plugins/golang/README.md @@ -0,0 +1,29 @@ +# 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 | diff --git a/plugins/golang/golang.plugin.zsh b/plugins/golang/golang.plugin.zsh index d9d450690..47b10988e 100644 --- a/plugins/golang/golang.plugin.zsh +++ b/plugins/golang/golang.plugin.zsh @@ -28,6 +28,7 @@ __go_tool_complete() { 'help[display help]' 'install[compile and install packages and dependencies]' 'list[list packages]' + 'mod[modules maintenance]' 'run[compile and run Go program]' 'test[test packages]' 'tool[run specified go tool]' @@ -83,7 +84,7 @@ __go_tool_complete() { "-x[print remove commands as it executes them]" \ "*:importpaths:__go_packages" ;; - fix|fmt|list|vet) + fix|fmt|vet) _alternative ':importpaths:__go_packages' ':files:_path_files -g "*.go"' ;; install) @@ -124,8 +125,84 @@ __go_tool_complete() { "-memprofilerate[set heap profiling rate]:number" \ "*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }" ;; + list) + _arguments -s -w : \ + "-f[alternative format for the list]:format" \ + "-json[print data in json format]" \ + "-compiled[set CompiledGoFiles to the Go source files presented to the compiler]" \ + "-deps[iterate over not just the named packages but also all their dependencies]" \ + "-e[change the handling of erroneous packages]" \ + "-export[set the Export field to the name of a file containing up-to-date export information for the given package]" \ + "-find[identify the named packages but not resolve their dependencies]" \ + "-test[report not only the named packages but also their test binaries]" \ + "-m[list modules instead of packages]" \ + "-u[adds information about available upgrades]" \ + "-versions[set the Module's Versions field to a list of all known versions of that module]:number" \ + "*:importpaths:__go_packages" + ;; + mod) + typeset -a mod_commands + mod_commands+=( + 'download[download modules to local cache]' + 'edit[edit go.mod from tools or scripts]' + 'graph[print module requirement graph]' + 'init[initialize new module in current directory]' + 'tidy[add missing and remove unused modules]' + 'vendor[make vendored copy of dependencies]' + 'verify[verify dependencies have expected content]' + 'why[explain why packages or modules are needed]' + ) + if (( CURRENT == 3 )); then + _values 'go mod commands' ${mod_commands[@]} "help[display help]" + return + fi + case ${words[3]} in + help) + _values 'go mod commands' ${mod_commands[@]} + ;; + download) + _arguments -s -w : \ + "-json[print a sequence of JSON objects standard output]" \ + "*:flags" + ;; + edit) + _arguments -s -w : \ + "-fmt[reformat the go.mod file]" \ + "-module[change the module's path]" \ + "-replace[=old{@v}=new{@v} add a replacement of the given module path and version pair]:name" \ + "-dropreplace[=old{@v}=new{@v} drop a replacement of the given module path and version pair]:name" \ + "-go[={version} set the expected Go language version]:number" \ + "-print[print the final go.mod in its text format]" \ + "-json[print the final go.mod file in JSON format]" \ + "*:flags" + ;; + graph) + ;; + init) + ;; + tidy) + _arguments -s -w : \ + "-v[print information about removed modules]" \ + "*:flags" + ;; + vendor) + _arguments -s -w : \ + "-v[print the names of vendored]" \ + "*:flags" + ;; + verify) + ;; + why) + _arguments -s -w : \ + "-m[treats the arguments as a list of modules and finds a path to any package in each of the modules]" \ + "-vendor[exclude tests of dependencies]" \ + "*:importpaths:__go_packages" + ;; + esac + ;; help) _values "${commands[@]}" \ + 'environment[show Go environment variables available]' \ 'gopath[GOPATH environment variable]' \ 'packages[description of package lists]' \ 'remote[remote import path syntax]' \ @@ -135,7 +212,7 @@ __go_tool_complete() { run) _arguments -s -w : \ ${build_flags[@]} \ - '*:file:_path_files -g "*.go"' + '*:file:_files -g "*.go"' ;; tool) if (( CURRENT == 3 )); then @@ -184,10 +261,14 @@ alias gob='go build' alias goc='go clean' alias god='go doc' alias gof='go fmt' -alias gofa='go fmt . ./...' +alias gofa='go fmt ./...' alias gog='go get' alias goi='go install' alias gol='go list' +alias gom='go mod' +alias gop='cd $GOPATH' +alias gopb='cd $GOPATH/bin' +alias gops='cd $GOPATH/src' alias gor='go run' alias got='go test' alias gov='go vet' diff --git a/plugins/gpg-agent/README.md b/plugins/gpg-agent/README.md new file mode 100644 index 000000000..a9711f923 --- /dev/null +++ b/plugins/gpg-agent/README.md @@ -0,0 +1,8 @@ +# 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) +``` diff --git a/plugins/gpg-agent/gpg-agent.plugin.zsh b/plugins/gpg-agent/gpg-agent.plugin.zsh index 69e239ccf..3e24c2527 100644 --- a/plugins/gpg-agent/gpg-agent.plugin.zsh +++ b/plugins/gpg-agent/gpg-agent.plugin.zsh @@ -1,14 +1,16 @@ -# Enable gpg-agent if it is not running -GPG_AGENT_SOCKET="${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.ssh" -if [ ! -S $GPG_AGENT_SOCKET ]; then - gpg-agent --daemon >/dev/null 2>&1 - export GPG_TTY=$(tty) +# Enable gpg-agent if it is not running- +# --use-standard-socket will work from version 2 upwards + +AGENT_SOCK=$(gpgconf --list-dirs | grep agent-socket | cut -d : -f 2) + +if [[ ! -S $AGENT_SOCK ]]; then + gpg-agent --daemon --use-standard-socket &>/dev/null 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" -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 - export SSH_AUTH_SOCK=$GPG_AGENT_SOCKET fi - diff --git a/plugins/gradle/README.md b/plugins/gradle/README.md new file mode 100644 index 000000000..215503c81 --- /dev/null +++ b/plugins/gradle/README.md @@ -0,0 +1,23 @@ +## 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. diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh index 0adc04a13..8d578e27b 100644 --- a/plugins/gradle/gradle.plugin.zsh +++ b/plugins/gradle/gradle.plugin.zsh @@ -1,6 +1,18 @@ ############################################################################## # 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() { local ret=1 state _arguments ':subcommand:->subcommand' && ret=0 @@ -88,7 +100,7 @@ function _gradle_arguments() { # and if so, regenerate the .gradle_tasks cache file ############################################################################ _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 () { # Discover the gradle tasks by running "gradle tasks --all" ############################################################################ _gradle_tasks () { - if [[ -f build.gradle ]]; then + if [[ -f build.gradle || -f build.gradle.kts || -f settings.gradle || -f settings.gradle.kts ]]; then _gradle_arguments if _gradle_does_task_list_need_generating; then _gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache @@ -154,7 +166,7 @@ _gradle_tasks () { } _gradlew_tasks () { - if [[ -f build.gradle ]]; then + if [[ -f build.gradle || -f build.gradle.kts || -f settings.gradle || -f settings.gradle.kts ]]; then _gradle_arguments if _gradle_does_task_list_need_generating; then _gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache diff --git a/plugins/grails/README.md b/plugins/grails/README.md new file mode 100644 index 000000000..64b4a9f07 --- /dev/null +++ b/plugins/grails/README.md @@ -0,0 +1,71 @@ +# 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` diff --git a/plugins/grunt/README.md b/plugins/grunt/README.md new file mode 100644 index 000000000..a69a9b7fc --- /dev/null +++ b/plugins/grunt/README.md @@ -0,0 +1,37 @@ +# 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 +``` diff --git a/plugins/gulp/README.md b/plugins/gulp/README.md new file mode 100644 index 000000000..4ed2b99b3 --- /dev/null +++ b/plugins/gulp/README.md @@ -0,0 +1,8 @@ +# 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) +``` diff --git a/plugins/gulp/gulp.plugin.zsh b/plugins/gulp/gulp.plugin.zsh index 2b3105135..6234302c5 100644 --- a/plugins/gulp/gulp.plugin.zsh +++ b/plugins/gulp/gulp.plugin.zsh @@ -11,7 +11,7 @@ # # André König -# Github: https://github.com/akoenig +# GitHub: https://github.com/akoenig # Twitter: https://twitter.com/caiifr # @@ -19,11 +19,11 @@ # Grabs all available tasks from the `gulpfile.js` # in the current directory. # -function $$gulp_completion { +function _gulp_completion { compls=$(gulp --tasks-simple 2>/dev/null) completions=(${=compls}) compadd -- $completions } -compdef $$gulp_completion gulp +compdef _gulp_completion gulp diff --git a/plugins/hanami/README.md b/plugins/hanami/README.md new file mode 100644 index 000000000..3ac8defbb --- /dev/null +++ b/plugins/hanami/README.md @@ -0,0 +1,32 @@ +# 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 | grep | Grep hanami routes with specified pattern | diff --git a/plugins/hanami/hanami.plugin.zsh b/plugins/hanami/hanami.plugin.zsh new file mode 100644 index 000000000..349c42cae --- /dev/null +++ b/plugins/hanami/hanami.plugin.zsh @@ -0,0 +1,19 @@ +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' diff --git a/plugins/helm/README.md b/plugins/helm/README.md new file mode 100644 index 000000000..49844c78f --- /dev/null +++ b/plugins/helm/README.md @@ -0,0 +1,9 @@ +# 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) +``` diff --git a/plugins/heroku/README.md b/plugins/heroku/README.md new file mode 100644 index 000000000..2bf92c9de --- /dev/null +++ b/plugins/heroku/README.md @@ -0,0 +1,9 @@ +# 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) +``` diff --git a/plugins/heroku/_heroku b/plugins/heroku/_heroku deleted file mode 100644 index 878d3ce1b..000000000 --- a/plugins/heroku/_heroku +++ /dev/null @@ -1,151 +0,0 @@ -#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 diff --git a/plugins/heroku/heroku.plugin.zsh b/plugins/heroku/heroku.plugin.zsh new file mode 100644 index 000000000..9a99b4211 --- /dev/null +++ b/plugins/heroku/heroku.plugin.zsh @@ -0,0 +1,9 @@ +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 diff --git a/plugins/history-substring-search/README.md b/plugins/history-substring-search/README.md index 0c02e91b1..7fb0fa0b6 100644 --- a/plugins/history-substring-search/README.md +++ b/plugins/history-substring-search/README.md @@ -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. You can also use K and J in VI mode or ^P and ^N in EMACS mode for the same. -[1]: http://fishshell.com -[2]: http://www.zsh.org/mla/users/2009/msg00818.html -[3]: http://sourceforge.net/projects/fizsh/ +[1]: https://fishshell.com +[2]: https://www.zsh.org/mla/users/2009/msg00818.html +[3]: https://sourceforge.net/projects/fizsh/ [4]: https://github.com/robbyrussell/oh-my-zsh/pull/215 [5]: https://github.com/zsh-users/zsh-history-substring-search [6]: https://github.com/zsh-users/zsh-syntax-highlighting diff --git a/plugins/homestead/README.md b/plugins/homestead/README.md new file mode 100644 index 000000000..476302371 --- /dev/null +++ b/plugins/homestead/README.md @@ -0,0 +1,9 @@ +# 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) +``` diff --git a/plugins/homestead/homestead.plugin.zsh b/plugins/homestead/homestead.plugin.zsh new file mode 100644 index 000000000..cdbc564e4 --- /dev/null +++ b/plugins/homestead/homestead.plugin.zsh @@ -0,0 +1,10 @@ +# 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 diff --git a/plugins/httpie/README.md b/plugins/httpie/README.md index 1d4ec48bd..f22d3a64e 100644 --- a/plugins/httpie/README.md +++ b/plugins/httpie/README.md @@ -1,6 +1,15 @@ -## HTTPie -**Maintainer:** [lululau](https://github.com/lululau) +# HTTPie plugin + +This plugin adds completion for [HTTPie](https://httpie.org), a command line HTTP +client, a friendlier cURL replacement. + +To use it, add `httpie` to the plugins array in your zshrc file: -This plugin adds completion for HTTPie, which is a command line HTTP client, a user-friendly cURL replacement. +```zsh +plugins=(... httpie) +``` -[HTTPie Homepage](http://httpie.org) +It uses completion from [zsh-completions](https://github.com/zsh-users/zsh-completions). + + +**Maintainer:** [lululau](https://github.com/lululau) diff --git a/plugins/httpie/_httpie b/plugins/httpie/_httpie new file mode 100644 index 000000000..4d702ef60 --- /dev/null +++ b/plugins/httpie/_httpie @@ -0,0 +1,181 @@ +#compdef http +# ------------------------------------------------------------------------------ +# Copyright (c) 2015 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# 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 httpie 0.7.2 (http://httpie.org) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Akira Maeda <https://github.com/glidenote> +# * Valodim <https://github.com/Valodim> +# * Claus Klingberg <https://github.com/cjk> +# +# ------------------------------------------------------------------------------ +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------ + +_httpie_params () { + + local ret=1 expl + + # or a url + if (( CURRENT <= NORMARG+1 )) && [[ $words[NORMARG] != *:* ]] ; then + _httpie_urls && ret=0 + + # regular param, if we already have a url + elif (( CURRENT > NORMARG )); then + + # if the suffix is precisely : this is shorthand for a header + if [[ -prefix ':' ]]; then + PREFIX= + SUFFIX=: + fi + + # if we are in front of a : (possibly due to the PREFIX move before) + if [[ -suffix ':' ]]; then + + # this is rather buggy with normal tab behavior :\ + compstate[insert]=menu + _wanted http_header expl 'HTTP Header' \ + compadd -s ':' -S '' -- Content-Type Cookie && return 0 + fi + + # ignore all prefix stuff + compset -P '(#b)([^:@=]#)' + local name=$match[1] + + if compset -P '='; then + _message "$name data field value" + elif compset -P '@'; then + _files + elif compset -P ':=@'; then + _files + elif compset -P ':='; then + _message "$name raw json data" + elif compset -P '=='; then + _message "$name url parameter value" + elif compset -P ':'; then + _message "$name header content" + else + typeset -a ops + ops=( + '=:data field' + '\::header' + '==:request parameter' + '@:data file field' + '\:=:raw json field' + '\:=@:raw json field file path' + ) + _describe -t httpparams "parameter types" ops -Q -S '' + fi + + ret=0 + + fi + + # first arg may be a request method + (( CURRENT == NORMARG )) && + _wanted http_method expl 'Request Method' \ + compadd GET POST PUT DELETE HEAD OPTIONS TRACE CONNECT PATCH LINK UNLINK && ret=0 + + return $ret + +} + +_httpie_urls() { + + local ret=1 + + if ! [[ -prefix [-+.a-z0-9]#:// ]]; then + local expl + compset -S '[^:/]*' && compstate[to_end]='' + _wanted url-schemas expl 'URL schema' compadd -S '' http:// https:// && ret=0 + else + _urls && ret=0 + fi + + return $ret + +} + +_httpie_printflags () { + + local ret=1 + + # not sure why this is necessary, but it will complete "-pH" style without it + [[ $IPREFIX == "-p" ]] && IPREFIX+=" " + + compset -P '(#b)([a-zA-Z]#)' + + local -a flags + [[ $match[1] != *H* ]] && flags+=( "H:request headers" ) + [[ $match[1] != *B* ]] && flags+=( "B:request body" ) + [[ $match[1] != *h* ]] && flags+=( "h:response headers" ) + [[ $match[1] != *b* ]] && flags+=( "b:response body" ) + + _describe -t printflags "print flags" flags -S '' && ret=0 + + return $ret + +} + +integer NORMARG + +_arguments -n -C -s \ + '(-j --json -f)'{-j,--json}'[Data items from the command line are serialized as a JSON object.]' \ + '(-f --form -j)'{-f,--form}'[Data items from the command line are serialized as form fields.]' \ + '--pretty=[Controls output processing.]:output format:(all colors format none)' \ + '(-s --style)'{-s,--style}'=[Output coloring style]:STYLE:(autumn borland bw colorful default emacs friendly fruity manni monokai murphy native pastie perldoc ttr solarized tango trac vim vs)' \ + '(-p --print)'{-p,--print}'=[String specifying what the output should contain]:print flags:_httpie_printflags' \ + '(-v --verbose)'{-v,--verbose}'[Print the whole request as well as the response.]' \ + '(-p -h --headers)'{-h,--headers}'[Print only the response headers.]' \ + '(-p -b --body)'{-b,--body}'[Print only the response body.]' \ + '(-S --stream)'{-S,--stream}'[Always stream the output by line, i.e., behave like `tail -f`.]' \ + '(-o --output)'{-o,--output}'=[Save output to FILE.]:output file:_files' \ + '(-d --download)'{-d,--download}'=[Do not print the response body to stdout.]' \ + '(-c --continue)'{-c,--continue}'[Resume an interrupted download.]' \ + '(--session-read-only)--session=[Create, or reuse and update a session.]:session name (or path)' \ + '(--session)--session-read-only=[Create or read a session without updating it form the request/response exchange.]:session name (or path)' \ + '(-a --auth)'{-a,--auth}'=[If only the username is provided (-a username)]:USER\:PASS' \ + '--auth-type=[The authentication mechanism to be used. Defaults to "basic".]:AUTH-TYPE:(basic digest)' \ + '--proxy=[String mapping protocol to the URL of the proxy.]:PROXY' \ + '--follow[Allow full redirects.]' \ + "--verify=[Enable or disable verification of ssl certificates.]:verify certificate:(yes no)" \ + '--allow-redirects[Set this flag if full redirects are allowed (e.g. re-POST-ing of data at new ``Location``)]' \ + '--timeout=[Float describes the timeout of the request (Use socket.setdefaulttimeout() as fallback).]:timeout (seconds)' \ + '--check-status[This flag instructs HTTPie to also check the HTTP status code and exit with an error if the status indicates one.]' \ + '--ignore-stdin[Do not attempt to read stdin.]' \ + '(- *)--help[show help message.]' \ + "(- *)--version[show program's version number and exit.]" \ + '--traceback[Prints exception traceback should one occur.]' \ + '--debug[Prints exception traceback should one occur and other information useful for debugging HTTPie itself.]' \ + '*:args:_httpie_params' && return 0 diff --git a/plugins/httpie/httpie.plugin.zsh b/plugins/httpie/httpie.plugin.zsh deleted file mode 100644 index 68ead6c67..000000000 --- a/plugins/httpie/httpie.plugin.zsh +++ /dev/null @@ -1,33 +0,0 @@ -function _httpie_completion() { - _arguments -C \ - '(- 1 *)--version[display version information]' \ - '(-j|--json)'{-j,--json}'[(default) Data items from the command line are serialized as a JSON object]' \ - '(-f|--form)'{-f,--form}'[Data items from the command line are serialized as form fields]' \ - '(--pretty)--pretty[<all,colors,format,none> Controls output processing]:options' \ - '(-s|--style)'{-s,--style}'[Output coloring style]' \ - '(-p|--print)'{-p,--print}'[String specifying what the output should contain: H(request headers), B(request body), h(response headers), b(response body)]' \ - '(-v|--verbose)'{-v,--verbose}'[Print the whole request as well as the response. Shortcut for --print=HBbh.]' \ - '(-h|--headers)'{-h,--headers}'[Print only the response headers. Shortcut for --print=h]' \ - '(-b|--body)'{-b,--body}'[Print only the response body. Shortcut for --print=b]' \ - '(-S|--stream)'{-S,--stream}'[Always stream the output by line, i.e., behave like `tail -f'"'"']' \ - '(-o|--output)'{-o,--output}'[Save output to FILE]:file:_files' \ - '(-d|--download)'{-d,--download}'[Do not print the response body to stdout. Rather, download it and store it in a file. The filename is guessed unless specified with --output filename. This action is similar to the default behaviour of wget.]' \ - '(-c|--continue)'{-c,--continue}'[Resume an interrupted download. Note that the --output option needs to be specified as well.]' \ - '(--session)--session[Create, or reuse and update a session. Within a session, custom headers, auth credential, as well as any cookies sent by the server persist between requests]:file:_files' \ - '(--session-read-only)--session-read-only[Create or read a session without updating it form the request/response exchange]:file:_files' \ - '(-a|--auth)'{-a,--auth}'[<USER:PASS> If only the username is provided (-a username), HTTPie will prompt for the password]' \ - '(--auth-type)--auth-type[<basic, digest> The authentication mechanism to be used. Defaults to "basic".]' \ - '(--proxy)--proxy[<PROTOCOL:PROXY_URL> String mapping protocol to the URL of the proxy]' \ - '(--follow)--follow[Set this flag if full redirects are allowed (e.g. re-POST-ing of data at new Location).]' \ - '(--verify)--verify[<VERIFY> Set to "no" to skip checking the host'"'"'s SSL certificate. You can also pass the path to a CA_BUNDLE file for private certs. You can also set the REQUESTS_CA_BUNDLE environment variable. Defaults to "yes".]' \ - '(--timeout)--timeout[<SECONDS> The connection timeout of the request in seconds. The default value is 30 seconds]' \ - '(--check-status)--check-status[By default, HTTPie exits with 0 when no network or other fatal errors occur. This flag instructs HTTPie to also check the HTTP status code and exit with an error if the status indicates one.]' \ - '(--ignore-stdin)--ignore-stdin[Do not attempt to read stdin]' \ - '(--help)--help[Show this help message and exit]' \ - '(--traceback)--traceback[Prints exception traceback should one occur]' \ - '(--debug)--debug[Prints exception traceback should one occur, and also other information that is useful for debugging HTTPie itself and for reporting bugs]' \ - '1: :->cmds' \ - '*: :->args' && ret=0 -} - -compdef _httpie_completion http
\ No newline at end of file diff --git a/plugins/iterm2/README.md b/plugins/iterm2/README.md new file mode 100644 index 000000000..50cdebf5e --- /dev/null +++ b/plugins/iterm2/README.md @@ -0,0 +1,29 @@ +# 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) diff --git a/plugins/iwhois/iwhois.plugin.zsh b/plugins/iwhois/iwhois.plugin.zsh deleted file mode 100644 index 38790bf28..000000000 --- a/plugins/iwhois/iwhois.plugin.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# provide a whois command with a more accurate and up to date list of whois -# servers using CNAMES via whois.geek.nz - -function iwhois() { - resolver="whois.geek.nz" - tld=`echo ${@: -1} | awk -F "." '{print $NF}'` - whois -h ${tld}.${resolver} "$@" ; -} diff --git a/plugins/jake-node/README.md b/plugins/jake-node/README.md new file mode 100644 index 000000000..78ca8d85f --- /dev/null +++ b/plugins/jake-node/README.md @@ -0,0 +1,9 @@ +# 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) +``` diff --git a/plugins/jake-node/jake-node.plugin.zsh b/plugins/jake-node/jake-node.plugin.zsh index a9eef4029..3b692f899 100644 --- a/plugins/jake-node/jake-node.plugin.zsh +++ b/plugins/jake-node/jake-node.plugin.zsh @@ -3,7 +3,7 @@ # Warning : Jakefile should have the right case : Jakefile or jakefile # Tested on : MacOSX 10.7 (Lion), Ubuntu 11.10 # 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 () { if [ -f Jakefile ]||[ -f jakefile ]; then @@ -11,4 +11,4 @@ function _jake () { fi } -compdef _jake jake
\ No newline at end of file +compdef _jake jake diff --git a/plugins/jenv/README.md b/plugins/jenv/README.md new file mode 100644 index 000000000..c043c626e --- /dev/null +++ b/plugins/jenv/README.md @@ -0,0 +1,27 @@ +# 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 +``` diff --git a/plugins/jenv/jenv.plugin.zsh b/plugins/jenv/jenv.plugin.zsh new file mode 100644 index 000000000..2eda8037b --- /dev/null +++ b/plugins/jenv/jenv.plugin.zsh @@ -0,0 +1,30 @@ +jenvdirs=("$HOME/.jenv" "/usr/local" "/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 diff --git a/plugins/jira/_jira b/plugins/jira/_jira index 890f97f4c..d64614233 100644 --- a/plugins/jira/_jira +++ b/plugins/jira/_jira @@ -7,7 +7,7 @@ _1st_arguments=( 'dashboard:open the dashboard' 'reported:search for issues reported by 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' ) diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index e03bda90e..e706948e9 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -43,7 +43,7 @@ function jira() { echo "Opening new issue" open_command "${jira_url}/secure/CreateIssue!default.jspa" elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then - _jira_query $@ + _jira_query ${@:-$action} elif [[ "$action" == "myissues" ]]; then echo "Opening my issues" open_command "${jira_url}/issues/?filter=-1" diff --git a/plugins/jump/README.md b/plugins/jump/README.md new file mode 100644 index 000000000..ed6415289 --- /dev/null +++ b/plugins/jump/README.md @@ -0,0 +1,19 @@ +# 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 | diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh index 86d9553a2..d161a6da0 100644 --- a/plugins/jump/jump.plugin.zsh +++ b/plugins/jump/jump.plugin.zsh @@ -19,7 +19,7 @@ mark() { MARK="$1" fi 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 } @@ -28,11 +28,18 @@ unmark() { } marks() { + local max=0 + for link in $MARKPATH/*(@); do + if [[ ${#link:t} -gt $max ]]; then + max=${#link:t} + fi + done + local printf_markname_template="$(printf -- "%%%us " "$max")" for link in $MARKPATH/*(@); do local markname="$fg[cyan]${link:t}$reset_color" local markpath="$fg[blue]$(readlink $link)$reset_color" - printf "%s\t" $markname - printf "-> %s \t\n" $markpath + printf -- "$printf_markname_template" "$markname" + printf -- "-> %s\n" "$markpath" done } diff --git a/plugins/kate/README.md b/plugins/kate/README.md new file mode 100644 index 000000000..aa2eaa3cc --- /dev/null +++ b/plugins/kate/README.md @@ -0,0 +1,20 @@ +# 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 | diff --git a/plugins/keychain/README.md b/plugins/keychain/README.md new file mode 100644 index 000000000..c603f6790 --- /dev/null +++ b/plugins/keychain/README.md @@ -0,0 +1,45 @@ +# keychain plugin + +This plugin starts automatically [`keychain`](https://www.funtoo.org/Keychain) +to set up and load whichever credentials you want for both gpg and ssh +connections. + +To enable it, add `keychain` to your plugins: + +```zsh +plugins=(... keychain) +``` + +**NOTE**: It is HIGHLY recommended to also enable the `gpg-agent` plugin. + +## Instructions + +**IMPORTANT: put these settings _before_ the line that sources oh-my-zsh** + +**To adjust the agents** that keychain manages, use the `agents` style as +shown below. By default, only the `gpg` agent is managed. + +```zsh +zstyle :omz:plugins:keychain agents gpg,ssh +``` + +To **load multiple identities** use the `identities` style, For example: + +```zsh +zstyle :omz:plugins:keychain identities id_ed25519 id_github 2C5879C2 +``` + +**To pass additional options** to the `keychain` program, use the +`options` style; for example: + +```zsh +zstyle :omz:plugins:keychain options --quiet +``` + +## Credits + +Based on code from the `ssh-agent` plugin. + +## References + +- [Keychain](https://www.funtoo.org/Keychain) diff --git a/plugins/keychain/keychain.plugin.zsh b/plugins/keychain/keychain.plugin.zsh new file mode 100644 index 000000000..af34793e7 --- /dev/null +++ b/plugins/keychain/keychain.plugin.zsh @@ -0,0 +1,32 @@ +function _start_agent() { + local agents + local -a identities + local -a options + local _keychain_env_sh + local _keychain_env_sh_gpg + + # load agents to start. + zstyle -s :omz:plugins:keychain agents agents + + # load identities to manage. + zstyle -a :omz:plugins:keychain identities identities + + # load additional options + zstyle -a :omz:plugins:keychain options options + + # start keychain... + keychain ${^options:-} --agents ${agents:-gpg} ${^identities} + + # Get the filenames to store/lookup the environment from + _keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh" + _keychain_env_sh_gpg="$HOME/.keychain/$SHORT_HOST-sh-gpg" + + # Source environment settings. + [ -f "$_keychain_env_sh" ] && . "$_keychain_env_sh" + [ -f "$_keychain_env_sh_gpg" ] && . "$_keychain_env_sh_gpg" +} + +_start_agent + +# tidy up after ourselves +unfunction _start_agent diff --git a/plugins/kitchen/README.md b/plugins/kitchen/README.md new file mode 100644 index 000000000..89a6d7002 --- /dev/null +++ b/plugins/kitchen/README.md @@ -0,0 +1,9 @@ +# 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) +``` diff --git a/plugins/kitchen/_kitchen b/plugins/kitchen/_kitchen index dee5c5809..29a3125e4 100644 --- a/plugins/kitchen/_kitchen +++ b/plugins/kitchen/_kitchen @@ -1,6 +1,6 @@ #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. # # Redistribution and use in source and binary forms, with or without @@ -28,7 +28,7 @@ # Description # ----------- # -# Completion script for Test Kitchen (http://kitchen.ci/). +# Completion script for Test Kitchen (https://kitchen.ci/). # # ------------------------------------------------------------------------------ # Authors diff --git a/plugins/kops/README.md b/plugins/kops/README.md new file mode 100644 index 000000000..5d9b5f8d6 --- /dev/null +++ b/plugins/kops/README.md @@ -0,0 +1,12 @@ +# 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) diff --git a/plugins/kops/kops.plugin.zsh b/plugins/kops/kops.plugin.zsh index f707f3aff..0c38ce2df 100644 --- a/plugins/kops/kops.plugin.zsh +++ b/plugins/kops/kops.plugin.zsh @@ -1,9 +1,3 @@ -# 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 source <(kops completion zsh) fi diff --git a/plugins/kube-ps1/README.md b/plugins/kube-ps1/README.md index a572773a3..19dac42e9 100644 --- a/plugins/kube-ps1/README.md +++ b/plugins/kube-ps1/README.md @@ -1,13 +1,12 @@ -Kubernetes prompt for zsh -========================= +# Kubernetes prompt for zsh -A Kubernetes (k8s) zsh prompt that displays the current cluster cluster +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. +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 @@ -32,29 +31,51 @@ fast switching between clusters and namespaces. The prompt layout is: ``` -(<logo>|<cluster>:<namespace>) +(<symbol>|<cluster>:<namespace>) ``` -Supported platforms: -* k8s - Kubernetes -* ocp - OpenShift +## Enabling -## Install +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. -1. Clone this repository -2. Source the kube-ps1.zsh in your ~./.zshrc +```shell +vim $HOME/.zshrc +``` + +Add kube-ps1 to the list of enabled plugins and enable it on the prompt: + +```shell +plugins=( + git + kube-ps1 +) -ZSH: +PROMPT=$PROMPT'$(kube_ps1) ' ``` -source path/kube-ps1.sh -PROMPT='$(kube_ps1) ' + +Note: the `PROMPT` example above was tested with the theme `robbyrussell` + +## Enabling / Disabling on the current shell + +Sometimes the kubernetes information can be anoying, you can easily +switch it on and off with the following commands: + +```shell +kubeon +``` + +```shell +kubeoff ``` ## Colors -The colors are of my opinion. 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. +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. Check the customization section for changing them. ## Customization @@ -62,15 +83,21 @@ The default settings can be overridden in ~/.zshrc | Variable | Default | Meaning | | :------- | :-----: | ------- | -| `KUBE_PS1_DEFAULT` | `true` | Default settings for the prompt | +| `KUBE_PS1_BINARY` | `kubectl` | Default Kubernetes binary | | `KUBE_PS1_PREFIX` | `(` | Prompt opening character | -| `KUBE_PS1_DEFAULT_LABEL` | `⎈ ` | Default prompt symbol | +| `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_PLATFORM` | `kubectl` | Cluster type and binary to use | | `KUBE_PS1_DIVIDER` | `:` | Separator between cluster and namespace | | `KUBE_PS1_SUFFIX` | `)` | Prompt closing character | -| `KUBE_PS1_DEFAULT_LABEL_IMG` | `false` | Use Kubernetes img as the label: ☸️ | +| `KUBE_PS1_COLOR_SYMBOL` | `"%F{blue}"` | Custom color for the symbol | +| `KUBE_PS1_COLOR_CONTEXT` | `"%F{red}"` | Custom color for the context | +| `KUBE_PS1_COLOR_NS` | `"%F{cyan}"` | Custom color for the namespace | +| `KUBE_PS1_ENABLED` | `true` | Set to false to start disabled on any new shell, `kubeon`/`kubeoff` will flip this value on the current shell | ## Contributors -Jared Yanovich +- Jared Yanovich +- Pedro Moranga
\ No newline at end of file diff --git a/plugins/kube-ps1/kube-ps1.plugin.zsh b/plugins/kube-ps1/kube-ps1.plugin.zsh new file mode 100644 index 000000000..8a751bda8 --- /dev/null +++ b/plugins/kube-ps1/kube-ps1.plugin.zsh @@ -0,0 +1,159 @@ +#!/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_ENABLED=true + +KUBE_PS1_COLOR_SYMBOL="%F{blue}" +KUBE_PS1_COLOR_CONTEXT="%F{red}" +KUBE_PS1_COLOR_NS="%F{cyan}" + +_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 +} + +# function to disable the prompt on the current shell +kubeon(){ + KUBE_PS1_ENABLED=true +} + +# function to disable the prompt on the current shell +kubeoff(){ + KUBE_PS1_ENABLED=false +} + +# Build our prompt +kube_ps1 () { + local reset_color="%{$reset_color%}" + [[ ${KUBE_PS1_ENABLED} != 'true' ]] && return + + KUBE_PS1="${reset_color}$KUBE_PS1_PREFIX" + KUBE_PS1+="${KUBE_PS1_COLOR_SYMBOL}$(_kube_ps1_symbol)" + KUBE_PS1+="${reset_color}$KUBE_PS1_SEPERATOR" + KUBE_PS1+="${KUBE_PS1_COLOR_CONTEXT}$KUBE_PS1_CONTEXT${reset_color}" + KUBE_PS1+="$KUBE_PS1_DIVIDER" + KUBE_PS1+="${KUBE_PS1_COLOR_NS}$KUBE_PS1_NAMESPACE${reset_color}" + KUBE_PS1+="$KUBE_PS1_SUFFIX" + + echo "${KUBE_PS1}" +} diff --git a/plugins/kube-ps1/kube-ps1.zsh b/plugins/kube-ps1/kube-ps1.zsh deleted file mode 100644 index e1cb4339d..000000000 --- a/plugins/kube-ps1/kube-ps1.zsh +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/zsh - -# Kubernetes prompt helper for bash/zsh -# Displays current context and namespace - -# Copyright 2017 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 -# -# http://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 -add-zsh-hook precmd _kube_ps1_load -zmodload zsh/stat - -# Default values for the prompt -# Override these values in ~/.zshrc or ~/.bashrc -KUBE_PS1_DEFAULT="${KUBE_PS1_DEFAULT:=true}" -KUBE_PS1_PREFIX="(" -KUBE_PS1_DEFAULT_LABEL="${KUBE_PS1_DEFAULT_LABEL:="⎈ "}" -KUBE_PS1_DEFAULT_LABEL_IMG="${KUBE_PS1_DEFAULT_LABEL_IMG:=false}" -KUBE_PS1_SEPERATOR="|" -KUBE_PS1_PLATFORM="${KUBE_PS1_PLATFORM:="kubectl"}" -KUBE_PS1_DIVIDER=":" -KUBE_PS1_SUFFIX=")" -KUBE_PS1_UNAME=$(uname) -KUBE_PS1_LAST_TIME=0 - -kube_ps1_label () { - - [[ "${KUBE_PS1_DEFAULT_LABEL_IMG}" == false ]] && return - - if [[ "${KUBE_PS1_DEFAULT_LABEL_IMG}" == true ]]; then - local KUBE_LABEL="☸️ " - fi - - KUBE_PS1_DEFAULT_LABEL="${KUBE_LABEL}" - -} - -_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 - mtime=$(stat +mtime "${file}") - - [ "${mtime}" -gt "${check_time}" ] - -} - -_kube_ps1_load() { - # kubectl will read the environment variable $KUBECONFIG - # otherwise set it to ~/.kube/config - KUBECONFIG="${KUBECONFIG:=$HOME/.kube/config}" - - for conf in $(_kube_ps1_split : "${KUBECONFIG}"); do - # TODO: check existence of $conf - 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=$(date +%s) - - if [[ "${KUBE_PS1_DEFAULT}" == true ]]; then - local KUBE_BINARY="${KUBE_PS1_PLATFORM}" - elif [[ "${KUBE_PS1_DEFAULT}" == false ]] && [[ "${KUBE_PS1_PLATFORM}" == "kubectl" ]];then - local KUBE_BINARY="kubectl" - elif [[ "${KUBE_PS1_PLATFORM}" == "oc" ]]; then - local KUBE_BINARY="oc" - fi - - KUBE_PS1_CONTEXT="$(${KUBE_BINARY} config current-context)" - KUBE_PS1_NAMESPACE="$(${KUBE_BINARY} config view --minify --output 'jsonpath={..namespace}')" - # Set namespace to default if it is not defined - KUBE_PS1_NAMESPACE="${KUBE_PS1_NAMESPACE:-default}" - -} - -# source our symbol -kube_ps1_label - -# 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_DEFAULT_LABEL" - 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}" - -} diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md new file mode 100644 index 000000000..3343f0195 --- /dev/null +++ b/plugins/kubectl/README.md @@ -0,0 +1,91 @@ +# 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 | +| kca | `kubectl --all-namespaces` | The kubectl command targeting all namespaces | +| 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 | +| kcn | `kubectl config set-context ...` | Change current namespace | +| 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 | +| kres | `kubectl set env $@ REFRESHED_AT=...` | Recreate all pods in deployment with zero-downtime | +| | | **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 | diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 97e429aac..ab7a1a0a4 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -1,56 +1,114 @@ -# Autocompletion for kubectl, the command line interface for Kubernetes -# -# Author: https://github.com/pstadler +if (( $+commands[kubectl] )); then + __KUBECTL_COMPLETION_FILE="${ZSH_CACHE_DIR}/kubectl_completion" -if [ $commands[kubectl] ]; then - source <(kubectl completion zsh) + if [[ ! -f $__KUBECTL_COMPLETION_FILE ]]; then + kubectl completion zsh >! $__KUBECTL_COMPLETION_FILE + fi + + [[ -f $__KUBECTL_COMPLETION_FILE ]] && source $__KUBECTL_COMPLETION_FILE + + unset __KUBECTL_COMPLETION_FILE 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 +# Execute a kubectl command against all namespaces +alias kca='f(){ kubectl "$@" --all-namespaces; unset -f f; }; f' + # Apply a YML file -alias kaf='k apply -f' +alias kaf='kubectl apply -f' # 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. -alias kcuc='k config use-context' -alias kcsc='k config set-context' -alias kcdc='k config delete-context' -alias kccc='k config current-context' +alias kcuc='kubectl config use-context' +alias kcsc='kubectl config set-context' +alias kcdc='kubectl config delete-context' +alias kccc='kubectl config current-context' + +# General aliases +alias kdel='kubectl delete' +alias kdelf='kubectl delete -f' # Pod management. -alias kgp='k get pods' -alias kep='k edit pods' -alias kdp='k describe pods' -alias kdelp='k delete pods' +alias kgp='kubectl get pods' +alias kgpw='kgp --watch' +alias kgpwide='kgp -o wide' +alias kep='kubectl edit pods' +alias kdp='kubectl describe pods' +alias kdelp='kubectl delete pods' + +# get pod by label: kgpl "app=myapp" -n myns +alias kgpl='kgp -l' # Service management. -alias kgs='k get svc' -alias kes='k edit svc' -alias kds='k describe svc' -alias kdels='k delete svc' +alias kgs='kubectl get svc' +alias kgsw='kgs --watch' +alias kgswide='kgs -o wide' +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' +alias kcn='kubectl config set-context $(kubectl config current-context) --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 -alias kgsec='k get secret' -alias kdsec='k describe secret' -alias kdelsec='k delete secret' +alias kgsec='kubectl get secret' +alias kdsec='kubectl describe secret' +alias kdelsec='kubectl delete secret' # Deployment management. -alias kgd='k get deployment' -alias ked='k edit deployment' -alias kdd='k describe deployment' -alias kdeld='k delete deployment' -alias ksd='k scale deployment' -alias krsd='k rollout status deployment' +alias kgd='kubectl get deployment' +alias kgdw='kgd --watch' +alias kgdwide='kgd -o wide' +alias ked='kubectl edit deployment' +alias kdd='kubectl describe deployment' +alias kdeld='kubectl delete deployment' +alias ksd='kubectl scale deployment' +alias krsd='kubectl rollout status deployment' +kres(){ + kubectl set env $@ REFRESHED_AT=$(date +%Y%m%d%H%M%S) +} # Rollout management. -alias kgrs='k get rs' -alias krh='k rollout history' -alias kru='k rollout undo' +alias kgrs='kubectl get rs' +alias krh='kubectl rollout history' +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='k logs' -alias klf='k logs -f' +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' diff --git a/plugins/laravel/README.md b/plugins/laravel/README.md new file mode 100644 index 000000000..44798b68d --- /dev/null +++ b/plugins/laravel/README.md @@ -0,0 +1,40 @@ +# Laravel + +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. + +``` +plugins=(... laravel) +``` + +| Alias | Description | +|:-:|:-:| +| `artisan` | `php artisan` | +| `pas` | `php artisan serve` | + +## Database + +| Alias | Description | +|:-:|:-:| +| `pam` | `php artisan migrate` | +| `pamf` | `php artisan migrate:fresh` | +| `pamfs` | `php artisan migrate:fresh --seed` | +| `pamr` | `php artisan migrate:rollback` | +| `pads` | `php artisan db:seed` | + +## Makers + +| Alias | Description | +|:-:|:-:| +| `pamm` | `php artisan make:model` | +| `pamc` | `php artisan make:controller` | +| `pams` | `php artisan make:seeder` | +| `pamt` | `php artisan make:test` | + +## Clears + +| Alias | Description | +|:-:|:-:| +| `pacac` | `php artisan cache:clear` | +| `pacoc` | `php artisan config:clear` | +| `pavic` | `php artisan view:clear` | +| `paroc` | `php artisan route:clear` | diff --git a/plugins/laravel/laravel.plugin.zsh b/plugins/laravel/laravel.plugin.zsh index ed932ee89..7ddfd85ba 100644 --- a/plugins/laravel/laravel.plugin.zsh +++ b/plugins/laravel/laravel.plugin.zsh @@ -1,3 +1,26 @@ #!zsh alias artisan='php artisan' alias bob='php artisan bob::build' + +# Development +alias pas='php artisan serve' + +# Database +alias pam='php artisan migrate' +alias pamf='php artisan migrate:fresh' +alias pamfs='php artisan migrate:fresh --seed' +alias pamr='php artisan migrate:rollback' +alias pads='php artisan db:seed' + +# Makers +alias pamm='php artisan make:model' +alias pamc='php artisan make:controller' +alias pams='php artisan make:seeder' +alias pamt='php artisan make:test' + + +# Clears +alias pacac='php artisan cache:clear' +alias pacoc='php artisan config:clear' +alias pavic='php artisan view:clear' +alias paroc='php artisan route:clear' diff --git a/plugins/laravel4/README.md b/plugins/laravel4/README.md new file mode 100644 index 000000000..c945601f7 --- /dev/null +++ b/plugins/laravel4/README.md @@ -0,0 +1,18 @@ +# 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 | diff --git a/plugins/laravel5/README.md b/plugins/laravel5/README.md new file mode 100644 index 000000000..933342a9e --- /dev/null +++ b/plugins/laravel5/README.md @@ -0,0 +1,18 @@ +# 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 | diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh index e882b288f..53bb19e46 100644 --- a/plugins/last-working-dir/last-working-dir.plugin.zsh +++ b/plugins/last-working-dir/last-working-dir.plugin.zsh @@ -4,8 +4,10 @@ typeset -g ZSH_LAST_WORKING_DIRECTORY # Updates the last directory once directory is changed chpwd_functions+=(chpwd_last_working_dir) chpwd_last_working_dir() { - local cache_file="$ZSH_CACHE_DIR/last-working-dir" - pwd >| "$cache_file" + if [ "$ZSH_SUBSHELL" = 0 ]; then + local cache_file="$ZSH_CACHE_DIR/last-working-dir" + pwd >| "$cache_file" + fi } # Changes directory to the last working directory diff --git a/plugins/lein/_lein b/plugins/lein/_lein new file mode 100644 index 000000000..9d022e968 --- /dev/null +++ b/plugins/lein/_lein @@ -0,0 +1,69 @@ +#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/" +} diff --git a/plugins/lein/lein.plugin.zsh b/plugins/lein/lein.plugin.zsh deleted file mode 100644 index f4e50b447..000000000 --- a/plugins/lein/lein.plugin.zsh +++ /dev/null @@ -1,43 +0,0 @@ -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 diff --git a/plugins/lighthouse/README.md b/plugins/lighthouse/README.md new file mode 100644 index 000000000..0db29b4e5 --- /dev/null +++ b/plugins/lighthouse/README.md @@ -0,0 +1,26 @@ +# Lighthouse plugin + +This plugin adds commands to manage [Lighthouse](https://lighthouseapp.com/). + +To use it, add `lighthouse` to the plugins array in your zshrc file: + +```zsh +plugins=(... lighthouse) +``` + +## Commands + +* `open_lighthouse_ticket <issue>` (alias: `lho`): + + Opens the URL to the issue passed as an argument. To use it, add a `.lighthouse-url` + file in your directory with the URL to the individual project. + + Example: + ```zsh + $ cat .lighthouse-url + https://rails.lighthouseapp.com/projects/8994 + + $ lho 23 + Opening ticket #23 + # The browser goes to https://rails.lighthouseapp.com/projects/8994/tickets/23 + ``` diff --git a/plugins/lighthouse/lighthouse.plugin.zsh b/plugins/lighthouse/lighthouse.plugin.zsh index 48cddbccc..3fca2bf4f 100644 --- a/plugins/lighthouse/lighthouse.plugin.zsh +++ b/plugins/lighthouse/lighthouse.plugin.zsh @@ -1,16 +1,12 @@ -# To use: add a .lighthouse file into your directory with the URL to the -# individual project. For example: -# https://rails.lighthouseapp.com/projects/8994 -# Example usage: http://screencast.com/t/ZDgwNDUwNT open_lighthouse_ticket () { if [ ! -f .lighthouse-url ]; then echo "There is no .lighthouse-url file in the current directory..." - return 0; - else - lighthouse_url=$(cat .lighthouse-url); - echo "Opening ticket #$1"; - open_command "$lighthouse_url/tickets/$1"; + return 0 fi + + lighthouse_url=$(cat .lighthouse-url) + echo "Opening ticket #$1" + open_command "$lighthouse_url/tickets/$1" } alias lho='open_lighthouse_ticket' diff --git a/plugins/lol/README.md b/plugins/lol/README.md new file mode 100644 index 000000000..b0e54f575 --- /dev/null +++ b/plugins/lol/README.md @@ -0,0 +1,83 @@ +# 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 +``` diff --git a/plugins/lol/lol.plugin.zsh b/plugins/lol/lol.plugin.zsh index e9a62a863..585f96e4f 100644 --- a/plugins/lol/lol.plugin.zsh +++ b/plugins/lol/lol.plugin.zsh @@ -1,5 +1,5 @@ # 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 onoz='cat /var/log/errors.log' @@ -45,7 +45,7 @@ alias bringz='git pull' alias chicken='git add' alias oanward='git commit -m' alias ooanward='git commit -am' -alias yolo='git commit -m "$(curl -s whatthecommit.com/index.txt)"' +alias yolo='git commit -m "$(curl -s https://whatthecommit.com/index.txt)"' alias letcat='git checkout' alias violenz='git rebase' diff --git a/plugins/macports/README.md b/plugins/macports/README.md new file mode 100644 index 000000000..ded823f3f --- /dev/null +++ b/plugins/macports/README.md @@ -0,0 +1,21 @@ +# 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 | diff --git a/plugins/macports/macports.plugin.zsh b/plugins/macports/macports.plugin.zsh index 277352e32..d1fde30d4 100644 --- a/plugins/macports/macports.plugin.zsh +++ b/plugins/macports/macports.plugin.zsh @@ -1,8 +1,6 @@ -#Aliases alias pc="sudo port clean --all installed" -alias pi="sudo port install $1" +alias pi="sudo port install" alias psu="sudo port selfupdate" alias puni="sudo port uninstall inactive" alias puo="sudo port upgrade outdated" alias pup="psu && puo" - diff --git a/plugins/magic-enter/Readme.md b/plugins/magic-enter/Readme.md new file mode 100644 index 000000000..b401ab415 --- /dev/null +++ b/plugins/magic-enter/Readme.md @@ -0,0 +1,14 @@ +## 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) +``` diff --git a/plugins/magic-enter/magic-enter.plugin.zsh b/plugins/magic-enter/magic-enter.plugin.zsh new file mode 100644 index 000000000..8e1859678 --- /dev/null +++ b/plugins/magic-enter/magic-enter.plugin.zsh @@ -0,0 +1,24 @@ +# 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 diff --git a/plugins/man/README.md b/plugins/man/README.md new file mode 100644 index 000000000..4601252c0 --- /dev/null +++ b/plugins/man/README.md @@ -0,0 +1,13 @@ +# 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 | diff --git a/plugins/man/man.zsh b/plugins/man/man.plugin.zsh index 3490b0b61..94aa4918d 100644 --- a/plugins/man/man.zsh +++ b/plugins/man/man.plugin.zsh @@ -5,7 +5,7 @@ # * Jerry Ling<jerryling315@gmail.com> # # ------------------------------------------------------------------------------ -# Usgae +# Usage # ----- # # man will be inserted before the command @@ -24,4 +24,4 @@ bindkey "\e"man man-command-line # ------------------------------------------------------------------------------ # 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 -# the .zshrc
\ No newline at end of file +# the .zshrc diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index 3ae59496e..58bc571a0 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -1,4 +1,5 @@ # Mercurial +alias hga='hg add' alias hgc='hg commit' alias hgb='hg branch' alias hgba='hg branches' diff --git a/plugins/meteor/_meteor b/plugins/meteor/_meteor index cd7fc304f..6a15c4bc2 100644 --- a/plugins/meteor/_meteor +++ b/plugins/meteor/_meteor @@ -13,19 +13,38 @@ _meteor_installed_packages() { local -a _1st_arguments _1st_arguments=( - 'run:[Default] Run this project in local development mode' - 'create:Create a new project' - 'update:Upgrade this project to the latest version of Meteor' - 'add:Add a package to this project' - 'remove:Remove a package from this project' - 'list:List available packages' - 'help:Display Meteor help' - 'bundle:Pack this project up into a tarball' - 'mongo:Connect to the Mongo database for the specified site' - 'deploy:Deploy this project to Meteor' - 'logs:Show logs for specified site' - 'reset:Reset the project state. Erases the local database.' - 'test-packages:Test one or more packages' + "add-platform:Add a platform to this project." + "add:Add a package to this project." + "admin:Administrative commands." + "authorized:View or change authorized users and organizations for a site." + "build:Build this project for all platforms." + "claim:Claim a site deployed with an old Meteor version." + "configure-android:Run the Android configuration tool from Meteor's ADK environment." + "create:Create a new project." + "debug:Run the project, but suspend the server process for debugging." + "deploy:Deploy this project to Meteor." + "install-sdk:Installs SDKs for a platform." + "lint:Build this project and run the linters printing all errors and warnings." + "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 @@ -45,4 +64,4 @@ case "$words[2]" in add) _meteor_all_packages _wanted packages expl 'all packages' compadd -a packages ;; -esac
\ No newline at end of file +esac diff --git a/plugins/minikube/README.md b/plugins/minikube/README.md new file mode 100644 index 000000000..eb2dd9b46 --- /dev/null +++ b/plugins/minikube/README.md @@ -0,0 +1,9 @@ +# 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) +``` diff --git a/plugins/minikube/minikube.plugin.zsh b/plugins/minikube/minikube.plugin.zsh new file mode 100644 index 000000000..d8ebe79af --- /dev/null +++ b/plugins/minikube/minikube.plugin.zsh @@ -0,0 +1,6 @@ +# Autocompletion for Minikube. +# + +if [ $commands[minikube] ]; then + source <(minikube completion zsh) +fi diff --git a/plugins/mix-fast/README.md b/plugins/mix-fast/README.md index 9a5eccc3f..644f12409 100644 --- a/plugins/mix-fast/README.md +++ b/plugins/mix-fast/README.md @@ -8,7 +8,7 @@ to update cache you should remove .mix_tasks file 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 @@ -25,4 +25,4 @@ You might consider adding `.mix_tasks` to your [global .gitignore](https://help. `mix`, then press tab -Currently maintained by [styx](https://github.com/styx/)
\ No newline at end of file +Currently maintained by [styx](https://github.com/styx/) diff --git a/plugins/mix-fast/mix-fast.plugin.zsh b/plugins/mix-fast/mix-fast.plugin.zsh index 3719c3525..e27e30d64 100644 --- a/plugins/mix-fast/mix-fast.plugin.zsh +++ b/plugins/mix-fast/mix-fast.plugin.zsh @@ -12,7 +12,7 @@ _mix_does_task_list_need_generating () { } _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 () { diff --git a/plugins/mix/README.md b/plugins/mix/README.md new file mode 100644 index 000000000..878f370f2 --- /dev/null +++ b/plugins/mix/README.md @@ -0,0 +1,19 @@ +# 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/) | diff --git a/plugins/mix/_mix b/plugins/mix/_mix index 025572a4d..61fa1cf25 100644 --- a/plugins/mix/_mix +++ b/plugins/mix/_mix @@ -21,7 +21,19 @@ _1st_arguments=( 'deps.unlock:Unlock the given dependencies' 'deps.update:Update the given dependencies' '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' + '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' 'hex:Print hex help information' 'hex.config:Read or update hex config' @@ -39,6 +51,11 @@ _1st_arguments=( 'local.phoenix:Updates Phoenix locally' 'local.phx:Updates the Phoenix project generator 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' 'phoenix.digest:Digests and compress static files' 'phoenix.gen.channel:Generates a Phoenix channel' diff --git a/plugins/mosh/README.md b/plugins/mosh/README.md new file mode 100644 index 000000000..4bbecf478 --- /dev/null +++ b/plugins/mosh/README.md @@ -0,0 +1,9 @@ +# 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) +``` diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md index 986ac84a4..88f5be8ba 100644 --- a/plugins/mvn/README.md +++ b/plugins/mvn/README.md @@ -1,7 +1,7 @@ -## Introduction +# mvn plugin -The [mvn plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/mvn) provides many -[useful aliases](#aliases) as well as completion for the `mvn` command. +The mvn plugin provides many [useful aliases](#aliases) as well as completion for +the [Apache Maven](https://maven.apache.org/) command (`mvn`). Enable it by adding `mvn` to the plugins array in your zshrc file: ```zsh @@ -10,25 +10,49 @@ plugins=(... mvn) ## Aliases +The plugin aliases mvn to a function that calls `mvnw` (the [Maven Wrapper](https://github.com/takari/maven-wrapper)) +if it's found, or the mvn command otherwise. + | Alias | Command | |:---------------------|:------------------------------------------------| -| `mvncie` | `mvn clean install eclipse:eclipse` | +| `mvn!` | `mvn -f <root>/pom.xml` | +| `mvnag` | `mvn archetype:generate` | +| `mvnboot` | `mvn spring-boot:run` | +| `mvnc` | `mvn clean` | +| `mvncd` | `mvn clean deploy` | +| `mvnce` | `mvn clean eclipse:clean eclipse:eclipse` | | `mvnci` | `mvn clean install` | +| `mvncie` | `mvn clean install eclipse:eclipse` | +| `mvncini` | `mvn clean initialize` | | `mvncist` | `mvn clean install -DskipTests` | | `mvncisto` | `mvn clean install -DskipTests --offline` | -| `mvne` | `mvn eclipse:eclipse` | -| `mvncv` | `mvn clean verify` | -| `mvnd` | `mvn deploy` | -| `mvnp` | `mvn package` | -| `mvnc` | `mvn clean` | | `mvncom` | `mvn compile` | +| `mvncp` | `mvn clean package` | | `mvnct` | `mvn clean test` | -| `mvnt` | `mvn test` | -| `mvnag` | `mvn archetype:generate` | -| `mvn-updates` | `mvn versions:display-dependency-updates` | -| `mvntc7` | `mvn tomcat7:run` | -| `mvnjetty` | `mvn jetty:run` | +| `mvncv` | `mvn clean verify` | +| `mvncvst` | `mvn clean verify -DskipTests` | +| `mvnd` | `mvn deploy` | +| `mvndocs` | `mvn dependency:resolve -Dclassifier=javadoc` | | `mvndt` | `mvn dependency:tree` | +| `mvne` | `mvn eclipse:eclipse` | +| `mvnjetty` | `mvn jetty:run` | +| `mvnp` | `mvn package` | | `mvns` | `mvn site` | | `mvnsrc` | `mvn dependency:sources` | -| `mvndocs` | `mvn dependency:resolve -Dclassifier=javadoc` | +| `mvnt` | `mvn test` | +| `mvntc` | `mvn tomcat:run` | +| `mvntc7` | `mvn tomcat7:run` | +| `mvn-updates` | `mvn versions:display-dependency-updates` | + +## mvn-color + +It's a function that wraps the mvn command to colorize it's output. You can use it in place +of the `mvn` command. For example: instead of `mvn test`, use `mvn-color test`. + +Since [Maven 3.5.0](https://maven.apache.org/docs/3.5.0/release-notes.html) the mvn command +has colored output, so this function will be soon removed from the plugin. + +### Known bugs + +It has a bug where it will swallow mvn prompts for user input, _e.g._ when using +`archetype:generate`. See [#5052](https://github.com/robbyrussell/oh-my-zsh/issues/5052). diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index ee6fe2770..01aef814d 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -1,276 +1,325 @@ -# mvn-color based on https://gist.github.com/1027800 -BOLD=$(tput bold) -UNDERLINE_ON=$(tput smul) -UNDERLINE_OFF=$(tput rmul) -TEXT_BLACK=$(tput setaf 0) -TEXT_RED=$(tput setaf 1) -TEXT_GREEN=$(tput setaf 2) -TEXT_YELLOW=$(tput setaf 3) -TEXT_BLUE=$(tput setaf 4) -TEXT_MAGENTA=$(tput setaf 5) -TEXT_CYAN=$(tput setaf 6) -TEXT_WHITE=$(tput setaf 7) -BACKGROUND_BLACK=$(tput setab 0) -BACKGROUND_RED=$(tput setab 1) -BACKGROUND_GREEN=$(tput setab 2) -BACKGROUND_YELLOW=$(tput setab 3) -BACKGROUND_BLUE=$(tput setab 4) -BACKGROUND_MAGENTA=$(tput setab 5) -BACKGROUND_CYAN=$(tput setab 6) -BACKGROUND_WHITE=$(tput setab 7) -RESET_FORMATTING=$(tput sgr0) - +# Calls ./mvnw if found, otherwise execute the original mvn +mvn-or-mvnw() { + if [ -x ./mvnw ]; then + echo "executing mvnw instead of mvn" + ./mvnw "$@" + else + command mvn "$@" + fi +} -# Wrapper function for Maven's mvn command. +# Wrapper function for Maven's mvn command. Based on https://gist.github.com/1027800 mvn-color() { - ( - # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations - unset LANG - LC_CTYPE=C mvn "$@" | sed -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ - -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \ - -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \ - -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g" - - # Make sure formatting is reset - echo -ne "${RESET_FORMATTING}" - ) + local BOLD=$(echoti bold) + local TEXT_RED=$(echoti setaf 1) + local TEXT_GREEN=$(echoti setaf 2) + local TEXT_YELLOW=$(echoti setaf 3) + local TEXT_BLUE=$(echoti setaf 4) + local TEXT_WHITE=$(echoti setaf 7) + local RESET_FORMATTING=$(echoti sgr0) + ( + # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations + unset LANG + LC_CTYPE=C mvn "$@" | sed \ + -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[DEBUG\]\)\(.*\)/${TEXT_WHITE}${BOLD}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \ + -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \ + -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g" + + # Make sure formatting is reset + echo -ne "${RESET_FORMATTING}" + ) } -# Override the mvn command with the colorized one. -#alias mvn="mvn-color" +# either use orignal mvn or the mvn wrapper +alias mvn="mvn-or-mvnw" + +# Run mvn against the pom found in a project's root directory (assumes a git repo) +alias 'mvn!'='mvn -f $(git rev-parse --show-toplevel 2>/dev/null || echo ".")/pom.xml' # aliases -alias mvncie='mvn clean install eclipse:eclipse' +alias mvnag='mvn archetype:generate' +alias mvnboot='mvn spring-boot:run' +alias mvnc='mvn clean' +alias mvncd='mvn clean deploy' +alias mvnce='mvn clean eclipse:clean eclipse:eclipse' alias mvnci='mvn clean install' +alias mvncie='mvn clean install eclipse:eclipse' +alias mvncini='mvn clean initialize' alias mvncist='mvn clean install -DskipTests' alias mvncisto='mvn clean install -DskipTests --offline' -alias mvne='mvn eclipse:eclipse' -alias mvnce='mvn clean eclipse:clean eclipse:eclipse' -alias mvncv='mvn clean verify' -alias mvnd='mvn deploy' -alias mvnp='mvn package' -alias mvnc='mvn clean' alias mvncom='mvn compile' +alias mvncp='mvn clean package' alias mvnct='mvn clean test' -alias mvnt='mvn test' -alias mvnag='mvn archetype:generate' -alias mvn-updates='mvn versions:display-dependency-updates' -alias mvntc7='mvn tomcat7:run' -alias mvntc='mvn tomcat:run' -alias mvnjetty='mvn jetty:run' +alias mvncv='mvn clean verify' +alias mvncvst='mvn clean verify -DskipTests' +alias mvnd='mvn deploy' +alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' alias mvndt='mvn dependency:tree' +alias mvne='mvn eclipse:eclipse' +alias mvnjetty='mvn jetty:run' +alias mvnp='mvn package' alias mvns='mvn site' alias mvnsrc='mvn dependency:sources' -alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' +alias mvnt='mvn test' +alias mvntc='mvn tomcat:run' +alias mvntc7='mvn tomcat7:run' +alias mvn-updates='mvn versions:display-dependency-updates' + + +function listMavenCompletions { + local file new_file + local -a profiles POM_FILES + + # Root POM + POM_FILES=(~/.m2/settings.xml) + + # POM in the current directory + if [[ -f pom.xml ]]; then + local file=pom.xml + POM_FILES+=("${file:A}") + fi + + # Look for POM files in parent directories + while [[ -n "$file" ]] && grep -q "<parent>" "$file"; do + # look for a new relativePath for parent pom.xml + new_file=$(grep -e "<relativePath>.*</relativePath>" "$file" | sed -e 's/.*<relativePath>\(.*\)<\/relativePath>.*/\1/') + + # if <parent> is present but not defined, assume ../pom.xml + if [[ -z "$new_file" ]]; then + new_file="../pom.xml" + fi + + # if file doesn't exist break + file="${file:h}/${new_file}" + if ! [[ -e "$file" ]]; then + break + fi + + POM_FILES+=("${file:A}") + done + + # Get profiles from found files + for file in $POM_FILES; do + [[ -e $file ]] || continue + profiles+=($(sed 's/<!--.*-->//' "$file" | sed '/<!--/,/-->/d' | grep -e "<profile>" -A 1 | grep -e "<id>.*</id>" | sed 's?.*<id>\(.*\)<\/id>.*?-P\1?')) + done + + reply=( + # common lifecycle + clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site + + # integration testing + pre-integration-test integration-test + + # common plugins + deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt -function listMavenCompletions { - reply=( - # common lifecycle - clean process-resources compile process-test-resources test-compile test integration-test package verify install deploy site + # deploy + deploy:deploy-file + # failsafe + failsafe:integration-test failsafe:verify + # install + install:install-file install:help + # site + site:site site:deploy site:run site:stage site:stage-deploy site:attach-descriptor site:jar site:effective-site + # surefire + surefire:test - # common plugins - deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt + # checkstyle + checkstyle:checkstyle checkstyle:check checkstyle:checkstyle-aggregate + # javadoc + javadoc:javadoc javadoc:test-javadoc javadoc:javadoc-no-fork javadoc:test-javadoc-no-fork javadoc:aggregate javadoc:test-aggregate javadoc:jar javadoc:test-jar javadoc:aggregate-jar javadoc:test-aggregate-jar javadoc:fix javadoc:test-fix javadoc:resource-bundle javadoc:test-resource-bundle + # jxr + jxr:jxr jxr:aggregate jxr:test-jxr jxr:test-aggregate + # pmd + pmd:pmd pmd:cpd pmd:check pmd:cpd-check - # deploy - deploy:deploy-file - # failsafe - failsafe:integration-test failsafe:verify - # install - install:install-file install:help - # site - site:site site:deploy site:run site:stage site:stage-deploy site:attach-descriptor site:jar site:effective-site - # surefire - surefire:test + # ant + ant:ant ant:clean + # antrun + antrun:run + # archetype + archetype:generate archetype:create-from-project archetype:crawl + # assembly + assembly:single assembly:assembly + # dependency + dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:analyze-duplicate dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:display-ancestors dependency:get dependency:go-offline dependency:list dependency:list-repositories dependency:properties dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies + # enforcer + enforcer:enforce enforcer:display-info + # gpg + gpg:sign gpg:sign-and-deploy-file + # help + help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system + # release + release:clean release:prepare release:prepare-with-pom release:rollback release:perform release:stage release:branch release:update-versions + # jgitflow + jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number + # repository + repository:bundle-create repository:bundle-pack + # source + source:aggregate source:jar source:jar-no-fork source:test-jar source:test-jar-no-fork - # checkstyle - checkstyle:checkstyle checkstyle:check checkstyle:checkstyle-aggregate - # javadoc - javadoc:javadoc javadoc:test-javadoc javadoc:javadoc-no-fork javadoc:test-javadoc-no-fork javadoc:aggregate javadoc:test-aggregate javadoc:jar javadoc:test-jar javadoc:aggregate-jar javadoc:test-aggregate-jar javadoc:fix javadoc:test-fix javadoc:resource-bundle javadoc:test-resource-bundle - # jxr - jxr:jxr jxr:aggregate jxr:test-jxr jxr:test-aggregate - # pmd - pmd:pmd pmd:cpd pmd:check pmd:cpd-check + # eclipse + eclipse:clean eclipse:eclipse + # idea + idea:clean idea:idea - # ant - ant:ant ant:clean - # antrun - antrun:run - # archetype - archetype:generate archetype:create-from-project archetype:crawl - # assembly - assembly:single assembly:assembly - # dependency - dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:analyze-duplicate dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:display-ancestors dependency:get dependency:go-offline dependency:list dependency:list-repositories dependency:properties dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies - # enforcer - enforcer:enforce enforcer:display-info - # gpg - gpg:sign gpg:sign-and-deploy-file - # help - help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system - # release - release:clean release:prepare release:prepare-with-pom release:rollback release:perform release:stage release:branch release:update-versions - # jgitflow - jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number - # repository - repository:bundle-create repository:bundle-pack - # source - source:aggregate source:jar source:jar-no-fork source:test-jar source:test-jar-no-fork + # jetty + jetty:run jetty:run-exploded + # cargo + cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help + # jboss + jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy + # tomcat + tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:redeploy + # tomcat6 + tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy + # tomcat7 + tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy + # tomee + tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy + # spring-boot + spring-boot:run spring-boot:repackage + # exec + exec:exec exec:java + # versions + versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert + # scm + scm:add scm:bootstrap scm:branch scm:changelog scm:check-local-modification scm:checkin scm:checkout scm:diff scm:edit scm:export scm:list scm:remove scm:status scm:tag scm:unedit scm:update scm:update-subprojects scm:validate + # buildnumber + buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset - # eclipse - eclipse:clean eclipse:eclipse - # idea - idea:clean idea:idea + # war + war:war war:exploded war:inplace war:manifest + # ear + ear:ear ear:generate-application-xml + # ejb + ejb:ejb + # android + android:apk android:apklib android:deploy android:deploy-dependencies android:dex android:emulator-start android:emulator-stop android:emulator-stop-all android:generate-sources android:help android:instrument android:manifest-update android:pull android:push android:redeploy android:run android:undeploy android:unpack android:version-update android:zipalign android:devices + # nexus + nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download + # repository + repository:bundle-create repository:bundle-pack repository:help - # jetty - jetty:run jetty:run-exploded - # cargo - cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help - # jboss - jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy - # tomcat - tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:redeploy - # tomcat6 - tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy - # tomcat7 - tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy - # tomee - tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy - # spring-boot - spring-boot:run spring-boot:repackage - # exec - exec:exec exec:java - # versions - versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert - # scm - scm:add scm:bootstrap scm:branch scm:changelog scm:check-local-modification scm:checkin scm:checkout scm:diff scm:edit scm:export scm:list scm:remove scm:status scm:tag scm:unedit scm:update scm:update-subprojects scm:validate - # buildnumber - buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset + # sonar + sonar:sonar + # license + license:format license:check + # hibernate3 + hibernate3:hbm2ddl hibernate3:help + # liquibase + liquibase:changelogSync liquibase:changelogSyncSQL liquibase:clearCheckSums liquibase:dbDoc liquibase:diff liquibase:dropAll liquibase:help liquibase:migrate liquibase:listLocks liquibase:migrateSQL liquibase:releaseLocks liquibase:rollback liquibase:rollbackSQL liquibase:status liquibase:tag liquibase:update liquibase:updateSQL liquibase:updateTestingRollback + # flyway + flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate + # gwt + gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test + # asciidoctor + asciidoctor:process-asciidoc asciidoctor:auto-refresh asciidoctor:http asciidoctor:zip + # compiler + compiler:compile compiler:testCompile + # resources + resources:resources resources:testResources resources:copy-resources + # verifier + verifier:verify + # jar + jar:jar jar:test-jar + # rar + rar:rar + # acr + acr:acr + # shade + shade:shade + # changelog + changelog:changelog changelog:dev-activity changelog:file-activity + # changes + changes:announcement-mail changes:announcement-generate changes:changes-check changes:changes-validate changes:changes-report changes:jira-report changes:trac-report changes:github-report + # doap + doap:generate + # docck + docck:check + # jdeps + jdeps:jdkinternals jdeps:test-jdkinternals + # linkcheck + linkcheck:linkcheck + # project-info-reports + project-info-reports:cim project-info-reports:dependencies project-info-reports:dependency-convergence project-info-reports:dependency-info project-info-reports:dependency-management project-info-reports:distribution-management project-info-reports:help project-info-reports:index project-info-reports:issue-tracking project-info-reports:license project-info-reports:mailing-list project-info-reports:modules project-info-reports:plugin-management project-info-reports:plugins project-info-reports:project-team project-info-reports:scm project-info-reports:summary + # surefire-report + surefire-report:failsafe-report-only surefire-report:report surefire-report:report-only + # invoker + invoker:install invoker:integration-test invoker:verify invoker:run + # jarsigner + jarsigner:sign jarsigner:verify + # patch + patch:apply + # pdf + pdf:pdf + # plugin + plugin:descriptor plugin:report plugin:updateRegistry plugin:addPluginArtifactMetadata plugin:helpmojo + # remote-resources + remote-resources:bundle remote-resources:process + # scm-publish + scm-publish:help scm-publish:publish-scm scm-publish:scmpublish + # stage + stage:copy + # toolchain + toolchain:toolchain - # war - war:war war:exploded war:inplace war:manifest - # ear - ear:ear ear:generate-application-xml - # ejb - ejb:ejb - # android - android:apk android:apklib android:deploy android:deploy-dependencies android:dex android:emulator-start android:emulator-stop android:emulator-stop-all android:generate-sources android:help android:instrument android:manifest-update android:pull android:push android:redeploy android:run android:undeploy android:unpack android:version-update android:zipalign android:devices - # nexus - nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download - # repository - repository:bundle-create repository:bundle-pack repository:help + # options + "-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile=" - # sonar - sonar:sonar - # license - license:format license:check - # hibernate3 - hibernate3:hbm2ddl hibernate3:help - # liquibase - liquibase:changelogSync liquibase:changelogSyncSQL liquibase:clearCheckSums liquibase:dbDoc liquibase:diff liquibase:dropAll liquibase:help liquibase:migrate liquibase:listLocks liquibase:migrateSQL liquibase:releaseLocks liquibase:rollback liquibase:rollbackSQL liquibase:status liquibase:tag liquibase:update liquibase:updateSQL liquibase:updateTestingRollback - # flyway - flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate - # gwt - gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test - # asciidoctor - asciidoctor:process-asciidoc asciidoctor:auto-refresh asciidoctor:http asciidoctor:zip - # compiler - compiler:compile compiler:testCompile - # resources - resources:resources resources:testResources resources:copy-resources - # verifier - verifier:verify - # jar - jar:jar jar:test-jar - # rar - rar:rar - # acr - acr:acr - # shade - shade:shade - # changelog - changelog:changelog changelog:dev-activity changelog:file-activity - # changes - changes:announcement-mail changes:announcement-generate changes:changes-check changes:changes-validate changes:changes-report changes:jira-report changes:trac-report changes:github-report - # doap - doap:generate - # docck - docck:check - # jdeps - jdeps:jdkinternals jdeps:test-jdkinternals - # linkcheck - linkcheck:linkcheck - # project-info-reports - project-info-reports:cim project-info-reports:dependencies project-info-reports:dependency-convergence project-info-reports:dependency-info project-info-reports:dependency-management project-info-reports:distribution-management project-info-reports:help project-info-reports:index project-info-reports:issue-tracking project-info-reports:license project-info-reports:mailing-list project-info-reports:modules project-info-reports:plugin-management project-info-reports:plugins project-info-reports:project-team project-info-reports:scm project-info-reports:summary - # surefire-report - surefire-report:failsafe-report-only surefire-report:report surefire-report:report-only - # invoker - invoker:install invoker:integration-test invoker:verify invoker:run - # jarsigner - jarsigner:sign jarsigner:verify - # patch - patch:apply - # pdf - pdf:pdf - # plugin - plugin:descriptor plugin:report plugin:updateRegistry plugin:addPluginArtifactMetadata plugin:helpmojo - # remote-resources - remote-resources:bundle remote-resources:process - # scm-publish - scm-publish:help scm-publish:publish-scm scm-publish:scmpublish - # stage - stage:copy - # toolchain - toolchain:toolchain - - # options - "-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile=" + # arguments + -am --also-make + -amd --also-make-dependents-am + -B --batch-mode + -b --builder + -C --strict-checksums + -c --lax-checksums + -cpu --check-plugin-updates + -D --define + -e --errors + -emp --encrypt-master-password + -ep --encrypt-password + -f --file + -fae --fail-at-end + -ff --fail-fast + -fn --fail-never + -gs --global-settings + -gt --global-toolchains + -h --help + -l --log-file + -llr --legacy-local-repository + -N --non-recursive + -npr --no-plugin-registry + -npu --no-plugin-updates + -nsu --no-snapshot-updates + -o --offline + -P --activate-profiles + -pl --projects + -q --quiet + -rf --resume-from + -s --settings + -t --toolchains + -T --threads + -U --update-snapshots + -up --update-plugins + -v --version + -V --show-version + -X --debug - # arguments - -am --also-make - -amd --also-make-dependents-am - -B --batch-mode - -b --builder - -C --strict-checksums - -c --lax-checksums - -cpu --check-plugin-updates - -D --define - -e --errors - -emp --encrypt-master-password - -ep --encrypt-password - -f --file - -fae --fail-at-end - -ff --fail-fast - -fn --fail-never - -gs --global-settings - -gt --global-toolchains - -h --help - -l --log-file - -llr --legacy-local-repository - -N --non-recursive - -npr --no-plugin-registry - -npu --no-plugin-updates - -nsu --no-snapshot-updates - -o --offline - -P --activate-profiles - -pl --projects - -q --quiet - -rf --resume-from - -s --settings - -t --toolchains - -T --threads - -U --update-snapshots - -up --update-plugins - -v --version - -V --show-version - -X --debug + cli:execute cli:execute-phase + archetype:generate generate-sources + cobertura:cobertura + -Dtest=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi) + -Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi) - cli:execute cli:execute-phase - archetype:generate generate-sources - cobertura:cobertura - -Dtest=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi) - -Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi) - ); + $profiles + ) } -compctl -K listMavenCompletions mvn +compctl -K listMavenCompletions mvn mvnw +compctl -K listMavenCompletions mvn-color +compctl -K listMavenCompletions mvn-or-mvnw diff --git a/plugins/n98-magerun/n98-magerun.plugin.zsh b/plugins/n98-magerun/n98-magerun.plugin.zsh index bfcf27b98..bfcf27b98 100755..100644 --- a/plugins/n98-magerun/n98-magerun.plugin.zsh +++ b/plugins/n98-magerun/n98-magerun.plugin.zsh diff --git a/plugins/nanoc/README.md b/plugins/nanoc/README.md new file mode 100644 index 000000000..d5d437d8a --- /dev/null +++ b/plugins/nanoc/README.md @@ -0,0 +1,20 @@ +# 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) | diff --git a/plugins/nanoc/_nanoc b/plugins/nanoc/_nanoc index fde07c3fc..a6a4792ad 100644 --- a/plugins/nanoc/_nanoc +++ b/plugins/nanoc/_nanoc @@ -1,28 +1,21 @@ #compdef nanoc #autoload -# nanoc zsh completion - based on the homebrew zsh completion # requires the 'nanoc' gem to be installed local -a _1st_arguments _1st_arguments=( - 'autocompile:start the autocompiler' + 'check:run issue checks' 'compile:compile items of this site' - 'create-item:create an item' - 'create-layout:create a layout' 'create-site:create a site' 'deploy:deploy the compiled site' 'help:show help' '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-plugins:show all available plugins' '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' - 'watch:start the watcher' ) local expl @@ -31,13 +24,68 @@ local -a pkgs installed_pkgs _arguments \ '(--color)--color[enable color]' \ '(--debug)--debug[enable debugging]' \ + '(--env)--env[set environment]' \ '(--help)--help[show the help message and quit]' \ '(--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]' \ '(--warn)--warn[enable warnings]' \ '*:: :->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 _describe -t commands "nanoc subcommand" _1st_arguments return diff --git a/plugins/nanoc/nanoc.plugin.zsh b/plugins/nanoc/nanoc.plugin.zsh index 5a5064613..05272ed66 100644 --- a/plugins/nanoc/nanoc.plugin.zsh +++ b/plugins/nanoc/nanoc.plugin.zsh @@ -1,9 +1,6 @@ alias n='nanoc' -alias na='nanoc autocompile' alias nco='nanoc compile' -alias nci='nanoc create_item' -alias ncl='nanoc create_layout' -alias ncs='nanoc create_site' +alias ncs='nanoc create-site' alias nd='nanoc deploy' +alias np='nanoc prune' alias nv='nanoc view' -alias nw='nanoc watch' diff --git a/plugins/ng/ng.plugin.zsh b/plugins/ng/ng.plugin.zsh index 2488bc230..b802bf617 100644 --- a/plugins/ng/ng.plugin.zsh +++ b/plugins/ng/ng.plugin.zsh @@ -1,5 +1,5 @@ -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 () { local words cword opts @@ -55,6 +55,10 @@ _ng_completion () { 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' ;; + + update ) + opts='--all --dryRun --force --from --migrate-only --next --registry --to -d' + ;; v | version ) opts='--verbose' diff --git a/plugins/nmap/nmap.plugin.zsh b/plugins/nmap/nmap.plugin.zsh index d09f2c615..8c691bdaa 100644 --- a/plugins/nmap/nmap.plugin.zsh +++ b/plugins/nmap/nmap.plugin.zsh @@ -13,20 +13,20 @@ # -O - enable OS detection # -sA - TCP ACK 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_list_interfaces="nmap --iflist" -alias nmap_slow="nmap -sS -v -T1" -alias nmap_fin="nmap -sF -v" -alias nmap_full="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_slow="sudo nmap -sS -v -T1" +alias nmap_fin="sudo nmap -sF -v" +alias nmap_full="sudo nmap -sS -T4 -PE -PP -PS80,443 -PY -g 53 -A -p1-65535 -v" +alias nmap_check_for_firewall="sudo nmap -sA -p1-65535 -v -T4" alias nmap_ping_through_firewall="nmap -PS -PA" 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_check_for_vulns="nmap --script=vulscan" -alias nmap_full_udp="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_detect_versions="sudo nmap -sV -p1-65535 -O --osscan-guess -T4 -Pn" +alias nmap_check_for_vulns="nmap --script=vuln" +alias nmap_full_udp="sudo nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443,3389 " +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_web_safe_osscan="sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy " diff --git a/plugins/node/README.md b/plugins/node/README.md new file mode 100644 index 000000000..c392dc0bf --- /dev/null +++ b/plugins/node/README.md @@ -0,0 +1,16 @@ +# 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 +``` diff --git a/plugins/npm/README.md b/plugins/npm/README.md new file mode 100644 index 000000000..202e2b0a4 --- /dev/null +++ b/plugins/npm/README.md @@ -0,0 +1,26 @@ +## 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 | diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index 014fb55f8..f62174a4f 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -1,5 +1,5 @@ (( $+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 npm completion >! $__NPM_COMPLETION_FILE 2>/dev/null @@ -51,4 +51,7 @@ alias npmt="npm test" alias npmR="npm run" # Run npm publish -alias npmP="npm publish"
\ No newline at end of file +alias npmP="npm publish" + +# Run npm init +alias npmI="npm init" diff --git a/plugins/npx/README.md b/plugins/npx/README.md index 2c94e4515..1c052930b 100644 --- a/plugins/npx/README.md +++ b/plugins/npx/README.md @@ -11,7 +11,21 @@ This plugin automatically registers npx command-not-found handler if `npx` exist 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 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. + diff --git a/plugins/nvm/README.md b/plugins/nvm/README.md new file mode 100644 index 000000000..079cf0009 --- /dev/null +++ b/plugins/nvm/README.md @@ -0,0 +1,9 @@ +# 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) +``` diff --git a/plugins/nvm/_nvm b/plugins/nvm/_nvm index 1414dcbb1..1eec48b0a 100644 --- a/plugins/nvm/_nvm +++ b/plugins/nvm/_nvm @@ -6,16 +6,23 @@ local -a _1st_arguments _1st_arguments=( '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' - 'use:modify PATH to use version' - 'run:run version with given arguments' + 'use:modify PATH to use <version>. Uses .nvmrc if available' + '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' + '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' - 'deactivate:undo effects of NVM on current shell' + 'deactivate:undo effects of `nvm` on current shell' 'alias:show or set aliases' '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 @@ -23,4 +30,4 @@ _arguments -C '*:: :->subcmds' && return 0 if (( CURRENT == 1 )); then _describe -t commands "nvm subcommand" _1st_arguments return -fi
\ No newline at end of file +fi diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh index 9dde3a266..4bab8e9d7 100644 --- a/plugins/nvm/nvm.plugin.zsh +++ b/plugins/nvm/nvm.plugin.zsh @@ -1,5 +1,8 @@ # Set NVM_DIR if it isn't already defined [[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm" -# Load nvm if it exists -[[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" +# Try to load nvm only if command not already available +if ! type "nvm" &> /dev/null; then + # Load nvm if it exists + [[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" +fi diff --git a/plugins/nyan/README.md b/plugins/nyan/README.md new file mode 100644 index 000000000..592941824 --- /dev/null +++ b/plugins/nyan/README.md @@ -0,0 +1,5 @@ +# 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 diff --git a/plugins/nyan/nyan.plugin.zsh b/plugins/nyan/nyan.plugin.zsh index ac9d0017e..c21c784d9 100644 --- a/plugins/nyan/nyan.plugin.zsh +++ b/plugins/nyan/nyan.plugin.zsh @@ -1,5 +1,10 @@ -if [[ -x `which nc` ]]; then - alias nyan='nc -v nyancat.dakko.us 23' # nyan cat -fi - - +print -Pn '%F{yellow}' +cat >&2 <<-EOD + 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' diff --git a/plugins/osx/README.md b/plugins/osx/README.md index d3a8f94df..3559dee02 100644 --- a/plugins/osx/README.md +++ b/plugins/osx/README.md @@ -42,19 +42,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ## Commands -| Command | Description | -| :-------------- | :----------------------------------------------- | -| `tab` | Open the current directory in a new tab | -| `split_tab` | Split the current terminal tab horizontally | -| `vsplit_tab` | Split the current terminal tab vertically | -| `ofd` | Open the current directory in a Finder window | -| `pfd` | Return the path of the frontmost Finder window | -| `pfs` | Return the current Finder selection | -| `cdf` | `cd` to the current Finder directory | -| `pushdf` | `pushd` to the current Finder directory | -| `quick-look` | Quick-Look a specified file | -| `man-preview` | Open a specified man page in Preview app | -| `showfiles` | Show hidden files | -| `hidefiles` | Hide the hidden files | -| `itunes` | Control iTunes. User `itunes -h` for usage details | -| `spotify` | Control Spotify and search by artist, album, track and etc.| +| Command | Description | +| :-------------- | :-------------------------------------------------- | +| `tab` | Open the current directory in a new tab | +| `split_tab` | Split the current terminal tab horizontally | +| `vsplit_tab` | Split the current terminal tab vertically | +| `ofd` | Open the current directory in a Finder window | +| `pfd` | Return the path of the frontmost Finder window | +| `pfs` | Return the current Finder selection | +| `cdf` | `cd` to the current Finder directory | +| `pushdf` | `pushd` to the current Finder directory | +| `quick-look` | Quick-Look a specified file | +| `man-preview` | Open a specified man page in Preview app | +| `showfiles` | Show hidden files | +| `hidefiles` | Hide the hidden files | +| `itunes` | Control iTunes. Use `itunes -h` for usage details | +| `spotify` | Control Spotify and search by artist, album, track… | +| `rmdsstore` | Remove .DS\_Store files recursively in a directory | diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index b7d6aca72..7deed0ba6 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -51,6 +51,17 @@ EOF end tell end tell EOF + elif [[ "$the_app" == 'Hyper' ]]; then + osascript >/dev/null <<EOF + tell application "System Events" + tell process "Hyper" to keystroke "t" using command down + end tell + delay 1 + tell application "System Events" + keystroke "${command}" + key code 36 #(presses enter) + end tell +EOF else echo "tab: unsupported terminal app: $the_app" @@ -91,6 +102,19 @@ EOF end tell end tell EOF + + elif [[ "$the_app" == 'Hyper' ]]; then + osascript >/dev/null <<EOF + tell application "System Events" + tell process "Hyper" + tell menu item "Split Vertically" of menu "Shell" of menu bar 1 + click + end tell + end tell + delay 1 + keystroke "${command} \n" + end tell +EOF else echo "$0: unsupported terminal app: $the_app" >&2 @@ -132,6 +156,19 @@ EOF end tell EOF + elif [[ "$the_app" == 'Hyper' ]]; then + osascript >/dev/null <<EOF + tell application "System Events" + tell process "Hyper" + tell menu item "Split Horizontally" of menu "Shell" of menu bar 1 + click + end tell + end tell + delay 1 + keystroke "${command} \n" + end tell +EOF + else echo "$0: unsupported terminal app: $the_app" >&2 false @@ -209,7 +246,7 @@ if [[ ! -z "$playlist" ]]; then opt="play" else opt="stop" - fi + fi else opt="set allPlaylists to (get name of every playlist)" fi @@ -241,7 +278,7 @@ if [[ ! -z "$playlist" ]]; then case "$state" in on|off) - # Inspired by: http://stackoverflow.com/a/14675583 + # Inspired by: https://stackoverflow.com/a/14675583 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" ) EOF @@ -282,3 +319,8 @@ source ${ZSH}/plugins/osx/spotify # Show/hide hidden files in the Finder alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" + +# Remove .DS_Store files recursively in a directory, default . +function rmdsstore() { + find "${@:-.}" -type f -name .DS_Store -delete +} diff --git a/plugins/osx/spotify b/plugins/osx/spotify index 69f6c5419..b4215dbe7 100644 --- a/plugins/osx/spotify +++ b/plugins/osx/spotify @@ -1,7 +1,7 @@ #!/usr/bin/env bash function spotify() { -# Copyright (c) 2012--2017 Harish Narayanan <mail@harishnarayanan.org> +# Copyright (c) 2012--2018 Harish Narayanan <mail@harishnarayanan.org> # # Contains numerous helpful contributions from Jorge Colindres, Thomas # Pritchard, iLan Epstein, Gabriele Bonetti, Sean Heller, Eric Martin @@ -134,8 +134,13 @@ showStatus () { if [ $# = 0 ]; then showHelp; else + if [ ! -d /Applications/Spotify.app ] && [ ! -d $HOME/Applications/Spotify.app ]; then + echo "The Spotify application must be installed." + exit 1 + fi + if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then - osascript -e 'tell application "Spotify" to activate' + osascript -e 'tell application "Spotify" to activate' || exit 1 sleep 2 fi fi @@ -160,7 +165,7 @@ while [ $# -gt 0 ]; do showAPIHelp; exit 1; fi - SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"); + SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"|tr -d '\r'); SPOTIFY_PLAY_URI=""; getAccessToken() { @@ -408,7 +413,7 @@ while [ $# -gt 0 ]; do uri=`osascript -e 'tell application "Spotify" to spotify url of current track'`; remove='spotify:track:' url=${uri#$remove} - url="http://open.spotify.com/track/$url" + url="https://open.spotify.com/track/$url" if [ "$2" = "" ]; then cecho "Spotify URL: $url" diff --git a/plugins/otp/otp.plugin.zsh b/plugins/otp/otp.plugin.zsh new file mode 100644 index 000000000..4bce34fd3 --- /dev/null +++ b/plugins/otp/otp.plugin.zsh @@ -0,0 +1,54 @@ +export OTP_HOME=~/.otp +mkdir -p $OTP_HOME + +function ot () { + if ! command -v oathtool > /dev/null 2>&1; then + echo "Note: you need to install oathtool or oath-toolkit, depending on your OS or distribution." + return 1 + fi + + if ! command -v gpg > /dev/null 2>&1; then + echo "Note: you need to install gpg and create an ID using 'gpg --gen-key', unless you have one already." + return 1 + fi + + if [[ `uname` == 'Darwin' ]] then # MacOS X + export COPY_CMD='pbcopy' + elif command -v xsel > /dev/null 2>&1; then # Any Unix with xsel installed + export COPY_CMD='xsel --clipboard --input' + else + COPY_CMD='true' + fi + + if [[ "x$1" == "x" ]]; then + echo "usage: otpw <profile.name>" + return 1 + elif [ ! -f $OTP_HOME/$1.otp.asc ]; then + echo "missing profile $1, you might need to create it first using otp_add_device" + return 1 + else + totpkey=$(gpg --decrypt $OTP_HOME/$1.otp.asc) + oathtool --totp --b $totpkey | tee /dev/stderr | `echo $COPY_CMD` + if [[ $COPY_CMD == 'true' ]] then + echo "Note: you might consider installing xsel for clipboard integration" + fi + fi +} + +function otp_add_device () { + if [[ "x$1" == "x" ]] then + echo "usage: otp_add <profile.name>" + return 1 + else + echo "Enter an email address attached to your GPG private key, then paste the secret configuration key followed by ^D" + + rm -f $OTP_HOME/$1.otp.asc + gpg --armor --encrypt --output $OTP_HOME/$1.otp.asc /dev/stdin + fi +} + +function otp_devices () { + reply=($(find $OTP_HOME -name \*.otp.asc | xargs basename -s .otp.asc)) +} + +compctl -K otp_devices ot diff --git a/plugins/pass/_pass b/plugins/pass/_pass index 7a9b1f955..5f3b8f541 100644 --- a/plugins/pass/_pass +++ b/plugins/pass/_pass @@ -6,11 +6,17 @@ # Brian Mattern <rephorm@rephorm.com> # Jason A. Donenfeld <Jason@zx2c4.com>. # All Rights Reserved. -# # 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 () { @@ -117,8 +123,9 @@ _pass_cmd_show () { } _pass_complete_entries_helper () { local IFS=$'\n' - local 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##' | sort):-""} + local prefix + 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 () { diff --git a/plugins/pep8/README.md b/plugins/pep8/README.md new file mode 100644 index 000000000..a9a4f1cd0 --- /dev/null +++ b/plugins/pep8/README.md @@ -0,0 +1,8 @@ +# 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) +``` diff --git a/plugins/per-directory-history/README.md b/plugins/per-directory-history/README.md index 196f74e6c..69854aa38 100644 --- a/plugins/per-directory-history/README.md +++ b/plugins/per-directory-history/README.md @@ -1,55 +1,48 @@ -[Per-Directory-History][6] -========================= +per-directory-history plugin +---------------------------- -Per directory history for zsh, as well as global history, and the -ability to toggle between them with ^G. +This plugin adds per-directory history for zsh, as well as a global history, +and the ability to toggle between them with a keyboard shortcut. This is a +bundle of the [official plugin by @jimhester][5]. -This is a implementation of per directory history for zsh, some -implementations of which exist in bash[1][],[2][]. It also implements -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 -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 -between global and directory histories on the fly is a novel feature as far -as I am aware. +To use it, add `per-directory-history` to the plugins array in your zshrc file: -This is a standalone repository for the script, however it is also included in -[oh-my-zsh][4] as a plugin. +```zsh +plugins=(... per-directory-history) +``` ----------------------------------------------------------------------------- -Usage ----------------------------------------------------------------------------- +This is an implementation of per-directory history for zsh, some implementations +of which exist in bash[1][],[2][]. It also implements a toggle-history function +to change from using the 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 toggle state will not effect the saved histories. Being able to +switch between global and directory histories on the fly is a novel feature. -1. Load this script into your interactive ZSH session: +## Usage - % source zsh-per-directory-history.zsh +The default mode is per directory history, interact with your history as normal. -2. The default mode if per directory history, interact with your history as normal. +Press ^G (the <kbd>Control</kbd> and <kbd>G</kbd> keys simultaneously) to toggle +between local and global histories. If you would prefer a different shortcut to +toggle set the `PER_DIRECTORY_HISTORY_TOGGLE` environment variable. -3. Press ^G (the Control and G keys simultaneously) to toggle between local - and global histories. If you would prefer a different shortcut to toggle - set the PER_DIRECTORY_HISTORY_TOGGLE environment variable. +## Configuration -------------------------------------------------------------------------------- -Configuration -------------------------------------------------------------------------------- +* `HISTORY_BASE` is a global variable that defines the base directory in which the + directory histories are stored (default `$HOME/.directory_history`). +* `per-directory-history-toggle-history` is the function to toggle between local + and global histories. +* `PER_DIRECTORY_HISTORY_TOGGLE` is the key binding used to run the toggle-history + function above (default `^G`) -* HISTORY_BASE a global variable that defines the base directory in which the - directory histories are stored -* per-directory-history-toggle-history is the function to toggle the history +## History -------------------------------------------------------------------------------- -History -------------------------------------------------------------------------------- - -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 -implementation is by [Jim Hester][5] in September 2012. +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 +implementation is by [Jim Hester][4] in September 2012. [1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html [2]: http://dieter.plaetinck.be/per_directory_bash -[3]: http://www.zsh.org/mla/users/1997/msg00226.html -[4]: https://github.com/robbyrussell/oh-my-zsh -[5]: http://jimhester.com -[6]: http://github.com/jimhester/per-directory-history - +[3]: https://www.zsh.org/mla/users/1997/msg00226.html +[4]: https://jimhester.com +[5]: https://github.com/jimhester/per-directory-history diff --git a/plugins/per-directory-history/per-directory-history.zsh b/plugins/per-directory-history/per-directory-history.zsh index 1242dc420..41de2f91d 100644 --- a/plugins/per-directory-history/per-directory-history.zsh +++ b/plugins/per-directory-history/per-directory-history.zsh @@ -109,8 +109,13 @@ function _per-directory-history-change-directory() { } function _per-directory-history-addhistory() { - print -Sr -- "${1%%$'\n'}" - fc -p $_per_directory_history_directory + # respect hist_ignore_space + if [[ -o hist_ignore_space ]] && [[ "$1" == \ * ]]; then + true + else + print -Sr -- "${1%%$'\n'}" + fc -p $_per_directory_history_directory + fi } diff --git a/plugins/percol/README.md b/plugins/percol/README.md new file mode 100644 index 000000000..b262e414e --- /dev/null +++ b/plugins/percol/README.md @@ -0,0 +1,20 @@ +## 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. + diff --git a/plugins/percol/percol.plugin.zsh b/plugins/percol/percol.plugin.zsh new file mode 100644 index 000000000..c6adf4e1e --- /dev/null +++ b/plugins/percol/percol.plugin.zsh @@ -0,0 +1,22 @@ +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 diff --git a/plugins/perl/perl.plugin.zsh b/plugins/perl/perl.plugin.zsh index 1fbf7c122..678e88d97 100644 --- a/plugins/perl/perl.plugin.zsh +++ b/plugins/perl/perl.plugin.zsh @@ -21,7 +21,7 @@ alias pd='perldoc' alias ple='perl -wlne' # 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;}'\' diff --git a/plugins/perms/README.md b/plugins/perms/README.md index 873c21d42..324b3f3cc 100644 --- a/plugins/perms/README.md +++ b/plugins/perms/README.md @@ -4,6 +4,6 @@ Plugin to handle some unix filesystem permissions quickly ### Usage -* `set755` recursively sets all directories located within the current working directory and sub directories to octal 755. -* `set644` recursively sets all files located within the current working directory and sub directories to octal 644. -* `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases.
\ No newline at end of file +* `set755` recursively sets all given directories (default to .) to octal 755. +* `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. diff --git a/plugins/perms/perms.plugin.zsh b/plugins/perms/perms.plugin.zsh index 7cdebab7f..1a7472c1c 100644 --- a/plugins/perms/perms.plugin.zsh +++ b/plugins/perms/perms.plugin.zsh @@ -6,10 +6,14 @@ ### Aliases # 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 -alias set755='find . -type d ! -perm 755 -print0 | xargs -0 chmod 755' +set755() { + find "${@:-.}" -type d ! -perm 755 -print0 | xargs -0 chmod 755 +} ### Functions diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh index d7236b02a..5539187e1 100644 --- a/plugins/pip/pip.plugin.zsh +++ b/plugins/pip/pip.plugin.zsh @@ -10,7 +10,7 @@ # "zsh-pip-clear-cache". ZSH_PIP_CACHE_FILE=~/.pip/zsh-cache -ZSH_PIP_INDEXES=(https://pypi.python.org/simple/) +ZSH_PIP_INDEXES=(https://pypi.org/simple/) zsh-pip-clear-cache() { rm $ZSH_PIP_CACHE_FILE @@ -31,7 +31,7 @@ zsh-pip-cache-packages() { tmp_cache=/tmp/zsh_tmp_cache for index in $ZSH_PIP_INDEXES ; do # well... I've already got two problems - curl $index 2>/dev/null | \ + curl -L $index 2>/dev/null | \ zsh-pip-clean-packages \ >> $tmp_cache done diff --git a/plugins/pipenv/README.md b/plugins/pipenv/README.md new file mode 100644 index 000000000..ab1c1e442 --- /dev/null +++ b/plugins/pipenv/README.md @@ -0,0 +1,28 @@ +# Pipenv + +## Installation +In your `.zshrc` file, add `pipenv` to the plugins section + +``` +plugins=(... pipenv ...) +``` + +## Features +This plugin provides some features to simplify the use of Pipenv while working on ZSH. +- Adds completion for pipenv +- Auto activates and deactivates pipenv shell +- Adds short aliases for common pipenv commands + - `pch` is aliased to `pipenv check` + - `pcl` is aliased to `pipenv clean` + - `pgr` is aliased to `pipenv graph` + - `pi` is aliased to `pipenv install` + - `pidev` is aliased to `pipenv install --dev` + - `pl` is aliased to `pipenv lock` + - `po` is aliased to `pipenv open` + - `prun` is aliased to `pipenv run` + - `psh` is aliased to `pipenv shell` + - `psy` is aliased to `pipenv sync` + - `pu` is aliased to `pipenv uninstall` + - `pwh` is aliased to `pipenv --where` + - `pvenv` is aliased to `pipenv --venv` + - `ppy` is aliased to `pipenv --py` diff --git a/plugins/pipenv/pipenv.plugin.zsh b/plugins/pipenv/pipenv.plugin.zsh new file mode 100644 index 000000000..0a5dc56a4 --- /dev/null +++ b/plugins/pipenv/pipenv.plugin.zsh @@ -0,0 +1,42 @@ +# Pipenv completion +_pipenv() { + eval $(env COMMANDLINE="${words[1,$CURRENT]}" _PIPENV_COMPLETE=complete-zsh pipenv) +} +compdef _pipenv pipenv + +# Automatic pipenv shell activation/deactivation +_togglePipenvShell() { + # deactivate shell if Pipfile doesn't exist and not in a subdir + if [[ ! -a "$PWD/Pipfile" ]]; then + if [[ "$PIPENV_ACTIVE" == 1 ]]; then + if [[ "$PWD" != "$pipfile_dir"* ]]; then + exit + fi + fi + fi + + # activate the shell if Pipfile exists + if [[ "$PIPENV_ACTIVE" != 1 ]]; then + if [[ -a "$PWD/Pipfile" ]]; then + export pipfile_dir="$PWD" + pipenv shell + fi + fi +} +chpwd_functions+=(_togglePipenvShell) + +# Aliases +alias pch="pipenv check" +alias pcl="pipenv clean" +alias pgr="pipenv graph" +alias pi="pipenv install" +alias pidev="pipenv install --dev" +alias pl="pipenv lock" +alias po="pipenv open" +alias prun="pipenv run" +alias psh="pipenv shell" +alias psy="pipenv sync" +alias pu="pipenv uninstall" +alias pwh="pipenv --where" +alias pvenv="pipenv --venv" +alias ppy="pipenv --py" diff --git a/plugins/please/README.md b/plugins/please/README.md new file mode 100644 index 000000000..89bfbf105 --- /dev/null +++ b/plugins/please/README.md @@ -0,0 +1,26 @@ +# please plugin + +[Please](https://please.build) is a cross-language build system with an emphasis on +high performance, extensibility and reproduceability. It supports a number of popular +languages and can automate nearly any aspect of your build process. + +This plugin adds autocomplete and major aliases for `plz`, the command line tool for +Please. + +To use it, add `please` to the plugins array in your zshrc file: + +```zsh +plugins=(... please) +``` + +## Aliases + +| Alias | Command | +|-------|-------------| +| `pb` | `plz build` | +| `pt` | `plz test` | +| `pw` | `plz watch` | + +## Maintainer + +[@thought-machine](https://github.com/thought-machine) diff --git a/plugins/please/please.plugin.zsh b/plugins/please/please.plugin.zsh new file mode 100644 index 000000000..0f58307ab --- /dev/null +++ b/plugins/please/please.plugin.zsh @@ -0,0 +1,7 @@ +if (( $+commands[plz] )); then + source <(plz --completion_script) +fi + +alias pb='plz build' +alias pt='plz test' +alias pw='plz watch' diff --git a/plugins/pod/_pod b/plugins/pod/_pod index 508a47102..80d23daad 100644 --- a/plugins/pod/_pod +++ b/plugins/pod/_pod @@ -7,7 +7,7 @@ # ----------------------------------------------------------------------------- # FILE: _pod # DESCRIPTION: Cocoapods (0.33.1) autocomplete plugin for Oh-My-Zsh -# http://cocoapods.org +# https://cocoapods.org # Generated with `pod --completion-script # AUTHOR: Alexandre Joly (alexandre.joly@mekanics.ch) # GITHUB: https://github.com/mekanics diff --git a/plugins/postgres/README.md b/plugins/postgres/README.md new file mode 100644 index 000000000..59445f31c --- /dev/null +++ b/plugins/postgres/README.md @@ -0,0 +1,22 @@ +# 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) | diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/pow.plugin.zsh index ded3336a7..0b8ccd15b 100644 --- a/plugins/pow/pow.plugin.zsh +++ b/plugins/pow/pow.plugin.zsh @@ -73,7 +73,7 @@ powed(){ } # 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(){ lsof | grep 20560 | awk '{print $2}' | xargs kill -9 launchctl unload ~/Library/LaunchAgents/cx.pow.powd.plist diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index ec3ae9f5b..40e58b5c2 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -1,50 +1,41 @@ -_homebrew-installed() { - type brew &> /dev/null -} - -_pyenv-from-homebrew-installed() { - brew --prefix pyenv &> /dev/null -} - -FOUND_PYENV=0 -pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv") - -for pyenvdir in "${pyenvdirs[@]}" ; do - 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)" +# This plugin loads pyenv into the current shell and provides prompt info via +# the 'pyenv_prompt_info' function. Also loads pyenv-virtualenv if available. + +FOUND_PYENV=$+commands[pyenv] + +if [[ $FOUND_PYENV -ne 1 ]]; then + pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv" "/usr/local/opt/pyenv") + for dir in $pyenvdirs; do + if [[ -d $dir/bin ]]; then + export PATH="$PATH:$dir/bin" + FOUND_PYENV=1 + break fi + done +fi - function pyenv_prompt_info() { - echo "$(pyenv version-name)" - } - fi -done -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)" +if [[ $FOUND_PYENV -ne 1 ]]; then + if (( $+commands[brew] )) && dir=$(brew --prefix pyenv 2>/dev/null); then + if [[ -d $dir/bin ]]; then + export PATH="$PATH:$dir/bin" + FOUND_PYENV=1 fi - - function pyenv_prompt_info() { - echo "$(pyenv version-name)" - } fi fi -if [ $FOUND_PYENV -eq 0 ] ; then - function pyenv_prompt_info() { echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')" } +if [[ $FOUND_PYENV -eq 1 ]]; then + 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 + +unset FOUND_PYENV pyenvdirs dir diff --git a/plugins/pylint/README.md b/plugins/pylint/README.md new file mode 100644 index 000000000..8c1de88ba --- /dev/null +++ b/plugins/pylint/README.md @@ -0,0 +1,15 @@ +# 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 | | diff --git a/plugins/python/README.md b/plugins/python/README.md new file mode 100644 index 000000000..2d955c5cb --- /dev/null +++ b/plugins/python/README.md @@ -0,0 +1,16 @@ +# 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 | diff --git a/plugins/python/_python b/plugins/python/_python deleted file mode 100644 index f517d4806..000000000 --- a/plugins/python/_python +++ /dev/null @@ -1,54 +0,0 @@ -#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 diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh index a10c06fd3..f754ea261 100644 --- a/plugins/python/python.plugin.zsh +++ b/plugins/python/python.plugin.zsh @@ -1,12 +1,13 @@ # Find python file 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 function pyclean() { ZSH_PYCLEAN_PLACES=${*:-'.'} 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 ".mypy_cache" -delete } # Grep among .py files diff --git a/plugins/rails/README.md b/plugins/rails/README.md new file mode 100644 index 000000000..7a3db3d64 --- /dev/null +++ b/plugins/rails/README.md @@ -0,0 +1,83 @@ +# Rails + +This plugin adds completion for [Ruby On Rails Framework](https://rubyonrails.org/) and [Rake](https://ruby.github.io/rake/) commands, as well as some aliases for logs and environment variables. + +To use it, add `rails` to the plugins array in your zshrc file: + +```zsh +plugins=(... rails) +``` + +## List of Aliases + +### Rails aliases + +| Alias | Command | Description | +|-------|----------------------------|----------------------------------------------------| +| `rc` | `rails console` | Interact with your Rails app from the CLI | +| `rcs` | `rails console --sandbox` | Test code in a sandbox, without changing any data | +| `rd` | `rails destroy` | Undo a generate operation | +| `rdb` | `rails dbconsole` | Interact with your db from the console | +| `rg` | `rails generate` | Generate boilerplate code | +| `rgm` | `rails generate migration` | Generate a db migration | +| `rp` | `rails plugin` | Run a Rails plugin command | +| `ru` | `rails runner` | Run Ruby code in the context of Rails | +| `rs` | `rails server` | Launch a web server | +| `rsd` | `rails server --debugger` | Launch a web server with debugger | +| `rsp` | `rails server --port` | Launch a web server and specify the listening port | + +### Rake aliases + +| Alias | Command | Description | +|---------|---------------------------------|--------------------------------------------------------| +| `rdm` | `rake db:migrate` | Run pending db migrations | +| `rdms` | `rake db:migrate:status` | Show current db migration status | +| `rdmtc` | `rake db:migrate db:test:clone` | Run pending migrations and clone db into test database | +| `rdr` | `rake db:rollback` | Roll back the last migration | +| `rdc` | `rake db:create` | Create the database | +| `rds` | `rake db:seed` | Seed the database | +| `rdd` | `rake db:drop` | Delete the database | +| `rdrs` | `rake db:reset` | Delete the database and set it up again | +| `rdtc` | `rake db:test:clone` | Clone the database into the test database | +| `rdtp` | `rake db:test:prepare` | Duplicate the db schema into your test database | +| `rdsl` | `rake db:schema:load` | Load the database schema | +| `rlc` | `rake log:clear` | Clear Rails logs | +| `rn` | `rake notes` | Search for notes (`FIXME`, `TODO`) in code comments | +| `rr` | `rake routes` | List all defined routes | +| `rrg` | `rake routes | grep` | List and filter the defined routes | +| `rt` | `rake test` | Run Rails tests | +| `rmd` | `rake middleware` | Interact with Rails middlewares | +| `rsts` | `rake stats` | Print code statistics | + +### Utility aliases + +| Alias | Command | Description | +|-----------|-------------------------------|------------------------------------------------| +| `devlog` | `tail -f log/development.log` | Show and follow changes to the development log | +| `prodlog` | `tail -f log/production.log` | Show and follow changes to the production log | +| `testlog` | `tail -f log/test.log` | Show and follow changes to the test log | + +### Environment settings + +| Alias | Command | Description | +|-------|-------------------------|---------------------------------| +| `RED` | `RAILS_ENV=development` | Sets `RAILS_ENV` to development | +| `REP` | `RAILS_ENV=production` | Sets `RAILS_ENV` to production | +| `RET` | `RAILS_ENV=test` | Sets `RAILS_ENV` to test | + +These are global aliases. Use in combination with a command or just run them +separately. For example: `RED rake db:migrate` will migrate the production db. + +### Legacy stuff + +| Alias | Command | +|---------|------------------------------------| +| `sstat` | `thin --stats "/thin/stats" start` | +| `sg` | `ruby script/generate` | +| `sd` | `ruby script/destroy` | +| `sp` | `ruby script/plugin` | +| `sr` | `ruby script/runner` | +| `ssp` | `ruby script/spec` | +| `sc` | `ruby script/console` | +| `sd` | `ruby script/server --debugger` | + diff --git a/plugins/rails/_rails b/plugins/rails/_rails index 96f57ce64..ad7505506 100644 --- a/plugins/rails/_rails +++ b/plugins/rails/_rails @@ -51,6 +51,9 @@ _arguments \ if (( CURRENT == 1 )); then _describe -t commands "rails subcommand" _1st_arguments return +else + _files + return fi case "$words[1]" in diff --git a/plugins/rake-fast/README.md b/plugins/rake-fast/README.md index 1417befa1..23cbd80fc 100644 --- a/plugins/rake-fast/README.md +++ b/plugins/rake-fast/README.md @@ -8,7 +8,7 @@ checks the file modification time to see if it needs to regenerate the cache file. This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/), -which is inspired by [this Ruby on Rails trick from 2006](http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh/). +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. diff --git a/plugins/rake-fast/rake-fast.plugin.zsh b/plugins/rake-fast/rake-fast.plugin.zsh index ca80d86e1..19dab154b 100644 --- a/plugins/rake-fast/rake-fast.plugin.zsh +++ b/plugins/rake-fast/rake-fast.plugin.zsh @@ -20,7 +20,7 @@ _tasks_changed () { } _rake_generate () { - rake --silent --tasks | cut -d " " -f 2 > .rake_tasks + rake --silent --tasks | cut -d " " -f 2 | sed 's/\[.*\]//g' > .rake_tasks } _rake () { diff --git a/plugins/rand-quote/README.md b/plugins/rand-quote/README.md new file mode 100644 index 000000000..c387aaa22 --- /dev/null +++ b/plugins/rand-quote/README.md @@ -0,0 +1,15 @@ +# 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. diff --git a/plugins/rand-quote/rand-quote.plugin.zsh b/plugins/rand-quote/rand-quote.plugin.zsh index 8f345d9aa..371b997d3 100644 --- a/plugins/rand-quote/rand-quote.plugin.zsh +++ b/plugins/rand-quote/rand-quote.plugin.zsh @@ -1,26 +1,14 @@ -# Get a random quote fron the site http://www.quotationspage.com/random.php3 -# 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 +if ! (( $+commands[curl] )); then echo "rand-quote plugin needs curl to work" >&2 + return 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”" +} diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh index 7430e9625..ed46d355b 100644 --- a/plugins/rbenv/rbenv.plugin.zsh +++ b/plugins/rbenv/rbenv.plugin.zsh @@ -1,60 +1,65 @@ -_homebrew-installed() { - type brew &> /dev/null -} - -FOUND_RBENV=0 -rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" "/usr/local/opt/rbenv") -if _homebrew-installed && rbenv_homebrew_path=$(brew --prefix rbenv 2>/dev/null); then - rbenvdirs=($rbenv_homebrew_path "${rbenvdirs[@]}") - unset rbenv_homebrew_path - if [[ $RBENV_ROOT = '' ]]; then - RBENV_ROOT="$HOME/.rbenv" - fi +# This plugin loads rbenv into the current shell and provides prompt info via +# the 'rbenv_prompt_info' function. + +FOUND_RBENV=$+commands[rbenv] + +if [[ $FOUND_RBENV -ne 1 ]]; then + rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" "/usr/local/opt/rbenv") + for dir in $rbenvdirs; do + if [[ -d $dir/bin ]]; then + export PATH="$dir/bin:$PATH" + FOUND_RBENV=1 + break + fi + done fi -for rbenvdir in "${rbenvdirs[@]}" ; do - if [ -d $rbenvdir/bin -a $FOUND_RBENV -eq 0 ] ; then - FOUND_RBENV=1 - if [[ $RBENV_ROOT = '' ]]; then - RBENV_ROOT=$rbenvdir +if [[ $FOUND_RBENV -ne 1 ]]; then + if (( $+commands[brew] )) && dir=$(brew --prefix rbenv 2>/dev/null); then + if [[ -d $dir/bin ]]; then + export PATH="$dir/bin:$PATH" + FOUND_RBENV=1 + fi fi - export RBENV_ROOT - export PATH=${rbenvdir}/bin:$PATH +fi + +if [[ $FOUND_RBENV -eq 1 ]]; then eval "$(rbenv init --no-rehash - zsh)" alias rubies="rbenv versions" alias gemsets="rbenv gemset list" function current_ruby() { - echo "$(rbenv version-name)" + echo "$(rbenv version-name)" } function current_gemset() { - echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)" + echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)" } - function gems { - local rbenv_path=$(rbenv prefix) - gem list $@ | sed -E \ - -e "s/\([0-9a-z, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \ - -e "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \ - -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ - -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" + function gems() { + local rbenv_path=$(rbenv prefix) + gem list $@ | sed -E \ + -e "s/\([0-9a-z, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \ + -e "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \ + -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ + -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" } function rbenv_prompt_info() { - if [[ -n $(current_gemset) ]] ; then - echo "$(current_ruby)@$(current_gemset)" - else - echo "$(current_ruby)" - fi + if [[ -n $(current_gemset) ]] ; then + echo "$(current_ruby)@$(current_gemset)" + else + echo "$(current_ruby)" + fi } - fi -done -unset rbenvdir - -if [ $FOUND_RBENV -eq 0 ] ; then - alias rubies='ruby -v' - function gemsets() { echo 'not supported' } - function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" } +else + alias rubies="ruby -v" + function gemsets() { echo "not supported" } + function current_ruby() { echo "not supported" } + function current_gemset() { echo "not supported" } + function gems() { echo "not supported" } + function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" } fi + +unset FOUND_RBENV rbenvdirs dir diff --git a/plugins/react-native/README.md b/plugins/react-native/README.md index 980246cf1..dc0207184 100644 --- a/plugins/react-native/README.md +++ b/plugins/react-native/README.md @@ -11,19 +11,63 @@ plugins=(... react-native) ## Aliases -| Alias | React Native command | -|:------------|:-----------------------------------------------| -| **rn** | `react-native` | -| **rns** | `react-native start` | -| **rnlink** | `react-native link` | -| _App testing_ | -| **rnand** | `react-native run-android` | -| **rnios** | `react-native run-ios` | -| **rnios4s** | `react-native run-ios --simulator "iPhone 4s"` | -| **rnios5** | `react-native run-ios --simulator "iPhone 5"` | -| **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` | -| **rnios6** | `react-native run-ios --simulator "iPhone 6"` | -| **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` | -| _Logging_ | -| **rnland** | `react-native log-android` | -| **rnlios** | `react-native log-ios` | +| Alias | React Native command | +| :------------ | :------------------------------------------------- | +| **rn** | `react-native` | +| **rns** | `react-native start` | +| **rnlink** | `react-native link` | +| _Logging_ | | +| **rnland** | `react-native log-android` | +| **rnlios** | `react-native log-ios` | +| _App Testing_ | | +| **rnand** | `react-native run-android` | +| **rnios** | `react-native run-ios` | +| _iPhone_ | | +| **rnios4s** | `react-native run-ios --simulator "iPhone 4s"` | +| **rnios5** | `react-native run-ios --simulator "iPhone 5"` | +| **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` | +| **rnios6** | `react-native run-ios --simulator "iPhone 6"` | +| **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` | +| **rnios6p** | `react-native run-ios --simulator "iPhone 6 Plus"` | +| **rnios6sp** | `react-native run-ios --simulator "iPhone 6s Plus"` | +| **rnios7** | `react-native run-ios --simulator "iPhone 7"` | +| **rnios7p** | `react-native run-ios --simulator "iPhone 7 Plus"` | +| **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 Xʀ"` | +| _iPad_ | | +| **rnipad2** | `react-native run-ios --simulator "iPad 2"` | +| **rnipad5** | `react-native run-ios --simulator "iPad (5th generation)"` | +| **rnipad6** | `react-native run-ios --simulator "iPad (6th generation)"` | +| **rnipadr** | `react-native run-ios --simulator "iPad Retina"` | +| **rnipada** | `react-native run-ios --simulator "iPad Air"` | +| **rnipada2** | `react-native run-ios --simulator "iPad Air 2"` | +| **rnipada3** | `react-native run-ios --simulator "iPad Air (3rd generation)"` | +| **rnipadm2** | `react-native run-ios --simulator "iPad mini 2"` | +| **rnipadm3** | `react-native run-ios --simulator "iPad mini 3"` | +| **rnipadm4** | `react-native run-ios --simulator "iPad mini 4"` | +| **rnipadm5** | `react-native run-ios --simulator "iPad mini (5th generation)"` | +| **rnipadp9** | `react-native run-ios --simulator "iPad Pro (9.7-inch)"` | +| **rnipadp12** | `react-native run-ios --simulator "iPad Pro (12.9-inch)"` | +| **rnipadp122** | `react-native run-ios --simulator "iPad Pro (12.9-inch) (2nd generation)"` | +| **rnipadp10** | `react-native run-ios --simulator "iPad Pro (10.5-inch)"` | +| **rnipad11** | `react-native run-ios --simulator "iPad Pro (11-inch)"` | +| **rnipad123** | `react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"` | +| _Apple TV_ | | +| **rnatv** | `react-native run-ios --simulator "Apple TV"` | +| **rnatv4k** | `react-native run-ios --simulator "Apple TV 4K"` | +| **rnatv4k1080**| `react-native run-ios --simulator "Apple TV 4K (at 1080p)"` | +| **rnipad123** | `react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"` | +| _Apple Watch_ | | +| **rnaw38** | `react-native run-ios --simulator "Apple Watch - 38mm"` | +| **rnaw42** | `react-native run-ios --simulator "Apple Watch - 42mm"` | +| **rnaws238** | `react-native run-ios --simulator "Apple Watch Series 2 - 38mm"` | +| **rnaws242** | `react-native run-ios --simulator "Apple Watch Series 2 - 42mm"` | +| **rnaws338** | `react-native run-ios --simulator "Apple Watch Series 3 - 38mm"` | +| **rnaws342** | `react-native run-ios --simulator "Apple Watch Series 3 - 42mm"` | +| **rnaws440** | `react-native run-ios --simulator "Apple Watch Series 4 - 40mm"` | +| **rnaws444** | `react-native run-ios --simulator "Apple Watch Series 4 - 44mm"` | diff --git a/plugins/react-native/react-native.plugin.zsh b/plugins/react-native/react-native.plugin.zsh index 0566941a1..f7695d15f 100644 --- a/plugins/react-native/react-native.plugin.zsh +++ b/plugins/react-native/react-native.plugin.zsh @@ -1,14 +1,60 @@ +# React Native alias rn='react-native' alias rns='react-native start' alias rnlink='react-native link' - +alias rnland='react-native log-android' +alias rnlios='react-native log-ios' alias rnand='react-native run-android' alias rnios='react-native run-ios' + +# iPhone alias rnios4s='react-native run-ios --simulator "iPhone 4s"' alias rnios5='react-native run-ios --simulator "iPhone 5"' alias rnios5s='react-native run-ios --simulator "iPhone 5s"' alias rnios6='react-native run-ios --simulator "iPhone 6"' +alias rnios6p='react-native run-ios --simulator "iPhone 6 Plus"' alias rnios6s='react-native run-ios --simulator "iPhone 6s"' +alias rnios6sp='react-native run-ios --simulator "iPhone 6s Plus"' +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 Xʀ"' -alias rnland='react-native log-android' -alias rnlios='react-native log-ios' +# iPad +alias rnipad2='react-native run-ios --simulator "iPad 2"' +alias rnipad5='react-native run-ios --simulator "iPad (5th generation)"' +alias rnipad6='react-native run-ios --simulator "iPad (6th generation)"' +alias rnipadr='react-native run-ios --simulator "iPad Retina"' +alias rnipada='react-native run-ios --simulator "iPad Air"' +alias rnipada2='react-native run-ios --simulator "iPad Air 2"' +alias rnipada3='react-native run-ios --simulator "iPad Air (3rd generation)"' +alias rnipadm2='react-native run-ios --simulator "iPad mini 2"' +alias rnipadm3='react-native run-ios --simulator "iPad mini 3"' +alias rnipadm4='react-native run-ios --simulator "iPad mini 4"' +alias rnipadm5='react-native run-ios --simulator "iPad mini (5th generation)"' +alias rnipadp9='react-native run-ios --simulator "iPad Pro (9.7-inch)"' +alias rnipadp12='react-native run-ios --simulator "iPad Pro (12.9-inch)"' +alias rnipadp122='react-native run-ios --simulator "iPad Pro (12.9-inch) (2nd generation)"' +alias rnipadp10='react-native run-ios --simulator "iPad Pro (10.5-inch)"' +alias rnipad11='react-native run-ios --simulator "iPad Pro (11-inch)"' +alias rnipad123='react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"' + +# Apple TV +alias rnatv='react-native run-ios --simulator "Apple TV"' +alias rnatv4k='react-native run-ios --simulator "Apple TV 4K"' +alias rnatv4k1080='react-native run-ios --simulator "Apple TV 4K (at 1080p)"' + +# Apple Watch +alias rnaw38='react-native run-ios --simulator "Apple Watch - 38mm"' +alias rnaw42='react-native run-ios --simulator "Apple Watch - 42mm"' +alias rnaws238='react-native run-ios --simulator "Apple Watch Series 2 - 38mm"' +alias rnaws242='react-native run-ios --simulator "Apple Watch Series 2 - 42mm"' +alias rnaws338='react-native run-ios --simulator "Apple Watch Series 3 - 38mm"' +alias rnaws342='react-native run-ios --simulator "Apple Watch Series 3 - 42mm"' +alias rnaws440='react-native run-ios --simulator "Apple Watch Series 4 - 40mm"' +alias rnaws444='react-native run-ios --simulator "Apple Watch Series 4 - 44mm"' diff --git a/plugins/repo/README.md b/plugins/repo/README.md index 0b77e6d48..4d9366adf 100644 --- a/plugins/repo/README.md +++ b/plugins/repo/README.md @@ -2,6 +2,6 @@ **Maintainer:** [Stibbons](https://github.com/Stibbons) 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` diff --git a/plugins/ripgrep/README.md b/plugins/ripgrep/README.md new file mode 100644 index 000000000..794b105ee --- /dev/null +++ b/plugins/ripgrep/README.md @@ -0,0 +1,13 @@ +# ripgrep + +This plugin adds completion for the text search tool [`ripgrep`](https://github.com/BurntSushi/ripgrep), also known as `rg`. + +To use it, add `ripgrep` to the plugins array in your zshrc file: + +```zsh +plugins=(... ripgrep) +``` + +Completion is taken from the ripgrep release [`0.10.0`](https://github.com/BurntSushi/ripgrep/releases/tag/0.10.0). + +Updated on September 27th, 2018. diff --git a/plugins/ripgrep/_ripgrep b/plugins/ripgrep/_ripgrep new file mode 100644 index 000000000..53f135dde --- /dev/null +++ b/plugins/ripgrep/_ripgrep @@ -0,0 +1,433 @@ +#compdef rg + +## +# zsh completion function for ripgrep +# +# Originally based on code from the zsh-users project — see copyright notice +# below. + +_rg() { + local curcontext=$curcontext no='!' descr ret=1 + local -a context line state state_descr args tmp suf + local -A opt_args + + # ripgrep has many options which negate the effect of a more common one — for + # example, `--no-column` to negate `--column`, and `--messages` to negate + # `--no-messages`. There are so many of these, and they're so infrequently + # used, that some users will probably find it irritating if they're completed + # indiscriminately, so let's not do that unless either the current prefix + # matches one of those negation options or the user has the `complete-all` + # style set. Note that this prefix check has to be updated manually to account + # for all of the potential negation options listed below! + if + # We also want to list all of these options during testing + [[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] || + # (--[imnp]* => --ignore*, --messages, --no-*, --pcre2-unicode) + [[ $PREFIX$SUFFIX == --[imnp]* ]] || + zstyle -t ":complete:$curcontext:*" complete-all + then + no= + fi + + # We make heavy use of argument groups here to prevent the option specs from + # growing unwieldy. These aren't supported in zsh <5.4, though, so we'll strip + # them out below if necessary. This makes the exclusions inaccurate on those + # older versions, but oh well — it's not that big a deal + args=( + + '(exclusive)' # Misc. fully exclusive options + '(: * -)'{-h,--help}'[display help information]' + '(: * -)'{-V,--version}'[display version information]' + + + '(buffered)' # buffering options + '--line-buffered[force line buffering]' + $no"--no-line-buffered[don't force line buffering]" + '--block-buffered[force block buffering]' + $no"--no-block-buffered[don't force block buffering]" + + + '(case)' # Case-sensitivity options + {-i,--ignore-case}'[search case-insensitively]' + {-s,--case-sensitive}'[search case-sensitively]' + {-S,--smart-case}'[search case-insensitively if pattern is all lowercase]' + + + '(context-a)' # Context (after) options + '(context-c)'{-A+,--after-context=}'[specify lines to show after each match]:number of lines' + + + '(context-b)' # Context (before) options + '(context-c)'{-B+,--before-context=}'[specify lines to show before each match]:number of lines' + + + '(context-c)' # Context (combined) options + '(context-a context-b)'{-C+,--context=}'[specify lines to show before and after each match]:number of lines' + + + '(column)' # Column options + '--column[show column numbers for matches]' + $no"--no-column[don't show column numbers for matches]" + + + '(count)' # Counting options + {-c,--count}'[only show count of matching lines for each file]' + '--count-matches[only show count of individual matches for each file]' + + + '(encoding)' # Encoding options + {-E+,--encoding=}'[specify text encoding of files to search]: :_rg_encodings' + $no'--no-encoding[use default text encoding]' + + + file # File-input options + '(1)*'{-f+,--file=}'[specify file containing patterns to search for]: :_files' + + + '(file-match)' # Files with/without match options + '(stats)'{-l,--files-with-matches}'[only show names of files with matches]' + '(stats)--files-without-match[only show names of files without matches]' + + + '(file-name)' # File-name options + {-H,--with-filename}'[show file name for matches]' + "--no-filename[don't show file name for matches]" + + + '(file-system)' # File system options + "--one-file-system[don't descend into directories on other file systems]" + $no'--no-one-file-system[descend into directories on other file systems]' + + + '(fixed)' # Fixed-string options + {-F,--fixed-strings}'[treat pattern as literal string instead of regular expression]' + $no"--no-fixed-strings[don't treat pattern as literal string]" + + + '(follow)' # Symlink-following options + {-L,--follow}'[follow symlinks]' + $no"--no-follow[don't follow symlinks]" + + + glob # File-glob options + '*'{-g+,--glob=}'[include/exclude files matching specified glob]:glob' + '*--iglob=[include/exclude files matching specified case-insensitive glob]:glob' + + + '(heading)' # Heading options + '(pretty-vimgrep)--heading[show matches grouped by file name]' + "(pretty-vimgrep)--no-heading[don't show matches grouped by file name]" + + + '(hidden)' # Hidden-file options + '--hidden[search hidden files and directories]' + $no"--no-hidden[don't search hidden files and directories]" + + + '(ignore)' # Ignore-file options + "(--no-ignore-global --no-ignore-parent --no-ignore-vcs)--no-ignore[don't respect ignore files]" + $no'(--ignore-global --ignore-parent --ignore-vcs)--ignore[respect ignore files]' + + + '(ignore-global)' # Global ignore-file options + "--no-ignore-global[don't respect global ignore files]" + $no'--ignore-global[respect global ignore files]' + + + '(ignore-parent)' # Parent ignore-file options + "--no-ignore-parent[don't respect ignore files in parent directories]" + $no'--ignore-parent[respect ignore files in parent directories]' + + + '(ignore-vcs)' # VCS ignore-file options + "--no-ignore-vcs[don't respect version control ignore files]" + $no'--ignore-vcs[respect version control ignore files]' + + + '(json)' # JSON options + '--json[output results in JSON Lines format]' + $no"--no-json[don't output results in JSON Lines format]" + + + '(line-number)' # Line-number options + {-n,--line-number}'[show line numbers for matches]' + {-N,--no-line-number}"[don't show line numbers for matches]" + + + '(line-terminator)' # Line-terminator options + '--crlf[use CRLF as line terminator]' + $no"--no-crlf[don't use CRLF as line terminator]" + '(text)--null-data[use NUL as line terminator]' + + + '(max-depth)' # Directory-depth options + '--max-depth=[specify max number of directories to descend]:number of directories' + '!--maxdepth=:number of directories' + + + '(messages)' # Error-message options + '(--no-ignore-messages)--no-messages[suppress some error messages]' + $no"--messages[don't suppress error messages affected by --no-messages]" + + + '(messages-ignore)' # Ignore-error message options + "--no-ignore-messages[don't show ignore-file parse error messages]" + $no'--ignore-messages[show ignore-file parse error messages]' + + + '(mmap)' # mmap options + '--mmap[search using memory maps when possible]' + "--no-mmap[don't search using memory maps]" + + + '(multiline)' # Multiline options + {-U,--multiline}'[permit matching across multiple lines]' + $no'(multiline-dotall)--no-multiline[restrict matches to at most one line each]' + + + '(multiline-dotall)' # Multiline DOTALL options + '(--no-multiline)--multiline-dotall[allow "." to match newline (with -U)]' + $no"(--no-multiline)--no-multiline-dotall[don't allow \".\" to match newline (with -U)]" + + + '(only)' # Only-match options + {-o,--only-matching}'[show only matching part of each line]' + + + '(passthru)' # Pass-through options + '(--vimgrep)--passthru[show both matching and non-matching lines]' + '!(--vimgrep)--passthrough' + + + '(pcre2)' # PCRE2 options + {-P,--pcre2}'[enable matching with PCRE2]' + $no'(pcre2-unicode)--no-pcre2[disable matching with PCRE2]' + + + '(pcre2-unicode)' # PCRE2 Unicode options + $no'(--no-pcre2 --no-pcre2-unicode)--pcre2-unicode[enable PCRE2 Unicode mode (with -P)]' + '(--no-pcre2 --pcre2-unicode)--no-pcre2-unicode[disable PCRE2 Unicode mode (with -P)]' + + + '(pre)' # Preprocessing options + '(-z --search-zip)--pre=[specify preprocessor utility]:preprocessor utility:_command_names -e' + $no'--no-pre[disable preprocessor utility]' + + + pre-glob # Preprocessing glob options + '*--pre-glob[include/exclude files for preprocessing with --pre]' + + + '(pretty-vimgrep)' # Pretty/vimgrep display options + '(heading)'{-p,--pretty}'[alias for --color=always --heading -n]' + '(heading passthru)--vimgrep[show results in vim-compatible format]' + + + regexp # Explicit pattern options + '(1 file)*'{-e+,--regexp=}'[specify pattern]:pattern' + + + '(replace)' # Replacement options + {-r+,--replace=}'[specify string used to replace matches]:replace string' + + + '(sort)' # File-sorting options + '(threads)--sort=[sort results in ascending order (disables parallelism)]:sort method:(( + none\:"no sorting" + path\:"sort by file path" + modified\:"sort by last modified time" + accessed\:"sort by last accessed time" + created\:"sort by creation time" + ))' + '(threads)--sortr=[sort results in descending order (disables parallelism)]:sort method:(( + none\:"no sorting" + path\:"sort by file path" + modified\:"sort by last modified time" + accessed\:"sort by last accessed time" + created\:"sort by creation time" + ))' + '!(threads)--sort-files[sort results by file path (disables parallelism)]' + + + '(stats)' # Statistics options + '(--files file-match)--stats[show search statistics]' + $no"--no-stats[don't show search statistics]" + + + '(text)' # Binary-search options + {-a,--text}'[search binary files as if they were text]' + $no"(--null-data)--no-text[don't search binary files as if they were text]" + + + '(threads)' # Thread-count options + '(sort)'{-j+,--threads=}'[specify approximate number of threads to use]:number of threads' + + + '(trim)' # Trim options + '--trim[trim any ASCII whitespace prefix from each line]' + $no"--no-trim[don't trim ASCII whitespace prefix from each line]" + + + type # Type options + '*'{-t+,--type=}'[only search files matching specified type]: :_rg_types' + '*--type-add=[add new glob for specified file type]: :->typespec' + '*--type-clear=[clear globs previously defined for specified file type]: :_rg_types' + # This should actually be exclusive with everything but other type options + '(: *)--type-list[show all supported file types and their associated globs]' + '*'{-T+,--type-not=}"[don't search files matching specified file type]: :_rg_types" + + + '(word-line)' # Whole-word/line match options + {-w,--word-regexp}'[only show matches surrounded by word boundaries]' + {-x,--line-regexp}'[only show matches surrounded by line boundaries]' + + + '(zip)' # Compression options + '(--pre)'{-z,--search-zip}'[search in compressed files]' + $no"--no-search-zip[don't search in compressed files]" + + + misc # Other options — no need to separate these at the moment + '(-b --byte-offset)'{-b,--byte-offset}'[show 0-based byte offset for each matching line]' + '--color=[specify when to use colors in output]:when:(( + never\:"never use colors" + auto\:"use colors or not based on stdout, TERM, etc." + always\:"always use colors" + ansi\:"always use ANSI colors (even on Windows)" + ))' + '*--colors=[specify color and style settings]: :->colorspec' + '--context-separator=[specify string used to separate non-continuous context lines in output]:separator' + '--debug[show debug messages]' + '--dfa-size-limit=[specify upper size limit of generated DFA]:DFA size (bytes)' + "(1 stats)--files[show each file that would be searched (but don't search)]" + '*--ignore-file=[specify additional ignore file]:ignore file:_files' + '(-v --invert-match)'{-v,--invert-match}'[invert matching]' + '(-M --max-columns)'{-M+,--max-columns=}'[specify max length of lines to print]:number of bytes' + '(-m --max-count)'{-m+,--max-count=}'[specify max number of matches per file]:number of matches' + '--max-filesize=[specify size above which files should be ignored]:file size (bytes)' + "--no-config[don't load configuration files]" + '(-0 --null)'{-0,--null}'[print NUL byte after file names]' + '--path-separator=[specify path separator to use when printing file names]:separator' + '(-q --quiet)'{-q,--quiet}'[suppress normal output]' + '--regex-size-limit=[specify upper size limit of compiled regex]:regex size (bytes)' + '*'{-u,--unrestricted}'[reduce level of "smart" searching]' + + + operand # Operands + '(--files --type-list file regexp)1: :_guard "^-*" pattern' + '(--type-list)*: :_files' + ) + + # This is used with test_complete.sh to verify that there are no options + # listed in the help output that aren't also defined here + [[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] && { + print -rl - $args + return 0 + } + + # Strip out argument groups where unsupported (see above) + [[ $ZSH_VERSION == (4|5.<0-3>)(.*)# ]] && + args=( ${(@)args:#(#i)(+|[a-z0-9][a-z0-9_-]#|\([a-z0-9][a-z0-9_-]#\))} ) + + _arguments -C -s -S : $args && ret=0 + + case $state in + colorspec) + if [[ ${IPREFIX#--*=}$PREFIX == [^:]# ]]; then + suf=( -qS: ) + tmp=( + 'column:specify coloring for column numbers' + 'line:specify coloring for line numbers' + 'match:specify coloring for match text' + 'path:specify coloring for file names' + ) + descr='color/style type' + elif [[ ${IPREFIX#--*=}$PREFIX == (column|line|match|path):[^:]# ]]; then + suf=( -qS: ) + tmp=( + 'none:clear color/style for type' + 'bg:specify background color' + 'fg:specify foreground color' + 'style:specify text style' + ) + descr='color/style attribute' + elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:(bg|fg):[^:]# ]]; then + tmp=( black blue green red cyan magenta yellow white ) + descr='color name or r,g,b' + elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:style:[^:]# ]]; then + tmp=( {,no}bold {,no}intense {,no}underline ) + descr='style name' + else + _message -e colorspec 'no more arguments' + fi + + (( $#tmp )) && { + compset -P '*:' + _describe -t colorspec $descr tmp $suf && ret=0 + } + ;; + + typespec) + if compset -P '[^:]##:include:'; then + _sequence -s , _rg_types && ret=0 + # @todo This bit in particular could be better, but it's a little + # complex, and attempting to solve it seems to run us up against a crash + # bug — zsh # 40362 + elif compset -P '[^:]##:'; then + _message 'glob or include directive' && ret=1 + elif [[ ! -prefix *:* ]]; then + _rg_types -qS : && ret=0 + fi + ;; + esac + + return ret +} + +# Complete encodings +_rg_encodings() { + local -a expl + local -aU _encodings + + # This is impossible to read, but these encodings rarely if ever change, so it + # probably doesn't matter. They are derived from the list given here: + # https://encoding.spec.whatwg.org/#concept-encoding-get + _encodings=( + {{,us-}ascii,arabic,chinese,cyrillic,greek{,8},hebrew,korean} + logical visual mac {,cs}macintosh x-mac-{cyrillic,roman,ukrainian} + 866 ibm{819,866} csibm866 + big5{,-hkscs} {cn-,cs}big5 x-x-big5 + cp{819,866,125{0..8}} x-cp125{0..8} + csiso2022{jp,kr} csiso8859{6,8}{e,i} + csisolatin{{1..6},9} csisolatin{arabic,cyrillic,greek,hebrew} + ecma-{114,118} asmo-708 elot_928 sun_eu_greek + euc-{jp,kr} x-euc-jp cseuckr cseucpkdfmtjapanese + {,x-}gbk csiso58gb231280 gb18030 {,cs}gb2312 gb_2312{,-80} hz-gb-2312 + iso-2022-{cn,cn-ext,jp,kr} + iso8859{,-}{{1..11},13,14,15} + iso-8859-{{1..11},{6,8}-{e,i},13,14,15,16} iso_8859-{{1..9},15} + iso_8859-{1,2,6,7}:1987 iso_8859-{3,4,5,8}:1988 iso_8859-9:1989 + iso-ir-{58,100,101,109,110,126,127,138,144,148,149,157} + koi{,8,8-r,8-ru,8-u,8_r} cskoi8r + ks_c_5601-{1987,1989} ksc{,_}5691 csksc56011987 + latin{1..6} l{{1..6},9} + shift{-,_}jis csshiftjis {,x-}sjis ms_kanji ms932 + utf{,-}8 utf-16{,be,le} unicode-1-1-utf-8 + windows-{31j,874,949,125{0..8}} dos-874 tis-620 ansi_x3.4-1968 + x-user-defined auto + ) + + _wanted encodings expl encoding compadd -a "$@" - _encodings +} + +# Complete file types +_rg_types() { + local -a expl + local -aU _types + + _types=( ${(@)${(f)"$( _call_program types rg --type-list )"}%%:*} ) + + _wanted types expl 'file type' compadd -a "$@" - _types +} + +_rg "$@" + + +# ------------------------------------------------------------------------------ +# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# 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 ripgrep +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * arcizan <ghostrevery@gmail.com> +# * MaskRay <i@maskray.me> +# +# ------------------------------------------------------------------------------ + +# Local Variables: +# mode: shell-script +# coding: utf-8-unix +# indent-tabs-mode: nil +# sh-indentation: 2 +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et diff --git a/plugins/ros/README.mkd b/plugins/ros/README.mkd new file mode 100644 index 000000000..83573e499 --- /dev/null +++ b/plugins/ros/README.mkd @@ -0,0 +1,10 @@ +# Roswell Plugin + +This plugin adds completions and aliases for [Roswell](https://github.com/roswell/roswell/). + +To use it, add `ros` to the plugins array in your zshrc file: + +```zsh +plugins=(... ros) +``` + diff --git a/plugins/ros/_ros b/plugins/ros/_ros new file mode 100644 index 000000000..6a04d3c8f --- /dev/null +++ b/plugins/ros/_ros @@ -0,0 +1,64 @@ +#compdef ros +#autoload + +# roswell zsh completion, based on gem completion + +local -a _1st_arguments +_1st_arguments=( +'run: Run repl' +'install:Install a given implementation or a system for roswell environment' +'update:Update installed systems.' +'build:Make executable from script.' +'use:Change default implementation.' +'init:a new ros script, optionally based on a template.' +'fmt:Indent lisp source.' +'list:Information' +'template:[WIP] Manage templates' +'delete:Delete installed implementations' +'config:Get and set options' +'version:Show the roswell version information' +"help:Use \"ros help [command]\" for more information about a command."$'\n\t\t'"Use \"ros help [topic]\" for more information about the topic." +) + +#local expl + +_arguments \ + '(--version)'--version'[Print version information and quit]' \ + '(-w --wrap)'{-w,--wrap}'[\[CODE\] Run roswell with a shell wrapper CODE]' \ + '(-m --image)'{-m,--image}'[\[IMAGE\] continue from Lisp image IMAGE]' \ + '(-M --module)'{-M,--module}'[\[NAME\] Execute ros script found in ROSWELLPATH. (pythons -m)]' \ + '(-L --lisp)'{-L,--lisp}'[\[NAME\] Run roswell with a lisp impl NAME\[/VERSION\].]' \ + '(-l --load)'{-l,--load}'[\[FILE\] load lisp FILE while building]' \ + '(-S --source-registry)'{-S,--source-registry}'[\[X\] override source registry of asdf systems]' \ + '(-s --system --load-system)'{-s,--system,--load-system}'[\[SYSTEM\] load asdf SYSTEM while building]' \ + '(-p --package)'{-p,--package}'[\[PACKAGE\] change current package to \[PACKAGE\]]' \ + '(-sp --system-package)'{-sp,--system-package}'[\[SP\] combination of -s \[SP\] and -p \[SP\]]' \ + '(-e --eval)'{-e,--eval}'[\[FORM\] evaluate \[FORM\] while building]' \ + '--require'--require'[\[MODULE\] require \[MODULE\] while building]' \ + '(-q --quit)'{-q,--quit}'[quit lisp here]' \ + '(-r --restart)'{-r,--restart}'[\[FUNC\] restart from build by calling (\[FUNC\])]' \ + '(-E --entry)'{-E,--entry}'[\[FUNC\] restart from build by calling (\[FUNC\] argv)]' \ + '(-i --init)'{-i,--init}'[\[FORM\] evaluate \[FORM\] after restart]' \ + '(-ip --print)'{-ip,--print}'[\[FORM\] evaluate and princ \[FORM\] after restart]' \ + '(-iw --write)'{-iw,--write}'[\[FORM\] evaluate and write \[FORM\] after restart]' \ + '(-F --final)'{-F,--final}'[\[FORM\] evaluate \[FORM\] before dumping IMAGE]' \ + '(\+R --no-rc)'{\+R,--no-rc}'[skip /etc/rosrc, ~/.roswell/init.lisp]' \ + '(-A --asdf)'{-A,--asdf}'[use new asdf]' \ + '(\+Q --no-quicklisp)'{\+Q,--no-quicklisp}'[do not use quicklisp]' \ + '(-v --verbose)'{-v,--verbose}'[be quite noisy while building]' \ + '--quiet'--quiet'[be quite quiet while building default]' \ + '--test'--test'[for test purpose]' \ + '*:: :->subcmds' && return 0 + + +if (( CURRENT == 1 )); then + _describe -t commands "ros subcommand" _1st_arguments + return +fi + +# _files +case "$words[1]" in + -l|--load) + _files + ;; +esac diff --git a/plugins/rsync/README.md b/plugins/rsync/README.md new file mode 100644 index 000000000..032ee7f3b --- /dev/null +++ b/plugins/rsync/README.md @@ -0,0 +1,16 @@ +# 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` | diff --git a/plugins/ruby/README.md b/plugins/ruby/README.md new file mode 100644 index 000000000..ad2755bbf --- /dev/null +++ b/plugins/ruby/README.md @@ -0,0 +1,20 @@ +# 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 | diff --git a/plugins/rust/_rust b/plugins/rust/_rust index ac6aee160..6e3f344cd 100644 --- a/plugins/rust/_rust +++ b/plugins/rust/_rust @@ -88,14 +88,14 @@ _rustc_opts_vals=( --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[@]"' --color='[Configure coloring of output]:CONF:_values "COLORS" "$_rustc_color_types[@]"' - {-v,--version}'[Print version info and exit]::VERBOSE:(verbose)' ) _rustc_opts_switches=( -g'[Equivalent to --debuginfo=2]' -O'[Equivalent to --opt-level=2]' --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]' --no-analysis'[Parse and expand the output, but run no analysis or produce output]' --no-trans'[Run all passes except translation; no output]' diff --git a/plugins/safe-paste/safe-paste.plugin.zsh b/plugins/safe-paste/safe-paste.plugin.zsh index 17c212c19..75f1791d7 100644 --- a/plugins/safe-paste/safe-paste.plugin.zsh +++ b/plugins/safe-paste/safe-paste.plugin.zsh @@ -1,7 +1,7 @@ -# 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 -# 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 bindkey -N paste diff --git a/plugins/salt/README.md b/plugins/salt/README.md new file mode 100644 index 000000000..3d224cce7 --- /dev/null +++ b/plugins/salt/README.md @@ -0,0 +1,5 @@ +## 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. diff --git a/plugins/salt/_salt b/plugins/salt/_salt new file mode 100644 index 000000000..10b782af4 --- /dev/null +++ b/plugins/salt/_salt @@ -0,0 +1,279 @@ +#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 "$@" diff --git a/plugins/sbt/README.md b/plugins/sbt/README.md new file mode 100644 index 000000000..f1a5753b9 --- /dev/null +++ b/plugins/sbt/README.md @@ -0,0 +1,32 @@ +# 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 | diff --git a/plugins/sbt/_sbt b/plugins/sbt/_sbt index 91372aa72..a601c9b97 100644 --- a/plugins/sbt/_sbt +++ b/plugins/sbt/_sbt @@ -17,6 +17,7 @@ _sbt_commands=( 'package-src:produce a source artifact, such as a jar containing sources' 'publish:publish artifacts to a 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-main:run the main class selected by the first argument' 'test:execute all tests' diff --git a/plugins/sbt/sbt.plugin.zsh b/plugins/sbt/sbt.plugin.zsh index 15acfec4f..f883b7fee 100644 --- a/plugins/sbt/sbt.plugin.zsh +++ b/plugins/sbt/sbt.plugin.zsh @@ -7,9 +7,10 @@ # aliases - mnemonic: prefix is 'sb' alias sbc='sbt compile' +alias sbcc='sbt clean compile' alias sbco='sbt console' alias sbcq='sbt console-quick' -alias sbcl='sbt clean' +alias sbcln='sbt clean' alias sbcp='sbt console-project' alias sbd='sbt doc' alias sbdc='sbt dist:clean' diff --git a/plugins/scala/README.md b/plugins/scala/README.md new file mode 100644 index 000000000..957261d9e --- /dev/null +++ b/plugins/scala/README.md @@ -0,0 +1,15 @@ +## 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 | diff --git a/plugins/scala/_scala b/plugins/scala/_scala index 80434680c..f7511a647 100644 --- a/plugins/scala/_scala +++ b/plugins/scala/_scala @@ -1,6 +1,6 @@ #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. # # Redistribution and use in source and binary forms, with or without @@ -28,7 +28,7 @@ # Description # ----------- # -# Completion script for scala and scalac (http://www.scala-lang.org/). +# Completion script for scala and scalac (https://www.scala-lang.org/). # # ------------------------------------------------------------------------------ # Authors diff --git a/plugins/scd/README.md b/plugins/scd/README.md index 86ab67203..8c156da1f 100644 --- a/plugins/scd/README.md +++ b/plugins/scd/README.md @@ -14,8 +14,8 @@ directory aliases, which appear as named directories in zsh session. ## INSTALLATION NOTES 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 -[IPython](http://ipython.org/) extension. For installation details, see +shells and is also available as [Vim](https://www.vim.org/) plugin and +[IPython](https://ipython.org/) extension. For installation details, see https://github.com/pavoljuhas/smart-change-directory. ## SYNOPSIS diff --git a/plugins/scd/scd b/plugins/scd/scd index 39b28237d..39b28237d 100755..100644 --- a/plugins/scd/scd +++ b/plugins/scd/scd diff --git a/plugins/scw/_scw b/plugins/scw/_scw index f9fdf916e..0eb125c65 100644 --- a/plugins/scw/_scw +++ b/plugins/scw/_scw @@ -1,6 +1,6 @@ #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 diff --git a/plugins/sdk/README.md b/plugins/sdk/README.md new file mode 100644 index 000000000..b237f3b4c --- /dev/null +++ b/plugins/sdk/README.md @@ -0,0 +1,8 @@ +# sdk + +Plugin for SDKMAN, a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. +Provides autocompletion for all known commands. + +## Requirements + + * [SDKMAN](http://sdkman.io/) diff --git a/plugins/sdk/sdk.plugin.zsh b/plugins/sdk/sdk.plugin.zsh new file mode 100644 index 000000000..d00459b16 --- /dev/null +++ b/plugins/sdk/sdk.plugin.zsh @@ -0,0 +1,82 @@ +### SDKMAN Autocomplete for Oh My Zsh + +# This is the output from sdkman. All the these options are supported at the +# moment. + +# Usage: sdk <command> [candidate] [version] +# sdk offline <enable|disable> +# +# commands: +# install or i <candidate> [version] +# uninstall or rm <candidate> <version> +# list or ls [candidate] +# use or u <candidate> [version] +# default or d <candidate> [version] +# current or c [candidate] +# upgrade or ug [candidate] +# version or v +# broadcast or b +# help or h +# offline [enable|disable] +# selfupdate [force] +# update +# flush <candidates|broadcast|archives|temp> +# +# candidate : the SDK to install: groovy, scala, grails, gradle, kotlin, etc. +# use list command for comprehensive list of candidates +# eg: $ sdk list +# +# version : where optional, defaults to latest stable if not provided +# eg: $ sdk install groovy + +local _sdk_commands=( + install i + uninstall rm + list ls + use u + default d + current c + upgrade ug + version v + broadcast b + help h + offline + selfupdate + update + flush +) + +_listInstalledVersions() { + __sdkman_build_version_csv $1 | sed -e "s/,/ /g" +} + +_listInstallableVersions() { + __sdkman_list_versions $1 | grep "^ " | sed -e "s/\* /*/g" | \ + sed -e "s/>//g" | xargs -n 1 echo | grep -v "^*" +} + +_listAllVersion() { + __sdkman_list_versions $1 | grep "^ " | sed -e "s/\*/ /g" | sed -e "s/>//g" +} + +_sdk () { + case $CURRENT in + 2) compadd -- $_sdk_commands ;; + 3) case "$words[2]" in + i|install|rm|uninstall|ls|list|u|use|d|default|c|current|ug|upgrade) + compadd -- $SDKMAN_CANDIDATES ;; + offline) compadd -- enable disable ;; + selfupdate) compadd -- force ;; + flush) compadd -- candidates broadcast archives temp ;; + esac + ;; + 4) case "$words[2]" in + rm|uninstall|d|default) compadd -- $(_listInstalledVersions $words[3]) ;; + i|install) compadd -- $(_listInstallableVersions $words[3]) ;; + u|use) compadd -- $(_listAllVersion $words[3]) ;; + esac + ;; + esac +} + +compdef _sdk sdk diff --git a/plugins/sfdx/README.md b/plugins/sfdx/README.md new file mode 100644 index 000000000..259c17fbe --- /dev/null +++ b/plugins/sfdx/README.md @@ -0,0 +1,11 @@ +# sfdx plugin + +This plugin provides autocompletion for the [Salesforce DX](https://developer.salesforce.com/tools/sfdxcli) CLI. + +To use it, add `sfdx` to the plugins array in your zshrc file: + +```zsh +plugins=(... sfdx) +``` + +Original repository: https://github.com/wadewegner/salesforce-cli-zsh-completion diff --git a/plugins/sfdx/_sfdx b/plugins/sfdx/_sfdx new file mode 100644 index 000000000..42ee55970 --- /dev/null +++ b/plugins/sfdx/_sfdx @@ -0,0 +1,1110 @@ +#compdef sfdx + +# DESCRIPTION: Zsh completion script for the Salesforce CLI +# AUTHOR: Wade Wegner (@WadeWegner) +# REPO: https://github.com/wadewegner/salesforce-cli-zsh-completion +# LICENSE: https://github.com/wadewegner/salesforce-cli-zsh-completion/blob/master/LICENSE + +local -a _1st_arguments + +_1st_arguments=( + "force\:alias\:list":"list username aliases for the Salesforce CLI" + "force\:alias\:set":"set username aliases for the Salesforce CLI" + "force\:apex\:class\:create":"create an Apex class" + "force\:apex\:execute":"execute anonymous Apex code" + "force\:apex\:log\:get":"fetch a debug log" + "force\:apex\:log\:list":"list debug logs" + "force\:apex\:log\:tail":"start debug logging and display logs" + "force\:apex\:test\:report":"display test results" + "force\:apex\:test\:run":"invoke Apex tests" + "force\:apex\:trigger\:create":"create an Apex trigger" + "force\:auth\:jwt\:grant":"authorize an org using the JWT flow" + "force\:auth\:logout":"log out from authorized orgs" + "force\:auth\:sfdxurl\:store":"authorize an org using an SFDX auth URL" + "force\:auth\:web\:login":"authorize an org using the web login flow" + "force\:config\:get":"get config var values for given names" + "force\:config\:list":"list config vars for the Salesforce CLI" + "force\:config\:set":"set config vars for the Salesforce CLI" + "force\:data\:bulk\:delete":"bulk delete records from a csv file" + "force\:data\:bulk\:status":"view the status of a bulk data load job or batch" + "force\:data\:bulk\:upsert":"bulk upsert records from a CSV file" + "force\:data\:record\:create":"create a record" + "force\:data\:record\:delete":"delete a record" + "force\:data\:record\:get":"view a record" + "force\:data\:record\:update":"update a record" + "force\:data\:soql\:query":"execute a SOQL query" + "force\:data\:tree\:export":"export data from an org into sObject tree format for force:data:tree:import consumption" + "force\:data\:tree\:import":"import data into an org using SObject Tree Save API" + "force\:doc\:commands\:display":"display help for force commands" + "force\:doc\:commands\:list":"list the force commands" + "force\:lightning\:app\:create":"create a Lightning app" + "force\:lightning\:component\:create":"create a bundle for an Aura component or a Lightning web component" + "force\:lightning\:event\:create":"create a Lightning event" + "force\:lightning\:interface\:create":"create a Lightning interface" + "force\:lightning\:lint":"analyse (lint) Lightning component code" + "force\:lightning\:test\:create":"create a Lightning test" + "force\:lightning\:test\:install":"install Lightning Testing Service unmanaged package in your org" + "force\:lightning\:test\:run":"invoke Aura component tests" + "force\:limits\:api\:display":"display current org’s limits" + "force\:mdapi\:convert":"convert metadata from the Metadata API format into the source format" + "force\:mdapi\:deploy":"deploy metadata to an org using Metadata API" + "force\:mdapi\:deploy\:cancel":"cancel a metadata deployment" + "force\:mdapi\:deploy\:report":"check the status of a metadata deployment" + "force\:mdapi\:retrieve":"retrieve metadata from an org using Metadata API" + "force\:mdapi\:retrieve\:report":"check the status of a metadata retrieval" + "force\:org\:create":"create a scratch org" + "force\:org\:delete":"mark a scratch org for deletion" + "force\:org\:display":"get org description" + "force\:org\:list":"list all orgs you’ve created or authenticated to" + "force\:org\:open":"open an org in your browser" + "force\:org\:shape\:create":"create a snapshot of org edition, features, and licenses" + "force\:org\:shape\:delete":"delete all org shapes for a target org" + "force\:org\:shape\:list":"list all org shapes you’ve created" + "force\:org\:snapshot\:create":"snapshot a scratch org" + "force\:org\:snapshot\:delete":"delete a scratch org snapshot" + "force\:org\:snapshot\:get":"get details about a scratch org snapshot" + "force\:org\:snapshot\:list":"list scratch org snapshots" + "force\:package1\:version\:create":"create a first-generation package version in the release org" + "force\:package1\:version\:create\:get":"retrieve the status of a package version creation request" + "force\:package1\:version\:display":"display details about a first-generation package version" + "force\:package1\:version\:list":"list package versions for the specified first-generation package or for the org" + "force\:package\:create":"create a package" + "force\:package\:hammertest\:list":"list the statuses of running and completed hammer tests" + "force\:package\:hammertest\:report":"display the status or results of a hammer test" + "force\:package\:hammertest\:run":"run ISV Hammer" + "force\:package\:install":"install a package in the target org" + "force\:package\:install\:report":"retrieve the status of a package installation request" + "force\:package\:installed\:list":"list the org’s installed packages" + "force\:package\:list":"list all packages in the Dev Hub org" + "force\:package\:uninstall":"uninstall a second-generation package from the target org" + "force\:package\:uninstall\:report":"retrieve status of package uninstall request" + "force\:package\:update":"update package details" + "force\:package\:version\:create":"create a package version" + "force\:package\:version\:create\:list":"list package version creation requests" + "force\:package\:version\:create\:report":"retrieve details about a package version creation request" + "force\:package\:version\:list":"list all package versions in the Dev Hub org" + "force\:package\:version\:promote":"promote a package version to released" + "force\:package\:version\:report":"retrieve details about a package version in the Dev Hub org" + "force\:package\:version\:update":"update a package version" + "force\:project\:create":"create a new SFDX project" + "force\:project\:upgrade":"update project config files to the latest format" + "force\:schema\:sobject\:describe":"describe an object" + "force\:schema\:sobject\:list":"list all objects of a specified category" + "force\:source\:convert":"convert source into Metadata API format" + "force\:source\:delete":"delete source from your project and from a non-source-tracked org" + "force\:source\:deploy":"deploy source to a non-source-tracked org" + "force\:source\:open":"edit a Lightning Page with Lightning App Builder" + "force\:source\:pull":"pull source from the scratch org to the project" + "force\:source\:push":"push source to a scratch org from the project" + "force\:source\:retrieve":"retrieve source from a non-source-tracked org" + "force\:source\:status":"list local changes and/or changes in a scratch org" + "force\:user\:create":"create a user for a scratch org" + "force\:user\:display":"displays information about a user of a scratch org" + "force\:user\:list":"lists all users of a scratch org" + "force\:user\:password\:generate":"generate a password for scratch org users" + "force\:user\:permset\:assign":"assign a permission set to one or more users of an org" + "force\:visualforce\:component\:create":"create a Visualforce component" + "force\:visualforce\:page\:create":"create a Visualforce page" +) + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "sfdx command" _1st_arguments + return +fi + +local -a _command_args +case "$words[1]" in + force:limits:api:display) + _command_args=( + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:lightning:app:create) + _command_args=( + '(-n|--appname)'{-n,--appname}'[name of the generated Lightning app]' \ + '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultLightningApp*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-a|--apiversion)'{-a,--apiversion}'[API version number (45.0*,44.0)]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:bulk:delete) + _command_args=( + '(-s|--sobjecttype)'{-s,--sobjecttype}'[the sObject type of the records you’re deleting]' \ + '(-f|--csvfile)'{-f,--csvfile}'[the path to the CSV file containing the ids of the records to delete]:file:_files' \ + '(-w|--wait)'{-w,--wait}'[the number of minutes to wait for the command to complete before displaying the results]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:bulk:status) + _command_args=( + '(-i|--jobid)'{-i,--jobid}'[the ID of the job you want to view or of the job whose batch you want to view]' \ + '(-b|--batchid)'{-b,--batchid}'[the ID of the batch whose status you want to view]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:bulk:upsert) + _command_args=( + '(-s|--sobjecttype)'{-s,--sobjecttype}'[the sObject type of the records you want to upsert]' \ + '(-f|--csvfile)'{-f,--csvfile}'[the path to the CSV file that defines the records to upsert]:file:_files' \ + '(-i|--externalid)'{-i,--externalid}'[the column name of the external ID]' \ + '(-w|--wait)'{-w,--wait}'[the number of minutes to wait for the command to complete before displaying the results]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:apex:class:create) + _command_args=( + '(-n|--classname)'{-n,--classname}'[name of the generated Apex class]' \ + '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultApexClass*,ApexException,ApexUnitTest,InboundEmailService)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-a|--apiversion)'{-a,--apiversion}'[API version number (45.0*,44.0)]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:doc:commands:display) + _command_args=( + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:doc:commands:list) + _command_args=( + '(-u|--usage)'{-u,--usage}'[list only docopt usage strings]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:visualforce:component:create) + _command_args=( + '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultVFComponent*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-n|--componentname)'{-n,--componentname}'[name of the generated Visualforce component]' \ + '(-a|--apiversion)'{-a,--apiversion}'[API version number (45.0*,44.0)]' \ + '(-l|--label)'{-l,--label}'[Visualforce component label]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:lightning:component:create) + _command_args=( + '(-n|--componentname)'{-n,--componentname}'[name of the generated Lightning component]' \ + '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultLightningCmp*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-a|--apiversion)'{-a,--apiversion}'[API version number (45.0*,44.0)]' \ + '(--type)--type[type of the Lightning component (aura*,lwc)]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:mdapi:convert) + _command_args=( + '(-r|--rootdir)'{-r,--rootdir}'[the root directory containing the Metadata API–formatted metadata]:file:_files' \ + '(-d|--outputdir)'{-d,--outputdir}'[the output directory to store the source–formatted files]:file:_files' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:source:convert) + _command_args=( + '(-r|--rootdir)'{-r,--rootdir}'[a source directory other than the default package to convert]:file:_files' \ + '(-d|--outputdir)'{-d,--outputdir}'[output directory to store the Metadata API–formatted files in]:file:_files' \ + '(-n|--packagename)'{-n,--packagename}'[name of the package to associate with the metadata-formatted files]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:create) + _command_args=( + '(-f|--definitionfile)'{-f,--definitionfile}'[path to a scratch org definition file]:file:_files' \ + '(-j|--definitionjson)'{-j,--definitionjson}'[scratch org definition in json format ]' \ + '(-n|--nonamespace)'{-n,--nonamespace}'[creates the scratch org with no namespace]' \ + '(-c|--noancestors)'{-c,--noancestors}'[do not include second-generation package ancestors in the scratch org]' \ + '(-i|--clientid)'{-i,--clientid}'[connected app consumer key]' \ + '(-s|--setdefaultusername)'{-s,--setdefaultusername}'[set the created org as the default username]' \ + '(-a|--setalias)'{-a,--setalias}'[set an alias for for the created scratch org]' \ + '(-e|--env)'{-e,--env}'[environment where the scratch org is created: \[sandbox*,virtual,prototype\] (sandbox*,virtual,prototype)]' \ + '(-w|--wait)'{-w,--wait}'[the streaming client socket timeout (in minutes) (default:6, min:2)]' \ + '(-d|--durationdays)'{-d,--durationdays}'[duration of the scratch org (in days) (default:7, min:1, max:30)]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:create) + _command_args=( + '(-n|--name)'{-n,--name}'[package name]' \ + '(-t|--packagetype)'{-t,--packagetype}'[package type (Managed,Unlocked)]' \ + '(-d|--description)'{-d,--description}'[package description]' \ + '(-e|--nonamespace)'{-e,--nonamespace}'[creates the package with no namespace; available only for unlocked packages.]' \ + '(-r|--path)'{-r,--path}'[path to directory that contains the contents of the package]:file:_files' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:user:create) + _command_args=( + '(-f|--definitionfile)'{-f,--definitionfile}'[file path to a user definition]:file:_files' \ + '(-a|--setalias)'{-a,--setalias}'[set an alias for the created username to reference within the CLI]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:project:create) + _command_args=( + '(-n|--projectname)'{-n,--projectname}'[name of the generated project]' \ + '(-t|--template)'{-t,--template}'[template to use for file creation (Defaultsfdx-project.json*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-l|--loginurl)'{-l,--loginurl}'[Salesforce instance login URL (https://login.salesforce.com*)]' \ + '(--sourceapiversion)--sourceapiversion[source API version number (45.0*)]' \ + '(-s|--namespace)'{-s,--namespace}'[project associated namespace]' \ + '(-p|--defaultpackagedir)'{-p,--defaultpackagedir}'[default package directory name (force-app*)]' \ + '(-x|--manifest)'{-x,--manifest}'[generate a manifest (package.xml) for change-set-based development]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:delete) + _command_args=( + '(-p|--noprompt)'{-p,--noprompt}'[no prompt to confirm deletion]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:source:delete) + _command_args=( + '(-r|--noprompt)'{-r,--noprompt}'[do not prompt for delete confirmation]' \ + '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 33) (default:33, min:1)]' \ + '(-p|--sourcepath)'{-p,--sourcepath}'[comma-separated list of paths to the local metadata to delete]:file:_files' \ + '(-m|--metadata)'{-m,--metadata}'[comma-separated list of names of metadata components to delete]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:mdapi:deploy) + _command_args=( + '(-c|--checkonly)'{-c,--checkonly}'[validate deploy but don’t save to the org (default:false)]' \ + '(-d|--deploydir)'{-d,--deploydir}'[root of directory tree of files to deploy]:file:_files' \ + '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 0)]' \ + '(-i|--jobid)'{-i,--jobid}'[(deprecated) job ID of the deployment you want to check; defaults to your most recent CLI deployment if not specified]' \ + '(-l|--testlevel)'{-l,--testlevel}'[deployment testing level (NoTestRun,RunSpecifiedTests,RunLocalTests,RunAllTestsInOrg)]' \ + '(-r|--runtests)'{-r,--runtests}'[tests to run if --testlevel RunSpecifiedTests]' \ + '(-e|--rollbackonerror)'{-e,--rollbackonerror}'[(deprecated) roll back deployment for any failure (default:true)]' \ + '(-o|--ignoreerrors)'{-o,--ignoreerrors}'[ignore any errors and do not roll back deployment (default:false)]' \ + '(-g|--ignorewarnings)'{-g,--ignorewarnings}'[whether a warning will allow a deployment to complete successfully (default:false)]' \ + '(-q|--validateddeployrequestid)'{-q,--validateddeployrequestid}'[request ID of the validated deployment to run a Quick Deploy]' \ + '(-f|--zipfile)'{-f,--zipfile}'[path to .zip file of metadata to deploy]:file:_files' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[verbose output of deploy results]' \ + ) + ;; + force:source:deploy) + _command_args=( + '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 33) (default:33, min:1)]' \ + '(-m|--metadata)'{-m,--metadata}'[comma-separated list of metadata component names]' \ + '(-p|--sourcepath)'{-p,--sourcepath}'[comma-separated list of paths to the local source files to deploy]:file:_files' \ + '(-x|--manifest)'{-x,--manifest}'[file path for manifest (package.xml) of components to deploy]:file:_files' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:mdapi:deploy:cancel) + _command_args=( + '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 33) (default:33, min:1)]' \ + '(-i|--jobid)'{-i,--jobid}'[job ID of the deployment you want to cancel; defaults to your most recent CLI deployment if not specified]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:mdapi:deploy:report) + _command_args=( + '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 0)]' \ + '(-i|--jobid)'{-i,--jobid}'[job ID of the deployment you want to check; defaults to your most recent CLI deployment if not specified]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[verbose output of deploy results]' \ + ) + ;; + force:org:display) + _command_args=( + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[emit additional command output to stdout]' \ + ) + ;; + force:user:display) + _command_args=( + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:lightning:event:create) + _command_args=( + '(-n|--eventname)'{-n,--eventname}'[name of the generated Lightning event]' \ + '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultLightningEvt*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-a|--apiversion)'{-a,--apiversion}'[API version number (45.0*,44.0)]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:apex:execute) + _command_args=( + '(-f|--apexcodefile)'{-f,--apexcodefile}'[path to a local file containing Apex code]:file:_files' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:config:get) + _command_args=( + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[emit additional command output to stdout]' \ + ) + ;; + force:package:hammertest:list) + _command_args=( + '(-i|--packageversionid)'{-i,--packageversionid}'[ID of the package version to list results for]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:hammertest:report) + _command_args=( + '(-i|--requestid)'{-i,--requestid}'[ID of the hammer request to report on]' \ + '(-s|--summary)'{-s,--summary}'[report only a results summary (hide Apex test failures)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:hammertest:run) + _command_args=( + '(-i|--packageversionid)'{-i,--packageversionid}'[ID of the package version to test]' \ + '(-s|--subscriberorg)'{-s,--subscriberorg}'[comma-separated list of subscriber orgs IDs]' \ + '(-f|--subscriberfile)'{-f,--subscriberfile}'[file with list of subscriber orgs IDs, one per line]' \ + '(-d|--scheduledrundatetime)'{-d,--scheduledrundatetime}'[earliest date/time to run the test]' \ + '(-p|--preview)'{-p,--preview}'[run the package hammer test in the Salesforce preview version]' \ + '(-t|--apextests)'{-t,--apextests}'[run the apex tests in the subscriber org]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:install) + _command_args=( + '(-w|--wait)'{-w,--wait}'[number of minutes to wait for installation status]' \ + '(-k|--installationkey)'{-k,--installationkey}'[installation key for key-protected package (default: null)]' \ + '(-b|--publishwait)'{-b,--publishwait}'[number of minutes to wait for subscriber package version ID to become available in the target org ]' \ + '(-r|--noprompt)'{-r,--noprompt}'[allow Remote Site Settings and Content Security Policy websites to send or receive data without confirmation]' \ + '(-p|--package)'{-p,--package}'[ID (starts with 04t) or alias of the package version to install]' \ + '(-s|--securitytype)'{-s,--securitytype}'[security access type for the installed package (AllUsers,AdminsOnly)]' \ + '(-t|--upgradetype)'{-t,--upgradetype}'[the upgrade type for the package installation (Mixed*,DeprecateOnly)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:install:report) + _command_args=( + '(-i|--requestid)'{-i,--requestid}'[ID of the package install request you want to check]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:installed:list) + _command_args=( + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:lightning:interface:create) + _command_args=( + '(-n|--interfacename)'{-n,--interfacename}'[name of the generated Lightning interface]' \ + '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultLightningIntf*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-a|--apiversion)'{-a,--apiversion}'[API version number (45.0*,44.0)]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:auth:jwt:grant) + _command_args=( + '(-u|--username)'{-u,--username}'[authentication username]' \ + '(-f|--jwtkeyfile)'{-f,--jwtkeyfile}'[path to a file containing the private key]:file:_files' \ + '(-i|--clientid)'{-i,--clientid}'[OAuth client ID (sometimes called the consumer key)]' \ + '(-r|--instanceurl)'{-r,--instanceurl}'[the login URL of the instance the org lives on]' \ + '(-d|--setdefaultdevhubusername)'{-d,--setdefaultdevhubusername}'[set the authenticated org as the default dev hub org for scratch org creation]' \ + '(-s|--setdefaultusername)'{-s,--setdefaultusername}'[set the authenticated org as the default username that all commands run against]' \ + '(-a|--setalias)'{-a,--setalias}'[set an alias for the authenticated org]' \ + '(-p|--noprompt)'{-p,--noprompt}'[do not prompt for auth confirmation in demo mode]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:lightning:lint) + _command_args=( + '(--ignore)--ignore[pattern used to ignore some folders]' \ + '(--files)--files[pattern used to include specific files]' \ + '(--json)--json[format output as JSON]' \ + '(--config)--config[path to a custom ESLint configuration file]' \ + '(--verbose)--verbose[report warnings in addition to errors]' \ + '(--exit)--exit[exit with error code 1 if there are lint issues]' \ + ) + ;; + force:alias:list) + _command_args=( + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:config:list) + _command_args=( + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:list) + _command_args=( + '(--all)--all[include expired, deleted, and unknown-status scratch orgs]' \ + '(--clean)--clean[remove all local org authorizations for non-active orgs]' \ + '(-p|--noprompt)'{-p,--noprompt}'[do not prompt for confirmation]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[list more information about each org]' \ + ) + ;; + force:package:list) + _command_args=( + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[display extended package detail]' \ + ) + ;; + force:user:list) + _command_args=( + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:apex:log:get) + _command_args=( + '(-c|--color)'{-c,--color}'[colorize noteworthy log lines]' \ + '(-i|--logid)'{-i,--logid}'[ID of the log to display]' \ + '(-n|--number)'{-n,--number}'[number of most recent logs to display (min:1, max:25)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:apex:log:list) + _command_args=( + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:apex:log:tail) + _command_args=( + '(-c|--color)'{-c,--color}'[colorize noteworthy log lines]' \ + '(-d|--debuglevel)'{-d,--debuglevel}'[debug level for trace flag]' \ + '(-s|--skiptraceflag)'{-s,--skiptraceflag}'[skip trace flag setup]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:auth:logout) + _command_args=( + '(-a|--all)'{-a,--all}'[include all authenticated orgs]' \ + '(-p|--noprompt)'{-p,--noprompt}'[do not prompt for confirmation]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:open) + _command_args=( + '(-p|--path)'{-p,--path}'[navigation URL path]' \ + '(-r|--urlonly)'{-r,--urlonly}'[display navigation URL, but don’t launch browser]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:source:open) + _command_args=( + '(-f|--sourcefile)'{-f,--sourcefile}'[file to edit]:file:_files' \ + '(-r|--urlonly)'{-r,--urlonly}'[generate a navigation URL; don’t launch the editor]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:visualforce:page:create) + _command_args=( + '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultVFPage*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-n|--pagename)'{-n,--pagename}'[name of the generated Visualforce page]' \ + '(-a|--apiversion)'{-a,--apiversion}'[API version number (45.0*,44.0)]' \ + '(-l|--label)'{-l,--label}'[Visualforce page label]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:user:password:generate) + _command_args=( + '(-o|--onbehalfof)'{-o,--onbehalfof}'[comma-separated list of usernames for which to generate passwords]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:user:permset:assign) + _command_args=( + '(-n|--permsetname)'{-n,--permsetname}'[the name of the permission set to assign]' \ + '(-o|--onbehalfof)'{-o,--onbehalfof}'[comma-separated list of usernames or aliases to assign the permission set to]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:source:pull) + _command_args=( + '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 33) (default:33, min:1)]' \ + '(-f|--forceoverwrite)'{-f,--forceoverwrite}'[ignore conflict warnings and overwrite changes to the project]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:source:push) + _command_args=( + '(-f|--forceoverwrite)'{-f,--forceoverwrite}'[ignore conflict warnings and overwrite changes to scratch org]' \ + '(-g|--ignorewarnings)'{-g,--ignorewarnings}'[deploy changes even if warnings are generated]' \ + '(-r|--replacetokens)'{-r,--replacetokens}'[replace tokens in source files prior to deployment]' \ + '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 33) (default:33, min:1)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:record:create) + _command_args=( + '(-s|--sobjecttype)'{-s,--sobjecttype}'[the type of the record you’re creating]' \ + '(-v|--values)'{-v,--values}'[the <fieldName>=<value> pairs you’re creating]' \ + '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[create the record with tooling api]' \ + '(--perflog)--perflog[get API performance data.]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:record:delete) + _command_args=( + '(-s|--sobjecttype)'{-s,--sobjecttype}'[the type of the record you’re deleting]' \ + '(-i|--sobjectid)'{-i,--sobjectid}'[the ID of the record you’re deleting]' \ + '(-w|--where)'{-w,--where}'[a list of <fieldName>=<value> pairs to search for]' \ + '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[delete the record with Tooling API]' \ + '(--perflog)--perflog[get API performance data.]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:record:get) + _command_args=( + '(-s|--sobjecttype)'{-s,--sobjecttype}'[the type of the record you’re retrieving]' \ + '(-i|--sobjectid)'{-i,--sobjectid}'[the ID of the record you’re retrieving]' \ + '(-w|--where)'{-w,--where}'[a list of <fieldName>=<value> pairs to search for]' \ + '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[retrieve the record with Tooling API]' \ + '(--perflog)--perflog[get API performance data.]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:record:update) + _command_args=( + '(-s|--sobjecttype)'{-s,--sobjecttype}'[the type of the record you’re updating]' \ + '(-i|--sobjectid)'{-i,--sobjectid}'[the ID of the record you’re updating]' \ + '(-w|--where)'{-w,--where}'[a list of <fieldName>=<value> pairs to search for]' \ + '(-v|--values)'{-v,--values}'[the <fieldName>=<value> pairs you’re updating]' \ + '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[update the record with Tooling API]' \ + '(--perflog)--perflog[get API performance data.]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:mdapi:retrieve) + _command_args=( + '(-a|--apiversion)'{-a,--apiversion}'[target API version for the retrieve (default 45.0)]' \ + '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: -1 (no limit))]' \ + '(-r|--retrievetargetdir)'{-r,--retrievetargetdir}'[directory root for the retrieved files]:file:_files' \ + '(-k|--unpackaged)'{-k,--unpackaged}'[file path of manifest of components to retrieve]:file:_files' \ + '(-d|--sourcedir)'{-d,--sourcedir}'[source dir to use instead of default manifest sfdx-project.xml]:file:_files' \ + '(-p|--packagenames)'{-p,--packagenames}'[a comma-separated list of packages to retrieve]' \ + '(-s|--singlepackage)'{-s,--singlepackage}'[a single-package retrieve (default: false)]' \ + '(-i|--jobid)'{-i,--jobid}'[(deprecated) job ID of the retrieve you want to check; defaults to your most recent CLI retrieval if not specified]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[verbose output of retrieve result]' \ + ) + ;; + force:source:retrieve) + _command_args=( + '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 33) (default:33, min:1)]' \ + '(-x|--manifest)'{-x,--manifest}'[file path for manifest (package.xml) of components to retrieve]:file:_files' \ + '(-m|--metadata)'{-m,--metadata}'[comma-separated list of metadata component names]' \ + '(-p|--sourcepath)'{-p,--sourcepath}'[comma-separated list of source file paths to retrieve]:file:_files' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:mdapi:retrieve:report) + _command_args=( + '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: -1 (no limit))]' \ + '(-r|--retrievetargetdir)'{-r,--retrievetargetdir}'[directory root for the retrieved files]:file:_files' \ + '(-i|--jobid)'{-i,--jobid}'[job ID of the retrieve you want to check; defaults to your most recent CLI retrieval if not specified]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[verbose output of retrieve result]' \ + ) + ;; + force:alias:set) + _command_args=( + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:config:set) + _command_args=( + '(-g|--global)'{-g,--global}'[set config var globally (to be used from any directory)]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:auth:sfdxurl:store) + _command_args=( + '(-f|--sfdxurlfile)'{-f,--sfdxurlfile}'[path to a file containing the sfdx url]:file:_files' \ + '(-d|--setdefaultdevhubusername)'{-d,--setdefaultdevhubusername}'[set the authenticated org as the default dev hub org for scratch org creation]' \ + '(-s|--setdefaultusername)'{-s,--setdefaultusername}'[set the authenticated org as the default username that all commands run against]' \ + '(-a|--setalias)'{-a,--setalias}'[set an alias for the authenticated org]' \ + '(-p|--noprompt)'{-p,--noprompt}'[do not prompt for auth confirmation in demo mode]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:shape:create) + _command_args=( + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:shape:delete) + _command_args=( + '(-p|--noprompt)'{-p,--noprompt}'[do not prompt for confirmation]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username for the target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:shape:list) + _command_args=( + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[list more information about each org shape]' \ + ) + ;; + force:org:snapshot:create) + _command_args=( + '(-o|--sourceorg)'{-o,--sourceorg}'[ID or locally authenticated username or alias of scratch org to snapshot]' \ + '(-n|--snapshotname)'{-n,--snapshotname}'[unique name of snapshot]' \ + '(-d|--description)'{-d,--description}'[description of snapshot]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:snapshot:delete) + _command_args=( + '(-s|--snapshot)'{-s,--snapshot}'[name or ID of snapshot to delete]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:snapshot:get) + _command_args=( + '(-s|--snapshot)'{-s,--snapshot}'[name or ID of snapshot to retrieve]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:org:snapshot:list) + _command_args=( + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:schema:sobject:describe) + _command_args=( + '(-s|--sobjecttype)'{-s,--sobjecttype}'[the API name of the object to describe]' \ + '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[execute with Tooling API]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:schema:sobject:list) + _command_args=( + '(-c|--sobjecttypecategory)'{-c,--sobjecttypecategory}'[the type of objects to list (all|custom|standard)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:soql:query) + _command_args=( + '(-q|--query)'{-q,--query}'[SOQL query to execute]' \ + '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[execute query with Tooling API]' \ + '(-r|--resultformat)'{-r,--resultformat}'[query result format emitted to stdout; --json flag overrides this parameter (human*,csv,json)]' \ + '(--perflog)--perflog[get API performance data.]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:source:status) + _command_args=( + '(-a|--all)'{-a,--all}'[list all the changes that have been made]' \ + '(-l|--local)'{-l,--local}'[list the changes that have been made locally]' \ + '(-r|--remote)'{-r,--remote}'[list the changes that have been made in the scratch org]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:lightning:test:create) + _command_args=( + '(-n|--testname)'{-n,--testname}'[name of the generated Lightning test]' \ + '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultLightningTest*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:lightning:test:install) + _command_args=( + '(-w|--wait)'{-w,--wait}'[number of minutes to wait for installation status (default:2)]' \ + '(-r|--releaseversion)'{-r,--releaseversion}'[release version of Lightning Testing Service (default:latest)]' \ + '(-t|--packagetype)'{-t,--packagetype}'[type of unmanaged package. 'full' option contains both jasmine and mocha, plus examples (full*,jasmine,mocha)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:apex:test:report) + _command_args=( + '(-i|--testrunid)'{-i,--testrunid}'[ID of test run]' \ + '(-c|--codecoverage)'{-c,--codecoverage}'[retrieve code coverage results]' \ + '(-d|--outputdir)'{-d,--outputdir}'[directory to store test run files]:file:_files' \ + '(-r|--resultformat)'{-r,--resultformat}'[test result format emitted to stdout; --json flag overrides this parameter (human*,tap,junit,json)]' \ + '(-w|--wait)'{-w,--wait}'[the streaming client socket timeout (in minutes) (default:6, min:2)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[display Apex test processing details]' \ + ) + ;; + force:apex:test:run) + _command_args=( + '(-n|--classnames)'{-n,--classnames}'[comma-separated list of Apex test class names to run]' \ + '(-s|--suitenames)'{-s,--suitenames}'[comma-separated list of Apex test suite names to run]' \ + '(-t|--tests)'{-t,--tests}'[comma-separated list of Apex test class names or IDs and, if applicable, test methods to run]' \ + '(-c|--codecoverage)'{-c,--codecoverage}'[retrieve code coverage results]' \ + '(-d|--outputdir)'{-d,--outputdir}'[directory to store test run files]:file:_files' \ + '(-l|--testlevel)'{-l,--testlevel}'[testlevel enum value (RunLocalTests,RunAllTestsInOrg,RunSpecifiedTests)]' \ + '(-r|--resultformat)'{-r,--resultformat}'[test result format emitted to stdout; --json flag overrides this parameter (human*,tap,junit,json)]' \ + '(-w|--wait)'{-w,--wait}'[the streaming client socket timeout (in minutes) (default:6, min:2)]' \ + '(--precompilewait)--precompilewait[how long to wait (in minutes) for Apex pre-compilation (default:3, min:3)]' \ + '(-y|--synchronous)'{-y,--synchronous}'[run tests from a single class synchronously]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[display Apex test processing details]' \ + ) + ;; + force:lightning:test:run) + _command_args=( + '(-a|--appname)'{-a,--appname}'[name of your Lightning test application]' \ + '(-d|--outputdir)'{-d,--outputdir}'[directory path to store test run artifacts: for example, log files and test results]:file:_files' \ + '(-r|--resultformat)'{-r,--resultformat}'[test result format emitted to stdout; --json flag overrides this parameter (human*,tap,junit,json)]' \ + '(-f|--configfile)'{-f,--configfile}'[path to config file for the test]:file:_files' \ + '(-o|--leavebrowseropen)'{-o,--leavebrowseropen}'[leave browser open]' \ + '(-t|--timeout)'{-t,--timeout}'[time (ms) to wait for results element in dom (default:60000)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:tree:export) + _command_args=( + '(-q|--query)'{-q,--query}'[soql query, or filepath of file containing a soql query, to retrieve records]' \ + '(-p|--plan)'{-p,--plan}'[generate mulitple sobject tree files and a plan definition file for aggregated import]' \ + '(-x|--prefix)'{-x,--prefix}'[prefix of generated files]' \ + '(-d|--outputdir)'{-d,--outputdir}'[directory to store files]:file:_files' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:data:tree:import) + _command_args=( + '(-f|--sobjecttreefiles)'{-f,--sobjecttreefiles}'[comma-delimited, ordered paths of json files containing collection of record trees to insert]:file:_files' \ + '(-p|--plan)'{-p,--plan}'[path to plan to insert multiple data files that have master-detail relationships]:file:_files' \ + '(-c|--contenttype)'{-c,--contenttype}'[if data file extension is not .json, provide content type (applies to all files)]' \ + '(--confighelp)--confighelp[display schema information for the --plan configuration file to stdout; if you use this option, all other options except --json are ignored]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:apex:trigger:create) + _command_args=( + '(-n|--triggername)'{-n,--triggername}'[name of the generated Apex trigger]' \ + '(-t|--template)'{-t,--template}'[template to use for file creation (ApexTrigger*)]' \ + '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \ + '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \ + '(-a|--apiversion)'{-a,--apiversion}'[API version number (45.0*,44.0)]' \ + '(-s|--sobject)'{-s,--sobject}'[sObject to create a trigger on (SOBJECT*)]' \ + '(-e|--triggerevents)'{-e,--triggerevents}'[events that fire the trigger (before insert*,before update,before delete,after insert,after update,after delete,after undelete)]' \ + '(--json)--json[JSON output]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:uninstall) + _command_args=( + '(-w|--wait)'{-w,--wait}'[number of minutes to wait for uninstall status]' \ + '(-p|--package)'{-p,--package}'[ID (starts with 04t) or alias of the package version to uninstall]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:uninstall:report) + _command_args=( + '(-i|--requestid)'{-i,--requestid}'[ID of the package uninstall request you want to check]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:update) + _command_args=( + '(-p|--package)'{-p,--package}'[ID (starts with 0Ho) or alias of the package to update]' \ + '(-n|--name)'{-n,--name}'[new package name]' \ + '(-d|--description)'{-d,--description}'[new package description]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:project:upgrade) + _command_args=( + '(-f|--forceupgrade)'{-f,--forceupgrade}'[run all upgrades even if project has already been upgraded]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:version:create) + _command_args=( + '(-p|--package)'{-p,--package}'[ID (starts with 0Ho) or alias of the package to create a version of]' \ + '(-d|--path)'{-d,--path}'[path to directory that contains the contents of the package]:file:_files' \ + '(-f|--definitionfile)'{-f,--definitionfile}'[path to a definition file similar to scratch org definition file that contains the list of features and org preferences that the metadata of the package version depends on]:file:_files' \ + '(-b|--branch)'{-b,--branch}'[the package version’s branch]' \ + '(-t|--tag)'{-t,--tag}'[the package version’s tag]' \ + '(-k|--installationkey)'{-k,--installationkey}'[installation key for key-protected package (either --installationkey or --installationkeybypass is required)]' \ + '(-x|--installationkeybypass)'{-x,--installationkeybypass}'[bypass the installation key requirement (either --installationkey or --installationkeybypass is required)]' \ + '(-r|--preserve)'{-r,--preserve}'[temp files are preserved that would otherwise be deleted]' \ + '(-j|--validateschema)'{-j,--validateschema}'[sfdx-project.json is validated against JSON schema]' \ + '(-w|--wait)'{-w,--wait}'[minutes to wait for the package version to be created (default:0)]' \ + '(-s|--buildinstance)'{-s,--buildinstance}'[the instance where the package version will be created——for example, NA50]' \ + '(-o|--sourceorg)'{-o,--sourceorg}'[the source org ID used to copy the org shape for the build org]' \ + '(-a|--versionname)'{-a,--versionname}'[the name of the package version to be created]' \ + '(-n|--versionnumber)'{-n,--versionnumber}'[the version number of the package version to be created]' \ + '(-e|--versiondescription)'{-e,--versiondescription}'[the description of the package version to be created]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package1:version:create) + _command_args=( + '(-i|--packageid)'{-i,--packageid}'[ID of the metadata package (starts with 033) of which you’re creating a new version]' \ + '(-n|--name)'{-n,--name}'[package version name]' \ + '(-d|--description)'{-d,--description}'[package version description]' \ + '(-v|--version)'{-v,--version}'[package version in major.minor format, for example, 3.2]' \ + '(-m|--managedreleased)'{-m,--managedreleased}'[create a managed package version]' \ + '(-r|--releasenotesurl)'{-r,--releasenotesurl}'[release notes URL]' \ + '(-p|--postinstallurl)'{-p,--postinstallurl}'[post install URL]' \ + '(-k|--installationkey)'{-k,--installationkey}'[installation key for key-protected package (default: null)]' \ + '(-w|--wait)'{-w,--wait}'[minutes to wait for the package version to be created (default: 2 minutes)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package1:version:create:get) + _command_args=( + '(-i|--requestid)'{-i,--requestid}'[PackageUploadRequest ID]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:version:create:list) + _command_args=( + '(-c|--createdlastdays)'{-c,--createdlastdays}'[created in the last specified number of days (starting at 00:00:00 of first day to now; 0 for today)]' \ + '(-s|--status)'{-s,--status}'[filter the list by version creation request status (Queued,InProgress,Success,Error)]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:version:create:report) + _command_args=( + '(-i|--packagecreaterequestid)'{-i,--packagecreaterequestid}'[package version creation request ID (starts with 08c)]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package1:version:display) + _command_args=( + '(-i|--packageversionid)'{-i,--packageversionid}'[metadata package version ID (starts with 04t)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:version:list) + _command_args=( + '(-c|--createdlastdays)'{-c,--createdlastdays}'[created in the last specified number of days (starting at 00:00:00 of first day to now; 0 for today)]' \ + '(-m|--modifiedlastdays)'{-m,--modifiedlastdays}'[list items modified in the specified last number of days (starting at 00:00:00 of first day to now; 0 for today)]' \ + '(-p|--packages)'{-p,--packages}'[filter results on specified comma-delimited packages (aliases or 0Ho IDs)]' \ + '(-r|--released)'{-r,--released}'[display released versions only]' \ + '(-o|--orderby)'{-o,--orderby}'[order by the specified package version fields]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--concise)--concise[display limited package version details]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[display extended package version details]' \ + ) + ;; + force:package1:version:list) + _command_args=( + '(-i|--packageid)'{-i,--packageid}'[metadata package ID (starts with 033)]' \ + '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:version:promote) + _command_args=( + '(-p|--package)'{-p,--package}'[ID (starts with 04t) or alias of the package version to promote]' \ + '(-n|--noprompt)'{-n,--noprompt}'[no prompt to confirm setting the package version as released]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:package:version:report) + _command_args=( + '(-p|--package)'{-p,--package}'[ID (starts with 04t) or alias of the package to retrieve details for]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + '(--verbose)--verbose[displays extended package version details]' \ + ) + ;; + force:package:version:update) + _command_args=( + '(-p|--package)'{-p,--package}'[ID (starts with 04t) or alias of the package to update a version of]' \ + '(-a|--versionname)'{-a,--versionname}'[new package version name]' \ + '(-e|--versiondescription)'{-e,--versiondescription}'[new package version description]' \ + '(-b|--branch)'{-b,--branch}'[new package version branch]' \ + '(-t|--tag)'{-t,--tag}'[new package version tag]' \ + '(-k|--installationkey)'{-k,--installationkey}'[new installation key for key-protected package (default: null)]' \ + '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + force:auth:web:login) + _command_args=( + '(-i|--clientid)'{-i,--clientid}'[OAuth client ID (sometimes called the consumer key)]' \ + '(-r|--instanceurl)'{-r,--instanceurl}'[the login URL of the instance the org lives on]' \ + '(-d|--setdefaultdevhubusername)'{-d,--setdefaultdevhubusername}'[set the authenticated org as the default dev hub org for scratch org creation]' \ + '(-s|--setdefaultusername)'{-s,--setdefaultusername}'[set the authenticated org as the default username that all commands run against]' \ + '(-a|--setalias)'{-a,--setalias}'[set an alias for the authenticated org]' \ + '(--disablemasking)--disablemasking[disable masking of user input (for use with problematic terminals)]' \ + '(-p|--noprompt)'{-p,--noprompt}'[do not prompt for auth confirmation in demo mode]' \ + '(--json)--json[format output as json]' \ + '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \ + ) + ;; + esac + +_arguments \ + $_command_args \ + && return 0 diff --git a/plugins/shrink-path/README.md b/plugins/shrink-path/README.md index 51fa8a051..b990aea91 100644 --- a/plugins/shrink-path/README.md +++ b/plugins/shrink-path/README.md @@ -57,10 +57,10 @@ supported. 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 - http://www.zsh.org/mla/workers/2009/msg00419.html +Ref: https://www.zsh.org/mla/workers/2009/msg00415.html + https://www.zsh.org/mla/workers/2009/msg00419.html ## Misc diff --git a/plugins/shrink-path/shrink-path.plugin.zsh b/plugins/shrink-path/shrink-path.plugin.zsh index f111962a5..86102e651 100644 --- a/plugins/shrink-path/shrink-path.plugin.zsh +++ b/plugins/shrink-path/shrink-path.plugin.zsh @@ -24,10 +24,10 @@ # Keywords: prompt directory truncate shrink collapse fish # # 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 -# http://www.zsh.org/mla/workers/2009/msg00419.html +# Ref: https://www.zsh.org/mla/workers/2009/msg00415.html +# https://www.zsh.org/mla/workers/2009/msg00419.html shrink_path () { setopt localoptions @@ -88,19 +88,18 @@ shrink_path () { if (( named )) { 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}) ( - unfunction chpwd 2> /dev/null if [[ $tree[1] == \~* ]] { - cd ${~tree[1]} + cd -q ${~tree[1]} result=$tree[1] shift tree } else { - cd / + cd -q / } for dir in $tree; { if (( lastfull && $#tree == 1 )) { @@ -117,7 +116,7 @@ shrink_path () { (( short )) && break done result+="/$part" - cd $dir + cd -q $dir shift tree } echo ${result:-/} diff --git a/plugins/spring/README.md b/plugins/spring/README.md index 62bfd8013..816181326 100644 --- a/plugins/spring/README.md +++ b/plugins/spring/README.md @@ -10,16 +10,16 @@ oh-my-zsh Spring Boot plugin $ cd ~/.oh-my-zsh/plugins $ git clone git@github.com:linux-china/oh-my-zsh-spring-boot-plugin.git spring -Adjust your .zshrc file and add spring to plugins=(...) - -## Tips +Adjust your .zshrc file and add spring to plugins=(...) + +## Tips * Install Spring Cloud plugin: spring install org.springframework.cloud:spring-cloud-cli:1.0.2.RELEASE ## Reference -* Spring Boot: http://projects.spring.io/spring-boot/ -* Spring Boot CLI: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#cli +* Spring Boot: https://spring.io/projects/spring-boot +* Spring Boot CLI: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#cli Maintainer : linux_china ([@linux_china](https://twitter.com/linux_china)) diff --git a/plugins/sprunge/sprunge.plugin.zsh b/plugins/sprunge/sprunge.plugin.zsh index fcc9004f8..e1c89b729 100644 --- a/plugins/sprunge/sprunge.plugin.zsh +++ b/plugins/sprunge/sprunge.plugin.zsh @@ -1,40 +1,40 @@ # 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 -# Original found at http://www.shellperson.net/sprunge-pastebin-script/ - +# Original found at https://www.shellperson.net/sprunge-pastebin-script/ + usage() { description | fmt -s >&2 } - + description() { cat << HERE - + DESCRIPTION Upload data and fetch URL from the pastebin http://sprunge.us - + USAGE $0 filename.txt $0 text string $0 < filename.txt piped_data | $0 - + NOTES -------------------------------------------------------------------------- * 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. - + * PRECEDENCE * STDIN redirection has precedence, then piped input, then a filename as an argument, and finally text strings as an arguments. - + EXAMPLE: 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. - + * 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. -------------------------------------------------------------------------- - + HERE exit } diff --git a/plugins/ssh-agent/README.md b/plugins/ssh-agent/README.md index 00af42f01..0b96d9bb5 100644 --- a/plugins/ssh-agent/README.md +++ b/plugins/ssh-agent/README.md @@ -11,6 +11,8 @@ plugins=(... ssh-agent) ## 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: ```zsh @@ -33,6 +35,6 @@ zstyle :omz:plugins:ssh-agent lifetime 4h ## 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 diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 20f97c6f1..9471ff49c 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -2,20 +2,51 @@ typeset _agent_forwarding _ssh_env_cache function _start_agent() { local lifetime - local -a identities - - # start ssh-agent and setup environment zstyle -s :omz:plugins:ssh-agent lifetime lifetime + # start ssh-agent and setup environment + echo Starting ssh-agent... ssh-agent -s ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' >! $_ssh_env_cache chmod 600 $_ssh_env_cache . $_ssh_env_cache > /dev/null +} - # load identies +function _add_identities() { + local id line sig + local -a identities loaded_sigs loaded_ids not_loaded zstyle -a :omz:plugins:ssh-agent identities identities - echo starting ssh-agent... - ssh-add $HOME/.ssh/${^identities} + # check for .ssh folder presence + if [[ ! -d $HOME/.ssh ]]; then + return + fi + + # add default keys if no identities were set up via zstyle + # this is to mimic the call to ssh-add with no identities + if [[ ${#identities} -eq 0 ]]; then + # key list found on `ssh-add` man page's DESCRIPTION section + for id in id_rsa id_dsa id_ecdsa id_ed25519 identity; do + # check if file exists + [[ -f "$HOME/.ssh/$id" ]] && identities+=$id + done + fi + + # get list of loaded identities' signatures and filenames + for line in ${(f)"$(ssh-add -l)"}; do + loaded_sigs+=${${(z)line}[2]} + loaded_ids+=${${(z)line}[3]} + done + + # add identities if not already loaded + for id in $identities; do + # check for filename match, otherwise try for signature match + if [[ ${loaded_ids[(I)$HOME/.ssh/$id]} -le 0 ]]; then + sig="$(ssh-keygen -lf "$HOME/.ssh/$id" | awk '{print $2}')" + [[ ${loaded_sigs[(I)$sig]} -le 0 ]] && not_loaded+="$HOME/.ssh/$id" + fi + done + + [[ -n "$not_loaded" ]] && ssh-add ${^not_loaded} } # Get the filename to store/lookup the environment from @@ -30,13 +61,20 @@ if [[ $_agent_forwarding == "yes" && -n "$SSH_AUTH_SOCK" ]]; then elif [[ -f "$_ssh_env_cache" ]]; then # Source SSH settings, if applicable . $_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 } else _start_agent fi +_add_identities + # tidy up after ourselves unset _agent_forwarding _ssh_env_cache -unfunction _start_agent +unfunction _start_agent _add_identities diff --git a/plugins/stack/README.md b/plugins/stack/README.md new file mode 100644 index 000000000..da73444ad --- /dev/null +++ b/plugins/stack/README.md @@ -0,0 +1,9 @@ +# 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) +``` diff --git a/plugins/sublime/README.md b/plugins/sublime/README.md index 5379891ad..22999241f 100644 --- a/plugins/sublime/README.md +++ b/plugins/sublime/README.md @@ -1,25 +1,37 @@ -## sublime +# sublime -Plugin for Sublime Text, a cross platform text and code editor, available for Linux, Mac OS X, and Windows. +Plugin for [Sublime Text](https://www.sublimetext.com/), a cross platform text and code editor, +available for Linux, macOS, and Windows. -### Requirements +To use the plugin, add `sublime` to the plugins array of your zshrc file: - * [Sublime Text](http://www.sublimetext.com/) +```zsh +plugins=(... sublime) +``` -### Usage +Sublime Text has to be installed to use the plugin. - * If `st` command is called without an argument, launch Sublime Text +## Usage - * If `st` is passed a directory, `cd` to it and open it in Sublime Text +The plugin defines several aliases, such as: - * If `st` is passed a file, open it in Sublime Text +- `st`: opens Sublime Text. If passed a file or directory, Sublime Text will open it. - * If `stt` command is called, it is equivalent to `st .`, opening the current folder in Sublime Text +- `stt`: open Sublime Text on the current directory. - * If `sst` command is called, it is like `sudo st`, opening the file or folder in Sublime Text. Useful for editing system protected files. +- `sst`: if `sudo` is available, `sst` will open Sublime Text with root permissions, so that + you can modify any file or directory that you pass it. Useful to edit system 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. +There are also a few functions available: - * 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 +- `find_project` (or `stp` alias): if called, the function will search for a `.sublime-project` file + on the current directory or its parents, until it finds none. - * If `stn` is passed a directory, create a stub `.sublime-project` file in it + If there is no `.sublime-project` file but the current folder is in a Git repository, it will open + Sublime Text on the root directory of the repository. + + If there is no Git repository, it will then open Sublime Text on the current directory. + +- `create_project` (or `stn` alias): if called without an argument, create a stub `.sublime-project` + file in the current working directory, if one does not already exist. If passed a directory, create + a stub `.sublime-project` file in it. diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh index 22cf98227..3a82d6c7f 100644 --- a/plugins/sublime/sublime.plugin.zsh +++ b/plugins/sublime/sublime.plugin.zsh @@ -1,118 +1,118 @@ -if [[ "$OSTYPE" == linux* ]]; then - local _sublime_linux_paths > /dev/null 2>&1 - _sublime_linux_paths=( +# Sublime Text aliases + +alias st=subl +alias stt='subl .' + +# Define sst only if sudo exists +(( $+commands[sudo] )) && alias sst='sudo subl' + +alias stp=find_project +alias stn=create_project + + +# Search for the Sublime Text command if not found +(( $+commands[subl] )) || { + declare -a _sublime_paths + + if [[ "$OSTYPE" == linux* ]]; then + if [[ "$(uname -r)" = *Microsoft* ]]; then + _sublime_paths=( + "$(wslpath -u 'C:\Program Files\Sublime Text 3\subl.exe')" + "$(wslpath -u 'C:\Program Files\Sublime Text 2\subl.exe')" + ) + else + _sublime_paths=( "$HOME/bin/sublime_text" "/opt/sublime_text/sublime_text" "/opt/sublime_text_3/sublime_text" "/usr/bin/sublime_text" "/usr/local/bin/sublime_text" "/usr/bin/subl" - "/opt/sublime_text_3/sublime_text" "/usr/bin/subl3" + ) + fi + elif [[ "$OSTYPE" = darwin* ]]; then + _sublime_paths=( + "/usr/local/bin/subl" + "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" + "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl" + "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" + "$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" + "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl" + "$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ) - for _sublime_path in $_sublime_linux_paths; do - if [[ -a $_sublime_path ]]; then - st_run() { $_sublime_path $@ >/dev/null 2>&1 &| } - st_run_sudo() {sudo $_sublime_path $@ >/dev/null 2>&1} - alias sst=st_run_sudo - alias st=st_run - break - fi - done - -elif [[ "$OSTYPE" = darwin* ]]; then - local _sublime_darwin_paths > /dev/null 2>&1 - _sublime_darwin_paths=( - "/usr/local/bin/subl" - "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" - "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl" - "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" - "$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" - "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl" - "$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" + elif [[ "$OSTYPE" = cygwin ]]; then + _sublime_paths=( + "$(cygpath "$ProgramW6432/Sublime Text 2")/subl.exe" + "$(cygpath "$ProgramW6432/Sublime Text 3")/subl.exe" ) - for _sublime_path in $_sublime_darwin_paths; do - if [[ -a $_sublime_path ]]; then - subl () { "$_sublime_path" $* } - alias st=subl - break - fi - done - -elif [[ "$OSTYPE" = 'cygwin' ]]; then - local _sublime_cygwin_paths > /dev/null 2>&1 - _sublime_cygwin_paths=( - "$(cygpath $ProgramW6432/Sublime\ Text\ 2)/sublime_text.exe" - "$(cygpath $ProgramW6432/Sublime\ Text\ 3)/sublime_text.exe" + elif [[ "$OSTYPE" = msys ]]; then + _sublime_paths=( + "/c/Program Files/Sublime Text 2/subl.exe" + "/c/Program Files/Sublime Text 3/subl.exe" ) - for _sublime_path in $_sublime_cygwin_paths; do - if [[ -a $_sublime_path ]]; then - subl () { "$_sublime_path" $* } - alias st=subl - break - fi - done + fi -fi + for _sublime_path in $_sublime_paths; do + if [[ -a $_sublime_path ]]; then + alias subl="'$_sublime_path'" + (( $+commands[sudo] )) && alias sst="sudo '$_sublime_path'" + break + fi + done -alias stt='st .' + unset _sublime_paths _sublime_path +} -find_project() -{ - local PROJECT_ROOT="${PWD}" - local FINAL_DEST="." +function find_project() { + local PROJECT_ROOT="${PWD}" + local FINAL_DEST="." - while [[ $PROJECT_ROOT != "/" && ! -d "$PROJECT_ROOT/.git" ]]; do - PROJECT_ROOT=$(dirname $PROJECT_ROOT) - done + while [[ $PROJECT_ROOT != "/" && ! -d "$PROJECT_ROOT/.git" ]]; do + PROJECT_ROOT=$(dirname $PROJECT_ROOT) + done - if [[ $PROJECT_ROOT != "/" ]]; then - local PROJECT_NAME="${PROJECT_ROOT##*/}" + if [[ $PROJECT_ROOT != "/" ]]; then + local PROJECT_NAME="${PROJECT_ROOT##*/}" - local SUBL_DIR=$PROJECT_ROOT - while [[ $SUBL_DIR != "/" && ! -f "$SUBL_DIR/$PROJECT_NAME.sublime-project" ]]; do - SUBL_DIR=$(dirname $SUBL_DIR) - done + local SUBL_DIR=$PROJECT_ROOT + while [[ $SUBL_DIR != "/" && ! -f "$SUBL_DIR/$PROJECT_NAME.sublime-project" ]]; do + SUBL_DIR=$(dirname $SUBL_DIR) + done - if [[ $SUBL_DIR != "/" ]]; then - FINAL_DEST="$SUBL_DIR/$PROJECT_NAME.sublime-project" - else - FINAL_DEST=$PROJECT_ROOT - fi + if [[ $SUBL_DIR != "/" ]]; then + FINAL_DEST="$SUBL_DIR/$PROJECT_NAME.sublime-project" + else + FINAL_DEST=$PROJECT_ROOT fi + fi - st $FINAL_DEST + subl $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 + 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 stn=create_project diff --git a/plugins/sudo/README.md b/plugins/sudo/README.md new file mode 100644 index 000000000..ebfdfd10d --- /dev/null +++ b/plugins/sudo/README.md @@ -0,0 +1,57 @@ +# 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: +$ +``` diff --git a/plugins/suse/README.md b/plugins/suse/README.md new file mode 100644 index 000000000..b9b069574 --- /dev/null +++ b/plugins/suse/README.md @@ -0,0 +1,90 @@ +# 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 | `zypper -h` | print help | +| zhse | `zypper -h se` | print help for the search command | +| zlicenses | `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 | `zypper tos` | shows the ID string of the target operating system | +| zvcmp | `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 | `zypper lp` | list necessary patches | +| zlu | `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 | `zypper if` | display info about packages | +| zpa | `zypper pa` | list packages | +| zpatch-info | `zypper patch-info` | display info about patches | +| zpattern-info | `zypper pattern-info` | display info about patterns | +| zproduct-info | `zypper product-info` | display info about products | +| zpch | `zypper pch` | list all patches | +| zpd | `zypper pd` | list products | +| zpt | `zypper pt` | list patterns | +| zse | `zypper se` | search for packages | +| zwp | `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 | `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 | `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 | `zypper ll` | list currently active package locks | +| zrl | `sudo zypper rl` | remove specified package lock | diff --git a/plugins/suse/suse.plugin.zsh b/plugins/suse/suse.plugin.zsh index f7215528b..dcfeccb03 100644 --- a/plugins/suse/suse.plugin.zsh +++ b/plugins/suse/suse.plugin.zsh @@ -1,61 +1,59 @@ -#Alias for Zypper according to the official Zypper's alias - #Main commands -alias z='sudo zypper' #call zypper -alias zh='sudo zypper -h' #print help -alias zhse='sudo zypper -h se' #print help for the search command -alias zlicenses='sudo zypper licenses' #prints a report about licenses and EULAs of installed packages -alias zps='sudo zypper ps' #list process using deleted files -alias zshell='sudo zypper shell' #open a zypper shell session -alias zsource-download='sudo zypper source-download' #download source rpms for all installed packages -alias ztos='sudo zypper tos' #shows the ID string of the target operating system -alias zvcmp='sudo zypper vcmp' #tell whether version1 is older or newer than version2 +alias z='sudo zypper' +alias zh='zypper -h' +alias zhse='zypper -h se' +alias zlicenses='zypper licenses' +alias zps='sudo zypper ps' +alias zshell='sudo zypper shell' +alias zsource-download='sudo zypper source-download' +alias ztos='zypper tos' +alias zvcmp='zypper vcmp' #Packages commands -alias zin='sudo zypper in' #install packages -alias zinr='sudo zypper inr' #install newly added packages recommended by already installed ones -alias zrm='sudo zypper rm' #remove packages -alias zsi='sudo zypper si' #install source of a package -alias zve='sudo zypper ve' #verify dependencies of installed packages +alias zin='sudo zypper in' +alias zinr='sudo zypper inr' +alias zrm='sudo zypper rm' +alias zsi='sudo zypper si' +alias zve='sudo zypper ve' #Updates commands -alias zdup='sudo zypper dup' #upgrade packages -alias zlp='sudo zypper lp' #list necessary patchs -alias zlu='sudo zypper lu' #list updates -alias zpchk='sudo zypper pchk' #check for patches -alias zup='sudo zypper up' #update packages -alias zpatch='sudo zypper patch' #install patches +alias zdup='sudo zypper dup' +alias zlp='zypper lp' +alias zlu='zypper lu' +alias zpchk='sudo zypper pchk' +alias zup='sudo zypper up' +alias zpatch='sudo zypper patch' #Request commands -alias zif='sudo zypper if' #display info about packages -alias zpa='sudo zypper pa' #list packages -alias zpatch-info='sudo zypper patch-info' #display info about patches -alias zpattern-info='sudo zypper patch-info' #display info about patterns -alias zproduct-info='sudo zypper patch-info' #display info about products -alias zpch='sudo zypper pch' #list all patches -alias zpd='sudo zypper pd' #list products -alias zpt='sudo zypper pt' #list patterns -alias zse='sudo zypper se' #search for packages -alias zwp='sudo zypper wp' #list all packages providing the specified capability +alias zif='zypper if' +alias zpa='zypper pa' +alias zpatch-info='zypper patch-info' +alias zpattern-info='zypper pattern-info' +alias zproduct-info='zypper product-info' +alias zpch='zypper pch' +alias zpd='zypper pd' +alias zpt='zypper pt' +alias zse='zypper se' +alias zwp='zypper wp' #Repositories commands -alias zar='sudo zypper ar' #add a repository -alias zcl='sudo zypper clean' #clean cache -alias zlr='sudo zypper lr' #list repositories -alias zmr='sudo zypper mr' #modify repositories -alias znr='sudo zypper nr' #rename repositories (for the alias only) -alias zref='sudo zypper ref' #refresh repositories -alias zrr='sudo zypper rr' #remove repositories +alias zar='sudo zypper ar' +alias zcl='sudo zypper clean' +alias zlr='zypper lr' +alias zmr='sudo zypper mr' +alias znr='sudo zypper nr' +alias zref='sudo zypper ref' +alias zrr='sudo zypper rr' #Services commands -alias zas='sudo zypper as' #adds a service specified by URI to the system -alias zms='sudo zypper ms' #modify properties of specified services -alias zrefs='sudo zypper refs' #refreshing a service mean executing the service's special task -alias zrs='sudo zypper rs' #remove specified repository index service from the system -alias zls='sudo zypper ls' #list services defined on the system +alias zas='sudo zypper as' +alias zms='sudo zypper ms' +alias zrefs='sudo zypper refs' +alias zrs='sudo zypper rs' +alias zls='zypper ls' #Package Locks Management commands -alias zal='sudo zypper al' #add a package lock -alias zcl='sudo zypper cl' #Remove unused locks -alias zll='sudo zypper ll' #list currently active package locks -alias zrl='sudo zypper rl' #remove specified package lock +alias zal='sudo zypper al' +alias zcl='sudo zypper cl' +alias zll='zypper ll' +alias zrl='sudo zypper rl' diff --git a/plugins/svcat/README.md b/plugins/svcat/README.md new file mode 100644 index 000000000..0bc60b117 --- /dev/null +++ b/plugins/svcat/README.md @@ -0,0 +1,9 @@ +# svcat + +This plugin provides completion for the [Kubernetes service catalog cli](https://github.com/kubernetes-incubator/service-catalog). + +To use it, add `svcat` to the plugins array in your zshrc file. + +``` +plugins=(... svcat) +``` diff --git a/plugins/svcat/svcat.plugin.zsh b/plugins/svcat/svcat.plugin.zsh new file mode 100644 index 000000000..f90e7d8d6 --- /dev/null +++ b/plugins/svcat/svcat.plugin.zsh @@ -0,0 +1,6 @@ +# Autocompletion for svcat. +# + +if [ $commands[svcat] ]; then + source <(svcat completion zsh) +fi diff --git a/plugins/svn/README.md b/plugins/svn/README.md index 1f7b70c86..cab166a4f 100644 --- a/plugins/svn/README.md +++ b/plugins/svn/README.md @@ -1,7 +1,7 @@ # `svn` plugin 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: diff --git a/plugins/swiftpm/README.md b/plugins/swiftpm/README.md index 07ca25651..291458511 100644 --- a/plugins/swiftpm/README.md +++ b/plugins/swiftpm/README.md @@ -2,7 +2,7 @@ ## Description -This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager). +This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager), as well as autocompletion for Swift 5.0. To start using it, add the `swiftpm` plugin to your `plugins` array in `~/.zshrc`: diff --git a/plugins/swiftpm/_swift b/plugins/swiftpm/_swift new file mode 100644 index 000000000..1366b4d9c --- /dev/null +++ b/plugins/swiftpm/_swift @@ -0,0 +1,466 @@ +#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]' 'undefined[enable Undefined Behavior sanitizer]'}" + "--disable-prefetching[]" + "--skip-update[Skip updating dependencies from their remote during a resolution]" + "--disable-sandbox[Disable using the sandbox when executing subprocesses]" + "--disable-package-manifest-caching[Disable caching Package.swift manifests]" + "--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-llbuild-library[Enable building with the llbuild library]" + "--force-resolved-versions[]" + "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" + "--enable-index-store[Enable indexing-while-building feature]" + "--disable-index-store[Disable indexing-while-building feature]" + "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" + "--enable-parseable-module-interfaces[]" + "--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]' 'undefined[enable Undefined Behavior sanitizer]'}" + "--disable-prefetching[]" + "--skip-update[Skip updating dependencies from their remote during a resolution]" + "--disable-sandbox[Disable using the sandbox when executing subprocesses]" + "--disable-package-manifest-caching[Disable caching Package.swift manifests]" + "--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-llbuild-library[Enable building with the llbuild library]" + "--force-resolved-versions[]" + "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" + "--enable-index-store[Enable indexing-while-building feature]" + "--disable-index-store[Disable indexing-while-building feature]" + "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" + "--enable-parseable-module-interfaces[]" + "--skip-build[Skip building the executable product]" + "--build-tests[Build both source and test targets]" + "--repl[Launch Swift REPL for the package]" + ) + _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]' 'undefined[enable Undefined Behavior sanitizer]'}" + "--disable-prefetching[]" + "--skip-update[Skip updating dependencies from their remote during a resolution]" + "--disable-sandbox[Disable using the sandbox when executing subprocesses]" + "--disable-package-manifest-caching[Disable caching Package.swift manifests]" + "--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-llbuild-library[Enable building with the llbuild library]" + "--force-resolved-versions[]" + "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" + "--enable-index-store[Enable indexing-while-building feature]" + "--disable-index-store[Disable indexing-while-building feature]" + "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" + "--enable-parseable-module-interfaces[]" + '(-): :->command' + '(-)*:: :->arg' + ) + _arguments $arguments && return + case $state in + (command) + local modes + modes=( + 'update:Update package dependencies' + 'describe:Describe the current package' + 'resolve:Resolve package dependencies' + 'tools-version:Manipulate tools version of the current package' + 'unedit:Remove a package from editable mode' + 'show-dependencies:Print the resolved dependency graph' + 'fetch:' + 'dump-package:Print parsed Package.swift as JSON' + 'edit:Put a package in editable mode' + 'config:Manipulate configuration of the package' + 'completion-tool:Completion tool (for shell completions)' + 'clean:Delete build artifacts' + 'generate-xcodeproj:Generates an Xcode project' + 'reset:Reset the complete cache/build directory' + 'init:Initialize a new package' + ) + _describe "mode" modes + ;; + (arg) + case ${words[1]} in + (update) + _swift_package_update + ;; + (describe) + _swift_package_describe + ;; + (resolve) + _swift_package_resolve + ;; + (tools-version) + _swift_package_tools-version + ;; + (unedit) + _swift_package_unedit + ;; + (show-dependencies) + _swift_package_show-dependencies + ;; + (fetch) + _swift_package_fetch + ;; + (dump-package) + _swift_package_dump-package + ;; + (edit) + _swift_package_edit + ;; + (config) + _swift_package_config + ;; + (completion-tool) + _swift_package_completion-tool + ;; + (clean) + _swift_package_clean + ;; + (generate-xcodeproj) + _swift_package_generate-xcodeproj + ;; + (reset) + _swift_package_reset + ;; + (init) + _swift_package_init + ;; + esac + ;; + esac +} + +_swift_package_update() { + 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_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_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_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_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 +} + +_swift_package_fetch() { + arguments=( + ) + _arguments $arguments && return +} + +_swift_package_dump-package() { + arguments=( + ) + _arguments $arguments && return +} + +_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_config() { + arguments=( + '(-): :->command' + '(-)*:: :->arg' + ) + _arguments $arguments && return + case $state in + (command) + local modes + modes=( + 'unset-mirror:Remove an existing mirror' + 'set-mirror:Set a mirror for a dependency' + 'get-mirror:Print mirror configuration for the given package dependency' + ) + _describe "mode" modes + ;; + (arg) + case ${words[1]} in + (unset-mirror) + _swift_package_config_unset-mirror + ;; + (set-mirror) + _swift_package_config_set-mirror + ;; + (get-mirror) + _swift_package_config_get-mirror + ;; + esac + ;; + esac +} + +_swift_package_config_unset-mirror() { + arguments=( + "--package-url[The package dependency url]:The package dependency url: " + "--mirror-url[The mirror url]:The mirror url: " + ) + _arguments $arguments && return +} + +_swift_package_config_set-mirror() { + arguments=( + "--package-url[The package dependency url]:The package dependency url: " + "--mirror-url[The mirror url]:The mirror url: " + ) + _arguments $arguments && return +} + +_swift_package_config_get-mirror() { + arguments=( + "--package-url[The package dependency url]:The package dependency url: " + ) + _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_clean() { + arguments=( + ) + _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]" + "--skip-extra-files[Do not add file references for extra files to the generated Xcode project]" + ) + _arguments $arguments && return +} + +_swift_package_reset() { + 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]'}" + "--name[Provide custom package name]:Provide custom package name: " + ) + _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]' 'undefined[enable Undefined Behavior sanitizer]'}" + "--disable-prefetching[]" + "--skip-update[Skip updating dependencies from their remote during a resolution]" + "--disable-sandbox[Disable using the sandbox when executing subprocesses]" + "--disable-package-manifest-caching[Disable caching Package.swift manifests]" + "--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-llbuild-library[Enable building with the llbuild library]" + "--force-resolved-versions[]" + "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" + "--enable-index-store[Enable indexing-while-building feature]" + "--disable-index-store[Disable indexing-while-building feature]" + "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" + "--enable-parseable-module-interfaces[]" + "--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.]" + "--num-workers[Number of tests to execute in parallel.]:Number of tests to execute 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>: " + "--enable-code-coverage[Test with code coverage enabled]" + ) + _arguments $arguments && return +} + +_swift_compiler() { +} + +_swift diff --git a/plugins/symfony/README.md b/plugins/symfony/README.md new file mode 100644 index 000000000..c58f64fdd --- /dev/null +++ b/plugins/symfony/README.md @@ -0,0 +1,9 @@ +# 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) +``` diff --git a/plugins/symfony2/README.md b/plugins/symfony2/README.md new file mode 100644 index 000000000..2946d0937 --- /dev/null +++ b/plugins/symfony2/README.md @@ -0,0 +1,28 @@ +# 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` | diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh index c2a1affad..1498e8d02 100644 --- a/plugins/symfony2/symfony2.plugin.zsh +++ b/plugins/symfony2/symfony2.plugin.zsh @@ -25,5 +25,10 @@ alias sfcw='sf cache:warmup' alias sfroute='sf debug:router' alias sfcontainer='sf debug:container' 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 sfprod='sf --env=prod' diff --git a/plugins/systemadmin/README.md b/plugins/systemadmin/README.md new file mode 100644 index 000000000..edca4d87d --- /dev/null +++ b/plugins/systemadmin/README.md @@ -0,0 +1,51 @@ +# 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 | diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh index 8c2633355..bdc2219fa 100644 --- a/plugins/systemadmin/systemadmin.plugin.zsh +++ b/plugins/systemadmin/systemadmin.plugin.zsh @@ -3,7 +3,6 @@ # ----------- # # This is one for the system administrator, operation and maintenance. -# Some of which come from http://justinlilly.com/dotfiles/zsh.html # # ------------------------------------------------------------------------------ # Authors @@ -13,14 +12,6 @@ # # ------------------------------------------------------------------------------ -function retval() { - if [[ -z $1 ]];then - echo '.' - else - echo $1 - fi -} - function retlog() { if [[ -z $1 ]];then echo '/var/log/nginx/access.log' @@ -30,8 +21,8 @@ function retlog() { } alias ping='ping -c 5' -alias clr='clear;echo "Currently logged in on $(tty), as $USER in directory $PWD."' -alias path='echo -e ${PATH//:/\\n}' +alias clr='clear; echo Currently logged in on $TTY, as $USER in directory $PWD.' +alias path='print -l $path' alias mkdir='mkdir -pv' # get top process eating memory 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' # directory LS dls () { - ls -l | grep "^d" | awk '{ print $9 }' | tr -d "/" + print -l *(/) } 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 killit() { @@ -55,10 +46,10 @@ killit() { } # list contents of directories in a tree-like format -if [ -z "\${which tree}" ]; then - tree () { - find $@ -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' - } +if ! (( $+commands[tree] )); then + tree () { + find $@ -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' + } fi # Sort connection state @@ -98,7 +89,7 @@ syn20() { # Printing process according to the port number 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 @@ -135,7 +126,7 @@ httpstatus() { # Delete 0 byte file d0() { - find "$(retval $1)" -type f -size 0 -exec rm -rf {} \; + find "${1:-.}" -type f -size 0 -exec rm -rf {} \; } # gather external ip address @@ -143,12 +134,12 @@ geteip() { curl -s -S https://icanhazip.com } -# determine local IP address +# determine local IP address(es) getip() { 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 - 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 } diff --git a/plugins/systemd/README.md b/plugins/systemd/README.md new file mode 100644 index 000000000..d91329290 --- /dev/null +++ b/plugins/systemd/README.md @@ -0,0 +1,53 @@ +# 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`. diff --git a/plugins/systemd/systemd.plugin.zsh b/plugins/systemd/systemd.plugin.zsh index 5a35ecbc7..7cd27d450 100644 --- a/plugins/systemd/systemd.plugin.zsh +++ b/plugins/systemd/systemd.plugin.zsh @@ -10,7 +10,13 @@ sudo_commands=( 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 $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-disable-now="sc-disable --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" diff --git a/plugins/taskwarrior/README.md b/plugins/taskwarrior/README.md index 053151e78..2a86510dd 100644 --- a/plugins/taskwarrior/README.md +++ b/plugins/taskwarrior/README.md @@ -1,6 +1,6 @@ # 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 completion definitions. diff --git a/plugins/taskwarrior/_task b/plugins/taskwarrior/_task index 46628be94..c38d6cad9 100644 --- a/plugins/taskwarrior/_task +++ b/plugins/taskwarrior/_task @@ -21,7 +21,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # 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 _task_projects=($(task _projects)) diff --git a/plugins/terraform/README.md b/plugins/terraform/README.md index 46855e417..e5d9e47b6 100644 --- a/plugins/terraform/README.md +++ b/plugins/terraform/README.md @@ -1,7 +1,9 @@ -## atom +## Terraform oh-my-zsh plugin Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely and efficiently. +Current as of Terraform v0.11.7 + ### Requirements * [Terraform](https://terraform.io/) @@ -12,8 +14,8 @@ Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely a ### Expanding ZSH prompt with current Terraform workspace name -If you want to get current Terraform workspace name in your ZSH prompt open -your .zsh-theme file and in a choosen place insert: +If you want to get current Terraform workspace name in your ZSH prompt open +your .zsh-theme file and in a chosen place insert: ``` $FG[045]\ diff --git a/plugins/terraform/_terraform b/plugins/terraform/_terraform index 285d83ec7..1d1315a8a 100644 --- a/plugins/terraform/_terraform +++ b/plugins/terraform/_terraform @@ -3,91 +3,151 @@ local -a _terraform_cmds _terraform_cmds=( 'apply:Builds or changes infrastructure' + 'console:Interactive console for Terraform interpolations' 'destroy:Destroy Terraform-managed infrastructure' + 'fmt:Rewrites config files to canonical format' 'get:Download and install modules for the configuration' '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' 'plan:Generate and show an execution plan' - 'pull:Refreshes the local state copy from the remote server' - 'push:Uploads the local state to the remote server' + 'providers:Prints a tree of the providers used in the configuration' + 'push:Upload this Terraform module to Atlas to run' 'refresh:Update local state file against real resources' - 'remote:Configures remote state management' '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' + 'workspace:Workspace management' ) __apply() { _arguments \ - '-auto-approve[Skip interactive approval of plan before applying.]' \ '-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.]' \ - '-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.]' \ - '-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.]' \ - '-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-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() { _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.]' \ - '-force[If set, then the destroy confirmation will not be shown.]' \ - '-input=[(true) Ask for input for variables if not directly set.]' \ - '-no-color[If specified, output will not contain any color.]' \ + '-auto-approve[Skip interactive approval before destroying.]' \ + '-force[Deprecated: same as auto-approve.]' \ + '-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.]' \ - '-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.]' \ - '-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-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() { _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() { _arguments \ '-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.]' \ - '-verbose[Generate a verbose, "worst-case" graph, with all nodes for potential operations in place.]' + '-no-color[If specified, output will contain no color.]' \ + '-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() { _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.]' \ - '-backend-config=[(path) Specifies the path to remote backend config file.]' \ - '-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.]' + '-backend=[(true) Configure the backend for this configuration.]' \ + '-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.]' \ + '-force-copy[Suppress prompts about copying state data. This is equivalent to providing a "yes" to all confirmation prompts.]' \ + '-from-module=[Copy the contents of the given module into the target directory before initialization.]' \ + '-get=[(true) Download any modules for this configuration.]' \ + '-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() { _arguments \ '-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() { _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.]' \ - '-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]' \ + '-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]' \ '-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.]' \ - '-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.]' \ + '-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.]' \ + '-parallelism=[(10) Limit the number of concurrent operations.]' \ '-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.]' \ - '-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-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() { @@ -106,6 +166,9 @@ __push() { __refresh() { _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.]' \ + '-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.]' \ '-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.]' \ @@ -114,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.]' } -__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() { _arguments \ '-module-depth=[(n) The maximum depth to expand modules. By default this is zero, which will not expand modules at all.]' \ @@ -137,12 +187,46 @@ __taint() { _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.]' } +__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' if (( CURRENT == 1 )); then @@ -154,26 +238,38 @@ local -a _command_args case "$words[1]" in apply) __apply ;; + console) + __console;; destroy) __destroy ;; + fmt) + __fmt;; get) __get ;; graph) __graph ;; + import) + __import;; init) __init ;; output) __output ;; plan) __plan ;; + providers) + __providers ;; push) __push ;; refresh) __refresh ;; - remote) - __remote ;; show) __show ;; taint) __taint ;; + untaint) + __untaint ;; + validate) + __validate ;; + workspace) + test $CURRENT -lt 3 && __workspace ;; esac diff --git a/plugins/terraform/terraform.plugin.zsh b/plugins/terraform/terraform.plugin.zsh index b170f73a6..d727c1ee0 100644 --- a/plugins/terraform/terraform.plugin.zsh +++ b/plugins/terraform/terraform.plugin.zsh @@ -1,4 +1,6 @@ function tf_prompt_info() { + # dont show 'default' workspace in home dir + [[ "$PWD" == ~ ]] && return # check if in terraform dir if [ -d .terraform ]; then workspace=$(terraform workspace show 2> /dev/null) || return diff --git a/plugins/textastic/README.md b/plugins/textastic/README.md index 369c2c137..3f3bcea1e 100644 --- a/plugins/textastic/README.md +++ b/plugins/textastic/README.md @@ -1,10 +1,10 @@ ## 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 - * [Textastic](http://www.textasticapp.com/mac.html) + * [Textastic](https://www.textasticapp.com/mac.html) ### Usage diff --git a/plugins/textmate/README.md b/plugins/textmate/README.md new file mode 100644 index 000000000..9fd342135 --- /dev/null +++ b/plugins/textmate/README.md @@ -0,0 +1,16 @@ +# 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. diff --git a/plugins/thefuck/thefuck.plugin.zsh b/plugins/thefuck/thefuck.plugin.zsh index 765e2b9a5..ac88e67de 100644 --- a/plugins/thefuck/thefuck.plugin.zsh +++ b/plugins/thefuck/thefuck.plugin.zsh @@ -1,6 +1,7 @@ if [[ -z $commands[thefuck] ]]; then - echo 'thefuck is not installed, you should "pip install thefuck" first' - return -1 + echo 'thefuck is not installed, you should "pip install thefuck" or "brew install thefuck" first.' + echo 'See https://github.com/nvbn/thefuck#installation' + return 1 fi # Register alias diff --git a/plugins/themes/README.md b/plugins/themes/README.md new file mode 100644 index 000000000..408e357e0 --- /dev/null +++ b/plugins/themes/README.md @@ -0,0 +1,18 @@ +# 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. + diff --git a/plugins/themes/themes.plugin.zsh b/plugins/themes/themes.plugin.zsh index 7519b0253..2cd0ee327 100644 --- a/plugins/themes/themes.plugin.zsh +++ b/plugins/themes/themes.plugin.zsh @@ -8,9 +8,9 @@ function theme source "$RANDOM_THEME" echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." else - if [ -f "$ZSH_CUSTOM/$1.zsh-theme" ] + if [ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ] then - source "$ZSH_CUSTOM/$1.zsh-theme" + source "$ZSH_CUSTOM/themes/$1.zsh-theme" else source "$ZSH/themes/$1.zsh-theme" fi @@ -19,6 +19,8 @@ function theme function lstheme { - cd $ZSH/themes - ls *zsh-theme | sed 's,\.zsh-theme$,,' + # Resources: + # 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) } diff --git a/plugins/timer/README.md b/plugins/timer/README.md new file mode 100644 index 000000000..321307e59 --- /dev/null +++ b/plugins/timer/README.md @@ -0,0 +1,17 @@ +This plugin allows to display command's execution time in a very nonintrusive way. + +Timer can be tuned by these two variables: +* `TIMER_PRECISION` allows to control number of decimal places (default `1`) +* `TIMER_FORMAT` allows to adjust display format (default `'/%d'`) + +Sample session: + + me@here:~$ sleep 1 /1.0s + me@here:~$ sleep 73 /1m13.0s + me@here:~$ TIMER_FORMAT='[%d]'; TIMER_PRECISION=2 [0.00s] + me@here:~$ head -c50 < /dev/urandom | hexdump + 0000000 b2 16 20 f0 29 1f 61 2d 8a 29 20 8c 8c 39 5a ab + 0000010 21 47 0e f9 ee a4 76 46 71 9e 4f 6b a4 c4 51 cb + 0000020 f9 1f 7e b9 6f 2c ae dd cf 40 6d 64 a8 fb d3 db + 0000030 09 37 + 0000032 [0.02s] diff --git a/plugins/timer/timer.plugin.zsh b/plugins/timer/timer.plugin.zsh new file mode 100644 index 000000000..231134e7d --- /dev/null +++ b/plugins/timer/timer.plugin.zsh @@ -0,0 +1,29 @@ +__timer_current_time() { + perl -MTime::HiRes=time -e'print time' +} + +__timer_format_duration() { + local mins=$(printf '%.0f' $(($1 / 60))) + local secs=$(printf "%.${TIMER_PRECISION:-1}f" $(($1 - 60 * mins))) + local duration_str=$(echo "${mins}m${secs}s") + local format="${TIMER_FORMAT:-/%d}" + echo "${format//\%d/${duration_str#0m}}" +} + +__timer_save_time_preexec() { + __timer_cmd_start_time=$(__timer_current_time) +} + +__timer_display_timer_precmd() { + if [ -n "${__timer_cmd_start_time}" ]; then + local cmd_end_time=$(__timer_current_time) + local tdiff=$((cmd_end_time - __timer_cmd_start_time)) + unset __timer_cmd_start_time + local tdiffstr=$(__timer_format_duration ${tdiff}) + local cols=$((COLUMNS - ${#tdiffstr} - 1)) + echo -e "\033[1A\033[${cols}C ${tdiffstr}" + fi +} + +preexec_functions+=(__timer_save_time_preexec) +precmd_functions+=(__timer_display_timer_precmd) diff --git a/plugins/tmux/README.md b/plugins/tmux/README.md new file mode 100644 index 000000000..427119d3d --- /dev/null +++ b/plugins/tmux/README.md @@ -0,0 +1,39 @@ +# 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` | diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index fb514a44c..2f3c3e79d 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -1,6 +1,9 @@ -# -# Aliases -# +if ! (( $+commands[tmux] )); then + 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 tad='tmux attach -d -t' @@ -9,90 +12,78 @@ alias tl='tmux list-sessions' alias tksv='tmux kill-server' alias tkss='tmux kill-session -t' -# Only run if tmux is actually installed -if which tmux &> /dev/null - then - # Configuration variables - # - # Automatically start tmux - [[ -n "$ZSH_TMUX_AUTOSTART" ]] || ZSH_TMUX_AUTOSTART=false - # Only autostart once. If set to false, tmux will attempt to - # autostart every time your zsh configs are reloaded. - [[ -n "$ZSH_TMUX_AUTOSTART_ONCE" ]] || ZSH_TMUX_AUTOSTART_ONCE=true - # Automatically connect to a previous session if it exists - [[ -n "$ZSH_TMUX_AUTOCONNECT" ]] || ZSH_TMUX_AUTOCONNECT=true - # Automatically close the terminal when tmux exits - [[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT=$ZSH_TMUX_AUTOSTART - # Set term to screen or screen-256color based on current terminal support - [[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true - # Set '-CC' option for iTerm2 tmux integration - [[ -n "$ZSH_TMUX_ITERM2" ]] || ZSH_TMUX_ITERM2=false - # The TERM to use for non-256 color terminals. - # Tmux states this should be screen, but you may need to change it on - # systems without the proper terminfo - [[ -n "$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITHOUT_256COLOR="screen" - # The TERM to use for 256 color terminals. - # Tmux states this should be screen-256color, but you may need to change it on - # systems without the proper terminfo - [[ -n "$ZSH_TMUX_FIXTERM_WITH_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITH_256COLOR="screen-256color" +# CONFIGURATION VARIABLES +# Automatically start tmux +: ${ZSH_TMUX_AUTOSTART:=false} +# Only autostart once. If set to false, tmux will attempt to +# autostart every time your zsh configs are reloaded. +: ${ZSH_TMUX_AUTOSTART_ONCE:=true} +# Automatically connect to a previous session if it exists +: ${ZSH_TMUX_AUTOCONNECT:=true} +# Automatically close the terminal when tmux exits +: ${ZSH_TMUX_AUTOQUIT:=$ZSH_TMUX_AUTOSTART} +# Set term to screen or screen-256color based on current terminal support +: ${ZSH_TMUX_FIXTERM:=true} +# Set '-CC' option for iTerm2 tmux integration +: ${ZSH_TMUX_ITERM2:=false} +# The TERM to use for non-256 color terminals. +# Tmux states this should be screen, but you may need to change it on +# systems without the proper terminfo +: ${ZSH_TMUX_FIXTERM_WITHOUT_256COLOR:=screen} +# The TERM to use for 256 color terminals. +# Tmux states this should be screen-256color, but you may need to change it on +# systems without the proper terminfo +: ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color} + +# Determine if the terminal supports 256 colors +if [[ $terminfo[colors] == 256 ]]; then + 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 - local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)" +# Wrapper function for tmux. +function _zsh_tmux_plugin_run() { + if [[ -n "$@" ]]; then + command tmux "$@" + return $? + fi - # Determine if the terminal supports 256 colors - if [[ `tput colors` == "256" ]] - then - export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR - else - export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR - fi + local -a tmux_cmd + tmux_cmd=(command tmux) + [[ "$ZSH_TMUX_ITERM2" == "true" ]] && tmux_cmd+=(-CC) - # Set the correct local config file to use. - if [[ "$ZSH_TMUX_ITERM2" == "false" ]] && [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] - 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 + # Try to connect to an existing session. + [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach - # Wrapper function for tmux. - function _zsh_tmux_plugin_run() - { - # We have other arguments, just run them - if [[ -n "$@" ]] - 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 - } + # If failed, just run tmux, fixing the TERM variable if requested. + if [[ $? -ne 0 ]]; then + [[ "$ZSH_TMUX_FIXTERM" == "true" ]] && tmux_cmd+=(-f "$_ZSH_TMUX_FIXED_CONFIG") + $tmux_cmd new-session + fi - # Use the completions for tmux for our function - compdef _tmux _zsh_tmux_plugin_run + if [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]]; then + exit + fi +} - # Alias tmux to our wrapper function. - alias tmux=_zsh_tmux_plugin_run +# Use the completions for tmux for our function +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. - if [[ ! -n "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" ]] - then - # Actually don't autostart if we already did and multiple autostarts are disabled. - if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]] - then - export ZSH_TMUX_AUTOSTARTED=true - _zsh_tmux_plugin_run - fi - fi -else - print "zsh tmux plugin: tmux not found. Please install tmux before using this plugin." +# Autostart if not already in tmux and enabled. +if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z "$EMACS" && -z "$VIM" ]]; then + # Actually don't autostart if we already did and multiple autostarts are disabled. + if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]]; then + export ZSH_TMUX_AUTOSTARTED=true + _zsh_tmux_plugin_run + fi fi diff --git a/plugins/tmuxinator/README.md b/plugins/tmuxinator/README.md new file mode 100644 index 000000000..994d8d46d --- /dev/null +++ b/plugins/tmuxinator/README.md @@ -0,0 +1,19 @@ +# 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 | diff --git a/plugins/tmuxinator/_tmuxinator b/plugins/tmuxinator/_tmuxinator index 551267ed2..9ae25ac38 100644 --- a/plugins/tmuxinator/_tmuxinator +++ b/plugins/tmuxinator/_tmuxinator @@ -1,40 +1,23 @@ #compdef tmuxinator mux #autoload -local curcontext="$curcontext" state line ret=1 -local -a _configs +_tmuxinator() { + local commands projects + commands=(${(f)"$(tmuxinator commands zsh)"}) + projects=(${(f)"$(tmuxinator completions start)"}) -_arguments -C \ - '1: :->cmds' \ - '2:: :->args' && ret=0 - -_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 - ;; + if (( CURRENT == 2 )); then + _describe -t commands "tmuxinator subcommands" commands + _describe -t projects "tmuxinator projects" projects + elif (( CURRENT == 3)); then + case $words[2] in + copy|debug|delete|open|start) + _arguments '*:projects:($projects)' + ;; esac - ;; -esac + fi + + return +} -return ret +compdef _tmuxinator tmuxinator diff --git a/plugins/tmuxinator/tmuxinator.plugin.zsh b/plugins/tmuxinator/tmuxinator.plugin.zsh new file mode 100644 index 000000000..166fa9881 --- /dev/null +++ b/plugins/tmuxinator/tmuxinator.plugin.zsh @@ -0,0 +1,5 @@ +# aliases +alias txs='tmuxinator start' +alias txo='tmuxinator open' +alias txn='tmuxinator new' +alias txl='tmuxinator list' diff --git a/plugins/transfer/README.md b/plugins/transfer/README.md new file mode 100644 index 000000000..5fa064445 --- /dev/null +++ b/plugins/transfer/README.md @@ -0,0 +1,24 @@ +# `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/ +``` diff --git a/plugins/transfer/transfer.plugin.zsh b/plugins/transfer/transfer.plugin.zsh new file mode 100644 index 000000000..db744b0cd --- /dev/null +++ b/plugins/transfer/transfer.plugin.zsh @@ -0,0 +1,69 @@ +# 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 + # add newline + echo + + # cleanup + rm -f $tmpfile +} diff --git a/plugins/ubuntu/README.md b/plugins/ubuntu/README.md new file mode 100644 index 000000000..caa6a90b4 --- /dev/null +++ b/plugins/ubuntu/README.md @@ -0,0 +1,52 @@ +# 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 | + + diff --git a/plugins/ubuntu/readme.md b/plugins/ubuntu/readme.md deleted file mode 100644 index 99d62a6f7..000000000 --- a/plugins/ubuntu/readme.md +++ /dev/null @@ -1,21 +0,0 @@ -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. diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh index 082481466..198f06743 100644 --- a/plugins/ubuntu/ubuntu.plugin.zsh +++ b/plugins/ubuntu/ubuntu.plugin.zsh @@ -5,18 +5,21 @@ # https://github.com/trinaldi # Nicolas Jonas nextgenthemes.com # https://github.com/loctauxphilippe +# https://github.com/HaraldNordgren # # Debian, Ubuntu and friends related zsh aliases and functions for zsh +(( $+commands[apt] )) && APT=apt || APT=apt-get + alias acs='apt-cache search' compdef _acs acs='apt-cache search' alias afs='apt-file search --regexp' compdef _afs afs='apt-file search --regexp' -# These are apt-get only -alias ags='apt-get source' # asrc -compdef _ags ags='apt-get source' +# These are apt/apt-get only +alias ags="$APT source" # asrc +compdef _ags ags="$APT source" alias acp='apt-cache policy' # app compdef _acp acp='apt-cache policy' @@ -37,33 +40,33 @@ compdef _afu afu='sudo apt-file update' alias ppap='sudo ppa-purge' compdef _ppap ppap='sudo ppa-purge' -alias apg='sudo apt-get' # age - but without sudo -alias aga='sudo apt-get autoclean' # aac -alias agb='sudo apt-get build-dep' # abd -alias agc='sudo apt-get clean' # adc -alias agd='sudo apt-get dselect-upgrade' # ads -alias agi='sudo apt-get install' # ai -alias agp='sudo apt-get purge' # ap -alias agr='sudo apt-get remove' # ar -alias agu='sudo apt-get update' # ad -alias agud='sudo apt-get update && sudo apt-get full-upgrade' #adu -alias agug='sudo apt-get upgrade' # ag -alias aguu='sudo apt-get update && sudo apt-get upgrade' #adg -alias agar='sudo apt-get autoremove' - -compdef _ag apg='sudo apt-get' -compdef _aga aga='sudo apt-get autoclean' -compdef _agb agb='sudo apt-get build-dep' -compdef _agc agc='sudo apt-get clean' -compdef _agd agd='sudo apt-get dselect-upgrade' -compdef _agi agi='sudo apt-get install' -compdef _agp agp='sudo apt-get purge' -compdef _agr agr='sudo apt-get remove' -compdef _agu agu='sudo apt-get update' -compdef _agud agud='sudo apt-get update && sudo apt-get full-upgrade' -compdef _agug agug='sudo apt-get upgrade' -compdef _aguu aguu='sudo apt-get update && sudo apt-get upgrade' -compdef _agar agar='sudo apt-get autoremove' +alias ag="sudo $APT" # age - but without sudo +alias aga="sudo $APT autoclean" # aac +alias agb="sudo $APT build-dep" # abd +alias agc="sudo $APT clean" # adc +alias agd="sudo $APT dselect-upgrade" # ads +alias agi="sudo $APT install" # ai +alias agp="sudo $APT purge" # ap +alias agr="sudo $APT remove" # ar +alias agu="sudo $APT update" # ad +alias agud="sudo $APT update && sudo $APT dist-upgrade" #adu +alias agug="sudo $APT upgrade" # ag +alias aguu="sudo $APT update && sudo $APT upgrade" #adg +alias agar="sudo $APT autoremove" + +compdef _ag ag="sudo $APT" +compdef _aga aga="sudo $APT autoclean" +compdef _agb agb="sudo $APT build-dep" +compdef _agc agc="sudo $APT clean" +compdef _agd agd="sudo $APT dselect-upgrade" +compdef _agi agi="sudo $APT install" +compdef _agp agp="sudo $APT purge" +compdef _agr agr="sudo $APT remove" +compdef _agu agu="sudo $APT update" +compdef _agud agud="sudo $APT update && sudo $APT dist-upgrade" +compdef _agug agug="sudo $APT upgrade" +compdef _aguu aguu="sudo $APT update && sudo $APT upgrade" +compdef _agar agar="sudo $APT autoremove" # Remove ALL kernel images and headers EXCEPT the one in use alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \ @@ -91,8 +94,8 @@ aar() { PACKAGE=${1##*/} fi - sudo apt-add-repository $1 && sudo apt-get update - sudo apt-get install $PACKAGE + sudo apt-add-repository $1 && sudo $APT update + sudo $APT install $PACKAGE } # Prints apt history @@ -102,7 +105,7 @@ aar() { # apt-history remove # apt-history rollback # 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 () { case "$1" in install) diff --git a/plugins/ufw/_ufw b/plugins/ufw/_ufw new file mode 100644 index 000000000..f5ad03377 --- /dev/null +++ b/plugins/ufw/_ufw @@ -0,0 +1,115 @@ +#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 diff --git a/plugins/urltools/README.md b/plugins/urltools/README.md new file mode 100644 index 000000000..548301c72 --- /dev/null +++ b/plugins/urltools/README.md @@ -0,0 +1,29 @@ +# 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 +``` diff --git a/plugins/urltools/urltools.plugin.zsh b/plugins/urltools/urltools.plugin.zsh index fa337acba..47d9a34e4 100644 --- a/plugins/urltools/urltools.plugin.zsh +++ b/plugins/urltools/urltools.plugin.zsh @@ -2,7 +2,7 @@ # Adds handy command line aliases useful for dealing with URLs # # 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 URLTOOLS_METHOD="" diff --git a/plugins/vagrant-prompt/README.md b/plugins/vagrant-prompt/README.md new file mode 100644 index 000000000..c5bc55d17 --- /dev/null +++ b/plugins/vagrant-prompt/README.md @@ -0,0 +1,6 @@ +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> diff --git a/plugins/vagrant-prompt/vagrant-prompt.plugin.zsh b/plugins/vagrant-prompt/vagrant-prompt.plugin.zsh new file mode 100644 index 000000000..28bf31f91 --- /dev/null +++ b/plugins/vagrant-prompt/vagrant-prompt.plugin.zsh @@ -0,0 +1,38 @@ +# 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 +} diff --git a/plugins/vagrant/README.md b/plugins/vagrant/README.md new file mode 100644 index 000000000..f6ea87b0e --- /dev/null +++ b/plugins/vagrant/README.md @@ -0,0 +1,10 @@ +# 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) +``` + diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant index c5335e72e..2efb4473d 100644 --- a/plugins/vagrant/_vagrant +++ b/plugins/vagrant/_vagrant @@ -6,6 +6,7 @@ local -a _1st_arguments _1st_arguments=( 'box:Box commands' + 'cloud:Manages everything related to Vagrant Cloud' 'connect:Connects to a remotely shared Vagrant environment' 'destroy:Destroys the vagrant environment' 'docker-logs:Outputs the logs from the Docker container' @@ -18,11 +19,12 @@ _1st_arguments=( 'login:Authenticates against a Vagrant Cloud server to access protected boxes' 'package:Packages a vagrant environment for distribution' 'plugin:Plugin commands' + 'port:Displays information about guest port mappings' 'provision:Run the provisioner' 'push:Deploys code in this environment to a configured destination' 'rdp:Connects to machine via RDP' '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-auto:Syncs rsync synced folders automatically when files change' 'share:Shares your Vagrant environment with anyone in the world' @@ -33,6 +35,7 @@ _1st_arguments=( 'suspend:Suspends the currently running vagrant environment' 'snapshot:Used to manage snapshots with the guest machine' 'up:Creates the vagrant environment' + 'validate:Validates the Vagrantfile' 'version:Prints current and latest Vagrant version' '--help:[TASK] Describe available tasks or one specific task' '--version:Prints the Vagrant version information' @@ -54,7 +57,7 @@ __task_list () local expl declare -a tasks - tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version) + tasks=(box destroy halt init package port provision reload resume ssh ssh_config status suspend up version) _wanted tasks expl 'help' compadd $tasks } @@ -81,7 +84,7 @@ __vagrant-box () case $state in (command) - _describe -t commands "gem subcommand" _box_arguments + _describe -t commands "vagrant subcommand" _box_arguments return ;; @@ -110,7 +113,7 @@ _arguments -C \ case $state in (command) - _describe -t commands "gem subcommand" _1st_arguments + _describe -t commands "vagrant subcommand" _1st_arguments return ;; @@ -123,7 +126,7 @@ case $state in (box) __vagrant-box ;; - (up|provision|package|destroy|reload|ssh|ssh-config|halt|resume|status) + (up|provision|port|package|destroy|reload|ssh|ssh-config|halt|resume|status) _arguments ':feature:__vm_list' esac ;; diff --git a/plugins/vault/README.md b/plugins/vault/README.md index 0f61c9410..69051d2b2 100644 --- a/plugins/vault/README.md +++ b/plugins/vault/README.md @@ -1,18 +1,15 @@ -## Vault (https://www.vaultproject.io) autocomplete plugin +# Vault plugin -- Adds autocomplete options for all vault commands. +Note: this plugin is deprecated. Use the [official autocompletion](https://www.vaultproject.io/docs/commands/index.html#autocompletion) instead. -####Show help for all commands -![General Help](http://i.imgur.com/yv5Db1r.png "Help for all commands") +------- +Adds autocomplete options for all [vault](https://www.vaultproject.io) commands. -####Create new Vault token -![Create token](http://i.imgur.com/xMegNgh.png "Create token") +To use it, add `vault` to the plugins array in your zshrc file: +```zsh +plugins=(... vault) +``` -####Enable audit backends -![Audit backends](http://i.imgur.com/fKLeiSF.png "Audit backends") - - - -Crafted with <3 by Valentin Bud ([@valentinbud](https://twitter.com/valentinbud))
\ No newline at end of file +Crafted with <3 by Valentin Bud ([@valentinbud](https://twitter.com/valentinbud)) diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh index 82a2f3040..a82e41439 100644 --- a/plugins/vi-mode/vi-mode.plugin.zsh +++ b/plugins/vi-mode/vi-mode.plugin.zsh @@ -1,14 +1,12 @@ # Updates editor information when the keymap changes. function zle-keymap-select() { + # update keymap variable for the prompt + VI_KEYMAP=$KEYMAP + zle reset-prompt zle -R } -# Ensure that the prompt is redrawn when the terminal size changes. -TRAPWINCH() { - zle && zle -R -} - zle -N zle-keymap-select zle -N edit-command-line @@ -28,8 +26,9 @@ bindkey '^?' backward-delete-char bindkey '^h' backward-delete-char bindkey '^w' backward-kill-word -# allow ctrl-r to perform backward search in history +# allow ctrl-r and ctrl-s to search the history bindkey '^r' history-incremental-search-backward +bindkey '^s' history-incremental-search-forward # allow ctrl-a and ctrl-e to move to beginning/end of line bindkey '^a' beginning-of-line @@ -41,7 +40,7 @@ if [[ "$MODE_INDICATOR" == "" ]]; then fi function vi_mode_prompt_info() { - echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}" + echo "${${VI_KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}" } # define right prompt, if it wasn't defined by a theme diff --git a/plugins/vim-interaction/vim-interaction.plugin.zsh b/plugins/vim-interaction/vim-interaction.plugin.zsh index b774be342..010f998d3 100644 --- a/plugins/vim-interaction/vim-interaction.plugin.zsh +++ b/plugins/vim-interaction/vim-interaction.plugin.zsh @@ -8,10 +8,11 @@ function callvim { if [[ $# == 0 ]]; then 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 -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 ... fileN The other files to add to the argslist EOH @@ -21,13 +22,16 @@ EOH local cmd="" local before="<esc>" local after="" - while getopts ":b:a:" option + local name="GVIM" + while getopts ":b:a:n:" option do case $option in a) after="$OPTARG" ;; b) before="$OPTARG" ;; + n) name="$OPTARG" + ;; esac done shift $((OPTIND-1)) @@ -43,7 +47,7 @@ EOH files=':args! '"${@:A:q}<cr>" fi cmd="$before$files$after" - gvim --remote-send "$cmd" + gvim --servername "$name" --remote-send "$cmd" if typeset -f postCallVim > /dev/null; then postCallVim fi diff --git a/plugins/virtualenv/README.md b/plugins/virtualenv/README.md new file mode 100644 index 000000000..e0b8c2c82 --- /dev/null +++ b/plugins/virtualenv/README.md @@ -0,0 +1,15 @@ +# 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 `]`. diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh index 6cd30732e..e27c6bb76 100644 --- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh +++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh @@ -1,11 +1,27 @@ 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 { setopt local_options unsetopt equals 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 function { setopt local_options diff --git a/plugins/vscode/README.md b/plugins/vscode/README.md new file mode 100644 index 000000000..74b5a45aa --- /dev/null +++ b/plugins/vscode/README.md @@ -0,0 +1,53 @@ +# 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) +``` + +If you are using [Visual Studio Code Insiders](https://code.visualstudio.com/insiders/), +add the following line in the oh-my-zsh settings section (between the `ZSH_THEME` and +the `plugins=()` line). This will make the plugin use the Insiders version instead. + +```zsh +ZSH_THEME=... + +# Add this line to use code-insiders instead of code +VSCODE=code-insiders + +plugins=(... vscode) + +source $ZSH/oh-my-zsh.sh +``` + +## 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. | diff --git a/plugins/vscode/vscode.plugin.zsh b/plugins/vscode/vscode.plugin.zsh new file mode 100644 index 000000000..4c15df2b0 --- /dev/null +++ b/plugins/vscode/vscode.plugin.zsh @@ -0,0 +1,22 @@ +# VScode zsh plugin +# author: https://github.com/MarsiBarsi + +# Use main Visual Studio Code version by default +: ${VSCODE:=code} + +alias vsc="$VSCODE ." +alias vsca="$VSCODE --add" +alias vscd="$VSCODE --diff" +alias vscg="$VSCODE --goto" +alias vscn="$VSCODE --new-window" +alias vscr="$VSCODE --reuse-window" +alias vscw="$VSCODE --wait" +alias vscu="$VSCODE --user-data-dir" + +alias vsced="$VSCODE --extensions-dir" +alias vscie="$VSCODE --install-extension" +alias vscue="$VSCODE --uninstall-extension" + +alias vscv="$VSCODE --verbose" +alias vscl="$VSCODE --log" +alias vscde="$VSCODE --disable-extensions" diff --git a/plugins/vundle/README.md b/plugins/vundle/README.md new file mode 100644 index 000000000..499038562 --- /dev/null +++ b/plugins/vundle/README.md @@ -0,0 +1,19 @@ +# 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!`) | + diff --git a/plugins/vundle/vundle.plugin.zsh b/plugins/vundle/vundle.plugin.zsh index 0f071597a..c84cacd0e 100644 --- a/plugins/vundle/vundle.plugin.zsh +++ b/plugins/vundle/vundle.plugin.zsh @@ -6,7 +6,7 @@ function vundle-init () { if [ ! -d ~/.vim/bundle/Vundle.vim/.git ] && [ ! -f ~/.vim/bundle/Vundle.vim/.git ] 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" fi } diff --git a/plugins/wd/wd.sh b/plugins/wd/wd.sh index 3d68583f1..3d68583f1 100755..100644 --- a/plugins/wd/wd.sh +++ b/plugins/wd/wd.sh diff --git a/plugins/web-search/README.md b/plugins/web-search/README.md new file mode 100644 index 000000000..d04042506 --- /dev/null +++ b/plugins/web-search/README.md @@ -0,0 +1,52 @@ +# 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=` | +| `givero` | `https://www.givero.com/search?q=` | +| `stackoverflow` | `https://stackoverflow.com/search?q=` | + +Also there are aliases for bang-searching DuckDuckGo: + +| Context | Bang | +|-----------|-------| +| `wiki` | `!w` | +| `news` | `!n` | +| `youtube` | `!yt` | +| `map` | `!m` | +| `image` | `!i` | +| `ducky` | `!` | diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh index cc970e5fd..5b76eeae2 100644 --- a/plugins/web-search/web-search.plugin.zsh +++ b/plugins/web-search/web-search.plugin.zsh @@ -16,6 +16,9 @@ function web_search() { 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=" + givero "https://www.givero.com/search?q=" + stackoverflow "https://stackoverflow.com/search?q=" ) # check whether the search engine is supported @@ -49,6 +52,9 @@ alias github='web_search github' alias baidu='web_search baidu' alias ecosia='web_search ecosia' alias goodreads='web_search goodreads' +alias qwant='web_search qwant' +alias givero='web_search givero' +alias stackoverflow='web_search stackoverflow' #add your own !bang searches here alias wiki='web_search duckduckgo \!w' diff --git a/plugins/wp-cli/README.md b/plugins/wp-cli/README.md index da398ed1a..43c41eb53 100644 --- a/plugins/wp-cli/README.md +++ b/plugins/wp-cli/README.md @@ -2,11 +2,11 @@ **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. -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 @@ -75,7 +75,7 @@ This plugin adds [tab completion](http://wp-cli.org/#complete) for `wp-cli` as w - wptp='wp theme path' - wpts='wp theme search' - wptst='wp theme status' -- wptu='wp theme updatet' +- wptu='wp theme update' ### User - wpuac='wp user add-cap' @@ -101,7 +101,7 @@ This plugin adds [tab completion](http://wp-cli.org/#complete) for `wp-cli` as w - wpwm='wp widget move' - 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. diff --git a/plugins/wp-cli/wp-cli.plugin.zsh b/plugins/wp-cli/wp-cli.plugin.zsh index 7b41c3257..97bed406e 100644 --- a/plugins/wp-cli/wp-cli.plugin.zsh +++ b/plugins/wp-cli/wp-cli.plugin.zsh @@ -1,6 +1,6 @@ # WP-CLI # A command line interface for WordPress -# http://wp-cli.org/ +# https://wp-cli.org/ # Cache @@ -109,7 +109,7 @@ alias wptm='wp theme mod' alias wptp='wp theme path' alias wpts='wp theme search' alias wptst='wp theme status' -alias wptu='wp theme updatet' +alias wptu='wp theme update' # Transient diff --git a/plugins/xcode/README.md b/plugins/xcode/README.md index c12ce047f..37f882638 100644 --- a/plugins/xcode/README.md +++ b/plugins/xcode/README.md @@ -19,7 +19,7 @@ plugins=(... xcode) | xcdd | Purge all temporary build information | rm -rf ~/Library/Developer/Xcode/DerivedData/* | | xcp | Show currently selected Xcode directory | xcode-select --print-path | | xcsel | Select different Xcode directory by path | sudo xcode-select --switch | - +| xx | Opens the files listed in Xcode | open -a "Xcode.app" | ## Functions @@ -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. 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` 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.) diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh index f711c39fb..89703fe3c 100644 --- a/plugins/xcode/xcode.plugin.zsh +++ b/plugins/xcode/xcode.plugin.zsh @@ -4,7 +4,7 @@ alias xcp='xcode-select --print-path' alias xcsel='sudo xcode-select --switch' # original author: @subdigital -# source: http://gist.github.com/subdigital/5420709 +# source: https://gist.github.com/subdigital/5420709 function xc { local xcode_proj if [[ $# == 0 ]]; then @@ -22,11 +22,25 @@ function xc { fi return 1 else - echo "Found ${xcode_proj[1]}" - open "${xcode_proj[1]}" + local active_path + 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 } +# 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 # Uses naming convention: # - different versions of Xcode are named Xcode-<version>.app or stored @@ -70,7 +84,7 @@ function xcselv { function _omz_xcode_print_xcselv_usage { cat << EOF >&2 -Usage: +Usage: xcselv <version> xcselv [options] diff --git a/plugins/yarn/README.md b/plugins/yarn/README.md new file mode 100644 index 000000000..671a272d9 --- /dev/null +++ b/plugins/yarn/README.md @@ -0,0 +1,39 @@ +# 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 | diff --git a/plugins/yarn/_yarn b/plugins/yarn/_yarn new file mode 100644 index 000000000..382f58a0a --- /dev/null +++ b/plugins/yarn/_yarn @@ -0,0 +1,345 @@ +#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 diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh index 5fa512377..9ed8322cd 100644 --- a/plugins/yarn/yarn.plugin.zsh +++ b/plugins/yarn/yarn.plugin.zsh @@ -1,88 +1,24 @@ -# Alias sorted alphabetically - -alias y="yarn " +alias y="yarn" alias ya="yarn add" +alias yad="yarn add --dev" +alias yap="yarn add --peer" +alias yb="yarn build" 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 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" - -_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 +alias yup="yarn upgrade" diff --git a/plugins/yum/README.md b/plugins/yum/README.md new file mode 100644 index 000000000..8043421d8 --- /dev/null +++ b/plugins/yum/README.md @@ -0,0 +1,27 @@ +# 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 | diff --git a/plugins/z/z.1 b/plugins/z/z.1 index bbc1bf5df..d4cac1ac2 100644 --- a/plugins/z/z.1 +++ b/plugins/z/z.1 @@ -22,6 +22,9 @@ OPTIONS \fB\-c\fR restrict matches to subdirectories of the current directory .TP +\fB\-e\fR +echo the best match, don't cd +.TP \fB\-h\fR show a brief help message .TP @@ -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.) .RE .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 .SS Aging: diff --git a/plugins/z/z.sh b/plugins/z/z.sh index d0eeb97ef..5fe6d5266 100644 --- a/plugins/z/z.sh +++ b/plugins/z/z.sh @@ -1,4 +1,4 @@ -# 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 # @@ -21,6 +21,7 @@ # * z -r foo # cd to highest ranked dir matching foo # * z -t foo # cd to most recently accessed dir matching foo # * 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 [ -d "${_Z_DATA:-$HOME/.z}" ] && { @@ -31,9 +32,21 @@ _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 [ -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 if [ "$1" = "--add" ]; then shift @@ -49,10 +62,7 @@ _z() { # maintain the data file local tempfile="$datafile.$RANDOM" - while read line; do - # only count directories - [ -d "${line%%\|*}" ] && echo $line - done < "$datafile" | awk -v path="$*" -v now="$(date +%s)" -F"|" ' + _z_dirs | awk -v path="$*" -v now="$(date +%s)" -F"|" ' BEGIN { rank[path] = 1 time[path] = now @@ -75,7 +85,7 @@ _z() { } else for( x in rank ) print x "|" rank[x] "|" time[x] } ' 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 env rm -f "$tempfile" else @@ -85,17 +95,15 @@ _z() { # tab completion elif [ "$1" = "--complete" -a -s "$datafile" ]; then - while read line; do - [ -d "${line%%\|*}" ] && echo $line - done < "$datafile" | awk -v q="$2" -F"|" ' + _z_dirs | awk -v q="$2" -F"|" ' BEGIN { - if( q == tolower(q) ) imatch = 1 q = substr(q, 3) - gsub(" ", ".*", q) + if( q == tolower(q) ) imatch = 1 + gsub(/ /, ".*", q) } { if( imatch ) { - if( tolower($1) ~ tolower(q) ) print $1 + if( tolower($1) ~ q ) print $1 } else if( $1 ~ q ) print $1 } ' 2>/dev/null @@ -106,11 +114,12 @@ _z() { --) while [ "$1" ]; do shift; local fnd="$fnd${fnd:+ }$1";done;; -*) local opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in c) local fnd="^$PWD $fnd";; - h) echo "${_Z_CMD:-z} [-chlrtx] args" >&2; return;; - x) sed -i -e "\:^${PWD}|.*:d" "$datafile";; + e) local echo=1;; + h) echo "${_Z_CMD:-z} [-cehlrtx] args" >&2; return;; l) local list=1;; r) local typ="rank";; t) local typ="recent";; + x) sed -i -e "\:^${PWD}|.*:d" "$datafile";; esac; opt=${opt:1}; done;; *) local fnd="$fnd${fnd:+ }$1";; esac; local last=$1; [ "$#" -gt 0 ] && shift; done @@ -119,16 +128,14 @@ _z() { # if we hit enter on a completion just go there case "$last" in # completions will always start with / - /*) [ -z "$list" -a -d "$last" ] && cd "$last" && return;; + /*) [ -z "$list" -a -d "$last" ] && builtin cd "$last" && return;; esac # no file yet [ -f "$datafile" ] || return local cd - cd="$(while read line; do - [ -d "${line%%\|*}" ] && echo $line - done < "$datafile" | awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" ' + cd="$( < <( _z_dirs ) awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" ' function frecent(rank, time) { # relate frequency and time dx = t - time @@ -137,19 +144,21 @@ _z() { if( dx < 604800 ) return rank / 2 return rank / 4 } - function output(files, out, common) { + function output(matches, best_match, common) { # list or return the desired directory if( list ) { cmd = "sort -n >&2" - for( x in files ) { - if( files[x] ) printf "%-10s %s\n", files[x], x | cmd + for( x in matches ) { + if( matches[x] ) { + printf "%-10s %s\n", matches[x], x | cmd + } } if( common ) { printf "%-10s %s\n", "common:", common > "/dev/stderr" } } else { - if( common ) out = common - print out + if( common ) best_match = common + print best_match } } function common(matches) { @@ -160,11 +169,9 @@ _z() { } } if( short == "/" ) return - # use a copy to escape special characters, as we want to return - # the original. yeah, this escaping is awful. - clean_short = short - gsub(/\[\(\)\[\]\|\]/, "\\\\&", clean_short) - for( x in matches ) if( matches[x] && x !~ clean_short ) return + for( x in matches ) if( matches[x] && index(x, short) != 1 ) { + return + } return short } BEGIN { @@ -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 } @@ -212,11 +221,17 @@ if type compctl >/dev/null 2>&1; then # populate directory list, avoid clobbering any other precmds. if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then _z_precmd() { - _z --add "${PWD:a}" + (_z --add "${PWD:a}" &) + # Reference $RANDOM to refresh its value inside the subshell + # Otherwise, multiple runs get the same value + : $RANDOM } else _z_precmd() { - _z --add "${PWD:A}" + (_z --add "${PWD:A}" &) + # Reference $RANDOM to refresh its value inside the subshell + # Otherwise, multiple runs get the same value + : $RANDOM } fi [[ -n "${precmd_functions[(r)_z_precmd]}" ]] || { @@ -237,7 +252,7 @@ elif type complete >/dev/null 2>&1; then [ "$_Z_NO_PROMPT_COMMAND" ] || { # populate directory list. avoid clobbering other PROMPT_COMMANDs. 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 diff --git a/plugins/zeus/_zeus b/plugins/zeus/_zeus index 5a13bd9ec..78f0c545e 100644 --- a/plugins/zeus/_zeus +++ b/plugins/zeus/_zeus @@ -2,33 +2,97 @@ #autoload # in order to make this work, you will need to have the gem zeus installed - -# zeus zsh completion, based on adb completion +# zeus zsh completion local -a _1st_arguments -_1st_arguments=( -'console:Lets you interact with your Rails application from the command line. (alias = c)' -'cucumber:Runs cucumber.' -'dbconsole:Figures out which database you are using and drops you into whichever command line interface.' -'destroy:Figures out what generate did, and undoes it. (alias = d)' -'generate:Uses templates to create a whole lot of things. (alias = g)' -'rake:Execute rake tasks.' -'runner:Runs Ruby code in the context of Rails non-interactively. (alias = r)' -'server:Launches a small web server named WEBrick which comes bundled with Ruby. (alias = s)' -'start:Preloads the zeus environment' -'test:Runs RSpec tests. (alias = rspec, testrb)' -'version:Shows the version number.' -) +if [[ -e .zeus.sock ]]; then + _1st_arguments=( + 'console:Lets you interact with your Rails application from the command line. (alias = c)' + 'cucumber:Runs cucumber.' + 'dbconsole:Figures out which database you are using and drops you into whichever command line interface.' + 'destroy:Figures out what generate did, and undoes it. (alias = d)' + 'generate:Uses templates to create a whole lot of things. (alias = g)' + 'rake:Execute rake tasks.' + 'runner:Runs Ruby code in the context of Rails non-interactively. (alias = r)' + 'server:Launches a small web server named WEBrick which comes bundled with Ruby. (alias = s)' + 'test:Runs RSpec tests. (alias = rspec, testrb)' + '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 -a pkgs installed_pkgs +local curcontext="$curcontext" state line +typeset -A opt_args -_arguments \ - '*:: :->subcmds' && return 0 +_arguments -C \ + ':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 diff --git a/plugins/zsh-navigation-tools/LICENSE b/plugins/zsh-navigation-tools/LICENSE index 075c80ccd..4ee028112 100644 --- a/plugins/zsh-navigation-tools/LICENSE +++ b/plugins/zsh-navigation-tools/LICENSE @@ -27,7 +27,7 @@ GPLv3 License GNU GENERAL PUBLIC LICENSE 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 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. GNU General Public License for more details. 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. @@ -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, 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 -<http://www.gnu.org/licenses/>. +<https://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you 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 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>. diff --git a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh index 32b4ca064..32b4ca064 100755..100644 --- a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh +++ b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh diff --git a/plugins/zsh_reload/README.md b/plugins/zsh_reload/README.md new file mode 100644 index 000000000..d31a827fe --- /dev/null +++ b/plugins/zsh_reload/README.md @@ -0,0 +1,23 @@ +# 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! +``` diff --git a/plugins/zsh_reload/zsh_reload.plugin.zsh b/plugins/zsh_reload/zsh_reload.plugin.zsh index cde9ebeca..51048ba9d 100644 --- a/plugins/zsh_reload/zsh_reload.plugin.zsh +++ b/plugins/zsh_reload/zsh_reload.plugin.zsh @@ -1,13 +1,12 @@ -# reload zshrc -function src() -{ - local cache=$ZSH_CACHE_DIR - autoload -U compinit zrecompile - compinit -d "$cache/zcomp-$HOST" +src() { + local cache="$ZSH_CACHE_DIR" + autoload -U compinit zrecompile + compinit -i -d "$cache/zcomp-$HOST" - for f in ~/.zshrc "$cache/zcomp-$HOST"; do - zrecompile -p $f && command rm -f $f.zwc.old - done + for f in ~/.zshrc "$cache/zcomp-$HOST"; do + zrecompile -p $f && command rm -f $f.zwc.old + done - source ~/.zshrc + # Use $SHELL if available; remove leading dash if login shell + [[ -n "$SHELL" ]] && exec ${SHELL#-} || exec zsh } diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index bba2d370d..453daf8a2 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -4,28 +4,31 @@ # Path to your oh-my-zsh installation. export ZSH=$HOME/.oh-my-zsh -# Set name of the theme to load. Optionally, if you set this to "random" -# it'll load a random theme each time that oh-my-zsh is loaded. +# Set name of the theme to load --- if set to "random", it will +# 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 ZSH_THEME="robbyrussell" -# Set list of themes to load -# Setting this variable when ZSH_THEME=random -# cause zsh load theme from this variable instead of -# looking in ~/.oh-my-zsh/themes/ -# An empty array have no effect +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/ +# If set to an empty array, this variable will have no effect. # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) # Uncomment the following line to use case-sensitive completion. # CASE_SENSITIVE="true" -# Uncomment the following line to use hyphen-insensitive completion. Case -# sensitive completion must be off. _ and - will be interchangeable. +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. # HYPHEN_INSENSITIVE="true" # Uncomment the following line to disable bi-weekly auto-update checks. # DISABLE_AUTO_UPDATE="true" +# Uncomment the following line to automatically update without prompting. +# DISABLE_UPDATE_PROMPT="true" + # Uncomment the following line to change how often to auto-update (in days). # export UPDATE_ZSH_DAYS=13 @@ -48,19 +51,21 @@ ZSH_THEME="robbyrussell" # Uncomment the following line if you want to change the command execution time # 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" # Would you like to use another custom folder than $ZSH/custom? # 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/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. -plugins=( - git -) +plugins=(git) source $ZSH/oh-my-zsh.sh @@ -81,9 +86,6 @@ source $ZSH/oh-my-zsh.sh # Compilation flags # export ARCHFLAGS="-arch x86_64" -# ssh -# export SSH_KEY_PATH="~/.ssh/rsa_id" - # Set personal aliases, overriding those provided by oh-my-zsh libs, # plugins, and themes. Aliases can be placed here, though oh-my-zsh # users are encouraged to define aliases within the ZSH_CUSTOM folder. diff --git a/themes/3den.zsh-theme b/themes/3den.zsh-theme index 1d2c7db7f..ae3a88659 100644 --- a/themes/3den.zsh-theme +++ b/themes/3den.zsh-theme @@ -1,4 +1,4 @@ -PROMPT=$'%{$fg[white]%}$(~/.rvm/bin/rvm-prompt) %{$fg_bold[cyan]%}%~%{$reset_color%}$(git_prompt_info) %{$fg[cyan]%}%D{[%I:%M:%S]}\ +PROMPT=$'%{$fg[white]%}$(ruby_prompt_info) %{$fg_bold[cyan]%}%~%{$reset_color%}$(git_prompt_info) %{$fg[cyan]%}%D{[%I:%M:%S]}\ %{$fg_bold[green]%}%n$%{$reset_color%} ' ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[white]%}(" diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme index e4774cf0e..b9ac77d00 100644 --- a/themes/adben.zsh-theme +++ b/themes/adben.zsh-theme @@ -6,7 +6,7 @@ # # a) displaying a pseudo-random message from a database of quotations # # (https://en.wikipedia.org/wiki/Fortune_%28Unix%29) # # 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. # # 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 @@ -23,11 +23,11 @@ # # optionally: # # -Oh-myzsh vcs plug-ins git and svn. # # -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) # # # # 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! ########## COLOR ########### for COLOR in CYAN WHITE YELLOW MAGENTA BLACK BLUE RED DEFAULT GREEN GREY; do diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 07546fd34..518a14a37 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -13,9 +13,13 @@ # # In addition, I recommend the # [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. # +# 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 # # The aim of this theme is to only show you *relevant* information. Like most @@ -30,6 +34,11 @@ CURRENT_BG='NONE' +case ${SOLARIZED_THEME:-dark} in + light) CURRENT_FG='white';; + *) CURRENT_FG='black';; +esac + # Special Powerline characters () { @@ -80,28 +89,31 @@ prompt_end() { # Context: user@hostname (who am I and where am I) prompt_context() { 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 } # Git: branch/detached head, dirty status prompt_git() { (( $+commands[git] )) || return + if [[ "$(git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]]; then + return + fi local PL_BRANCH_CHAR () { local LC_ALL="" LC_CTYPE="en_US.UTF-8" PL_BRANCH_CHAR=$'\ue0a0' # } 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 + repo_path=$(git rev-parse --git-dir 2>/dev/null) dirty=$(parse_git_dirty) ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)" if [[ -n $dirty ]]; then prompt_segment yellow black else - prompt_segment green black + prompt_segment green $CURRENT_FG fi if [[ -e "${repo_path}/BISECT_LOG" ]]; then @@ -140,7 +152,6 @@ prompt_bzr() { if [[ $status_all -gt 0 ]] ; then prompt_segment yellow black echo -n "bzr@"$revision - else prompt_segment green black echo -n "bzr@"$revision @@ -151,7 +162,7 @@ prompt_bzr() { prompt_hg() { (( $+commands[hg] )) || return - local rev status + local rev st branch if $(hg id >/dev/null 2>&1); then if $(hg prompt >/dev/null 2>&1); then if [[ $(hg prompt "{status|unknown}") = "?" ]]; then @@ -164,7 +175,7 @@ prompt_hg() { st='±' else # if working copy is clean - prompt_segment green black + prompt_segment green $CURRENT_FG fi echo -n $(hg prompt "☿ {rev}@{branch}") $st else @@ -178,7 +189,7 @@ prompt_hg() { prompt_segment yellow black st='±' else - prompt_segment green black + prompt_segment green $CURRENT_FG fi echo -n "☿ $rev@$branch" $st fi @@ -187,7 +198,7 @@ prompt_hg() { # Dir: current working directory prompt_dir() { - prompt_segment blue black '%~' + prompt_segment blue $CURRENT_FG '%~' } # Virtualenv: current working virtualenv @@ -203,8 +214,8 @@ prompt_virtualenv() { # - am I root # - are there background jobs? prompt_status() { - local symbols - symbols=() + local -a symbols + [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘" [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙" @@ -212,11 +223,25 @@ prompt_status() { [[ -n "$symbols" ]] && prompt_segment black default "$symbols" } +#AWS Profile: +# - display current AWS_PROFILE name +# - displays yellow on red if profile name contains 'production' or +# ends in '-prod' +# - displays black on green otherwise +prompt_aws() { + [[ -z "$AWS_PROFILE" ]] && return + case "$AWS_PROFILE" in + *-prod|*production*) prompt_segment red yellow "AWS: $AWS_PROFILE" ;; + *) prompt_segment green black "AWS: $AWS_PROFILE" ;; + esac +} + ## Main prompt build_prompt() { RETVAL=$? prompt_status prompt_virtualenv + prompt_aws prompt_context prompt_dir prompt_git diff --git a/themes/alanpeabody.zsh-theme b/themes/alanpeabody.zsh-theme index 4a1b1b386..1de90e57b 100644 --- a/themes/alanpeabody.zsh-theme +++ b/themes/alanpeabody.zsh-theme @@ -1,17 +1,10 @@ local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}' local pwd='%{$fg[blue]%}%~%{$reset_color%}' -local rvm='' -if which rvm-prompt &> /dev/null; then - rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}' -else - if which rbenv &> /dev/null; then - rvm='%{$fg[green]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}' - fi -fi local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})' local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}' +ZSH_THEME_RVM_PROMPT_OPTIONS="i v g" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="" @@ -24,5 +17,8 @@ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[green]%}‹" +ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}" + PROMPT="${user} ${pwd}$ " -RPROMPT="${return_code} ${git_branch} ${rvm}" +RPROMPT="${return_code} ${git_branch} \$(ruby_prompt_info)" diff --git a/themes/amuse.zsh-theme b/themes/amuse.zsh-theme index 4e7361ced..3f7ec0bc5 100644 --- a/themes/amuse.zsh-theme +++ b/themes/amuse.zsh-theme @@ -1,17 +1,5 @@ # vim:ft=zsh ts=2 sw=2 sts=2 -rvm_current() { - rvm current 2>/dev/null -} - -rbenv_version() { - rbenv version 2>/dev/null | awk '{print $1}' -} - -PROMPT=' -%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%} -$ ' - # Must use Powerline font, for \uE0A0 to render. ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}\uE0A0 " ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" @@ -19,11 +7,12 @@ ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" ZSH_THEME_GIT_PROMPT_CLEAN="" -if [ -e ~/.rvm/bin/rvm-prompt ]; then - RPROMPT='%{$fg_bold[red]%}‹$(rvm_current)›%{$reset_color%}' -else - if which rbenv &> /dev/null; then - RPROMPT='%{$fg_bold[red]%}$(rbenv_version)%{$reset_color%}' - fi -fi +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg_bold[red]%}‹" +ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}" + +PROMPT=' +%{$fg_bold[green]%}%~%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%} +$ ' + +RPROMPT='$(ruby_prompt_info)' diff --git a/themes/arrow.zsh-theme b/themes/arrow.zsh-theme index d62dcdcb9..a3e77d65d 100644 --- a/themes/arrow.zsh-theme +++ b/themes/arrow.zsh-theme @@ -8,7 +8,7 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_DIRTY="*" ZSH_THEME_GIT_PROMPT_CLEAN="" -# See http://geoff.greer.fm/lscolors/ +# See https://geoff.greer.fm/lscolors/ 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:" diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 4f0dcbcc6..aec14e4a6 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -50,9 +50,7 @@ function _ruby_version() { # use a neutral color, otherwise colors will vary according to time. function _git_time_since_commit() { # Only proceed if there is actually a commit. - if git log -1 > /dev/null 2>&1; then - # Get the last commit. - last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null) + if last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null); then now=$(date +%s) seconds_since_last_commit=$((now-last_commit)) @@ -65,7 +63,7 @@ function _git_time_since_commit() { sub_hours=$((hours % 24)) sub_minutes=$((minutes % 60)) - if [ $hours -gt 24 ]; then + if [ $hours -ge 24 ]; then commit_age="${days}d" elif [ $minutes -gt 60 ]; then commit_age="${sub_hours}h${sub_minutes}m" @@ -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_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 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' diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme index 29bda0be8..d00f72f5d 100644 --- a/themes/bira.zsh-theme +++ b/themes/bira.zsh-theme @@ -1,30 +1,32 @@ -# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png +# ZSH Theme - Preview: https://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - if [[ $UID -eq 0 ]]; then - local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}' + local user_host='%{$terminfo[bold]$fg[red]%}%n@%m %{$reset_color%}' local user_symbol='#' else - local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' + local user_host='%{$terminfo[bold]$fg[green]%}%n@%m %{$reset_color%}' local user_symbol='$' fi -local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}' -local rvm_ruby='' -if which rvm-prompt &> /dev/null; then - rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' -else - if which rbenv &> /dev/null; then - rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}' - fi -fi -local git_branch='$(git_prompt_info)%{$reset_color%}' +local current_dir='%{$terminfo[bold]$fg[blue]%}%~ %{$reset_color%}' +local git_branch='$(git_prompt_info)' +local rvm_ruby='$(ruby_prompt_info)' +local venv_prompt='$(virtualenv_prompt_info)' -PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} +ZSH_THEME_RVM_PROMPT_OPTIONS="i v g" + +PROMPT="╭─${venv_prompt}${user_host}${current_dir}${rvm_ruby}${git_branch} ╰─%B${user_symbol}%b " -RPS1="%B${return_code}%b" +RPROMPT="%B${return_code}%b" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹" +ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}" + +ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$fg[green]%}‹" +ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="› %{$reset_color%}" +ZSH_THEME_VIRTUALENV_PREFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX +ZSH_THEME_VIRTUALENV_SUFFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX diff --git a/themes/candy-kingdom.zsh-theme b/themes/candy-kingdom.zsh-theme index 9d2103926..30ce785c0 100644 --- a/themes/candy-kingdom.zsh-theme +++ b/themes/candy-kingdom.zsh-theme @@ -17,7 +17,7 @@ function box_name { } 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%} )$ ' ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[magenta]%}branch: " diff --git a/themes/clean.zsh-theme b/themes/clean.zsh-theme index 7ee29cb8c..5c96e4726 100644 --- a/themes/clean.zsh-theme +++ b/themes/clean.zsh-theme @@ -9,6 +9,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} " ZSH_THEME_GIT_PROMPT_CLEAN="" 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 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:' diff --git a/themes/cloud.zsh-theme b/themes/cloud.zsh-theme index 4efbf9776..59a3472b6 100644 --- a/themes/cloud.zsh-theme +++ b/themes/cloud.zsh-theme @@ -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_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}] %{$fg[yellow]%}⚡%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]"
\ No newline at end of file +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}] %{$fg[yellow]%}⚡ %{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]" diff --git a/themes/crunch.zsh-theme b/themes/crunch.zsh-theme index 2fc066381..8278661ab 100644 --- a/themes/crunch.zsh-theme +++ b/themes/crunch.zsh-theme @@ -29,13 +29,9 @@ ZSH_THEME_GIT_PROMPT_DIRTY=" $CRUNCH_GIT_DIRTY_COLOR✗" # Our elements: CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}" -if [ -e ~/.rvm/bin/rvm-prompt ]; then - CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}" -else - if which rbenv &> /dev/null; then - CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(rbenv version | sed -e 's/ (set.*$//' -e 's/^ruby-//')}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}" - fi -fi +ZSH_THEME_RUBY_PROMPT_PREFIX="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR" +ZSH_THEME_RUBY_PROMPT_SUFFIX="$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}" +CRUNCH_RVM_='$(ruby_prompt_info)' CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) " CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ " diff --git a/themes/dallas.zsh-theme b/themes/dallas.zsh-theme index e9e86177b..d6c417fc3 100644 --- a/themes/dallas.zsh-theme +++ b/themes/dallas.zsh-theme @@ -2,14 +2,6 @@ # Grab the current date (%D) and time (%T) wrapped in {}: {%D %T} DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%D %T%{$fg[white]%}}%{$reset_color%}" -# Grab the current version of ruby in use (via RVM): [ruby-1.8.7] -if [ -e ~/.rvm/bin/rvm-prompt ]; then - DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}" -else - if which rbenv &> /dev/null; then - DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg[white]%}]%{$reset_color%}" - fi -fi # Grab the current machine name: muscato DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}" # Grab the current filepath, use shortcuts: ~/Desktop @@ -28,5 +20,8 @@ ZSH_THEME_GIT_PROMPT_CLEAN="" # Add 3 cyan ✗s if this branch is diiirrrty! Dirty branch! ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[cyan]%}✗✗✗" +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[white]%}[%{$fg[magenta]%}" +ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$fg[white]%}]%{$reset_color%}" + # Put it all together! -PROMPT="$DALLAS_CURRENT_TIME_$DALLAS_CURRENT_RUBY_$DALLAS_CURRENT_MACH_$DALLAS_CURRENT_LOCA_ $DALLAS_CURRENT_USER_$DALLAS_PROMPT_CHAR_ " +PROMPT="$DALLAS_CURRENT_TIME_\$(ruby_prompt_info)$DALLAS_CURRENT_MACH_$DALLAS_CURRENT_LOCA_ $DALLAS_CURRENT_USER_$DALLAS_PROMPT_CHAR_ " diff --git a/themes/dst.zsh-theme b/themes/dst.zsh-theme index 3e2539d57..6b2f8767d 100644 --- a/themes/dst.zsh-theme +++ b/themes/dst.zsh-theme @@ -11,6 +11,6 @@ function prompt_char { PROMPT='%(?, ,%{$fg[red]%}FAIL%{$reset_color%} ) %{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) -%_ $(prompt_char) ' +$(prompt_char) ' RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' diff --git a/themes/dstufft.zsh-theme b/themes/dstufft.zsh-theme index 5a23fcea5..39ce69819 100644 --- a/themes/dstufft.zsh-theme +++ b/themes/dstufft.zsh-theme @@ -9,7 +9,7 @@ function virtualenv_info { } 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) ' ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" diff --git a/themes/duellj.zsh-theme b/themes/duellj.zsh-theme index 3849c35be..f70b39bc3 100644 --- a/themes/duellj.zsh-theme +++ b/themes/duellj.zsh-theme @@ -1,6 +1,6 @@ # user, host, full path, and time/date # 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%} %{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]%{\e[0m%}%b ' RPROMPT='[%*]' diff --git a/themes/emotty.zsh-theme b/themes/emotty.zsh-theme index 34d491ff0..13adad78d 100644 --- a/themes/emotty.zsh-theme +++ b/themes/emotty.zsh-theme @@ -68,6 +68,10 @@ prompt_glyph="%{%(#.${root_prompt}.${user_prompt}) %2G%}" 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 -Uz vcs_info diff --git a/themes/example.zsh-theme b/themes/example.zsh-theme deleted file mode 100644 index dbd9dc9c9..000000000 --- a/themes/example.zsh-theme +++ /dev/null @@ -1,5 +0,0 @@ -# Found on the ZshWiki -# http://zshwiki.org/home/config/prompt -# - -PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "
\ No newline at end of file diff --git a/themes/fino-time.zsh-theme b/themes/fino-time.zsh-theme index 9b1db3a08..5679e9f37 100644 --- a/themes/fino-time.zsh-theme +++ b/themes/fino-time.zsh-theme @@ -25,15 +25,16 @@ function box_name { } -local rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}' -local current_dir='${PWD/#$HOME/~}' +local rvm_ruby='using%{$FG[243]%}$(ruby_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) " ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$FG[202]%}✘✘✘" ZSH_THEME_GIT_PROMPT_CLEAN="%{$FG[040]%}✔" +ZSH_THEME_RUBY_PROMPT_PREFIX="‹" +ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}" diff --git a/themes/fino.zsh-theme b/themes/fino.zsh-theme index 6eec097f5..1d8bb30e1 100644 --- a/themes/fino.zsh-theme +++ b/themes/fino.zsh-theme @@ -20,24 +20,17 @@ function box_name { [ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST} } -local ruby_env='' -if which rvm-prompt &> /dev/null; then - ruby_env=' ‹$(rvm-prompt i v g)›%{$reset_color%}' -else - if which rbenv &> /dev/null; then - ruby_env=' ‹$(rbenv version-name)›%{$reset_color%}' - fi -fi - -local current_dir='${PWD/#$HOME/~}' +local ruby_env='using%{$FG[243]%} $(ruby_prompt_info)' local git_info='$(git_prompt_info)' 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%} " ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$FG[202]%}✘✘✘" ZSH_THEME_GIT_PROMPT_CLEAN="%{$FG[040]%}✔" +ZSH_THEME_RUBY_PROMPT_PREFIX="‹" +ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}" diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme index 83bd455b5..00a60f45b 100644 --- a/themes/fishy.zsh-theme +++ b/themes/fishy.zsh-theme @@ -14,7 +14,7 @@ PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) PROMPT2='%{$fg[red]%}\ %{$reset_color%}' local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}" -RPROMPT='${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}' +RPROMPT="${RPROMPT}"'${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX=" " ZSH_THEME_GIT_PROMPT_SUFFIX="" diff --git a/themes/frontcube.zsh-theme b/themes/frontcube.zsh-theme index 539e744f8..f9488d0ac 100644 --- a/themes/frontcube.zsh-theme +++ b/themes/frontcube.zsh-theme @@ -1,12 +1,13 @@ -local rvm="%{$fg[green]%}[$(rvm-prompt i v g)]%{$reset_color%}" PROMPT=' %{$fg_bold[gray]%}%~%{$fg_bold[blue]%}%{$fg_bold[blue]%} % %{$reset_color%} %{$fg[green]%}➞ %{$reset_color%' -RPROMPT='$(git_prompt_info) ${rvm}' +RPROMPT='$(git_prompt_info) $(ruby_prompt_info)' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}[git:" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}] %{$fg[red]%}✖ %{$reset_color%}" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}] %{$fg[green]%}✔%{$reset_color%}" +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[green]%}[" +ZSH_THEME_RUBY_PROMPT_SUFFIX="]%{$reset_color%}" diff --git a/themes/funky.zsh-theme b/themes/funky.zsh-theme index 2451296d9..574538f88 100644 --- a/themes/funky.zsh-theme +++ b/themes/funky.zsh-theme @@ -1,5 +1,5 @@ # 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_cp="%{$fg[blue]%}]%{$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} ╰─${blue_op}${smiley}${blue_cp} %# " local cur_cmd="${blue_op}%_${blue_cp}" -PROMPT2="${cur_cmd}> "
\ No newline at end of file +PROMPT2="${cur_cmd}> " diff --git a/themes/gallifrey.zsh-theme b/themes/gallifrey.zsh-theme index 252566f06..768547064 100644 --- a/themes/gallifrey.zsh-theme +++ b/themes/gallifrey.zsh-theme @@ -1,8 +1,11 @@ -# ZSH Theme - Preview: https://flic.kr/p/ZFvivf -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +# ZSH Theme - Preview: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#gallifrey +return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +host_color="%(!.%{$fg[red]%}.%{$fg[green]%})" -PROMPT='%{$fg[green]%}%m%{$reset_color%} %2~ $(git_prompt_info)%{$reset_color%}%B»%b ' +PROMPT="${host_color}%m%{$reset_color%} %2~ \$(git_prompt_info)%{$reset_color%}%B»%b " RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" + +unset return_code host_color diff --git a/themes/gallois.zsh-theme b/themes/gallois.zsh-theme index 515325e38..e6c2d8142 100644 --- a/themes/gallois.zsh-theme +++ b/themes/gallois.zsh-theme @@ -14,8 +14,8 @@ git_custom_status() { } # RVM component of prompt -ZSH_THEME_RVM_PROMPT_PREFIX="%{$fg[red]%}[" -ZSH_THEME_RVM_PROMPT_SUFFIX="]%{$reset_color%}" +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}[" +ZSH_THEME_RUBY_PROMPT_SUFFIX="]%{$reset_color%}" # Combine it all into a final right-side prompt RPS1='$(git_custom_status)$(ruby_prompt_info) $EPS1' diff --git a/themes/gentoo.zsh-theme b/themes/gentoo.zsh-theme index ee205d248..5f2427c7a 100644 --- a/themes/gentoo.zsh-theme +++ b/themes/gentoo.zsh-theme @@ -2,7 +2,7 @@ function prompt_char { if [ $UID -eq 0 ]; then echo "#"; else echo $; fi } -PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%_$(prompt_char)%{$reset_color%} ' +PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)$(prompt_char)%{$reset_color%} ' ZSH_THEME_GIT_PROMPT_PREFIX="(" ZSH_THEME_GIT_PROMPT_SUFFIX=") " diff --git a/themes/gnzh.zsh-theme b/themes/gnzh.zsh-theme index 04b0450a8..1e6c4e93b 100644 --- a/themes/gnzh.zsh-theme +++ b/themes/gnzh.zsh-theme @@ -1,4 +1,3 @@ -# ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png # Based on bira theme setopt prompt_subst @@ -30,21 +29,15 @@ local return_code="%(?..%F{red}%? ↵%f)" local user_host="${PR_USER}%F{cyan}@${PR_HOST}" local current_dir="%B%F{blue}%~%f%b" -local rvm_ruby='' -if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect user-local rvm installation - rvm_ruby='%F{red}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%f' -elif which rvm-prompt &> /dev/null; then # detect system-wide rvm installation - rvm_ruby='%F{red}‹$(rvm-prompt i v g s)›%f' -elif which rbenv &> /dev/null; then # detect Simple Ruby Version Management - rvm_ruby='%F{red}‹$(rbenv version | sed -e "s/ (set.*$//")›%f' -fi local git_branch='$(git_prompt_info)' -PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} +PROMPT="╭─${user_host} ${current_dir} \$(ruby_prompt_info) ${git_branch} ╰─$PR_PROMPT " RPROMPT="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="› %f" +ZSH_THEME_RUBY_PROMPT_PREFIX="%F{red}‹" +ZSH_THEME_RUBY_PROMPT_SUFFIX="›%f" } diff --git a/themes/half-life.zsh-theme b/themes/half-life.zsh-theme index 5f987099d..c79027ed6 100644 --- a/themes/half-life.zsh-theme +++ b/themes/half-life.zsh-theme @@ -1,11 +1,11 @@ # 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: # http://www.jukie.net/bart/blog/pimping-out-zsh-prompt # # 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 { [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' @@ -60,7 +60,7 @@ zstyle ':vcs_info:*:prompt:*' nvcsformats "" function steeef_preexec { - case "$(history $HISTCMD)" in + case "$2" in *git*) PR_GIT_UPDATE=1 ;; diff --git a/themes/itchy.zsh-theme b/themes/itchy.zsh-theme index c23889edf..41a42e88c 100644 --- a/themes/itchy.zsh-theme +++ b/themes/itchy.zsh-theme @@ -1,5 +1,3 @@ -# Inspired by http://peepcode.com/blog/2012/my-command-line-prompt - local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})" local user="%{$fg[cyan]%}%n%{$reset_color%}" @@ -9,10 +7,12 @@ local pwd="%{$fg[yellow]%}%~%{$reset_color%}" PROMPT='${user}${host} ${pwd} ${smiley} ' -RPROMPT='$(rvm-prompt || rbenv version) %{$fg[white]%}$(git_prompt_info)%{$reset_color%}' +RPROMPT='$(ruby_prompt_info) %{$fg[white]%}$(git_prompt_info)%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="" ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ✗%{$reset_color%}" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ✔%{$reset_color%}" +ZSH_THEME_RUBY_PROMPT_PREFIX="" +ZSH_THEME_RUBY_PROMPT_SUFFIX="" diff --git a/themes/jaischeema.zsh-theme b/themes/jaischeema.zsh-theme index da1dd1e5d..50d2bc4a5 100644 --- a/themes/jaischeema.zsh-theme +++ b/themes/jaischeema.zsh-theme @@ -1,16 +1,12 @@ # jaischeema.zsh-theme PROMPT='%{$fg_bold[magenta]%}%m%{$reset_color%} at %{$fg_bold[green]%}%~%{$reset_color%} %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}%{$fg[red]%}❯%{$reset_color%} ' +RPROMPT='$(ruby_prompt_info)' ZSH_THEME_GIT_PROMPT_PREFIX="±(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%} " ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) " -if which rbenv &> /dev/null; then - RPROMPT='%{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%}' -else - if which rvm-prompt &> /dev/null; then - RPROMPT='%{$fg[red]%}$(rvm-prompt)%{$reset_color%}' - fi -fi +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}" +ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}" diff --git a/themes/jreese.zsh-theme b/themes/jreese.zsh-theme index 0fa6b4ecd..de42a1010 100644 --- a/themes/jreese.zsh-theme +++ b/themes/jreese.zsh-theme @@ -1,5 +1,3 @@ -# 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 local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" diff --git a/themes/lambda.zsh-theme b/themes/lambda.zsh-theme index 63292d331..6e67773ea 100644 --- a/themes/lambda.zsh-theme +++ b/themes/lambda.zsh-theme @@ -1,5 +1,3 @@ -# ZSH Theme - Preview: http://cl.ly/350F0F0k1M2y3A2i3p1S - PROMPT='λ %~/ $(git_prompt_info)%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" diff --git a/themes/lukerandall.zsh-theme b/themes/lukerandall.zsh-theme index f4045bd8e..cdecd284f 100644 --- a/themes/lukerandall.zsh-theme +++ b/themes/lukerandall.zsh-theme @@ -1,4 +1,4 @@ -# ZSH Theme - Preview: http://cl.ly/f701d00760f8059e06dc +# ZSH Theme - Preview: https://cl.ly/f701d00760f8059e06dc # Thanks to gallifrey, upon whose theme this is based local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})" diff --git a/themes/macovsky-ruby.zsh-theme b/themes/macovsky-ruby.zsh-theme index 69d80d588..d3ee200a9 100644..120000 --- a/themes/macovsky-ruby.zsh-theme +++ b/themes/macovsky-ruby.zsh-theme @@ -1,15 +1 @@ -# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - -if [ -e ~/.rvm/bin/rvm-prompt ]; then - PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' -else - if which rbenv &> /dev/null; then - PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' - fi -fi - -RPS1="${return_code}" - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" -ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" +macovsky.zsh-theme
\ No newline at end of file diff --git a/themes/macovsky.zsh-theme b/themes/macovsky.zsh-theme index 2e6dce42d..f527e5861 100644 --- a/themes/macovsky.zsh-theme +++ b/themes/macovsky.zsh-theme @@ -1,14 +1,12 @@ -# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png +# ZSH Theme - Preview: https://i.gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -if [ -e ~/.rvm/bin/rvm-prompt ]; then - PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' -else - if which rbenv &> /dev/null; then - PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' - fi -fi -RPS1="${return_code}" +PROMPT='%{$fg[green]%}%~%{$reset_color%} $(ruby_prompt_info) $(git_prompt_info)%{$reset_color%}%B$%b ' +RPROMPT="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" + + +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹" +ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}" diff --git a/themes/maran.zsh-theme b/themes/maran.zsh-theme index 6fba04688..fddb7bc30 100644 --- a/themes/maran.zsh-theme +++ b/themes/maran.zsh-theme @@ -1,6 +1,6 @@ # Theme with full path names and hostname # Handy if you work on different servers all the time; -PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@%{$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) ' +PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@%{$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%}$(git_prompt_info) %(!.#.$) ' ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}git:(" ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" diff --git a/themes/mh.zsh-theme b/themes/mh.zsh-theme index 34a3765b1..2b2cc9b68 100644 --- a/themes/mh.zsh-theme +++ b/themes/mh.zsh-theme @@ -1,5 +1,5 @@ # mh theme -# preview: http://cl.ly/1y2x0W0E3t2C0F29043z +# preview: https://cl.ly/1y2x0W0E3t2C0F29043z # features: # path is autoshortened to ~30 characters @@ -19,6 +19,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[gray]%})%{$reset_color%} " ZSH_THEME_GIT_PROMPT_CLEAN="" 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 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:' diff --git a/themes/michelebologna.zsh-theme b/themes/michelebologna.zsh-theme index 110e3f203..7ff6a7ffe 100644 --- a/themes/michelebologna.zsh-theme +++ b/themes/michelebologna.zsh-theme @@ -1,16 +1,16 @@ # Michele Bologna's theme -# http://michelebologna.net +# https://www.michelebologna.net # # This a theme for oh-my-zsh. Features a colored prompt with: -# * username@host: [jobs] [git] workdir % -# * hostname color is based on hostname characters. When using as root, the +# * username@host: [jobs] [git] workdir % +# * hostname color is based on hostname characters. When using as root, the # prompt shows only the hostname in red color. # * [jobs], if applicable, counts the number of suspended jobs tty # * [git], if applicable, represents the status of your git repo (more on that # later) # * '%' 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 # and it adds: # * the current branch diff --git a/themes/mikeh.zsh-theme b/themes/mikeh.zsh-theme index a95383ba5..f231b91bb 100644 --- a/themes/mikeh.zsh-theme +++ b/themes/mikeh.zsh-theme @@ -15,7 +15,7 @@ mikeh_precmd() { # user, host, full path, and time/date # 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%} %{\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 '
\ No newline at end of file +PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' diff --git a/themes/mira.zsh-theme b/themes/mira.zsh-theme index e6c952998..a7c60359c 100644 --- a/themes/mira.zsh-theme +++ b/themes/mira.zsh-theme @@ -4,22 +4,13 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' -local rvm_ruby='' -if which rvm-prompt &> /dev/null; then - rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' -else - if which rbenv &> /dev/null; then - rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}' - fi -fi +local nvm_node='%{$fg[green]%}‹node-$(nvm_prompt_info)›%{$reset_color%}' -local nvm_node='' -nvm_node='%{$fg[green]%}‹node-$(nvm_prompt_info)›%{$reset_color%}' +local jenv_java='%{$fg[blue]%}‹$(jenv_prompt_info)›%{$reset_color%}' -local jenv_java='' -jenv_java='%{$fg[blue]%}‹$(jenv_prompt_info)›%{$reset_color%}' +local git_branch='$(git_prompt_info)' -local git_branch='$(git_prompt_info)%{$reset_color%}' +local rvm_ruby='$(ruby_prompt_info)' PROMPT="╭─${user_host} ${current_dir} ${nvm_node} ${rvm_ruby} ${jenv_java} ${git_branch} ╰─%B$%b " @@ -27,3 +18,6 @@ RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}(" ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}" + +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹" +ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}" diff --git a/themes/mortalscumbag.zsh-theme b/themes/mortalscumbag.zsh-theme index 55ece9760..d81a7ca06 100644 --- a/themes/mortalscumbag.zsh-theme +++ b/themes/mortalscumbag.zsh-theme @@ -9,6 +9,11 @@ function my_git_prompt() { STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" 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? if $(echo "$INDEX" | command grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then 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 ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}" ZSH_THEME_GIT_PROMPT_PREFIX=" $fg[white]‹ %{$fg_bold[yellow]%}" 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_UNSTAGED="%{$fg_bold[red]%}●" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[white]%}●" diff --git a/themes/philips.zsh-theme b/themes/philips.zsh-theme index f6e5b324e..fec734bad 100644 --- a/themes/philips.zsh-theme +++ b/themes/philips.zsh-theme @@ -9,6 +9,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} " ZSH_THEME_GIT_PROMPT_CLEAN="" 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 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' diff --git a/themes/pmcgee.zsh-theme b/themes/pmcgee.zsh-theme index e4e45c71a..58a9b8bef 100644 --- a/themes/pmcgee.zsh-theme +++ b/themes/pmcgee.zsh-theme @@ -11,6 +11,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " ZSH_THEME_GIT_PROMPT_CLEAN="" 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 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:' diff --git a/themes/pure.zsh-theme b/themes/pure.zsh-theme deleted file mode 100644 index 98c1312af..000000000 --- a/themes/pure.zsh-theme +++ /dev/null @@ -1,10 +0,0 @@ -print -P '%F{yellow}'Oh My Zsh pure theme: -cat <<-EOF - - The pure theme has been renamed as 'refined' as per the original author's - request. Change your ZSH_THEME to 'refined' to avoid seeing this warning. - -EOF -print -P '%f' - -source ${0:h:A}/refined.zsh-theme diff --git a/themes/pygmalion-virtualenv.zsh-theme b/themes/pygmalion-virtualenv.zsh-theme new file mode 100644 index 000000000..ea28e125a --- /dev/null +++ b/themes/pygmalion-virtualenv.zsh-theme @@ -0,0 +1,50 @@ +# Yay! High voltage and arrows! + + +function _virtualenv_prompt_info { + if [[ -n "$(whence virtualenv_prompt_info)" ]]; then + if [ -n "$(whence pyenv_prompt_info)" ]; then + if [ "$1" = "inline" ]; then + ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX=%{$fg[blue]%}"::%{$fg[red]%}" + ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="" + virtualenv_prompt_info + fi + [ "$(pyenv_prompt_info)" = "${PYENV_PROMPT_DEFAULT_VERSION}" ] && virtualenv_prompt_info + else + virtualenv_prompt_info + fi + fi +} + +prompt_setup_pygmalion(){ + ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " + ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + base_prompt='$(_virtualenv_prompt_info)%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}' + post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} ' + + base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") + post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g") + + precmd_functions+=(prompt_pygmalion_precmd) +} + +prompt_pygmalion_precmd(){ + local gitinfo=$(git_prompt_info) + local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g") + local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")" + local prompt_length=${#exp_nocolor} + + local nl="" + + if [[ $prompt_length -gt 40 ]]; then + nl=$'\n%{\r%}'; + fi + PROMPT="$base_prompt$gitinfo$nl$post_prompt" +} + +prompt_setup_pygmalion + + diff --git a/themes/refined.zsh-theme b/themes/refined.zsh-theme index 0e5681cc7..2a4188c9d 100644 --- a/themes/refined.zsh-theme +++ b/themes/refined.zsh-theme @@ -72,6 +72,7 @@ preexec() { precmd() { vcs_info # Get version control info before we start outputting stuff print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f" + unset cmd_timestamp #Reset cmd exec time. } # Define prompts diff --git a/themes/rkj-repos.zsh-theme b/themes/rkj-repos.zsh-theme index ba2a0dba6..65a075456 100644 --- a/themes/rkj-repos.zsh-theme +++ b/themes/rkj-repos.zsh-theme @@ -1,13 +1,13 @@ -# user, host, full path, and time/date -# 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 +# user, host, full path, and time/date on two lines for easier vgrepping function hg_prompt_info { + if (( $+commands[hg] )) && grep -q "prompt" ~/.hgrc; then hg prompt --angle-brackets "\ <hg:%{$fg[magenta]%}<branch>%{$reset_color%}><:%{$fg[magenta]%}<bookmark>%{$reset_color%}>\ </%{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$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 + fi } ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+" @@ -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]%}] %{$fg_bold[blue]%}└─[%{$fg_bold[magenta]%}%?$(retcode)%{$fg_bold[blue]%}] <$(mygit)$(hg_prompt_info)>%{$reset_color%} ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' - diff --git a/themes/rkj.zsh-theme b/themes/rkj.zsh-theme index fe06161c8..d7c9314e3 100644 --- a/themes/rkj.zsh-theme +++ b/themes/rkj.zsh-theme @@ -1,6 +1,6 @@ # user, host, full path, and time/date # 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() {} diff --git a/themes/simonoff.zsh-theme b/themes/simonoff.zsh-theme index 63ce4261b..ef91c5ee3 100644 --- a/themes/simonoff.zsh-theme +++ b/themes/simonoff.zsh-theme @@ -23,7 +23,7 @@ function precmd { local promptsize=${#${(%):---(%n@%M:%l)---()}} local pwdsize=${#${(%):-%~}} local gitbranch="$(git_prompt_info)" - local rvmprompt="$(rvm_prompt_info)" + local rvmprompt="$(ruby_prompt_info)" local gitbranchsize=${#${gitbranch:-''}} local rvmpromptsize=${#${rvmprompt:-''}} @@ -90,8 +90,8 @@ setprompt () { ZSH_THEME_GIT_PROMPT_SUFFIX="]" ### # Modify RVM prompt - ZSH_THEME_RVM_PROMPT_PREFIX=" [" - ZSH_THEME_RVM_PROMPT_SUFFIX="]" + ZSH_THEME_RUBY_PROMPT_PREFIX=" [" + ZSH_THEME_RUBY_PROMPT_SUFFIX="]" ### diff --git a/themes/simple.zsh-theme b/themes/simple.zsh-theme index a88d9d72a..8d0070ba7 100644 --- a/themes/simple.zsh-theme +++ b/themes/simple.zsh-theme @@ -1,4 +1,4 @@ -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_SUFFIX=")" diff --git a/themes/sorin.zsh-theme b/themes/sorin.zsh-theme index ac6a49840..e478d2672 100644 --- a/themes/sorin.zsh-theme +++ b/themes/sorin.zsh-theme @@ -1,10 +1,10 @@ # 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 MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$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%} ' ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}git%{$reset_color%}:%{$fg[red]%}" @@ -20,10 +20,10 @@ if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" -else +else MODE_INDICATOR="❮❮❮" local return_status="%(?::⏎)" - + PROMPT='%c$(git_prompt_info) %(!.#.❯) ' ZSH_THEME_GIT_PROMPT_PREFIX=" git:" diff --git a/themes/sporty_256.zsh-theme b/themes/sporty_256.zsh-theme index db0fc4277..e008a8664 100644 --- a/themes/sporty_256.zsh-theme +++ b/themes/sporty_256.zsh-theme @@ -1,6 +1,6 @@ # zsh theme requires 256 color enabled terminal # 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! PROMPT='%{$fg_bold[blue]%}$(git_prompt_info) %F{208}%c%f diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index b72a41c92..3532d3bc7 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -1,11 +1,11 @@ # 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: # http://www.jukie.net/bart/blog/pimping-out-zsh-prompt # # 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 @@ -62,10 +62,13 @@ zstyle ':vcs_info:*:prompt:*' nvcsformats "" function steeef_preexec { - case "$(history $HISTCMD)" in + case "$2" in *git*) PR_GIT_UPDATE=1 ;; + *hub*) + PR_GIT_UPDATE=1 + ;; *svn*) PR_GIT_UPDATE=1 ;; diff --git a/themes/sunaku.zsh-theme b/themes/sunaku.zsh-theme index 440fa90b4..77f3acc7b 100644 --- a/themes/sunaku.zsh-theme +++ b/themes/sunaku.zsh-theme @@ -1,5 +1,4 @@ # 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_MODIFIED="%{$fg[magenta]%}!" diff --git a/themes/suvash.zsh-theme b/themes/suvash.zsh-theme index 1680973df..850476cdf 100644 --- a/themes/suvash.zsh-theme +++ b/themes/suvash.zsh-theme @@ -8,20 +8,7 @@ function virtualenv_info { [[ -n "$VIRTUAL_ENV" ]] && echo '('${VIRTUAL_ENV:t}') ' } -function ruby_prompt { - if (( $+commands[rvm-prompt] )); then - print -n $ZSH_THEME_RUBY_PROMPT_PREFIX - print -n $(~/.rvm/bin/rvm-prompt) - print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX - elif (( $+commands[rbenv] )); then - print -n $ZSH_THEME_RUBY_PROMPT_PREFIX - print -n $(rbenv version | sed -e "s/ (set.*$//") - print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX - fi - return 0 -} - -PROMPT='%F{magenta}%n%f at %F{yellow}%m%f in %B%F{green}%~%f%b$(git_prompt_info)$(ruby_prompt) +PROMPT='%F{magenta}%n%f at %F{yellow}%m%f in %B%F{green}%~%f%b$(git_prompt_info)$(ruby_prompt_info) $(virtualenv_info) $(prompt_char) ' ZSH_THEME_GIT_PROMPT_PREFIX=' on %F{magenta}' diff --git a/themes/tjkirch.zsh-theme b/themes/tjkirch.zsh-theme index 446cde724..c51609860 100644 --- a/themes/tjkirch.zsh-theme +++ b/themes/tjkirch.zsh-theme @@ -10,6 +10,6 @@ function prompt_char { PROMPT='%(?, ,%{$fg[red]%}FAIL: $?%{$reset_color%} ) %{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) -%_$(prompt_char) ' +$(prompt_char) ' RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' diff --git a/themes/tjkirch_mod.zsh-theme b/themes/tjkirch_mod.zsh-theme index 1b206a7e1..2dd060ea1 100644 --- a/themes/tjkirch_mod.zsh-theme +++ b/themes/tjkirch_mod.zsh-theme @@ -8,6 +8,6 @@ function prompt_char { } PROMPT='%(?,,%{$fg[red]%}FAIL: $?%{$reset_color%} -)%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) %_$(prompt_char) ' +)%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) $(prompt_char) ' RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' diff --git a/themes/tonotdo.zsh-theme b/themes/tonotdo.zsh-theme index a6407034c..426e2bf35 100644 --- a/themes/tonotdo.zsh-theme +++ b/themes/tonotdo.zsh-theme @@ -7,6 +7,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_CLEAN="%{$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 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 +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:' diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme index 3fa5d57ab..144d2549a 100644 --- a/themes/trapd00r.zsh-theme +++ b/themes/trapd00r.zsh-theme @@ -1,8 +1,9 @@ # trapd00r.zsh-theme # -# This theme needs a terminal supporting 256 colors as well as unicode. It also -# needs the script that splits up the current path and makes it fancy as located -# here: https://github.com/trapd00r/utils/blob/master/zsh_path +# This theme needs a terminal supporting 256 colors as well as unicode. +# In order to avoid external dependencies, it also has a zsh version of +# 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: # @@ -20,37 +21,77 @@ autoload -U add-zsh-hook autoload -Uz vcs_info -local c0=$( printf "\e[m") -local c1=$( printf "\e[38;5;245m") -local c2=$( printf "\e[38;5;250m") -local c3=$( printf "\e[38;5;242m") -local c4=$( printf "\e[38;5;197m") -local c5=$( printf "\e[38;5;225m") -local c6=$( printf "\e[38;5;240m") -local c7=$( printf "\e[38;5;242m") -local c8=$( printf "\e[38;5;244m") -local c9=$( printf "\e[38;5;162m") -local c10=$(printf "\e[1m") -local c11=$(printf "\e[38;5;208m\e[1m") -local c12=$(printf "\e[38;5;142m\e[1m") -local c13=$(printf "\e[38;5;196m\e[1m") +local c0=$'\e[m' +local c1=$'\e[38;5;245m' +local c2=$'\e[38;5;250m' +local c3=$'\e[38;5;242m' +local c4=$'\e[38;5;197m' +local c5=$'\e[38;5;225m' +local c6=$'\e[38;5;240m' +local c7=$'\e[38;5;242m' +local c8=$'\e[38;5;244m' +local c9=$'\e[38;5;162m' +local c10=$'\e[1m' +local c11=$'\e[38;5;208m\e[1m' +local c12=$'\e[38;5;142m\e[1m' +local c13=$'\e[38;5;196m\e[1m' -# We don't want to use the extended colorset in the TTY / VC. -if [ "$TERM" = "linux" ]; then - c1=$( printf "\e[34;1m") - c2=$( printf "\e[35m") - c3=$( printf "\e[31m") - c4=$( printf "\e[31;1m") - c5=$( printf "\e[32m") - c6=$( printf "\e[32;1m") - c7=$( printf "\e[33m") - c8=$( printf "\e[33;1m") - c9=$( printf "\e[34m") +zsh_path() { + local colors + colors=$(echoti colors) + + local -A yellow + yellow=( + 1 '%F{228}' 2 '%F{222}' 3 '%F{192}' 4 '%F{186}' + 5 '%F{227}' 6 '%F{221}' 7 '%F{191}' 8 '%F{185}' + 9 '%F{226}' 10 '%F{220}' 11 '%F{190}' 12 '%F{184}' + 13 '%F{214}' 14 '%F{178}' 15 '%F{208}' 16 '%F{172}' + 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") - c13=$(printf "\e[31;1m") + +# We don't want to use the extended colorset in the TTY / VC. +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 zstyle ':vcs_info:*' actionformats \ @@ -70,14 +111,12 @@ prompt_jnrowe_precmd () { 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%} > ' - -# modified, to be committed + # modified, to be committed 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%})" 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%} > ' - 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%})" 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 () { PROMPT='${vcs_info_msg_0_} %{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} > ' -fi + fi } - -# vim: set ft=zsh sw=2 et tw=0: diff --git a/themes/wedisagree.zsh-theme b/themes/wedisagree.zsh-theme index 9bdbce40d..07006ecd9 100644 --- a/themes/wedisagree.zsh-theme +++ b/themes/wedisagree.zsh-theme @@ -28,7 +28,7 @@ PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}' RPROMPT='${time} %{$fg[magenta]%}$(git_prompt_info)%{$reset_color%}$(git_prompt_status)%{$reset_color%}$(git_prompt_ahead)%{$reset_color%}' # Add this at the start of RPROMPT to include rvm info showing ruby-version@gemset-name -# %{$fg[yellow]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%} +# $(ruby_prompt_info) # local time, color coded by last return code time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}" @@ -48,6 +48,9 @@ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➜" # ⓡ ⑄ ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ♒" # ⓤ ⑊ ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[blue]%} 𝝙" +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[yellow]%}" +ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}" + # More symbols to choose from: # ☀ ✹ ☄ ♆ ♀ ♁ ♐ ♇ ♈ ♉ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♣ ⚢ ⚲ ⚳ ⚴ ⚥ ⚤ ⚦ ⚒ ⚑ ⚐ ♺ ♻ ♼ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷ # ✡ ✔ ✖ ✚ ✱ ✤ ✦ ❤ ➜ ➟ ➼ ✂ ✎ ✐ ⨀ ⨁ ⨂ ⨍ ⨎ ⨏ ⨷ ⩚ ⩛ ⩡ ⩱ ⩲ ⩵ ⩶ ⨠ diff --git a/themes/xiong-chiamiov-plus.zsh-theme b/themes/xiong-chiamiov-plus.zsh-theme index 5fb4fe6f4..aa6ef7421 100644 --- a/themes/xiong-chiamiov-plus.zsh-theme +++ b/themes/xiong-chiamiov-plus.zsh-theme @@ -1,6 +1,6 @@ # user, host, full path, and time/date # 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%} %{\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 ' diff --git a/themes/xiong-chiamiov.zsh-theme b/themes/xiong-chiamiov.zsh-theme index 0ed335fb5..b67d9947c 100644 --- a/themes/xiong-chiamiov.zsh-theme +++ b/themes/xiong-chiamiov.zsh-theme @@ -1,6 +1,6 @@ # user, host, full path, and time/date # 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%} %{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index a57f6da0f..c8dedcf77 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -7,7 +7,7 @@ function _current_epoch() { } function _update_zsh_update() { - echo "LAST_EPOCH=$(_current_epoch)" >! ~/.zsh-update + echo "LAST_EPOCH=$(_current_epoch)" >! ${ZSH_CACHE_DIR}/.zsh-update } function _upgrade_zsh() { @@ -30,11 +30,13 @@ fi whence git >/dev/null || return 0 if mkdir "$ZSH/log/update.lock" 2>/dev/null; then - if [ -f ~/.zsh-update ]; then - . ~/.zsh-update + if [ -f ${ZSH_CACHE_DIR}/.zsh-update ]; then + . ${ZSH_CACHE_DIR}/.zsh-update if [[ -z "$LAST_EPOCH" ]]; then - _update_zsh_update && return 0; + _update_zsh_update + rmdir $ZSH/log/update.lock # TODO: fix later + return 0 fi epoch_diff=$(($(_current_epoch) - $LAST_EPOCH)) @@ -42,7 +44,7 @@ if mkdir "$ZSH/log/update.lock" 2>/dev/null; then if [ "$DISABLE_UPDATE_PROMPT" = "true" ]; then _upgrade_zsh 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 if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then _upgrade_zsh diff --git a/tools/install.sh b/tools/install.sh index 187c828f5..2e5e8fd43 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -24,12 +24,10 @@ main() { # which may fail on systems lacking tput or terminfo set -e - CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l) - if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then + if ! command -v zsh >/dev/null 2>&1; then printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n" exit fi - unset CHECK_ZSH_INSTALLED if [ ! -n "$ZSH" ]; then ZSH=~/.oh-my-zsh @@ -49,7 +47,7 @@ main() { umask g-w,o-w 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" exit 1 } @@ -61,7 +59,7 @@ main() { exit 1 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" exit 1 } @@ -74,14 +72,14 @@ main() { fi 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\\ - export ZSH=$ZSH + export ZSH=\"$ZSH\" " ~/.zshrc > ~/.zshrc-omztemp mv -f ~/.zshrc-omztemp ~/.zshrc # If this user's login shell is not already "zsh", attempt to switch. - TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') + TEST_CURRENT_SHELL=$(basename "$SHELL") if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then # If this platform provides a "chsh" command (not Cygwin), do it, man! if hash chsh >/dev/null 2>&1; then @@ -105,12 +103,12 @@ main() { echo '' echo 'Please look over the ~/.zshrc file to select plugins, themes, and options.' echo '' - echo 'p.s. Follow us at https://twitter.com/ohmyzsh.' + echo 'p.s. Follow us at https://twitter.com/ohmyzsh' echo '' - echo 'p.p.s. Get stickers and t-shirts at https://shop.planetargon.com.' + echo 'p.p.s. Get stickers, shirts, and coffee mugs at https://shop.planetargon.com/collections/oh-my-zsh' echo '' printf "${NORMAL}" - env zsh + env zsh -l } main diff --git a/tools/theme_chooser.sh b/tools/theme_chooser.sh index 2c2a379ba..82ae5857c 100755 --- a/tools/theme_chooser.sh +++ b/tools/theme_chooser.sh @@ -5,7 +5,7 @@ # 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 # 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" FAVLIST="${HOME}/.zsh_favlist" diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 25b2de27a..d234c7f88 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -33,7 +33,7 @@ then printf '%s\n' ' /____/ ' printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version." printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh" - printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/" + printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh" else printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?' fi |