Merge branch 'master' of github.com:robbyrussell/oh-my-zsh
This commit is contained in:
commit
d709141023
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,9 +1,8 @@
|
||||
locals.zsh
|
||||
log/.zsh_history
|
||||
projects.zsh
|
||||
custom
|
||||
# custom files
|
||||
custom/
|
||||
!custom/plugins/example
|
||||
!custom/example.zsh
|
||||
*.swp
|
||||
!custom/example.zshcache
|
||||
|
||||
# temp files directories
|
||||
cache/
|
||||
log/
|
||||
|
123
CONTRIBUTING.md
Normal file
123
CONTRIBUTING.md
Normal file
@ -0,0 +1,123 @@
|
||||
# CONTRIBUTING GUIDELINES
|
||||
|
||||
Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged and appreciated.
|
||||
It is also essential for the development of the project.
|
||||
|
||||
These guidelines are an attempt at better addressing the huge amount of pending
|
||||
issues and pull requests. Please read them closely.
|
||||
|
||||
Foremost, be so kind as to [search](#use-the-search-luke). This ensures any contribution
|
||||
you would make is not already covered.
|
||||
|
||||
* [Issues](#reporting-issues)
|
||||
* [You have a problem](#you-have-a-problem)
|
||||
* [You have a suggestion](#you-have-a-suggestion)
|
||||
* [Pull Requests](#submitting-pull-requests)
|
||||
* [Getting started](#getting-started)
|
||||
* [You have a solution](#you-have-a-solution)
|
||||
* [You have an addition](#you-have-an-addition)
|
||||
* [Information sources (_aka_ search)](#use-the-search-luke)
|
||||
|
||||
**BONUS:** [Volunteering](#you-have-spare-time-to-volunteer)
|
||||
|
||||
## Reporting Issues
|
||||
|
||||
### You have a problem
|
||||
|
||||
Please be so kind as to [search](#use-the-search-luke) for any open issue already covering
|
||||
your problem.
|
||||
|
||||
If you find one, comment on it so we can know there are more people experiencing it.
|
||||
|
||||
If not, look at the [Troubleshooting](https://github.com/robbyrussell/oh-my-zsh/wiki/Troubleshooting)
|
||||
page for instructions on how to gather data to better debug your problem.
|
||||
|
||||
Then, you can go ahead and create an issue with as much detail as you can provide.
|
||||
It should include the data gathered as indicated above, along with:
|
||||
|
||||
1. How to reproduce the problem
|
||||
2. What the correct behavior should be
|
||||
3. What the actual behavior is
|
||||
|
||||
Please copy to anyone relevant (_eg_ plugin maintainers) by mentioning their GitHub handle
|
||||
(starting with `@`) in your message.
|
||||
|
||||
We will do our very best to help you.
|
||||
|
||||
### You have a suggestion
|
||||
|
||||
Please be so kind as to [search](#use-the-search-luke) for any open issue already covering
|
||||
your suggestion.
|
||||
|
||||
If you find one, comment on it so we can know there are more people supporting it.
|
||||
|
||||
If not, you can go ahead and create an issue. Please copy to anyone relevant (_eg_ plugin
|
||||
maintainers) by mentioning their GitHub handle (starting with `@`) in your message.
|
||||
|
||||
## Submitting Pull Requests
|
||||
|
||||
### Getting started
|
||||
|
||||
You should be familiar with the basics of
|
||||
[contributing on GitHub](https://help.github.com/articles/using-pull-requests) and have a fork
|
||||
[properly set up](https://github.com/robbyrussell/oh-my-zsh/wiki/Contribution-Technical-Practices).
|
||||
|
||||
You MUST always create PRs with _a dedicated branch_ based on the latest upstream tree.
|
||||
|
||||
If you create your own PR, please make sure you do it right. Also be so kind as to reference
|
||||
any issue that would be solved in the PR description body,
|
||||
[for instance](https://help.github.com/articles/closing-issues-via-commit-messages/)
|
||||
_"Fixes #XXXX"_ for issue number XXXX.
|
||||
|
||||
### You have a solution
|
||||
|
||||
Please be so kind as to [search](#use-the-search-luke) for any open issue already covering
|
||||
your [problem](#you-have-a-problem), and any pending/merged/rejected PR covering your solution.
|
||||
|
||||
If the solution is already reported, try it out and +1 the pull request if the
|
||||
solution works ok. On the other hand, if you think your solution is better, post
|
||||
it with a reference to the other one so we can have both solutions to compare.
|
||||
|
||||
If not, then go ahead and submit a PR. Please copy to anyone relevant (e.g. plugin
|
||||
maintainers) by mentioning their GitHub handle (starting with `@`) in your message.
|
||||
|
||||
### You have an addition
|
||||
|
||||
Please [do not](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#dont-send-us-your-theme-for-now)
|
||||
send themes for now.
|
||||
|
||||
Please be so kind as to [search](#use-the-search-luke) for any pending, merged or rejected Pull Requests
|
||||
covering or related to what you want to add.
|
||||
|
||||
If you find one, try it out and work with the author on a common solution.
|
||||
|
||||
If not, then go ahead and submit a PR. Please copy to anyone relevant (_eg_ plugin
|
||||
maintainers) by mentioning their GitHub handle (starting with `@`) in your message.
|
||||
|
||||
For any extensive change, _eg_ a new plugin, you will have to find testers to +1 your PR.
|
||||
|
||||
----
|
||||
|
||||
## Use the Search, Luke
|
||||
|
||||
_May the Force (of past experiences) be with you_
|
||||
|
||||
GitHub offers [many search features](https://help.github.com/articles/searching-github/)
|
||||
to help you check whether a similar contribution to yours already exists. Please search
|
||||
before making any contribution, it avoids duplicates and eases maintenance. Trust me,
|
||||
that works 90% of the time.
|
||||
|
||||
You can also take a look at the [FAQ](https://github.com/robbyrussell/oh-my-zsh/wiki/FAQ)
|
||||
to be sure your contribution has not already come up.
|
||||
|
||||
If all fails, your thing has probably not been reported yet, so you can go ahead
|
||||
and [create an issue](#reporting-issues) or [submit a PR](#submitting-pull-requests).
|
||||
|
||||
----
|
||||
|
||||
### You have spare time to volunteer
|
||||
|
||||
Very nice!! :)
|
||||
|
||||
Please have a look at the [Volunteer](https://github.com/robbyrussell/oh-my-zsh/wiki/Volunteers)
|
||||
page for instructions on where to start and more.
|
@ -1,6 +1,7 @@
|
||||
The MIT License
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2009-2015 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/contributors)
|
||||
Copyright (c) 2009-2017 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
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@ -9,13 +10,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -1,21 +1,27 @@
|
||||
![Oh My Zsh](https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png)
|
||||
<p align="center">
|
||||
<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](http://www.zsh.org/) configuration. That sounds boring. Let's try this again.
|
||||
Sounds boring. Let's try again.
|
||||
|
||||
__Oh My Zsh is a way of life!__ Once installed, your terminal prompt will become the talk of the town _or your money back!_ Each time you interact with your command prompt, you'll be able take advantage of the hundreds of bundled plugins and pretty themes. Strangers will come up to you in cafés and ask you, _"that is amazing. are you some sort of genius?"_ Finally, you'll begin to get the sort of attention that you always felt that you deserved. ...or maybe you'll just use the time that you saved to start flossing more often.
|
||||
__Oh My Zsh will not make you a 10x developer...but you might feel like one.__
|
||||
|
||||
To learn more, visit http://ohmyz.sh and/or follow [ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.
|
||||
Once installed, your terminal shell will become the talk of the town _or your money back!_ With each keystroke in your command prompt, you'll take advantage of the hundreds of powerful plugins and beautiful themes. Strangers will come up to you in cafés and ask you, _"that is amazing! are you some sort of genius?"_
|
||||
|
||||
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.
|
||||
|
||||
## Getting Started
|
||||
|
||||
|
||||
### Prerequisites
|
||||
|
||||
__Disclaimer:__ _Oh My Zsh works best on Mac OS X and Linux._
|
||||
__Disclaimer:__ _Oh My Zsh works best on macOS and Linux._
|
||||
|
||||
* Unix-based operating system (Mac OS X 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)
|
||||
* 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)
|
||||
* `curl` or `wget` should be installed
|
||||
* `git` should be installed
|
||||
|
||||
@ -25,11 +31,15 @@ Oh My Zsh is installed by running one of the following commands in your terminal
|
||||
|
||||
#### via curl
|
||||
|
||||
`sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"`
|
||||
```shell
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
```
|
||||
|
||||
#### via wget
|
||||
|
||||
`sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"`
|
||||
```shell
|
||||
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
|
||||
```
|
||||
|
||||
## Using Oh My Zsh
|
||||
|
||||
@ -39,9 +49,9 @@ Oh My Zsh comes with a shit load of plugins to take advantage of. You can take a
|
||||
|
||||
#### Enabling Plugins
|
||||
|
||||
If you spot a plugin (or several) that you would like to use with Oh My Zsh, you will need to edit the `~/.zshrc` file. Once you open it with your favorite editor, you'll see a spot to list all the plugins that you'd like Oh My Zsh to load in initialization.
|
||||
Once you spot a plugin (or several) that you'd like to use 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.
|
||||
|
||||
For example, this line might begin to look like...
|
||||
For example, this line might begin to look like this:
|
||||
|
||||
```shell
|
||||
plugins=(git bundler osx rake ruby)
|
||||
@ -57,7 +67,7 @@ We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme
|
||||
|
||||
#### Selecting a Theme
|
||||
|
||||
_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just right (for him)._
|
||||
_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just the right one (for him)._
|
||||
|
||||
Once you find a theme that you want to use, you will need to edit the `~/.zshrc` file. You'll see an environment variable (all caps) in there that looks like:
|
||||
|
||||
@ -69,9 +79,11 @@ To use a different theme, simply change the value to match the name of your desi
|
||||
|
||||
```shell
|
||||
ZSH_THEME="agnoster" # (this is one of the fancy ones)
|
||||
# you might need to install a special Powerline font on your console's host for this to work
|
||||
# see https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#agnoster
|
||||
```
|
||||
|
||||
Open up a new terminal window and your prompt should look something like...
|
||||
Open up a new terminal window and your prompt should look something like this:
|
||||
|
||||
![Agnoster theme](https://cloud.githubusercontent.com/assets/2618447/6316862/70f58fb6-ba03-11e4-82c9-c083bf9a6574.png)
|
||||
|
||||
@ -100,7 +112,7 @@ The default location is `~/.oh-my-zsh` (hidden in your home directory)
|
||||
If you'd like to change the install directory with the `ZSH` environment variable, either by running `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this:
|
||||
|
||||
```shell
|
||||
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | ZSH=~/.dotfiles/zsh sh
|
||||
export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
```
|
||||
|
||||
#### Manual Installation
|
||||
@ -119,7 +131,7 @@ cp ~/.zshrc ~/.zshrc.orig
|
||||
|
||||
##### 3. Create a new zsh configuration file
|
||||
|
||||
You can create a new zsh config file by copying the template that we included for you.
|
||||
You can create a new zsh config file by copying the template that we have included for you.
|
||||
|
||||
```shell
|
||||
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
|
||||
@ -198,7 +210,10 @@ Thank you so much!
|
||||
|
||||
## Follow Us
|
||||
|
||||
We have an [@ohmyzsh](https://twitter.com/ohmyzsh) Twitter account. You should follow it.
|
||||
We're on the social media.
|
||||
|
||||
* [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. You should follow it.
|
||||
* [Oh My Zsh](https://www.facebook.com/Oh-My-Zsh-296616263819290/) on Facebook.
|
||||
|
||||
## Merchandise
|
||||
|
||||
@ -206,4 +221,10 @@ We have [stickers](http://shop.planetargon.com/products/ohmyzsh-stickers-set-of-
|
||||
|
||||
## License
|
||||
|
||||
Oh My Zsh is released under the [MIT license](https://github.com/robbyrussell/oh-my-zsh/blob/master/MIT-LICENSE.txt).
|
||||
Oh My Zsh is released under the [MIT license](LICENSE.txt).
|
||||
|
||||
## About Planet Argon
|
||||
|
||||
![Planet Argon](http://pa-github-assets.s3.amazonaws.com/PARGON_logo_digital_COL-small.jpg)
|
||||
|
||||
Oh My Zsh was started by the team at [Planet Argon](https://www.planetargon.com/?utm_source=github), a [Ruby on Rails development agency](https://www.planetargon.com/skills/ruby-on-rails-development?utm_source=github).
|
4
cache/.easter-egg
vendored
4
cache/.easter-egg
vendored
@ -1,4 +0,0 @@
|
||||
This file is only here so that Git will keep a cache directory as .gitignore is ignoring all the files within it.
|
||||
|
||||
Feel free to add love notes for people here.
|
||||
|
0
cache/.gitkeep
vendored
Normal file
0
cache/.gitkeep
vendored
Normal file
@ -1,5 +1,10 @@
|
||||
# Add yourself some shortcuts to projects you often work on
|
||||
# Example:
|
||||
# You can put files here to add functionality separated per file, which
|
||||
# will be ignored by git.
|
||||
# Files on the custom/ directory will be automatically loaded by the init
|
||||
# script, in alphabetical order.
|
||||
|
||||
# For example: add yourself some shortcuts to projects you often work on.
|
||||
#
|
||||
# brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr
|
||||
# brainstormr=~/Projects/development/planetargon/brainstormr
|
||||
# cd $brainstormr
|
||||
#
|
86
lib/clipboard.zsh
Normal file
86
lib/clipboard.zsh
Normal file
@ -0,0 +1,86 @@
|
||||
# System clipboard integration
|
||||
#
|
||||
# This file has support for doing system clipboard copy and paste operations
|
||||
# from the command line in a generic cross-platform fashion.
|
||||
#
|
||||
# On OS X and Windows, the main system clipboard or "pasteboard" is used. On other
|
||||
# Unix-like OSes, this considers the X Windows CLIPBOARD selection to be the
|
||||
# "system clipboard", and the X Windows `xclip` command must be installed.
|
||||
|
||||
# clipcopy - Copy data to clipboard
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# <command> | clipcopy - copies stdin to clipboard
|
||||
#
|
||||
# clipcopy <file> - copies a file's contents to clipboard
|
||||
#
|
||||
function clipcopy() {
|
||||
emulate -L zsh
|
||||
local file=$1
|
||||
if [[ $OSTYPE == darwin* ]]; then
|
||||
if [[ -z $file ]]; then
|
||||
pbcopy
|
||||
else
|
||||
cat $file | pbcopy
|
||||
fi
|
||||
elif [[ $OSTYPE == cygwin* ]]; then
|
||||
if [[ -z $file ]]; then
|
||||
cat > /dev/clipboard
|
||||
else
|
||||
cat $file > /dev/clipboard
|
||||
fi
|
||||
else
|
||||
if (( $+commands[xclip] )); then
|
||||
if [[ -z $file ]]; then
|
||||
xclip -in -selection clipboard
|
||||
else
|
||||
xclip -in -selection clipboard $file
|
||||
fi
|
||||
elif (( $+commands[xsel] )); then
|
||||
if [[ -z $file ]]; then
|
||||
xsel --clipboard --input
|
||||
else
|
||||
cat "$file" | xsel --clipboard --input
|
||||
fi
|
||||
else
|
||||
print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# clippaste - "Paste" data from clipboard to stdout
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# clippaste - writes clipboard's contents to stdout
|
||||
#
|
||||
# clippaste | <command> - pastes contents and pipes it to another process
|
||||
#
|
||||
# clippaste > <file> - paste contents to a file
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# # Pipe to another process
|
||||
# clippaste | grep foo
|
||||
#
|
||||
# # Paste to a file
|
||||
# clippaste > file.txt
|
||||
function clippaste() {
|
||||
emulate -L zsh
|
||||
if [[ $OSTYPE == darwin* ]]; then
|
||||
pbpaste
|
||||
elif [[ $OSTYPE == cygwin* ]]; then
|
||||
cat /dev/clipboard
|
||||
else
|
||||
if (( $+commands[xclip] )); then
|
||||
xclip -out -selection clipboard
|
||||
elif (( $+commands[xsel] )); then
|
||||
xsel --clipboard --output
|
||||
else
|
||||
print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
@ -1,37 +1,34 @@
|
||||
# fixme - the load process here seems a bit bizarre
|
||||
|
||||
unsetopt menu_complete # do not autoselect the first completion entry
|
||||
unsetopt flowcontrol
|
||||
setopt auto_menu # show completion menu on succesive tab press
|
||||
setopt complete_in_word
|
||||
setopt always_to_end
|
||||
zmodload -i zsh/complist
|
||||
|
||||
WORDCHARS=''
|
||||
|
||||
zmodload -i zsh/complist
|
||||
|
||||
## case-insensitive (all),partial-word and then substring completion
|
||||
if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
|
||||
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||
unset CASE_SENSITIVE
|
||||
else
|
||||
if [ "x$HYPHEN_INSENSITIVE" = "xtrue" ]; then
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||
unset HYPHEN_INSENSITIVE
|
||||
else
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||
fi
|
||||
fi
|
||||
|
||||
zstyle ':completion:*' list-colors ''
|
||||
unsetopt menu_complete # do not autoselect the first completion entry
|
||||
unsetopt flowcontrol
|
||||
setopt auto_menu # show completion menu on successive tab press
|
||||
setopt complete_in_word
|
||||
setopt always_to_end
|
||||
|
||||
# should this be in keybindings?
|
||||
bindkey -M menuselect '^o' accept-and-infer-next-history
|
||||
|
||||
zstyle ':completion:*:*:*:*:*' menu select
|
||||
|
||||
# case insensitive (all), partial-word and substring completion
|
||||
if [[ "$CASE_SENSITIVE" = true ]]; then
|
||||
zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
|
||||
else
|
||||
if [[ "$HYPHEN_INSENSITIVE" = true ]]; then
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
|
||||
else
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
|
||||
fi
|
||||
fi
|
||||
unset CASE_SENSITIVE HYPHEN_INSENSITIVE
|
||||
|
||||
zstyle ':completion:*' list-colors ''
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
||||
if [ "$OSTYPE[0,7]" = "solaris" ]
|
||||
then
|
||||
|
||||
if [[ "$OSTYPE" = solaris* ]]; then
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm"
|
||||
else
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
|
||||
|
@ -52,6 +52,9 @@
|
||||
# * Consider whether to move default output file location to TMPDIR. More robust
|
||||
# but less user friendly.
|
||||
#
|
||||
|
||||
autoload -Uz is-at-least
|
||||
|
||||
function omz_diagnostic_dump() {
|
||||
emulate -L zsh
|
||||
|
||||
@ -247,7 +250,7 @@ function _omz_diag_dump_one_big_text() {
|
||||
|
||||
function _omz_diag_dump_check_core_commands() {
|
||||
builtin echo "Core command check:"
|
||||
local redefined name builtins externals
|
||||
local redefined name builtins externals reserved_words
|
||||
redefined=()
|
||||
# All the zsh non-module builtin commands
|
||||
# These are taken from the zsh reference manual for 5.0.2
|
||||
@ -255,17 +258,32 @@ function _omz_diag_dump_check_core_commands() {
|
||||
# (For back-compatibility, if any of these are newish, they should be removed,
|
||||
# or at least made conditional on the version of the current running zsh.)
|
||||
# "history" is also excluded because OMZ is known to redefine that
|
||||
reserved_words=( do done esac then elif else fi for case if while function
|
||||
repeat time until select coproc nocorrect foreach end '!' '[[' '{' '}'
|
||||
)
|
||||
builtins=( alias autoload bg bindkey break builtin bye cd chdir command
|
||||
comparguments compcall compctl compdescribe compfiles compgroups compquote comptags
|
||||
comptry compvalues continue declare dirs disable disown echo echotc echoti emulate
|
||||
enable eval exec exit export false fc fg float functions getln getopts hash
|
||||
integer jobs kill let limit local log logout noglob popd print printf
|
||||
pushd pushln pwd r read readonly rehash return sched set setopt shift
|
||||
source suspend test times trap true ttyctl type typeset ulimit umask unalias
|
||||
comptry compvalues continue dirs disable disown echo echotc echoti emulate
|
||||
enable eval exec exit false fc fg functions getln getopts hash
|
||||
jobs kill let limit log logout noglob popd print printf
|
||||
pushd pushln pwd r read rehash return sched set setopt shift
|
||||
source suspend test times trap true ttyctl type ulimit umask unalias
|
||||
unfunction unhash unlimit unset unsetopt vared wait whence where which zcompile
|
||||
zle zmodload zparseopts zregexparse zstyle )
|
||||
if is-at-least 5.1; then
|
||||
reserved_word+=( declare export integer float local readonly typeset )
|
||||
else
|
||||
builtins+=( declare export integer float local readonly typeset )
|
||||
fi
|
||||
builtins_fatal=( builtin command local )
|
||||
externals=( zsh )
|
||||
for name in $reserved_words; do
|
||||
if [[ $(builtin whence -w $name) != "$name: reserved" ]]; then
|
||||
builtin echo "reserved word '$name' has been redefined"
|
||||
builtin which $name
|
||||
redefined+=$name
|
||||
fi
|
||||
done
|
||||
for name in $builtins; do
|
||||
if [[ $(builtin whence -w $name) != "$name: builtin" ]]; then
|
||||
builtin echo "builtin '$name' has been redefined"
|
||||
|
@ -8,6 +8,7 @@ alias -g ....='../../..'
|
||||
alias -g .....='../../../..'
|
||||
alias -g ......='../../../../..'
|
||||
|
||||
alias -- -='cd -'
|
||||
alias 1='cd -'
|
||||
alias 2='cd -2'
|
||||
alias 3='cd -3'
|
||||
|
@ -3,11 +3,11 @@ function zsh_stats() {
|
||||
}
|
||||
|
||||
function uninstall_oh_my_zsh() {
|
||||
env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh
|
||||
env ZSH=$ZSH sh $ZSH/tools/uninstall.sh
|
||||
}
|
||||
|
||||
function upgrade_oh_my_zsh() {
|
||||
env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
|
||||
env ZSH=$ZSH sh $ZSH/tools/upgrade.sh
|
||||
}
|
||||
|
||||
function take() {
|
||||
@ -16,19 +16,28 @@ function take() {
|
||||
}
|
||||
|
||||
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" ;;
|
||||
darwin*) open_cmd='open' ;;
|
||||
cygwin*) open_cmd='cygstart' ;;
|
||||
linux*) open_cmd='xdg-open' ;;
|
||||
msys*) open_cmd='start ""' ;;
|
||||
*) echo "Platform $OSTYPE not supported"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
nohup $open_cmd "$@" &>/dev/null
|
||||
# don't use nohup on OSX
|
||||
if [[ "$OSTYPE" == darwin* ]]; then
|
||||
$open_cmd "$@" &>/dev/null
|
||||
else
|
||||
nohup $open_cmd "$@" &>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
@ -77,7 +86,7 @@ function default() {
|
||||
}
|
||||
|
||||
#
|
||||
# Set enviroment variable "$1" to default value "$2" if "$1" is not yet defined.
|
||||
# Set environment variable "$1" to default value "$2" if "$1" is not yet defined.
|
||||
#
|
||||
# Arguments:
|
||||
# 1. name - The env variable to set
|
||||
@ -111,7 +120,7 @@ zmodload zsh/langinfo
|
||||
# Returns nonzero if encoding failed.
|
||||
#
|
||||
# Usage:
|
||||
# omz_urlencode [-r] [-m] <string>
|
||||
# omz_urlencode [-r] [-m] [-P] <string>
|
||||
#
|
||||
# -r causes reserved characters (;/?:@&=+$,) to be escaped
|
||||
#
|
||||
@ -220,4 +229,3 @@ function omz_urldecode {
|
||||
|
||||
echo -E "$decoded"
|
||||
}
|
||||
|
||||
|
114
lib/git.zsh
114
lib/git.zsh
@ -1,5 +1,6 @@
|
||||
# get the name of the branch we are on
|
||||
# Outputs current branch info in prompt format
|
||||
function git_prompt_info() {
|
||||
local ref
|
||||
if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then
|
||||
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
|
||||
@ -7,9 +8,8 @@ function git_prompt_info() {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Checks if working tree is dirty
|
||||
parse_git_dirty() {
|
||||
function parse_git_dirty() {
|
||||
local STATUS=''
|
||||
local FLAGS
|
||||
FLAGS=('--porcelain')
|
||||
@ -29,32 +29,28 @@ parse_git_dirty() {
|
||||
fi
|
||||
}
|
||||
|
||||
# get the difference between the local and remote branches
|
||||
git_remote_status() {
|
||||
# Gets the difference between the local and remote branches
|
||||
function git_remote_status() {
|
||||
local remote ahead behind git_remote_status git_remote_status_detailed
|
||||
remote=${$(command git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
|
||||
if [[ -n ${remote} ]] ; then
|
||||
if [[ -n ${remote} ]]; then
|
||||
ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
|
||||
behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
|
||||
|
||||
if [ $ahead -eq 0 ] && [ $behind -eq 0 ]
|
||||
then
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE"
|
||||
elif [ $ahead -gt 0 ] && [ $behind -eq 0 ]
|
||||
then
|
||||
if [[ $ahead -eq 0 ]] && [[ $behind -eq 0 ]]; then
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE"
|
||||
elif [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
|
||||
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}"
|
||||
elif [ $behind -gt 0 ] && [ $ahead -eq 0 ]
|
||||
then
|
||||
elif [[ $behind -gt 0 ]] && [[ $ahead -eq 0 ]]; then
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE"
|
||||
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
|
||||
elif [ $ahead -gt 0 ] && [ $behind -gt 0 ]
|
||||
then
|
||||
elif [[ $ahead -gt 0 ]] && [[ $behind -gt 0 ]]; then
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE"
|
||||
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
|
||||
fi
|
||||
|
||||
if [ $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]
|
||||
then
|
||||
if [[ -n $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX"
|
||||
fi
|
||||
|
||||
@ -62,31 +58,59 @@ git_remote_status() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Outputs the name of the current branch
|
||||
# Usage example: git pull origin $(git_current_branch)
|
||||
# Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if
|
||||
# it's not a symbolic ref, but in a Git repo.
|
||||
function git_current_branch() {
|
||||
local ref
|
||||
ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null)
|
||||
local ret=$?
|
||||
if [[ $ret != 0 ]]; then
|
||||
[[ $ret == 128 ]] && return # no git repo.
|
||||
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
|
||||
fi
|
||||
echo ${ref#refs/heads/}
|
||||
}
|
||||
|
||||
|
||||
# Gets the number of commits ahead from remote
|
||||
function git_commits_ahead() {
|
||||
if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ')
|
||||
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
|
||||
if command git rev-parse --git-dir &>/dev/null; then
|
||||
local commits="$(git rev-list --count @{upstream}..HEAD)"
|
||||
if [[ "$commits" != 0 ]]; then
|
||||
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# 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
|
||||
echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Outputs if current branch is ahead of remote
|
||||
function git_prompt_ahead() {
|
||||
if [[ -n "$(command git rev-list origin/$(current_branch)..HEAD 2> /dev/null)" ]]; then
|
||||
if [[ -n "$(command git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||
fi
|
||||
}
|
||||
|
||||
# Outputs if current branch is behind remote
|
||||
function git_prompt_behind() {
|
||||
if [[ -n "$(command git rev-list HEAD..origin/$(current_branch) 2> /dev/null)" ]]; then
|
||||
if [[ -n "$(command git rev-list HEAD..origin/$(git_current_branch) 2> /dev/null)" ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_BEHIND"
|
||||
fi
|
||||
}
|
||||
|
||||
# Outputs if current branch exists on remote or not
|
||||
function git_prompt_remote() {
|
||||
if [[ -n "$(command git show-ref origin/$(current_branch) 2> /dev/null)" ]]; then
|
||||
if [[ -n "$(command git show-ref origin/$(git_current_branch) 2> /dev/null)" ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_REMOTE_EXISTS"
|
||||
else
|
||||
echo "$ZSH_THEME_GIT_PROMPT_REMOTE_MISSING"
|
||||
@ -95,16 +119,19 @@ function git_prompt_remote() {
|
||||
|
||||
# Formats prompt string for current git commit short SHA
|
||||
function git_prompt_short_sha() {
|
||||
local SHA
|
||||
SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
||||
}
|
||||
|
||||
# Formats prompt string for current git commit long SHA
|
||||
function git_prompt_long_sha() {
|
||||
local SHA
|
||||
SHA=$(command git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
||||
}
|
||||
|
||||
# Get the status of the working tree
|
||||
git_prompt_status() {
|
||||
function git_prompt_status() {
|
||||
local INDEX STATUS
|
||||
INDEX=$(command git status --porcelain -b 2> /dev/null)
|
||||
STATUS=""
|
||||
if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then
|
||||
@ -138,27 +165,26 @@ git_prompt_status() {
|
||||
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*ahead' &> /dev/null); then
|
||||
if $(echo "$INDEX" | grep '^## [^ ]\+ .*ahead' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*behind' &> /dev/null); then
|
||||
if $(echo "$INDEX" | grep '^## [^ ]\+ .*behind' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*diverged' &> /dev/null); then
|
||||
if $(echo "$INDEX" | grep '^## [^ ]\+ .*diverged' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS"
|
||||
fi
|
||||
echo $STATUS
|
||||
}
|
||||
|
||||
#compare the provided version of git to the version installed and on path
|
||||
#prints 1 if input version <= installed version
|
||||
#prints -1 otherwise
|
||||
# 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=$1;
|
||||
local INSTALLED_GIT_VERSION
|
||||
INPUT_GIT_VERSION=(${(s/./)INPUT_GIT_VERSION});
|
||||
INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null));
|
||||
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
|
||||
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
|
||||
@ -173,7 +199,19 @@ function git_compare_version() {
|
||||
echo 0
|
||||
}
|
||||
|
||||
#this is unlikely to change so make it all statically assigned
|
||||
# Outputs the name of the current user
|
||||
# Usage example: $(git_current_user_name)
|
||||
function git_current_user_name() {
|
||||
command git config user.name 2>/dev/null
|
||||
}
|
||||
|
||||
# Outputs the email of the current user
|
||||
# Usage example: $(git_current_user_email)
|
||||
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
|
||||
unset -f git_compare_version
|
||||
# Clean up the namespace slightly by removing the checker function
|
||||
unfunction git_compare_version
|
||||
|
@ -27,11 +27,17 @@ if [[ "${terminfo[knp]}" != "" ]]; then
|
||||
bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history
|
||||
fi
|
||||
|
||||
# start typing + [Up-Arrow] - fuzzy find history forward
|
||||
if [[ "${terminfo[kcuu1]}" != "" ]]; then
|
||||
bindkey "${terminfo[kcuu1]}" up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward
|
||||
autoload -U up-line-or-beginning-search
|
||||
zle -N up-line-or-beginning-search
|
||||
bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||
fi
|
||||
# start typing + [Down-Arrow] - fuzzy find history backward
|
||||
if [[ "${terminfo[kcud1]}" != "" ]]; then
|
||||
bindkey "${terminfo[kcud1]}" down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward
|
||||
autoload -U down-line-or-beginning-search
|
||||
zle -N down-line-or-beginning-search
|
||||
bindkey "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||
fi
|
||||
|
||||
if [[ "${terminfo[khome]}" != "" ]]; then
|
||||
|
35
lib/misc.zsh
35
lib/misc.zsh
@ -1,28 +1,37 @@
|
||||
## Load smart urls if available
|
||||
for d in $fpath; do
|
||||
if [[ -e "$d/url-quote-magic" ]]; then
|
||||
if [[ -e "$d/bracketed-paste-magic" ]]; then
|
||||
autoload -Uz bracketed-paste-magic
|
||||
zle -N bracketed-paste bracketed-paste-magic
|
||||
fi
|
||||
autoload -U url-quote-magic
|
||||
zle -N self-insert url-quote-magic
|
||||
fi
|
||||
done
|
||||
# bracketed-paste-magic is known buggy in zsh 5.1.1 (only), so skip it there; see #4434
|
||||
autoload -Uz is-at-least
|
||||
if [[ $ZSH_VERSION != 5.1.1 ]]; then
|
||||
for d in $fpath; do
|
||||
if [[ -e "$d/url-quote-magic" ]]; then
|
||||
if is-at-least 5.1; then
|
||||
autoload -Uz bracketed-paste-magic
|
||||
zle -N bracketed-paste bracketed-paste-magic
|
||||
fi
|
||||
autoload -Uz url-quote-magic
|
||||
zle -N self-insert url-quote-magic
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
## jobs
|
||||
setopt long_list_jobs
|
||||
|
||||
## pager
|
||||
export PAGER="less"
|
||||
export LESS="-R"
|
||||
env_default PAGER 'less'
|
||||
env_default LESS '-R'
|
||||
|
||||
## super user alias
|
||||
alias _='sudo'
|
||||
alias please='sudo'
|
||||
|
||||
## more intelligent acking for ubuntu users
|
||||
alias afind='ack-grep -il'
|
||||
if which ack-grep &> /dev/null; then
|
||||
alias afind='ack-grep -il'
|
||||
else
|
||||
alias afind='ack -il'
|
||||
fi
|
||||
|
||||
# only define LC_CTYPE if undefined
|
||||
if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then
|
||||
|
@ -1,6 +1,6 @@
|
||||
# get the node.js version
|
||||
function nvm_prompt_info() {
|
||||
[ -f "$HOME/.nvm/nvm.sh" ] || return
|
||||
[[ -f "$NVM_DIR/nvm.sh" ]] || return
|
||||
local nvm_prompt
|
||||
nvm_prompt=$(node -v 2>/dev/null)
|
||||
[[ "${nvm_prompt}x" == "x" ]] && return
|
||||
|
@ -3,7 +3,7 @@
|
||||
# P.C. Shyamshankar <sykora@lucentbeing.com>
|
||||
# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
|
||||
|
||||
typeset -Ag FX FG BG
|
||||
typeset -AHg FX FG BG
|
||||
|
||||
FX=(
|
||||
reset "%{[00m%}"
|
||||
@ -25,13 +25,13 @@ ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab o
|
||||
# Show all 256 colors with color number
|
||||
function spectrum_ls() {
|
||||
for code in {000..255}; do
|
||||
print -P -- "$code: %F{$code}$ZSH_SPECTRUM_TEXT%f"
|
||||
print -P -- "$code: %{$FG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"
|
||||
done
|
||||
}
|
||||
|
||||
# Show all 256 colors where the background is set to specific color
|
||||
function spectrum_bls() {
|
||||
for code in {000..255}; do
|
||||
print -P -- "$BG[$code]$code: $ZSH_SPECTRUM_TEXT %{$reset_color%}"
|
||||
print -P -- "$code: %{$BG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"
|
||||
done
|
||||
}
|
||||
|
@ -16,25 +16,43 @@ function title {
|
||||
# if it is set and empty, leave it as is
|
||||
: ${2=$1}
|
||||
|
||||
if [[ "$TERM" == screen* ]]; then
|
||||
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
|
||||
elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
print -Pn "\e]2;$2:q\a" #set window name
|
||||
print -Pn "\e]1;$1:q\a" #set icon (=tab) name
|
||||
fi
|
||||
case "$TERM" in
|
||||
cygwin|xterm*|putty*|rxvt*|ansi)
|
||||
print -Pn "\e]2;$2:q\a" # set window name
|
||||
print -Pn "\e]1;$1:q\a" # set tab name
|
||||
;;
|
||||
screen*)
|
||||
print -Pn "\ek$1:q\e\\" # set screen hardstatus
|
||||
;;
|
||||
*)
|
||||
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
print -Pn "\e]2;$2:q\a" # set window name
|
||||
print -Pn "\e]1;$1:q\a" # set tab name
|
||||
else
|
||||
# Try to use terminfo to set the title
|
||||
# If the feature is available set title
|
||||
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
|
||||
echoti tsl
|
||||
print -Pn "$1"
|
||||
echoti fsl
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
|
||||
ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
|
||||
# Avoid duplication of directory in terminals with independent dir display
|
||||
if [[ $TERM_PROGRAM == Apple_Terminal ]]; then
|
||||
if [[ "$TERM_PROGRAM" == Apple_Terminal ]]; then
|
||||
ZSH_THEME_TERM_TITLE_IDLE="%n@%m"
|
||||
fi
|
||||
|
||||
# Runs before showing the prompt
|
||||
function omz_termsupport_precmd {
|
||||
emulate -L zsh
|
||||
if [[ $DISABLE_AUTO_TITLE == true ]]; then
|
||||
|
||||
if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
@ -44,12 +62,12 @@ function omz_termsupport_precmd {
|
||||
# Runs before executing the command
|
||||
function omz_termsupport_preexec {
|
||||
emulate -L zsh
|
||||
if [[ $DISABLE_AUTO_TITLE == true ]]; then
|
||||
setopt extended_glob
|
||||
|
||||
if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
setopt extended_glob
|
||||
|
||||
# cmd name only, or if this is sudo or ssh, the next cmd
|
||||
local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
|
||||
local LINE="${2:gs/%/%%}"
|
||||
@ -66,19 +84,18 @@ preexec_functions+=(omz_termsupport_preexec)
|
||||
# With extra fixes to handle multibyte chars and non-UTF-8 locales
|
||||
|
||||
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
|
||||
|
||||
# Emits the control sequence to notify Terminal.app of the cwd
|
||||
# Identifies the directory using a file: URI scheme, including
|
||||
# the host name to disambiguate local vs. remote paths.
|
||||
function update_terminalapp_cwd() {
|
||||
emulate -L zsh
|
||||
# Identify the directory using a "file:" scheme URL, including
|
||||
# the host name to disambiguate local vs. remote paths.
|
||||
|
||||
# Percent-encode the pathname.
|
||||
local URL_PATH=$(omz_urlencode -P $PWD)
|
||||
local URL_PATH="$(omz_urlencode -P $PWD)"
|
||||
[[ $? != 0 ]] && return 1
|
||||
local PWD_URL="file://$HOST$URL_PATH"
|
||||
|
||||
# Undocumented Terminal.app-specific control sequence
|
||||
printf '\e]7;%s\a' $PWD_URL
|
||||
printf '\e]7;%s\a' "file://$HOST$URL_PATH"
|
||||
}
|
||||
|
||||
# Use a precmd hook instead of a chpwd hook to avoid contaminating output
|
||||
|
@ -1,38 +1,49 @@
|
||||
# ls colors
|
||||
autoload -U colors && colors
|
||||
export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
||||
|
||||
# Enable ls colors
|
||||
if [ "$DISABLE_LS_COLORS" != "true" ]
|
||||
then
|
||||
# Find the option for using colors in ls, depending on the version: Linux or BSD
|
||||
if [[ "$(uname -s)" == "NetBSD" ]]; then
|
||||
export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
||||
|
||||
# TODO organise this chaotic logic
|
||||
|
||||
if [[ "$DISABLE_LS_COLORS" != "true" ]]; then
|
||||
# Find the option for using colors in ls, depending on the version
|
||||
if [[ "$OSTYPE" == netbsd* ]]; then
|
||||
# On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
|
||||
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
|
||||
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
|
||||
elif [[ "$(uname -s)" == "OpenBSD" ]]; then
|
||||
gls --color -d . &>/dev/null && alias ls='gls --color=tty'
|
||||
elif [[ "$OSTYPE" == openbsd* ]]; then
|
||||
# On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base,
|
||||
# with color and multibyte support) are available from ports. "colorls"
|
||||
# will be installed on purpose and can't be pulled in by installing
|
||||
# coreutils, so prefer it to "gls".
|
||||
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
|
||||
colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G'
|
||||
gls --color -d . &>/dev/null && alias ls='gls --color=tty'
|
||||
colorls -G -d . &>/dev/null && alias ls='colorls -G'
|
||||
elif [[ "$OSTYPE" == darwin* ]]; then
|
||||
# this is a good alias, it works by default just using $LSCOLORS
|
||||
ls -G . &>/dev/null && alias ls='ls -G'
|
||||
|
||||
# only use coreutils ls if there is a dircolors customization present ($LS_COLORS or .dircolors file)
|
||||
# otherwise, gls will use the default color scheme which is ugly af
|
||||
[[ -n "$LS_COLORS" || -f "$HOME/.dircolors" ]] && gls --color -d . &>/dev/null && alias ls='gls --color=tty'
|
||||
else
|
||||
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
|
||||
# For GNU ls, we use the default ls color theme. They can later be overwritten by themes.
|
||||
if [[ -z "$LS_COLORS" ]]; then
|
||||
(( $+commands[dircolors] )) && eval "$(dircolors -b)"
|
||||
fi
|
||||
|
||||
ls --color -d . &>/dev/null && alias ls='ls --color=tty' || { ls -G . &>/dev/null && alias ls='ls -G' }
|
||||
|
||||
# Take advantage of $LS_COLORS for completion as well.
|
||||
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
||||
fi
|
||||
fi
|
||||
|
||||
#setopt no_beep
|
||||
setopt auto_cd
|
||||
setopt multios
|
||||
setopt cdablevars
|
||||
setopt prompt_subst
|
||||
|
||||
if [[ x$WINDOW != x ]]
|
||||
then
|
||||
SCREEN_NO="%B$WINDOW%b "
|
||||
else
|
||||
SCREEN_NO=""
|
||||
fi
|
||||
[[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO=""
|
||||
|
||||
# Apply theming defaults
|
||||
PS1="%n@%m:%~%# "
|
||||
@ -42,6 +53,3 @@ ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of th
|
||||
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
|
||||
|
||||
# Setup the prompt with pretty colors
|
||||
setopt prompt_subst
|
||||
|
@ -1,4 +0,0 @@
|
||||
This file is only here so that Git will keep a log directory as .gitignore is ignoring all the log files within it.
|
||||
|
||||
feel free to add love notes for people here.
|
||||
|
0
log/.gitkeep
Normal file
0
log/.gitkeep
Normal file
22
oh-my-zsh.sh
22
oh-my-zsh.sh
@ -11,6 +11,8 @@ 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
|
||||
@ -20,7 +22,7 @@ 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/"
|
||||
ZSH_CACHE_DIR="$ZSH/cache"
|
||||
fi
|
||||
|
||||
|
||||
@ -51,7 +53,7 @@ done
|
||||
|
||||
# Figure out the SHORT hostname
|
||||
if [[ "$OSTYPE" = darwin* ]]; then
|
||||
# OS X's $HOST changes with dhcp, etc. Use ComputerName if possible.
|
||||
# macOS's $HOST changes with dhcp, etc. Use ComputerName if possible.
|
||||
SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/}
|
||||
else
|
||||
SHORT_HOST=${HOST/.*/}
|
||||
@ -62,13 +64,17 @@ if [ -z "$ZSH_COMPDUMP" ]; then
|
||||
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
|
||||
fi
|
||||
|
||||
# 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.
|
||||
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
|
||||
else
|
||||
compinit -d "${ZSH_COMPDUMP}"
|
||||
compinit -i -d "${ZSH_COMPDUMP}"
|
||||
fi
|
||||
|
||||
# Load all of the plugins that were defined in ~/.zshrc
|
||||
|
@ -13,9 +13,13 @@ _1st_arguments=(
|
||||
'disconnect:disconnect from a TCP/IP device. Port 5555 is default.'
|
||||
'emu:run emulator console command'
|
||||
'forward:forward socket connections'
|
||||
'get-devpath:print the device path'
|
||||
'get-serialno:print the serial number of the device'
|
||||
'get-state:print the current state of the device: offline | bootloader | device'
|
||||
'help:show the help message'
|
||||
'install:push this package file to the device and install it'
|
||||
'jdwp:list PIDs of processes hosting a JDWP transport'
|
||||
'keygen:generate adb public/private key'
|
||||
'kill-server:kill the server if it is running'
|
||||
'logcat:view device log'
|
||||
'pull:copy file/dir from device'
|
||||
@ -30,6 +34,7 @@ _1st_arguments=(
|
||||
'start-server:ensure that there is a server running'
|
||||
'tcpip:restart host adb in tcpip mode'
|
||||
'uninstall:remove this app package from the device'
|
||||
'usb:restart the adbd daemon listing on USB'
|
||||
'version:show version num'
|
||||
'wait-for-device:block until device is online'
|
||||
)
|
||||
|
5
plugins/arcanist/README.md
Normal file
5
plugins/arcanist/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
## arcanist
|
||||
|
||||
**Maintainer:** [@emzar](https://github.com/emzar)
|
||||
|
||||
This plugin adds many useful aliases.
|
21
plugins/arcanist/arcanist.plugin.zsh
Normal file
21
plugins/arcanist/arcanist.plugin.zsh
Normal file
@ -0,0 +1,21 @@
|
||||
#
|
||||
# Aliases
|
||||
# (sorted alphabetically)
|
||||
#
|
||||
|
||||
alias ara='arc amend'
|
||||
alias arb='arc branch'
|
||||
alias arco='arc cover'
|
||||
alias arci='arc commit'
|
||||
|
||||
alias ard='arc diff'
|
||||
alias ardnu='arc diff --nounit'
|
||||
alias ardnupc='arc diff --nounit --plan-changes'
|
||||
alias ardpc='arc diff --plan-changes'
|
||||
|
||||
alias are='arc export'
|
||||
alias arh='arc help'
|
||||
alias arl='arc land'
|
||||
alias arli='arc lint'
|
||||
alias arls='arc list'
|
||||
alias arpa='arc patch'
|
@ -1,64 +1,97 @@
|
||||
## ARCHLINUX PLUGIN
|
||||
# Archlinux plugin
|
||||
|
||||
## Features
|
||||
|
||||
#### YAOURT
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|------------------------------------|---------------------------------------------------------------------|
|
||||
| yaconf | yaourt -C | Fix all configuration files with vimdiff |
|
||||
| yain | yaourt -S | Install packages from the repositories |
|
||||
| yains | yaourt -U | Install a package from a local file |
|
||||
| yainsd | yaourt -S --asdeps | Install packages as dependencies of another package |
|
||||
| yaloc | yaourt -Qi | Display information about a package in the local database |
|
||||
| yalocs | yaourt -Qs | Search for packages in the local database |
|
||||
| yalst | yaourt -Qe | List installed packages including from AUR (tagged as "local") |
|
||||
| yamir | yaourt -Syy | Force refresh of all package lists after updating mirrorlist |
|
||||
| yaorph | yaourt -Qtd | Remove orphans using yaourt |
|
||||
| yare | yaourt -R | Remove packages, keeping its settings and dependencies |
|
||||
| yarem | yaourt -Rns | Remove packages, including its settings and unneeded dependencies |
|
||||
| yarep | yaourt -Si | Display information about a package in the repositories |
|
||||
| yareps | yaourt -Ss | Search for packages in the repositories |
|
||||
| yaupd | yaourt -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases |
|
||||
| yaupd | yaourt -Sy && sudo abs | Update and refresh the local package and ABS databases |
|
||||
| yaupd | yaourt -Sy && sudo aur | Update and refresh the local package and AUR databases |
|
||||
| yaupd | yaourt -Sy | Update and refresh the local package database |
|
||||
| yaupg | yaourt -Syua | Sync with repositories before upgrading all packages (from AUR too) |
|
||||
| yasu | yaourt -Syua --no-confirm | Same as `yaupg`, but without confirmation |
|
||||
| upgrade | yaourt -Syu | Sync with repositories before upgrading packages |
|
||||
|
||||
### PACAUR
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|------------------------------------|---------------------------------------------------------------------|
|
||||
| pain | pacaur -S | Install packages from the repositories |
|
||||
| pains | pacaur -U | Install a package from a local file |
|
||||
| painsd | pacaur -S --asdeps | Install packages as dependencies of another package |
|
||||
| paloc | pacaur -Qi | Display information about a package in the local database |
|
||||
| palocs | pacaur -Qs | Search for packages in the local database |
|
||||
| palst | pacaur -Qe | List installed packages including from AUR (tagged as "local") |
|
||||
| pamir | pacaur -Syy | Force refresh of all package lists after updating mirrorlist |
|
||||
| paorph | pacaur -Qtd | Remove orphans using pacaur |
|
||||
| pare | pacaur -R | Remove packages, keeping its settings and dependencies |
|
||||
| parem | pacaur -Rns | Remove packages, including its settings and unneeded dependencies |
|
||||
| parep | pacaur -Si | Display information about a package in the repositories |
|
||||
| pareps | pacaur -Ss | Search for packages in the repositories |
|
||||
| paupd | pacaur -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases |
|
||||
| paupd | pacaur -Sy && sudo abs | Update and refresh the local package and ABS databases |
|
||||
| paupd | pacaur -Sy && sudo aur | Update and refresh the local package and AUR databases |
|
||||
| paupd | pacaur -Sy | Update and refresh the local package database |
|
||||
| paupg | pacaur -Syua | Sync with repositories before upgrading all packages (from AUR too) |
|
||||
| pasu | pacaur -Syua --no-confirm | Same as `paupg`, but without confirmation |
|
||||
| upgrade | pacaur -Syu | Sync with repositories before upgrading packages |
|
||||
|
||||
#### PACMAN
|
||||
|
||||
| Alias | Command | Description |
|
||||
|--------------|-----------------------------------------|--------------------------------------------------------------|
|
||||
| pacin | sudo pacman -S | Install packages from the repositories |
|
||||
| pacins | sudo pacman -U | Install a package from a local file |
|
||||
| pacinsd | sudo pacman -S --asdeps | Install packages as dependencies of another package |
|
||||
| pacloc | pacman -Qi | Display information about a package in the local database |
|
||||
| paclocs | pacman -Qs | Search for packages in the local database |
|
||||
| paclsorphans | sudo pacman -Qdt | List all orphaned packages |
|
||||
| pacmir | sudo pacman -Syy | Force refresh of all package lists after updating mirrorlist |
|
||||
| pacre | sudo pacman -R | Remove packages, keeping its settings and dependencies |
|
||||
| pacrem | sudo pacman -Rns | Remove packages, including its settings and dependencies |
|
||||
| pacrep | pacman -Si | Display information about a package in the repositories |
|
||||
| pacreps | pacman -Ss | Search for packages in the repositories |
|
||||
| pacrmorphans | sudo pacman -Rs $(pacman -Qtdq) | Delete all orphaned packages |
|
||||
| pacupd | sudo pacman -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases |
|
||||
| pacupd | sudo pacman -Sy && sudo abs | Update and refresh the local package and ABS databases |
|
||||
| pacupd | sudo pacman -Sy && sudo aur | Update and refresh the local package and AUR databases |
|
||||
| pacupd | sudo pacman -Sy | Update and refresh the local package database |
|
||||
| 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. |
|
||||
|
||||
| Function | Description |
|
||||
|----------------|------------------------------------------------------|
|
||||
| pacdisowned | List all disowned files in your system |
|
||||
| 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 |
|
||||
|
||||
---
|
||||
|
||||
### FEATURES
|
||||
## Contributors
|
||||
|
||||
| Alias | Function | Description |
|
||||
|:------------:|-----------------------------------------|:--------------------------------------------------------------------------------------------------------------------|
|
||||
| pacin | sudo pacman -S | Install specific package(s) from the repositories |
|
||||
| pacins | sudo pacman -U | Install specific package not from the repositories but from a file |
|
||||
| pacinsd | sudo pacman -S --asdeps | Install given package(s) as dependencies of another package |
|
||||
| pacloc | pacman -Qi | Display information about a given package in the local database |
|
||||
| paclocs | pacman -Qs | Search for package(s) in the local database |
|
||||
| paclsorphans | sudo pacman -Qdt' | List all orphaned packages |
|
||||
| pacmir | sudo pacman -Syy | Force refresh of all package lists after updating /etc/pacman.d/mirrorlist |
|
||||
| pacre | sudo pacman -R | Remove the specified package(s), retaining its configuration(s) and required dependencies |
|
||||
| pacrem | sudo pacman -Rns | Remove the specified package(s), its configuration(s) and unneeded dependencies |
|
||||
| pacrep | pacman -Si | Display information about a given package in the repositories |
|
||||
| pacreps | pacman -Ss | Search for package(s) in the repositories |
|
||||
| pacrmorphans | sudo pacman -Rs $(pacman -Qtdq)' | Delete all orphaned packages |
|
||||
| pacupd | sudo pacman -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases against repositories |
|
||||
| pacupd | sudo pacman -Sy && sudo abs | Update and refresh the local package and ABS databases against repositories |
|
||||
| pacupd | sudo pacman -Sy && sudo aur | Update and refresh the local package and AUR databases against repositories |
|
||||
| pacupd | sudo pacman -Sy | Update and refresh the local package database against repositories |
|
||||
| pacupg | sudo pacman -Syu | Synchronize with repositories before upgrading packages that are out of date on the local system. |
|
||||
| yaconf | yaourt -C | Fix all configuration files with vimdiff |
|
||||
| yain | yaourt -S | Install specific package(s) from the repositories |
|
||||
| yains | yaourt -U | Install specific package not from the repositories but from a file |
|
||||
| yainsd | yaourt -S --asdeps | Install given package(s) as dependencies of another package |
|
||||
| yaloc | yaourt -Qi | Display information about a given package in the local database |
|
||||
| yalocs | yaourt -Qs | Search for package(s) in the local database |
|
||||
| yalst | yaourt -Qe | List installed packages, even those installed from AUR (they're tagged as "local") |
|
||||
| yamir | yaourt -Syy | Force refresh of all package lists after updating /etc/pacman.d/mirrorlist |
|
||||
| yaorph | yaourt -Qtd | Remove orphans using yaourt |
|
||||
| yare | yaourt -R | Remove the specified package(s), retaining its configuration(s) and required dependencies |
|
||||
| yarem | yaourt -Rns | Remove the specified package(s), its configuration(s) and unneeded dependencies |
|
||||
| yarep | yaourt -Si | Display information about a given package in the repositories |
|
||||
| yareps | yaourt -Ss | Search for package(s) in the repositories |
|
||||
| yasu | yaourt --sucre | Same as yaupg, but without confirmation |
|
||||
| yaupd | yaourt -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases against repositories |
|
||||
| yaupd | yaourt -Sy && sudo abs | Update and refresh the local package and ABS databases against repositories |
|
||||
| yaupd | yaourt -Sy && sudo aur | Update and refresh the local package and AUR databases against repositories |
|
||||
| yaupd | yaourt -Sy | Update and refresh the local package database against repositories |
|
||||
| yaupg | yaourt -Syua | Synchronize with repositories before upgrading packages (AUR packages too) that are out of date on the local system |
|
||||
|
||||
| Function | Description |
|
||||
|----------------|:------------------------------------------------------------------------------------------------------------------|
|
||||
| pacdisowned | List all disowned files in your system |
|
||||
| paclist | List all installed packages with a short description - [Source](https://bbs.archlinux.org/viewtopic.php?id=93683) |
|
||||
| pacmanallkeys | Get all keys for developers and trusted users |
|
||||
| pacmansignkeys | |
|
||||
|
||||
---
|
||||
|
||||
### CONTRIBUTORS
|
||||
- Benjamin Boudreau - dreurmail@gmail.com
|
||||
- Celso Miranda - contacto@celsomiranda.net
|
||||
- KhasMek - Boushh@gmail.com
|
||||
- Martin Putniorz - mputniorz@gmail.com
|
||||
- MatthR3D - matthr3d@gmail.com
|
||||
- ornicar - thibault.duplessis@gmail.com
|
||||
|
||||
---
|
||||
- Benjamin Boudreau - dreurmail@gmail.com
|
||||
- Celso Miranda - contacto@celsomiranda.net
|
||||
- KhasMek - Boushh@gmail.com
|
||||
- Martin Putniorz - mputniorz@gmail.com
|
||||
- MatthR3D - matthr3d@gmail.com
|
||||
- ornicar - thibault.duplessis@gmail.com
|
||||
- Juraj Fiala - doctorjellyface@riseup.net
|
||||
- Majora320 (Moses Miller) - Majora320@gmail.com
|
||||
|
@ -1,75 +1,110 @@
|
||||
# Archlinux zsh aliases and functions
|
||||
# Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
|
||||
if (( $+commands[yaourt] )); then
|
||||
alias yaconf='yaourt -C'
|
||||
alias yaupg='yaourt -Syua'
|
||||
alias yasu='yaourt -Syua --noconfirm'
|
||||
alias yain='yaourt -S'
|
||||
alias yains='yaourt -U'
|
||||
alias yare='yaourt -R'
|
||||
alias yarem='yaourt -Rns'
|
||||
alias yarep='yaourt -Si'
|
||||
alias yareps='yaourt -Ss'
|
||||
alias yaloc='yaourt -Qi'
|
||||
alias yalocs='yaourt -Qs'
|
||||
alias yalst='yaourt -Qe'
|
||||
alias yaorph='yaourt -Qtd'
|
||||
alias yainsd='yaourt -S --asdeps'
|
||||
alias yamir='yaourt -Syy'
|
||||
|
||||
# Look for yaourt, and add some useful functions if we have it.
|
||||
if [[ -x `command -v yaourt` ]]; then
|
||||
upgrade () {
|
||||
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias yaupd='yaourt -Sy && sudo abs && sudo aur'
|
||||
elif (( $+commands[abs] )); then
|
||||
alias yaupd='yaourt -Sy && sudo abs'
|
||||
elif (( $+commands[aur] )); then
|
||||
alias yaupd='yaourt -Sy && sudo aur'
|
||||
else
|
||||
alias yaupd='yaourt -Sy'
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $+commands[pacaur] )); then
|
||||
alias paupg='pacaur -Syua'
|
||||
alias pasu='pacaur -Syua --noconfirm'
|
||||
alias pain='pacaur -S'
|
||||
alias pains='pacaur -U'
|
||||
alias pare='pacaur -R'
|
||||
alias parem='pacaur -Rns'
|
||||
alias parep='pacaur -Si'
|
||||
alias pareps='pacaur -Ss'
|
||||
alias paloc='pacaur -Qi'
|
||||
alias palocs='pacaur -Qs'
|
||||
alias palst='pacaur -Qe'
|
||||
alias paorph='pacaur -Qtd'
|
||||
alias painsd='pacaur -S --asdeps'
|
||||
alias pamir='pacaur -Syy'
|
||||
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias paupd='pacaur -Sy && sudo abs && sudo aur'
|
||||
elif (( $+commands[abs] )); then
|
||||
alias paupd='pacaur -Sy && sudo abs'
|
||||
elif (( $+commands[aur] )); then
|
||||
alias paupd='pacaur -Sy && sudo aur'
|
||||
else
|
||||
alias paupd='pacaur -Sy'
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $+commands[pacaur] )); then
|
||||
upgrade() {
|
||||
pacaur -Syu
|
||||
}
|
||||
elif (( $+commands[yaourt] )); then
|
||||
upgrade() {
|
||||
yaourt -Syu
|
||||
}
|
||||
alias yaconf='yaourt -C' # Fix all configuration files with vimdiff
|
||||
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
|
||||
alias yaupg='yaourt -Syua' # Synchronize with repositories before upgrading packages (AUR packages too) that are out of date on the local system.
|
||||
alias yasu='yaourt --sucre' # Same as yaupg, but without confirmation
|
||||
alias yain='yaourt -S' # Install specific package(s) from the repositories
|
||||
alias yains='yaourt -U' # Install specific package not from the repositories but from a file
|
||||
alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
|
||||
alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
|
||||
alias yarep='yaourt -Si' # Display information about a given package in the repositories
|
||||
alias yareps='yaourt -Ss' # Search for package(s) in the repositories
|
||||
alias yaloc='yaourt -Qi' # Display information about a given package in the local database
|
||||
alias yalocs='yaourt -Qs' # Search for package(s) in the local database
|
||||
alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local")
|
||||
alias yaorph='yaourt -Qtd' # Remove orphans using yaourt
|
||||
# Additional yaourt alias examples
|
||||
if [[ -x `command -v abs` && -x `command -v aur` ]]; then
|
||||
alias yaupd='yaourt -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
|
||||
elif [[ -x `command -v abs` ]]; then
|
||||
alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
|
||||
elif [[ -x `command -v aur` ]]; then
|
||||
alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
|
||||
else
|
||||
alias yaupd='yaourt -Sy' # Update and refresh the local package database against repositories
|
||||
fi
|
||||
alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package
|
||||
alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
|
||||
else
|
||||
upgrade() {
|
||||
sudo pacman -Syu
|
||||
}
|
||||
upgrade() {
|
||||
sudo pacman -Syu
|
||||
}
|
||||
fi
|
||||
|
||||
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
|
||||
alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
|
||||
alias pacin='sudo pacman -S' # Install specific package(s) from the repositories
|
||||
alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file
|
||||
alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
|
||||
alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
|
||||
alias pacrep='pacman -Si' # Display information about a given package in the repositories
|
||||
alias pacreps='pacman -Ss' # Search for package(s) in the repositories
|
||||
alias pacloc='pacman -Qi' # Display information about a given package in the local database
|
||||
alias paclocs='pacman -Qs' # Search for package(s) in the local database
|
||||
# Additional pacman alias examples
|
||||
if [[ -x `command -v abs` && -x `command -v aur` ]]; then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
|
||||
elif [[ -x `command -v abs` ]]; then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
|
||||
elif [[ -x `command -v aur` ]]; then
|
||||
alias pacupd='sudo pacman -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
|
||||
else
|
||||
alias pacupd='sudo pacman -Sy' # Update and refresh the local package database against repositories
|
||||
fi
|
||||
alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package
|
||||
alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
|
||||
|
||||
# https://bbs.archlinux.org/viewtopic.php?id=93683
|
||||
paclist() {
|
||||
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}'
|
||||
}
|
||||
|
||||
alias pacupg='sudo pacman -Syu'
|
||||
alias pacin='sudo pacman -S'
|
||||
alias pacins='sudo pacman -U'
|
||||
alias pacre='sudo pacman -R'
|
||||
alias pacrem='sudo pacman -Rns'
|
||||
alias pacrep='pacman -Si'
|
||||
alias pacreps='pacman -Ss'
|
||||
alias pacloc='pacman -Qi'
|
||||
alias paclocs='pacman -Qs'
|
||||
alias pacinsd='sudo pacman -S --asdeps'
|
||||
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'
|
||||
|
||||
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs && sudo aur'
|
||||
elif (( $+commands[abs] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs'
|
||||
elif (( $+commands[aur] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo aur'
|
||||
else
|
||||
alias pacupd='sudo pacman -Sy'
|
||||
fi
|
||||
|
||||
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() {
|
||||
emulate -L zsh
|
||||
|
||||
tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
|
||||
db=$tmp/db
|
||||
fs=$tmp/fs
|
||||
@ -79,21 +114,21 @@ pacdisowned() {
|
||||
|
||||
pacman -Qlq | sort -u > "$db"
|
||||
|
||||
find /bin /etc /lib /sbin /usr \
|
||||
! -name lost+found \
|
||||
\( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
|
||||
find /bin /etc /lib /sbin /usr ! -name lost+found \
|
||||
\( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
|
||||
|
||||
comm -23 "$fs" "$db"
|
||||
}
|
||||
|
||||
pacmanallkeys() {
|
||||
# Get all keys for developers and trusted users
|
||||
curl https://www.archlinux.org/{developers,trustedusers}/ |
|
||||
awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' |
|
||||
xargs sudo pacman-key --recv-keys
|
||||
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() {
|
||||
emulate -L zsh
|
||||
for key in $*; do
|
||||
sudo pacman-key --recv-keys $key
|
||||
sudo pacman-key --lsign-key $key
|
||||
|
27
plugins/asdf/README.md
Normal file
27
plugins/asdf/README.md
Normal file
@ -0,0 +1,27 @@
|
||||
## asdf
|
||||
|
||||
**Maintainer:** [@RobLoach](https://github.com/RobLoach)
|
||||
|
||||
Adds integration with [asdf](https://github.com/asdf-vm/asdf), the extendable version manager, with support for Ruby, Node.js, Elixir, Erlang and more.
|
||||
|
||||
### Installation
|
||||
|
||||
1. Enable the plugin by adding it to your `plugins` definition in `~/.zshrc`.
|
||||
|
||||
```
|
||||
plugins=(asdf)
|
||||
```
|
||||
|
||||
2. [Install asdf](https://github.com/asdf-vm/asdf#setup) by running the following:
|
||||
```
|
||||
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
See the [asdf usage documentation](https://github.com/asdf-vm/asdf#usage) for information on how to use asdf:
|
||||
|
||||
```
|
||||
asdf plugin-add nodejs git@github.com:asdf-vm/asdf-nodejs.git
|
||||
asdf install nodejs 5.9.1
|
||||
```
|
7
plugins/asdf/asdf.plugin.zsh
Normal file
7
plugins/asdf/asdf.plugin.zsh
Normal file
@ -0,0 +1,7 @@
|
||||
# Find where asdf should be installed.
|
||||
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
||||
|
||||
# Load asdf, if found.
|
||||
if [ -f $ASDF_DIR/asdf.sh ]; then
|
||||
. $ASDF_DIR/asdf.sh
|
||||
fi
|
@ -1,23 +0,0 @@
|
||||
## atom
|
||||
|
||||
This plugin makes "at" a useful function for invoking the Atom Editor.
|
||||
|
||||
Originally by Github user [aforty](https://github.com/aforty) for OSX, modified to alias 'at' to 'atom' for Linux, since atom already works on the terminal for Linux, and calling 'at' in a non-OSX environment should still work.
|
||||
|
||||
### Requirements
|
||||
|
||||
* [Atom](https://atom.io/)
|
||||
|
||||
### Usage
|
||||
|
||||
* If `at` command is called without an argument, launch Atom
|
||||
|
||||
* If `at` is passed a directory, open it in Atom
|
||||
|
||||
* If `at` is passed a file, open it in Atom
|
||||
|
||||
### Examples
|
||||
|
||||
* Open the current dir in atom: `at .`
|
||||
* Open another dir in atom: `at path/to/folder`
|
||||
* Open a file: `at filename.extension`
|
@ -1,37 +0,0 @@
|
||||
case $OSTYPE in
|
||||
darwin*)
|
||||
local _atom_paths > /dev/null 2>&1
|
||||
_atom_paths=(
|
||||
"$HOME/Applications/Atom.app"
|
||||
"/Applications/Atom.app"
|
||||
)
|
||||
|
||||
for _atom_path in $_atom_paths; do
|
||||
if [[ -a $_atom_path ]]; then
|
||||
alias at="open -a '$_atom_path'"
|
||||
break
|
||||
fi
|
||||
done
|
||||
;;
|
||||
cygwin)
|
||||
local _atom_path > /dev/null 2>&1
|
||||
|
||||
_atom_path=${LOCALAPPDATA}/atom/bin/atom
|
||||
|
||||
if [[ -a $_atom_path ]]; then
|
||||
cyg_open_atom()
|
||||
{
|
||||
if [[ -n $1 ]]; then
|
||||
${_atom_path} `cygpath -w -a $1`
|
||||
else
|
||||
${_atom_path}
|
||||
fi
|
||||
}
|
||||
|
||||
alias at=cyg_open_atom
|
||||
fi
|
||||
;;
|
||||
linux*)
|
||||
# Alerts the user if 'atom' is not a found command.
|
||||
type atom >/dev/null 2>&1 && alias at="atom" || { echo >&2 "You have enabled the atom oh-my-zsh plugin on Linux, but atom is not a recognized command. Please make sure you have it installed before using this plugin."; }
|
||||
esac
|
@ -1,12 +1,26 @@
|
||||
# Activates autoenv or reports its failure
|
||||
if ! source $HOME/.autoenv/activate.sh 2>/dev/null; then
|
||||
echo '-------- AUTOENV ---------'
|
||||
echo 'Could not find ~/.autoenv/activate.sh.'
|
||||
echo 'Please check if autoenv is correctly installed.'
|
||||
echo 'In the meantime the autoenv plugin is DISABLED.'
|
||||
echo '--------------------------'
|
||||
return 1
|
||||
() {
|
||||
if ! type autoenv_init >/dev/null; then
|
||||
for d (~/.autoenv ~/.local/bin /usr/local/opt/autoenv /usr/local/bin); do
|
||||
if [[ -e $d/activate.sh ]]; then
|
||||
autoenv_dir=$d
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ -z $autoenv_dir ]]; then
|
||||
cat <<END >&2
|
||||
-------- AUTOENV ---------
|
||||
Could not locate autoenv installation.
|
||||
Please check if autoenv is correctly installed.
|
||||
In the meantime the autoenv plugin is DISABLED.
|
||||
--------------------------
|
||||
END
|
||||
return 1
|
||||
fi
|
||||
source $autoenv_dir/activate.sh
|
||||
fi
|
||||
}
|
||||
[[ $? != 0 ]] && return $?
|
||||
|
||||
# The use_env call below is a reusable command to activate/create a new Python
|
||||
# virtualenv, requiring only a single declarative line of code in your .env files.
|
||||
|
@ -64,15 +64,15 @@ if [[ "$OSTYPE" = darwin* ]] ; then
|
||||
[[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]]
|
||||
}
|
||||
|
||||
elif [[ $(uname) == "Linux" ]] ; then
|
||||
elif [[ "$OSTYPE" = linux* ]] ; then
|
||||
|
||||
function battery_is_charging() {
|
||||
! [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]]
|
||||
! [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]]
|
||||
}
|
||||
|
||||
function battery_pct() {
|
||||
if (( $+commands[acpi] )) ; then
|
||||
echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')"
|
||||
echo "$(acpi 2>/dev/null | cut -f2 -d ',' | tr -cd '[:digit:]')"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -85,14 +85,14 @@ elif [[ $(uname) == "Linux" ]] ; then
|
||||
}
|
||||
|
||||
function battery_time_remaining() {
|
||||
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
echo $(acpi | cut -f3 -d ',')
|
||||
if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
echo $(acpi 2>/dev/null | cut -f3 -d ',')
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_pct_prompt() {
|
||||
b=$(battery_pct_remaining)
|
||||
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
if [ $b -gt 50 ] ; then
|
||||
color='green'
|
||||
elif [ $b -gt 20 ] ; then
|
||||
@ -100,7 +100,7 @@ elif [[ $(uname) == "Linux" ]] ; then
|
||||
else
|
||||
color='red'
|
||||
fi
|
||||
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
|
||||
echo "%{$fg[$color]%}$(battery_pct_remaining)%%%{$reset_color%}"
|
||||
else
|
||||
echo "∞"
|
||||
fi
|
||||
|
@ -72,6 +72,7 @@ _bower ()
|
||||
compadd "$@" $(echo $bower_package_list)
|
||||
;;
|
||||
*)
|
||||
_arguments \
|
||||
$_no_color \
|
||||
;;
|
||||
esac
|
||||
|
33
plugins/branch/README.md
Normal file
33
plugins/branch/README.md
Normal file
@ -0,0 +1,33 @@
|
||||
# Branch
|
||||
|
||||
Displays the current Git or Mercurial branch fast.
|
||||
|
||||
## Speed test
|
||||
|
||||
### Mercurial
|
||||
|
||||
```shell
|
||||
$ time hg branch
|
||||
0.11s user 0.14s system 70% cpu 0.355 total
|
||||
```
|
||||
|
||||
### Branch plugin
|
||||
|
||||
```shell
|
||||
$ time zsh /tmp/branch_prompt_info_test.zsh
|
||||
0.00s user 0.01s system 78% cpu 0.014 total
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Edit your theme file (eg.: `~/.oh-my-zsh/theme/robbyrussell.zsh-theme`)
|
||||
adding `$(branch_prompt_info)` in your prompt like this:
|
||||
|
||||
```diff
|
||||
- PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||
+ PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(branch_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||
```
|
||||
|
||||
## Maintainer
|
||||
|
||||
Victor Torres (<vpaivatorres@gmail.com>)
|
31
plugins/branch/branch.plugin.zsh
Normal file
31
plugins/branch/branch.plugin.zsh
Normal file
@ -0,0 +1,31 @@
|
||||
# Branch: displays the current Git or Mercurial branch fast.
|
||||
# Victor Torres <vpaivatorres@gmail.com>
|
||||
# Oct 2, 2015
|
||||
|
||||
function branch_prompt_info() {
|
||||
# Defines path as current directory
|
||||
local current_dir=$PWD
|
||||
# While current path is not root path
|
||||
while [[ $current_dir != '/' ]]
|
||||
do
|
||||
# Git repository
|
||||
if [[ -d "${current_dir}/.git" ]]
|
||||
then
|
||||
echo '±' ${"$(<"$current_dir/.git/HEAD")"##*/}
|
||||
return;
|
||||
fi
|
||||
# Mercurial repository
|
||||
if [[ -d "${current_dir}/.hg" ]]
|
||||
then
|
||||
if [[ -f "$current_dir/.hg/branch" ]]
|
||||
then
|
||||
echo '☿' $(<"$current_dir/.hg/branch")
|
||||
else
|
||||
echo '☿ default'
|
||||
fi
|
||||
return;
|
||||
fi
|
||||
# Defines path as parent directory and keeps looking for :)
|
||||
current_dir="${current_dir:h}"
|
||||
done
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
# Autocompletion for homebrew-cask.
|
||||
#
|
||||
# This script intercepts calls to the brew plugin and adds autocompletion
|
||||
# for the cask subcommand.
|
||||
#
|
||||
# Author: https://github.com/pstadler
|
||||
|
||||
compdef _brew-cask brew
|
||||
|
||||
_brew-cask()
|
||||
{
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
':subcmd:->subcmd' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
__call_original_brew
|
||||
cask_commands=(
|
||||
'cask:manage casks'
|
||||
)
|
||||
_describe -t commands 'brew cask command' cask_commands ;;
|
||||
|
||||
(subcmd)
|
||||
case "$line[1]" in
|
||||
cask)
|
||||
if (( CURRENT == 3 )); then
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
"alfred:used to modify Alfred's scope to include the Caskroom"
|
||||
'audit:verifies installability of casks'
|
||||
'checklinks:checks for bad cask links'
|
||||
'cleanup:cleans up cached downloads'
|
||||
'create:creates a cask of the given name and opens it in an editor'
|
||||
'doctor:checks for configuration issues'
|
||||
'edit:edits the cask of the given name'
|
||||
'fetch:downloads Cask resources to local cache'
|
||||
'home:opens the homepage of the cask of the given name'
|
||||
'info:displays information about the cask of the given name'
|
||||
'install:installs the cask of the given name'
|
||||
'list:with no args, lists installed casks; given installed casks, lists installed files'
|
||||
'search:searches all known casks'
|
||||
'uninstall:uninstalls the cask of the given name'
|
||||
"update:a synonym for 'brew update'"
|
||||
)
|
||||
_describe -t commands "brew cask subcommand" subcommands
|
||||
fi ;;
|
||||
|
||||
*)
|
||||
__call_original_brew ;;
|
||||
esac ;;
|
||||
|
||||
(options)
|
||||
local -a casks installed_casks
|
||||
local expl
|
||||
case "$line[2]" in
|
||||
list|uninstall)
|
||||
__brew_installed_casks
|
||||
_wanted installed_casks expl 'installed casks' compadd -a installed_casks ;;
|
||||
audit|edit|home|info|install)
|
||||
__brew_all_casks
|
||||
_wanted casks expl 'all casks' compadd -a casks ;;
|
||||
esac ;;
|
||||
esac
|
||||
}
|
||||
|
||||
__brew_all_casks() {
|
||||
casks=(`brew cask search`)
|
||||
}
|
||||
|
||||
__brew_installed_casks() {
|
||||
installed_casks=(`brew cask list`)
|
||||
}
|
||||
|
||||
__call_original_brew()
|
||||
{
|
||||
local ret=1
|
||||
_call_function ret _brew
|
||||
compdef _brew-cask brew
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
#compdef brew
|
||||
#autoload
|
||||
|
||||
# imported from the latest homebrew contributions
|
||||
|
||||
_brew_all_formulae() {
|
||||
formulae=(`brew search`)
|
||||
}
|
||||
|
||||
_brew_installed_formulae() {
|
||||
installed_formulae=(`brew list`)
|
||||
}
|
||||
|
||||
_brew_installed_taps() {
|
||||
installed_taps=(`brew tap`)
|
||||
}
|
||||
|
||||
_brew_outdated_formulae() {
|
||||
outdated_formulae=(`brew outdated`)
|
||||
}
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'audit:check formulae for Homebrew coding style'
|
||||
'cat:display formula file for a formula'
|
||||
'cleanup:uninstall unused and old versions of packages'
|
||||
'commands:show a list of commands'
|
||||
'create:create a new formula'
|
||||
'deps:list dependencies of a formula'
|
||||
'doctor:audits your installation for common issues'
|
||||
'edit:edit a formula'
|
||||
'fetch:download formula resources to the cache'
|
||||
'gist-logs:generate a gist of the full build logs'
|
||||
'home:visit the homepage of a formula or the brew project'
|
||||
'info:information about a formula'
|
||||
'install:install a formula'
|
||||
'reinstall:install a formula anew; re-using its current options'
|
||||
'leaves:show installed formulae that are not dependencies of another installed formula'
|
||||
'link:link a formula'
|
||||
'list:list files in a formula or not-installed formulae'
|
||||
'log:git commit log for a formula'
|
||||
'missing:check all installed formuale for missing dependencies.'
|
||||
'outdated:list formulae for which a newer version is available'
|
||||
'pin:pin specified formulae'
|
||||
'postinstall:perform post_install for a given formula'
|
||||
'prune:remove dead links'
|
||||
'remove:remove a formula'
|
||||
'search:search for a formula (/regex/ or string)'
|
||||
'switch:switch linkage between installed versions of a formula'
|
||||
'tap:tap a new formula repository from GitHub, or list existing taps'
|
||||
'test-bot:test a formula and build a bottle'
|
||||
'uninstall:uninstall a formula'
|
||||
'unlink:unlink a formula'
|
||||
'unpin:unpin specified formulae'
|
||||
'untap:remove a tapped repository'
|
||||
'update:pull latest repository'
|
||||
'upgrade:upgrade outdated formulae'
|
||||
'uses:show formulae which depend on a formula'
|
||||
)
|
||||
|
||||
local expl
|
||||
local -a formulae installed_formulae installed_taps outdated_formulae
|
||||
|
||||
_arguments \
|
||||
'(-v)-v[verbose]' \
|
||||
'(--cellar)--cellar[brew cellar]' \
|
||||
'(--config)--config[brew configuration]' \
|
||||
'(--env)--env[brew environment]' \
|
||||
'(--repository)--repository[brew repository]' \
|
||||
'(--version)--version[version information]' \
|
||||
'(--prefix)--prefix[where brew lives on this system]' \
|
||||
'(--cache)--cache[brew cache]' \
|
||||
'(--force)--force[brew force]' \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "brew subcommand" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
case "$words[1]" in
|
||||
install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|edit|options)
|
||||
_brew_all_formulae
|
||||
_wanted formulae expl 'all formulae' compadd -a formulae ;;
|
||||
list|ls)
|
||||
_arguments \
|
||||
'(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
|
||||
'(--pinned)--pinned[list all versions of pinned formulae]' \
|
||||
'(--versions)--versions[list all installed versions of a formula]' \
|
||||
'1: :->forms' && return 0
|
||||
|
||||
if [[ "$state" == forms ]]; then
|
||||
_brew_installed_formulae
|
||||
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
|
||||
fi ;;
|
||||
remove|rm|uninstall|unlink|cleanup|link|ln|pin|unpin)
|
||||
_brew_installed_formulae
|
||||
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
|
||||
search|-S)
|
||||
_arguments \
|
||||
'(--macports)--macports[search the macports repository]' \
|
||||
'(--fink)--fink[search the fink repository]' ;;
|
||||
untap)
|
||||
_brew_installed_taps
|
||||
_wanted installed_taps expl 'installed taps' compadd -a installed_taps ;;
|
||||
upgrade)
|
||||
_brew_outdated_formulae
|
||||
_wanted outdated_formulae expl 'outdated formulae' compadd -a outdated_formulae ;;
|
||||
esac
|
@ -2,3 +2,19 @@ alias brews='brew list -1'
|
||||
alias bubo='brew update && brew outdated'
|
||||
alias bubc='brew upgrade && brew cleanup'
|
||||
alias bubu='bubo && bubc'
|
||||
|
||||
if command mkdir "$ZSH_CACHE_DIR/.brew-completion-message" 2>/dev/null; then
|
||||
print -P '%F{yellow}'Oh My Zsh brew plugin:
|
||||
cat <<-'EOF'
|
||||
|
||||
With the advent of their 1.0 release, Homebrew has decided to bundle
|
||||
the zsh completion as part of the brew installation, so we no longer
|
||||
ship it with the brew plugin; now it only has brew aliases.
|
||||
|
||||
If you find that brew completion no longer works, make sure you have
|
||||
your Homebrew installation fully up to date.
|
||||
|
||||
You will only see this message once.
|
||||
EOF
|
||||
print -P '%f'
|
||||
fi
|
||||
|
@ -6,6 +6,7 @@
|
||||
- `bl` aliased to `bundle list`
|
||||
- `bp` aliased to `bundle package`
|
||||
- `bo` aliased to `bundle open`
|
||||
- `bout` aliased to `bundle outdated`
|
||||
- `bu` aliased to `bundle update`
|
||||
- `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`)
|
||||
- adds a wrapper for common gems:
|
||||
|
@ -2,6 +2,7 @@ alias be="bundle exec"
|
||||
alias bl="bundle list"
|
||||
alias bp="bundle package"
|
||||
alias bo="bundle open"
|
||||
alias bout="bundle outdated"
|
||||
alias bu="bundle update"
|
||||
alias bi="bundle_install"
|
||||
alias bcn="bundle clean"
|
||||
@ -57,7 +58,7 @@ bundle_install() {
|
||||
if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
|
||||
if [[ "$OSTYPE" = darwin* ]]
|
||||
then
|
||||
local cores_num="$(sysctl hw.ncpu | awk '{print $2}')"
|
||||
local cores_num="$(sysctl -n hw.ncpu)"
|
||||
else
|
||||
local cores_num="$(nproc)"
|
||||
fi
|
||||
|
@ -1,11 +1,31 @@
|
||||
# CakePHP 3 basic command completion
|
||||
_cakephp3_get_command_list () {
|
||||
cakephp3commands=($(bin/cake completion commands));printf "%s\n" "${cakephp3commands[@]}"
|
||||
bin/cake Completion commands
|
||||
}
|
||||
|
||||
_cakephp3_get_sub_command_list () {
|
||||
bin/cake Completion subcommands ${words[2]}
|
||||
}
|
||||
|
||||
_cakephp3_get_3rd_argument () {
|
||||
bin/cake ${words[2]} ${words[3]} | \grep '\-\ '| \awk '{print $2}'
|
||||
}
|
||||
|
||||
_cakephp3 () {
|
||||
if [ -f bin/cake ]; then
|
||||
compadd `_cakephp3_get_command_list`
|
||||
local -a has3rdargument
|
||||
has3rdargument=("all" "controller" "fixture" "model" "template")
|
||||
if [ -f bin/cake ]; then
|
||||
if (( CURRENT == 2 )); then
|
||||
compadd $(_cakephp3_get_command_list)
|
||||
fi
|
||||
if (( CURRENT == 3 )); then
|
||||
compadd $(_cakephp3_get_sub_command_list)
|
||||
fi
|
||||
if (( CURRENT == 4 )); then
|
||||
if [[ ${has3rdargument[(i)${words[3]}]} -le ${#has3rdargument} ]]; then
|
||||
compadd $(_cakephp3_get_3rd_argument)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -14,6 +34,5 @@ compdef _cakephp3 cake
|
||||
|
||||
#Alias
|
||||
alias c3='bin/cake'
|
||||
|
||||
alias c3cache='bin/cake orm_cache clear'
|
||||
alias c3migrate='bin/cake migrations migrate'
|
||||
|
@ -1,7 +1,7 @@
|
||||
#compdef shipit
|
||||
#compdef capit
|
||||
#autoload
|
||||
|
||||
# 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
|
||||
|
||||
local curcontext="$curcontext" state line ret=1
|
||||
@ -14,7 +14,7 @@ _arguments -C \
|
||||
_cap_tasks() {
|
||||
if [[ -f config/deploy.rb || -f Capfile ]]; then
|
||||
if [[ ! -f .cap_tasks~ ]]; then
|
||||
shipit --tasks | sed 's/\(\[\)\(.*\)\(\]\)/\2:/' | awk '{command=$2; $1=$2=$3=""; gsub(/^[ \t\r\n]+/, "", $0); gsub(":", "\\:", command); print command"["$0"]"}' > .cap_tasks~
|
||||
capit --tasks | sed 's/\(\[\)\(.*\)\(\]\)/\2:/' | awk '{command=$2; $1=$2=$3=""; gsub(/^[ \t\r\n]+/, "", $0); gsub(":", "\\:", command); print command"["$0"]"}' > .cap_tasks~
|
||||
fi
|
||||
|
||||
OLD_IFS=$IFS
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Added `shipit` 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 shipit() {
|
||||
func capit() {
|
||||
if [ -f Gemfile ]
|
||||
then
|
||||
bundle exec cap $*
|
||||
|
11
plugins/cargo/README.md
Normal file
11
plugins/cargo/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# 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:
|
||||
|
||||
```zsh
|
||||
plugins=(... cargo)
|
||||
```
|
||||
|
||||
Updated on October 4th, 2016.
|
497
plugins/cargo/_cargo
Normal file
497
plugins/cargo/_cargo
Normal file
@ -0,0 +1,497 @@
|
||||
#compdef cargo
|
||||
|
||||
typeset -A opt_args
|
||||
autoload -U regexp-replace
|
||||
|
||||
_cargo() {
|
||||
|
||||
_arguments \
|
||||
'(- 1 *)'{-h,--help}'[show help message]' \
|
||||
'(- 1 *)'--list'[list installed commands]' \
|
||||
'(- 1 *)'{-v,--verbose}'[use verbose output]' \
|
||||
'(- 1 *)'--color'[colorization option]' \
|
||||
'(- 1 *)'{-V,--version}'[show version information]' \
|
||||
'1: :_cargo_cmds' \
|
||||
'*:: :->args'
|
||||
|
||||
case $state in
|
||||
args)
|
||||
case $words[1] in
|
||||
bench)
|
||||
_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 build the default features]' \
|
||||
'--no-run[compile but do not run]' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \
|
||||
'--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)' \
|
||||
;;
|
||||
|
||||
build)
|
||||
_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 build the default features]' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \
|
||||
'--release=[build 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]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release[whether or not to clean release artifacts]' \
|
||||
'--target=[target triple(default:all)]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
doc)
|
||||
_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]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--no-deps[do not build docs for dependencies]' \
|
||||
'--no-default-features[do not build the default features]' \
|
||||
'--open[open docs in browser after the build]' \
|
||||
'(-p, --package)'{-p,--package}'=[package to document]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release[build artifacts in release mode, with optimizations]' \
|
||||
'--target=[build for the target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
fetch)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
generate-lockfile)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
git-checkout)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'q(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--reference=[REF]' \
|
||||
'--url=[URL]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
help)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'*: :_cargo_cmds' \
|
||||
;;
|
||||
|
||||
init)
|
||||
_arguments \
|
||||
'--bin[use binary template]' \
|
||||
'--vcs:initialize a new repo with a given VCS:(git hg none)' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--name=[set the resulting package name]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
install)
|
||||
_arguments \
|
||||
'--bin=[only install the specified binary]' \
|
||||
'--branch=[branch to use when installing from git]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'--debug[build in debug mode instead of release mode]' \
|
||||
'--example[install the specified example instead of binaries]' \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'--git=[URL from which to install the crate]' \
|
||||
'(-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]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--rev=[specific commit to use when installing from git]' \
|
||||
'--root=[directory to install packages into]' \
|
||||
'--tag=[tag to use when installing from git]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--vers=[version to install from crates.io]' \
|
||||
;;
|
||||
|
||||
locate-project)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
;;
|
||||
|
||||
login)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--host=[Host to set the token for]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
metadata)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
"--no-deps[output information only about the root package and don't fetch dependencies]" \
|
||||
'--no-default-features[do not include the default feature]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'--format-version=[format version(default: 1)]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
new)
|
||||
_arguments \
|
||||
'--bin[use binary template]' \
|
||||
'--vcs:initialize a new repo with a given VCS:(git hg none)' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--name=[set the resulting package name]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
owner)
|
||||
_arguments \
|
||||
'(-a, --add)'{-a,--add}'[add owner LOGIN]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--index[registry index]' \
|
||||
'(-l, --list)'{-l,--list}'[list owners of a crate]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-r, --remove)'{-r,--remove}'[remove owner LOGIN]' \
|
||||
'--token[API token to use when authenticating]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
package)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-l, --list)'{-l,--list}'[print files included in a package without making one]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--no-metadata[ignore warnings about a lack of human-usable metadata]' \
|
||||
'--no-verify[do not build to verify contents]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
pkgid)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
publish)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--host=[Host to set the token for]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--no-verify[Do not verify tarball until before publish]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--token[token to use when uploading]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
read-manifest)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
run)
|
||||
_arguments \
|
||||
'--example=[name of the bin target]' \
|
||||
'--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]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--bin=[name of the bin target]' \
|
||||
'--no-default-features[do not build the default features]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release=[build in release mode]' \
|
||||
'--target=[target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'*: :_normal' \
|
||||
;;
|
||||
|
||||
rustc)
|
||||
_arguments \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'--features=[features to compile for the package]' \
|
||||
'--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]' \
|
||||
'--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]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release[build artifacts in release mode, with optimizations]' \
|
||||
'--target=[target triple which compiles will be for]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
"${command_scope_spec[@]}" \
|
||||
;;
|
||||
|
||||
rustdoc)
|
||||
_arguments \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'--features=[space-separated list of features to also build]' \
|
||||
'--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]' \
|
||||
'--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]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release[build artifacts in release mode, with optimizations]' \
|
||||
'--target=[build for the target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
"${command_scope_spec[@]}" \
|
||||
;;
|
||||
|
||||
search)
|
||||
_arguments \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--host=[host of a registry to search in]' \
|
||||
'--limit=[limit the number of results]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
;;
|
||||
|
||||
test)
|
||||
_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]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--test=[test name]: :_test_names' \
|
||||
'--no-default-features[do not build the default features]' \
|
||||
'--no-fail-fast[run all tests regardless of failure]' \
|
||||
'--no-run[compile but do not run]' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to run tests for]:packages:_get_package_names' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release[build artifacts in release mode, with optimizations]' \
|
||||
'--target=[target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'1: :_test_names' \
|
||||
;;
|
||||
|
||||
uninstall)
|
||||
_arguments \
|
||||
'--bin=[only uninstall the binary NAME]' \
|
||||
'--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]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
;;
|
||||
|
||||
update)
|
||||
_arguments \
|
||||
'--aggressive=[force dependency update]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to update]:packages:__get_package_names' \
|
||||
'--precise=[update single dependency to PRECISE]: :' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
verify-project)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
version)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
yank)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--index[registry index]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--token[API token to use when authenticating]' \
|
||||
'--undo[undo a yank, putting a version back into the index]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'--vers[yank version]' \
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_cargo_cmds(){
|
||||
local -a commands;commands=(
|
||||
'bench:execute all benchmarks of a local package'
|
||||
'build:compile the current project'
|
||||
'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'
|
||||
'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'
|
||||
'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'
|
||||
'publish:upload package to the registry'
|
||||
'read-manifest:print manifest in JSON format'
|
||||
'run:run the main binary of the local package'
|
||||
'rustc:compile a package and all of its dependencies'
|
||||
'rustdoc:build documentation for a package'
|
||||
'search:search packages on crates.io'
|
||||
'test:execute all unit and tests of a local package'
|
||||
'uninstall:remove a Rust binary'
|
||||
'update:update dependencies'
|
||||
'verify-project:check Cargo.toml'
|
||||
'version:show version information'
|
||||
'yank:remove pushed file from index'
|
||||
)
|
||||
_describe 'command' commands
|
||||
|
||||
}
|
||||
|
||||
|
||||
#FIXME: Disabled until fixed
|
||||
#gets package names from the manifest file
|
||||
_get_package_names()
|
||||
{
|
||||
}
|
||||
|
||||
#TODO:see if it makes sense to have 'locate-project' to have non-json output.
|
||||
#strips package name from json stuff
|
||||
_locate_manifest(){
|
||||
local manifest=`cargo locate-project 2>/dev/null`
|
||||
regexp-replace manifest '\{"root":"|"\}' ''
|
||||
echo $manifest
|
||||
}
|
||||
|
||||
# Extracts the values of "name" from the array given in $1 and shows them as
|
||||
# command line options for completion
|
||||
_get_names_from_array()
|
||||
{
|
||||
local -a filelist;
|
||||
local manifest=$(_locate_manifest)
|
||||
if [[ -z $manifest ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
local last_line
|
||||
local -a names;
|
||||
local in_block=false
|
||||
local block_name=$1
|
||||
names=()
|
||||
while read line
|
||||
do
|
||||
if [[ $last_line == "[[$block_name]]" ]]; then
|
||||
in_block=true
|
||||
else
|
||||
if [[ $last_line =~ '.*\[\[.*' ]]; then
|
||||
in_block=false
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $in_block == true ]]; then
|
||||
if [[ $line =~ '.*name.*=' ]]; then
|
||||
regexp-replace line '^.*name *= *|"' ""
|
||||
names+=$line
|
||||
fi
|
||||
fi
|
||||
|
||||
last_line=$line
|
||||
done < $manifest
|
||||
_describe $block_name names
|
||||
|
||||
}
|
||||
|
||||
#Gets the test names from the manifest file
|
||||
_test_names()
|
||||
{
|
||||
_get_names_from_array "test"
|
||||
}
|
||||
|
||||
#Gets the bench names from the manifest file
|
||||
_benchmark_names()
|
||||
{
|
||||
_get_names_from_array "bench"
|
||||
}
|
||||
|
||||
# These flags are mutally 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
|
||||
command_scope_spec=(
|
||||
'(--bin --example --test --lib)--bench=[benchmark name]: :_benchmark_names'
|
||||
'(--bench --bin --test --lib)--example=[example name]'
|
||||
'(--bench --example --test --lib)--bin=[binary name]'
|
||||
'(--bench --bin --example --test)--lib=[library name]'
|
||||
'(--bench --bin --example --lib)--test=[test name]'
|
||||
)
|
||||
|
||||
|
||||
_cargo
|
15
plugins/cask/README.md
Normal file
15
plugins/cask/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Cask plugin
|
||||
|
||||
[Cask](https://github.com/cask/cask) is a project management tool for Emacs that helps
|
||||
automate the package development cycle; development, dependencies, testing, building,
|
||||
packaging and more.
|
||||
|
||||
This plugin loads `cask` completion from non-standard locations, such as if installed
|
||||
via Homebrew or others. To enable it, add `cask` to your plugins array:
|
||||
|
||||
```zsh
|
||||
plugins=(... cask)
|
||||
```
|
||||
|
||||
Make sure you have the `cask` directory in your `$PATH` before loading Oh My Zsh,
|
||||
otherwise you'll get a "command not found" error.
|
@ -1,5 +1,26 @@
|
||||
if which cask &> /dev/null; then
|
||||
source $(dirname $(which cask))/../etc/cask_completion.zsh
|
||||
else
|
||||
print "zsh cask plugin: cask not found"
|
||||
fi
|
||||
() {
|
||||
emulate -L zsh
|
||||
|
||||
if ! (( $+commands[cask] )); then
|
||||
print "zsh cask plugin: cask command not found" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
cask_base=${commands[cask]:h:h}
|
||||
|
||||
# Plain cask installation location (for Cask 0.7.2 and earlier)
|
||||
comp_files=($cask_base/etc/cask_completion.zsh)
|
||||
|
||||
# Mac Homebrew installs the completion in a different location
|
||||
if (( $+commands[brew] )); then
|
||||
comp_files+=($(brew --prefix)/share/zsh/site-functions/cask_completion.zsh)
|
||||
fi
|
||||
|
||||
# Load first found file
|
||||
for f in $comp_files; do
|
||||
if [[ -f "$f" ]]; then
|
||||
source "$f"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -16,9 +16,6 @@
|
||||
# rvm and rbenv plugins also provide this alias
|
||||
alias rubies='chruby'
|
||||
|
||||
local _chruby_path
|
||||
local _chruby_auto
|
||||
|
||||
_homebrew-installed() {
|
||||
whence brew &> /dev/null
|
||||
}
|
||||
@ -42,6 +39,9 @@ if _ruby-build_installed; then
|
||||
fi
|
||||
|
||||
_source_from_omz_settings() {
|
||||
local _chruby_path
|
||||
local _chruby_auto
|
||||
|
||||
zstyle -s :omz:plugins:chruby path _chruby_path
|
||||
zstyle -s :omz:plugins:chruby auto _chruby_auto
|
||||
|
||||
|
@ -17,9 +17,11 @@ Chuck Norris' blood type is AK+. Ass-Kicking Positive. It is compatible only wit
|
||||
Chuck Norris is 1/8th Cherokee. This has nothing to do with ancestry, the man ate a fucking Indian.
|
||||
%
|
||||
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.
|
||||
%
|
||||
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.
|
||||
@ -127,6 +129,7 @@ Chuck Norris can drink an entire gallon of milk in thirty-seven seconds.
|
||||
Little known medical fact: Chuck Norris invented the Caesarean section when he roundhouse-kicked his way out of his monther's womb.
|
||||
%
|
||||
Chuck Norris doesn't bowl strikes, he just knocks down one pin and the other nine faint.
|
||||
%
|
||||
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.
|
||||
%
|
||||
It takes Chuck Norris 20 minutes to watch 60 Minutes.
|
||||
@ -281,6 +284,7 @@ In a recent survey it was discovered the 94% of American women lost their virgin
|
||||
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.
|
||||
%
|
||||
If at first you don't succeed, you're not Chuck Norris.
|
||||
%
|
||||
If Chuck Norris were a calendar, every month would be named Chucktober, and every day he'd kick your ass.
|
||||
%
|
||||
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."
|
||||
@ -349,7 +353,7 @@ As President Roosevelt said: "We have nothing to fear but fear itself. And Chuck
|
||||
%
|
||||
Chuck Norris just says "no" to drugs. If he said "yes", it would collapse Colombia's infrastructure.
|
||||
%
|
||||
Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent.
|
||||
Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent.?
|
||||
%
|
||||
Crime does not pay - unless you are an undertaker following Walker, Texas Ranger, on a routine patrol.
|
||||
%
|
||||
@ -497,7 +501,8 @@ When Chuck Norris works out on the Total Gym, the Total Gym feels like it's been
|
||||
%
|
||||
Chuck Norris can skeletize a cow in two minutes.
|
||||
%
|
||||
The only sure things are Death and Taxes?and when Chuck Norris goes to work for the IRS, they'll be the same thing.
|
||||
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.
|
||||
%
|
||||
With the rising cost of gasoline, Chuck Norris is beginning to worry about his drinking habit.
|
||||
@ -527,8 +532,6 @@ Chuck Norris uses 8'x10' sheets of plywood as toilet paper.
|
||||
Noah was the only man notified before Chuck Norris relieved himself in the Atlantic Ocean.
|
||||
%
|
||||
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.
|
||||
%
|
||||
|
||||
%
|
||||
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.
|
||||
%
|
||||
|
@ -1,7 +1,7 @@
|
||||
## Coffeescript Plugin
|
||||
|
||||
This plugin provides aliases for quickly compiling and previewing your
|
||||
cofeescript code.
|
||||
coffeescript code.
|
||||
|
||||
When writing Coffeescript it's very common to want to preview the output of a
|
||||
certain snippet of code, either because you want to test the output or because
|
||||
@ -11,7 +11,7 @@ Preview the compiled result of your coffeescript with `cf "code"` as per the
|
||||
following:
|
||||
|
||||
```zsh
|
||||
$ cf 'if a then be else c'
|
||||
$ cf 'if a then b else c'
|
||||
if (a) {
|
||||
b;
|
||||
} else {
|
||||
|
@ -6,11 +6,11 @@ cf () {
|
||||
}
|
||||
# compile & copy to clipboard
|
||||
cfc () {
|
||||
cf "$1" | pbcopy
|
||||
cf "$1" | clipcopy
|
||||
}
|
||||
|
||||
# compile from pasteboard & print
|
||||
alias cfp='coffeeMe "$(pbpaste)"'
|
||||
# compile from clipboard & print
|
||||
alias cfp='cf "$(clippaste)"'
|
||||
|
||||
# compile from pasteboard and copy to clipboard
|
||||
alias cfpc='cfp | pbcopy'
|
||||
# compile from clipboard and copy to clipboard
|
||||
alias cfpc='cfp | clipcopy'
|
||||
|
32
plugins/colored-man-pages/colored-man-pages.plugin.zsh
Normal file
32
plugins/colored-man-pages/colored-man-pages.plugin.zsh
Normal file
@ -0,0 +1,32 @@
|
||||
if [[ "$OSTYPE" = solaris* ]]
|
||||
then
|
||||
if [[ ! -x "$HOME/bin/nroff" ]]
|
||||
then
|
||||
mkdir -p "$HOME/bin"
|
||||
cat > "$HOME/bin/nroff" <<EOF
|
||||
#!/bin/sh
|
||||
if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then
|
||||
shift
|
||||
exec /usr/bin/nroff -u\$_NROFF_U "\$@"
|
||||
fi
|
||||
#-- Some other invocation of nroff
|
||||
exec /usr/bin/nroff "\$@"
|
||||
EOF
|
||||
chmod +x "$HOME/bin/nroff"
|
||||
fi
|
||||
fi
|
||||
|
||||
man() {
|
||||
env \
|
||||
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_me=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_se=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
|
||||
LESS_TERMCAP_ue=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_us=$(printf "\e[1;32m") \
|
||||
PAGER="${commands[less]:-$PAGER}" \
|
||||
_NROFF_U=1 \
|
||||
PATH="$HOME/bin:$PATH" \
|
||||
man "$@"
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
if [ "$OSTYPE[0,7]" = "solaris" ]
|
||||
then
|
||||
if [ ! -x ${HOME}/bin/nroff ]
|
||||
then
|
||||
mkdir -p ${HOME}/bin
|
||||
cat > ${HOME}/bin/nroff <<EOF
|
||||
#!/bin/sh
|
||||
if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then
|
||||
shift
|
||||
exec /usr/bin/nroff -u\${_NROFF_U} "\$@"
|
||||
fi
|
||||
#-- Some other invocation of nroff
|
||||
exec /usr/bin/nroff "\$@"
|
||||
EOF
|
||||
chmod +x ${HOME}/bin/nroff
|
||||
fi
|
||||
fi
|
||||
|
||||
man() {
|
||||
env \
|
||||
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_me=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_se=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
|
||||
LESS_TERMCAP_ue=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_us=$(printf "\e[1;32m") \
|
||||
PAGER=/usr/bin/less \
|
||||
_NROFF_U=1 \
|
||||
PATH=${HOME}/bin:${PATH} \
|
||||
man "$@"
|
||||
}
|
@ -23,3 +23,11 @@ if [ -f /usr/libexec/pk-command-not-found ]; then
|
||||
return $retval
|
||||
}
|
||||
fi
|
||||
|
||||
# OSX command-not-found support
|
||||
# https://github.com/Homebrew/homebrew-command-not-found
|
||||
if type brew &> /dev/null; then
|
||||
if brew command command-not-found-init > /dev/null 2>&1; then
|
||||
eval "$(brew command-not-found-init)";
|
||||
fi
|
||||
fi
|
||||
|
@ -52,19 +52,23 @@ alias mv='mv -i'
|
||||
|
||||
# zsh is able to auto-do some kungfoo
|
||||
# depends on the SUFFIX :)
|
||||
if [ ${ZSH_VERSION//\./} -ge 420 ]; then
|
||||
if is-at-least 4.2.0; then
|
||||
# open browser on urls
|
||||
_browser_fts=(htm html de org net com at cx nl se dk dk php)
|
||||
for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done
|
||||
if [[ -n "$BROWSER" ]]; then
|
||||
_browser_fts=(htm html de org net com at cx nl se dk)
|
||||
for ft in $_browser_fts; do alias -s $ft=$BROWSER; done
|
||||
fi
|
||||
|
||||
_editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex)
|
||||
for ft in $_editor_fts ; do alias -s $ft=$EDITOR ; done
|
||||
for ft in $_editor_fts; do alias -s $ft=$EDITOR; done
|
||||
|
||||
_image_fts=(jpg jpeg png gif mng tiff tif xpm)
|
||||
for ft in $_image_fts ; do alias -s $ft=$XIVIEWER; done
|
||||
if [[ -n "$XIVIEWER" ]]; then
|
||||
_image_fts=(jpg jpeg png gif mng tiff tif xpm)
|
||||
for ft in $_image_fts; do alias -s $ft=$XIVIEWER; done
|
||||
fi
|
||||
|
||||
_media_fts=(ape avi flv mkv mov mp3 mpeg mpg ogg ogm rm wav webm)
|
||||
for ft in $_media_fts ; do alias -s $ft=mplayer ; done
|
||||
_media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm)
|
||||
for ft in $_media_fts; do alias -s $ft=mplayer; done
|
||||
|
||||
#read documents
|
||||
alias -s pdf=acroread
|
||||
@ -83,4 +87,3 @@ fi
|
||||
|
||||
# Make zsh know about hosts already accessed by SSH
|
||||
zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'
|
||||
|
||||
|
@ -7,11 +7,11 @@
|
||||
|
||||
# Composer basic command completion
|
||||
_composer_get_command_list () {
|
||||
$_comp_command1 --no-ansi | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
|
||||
$_comp_command1 --no-ansi 2>/dev/null | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
|
||||
}
|
||||
|
||||
_composer_get_required_list () {
|
||||
$_comp_command1 show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
|
||||
$_comp_command1 show -s --no-ansi 2>/dev/null | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
|
||||
}
|
||||
|
||||
_composer () {
|
||||
@ -39,14 +39,17 @@ alias c='composer'
|
||||
alias csu='composer self-update'
|
||||
alias cu='composer update'
|
||||
alias cr='composer require'
|
||||
alias crm='composer remove'
|
||||
alias ci='composer install'
|
||||
alias ccp='composer create-project'
|
||||
alias cdu='composer dump-autoload'
|
||||
alias cdo='composer dump-autoload --optimize-autoloader'
|
||||
alias cgu='composer global update'
|
||||
alias cgr='composer global require'
|
||||
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/vendor/bin
|
||||
export PATH=$PATH:$(composer global config bin-dir --absolute) 2>/dev/null
|
||||
|
11
plugins/copybuffer/README.md
Normal file
11
plugins/copybuffer/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# `copybuffer` plugin
|
||||
|
||||
This plugin binds the ctrl-o keyboard shortcut to a command that copies the text
|
||||
that is currently typed in the command line ($BUFFER) to the system clipboard.
|
||||
|
||||
This is useful if you type a command - and before you hit enter to execute it - want
|
||||
to copy it maybe so you can paste it into a script, gist or whatnot.
|
||||
|
||||
```zsh
|
||||
plugins=(... copybuffer)
|
||||
```
|
14
plugins/copybuffer/copybuffer.plugin.zsh
Normal file
14
plugins/copybuffer/copybuffer.plugin.zsh
Normal file
@ -0,0 +1,14 @@
|
||||
# copy the active line from the command line buffer
|
||||
# onto the system clipboard (requires clipcopy plugin)
|
||||
|
||||
copybuffer () {
|
||||
if which clipcopy &>/dev/null; then
|
||||
echo $BUFFER | clipcopy
|
||||
else
|
||||
echo "clipcopy function not found. Please make sure you have Oh My Zsh installed correctly."
|
||||
fi
|
||||
}
|
||||
|
||||
zle -N copybuffer
|
||||
|
||||
bindkey "^O" copybuffer
|
@ -1,3 +1,5 @@
|
||||
# Copies the pathname of the current directory to the system or X Windows clipboard
|
||||
function copydir {
|
||||
pwd | tr -d "\r\n" | pbcopy
|
||||
emulate -L zsh
|
||||
print -n $PWD | clipcopy
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
# Copies the contents of a given file to the system or X Windows clipboard
|
||||
#
|
||||
# copyfile <file>
|
||||
function copyfile {
|
||||
[[ "$#" != 1 ]] && return 1
|
||||
local file_to_copy=$1
|
||||
cat $file_to_copy | pbcopy
|
||||
emulate -L zsh
|
||||
clipcopy $1
|
||||
}
|
||||
|
32
plugins/cp/README.md
Normal file
32
plugins/cp/README.md
Normal file
@ -0,0 +1,32 @@
|
||||
# cp plugin
|
||||
|
||||
This plugin defines a `cpv` function that uses `rsync` so that you
|
||||
get the features and security of this command.
|
||||
|
||||
To enable, add `cp` to your `plugins` array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... cp)
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
The enabled options for rsync are:
|
||||
|
||||
- `-p`: preserves permissions.
|
||||
|
||||
- `-o`: preserves owner.
|
||||
|
||||
* `-g`: preserves group.
|
||||
|
||||
* `-b`: make a backup of the original file instead of overwriting it, if it exists.
|
||||
|
||||
* `-r`: recurse directories.
|
||||
|
||||
* `-hhh`: outputs numbers in human-readable format, in units of 1024 (K, M, G, T).
|
||||
|
||||
* `--backup-dir=/tmp/rsync`: move backup copies to "/tmp/rsync".
|
||||
|
||||
* `-e /dev/null`: only work on local files (disable remote shells).
|
||||
|
||||
* `--progress`: display progress.
|
@ -1,14 +1,4 @@
|
||||
#Show progress while file is copying
|
||||
|
||||
# Rsync options are:
|
||||
# -p - preserve permissions
|
||||
# -o - preserve owner
|
||||
# -g - preserve group
|
||||
# -h - output in human-readable format
|
||||
# --progress - display progress
|
||||
# -b - instead of just overwriting an existing file, save the original
|
||||
# --backup-dir=/tmp/rsync - move backup copies to "/tmp/rsync"
|
||||
# -e /dev/null - only work on local files
|
||||
# -- - everything after this is an argument, even if it looks like an option
|
||||
|
||||
alias cpv="rsync -poghb --backup-dir=/tmp/rsync -e /dev/null --progress --"
|
||||
cpv() {
|
||||
rsync -pogbr -hhh --backup-dir=/tmp/rsync -e /dev/null --progress "$@"
|
||||
}
|
||||
compdef _files cpv
|
||||
|
@ -192,7 +192,7 @@ apt-history () {
|
||||
awk '{print $4"="$5}'
|
||||
;;
|
||||
list)
|
||||
zcat $(ls -rt /var/log/dpkg*)
|
||||
zgrep --no-filename '' $(ls -rt /var/log/dpkg*)
|
||||
;;
|
||||
*)
|
||||
echo "Parameters:"
|
||||
|
@ -8,11 +8,23 @@
|
||||
# pushd +N: start counting from left of `dirs' output
|
||||
# pushd -N: start counting from right of `dirs' output
|
||||
|
||||
switch-to-dir () {
|
||||
[[ ${#dirstack} -eq 0 ]] && return
|
||||
|
||||
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
|
||||
done
|
||||
}
|
||||
|
||||
insert-cycledleft () {
|
||||
emulate -L zsh
|
||||
setopt nopushdminus
|
||||
|
||||
builtin pushd -q +1 &>/dev/null || true
|
||||
switch-to-dir +1
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N insert-cycledleft
|
||||
@ -21,17 +33,17 @@ insert-cycledright () {
|
||||
emulate -L zsh
|
||||
setopt nopushdminus
|
||||
|
||||
builtin pushd -q -0 &>/dev/null || true
|
||||
switch-to-dir -0
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N insert-cycledright
|
||||
|
||||
|
||||
# add key bindings for iTerm2
|
||||
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
bindkey "^[[1;6D" insert-cycledleft
|
||||
bindkey "^[[1;6C" insert-cycledright
|
||||
else
|
||||
bindkey "\e[1;6D" insert-cycledleft
|
||||
bindkey "\e[1;6C" insert-cycledright
|
||||
fi
|
||||
# These sequences work for xterm, Apple Terminal.app, and probably others.
|
||||
# Not for rxvt-unicode, but it doesn't seem differentiate Ctrl-Shift-Arrow
|
||||
# from plain Shift-Arrow, at least by default.
|
||||
# iTerm2 does not have these key combinations defined by default; you will need
|
||||
# to add them under "Keys" in your profile if you want to use this. You can do
|
||||
# this conveniently by loading the "xterm with Numeric Keypad" preset.
|
||||
bindkey "\e[1;6D" insert-cycledleft
|
||||
bindkey "\e[1;6C" insert-cycledright
|
||||
|
25
plugins/dnf/README.md
Executable file
25
plugins/dnf/README.md
Executable file
@ -0,0 +1,25 @@
|
||||
## Description
|
||||
|
||||
This plugin makes `dnf` usage easier by adding aliases for the most
|
||||
common commands.
|
||||
|
||||
`dnf` is the new package manager for RPM-based distributions, which
|
||||
replaces `yum`.
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|-------------------------|--------------------------|
|
||||
| dnfl | `dnf list` | List packages |
|
||||
| dnfli | `dnf list installed` | List installed packages |
|
||||
| dnfgl | `dnf grouplist` | List package groups |
|
||||
| dnfmc | `dnf makecache` | Generate metadata cache |
|
||||
| dnfp | `dnf info` | Show package information |
|
||||
| dnfs | `dnf search` | Search package |
|
||||
| **Use `sudo`** |
|
||||
| dnfu | `sudo dnf upgrade` | Upgrade package |
|
||||
| dnfi | `sudo dnf install` | Install package |
|
||||
| dnfgi | `sudo dnf groupinstall` | Install package group |
|
||||
| dnfr | `sudo dnf remove` | Remove package |
|
||||
| dnfgr | `sudo dnf groupremove` | Remove package group |
|
||||
| dnfc | `sudo dnf clean all` | Clean cache |
|
15
plugins/dnf/dnf.plugin.zsh
Normal file
15
plugins/dnf/dnf.plugin.zsh
Normal file
@ -0,0 +1,15 @@
|
||||
## Aliases
|
||||
|
||||
alias dnfl="dnf list" # List packages
|
||||
alias dnfli="dnf list installed" # List installed packages
|
||||
alias dnfgl="dnf grouplist" # List package groups
|
||||
alias dnfmc="dnf makecache" # Generate metadata cache
|
||||
alias dnfp="dnf info" # Show package information
|
||||
alias dnfs="dnf search" # Search package
|
||||
|
||||
alias dnfu="sudo dnf upgrade" # Upgrade package
|
||||
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 package group
|
||||
alias dnfc="sudo dnf clean all" # Clean cache
|
@ -1,5 +1,4 @@
|
||||
# Docker-compose plugin for oh my zsh
|
||||
|
||||
A copy of the completion script from the [docker-compose](1) git repo.
|
||||
A copy of the completion script from the [docker-compose](https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose) git repo.
|
||||
|
||||
[1]:[https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose]
|
||||
|
@ -7,7 +7,7 @@
|
||||
# -------------------------------------------------------------------------
|
||||
# Version
|
||||
# -------
|
||||
# 0.1.0
|
||||
# 1.5.0
|
||||
# -------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
@ -19,58 +19,69 @@
|
||||
# * @felixr docker zsh completion script : https://github.com/felixr/docker-zsh-completion
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# For compatibility reasons, Compose and therefore its completion supports several
|
||||
# stack compositon files as listed here, in descending priority.
|
||||
# Support for these filenames might be dropped in some future version.
|
||||
__docker-compose_compose_file() {
|
||||
local file
|
||||
for file in docker-compose.y{,a}ml fig.y{,a}ml ; do
|
||||
[ -e $file ] && {
|
||||
echo $file
|
||||
return
|
||||
}
|
||||
done
|
||||
echo docker-compose.yml
|
||||
__docker-compose_q() {
|
||||
docker-compose 2>/dev/null $compose_options "$@"
|
||||
}
|
||||
|
||||
# Extracts all service names from docker-compose.yml.
|
||||
___docker-compose_all_services_in_compose_file() {
|
||||
# All services defined in docker-compose.yml
|
||||
__docker-compose_all_services_in_compose_file() {
|
||||
local already_selected
|
||||
local -a services
|
||||
already_selected=$(echo ${words[@]} | tr " " "|")
|
||||
awk -F: '/^[a-zA-Z0-9]/{print $1}' "${compose_file:-$(__docker-compose_compose_file)}" 2>/dev/null | grep -Ev "$already_selected"
|
||||
already_selected=$(echo $words | tr " " "|")
|
||||
__docker-compose_q config --services \
|
||||
| grep -Ev "^(${already_selected})$"
|
||||
}
|
||||
|
||||
# All services, even those without an existing container
|
||||
__docker-compose_services_all() {
|
||||
services=$(___docker-compose_all_services_in_compose_file)
|
||||
_alternative "args:services:($services)"
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
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() {
|
||||
__docker-compose_services_with_key() {
|
||||
local already_selected
|
||||
local -a buildable
|
||||
already_selected=$(echo ${words[@]} | tr " " "|")
|
||||
already_selected=$(echo $words | tr " " "|")
|
||||
# flatten sections to one line, then filter lines containing the key and return section name.
|
||||
awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' "${compose_file:-$(__docker-compose_compose_file)}" 2>/dev/null | awk -F: -v key=": +$1:" '$0 ~ key {print $1}' 2>/dev/null | grep -Ev "$already_selected"
|
||||
__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() {
|
||||
buildable=$(___docker-compose_services_with_key build)
|
||||
_alternative "args:buildable services:($buildable)"
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
buildable=$(__docker-compose_services_with_key build)
|
||||
_alternative "args:buildable services:($buildable)" && ret=0
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
# All services that are defined by an image
|
||||
__docker-compose_services_from_image() {
|
||||
pullable=$(___docker-compose_services_with_key image)
|
||||
_alternative "args:pullable services:($pullable)"
|
||||
[[ $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() {
|
||||
local kind expl
|
||||
declare -a running stopped lines args 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
|
||||
@ -80,64 +91,78 @@ __docker-compose_get_services() {
|
||||
|
||||
kind=$1
|
||||
shift
|
||||
[[ $kind = (stopped|all) ]] && args=($args -a)
|
||||
[[ $kind =~ (stopped|all) ]] && args=($args -a)
|
||||
|
||||
lines=(${(f)"$(_call_program commands docker ps ${args})"})
|
||||
services=(${(f)"$(_call_program commands docker-compose 2>/dev/null ${compose_file:+-f $compose_file} ${compose_project:+-p $compose_project} ps -q)"})
|
||||
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 )) {
|
||||
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
|
||||
}
|
||||
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
|
||||
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]]}/:/\\:}%% ##}"
|
||||
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
|
||||
[[ $kind = (stopped|all) ]] && _describe -t services-stopped "stopped services" stopped
|
||||
[[ $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_pausedservices() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
__docker-compose_get_services paused "$@"
|
||||
}
|
||||
|
||||
__docker-compose_stoppedservices() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
__docker-compose_get_services stopped "$@"
|
||||
}
|
||||
|
||||
__docker-compose_runningservices() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
__docker-compose_get_services running "$@"
|
||||
}
|
||||
|
||||
__docker-compose_services () {
|
||||
__docker-compose_services() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
__docker-compose_get_services all "$@"
|
||||
}
|
||||
|
||||
__docker-compose_caching_policy() {
|
||||
oldp=( "$1"(Nmh+1) ) # 1 hour
|
||||
oldp=( "$1"(Nmh+1) ) # 1 hour
|
||||
(( $#oldp ))
|
||||
}
|
||||
|
||||
__docker-compose_commands () {
|
||||
__docker-compose_commands() {
|
||||
local cache_policy
|
||||
|
||||
zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
|
||||
@ -151,110 +176,204 @@ __docker-compose_commands () {
|
||||
local -a lines
|
||||
lines=(${(f)"$(_call_program commands docker-compose 2>&1)"})
|
||||
_docker_compose_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/ ##/:})
|
||||
_store_cache docker_compose_subcommands _docker_compose_subcommands
|
||||
(( $#_docker_compose_subcommands > 0 )) && _store_cache docker_compose_subcommands _docker_compose_subcommands
|
||||
fi
|
||||
_describe -t docker-compose-commands "docker-compose command" _docker_compose_subcommands
|
||||
}
|
||||
|
||||
__docker-compose_subcommand () {
|
||||
local -a _command_args
|
||||
__docker-compose_subcommand() {
|
||||
local opts_help opts_force_recreate opts_no_recreate opts_no_build opts_remove_orphans opts_timeout opts_no_color opts_no_deps
|
||||
|
||||
opts_help='(: -)--help[Print usage]'
|
||||
opts_force_recreate="(--no-recreate)--force-recreate[Recreate containers even if their configuration and image haven't changed. Incompatible with --no-recreate.]"
|
||||
opts_no_recreate="(--force-recreate)--no-recreate[If containers already exist, don't recreate them. Incompatible with --force-recreate.]"
|
||||
opts_no_build="(--build)--no-build[Don't build an image, even if it's missing.]"
|
||||
opts_remove_orphans="--remove-orphans[Remove containers for services not defined in the Compose file]"
|
||||
opts_timeout=('(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: ")
|
||||
opts_no_color='--no-color[Produce monochrome output.]'
|
||||
opts_no_deps="--no-deps[Don't start linked services.]"
|
||||
|
||||
integer ret=1
|
||||
|
||||
case "$words[1]" in
|
||||
(build)
|
||||
_arguments \
|
||||
'--no-cache[Do not use cache when building the image]' \
|
||||
$opts_help \
|
||||
'--force-rm[Always remove intermediate containers.]' \
|
||||
'--no-cache[Do not use cache when building the image.]' \
|
||||
'--pull[Always attempt to pull a newer version of the image.]' \
|
||||
'*:services:__docker-compose_services_from_build' && ret=0
|
||||
;;
|
||||
(bundle)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--output -o)'{--output,-o}'[Path to write the bundle file to. Defaults to "<project name>.dab".]:file:_files' && ret=0
|
||||
;;
|
||||
(config)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \
|
||||
'--services[Print the service names, one per line.]' && ret=0
|
||||
;;
|
||||
(create)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
$opts_force_recreate \
|
||||
$opts_no_recreate \
|
||||
$opts_no_build \
|
||||
"(--no-build)--build[Build images before creating containers.]" \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(down)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
"--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
|
||||
;;
|
||||
(events)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'--json[Output events as a stream of json objects]' \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(exec)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'-d[Detached mode: Run command in the background.]' \
|
||||
'--privileged[Give extended privileges to the process.]' \
|
||||
'--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: ' \
|
||||
'(-):running services:__docker-compose_runningservices' \
|
||||
'(-):command: _command_names -e' \
|
||||
'*::arguments: _normal' && ret=0
|
||||
;;
|
||||
(help)
|
||||
_arguments ':subcommand:__docker-compose_commands' && ret=0
|
||||
;;
|
||||
(kill)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'-s[SIGNAL to send to the container. Default signal is SIGKILL.]:signal:_signals' \
|
||||
'*:running services:__docker-compose_runningservices' && ret=0
|
||||
;;
|
||||
(logs)
|
||||
_arguments \
|
||||
'--no-color[Produce monochrome output.]' \
|
||||
$opts_help \
|
||||
'(-f --follow)'{-f,--follow}'[Follow log output]' \
|
||||
$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
|
||||
;;
|
||||
(migrate-to-labels)
|
||||
(pause)
|
||||
_arguments \
|
||||
'(-):Recreate containers to add labels' && ret=0
|
||||
$opts_help \
|
||||
'*:running services:__docker-compose_runningservices' && ret=0
|
||||
;;
|
||||
(port)
|
||||
_arguments \
|
||||
'--protocol=-[tcp or udap (defaults to tcp)]:protocol:(tcp udp)' \
|
||||
'--index=-[index of the container if there are mutiple instances of a service (defaults to 1)]:index: ' \
|
||||
$opts_help \
|
||||
'--protocol=[tcp or udp \[default: tcp\]]:protocol:(tcp udp)' \
|
||||
'--index=[index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \
|
||||
'1:running services:__docker-compose_runningservices' \
|
||||
'2:port:_ports' && ret=0
|
||||
;;
|
||||
(ps)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'-q[Only display IDs]' \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(pull)
|
||||
_arguments \
|
||||
'--allow-insecure-ssl[Allow insecure connections to the docker registry]' \
|
||||
$opts_help \
|
||||
'--ignore-pull-failures[Pull what it can and ignores images with pull failures.]' \
|
||||
'*:services:__docker-compose_services_from_image' && ret=0
|
||||
;;
|
||||
(push)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'--ignore-push-failures[Push what it can and ignores images with push failures.]' \
|
||||
'*:services:__docker-compose_services' && ret=0
|
||||
;;
|
||||
(rm)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(-f --force)'{-f,--force}"[Don't ask to confirm removal]" \
|
||||
'-v[Remove volumes associated with containers]' \
|
||||
'-v[Remove any anonymous volumes attached to containers]' \
|
||||
'*:stopped services:__docker-compose_stoppedservices' && ret=0
|
||||
;;
|
||||
(run)
|
||||
_arguments \
|
||||
'--allow-insecure-ssl[Allow insecure connections to the docker registry]' \
|
||||
$opts_help \
|
||||
'-d[Detached mode: Run container in the background, print new container name.]' \
|
||||
'--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \
|
||||
'*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \
|
||||
'(-u --user)'{-u,--user=-}'[Run as specified username or uid]:username or uid:_users' \
|
||||
"--no-deps[Don't start linked services.]" \
|
||||
'--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \
|
||||
'--name=[Assign a name to the container]:name: ' \
|
||||
$opts_no_deps \
|
||||
'(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \
|
||||
'--rm[Remove container after run. Ignored in detached mode.]' \
|
||||
"--service-ports[Run command with the service's ports enabled and mapped to the host.]" \
|
||||
'-T[Disable pseudo-tty allocation. By default `docker-compose run` allocates a TTY.]' \
|
||||
'(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \
|
||||
'(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \
|
||||
'(-):services:__docker-compose_services' \
|
||||
'(-):command: _command_names -e' \
|
||||
'*::arguments: _normal' && ret=0
|
||||
;;
|
||||
(scale)
|
||||
_arguments '*:running services:__docker-compose_runningservices' && ret=0
|
||||
_arguments \
|
||||
$opts_help \
|
||||
$opts_timeout \
|
||||
'*:running services:__docker-compose_runningservices' && ret=0
|
||||
;;
|
||||
(start)
|
||||
_arguments '*:stopped services:__docker-compose_stoppedservices' && ret=0
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:stopped services:__docker-compose_stoppedservices' && ret=0
|
||||
;;
|
||||
(stop|restart)
|
||||
_arguments \
|
||||
'(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: " \
|
||||
$opts_help \
|
||||
$opts_timeout \
|
||||
'*:running services:__docker-compose_runningservices' && ret=0
|
||||
;;
|
||||
(unpause)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:paused services:__docker-compose_pausedservices' && ret=0
|
||||
;;
|
||||
(up)
|
||||
_arguments \
|
||||
'--allow-insecure-ssl[Allow insecure connections to the docker registry]' \
|
||||
'-d[Detached mode: Run containers in the background, print new container names.]' \
|
||||
'--no-color[Produce monochrome output.]' \
|
||||
"--no-deps[Don't start linked services.]" \
|
||||
"--no-recreate[If containers already exist, don't recreate them.]" \
|
||||
"--no-build[Don't build an image, even if it's missing]" \
|
||||
'(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: " \
|
||||
"--x-smart-recreate[Only recreate containers whose configuration or image needs to be updated. (EXPERIMENTAL)]" \
|
||||
$opts_help \
|
||||
'(--abort-on-container-exit)-d[Detached mode: Run containers in the background, print new container names. Incompatible with --abort-on-container-exit.]' \
|
||||
$opts_no_color \
|
||||
$opts_no_deps \
|
||||
$opts_force_recreate \
|
||||
$opts_no_recreate \
|
||||
$opts_no_build \
|
||||
"(--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: " \
|
||||
$opts_remove_orphans \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(version)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
"--short[Shows only Compose's version number.]" && ret=0
|
||||
;;
|
||||
(*)
|
||||
_message 'Unknown sub command'
|
||||
_message 'Unknown sub command' && ret=1
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_docker-compose () {
|
||||
_docker-compose() {
|
||||
# Support for subservices, which allows for `compdef _docker docker-shell=_docker_containers`.
|
||||
# Based on /usr/share/zsh/functions/Completion/Unix/_git without support for `ret`.
|
||||
if [[ $service != docker-compose ]]; then
|
||||
@ -262,34 +381,62 @@ _docker-compose () {
|
||||
return
|
||||
fi
|
||||
|
||||
local curcontext="$curcontext" state line ret=1
|
||||
local curcontext="$curcontext" state line
|
||||
integer ret=1
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
'(- :)'{-h,--help}'[Get help]' \
|
||||
'--verbose[Show more output]' \
|
||||
'(- :)'{-v,--version}'[Print version and exit]' \
|
||||
'(-f --file)'{-f,--file}'[Specify an alternate docker-compose file (default: docker-compose.yml)]:file:_files -g "*.yml"' \
|
||||
'(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \
|
||||
'--verbose[Show more output]' \
|
||||
'(- :)'{-v,--version}'[Print version and exit]' \
|
||||
'(-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:' \
|
||||
'--tlscert=[Path to TLS certificate file]:client cert path:' \
|
||||
'--tlskey=[Path to TLS key file]:tls key path:' \
|
||||
'--tlsverify[Use TLS and verify the remote]' \
|
||||
"--skip-hostname-check[Don't check the daemon's hostname against the name specified in the client certificate (for example if your docker host is an IP address)]" \
|
||||
'(-): :->command' \
|
||||
'(-)*:: :->option-or-argument' && ret=0
|
||||
|
||||
local counter=1
|
||||
#local compose_file compose_project
|
||||
while [ $counter -lt ${#words[@]} ]; do
|
||||
case "${words[$counter]}" in
|
||||
-f|--file)
|
||||
(( counter++ ))
|
||||
compose_file="${words[$counter]}"
|
||||
;;
|
||||
-p|--project-name)
|
||||
(( counter++ ))
|
||||
compose_project="${words[$counter]}"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
(( counter++ ))
|
||||
local -a relevant_compose_flags relevant_docker_flags compose_options docker_options
|
||||
|
||||
relevant_compose_flags=(
|
||||
"--file" "-f"
|
||||
"--host" "-H"
|
||||
"--project-name" "-p"
|
||||
"--tls"
|
||||
"--tlscacert"
|
||||
"--tlscert"
|
||||
"--tlskey"
|
||||
"--tlsverify"
|
||||
"--skip-hostname-check"
|
||||
)
|
||||
|
||||
relevant_docker_flags=(
|
||||
"--host" "-H"
|
||||
"--tls"
|
||||
"--tlscacert"
|
||||
"--tlscert"
|
||||
"--tlskey"
|
||||
"--tlsverify"
|
||||
)
|
||||
|
||||
for k in "${(@k)opt_args}"; do
|
||||
if [[ -n "${relevant_docker_flags[(r)$k]}" ]]; then
|
||||
docker_options+=$k
|
||||
if [[ -n "$opt_args[$k]" ]]; then
|
||||
docker_options+=$opt_args[$k]
|
||||
fi
|
||||
fi
|
||||
if [[ -n "${relevant_compose_flags[(r)$k]}" ]]; then
|
||||
compose_options+=$k
|
||||
if [[ -n "$opt_args[$k]" ]]; then
|
||||
compose_options+=$opt_args[$k]
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
case $state in
|
||||
|
23
plugins/docker-compose/docker-compose.plugin.zsh
Normal file
23
plugins/docker-compose/docker-compose.plugin.zsh
Normal file
@ -0,0 +1,23 @@
|
||||
# Authors:
|
||||
# https://github.com/tristola
|
||||
#
|
||||
# Docker-compose related zsh aliases
|
||||
|
||||
# Aliases ###################################################################
|
||||
|
||||
# Use dco as alias for docker-compose, since dc on *nix is 'dc - an arbitrary precision calculator'
|
||||
# https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html
|
||||
|
||||
alias dco='docker-compose'
|
||||
|
||||
alias dcb='docker-compose build'
|
||||
alias dce='docker-compose exec'
|
||||
alias dcps='docker-compose ps'
|
||||
alias dcrestart='docker-compose restart'
|
||||
alias dcrm='docker-compose rm'
|
||||
alias dcr='docker-compose run'
|
||||
alias dcstop='docker-compose stop'
|
||||
alias dcup='docker-compose up'
|
||||
alias dcdn='docker-compose down'
|
||||
alias dcl='docker-compose logs'
|
||||
alias dclf='docker-compose logs -f'
|
@ -1,19 +1,5 @@
|
||||
## Docker autocomplete plugin
|
||||
|
||||
- Adds autocomplete options for all docker commands.
|
||||
- Will also show containerIDs and Image names where applicable
|
||||
|
||||
####Shows help for all commands
|
||||
![General Help](http://i.imgur.com/tUBO9jh.png "Help for all commands")
|
||||
|
||||
|
||||
####Shows your downloaded images where applicable
|
||||
![Images](http://i.imgur.com/R8ZsWO1.png "Images")
|
||||
|
||||
|
||||
####Shows your running containers where applicable
|
||||
![Containers](http://i.imgur.com/WQtbheg.png "Containers")
|
||||
|
||||
|
||||
|
||||
Maintainer : Ahmed Azaan ([@aeonazaan](https://twitter.com/aeonazaan))
|
||||
A copy of the completion script from the
|
||||
[docker](https://github.com/docker/docker/tree/master/contrib/completion/zsh)
|
||||
git repo.
|
||||
|
File diff suppressed because it is too large
Load Diff
34
plugins/dotenv/README.md
Normal file
34
plugins/dotenv/README.md
Normal file
@ -0,0 +1,34 @@
|
||||
# dotenv
|
||||
|
||||
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.
|
||||
|
||||
## Installation
|
||||
|
||||
Just add the plugin to your `.zshrc`:
|
||||
|
||||
```sh
|
||||
plugins=(git man dotenv)
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Create `.env` file inside your project directory and put your local ENV variables there.
|
||||
|
||||
For example:
|
||||
```sh
|
||||
export AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a
|
||||
export SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
|
||||
export MONGO_URI=mongodb://127.0.0.1:27017
|
||||
export PORT=3001
|
||||
```
|
||||
`export` is optional. This format works as well:
|
||||
```sh
|
||||
AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a
|
||||
SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
|
||||
MONGO_URI=mongodb://127.0.0.1:27017
|
||||
PORT=3001
|
||||
```
|
||||
|
||||
**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.
|
10
plugins/dotenv/dotenv.plugin.zsh
Normal file
10
plugins/dotenv/dotenv.plugin.zsh
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/zsh
|
||||
|
||||
source_env() {
|
||||
if [[ -f .env ]]; then
|
||||
source .env
|
||||
fi
|
||||
}
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook chpwd source_env
|
19
plugins/droplr/README.md
Normal file
19
plugins/droplr/README.md
Normal file
@ -0,0 +1,19 @@
|
||||
# droplr
|
||||
|
||||
Use [Droplr](https://droplr.com/) from the command line to upload files and shorten
|
||||
links. It needs to have [Droplr.app](https://droplr.com/apps) installed and logged
|
||||
in. MacOS only.
|
||||
|
||||
To use it, add `droplr` to the `$plugins` variable in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... droplr)
|
||||
```
|
||||
|
||||
Author: [Fabio Fernandes](https://github.com/fabiofl)
|
||||
|
||||
## Examples
|
||||
|
||||
- Upload a file: `droplr ./path/to/file/`
|
||||
|
||||
- Shorten a link: `droplr http://example.com`
|
15
plugins/droplr/droplr.plugin.zsh
Normal file
15
plugins/droplr/droplr.plugin.zsh
Normal file
@ -0,0 +1,15 @@
|
||||
# Only compatible with MacOS
|
||||
[[ "$OSTYPE" == darwin* ]] || return
|
||||
|
||||
droplr() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo You need to specify a parameter. >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ "$1" =~ ^https?:// ]]; then
|
||||
osascript -e 'tell app "Droplr" to shorten "'"$1"'"'
|
||||
else
|
||||
open -ga /Applications/Droplr.app "$1"
|
||||
fi
|
||||
}
|
@ -10,7 +10,7 @@
|
||||
# - Configuration changes made at runtime are applied to all frames.
|
||||
|
||||
|
||||
if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
|
||||
if "$ZSH/tools/require_tool.sh" emacs 24 2>/dev/null ; then
|
||||
export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh"
|
||||
|
||||
# set EDITOR if not already defined.
|
||||
@ -18,15 +18,14 @@ if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
|
||||
|
||||
alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait"
|
||||
alias e=emacs
|
||||
# open terminal emacsclient
|
||||
alias te="$EMACS_PLUGIN_LAUNCHER -nw"
|
||||
|
||||
# same than M-x eval but from outside Emacs.
|
||||
alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
|
||||
# create a new X frame
|
||||
alias eframe='emacsclient --alternate-editor "" --create-frame'
|
||||
|
||||
# to code all night long
|
||||
alias emasc=emacs
|
||||
alias emcas=emacs
|
||||
|
||||
# Write to standard output the path to the file
|
||||
# opened in the current buffer.
|
||||
|
@ -1,12 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
# get list of available X windows.
|
||||
x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`
|
||||
_emacsfun()
|
||||
{
|
||||
# get list of emacs frames.
|
||||
frameslist=`emacsclient --alternate-editor '' --eval '(frame-list)' 2>/dev/null | egrep -o '(frame)+'`
|
||||
|
||||
if [ -z "$x" ] || [ "$x" = "nil" ] ;then
|
||||
# Create one if there is no X window yet.
|
||||
emacsclient --alternate-editor "" --create-frame "$@"
|
||||
if [ "$(echo "$frameslist" | sed -n '$=')" -ge 2 ] ;then
|
||||
# prevent creating another X frame if there is at least one present.
|
||||
emacsclient --alternate-editor "" "$@"
|
||||
else
|
||||
# Create one if there is no X window yet.
|
||||
emacsclient --alternate-editor "" --create-frame "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# adopted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh
|
||||
# If the second argument is - then write stdin to a tempfile and open the
|
||||
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
|
||||
if [ "$#" -ge "2" -a "$2" = "-" ]
|
||||
then
|
||||
tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)"
|
||||
cat - > "$tempfile"
|
||||
_emacsfun --no-wait $tempfile
|
||||
else
|
||||
# prevent creating another X frame if there is at least one present.
|
||||
emacsclient --alternate-editor "" "$@"
|
||||
_emacsfun "$@"
|
||||
fi
|
||||
|
@ -6,14 +6,16 @@ Ember CLI (http://www.ember-cli.com/)
|
||||
|
||||
### List of Aliases
|
||||
|
||||
alias es='ember serve'
|
||||
alias ea='ember addon'
|
||||
alias eb='ember build'
|
||||
alias ed='ember destroy'
|
||||
alias eg='ember generate'
|
||||
alias eh='ember help'
|
||||
alias ein='ember init'
|
||||
alias ei='ember install'
|
||||
alias et='ember test'
|
||||
alias eu='ember update'
|
||||
alias ev='ember version'
|
||||
Alias | Ember-CLI command
|
||||
----- | -----------------
|
||||
**es** | *ember serve*
|
||||
**ea** | *ember addon*
|
||||
**eb** | *ember build*
|
||||
**ed** | *ember destroy*
|
||||
**eg** | *ember generate*
|
||||
**eh** | *ember help*
|
||||
**ein** | *ember init*
|
||||
**ei** | *ember install*
|
||||
**et** | *ember test*
|
||||
**eu** | *ember update*
|
||||
**ev** | *ember version*
|
||||
|
@ -1,4 +1,17 @@
|
||||
encode64(){ echo -n $1 | base64 }
|
||||
decode64(){ echo -n $1 | base64 --decode }
|
||||
encode64() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
cat | base64
|
||||
else
|
||||
printf '%s' $1 | base64
|
||||
fi
|
||||
}
|
||||
|
||||
decode64() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
cat | base64 --decode
|
||||
else
|
||||
printf '%s' $1 | base64 --decode
|
||||
fi
|
||||
}
|
||||
alias e64=encode64
|
||||
alias d64=decode64
|
||||
|
46
plugins/extract/README.md
Normal file
46
plugins/extract/README.md
Normal file
@ -0,0 +1,46 @@
|
||||
# extract plugin
|
||||
|
||||
This plugin defines a function called `extract` that extracts the archive file
|
||||
you pass it, and it supports a wide variety of archive filetypes.
|
||||
|
||||
This way you don't have to know what specific command extracts a file, you just
|
||||
do `extract <filename>` and the function takes care of the rest.
|
||||
|
||||
To use it, add `extract` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... extract)
|
||||
```
|
||||
|
||||
## Supported file extensions
|
||||
|
||||
| Extension | Description |
|
||||
|:------------------|:-------------------------------------|
|
||||
| `7z` | 7zip file |
|
||||
| `Z` | Z archive (LZW) |
|
||||
| `apk` | Android app file |
|
||||
| `bz2` | Bzip2 file |
|
||||
| `deb` | Debian package |
|
||||
| `gz` | Gzip file |
|
||||
| `ipsw` | iOS firmware file |
|
||||
| `jar` | Java Archive |
|
||||
| `lzma` | LZMA archive |
|
||||
| `rar` | WinRAR archive |
|
||||
| `sublime-package` | Sublime Text package |
|
||||
| `tar` | Tarball |
|
||||
| `tar.bz2` | Tarball with bzip2 compression |
|
||||
| `tar.gz` | Tarball with gzip compression |
|
||||
| `tar.xz` | Tarball with lzma2 compression |
|
||||
| `tar.zma` | Tarball with lzma compression |
|
||||
| `tbz` | Tarball with bzip compression |
|
||||
| `tbz2` | Tarball with bzip2 compression |
|
||||
| `tgz` | Tarball with gzip compression |
|
||||
| `tlz` | Tarball with lzma compression |
|
||||
| `txz` | Tarball with lzma2 compression |
|
||||
| `war` | Web Application archive (Java-based) |
|
||||
| `xpi` | Mozilla XPI module file |
|
||||
| `xz` | LZMA2 archive |
|
||||
| `zip` | Zip archive |
|
||||
|
||||
See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for
|
||||
more information regarding archive formats.
|
@ -3,6 +3,5 @@
|
||||
|
||||
_arguments \
|
||||
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
|
||||
"*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|ipsw|rar|7z|deb)(-.)'" && return 0
|
||||
|
||||
|
||||
"*::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)(-.)'" \
|
||||
&& return 0
|
||||
|
@ -1,80 +1,71 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# FILE: extract.plugin.zsh
|
||||
# DESCRIPTION: oh-my-zsh plugin file.
|
||||
# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
|
||||
# VERSION: 1.0.1
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
function extract() {
|
||||
local remove_archive
|
||||
local success
|
||||
local file_name
|
||||
local extract_dir
|
||||
|
||||
if (( $# == 0 )); then
|
||||
echo "Usage: extract [-option] [file ...]"
|
||||
echo
|
||||
echo Options:
|
||||
echo " -r, --remove Remove archive."
|
||||
echo
|
||||
echo "Report bugs to <sorin.ionescu@gmail.com>."
|
||||
fi
|
||||
|
||||
remove_archive=1
|
||||
if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then
|
||||
remove_archive=0
|
||||
shift
|
||||
fi
|
||||
|
||||
while (( $# > 0 )); do
|
||||
if [[ ! -f "$1" ]]; then
|
||||
echo "extract: '$1' is not a valid file" 1>&2
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
|
||||
success=0
|
||||
file_name="$( basename "$1" )"
|
||||
extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )"
|
||||
case "$1" in
|
||||
(*.tar.gz|*.tgz) [ -z $commands[pigz] ] && tar zxvf "$1" || pigz -dc "$1" | tar xv ;;
|
||||
(*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
|
||||
(*.tar.xz|*.txz) tar --xz --help &> /dev/null \
|
||||
&& tar --xz -xvf "$1" \
|
||||
|| xzcat "$1" | tar xvf - ;;
|
||||
(*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \
|
||||
&& tar --lzma -xvf "$1" \
|
||||
|| lzcat "$1" | tar xvf - ;;
|
||||
(*.tar) tar xvf "$1" ;;
|
||||
(*.gz) [ -z $commands[pigz] ] && gunzip "$1" || pigz -d "$1" ;;
|
||||
(*.bz2) bunzip2 "$1" ;;
|
||||
(*.xz) unxz "$1" ;;
|
||||
(*.lzma) unlzma "$1" ;;
|
||||
(*.Z) uncompress "$1" ;;
|
||||
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw) unzip "$1" -d $extract_dir ;;
|
||||
(*.rar) unrar x -ad "$1" ;;
|
||||
(*.7z) 7za x "$1" ;;
|
||||
(*.deb)
|
||||
mkdir -p "$extract_dir/control"
|
||||
mkdir -p "$extract_dir/data"
|
||||
cd "$extract_dir"; ar vx "../${1}" > /dev/null
|
||||
cd control; tar xzvf ../control.tar.gz
|
||||
cd ../data; tar xzvf ../data.tar.gz
|
||||
cd ..; rm *.tar.gz debian-binary
|
||||
cd ..
|
||||
;;
|
||||
(*)
|
||||
echo "extract: '$1' cannot be extracted" 1>&2
|
||||
success=1
|
||||
;;
|
||||
esac
|
||||
|
||||
(( success = $success > 0 ? $success : $? ))
|
||||
(( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
alias x=extract
|
||||
|
||||
extract() {
|
||||
local remove_archive
|
||||
local success
|
||||
local extract_dir
|
||||
|
||||
if (( $# == 0 )); then
|
||||
cat <<-'EOF' >&2
|
||||
Usage: extract [-option] [file ...]
|
||||
|
||||
Options:
|
||||
-r, --remove Remove archive.
|
||||
EOF
|
||||
fi
|
||||
|
||||
remove_archive=1
|
||||
if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then
|
||||
remove_archive=0
|
||||
shift
|
||||
fi
|
||||
|
||||
while (( $# > 0 )); do
|
||||
if [[ ! -f "$1" ]]; then
|
||||
echo "extract: '$1' is not a valid file" >&2
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
|
||||
success=0
|
||||
extract_dir="${1:t:r}"
|
||||
case "$1" in
|
||||
(*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$1" | tar xv } || tar zxvf "$1" ;;
|
||||
(*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
|
||||
(*.tar.xz|*.txz)
|
||||
tar --xz --help &> /dev/null \
|
||||
&& tar --xz -xvf "$1" \
|
||||
|| xzcat "$1" | tar xvf - ;;
|
||||
(*.tar.zma|*.tlz)
|
||||
tar --lzma --help &> /dev/null \
|
||||
&& tar --lzma -xvf "$1" \
|
||||
|| lzcat "$1" | tar xvf - ;;
|
||||
(*.tar) tar xvf "$1" ;;
|
||||
(*.gz) (( $+commands[pigz] )) && pigz -d "$1" || gunzip "$1" ;;
|
||||
(*.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 ;;
|
||||
(*.rar) unrar x -ad "$1" ;;
|
||||
(*.7z) 7za x "$1" ;;
|
||||
(*.deb)
|
||||
mkdir -p "$extract_dir/control"
|
||||
mkdir -p "$extract_dir/data"
|
||||
cd "$extract_dir"; ar vx "../${1}" > /dev/null
|
||||
cd control; tar xzvf ../control.tar.gz
|
||||
cd ../data; extract ../data.tar.*
|
||||
cd ..; rm *.tar.* debian-binary
|
||||
cd ..
|
||||
;;
|
||||
(*)
|
||||
echo "extract: '$1' cannot be extracted" >&2
|
||||
success=1
|
||||
;;
|
||||
esac
|
||||
|
||||
(( success = $success > 0 ? $success : $? ))
|
||||
(( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
@ -6,6 +6,6 @@ if [ $commands[fasd] ]; then # check if fasd is installed
|
||||
source "$fasd_cache"
|
||||
unset fasd_cache
|
||||
|
||||
alias v='f -e vim'
|
||||
alias v="f -e $EDITOR"
|
||||
alias o='a -e open_command'
|
||||
fi
|
||||
|
17
plugins/firewalld/firewalld.plugin.zsh
Normal file
17
plugins/firewalld/firewalld.plugin.zsh
Normal file
@ -0,0 +1,17 @@
|
||||
alias fw="sudo firewall-cmd"
|
||||
alias fwp="sudo firewall-cmd --permanent"
|
||||
alias fwr="sudo firewall-cmd --reload"
|
||||
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)}")
|
||||
|
||||
for i in $zones; do
|
||||
sudo firewall-cmd --zone $i --list-all
|
||||
done
|
||||
|
||||
echo 'Direct Rules:'
|
||||
sudo firewall-cmd --direct --get-all-rules
|
||||
}
|
22
plugins/firewalld/readme.md
Normal file
22
plugins/firewalld/readme.md
Normal file
@ -0,0 +1,22 @@
|
||||
# FirewallD Plugin
|
||||
|
||||
This plugin adds some aliases and functions for FirewallD using the `firewalld-cmd` command. To use it, add firewalld to your plugins array.
|
||||
|
||||
```zsh
|
||||
plugins=(... firewalld)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| :---- | :----------------------------------------- | :--------------------------- |
|
||||
| fw | `sudo firewall-cmd` | Shorthand |
|
||||
| fwr | `sudo firewall-cmd --reload` | Reload current configuration |
|
||||
| fwp | `sudo firewall-cmd --permanent` | Create permanent rule |
|
||||
| fwrp | `sudo firewall-cmd --runtime-to-permanent` | Save current configuration |
|
||||
|
||||
## Functions
|
||||
|
||||
| Function | Description |
|
||||
| :------- | :--------------------------------------------------------- |
|
||||
| fwl | Lists configuration from all active zones and direct rules |
|
@ -4,10 +4,12 @@ Plugin for ForkLift, an FTP application for OS X.
|
||||
|
||||
### Requirements
|
||||
|
||||
* [ForkLift](http://forkliftapp.com/forklift/)
|
||||
* [ForkLift](http://www.binarynights.com/forklift/)
|
||||
|
||||
### Usage
|
||||
|
||||
* If `fl` is called without arguments then the current folder is opened in ForkLift. Is equivalent to `fl .`
|
||||
<code>fl [*file_or_folder*]</code>
|
||||
|
||||
* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift
|
||||
* If `fl` is called without arguments then the current folder is opened in ForkLift. This is equivalent to `fl .`.
|
||||
|
||||
* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift. If called with a non-directory file as the argument, then the file's parent directory is opened.
|
||||
|
7
plugins/fossil/README.md
Normal file
7
plugins/fossil/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
## Fossil Plugin
|
||||
|
||||
This plugin adds completion support and prompt for fossil repositories.
|
||||
The prompt will display the current branch and status been dirty or clean.
|
||||
|
||||
### CONTRIBUTOR
|
||||
- Jefferson González ([jgmdev](https://github.com/jgmdev))
|
89
plugins/fossil/fossil.plugin.zsh
Normal file
89
plugins/fossil/fossil.plugin.zsh
Normal file
@ -0,0 +1,89 @@
|
||||
_FOSSIL_PROMPT=""
|
||||
|
||||
# Prefix at the very beginning of the prompt, before the branch name
|
||||
ZSH_THEME_FOSSIL_PROMPT_PREFIX="%{$fg_bold[blue]%}fossil:(%{$fg_bold[red]%}"
|
||||
|
||||
# At the very end of the prompt
|
||||
ZSH_THEME_FOSSIL_PROMPT_SUFFIX="%{$fg_bold[blue]%})"
|
||||
|
||||
# Text to display if the branch is dirty
|
||||
ZSH_THEME_FOSSIL_PROMPT_DIRTY=" %{$fg_bold[red]%}✖"
|
||||
|
||||
# Text to display if the branch is clean
|
||||
ZSH_THEME_FOSSIL_PROMPT_CLEAN=" %{$fg_bold[green]%}✔"
|
||||
|
||||
function fossil_prompt_info () {
|
||||
local _OUTPUT=`fossil branch 2>&1`
|
||||
local _STATUS=`echo $_OUTPUT | grep "use --repo"`
|
||||
if [ "$_STATUS" = "" ]; then
|
||||
local _EDITED=`fossil changes`
|
||||
local _EDITED_SYM="$ZSH_THEME_FOSSIL_PROMPT_CLEAN"
|
||||
local _BRANCH=`echo $_OUTPUT | grep "* " | sed 's/* //g'`
|
||||
|
||||
if [ "$_EDITED" != "" ]; then
|
||||
_EDITED_SYM="$ZSH_THEME_FOSSIL_PROMPT_DIRTY"
|
||||
fi
|
||||
|
||||
echo "$ZSH_THEME_FOSSIL_PROMPT_PREFIX" \
|
||||
"$_BRANCH" \
|
||||
"$ZSH_THEME_FOSSIL_PROMPT_SUFFIX" \
|
||||
"$_EDITED_SYM"\
|
||||
"%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
|
||||
function _fossil_get_command_list () {
|
||||
fossil help -a | grep -v "Usage|Common|This is"
|
||||
}
|
||||
|
||||
function _fossil () {
|
||||
local context state state_descr line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments \
|
||||
'1: :->command'\
|
||||
'2: :->subcommand'
|
||||
|
||||
case $state in
|
||||
command)
|
||||
local _OUTPUT=`fossil branch 2>&1 | grep "use --repo"`
|
||||
if [ "$_OUTPUT" = "" ]; then
|
||||
compadd `_fossil_get_command_list`
|
||||
else
|
||||
compadd clone init import help version
|
||||
fi
|
||||
;;
|
||||
subcommand)
|
||||
if [ "$words[2]" = "help" ]; then
|
||||
compadd `_fossil_get_command_list`
|
||||
else
|
||||
compcall -D
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function _fossil_prompt () {
|
||||
local current=`echo $PROMPT $RPROMPT | grep fossil`
|
||||
|
||||
if [ "$_FOSSIL_PROMPT" = "" -o "$current" = "" ]; then
|
||||
local _prompt=${PROMPT}
|
||||
local _rprompt=${RPROMPT}
|
||||
|
||||
local is_prompt=`echo $PROMPT | grep git`
|
||||
|
||||
if [ "$is_prompt" = "" ]; then
|
||||
export RPROMPT="$_rprompt"'$(fossil_prompt_info)'
|
||||
else
|
||||
export PROMPT="$_prompt"'$(fossil_prompt_info) '
|
||||
fi
|
||||
|
||||
_FOSSIL_PROMPT="1"
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _fossil fossil
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
|
||||
add-zsh-hook precmd _fossil_prompt
|
@ -38,7 +38,7 @@ Available search contexts are:
|
||||
| bootsnipp | `http://bootsnipp.com/search?q=` |
|
||||
| caniuse | `http://caniuse.com/#search=` |
|
||||
| codepen | `http://codepen.io/search?q=` |
|
||||
| compass | `http://compass-style.org/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=` |
|
||||
|
@ -19,7 +19,7 @@ function _frontend() {
|
||||
commands=(
|
||||
'jquery: Search in jQuery website'
|
||||
'mdn: Search in MDN website'
|
||||
'compass: Search in COMPASS website'
|
||||
'compassdoc: Search in COMPASS website'
|
||||
'html5please: Search in HTML5 Please website'
|
||||
'caniuse: Search in Can I Use website'
|
||||
'aurajs: Search in AuraJs website'
|
||||
@ -57,7 +57,7 @@ function _frontend() {
|
||||
mdn)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
compass)
|
||||
compassdoc)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
html5please)
|
||||
|
@ -4,7 +4,7 @@ alias bem='frontend bem'
|
||||
alias bootsnipp='frontend bootsnipp'
|
||||
alias caniuse='frontend caniuse'
|
||||
alias codepen='frontend codepen'
|
||||
alias compass='frontend compass'
|
||||
alias compassdoc='frontend compassdoc'
|
||||
alias cssflow='frontend cssflow'
|
||||
alias dartlang='frontend dartlang'
|
||||
alias emberjs='frontend emberjs'
|
||||
@ -32,7 +32,7 @@ function frontend() {
|
||||
bootsnipp 'http://bootsnipp.com/search?q='
|
||||
caniuse 'http://caniuse.com/#search='
|
||||
codepen 'http://codepen.io/search?q='
|
||||
compass 'http://compass-style.org/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='
|
||||
@ -57,7 +57,7 @@ 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, compass, cssflow,"
|
||||
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 ""
|
||||
@ -73,7 +73,7 @@ function frontend() {
|
||||
echo ""
|
||||
echo "Valid contexts are:"
|
||||
echo ""
|
||||
echo " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compass, cssflow, "
|
||||
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 ""
|
||||
|
21
plugins/gb/README.md
Normal file
21
plugins/gb/README.md
Normal file
@ -0,0 +1,21 @@
|
||||
# `gb` plugin
|
||||
|
||||
> A project based build tool for the Go programming language.
|
||||
|
||||
See https://getgb.io for the full `gb` documentation
|
||||
|
||||
* * * *
|
||||
|
||||
- Adds completion support for all `gb` commands.
|
||||
- Also supports completion for the [`gb-vendor` plugin](https://godoc.org/github.com/constabulary/gb/cmd/gb-vendor).
|
||||
|
||||
To use it, add `gb` to your plugins array:
|
||||
```sh
|
||||
plugins=(... gb)
|
||||
```
|
||||
|
||||
## Caveats
|
||||
|
||||
The `git` plugin defines an alias `gb` that usually conflicts with the `gb` program.
|
||||
If you're having trouble with it, remove it by adding `unalias gb` at the end of your
|
||||
zshrc file.
|
111
plugins/gb/_gb
Normal file
111
plugins/gb/_gb
Normal file
@ -0,0 +1,111 @@
|
||||
#compdef gb
|
||||
#autoload
|
||||
|
||||
_gb () {
|
||||
local ret=1 state
|
||||
_arguments -C ':command:->command' '*::options:->options' && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
"build:build a package"
|
||||
"doc:show documentation for a package or symbol"
|
||||
"env:print project environment variables"
|
||||
"generate:generate Go files by processing source"
|
||||
"help:displays the help"
|
||||
"info:info returns information about this project"
|
||||
"list:list the packages named by the importpaths"
|
||||
"test:test packages"
|
||||
"vendor:manage your vendored dependencies"
|
||||
)
|
||||
_describe -t subcommands 'gb subcommands' subcommands && ret=0
|
||||
;;
|
||||
(options)
|
||||
case $line[1] in
|
||||
(build)
|
||||
_arguments \
|
||||
-f'[ignore cached packages]' \
|
||||
-F'[do not cache packages]' \
|
||||
-q'[decreases verbosity]' \
|
||||
-P'[the number of build jobs to run in parallel]' \
|
||||
-R'[sets the base of the project root search path]' \
|
||||
-dotfile'[output a dot formatted file of the build steps]' \
|
||||
-ldflags'["flag list" arguments to pass to the linker]' \
|
||||
-gcflags'["arg list" arguments to pass to the compiler]' \
|
||||
-race'[enable data race detection]' \
|
||||
-tags'["tag list" additional build tags]'
|
||||
;;
|
||||
(list)
|
||||
_arguments \
|
||||
-f'[alternate format for the list, using the syntax of package template]' \
|
||||
-s'[read format template from STDIN]' \
|
||||
-json'[prints output in structured JSON format]'
|
||||
;;
|
||||
(test)
|
||||
_arguments \
|
||||
-v'[print output from test subprocess]' \
|
||||
-ldflags'["flag list" arguments to pass to the linker]' \
|
||||
-gcflags'["arg list" arguments to pass to the compiler]' \
|
||||
-race'[enable data race detection]' \
|
||||
-tags'["tag list" additional build tags]'
|
||||
;;
|
||||
(vendor)
|
||||
_gb-vendor
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_gb-vendor () {
|
||||
local curcontext="$curcontext" state line
|
||||
_arguments -C ':command:->command' '*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
'delete:deletes a local dependency'
|
||||
'fetch:fetch a remote dependency'
|
||||
'list:lists dependencies, one per line'
|
||||
'purge:remove all unreferenced dependencies'
|
||||
'restore:restore dependencies from the manifest'
|
||||
'update:update a local dependency'
|
||||
)
|
||||
_describe -t subcommands 'gb vendor subcommands' subcommands && ret=0
|
||||
;;
|
||||
(options)
|
||||
case $line[1] in
|
||||
(delete)
|
||||
_arguments \
|
||||
-all'[remove all dependencies]'
|
||||
;;
|
||||
(fetch)
|
||||
_arguments \
|
||||
-branch'[fetch from a particular branch]' \
|
||||
-no-recurse'[do not fetch recursively]' \
|
||||
-tag'[fetch the specified tag]' \
|
||||
-revision'[fetch the specific revision from the branch (if supplied)]' \
|
||||
-precaire'[allow the use of insecure protocols]' \
|
||||
;;
|
||||
(list)
|
||||
_arguments \
|
||||
-f'[controls the template used for printing each manifest entry]'
|
||||
;;
|
||||
(restore)
|
||||
_arguments \
|
||||
-precaire'[allow the use of insecure protocols]'
|
||||
;;
|
||||
(update)
|
||||
_arguments \
|
||||
-all'[update all dependencies in the manifest or supply a given dependency]' \
|
||||
-precaire'[allow the use of insecure protocols]'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_gb
|
12
plugins/geeknote/README.md
Normal file
12
plugins/geeknote/README.md
Normal file
@ -0,0 +1,12 @@
|
||||
## ZSH-Geeknote
|
||||
|
||||
[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for [oh-my-zsh framework](http://github.com/robbyrussell/oh-my-zsh).
|
||||
|
||||
Plugins provides:
|
||||
|
||||
- auto completion of commands and their options
|
||||
- alias `gn`
|
||||
|
||||
You can find information how to install Geeknote and it's available commands on the [project website](http://www.geeknote.me/).
|
||||
|
||||
Maintainer : Ján Koščo ([@s7anley](https://twitter.com/s7anley))
|
136
plugins/geeknote/_geeknote
Normal file
136
plugins/geeknote/_geeknote
Normal file
@ -0,0 +1,136 @@
|
||||
#compdef geeknote
|
||||
# --------------- ------------------------------------------------------------
|
||||
# Name : _geeknote
|
||||
# Synopsis : zsh completion for geeknote
|
||||
# Author : Ján Koščo <3k.stanley@gmail.com>
|
||||
# HomePage : http://www.geeknote.me
|
||||
# Version : 0.1
|
||||
# Tag : [ shell, zsh, completion, evernote ]
|
||||
# Copyright : © 2014 by Ján Koščo,
|
||||
# Released under current GPL license.
|
||||
# --------------- ------------------------------------------------------------
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'login'
|
||||
'logout'
|
||||
'settings'
|
||||
'create'
|
||||
'edit'
|
||||
'find'
|
||||
'show'
|
||||
'remove'
|
||||
'notebook-list'
|
||||
'notebook-create'
|
||||
'notebook-edit'
|
||||
'tag-list'
|
||||
'tag-create'
|
||||
'tag-edit'
|
||||
'tag-remove'
|
||||
'gnsync'
|
||||
'user'
|
||||
)
|
||||
|
||||
_arguments '*:: :->command'
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "geeknote command" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
local -a _command_args
|
||||
case "$words[1]" in
|
||||
user)
|
||||
_command_args=(
|
||||
'(--full)--full' \
|
||||
)
|
||||
;;
|
||||
logout)
|
||||
_command_args=(
|
||||
'(--force)--force' \
|
||||
)
|
||||
;;
|
||||
settings)
|
||||
_command_args=(
|
||||
'(--editor)--editor' \
|
||||
)
|
||||
;;
|
||||
create)
|
||||
_command_args=(
|
||||
'(-t|--title)'{-t,--title}'[note title]' \
|
||||
'(-c|--content)'{-c,--content}'[note content]' \
|
||||
'(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
|
||||
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
|
||||
)
|
||||
;;
|
||||
edit)
|
||||
_command_args=(
|
||||
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
|
||||
'(-t|--title)'{-t,--title}'[note title]' \
|
||||
'(-c|--content)'{-c,--content}'[note content]' \
|
||||
'(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
|
||||
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
|
||||
)
|
||||
;;
|
||||
remove)
|
||||
_command_args=(
|
||||
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
|
||||
'(--force)--force' \
|
||||
)
|
||||
;;
|
||||
show)
|
||||
_command_args=(
|
||||
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
|
||||
)
|
||||
;;
|
||||
find)
|
||||
_command_args=(
|
||||
'(-s|--search)'{-s,--search}'[text to search]' \
|
||||
'(-tg|--tags)'{-tg,--tags}'[notes with which tag/tags to search]' \
|
||||
'(-nb|--notebook)'{-nb,--notebook}'[in which notebook search the note]' \
|
||||
'(-d|--date)'{-d,--date}'[date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy]' \
|
||||
'(-cn|--count)'{-cn,--count}'[how many notes show in the result list]' \
|
||||
'(-uo|--url-only)'{-uo,--url-only}'[add direct url of each note in results to Evernote web-version]' \
|
||||
'(-ee|--exact-entry)'{-ee,--exact-entry}'[search for exact entry of the request]' \
|
||||
'(-cs|--content-search)'{-cs,--content-search}'[search by content, not by title]' \
|
||||
)
|
||||
;;
|
||||
notebook-create)
|
||||
_command_args=(
|
||||
'(-t|--title)'{-t,--title}'[notebook title]' \
|
||||
)
|
||||
;;
|
||||
notebook-edit)
|
||||
_command_args=(
|
||||
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook to rename]' \
|
||||
'(-t|--title)'{-t,--title}'[new notebook title]' \
|
||||
)
|
||||
;;
|
||||
notebook-remove)
|
||||
_command_args=(
|
||||
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook to remove]' \
|
||||
'(--force)--force' \
|
||||
)
|
||||
;;
|
||||
tag-create)
|
||||
_command_args=(
|
||||
'(-t|--title)'{-t,--title}'[title of tag]' \
|
||||
)
|
||||
;;
|
||||
tag-edit)
|
||||
_command_args=(
|
||||
'(-tgn|--tagname)'{-tgn,--tagname}'[tag to edit]' \
|
||||
'(-t|--title)'{-t,--title}'[new tag name]' \
|
||||
)
|
||||
;;
|
||||
tag-remove)
|
||||
_command_args=(
|
||||
'(-tgn|--tagname)'{-tgn,--tagname}'[tag to remove]' \
|
||||
'(--force)--force' \
|
||||
)
|
||||
;;
|
||||
esac
|
||||
|
||||
_arguments \
|
||||
$_command_args \
|
||||
&& return 0
|
2
plugins/geeknote/geeknote.plugin.zsh
Normal file
2
plugins/geeknote/geeknote.plugin.zsh
Normal file
@ -0,0 +1,2 @@
|
||||
#Alias
|
||||
alias gn='geeknote'
|
11
plugins/git-extras/README.md
Normal file
11
plugins/git-extras/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# git-extras
|
||||
|
||||
This plugin provides completion definitions for some of the commands defined by [git-extras](http://github.com/tj/git-extras).
|
||||
|
||||
## Setup notes
|
||||
|
||||
The completions work by augmenting the `_git` completion provided by `zsh`. This only works with the `zsh`-provided `_git`, not the `_git` provided by `git` itself. If you have both `zsh` and `git` installed, you need to make sure that the `zsh`-provided `_git` takes precedence.
|
||||
|
||||
### OS X Homebrew Setup
|
||||
|
||||
On OS X with Homebrew, you need to install `git` with `brew install git --without-completions`. Otherwise, `git`'s `_git` will take precedence, and you won't see the completions for `git-extras` commands.
|
@ -1,10 +1,13 @@
|
||||
#compdef git
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for git-extras (http://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
|
||||
# with git.
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
@ -22,16 +25,18 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
__git_command_successful () {
|
||||
if (( ${#pipestatus:#0} > 0 )); then
|
||||
_message 'not a git repository'
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
# Internal functions
|
||||
# These are a lot like their __git_* equivalents inside _git
|
||||
|
||||
__gitex_command_successful () {
|
||||
if (( ${#*:#0} > 0 )); then
|
||||
_message 'not a git repository'
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
__git_commits() {
|
||||
__gitex_commits() {
|
||||
declare -A commits
|
||||
git log --oneline -15 | sed 's/\([[:alnum:]]\{7\}\) /\1:/' | while read commit
|
||||
do
|
||||
@ -42,7 +47,7 @@ __git_commits() {
|
||||
_describe -t commits commit commits && ret=0
|
||||
}
|
||||
|
||||
__git_tag_names() {
|
||||
__gitex_tag_names() {
|
||||
local expl
|
||||
declare -a tag_names
|
||||
tag_names=(${${(f)"$(_call_program tags git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
|
||||
@ -51,7 +56,7 @@ __git_tag_names() {
|
||||
}
|
||||
|
||||
|
||||
__git_branch_names() {
|
||||
__gitex_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/})
|
||||
@ -59,7 +64,7 @@ __git_branch_names() {
|
||||
_wanted branch-names expl branch-name compadd $* - $branch_names
|
||||
}
|
||||
|
||||
__git_specific_branch_names() {
|
||||
__gitex_specific_branch_names() {
|
||||
local expl
|
||||
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/})
|
||||
@ -67,32 +72,28 @@ __git_specific_branch_names() {
|
||||
_wanted branch-names expl branch-name compadd $* - $branch_names
|
||||
}
|
||||
|
||||
|
||||
__git_feature_branch_names() {
|
||||
__git_specific_branch_names 'feature'
|
||||
__gitex_feature_branch_names() {
|
||||
__gitex_specific_branch_names 'feature'
|
||||
}
|
||||
|
||||
|
||||
__git_refactor_branch_names() {
|
||||
__git_specific_branch_names 'refactor'
|
||||
__gitex_refactor_branch_names() {
|
||||
__gitex_specific_branch_names 'refactor'
|
||||
}
|
||||
|
||||
|
||||
__git_bug_branch_names() {
|
||||
__git_specific_branch_names 'bug'
|
||||
__gitex_bug_branch_names() {
|
||||
__gitex_specific_branch_names 'bug'
|
||||
}
|
||||
|
||||
|
||||
__git_submodule_names() {
|
||||
__gitex_submodule_names() {
|
||||
local expl
|
||||
declare -a submodule_names
|
||||
submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"})
|
||||
submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"}) # '
|
||||
__git_command_successful || return
|
||||
_wanted submodule-names expl submodule-name compadd $* - $submodule_names
|
||||
}
|
||||
|
||||
|
||||
__git_author_names() {
|
||||
__gitex_author_names() {
|
||||
local expl
|
||||
declare -a author_names
|
||||
author_names=(${(f)"$(_call_program branchrefs git log --format='%aN' | sort -u)"})
|
||||
@ -123,7 +124,7 @@ _git-bug() {
|
||||
case $line[1] in
|
||||
(finish)
|
||||
_arguments -C \
|
||||
':branch-name:__git_bug_branch_names'
|
||||
':branch-name:__gitex_bug_branch_names'
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
@ -139,7 +140,7 @@ _git-changelog() {
|
||||
|
||||
_git-contrib() {
|
||||
_arguments \
|
||||
':author:__git_author_names'
|
||||
':author:__gitex_author_names'
|
||||
}
|
||||
|
||||
|
||||
@ -151,19 +152,19 @@ _git-count() {
|
||||
|
||||
_git-delete-branch() {
|
||||
_arguments \
|
||||
':branch-name:__git_branch_names'
|
||||
':branch-name:__gitex_branch_names'
|
||||
}
|
||||
|
||||
|
||||
_git-delete-submodule() {
|
||||
_arguments \
|
||||
':submodule-name:__git_submodule_names'
|
||||
':submodule-name:__gitex_submodule_names'
|
||||
}
|
||||
|
||||
|
||||
_git-delete-tag() {
|
||||
_arguments \
|
||||
':tag-name:__git_tag_names'
|
||||
':tag-name:__gitex_tag_names'
|
||||
}
|
||||
|
||||
|
||||
@ -172,6 +173,7 @@ _git-effort() {
|
||||
'--above[ignore file with less than x commits]'
|
||||
}
|
||||
|
||||
|
||||
_git-extras() {
|
||||
local curcontext=$curcontext state line ret=1
|
||||
declare -A opt_args
|
||||
@ -216,7 +218,7 @@ _git-feature() {
|
||||
case $line[1] in
|
||||
(finish)
|
||||
_arguments -C \
|
||||
':branch-name:__git_feature_branch_names'
|
||||
':branch-name:__gitex_feature_branch_names'
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
@ -225,8 +227,8 @@ _git-feature() {
|
||||
|
||||
_git-graft() {
|
||||
_arguments \
|
||||
':src-branch-name:__git_branch_names' \
|
||||
':dest-branch-name:__git_branch_names'
|
||||
':src-branch-name:__gitex_branch_names' \
|
||||
':dest-branch-name:__gitex_branch_names'
|
||||
}
|
||||
|
||||
|
||||
@ -236,12 +238,14 @@ _git-ignore() {
|
||||
'(--global -g)'{--global,-g}'[show global gitignore]'
|
||||
}
|
||||
|
||||
|
||||
_git-missing() {
|
||||
_arguments \
|
||||
':first-branch-name:__git_branch_names' \
|
||||
':second-branch-name:__git_branch_names'
|
||||
':first-branch-name:__gitex_branch_names' \
|
||||
':second-branch-name:__gitex_branch_names'
|
||||
}
|
||||
|
||||
|
||||
_git-refactor() {
|
||||
local curcontext=$curcontext state line ret=1
|
||||
declare -A opt_args
|
||||
@ -263,7 +267,7 @@ _git-refactor() {
|
||||
case $line[1] in
|
||||
(finish)
|
||||
_arguments -C \
|
||||
':branch-name:__git_refactor_branch_names'
|
||||
':branch-name:__gitex_refactor_branch_names'
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
@ -272,12 +276,12 @@ _git-refactor() {
|
||||
|
||||
_git-squash() {
|
||||
_arguments \
|
||||
':branch-name:__git_branch_names'
|
||||
':branch-name:__gitex_branch_names'
|
||||
}
|
||||
|
||||
_git-summary() {
|
||||
_arguments '--line[summarize with lines other than commits]'
|
||||
__git_commits
|
||||
_arguments '--line[summarize with lines rather than commits]'
|
||||
__gitex_commits
|
||||
}
|
||||
|
||||
|
||||
@ -298,7 +302,7 @@ zstyle ':completion:*:*:git:*' user-commands \
|
||||
count:'count commits' \
|
||||
create-branch:'create local and remote branch' \
|
||||
delete-branch:'delete local and remote branch' \
|
||||
delete-merged-brancees:'delete merged branches'\
|
||||
delete-merged-branches:'delete merged branches'\
|
||||
delete-submodule:'delete submodule' \
|
||||
delete-tag:'delete local and remote tag' \
|
||||
effort:'display effort statistics' \
|
||||
|
31
plugins/git-flow/README.md
Normal file
31
plugins/git-flow/README.md
Normal file
@ -0,0 +1,31 @@
|
||||
# Git-Flow plugin
|
||||
|
||||
This plugin adds completion and aliases for the `git-flow` command. More information
|
||||
at https://github.com/nvie/gitflow.
|
||||
|
||||
Enable git-flow plugin in your zshrc file:
|
||||
```
|
||||
plugins=(... git-flow)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
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>` |
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user