diff options
Diffstat (limited to 'plugins')
47 files changed, 948 insertions, 162 deletions
diff --git a/plugins/autoenv/README.md b/plugins/autoenv/README.md new file mode 100644 index 000000000..de3881774 --- /dev/null +++ b/plugins/autoenv/README.md @@ -0,0 +1,14 @@ +# Autoenv plugin + +This plugin loads the [Autoenv](https://github.com/inishchith/autoenv). + +To use it, add `autoenv` to the plugins array in your zshrc file: + +```zsh +plugins=(... autoenv) +``` +## Requirements + +In order to make this work, you will need to have the autoenv installed. + +More info on the usage and install: https://github.com/inishchith/autoenv diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh index 8f398cfb3..6b6684716 100644 --- a/plugins/battery/battery.plugin.zsh +++ b/plugins/battery/battery.plugin.zsh @@ -7,6 +7,9 @@ # Email: neuralsandwich@gmail.com # # Modified to add support for Apple Mac # ########################################### +# Author: J (927589452) # +# Modified to add support for FreeBSD # +########################################### if [[ "$OSTYPE" = darwin* ]] ; then @@ -64,6 +67,52 @@ if [[ "$OSTYPE" = darwin* ]] ; then [[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]] } +elif [[ "$OSTYPE" = freebsd* ]] ; then + + function battery_is_charging() { + [[ $(sysctl -n hw.acpi.battery.state) -eq 2 ]] + } + + function battery_pct() { + if (( $+commands[sysctl] )) ; then + echo "$(sysctl -n hw.acpi.battery.life)" + fi + } + + function battery_pct_remaining() { + if [ ! $(battery_is_charging) ] ; then + battery_pct + else + echo "External Power" + fi + } + + function battery_time_remaining() { + remaining_time=$(sysctl -n hw.acpi.battery.time) + if [[ $remaining_time -ge 0 ]] ; then + # calculation from https://www.unix.com/shell-programming-and-scripting/23695-convert-minutes-hours-minutes-seconds.html + ((hour=$remaining_time/60)) + ((minute=$remaining_time-$hour*60)) + echo $hour:$minute + fi + } + + function battery_pct_prompt() { + b=$(battery_pct_remaining) + if [ ! $(battery_is_charging) ] ; then + if [ $b -gt 50 ] ; then + color='green' + elif [ $b -gt 20 ] ; then + color='yellow' + else + color='red' + fi + echo "%{$fg[$color]%}$(battery_pct_remaining)%%%{$reset_color%}" + else + echo "∞" + fi + } + elif [[ "$OSTYPE" = linux* ]] ; then function battery_is_charging() { diff --git a/plugins/bundler/README.md b/plugins/bundler/README.md index dc2f17008..a7d40cd0a 100644 --- a/plugins/bundler/README.md +++ b/plugins/bundler/README.md @@ -2,7 +2,7 @@ - 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` @@ -15,7 +15,7 @@ - calls `bundle exec <gem executable>` otherwise Common gems wrapped by default (by name of the executable): -`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`. +`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `rubocop`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`. ## Configuration diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 668e15d2f..c4a4fd40a 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -27,6 +27,7 @@ bundled_commands=( rainbows rake rspec + rubocop shotgun sidekiq spec diff --git a/plugins/cakephp3/README.md b/plugins/cakephp3/README.md new file mode 100644 index 000000000..7e8f6640d --- /dev/null +++ b/plugins/cakephp3/README.md @@ -0,0 +1,16 @@ +# cakephp3 plugin + +The plugin adds aliases and autocompletion for [cakephp3](https://book.cakephp.org/3.0/en/index.html). + +To use it, add `cakephp3` to the plugins array of your zshrc file: +``` +plugins=(... cakephp3) +``` + +## Aliases + +| Alias | Command | +|-----------|-------------------------------| +| c3 | `bin/cake` | +| c3cache | `bin/cake orm_cache clear` | +| c3migrate | `bin/cake migrations migrate` | diff --git a/plugins/chruby/README.md b/plugins/chruby/README.md new file mode 100644 index 000000000..d373006a5 --- /dev/null +++ b/plugins/chruby/README.md @@ -0,0 +1,20 @@ +# chruby plugin + +This plugin loads [chruby](https://github.com/postmodern/chruby), a tool that changes the +current Ruby version, and completion and a prompt function to display the Ruby version. +Supports brew and manual installation of chruby. + +To use it, add `chruby` to the plugins array in your zshrc file: +```zsh +plugins=(... chruby) +``` + +## Usage + +If you'd prefer to specify an explicit path to load chruby from +you can set variables like so: + +``` +zstyle :omz:plugins:chruby path /local/path/to/chruby.sh +zstyle :omz:plugins:chruby auto /local/path/to/auto.sh +``` diff --git a/plugins/cloudapp/README.md b/plugins/cloudapp/README.md new file mode 100644 index 000000000..62975a631 --- /dev/null +++ b/plugins/cloudapp/README.md @@ -0,0 +1,24 @@ +# CloudApp plugin + +[CloudApp](https://www.getcloudapp.com) brings screen recording, screenshots, and GIF creation to the cloud, in an easy-to-use enterprise-level app. The CloudApp plugin allows you to upload a file to your CloadApp account from the command line. + +To use it, add `cloudapp` to the plugins array of your `~/.zshrc` file: + +``` +plugins=(... dash) +``` + +## Requirements + +1. [Aaron Russell's `cloudapp_api` gem](https://github.com/aaronrussell/cloudapp_api#installation) + +2. That you set your CloudApp credentials in `~/.cloudapp` as a simple text file like below: + ``` + email + password + ``` + +## Usage + +- `cloudapp <filename>`: uploads `<filename>` to your CloudApp account, and if you're using + macOS, copies the URL to your clipboard. diff --git a/plugins/colemak/README.md b/plugins/colemak/README.md new file mode 100644 index 000000000..4da4bc126 --- /dev/null +++ b/plugins/colemak/README.md @@ -0,0 +1,48 @@ +# Colemak plugin + +This plugin remaps keys in `zsh`'s [`vi`-style navigation mode](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Keymaps) +for a [Colemak](https://colemak.com/) keyboard layout, to match the QWERTY position: + +![Colemak layout on a US keyboard](https://colemak.com/wiki/images/6/6c/Colemak2.png) + +To use it, add it to the plugins array in your `~/.zshrc` file: + +``` +plugins=(... colemak) +``` + +You will also need to enable `vi` mode, so add another line to `~/.zshrc`: +``` +bindkey -v +``` + +Restart your shell and hit the `<ESC>` key to activate `vicmd` (navigation) mode, +and start navigating `zsh` with your new keybindings! + +## Key bindings for vicmd + +| Old | New | Binding | Description | +|------------|------------|---------------------------|----------------------------------------------------| +| `CTRL`+`j` | `CTRL`+`n` | accept-line | Insert new line | +| `j` | `n` | down-line-or-history | Move one line down or command history forwards | +| `k` | `e` | up-line-or-history | Move one line up or command history backwards | +| `l` | `i` | vi-forward-char | Move one character to the right | +| `n` | `k` | vi-repeat-search | Repeat command search forwards | +| `N` | `K` | vi-rev-repeat-search | Repeat command search backwards | +| `i` | `u` | vi-insert | Enter insert mode | +| `I` | `U` | vi-insert-bol | Move to first non-blank char and enter insert mode | +| `<none>` | `l` | vi-undo-change | Undo change | +| `J` | `N` | vi-join | Join the current line with the next one | +| `e` | `j` | vi-forward-word-end | Move to the end of the next word | +| `E` | `J` | vi-forward-blank-word-end | Move to end of the current or next word | + +## Key bindings for less + +| Keyboard shortcut | `less` key binding | +|-------------------|--------------------| +| `n` | forw-line | +| `e` | back-line | +| `k` | repeat-search | +| `ESC`+`k` | repeat-search-all | +| `K` | reverse-search | +| `ESC`+`K` | reverse-search-all | diff --git a/plugins/compleat/README.md b/plugins/compleat/README.md new file mode 100644 index 000000000..630c91503 --- /dev/null +++ b/plugins/compleat/README.md @@ -0,0 +1,8 @@ +# compleat plugin + +This plugin looks for [compleat](https://github.com/mbrubeck/compleat) and loads its completion. + +To use it, add compleat to the plugins array in your zshrc file: +``` +plugins=(... compleat) +``` diff --git a/plugins/dash/README.md b/plugins/dash/README.md new file mode 100644 index 000000000..0ca3e4e44 --- /dev/null +++ b/plugins/dash/README.md @@ -0,0 +1,28 @@ +# Dash plugin + +This plugin adds command line functionality for [Dash](https://kapeli.com/dash), +an API Documentation Browser for macOS. This plugin requires Dash to be installed +to work. + +To use it, add `dash` to the plugins array in your zshrc file: + +```zsh +plugins=(... dash) +``` + +## Usage + +- Open and switch to the dash application. +``` +dash +``` + +- Query for something in dash app: `dash query` +``` +dash golang +``` + +- You can optionally provide a keyword: `dash [keyword:]query` +``` +dash python:tuple +``` diff --git a/plugins/dash/dash.plugin.zsh b/plugins/dash/dash.plugin.zsh index b00d4877e..ace2e33c1 100644 --- a/plugins/dash/dash.plugin.zsh +++ b/plugins/dash/dash.plugin.zsh @@ -35,36 +35,30 @@ _dash() { 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 + if [[ "$keyword" = (python|java|qt|cocos2d) ]]; 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 + case "$keyword" in + python) + case "$docsetName" in + "Python 2") keyword="python2" ;; + "Python 3") keyword="python3" ;; + esac ;; + java) + case "$docsetName" in + "Java SE7") keyword="java7" ;; + "Java SE6") keyword="java6" ;; + "Java SE8") keyword="java8" ;; + esac ;; + qt) + case "$docsetName" in + "Qt 5") keyword="qt5" ;; + "Qt 4"|Qt) keyword="qt4" ;; + esac ;; + cocos2d) + case "$docsetName" in + Cocos3D) keyword="cocos3d" ;; + esac ;; + esac fi fi diff --git a/plugins/emotty/README.md b/plugins/emotty/README.md new file mode 100644 index 000000000..2cfbe120c --- /dev/null +++ b/plugins/emotty/README.md @@ -0,0 +1,39 @@ +# emotty plugin + +This plugin returns an emoji for the current $TTY number so it can be used +in a prompt. + +To use it, add emotty to the plugins array in your zshrc file: +``` +plugins=(... emotty) +``` + +**NOTE:** it requires the [emoji plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/emoji). + +## Usage + +The function `emotty` displays an emoji from the current character set (default: `emoji`), based +on the number associated to the `$TTY`. + +There are different sets of emoji characters available, to choose a different +set, set `$emotty_set` to the name of the set you would like to use, e.g.: +``` +emotty_set=nature +``` + +### Character Sets + +- emoji +- loral +- love +- nature +- stellar +- zodiac + +Use the `display_emotty` function to list the emojis in the current character set, or +the character set passed as the first argument. For example: + +``` +$ display_emotty zodiac +<list of all the emojis in the zodiac character set> +``` diff --git a/plugins/fbterm/README.md b/plugins/fbterm/README.md new file mode 100644 index 000000000..eec33d7ee --- /dev/null +++ b/plugins/fbterm/README.md @@ -0,0 +1,9 @@ +# fbterm + +This plugin automatically starts [fbterm](https://github.com/zhangyuanwei/fbterm) +if on a real TTY (`/dev/tty*`). + +To use it, add fbterm to the plugins array of your zshrc file: +``` +plugins=(... fbterm) +``` diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh index 27e2d9246..646148297 100644 --- a/plugins/fzf/fzf.plugin.zsh +++ b/plugins/fzf/fzf.plugin.zsh @@ -1,57 +1,95 @@ -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 +function setup_using_base_dir() { + # Declare all variables local not no mess with outside env in any way + local fzf_base + local fzf_shell + local fzfdirs + local dir + + 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 [[ -d "${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 binary path + 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 + return 1 + fi +} + + +function setup_using_debian_package() { + dpkg -s fzf &> /dev/null + if (( $? )); then + # Either not a debian based distro, or no fzf installed. In any case skip ahead + return 1 + fi + + # NOTE: There is no need to configure PATH for debian package, all binaries + # are installed to /usr/bin by default + + local completions="/usr/share/zsh/vendor-completions/_fzf" + local key_bindings="/usr/share/doc/fzf/examples/key-bindings.zsh" + + # Auto-completion + if [[ $- == *i* ]] && [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then + source $completions 2> /dev/null + fi + + # Key bindings + if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then + source $key_bindings + fi + + return 0 +} + +function indicate_error() { + 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 +} + +# Check for debian package first, because it easy to short cut +# Indicate to user that fzf installation not found if nothing worked +setup_using_debian_package || setup_using_base_dir || indicate_error + +unset -f setup_using_debian_package setup_using_base_dir indicate_error diff --git a/plugins/git-escape-magic/README.md b/plugins/git-escape-magic/README.md index c3e3898f5..7fefed39d 100644 --- a/plugins/git-escape-magic/README.md +++ b/plugins/git-escape-magic/README.md @@ -4,13 +4,13 @@ This plugin is copied from the original at https://github.com/knu/zsh-git-escape-magic. All credit for the functionality enabled by this plugin should go to @knu. -An excerpt from that project's readme explains it's purpose. +An excerpt from that project's readme explains its purpose. > It eliminates the need for manually escaping those meta-characters. The zle function it provides is context aware and recognizes the characteristics of each subcommand of git. Every time you type one of these meta-characters on a git command line, it automatically escapes the meta-character with a backslash as necessary and as appropriate. ## Usage -To use this plugin add it to your list of plugins in your `.zshrc` file. +To use this plugin, add it to your list of plugins in your `.zshrc` file. -**NOTE**: If you use url-quote-magic it must be included before this +**NOTE**: If you use url-quote-magic, it must be included before this plugin runs to prevent any conflicts. diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh index 8d578e27b..6be583179 100644 --- a/plugins/gradle/gradle.plugin.zsh +++ b/plugins/gradle/gradle.plugin.zsh @@ -181,3 +181,4 @@ _gradlew_tasks () { ############################################################################ compdef _gradle_tasks gradle compdef _gradlew_tasks gradlew +compdef _gradlew_tasks gw diff --git a/plugins/jruby/README.md b/plugins/jruby/README.md new file mode 100644 index 000000000..821a46d5e --- /dev/null +++ b/plugins/jruby/README.md @@ -0,0 +1,21 @@ +# JRuby plugin + +This plugin adds aliases for [JRuby](https://www.jruby.org/). + +To use it, add `jruby` to the plugins array in your zshrc file: + +```zsh +plugins=(... jruby) +``` + +## Requirements + +This plugin assumes you already have jruby installed and available in your [path](https://www.jruby.org/getting-started). + +## Aliases + +| Alias | Command | +| ------------ | ---------------------------------------------------------------- | +| `jrspec` | `jruby --debug -S rspec --debug` | +| `jprofile` | `jruby --profile.api -S rspec` | +| `jexec` | `jruby -S` | diff --git a/plugins/lein/README.md b/plugins/lein/README.md new file mode 100644 index 000000000..0c4119663 --- /dev/null +++ b/plugins/lein/README.md @@ -0,0 +1,9 @@ +# Leiningen plugin + +This plugin adds completions for the [Leiningen](https://leiningen.org/) Clojure build tool. + +To use it, add `lein` to the plugins array in your zshrc file: + +```zsh +plugins=(... lein) +``` diff --git a/plugins/mysql-macports/README.md b/plugins/mysql-macports/README.md new file mode 100644 index 000000000..a4224d9c0 --- /dev/null +++ b/plugins/mysql-macports/README.md @@ -0,0 +1,20 @@ +# MySQL-Macports plugin + +This plugin adds aliases for some of the commonly used [MySQL](https://www.mysql.com/) commands when installed using [MacPorts](https://www.macports.org/) on macOS. + +To use it, add `mysql-macports` to the plugins array in your zshrc file: + +```zsh +plugins=(... mysql-macports) +``` + +For instructions on how to install MySQL using MacPorts, read the [MacPorts wiki](https://trac.macports.org/wiki/howto/MySQL/). + +## Aliases + +| Alias | Command | Description | +| ------------ | --------------------------------------------------------- | ------------------------------------------ | +| mysqlstart | `sudo /opt/local/share/mysql5/mysql/mysql.server start` | Start the MySQL server. | +| mysqlstop | `sudo /opt/local/share/mysql5/mysql/mysql.server stop` | Stop the MySQL server. | +| mysqlrestart | `sudo /opt/local/share/mysql5/mysql/mysql.server restart` | Restart the MySQL server. | +| mysqlstatus | `mysqladmin5 -u root -p ping` | Check whether the MySQL server is running. | diff --git a/plugins/n98-magerun/README.md b/plugins/n98-magerun/README.md new file mode 100644 index 000000000..b0abe4747 --- /dev/null +++ b/plugins/n98-magerun/README.md @@ -0,0 +1,21 @@ +# n98-magerun plugin + +The swiss army knife for Magento developers, sysadmins and devops. The tool provides a huge set of well tested command line commands which save hours of work time. + +The [n98-magerun plugin](https://github.com/netz98/n98-magerun) provides many +[useful aliases](#aliases) as well as completion for the `n98-magerun` command. + +Enable it by adding `n98-magerun` to the plugins array in your zshrc file: + +```zsh +plugins=(... n98-magerun) +``` + +## Aliases + +| Alias | Command | Description | +| --------- | -------------------------------------------------- | --------------------------------------------------------------------------------- | +| n98 | `n98-magerun.phar` | The N98-Magerun phar-file (Version 1) | +| n98-2 | `n98-magerun2.phar` | The N98-Magerun phar-file (Version 2) | +| mage-get | `wget https://files.magerun.net/n98-magerun.phar` | Download the latest stable N98-Magerun phar-file from the file-server (Version 1) | +| mage2-get | `wget https://files.magerun.net/n98-magerun2.phar` | Download the latest stable N98-Magerun phar-file from the file-server (Version 2) | diff --git a/plugins/oc/README.md b/plugins/oc/README.md new file mode 100644 index 000000000..deae9b2d0 --- /dev/null +++ b/plugins/oc/README.md @@ -0,0 +1,13 @@ +# OC - OpenShift CLI + +This plugin provides autocompletion for [OC](https://docs.openshift.com/container-platform/3.7/cli_reference/index.html) commands, building, managing and updating operations. + +To use it, add `oc` to the plugins array of your zshrc file: + +```bash +plugins=(... oc) +``` + +## Contributors + ++ [kevinkirkup](https://github.com/kevinkirkup) - Plugin Author diff --git a/plugins/perl/README.md b/plugins/perl/README.md new file mode 100644 index 000000000..dd9b7dc75 --- /dev/null +++ b/plugins/perl/README.md @@ -0,0 +1,37 @@ +# Perl + +This plugin adds [perl](https://www.perl.org/) useful aliases/functions. + +To use it, add `perl` to the plugins array in your zshrc file: + +```zsh +plugins=(... perl) +``` + +## Aliases + +| Aliases | Command | Description | +| :------------ | :----------------- | :------------------------------------- | +| pbi | `perlbrew install` | Install specific perl version | +| pbl | `perlbrew list` | List all perl version installed | +| pbo | `perlbrew off` | Go back to the system perl | +| pbs | `perlbrew switch` | Turn it back on | +| pbu | `perlbrew use` | Use specific version of perl | +| pd | `perldoc` | Show the perl documentation | +| ple | `perl -wlne` | Use perl like awk/sed | +| latest-perl | `curl ...` | Show the latest stable release of Perl | + +## Functions + +* `newpl`: creates a basic Perl script file and opens it with $EDITOR. + +* `pgs`: Perl Global Substitution: `pgs <find_pattern> <replace_pattern> <filename>` + Looks for `<find_pattern>` and replaces it with `<replace_pattern>` in `<filename>`. + +* `prep`: Perl grep, because 'grep -P' is terrible: `prep <pattern> [<filename>]` + Lets you work with pipes or files (if no `<filename>` provided, use stdin). + +## Requirements + +In order to make this work, you will need to have perl installed. +More info on the usage and install: https://www.perl.org/get.html diff --git a/plugins/pip/README.md b/plugins/pip/README.md new file mode 100644 index 000000000..f07b5c058 --- /dev/null +++ b/plugins/pip/README.md @@ -0,0 +1,19 @@ +# pip plugin + +This plugin adds completion for [pip](https://pip.pypa.io/en/latest/), +the Python package manager. + +To use it, add `pip` to the plugins array in your zshrc file: + +```zsh +plugins=(... pip) +``` + +## pip cache + +The pip plugin caches the names of available pip packages from the PyPI index. +To trigger the caching process, try to complete `pip install`, +or you can run `zsh-pip-cache-packages` directly. + +To reset the cache, run `zsh-pip-clear-cache` and it will be rebuilt next +the next time you autocomplete `pip install`. diff --git a/plugins/pow/README.md b/plugins/pow/README.md new file mode 100644 index 000000000..1f8a9d136 --- /dev/null +++ b/plugins/pow/README.md @@ -0,0 +1,21 @@ +# pow plugin + +This plugin adds completion and commands for [pow](http://pow.cx/), a +zero-configuration Rack server for macOS. + +To use it, add pow to the plugins array of your zshrc file: + +```sh +plugins=(... pow) +``` + +## Commands + +- `kapow` will restart an app. + + ```bash + kapow myapp + ``` + +- `kaput` will show the standard output from any pow app. +- `repow` will restart the pow process. diff --git a/plugins/powify/README.md b/plugins/powify/README.md new file mode 100644 index 000000000..fd58b860e --- /dev/null +++ b/plugins/powify/README.md @@ -0,0 +1,10 @@ +# powify plugin + +This plugin adds autocompletion for [powify](https://github.com/sethvargo/powify), +an easy-to-use wrapper for Basecamp's [pow](https://github.com/basecamp/pow). + +To use it, add powify to the plugins array of your zshrc file: + +```sh +plugins=(... powify) +``` diff --git a/plugins/pyenv/README.md b/plugins/pyenv/README.md new file mode 100644 index 000000000..d063b55b9 --- /dev/null +++ b/plugins/pyenv/README.md @@ -0,0 +1,16 @@ +# pyenv + +This plugin looks for [pyenv](https://github.com/pyenv/pyenv), a Simple Python version +management system, and loads it if it's found. It also loads pyenv-virtualenv, a pyenv +plugin to manage virtualenv, if it's found. + +To use it, add `pyenv` to the plugins array in your zshrc file: + +```zsh +plugins=(... pyenv) +``` + +## Functions + +- `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python + version, if pyenv wasn't found. diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh index f754ea261..950b0e01a 100644 --- a/plugins/python/python.plugin.zsh +++ b/plugins/python/python.plugin.zsh @@ -11,5 +11,5 @@ function pyclean() { } # Grep among .py files -alias pygrep='grep --include="*.py"' +alias pygrep='grep -r --include="*.py"' diff --git a/plugins/react-native/README.md b/plugins/react-native/README.md index dc0207184..d0a53b8d7 100644 --- a/plugins/react-native/README.md +++ b/plugins/react-native/README.md @@ -39,6 +39,9 @@ plugins=(... react-native) | **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ʀ"` | +| **rnios11** | `react-native run-ios --simulator "iPhone 11"` | +| **rnios11p** | `react-native run-ios --simulator "iPhone 11 Pro"` | +| **rnios11pm** | `react-native run-ios --simulator "iPhone 11 Pro Max"` | | _iPad_ | | | **rnipad2** | `react-native run-ios --simulator "iPad 2"` | | **rnipad5** | `react-native run-ios --simulator "iPad (5th generation)"` | diff --git a/plugins/react-native/react-native.plugin.zsh b/plugins/react-native/react-native.plugin.zsh index f7695d15f..b33dedfed 100644 --- a/plugins/react-native/react-native.plugin.zsh +++ b/plugins/react-native/react-native.plugin.zsh @@ -24,6 +24,10 @@ 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 rnios11='react-native run-ios --simulator "iPhone 11"' +alias rnios11p='react-native run-ios --simulator "iPhone 11 Pro"' +alias rnios11pm='react-native run-ios --simulator "iPhone 11 Pro Max"' + # iPad alias rnipad2='react-native run-ios --simulator "iPad 2"' diff --git a/plugins/rebar/README.md b/plugins/rebar/README.md new file mode 100644 index 000000000..456ba45c7 --- /dev/null +++ b/plugins/rebar/README.md @@ -0,0 +1,9 @@ +# rebar plugin + +This plugin adds completions for the [rebar](https://www.rebar3.org/) Erlang build tool. + +To use it, add `rebar` to the plugins array in your zshrc file: + +```zsh +plugins=(... rebar) +``` diff --git a/plugins/redis-cli/README.md b/plugins/redis-cli/README.md new file mode 100644 index 000000000..bb6e94a0f --- /dev/null +++ b/plugins/redis-cli/README.md @@ -0,0 +1,15 @@ +# Redis-CLI + +This plugin adds [redis-cli](https://redis.io/topics/rediscli) completion, based off of Homebrew completion. + +To use it, add `redis-cli` to the plugins array in your zshrc file: + +```zsh +plugins=(... redis-cli) +``` + +## Requirements + +In order to make this work, you will need to have redis installed. + +More info on the usage and install: https://redis.io/topics/quickstart diff --git a/plugins/rvm/README.md b/plugins/rvm/README.md new file mode 100644 index 000000000..9d6fd8f85 --- /dev/null +++ b/plugins/rvm/README.md @@ -0,0 +1,19 @@ +# Ruby Version Manager plugin + +This plugin adds some utility functions and completions for [Ruby Version Manager](https://rvm.io/). + +To use it, add `rvm` to the plugins array in your zshrc file: + +```zsh +plugins=(... rvm) +``` + +## Functions +| Alias | Command | +|----------------|----------------------| +| `rb18` | `rvm use ruby-1.8.7` | +| `rb19` | `rvm use ruby-1.9.3` | +| `rb20` | `rvm use ruby-2.0.0` | +| `rb21` | `rvm use ruby-2.1.2` | +| `rvm-update` | `rvm get head` | +| `gems` | `gem list` | diff --git a/plugins/singlechar/README.md b/plugins/singlechar/README.md new file mode 100644 index 000000000..d89029900 --- /dev/null +++ b/plugins/singlechar/README.md @@ -0,0 +1,118 @@ +# Singlechar plugin + +This plugin adds single char shortcuts (and combinations) for some commands. + +To use it, add `singlechar` to the plugins array of your zshrc file: +``` +plugins=(... singlechar) +``` + +## Aliases + +### CAT, GREP, CURL, WGET + +| Alias | Command | Description | +|-------|------------------|-------------| +| y | `grep -Ri` | Find case-insensitive string in all files and directories, recursively. Follows symlinks. | +| n | `grep -Rvi` | Same as above but only show lines that don't match the string. | +| f | `grep -Rli` | Same as 'y' but only print the filenames where the string is found. | +| fn | `grep -Rlvi` | Same as above but only show files that don't contain the string. | +| f. | `find . \| grep` | Grep list of files in current directory | +| f: | `find` | 'find' command | +| p | `less` | 'less' command | +| m | `man` | 'man' command | +| d | `wget` | 'wget' command | +| u | `curl` | 'curl' command | +| c | `cat` | 'cat' command | +| w | `echo >` | Write arguments to file, overwriting it if it exists. | +| a | `echo >>` | Write arguments to file, appending them if the file exists. | +| w: | `cat >` | Write stdin to file, overwriting if it exists. | +| a: | `cat >>` | Write stdin to file, appending it if the file exists. | + +### XARGS + +These aliases are versions of the aliases above but using xargs. This can be used +by piping the arguments to the xargs aliases. + +| Alias | Command | Description | +|-------|----------------------|---------------------------------| +| x | `xargs` | 'xargs' command | +| xy | `xargs grep -Ri` | Same as 'y' alias using xargs. | +| xn | `xargs grep -Rvi` | Same as 'n' alias using xargs. | +| xf | `xargs grep -Rli` | Same as 'f' alias using xargs. | +| xfn | `xargs grep -Rlvi` | Same as 'fn' alias using xargs. | +| xf. | `xargs find \| grep` | Same as 'f.' alias using xargs. | +| xf: | `xargs find` | Same as 'f:' alias using xargs. | +| xc | `xargs cat` | Same as 'c' alias using xargs. | +| xp | `xargs less` | Same as 'p' alias using xargs. | +| xm | `xargs man` | Same as 'm' alias using xargs. | +| xd | `xargs wget` | Same as 'd' alias using xargs. | +| xu | `xargs curl` | Same as 'u' alias using xargs. | +| xw | `xargs echo >` | Same as 'w' alias using xargs. | +| xa | `xargs echo >>` | Same as 'a' alias using xargs. | +| xw: | `xargs cat >` | Same as 'w:' alias using xargs. | +| xa: | `xargs >>` | Same as 'a:' alias using xargs. | + +### SUDO + +These aliases are versions of the aliases above in [CAT, GREP, CURL, WGET](#cat-grep-curl-wget) +but using sudo to run them with root permission. + +| Alias | Command | Description | +|-------|-----------------------|--------------------------------| +| s | `sudo` | 'sudo' command | +| sy | `sudo grep -Ri` | Same as 'y' alias using sudo. | +| sn | `sudo grep -Riv` | Same as 'n' alias using sudo. | +| sf | `sudo grep -Rli` | Same as 'f' alias using sudo. | +| sfn | `sudo grep -Rlvi` | Same as 'fn' alias using sudo. | +| sf. | `sudo find . \| grep` | Same as 'f.' alias using sudo. | +| sf: | `sudo find` | Same as 'f:' alias using sudo. | +| sp | `sudo less` | Same as 'p' alias using sudo. | +| sm | `sudo man` | Same as 'm' alias using sudo. | +| sd | `sudo wget` | Same as 'd' alias using sudo. | +| sc | `sudo cat` | Same as 'c' alias using sudo. | +| sw | `sudo echo >` | Same as 'w' alias using sudo. | +| sa | `sudo echo >>` | Same as 'a' alias using sudo. | +| sw: | `sudo cat >` | Same as 'w:' alias using sudo. | +| sa: | `sudo cat >>` | Same as 'a:' alias using sudo. | + +### SUDO-XARGS + +Same as above but using both sudo and xargs. + +| Alias | Command | Description | +|-------|---------------------------|---------------------------------| +| sx | `sudo xargs` | 'sudo xargs' command | +| sxy | `sudo xargs grep -Ri` | Same as 'xy' alias using sudo. | +| sxn | `sudo xargs grep -Riv` | Same as 'xn' alias using sudo. | +| sxf | `sudo xargs grep -li` | Same as 'xf' alias using sudo. | +| sxfn | `sudo xargs grep -lvi` | Same as 'xfn' alias using sudo. | +| sxf. | `sudo xargs find \| grep` | Same as 'xf.' alias using sudo. | +| sxf: | `sudo xargs find` | Same as 'xf:' alias using sudo. | +| sxp | `sudo xargs less` | Same as 'xp' alias using sudo. | +| sxm | `sudo xargs man` | Same as 'xm' alias using sudo. | +| sxd | `sudo xargs wget` | Same as 'xd' alias using sudo. | +| sxu | `sudo xargs curl` | Same as 'xu' alias using sudo. | +| sxc | `sudo xargs cat` | Same as 'xc' alias using sudo. | +| sxw | `sudo xargs echo >` | Same as 'xw' alias using sudo. | +| sxa | `sudo xargs echo >>` | Same as 'xa' alias using sudo. | +| sxw: | `sudo xargs cat >` | Same as 'xw:' alias using sudo. | +| sxa: | `sudo xargs cat >>` | Same as 'xa:' alias using sudo. | + +## Options + +The commands `grep`, `sudo`, `wget`, `curl`, and `less` can be configured to use other commands +via the setup variables below, before Oh My Zsh is sourced. If they are not set yet, they will +use their default values: + +| Setup variable | Default value | +|----------------|---------------| +| GREP | `grep` | +| ROOT | `sudo` | +| WGET | `wget` | +| CURL | `curl` | +| PAGER | `less` | + +## Author + +- [Karolin Varner](https://github.com/koraa) diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh index 44bd998aa..d4b0b6735 100644 --- a/plugins/singlechar/singlechar.plugin.zsh +++ b/plugins/singlechar/singlechar.plugin.zsh @@ -1,13 +1,3 @@ -################################################################################ -# FILE: singlechar.plugin.zsh -# DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Michael Varner (musikmichael@web.de) -# VERSION: 1.0.0 -# -# This plugin adds single char shortcuts (and combinations) for some commands. -# -################################################################################ - ########################### # Settings @@ -130,4 +120,4 @@ alias sxd='"$ROOT" xargs "$WGET"' alias sxu='"$ROOT" xargs "$CURL"' alias sxw:='"$ROOT" xargs cat >' -alias sxa:='"$ROOT" xargs cat >>'
\ No newline at end of file +alias sxa:='"$ROOT" xargs cat >>' diff --git a/plugins/sprunge/README.md b/plugins/sprunge/README.md new file mode 100644 index 000000000..2a363d3bd --- /dev/null +++ b/plugins/sprunge/README.md @@ -0,0 +1,31 @@ +# Sprunge plugin + +This plugin uploads data and fetch URL from the pastebin http://sprunge.us + +To enable it, add 'sprunge' to your plugins: +``` +plugins=(... sprunge) +``` + +## Usage + +| Command | Description | +|------------------------------|-------------------------------------------| +| `sprunge filename.txt` | Uploads filename.txt | +| `sprunge "this is a string"` | Uploads plain text | +| `sprunge < filename.txt` | Redirects filename.txt content to sprunge | +| `echo data \| sprunge` | Any piped data will be uploaded | + +Once sprunge has processed the input it will give you a unique HTTP address: +``` +$ sprunge "hello" +http://sprunge.us/XxjnKz +``` + +## Notes + +- Sprunge accepts piped data, stdin redirection, text strings as input or filenames. + Only one of these can be used at a time. +- Argument precedence goes as follows: stdin > piped input > text strings. +- If a filename is mispelled or doesn't have the necessary path description, it will NOT + generate an error, but instead treat it as a text string. diff --git a/plugins/sprunge/sprunge.plugin.zsh b/plugins/sprunge/sprunge.plugin.zsh index e1c89b729..5d5687a82 100644 --- a/plugins/sprunge/sprunge.plugin.zsh +++ b/plugins/sprunge/sprunge.plugin.zsh @@ -2,12 +2,9 @@ # Created by the blogger at the URL below...I don't know where to find his/her name # Original found at https://www.shellperson.net/sprunge-pastebin-script/ -usage() { -description | fmt -s >&2 -} - -description() { -cat << HERE +sprunge() { + if [[ "$1" = --help ]]; then + fmt -s >&2 << EOF DESCRIPTION Upload data and fetch URL from the pastebin http://sprunge.us @@ -19,44 +16,41 @@ USAGE 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 -} - -sprunge() { - if [ -t 0 ]; then - echo Running interactively, checking for arguments... >&2 - if [ "$*" ]; then - echo Arguments present... >&2 - if [ -f "$*" ]; then - echo Uploading the contents of "$*"... >&2 - cat "$*" - else - echo Uploading the text: \""$*"\"... >&2 - echo "$*" - fi | curl -F 'sprunge=<-' http://sprunge.us - else - echo No arguments found, printing USAGE and exiting. >&2 - usage - fi - else - echo Using input from a pipe or STDIN redirection... >&2 - curl -F 'sprunge=<-' http://sprunge.us - fi + 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 arguments. For 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. + +EOF + return + fi + + if [ -t 0 ]; then + echo Running interactively, checking for arguments... >&2 + if [ "$*" ]; then + echo Arguments present... >&2 + if [ -f "$*" ]; then + echo Uploading the contents of "$*"... >&2 + cat "$*" + else + echo Uploading the text: \""$*"\"... >&2 + echo "$*" + fi | curl -F 'sprunge=<-' http://sprunge.us + else + echo No arguments found, printing USAGE and exiting. >&2 + sprunge --help + return 1 + fi + else + echo Using input from a pipe or STDIN redirection... >&2 + curl -F 'sprunge=<-' http://sprunge.us + fi } diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh index 69604ab4f..dd5063360 100644 --- a/plugins/sublime/sublime.plugin.zsh +++ b/plugins/sublime/sublime.plugin.zsh @@ -17,8 +17,8 @@ alias stn=create_project if [[ "$OSTYPE" == linux* ]]; then if [[ "$(uname -r)" = *icrosoft* ]]; then _sublime_paths=( - "$(wslpath -u 'C:\Program Files\Sublime Text 3\subl.exe')" - "$(wslpath -u 'C:\Program Files\Sublime Text 2\subl.exe')" + "$(wslpath -u 'C:\Program Files\Sublime Text 3\subl.exe' 2>/dev/null)" + "$(wslpath -u 'C:\Program Files\Sublime Text 2\subl.exe' 2>/dev/null)" ) else _sublime_paths=( diff --git a/plugins/terminalapp/terminalapp.plugin.zsh b/plugins/terminalapp/terminalapp.plugin.zsh deleted file mode 100644 index 7c0c278b9..000000000 --- a/plugins/terminalapp/terminalapp.plugin.zsh +++ /dev/null @@ -1,6 +0,0 @@ -# This file is intentionally empty. -# -# The terminalapp plugin is deprecated and may be removed in a future release. -# Its functionality has been folded in to the core lib/termsupport.zsh, which -# is loaded for all users. You can remove terminalapp from your $plugins list -# once all your systems are updated to the current version of Oh My Zsh. diff --git a/plugins/terminitor/README.md b/plugins/terminitor/README.md new file mode 100644 index 000000000..8c0e02113 --- /dev/null +++ b/plugins/terminitor/README.md @@ -0,0 +1,9 @@ +# Terminitor plugin + +This plugin adds completions for the [Terminitor](https://github.com/achiurizo/terminitor) development workflow setup tool. + +To use it, add `terminitor` to the plugins array in your zshrc file: + +```zsh +plugins=(... terminitor) +``` diff --git a/plugins/thor/README.md b/plugins/thor/README.md new file mode 100644 index 000000000..09c705d9a --- /dev/null +++ b/plugins/thor/README.md @@ -0,0 +1,10 @@ +# Thor plugin + +This plugin adds completion for [Thor](http://whatisthor.com/), +a ruby toolkit for building powerful command-line interfaces. + +To use it, add `thor` to the plugins array in your zshrc file: + +```zsh +plugins=(... thor) +``` diff --git a/plugins/tugboat/README.md b/plugins/tugboat/README.md new file mode 100644 index 000000000..14f828f85 --- /dev/null +++ b/plugins/tugboat/README.md @@ -0,0 +1,12 @@ +# Tugboat plugin + +This plugin adds autocompletion for Tugboat, a command line tool for interacting with your +[DigitalOcean droplets](https://www.digitalocean.com/products/droplets/). + +To use it, add it to the plugins array in your `~/.zshrc` file: + +```zsh +plugins=(... tugboat) +``` + +Further documentation for Tugboat can be found in the [Tugboat repository](https://github.com/petems/tugboat). diff --git a/plugins/ufw/README.md b/plugins/ufw/README.md new file mode 100644 index 000000000..ac377cd17 --- /dev/null +++ b/plugins/ufw/README.md @@ -0,0 +1,18 @@ +# UFW plugin + +This plugin adds completion for managing everybody's favorite Uncomplicated Firewall (UFW), +a simple interface for managing iptables. Learn more about [`UFW`](https://wiki.ubuntu.com/UncomplicatedFirewall). + +To use it, add ufw to the plugins array of your zshrc file: +``` +plugins=(... ufw) +``` + +Some of the commands include: + +* `allow <port>/<optional: protocol>` add an allow rule +* `default` set default policy +* `delete <port>/<optional: protocol>` delete RULE +* `deny <port>/<optional: protocol>` add deny rule +* `disable` disables the firewall +* `enable` enables the firewall diff --git a/plugins/virtualenvwrapper/README.md b/plugins/virtualenvwrapper/README.md new file mode 100644 index 000000000..63eb58541 --- /dev/null +++ b/plugins/virtualenvwrapper/README.md @@ -0,0 +1,38 @@ +# Virtualenvwrapper plugin + +This plugin loads Python's [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/) shell tools. + +To use it, add `virtualenvwrapper` to the plugins array in your zshrc file: + +```zsh +plugins=(... virtualenvwrapper) +``` + +## Usage + +The plugin allows to automatically activate virtualenvs on cd into git repositories with a matching name: + +``` +➜ github $ cd ansible +(ansible) ➜ ansible git:(devel) $ cd docs +(ansible) ➜ docs git:(devel) $ cd .. +(ansible) ➜ ansible git:(devel) $ cd .. +➜ github $ +``` + +We can override this by having a `.venv` file in the directory containing a differently named virtualenv: + +``` +➜ github $ cat ansible/.venv +myvirtualenv +➜ github $ cd ansible +(myvirtualenv) ➜ ansible git:(devel) $ cd .. +➜ github $ +``` + +We can disable this behaviour by setting `DISABLE_VENV_CD=1` before Oh My Zsh is sourced: +```zsh +DISABLE_VENV_CD=1 +plugins=(... virtualenvwrapper) +source $ZSH/oh-my-zsh.sh +``` diff --git a/plugins/yarn/README.md b/plugins/yarn/README.md index 671a272d9..e6daae44f 100644 --- a/plugins/yarn/README.md +++ b/plugins/yarn/README.md @@ -19,6 +19,7 @@ plugins=(... yarn) | 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 | +| yd | `yarn dev` | Run the dev script defined in `package.json` | | 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 | @@ -34,6 +35,10 @@ plugins=(... yarn) | 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` | +| ytc | `yarn test --coverage` | Run the test script defined in `package.json` with coverage | | 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 | +| yv | `yarn version` | Update the version of your package | +| yw | `yarn workspace` | Run a command within a single workspace. | +| yws | `yarn workspaces` | Run a command within all defined workspaces. | diff --git a/plugins/yarn/_yarn b/plugins/yarn/_yarn index 382f58a0a..3689ae960 100644 --- a/plugins/yarn/_yarn +++ b/plugins/yarn/_yarn @@ -71,7 +71,7 @@ _global_commands=( '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' + 'upgrade-interactive:Interactively upgrade packages' ) _yarn_commands_scripts() { @@ -81,9 +81,21 @@ _yarn_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 + local -a commands binaries scripts + local -a scriptNames scriptCommands + local i runJSON + + runJSON=$(yarn run --json 2>/dev/null) + binaries=($(sed -E '/Commands available/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\n/g' <<< "$runJSON")) + scriptNames=($(sed -E '/possibleCommands/!d;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\n/g' <<< "$runJSON")) + scriptCommands=("${(@f)$(sed -E '/possibleCommands/!d;s/.*"hints":\{([^}]+)\}.*/\1/;s/"[^"]+"://g;s/:/\\:/g;s/","/\n/g;s/(^"|"$)//g' <<< "$runJSON")}") + + for (( i=1; i <= $#scriptNames; i++ )); do + scripts+=("${scriptNames[$i]}:${scriptCommands[$i]}") + done + + commands=($scripts $binaries) + _describe 'command' commands } _yarn_global_commands() { @@ -240,7 +252,8 @@ _yarn() { run) _arguments \ - '1: :_yarn_scripts' + '1: :_yarn_scripts' \ + '*:: :_default' ;; tag) @@ -255,6 +268,11 @@ _yarn() { '*:: :->team_args' ;; + upgrade-interactive) + _arguments \ + '--latest:use the version tagged latest in the registry:' + ;; + version) _arguments \ '--new-version:version:' \ @@ -266,6 +284,10 @@ _yarn() { _arguments \ '1:query:_files' ;; + + *) + _default + ;; esac ;; esac diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh index 9ed8322cd..18c5dcc89 100644 --- a/plugins/yarn/yarn.plugin.zsh +++ b/plugins/yarn/yarn.plugin.zsh @@ -4,6 +4,7 @@ alias yad="yarn add --dev" alias yap="yarn add --peer" alias yb="yarn build" alias ycc="yarn cache clean" +alias yd="yarn dev" alias yga="yarn global add" alias ygls="yarn global list" alias ygrm="yarn global remove" @@ -19,6 +20,10 @@ alias yrun="yarn run" alias ys="yarn serve" alias yst="yarn start" alias yt="yarn test" +alias ytc="yarn test --coverage" alias yuc="yarn global upgrade && yarn cache clean" alias yui="yarn upgrade-interactive" alias yup="yarn upgrade" +alias yv="yarn version" +alias yw="yarn workspace" +alias yws="yarn workspaces" diff --git a/plugins/yii/README.md b/plugins/yii/README.md new file mode 100644 index 000000000..f1b72e916 --- /dev/null +++ b/plugins/yii/README.md @@ -0,0 +1,14 @@ +# Yii plugin + +The plugin adds autocomplete commands and subcommands for [yii](https://www.yiiframework.com/). + +To use it, add `yii` to the plugins array of your zshrc file: +``` +plugins=(... yii) +``` + +## Aliases + +| Alias | Command | +|--------|----------------------| +| yiic | `protected/yiic` | |