diff options
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | plugins/autoenv/README.md | 14 | ||||
-rw-r--r-- | plugins/fzf/fzf.plugin.zsh | 152 | ||||
-rw-r--r-- | plugins/jruby/README.md | 21 | ||||
-rw-r--r-- | plugins/lein/README.md | 9 | ||||
-rw-r--r-- | plugins/oc/README.md | 13 | ||||
-rw-r--r-- | plugins/pip/README.md | 19 | ||||
-rw-r--r-- | plugins/react-native/README.md | 3 | ||||
-rw-r--r-- | plugins/react-native/react-native.plugin.zsh | 4 | ||||
-rw-r--r-- | plugins/sublime/sublime.plugin.zsh | 4 | ||||
-rw-r--r-- | plugins/thor/README.md | 10 | ||||
-rw-r--r-- | plugins/yarn/README.md | 3 | ||||
-rw-r--r-- | plugins/yarn/yarn.plugin.zsh | 3 |
13 files changed, 198 insertions, 63 deletions
@@ -18,10 +18,8 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh) and follow [@ohmyzsh](https:// ### Prerequisites -__Disclaimer:__ _Oh My Zsh works best on macOS and Linux._ - -* Unix-like operating system (macOS or Linux) -* [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) +* A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL is preferred, but cygwin or msys also mostly work. +* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (run `zsh --version` to confirm), check the following instructions here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH) * `curl` or `wget` should be installed * `git` should be installed 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/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/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/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/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/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/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/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/yarn/README.md b/plugins/yarn/README.md index 671a272d9..439a9355f 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 | @@ -37,3 +38,5 @@ plugins=(... yarn) | 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 | +| 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.plugin.zsh b/plugins/yarn/yarn.plugin.zsh index 9ed8322cd..6dc4786de 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" @@ -22,3 +23,5 @@ alias yt="yarn test" alias yuc="yarn global upgrade && yarn cache clean" alias yui="yarn upgrade-interactive" alias yup="yarn upgrade" +alias yw="yarn workspace" +alias yws="yarn workspaces" |