Unverified Commit 18ee5dff authored by Marc Cornellà's avatar Marc Cornellà Committed by GitHub
Browse files

Merge branch 'master' into clipboard

parents d81cd753 368198b7
# profiles plugin
This plugin allows you to create separate configuration files for zsh based
on your long hostname (including the domain).
To use it, add profiles to the plugins array of your zshrc file:
```sh
plugins=(... profiles)
```
It takes your `$HOST` variable and looks for files named according to the
domain parts in `$ZSH_CUSTOM/profiles/` directory.
For example, for `HOST=host.domain.com`, it will try to load the following files,
in this order:
```text
$ZSH_CUSTOM/profiles/com
$ZSH_CUSTOM/profiles/domain.com
$ZSH_CUSTOM/profiles/host.domain.com
```
This means that if there are conflicting settings on those files, the one to take
precedence will be the last applied, i.e. the one in host.domain.com.
# 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.
# 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]
# Load pyenv only if command not already available
command -v pyenv &> /dev/null && FOUND_PYENV=1 || FOUND_PYENV=0
if [[ $FOUND_PYENV -ne 1 ]]; then
pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv" "/usr/local/opt/pyenv")
......
......@@ -14,3 +14,4 @@ plugins=(... python)
| `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 |
| `ipython` | Runs the appropriate `ipython` version according to the activated virtualenv |
# Find python file
alias pyfind='find . -name "*.py"'
# Remove python compiled byte-code and mypy cache in either current directory or in a
# list of specified directories
# Remove python compiled byte-code and mypy/pytest cache in either the current
# directory or in a list of specified directories (including sub 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
find ${ZSH_PYCLEAN_PLACES} -depth -type d -name ".mypy_cache" -exec rm -r "{}" +
find ${ZSH_PYCLEAN_PLACES} -depth -type d -name ".pytest_cache" -exec rm -r "{}" +
}
# Grep among .py files
alias pygrep='grep --include="*.py"'
alias pygrep='grep -r --include="*.py"'
# Run proper IPython regarding current virtualenv (if any)
alias ipython="python -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'"
......@@ -18,7 +18,7 @@ plugins=(... rails)
| `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 |
| `rgen` | `rails generate` | Generate boilerplate code |
| `rgen`| `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 |
......@@ -44,7 +44,7 @@ plugins=(... rails)
| `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 |
| `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 |
......
......@@ -17,7 +17,7 @@ function _rake_command () {
bin/stubs/rake $@
elif [ -e "bin/rake" ]; then
bin/rake $@
elif type bundle &> /dev/null && [ -e "Gemfile" ]; then
elif type bundle &> /dev/null && ([ -e "Gemfile" ] || [ -e "gems.rb" ]); then
bundle exec rake $@
else
command rake $@
......
# Rake plugin
This plugin adds support for [rake](https://ruby.github.io/rake/), the Ruby
build tool or Ruby Make.
To use it, add `rake` to the plugins array in your zshrc file:
```zsh
plugins=(... rake)
```
## Aliases
The plugin aliases the rake command so you can pass arguments when invoking rake tasks
without having to escape the brackets, i.e., you can run
```
rake namespace:task['argument']
```
instead of having to do
```
rake namespace:task\['argument'\]
```
| Alias | Command | Description |
|--------|--------------------------------|-----------------------------------------------|
| rake | `noglob rake` | Allows unescaped square brackets |
| brake | `noglob bundle exec rake` | Same as above but call rake using bundler |
| srake | `noglob sudo rake` | Same as rake but using sudo |
| sbrake | `noglob sudo bundle exec rake` | Same as above but using both sudo and bundler |
## Jim Weirich
The plugin also aliases `rake` to [`jimweirich`](https://github.com/jimweirich), author of Rake
and big time contributor to the Ruby open source community. He passed away in 2014:
> Thank you Jim for everything you contributed to the Ruby and open source community
> over the years. We will miss you dearly. — [**@robbyrussell**](https://github.com/ohmyzsh/ohmyzsh/commit/598a9c6f990756386517d66b6bcf77e53791e905)
# rbenv plugin
The primary job of this plugin is to provide `rbenv_prompt_info` which can be added to your theme to include Ruby
version and gemset information into your prompt.
Some functionality of this plugin will not work unless you also have the rbenv plugin *gemset* installed.
https://github.com/jf/rbenv-gemset
To use it, add `rbenv` to the plugins array in your zshrc file:
```zsh
plugins=(... rbenv)
```
## Alias
| Alias | Command | Description |
|----------------|---------------------|----------------------------------|
| rubies | `rbenv versions` | List the installed Ruby versions |
| gemsets | `rbenv gemset list` | List the existing gemsets |
## Functions
* `current_ruby`: The version of Ruby currently being used.
* `current_gemset`: The name of the current gemset.
* `gems`: Lists installed gems with enhanced formatting and color.
* `rbenv_prompt_info`: For adding information to your prompt. Format: `<ruby version>@<current gemset>`.
# rbfu plugin
This plugin starts [rbfu](https://github.com/hmans/rbfu), a minimal Ruby version
manager, and adds some useful functions.
To use it, add `rbfu` to the plugins array in your zshrc file:
```zsh
plugins=(... rbfu)
```
**Note: `rbfu` is deprecated and should no longer be used.**
## Functions
- `rbfu-rubies`: lists all installed rubies available to rbfu.
- `rvm_prompt_info`: shows the Ruby version being used with rbfu.
......@@ -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)"` |
......
......@@ -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"'
......
# 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)
```
# 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
......@@ -16,3 +16,15 @@ compdef _repo ru='repo upload'
alias rst='repo status'
compdef _repo rst='repo status'
alias rsto='repo status -o'
compdef _repo rsto='repo status -o'
alias rfa='repo forall -c'
compdef _repo rfa='repo forall -c'
alias rfap='repo forall -p -c'
compdef _repo rfap='repo forall -p -c'
alias rinf='repo info'
compdef _repo rinf='repo info'
......@@ -8,6 +8,6 @@ To use it, add `ripgrep` to the plugins array in your zshrc file:
plugins=(... ripgrep)
```
Completion is taken from the ripgrep release [`0.10.0`](https://github.com/BurntSushi/ripgrep/releases/tag/0.10.0).
Completion is taken from the ripgrep release [`11.0.2`](https://github.com/BurntSushi/ripgrep/releases/tag/11.0.2).
Updated on September 27th, 2018.
Updated on August 16th, 2019.
......@@ -3,6 +3,12 @@
##
# zsh completion function for ripgrep
#
# Run ci/test_complete.sh after building to ensure that the options supported by
# this function stay in synch with the `rg` binary.
#
# For convenience, a completion reference guide is included at the bottom of
# this file.
#
# Originally based on code from the zsh-users project — see copyright notice
# below.
......@@ -37,6 +43,7 @@ _rg() {
+ '(exclusive)' # Misc. fully exclusive options
'(: * -)'{-h,--help}'[display help information]'
'(: * -)'{-V,--version}'[display version information]'
'(: * -)'--pcre2-version'[print the version of PCRE2 used by ripgrep, if available]'
+ '(buffered)' # buffering options
'--line-buffered[force line buffering]'
......@@ -79,7 +86,7 @@ _rg() {
+ '(file-name)' # File-name options
{-H,--with-filename}'[show file name for matches]'
"--no-filename[don't show file name for matches]"
{-I,--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]"
......@@ -97,6 +104,10 @@ _rg() {
'*'{-g+,--glob=}'[include/exclude files matching specified glob]:glob'
'*--iglob=[include/exclude files matching specified case-insensitive glob]:glob'
+ '(glob-case-insensitive)' # File-glob case sensitivity options
'--glob-case-insensitive[treat -g/--glob patterns case insensitively]'
$no'--no-glob-case-insensitive[treat -g/--glob patterns case sensitively]'
+ '(heading)' # Heading options
'(pretty-vimgrep)--heading[show matches grouped by file name]'
"(pretty-vimgrep)--no-heading[don't show matches grouped by file name]"
......@@ -105,9 +116,17 @@ _rg() {
'--hidden[search hidden files and directories]'
$no"--no-hidden[don't search hidden files and directories]"
+ '(hybrid)' # hybrid regex options
'--auto-hybrid-regex[dynamically use PCRE2 if necessary]'
$no"--no-auto-hybrid-regex[don't dynamically use PCRE2 if necessary]"
+ '(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]'
"(--no-ignore-global --no-ignore-parent --no-ignore-vcs --no-ignore-dot)--no-ignore[don't respect ignore files]"
$no'(--ignore-global --ignore-parent --ignore-vcs --ignore-dot)--ignore[respect ignore files]'
+ '(ignore-file-case-insensitive)' # Ignore-file case sensitivity options
'--ignore-file-case-insensitive[process ignore files case insensitively]'
$no'--no-ignore-file-case-insensitive[process ignore files case sensitively]'
+ '(ignore-global)' # Global ignore-file options
"--no-ignore-global[don't respect global ignore files]"
......@@ -121,6 +140,10 @@ _rg() {
"--no-ignore-vcs[don't respect version control ignore files]"
$no'--ignore-vcs[respect version control ignore files]'
+ '(ignore-dot)' # .ignore-file options
"--no-ignore-dot[don't respect .ignore files]"
$no'--ignore-dot[respect .ignore files]'
+ '(json)' # JSON options
'--json[output results in JSON Lines format]'
$no"--no-json[don't output results in JSON Lines format]"
......@@ -134,6 +157,10 @@ _rg() {
$no"--no-crlf[don't use CRLF as line terminator]"
'(text)--null-data[use NUL as line terminator]'
+ '(max-columns-preview)' # max column preview options
'--max-columns-preview[show preview for long lines (with -M)]'
$no"--no-max-columns-preview[don't show preview for long lines (with -M)]"
+ '(max-depth)' # Directory-depth options
'--max-depth=[specify max number of directories to descend]:number of directories'
'!--maxdepth=:number of directories'
......@@ -213,6 +240,8 @@ _rg() {
+ '(text)' # Binary-search options
{-a,--text}'[search binary files as if they were text]'
"--binary[search binary files, don't print binary data]"
$no"--no-binary[don't search binary files]"
$no"(--null-data)--no-text[don't search binary files as if they were text]"
+ '(threads)' # Thread-count options
......@@ -364,7 +393,7 @@ _rg_encodings() {
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
x-user-defined auto none
)
_wanted encodings expl encoding compadd -a "$@" - _encodings
......@@ -382,6 +411,156 @@ _rg_types() {
_rg "$@"
################################################################################
# ZSH COMPLETION REFERENCE
#
# For the convenience of developers who aren't especially familiar with zsh
# completion functions, a brief reference guide follows. This is in no way
# comprehensive; it covers just enough of the basic structure, syntax, and
# conventions to help someone make simple changes like adding new options. For
# more complete documentation regarding zsh completion functions, please see the
# following:
#
# * http://zsh.sourceforge.net/Doc/Release/Completion-System.html
# * https://github.com/zsh-users/zsh/blob/master/Etc/completion-style-guide
#
# OVERVIEW
#
# Most zsh completion functions are defined in terms of `_arguments`, which is a
# shell function that takes a series of argument specifications. The specs for
# `rg` are stored in an array, which is common for more complex functions; the
# elements of the array are passed to `_arguments` on invocation.
#
# ARGUMENT-SPECIFICATION SYNTAX
#
# The following is a contrived example of the argument specs for a simple tool:
#
# '(: * -)'{-h,--help}'[display help information]'
# '(-q -v --quiet --verbose)'{-q,--quiet}'[decrease output verbosity]'
# '!(-q -v --quiet --verbose)--silent'
# '(-q -v --quiet --verbose)'{-v,--verbose}'[increase output verbosity]'
# '--color=[specify when to use colors]:when:(always never auto)'
# '*:example file:_files'
#
# Although there may appear to be six specs here, there are actually nine; we
# use brace expansion to combine specs for options that go by multiple names,
# like `-q` and `--quiet`. This is customary, and ties in with the fact that zsh
# merges completion possibilities together when they have the same description.
#
# The first line defines the option `-h`/`--help`. With most tools, it isn't
# useful to complete anything after `--help` because it effectively overrides
# all others; the `(: * -)` at the beginning of the spec tells zsh not to
# complete any other operands (`:` and `*`) or options (`-`) after this one has
# been used. The `[...]` at the end associates a description with `-h`/`--help`;
# as mentioned, zsh will see the identical descriptions and merge these options
# together when offering completion possibilities.
#
# The next line defines `-q`/`--quiet`. Here we don't want to suppress further
# completions entirely, but we don't want to offer `-q` if `--quiet` has been
# given (since they do the same thing), nor do we want to offer `-v` (since it
# doesn't make sense to be quiet and verbose at the same time). We don't need to
# tell zsh not to offer `--quiet` a second time, since that's the default
# behaviour, but since this line expands to two specs describing `-q` *and*
# `--quiet` we do need to explicitly list all of them here.
#
# The next line defines a hidden option `--silent` — maybe it's a deprecated
# synonym for `--quiet`. The leading `!` indicates that zsh shouldn't offer this
# option during completion. The benefit of providing a spec for an option that
# shouldn't be completed is that, if someone *does* use it, we can correctly
# suppress completion of other options afterwards.
#
# The next line defines `-v`/`--verbose`; this works just like `-q`/`--quiet`.
#
# The next line defines `--color`. In this example, `--color` doesn't have a
# corresponding short option, so we don't need to use brace expansion. Further,
# there are no other options it's exclusive with (just itself), so we don't need
# to define those at the beginning. However, it does take a mandatory argument.
# The `=` at the end of `--color=` indicates that the argument may appear either
# like `--color always` or like `--color=always`; this is how most GNU-style
# command-line tools work. The corresponding short option would normally use `+`
# — for example, `-c+` would allow either `-c always` or `-calways`. For this
# option, the arguments are known ahead of time, so we can simply list them in
# parentheses at the end (`when` is used as the description for the argument).
#
# The last line defines an operand (a non-option argument). In this example, the
# operand can be used any number of times (the leading `*`), and it should be a
# file path, so we tell zsh to call the `_files` function to complete it. The
# `example file` in the middle is the description to use for this operand; we
# could use a space instead to accept the default provided by `_files`.
#
# GROUPING ARGUMENT SPECIFICATIONS
#
# Newer versions of zsh support grouping argument specs together. All specs
# following a `+` and then a group name are considered to be members of the
# named group. Grouping is useful mostly for organisational purposes; it makes
# the relationship between different options more obvious, and makes it easier
# to specify exclusions.
#
# We could rewrite our example above using grouping as follows:
#
# '(: * -)'{-h,--help}'[display help information]'
# '--color=[specify when to use colors]:when:(always never auto)'
# '*:example file:_files'
# + '(verbosity)'
# {-q,--quiet}'[decrease output verbosity]'
# '!--silent'
# {-v,--verbose}'[increase output verbosity]'
#
# Here we take advantage of a useful feature of spec grouping — when the group
# name is surrounded by parentheses, as in `(verbosity)`, it tells zsh that all
# of the options in that group are exclusive with each other. As a result, we
# don't need to manually list out the exclusions at the beginning of each
# option.
#
# Groups can also be referred to by name in other argument specs; for example:
#
# '(xyz)--aaa' '*: :_files'
# + xyz --xxx --yyy --zzz
#
# Here we use the group name `xyz` to tell zsh that `--xxx`, `--yyy`, and
# `--zzz` are not to be completed after `--aaa`. This makes the exclusion list
# much more compact and reusable.
#
# CONVENTIONS
#
# zsh completion functions generally adhere to the following conventions:
#
# * Use two spaces for indentation
# * Combine specs for options with different names using brace expansion
# * In combined specs, list the short option first (as in `{-a,--text}`)
# * Use `+` or `=` as described above for options that take arguments
# * Provide a description for all options, option-arguments, and operands
# * Capitalise/punctuate argument descriptions as phrases, not complete
# sentences — 'display help information', never 'Display help information.'
# (but still capitalise acronyms and proper names)
# * Write argument descriptions as verb phrases — 'display x', 'enable y',
# 'use z'
# * Word descriptions to make it clear when an option expects an argument;
# usually this is done with the word 'specify', as in 'specify x' or
# 'use specified x')
# * Write argument descriptions as tersely as possible — for example, articles
# like 'a' and 'the' should be omitted unless it would be confusing
#
# Other conventions currently used by this function:
#
# * Order argument specs alphabetically by group name, then option name
# * Group options that are directly related, mutually exclusive, or frequently
# referenced by other argument specs
# * Use only characters in the set [a-z0-9_-] in group names
# * Order exclusion lists as follows: short options, long options, groups
# * Use American English in descriptions
# * Use 'don't' in descriptions instead of 'do not'
# * Word descriptions for related options as similarly as possible. For example,
# `--foo[enable foo]` and `--no-foo[disable foo]`, or `--foo[use foo]` and
# `--no-foo[don't use foo]`
# * Word descriptions to make it clear when an option only makes sense with
# another option, usually by adding '(with -x)' to the end
# * Don't quote strings or variables unnecessarily. When quotes are required,
# prefer single-quotes to double-quotes
# * Prefix option specs with `$no` when the option serves only to negate the
# behaviour of another option that must be provided explicitly by the user.
# This prevents rarely used options from cluttering up the completion menu
################################################################################
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
......
# rust
This plugin adds completion for [`rustc`](https://doc.rust-lang.org/rustc/index.html), the compiler for the Rust programming language.
To use it, add `rust` to the plugins array in your zshrc file:
```zsh
plugins=(... rust)
```
# 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` |
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment