diff --git a/install.sh b/install.sh
index b1c95ae..3174557 100755
--- a/install.sh
+++ b/install.sh
@@ -23,7 +23,7 @@ cp -f "$HOME/.vimrc" "$HOME/.vimrc.bak" 2>/dev/null || true
# Create symlinks
ln -sf .dots/tmux/tmux.conf "$HOME"/.tmux.conf
-ln -sf .dots/zsh/zshrc "$HOME"/.zshrc
+ln -sf .dots/zsh/custom/zshrc "$HOME"/.zshrc
ln -sf .dots/vim/vimrc "$HOME"/.vimrc
printf "OK: Completed\n"
diff --git a/zsh/.editorconfig b/zsh/.editorconfig
new file mode 100644
index 0000000..aa18e0e
--- /dev/null
+++ b/zsh/.editorconfig
@@ -0,0 +1,10 @@
+root = true
+
+[*]
+end_of_line = lf
+insert_final_newline = true
+charset = utf-8
+
+[*.sh]
+indent_size = 4
+indent_style = tab
diff --git a/zsh/.github/CODEOWNERS b/zsh/.github/CODEOWNERS
new file mode 100644
index 0000000..c3990c4
--- /dev/null
+++ b/zsh/.github/CODEOWNERS
@@ -0,0 +1,4 @@
+# Plugin owners
+plugins/gitfast/ @felipec
+plugins/sdk/ @rgoldberg
+plugins/git-lfs/ @vietduc01100001
diff --git a/zsh/.github/FUNDING.yml b/zsh/.github/FUNDING.yml
new file mode 100644
index 0000000..c44bb24
--- /dev/null
+++ b/zsh/.github/FUNDING.yml
@@ -0,0 +1,2 @@
+github: [robbyrussell, mcornella, larson-carter]
+open_collective: ohmyzsh
diff --git a/zsh/.github/ISSUE_TEMPLATE/bug_report.md b/zsh/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000..611d8eb
--- /dev/null
+++ b/zsh/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,45 @@
+---
+name: Bug report
+about: Create a report to help us improve Oh My Zsh
+
+---
+
+
+
+**Describe the bug**
+A clear description of what the bug is.
+
+**To Reproduce**
+Steps to reproduce the behavior, for example:
+1. Enable this plugin '...'
+2. Run command '...' or try the autocomplete command '...'
+3. See error
+
+**Expected behavior**
+A brief description of what should happen.
+
+**Screenshots and/or Recordings**
+If applicable, add screenshots to help explain your problem.
+You can also record an asciinema session: https://asciinema.org/
+
+**Self Check**
+
+- Have you tried reaching out on the [Discord server](https://discord.gg/ohmyzsh)?
+ This can help cut down on filling up issues. We always have a few people
+ online that are in a variety of timezones that are willing to help you!
+
+- Also searching existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=) might help you get quicker support
+
+**Desktop (please complete the following information):**
+
+ - OS / Distro: [e.g. Arch Linux, macOS]
+ - If on Windows what version of WSL: [e.g. WSL1, WSL2]
+ - Latest ohmyzsh update?: [e.g. Yes/No]
+ - ZSH Version: [e.g. 5.6]
+ - Terminal emulator: [e.g. iTerm2]
+
+**Additional context**
+Add any other context about the problem here. This can be themes, plugins, custom configs.
diff --git a/zsh/.github/ISSUE_TEMPLATE/config.yml b/zsh/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 0000000..c6b4cef
--- /dev/null
+++ b/zsh/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,5 @@
+blank_issues_enabled: true
+contact_links:
+ - name: Get help on Discord
+ url: https://discord.gg/ohmyzsh
+ about: Have a quick question? Join the Discord server and ask on the appropriate channel.
diff --git a/zsh/.github/ISSUE_TEMPLATE/feature_request.md b/zsh/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 0000000..8c20544
--- /dev/null
+++ b/zsh/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,29 @@
+---
+name: Feature request
+about: Suggest a feature for Oh My Zsh
+labels: 'feature'
+
+---
+
+
+
+**Is your feature request related to a particular plugin or theme? If so, specify it.**
+The name of the plugin, theme or alias that you would like us to improve. [...]
+
+**Is your feature request related to a problem? Please describe.**
+A description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A description of what you want to happen. [...]
+
+**Describe alternatives you've considered**
+A description of any alternative solutions or features you've considered. This can also include other plugins or themes.
+
+**Additional context**
+Add any other context, screenshots or discord conversations about the feature request here. Also if you have any PRs related to this issue that are already open that you would like us to look at.
+
+**Related Issues**
+Is there any open or closed issues that is related to this feature request? If so please link them below! [...]
diff --git a/zsh/.github/ISSUE_TEMPLATE/support.md b/zsh/.github/ISSUE_TEMPLATE/support.md
new file mode 100644
index 0000000..697f0c0
--- /dev/null
+++ b/zsh/.github/ISSUE_TEMPLATE/support.md
@@ -0,0 +1,10 @@
+---
+name: Support
+about: Request support for any problem you're having with Oh My Zsh
+labels: 'support'
+
+---
+
+1. Look for similar issues already posted (including closed ones)
+2. Include as much relevant information as possible
+3. Try to make sure the issue is due to Oh My Zsh
diff --git a/zsh/.github/PULL_REQUEST_TEMPLATE.md b/zsh/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..1abae89
--- /dev/null
+++ b/zsh/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,19 @@
+## Standards checklist:
+
+
+
+- [ ] The PR title is descriptive.
+- [ ] The PR doesn't replicate another PR which is already open.
+- [ ] I have read the contribution guide and followed all the instructions.
+- [ ] The code follows the code style guide detailed in the wiki.
+- [ ] The code is mine or it's from somewhere with an MIT-compatible license.
+- [ ] The code is efficient, to the best of my ability, and does not waste computer resources.
+- [ ] The code is stable and I have tested it myself, to the best of my abilities.
+
+## Changes:
+
+- [...]
+
+## Other comments:
+
+...
diff --git a/zsh/.github/workflows/main.yml b/zsh/.github/workflows/main.yml
new file mode 100644
index 0000000..7ab7efd
--- /dev/null
+++ b/zsh/.github/workflows/main.yml
@@ -0,0 +1,36 @@
+name: CI
+on:
+ pull_request:
+ types:
+ - opened
+ - synchronize
+ branches:
+ - master
+ push:
+ branches:
+ - master
+
+jobs:
+ tests:
+ name: Run tests
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ubuntu-latest, macos-latest]
+ steps:
+ - name: Set up git repository
+ uses: actions/checkout@v2
+ - name: Install zsh
+ if: runner.os == 'Linux'
+ run: sudo apt-get update; sudo apt-get install zsh
+ - name: Test installer
+ run: sh ./tools/install.sh
+ - name: Check syntax
+ run: |
+ for file in ./oh-my-zsh.sh \
+ ./lib/*.zsh \
+ ./plugins/*/*.plugin.zsh \
+ ./plugins/*/_* \
+ ./themes/*.zsh-theme; do
+ zsh -n "$file" || return 1
+ done
diff --git a/zsh/.gitignore b/zsh/.gitignore
new file mode 100644
index 0000000..ec24a19
--- /dev/null
+++ b/zsh/.gitignore
@@ -0,0 +1,8 @@
+# custom files
+custom/
+
+# temp files directories
+cache/
+log/
+*.swp
+.DS_Store
diff --git a/zsh/.gitpod.Dockerfile b/zsh/.gitpod.Dockerfile
new file mode 100644
index 0000000..b35c80d
--- /dev/null
+++ b/zsh/.gitpod.Dockerfile
@@ -0,0 +1,5 @@
+FROM gitpod/workspace-full
+
+RUN sudo apt-get update && \
+ sudo apt-get install -y zsh && \
+ sudo rm -rf /var/lib/apt/lists/*
diff --git a/zsh/.gitpod.yml b/zsh/.gitpod.yml
new file mode 100644
index 0000000..ccc5724
--- /dev/null
+++ b/zsh/.gitpod.yml
@@ -0,0 +1,9 @@
+image:
+ file: .gitpod.Dockerfile
+
+tasks:
+ - init: |
+ export EDITOR="command gp open -w" VISUAL="command gp open -w"
+ cp -f /workspace/ohmyzsh/templates/zshrc.zsh-template ~/.zshrc
+ ln -sf /workspace/ohmyzsh ~/.oh-my-zsh
+ command: exec zsh
diff --git a/zsh/CODE_OF_CONDUCT.md b/zsh/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..20ad1cc
--- /dev/null
+++ b/zsh/CODE_OF_CONDUCT.md
@@ -0,0 +1,76 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, sex characteristics, gender identity and expression,
+level of experience, education, socio-economic status, nationality, personal
+appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies within all project spaces, and it also applies when
+an individual is representing the project or its community in public spaces.
+Examples of representing a project or community include using an official
+project e-mail address, posting via an official social media account, or acting
+as an appointed representative at an online or offline event. Representation of
+a project may be further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at ohmyzsh@planetargon.com. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see
+https://www.contributor-covenant.org/faq
diff --git a/zsh/CONTRIBUTING.md b/zsh/CONTRIBUTING.md
new file mode 100644
index 0000000..be67e93
--- /dev/null
+++ b/zsh/CONTRIBUTING.md
@@ -0,0 +1,125 @@
+# 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.
+
+First, please take a moment to review our [code of conduct](CODE_OF_CONDUCT.md).
+
+These guidelines are an attempt at better addressing the huge amount of pending
+issues and pull requests. Please read them closely.
+
+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/ohmyzsh/ohmyzsh/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/ohmyzsh/ohmyzsh/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/ohmyzsh/ohmyzsh/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/ohmyzsh/ohmyzsh/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/ohmyzsh/ohmyzsh/wiki/Volunteers)
+page for instructions on where to start and more.
diff --git a/zsh/LICENSE.txt b/zsh/LICENSE.txt
index 4d465b1..45ba85a 100644
--- a/zsh/LICENSE.txt
+++ b/zsh/LICENSE.txt
@@ -1,7 +1,6 @@
-The MIT License (MIT)
+MIT License
-Copyright (c) 2009-2019 Robby Russell and contributors
-See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors
+Copyright (c) 2009-2020 Robby Russell and contributors (https://github.com/ohmyzsh/ohmyzsh/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
diff --git a/zsh/README.md b/zsh/README.md
index 78a5b56..86037f1 100644
--- a/zsh/README.md
+++ b/zsh/README.md
@@ -1,45 +1,40 @@
-
-
-
+
Oh My Zsh is an open source, community-driven framework for managing your [zsh](https://www.zsh.org/) configuration.
Sounds boring. Let's try again.
-__Oh My Zsh will not make you a 10x developer...but you may feel like one.__
+**Oh My Zsh will not make you a 10x developer...but you may feel like one.**
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](https://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.
+To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter, and join us on [Discord](https://discord.gg/ohmyzsh).
+
+[](https://github.com/ohmyzsh/ohmyzsh/actions?query=workflow%3ACI)
+[](https://twitter.com/intent/follow?screen_name=ohmyzsh)
+[](https://discord.gg/ohmyzsh)
+[](https://gitpod.io/#https://github.com/ohmyzsh/ohmyzsh)
## Getting Started
### Prerequisites
-__Disclaimer:__ _Oh My Zsh works best on macOS and Linux._
-
-* Unix-like operating system (macOS or Linux)
-* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH)
-* `curl` or `wget` should be installed
-* `git` should be installed
+- A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL2 is preferred, but cygwin or msys also mostly work.
+- [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent is fine but we prefer 5.0.8 and newer). If not pre-installed (run `zsh --version` to confirm), check the following wiki instructions here: [Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH)
+- `curl` or `wget` should be installed
+- `git` should be installed (recommended v2.4.11 or higher)
### Basic Installation
-Oh My Zsh is installed by running one of the following commands in your terminal. You can install this via the command-line with either `curl` or `wget`.
+Oh My Zsh is installed by running one of the following commands in your terminal. You can install this via the command-line with either `curl`, `wget` or another similar tool.
-#### via curl
-
-```shell
-sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
-```
-
-#### via wget
-
-```shell
-sh -c "$(wget -O- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
-```
+| Method | Command |
+|:----------|:--------------------------------------------------------------------------------------------------|
+| **curl** | `sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
+| **wget** | `sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
+| **fetch** | `sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
#### Manual inspection
@@ -48,7 +43,7 @@ that by downloading the install script first, looking through it so everything l
then running it:
```shell
-curl -Lo install.sh https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
+wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
sh install.sh
```
@@ -56,7 +51,7 @@ sh install.sh
### Plugins
-Oh My Zsh comes with a shitload of plugins to take advantage of. You can take a look in the [plugins](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins) directory and/or the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins) to see what's currently available.
+Oh My Zsh comes with a shitload of plugins for you to take advantage of. You can take a look in the [plugins](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins) directory and/or the [wiki](https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins) to see what's currently available.
#### Enabling Plugins
@@ -80,15 +75,15 @@ plugins=(
)
```
-_Note that the plugins are separated by whitespace. **Do not** use commas between them._
+_Note that the plugins are separated by whitespace (spaces, tabs, new lines...). **Do not** use commas between them or it will break._
#### Using Plugins
-Most plugins (should! we're working on this) include a __README__, which documents how to use them.
+Each plugin includes a __README__, documenting it. This README should show the aliases (if the plugin adds any) and extra goodies that are included in that particular plugin.
### Themes
-We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes) on the wiki. Check them out!
+We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred and fifty themes now bundled. Most of them have [screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki (We are working on updating this!). Check them out!
#### Selecting a Theme
@@ -104,7 +99,7 @@ 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)
-# see https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#agnoster
+# see https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster
```
_Note: many themes require installing the [Powerline Fonts](https://github.com/powerline/fonts) in order to render properly._
@@ -113,11 +108,10 @@ Open up a new terminal window and your prompt should look something like this:

-In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes).
+In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes).
If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window.
-
```shell
ZSH_THEME="random" # (...please let it be pie... please be some pie..)
```
@@ -131,6 +125,16 @@ ZSH_THEME_RANDOM_CANDIDATES=(
)
```
+If you only know which themes you don't like, you can add them similarly to an ignored list:
+
+```shell
+ZSH_THEME_RANDOM_IGNORED=(pygmalion tjkirch_mod)
+```
+
+### FAQ
+
+If you have some more questions or issues, you might find a solution in our [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ).
+
## Advanced Topics
If you're the type that likes to get their hands dirty, these sections might resonate.
@@ -142,7 +146,7 @@ the installer accepts (these settings are also documented at the top of the inst
#### Custom Directory
-The default location is `~/.oh-my-zsh` (hidden in your home directory)
+The default location is `~/.oh-my-zsh` (hidden in your home directory, you can access it with `cd ~/.oh-my-zsh`)
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
@@ -159,14 +163,14 @@ flag `--unattended` to the `install.sh` script. This will have the effect of not
the default shell, and also won't run `zsh` when the installation has finished.
```shell
-sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" "" --unattended
+sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
```
#### Installing from a forked repository
The install script also accepts these variables to allow installation of a different repository:
-- `REPO` (default: `robbyrussell/oh-my-zsh`): this takes the form of `owner/repository`. If you set
+- `REPO` (default: `ohmyzsh/ohmyzsh`): this takes the form of `owner/repository`. If you set
this variable, the installer will look for a repository at `https://github.com/{owner}/{repository}`.
- `REMOTE` (default: `https://github.com/${REPO}.git`): this is the full URL of the git repository
@@ -187,13 +191,13 @@ REPO=apjanke/oh-my-zsh BRANCH=edge sh install.sh
#### Manual Installation
-##### 1. Clone the repository:
+##### 1. Clone the repository
```shell
-git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
+git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
```
-##### 2. *Optionally*, backup your existing `~/.zshrc` file:
+##### 2. *Optionally*, backup your existing `~/.zshrc` file
```shell
cp ~/.zshrc ~/.zshrc.orig
@@ -223,9 +227,9 @@ Once you open up a new terminal window, it should load zsh with Oh My Zsh's conf
If you have any hiccups installing, here are a few common fixes.
-* You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after
+- You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after
switching to `oh-my-zsh`.
-* If you installed manually or changed the install location, check the `ZSH` environment variable in
+- If you installed manually or changed the install location, check the `ZSH` environment variable in
`~/.zshrc`.
### Custom Plugins and Themes
@@ -255,7 +259,7 @@ DISABLE_AUTO_UPDATE=true
If you'd like to upgrade at any point in time (maybe someone just released a new plugin and you don't want to wait a week?) you just need to run:
```shell
-upgrade_oh_my_zsh
+omz update
```
Magic! 🎉
@@ -272,13 +276,13 @@ Before you participate in our delightful community, please read the [code of con
I'm far from being a [Zsh](https://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
-We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/robbyrussell/oh-my-zsh/issues) and help where you can.
+We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/ohmyzsh/ohmyzsh/issues) and help where you can.
See [Contributing](CONTRIBUTING.md) for more details.
### Do NOT send us themes
-We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes) wiki page.
+We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes) wiki page.
## Contributors
@@ -288,10 +292,12 @@ Thank you so much!
## Follow Us
-We're on the social media.
+We're on 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.
+- [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. You should follow it.
+- [FaceBook](https://www.facebook.com/Oh-My-Zsh-296616263819290/) poke us.
+- [Instagram](https://www.instagram.com/_ohmyzsh/) tag us in your post showing Oh My Zsh!
+- [Discord](https://discord.gg/ohmyzsh) to chat with us!
## Merchandise
diff --git a/zsh/lib/cli.zsh b/zsh/lib/cli.zsh
new file mode 100644
index 0000000..ff86509
--- /dev/null
+++ b/zsh/lib/cli.zsh
@@ -0,0 +1,354 @@
+#!/usr/bin/env zsh
+
+function omz {
+ [[ $# -gt 0 ]] || {
+ _omz::help
+ return 1
+ }
+
+ local command="$1"
+ shift
+
+ # Subcommand functions start with _ so that they don't
+ # appear as completion entries when looking for `omz`
+ (( $+functions[_omz::$command] )) || {
+ _omz::help
+ return 1
+ }
+
+ _omz::$command "$@"
+}
+
+function _omz {
+ local -a cmds subcmds
+ cmds=(
+ 'help:Usage information'
+ 'plugin:Commands for Oh My Zsh plugins management'
+ 'pr:Commands for Oh My Zsh Pull Requests management'
+ 'theme:Commands for Oh My Zsh themes management'
+ 'update:Update Oh My Zsh'
+ )
+
+ if (( CURRENT == 2 )); then
+ _describe 'command' cmds
+ elif (( CURRENT == 3 )); then
+ case "$words[2]" in
+ plugin) subcmds=('list:List plugins')
+ _describe 'command' subcmds ;;
+ pr) subcmds=('test:Test a Pull Request' 'clean:Delete all Pull Request branches')
+ _describe 'command' subcmds ;;
+ theme) subcmds=('use:Load a theme' 'list:List themes')
+ _describe 'command' subcmds ;;
+ esac
+ elif (( CURRENT == 4 )); then
+ case "$words[2]::$words[3]" in
+ theme::use) compadd "$ZSH"/themes/*.zsh-theme(.N:t:r) \
+ "$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::) ;;
+ esac
+ fi
+
+ return 0
+}
+
+compdef _omz omz
+
+
+function _omz::help {
+ cat < [options]
+
+Available commands:
+
+ help Print this help message
+ plugin Manage plugins
+ pr Manage Oh My Zsh Pull Requests
+ theme Manage themes
+ update Update Oh My Zsh
+
+EOF
+}
+
+function _omz::confirm {
+ # If question supplied, ask it before reading the answer
+ # NOTE: uses the logname of the caller function
+ if [[ -n "$1" ]]; then
+ _omz::log prompt "$1" "${${functrace[1]#_}%:*}"
+ fi
+
+ # Read one character
+ read -r -k 1
+
+ # If no newline entered, add a newline
+ if [[ "$REPLY" != $'\n' ]]; then
+ echo
+ fi
+}
+
+function _omz::log {
+ # if promptsubst is set, a message with `` or $()
+ # will be run even if quoted due to `print -P`
+ setopt localoptions nopromptsubst
+
+ # $1 = info|warn|error|debug
+ # $2 = text
+ # $3 = (optional) name of the logger
+
+ local logtype=$1
+ local logname=${3:-${${functrace[1]#_}%:*}}
+
+ # Don't print anything if debug is not active
+ if [[ $logtype = debug && -z $_OMZ_DEBUG ]]; then
+ return
+ fi
+
+ # Choose coloring based on log type
+ case "$logtype" in
+ prompt) print -Pn "%S%F{blue}$logname%f%s: $2" ;;
+ debug) print -P "%F{white}$logname%f: $2" ;;
+ info) print -P "%F{green}$logname%f: $2" ;;
+ warn) print -P "%S%F{yellow}$logname%f%s: $2" ;;
+ error) print -P "%S%F{red}$logname%f%s: $2" ;;
+ esac >&2
+}
+
+function _omz::plugin {
+ (( $# > 0 && $+functions[_omz::plugin::$1] )) || {
+ cat < [options]
+
+Available commands:
+
+ list List all available Oh My Zsh plugins
+
+EOF
+ return 1
+ }
+
+ local command="$1"
+ shift
+
+ _omz::plugin::$command "$@"
+}
+
+function _omz::plugin::list {
+ local -a custom_plugins builtin_plugins
+ custom_plugins=("$ZSH_CUSTOM"/plugins/*(/N:t))
+ builtin_plugins=("$ZSH"/plugins/*(/N:t))
+
+ {
+ (( ${#custom_plugins} )) && {
+ print -Pn "%U%BCustom plugins%b%u: "
+ print -l ${(q-)custom_plugins}
+ }
+
+ (( ${#builtin_plugins} )) && {
+ # add a line of separation
+ (( ${#custom_plugins} )) && echo
+
+ print -Pn "%U%BBuilt-in plugins%b%u: "
+ print -l ${(q-)builtin_plugins}
+ }
+ } | fmt -w $COLUMNS | sed -E $'s/\e?(\\[[0-9]*m)/\e\\1/g' # deal with fmt removing ESC
+}
+
+function _omz::pr {
+ (( $# > 0 && $+functions[_omz::pr::$1] )) || {
+ cat < [options]
+
+Available commands:
+
+ clean Delete all PR branches (ohmyzsh/pull-*)
+ test Fetch PR #NUMBER and rebase against master
+
+EOF
+ return 1
+ }
+
+ local command="$1"
+ shift
+
+ _omz::pr::$command "$@"
+}
+
+function _omz::pr::clean {
+ (
+ set -e
+ builtin cd -q "$ZSH"
+
+ # Check if there are PR branches
+ local fmt branches
+ fmt="%(color:bold blue)%(align:18,right)%(refname:short)%(end)%(color:reset) %(color:dim bold red)%(objectname:short)%(color:reset) %(color:yellow)%(contents:subject)"
+ branches="$(command git for-each-ref --sort=-committerdate --color --format="$fmt" "refs/heads/ohmyzsh/pull-*")"
+
+ # Exit if there are no PR branches
+ if [[ -z "$branches" ]]; then
+ _omz::log info "there are no Pull Request branches to remove."
+ return
+ fi
+
+ # Print found PR branches
+ echo "$branches\n"
+ # Confirm before removing the branches
+ _omz::confirm "do you want remove these Pull Request branches? [Y/n] "
+ # Only proceed if the answer is a valid yes option
+ [[ "$REPLY" != [yY$'\n'] ]] && return
+
+ _omz::log info "removing all Oh My Zsh Pull Request branches..."
+ command git branch --list 'ohmyzsh/pull-*' | while read branch; do
+ command git branch -D "$branch"
+ done
+ )
+}
+
+function _omz::pr::test {
+ # Allow $1 to be a URL to the pull request
+ if [[ "$1" = https://* ]]; then
+ 1="${1:t}"
+ fi
+
+ # Check the input
+ if ! [[ -n "$1" && "$1" =~ ^[[:digit:]]+$ ]]; then
+ echo >&2 "Usage: omz pr test "
+ return 1
+ fi
+
+ # Save current git HEAD
+ local branch
+ branch=$(builtin cd -q "$ZSH"; git symbolic-ref --short HEAD) || {
+ _omz::log error "error when getting the current git branch. Aborting..."
+ return 1
+ }
+
+
+ # Fetch PR onto ohmyzsh/pull- branch and rebase against master
+ # If any of these operations fail, undo the changes made
+ (
+ set -e
+ builtin cd -q "$ZSH"
+
+ # Get the ohmyzsh git remote
+ command git remote -v | while read remote url _; do
+ case "$url" in
+ https://github.com/ohmyzsh/ohmyzsh(|.git)) found=1; break ;;
+ git@github.com:ohmyzsh/ohmyzsh(|.git)) found=1; break ;;
+ esac
+ done
+
+ (( $found )) || {
+ _omz::log error "could not found the ohmyzsh git remote. Aborting..."
+ return 1
+ }
+
+ # Fetch pull request head
+ _omz::log info "fetching PR #$1 to ohmyzsh/pull-$1..."
+ command git fetch -f "$remote" refs/pull/$1/head:ohmyzsh/pull-$1 || {
+ _omz::log error "error when trying to fetch PR #$1."
+ return 1
+ }
+
+ # Rebase pull request branch against the current master
+ _omz::log info "rebasing PR #$1..."
+ command git rebase master ohmyzsh/pull-$1 || {
+ command git rebase --abort &>/dev/null
+ _omz::log warn "could not rebase PR #$1 on top of master."
+ _omz::log warn "you might not see the latest stable changes."
+ _omz::log info "run \`zsh\` to test the changes."
+ return 1
+ }
+
+ _omz::log info "fetch of PR #${1} successful."
+ )
+
+ # If there was an error, abort running zsh to test the PR
+ [[ $? -eq 0 ]] || return 1
+
+ # Run zsh to test the changes
+ _omz::log info "running \`zsh\` to test the changes. Run \`exit\` to go back."
+ command zsh -l
+
+ # After testing, go back to the previous HEAD if the user wants
+ _omz::confirm "do you want to go back to the previous branch? [Y/n] "
+ # Only proceed if the answer is a valid yes option
+ [[ "$REPLY" != [yY$'\n'] ]] && return
+
+ (
+ set -e
+ builtin cd -q "$ZSH"
+
+ command git checkout "$branch" -- || {
+ _omz::log error "could not go back to the previous branch ('$branch')."
+ return 1
+ }
+ )
+}
+
+function _omz::theme {
+ (( $# > 0 && $+functions[_omz::theme::$1] )) || {
+ cat < [options]
+
+Available commands:
+
+ list List all available Oh My Zsh themes
+ use Load an Oh My Zsh theme
+
+EOF
+ return 1
+ }
+
+ local command="$1"
+ shift
+
+ _omz::theme::$command "$@"
+}
+
+function _omz::theme::list {
+ local -a custom_themes builtin_themes
+ custom_themes=("$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::))
+ builtin_themes=("$ZSH"/themes/*.zsh-theme(.N:t:r))
+
+ {
+ (( ${#custom_themes} )) && {
+ print -Pn "%U%BCustom themes%b%u: "
+ print -l ${(q-)custom_themes}
+ }
+
+ (( ${#builtin_themes} )) && {
+ # add a line of separation
+ (( ${#custom_themes} )) && echo
+
+ print -Pn "%U%BBuilt-in themes%b%u: "
+ print -l ${(q-)builtin_themes}
+ }
+ } | fmt -w $COLUMNS | sed -E $'s/\e?(\\[[0-9]*m)/\e\\1/g' # deal with fmt removing ESC
+}
+
+function _omz::theme::use {
+ if [[ -z "$1" ]]; then
+ echo >&2 "Usage: omz theme use "
+ return 1
+ fi
+
+ # Respect compatibility with old lookup order
+ if [[ -f "$ZSH_CUSTOM/$1.zsh-theme" ]]; then
+ source "$ZSH_CUSTOM/$1.zsh-theme"
+ elif [[ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ]]; then
+ source "$ZSH_CUSTOM/themes/$1.zsh-theme"
+ elif [[ -f "$ZSH/themes/$1.zsh-theme" ]]; then
+ source "$ZSH/themes/$1.zsh-theme"
+ else
+ _omz::log error "theme '$1' not found"
+ return 1
+ fi
+}
+
+function _omz::update {
+ # Run update script
+ env ZSH="$ZSH" sh "$ZSH/tools/upgrade.sh"
+ # Update last updated file
+ zmodload zsh/datetime
+ echo "LAST_EPOCH=$(( EPOCHSECONDS / 60 / 60 / 24 ))" >! "${ZSH_CACHE_DIR}/.zsh-update"
+ # Remove update lock if it exists
+ command rm -rf "$ZSH/log/update.lock"
+}
diff --git a/zsh/lib/clipboard.zsh b/zsh/lib/clipboard.zsh
index 2c93d1b..122145f 100644
--- a/zsh/lib/clipboard.zsh
+++ b/zsh/lib/clipboard.zsh
@@ -3,10 +3,23 @@
# 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.
-
+# This is uses essentially the same heuristic as neovim, with the additional
+# special support for Cygwin.
+# See: https://github.com/neovim/neovim/blob/e682d799fa3cf2e80a02d00c6ea874599d58f0e7/runtime/autoload/provider/clipboard.vim#L55-L121
+#
+# - pbcopy, pbpaste (macOS)
+# - cygwin (Windows running Cygwin)
+# - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)
+# - xclip (if $DISPLAY is set)
+# - xsel (if $DISPLAY is set)
+# - lemonade (for SSH) https://github.com/pocke/lemonade
+# - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
+# - win32yank (Windows)
+# - tmux (if $TMUX is set)
+#
+# Defines two functions, clipcopy and clippaste, based on the detected platform.
+##
+#
# clipcopy - Copy data to clipboard
#
# Usage:
@@ -15,41 +28,8 @@
#
# clipcopy - 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:
@@ -67,20 +47,61 @@ function clipcopy() {
#
# # Paste to a file
# clippaste > file.txt
-function clippaste() {
+#
+function detect-clipboard() {
emulate -L zsh
- if [[ $OSTYPE == darwin* ]]; then
- pbpaste
- elif [[ $OSTYPE == cygwin* ]]; then
- cat /dev/clipboard
+
+ if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then
+ function clipcopy() { pbcopy < "${1:-/dev/stdin}"; }
+ function clippaste() { pbpaste; }
+ elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then
+ function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; }
+ function clippaste() { cat /dev/clipboard; }
+ elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
+ function clipcopy() { wl-copy < "${1:-/dev/stdin}"; }
+ function clippaste() { wl-paste; }
+ elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then
+ function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}"; }
+ function clippaste() { xclip -out -selection clipboard; }
+ elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then
+ function clipcopy() { xsel --clipboard --input < "${1:-/dev/stdin}"; }
+ function clippaste() { xsel --clipboard --output; }
+ elif (( ${+commands[lemonade]} )); then
+ function clipcopy() { lemonade copy < "${1:-/dev/stdin}"; }
+ function clippaste() { lemonade paste; }
+ elif (( ${+commands[doitclient]} )); then
+ function clipcopy() { doitclient wclip < "${1:-/dev/stdin}"; }
+ function clippaste() { doitclient wclip -r; }
+ elif (( ${+commands[win32yank]} )); then
+ function clipcopy() { win32yank -i < "${1:-/dev/stdin}"; }
+ function clippaste() { win32yank -o; }
+ elif [[ $OSTYPE == linux-android* ]] && (( $+commands[termux-clipboard-set] )); then
+ function clipcopy() { termux-clipboard-set "${1:-/dev/stdin}"; }
+ function clippaste() { termux-clipboard-get; }
+ elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then
+ function clipcopy() { tmux load-buffer "${1:--}"; }
+ function clippaste() { tmux save-buffer -; }
+ elif [[ $(uname -r) = *icrosoft* ]]; then
+ function clipcopy() { clip.exe < "${1:-/dev/stdin}"; }
+ function clippaste() { powershell.exe -noprofile -command Get-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
+ function _retry_clipboard_detection_or_fail() {
+ local clipcmd="${1}"; shift
+ if detect-clipboard; then
+ "${clipcmd}" "$@"
+ else
+ print "${clipcmd}: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
+ return 1
+ fi
+ }
+ function clipcopy() { _retry_clipboard_detection_or_fail clipcopy "$@"; }
+ function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; }
+ return 1
fi
}
+
+# Detect at startup. A non-zero exit here indicates that the dummy clipboards were set,
+# which is not really an error. If the user calls them, they will attempt to redetect
+# (for example, perhaps the user has now installed xclip) and then either print an error
+# or proceed successfully.
+detect-clipboard || true
diff --git a/zsh/lib/completion.zsh b/zsh/lib/completion.zsh
index c7db2eb..a3873cd 100644
--- a/zsh/lib/completion.zsh
+++ b/zsh/lib/completion.zsh
@@ -1,7 +1,7 @@
# fixme - the load process here seems a bit bizarre
zmodload -i zsh/complist
-WORDCHARS=''
+WORDCHARS='_-'
unsetopt menu_complete # do not autoselect the first completion entry
unsetopt flowcontrol
@@ -41,8 +41,8 @@ fi
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
# Use caching so that commands like apt and dpkg complete are useable
-zstyle ':completion::complete:*' use-cache 1
-zstyle ':completion::complete:*' cache-path $ZSH_CACHE_DIR
+zstyle ':completion:*' use-cache yes
+zstyle ':completion:*' cache-path $ZSH_CACHE_DIR
# Don't complete uninteresting users
zstyle ':completion:*:*:*:users' ignored-patterns \
@@ -60,14 +60,16 @@ zstyle '*' single-ignored show
if [[ $COMPLETION_WAITING_DOTS = true ]]; then
expand-or-complete-with-dots() {
- # toggle line-wrapping off and back on again
- [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
- print -Pn "%{%F{red}......%f%}"
- [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam
-
+ print -Pn "%F{red}…%f"
zle expand-or-complete
zle redisplay
}
zle -N expand-or-complete-with-dots
- bindkey "^I" expand-or-complete-with-dots
+ # Set the function as the default tab completion widget
+ bindkey -M emacs "^I" expand-or-complete-with-dots
+ bindkey -M viins "^I" expand-or-complete-with-dots
+ bindkey -M vicmd "^I" expand-or-complete-with-dots
fi
+
+# automatically load bash completion functions
+autoload -U +X bashcompinit && bashcompinit
diff --git a/zsh/lib/diagnostics.zsh b/zsh/lib/diagnostics.zsh
index 9c9905e..001de42 100644
--- a/zsh/lib/diagnostics.zsh
+++ b/zsh/lib/diagnostics.zsh
@@ -192,19 +192,19 @@ function _omz_diag_dump_one_big_text() {
command ls -ld ~/.oh*
builtin echo
builtin echo oh-my-zsh git state:
- (cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]")
+ (builtin cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]")
if [[ $verbose -ge 1 ]]; then
- (cd $ZSH && git reflog --date=default | command grep pull)
+ (builtin cd $ZSH && git reflog --date=default | command grep pull)
fi
builtin echo
if [[ -e $ZSH_CUSTOM ]]; then
local custom_dir=$ZSH_CUSTOM
if [[ -h $custom_dir ]]; then
- custom_dir=$(cd $custom_dir && pwd -P)
+ custom_dir=$(builtin cd $custom_dir && pwd -P)
fi
builtin echo "oh-my-zsh custom dir:"
builtin echo " $ZSH_CUSTOM ($custom_dir)"
- (cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print)
+ (builtin cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print)
builtin echo
fi
diff --git a/zsh/lib/functions.zsh b/zsh/lib/functions.zsh
index 9f8736b..58f0e3f 100644
--- a/zsh/lib/functions.zsh
+++ b/zsh/lib/functions.zsh
@@ -1,13 +1,25 @@
function zsh_stats() {
- fc -l 1 | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20
+ fc -l 1 \
+ | awk '{ CMD[$2]++; count++; } END { for (a in CMD) print CMD[a] " " CMD[a]*100/count "% " a }' \
+ | grep -v "./" | sort -nr | head -n20 | column -c3 -s " " -t | nl
}
function uninstall_oh_my_zsh() {
- env ZSH=$ZSH sh $ZSH/tools/uninstall.sh
+ env ZSH="$ZSH" sh "$ZSH/tools/uninstall.sh"
}
function upgrade_oh_my_zsh() {
- env ZSH=$ZSH sh $ZSH/tools/upgrade.sh
+ if (( $+functions[_omz::update] )); then
+ echo >&2 "${fg[yellow]}Note: \`$0\` is deprecated. Use \`omz update\` instead.$reset_color"
+ fi
+
+ # Run update script
+ env ZSH="$ZSH" sh "$ZSH/tools/upgrade.sh"
+ # Update last updated file
+ zmodload zsh/datetime
+ echo "LAST_EPOCH=$(( EPOCHSECONDS / 60 / 60 / 24 ))" >! "${ZSH_CACHE_DIR}/.zsh-update"
+ # Remove update lock if it exists
+ command rm -rf "$ZSH/log/update.lock"
}
function take() {
@@ -21,7 +33,7 @@ function open_command() {
case "$OSTYPE" in
darwin*) open_cmd='open' ;;
cygwin*) open_cmd='cygstart' ;;
- linux*) ! [[ $(uname -a) =~ "Microsoft" ]] && open_cmd='xdg-open' || {
+ linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || {
open_cmd='cmd.exe /c start ""'
[[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
} ;;
@@ -31,12 +43,7 @@ function open_command() {
;;
esac
- # don't use nohup on OSX
- if [[ "$OSTYPE" == darwin* ]]; then
- ${=open_cmd} "$@" &>/dev/null
- else
- nohup ${=open_cmd} "$@" &>/dev/null
- fi
+ ${=open_cmd} "$@" &>/dev/null
}
#
@@ -93,7 +100,7 @@ function default() {
# 0 if the env variable exists, 3 if it was set
#
function env_default() {
- (( ${${(@f):-$(typeset +xg)}[(I)$1]} )) && return 0
+ [[ ${parameters[$1]} = *-export* ]] && return 0
export "$1=$2" && return 3
}
diff --git a/zsh/lib/git.zsh b/zsh/lib/git.zsh
index 640561e..53d3960 100644
--- a/zsh/lib/git.zsh
+++ b/zsh/lib/git.zsh
@@ -1,9 +1,20 @@
+# The git prompt's git commands are read-only and should not interfere with
+# other processes. This environment variable is equivalent to running with `git
+# --no-optional-locks`, but falls back gracefully for older versions of git.
+# See git(1) for and git-status(1) for a description of that flag.
+#
+# We wrap in a local function instead of exporting the variable directly in
+# order to avoid interfering with manually-run git commands by the user.
+function __git_prompt_git() {
+ GIT_OPTIONAL_LOCKS=0 command git "$@"
+}
+
# 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
+ if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then
+ ref=$(__git_prompt_git symbolic-ref HEAD 2> /dev/null) || \
+ ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) || return 0
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi
}
@@ -12,12 +23,22 @@ function git_prompt_info() {
function parse_git_dirty() {
local STATUS
local -a FLAGS
- FLAGS=('--porcelain' '--ignore-submodules=dirty')
- if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
- if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
+ FLAGS=('--porcelain')
+ if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
+ if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then
FLAGS+='--untracked-files=no'
fi
- STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
+ case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in
+ git)
+ # let git decide (this respects per-repo config in .gitmodules)
+ ;;
+ *)
+ # if unset: ignore dirty submodules
+ # other values are passed to --ignore-submodules
+ FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
+ ;;
+ esac
+ STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n1)
fi
if [[ -n $STATUS ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
@@ -29,10 +50,10 @@ function parse_git_dirty() {
# 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\/}
+ remote=${$(__git_prompt_git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
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)
+ ahead=$(__git_prompt_git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
+ behind=$(__git_prompt_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"
@@ -61,11 +82,11 @@ function git_remote_status() {
# 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)
+ ref=$(__git_prompt_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
+ ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) || return
fi
echo ${ref#refs/heads/}
}
@@ -73,8 +94,8 @@ function git_current_branch() {
# Gets the number of commits ahead from remote
function git_commits_ahead() {
- if command git rev-parse --git-dir &>/dev/null; then
- local commits="$(git rev-list --count @{upstream}..HEAD 2>/dev/null)"
+ if __git_prompt_git rev-parse --git-dir &>/dev/null; then
+ local commits="$(__git_prompt_git rev-list --count @{upstream}..HEAD 2>/dev/null)"
if [[ -n "$commits" && "$commits" != 0 ]]; then
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
fi
@@ -83,8 +104,8 @@ function git_commits_ahead() {
# Gets the number of commits behind remote
function git_commits_behind() {
- if command git rev-parse --git-dir &>/dev/null; then
- local commits="$(git rev-list --count HEAD..@{upstream} 2>/dev/null)"
+ if __git_prompt_git rev-parse --git-dir &>/dev/null; then
+ local commits="$(__git_prompt_git rev-list --count HEAD..@{upstream} 2>/dev/null)"
if [[ -n "$commits" && "$commits" != 0 ]]; then
echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX"
fi
@@ -93,21 +114,21 @@ function git_commits_behind() {
# Outputs if current branch is ahead of remote
function git_prompt_ahead() {
- if [[ -n "$(command git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then
+ if [[ -n "$(__git_prompt_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/$(git_current_branch) 2> /dev/null)" ]]; then
+ if [[ -n "$(__git_prompt_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/$(git_current_branch) 2> /dev/null)" ]]; then
+ if [[ -n "$(__git_prompt_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"
@@ -117,75 +138,130 @@ 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"
+ SHA=$(__git_prompt_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"
+ SHA=$(__git_prompt_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
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
- STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
+ [[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]] && return
+
+ # Maps a git status prefix to an internal constant
+ # This cannot use the prompt constants, as they may be empty
+ local -A prefix_constant_map
+ prefix_constant_map=(
+ '\?\? ' 'UNTRACKED'
+ 'A ' 'ADDED'
+ 'M ' 'ADDED'
+ 'MM ' 'ADDED'
+ ' M ' 'MODIFIED'
+ 'AM ' 'MODIFIED'
+ ' T ' 'MODIFIED'
+ 'R ' 'RENAMED'
+ ' D ' 'DELETED'
+ 'D ' 'DELETED'
+ 'UU ' 'UNMERGED'
+ 'ahead' 'AHEAD'
+ 'behind' 'BEHIND'
+ 'diverged' 'DIVERGED'
+ 'stashed' 'STASHED'
+ )
+
+ # Maps the internal constant to the prompt theme
+ local -A constant_prompt_map
+ constant_prompt_map=(
+ 'UNTRACKED' "$ZSH_THEME_GIT_PROMPT_UNTRACKED"
+ 'ADDED' "$ZSH_THEME_GIT_PROMPT_ADDED"
+ 'MODIFIED' "$ZSH_THEME_GIT_PROMPT_MODIFIED"
+ 'RENAMED' "$ZSH_THEME_GIT_PROMPT_RENAMED"
+ 'DELETED' "$ZSH_THEME_GIT_PROMPT_DELETED"
+ 'UNMERGED' "$ZSH_THEME_GIT_PROMPT_UNMERGED"
+ 'AHEAD' "$ZSH_THEME_GIT_PROMPT_AHEAD"
+ 'BEHIND' "$ZSH_THEME_GIT_PROMPT_BEHIND"
+ 'DIVERGED' "$ZSH_THEME_GIT_PROMPT_DIVERGED"
+ 'STASHED' "$ZSH_THEME_GIT_PROMPT_STASHED"
+ )
+
+ # The order that the prompt displays should be added to the prompt
+ local status_constants
+ status_constants=(
+ UNTRACKED ADDED MODIFIED RENAMED DELETED
+ STASHED UNMERGED AHEAD BEHIND DIVERGED
+ )
+
+ local status_text="$(__git_prompt_git status --porcelain -b 2> /dev/null)"
+
+ # Don't continue on a catastrophic failure
+ if [[ $? -eq 128 ]]; then
+ return 1
fi
- if $(echo "$INDEX" | grep '^A ' &> /dev/null); then
- STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
- elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then
- STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
- elif $(echo "$INDEX" | grep '^MM ' &> /dev/null); then
- STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
+
+ # A lookup table of each git status encountered
+ local -A statuses_seen
+
+ if __git_prompt_git rev-parse --verify refs/stash &>/dev/null; then
+ statuses_seen[STASHED]=1
fi
- if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then
- STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
- elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then
- STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
- elif $(echo "$INDEX" | grep '^MM ' &> /dev/null); then
- STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
- elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then
- STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
+
+ local status_lines
+ status_lines=("${(@f)${status_text}}")
+
+ # If the tracking line exists, get and parse it
+ if [[ "$status_lines[1]" =~ "^## [^ ]+ \[(.*)\]" ]]; then
+ local branch_statuses
+ branch_statuses=("${(@s/,/)match}")
+ for branch_status in $branch_statuses; do
+ if [[ ! $branch_status =~ "(behind|diverged|ahead) ([0-9]+)?" ]]; then
+ continue
+ fi
+ local last_parsed_status=$prefix_constant_map[$match[1]]
+ statuses_seen[$last_parsed_status]=$match[2]
+ done
fi
- if $(echo "$INDEX" | grep '^R ' &> /dev/null); then
- STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS"
- fi
- if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
- STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
- elif $(echo "$INDEX" | grep '^D ' &> /dev/null); then
- STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
- elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
- STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
- fi
- if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then
- STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS"
- fi
- if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
- STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
- fi
- if $(echo "$INDEX" | grep '^## [^ ]\+ .*ahead' &> /dev/null); then
- STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS"
- fi
- if $(echo "$INDEX" | grep '^## [^ ]\+ .*behind' &> /dev/null); then
- STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS"
- fi
- if $(echo "$INDEX" | grep '^## [^ ]\+ .*diverged' &> /dev/null); then
- STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS"
- fi
- echo $STATUS
+
+ # For each status prefix, do a regex comparison
+ for status_prefix in ${(k)prefix_constant_map}; do
+ local status_constant="${prefix_constant_map[$status_prefix]}"
+ local status_regex=$'(^|\n)'"$status_prefix"
+
+ if [[ "$status_text" =~ $status_regex ]]; then
+ statuses_seen[$status_constant]=1
+ fi
+ done
+
+ # Display the seen statuses in the order specified
+ local status_prompt
+ for status_constant in $status_constants; do
+ if (( ${+statuses_seen[$status_constant]} )); then
+ local next_display=$constant_prompt_map[$status_constant]
+ status_prompt="$next_display$status_prompt"
+ fi
+ done
+
+ echo $status_prompt
}
# 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
+ __git_prompt_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
+ __git_prompt_git config user.email 2>/dev/null
+}
+
+# Output the name of the root directory of the git repository
+# Usage example: $(git_repo_name)
+function git_repo_name() {
+ local repo_path
+ if repo_path="$(__git_prompt_git rev-parse --show-toplevel 2>/dev/null)" && [[ -n "$repo_path" ]]; then
+ echo ${repo_path:t}
+ fi
}
diff --git a/zsh/lib/grep.zsh b/zsh/lib/grep.zsh
index abc1650..a725e0f 100644
--- a/zsh/lib/grep.zsh
+++ b/zsh/lib/grep.zsh
@@ -1,28 +1,41 @@
-# is x grep argument available?
-grep-flag-available() {
- echo | grep $1 "" >/dev/null 2>&1
-}
+__GREP_CACHE_FILE="$ZSH_CACHE_DIR"/grep-alias
-GREP_OPTIONS=""
+# See if there's a cache file modified in the last day
+__GREP_ALIAS_CACHES=("$__GREP_CACHE_FILE"(Nm-1))
+if [[ -n "$__GREP_ALIAS_CACHES" ]]; then
+ source "$__GREP_CACHE_FILE"
+else
+ grep-flags-available() {
+ command grep "$@" "" &>/dev/null <<< ""
+ }
-# color grep results
-if grep-flag-available --color=auto; then
- GREP_OPTIONS+=" --color=auto"
+ # Ignore these folders (if the necessary grep flags are available)
+ EXC_FOLDERS="{.bzr,CVS,.git,.hg,.svn,.idea,.tox}"
+
+ # Check for --exclude-dir, otherwise check for --exclude. If --exclude
+ # isn't available, --color won't be either (they were released at the same
+ # time (v2.5): https://git.savannah.gnu.org/cgit/grep.git/tree/NEWS?id=1236f007
+ if grep-flags-available --color=auto --exclude-dir=.cvs; then
+ GREP_OPTIONS="--color=auto --exclude-dir=$EXC_FOLDERS"
+ elif grep-flags-available --color=auto --exclude=.cvs; then
+ GREP_OPTIONS="--color=auto --exclude=$EXC_FOLDERS"
+ fi
+
+ if [[ -n "$GREP_OPTIONS" ]]; then
+ # export grep, egrep and fgrep settings
+ alias grep="grep $GREP_OPTIONS"
+ alias egrep="egrep $GREP_OPTIONS"
+ alias fgrep="fgrep $GREP_OPTIONS"
+
+ # write to cache file if cache directory is writable
+ if [[ -w "$ZSH_CACHE_DIR" ]]; then
+ alias -L grep egrep fgrep >| "$__GREP_CACHE_FILE"
+ fi
+ fi
+
+ # Clean up
+ unset GREP_OPTIONS EXC_FOLDERS
+ unfunction grep-flags-available
fi
-# ignore VCS folders (if the necessary grep flags are available)
-VCS_FOLDERS="{.bzr,CVS,.git,.hg,.svn}"
-
-if grep-flag-available --exclude-dir=.cvs; then
- GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS"
-elif grep-flag-available --exclude=.cvs; then
- GREP_OPTIONS+=" --exclude=$VCS_FOLDERS"
-fi
-
-# export grep settings
-alias grep="grep $GREP_OPTIONS"
-
-# clean up
-unset GREP_OPTIONS
-unset VCS_FOLDERS
-unfunction grep-flag-available
+unset __GREP_CACHE_FILE __GREP_ALIAS_CACHES
diff --git a/zsh/lib/history.zsh b/zsh/lib/history.zsh
index 52e45bf..8d922a3 100644
--- a/zsh/lib/history.zsh
+++ b/zsh/lib/history.zsh
@@ -27,8 +27,8 @@ esac
## History file configuration
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
-HISTSIZE=50000
-SAVEHIST=10000
+[ "$HISTSIZE" -lt 50000 ] && HISTSIZE=50000
+[ "$SAVEHIST" -lt 10000 ] && SAVEHIST=10000
## History command configuration
setopt extended_history # record timestamp of command in HISTFILE
@@ -36,5 +36,3 @@ setopt hist_expire_dups_first # delete duplicates first when HISTFILE size excee
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
-setopt inc_append_history # add commands to HISTFILE in order of execution
-setopt share_history # share command history data
diff --git a/zsh/lib/key-bindings.zsh b/zsh/lib/key-bindings.zsh
index 0e056dc..aaa7304 100644
--- a/zsh/lib/key-bindings.zsh
+++ b/zsh/lib/key-bindings.zsh
@@ -15,55 +15,100 @@ if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
zle -N zle-line-finish
fi
-bindkey -e # Use emacs key bindings
+# Use emacs key bindings
+bindkey -e
+
+# [PageUp] - Up a line of history
+if [[ -n "${terminfo[kpp]}" ]]; then
+ bindkey -M emacs "${terminfo[kpp]}" up-line-or-history
+ bindkey -M viins "${terminfo[kpp]}" up-line-or-history
+ bindkey -M vicmd "${terminfo[kpp]}" up-line-or-history
+fi
+# [PageDown] - Down a line of history
+if [[ -n "${terminfo[knp]}" ]]; then
+ bindkey -M emacs "${terminfo[knp]}" down-line-or-history
+ bindkey -M viins "${terminfo[knp]}" down-line-or-history
+ bindkey -M vicmd "${terminfo[knp]}" down-line-or-history
+fi
+
+# Start typing + [Up-Arrow] - fuzzy find history forward
+if [[ -n "${terminfo[kcuu1]}" ]]; then
+ autoload -U up-line-or-beginning-search
+ zle -N up-line-or-beginning-search
+
+ bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search
+ bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search
+ bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search
+fi
+# Start typing + [Down-Arrow] - fuzzy find history backward
+if [[ -n "${terminfo[kcud1]}" ]]; then
+ autoload -U down-line-or-beginning-search
+ zle -N down-line-or-beginning-search
+
+ bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search
+ bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search
+ bindkey -M vicmd "${terminfo[kcud1]}" down-line-or-beginning-search
+fi
+
+# [Home] - Go to beginning of line
+if [[ -n "${terminfo[khome]}" ]]; then
+ bindkey -M emacs "${terminfo[khome]}" beginning-of-line
+ bindkey -M viins "${terminfo[khome]}" beginning-of-line
+ bindkey -M vicmd "${terminfo[khome]}" beginning-of-line
+fi
+# [End] - Go to end of line
+if [[ -n "${terminfo[kend]}" ]]; then
+ bindkey -M emacs "${terminfo[kend]}" end-of-line
+ bindkey -M viins "${terminfo[kend]}" end-of-line
+ bindkey -M vicmd "${terminfo[kend]}" end-of-line
+fi
+
+# [Shift-Tab] - move through the completion menu backwards
+if [[ -n "${terminfo[kcbt]}" ]]; then
+ bindkey -M emacs "${terminfo[kcbt]}" reverse-menu-complete
+ bindkey -M viins "${terminfo[kcbt]}" reverse-menu-complete
+ bindkey -M vicmd "${terminfo[kcbt]}" reverse-menu-complete
+fi
+
+# [Backspace] - delete backward
+bindkey -M emacs '^?' backward-delete-char
+bindkey -M viins '^?' backward-delete-char
+bindkey -M vicmd '^?' backward-delete-char
+# [Delete] - delete forward
+if [[ -n "${terminfo[kdch1]}" ]]; then
+ bindkey -M emacs "${terminfo[kdch1]}" delete-char
+ bindkey -M viins "${terminfo[kdch1]}" delete-char
+ bindkey -M vicmd "${terminfo[kdch1]}" delete-char
+else
+ bindkey -M emacs "^[[3~" delete-char
+ bindkey -M viins "^[[3~" delete-char
+ bindkey -M vicmd "^[[3~" delete-char
+
+ bindkey -M emacs "^[3;5~" delete-char
+ bindkey -M viins "^[3;5~" delete-char
+ bindkey -M vicmd "^[3;5~" delete-char
+fi
+
+# [Ctrl-Delete] - delete whole forward-word
+bindkey -M emacs '^[[3;5~' kill-word
+bindkey -M viins '^[[3;5~' kill-word
+bindkey -M vicmd '^[[3;5~' kill-word
+
+# [Ctrl-RightArrow] - move forward one word
+bindkey -M emacs '^[[1;5C' forward-word
+bindkey -M viins '^[[1;5C' forward-word
+bindkey -M vicmd '^[[1;5C' forward-word
+# [Ctrl-LeftArrow] - move backward one word
+bindkey -M emacs '^[[1;5D' backward-word
+bindkey -M viins '^[[1;5D' backward-word
+bindkey -M vicmd '^[[1;5D' backward-word
+
bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark
bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls
bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line.
-if [[ "${terminfo[kpp]}" != "" ]]; then
- bindkey "${terminfo[kpp]}" up-line-or-history # [PageUp] - Up a line of history
-fi
-if [[ "${terminfo[knp]}" != "" ]]; then
- bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history
-fi
+bindkey ' ' magic-space # [Space] - don't do history expansion
-# start typing + [Up-Arrow] - fuzzy find history forward
-if [[ "${terminfo[kcuu1]}" != "" ]]; then
- 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
- 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
- bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
-fi
-if [[ "${terminfo[kend]}" != "" ]]; then
- bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
-fi
-
-bindkey ' ' magic-space # [Space] - do history expansion
-
-bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word
-bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word
-
-if [[ "${terminfo[kcbt]}" != "" ]]; then
- bindkey "${terminfo[kcbt]}" reverse-menu-complete # [Shift-Tab] - move through the completion menu backwards
-fi
-
-bindkey '^?' backward-delete-char # [Backspace] - delete backward
-if [[ "${terminfo[kdch1]}" != "" ]]; then
- bindkey "${terminfo[kdch1]}" delete-char # [Delete] - delete forward
-else
- bindkey "^[[3~" delete-char
- bindkey "^[3;5~" delete-char
- bindkey "\e[3~" delete-char
-fi
# Edit the current command line in $EDITOR
autoload -U edit-command-line
diff --git a/zsh/lib/misc.zsh b/zsh/lib/misc.zsh
index 36c3ae2..a5d3af9 100644
--- a/zsh/lib/misc.zsh
+++ b/zsh/lib/misc.zsh
@@ -3,15 +3,15 @@ autoload -Uz is-at-least
# *-magic is known buggy in some versions; disable if so
if [[ $DISABLE_MAGIC_FUNCTIONS != true ]]; 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
+ 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
@@ -22,10 +22,10 @@ env_default 'PAGER' 'less'
env_default 'LESS' '-R'
## super user alias
-alias _='sudo'
+alias _='sudo '
## more intelligent acking for ubuntu users
-if which ack-grep &> /dev/null; then
+if (( $+commands[ack-grep] )); then
alias afind='ack-grep -il'
else
alias afind='ack -il'
diff --git a/zsh/lib/nvm.zsh b/zsh/lib/nvm.zsh
index 4a8b681..2fe57a8 100644
--- a/zsh/lib/nvm.zsh
+++ b/zsh/lib/nvm.zsh
@@ -1,9 +1,6 @@
-# get the node.js version
+# get the nvm-controlled node.js version
function nvm_prompt_info() {
- [[ -f "$NVM_DIR/nvm.sh" ]] || return
- local nvm_prompt
- nvm_prompt=$(node -v 2>/dev/null)
- [[ "${nvm_prompt}x" == "x" ]] && return
- nvm_prompt=${nvm_prompt:1}
+ which nvm &>/dev/null || return
+ local nvm_prompt=${$(nvm current)#v}
echo "${ZSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt}${ZSH_THEME_NVM_PROMPT_SUFFIX}"
}
diff --git a/zsh/lib/spectrum.zsh b/zsh/lib/spectrum.zsh
index 312ab22..d5c22a8 100644
--- a/zsh/lib/spectrum.zsh
+++ b/zsh/lib/spectrum.zsh
@@ -1,4 +1,3 @@
-#! /bin/zsh
# A script to make using 256 colors in zsh less painful.
# P.C. Shyamshankar
# Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
@@ -6,32 +5,31 @@
typeset -AHg FX FG BG
FX=(
- reset "%{[00m%}"
- bold "%{[01m%}" no-bold "%{[22m%}"
- italic "%{[03m%}" no-italic "%{[23m%}"
- underline "%{[04m%}" no-underline "%{[24m%}"
- blink "%{[05m%}" no-blink "%{[25m%}"
- reverse "%{[07m%}" no-reverse "%{[27m%}"
+ reset "%{[00m%}"
+ bold "%{[01m%}" no-bold "%{[22m%}"
+ italic "%{[03m%}" no-italic "%{[23m%}"
+ underline "%{[04m%}" no-underline "%{[24m%}"
+ blink "%{[05m%}" no-blink "%{[25m%}"
+ reverse "%{[07m%}" no-reverse "%{[27m%}"
)
for color in {000..255}; do
- FG[$color]="%{[38;5;${color}m%}"
- BG[$color]="%{[48;5;${color}m%}"
+ FG[$color]="%{[38;5;${color}m%}"
+ BG[$color]="%{[48;5;${color}m%}"
done
-
-ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
-
# Show all 256 colors with color number
function spectrum_ls() {
+ local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
for code in {000..255}; do
- print -P -- "$code: %{$FG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"
+ 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() {
+ local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
for code in {000..255}; do
- print -P -- "$code: %{$BG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"
+ print -P -- "$code: $BG[$code]$ZSH_SPECTRUM_TEXT%{$reset_color%}"
done
}
diff --git a/zsh/lib/termsupport.zsh b/zsh/lib/termsupport.zsh
index aa14f3f..778f12b 100644
--- a/zsh/lib/termsupport.zsh
+++ b/zsh/lib/termsupport.zsh
@@ -17,32 +17,32 @@ function title {
: ${2=$1}
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
+ cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty|st*)
+ print -Pn "\e]2;${2:q}\a" # set window name
+ print -Pn "\e]1;${1:q}\a" # set tab name
;;
screen*|tmux*)
- print -Pn "\ek$1:q\e\\" # set screen hardstatus
+ 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
+ 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
+ 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: %~"
+ZSH_THEME_TERM_TITLE_IDLE="%n@%m:%~"
# Avoid duplication of directory in terminals with independent dir display
if [[ "$TERM_PROGRAM" == Apple_Terminal ]]; then
ZSH_THEME_TERM_TITLE_IDLE="%n@%m"
@@ -50,22 +50,52 @@ fi
# Runs before showing the prompt
function omz_termsupport_precmd {
- emulate -L zsh
-
- if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
- return
- fi
-
+ [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
}
# Runs before executing the command
function omz_termsupport_preexec {
+ [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
+
emulate -L zsh
setopt extended_glob
- if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
- return
+ # split command into array of arguments
+ local -a cmdargs
+ cmdargs=("${(z)2}")
+ # if running fg, extract the command from the job description
+ if [[ "${cmdargs[1]}" = fg ]]; then
+ # get the job id from the first argument passed to the fg command
+ local job_id jobspec="${cmdargs[2]#%}"
+ # logic based on jobs arguments:
+ # http://zsh.sourceforge.net/Doc/Release/Jobs-_0026-Signals.html#Jobs
+ # https://www.zsh.org/mla/users/2007/msg00704.html
+ case "$jobspec" in
+ <->) # %number argument:
+ # use the same passed as an argument
+ job_id=${jobspec} ;;
+ ""|%|+) # empty, %% or %+ argument:
+ # use the current job, which appears with a + in $jobstates:
+ # suspended:+:5071=suspended (tty output)
+ job_id=${(k)jobstates[(r)*:+:*]} ;;
+ -) # %- argument:
+ # use the previous job, which appears with a - in $jobstates:
+ # suspended:-:6493=suspended (signal)
+ job_id=${(k)jobstates[(r)*:-:*]} ;;
+ [?]*) # %?string argument:
+ # use $jobtexts to match for a job whose command *contains*
+ job_id=${(k)jobtexts[(r)*${(Q)jobspec}*]} ;;
+ *) # %string argument:
+ # use $jobtexts to match for a job whose command *starts with*
+ job_id=${(k)jobtexts[(r)${(Q)jobspec}*]} ;;
+ esac
+
+ # override preexec function arguments with job command
+ if [[ -n "${jobtexts[$job_id]}" ]]; then
+ 1="${jobtexts[$job_id]}"
+ 2="${jobtexts[$job_id]}"
+ fi
fi
# cmd name only, or if this is sudo or ssh, the next cmd
@@ -75,8 +105,9 @@ function omz_termsupport_preexec {
title '$CMD' '%100>...>$LINE%<<'
}
-precmd_functions+=(omz_termsupport_precmd)
-preexec_functions+=(omz_termsupport_preexec)
+autoload -U add-zsh-hook
+add-zsh-hook precmd omz_termsupport_precmd
+add-zsh-hook preexec omz_termsupport_preexec
# Keep Apple Terminal.app's current working directory updated
@@ -90,16 +121,17 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
function update_terminalapp_cwd() {
emulate -L zsh
- # Percent-encode the pathname.
- local URL_PATH="$(omz_urlencode -P $PWD)"
- [[ $? != 0 ]] && return 1
+ # Percent-encode the host and path names.
+ local URL_HOST URL_PATH
+ URL_HOST="$(omz_urlencode -P $HOST)" || return 1
+ URL_PATH="$(omz_urlencode -P $PWD)" || return 1
# Undocumented Terminal.app-specific control sequence
- printf '\e]7;%s\a' "file://$HOST$URL_PATH"
+ printf '\e]7;%s\a' "file://$URL_HOST$URL_PATH"
}
# Use a precmd hook instead of a chpwd hook to avoid contaminating output
- precmd_functions+=(update_terminalapp_cwd)
+ add-zsh-hook precmd update_terminalapp_cwd
# Run once to get initial cwd set
update_terminalapp_cwd
fi
diff --git a/zsh/lib/theme-and-appearance.zsh b/zsh/lib/theme-and-appearance.zsh
index 5016d86..0b71de3 100644
--- a/zsh/lib/theme-and-appearance.zsh
+++ b/zsh/lib/theme-and-appearance.zsh
@@ -39,6 +39,11 @@ if [[ "$DISABLE_LS_COLORS" != "true" ]]; then
fi
fi
+# enable diff color if possible.
+if command diff --color . . &>/dev/null; then
+ alias diff='diff --color'
+fi
+
setopt auto_cd
setopt multios
setopt prompt_subst
diff --git a/zsh/oh-my-zsh.sh b/zsh/oh-my-zsh.sh
index 6b2662d..16e244b 100644
--- a/zsh/oh-my-zsh.sh
+++ b/zsh/oh-my-zsh.sh
@@ -1,17 +1,15 @@
+# If ZSH is not defined, use the current script's directory.
+[[ -z "$ZSH" ]] && export ZSH="${${(%):-%x}:a:h}"
+
# Set ZSH_CACHE_DIR to the path where cache files should be created
# or else we will use the default cache/
if [[ -z "$ZSH_CACHE_DIR" ]]; then
ZSH_CACHE_DIR="$ZSH/cache"
fi
-# Migrate .zsh-update file to $ZSH_CACHE_DIR
-if [ -f ~/.zsh-update ] && [ ! -f ${ZSH_CACHE_DIR}/.zsh-update ]; then
- mv ~/.zsh-update ${ZSH_CACHE_DIR}/.zsh-update
-fi
-
# Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
- env ZSH=$ZSH ZSH_CACHE_DIR=$ZSH_CACHE_DIR DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
+ source $ZSH/tools/check_for_upgrade.sh
fi
# Initializes Oh My Zsh
@@ -32,8 +30,8 @@ fi
is_plugin() {
local base_dir=$1
local name=$2
- test -f $base_dir/plugins/$name/$name.plugin.zsh \
- || test -f $base_dir/plugins/$name/_$name
+ builtin test -f $base_dir/plugins/$name/$name.plugin.zsh \
+ || builtin test -f $base_dir/plugins/$name/_$name
}
# Add all defined plugins to fpath. This must be done
@@ -61,6 +59,17 @@ if [ -z "$ZSH_COMPDUMP" ]; then
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
fi
+# Construct zcompdump OMZ metadata
+zcompdump_revision="#omz revision: $(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)"
+zcompdump_fpath="#omz fpath: $fpath"
+
+# Delete the zcompdump file if OMZ zcompdump metadata changed
+if ! command grep -q -Fx "$zcompdump_revision" "$ZSH_COMPDUMP" 2>/dev/null \
+ || ! command grep -q -Fx "$zcompdump_fpath" "$ZSH_COMPDUMP" 2>/dev/null; then
+ command rm -f "$ZSH_COMPDUMP"
+ zcompdump_refresh=1
+fi
+
if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
source $ZSH/lib/compfix.zsh
# If completion insecurities exist, warn the user
@@ -72,6 +81,19 @@ else
compinit -u -C -d "${ZSH_COMPDUMP}"
fi
+# Append zcompdump metadata if missing
+if (( $zcompdump_refresh )); then
+ # Use `tee` in case the $ZSH_COMPDUMP filename is invalid, to silence the error
+ # See https://github.com/ohmyzsh/ohmyzsh/commit/dd1a7269#commitcomment-39003489
+ tee -a "$ZSH_COMPDUMP" &>/dev/null <` as well as ``.
+
+| Function | Command |
+| ------------------------- | --------------------------------- |
+| ardu [URL or revision_id] | `arc diff --update` [revision_id] |
+| arpa [URL or revision_id] | `arc patch` [revision_id] |
diff --git a/zsh/plugins/arcanist/arcanist.plugin.zsh b/zsh/plugins/arcanist/arcanist.plugin.zsh
index 3f4eb07..88e6713 100644
--- a/zsh/plugins/arcanist/arcanist.plugin.zsh
+++ b/zsh/plugins/arcanist/arcanist.plugin.zsh
@@ -9,13 +9,29 @@ alias arco='arc cover'
alias arci='arc commit'
alias ard='arc diff'
+alias ardc='arc diff --create'
alias ardnu='arc diff --nounit'
alias ardnupc='arc diff --nounit --plan-changes'
alias ardpc='arc diff --plan-changes'
+alias ardp='arc diff --preview' # creates a new diff in the phab interface
alias are='arc export'
alias arh='arc help'
alias arl='arc land'
alias arli='arc lint'
alias arls='arc list'
-alias arpa='arc patch'
+
+#
+# Functions
+# (sorted alphabetically)
+#
+
+ardu() {
+ # Both `ardu https://arcanist-url.com/`, and `ardu ` work.
+ arc diff --update "${1:t}"
+}
+
+arpa() {
+ # Both `arpa https://arcanist-url.com/`, and `arpa ` work.
+ arc patch "${1:t}"
+}
diff --git a/zsh/plugins/archlinux/README.md b/zsh/plugins/archlinux/README.md
index ff2b6a4..5882c76 100644
--- a/zsh/plugins/archlinux/README.md
+++ b/zsh/plugins/archlinux/README.md
@@ -1,5 +1,13 @@
# Archlinux plugin
+This plugin adds some aliases and functions to work with Arch Linux.
+
+To use it, add `archlinux` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... archlinux)
+```
+
## Features
#### YAY
@@ -119,7 +127,7 @@
| pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages |
| upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages |
| pacfileupg | sudo pacman -Fy | Download fresh package databases from the server |
-| pacfiles | pacman -Fs | Search package file names for matching strings |
+| pacfiles | pacman -F | Search package file names for matching strings |
| pacls | pacman -Ql | List files in a package |
| pacown | pacman -Qo | Show which package owns a file |
diff --git a/zsh/plugins/archlinux/archlinux.plugin.zsh b/zsh/plugins/archlinux/archlinux.plugin.zsh
index e0101c7..4d39bd8 100644
--- a/zsh/plugins/archlinux/archlinux.plugin.zsh
+++ b/zsh/plugins/archlinux/archlinux.plugin.zsh
@@ -149,7 +149,7 @@ 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 -Fs'
+alias pacfiles='pacman -F'
alias pacls='pacman -Ql'
alias pacown='pacman -Qo'
@@ -208,12 +208,12 @@ function pacmansignkeys() {
if (( $+commands[xdg-open] )); then
function pacweb() {
pkg="$1"
- infos="$(pacman -Si "$pkg")"
+ infos="$(LANG=C pacman -Si "$pkg")"
if [[ -z "$infos" ]]; then
return
fi
- repo="$(grep '^Repo' <<< "$infos" | grep -oP '[^ ]+$')"
- arch="$(grep '^Arch' <<< "$infos" | grep -oP '[^ ]+$')"
+ repo="$(grep -m 1 '^Repo' <<< "$infos" | grep -oP '[^ ]+$')"
+ arch="$(grep -m 1 '^Arch' <<< "$infos" | grep -oP '[^ ]+$')"
xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null
}
fi
diff --git a/zsh/plugins/asdf/asdf.plugin.zsh b/zsh/plugins/asdf/asdf.plugin.zsh
index 38b2255..c386d57 100644
--- a/zsh/plugins/asdf/asdf.plugin.zsh
+++ b/zsh/plugins/asdf/asdf.plugin.zsh
@@ -3,7 +3,7 @@ ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
ASDF_COMPLETIONS="$ASDF_DIR/completions"
# If not found, check for Homebrew package
-if [[ ! -f "$ASDF_DIR/asdf.sh" ]] && (( $+commands[brew] )); then
+if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && (( $+commands[brew] )); then
ASDF_DIR="$(brew --prefix asdf)"
ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d"
fi
diff --git a/zsh/plugins/autoenv/README.md b/zsh/plugins/autoenv/README.md
new file mode 100644
index 0000000..5dfb5fb
--- /dev/null
+++ b/zsh/plugins/autoenv/README.md
@@ -0,0 +1,20 @@
+# Autoenv plugin
+
+This plugin loads the [Autoenv](https://github.com/inishchith/autoenv).
+
+To use it, add `autoenv` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... autoenv)
+```
+
+## Functions
+
+* `use_env()`: creates and/or activates a virtualenv. For use in `.env` files.
+ See the source code for details.
+
+## Requirements
+
+In order to make this work, you will need to have the autoenv installed.
+
+More info on the usage and install at [the project's homepage](https://github.com/inishchith/autoenv).
diff --git a/zsh/plugins/autoenv/autoenv.plugin.zsh b/zsh/plugins/autoenv/autoenv.plugin.zsh
index 3c1b0fa..bd03cf4 100644
--- a/zsh/plugins/autoenv/autoenv.plugin.zsh
+++ b/zsh/plugins/autoenv/autoenv.plugin.zsh
@@ -1,12 +1,39 @@
-# Activates autoenv or reports its failure
+# Initialization: activate autoenv or report its absence
() {
+local d autoenv_dir install_locations
if ! type autoenv_init >/dev/null; then
- for d (~/.autoenv ~/.local/bin /usr/local/opt/autoenv /usr/local/bin); do
+ # Check if activate.sh is in $PATH
+ if (( $+commands[activate.sh] )); then
+ autoenv_dir="${commands[activate.sh]:h}"
+ fi
+
+ # Locate autoenv installation
+ if [[ -z $autoenv_dir ]]; then
+ install_locations=(
+ ~/.autoenv
+ ~/.local/bin
+ /usr/local/opt/autoenv
+ /usr/local/bin
+ /usr/share/autoenv-git
+ ~/Library/Python/bin
+ )
+ for d ( $install_locations ); do
+ if [[ -e $d/activate.sh ]]; then
+ autoenv_dir=$d
+ break
+ fi
+ done
+ fi
+
+ # Look for Homebrew path as a last resort
+ if [[ -z "$autoenv_dir" ]] && (( $+commands[brew] )); then
+ d=$(brew --prefix)/opt/autoenv
if [[ -e $d/activate.sh ]]; then
autoenv_dir=$d
- break
fi
- done
+ fi
+
+ # Complain if autoenv is not installed
if [[ -z $autoenv_dir ]]; then
cat <&2
-------- AUTOENV ---------
@@ -17,6 +44,7 @@ In the meantime the autoenv plugin is DISABLED.
END
return 1
fi
+ # Load autoenv
source $autoenv_dir/activate.sh
fi
}
@@ -27,17 +55,17 @@ fi
# It only performs an action if the requested virtualenv is not the current one.
use_env() {
- typeset venv
- venv="$1"
- if [[ "${VIRTUAL_ENV:t}" != "$venv" ]]; then
- if workon | grep -q "$venv"; then
- workon "$venv"
- else
- echo -n "Create virtualenv $venv now? (Yn) "
- read answer
- if [[ "$answer" == "Y" ]]; then
- mkvirtualenv "$venv"
- fi
- fi
+ local venv
+ venv="$1"
+ if [[ "${VIRTUAL_ENV:t}" != "$venv" ]]; then
+ if workon | grep -q "$venv"; then
+ workon "$venv"
+ else
+ echo -n "Create virtualenv $venv now? (Yn) "
+ read answer
+ if [[ "$answer" == "Y" ]]; then
+ mkvirtualenv "$venv"
+ fi
fi
+ fi
}
diff --git a/zsh/plugins/autojump/README.md b/zsh/plugins/autojump/README.md
index 18ff793..750ff56 100644
--- a/zsh/plugins/autojump/README.md
+++ b/zsh/plugins/autojump/README.md
@@ -8,4 +8,4 @@ To use it, add `autojump` to the plugins array in your zshrc file:
plugins=(... autojump)
```
-More info on the usage: https://github.com/wting/autojump
+**Note:** you have to [install autojump](https://github.com/wting/autojump#installation) first.
diff --git a/zsh/plugins/autojump/autojump.plugin.zsh b/zsh/plugins/autojump/autojump.plugin.zsh
index d80c888..f40b0e9 100644
--- a/zsh/plugins/autojump/autojump.plugin.zsh
+++ b/zsh/plugins/autojump/autojump.plugin.zsh
@@ -29,6 +29,6 @@ if (( ! found && $+commands[brew] )); then
fi
fi
-(( ! found )) && echo '[oh-my-zsh] autojump script not found'
+(( ! found )) && echo '[oh-my-zsh] autojump not found. Please install it first.'
unset autojump_paths file found
diff --git a/zsh/plugins/aws/aws.plugin.zsh b/zsh/plugins/aws/aws.plugin.zsh
index 231ac5a..7994963 100644
--- a/zsh/plugins/aws/aws.plugin.zsh
+++ b/zsh/plugins/aws/aws.plugin.zsh
@@ -10,7 +10,8 @@ function asp() {
return
fi
- local available_profiles=($(aws_profiles))
+ local -a available_profiles
+ available_profiles=($(aws_profiles))
if [[ -z "${available_profiles[(r)$1]}" ]]; then
echo "${fg[red]}Profile '$1' not found in '${AWS_CONFIG_FILE:-$HOME/.aws/config}'" >&2
echo "Available profiles: ${(j:, :)available_profiles:-no profiles found}${reset_color}" >&2
@@ -30,17 +31,17 @@ function aws_change_access_key() {
echo Insert the credentials when asked.
asp "$1" || return 1
- aws iam create-access-key
- aws configure --profile "$1"
+ AWS_PAGER="" aws iam create-access-key
+ AWS_PAGER="" aws configure --profile "$1"
echo You can now safely delete the old access key running \`aws iam delete-access-key --access-key-id ID\`
echo Your current keys are:
- aws iam list-access-keys
+ AWS_PAGER="" aws iam list-access-keys
}
function aws_profiles() {
[[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1
- grep '\[profile' "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/'
+ grep '\[profile' "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9@_\.-]*\).*/\1/'
}
function _aws_profiles() {
@@ -61,36 +62,45 @@ fi
# Load awscli completions
-function _awscli-homebrew-installed() {
- # check if Homebrew is installed
- (( $+commands[brew] )) || return 1
+# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back
+if command -v aws_completer &> /dev/null; then
+ autoload -Uz bashcompinit && bashcompinit
+ complete -C aws_completer aws
+else
+ function _awscli-homebrew-installed() {
+ # check if Homebrew is installed
+ (( $+commands[brew] )) || return 1
- # speculatively check default brew prefix
- if [ -h /usr/local/opt/awscli ]; then
- _brew_prefix=/usr/local/opt/awscli
- else
- # ok, it is not in the default prefix
- # this call to brew is expensive (about 400 ms), so at least let's make it only once
- _brew_prefix=$(brew --prefix awscli)
+ # speculatively check default brew prefix
+ if [ -h /usr/local/opt/awscli ]; then
+ _brew_prefix=/usr/local/opt/awscli
+ else
+ # ok, it is not in the default prefix
+ # this call to brew is expensive (about 400 ms), so at least let's make it only once
+ _brew_prefix=$(brew --prefix awscli)
+ fi
+ }
+
+ # get aws_zsh_completer.sh location from $PATH
+ _aws_zsh_completer_path="$commands[aws_zsh_completer.sh]"
+
+ # otherwise check common locations
+ if [[ -z $_aws_zsh_completer_path ]]; then
+ # Homebrew
+ if _awscli-homebrew-installed; then
+ _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
+ # Ubuntu
+ elif [[ -e /usr/share/zsh/vendor-completions/_awscli ]]; then
+ _aws_zsh_completer_path=/usr/share/zsh/vendor-completions/_awscli
+ # NixOS
+ elif [[ -e "${commands[aws]:P:h:h}/share/zsh/site-functions/aws_zsh_completer.sh" ]]; then
+ _aws_zsh_completer_path="${commands[aws]:P:h:h}/share/zsh/site-functions/aws_zsh_completer.sh"
+ # RPM
+ else
+ _aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh
+ fi
fi
-}
-# get aws_zsh_completer.sh location from $PATH
-_aws_zsh_completer_path="$commands[aws_zsh_completer.sh]"
-
-# otherwise check common locations
-if [[ -z $_aws_zsh_completer_path ]]; then
- # Homebrew
- if _awscli-homebrew-installed; then
- _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
- # Ubuntu
- elif [[ -e /usr/share/zsh/vendor-completions/_awscli ]]; then
- _aws_zsh_completer_path=/usr/share/zsh/vendor-completions/_awscli
- # RPM
- else
- _aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh
- fi
+ [[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path
+ unset _aws_zsh_completer_path _brew_prefix
fi
-
-[[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path
-unset _aws_zsh_completer_path _brew_prefix
diff --git a/zsh/plugins/battery/README.md b/zsh/plugins/battery/README.md
index b7a13a7..c2554a3 100644
--- a/zsh/plugins/battery/README.md
+++ b/zsh/plugins/battery/README.md
@@ -9,5 +9,14 @@ To use, add `battery` to the list of plugins in your `.zshrc` file:
Then, add the `battery_pct_prompt` function to your custom theme. For example:
```
-RPROMPT='$(battery_pct_prompt)'
+RPROMPT='$(battery_pct_prompt) ...'
+```
+
+## Requirements
+
+On Linux, you must have the `acpi` tool installed on your operating system.
+
+Here's an example of how to install with apt:
+```
+sudo apt-get install acpi
```
diff --git a/zsh/plugins/battery/battery.plugin.zsh b/zsh/plugins/battery/battery.plugin.zsh
index 8f398cf..755ec8d 100644
--- a/zsh/plugins/battery/battery.plugin.zsh
+++ b/zsh/plugins/battery/battery.plugin.zsh
@@ -7,23 +7,25 @@
# Email: neuralsandwich@gmail.com #
# Modified to add support for Apple Mac #
###########################################
+# Author: J (927589452) #
+# Modified to add support for FreeBSD #
+###########################################
-if [[ "$OSTYPE" = darwin* ]] ; then
+if [[ "$OSTYPE" = darwin* ]]; then
- function battery_pct() {
- local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
- typeset -F maxcapacity=$(echo $smart_battery_status | grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //')
- typeset -F currentcapacity=$(echo $smart_battery_status | grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //')
- integer i=$(((currentcapacity/maxcapacity) * 100))
- echo $i
+ function battery_is_charging() {
+ ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ Yes'
}
- function plugged_in() {
- [ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ Yes') -eq 1 ]
+ function battery_pct() {
+ local battery_status="$(ioreg -rc AppleSmartBattery)"
+ local -i capacity=$(sed -n -e '/MaxCapacity/s/^.*"MaxCapacity"\ =\ //p' <<< $battery_status)
+ local -i current=$(sed -n -e '/CurrentCapacity/s/^.*"CurrentCapacity"\ =\ //p' <<< $battery_status)
+ echo $(( current * 100 / capacity ))
}
function battery_pct_remaining() {
- if plugged_in ; then
+ if battery_is_charging; then
echo "External Power"
else
battery_pct
@@ -32,9 +34,9 @@ if [[ "$OSTYPE" = darwin* ]] ; then
function battery_time_remaining() {
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
- if [[ $(echo $smart_battery_status | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
- timeremaining=$(echo $smart_battery_status | grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
- if [ $timeremaining -gt 720 ] ; then
+ if [[ $(echo $smart_battery_status | command grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]]; then
+ timeremaining=$(echo $smart_battery_status | command grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
+ if [ $timeremaining -gt 720 ]; then
echo "::"
else
echo "~$((timeremaining / 60)):$((timeremaining % 60))"
@@ -45,39 +47,36 @@ if [[ "$OSTYPE" = darwin* ]] ; then
}
function battery_pct_prompt () {
- if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
- b=$(battery_pct_remaining)
- if [ $b -gt 50 ] ; then
+ local battery_pct color
+ if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ No'; then
+ battery_pct=$(battery_pct_remaining)
+ if [[ $battery_pct -gt 50 ]]; then
color='green'
- elif [ $b -gt 20 ] ; then
+ elif [[ $battery_pct -gt 20 ]]; then
color='yellow'
else
color='red'
fi
- echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
+ echo "%{$fg[$color]%}[${battery_pct}%%]%{$reset_color%}"
else
echo "∞"
fi
}
- function battery_is_charging() {
- [[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]]
- }
-
-elif [[ "$OSTYPE" = linux* ]] ; then
+elif [[ "$OSTYPE" = freebsd* ]]; then
function battery_is_charging() {
- ! [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]]
+ [[ $(sysctl -n hw.acpi.battery.state) -eq 2 ]]
}
function battery_pct() {
- if (( $+commands[acpi] )) ; then
- echo "$(acpi 2>/dev/null | cut -f2 -d ',' | tr -cd '[:digit:]')"
+ if (( $+commands[sysctl] )); then
+ sysctl -n hw.acpi.battery.life
fi
}
function battery_pct_remaining() {
- if [ ! $(battery_is_charging) ] ; then
+ if ! battery_is_charging; then
battery_pct
else
echo "External Power"
@@ -85,76 +84,128 @@ elif [[ "$OSTYPE" = linux* ]] ; then
}
function battery_time_remaining() {
- if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
- echo $(acpi 2>/dev/null | cut -f3 -d ',')
+ local remaining_time
+ remaining_time=$(sysctl -n hw.acpi.battery.time)
+ if [[ $remaining_time -ge 0 ]]; then
+ ((hour = $remaining_time / 60 ))
+ ((minute = $remaining_time % 60 ))
+ printf %02d:%02d $hour $minute
fi
}
function battery_pct_prompt() {
- b=$(battery_pct_remaining)
- if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
- if [ $b -gt 50 ] ; then
+ local battery_pct color
+ battery_pct=$(battery_pct_remaining)
+ if battery_is_charging; then
+ echo "∞"
+ else
+ if [[ $battery_pct -gt 50 ]]; then
color='green'
- elif [ $b -gt 20 ] ; then
+ elif [[ $battery_pct -gt 20 ]]; then
color='yellow'
else
color='red'
fi
- echo "%{$fg[$color]%}$(battery_pct_remaining)%%%{$reset_color%}"
+ echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
+ fi
+ }
+
+elif [[ "$OSTYPE" = linux* ]]; then
+
+ function battery_is_charging() {
+ ! acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -q '^Battery.*Discharging'
+ }
+
+ function battery_pct() {
+ if (( $+commands[acpi] )); then
+ acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -E '^Battery.*(Full|(Disc|C)harging)' | cut -f2 -d ',' | tr -cd '[:digit:]'
+ fi
+ }
+
+ function battery_pct_remaining() {
+ if ! battery_is_charging; then
+ battery_pct
else
+ echo "External Power"
+ fi
+ }
+
+ function battery_time_remaining() {
+ if ! battery_is_charging; then
+ acpi 2>/dev/null | command grep -v "rate information unavailable" | cut -f3 -d ','
+ fi
+ }
+
+ function battery_pct_prompt() {
+ local battery_pct color
+ battery_pct=$(battery_pct_remaining)
+ if battery_is_charging; then
echo "∞"
+ else
+ if [[ $battery_pct -gt 50 ]]; then
+ color='green'
+ elif [[ $battery_pct -gt 20 ]]; then
+ color='yellow'
+ else
+ color='red'
+ fi
+ echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
fi
}
else
# Empty functions so we don't cause errors in prompts
- function battery_pct_remaining() {
- }
-
- function battery_time_remaining() {
- }
-
- function battery_pct_prompt() {
- }
+ function battery_is_charging { false }
+ function battery_pct \
+ battery_pct_remaining \
+ battery_time_remaining \
+ battery_pct_prompt { }
fi
function battery_level_gauge() {
- local gauge_slots=${BATTERY_GAUGE_SLOTS:-10};
- local green_threshold=${BATTERY_GREEN_THRESHOLD:-6};
- local yellow_threshold=${BATTERY_YELLOW_THRESHOLD:-4};
- local color_green=${BATTERY_COLOR_GREEN:-%F{green}};
- local color_yellow=${BATTERY_COLOR_YELLOW:-%F{yellow}};
- local color_red=${BATTERY_COLOR_RED:-%F{red}};
- local color_reset=${BATTERY_COLOR_RESET:-%{%f%k%b%}};
- local battery_prefix=${BATTERY_GAUGE_PREFIX:-'['};
- local battery_suffix=${BATTERY_GAUGE_SUFFIX:-']'};
- local filled_symbol=${BATTERY_GAUGE_FILLED_SYMBOL:-'▶'};
- local empty_symbol=${BATTERY_GAUGE_EMPTY_SYMBOL:-'▷'};
- local charging_color=${BATTERY_CHARGING_COLOR:-$color_yellow};
- local charging_symbol=${BATTERY_CHARGING_SYMBOL:-'⚡'};
+ local gauge_slots=${BATTERY_GAUGE_SLOTS:-10}
+ local green_threshold=${BATTERY_GREEN_THRESHOLD:-$(( gauge_slots * 0.6 ))}
+ local yellow_threshold=${BATTERY_YELLOW_THRESHOLD:-$(( gauge_slots * 0.4 ))}
+ local color_green=${BATTERY_COLOR_GREEN:-%F{green}}
+ local color_yellow=${BATTERY_COLOR_YELLOW:-%F{yellow}}
+ local color_red=${BATTERY_COLOR_RED:-%F{red}}
+ local color_reset=${BATTERY_COLOR_RESET:-%{%f%k%b%}}
+ local battery_prefix=${BATTERY_GAUGE_PREFIX:-'['}
+ local battery_suffix=${BATTERY_GAUGE_SUFFIX:-']'}
+ local filled_symbol=${BATTERY_GAUGE_FILLED_SYMBOL:-'▶'}
+ local empty_symbol=${BATTERY_GAUGE_EMPTY_SYMBOL:-'▷'}
+ local charging_color=${BATTERY_CHARGING_COLOR:-$color_yellow}
+ local charging_symbol=${BATTERY_CHARGING_SYMBOL:-'⚡'}
- local battery_remaining_percentage=$(battery_pct);
+ local battery_remaining_percentage=$(battery_pct)
+ local filled empty gauge_color
if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then
- local filled=$(((( $battery_remaining_percentage + $gauge_slots - 1) / $gauge_slots)));
- local empty=$(($gauge_slots - $filled));
+ filled=$(( ($battery_remaining_percentage * $gauge_slots) / 100 ))
+ empty=$(( $gauge_slots - $filled ))
- if [[ $filled -gt $green_threshold ]]; then local gauge_color=$color_green;
- elif [[ $filled -gt $yellow_threshold ]]; then local gauge_color=$color_yellow;
- else local gauge_color=$color_red;
+ if [[ $filled -gt $green_threshold ]]; then
+ gauge_color=$color_green
+ elif [[ $filled -gt $yellow_threshold ]]; then
+ gauge_color=$color_yellow
+ else
+ gauge_color=$color_red
fi
else
- local filled=$gauge_slots;
- local empty=0;
- filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'};
+ filled=$gauge_slots
+ empty=0
+ filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'}
fi
- local charging=' ' && battery_is_charging && charging=$charging_symbol;
+ local charging=' '
+ battery_is_charging && charging=$charging_symbol
- printf ${charging_color//\%/\%\%}$charging${color_reset//\%/\%\%}${battery_prefix//\%/\%\%}${gauge_color//\%/\%\%}
- printf ${filled_symbol//\%/\%\%}'%.0s' {1..$filled}
+ # Charging status and prefix
+ print -n ${charging_color}${charging}${color_reset}${battery_prefix}${gauge_color}
+ # Filled slots
+ [[ $filled -gt 0 ]] && printf ${filled_symbol//\%/\%\%}'%.0s' {1..$filled}
+ # Empty slots
[[ $filled -lt $gauge_slots ]] && printf ${empty_symbol//\%/\%\%}'%.0s' {1..$empty}
- printf ${color_reset//\%/\%\%}${battery_suffix//\%/\%\%}${color_reset//\%/\%\%}
+ # Suffix
+ print -n ${color_reset}${battery_suffix}${color_reset}
}
-
-
diff --git a/zsh/plugins/bazel/README.md b/zsh/plugins/bazel/README.md
new file mode 100644
index 0000000..e5ffe6e
--- /dev/null
+++ b/zsh/plugins/bazel/README.md
@@ -0,0 +1,5 @@
+## Bazel autocomplete plugin
+
+A copy of the completion script from the
+[bazelbuild/bazel](https://github.com/bazelbuild/bazel/master/scripts/zsh_completion/_bazel)
+git repo.
diff --git a/zsh/plugins/bazel/_bazel b/zsh/plugins/bazel/_bazel
new file mode 100644
index 0000000..827ce54
--- /dev/null
+++ b/zsh/plugins/bazel/_bazel
@@ -0,0 +1,341 @@
+#compdef bazel
+
+# Copyright 2015 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Installation
+# ------------
+#
+# 1. Add this script to a directory on your $fpath:
+# fpath[1,0]=~/.zsh/completion/
+# mkdir -p ~/.zsh/completion/
+# cp scripts/zsh_completion/_bazel ~/.zsh/completion
+#
+# 2. Optionally, add the following to your .zshrc.
+# zstyle ':completion:*' use-cache on
+# zstyle ':completion:*' cache-path ~/.zsh/cache
+#
+# This way, the completion script does not have to parse Bazel's options
+# repeatedly. The directory in cache-path must be created manually.
+#
+# 3. Restart the shell
+#
+# Options
+# -------
+# completion:init:bazel:* cache-lifetime
+# Lifetime for the completion cache (if turned on, default: 1 week)
+
+local curcontext="$curcontext" state line
+
+: ${BAZEL_COMPLETION_PACKAGE_PATH:=%workspace%}
+: ${BAZEL:=bazel}
+_bazel_b() { ${BAZEL} --noblock_for_lock "$@" 2>/dev/null; }
+
+# Default cache lifetime is 1 week
+zstyle -s ":completion:${curcontext}:" cache-lifetime lifetime
+if [[ -z "${lifetime}" ]]; then
+ lifetime=$((60*60*24*7))
+fi
+
+_bazel_cache_policy() {
+ local -a oldp
+ oldp=( "$1"(Nms+${lifetime}) )
+ (( $#oldp ))
+}
+
+_set_cache_policy() {
+ zstyle -s ":completion:*:$curcontext*" cache-policy update_policy
+
+ if [[ -z "$update_policy" ]]; then
+ zstyle ":completion:$curcontext*" cache-policy _bazel_cache_policy
+ fi
+}
+
+# Skips over all global arguments. After invocation, OFFSET contains the
+# position of the bazel command in $words.
+_adapt_subcommand_offset() {
+ OFFSET=2
+ for w in ${words[2,-1]}; do
+ if [[ $w == (#b)-* ]]; then
+ (( OFFSET++ ))
+ else
+ return
+ fi
+ done
+}
+
+# Retrieve the cache but also check that the value is not empty.
+_bazel_safe_retrieve_cache() {
+ _retrieve_cache $1 && [[ ${(P)#2} -gt 0 ]]
+}
+
+# Puts the name of the variable that contains the options for the bazel
+# subcommand handed in as the first argument into the global variable
+# _bazel_cmd_options.
+_bazel_get_options() {
+ local lcmd=$1
+ _bazel_cmd_options=_bazel_${lcmd}_options
+ _bazel_cmd_args=_bazel_${lcmd}_args
+ if [[ ${(P)#_bazel_cmd_options} != 0 ]]; then
+ return
+ fi
+ if _cache_invalid BAZEL_${lcmd}_options || _cache_invalid BAZEL_${lcmd}_args \
+ || ! _bazel_safe_retrieve_cache BAZEL_${lcmd}_options ${_bazel_cmd_options} \
+ || ! _retrieve_cache BAZEL_${lcmd}_args ${_bazel_cmd_args}; then
+ if ! eval "$(_bazel_b help completion)"; then
+ return
+ fi
+ local opts_var
+ if [[ $lcmd == "startup_options" ]]; then
+ opts_var="BAZEL_STARTUP_OPTIONS"
+ else
+ opts_var="BAZEL_COMMAND_${lcmd:u}_FLAGS"
+ fi
+ local -a raw_options
+ if ! eval "raw_options=(\${(@f)$opts_var})"; then
+ return
+ fi
+
+ local -a option_list
+ for opt in $raw_options; do
+ case $opt in
+ --*"={"*)
+ local lst="${${opt##*"={"}%"}"}"
+ local opt="${opt%%=*}="
+ option_list+=("${opt}:string:_values '' ${lst//,/ }") ;;
+ --*=path)
+ option_list+=("${opt%path}:path:_files") ;;
+ --*=label)
+ option_list+=("${opt%label}:target:_bazel_complete_target") ;;
+ --*=*)
+ option_list+=("${opt}:string:") ;;
+ *)
+ option_list+=("$opt") ;;
+ esac
+ done
+
+ local -a cmd_args
+ local cmd_type
+ if eval "cmd_type=\${BAZEL_COMMAND_${lcmd:u}_ARGUMENT}" && [[ -n $cmd_type ]]; then
+ case $cmd_type in
+ label|label-*)
+ cmd_args+=("*::${cmd_type}:_bazel_complete_target_${cmd_type//-/_}") ;;
+ info-key)
+ cmd_args+=('1::key:_bazel_info_key') ;;
+ path)
+ cmd_args+=('1::profile:_path_files') ;;
+ "command|{"*"}")
+ local lst=${${cmd_type#"command|{"}%"}"}
+ cmd_args+=("1::topic:_bazel_help_topic -- ${lst//,/ }") ;;
+ esac
+ fi
+
+ typeset -g "${_bazel_cmd_options}"="${(pj:|:)option_list[*]}"
+ _store_cache BAZEL_${lcmd}_options ${_bazel_cmd_options}
+ typeset -g "${_bazel_cmd_args}"="${(pj:|:)cmd_args[*]}"
+ _store_cache BAZEL_${lcmd}_args ${_bazel_cmd_args}
+ fi
+}
+
+_get_build_targets() {
+ local pkg=$1
+ local rule_re
+ typeset -a completions
+ case $target_type in
+ test)
+ rule_re=".*_test"
+ ;;
+ build)
+ rule_re=".*"
+ ;;
+ bin)
+ rule_re=".*_test|.*_binary"
+ ;;
+ esac
+ completions=(${$(_bazel_b query "kind(\"${rule_re}\", ${pkg}:all)" 2>/dev/null)##*:})
+ if ( (( ${#completions} > 0 )) && [[ $target_type != run ]] ); then
+ completions+=(all)
+ fi
+ echo ${completions[*]}
+}
+
+# Returns all packages that match $PREFIX. PREFIX may start with //, in which
+# case the workspace roots are searched. Otherwise, they are completed based on
+# PWD.
+_get_build_packages() {
+ local workspace pfx
+ typeset -a package_roots paths final_paths
+ workspace=$PWD
+ package_roots=(${(ps.:.)BAZEL_COMPLETION_PACKAGE_PATH})
+ package_roots=(${^package_roots//\%workspace\%/$workspace})
+ if [[ "${(e)PREFIX}" == //* ]]; then
+ pfx=${(e)PREFIX[2,-1]}
+ else
+ pfx=${(e)PREFIX}
+ fi
+ paths=(${^package_roots}/${pfx}*(/))
+ for p in ${paths[*]}; do
+ if [[ -f ${p}/BUILD || -f ${p}/BUILD.bazel ]]; then
+ final_paths+=(${p##*/}:)
+ fi
+ final_paths+=(${p##*/}/)
+ done
+ echo ${final_paths[*]}
+}
+
+_package_remove_slash() {
+ if [[ $KEYS == ':' && $LBUFFER == */ ]]; then
+ LBUFFER=${LBUFFER[1,-2]}
+ fi
+}
+
+# Completion function for BUILD targets, called by the completion system.
+_bazel_complete_target() {
+ local expl
+ typeset -a packages targets
+ if [[ "${(e)PREFIX}" != *:* ]]; then
+ # There is no : in the prefix, completion can be either
+ # a package or a target, if the cwd is a package itself.
+ if [[ -f $PWD/BUILD || -f $PWD/BUILD.bazel ]]; then
+ targets=($(_get_build_targets ""))
+ _description build_target expl "BUILD target"
+ compadd "${expl[@]}" -a targets
+ fi
+ packages=($(_get_build_packages))
+ _description build_package expl "BUILD package"
+ # Chop of the leading path segments from the prefix for display.
+ compset -P '*/'
+ compadd -R _package_remove_slash -S '' "${expl[@]}" -a packages
+ else
+ targets=($(_get_build_targets "${${(e)PREFIX}%:*}"))
+ _description build_target expl "BUILD target"
+ # Ignore the current prefix for the upcoming completion, since we only list
+ # the names of the targets, not the full path.
+ compset -P '*:'
+ compadd "${expl[@]}" -a targets
+ fi
+}
+
+_bazel_complete_target_label() {
+ typeset -g target_type=build
+ _bazel_complete_target
+}
+
+_bazel_complete_target_label_test() {
+ typeset -g target_type=test
+ _bazel_complete_target
+}
+
+_bazel_complete_target_label_bin() {
+ typeset -g target_type=bin
+ _bazel_complete_target
+}
+
+### Actual completion commands
+
+_bazel() {
+ _adapt_subcommand_offset
+ if (( CURRENT - OFFSET > 0 )); then
+ # Remember the subcommand name, stored globally so we can access it
+ # from any subsequent function
+ cmd=${words[OFFSET]//-/_}
+
+ # Set the context for the subcommand.
+ curcontext="${curcontext%:*:*}:bazel-$cmd:"
+ _set_cache_policy
+
+ # Narrow the range of words we are looking at to exclude cmd
+ # name and any leading options
+ (( CURRENT = CURRENT - OFFSET + 1 ))
+ shift $((OFFSET - 1)) words
+ # Run the completion for the subcommand
+ _bazel_get_options $cmd
+ _arguments : \
+ ${(Pps:|:)_bazel_cmd_options} \
+ ${(Pps:|:)_bazel_cmd_args}
+ else
+ _set_cache_policy
+ # Start special handling for global options,
+ # which can be retrieved by calling
+ # $ bazel help startup_options
+ _bazel_get_options startup_options
+ _arguments : \
+ ${(Pps:|:)_bazel_cmd_options} \
+ "*:commands:_bazel_commands"
+ fi
+ return
+}
+
+_get_commands() {
+ # bazel_cmd_list is a global (g) array (a)
+ typeset -ga _bazel_cmd_list
+ # Use `bazel help` instead of `bazel help completion` to get command
+ # descriptions.
+ if _bazel_cmd_list=("${(@f)$(_bazel_b help | awk '
+/Available commands/ { command=1; }
+/ [-a-z]+[ \t]+.+/ { if (command) { printf "%s:", $1; for (i=2; i<=NF; i++) printf "%s ", $i; print "" } }
+/^$/ { command=0; }')}"); then
+ _store_cache BAZEL_commands _bazel_cmd_list
+ fi
+}
+
+# Completion function for bazel subcommands, called by the completion system.
+_bazel_commands() {
+ if [[ ${#_bazel_cmd_list} == 0 ]]; then
+ if _cache_invalid BAZEL_commands \
+ || ! _bazel_safe_retrieve_cache BAZEL_commands _bazel_cmd_list; then
+ _get_commands
+ fi
+ fi
+
+ _describe -t bazel-commands 'Bazel command' _bazel_cmd_list
+}
+
+# Completion function for bazel help options, called by the completion system.
+_bazel_help_topic() {
+ if [[ ${#_bazel_cmd_list} == 0 ]]; then
+ if _cache_invalid BAZEL_commands \
+ || ! _bazel_safe_retrieve_cache BAZEL_commands _bazel_cmd_list; then
+ _get_commands
+ fi
+ fi
+
+ while [[ $# -gt 0 ]]; do
+ if [[ $1 == -- ]]; then
+ shift
+ break
+ fi
+ shift
+ done
+ _bazel_help_list=($@)
+ _bazel_help_list+=($_bazel_cmd_list)
+ _describe -t bazel-help 'Help topic' _bazel_help_list
+}
+
+# Completion function for bazel info keys, called by the completion system.
+_bazel_info_key() {
+ if [[ ${#_bazel_info_keys_list} == 0 ]]; then
+ if _cache_invalid BAZEL_info_keys \
+ || ! _bazel_safe_retrieve_cache BAZEL_info_keys _bazel_info_keys_list; then
+ typeset -ga _bazel_info_keys_list
+ # Use `bazel help` instead of `bazel help completion` to get info-key
+ # descriptions.
+ if _bazel_info_keys_list=("${(@f)$(_bazel_b help info-keys | awk '
+ { printf "%s:", $1; for (i=2; i<=NF; i++) printf "%s ", $i; print "" }')}"); then
+ _store_cache BAZEL_info_keys _bazel_info_keys_list
+ fi
+ fi
+ fi
+ _describe -t bazel-info 'Key' _bazel_info_keys_list
+}
diff --git a/zsh/plugins/bgnotify/bgnotify.plugin.zsh b/zsh/plugins/bgnotify/bgnotify.plugin.zsh
index b3a6890..aecde20 100644
--- a/zsh/plugins/bgnotify/bgnotify.plugin.zsh
+++ b/zsh/plugins/bgnotify/bgnotify.plugin.zsh
@@ -53,7 +53,7 @@ bgnotify () { ## args: (title, subtitle)
bgnotify_begin() {
bgnotify_timestamp=$EPOCHSECONDS
- bgnotify_lastcmd="$1"
+ bgnotify_lastcmd="${1:-$2}"
bgnotify_windowid=$(currentWindowId)
}
diff --git a/zsh/plugins/bower/README.md b/zsh/plugins/bower/README.md
index 743b6a0..8877fbd 100644
--- a/zsh/plugins/bower/README.md
+++ b/zsh/plugins/bower/README.md
@@ -4,7 +4,7 @@ This plugin adds completion for [Bower](https://bower.io/) and a few useful alia
To use it, add `bower` to the plugins array in your zshrc file:
-```
+```zsh
plugins=(... bower)
```
@@ -15,4 +15,3 @@ plugins=(... bower)
| bi | `bower install` | Installs the project dependencies listed in bower.json |
| bl | `bower list` | List local packages and possible updates |
| bs | `bower search` | Finds all packages or a specific package. |
-
diff --git a/zsh/plugins/brew/README.md b/zsh/plugins/brew/README.md
index c129a76..b714b7a 100644
--- a/zsh/plugins/brew/README.md
+++ b/zsh/plugins/brew/README.md
@@ -3,19 +3,28 @@
The plugin adds several aliases for common [brew](https://brew.sh) commands.
To use it, add `brew` to the plugins array of your zshrc file:
-```
+
+```zsh
plugins=(... brew)
```
## Aliases
-| Alias | Command | Description |
-|--------|----------------------|---------------|
-| brewp | `brew pin` | Pin a specified formulae, preventing them from being upgraded when issuing the brew upgrade command. |
-| brews | `brew list -1` | List installed formulae, one entry per line, or the installed files for a given formulae. |
-| brewsp | `brew list --pinned` | Show the versions of pinned formulae, or only the specified (pinned) formulae if formulae are given. |
-| bubo | `brew update && brew outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated formulae. |
-| bubc | `brew upgrade && brew cleanup` | Upgrade outdated, unpinned brews (with existing install options), then removes stale lock files and outdated downloads for formulae and casks, and removes old versions of installed formulae. |
-| bubu | `bubo && bubc` | Updates Homebrew, lists outdated formulae, upgrades oudated and unpinned formulae, and removes stale and outdated downloads and versions. |
-| bcubo | `brew update && brew cask outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated casks. |
-| bcubc | `brew cask reinstall $(brew cask outdated) && brew cleanup` | Updates outdated casks, then runs cleanup. |
\ No newline at end of file
+| Alias | Command | Description |
+|----------|------------------------------------------------------------- |---------------------------------------------------------------------|
+| `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. |
+| `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. |
+| `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. |
+| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. |
+| `bubc` | `brew upgrade && brew cleanup` | Upgrade outdated formulae and casks, then run cleanup. |
+| `bubu` | `bubo && bubc` | Do the last two operations above. |
+| `buf` | `brew upgrade --formula` | Upgrade only formulas (not casks). |
+| `bcubo` | `brew update && brew outdated --cask` | Update Homebrew data, then list outdated casks. |
+| `bcubc` | `brew cask reinstall $(brew outdated --cask) && brew cleanup` | Update outdated casks, then run cleanup. |
+
+## Completion
+
+With the release of Homebrew 1.0, they 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.
diff --git a/zsh/plugins/brew/brew.plugin.zsh b/zsh/plugins/brew/brew.plugin.zsh
index cfbaa34..30eb135 100644
--- a/zsh/plugins/brew/brew.plugin.zsh
+++ b/zsh/plugins/brew/brew.plugin.zsh
@@ -4,21 +4,6 @@ alias brewsp='brew list --pinned'
alias bubo='brew update && brew outdated'
alias bubc='brew upgrade && brew cleanup'
alias bubu='bubo && bubc'
-alias bcubo='brew update && brew cask outdated'
-alias bcubc='brew cask reinstall $(brew cask outdated) && brew cleanup'
-
-if command mkdir "$ZSH_CACHE_DIR/.brew-completion-message" 2>/dev/null; then
- print -P '%F{yellow}'Oh My Zsh brew plugin:
- 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
+alias buf='brew upgrade --formula'
+alias bcubo='brew update && brew outdated --cask'
+alias bcubc='brew cask reinstall $(brew outdated --cask) && brew cleanup'
diff --git a/zsh/plugins/bundler/README.md b/zsh/plugins/bundler/README.md
index dc2f170..7b79cbc 100644
--- a/zsh/plugins/bundler/README.md
+++ b/zsh/plugins/bundler/README.md
@@ -1,52 +1,74 @@
# Bundler
-- adds completion for basic bundler commands
-- adds short aliases for common bundler commands
- - `be` aliased to `bundle exec`.
- It also supports aliases (if `rs` is `rails server`, `be rs` will bundle-exec `rails server`).
- - `bl` aliased to `bundle list`
- - `bp` aliased to `bundle package`
- - `bo` aliased to `bundle open`
- - `bout` aliased to `bundle outdated`
- - `bu` aliased to `bundle update`
- - `bi` aliased to `bundle install --jobs=` (only for bundler `>= 1.4.0`)
-- adds a wrapper for common gems:
- - looks for a binstub under `./bin/` and executes it (if present)
- - calls `bundle exec ` otherwise
+This plugin adds completion for basic bundler commands, as well as aliases and helper functions for
+an easier experience with bundler.
+
+To use it, add `bundler` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... bundler)
+```
+
+## Aliases
+
+| Alias | Command | Description |
+|--------|--------------------------------------|------------------------------------------------------------------------------------------|
+| `ba` | `bundle add` | Add gem to the Gemfile and run bundle install |
+| `bck` | `bundle check` | Verifies if dependencies are satisfied by installed gems |
+| `bcn` | `bundle clean` | Cleans up unused gems in your bundler directory |
+| `be` | `bundle exec` | Execute a command in the context of the bundle |
+| `bi` | `bundle install --jobs=` | Install the dependencies specified in your Gemfile (using all cores in bundler >= 1.4.0) |
+| `bl` | `bundle list` | List all the gems in the bundle |
+| `bo` | `bundle open` | Opens the source directory for a gem in your bundle |
+| `bout` | `bundle outdated` | List installed gems with newer versions available |
+| `bp` | `bundle package` | Package your needed .gem files into your application |
+| `bu` | `bundle update` | Update your gems to the latest available versions |
+
+## Gem wrapper
+
+The plugin adds a wrapper for common gems, which:
+
+- Looks for a binstub under `./bin/` and executes it if present.
+- Calls `bundle exec ` otherwise.
Common gems wrapped by default (by name of the executable):
-`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`.
-## Configuration
+`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `rubocop`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`.
-Please use the exact name of the executable and not the gem name.
+### Settings
-### Add additional gems to be wrapped
+You can add or remove gems from the list of wrapped commands.
+Please **use the exact name of the executable** and not the gem name.
+
+#### Include gems to be wrapped (`BUNDLED_COMMANDS`)
+
+Add this before the plugin list in your `.zshrc`:
-Add this before the plugin-list in your `.zshrc`:
```sh
BUNDLED_COMMANDS=(rubocop)
plugins=(... bundler ...)
```
+
This will add the wrapper for the `rubocop` gem (i.e. the executable).
+#### Exclude gems from being wrapped (`UNBUNDLED_COMMANDS`)
-### Exclude gems from being wrapped
+Add this before the plugin list in your `.zshrc`:
-Add this before the plugin-list in your `.zshrc`:
```sh
UNBUNDLED_COMMANDS=(foreman spin)
plugins=(... bundler ...)
```
+
This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped.
-## Excluded gems
+### Excluded gems
-These gems should not be called with `bundle exec`. Please see [issue #2923](https://github.com/robbyrussell/oh-my-zsh/pull/2923) on GitHub for clarification.
+These gems should not be called with `bundle exec`. Please see [issue #2923](https://github.com/ohmyzsh/ohmyzsh/pull/2923) on GitHub for clarification:
-`berks`
-`foreman`
-`mailcatcher`
-`rails`
-`ruby`
-`spin`
+- `berks`
+- `foreman`
+- `mailcatcher`
+- `rails`
+- `ruby`
+- `spin`
diff --git a/zsh/plugins/bundler/bundler.plugin.zsh b/zsh/plugins/bundler/bundler.plugin.zsh
index 668e15d..6293dc2 100644
--- a/zsh/plugins/bundler/bundler.plugin.zsh
+++ b/zsh/plugins/bundler/bundler.plugin.zsh
@@ -1,11 +1,49 @@
+## Aliases
+
+alias ba="bundle add"
+alias bck="bundle check"
+alias bcn="bundle clean"
alias be="bundle exec"
+alias bi="bundle_install"
alias bl="bundle list"
-alias bp="bundle package"
alias bo="bundle open"
alias bout="bundle outdated"
+alias bp="bundle package"
alias bu="bundle update"
-alias bi="bundle_install"
-alias bcn="bundle clean"
+
+## Functions
+
+bundle_install() {
+ # Bail out if bundler is not installed
+ if (( ! $+commands[bundle] )); then
+ echo "Bundler is not installed"
+ return 1
+ fi
+
+ # Bail out if not in a bundled project
+ if ! _within-bundled-project; then
+ echo "Can't 'bundle install' outside a bundled project"
+ return 1
+ fi
+
+ # Check the bundler version is at least 1.4.0
+ autoload -Uz is-at-least
+ local bundler_version=$(bundle version | cut -d' ' -f3)
+ if ! is-at-least 1.4.0 "$bundler_version"; then
+ bundle install "$@"
+ return $?
+ fi
+
+ # If bundler is at least 1.4.0, use all the CPU cores to bundle install
+ if [[ "$OSTYPE" = (darwin|freebsd)* ]]; then
+ local cores_num="$(sysctl -n hw.ncpu)"
+ else
+ local cores_num="$(nproc)"
+ fi
+ bundle install --jobs="$cores_num" "$@"
+}
+
+## Gem wrapper
bundled_commands=(
annotate
@@ -27,6 +65,7 @@ bundled_commands=(
rainbows
rake
rspec
+ rubocop
shotgun
sidekiq
spec
@@ -51,65 +90,41 @@ for cmd in $BUNDLED_COMMANDS; do
bundled_commands+=($cmd);
done
-## Functions
-
-bundle_install() {
- if ! _bundler-installed; then
- echo "Bundler is not installed"
- elif ! _within-bundled-project; then
- echo "Can't 'bundle install' outside a bundled project"
- else
- local bundler_version=`bundle version | cut -d' ' -f3`
- if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
- if [[ "$OSTYPE" = (darwin|freebsd)* ]]
- then
- local cores_num="$(sysctl -n hw.ncpu)"
- else
- local cores_num="$(nproc)"
- fi
- bundle install --jobs=$cores_num $@
- else
- bundle install $@
- fi
- fi
-}
-
-_bundler-installed() {
- which bundle > /dev/null 2>&1
-}
-
+# Check if in the root or a subdirectory of a bundled project
_within-bundled-project() {
local check_dir="$PWD"
- while [ "$check_dir" != "/" ]; do
- [ -f "$check_dir/Gemfile" ] && return
- check_dir="$(dirname $check_dir)"
+ while [[ "$check_dir" != "/" ]]; do
+ if [[ -f "$check_dir/Gemfile" || -f "$check_dir/gems.rb" ]]; then
+ return 0
+ fi
+ check_dir="${check_dir:h}"
done
- false
-}
-
-_binstubbed() {
- [ -f "./bin/${1}" ]
+ return 1
}
_run-with-bundler() {
- if _bundler-installed && _within-bundled-project; then
- if _binstubbed $1; then
- ./bin/$@
- else
- bundle exec $@
- fi
+ if (( ! $+commands[bundle] )) || ! _within-bundled-project; then
+ "$@"
+ return $?
+ fi
+
+ if [[ -f "./bin/${1}" ]]; then
+ ./bin/${^^@}
else
- $@
+ bundle exec "$@"
fi
}
-## Main program
for cmd in $bundled_commands; do
- eval "function unbundled_$cmd () { $cmd \$@ }"
- eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}"
- alias $cmd=bundled_$cmd
+ # Create wrappers for bundled and unbundled execution
+ eval "function unbundled_$cmd () { \"$cmd\" \"\$@\"; }"
+ eval "function bundled_$cmd () { _run-with-bundler \"$cmd\" \"\$@\"; }"
+ alias "$cmd"="bundled_$cmd"
- if which _$cmd > /dev/null 2>&1; then
- compdef _$cmd bundled_$cmd=$cmd
+ # Bind completion function to wrapped gem if available
+ if (( $+functions[_$cmd] )); then
+ compdef "_$cmd" "bundled_$cmd"="$cmd"
fi
done
+
+unset cmd bundled_commands
diff --git a/zsh/plugins/cake/README.md b/zsh/plugins/cake/README.md
index aad92a3..2c2a280 100644
--- a/zsh/plugins/cake/README.md
+++ b/zsh/plugins/cake/README.md
@@ -10,6 +10,6 @@ plugins=(... cake)
## Note
-This plugin generates a cache file of the cake tasks found, named `.cake_task_cache`, in the current working directory.
+This plugin generates a cache file of the cake tasks found, named `.cake_task_cache`, in the current working directory.
It is regenerated when the Cakefile is newer than the cache file. It is advised that you add the cake file to your
`.gitignore` files.
diff --git a/zsh/plugins/cakephp3/README.md b/zsh/plugins/cakephp3/README.md
new file mode 100644
index 0000000..7e8f664
--- /dev/null
+++ b/zsh/plugins/cakephp3/README.md
@@ -0,0 +1,16 @@
+# cakephp3 plugin
+
+The plugin adds aliases and autocompletion for [cakephp3](https://book.cakephp.org/3.0/en/index.html).
+
+To use it, add `cakephp3` to the plugins array of your zshrc file:
+```
+plugins=(... cakephp3)
+```
+
+## Aliases
+
+| Alias | Command |
+|-----------|-------------------------------|
+| c3 | `bin/cake` |
+| c3cache | `bin/cake orm_cache clear` |
+| c3migrate | `bin/cake migrations migrate` |
diff --git a/zsh/plugins/cargo/_cargo b/zsh/plugins/cargo/_cargo
index 395c517..1269490 100644
--- a/zsh/plugins/cargo/_cargo
+++ b/zsh/plugins/cargo/_cargo
@@ -2,489 +2,367 @@
autoload -U regexp-replace
-zstyle -T ':completion:*:*:cargo:*' tag-order && \
- zstyle ':completion:*:*:cargo:*' tag-order 'common-commands'
-
_cargo() {
-local context state state_descr line
-typeset -A opt_args
+ local curcontext="$curcontext" ret=1
+ local -a command_scope_spec common parallel features msgfmt triple target registry
+ local -a state line state_descr # These are set by _arguments
+ typeset -A opt_args
-# leading items in parentheses are an exclusion list for the arguments following that arg
-# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions
-# - => exclude all other options
-# 1 => exclude positional arg 1
-# * => exclude all other args
-# +blah => exclude +blah
-_arguments \
- '(- 1 *)'{-h,--help}'[show help message]' \
- '(- 1 *)--list[list installed commands]' \
- '(- 1 *)'{-V,--version}'[show version information]' \
- {-v,--verbose}'[use verbose output]' \
- --color'[colorization option]' \
- '(+beta +nightly)+stable[use the stable toolchain]' \
- '(+stable +nightly)+beta[use the beta toolchain]' \
- '(+stable +beta)+nightly[use the nightly toolchain]' \
- '1: :->command' \
- '*:: :->args'
+ common=(
+ '(-q --quiet)*'{-v,--verbose}'[use verbose output]'
+ '(-q --quiet -v --verbose)'{-q,--quiet}'[no output printed to stdout]'
+ '-Z+[pass unstable (nightly-only) flags to cargo]: :_cargo_unstable_flags'
+ '--frozen[require that Cargo.lock and cache are up-to-date]'
+ '--locked[require that Cargo.lock is up-to-date]'
+ '--color=[specify colorization option]:coloring:(auto always never)'
+ '(- 1 *)'{-h,--help}'[show help message]'
+ )
-case $state in
- command)
- _alternative 'common-commands:common:_cargo_cmds' 'all-commands:all:_cargo_all_cmds'
- ;;
+ # leading items in parentheses are an exclusion list for the arguments following that arg
+ # See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions
+ # - => exclude all other options
+ # 1 => exclude positional arg 1
+ # * => exclude all other args
+ # +blah => exclude +blah
+ _arguments -s -S -C $common \
+ '(- 1 *)--list[list installed commands]' \
+ '(- 1 *)--explain=[provide a detailed explanation of an error message]:error code' \
+ '(- 1 *)'{-V,--version}'[show version information]' \
+ '(+beta +nightly)+stable[use the stable toolchain]' \
+ '(+stable +nightly)+beta[use the beta toolchain]' \
+ '(+stable +beta)+nightly[use the nightly toolchain]' \
+ '1: :_cargo_cmds' \
+ '*:: :->args'
- 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)' \
- ;;
+ # These flags are mutually exclusive specifiers for the scope of a command; as
+ # they are used in multiple places without change, they are expanded into the
+ # appropriate command's `_arguments` where appropriate.
+ command_scope_spec=(
+ '(--bin --example --test --lib)--bench=[specify benchmark name]: :_cargo_benchmark_names'
+ '(--bench --bin --test --lib)--example=[specify example name]:example name'
+ '(--bench --example --test --lib)--bin=[specify binary name]:binary name'
+ '(--bench --bin --example --test)--lib=[specify library name]:library name'
+ '(--bench --bin --example --lib)--test=[specify test name]:test name'
+ )
- 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)' \
- ;;
+ parallel=(
+ '(-j --jobs)'{-j+,--jobs=}'[specify number of parallel jobs]:jobs [# of CPUs]'
+ )
- check)
- _arguments \
- '--features=[space separated feature list]' \
- '--all-features[enable all available features]' \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
- "${command_scope_spec[@]}" \
- '--manifest-path=[path to manifest]: :_files -/' \
- '--no-default-features[do not check the default features]' \
- '(-p,--package)'{-p=,--package=}'[package to check]:packages:_get_package_names' \
- '--release=[check in release mode]' \
- '--target=[target triple]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '--color=:colorization option:(auto always never)' \
- ;;
+ features=(
+ '(--all-features)--features=[specify features to activate]:feature'
+ '(--features)--all-features[activate all available features]'
+ "--no-default-features[don't build the default features]"
+ )
- 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)' \
- ;;
+ msgfmt='--message-format=[specify error format]:error format [human]:(human json short)'
+ triple='--target=[specify target triple]:target triple'
+ target='--target-dir=[specify directory for all generated artifacts]:directory:_directories'
+ manifest='--manifest-path=[specify path to manifest]:path:_directories'
+ registry='--registry=[specify registry to use]:registry'
- 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)' \
- ;;
+ case $state in
+ args)
+ curcontext="${curcontext%:*}-${words[1]}:"
+ case ${words[1]} in
+ bench)
+ _arguments -s -A "^--" $common $parallel $features $msgfmt $triple $target $manifest \
+ "${command_scope_spec[@]}" \
+ '--all-targets[benchmark all targets]' \
+ "--no-run[compile but don't run]" \
+ '(-p --package)'{-p+,--package=}'[specify package to run benchmarks for]:package:_cargo_package_names' \
+ '--exclude=[exclude packages from the benchmark]:spec' \
+ '--no-fail-fast[run all benchmarks regardless of failure]' \
+ '1: :_guard "^-*" "bench name"' \
+ '*:args:_default'
+ ;;
- 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)' \
- ;;
+ build)
+ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
+ '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \
+ "${command_scope_spec[@]}" \
+ '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \
+ '--release[build in release mode]' \
+ '--build-plan[output the build plan in JSON]' \
+ ;;
- 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)' \
- ;;
+ check)
+ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
+ '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \
+ "${command_scope_spec[@]}" \
+ '(-p --package)'{-p+,--package=}'[specify package to check]:package:_cargo_package_names' \
+ '--release[check in release mode]' \
+ ;;
- git-checkout)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-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)' \
- ;;
+ clean)
+ _arguments -s -S $common $triple $target $manifest \
+ '(-p --package)'{-p+,--package=}'[specify package to clean]:package:_cargo_package_names' \
+ '--release[clean release artifacts]' \
+ '--doc[clean just the documentation directory]'
+ ;;
- help)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '*: :_cargo_cmds' \
- ;;
+ doc)
+ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
+ '--no-deps[do not build docs for dependencies]' \
+ '--document-private-items[include non-public items in the documentation]' \
+ '--open[open docs in browser after the build]' \
+ '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \
+ '--release[build artifacts in release mode, with optimizations]' \
+ ;;
- 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)' \
- ;;
+ fetch)
+ _arguments -s -S $common $triple $manifest
+ ;;
- 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]: :_files -/' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '--rev=[specific commit to use when installing from git]' \
- '--root=[directory to install packages into]: :_files -/' \
- '--tag=[tag to use when installing from git]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--vers=[version to install from crates.io]' \
- ;;
+ fix)
+ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
+ "${command_scope_spec[@]}" \
+ '--broken-code[fix code even if it already has compiler errors]' \
+ '--edition[fix in preparation for the next edition]' \
+ '--edition-idioms[fix warnings to migrate to the idioms of an edition]' \
+ '--allow-no-vcs[fix code even if a VCS was not detected]' \
+ '--allow-dirty[fix code even if the working directory is dirty]' \
+ '--allow-staged[fix code even if the working directory has staged changes]'
+ ;;
- locate-project)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '--manifest-path=[path to manifest]: :_files -/' \
- ;;
+ generate-lockfile)
+ _arguments -s -S $common $manifest
+ ;;
- 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)' \
- ;;
+ git-checkout)
+ _arguments -s -S $common \
+ '--reference=:reference' \
+ '--url=:url:_urls'
+ ;;
- 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)' \
- ;;
+ help)
+ _cargo_cmds
+ ;;
- 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)' \
- ;;
+ init)
+ _arguments -s -S $common $registry \
+ '--lib[use library template]' \
+ '--edition=[specify edition to set for the crate generated]:edition:(2015 2018)' \
+ '--vcs=[initialize a new repo with a given VCS]:vcs:(git hg pijul fossil none)' \
+ '--name=[set the resulting package name]:name' \
+ '1:path:_directories'
+ ;;
- 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)' \
- ;;
+ install)
+ _arguments -s -S $common $parallel $features $triple $registry \
+ '(-f --force)'{-f,--force}'[force overwriting of existing crates or binaries]' \
+ '--bin=[only install the specified binary]:binary' \
+ '--branch=[branch to use when installing from git]:branch' \
+ '--debug[build in debug mode instead of release mode]' \
+ '--example=[install the specified example instead of binaries]:example' \
+ '--git=[specify URL from which to install the crate]:url:_urls' \
+ '--path=[local filesystem path to crate to install]: :_directories' \
+ '--rev=[specific commit to use when installing from git]:commit' \
+ '--root=[directory to install packages into]: :_directories' \
+ '--tag=[tag to use when installing from git]:tag' \
+ '--vers=[version to install from crates.io]:version' \
+ '--list[list all installed packages and their versions]' \
+ '*: :_guard "^-*" "crate"'
+ ;;
- 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)' \
- ;;
+ locate-project)
+ _arguments -s -S $common $manifest
+ ;;
- 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)' \
- ;;
+ login)
+ _arguments -s -S $common $registry \
+ '*: :_guard "^-*" "token"'
+ ;;
- 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)' \
- ;;
+ metadata)
+ _arguments -s -S $common $features $manifest \
+ "--no-deps[output information only about the root package and don't fetch dependencies]" \
+ '--format-version=[specify format version]:version [1]:(1)'
+ ;;
- 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)' \
- ;;
+ new)
+ _arguments -s -S $common $registry \
+ '--lib[use library template]' \
+ '--vcs:initialize a new repo with a given VCS:(git hg none)' \
+ '--name=[set the resulting package name]'
+ ;;
- 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' \
- ;;
+ owner)
+ _arguments -s -S $common $registry \
+ '(-a --add)'{-a,--add}'[specify name of a user or team to invite as an owner]:name' \
+ '--index=[specify registry index]:index' \
+ '(-l --list)'{-l,--list}'[list owners of a crate]' \
+ '(-r --remove)'{-r,--remove}'[specify name of a user or team to remove as an owner]:name' \
+ '--token=[specify API token to use when authenticating]:token' \
+ '*: :_guard "^-*" "crate"'
+ ;;
- 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]: :_files -/' \
- '--no-default-features[do not compile default features for the package]' \
- '(-p, --package)'{-p,--package}'=[profile to compile for]' \
- '--profile=[profile to build the selected target for]' \
- '(-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[@]}" \
- ;;
+ package)
+ _arguments -s -S $common $parallel $features $triple $target $manifest \
+ '(-l --list)'{-l,--list}'[print files included in a package without making one]' \
+ '--no-metadata[ignore warnings about a lack of human-usable metadata]' \
+ '--allow-dirty[allow dirty working directories to be packaged]' \
+ "--no-verify[don't build to verify contents]"
+ ;;
- 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]: :_files -/' \
- '--no-default-features[do not build the `default` feature]' \
- '--open[open the docs in a browser after the operation]' \
- '(-p, --package)'{-p,--package}'=[package to document]' \
- '(-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[@]}" \
- ;;
+ pkgid)
+ _arguments -s -S $common $manifest \
+ '(-p --package)'{-p+,--package=}'[specify package to get ID specifier for]:package:_cargo_package_names' \
+ '*: :_guard "^-*" "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]' \
- ;;
+ publish)
+ _arguments -s -S $common $parallel $features $triple $target $manifest $registry \
+ '--index=[specify registry index]:index' \
+ '--allow-dirty[allow dirty working directories to be packaged]' \
+ "--no-verify[don't verify the contents by building them]" \
+ '--token=[specify token to use when uploading]:token' \
+ '--dry-run[perform all checks without uploading]'
+ ;;
- 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' \
- '(--doc --bin --example --test --bench)--lib[only test library]' \
- '(--lib --bin --example --test --bench)--doc[only test documentation]' \
- '(--lib --doc --example --test --bench)--bin=[binary name]' \
- '(--lib --doc --bin --test --bench)--example=[example name]' \
- '(--lib --doc --bin --example --bench)--test=[test name]' \
- '(--lib --doc --bin --example --test)--bench=[benchmark name]' \
- '--message-format:error format:(human json short)' \
- '--frozen[require lock and cache up to date]' \
- '--locked[require lock up to date]'
- ;;
+ read-manifest)
+ _arguments -s -S $common $manifest
+ ;;
- 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]: :_files -/' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- ;;
+ run)
+ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
+ '--example=[name of the bin target]:name' \
+ '--bin=[name of the bin target]:name' \
+ '(-p --package)'{-p+,--package=}'[specify package with the target to run]:package:_cargo_package_names' \
+ '--release[build in release mode]' \
+ '*: :_default'
+ ;;
- 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)' \
- ;;
+ rustc)
+ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
+ '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \
+ '--profile=[specify profile to build the selected target for]:profile' \
+ '--release[build artifacts in release mode, with optimizations]' \
+ "${command_scope_spec[@]}" \
+ '*: : _dispatch rustc rustc -default-'
+ ;;
- 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)' \
- ;;
+ rustdoc)
+ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
+ '--document-private-items[include non-public items in the documentation]' \
+ '--open[open the docs in a browser after the operation]' \
+ '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \
+ '--release[build artifacts in release mode, with optimizations]' \
+ "${command_scope_spec[@]}" \
+ '*: : _dispatch rustdoc rustdoc -default-'
+ ;;
- version)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
+ search)
+ _arguments -s -S $common $registry \
+ '--index=[specify registry index]:index' \
+ '--limit=[limit the number of results]:results [10]' \
+ '*: :_guard "^-*" "query"'
+ ;;
- 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
+ test)
+ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
+ '--test=[test name]: :_cargo_test_names' \
+ '--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]:package:_cargo_package_names' \
+ '--all[test all packages in the workspace]' \
+ '--release[build artifacts in release mode, with optimizations]' \
+ '1: :_cargo_test_names' \
+ '(--doc --bin --example --test --bench)--lib[only test library]' \
+ '(--lib --bin --example --test --bench)--doc[only test documentation]' \
+ '(--lib --doc --example --test --bench)--bin=[binary name]' \
+ '(--lib --doc --bin --test --bench)--example=[example name]' \
+ '(--lib --doc --bin --example --bench)--test=[test name]' \
+ '(--lib --doc --bin --example --test)--bench=[benchmark name]' \
+ '*: :_default'
+ ;;
+
+ uninstall)
+ _arguments -s -S $common \
+ '(-p --package)'{-p+,--package=}'[specify package to uninstall]:package:_cargo_package_names' \
+ '--bin=[only uninstall the specified binary]:name' \
+ '--root=[directory to uninstall packages from]: :_files -/' \
+ '*:crate:_cargo_installed_crates -F line'
+ ;;
+
+ update)
+ _arguments -s -S $common $manifest \
+ '--aggressive=[force dependency update]' \
+ "--dry-run[don't actually write the lockfile]" \
+ '(-p --package)'{-p+,--package=}'[specify package to update]:package:_cargo_package_names' \
+ '--precise=[update single dependency to precise release]:release'
+ ;;
+
+ verify-project)
+ _arguments -s -S $common $manifest
+ ;;
+
+ version)
+ _arguments -s -S $common
+ ;;
+
+ yank)
+ _arguments -s -S $common $registry \
+ '--vers=[specify yank version]:version' \
+ '--undo[undo a yank, putting a version back into the index]' \
+ '--index=[specify registry index to yank from]:registry index' \
+ '--token=[specify API token to use when authenticating]:token' \
+ '*: :_guard "^-*" "crate"'
+ ;;
+ *)
+ # allow plugins to define their own functions
+ if ! _call_function ret _cargo-${words[1]}; then
+ # fallback on default completion for unknown commands
+ _default && ret=0
+ fi
+ (( ! ret ))
+ ;;
+ esac
+ ;;
+ esac
}
-_cargo_cmds(){
-local -a commands;commands=(
-'bench:execute all benchmarks of a local package'
-'build:compile the current package'
-'check:check the current package without compiling'
-'clean:remove generated artifacts'
-'doc:build package documentation'
-'fetch:fetch package dependencies'
-'generate-lockfile:create lockfile'
-'git-checkout:git checkout'
-'help:get help for commands'
-'init:create new package in current directory'
-'install:install a Rust binary'
-'locate-project:print "Cargo.toml" location'
-'login:login to remote server'
-'metadata:the metadata for a package in json'
-'new:create a new package'
-'owner:manage the owners of a crate on the registry'
-'package:assemble local package into a distributable tarball'
-'pkgid:print a fully qualified package specification'
-'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 -t common-commands 'common commands' commands
+_cargo_unstable_flags() {
+ local flags
+ flags=( help ${${${(M)${(f)"$(_call_program flags cargo -Z help)"}:#*--*}/ #-- #/:}##*-Z } )
+ _describe -t flags 'unstable flag' flags
}
-_cargo_all_cmds(){
-local -a commands;commands=($(cargo --list))
-_describe -t all-commands 'all commands' commands
+_cargo_installed_crates() {
+ local expl
+ _description crates expl 'crate'
+ compadd "$@" "$expl[@]" - ${${${(f)"$(cargo install --list)"}:# *}%% *}
+}
+
+_cargo_cmds() {
+ local -a commands
+ # This uses Parameter Expansion Flags, which are a built-in Zsh feature.
+ # See more: http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags
+ # and http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion
+ #
+ # # How this work?
+ #
+ # First it splits the result of `cargo --list` at newline, then it removes the first line.
+ # Then it removes indentation (4 whitespaces) before each items. (Note the x## pattern [1]).
+ # Then it replaces those spaces between item and description with a `:`
+ #
+ # [1]: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org#patterns
+ commands=( ${${${(M)"${(f)$(_call_program commands cargo --list)}":# *}/ ##/}/ ##/:} )
+ _describe -t commands '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
+_cargo_package_names() {
+ _message -e packages package
}
# 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)
+_cargo_names_from_array() {
+ # strip json from the path
+ local manifest=${${${"$(cargo locate-project)"}%\"\}}##*\"}
if [[ -z $manifest ]]; then
return 0
fi
@@ -494,51 +372,36 @@ _get_names_from_array()
local in_block=false
local block_name=$1
names=()
- while read line
- do
+ while read -r line; do
if [[ $last_line == "[[$block_name]]" ]]; then
in_block=true
else
- if [[ $last_line =~ '.*\[\[.*' ]]; then
+ if [[ $last_line =~ '\s*\[\[.*' ]]; then
in_block=false
fi
fi
if [[ $in_block == true ]]; then
- if [[ $line =~ '.*name.*=' ]]; then
- regexp-replace line '^.*name *= *|"' ""
- names+=$line
+ if [[ $line =~ '\s*name\s*=' ]]; then
+ regexp-replace line '^\s*name\s*=\s*|"' ''
+ names+=( "$line" )
fi
fi
last_line=$line
- done < $manifest
- _describe $block_name names
+ done < "$manifest"
+ _describe "$block_name" names
}
#Gets the test names from the manifest file
-_test_names()
-{
- _get_names_from_array "test"
+_cargo_test_names() {
+ _cargo_names_from_array "test"
}
#Gets the bench names from the manifest file
-_benchmark_names()
-{
- _get_names_from_array "bench"
+_cargo_benchmark_names() {
+ _cargo_names_from_array "bench"
}
-# These flags are mutually exclusive specifiers for the scope of a command; as
-# they are used in multiple places without change, they are expanded into the
-# appropriate command's `_arguments` where appropriate.
-set command_scope_spec
-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
diff --git a/zsh/plugins/catimg/README.md b/zsh/plugins/catimg/README.md
index 2fc28a1..8f26880 100644
--- a/zsh/plugins/catimg/README.md
+++ b/zsh/plugins/catimg/README.md
@@ -2,28 +2,16 @@
Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
+To use it, add `catimg` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... catimg)
+```
+
## Requirements
- `convert` (ImageMagick)
-## Enabling the plugin
-
-1. Open your `.zshrc` file and add `catimg` in the plugins section:
-
- ```zsh
- plugins=(
- # all your enabled plugins
- catimg
- )
- ```
-
-2. Reload the source file or restart your Terminal session:
-
- ```console
- $ source ~/.zshrc
- $
- ```
-
## Functions
| Function | Description |
diff --git a/zsh/plugins/chruby/README.md b/zsh/plugins/chruby/README.md
new file mode 100644
index 0000000..d373006
--- /dev/null
+++ b/zsh/plugins/chruby/README.md
@@ -0,0 +1,20 @@
+# chruby plugin
+
+This plugin loads [chruby](https://github.com/postmodern/chruby), a tool that changes the
+current Ruby version, and completion and a prompt function to display the Ruby version.
+Supports brew and manual installation of chruby.
+
+To use it, add `chruby` to the plugins array in your zshrc file:
+```zsh
+plugins=(... chruby)
+```
+
+## Usage
+
+If you'd prefer to specify an explicit path to load chruby from
+you can set variables like so:
+
+```
+zstyle :omz:plugins:chruby path /local/path/to/chruby.sh
+zstyle :omz:plugins:chruby auto /local/path/to/auto.sh
+```
diff --git a/zsh/plugins/chucknorris/README.md b/zsh/plugins/chucknorris/README.md
index be7b97e..35f9891 100644
--- a/zsh/plugins/chucknorris/README.md
+++ b/zsh/plugins/chucknorris/README.md
@@ -1,6 +1,6 @@
# chucknorris
-Chuck Norris fortunes plugin for oh-my-zsh
+Chuck Norris fortunes plugin for oh-my-zsh. Perfectly suitable as MOTD.
**Maintainers**: [apjanke](https://github.com/apjanke) [maff](https://github.com/maff)
@@ -10,11 +10,31 @@ To use it add `chucknorris` to the plugins array in you zshrc file.
plugins=(... chucknorris)
```
-
-Depends on fortune (and cowsay if using chuck_cow) being installed (available via homebrew, apt, ...). Perfectly suitable as MOTD.
-
+## Usage
| Command | Description |
| ----------- | ------------------------------- |
| `chuck` | Print random Chuck Norris quote |
| `chuck_cow` | Print quote in cowthink |
+
+Example: output of `chuck_cow`:
+
+```
+Last login: Fri Jan 30 23:12:26 on ttys001
+ ______________________________________
+( When Chuck Norris plays Monopoly, it )
+( affects the actual world economy. )
+ --------------------------------------
+ o ^__^
+ o (oo)\_______
+ (__)\ )\/\
+ ||----w |
+ || ||
+```
+
+## Requirements
+
+- `fortune`
+- `cowsay` if using `chuck_cow`
+
+Available via homebrew, apt, ...
diff --git a/zsh/plugins/chucknorris/fortunes/chucknorris b/zsh/plugins/chucknorris/fortunes/chucknorris
index 2a13b06..0eb6e2e 100644
--- a/zsh/plugins/chucknorris/fortunes/chucknorris
+++ b/zsh/plugins/chucknorris/fortunes/chucknorris
@@ -1,2544 +1,560 @@
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-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 does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-Chuck Norris can win in a top spinning tournament with a cube
-%
-Beware of dogs... Dogs, beware of Chuck Norris.
-%
-Chuck Norris can dig a hole in air.
-%
-The apple falls far from the tree, when a roundhouse kick is taken to the trunk.
-%
-Chuck Norris - the new standard.
-%
-Chuck Norris told me to put this here.
-%
-Chuck Norris doesn't exhale. The air runs desperately scared out of his lungs.
-%
-Fear of spiders is aracnaphobia, fear of tight spaces is chlaustraphobia, fear of Chuck Norris is called Logic
-%
-When Chuck Norris goes to rodeos, bulls ride him.
-%
-Chuck Norris once walked down a street with his fists in his pockets. He was then arrested for concealing two deadly weapons.
-%
-The meaning of life is Chuck Norris
-%
-Chuck Norris is the meaning of life. Too bad he's also the meaning of death.
-%
-If God doesn't know, Chuck does
-%
-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.
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-When God said "Let there be light!", Chuck Norris said "Only for half the day
-%
-Chuck Norris went up the creek without a paddle... or a canoe
-%
-Chuck Norris once asked a man to turn down his music, he refused, that man's baby was born deaf.
-%
-Chuck Norris found the hay in the needle stack.
-%
-Chuck Norris doesn't need to brush his teeth, his spit acts as a bleach.
-%
-Chuck Norris once had a street named after him. But the name removed at once, because nobody crosses Chuck Norris, and lives
-%
-The planes in 9/11 were not hijacked. Chuck Norris was just playing with his old radio controller.
-%
-Machiavelli said it is better to be feared than loved because he was inspired by Chuck Norris.
-%
-Chuck Norris Can Play the Theme from the Twilight Zone with His Beard
-%
-Chuck Norris pees Adamantium
-%
-The Beatles are on iTunes because Chuck Norris bought a Mac.
-%
-Chuck Norris once rounhouse kicked a football ...... it is now considered as a planet
-%
-Chuck Norris yells at Drill Sergeants
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-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.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent.?
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-There is no such thing as being hard its called the Chuck Norris factor.
-%
-When Chuck Norris goes to the library, he looks for the guinness book of records in the comedy section.
-%
-Chuck Norris can shoot a person 28 times with an unloaded gun.
-%
-Chuck Norris' personal airplane is called Air Force Chuck
-%
-The letters in Chuck Norris cannot be unscrambled.
-%
-Cops don't need a badges in their wallets but only a picture of Chuck Norris.
-%
-Chuck Norris was the reason why the Great Wall of China was constructed. It failed miserably.
-%
-If you see a man in the street who looks like Chuck Norris, but isn't, run: you don't want to be caught in the resulting roundhouse kick to his face.
-%
-The red phone in the oval office...Rings directly to Chuck Norris Cell Phone
-%
-The only way sharks will come near CN underwater is when CN is inside of a cage.
-%
-Chuck Norris uses a real mouse to move the cursor, type on the keyboard, write e-mails, code entire websites, use photoshop, bring coffee.
-%
-If Chuck Norris were to get into a fight with another Chuck Norris, Chuck Norris would win.
+King Kong climbed the Empire State building in fear of Chuck Norris who was downstairs at the time.
%
"2012" is code for, Chuck Norris when he is pissed.
%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-In the back of the book of world records, it says "All records are held by Chuck Norris. The ones listed are in second place."
-%
-The only place where the Starship Enterprise refuses to boldly go is Chuck Norris' planet...which is all of them.
-%
-Chuck Norris once had a pet monkey........his name was KING KONG
-%
-Chuck Norris can make his own megazord "The Chuck Norris Roundhouse Kickers Ultimate Super Awesome Megazord"
-%
-Simon doesn't say...Chuck Norris says.
-%
-When does Chuck Norris run out of shotgun bullets?.....whenever he wants to.
-%
-The only sure things are Death and Taxes, and when Chuck Norris goes to work for the IRS, they'll be the same thing.
-%
-Chuck Norris' first job was as a paperboy. There were no survivors.
-%
-Chuck Norris can turn toast back into bread
-%
-Chuck Norris started Chuck Norris.
-%
-Ever wonder what really happened to the dinosaurs? They all dug their own graves when they heard Chuck Norris was coming
-%
-Chuck Norris killed Kemper
-%
-Did you here about the boy who cried Chuck Norris?
-%
-Chuck Norris can't perform Hadoukens, he IS a Hadouken
-%
-Behind every successful man is Chuck Norris
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-MacGyver immediately tried to make a bomb out of some Q-Tips and Gatorade, but Chuck Norris roundhouse-kicked him in the solar plexus. MacGyver promptly threw up his own heart.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-The square root of Chuck Norris is pain. Do not try to square Chuck Norris. The result is death
-%
-Chuck Norris doesn't read. He just stares at the book until he gets the information he wants.
-%
-Why didn't the chicken cross the road? Because Chuck Norris got to it first.
-%
-When taking the SAT, write "Chuck Norris" for every answer. You will score over 8000.
-%
-Chuck Norris can milk an alligator
-%
-Chuck Norris doesn't eat, he just sucks the energy out of food by staring at it
-%
-Chuck Norris once proved p^~p by induction on his beard hairs.
-%
-The reason why batman only comes out at night is because he's afraid he might encounter Chuck Norris in the Morning and afternoon.
-%
-Chuck Norris can bake in a Freezer.
-%
-Chuck Norris is currently suing any broadway theater that plays "The Nutcracker". He claims its an infringement on his "other" roundhouse kick.
-%
-Chuck Norris once had a weak moment, just to know what it felt like.
-%
-Note to everyone: Please do not give beans to Chuck Norris or do you want another atombomb on hiroshima?
-%
-Chuck Norris has made a 148 break a snooker.
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-http://chucknorrisfacts.com/ is built in Drupal because Chuck Norris knows a good CMS when he sees one.
-%
-The producers of the movie "The Last Airbender" are now in talks with Chuck Norris in Order to star him in their next sequal "The Last Skull Bender".
-%
-Some boots were made for walking. Some boots may walk all over you, but Chuck Norris' boot walk THROUGH you.
-%
-World War II began because Chuck Norris took a nap. When he woke up, Hitler found out and killed himself out of fear Chuck Norris would kill him.
-%
-The best part of waking up is not Folgers in your cup, it's knowing that Chuck Norris let you live.
-%
-Only Chuck Norris can win the mind game, 'cause he never minds.
-%
-Do you know why Chuck Norris didn't star in The Expandebles? Because all the others guys would have surrended at the beginning.
-%
-Bruce Lee didn't defeat Chuck Norris. Chuck hit Bruce with a Delayed roundhouse kick that was so fast that Lee only felt the impact a year later!
-%
-Chuck Norris doesn't need a bulletproof vest to be bulletproof
-%
-When Chuck Norris goes to Vegas, he doesn't have to gamble. The casinos just give him stacks of money.
-%
-Merlin was Chuck Norris' assistant.
-%
-If you put in the correct cheat code in Halo 2, you can have Master Cheif play without his helmet; revealing to be Chuck Norris.
-%
-Those who ignore history, are doomed by Chuck Norris.
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-Some kids pee their name in snow. Chuck Norris pees his name in concrete.
-%
-The Matrix Trilogy would have ended on the first movie if Keanu Reeves said, “I know Chuck Norris.”
-%
-Chuck Norris created Heavy Metal when he was upset
-%
-Some people ask for a Kleenex when they sneeze, Chuck Norris asks for a body bag.
-%
-When things go bump in the night.... it's Chuck Norris
-%
-Chuck Norris fed the Hunger Games
-%
-Chuck Norris played "Got your Nose" with Voldemort and won.
-%
-Chuck Norris had a knife thrown at him............ the knife didn't impale him, he impaled the knife
-%
-Chuck Norris doesn't let it go.
-%
-You know Chuck Norris' pet lizard, right? Last I heard, he was in the movie "Godzilla". Oh, and his pet turtle starred in "Gamera" as well.
-%
-Whatever Chuck Norris wants, it will instantly appear.
-%
-Chuck Norris once cut a knife with a stick of butter.
-%
-Chuck Norris shops at Sam's Club, but leaves without having his receipt checked
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-In 1945 The US army asked if they could clone Chuck Norris. instead he said he could sort out the Japanese.
-%
-One glance from Chuck Norris and snow turns itself yellow.
-%
-Chuck Norris checks under his bed for Fedor Emelianenko because he takes Fedor to the vet regularly.
-%
-Chuck Norris was the image used for Papa Smurf.
-%
-Chuck Norris is so scary he makes Sharks swim backwards away from him
-%
-When Chuck Norris tosses a coin, it lands on both head and tail.
-%
-Chuck Norris found the last digit of pie
-%
-Chuck Norris Watches "the Nat.Geo. Specials" on Discovery Channel
-%
-James Bond has a license to kill. He got it from Chuck Norris.
-%
-Chuck Norris is Chuck Norris
-%
"The Big Chuck Norris Roundhouse-Kick Theory"
%
-That's not an eclipse....that's the sun hiding from Chuck Norris.
-%
-Chuck Norris doesn't like Mudkipz
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-Chuck Norris doesn’t eat salad, he eats vegetarians
-%
-Every time there's an earthquake, you know Chuck Norris is hungry. The earthquake is caused by his stomach growling.
-%
-Chuck Norris wasn't born on his birthday
-%
-One time a test cheated on Chuck Norris.
-%
-Chuck Norris won a stepdance contest by standing on his hands
-%
-Chuck Norris thretened to kill Michael Jackson, MJ got so scared to turned white.
-%
-When Steven Seagal kills a ninja, he only takes its hide. When Chuck Norris kills a ninja, he uses every part.
-%
-Chuck Norris is the life of parties he dosen't attend
-%
-Chuck Norris can rub two fires together and make a stick!
-%
-Contrary to popular beleif, Rome WAS built in a day, by Chuck Norris.
-%
-Chuck Norris rolled a 20 on a 6 sided die.
-%
-When chuck Norris was in school, he made his PE teacher run laps.
-%
-Chuck Norris wins NASCAR races with all right turns.
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-Chuck Norris is waiting for Mt. St. Helens to erupt again. He's hoping the lava is hot enough to soften his beard so he can shave for the first time.
-%
-Chuck Norris is overra...
-%
-Chuck Norris was originally in Mortal Kombat, but that version was deleted because no one can beat Chuck Norris in a fight.
-%
-Chuck Norris likes everyone on the earth, cause everyone he didn't like... Is dead...
-%
-Chunk Norris can make sour milk turn fresh
-%
-There is no limbo, only a world that doesn't know of Chuck Norris
-%
-Chuck Norris CAN believe it's not butter
-%
-Dog the Bounty Hunter can't track Chuck Norris down.
-%
-Abraham Lincoln didn't die because he was shot, Chuck Norris roundhouse-kicked so fast his foot went back in time and killed Abraham Lincoln.
-%
-When Chuck Norris inhales helium, his voice doesn't change.
-%
-When Chuck Norris drinks water, the water automatically pasteurized.
-%
-Chuck Norris once punched the ground to stop an earthquake. The resulting aftershock caused the BP oil spill
-%
-Chuck Norris can play the death waltz with his chin.
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-More of a question than a fact: in a fight between Chuck Norris and Gordan Freeman who would win?
-%
-Chuck Norris once round-house kicked a salesman. Over the phone.
-%
-Chuck Norris can grill a popsicle
-%
-Chuck Norris' films are factual documentaries.
-%
-Casinos pay Chuck Norris not to play at anything or wish anyone good luck.
-%
-Chuck Norris once got a 200 yard punt return
-%
-Every line in a Chuck Norris haiku is "A roundhouse kick to the face." And they all have the correct number of syllables.
-%
-An angry glare from Chuck Norris is known to kill on the spot.
-%
-Evolution's driving mechanism is nature's desperate attempt to escape Chuck Norris.
-%
-When President Roosevelt dropped the atomic bomb on Hiroshima, he did so only because it was more human then sending Chuck Norris.
-%
-Don't get Chuck Norris angry, last time somebody did that Chuck Norris made the Grand Canyon.
-%
-In Texas, there are five sizes for fountain drinks: small, medium, large, Texas sized, and Chuck Norris Sized. It is a cup made of a human skull.
-%
-After Chuck counted to infinity the first time, he vowed to count to infinity a second time....by counting the bodies of those previously roundhoused.
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-Taking Karate Lessons = $100, Buying MMA DVD's= $150, Subscribing to a UFC event = $50, Getting a Roundhouse Kick from Chuck Norris = PRICELESS
-%
-Chuck Norris played the game of thrones and won
-%
-Chuck Norris doesn't need sunglasses, the sun needs Chuck Norris glasses
-%
-Chuck Norris doesn't call the wrong number, you just answer the wrong phone.
-%
-Chuck Norris once won the tour de france riding a " big wheel"
-%
-May the Force be with Chuck Norris... for it's own good.
-%
-Chuck Norris once played Duck Duck Goose with a group of Kindergarteners. Only one kid made it to first grade
-%
-During the Civil War Chuck Norris was a slave, his master would often beg him for mercy
-%
-Chuck Norris' glass is never half full or half empty. It stays full even after he takes a drink.
-%
- King Kong climbed the Empire State building in fear of Chuck Norris who was downstairs at the time.
-%
-Chuck Norris can French kiss his elbow.
-%
-Chuck Norris never trains, because he's Chuck Norris.
-%
-Every phobia known to man has a phobia of Chuck Norris
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-Once upon a time, Chuck Norris found himself in a town called Shit Creek.....He opened a Paddle Store.
-%
-Chuck Norris Can Power Solar Panels. At Night.
-%
-When Betty White gets angry, she turns into the Hulk. When Valerie Bertinelli gets mad, she turns into Chuck Norris.
-%
-Chuck Norris is so hard, he uses diamonds as stress balls.
-%
-Chuck Norris can roundhouse kick someone through a window without breaking the glass
-%
-Chuck Norris. Enough said.
-%
-The letters in Chuck Norris cannot be unscrambled.
-%
-Chuck Norris once taught a class of martial arts.Unfortunately Chuck had forgiven to take elephant tranquilizers and killed every one just by saluting
-%
-Chuck Norris was heard in a soundproof room!
-%
-Chuck Norris can see in 3D with just one eye.
-%
-Chuck Norris owns all number 1 pencils.
-%
-Staring at Chuck Norris for extended periods of time without proper eye protection will cause blindess, and possibly foot sized brusies on the face.
-%
-Chuck Norris doesn’t brew up tea. He sucks the bag.
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-They say death by a 1000 lashes was the most painful way to die, that was before they got roundhouse kicked in the face by Chuck Norris
-%
-Chuck Norris made a statue bleed.
-%
-Dead bodies were found of people that are still alive. These people will cross Chuck Norris in the future and will be round-house kicked back in time.
-%
-The reason why batman only comes out at night is because he's afraid he might encounter Chuck Norris in the Morning and afternoon.
-%
-The kids said when Chuck was eating Trix cereal ´´silly Chuck, Trix are for kids´´...what happened next?..............................Darfur happened.
-%
-Chuck Norris can roundhouse-kick round houses into squares.
-%
-Chuck Norris is allowed two carry-ons.
-%
-Chuck Norris can divide by zero.
-%
-Chuck Norris does not have a cell phone because he hears everything
-%
-Chuck Norris isn't appropriate...appropriate isn't Chuck Norris
-%
-Earth's rotation is purely governed by the direction that Chuck Norris is walking.
-%
-Chuck Norris drowned a man ON LAND.
-%
-The Jone's are trying to keep up with Chuck Norris
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-Chuck Norris bowled a 301 after constructing another pin out of his beard hair
-%
-The only reason that USA lost the 2011 world cup to Japan is because Chuck Norris wasn't there.
-%
-Unlike Jack Bauer, Chuck Norris doesn't need bullets. A quick roundhouse to the face kills twice as fast.
-%
-There is no such thing as global warming. Chuck Norris was cold, so he turned the sun up.
-%
-Chuck Norris' dog pick up after him.
-%
-Jedis are now taught to use the "Chuck"
-%
-Chuck Norris dosent carry a list. He always knows what to do.
-%
-When Chuck Norris performs a roundhouse kick, he's actually measuring the circumference of the universe.
-%
-Walker: Texas Ranger went into syndication before the first episode was shot.
-%
-Chuck Norris doesn't throw up if he drinks too much. Chuck Norris throws down!
-%
-"Walker Texas Ranger: The Movie 3-D" was considered by Warner Brothers; however the technology to create the visual effects will never be possible.
-%
-When Chuck Norris creates a login, it tells him "password not strong enough", he types in his name and it tells him "password too strong."
-%
-Chuck Norris isn't allowed at the zoo because when he's there the animals are terriefied to come out their cages
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-Aliens fear that Chuck Norris might abduct them.
-%
-Chuck Norris splattered tiger blood and Adonis' dna on Charlie Sheen with 1 roundhouse kick!
-%
-How much wood could a woodchuck chuck if a woodchuck could chuck wood? No woodchuck could chuck Chuck's wood!
-%
-The sun only rises every morning because Chuck Norris allows it to.
-%
-Chuck Norris can do a regime change with a roundhouse kick.
-%
-Chuck Norris CAN spell with an I before E even after C.
-%
-Ghosts can see Chuck Norris
-%
-The answer to life, the universe and everything isnt 42. It's Chuck Norris.
-%
-When Chuck Norris pokes the Pillsbury Doughboy, it's not a laughing matter.
-%
-Chuck Norris once thought he was wrong. He was, however, mistaken.
-%
-Ever wonder what really happened to the dinosaurs? They all dug their own graves when they heard Chuck Norris was coming
-%
"The wind cries Chuck Norris"
%
-Chuck Norris doesn't need a bulletproof vest. He catches them with his bare hands.
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
+"Walker Texas Ranger: The Movie 3-D" was considered by Warner Brothers; however the technology to create the visual effects will never be possible.
%
A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-Chuck Norris: even Naruto can't believe it
-%
-Chuck Norris can fit 10 gallons of water in a 5 gallon water bucket
-%
-Chuck Norris roundhouse kicks people in the face first and asks questions later.
-%
-Chuck Norris is the only one who can tear a facebook page!
-%
-Chuck Norris doesn't need air, he is air
-%
-Chuck Norris once tried to teach a fat, stupid kid Martial Arts. Unsuccessfully. The kid grew up to be Steven Seagal.
+Abraham Lincoln didn't die because he was shot, Chuck Norris roundhouse-kicked so fast his foot went back in time and killed Abraham Lincoln.
%
Achievement Unlocked: Chuck Norris of Death
%
-Chuck Norris is the ghost in paranormal activity.
+After Chuck counted to infinity the first time, he vowed to count to infinity a second time....by counting the bodies of those previously roundhoused.
%
-Chuck Norris can't get fired by Donald Trump
+Aliens fear that Chuck Norris might abduct them.
%
-Ozzy Osbourne once accidentally bit the head off a live bat - Chuck Norris once deliberately bit the head off a live pterodactyl.
+An angry glare from Chuck Norris is known to kill on the spot.
%
-Note to self: Don’t be the cashier to tell Chuck Norris his coupons have expired.
+Behind every successful man is Chuck Norris.
%
-Chuck Norris was what Willis was talking about.
+Beware of dogs... Dogs, beware of Chuck Norris.
%
-Chuck Norris is entitiled to his own facts.
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
+Bruce Lee didn't defeat Chuck Norris. Chuck hit Bruce with a Delayed roundhouse kick that was so fast that Lee only felt the impact a year later!
%
CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
%
-Chuck Norris can win a game of Connect Four in only three moves.
+Casinos pay Chuck Norris not to play at anything or wish anyone good luck.
%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-While visiting the hexagon, Chuck Norris was asked to demonstrate his famous roundhouse kick. Henceforth, it has been known as the Pentagon.
-%
-When Chuck Norris played the card game War with a friend, France surrendered.
-%
-If Goliath listened to Chuck Norris he would have won.
-%
-Chuck Norris can defuse bomb even if he cut the wrong wire
-%
-Chuck Norris sleeps in Seattle.
-%
-Chuck Norris shot a man with a knife
-%
-The dictionary references Chuck Norris several times, he is metioned under Fear, Law, Order and Chucktatorship.
+Chuck Norris - the new standard.
%
Chuck Norris CAN balance the light-switch between ON and OFF.
%
-If Chuck was ever captured, he could win a game of Russian Roulette with six bullets in the revolver, he would shoot everyone else!
+Chuck Norris CAN believe it's not butter.
%
-In a rain storm Chuck Norris stays dry. Rain drops are scared to hit him.
+Chuck Norris CAN spell with an I before E even after C.
%
-Chuck Norris is the reason tumbleweeds tumble
+Chuck Norris can play the theme from the Twilight Zone with his beard.
%
-The Earth was almost destroyed by a 50 km wide asteroid in 1984, but Chuck Norris roundhouse kicked it into the Sun.
+Chuck Norris can power solar panels. At night.
%
-Chuck Norris can terminate a repeating decimal.
+Chuck Norris watches "the Nat.Geo. Specials" on Discovery Channel.
%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-Chuck Norris doesn't look for fun. The fun looks for Chuck Norris.
-%
-Chuck Norris starts his day with 6 live chickens two cows, three pigs and a boiling hot cup of pure fury
-%
-The only word that rhymes with orange is Chuck Norris
-%
-Everyone is so scared of Chuck Norris that they kiss his arse by writing these facts, too right they should
-%
-gmail@chucknorris.com
-%
-Chuck Norris play's Texas hold em with Zeus, every second Wednesday of the month
-%
-Chuck Norris has killed the Dead Sea
-%
-On the keyboard there is no control button because Chuck Norris is always in control.
-%
-The truth hurts dosen't it, Chuck Norris' truth kills.
-%
-Chuck Norris sent a BBM to an iphone.
-%
-When Presidents speak, their nation listens. When Chuck Norris blinks, the whole World listens.
-%
-Chuck Norris once cried just to see what it was like. The end result was the creation of life.
-%
-Chuck Norris is the reason that the world will end in 2012. He was getting bored with the Earth
-%
-When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
-%
-Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
-%
-There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
-%
-Outer space exists because it's afraid to be on the same planet with Chuck Norris.
-%
-Chuck Norris does not sleep. He waits.
-%
-Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
-%
-Chuck Norris is the reason why Waldo is hiding.
-%
-Chuck Norris counted to infinity - twice.
-%
-There is no chin behind Chuck Norris’ beard. There is only another fist.
-%
-When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
-%
-Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
-%
-Chuck Norris' hand is the only hand that can beat a Royal Flush.
-%
-Chuck Norris can lead a horse to water AND make it drink.
-%
-Chuck Norris doesn’t wear a watch. HE decides what time it is.
-%
-Chuck Norris can slam a revolving door.
-%
-Chuck Norris does not get frostbite. Chuck Norris bites frost.
-%
-Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
-%
-Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
-%
-If you spell Chuck Norris in Scrabble, you win. Forever.
-%
-Guns don't kill people. Chuck Norris kills people.
-%
-There is no theory of evolution. Just a list of animals Chuck Norris allows to live.
-%
-The chief export of Chuck Norris is Pain.
-%
-Chuck Norris has two speeds. Walk, and Kill.
-%
-The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
-%
-Chuck Norris drives an ice cream truck covered in human skulls.
-%
-Chuck Norris is my Homeboy.
-%
-Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
-%
-Chuck Norris uses pepper spray to spice up his steaks.
-%
-Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean.
-%
-Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
-%
-Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
-%
-The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
-%
-Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth.
-%
-Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
-%
-If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
-%
-When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
-%
-The quickest way to a man's heart is with Chuck Norris' fist.
-%
-Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
-%
-CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
-%
-Chuck Norris can win a game of Connect Four in only three moves.
-%
-What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
-%
-Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
-%
-Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
-%
-Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
-%
-Chuck Norris doesn’t wash his clothes, he disembowels them.
-%
-A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
-%
-Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
-%
-Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
-%
-Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
-%
-Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
-%
-Only Chuck Norris is stronger than an Altoid.
-%
-Chuck Norris has a battlecruiser AND a car.
+Chuck Norris bowled a 301 after constructing another pin out of his beard hair.
%
Chuck Norris burnt a fire proof vest, UNDERWATER!
%
-Chuck Norris was once turned down for American Idol. When Simon was questioned about it, he replied "I'm retiring after this season". I wonder why?
+Chuck Norris can French kiss his elbow.
+%
+Chuck Norris can bake in a freezer.
+%
+Chuck Norris can defuse a bomb by cutting the wrong wire.
+%
+Chuck Norris can dig a hole in air.
+%
+Chuck Norris can divide by zero.
+%
+Chuck Norris can do a regime change with a roundhouse kick.
+%
+Chuck Norris can fit 10 gallons of water in a 5 gallon bucket.
+%
+Chuck Norris can grill a popsicle.
+%
+Chuck Norris can lead a horse to water AND make it drink.
+%
+Chuck Norris can make his own megazord "The Chuck Norris Roundhouse Kickers Ultimate Super Awesome Megazord".
+%
+Chuck Norris can milk an alligator.
+%
+Chuck Norris can play the death waltz with his chin.
+%
+Chuck Norris can roundhouse kick someone through a window without breaking the glass.
+%
+Chuck Norris can roundhouse-kick round houses into squares.
+%
+Chuck Norris can rub two fires together and make a stick!
+%
+Chuck Norris can see in 3D with just one eye.
+%
+Chuck Norris can slam a revolving door.
+%
+Chuck Norris can terminate a repeating decimal.
+%
+Chuck Norris can turn toast back into bread.
+%
+Chuck Norris can win a game of Connect Four in only three moves.
+%
+Chuck Norris can win in a top spinning tournament with a cube.
+%
+Chuck Norris can't perform Hadoukens, he IS a Hadouken.
+%
+Chuck Norris checks under his bed for Fedor Emelianenko because he takes Fedor to the vet regularly.
+%
+Chuck Norris counted to infinity - twice.
+%
+Chuck Norris created Heavy Metal when he was upset.
+%
+Chuck Norris does not get frostbite. Chuck Norris bites frost.
+%
+Chuck Norris does not have a cell phone because he hears everything.
+%
+Chuck Norris does not sleep. He waits.
+%
+Chuck Norris doesn't bowl strikes, he just knocks down one pin and the other nine faint.
+%
+Chuck Norris doesn't call the wrong number, you just answer the wrong phone.
%
Chuck Norris doesn't cheat death, he beats it fair and square.
%
-When Chuck Norris roundhouse-kicks you HE decides when you will feel the impact .
+Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
%
-Chuck Norris made the big bang just by clicking his fingers
+Chuck Norris doesn't eat, he just sucks the energy out of food by staring at it.
%
-Trick me once, shame on you, trick Chuck Norris.....rest in peace.
+Chuck Norris doesn't exhale. The air runs desperately scared out of his lungs.
%
-Chuck Norris doesn't fight. He gives motivational seminars to die on their own to avoid a roundhouse kick to the face.
+Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
%
-This one time at band camp... BAM! Chuck Norris.
+Chuck Norris doesn't let it go.
%
-Chuck Norris protects his body guards.
+Chuck Norris doesn't like Mudkipz.
%
-Chuck Norris watched the first steps on the moon... From his summer home on Mars
+Chuck Norris doesn't look for fun. The fun looks for Chuck Norris.
+%
+Chuck Norris doesn't need a bulletproof vest. He catches them with his bare hands.
+%
+Chuck Norris doesn't need air, he is air.
+%
+Chuck Norris doesn't need sunglasses, the sun needs Chuck Norris glasses.
+%
+Chuck Norris doesn't need to brush his teeth, his spit acts as a bleach.
+%
+Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
+%
+Chuck Norris doesn't throw up if he drinks too much. Chuck Norris throws down!
+%
+Chuck Norris doesn't eat salad, he eats vegetarians.
+%
+Chuck Norris doesn't wash his clothes, he disembowels them.
+%
+Chuck Norris doesn't wear a watch. HE decides what time it is.
+%
+Chuck Norris doesn't carry a list. He always knows what to do.
+%
+Chuck Norris drives an ice cream truck covered in human skulls.
+%
+Chuck Norris drowned a man ON LAND.
+%
+Chuck Norris fed the Hunger Games.
+%
+Chuck Norris found the hay in the needle stack.
+%
+Chuck Norris found the last digit of pi.
+%
+Chuck Norris had a knife thrown at him. The knife didn't impale him; he impaled the knife.
+%
+Chuck Norris has a battle cruiser AND a car.
+%
+Chuck Norris has killed the Dead Sea.
+%
+Chuck Norris has made a 148 break at snooker.
+%
+Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
+%
+Chuck Norris is allowed two carry-ons.
+%
+Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
+%
+Chuck Norris is currently suing any broadway theater that plays "The Nutcracker". He claims its an infringement on his "other" roundhouse kick.
+%
+Chuck Norris is entitled to his own facts.
+%
+Chuck Norris is my Homeboy.
+%
+Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
+%
+Chuck Norris is so hard, he uses diamonds as stress balls.
+%
+Chuck Norris is so scary, he makes sharks swim backwards away from him.
+%
+Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
+%
+Chuck Norris is the ghost in paranormal activity.
+%
+Chuck Norris is the life of parties he doesn't attend.
+%
+Chuck Norris is the meaning of life. Too bad he's also the meaning of death.
+%
+Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
+%
+Chuck Norris is the only one who can tear a facebook page!
+%
+Chuck Norris is the reason that the world will end in 2012. He was getting bored with the Earth.
+%
+Chuck Norris is the reason tumbleweeds tumble.
+%
+Chuck Norris is the reason why Waldo is hiding.
+%
+Chuck Norris is waiting for Mt. St. Helens to erupt again. He's hoping the lava is hot enough to soften his beard so he can shave for the first time.
+%
+Chuck Norris isn't allowed at the zoo, because when he's there the animals are too terrified to come out of their cages.
+%
+Chuck Norris made a statue bleed.
+%
+Chuck Norris made the big bang just by clicking his fingers.
+%
+Chuck Norris never trains, because he's Chuck Norris.
+%
+Chuck Norris once cried just to see what it was like. The end result was the creation of life.
+%
+Chuck Norris once cut a knife with a stick of butter.
+%
+Chuck Norris once got a 200 yard punt return.
+%
+Chuck Norris once had a pet monkey named KING KONG.
+%
+Chuck Norris once had a street named after him. The name removed at once, because nobody crosses Chuck Norris, and lives.
+%
+Chuck Norris once had a weak moment, just to know what it felt like.
+%
+Chuck Norris once played Duck Duck Goose with a group of Kindergarteners. Only one kid made it to first grade.
+%
+Chuck Norris once proved p^~p by induction on his beard hairs.
+%
+Chuck Norris once punched the ground to stop an earthquake. The resulting aftershock caused the BP oil spill.
+%
+Chuck Norris once round-house kicked a salesman. Over the phone.
+%
+Chuck Norris once rounhouse kicked a football. The astronomical society now considers it a planet.
+%
+Chuck Norris once thought he was wrong. He was, however, mistaken.
+%
+Chuck Norris once walked down a street with his fists in his pockets. He was then arrested for concealing two deadly weapons.
+%
+Chuck Norris once won the Tour de France riding a "big wheel".
+%
+Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
+%
+Chuck Norris owns all number 1 pencils.
+%
+Chuck Norris pees Adamantium.
+%
+Chuck Norris plays Texas Hold'Em with Zeus, every second Wednesday of the month.
+%
+Chuck Norris played "Got your Nose" with Voldemort and won.
+%
+Chuck Norris played the game of thrones and won.
+%
+Chuck Norris protects his bodyguards.
+%
+Chuck Norris rolled a 20 on a 6 sided die.
+%
+Chuck Norris roundhouse kicks people in the face first and asks questions later.
+%
+Chuck Norris sent a BBM to an iPhone.
+%
+Chuck Norris shops at Sam's Club, but leaves without having his receipt checked.
+%
+Chuck Norris splattered tiger blood and Adonis' DNA on Charlie Sheen with 1 roundhouse kick!
+%
+Chuck Norris started Chuck Norris.
+%
+Chuck Norris starts his day with 6 live chickens, two cows, three pigs, and a boiling hot cup of pure fury.
+%
+Chuck Norris told me to put this here.
+%
+Chuck Norris uses a real mouse to move the cursor, type on the keyboard, write e-mails, code entire websites, and make coffee.
+%
+Chuck Norris uses pepper spray to spice up his steaks.
+%
+Chuck Norris was heard in a soundproof room!
+%
+Chuck Norris was once turned down for American Idol. When Simon was questioned about it, he replied "I'm retiring after this season". I wonder why?
+%
+Chuck Norris was originally in Mortal Kombat, but that version was deleted because no one can beat Chuck Norris in a fight.
+%
+Chuck Norris was the image used for Papa Smurf.
+%
+Chuck Norris was the reason why the Great Wall of China was constructed. It failed miserably.
+%
+Chuck Norris was what Willis was talking about.
+%
+Chuck Norris wasn't born on his birthday.
+%
+Chuck Norris watched the first steps on the moon... from his summer home on Mars.
+%
+Chuck Norris went up the creek without a paddle... or a canoe.
+%
+Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
+%
+Chuck Norris wins NASCAR races with all right turns.
+%
+Chuck Norris won a stepdance contest by standing on his hands.
+%
+Chuck Norris yells at drill Sergeants.
+%
+Chuck Norris' dog picks up after him.
+%
+Chuck Norris' films are factual documentaries.
+%
+Chuck Norris' first job was as a paperboy. There were no survivors.
+%
+Chuck Norris' glass is never half full or half empty. It stays full even after he takes a drink.
+%
+Chuck Norris' hand is the only hand that can beat a Royal Flush.
+%
+Chuck Norris' personal airplane is called Air Force Chuck.
+%
+Chuck Norris. Enough said.
+%
+Chuck Norris: even Naruto can't believe it.
+%
+Chunk Norris can make sour milk turn fresh.
+%
+Contrary to popular belief, Rome WAS built in a day, by Chuck Norris.
+%
+Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
+%
+Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on Earth.
+%
+Cops don't need badges in their wallets, but only a picture of Chuck Norris.
+%
+Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
+%
+Did you hear about the boy who cried Chuck Norris?
+%
+Dog the Bounty Hunter can't track Chuck Norris down.
+%
+Don't get Chuck Norris angry. Last time somebody did that, Chuck Norris made the Grand Canyon.
+%
+Earth's rotation is purely governed by the direction that Chuck Norris is walking.
+%
+Ever wonder what really happened to the dinosaurs? They all dug their own graves when they heard Chuck Norris was coming.
+%
+Every line in a Chuck Norris haiku is "A roundhouse kick to the face." And they all have the correct number of syllables.
+%
+Every phobia known to man has a phobia of Chuck Norris.
+%
+Every time there's an earthquake, you know Chuck Norris is hungry. The earthquake is caused by his stomach growling.
+%
+Evolution's driving mechanism is nature's desperate attempt to escape Chuck Norris.
+%
+Fear of spiders is arachnaphobia. Fear of tight spaces is claustrophobia. Fear of Chuck Norris is called Logic.
+%
+Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
+%
+Ghosts can see Chuck Norris.
+%
+Guns don't kill people. Chuck Norris kills people.
+%
+How much wood could a woodchuck chuck if a woodchuck could chuck wood? No woodchuck could chuck Chuck's wood!
+%
+If Chuck Norris were a calendar, every month would be named Chucktober, and every day he'd kick your ass.
+%
+If Chuck Norris were to get into a fight with another Chuck Norris, Chuck Norris would win.
+%
+If God doesn't know, Chuck does.
+%
+If Goliath listened to Chuck Norris, he would have won.
+%
+If at first you don't succeed, you're not Chuck Norris.
+%
+If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
+%
+If you put in the correct cheat code in Halo 2, you can have Master Chief play without his helmet, revealing himself to be Chuck Norris.
+%
+If you see a man in the street who looks like Chuck Norris, but isn't, run: you don't want to be caught in the resulting roundhouse kick to his face.
+%
+If you spell Chuck Norris in Scrabble, you win. Forever.
+%
+In 1945 The US army asked if they could clone Chuck Norris. Instead he said he could sort out the Japanese.
+%
+In Texas, there are five sizes for fountain drinks: small, medium, large, Texas sized, and Chuck Norris sized. It is a cup made of a human skull.
+%
+In a rain storm Chuck Norris stays dry. Rain drops are scared to hit him.
+%
+In the back of the book of world records, it says "All records are held by Chuck Norris. The ones listed are in second place."
+%
+James Bond has a license to kill. He got it from Chuck Norris.
+%
+Jedis are now taught to use the "Chuck".
+%
+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.
+%
+Machiavelli said it is better to be feared than loved because he was inspired by Chuck Norris.
+%
+May the Force be with Chuck Norris... for its own good.
+%
+Merlin was Chuck Norris' assistant.
+%
+Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
+%
+Note to self: Don't be the cashier to tell Chuck Norris his coupons have expired.
+%
+Chuck Norris' keyboard has no control key. Chuck Norris is always in control.
+%
+Once upon a time, Chuck Norris found himself in a town called Shit Creek. He opened a Paddle Store.
+%
+One glance from Chuck Norris and snow turns itself yellow.
+%
+One time a test cheated on Chuck Norris.
+%
+Only Chuck Norris can win the mind game, 'cause he never minds.
+%
+Only Chuck Norris is stronger than an Altoid.
+%
+Outer space exists because it's afraid to be on the same planet with Chuck Norris.
+%
+Ozzy Osbourne once accidentally bit the head off a live bat - Chuck Norris once deliberately bit the head off a live pterodactyl.
+%
+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.
+%
+Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
+%
+Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
+%
+Simon doesn't say... Chuck Norris says.
+%
+Some boots were made for walking. Some boots may walk all over you, but Chuck Norris' boots walk THROUGH you.
+%
+Some kids pee their name in snow. Chuck Norris pees his name in concrete.
+%
+Some people ask for a Kleenex when they sneeze, Chuck Norris asks for a body bag.
+%
+Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
+%
+Staring at Chuck Norris for extended periods of time without proper eye protection will cause blindess, and possibly foot sized brusies on the face.
+%
+Taking Karate Lessons = $100, Buying MMA DVD's = $150, Subscribing to a UFC event = $50, Getting a Roundhouse Kick from Chuck Norris = PRICELESS.
+%
+That's not an eclipse. That's the sun hiding from Chuck Norris.
+%
+The Beatles are on iTunes because Chuck Norris bought a Mac.
%
The Earth is made up of two-thirds water and one-third Chuck Norris.
%
+The Earth was almost destroyed by a 50 km wide asteroid in 1984, but Chuck Norris roundhouse kicked it into the Sun.
+%
+The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
+%
+The Joneses are trying to keep up with Chuck Norris.
+%
+The Matrix Trilogy would have ended on the first movie had Keanu Reeves said, “I know Chuck Norris.”
+%
+The answer to life, the universe and everything isn't 42. It's Chuck Norris.
+%
+The apple falls far from the tree, when Chuck's roundhouse kick is taken to the trunk.
+%
+The best part of waking up is not Folgers in your cup. it's knowing that Chuck Norris let you live.
+%
+The chief export of Chuck Norris is pain.
+%
+The dictionary references Chuck Norris several times, he is metioned under Fear, Law, Order and Chucktatorship.
+%
+The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
+%
+The letters in Chuck Norris cannot be unscrambled.
+%
+The only place where the Starship Enterprise refuses to boldly go is Chuck Norris' planet... which is all of them.
+%
+The only reason that USA lost the 2011 world cup to Japan is because Chuck Norris wasn't there.
+%
+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 way sharks will come near CN underwater is when CN is inside of a cage.
+%
+The only word that rhymes with orange is Chuck Norris.
+%
+The producers of the movie "The Last Airbender" are now in talks with Chuck Norris in Order to star him in their next sequal "The Last Skull Bender".
+%
+The quickest way to a man's heart is with Chuck Norris' fist.
+%
+The reason why Batman only comes out at night is because he's afraid he might encounter Chuck Norris in the morning and afternoon.
+%
+The red phone in the oval office rings directly to Chuck Norris' cell phone.
+%
+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.
+%
+The square root of Chuck Norris is pain. Do not try to square Chuck Norris. The result is death.
+%
+The sun only rises every morning because Chuck Norris allows it to.
+%
+The truth hurts, doesn't it? Chuck Norris' truth kills.
+%
+There is no chin behind Chuck Norris' beard. There is only another fist.
+%
+There is no limbo, only a world that doesn't know of Chuck Norris.
+%
+There is no such thing as global warming. Chuck Norris was cold, so he turned the sun up.
+%
+There is no theory of evolution, just a list of creatures Chuck Norris has allowed to live.
+%
+This one time at band camp... BAM! Chuck Norris.
+%
+Those who ignore history, are doomed by Chuck Norris.
+%
+Trick me once, shame on you, trick Chuck Norris.. rest in peace.
+%
+Unlike Jack Bauer, Chuck Norris doesn't need bullets. A quick roundhouse to the face kills twice as fast.
+%
+Walker: Texas Ranger went into syndication before the first episode was shot.
+%
+What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
+%
+Whatever Chuck Norris wants, it will instantly appear.
+%
+When Betty White gets angry, she turns into the Hulk. When Valerie Bertinelli gets mad, she turns into Chuck Norris.
+%
+When Chuck Norris creates a login, it tells him "password not strong enough." He types in his name and it tells him "password too strong."
+%
+When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
+%
+When Chuck Norris drinks water, the water automatically pasteurized.
+%
+When Chuck Norris goes to Vegas, he doesn't have to gamble. The casinos just give him stacks of money.
+%
+When Chuck Norris goes to rodeos, bulls ride him.
+%
+When Chuck Norris goes to the library, he looks for the Guinness book of records in the comedy section.
+%
+When Chuck Norris inhales helium, his voice doesn't change.
+%
+When Chuck Norris performs a roundhouse kick, he's actually measuring the circumference of the universe.
+%
+When Chuck Norris played the card game War with a friend, France surrendered.
+%
+When Chuck Norris pokes the Pillsbury Doughboy, it's not a laughing matter.
+%
+When Chuck Norris roundhouse-kicks you, he decides when you will feel the impact.
+%
+When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
+%
+When Chuck Norris tosses a coin, it lands on both heads and tails.
+%
+When God said "Let there be light!", Chuck Norris said "Only for half the day."
+%
+When Presidents speak, their nation listens. When Chuck Norris blinks, the whole world listens.
+%
+When Steven Seagal kills a ninja, he only takes its hide. When Chuck Norris kills a ninja, he uses every part.
+%
+When chuck Norris was in school, he made his PE teacher run laps.
+%
+When does Chuck Norris run out of shotgun bullets? whenever he wants to.
+%
+When taking the SAT, write "Chuck Norris" for every answer. You will score over 8000.
+%
+When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
+%
+When things go bump in the night, it's Chuck Norris
+%
+While visiting the Hexagon, Chuck Norris was asked to demonstrate his famous roundhouse kick. Henceforth, it has been known as the Pentagon.
+%
+Why didn't the chicken cross the road? Because Chuck Norris got to it first.
+%
+You know Chuck Norris' pet lizard, right? Last I heard, he was in the movie "Godzilla". Oh, and his pet turtle starred in "Gamera" as well.
+%
+http://chucknorrisfacts.com/ is built in Drupal because Chuck Norris knows a good CMS when he sees one.
+%
diff --git a/zsh/plugins/cloudapp/README.md b/zsh/plugins/cloudapp/README.md
new file mode 100644
index 0000000..ef304ed
--- /dev/null
+++ b/zsh/plugins/cloudapp/README.md
@@ -0,0 +1,26 @@
+# CloudApp plugin
+
+## The CloudApp API is deprecated, so the plugin will be removed shortly
+
+[CloudApp](https://www.getcloudapp.com) brings screen recording, screenshots, and GIF creation to the cloud, in an easy-to-use enterprise-level app. The CloudApp plugin allows you to upload a file to your CloadApp account from the command line.
+
+To use it, add `cloudapp` to the plugins array of your `~/.zshrc` file:
+
+```zsh
+plugins=(... cloudapp)
+```
+
+## Requirements
+
+1. [Aaron Russell's `cloudapp_api` gem](https://github.com/aaronrussell/cloudapp_api#installation)
+
+2. That you set your CloudApp credentials in `~/.cloudapp` as a simple text file like below:
+ ```
+ email
+ password
+ ```
+
+## Usage
+
+- `cloudapp `: uploads `` to your CloudApp account, and if you're using
+ macOS, copies the URL to your clipboard.
diff --git a/zsh/plugins/cloudapp/cloudapp.plugin.zsh b/zsh/plugins/cloudapp/cloudapp.plugin.zsh
index 3b363c8..a4d92a0 100644
--- a/zsh/plugins/cloudapp/cloudapp.plugin.zsh
+++ b/zsh/plugins/cloudapp/cloudapp.plugin.zsh
@@ -1,6 +1,4 @@
-alias cloudapp="${0:a:h}/cloudapp.rb"
-
-# Ensure only the owner can access the credentials file
-if [[ -f ~/.cloudapp ]]; then
- chmod 600 ~/.cloudapp
-fi
+print -Pn "%F{yellow}"
+print "[oh-my-zsh] The CloudApp API no longer works, so the cloudapp plugin will"
+print "[oh-my-zsh] be removed shortly. Please remove it from your plugins list."
+print -Pn "%f"
diff --git a/zsh/plugins/cloudapp/cloudapp.rb b/zsh/plugins/cloudapp/cloudapp.rb
deleted file mode 100755
index a11cfdb..0000000
--- a/zsh/plugins/cloudapp/cloudapp.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env ruby
-#
-# cloudapp
-# Zach Holman / @holman
-#
-# Uploads a file from the command line to CloudApp, drops it into your
-# clipboard (on a Mac, at least).
-#
-# Example:
-#
-# cloudapp drunk-blake.png
-#
-# This requires Aaron Russell's cloudapp_api gem:
-#
-# gem install cloudapp_api
-#
-# Requires you set your CloudApp credentials in ~/.cloudapp as a simple file of:
-#
-# email
-# password
-
-require 'rubygems'
-begin
- require 'cloudapp_api'
-rescue LoadError
- puts "You need to install cloudapp_api: gem install cloudapp_api"
- exit!(1)
-end
-
-config_file = "#{ENV['HOME']}/.cloudapp"
-unless File.exist?(config_file)
- puts "You need to type your email and password (one per line) into "+
- "`~/.cloudapp`"
- exit!(1)
-end
-
-email,password = File.read(config_file).split("\n")
-
-class HTTParty::Response
- # Apparently HTTPOK.ok? IS NOT OKAY WTFFFFFFFFFFUUUUUUUUUUUUUU
- # LETS MONKEY PATCH IT I FEEL OKAY ABOUT IT
- def ok? ; true end
-end
-
-if ARGV[0].nil?
- puts "You need to specify a file to upload."
- exit!(1)
-end
-
-CloudApp.authenticate(email,password)
-url = CloudApp::Item.create(:upload, {:file => ARGV[0]}).url
-
-# Say it for good measure.
-puts "Uploaded to #{url}."
-
-# Get the embed link.
-url = "#{url}/#{ARGV[0].split('/').last}"
-
-# Copy it to your (Mac's) clipboard.
-`echo '#{url}' | tr -d "\n" | pbcopy`
diff --git a/zsh/plugins/codeclimate/README.md b/zsh/plugins/codeclimate/README.md
new file mode 100644
index 0000000..0d712ac
--- /dev/null
+++ b/zsh/plugins/codeclimate/README.md
@@ -0,0 +1,8 @@
+# codeclimate plugin
+
+This plugin adds autocompletion for the [`codeclimate` CLI](https://github.com/codeclimate/codeclimate).
+
+To use it, add `codeclimate` to the plugins array in your zshrc file:
+```zsh
+plugins=(... codeclimate)
+```
diff --git a/zsh/plugins/coffee/README.md b/zsh/plugins/coffee/README.md
index d6cd074..2baade8 100644
--- a/zsh/plugins/coffee/README.md
+++ b/zsh/plugins/coffee/README.md
@@ -1,4 +1,4 @@
-## Coffeescript Plugin
+# Coffeescript Plugin
This plugin provides aliases for quickly compiling and previewing your
coffeescript code.
diff --git a/zsh/plugins/colemak/README.md b/zsh/plugins/colemak/README.md
new file mode 100644
index 0000000..4da4bc1
--- /dev/null
+++ b/zsh/plugins/colemak/README.md
@@ -0,0 +1,48 @@
+# Colemak plugin
+
+This plugin remaps keys in `zsh`'s [`vi`-style navigation mode](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Keymaps)
+for a [Colemak](https://colemak.com/) keyboard layout, to match the QWERTY position:
+
+
+
+To use it, add it to the plugins array in your `~/.zshrc` file:
+
+```
+plugins=(... colemak)
+```
+
+You will also need to enable `vi` mode, so add another line to `~/.zshrc`:
+```
+bindkey -v
+```
+
+Restart your shell and hit the `` key to activate `vicmd` (navigation) mode,
+and start navigating `zsh` with your new keybindings!
+
+## Key bindings for vicmd
+
+| Old | New | Binding | Description |
+|------------|------------|---------------------------|----------------------------------------------------|
+| `CTRL`+`j` | `CTRL`+`n` | accept-line | Insert new line |
+| `j` | `n` | down-line-or-history | Move one line down or command history forwards |
+| `k` | `e` | up-line-or-history | Move one line up or command history backwards |
+| `l` | `i` | vi-forward-char | Move one character to the right |
+| `n` | `k` | vi-repeat-search | Repeat command search forwards |
+| `N` | `K` | vi-rev-repeat-search | Repeat command search backwards |
+| `i` | `u` | vi-insert | Enter insert mode |
+| `I` | `U` | vi-insert-bol | Move to first non-blank char and enter insert mode |
+| `` | `l` | vi-undo-change | Undo change |
+| `J` | `N` | vi-join | Join the current line with the next one |
+| `e` | `j` | vi-forward-word-end | Move to the end of the next word |
+| `E` | `J` | vi-forward-blank-word-end | Move to end of the current or next word |
+
+## Key bindings for less
+
+| Keyboard shortcut | `less` key binding |
+|-------------------|--------------------|
+| `n` | forw-line |
+| `e` | back-line |
+| `k` | repeat-search |
+| `ESC`+`k` | repeat-search-all |
+| `K` | reverse-search |
+| `ESC`+`K` | reverse-search-all |
diff --git a/zsh/plugins/colored-man-pages/README.md b/zsh/plugins/colored-man-pages/README.md
index d9f6acb..f34941e 100644
--- a/zsh/plugins/colored-man-pages/README.md
+++ b/zsh/plugins/colored-man-pages/README.md
@@ -8,6 +8,9 @@ To use it, add `colored-man-pages` to the plugins array in your zshrc file:
plugins=(... colored-man-pages)
```
+It will also automatically colorize man pages displayed by `dman` or `debman`,
+from [`debian-goodies`](https://packages.debian.org/stable/debian-goodies).
+
You can also try to color other pages by prefixing the respective command with `colored`:
```zsh
diff --git a/zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh
index ac6a946..ec51847 100644
--- a/zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh
+++ b/zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh
@@ -17,7 +17,7 @@ EOF
fi
function colored() {
- env \
+ command env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
@@ -31,6 +31,9 @@ function colored() {
"$@"
}
-function man() {
- colored man "$@"
+# Colorize man and dman/debman (from debian-goodies)
+function man \
+ dman \
+ debman {
+ colored $0 "$@"
}
diff --git a/zsh/plugins/colorize/README.md b/zsh/plugins/colorize/README.md
index d1f878e..405bb6d 100644
--- a/zsh/plugins/colorize/README.md
+++ b/zsh/plugins/colorize/README.md
@@ -6,30 +6,51 @@ Colorize will highlight the content based on the filename extension. If it can't
method for a given extension, it will try to find one by looking at the file contents. If no highlight method
is found it will just cat the file normally, without syntax highlighting.
-To use it, add colorize to the plugins array of your zshrc file:
+## Setup
+
+To use it, add colorize to the plugins array of your `~/.zshrc` file:
```
plugins=(... colorize)
```
-## Styles
+## Configuration
+
+### Requirements
+
+This plugin requires that at least one of the following tools is installed:
+
+* [Chroma](https://github.com/alecthomas/chroma)
+* [Pygments](https://pygments.org/download/)
+
+### Colorize tool
+
+Colorize supports `pygmentize` and `chroma` as syntax highlighter. By default colorize uses `pygmentize` unless it's not installed and `chroma` is. This can be overridden by the `ZSH_COLORIZE_TOOL` environment variable:
+
+```
+ZSH_COLORIZE_TOOL=chroma
+```
+
+### Styles
Pygments offers multiple styles. By default, the `default` style is used, but you can choose another theme by setting the `ZSH_COLORIZE_STYLE` environment variable:
-`ZSH_COLORIZE_STYLE="colorful"`
+```
+ZSH_COLORIZE_STYLE="colorful"
+```
+
+### Chroma Formatter Settings
+
+Chroma supports terminal output in 8 color, 256 color, and true-color. If you need to change the default terminal output style from the standard 8 color output, set the `ZSH_COLORIZE_CHROMA_FORMATTER` environment variable:
+
+```
+ZSH_COLORIZE_CHROMA_FORMATTER=terminal256
+```
## Usage
-* `ccat [files]`: colorize the contents of the file (or files, if more than one are provided).
- If no arguments are passed it will colorize the standard input or stdin.
+* `ccat [files]`: colorize the contents of the file (or files, if more than one are provided).
+ If no files are passed it will colorize the standard input.
-* `cless [files]`: colorize the contents of the file (or files, if more than one are provided) and
- open less. If no arguments are passed it will colorize the standard input or stdin.
-
-Note that `cless` will behave as less when provided more than one file: you have to navigate files with
-the commands `:n` for next and `:p` for previous. The downside is that less options are not supported.
-But you can circumvent this by either using the LESS environment variable, or by running `ccat file1 file2|less --opts`.
-In the latter form, the file contents will be concatenated and presented by less as a single file.
-
-## Requirements
-
-You have to install Pygments first: [pygments.org](http://pygments.org/download/)
+* `cless [less-options] [files]`: colorize the contents of the file (or files, if more than one are provided) and open less.
+ If no files are passed it will colorize the standard input.
+ The LESSOPEN and LESSCLOSE will be overwritten for this to work, but only in a local scope.
diff --git a/zsh/plugins/colorize/colorize.plugin.zsh b/zsh/plugins/colorize/colorize.plugin.zsh
index 565ba5a..80b6919 100644
--- a/zsh/plugins/colorize/colorize.plugin.zsh
+++ b/zsh/plugins/colorize/colorize.plugin.zsh
@@ -1,57 +1,113 @@
-# easier alias to use the plugin
-alias ccat='colorize_via_pygmentize'
-alias cless='colorize_via_pygmentize_less'
+# Easier alias to use the plugin
+alias ccat="colorize_cat"
+alias cless="colorize_less"
-colorize_via_pygmentize() {
- if ! (( $+commands[pygmentize] )); then
- echo "package 'Pygments' is not installed!"
+# '$0:A' gets the absolute path of this file
+ZSH_COLORIZE_PLUGIN_PATH=$0:A
+
+colorize_check_requirements() {
+ local available_tools=("chroma" "pygmentize")
+
+ if [ -z "$ZSH_COLORIZE_TOOL" ]; then
+ if (( $+commands[pygmentize] )); then
+ ZSH_COLORIZE_TOOL="pygmentize"
+ elif (( $+commands[chroma] )); then
+ ZSH_COLORIZE_TOOL="chroma"
+ else
+ echo "Neither 'pygments' nor 'chroma' is installed!" >&2
+ return 1
+ fi
+ fi
+
+ if [[ ${available_tools[(Ie)$ZSH_COLORIZE_TOOL]} -eq 0 ]]; then
+ echo "ZSH_COLORIZE_TOOL '$ZSH_COLORIZE_TOOL' not recognized. Available options are 'pygmentize' and 'chroma'." >&2
+ return 1
+ elif (( $+commands["$ZSH_COLORIZE_TOOL"] )); then
+ echo "Package '$ZSH_COLORIZE_TOOL' is not installed!" >&2
+ return 1
+ fi
+}
+
+colorize_cat() {
+ if ! colorize_check_requirements; then
return 1
fi
- # If the environment varianle ZSH_COLORIZE_STYLE
+ # If the environment variable ZSH_COLORIZE_STYLE
# is set, use that theme instead. Otherwise,
# use the default.
- if [ -z $ZSH_COLORIZE_STYLE ]; then
- ZSH_COLORIZE_STYLE="default"
+ if [ -z "$ZSH_COLORIZE_STYLE" ]; then
+ # Both pygmentize & chroma support 'emacs'
+ ZSH_COLORIZE_STYLE="emacs"
fi
- # pygmentize stdin if no arguments passed
+ # Use stdin if no arguments have been passed.
if [ $# -eq 0 ]; then
- pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
+ if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
+ pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
+ else
+ chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}"
+ fi
return $?
fi
- # guess lexer from file extension, or
- # guess it from file contents if unsuccessful
-
+ # Guess lexer from file extension, or guess it from file contents if unsuccessful.
local FNAME lexer
- for FNAME in "$@"
- do
- lexer=$(pygmentize -N "$FNAME")
- if [[ $lexer != text ]]; then
- pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME"
+ for FNAME in "$@"; do
+ if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
+ lexer=$(pygmentize -N "$FNAME")
+ if [[ $lexer != text ]]; then
+ pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME"
+ else
+ pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
+ fi
else
- pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
+ chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}" "$FNAME"
fi
done
}
-colorize_via_pygmentize_less() (
- # this function is a subshell so tmp_files can be shared to cleanup function
- declare -a tmp_files
+# The less option 'F - Forward forever; like "tail -f".' will not work in this implementation
+# caused by the lack of the ability to follow the file within pygmentize.
+colorize_less() {
+ if ! colorize_check_requirements; then
+ return 1
+ fi
- cleanup () {
- [[ ${#tmp_files} -gt 0 ]] && rm -f "${tmp_files[@]}"
- exit
+ _cless() {
+ # LESS="-R $LESS" enables raw ANSI colors, while maintain already set options.
+ local LESS="-R $LESS"
+
+ # This variable tells less to pipe every file through the specified command
+ # (see the man page of less INPUT PREPROCESSOR).
+ # 'zsh -ic "colorize_cat %s 2> /dev/null"' would not work for huge files like
+ # the ~/.zsh_history. For such files the tty of the preprocessor will be supended.
+ # Therefore we must source this file to make colorize_cat available in the
+ # preprocessor without the interactive mode.
+ # `2>/dev/null` will suppress the error for large files 'broken pipe' of the python
+ # script pygmentize, which will show up if less has not fully "loaded the file"
+ # (e.g. when not scrolled to the bottom) while already the next file will be displayed.
+ local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \
+ ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \
+ colorize_cat %s 2> /dev/null'"
+
+ # LESSCLOSE will be set to prevent any errors by executing a user script
+ # which assumes that his LESSOPEN has been executed.
+ local LESSCLOSE=""
+
+ LESS="$LESS" LESSOPEN="$LESSOPEN" LESSCLOSE="$LESSCLOSE" less "$@"
}
- trap 'cleanup' EXIT HUP TERM INT
- while (( $# != 0 )); do #TODO: filter out less opts
- tmp_file="$(mktemp -t "tmp.colorize.XXXX.$(sed 's/\//./g' <<< "$1")")"
- tmp_files+=("$tmp_file")
- colorize_via_pygmentize "$1" > "$tmp_file"
- shift 1
- done
-
- less -f "${tmp_files[@]}"
-)
+ if [ -t 0 ]; then
+ _cless "$@"
+ else
+ # The input is not associated with a terminal, therefore colorize_cat will
+ # colorize this input and pass it to less.
+ # Less has now to decide what to use. If any files have been provided, less
+ # will ignore the input by default, otherwise the colorized input will be used.
+ # If files have been supplied and the input has been redirected, this will
+ # lead to unnecessary overhead, but retains the ability to use the less options
+ # without checking for them inside this script.
+ colorize_cat | _cless "$@"
+ fi
+}
diff --git a/zsh/plugins/command-not-found/command-not-found.plugin.zsh b/zsh/plugins/command-not-found/command-not-found.plugin.zsh
index dd1186e..81d76e6 100644
--- a/zsh/plugins/command-not-found/command-not-found.plugin.zsh
+++ b/zsh/plugins/command-not-found/command-not-found.plugin.zsh
@@ -26,10 +26,8 @@ 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
+if [[ -s '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh' ]]; then
+ source '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh'
fi
# NixOS command-not-found support
diff --git a/zsh/plugins/common-aliases/common-aliases.plugin.zsh b/zsh/plugins/common-aliases/common-aliases.plugin.zsh
index 785a09c..a9d4f1a 100644
--- a/zsh/plugins/common-aliases/common-aliases.plugin.zsh
+++ b/zsh/plugins/common-aliases/common-aliases.plugin.zsh
@@ -13,7 +13,7 @@ alias lS='ls -1FSsh'
alias lart='ls -1Fcart'
alias lrt='ls -1Fcrt'
-alias zshrc='${=EDITOR} ~/.zshrc' # Quick access to the ~/.zshrc file
+alias zshrc='${=EDITOR} ${ZDOTDIR:-$HOME}/.zshrc' # Quick access to the .zshrc file
alias grep='grep --color'
alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
@@ -50,19 +50,20 @@ alias mv='mv -i'
# zsh is able to auto-do some kungfoo
# depends on the SUFFIX :)
+autoload -Uz is-at-least
if is-at-least 4.2.0; then
# open browser on urls
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
+ 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
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
+ for ft in $_image_fts; do alias -s $ft='$XIVIEWER'; done
fi
_media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm)
diff --git a/zsh/plugins/compleat/README.md b/zsh/plugins/compleat/README.md
new file mode 100644
index 0000000..af0e383
--- /dev/null
+++ b/zsh/plugins/compleat/README.md
@@ -0,0 +1,9 @@
+# compleat plugin
+
+This plugin looks for [compleat](https://github.com/mbrubeck/compleat) and loads its completion.
+
+To use it, add compleat to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... compleat)
+```
diff --git a/zsh/plugins/composer/README.md b/zsh/plugins/composer/README.md
index 2b4bae5..7a5f725 100644
--- a/zsh/plugins/composer/README.md
+++ b/zsh/plugins/composer/README.md
@@ -12,18 +12,20 @@ plugins=(... composer)
## Aliases
-| Alias | Command | Description |
-| ------ | -------------------------------------------- | -------------------------------------------------------------------------------------- |
-| `c` | composer | Starts composer |
-| `csu` | composer self-update | Updates composer to the latest version |
-| `cu` | composer update | Updates composer dependencies and `composer.lock` file |
-| `cr` | composer require | Adds new packages to `composer.json` |
-| `crm` | composer remove | Removes packages from `composer.json` |
-| `ci` | composer install | Resolves and installs dependencies from `composer.json` |
-| `ccp` | composer create-project | Create new project from an existing package |
-| `cdu` | composer dump-autoload | Updates the autoloader |
-| `cdo` | composer dump-autoload --optimize-autoloader | Converts PSR-0/4 autoloading to classmap for a faster autoloader (good for production) |
-| `cgu` | composer global update | Allows update command to run on COMPOSER_HOME directory |
-| `cgr` | composer global require | Allows require command to run on COMPOSER_HOME directory |
-| `cgrm` | composer global remove | Allows remove command to run on COMPOSER_HOME directory |
-| `cget` | `curl -s https://getcomposer.org/installer` | Installs composer in the current directory |
+| Alias | Command | Description |
+| ------ | ------------------------------------------- | --------------------------------------------------------------------------------------- |
+| `c` | `composer` | Starts composer |
+| `csu` | `composer self-update` | Updates composer to the latest version |
+| `cu` | `composer update` | Updates composer dependencies and `composer.lock` file |
+| `cr` | `composer require` | Adds new packages to `composer.json` |
+| `crm` | `composer remove` | Removes packages from `composer.json` |
+| `ci` | `composer install` | Resolves and installs dependencies from `composer.json` |
+| `ccp` | `composer create-project` | Create new project from an existing package |
+| `cdu` | `composer dump-autoload` | Updates the autoloader |
+| `cdo` | `composer dump-autoload -o` | Converts PSR-0/4 autoloading to classmap for a faster autoloader (good for production) |
+| `cgu` | `composer global update` | Allows update command to run on COMPOSER_HOME directory |
+| `cgr` | `composer global require` | Allows require command to run on COMPOSER_HOME directory |
+| `cgrm` | `composer global remove` | Allows remove command to run on COMPOSER_HOME directory |
+| `cget` | `curl -s https://getcomposer.org/installer` | Installs composer in the current directory |
+| `co` | `composer outdated` | Shows a list of installed packages with available updates |
+| `cod` | `composer outdated --direct` | Shows a list of installed packages with available updates which are direct dependencies |
diff --git a/zsh/plugins/composer/composer.plugin.zsh b/zsh/plugins/composer/composer.plugin.zsh
index 6349610..75b03ff 100644
--- a/zsh/plugins/composer/composer.plugin.zsh
+++ b/zsh/plugins/composer/composer.plugin.zsh
@@ -15,20 +15,16 @@ _composer_get_required_list () {
}
_composer () {
- local curcontext="$curcontext" state line
- typeset -A opt_args
- _arguments \
- '1: :->command'\
- '*: :->args'
+ local curcontext="$curcontext" state line
+ typeset -A opt_args
+ _arguments \
+ '*:: :->subcmds'
- case $state in
- command)
- compadd $(_composer_get_command_list)
- ;;
- *)
- compadd $(_composer_get_required_list)
- ;;
- esac
+ if (( CURRENT == 1 )) || ( ((CURRENT == 2)) && [ "$words[1]" = "global" ] ) ; then
+ compadd $(_composer_get_command_list)
+ else
+ compadd $(_composer_get_required_list)
+ fi
}
compdef _composer composer
@@ -43,17 +39,31 @@ 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 cdo='composer dump-autoload -o'
alias cgu='composer global update'
alias cgr='composer global require'
alias cgrm='composer global remove'
+alias co='composer outdated'
+alias cod='composer outdated --direct'
# install composer in the current directory
alias cget='curl -s https://getcomposer.org/installer | php'
# Add Composer's global binaries to PATH, using Composer if available.
if (( $+commands[composer] )); then
- export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null)
+ autoload -Uz _store_cache _retrieve_cache
+
+ _retrieve_cache composer
+
+ if [[ -z $__composer_bin_dir ]]; then
+ __composer_bin_dir=$(composer global config bin-dir --absolute 2>/dev/null)
+ _store_cache composer __composer_bin_dir
+ fi
+
+ # Add Composer's global binaries to PATH
+ export PATH="$PATH:$__composer_bin_dir"
+
+ unset __composer_bin_dir
else
[ -d $HOME/.composer/vendor/bin ] && export PATH=$PATH:$HOME/.composer/vendor/bin
[ -d $HOME/.config/composer/vendor/bin ] && export PATH=$PATH:$HOME/.config/composer/vendor/bin
diff --git a/zsh/plugins/copybuffer/copybuffer.plugin.zsh b/zsh/plugins/copybuffer/copybuffer.plugin.zsh
index cc205d4..483ed5a 100644
--- a/zsh/plugins/copybuffer/copybuffer.plugin.zsh
+++ b/zsh/plugins/copybuffer/copybuffer.plugin.zsh
@@ -1,9 +1,9 @@
# copy the active line from the command line buffer
-# onto the system clipboard (requires clipcopy plugin)
+# onto the system clipboard
copybuffer () {
if which clipcopy &>/dev/null; then
- echo $BUFFER | clipcopy
+ printf "%s" "$BUFFER" | clipcopy
else
echo "clipcopy function not found. Please make sure you have Oh My Zsh installed correctly."
fi
diff --git a/zsh/plugins/copyfile/README.md b/zsh/plugins/copyfile/README.md
index 53138ad..a110b83 100644
--- a/zsh/plugins/copyfile/README.md
+++ b/zsh/plugins/copyfile/README.md
@@ -3,7 +3,8 @@
Puts the contents of a file in your system clipboard so you can paste it anywhere.
To use, add `copyfile` to your plugins array:
-```
+
+```zsh
plugins=(... copyfile)
```
diff --git a/zsh/plugins/cpanm/README.md b/zsh/plugins/cpanm/README.md
index 3803e3e..13e93d0 100644
--- a/zsh/plugins/cpanm/README.md
+++ b/zsh/plugins/cpanm/README.md
@@ -1,9 +1,9 @@
# Cpanm
This plugin provides completion for [Cpanm](https://github.com/miyagawa/cpanminus) ([docs](https://metacpan.org/pod/App::cpanminus)).
-
+
To use it add cpanm to the plugins array in your zshrc file.
-
- ```bash
+
+```zsh
plugins=(... cpanm)
```
diff --git a/zsh/plugins/dash/README.md b/zsh/plugins/dash/README.md
new file mode 100644
index 0000000..0ca3e4e
--- /dev/null
+++ b/zsh/plugins/dash/README.md
@@ -0,0 +1,28 @@
+# Dash plugin
+
+This plugin adds command line functionality for [Dash](https://kapeli.com/dash),
+an API Documentation Browser for macOS. This plugin requires Dash to be installed
+to work.
+
+To use it, add `dash` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... dash)
+```
+
+## Usage
+
+- Open and switch to the dash application.
+```
+dash
+```
+
+- Query for something in dash app: `dash query`
+```
+dash golang
+```
+
+- You can optionally provide a keyword: `dash [keyword:]query`
+```
+dash python:tuple
+```
diff --git a/zsh/plugins/dash/dash.plugin.zsh b/zsh/plugins/dash/dash.plugin.zsh
index b00d487..ace2e33 100644
--- a/zsh/plugins/dash/dash.plugin.zsh
+++ b/zsh/plugins/dash/dash.plugin.zsh
@@ -35,36 +35,30 @@ _dash() {
if [[ "$locator" == "platform" ]]; then
# Since these are the only special cases right now, let's not do the
# expensive processing unless we have to
- if [[ "$keyword" == "python" || "$keyword" == "java" || \
- "$keyword" == "qt" || "$keyword" == "cocs2d" ]]; then
+ if [[ "$keyword" = (python|java|qt|cocos2d) ]]; then
docsetName=`echo $doc | grep -Eo "docsetName = .*?;" | sed -e "s/docsetName = \(.*\);/\1/" -e "s/[\":]//g"`
- if [[ "$keyword" == "python" ]]; then
- if [[ "$docsetName" == "Python 2" ]]; then
- keyword="python2"
- elif [[ "$docsetName" == "Python 3" ]]; then
- keyword="python3"
- fi
- elif [[ "$keyword" == "java" ]]; then
- if [[ "$docsetName" == "Java SE7" ]]; then
- keyword="java7"
- elif [[ "$docsetName" == "Java SE6" ]]; then
- keyword="java6"
- elif [[ "$docsetName" == "Java SE8" ]]; then
- keyword="java8"
- fi
- elif [[ "$keyword" == "qt" ]]; then
- if [[ "$docsetName" == "Qt 5" ]]; then
- keyword="qt5"
- elif [[ "$docsetName" == "Qt 4" ]]; then
- keyword="qt4"
- elif [[ "$docsetName" == "Qt" ]]; then
- keyword="qt4"
- fi
- elif [[ "$keyword" == "cocos2d" ]]; then
- if [[ "$docsetName" == "Cocos3D" ]]; then
- keyword="cocos3d"
- fi
- fi
+ case "$keyword" in
+ python)
+ case "$docsetName" in
+ "Python 2") keyword="python2" ;;
+ "Python 3") keyword="python3" ;;
+ esac ;;
+ java)
+ case "$docsetName" in
+ "Java SE7") keyword="java7" ;;
+ "Java SE6") keyword="java6" ;;
+ "Java SE8") keyword="java8" ;;
+ esac ;;
+ qt)
+ case "$docsetName" in
+ "Qt 5") keyword="qt5" ;;
+ "Qt 4"|Qt) keyword="qt4" ;;
+ esac ;;
+ cocos2d)
+ case "$docsetName" in
+ Cocos3D) keyword="cocos3d" ;;
+ esac ;;
+ esac
fi
fi
diff --git a/zsh/plugins/dircycle/README.md b/zsh/plugins/dircycle/README.md
index 3ac162f..3c9b3a9 100644
--- a/zsh/plugins/dircycle/README.md
+++ b/zsh/plugins/dircycle/README.md
@@ -15,10 +15,10 @@ This plugin enables directory navigation similar to using back and forward on br
)
```
-2. Reload the source file or restart your Terminal session:
+2. Restart the shell or restart your Terminal session:
```console
- $ source ~/.zshrc
+ $ exec zsh
$
```
diff --git a/zsh/plugins/direnv/README.md b/zsh/plugins/direnv/README.md
new file mode 100644
index 0000000..8deaf38
--- /dev/null
+++ b/zsh/plugins/direnv/README.md
@@ -0,0 +1,15 @@
+# direnv plugin
+
+This plugin creates the [Direnv](https://direnv.net/) hook.
+
+To use it, add `direnv` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... direnv)
+```
+
+## Requirements
+
+In order to make this work, you will need to have the direnv installed.
+
+More info on the usage and install: https://github.com/direnv/direnv
diff --git a/zsh/plugins/direnv/direnv.plugin.zsh b/zsh/plugins/direnv/direnv.plugin.zsh
new file mode 100644
index 0000000..5e32c4c
--- /dev/null
+++ b/zsh/plugins/direnv/direnv.plugin.zsh
@@ -0,0 +1,16 @@
+# Don't continue if direnv is not found
+command -v direnv &>/dev/null || return
+
+_direnv_hook() {
+ trap -- '' SIGINT;
+ eval "$(direnv export zsh)";
+ trap - SIGINT;
+}
+typeset -ag precmd_functions;
+if [[ -z ${precmd_functions[(r)_direnv_hook]} ]]; then
+ precmd_functions=( _direnv_hook ${precmd_functions[@]} )
+fi
+typeset -ag chpwd_functions;
+if [[ -z ${chpwd_functions[(r)_direnv_hook]} ]]; then
+ chpwd_functions=( _direnv_hook ${chpwd_functions[@]} )
+fi
diff --git a/zsh/plugins/dirhistory/README.md b/zsh/plugins/dirhistory/README.md
index 511f2be..2236507 100644
--- a/zsh/plugins/dirhistory/README.md
+++ b/zsh/plugins/dirhistory/README.md
@@ -7,6 +7,7 @@ To use it, add `dirhistory` to the plugins array in your zshrc file:
```zsh
plugins=(... dirhistory)
```
+
## Keyboard Shortcuts
| Shortcut | Description |
@@ -15,3 +16,24 @@ plugins=(... dirhistory)
| alt + right | Undo alt + left |
| alt + up | Move into the parent directory |
| alt + down | Move into the first child directory by alphabetical order |
+
+## Usage
+
+This plugin allows you to navigate the history of previous current-working-directories using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT. MAC users may alternately use OPT-LEFT and OPT-RIGHT.
+
+Also, navigate directory **hierarchy** using ALT-UP and ALT-DOWN. (mac keybindings not yet implemented). ALT-UP moves to higher hierarchy (shortcut for 'cd ..'). ALT-DOWN moves into the first directory found in alphabetical order (useful to navigate long empty directories e.g. java packages)
+
+For example, if the shell was started, and the following commands were entered:
+
+```shell
+cd ~
+cd /usr
+cd share
+cd doc
+```
+
+Then entering ALT-LEFT at the prompt would change directory from /usr/share/doc to /usr/share, then if pressed again to /usr/, then ~. If ALT-RIGHT were pressed the directory would be changed to /usr/ again.
+
+After that, ALT-DOWN will probably go to /usr/bin (depends on your /usr structure), ALT-UP will return to /usr, then ALT-UP will get you to /
+
+**Currently the max history size is 30**. The navigation should work for xterm, PuTTY xterm mode, GNU screen, and on MAC with alternate keys as mentioned above.
diff --git a/zsh/plugins/dirhistory/dirhistory.plugin.zsh b/zsh/plugins/dirhistory/dirhistory.plugin.zsh
index 239915e..35c43d7 100644
--- a/zsh/plugins/dirhistory/dirhistory.plugin.zsh
+++ b/zsh/plugins/dirhistory/dirhistory.plugin.zsh
@@ -53,7 +53,8 @@ function push_future() {
}
# Called by zsh when directory changes
-chpwd_functions+=(chpwd_dirhistory)
+autoload -U add-zsh-hook
+add-zsh-hook chpwd chpwd_dirhistory
function chpwd_dirhistory() {
push_past $PWD
# If DIRHISTORY_CD is not set...
diff --git a/zsh/plugins/dirpersist/README.md b/zsh/plugins/dirpersist/README.md
index 9880bc5..792fb4b 100644
--- a/zsh/plugins/dirpersist/README.md
+++ b/zsh/plugins/dirpersist/README.md
@@ -1,6 +1,7 @@
# Dirpersist plugin
-This plugin keeps a running tally of the previous 20 unique directories in the $HOME/.zdirs file. When you cd to a new directory, it is prepended to the beginning of the file.
+This plugin keeps a running tally of the previous 20 unique directories in the `$HOME/.zdirs` file.
+When you cd to a new directory, it is prepended to the beginning of the file.
To use it, add `dirpersist` to the plugins array in your zshrc file:
diff --git a/zsh/plugins/dirpersist/dirpersist.plugin.zsh b/zsh/plugins/dirpersist/dirpersist.plugin.zsh
index 616e2c3..daadc38 100644
--- a/zsh/plugins/dirpersist/dirpersist.plugin.zsh
+++ b/zsh/plugins/dirpersist/dirpersist.plugin.zsh
@@ -11,7 +11,8 @@ if [[ -f ${dirstack_file} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then
[[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD
fi
-chpwd_functions+=(chpwd_dirpersist)
+autoload -U add-zsh-hook
+add-zsh-hook chpwd chpwd_dirpersist
chpwd_dirpersist() {
if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi
local -ax my_stack
diff --git a/zsh/plugins/django/README.md b/zsh/plugins/django/README.md
index 415f6b7..1740e55 100644
--- a/zsh/plugins/django/README.md
+++ b/zsh/plugins/django/README.md
@@ -34,23 +34,3 @@ runfcgi -- run this project as a fastcgi
runserver -- start a lightweight web server for development
...
```
-
-If you want to see the options available for a specific command, try:
-
-```zsh
-$> python manage.py makemessages (press here)
-```
-
-And that would result in:
-
-```zsh
---all -a -- re-examine all code and templates
---domain -d -- domain of the message files (default: "django")
---extensions -e -- file extension(s) to examine (default: ".html")
---help -- display help information
---locale -l -- locale to process (default: all)
---pythonpath -- directory to add to the Python path
---settings -- python path to settings module
-...
-```
-
diff --git a/zsh/plugins/django/django.plugin.zsh b/zsh/plugins/django/django.plugin.zsh
index 86558ff..c2d00c1 100644
--- a/zsh/plugins/django/django.plugin.zsh
+++ b/zsh/plugins/django/django.plugin.zsh
@@ -374,7 +374,8 @@ _managepy-commands() {
_applist() {
local line
local -a apps
- _call_program help-command "python -c \"import os.path as op, re, django.conf, sys;\\
+ _call_program help-command "python -c \"import sys; del sys.path[0];\\
+ import os.path as op, re, django.conf;\\
bn=op.basename(op.abspath(op.curdir));[sys\\
.stdout.write(str(re.sub(r'^%s\.(.*?)$' %
bn, r'\1', i)) + '\n') for i in django.conf.settings.\\
diff --git a/zsh/plugins/dnf/README.md b/zsh/plugins/dnf/README.md
index f9ef496..dc0d1e0 100644
--- a/zsh/plugins/dnf/README.md
+++ b/zsh/plugins/dnf/README.md
@@ -1,10 +1,14 @@
-## Description
+# dnf plugin
-This plugin makes `dnf` usage easier by adding aliases for the most
-common commands.
+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`.
+`dnf` is the new package manager for RPM-based distributions, which replaces `yum`.
+
+To use it, add `dnf` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... dnf)
+```
## Aliases
diff --git a/zsh/plugins/docker-compose/README.md b/zsh/plugins/docker-compose/README.md
index 07a87bc..a81c2c7 100644
--- a/zsh/plugins/docker-compose/README.md
+++ b/zsh/plugins/docker-compose/README.md
@@ -4,7 +4,8 @@ This plugin provides completion for [docker-compose](https://docs.docker.com/com
aliases for frequent docker-compose commands.
To use it, add docker-compose to the plugins array of your zshrc file:
-```
+
+```zsh
plugins=(... docker-compose)
```
@@ -27,3 +28,4 @@ plugins=(... docker-compose)
| dclf | `docker-compose logs -f` | Show logs and follow output |
| dcpull | `docker-compose pull` | Pull image of a service |
| dcstart | `docker-compose start` | Start a container |
+| dck | `docker-compose kill` | Kills containers |
diff --git a/zsh/plugins/docker-compose/docker-compose.plugin.zsh b/zsh/plugins/docker-compose/docker-compose.plugin.zsh
index 9ffe1ed..5b25b63 100644
--- a/zsh/plugins/docker-compose/docker-compose.plugin.zsh
+++ b/zsh/plugins/docker-compose/docker-compose.plugin.zsh
@@ -24,3 +24,4 @@ alias dcl='docker-compose logs'
alias dclf='docker-compose logs -f'
alias dcpull='docker-compose pull'
alias dcstart='docker-compose start'
+alias dck='docker-compose kill'
diff --git a/zsh/plugins/docker/README.md b/zsh/plugins/docker/README.md
index e917984..fab7aa8 100644
--- a/zsh/plugins/docker/README.md
+++ b/zsh/plugins/docker/README.md
@@ -1,5 +1,34 @@
-## Docker autocomplete plugin
+# Docker plugin
-A copy of the completion script from the
-[docker/cli](https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker)
-git repo.
+This plugin adds auto-completion for [docker](https://www.docker.com/).
+
+To use it add `docker` to the plugins array in your zshrc file.
+
+```zsh
+plugins=(... docker)
+```
+
+A copy of the completion script from the docker/cli git repo:
+https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker
+
+## Settings
+
+By default, the completion doesn't allow option-stacking, meaning if you try to
+complete `docker run -it ` it won't work, because you're _stacking_ the
+`-i` and `-t` options.
+
+[You can enable it](https://github.com/docker/cli/commit/b10fb43048) by **adding
+the lines below to your zshrc file**, but be aware of the side effects:
+
+> This enables Zsh to understand commands like `docker run -it
+> ubuntu`. However, by enabling this, this also makes Zsh complete
+> `docker run -u` with `docker run -uapprox` which is not valid. The
+> users have to put the space or the equal sign themselves before trying
+> to complete.
+>
+> Therefore, this behavior is disabled by default. To enable it:
+>
+> ```
+> zstyle ':completion:*:*:docker:*' option-stacking yes
+> zstyle ':completion:*:*:docker-*:*' option-stacking yes
+> ```
diff --git a/zsh/plugins/docker/_docker b/zsh/plugins/docker/_docker
index 54b5e59..10c19e2 100644
--- a/zsh/plugins/docker/_docker
+++ b/zsh/plugins/docker/_docker
@@ -9,6 +9,7 @@
# - Felix Riedel
# - Steve Durrheimer
# - Vincent Bernat
+# - Rohan Verma
#
# license:
#
@@ -604,6 +605,7 @@ __docker_container_subcommand() {
"($help)*--blkio-weight-device=[Block IO (relative device weight)]:device:Block IO weight: "
"($help)*--cap-add=[Add Linux capabilities]:capability: "
"($help)*--cap-drop=[Drop Linux capabilities]:capability: "
+ "($help)--cgroupns=[Cgroup namespace mode to use]:cgroup namespace mode: "
"($help)--cgroup-parent=[Parent cgroup for the container]:cgroup: "
"($help)--cidfile=[Write the container ID to the file]:CID file:_files"
"($help)--cpus=[Number of CPUs (default 0.000)]:cpus: "
@@ -676,6 +678,7 @@ __docker_container_subcommand() {
"($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: "
"($help)--memory-reservation=[Memory soft limit]:Memory limit: "
"($help)--memory-swap=[Total memory limit with swap]:Memory limit: "
+ "($help)--pids-limit[Tune container pids limit (set -1 for unlimited)]"
"($help)--restart=[Restart policy]:restart policy:(no on-failure always unless-stopped)"
)
opts_help=("(: -)--help[Print usage]")
@@ -801,7 +804,7 @@ __docker_container_subcommand() {
"($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \
"($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \
"($help)--no-trunc[Do not truncate output]" \
- "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \
+ "($help -q --quiet)"{-q,--quiet}"[Only show container IDs]" \
"($help -s --size)"{-s,--size}"[Display total file sizes]" \
"($help)--since=[Show only containers created since...]:containers:__docker_complete_containers" && ret=0
;;
@@ -832,7 +835,7 @@ __docker_container_subcommand() {
_arguments $(__docker_arguments) \
$opts_help \
"($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \
- "($help -)*:containers:__docker_complete_containers_ids" && ret=0
+ "($help -)*:containers:__docker_complete_containers" && ret=0
;;
(rm)
local state
@@ -1024,7 +1027,7 @@ __docker_image_subcommand() {
$opts_help \
"($help -H --human)"{-H,--human}"[Print sizes and dates in human readable format]" \
"($help)--no-trunc[Do not truncate output]" \
- "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \
+ "($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \
"($help -)*: :__docker_complete_images" && ret=0
;;
(import)
@@ -1056,7 +1059,7 @@ __docker_image_subcommand() {
"($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_images_filters" \
"($help)--format=[Pretty-print images using a Go template]:template: " \
"($help)--no-trunc[Do not truncate output]" \
- "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \
+ "($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \
"($help -): :__docker_complete_repositories" && ret=0
;;
(prune)
@@ -1076,6 +1079,7 @@ __docker_image_subcommand() {
(push)
_arguments $(__docker_arguments) \
$opts_help \
+ "($help -a --all-tags)"{-a,--all-tags}"[Push all tagged images in the repository]" \
"($help)--disable-content-trust[Skip image signing]" \
"($help -): :__docker_complete_images" && ret=0
;;
@@ -1286,7 +1290,7 @@ __docker_network_subcommand() {
"($help)--no-trunc[Do not truncate the output]" \
"($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_network_complete_ls_filters" \
"($help)--format=[Pretty-print networks using a Go template]:template: " \
- "($help -q --quiet)"{-q,--quiet}"[Only display numeric IDs]" && ret=0
+ "($help -q --quiet)"{-q,--quiet}"[Only display network IDs]" && ret=0
;;
(prune)
_arguments $(__docker_arguments) \
@@ -2214,7 +2218,6 @@ __docker_stack_subcommand() {
(deploy|up)
_arguments $(__docker_arguments) \
$opts_help \
- "($help)--bundle-file=[Path to a Distributed Application Bundle file]:dab:_files -g \"*.dab\"" \
"($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file, or '-' to read from stdin]:compose file:_files -g \"*.(yml|yaml)\"" \
"($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \
"($help -):stack:__docker_complete_stacks" && ret=0
@@ -2668,6 +2671,7 @@ __docker_subcommand() {
"($help)*--log-opt=[Default log driver options for containers]:log driver options:__docker_complete_log_options" \
"($help)--max-concurrent-downloads[Set the max concurrent downloads for each pull]" \
"($help)--max-concurrent-uploads[Set the max concurrent uploads for each push]" \
+ "($help)--max-download-attempts[Set the max download attempts for each pull]" \
"($help)--mtu=[Network MTU]:mtu:(0 576 1420 1500 9000)" \
"($help)--oom-score-adjust=[Set the oom_score_adj for the daemon]:oom-score:(-500)" \
"($help -p --pidfile)"{-p=,--pidfile=}"[Path to use for daemon PID file]:PID file:_files" \
@@ -2783,7 +2787,7 @@ __docker_subcommand() {
$opts_help \
"($help -p --password)"{-p=,--password=}"[Password]:password: " \
"($help)--password-stdin[Read password from stdin]" \
- "($help -u --user)"{-u=,--user=}"[Username]:username: " \
+ "($help -u --username)"{-u=,--username=}"[Username]:username: " \
"($help -)1:server: " && ret=0
;;
(logout)
diff --git a/zsh/plugins/dotenv/README.md b/zsh/plugins/dotenv/README.md
index cac5524..ab9d329 100644
--- a/zsh/plugins/dotenv/README.md
+++ b/zsh/plugins/dotenv/README.md
@@ -4,9 +4,7 @@ Automatically load your project ENV variables from `.env` file when you `cd` int
Storing configuration in the environment is one of the tenets of a [twelve-factor app](https://www.12factor.net). Anything that is likely to change between deployment environments, such as resource handles for databases or credentials for external services, should be extracted from the code into environment variables.
-## Installation
-
-Just add the plugin to your `.zshrc`:
+To use it, add `dotenv` to the plugins array in your zshrc file:
```sh
plugins=(... dotenv)
@@ -17,32 +15,69 @@ plugins=(... dotenv)
Create `.env` file inside your project root directory and put your 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
```
+
You can even mix both formats, although it's probably a bad idea.
+## Settings
+
### ZSH_DOTENV_FILE
You can also modify the name of the file to be loaded with the variable `ZSH_DOTENV_FILE`.
If the variable isn't set, the plugin will default to use `.env`.
For example, this will make the plugin look for files named `.dotenv` and load them:
-```
+```zsh
# in ~/.zshrc, before Oh My Zsh is sourced:
ZSH_DOTENV_FILE=.dotenv
```
+### ZSH_DOTENV_PROMPT
+
+Set `ZSH_DOTENV_PROMPT=false` in your zshrc file if you don't want the confirmation message.
+You can also choose the `Always` option when prompted to always allow sourcing the .env file
+in that directory. See the next section for more details.
+
+### ZSH_DOTENV_ALLOWED_LIST, ZSH_DOTENV_DISALLOWED_LIST
+
+The default behavior of the plugin is to always ask whether to source a dotenv file. There's
+a **Y**es, **N**o, **A**lways and N**e**ver option. If you choose Always, the directory of the .env file
+will be added to an allowed list; if you choose Never, it will be added to a disallowed list.
+If a directory is found in either of those lists, the plugin won't ask for confirmation and will
+instead either source the .env file or proceed without action respectively.
+
+The allowed and disallowed lists are saved by default in `$ZSH_CACHE_DIR/dotenv-allowed.list` and
+`$ZSH_CACHE_DIR/dotenv-disallowed.list` respectively. If you want to change that location,
+change the `$ZSH_DOTENV_ALLOWED_LIST` and `$ZSH_DOTENV_DISALLOWED_LIST` variables, like so:
+
+```zsh
+# in ~/.zshrc, before Oh My Zsh is sourced:
+ZSH_DOTENV_ALLOWED_LIST=/path/to/dotenv/allowed/list
+ZSH_DOTENV_DISALLOWED_LIST=/path/to/dotenv/disallowed/list
+```
+
+The file is just a list of directories, separated by a newline character. If you want
+to change your decision, just edit the file and remove the line for the directory you want to
+change.
+
+NOTE: if a directory is found in both the allowed and disallowed lists, the disallowed list
+takes preference, _i.e._ the .env file will never be sourced.
+
## Version Control
**It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it's supposed to be local only.
@@ -52,5 +87,6 @@ ZSH_DOTENV_FILE=.dotenv
This plugin only sources the `.env` file. Nothing less, nothing more. It doesn't do any checks. It's designed to be the fastest and simplest option. You're responsible for the `.env` file content. You can put some code (or weird symbols) there, but do it on your own risk. `dotenv` is the basic tool, yet it does the job.
If you need more advanced and feature-rich ENV management, check out these awesome projects:
+
* [direnv](https://github.com/direnv/direnv)
* [zsh-autoenv](https://github.com/Tarrasch/zsh-autoenv)
diff --git a/zsh/plugins/dotenv/dotenv.plugin.zsh b/zsh/plugins/dotenv/dotenv.plugin.zsh
index 89763d0..24f285d 100644
--- a/zsh/plugins/dotenv/dotenv.plugin.zsh
+++ b/zsh/plugins/dotenv/dotenv.plugin.zsh
@@ -1,23 +1,54 @@
+## Settings
+
+# Filename of the dotenv file to look for
+: ${ZSH_DOTENV_FILE:=.env}
+
+# Path to the file containing allowed paths
+: ${ZSH_DOTENV_ALLOWED_LIST:="${ZSH_CACHE_DIR:-$ZSH/cache}/dotenv-allowed.list"}
+: ${ZSH_DOTENV_DISALLOWED_LIST:="${ZSH_CACHE_DIR:-$ZSH/cache}/dotenv-disallowed.list"}
+
+
+## Functions
+
source_env() {
if [[ -f $ZSH_DOTENV_FILE ]]; then
+ if [[ "$ZSH_DOTENV_PROMPT" != false ]]; then
+ local confirmation dirpath="${PWD:A}"
+
+ # make sure there is an (dis-)allowed file
+ touch "$ZSH_DOTENV_ALLOWED_LIST"
+ touch "$ZSH_DOTENV_DISALLOWED_LIST"
+
+ # early return if disallowed
+ if grep -q "$dirpath" "$ZSH_DOTENV_DISALLOWED_LIST" &>/dev/null; then
+ return;
+ fi
+
+ # check if current directory's .env file is allowed or ask for confirmation
+ if ! grep -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then
+ # print same-line prompt and output newline character if necessary
+ echo -n "dotenv: found '$ZSH_DOTENV_FILE' file. Source it? ([Y]es/[n]o/[a]lways/n[e]ver) "
+ read -k 1 confirmation; [[ "$confirmation" != $'\n' ]] && echo
+
+ # check input
+ case "$confirmation" in
+ [nN]) return ;;
+ [aA]) echo "$dirpath" >> "$ZSH_DOTENV_ALLOWED_LIST" ;;
+ [eE]) echo "$dirpath" >> "$ZSH_DOTENV_DISALLOWED_LIST"; return ;;
+ *) ;; # interpret anything else as a yes
+ esac
+ fi
+ fi
+
# test .env syntax
zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2
- if [[ -o a ]]; then
- source $ZSH_DOTENV_FILE
- else
- set -a
- source $ZSH_DOTENV_FILE
- set +a
- fi
+ setopt localoptions allexport
+ source $ZSH_DOTENV_FILE
fi
}
autoload -U add-zsh-hook
add-zsh-hook chpwd source_env
-if [[ -z $ZSH_DOTENV_FILE ]]; then
- ZSH_DOTENV_FILE=.env
-fi
-
source_env
diff --git a/zsh/plugins/dotnet/README.md b/zsh/plugins/dotnet/README.md
new file mode 100644
index 0000000..7554b4e
--- /dev/null
+++ b/zsh/plugins/dotnet/README.md
@@ -0,0 +1,23 @@
+# .NET Core CLI plugin
+
+This plugin provides completion and useful aliases for [.NET Core CLI](https://dotnet.microsoft.com/).
+
+To use it, add `dotnet` to the plugins array in your zshrc file.
+
+```
+plugins=(... dotnet)
+```
+
+## Aliases
+
+| Alias | Command | Description |
+|-------|------------------|-------------------------------------------------------------------|
+| dn | dotnet new | Create a new .NET project or file. |
+| dr | dotnet run | Build and run a .NET project output. |
+| dt | dotnet test | Run unit tests using the test runner specified in a .NET project. |
+| dw | dotnet watch | Watch for source file changes and restart the dotnet command. |
+| dwr | dotnet watch run | Watch for source file changes and restart the `run` command. |
+| ds | dotnet sln | Modify Visual Studio solution files. |
+| da | dotnet add | Add a package or reference to a .NET project. |
+| dp | dotnet pack | Create a NuGet package. |
+| dng | dotnet nuget | Provides additional NuGet commands. |
diff --git a/zsh/plugins/dotnet/dotnet.plugin.zsh b/zsh/plugins/dotnet/dotnet.plugin.zsh
new file mode 100644
index 0000000..6bd4b7a
--- /dev/null
+++ b/zsh/plugins/dotnet/dotnet.plugin.zsh
@@ -0,0 +1,32 @@
+# This scripts is copied from (MIT License):
+# https://github.com/dotnet/toolset/blob/master/scripts/register-completions.zsh
+
+_dotnet_zsh_complete()
+{
+ local completions=("$(dotnet complete "$words")")
+
+ # If the completion list is empty, just continue with filename selection
+ if [ -z "$completions" ]
+ then
+ _arguments '*::arguments: _normal'
+ return
+ fi
+
+ # This is not a variable assigment, don't remove spaces!
+ _values = "${(ps:\n:)completions}"
+}
+
+compdef _dotnet_zsh_complete dotnet
+
+# Aliases bellow are here for backwards compatibility
+# added by Shaun Tabone (https://github.com/xontab)
+
+alias dn='dotnet new'
+alias dr='dotnet run'
+alias dt='dotnet test'
+alias dw='dotnet watch'
+alias dwr='dotnet watch run'
+alias ds='dotnet sln'
+alias da='dotnet add'
+alias dp='dotnet pack'
+alias dng='dotnet nuget'
diff --git a/zsh/plugins/eecms/README.md b/zsh/plugins/eecms/README.md
new file mode 100644
index 0000000..c538355
--- /dev/null
+++ b/zsh/plugins/eecms/README.md
@@ -0,0 +1,11 @@
+# eecms plugin
+
+This plugin adds auto-completion of console commands for [`eecms`](https://github.com/ExpressionEngine/ExpressionEngine).
+
+To use it, add `eecms` to the plugins array of your `.zshrc` file:
+```
+plugins=(... eecms)
+```
+
+It also adds the alias `eecms` which finds the eecms file in the current project
+and runs it with php.
diff --git a/zsh/plugins/emacs/emacs.plugin.zsh b/zsh/plugins/emacs/emacs.plugin.zsh
index db0ab13..0b602d1 100644
--- a/zsh/plugins/emacs/emacs.plugin.zsh
+++ b/zsh/plugins/emacs/emacs.plugin.zsh
@@ -26,6 +26,16 @@ if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then
# create a new X frame
alias eframe='emacsclient --alternate-editor "" --create-frame'
+ # Emacs ANSI Term tracking
+ if [[ -n "$INSIDE_EMACS" ]]; then
+ chpwd_emacs() { print -P "\033AnSiTc %d"; }
+ print -P "\033AnSiTc %d" # Track current working directory
+ print -P "\033AnSiTu %n" # Track username
+
+ # add chpwd hook
+ autoload -Uz add-zsh-hook
+ add-zsh-hook chpwd chpwd_emacs
+ fi
# Write to standard output the path to the file
# opened in the current buffer.
diff --git a/zsh/plugins/emacs/emacsclient.sh b/zsh/plugins/emacs/emacsclient.sh
index 26b28d4..0aa8d6f 100755
--- a/zsh/plugins/emacs/emacsclient.sh
+++ b/zsh/plugins/emacs/emacsclient.sh
@@ -20,7 +20,8 @@ _emacsfun()
# 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)"
+ tempfile="$(mktemp --tmpdir emacs-stdin-$USER.XXXXXXX 2>/dev/null \
+ || mktemp -t emacs-stdin-$USER)" # support BSD mktemp
cat - > "$tempfile"
_emacsfun --no-wait $tempfile
else
diff --git a/zsh/plugins/emoji-clock/emoji-clock.plugin.zsh b/zsh/plugins/emoji-clock/emoji-clock.plugin.zsh
index 0a55528..bdd606f 100644
--- a/zsh/plugins/emoji-clock/emoji-clock.plugin.zsh
+++ b/zsh/plugins/emoji-clock/emoji-clock.plugin.zsh
@@ -2,7 +2,7 @@
# FILE: emoji-clock.plugin.zsh
# DESCRIPTION: The current time with half hour accuracy as an emoji symbol.
# Inspired by Andre Torrez' "Put A Burger In Your Shell"
-# http://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html
+# https://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
# VERSION: 1.0.0
# -----------------------------------------------------------------------------
diff --git a/zsh/plugins/emotty/README.md b/zsh/plugins/emotty/README.md
new file mode 100644
index 0000000..ee57170
--- /dev/null
+++ b/zsh/plugins/emotty/README.md
@@ -0,0 +1,39 @@
+# emotty plugin
+
+This plugin returns an emoji for the current $TTY number so it can be used
+in a prompt.
+
+To use it, add emotty to the plugins array in your zshrc file:
+```
+plugins=(... emotty)
+```
+
+**NOTE:** it requires the [emoji plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/emoji).
+
+## Usage
+
+The function `emotty` displays an emoji from the current character set (default: `emoji`), based
+on the number associated to the `$TTY`.
+
+There are different sets of emoji characters available, to choose a different
+set, set `$emotty_set` to the name of the set you would like to use, e.g.:
+```
+emotty_set=nature
+```
+
+### Character Sets
+
+- emoji
+- loral
+- love
+- nature
+- stellar
+- zodiac
+
+Use the `display_emotty` function to list the emojis in the current character set, or
+the character set passed as the first argument. For example:
+
+```
+$ display_emotty zodiac
+
+```
diff --git a/zsh/plugins/encode64/README.md b/zsh/plugins/encode64/README.md
index 9850da8..86320cf 100644
--- a/zsh/plugins/encode64/README.md
+++ b/zsh/plugins/encode64/README.md
@@ -1,6 +1,12 @@
# encode64
-Alias plugin for encoding or decoding using `base64` command
+Alias plugin for encoding or decoding using `base64` command.
+
+To use it, add `encode64` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... encode64)
+```
## Functions and Aliases
@@ -9,23 +15,6 @@ Alias plugin for encoding or decoding using `base64` command
| `encode64` | `e64` | Encodes given data to base64 |
| `decode64` | `d64` | Decodes given data from base64 |
-## Enabling plugin
-
-1. Edit your `.zshrc` file and add `encode64` to the list of plugins:
-
- ```sh
- plugins=(
- # ...other enabled plugins
- encode64
- )
- ```
-
-2. Restart your terminal session or reload configuration by running:
-
- ```sh
- source ~/.zshrc
- ```
-
## Usage and examples
### Encoding
@@ -64,6 +53,6 @@ Alias plugin for encoding or decoding using `base64` command
```console
$ echo "b2gtbXktenNoCg==" | decode64
oh-my-zsh
- $ echo "b2gtbXktenNoCg==" | decode64
+ $ echo "b2gtbXktenNoCg==" | d64
oh-my-zsh
```
diff --git a/zsh/plugins/extract/README.md b/zsh/plugins/extract/README.md
index 83b878c..b2b731e 100644
--- a/zsh/plugins/extract/README.md
+++ b/zsh/plugins/extract/README.md
@@ -23,25 +23,35 @@ plugins=(... extract)
| `bz2` | Bzip2 file |
| `deb` | Debian package |
| `gz` | Gzip file |
+| `ipa` | iOS app package |
| `ipsw` | iOS firmware file |
| `jar` | Java Archive |
+| `lrz` | LRZ archive |
+| `lz4` | LZ4 archive |
| `lzma` | LZMA archive |
| `rar` | WinRAR archive |
+| `rpm` | RPM package |
| `sublime-package` | Sublime Text package |
| `tar` | Tarball |
| `tar.bz2` | Tarball with bzip2 compression |
| `tar.gz` | Tarball with gzip compression |
+| `tar.lrz` | Tarball with lrzip compression |
+| `tar.lz` | Tarball with lzip compression |
+| `tar.lz4` | Tarball with lz4 compression |
| `tar.xz` | Tarball with lzma2 compression |
| `tar.zma` | Tarball with lzma compression |
+| `tar.zst` | Tarball with zstd 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 |
+| `tzst` | Tarball with zstd compression |
| `war` | Web Application archive (Java-based) |
| `xpi` | Mozilla XPI module file |
| `xz` | LZMA2 archive |
| `zip` | Zip archive |
+| `zst` | Zstandard file (zstd) |
See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for
more information regarding archive formats.
diff --git a/zsh/plugins/extract/_extract b/zsh/plugins/extract/_extract
index 33d49fc..f96f0d4 100644
--- a/zsh/plugins/extract/_extract
+++ b/zsh/plugins/extract/_extract
@@ -3,5 +3,5 @@
_arguments \
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
- "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lzma|rar|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|whl|xpi|xz|zip)(-.)'" \
+ "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipa|ipsw|jar|lrz|lz4|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \
&& return 0
diff --git a/zsh/plugins/extract/extract.plugin.zsh b/zsh/plugins/extract/extract.plugin.zsh
index 5e9b9ff..46e69f0 100644
--- a/zsh/plugins/extract/extract.plugin.zsh
+++ b/zsh/plugins/extract/extract.plugin.zsh
@@ -40,14 +40,24 @@ extract() {
tar --lzma --help &> /dev/null \
&& tar --lzma -xvf "$1" \
|| lzcat "$1" | tar xvf - ;;
+ (*.tar.zst|*.tzst)
+ tar --zstd --help &> /dev/null \
+ && tar --zstd -xvf "$1" \
+ || zstdcat "$1" | tar xvf - ;;
(*.tar) tar xvf "$1" ;;
- (*.gz) (( $+commands[pigz] )) && pigz -d "$1" || gunzip "$1" ;;
+ (*.tar.lz) (( $+commands[lzip] )) && tar xvf "$1" ;;
+ (*.tar.lz4) lz4 -c -d "$1" | tar xvf - ;;
+ (*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$1" ;;
+ (*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;;
(*.bz2) bunzip2 "$1" ;;
(*.xz) unxz "$1" ;;
+ (*.lrz) (( $+commands[lrunzip] )) && lrunzip "$1" ;;
+ (*.lz4) lz4 -d "$1" ;;
(*.lzma) unlzma "$1" ;;
(*.z) uncompress "$1" ;;
- (*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;;
+ (*.zip|*.war|*.jar|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;;
(*.rar) unrar x -ad "$1" ;;
+ (*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;;
(*.7z) 7za x "$1" ;;
(*.deb)
mkdir -p "$extract_dir/control"
@@ -58,6 +68,7 @@ extract() {
cd ..; rm *.tar.* debian-binary
cd ..
;;
+ (*.zst) unzstd "$1" ;;
(*)
echo "extract: '$1' cannot be extracted" >&2
success=1
diff --git a/zsh/plugins/fabric/README.md b/zsh/plugins/fabric/README.md
index cf0fa81..f121d2e 100644
--- a/zsh/plugins/fabric/README.md
+++ b/zsh/plugins/fabric/README.md
@@ -4,6 +4,6 @@ This plugin provides completion for [Fabric](https://www.fabfile.org/).
To use it add fabric to the plugins array in your zshrc file.
-```bash
+```zsh
plugins=(... fabric)
```
diff --git a/zsh/plugins/fabric/_fab b/zsh/plugins/fabric/_fab
index 4c2e613..9102dad 100644
--- a/zsh/plugins/fabric/_fab
+++ b/zsh/plugins/fabric/_fab
@@ -4,10 +4,19 @@
local curcontext=$curcontext state line
declare -A opt_args
-declare target_list
-target_list=(`fab --shortlist 2>/dev/null || fab --complete 2>/dev/null`)
+declare -a target_list
+target_list=("${(@f)$(fab -l 2>/dev/null | awk '{
+ if (NF == 0 || NR == 1) next
+ if (NF < 2) print $1
+ else {
+ docstring=substr($0, index($0,$2))
+ gsub(":", "\\:", docstring)
+ print $1":"docstring
+ }
+}')}")
-_targets() {
+_fab_targets() {
+ [[ -n "$target_list" ]] || return
_describe -t commands "fabric targets" target_list
}
@@ -28,7 +37,7 @@ _arguments -w -S -C \
'(-)--shortlist[print non-verbose list of possible commands and exit]: :->noargs' \
'(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \
'(--no-pty)--no-pty[do not use pseudo-terminal in run/sudo]' \
- "(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_targets" \
+ "(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_fab_targets" \
'(-D --disable-known-hosts)'{-D,--disable-known-hosts}'[do not load user known_hosts file]' \
'(-r --reject-unknown-hosts)'{-r,--reject-unknown-hosts}'[reject unknown hosts]' \
'(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \
@@ -53,7 +62,7 @@ if [[ CURRENT -ge 1 ]]; then
levels)
_describe -t commands "output levels" output_levels;;
*)
- _targets;;
+ _fab_targets;;
esac
return
diff --git a/zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh b/zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh
index 8ab2979..82b9688 100644
--- a/zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh
+++ b/zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh
@@ -1,10 +1,10 @@
fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then
BUFFER="fg"
- zle accept-line
+ zle accept-line -w
else
- zle push-input
- zle clear-screen
+ zle push-input -w
+ zle clear-screen -w
fi
}
zle -N fancy-ctrl-z
diff --git a/zsh/plugins/fasd/README.md b/zsh/plugins/fasd/README.md
new file mode 100644
index 0000000..a5c74e5
--- /dev/null
+++ b/zsh/plugins/fasd/README.md
@@ -0,0 +1,21 @@
+# fasd
+
+[`Fasd`](https://github.com/clvv/fasd) (pronounced similar to "fast") is a command-line productivity booster. Fasd offers quick access to files and directories for POSIX shells.
+
+To use it, add `fasd` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... fasd)
+```
+
+## Installation
+
+Please find detailed installation guide [`here`](https://github.com/clvv/fasd#install)
+
+## Aliases
+
+| Alias | Command | Description |
+|-------|-------------------------------------------|-------------------------------------------------------------|
+| v | `fasd -f -e "$EDITOR"` | List frequent/recent files matching the given filename. |
+| o | `fasd -a -e xdg-open` | List frequent/recent files and directories matching. |
+| j | `fasd_cd -d -i` | cd with interactive selection |
diff --git a/zsh/plugins/fasd/fasd.plugin.zsh b/zsh/plugins/fasd/fasd.plugin.zsh
index ec2e518..6538d09 100644
--- a/zsh/plugins/fasd/fasd.plugin.zsh
+++ b/zsh/plugins/fasd/fasd.plugin.zsh
@@ -1,12 +1,16 @@
-if [ $commands[fasd] ]; then # check if fasd is installed
- fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache"
- if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
- fasd --init auto >| "$fasd_cache"
- fi
- source "$fasd_cache"
- unset fasd_cache
-
- alias v='f -e "$EDITOR"'
- alias o='a -e xdg-open'
- alias j='zz'
+# check if fasd is installed
+if (( ! ${+commands[fasd]} )); then
+ return
fi
+
+fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache"
+if [[ "$commands[fasd]" -nt "$fasd_cache" || ! -s "$fasd_cache" ]]; then
+ fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install \
+ zsh-wcomp zsh-wcomp-install >| "$fasd_cache"
+fi
+source "$fasd_cache"
+unset fasd_cache
+
+alias v='f -e "$EDITOR"'
+alias o='a -e xdg-open'
+alias j='zz'
diff --git a/zsh/plugins/fastfile/README.md b/zsh/plugins/fastfile/README.md
new file mode 100644
index 0000000..37f5b2f
--- /dev/null
+++ b/zsh/plugins/fastfile/README.md
@@ -0,0 +1,84 @@
+# Fastfile plugin
+
+This plugin adds a way to reference certain files or folders used frequently using
+a global alias or shortcut.
+
+To use it, add `fastfile` to the plugins array in your zshrc file:
+```zsh
+plugins=(... fastfile)
+```
+
+## Usage
+
+Example: you access folder `/code/project/backend/database` very frequently.
+
+First, generate a shortcut with the name `pjdb`:
+```zsh
+$ fastfile pjdb /code/project/backend/database
+```
+
+Next time you want to access it, use `§pjdb`. For example:
+```zsh
+$ cd §pjdb
+$ subl §pjdb
+```
+where § is the fastfile prefix (see [below](#options) for how to change).
+
+**Note:** shortcuts with spaces in the name are assigned a global alias
+where the spaces have been substituted with underscores (`_`). For example:
+a shortcut named `"hello world"` corresponds with `§hello_world`.
+
+
+## Functions
+
+- `fastfile `: generate a shortcut.
+
+- `fastfile_print `: prints a shortcut, with the format
+ ` -> `.
+
+- `fastfile_ls`: lists all shortcuts.
+
+- `fastfile_rm `: remove a shortcut.
+
+- `fastfile_sync`: generates the global aliases for the shortcuts.
+
+
+### Internal functions
+
+- `fastfile_resolv `: resolves the location of the shortcut
+ file, i.e., the file in the fastfile directory where the shortcut path
+ is stored.
+
+- `fastfile_get `: get the real path of the shortcut.
+
+
+## Aliases
+
+| Alias | Function |
+|--------|------------------|
+| ff | `fastfile` |
+| ffp | `fastfile_print` |
+| ffrm | `fastfile_rm` |
+| ffls | `fastfile_ls` |
+| ffsync | `fastfile_sync` |
+
+
+## Options
+
+These are options you can set to change certain parts of the plugin. To change
+them, add `=` to your zshrc file, before Oh My Zsh is sourced.
+For example: `fastfile_var_prefix='@'`.
+
+- `fastfile_var_prefix`: prefix for the global aliases created. Controls the prefix of the
+ created global aliases.
+ **Default:** `§` (section sign), easy to type in a german keyboard via the combination
+ [`⇧ Shift`+`3`](https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg),
+ or using `⌥ Option`+`6` in macOS.
+
+- `fastfile_dir`: directory where the fastfile shortcuts are stored. Needs to end
+ with a trailing slash.
+ **Default:** `$HOME/.fastfile/`.
+
+## Author
+
+- [Karolin Varner](https://github.com/koraa)
diff --git a/zsh/plugins/fastfile/fastfile.plugin.zsh b/zsh/plugins/fastfile/fastfile.plugin.zsh
index 775e948..ccbbce3 100644
--- a/zsh/plugins/fastfile/fastfile.plugin.zsh
+++ b/zsh/plugins/fastfile/fastfile.plugin.zsh
@@ -1,21 +1,11 @@
-################################################################################
-# FILE: fastfile.plugin.zsh
-# DESCRIPTION: oh-my-zsh plugin file.
-# AUTHOR: Michael Varner (musikmichael@web.de)
-# VERSION: 1.0.0
-#
-# This plugin adds the ability to on the fly generate and access file shortcuts.
-#
-################################################################################
-
###########################
-# Settings
+# Settings
# These can be overwritten any time.
# If they are not set yet, they will be
# overwritten with their default values
-default fastfile_dir "${HOME}/.fastfile/"
+default fastfile_dir "${HOME}/.fastfile"
default fastfile_var_prefix "§"
###########################
@@ -33,7 +23,7 @@ default fastfile_var_prefix "§"
function fastfile() {
test "$2" || 2="."
file=$(readlink -f "$2")
-
+
test "$1" || 1="$(basename "$file")"
name=$(echo "$1" | tr " " "_")
@@ -51,7 +41,7 @@ function fastfile() {
# Arguments:
# 1. name - The name of the shortcut
# STDOUT:
-# The path
+# The path to the shortcut file
#
function fastfile_resolv() {
echo "${fastfile_dir}${1}"
@@ -88,12 +78,12 @@ function fastfile_print() {
# (=> fastfle_print) for each shortcut
#
function fastfile_ls() {
- for f in "${fastfile_dir}"/*; do
- file=`basename "$f"` # To enable simpler handeling of spaces in file names
- varkey=`echo "$file" | tr " " "_"`
+ for f in "${fastfile_dir}"/*(NF); do
+ file=`basename "$f"` # To enable simpler handeling of spaces in file names
+ varkey=`echo "$file" | tr " " "_"`
- # Special format for colums
- echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
+ # Special format for colums
+ echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
done | column -t -s "|"
}
@@ -102,7 +92,6 @@ function fastfile_ls() {
#
# Arguments:
# 1. name - The name of the shortcut (default: name of the file)
-# 2. file - The file or directory to make the shortcut for
# STDOUT:
# => fastfle_print
#
@@ -115,11 +104,11 @@ function fastfile_rm() {
# Generate the aliases for the shortcuts
#
function fastfile_sync() {
- for f in "${fastfile_dir}"/*; do
- file=`basename "$f"` # To enable simpler handeling of spaces in file names
- varkey=`echo "$file" | tr " " "_"`
+ for f in "${fastfile_dir}"/*(NF); do
+ file=`basename "$f"` # To enable simpler handeling of spaces in file names
+ varkey=`echo "$file" | tr " " "_"`
- alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
+ alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
done
}
@@ -133,6 +122,6 @@ alias ffls=fastfile_ls
alias ffsync=fastfile_sync
##################################
-# Init
+# Init
-fastfile_sync
\ No newline at end of file
+fastfile_sync
diff --git a/zsh/plugins/fbterm/README.md b/zsh/plugins/fbterm/README.md
new file mode 100644
index 0000000..70ce56d
--- /dev/null
+++ b/zsh/plugins/fbterm/README.md
@@ -0,0 +1,10 @@
+# fbterm
+
+This plugin automatically starts [fbterm](https://github.com/zhangyuanwei/fbterm)
+if on a real TTY (`/dev/tty*`).
+
+To use it, add `fbterm` to the plugins array of your zshrc file:
+
+```zsh
+plugins=(... fbterm)
+```
diff --git a/zsh/plugins/fedora/README.md b/zsh/plugins/fedora/README.md
index 6594799..85d8d7d 100644
--- a/zsh/plugins/fedora/README.md
+++ b/zsh/plugins/fedora/README.md
@@ -1 +1 @@
-The fedora plugin is deprecated. Use the [dnf plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/dnf) instead.
+The fedora plugin is deprecated. Use the [dnf plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dnf) instead.
diff --git a/zsh/plugins/fedora/fedora.plugin.zsh b/zsh/plugins/fedora/fedora.plugin.zsh
deleted file mode 120000
index 16a2143..0000000
--- a/zsh/plugins/fedora/fedora.plugin.zsh
+++ /dev/null
@@ -1 +0,0 @@
-../dnf/dnf.plugin.zsh
\ No newline at end of file
diff --git a/zsh/plugins/fedora/fedora.plugin.zsh b/zsh/plugins/fedora/fedora.plugin.zsh
new file mode 100644
index 0000000..226506c
--- /dev/null
+++ b/zsh/plugins/fedora/fedora.plugin.zsh
@@ -0,0 +1,3 @@
+print -P "%F{yellow}The 'fedora' plugin is deprecated. Use the '%Udnf%u' plugin instead.%f"
+
+source "$ZSH/plugins/dnf/dnf.plugin.zsh"
diff --git a/zsh/plugins/firewalld/readme.md b/zsh/plugins/firewalld/README.md
similarity index 100%
rename from zsh/plugins/firewalld/readme.md
rename to zsh/plugins/firewalld/README.md
diff --git a/zsh/plugins/flutter/README.md b/zsh/plugins/flutter/README.md
new file mode 100644
index 0000000..be41914
--- /dev/null
+++ b/zsh/plugins/flutter/README.md
@@ -0,0 +1,21 @@
+## Flutter plugin
+
+The Flutter plugin provides completion and useful aliases
+
+To use it, add flutter to the plugins array of your zshrc file:
+
+```
+plugins=(... flutter)
+```
+
+## Aliases
+
+| Alias | Command | Description |
+| :--------- | :--------------------- | :------------------------------------------------------------------------- |
+| `fl` | `flutter` | Shorthand for flutter command |
+| `flr` | `flutter run` | Runs flutter app |
+| `fldoc` | `flutter doctor` | Runs flutter doctor |
+| `flb` | `flutter build` | Build flutter application |
+| `flattach` | `flutter attach` | Attaches flutter to a running flutter application with enabled observatory |
+| `flget` | `flutter packages get` | Installs dependencies |
+| `flc` | `flutter clean` | Cleans flutter porject |
diff --git a/zsh/plugins/flutter/_flutter b/zsh/plugins/flutter/_flutter
new file mode 100644
index 0000000..ab6ce42
--- /dev/null
+++ b/zsh/plugins/flutter/_flutter
@@ -0,0 +1,37 @@
+#compdef flutter
+#autoload
+
+local -a _1st_arguments
+_1st_arguments=(
+ "analyze":"Analyze the project's Dart code."
+ "assemble":"Assemble and build flutter resources."
+ "attach":"Attach to a running application."
+ "build":"Flutter build commands."
+ "channel":"List or switch flutter channels."
+ "clean":"Delete the build/ and .dart_tool/ directories."
+ "config":"Configure Flutter settings."
+ "create":"Create a new Flutter project."
+ "devices":"List all connected devices."
+ "doctor":"Show information about the installed tooling."
+ "drive":"Runs Flutter Driver tests for the current project."
+ "emulators":"List, launch and create emulators."
+ "format":" Format one or more dart files."
+ "help":"Display help information for flutter."
+ "install":"Install a Flutter app on an attached device."
+ "logs":"Show log output for running Flutter apps."
+ "make-host-app-editable":"Moves host apps from generated directories to non-generated directories so that they can be edited by developers."
+ "precache":"Populates the Flutter tool's cache of binary artifacts."
+ "pub":"Commands for managing Flutter packages."
+ "run":"Run your Flutter app on an attached device."
+ "screenshot":"Take a screenshot from a connected device."
+ "test":"Run Flutter unit tests for the current project."
+ "upgrade":"Upgrade your copy of Flutter."
+ "version":"List or switch flutter versions."
+)
+
+_arguments -C '*:: :->subcmds'
+
+if (( CURRENT == 1 )); then
+ _describe -t commands "flutter command" _1st_arguments
+ return
+fi
diff --git a/zsh/plugins/flutter/flutter.plugin.zsh b/zsh/plugins/flutter/flutter.plugin.zsh
new file mode 100644
index 0000000..01c4c9f
--- /dev/null
+++ b/zsh/plugins/flutter/flutter.plugin.zsh
@@ -0,0 +1,7 @@
+alias fl="flutter"
+alias flr="flutter run"
+alias fldoc="flutter doctor"
+alias flb="flutter build"
+alias flattach="flutter attach"
+alias flget="flutter packages get"
+alias flc="flutter clean"
diff --git a/zsh/plugins/forklift/README.md b/zsh/plugins/forklift/README.md
index 6c4ce1e..7dfd8bf 100644
--- a/zsh/plugins/forklift/README.md
+++ b/zsh/plugins/forklift/README.md
@@ -1,15 +1,23 @@
-## forklift
+# forklift
Plugin for ForkLift, an FTP application for OS X.
-### Requirements
+To use it, add `forklift` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... forklift)
+```
+
+## Requirements
* [ForkLift](https://binarynights.com/)
-### Usage
+## Usage
-fl [*file_or_folder*]
+`fl []`
* 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.
+* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift
+
+* If `fl` is called with a non-directory file as the argument, then the file's parent directory is opened.
diff --git a/zsh/plugins/forklift/forklift.plugin.zsh b/zsh/plugins/forklift/forklift.plugin.zsh
index 274c4a8..8588948 100644
--- a/zsh/plugins/forklift/forklift.plugin.zsh
+++ b/zsh/plugins/forklift/forklift.plugin.zsh
@@ -1,6 +1,7 @@
# Open folder in ForkLift.app or ForkLift2.app from console
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
# Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving
+# Updated to support ForkLift from Setapp by Paul Rudkin
#
# Usage:
# fl []
@@ -24,6 +25,13 @@ function fl {
fi
osascript 2>&1 1>/dev/null < /dev/null
+ fi
+
+ # Key bindings
+ if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
+ source "${fzf_shell}/key-bindings.zsh"
+ fi
+ else
+ return 1
+ fi
+}
+
+
+function setup_using_debian_package() {
+ (( $+commands[dpkg] )) && dpkg -s fzf &> /dev/null
+ if (( $? )); then
+ # Either not a debian based distro, or no fzf installed. In any case skip ahead
+ return 1
+ fi
+
+ # NOTE: There is no need to configure PATH for debian package, all binaries
+ # are installed to /usr/bin by default
+
+ # Determine completion file path: first bullseye/sid, then buster/stretch
+ local completions="/usr/share/doc/fzf/examples/completion.zsh"
+ [[ -f "$completions" ]] || completions="/usr/share/zsh/vendor-completions/_fzf"
+
+ local key_bindings="/usr/share/doc/fzf/examples/key-bindings.zsh"
+
+ # Auto-completion
+ if [[ $- == *i* ]] && [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then
+ source $completions 2> /dev/null
+ fi
+
+ # Key bindings
+ if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
+ source $key_bindings
+ fi
+
+ return 0
+}
+
+function indicate_error() {
+ print "[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.\n"\
+ "Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2
+}
+
+# Check for debian package first, because it easy to short cut
+# Indicate to user that fzf installation not found if nothing worked
+setup_using_debian_package || setup_using_base_dir || indicate_error
+
+unset -f setup_using_debian_package setup_using_base_dir indicate_error
+
+if [[ -z "$FZF_DEFAULT_COMMAND" ]]; then
+ if (( $+commands[rg] )); then
+ export FZF_DEFAULT_COMMAND='rg --files --hidden'
+ elif (( $+commands[fd] )); then
+ export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude .git'
+ elif (( $+commands[ag] )); then
+ export FZF_DEFAULT_COMMAND='ag -l --hidden -g ""'
+ fi
fi
-
-if [[ -n "${fzf_base}" ]]; then
-
- # Fix fzf shell directory for Archlinux package
- if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then
- fzf_shell="${fzf_base}"
- else
- fzf_shell="${fzf_base}/shell"
- fi
-
- # Setup fzf
- # ---------
- if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then
- export PATH="$PATH:$fzf_base/bin"
- fi
-
- # Auto-completion
- # ---------------
- if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then
- [[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null
- fi
-
- # Key bindings
- # ------------
- if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
- source "${fzf_shell}/key-bindings.zsh"
- fi
-
-else
- print "[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.\n"\
- "Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2
-fi
-
-unset fzf_base fzf_shell dir fzfdirs
diff --git a/zsh/plugins/gas/README.md b/zsh/plugins/gas/README.md
new file mode 100644
index 0000000..47b3fb9
--- /dev/null
+++ b/zsh/plugins/gas/README.md
@@ -0,0 +1,10 @@
+# Gas plugin
+
+This plugin adds autocompletion for the [gas](http://walle.github.com/gas) command,
+a utility to manage Git authors.
+
+To use it, add `gas` to the plugins array of your zshrc file:
+
+```zsh
+plugins=(... gas)
+```
diff --git a/zsh/plugins/gcloud/README.md b/zsh/plugins/gcloud/README.md
new file mode 100644
index 0000000..e7ce0e0
--- /dev/null
+++ b/zsh/plugins/gcloud/README.md
@@ -0,0 +1,24 @@
+# gcloud
+
+This plugin provides completion support for the
+[Google Cloud SDK CLI](https://cloud.google.com/sdk/gcloud/).
+
+To use it, add `gcloud` to the plugins array in your zshrc file.
+
+```zsh
+plugins=(... gcloud)
+```
+
+It relies on you having installed the SDK using one of the supported options
+listed [here](https://cloud.google.com/sdk/install).
+
+## Plugin Options
+
+* Set `CLOUDSDK_HOME` in your `zshrc` file before you load oh-my-zsh if you have
+your GCloud SDK installed in a non-standard location. The plugin will use this
+as the base for your SDK if it finds it set already.
+
+* If you do not have a `python2` in your `PATH` you'll also need to set the
+`CLOUDSDK_PYTHON` environment variable at the end of your `.zshrc`. This is
+used by the SDK to call a compatible interpreter when you run one of the
+SDK commands.
diff --git a/zsh/plugins/gcloud/gcloud.plugin.zsh b/zsh/plugins/gcloud/gcloud.plugin.zsh
new file mode 100644
index 0000000..c7aebe6
--- /dev/null
+++ b/zsh/plugins/gcloud/gcloud.plugin.zsh
@@ -0,0 +1,33 @@
+#####################################################
+# gcloud plugin for oh-my-zsh #
+# Author: Ian Chesal (github.com/ianchesal) #
+#####################################################
+
+if [[ -z "${CLOUDSDK_HOME}" ]]; then
+ search_locations=(
+ "$HOME/google-cloud-sdk"
+ "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
+ "/usr/share/google-cloud-sdk"
+ "/snap/google-cloud-sdk/current"
+ "/usr/lib64/google-cloud-sdk/"
+ "/opt/google-cloud-sdk"
+ )
+
+ for gcloud_sdk_location in $search_locations; do
+ if [[ -d "${gcloud_sdk_location}" ]]; then
+ CLOUDSDK_HOME="${gcloud_sdk_location}"
+ break
+ fi
+ done
+fi
+
+if (( ${+CLOUDSDK_HOME} )); then
+ if (( ! $+commands[gcloud] )); then
+ # Only source this if GCloud isn't already on the path
+ if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then
+ source "${CLOUDSDK_HOME}/path.zsh.inc"
+ fi
+ fi
+ source "${CLOUDSDK_HOME}/completion.zsh.inc"
+ export CLOUDSDK_HOME
+fi
diff --git a/zsh/plugins/geeknote/README.md b/zsh/plugins/geeknote/README.md
index 3f23531..95b3aa7 100644
--- a/zsh/plugins/geeknote/README.md
+++ b/zsh/plugins/geeknote/README.md
@@ -1,12 +1,10 @@
-## ZSH-Geeknote
+# Geeknote plugin
-[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for oh-my-zsh.
+This plugin provides autocompletion for [Geeknote](https://github.com/VitaliyRodnenko/geeknote)
+and an alias for `geeknote` called `gn`.
-Plugins provides:
+To use it, add `geeknote` to the plugins array in your zshrc file:
-- 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))
+```zsh
+plugins=( ... geeknote ...)
+```
diff --git a/zsh/plugins/geeknote/_geeknote b/zsh/plugins/geeknote/_geeknote
index cf1a187..a34be59 100644
--- a/zsh/plugins/geeknote/_geeknote
+++ b/zsh/plugins/geeknote/_geeknote
@@ -1,136 +1,157 @@
#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.
-# --------------- ------------------------------------------------------------
+
+# Geeknote Autocomplete plugin for Zsh
+# Requires: Geeknote installed
+# Author : Ján Koščo (@s7anley)
+
+__login() {
+ # no arguments
+}
+
+__logout() {
+ _arguments \
+ '--force[Do not ask about logging out.]'
+}
+
+__settings() {
+ _arguments \
+ "--editor+[Set the editor, which use to edit and create notes.]::"
+}
+
+__create() {
+ _arguments \
+ '--title+[The note title.]::' \
+ '--content+[The note content.]::' \
+ '--tags+[One tag or the list of tags which will be added to the note.]::' \
+ '--notebook+[Set the notebook where to save note.]::' \
+ '--resource+[Add a resource to the note.]::'
+}
+
+__edit() {
+ _arguments \
+ '--note+[The name or ID from the previous search of a note to edit.]::' \
+ '--title+[Set new title of the note.]::' \
+ '--content+[Set new content of the note.]::' \
+ '--tags+[Set new list o tags for the note.]::' \
+ '--notebook+[Assign new notebook for the note.]::' \
+ '--resource+[Add a resource to the note.]::'
+}
+
+__find() {
+ _arguments \
+ '--search+[Text to search.]::' \
+ '--tags+[Notes with which tag/tags to search.]::' \
+ '--notebook+[In which notebook search the note.]::' \
+ '--date+[Set date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy.]::' \
+ '--count+[How many notes show in the result list.]::' \
+ '--with-url[Add direct url of each note in results to Evernote web-version.]' \
+ '--content-search[Search by content, not by title.]' \
+ '--exact-entry[Search for exact entry of the request.]'
+}
+
+__show() {
+ _arguments \
+ '--note+[The name or ID from the previous search of a note to show.]::' \
+ '--raw[Show the raw note body.]'
+}
+
+__remove() {
+ _arguments \
+ '--note+[The name or ID from the previous search of a note to remove.]::' \
+ '--force[Do not ask about removing.]'
+}
+
+__notebook-list() {
+ # no arguments
+}
+
+__notebook-create() {
+ _arguments \
+ '--title+[Set the title of new notebook.]::'
+}
+
+__notebook-edit() {
+ _arguments \
+ '--title+[Set the title of new notebook.]::' \
+ '--notebook+[The name of a notebook to rename.]::'
+}
+
+__tag-list() {
+ # no arguments
+}
+
+__tag-create() {
+ _arguments \
+ '--title+[Set the title of new tag.]::'
+}
+
+__tag-edit() {
+ _arguments \
+ '--tagname+[The name of a tag to rename.]::' \
+ '--title+[Set the new name of tag.]::'
+}
+
+__user() {
+ _arguments \
+ '--full[Show full information.]'
+}
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'
+ 'login':'Authorize in Evernote.'
+ 'logout':'Logout from Evernote.'
+ 'settings':'Show and edit current settings.'
+ 'create':'Create note in Evernote.'
+ 'edit':'Edit note in Evernote.'
+ 'find':'Search notes in Evernote.'
+ 'show':'Output note in the terminal.'
+ 'remove':'Remove note from Evernote.'
+ 'notebook-list':'Show the list of existing notebooks in your Evernote.'
+ 'notebook-create':'Create new notebook.'
+ 'notebook-edit':'Edit/rename notebook.'
+ 'tag-list':'Show the list of existing tags in your Evernote.'
+ 'tag-create':'Create new tag.'
+ 'tag-edit':'Edit/rename tag.'
+ 'user':'Show information about active user.'
)
_arguments '*:: :->command'
if (( CURRENT == 1 )); then
- _describe -t commands "geeknote command" _1st_arguments
- return
+ _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
+ login)
+ __login ;;
+ logout)
+ __logout ;;
+ settings)
+ __settings ;;
+ create)
+ __create ;;
+ edit)
+ __edit ;;
+ find)
+ __find ;;
+ show)
+ __show ;;
+ remove)
+ __remove ;;
+ notebook-list)
+ __notebook-list ;;
+ notebook-create)
+ __notebook-create ;;
+ notebook-edit)
+ __notebook-edit ;;
+ tag-list)
+ __tag-list ;;
+ tag-create)
+ __tag-create ;;
+ tag-edit)
+ __tag-edit ;;
+ user)
+ __user ;;
+esac
diff --git a/zsh/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/zsh/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh
index 56ab86d..5c42c21 100644
--- a/zsh/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh
+++ b/zsh/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh
@@ -1,16 +1,17 @@
GIT_AUTO_FETCH_INTERVAL=${GIT_AUTO_FETCH_INTERVAL:=60}
function git-fetch-all {
- (`git rev-parse --is-inside-work-tree 2>/dev/null` &&
- dir=`git rev-parse --git-dir` &&
+ (`command git rev-parse --is-inside-work-tree 2>/dev/null` &&
+ dir=`command git rev-parse --git-dir` &&
[[ ! -f $dir/NO_AUTO_FETCH ]] &&
(( `date +%s` - `date -r $dir/FETCH_LOG +%s 2>/dev/null || echo 0` > $GIT_AUTO_FETCH_INTERVAL )) &&
- git fetch --all 2>/dev/null &>! $dir/FETCH_LOG &)
+ GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \
+ command git fetch --all 2>/dev/null &>! $dir/FETCH_LOG &)
}
function git-auto-fetch {
- `git rev-parse --is-inside-work-tree 2>/dev/null` || return
- guard="`git rev-parse --git-dir`/NO_AUTO_FETCH"
+ `command git rev-parse --is-inside-work-tree 2>/dev/null` || return
+ guard="`command git rev-parse --git-dir`/NO_AUTO_FETCH"
(rm $guard 2>/dev/null &&
echo "${fg_bold[green]}enabled${reset_color}") ||
diff --git a/zsh/plugins/git-escape-magic/README.md b/zsh/plugins/git-escape-magic/README.md
index c3e3898..7fefed3 100644
--- a/zsh/plugins/git-escape-magic/README.md
+++ b/zsh/plugins/git-escape-magic/README.md
@@ -4,13 +4,13 @@ This plugin is copied from the original at
https://github.com/knu/zsh-git-escape-magic. All credit for the
functionality enabled by this plugin should go to @knu.
-An excerpt from that project's readme explains it's purpose.
+An excerpt from that project's readme explains its purpose.
> It eliminates the need for manually escaping those meta-characters. The zle function it provides is context aware and recognizes the characteristics of each subcommand of git. Every time you type one of these meta-characters on a git command line, it automatically escapes the meta-character with a backslash as necessary and as appropriate.
## Usage
-To use this plugin add it to your list of plugins in your `.zshrc` file.
+To use this plugin, add it to your list of plugins in your `.zshrc` file.
-**NOTE**: If you use url-quote-magic it must be included before this
+**NOTE**: If you use url-quote-magic, it must be included before this
plugin runs to prevent any conflicts.
diff --git a/zsh/plugins/git-extras/README.md b/zsh/plugins/git-extras/README.md
index 987f0d8..2adc9d4 100644
--- a/zsh/plugins/git-extras/README.md
+++ b/zsh/plugins/git-extras/README.md
@@ -2,10 +2,16 @@
This plugin provides completion definitions for some of the commands defined by [git-extras](https://github.com/tj/git-extras).
-## Setup notes
+To use it, add `git-extras` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... 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.
+**NOTE:** this no longer works on current Homebrew distributions of git. ~~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.~~
diff --git a/zsh/plugins/git-flow/README.md b/zsh/plugins/git-flow/README.md
index 5d8049e..9c25dec 100644
--- a/zsh/plugins/git-flow/README.md
+++ b/zsh/plugins/git-flow/README.md
@@ -1,18 +1,15 @@
# Git-Flow plugin
-This plugin adds completion and aliases for the `git-flow` command. More information
-at https://github.com/nvie/gitflow.
+This plugin adds completion and aliases for the [`git-flow` command](https://github.com/nvie/gitflow).
-Enable git-flow plugin in your zshrc file:
-```
+To use it, add `git-flow` to the plugins array in your zshrc file:
+
+```zsh
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 |
@@ -30,3 +27,5 @@ https://github.com/nvie/gitflow/wiki/Command-Line-Arguments
| `gflfp` | `git flow feature publish` | Publish feature: `gflfp ` |
| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf ` |
| `gflrf` | `git flow release finish` | Finish release: `gflrf ` |
+
+[More information about `git-flow` commands](https://github.com/nvie/gitflow/wiki/Command-Line-Arguments).
diff --git a/zsh/plugins/git-lfs/README.md b/zsh/plugins/git-lfs/README.md
new file mode 100644
index 0000000..1222b27
--- /dev/null
+++ b/zsh/plugins/git-lfs/README.md
@@ -0,0 +1,24 @@
+# git lfs plugin
+
+The git lfs plugin provides [aliases](#aliases) and [functions](#functions) for [git-lfs](https://github.com/git-lfs/git-lfs).
+
+To use it, add `git-lfs` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... git-lfs)
+```
+
+## Aliases
+
+| Alias | Command |
+| :------- | :---------------------------------- |
+| `glfsi` | `git lfs install` |
+| `glfst` | `git lfs track` |
+| `glfsls` | `git lfs ls-files` |
+| `glfsmi` | `git lfs migrate import --include=` |
+
+## Functions
+
+| Function | Command |
+| :------- | :---------------------------------------------- |
+| `gplfs` | `git lfs push origin "$(current_branch)" --all` |
diff --git a/zsh/plugins/git-lfs/git-lfs.plugin.zsh b/zsh/plugins/git-lfs/git-lfs.plugin.zsh
new file mode 100644
index 0000000..e7bb676
--- /dev/null
+++ b/zsh/plugins/git-lfs/git-lfs.plugin.zsh
@@ -0,0 +1,17 @@
+#
+# Aliases
+#
+
+alias glfsi='git lfs install'
+alias glfst='git lfs track'
+alias glfsls='git lfs ls-files'
+alias glfsmi='git lfs migrate import --include='
+
+#
+# Functions
+#
+
+function gplfs() {
+ local b="$(git_current_branch)"
+ git lfs push origin "$b" --all
+}
diff --git a/zsh/plugins/git-prompt/README.md b/zsh/plugins/git-prompt/README.md
index e3b2d62..83948f5 100644
--- a/zsh/plugins/git-prompt/README.md
+++ b/zsh/plugins/git-prompt/README.md
@@ -11,6 +11,9 @@ plugins=(... git-prompt)
See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
+## Prerequisites
+This plugin uses `python`, so your host needs to have it installed
+
## Examples
The prompt may look like the following:
diff --git a/zsh/plugins/git-prompt/git-prompt.plugin.zsh b/zsh/plugins/git-prompt/git-prompt.plugin.zsh
index 1742429..da674af 100644
--- a/zsh/plugins/git-prompt/git-prompt.plugin.zsh
+++ b/zsh/plugins/git-prompt/git-prompt.plugin.zsh
@@ -1,6 +1,3 @@
-# ZSH Git Prompt Plugin from:
-# http://github.com/olivierverdier/zsh-git-prompt
-
__GIT_PROMPT_DIR="${0:A:h}"
## Hook function definitions
@@ -23,9 +20,10 @@ function precmd_update_git_vars() {
fi
}
-chpwd_functions+=(chpwd_update_git_vars)
-precmd_functions+=(precmd_update_git_vars)
-preexec_functions+=(preexec_update_git_vars)
+autoload -U add-zsh-hook
+add-zsh-hook chpwd chpwd_update_git_vars
+add-zsh-hook precmd precmd_update_git_vars
+add-zsh-hook preexec preexec_update_git_vars
## Function definitions
@@ -42,19 +40,16 @@ function update_current_git_vars() {
GIT_CONFLICTS=$__CURRENT_GIT_STATUS[5]
GIT_CHANGED=$__CURRENT_GIT_STATUS[6]
GIT_UNTRACKED=$__CURRENT_GIT_STATUS[7]
- GIT_DELETED=$__CURRENT_GIT_STATUS[8]
}
git_super_status() {
precmd_update_git_vars
if [ -n "$__CURRENT_GIT_STATUS" ]; then
STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}"
- if [ "$GIT_BEHIND" -ne "0" ]; then
- STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR"
+ if [ "$GIT_BEHIND" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND$GIT_BEHIND%{${reset_color}%}"
fi
if [ "$GIT_AHEAD" -ne "0" ]; then
- STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR"
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD$GIT_AHEAD%{${reset_color}%}"
fi
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR"
@@ -67,11 +62,8 @@ git_super_status() {
if [ "$GIT_CHANGED" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}"
fi
- if [ "$GIT_DELETED" -ne "0" ]; then
- STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_DELETED$GIT_DELETED%{${reset_color}%}"
- fi
if [ "$GIT_UNTRACKED" -ne "0" ]; then
- STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED$GIT_UNTRACKED%{${reset_color}%}"
+ STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED%{${reset_color}%}"
fi
if [ "$GIT_CHANGED" -eq "0" ] && [ "$GIT_CONFLICTS" -eq "0" ] && [ "$GIT_STAGED" -eq "0" ] && [ "$GIT_UNTRACKED" -eq "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
@@ -93,7 +85,6 @@ ZSH_THEME_GIT_PROMPT_BEHIND="%{↓%G%}"
ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%G%}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{…%G%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%G%}"
-ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}-"
# Set the prompt.
RPROMPT='$(git_super_status)'
diff --git a/zsh/plugins/git-prompt/gitstatus.py b/zsh/plugins/git-prompt/gitstatus.py
index 709de9e..300365d 100644
--- a/zsh/plugins/git-prompt/gitstatus.py
+++ b/zsh/plugins/git-prompt/gitstatus.py
@@ -1,28 +1,24 @@
#!/usr/bin/env python
from __future__ import print_function
+import os
import sys
import re
-import shlex
from subprocess import Popen, PIPE, check_output
def get_tagname_or_hash():
"""return tagname if exists else hash"""
- cmd = 'git log -1 --format="%h%d"'
- output = check_output(shlex.split(cmd)).decode('utf-8').strip()
- hash_, tagname = None, None
# get hash
- m = re.search('\(.*\)$', output)
- if m:
- hash_ = output[:m.start()-1]
- # get tagname
- m = re.search('tag: .*[,\)]', output)
- if m:
- tagname = 'tags/' + output[m.start()+len('tag: '): m.end()-1]
+ hash_cmd = ['git', 'rev-parse', '--short', 'HEAD']
+ hash_ = check_output(hash_cmd).strip()
- if tagname:
- return tagname
+ # get tagname
+ tags_cmd = ['git', 'for-each-ref', '--points-at=HEAD', '--count=2', '--sort=-version:refname', '--format=%(refname:short)', 'refs/tags']
+ tags = check_output(tags_cmd).split()
+
+ if tags:
+ return tags[0] + ('+' if len(tags) > 1 else '')
elif hash_:
return hash_
return None
@@ -30,18 +26,18 @@ def get_tagname_or_hash():
# `git status --porcelain --branch` can collect all information
# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
-po = Popen(['git', 'status', '--porcelain', '--branch'], stdout=PIPE, stderr=PIPE)
+po = Popen(['git', 'status', '--porcelain', '--branch'], env=dict(os.environ, LANG="C"), stdout=PIPE, stderr=PIPE)
stdout, sterr = po.communicate()
if po.returncode != 0:
sys.exit(0) # Not a git repository
# collect git status information
-untracked, staged, changed, conflicts, deleted = [], [], [], [], []
+untracked, staged, changed, conflicts = [], [], [], []
ahead, behind = 0, 0
status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()]
for st in status:
if st[0] == '#' and st[1] == '#':
- if re.search('Initial commit on', st[2]):
+ if re.search('Initial commit on', st[2]) or re.search('No commits yet on', st[2]):
branch = st[2].split(' ')[-1]
elif re.search('no branch', st[2]): # detached status
branch = get_tagname_or_hash()
@@ -67,8 +63,6 @@ for st in status:
else:
if st[1] == 'M':
changed.append(st)
- if st[1] == 'D':
- deleted.append(st)
if st[0] == 'U':
conflicts.append(st)
elif st[0] != ' ':
@@ -82,6 +76,5 @@ out = ' '.join([
str(len(conflicts)),
str(len(changed)),
str(len(untracked)),
- str(len(deleted)),
])
print(out, end='')
diff --git a/zsh/plugins/git-remote-branch/git-remote-branch.plugin.zsh b/zsh/plugins/git-remote-branch/git-remote-branch.plugin.zsh
deleted file mode 100644
index 6c5ab8f..0000000
--- a/zsh/plugins/git-remote-branch/git-remote-branch.plugin.zsh
+++ /dev/null
@@ -1,19 +0,0 @@
-_git_remote_branch() {
- ref=$(git symbolic-ref HEAD 2> /dev/null)
- if [[ -n $ref ]]; then
- if (( CURRENT == 2 )); then
- # first arg: operation
- compadd create publish rename delete track
- elif (( CURRENT == 3 )); then
- # second arg: remote branch name
- remotes=`git remote | tr '\n' '|' | sed "s/\|$//g"`
- compadd `git branch -r | grep -v HEAD | sed "s/$remotes\///" | sed "s/ //g"`
- elif (( CURRENT == 4 )); then
- # third arg: remote name
- compadd `git remote`
- fi
- else;
- _files
- fi
-}
-compdef _git_remote_branch grb
diff --git a/zsh/plugins/git/README.md b/zsh/plugins/git/README.md
index 7878f74..b7f2168 100644
--- a/zsh/plugins/git/README.md
+++ b/zsh/plugins/git/README.md
@@ -10,194 +10,211 @@ plugins=(... git)
## Aliases
-| Alias | Command |
-|:---------------------|:------------------------------------------------------------------------------------------------------------------------------|
-| g | git |
-| ga | git add |
-| gaa | git add --all |
-| gapa | git add --patch |
-| gau | git add --update |
-| gav | git add --verbose |
-| gap | git apply |
-| gb | git branch |
-| gba | git branch -a |
-| gbd | git branch -d |
-| gbda | git branch --no-color --merged \| command grep -vE "^(\+|\*\|\s*(master\|develop\|dev)\s*$)" \| command xargs -n 1 git branch -d |
-| gbD | git branch -D |
-| gbl | git blame -b -w |
-| gbnm | git branch --no-merged |
-| gbr | git branch --remote |
-| gbs | git bisect |
-| gbsb | git bisect bad |
-| gbsg | git bisect good |
-| gbsr | git bisect reset |
-| gbss | git bisect start |
-| gc | git commit -v |
-| gc! | git commit -v --amend |
-| gcn! | git commit -v --no-edit --amend |
-| gca | git commit -v -a |
-| gca! | git commit -v -a --amend |
-| gcan! | git commit -v -a --no-edit --amend |
-| gcans! | git commit -v -a -s --no-edit --amend |
-| gcam | git commit -a -m |
-| gcsm | git commit -s -m |
-| gcb | git checkout -b |
-| gcf | git config --list |
-| gcl | git clone --recurse-submodules |
-| gclean | git clean -id |
-| gpristine | git reset --hard && git clean -dfx |
-| gcm | git checkout master |
-| gcd | git checkout develop |
-| gcmsg | git commit -m |
-| gco | git checkout |
-| gcount | git shortlog -sn |
-| gcp | git cherry-pick |
-| gcpa | git cherry-pick --abort |
-| gcpc | git cherry-pick --continue |
-| gcs | git commit -S |
-| gd | git diff |
-| gdca | git diff --cached |
-| gdcw | git diff --cached --word-diff |
-| gdct | git describe --tags $(git rev-list --tags --max-count=1) |
-| gds | git diff --staged |
-| gdt | git diff-tree --no-commit-id --name-only -r |
-| gdv | git diff -w $@ \| view - |
-| gdw | git diff --word-diff |
-| gf | git fetch |
-| gfa | git fetch --all --prune |
-| gfg | git ls-files \| grep |
-| gfo | git fetch origin |
-| gg | git gui citool |
-| gga | git gui citool --amend |
-| ggf | git push --force origin $(current_branch) |
-| ggfl | git push --force-with-lease origin $(current_branch) |
-| ggl | git pull origin $(current_branch) |
-| ggp | git push origin $(current_branch) |
-| ggpnp | ggl && ggp |
-| ggpull | git pull origin "$(git_current_branch)" |
-| ggpur | ggu |
-| ggpush | git push origin "$(git_current_branch)" |
-| ggsup | git branch --set-upstream-to=origin/$(git_current_branch) |
-| ggu | git pull --rebase origin $(current_branch) |
-| gpsup | git push --set-upstream origin $(git_current_branch) |
-| ghh | git help |
-| gignore | git update-index --assume-unchanged |
-| gignored | git ls-files -v \| grep "^[[:lower:]]" |
-| git-svn-dcommit-push | git svn dcommit && git push github master:svntrunk |
-| gk | gitk --all --branches |
-| gke | gitk --all $(git log -g --pretty=%h) |
-| gl | git pull |
-| glg | git log --stat |
-| glgp | git log --stat -p |
-| glgg | git log --graph |
-| glgga | git log --graph --decorate --all |
-| glgm | git log --graph --max-count=10 |
-| glo | git log --oneline --decorate |
-| glol | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' |
-| glols | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat |
-| glod | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' |
-| glods | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short |
-| glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all |
-| glog | git log --oneline --decorate --graph |
-| gloga | git log --oneline --decorate --graph --all |
-| glp | `_git_log_prettily` |
-| gm | git merge |
-| gmom | git merge origin/master |
-| gmt | git mergetool --no-prompt |
-| gmtvim | git mergetool --no-prompt --tool=vimdiff |
-| gmum | git merge upstream/master |
-| gma | git merge --abort |
-| gp | git push |
-| gpd | git push --dry-run |
-| gpf | git push --force-with-lease |
-| gpf! | git push --force |
-| gpoat | git push origin --all && git push origin --tags |
-| gpu | git push upstream |
-| gpv | git push -v |
-| gr | git remote |
-| gra | git remote add |
-| grb | git rebase |
-| grba | git rebase --abort |
-| grbc | git rebase --continue |
-| grbd | git rebase develop |
-| grbi | git rebase -i |
-| grbm | git rebase master |
-| grbs | git rebase --skip |
-| grev | git revert |
-| grh | git reset |
-| grhh | git reset --hard |
-| groh | git reset origin/$(git_current_branch) --hard |
-| grm | git rm |
-| grmc | git rm --cached |
-| grmv | git remote rename |
-| grrm | git remote remove |
-| grs | git restore |
-| grset | git remote set-url |
-| grss | git restore --source |
-| grt | cd "$(git rev-parse --show-toplevel \|\| echo .)" |
-| gru | git reset -- |
-| grup | git remote update |
-| grv | git remote -v |
-| gsb | git status -sb |
-| gsd | git svn dcommit |
-| gsh | git show |
-| gsi | git submodule init |
-| gsps | git show --pretty=short --show-signature |
-| gsr | git svn rebase |
-| gss | git status -s |
-| gst | git status |
-| gsta | git stash push |
-| gsta | git stash save |
-| gstaa | git stash apply |
-| gstc | git stash clear |
-| gstd | git stash drop |
-| gstl | git stash list |
-| gstp | git stash pop |
-| gsts | git stash show --text |
-| gstall | git stash --all |
-| gsu | git submodule update |
-| gsw | git switch |
-| gswc | git switch -c |
-| gts | git tag -s |
-| gtv | git tag \| sort -V |
-| gtl | gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl |
-| gunignore | git update-index --no-assume-unchanged |
-| gunwip | git log -n 1 \| grep -q -c "\-\-wip\-\-" && git reset HEAD~1 |
-| gup | git pull --rebase |
-| gupv | git pull --rebase -v |
-| gupa | git pull --rebase --autostash |
-| gupav | git pull --rebase --autostash -v |
-| glum | git pull upstream master |
-| gwch | git whatchanged -p --abbrev-commit --pretty=medium |
-| gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" |
+| Alias | Command |
+|:---------------------|:---------------------------------------------------------------------------------------------------------------------------------|
+| g | git |
+| ga | git add |
+| gaa | git add --all |
+| gapa | git add --patch |
+| gau | git add --update |
+| gav | git add --verbose |
+| gap | git apply |
+| gapt | git apply --3way |
+| gb | git branch |
+| gba | git branch -a |
+| gbd | git branch -d |
+| gbda | git branch --no-color --merged \| command grep -vE "^(\+\|\*\|\s*($(git_main_branch)\|development\|develop\|devel\|dev)\s*$)" \| command xargs -n 1 git branch -d |
+| gbD | git branch -D |
+| gbl | git blame -b -w |
+| gbnm | git branch --no-merged |
+| gbr | git branch --remote |
+| gbs | git bisect |
+| gbsb | git bisect bad |
+| gbsg | git bisect good |
+| gbsr | git bisect reset |
+| gbss | git bisect start |
+| gc | git commit -v |
+| gc! | git commit -v --amend |
+| gcn! | git commit -v --no-edit --amend |
+| gca | git commit -v -a |
+| gca! | git commit -v -a --amend |
+| gcan! | git commit -v -a --no-edit --amend |
+| gcans! | git commit -v -a -s --no-edit --amend |
+| gcam | git commit -a -m |
+| gcsm | git commit -s -m |
+| gcb | git checkout -b |
+| gcf | git config --list |
+| gcl | git clone --recurse-submodules |
+| gclean | git clean -id |
+| gpristine | git reset --hard && git clean -dffx |
+| gcm | git checkout $(git_main_branch) |
+| gcd | git checkout develop |
+| gcmsg | git commit -m |
+| gco | git checkout |
+| gcount | git shortlog -sn |
+| gcp | git cherry-pick |
+| gcpa | git cherry-pick --abort |
+| gcpc | git cherry-pick --continue |
+| gcs | git commit -S |
+| gd | git diff |
+| gdca | git diff --cached |
+| gdcw | git diff --cached --word-diff |
+| gdct | git describe --tags $(git rev-list --tags --max-count=1) |
+| gds | git diff --staged |
+| gdt | git diff-tree --no-commit-id --name-only -r |
+| gdnolock | git diff $@ ":(exclude)package-lock.json" ":(exclude)*.lock" |
+| gdv | git diff -w $@ \| view - |
+| gdw | git diff --word-diff |
+| gf | git fetch |
+| gfa | git fetch --all --prune |
+| gfg | git ls-files \| grep |
+| gfo | git fetch origin |
+| gg | git gui citool |
+| gga | git gui citool --amend |
+| ggf | git push --force origin $(current_branch) |
+| ggfl | git push --force-with-lease origin $(current_branch) |
+| ggl | git pull origin $(current_branch) |
+| ggp | git push origin $(current_branch) |
+| ggpnp | ggl && ggp |
+| ggpull | git pull origin "$(git_current_branch)" |
+| ggpur | ggu |
+| ggpush | git push origin "$(git_current_branch)" |
+| ggsup | git branch --set-upstream-to=origin/$(git_current_branch) |
+| ggu | git pull --rebase origin $(current_branch) |
+| gpsup | git push --set-upstream origin $(git_current_branch) |
+| ghh | git help |
+| gignore | git update-index --assume-unchanged |
+| gignored | git ls-files -v \| grep "^[[:lower:]]" |
+| git-svn-dcommit-push | git svn dcommit && git push github $(git_main_branch):svntrunk |
+| gk | gitk --all --branches |
+| gke | gitk --all $(git log -g --pretty=%h) |
+| gl | git pull |
+| glg | git log --stat |
+| glgp | git log --stat -p |
+| glgg | git log --graph |
+| glgga | git log --graph --decorate --all |
+| glgm | git log --graph --max-count=10 |
+| glo | git log --oneline --decorate |
+| glol | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' |
+| glols | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat |
+| glod | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' |
+| glods | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short |
+| glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all |
+| glog | git log --oneline --decorate --graph |
+| gloga | git log --oneline --decorate --graph --all |
+| glp | git log --pretty=\ |
+| gm | git merge |
+| gmom | git merge origin/$(git_main_branch) |
+| gmt | git mergetool --no-prompt |
+| gmtvim | git mergetool --no-prompt --tool=vimdiff |
+| gmum | git merge upstream/$(git_main_branch) |
+| gma | git merge --abort |
+| gp | git push |
+| gpd | git push --dry-run |
+| gpf | git push --force-with-lease |
+| gpf! | git push --force |
+| gpoat | git push origin --all && git push origin --tags |
+| gpu | git push upstream |
+| gpv | git push -v |
+| gr | git remote |
+| gra | git remote add |
+| grb | git rebase |
+| grba | git rebase --abort |
+| grbc | git rebase --continue |
+| grbd | git rebase develop |
+| grbi | git rebase -i |
+| grbm | git rebase $(git_main_branch) |
+| grbs | git rebase --skip |
+| grev | git revert |
+| grh | git reset |
+| grhh | git reset --hard |
+| groh | git reset origin/$(git_current_branch) --hard |
+| grm | git rm |
+| grmc | git rm --cached |
+| grmv | git remote rename |
+| grrm | git remote remove |
+| grs | git restore |
+| grset | git remote set-url |
+| grss | git restore --source |
+| grt | cd "$(git rev-parse --show-toplevel \|\| echo .)" |
+| gru | git reset -- |
+| grup | git remote update |
+| grv | git remote -v |
+| gsb | git status -sb |
+| gsd | git svn dcommit |
+| gsh | git show |
+| gsi | git submodule init |
+| gsps | git show --pretty=short --show-signature |
+| gsr | git svn rebase |
+| gss | git status -s |
+| gst | git status |
+| gsta | git stash push |
+| gsta | git stash save |
+| gstaa | git stash apply |
+| gstc | git stash clear |
+| gstd | git stash drop |
+| gstl | git stash list |
+| gstp | git stash pop |
+| gsts | git stash show --text |
+| gstu | git stash --include-untracked |
+| gstall | git stash --all |
+| gsu | git submodule update |
+| gsw | git switch |
+| gswc | git switch -c |
+| gts | git tag -s |
+| gtv | git tag \| sort -V |
+| gtl | gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl |
+| gunignore | git update-index --no-assume-unchanged |
+| gunwip | git log -n 1 \| grep -q -c "\-\-wip\-\-" && git reset HEAD~1 |
+| gup | git pull --rebase |
+| gupv | git pull --rebase -v |
+| gupa | git pull --rebase --autostash |
+| gupav | git pull --rebase --autostash -v |
+| glum | git pull upstream $(git_main_branch) |
+| gwch | git whatchanged -p --abbrev-commit --pretty=medium |
+| gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" |
+| gam | git am |
+| gamc | git am --continue |
+| gams | git am --skip |
+| gama | git am --abort |
+| gamscp | git am --show-current-patch |
-### Deprecated
+### Main branch preference
+
+Following the recent push for removing racially-charged words from our technical vocabulary, the git plugin favors using
+a branch name other than `master`. In this case, we favor the shorter, neutral and descriptive term `main`. This means
+that any aliases and functions that previously used `master`, will use `main` if that branch exists. We do this via the
+function `git_main_branch`.
+
+### Deprecated aliases
These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not, receive further support.
-| Alias | Command | Modification |
-| :----- | :----------------------------------------------------------------------------------| --------------------------------------------------------------------------------------------------- |
-| gap | git add --patch | new alias `gapa` |
-| gcl | git config --list | new alias `gcf` |
-| gdc | git diff --cached | new alias `gdca` |
-| gdt | git difftool | no replacement |
-| ggpull | git pull origin $(current_branch) | new alias `ggl` (`ggpull` still exists for now though) |
-| ggpur | git pull --rebase origin $(current_branch) | new alias `ggu` (`ggpur` still exists for now though) |
-| ggpush | git push origin $(current_branch) | new alias `ggp` (`ggpush` still exists for now though) |
-| gk | gitk --all --branches | now aliased to `gitk --all --branches` |
-| glg | git log --stat --max-count = 10 | now aliased to `git log --stat --color` |
-| glgg | git log --graph --max-count = 10 | now aliased to `git log --graph --color` |
-| gwc | git whatchanged -p --abbrev-commit --pretty = medium | new alias `gwch` |
+| Alias | Command | Modification |
+| :----- | :----------------------------------------------------- | :----------------------------------------------------- |
+| gap | `git add --patch` | new alias `gapa` |
+| gcl | `git config --list` | new alias `gcf` |
+| gdc | `git diff --cached` | new alias `gdca` |
+| gdt | `git difftool` | no replacement |
+| ggpull | `git pull origin $(current_branch)` | new alias `ggl` (`ggpull` still exists for now though) |
+| ggpur | `git pull --rebase origin $(current_branch)` | new alias `ggu` (`ggpur` still exists for now though) |
+| ggpush | `git push origin $(current_branch)` | new alias `ggp` (`ggpush` still exists for now though) |
+| gk | `gitk --all --branches` | now aliased to `gitk --all --branches` |
+| glg | `git log --stat --max-count = 10` | now aliased to `git log --stat --color` |
+| glgg | `git log --graph --max-count = 10` | now aliased to `git log --graph --color` |
+| gwc | `git whatchanged -p --abbrev-commit --pretty = medium` | new alias `gwch` |
## Functions
### Current
-| Command | Description |
-|:-----------------------|:----------------------------------------|
-| current_branch | Return the name of the current branch |
-| git_current_user_name | Returns the `user.name` config value |
-| git_current_user_email | Returns the `user.email` config value |
+| Command | Description |
+|:-----------------------|:-----------------------------------------------------------------------------|
+| `grename ` | Rename `old` branch to `new`, including in origin remote |
+| current_branch | Return the name of the current branch |
+| git_current_user_name | Returns the `user.name` config value |
+| git_current_user_email | Returns the `user.email` config value |
+| git_main_branch | Returns the name of the main branch: `main` if it exists, `master` otherwise |
### Work in Progress (WIP)
@@ -209,7 +226,7 @@ These features allow to pause a branch development and switch to another one (_"
| gwip | Commit wip branch |
| gunwip | Uncommit wip branch |
-### Deprecated
+### Deprecated functions
| Command | Description | Reason |
|:-----------------------|:----------------------------------------|:----------------------------------------------------------------|
diff --git a/zsh/plugins/git/git.plugin.zsh b/zsh/plugins/git/git.plugin.zsh
index d8c4cff..ccb9d84 100644
--- a/zsh/plugins/git/git.plugin.zsh
+++ b/zsh/plugins/git/git.plugin.zsh
@@ -1,3 +1,7 @@
+# Git version checking
+autoload -Uz is-at-least
+git_version="${${(As: :)$(git version 2>/dev/null)}[3]}"
+
#
# Functions
#
@@ -25,6 +29,15 @@ function work_in_progress() {
fi
}
+# Check if main exists and use instead of master
+function git_main_branch() {
+ if [[ -n "$(git branch --list main)" ]]; then
+ echo main
+ else
+ echo master
+ fi
+}
+
#
# Aliases
# (sorted alphabetically)
@@ -38,11 +51,12 @@ alias gapa='git add --patch'
alias gau='git add --update'
alias gav='git add --verbose'
alias gap='git apply'
+alias gapt='git apply --3way'
alias gb='git branch'
alias gba='git branch -a'
alias gbd='git branch -d'
-alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d'
+alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*($(git_main_branch)|development|develop|devel|dev)\s*$)" | command xargs -n 1 git branch -d'
alias gbD='git branch -D'
alias gbl='git blame -b -w'
alias gbnm='git branch --no-merged'
@@ -66,8 +80,8 @@ alias gcb='git checkout -b'
alias gcf='git config --list'
alias gcl='git clone --recurse-submodules'
alias gclean='git clean -id'
-alias gpristine='git reset --hard && git clean -dfx'
-alias gcm='git checkout master'
+alias gpristine='git reset --hard && git clean -dffx'
+alias gcm='git checkout $(git_main_branch)'
alias gcd='git checkout develop'
alias gcmsg='git commit -m'
alias gco='git checkout'
@@ -85,11 +99,19 @@ alias gds='git diff --staged'
alias gdt='git diff-tree --no-commit-id --name-only -r'
alias gdw='git diff --word-diff'
+function gdnolock() {
+ git diff "$@" ":(exclude)package-lock.json" ":(exclude)*.lock"
+}
+compdef _git gdnolock=git-diff
+
function gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff
alias gf='git fetch'
-alias gfa='git fetch --all --prune'
+# --jobs= was added in git 2.8
+is-at-least 2.8 "$git_version" \
+ && alias gfa='git fetch --all --prune --jobs=10' \
+ || alias gfa='git fetch --all --prune'
alias gfo='git fetch origin'
alias gfg='git ls-files | grep'
@@ -154,7 +176,7 @@ alias ghh='git help'
alias gignore='git update-index --assume-unchanged'
alias gignored='git ls-files -v | grep "^[[:lower:]]"'
-alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
+alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk'
alias gk='\gitk --all --branches'
alias gke='\gitk --all $(git log -g --pretty=%h)'
@@ -176,10 +198,10 @@ alias gloga='git log --oneline --decorate --graph --all'
alias glp="_git_log_prettily"
alias gm='git merge'
-alias gmom='git merge origin/master'
+alias gmom='git merge origin/$(git_main_branch)'
alias gmt='git mergetool --no-prompt'
alias gmtvim='git mergetool --no-prompt --tool=vimdiff'
-alias gmum='git merge upstream/master'
+alias gmum='git merge upstream/$(git_main_branch)'
alias gma='git merge --abort'
alias gp='git push'
@@ -197,7 +219,7 @@ alias grba='git rebase --abort'
alias grbc='git rebase --continue'
alias grbd='git rebase develop'
alias grbi='git rebase -i'
-alias grbm='git rebase master'
+alias grbm='git rebase $(git_main_branch)'
alias grbs='git rebase --skip'
alias grev='git revert'
alias grh='git reset'
@@ -225,8 +247,7 @@ alias gss='git status -s'
alias gst='git status'
# use the default stash push on git 2.13 and newer
-autoload -Uz is-at-least
-is-at-least 2.13 "$(git --version 2>/dev/null | awk '{print $3}')" \
+is-at-least 2.13 "$git_version" \
&& alias gsta='git stash push' \
|| alias gsta='git stash save'
@@ -236,6 +257,7 @@ alias gstd='git stash drop'
alias gstl='git stash list'
alias gstp='git stash pop'
alias gsts='git stash show --text'
+alias gstu='git stash --include-untracked'
alias gstall='git stash --all'
alias gsu='git submodule update'
alias gsw='git switch'
@@ -251,7 +273,29 @@ alias gup='git pull --rebase'
alias gupv='git pull --rebase -v'
alias gupa='git pull --rebase --autostash'
alias gupav='git pull --rebase --autostash -v'
-alias glum='git pull upstream master'
+alias glum='git pull upstream $(git_main_branch)'
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"'
+
+alias gam='git am'
+alias gamc='git am --continue'
+alias gams='git am --skip'
+alias gama='git am --abort'
+alias gamscp='git am --show-current-patch'
+
+function grename() {
+ if [[ -z "$1" || -z "$2" ]]; then
+ echo "Usage: $0 old_branch new_branch"
+ return 1
+ fi
+
+ # Rename branch locally
+ git branch -m "$1" "$2"
+ # Rename branch in origin remote
+ if git push origin :"$1"; then
+ git push --set-upstream origin "$2"
+ fi
+}
+
+unset git_version
diff --git a/zsh/plugins/gitfast/README.md b/zsh/plugins/gitfast/README.md
index 84e35d7..fed4b12 100644
--- a/zsh/plugins/gitfast/README.md
+++ b/zsh/plugins/gitfast/README.md
@@ -1,6 +1,6 @@
# Gitfast plugin
-This plugin adds completion for Git, using the zsh completion from git.git folks, which is much faster than the official one from zsh. A lot of zsh-specific features are not supported, like descriptions for every argument, but everything the bash completion has, this one does too (as it is using it behind the scenes). Not only is it faster, it should be more robust, and updated regularly to the latest git upstream version..
+This plugin adds completion for Git, using the zsh completion from git.git folks, which is much faster than the official one from zsh. A lot of zsh-specific features are not supported, like descriptions for every argument, but everything the bash completion has, this one does too (as it is using it behind the scenes). Not only is it faster, it should be more robust, and updated regularly to the latest git upstream version.
To use it, add `gitfast` to the plugins array in your zshrc file:
@@ -11,5 +11,5 @@ plugins=(... gitfast)
## Aliases
An earlier version of the plugin also loaded the git plugin. If you want to keep those
-aliases enable the [git plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/git)
+aliases enable the [git plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git)
as well.
diff --git a/zsh/plugins/gitfast/_git b/zsh/plugins/gitfast/_git
index 886bf95..78a6dbb 100644
--- a/zsh/plugins/gitfast/_git
+++ b/zsh/plugins/gitfast/_git
@@ -30,7 +30,7 @@ if [ -z "$script" ]; then
local -a locations
local e
locations=(
- $(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
+ "$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash"
'/etc/bash_completion.d/git' # fedora, old debian
'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
'/usr/share/bash-completion/git' # gentoo
@@ -39,7 +39,7 @@ if [ -z "$script" ]; then
test -f $e && script="$e" && break
done
fi
-GIT_SOURCING_ZSH_COMPLETION=y . "$script"
+ZSH_VERSION='' . "$script"
__gitcomp ()
{
@@ -93,22 +93,13 @@ __gitcomp_nl_append ()
compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
}
-__gitcomp_file_direct ()
-{
- emulate -L zsh
-
- local IFS=$'\n'
- compset -P '*[=:]'
- compadd -f -- ${=1} && _ret=0
-}
-
__gitcomp_file ()
{
emulate -L zsh
local IFS=$'\n'
compset -P '*[=:]'
- compadd -p "${2-}" -f -- ${=1} && _ret=0
+ compadd -Q -p "${2-}" -f -- ${=1} && _ret=0
}
__git_zsh_bash_func ()
@@ -232,8 +223,10 @@ _git ()
if (( $+functions[__${service}_zsh_main] )); then
__${service}_zsh_main
- else
+ elif (( $+functions[__${service}_main] )); then
emulate ksh -c __${service}_main
+ elif (( $+functions[_${service}] )); then
+ emulate ksh -c _${service}
fi
let _ret && _default && _ret=0
diff --git a/zsh/plugins/gitfast/git-completion.bash b/zsh/plugins/gitfast/git-completion.bash
index e087c4b..b6ff5dc 100644
--- a/zsh/plugins/gitfast/git-completion.bash
+++ b/zsh/plugins/gitfast/git-completion.bash
@@ -29,16 +29,13 @@
# tell the completion to use commit completion. This also works with aliases
# of form "!sh -c '...'". For example, "!sh -c ': git commit ; ... '".
#
-# Compatible with bash 3.2.57.
-#
# You can set the following environment variables to influence the behavior of
# the completion routines:
#
# GIT_COMPLETION_CHECKOUT_NO_GUESS
#
# When set to "1", do not include "DWIM" suggestions in git-checkout
-# and git-switch completion (e.g., completing "foo" when "origin/foo"
-# exists).
+# completion (e.g., completing "foo" when "origin/foo" exists).
case "$COMP_WORDBREAKS" in
*:*) : great ;;
@@ -95,70 +92,6 @@ __git ()
${__git_dir:+--git-dir="$__git_dir"} "$@" 2>/dev/null
}
-# Removes backslash escaping, single quotes and double quotes from a word,
-# stores the result in the variable $dequoted_word.
-# 1: The word to dequote.
-__git_dequote ()
-{
- local rest="$1" len ch
-
- dequoted_word=""
-
- while test -n "$rest"; do
- len=${#dequoted_word}
- dequoted_word="$dequoted_word${rest%%[\\\'\"]*}"
- rest="${rest:$((${#dequoted_word}-$len))}"
-
- case "${rest:0:1}" in
- \\)
- ch="${rest:1:1}"
- case "$ch" in
- $'\n')
- ;;
- *)
- dequoted_word="$dequoted_word$ch"
- ;;
- esac
- rest="${rest:2}"
- ;;
- \')
- rest="${rest:1}"
- len=${#dequoted_word}
- dequoted_word="$dequoted_word${rest%%\'*}"
- rest="${rest:$((${#dequoted_word}-$len+1))}"
- ;;
- \")
- rest="${rest:1}"
- while test -n "$rest" ; do
- len=${#dequoted_word}
- dequoted_word="$dequoted_word${rest%%[\\\"]*}"
- rest="${rest:$((${#dequoted_word}-$len))}"
- case "${rest:0:1}" in
- \\)
- ch="${rest:1:1}"
- case "$ch" in
- \"|\\|\$|\`)
- dequoted_word="$dequoted_word$ch"
- ;;
- $'\n')
- ;;
- *)
- dequoted_word="$dequoted_word\\$ch"
- ;;
- esac
- rest="${rest:2}"
- ;;
- \")
- rest="${rest:1}"
- break
- ;;
- esac
- done
- ;;
- esac
- done
-}
-
# The following function is based on code from:
#
# bash_completion - programmable completion functions for bash 3.2+
@@ -331,32 +264,9 @@ __gitcomp ()
case "$cur_" in
--*=)
;;
- --no-*)
- local c i=0 IFS=$' \t\n'
- for c in $1; do
- if [[ $c == "--" ]]; then
- continue
- fi
- c="$c${4-}"
- if [[ $c == "$cur_"* ]]; then
- case $c in
- --*=*|*.) ;;
- *) c="$c " ;;
- esac
- COMPREPLY[i++]="${2-}$c"
- fi
- done
- ;;
*)
local c i=0 IFS=$' \t\n'
for c in $1; do
- if [[ $c == "--" ]]; then
- c="--no-...${4-}"
- if [[ $c == "$cur_"* ]]; then
- COMPREPLY[i++]="${2-}$c "
- fi
- break
- fi
c="$c${4-}"
if [[ $c == "$cur_"* ]]; then
case $c in
@@ -370,48 +280,6 @@ __gitcomp ()
esac
}
-# Clear the variables caching builtins' options when (re-)sourcing
-# the completion script.
-if [[ -n ${ZSH_VERSION-} ]]; then
- unset $(set |sed -ne 's/^\(__gitcomp_builtin_[a-zA-Z0-9_][a-zA-Z0-9_]*\)=.*/\1/p') 2>/dev/null
-else
- unset $(compgen -v __gitcomp_builtin_)
-fi
-
-# This function is equivalent to
-#
-# __gitcomp "$(git xxx --git-completion-helper) ..."
-#
-# except that the output is cached. Accept 1-3 arguments:
-# 1: the git command to execute, this is also the cache key
-# 2: extra options to be added on top (e.g. negative forms)
-# 3: options to be excluded
-__gitcomp_builtin ()
-{
- # spaces must be replaced with underscore for multi-word
- # commands, e.g. "git remote add" becomes remote_add.
- local cmd="$1"
- local incl="$2"
- local excl="$3"
-
- local var=__gitcomp_builtin_"${cmd/-/_}"
- local options
- eval "options=\$$var"
-
- if [ -z "$options" ]; then
- # leading and trailing spaces are significant to make
- # option removal work correctly.
- options=" $incl $(__git ${cmd/_/ } --git-completion-helper) " || return
-
- for i in $excl; do
- options="${options/ $i / }"
- done
- eval "$var=\"$options\""
- fi
-
- __gitcomp "$options"
-}
-
# Variation of __gitcomp_nl () that appends to the existing list of
# completion candidates, COMPREPLY.
__gitcomp_nl_append ()
@@ -435,24 +303,6 @@ __gitcomp_nl ()
__gitcomp_nl_append "$@"
}
-# Fills the COMPREPLY array with prefiltered paths without any additional
-# processing.
-# Callers must take care of providing only paths that match the current path
-# to be completed and adding any prefix path components, if necessary.
-# 1: List of newline-separated matching paths, complete with all prefix
-# path components.
-__gitcomp_file_direct ()
-{
- local IFS=$'\n'
-
- COMPREPLY=($1)
-
- # use a hack to enable file mode in bash < 4
- compopt -o filenames +o nospace 2>/dev/null ||
- compgen -f /non-existing-dir/ >/dev/null ||
- true
-}
-
# Generates completion reply with compgen from newline-separated possible
# completion filenames.
# It accepts 1 to 3 arguments:
@@ -472,8 +322,7 @@ __gitcomp_file ()
# use a hack to enable file mode in bash < 4
compopt -o filenames +o nospace 2>/dev/null ||
- compgen -f /non-existing-dir/ >/dev/null ||
- true
+ compgen -f /non-existing-dir/ > /dev/null
}
# Execute 'git ls-files', unless the --committable option is specified, in
@@ -483,12 +332,10 @@ __gitcomp_file ()
__git_ls_files_helper ()
{
if [ "$2" == "--committable" ]; then
- __git -C "$1" -c core.quotePath=false diff-index \
- --name-only --relative HEAD -- "${3//\\/\\\\}*"
+ __git -C "$1" diff-index --name-only --relative HEAD
else
# NOTE: $2 is not quoted in order to support multiple options
- __git -C "$1" -c core.quotePath=false ls-files \
- --exclude-standard $2 -- "${3//\\/\\\\}*"
+ __git -C "$1" ls-files --exclude-standard $2
fi
}
@@ -499,103 +346,17 @@ __git_ls_files_helper ()
# If provided, only files within the specified directory are listed.
# Sub directories are never recursed. Path must have a trailing
# slash.
-# 3: List only paths matching this path component (optional).
__git_index_files ()
{
- local root="$2" match="$3"
+ local root="${2-.}" file
- __git_ls_files_helper "$root" "$1" "$match" |
- awk -F / -v pfx="${2//\\/\\\\}" '{
- paths[$1] = 1
- }
- END {
- for (p in paths) {
- if (substr(p, 1, 1) != "\"") {
- # No special characters, easy!
- print pfx p
- continue
- }
-
- # The path is quoted.
- p = dequote(p)
- if (p == "")
- continue
-
- # Even when a directory name itself does not contain
- # any special characters, it will still be quoted if
- # any of its (stripped) trailing path components do.
- # Because of this we may have seen the same direcory
- # both quoted and unquoted.
- if (p in paths)
- # We have seen the same directory unquoted,
- # skip it.
- continue
- else
- print pfx p
- }
- }
- function dequote(p, bs_idx, out, esc, esc_idx, dec) {
- # Skip opening double quote.
- p = substr(p, 2)
-
- # Interpret backslash escape sequences.
- while ((bs_idx = index(p, "\\")) != 0) {
- out = out substr(p, 1, bs_idx - 1)
- esc = substr(p, bs_idx + 1, 1)
- p = substr(p, bs_idx + 2)
-
- if ((esc_idx = index("abtvfr\"\\", esc)) != 0) {
- # C-style one-character escape sequence.
- out = out substr("\a\b\t\v\f\r\"\\",
- esc_idx, 1)
- } else if (esc == "n") {
- # Uh-oh, a newline character.
- # We cant reliably put a pathname
- # containing a newline into COMPREPLY,
- # and the newline would create a mess.
- # Skip this path.
- return ""
- } else {
- # Must be a \nnn octal value, then.
- dec = esc * 64 + \
- substr(p, 1, 1) * 8 + \
- substr(p, 2, 1)
- out = out sprintf("%c", dec)
- p = substr(p, 3)
- }
- }
- # Drop closing double quote, if there is one.
- # (There isnt any if this is a directory, as it was
- # already stripped with the trailing path components.)
- if (substr(p, length(p), 1) == "\"")
- out = out substr(p, 1, length(p) - 1)
- else
- out = out p
-
- return out
- }'
-}
-
-# __git_complete_index_file requires 1 argument:
-# 1: the options to pass to ls-file
-#
-# The exception is --committable, which finds the files appropriate commit.
-__git_complete_index_file ()
-{
- local dequoted_word pfx="" cur_
-
- __git_dequote "$cur"
-
- case "$dequoted_word" in
- ?*/*)
- pfx="${dequoted_word%/*}/"
- cur_="${dequoted_word##*/}"
- ;;
- *)
- cur_="$dequoted_word"
- esac
-
- __gitcomp_file_direct "$(__git_index_files "$1" "$pfx" "$cur_")"
+ __git_ls_files_helper "$root" "$1" |
+ while read -r file; do
+ case "$file" in
+ ?*/*) echo "${file%%/*}" ;;
+ *) echo "$file" ;;
+ esac
+ done | sort | uniq
}
# Lists branches from the local repository.
@@ -678,7 +439,7 @@ __git_refs ()
track=""
;;
*)
- for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD; do
+ for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do
case "$i" in
$match*)
if [ -e "$dir/$i" ]; then
@@ -833,7 +594,7 @@ __git_is_configured_remote ()
__git_list_merge_strategies ()
{
- LANG=C LC_ALL=C git merge -s help 2>&1 |
+ git merge -s help 2>&1 |
sed -n -e '/[Aa]vailable strategies are: /,/^$/{
s/\.$//
s/.*://
@@ -855,14 +616,9 @@ __git_compute_merge_strategies ()
__git_merge_strategies=$(__git_list_merge_strategies)
}
-__git_merge_strategy_options="ours theirs subtree subtree= patience
- histogram diff-algorithm= ignore-space-change ignore-all-space
- ignore-space-at-eol renormalize no-renormalize no-renames
- find-renames find-renames= rename-threshold="
-
__git_complete_revlist_file ()
{
- local dequoted_word pfx ls ref cur_="$cur"
+ local pfx ls ref cur_="$cur"
case "$cur_" in
*..?*:*)
return
@@ -870,18 +626,14 @@ __git_complete_revlist_file ()
?*:*)
ref="${cur_%%:*}"
cur_="${cur_#*:}"
-
- __git_dequote "$cur_"
-
- case "$dequoted_word" in
+ case "$cur_" in
?*/*)
- pfx="${dequoted_word%/*}"
- cur_="${dequoted_word##*/}"
+ pfx="${cur_%/*}"
+ cur_="${cur_##*/}"
ls="$ref:$pfx"
pfx="$pfx/"
;;
*)
- cur_="$dequoted_word"
ls="$ref"
;;
esac
@@ -891,10 +643,21 @@ __git_complete_revlist_file ()
*) pfx="$ref:$pfx" ;;
esac
- __gitcomp_file "$(__git ls-tree "$ls" \
- | sed 's/^.* //
- s/$//')" \
- "$pfx" "$cur_"
+ __gitcomp_nl "$(__git ls-tree "$ls" \
+ | sed '/^100... blob /{
+ s,^.* ,,
+ s,$, ,
+ }
+ /^120000 blob /{
+ s,^.* ,,
+ s,$, ,
+ }
+ /^040000 tree /{
+ s,^.* ,,
+ s,$,/,
+ }
+ s/^.* //')" \
+ "$pfx" "$cur_" ""
;;
*...*)
pfx="${cur_%...*}..."
@@ -912,6 +675,26 @@ __git_complete_revlist_file ()
esac
}
+
+# __git_complete_index_file requires 1 argument:
+# 1: the options to pass to ls-file
+#
+# The exception is --committable, which finds the files appropriate commit.
+__git_complete_index_file ()
+{
+ local pfx="" cur_="$cur"
+
+ case "$cur_" in
+ ?*/*)
+ pfx="${cur_%/*}"
+ cur_="${cur_##*/}"
+ pfx="${pfx}/"
+ ;;
+ esac
+
+ __gitcomp_file "$(__git_index_files "$1" ${pfx:+"$pfx"})" "$pfx" "$cur_"
+}
+
__git_complete_file ()
{
__git_complete_revlist_file
@@ -943,7 +726,6 @@ __git_complete_remote_or_refspec ()
*) ;;
esac
;;
- --multiple) no_complete_refspec=1; break ;;
-*) ;;
*) remote="$i"; break ;;
esac
@@ -1003,30 +785,136 @@ __git_complete_strategy ()
-s|--strategy)
__gitcomp "$__git_merge_strategies"
return 0
- ;;
- -X)
- __gitcomp "$__git_merge_strategy_options"
- return 0
- ;;
esac
case "$cur" in
--strategy=*)
__gitcomp "$__git_merge_strategies" "" "${cur##--strategy=}"
return 0
;;
- --strategy-option=*)
- __gitcomp "$__git_merge_strategy_options" "" "${cur##--strategy-option=}"
- return 0
- ;;
esac
return 1
}
+__git_commands () {
+ if test -n "${GIT_TESTING_COMMAND_COMPLETION:-}"
+ then
+ printf "%s" "${GIT_TESTING_COMMAND_COMPLETION}"
+ else
+ git help -a|egrep '^ [a-zA-Z0-9]'
+ fi
+}
+
+__git_list_all_commands ()
+{
+ local i IFS=" "$'\n'
+ for i in $(__git_commands)
+ do
+ case $i in
+ *--*) : helper pattern;;
+ *) echo $i;;
+ esac
+ done
+}
+
__git_all_commands=
__git_compute_all_commands ()
{
test -n "$__git_all_commands" ||
- __git_all_commands=$(__git --list-cmds=main,others,alias,nohelpers)
+ __git_all_commands=$(__git_list_all_commands)
+}
+
+__git_list_porcelain_commands ()
+{
+ local i IFS=" "$'\n'
+ __git_compute_all_commands
+ for i in $__git_all_commands
+ do
+ case $i in
+ *--*) : helper pattern;;
+ applymbox) : ask gittus;;
+ applypatch) : ask gittus;;
+ archimport) : import;;
+ cat-file) : plumbing;;
+ check-attr) : plumbing;;
+ check-ignore) : plumbing;;
+ check-mailmap) : plumbing;;
+ check-ref-format) : plumbing;;
+ checkout-index) : plumbing;;
+ column) : internal helper;;
+ commit-tree) : plumbing;;
+ count-objects) : infrequent;;
+ credential) : credentials;;
+ credential-*) : credentials helper;;
+ cvsexportcommit) : export;;
+ cvsimport) : import;;
+ cvsserver) : daemon;;
+ daemon) : daemon;;
+ diff-files) : plumbing;;
+ diff-index) : plumbing;;
+ diff-tree) : plumbing;;
+ fast-import) : import;;
+ fast-export) : export;;
+ fsck-objects) : plumbing;;
+ fetch-pack) : plumbing;;
+ fmt-merge-msg) : plumbing;;
+ for-each-ref) : plumbing;;
+ hash-object) : plumbing;;
+ http-*) : transport;;
+ index-pack) : plumbing;;
+ init-db) : deprecated;;
+ local-fetch) : plumbing;;
+ ls-files) : plumbing;;
+ ls-remote) : plumbing;;
+ ls-tree) : plumbing;;
+ mailinfo) : plumbing;;
+ mailsplit) : plumbing;;
+ merge-*) : plumbing;;
+ mktree) : plumbing;;
+ mktag) : plumbing;;
+ pack-objects) : plumbing;;
+ pack-redundant) : plumbing;;
+ pack-refs) : plumbing;;
+ parse-remote) : plumbing;;
+ patch-id) : plumbing;;
+ prune) : plumbing;;
+ prune-packed) : plumbing;;
+ quiltimport) : import;;
+ read-tree) : plumbing;;
+ receive-pack) : plumbing;;
+ remote-*) : transport;;
+ rerere) : plumbing;;
+ rev-list) : plumbing;;
+ rev-parse) : plumbing;;
+ runstatus) : plumbing;;
+ sh-setup) : internal;;
+ shell) : daemon;;
+ show-ref) : plumbing;;
+ send-pack) : plumbing;;
+ show-index) : plumbing;;
+ ssh-*) : transport;;
+ stripspace) : plumbing;;
+ symbolic-ref) : plumbing;;
+ unpack-file) : plumbing;;
+ unpack-objects) : plumbing;;
+ update-index) : plumbing;;
+ update-ref) : plumbing;;
+ update-server-info) : daemon;;
+ upload-archive) : plumbing;;
+ upload-pack) : plumbing;;
+ write-tree) : plumbing;;
+ var) : infrequent;;
+ verify-pack) : infrequent;;
+ verify-tag) : plumbing;;
+ *) echo $i;;
+ esac
+ done
+}
+
+__git_porcelain_commands=
+__git_compute_porcelain_commands ()
+{
+ test -n "$__git_porcelain_commands" ||
+ __git_porcelain_commands=$(__git_list_porcelain_commands)
}
# Lists all set config variables starting with the given section prefix,
@@ -1044,6 +932,11 @@ __git_pretty_aliases ()
__git_get_config_variables "pretty"
}
+__git_aliases ()
+{
+ __git_get_config_variables "alias"
+}
+
# __git_aliased_command requires 1 argument
__git_aliased_command ()
{
@@ -1179,14 +1072,12 @@ __git_count_arguments ()
}
__git_whitespacelist="nowarn warn error error-all fix"
-__git_patchformat="mbox stgit stgit-series hg mboxrd"
-__git_am_inprogress_options="--skip --continue --resolved --abort --quit --show-current-patch"
_git_am ()
{
__git_find_repo_path
if [ -d "$__git_repo_path"/rebase-apply ]; then
- __gitcomp "$__git_am_inprogress_options"
+ __gitcomp "--skip --continue --resolved --abort"
return
fi
case "$cur" in
@@ -1194,13 +1085,13 @@ _git_am ()
__gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
return
;;
- --patch-format=*)
- __gitcomp "$__git_patchformat" "" "${cur##--patch-format=}"
- return
- ;;
--*)
- __gitcomp_builtin am "" \
- "$__git_am_inprogress_options"
+ __gitcomp "
+ --3way --committer-date-is-author-date --ignore-date
+ --ignore-whitespace --ignore-space-change
+ --interactive --keep --no-utf8 --signoff --utf8
+ --whitespace= --scissors
+ "
return
esac
}
@@ -1213,7 +1104,14 @@ _git_apply ()
return
;;
--*)
- __gitcomp_builtin apply
+ __gitcomp "
+ --stat --numstat --summary --check --index
+ --cached --index-info --reverse --reject --unidiff-zero
+ --apply --no-add --exclude=
+ --ignore-whitespace --ignore-space-change
+ --whitespace= --inaccurate-eof --verbose
+ --recount --directory=
+ "
return
esac
}
@@ -1221,12 +1119,11 @@ _git_apply ()
_git_add ()
{
case "$cur" in
- --chmod=*)
- __gitcomp "+x -x" "" "${cur##--chmod=}"
- return
- ;;
--*)
- __gitcomp_builtin add
+ __gitcomp "
+ --interactive --refresh --patch --update --dry-run
+ --ignore-errors --intent-to-add --force --edit --chmod=
+ "
return
esac
@@ -1285,8 +1182,6 @@ _git_bisect ()
esac
}
-__git_ref_fieldlist="refname objecttype objectsize objectname upstream push HEAD symref"
-
_git_branch ()
{
local i c=1 only_local_ref="n" has_r="n"
@@ -1305,7 +1200,13 @@ _git_branch ()
__git_complete_refs --cur="${cur##--set-upstream-to=}"
;;
--*)
- __gitcomp_builtin branch
+ __gitcomp "
+ --color --no-color --verbose --abbrev= --no-abbrev
+ --track --no-track --contains --no-contains --merged --no-merged
+ --set-upstream-to= --edit-description --list
+ --unset-upstream --delete --move --copy --remotes
+ --column --no-column --sort= --points-at
+ "
;;
*)
if [ $only_local_ref = "y" -a $has_r = "n" ]; then
@@ -1346,7 +1247,11 @@ _git_checkout ()
__gitcomp "diff3 merge" "" "${cur##--conflict=}"
;;
--*)
- __gitcomp_builtin checkout
+ __gitcomp "
+ --quiet --ours --theirs --track --no-track --merge
+ --conflict= --orphan --patch --detach --ignore-skip-worktree-bits
+ --recurse-submodules --no-recurse-submodules
+ "
;;
*)
# check if --track, --no-track, or --no-guess was specified
@@ -1361,22 +1266,21 @@ _git_checkout ()
esac
}
-__git_cherry_pick_inprogress_options="--continue --quit --abort"
+_git_cherry ()
+{
+ __git_complete_refs
+}
_git_cherry_pick ()
{
__git_find_repo_path
if [ -f "$__git_repo_path"/CHERRY_PICK_HEAD ]; then
- __gitcomp "$__git_cherry_pick_inprogress_options"
+ __gitcomp "--continue --quit --abort"
return
fi
-
- __git_complete_strategy && return
-
case "$cur" in
--*)
- __gitcomp_builtin cherry-pick "" \
- "$__git_cherry_pick_inprogress_options"
+ __gitcomp "--edit --no-commit --signoff --strategy= --mainline"
;;
*)
__git_complete_refs
@@ -1388,7 +1292,7 @@ _git_clean ()
{
case "$cur" in
--*)
- __gitcomp_builtin clean
+ __gitcomp "--dry-run --quiet"
return
;;
esac
@@ -1401,7 +1305,26 @@ _git_clone ()
{
case "$cur" in
--*)
- __gitcomp_builtin clone
+ __gitcomp "
+ --local
+ --no-hardlinks
+ --shared
+ --reference
+ --quiet
+ --no-checkout
+ --bare
+ --mirror
+ --origin
+ --upload-pack
+ --template=
+ --depth
+ --single-branch
+ --no-tags
+ --branch
+ --recurse-submodules
+ --no-single-branch
+ --shallow-submodules
+ "
return
;;
esac
@@ -1434,7 +1357,16 @@ _git_commit ()
return
;;
--*)
- __gitcomp_builtin commit
+ __gitcomp "
+ --all --author= --signoff --verify --no-verify
+ --edit --no-edit
+ --amend --include --only --interactive
+ --dry-run --reuse-message= --reedit-message=
+ --reset-author --file= --message= --template=
+ --cleanup= --untracked-files --untracked-files=
+ --verbose --quiet --fixup= --squash=
+ --patch --short --date --allow-empty
+ "
return
esac
@@ -1450,7 +1382,11 @@ _git_describe ()
{
case "$cur" in
--*)
- __gitcomp_builtin describe
+ __gitcomp "
+ --all --tags --contains --abbrev= --candidates=
+ --exact-match --debug --long --match --always --first-parent
+ --exclude --dirty --broken
+ "
return
esac
__git_complete_refs
@@ -1475,7 +1411,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
--dirstat --dirstat= --dirstat-by-file
--dirstat-by-file= --cumulative
--diff-algorithm=
- --submodule --submodule= --ignore-submodules
+ --submodule --submodule=
"
_git_diff ()
@@ -1503,8 +1439,7 @@ _git_diff ()
}
__git_mergetools_common="diffuse diffmerge ecmerge emerge kdiff3 meld opendiff
- tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc
- codecompare smerge
+ tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc codecompare
"
_git_difftool ()
@@ -1517,11 +1452,11 @@ _git_difftool ()
return
;;
--*)
- __gitcomp_builtin difftool "$__git_diff_common_options
- --base --cached --ours --theirs
- --pickaxe-all --pickaxe-regex
- --relative --staged
- "
+ __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
+ --base --ours --theirs
+ --no-renames --diff-filter= --find-copies-harder
+ --relative --ignore-submodules
+ --tool="
return
;;
esac
@@ -1530,6 +1465,12 @@ _git_difftool ()
__git_fetch_recurse_submodules="yes on-demand no"
+__git_fetch_options="
+ --quiet --verbose --append --upload-pack --force --keep --depth=
+ --tags --no-tags --all --prune --dry-run --recurse-submodules=
+ --unshallow --update-shallow
+"
+
_git_fetch ()
{
case "$cur" in
@@ -1537,21 +1478,21 @@ _git_fetch ()
__gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"
return
;;
- --filter=*)
- __gitcomp "blob:none blob:limit= sparse:oid=" "" "${cur##--filter=}"
- return
- ;;
--*)
- __gitcomp_builtin fetch
+ __gitcomp "$__git_fetch_options"
return
;;
esac
__git_complete_remote_or_refspec
}
-__git_format_patch_extra_options="
- --full-index --not --all --no-prefix --src-prefix=
- --dst-prefix= --notes
+__git_format_patch_options="
+ --stdout --attach --no-attach --thread --thread= --no-thread
+ --numbered --start-number --numbered-files --keep-subject --signoff
+ --signature --no-signature --in-reply-to= --cc= --full-index --binary
+ --not --all --cover-letter --no-prefix --src-prefix= --dst-prefix=
+ --inline --suffix= --ignore-if-in-upstream --subject-prefix=
+ --output-directory --reroll-count --to= --quiet --notes
"
_git_format_patch ()
@@ -1564,7 +1505,7 @@ _git_format_patch ()
return
;;
--*)
- __gitcomp_builtin format-patch "$__git_format_patch_extra_options"
+ __gitcomp "$__git_format_patch_options"
return
;;
esac
@@ -1575,7 +1516,20 @@ _git_fsck ()
{
case "$cur" in
--*)
- __gitcomp_builtin fsck
+ __gitcomp "
+ --tags --root --unreachable --cache --no-reflogs --full
+ --strict --verbose --lost-found --name-objects
+ "
+ return
+ ;;
+ esac
+}
+
+_git_gc ()
+{
+ case "$cur" in
+ --*)
+ __gitcomp "--prune --aggressive"
return
;;
esac
@@ -1631,7 +1585,21 @@ _git_grep ()
case "$cur" in
--*)
- __gitcomp_builtin grep
+ __gitcomp "
+ --cached
+ --text --ignore-case --word-regexp --invert-match
+ --full-name --line-number
+ --extended-regexp --basic-regexp --fixed-strings
+ --perl-regexp
+ --threads
+ --files-with-matches --name-only
+ --files-without-match
+ --max-depth
+ --count
+ --and --or --not --all-match
+ --break --heading --show-function --function-context
+ --untracked --no-index
+ "
return
;;
esac
@@ -1649,16 +1617,17 @@ _git_help ()
{
case "$cur" in
--*)
- __gitcomp_builtin help
+ __gitcomp "--all --guides --info --man --web"
return
;;
esac
- if test -n "$GIT_TESTING_ALL_COMMAND_LIST"
- then
- __gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(__git --list-cmds=alias,list-guide) gitk"
- else
- __gitcomp "$(__git --list-cmds=main,nohelpers,alias,list-guide) gitk"
- fi
+ __git_compute_all_commands
+ __gitcomp "$__git_all_commands $(__git_aliases)
+ attributes cli core-tutorial cvs-migration
+ diffcore everyday gitk glossary hooks ignore modules
+ namespaces repository-layout revisions tutorial tutorial-2
+ workflows
+ "
}
_git_init ()
@@ -1671,7 +1640,7 @@ _git_init ()
return
;;
--*)
- __gitcomp_builtin init
+ __gitcomp "--quiet --bare --template= --shared --shared="
return
;;
esac
@@ -1681,7 +1650,13 @@ _git_ls_files ()
{
case "$cur" in
--*)
- __gitcomp_builtin ls-files
+ __gitcomp "--cached --deleted --modified --others --ignored
+ --stage --directory --no-empty-directory --unmerged
+ --killed --exclude= --exclude-from=
+ --exclude-per-directory= --exclude-standard
+ --error-unmatch --with-tree= --full-name
+ --abbrev --ignored --exclude-per-directory
+ "
return
;;
esac
@@ -1695,7 +1670,7 @@ _git_ls_remote ()
{
case "$cur" in
--*)
- __gitcomp_builtin ls-remote
+ __gitcomp "--heads --tags --refs --get-url --symref"
return
;;
esac
@@ -1704,13 +1679,6 @@ _git_ls_remote ()
_git_ls_tree ()
{
- case "$cur" in
- --*)
- __gitcomp_builtin ls-tree
- return
- ;;
- esac
-
__git_complete_file
}
@@ -1737,8 +1705,8 @@ __git_log_shortlog_options="
--all-match --invert-grep
"
-__git_log_pretty_formats="oneline short medium full fuller email raw format: mboxrd"
-__git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default raw unix format:"
+__git_log_pretty_formats="oneline short medium full fuller email raw format:"
+__git_log_date_formats="relative iso8601 rfc2822 short local default raw"
_git_log ()
{
@@ -1826,13 +1794,22 @@ _git_log ()
__git_complete_revlist
}
+# Common merge options shared by git-merge(1) and git-pull(1).
+__git_merge_options="
+ --no-commit --no-stat --log --no-log --squash --strategy
+ --commit --stat --no-squash --ff --no-ff --ff-only --edit --no-edit
+ --verify-signatures --no-verify-signatures --gpg-sign
+ --quiet --verbose --progress --no-progress
+"
+
_git_merge ()
{
__git_complete_strategy && return
case "$cur" in
--*)
- __gitcomp_builtin merge
+ __gitcomp "$__git_merge_options
+ --rerere-autoupdate --no-rerere-autoupdate --abort --continue"
return
esac
__git_complete_refs
@@ -1846,7 +1823,7 @@ _git_mergetool ()
return
;;
--*)
- __gitcomp "--tool= --prompt --no-prompt --gui --no-gui"
+ __gitcomp "--tool= --prompt --no-prompt"
return
;;
esac
@@ -1856,7 +1833,7 @@ _git_merge_base ()
{
case "$cur" in
--*)
- __gitcomp_builtin merge-base
+ __gitcomp "--octopus --independent --is-ancestor --fork-point"
return
;;
esac
@@ -1867,7 +1844,7 @@ _git_mv ()
{
case "$cur" in
--*)
- __gitcomp_builtin mv
+ __gitcomp "--dry-run"
return
;;
esac
@@ -1881,14 +1858,19 @@ _git_mv ()
fi
}
+_git_name_rev ()
+{
+ __gitcomp "--tags --all --stdin"
+}
+
_git_notes ()
{
- local subcommands='add append copy edit get-ref list merge prune remove show'
+ local subcommands='add append copy edit list prune remove show'
local subcommand="$(__git_find_on_cmdline "$subcommands")"
case "$subcommand,$cur" in
,--*)
- __gitcomp_builtin notes
+ __gitcomp '--ref'
;;
,*)
case "$prev" in
@@ -1900,14 +1882,21 @@ _git_notes ()
;;
esac
;;
- *,--reuse-message=*|*,--reedit-message=*)
+ add,--reuse-message=*|append,--reuse-message=*|\
+ add,--reedit-message=*|append,--reedit-message=*)
__git_complete_refs --cur="${cur#*=}"
;;
- *,--*)
- __gitcomp_builtin notes_$subcommand
+ add,--*|append,--*)
+ __gitcomp '--file= --message= --reedit-message=
+ --reuse-message='
;;
- prune,*|get-ref,*)
- # this command does not take a ref, do not complete it
+ copy,--*)
+ __gitcomp '--stdin'
+ ;;
+ prune,--*)
+ __gitcomp '--dry-run --verbose'
+ ;;
+ prune,*)
;;
*)
case "$prev" in
@@ -1931,8 +1920,12 @@ _git_pull ()
return
;;
--*)
- __gitcomp_builtin pull
-
+ __gitcomp "
+ --rebase --no-rebase
+ --autostash --no-autostash
+ $__git_merge_options
+ $__git_fetch_options
+ "
return
;;
esac
@@ -1983,36 +1976,27 @@ _git_push ()
return
;;
--*)
- __gitcomp_builtin push
+ __gitcomp "
+ --all --mirror --tags --dry-run --force --verbose
+ --quiet --prune --delete --follow-tags
+ --receive-pack= --repo= --set-upstream
+ --force-with-lease --force-with-lease= --recurse-submodules=
+ "
return
;;
esac
__git_complete_remote_or_refspec
}
-_git_range_diff ()
-{
- case "$cur" in
- --*)
- __gitcomp "
- --creation-factor= --no-dual-color
- $__git_diff_common_options
- "
- return
- ;;
- esac
- __git_complete_revlist
-}
-
_git_rebase ()
{
__git_find_repo_path
if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then
- __gitcomp "--continue --skip --abort --quit --edit-todo --show-current-patch"
+ __gitcomp "--continue --skip --abort --quit --edit-todo"
return
elif [ -d "$__git_repo_path"/rebase-apply ] || \
[ -d "$__git_repo_path"/rebase-merge ]; then
- __gitcomp "--continue --skip --abort --quit --show-current-patch"
+ __gitcomp "--continue --skip --abort --quit"
return
fi
__git_complete_strategy && return
@@ -2024,7 +2008,7 @@ _git_rebase ()
--*)
__gitcomp "
--onto --merge --strategy --interactive
- --rebase-merges --preserve-merges --stat --no-stat
+ --preserve-merges --stat --no-stat
--committer-date-is-author-date --ignore-date
--ignore-whitespace --whitespace=
--autosquash --no-autosquash
@@ -2032,7 +2016,6 @@ _git_rebase ()
--autostash --no-autostash
--verify --no-verify
--keep-empty --root --force-rebase --no-ff
- --rerere-autoupdate
--exec
"
@@ -2094,16 +2077,16 @@ _git_send_email ()
return
;;
--*)
- __gitcomp_builtin send-email "--annotate --bcc --cc --cc-cmd --chain-reply-to
+ __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
--compose --confirm= --dry-run --envelope-sender
--from --identity
--in-reply-to --no-chain-reply-to --no-signed-off-by-cc
- --no-suppress-from --no-thread --quiet --reply-to
+ --no-suppress-from --no-thread --quiet
--signed-off-by-cc --smtp-pass --smtp-server
--smtp-server-port --smtp-encryption= --smtp-user
--subject --suppress-cc= --suppress-from --thread --to
--validate --no-validate
- $__git_format_patch_extra_options"
+ $__git_format_patch_options"
return
;;
esac
@@ -2136,7 +2119,11 @@ _git_status ()
return
;;
--*)
- __gitcomp_builtin status
+ __gitcomp "
+ --short --branch --porcelain --long --verbose
+ --untracked-files= --ignore-submodules= --ignored
+ --column= --no-column
+ "
return
;;
esac
@@ -2161,44 +2148,6 @@ _git_status ()
__git_complete_index_file "$complete_opt"
}
-_git_switch ()
-{
- case "$cur" in
- --conflict=*)
- __gitcomp "diff3 merge" "" "${cur##--conflict=}"
- ;;
- --*)
- __gitcomp_builtin switch
- ;;
- *)
- # check if --track, --no-track, or --no-guess was specified
- # if so, disable DWIM mode
- local track_opt="--track" only_local_ref=n
- if [ "$GIT_COMPLETION_CHECKOUT_NO_GUESS" = "1" ] ||
- [ -n "$(__git_find_on_cmdline "--track --no-track --no-guess")" ]; then
- track_opt=''
- fi
- # explicit --guess enables DWIM mode regardless of
- # $GIT_COMPLETION_CHECKOUT_NO_GUESS
- if [ -n "$(__git_find_on_cmdline "--guess")" ]; then
- track_opt='--track'
- fi
- if [ -z "$(__git_find_on_cmdline "-d --detach")" ]; then
- only_local_ref=y
- else
- # --guess --detach is invalid combination, no
- # dwim will be done when --detach is specified
- track_opt=
- fi
- if [ $only_local_ref = y -a -z "$track_opt" ]; then
- __gitcomp_direct "$(__git_heads "" "$cur" " ")"
- else
- __git_complete_refs $track_opt
- fi
- ;;
- esac
-}
-
__git_config_get_set_variables ()
{
local prevword word config_file= c=$cword
@@ -2221,24 +2170,9 @@ __git_config_get_set_variables ()
__git config $config_file --name-only --list
}
-__git_config_vars=
-__git_compute_config_vars ()
-{
- test -n "$__git_config_vars" ||
- __git_config_vars="$(git help --config-for-completion | sort | uniq)"
-}
-
_git_config ()
{
- local varname
-
- if [ "${BASH_VERSINFO[0]:-0}" -ge 4 ]; then
- varname="${prev,,}"
- else
- varname="$(echo "$prev" |tr A-Z a-z)"
- fi
-
- case "$varname" in
+ case "$prev" in
branch.*.remote|branch.*.pushremote)
__gitcomp_nl "$(__git_remotes)"
return
@@ -2248,7 +2182,7 @@ _git_config ()
return
;;
branch.*.rebase)
- __gitcomp "false true merges preserve interactive"
+ __gitcomp "false true preserve interactive"
return
;;
remote.pushdefault)
@@ -2294,7 +2228,7 @@ _git_config ()
return
;;
diff.submodule)
- __gitcomp "$__git_diff_submodule_formats"
+ __gitcomp "log short"
return
;;
help.format)
@@ -2305,7 +2239,7 @@ _git_config ()
__gitcomp "$__git_log_date_formats"
return
;;
- sendemail.aliasfiletype)
+ sendemail.aliasesfiletype)
__gitcomp "mutt mailrc pine elm gnus"
return
;;
@@ -2331,25 +2265,32 @@ _git_config ()
esac
case "$cur" in
--*)
- __gitcomp_builtin config
+ __gitcomp "
+ --system --global --local --file=
+ --list --replace-all
+ --get --get-all --get-regexp
+ --add --unset --unset-all
+ --remove-section --rename-section
+ --name-only
+ "
return
;;
branch.*.*)
local pfx="${cur%.*}." cur_="${cur##*.}"
- __gitcomp "remote pushRemote merge mergeOptions rebase" "$pfx" "$cur_"
+ __gitcomp "remote pushremote merge mergeoptions rebase" "$pfx" "$cur_"
return
;;
branch.*)
local pfx="${cur%.*}." cur_="${cur#*.}"
__gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")"
- __gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_"
+ __gitcomp_nl_append $'autosetupmerge\nautosetuprebase\n' "$pfx" "$cur_"
return
;;
guitool.*.*)
local pfx="${cur%.*}." cur_="${cur##*.}"
__gitcomp "
- argPrompt cmd confirm needsFile noConsole noRescan
- prompt revPrompt revUnmerged title
+ argprompt cmd confirm needsfile noconsole norescan
+ prompt revprompt revunmerged title
" "$pfx" "$cur_"
return
;;
@@ -2378,14 +2319,14 @@ _git_config ()
local pfx="${cur%.*}." cur_="${cur##*.}"
__gitcomp "
url proxy fetch push mirror skipDefaultUpdate
- receivepack uploadpack tagOpt pushurl
+ receivepack uploadpack tagopt pushurl
" "$pfx" "$cur_"
return
;;
remote.*)
local pfx="${cur%.*}." cur_="${cur#*.}"
__gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "."
- __gitcomp_nl_append "pushDefault" "$pfx" "$cur_"
+ __gitcomp_nl_append "pushdefault" "$pfx" "$cur_"
return
;;
url.*.*)
@@ -2393,14 +2334,332 @@ _git_config ()
__gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_"
return
;;
- *.*)
- __git_compute_config_vars
- __gitcomp "$__git_config_vars"
- ;;
- *)
- __git_compute_config_vars
- __gitcomp "$(echo "$__git_config_vars" | sed 's/\.[^ ]*/./g')"
esac
+ __gitcomp "
+ add.ignoreErrors
+ advice.amWorkDir
+ advice.commitBeforeMerge
+ advice.detachedHead
+ advice.implicitIdentity
+ advice.pushAlreadyExists
+ advice.pushFetchFirst
+ advice.pushNeedsForce
+ advice.pushNonFFCurrent
+ advice.pushNonFFMatching
+ advice.pushUpdateRejected
+ advice.resolveConflict
+ advice.rmHints
+ advice.statusHints
+ advice.statusUoption
+ advice.ignoredHook
+ alias.
+ am.keepcr
+ am.threeWay
+ apply.ignorewhitespace
+ apply.whitespace
+ branch.autosetupmerge
+ branch.autosetuprebase
+ browser.
+ clean.requireForce
+ color.branch
+ color.branch.current
+ color.branch.local
+ color.branch.plain
+ color.branch.remote
+ color.decorate.HEAD
+ color.decorate.branch
+ color.decorate.remoteBranch
+ color.decorate.stash
+ color.decorate.tag
+ color.diff
+ color.diff.commit
+ color.diff.frag
+ color.diff.func
+ color.diff.meta
+ color.diff.new
+ color.diff.old
+ color.diff.plain
+ color.diff.whitespace
+ color.grep
+ color.grep.context
+ color.grep.filename
+ color.grep.function
+ color.grep.linenumber
+ color.grep.match
+ color.grep.selected
+ color.grep.separator
+ color.interactive
+ color.interactive.error
+ color.interactive.header
+ color.interactive.help
+ color.interactive.prompt
+ color.pager
+ color.showbranch
+ color.status
+ color.status.added
+ color.status.changed
+ color.status.header
+ color.status.localBranch
+ color.status.nobranch
+ color.status.remoteBranch
+ color.status.unmerged
+ color.status.untracked
+ color.status.updated
+ color.ui
+ commit.cleanup
+ commit.gpgSign
+ commit.status
+ commit.template
+ commit.verbose
+ core.abbrev
+ core.askpass
+ core.attributesfile
+ core.autocrlf
+ core.bare
+ core.bigFileThreshold
+ core.checkStat
+ core.commentChar
+ core.compression
+ core.createObject
+ core.deltaBaseCacheLimit
+ core.editor
+ core.eol
+ core.excludesfile
+ core.fileMode
+ core.fsyncobjectfiles
+ core.gitProxy
+ core.hideDotFiles
+ core.hooksPath
+ core.ignoreStat
+ core.ignorecase
+ core.logAllRefUpdates
+ core.loosecompression
+ core.notesRef
+ core.packedGitLimit
+ core.packedGitWindowSize
+ core.packedRefsTimeout
+ core.pager
+ core.precomposeUnicode
+ core.preferSymlinkRefs
+ core.preloadindex
+ core.protectHFS
+ core.protectNTFS
+ core.quotepath
+ core.repositoryFormatVersion
+ core.safecrlf
+ core.sharedRepository
+ core.sparseCheckout
+ core.splitIndex
+ core.sshCommand
+ core.symlinks
+ core.trustctime
+ core.untrackedCache
+ core.warnAmbiguousRefs
+ core.whitespace
+ core.worktree
+ credential.helper
+ credential.useHttpPath
+ credential.username
+ credentialCache.ignoreSIGHUP
+ diff.autorefreshindex
+ diff.external
+ diff.ignoreSubmodules
+ diff.mnemonicprefix
+ diff.noprefix
+ diff.renameLimit
+ diff.renames
+ diff.statGraphWidth
+ diff.submodule
+ diff.suppressBlankEmpty
+ diff.tool
+ diff.wordRegex
+ diff.algorithm
+ difftool.
+ difftool.prompt
+ fetch.recurseSubmodules
+ fetch.unpackLimit
+ format.attach
+ format.cc
+ format.coverLetter
+ format.from
+ format.headers
+ format.numbered
+ format.pretty
+ format.signature
+ format.signoff
+ format.subjectprefix
+ format.suffix
+ format.thread
+ format.to
+ gc.
+ gc.aggressiveDepth
+ gc.aggressiveWindow
+ gc.auto
+ gc.autoDetach
+ gc.autopacklimit
+ gc.logExpiry
+ gc.packrefs
+ gc.pruneexpire
+ gc.reflogexpire
+ gc.reflogexpireunreachable
+ gc.rerereresolved
+ gc.rerereunresolved
+ gc.worktreePruneExpire
+ gitcvs.allbinary
+ gitcvs.commitmsgannotation
+ gitcvs.dbTableNamePrefix
+ gitcvs.dbdriver
+ gitcvs.dbname
+ gitcvs.dbpass
+ gitcvs.dbuser
+ gitcvs.enabled
+ gitcvs.logfile
+ gitcvs.usecrlfattr
+ guitool.
+ gui.blamehistoryctx
+ gui.commitmsgwidth
+ gui.copyblamethreshold
+ gui.diffcontext
+ gui.encoding
+ gui.fastcopyblame
+ gui.matchtrackingbranch
+ gui.newbranchtemplate
+ gui.pruneduringfetch
+ gui.spellingdictionary
+ gui.trustmtime
+ help.autocorrect
+ help.browser
+ help.format
+ http.lowSpeedLimit
+ http.lowSpeedTime
+ http.maxRequests
+ http.minSessions
+ http.noEPSV
+ http.postBuffer
+ http.proxy
+ http.sslCipherList
+ http.sslVersion
+ http.sslCAInfo
+ http.sslCAPath
+ http.sslCert
+ http.sslCertPasswordProtected
+ http.sslKey
+ http.sslVerify
+ http.useragent
+ i18n.commitEncoding
+ i18n.logOutputEncoding
+ imap.authMethod
+ imap.folder
+ imap.host
+ imap.pass
+ imap.port
+ imap.preformattedHTML
+ imap.sslverify
+ imap.tunnel
+ imap.user
+ init.templatedir
+ instaweb.browser
+ instaweb.httpd
+ instaweb.local
+ instaweb.modulepath
+ instaweb.port
+ interactive.singlekey
+ log.date
+ log.decorate
+ log.showroot
+ mailmap.file
+ man.
+ man.viewer
+ merge.
+ merge.conflictstyle
+ merge.log
+ merge.renameLimit
+ merge.renormalize
+ merge.stat
+ merge.tool
+ merge.verbosity
+ mergetool.
+ mergetool.keepBackup
+ mergetool.keepTemporaries
+ mergetool.prompt
+ notes.displayRef
+ notes.rewrite.
+ notes.rewrite.amend
+ notes.rewrite.rebase
+ notes.rewriteMode
+ notes.rewriteRef
+ pack.compression
+ pack.deltaCacheLimit
+ pack.deltaCacheSize
+ pack.depth
+ pack.indexVersion
+ pack.packSizeLimit
+ pack.threads
+ pack.window
+ pack.windowMemory
+ pager.
+ pretty.
+ pull.octopus
+ pull.twohead
+ push.default
+ push.followTags
+ rebase.autosquash
+ rebase.stat
+ receive.autogc
+ receive.denyCurrentBranch
+ receive.denyDeleteCurrent
+ receive.denyDeletes
+ receive.denyNonFastForwards
+ receive.fsckObjects
+ receive.unpackLimit
+ receive.updateserverinfo
+ remote.pushdefault
+ remotes.
+ repack.usedeltabaseoffset
+ rerere.autoupdate
+ rerere.enabled
+ sendemail.
+ sendemail.aliasesfile
+ sendemail.aliasfiletype
+ sendemail.bcc
+ sendemail.cc
+ sendemail.cccmd
+ sendemail.chainreplyto
+ sendemail.confirm
+ sendemail.envelopesender
+ sendemail.from
+ sendemail.identity
+ sendemail.multiedit
+ sendemail.signedoffbycc
+ sendemail.smtpdomain
+ sendemail.smtpencryption
+ sendemail.smtppass
+ sendemail.smtpserver
+ sendemail.smtpserveroption
+ sendemail.smtpserverport
+ sendemail.smtpuser
+ sendemail.suppresscc
+ sendemail.suppressfrom
+ sendemail.thread
+ sendemail.to
+ sendemail.tocmd
+ sendemail.validate
+ sendemail.smtpbatchsize
+ sendemail.smtprelogindelay
+ showbranch.default
+ status.relativePaths
+ status.showUntrackedFiles
+ status.submodulesummary
+ submodule.
+ tar.umask
+ transfer.unpackLimit
+ url.
+ user.email
+ user.name
+ user.signingkey
+ web.browser
+ branch. remote.
+ "
}
_git_remote ()
@@ -2413,7 +2672,7 @@ _git_remote ()
if [ -z "$subcommand" ]; then
case "$cur" in
--*)
- __gitcomp_builtin remote
+ __gitcomp "--verbose"
;;
*)
__gitcomp "$subcommands"
@@ -2424,33 +2683,33 @@ _git_remote ()
case "$subcommand,$cur" in
add,--*)
- __gitcomp_builtin remote_add
+ __gitcomp "--track --master --fetch --tags --no-tags --mirror="
;;
add,*)
;;
set-head,--*)
- __gitcomp_builtin remote_set-head
+ __gitcomp "--auto --delete"
;;
set-branches,--*)
- __gitcomp_builtin remote_set-branches
+ __gitcomp "--add"
;;
set-head,*|set-branches,*)
__git_complete_remote_or_refspec
;;
update,--*)
- __gitcomp_builtin remote_update
+ __gitcomp "--prune"
;;
update,*)
- __gitcomp "$(__git_remotes) $(__git_get_config_variables "remotes")"
+ __gitcomp "$(__git_get_config_variables "remotes")"
;;
set-url,--*)
- __gitcomp_builtin remote_set-url
+ __gitcomp "--push --add --delete"
;;
get-url,--*)
- __gitcomp_builtin remote_get-url
+ __gitcomp "--push --all"
;;
prune,--*)
- __gitcomp_builtin remote_prune
+ __gitcomp "--dry-run"
;;
*)
__gitcomp_nl "$(__git_remotes)"
@@ -2461,12 +2720,8 @@ _git_remote ()
_git_replace ()
{
case "$cur" in
- --format=*)
- __gitcomp "short medium long" "" "${cur##--format=}"
- return
- ;;
--*)
- __gitcomp_builtin replace
+ __gitcomp "--edit --graft --format= --list --delete"
return
;;
esac
@@ -2490,42 +2745,26 @@ _git_reset ()
case "$cur" in
--*)
- __gitcomp_builtin reset
+ __gitcomp "--merge --mixed --hard --soft --patch --keep"
return
;;
esac
__git_complete_refs
}
-_git_restore ()
-{
- case "$cur" in
- --conflict=*)
- __gitcomp "diff3 merge" "" "${cur##--conflict=}"
- ;;
- --source=*)
- __git_complete_refs --cur="${cur##--source=}"
- ;;
- --*)
- __gitcomp_builtin restore
- ;;
- esac
-}
-
-__git_revert_inprogress_options="--continue --quit --abort"
-
_git_revert ()
{
__git_find_repo_path
if [ -f "$__git_repo_path"/REVERT_HEAD ]; then
- __gitcomp "$__git_revert_inprogress_options"
+ __gitcomp "--continue --quit --abort"
return
fi
- __git_complete_strategy && return
case "$cur" in
--*)
- __gitcomp_builtin revert "" \
- "$__git_revert_inprogress_options"
+ __gitcomp "
+ --edit --mainline --no-edit --no-commit --signoff
+ --strategy= --strategy-option=
+ "
return
;;
esac
@@ -2536,7 +2775,7 @@ _git_rm ()
{
case "$cur" in
--*)
- __gitcomp_builtin rm
+ __gitcomp "--cached --dry-run --ignore-unmatch --quiet"
return
;;
esac
@@ -2594,7 +2833,12 @@ _git_show_branch ()
{
case "$cur" in
--*)
- __gitcomp_builtin show-branch
+ __gitcomp "
+ --all --remotes --topo-order --date-order --current --more=
+ --list --independent --merge-base --no-name
+ --color --no-color
+ --sha1-name --sparse --topics --reflog
+ "
return
;;
esac
@@ -2604,21 +2848,13 @@ _git_show_branch ()
_git_stash ()
{
local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
- local subcommands='push list show apply clear drop pop create branch'
- local subcommand="$(__git_find_on_cmdline "$subcommands save")"
- if [ -n "$(__git_find_on_cmdline "-p")" ]; then
- subcommand="push"
- fi
+ local subcommands='push save list show apply clear drop pop create branch'
+ local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
case "$cur" in
--*)
__gitcomp "$save_opts"
;;
- sa*)
- if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
- __gitcomp "save"
- fi
- ;;
*)
if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
__gitcomp "$subcommands"
@@ -2639,9 +2875,6 @@ _git_stash ()
drop,--*)
__gitcomp "--quiet"
;;
- list,--*)
- __gitcomp "--name-status --oneline --patch-with-stat"
- ;;
show,--*|branch,--*)
;;
branch,*)
@@ -2666,7 +2899,7 @@ _git_submodule ()
{
__git_has_doubledash && return
- local subcommands="add status init deinit update set-branch summary foreach sync absorbgitdirs"
+ local subcommands="add status init deinit update summary foreach sync"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
case "$cur" in
@@ -2697,9 +2930,6 @@ _git_submodule ()
--force --rebase --merge --reference --depth --recursive --jobs
"
;;
- set-branch,--*)
- __gitcomp "--default --branch"
- ;;
summary,--*)
__gitcomp "--cached --files --summary-limit"
;;
@@ -2815,7 +3045,7 @@ _git_tag ()
while [ $c -lt $cword ]; do
i="${words[c]}"
case "$i" in
- -d|--delete|-v|--verify)
+ -d|-v)
__gitcomp_direct "$(__git_tags "" "$cur" " ")"
return
;;
@@ -2841,7 +3071,11 @@ _git_tag ()
case "$cur" in
--*)
- __gitcomp_builtin tag
+ __gitcomp "
+ --list --delete --verify --annotate --message --file
+ --sign --cleanup --local-user --force --column --sort=
+ --contains --no-contains --points-at --merged --no-merged --create-reflog
+ "
;;
esac
}
@@ -2853,26 +3087,23 @@ _git_whatchanged ()
_git_worktree ()
{
- local subcommands="add list lock move prune remove unlock"
+ local subcommands="add list lock prune unlock"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
else
case "$subcommand,$cur" in
add,--*)
- __gitcomp_builtin worktree_add
+ __gitcomp "--detach"
;;
list,--*)
- __gitcomp_builtin worktree_list
+ __gitcomp "--porcelain"
;;
lock,--*)
- __gitcomp_builtin worktree_lock
+ __gitcomp "--reason"
;;
prune,--*)
- __gitcomp_builtin worktree_prune
- ;;
- remove,--*)
- __gitcomp "--force"
+ __gitcomp "--dry-run --expire --verbose"
;;
*)
;;
@@ -2880,52 +3111,6 @@ _git_worktree ()
fi
}
-__git_complete_common () {
- local command="$1"
-
- case "$cur" in
- --*)
- __gitcomp_builtin "$command"
- ;;
- esac
-}
-
-__git_cmds_with_parseopt_helper=
-__git_support_parseopt_helper () {
- test -n "$__git_cmds_with_parseopt_helper" ||
- __git_cmds_with_parseopt_helper="$(__git --list-cmds=parseopt)"
-
- case " $__git_cmds_with_parseopt_helper " in
- *" $1 "*)
- return 0
- ;;
- *)
- return 1
- ;;
- esac
-}
-
-__git_complete_command () {
- local command="$1"
- local completion_func="_git_${command//-/_}"
- if ! declare -f $completion_func >/dev/null 2>/dev/null &&
- declare -f _completion_loader >/dev/null 2>/dev/null
- then
- _completion_loader "git-$command"
- fi
- if declare -f $completion_func >/dev/null 2>/dev/null
- then
- $completion_func
- return 0
- elif __git_support_parseopt_helper "$command"
- then
- __git_complete_common "$command"
- return 0
- else
- return 1
- fi
-}
-
__git_main ()
{
local i c=1 command __git_dir __git_repo_path
@@ -2979,24 +3164,20 @@ __git_main ()
--help
"
;;
- *)
- if test -n "$GIT_TESTING_PORCELAIN_COMMAND_LIST"
- then
- __gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST"
- else
- __gitcomp "$(__git --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config)"
- fi
- ;;
+ *) __git_compute_porcelain_commands
+ __gitcomp "$__git_porcelain_commands $(__git_aliases)" ;;
esac
return
fi
- __git_complete_command "$command" && return
+ local completion_func="_git_${command//-/_}"
+ declare -f $completion_func >/dev/null 2>/dev/null && $completion_func && return
local expansion=$(__git_aliased_command "$command")
if [ -n "$expansion" ]; then
words[1]=$expansion
- __git_complete_command "$expansion"
+ completion_func="_git_${expansion//-/_}"
+ declare -f $completion_func >/dev/null 2>/dev/null && $completion_func
fi
}
@@ -3024,10 +3205,7 @@ __gitk_main ()
__git_complete_revlist
}
-if [[ -n ${ZSH_VERSION-} ]] &&
- # Don't define these functions when sourced from 'git-completion.zsh',
- # it has its own implementations.
- [[ -z ${GIT_SOURCING_ZSH_COMPLETION-} ]]; then
+if [[ -n ${ZSH_VERSION-} ]]; then
echo "WARNING: this script is deprecated, please see git-completion.zsh" 1>&2
autoload -U +X compinit && compinit
@@ -3076,22 +3254,13 @@ if [[ -n ${ZSH_VERSION-} ]] &&
compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
}
- __gitcomp_file_direct ()
- {
- emulate -L zsh
-
- local IFS=$'\n'
- compset -P '*[=:]'
- compadd -f -- ${=1} && _ret=0
- }
-
__gitcomp_file ()
{
emulate -L zsh
local IFS=$'\n'
compset -P '*[=:]'
- compadd -p "${2-}" -f -- ${=1} && _ret=0
+ compadd -Q -p "${2-}" -f -- ${=1} && _ret=0
}
_git ()
@@ -3146,6 +3315,6 @@ __git_complete gitk __gitk_main
# when the user has tab-completed the executable name and consequently
# included the '.exe' suffix.
#
-if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
+if [[ "$OSTYPE" = cygwin* ]]; then
__git_complete git.exe __git_main
fi
diff --git a/zsh/plugins/gitfast/git-prompt.sh b/zsh/plugins/gitfast/git-prompt.sh
index f7009b0..fd2b049 100644
--- a/zsh/plugins/gitfast/git-prompt.sh
+++ b/zsh/plugins/gitfast/git-prompt.sh
@@ -219,7 +219,7 @@ __git_ps1_show_upstream ()
if [[ -n "$count" && -n "$name" ]]; then
__git_ps1_upstream_name=$(git rev-parse \
--abbrev-ref "$upstream" 2>/dev/null)
- if [ "$pcmode" = yes ] && [ "$ps1_expanded" = yes ]; then
+ if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
p="$p \${__git_ps1_upstream_name}"
else
p="$p ${__git_ps1_upstream_name}"
@@ -237,7 +237,7 @@ __git_ps1_show_upstream ()
# to build a gitstring.
__git_ps1_colorize_gitstring ()
{
- if [[ -n "${ZSH_VERSION-}" ]]; then
+ if [[ -n ${ZSH_VERSION-} ]]; then
local c_red='%F{red}'
local c_green='%F{green}'
local c_lblue='%F{blue}'
@@ -255,7 +255,7 @@ __git_ps1_colorize_gitstring ()
local flags_color="$c_lblue"
local branch_color=""
- if [ "$detached" = no ]; then
+ if [ $detached = no ]; then
branch_color="$ok_color"
else
branch_color="$bad_color"
@@ -508,13 +508,13 @@ __git_ps1 ()
# NO color option unless in PROMPT_COMMAND mode or it's Zsh
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
- if [ "$pcmode" = yes ] || [ -n "${ZSH_VERSION-}" ]; then
+ if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then
__git_ps1_colorize_gitstring
fi
fi
b=${b##refs/heads/}
- if [ "$pcmode" = yes ] && [ "$ps1_expanded" = yes ]; then
+ if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
__git_ps1_branch_name=$b
b="\${__git_ps1_branch_name}"
fi
@@ -522,7 +522,7 @@ __git_ps1 ()
local f="$w$i$s$u"
local gitstring="$c$b${f:+$z$f}$r$p"
- if [ "$pcmode" = yes ]; then
+ if [ $pcmode = yes ]; then
if [ "${__git_printf_supports_v-}" != yes ]; then
gitstring=$(printf -- "$printf_format" "$gitstring")
else
diff --git a/zsh/plugins/github/README.md b/zsh/plugins/github/README.md
index 2b66e39..70b863f 100644
--- a/zsh/plugins/github/README.md
+++ b/zsh/plugins/github/README.md
@@ -1,4 +1,4 @@
-# github
+# github plugin
This plugin supports working with GitHub from the command line. It provides a few things:
@@ -6,7 +6,7 @@ This plugin supports working with GitHub from the command line. It provides a fe
* Completion for the `github` Ruby gem.
* Convenience functions for working with repos and URLs.
-### Functions
+### Functions
* `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub
* `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub
@@ -14,13 +14,13 @@ This plugin supports working with GitHub from the command line. It provides a fe
* `git.io` - Shortens a URL using [git.io](https://git.io)
-## Installation
+## Installation
[Hub](https://github.com/github/hub) needs to be installed if you want to use it. On OS X with Homebrew, this can be done with `brew install hub`. The `hub` completion definition needs to be added to your `$FPATH` before initializing OMZ.
The [`github` Ruby gem](https://github.com/defunkt/github-gem) needs to be installed if you want to use it.
-### Configuration
+### Configuration
These settings affect `github`'s behavior.
@@ -35,7 +35,7 @@ These settings affect `github`'s behavior.
See `man hub` for more details.
-### Homebrew installation note
+### Homebrew installation note
If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which will be on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`.
diff --git a/zsh/plugins/gitignore/gitignore.plugin.zsh b/zsh/plugins/gitignore/gitignore.plugin.zsh
index 15e38d3..a687f5c 100644
--- a/zsh/plugins/gitignore/gitignore.plugin.zsh
+++ b/zsh/plugins/gitignore/gitignore.plugin.zsh
@@ -1,4 +1,4 @@
-function gi() { curl -fL https://www.gitignore.io/api/${(j:,:)@} }
+function gi() { curl -fLw '\n' https://www.gitignore.io/api/"${(j:,:)@}" }
_gitignoreio_get_command_list() {
curl -sfL https://www.gitignore.io/api/list | tr "," "\n"
diff --git a/zsh/plugins/glassfish/README.md b/zsh/plugins/glassfish/README.md
new file mode 100644
index 0000000..1f4a8be
--- /dev/null
+++ b/zsh/plugins/glassfish/README.md
@@ -0,0 +1,9 @@
+# glassfish
+
+The glassfish plugin adds completion for the `asadmin` utility, a command to manage
+[Oracle GlassFish](https://docs.oracle.com/cd/E18930_01/html/821-2416/giobi.html) servers.
+
+To use it, add `glassfish` to the plugins array in your zshrc file:
+```zsh
+plugins=(... glassfish)
+```
diff --git a/zsh/plugins/glassfish/glassfish.plugin.zsh b/zsh/plugins/glassfish/glassfish.plugin.zsh
index fde2edb..e69de29 100644
--- a/zsh/plugins/glassfish/glassfish.plugin.zsh
+++ b/zsh/plugins/glassfish/glassfish.plugin.zsh
@@ -1,3 +0,0 @@
-# if there is a user named 'glassfish' on the system, we'll assume
-# that is the user asadmin should be run as
-# grep -e '^glassfish' /etc/passwd > /dev/null && alias asadmin='sudo -u glassfish asadmin'
\ No newline at end of file
diff --git a/zsh/plugins/globalias/README.md b/zsh/plugins/globalias/README.md
index 0b06410..cd7fc3c 100644
--- a/zsh/plugins/globalias/README.md
+++ b/zsh/plugins/globalias/README.md
@@ -17,6 +17,9 @@ Then just press `SPACE` to trigger the expansion of a command you've written.
If you only want to insert a space without expanding the command line, press
`CTRL`+`SPACE`.
+if you would like to filter out any values from expanding set `GLOBALIAS_FILTER_VALUES` to
+an array of said values. See [Filtered values](#filtered-values).
+
## Examples
#### Glob expressions
@@ -37,7 +40,6 @@ $ ls folder/file.json anotherfolder/another.json
$ mkdir "`date -R`"
# expands to
$ mkdir Tue,\ 04\ Oct\ 2016\ 13:54:03\ +0300
-
```
#### Aliases
@@ -60,3 +62,18 @@ $ S
# expands to:
$ sudo systemctl
```
+
+#### Filtered values
+
+```
+# .zshrc
+alias l='ls -lh'
+alias la='ls --color=auto -lah'
+GLOBALIAS_FILTER_VALUES=(l)
+
+$ l
+# does not expand
+$ la
+# expands to:
+$ ls --color=auto -lah
+```
diff --git a/zsh/plugins/globalias/globalias.plugin.zsh b/zsh/plugins/globalias/globalias.plugin.zsh
index 9602a96..bd27d58 100644
--- a/zsh/plugins/globalias/globalias.plugin.zsh
+++ b/zsh/plugins/globalias/globalias.plugin.zsh
@@ -1,6 +1,12 @@
globalias() {
- zle _expand_alias
- zle expand-word
+ # Get last word to the left of the cursor:
+ # (z) splits into words using shell parsing
+ # (A) makes it an array even if there's only one element
+ local word=${${(Az)LBUFFER}[-1]}
+ if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then
+ zle _expand_alias
+ zle expand-word
+ fi
zle self-insert
}
zle -N globalias
diff --git a/zsh/plugins/gnu-utils/README.md b/zsh/plugins/gnu-utils/README.md
new file mode 100644
index 0000000..f5fa81e
--- /dev/null
+++ b/zsh/plugins/gnu-utils/README.md
@@ -0,0 +1,38 @@
+# gnu-utils plugin
+
+This plugin binds GNU coreutils to their default names, so that you don't have
+to call them using their prefixed name, which starts with `g`. This is useful
+in systems which don't have GNU coreutils installed by default, mainly macOS
+or FreeBSD, which use BSD coreutils.
+
+To use it, add `gnu-utils` to the plugins array in your zshrc file:
+```zsh
+plugins=(... gnu-utils)
+```
+
+The plugin works by changing the path that the command hash points to, so
+instead of `ls` pointing to `/bin/ls`, it points to wherever `gls` is
+installed.
+
+Since `hash -rf` or `rehash` refreshes the command hashes, it also wraps
+`hash` and `rehash` so that the coreutils binding is always done again
+after calling these two commands.
+
+Look at the source code of the plugin to see which GNU coreutils are tried
+to rebind. Open an issue if there are some missing.
+
+## Other methods
+
+The plugin also documents two other ways to do this:
+
+1. Using a function wrapper, such that, for example, there exists a function
+named `ls` which calls `gls` instead. Since functions have a higher preference
+than commands, this ends up calling the GNU coreutil. It has also a higher
+preference over shell builtins (`gecho` is called instead of the builtin `echo`).
+
+2. Using an alias. This has an even higher preference than functions, but they
+could be overridden because of a user setting.
+
+## Author
+
+- [Sorin Ionescu](https://github.com/sorin-ionescu).
diff --git a/zsh/plugins/gnu-utils/gnu-utils.plugin.zsh b/zsh/plugins/gnu-utils/gnu-utils.plugin.zsh
index b66e25d..23e00c2 100644
--- a/zsh/plugins/gnu-utils/gnu-utils.plugin.zsh
+++ b/zsh/plugins/gnu-utils/gnu-utils.plugin.zsh
@@ -5,79 +5,79 @@
# VERSION: 1.0.0
# ------------------------------------------------------------------------------
-
-if [[ -x "${commands[gwhoami]}" ]]; then
- __gnu_utils() {
- emulate -L zsh
- local gcmds
- local gcmd
- local cmd
- local prefix
-
- # coreutils
- gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
- 'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
- 'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
- 'gexpr' 'gfactor' 'gfalse' 'gfmt' 'gfold' 'ggroups' 'ghead' 'ghostid'
- 'gid' 'ginstall' 'gjoin' 'gkill' 'glink' 'gln' 'glogname' 'gls' 'gmd5sum'
- 'gmkdir' 'gmkfifo' 'gmknod' 'gmktemp' 'gmv' 'gnice' 'gnl' 'gnohup' 'gnproc'
- 'god' 'gpaste' 'gpathchk' 'gpinky' 'gpr' 'gprintenv' 'gprintf' 'gptx' 'gpwd'
- 'greadlink' 'grm' 'grmdir' 'gruncon' 'gseq' 'gsha1sum' 'gsha224sum'
- 'gsha256sum' 'gsha384sum' 'gsha512sum' 'gshred' 'gshuf' 'gsleep' 'gsort'
- 'gsplit' 'gstat' 'gstty' 'gsum' 'gsync' 'gtac' 'gtail' 'gtee' 'gtest'
- 'gtimeout' 'gtouch' 'gtr' 'gtrue' 'gtruncate' 'gtsort' 'gtty' 'guname'
- 'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho'
- 'gwhoami' 'gyes')
-
- # findutils
- gcmds+=('gfind' 'gxargs' 'glocate')
-
- # Not part of either coreutils or findutils, installed separately.
- gcmds+=('gsed' 'gtar' 'gtime')
-
- for gcmd in "${gcmds[@]}"; do
- #
- # This method allows for builtin commands to be primary but it's
- # lost if hash -r or rehash -f is executed. Thus, those two
- # functions have to be wrapped.
- #
- (( ${+commands[$gcmd]} )) && hash ${gcmd[2,-1]}=${commands[$gcmd]}
-
- #
- # This method generates wrapper functions.
- # It will override shell builtins.
- #
- # (( ${+commands[$gcmd]} )) && \
- # eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }"
-
- #
- # This method is inflexible since the aliases are at risk of being
- # overridden resulting in the BSD coreutils being called.
- #
- # (( ${+commands[$gcmd]} )) && \
- # alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}"
- done
-
- return 0
- }
- __gnu_utils;
-
- function hash() {
- if [[ "$*" =~ "-(r|f)" ]]; then
- builtin hash "$@"
- __gnu_utils
- else
- builtin hash "$@"
- fi
- }
-
- function rehash() {
- if [[ "$*" =~ "-f" ]]; then
- builtin rehash "$@"
- __gnu_utils
- else
- builtin rehash "$@"
- fi
- }
+# Detect if GNU coreutils are installed by looking for gwhoami
+if [[ ! -x "${commands[gwhoami]}" ]]; then
+ return
fi
+__gnu_utils() {
+ emulate -L zsh
+ local gcmds
+ local gcmd
+ local cmd
+ local prefix
+
+ # coreutils
+ gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
+ 'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
+ 'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
+ 'gexpr' 'gfactor' 'gfalse' 'gfmt' 'gfold' 'ggroups' 'ghead' 'ghostid'
+ 'gid' 'ginstall' 'gjoin' 'gkill' 'glink' 'gln' 'glogname' 'gls' 'gmd5sum'
+ 'gmkdir' 'gmkfifo' 'gmknod' 'gmktemp' 'gmv' 'gnice' 'gnl' 'gnohup' 'gnproc'
+ 'god' 'gpaste' 'gpathchk' 'gpinky' 'gpr' 'gprintenv' 'gprintf' 'gptx' 'gpwd'
+ 'greadlink' 'grm' 'grmdir' 'gruncon' 'gseq' 'gsha1sum' 'gsha224sum'
+ 'gsha256sum' 'gsha384sum' 'gsha512sum' 'gshred' 'gshuf' 'gsleep' 'gsort'
+ 'gsplit' 'gstat' 'gstty' 'gsum' 'gsync' 'gtac' 'gtail' 'gtee' 'gtest'
+ 'gtimeout' 'gtouch' 'gtr' 'gtrue' 'gtruncate' 'gtsort' 'gtty' 'guname'
+ 'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho'
+ 'gwhoami' 'gyes')
+
+ # findutils
+ gcmds+=('gfind' 'gxargs' 'glocate')
+
+ # Not part of either coreutils or findutils, installed separately.
+ gcmds+=('gsed' 'gtar' 'gtime' 'gmake')
+
+ for gcmd in "${gcmds[@]}"; do
+ # Do nothing if the command isn't found
+ (( ${+commands[$gcmd]} )) || continue
+
+ # This method allows for builtin commands to be primary but it's
+ # lost if hash -r or rehash -f is executed. Thus, those two
+ # functions have to be wrapped.
+ #
+ hash ${gcmd[2,-1]}=${commands[$gcmd]}
+
+ # This method generates wrapper functions.
+ # It will override shell builtins.
+ #
+ # eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }"
+
+ # This method is inflexible since the aliases are at risk of being
+ # overridden resulting in the BSD coreutils being called.
+ #
+ # alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}"
+ done
+
+ return 0
+}
+__gnu_utils
+
+function hash() {
+ if [[ "$*" =~ "-(r|f)" ]]; then
+ builtin hash "$@"
+ __gnu_utils
+ else
+ builtin hash "$@"
+ fi
+}
+
+function rehash() {
+ if [[ "$*" =~ "-f" ]]; then
+ builtin rehash "$@"
+ __gnu_utils
+ else
+ builtin rehash "$@"
+ fi
+}
+
diff --git a/zsh/plugins/go/README.md b/zsh/plugins/go/README.md
index 6ce6f4e..bf43b9f 100644
--- a/zsh/plugins/go/README.md
+++ b/zsh/plugins/go/README.md
@@ -1 +1 @@
-The go plugin is deprecated. Use the [golang plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/golang) instead.
+The go plugin is deprecated. Use the [golang plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/golang) instead.
diff --git a/zsh/plugins/go/go.plugin.zsh b/zsh/plugins/go/go.plugin.zsh
deleted file mode 120000
index cf943e2..0000000
--- a/zsh/plugins/go/go.plugin.zsh
+++ /dev/null
@@ -1 +0,0 @@
-../golang/golang.plugin.zsh
\ No newline at end of file
diff --git a/zsh/plugins/go/go.plugin.zsh b/zsh/plugins/go/go.plugin.zsh
new file mode 100644
index 0000000..da7c87c
--- /dev/null
+++ b/zsh/plugins/go/go.plugin.zsh
@@ -0,0 +1,3 @@
+print -P "%F{yellow}The 'go' plugin is deprecated. Use the '%Ugolang%u' plugin instead.%f"
+
+source "$ZSH/plugins/golang/golang.plugin.zsh"
diff --git a/zsh/plugins/gpg-agent/README.md b/zsh/plugins/gpg-agent/README.md
index a9711f9..9c1e6d2 100644
--- a/zsh/plugins/gpg-agent/README.md
+++ b/zsh/plugins/gpg-agent/README.md
@@ -3,6 +3,7 @@
Enables [GPG's gpg-agent](https://www.gnupg.org/documentation/manuals/gnupg/) if it is not running.
To use it, add gpg-agent to the plugins array of your zshrc file:
-```
+
+```zsh
plugins=(... gpg-agent)
```
diff --git a/zsh/plugins/gradle/README.md b/zsh/plugins/gradle/README.md
index 215503c..3756db0 100644
--- a/zsh/plugins/gradle/README.md
+++ b/zsh/plugins/gradle/README.md
@@ -1,4 +1,4 @@
-## Gradle Plugin
+# Gradle plugin
This plugin adds completions and aliases for [Gradle](https://gradle.org/).
@@ -10,9 +10,15 @@ plugins=(... gradle)
## Usage
-This plugin creates an alias `gradle` which is used to determine whether the current working directory has a gradlew file. If gradlew is present it will be used otherwise `gradle` is used directly. Gradle tasks can be executed directly without regard for whether it is `gradle` or `gradlew`
+This plugin creates a function called `gradle-or-gradlew`, which is aliased
+to `gradle`, which is used to determine whether the current project directory
+has a gradlew file. If `gradlew` is present it will be used, otherwise `gradle`
+is used instead. Gradle tasks can be executed directly without regard for
+whether it is `gradle` or `gradlew`. It also supports being called from
+any directory inside the root project directory.
Examples:
+
```zsh
gradle test
gradle build
@@ -20,4 +26,5 @@ gradle build
## Completion
-The completion provided for this plugin caches the parsed tasks into a file named `.gradletasknamecache` in the current working directory, so you might want to add that to your `.gitignore` file so that it's not accidentally committed.
+This plugin uses [the completion from the Gradle project](https://github.com/gradle/gradle-completion),
+which is distributed under the MIT license.
diff --git a/zsh/plugins/gradle/_gradle b/zsh/plugins/gradle/_gradle
deleted file mode 120000
index 80723f2..0000000
--- a/zsh/plugins/gradle/_gradle
+++ /dev/null
@@ -1 +0,0 @@
-gradle.plugin.zsh
\ No newline at end of file
diff --git a/zsh/plugins/gradle/_gradle b/zsh/plugins/gradle/_gradle
new file mode 100644
index 0000000..e77b23c
--- /dev/null
+++ b/zsh/plugins/gradle/_gradle
@@ -0,0 +1,420 @@
+#compdef gradle gradlew gw
+#
+# Taken from https://github.com/gradle/gradle-completion
+# Copyright (c) 2017 Eric Wendelin
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy of
+# this software and associated documentation files (the "Software"), to deal in
+# the Software without restriction, including without limitation the rights 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 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.
+# Terms
+
+__gradle-set-project-root-dir() {
+ local dir=`pwd`
+ project_root_dir=`pwd`
+ while [[ $dir != '/' ]]; do
+ if [[ -f "$dir/settings.gradle" || -f "$dir/settings.gradle.kts" || -f "$dir/gradlew" ]]; then
+ project_root_dir=$dir
+ return 0
+ fi
+ dir="$(dirname "$dir")"
+ done
+ return 1
+}
+
+__gradle-init-cache-dir() {
+ cache_dir="$HOME/.gradle/completion"
+ mkdir -p $cache_dir
+}
+
+__gradle-set-settings-file() {
+ # In order of precedence: --settings-file=filename, settings.gradle, settings.gradle.kts
+
+ local default_gradle_settings_file="$project_root_dir/settings.gradle"
+ if [[ ! -f $default_gradle_settings_file ]]; then
+ default_gradle_settings_file="$project_root_dir/settings.gradle.kts"
+ fi
+ gradle_settings_file=${${(v)opt_args[(i)-c|--settings-file]}:-$default_gradle_settings_file}
+}
+
+__gradle-set-build-file() {
+ __gradle-set-settings-file
+ # In order of precedence: --build-file=filename, rootProject.buildFileName, build.gradle, build.gradle.kts
+
+ local default_gradle_build_file_name="build.gradle"
+ if [[ -r $gradle_settings_file ]]; then
+ default_gradle_build_file_name=${$(grep "^rootProject\.buildFileName" $gradle_settings_file | \
+ sed -n -e "s/rootProject\.buildFileName = [\'\"]\(.*\)[\'\"]/\1/p")}
+
+ default_gradle_build_file_name="${default_gradle_build_file:-build.gradle}"
+ fi
+
+ local default_gradle_build_file="$project_root_dir/$default_gradle_build_file_name"
+ if [[ ! -f $default_gradle_build_file ]]; then
+ default_gradle_build_file="$project_root_dir/build.gradle.kts"
+ fi
+
+ # If a build file is specified after '-b' or '--build-file', use this file.
+ gradle_build_file=${${(v)opt_args[(i)-b|--build-file]}:-$default_gradle_build_file}
+}
+
+__gradle-set-cache-name() {
+ # Cache name is constructed from the absolute path of the build file.
+ cache_name=${${gradle_build_file:a}//[^[:alnum:]]/_}
+}
+
+__gradle-set-files-checksum() {
+ # Cache MD5 sum of all Gradle scripts and modified timestamps
+ if builtin command -v md5 > /dev/null; then
+ gradle_files_checksum=( $(md5 -q -s "$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null)") )
+ elif builtin command -v md5sum > /dev/null; then
+ gradle_files_checksum=( $(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null | md5sum | awk '{print $1}') )
+ else
+ _message 'Cannot generate completions as neither md5 nor md5sum exist on \$PATH'
+ return 1
+ fi
+}
+
+__gradle-generate-script-cache() {
+ # Invalidate cache after 3 weeks by default
+ local cache_ttl_mins=${$(echo $GRADLE_CACHE_TTL_MINUTES):-30240}
+ local script_exclude_pattern=${$(echo $GRADLE_COMPLETION_EXCLUDE_PATTERN):-"/(.git|build|integTest|samples|templates|smokeTest|testFixtures|out)/"}
+ if [[ ! $(find $cache_dir/$cache_name -mmin -$cache_ttl_mins 2>/dev/null) ]]; then
+ zle -R "Generating Gradle build script cache"
+ # Cache all Gradle scripts
+ local -a gradle_build_scripts
+ gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | egrep -v "$script_exclude_pattern") )
+ printf "%s\n" "${gradle_build_scripts[@]}" >| $cache_dir/$cache_name
+ fi
+}
+
+__gradle-generate-tasks-cache() {
+ __gradle-set-files-checksum
+
+ # Use Gradle wrapper when it exists.
+ local gradle_cmd="gradle"
+ if [[ -x "$project_root_dir/gradlew" ]]; then
+ gradle_cmd="$project_root_dir/gradlew"
+ fi
+
+ zle -R "Generating Gradle task cache from $gradle_build_file"
+
+ # Run gradle to retrieve possible tasks and cache.
+ # Reuse Gradle Daemon if IDLE but don't start a new one.
+ local gradle_tasks_output
+ if [[ ! -z "$($gradle_cmd --status 2>/dev/null | grep IDLE)" ]]; then
+ gradle_tasks_output="$($gradle_cmd --daemon --build-file $gradle_build_file --console plain -q tasks --all 2>/dev/null)"
+ else
+ gradle_tasks_output="$($gradle_cmd --no-daemon --build-file $gradle_build_file --console plain -q tasks --all 2>/dev/null)"
+ fi
+ local gradle_all_tasks="" root_tasks="" subproject_tasks="" output_line
+ local -a match
+ for output_line in ${(f)"$(printf "%s\n" "${gradle_tasks_output[@]}")"}; do
+ if [[ $output_line =~ ^([[:lower:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then
+ local task_name="${match[1]}"
+ local task_description="${match[3]}"
+ # Completion for subproject tasks with ':' prefix
+ if [[ $task_name =~ ^([[:alnum:][:punct:]]+):([[:alnum:]]+) ]]; then
+ gradle_all_tasks+="${task_name//:/\\:}:$task_description\n\\:${task_name//:/\\:}:$task_description\n"
+ subproject_tasks+="${match[2]}\n"
+ else
+ gradle_all_tasks+="${task_name//:/\\:}:$task_description\n"
+ root_tasks+="$task_name\n"
+ fi
+ fi
+ done
+
+ # subproject tasks can be referenced implicitly from root project
+ if [[ $GRADLE_COMPLETION_UNQUALIFIED_TASKS == "true" ]]; then
+ local -a implicit_tasks
+ implicit_tasks=( $(comm -23 <(echo $subproject_tasks | sort) <(echo $root_tasks | sort)) )
+ for task in $(printf "%s\n" "${implicit_tasks[@]}"); do
+ gradle_all_tasks+="$task\n"
+ done
+ fi
+
+ echo $gradle_all_tasks >| $cache_dir/$gradle_files_checksum
+ echo $gradle_files_checksum >| $cache_dir/$cache_name.md5
+}
+
+__gradle-completion-init() {
+ local cache_dir cache_name gradle_build_file gradle_files_checksum project_root_dir
+ __gradle-init-cache-dir
+ __gradle-set-project-root-dir
+ __gradle-set-build-file
+ if [[ -f $gradle_build_file ]]; then
+ __gradle-set-cache-name
+ __gradle-generate-script-cache
+ __gradle-set-files-checksum
+ __gradle-generate-tasks-cache
+ fi
+ return 0
+}
+
+__gradle_tasks() {
+ local cache_dir cache_name gradle_build_file gradle_files_checksum project_root_dir
+
+ __gradle-init-cache-dir
+ __gradle-set-project-root-dir
+ __gradle-set-build-file
+ if [[ -f $gradle_build_file ]]; then
+ __gradle-set-cache-name
+ __gradle-generate-script-cache
+ __gradle-set-files-checksum
+
+ # The cache key is md5 sum of all gradle scripts, so it's valid if it exists.
+ if [[ -f $cache_dir/$cache_name.md5 ]]; then
+ local cached_checksum="$(cat $cache_dir/$cache_name.md5)"
+ local -a cached_tasks
+ if [[ -z $cur ]]; then
+ cached_tasks=(${(f)"$(cat $cache_dir/$cached_checksum)"})
+ else
+ cached_tasks=(${(f)"$(grep "^${cur//:/\\\\:}" $cache_dir/$cached_checksum)"})
+ fi
+ _describe 'all tasks' cached_tasks && ret=0
+ else
+ __gradle-generate-tasks-cache
+ fi
+
+ # Regenerate tasks cache in the background
+ if [[ $gradle_files_checksum != "$(cat $cache_dir/$cache_name.md5)" || ! -f $cache_dir/$gradle_files_checksum || $(wc -c < $cache_dir/$gradle_files_checksum) -le 1 ]]; then
+ $(__gradle-generate-tasks-cache 1>&2 2>/dev/null &)
+ fi
+ else
+ _describe 'built-in tasks' '(
+ "buildEnvironment:Displays all buildscript dependencies declared in root project."
+ "components:Displays the components produced by root project."
+ "dependencies:Displays all dependencies declared in root project."
+ "dependencyInsight:Displays the insight into a specific dependency in root project."
+ "dependentComponents:Displays the dependent components of components in root project."
+ "help:Displays a help message."
+ "init:Initializes a new Gradle build."
+ "model:Displays the configuration model of root project."
+ "projects:Displays the sub-projects of root project."
+ "properties:Displays the properties of root project."
+ "tasks:Displays the tasks runnable from root project."
+ "wrapper:Generates Gradle wrapper files."
+ )' && ret=0
+ fi
+}
+
+__gradle_subcommand() {
+ integer ret=1
+
+ case "$words[1]" in
+ (dependencies)
+ _arguments \
+ '--configuration=[The configuration to generate the report for.]:dependency configuration:_gradle_dependency_configurations' && ret=0
+ ;;
+ (dependencyInsight)
+ _arguments \
+ '--dependency=[Shows the details of given dependency.]' \
+ '--configuration=[Looks for the dependency in given configuration.]:dependency configuration:_gradle_dependency_configurations' && ret=0
+ ;;
+ (help)
+ _arguments \
+ '--task[The task to show help for.]' && ret=0
+ ;;
+ (init)
+ _arguments \
+ '--dsl=[DSL to be used in generated scripts.]:dsl:(groovy kotlin)' \
+ '--package=[Package for the generated source.]' \
+ '--project-name=[Name of the generated project.]' \
+ '--test-framework=[Test framework to be used.]:test framework:(junit kotlintest scalatest spock testng)' \
+ '--type=[Project type to generate.]:project type:(basic cpp-application cpp-library groovy-application groovy-library java-application java-library kotlin-application kotlin-library pom scala-library)' && ret=0
+ ;;
+ (tasks)
+ _arguments \
+ '--all[List all tasks, including subproject tasks.]' \
+ '--group=[Show tasks only from given task group.]' && ret=0
+ ;;
+ (test)
+ _arguments -C \
+ '--debug-jvm[Enable debugging for the test process. The process is started suspended and listening on port 5005. Requires the "java" plugin.]' \
+ '--fail-fast[Stops test execution after the first failed test. Requires the "java" plugin.]' \
+ '--tests=[Sets test class or method name to be included, * is supported. Requires the "java" plugin.]' \
+ '(-)*:: :->task-or-option' && ret=0
+ ;;
+ (wrapper)
+ _arguments \
+ '--distribution-type=[Binary-only or all with docs and sources]:*:distribution type:(bin all)' \
+ '--gradle-version=[Set Gradle version for wrapper]' \
+ '--gradle-distribution-sha256-sum=[SHA-256 checksum]' \
+ '--gradle-distribution-url=[Set Gradle distribution URL]' && ret=0
+ ;;
+ (*)
+ _arguments -C \
+ {-a,--no-rebuild}'[Do not rebuild project dependencies.]' \
+ '(--no-build-cache)--build-cache[Enable the Gradle build cache.]' \
+ {-b,--build-file}'[Specifies the build file.]:build script:_files -g \*.gradle' \
+ {-C,--cache}'[Specifies how compiled build scripts should be cached.]:cache policy:(on rebuild)' \
+ {-c,--settings-file}'[Specifies the settings file.]:settings file:_files -g \*.gradle' \
+ '(--no-configure-on-demand)--configure-on-demand[Only relevant projects are configured in this build run.]' \
+ '--console=[Specifies which type of console output to generate.]:console output type:(plain auto rich verbose)' \
+ '--continue[Continues task execution after a task failure.]' \
+ '-Dorg.gradle.cache.reserved.mb=[Reserve Gradle Daemon memory for operations.]' \
+ '-Dorg.gradle.caching=[Set true to enable Gradle build cache.]:enable build cache:(true false)' \
+ '-Dorg.gradle.console=[Set type of console output to generate.]:console output type:(plain auto rich verbose)' \
+ '-Dorg.gradle.daemon.debug=[Set true to debug Gradle Daemon.]:enable daemon debug:(true false)' \
+ '-Dorg.gradle.daemon.idletimeout=[Kill Gradle Daemon after # idle millis.]' \
+ '-Dorg.gradle.debug=[Set true to debug Gradle Client.]' \
+ '-Dorg.gradle.jvmargs=[Set JVM arguments.]' \
+ '-Dorg.gradle.java.home=[Set JDK home dir.]' \
+ '-Dorg.gradle.logging.level=[Set default Gradle log level.]:log level:(quiet warn lifecycle info debug)' \
+ '-Dorg.gradle.parallel=[Set true to enable parallel project builds.]:enable parallel build:(true false)' \
+ '-Dorg.gradle.priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \
+ '-Dorg.gradle.warning.mode=[Set types of warnings to log.]:warning level:(all summary none)' \
+ '-Dorg.gradle.workers.max=[Set the number of workers Gradle is allowed to use.]' \
+ '(-i --info -w --warn -q --quiet)'{-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \
+ '(--no-daemon)--daemon[Uses the Gradle daemon to run the build. Starts the daemon if not running.]' \
+ '--foreground[Starts the Gradle daemon in the foreground.]' \
+ {-g,--gradle-user-home}'[Specifies the gradle user home directory.]:file:_directories' \
+ \*--include-build'[Includes the specified build in the composite.]:file:_directories' \
+ \*{-I,--init-script}'[Specifies an initialization script.]:init script:_files -g \*.gradle' \
+ '(-d --debug -w --warn -q --quiet)'{-i,--info}'[Set log level to info.]' \
+ '--max-workers[Set the maximum number of concurrent workers that Gradle may use.]:number workers' \
+ {-m,--dry-run}'[Runs the builds with all task actions disabled.]' \
+ '--no-color[Do not use color in the console output. (Removed in Gradle 3.0)]' \
+ '(--build-cache)--no-build-cache[Do not use the Gradle build cache.]' \
+ '(--configure-on-demand)--no-configure-on-demand[Disables configuration on demand.]' \
+ '(--daemon)--no-daemon[Do not use the Gradle daemon to run the build.]' \
+ '(--parallel)--no-parallel[Disables parallel execution to build projects.]' \
+ '(--scan)--no-scan[Do not create a build scan.]' \
+ '--offline[The build should operate without accessing network resources.]' \
+ \*{-P+,--project-prop}'[Set project property for the build script (e.g. -Pmyprop=myvalue).]:project property (prop=val):' \
+ {-p,--project-dir}'[Specifies the start directory for Gradle.]:start directory:_directories' \
+ '(--no-parallel)--parallel[Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]' \
+ '--profile[Profiles build execution time and generates a report in the /reports/profile directory.]' \
+ '--priority[Set priority for Gradle worker processes.]:priority:(low normal)' \
+ '--project-cache-dir[Specifies the project-specific cache directory.]:cache directory:_directories' \
+ '(-d --debug -w --warn -i --info)'{-q,--quiet}'[Log errors only.]' \
+ '--recompile-scripts[Force build script recompiling.]' \
+ '--refresh[Refresh the state of resources of the type(s) specified.]:refresh policy:(dependencies)' \
+ '--refresh-dependencies[Refresh the state of dependencies.]' \
+ '--rerun-tasks[Ignore previously cached task results.]' \
+ '(--no-scan)--scan[Create a build scan.]' \
+ '(-S --full-stacktrace)'{-s,--stacktrace}'[Print out the stacktrace for all exceptions.]' \
+ '(-s --stacktrace)'{-S,--full-stacktrace}'[Print out the full (very verbose) stacktrace for all exceptions.]' \
+ '--system-prop[system property (prop=val)]' \
+ {-t,--continuous}'[Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.]' \
+ {-u,--no-search-upward}"[Don't search in parent folders for a settings.gradle file.]" \
+ '(--write-locks)--update-locks[Perform a partial update of the dependency lock.]' \
+ '(-d --debug -q --quiet -i --info)'{-w,--warn}'[Log warnings and errors only.]' \
+ '--warning-mode=[Set types of warnings to log.]:warning mode:(all summary none)' \
+ '(--update-locks)--write-locks[Persists dependency resolution for locked configurations.]' \
+ {-x,--exclude-task}'[Specify a task to be excluded from execution.]' && ret=0
+ ;;
+ esac
+
+ return ret
+}
+
+(( $+functions[_gradle_dependency_configurations] )) ||
+_gradle_dependency_configurations() {
+ local configurations
+ configurations=(
+ 'compileClasspath'
+ 'runtimeClasspath'
+ 'testCompileClasspath'
+ 'testRuntimeClasspath'
+ )
+ _describe -t 'dependency configurations' "dependency configuration" configurations
+}
+
+_gradle() {
+ local cur=${words[CURRENT]}
+ local curcontext="$curcontext" state
+ integer ret=1
+ typeset -A opt_args
+
+ _arguments -C \
+ '(-)'{-\?,-h,--help}'[Shows a help message.]' \
+ {-a,--no-rebuild}'[Do not rebuild project dependencies.]' \
+ '(--no-build-cache)--build-cache[Enable the Gradle build cache.]' \
+ {-b,--build-file}'[Specifies the build file.]:build script:_files -g \*.gradle' \
+ {-C,--cache}'[Specifies how compiled build scripts should be cached.]:cache policy:(on rebuild)' \
+ {-c,--settings-file}'[Specifies the settings file.]:settings file:_files -g \*.gradle:->argument-expected' \
+ '(--no-configure-on-demand)--configure-on-demand[Only relevant projects are configured in this build run.]' \
+ '--console=[Specifies which type of console output to generate.]:console output type:(plain auto rich verbose)' \
+ '--continue[Continues task execution after a task failure.]' \
+ '-Dorg.gradle.cache.reserved.mb=[Reserve Gradle Daemon memory for operations.]' \
+ '-Dorg.gradle.caching=[Set true to enable Gradle build cache.]' \
+ '-Dorg.gradle.console=[Set type of console output to generate.]:console output type:(plain auto rich verbose)' \
+ '-Dorg.gradle.daemon.debug=[Set true to debug Gradle Daemon.]' \
+ '-Dorg.gradle.daemon.idletimeout=[Kill Gradle Daemon after # idle millis.]' \
+ '-Dorg.gradle.debug=[Set true to debug Gradle Client.]' \
+ '-Dorg.gradle.jvmargs=[Set JVM arguments.]' \
+ '-Dorg.gradle.java.home=[Set JDK home dir.]' \
+ '-Dorg.gradle.logging.level=[Set default Gradle log level.]:log level:(quiet warn lifecycle info debug)' \
+ '-Dorg.gradle.parallel=[Set true to enable parallel project builds.]:(true false)' \
+ '-Dorg.gradle.priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \
+ '-Dorg.gradle.warning.mode=[Set types of warnings to log.]:warning level:(all summary none)' \
+ '-Dorg.gradle.workers.max=[Set the number of workers Gradle is allowed to use.]' \
+ '(-i --info -w --warn -q --quiet)'{-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \
+ '(--no-daemon)--daemon[Uses the Gradle daemon to run the build. Starts the daemon if not running.]' \
+ '--foreground[Starts the Gradle daemon in the foreground.]' \
+ {-g,--gradle-user-home}'[Specifies the gradle user home directory.]:home directory:_directories:->argument-expected' \
+ '(-)--gui[Launches the Gradle GUI. (Removed in Gradle 4.0)]' \
+ \*--include-build'[Includes the specified build in the composite.]:file:_directories:->argument-expected' \
+ \*{-I,--init-script}'[Specifies an initialization script.]:init script:_files -g \*.gradle:->argument-expected' \
+ '(-d --debug -w --warn -q --quiet)'{-i,--info}'[Set log level to info.]' \
+ '--max-workers[Set the maximum number of concurrent workers that Gradle may use.]:number workers:->argument-expected' \
+ {-m,--dry-run}'[Runs the builds with all task actions disabled.]' \
+ '--no-color[Do not use color in the console output. (Removed in Gradle 3.0)]' \
+ '(--build-cache)--no-build-cache[Do not use the Gradle build cache.]' \
+ '(--configure-on-demand)--no-configure-on-demand[Disables configuration on demand.]' \
+ '(--daemon)--no-daemon[Do not use the Gradle daemon to run the build.]' \
+ '(--parallel)--no-parallel[Disables parallel execution to build projects.]' \
+ '(--scan)--no-scan[Do not create a build scan.]' \
+ '--offline[The build should operate without accessing network resources.]' \
+ \*{-P+,--project-prop}'[Set project property for the build script (e.g. -Pmyprop=myvalue).]:project property (prop=val):->argument-expected' \
+ {-p,--project-dir}'[Specifies the start directory for Gradle.]:start directory:_directories:->argument-expected' \
+ '(--no-parallel)--parallel[Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]' \
+ '--priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \
+ '--profile[Profiles build execution time and generates a report in the /reports/profile directory.]' \
+ '--project-cache-dir=[Specifies the project-specific cache directory.]:cache directory:_directories:->argument-expected' \
+ '(-d --debug -w --warn -i --info)'{-q,--quiet}'[Log errors only.]' \
+ '--recompile-scripts[Force build script recompiling.]' \
+ '--refresh[Refresh the state of resources of the type(s) specified.]:refresh policy:(dependencies)' \
+ '--refresh-dependencies[Refresh the state of dependencies.]' \
+ '--rerun-tasks[Ignore previously cached task results.]' \
+ '(--no-scan)--scan[Create a build scan.]' \
+ '(-S --full-stacktrace)'{-s,--stacktrace}'[Print out the stacktrace for all exceptions.]' \
+ '(-s --stacktrace)'{-S,--full-stacktrace}'[Print out the full (very verbose) stacktrace for all exceptions.]' \
+ '(-)--status[Shows status of running and recently stopped Gradle Daemons.]' \
+ '(-)--stop[Stops all Gradle daemons.]' \
+ '--system-prop[system property (prop=val)]' \
+ {-t,--continuous}'[Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.]' \
+ {-u,--no-search-upward}"[Don't search in parent folders for a settings.gradle file.]" \
+ '(--write-locks)--update-locks[Perform a partial update of the dependency lock.]' \
+ '(-)'{-v,--version}'[Print version info.]' \
+ '(-d --debug -q --quiet -i --info)'{-w,--warn}'[Log warnings and errors only.]' \
+ '--warning-mode=[Set types of warnings to log.]:warning mode:(all summary none)' \
+ '(--update-locks)--write-locks[Persists dependency resolution for locked configurations.]' \
+ {-x,--exclude-task}'[Specify a task to be excluded from execution.]' \
+ '(-)*:: :->task-or-option' && ret=0
+
+ if [[ $words[CURRENT] != -* && $state != "argument-expected" ]]; then
+ __gradle_tasks && ret=0
+ else
+ curcontext=${curcontext%:*:*}:gradle-$words[1]:
+ __gradle_subcommand && ret=0
+ fi
+
+ return ret
+}
+
+_gradle "$@"
diff --git a/zsh/plugins/gradle/_gradlew b/zsh/plugins/gradle/_gradlew
deleted file mode 120000
index 80723f2..0000000
--- a/zsh/plugins/gradle/_gradlew
+++ /dev/null
@@ -1 +0,0 @@
-gradle.plugin.zsh
\ No newline at end of file
diff --git a/zsh/plugins/gradle/gradle.plugin.zsh b/zsh/plugins/gradle/gradle.plugin.zsh
index 8d578e2..5bca364 100644
--- a/zsh/plugins/gradle/gradle.plugin.zsh
+++ b/zsh/plugins/gradle/gradle.plugin.zsh
@@ -1,183 +1,26 @@
-##############################################################################
-# A descriptive listing of core Gradle commands
-############################################################################
-
-gradle-or-gradlew() {
- if [ -f ./gradlew ] ; then
- echo "executing gradlew instead of gradle";
- ./gradlew "$@";
- else
- gradle "$@";
- fi
-}
-
-alias gradle=gradle-or-gradlew;
-
-function _gradle_core_commands() {
- local ret=1 state
- _arguments ':subcommand:->subcommand' && ret=0
-
- case $state in
- subcommand)
- subcommands=(
- "properties:Display all project properties"
- "tasks:Calculate and display all tasks"
- "dependencies:Calculate and display all dependencies"
- "projects:Discover and display all sub-projects"
- "build:Build the project"
- "help:Display help"
- )
- _describe -t subcommands 'gradle subcommands' subcommands && ret=0
- esac
-
- return ret
-}
-
-function _gradle_arguments() {
- _arguments -C \
- '-a[Do not rebuild project dependencies]' \
- '-b[Specifies the build file]' \
- '-c[Specifies the settings file]' \
- '-d[Log at the debug level]' \
- '-g[Specifies the Gradle user home directory]' \
- '-h[Shows a help message]' \
- '-i[Set log level to INFO]' \
- '-m[Runs the build with all task actions disabled]' \
- '-p[Specifies the start directory for Gradle]' \
- '-q[Log errors only]' \
- '-s[Print out the stacktrace also for user exceptions]' \
- '-t[Continuous mode. Automatically re-run build after changes]' \
- '-u[Don''t search in parent directories for a settings.gradle file]' \
- '-v[Prints Gradle version info]' \
- '-x[Specify a task to be excluded]' \
- '-D[Set a system property]' \
- '-I[Specifies an initialization script]' \
- '-P[Sets a project property of the root project]' \
- '-S[Print out the full (very verbose) stacktrace]' \
- '--build-file[Specifies the build file]' \
- '--configure-on-demand[Only relevant projects are configured]' \
- '--console[Type of console output to generate (plain, auto, or rich)]' \
- '--continue[Continues task execution after a task failure]' \
- '--continuous[Continuous mode. Automatically re-run build after changes]' \
- '--daemon[Use the Gradle Daemon]' \
- '--debug[Log at the debug level]' \
- '--dry-run[Runs the build with all task actions disabled]' \
- '--exclude-task[Specify a task to be excluded]' \
- '--full-stacktrace[Print out the full (very verbose) stacktrace]' \
- '--gradle-user-home[Specifies the Gradle user home directory]' \
- '--gui[Launches the Gradle GUI app (Deprecated)]' \
- '--help[Shows a help message]' \
- '--include-build[Run the build as a composite, including the specified build]' \
- '--info[Set log level to INFO]' \
- '--init-script[Specifies an initialization script]' \
- '--max-workers[Set the maximum number of workers that Gradle may use]' \
- '--no-daemon[Do not use the Gradle Daemon]' \
- '--no-rebuild[Do not rebuild project dependencies]' \
- '--no-search-upwards[Don''t search in parent directories for a settings.gradle file]' \
- '--offline[Build without accessing network resources]' \
- '--parallel[Build projects in parallel]' \
- '--profile[Profile build time and create report]' \
- '--project-cache-dir[Specifies the project-specific cache directory]' \
- '--project-dir[Specifies the start directory for Gradle]' \
- '--project-prop[Sets a project property of the root project]' \
- '--quiet[Log errors only]' \
- '--recompile-scripts[Forces scripts to be recompiled, bypassing caching]' \
- '--refresh-dependencies[Refresh the state of dependencies]' \
- '--rerun-task[Specifies that any task optimization is ignored]' \
- '--settings-file[Specifies the settings file]' \
- '--stacktrace[Print out the stacktrace also for user exceptions]' \
- '--status[Print Gradle Daemon status]' \
- '--stop[Stop all Gradle Daemons]' \
- '--system-prop[Set a system property]' \
- '--version[Prints Gradle version info]' \
- '*::command:->command' \
- && return 0
-}
-
-
-##############################################################################
-# Examine the build.gradle file to see if its timestamp has changed;
-# and if so, regenerate the .gradle_tasks cache file
-############################################################################
-_gradle_does_task_list_need_generating () {
- [[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache || build.gradle.kts -nt .gradletasknamecache ]]
-}
-
-##############
-# Parse the tasks from `gradle(w) tasks --all` and return them to the calling function.
-# All lines in the output from gradle(w) that are between /^-+$/ and /^\s*$/
-# are considered to be tasks. If and when gradle adds support for listing tasks
-# for programmatic parsing, this method can be deprecated.
-##############
-_gradle_parse_tasks () {
- lines_might_be_tasks=false
- task_name_buffer=""
- while read -r line; do
- if [[ $line =~ ^-+$ ]]; then
- lines_might_be_tasks=true
- # Empty buffer, because it contains items that are not tasks
- task_name_buffer=""
- elif [[ $line =~ ^\s*$ ]]; then
- if [[ "$lines_might_be_tasks" = true ]]; then
- # If a newline is found, echo the buffer to the calling function
- while read -r task; do
- echo $task | awk '/[a-zA-Z0-9:-]+/ {print $1}'
- done <<< "$task_name_buffer"
- # Empty buffer, because we are done with the tasks
- task_name_buffer=""
- fi
- lines_might_be_tasks=false
- elif [[ "$lines_might_be_tasks" = true ]]; then
- task_name_buffer="${task_name_buffer}\n${line}"
+# Looks for a gradlew file in the current working directory
+# or any of its parent directories, and executes it if found.
+# Otherwise it will call gradle directly.
+function gradle-or-gradlew() {
+ # find project root
+ # taken from https://github.com/gradle/gradle-completion
+ local dir="$PWD" project_root="$PWD"
+ while [[ "$dir" != / ]]; do
+ if [[ -f "$dir/settings.gradle" || -f "$dir/settings.gradle.kts" || -f "$dir/gradlew" ]]; then
+ project_root="$dir"
+ break
fi
- done <<< "$1"
-}
+ dir="${dir:h}"
+ done
-
-##############
-# Gradle tasks from subprojects are allowed to be executed without specifying
-# the subproject; that task will then be called on all subprojects.
-# gradle(w) tasks --all only lists tasks per subproject, but when autocompleting
-# we often want to be able to run a specific task on all subprojects, e.g.
-# "gradle clean".
-# This function uses the list of tasks from "gradle tasks --all", and for each
-# line grabs everything after the last ":" and combines that output with the original
-# output. The combined list is returned as the result of this function.
-##############
-_gradle_parse_and_extract_tasks () {
- # All tasks
- tasks=$(_gradle_parse_tasks "$1")
- # Task name without sub project(s) prefix
- simple_tasks=$(echo $tasks | awk 'BEGIN { FS = ":" } { print $NF }')
- echo "$tasks\n$simple_tasks"
-}
-
-##############################################################################
-# Discover the gradle tasks by running "gradle tasks --all"
-############################################################################
-_gradle_tasks () {
- if [[ -f build.gradle || -f build.gradle.kts || -f settings.gradle || -f settings.gradle.kts ]]; then
- _gradle_arguments
- if _gradle_does_task_list_need_generating; then
- _gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache
- fi
- compadd -X "==== Gradle Tasks ====" $(cat .gradletasknamecache)
+ # if gradlew found, run it instead of gradle
+ if [[ -f "$project_root/gradlew" ]]; then
+ echo "executing gradlew instead of gradle"
+ "$project_root/gradlew" "$@"
+ else
+ command gradle "$@"
fi
}
-_gradlew_tasks () {
- if [[ -f build.gradle || -f build.gradle.kts || -f settings.gradle || -f settings.gradle.kts ]]; then
- _gradle_arguments
- if _gradle_does_task_list_need_generating; then
- _gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache
- fi
- compadd -X "==== Gradlew Tasks ====" $(cat .gradletasknamecache)
- fi
-}
-
-
-##############################################################################
-# Register the completions against the gradle and gradlew commands
-############################################################################
-compdef _gradle_tasks gradle
-compdef _gradlew_tasks gradlew
+alias gradle=gradle-or-gradlew
+compdef _gradle gradle-or-gradlew
diff --git a/zsh/plugins/grails/README.md b/zsh/plugins/grails/README.md
index 64b4a9f..5d9ebd7 100644
--- a/zsh/plugins/grails/README.md
+++ b/zsh/plugins/grails/README.md
@@ -14,58 +14,3 @@ It looks for scripts in the following paths:
- `~/.grails/scripts`
- `./scripts`
- `./plugins/*/scripts`
-
-## Grails Commands
-- `add-proxy`
-- `alias`
-- `bootstrap`
-- `bug-report`
-- `clean`
-- `clean-all`
-- `clear-proxy`
-- `compile`
-- `console`
-- `create-app`
-- `create-controller`
-- `create-domain-class`
-- `create-filters`
-- `create-integration-test`
-- `create-multi-project-build`
-- `create-plugin`
-- `create-pom`
-- `create-script`
-- `create-service`
-- `create-tag-lib`
-- `create-unit-test`
-- `dependency-report`
-- `doc`
-- `help`
-- `init`
-- `install-app-templates`
-- `install-dependency`
-- `install-plugin`
-- `install-templates`
-- `integrate-with`
-- `interactive`
-- `list-plugin-updates`
-- `list-plugins`
-- `migrate-docs`
-- `package`
-- `package-plugin`
-- `plugin-info`
-- `refresh-dependencies`
-- `remove-proxy`
-- `run-app`
-- `run-script`
-- `run-war`
-- `set-grails-version`
-- `set-proxy`
-- `set-version`
-- `shell`
-- `stats`
-- `stop-app`
-- `test-app`
-- `uninstall-plugin`
-- `url-mappings-report`
-- `war`
-- `wrapper`
diff --git a/zsh/plugins/history-substring-search/README.md b/zsh/plugins/history-substring-search/README.md
index 7fb0fa0..6d8b564 100644
--- a/zsh/plugins/history-substring-search/README.md
+++ b/zsh/plugins/history-substring-search/README.md
@@ -1,25 +1,44 @@
-zsh-history-substring-search
-==============================================================================
+# zsh-history-substring-search
This is a clean-room implementation of the [Fish shell][1]'s history search
-feature, where you can type in any part of any previously entered command
-and press the UP and DOWN arrow keys to cycle through the matching commands.
-You can also use K and J in VI mode or ^P and ^N in EMACS mode for the same.
+feature, where you can type in any part of any command from history and then
+press chosen keys, such as the UP and DOWN arrows, to cycle through matches.
-[1]: https://fishshell.com
-[2]: https://www.zsh.org/mla/users/2009/msg00818.html
-[3]: https://sourceforge.net/projects/fizsh/
+[1]: http://fishshell.com
+[2]: http://www.zsh.org/mla/users/2009/msg00818.html
+[3]: http://sourceforge.net/projects/fizsh/
[4]: https://github.com/robbyrussell/oh-my-zsh/pull/215
[5]: https://github.com/zsh-users/zsh-history-substring-search
[6]: https://github.com/zsh-users/zsh-syntax-highlighting
-------------------------------------------------------------------------------
+
Requirements
------------------------------------------------------------------------------
* [ZSH](http://zsh.sourceforge.net) 4.3 or newer
+Install
------------------------------------------------------------------------------
+
+Using the [Homebrew]( https://brew.sh ) package manager:
+
+ brew install zsh-history-substring-search
+ echo 'source /usr/local/share/zsh-history-substring-search/zsh-history-substring-search.zsh' >> ~/.zshrc
+
+Using [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh):
+
+1. Clone this repository in oh-my-zsh's plugins directory:
+
+ git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
+
+2. Activate the plugin in `~/.zshrc`:
+
+ plugins=( [plugins...] history-substring-search)
+
+3. Source `~/.zshrc` to take changes into account:
+
+ source ~/.zshrc
+
Usage
------------------------------------------------------------------------------
@@ -33,117 +52,147 @@ Usage
% source zsh-syntax-highlighting.zsh
% source zsh-history-substring-search.zsh
-2. Bind keyboard shortcuts to this script's functions:
+2. Bind keyboard shortcuts to this script's functions.
- # bind UP and DOWN arrow keys
- zmodload zsh/terminfo
- bindkey "$terminfo[kcuu1]" history-substring-search-up
- bindkey "$terminfo[kcud1]" history-substring-search-down
+ Users typically bind their UP and DOWN arrow keys to this script, thus:
+ * Run `cat -v` in your favorite terminal emulator to observe key codes.
+ (**NOTE:** In some cases, `cat -v` shows the wrong key codes. If the
+ key codes shown by `cat -v` don't work for you, press `` and
+ `` at your ZSH command line prompt for correct key codes.)
+ * Press the UP arrow key and observe what is printed in your terminal.
+ * Press the DOWN arrow key and observe what is printed in your terminal.
+ * Press the Control and C keys simultaneously to terminate the `cat -v`.
+ * Use your observations from the previous steps to create key bindings.
+ For example, if you observed `^[[A` for UP and `^[[B` for DOWN, then:
- # bind UP and DOWN arrow keys (compatibility fallback
- # for Ubuntu 12.04, Fedora 21, and MacOSX 10.9 users)
- bindkey '^[[A' history-substring-search-up
- bindkey '^[[B' history-substring-search-down
+ bindkey '^[[A' history-substring-search-up
+ bindkey '^[[B' history-substring-search-down
- # bind P and N for EMACS mode
- bindkey -M emacs '^P' history-substring-search-up
- bindkey -M emacs '^N' history-substring-search-down
+ However, if the observed values don't work, you can try using terminfo:
- # bind k and j for VI mode
- bindkey -M vicmd 'k' history-substring-search-up
- bindkey -M vicmd 'j' history-substring-search-down
+ bindkey "$terminfo[kcuu1]" history-substring-search-up
+ bindkey "$terminfo[kcud1]" history-substring-search-down
+
+ You might also want to bind the Control-P/N keys for use in EMACS mode:
+
+ bindkey -M emacs '^P' history-substring-search-up
+ bindkey -M emacs '^N' history-substring-search-down
+
+ You might also want to bind the `k` and `j` keys for use in VI mode:
+
+ bindkey -M vicmd 'k' history-substring-search-up
+ bindkey -M vicmd 'j' history-substring-search-down
3. Type any part of any previous command and then:
- * Press the UP arrow key to select the nearest command that (1) contains
- your query and (2) is older than the current command in the command
- history.
+ * Press the `history-substring-search-up` key, which was configured in
+ step 2 above, to select the nearest command that (1) contains your query
+ and (2) is also older than the current command in your command history.
- * Press the DOWN arrow key to select the nearest command that (1)
- contains your query and (2) is newer than the current command in the
- command history.
+ * Press the `history-substring-search-down` key, which was configured in
+ step 2 above, to select the nearest command that (1) contains your query
+ and (2) is also newer than the current command in your command history.
- * Press ^U (the Control and U keys simultaneously) to abort the search.
+ * Press `^U` the Control and U keys simultaneously to abort the search.
4. If a matching command spans more than one line of text, press the LEFT
arrow key to move the cursor away from the end of the command, and then:
- * Press the UP arrow key to move the cursor to the line above. When the
- cursor reaches the first line of the command, pressing the UP arrow
- key again will cause this script to perform another search.
+ * Press the `history-substring-search-up` key, which was configured in
+ step 2 above, to move the cursor to the line above the cursored line.
+ When the cursor reaches the first line of the command, pressing the
+ `history-substring-search-up` key again will cause this script to
+ perform another search.
+
+ * Press the `history-substring-search-down` key, which was configured in
+ step 2 above, to move the cursor to the line below the cursored line.
+ When the cursor reaches the last line of the command, pressing the
+ `history-substring-search-down` key, which was configured in step 2
+ above, again will cause this script to perform another search.
- * Press the DOWN arrow key to move the cursor to the line below. When
- the cursor reaches the last line of the command, pressing the DOWN
- arrow key again will cause this script to perform another search.
-------------------------------------------------------------------------------
Configuration
------------------------------------------------------------------------------
This script defines the following global variables. You may override their
default values only after having loaded this script into your ZSH session.
-* HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND is a global variable that defines
+* `HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND` is a global variable that defines
how the query should be highlighted inside a matching command. Its default
value causes this script to highlight using bold, white text on a magenta
background. See the "Character Highlighting" section in the zshzle(1) man
page to learn about the kinds of values you may assign to this variable.
-* HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND is a global variable that
+* `HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND` is a global variable that
defines how the query should be highlighted when no commands in the
history match it. Its default value causes this script to highlight using
bold, white text on a red background. See the "Character Highlighting"
section in the zshzle(1) man page to learn about the kinds of values you
may assign to this variable.
-* HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS is a global variable that defines
+* `HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS` is a global variable that defines
how the command history will be searched for your query. Its default value
causes this script to perform a case-insensitive search. See the "Globbing
Flags" section in the zshexpn(1) man page to learn about the kinds of
values you may assign to this variable.
-To always receive _unique_ search results, use `setopt HIST_IGNORE_ALL_DUPS`.
-Alternatively, use `setopt HIST_FIND_NO_DUPS` which makes this plugin skip
-duplicate _adjacent_ search results as you cycle through them---however, this
-does not guarantee that search results are unique: if your search results were
-"Dog", "Dog", "HotDog", "Dog", then cycling them gives "Dog", "HotDog", "Dog".
-Notice that the "Dog" search result appeared twice as you cycled through them!
-If you wish to avoid this limitation, then use `setopt HIST_IGNORE_ALL_DUPS`.
+* `HISTORY_SUBSTRING_SEARCH_FUZZY` is a global variable that defines
+ how the command history will be searched for your query. If set to a non-empty
+ value, causes this script to perform a fuzzy search by words, matching in
+ given order e.g. `ab c` will match `*ab*c*`
+
+* `HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE` is a global variable that defines
+ whether all search results returned are _unique_. If set to a non-empty
+ value, then only unique search results are presented. This behaviour is off
+ by default. An alternative way to ensure that search results are unique is
+ to use `setopt HIST_IGNORE_ALL_DUPS`. If this configuration variable is off
+ and `setopt HIST_IGNORE_ALL_DUPS` is unset, then `setopt HIST_FIND_NO_DUPS`
+ is still respected and it makes this script skip duplicate _adjacent_ search
+ results as you cycle through them, but this does not guarantee that search
+ results are unique: if your search results were "Dog", "Dog", "HotDog",
+ "Dog", then cycling them gives "Dog", "HotDog", "Dog". Notice that the "Dog"
+ search result appeared twice as you cycled through them. If you wish to
+ receive globally unique search results only once, then use this
+ configuration variable, or use `setopt HIST_IGNORE_ALL_DUPS`.
+
-------------------------------------------------------------------------------
History
------------------------------------------------------------------------------
-This script was originally written by [Peter Stephenson][2], who published it
-to the ZSH users mailing list (thereby making it public domain) in September
-2009. It was later revised by Guido van Steen and released under the BSD
-license (see below) as part of [the fizsh project][3] in January 2011.
+* September 2009: [Peter Stephenson][2] originally wrote this script and it
+ published to the zsh-users mailing list.
-It was later extracted from fizsh release 1.0.1, refactored heavily, and
-repackaged as both an [oh-my-zsh plugin][4] and as an independently loadable
-[ZSH script][5] by Suraj N. Kurapati in 2011.
+* January 2011: Guido van Steen (@guidovansteen) revised this script and
+ released it under the 3-clause BSD license as part of [fizsh][3], the
+ Friendly Interactive ZSHell.
-It was [further developed][4] by Guido van Steen, Suraj N. Kurapati, Sorin
-Ionescu, and Vincent Guerci in 2011.
+* January 2011: Suraj N. Kurapati (@sunaku) extracted this script from
+ [fizsh][3] 1.0.1, refactored it heavily, and finally repackaged it as an
+ [oh-my-zsh plugin][4] and as an independently loadable [ZSH script][5].
+
+* July 2011: Guido van Steen, Suraj N. Kurapati, and Sorin Ionescu
+ (@sorin-ionescu) [further developed it][4] with Vincent Guerci (@vguerci).
+
+* March 2016: Geza Lore (@gezalore) greatly refactored it in pull request #55.
------------------------------------------------------------------------------
Oh My Zsh Distribution Notes
------------------------------------------------------------------------------
-What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search
+What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search
as an OMZ module inside the Oh My Zsh distribution.
-The upstream repo, zsh-users/zsh-history-substring-search, can be found on GitHub at
+The upstream repo, zsh-users/zsh-history-substring-search, can be found on GitHub at
https://github.com/zsh-users/zsh-history-substring-search.
This downstream copy was last updated from the following upstream commit:
- SHA: 2c295432175990c1bb4e90bc13f609daa67a25d6
- Commit date: 2015-09-28 10:47:34 -0700
+ SHA: 0f80b8eb3368b46e5e573c1d91ae69eb095db3fb
+ Commit date: 2019-05-12 17:35:54 -0700
Everything above this section is a copy of the original upstream's README, so things
may differ slightly when you're using this inside OMZ. In particular, you do not
-need to set up key bindings for the up and down arrows yourself in `~/.zshrc`; the OMZ
+need to set up key bindings for the up and down arrows yourself in `~/.zshrc`; the OMZ
plugin does that for you. You may still want to set up additional emacs- or vi-specific
bindings as mentioned above.
diff --git a/zsh/plugins/history-substring-search/history-substring-search.plugin.zsh b/zsh/plugins/history-substring-search/history-substring-search.plugin.zsh
index 7883a65..d2c749b 100644
--- a/zsh/plugins/history-substring-search/history-substring-search.plugin.zsh
+++ b/zsh/plugins/history-substring-search/history-substring-search.plugin.zsh
@@ -1,20 +1,9 @@
-# This file integrates the zsh-history-substring-search script into oh-my-zsh.
-
-source "${0:r:r}.zsh"
-
-if test "$CASE_SENSITIVE" = true; then
- unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS
-fi
-
-if test "$DISABLE_COLOR" = true; then
- unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
- unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
-fi
+0=${(%):-%N}
+source ${0:A:h}/history-substring-search.zsh
# Bind terminal-specific up and down keys
-# Bind in both emacs and vi modes so it works in both, and is not
-# sensitive to whether this is loaded before or after the vi-mode plugin
+
if [[ -n "$terminfo[kcuu1]" ]]; then
bindkey -M emacs "$terminfo[kcuu1]" history-substring-search-up
bindkey -M viins "$terminfo[kcuu1]" history-substring-search-up
diff --git a/zsh/plugins/history-substring-search/history-substring-search.zsh b/zsh/plugins/history-substring-search/history-substring-search.zsh
index 3b8afd3..a791cc4 100644
--- a/zsh/plugins/history-substring-search/history-substring-search.zsh
+++ b/zsh/plugins/history-substring-search/history-substring-search.zsh
@@ -6,6 +6,8 @@
# Copyright (c) 2011 Suraj N. Kurapati
# Copyright (c) 2011 Sorin Ionescu
# Copyright (c) 2011 Vincent Guerci
+# Copyright (c) 2016 Geza Lore
+# Copyright (c) 2017 Bengt Brodersen
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -38,12 +40,30 @@
##############################################################################
#-----------------------------------------------------------------------------
-# configuration variables
+# declare global configuration variables
#-----------------------------------------------------------------------------
-HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'
-HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'
-HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'
+typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'
+typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'
+typeset -g HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'
+typeset -g HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=''
+typeset -g HISTORY_SUBSTRING_SEARCH_FUZZY=''
+
+#-----------------------------------------------------------------------------
+# declare internal global variables
+#-----------------------------------------------------------------------------
+
+typeset -g BUFFER MATCH MBEGIN MEND CURSOR
+typeset -g _history_substring_search_refresh_display
+typeset -g _history_substring_search_query_highlight
+typeset -g _history_substring_search_result
+typeset -g _history_substring_search_query
+typeset -g -a _history_substring_search_query_parts
+typeset -g -a _history_substring_search_raw_matches
+typeset -g -i _history_substring_search_raw_match_index
+typeset -g -a _history_substring_search_matches
+typeset -g -i _history_substring_search_match_index
+typeset -g -A _history_substring_search_unique_filter
#-----------------------------------------------------------------------------
# the main ZLE widgets
@@ -180,62 +200,104 @@ _history-substring-search-begin() {
_history_substring_search_query_highlight=
#
- # Continue using the previous $_history_substring_search_result by default,
- # unless the current query was cleared or a new/different query was entered.
+ # If the buffer is the same as the previously displayed history substring
+ # search result, then just keep stepping through the match list. Otherwise
+ # start a new search.
#
- if [[ -z $BUFFER || $BUFFER != $_history_substring_search_result ]]; then
+ if [[ -n $BUFFER && $BUFFER == ${_history_substring_search_result:-} ]]; then
+ return;
+ fi
+
+ #
+ # Clear the previous result.
+ #
+ _history_substring_search_result=''
+
+ if [[ -z $BUFFER ]]; then
#
- # For the purpose of highlighting we will also keep
- # a version without doubly-escaped meta characters.
+ # If the buffer is empty, we will just act like up-history/down-history
+ # in ZSH, so we do not need to actually search the history. This should
+ # speed things up a little.
+ #
+ _history_substring_search_query=
+ _history_substring_search_query_parts=()
+ _history_substring_search_raw_matches=()
+
+ else
+ #
+ # For the purpose of highlighting we keep a copy of the original
+ # query string.
#
_history_substring_search_query=$BUFFER
#
- # $BUFFER contains the text that is in the command-line currently.
- # we put an extra "\\" before meta characters such as "\(" and "\)",
- # so that they become "\\\(" and "\\\)".
+ # compose search pattern
#
- _history_substring_search_query_escaped=${BUFFER//(#m)[\][()|\\*?#<>~^]/\\$MATCH}
+ if [[ -n $HISTORY_SUBSTRING_SEARCH_FUZZY ]]; then
+ #
+ # `=` split string in arguments
+ #
+ _history_substring_search_query_parts=(${=_history_substring_search_query})
+ else
+ _history_substring_search_query_parts=(${==_history_substring_search_query})
+ fi
#
- # Find all occurrences of the search query in the history file.
+ # Escape and join query parts with wildcard character '*' as seperator
+ # `(j:CHAR:)` join array to string with CHAR as seperator
+ #
+ local search_pattern="*${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*"
+
+ #
+ # Find all occurrences of the search pattern in the history file.
#
# (k) returns the "keys" (history index numbers) instead of the values
- # (Oa) reverses the order, because (R) returns results reversed.
+ # (R) returns values in reverse older, so the index of the youngest
+ # matching history entry is at the head of the list.
#
- _history_substring_search_matches=(${(kOa)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)*${_history_substring_search_query_escaped}*]})
+ _history_substring_search_raw_matches=(${(k)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)${search_pattern}]})
+ fi
- #
- # Define the range of values that $_history_substring_search_match_index
- # can take: [0, $_history_substring_search_matches_count_plus].
- #
- _history_substring_search_matches_count=$#_history_substring_search_matches
- _history_substring_search_matches_count_plus=$(( _history_substring_search_matches_count + 1 ))
- _history_substring_search_matches_count_sans=$(( _history_substring_search_matches_count - 1 ))
+ #
+ # In order to stay as responsive as possible, we will process the raw
+ # matches lazily (when the user requests the next match) to choose items
+ # that need to be displayed to the user.
+ # _history_substring_search_raw_match_index holds the index of the last
+ # unprocessed entry in _history_substring_search_raw_matches. Any items
+ # that need to be displayed will be added to
+ # _history_substring_search_matches.
+ #
+ # We use an associative array (_history_substring_search_unique_filter) as
+ # a 'set' data structure to ensure uniqueness of the results if desired.
+ # If an entry (key) is in the set (non-empty value), then we have already
+ # added that entry to _history_substring_search_matches.
+ #
+ _history_substring_search_raw_match_index=0
+ _history_substring_search_matches=()
+ _history_substring_search_unique_filter=()
- #
- # If $_history_substring_search_match_index is equal to
- # $_history_substring_search_matches_count_plus, this indicates that we
- # are beyond the beginning of $_history_substring_search_matches.
- #
- # If $_history_substring_search_match_index is equal to 0, this indicates
- # that we are beyond the end of $_history_substring_search_matches.
- #
- # If we have initially pressed "up" we have to initialize
- # $_history_substring_search_match_index to
- # $_history_substring_search_matches_count_plus so that it will be
- # decreased to $_history_substring_search_matches_count.
- #
- # If we have initially pressed "down" we have to initialize
- # $_history_substring_search_match_index to
- # $_history_substring_search_matches_count so that it will be increased to
- # $_history_substring_search_matches_count_plus.
- #
- if [[ $WIDGET == history-substring-search-down ]]; then
- _history_substring_search_match_index=$_history_substring_search_matches_count
- else
- _history_substring_search_match_index=$_history_substring_search_matches_count_plus
- fi
+ #
+ # If $_history_substring_search_match_index is equal to
+ # $#_history_substring_search_matches + 1, this indicates that we
+ # are beyond the end of $_history_substring_search_matches and that we
+ # have also processed all entries in
+ # _history_substring_search_raw_matches.
+ #
+ # If $#_history_substring_search_match_index is equal to 0, this indicates
+ # that we are beyond the beginning of $_history_substring_search_matches.
+ #
+ # If we have initially pressed "up" we have to initialize
+ # $_history_substring_search_match_index to 0 so that it will be
+ # incremented to 1.
+ #
+ # If we have initially pressed "down" we have to initialize
+ # $_history_substring_search_match_index to 1 so that it will be
+ # decremented to 0.
+ #
+ if [[ $WIDGET == history-substring-search-down ]]; then
+ _history_substring_search_match_index=1
+ else
+ _history_substring_search_match_index=0
fi
}
@@ -255,16 +317,21 @@ _history-substring-search-end() {
_zsh_highlight
# highlight the search query inside the command line
- if [[ -n $_history_substring_search_query_highlight && -n $_history_substring_search_query ]]; then
- #
- # The following expression yields a variable $MBEGIN, which
- # indicates the begin position + 1 of the first occurrence
- # of _history_substring_search_query_escaped in $BUFFER.
- #
- : ${(S)BUFFER##(#m$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)($_history_substring_search_query##)}
- local begin=$(( MBEGIN - 1 ))
- local end=$(( begin + $#_history_substring_search_query ))
- region_highlight+=("$begin $end $_history_substring_search_query_highlight")
+ if [[ -n $_history_substring_search_query_highlight ]]; then
+ # highlight first matching query parts
+ local highlight_start_index=0
+ local highlight_end_index=0
+ local query_part
+ for query_part in $_history_substring_search_query_parts; do
+ local escaped_query_part=${query_part//(#m)[\][()|\\*?#<>~^]/\\$MATCH}
+ # (i) get index of pattern
+ local query_part_match_index="${${BUFFER:$highlight_start_index}[(i)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)${escaped_query_part}]}"
+ if [[ $query_part_match_index -le ${#BUFFER:$highlight_start_index} ]]; then
+ highlight_start_index=$(( $highlight_start_index + $query_part_match_index ))
+ highlight_end_index=$(( $highlight_start_index + ${#query_part} ))
+ region_highlight+=("$(($highlight_start_index - 1)) $(($highlight_end_index - 1)) $_history_substring_search_query_highlight")
+ fi
+ done
fi
# For debugging purposes:
@@ -378,12 +445,143 @@ _history-substring-search-down-history() {
return 1
}
+_history_substring_search_process_raw_matches() {
+ #
+ # Process more outstanding raw matches and append any matches that need to
+ # be displayed to the user to _history_substring_search_matches.
+ # Return whether there were any more results appended.
+ #
+
+ #
+ # While we have more raw matches. Process them to see if there are any more
+ # matches that need to be displayed to the user.
+ #
+ while [[ $_history_substring_search_raw_match_index -lt $#_history_substring_search_raw_matches ]]; do
+ #
+ # Move on to the next raw entry and get its history index.
+ #
+ _history_substring_search_raw_match_index+=1
+ local index=${_history_substring_search_raw_matches[$_history_substring_search_raw_match_index]}
+
+ #
+ # If HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE is set to a non-empty value,
+ # then ensure that only unique matches are presented to the user.
+ # When HIST_IGNORE_ALL_DUPS is set, ZSH already ensures a unique history,
+ # so in this case we do not need to do anything.
+ #
+ if [[ ! -o HIST_IGNORE_ALL_DUPS && -n $HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE ]]; then
+ #
+ # Get the actual history entry at the new index, and check if we have
+ # already added it to _history_substring_search_matches.
+ #
+ local entry=${history[$index]}
+
+ if [[ -z ${_history_substring_search_unique_filter[$entry]} ]]; then
+ #
+ # This is a new unique entry. Add it to the filter and append the
+ # index to _history_substring_search_matches.
+ #
+ _history_substring_search_unique_filter[$entry]=1
+ _history_substring_search_matches+=($index)
+
+ #
+ # Indicate that we did find a match.
+ #
+ return 0
+ fi
+
+ else
+ #
+ # Just append the new history index to the processed matches.
+ #
+ _history_substring_search_matches+=($index)
+
+ #
+ # Indicate that we did find a match.
+ #
+ return 0
+ fi
+
+ done
+
+ #
+ # We are beyond the end of the list of raw matches. Indicate that no
+ # more matches are available.
+ #
+ return 1
+}
+
+_history-substring-search-has-next() {
+ #
+ # Predicate function that returns whether any more older matches are
+ # available.
+ #
+
+ if [[ $_history_substring_search_match_index -lt $#_history_substring_search_matches ]]; then
+ #
+ # We did not reach the end of the processed list, so we do have further
+ # matches.
+ #
+ return 0
+
+ else
+ #
+ # We are at the end of the processed list. Try to process further
+ # unprocessed matches. _history_substring_search_process_raw_matches
+ # returns whether any more matches were available, so just return
+ # that result.
+ #
+ _history_substring_search_process_raw_matches
+ return $?
+ fi
+}
+
+_history-substring-search-has-prev() {
+ #
+ # Predicate function that returns whether any more younger matches are
+ # available.
+ #
+
+ if [[ $_history_substring_search_match_index -gt 1 ]]; then
+ #
+ # We did not reach the beginning of the processed list, so we do have
+ # further matches.
+ #
+ return 0
+
+ else
+ #
+ # We are at the beginning of the processed list. We do not have any more
+ # matches.
+ #
+ return 1
+ fi
+}
+
+_history-substring-search-found() {
+ #
+ # A match is available. The index of the match is held in
+ # $_history_substring_search_match_index
+ #
+ # 1. Make $BUFFER equal to the matching history entry.
+ #
+ # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
+ # to highlight the current buffer.
+ #
+ BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]]
+ _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
+}
+
_history-substring-search-not-found() {
#
- # Nothing matched the search query, so put it back into the $BUFFER while
- # highlighting it accordingly so the user can revise it and search again.
+ # No more matches are available.
+ #
+ # 1. Make $BUFFER equal to $_history_substring_search_query so the user can
+ # revise it and search again.
+ #
+ # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
+ # to highlight the current buffer.
#
- _history_substring_search_old_buffer=$BUFFER
BUFFER=$_history_substring_search_query
_history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
}
@@ -392,91 +590,84 @@ _history-substring-search-up-search() {
_history_substring_search_refresh_display=1
#
- # Highlight matches during history-substring-up-search:
+ # Select history entry during history-substring-down-search:
#
- # The following constants have been initialized in
+ # The following variables have been initialized in
# _history-substring-search-up/down-search():
#
- # $_history_substring_search_matches is the current list of matches
- # $_history_substring_search_matches_count is the current number of matches
- # $_history_substring_search_matches_count_plus is the current number of matches + 1
- # $_history_substring_search_matches_count_sans is the current number of matches - 1
+ # $_history_substring_search_matches is the current list of matches that
+ # need to be displayed to the user.
# $_history_substring_search_match_index is the index of the current match
+ # that is being displayed to the user.
#
# The range of values that $_history_substring_search_match_index can take
- # is: [0, $_history_substring_search_matches_count_plus]. A value of 0
- # indicates that we are beyond the end of
+ # is: [0, $#_history_substring_search_matches + 1]. A value of 0
+ # indicates that we are beyond the beginning of
# $_history_substring_search_matches. A value of
- # $_history_substring_search_matches_count_plus indicates that we are beyond
- # the beginning of $_history_substring_search_matches.
+ # $#_history_substring_search_matches + 1 indicates that we are beyond
+ # the end of $_history_substring_search_matches and that we have also
+ # processed all entries in _history_substring_search_raw_matches.
+ #
+ # If $_history_substring_search_match_index equals
+ # $#_history_substring_search_matches and
+ # $_history_substring_search_raw_match_index is not greater than
+ # $#_history_substring_search_raw_matches, then we need to further process
+ # $_history_substring_search_raw_matches to see if there are any more
+ # entries that need to be displayed to the user.
#
# In _history-substring-search-up-search() the initial value of
- # $_history_substring_search_match_index is
- # $_history_substring_search_matches_count_plus. This value is set in
- # _history-substring-search-begin(). _history-substring-search-up-search()
- # will initially decrease it to $_history_substring_search_matches_count.
+ # $_history_substring_search_match_index is 0. This value is set in
+ # _history-substring-search-begin(). _history-substring-search-up-search()
+ # will initially increment it to 1.
#
- if [[ $_history_substring_search_match_index -ge 2 ]]; then
- #
- # Highlight the next match:
- #
- # 1. Decrease the value of $_history_substring_search_match_index.
- #
- # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
- # to highlight the current buffer.
- #
- (( _history_substring_search_match_index-- ))
- BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]]
- _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
- elif [[ $_history_substring_search_match_index -eq 1 ]]; then
+ if [[ $_history_substring_search_match_index -gt $#_history_substring_search_matches ]]; then
#
- # We will move beyond the end of $_history_substring_search_matches:
+ # We are beyond the end of $_history_substring_search_matches. This
+ # can only happen if we have also exhausted the unprocessed matches in
+ # _history_substring_search_raw_matches.
#
- # 1. Decrease the value of $_history_substring_search_match_index.
- #
- # 2. Save the current buffer in $_history_substring_search_old_buffer,
- # so that it can be retrieved by
- # _history-substring-search-down-search() later.
- #
- # 3. Make $BUFFER equal to $_history_substring_search_query.
- #
- # 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
- # to highlight the current buffer.
- #
- (( _history_substring_search_match_index-- ))
- _history-substring-search-not-found
-
- elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count_plus ]]; then
- #
- # We were beyond the beginning of $_history_substring_search_matches but
- # UP makes us move back to $_history_substring_search_matches:
- #
- # 1. Decrease the value of $_history_substring_search_match_index.
- #
- # 2. Restore $BUFFER from $_history_substring_search_old_buffer.
- #
- # 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
- # to highlight the current buffer.
- #
- (( _history_substring_search_match_index-- ))
- BUFFER=$_history_substring_search_old_buffer
- _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
-
- else
- #
- # We are at the beginning of history and there are no further matches.
+ # 1. Update display to indicate search not found.
#
_history-substring-search-not-found
return
fi
+ if _history-substring-search-has-next; then
+ #
+ # We do have older matches.
+ #
+ # 1. Move index to point to the next match.
+ # 2. Update display to indicate search found.
+ #
+ _history_substring_search_match_index+=1
+ _history-substring-search-found
+
+ else
+ #
+ # We do not have older matches.
+ #
+ # 1. Move the index beyond the end of
+ # _history_substring_search_matches.
+ # 2. Update display to indicate search not found.
+ #
+ _history_substring_search_match_index+=1
+ _history-substring-search-not-found
+ fi
+
#
# When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from
# history should be matched, make sure the new and old results are different.
- # But when HIST_IGNORE_ALL_DUPS is set, ZSH already ensures a unique history.
#
- if [[ ! -o HIST_IGNORE_ALL_DUPS && -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then
+ # However, if the HIST_IGNORE_ALL_DUPS shell option, or
+ # HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE is set, then we already have a
+ # unique history, so in this case we do not need to do anything.
+ #
+ if [[ -o HIST_IGNORE_ALL_DUPS || -n $HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE ]]; then
+ return
+ fi
+
+ if [[ -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then
#
# Repeat the current search so that a different (unique) match is found.
#
@@ -488,92 +679,75 @@ _history-substring-search-down-search() {
_history_substring_search_refresh_display=1
#
- # Highlight matches during history-substring-up-search:
+ # Select history entry during history-substring-down-search:
#
- # The following constants have been initialized in
+ # The following variables have been initialized in
# _history-substring-search-up/down-search():
#
- # $_history_substring_search_matches is the current list of matches
- # $_history_substring_search_matches_count is the current number of matches
- # $_history_substring_search_matches_count_plus is the current number of matches + 1
- # $_history_substring_search_matches_count_sans is the current number of matches - 1
+ # $_history_substring_search_matches is the current list of matches that
+ # need to be displayed to the user.
# $_history_substring_search_match_index is the index of the current match
+ # that is being displayed to the user.
#
# The range of values that $_history_substring_search_match_index can take
- # is: [0, $_history_substring_search_matches_count_plus]. A value of 0
- # indicates that we are beyond the end of
+ # is: [0, $#_history_substring_search_matches + 1]. A value of 0
+ # indicates that we are beyond the beginning of
# $_history_substring_search_matches. A value of
- # $_history_substring_search_matches_count_plus indicates that we are beyond
- # the beginning of $_history_substring_search_matches.
+ # $#_history_substring_search_matches + 1 indicates that we are beyond
+ # the end of $_history_substring_search_matches and that we have also
+ # processed all entries in _history_substring_search_raw_matches.
#
# In _history-substring-search-down-search() the initial value of
- # $_history_substring_search_match_index is
- # $_history_substring_search_matches_count. This value is set in
- # _history-substring-search-begin().
- # _history-substring-search-down-search() will initially increase it to
- # $_history_substring_search_matches_count_plus.
+ # $_history_substring_search_match_index is 1. This value is set in
+ # _history-substring-search-begin(). _history-substring-search-down-search()
+ # will initially decrement it to 0.
#
- if [[ $_history_substring_search_match_index -le $_history_substring_search_matches_count_sans ]]; then
- #
- # Highlight the next match:
- #
- # 1. Increase $_history_substring_search_match_index by 1.
- #
- # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
- # to highlight the current buffer.
- #
- (( _history_substring_search_match_index++ ))
- BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]]
- _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
- elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count ]]; then
+ if [[ $_history_substring_search_match_index -lt 1 ]]; then
#
- # We will move beyond the beginning of $_history_substring_search_matches:
+ # We are beyond the beginning of $_history_substring_search_matches.
#
- # 1. Increase $_history_substring_search_match_index by 1.
- #
- # 2. Save the current buffer in $_history_substring_search_old_buffer, so
- # that it can be retrieved by _history-substring-search-up-search()
- # later.
- #
- # 3. Make $BUFFER equal to $_history_substring_search_query.
- #
- # 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
- # to highlight the current buffer.
- #
- (( _history_substring_search_match_index++ ))
- _history-substring-search-not-found
-
- elif [[ $_history_substring_search_match_index -eq 0 ]]; then
- #
- # We were beyond the end of $_history_substring_search_matches but DOWN
- # makes us move back to the $_history_substring_search_matches:
- #
- # 1. Increase $_history_substring_search_match_index by 1.
- #
- # 2. Restore $BUFFER from $_history_substring_search_old_buffer.
- #
- # 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
- # to highlight the current buffer.
- #
- (( _history_substring_search_match_index++ ))
- BUFFER=$_history_substring_search_old_buffer
- _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
-
- else
- #
- # We are at the end of history and there are no further matches.
+ # 1. Update display to indicate search not found.
#
_history-substring-search-not-found
return
fi
+ if _history-substring-search-has-prev; then
+ #
+ # We do have younger matches.
+ #
+ # 1. Move index to point to the previous match.
+ # 2. Update display to indicate search found.
+ #
+ _history_substring_search_match_index+=-1
+ _history-substring-search-found
+
+ else
+ #
+ # We do not have younger matches.
+ #
+ # 1. Move the index beyond the beginning of
+ # _history_substring_search_matches.
+ # 2. Update display to indicate search not found.
+ #
+ _history_substring_search_match_index+=-1
+ _history-substring-search-not-found
+ fi
+
#
# When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from
# history should be matched, make sure the new and old results are different.
- # But when HIST_IGNORE_ALL_DUPS is set, ZSH already ensures a unique history.
#
- if [[ ! -o HIST_IGNORE_ALL_DUPS && -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then
+ # However, if the HIST_IGNORE_ALL_DUPS shell option, or
+ # HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE is set, then we already have a
+ # unique history, so in this case we do not need to do anything.
+ #
+ if [[ -o HIST_IGNORE_ALL_DUPS || -n $HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE ]]; then
+ return
+ fi
+
+ if [[ -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then
#
# Repeat the current search so that a different (unique) match is found.
#
diff --git a/zsh/plugins/history/README.md b/zsh/plugins/history/README.md
index dd92868..a9d480f 100644
--- a/zsh/plugins/history/README.md
+++ b/zsh/plugins/history/README.md
@@ -1,15 +1,17 @@
-## history
+# history plugin
Provides a couple of convenient aliases for using the `history` command to examine your command line history.
-### Requirements
+To use it, add `history` to the plugins array in your zshrc file:
-* None.
+```zsh
+plugins=(... history)
+```
-### Usage
+## Aliases
-* If `h` is called, your command history is listed. Equivalent to using `history`
-
-* If `hsi` is called with an argument, a **case insensitive** `grep` search is performed on your command history, looking for commands that match the argument provided
-
-* If `hsi` is called without an argument you will help on `grep` arguments
\ No newline at end of file
+| Alias | Command | Description |
+|-------|----------------------|------------------------------------------------------------------|
+| `h` | `history` | Prints your command history |
+| `hs` | `history \| grep` | Use grep to search your command history |
+| `hsi` | `history \| grep -i` | Use grep to do a case-insensitive search of your command history |
diff --git a/zsh/plugins/history/history.plugin.zsh b/zsh/plugins/history/history.plugin.zsh
index 0f4aa4b..9cee48f 100644
--- a/zsh/plugins/history/history.plugin.zsh
+++ b/zsh/plugins/history/history.plugin.zsh
@@ -1,8 +1,3 @@
alias h='history'
-
-function hs
-{
- history | grep $*
-}
-
-alias hsi='hs -i'
+alias hs='history | grep'
+alias hsi='history | grep -i'
diff --git a/zsh/plugins/hitokoto/README.md b/zsh/plugins/hitokoto/README.md
new file mode 100644
index 0000000..3a8758f
--- /dev/null
+++ b/zsh/plugins/hitokoto/README.md
@@ -0,0 +1,15 @@
+# hitokoto plugin
+
+Displays a random quote taken from [hitokoto.cn](https://v1.hitokoto.cn/)
+
+Created by [Sinrimin](https://github.com/sinrimin)
+
+## Usage
+
+Add the plugin to the plugins array in your zshrc file and restart zsh:
+
+```zsh
+plugins=(... hitokoto)
+```
+
+Then, run `hitokoto` to get a new random quote.
diff --git a/zsh/plugins/hitokoto/hitokoto.plugin.zsh b/zsh/plugins/hitokoto/hitokoto.plugin.zsh
new file mode 100644
index 0000000..8646ebf
--- /dev/null
+++ b/zsh/plugins/hitokoto/hitokoto.plugin.zsh
@@ -0,0 +1,14 @@
+if ! (( $+commands[curl] )); then
+ echo "hitokoto plugin needs curl to work" >&2
+ return
+fi
+
+function hitokoto {
+ emulate -L zsh
+ Q=$(curl -s --connect-timeout 2 "https://v1.hitokoto.cn" | jq -j '.hitokoto+"\t"+.from')
+
+ TXT=$(echo "$Q" | awk -F '\t' '{print $1}')
+ WHO=$(echo "$Q" | awk -F '\t' '{print $2}')
+
+ [[ -n "$WHO" && -n "$TXT" ]] && print -P "%F{3}${WHO}%f: “%F{5}${TXT}%f”"
+}
diff --git a/zsh/plugins/httpie/README.md b/zsh/plugins/httpie/README.md
index f22d3a6..40d60c4 100644
--- a/zsh/plugins/httpie/README.md
+++ b/zsh/plugins/httpie/README.md
@@ -11,5 +11,10 @@ plugins=(... httpie)
It uses completion from [zsh-completions](https://github.com/zsh-users/zsh-completions).
+## Aliases
+
+| Alias | Command |
+| ------------ | ---------------------------------------------------------------- |
+| `https` | `http --default-scheme=https` |
**Maintainer:** [lululau](https://github.com/lululau)
diff --git a/zsh/plugins/httpie/httpie.plugin.zsh b/zsh/plugins/httpie/httpie.plugin.zsh
new file mode 100644
index 0000000..088a1f1
--- /dev/null
+++ b/zsh/plugins/httpie/httpie.plugin.zsh
@@ -0,0 +1,7 @@
+#
+# Aliases
+# (sorted alphabetically)
+#
+
+alias https='http --default-scheme=https'
+
diff --git a/zsh/plugins/ionic/README.md b/zsh/plugins/ionic/README.md
new file mode 100644
index 0000000..3ec4fc8
--- /dev/null
+++ b/zsh/plugins/ionic/README.md
@@ -0,0 +1,30 @@
+# Ionic plugin
+
+This plugin adds completion for the [Ionic CLI](https://ionicframework.com/docs/cli),
+as well as some aliases for common Ionic commands.
+
+To use it, add `ionic` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... ionic)
+```
+
+## Aliases
+
+| Alias | Command | Description |
+|-------|--------------------------------------|------------------------------------------------------------------|
+| iv | `ionic --version` | Check Ionic version |
+| ih | `ionic --help` | Ionic help command |
+| ist | `ionic start` | Create a new project |
+| ii | `ionic info` | Print system/environment info |
+| is | `ionic serve` | Start a local dev server for app dev/testing |
+| icba | `ionic cordova build android` | Build web assets and prepare app for android platform targets |
+| icbi | `ionic cordova build ios` | Build web assets and prepare app for ios platform targets |
+| icra | `ionic cordova run android` | Run an Ionic project on a connected android device |
+| icri | `ionic cordova run ios` | Run an Ionic project on a connected ios device |
+| icrsa | `ionic cordova resources android` | Automatically create icon and splash screen resources for android|
+| icrsi | `ionic cordova resources ios` | Automatically create icon and splash screen resources for ios |
+| icpaa | `ionic cordova platform add android` | Add Cordova android platform targets |
+| icpai | `ionic cordova platform add ios` | Add Cordova ios platform targets |
+| icpra | `ionic cordova platform rm android` | Remove Cordova platform targets |
+| icpri | `ionic cordova platform rm ios` | Remove Cordova platform targets |
diff --git a/zsh/plugins/ionic/ionic.plugin.zsh b/zsh/plugins/ionic/ionic.plugin.zsh
new file mode 100644
index 0000000..cf388af
--- /dev/null
+++ b/zsh/plugins/ionic/ionic.plugin.zsh
@@ -0,0 +1,15 @@
+alias iv="ionic --version"
+alias ih="ionic --help"
+alias ist="ionic start"
+alias ii="ionic info"
+alias is="ionic serve"
+alias icba="ionic cordova build android"
+alias icbi="ionic cordova build ios"
+alias icra="ionic cordova run android"
+alias icri="ionic cordova run ios"
+alias icrsa="ionic cordova resources android"
+alias icrsi="ionic cordova resources ios"
+alias icpaa="ionic cordova platform add android"
+alias icpai="ionic cordova platform add ios"
+alias icpra="ionic cordova platform rm android"
+alias icpri="ionic cordova platform rm ios"
diff --git a/zsh/plugins/ipfs/LICENSE b/zsh/plugins/ipfs/LICENSE
new file mode 100644
index 0000000..cf84491
--- /dev/null
+++ b/zsh/plugins/ipfs/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Angel Ramboi
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+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 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.
+
diff --git a/zsh/plugins/ipfs/README.md b/zsh/plugins/ipfs/README.md
new file mode 100644
index 0000000..0808a26
--- /dev/null
+++ b/zsh/plugins/ipfs/README.md
@@ -0,0 +1,17 @@
+# zsh-ipfs
+
+zsh completion plugin for [The InterPlanetary File System (IPFS)][1]
+
+Please submit issues and pull requests to the [main zsh-ipfs repo][2].
+
+### About
+
+[IPFS (InterPlanetary File System)][1] is a peer-to-peer hypermedia protocol
+designed to make the web faster, safer, and more open.
+
+### License
+
+See: https://github.com/hellounicorn/zsh-ipfs/blob/master/LICENSE
+
+[1]: http://ipfs.io/
+[2]: https://github.com/hellounicorn/zsh-ipfs
diff --git a/zsh/plugins/ipfs/_ipfs b/zsh/plugins/ipfs/_ipfs
new file mode 100644
index 0000000..9ee8bd7
--- /dev/null
+++ b/zsh/plugins/ipfs/_ipfs
@@ -0,0 +1,717 @@
+#compdef ipfs
+#autoload
+
+local -a _1st_arguments
+_1st_arguments=(
+ 'add:Add a file or directory to ipfs.'
+ 'bitswap:Interact with the bitswap agent.'
+ 'block:Interact with raw IPFS blocks.'
+ 'bootstrap:Show or edit the list of bootstrap peers.'
+ 'cat:Show IPFS object data.'
+ 'cid:Convert and discover properties of CIDs'
+ 'commands:List all available commands.'
+ 'config:Get and set ipfs config values.'
+ 'daemon:Run a network-connected IPFS node.'
+ 'dag:Interact with ipld dag objects. (experimental)'
+ 'dht:Issue commands directly through the DHT.'
+ 'diag:Generate diagnostic reports.'
+ 'dns:Resolve DNS links.'
+ 'files:Interact with unixfs files.'
+ 'filestore:Interact with filestore objects. (experimental)'
+ 'get:Download IPFS objects.'
+ 'id:Show ipfs node id info.'
+ 'init:Initializes ipfs config file.'
+ 'key:Create and list IPNS name keypairs.'
+ 'log:Interact with the daemon log output.'
+ 'ls:List directory contents for Unix filesystem objects.'
+ 'mount:Mounts IPFS to the filesystem (read-only).'
+ 'name:Publish and resolve IPNS names.'
+ 'object:Interact with IPFS objects.'
+ 'p2p:Libp2p stream mounting.'
+ 'pin:Pin (and unpin) objects to local storage.'
+ 'ping:Send echo request packets to IPFS hosts.'
+ 'refs:List links (references) from an object.'
+ 'repo:Manipulate the IPFS repo.'
+ 'resolve:Resolve the value of names to IPFS.'
+ 'stats:Query IPFS statistics.'
+ 'swarm:Interact with the swarm.'
+ 'tar:Utility functions for tar files in ipfs.'
+ 'update:Download and apply go-ipfs updates'
+ 'version:Show ipfs version information.'
+)
+
+_ipfs_subcommand(){
+ local curcontext="$curcontext" state line
+ typeset -A opt_args
+ _arguments -C ':command:->command' '*::options:->options'
+ case $state in
+ (command)
+ _describe -t commands "ipfs subcommand" $1
+ return
+ ;;
+ (options)
+ case $line[1] in
+ (wantlist)
+ case $MAIN_SUBCOMMAND in
+ (bitswap)
+ _arguments '(-p --peer)'{-p,--peer}'[Specify which peer to show wantlist for. Default: self.]'
+ ;;
+ esac
+ ;;
+ (add)
+ case $MAIN_SUBCOMMAND in
+ (pin)
+ _arguments \
+ '(-r --recursive)'{-r,--recursive}'[Recursively pin the object linked to by the specified object(s). Default: true.]' \
+ '--progress[Show progress.]'
+ ;;
+ (bootstrap)
+ local -a _bootstrap_rm_arguments
+ _bootstrap_rm_arguments=(
+ 'default:Add default peers to the bootstrap list.'
+ )
+ _ipfs_subcommand _bootstrap_rm_arguments
+ ;;
+ esac
+ ;;
+ (rm)
+ case $MAIN_SUBCOMMAND in
+ (pin)
+ _arguments '(-r --recursive)'{-r,--recursive}'[Recursively unpin the object linked to by the specified object(s). Default: true.]'
+ ;;
+ (bootstrap)
+ local -a _bootstrap_rm_arguments
+ _bootstrap_rm_arguments=(
+ 'all:Remove all peers from the bootstrap list.'
+ )
+ _ipfs_subcommand _bootstrap_rm_arguments
+ ;;
+ esac
+ ;;
+ (ls)
+ case $MAIN_SUBCOMMAND in
+ (pin)
+ _arguments \
+ '(-t --type)'{-t,--type}'[The type of pinned keys to list. Can be "direct", "indirect", "recursive", or "all". Default: all.]' \
+ '(-q --quiet)'{-q,--quiet}'[Write just hashes of objects.]'
+ ;;
+ (p2p)
+ _arguments '(-v --headers)'{-v,--headers}'[Print table headers (Protocol, Listen, Target).]'
+ ;;
+ esac
+ ;;
+ (update)
+ case $MAIN_SUBCOMMAND in
+ (pin)
+ _arguments '--unpin[Remove the old pin. Default: true.]'
+ ;;
+ esac
+ ;;
+ (verify)
+ case $MAIN_SUBCOMMAND in
+ (pin)
+ _arguments \
+ '--verbose[Also write the hashes of non-broken pins.]' \
+ '(-q --quiet)'{-q,--quiet}'[Write just hashes of broken pins.]'
+ ;;
+ esac
+ ;;
+ (get|query|findpeer)
+ case $MAIN_SUBCOMMAND in
+ (dht)
+ _arguments '(-v --verbose)'{-v,--verbose}'[Print extra information.]'
+ ;;
+ (object)
+ _arguments '--data-encoding[Encoding type of the data field, either "text" or "base64". Default: text.]'
+ ;;
+ esac
+ ;;
+ (put)
+ case $MAIN_SUBCOMMAND in
+ (dht)
+ _arguments '(-v --verbose)'{-v,--verbose}'[Print extra information.]'
+ ;;
+ (object)
+ _arguments \
+ '--inputenc[Encoding type of input data. One of: {"protobuf", "json"}. Default: json.]' \
+ '--datafieldenc[Encoding type of the data field, either "text" or "base64". Default: text.]' \
+ '--pin[Pin this object when adding.]' \
+ '(-q --quiet)'{-q,--quiet}'[Write minimal output]'
+ ;;
+ esac
+ ;;
+ (findprovs)
+ case $MAIN_SUBCOMMAND in
+ (dht)
+ _arguments \
+ '(-v --verbose)'{-v,--verbose}'[Print extra information.]' \
+ '(-n --num-providers)'{-n,--num-providers}'[The number of providers to find. Default: 20.]'
+ ;;
+ esac
+ ;;
+ (provide)
+ case $MAIN_SUBCOMMAND in
+ (dht)
+ _arguments \
+ '(-v --verbose)'{-v,--verbose}'[Print extra information.]' \
+ '(-r --recursive)'{-r,--recursive}'[Recursively provide entire graph.]'
+ ;;
+ esac
+ ;;
+ (cmds|diff)
+ case $MAIN_SUBCOMMAND in
+ (diag|object)
+ _arguments '(-v --verbose)'{-v,--verbose}'[Print extra information.]'
+ ;;
+ esac
+ ;;
+ (stat)
+ case $MAIN_SUBCOMMAND in
+ (object)
+ _arguments '--human[Print sizes in human readable format (e.g., 1K 234M 2G).]'
+ ;;
+ (repo)
+ _arguments \
+ '--size-only[Only report RepoSize and StorageMax.]' \
+ '--human[Print sizes in human readable format (e.g., 1K 234M 2G).]'
+ ;;
+ esac
+ ;;
+ (publish)
+ case $MAIN_SUBCOMMAND in
+ (name)
+ _arguments \
+ '--resolve[Check if the given path can be resolved before publishing. Default: true.]' \
+ '(-t --lifetime)'{-t,--lifetime}'[Time duration that the record will be valid for. Default: 24h.]' \
+ '--allow-offline[When offline, save the IPNS record to the the local datastore without broadcasting to the network instead of simply failing.]' \
+ '--ttl[Time duration this record should be cached for. Uses the same syntax as the lifetime option. (caution: experimental).]' \
+ '(-k --key)'{-k,--key}"[Name of the key to be used or a valid PeerID, as listed by 'ipfs key list -l'. Default: self.]" \
+ '(-Q --quieter)'{-Q,--quieter}'[Write only final hash.]'
+ ;;
+ esac
+ ;;
+ (pubsub)
+ case $MAIN_SUBCOMMAND in
+ (name)
+ local -a _name_pubsub_arguments
+ _name_pubsub_arguments=(
+ 'cancel:Cancel a name subscription'
+ 'state:Query the state of IPNS pubsub'
+ 'subs:Show current name subscriptions'
+ )
+ _ipfs_subcommand _name_pubsub_arguments
+ ;;
+ esac
+ ;;
+ (resolve)
+ case $MAIN_SUBCOMMAND in
+ (name)
+ _arguments \
+ '(-r --recursive)'{-r,--recursive}'[Resolve until the result is not an IPNS name. Default: true.]' \
+ '(-n --nocache)'{-n,--nocache}'[Do not use cached entries.]' \
+ '(--dhtrc --dht-record-count)'{--dhtrc,--dht-record-count}'[Number of records to request for DHT resolution.]' \
+ '(--dhtt --dht-timeout)'{--dhtt,--dht-timeout}'[Max time to collect values during DHT resolution eg "30s". Pass 0 for no timeout.]' \
+ '(-s --stream)'{-s,--stream}'[Stream entries as they are found.]'
+ ;;
+ esac
+ ;;
+ (patch)
+ case $MAIN_SUBCOMMAND in
+ (object)
+ local -a _object_patch_arguments
+ _object_patch_arguments=(
+ 'add-link:Add a link to a given object.'
+ 'append-data:Append data to the data segment of a dag node.'
+ 'rm-link:Remove a link from a given object.'
+ 'set-data:Set the data field of an IPFS object.'
+ )
+ _ipfs_subcommand _object_patch_arguments
+ ;;
+ esac
+ ;;
+ (gc)
+ case $MAIN_SUBCOMMAND in
+ (repo)
+ _arguments \
+ '--stream-errors[Stream errors.]' \
+ '(-q --quiet)'{-q,--quiet}'[Write minimal output.]'
+ ;;
+ esac
+ ;;
+ (bitswap)
+ case $MAIN_SUBCOMMAND in
+ (stats)
+ _arguments \
+ '(-v --verbose)'{-v,--verbose}'[Print extra information.]' \
+ '--human[Print sizes in human readable format (e.g., 1K 234M 2G).]'
+ ;;
+ esac
+ ;;
+ (bw)
+ case $MAIN_SUBCOMMAND in
+ (stats)
+ _arguments \
+ '(-p --peer)'{-p,--peer}'[Specify a peer to print bandwidth for.]' \
+ '(-t --proto)'{-t,--proto}'[Specify a protocol to print bandwidth for.]' \
+ '--poll[Print bandwidth at an interval.]' \
+ '(-i --interval)'{-i,--interval}'[Time interval to wait between updating output, if 'poll' is true.]'
+ ;;
+ esac
+ ;;
+ (repo)
+ case $MAIN_SUBCOMMAND in
+ (stats)
+ _arguments \
+ '--size-only[Only report RepoSize and StorageMax.]' \
+ '--human[Print sizes in human readable format (e.g., 1K 234M 2G).]'
+ ;;
+ esac
+ ;;
+ (bases)
+ case $MAIN_SUBCOMMAND in
+ (cid)
+ _arguments \
+ '--prefix[also include the single leter prefixes in addition to the code.]' \
+ '--numeric[also include numeric codes.]'
+ ;;
+ esac
+ ;;
+ (codecs|hashes)
+ case $MAIN_SUBCOMMAND in
+ (cid)
+ _arguments '--numeric[also include numeric codes.]'
+ ;;
+ esac
+ ;;
+ (format)
+ case $MAIN_SUBCOMMAND in
+ (cid)
+ _arguments \
+ '-f[Printf style format string. Default: %s.]' \
+ '-v[CID version to convert to.]' \
+ '-b[Multibase to display CID in.]'
+ ;;
+ esac
+ ;;
+ (close)
+ case $MAIN_SUBCOMMAND in
+ (p2p)
+ _arguments \
+ '(-a --all)'{-a,--all}'[Close all listeners.]' \
+ '(-p --protocol)'{-p,--protocol}'[Match protocol name.]' \
+ '(-l --listen-address)'{-l,--listen-address}'[Match listen address.]' \
+ '(-t --target-address)'{-t,--target-address}'[Match target address.]'
+ ;;
+ esac
+ ;;
+ (forward)
+ case $MAIN_SUBCOMMAND in
+ (p2p)
+ _arguments "--allow-custom-protocol[Don't require /x/ prefix.]"
+ ;;
+ esac
+ ;;
+ (listen)
+ case $MAIN_SUBCOMMAND in
+ (p2p)
+ _arguments \
+ "--allow-custom-protocol[Don't require /x/ prefix.]" \
+ '(-r --report-peer-id)'{-r,--report-peer-id}'[Send remote base58 peerid to target when a new connection is established.]'
+ ;;
+ esac
+ ;;
+ (stream)
+ case $MAIN_SUBCOMMAND in
+ (p2p)
+ local -a _p2p_stream_arguments
+ _p2p_stream_arguments=(
+ 'close:Close active p2p stream.'
+ 'ls:List active p2p streams.'
+ )
+ _ipfs_subcommand _p2p_stream_arguments
+ ;;
+ esac
+ ;;
+ (addrs)
+ case $MAIN_SUBCOMMAND in
+ (swarm)
+ local -a _swarm_addrs_arguments
+ _swarm_addrs_arguments=(
+ 'listen:List interface listening addresses.'
+ 'local:List local addresses.'
+ )
+ _ipfs_subcommand _swarm_addrs_arguments
+ ;;
+ esac
+ ;;
+ (filters)
+ case $MAIN_SUBCOMMAND in
+ (swarm)
+ local -a _swarm_filters_arguments
+ _swarm_filters_arguments=(
+ 'add:Add an address filter.'
+ 'rm:Remove an address filter.'
+ )
+ _ipfs_subcommand _swarm_filters_arguments
+ ;;
+ esac
+ ;;
+ (peers)
+ case $MAIN_SUBCOMMAND in
+ (swarm)
+ _arguments \
+ '(-v --verbose)'{-v,--verbose}'[display all extra information.]' \
+ '--streams[Also list information about open streams for each peer.]' \
+ '--latency[Also list information about latency to each peer.]' \
+ '--direction[Also list information about the direction of connection.]'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+}
+
+local expl
+
+_arguments \
+ '(-c --config)'{-c,--config}'[Path to the configuration file to use.]' \
+ '(-D --debug)'{-D,--debug}'[Operate in debug mode.]' \
+ '(--help)--help[Show the full command help text.]' \
+ '(--h)-h[Show a short version of the command help text.]' \
+ '(-L --local)'{-L,--local}'[Run the command locally, instead of using the daemon. DEPRECATED: use --offline.]' \
+ '(--offline)--offline[Run the command offline.]' \
+ '(--api)--api[Use a specific API instance (defaults to /ip4/127.0.0.1/tcp/5001).]' \
+ '(--cid-base)--cid-base[Multibase encoding used for version 1 CIDs in output.]' \
+ '(--upgrade-cidv0-in-output)--upgrade-cidv0-in-output[Upgrade version 0 to version 1 CIDs in output.]' \
+ '(--enc --encoding)'{--enc,--encoding}'[The encoding type the output should be encoded with (json, xml, or text). Default: text.]' \
+ '(--stream-channels)--stream-channels[Stream channel output.]' \
+ '(--timeout)--timeout[Set a global timeout on the command.]' \
+ '*:: :->subcmds' && return 0
+
+if (( CURRENT == 1 )); then
+ _describe -t commands "ipfs subcommand" _1st_arguments
+ return
+fi
+
+MAIN_SUBCOMMAND="$words[1]"
+case $MAIN_SUBCOMMAND in
+ (add)
+ _arguments \
+ '(-r --recursive)'{-r,--recursive}'[Add directory paths recursively.]' \
+ '(--dereference-args)--dereference-args[Symlinks supplied in arguments are dereferenced.]' \
+ '(--stdin-name)--stdin-name[Assign a name if the file source is stdin.]' \
+ '(-H --hidden)'{-H,--hidden}'[Include files that are hidden. Only takes effect on recursive add.]' \
+ '(-q --quiet)'{-q,--quiet}'[Write minimal output.]' \
+ '(-Q --quieter)'{-Q,--quieter}'[Write only final hash.]' \
+ '(--silent)--silent[Write no output.]' \
+ '(-p --progress)'{-p,--progress}'[Stream progress data.]' \
+ '(-t --trickle)'{-t,--trickle}'[Use trickle-dag format for dag generation.]' \
+ '(-n --only-hash)'{-n,--only-hash}'[Only chunk and hash - do not write to disk.]' \
+ '(-w --wrap-with-directory)'{-w,--wrap-with-directory}'[Wrap files with a directory object.]' \
+ '(-s --chunker)'{-s,--chunker}'[Chunking algorithm, size-(bytes) or rabin-(min)-(avg)-(max). Default: size-262144.]' \
+ '(--pin)--pin[Pin this object when adding. Default: true.]' \
+ '(--raw-leaves)--raw-leaves[Use raw blocks for leaf nodes. (experimental).]' \
+ '(--nocopy)--nocopy[Add the file using filestore. Implies raw-leaves. (experimental).]' \
+ '(--fscache)--fscache[Check the filestore for pre-existing blocks. (experimental).]' \
+ '(--cid-version)--cid-version[CID version. Defaults to 0 unless an option that depends on CIDv1 is passed. (experimental).]' \
+ '(--hash)--hash[Hash function to use. Implies CIDv1 if not sha2-256. (experimental). Default: sha2-256.]' \
+ '(--inline)--inline[Inline small blocks into CIDs. (experimental).]' \
+ '(--inline-limit)--inline-limit[Maximum block size to inline. (experimental). Default: 32.]'
+ ;;
+ (bitswap)
+ local -a _bitswap_arguments
+ _bitswap_arguments=(
+ 'ledger:Show the current ledger for a peer.'
+ 'reprovide:Trigger reprovider.'
+ 'stat:Show some diagnostic information on the bitswap agent.'
+ 'wantlist:Show blocks currently on the wantlist.'
+ )
+ _ipfs_subcommand _bitswap_arguments
+ ;;
+ (block)
+ local -a _block_arguments
+ _block_arguments=(
+ 'get:Get a raw IPFS block.'
+ 'put:Store input as an IPFS block.'
+ 'rm:Remove IPFS block(s).'
+ 'stat:Print information of a raw IPFS block.'
+ )
+ _ipfs_subcommand _block_arguments
+ ;;
+ (bootstrap)
+ local -a _bootstrap_arguments
+ _bootstrap_arguments=(
+ 'add:Add peers to the bootstrap list.'
+ 'list:Show peers in the bootstrap list.'
+ 'rm:Remove peers from the bootstrap list.'
+ )
+ _ipfs_subcommand _bootstrap_arguments
+ ;;
+ (cat)
+ _arguments \
+ '(-o --offset)'{-o,--offset}'[Byte offset to begin reading from.]' \
+ '(-l --length)'{-l,--length}'[Maximum number of bytes to read.]'
+ ;;
+ (cid)
+ local -a _cid_arguments
+ _cid_arguments=(
+ 'base32:Convert CIDs to Base32 CID version 1.'
+ 'bases:List available multibase encodings.'
+ 'codecs:List available CID codecs.'
+ 'format:Format and convert a CID in various useful ways.'
+ 'hashes:List available multihashes.'
+ )
+ _ipfs_subcommand _cid_arguments
+ ;;
+ (commands)
+ _arguments '(-f --flags)'{-f,--flags}'[Show command flags.]'
+ ;;
+ (config)
+ _arguments \
+ '--bool[Set a boolean value.]' \
+ '--json[Parse stringified JSON.]'
+ local -a _config_arguments
+ _config_arguments=(
+ 'edit:Open the config file for editing in $EDITOR.'
+ 'profile:Apply profiles to config.'
+ 'replace:Replace the config with .'
+ 'show:Output config file contents.'
+ )
+ _ipfs_subcommand _config_arguments
+ ;;
+ (daemon)
+ _arguments \
+ '--init[Initialize ipfs with default settings if not already initialized.]' \
+ '--init-profile[Configuration profiles to apply for --init. See ipfs init --help for more.]' \
+ '--routing[Overrides the routing option. Default: default.]' \
+ '--mount[Mounts IPFS to the filesystem.]' \
+ '--writable[Enable writing objects (with POST, PUT and DELETE).]' \
+ '--mount-ipfs[Path to the mountpoint for IPFS (if using --mount). Defaults to config setting.]' \
+ '--mount-ipns[Path to the mountpoint for IPNS (if using --mount). Defaults to config setting.]' \
+ '--unrestricted-api[Allow API access to unlisted hashes.]' \
+ '--disable-transport-encryption[Disable transport encryption (for debugging protocols).]' \
+ '--enable-gc[Enable automatic periodic repo garbage collection.]' \
+ '--manage-fdlimit[Check and raise file descriptor limits if needed. Default: true.]' \
+ '--migrate[If true, assume yes at the migrate prompt. If false, assume no.]' \
+ '--enable-pubsub-experiment[Instantiate the ipfs daemon with the experimental pubsub feature enabled.]' \
+ '--enable-namesys-pubsub[Enable IPNS record distribution through pubsub; enables pubsub.]' \
+ '--enable-mplex-experiment[Add the experimental 'go-multiplex' stream muxer to libp2p on construction. Default: true.]'
+ ;;
+ (dag)
+ local -a _dag_arguments
+ _dag_arguments=(
+ 'get:Get a dag node from ipfs.'
+ 'put:Add a dag node to ipfs.'
+ 'resolve:Resolve ipld block.'
+ )
+ _ipfs_subcommand _dag_arguments
+ ;;
+ (dht)
+ local -a _dht_arguments
+ _dht_arguments=(
+ 'findpeer:Find the multiaddresses associated with a Peer ID.'
+ 'findprovs:Find peers that can provide a specific value, given a key.'
+ 'get:Given a key, query the routing system for its best value.'
+ 'provide:Announce to the network that you are providing given values.'
+ 'put:Write a key/value pair to the routing system.'
+ 'query:Find the closest Peer IDs to a given Peer ID by querying the DHT.'
+ )
+ _ipfs_subcommand _dht_arguments
+ ;;
+ (diag)
+ local -a _diag_arguments
+ _diag_arguments=(
+ 'cmds:List commands run on this IPFS node.'
+ 'sys:Print system diagnostic information.'
+ )
+ _ipfs_subcommand _diag_arguments
+ ;;
+ (dns)
+ _arguments '(-r --recursive)'{-r,--recursive}'[Resolve until the result is not a DNS link. Default: true.]'
+ ;;
+ (files)
+ _arguments '(-f --flush)'{-f,--flush}'[Flush target and ancestors after write. Default: true.]'
+ local -a _files_arguments
+ _files_arguments=(
+ 'chcid:Change the cid version or hash function of the root node of a given path.'
+ 'cp:Copy files into mfs.'
+ "flush:Flush a given path's data to disk."
+ 'ls:List directories in the local mutable namespace.'
+ 'mkdir:Make directories.'
+ 'mv:Move files.'
+ 'read:Read a file in a given mfs.'
+ 'rm:Remove a file.'
+ 'stat:Display file status.'
+ 'write:Write to a mutable file in a given filesystem.'
+ )
+ _ipfs_subcommand _files_arguments
+ ;;
+ (filestore)
+ local -a _filestore_arguments
+ _filestore_arguments=(
+ 'dups:List blocks that are both in the filestore and standard block storage.'
+ 'ls:List objects in filestore.'
+ 'verify:Verify objects in filestore.'
+ )
+ _ipfs_subcommand _filestore_arguments
+ ;;
+ (get)
+ _arguments \
+ '(-o --output)'{-o,--output}'[The path where the output should be stored.]'\
+ '(-a --archive)'{-a,--archive}'[Output a TAR archive.]' \
+ '(-C --compress)'{-C,--compress}'[Compress the output with GZIP compression.]' \
+ '(-l --compression-level)'{-l,--compression-level}'[The level of compression (1-9).]'
+ ;;
+ (id)
+ _arguments '(-f --format)'{-f,--format}'[Optional output format.]'
+ ;;
+ (init)
+ _arguments \
+ '(-b --bits)'{-b,--bits}'[Number of bits to use in the generated RSA private key. Default: 2048.]' \
+ '(-e --empty-repo)'{-e,--empty-repo}"[Don't add and pin help files to the local storage.]" \
+ '(-p --profile)'{-p,--profile}"[Apply profile settings to config. Multiple profiles can be separated by ','.]"
+ ;;
+ (key)
+ local -a _key_arguments
+ _key_arguments=(
+ 'gen:Create a new keypair'
+ 'list:List all local keypairs'
+ 'rename:Rename a keypair'
+ 'rm:Remove a keypair'
+ )
+ _ipfs_subcommand _key_arguments
+ ;;
+ (log)
+ local -a _log_arguments
+ _log_arguments=(
+ 'level:Change the logging level.'
+ 'ls:List the logging subsystems.'
+ 'tail:Read the event log.'
+ )
+ _ipfs_subcommand _log_arguments
+ ;;
+ (ls)
+ _arguments \
+ '(-v --headers)'{-v,--headers}'[Print table headers (Hash, Size, Name).]' \
+ '--resolve-type[Resolve linked objects to find out their types. Default: true.]' \
+ '--size[Resolve linked objects to find out their file size. Default: true.]' \
+ '(-s --stream)'{-s,--stream}'[Enable exprimental streaming of directory entries as they are traversed.]' \
+ ;;
+ (mount)
+ _arguments \
+ '(-f --ipfs-path)'{-f,--ipfs-path}'[The path where IPFS should be mounted.]' \
+ '(-n --ipns-path)'{-n,--ipns-path}'[The path where IPNS should be mounted.]'
+ ;;
+ (name)
+ local -a _name_arguments
+ _name_arguments=(
+ 'publish:Publish IPNS names.'
+ 'pubsub:IPNS pubsub management.'
+ 'resolve:Resolve IPNS names.'
+ )
+ _ipfs_subcommand _name_arguments
+ ;;
+ (object)
+ local -a _object_arguments
+ _object_arguments=(
+ 'data:Output the raw bytes of an IPFS object.'
+ 'diff:Display the diff between two ipfs objects.'
+ 'get:Get and serialize the DAG node named by .'
+ 'links:Output the links pointed to by the specified object.'
+ 'new:Create a new object from an ipfs template.'
+ 'patch:Create a new merkledag object based on an existing one.'
+ 'put:Store input as a DAG object, print its key.'
+ 'stat:Get stats for the DAG node named by .'
+ )
+ _ipfs_subcommand _object_arguments
+ ;;
+ (p2p)
+ local -a _p2p_arguments
+ _p2p_arguments=(
+ 'close:Stop listening for new connections to forward.'
+ 'forward:Forward connections to libp2p service'
+ 'listen:Create libp2p service'
+ 'ls:List active p2p listeners.'
+ 'stream:P2P stream management.'
+ )
+ _ipfs_subcommand _p2p_arguments
+ ;;
+ (pin)
+ local -a _pin_arguments
+ _pin_arguments=(
+ 'add:Pin objects to local storage.'
+ 'ls:List objects pinned to local storage.'
+ 'rm:Remove pinned objects from local storage.'
+ 'update:Update a recursive pin'
+ 'verify:Verify that recursive pins are complete.'
+ )
+ _ipfs_subcommand _pin_arguments
+ ;;
+ (ping)
+ _arguments '(-n --count)'{-n,--count}'[Number of ping messages to send. Default: 10.]'
+ ;;
+ (refs)
+ _arguments \
+ '--format[Emit edges with given format. Available tokens: . Default: .]' \
+ '(-e --edges)'{-e,--edges}'[Emit edge format: ` -> `.]' \
+ '(-u --unique)'{-u,--unique}'[Omit duplicate refs from output.]' \
+ '(-r --recursive)'{-r,--recursive}'[Recursively list links of child nodes.]' \
+ '--max-depth[Only for recursive refs, limits fetch and listing to the given depth. Default: -1.]'
+ local -a _refs_arguments
+ _refs_arguments='local:List all local references.'
+ _ipfs_subcommand _refs_arguments
+ ;;
+ (repo)
+ local -a _repo_arguments
+ _repo_arguments=(
+ 'fsck:Remove repo lockfiles.'
+ 'gc:Perform a garbage collection sweep on the repo.'
+ 'stat:Get stats for the currently used repo.'
+ 'verify:Verify all blocks in repo are not corrupted.'
+ 'version:Show the repo version.'
+ )
+ _ipfs_subcommand _repo_arguments
+ ;;
+ (resolve)
+ _arguments \
+ '(-r --recursive)'{-r,--recursive}'[Resolve until the result is an IPFS name. Default: true.]' \
+ '(--dhtrc --dht-record-count)'{--dhtrc,--dht-record-count}'[Number of records to request for DHT resolution.]' \
+ '(--dhtt --dht-timeout)'{--dhtt,--dht-timeout}'[Max time to collect values during DHT resolution eg "30s". Pass 0 for no timeout.]'
+ ;;
+ (stats)
+ local -a _stats_arguments
+ _stats_arguments=(
+ 'bitswap:Show some diagnostic information on the bitswap agent.'
+ 'bw:Print ipfs bandwidth information.'
+ 'repo:Get stats for the currently used repo.'
+ )
+ _ipfs_subcommand _stats_arguments
+ ;;
+ (swarm)
+ local -a _swarm_arguments
+ _swarm_arguments=(
+ 'addrs:List known addresses. Useful for debugging.'
+ 'connect:Open connection to a given address.'
+ 'disconnect:Close connection to a given address.'
+ 'filters:Manipulate address filters.'
+ 'peers:List peers with open connections.'
+ )
+ _ipfs_subcommand _swarm_arguments
+ ;;
+ (tar)
+ local -a _tar_arguments
+ _tar_arguments=(
+ 'add:Import a tar file into ipfs.'
+ 'cat:Export a tar file from IPFS.'
+ )
+ _ipfs_subcommand _tar_arguments
+ ;;
+ (version)
+ _arguments \
+ '(-n --number)'{-n,--number}'[Only show the version number.]' \
+ '--commit[Show the commit hash.]' \
+ '--repo[Show repo version.]' \
+ '--all[Show all version information.]'
+ ;;
+esac
diff --git a/zsh/plugins/jenv/jenv.plugin.zsh b/zsh/plugins/jenv/jenv.plugin.zsh
index 2eda803..946ce18 100644
--- a/zsh/plugins/jenv/jenv.plugin.zsh
+++ b/zsh/plugins/jenv/jenv.plugin.zsh
@@ -1,4 +1,4 @@
-jenvdirs=("$HOME/.jenv" "/usr/local" "/usr/local/jenv" "/opt/jenv")
+jenvdirs=("$HOME/.jenv" "/usr/local/bin/jenv" "/usr/local/jenv" "/opt/jenv")
FOUND_JENV=0
for jenvdir in $jenvdirs; do
@@ -15,7 +15,7 @@ if [[ $FOUND_JENV -eq 0 ]]; then
fi
if [[ $FOUND_JENV -eq 1 ]]; then
- export PATH="${jenvdir}/bin:$PATH"
+ (( $+commands[jenv] )) || export PATH="${jenvdir}/bin:$PATH"
eval "$(jenv init - zsh)"
function jenv_prompt_info() { jenv version-name 2>/dev/null }
diff --git a/zsh/plugins/jfrog/README.md b/zsh/plugins/jfrog/README.md
new file mode 100644
index 0000000..1d85862
--- /dev/null
+++ b/zsh/plugins/jfrog/README.md
@@ -0,0 +1,11 @@
+# JFrog CLI
+
+This plugin provides completion for [JFrog CLI](https://github.com/jfrog/jfrog-cli).
+
+JFrog CLI provides a simple interface that automates access to [Artifactory](https://jfrog.com/artifactory), [Xray](https://jfrog.com/xray), [Bintray](https://jfrog.com/bintray) and [Mission Control](https://jfrog.com/mission-control) through their respective REST APIs.
+
+To use it, add `jfrog` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... jfrog)
+```
diff --git a/zsh/plugins/jfrog/jfrog.plugin.zsh b/zsh/plugins/jfrog/jfrog.plugin.zsh
new file mode 100644
index 0000000..064ffa2
--- /dev/null
+++ b/zsh/plugins/jfrog/jfrog.plugin.zsh
@@ -0,0 +1,10 @@
+_jfrog() {
+ local -a opts
+ opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
+ _describe 'values' opts
+ if [[ $compstate[nmatches] -eq 0 && $words[$CURRENT] != -* ]]; then
+ _files
+ fi
+}
+
+compdef _jfrog jfrog
\ No newline at end of file
diff --git a/zsh/plugins/jhbuild/README.md b/zsh/plugins/jhbuild/README.md
index 9105269..3220e0d 100644
--- a/zsh/plugins/jhbuild/README.md
+++ b/zsh/plugins/jhbuild/README.md
@@ -1,4 +1,34 @@
-## JHBuild
+# JHBuild
+
+This plugin adds some [JHBuild](https://developer.gnome.org/jhbuild/) aliases.
+
+To use it, add `jhbuild` to the plugins array of your zshrc file:
+
+```zsh
+plugins=(... jhbuild)
+```
+
**Maintainer:** [Miguel Vaello](https://github.com/miguxbe)
-This plugin adds some jhbuild aliases and increase the completion function provided by zsh.
+## Aliases
+
+| Alias | Command |
+|---------|---------------------------|
+| `jh` | `jhbuild` |
+| `jhb` | `jhbuild build` |
+| `jhbo` | `jhbuild buildone` |
+| `jhckb` | `jhbuild checkbranches` |
+| `jhckm` | `jhbuild checkmodulesets` |
+| `jhi` | `jhbuild info` |
+| `jhl` | `jhbuild list` |
+| `jhc` | `jhbuild clean` |
+| `jhco` | `jhbuild cleanone` |
+| `jhm` | `jhbuild make` |
+| `jhr` | `jhbuild run` |
+| `jhrd` | `jhbuild rdepends` |
+| `jhsd` | `jhbuild sysdeps` |
+| `jhu` | `jhbuild update` |
+| `jhuo` | `jhbuild updateone` |
+| `jhun` | `jhbuild uninstall` |
+| `jhsh` | `jhbuild shell` |
+| `jht` | `jhbuild tinderbox` |
diff --git a/zsh/plugins/jhbuild/jhbuild.plugin.zsh b/zsh/plugins/jhbuild/jhbuild.plugin.zsh
index fed1bc9..416745d 100644
--- a/zsh/plugins/jhbuild/jhbuild.plugin.zsh
+++ b/zsh/plugins/jhbuild/jhbuild.plugin.zsh
@@ -1,5 +1,6 @@
-# Aliases
-#
+# JHBuild Aliases
+
+# Base
alias jh='jhbuild'
# Build
alias jhb='jhbuild build'
@@ -7,12 +8,14 @@ alias jhbo='jhbuild buildone'
# Checks
alias jhckb='jhbuild checkbranches'
alias jhckm='jhbuild checkmodulesets'
-# Info & list
+# Info & List
alias jhi='jhbuild info'
alias jhl='jhbuild list'
# Clean
alias jhc='jhbuild clean'
alias jhco='jhbuild cleanone'
+# Make
+alias jhm='jhbuild make'
# Run
alias jhr='jhbuild run'
# Depends
@@ -23,6 +26,7 @@ alias jhu='jhbuild update'
alias jhuo='jhbuild updateone'
# Uninstall
alias jhun='jhbuild uninstall'
-
-
-
+# Shell
+alias jhsh='jhbuild shell'
+# Tinderbox
+alias jht='jhbuild tinderbox'
diff --git a/zsh/plugins/jira/README.md b/zsh/plugins/jira/README.md
index 091dccb..a5633af 100644
--- a/zsh/plugins/jira/README.md
+++ b/zsh/plugins/jira/README.md
@@ -19,10 +19,14 @@ jira # performs the default action
jira new # opens a new issue
jira dashboard # opens your JIRA dashboard
+jira tempo # opens your JIRA Tempo
jira reported [username] # queries for issues reported by a user
jira assigned [username] # queries for issues assigned to a user
jira myissues # queries for you own issues
jira branch # opens an existing issue matching the current branch name
+ # The branch name may have prefixes ending in "/": "feature/MP-1234",
+ # and also suffixes starting with "_": "MP-1234_fix_dashboard"
+ # In both these cases, the issue opened will be "MP-1234"
jira ABC-123 # opens an existing issue
jira ABC-123 m # opens an existing issue for adding a comment
```
diff --git a/zsh/plugins/jira/_jira b/zsh/plugins/jira/_jira
index d646142..1ac3eed 100644
--- a/zsh/plugins/jira/_jira
+++ b/zsh/plugins/jira/_jira
@@ -5,6 +5,7 @@ local -a _1st_arguments
_1st_arguments=(
'new:create a new issue'
'dashboard:open the dashboard'
+ 'tempo:open the tempo'
'reported:search for issues reported by a user'
'assigned:search for issues assigned to a user'
'branch:open the issue named after the git branch of the current directory'
diff --git a/zsh/plugins/jira/jira.plugin.zsh b/zsh/plugins/jira/jira.plugin.zsh
index e706948..22807e0 100644
--- a/zsh/plugins/jira/jira.plugin.zsh
+++ b/zsh/plugins/jira/jira.plugin.zsh
@@ -54,6 +54,9 @@ function jira() {
else
open_command "${jira_url}/secure/Dashboard.jspa"
fi
+ elif [[ "$action" == "tempo" ]]; then
+ echo "Opening tempo"
+ open_command "${jira_url}/secure/Tempo.jspa"
elif [[ "$action" == "dumpconfig" ]]; then
echo "JIRA_URL=$jira_url"
echo "JIRA_PREFIX=$jira_prefix"
@@ -63,25 +66,33 @@ function jira() {
else
# Anything that doesn't match a special action is considered an issue name
# but `branch` is a special case that will parse the current git branch
+ local issue_arg issue
if [[ "$action" == "branch" ]]; then
- local issue_arg=$(git rev-parse --abbrev-ref HEAD)
- local issue="${jira_prefix}${issue_arg}"
+ # Get name of the branch
+ issue_arg=$(git rev-parse --abbrev-ref HEAD)
+ # Strip prefixes like feature/ or bugfix/
+ issue_arg=${issue_arg##*/}
+ # Strip suffixes starting with _
+ issue_arg=(${(s:_:)issue_arg})
+ issue_arg=${issue_arg[1]}
+ if [[ "$issue_arg" = ${jira_prefix}* ]]; then
+ issue="${issue_arg}"
+ else
+ issue="${jira_prefix}${issue_arg}"
+ fi
else
- local issue_arg=$action
- local issue="${jira_prefix}${issue_arg}"
+ issue_arg=${(U)action}
+ issue="${jira_prefix}${issue_arg}"
fi
- local url_fragment=''
+
+ local url_fragment
if [[ "$2" == "m" ]]; then
url_fragment="#add-comment"
echo "Add comment to issue #$issue"
else
echo "Opening issue #$issue"
fi
- if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then
- open_command "${jira_url}/issues/${issue}${url_fragment}"
- else
- open_command "${jira_url}/browse/${issue}${url_fragment}"
- fi
+ open_command "${jira_url}/browse/${issue}${url_fragment}"
fi
}
diff --git a/zsh/plugins/jruby/README.md b/zsh/plugins/jruby/README.md
new file mode 100644
index 0000000..821a46d
--- /dev/null
+++ b/zsh/plugins/jruby/README.md
@@ -0,0 +1,21 @@
+# JRuby plugin
+
+This plugin adds aliases for [JRuby](https://www.jruby.org/).
+
+To use it, add `jruby` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... jruby)
+```
+
+## Requirements
+
+This plugin assumes you already have jruby installed and available in your [path](https://www.jruby.org/getting-started).
+
+## Aliases
+
+| Alias | Command |
+| ------------ | ---------------------------------------------------------------- |
+| `jrspec` | `jruby --debug -S rspec --debug` |
+| `jprofile` | `jruby --profile.api -S rspec` |
+| `jexec` | `jruby -S` |
diff --git a/zsh/plugins/jsontools/README.md b/zsh/plugins/jsontools/README.md
index 4faf58b..1fa2b8e 100644
--- a/zsh/plugins/jsontools/README.md
+++ b/zsh/plugins/jsontools/README.md
@@ -2,41 +2,47 @@
Handy command line tools for dealing with json data.
-## Tools
+To use it, add `jsontools` to the plugins array in your zshrc file:
-- **pp_json** - pretty prints json
-- **is_json** - returns true if valid json; false otherwise
-- **urlencode_json** - returns a url encoded string for the given json
-- **urldecode_json** - returns decoded json for the given url encoded string
+```zsh
+plugins=(... jsontools)
+```
## Usage
-Usage is simple...just take your json data and pipe it into the appropriate jsontool.
-```sh
- |
-```
-## Examples
-##### pp_json
+Usage is simple... just take your json data and pipe it into the appropriate jsontool:
+
+- `pp_json`: pretty prints json.
+- `is_json`: returns true if valid json; false otherwise.
+- `urlencode_json`: returns a url encoded string for the given json.
+- `urldecode_json`: returns decoded json for the given url encoded string.
+
+### Examples
+
+- **pp_json**:
```sh
# curl json data and pretty print the results
curl https://coderwall.com/bobwilliams.json | pp_json
```
-##### is_json
+- **is_json**:
+
```sh
-# pretty print the contents of an existing json file
+# Validate if file's content conforms to a valid JSON schema
less data.json | is_json
```
-##### urlencode_json
+- **urlencode_json**:
+
```sh
# json data directly from the command line
echo '{"b":2, "a":1}' | urlencode_json
```
-##### urldecode_json
+- **urldecode_json**:
+
```sh
# url encoded string to decode
echo '%7B%22b%22:2,%20%22a%22:1%7D%0A' | urldecode_json
-```
\ No newline at end of file
+```
diff --git a/zsh/plugins/jsontools/jsontools.plugin.zsh b/zsh/plugins/jsontools/jsontools.plugin.zsh
index 20d5eb1..912c835 100644
--- a/zsh/plugins/jsontools/jsontools.plugin.zsh
+++ b/zsh/plugins/jsontools/jsontools.plugin.zsh
@@ -11,9 +11,10 @@ if [[ $(whence node) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METH
alias urlencode_json='xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))"'
alias urldecode_json='xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"'
elif [[ $(whence python) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xpython" ) ]]; then
- alias pp_json='python -mjson.tool'
+ alias pp_json='python -c "import sys; del sys.path[0]; import runpy; runpy._run_module_as_main(\"json.tool\")"'
alias is_json='python -c "
-import json, sys;
+import sys; del sys.path[0];
+import json;
try:
json.loads(sys.stdin.read())
except ValueError, e:
@@ -22,11 +23,13 @@ else:
print True
sys.exit(0)"'
alias urlencode_json='python -c "
-import urllib, json, sys;
+import sys; del sys.path[0];
+import urllib, json;
print urllib.quote_plus(sys.stdin.read())
sys.exit(0)"'
alias urldecode_json='python -c "
-import urllib, json, sys;
+import sys; del sys.path[0];
+import urllib, json;
print urllib.unquote_plus(sys.stdin.read())
sys.exit(0)"'
elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xruby" ) ]]; then
@@ -36,4 +39,4 @@ elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_MET
alias urldecode_json='ruby -e "require \"uri\"; puts URI.unescape(STDIN.read)"'
fi
-unset JSONTOOLS_METHOD
\ No newline at end of file
+unset JSONTOOLS_METHOD
diff --git a/zsh/plugins/jump/README.md b/zsh/plugins/jump/README.md
index ed64152..1b0ce68 100644
--- a/zsh/plugins/jump/README.md
+++ b/zsh/plugins/jump/README.md
@@ -17,3 +17,15 @@ plugins=(... jump)
| `mark [mark-name]` | Create a mark with the given name or with the name of the current directory if none is provided |
| `unmark ` | Remove the given mark |
| `marks` | List the existing marks and the directories they point to |
+
+## Key bindings
+
+Pressing `CTRL`+`G` substitutes the written mark name for the full path of the mark.
+For example, with a mark named `mymark` pointing to `/path/to/my/mark`:
+```zsh
+$ cp /tmp/file mymark
+```
+will become:
+```zsh
+$ cp /tmp/file /path/to/my/mark
+```
diff --git a/zsh/plugins/jump/jump.plugin.zsh b/zsh/plugins/jump/jump.plugin.zsh
index d161a6d..c2da114 100644
--- a/zsh/plugins/jump/jump.plugin.zsh
+++ b/zsh/plugins/jump/jump.plugin.zsh
@@ -9,33 +9,34 @@
export MARKPATH=$HOME/.marks
jump() {
- cd -P "$MARKPATH/$1" 2>/dev/null || {echo "No such mark: $1"; return 1}
+ builtin cd -P "$MARKPATH/$1" 2>/dev/null || {echo "No such mark: $1"; return 1}
}
mark() {
- if [[ ( $# == 0 ) || ( "$1" == "." ) ]]; then
- MARK=$(basename "$PWD")
+ if [[ $# -eq 0 || "$1" = "." ]]; then
+ MARK=${PWD:t}
else
MARK="$1"
fi
- if read -q \?"Mark $PWD as ${MARK}? (y/n) "; then
- mkdir -p "$MARKPATH"; ln -sfn "$PWD" "$MARKPATH/$MARK"
+ if read -q "?Mark $PWD as ${MARK}? (y/n) "; then
+ command mkdir -p "$MARKPATH"
+ command ln -sfn "$PWD" "$MARKPATH/$MARK"
fi
}
unmark() {
- rm -i "$MARKPATH/$1"
+ LANG= command rm -i "$MARKPATH/$1"
}
marks() {
- local max=0
- for link in $MARKPATH/*(@); do
+ local link max=0
+ for link in $MARKPATH/{,.}*(@N); do
if [[ ${#link:t} -gt $max ]]; then
max=${#link:t}
fi
done
local printf_markname_template="$(printf -- "%%%us " "$max")"
- for link in $MARKPATH/*(@); do
+ for link in $MARKPATH/{,.}*(@N); do
local markname="$fg[cyan]${link:t}$reset_color"
local markpath="$fg[blue]$(readlink $link)$reset_color"
printf -- "$printf_markname_template" "$markname"
@@ -44,21 +45,15 @@ marks() {
}
_completemarks() {
- if [[ $(ls "${MARKPATH}" | wc -l) -gt 1 ]]; then
- reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_a-zA-Z0-9\.\-]*):$/\2/g'))
- else
- if readlink -e "${MARKPATH}"/* &>/dev/null; then
- reply=($(ls "${MARKPATH}"))
- fi
- fi
+ reply=("${MARKPATH}"/{,.}*(@N:t))
}
compctl -K _completemarks jump
compctl -K _completemarks unmark
_mark_expansion() {
- setopt extendedglob
+ setopt localoptions extendedglob
autoload -U modify-current-argument
- modify-current-argument '$(readlink "$MARKPATH/$ARG")'
+ modify-current-argument '$(readlink "$MARKPATH/$ARG" || echo "$ARG")'
}
zle -N _mark_expansion
bindkey "^g" _mark_expansion
diff --git a/zsh/plugins/keychain/keychain.plugin.zsh b/zsh/plugins/keychain/keychain.plugin.zsh
index af34793..f122f79 100644
--- a/zsh/plugins/keychain/keychain.plugin.zsh
+++ b/zsh/plugins/keychain/keychain.plugin.zsh
@@ -1,4 +1,9 @@
-function _start_agent() {
+(( $+commands[keychain] )) || return
+
+# Define SHORT_HOST if not defined (%m = host name up to first .)
+SHORT_HOST=${SHORT_HOST:-${(%):-%m}}
+
+function {
local agents
local -a identities
local -a options
@@ -15,7 +20,7 @@ function _start_agent() {
zstyle -a :omz:plugins:keychain options options
# start keychain...
- keychain ${^options:-} --agents ${agents:-gpg} ${^identities}
+ keychain ${^options:-} --agents ${agents:-gpg} ${^identities} --host $SHORT_HOST
# Get the filenames to store/lookup the environment from
_keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh"
@@ -25,8 +30,3 @@ function _start_agent() {
[ -f "$_keychain_env_sh" ] && . "$_keychain_env_sh"
[ -f "$_keychain_env_sh_gpg" ] && . "$_keychain_env_sh_gpg"
}
-
-_start_agent
-
-# tidy up after ourselves
-unfunction _start_agent
diff --git a/zsh/plugins/kitchen/_kitchen b/zsh/plugins/kitchen/_kitchen
index 29a3125..d93d93d 100644
--- a/zsh/plugins/kitchen/_kitchen
+++ b/zsh/plugins/kitchen/_kitchen
@@ -67,7 +67,7 @@ _kitchen() {
_kitchen_commands() {
local commands
- commands=("${(@f)$(_call_program commands $service help | sed -n 's/^ kitchen \([[:alpha:]]*\) [ [].*# \(.*\)$/\1:\2/p')}")
+ commands=("${(@f)$(_call_program commands $service help | sed -n 's/^ kitchen \([[:alpha:]]*\) [ A-Z[].*# \(.*\)$/\1:\2/p')}")
_describe -t commands 'kitchen commands' commands
}
diff --git a/zsh/plugins/knife/README.md b/zsh/plugins/knife/README.md
new file mode 100644
index 0000000..b167f16
--- /dev/null
+++ b/zsh/plugins/knife/README.md
@@ -0,0 +1,25 @@
+# knife plugin
+
+This plugin adds completion for [knife](https://docs.chef.io/knife.html), a command-line tool
+to interact with [Chef](https://chef.io), a platform to automate and manage infrastructure via
+code.
+
+To use it, add `knife` to the plugins array in your zshrc file:
+```zsh
+plugins=(... knife)
+```
+
+## Options
+
+- `KNIFE_RELATIVE_PATH`: if set to `true`, the completion script will look for local cookbooks
+ under the `cookbooks` folder in the chef root directory. It has preference over the other two
+ options below. **Default:** empty.
+
+- `KNIFE_COOKBOOK_PATH`: if set, it points to the folder that contains local cookbooks, for
+ example: `/path/to/my/chef/cookbooks`. **Default:** `cookbook_path` field in `knife.rb`
+ (see below).
+
+- `KNIFE_CONF_PATH`: variable pointing to the `knife.rb` configuration file, for example
+ `/path/to/my/.chef/knife.rb`. Only used if `$KNIFE_COOKBOOK_PATH` isn't set. If it exists,
+ `$PWD/.chef/knife.rb` is used instead. Otherwise, if it's set, its value is used.
+ **Default**: `$HOME/.chef/knife.rb`.
diff --git a/zsh/plugins/knife/_knife b/zsh/plugins/knife/_knife
index 0d61ff1..09757eb 100644
--- a/zsh/plugins/knife/_knife
+++ b/zsh/plugins/knife/_knife
@@ -3,13 +3,13 @@
# You can override the path to knife.rb and your cookbooks by setting
# KNIFE_CONF_PATH=/path/to/my/.chef/knife.rb
# KNIFE_COOKBOOK_PATH=/path/to/my/chef/cookbooks
-# If you want your local cookbooks path to be calculated relative to where you are then
+# If you want your local cookbooks path to be calculated relative to where you are then
# set the below option
-# KNIFE_RELATIVE_PATH=true
+# KNIFE_RELATIVE_PATH=true
# Read around where these are used for more detail.
# These flags should be available everywhere according to man knife
-knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes )
+knife_general_flags=(--help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes)
# knife has a very special syntax, some example calls are:
# knife status
@@ -25,183 +25,200 @@ _knife() {
typeset -A opt_args
cloudproviders=(bluebox ec2 rackspace slicehost terremark)
_arguments \
- '1: :->knifecmd'\
- '2: :->knifesubcmd'\
+ '1: :->knifecmd' \
+ '2: :->knifesubcmd' \
'3: :->knifesubcmd2' \
'4: :->knifesubcmd3' \
'5: :->knifesubcmd4' \
'6: :->knifesubcmd5'
-
+
case $state in
knifecmd)
- compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" diff exec environment index node recipe role search ssh status upload vault windows $cloudproviders
- ;;
+ compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" diff exec environment index node recipe role search solo ssh status upload vault windows $cloudproviders
+ ;;
knifesubcmd)
case $words[2] in
- (bluebox|ec2|rackspace|slicehost|terremark)
+ bluebox|ec2|rackspace|slicehost|terremark)
compadd "$@" server images
- ;;
+ ;;
client)
compadd -Q "$@" "bulk delete" list create show delete edit reregister
- ;;
+ ;;
configure)
compadd "$@" client
- ;;
+ ;;
cookbook)
compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload
- ;;
+ ;;
diff)
_arguments '*:file or directory:_files -g "*"'
- ;;
+ ;;
environment)
compadd -Q "$@" list create delete edit show "from file"
- ;;
+ ;;
node)
- compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
- ;;
+ compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
+ ;;
recipe)
- compadd "$@" list
- ;;
+ compadd "$@" list
+ ;;
role)
compadd -Q "$@" "bulk delete" create delete edit "from file" list show
- ;;
+ ;;
+ solo)
+ compadd "$@" bootstrap clean cook init prepare
+ ;;
upload)
- _arguments '*:file or directory:_files -g "*"'
- ;;
+ _arguments '*:file or directory:_files -g "*"'
+ ;;
vault)
compadd -Q "$@" create decrypt delete edit remove "rotate all keys" "rotate keys" show update
- ;;
+ ;;
windows)
compadd "$@" bootstrap
- ;;
+ ;;
*)
- _arguments '2:Subsubcommands:($(_knife_options1))'
+ _arguments '2:Subsubcommands:($(_knife_options1))'
+ ;;
esac
- ;;
- knifesubcmd2)
+ ;;
+ knifesubcmd2)
case $words[3] in
- server)
+ server)
compadd "$@" list create delete
- ;;
- images)
+ ;;
+ images)
compadd "$@" list
- ;;
- site)
+ ;;
+ site)
compadd "$@" vendor show share search download list unshare
- ;;
- (show|delete|edit)
- _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))'
- ;;
- (upload|test)
- _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)'
- ;;
+ ;;
+ show|delete|edit)
+ _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))'
+ ;;
+ upload|test)
+ _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)'
+ ;;
list)
- compadd -a "$@" knife_general_flags
- ;;
+ compadd -a "$@" knife_general_flags
+ ;;
bag)
compadd -Q "$@" show edit list "from file" create delete
- ;;
+ ;;
+ bootstrap|clean|cook|prepare)
+ compadd "$@" nodes/*.json(N:t:r)
+ ;;
+ init)
+ compadd "$@" ./*(/N:t)
+ ;;
*)
_arguments '3:Subsubcommands:($(_knife_options2))'
+ ;;
esac
- ;;
- knifesubcmd3)
- case $words[3] in
- show)
- case $words[2] in
- cookbook)
- versioncomp=1
- _arguments '4:Cookbookversions:($(_cookbook_versions) latest)'
- ;;
- (node|client|role)
- compadd "$@" --attribute
- esac
- esac
- case $words[4] in
- (show|edit)
- _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))'
;;
- file)
+ knifesubcmd3)
+ case $words[3] in
+ show)
+ case $words[2] in
+ cookbook)
+ versioncomp=1
+ _arguments '4:Cookbookversions:($(_cookbook_versions) latest)'
+ ;;
+ node|client|role)
+ compadd "$@" --attribute
+ ;;
+ esac
+ ;;
+ esac
+ case $words[4] in
+ show|edit)
+ _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))'
+ ;;
+ file)
case $words[2] in
environment)
_arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/environments"'
- ;;
+ ;;
node)
_arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/nodes"'
- ;;
+ ;;
role)
_arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/roles"'
- ;;
+ ;;
*)
_arguments '*:Subsubcommands:($(_knife_options3))'
- esac
- ;;
- list)
- compadd -a "$@" knife_general_flags
- ;;
- *)
- _arguments '*:Subsubcommands:($(_knife_options3))'
+ ;;
+ esac
+ ;;
+ list)
+ compadd -a "$@" knife_general_flags
+ ;;
+ *)
+ _arguments '*:Subsubcommands:($(_knife_options3))'
+ ;;
esac
;;
- knifesubcmd4)
- if (( versioncomp > 0 )); then
- compadd "$@" attributes definitions files libraries providers recipes resources templates
- else
- case $words[5] in
- file)
- _arguments '*:directory:_path_files -/ -W "$(_chef_root)/data_bags" -qS \ '
+ knifesubcmd4)
+ if ((versioncomp > 0)); then
+ compadd "$@" attributes definitions files libraries providers recipes resources templates
+ else
+ case $words[5] in
+ file)
+ _arguments '*:directory:_path_files -/ -W "$(_chef_root)/data_bags" -qS \ '
;;
- *) _arguments '*:Subsubcommands:($(_knife_options2))'
+ *) _arguments '*:Subsubcommands:($(_knife_options2))' ;;
esac
- fi
- ;;
- knifesubcmd5)
- case $words[5] in
- file)
- _arguments '*:files:_path_files -g "*.json" -W "$(_chef_root)/data_bags/$words[6]"'
- ;;
- *)
- _arguments '*:Subsubcommands:($(_knife_options3))'
- esac
- esac
+ fi
+ ;;
+ knifesubcmd5)
+ case $words[5] in
+ file)
+ _arguments '*:files:_path_files -g "*.json" -W "$(_chef_root)/data_bags/$words[6]"'
+ ;;
+ *)
+ _arguments '*:Subsubcommands:($(_knife_options3))'
+ ;;
+ esac
+ ;;
+ esac
}
# Helper functions to provide the argument completion for several depths of commands
_knife_options1() {
- ( for line in $( knife $words[2] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
+ (for line in $(knife $words[2] --help | grep -v "^knife"); do echo $line | grep "\-\-"; done)
}
_knife_options2() {
- ( for line in $( knife $words[2] $words[3] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
+ (for line in $(knife $words[2] $words[3] --help | grep -v "^knife"); do echo $line | grep "\-\-"; done)
}
_knife_options3() {
- ( for line in $( knife $words[2] $words[3] $words[4] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
+ (for line in $(knife $words[2] $words[3] $words[4] --help | grep -v "^knife"); do echo $line | grep "\-\-"; done)
}
# The chef_x_remote functions use knife to get a list of objects of type x on the server
_chef_roles_remote() {
- (knife role list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife role list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_clients_remote() {
- (knife client list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife client list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_nodes_remote() {
- (knife node list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife node list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_cookbooks_remote() {
- (knife cookbook list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife cookbook list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_sitecookbooks_remote() {
- (knife cookbook site list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife cookbook site list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_data_bags_remote() {
- (knife data bag list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife data bag list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_environments_remote() {
@@ -210,14 +227,14 @@ _chef_environments_remote() {
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
_chef_cookbooks_local() {
- if [ $KNIFE_RELATIVE_PATH ]; then
+ if [ $KNIFE_RELATIVE_PATH ]; then
local cookbook_path="$(_chef_root)/cookbooks"
- else
+ else
local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb}
if [ -f ./.chef/knife.rb ]; then
knife_rb="./.chef/knife.rb"
fi
- local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )}
+ local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/')}
fi
(for i in $cookbook_path; do ls $i; done)
}
@@ -227,12 +244,11 @@ _cookbook_versions() {
(knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g')
}
-# Searches up from current directory to find the closest folder that has a .chef folder
-# Useful for the knife upload/from file commands
-_chef_root () {
+# Searches up from current directory to find the closest folder that has a .chef folder
+# Useful for the knife upload/from file commands
+_chef_root() {
directory="$PWD"
- while [ $directory != '/' ]
- do
+ while [ $directory != '/' ]; do
test -e "$directory/.chef" && echo "$directory" && return
directory="${directory:h}"
done
diff --git a/zsh/plugins/knife_ssh/README.md b/zsh/plugins/knife_ssh/README.md
new file mode 100644
index 0000000..cb836b7
--- /dev/null
+++ b/zsh/plugins/knife_ssh/README.md
@@ -0,0 +1,14 @@
+# knife_ssh plugin
+
+This plugin adds a `knife_ssh` function as well as completion for it, to allow
+connecting via ssh to servers managed with [Chef](https://www.chef.io/).
+
+To use it, add `knife_ssh` to the plugins array in your zshrc file:
+```zsh
+plugins=(... knife_ssh)
+```
+
+The plugin creates a cache of the Chef node list via `knife`, and stores it
+in `$HOME/.knife_comp~`, when first triggering knife_ssh completion.
+
+**Requirements:** `knife` has to be installed.
diff --git a/zsh/plugins/knife_ssh/knife_ssh.plugin.zsh b/zsh/plugins/knife_ssh/knife_ssh.plugin.zsh
index 7fdd42a..dc425a3 100644
--- a/zsh/plugins/knife_ssh/knife_ssh.plugin.zsh
+++ b/zsh/plugins/knife_ssh/knife_ssh.plugin.zsh
@@ -1,17 +1,17 @@
function knife_ssh() {
- grep -q $1 ~/.knife_comp~ 2> /dev/null || rm -f ~/.knife_comp~;
+ grep -q $1 ~/.knife_comp~ 2> /dev/null || rm -f ~/.knife_comp~
ssh $(knife node show $1 | awk '/IP:/{print $2}')
}
_knife_ssh() {
if hash knife 2>/dev/null; then
if [[ ! -f ~/.knife_comp~ ]]; then
- echo "\nGenerating ~/.knife_comp~..." >/dev/stderr
+ echo "\nGenerating ~/.knife_comp~..." >&2
knife node list > ~/.knife_comp~
fi
- compadd $(<~/.knife_comp~)
+ compadd $(< ~/.knife_comp~)
else
- echo "Could not find knife" > /dev/stderr;
+ echo "Could not find knife" >&2
fi
}
diff --git a/zsh/plugins/kube-ps1/README.md b/zsh/plugins/kube-ps1/README.md
index 82c0a77..b08997b 100644
--- a/zsh/plugins/kube-ps1/README.md
+++ b/zsh/plugins/kube-ps1/README.md
@@ -1,104 +1,238 @@
-# Kubernetes prompt for zsh
+kube-ps1: Kubernetes prompt for bash and zsh
+============================================
-A Kubernetes zsh prompt that displays the current cluster cluster
-and the namespace.
+A script that lets you add the current Kubernetes context and namespace
+configured on `kubectl` to your Bash/Zsh prompt strings (i.e. the `$PS1`).
-Inspired by several tools used to simplify usage of kubectl
+Inspired by several tools used to simplify usage of `kubectl`.
-NOTE: If you are not using zsh, check out [kube-ps1](https://github.com/jonmosco/kube-ps1)
-designed for bash as well as zsh.
+## Installing
+
+### MacOS
+
+Homebrew package manager:
+
+```
+$ brew update
+$ brew install kube-ps1
+```
+### From Source
+
+1. Clone this repository
+2. Source the kube-ps1.sh in your `~/.zshrc` or your `~/.bashrc`
+
+### Arch Linux
+AUR Package available at [https://aur.archlinux.org/packages/kube-ps1/](https://aur.archlinux.org/packages/kube-ps1/).
+
+#### Zsh
+```sh
+source /path/to/kube-ps1.sh
+PROMPT='$(kube_ps1)'$PROMPT
+```
+#### Bash
+```sh
+source /path/to/kube-ps1.sh
+PS1='[\u@\h \W $(kube_ps1)]\$ '
+```
+
+### Zsh Plugin Managers
+
+#### Using [zplugin](https://github.com/zdharma/zplugin)
+
+Update `.zshrc` with:
+```sh
+zplugin light jonmosco/kube-ps1
+PROMPT='$(kube_ps1)'$PROMPT
+```
## Requirements
-The default prompt assumes you have the kubectl command line utility installed. It
-can be obtained here:
+The default prompt assumes you have the `kubectl` command line utility installed.
+Official installation instructions and binaries are available:
[Install and Set up kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
-If using this with OpenShift, the oc tool needs installed. It can be obtained from here:
+If using this with OpenShift, the `oc` tool needs installed. It can be obtained
+from brew ports:
+
+```
+brew install openshift-cli
+```
+or the source can be downloaded:
[OC Client Tools](https://www.openshift.org/download.html)
+Set the binary to `oc` with the following environment variable:
+
+```
+KUBE_PS1_BINARY=oc
+```
+
+If neither binary is available, the prompt will print the following:
+
+```
+(|BINARY-N/A:N/A)
+```
+
## Helper utilities
-There are several great tools that make using kubectl very enjoyable.
+There are several great tools that make using kubectl very enjoyable:
-[kubectx and kubenx](https://github.com/ahmetb/kubectx) are great for
+- [`kubectx` and `kubens`](https://github.com/ahmetb/kubectx) are great for
fast switching between clusters and namespaces.
+## Tmux port
+
+I have begun porting kube-ps1 to tmux as a status line plugin. If you prefer
+tmux, and like the functionality provided by kube-ps1, checkout the
+[kube-tmux](https://github.com/jonmosco/kube-tmux) project
+
## Prompt Structure
-The prompt layout is:
+The default prompt layout is:
```
-(|:)
+(|:)
```
-## Enabling
+If the current-context is not set, kube-ps1 will return the following:
-In order to use kube-ps1 with Oh My Zsh, you'll need to enable them in the
-.zshrc file. You'll find the zshrc file in your $HOME directory. Open it with
-your favorite text editor and you'll see a spot to list all the plugins you
-want to load.
-
-```shell
-vim $HOME/.zshrc
+```
+(|N/A:N/A)
```
-Add kube-ps1 to the list of enabled plugins and enable it on the prompt:
+## Enabling/Disabling
-```shell
-plugins=(
- git
- kube-ps1
-)
+If you want to stop showing Kubernetes status on your prompt string temporarily
+run `kubeoff`. To disable the prompt for all shell sessions, run `kubeoff -g`.
+You can enable it again in the current shell by running `kubeon`, and globally
+with `kubeon -g`.
-# After the "source Oh My Zsh" line
-PROMPT=$PROMPT'$(kube_ps1) '
```
-
-Note: The `PROMPT` example above was tested with the theme `robbyrussell`.
-
-## Enabling / Disabling on the current shell
-
-Sometimes the kubernetes information can be anoying, you can easily
-switch it on and off with the following commands:
-
-```shell
-kubeon
+kubeon : turn on kube-ps1 status for this shell. Takes precedence over
+ global setting for current session
+kubeon -g : turn on kube-ps1 status globally
+kubeoff : turn off kube-ps1 status for this shell. Takes precedence over
+ global setting for current session
+kubeoff -g : turn off kube-ps1 status globally
```
-```shell
-kubeoff
-```
-
-## Colors
-
-Blue was used as the prefix to match the Kubernetes color as closely as
-possible. Red was chosen as the cluster name to stand out, and cyan
-for the namespace. Check the customization section for changing them.
-
## Customization
-The default settings can be overridden in ~/.zshrc
+The default settings can be overridden in `~/.bashrc` or `~/.zshrc` by setting
+the following environment variables:
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `KUBE_PS1_BINARY` | `kubectl` | Default Kubernetes binary |
+| `KUBE_PS1_NS_ENABLE` | `true` | Display the namespace. If set to `false`, this will also disable `KUBE_PS1_DIVIDER` |
| `KUBE_PS1_PREFIX` | `(` | Prompt opening character |
| `KUBE_PS1_SYMBOL_ENABLE` | `true ` | Display the prompt Symbol. If set to `false`, this will also disable `KUBE_PS1_SEPARATOR` |
| `KUBE_PS1_SYMBOL_DEFAULT` | `⎈ ` | Default prompt symbol. Unicode `\u2388` |
| `KUBE_PS1_SYMBOL_USE_IMG` | `false` | ☸️ , Unicode `\u2638` as the prompt symbol |
-| `KUBE_PS1_NS_ENABLE` | `true` | Display the namespace. If set to `false`, this will also disable `KUBE_PS1_DIVIDER` |
-| `KUBE_PS1_SEPERATOR` | `\|` | Separator between symbol and cluster name |
-| `KUBE_PS1_DIVIDER` | `:` | Separator between cluster and namespace |
+| `KUBE_PS1_SEPARATOR` | | | Separator between symbol and context name |
+| `KUBE_PS1_DIVIDER` | `:` | Separator between context and namespace |
| `KUBE_PS1_SUFFIX` | `)` | Prompt closing character |
-| `KUBE_PS1_COLOR_SYMBOL` | `"%F{blue}"` | Custom color for the symbol |
-| `KUBE_PS1_COLOR_CONTEXT` | `"%F{red}"` | Custom color for the context |
-| `KUBE_PS1_COLOR_NS` | `"%F{cyan}"` | Custom color for the namespace |
-| `KUBE_PS1_ENABLED` | `true` | Set to false to start disabled on any new shell, `kubeon`/`kubeoff` will flip this value on the current shell |
+| `KUBE_PS1_CLUSTER_FUNCTION` | No default, must be user supplied | Function to customize how cluster is displayed |
+| `KUBE_PS1_NAMESPACE_FUNCTION` | No default, must be user supplied | Function to customize how namespace is displayed |
+
+For terminals that do not support UTF-8, the symbol will be replaced with the
+string `k8s`.
+
+To disable a feature, set it to an empty string:
+
+```
+KUBE_PS1_SEPARATOR=''
+```
+
+## Colors
+
+The default colors are set with the following environment variables:
+
+| Variable | Default | Meaning |
+| :------- | :-----: | ------- |
+| `KUBE_PS1_SYMBOL_COLOR` | `blue` | Set default color of the Kubernetes symbol |
+| `KUBE_PS1_CTX_COLOR` | `red` | Set default color of the context |
+| `KUBE_PS1_NS_COLOR` | `cyan` | Set default color of the namespace |
+| `KUBE_PS1_BG_COLOR` | `null` | Set default color of the prompt background |
+
+Blue was used for the default symbol to match the Kubernetes color as closely
+as possible. Red was chosen as the context name to stand out, and cyan for the
+namespace.
+
+Set the variable to an empty string if you do not want color for each
+prompt section:
+
+```
+KUBE_PS1_CTX_COLOR=''
+```
+
+Names are usable for the following colors:
+
+```
+black, red, green, yellow, blue, magenta, cyan
+```
+
+256 colors are available by specifying the numerical value as the variable
+argument.
+
+## Customize display of cluster name and namespace
+
+You can change how the cluster name and namespace are displayed using the
+`KUBE_PS1_CLUSTER_FUNCTION` and `KUBE_PS1_NAMESPACE_FUNCTION` variables
+respectively.
+
+For the following examples let's assume the following:
+
+cluster name: `sandbox.k8s.example.com`
+namespace: `alpha`
+
+If you're using domain style cluster names, your prompt will get quite long
+very quickly. Let's say you only want to display the first portion of the
+cluster name (`sandbox`), you could do that by adding the following:
+
+```sh
+function get_cluster_short() {
+ echo "$1" | cut -d . -f1
+}
+
+KUBE_PS1_CLUSTER_FUNCTION=get_cluster_short
+```
+
+The same pattern can be followed to customize the display of the namespace.
+Let's say you would prefer the namespace to be displayed in all uppercase
+(`ALPHA`), here's one way you could do that:
+
+```sh
+function get_namespace_upper() {
+ echo "$1" | tr '[:lower:]' '[:upper:]'
+}
+
+export KUBE_PS1_NAMESPACE_FUNCTION=get_namespace_upper
+```
+
+In both cases, the variable is set to the name of the function, and you must have defined the function in your shell configuration before kube_ps1 is called. The function must accept a single parameter and echo out the final value.
+
+### Bug Reports and shell configuration
+
+Due to the vast ways of customizing the shell, please try the prompt with a
+minimal configuration before submitting a bug report.
+
+This can be done as follows for each shell before loading kube-ps1:
+
+Bash:
+```bash
+bash --norc
+```
+
+Zsh:
+```bash
+zsh -f
+or
+zsh --no-rcs
+```
## Contributors
-- Jared Yanovich
-- Pedro Moranga
+* [Ahmet Alp Balkan](https://github.com/ahmetb)
+* Jared Yanovich
diff --git a/zsh/plugins/kube-ps1/kube-ps1.plugin.zsh b/zsh/plugins/kube-ps1/kube-ps1.plugin.zsh
index 3cb2128..9e77cbc 100644
--- a/zsh/plugins/kube-ps1/kube-ps1.plugin.zsh
+++ b/zsh/plugins/kube-ps1/kube-ps1.plugin.zsh
@@ -1,16 +1,15 @@
-#!/bin/zsh
+#!/bin/bash
# Kubernetes prompt helper for bash/zsh
-# ported to oh-my-zsh
# Displays current context and namespace
-# Copyright 2018 Jon Mosco
+# Copyright 2019 Jon Mosco
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
-# https://www.apache.org/licenses/LICENSE-2.0
+# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@@ -21,39 +20,150 @@
# Debug
[[ -n $DEBUG ]] && set -x
-setopt PROMPT_SUBST
-autoload -U add-zsh-hook
-add-zsh-hook precmd _kube_ps1_update_cache
-zmodload zsh/stat
-zmodload zsh/datetime
-
# Default values for the prompt
-# Override these values in ~/.zshrc
+# Override these values in ~/.zshrc or ~/.bashrc
KUBE_PS1_BINARY="${KUBE_PS1_BINARY:-kubectl}"
KUBE_PS1_SYMBOL_ENABLE="${KUBE_PS1_SYMBOL_ENABLE:-true}"
-KUBE_PS1_SYMBOL_DEFAULT="${KUBE_PS1_SYMBOL_DEFAULT:-\u2388 }"
+KUBE_PS1_SYMBOL_DEFAULT=${KUBE_PS1_SYMBOL_DEFAULT:-$'\u2388 '}
KUBE_PS1_SYMBOL_USE_IMG="${KUBE_PS1_SYMBOL_USE_IMG:-false}"
KUBE_PS1_NS_ENABLE="${KUBE_PS1_NS_ENABLE:-true}"
+KUBE_PS1_CONTEXT_ENABLE="${KUBE_PS1_CONTEXT_ENABLE:-true}"
+KUBE_PS1_PREFIX="${KUBE_PS1_PREFIX-(}"
KUBE_PS1_SEPARATOR="${KUBE_PS1_SEPARATOR-|}"
KUBE_PS1_DIVIDER="${KUBE_PS1_DIVIDER-:}"
-KUBE_PS1_PREFIX="${KUBE_PS1_PREFIX-(}"
KUBE_PS1_SUFFIX="${KUBE_PS1_SUFFIX-)}"
+KUBE_PS1_SYMBOL_COLOR="${KUBE_PS1_SYMBOL_COLOR-blue}"
+KUBE_PS1_CTX_COLOR="${KUBE_PS1_CTX_COLOR-red}"
+KUBE_PS1_NS_COLOR="${KUBE_PS1_NS_COLOR-cyan}"
+KUBE_PS1_BG_COLOR="${KUBE_PS1_BG_COLOR}"
+KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}"
+KUBE_PS1_DISABLE_PATH="${HOME}/.kube/kube-ps1/disabled"
KUBE_PS1_LAST_TIME=0
-KUBE_PS1_ENABLED=true
+KUBE_PS1_CLUSTER_FUNCTION="${KUBE_PS1_CLUSTER_FUNCTION}"
+KUBE_PS1_NAMESPACE_FUNCTION="${KUBE_PS1_NAMESPACE_FUNCTION}"
-KUBE_PS1_COLOR_SYMBOL="%{$fg[blue]%}"
-KUBE_PS1_COLOR_CONTEXT="%{$fg[red]%}"
-KUBE_PS1_COLOR_NS="%{$fg[cyan]%}"
+# Determine our shell
+if [ "${ZSH_VERSION-}" ]; then
+ KUBE_PS1_SHELL="zsh"
+elif [ "${BASH_VERSION-}" ]; then
+ KUBE_PS1_SHELL="bash"
+fi
+
+_kube_ps1_init() {
+ [[ -f "${KUBE_PS1_DISABLE_PATH}" ]] && KUBE_PS1_ENABLED=off
+
+ case "${KUBE_PS1_SHELL}" in
+ "zsh")
+ _KUBE_PS1_OPEN_ESC="%{"
+ _KUBE_PS1_CLOSE_ESC="%}"
+ _KUBE_PS1_DEFAULT_BG="%k"
+ _KUBE_PS1_DEFAULT_FG="%f"
+ setopt PROMPT_SUBST
+ autoload -U add-zsh-hook
+ add-zsh-hook precmd _kube_ps1_update_cache
+ zmodload -F zsh/stat b:zstat
+ zmodload zsh/datetime
+ ;;
+ "bash")
+ _KUBE_PS1_OPEN_ESC=$'\001'
+ _KUBE_PS1_CLOSE_ESC=$'\002'
+ _KUBE_PS1_DEFAULT_BG=$'\033[49m'
+ _KUBE_PS1_DEFAULT_FG=$'\033[39m'
+ [[ $PROMPT_COMMAND =~ _kube_ps1_update_cache ]] || PROMPT_COMMAND="_kube_ps1_update_cache;${PROMPT_COMMAND:-:}"
+ ;;
+ esac
+}
+
+_kube_ps1_color_fg() {
+ local KUBE_PS1_FG_CODE
+ case "${1}" in
+ black) KUBE_PS1_FG_CODE=0;;
+ red) KUBE_PS1_FG_CODE=1;;
+ green) KUBE_PS1_FG_CODE=2;;
+ yellow) KUBE_PS1_FG_CODE=3;;
+ blue) KUBE_PS1_FG_CODE=4;;
+ magenta) KUBE_PS1_FG_CODE=5;;
+ cyan) KUBE_PS1_FG_CODE=6;;
+ white) KUBE_PS1_FG_CODE=7;;
+ # 256
+ [0-9]|[1-9][0-9]|[1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-6]) KUBE_PS1_FG_CODE="${1}";;
+ *) KUBE_PS1_FG_CODE=default
+ esac
+
+ if [[ "${KUBE_PS1_FG_CODE}" == "default" ]]; then
+ KUBE_PS1_FG_CODE="${_KUBE_PS1_DEFAULT_FG}"
+ return
+ elif [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then
+ KUBE_PS1_FG_CODE="%F{$KUBE_PS1_FG_CODE}"
+ elif [[ "${KUBE_PS1_SHELL}" == "bash" ]]; then
+ if tput setaf 1 &> /dev/null; then
+ KUBE_PS1_FG_CODE="$(tput setaf ${KUBE_PS1_FG_CODE})"
+ elif [[ $KUBE_PS1_FG_CODE -ge 0 ]] && [[ $KUBE_PS1_FG_CODE -le 256 ]]; then
+ KUBE_PS1_FG_CODE="\033[38;5;${KUBE_PS1_FG_CODE}m"
+ else
+ KUBE_PS1_FG_CODE="${_KUBE_PS1_DEFAULT_FG}"
+ fi
+ fi
+ echo ${_KUBE_PS1_OPEN_ESC}${KUBE_PS1_FG_CODE}${_KUBE_PS1_CLOSE_ESC}
+}
+
+_kube_ps1_color_bg() {
+ local KUBE_PS1_BG_CODE
+ case "${1}" in
+ black) KUBE_PS1_BG_CODE=0;;
+ red) KUBE_PS1_BG_CODE=1;;
+ green) KUBE_PS1_BG_CODE=2;;
+ yellow) KUBE_PS1_BG_CODE=3;;
+ blue) KUBE_PS1_BG_CODE=4;;
+ magenta) KUBE_PS1_BG_CODE=5;;
+ cyan) KUBE_PS1_BG_CODE=6;;
+ white) KUBE_PS1_BG_CODE=7;;
+ # 256
+ [0-9]|[1-9][0-9]|[1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-6]) KUBE_PS1_BG_CODE="${1}";;
+ *) KUBE_PS1_BG_CODE=$'\033[0m';;
+ esac
+
+ if [[ "${KUBE_PS1_BG_CODE}" == "default" ]]; then
+ KUBE_PS1_FG_CODE="${_KUBE_PS1_DEFAULT_BG}"
+ return
+ elif [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then
+ KUBE_PS1_BG_CODE="%K{$KUBE_PS1_BG_CODE}"
+ elif [[ "${KUBE_PS1_SHELL}" == "bash" ]]; then
+ if tput setaf 1 &> /dev/null; then
+ KUBE_PS1_BG_CODE="$(tput setab ${KUBE_PS1_BG_CODE})"
+ elif [[ $KUBE_PS1_BG_CODE -ge 0 ]] && [[ $KUBE_PS1_BG_CODE -le 256 ]]; then
+ KUBE_PS1_BG_CODE="\033[48;5;${KUBE_PS1_BG_CODE}m"
+ else
+ KUBE_PS1_BG_CODE="${DEFAULT_BG}"
+ fi
+ fi
+ echo ${OPEN_ESC}${KUBE_PS1_BG_CODE}${CLOSE_ESC}
+}
_kube_ps1_binary_check() {
- command -v "$1" >/dev/null
+ command -v $1 >/dev/null
}
_kube_ps1_symbol() {
[[ "${KUBE_PS1_SYMBOL_ENABLE}" == false ]] && return
- KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_DEFAULT}"
- KUBE_PS1_SYMBOL_IMG="\u2638 "
+ case "${KUBE_PS1_SHELL}" in
+ bash)
+ if ((BASH_VERSINFO[0] >= 4)) && [[ $'\u2388 ' != "\\u2388 " ]]; then
+ KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_DEFAULT}"
+ # KUBE_PS1_SYMBOL=$'\u2388 '
+ KUBE_PS1_SYMBOL_IMG=$'\u2638 '
+ else
+ KUBE_PS1_SYMBOL=$'\xE2\x8E\x88 '
+ KUBE_PS1_SYMBOL_IMG=$'\xE2\x98\xB8 '
+ fi
+ ;;
+ zsh)
+ KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_DEFAULT}"
+ KUBE_PS1_SYMBOL_IMG="\u2638 ";;
+ *)
+ KUBE_PS1_SYMBOL="k8s"
+ esac
if [[ "${KUBE_PS1_SYMBOL_USE_IMG}" == true ]]; then
KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_IMG}"
@@ -73,22 +183,24 @@ _kube_ps1_file_newer_than() {
local file=$1
local check_time=$2
- zmodload -e "zsh/stat"
- if [[ "$?" -eq 0 ]]; then
- mtime=$(stat +mtime "${file}")
+ if [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then
+ mtime=$(zstat +mtime "${file}")
elif stat -c "%s" /dev/null &> /dev/null; then
# GNU stat
- mtime=$(stat -c %Y "${file}")
+ mtime=$(stat -L -c %Y "${file}")
else
# BSD stat
- mtime=$(stat -f %m "$file")
+ mtime=$(stat -L -f %m "$file")
fi
[[ "${mtime}" -gt "${check_time}" ]]
}
_kube_ps1_update_cache() {
- KUBECONFIG="${KUBECONFIG:=$HOME/.kube/config}"
+ local return_code=$?
+
+ [[ "${KUBE_PS1_ENABLED}" == "off" ]] && return $return_code
+
if ! _kube_ps1_binary_check "${KUBE_PS1_BINARY}"; then
# No ability to fetch context/namespace; display N/A.
KUBE_PS1_CONTEXT="BINARY-N/A"
@@ -113,47 +225,147 @@ _kube_ps1_update_cache() {
return
fi
done
+
+ return $return_code
}
-_kube_ps1_get_context_ns() {
+_kube_ps1_get_context() {
+ if [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]]; then
+ KUBE_PS1_CONTEXT="$(${KUBE_PS1_BINARY} config current-context 2>/dev/null)"
+ # Set namespace to 'N/A' if it is not defined
+ KUBE_PS1_CONTEXT="${KUBE_PS1_CONTEXT:-N/A}"
- # Set the command time
- KUBE_PS1_LAST_TIME=$EPOCHSECONDS
-
- KUBE_PS1_CONTEXT="$(${KUBE_PS1_BINARY} config current-context 2>/dev/null)"
- if [[ -z "${KUBE_PS1_CONTEXT}" ]]; then
- KUBE_PS1_CONTEXT="N/A"
- KUBE_PS1_NAMESPACE="N/A"
- return
- elif [[ "${KUBE_PS1_NS_ENABLE}" == true ]]; then
- KUBE_PS1_NAMESPACE="$(${KUBE_PS1_BINARY} config view --minify --output 'jsonpath={..namespace}' 2>/dev/null)"
- # Set namespace to 'default' if it is not defined
- KUBE_PS1_NAMESPACE="${KUBE_PS1_NAMESPACE:-default}"
+ if [[ ! -z "${KUBE_PS1_CLUSTER_FUNCTION}" ]]; then
+ KUBE_PS1_CONTEXT=$($KUBE_PS1_CLUSTER_FUNCTION $KUBE_PS1_CONTEXT)
+ fi
fi
}
-# function to disable the prompt on the current shell
-kubeon(){
- KUBE_PS1_ENABLED=true
+_kube_ps1_get_ns() {
+ if [[ "${KUBE_PS1_NS_ENABLE}" == true ]]; then
+ KUBE_PS1_NAMESPACE="$(${KUBE_PS1_BINARY} config view --minify --output 'jsonpath={..namespace}' 2>/dev/null)"
+ # Set namespace to 'default' if it is not defined
+ KUBE_PS1_NAMESPACE="${KUBE_PS1_NAMESPACE:-default}"
+
+ if [[ ! -z "${KUBE_PS1_NAMESPACE_FUNCTION}" ]]; then
+ KUBE_PS1_NAMESPACE=$($KUBE_PS1_NAMESPACE_FUNCTION $KUBE_PS1_NAMESPACE)
+ fi
+ fi
}
-# function to disable the prompt on the current shell
-kubeoff(){
- KUBE_PS1_ENABLED=false
+_kube_ps1_get_context_ns() {
+ # Set the command time
+ if [[ "${KUBE_PS1_SHELL}" == "bash" ]]; then
+ if ((BASH_VERSINFO[0] >= 4 && BASH_VERSINFO[1] >= 2)); then
+ KUBE_PS1_LAST_TIME=$(printf '%(%s)T')
+ else
+ KUBE_PS1_LAST_TIME=$(date +%s)
+ fi
+ elif [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then
+ KUBE_PS1_LAST_TIME=$EPOCHSECONDS
+ fi
+
+ _kube_ps1_get_context
+ _kube_ps1_get_ns
+}
+
+# Set kube-ps1 shell defaults
+_kube_ps1_init
+
+_kubeon_usage() {
+ cat <<"EOF"
+Toggle kube-ps1 prompt on
+
+Usage: kubeon [-g | --global] [-h | --help]
+
+With no arguments, turn off kube-ps1 status for this shell instance (default).
+
+ -g --global turn on kube-ps1 status globally
+ -h --help print this message
+EOF
+}
+
+_kubeoff_usage() {
+ cat <<"EOF"
+Toggle kube-ps1 prompt off
+
+Usage: kubeoff [-g | --global] [-h | --help]
+
+With no arguments, turn off kube-ps1 status for this shell instance (default).
+
+ -g --global turn off kube-ps1 status globally
+ -h --help print this message
+EOF
+}
+
+kubeon() {
+ if [[ "${1}" == '-h' || "${1}" == '--help' ]]; then
+ _kubeon_usage
+ elif [[ "${1}" == '-g' || "${1}" == '--global' ]]; then
+ rm -f -- "${KUBE_PS1_DISABLE_PATH}"
+ elif [[ "$#" -ne 0 ]]; then
+ echo -e "error: unrecognized flag ${1}\\n"
+ _kubeon_usage
+ return
+ fi
+
+ KUBE_PS1_ENABLED=on
+}
+
+kubeoff() {
+ if [[ "${1}" == '-h' || "${1}" == '--help' ]]; then
+ _kubeoff_usage
+ elif [[ "${1}" == '-g' || "${1}" == '--global' ]]; then
+ mkdir -p -- "$(dirname "${KUBE_PS1_DISABLE_PATH}")"
+ touch -- "${KUBE_PS1_DISABLE_PATH}"
+ elif [[ $# -ne 0 ]]; then
+ echo "error: unrecognized flag ${1}" >&2
+ _kubeoff_usage
+ return
+ fi
+
+ KUBE_PS1_ENABLED=off
}
# Build our prompt
-kube_ps1 () {
- local reset_color="%{$reset_color%}"
- [[ ${KUBE_PS1_ENABLED} != 'true' ]] && return
+kube_ps1() {
+ [[ "${KUBE_PS1_ENABLED}" == "off" ]] && return
+ [[ -z "${KUBE_PS1_CONTEXT}" ]] && [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]] && return
- KUBE_PS1="${reset_color}$KUBE_PS1_PREFIX"
- KUBE_PS1+="${KUBE_PS1_COLOR_SYMBOL}$(_kube_ps1_symbol)"
- KUBE_PS1+="${reset_color}$KUBE_PS1_SEPERATOR"
- KUBE_PS1+="${KUBE_PS1_COLOR_CONTEXT}$KUBE_PS1_CONTEXT${reset_color}"
- KUBE_PS1+="$KUBE_PS1_DIVIDER"
- KUBE_PS1+="${KUBE_PS1_COLOR_NS}$KUBE_PS1_NAMESPACE${reset_color}"
- KUBE_PS1+="$KUBE_PS1_SUFFIX"
+ local KUBE_PS1
+ local KUBE_PS1_RESET_COLOR="${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_DEFAULT_FG}${_KUBE_PS1_CLOSE_ESC}"
+
+ # Background Color
+ [[ -n "${KUBE_PS1_BG_COLOR}" ]] && KUBE_PS1+="$(_kube_ps1_color_bg ${KUBE_PS1_BG_COLOR})"
+
+ # Prefix
+ [[ -n "${KUBE_PS1_PREFIX}" ]] && KUBE_PS1+="${KUBE_PS1_PREFIX}"
+
+ # Symbol
+ KUBE_PS1+="$(_kube_ps1_color_fg $KUBE_PS1_SYMBOL_COLOR)$(_kube_ps1_symbol)${KUBE_PS1_RESET_COLOR}"
+
+ if [[ -n "${KUBE_PS1_SEPARATOR}" ]] && [[ "${KUBE_PS1_SYMBOL_ENABLE}" == true ]]; then
+ KUBE_PS1+="${KUBE_PS1_SEPARATOR}"
+ fi
+
+ # Context
+ if [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]]; then
+ KUBE_PS1+="$(_kube_ps1_color_fg $KUBE_PS1_CTX_COLOR)${KUBE_PS1_CONTEXT}${KUBE_PS1_RESET_COLOR}"
+ fi
+
+ # Namespace
+ if [[ "${KUBE_PS1_NS_ENABLE}" == true ]]; then
+ if [[ -n "${KUBE_PS1_DIVIDER}" ]] && [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]]; then
+ KUBE_PS1+="${KUBE_PS1_DIVIDER}"
+ fi
+ KUBE_PS1+="$(_kube_ps1_color_fg ${KUBE_PS1_NS_COLOR})${KUBE_PS1_NAMESPACE}${KUBE_PS1_RESET_COLOR}"
+ fi
+
+ # Suffix
+ [[ -n "${KUBE_PS1_SUFFIX}" ]] && KUBE_PS1+="${KUBE_PS1_SUFFIX}"
+
+ # Close Background color if defined
+ [[ -n "${KUBE_PS1_BG_COLOR}" ]] && KUBE_PS1+="${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_DEFAULT_BG}${_KUBE_PS1_CLOSE_ESC}"
echo "${KUBE_PS1}"
}
diff --git a/zsh/plugins/kubectl/README.md b/zsh/plugins/kubectl/README.md
index c0db593..84f5f8d 100644
--- a/zsh/plugins/kubectl/README.md
+++ b/zsh/plugins/kubectl/README.md
@@ -33,7 +33,8 @@ plugins=(... kubectl)
| kep | `kubectl edit pods` | Edit pods from the default editor |
| kdp | `kubectl describe pods` | Describe all pods |
| kdelp | `kubectl delete pods` | Delete all pods matching passed arguments |
-| kgpl | `kgp -l` | Get pod by label. Example: `kgpl "app=myapp" -n myns` |
+| kgpl | `kgp -l` | Get pods by label. Example: `kgpl "app=myapp" -n myns` |
+| kgpn | `kgp -n` | Get pods by namespace. Example: `kgpn kube-system` |
| | | **Service management** |
| kgs | `kubectl get svc` | List all services in ps output format |
| kgsw | `kgs --watch` | After listing all services, watch for changes |
@@ -105,3 +106,11 @@ plugins=(... kubectl)
| kdelss | `kubectl delete statefulset` | Delete the statefulset |
| ksss | `kubectl scale statefulset` | Scale a statefulset |
| krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment |
+
+## Wrappers
+
+This plugin provides 3 wrappers to colorize kubectl output in JSON and YAML using various tools (which must be installed):
+
+- `kj`: JSON, colorized with [`jq`](https://stedolan.github.io/jq/).
+- `kjx`: JSON, colorized with [`fx`](https://github.com/antonmedv/fx).
+- `ky`: YAML, colorized with [`yh`](https://github.com/andreazorzetto/yh).
diff --git a/zsh/plugins/kubectl/kubectl.plugin.zsh b/zsh/plugins/kubectl/kubectl.plugin.zsh
index 6c1696d..7a0c479 100644
--- a/zsh/plugins/kubectl/kubectl.plugin.zsh
+++ b/zsh/plugins/kubectl/kubectl.plugin.zsh
@@ -14,7 +14,7 @@ fi
alias k=kubectl
# Execute a kubectl command against all namespaces
-alias kca='f(){ kubectl "$@" --all-namespaces; unset -f f; }; f'
+alias kca='_kca(){ kubectl "$@" --all-namespaces; unset -f _kca; }; _kca'
# Apply a YML file
alias kaf='kubectl apply -f'
@@ -37,6 +37,7 @@ alias kdelf='kubectl delete -f'
# Pod management.
alias kgp='kubectl get pods'
+alias kgpa='kubectl get pods --all-namespaces'
alias kgpw='kgp --watch'
alias kgpwide='kgp -o wide'
alias kep='kubectl edit pods'
@@ -46,8 +47,12 @@ alias kdelp='kubectl delete pods'
# get pod by label: kgpl "app=myapp" -n myns
alias kgpl='kgp -l'
+# get pod by namespace: kgpn kube-system"
+alias kgpn='kgp -n'
+
# Service management.
alias kgs='kubectl get svc'
+alias kgsa='kubectl get svc --all-namespaces'
alias kgsw='kgs --watch'
alias kgswide='kgs -o wide'
alias kes='kubectl edit svc'
@@ -56,6 +61,7 @@ alias kdels='kubectl delete svc'
# Ingress management
alias kgi='kubectl get ingress'
+alias kgia='kubectl get ingress --all-namespaces'
alias kei='kubectl edit ingress'
alias kdi='kubectl describe ingress'
alias kdeli='kubectl delete ingress'
@@ -69,17 +75,20 @@ alias kcn='kubectl config set-context $(kubectl config current-context) --namesp
# ConfigMap management
alias kgcm='kubectl get configmaps'
+alias kgcma='kubectl get configmaps --all-namespaces'
alias kecm='kubectl edit configmap'
alias kdcm='kubectl describe configmap'
alias kdelcm='kubectl delete configmap'
# Secret management
alias kgsec='kubectl get secret'
+alias kgseca='kubectl get secret --all-namespaces'
alias kdsec='kubectl describe secret'
alias kdelsec='kubectl delete secret'
# Deployment management.
alias kgd='kubectl get deployment'
+alias kgda='kubectl get deployment --all-namespaces'
alias kgdw='kgd --watch'
alias kgdwide='kgd -o wide'
alias ked='kubectl edit deployment'
@@ -98,6 +107,7 @@ alias kru='kubectl rollout undo'
# Statefulset management.
alias kgss='kubectl get statefulset'
+alias kgssa='kubectl get statefulset --all-namespaces'
alias kgssw='kgss --watch'
alias kgsswide='kgss -o wide'
alias kess='kubectl edit statefulset'
@@ -115,7 +125,13 @@ alias kgaa='kubectl get all --all-namespaces'
# Logs
alias kl='kubectl logs'
+alias kl1h='kubectl logs --since 1h'
+alias kl1m='kubectl logs --since 1m'
+alias kl1s='kubectl logs --since 1s'
alias klf='kubectl logs -f'
+alias klf1h='kubectl logs --since 1h -f'
+alias klf1m='kubectl logs --since 1m -f'
+alias klf1s='kubectl logs --since 1s -f'
# File copy
alias kcp='kubectl cp'
@@ -128,8 +144,19 @@ alias kdelno='kubectl delete node'
# PVC management.
alias kgpvc='kubectl get pvc'
+alias kgpvca='kubectl get pvc --all-namespaces'
alias kgpvcw='kgpvc --watch'
alias kepvc='kubectl edit pvc'
alias kdpvc='kubectl describe pvc'
alias kdelpvc='kubectl delete pvc'
+# Only run if the user actually has kubectl installed
+if (( $+commands[kubectl] )); then
+ kj() { kubectl "$@" -o json | jq; }
+ kjx() { kubectl "$@" -o json | fx; }
+ ky() { kubectl "$@" -o yaml | yh; }
+
+ compdef kj=kubectl
+ compdef kjx=kubectl
+ compdef ky=kubectl
+fi
diff --git a/zsh/plugins/lando/LICENSE b/zsh/plugins/lando/LICENSE
new file mode 100644
index 0000000..1d49831
--- /dev/null
+++ b/zsh/plugins/lando/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019 Joshua Bedford
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+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 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.
\ No newline at end of file
diff --git a/zsh/plugins/lando/README.md b/zsh/plugins/lando/README.md
new file mode 100644
index 0000000..928a42b
--- /dev/null
+++ b/zsh/plugins/lando/README.md
@@ -0,0 +1,37 @@
+# Lando ZSH (lando-zsh)
+
+This plugin adds aliases for using various languages and frameworks with [Lando](https://docs.lando.dev/basics/) for Docker. It will only run within lando-driven project directories.
+
+To use it, add `lando` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... lando)
+```
+
+## ALIASES:
+
+| Alias | Description |
+|:----------:|:----------------:|
+| `artisan` | `lando artisan` |
+| `composer` | `lando composer` |
+| `drush` | `lando drush` |
+| `gulp` | `lando gulp` |
+| `npm` | `lando npm` |
+| `wp` | `lando wp` |
+| `yarn` | `lando yarn` |
+
+## How It Works:
+
+This plugin removes the requirement to type `lando` before a command. It utilizes the lando version of supported commands run within directories with the following criteria:
+- The `.lando.yml` file is found in the current directory or any parent directory within `$LANDO_ZSH_SITES_DIRECTORY`.
+- The current directory is within `$LANDO_ZSH_SITES_DIRECTORY` but is not `$LANDO_ZSH_SITES_DIRECTORY` itself.
+
+## Settings:
+
+- `LANDO_ZSH_SITES_DIRECTORY`: The plugin will stop searching through parents for `CONFIG_FILE` once it hits this directory.
+- `LANDO_ZSH_CONFIG_FILE`: The plugin will check to see if this provided file exists to check for presence of Lando.
+
+## Author:
+
+- Author: Joshua Bedford
+- URL: [https://github.com/joshuabedford/lando-zsh](https://github.com/joshuabedford/lando-zsh)
diff --git a/zsh/plugins/lando/lando.plugin.zsh b/zsh/plugins/lando/lando.plugin.zsh
new file mode 100644
index 0000000..aa74c99
--- /dev/null
+++ b/zsh/plugins/lando/lando.plugin.zsh
@@ -0,0 +1,40 @@
+# Settings
+: ${LANDO_ZSH_SITES_DIRECTORY:="$HOME/Sites"}
+: ${LANDO_ZSH_CONFIG_FILE:=.lando.yml}
+
+# Enable multiple commands with lando.
+function artisan \
+ composer \
+ drush \
+ gulp \
+ npm \
+ wp \
+ yarn {
+ if checkForLandoFile; then
+ lando "$0" "$@"
+ else
+ command "$0" "$@"
+ fi
+}
+
+# Check for the file in the current and parent directories.
+checkForLandoFile() {
+ # Only bother checking for lando within the Sites directory.
+ if [[ "$PWD/" != "$LANDO_ZSH_SITES_DIRECTORY"/* ]]; then
+ # Not within $LANDO_ZSH_SITES_DIRECTORY
+ return 1
+ fi
+
+ local curr_dir="$PWD"
+ # Checking for file: $LANDO_ZSH_CONFIG_FILE within $LANDO_ZSH_SITES_DIRECTORY...
+ while [[ "$curr_dir" != "$LANDO_ZSH_SITES_DIRECTORY" ]]; do
+ if [[ -f "$curr_dir/$LANDO_ZSH_CONFIG_FILE" ]]; then
+ return 0
+ fi
+ curr_dir="${curr_dir:h}"
+ done
+
+ # Could not find $LANDO_ZSH_CONFIG_FILE in the current directory
+ # or in any of its parents up to $LANDO_ZSH_SITES_DIRECTORY.
+ return 1
+}
\ No newline at end of file
diff --git a/zsh/plugins/laravel/README.md b/zsh/plugins/laravel/README.md
index 44798b6..95f5901 100644
--- a/zsh/plugins/laravel/README.md
+++ b/zsh/plugins/laravel/README.md
@@ -29,6 +29,12 @@ plugins=(... laravel)
| `pamc` | `php artisan make:controller` |
| `pams` | `php artisan make:seeder` |
| `pamt` | `php artisan make:test` |
+| `pamfa` | `php artisan make:factory` |
+| `pamp` | `php artisan make:policy` |
+| `pame` | `php artisan make:event` |
+| `pamj` | `php artisan make:job` |
+| `paml` | `php artisan make:listener` |
+| `pamn` | `php artisan make:notification` |
## Clears
@@ -38,3 +44,14 @@ plugins=(... laravel)
| `pacoc` | `php artisan config:clear` |
| `pavic` | `php artisan view:clear` |
| `paroc` | `php artisan route:clear` |
+
+## Queues
+
+| Alias | Description |
+|:-:|:-:|
+| `paqf` | `php artisan queue:failed` |
+| `paqft` | `php artisan queue:failed-table` |
+| `paql` | `php artisan queue:listen` |
+| `paqr` | `php artisan queue:retry` |
+| `paqt` | `php artisan queue:table` |
+| `paqw` | `php artisan queue:work` |
diff --git a/zsh/plugins/laravel/laravel.plugin.zsh b/zsh/plugins/laravel/laravel.plugin.zsh
index 7ddfd85..a8382d3 100644
--- a/zsh/plugins/laravel/laravel.plugin.zsh
+++ b/zsh/plugins/laravel/laravel.plugin.zsh
@@ -17,6 +17,13 @@ alias pamm='php artisan make:model'
alias pamc='php artisan make:controller'
alias pams='php artisan make:seeder'
alias pamt='php artisan make:test'
+alias pamfa='php artisan make:factory'
+alias pamp='php artisan make:policy'
+alias pame='php artisan make:event'
+alias pamj='php artisan make:job'
+alias paml='php artisan make:listener'
+alias pamn='php artisan make:notification'
+alias pampp='php artisan make:provider'
# Clears
@@ -24,3 +31,11 @@ alias pacac='php artisan cache:clear'
alias pacoc='php artisan config:clear'
alias pavic='php artisan view:clear'
alias paroc='php artisan route:clear'
+
+# queues
+alias paqf='php artisan queue:failed'
+alias paqft='php artisan queue:failed-table'
+alias paql='php artisan queue:listen'
+alias paqr='php artisan queue:retry'
+alias paqt='php artisan queue:table'
+alias paqw='php artisan queue:work'
diff --git a/zsh/plugins/laravel4/README.md b/zsh/plugins/laravel4/README.md
index c945601..97a6a78 100644
--- a/zsh/plugins/laravel4/README.md
+++ b/zsh/plugins/laravel4/README.md
@@ -10,9 +10,9 @@ plugins=(... laravel4)
## Aliases
-| Alias | Command | Description |
-|-----------|-------------------------------------------|-------------------------------------------------------------|
-| la4 | `php artisan` | Main Artisan command |
-| la4dump | `php artisan dump-autoload` | Regenerate framework autoload files |
-| la4cache | `php artisan cache:clear` | Flush the application cache |
-| la4routes | `php artisan routes` | List all registered routes |
+| Alias | Command | Description |
+|-----------|-----------------------------|-------------------------------------|
+| la4 | `php artisan` | Main Artisan command |
+| la4dump | `php artisan dump-autoload` | Regenerate framework autoload files |
+| la4cache | `php artisan cache:clear` | Flush the application cache |
+| la4routes | `php artisan routes` | List all registered routes |
diff --git a/zsh/plugins/laravel5/laravel5.plugin.zsh b/zsh/plugins/laravel5/laravel5.plugin.zsh
index 487a074..70dc4ed 100644
--- a/zsh/plugins/laravel5/laravel5.plugin.zsh
+++ b/zsh/plugins/laravel5/laravel5.plugin.zsh
@@ -1,20 +1,19 @@
+# Alias
+alias la5='php artisan'
+alias la5cache='php artisan cache:clear'
+alias la5routes='php artisan route:list'
+alias la5vendor='php artisan vendor:publish'
+
# Laravel5 basic command completion
_laravel5_get_command_list () {
- php artisan --raw --no-ansi list | sed "s/[[:space:]].*//g"
+ php artisan --raw --no-ansi list | sed "s/[[:space:]].*//g"
}
_laravel5 () {
- if [ -f artisan ]; then
- compadd `_laravel5_get_command_list`
+ if [[ -f artisan ]]; then
+ compadd $(_laravel5_get_command_list)
fi
}
compdef _laravel5 artisan
compdef _laravel5 la5
-
-#Alias
-alias la5='php artisan'
-
-alias la5cache='php artisan cache:clear'
-alias la5routes='php artisan route:list'
-alias la5vendor='php artisan vendor:publish'
diff --git a/zsh/plugins/last-working-dir/README.md b/zsh/plugins/last-working-dir/README.md
index 4cc4aca..ced9e03 100644
--- a/zsh/plugins/last-working-dir/README.md
+++ b/zsh/plugins/last-working-dir/README.md
@@ -6,4 +6,10 @@ for new shells, unless:
- The plugin is already loaded.
- The current `$PWD` is not `$HOME`.
-Adds `lwd` function to jump to the last working directory.
+Also adds `lwd` function to jump to the last working directory.
+
+To use it, add `last-working-dir` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... last-working-dir)
+```
diff --git a/zsh/plugins/last-working-dir/last-working-dir.plugin.zsh b/zsh/plugins/last-working-dir/last-working-dir.plugin.zsh
index 53bb19e..fd21705 100644
--- a/zsh/plugins/last-working-dir/last-working-dir.plugin.zsh
+++ b/zsh/plugins/last-working-dir/last-working-dir.plugin.zsh
@@ -2,7 +2,8 @@
typeset -g ZSH_LAST_WORKING_DIRECTORY
# Updates the last directory once directory is changed
-chpwd_functions+=(chpwd_last_working_dir)
+autoload -U add-zsh-hook
+add-zsh-hook chpwd chpwd_last_working_dir
chpwd_last_working_dir() {
if [ "$ZSH_SUBSHELL" = 0 ]; then
local cache_file="$ZSH_CACHE_DIR/last-working-dir"
diff --git a/zsh/plugins/lein/README.md b/zsh/plugins/lein/README.md
new file mode 100644
index 0000000..0c41196
--- /dev/null
+++ b/zsh/plugins/lein/README.md
@@ -0,0 +1,9 @@
+# Leiningen plugin
+
+This plugin adds completions for the [Leiningen](https://leiningen.org/) Clojure build tool.
+
+To use it, add `lein` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... lein)
+```
diff --git a/zsh/plugins/lighthouse/README.md b/zsh/plugins/lighthouse/README.md
index 0db29b4..55587b2 100644
--- a/zsh/plugins/lighthouse/README.md
+++ b/zsh/plugins/lighthouse/README.md
@@ -16,7 +16,8 @@ plugins=(... lighthouse)
file in your directory with the URL to the individual project.
Example:
- ```zsh
+
+ ```console
$ cat .lighthouse-url
https://rails.lighthouseapp.com/projects/8994
@@ -24,3 +25,5 @@ plugins=(... lighthouse)
Opening ticket #23
# The browser goes to https://rails.lighthouseapp.com/projects/8994/tickets/23
```
+
+See a demo: http://screencast.com/t/ZDgwNDUwNT
diff --git a/zsh/plugins/lol/README.md b/zsh/plugins/lol/README.md
index b0e54f5..ea6b0c3 100644
--- a/zsh/plugins/lol/README.md
+++ b/zsh/plugins/lol/README.md
@@ -1,67 +1,55 @@
# lol
-Plugin for adding catspeak aliases, because why not
+Plugin for adding catspeak aliases, because why not.
-## Enabling the plugin
+To use it, add `lol` to the plugins array in your zshrc file:
-1. Open your `.zshrc` file and add `lol` in the plugins section:
-
- ```zsh
- plugins=(
- # all your enabled plugins
- lol
- )
- ```
-
-2. Reload the source file or restart your Terminal session:
-
- ```console
- $ source ~/.zshrc
- $
- ```
+```zsh
+plugins=(... lol)
+```
## Aliases
-| Alias | Command |
-| ------------ | ---------------------------------------------------------------- |
-| `:3` | `echo` |
-| `alwayz` | `tail -f` |
-| `bringz` | `git pull` |
-| `btw` | `nice` |
-| `byes` | `exit` |
-| `chicken` | `git add` |
-| `cya` | `reboot` |
-| `donotwant` | `rm` |
-| `dowant` | `cp` |
-| `gimmeh` | `touch` |
-| `gtfo` | `mv` |
-| `hackzor` | `git init` |
-| `hai` | `cd` |
-| `icanhas` | `mkdir` |
-| `ihasbucket` | `df -h` |
-| `iminurbase` | `finger` |
-| `inur` | `locate` |
-| `invisible` | `cat` |
-| `iz` | `ls` |
-| `kthxbai` | `halt` |
-| `letcat` | `git checkout` |
-| `moar` | `more` |
-| `nomnom` | `killall` |
-| `nomz` | `ps aux` |
-| `nowai` | `chmod` |
-| `oanward` | `git commit -m` |
-| `obtw` | `nohup` |
-| `onoz` | `cat /var/log/errors.log` |
-| `ooanward` | `git commit -am` |
-| `plz` | `pwd` |
-| `pwned` | `ssh` |
-| `rtfm` | `man` |
-| `rulz` | `git push` |
-| `tldr` | `less` |
-| `violenz` | `git rebase` |
-| `visible` | `echo` |
-| `wtf` | `dmesg` |
-| `yolo` | `git commit -m "$(curl -s https://whatthecommit.com/index.txt)"` |
+| Alias | Command |
+| ------------ | --------------------------------------------------------------- |
+| `:3` | `echo` |
+| `alwayz` | `tail -f` |
+| `bringz` | `git pull` |
+| `btw` | `nice` |
+| `byes` | `exit` |
+| `chicken` | `git add` |
+| `cya` | `reboot` |
+| `donotwant` | `rm` |
+| `dowant` | `cp` |
+| `gimmeh` | `touch` |
+| `gtfo` | `mv` |
+| `hackzor` | `git init` |
+| `hai` | `cd` |
+| `icanhas` | `mkdir` |
+| `ihasbucket` | `df -h` |
+| `iminurbase` | `finger` |
+| `inur` | `locate` |
+| `invisible` | `cat` |
+| `iz` | `ls` |
+| `kthxbai` | `halt` |
+| `letcat` | `git checkout` |
+| `moar` | `more` |
+| `nomnom` | `killall` |
+| `nomz` | `ps aux` |
+| `nowai` | `chmod` |
+| `oanward` | `git commit -m` |
+| `obtw` | `nohup` |
+| `onoz` | `cat /var/log/errors.log` |
+| `ooanward` | `git commit -am` |
+| `plz` | `pwd` |
+| `pwned` | `ssh` |
+| `rtfm` | `man` |
+| `rulz` | `git push` |
+| `tldr` | `less` |
+| `violenz` | `git rebase` |
+| `visible` | `echo` |
+| `wtf` | `dmesg` |
+| `yolo` | `git commit -m "$(curl -s http://whatthecommit.com/index.txt)"` |
## Usage Examples
@@ -78,6 +66,6 @@ nowai u=r,go= some.file
# ssh root@catserver.org
pwned root@catserver.org
-# git commit -m "$(curl -s https://whatthecommit.com/index.txt)"
+# git commit -m "$(curl -s http://whatthecommit.com/index.txt)"
yolo
```
diff --git a/zsh/plugins/lol/lol.plugin.zsh b/zsh/plugins/lol/lol.plugin.zsh
index 585f96e..3c30259 100644
--- a/zsh/plugins/lol/lol.plugin.zsh
+++ b/zsh/plugins/lol/lol.plugin.zsh
@@ -45,7 +45,7 @@ alias bringz='git pull'
alias chicken='git add'
alias oanward='git commit -m'
alias ooanward='git commit -am'
-alias yolo='git commit -m "$(curl -s https://whatthecommit.com/index.txt)"'
+alias yolo='git commit -m "$(curl -s http://whatthecommit.com/index.txt)"'
alias letcat='git checkout'
alias violenz='git rebase'
diff --git a/zsh/plugins/lxd/README.md b/zsh/plugins/lxd/README.md
new file mode 100644
index 0000000..cea45e3
--- /dev/null
+++ b/zsh/plugins/lxd/README.md
@@ -0,0 +1,9 @@
+# lxd
+
+This plugin provides completion for [lxd](https://linuxcontainers.org/lxd/), as well as aliases
+for frequent lxc commands.
+
+To use it add `lxd` to the plugins array in your zshrc file.
+
+```zsh
+plugins=(... lxd)
diff --git a/zsh/plugins/lxd/lxd.plugin.zsh b/zsh/plugins/lxd/lxd.plugin.zsh
new file mode 100644
index 0000000..a6a0742
--- /dev/null
+++ b/zsh/plugins/lxd/lxd.plugin.zsh
@@ -0,0 +1,26 @@
+_lxc_get_command_list () {
+ $_comp_command1 | sed "1,/Available Commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
+}
+
+_lxc_get_subcommand_list () {
+ $_comp_command1 ${words[2]} | sed "1,/Available Commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
+}
+
+_lxc () {
+ local curcontext="$curcontext" state line
+ typeset -A opt_args
+ _arguments \
+ '1: :->command'\
+ '*: :->args'
+
+ case $state in
+ command)
+ compadd $(_lxc_get_command_list)
+ ;;
+ *)
+ compadd $(_lxc_get_subcommand_list)
+ ;;
+ esac
+}
+
+compdef _lxc lxc
diff --git a/zsh/plugins/macports/_port b/zsh/plugins/macports/_port
index 06d7fb4..6a9ebe0 100644
--- a/zsh/plugins/macports/_port
+++ b/zsh/plugins/macports/_port
@@ -41,6 +41,8 @@ subcmds=(
'patch'
'pkg'
'provides'
+'rdependents'
+'rdeps'
'rpmpackage'
'search'
'selfupdate'
diff --git a/zsh/plugins/magic-enter/README.md b/zsh/plugins/magic-enter/README.md
new file mode 100644
index 0000000..78514c6
--- /dev/null
+++ b/zsh/plugins/magic-enter/README.md
@@ -0,0 +1,17 @@
+## Magic Enter plugin
+
+This plugin makes your enter key magical, by binding commonly used commands to it.
+
+To use it, add `magic-enter` to the plugins array in your zshrc file. You can set the
+commands to be run in your .zshrc, before the line containing plugins. If no command
+is specified in a git directory, `git status` is executed; in other directories, `ls`.
+
+```zsh
+# defaults
+MAGIC_ENTER_GIT_COMMAND='git status -u .'
+MAGIC_ENTER_OTHER_COMMAND='ls -lh .'
+
+plugins=(... magic-enter)
+```
+
+**Maintainer:** [@dufferzafar](https://github.com/dufferzafar)
diff --git a/zsh/plugins/magic-enter/Readme.md b/zsh/plugins/magic-enter/Readme.md
deleted file mode 100644
index b401ab4..0000000
--- a/zsh/plugins/magic-enter/Readme.md
+++ /dev/null
@@ -1,14 +0,0 @@
-## Magic Enter
-
-**Maintainer:** [@dufferzafar](https://github.com/dufferzafar)
-
-Makes your enter key magical, by binding commonly used commands to it.
-
-You can set the commands to be run in your .zshrc, before the line containing plugins!
-
-```bash
-MAGIC_ENTER_GIT_COMMAND='git status -u .'
-MAGIC_ENTER_OTHER_COMMAND='ls -lh .'
-
-plugins=(magic-enter)
-```
diff --git a/zsh/plugins/magic-enter/magic-enter.plugin.zsh b/zsh/plugins/magic-enter/magic-enter.plugin.zsh
index 8e18596..2d4d578 100644
--- a/zsh/plugins/magic-enter/magic-enter.plugin.zsh
+++ b/zsh/plugins/magic-enter/magic-enter.plugin.zsh
@@ -3,7 +3,6 @@
# Pressing enter in a git directory runs `git status`
# in other directories `ls`
magic-enter () {
-
# If commands are not already set, use the defaults
[ -z "$MAGIC_ENTER_GIT_COMMAND" ] && MAGIC_ENTER_GIT_COMMAND="git status -u ."
[ -z "$MAGIC_ENTER_OTHER_COMMAND" ] && MAGIC_ENTER_OTHER_COMMAND="ls -lh ."
@@ -20,5 +19,9 @@ magic-enter () {
zle accept-line
fi
}
+
zle -N magic-enter
-bindkey "^M" magic-enter
+
+bindkey -M emacs "^M" magic-enter
+bindkey -M vicmd "^M" magic-enter
+bindkey -M viins "^M" magic-enter
diff --git a/zsh/plugins/man/man.plugin.zsh b/zsh/plugins/man/man.plugin.zsh
index 94aa491..dcba613 100644
--- a/zsh/plugins/man/man.plugin.zsh
+++ b/zsh/plugins/man/man.plugin.zsh
@@ -13,15 +13,25 @@
# ------------------------------------------------------------------------------
man-command-line() {
- [[ -z $BUFFER ]] && zle up-history
- [[ $BUFFER != man\ * ]] && LBUFFER="man $LBUFFER"
+ # if there is no command typed, use the last command
+ [[ -z "$BUFFER" ]] && zle up-history
+
+ # if typed command begins with man, do nothing
+ [[ "$BUFFER" = man\ * ]] && return
+
+ # get command and possible subcommand
+ # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags
+ local -a args
+ args=(${${(Az)BUFFER}[1]} ${${(Az)BUFFER}[2]})
+
+ # check if man page exists for command and first argument
+ if man "${args[1]}-${args[2]}" >/dev/null 2>&1; then
+ BUFFER="man $args"
+ else
+ BUFFER="man ${args[1]}"
+ fi
}
+
zle -N man-command-line
# Defined shortcut keys: [Esc]man
bindkey "\e"man man-command-line
-
-
-# ------------------------------------------------------------------------------
-# Also, you might want to use man-preview included in 'osx' plugin
-# just substitute "man" in the function with "man-preview" after you included OS X in
-# the .zshrc
diff --git a/zsh/plugins/mercurial/README.md b/zsh/plugins/mercurial/README.md
index f42212d..80ea2de 100644
--- a/zsh/plugins/mercurial/README.md
+++ b/zsh/plugins/mercurial/README.md
@@ -1,60 +1,66 @@
# Mercurial plugin
-### Usage
-Update .zshrc:
-1. Add name to the list of plugins, e.g. `plugins=(... mercurial ...)`
- (that is pretty obvious).
-2. Switch to a theme which uses `hg_prompt_info`.
+This plugin adds some handy aliases for using Mercurial as well as a few
+utility and prompt functions that can be used in a theme.
- Or, customize the `$PROMPT` variable of your current theme to contain current folder mercurial repo info. This can be done by putting a custom version of the theme in `$ZSH_CUSTOM` or by changing `$PROMPT` in `.zshrc` after loading the theme.
+To use it, add `mercurial` to the plugins array in your zshrc file:
- The `robbyrussell` theme is used by default, so you need to modify `$PROMPT` var by adding `$(hg_prompt_info)` after `$(git_prompt_info)`, so it looks like this:
+```zsh
+plugins=(... mercurial)
+```
- ```zsh
- PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
- ```
+## Aliases
-3. Initialize additional vars used in plugin. So in short put next in **.zshrc**:
+| Alias | Command |
+|--------|-------------------------------------------------------------------------------------------------------------|
+| `hga` | `hg add` |
+| `hgc` | `hg commit` |
+| `hgca` | `hg commit --amend` |
+| `hgb` | `hg branch` |
+| `hgba` | `hg branches` |
+| `hgbk` | `hg bookmarks` |
+| `hgco` | `hg checkout` |
+| `hgd` | `hg diff` |
+| `hged` | `hg diffmerge` |
+| `hgp` | `hg push` |
+| `hgs` | `hg status` |
+| `hgsl` | `hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"` |
+| `hgun` | `hg resolve --list` |
+| `hgi` | `hg incoming` |
+| `hgl` | `hg pull -u` |
+| `hglr` | `hg pull --rebase` |
+| `hgo` | `hg outgoing` |
- ```
- ZSH_THEME_HG_PROMPT_PREFIX="%{$fg_bold[magenta]%}hg:(%{$fg[red]%}"
- ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}"
- ZSH_THEME_HG_PROMPT_DIRTY="%{$fg[magenta]%}) %{$fg[yellow]%}✗%{$reset_color%}"
- ZSH_THEME_HG_PROMPT_CLEAN="%{$fg[magenta]%})"
- ```
+## Prompt usage
-### What's inside?
-#### Adds handy aliases:
-###### general
-* `hgc` - `hg commit`
-* `hgb` - `hg branch`
-* `hgba` - `hg branches`
-* `hgbk` - `hg bookmarks`
-* `hgco` - `hg checkout`
-* `hgd` - `hg diff`
-* `hged` - `hg diffmerge`
+- Switch to a theme which uses `hg_prompt_info`
-###### pull and update
-* `hgi` - `hg incoming`
-* `hgl` - `hg pull -u`
-* `hglr` - `hg pull --rebase`
-* `hgo` - `hg outgoing`
-* `hgp` - `hg push`
-* `hgs` - `hg status`
-* `hgsl` - `hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"`
+- Or customize the `$PROMPT` variable of your current theme to contain current folder mercurial repo info.
+ This can be done by putting a custom version of the theme in `$ZSH_CUSTOM` or by changing `$PROMPT` in
+ `.zshrc` after loading the theme.
-###### this is the 'git commit --amend' equivalent
-* `hgca` - `hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip`
+ For example, for the `robbyrussell` theme you need to modify `$PROMPT` var by adding `$(hg_prompt_info)`
+ after `$(git_prompt_info)`, so it looks like this:
-###### list unresolved files (since hg does not list unmerged files in the status command)
-* `hgun` - `hg resolve --list`
+ ```zsh
+ PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+ ```
-#### Displays repo branch and directory status in prompt
-This is the same as git plugin does.
+You can also redefine additional vars used in the plugin (after Oh My Zsh is sourced):
-**Note**: Additional changes to **.zshrc**, or using a theme designed to use `hg_prompt_info`, are required in order for this to work.
+```zsh
+ZSH_THEME_HG_PROMPT_PREFIX="%{$fg_bold[magenta]%}hg:(%{$fg[red]%}"
+ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}"
+ZSH_THEME_HG_PROMPT_DIRTY="%{$fg[magenta]%}) %{$fg[yellow]%}✗%{$reset_color%}"
+ZSH_THEME_HG_PROMPT_CLEAN="%{$fg[magenta]%})"
+```
-### Mantainers
-[ptrv](https://github.com/ptrv) - original creator
+### Display repo branch and directory status in prompt
-[oshybystyi](https://github.com/oshybystyi) - created this README and know how most of code works
+This is the same as git plugin does. **Note**: additional changes to `.zshrc`, or using a theme designed
+to use `hg_prompt_info`, are required in order for this to work.
+
+## Mantainers
+
+- [ptrv](https://github.com/ptrv): original creator
+- [oshybystyi](https://github.com/oshybystyi)
diff --git a/zsh/plugins/mercurial/mercurial.plugin.zsh b/zsh/plugins/mercurial/mercurial.plugin.zsh
index 58bc571..f134304 100644
--- a/zsh/plugins/mercurial/mercurial.plugin.zsh
+++ b/zsh/plugins/mercurial/mercurial.plugin.zsh
@@ -1,23 +1,22 @@
-# Mercurial
+# aliases
alias hga='hg add'
alias hgc='hg commit'
+alias hgca='hg commit --amend'
alias hgb='hg branch'
alias hgba='hg branches'
alias hgbk='hg bookmarks'
alias hgco='hg checkout'
alias hgd='hg diff'
alias hged='hg diffmerge'
+alias hgp='hg push'
+alias hgs='hg status'
+alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"'
+alias hgun='hg resolve --list'
# pull and update
alias hgi='hg incoming'
alias hgl='hg pull -u'
alias hglr='hg pull --rebase'
alias hgo='hg outgoing'
-alias hgp='hg push'
-alias hgs='hg status'
-alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n" '
-alias hgca='hg commit --amend'
-# list unresolved files (since hg does not list unmerged files in the status command)
-alias hgun='hg resolve --list'
function in_hg() {
if [[ -d .hg ]] || $(hg summary > /dev/null 2>&1); then
diff --git a/zsh/plugins/meteor/README.md b/zsh/plugins/meteor/README.md
index 4bee87f..f7c43b7 100644
--- a/zsh/plugins/meteor/README.md
+++ b/zsh/plugins/meteor/README.md
@@ -1,9 +1,10 @@
-## Introduction
+# meteor plugin
-The [meteor plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/meteor) provides many
+The [meteor plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/meteor) provides many
[useful aliases](#aliases) as well as completion for the `meteor` command.
Enable it by adding `meteor` to the plugins array in your zshrc file:
+
```zsh
plugins=(... meteor)
```
diff --git a/zsh/plugins/microk8s/README.md b/zsh/plugins/microk8s/README.md
new file mode 100644
index 0000000..2b4ea20
--- /dev/null
+++ b/zsh/plugins/microk8s/README.md
@@ -0,0 +1,24 @@
+# MicroK8s plugin
+
+This plugin provides completion and useful aliases for [MicroK8s](https://microk8s.io/).
+
+To use it, add `microk8s` to the plugins array in your zshrc file.
+
+```zsh
+plugins=(... microk8s)
+```
+
+## Aliases
+
+| Alias | Command | Description |
+|-------|------------------|----------------------------------------------------------------------------------------------------------|
+| mco | microk8s.config | Shows the Kubernetes config file. |
+| mct | microk8s.ctr | Interact with containerd CLI. |
+| mdi | microk8s.disable | Disables an addon. |
+| me | microk8s.enable | Enables an addon. |
+| mh | microk8s.helm | Interact with Helm CLI. |
+| mis | microk8s.istio | Interact with Istio CLI. |
+| mk | microk8s.kubectl | Interact with Kubernetes CLI. |
+| msp | microk8s.stop | Stops all Kubernetes services. |
+| mst | microk8s.start | Starts MicroK8s after it is being stopped. |
+| msts | microk8s.status | Provides an overview of the MicroK8s state (running / not running) as well as the set of enabled addons. |
\ No newline at end of file
diff --git a/zsh/plugins/microk8s/microk8s.plugin.zsh b/zsh/plugins/microk8s/microk8s.plugin.zsh
new file mode 100644
index 0000000..048a9ab
--- /dev/null
+++ b/zsh/plugins/microk8s/microk8s.plugin.zsh
@@ -0,0 +1,82 @@
+# ---------------------------------------------------------- #
+# Aliases and Completions for MicroK8s (https://microk8s.io) #
+# Author: Shaun Tabone (https://github.com/xontab) #
+# ---------------------------------------------------------- #
+
+# Helper function to cache and load completions
+_microk8s_cache_completion() {
+ local cache="${ZSH_CACHE_DIR}/microk8s_$(echo $1)_completion"
+ if [[ ! -f $cache ]]; then
+ $2 $cache
+ fi
+
+ [[ -f $cache ]] && source $cache
+}
+
+# ---------------------------------------------------------- #
+# microk8s.enable #
+# ALIAS: me #
+# ---------------------------------------------------------- #
+_microk8s_enable_get_command_list() {
+ microk8s.enable --help | tail -n +7 | awk '{$1=$1;print}'
+}
+
+_microk8s_enable() {
+ compadd -X "MicroK8s Addons" $(_microk8s_enable_get_command_list)
+}
+
+compdef _microk8s_enable microk8s.enable
+alias me='microk8s.enable'
+
+# ---------------------------------------------------------- #
+# microk8s.disable #
+# ALIAS: mdi #
+# ---------------------------------------------------------- #
+_microk8s_disable_get_command_list() {
+ microk8s.disable --help | tail -n +7 | awk '{$1=$1;print}'
+}
+
+_microk8s_disable() {
+ compadd -X "MicroK8s Addons" $(_microk8s_disable_get_command_list)
+}
+
+compdef _microk8s_disable microk8s.disable
+alias mdi='microk8s.disable'
+
+# ---------------------------------------------------------- #
+# microk8s.kubectl #
+# ALIAS: mk #
+# ---------------------------------------------------------- #
+_microk8s_kubectl_completion() {
+ if [ $commands[microk8s.kubectl] ]; then
+ microk8s.kubectl 2>/dev/null >/dev/null && microk8s.kubectl completion zsh | sed 's/__start_kubectl kubectl/__start_kubectl microk8s.kubectl/g' >$1
+ fi
+}
+
+_microk8s_cache_completion 'kubectl' _microk8s_kubectl_completion
+
+alias mk='microk8s.kubectl'
+
+# ---------------------------------------------------------- #
+# microk8s.helm #
+# ALIAS: mh #
+# ---------------------------------------------------------- #
+_microk8s_helm_completion() {
+ if [ $commands[microk8s.helm] ]; then
+ microk8s.helm completion zsh | sed 's/__start_helm helm/__start_helm microk8s.helm/g' >$1
+ fi
+}
+
+_microk8s_cache_completion 'helm' _microk8s_helm_completion
+
+alias mh='microk8s.helm'
+
+# ---------------------------------------------------------- #
+# Other Aliases #
+# ---------------------------------------------------------- #
+alias mco='microk8s.config'
+alias mct='microk8s.ctr'
+alias mis='microk8s.istio'
+alias mst='microk8s.start'
+alias msts='microk8s.status'
+alias msp='microk8s.stop'
diff --git a/zsh/plugins/minikube/minikube.plugin.zsh b/zsh/plugins/minikube/minikube.plugin.zsh
index d8ebe79..e87abce 100644
--- a/zsh/plugins/minikube/minikube.plugin.zsh
+++ b/zsh/plugins/minikube/minikube.plugin.zsh
@@ -1,6 +1,13 @@
# Autocompletion for Minikube.
#
+if (( $+commands[minikube] )); then
+ __MINIKUBE_COMPLETION_FILE="${ZSH_CACHE_DIR}/minikube_completion"
-if [ $commands[minikube] ]; then
- source <(minikube completion zsh)
+ if [[ ! -f $__MINIKUBE_COMPLETION_FILE ]]; then
+ minikube completion zsh >! $__MINIKUBE_COMPLETION_FILE
+ fi
+
+ [[ -f $__MINIKUBE_COMPLETION_FILE ]] && source $__MINIKUBE_COMPLETION_FILE
+
+ unset __MINIKUBE_COMPLETION_FILE
fi
diff --git a/zsh/plugins/mix-fast/mix-fast.plugin.zsh b/zsh/plugins/mix-fast/mix-fast.plugin.zsh
index e27e30d..564c505 100644
--- a/zsh/plugins/mix-fast/mix-fast.plugin.zsh
+++ b/zsh/plugins/mix-fast/mix-fast.plugin.zsh
@@ -12,7 +12,7 @@ _mix_does_task_list_need_generating () {
}
_mix_generate () {
- mix help | grep -v 'iex -S' | tail -n +2 | cut -d " " -f 2 > .mix_tasks
+ mix help | grep '^mix [^ ]' | sed -E "s/mix ([^ ]*) *# (.*)/\1:\2/" > .mix_tasks
}
_mix () {
@@ -21,7 +21,8 @@ _mix () {
echo "\nGenerating .mix_tasks..." > /dev/stderr
_mix_generate
fi
- compadd `cat .mix_tasks`
+ local tasks=(${(f)"$(cat .mix_tasks)"})
+ _describe 'tasks' tasks
fi
}
diff --git a/zsh/plugins/mix/_mix b/zsh/plugins/mix/_mix
index 61fa1cf..c0fe68c 100644
--- a/zsh/plugins/mix/_mix
+++ b/zsh/plugins/mix/_mix
@@ -34,6 +34,7 @@ _1st_arguments=(
'firmware:Nerves - Build a firmware image for the selected target platform'
'firmware.burn:Nerves - Writes the generated firmware image to an attached SDCard or file'
'firmware.image:Nerves - Create a firmware image file that can be copied byte-for-byte'
+ 'format:Formats the given files and patterns'
'help:Print help information for tasks'
'hex:Print hex help information'
'hex.config:Read or update hex config'
@@ -92,7 +93,7 @@ __task_list ()
local expl
declare -a tasks
- tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.presence phx.gen.schema phx.gen.secret phx.new phx.new.ecto phx.new.web phx.routes phx.server run test)
+ tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build format help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.presence phx.gen.schema phx.gen.secret phx.new phx.new.ecto phx.new.web phx.routes phx.server run test)
_wanted tasks expl 'help' compadd $tasks
}
diff --git a/zsh/plugins/mvn/README.md b/zsh/plugins/mvn/README.md
index 88f5be8..815dfd5 100644
--- a/zsh/plugins/mvn/README.md
+++ b/zsh/plugins/mvn/README.md
@@ -4,6 +4,7 @@ The mvn plugin provides many [useful aliases](#aliases) as well as completion fo
the [Apache Maven](https://maven.apache.org/) command (`mvn`).
Enable it by adding `mvn` to the plugins array in your zshrc file:
+
```zsh
plugins=(... mvn)
```
@@ -18,6 +19,7 @@ if it's found, or the mvn command otherwise.
| `mvn!` | `mvn -f /pom.xml` |
| `mvnag` | `mvn archetype:generate` |
| `mvnboot` | `mvn spring-boot:run` |
+| `mvnqdev` | `mvn quarkus:dev` |
| `mvnc` | `mvn clean` |
| `mvncd` | `mvn clean deploy` |
| `mvnce` | `mvn clean eclipse:clean eclipse:eclipse` |
@@ -35,6 +37,7 @@ if it's found, or the mvn command otherwise.
| `mvndocs` | `mvn dependency:resolve -Dclassifier=javadoc` |
| `mvndt` | `mvn dependency:tree` |
| `mvne` | `mvn eclipse:eclipse` |
+| `mvnfmt` | `mvn fmt:format` |
| `mvnjetty` | `mvn jetty:run` |
| `mvnp` | `mvn package` |
| `mvns` | `mvn site` |
@@ -55,4 +58,4 @@ has colored output, so this function will be soon removed from the plugin.
### Known bugs
It has a bug where it will swallow mvn prompts for user input, _e.g._ when using
-`archetype:generate`. See [#5052](https://github.com/robbyrussell/oh-my-zsh/issues/5052).
+`archetype:generate`. See [#5052](https://github.com/ohmyzsh/ohmyzsh/issues/5052).
diff --git a/zsh/plugins/mvn/mvn.plugin.zsh b/zsh/plugins/mvn/mvn.plugin.zsh
index 01aef81..27d63a6 100644
--- a/zsh/plugins/mvn/mvn.plugin.zsh
+++ b/zsh/plugins/mvn/mvn.plugin.zsh
@@ -59,8 +59,10 @@ alias mvnd='mvn deploy'
alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc'
alias mvndt='mvn dependency:tree'
alias mvne='mvn eclipse:eclipse'
+alias mvnfmt='mvn fmt:format'
alias mvnjetty='mvn jetty:run'
alias mvnp='mvn package'
+alias mvnqdev='mvn quarkus:dev'
alias mvns='mvn site'
alias mvnsrc='mvn dependency:sources'
alias mvnt='mvn test'
@@ -71,7 +73,7 @@ alias mvn-updates='mvn versions:display-dependency-updates'
function listMavenCompletions {
local file new_file
- local -a profiles POM_FILES
+ local -a profiles POM_FILES modules
# Root POM
POM_FILES=(~/.m2/settings.xml)
@@ -107,6 +109,9 @@ function listMavenCompletions {
profiles+=($(sed 's///' "$file" | sed '//d' | grep -e "" -A 1 | grep -e ".* " | sed 's?.*\(.*\)<\/id>.*?-P\1?'))
done
+ # List modules
+ modules=($(find **/pom.xml -type f | grep -v '/target/classes/META-INF/' | grep '/pom.xml' |sed 's|\(.*\)/pom\.xml|\1|'))
+
reply=(
# common lifecycle
clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site
@@ -183,6 +188,8 @@ function listMavenCompletions {
tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy
# spring-boot
spring-boot:run spring-boot:repackage
+ # quarkus
+ quarkus:dev quarkus:list-extensions quarkus:add-extension quarkus:add-extensions quarkus:generate-config quarkus:help
# exec
exec:exec exec:java
# versions
@@ -267,6 +274,8 @@ function listMavenCompletions {
stage:copy
# toolchain
toolchain:toolchain
+ #liberty
+ liberty:clean-server liberty:compile-jsp liberty:configure-arquillian liberty:create-server liberty:debug liberty:debug-server liberty:deploy liberty:dev liberty:display-url liberty:dump-server liberty:install-apps liberty:install-feature liberty:install-server liberty:java-dump-server liberty:package-server liberty:run liberty:run-server liberty:server-status liberty:start liberty:start-server liberty:status liberty:stop liberty:stop-server liberty:test-start-server liberty:test-stop-server liberty:undeploy liberty:uninstall-feature
# options
"-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile="
@@ -317,6 +326,7 @@ function listMavenCompletions {
-Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi)
$profiles
+ $modules
)
}
diff --git a/zsh/plugins/mysql-macports/README.md b/zsh/plugins/mysql-macports/README.md
new file mode 100644
index 0000000..ff4fb3a
--- /dev/null
+++ b/zsh/plugins/mysql-macports/README.md
@@ -0,0 +1,20 @@
+# MySQL-Macports plugin
+
+This plugin adds aliases for some of the commonly used [MySQL](https://www.mysql.com/) commands when installed using [MacPorts](https://www.macports.org/) on macOS.
+
+To use it, add `mysql-macports` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... mysql-macports)
+```
+
+For instructions on how to install MySQL using MacPorts, read the [MacPorts wiki](https://trac.macports.org/wiki/howto/MySQL/).
+
+## Aliases
+
+| Alias | Command | Description |
+| ------------ | ------------------------------------ | ------------------------------------------ |
+| mysqlstart | `sudo /path/to/mysql.server start` | Start the MySQL server. |
+| mysqlstop | `sudo /path/to/mysql.server stop` | Stop the MySQL server. |
+| mysqlrestart | `sudo /path/to/mysql.server restart` | Restart the MySQL server. |
+| mysqlstatus | `mysqladmin5 -u root -p ping` | Check whether the MySQL server is running. |
diff --git a/zsh/plugins/n98-magerun/README.md b/zsh/plugins/n98-magerun/README.md
new file mode 100644
index 0000000..b0abe47
--- /dev/null
+++ b/zsh/plugins/n98-magerun/README.md
@@ -0,0 +1,21 @@
+# n98-magerun plugin
+
+The swiss army knife for Magento developers, sysadmins and devops. The tool provides a huge set of well tested command line commands which save hours of work time.
+
+The [n98-magerun plugin](https://github.com/netz98/n98-magerun) provides many
+[useful aliases](#aliases) as well as completion for the `n98-magerun` command.
+
+Enable it by adding `n98-magerun` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... n98-magerun)
+```
+
+## Aliases
+
+| Alias | Command | Description |
+| --------- | -------------------------------------------------- | --------------------------------------------------------------------------------- |
+| n98 | `n98-magerun.phar` | The N98-Magerun phar-file (Version 1) |
+| n98-2 | `n98-magerun2.phar` | The N98-Magerun phar-file (Version 2) |
+| mage-get | `wget https://files.magerun.net/n98-magerun.phar` | Download the latest stable N98-Magerun phar-file from the file-server (Version 1) |
+| mage2-get | `wget https://files.magerun.net/n98-magerun2.phar` | Download the latest stable N98-Magerun phar-file from the file-server (Version 2) |
diff --git a/zsh/plugins/ng/README.md b/zsh/plugins/ng/README.md
index 86ad640..29ac15a 100644
--- a/zsh/plugins/ng/README.md
+++ b/zsh/plugins/ng/README.md
@@ -1,37 +1,10 @@
-## NG Plugin
+# ng plugin
-This [ng plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/ng)
- adds completion support for Angular's CLI (named ng).
+This plugin adds autocompletion support for [Angular's CLI](https://github.com/angular/angular-cli)
+(named `ng`).
-Ng is hosted on [ng home](https://github.com/catull/angular-cli)
-
-It is used to generate Angular 2 app "stubs", build those apps, configure them,
-test them, lint them etc.
-
-Ahem, "stubs" is not what Angular engineers refer to the items ng can generate
-for you.
-
-"Stubs" can be any one of:
-- class
-- component
-- directive
-- enum
-- module
-- pipe
-- route
-- service
-
-At the moment, `ng completion` creates a very rough completion for Zsh and
-Bash.
-
-It is missing most of the options and a few arguments.
-In future, this plugin may be shortened to simply being
+To use it, add `ng` to the plugins array of your zshrc file:
```zsh
-eval `ng completion`
+plugins=(... ng)
```
-
-There is hope this materialises in the 21st century.
-
-### CONTRIBUTOR
- - Carlo Dapor ([catull](https://github.com/catull))
diff --git a/zsh/plugins/nmap/README.md b/zsh/plugins/nmap/README.md
index 5cd6462..0a60068 100644
--- a/zsh/plugins/nmap/README.md
+++ b/zsh/plugins/nmap/README.md
@@ -1,37 +1,27 @@
-# Nmap aliases plugin
+# Nmap plugin
-Adds some useful aliases for nmap similar to the profiles in zenmap.
+Adds some useful aliases for [Nmap](https://nmap.org/) similar to the profiles in zenmap.
-Nmap options are:
- * -sS - TCP SYN scan
- * -v - verbose
- * -T1 - timing of scan. Options are paranoid (0), sneaky (1), polite (2), normal (3), aggressive (4), and insane (5)
- * -sF - FIN scan (can sneak through non-stateful firewalls)
- * -PE - ICMP echo discovery probe
- * -PP - timestamp discovery probe
- * -PY - SCTP init ping
- * -g - use given number as source port
- * -A - enable OS detection, version detection, script scanning, and traceroute (aggressive)
- * -O - enable OS detection
- * -sA - TCP ACK scan
- * -F - fast scan
- * --script=vulscan - also access vulnerabilities in target
+To use it, add `nmap` to the plugins array in your zshrc file:
-## Aliases explained
+```zsh
+plugins=(... nmap)
+```
- * nmap_open_ports - Scan for open ports on target
- * nmap_list_interfaces - List all network interfaces on host where the command runs
- * nmap_slow - Slow scan that avoids to spam the targets logs
- * nmap_fin - Scan to see if hosts are up with TCP FIN scan
- * nmap_full - Aggressive full scan that scans all ports, tries to determine OS and service versions
- * nmap_check_for_firewall - TCP ACK scan to check for firewall existence
- * nmap_ping_through_firewall - Host discovery with SYN and ACK probes instead of just pings to avoid firewall
- restrictions
- * nmap_fast - Fast scan of the top 300 popular ports
- * nmap_detect_versions - Detects versions of services and OS, runs on all ports
- * nmap_check_for_vulns - Uses vulscan script to check target services for vulnerabilities
- * nmap_full_udp - Same as full but via UDP
- * nmap_traceroute - Try to traceroute using the most common ports
- * nmap_full_with_scripts - Same as nmap_full but also runs all the scripts
- * nmap_web_safe_osscan - Little "safer" scan for OS version as connecting to only HTTP and HTTPS ports doesn't look so attacking.
+## Aliases
+- `nmap_open_ports`: scan for open ports on target.
+- `nmap_list_interfaces`: list all network interfaces on host where the command runs.
+- `nmap_slow`: slow scan that avoids to spam the targets logs.
+- `nmap_fin`: scan to see if hosts are up with TCP FIN scan.
+- `nmap_full`: aggressive full scan that scans all ports, tries to determine OS and service versions.
+- `nmap_check_for_firewall`: TCP ACK scan to check for firewall existence.
+- `nmap_ping_through_firewall`: host discovery with SYN and ACK probes instead of just pings to avoid firewall restrictions.
+- `nmap_fast`: fast scan of the top 300 popular ports.
+- `nmap_detect_versions`: detects versions of services and OS, runs on all ports.
+- `nmap_check_for_vulns`: uses vulscan script to check target services for vulnerabilities.
+- `nmap_full_udp`: same as full but via UDP.
+- `nmap_traceroute`: try to traceroute using the most common ports.
+- `nmap_full_with_scripts`: same as nmap_full but also runs all the scripts.
+- `nmap_web_safe_osscan`: little "safer" scan for OS version as connecting to only HTTP and HTTPS ports doesn't look so attacking.
+- `nmap_ping_scan`: ICMP scan for active hosts.
diff --git a/zsh/plugins/nmap/nmap.plugin.zsh b/zsh/plugins/nmap/nmap.plugin.zsh
index 8c691bd..406870f 100644
--- a/zsh/plugins/nmap/nmap.plugin.zsh
+++ b/zsh/plugins/nmap/nmap.plugin.zsh
@@ -29,4 +29,4 @@ alias nmap_full_udp="sudo nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443
alias nmap_traceroute="sudo nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute "
alias nmap_full_with_scripts="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all "
alias nmap_web_safe_osscan="sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy "
-
+alias nmap_ping_scan="nmap -n -sP"
diff --git a/zsh/plugins/node/README.md b/zsh/plugins/node/README.md
index c392dc0..911b669 100644
--- a/zsh/plugins/node/README.md
+++ b/zsh/plugins/node/README.md
@@ -1,16 +1,19 @@
# node plugin
+This plugin adds `node-docs` function that opens specific section in [Node.js](https://nodejs.org)
+documentation (depending on the installed version).
+
To use it, add `node` to the plugins array of your zshrc file:
+
```zsh
plugins=(... node)
```
-This plugin adds `node-docs` function that open specific section in [Node.js](https://nodejs.org) documentation (depending on the installed version).
-For example:
+## Usage
```zsh
# Opens https://nodejs.org/docs/latest-v10.x/api/fs.html
$ node-docs fs
# Opens https://nodejs.org/docs/latest-v10.x/api/path.html
-$ node-docs path
+$ node-docs path
```
diff --git a/zsh/plugins/npm/README.md b/zsh/plugins/npm/README.md
index 202e2b0..0b1a228 100644
--- a/zsh/plugins/npm/README.md
+++ b/zsh/plugins/npm/README.md
@@ -1,9 +1,10 @@
-## npm plugin
+# npm plugin
The npm plugin provides completion as well as adding many useful aliases.
To use it, add npm to the plugins array of your zshrc file:
-```
+
+```zsh
plugins=(... npm)
```
diff --git a/zsh/plugins/npm/npm.plugin.zsh b/zsh/plugins/npm/npm.plugin.zsh
index f62174a..87c68f3 100644
--- a/zsh/plugins/npm/npm.plugin.zsh
+++ b/zsh/plugins/npm/npm.plugin.zsh
@@ -1,14 +1,16 @@
(( $+commands[npm] )) && {
- __NPM_COMPLETION_FILE="${ZSH_CACHE_DIR:-$ZSH/cache}/npm_completion"
+ rm -f "${ZSH_CACHE_DIR:-$ZSH/cache}/npm_completion"
- if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
- npm completion >! $__NPM_COMPLETION_FILE 2>/dev/null
- [[ $? -ne 0 ]] && rm -f $__NPM_COMPLETION_FILE
- fi
-
- [[ -f $__NPM_COMPLETION_FILE ]] && source $__NPM_COMPLETION_FILE
-
- unset __NPM_COMPLETION_FILE
+ _npm_completion() {
+ local si=$IFS
+ compadd -- $(COMP_CWORD=$((CURRENT-1)) \
+ COMP_LINE=$BUFFER \
+ COMP_POINT=0 \
+ npm completion -- "${words[@]}" \
+ 2>/dev/null)
+ IFS=$si
+ }
+ compdef _npm_completion npm
}
# Install dependencies globally
diff --git a/zsh/plugins/nvm/README.md b/zsh/plugins/nvm/README.md
index 079cf00..749a434 100644
--- a/zsh/plugins/nvm/README.md
+++ b/zsh/plugins/nvm/README.md
@@ -1,9 +1,26 @@
# nvm plugin
-This plugin adds autocompletions for [nvm](https://github.com/creationix/nvm) — a Node.js version manager.
+This plugin adds autocompletions for [nvm](https://github.com/nvm-sh/nvm) — a Node.js version manager.
It also automatically sources nvm, so you don't need to do it manually in your `.zshrc`.
To use it, add `nvm` to the plugins array of your zshrc file:
+
```zsh
plugins=(... nvm)
```
+
+## Settings
+
+- **`NVM_DIR`**: if you have installed nvm in a directory other than `$HOME/.nvm`, set and export `NVM_DIR`
+ to be the directory where you installed nvm.
+
+- **`NVM_HOMEBREW`**: if you installed nvm via Homebrew, in a directory other than `/usr/local/opt/nvm`, you
+ can set `NVM_HOMEBREW` to be the directory where you installed it.
+
+- **`NVM_LAZY`**: if you want the plugin to defer the load of nvm to speed-up the start of your zsh session,
+ set `NVM_LAZY` to `1`. This will use the `--no-use` parameter when loading nvm, and will create a function
+ for `node`, `npm` and `yarn`, so when you call either of these three, nvm will load with `nvm use default`.
+
+- **`NVM_AUTOLOAD`**: if `NVM_AUTOLOAD` is set to `1`, the plugin will automatically load a node version when
+ if finds a [`.nvmrc` file](https://github.com/nvm-sh/nvm#nvmrc) in the current working directory indicating
+ which node version to load.
diff --git a/zsh/plugins/nvm/_nvm b/zsh/plugins/nvm/_nvm
index 1eec48b..e292a8d 100644
--- a/zsh/plugins/nvm/_nvm
+++ b/zsh/plugins/nvm/_nvm
@@ -8,6 +8,7 @@ _1st_arguments=(
'help:show help'
'--version:print out the latest released version of nvm'
'install:download and install a version in '
+ 'install-latest-npm:download and install the latest npm version'
'uninstall:uninstall a version'
'use:modify PATH to use . Uses .nvmrc if available'
'exec:run on . Uses .nvmrc if available'
diff --git a/zsh/plugins/nvm/nvm.plugin.zsh b/zsh/plugins/nvm/nvm.plugin.zsh
index 4bab8e9..1e9b26e 100644
--- a/zsh/plugins/nvm/nvm.plugin.zsh
+++ b/zsh/plugins/nvm/nvm.plugin.zsh
@@ -1,8 +1,77 @@
-# Set NVM_DIR if it isn't already defined
-[[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm"
-
-# Try to load nvm only if command not already available
-if ! type "nvm" &> /dev/null; then
- # Load nvm if it exists
- [[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
+# See https://github.com/nvm-sh/nvm#installation-and-update
+if [[ -z "$NVM_DIR" ]]; then
+ if [[ -d "$HOME/.nvm" ]]; then
+ export NVM_DIR="$HOME/.nvm"
+ elif [[ -d "${XDG_CONFIG_HOME:-$HOME/.config}/nvm" ]]; then
+ export NVM_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/nvm"
+ fi
fi
+
+# Don't try to load nvm if command already available
+which nvm &> /dev/null && return
+
+if [[ -f "$NVM_DIR/nvm.sh" ]]; then
+ # Load nvm if it exists in $NVM_DIR
+ source "$NVM_DIR/nvm.sh" ${NVM_LAZY+"--no-use"}
+else
+ # Otherwise try to load nvm installed via Homebrew
+ # User can set this if they have an unusual Homebrew setup
+ NVM_HOMEBREW="${NVM_HOMEBREW:-/usr/local/opt/nvm}"
+ # Load nvm from Homebrew location if it exists
+ if [[ -f "$NVM_HOMEBREW/nvm.sh" ]]; then
+ source "$NVM_HOMEBREW/nvm.sh" ${NVM_LAZY+"--no-use"}
+ else
+ # Exit the plugin if we couldn't find nvm
+ return
+ fi
+fi
+
+# Call nvm when first using node, npm or yarn
+if (( $+NVM_LAZY )); then
+ function node npm yarn {
+ unfunction node npm yarn
+ nvm use default
+ command "$0" "$@"
+ }
+fi
+
+# Autoload nvm when finding a .nvmrc file in the current directory
+# Adapted from: https://github.com/nvm-sh/nvm#zsh
+if (( $+NVM_AUTOLOAD )); then
+ load-nvmrc() {
+ local node_version="$(nvm version)"
+ local nvmrc_path="$(nvm_find_nvmrc)"
+
+ if [[ -n "$nvmrc_path" ]]; then
+ local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
+
+ if [[ "$nvmrc_node_version" = "N/A" ]]; then
+ nvm install
+ elif [[ "$nvmrc_node_version" != "$node_version" ]]; then
+ nvm use
+ fi
+ elif [[ "$node_version" != "$(nvm version default)" ]]; then
+ echo "Reverting to nvm default version"
+ nvm use default
+ fi
+ }
+
+ autoload -U add-zsh-hook
+ add-zsh-hook chpwd load-nvmrc
+
+ load-nvmrc
+fi
+
+# Load nvm bash completion
+for nvm_completion in "$NVM_DIR/bash_completion" "$NVM_HOMEBREW/etc/bash_completion.d/nvm"; do
+ if [[ -f "$nvm_completion" ]]; then
+ # Load bashcompinit
+ autoload -U +X bashcompinit && bashcompinit
+ # Bypass compinit call in nvm bash completion script. See:
+ # https://github.com/nvm-sh/nvm/blob/4436638/bash_completion#L86-L93
+ ZSH_VERSION= source "$nvm_completion"
+ break
+ fi
+done
+
+unset NVM_HOMEBREW NVM_LAZY NVM_AUTOLOAD nvm_completion
diff --git a/zsh/plugins/nyan/README.md b/zsh/plugins/nyan/README.md
deleted file mode 100644
index 5929418..0000000
--- a/zsh/plugins/nyan/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Nyan plugin
-
-This plugin adds a command to display [Nyan Cat](https://en.wikipedia.org/wiki/Nyan_Cat) right inside your terminal.
-
-**Plugin is deprecated**. Check [official repo](https://github.com/klange/nyancat) for more information.
\ No newline at end of file
diff --git a/zsh/plugins/nyan/nyan.plugin.zsh b/zsh/plugins/nyan/nyan.plugin.zsh
deleted file mode 100644
index c21c784..0000000
--- a/zsh/plugins/nyan/nyan.plugin.zsh
+++ /dev/null
@@ -1,10 +0,0 @@
-print -Pn '%F{yellow}'
-cat >&2 <<-EOD
- nyan plugin:
- The nyancat server used by this plugin was shut down due to increased
- bandwidth costs, so the nyan plugin no longer works. You can get the
- same functionality in some distributions by installing the nyancat package,
- or you can compile it yourself.
- See https://github.com/klange/nyancat for more information.
-EOD
-print -Pn '%f'
diff --git a/zsh/plugins/oc/README.md b/zsh/plugins/oc/README.md
new file mode 100644
index 0000000..deae9b2
--- /dev/null
+++ b/zsh/plugins/oc/README.md
@@ -0,0 +1,13 @@
+# OC - OpenShift CLI
+
+This plugin provides autocompletion for [OC](https://docs.openshift.com/container-platform/3.7/cli_reference/index.html) commands, building, managing and updating operations.
+
+To use it, add `oc` to the plugins array of your zshrc file:
+
+```bash
+plugins=(... oc)
+```
+
+## Contributors
+
++ [kevinkirkup](https://github.com/kevinkirkup) - Plugin Author
diff --git a/zsh/plugins/osx/README.md b/zsh/plugins/osx/README.md
index 4595ee3..ecc9327 100644
--- a/zsh/plugins/osx/README.md
+++ b/zsh/plugins/osx/README.md
@@ -1,8 +1,6 @@
# OSX plugin
-## Description
-
-This plugin provides a few utilities to make it more enjoyable on OSX.
+This plugin provides a few utilities to make it more enjoyable on macOS (previously named OSX).
To start using it, add the `osx` plugin to your plugins array in `~/.zshrc`:
@@ -12,6 +10,30 @@ plugins=(... osx)
Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
+## Commands
+
+| Command | Description |
+| :-------------- | :---------------------------------------------------- |
+| `tab` | Open the current directory in a new tab |
+| `split_tab` | Split the current terminal tab horizontally |
+| `vsplit_tab` | Split the current terminal tab vertically |
+| `ofd` | Open the current directory in a Finder window |
+| `pfd` | Return the path of the frontmost Finder window |
+| `pfs` | Return the current Finder selection |
+| `cdf` | `cd` to the current Finder directory |
+| `pushdf` | `pushd` to the current Finder directory |
+| `pxd` | Return the current Xcode project directory |
+| `cdx` | `cd` to the current Xcode project directory |
+| `quick-look` | Quick-Look a specified file |
+| `man-preview` | Open a specified man page in Preview app |
+| `showfiles` | Show hidden files in Finder |
+| `hidefiles` | Hide the hidden files in Finder |
+| `itunes` | _DEPRECATED_. Use `music` from macOS Catalina on |
+| `music` | Control Apple Music. Use `music -h` for usage details |
+| `spotify` | Control Spotify and search by artist, album, track… |
+| `rmdsstore` | Remove .DS\_Store files recursively in a directory |
+| `btrestart` | Restart the Bluetooth daemon |
+
## Acknowledgements
This application makes use of the following third party scripts:
@@ -38,24 +60,3 @@ 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.
-
-
-## Commands
-
-| Command | Description |
-| :-------------- | :-------------------------------------------------- |
-| `tab` | Open the current directory in a new tab |
-| `split_tab` | Split the current terminal tab horizontally |
-| `vsplit_tab` | Split the current terminal tab vertically |
-| `ofd` | Open the current directory in a Finder window |
-| `pfd` | Return the path of the frontmost Finder window |
-| `pfs` | Return the current Finder selection |
-| `cdf` | `cd` to the current Finder directory |
-| `pushdf` | `pushd` to the current Finder directory |
-| `quick-look` | Quick-Look a specified file |
-| `man-preview` | Open a specified man page in Preview app |
-| `showfiles` | Show hidden files |
-| `hidefiles` | Hide the hidden files |
-| `itunes` | Control iTunes. Use `itunes -h` for usage details |
-| `spotify` | Control Spotify and search by artist, album, track… |
-| `rmdsstore` | Remove .DS\_Store files recursively in a directory |
diff --git a/zsh/plugins/osx/_security b/zsh/plugins/osx/_security
new file mode 100644
index 0000000..e4ed585
--- /dev/null
+++ b/zsh/plugins/osx/_security
@@ -0,0 +1,90 @@
+#compdef security
+
+local -a _1st_arguments
+_1st_arguments=(
+ 'help:Show all commands, or show usage for a command'
+ 'list-keychains:Display or manipulate the keychain search list'
+ 'default-keychain:Display or set the default keychain'
+ 'login-keychain:Display or set the login keychain'
+ 'create-keychain:Create keychains and add them to the search list'
+ 'delete-keychain:Delete keychains and remove them from the search list'
+ 'lock-keychain:Lock the specified keychain'
+ 'lock-keychain:Unlock the specified keychain'
+ 'set-keychain-settings:Set settings for a keychain'
+ 'set-keychain-password:Set password for a keychain'
+ 'show-keychain-info:Show the settings for keychain'
+ 'dump-keychain:Dump the contents of one or more keychains'
+ 'create-keypair:Create an asymmetric key pair'
+ 'add-generic-password:Add a generic password item'
+ 'add-internet-password:Add an internet password item'
+ 'add-certificates:Add certificates to a keychain'
+ 'find-generic-password:Find a generic password item'
+ 'delete-generic-password:Delete a generic password item'
+ 'find-internet-password:Find an internet password item'
+ 'delete-internet-password:Delete an internet password item'
+ 'find-certificate:Find a certificate item'
+ 'find-identity:Find an identity certificate + private key'
+ 'delete-certificate:Delete a certificate from a keychain'
+ 'set-identity-preference:Set the preferred identity to use for a service'
+ 'get-identity-preference:Get the preferred identity to use for a service'
+ 'create-db:Create a db using the DL'
+ 'export:Export items from a keychain'
+ 'import:Import items into a keychain'
+ 'cms:Encode or decode CMS messages'
+ 'install-mds:MDS database'
+ 'add-trusted-cert:Add trusted certificates:'
+ 'remove-trusted-cert:Remove trusted certificates:'
+ 'dump-trust-settings:Display contents of trust settings'
+ 'user-trust-settings-enable:Display or manipulate user-level trust settings'
+ 'trust-settings-export:Export trust settings'
+ 'trust-settings-import:Import trust settings'
+ 'verify-cert:Verify certificates:'
+ 'authorize:Perform authorization operations'
+ 'authorizationdb:Make changes to the authorization policy database'
+ 'execute-with-privileges:Execute tool with privileges'
+ 'leaks:Run /usr/bin/leaks on this process'
+ 'error:Display a descriptive message for the given error codes:'
+ 'create-filevaultmaster-keychain:"Create a keychain containing a key pair for FileVault recovery use'
+)
+_arguments '*:: :->command'
+
+if (( CURRENT == 1 )); then
+ _describe -t commands "security command" _1st_arguments
+ return
+fi
+
+case "$words[1]" in
+ find-(generic|internet)-password)
+ _values \
+ 'Usage: find-[internet/generic]-password [-a account] [-s server] [options...] [-g] [keychain...]' \
+ '-a[Match "account" string]' \
+ '-c[Match "creator" (four-character code)]' \
+ '-C[Match "type" (four-character code)]' \
+ '-D[Match "kind" string]' \
+ '-G[Match "value" string (generic attribute)]' \
+ '-j[Match "comment" string]' \
+ '-l[Match "label" string]' \
+ '-s[Match "service" string]' \
+ '-g[Display the password for the item found]' \
+ '-w[Display only the password on stdout]' ;;
+ add-(generic|internet)-password)
+ _values \
+ 'Usage: add-[internet/generic]-password [-a account] [-s server] [-w password] [options...] [-A|-T appPath] [keychain]]' \
+ '-a[Specify account name (required)]' \
+ '-c[Specify item creator (optional four-character code)]' \
+ '-C[Specify item type (optional four-character code)]' \
+ '-d[Specify security domain string (optional)]' \
+ '-D[Specify kind (default is "Internet password")]' \
+ '-j[Specify comment string (optional)]' \
+ '-l[Specify label (if omitted, server name is used as default label)]' \
+ '-p[Specify path string (optional)]' \
+ '-P[Specify port number (optional)]' \
+ '-r[Specify protocol (optional four-character SecProtocolType, e.g. "http", "ftp ")]' \
+ '-s[Specify server name (required)]' \
+ '-t[Specify authentication type (as a four-character SecAuthenticationType, default is "dflt")]' \
+ '-w[Specify password to be added]' \
+ '-A[Allow any application to access this item without warning (insecure, not recommended!)]' \
+ '-T[Specify an application which may access this item (multiple -T options are allowed)]' \
+ '-U[Update item if it already exists (if omitted, the item cannot already exist) ]' \
+ 'utils)]' ;;
+esac
diff --git a/zsh/plugins/osx/music b/zsh/plugins/osx/music
new file mode 100644
index 0000000..5056679
--- /dev/null
+++ b/zsh/plugins/osx/music
@@ -0,0 +1,170 @@
+#!/usr/bin/env zsh
+
+function music itunes() {
+ local APP_NAME=Music sw_vers=$(sw_vers -productVersion 2>/dev/null)
+
+ autoload is-at-least
+ if [[ -z "$sw_vers" ]] || is-at-least 10.15 $sw_vers; then
+ if [[ $0 = itunes ]]; then
+ echo >&2 The itunes function name is deprecated. Use \'music\' instead.
+ return 1
+ fi
+ else
+ APP_NAME=iTunes
+ fi
+
+ local opt=$1 playlist=$2
+ (( $# > 0 )) && shift
+ case "$opt" in
+ launch|play|pause|stop|rewind|resume|quit)
+ ;;
+ mute)
+ opt="set mute to true"
+ ;;
+ unmute)
+ opt="set mute to false"
+ ;;
+ next|previous)
+ opt="$opt track"
+ ;;
+ vol)
+ local new_volume volume=$(osascript -e "tell application \"$APP_NAME\" to get sound volume")
+ if [[ $# -eq 0 ]]; then
+ echo "Current volume is ${volume}."
+ return 0
+ fi
+ case $1 in
+ up) new_volume=$((volume + 10 < 100 ? volume + 10 : 100)) ;;
+ down) new_volume=$((volume - 10 > 0 ? volume - 10 : 0)) ;;
+ <0-100>) new_volume=$1 ;;
+ *) echo "'$1' is not valid. Expected <0-100>, up or down."
+ return 1 ;;
+ esac
+ opt="set sound volume to ${new_volume}"
+ ;;
+ playlist)
+ # Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f
+ if [[ -n "$playlist" ]]; then
+ osascript 2>/dev/null </dev/null 2>&1 </dev/null 2>&1 <"
+ echo "option:"
+ echo "\t-h|--help\tShow this message and exit"
+ echo "\tlaunch|play|pause|stop|rewind|resume|quit"
+ echo "\tmute|unmute\tMute or unmute $APP_NAME"
+ echo "\tnext|previous\tPlay next or previous track"
+ echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
+ echo "\tvol [0-100|up|down]\tGet or set the volume. 0 to 100 sets the volume. 'up' / 'down' increases / decreases by 10 points. No argument displays current volume."
+ echo "\tplaying|status\tShow what song is currently playing in Music."
+ echo "\tplaylist [playlist name]\t Play specific playlist"
+ return 0
+ ;;
+ *)
+ print "Unknown option: $opt"
+ return 1
+ ;;
+ esac
+ osascript -e "tell application \"$APP_NAME\" to $opt"
+}
+
+function _music() {
+ local app_name
+ case "$words[1]" in
+ itunes) app_name="iTunes" ;;
+ music|*) app_name="Music" ;;
+ esac
+
+ local -a cmds subcmds
+ cmds=(
+ "launch:Launch the ${app_name} app"
+ "play:Play ${app_name}"
+ "pause:Pause ${app_name}"
+ "stop:Stop ${app_name}"
+ "rewind:Rewind ${app_name}"
+ "resume:Resume ${app_name}"
+ "quit:Quit ${app_name}"
+ "mute:Mute the ${app_name} app"
+ "unmute:Unmute the ${app_name} app"
+ "next:Skip to the next song"
+ "previous:Skip to the previous song"
+ "vol:Change the volume"
+ "playlist:Play a specific playlist"
+ {playing,status}":Show what song is currently playing"
+ {shuf,shuff,shuffle}":Set shuffle mode"
+ {-h,--help}":Show usage"
+ )
+
+ if (( CURRENT == 2 )); then
+ _describe 'command' cmds
+ elif (( CURRENT == 3 )); then
+ case "$words[2]" in
+ vol) subcmds=( 'up:Raise the volume' 'down:Lower the volume' )
+ _describe 'command' subcmds ;;
+ shuf|shuff|shuffle) subcmds=('on:Switch on shuffle mode' 'off:Switch off shuffle mode' 'toggle:Toggle shuffle mode (default)')
+ _describe 'command' subcmds ;;
+ esac
+ elif (( CURRENT == 4 )); then
+ case "$words[2]" in
+ playlist) subcmds=('play:Play the playlist (default)' 'stop:Stop the playlist')
+ _describe 'command' subcmds ;;
+ esac
+ fi
+
+ return 0
+}
+
+compdef _music music itunes
diff --git a/zsh/plugins/osx/osx.plugin.zsh b/zsh/plugins/osx/osx.plugin.zsh
index eb3c4fb..7842e9f 100644
--- a/zsh/plugins/osx/osx.plugin.zsh
+++ b/zsh/plugins/osx/osx.plugin.zsh
@@ -1,15 +1,22 @@
# Open the current directory in a Finder window
alias ofd='open_command $PWD'
+# Show/hide hidden files in the Finder
+alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
+alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
+
+# Bluetooth restart
+function btrestart() {
+ sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
+ sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
+}
+
function _omz_osx_get_frontmost_app() {
- local the_app=$(
- osascript 2>/dev/null </dev/null </dev/null <&2
+ return 1
fi
}
@@ -79,7 +82,6 @@ function vsplit_tab() {
if [[ "$the_app" == 'iTerm' ]]; then
osascript </dev/null </dev/null <&2
- false
-
+ return 1
fi
}
@@ -142,44 +140,40 @@ function split_tab() {
keystroke "${command} \n"
end tell
EOF
-
elif [[ "$the_app" == 'iTerm2' ]]; then
- osascript </dev/null </dev/null <&2
- false
-
+ return 1
fi
}
function pfd() {
osascript 2>/dev/null </dev/null < 0 )) && qlmanage -p $* &>/dev/null &
}
@@ -218,121 +227,13 @@ function vncviewer() {
open vnc://$@
}
-# iTunes control function
-function itunes() {
- local opt=$1
- local playlist=$2
- shift
- case "$opt" in
- launch|play|pause|stop|rewind|resume|quit)
- ;;
- mute)
- opt="set mute to true"
- ;;
- unmute)
- opt="set mute to false"
- ;;
- next|previous)
- opt="$opt track"
- ;;
- vol)
- local new_volume volume=$(osascript -e 'tell application "iTunes" to get sound volume')
- if [[ $# -eq 0 ]]; then
- echo "Current volume is ${volume}."
- return 0
- fi
- case $1 in
- up) new_volume=$((volume + 10 < 100 ? volume + 10 : 100)) ;;
- down) new_volume=$((volume - 10 > 0 ? volume - 10 : 0)) ;;
- <0-100>) new_volume=$1 ;;
- *) echo "'$1' is not valid. Expected <0-100>, up or down."
- return 1 ;;
- esac
- opt="set sound volume to ${new_volume}"
- ;;
- playlist)
- # Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f
-if [[ ! -z "$playlist" ]]; then
- osascript -e 'tell application "iTunes"' -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null;
- if [[ $? -eq 0 ]]; then
- opt="play"
- else
- opt="stop"
- fi
- else
- opt="set allPlaylists to (get name of every playlist)"
- fi
- ;;
- playing|status)
- local state=`osascript -e 'tell application "iTunes" to player state as string'`
- if [[ "$state" = "playing" ]]; then
- currenttrack=`osascript -e 'tell application "iTunes" to name of current track as string'`
- currentartist=`osascript -e 'tell application "iTunes" to artist of current track as string'`
- echo -E "Listening to $fg[yellow]$currenttrack$reset_color by $fg[yellow]$currentartist$reset_color";
- else
- echo "iTunes is" $state;
- fi
- return 0
- ;;
- shuf|shuff|shuffle)
- # The shuffle property of current playlist can't be changed in iTunes 12,
- # so this workaround uses AppleScript to simulate user input instead.
- # Defaults to toggling when no options are given.
- # The toggle option depends on the shuffle button being visible in the Now playing area.
- # On and off use the menu bar items.
- local state=$1
-
- if [[ -n "$state" && ! "$state" =~ "^(on|off|toggle)$" ]]
- then
- print "Usage: itunes shuffle [on|off|toggle]. Invalid option."
- return 1
- fi
-
- case "$state" in
- on|off)
- # Inspired by: https://stackoverflow.com/a/14675583
- osascript 1>/dev/null 2>&1 <<-EOF
- tell application "System Events" to perform action "AXPress" of (menu item "${state}" of menu "Shuffle" of menu item "Shuffle" of menu "Controls" of menu bar item "Controls" of menu bar 1 of application process "iTunes" )
-EOF
- return 0
- ;;
- toggle|*)
- osascript 1>/dev/null 2>&1 <<-EOF
- tell application "System Events" to perform action "AXPress" of (button 2 of process "iTunes"'s window "iTunes"'s scroll area 1)
-EOF
- return 0
- ;;
- esac
- ;;
- ""|-h|--help)
- echo "Usage: itunes "
- echo "option:"
- echo "\tlaunch|play|pause|stop|rewind|resume|quit"
- echo "\tmute|unmute\tcontrol volume set"
- echo "\tnext|previous\tplay next or previous track"
- echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
- echo "\tvol [0-100|up|down]\tGet or set the volume. 0 to 100 sets the volume. 'up' / 'down' increases / decreases by 10 points. No argument displays current volume."
- echo "\tplaying|status\tShow what song is currently playing in iTunes."
- echo "\tplaylist [playlist name]\t Play specific playlist"
- echo "\thelp\tshow this message and exit"
- return 0
- ;;
- *)
- print "Unknown option: $opt"
- return 1
- ;;
- esac
- osascript -e "tell application \"iTunes\" to $opt"
-}
-
-# Spotify control function
-source ${ZSH}/plugins/osx/spotify
-
-# Show/hide hidden files in the Finder
-alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
-alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
-
# Remove .DS_Store files recursively in a directory, default .
function rmdsstore() {
- find "${@:-.}" -type f -name .DS_Store -delete
+ find "${@:-.}" -type f -name .DS_Store -delete
}
+
+# Music / iTunes control function
+source "${0:h:A}/music"
+
+# Spotify control function
+source "${0:h:A}/spotify"
diff --git a/zsh/plugins/osx/spotify b/zsh/plugins/osx/spotify
index 39f8e04..663215a 100644
--- a/zsh/plugins/osx/spotify
+++ b/zsh/plugins/osx/spotify
@@ -148,11 +148,11 @@ if [ $# = 0 ]; then
else
if [ ! -d /Applications/Spotify.app ] && [ ! -d $HOME/Applications/Spotify.app ]; then
echo "The Spotify application must be installed."
- exit 1
+ return 1
fi
if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then
- osascript -e 'tell application "Spotify" to activate' || exit 1
+ osascript -e 'tell application "Spotify" to activate' || return 1
sleep 2
fi
fi
@@ -170,12 +170,12 @@ while [ $# -gt 0 ]; do
if [ -z "${CLIENT_ID}" ]; then
cecho "Invalid Client ID, please update ${USER_CONFIG_FILE}";
showAPIHelp;
- exit 1;
+ return 1
fi
if [ -z "${CLIENT_SECRET}" ]; then
cecho "Invalid Client Secret, please update ${USER_CONFIG_FILE}";
showAPIHelp;
- exit 1;
+ return 1
fi
SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"|tr -d '\r');
SPOTIFY_PLAY_URI="";
@@ -194,7 +194,7 @@ while [ $# -gt 0 ]; do
cecho "Autorization failed, please check ${USER_CONFG_FILE}"
cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}"
showAPIHelp
- exit 1
+ return 1
fi
SPOTIFY_ACCESS_TOKEN=$( \
printf "${SPOTIFY_TOKEN_RESPONSE_DATA}" \
@@ -307,7 +307,7 @@ while [ $# -gt 0 ]; do
"quit" ) cecho "Quitting Spotify.";
osascript -e 'tell application "Spotify" to quit';
- exit 0 ;;
+ break ;;
"next" ) cecho "Going to next track." ;
osascript -e 'tell application "Spotify" to next track';
@@ -358,7 +358,7 @@ while [ $# -gt 0 ]; do
echo " vol down # Decreases the volume by 10%.";
echo " vol [amount] # Sets the volume to an amount between 0 and 100.";
echo " vol # Shows the current Spotify volume.";
- exit 1;
+ return 1
fi
osascript -e "tell application \"Spotify\" to set sound volume to $newvol";
@@ -468,9 +468,10 @@ while [ $# -gt 0 ]; do
"help" )
showHelp;
break ;;
+
* )
showHelp;
- exit 1;
+ return 1 ;;
esac
done
diff --git a/zsh/plugins/otp/README.md b/zsh/plugins/otp/README.md
new file mode 100644
index 0000000..8331fd0
--- /dev/null
+++ b/zsh/plugins/otp/README.md
@@ -0,0 +1,22 @@
+# otp plugin
+
+This plugin allows you to create one-time passwords using [`oathtool`](https://www.nongnu.org/oath-toolkit/man-oathtool.html),
+able to replace MFA devices. The oathtool key is kept in a GPG-encrypted file so the codes
+can only be generated by a user able to decrypt it.
+
+To use it, add `otp` to the plugins array in your zshrc file:
+```zsh
+plugins=(... otp)
+```
+
+Provided aliases:
+
+- `otp_add_device`: creates a new encrypted storage for an oathtool key and stores it
+ on the disk. For encrypting the key, it will ask for a GPG user ID (your GPG key's
+ email address). Then the OTP key needs to be pasted, followed by a CTRL+D character
+ inserted on an empty line.
+
+- `ot`: generates a MFA code based on the given key and copies it to the clipboard
+ (on Linux it relies on xsel, on MacOS X it uses pbcopy instead).
+
+The plugin uses `$HOME/.otp` to store its internal files.
diff --git a/zsh/plugins/otp/otp.plugin.zsh b/zsh/plugins/otp/otp.plugin.zsh
index 4bce34f..8be125c 100644
--- a/zsh/plugins/otp/otp.plugin.zsh
+++ b/zsh/plugins/otp/otp.plugin.zsh
@@ -12,32 +12,23 @@ function ot () {
return 1
fi
- if [[ `uname` == 'Darwin' ]] then # MacOS X
- export COPY_CMD='pbcopy'
- elif command -v xsel > /dev/null 2>&1; then # Any Unix with xsel installed
- export COPY_CMD='xsel --clipboard --input'
- else
- COPY_CMD='true'
- fi
+ COPY_CMD='true'
- if [[ "x$1" == "x" ]]; then
- echo "usage: otpw "
+ if [[ -z "$1" ]]; then
+ echo "usage: $0 "
return 1
elif [ ! -f $OTP_HOME/$1.otp.asc ]; then
echo "missing profile $1, you might need to create it first using otp_add_device"
return 1
else
totpkey=$(gpg --decrypt $OTP_HOME/$1.otp.asc)
- oathtool --totp --b $totpkey | tee /dev/stderr | `echo $COPY_CMD`
- if [[ $COPY_CMD == 'true' ]] then
- echo "Note: you might consider installing xsel for clipboard integration"
- fi
+ oathtool --totp --b $totpkey | tee /dev/stderr | clipcopy
fi
}
function otp_add_device () {
if [[ "x$1" == "x" ]] then
- echo "usage: otp_add "
+ echo "usage: $0 "
return 1
else
echo "Enter an email address attached to your GPG private key, then paste the secret configuration key followed by ^D"
diff --git a/zsh/plugins/pass/README.md b/zsh/plugins/pass/README.md
new file mode 100644
index 0000000..2b07049
--- /dev/null
+++ b/zsh/plugins/pass/README.md
@@ -0,0 +1,22 @@
+# pass
+
+This plugin provides completion for the [pass](https://www.passwordstore.org/) password manager.
+
+To use it, add `pass` to the plugins array in your zshrc file.
+
+```
+plugins=(... pass)
+```
+
+## Configuration
+
+### Multiple repositories
+
+If you use multiple repositories, you can configure completion like this:
+```zsh
+compdef _pass workpass
+zstyle ':completion::complete:workpass::' prefix "$HOME/work/pass"
+workpass() {
+ PASSWORD_STORE_DIR=$HOME/work/pass pass $@
+}
+```
diff --git a/zsh/plugins/pass/_pass b/zsh/plugins/pass/_pass
index 5f3b8f5..75f3feb 100644
--- a/zsh/plugins/pass/_pass
+++ b/zsh/plugins/pass/_pass
@@ -10,6 +10,14 @@
# Please visit https://git.zx2c4.com/password-store/tree/COPYING for more information.
+# If you use multiple repositories, you can configure completion like this:
+#
+# compdef _pass workpass
+# zstyle ':completion::complete:workpass::' prefix "$HOME/work/pass"
+# workpass() {
+# PASSWORD_STORE_DIR=$HOME/work/pass pass $@
+# }
+
# If you use multiple repositories, you can configure completion like this:
#
# compdef _pass workpass
diff --git a/zsh/plugins/paver/README.md b/zsh/plugins/paver/README.md
new file mode 100644
index 0000000..c38d898
--- /dev/null
+++ b/zsh/plugins/paver/README.md
@@ -0,0 +1,12 @@
+# Paver
+
+This plugin adds completion for the `paver` command-line tool of [Paver](https://pythonhosted.org/Paver/).
+
+To use it, add `paver` to the plugins array of your zshrc file:
+```zsh
+plugins=(... paver)
+```
+
+The completion function creates a cache of paver tasks with the name `.paver_tasks`,
+in the current working directory. It regenerates that cache when the `pavement.py`
+changes.
diff --git a/zsh/plugins/paver/paver.plugin.zsh b/zsh/plugins/paver/paver.plugin.zsh
index 40bdbd1..7e70ea3 100644
--- a/zsh/plugins/paver/paver.plugin.zsh
+++ b/zsh/plugins/paver/paver.plugin.zsh
@@ -1,7 +1,7 @@
_paver_does_target_list_need_generating () {
- [ ! -f .paver_targets ] && return 0;
- [ pavement.py -nt .paver_targets ] && return 0;
- return 1;
+ [ ! -f .paver_targets ] && return 0
+ [ pavement.py -nt .paver_targets ] && return 0
+ return 1
}
_paver () {
diff --git a/zsh/plugins/percol/README.md b/zsh/plugins/percol/README.md
index b262e41..ec5de4f 100644
--- a/zsh/plugins/percol/README.md
+++ b/zsh/plugins/percol/README.md
@@ -1,6 +1,6 @@
## percol
-Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and [jump plugin](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh)
+Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and [jump plugin](https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/jump/jump.plugin.zsh)
### Requirements
@@ -8,7 +8,7 @@ Provides some useful function to make [percol](https://github.com/mooz/percol) w
pip install percol
```
-And [jump](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh) for `oh-my-zsh` is a optional requirement.
+And [jump](https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/jump/jump.plugin.zsh) for `oh-my-zsh` is a optional requirement.
### Usage
diff --git a/zsh/plugins/perl/README.md b/zsh/plugins/perl/README.md
new file mode 100644
index 0000000..dd9b7dc
--- /dev/null
+++ b/zsh/plugins/perl/README.md
@@ -0,0 +1,37 @@
+# Perl
+
+This plugin adds [perl](https://www.perl.org/) useful aliases/functions.
+
+To use it, add `perl` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... perl)
+```
+
+## Aliases
+
+| Aliases | Command | Description |
+| :------------ | :----------------- | :------------------------------------- |
+| pbi | `perlbrew install` | Install specific perl version |
+| pbl | `perlbrew list` | List all perl version installed |
+| pbo | `perlbrew off` | Go back to the system perl |
+| pbs | `perlbrew switch` | Turn it back on |
+| pbu | `perlbrew use` | Use specific version of perl |
+| pd | `perldoc` | Show the perl documentation |
+| ple | `perl -wlne` | Use perl like awk/sed |
+| latest-perl | `curl ...` | Show the latest stable release of Perl |
+
+## Functions
+
+* `newpl`: creates a basic Perl script file and opens it with $EDITOR.
+
+* `pgs`: Perl Global Substitution: `pgs `
+ Looks for `` and replaces it with `` in ``.
+
+* `prep`: Perl grep, because 'grep -P' is terrible: `prep []`
+ Lets you work with pipes or files (if no `` provided, use stdin).
+
+## Requirements
+
+In order to make this work, you will need to have perl installed.
+More info on the usage and install: https://www.perl.org/get.html
diff --git a/zsh/plugins/perms/README.md b/zsh/plugins/perms/README.md
index 324b3f3..ae7a36b 100644
--- a/zsh/plugins/perms/README.md
+++ b/zsh/plugins/perms/README.md
@@ -1,9 +1,15 @@
-## Perms
+# Perms plugin
-Plugin to handle some unix filesystem permissions quickly
+Plugin to handle some unix filesystem permissions quickly.
-### Usage
+To use it, add `perms` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... perms)
+```
+
+## Usage
* `set755` recursively sets all given directories (default to .) to octal 755.
* `set644` recursively sets all given files (default to .) to octal 644.
-* `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases.
+* `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases.
diff --git a/zsh/plugins/phing/README.md b/zsh/plugins/phing/README.md
new file mode 100644
index 0000000..84d1d18
--- /dev/null
+++ b/zsh/plugins/phing/README.md
@@ -0,0 +1,9 @@
+# Phing plugin
+
+This plugin adds autocompletion for [`phing`](https://github.com/phingofficial/phing) targets.
+
+To use it, add `phing` to the plugins array of your `.zshrc` file:
+
+```zsh
+plugins=(... phing)
+```
diff --git a/zsh/plugins/pip/README.md b/zsh/plugins/pip/README.md
new file mode 100644
index 0000000..f07b5c0
--- /dev/null
+++ b/zsh/plugins/pip/README.md
@@ -0,0 +1,19 @@
+# pip plugin
+
+This plugin adds completion for [pip](https://pip.pypa.io/en/latest/),
+the Python package manager.
+
+To use it, add `pip` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... pip)
+```
+
+## pip cache
+
+The pip plugin caches the names of available pip packages from the PyPI index.
+To trigger the caching process, try to complete `pip install`,
+or you can run `zsh-pip-cache-packages` directly.
+
+To reset the cache, run `zsh-pip-clear-cache` and it will be rebuilt next
+the next time you autocomplete `pip install`.
diff --git a/zsh/plugins/pip/_pip b/zsh/plugins/pip/_pip
index 607f68e..a5adead 100644
--- a/zsh/plugins/pip/_pip
+++ b/zsh/plugins/pip/_pip
@@ -89,6 +89,7 @@ case "$words[1]" in
if [[ "$state" == packages ]]; then
_pip_all
_wanted piplist expl 'packages' compadd -a piplist
+ _files -g "*.(tar.gz|whl)"
fi ;;
uninstall)
_pip_installed
diff --git a/zsh/plugins/pip/pip.plugin.zsh b/zsh/plugins/pip/pip.plugin.zsh
index aaae901..a46e765 100644
--- a/zsh/plugins/pip/pip.plugin.zsh
+++ b/zsh/plugins/pip/pip.plugin.zsh
@@ -9,7 +9,11 @@
# If you would like to clear your cache, go ahead and do a
# "zsh-pip-clear-cache".
-ZSH_PIP_CACHE_FILE=~/.pip/zsh-cache
+if [[ -d "${XDG_CACHE_HOME:-$HOME/.cache}/pip" ]]; then
+ ZSH_PIP_CACHE_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/pip/zsh-cache"
+else
+ ZSH_PIP_CACHE_FILE=~/.pip/zsh-cache
+fi
ZSH_PIP_INDEXES=(https://pypi.org/simple/)
zsh-pip-clear-cache() {
diff --git a/zsh/plugins/pipenv/pipenv.plugin.zsh b/zsh/plugins/pipenv/pipenv.plugin.zsh
index 0a5dc56..4be61a9 100644
--- a/zsh/plugins/pipenv/pipenv.plugin.zsh
+++ b/zsh/plugins/pipenv/pipenv.plugin.zsh
@@ -1,13 +1,13 @@
# Pipenv completion
_pipenv() {
- eval $(env COMMANDLINE="${words[1,$CURRENT]}" _PIPENV_COMPLETE=complete-zsh pipenv)
+ eval $(env COMMANDLINE="${words[1,$CURRENT]}" _PIPENV_COMPLETE=complete-zsh pipenv)
}
compdef _pipenv pipenv
# Automatic pipenv shell activation/deactivation
_togglePipenvShell() {
# deactivate shell if Pipfile doesn't exist and not in a subdir
- if [[ ! -a "$PWD/Pipfile" ]]; then
+ if [[ ! -f "$PWD/Pipfile" ]]; then
if [[ "$PIPENV_ACTIVE" == 1 ]]; then
if [[ "$PWD" != "$pipfile_dir"* ]]; then
exit
@@ -17,13 +17,15 @@ _togglePipenvShell() {
# activate the shell if Pipfile exists
if [[ "$PIPENV_ACTIVE" != 1 ]]; then
- if [[ -a "$PWD/Pipfile" ]]; then
+ if [[ -f "$PWD/Pipfile" ]]; then
export pipfile_dir="$PWD"
pipenv shell
fi
fi
}
-chpwd_functions+=(_togglePipenvShell)
+autoload -U add-zsh-hook
+add-zsh-hook chpwd _togglePipenvShell
+_togglePipenvShell
# Aliases
alias pch="pipenv check"
diff --git a/zsh/plugins/pod/README.md b/zsh/plugins/pod/README.md
new file mode 100644
index 0000000..0a3cc7a
--- /dev/null
+++ b/zsh/plugins/pod/README.md
@@ -0,0 +1,10 @@
+# pod
+
+This plugin adds completion for [`CocoaPods`](https://cocoapods.org/).
+CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects.
+
+To use it, add `pod` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... pod)
+```
diff --git a/zsh/plugins/pow/README.md b/zsh/plugins/pow/README.md
new file mode 100644
index 0000000..1f8a9d1
--- /dev/null
+++ b/zsh/plugins/pow/README.md
@@ -0,0 +1,21 @@
+# pow plugin
+
+This plugin adds completion and commands for [pow](http://pow.cx/), a
+zero-configuration Rack server for macOS.
+
+To use it, add pow to the plugins array of your zshrc file:
+
+```sh
+plugins=(... pow)
+```
+
+## Commands
+
+- `kapow` will restart an app.
+
+ ```bash
+ kapow myapp
+ ```
+
+- `kaput` will show the standard output from any pow app.
+- `repow` will restart the pow process.
diff --git a/zsh/plugins/powder/README.md b/zsh/plugins/powder/README.md
new file mode 100644
index 0000000..a83b1f2
--- /dev/null
+++ b/zsh/plugins/powder/README.md
@@ -0,0 +1,8 @@
+# Powder
+
+This plugin provides completion for [powder](https://github.com/powder-rb/powder/).
+
+To use it, add powder to the plugins array of your zshrc file:
+```
+plugins=(... powder)
+```
diff --git a/zsh/plugins/powify/README.md b/zsh/plugins/powify/README.md
new file mode 100644
index 0000000..fd58b86
--- /dev/null
+++ b/zsh/plugins/powify/README.md
@@ -0,0 +1,10 @@
+# powify plugin
+
+This plugin adds autocompletion for [powify](https://github.com/sethvargo/powify),
+an easy-to-use wrapper for Basecamp's [pow](https://github.com/basecamp/pow).
+
+To use it, add powify to the plugins array of your zshrc file:
+
+```sh
+plugins=(... powify)
+```
diff --git a/zsh/plugins/profiles/README.md b/zsh/plugins/profiles/README.md
new file mode 100644
index 0000000..5aa1918
--- /dev/null
+++ b/zsh/plugins/profiles/README.md
@@ -0,0 +1,25 @@
+# profiles plugin
+
+This plugin allows you to create separate configuration files for zsh based
+on your long hostname (including the domain).
+
+To use it, add profiles to the plugins array of your zshrc file:
+
+```sh
+plugins=(... profiles)
+```
+
+It takes your `$HOST` variable and looks for files named according to the
+domain parts in `$ZSH_CUSTOM/profiles/` directory.
+
+For example, for `HOST=host.domain.com`, it will try to load the following files,
+in this order:
+
+```text
+$ZSH_CUSTOM/profiles/com
+$ZSH_CUSTOM/profiles/domain.com
+$ZSH_CUSTOM/profiles/host.domain.com
+```
+
+This means that if there are conflicting settings on those files, the one to take
+precedence will be the last applied, i.e. the one in host.domain.com.
diff --git a/zsh/plugins/pyenv/README.md b/zsh/plugins/pyenv/README.md
new file mode 100644
index 0000000..d063b55
--- /dev/null
+++ b/zsh/plugins/pyenv/README.md
@@ -0,0 +1,16 @@
+# pyenv
+
+This plugin looks for [pyenv](https://github.com/pyenv/pyenv), a Simple Python version
+management system, and loads it if it's found. It also loads pyenv-virtualenv, a pyenv
+plugin to manage virtualenv, if it's found.
+
+To use it, add `pyenv` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... pyenv)
+```
+
+## Functions
+
+- `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python
+ version, if pyenv wasn't found.
diff --git a/zsh/plugins/pyenv/pyenv.plugin.zsh b/zsh/plugins/pyenv/pyenv.plugin.zsh
index 40e58b5..82ba6ff 100644
--- a/zsh/plugins/pyenv/pyenv.plugin.zsh
+++ b/zsh/plugins/pyenv/pyenv.plugin.zsh
@@ -1,7 +1,12 @@
# This plugin loads pyenv into the current shell and provides prompt info via
# the 'pyenv_prompt_info' function. Also loads pyenv-virtualenv if available.
-FOUND_PYENV=$+commands[pyenv]
+# Load pyenv only if command not already available
+if command -v pyenv &> /dev/null && [[ "$(uname -r)" != *icrosoft* ]]; then
+ FOUND_PYENV=1
+else
+ FOUND_PYENV=0
+fi
if [[ $FOUND_PYENV -ne 1 ]]; then
pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv" "/usr/local/opt/pyenv")
@@ -24,7 +29,7 @@ if [[ $FOUND_PYENV -ne 1 ]]; then
fi
if [[ $FOUND_PYENV -eq 1 ]]; then
- eval "$(pyenv init - zsh)"
+ eval "$(pyenv init - --no-rehash zsh)"
if (( $+commands[pyenv-virtualenv-init] )); then
eval "$(pyenv virtualenv-init - zsh)"
fi
diff --git a/zsh/plugins/pylint/README.md b/zsh/plugins/pylint/README.md
index 8c1de88..31710d8 100644
--- a/zsh/plugins/pylint/README.md
+++ b/zsh/plugins/pylint/README.md
@@ -1,6 +1,7 @@
-# pylint
+# pylint
-This plugin adds code analysis for python through [Pylint](https://www.pylint.org/).
+This plugin adds aliases and autocompletion for [Pylint](https://www.pylint.org/),
+the Python code style checking tool.
To use it, add `pylint` to the plugins array in your zshrc file:
@@ -12,4 +13,4 @@ plugins=(... pylint)
| Alias | Command | Description |
| -------------| -------------------- | -------------------------------------------------------------------------------------------------------------------------|
-| pylint-quick | `pylint --reports=n` | Displays a set of reports each one focusing on a particular aspect of the project, default set `no` for multiple reports | |
+| pylint-quick | `pylint --reports=n` | Displays a set of reports each one focusing on a particular aspect of the project, default set `no` for multiple reports |
diff --git a/zsh/plugins/pylint/pylint.plugin.zsh b/zsh/plugins/pylint/pylint.plugin.zsh
index 57c7c0a..14cea5b 100644
--- a/zsh/plugins/pylint/pylint.plugin.zsh
+++ b/zsh/plugins/pylint/pylint.plugin.zsh
@@ -1,3 +1 @@
-# Aliases
alias pylint-quick='pylint --reports=n'
-compdef _pylint-quick pylint-quick='pylint --reports=n'
diff --git a/zsh/plugins/python/README.md b/zsh/plugins/python/README.md
index 2d955c5..0180218 100644
--- a/zsh/plugins/python/README.md
+++ b/zsh/plugins/python/README.md
@@ -11,6 +11,8 @@ plugins=(... python)
| Command | Description |
|------------------|---------------------------------------------------------------------------------|
+| `ipython` | Runs the appropriate `ipython` version according to the activated virtualenv |
| `pyfind` | Finds .py files recursively in the current directory |
| `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one |
| `pygrep ` | Looks for `text` in .py files |
+| `pyuserpaths` | Add --user site-packages to PYTHONPATH, for all installed python versions. |
diff --git a/zsh/plugins/python/python.plugin.zsh b/zsh/plugins/python/python.plugin.zsh
index f754ea2..c3c1474 100644
--- a/zsh/plugins/python/python.plugin.zsh
+++ b/zsh/plugins/python/python.plugin.zsh
@@ -1,15 +1,47 @@
# Find python file
alias pyfind='find . -name "*.py"'
-# Remove python compiled byte-code and mypy cache in either current directory or in a
-# list of specified directories
+# Remove python compiled byte-code and mypy/pytest cache in either the current
+# directory or in a list of specified directories (including sub directories).
function pyclean() {
ZSH_PYCLEAN_PLACES=${*:-'.'}
find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete
find ${ZSH_PYCLEAN_PLACES} -type d -name "__pycache__" -delete
- find ${ZSH_PYCLEAN_PLACES} -type d -name ".mypy_cache" -delete
+ find ${ZSH_PYCLEAN_PLACES} -depth -type d -name ".mypy_cache" -exec rm -r "{}" +
+ find ${ZSH_PYCLEAN_PLACES} -depth -type d -name ".pytest_cache" -exec rm -r "{}" +
+}
+
+# Add the user installed site-packages paths to PYTHONPATH, only if the
+# directory exists. Also preserve the current PYTHONPATH value.
+# Feel free to autorun this when .zshrc loads.
+function pyuserpaths() {
+ local targets=("python2" "python3") # bins
+
+ # Get existing interpreters.
+ local interps=()
+ for target in $targets; do
+ [ `command -v $target` ] && interps+=($target)
+ done
+
+ # Check for a non-standard install directory.
+ local user_base="${HOME}/.local"
+ [ $PYTHONUSERBASE ] && user_base=$PYTHONUSERBASE
+
+ # Add version specific paths, if:
+ # it exists in the filesystem;
+ # it isn't in PYTHONPATH already.
+ for interp in $interps; do
+ # Get minor release version.
+ local ver=`$interp -V 2>&1`
+ ver=`echo ${ver:7} | cut -d '.' -f 1,2` # The patch version is variable length, truncate it.
+
+ local site_pkgs="${user_base}/lib/python${ver}/site-packages"
+ [[ -d $site_pkgs && ! $PYTHONPATH =~ $site_pkgs ]] && export PYTHONPATH=${site_pkgs}:$PYTHONPATH
+ done
}
# Grep among .py files
-alias pygrep='grep --include="*.py"'
+alias pygrep='grep -nr --include="*.py"'
+# Run proper IPython regarding current virtualenv (if any)
+alias ipython="python -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'"
diff --git a/zsh/plugins/rails/README.md b/zsh/plugins/rails/README.md
index 5549ba1..9fb1cec 100644
--- a/zsh/plugins/rails/README.md
+++ b/zsh/plugins/rails/README.md
@@ -18,7 +18,7 @@ plugins=(... rails)
| `rcs` | `rails console --sandbox` | Test code in a sandbox, without changing any data |
| `rd` | `rails destroy` | Undo a generate operation |
| `rdb` | `rails dbconsole` | Interact with your db from the console |
-| `rgen` | `rails generate` | Generate boilerplate code |
+| `rgen`| `rails generate` | Generate boilerplate code |
| `rgm` | `rails generate migration` | Generate a db migration |
| `rp` | `rails plugin` | Run a Rails plugin command |
| `ru` | `rails runner` | Run Ruby code in the context of Rails |
@@ -44,7 +44,7 @@ plugins=(... rails)
| `rlc` | `rake log:clear` | Clear Rails logs |
| `rn` | `rake notes` | Search for notes (`FIXME`, `TODO`) in code comments |
| `rr` | `rake routes` | List all defined routes |
-| `rrg` | `rake routes | grep` | List and filter the defined routes |
+| `rrg` | `rake routes \| grep` | List and filter the defined routes |
| `rt` | `rake test` | Run Rails tests |
| `rmd` | `rake middleware` | Interact with Rails middlewares |
| `rsts` | `rake stats` | Print code statistics |
@@ -80,4 +80,3 @@ separately. For example: `REP rake db:migrate` will migrate the production db.
| `ssp` | `ruby script/spec` |
| `sc` | `ruby script/console` |
| `sd` | `ruby script/server --debugger` |
-
diff --git a/zsh/plugins/rails/rails.plugin.zsh b/zsh/plugins/rails/rails.plugin.zsh
index a8ec79d..1fd5f0f 100644
--- a/zsh/plugins/rails/rails.plugin.zsh
+++ b/zsh/plugins/rails/rails.plugin.zsh
@@ -17,7 +17,7 @@ function _rake_command () {
bin/stubs/rake $@
elif [ -e "bin/rake" ]; then
bin/rake $@
- elif type bundle &> /dev/null && [ -e "Gemfile" ]; then
+ elif type bundle &> /dev/null && ([ -e "Gemfile" ] || [ -e "gems.rb" ]); then
bundle exec rake $@
else
command rake $@
diff --git a/zsh/plugins/rake/README.md b/zsh/plugins/rake/README.md
new file mode 100644
index 0000000..e888c07
--- /dev/null
+++ b/zsh/plugins/rake/README.md
@@ -0,0 +1,37 @@
+# Rake plugin
+
+This plugin adds support for [rake](https://ruby.github.io/rake/), the Ruby
+build tool or Ruby Make.
+
+To use it, add `rake` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... rake)
+```
+
+## Aliases
+
+The plugin aliases the rake command so you can pass arguments when invoking rake tasks
+without having to escape the brackets, i.e., you can run
+```
+rake namespace:task['argument']
+```
+instead of having to do
+```
+rake namespace:task\['argument'\]
+```
+
+| Alias | Command | Description |
+|--------|--------------------------------|-----------------------------------------------|
+| rake | `noglob rake` | Allows unescaped square brackets |
+| brake | `noglob bundle exec rake` | Same as above but call rake using bundler |
+| srake | `noglob sudo rake` | Same as rake but using sudo |
+| sbrake | `noglob sudo bundle exec rake` | Same as above but using both sudo and bundler |
+
+## Jim Weirich
+
+The plugin also aliases `rake` to [`jimweirich`](https://github.com/jimweirich), author of Rake
+and big time contributor to the Ruby open source community. He passed away in 2014:
+
+> Thank you Jim for everything you contributed to the Ruby and open source community
+> over the years. We will miss you dearly. — [**@robbyrussell**](https://github.com/ohmyzsh/ohmyzsh/commit/598a9c6f990756386517d66b6bcf77e53791e905)
diff --git a/zsh/plugins/rbenv/README.md b/zsh/plugins/rbenv/README.md
new file mode 100644
index 0000000..43a2e93
--- /dev/null
+++ b/zsh/plugins/rbenv/README.md
@@ -0,0 +1,26 @@
+# rbenv plugin
+
+The primary job of this plugin is to provide `rbenv_prompt_info` which can be added to your theme to include Ruby
+version and gemset information into your prompt.
+
+Some functionality of this plugin will not work unless you also have the rbenv plugin *gemset* installed.
+https://github.com/jf/rbenv-gemset
+
+To use it, add `rbenv` to the plugins array in your zshrc file:
+```zsh
+plugins=(... rbenv)
+```
+
+## Alias
+
+| Alias | Command | Description |
+|----------------|---------------------|----------------------------------|
+| rubies | `rbenv versions` | List the installed Ruby versions |
+| gemsets | `rbenv gemset list` | List the existing gemsets |
+
+## Functions
+
+* `current_ruby`: The version of Ruby currently being used.
+* `current_gemset`: The name of the current gemset.
+* `gems`: Lists installed gems with enhanced formatting and color.
+* `rbenv_prompt_info`: For adding information to your prompt. Format: `@`.
diff --git a/zsh/plugins/rbenv/rbenv.plugin.zsh b/zsh/plugins/rbenv/rbenv.plugin.zsh
index ed46d35..0f2d366 100644
--- a/zsh/plugins/rbenv/rbenv.plugin.zsh
+++ b/zsh/plugins/rbenv/rbenv.plugin.zsh
@@ -34,7 +34,7 @@ if [[ $FOUND_RBENV -eq 1 ]]; then
}
function current_gemset() {
- echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)"
+ echo "$(rbenv gemset active 2>/dev/null)" | tr ' ' '+'
}
function gems() {
@@ -47,11 +47,10 @@ if [[ $FOUND_RBENV -eq 1 ]]; then
}
function rbenv_prompt_info() {
- if [[ -n $(current_gemset) ]] ; then
- echo "$(current_ruby)@$(current_gemset)"
- else
- echo "$(current_ruby)"
- fi
+ local ruby=$(current_ruby) gemset=$(current_gemset)
+ echo -n "${ZSH_THEME_RUBY_PROMPT_PREFIX}"
+ [[ -n "$gemset" ]] && echo -n "${ruby}@${gemset}" || echo -n "${ruby}"
+ echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
}
else
alias rubies="ruby -v"
@@ -59,7 +58,11 @@ else
function current_ruby() { echo "not supported" }
function current_gemset() { echo "not supported" }
function gems() { echo "not supported" }
- function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" }
+ function rbenv_prompt_info() {
+ echo -n "${ZSH_THEME_RUBY_PROMPT_PREFIX}"
+ echo -n "system: $(ruby -v | cut -f-2 -d ' ')"
+ echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
+ }
fi
unset FOUND_RBENV rbenvdirs dir
diff --git a/zsh/plugins/rbfu/README.md b/zsh/plugins/rbfu/README.md
new file mode 100644
index 0000000..f1f9fa2
--- /dev/null
+++ b/zsh/plugins/rbfu/README.md
@@ -0,0 +1,17 @@
+# rbfu plugin
+
+This plugin starts [rbfu](https://github.com/hmans/rbfu), a minimal Ruby version
+manager, and adds some useful functions.
+
+To use it, add `rbfu` to the plugins array in your zshrc file:
+```zsh
+plugins=(... rbfu)
+```
+
+**Note: `rbfu` is deprecated and should no longer be used.**
+
+## Functions
+
+- `rbfu-rubies`: lists all installed rubies available to rbfu.
+
+- `rvm_prompt_info`: shows the Ruby version being used with rbfu.
diff --git a/zsh/plugins/react-native/README.md b/zsh/plugins/react-native/README.md
index dc02071..d0a53b8 100644
--- a/zsh/plugins/react-native/README.md
+++ b/zsh/plugins/react-native/README.md
@@ -39,6 +39,9 @@ plugins=(... react-native)
| **rniosxs** | `react-native run-ios --simulator "iPhone Xs"` |
| **rniosxsm** | `react-native run-ios --simulator "iPhone Xs Max"` |
| **rniosxr** | `react-native run-ios --simulator "iPhone Xʀ"` |
+| **rnios11** | `react-native run-ios --simulator "iPhone 11"` |
+| **rnios11p** | `react-native run-ios --simulator "iPhone 11 Pro"` |
+| **rnios11pm** | `react-native run-ios --simulator "iPhone 11 Pro Max"` |
| _iPad_ | |
| **rnipad2** | `react-native run-ios --simulator "iPad 2"` |
| **rnipad5** | `react-native run-ios --simulator "iPad (5th generation)"` |
diff --git a/zsh/plugins/react-native/react-native.plugin.zsh b/zsh/plugins/react-native/react-native.plugin.zsh
index f7695d1..b33dedf 100644
--- a/zsh/plugins/react-native/react-native.plugin.zsh
+++ b/zsh/plugins/react-native/react-native.plugin.zsh
@@ -24,6 +24,10 @@ alias rniosx='react-native run-ios --simulator "iPhone X"'
alias rniosxs='react-native run-ios --simulator "iPhone Xs"'
alias rniosxsm='react-native run-ios --simulator "iPhone Xs Max"'
alias rniosxr='react-native run-ios --simulator "iPhone Xʀ"'
+alias rnios11='react-native run-ios --simulator "iPhone 11"'
+alias rnios11p='react-native run-ios --simulator "iPhone 11 Pro"'
+alias rnios11pm='react-native run-ios --simulator "iPhone 11 Pro Max"'
+
# iPad
alias rnipad2='react-native run-ios --simulator "iPad 2"'
diff --git a/zsh/plugins/rebar/README.md b/zsh/plugins/rebar/README.md
new file mode 100644
index 0000000..456ba45
--- /dev/null
+++ b/zsh/plugins/rebar/README.md
@@ -0,0 +1,9 @@
+# rebar plugin
+
+This plugin adds completions for the [rebar](https://www.rebar3.org/) Erlang build tool.
+
+To use it, add `rebar` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... rebar)
+```
diff --git a/zsh/plugins/redis-cli/README.md b/zsh/plugins/redis-cli/README.md
new file mode 100644
index 0000000..bb6e94a
--- /dev/null
+++ b/zsh/plugins/redis-cli/README.md
@@ -0,0 +1,15 @@
+# Redis-CLI
+
+This plugin adds [redis-cli](https://redis.io/topics/rediscli) completion, based off of Homebrew completion.
+
+To use it, add `redis-cli` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... redis-cli)
+```
+
+## Requirements
+
+In order to make this work, you will need to have redis installed.
+
+More info on the usage and install: https://redis.io/topics/quickstart
diff --git a/zsh/plugins/repo/README.md b/zsh/plugins/repo/README.md
index 4d9366a..6abd233 100644
--- a/zsh/plugins/repo/README.md
+++ b/zsh/plugins/repo/README.md
@@ -1,7 +1,25 @@
-## repo
-**Maintainer:** [Stibbons](https://github.com/Stibbons)
+# repo plugin
-This plugin mainly add support automatic completion for the repo command line tool:
-https://code.google.com/p/git-repo/
+This plugin mainly adds some aliases and support for automatic completion for
+the [repo command line tool](https://code.google.com/p/git-repo/).
-* `r` aliases `repo`
+To use it, add `repo` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... repo)
+```
+
+## Aliases
+
+| Alias | Command |
+|---------|----------------------------------------|
+| `r` | `repo` |
+| `rra` | `repo rebase --auto-stash` |
+| `rs` | `repo sync` |
+| `rsrra` | `repo sync ; repo rebase --auto-stash` |
+| `ru` | `repo upload` |
+| `rst` | `repo status` |
+| `rsto` | `repo status -o` |
+| `rfa` | `repo forall -c` |
+| `rfap` | `repo forall -p -c` |
+| `rinf` | `repo info` |
diff --git a/zsh/plugins/repo/_repo b/zsh/plugins/repo/_repo
index 59e39c9..db0ecd1 100644
--- a/zsh/plugins/repo/_repo
+++ b/zsh/plugins/repo/_repo
@@ -1,6 +1,5 @@
#compdef repo
-
__git_apply_whitespace_strategies ()
{
declare -a strategies
@@ -269,4 +268,3 @@ __repo_projects_or_all()
_repo "$@"
return $?
-
diff --git a/zsh/plugins/repo/repo.plugin.zsh b/zsh/plugins/repo/repo.plugin.zsh
index 33f4195..f098993 100644
--- a/zsh/plugins/repo/repo.plugin.zsh
+++ b/zsh/plugins/repo/repo.plugin.zsh
@@ -1,18 +1,10 @@
-# Aliases
alias r='repo'
-compdef _repo r=repo
-
alias rra='repo rebase --auto-stash'
-compdef _repo rra='repo rebase --auto-stash'
-
alias rs='repo sync'
-compdef _repo rs='repo sync'
-
alias rsrra='repo sync ; repo rebase --auto-stash'
-compdef _repo rsrra='repo sync ; repo rebase --auto-stash'
-
alias ru='repo upload'
-compdef _repo ru='repo upload'
-
alias rst='repo status'
-compdef _repo rst='repo status'
+alias rsto='repo status -o'
+alias rfa='repo forall -c'
+alias rfap='repo forall -p -c'
+alias rinf='repo info'
diff --git a/zsh/plugins/ros/README.mkd b/zsh/plugins/ros/README.md
similarity index 100%
rename from zsh/plugins/ros/README.mkd
rename to zsh/plugins/ros/README.md
diff --git a/zsh/plugins/rust/README.md b/zsh/plugins/rust/README.md
new file mode 100644
index 0000000..83d7d91
--- /dev/null
+++ b/zsh/plugins/rust/README.md
@@ -0,0 +1,9 @@
+# rust
+
+This plugin adds completion for [`rustc`](https://doc.rust-lang.org/rustc/index.html), the compiler for the Rust programming language.
+
+To use it, add `rust` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... rust)
+```
diff --git a/zsh/plugins/rustup/README.md b/zsh/plugins/rustup/README.md
new file mode 100644
index 0000000..ba037f8
--- /dev/null
+++ b/zsh/plugins/rustup/README.md
@@ -0,0 +1,9 @@
+# rustup
+
+This plugin adds completion for [`rustup`](https://rustup.rs/), the toolchain installer for the Rust programming language.
+
+To use it, add `rustup` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... rustup)
+```
diff --git a/zsh/plugins/rustup/_rustup b/zsh/plugins/rustup/_rustup
new file mode 100644
index 0000000..dab3353
--- /dev/null
+++ b/zsh/plugins/rustup/_rustup
@@ -0,0 +1,1143 @@
+#compdef rustup
+
+autoload -U is-at-least
+
+_rustup() {
+ typeset -A opt_args
+ typeset -a _arguments_options
+ local ret=1
+
+ if is-at-least 5.2; then
+ _arguments_options=(-s -S -C)
+ else
+ _arguments_options=(-s -C)
+ fi
+
+ local context curcontext="$curcontext" state line
+ _arguments "${_arguments_options[@]}" \
+'-v[Enable verbose output]' \
+'--verbose[Enable verbose output]' \
+'(-v --verbose)-q[Disable progress output]' \
+'(-v --verbose)--quiet[Disable progress output]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+'::+toolchain -- release channel (e.g. +stable) or custom toolchain to set override:_files' \
+":: :_rustup_commands" \
+"*::: :->rustup" \
+&& ret=0
+ case $state in
+ (rustup)
+ words=($line[2] "${words[@]}")
+ (( CURRENT += 1 ))
+ curcontext="${curcontext%:*:*}:rustup-command-$line[2]:"
+ case $line[2] in
+ (dump-testament)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+(show)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+":: :_rustup__show_commands" \
+"*::: :->show" \
+&& ret=0
+case $state in
+ (show)
+ words=($line[1] "${words[@]}")
+ (( CURRENT += 1 ))
+ curcontext="${curcontext%:*:*}:rustup-show-command-$line[1]:"
+ case $line[1] in
+ (active-toolchain)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+(home)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+(profile)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+(keys)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+(help)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+ esac
+ ;;
+esac
+;;
+(install)
+_arguments "${_arguments_options[@]}" \
+'--profile=[]: :(minimal default complete)' \
+'--no-self-update[Don'\''t perform self-update when running the `rustup install` command]' \
+'--force[Force an update, even if some components are missing]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \
+&& ret=0
+;;
+(uninstall)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \
+&& ret=0
+;;
+(update)
+_arguments "${_arguments_options[@]}" \
+'--no-self-update[Don'\''t perform self update when running the `rustup update` command]' \
+'--force[Force an update, even if some components are missing]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+'::toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \
+&& ret=0
+;;
+(check)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+(default)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+'::toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \
+&& ret=0
+;;
+(toolchain)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+":: :_rustup__toolchain_commands" \
+"*::: :->toolchain" \
+&& ret=0
+case $state in
+ (toolchain)
+ words=($line[1] "${words[@]}")
+ (( CURRENT += 1 ))
+ curcontext="${curcontext%:*:*}:rustup-toolchain-command-$line[1]:"
+ case $line[1] in
+ (list)
+_arguments "${_arguments_options[@]}" \
+'-v[Enable verbose output with toolchain information]' \
+'--verbose[Enable verbose output with toolchain information]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+(update)
+_arguments "${_arguments_options[@]}" \
+'--profile=[]: :(minimal default complete)' \
+'*-c+[Add specific components on installation]' \
+'*--component=[Add specific components on installation]' \
+'*-t+[Add specific targets on installation]' \
+'*--target=[Add specific targets on installation]' \
+'--no-self-update[Don'\''t perform self update when running the`rustup toolchain install` command]' \
+'--force[Force an update, even if some components are missing]' \
+'--allow-downgrade[Allow rustup to downgrade the toolchain to satisfy your component choice]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \
+&& ret=0
+;;
+(add)
+_arguments "${_arguments_options[@]}" \
+'--profile=[]: :(minimal default complete)' \
+'*-c+[Add specific components on installation]' \
+'*--component=[Add specific components on installation]' \
+'*-t+[Add specific targets on installation]' \
+'*--target=[Add specific targets on installation]' \
+'--no-self-update[Don'\''t perform self update when running the`rustup toolchain install` command]' \
+'--force[Force an update, even if some components are missing]' \
+'--allow-downgrade[Allow rustup to downgrade the toolchain to satisfy your component choice]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \
+&& ret=0
+;;
+(install)
+_arguments "${_arguments_options[@]}" \
+'--profile=[]: :(minimal default complete)' \
+'*-c+[Add specific components on installation]' \
+'*--component=[Add specific components on installation]' \
+'*-t+[Add specific targets on installation]' \
+'*--target=[Add specific targets on installation]' \
+'--no-self-update[Don'\''t perform self update when running the`rustup toolchain install` command]' \
+'--force[Force an update, even if some components are missing]' \
+'--allow-downgrade[Allow rustup to downgrade the toolchain to satisfy your component choice]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \
+&& ret=0
+;;
+(remove)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \
+&& ret=0
+;;
+(uninstall)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \
+&& ret=0
+;;
+(link)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \
+':path:_files' \
+&& ret=0
+;;
+(help)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+ esac
+ ;;
+esac
+;;
+(target)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+":: :_rustup__target_commands" \
+"*::: :->target" \
+&& ret=0
+case $state in
+ (target)
+ words=($line[1] "${words[@]}")
+ (( CURRENT += 1 ))
+ curcontext="${curcontext%:*:*}:rustup-target-command-$line[1]:"
+ case $line[1] in
+ (list)
+_arguments "${_arguments_options[@]}" \
+'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \
+'--installed[List only installed targets]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+(install)
+_arguments "${_arguments_options[@]}" \
+'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':target -- List of targets to install; "all" installs all available targets:_files' \
+&& ret=0
+;;
+(add)
+_arguments "${_arguments_options[@]}" \
+'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':target -- List of targets to install; "all" installs all available targets:_files' \
+&& ret=0
+;;
+(uninstall)
+_arguments "${_arguments_options[@]}" \
+'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':target:_files' \
+&& ret=0
+;;
+(remove)
+_arguments "${_arguments_options[@]}" \
+'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':target:_files' \
+&& ret=0
+;;
+(help)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+ esac
+ ;;
+esac
+;;
+(component)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+":: :_rustup__component_commands" \
+"*::: :->component" \
+&& ret=0
+case $state in
+ (component)
+ words=($line[1] "${words[@]}")
+ (( CURRENT += 1 ))
+ curcontext="${curcontext%:*:*}:rustup-component-command-$line[1]:"
+ case $line[1] in
+ (list)
+_arguments "${_arguments_options[@]}" \
+'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \
+'--installed[List only installed components]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+(add)
+_arguments "${_arguments_options[@]}" \
+'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \
+'--target=[]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':component:_files' \
+&& ret=0
+;;
+(remove)
+_arguments "${_arguments_options[@]}" \
+'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \
+'--target=[]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':component:_files' \
+&& ret=0
+;;
+(help)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+ esac
+ ;;
+esac
+;;
+(override)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+":: :_rustup__override_commands" \
+"*::: :->override" \
+&& ret=0
+case $state in
+ (override)
+ words=($line[1] "${words[@]}")
+ (( CURRENT += 1 ))
+ curcontext="${curcontext%:*:*}:rustup-override-command-$line[1]:"
+ case $line[1] in
+ (list)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+(add)
+_arguments "${_arguments_options[@]}" \
+'--path=[Path to the directory]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \
+&& ret=0
+;;
+(set)
+_arguments "${_arguments_options[@]}" \
+'--path=[Path to the directory]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \
+&& ret=0
+;;
+(remove)
+_arguments "${_arguments_options[@]}" \
+'--path=[Path to the directory]' \
+'--nonexistent[Remove override toolchain for all nonexistent directories]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+(unset)
+_arguments "${_arguments_options[@]}" \
+'--path=[Path to the directory]' \
+'--nonexistent[Remove override toolchain for all nonexistent directories]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+(help)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+ esac
+ ;;
+esac
+;;
+(run)
+_arguments "${_arguments_options[@]}" \
+'--install[Install the requested toolchain if needed]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \
+':command:_files' \
+&& ret=0
+;;
+(which)
+_arguments "${_arguments_options[@]}" \
+'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':command:_files' \
+&& ret=0
+;;
+(docs)
+_arguments "${_arguments_options[@]}" \
+'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \
+'--path[Only print the path to the documentation]' \
+'--alloc[The Rust core allocation and collections library]' \
+'--book[The Rust Programming Language book]' \
+'--cargo[The Cargo Book]' \
+'--core[The Rust Core Library]' \
+'--edition-guide[The Rust Edition Guide]' \
+'--nomicon[The Dark Arts of Advanced and Unsafe Rust Programming]' \
+'--proc_macro[A support library for macro authors when defining new macros]' \
+'--reference[The Rust Reference]' \
+'--rust-by-example[A collection of runnable examples that illustrate various Rust concepts and standard libraries]' \
+'--rustc[The compiler for the Rust programming language]' \
+'--rustdoc[Generate documentation for Rust projects]' \
+'--std[Standard library API documentation]' \
+'--test[Support code for rustc'\''s built in unit-test and micro-benchmarking framework]' \
+'--unstable-book[The Unstable Book]' \
+'--embedded-book[The Embedded Rust Book]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+'::topic -- Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!', 'std::fs', 'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum', 'std::io::error::Result' etc...:_files' \
+&& ret=0
+;;
+(doc)
+_arguments "${_arguments_options[@]}" \
+'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \
+'--path[Only print the path to the documentation]' \
+'--alloc[The Rust core allocation and collections library]' \
+'--book[The Rust Programming Language book]' \
+'--cargo[The Cargo Book]' \
+'--core[The Rust Core Library]' \
+'--edition-guide[The Rust Edition Guide]' \
+'--nomicon[The Dark Arts of Advanced and Unsafe Rust Programming]' \
+'--proc_macro[A support library for macro authors when defining new macros]' \
+'--reference[The Rust Reference]' \
+'--rust-by-example[A collection of runnable examples that illustrate various Rust concepts and standard libraries]' \
+'--rustc[The compiler for the Rust programming language]' \
+'--rustdoc[Generate documentation for Rust projects]' \
+'--std[Standard library API documentation]' \
+'--test[Support code for rustc'\''s built in unit-test and micro-benchmarking framework]' \
+'--unstable-book[The Unstable Book]' \
+'--embedded-book[The Embedded Rust Book]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+'::topic -- Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!', 'std::fs', 'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum', 'std::io::error::Result' etc...:_files' \
+&& ret=0
+;;
+(man)
+_arguments "${_arguments_options[@]}" \
+'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':command:_files' \
+&& ret=0
+;;
+(self)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+":: :_rustup__self_commands" \
+"*::: :->self" \
+&& ret=0
+case $state in
+ (self)
+ words=($line[1] "${words[@]}")
+ (( CURRENT += 1 ))
+ curcontext="${curcontext%:*:*}:rustup-self-command-$line[1]:"
+ case $line[1] in
+ (update)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+(uninstall)
+_arguments "${_arguments_options[@]}" \
+'-y[]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+(upgrade-data)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+(help)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+ esac
+ ;;
+esac
+;;
+(set)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+":: :_rustup__set_commands" \
+"*::: :->set" \
+&& ret=0
+case $state in
+ (set)
+ words=($line[1] "${words[@]}")
+ (( CURRENT += 1 ))
+ curcontext="${curcontext%:*:*}:rustup-set-command-$line[1]:"
+ case $line[1] in
+ (default-host)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':host_triple:_files' \
+&& ret=0
+;;
+(profile)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+':profile-name:(minimal default complete)' \
+&& ret=0
+;;
+(help)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+ esac
+ ;;
+esac
+;;
+(completions)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+'::shell:(zsh bash fish powershell elvish)' \
+'::command:(rustup cargo)' \
+&& ret=0
+;;
+(help)
+_arguments "${_arguments_options[@]}" \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+&& ret=0
+;;
+ esac
+ ;;
+esac
+}
+
+(( $+functions[_rustup_commands] )) ||
+_rustup_commands() {
+ local commands; commands=(
+ "dump-testament:Dump information about the build" \
+"show:Show the active and installed toolchains or profiles" \
+"install:Update Rust toolchains" \
+"uninstall:Uninstall Rust toolchains" \
+"update:Update Rust toolchains and rustup" \
+"check:Check for updates to Rust toolchains" \
+"default:Set the default toolchain" \
+"toolchain:Modify or query the installed toolchains" \
+"target:Modify a toolchain's supported targets" \
+"component:Modify a toolchain's installed components" \
+"override:Modify directory toolchain overrides" \
+"run:Run a command with an environment configured for a given toolchain" \
+"which:Display which binary will be run for a given command" \
+"doc:Open the documentation for the current toolchain" \
+"man:View the man page for a given command" \
+"self:Modify the rustup installation" \
+"set:Alter rustup settings" \
+"completions:Generate tab-completion scripts for your shell" \
+"help:Prints this message or the help of the given subcommand(s)" \
+ )
+ _describe -t commands 'rustup commands' commands "$@"
+}
+(( $+functions[_rustup__show__active-toolchain_commands] )) ||
+_rustup__show__active-toolchain_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup show active-toolchain commands' commands "$@"
+}
+(( $+functions[_rustup__add_commands] )) ||
+_rustup__add_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup add commands' commands "$@"
+}
+(( $+functions[_rustup__component__add_commands] )) ||
+_rustup__component__add_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup component add commands' commands "$@"
+}
+(( $+functions[_rustup__override__add_commands] )) ||
+_rustup__override__add_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup override add commands' commands "$@"
+}
+(( $+functions[_rustup__target__add_commands] )) ||
+_rustup__target__add_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup target add commands' commands "$@"
+}
+(( $+functions[_rustup__toolchain__add_commands] )) ||
+_rustup__toolchain__add_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup toolchain add commands' commands "$@"
+}
+(( $+functions[_rustup__check_commands] )) ||
+_rustup__check_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup check commands' commands "$@"
+}
+(( $+functions[_rustup__completions_commands] )) ||
+_rustup__completions_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup completions commands' commands "$@"
+}
+(( $+functions[_rustup__component_commands] )) ||
+_rustup__component_commands() {
+ local commands; commands=(
+ "list:List installed and available components" \
+"add:Add a component to a Rust toolchain" \
+"remove:Remove a component from a Rust toolchain" \
+"help:Prints this message or the help of the given subcommand(s)" \
+ )
+ _describe -t commands 'rustup component commands' commands "$@"
+}
+(( $+functions[_rustup__default_commands] )) ||
+_rustup__default_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup default commands' commands "$@"
+}
+(( $+functions[_rustup__set__default-host_commands] )) ||
+_rustup__set__default-host_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup set default-host commands' commands "$@"
+}
+(( $+functions[_rustup__doc_commands] )) ||
+_rustup__doc_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup doc commands' commands "$@"
+}
+(( $+functions[_docs_commands] )) ||
+_docs_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'docs commands' commands "$@"
+}
+(( $+functions[_rustup__docs_commands] )) ||
+_rustup__docs_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup docs commands' commands "$@"
+}
+(( $+functions[_rustup__dump-testament_commands] )) ||
+_rustup__dump-testament_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup dump-testament commands' commands "$@"
+}
+(( $+functions[_rustup__component__help_commands] )) ||
+_rustup__component__help_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup component help commands' commands "$@"
+}
+(( $+functions[_rustup__help_commands] )) ||
+_rustup__help_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup help commands' commands "$@"
+}
+(( $+functions[_rustup__override__help_commands] )) ||
+_rustup__override__help_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup override help commands' commands "$@"
+}
+(( $+functions[_rustup__self__help_commands] )) ||
+_rustup__self__help_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup self help commands' commands "$@"
+}
+(( $+functions[_rustup__set__help_commands] )) ||
+_rustup__set__help_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup set help commands' commands "$@"
+}
+(( $+functions[_rustup__show__help_commands] )) ||
+_rustup__show__help_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup show help commands' commands "$@"
+}
+(( $+functions[_rustup__target__help_commands] )) ||
+_rustup__target__help_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup target help commands' commands "$@"
+}
+(( $+functions[_rustup__toolchain__help_commands] )) ||
+_rustup__toolchain__help_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup toolchain help commands' commands "$@"
+}
+(( $+functions[_rustup__show__home_commands] )) ||
+_rustup__show__home_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup show home commands' commands "$@"
+}
+(( $+functions[_rustup__install_commands] )) ||
+_rustup__install_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup install commands' commands "$@"
+}
+(( $+functions[_rustup__target__install_commands] )) ||
+_rustup__target__install_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup target install commands' commands "$@"
+}
+(( $+functions[_rustup__toolchain__install_commands] )) ||
+_rustup__toolchain__install_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup toolchain install commands' commands "$@"
+}
+(( $+functions[_rustup__show__keys_commands] )) ||
+_rustup__show__keys_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup show keys commands' commands "$@"
+}
+(( $+functions[_rustup__toolchain__link_commands] )) ||
+_rustup__toolchain__link_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup toolchain link commands' commands "$@"
+}
+(( $+functions[_rustup__component__list_commands] )) ||
+_rustup__component__list_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup component list commands' commands "$@"
+}
+(( $+functions[_rustup__override__list_commands] )) ||
+_rustup__override__list_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup override list commands' commands "$@"
+}
+(( $+functions[_rustup__target__list_commands] )) ||
+_rustup__target__list_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup target list commands' commands "$@"
+}
+(( $+functions[_rustup__toolchain__list_commands] )) ||
+_rustup__toolchain__list_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup toolchain list commands' commands "$@"
+}
+(( $+functions[_rustup__man_commands] )) ||
+_rustup__man_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup man commands' commands "$@"
+}
+(( $+functions[_rustup__override_commands] )) ||
+_rustup__override_commands() {
+ local commands; commands=(
+ "list:List directory toolchain overrides" \
+"set:Set the override toolchain for a directory" \
+"unset:Remove the override toolchain for a directory" \
+"help:Prints this message or the help of the given subcommand(s)" \
+ )
+ _describe -t commands 'rustup override commands' commands "$@"
+}
+(( $+functions[_rustup__set__profile_commands] )) ||
+_rustup__set__profile_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup set profile commands' commands "$@"
+}
+(( $+functions[_rustup__show__profile_commands] )) ||
+_rustup__show__profile_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup show profile commands' commands "$@"
+}
+(( $+functions[_rustup__component__remove_commands] )) ||
+_rustup__component__remove_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup component remove commands' commands "$@"
+}
+(( $+functions[_rustup__override__remove_commands] )) ||
+_rustup__override__remove_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup override remove commands' commands "$@"
+}
+(( $+functions[_rustup__remove_commands] )) ||
+_rustup__remove_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup remove commands' commands "$@"
+}
+(( $+functions[_rustup__target__remove_commands] )) ||
+_rustup__target__remove_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup target remove commands' commands "$@"
+}
+(( $+functions[_rustup__toolchain__remove_commands] )) ||
+_rustup__toolchain__remove_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup toolchain remove commands' commands "$@"
+}
+(( $+functions[_rustup__run_commands] )) ||
+_rustup__run_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup run commands' commands "$@"
+}
+(( $+functions[_rustup__self_commands] )) ||
+_rustup__self_commands() {
+ local commands; commands=(
+ "update:Download and install updates to rustup" \
+"uninstall:Uninstall rustup." \
+"upgrade-data:Upgrade the internal data format." \
+"help:Prints this message or the help of the given subcommand(s)" \
+ )
+ _describe -t commands 'rustup self commands' commands "$@"
+}
+(( $+functions[_rustup__override__set_commands] )) ||
+_rustup__override__set_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup override set commands' commands "$@"
+}
+(( $+functions[_rustup__set_commands] )) ||
+_rustup__set_commands() {
+ local commands; commands=(
+ "default-host:The triple used to identify toolchains when not specified" \
+"profile:The default components installed" \
+"help:Prints this message or the help of the given subcommand(s)" \
+ )
+ _describe -t commands 'rustup set commands' commands "$@"
+}
+(( $+functions[_rustup__show_commands] )) ||
+_rustup__show_commands() {
+ local commands; commands=(
+ "active-toolchain:Show the active toolchain" \
+"home:Display the computed value of RUSTUP_HOME" \
+"profile:Show the current profile" \
+"keys:Display the known PGP keys" \
+"help:Prints this message or the help of the given subcommand(s)" \
+ )
+ _describe -t commands 'rustup show commands' commands "$@"
+}
+(( $+functions[_rustup__target_commands] )) ||
+_rustup__target_commands() {
+ local commands; commands=(
+ "list:List installed and available targets" \
+"add:Add a target to a Rust toolchain" \
+"remove:Remove a target from a Rust toolchain" \
+"help:Prints this message or the help of the given subcommand(s)" \
+ )
+ _describe -t commands 'rustup target commands' commands "$@"
+}
+(( $+functions[_rustup__toolchain_commands] )) ||
+_rustup__toolchain_commands() {
+ local commands; commands=(
+ "list:List installed toolchains" \
+"install:Install or update a given toolchain" \
+"uninstall:Uninstall a toolchain" \
+"link:Create a custom toolchain by symlinking to a directory" \
+"help:Prints this message or the help of the given subcommand(s)" \
+ )
+ _describe -t commands 'rustup toolchain commands' commands "$@"
+}
+(( $+functions[_rustup__self__uninstall_commands] )) ||
+_rustup__self__uninstall_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup self uninstall commands' commands "$@"
+}
+(( $+functions[_rustup__target__uninstall_commands] )) ||
+_rustup__target__uninstall_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup target uninstall commands' commands "$@"
+}
+(( $+functions[_rustup__toolchain__uninstall_commands] )) ||
+_rustup__toolchain__uninstall_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup toolchain uninstall commands' commands "$@"
+}
+(( $+functions[_rustup__uninstall_commands] )) ||
+_rustup__uninstall_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup uninstall commands' commands "$@"
+}
+(( $+functions[_rustup__override__unset_commands] )) ||
+_rustup__override__unset_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup override unset commands' commands "$@"
+}
+(( $+functions[_rustup__self__update_commands] )) ||
+_rustup__self__update_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup self update commands' commands "$@"
+}
+(( $+functions[_rustup__toolchain__update_commands] )) ||
+_rustup__toolchain__update_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup toolchain update commands' commands "$@"
+}
+(( $+functions[_rustup__update_commands] )) ||
+_rustup__update_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup update commands' commands "$@"
+}
+(( $+functions[_rustup__self__upgrade-data_commands] )) ||
+_rustup__self__upgrade-data_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup self upgrade-data commands' commands "$@"
+}
+(( $+functions[_rustup__which_commands] )) ||
+_rustup__which_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'rustup which commands' commands "$@"
+}
+
+_rustup "$@"
\ No newline at end of file
diff --git a/zsh/plugins/rvm/README.md b/zsh/plugins/rvm/README.md
new file mode 100644
index 0000000..1ed8d46
--- /dev/null
+++ b/zsh/plugins/rvm/README.md
@@ -0,0 +1,20 @@
+# Ruby Version Manager plugin
+
+This plugin adds some utility functions and completions for [Ruby Version Manager](https://rvm.io/).
+
+To use it, add `rvm` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... rvm)
+```
+
+## Aliases
+
+| Alias | Command |
+|----------------|----------------------|
+| `rb18` | `rvm use ruby-1.8.7` |
+| `rb19` | `rvm use ruby-1.9.3` |
+| `rb20` | `rvm use ruby-2.0.0` |
+| `rb21` | `rvm use ruby-2.1.2` |
+| `rvm-update` | `rvm get head` |
+| `gems` | `gem list` |
diff --git a/zsh/plugins/safe-paste/README.md b/zsh/plugins/safe-paste/README.md
new file mode 100644
index 0000000..a2e7ddb
--- /dev/null
+++ b/zsh/plugins/safe-paste/README.md
@@ -0,0 +1,9 @@
+# safe-paste
+
+Preventing any code from actually running while pasting, so you have a chance to review what was actually pasted before running it.
+
+To use it, add `safe-paste` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... safe-paste)
+```
diff --git a/zsh/plugins/safe-paste/safe-paste.plugin.zsh b/zsh/plugins/safe-paste/safe-paste.plugin.zsh
index 75f1791..d443ae8 100644
--- a/zsh/plugins/safe-paste/safe-paste.plugin.zsh
+++ b/zsh/plugins/safe-paste/safe-paste.plugin.zsh
@@ -1,54 +1,100 @@
+# A good summary of the zsh 5.1 Bracketed Paste Mode changes is at:
+# https://archive.zhimingwang.org/blog/2015-09-21-zsh-51-and-bracketed-paste.html
+
+# zsh 5.1 (September 2015) introduced built-in support for Bracketed Paste Mode
+# https://github.com/zsh-users/zsh/blob/68405f31a043bdd5bf338eb06688ed3e1f740937/README#L38-L45
+#
+# zsh 5.1 breaks url-quote-magic and other widgets replacing self-insert
+# zsh-users' bracketed-paste-magic resolves these issues:
+# https://github.com/zsh-users/zsh/blob/f702e17b14d75aa21bff014168fa9048124db286/Functions/Zle/bracketed-paste-magic#L9-L12
+
+# Load bracketed-paste-magic if zsh version is >= 5.1
+if [[ ${ZSH_VERSION:0:3} -ge 5.1 ]]; then
+ set zle_bracketed_paste # Explicitly restore this zsh default
+ autoload -Uz bracketed-paste-magic
+ zle -N bracketed-paste bracketed-paste-magic
+ return ### The rest of this file is NOT executed on zsh version >= 5.1 ###
+fi
+
+######################################################################
+# The rest of this file is ONLY executed if zsh version < 5.1
+######################################################################
+
# Code from Mikael Magnusson: https://www.zsh.org/mla/users/2011/msg00367.html
#
-# Requires xterm, urxvt, iTerm2 or any other terminal that supports bracketed
-# paste mode as documented: https://www.xfree86.org/current/ctlseqs.html
+# Requires xterm, urxvt, iTerm2 or any other terminal that supports
+# Bracketed Paste Mode as documented:
+# https://www.xfree86.org/current/ctlseqs.html#Bracketed%20Paste%20Mode
+#
+# For tmux, use: bind ] paste-buffer -p
+#
+# Additional technical details: https://cirw.in/blog/bracketed-paste
-# create a new keymap to use while pasting
-bindkey -N paste
-# make everything in this keymap call our custom widget
-bindkey -R -M paste "^@"-"\M-^?" paste-insert
-# these are the codes sent around the pasted text in bracketed
-# paste mode.
-# do the first one with both -M viins and -M vicmd in vi mode
-bindkey '^[[200~' _start_paste
-bindkey -M paste '^[[201~' _end_paste
-# insert newlines rather than carriage returns when pasting newlines
-bindkey -M paste -s '^M' '^J'
+# Create a new keymap to use while pasting
+bindkey -N bracketed-paste
+# Make everything in this new keymap enqueue characters for pasting
+bindkey -RM bracketed-paste '\x00-\xFF' bracketed-paste-enqueue
+# These are the codes sent around the pasted text in bracketed paste mode
+bindkey -M main '^[[200~' _bracketed_paste_begin
+bindkey -M bracketed-paste '^[[201~' _bracketed_paste_end
+# Insert newlines rather than carriage returns when pasting newlines
+bindkey -M bracketed-paste -s '^M' '^J'
-zle -N _start_paste
-zle -N _end_paste
-zle -N zle-line-init _zle_line_init
-zle -N zle-line-finish _zle_line_finish
-zle -N paste-insert _paste_insert
+zle -N _bracketed_paste_begin
+zle -N _bracketed_paste_end
+zle -N bracketed-paste-enqueue _bracketed_paste_enqueue
-# switch the active keymap to paste mode
-function _start_paste() {
- bindkey -A paste main
+# Attempt to not clobber zle_line_{init,finish}
+# Use https://github.com/willghatch/zsh-hooks if available
+if typeset -f hooks-add-hook > /dev/null; then
+ hooks-add-hook zle_line_init_hook _bracketed_paste_zle_init
+ hooks-add-hook zle_line_finish_hook _bracketed_paste_zle_finish
+else
+ zle -N zle-line-init _bracketed_paste_zle_init
+ zle -N zle-line-finish _bracketed_paste_zle_finish
+fi
+
+# Switch the active keymap to paste mode
+_bracketed_paste_begin() {
+ # Save the bindkey command to restore the active ("main") keymap
+ # Tokenise the restorative bindkey command into an array
+ _bracketed_paste_restore_keymap=( ${(z)"$(bindkey -lL main)"} )
+ bindkey -A bracketed-paste main
}
-# go back to our normal keymap, and insert all the pasted text in the
-# command line. this has the nice effect of making the whole paste be
+# Go back to our normal keymap, and insert all the pasted text in the
+# command line. This has the nice effect of making the whole paste be
# a single undo/redo event.
-function _end_paste() {
-#use bindkey -v here with vi mode probably. maybe you want to track
-#if you were in ins or cmd mode and restore the right one.
- bindkey -e
- LBUFFER+=$_paste_content
- unset _paste_content
+_bracketed_paste_end() {
+ # Only execute the restore command if it starts with 'bindkey'
+ # Allow for option KSH_ARRAYS being set (indexing starts at 0)
+ if [ ${_bracketed_paste_restore_keymap[@]:0:1} = 'bindkey' ]; then
+ $_bracketed_paste_restore_keymap
+ fi
+ LBUFFER+=$_bracketed_paste_content
+ unset _bracketed_paste_content _bracketed_paste_restore_keymap
}
-function _paste_insert() {
- _paste_content+=$KEYS
+# Append a pasted character to the content which is later inserted as a whole
+_bracketed_paste_enqueue() {
+ _bracketed_paste_content+=$KEYS
}
-function _zle_line_init() {
- # Tell terminal to send escape codes around pastes.
- [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color || $TERM = screen || $TERM = screen-256color ]] && printf '\e[?2004h'
+# Run at zle-line-init
+_bracketed_paste_zle_init() {
+ _bracketed_paste_content=''
+ # Tell terminal to send escape codes around pastes
+ if [[ $TERM =~ '^(rxvt-unicode|xterm(-256color)?|screen(-256color)?)$' ]]; then
+ printf '\e[?2004h'
+ fi
}
-function _zle_line_finish() {
- # Tell it to stop when we leave zle, so pasting in other programs
- # doesn't get the ^[[200~ codes around the pasted text.
- [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color || $TERM = screen || $TERM = screen-256color ]] && printf '\e[?2004l'
+# Run at zle-line-finish
+_bracketed_paste_zle_finish() {
+ # Turn off bracketed paste when we leave ZLE, so pasting in other programs
+ # doesn't get the ^[[200~ codes around the pasted text
+ if [[ $TERM =~ '^(rxvt-unicode|xterm(-256color)?|screen(-256color)?)$' ]]; then
+ printf '\e[?2004l'
+ fi
}
diff --git a/zsh/plugins/salt/_salt b/zsh/plugins/salt/_salt
index 10b782a..78d8611 100644
--- a/zsh/plugins/salt/_salt
+++ b/zsh/plugins/salt/_salt
@@ -271,7 +271,7 @@ _salt_comp(){
fi
if _cache_invalid salt/salt_dir || ! _retrieve_cache salt/salt_dir; then
- salt_dir="${$(python2 -c 'import salt; print(salt.__file__);')%__init__*}"
+ salt_dir="${$(python2 -c 'import sys; del sys.path[0]; import salt; print(salt.__file__);')%__init__*}"
_store_cache salt/salt_dir salt_dir
fi
}
diff --git a/zsh/plugins/sbt/README.md b/zsh/plugins/sbt/README.md
index f1a5753..f020193 100644
--- a/zsh/plugins/sbt/README.md
+++ b/zsh/plugins/sbt/README.md
@@ -17,16 +17,16 @@ plugins=(... sbt)
| sbcln | `sbt clean` | Deletes all generated files |
| sbcc | `sbt clean compile` | Deletes generated files, compiles the main sources |
| sbco | `sbt console` | Starts Scala with the compiled sources and all dependencies |
-| sbcq | `sbt console-quick` | Starts Scala with all dependencies |
-| sbcp | `sbt console-project` | Starts Scala with sbt and the build definitions |
+| sbcq | `sbt consoleQuick` | Starts Scala with all dependencies |
+| sbcp | `sbt consoleProject` | Starts Scala with sbt and the build definitions |
| sbd | `sbt doc` | Generates API documentation for Scala source files |
| sbdc | `sbt dist:clean` | Deletes the distribution packages |
| sbdi | `sbt dist` | Creates the distribution packages |
-| sbgi | `sbt gen-idea` | Create Idea project files |
+| sbgi | `sbt genIdea` | Create Idea project files |
| sbp | `sbt publish` | Publishes artifacts to the repository |
-| sbpl | `sbt publish-local` | Publishes artifacts to the local Ivy repository |
+| sbpl | `sbt publishLocal` | Publishes artifacts to the local Ivy repository |
| sbr | `sbt run` | Runs the main class for the project |
-| sbrm | `sbt run-main` | Runs the specified main class for the project |
+| sbrm | `sbt runMain` | Runs the specified main class for the project |
| sbu | `sbt update` | Resolves and retrieves external dependencies |
| sbx | `sbt test` | Compiles and runs all tests |
| sba | `sbt assembly` | Create a fat JAR with all dependencies |
diff --git a/zsh/plugins/sbt/_sbt b/zsh/plugins/sbt/_sbt
index a601c9b..2138a72 100644
--- a/zsh/plugins/sbt/_sbt
+++ b/zsh/plugins/sbt/_sbt
@@ -6,23 +6,23 @@ _sbt_commands=(
'clean:delete files produced by the build'
'compile:compile sources'
'console:start the Scala REPL with project classes on the classpath'
- 'console-quick:start the Scala REPL with project deps on the classpath'
- 'console-project:start the Scala REPL w/sbt+build-def on the classpath'
+ 'consoleQuick:start the Scala REPL with project deps on the classpath'
+ 'consoleProject:start the Scala REPL w/sbt+build-def on the classpath'
'dist:generate distribution artifacts'
'dist\:clean:clean distribution artifacts'
'doc:generate API documentation'
- 'gen-idea:generate Intellij Idea project files'
+ 'genIdea:generate Intellij Idea project files'
'package:produce the main artifact, such as a binary jar'
- 'package-doc:produce a doc artifact, such as a jar containing API docs'
- 'package-src:produce a source artifact, such as a jar containing sources'
+ 'packageDoc:produce a doc artifact, such as a jar containing API docs'
+ 'packageSrc:produce a source artifact, such as a jar containing sources'
'publish:publish artifacts to a repository'
- 'publish-local:publish artifacts to the local repository'
- 'publish-m2:publish artifacts to the local Maven 2 repository'
+ 'publishLocal:publish artifacts to the local repository'
+ 'publishM2:publish artifacts to the local Maven 2 repository'
'run:run a main class'
- 'run-main:run the main class selected by the first argument'
+ 'runMain:run the main class selected by the first argument'
'test:execute all tests'
- 'test-only:execute the tests provided as arguments'
- 'test-quick:execute previously failed tests'
+ 'testOnly:execute the tests provided as arguments'
+ 'testQuick:execute previously failed tests'
'update:resolve and optionally retrieve dependencies'
)
diff --git a/zsh/plugins/sbt/sbt.plugin.zsh b/zsh/plugins/sbt/sbt.plugin.zsh
index f883b7f..851302c 100644
--- a/zsh/plugins/sbt/sbt.plugin.zsh
+++ b/zsh/plugins/sbt/sbt.plugin.zsh
@@ -9,17 +9,17 @@
alias sbc='sbt compile'
alias sbcc='sbt clean compile'
alias sbco='sbt console'
-alias sbcq='sbt console-quick'
+alias sbcq='sbt consoleQuick'
alias sbcln='sbt clean'
-alias sbcp='sbt console-project'
+alias sbcp='sbt consoleProject'
alias sbd='sbt doc'
alias sbdc='sbt dist:clean'
alias sbdi='sbt dist'
-alias sbgi='sbt gen-idea'
+alias sbgi='sbt genIdea'
alias sbp='sbt publish'
-alias sbpl='sbt publish-local'
+alias sbpl='sbt publishLocal'
alias sbr='sbt run'
-alias sbrm='sbt run-main'
+alias sbrm='sbt runMain'
alias sbu='sbt update'
alias sbx='sbt test'
alias sba='sbt assembly'
diff --git a/zsh/plugins/scala/README.md b/zsh/plugins/scala/README.md
index 957261d..91a3221 100644
--- a/zsh/plugins/scala/README.md
+++ b/zsh/plugins/scala/README.md
@@ -1,15 +1,16 @@
-## Scala plugin
+# Scala plugin
Completion script for [scala and scalac](https://www.scala-lang.org/) commands.
To use it, add `scala` to the plugins array of your zshrc file:
-```
+
+```zsh
plugins=(... scala)
```
## Aliases
-| Command | Description |
-|------------------|---------------------------------------------------------------------------------|
-| `scala` | Run code in the Scala language |
-| `scalac` | Compiler for the Scala language |
+| Command | Description |
+|----------|---------------------------------|
+| `scala` | Run code in the Scala language |
+| `scalac` | Compiler for the Scala language |
diff --git a/zsh/plugins/scd/README.md b/zsh/plugins/scd/README.md
index 8c156da..d8535f9 100644
--- a/zsh/plugins/scd/README.md
+++ b/zsh/plugins/scd/README.md
@@ -14,8 +14,9 @@ directory aliases, which appear as named directories in zsh session.
## INSTALLATION NOTES
Besides oh-my-zsh, `scd` can be used with *bash*, *dash* or *tcsh*
-shells and is also available as [Vim](https://www.vim.org/) plugin and
-[IPython](https://ipython.org/) extension. For installation details, see
+shells and is also available as Vim plugin
+[scd.vim](https://github.com/pavoljuhas/scd.vim) and
+[IPython](https://ipython.org) extension. For installation details, see
https://github.com/pavoljuhas/smart-change-directory.
## SYNOPSIS
@@ -24,11 +25,31 @@ https://github.com/pavoljuhas/smart-change-directory.
scd [options] [pattern1 pattern2 ...]
```
+## PATTERNS
+
+Patterns may use all zsh [glob operators](
+http://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Operators)
+available with *extendedglob* option. Specified patterns must match
+the absolute path and at least one of them must match in the tail.
+Several special patterns are also recognized as follows:
+
+
+^PAT
+ PAT must match at the beginning of the path, for example, "^/home"
+PAT$
+ require PAT to match the end of the path, "man$"
+./
+ match only subdirectories of the current directory
+:PAT
+ require PAT to match over the tail component, ":doc", ":re/doc"
+
+
+
## OPTIONS
-a, --add
- add specified directories to the directory index.
+ add current or specified directories to the directory index.
--unindex
remove current or specified directories from the index.
@@ -42,11 +63,16 @@ scd [options] [pattern1 pattern2 ...]
--unalias
remove ALIAS definition for the current or specified directory from
- ~/.scdalias.zsh .
+ ~/.scdalias.zsh . Use "OLD" to purge aliases to non-existent
+ directories.
-A, --all
- include all matching directories. Disregard matching by directory
- alias and filtering of less likely paths.
+ display all directories even those excluded by patterns in
+ ~/.scdignore . Disregard the unique matching for a
+ directory alias and filtering of less likely paths.
+
+-p, --push
+ use "pushd" to change to the target directory.
--list
show matching directories and exit.
@@ -58,6 +84,7 @@ scd [options] [pattern1 pattern2 ...]
display this options summary and exit.
+
## Examples
```sh
@@ -83,17 +110,26 @@ scd --alias=xray
scd xray
```
-# FILES
+## FILES
~/.scdhistory
time-stamped index of visited directories.
~/.scdalias.zsh
- scd-generated definitions of directory aliases.
+ scd-generated definitions of directory aliases.
+
+~/.scdignore
+
+ glob patterns for paths to be ignored in the scd search, for example,
+ /mnt/backup/*
. The patterns are specified one per line
+ and are matched assuming the extendedglob zsh option. Lines
+ starting with "#" are skipped as comments. The .scdignore patterns
+ are not applied in the --all mode.
-# ENVIRONMENT
+
+## ENVIRONMENT
SCD_HISTFILE
diff --git a/zsh/plugins/scd/_scd b/zsh/plugins/scd/_scd
new file mode 100644
index 0000000..39c7fa4
--- /dev/null
+++ b/zsh/plugins/scd/_scd
@@ -0,0 +1,60 @@
+#compdef scd
+#description smart change directory
+
+local curcontext="$curcontext" state line expl ret=1
+typeset -A opt_args
+
+local -a indexopts myargs
+indexopts=( --add -a --unindex )
+
+myargs=(
+ # common options
+ "(--help -h)"{--help,-h}"[print help and exit]"
+
+ # options for manipulating directory index
+ - index
+ "(--recursive -r)"{--recursive,-r}"[use recursive --add or --unindex]"
+ "($indexopts)"{--add,-a}"[add specified directories to the index]"
+ "($indexopts)--unindex[remove specified directories from the index]"
+ "*:directory:{ (( ${words[(I)-a|--add|--unindex]} )) && _path_files -/ }"
+
+ # define new directory alias
+ - alias
+ "--alias=[create alias for this or given directory]:directory-alias:()"
+ '1:directory:{ (( words[(I)--alias*] )) && _path_files -/ }'
+
+ # remove definition of directory alias
+ - unalias
+ "--unalias[remove definition of directory alias]"
+ "*::directory alias:->scd-alias-target"
+
+ # act on the directory change
+ - scd
+ "(--all -A)"{--all,-A}"[include less likely and ignored paths]"
+ "--list[print matching directories and exit]"
+ "(--verbose -v)"{--verbose,-v}"[show directory ranking and full paths]"
+ "(--push -p)"{--push,-p}"[change directory with 'pushd']"
+ "1::directory alias:->scd-alias-target"
+ "*:patterns:()"
+)
+
+_arguments -S -C $myargs && ret=0
+
+
+if [[ "$state" == scd-alias-target && -s ~/.scdalias.zsh ]]; then
+ local -a scdaliases
+ scdaliases=( )
+ eval "$(setopt extendedglob
+ phome="(#b)(#s)${HOME}(/*)#(#e)"
+ builtin hash -dr
+ source ~/.scdalias.zsh &&
+ for k v in ${(kv)nameddirs}; do
+ scdaliases+=( $k:${v/${~phome}/"~"${match[1]}} )
+ done
+ complete_unalias=${+opt_args[unalias---unalias]}
+ if (( complete_unalias && ! ${+nameddirs[OLD]} )); then
+ scdaliases+=( 'OLD:all aliases to non-existent paths' )
+ fi
+ typeset -p scdaliases )"
+ _describe -t scdaliases scdalias scdaliases
+fi
diff --git a/zsh/plugins/scd/scd b/zsh/plugins/scd/scd
old mode 100644
new mode 100755
index 39b2823..a7db6c2
--- a/zsh/plugins/scd/scd
+++ b/zsh/plugins/scd/scd
@@ -1,29 +1,39 @@
#!/bin/zsh -f
emulate -L zsh
+
+local RUNNING_AS_COMMAND=
local EXIT=return
if [[ $(whence -w $0) == *:' 'command ]]; then
- emulate -R zsh
- local RUNNING_AS_COMMAND=1
+ RUNNING_AS_COMMAND=1
EXIT=exit
fi
local DOC='scd -- smart change to a recently used directory
usage: scd [options] [pattern1 pattern2 ...]
-Go to a directory path that contains all fixed string patterns. Prefer
-recent or frequently visited directories as found in the directory index.
+Go to a directory path that matches all patterns. Prefer recent or
+frequently visited directories as found in the directory index.
Display a selection menu in case of multiple matches.
+Special patterns:
+ ^PAT match at the path root, "^/home"
+ PAT$ match paths ending with PAT, "man$"
+ ./ match paths under the current directory
+ :PAT require PAT to span the tail, ":doc", ":re/doc"
+
Options:
- -a, --add add specified directories to the directory index.
+ -a, --add add current or specified directories to the index.
--unindex remove current or specified directories from the index.
-r, --recursive apply options --add or --unindex recursively.
--alias=ALIAS create alias for the current or specified directory and
store it in ~/.scdalias.zsh.
--unalias remove ALIAS definition for the current or specified
directory from ~/.scdalias.zsh.
- -A, --all include all matching directories. Disregard matching by
- directory alias and filtering of less likely paths.
+ Use "OLD" to purge aliases to non-existent directories.
+ -A, --all display all directories even those excluded by patterns
+ in ~/.scdignore. Disregard unique match for a directory
+ alias and filtering of less likely paths.
+ -p, --push use "pushd" to change to the target directory.
--list show matching directories and exit.
-v, --verbose display directory rank in the selection menu.
-h, --help display this message and exit.
@@ -36,18 +46,28 @@ local SCD_MEANLIFE=${SCD_MEANLIFE:-86400}
local SCD_THRESHOLD=${SCD_THRESHOLD:-0.005}
local SCD_SCRIPT=${RUNNING_AS_COMMAND:+$SCD_SCRIPT}
local SCD_ALIAS=~/.scdalias.zsh
+local SCD_IGNORE=~/.scdignore
-local ICASE a d m p i maxrank threshold
+# Minimum logarithm of probability. Avoids out of range warning in exp().
+local -r MINLOGPROB=-15
+
+# When false, use case-insensitive globbing to fix PWD capitalization.
+local PWDCASECORRECT=true
+if [[ ${OSTYPE} == darwin* ]]; then
+ PWDCASECORRECT=false
+fi
+
+local a d m p i maxrank threshold
local opt_help opt_add opt_unindex opt_recursive opt_verbose
-local opt_alias opt_unalias opt_all opt_list
-local -A drank dalias
+local opt_alias opt_unalias opt_all opt_push opt_list
+local -A drank dalias scdignore
local dmatching
local last_directory
-setopt extendedhistory extendedglob noautonamedirs brace_ccl
+setopt extendedglob noautonamedirs brace_ccl
-# If SCD_SCRIPT is defined make sure the file exists and is empty.
-# This removes any previous old commands.
+# If SCD_SCRIPT is defined make sure that that file exists and is empty.
+# This removes any old previous commands from the SCD_SCRIPT file.
[[ -n "$SCD_SCRIPT" ]] && [[ -s $SCD_SCRIPT || ! -f $SCD_SCRIPT ]] && (
umask 077
: >| $SCD_SCRIPT
@@ -56,13 +76,17 @@ setopt extendedhistory extendedglob noautonamedirs brace_ccl
# process command line options
zmodload -i zsh/zutil
zmodload -i zsh/datetime
-zparseopts -D -- a=opt_add -add=opt_add -unindex=opt_unindex \
+zmodload -i zsh/parameter
+zparseopts -D -E -- a=opt_add -add=opt_add -unindex=opt_unindex \
r=opt_recursive -recursive=opt_recursive \
-alias:=opt_alias -unalias=opt_unalias \
- A=opt_all -all=opt_all -list=opt_list \
+ A=opt_all -all=opt_all p=opt_push -push=opt_push -list=opt_list \
v=opt_verbose -verbose=opt_verbose h=opt_help -help=opt_help \
|| $EXIT $?
+# remove the first instance of "--" from positional arguments
+argv[(i)--]=( )
+
if [[ -n $opt_help ]]; then
print $DOC
$EXIT
@@ -71,6 +95,22 @@ fi
# load directory aliases if they exist
[[ -r $SCD_ALIAS ]] && source $SCD_ALIAS
+# load scd-ignore patterns if available
+if [[ -s $SCD_IGNORE ]]; then
+ setopt noglob
+ <$SCD_IGNORE \
+ while read p; do
+ [[ $p != [\#]* ]] || continue
+ [[ -n $p ]] || continue
+ # expand leading tilde if it has valid expansion
+ if [[ $p == [~]* ]] && ( : ${~p} ) 2>/dev/null; then
+ p=${~p}
+ fi
+ scdignore[$p]=1
+ done
+ setopt glob
+fi
+
# Private internal functions are prefixed with _scd_Y19oug_.
# Clean them up when the scd function returns.
setopt localtraps
@@ -79,9 +119,17 @@ trap 'unfunction -m "_scd_Y19oug_*"' EXIT
# works faster than the (:a) modifier and is compatible with zsh 4.2.6
_scd_Y19oug_abspath() {
set -A $1 ${(ps:\0:)"$(
- unfunction -m "*"; shift
+ setopt pushdsilent
+ unfunction -m "*"
+ unalias -m "*"
+ unset CDPATH
+ shift
for d; do
- cd $d && print -Nr -- $PWD && cd $OLDPWD
+ pushd $d || continue
+ $PWDCASECORRECT &&
+ print -Nr -- $PWD ||
+ print -Nr -- (#i)$PWD
+ popd 2>/dev/null
done
)"}
}
@@ -106,47 +154,76 @@ if [[ -n $opt_alias ]]; then
$EXIT $?
fi
-# undefine directory alias
+# undefine one or more directory aliases
if [[ -n $opt_unalias ]]; then
- if [[ -n $1 && ! -d $1 ]]; then
- print -u2 "'$1' is not a directory."
- $EXIT 1
+ local -U uu
+ local ec=0
+ uu=( ${*:-${PWD}} )
+ if (( ${uu[(I)OLD]} && ${+nameddirs[OLD]} == 0 )); then
+ uu=( ${uu:#OLD} ${(ps:\0:)"$(
+ hash -dr
+ if [[ -r $SCD_ALIAS ]]; then
+ source $SCD_ALIAS
+ fi
+ for a d in ${(kv)nameddirs}; do
+ [[ -d $d ]] || print -Nr -- $a
+ done
+ )"}
+ )
fi
- _scd_Y19oug_abspath a ${1:-$PWD}
- a=$(print -rD ${a})
- if [[ $a != [~][^/]## ]]; then
- $EXIT
- fi
- a=${a#[~]}
- # unalias in the current shell, update alias file if successful
- if unhash -d -- $a 2>/dev/null && [[ -r $SCD_ALIAS ]]; then
+ m=( )
+ for p in $uu; do
+ d=$p
+ if [[ ${+nameddirs[$d]} == 0 && -d $d ]]; then
+ _scd_Y19oug_abspath d $d
+ fi
+ a=${(k)nameddirs[$d]:-${(k)nameddirs[(r)$d]}}
+ if [[ -z $a ]]; then
+ ec=1
+ print -u2 "'$p' is neither a directory alias nor an aliased path."
+ continue
+ fi
+ # unalias in the current shell and remember to update the alias file
+ if unhash -d -- $a 2>/dev/null; then
+ m+=( $a )
+ fi
+ done
+ if [[ $#m != 0 && -r $SCD_ALIAS ]]; then
(
umask 077
hash -dr
source $SCD_ALIAS
- unhash -d -- $a 2>/dev/null &&
+ for a in $m; do
+ unhash -d -- $a 2>/dev/null
+ done
hash -dL >| $SCD_ALIAS
- )
+ ) || ec=$?
fi
- $EXIT $?
+ $EXIT $ec
fi
-# The "compress" function collapses repeated directories to
-# one entry with a time stamp that gives equivalent-probability.
+# The "compress" function collapses repeated directories into
+# a single entry with a time-stamp yielding an equivalent probability.
_scd_Y19oug_compress() {
- awk -v epochseconds=$EPOCHSECONDS -v meanlife=$SCD_MEANLIFE '
- BEGIN { FS = "[:;]"; }
- length($0) < 4096 && $2 > 0 {
+ awk -v epochseconds=$EPOCHSECONDS \
+ -v meanlife=$SCD_MEANLIFE \
+ -v minlogprob=$MINLOGPROB \
+ '
+ BEGIN {
+ FS = "[:;]";
+ pmin = exp(minlogprob);
+ }
+ /^: deleted:0;/ { next; }
+ length($0) < 4096 && $2 > 1000 {
+ df = $0;
+ sub("^[^;]*;", "", df);
+ if (!df) next;
tau = 1.0 * ($2 - epochseconds) / meanlife;
- if (tau < -6.9078) tau = -6.9078;
- prob = exp(tau);
- sub(/^[^;]*;/, "");
- if (NF) {
- dlist[last[$0]] = "";
- dlist[NR] = $0;
- last[$0] = NR;
- ptot[$0] += prob;
- }
+ prob = (tau < minlogprob) ? pmin : exp(tau);
+ dlist[last[df]] = "";
+ dlist[NR] = df;
+ last[df] = NR;
+ ptot[df] += prob;
}
END {
for (i = 1; i <= NR; ++i) {
@@ -157,26 +234,38 @@ _scd_Y19oug_compress() {
}
}
}
- ' $*
+ ' $*
}
-# Rewrite directory index if it is at least 20% oversized
-if [[ -s $SCD_HISTFILE ]] && \
-(( $(wc -l <$SCD_HISTFILE) > 1.2 * $SCD_HISTSIZE )); then
- # compress repeated entries
- m=( ${(f)"$(_scd_Y19oug_compress $SCD_HISTFILE)"} )
- # purge non-existent directories
- m=( ${(f)"$(
- for a in $m; do
- if [[ -d ${a#*;} ]]; then print -r -- $a; fi
- done
- )"}
- )
- # cut old entries if still oversized
- if [[ $#m -gt $SCD_HISTSIZE ]]; then
- m=( ${m[-$SCD_HISTSIZE,-1]} )
- fi
- print -lr -- $m >| ${SCD_HISTFILE}
+# Rewrite directory index if it is at least 20% oversized.
+local curhistsize
+if [[ -z $opt_unindex && -s $SCD_HISTFILE ]] && \
+curhistsize=$(wc -l <$SCD_HISTFILE) && \
+(( $curhistsize > 1.2 * $SCD_HISTSIZE )); then
+ # Compress repeated entries in a background process.
+ (
+ m=( ${(f)"$(_scd_Y19oug_compress $SCD_HISTFILE)"} )
+ # purge non-existent and ignored directories
+ m=( ${(f)"$(
+ for a in $m; do
+ d=${a#*;}
+ [[ -z ${scdignore[(k)$d]} ]] || continue
+ [[ -d $d ]] || continue
+ $PWDCASECORRECT || d=( (#i)${d} )
+ t=${a%%;*}
+ print -r -- "${t};${d}"
+ done
+ )"}
+ )
+ # cut old entries if still oversized
+ if [[ $#m -gt $SCD_HISTSIZE ]]; then
+ m=( ${m[-$SCD_HISTSIZE,-1]} )
+ fi
+ # Checking existence of many directories could have taken a while.
+ # Append any index entries added in meantime.
+ m+=( ${(f)"$(sed "1,${curhistsize}d" $SCD_HISTFILE)"} )
+ print -lr -- $m >| ${SCD_HISTFILE}
+ ) &|
fi
# Determine the last recorded directory
@@ -197,13 +286,8 @@ _scd_Y19oug_record() {
}
if [[ -n $opt_add ]]; then
- for d; do
- if [[ ! -d $d ]]; then
- print -u2 "Directory '$d' does not exist."
- $EXIT 2
- fi
- done
- _scd_Y19oug_abspath m ${*:-$PWD}
+ m=( ${^${argv:-$PWD}}(N-/) )
+ _scd_Y19oug_abspath m ${m}
_scd_Y19oug_record $m
if [[ -n $opt_recursive ]]; then
for d in $m; do
@@ -220,6 +304,7 @@ if [[ -n $opt_unindex ]]; then
if [[ ! -s $SCD_HISTFILE ]]; then
$EXIT
fi
+ argv=( ${argv:-$PWD} )
# expand existing directories in the argument list
for i in {1..$#}; do
if [[ -d ${argv[i]} ]]; then
@@ -227,24 +312,28 @@ if [[ -n $opt_unindex ]]; then
argv[i]=${d}
fi
done
+ # strip trailing slashes, but preserve the root path
+ argv=( ${argv/(#m)?\/##(#e)/${MATCH[1]}} )
m="$(awk -v recursive=${opt_recursive} '
BEGIN {
for (i = 2; i < ARGC; ++i) {
argset[ARGV[i]] = 1;
delete ARGV[i];
}
+ unindex_root = ("/" in argset);
}
1 {
d = $0; sub(/^[^;]*;/, "", d);
if (d in argset) next;
}
recursive {
+ if (unindex_root) exit;
for (a in argset) {
if (substr(d, 1, length(a) + 1) == a"/") next;
}
}
{ print $0 }
- ' $SCD_HISTFILE ${*:-$PWD} )" || $EXIT $?
+ ' $SCD_HISTFILE $* )" || $EXIT $?
: >| ${SCD_HISTFILE}
[[ ${#m} == 0 ]] || print -r -- $m >> ${SCD_HISTFILE}
$EXIT
@@ -252,67 +341,113 @@ fi
# The "action" function is called when there is just one target directory.
_scd_Y19oug_action() {
- cd $1 || return $?
+ local cdcmd=cd
+ [[ -z ${opt_push} ]] || cdcmd=pushd
+ builtin $cdcmd $1 || return $?
if [[ -z $SCD_SCRIPT && -n $RUNNING_AS_COMMAND ]]; then
print -u2 "Warning: running as command with SCD_SCRIPT undefined."
fi
if [[ -n $SCD_SCRIPT ]]; then
- print -r "cd ${(q)1}" >| $SCD_SCRIPT
+ local d=$1
+ if [[ $OSTYPE == cygwin && ${(L)SCD_SCRIPT} == *.bat ]]; then
+ d=$(cygpath -aw .)
+ fi
+ print -r "${cdcmd} ${(qqq)d}" >| $SCD_SCRIPT
fi
}
-# Match and rank patterns to the index file
-# set global arrays dmatching and drank
+# Select and order indexed directories by matching command-line patterns.
+# Set global arrays dmatching and drank.
_scd_Y19oug_match() {
## single argument that is an existing directory or directory alias
if [[ -z $opt_all && $# == 1 ]] && \
- [[ -d ${d::=$1} || -d ${d::=${nameddirs[$1]}} ]] && [[ -x $d ]];
+ [[ -d ${d::=${nameddirs[$1]}} || -d ${d::=$1} ]] && [[ -x $d ]];
then
_scd_Y19oug_abspath dmatching $d
drank[${dmatching[1]}]=1
return
fi
- # ignore case unless there is an argument with an uppercase letter
- [[ "$*" == *[[:upper:]]* ]] || ICASE='(#i)'
- # support "$" as an anchor for the directory name ending
+ # quote brackets when PWD is /Volumes/[C]/
+ local qpwd=${PWD//(#m)[][]/\\${MATCH}}
+
+ # support "./" as an alias for $PWD to match only subdirectories.
+ argv=( ${argv/(#s).\/(#e)/(#s)${qpwd}(|/*)(#e)} )
+
+ # support "./pat" as an alias for $PWD/pat.
+ argv=( ${argv/(#m)(#s).\/?*/(#s)${qpwd}${MATCH#.}} )
+
+ # support "^" as an anchor for the root directory, e.g., "^$HOME".
+ argv=( ${argv/(#m)(#s)\^?*/(#s)${${~MATCH[2,-1]}}} )
+
+ # support "$" as an anchor at the end of directory name.
argv=( ${argv/(#m)?[$](#e)/${MATCH[1]}(#e)} )
- # calculate rank of all directories in the SCD_HISTFILE and keep it as drank
- # include a dummy entry for splitting of an empty string is buggy
+ # support prefix ":" to match over the tail component.
+ argv=( ${argv/(#m)(#s):?*/${MATCH[2,-1]}[^/]#(#e)} )
+
+ # calculate rank of all directories in SCD_HISTFILE and store it in drank.
+ # include a dummy entry to avoid issues with splitting an empty string.
[[ -s $SCD_HISTFILE ]] && drank=( ${(f)"$(
print -l /dev/null -10
<$SCD_HISTFILE \
- awk -v epochseconds=$EPOCHSECONDS -v meanlife=$SCD_MEANLIFE '
- BEGIN { FS = "[:;]"; }
- length($0) < 4096 && $2 > 0 {
- tau = 1.0 * ($2 - epochseconds) / meanlife;
- if (tau < -6.9078) tau = -6.9078;
- prob = exp(tau);
- sub(/^[^;]*;/, "");
- if (NF) ptot[$0] += prob;
+ awk -v epochseconds=$EPOCHSECONDS \
+ -v meanlife=$SCD_MEANLIFE \
+ -v minlogprob=$MINLOGPROB \
+ '
+ BEGIN {
+ FS = "[:;]";
+ pmin = exp(minlogprob);
}
- END { for (di in ptot) { print di; print ptot[di]; } }'
+ /^: deleted:0;/ {
+ df = $0;
+ sub("^[^;]*;", "", df);
+ delete ptot[df];
+ next;
+ }
+ length($0) < 4096 && $2 > 0 {
+ df = $0;
+ sub("^[^;]*;", "", df);
+ if (!df) next;
+ dp = df;
+ while (!(dp in ptot)) {
+ ptot[dp] = pmin;
+ sub("//*[^/]*$", "", dp);
+ if (!dp) break;
+ }
+ if ($2 <= 1000) next;
+ tau = 1.0 * ($2 - epochseconds) / meanlife;
+ prob = (tau < minlogprob) ? pmin : exp(tau);
+ ptot[df] += prob;
+ }
+ END { for (di in ptot) { print di; print ptot[di]; } }
+ '
)"}
)
unset "drank[/dev/null]"
# filter drank to the entries that match all arguments
for a; do
- p=${ICASE}"*(${a})*"
+ p="(#l)*(${a})*"
drank=( ${(kv)drank[(I)${~p}]} )
done
- # require at least one argument matches the directory name
- p=${ICASE}"*(${(j:|:)argv})[^/]#"
+ # require that at least one argument matches in directory tail name.
+ p="(#l)*(${(j:|:)argv})[^/]#"
drank=( ${(kv)drank[(I)${~p}]} )
+ # discard ignored directories
+ if [[ -z ${opt_all} ]]; then
+ for d in ${(k)drank}; do
+ [[ -z ${scdignore[(k)$d]} ]] || unset "drank[$d]"
+ done
+ fi
+
# build a list of matching directories reverse-sorted by their probabilities
dmatching=( ${(f)"$(
- for d p in ${(kv)drank}; do
- print -r -- "$p $d";
- done | sort -grk1 | cut -d ' ' -f 2-
- )"}
+ builtin printf "%s %s\n" ${(Oakv)drank} |
+ /usr/bin/sort -grk1 )"}
)
+ dmatching=( ${dmatching#*[[:blank:]]} )
# do not match $HOME or $PWD when run without arguments
if [[ $# == 0 ]]; then
@@ -320,12 +455,20 @@ _scd_Y19oug_match() {
fi
# keep at most SCD_MENUSIZE of matching and valid directories
+ # mark up any deleted entries in the index
+ local -A isdeleted
m=( )
+ isdeleted=( )
for d in $dmatching; do
[[ ${#m} == $SCD_MENUSIZE ]] && break
- [[ -d $d && -x $d ]] && m+=$d
+ (( ${+isdeleted[$d]} == 0 )) || continue
+ [[ -d $d ]] || { isdeleted[$d]=1; continue }
+ [[ -x $d ]] && m+=$d
done
dmatching=( $m )
+ if [[ -n ${isdeleted} ]]; then
+ print -lr -- ": deleted:0;"${^${(k)isdeleted}} >> $SCD_HISTFILE
+ fi
# find the maximum rank
maxrank=0.0
@@ -343,7 +486,7 @@ _scd_Y19oug_match() {
_scd_Y19oug_match $*
-## process whatever directories that remained
+## process matching directories.
if [[ ${#dmatching} == 0 ]]; then
print -u2 "No matching directory."
$EXIT 1
@@ -367,13 +510,13 @@ if [[ -n $opt_list ]]; then
$EXIT
fi
-## process single directory match
+## handle a single matching directory here.
if [[ ${#dmatching} == 1 ]]; then
_scd_Y19oug_action $dmatching
$EXIT $?
fi
-## here we have multiple matches - display selection menu
+## Here we have multiple matches. Let's use the selection menu.
a=( {a-z} {A-Z} )
a=( ${a[1,${#dmatching}]} )
p=( )
diff --git a/zsh/plugins/scd/scd.plugin.zsh b/zsh/plugins/scd/scd.plugin.zsh
index 0197c53..1a6c186 100644
--- a/zsh/plugins/scd/scd.plugin.zsh
+++ b/zsh/plugins/scd/scd.plugin.zsh
@@ -1,19 +1,17 @@
## The scd script should autoload as a shell function.
-autoload scd
+autoload -Uz scd
## If the scd function exists, define a change-directory-hook function
## to record visited directories in the scd index.
if [[ ${+functions[scd]} == 1 ]]; then
- scd_chpwd_hook() { scd --add $PWD }
- autoload add-zsh-hook
- add-zsh-hook chpwd scd_chpwd_hook
+ chpwd_scd() { scd --add $PWD }
+ autoload -Uz add-zsh-hook
+ add-zsh-hook chpwd chpwd_scd
fi
-## Allow scd usage with unquoted wildcard characters such as "*" or "?".
-alias scd='noglob scd'
-
-
## Load the directory aliases created by scd if any.
-if [[ -s ~/.scdalias.zsh ]]; then source ~/.scdalias.zsh; fi
+if [[ -s ~/.scdalias.zsh ]]; then
+ source ~/.scdalias.zsh
+fi
diff --git a/zsh/plugins/screen/README.md b/zsh/plugins/screen/README.md
new file mode 100644
index 0000000..103e172
--- /dev/null
+++ b/zsh/plugins/screen/README.md
@@ -0,0 +1,10 @@
+# screen
+
+This plugin sets title and hardstatus of the tab window for [screen](https://www.gnu.org/software/screen/),
+the terminal multiplexer.
+
+To use it add `screen` to the plugins array in your zshrc file.
+
+```zsh
+plugins=(... screen)
+```
diff --git a/zsh/plugins/sdk/README.md b/zsh/plugins/sdk/README.md
index b237f3b..1eda5d3 100644
--- a/zsh/plugins/sdk/README.md
+++ b/zsh/plugins/sdk/README.md
@@ -3,6 +3,12 @@
Plugin for SDKMAN, a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems.
Provides autocompletion for all known commands.
+To use it, add `sdk` to your plugins array in your zshrc file:
+
+```zsh
+plugins=(... sdk)
+```
+
## Requirements
- * [SDKMAN](http://sdkman.io/)
+* [SDKMAN](http://sdkman.io/)
diff --git a/zsh/plugins/sdk/sdk.plugin.zsh b/zsh/plugins/sdk/sdk.plugin.zsh
index d00459b..441bd6f 100644
--- a/zsh/plugins/sdk/sdk.plugin.zsh
+++ b/zsh/plugins/sdk/sdk.plugin.zsh
@@ -1,82 +1,58 @@
+#!/usr/bin/env zsh
+
### SDKMAN Autocomplete for Oh My Zsh
-# This is the output from sdkman. All the these options are supported at the
-# moment.
-
-# Usage: sdk [candidate] [version]
-# sdk offline
-#
-# commands:
-# install or i [version]
-# uninstall or rm
-# list or ls [candidate]
-# use or u [version]
-# default or d [version]
-# current or c [candidate]
-# upgrade or ug [candidate]
-# version or v
-# broadcast or b
-# help or h
-# offline [enable|disable]
-# selfupdate [force]
-# update
-# flush
-#
-# candidate : the SDK to install: groovy, scala, grails, gradle, kotlin, etc.
-# use list command for comprehensive list of candidates
-# eg: $ sdk list
-#
-# version : where optional, defaults to latest stable if not provided
-# eg: $ sdk install groovy
-
-local _sdk_commands=(
- install i
- uninstall rm
- list ls
- use u
- default d
- current c
- upgrade ug
- version v
- broadcast b
- help h
- offline
- selfupdate
- update
- flush
-)
-
-_listInstalledVersions() {
- __sdkman_build_version_csv $1 | sed -e "s/,/ /g"
-}
-
-_listInstallableVersions() {
- __sdkman_list_versions $1 | grep "^ " | sed -e "s/\* /*/g" | \
- sed -e "s/>//g" | xargs -n 1 echo | grep -v "^*"
-}
-
-_listAllVersion() {
- __sdkman_list_versions $1 | grep "^ " | sed -e "s/\*/ /g" | sed -e "s/>//g"
-}
-
-_sdk () {
- case $CURRENT in
- 2) compadd -- $_sdk_commands ;;
- 3) case "$words[2]" in
- i|install|rm|uninstall|ls|list|u|use|d|default|c|current|ug|upgrade)
- compadd -- $SDKMAN_CANDIDATES ;;
- offline) compadd -- enable disable ;;
- selfupdate) compadd -- force ;;
- flush) compadd -- candidates broadcast archives temp ;;
- esac
- ;;
- 4) case "$words[2]" in
- rm|uninstall|d|default) compadd -- $(_listInstalledVersions $words[3]) ;;
- i|install) compadd -- $(_listInstallableVersions $words[3]) ;;
- u|use) compadd -- $(_listAllVersion $words[3]) ;;
- esac
- ;;
- esac
+_sdk() {
+ case "${CURRENT}" in
+ 2)
+ compadd -X $'Commands:\n' -- "${${(Mk)functions[@]:#__sdk_*}[@]#__sdk_}"
+ compadd -n rm
+ ;;
+ 3)
+ case "${words[2]}" in
+ l|ls|list|i|install)
+ compadd -X $'Candidates:\n' -- "${SDKMAN_CANDIDATES[@]}"
+ ;;
+ ug|upgrade|h|home|c|current|u|use|d|default|rm|uninstall)
+ compadd -X $'Installed Candidates:\n' -- "${${(u)${(f)$(find -L -- "${SDKMAN_CANDIDATES_DIR}" -mindepth 2 -maxdepth 2 -type d)}[@]:h}[@]:t}"
+ ;;
+ e|env)
+ compadd init
+ ;;
+ offline)
+ compadd enable disable
+ ;;
+ selfupdate)
+ compadd force
+ ;;
+ flush)
+ compadd archives broadcast temp version
+ ;;
+ esac
+ ;;
+ 4)
+ case "${words[2]}" in
+ i|install)
+ setopt localoptions kshglob
+ if [[ "${words[3]}" == 'java' ]]; then
+ compadd -X $'Installable Versions of java:\n' -- "${${${${${(f)$(__sdkman_list_versions "${words[3]}")}[@]:5:-4}[@]:#* | (local only|installed ) | *}[@]##* | | }[@]%%+( )}"
+ else
+ compadd -X "Installable Versions of ${words[3]}:"$'\n' -- "${${(z)${(M)${(f)${$(__sdkman_list_versions "${words[3]}")//[*+>]+( )/-}}[@]:# *}[@]}[@]:#-*}"
+ fi
+ ;;
+ h|home|u|use|d|default|rm|uninstall)
+ compadd -X "Installed Versions of ${words[3]}:"$'\n' -- "${${(f)$(find -L -- "${SDKMAN_CANDIDATES_DIR}/${words[3]}" -mindepth 1 -maxdepth 1 -type d -not -name 'current')}[@]:t}"
+ ;;
+ esac
+ ;;
+ 5)
+ case "${words[2]}" in
+ i|install)
+ _files -X "Path to Local Installation of ${words[3]} ${words[4]}:"$'\n' -/
+ ;;
+ esac
+ ;;
+ esac
}
compdef _sdk sdk
diff --git a/zsh/plugins/sfffe/README.md b/zsh/plugins/sfffe/README.md
new file mode 100644
index 0000000..29044e8
--- /dev/null
+++ b/zsh/plugins/sfffe/README.md
@@ -0,0 +1,17 @@
+# "Search files for Front-End"
+
+This plugin adds a few functions for searching files used in Front-End web development.
+
+To use it, add `sfffe` to the plugins array in your zshrc file:
+```zsh
+plugins=(... sfffe)
+```
+
+**Requires:** `ack`
+
+## Functions
+
+- `ajs`: look for string in `.js` files.
+- `acss`: look for string in `.css` files.
+- `fjs`: search for `.js` files under the current working directory.
+- `fcss`: search for `.css` files under the current working directory.
diff --git a/zsh/plugins/sfffe/sfffe.plugin.zsh b/zsh/plugins/sfffe/sfffe.plugin.zsh
index a0f0349..177e5fa 100644
--- a/zsh/plugins/sfffe/sfffe.plugin.zsh
+++ b/zsh/plugins/sfffe/sfffe.plugin.zsh
@@ -6,9 +6,9 @@
# REQUIRE: ack
# ------------------------------------------------------------------------------
-if [ ! -x $(which ack) ]; then
- echo \'ack\' is not installed!
- exit -1
+if (( ! $+commands[ack] )); then
+ echo "'ack' is not installed!"
+ return
fi
ajs() {
diff --git a/zsh/plugins/shell-proxy/README.md b/zsh/plugins/shell-proxy/README.md
new file mode 100644
index 0000000..6f2cd13
--- /dev/null
+++ b/zsh/plugins/shell-proxy/README.md
@@ -0,0 +1,52 @@
+# Shell Proxy oh-my-zsh plugin
+
+This a pure user-space program, shell-proxy setter, written Python3 and Bash.
+
+100% only no side-effects, only effect **environment variables** and **aliases**
+
+## Key feature
+
+- Support Ubuntu, Archlinux, etc (Linux)
+- Support macOS
+- Support git via based-`$GIT_SSH`
+- Support ssh, sftp, scp, slogin and ssh-copy-id via based-`alias`
+- Built-in Auto-complete
+
+## Usage
+
+Method 1:
+
+`$DEFAULT_PROXY` is the proxy URL you will set
+
+Method 2:
+
+Write a program to `$HOME/.config/proxy` in the file.
+
+Example program:
+
+```bash
+#!/bin/bash
+# The file path: $HOME/.config/proxy
+if [[ "$OSTYPE" == "darwin"* ]]; then
+ echo "http://127.0.0.1:6152" # Surge Mac
+else
+ echo "http://127.0.0.1:8123" # polipo
+fi
+```
+
+Method 3:
+
+The working path of **Method 2** can be changed via `$CONFIG_PROXY`
+
+## Reference
+
+- `$GIT_SSH`:
+- OpenSSH manual:
+
+## Maintainer
+
+-
+
+## The oh-my-zsh plugin (shell-proxy)
+
+Public Domain
diff --git a/zsh/plugins/shell-proxy/proxy.py b/zsh/plugins/shell-proxy/proxy.py
new file mode 100755
index 0000000..2b62f6c
--- /dev/null
+++ b/zsh/plugins/shell-proxy/proxy.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python3
+import os
+import sys
+from subprocess import check_output, list2cmdline
+
+cwd = os.path.dirname(__file__)
+ssh_agent = os.path.join(cwd, "ssh-agent.py")
+user_proxy = os.environ.get("CONFIG_PROXY", os.path.expandvars("$HOME/.config/proxy"))
+
+
+def get_http_proxy():
+ if "DEFAULT_PROXY" in os.environ:
+ return os.environ["DEFAULT_PROXY"]
+ if os.path.isfile(user_proxy):
+ return check_output(user_proxy).decode("utf-8").strip()
+ raise Exception("Not found, Proxy configuration")
+
+
+def make_proxies(url: str):
+ proxies = {"%s_PROXY" % _: url for _ in ("HTTP", "HTTPS", "FTP", "RSYNC", "ALL")}
+ proxies.update({name.lower(): value for (name, value) in proxies.items()})
+ proxies["GIT_SSH"] = ssh_agent
+ return proxies
+
+
+def merge(mapping: dict):
+ return ("%s=%s" % _ for _ in mapping.items())
+
+
+class CommandSet:
+ proxies = make_proxies(get_http_proxy())
+ aliases = {
+ _: "env NAME=%s %s" % (_, ssh_agent)
+ for _ in ("ssh", "sftp", "scp", "slogin", "ssh-copy-id")
+ }
+
+ def enable(self):
+ cmdline("export", *merge(self.proxies))
+ cmdline("alias", *merge(self.aliases))
+
+ def disable(self):
+ cmdline("unset", *self.proxies.keys())
+ cmdline("unalias", *self.aliases.keys())
+
+ def status(self):
+ proxies = (
+ "%11s = %s" % (name, os.environ[name])
+ for name in self.proxies.keys()
+ if name in os.environ
+ )
+ for _ in proxies:
+ cmdline("echo", _)
+
+ def usage(self):
+ cmdline("echo", "usage: proxy {enable,disable,status}")
+ self.status()
+
+
+def cmdline(*items):
+ print(list2cmdline(items))
+
+
+def main():
+ command = CommandSet()
+ if len(sys.argv) == 1:
+ command.usage()
+ sys.exit(-1)
+ getattr(command, sys.argv[1], command.usage)()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/zsh/plugins/shell-proxy/shell-proxy.plugin.zsh b/zsh/plugins/shell-proxy/shell-proxy.plugin.zsh
new file mode 100644
index 0000000..fd0e2fe
--- /dev/null
+++ b/zsh/plugins/shell-proxy/shell-proxy.plugin.zsh
@@ -0,0 +1,16 @@
+#!/usr/bin/bash
+# shellcheck disable=SC1090
+
+__PROXY__="${0:A:h}/proxy.py"
+
+proxy() {
+ source <("$__PROXY__" "$1")
+}
+
+_proxy() {
+ local -r commands=('enable' 'disable' 'status')
+ compset -P '*,'
+ compadd -S '' "${commands[@]}"
+}
+
+compdef '_proxy' 'proxy'
diff --git a/zsh/plugins/shell-proxy/ssh-agent.py b/zsh/plugins/shell-proxy/ssh-agent.py
new file mode 100755
index 0000000..61cf84c
--- /dev/null
+++ b/zsh/plugins/shell-proxy/ssh-agent.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python3
+import os
+import subprocess
+import sys
+
+ssh_proxy = os.path.join(os.path.dirname(__file__), "ssh-proxy.py")
+
+argv = [
+ os.environ.get("NAME", "ssh"),
+ "-o",
+ "ProxyCommand={} %h %p".format(ssh_proxy),
+ "-o",
+ "Compression=yes",
+]
+
+subprocess.call(argv + sys.argv[1:], env=os.environ)
diff --git a/zsh/plugins/shell-proxy/ssh-proxy.py b/zsh/plugins/shell-proxy/ssh-proxy.py
new file mode 100755
index 0000000..5efd5fd
--- /dev/null
+++ b/zsh/plugins/shell-proxy/ssh-proxy.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+import os
+import subprocess
+import sys
+import urllib.parse
+
+proxy = next(os.environ[_] for _ in ("HTTP_PROXY", "HTTPS_PROXY") if _ in os.environ)
+argv = [
+ "nc",
+ "-X",
+ "connect",
+ "-x",
+ urllib.parse.urlparse(proxy).netloc, # proxy-host:proxy-port
+ sys.argv[1], # host
+ sys.argv[2], # port
+]
+
+subprocess.call(argv)
diff --git a/zsh/plugins/shrink-path/README.md b/zsh/plugins/shrink-path/README.md
index b990aea..33dc3f8 100644
--- a/zsh/plugins/shrink-path/README.md
+++ b/zsh/plugins/shrink-path/README.md
@@ -7,19 +7,26 @@ For this directory tree:
```
/home/
me/
- foo/
+ f o o/ # The prefix f is ambiguous between "f o o" and "f i g".
bar/
quux/
biz/ # The prefix b is ambiguous between bar and biz.
+ f i g/
+ baz/
```
here are the results of calling `shrink_path /home/me/foo/bar/quux`:
```
Option Result
- /h/m/f/ba/q
- -l|--last /h/m/f/ba/quux
+ /h/m/f o/ba/q
+ -l|--last /h/m/f o/ba/q
-s|--short /h/m/f/b/q
- -t|--tilde ~/f/ba/q
+ -t|--tilde ~/f o/ba/q
-f|--fish ~/f/b/quux
+ -g|--glob /h*/m*/f o*/ba*/q*
+ -3 /hom/me/f o/bar/quu
+ -e '$' -3 /hom$/me/f o$/bar/quu$
+ -q /h/m/f\ o/ba/q
+ -g -q /h*/m*/f\ o*/ba*/q*
```
@@ -37,11 +44,16 @@ The following options are available:
```
-f, --fish fish simulation, equivalent to -l -s -t.
+ -g, --glob Add asterisk to allow globbing of shrunk path (equivalent to -e "*")
-l, --last Print the last directory's full name.
- -s, --short Truncate directory names to the first character. Without
+ -s, --short Truncate directory names to the number of characters given by -. Without
-s, names are truncated without making them ambiguous.
-t, --tilde Substitute ~ for the home directory.
-T, --nameddirs Substitute named directories as well.
+ -# Truncate each directly to at least this many characters inclusive of the
+ ellipsis character(s) (defaulting to 1).
+ -e SYMBOL Postfix symbol(s) to indicate that a directory name had been truncated.
+ -q, --quote Quote special characters in the shrunk path
```
The long options can also be set via zstyle, like
@@ -56,6 +68,7 @@ supported.
## License
Copyright (C) 2008 by Daniel Friesel
+Copyright (C) 2018-2020 by Pavel N. Krivitsky
License: WTFPL
diff --git a/zsh/plugins/shrink-path/shrink-path.plugin.zsh b/zsh/plugins/shrink-path/shrink-path.plugin.zsh
index 86102e6..f0ed651 100644
--- a/zsh/plugins/shrink-path/shrink-path.plugin.zsh
+++ b/zsh/plugins/shrink-path/shrink-path.plugin.zsh
@@ -9,11 +9,16 @@
# The following options are available:
#
# -f, --fish fish simulation, equivalent to -l -s -t.
+# -g, --glob Add asterisk to allow globbing of shrunk path (equivalent to -e "*")
# -l, --last Print the last directory's full name.
-# -s, --short Truncate directory names to the first character. Without
+# -s, --short Truncate directory names to the number of characters given by -#. Without
# -s, names are truncated without making them ambiguous.
# -t, --tilde Substitute ~ for the home directory.
# -T, --nameddirs Substitute named directories as well.
+# -# Truncate each directly to at least this many characters inclusive of the
+# ellipsis character(s) (defaulting to 1).
+# -e SYMBOL Postfix symbol(s) to indicate that a directory name had been truncated.
+# -q, --quote Quote special characters in the shrunk path
#
# The long options can also be set via zstyle, like
# zstyle :prompt:shrink_path fish yes
@@ -37,6 +42,9 @@ shrink_path () {
typeset -i short=0
typeset -i tilde=0
typeset -i named=0
+ typeset -i length=1
+ typeset ellipsis=""
+ typeset -i quote=0
if zstyle -t ':prompt:shrink_path' fish; then
lastfull=1
@@ -50,9 +58,15 @@ shrink_path () {
zstyle -t ':prompt:shrink_path' last && lastfull=1
zstyle -t ':prompt:shrink_path' short && short=1
zstyle -t ':prompt:shrink_path' tilde && tilde=1
+ zstyle -t ':prompt:shrink_path' glob && ellipsis='*'
+ zstyle -t ':prompt:shrink_path' quote && quote=1
while [[ $1 == -* ]]; do
case $1 in
+ --)
+ shift
+ break
+ ;;
-f|--fish)
lastfull=1
short=1
@@ -61,10 +75,16 @@ shrink_path () {
-h|--help)
print 'Usage: shrink_path [-f -l -s -t] [directory]'
print ' -f, --fish fish-simulation, like -l -s -t'
+ print ' -g, --glob Add asterisk to allow globbing of shrunk path (equivalent to -e "*")'
print ' -l, --last Print the last directory''s full name'
- print ' -s, --short Truncate directory names to the first character'
+ print ' -s, --short Truncate directory names to the number of characters given by -#. Without'
+ print ' -s, names are truncated without making them ambiguous.'
print ' -t, --tilde Substitute ~ for the home directory'
print ' -T, --nameddirs Substitute named directories as well'
+ print ' -# Truncate each directly to at least this many characters inclusive of the'
+ print ' ellipsis character(s) (defaulting to 1).'
+ print ' -e SYMBOL Postfix symbol(s) to indicate that a directory name had been truncated.'
+ print ' -q, --quote Quote special characters in the shrunk path'
print 'The long options can also be set via zstyle, like'
print ' zstyle :prompt:shrink_path fish yes'
return 0
@@ -76,10 +96,24 @@ shrink_path () {
tilde=1
named=1
;;
+ -[0-9]|-[0-9][0-9])
+ length=${1/-/}
+ ;;
+ -e)
+ shift
+ ellipsis="$1"
+ ;;
+ -g|--glob)
+ ellipsis='*'
+ ;;
+ -q|--quote)
+ quote=1
+ ;;
esac
shift
done
+ typeset -i elllen=${#ellipsis}
typeset -a tree expn
typeset result part dir=${1-$PWD}
typeset -i i
@@ -109,12 +143,22 @@ shrink_path () {
expn=(a b)
part=''
i=0
- until [[ (( ${#expn} == 1 )) || $dir = $expn || $i -gt 99 ]] do
+ until [[ $i -gt 99 || ( $i -ge $((length - ellen)) || $dir == $part ) && ( (( ${#expn} == 1 )) || $dir = $expn ) ]]; do
(( i++ ))
part+=$dir[$i]
expn=($(echo ${part}*(-/)))
- (( short )) && break
+ (( short )) && [[ $i -ge $((length - ellen)) ]] && break
done
+
+ typeset -i dif=$(( ${#dir} - ${#part} - ellen ))
+ if [[ $dif -gt 0 ]]
+ then
+ (( quote )) && part=${(q)part}
+ part+="$ellipsis"
+ else
+ part="$dir"
+ (( quote )) && part=${(q)part}
+ fi
result+="/$part"
cd -q $dir
shift tree
diff --git a/zsh/plugins/singlechar/README.md b/zsh/plugins/singlechar/README.md
new file mode 100644
index 0000000..d890299
--- /dev/null
+++ b/zsh/plugins/singlechar/README.md
@@ -0,0 +1,118 @@
+# Singlechar plugin
+
+This plugin adds single char shortcuts (and combinations) for some commands.
+
+To use it, add `singlechar` to the plugins array of your zshrc file:
+```
+plugins=(... singlechar)
+```
+
+## Aliases
+
+### CAT, GREP, CURL, WGET
+
+| Alias | Command | Description |
+|-------|------------------|-------------|
+| y | `grep -Ri` | Find case-insensitive string in all files and directories, recursively. Follows symlinks. |
+| n | `grep -Rvi` | Same as above but only show lines that don't match the string. |
+| f | `grep -Rli` | Same as 'y' but only print the filenames where the string is found. |
+| fn | `grep -Rlvi` | Same as above but only show files that don't contain the string. |
+| f. | `find . \| grep` | Grep list of files in current directory |
+| f: | `find` | 'find' command |
+| p | `less` | 'less' command |
+| m | `man` | 'man' command |
+| d | `wget` | 'wget' command |
+| u | `curl` | 'curl' command |
+| c | `cat` | 'cat' command |
+| w | `echo >` | Write arguments to file, overwriting it if it exists. |
+| a | `echo >>` | Write arguments to file, appending them if the file exists. |
+| w: | `cat >` | Write stdin to file, overwriting if it exists. |
+| a: | `cat >>` | Write stdin to file, appending it if the file exists. |
+
+### XARGS
+
+These aliases are versions of the aliases above but using xargs. This can be used
+by piping the arguments to the xargs aliases.
+
+| Alias | Command | Description |
+|-------|----------------------|---------------------------------|
+| x | `xargs` | 'xargs' command |
+| xy | `xargs grep -Ri` | Same as 'y' alias using xargs. |
+| xn | `xargs grep -Rvi` | Same as 'n' alias using xargs. |
+| xf | `xargs grep -Rli` | Same as 'f' alias using xargs. |
+| xfn | `xargs grep -Rlvi` | Same as 'fn' alias using xargs. |
+| xf. | `xargs find \| grep` | Same as 'f.' alias using xargs. |
+| xf: | `xargs find` | Same as 'f:' alias using xargs. |
+| xc | `xargs cat` | Same as 'c' alias using xargs. |
+| xp | `xargs less` | Same as 'p' alias using xargs. |
+| xm | `xargs man` | Same as 'm' alias using xargs. |
+| xd | `xargs wget` | Same as 'd' alias using xargs. |
+| xu | `xargs curl` | Same as 'u' alias using xargs. |
+| xw | `xargs echo >` | Same as 'w' alias using xargs. |
+| xa | `xargs echo >>` | Same as 'a' alias using xargs. |
+| xw: | `xargs cat >` | Same as 'w:' alias using xargs. |
+| xa: | `xargs >>` | Same as 'a:' alias using xargs. |
+
+### SUDO
+
+These aliases are versions of the aliases above in [CAT, GREP, CURL, WGET](#cat-grep-curl-wget)
+but using sudo to run them with root permission.
+
+| Alias | Command | Description |
+|-------|-----------------------|--------------------------------|
+| s | `sudo` | 'sudo' command |
+| sy | `sudo grep -Ri` | Same as 'y' alias using sudo. |
+| sn | `sudo grep -Riv` | Same as 'n' alias using sudo. |
+| sf | `sudo grep -Rli` | Same as 'f' alias using sudo. |
+| sfn | `sudo grep -Rlvi` | Same as 'fn' alias using sudo. |
+| sf. | `sudo find . \| grep` | Same as 'f.' alias using sudo. |
+| sf: | `sudo find` | Same as 'f:' alias using sudo. |
+| sp | `sudo less` | Same as 'p' alias using sudo. |
+| sm | `sudo man` | Same as 'm' alias using sudo. |
+| sd | `sudo wget` | Same as 'd' alias using sudo. |
+| sc | `sudo cat` | Same as 'c' alias using sudo. |
+| sw | `sudo echo >` | Same as 'w' alias using sudo. |
+| sa | `sudo echo >>` | Same as 'a' alias using sudo. |
+| sw: | `sudo cat >` | Same as 'w:' alias using sudo. |
+| sa: | `sudo cat >>` | Same as 'a:' alias using sudo. |
+
+### SUDO-XARGS
+
+Same as above but using both sudo and xargs.
+
+| Alias | Command | Description |
+|-------|---------------------------|---------------------------------|
+| sx | `sudo xargs` | 'sudo xargs' command |
+| sxy | `sudo xargs grep -Ri` | Same as 'xy' alias using sudo. |
+| sxn | `sudo xargs grep -Riv` | Same as 'xn' alias using sudo. |
+| sxf | `sudo xargs grep -li` | Same as 'xf' alias using sudo. |
+| sxfn | `sudo xargs grep -lvi` | Same as 'xfn' alias using sudo. |
+| sxf. | `sudo xargs find \| grep` | Same as 'xf.' alias using sudo. |
+| sxf: | `sudo xargs find` | Same as 'xf:' alias using sudo. |
+| sxp | `sudo xargs less` | Same as 'xp' alias using sudo. |
+| sxm | `sudo xargs man` | Same as 'xm' alias using sudo. |
+| sxd | `sudo xargs wget` | Same as 'xd' alias using sudo. |
+| sxu | `sudo xargs curl` | Same as 'xu' alias using sudo. |
+| sxc | `sudo xargs cat` | Same as 'xc' alias using sudo. |
+| sxw | `sudo xargs echo >` | Same as 'xw' alias using sudo. |
+| sxa | `sudo xargs echo >>` | Same as 'xa' alias using sudo. |
+| sxw: | `sudo xargs cat >` | Same as 'xw:' alias using sudo. |
+| sxa: | `sudo xargs cat >>` | Same as 'xa:' alias using sudo. |
+
+## Options
+
+The commands `grep`, `sudo`, `wget`, `curl`, and `less` can be configured to use other commands
+via the setup variables below, before Oh My Zsh is sourced. If they are not set yet, they will
+use their default values:
+
+| Setup variable | Default value |
+|----------------|---------------|
+| GREP | `grep` |
+| ROOT | `sudo` |
+| WGET | `wget` |
+| CURL | `curl` |
+| PAGER | `less` |
+
+## Author
+
+- [Karolin Varner](https://github.com/koraa)
diff --git a/zsh/plugins/singlechar/singlechar.plugin.zsh b/zsh/plugins/singlechar/singlechar.plugin.zsh
index 44bd998..d4b0b67 100644
--- a/zsh/plugins/singlechar/singlechar.plugin.zsh
+++ b/zsh/plugins/singlechar/singlechar.plugin.zsh
@@ -1,13 +1,3 @@
-################################################################################
-# FILE: singlechar.plugin.zsh
-# DESCRIPTION: oh-my-zsh plugin file.
-# AUTHOR: Michael Varner (musikmichael@web.de)
-# VERSION: 1.0.0
-#
-# This plugin adds single char shortcuts (and combinations) for some commands.
-#
-################################################################################
-
###########################
# Settings
@@ -130,4 +120,4 @@ alias sxd='"$ROOT" xargs "$WGET"'
alias sxu='"$ROOT" xargs "$CURL"'
alias sxw:='"$ROOT" xargs cat >'
-alias sxa:='"$ROOT" xargs cat >>'
\ No newline at end of file
+alias sxa:='"$ROOT" xargs cat >>'
diff --git a/zsh/plugins/sprunge/README.md b/zsh/plugins/sprunge/README.md
new file mode 100644
index 0000000..28ed183
--- /dev/null
+++ b/zsh/plugins/sprunge/README.md
@@ -0,0 +1,32 @@
+# Sprunge plugin
+
+This plugin uploads data and fetch URL from the pastebin http://sprunge.us
+
+To enable it, add 'sprunge' to your plugins:
+
+```zsh
+plugins=(... sprunge)
+```
+
+## Usage
+
+| Command | Description |
+|------------------------------|-------------------------------------------|
+| `sprunge filename.txt` | Uploads filename.txt |
+| `sprunge "this is a string"` | Uploads plain text |
+| `sprunge < filename.txt` | Redirects filename.txt content to sprunge |
+| `echo data \| sprunge` | Any piped data will be uploaded |
+
+Once sprunge has processed the input it will give you a unique HTTP address:
+```
+$ sprunge "hello"
+http://sprunge.us/XxjnKz
+```
+
+## Notes
+
+- Sprunge accepts piped data, stdin redirection, text strings as input or filenames.
+ Only one of these can be used at a time.
+- Argument precedence goes as follows: stdin > piped input > text strings.
+- If a filename is mispelled or doesn't have the necessary path description, it will NOT
+ generate an error, but instead treat it as a text string.
diff --git a/zsh/plugins/sprunge/sprunge.plugin.zsh b/zsh/plugins/sprunge/sprunge.plugin.zsh
index e1c89b7..5d5687a 100644
--- a/zsh/plugins/sprunge/sprunge.plugin.zsh
+++ b/zsh/plugins/sprunge/sprunge.plugin.zsh
@@ -2,12 +2,9 @@
# Created by the blogger at the URL below...I don't know where to find his/her name
# Original found at https://www.shellperson.net/sprunge-pastebin-script/
-usage() {
-description | fmt -s >&2
-}
-
-description() {
-cat << HERE
+sprunge() {
+ if [[ "$1" = --help ]]; then
+ fmt -s >&2 << EOF
DESCRIPTION
Upload data and fetch URL from the pastebin http://sprunge.us
@@ -19,44 +16,41 @@ USAGE
piped_data | $0
NOTES
---------------------------------------------------------------------------
-* INPUT METHODS *
-$0 can accept piped data, STDIN redirection [&2
- if [ "$*" ]; then
- echo Arguments present... >&2
- if [ -f "$*" ]; then
- echo Uploading the contents of "$*"... >&2
- cat "$*"
- else
- echo Uploading the text: \""$*"\"... >&2
- echo "$*"
- fi | curl -F 'sprunge=<-' http://sprunge.us
- else
- echo No arguments found, printing USAGE and exiting. >&2
- usage
- fi
- else
- echo Using input from a pipe or STDIN redirection... >&2
- curl -F 'sprunge=<-' http://sprunge.us
- fi
+EOF
+ return
+ fi
+
+ if [ -t 0 ]; then
+ echo Running interactively, checking for arguments... >&2
+ if [ "$*" ]; then
+ echo Arguments present... >&2
+ if [ -f "$*" ]; then
+ echo Uploading the contents of "$*"... >&2
+ cat "$*"
+ else
+ echo Uploading the text: \""$*"\"... >&2
+ echo "$*"
+ fi | curl -F 'sprunge=<-' http://sprunge.us
+ else
+ echo No arguments found, printing USAGE and exiting. >&2
+ sprunge --help
+ return 1
+ fi
+ else
+ echo Using input from a pipe or STDIN redirection... >&2
+ curl -F 'sprunge=<-' http://sprunge.us
+ fi
}
diff --git a/zsh/plugins/stack/stack.plugin.zsh b/zsh/plugins/stack/stack.plugin.zsh
index a149208..45ef387 100644
--- a/zsh/plugins/stack/stack.plugin.zsh
+++ b/zsh/plugins/stack/stack.plugin.zsh
@@ -1,37 +1,4 @@
-function _stack_commands() {
- local ret=1 state
- _arguments ':subcommand:->subcommand' && ret=0
+(( $+commands[stack] )) || return
- case $state in
- subcommand)
- subcommands=(
- "build:Build the project(s) in this directory/configuration"
- "install:Build executables and install to a user path"
- "test:Build and test the project(s) in this directory/configuration"
- "bench:Build and benchmark the project(s) in this directory/configuration"
- "haddock:Generate haddocks for the project(s) in this directory/configuration"
- "new:Create a brand new project"
- "init:Initialize a stack project based on one or more stack packages"
- "solver:Use a dependency solver to try and determine missing extra-deps"
- "setup:Get the appropriate ghc for your project"
- "path:Print out handy path information"
- "unpack:Unpack one or more packages locally"
- "update:Update the package index"
- "upgrade:Upgrade to the latest stack (experimental)"
- "upload:Upload a package to Hackage"
- "dot:Visualize your project's dependency graph using Graphviz dot"
- "exec:Execute a command"
- "ghc:Run ghc"
- "ghci:Run ghci in the context of project(s)"
- "ide:Run ide-backend-client with the correct arguments"
- "runghc:Run runghc"
- "clean:Clean the local packages"
- "docker:Subcommands specific to Docker use"
- )
- _describe -t subcommands 'stack subcommands' subcommands && ret=0
- esac
-
- return ret
-}
-
-compdef _stack_commands stack
+autoload -U +X bashcompinit && bashcompinit
+source <(stack --bash-completion-script stack)
diff --git a/zsh/plugins/sublime-merge/README.md b/zsh/plugins/sublime-merge/README.md
new file mode 100644
index 0000000..5344791
--- /dev/null
+++ b/zsh/plugins/sublime-merge/README.md
@@ -0,0 +1,17 @@
+## sublime-merge
+
+Plugin for Sublime Merge, a cross platform text and code editor, available for Linux, Mac OS X, and Windows.
+
+### Requirements
+
+ * [Sublime Merge](https://www.sublimemerge.com)
+
+### Usage
+
+ * If `sm` command is called without an argument, launch Sublime Merge
+
+ * If `sm` is passed a directory, `cd` to it and open the existing git repository in Sublime Merge
+
+ * If `smt` command is called, it is equivalent to `sm .`, opening the existing git repository in the current folder in Sublime Merge
+
+ * If `ssm` command is called, it is like `sudo sm`, opening the git repository in Sublime Merge. Useful for editing system protected repositories.
\ No newline at end of file
diff --git a/zsh/plugins/sublime-merge/sublime-merge.plugin.zsh b/zsh/plugins/sublime-merge/sublime-merge.plugin.zsh
new file mode 100644
index 0000000..15452e6
--- /dev/null
+++ b/zsh/plugins/sublime-merge/sublime-merge.plugin.zsh
@@ -0,0 +1,55 @@
+# Sublime Merge Aliases
+
+() {
+
+ if [[ "$OSTYPE" == linux* ]]; then
+ local _sublime_linux_paths
+ _sublime_linux_paths=(
+ "$HOME/bin/sublime_merge"
+ "/opt/sublime_merge/sublime_merge"
+ "/usr/bin/sublime_merge"
+ "/usr/local/bin/sublime_merge"
+ "/usr/bin/sublime_merge"
+ "/usr/local/bin/smerge"
+ "/usr/bin/smerge"
+ )
+ for _sublime_merge_path in $_sublime_linux_paths; do
+ if [[ -a $_sublime_merge_path ]]; then
+ sm_run() { $_sublime_merge_path "$@" >/dev/null 2>&1 &| }
+ ssm_run_sudo() {sudo $_sublime_merge_path "$@" >/dev/null 2>&1}
+ alias ssm=ssm_run_sudo
+ alias sm=sm_run
+ break
+ fi
+ done
+ elif [[ "$OSTYPE" = darwin* ]]; then
+ local _sublime_darwin_paths
+ _sublime_darwin_paths=(
+ "/usr/local/bin/smerge"
+ "/Applications/Sublime Merge.app/Contents/SharedSupport/bin/smerge"
+ "$HOME/Applications/Sublime Merge.app/Contents/SharedSupport/bin/smerge"
+ )
+ for _sublime_merge_path in $_sublime_darwin_paths; do
+ if [[ -a $_sublime_merge_path ]]; then
+ subm () { "$_sublime_merge_path" "$@" }
+ alias sm=subm
+ break
+ fi
+ done
+ elif [[ "$OSTYPE" = 'cygwin' ]]; then
+ local sublime_merge_cygwin_paths
+ sublime_merge_cygwin_paths=(
+ "$(cygpath $ProgramW6432/Sublime\ Merge)/sublime_merge.exe"
+ )
+ for _sublime_merge_path in $_sublime_merge_cygwin_paths; do
+ if [[ -a $_sublime_merge_path ]]; then
+ subm () { "$_sublime_merge_path" "$@" }
+ alias sm=subm
+ break
+ fi
+ done
+ fi
+
+}
+
+alias smt='sm .'
diff --git a/zsh/plugins/sublime/sublime.plugin.zsh b/zsh/plugins/sublime/sublime.plugin.zsh
index 3a82d6c..618dd8e 100644
--- a/zsh/plugins/sublime/sublime.plugin.zsh
+++ b/zsh/plugins/sublime/sublime.plugin.zsh
@@ -15,10 +15,10 @@ alias stn=create_project
declare -a _sublime_paths
if [[ "$OSTYPE" == linux* ]]; then
- if [[ "$(uname -r)" = *Microsoft* ]]; then
+ if [[ "$(uname -r)" = *icrosoft* ]]; then
_sublime_paths=(
- "$(wslpath -u 'C:\Program Files\Sublime Text 3\subl.exe')"
- "$(wslpath -u 'C:\Program Files\Sublime Text 2\subl.exe')"
+ "$(wslpath -u 'C:\Program Files\Sublime Text 3\subl.exe' 2>/dev/null)"
+ "$(wslpath -u 'C:\Program Files\Sublime Text 2\subl.exe' 2>/dev/null)"
)
else
_sublime_paths=(
@@ -29,15 +29,19 @@ alias stn=create_project
"/usr/local/bin/sublime_text"
"/usr/bin/subl"
"/usr/bin/subl3"
+ "/snap/bin/subl"
+ "/snap/bin/sublime-text.subl"
)
fi
elif [[ "$OSTYPE" = darwin* ]]; then
_sublime_paths=(
"/usr/local/bin/subl"
"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
+ "/Applications/Sublime Text 4.app/Contents/SharedSupport/bin/subl"
"/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
"/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
"$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
+ "$HOME/Applications/Sublime Text 4.app/Contents/SharedSupport/bin/subl"
"$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
"$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
)
diff --git a/zsh/plugins/sudo/README.md b/zsh/plugins/sudo/README.md
index ebfdfd1..4f3973e 100644
--- a/zsh/plugins/sudo/README.md
+++ b/zsh/plugins/sudo/README.md
@@ -2,25 +2,13 @@
Easily prefix your current or previous commands with `sudo` by pressing esc twice
-## Enabling the plugin
+To use it, add `sudo` to the plugins array in your zshrc file:
-1. Open your `.zshrc` file and add `sudo` in the plugins section:
+```zsh
+plugins=(... sudo)
+```
- ```zsh
- plugins=(
- # all your enabled plugins
- sudo
- )
- ```
-
-2. Reload the source file or restart your Terminal session:
-
- ```console
- $ source ~/.zshrc
- $
- ```
-
-## Usage examples
+## Usage
### Current typed commands
diff --git a/zsh/plugins/sudo/sudo.plugin.zsh b/zsh/plugins/sudo/sudo.plugin.zsh
index f405b02..b3749ef 100644
--- a/zsh/plugins/sudo/sudo.plugin.zsh
+++ b/zsh/plugins/sudo/sudo.plugin.zsh
@@ -13,18 +13,42 @@
# ------------------------------------------------------------------------------
sudo-command-line() {
- [[ -z $BUFFER ]] && zle up-history
- if [[ $BUFFER == sudo\ * ]]; then
- LBUFFER="${LBUFFER#sudo }"
- elif [[ $BUFFER == $EDITOR\ * ]]; then
- LBUFFER="${LBUFFER#$EDITOR }"
- LBUFFER="sudoedit $LBUFFER"
+ [[ -z $BUFFER ]] && LBUFFER="$(fc -ln -1)"
+
+ # Save beginning space
+ local WHITESPACE=""
+ if [[ ${LBUFFER:0:1} == " " ]] ; then
+ WHITESPACE=" "
+ LBUFFER="${LBUFFER:1}"
+ fi
+
+ if [[ -n $EDITOR && $BUFFER == $EDITOR\ * ]]; then
+ if [[ ${#LBUFFER} -le ${#EDITOR} ]]; then
+ RBUFFER=" ${BUFFER#$EDITOR }"
+ LBUFFER="sudoedit"
+ else
+ LBUFFER="sudoedit ${LBUFFER#$EDITOR }"
+ fi
elif [[ $BUFFER == sudoedit\ * ]]; then
- LBUFFER="${LBUFFER#sudoedit }"
- LBUFFER="$EDITOR $LBUFFER"
+ if [[ ${#LBUFFER} -le 8 ]]; then
+ RBUFFER=" ${BUFFER#sudoedit }"
+ LBUFFER="$EDITOR"
+ else
+ LBUFFER="$EDITOR ${LBUFFER#sudoedit }"
+ fi
+ elif [[ $BUFFER == sudo\ * ]]; then
+ if [[ ${#LBUFFER} -le 4 ]]; then
+ RBUFFER="${BUFFER#sudo }"
+ LBUFFER=""
+ else
+ LBUFFER="${LBUFFER#sudo }"
+ fi
else
LBUFFER="sudo $LBUFFER"
fi
+
+ # Preserve beginning space
+ LBUFFER="${WHITESPACE}${LBUFFER}"
}
zle -N sudo-command-line
# Defined shortcut keys: [Esc] [Esc]
diff --git a/zsh/plugins/supervisor/README.md b/zsh/plugins/supervisor/README.md
new file mode 100644
index 0000000..a060ff4
--- /dev/null
+++ b/zsh/plugins/supervisor/README.md
@@ -0,0 +1,13 @@
+# supervisor plugin
+
+This plugin adds tab-completion for `supervisord`/`supervisorctl` in [Supervisor](http://supervisord.org/).
+Supervisor is a client/server system that allows its users to monitor and control a number
+of processes on UNIX-like operating systems.
+
+To use it, add `supervisor` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... supervisor)
+```
+
+These scripts are from [zshcompfunc4supervisor](https://bitbucket.org/hhatto/zshcompfunc4supervisor).
diff --git a/zsh/plugins/supervisor/_supervisorctl b/zsh/plugins/supervisor/_supervisorctl
index d159f20..9f576c0 100644
--- a/zsh/plugins/supervisor/_supervisorctl
+++ b/zsh/plugins/supervisor/_supervisorctl
@@ -112,6 +112,13 @@ _supervisorctl_start() {
'*::supvervisor process:_get_supervisor_procs'
}
+(( $+functions[_supervisorctl_restart] )) ||
+_supervisorctl_restart() {
+ # TODO: add 'all'
+ _arguments -s \
+ '*::supvervisor process:_get_supervisor_procs'
+}
+
(( $+functions[_supervisorctl_status] )) ||
_supervisorctl_status() {
_arguments \
diff --git a/zsh/plugins/svn-fast-info/README.md b/zsh/plugins/svn-fast-info/README.md
new file mode 100644
index 0000000..7713782
--- /dev/null
+++ b/zsh/plugins/svn-fast-info/README.md
@@ -0,0 +1,56 @@
+# svn-fast-info plugin
+
+Faster alternative to the main SVN plugin implementation. Works with svn 1.6 and newer.
+Use as a drop-in replacement to the svn plugin, not as complementary.
+
+To use it, add `svn-fast-info` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... svn-fast-info)
+```
+
+It's faster because his efficient use of svn (single svn call) which saves a lot on a huge codebase
+It displays the current status of the local files (added, deleted, modified, replaced, or else...)
+
+Use `svn_prompt_info` method to display the svn repository status in your theme.
+
+## Functions
+
+- `svn_prompt_info`: displays all the available information regarding the status of the svn repository.
+
+- `svn_repo_need_upgrade`: shows whether the repository needs upgrading. `svn_prompt_info` queries the
+ rest of functions or not based on the result of this function.
+
+- `svn_current_branch_name`: shows the current branch.
+
+- `svn_repo_root_name`: displays the repository root.
+
+- `svn_current_revision`: shows the currently checked-out revision.
+
+- `svn_status_info`: shows a bunch of symbols depending on the status of the files in the repository.
+
+## Options
+
+- `ZSH_THEME_SVN_PROMPT_PREFIX`: sequence displayed at the beginning of the prompt info output.
+
+- `ZSH_THEME_SVN_PROMPT_SUFFIX`: sequence displayed at the end of the prompt info output.
+
+- `ZSH_THEME_SVN_PROMPT_CLEAN`: sequence displayed when the status of the repository is clean.
+
+- `ZSH_THEME_SVN_PROMPT_ADDITIONS`: sequence displayed if there are added files in the repository.
+ **Default:** `+`.
+
+- `ZSH_THEME_SVN_PROMPT_DELETIONS`: sequence displayed if there are deleted files in the repository.
+ **Default:** `✖`.
+
+- `ZSH_THEME_SVN_PROMPT_MODIFICATIONS`: sequence displayed if there are modified files in the repository.
+ **Default:** `✎`.
+
+- `ZSH_THEME_SVN_PROMPT_REPLACEMENTS`: sequence displayed if there are replaced files in the repository.
+ **Default:** `∿`.
+
+- `ZSH_THEME_SVN_PROMPT_UNTRACKED`: sequence displayed if there are untracked files in the repository.
+ **Default:** `?`.
+
+- `ZSH_THEME_SVN_PROMPT_DIRTY`: sequence displayed if the repository is dirty.
+ **Default:** `!`.
diff --git a/zsh/plugins/svn-fast-info/svn-fast-info.plugin.zsh b/zsh/plugins/svn-fast-info/svn-fast-info.plugin.zsh
index fe52653..f40a596 100644
--- a/zsh/plugins/svn-fast-info/svn-fast-info.plugin.zsh
+++ b/zsh/plugins/svn-fast-info/svn-fast-info.plugin.zsh
@@ -1,17 +1,6 @@
-# vim:ft=zsh ts=2 sw=2 sts=2 et
-#
-# Faster alternative to the current SVN plugin implementation.
-#
-# Works with svn 1.6, 1.7, 1.8.
-# Use `svn_prompt_info` method to enquire the svn data.
-# It's faster because his efficient use of svn (single svn call) which saves a lot on a huge codebase
-# It displays the current status of the local files (added, deleted, modified, replaced, or else...)
-#
-# Use as a drop-in replacement of the svn plugin not as complementary plugin
-
function svn_prompt_info() {
local info
- info=$(svn info 2>&1) || return 1; # capture stdout and stderr
+ info=$(svn info 2>&1) || return 1 # capture stdout and stderr
local repo_need_upgrade=$(svn_repo_need_upgrade $info)
if [[ -n $repo_need_upgrade ]]; then
@@ -27,7 +16,6 @@ function svn_prompt_info() {
printf '%s%s%s%s %s%s%s:%s%s%s%s' \
"$ZSH_PROMPT_BASE_COLOR" \
"$ZSH_THEME_SVN_PROMPT_PREFIX" \
- \
"$(svn_status_info $info)" \
"$ZSH_PROMPT_BASE_COLOR" \
\
@@ -37,14 +25,13 @@ function svn_prompt_info() {
\
"$(svn_current_revision $info)" \
"$ZSH_PROMPT_BASE_COLOR" \
- \
"$ZSH_THEME_SVN_PROMPT_SUFFIX" \
"$ZSH_PROMPT_BASE_COLOR"
fi
}
function svn_repo_need_upgrade() {
- grep -q "E155036" <<< ${1:-$(svn info 2> /dev/null)} && \
+ grep -q "E155036" <<< "${1:-$(svn info 2> /dev/null)}" && \
echo "E155036: upgrade repo with svn upgrade"
}
@@ -63,12 +50,23 @@ function svn_current_revision() {
function svn_status_info() {
local svn_status_string="$ZSH_THEME_SVN_PROMPT_CLEAN"
local svn_status="$(svn status 2> /dev/null)";
- if command grep -E '^\s*A' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"; fi
- if command grep -E '^\s*D' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_DELETIONS:-✖}"; fi
- if command grep -E '^\s*M' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-✎}"; fi
- if command grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-∿}"; fi
- if command grep -E '^\s*\?' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"; fi
- if command grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_DIRTY:-!}"; fi
+ if command grep -E '^\s*A' &> /dev/null <<< $svn_status; then
+ svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"
+ fi
+ if command grep -E '^\s*D' &> /dev/null <<< $svn_status; then
+ svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_DELETIONS:-✖}"
+ fi
+ if command grep -E '^\s*M' &> /dev/null <<< $svn_status; then
+ svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-✎}"
+ fi
+ if command grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then
+ svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-∿}"
+ fi
+ if command grep -E '^\s*\?' &> /dev/null <<< $svn_status; then
+ svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"
+ fi
+ if command grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then
+ svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_DIRTY:-!}"
+ fi
echo $svn_status_string
}
-
diff --git a/zsh/plugins/swiftpm/README.md b/zsh/plugins/swiftpm/README.md
index 2914585..a722c03 100644
--- a/zsh/plugins/swiftpm/README.md
+++ b/zsh/plugins/swiftpm/README.md
@@ -2,7 +2,7 @@
## Description
-This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager), as well as autocompletion for Swift 5.0.
+This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager), as well as autocompletion for Swift 5.1.
To start using it, add the `swiftpm` plugin to your `plugins` array in `~/.zshrc`:
diff --git a/zsh/plugins/swiftpm/_swift b/zsh/plugins/swiftpm/_swift
index 1366b4d..fe6f1c9 100644
--- a/zsh/plugins/swiftpm/_swift
+++ b/zsh/plugins/swiftpm/_swift
@@ -82,13 +82,15 @@ _swift_build() {
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
- "--enable-llbuild-library[Enable building with the llbuild library]"
"--force-resolved-versions[]"
"--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
"--enable-index-store[Enable indexing-while-building feature]"
"--disable-index-store[Disable indexing-while-building feature]"
"--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
"--enable-parseable-module-interfaces[]"
+ "--trace-resolver[]"
+ "(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
+ "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
"--build-tests[Build both source and test targets]"
"--product[Build the specified product]:Build the specified product: "
"--target[Build the specified target]:Build the specified target: "
@@ -125,13 +127,15 @@ _swift_run() {
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
- "--enable-llbuild-library[Enable building with the llbuild library]"
"--force-resolved-versions[]"
"--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
"--enable-index-store[Enable indexing-while-building feature]"
"--disable-index-store[Disable indexing-while-building feature]"
"--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
"--enable-parseable-module-interfaces[]"
+ "--trace-resolver[]"
+ "(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
+ "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
"--skip-build[Skip building the executable product]"
"--build-tests[Build both source and test targets]"
"--repl[Launch Swift REPL for the package]"
@@ -166,13 +170,15 @@ _swift_package() {
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
- "--enable-llbuild-library[Enable building with the llbuild library]"
"--force-resolved-versions[]"
"--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
"--enable-index-store[Enable indexing-while-building feature]"
"--disable-index-store[Disable indexing-while-building feature]"
"--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
"--enable-parseable-module-interfaces[]"
+ "--trace-resolver[]"
+ "(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
+ "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
'(-): :->command'
'(-)*:: :->arg'
)
@@ -181,49 +187,61 @@ _swift_package() {
(command)
local modes
modes=(
- 'update:Update package dependencies'
- 'describe:Describe the current package'
- 'resolve:Resolve package dependencies'
- 'tools-version:Manipulate tools version of the current package'
- 'unedit:Remove a package from editable mode'
- 'show-dependencies:Print the resolved dependency graph'
- 'fetch:'
+ 'completion-tool:Completion tool (for shell completions)'
'dump-package:Print parsed Package.swift as JSON'
+ 'describe:Describe the current package'
+ 'clean:Delete build artifacts'
+ 'show-dependencies:Print the resolved dependency graph'
+ 'init:Initialize a new package'
+ 'unedit:Remove a package from editable mode'
+ 'tools-version:Manipulate tools version of the current package'
+ 'fetch:'
+ 'resolve:Resolve package dependencies'
+ 'reset:Reset the complete cache/build directory'
+ 'generate-xcodeproj:Generates an Xcode project'
'edit:Put a package in editable mode'
'config:Manipulate configuration of the package'
- 'completion-tool:Completion tool (for shell completions)'
- 'clean:Delete build artifacts'
- 'generate-xcodeproj:Generates an Xcode project'
- 'reset:Reset the complete cache/build directory'
- 'init:Initialize a new package'
+ 'update:Update package dependencies'
)
_describe "mode" modes
;;
(arg)
case ${words[1]} in
- (update)
- _swift_package_update
+ (completion-tool)
+ _swift_package_completion-tool
+ ;;
+ (dump-package)
+ _swift_package_dump-package
;;
(describe)
_swift_package_describe
;;
- (resolve)
- _swift_package_resolve
- ;;
- (tools-version)
- _swift_package_tools-version
- ;;
- (unedit)
- _swift_package_unedit
+ (clean)
+ _swift_package_clean
;;
(show-dependencies)
_swift_package_show-dependencies
;;
+ (init)
+ _swift_package_init
+ ;;
+ (unedit)
+ _swift_package_unedit
+ ;;
+ (tools-version)
+ _swift_package_tools-version
+ ;;
(fetch)
_swift_package_fetch
;;
- (dump-package)
- _swift_package_dump-package
+ (resolve)
+ _swift_package_resolve
+ ;;
+ (reset)
+ _swift_package_reset
+ ;;
+ (generate-xcodeproj)
+ _swift_package_generate-xcodeproj
;;
(edit)
_swift_package_edit
@@ -231,27 +249,22 @@ _swift_package() {
(config)
_swift_package_config
;;
- (completion-tool)
- _swift_package_completion-tool
- ;;
- (clean)
- _swift_package_clean
- ;;
- (generate-xcodeproj)
- _swift_package_generate-xcodeproj
- ;;
- (reset)
- _swift_package_reset
- ;;
- (init)
- _swift_package_init
+ (update)
+ _swift_package_update
;;
esac
;;
esac
}
-_swift_package_update() {
+_swift_package_completion-tool() {
+ arguments=(
+ ": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}"
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_dump-package() {
arguments=(
)
_arguments $arguments && return
@@ -264,6 +277,49 @@ _swift_package_describe() {
_arguments $arguments && return
}
+_swift_package_clean() {
+ arguments=(
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_show-dependencies() {
+ arguments=(
+ "--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}"
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_init() {
+ arguments=(
+ "--type[empty|library|executable|system-module|manifest]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}"
+ "--name[Provide custom package name]:Provide custom package name: "
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_unedit() {
+ arguments=(
+ ":The name of the package to unedit:_swift_dependency"
+ "--force[Unedit the package even if it has uncommited and unpushed changes.]"
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_tools-version() {
+ arguments=(
+ "--set[Set tools version of package to the given value]:Set tools version of package to the given value: "
+ "--set-current[Set tools version of package to the current tools version in use]"
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_fetch() {
+ arguments=(
+ )
+ _arguments $arguments && return
+}
+
_swift_package_resolve() {
arguments=(
":The name of the package to resolve:_swift_dependency"
@@ -274,37 +330,20 @@ _swift_package_resolve() {
_arguments $arguments && return
}
-_swift_package_tools-version() {
- arguments=(
- "--set[Set tools version of package to the given value]:Set tools version of package to the given value: "
- "--set-current[Set tools version of package to the current tools version in use]"
- )
- _arguments $arguments && return
-}
-
-_swift_package_unedit() {
- arguments=(
- ":The name of the package to unedit:_swift_dependency"
- "--force[Unedit the package even if it has uncommited and unpushed changes.]"
- )
- _arguments $arguments && return
-}
-
-_swift_package_show-dependencies() {
- arguments=(
- "--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}"
- )
- _arguments $arguments && return
-}
-
-_swift_package_fetch() {
+_swift_package_reset() {
arguments=(
)
_arguments $arguments && return
}
-_swift_package_dump-package() {
+_swift_package_generate-xcodeproj() {
arguments=(
+ "--xcconfig-overrides[Path to xcconfig file]:Path to xcconfig file:_files"
+ "--enable-code-coverage[Enable code coverage in the generated project]"
+ "--output[Path where the Xcode project should be generated]:Path where the Xcode project should be generated:_files"
+ "--legacy-scheme-generator[Use the legacy scheme generator]"
+ "--watch[Watch for changes to the Package manifest to regenerate the Xcode project]"
+ "--skip-extra-files[Do not add file references for extra files to the generated Xcode project]"
)
_arguments $arguments && return
}
@@ -330,8 +369,8 @@ _swift_package_config() {
local modes
modes=(
'unset-mirror:Remove an existing mirror'
- 'set-mirror:Set a mirror for a dependency'
'get-mirror:Print mirror configuration for the given package dependency'
+ 'set-mirror:Set a mirror for a dependency'
)
_describe "mode" modes
;;
@@ -340,12 +379,12 @@ _swift_package_config() {
(unset-mirror)
_swift_package_config_unset-mirror
;;
- (set-mirror)
- _swift_package_config_set-mirror
- ;;
(get-mirror)
_swift_package_config_get-mirror
;;
+ (set-mirror)
+ _swift_package_config_set-mirror
+ ;;
esac
;;
esac
@@ -359,6 +398,13 @@ _swift_package_config_unset-mirror() {
_arguments $arguments && return
}
+_swift_package_config_get-mirror() {
+ arguments=(
+ "--package-url[The package dependency url]:The package dependency url: "
+ )
+ _arguments $arguments && return
+}
+
_swift_package_config_set-mirror() {
arguments=(
"--package-url[The package dependency url]:The package dependency url: "
@@ -367,48 +413,8 @@ _swift_package_config_set-mirror() {
_arguments $arguments && return
}
-_swift_package_config_get-mirror() {
+_swift_package_update() {
arguments=(
- "--package-url[The package dependency url]:The package dependency url: "
- )
- _arguments $arguments && return
-}
-
-_swift_package_completion-tool() {
- arguments=(
- ": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}"
- )
- _arguments $arguments && return
-}
-
-_swift_package_clean() {
- arguments=(
- )
- _arguments $arguments && return
-}
-
-_swift_package_generate-xcodeproj() {
- arguments=(
- "--xcconfig-overrides[Path to xcconfig file]:Path to xcconfig file:_files"
- "--enable-code-coverage[Enable code coverage in the generated project]"
- "--output[Path where the Xcode project should be generated]:Path where the Xcode project should be generated:_files"
- "--legacy-scheme-generator[Use the legacy scheme generator]"
- "--watch[Watch for changes to the Package manifest to regenerate the Xcode project]"
- "--skip-extra-files[Do not add file references for extra files to the generated Xcode project]"
- )
- _arguments $arguments && return
-}
-
-_swift_package_reset() {
- arguments=(
- )
- _arguments $arguments && return
-}
-
-_swift_package_init() {
- arguments=(
- "--type[empty|library|executable|system-module]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}"
- "--name[Provide custom package name]:Provide custom package name: "
)
_arguments $arguments && return
}
@@ -440,13 +446,15 @@ _swift_test() {
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
- "--enable-llbuild-library[Enable building with the llbuild library]"
"--force-resolved-versions[]"
"--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
"--enable-index-store[Enable indexing-while-building feature]"
"--disable-index-store[Disable indexing-while-building feature]"
"--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
"--enable-parseable-module-interfaces[]"
+ "--trace-resolver[]"
+ "(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
+ "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
"--skip-build[Skip building the test target]"
"(--list-tests -l)"{--list-tests,-l}"[Lists test methods in specifier format]"
"--generate-linuxmain[Generate LinuxMain.swift entries for the package]"
diff --git a/zsh/plugins/systemadmin/README.md b/zsh/plugins/systemadmin/README.md
index edca4d8..243db03 100644
--- a/zsh/plugins/systemadmin/README.md
+++ b/zsh/plugins/systemadmin/README.md
@@ -16,8 +16,8 @@ plugins=(... systemadmin)
| clr | `clear; echo Currently logged in on $TTY, as $USER in directory $PWD.` | Clears the screen and prints the current user, TTY, and directory |
| path | `print -l $path` | Displays PATH with each entry on a separate line |
| mkdir | `mkdir -pv` | Automatically create parent directories and display verbose output |
-| psmem | `ps -e -orss=,args= \| sort -b -k1,1n` | Display the processes using the most memory |
-| psmem10 | `ps -e -orss=,args= \| sort -b -k1,1n \| head -10` | Display the top 10 processes using the most memory |
+| psmem | `ps -e -orss=,args= \| sort -b -k1 -nr` | Display the processes using the most memory |
+| psmem10 | `ps -e -orss=,args= \| sort -b -k1 -nr \| head -10` | Display the top 10 processes using the most memory |
| pscpu | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr` | Display the top processes using the most CPU |
| pscpu10 | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr \| head -10` | Display the top 10 processes using the most CPU |
| hist10 | `print -l ${(o)history%% *} \| uniq -c \| sort -nr \| head -n 10` | Display the top 10 most used commands in the history |
diff --git a/zsh/plugins/systemadmin/systemadmin.plugin.zsh b/zsh/plugins/systemadmin/systemadmin.plugin.zsh
index bdc2219..03064c0 100644
--- a/zsh/plugins/systemadmin/systemadmin.plugin.zsh
+++ b/zsh/plugins/systemadmin/systemadmin.plugin.zsh
@@ -25,11 +25,11 @@ alias clr='clear; echo Currently logged in on $TTY, as $USER in directory $PWD.'
alias path='print -l $path'
alias mkdir='mkdir -pv'
# get top process eating memory
-alias psmem='ps -e -orss=,args= | sort -b -k1,1n'
-alias psmem10='ps -e -orss=,args= | sort -b -k1,1n| head -10'
+alias psmem='ps -e -orss=,args= | sort -b -k1 -nr'
+alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -10'
# get top process eating cpu if not work try excute : export LC_ALL='C'
-alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1 -nr'
-alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1 -nr | head -10'
+alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr'
+alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head -10'
# top10 of the history
alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
diff --git a/zsh/plugins/systemd/README.md b/zsh/plugins/systemd/README.md
index d913292..3fa1d21 100644
--- a/zsh/plugins/systemd/README.md
+++ b/zsh/plugins/systemd/README.md
@@ -51,3 +51,44 @@ plugins=(... systemd)
You can use the above aliases as `--user` by using the prefix `scu` instead of `sc`.
For example: `scu-list-units` will be aliased to `systemctl --user list-units`.
+
+### Unit Status Prompt
+
+You can add a token to your prompt in a similar way to the gitfast plugin. To add the token
+to your prompt, drop `$(systemd_prompt_info [unit]...)` into your prompt (more than one unit
+may be specified).
+
+The plugin will add the following to your prompt for each `$unit`.
+```
+:
+```
+You can control these parts with the following variables:
+
+- ``: Set `$ZSH_THEME_SYSTEMD_PROMPT_PREFIX`.
+
+- ``: Set `$ZSH_THEME_SYSTEMD_PROMPT_SUFFIX`.
+
+- ``: name passed as parameter to the function. If you want it to be in ALL CAPS,
+ you can set the variable `$ZSH_THEME_SYSTEMD_PROMPT_CAPS` to a non-empty string.
+
+- ``: shown if the systemd unit is active.
+ Set `$ZSH_THEME_SYSTEMD_PROMPT_ACTIVE`.
+
+- ``: shown if the systemd unit is *not* active.
+ Set `$ZSH_THEME_SYSTEMD_PROMPT_NOTACTIVE`.
+
+For example, if your prompt contains `PROMPT='$(systemd_prompt_info dhcpd httpd)'` and you set the following variables:
+
+```
+ZSH_THEME_SYSTEMD_PROMPT_PREFIX="["
+ZSH_THEME_SYSTEMD_PROMPT_SUFFIX="]"
+ZSH_THEME_SYSTEMD_PROMPT_ACTIVE="+"
+ZSH_THEME_SYSTEMD_PROMPT_NOTACTIVE="X"
+ZSH_THEME_SYSTEMD_PROMPT_CAPS=1
+```
+
+If `dhcpd` is running, and `httpd` is not, then your prompt will look like this:
+
+```
+[DHCPD: +][HTTPD: X]
+```
diff --git a/zsh/plugins/systemd/systemd.plugin.zsh b/zsh/plugins/systemd/systemd.plugin.zsh
index 7cd27d4..c6fd529 100644
--- a/zsh/plugins/systemd/systemd.plugin.zsh
+++ b/zsh/plugins/systemd/systemd.plugin.zsh
@@ -1,12 +1,65 @@
user_commands=(
- list-units is-active status show help list-unit-files
- is-enabled list-jobs show-environment cat list-timers)
+ cat
+ get-default
+ help
+ is-active
+ is-enabled
+ is-failed
+ is-system-running
+ list-dependencies
+ list-jobs
+ list-sockets
+ list-timers
+ list-unit-files
+ list-units
+ show
+ show-environment
+ status)
sudo_commands=(
- start stop reload restart try-restart isolate kill
- reset-failed enable disable reenable preset mask unmask
- link load cancel set-environment unset-environment
- edit)
+ add-requires
+ add-wants
+ cancel
+ daemon-reexec
+ daemon-reload
+ default
+ disable
+ edit
+ emergency
+ enable
+ halt
+ hibernate
+ hybrid-sleep
+ import-environment
+ isolate
+ kexec
+ kill
+ link
+ list-machines
+ load
+ mask
+ poweroff
+ preset
+ preset-all
+ reboot
+ reenable
+ reload
+ reload-or-restart
+ reset-failed
+ rescue
+ restart
+ revert
+ set-default
+ set-environment
+ set-property
+ start
+ stop
+ suspend
+ switch-root
+ try-reload-or-restart
+ try-restart
+ unmask
+ unset-environment)
for c in $user_commands; do; alias sc-$c="systemctl $c"; done
for c in $sudo_commands; do; alias sc-$c="sudo systemctl $c"; done
@@ -20,3 +73,18 @@ alias sc-mask-now="sc-mask --now"
alias scu-enable-now="scu-enable --now"
alias scu-disable-now="scu-disable --now"
alias scu-mask-now="scu-mask --now"
+
+function systemd_prompt_info {
+ local unit
+ for unit in $@; do
+ echo -n "$ZSH_THEME_SYSTEMD_PROMPT_PREFIX"
+ [[ -n "$ZSH_THEME_SYSTEMD_PROMPT_CAPS" ]] && echo -n "${(U)unit}:" || echo -n "$unit:"
+ if systemctl is-active $unit &>/dev/null; then
+ echo -n "$ZSH_THEME_SYSTEMD_PROMPT_ACTIVE"
+ else
+ echo -n "$ZSH_THEME_SYSTEMD_PROMPT_NOTACTIVE"
+ fi
+ echo -n "$ZSH_THEME_SYSTEMD_PROMPT_SUFFIX"
+ done
+}
+
diff --git a/zsh/plugins/taskwarrior/README.md b/zsh/plugins/taskwarrior/README.md
index 2a86510..e77e452 100644
--- a/zsh/plugins/taskwarrior/README.md
+++ b/zsh/plugins/taskwarrior/README.md
@@ -4,10 +4,15 @@ This plugin adds smart tab completion for [TaskWarrior](https://taskwarrior.org/
It uses the zsh tab completion script (`_task`) shipped with TaskWarrior for the
completion definitions.
-The latest version pulled in from the official project is of January 1st, 2015.
+To use it, add `taskwarrior` to the plugins array in your zshrc file:
+```zsh
+plugins=(... taskwarrior)
+```
## Examples
Typing `task [TAB]` will give you a list of commands, `task 66[TAB]` shows a
list of available modifications for that task, etcetera.
+
+The latest version pulled in from the official project is of January 1st, 2015.
diff --git a/zsh/plugins/taskwarrior/_task b/zsh/plugins/taskwarrior/_task
index c38d6ca..e0fea17 100644
--- a/zsh/plugins/taskwarrior/_task
+++ b/zsh/plugins/taskwarrior/_task
@@ -1,6 +1,6 @@
#compdef task
#
-# Copyright 2010 - 2016 Johannes Schlatow
+# Copyright 2010 - 2019 Johannes Schlatow
# Copyright 2009 P.C. Shyamshankar
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -24,7 +24,7 @@
# https://www.opensource.org/licenses/mit-license.php
#
typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers
-_task_projects=($(task _projects))
+_task_projects=(${(f)"$(task _projects)"})
_task_tags=($(task _tags))
_task_zshids=( ${(f)"$(task _zshids)"} )
_task_config=($(task _config))
diff --git a/zsh/plugins/terminalapp/terminalapp.plugin.zsh b/zsh/plugins/terminalapp/terminalapp.plugin.zsh
deleted file mode 100644
index 7c0c278..0000000
--- a/zsh/plugins/terminalapp/terminalapp.plugin.zsh
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is intentionally empty.
-#
-# The terminalapp plugin is deprecated and may be removed in a future release.
-# Its functionality has been folded in to the core lib/termsupport.zsh, which
-# is loaded for all users. You can remove terminalapp from your $plugins list
-# once all your systems are updated to the current version of Oh My Zsh.
diff --git a/zsh/plugins/terminitor/README.md b/zsh/plugins/terminitor/README.md
new file mode 100644
index 0000000..8c0e021
--- /dev/null
+++ b/zsh/plugins/terminitor/README.md
@@ -0,0 +1,9 @@
+# Terminitor plugin
+
+This plugin adds completions for the [Terminitor](https://github.com/achiurizo/terminitor) development workflow setup tool.
+
+To use it, add `terminitor` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... terminitor)
+```
diff --git a/zsh/plugins/terraform/README.md b/zsh/plugins/terraform/README.md
index 471aef2..9e9f0cd 100644
--- a/zsh/plugins/terraform/README.md
+++ b/zsh/plugins/terraform/README.md
@@ -2,7 +2,7 @@
Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely and efficiently.
-Current as of Terraform v0.11.7
+Current as of Terraform v0.13
### Requirements
@@ -17,6 +17,7 @@ plugins=(... terraform)
```
* Type `terraform` into your prompt and hit `TAB` to see available completion options
+ * Type `tf` into your prompt as a short alias to `terraform`
### Expanding ZSH prompt with current Terraform workspace name
diff --git a/zsh/plugins/terraform/_terraform b/zsh/plugins/terraform/_terraform
index 1d1315a..e4298f2 100644
--- a/zsh/plugins/terraform/_terraform
+++ b/zsh/plugins/terraform/_terraform
@@ -1,6 +1,6 @@
#compdef terraform
-local -a _terraform_cmds
+local -a _terraform_cmds opt_args
_terraform_cmds=(
'apply:Builds or changes infrastructure'
'console:Interactive console for Terraform interpolations'
@@ -16,13 +16,21 @@ _terraform_cmds=(
'push:Upload this Terraform module to Atlas to run'
'refresh:Update local state file against real resources'
'show:Inspect Terraform state or plan'
+ 'state:Advanced state management'
'taint:Manually mark a resource for recreation'
'untaint:Manually unmark a resource as tainted'
'validate:Validates the Terraform files'
'version:Prints the Terraform version'
'workspace:Workspace management'
+ '0.12upgrade:Rewrites pre-0.12 module source code for v0.12'
)
+__012upgrade() {
+ _arguments \
+ '-yes[Skip the initial introduction messages and interactive confirmation. This can be used to run this command in batch from a script.]' \
+ '-force[ Override the heuristic that attempts to detect if a configuration is already written for v0.12 or later. Some of the transformations made by this command are not idempotent, so re-running against the same module may change the meanings expressions in the module.]'
+}
+
__apply() {
_arguments \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
@@ -35,7 +43,7 @@ __apply() {
'-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
'-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]' \
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
- '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
+ '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
}
@@ -59,7 +67,7 @@ __destroy() {
'-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
'-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]' \
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
- '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
+ '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
}
@@ -69,7 +77,8 @@ __fmt() {
'-list=[(true) List files whose formatting differs (always false if using STDIN)]' \
'-write=[(true) Write result to source file instead of STDOUT (always false if using STDIN or -check)]' \
'-diff=[(false) Display diffs of formatting changes]' \
- '-check=[(false) Check if the input is formatted. Exit status will be 0 if all input is properly formatted and non-zero otherwise.]'
+ '-check=[(false) Check if the input is formatted. Exit status will be 0 if all input is properly formatted and non-zero otherwise.]' \
+ '-recursive=[(false) Also process files in subdirectories. By default, only the given directory (or current directory) is processed.]'
}
__get() {
@@ -140,7 +149,7 @@ __plan() {
'-parallelism=[(10) Limit the number of concurrent operations.]' \
'-refresh=[(true) Update state prior to checking for differences.]' \
'-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]' \
- '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
+ '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]' \
}
@@ -172,7 +181,7 @@ __refresh() {
'-no-color[If specified, output will not contain any color.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
- '-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
+ '-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]'
}
@@ -183,6 +192,70 @@ __show() {
'-no-color[If specified, output will not contain any color.]'
}
+__state() {
+ local -a __state_cmds
+ __state_cmds=(
+ 'list:List resources in the state'
+ 'mv:Move an item in the state'
+ 'pull:Pull current state and output to stdout'
+ 'push:Update remote state from a local state file'
+ 'rm:Remove instances from the state'
+ 'show:Show a resource in the state'
+ )
+ _describe -t state "state commands" __state_cmds
+}
+
+__state_list() {
+ _arguments \
+ '-state=[(path) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]' \
+ '-id=[(id) Filters the results to include only instances whose resource types have an attribute named id whose value equals the given id string.]' \
+ "*:address:__statelist"
+}
+
+__state_mv() {
+ _arguments \
+ "-dry-run[If set, prints out what would've been moved but doesn't actually move anything.]" \
+ "-backup=[(path) Path where Terraform should write the backup for the original state. This can't be disabled. If not set, Terraform will write it to the same path as the statefile with a \".backup\" extension.]:file:_files" \
+ "-backup-out=[(path) Path where Terraform should write the backup for the destination state. This can't be disabled. If not set, Terraform will write it to the same path as the destination state file with a backup extension. This only needs to be specified if -state-out is set to a different path than -state.]:file:_files" \
+ "-lock=[(true|false) Lock the state files when locking is supported.]:lock:(true false)" \
+ "-lock-timeout=[(seconds) Duration to retry a state lock.]" \
+ '-state=[(path) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]:file:_files' \
+ "-state-out=[(path) Path to the destination state file to write to. If this isn't specified, the source state file will be used. This can be a new or existing path.]:file:_files" \
+ "::" \
+ ":source:__statelist" \
+ ":destination: "
+}
+
+__state_push() {
+ _arguments \
+ "-force[Write the state even if lineages don't match or the remote serial is higher.]" \
+ '-lock=[(true|false) Lock the state file when locking is supported.]:lock:(true false)' \
+ "-lock-timeout=[(seconds) Duration to retry a state lock.]" \
+ "::" \
+ ":destination:_files"
+}
+
+__state_rm() {
+ _arguments \
+ "-dry-run[If set, prints out what would've been removed but doesn't actually remove anything.]" \
+ "-backup=[(path) Path where Terraform should write the backup for the original state.]:file:_files" \
+ "-lock=[(true|false) Lock the state files when locking is supported.]:lock:(true false)" \
+ "-lock-timeout=[(seconds) Duration to retry a state lock.]" \
+ '-state=[(path) Path to the state file to update. Defaults to the current workspace state.]:file:_files' \
+ "*:address:__statelist"
+}
+
+
+__state_show() {
+ _arguments \
+ '-state=[(path) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]' \
+ "*:address:__statelist"
+}
+
+__statelist() {
+ compadd $(terraform state list $opt_args[-state])
+}
+
__taint() {
_arguments \
'-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
@@ -192,7 +265,8 @@ __taint() {
'-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \
'-no-color[If specified, output will not contain any color.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
- '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]'
+ '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]' \
+ "*:address:__statelist"
}
__untaint() {
@@ -236,6 +310,8 @@ fi
local -a _command_args
case "$words[1]" in
+ 0.12upgrade)
+ __012upgrade ;;
apply)
__apply ;;
console)
@@ -264,6 +340,14 @@ case "$words[1]" in
__refresh ;;
show)
__show ;;
+ state)
+ test $CURRENT -lt 3 && __state
+ [[ $words[2] = "list" ]] && __state_list
+ [[ $words[2] = "mv" ]] && __state_mv
+ [[ $words[2] = "push" ]] && __state_push
+ [[ $words[2] = "rm" ]] && __state_rm
+ [[ $words[2] = "show" ]] && __state_show
+ ;;
taint)
__taint ;;
untaint)
diff --git a/zsh/plugins/terraform/terraform.plugin.zsh b/zsh/plugins/terraform/terraform.plugin.zsh
index d727c1e..2c42d39 100644
--- a/zsh/plugins/terraform/terraform.plugin.zsh
+++ b/zsh/plugins/terraform/terraform.plugin.zsh
@@ -7,3 +7,5 @@ function tf_prompt_info() {
echo "[${workspace}]"
fi
}
+
+alias tf='terraform'
diff --git a/zsh/plugins/textmate/README.md b/zsh/plugins/textmate/README.md
index 9fd3421..e6c1943 100644
--- a/zsh/plugins/textmate/README.md
+++ b/zsh/plugins/textmate/README.md
@@ -3,7 +3,8 @@
The plugin adds a function for the [TextMate](https://macromates.com) editor.
To use it, add `textmate` to the plugins array of your zshrc file:
-```
+
+```zsh
plugins=(... textmate)
```
diff --git a/zsh/plugins/thefuck/README.md b/zsh/plugins/thefuck/README.md
index a9b7550..bd407b3 100644
--- a/zsh/plugins/thefuck/README.md
+++ b/zsh/plugins/thefuck/README.md
@@ -6,4 +6,4 @@
Press `ESC` twice to correct previous console command.
## Notes
-`Esc`-`Esc` key binding conflicts with [sudo](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/sudo) plugin.
+`Esc`-`Esc` key binding conflicts with [sudo](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/sudo) plugin.
diff --git a/zsh/plugins/themes/_theme b/zsh/plugins/themes/_theme
deleted file mode 100644
index 8214ddb..0000000
--- a/zsh/plugins/themes/_theme
+++ /dev/null
@@ -1,3 +0,0 @@
-#compdef theme
-
-_arguments "1: :($(lstheme | tr "\n" " "))"
diff --git a/zsh/plugins/themes/themes.plugin.zsh b/zsh/plugins/themes/themes.plugin.zsh
index 2cd0ee3..6508562 100644
--- a/zsh/plugins/themes/themes.plugin.zsh
+++ b/zsh/plugins/themes/themes.plugin.zsh
@@ -1,26 +1,35 @@
-function theme
-{
- if [ -z "$1" ] || [ "$1" = "random" ]; then
- themes=($ZSH/themes/*zsh-theme)
- N=${#themes[@]}
- ((N=(RANDOM%N)+1))
- RANDOM_THEME=${themes[$N]}
- source "$RANDOM_THEME"
- echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
+function theme {
+ : ${1:=random} # Use random theme if none provided
+
+ if [[ -f "$ZSH_CUSTOM/$1.zsh-theme" ]]; then
+ source "$ZSH_CUSTOM/$1.zsh-theme"
+ elif [[ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ]]; then
+ source "$ZSH_CUSTOM/themes/$1.zsh-theme"
+ elif [[ -f "$ZSH/themes/$1.zsh-theme" ]]; then
+ source "$ZSH/themes/$1.zsh-theme"
else
- if [ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ]
- then
- source "$ZSH_CUSTOM/themes/$1.zsh-theme"
- else
- source "$ZSH/themes/$1.zsh-theme"
- fi
+ echo "$0: Theme '$1' not found"
+ return 1
fi
}
-function lstheme
-{
+function _theme {
+ _arguments "1: :($(lstheme))"
+}
+
+compdef _theme theme
+
+function lstheme {
# Resources:
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Modifiers
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Qualifiers
- print -l {$ZSH,$ZSH_CUSTOM}/themes/*.zsh-theme(N:t:r)
+ {
+ # Show themes inside $ZSH_CUSTOM (in any subfolder)
+ # Strip $ZSH_CUSTOM/themes/ and $ZSH_CUSTOM/ from the name, so that it matches
+ # the value that should be written in $ZSH_THEME to load the theme.
+ print -l "$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::)
+
+ # Show themes inside $ZSH, stripping the head of the path.
+ print -l "$ZSH"/themes/*.zsh-theme(.N:t:r)
+ } | sort -u | fmt -w $COLUMNS
}
diff --git a/zsh/plugins/thor/README.md b/zsh/plugins/thor/README.md
new file mode 100644
index 0000000..09c705d
--- /dev/null
+++ b/zsh/plugins/thor/README.md
@@ -0,0 +1,10 @@
+# Thor plugin
+
+This plugin adds completion for [Thor](http://whatisthor.com/),
+a ruby toolkit for building powerful command-line interfaces.
+
+To use it, add `thor` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... thor)
+```
diff --git a/zsh/plugins/tig/README.md b/zsh/plugins/tig/README.md
index bb24cd1..3323fd0 100644
--- a/zsh/plugins/tig/README.md
+++ b/zsh/plugins/tig/README.md
@@ -1,6 +1,6 @@
# `tig` plugin
-This plugin adds some aliases for people who work with `tig` in
+This plugin adds some aliases for people who work with [`tig`](https://jonas.github.io/tig/) (text-mode interface for Git) in
a regular basis. To use it, add `tig` to your plugins array:
```zsh
diff --git a/zsh/plugins/timer/README.md b/zsh/plugins/timer/README.md
index 321307e..30b0bd0 100644
--- a/zsh/plugins/timer/README.md
+++ b/zsh/plugins/timer/README.md
@@ -3,6 +3,7 @@ This plugin allows to display command's execution time in a very nonintrusive wa
Timer can be tuned by these two variables:
* `TIMER_PRECISION` allows to control number of decimal places (default `1`)
* `TIMER_FORMAT` allows to adjust display format (default `'/%d'`)
+* `TIMER_THRESHOLD` allows to set the minimum execution time that causes the timer to be shown (default `0`)
Sample session:
diff --git a/zsh/plugins/timer/timer.plugin.zsh b/zsh/plugins/timer/timer.plugin.zsh
index 231134e..b261f71 100644
--- a/zsh/plugins/timer/timer.plugin.zsh
+++ b/zsh/plugins/timer/timer.plugin.zsh
@@ -1,5 +1,8 @@
+zmodload zsh/datetime
+
__timer_current_time() {
- perl -MTime::HiRes=time -e'print time'
+ zmodload zsh/datetime
+ echo $EPOCHREALTIME
}
__timer_format_duration() {
@@ -19,11 +22,14 @@ __timer_display_timer_precmd() {
local cmd_end_time=$(__timer_current_time)
local tdiff=$((cmd_end_time - __timer_cmd_start_time))
unset __timer_cmd_start_time
- local tdiffstr=$(__timer_format_duration ${tdiff})
- local cols=$((COLUMNS - ${#tdiffstr} - 1))
- echo -e "\033[1A\033[${cols}C ${tdiffstr}"
+ if [[ -z "${TIMER_THRESHOLD}" || ${tdiff} -ge "${TIMER_THRESHOLD}" ]]; then
+ local tdiffstr=$(__timer_format_duration ${tdiff})
+ local cols=$((COLUMNS - ${#tdiffstr} - 1))
+ echo -e "\033[1A\033[${cols}C ${tdiffstr}"
+ fi
fi
}
-preexec_functions+=(__timer_save_time_preexec)
-precmd_functions+=(__timer_display_timer_precmd)
+autoload -U add-zsh-hook
+add-zsh-hook preexec __timer_save_time_preexec
+add-zsh-hook precmd __timer_display_timer_precmd
diff --git a/zsh/plugins/tmux-cssh/README.md b/zsh/plugins/tmux-cssh/README.md
new file mode 100644
index 0000000..4602a50
--- /dev/null
+++ b/zsh/plugins/tmux-cssh/README.md
@@ -0,0 +1,10 @@
+# tmux-cssh plugin
+
+This plugin adds autocompletion for [`tmux-cssh`](https://github.com/zinic/tmux-cssh/).
+
+To use it, add `tmux-cssh` to the plugins array in your zshrc file:
+```zsh
+plugins=(... tmux-cssh)
+```
+
+First upstream repo, now disappeared: https://github.com/dennishafemann/tmux-cssh.
diff --git a/zsh/plugins/tmux-cssh/_tmux-cssh b/zsh/plugins/tmux-cssh/_tmux-cssh
index 604e2e4..3e81b82 100644
--- a/zsh/plugins/tmux-cssh/_tmux-cssh
+++ b/zsh/plugins/tmux-cssh/_tmux-cssh
@@ -5,21 +5,21 @@
# Author: Manfred Touron (@moul)
_arguments \
-'(-h --help)'{-h,--help}'[This help.]' \
-'(-u --user)'{-u,--user}'[User to use.]' \
-'(-c --certificate)'{-c,--certificate}'[Path to ssh-certificate to use.]' \
-'(-sc --ssh)'{-sc,--ssh}'[SSH-connection-string, multiple.]' \
-'(-sa --ssh)'{-sa,--ssh}'[SSH connection arguments, used on every session.]' \
-'(-ts --tmux)'{-ts,--tmux}'[Alternative tmux-session-name, default: tmux-cssh]' \
-'(-ns --new)'{-ns,--new}'[Initializes a new session, like -ts \[name\].]' \
-'(-q --quiet)'{-q,--quiet}'[Quiet-mode.]' \
-'(-f --filename)'{-f,--filename}'[Filename of textfile to get -sc connection-strings from, line separated.]' \
-'(-cs --config)'{-cs,--config}'[Name of config-settings which should be get from config-file "$HOME/.tmux-cssh". Which can be a grep-regular expression to find the name(s).]' \
+ '(-h --help)'{-h,--help}'[This help.]' \
+ '(-u --user)'{-u,--user}'[User to use.]' \
+ '(-c --certificate)'{-c,--certificate}'[Path to ssh-certificate to use.]' \
+ '(-sc --ssh)'{-sc,--ssh}'[SSH-connection-string, multiple.]' \
+ '(-sa --ssh)'{-sa,--ssh}'[SSH connection arguments, used on every session.]' \
+ '(-ts --tmux)'{-ts,--tmux}'[Alternative tmux-session-name, default: tmux-cssh]' \
+ '(-ns --new)'{-ns,--new}'[Initializes a new session, like -ts \[name\].]' \
+ '(-q --quiet)'{-q,--quiet}'[Quiet-mode.]' \
+ '(-f --filename)'{-f,--filename}'[Filename of textfile to get -sc connection-strings from, line separated.]' \
+ '(-cs --config)'{-cs,--config}'[Name of config-settings which should be get from config-file "$HOME/.tmux-cssh". Which can be a grep-regular expression to find the name(s).]' \
':hosts:_hosts' \
'*:: :->subcmds' \
&& return 0
if (( CURRENT == 1 )); then
- _describe -t commands "tmux-cssh command"
- return
+ _describe -t commands "tmux-cssh command"
+ return
fi
diff --git a/zsh/plugins/tmux/README.md b/zsh/plugins/tmux/README.md
index 427119d..2ceaf1a 100644
--- a/zsh/plugins/tmux/README.md
+++ b/zsh/plugins/tmux/README.md
@@ -1,13 +1,14 @@
# tmux
-This plugin provides aliases for [tmux](http://tmux.github.io/), the terminal multiplexer.
+This plugin provides aliases for [tmux](https://tmux.github.io/), the terminal multiplexer.
To use it add `tmux` to the plugins array in your zshrc file.
```zsh
plugins=(... tmux)
```
-The plugin also supports the following -
+The plugin also supports the following:
+
- determines if tmux is installed or not, if not, prompts user to install tmux
- determines if the terminal supports the 256 colors or not, sets the appropriate configuration variable
- sets the correct local config file to use
@@ -24,7 +25,6 @@ The plugin also supports the following -
| `tkss` | tmux kill-session -t | Terminate named running tmux session |
| `tmux` | `_zsh_tmux_plugin_run` | Start a new tmux session |
-
## Configuration Variables
| Variable | Description |
@@ -37,3 +37,5 @@ The plugin also supports the following -
| `ZSH_TMUX_ITERM2` | Sets the `-CC` option for iTerm2 tmux integration (default: `false`) |
| `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `screen`) |
| `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `screen-256color` |
+| `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`) |
+| `ZSH_TMUX_UNICODE` | Set `tmux -u` option to support unicode |
diff --git a/zsh/plugins/tmux/tmux.extra.conf b/zsh/plugins/tmux/tmux.extra.conf
index beffd38..c4aaad0 100644
--- a/zsh/plugins/tmux/tmux.extra.conf
+++ b/zsh/plugins/tmux/tmux.extra.conf
@@ -1,2 +1,2 @@
set -g default-terminal $ZSH_TMUX_TERM
-source $HOME/.tmux.conf
+source-file $ZSH_TMUX_CONFIG
\ No newline at end of file
diff --git a/zsh/plugins/tmux/tmux.plugin.zsh b/zsh/plugins/tmux/tmux.plugin.zsh
index 2f3c3e7..e52443a 100644
--- a/zsh/plugins/tmux/tmux.plugin.zsh
+++ b/zsh/plugins/tmux/tmux.plugin.zsh
@@ -34,6 +34,10 @@ alias tkss='tmux kill-session -t'
# Tmux states this should be screen-256color, but you may need to change it on
# systems without the proper terminfo
: ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color}
+# Set the configuration path
+: ${ZSH_TMUX_CONFIG:=$HOME/.tmux.conf}
+# Set -u option to support unicode
+: ${ZSH_TMUX_UNICODE:=false}
# Determine if the terminal supports 256 colors
if [[ $terminfo[colors] == 256 ]]; then
@@ -43,7 +47,8 @@ else
fi
# Set the correct local config file to use.
-if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$HOME/.tmux.conf" ]]; then
+if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$ZSH_TMUX_CONFIG" ]]; then
+ export ZSH_TMUX_CONFIG
export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.extra.conf"
else
export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.only.conf"
@@ -59,13 +64,18 @@ function _zsh_tmux_plugin_run() {
local -a tmux_cmd
tmux_cmd=(command tmux)
[[ "$ZSH_TMUX_ITERM2" == "true" ]] && tmux_cmd+=(-CC)
+ [[ "$ZSH_TMUX_UNICODE" == "true" ]] && tmux_cmd+=(-u)
# Try to connect to an existing session.
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach
# If failed, just run tmux, fixing the TERM variable if requested.
if [[ $? -ne 0 ]]; then
- [[ "$ZSH_TMUX_FIXTERM" == "true" ]] && tmux_cmd+=(-f "$_ZSH_TMUX_FIXED_CONFIG")
+ if [[ "$ZSH_TMUX_FIXTERM" == "true" ]]; then
+ tmux_cmd+=(-f "$_ZSH_TMUX_FIXED_CONFIG")
+ elif [[ -e "$ZSH_TMUX_CONFIG" ]]; then
+ tmux_cmd+=(-f "$ZSH_TMUX_CONFIG")
+ fi
$tmux_cmd new-session
fi
diff --git a/zsh/plugins/tmuxinator/README.md b/zsh/plugins/tmuxinator/README.md
index 994d8d4..8709204 100644
--- a/zsh/plugins/tmuxinator/README.md
+++ b/zsh/plugins/tmuxinator/README.md
@@ -11,9 +11,9 @@ plugins=(... tmuxinator)
## Aliases
-| Alias | Command | Description |
-| ------ | ---------------- | ------------------------ |
-| `txs ` | tmuxinator start | Start Tmuxinator |
-| `txo ` | tmuxinator open | Open project for editing |
-| `txn ` | tmuxinator new | Create project |
-| `txl ` | tmuxinator list | List projects |
+| Alias | Command | Description |
+| ----- | ---------------- | ------------------------ |
+| `txs` | tmuxinator start | Start Tmuxinator |
+| `txo` | tmuxinator open | Open project for editing |
+| `txn` | tmuxinator new | Create project |
+| `txl` | tmuxinator list | List projects |
diff --git a/zsh/plugins/tugboat/README.md b/zsh/plugins/tugboat/README.md
new file mode 100644
index 0000000..14f828f
--- /dev/null
+++ b/zsh/plugins/tugboat/README.md
@@ -0,0 +1,12 @@
+# Tugboat plugin
+
+This plugin adds autocompletion for Tugboat, a command line tool for interacting with your
+[DigitalOcean droplets](https://www.digitalocean.com/products/droplets/).
+
+To use it, add it to the plugins array in your `~/.zshrc` file:
+
+```zsh
+plugins=(... tugboat)
+```
+
+Further documentation for Tugboat can be found in the [Tugboat repository](https://github.com/petems/tugboat).
diff --git a/zsh/plugins/ufw/README.md b/zsh/plugins/ufw/README.md
new file mode 100644
index 0000000..ac377cd
--- /dev/null
+++ b/zsh/plugins/ufw/README.md
@@ -0,0 +1,18 @@
+# UFW plugin
+
+This plugin adds completion for managing everybody's favorite Uncomplicated Firewall (UFW),
+a simple interface for managing iptables. Learn more about [`UFW`](https://wiki.ubuntu.com/UncomplicatedFirewall).
+
+To use it, add ufw to the plugins array of your zshrc file:
+```
+plugins=(... ufw)
+```
+
+Some of the commands include:
+
+* `allow /` add an allow rule
+* `default` set default policy
+* `delete /` delete RULE
+* `deny /` add deny rule
+* `disable` disables the firewall
+* `enable` enables the firewall
diff --git a/zsh/plugins/urltools/README.md b/zsh/plugins/urltools/README.md
index 548301c..29c3710 100644
--- a/zsh/plugins/urltools/README.md
+++ b/zsh/plugins/urltools/README.md
@@ -21,9 +21,9 @@ Original idea and aliases: [Ruslan Spivak](https://ruslanspivak.wordpress.com/20
## Examples
```zsh
-urlencode 'https://github.com/robbyrussell/oh-my-zsh/search?q=urltools&type=Code'
-# returns https%3A%2F%2Fgithub.com%2Frobbyrussell%2Foh-my-zsh%2Fsearch%3Fq%3Durltools%26type%3DCode
+urlencode 'https://github.com/ohmyzsh/ohmyzsh/search?q=urltools&type=Code'
+# returns https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh%2Fsearch%3Fq%3Durltools%26type%3DCode
-urldecode 'https%3A%2F%2Fgithub.com%2Frobbyrussell%2Foh-my-zsh%2Fsearch%3Fq%3Durltools%26type%3DCode'
-# returns https://github.com/robbyrussell/oh-my-zsh/search?q=urltools&type=Code
+urldecode 'https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh%2Fsearch%3Fq%3Durltools%26type%3DCode'
+# returns https://github.com/ohmyzsh/ohmyzsh/search?q=urltools&type=Code
```
diff --git a/zsh/plugins/urltools/urltools.plugin.zsh b/zsh/plugins/urltools/urltools.plugin.zsh
index 47d9a34..b443e50 100644
--- a/zsh/plugins/urltools/urltools.plugin.zsh
+++ b/zsh/plugins/urltools/urltools.plugin.zsh
@@ -12,11 +12,11 @@ if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD
alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"'
alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"'
elif [[ $(whence python3) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then
- alias urlencode='python3 -c "import sys, urllib.parse as up; print(up.quote_plus(sys.argv[1]))"'
- alias urldecode='python3 -c "import sys, urllib.parse as up; print(up.unquote_plus(sys.argv[1]))"'
+ alias urlencode='python3 -c "import sys; del sys.path[0]; import urllib.parse as up; print(up.quote_plus(sys.argv[1]))"'
+ alias urldecode='python3 -c "import sys; del sys.path[0]; import urllib.parse as up; print(up.unquote_plus(sys.argv[1]))"'
elif [[ $(whence python2) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then
- alias urlencode='python2 -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
- alias urldecode='python2 -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
+ alias urlencode='python2 -c "import sys; del sys.path[0]; import urllib as ul; print ul.quote_plus(sys.argv[1])"'
+ alias urldecode='python2 -c "import sys; del sys.path[0]; import urllib as ul; print ul.unquote_plus(sys.argv[1])"'
elif [[ $(whence xxd) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xshell" ) ]]; then
function urlencode() {echo $@ | tr -d "\n" | xxd -plain | sed "s/\(..\)/%\1/g"}
function urldecode() {printf $(echo -n $@ | sed 's/\\/\\\\/g;s/\(%\)\([0-9a-fA-F][0-9a-fA-F]\)/\\x\2/g')"\n"}
diff --git a/zsh/plugins/vagrant-prompt/vagrant-prompt.plugin.zsh b/zsh/plugins/vagrant-prompt/vagrant-prompt.plugin.zsh
index 28bf31f..d7c76c3 100644
--- a/zsh/plugins/vagrant-prompt/vagrant-prompt.plugin.zsh
+++ b/zsh/plugins/vagrant-prompt/vagrant-prompt.plugin.zsh
@@ -16,22 +16,17 @@
# ZSH_THEME_VAGRANT_PROMPT_NOT_CREATED="%{$fg_no_bold[white]%}○"
function vagrant_prompt_info() {
- test -d .vagrant && test -f Vagrantfile
- if [[ "$?" == "0" ]]; then
- statuses=$(vagrant status 2> /dev/null | grep -P "\w+\s+[\w\s]+\s\(\w+\)")
- statuses=("${(f)statuses}")
+ local vm_states vm_state
+ if [[ -d .vagrant && -f Vagrantfile ]]; then
+ vm_states=(${(f)"$(vagrant status 2> /dev/null | sed -nE 's/^.*(saved|poweroff|running|not created) \([[:alnum:]_]+\)$/\1/p')"})
printf '%s' $ZSH_THEME_VAGRANT_PROMPT_PREFIX
- for vm_details in $statuses; do
- vm_state=$(echo $vm_details | grep -o -E "saved|poweroff|not created|running")
- if [[ "$vm_state" == "running" ]]; then
- printf '%s' $ZSH_THEME_VAGRANT_PROMPT_RUNNING
- elif [[ "$vm_state" == "saved" ]]; then
- printf '%s' $ZSH_THEME_VAGRANT_PROMPT_SUSPENDED
- elif [[ "$vm_state" == "not created" ]]; then
- printf '%s' $ZSH_THEME_VAGRANT_PROMPT_NOT_CREATED
- elif [[ "$vm_state" == "poweroff" ]]; then
- printf '%s' $ZSH_THEME_VAGRANT_PROMPT_POWEROFF
- fi
+ for vm_state in $vm_states; do
+ case "$vm_state" in
+ saved) printf '%s' $ZSH_THEME_VAGRANT_PROMPT_SUSPENDED ;;
+ running) printf '%s' $ZSH_THEME_VAGRANT_PROMPT_RUNNING ;;
+ poweroff) printf '%s' $ZSH_THEME_VAGRANT_PROMPT_POWEROFF ;;
+ "not created") printf '%s' $ZSH_THEME_VAGRANT_PROMPT_NOT_CREATED ;;
+ esac
done
printf '%s' $ZSH_THEME_VAGRANT_PROMPT_SUFFIX
fi
diff --git a/zsh/plugins/vagrant/README.md b/zsh/plugins/vagrant/README.md
index f6ea87b..331bfa1 100644
--- a/zsh/plugins/vagrant/README.md
+++ b/zsh/plugins/vagrant/README.md
@@ -8,3 +8,33 @@ To use it, add `vagrant` to the plugins array in your zshrc file:
plugins=(... vagrant)
```
+## Aliases
+
+| Alias | Command |
+|---------|------------------------------|
+| `vgi` | `vagrant init` |
+| `vup` | `vagrant up` |
+| `vd` | `vagrant destroy` |
+| `vdf` | `vagrant destroy -f` |
+| `vssh` | `vagrant ssh` |
+| `vsshc` | `vagrant ssh-config` |
+| `vrdp` | `vagrant rdp` |
+| `vh` | `vagrant halt` |
+| `vssp` | `vagrant suspend` |
+| `vst` | `vagrant status` |
+| `vre` | `vagrant resume` |
+| `vgs` | `vagrant global-status` |
+| `vpr` | `vagrant provision` |
+| `vr` | `vagrant reload` |
+| `vrp` | `vagrant reload --provision` |
+| `vp` | `vagrant push` |
+| `vsh` | `vagrant share` |
+| `vba` | `vagrant box add` |
+| `vbr` | `vagrant box remove` |
+| `vbl` | `vagrant box list` |
+| `vbo` | `vagrant box outdated` |
+| `vbu` | `vagrant box update` |
+| `vpli` | `vagrant plugin install` |
+| `vpll` | `vagrant plugin list` |
+| `vplun` | `vagrant plugin uninstall` |
+| `vplu` | `vagrant plugin update` |
diff --git a/zsh/plugins/vagrant/_vagrant b/zsh/plugins/vagrant/_vagrant
index 2efb447..3e16dbe 100644
--- a/zsh/plugins/vagrant/_vagrant
+++ b/zsh/plugins/vagrant/_vagrant
@@ -64,13 +64,13 @@ __task_list ()
__box_list ()
{
- _wanted application expl 'command' compadd $(command vagrant box list | sed -e 's/ /\\ /g')
+ _wanted application expl 'command' compadd $(command vagrant box list | sed -e 's/ *(.*)//g;s/ /\\ /g')
}
__vm_list ()
{
- _wanted application expl 'command' compadd $(command grep Vagrantfile -oe '^[^#]*\.vm\.define *[:"]\([a-zA-Z0-9_-]\+\)' 2>/dev/null | awk '{print substr($2, 2)}')
- _wanted application expl 'command' compadd $(command ls .vagrant/machines/ 2>/dev/null)
+ _wanted application expl 'command' compadd $(command grep "${VAGRANT_CWD:-.}/Vagrantfile" -oe '^[^#]*\.vm\.define *[:"]\([a-zA-Z0-9_-]\+\)' 2>/dev/null | awk '{print substr($2, 2)}')
+ _wanted application expl 'command' compadd $(command ls "${VAGRANT_CWD:-.}/.vagrant/machines/" 2>/dev/null)
}
__vagrant-box ()
diff --git a/zsh/plugins/vagrant/vagrant.plugin.zsh b/zsh/plugins/vagrant/vagrant.plugin.zsh
new file mode 100644
index 0000000..a4e9b06
--- /dev/null
+++ b/zsh/plugins/vagrant/vagrant.plugin.zsh
@@ -0,0 +1,33 @@
+alias vgi="vagrant init"
+
+alias vup="vagrant up"
+alias vd="vagrant destroy"
+alias vdf="vagrant destroy -f"
+
+alias vssh="vagrant ssh"
+alias vsshc="vagrant ssh-config"
+alias vrdp="vagrant rdp"
+
+alias vh="vagrant halt"
+alias vssp="vagrant suspend"
+alias vst="vagrant status"
+alias vre="vagrant resume"
+alias vgs="vagrant global-status"
+
+alias vpr="vagrant provision"
+alias vr="vagrant reload"
+alias vrp="vagrant reload --provision"
+
+alias vp="vagrant push"
+alias vsh="vagrant share"
+
+alias vba="vagrant box add"
+alias vbr="vagrant box remove"
+alias vbl="vagrant box list"
+alias vbo="vagrant box outdated"
+alias vbu="vagrant box update"
+
+alias vpli="vagrant plugin install"
+alias vpll="vagrant plugin list"
+alias vplun="vagrant plugin uninstall"
+alias vplu="vagrant plugin update"
diff --git a/zsh/plugins/virtualenvwrapper/README.md b/zsh/plugins/virtualenvwrapper/README.md
new file mode 100644
index 0000000..63eb585
--- /dev/null
+++ b/zsh/plugins/virtualenvwrapper/README.md
@@ -0,0 +1,38 @@
+# Virtualenvwrapper plugin
+
+This plugin loads Python's [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/) shell tools.
+
+To use it, add `virtualenvwrapper` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... virtualenvwrapper)
+```
+
+## Usage
+
+The plugin allows to automatically activate virtualenvs on cd into git repositories with a matching name:
+
+```
+➜ github $ cd ansible
+(ansible) ➜ ansible git:(devel) $ cd docs
+(ansible) ➜ docs git:(devel) $ cd ..
+(ansible) ➜ ansible git:(devel) $ cd ..
+➜ github $
+```
+
+We can override this by having a `.venv` file in the directory containing a differently named virtualenv:
+
+```
+➜ github $ cat ansible/.venv
+myvirtualenv
+➜ github $ cd ansible
+(myvirtualenv) ➜ ansible git:(devel) $ cd ..
+➜ github $
+```
+
+We can disable this behaviour by setting `DISABLE_VENV_CD=1` before Oh My Zsh is sourced:
+```zsh
+DISABLE_VENV_CD=1
+plugins=(... virtualenvwrapper)
+source $ZSH/oh-my-zsh.sh
+```
diff --git a/zsh/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/zsh/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
index e27c6bb..88217a7 100644
--- a/zsh/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
+++ b/zsh/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
@@ -1,48 +1,31 @@
-virtualenvwrapper='virtualenvwrapper.sh'
-virtualenvwrapper_lazy='virtualenvwrapper_lazy.sh'
+function {
+ # search in these locations for the init script:
+ for virtualenvwrapper in $commands[virtualenvwrapper_lazy.sh] \
+ $commands[virtualenvwrapper.sh] \
+ /usr/share/virtualenvwrapper/virtualenvwrapper{_lazy,}.sh \
+ /usr/local/bin/virtualenvwrapper{_lazy,}.sh \
+ /etc/bash_completion.d/virtualenvwrapper \
+ /usr/share/bash-completion/completions/virtualenvwrapper \
+ $HOME/.local/bin/virtualenvwrapper.sh
+ do
+ if [[ -f "$virtualenvwrapper" ]]; then
+ source "$virtualenvwrapper"
+ return
+ fi
+ done
+ print "[oh-my-zsh] virtualenvwrapper plugin: Cannot find virtualenvwrapper.sh.\n"\
+ "Please install with \`pip install virtualenvwrapper\`" >&2
+ return 1
+}
-if (( $+commands[$virtualenvwrapper_lazy] )); then
- function {
- setopt local_options
- unsetopt equals
- virtualenvwrapper=${${virtualenvwrapper_lazy}:c}
- source ${${virtualenvwrapper_lazy}:c}
- [[ -z "$WORKON_HOME" ]] && WORKON_HOME="$HOME/.virtualenvs"
- }
-elif (( $+commands[$virtualenvwrapper] )); then
- function {
- setopt local_options
- unsetopt equals
- source ${${virtualenvwrapper}:c}
- }
-elif [[ -f "/usr/local/bin/virtualenvwrapper.sh" ]]; then
- function {
- setopt local_options
- unsetopt equals
- virtualenvwrapper="/usr/local/bin/virtualenvwrapper.sh"
- source "/usr/local/bin/virtualenvwrapper.sh"
- }
-elif [[ -f "/etc/bash_completion.d/virtualenvwrapper" ]]; then
- function {
- setopt local_options
- unsetopt equals
- virtualenvwrapper="/etc/bash_completion.d/virtualenvwrapper"
- source "/etc/bash_completion.d/virtualenvwrapper"
- }
-else
- print "[oh-my-zsh] virtualenvwrapper plugin: Cannot find ${virtualenvwrapper}.\n"\
- "Please install with \`pip install virtualenvwrapper\`" >&2
- return
-fi
-if ! type workon &>/dev/null; then
+if [[ $? -eq 0 ]] && ! type workon &>/dev/null; then
print "[oh-my-zsh] virtualenvwrapper plugin: shell function 'workon' not defined.\n"\
"Please check ${virtualenvwrapper}" >&2
return
fi
-if [[ "$WORKON_HOME" == "" ]]; then
- print "[oh-my-zsh] \$WORKON_HOME is not defined so plugin virtualenvwrapper will not work" >&2
- return
+if [[ -z "$WORKON_HOME" ]]; then
+ WORKON_HOME="$HOME/.virtualenvs"
fi
if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
@@ -77,6 +60,12 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
else
ENV_NAME=""
fi
+
+ if [[ -n $CD_VIRTUAL_ENV && "$ENV_NAME" != "$CD_VIRTUAL_ENV" ]]; then
+ # We've just left the repo, deactivate the environment
+ # Note: this only happens if the virtualenv was activated automatically
+ deactivate && unset CD_VIRTUAL_ENV
+ fi
if [[ "$ENV_NAME" != "" ]]; then
# Activate the environment only if it is not already active
if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
@@ -86,17 +75,12 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
fi
fi
- elif [[ -n $CD_VIRTUAL_ENV && -n $VIRTUAL_ENV ]]; then
- # We've just left the repo, deactivate the environment
- # Note: this only happens if the virtualenv was activated automatically
- deactivate && unset CD_VIRTUAL_ENV
fi
fi
}
# Append workon_cwd to the chpwd_functions array, so it will be called on cd
# http://zsh.sourceforge.net/Doc/Release/Functions.html
- if ! (( $chpwd_functions[(I)workon_cwd] )); then
- chpwd_functions+=(workon_cwd)
- fi
+ autoload -U add-zsh-hook
+ add-zsh-hook chpwd workon_cwd
fi
diff --git a/zsh/plugins/vscode/README.md b/zsh/plugins/vscode/README.md
index 74b5a45..e95ed5d 100644
--- a/zsh/plugins/vscode/README.md
+++ b/zsh/plugins/vscode/README.md
@@ -1,6 +1,6 @@
-# VS code
+# VS Code
-This plugin makes interaction between the command line and the code editor easier.
+This plugin provides useful aliases to simplify the interaction between the command line and VS Code or VSCodium editor.
To start using it, add the `vscode` plugin to your `plugins` array in `~/.zshrc`:
@@ -8,14 +8,39 @@ To start using it, add the `vscode` plugin to your `plugins` array in `~/.zshrc`
plugins=(... vscode)
```
-If you are using [Visual Studio Code Insiders](https://code.visualstudio.com/insiders/),
-add the following line in the oh-my-zsh settings section (between the `ZSH_THEME` and
-the `plugins=()` line). This will make the plugin use the Insiders version instead.
+## Requirements
+
+This plugin requires to have a flavour of VS Code installed and it's executable available in PATH.
+
+You can install either:
+
+* VS Code (code)
+* VS Code Insiders (code-insiders)
+* VSCodium (codium)
+
+### MacOS
+While Linux installations will add the executable to PATH, MacOS users might still have to do this manually:
+
+[For VS Code and VS Code Insiders](https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line), open
+the Command Palette via (F1 or ⇧⌘P) and type shell command to find the Shell Command:
+> Shell Command: Install 'code' command in PATH
+
+[For VSCodium](https://github.com/VSCodium/vscodium/blob/master/DOCS.md#how-do-i-open-vscodium-from-the-terminal), open
+the Command Palette via (F1 or ⇧⌘P) and type shell command to find the Shell Command:
+> Shell Command: Install 'codium' command in PATH
+
+## Using multiple flavours
+
+If for any reason, you ever require to use multiple flavours of VS Code i.e. VS Code (stable) and VS Code Insiders, you can
+manually specify the flavour's executable. Add the following line to the .zshrc file (between the `ZSH_THEME` and the `plugins=()` lines).
+This will make the plugin use your manually defined executable.
```zsh
ZSH_THEME=...
-# Add this line to use code-insiders instead of code
+# Choose between one [code, code-insiders or codium]
+# The following line will make the plugin to open VS Code Insiders
+# Invalid entries will be ignored, no aliases will be added
VSCODE=code-insiders
plugins=(... vscode)
diff --git a/zsh/plugins/vscode/vscode.plugin.zsh b/zsh/plugins/vscode/vscode.plugin.zsh
index 4c15df2..48d9043 100644
--- a/zsh/plugins/vscode/vscode.plugin.zsh
+++ b/zsh/plugins/vscode/vscode.plugin.zsh
@@ -1,8 +1,27 @@
-# VScode zsh plugin
-# author: https://github.com/MarsiBarsi
+# VS Code (stable / insiders) / VSCodium zsh plugin
+# Authors:
+# https://github.com/MarsiBarsi (original author)
+# https://github.com/babakks
+# https://github.com/SteelShot
-# Use main Visual Studio Code version by default
-: ${VSCODE:=code}
+# Verify if any manual user choice of VS Code exists first.
+if [[ -n "$VSCODE" ]] && ! which $VSCODE &>/dev/null; then
+ echo "'$VSCODE' flavour of VS Code not detected."
+ unset VSCODE
+fi
+
+# Otherwise, try to detect a flavour of VS Code.
+if [[ -z "$VSCODE" ]]; then
+ if which code &>/dev/null; then
+ VSCODE=code
+ elif which code-insiders &>/dev/null; then
+ VSCODE=code-insiders
+ elif which codium &>/dev/null; then
+ VSCODE=codium
+ else
+ return
+ fi
+fi
alias vsc="$VSCODE ."
alias vsca="$VSCODE --add"
diff --git a/zsh/plugins/wakeonlan/README b/zsh/plugins/wakeonlan/README.md
similarity index 67%
rename from zsh/plugins/wakeonlan/README
rename to zsh/plugins/wakeonlan/README.md
index 16fdd45..3fcb6d7 100644
--- a/zsh/plugins/wakeonlan/README
+++ b/zsh/plugins/wakeonlan/README.md
@@ -1,9 +1,17 @@
+# wakeonlan
+
This plugin provides a wrapper around the "wakeonlan" tool available from most
-distributions' package repositories, or from the following website:
+distributions' package repositories, or from [the following website](https://github.com/jpoliv/wakeonlan).
-http://gsd.di.uminho.pt/jpo/software/wakeonlan/
+To use it, add `wakeonlan` to the plugins array in your zshrc file:
-In order to use this wrapper, create the ~/.wakeonlan directory, and place in
+```zsh
+plugins=(... wakeonlan)
+```
+
+## Usage
+
+In order to use this wrapper, create the `~/.wakeonlan` directory, and place in
that directory one file for each device you would like to be able to wake. Give
the file a name that describes the device, such as its hostname. Each file
should contain a line with the mac address of the target device and the network
@@ -12,15 +20,21 @@ broadcast address.
For instance, there might be a file ~/.wakeonlan/leto with the following
contents:
+```
00:11:22:33:44:55:66 192.168.0.255
+```
To wake that device, use the following command:
-# wake leto
+```console
+$ wake leto
+```
The available device names will be autocompleted, so:
-# wake
+```console
+$ wake
+```
...will suggest "leto", along with any other configuration files that were
placed in the ~/.wakeonlan directory.
diff --git a/zsh/plugins/wd/README.md b/zsh/plugins/wd/README.md
index b1deeff..8791f9f 100644
--- a/zsh/plugins/wd/README.md
+++ b/zsh/plugins/wd/README.md
@@ -1,158 +1,259 @@
-wd
-==
+# wd
[](https://travis-ci.org/mfaerevaag/wd)
-`wd` (*warp directory*) lets you jump to custom directories in zsh, without using `cd`. Why? Because `cd` seems inefficient when the folder is frequently visited or has a long path.
+`wd` (*warp directory*) lets you jump to custom directories in zsh, without using `cd`.
+Why?
+Because `cd` seems inefficient when the folder is frequently visited or has a long path.

-*NEWS*: If you are not using zsh, check out the c-port, [wd-c](https://github.com/mfaerevaag/wd-c), which works with all shells using wrapper functions.
+## Setup
-### Setup
+### [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh)
-### oh-my-zsh
+`wd` comes bundled with oh-my-zsh!
-`wd` comes bundled with [oh-my-zshell](https://github.com/robbyrussell/oh-my-zsh)!
+Just add the plugin in your `.zshrc` file:
-Just add the plugin in your `~/.zshrc` file:
+```zsh
+plugins=(... wd)
+```
- plugins=(... wd)
+### [Antigen](https://github.com/zsh-users/antigen)
+In your `.zshrc`:
-#### Automatic
+```zsh
+antigen bundle mfaerevaag/wd
+```
-Run either in terminal:
+### [Antibody](https://github.com/getantibody/antibody)
- * `curl -L https://github.com/mfaerevaag/wd/raw/master/install.sh | sh`
+In your `.zshrc`:
- * `wget --no-check-certificate https://github.com/mfaerevaag/wd/raw/master/install.sh -O - | sh`
+```zsh
+antibody bundle mfaerevaag/wd
+```
-##### Arch ([AUR](https://aur.archlinux.org/))
+### Arch ([AUR](https://aur.archlinux.org/packages/zsh-plugin-wd-git/))
- # yaourt -S zsh-plugin-wd-git
+1. Install from the AUR
+```zsh
+yay -S zsh-plugin-wd-git
+# or use any other AUR helper
+```
-#### Manual
+2. Then add to your `.zshrc`:
- * Clone this repo to your liking
+```zsh
+wd() {
+ . /usr/share/wd/wd.sh
+}
+```
- * Add `wd` function to `.zshrc` (or `.profile` etc.):
+### [zplug](https://github.com/zplug/zplug)
- wd() {
- . ~/path/to/cloned/repo/wd/wd.sh
- }
+```zsh
+zplug "mfaerevaag/wd", as:command, use:"wd.sh", hook-load:"wd() { . $ZPLUG_REPOS/mfaerevaag/wd/wd.sh }"
+```
- * Install manpage. From `wd`'s base directory (requires root permissions):
+### Automatic
- # cp wd.1 /usr/share/man/man1/wd.1
- # chmod 644 /usr/share/man/man1/wd.1
+_Note: automatic install does not provide the manpage. It is also poor security practice to run remote code without first reviewing it, so you ought to look [here](https://github.com/mfaerevaag/wd/blob/master/install.sh)_
- Note, when pulling and updating `wd`, you'll need to do this again in case of changes to the manpage.
+Run either command in your terminal:
+```zsh
+curl -L https://github.com/mfaerevaag/wd/raw/master/install.sh | sh
+```
-#### Completion
+or
-If you're NOT using [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) and you want to utilize the zsh-completion feature, you will also need to add the path to your `wd` installation (`~/bin/wd` if you used the automatic installer) to your `fpath`. E.g. in your `~/.zshrc`:
+```zsh
+wget --no-check-certificate https://github.com/mfaerevaag/wd/raw/master/install.sh -O - | sh
+```
- fpath=(~/path/to/wd $fpath)
+### Manual
+
+1. Clone this repository on your local machine in a sensible location (if you know what you're doing of course all of this is up to you):
+
+```zsh
+git clone git@github.com:mfaerevaag/wd.git ~/.local/wd --depth 1
+```
+
+2. Add `wd` function to `.zshrc` (or `.profile` etc.):
+
+```zsh
+wd() {
+ . ~/.local/wd/wd.sh
+}
+```
+
+3. Install manpage (optional):
+
+```zsh
+sudo cp ~/.local/wd/wd.1 /usr/share/man/man1/wd.1
+sudo chmod 644 /usr/share/man/man1/wd.1
+```
+
+**Note:** when pulling and updating `wd`, you'll need to repeat step 3 should the manpage change
+
+## Completion
+
+If you're NOT using [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) and you want to utilize the zsh-completion feature, you will also need to add the path to your `wd` installation (`~/bin/wd` if you used the automatic installer) to your `fpath`.
+E.g. in your `~/.zshrc`:
+
+```zsh
+fpath=(~/path/to/wd $fpath)
+```
Also, you may have to force a rebuild of `zcompdump` by running:
- $ rm -f ~/.zcompdump; compinit
+```zsh
+rm -f ~/.zcompdump; compinit
+```
+## Usage
+* Add warp point to current working directory:
-### Usage
+```zsh
+wd add foo
+```
- * Add warp point to current working directory:
+If a warp point with the same name exists, use `wd add foo --force` to overwrite it.
- $ wd add foo
+**Note:** a warp point cannot contain colons, or consist of only spaces and dots.
+The first will conflict in how `wd` stores the warp points, and the second will conflict with other features, as below.
- If a warp point with the same name exists, use `add!` to overwrite it.
+You can omit point name to automatically use the current directory's name instead.
- Note, a warp point cannot contain colons, or only consist of only spaces and dots. The first will conflict in how `wd` stores the warp points, and the second will conflict with other features, as below.
+* From any directory, warp to `foo` with:
- You can omit point name to use the current directory's name instead.
+```zsh
+wd foo
+```
- * From an other directory (not necessarily), warp to `foo` with:
+* You can also warp to a directory within `foo`, with autocompletion:
- $ wd foo
+```zsh
+wd foo some/inner/path
+```
- * You can warp back to previous directory, and so on, with this dot syntax:
+* You can warp back to previous directory and higher, with this dot syntax:
- $ wd ..
- $ wd ...
+```zsh
+wd ..
+wd ...
+```
- This is a wrapper for the zsh `dirs` function.
- (You might need `setopt AUTO_PUSHD` in your `.zshrc` if you hare not using [oh-my-zshell](https://github.com/robbyrussell/oh-my-zsh)).
+This is a wrapper for the zsh's `dirs` function.
+_You might need to add `setopt AUTO_PUSHD` to your `.zshrc` if you are not using [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh)._
- * Remove warp point test point:
+* Remove warp point:
- $ wd rm foo
+```zsh
+wd rm foo
+```
- You can omit point name to use the current directory's name instead.
+You can omit point name to use the current directory's name instead.
- * List all warp points (stored in `~/.warprc`):
+* List all warp points (stored in `~/.warprc` by default):
- $ wd list
+```zsh
+wd list
+```
- * List files in given warp point:
+* List files in given warp point:
- $ wd ls foo
+```zsh
+wd ls foo
+```
- * Show path of given warp point:
+* Show path of given warp point:
- $ wd path foo
+```zsh
+wd path foo
+```
- * List warp points to current directory, or optionally, path to given warp point:
+* List warp points to current directory, or optionally, path to given warp point:
- $ wd show
+```zsh
+wd show
+```
- * Remove warp points to non-existent directories.
+* Remove warp points to non-existent directories.
- $ wd clean
+```zsh
+wd clean
+```
- Use `clean!` to not be prompted with confirmation (force).
+Use `wd clean --force` to not be prompted with confirmation.
- * Print usage with no opts or the `help` argument:
+* Print usage info:
- $ wd help
+```zsh
+wd help
+```
- * Print the running version of `wd`:
+The usage will be printed also if you call `wd` with no command
- $ wd --version
+* Print the running version of `wd`:
- * Specifically set the config file (default `~/.warprc`), which is useful when testing:
+```zsh
+wd --version
+```
- $ wd --config ./file
+* Specifically set the config file (default being `~/.warprc`), which is useful for testing:
- * Force `exit` with return code after running. This is not default, as it will *exit your terminal*, though required when testing/debugging.
+```zsh
+wd --config ./file
+```
- $ wd --debug
+* Force `exit` with return code after running. This is not default, as it will *exit your terminal*, though required for testing/debugging.
- * Silence all output:
+```zsh
+wd --debug
+```
- $ wd --quiet
+* Silence all output:
+```zsh
+wd --quiet
+```
-### Testing
+## Configuration
-`wd` comes with a small test suite, run with [shunit2](https://code.google.com/p/shunit2/). This can be used to confirm that things are working as it should on your setup, or to demonstrate an issue.
+You can configure `wd` with the following environment variables:
+
+### `WD_CONFIG`
+
+Defines the path where warp points get stored. Defaults to `$HOME/.warprc`.
+
+## Testing
+
+`wd` comes with a small test suite, run with [shunit2](https://github.com/kward/shunit2). This can be used to confirm that things are working as they should on your setup, or to demonstrate an issue.
To run, simply `cd` into the `test` directory and run the `tests.sh`.
- $ ./tests.sh
+```zsh
+cd ./test
+./tests.sh
+```
+## Maintainers
-### License
+Following @mfaerevaag stepping away from active maintainership of this repository, the following users now are also maintainers of the repo:
-The project is licensed under the [MIT-license](https://github.com/mfaerevaag/wd/blob/master/LICENSE).
+* @alpha-tango-kilo
+* @MattLewin
-### Finally
+Anyone else contributing is greatly appreciated and will be mentioned in the release notes!
-If you have issues, feedback or improvements, don't hesitate to report it or submit a pull-request. In the case of an issue, we would much appreciate if you would include a failing test in `test/tests.sh`. For an explanation on how to run the tests, read the section "Testing" in this README.
+---
Credit to [altschuler](https://github.com/altschuler) for an awesome idea.
diff --git a/zsh/plugins/wd/_wd.sh b/zsh/plugins/wd/_wd.sh
index 4354a71..8d5cf15 100644
--- a/zsh/plugins/wd/_wd.sh
+++ b/zsh/plugins/wd/_wd.sh
@@ -1,6 +1,6 @@
#compdef wd
-zstyle ':completion:*:descriptions' format '%B%d%b'
+zstyle ':completion::complete:wd:*:descriptions' format '%B%d%b'
zstyle ':completion::complete:wd:*:commands' group-name commands
zstyle ':completion::complete:wd:*:warp_points' group-name warp_points
zstyle ':completion::complete:wd::' list-grouped
@@ -8,13 +8,13 @@ zstyle ':completion::complete:wd::' list-grouped
zmodload zsh/mapfile
function _wd() {
- local CONFIG=$HOME/.warprc
+ local WD_CONFIG=${WD_CONFIG:-$HOME/.warprc}
local ret=1
local -a commands
local -a warp_points
- warp_points=( "${(f)mapfile[$CONFIG]//$HOME/~}" )
+ warp_points=( "${(f)mapfile[$WD_CONFIG]//$HOME/~}" )
typeset -A points
while read -r line
@@ -27,11 +27,12 @@ function _wd() {
target_path=${target_path/#\~/$HOME}
points[$name]=$target_path
- done < $CONFIG
+ done < $WD_CONFIG
commands=(
'add:Adds the current working directory to your warp points'
'add!:Overwrites existing warp point'
+ 'export:Export warp points as static named directories'
'rm:Removes the given warp point'
'list:Outputs all stored warp points'
'ls:Show files from given warp point'
@@ -72,8 +73,12 @@ function _wd() {
_describe -t points "Warp points" warp_points && ret=0
;;
*)
- # complete sub directories from the warp point
- _path_files -W "(${points[$target]})" -/ && ret=0
+ if [[ -v points[$target] ]]; then
+ # complete sub directories from the warp point
+ _path_files -W "(${points[$target]})" -/ && ret=0
+ fi
+
+ # don't complete anything if warp point is not valid
;;
esac
;;
diff --git a/zsh/plugins/wd/wd.plugin.zsh b/zsh/plugins/wd/wd.plugin.zsh
index 4b7cd3c..87d1d08 100644
--- a/zsh/plugins/wd/wd.plugin.zsh
+++ b/zsh/plugins/wd/wd.plugin.zsh
@@ -1,6 +1,9 @@
+#!/bin/zsh
+
# WARP DIRECTORY
# ==============
-# oh-my-zsh plugin
+# Jump to custom directories in terminal
+# because `cd` takes too long...
#
# @github.com/mfaerevaag/wd
diff --git a/zsh/plugins/wd/wd.sh b/zsh/plugins/wd/wd.sh
index 3d68583..9085c5b 100644
--- a/zsh/plugins/wd/wd.sh
+++ b/zsh/plugins/wd/wd.sh
@@ -8,7 +8,7 @@
# @github.com/mfaerevaag/wd
# version
-readonly WD_VERSION=0.4.6
+readonly WD_VERSION=0.5.0
# colors
readonly WD_BLUE="\033[96m"
@@ -36,11 +36,11 @@ wd_yesorno()
read -r answer
case ${answer:=${default}} in
- Y|y|YES|yes|Yes )
+ "Y"|"y"|"YES"|"yes"|"Yes" )
RETVAL=${yes_RETVAL} && \
break
;;
- N|n|NO|no|No )
+ "N"|"n"|"NO"|"no"|"No" )
RETVAL=${no_RETVAL} && \
break
;;
@@ -71,14 +71,14 @@ wd_print_msg()
wd_print_usage()
{
- cat <<- EOF
+ command cat <<- EOF
Usage: wd [command] [point]
Commands:
+ Warps to the directory specified by the warp point
+ Warps to the directory specified by the warp point with path appended
add Adds the current working directory to your warp points
add Adds the current working directory to your warp points with current directory's name
- add! Overwrites existing warp point
- add! Overwrites existing warp point with current directory's name
rm Removes the given warp point
rm Removes the given warp point with current directory's name
show Print path to given warp point
@@ -86,12 +86,13 @@ Commands:
list Print all stored warp points
ls Show files from given warp point (ls)
path Show the path to given warp point (pwd)
- clean! Remove points warping to nonexistent directories
+ clean Remove points warping to nonexistent directories (will prompt unless --force is used)
-v | --version Print version
-d | --debug Exit after execution with exit codes (for testing)
-c | --config Specify config file (default ~/.warprc)
-q | --quiet Suppress all output
+ -f | --force Allows overwriting without warning (for add & clean)
help Show this extremely helpful text
EOF
@@ -101,7 +102,7 @@ wd_exit_fail()
{
local msg=$1
- wd_print_msg $WD_RED $msg
+ wd_print_msg "$WD_RED" "$msg"
WD_EXIT_CODE=1
}
@@ -109,7 +110,7 @@ wd_exit_warn()
{
local msg=$1
- wd_print_msg $WD_YELLOW $msg
+ wd_print_msg "$WD_YELLOW" "$msg"
WD_EXIT_CODE=1
}
@@ -117,7 +118,7 @@ wd_getdir()
{
local name_arg=$1
- point=$(wd_show $name_arg)
+ point=$(wd_show "$name_arg")
dir=${point:28+$#name_arg+7}
if [[ -z $name_arg ]]; then
@@ -160,12 +161,12 @@ wd_warp()
wd_add()
{
- local force=$1
- local point=$2
+ local point=$1
+ local force=$2
if [[ $point == "" ]]
then
- point=$(basename $PWD)
+ point=$(basename "$PWD")
fi
if [[ $point =~ "^[\.]+$" ]]
@@ -174,52 +175,62 @@ wd_add()
elif [[ $point =~ "[[:space:]]+" ]]
then
wd_exit_fail "Warp point should not contain whitespace"
- elif [[ $point == *:* ]]
+ elif [[ $point =~ : ]] || [[ $point =~ / ]]
then
- wd_exit_fail "Warp point cannot contain colons"
- elif [[ ${points[$point]} == "" ]] || $force
+ wd_exit_fail "Warp point contains illegal character (:/)"
+ elif [[ ${points[$point]} == "" ]] || [ ! -z "$force" ]
then
- wd_remove $point > /dev/null
- printf "%q:%s\n" "${point}" "${PWD/#$HOME/~}" >> $WD_CONFIG
+ wd_remove "$point" > /dev/null
+ printf "%q:%s\n" "${point}" "${PWD/#$HOME/~}" >> "$WD_CONFIG"
+ if (whence sort >/dev/null); then
+ local config_tmp=$(mktemp "${TMPDIR:-/tmp}/wd.XXXXXXXXXX")
+ # use 'cat' below to ensure we respect $WD_CONFIG as a symlink
+ command sort -o "${config_tmp}" "$WD_CONFIG" && command cat "${config_tmp}" > "$WD_CONFIG" && command rm "${config_tmp}"
+ fi
- wd_print_msg $WD_GREEN "Warp point added"
+ wd_export_static_named_directories
+
+ wd_print_msg "$WD_GREEN" "Warp point added"
# override exit code in case wd_remove did not remove any points
# TODO: we should handle this kind of logic better
WD_EXIT_CODE=0
else
- wd_exit_warn "Warp point '${point}' already exists. Use 'add!' to overwrite."
+ wd_exit_warn "Warp point '${point}' already exists. Use 'add --force' to overwrite."
fi
}
wd_remove()
{
- local point=$1
+ local point_list=$1
- if [[ $point == "" ]]
+ if [[ "$point_list" == "" ]]
then
- point=$(basename $PWD)
+ point_list=$(basename "$PWD")
fi
- if [[ ${points[$point]} != "" ]]
- then
- local config_tmp=$WD_CONFIG.tmp
- if sed -n "/^${point}:.*$/!p" $WD_CONFIG > $config_tmp && mv $config_tmp $WD_CONFIG
+ for point_name in $point_list ; do
+ if [[ ${points[$point_name]} != "" ]]
then
- wd_print_msg $WD_GREEN "Warp point removed"
+ local config_tmp=$(mktemp "${TMPDIR:-/tmp}/wd.XXXXXXXXXX")
+ # Copy and delete in two steps in order to preserve symlinks
+ if sed -n "/^${point_name}:.*$/!p" "$WD_CONFIG" > "$config_tmp" && command cp "$config_tmp" "$WD_CONFIG" && command rm "$config_tmp"
+ then
+ wd_print_msg "$WD_GREEN" "Warp point removed"
+ else
+ wd_exit_fail "Something bad happened! Sorry."
+ fi
else
- wd_exit_fail "Something bad happened! Sorry."
+ wd_exit_fail "Warp point was not found"
fi
- else
- wd_exit_fail "Warp point was not found"
- fi
+ done
}
wd_list_all()
{
- wd_print_msg $WD_BLUE "All warp points:"
+ wd_print_msg "$WD_BLUE" "All warp points:"
- entries=$(sed "s:${HOME}:~:g" $WD_CONFIG)
+ entries=$(sed "s:${HOME}:~:g" "$WD_CONFIG")
max_warp_point_length=0
while IFS= read -r line
@@ -232,7 +243,7 @@ wd_list_all()
then
max_warp_point_length=$length
fi
- done <<< $entries
+ done <<< "$entries"
while IFS= read -r line
do
@@ -244,35 +255,35 @@ wd_list_all()
if [[ -z $wd_quiet_mode ]]
then
- printf "%${max_warp_point_length}s -> %s\n" $key $val
+ printf "%${max_warp_point_length}s -> %s\n" "$key" "$val"
fi
fi
- done <<< $entries
+ done <<< "$entries"
}
wd_ls()
{
- wd_getdir $1
- ls ${dir/#\~/$HOME}
+ wd_getdir "$1"
+ ls "${dir/#\~/$HOME}"
}
wd_path()
{
- wd_getdir $1
- echo $(echo $dir | sed "s:${HOME}:~:g")
+ wd_getdir "$1"
+ echo "$(echo "$dir" | sed "s:~:${HOME}:g")"
}
wd_show()
{
local name_arg=$1
# if there's an argument we look up the value
- if [[ ! -z $name_arg ]]
+ if [[ -n $name_arg ]]
then
if [[ -z $points[$name_arg] ]]
then
- wd_print_msg $WD_BLUE "No warp point named $name_arg"
+ wd_print_msg "$WD_BLUE" "No warp point named $name_arg"
else
- wd_print_msg $WD_GREEN "Warp point: ${WD_GREEN}$name_arg${WD_NOC} -> $points[$name_arg]"
+ wd_print_msg "$WD_GREEN" "Warp point: ${WD_GREEN}$name_arg${WD_NOC} -> $points[$name_arg]"
fi
else
# hax to create a local empty array
@@ -280,19 +291,19 @@ wd_show()
wd_matches=()
# do a reverse lookup to check whether PWD is in $points
PWD="${PWD/$HOME/~}"
- if [[ ${points[(r)$PWD]} == $PWD ]]
+ if [[ ${points[(r)$PWD]} == "$PWD" ]]
then
for name in ${(k)points}
do
- if [[ $points[$name] == $PWD ]]
+ if [[ $points[$name] == "$PWD" ]]
then
wd_matches[$(($#wd_matches+1))]=$name
fi
done
- wd_print_msg $WD_BLUE "$#wd_matches warp point(s) to current directory: ${WD_GREEN}$wd_matches${WD_NOC}"
+ wd_print_msg "$WD_BLUE" "$#wd_matches warp point(s) to current directory: ${WD_GREEN}$wd_matches${WD_NOC}"
else
- wd_print_msg $WD_YELLOW "No warp point to $(echo $PWD | sed "s:$HOME:~:")"
+ wd_print_msg "$WD_YELLOW" "No warp point to $(echo "$PWD" | sed "s:$HOME:~:")"
fi
fi
}
@@ -302,7 +313,7 @@ wd_clean() {
local count=0
local wd_tmp=""
- while read line
+ while read -r line
do
if [[ $line != "" ]]
then
@@ -312,29 +323,38 @@ wd_clean() {
if [ -d "${val/#\~/$HOME}" ]
then
- wd_tmp=$wd_tmp"\n"`echo $line`
+ wd_tmp=$wd_tmp"\n"`echo "$line"`
else
- wd_print_msg $WD_YELLOW "Nonexistent directory: ${key} -> ${val}"
+ wd_print_msg "$WD_YELLOW" "Nonexistent directory: ${key} -> ${val}"
count=$((count+1))
fi
fi
- done < $WD_CONFIG
+ done < "$WD_CONFIG"
if [[ $count -eq 0 ]]
then
- wd_print_msg $WD_BLUE "No warp points to clean, carry on!"
+ wd_print_msg "$WD_BLUE" "No warp points to clean, carry on!"
else
- if $force || wd_yesorno "Removing ${count} warp points. Continue? (Y/n)"
+ if [ ! -z "$force" ] || wd_yesorno "Removing ${count} warp points. Continue? (y/n)"
then
- echo $wd_tmp >! $WD_CONFIG
- wd_print_msg $WD_GREEN "Cleanup complete. ${count} warp point(s) removed"
+ echo "$wd_tmp" >! "$WD_CONFIG"
+ wd_print_msg "$WD_GREEN" "Cleanup complete. ${count} warp point(s) removed"
else
- wd_print_msg $WD_BLUE "Cleanup aborted"
+ wd_print_msg "$WD_BLUE" "Cleanup aborted"
fi
fi
}
-local WD_CONFIG=$HOME/.warprc
+wd_export_static_named_directories() {
+ if [[ ! -z $WD_EXPORT ]]
+ then
+ command grep '^[0-9a-zA-Z_-]\+:' "$WD_CONFIG" | sed -e "s,~,$HOME," -e 's/:/=/' | while read -r warpdir ; do
+ hash -d "$warpdir"
+ done
+ fi
+}
+
+local WD_CONFIG=${WD_CONFIG:-$HOME/.warprc}
local WD_QUIET=0
local WD_EXIT_CODE=0
local WD_DEBUG=0
@@ -347,7 +367,8 @@ zparseopts -D -E \
c:=wd_alt_config -config:=wd_alt_config \
q=wd_quiet_mode -quiet=wd_quiet_mode \
v=wd_print_version -version=wd_print_version \
- d=wd_debug_mode -debug=wd_debug_mode
+ d=wd_debug_mode -debug=wd_debug_mode \
+ f=wd_force_mode -force=wd_force_mode
if [[ ! -z $wd_print_version ]]
then
@@ -360,10 +381,12 @@ then
fi
# check if config file exists
-if [ ! -e $WD_CONFIG ]
+if [ ! -e "$WD_CONFIG" ]
then
# if not, create config file
- touch $WD_CONFIG
+ touch "$WD_CONFIG"
+else
+ wd_export_static_named_directories
fi
# load warp points
@@ -376,72 +399,69 @@ do
val=${(j,:,)arr[2,-1]}
points[$key]=$val
-done < $WD_CONFIG
+done < "$WD_CONFIG"
# get opts
-args=$(getopt -o a:r:c:lhs -l add:,rm:,clean\!,list,ls:,path:,help,show -- $*)
+args=$(getopt -o a:r:c:lhs -l add:,rm:,clean,list,ls:,path:,help,show -- $*)
# check if no arguments were given, and that version is not set
if [[ ($? -ne 0 || $#* -eq 0) && -z $wd_print_version ]]
then
wd_print_usage
- # check if config file is writeable
-elif [ ! -w $WD_CONFIG ]
+# check if config file is writeable
+elif [ ! -w "$WD_CONFIG" ]
then
# do nothing
# can't run `exit`, as this would exit the executing shell
wd_exit_fail "\'$WD_CONFIG\' is not writeable."
else
-
# parse rest of options
- for o
+ local wd_o
+ for wd_o
do
- case "$o"
+ case "$wd_o"
in
- -a|--add|add)
- wd_add false $2
+ "-a"|"--add"|"add")
+ wd_add "$2" "$wd_force_mode"
break
;;
- -a!|--add!|add!)
- wd_add true $2
+ "-e"|"export")
+ wd_export_static_named_directories
break
;;
- -r|--remove|rm)
- wd_remove $2
+ "-r"|"--remove"|"rm")
+ # Passes all the arguments as a single string separated by whitespace to wd_remove
+ wd_remove "${@:2}"
break
;;
- -l|list)
+ "-l"|"list")
wd_list_all
break
;;
- -ls|ls)
- wd_ls $2
+ "-ls"|"ls")
+ wd_ls "$2"
break
;;
- -p|--path|path)
- wd_path $2
+ "-p"|"--path"|"path")
+ wd_path "$2"
break
;;
- -h|--help|help)
+ "-h"|"--help"|"help")
wd_print_usage
break
;;
- -s|--show|show)
- wd_show $2
+ "-s"|"--show"|"show")
+ wd_show "$2"
break
;;
- -c|--clean|clean)
- wd_clean false
- break
- ;;
- -c!|--clean!|clean!)
- wd_clean true
+ "-c"|"--clean"|"clean")
+ wd_clean "$wd_force_mode"
break
;;
*)
- wd_warp $o $2
+ wd_warp "$wd_o" "$2"
break
;;
--)
@@ -466,12 +486,14 @@ unset wd_print_usage
unset wd_alt_config
unset wd_quiet_mode
unset wd_print_version
+unset wd_export_static_named_directories
+unset wd_o
unset args
unset points
unset val &> /dev/null # fixes issue #1
-if [[ ! -z $wd_debug_mode ]]
+if [[ -n $wd_debug_mode ]]
then
exit $WD_EXIT_CODE
else
diff --git a/zsh/plugins/web-search/README.md b/zsh/plugins/web-search/README.md
index d040425..da90f90 100644
--- a/zsh/plugins/web-search/README.md
+++ b/zsh/plugins/web-search/README.md
@@ -39,6 +39,9 @@ Available search contexts are:
| `qwant` | `https://www.qwant.com/?q=` |
| `givero` | `https://www.givero.com/search?q=` |
| `stackoverflow` | `https://stackoverflow.com/search?q=` |
+| `wolframalpha` | `https://wolframalpha.com/input?i=` |
+| `archive` | `https://web.archive.org/web/*/` |
+| `scholar` | `https://scholar.google.com/scholar?q=` |
Also there are aliases for bang-searching DuckDuckGo:
@@ -50,3 +53,27 @@ Also there are aliases for bang-searching DuckDuckGo:
| `map` | `!m` |
| `image` | `!i` |
| `ducky` | `!` |
+
+### Custom search engines
+
+If you want to add other search contexts to the plugin, you can use the
+`$ZSH_WEB_SEARCH_ENGINES` variable. Set it before Oh My Zsh is sourced,
+with the following format:
+
+```zsh
+ZSH_WEB_SEARCH_ENGINES=(
+
+
+)
+```
+
+where `` is the name of the search context, and `` a URL of
+the same type as the search contexts above. For example, to add `reddit`,
+you'd do:
+
+```zsh
+ZSH_WEB_SEARCH_ENGINES=(reddit "https://www.reddit.com/search/?q=")
+```
+
+These custom search engines will also be turned to aliases, so you can
+both do `web_search reddit ` or `reddit `.
diff --git a/zsh/plugins/web-search/web-search.plugin.zsh b/zsh/plugins/web-search/web-search.plugin.zsh
index 5b76eea..0a2b880 100644
--- a/zsh/plugins/web-search/web-search.plugin.zsh
+++ b/zsh/plugins/web-search/web-search.plugin.zsh
@@ -6,6 +6,7 @@ function web_search() {
# define search engine URLS
typeset -A urls
urls=(
+ $ZSH_WEB_SEARCH_ENGINES
google "https://www.google.com/search?q="
bing "https://www.bing.com/search?q="
yahoo "https://search.yahoo.com/search?p="
@@ -19,11 +20,14 @@ function web_search() {
qwant "https://www.qwant.com/?q="
givero "https://www.givero.com/search?q="
stackoverflow "https://stackoverflow.com/search?q="
+ wolframalpha "https://www.wolframalpha.com/input/?i="
+ archive "https://web.archive.org/web/*/"
+ scholar "https://scholar.google.com/scholar?q="
)
# check whether the search engine is supported
if [[ -z "$urls[$1]" ]]; then
- echo "Search engine $1 not supported."
+ echo "Search engine '$1' not supported."
return 1
fi
@@ -55,6 +59,9 @@ alias goodreads='web_search goodreads'
alias qwant='web_search qwant'
alias givero='web_search givero'
alias stackoverflow='web_search stackoverflow'
+alias wolframalpha='web_search wolframalpha'
+alias archive='web_search archive'
+alias scholar='web_search scholar'
#add your own !bang searches here
alias wiki='web_search duckduckgo \!w'
@@ -63,3 +70,13 @@ alias youtube='web_search duckduckgo \!yt'
alias map='web_search duckduckgo \!m'
alias image='web_search duckduckgo \!i'
alias ducky='web_search duckduckgo \!'
+
+# other search engine aliases
+if [[ ${#ZSH_WEB_SEARCH_ENGINES} -gt 0 ]]; then
+ typeset -A engines
+ engines=($ZSH_WEB_SEARCH_ENGINES)
+ for key in ${(k)engines}; do
+ alias "$key"="web_search $key"
+ done
+ unset engines key
+fi
diff --git a/zsh/plugins/yarn/README.md b/zsh/plugins/yarn/README.md
index 671a272..fd748b7 100644
--- a/zsh/plugins/yarn/README.md
+++ b/zsh/plugins/yarn/README.md
@@ -11,29 +11,36 @@ plugins=(... yarn)
## Aliases
-| Alias | Command | Description |
-|-------|-------------------------------------------|-------------------------------------------------------------|
-| y | `yarn` | The Yarn command |
-| ya | `yarn add` | Install a package in dependencies (`package.json`) |
-| yad | `yarn add --dev` | Install a package in devDependencies (`package.json`) |
-| yap | `yarn add --peer` | Install a package in peerDependencies (`package.json`) |
-| yb | `yarn build` | Run the build script defined in `package.json` |
-| ycc | `yarn cache clean` | Clean yarn's global cache of packages |
-| yga | `yarn global add` | Install packages globally on your operating system |
-| ygls | `yarn global list` | Lists global installed packages |
-| ygrm | `yarn global remove` | Remove global installed packages from your OS |
-| ygu | `yarn global upgrade` | Upgrade packages installed globally to their latest version |
-| yh | `yarn help` | Show help for a yarn command |
-| yi | `yarn init` | Interactively creates or updates a package.json file |
-| yin | `yarn install` | Install dependencies defined in `package.json` |
-| yls | `yarn list` | List installed packages |
-| yout | `yarn outdated` | Check for outdated package dependencies |
-| yp | `yarn pack` | Create a compressed gzip archive of package dependencies |
-| yrm | `yarn remove` | Remove installed packages |
-| yrun | `yarn run` | Run a defined package script |
-| ys | `yarn serve` | Start the dev server |
-| yst | `yarn start` | Run the start script defined in `package.json` |
-| yt | `yarn test` | Run the test script defined in `package.json` |
-| yuc | `yarn global upgrade && yarn cache clean` | Upgrade global packages and clean yarn's global cache |
-| yui | `yarn upgrade-interactive` | Prompt for which outdated packages to upgrade |
-| yup | `yarn upgrade` | Upgrade packages to their latest version |
+| Alias | Command | Description |
+| ----- | ----------------------------------------- | ----------------------------------------------------------------------------- |
+| y | `yarn` | The Yarn command |
+| ya | `yarn add` | Install a package in dependencies (`package.json`) |
+| yad | `yarn add --dev` | Install a package in devDependencies (`package.json`) |
+| yap | `yarn add --peer` | Install a package in peerDependencies (`package.json`) |
+| yb | `yarn build` | Run the build script defined in `package.json` |
+| ycc | `yarn cache clean` | Clean yarn's global cache of packages |
+| yd | `yarn dev` | Run the dev script defined in `package.json` |
+| yga | `yarn global add` | Install packages globally on your operating system |
+| ygls | `yarn global list` | Lists global installed packages |
+| ygrm | `yarn global remove` | Remove global installed packages from your OS |
+| ygu | `yarn global upgrade` | Upgrade packages installed globally to their latest version |
+| yh | `yarn help` | Show help for a yarn command |
+| yi | `yarn init` | Interactively creates or updates a package.json file |
+| yin | `yarn install` | Install dependencies defined in `package.json` |
+| yln | `yarn lint` | Run the lint script defined in `package.json` |
+| yls | `yarn list` | List installed packages |
+| yout | `yarn outdated` | Check for outdated package dependencies |
+| yp | `yarn pack` | Create a compressed gzip archive of package dependencies |
+| yrm | `yarn remove` | Remove installed packages |
+| yrun | `yarn run` | Run a defined package script |
+| ys | `yarn serve` | Start the dev server |
+| yst | `yarn start` | Run the start script defined in `package.json` |
+| yt | `yarn test` | Run the test script defined in `package.json` |
+| ytc | `yarn test --coverage` | Run the test script defined in `package.json` with coverage |
+| yuc | `yarn global upgrade && yarn cache clean` | Upgrade global packages and clean yarn's global cache |
+| yui | `yarn upgrade-interactive` | Prompt for which outdated packages to upgrade |
+| yuil | `yarn upgrade-interactive --latest` | Prompt for which outdated packages to upgrade to the latest available version |
+| yup | `yarn upgrade` | Upgrade packages to their latest version |
+| yv | `yarn version` | Update the version of your package |
+| yw | `yarn workspace` | Run a command within a single workspace. |
+| yws | `yarn workspaces` | Run a command within all defined workspaces. |
diff --git a/zsh/plugins/yarn/_yarn b/zsh/plugins/yarn/_yarn
index 382f58a..70e783b 100644
--- a/zsh/plugins/yarn/_yarn
+++ b/zsh/plugins/yarn/_yarn
@@ -71,7 +71,7 @@ _global_commands=(
'bin:Displays the location of the yarn bin folder'
'remove:Remove installed package from dependencies updating package.json'
'upgrade:Upgrades packages to their latest version based on the specified range'
- 'upgrade-interactive'
+ 'upgrade-interactive:Interactively upgrade packages'
)
_yarn_commands_scripts() {
@@ -81,9 +81,23 @@ _yarn_commands_scripts() {
}
_yarn_scripts() {
- local -a scripts
- scripts=($(yarn run --json 2>/dev/null | sed -E '/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n' | sed -e 's/:/\\:/g'))
- _describe 'script' scripts
+ local -a commands binaries scripts
+ local -a scriptNames scriptCommands
+ local i runJSON
+
+ runJSON=$(yarn run --json 2>/dev/null)
+ # Some sed utilities (e.g. Mac OS / BSD) don't interpret `\n` in a replacement
+ # pattern as a newline. See https://superuser.com/q/307165
+ binaries=($(sed -E '/Commands available/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\'$'\n/g' <<< "$runJSON"))
+ scriptNames=($(sed -E '/possibleCommands/!d;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\'$'\n/g' <<< "$runJSON"))
+ scriptCommands=("${(@f)$(sed -E '/possibleCommands/!d;s/.*"hints":\{(.+")\}.*/\1/;s/"[^"]+"://g;s/:/\\:/g;s/","/\'$'\n/g;s/(^"|"$)//g' <<< "$runJSON")}")
+
+ for (( i=1; i <= $#scriptNames; i++ )); do
+ scripts+=("${scriptNames[$i]}:${scriptCommands[$i]}")
+ done
+
+ commands=($scripts $binaries)
+ _describe 'command' commands
}
_yarn_global_commands() {
@@ -240,7 +254,8 @@ _yarn() {
run)
_arguments \
- '1: :_yarn_scripts'
+ '1: :_yarn_scripts' \
+ '*:: :_default'
;;
tag)
@@ -255,6 +270,11 @@ _yarn() {
'*:: :->team_args'
;;
+ upgrade-interactive)
+ _arguments \
+ '--latest:use the version tagged latest in the registry:'
+ ;;
+
version)
_arguments \
'--new-version:version:' \
@@ -266,6 +286,10 @@ _yarn() {
_arguments \
'1:query:_files'
;;
+
+ *)
+ _default
+ ;;
esac
;;
esac
diff --git a/zsh/plugins/yarn/yarn.plugin.zsh b/zsh/plugins/yarn/yarn.plugin.zsh
index 9ed8322..4a5192c 100644
--- a/zsh/plugins/yarn/yarn.plugin.zsh
+++ b/zsh/plugins/yarn/yarn.plugin.zsh
@@ -4,6 +4,7 @@ alias yad="yarn add --dev"
alias yap="yarn add --peer"
alias yb="yarn build"
alias ycc="yarn cache clean"
+alias yd="yarn dev"
alias yga="yarn global add"
alias ygls="yarn global list"
alias ygrm="yarn global remove"
@@ -11,6 +12,7 @@ alias ygu="yarn global upgrade"
alias yh="yarn help"
alias yi="yarn init"
alias yin="yarn install"
+alias yln="yarn lint"
alias yls="yarn list"
alias yout="yarn outdated"
alias yp="yarn pack"
@@ -19,6 +21,11 @@ alias yrun="yarn run"
alias ys="yarn serve"
alias yst="yarn start"
alias yt="yarn test"
+alias ytc="yarn test --coverage"
alias yuc="yarn global upgrade && yarn cache clean"
alias yui="yarn upgrade-interactive"
+alias yuil="yarn upgrade-interactive --latest"
alias yup="yarn upgrade"
+alias yv="yarn version"
+alias yw="yarn workspace"
+alias yws="yarn workspaces"
diff --git a/zsh/plugins/yii/README.md b/zsh/plugins/yii/README.md
new file mode 100644
index 0000000..9636149
--- /dev/null
+++ b/zsh/plugins/yii/README.md
@@ -0,0 +1,15 @@
+# Yii plugin
+
+The plugin adds autocomplete commands and subcommands for [yii](https://www.yiiframework.com/).
+
+To use it, add `yii` to the plugins array of your zshrc file:
+
+```zsh
+plugins=(... yii)
+```
+
+## Aliases
+
+| Alias | Command |
+|--------|----------------------|
+| yiic | `protected/yiic` |
diff --git a/zsh/plugins/yii2/yii2.plugin.zsh b/zsh/plugins/yii2/yii2.plugin.zsh
index e8993ad..713f2ef 100644
--- a/zsh/plugins/yii2/yii2.plugin.zsh
+++ b/zsh/plugins/yii2/yii2.plugin.zsh
@@ -26,4 +26,4 @@ _yii2 () {
fi
}
-compdef _yii2 yii
\ No newline at end of file
+compdef _yii2 yii
diff --git a/zsh/plugins/yum/README.md b/zsh/plugins/yum/README.md
index 8043421..fec5849 100644
--- a/zsh/plugins/yum/README.md
+++ b/zsh/plugins/yum/README.md
@@ -4,7 +4,7 @@ This plugin adds useful aliases for common [Yum](http://yum.baseurl.org/) comman
To use it, add `yum` to the plugins array in your zshrc file:
-```
+```zsh
plugins=(... yum)
```
diff --git a/zsh/plugins/z/README b/zsh/plugins/z/README
index 56261cf..47e54c5 100644
--- a/zsh/plugins/z/README
+++ b/zsh/plugins/z/README
@@ -23,6 +23,8 @@ DESCRIPTION
OPTIONS
-c restrict matches to subdirectories of the current directory
+ -e echo the best match, don't cd
+
-h show a brief help message
-l list only
@@ -57,6 +59,8 @@ NOTES
Optionally:
Set $_Z_CMD to change the command name (default z).
Set $_Z_DATA to change the datafile (default $HOME/.z).
+ Set $_Z_MAX_SCORE lower to age entries out faster (default
+ 9000).
Set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution.
Set $_Z_NO_PROMPT_COMMAND to handle PROMPT_COMMAND/precmd your-
self.
@@ -64,8 +68,8 @@ NOTES
Set $_Z_OWNER to allow usage when in 'sudo -s' mode.
(These settings should go in .bashrc/.zshrc before the line
added above.)
- Install the provided man page z.1 somewhere like
- /usr/local/man/man1.
+ Install the provided man page z.1 somewhere in your MANPATH,
+ like /usr/local/man/man1.
Aging:
The rank of directories maintained by z undergoes aging based on a sim-
diff --git a/zsh/plugins/z/README.md b/zsh/plugins/z/README.md
new file mode 100644
index 0000000..ea8d461
--- /dev/null
+++ b/zsh/plugins/z/README.md
@@ -0,0 +1,23 @@
+# z - jump around
+
+This plugin defines the [z command](https://github.com/rupa/z) that tracks your most visited directories and allows you to access them with very few keystrokes.
+
+### Example
+Assume that you have previously visited directory `~/.oh-my-zsh/plugins`. From any folder in your command line, you can quickly access it by using a regex match to this folder:
+
+```bash
+/usr/bin$ z plug # Even 'z p' might suffice
+~/.oh-my-zsh/plugins$
+```
+
+### Setup
+To enable z, add `z` to your `plugins` array in your zshrc file:
+
+```zsh
+plugins=(... z)
+```
+
+### Further reading
+
+For advanced usage and details of z, see [README](./README) (in man page format, copied from [rupa/z](https://github.com/rupa/z)).
+
diff --git a/zsh/plugins/z/z.1 b/zsh/plugins/z/z.1
index d4cac1a..182f981 100644
--- a/zsh/plugins/z/z.1
+++ b/zsh/plugins/z/z.1
@@ -78,6 +78,9 @@ Set \fB$_Z_CMD\fR to change the command name (default \fBz\fR).
Set \fB$_Z_DATA\fR to change the datafile (default \fB$HOME/.z\fR).
.RE
.RS
+Set \fB$_Z_MAX_SCORE\fR lower to age entries out faster (default \fB9000\fR).
+.RE
+.RS
Set \fB$_Z_NO_RESOLVE_SYMLINKS\fR to prevent symlink resolution.
.RE
.RS
diff --git a/zsh/plugins/z/z.sh b/zsh/plugins/z/z.sh
index 5c5771d..13008a6 100644
--- a/zsh/plugins/z/z.sh
+++ b/zsh/plugins/z/z.sh
@@ -10,6 +10,7 @@
# * optionally:
# set $_Z_CMD in .bashrc/.zshrc to change the command (default z).
# set $_Z_DATA in .bashrc/.zshrc to change the datafile (default ~/.z).
+# set $_Z_MAX_SCORE lower to age entries out faster (default 9000).
# set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution.
# set $_Z_NO_PROMPT_COMMAND if you're handling PROMPT_COMMAND yourself.
# set $_Z_EXCLUDE_DIRS to an array of directories to exclude.
@@ -23,6 +24,8 @@
# * z -l foo # list matches instead of cd
# * z -e foo # echo the best match, don't cd
# * z -c foo # restrict matches to subdirs of $PWD
+# * z -x # remove the current directory from the datafile
+# * z -h # show a brief help message
[ -d "${_Z_DATA:-$HOME/.z}" ] && {
echo "ERROR: z.sh's datafile (${_Z_DATA:-$HOME/.z}) is a directory."
@@ -62,7 +65,8 @@ _z() {
# maintain the data file
local tempfile="$datafile.$RANDOM"
- _z_dirs | awk -v path="$*" -v now="$(date +%s)" -F"|" '
+ local score=${_Z_MAX_SCORE:-9000}
+ _z_dirs | awk -v path="$*" -v now="$(date +%s)" -v score=$score -F"|" '
BEGIN {
rank[path] = 1
time[path] = now
@@ -79,7 +83,7 @@ _z() {
count += $2
}
END {
- if( count > 9000 ) {
+ if( count > score ) {
# aging
for( x in rank ) print x "|" 0.99*rank[x] "|" time[x]
} else for( x in rank ) print x "|" rank[x] "|" time[x]
@@ -138,27 +142,24 @@ _z() {
local cd
cd="$( < <( _z_dirs ) awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" '
function frecent(rank, time) {
- # relate frequency and time
- dx = t - time
- if( dx < 3600 ) return rank * 4
- if( dx < 86400 ) return rank * 2
- if( dx < 604800 ) return rank / 2
- return rank / 4
+ # relate frequency and time
+ dx = t - time
+ return int(10000 * rank * (3.75/((0.0001 * dx + 1) + 0.25)))
}
function output(matches, best_match, common) {
# list or return the desired directory
if( list ) {
- cmd = "sort -g >&2"
+ if( common ) {
+ printf "%-10s %s\n", "common:", common > "/dev/stderr"
+ }
+ cmd = "sort -n >&2"
for( x in matches ) {
if( matches[x] ) {
printf "%-10s %s\n", matches[x], x | cmd
}
}
- if( common ) {
- printf "%-10s %s\n", "common:", common > "/dev/stderr"
- }
} else {
- if( common ) best_match = common
+ if( common && !typ ) best_match = common
print best_match
}
}
@@ -200,15 +201,22 @@ _z() {
# prefer case sensitive
if( best_match ) {
output(matches, best_match, common(matches))
+ exit
} else if( ibest_match ) {
output(imatches, ibest_match, common(imatches))
+ exit
}
+ exit(1)
}
')"
- [ $? -eq 0 ] && [ "$cd" ] && {
- if [ "$echo" ]; then echo "$cd"; else builtin cd "$cd"; fi
- }
+ if [ "$?" -eq 0 ]; then
+ if [ "$cd" ]; then
+ if [ "$echo" ]; then echo "$cd"; else builtin cd "$cd"; fi
+ fi
+ else
+ return $?
+ fi
fi
}
@@ -223,15 +231,11 @@ if type compctl >/dev/null 2>&1; then
if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then
_z_precmd() {
(_z --add "${PWD:a}" &)
- # Reference $RANDOM to refresh its value inside the subshell
- # Otherwise, multiple runs get the same value
: $RANDOM
}
else
_z_precmd() {
(_z --add "${PWD:A}" &)
- # Reference $RANDOM to refresh its value inside the subshell
- # Otherwise, multiple runs get the same value
: $RANDOM
}
fi
diff --git a/zsh/plugins/zeus/README.md b/zsh/plugins/zeus/README.md
index 4518800..0131f70 100644
--- a/zsh/plugins/zeus/README.md
+++ b/zsh/plugins/zeus/README.md
@@ -1,56 +1,50 @@
-## zeus
-**Maintainer:** [b4mboo](https://github.com/b4mboo)
+# zeus plugin
-* `zi` aliases `zeus init`
-* `zinit` aliases `zeus init`
+[Zeus](https://github.com/burke/zeus) preloads your Rails environment and forks that
+process whenever needed. This effectively speeds up Rails' boot process to under 1 sec.
+This plugin adds autocompletion for zeus and aliases for common usage.
-* `zs` aliases `zeus start`
-* `ztart` aliases `zeus start`
+To use it, add `zeus` to the plugins array in your zshrc file:
-* `zc` aliases `zeus console`
-* `zonsole` aliases `zeus console`
+```zsh
+plugins=(... zeus)
+```
-* `zsr` aliases `zeus server`
-* `zerver` aliases `zeus server`
+You also need to have the `zeus` gem installed.
-* `zr` aliases `zeus rake`
-* `zake` aliases `zeus rake`
-
-* `zg` aliases `zeus generate`
-* `zenerate` aliases `zeus generate`
-
-* `zrn` aliases `zeus runner`
-* `zunner` aliases `zeus runner`
-
-* `zcu` aliases `zeus cucumber`
-* `zucumber` aliases `zeus cucumber`
-
-* `zspec` aliases `zeus rspec`
-
-* `zt` aliases `zeus test`
-* `zest` aliases `zeus test`
-
-* `zu` aliases `zeus test test/unit/*`
-* `zunits` aliases `zeus test test/unit/*`
-
-* `zf` aliases `zeus test test/functional/*`
-* `zunctional` aliases `zeus test test/functional/*`
-
-* `za` aliases `zeus test test/unit/*; zeus test test/functional/; zeus cucumber`
-* `zall` aliases `zeus test test/unit/*; zeus test test/functional/; zeus cucumber`
-
-* `zsw` aliases `rm .zeus.sock`
-* `zweep` aliases `rm .zeus.sock`
-
-* `zdbr` aliases `zeus rake db:reset db:test:prepare`
-* `zdbreset` aliases `zeus rake db:reset db:test:prepare`
-
-* `zdbm` aliases `zeus rake db:migrate db:test:prepare`
-* `zdbmigrate` aliases `zeus rake db:migrate db:test:prepare`
-
-* `zdbc` aliases `zeus rake db:create`
-
-* `zdbcm` aliases `zeus rake db:create db:migrate db:test:prepare`
-
-## Installation
-Add zeus to the plugins line of your `.zshconfig` file (e.g. `plugins=(rails git zeus)`)
+| Alias | Command |
+|:-------------|:-------------------------------------------------------------------|
+| _zi_ | `zeus init` |
+| _zinit_ | `zeus init` |
+| _zs_ | `zeus start` |
+| _ztart_ | `zeus start` |
+| _zc_ | `zeus console` |
+| _zonsole_ | `zeus console` |
+| _zsr_ | `zeus server` |
+| _zerver_ | `zeus server` |
+| _zr_ | `noglob zeus rake` |
+| _zake_ | `noglob zeus rake` |
+| _zg_ | `zeus generate` |
+| _zenerate_ | `zeus generate` |
+| _zrn_ | `zeus runner` |
+| _zunner_ | `zeus runner` |
+| _zcu_ | `zeus cucumber` |
+| _zucumber_ | `zeus cucumber` |
+| _zwip_ | `zeus cucumber --profile wip` |
+| _zspec_ | `zeus rspec` |
+| _zt_ | `zeus test` |
+| _zest_ | `zeus test` |
+| _zu_ | `zeus test test/unit/*` |
+| _zunits_ | `zeus test test/unit/*` |
+| _zf_ | `zeus test test/functional/*` |
+| _zunctional_ | `zeus test test/functional/*` |
+| _za_ | `zeus test test/unit/*; zeus test test/functional/; zeus cucumber` |
+| _zall_ | `zeus test test/unit/*; zeus test test/functional/; zeus cucumber` |
+| _zsw_ | `rm .zeus.sock` |
+| _zweep_ | `rm .zeus.sock` |
+| _zdbr_ | `zeus rake db:reset db:test:prepare` |
+| _zdbreset_ | `zeus rake db:reset db:test:prepare` |
+| _zdbm_ | `zeus rake db:migrate db:test:prepare` |
+| _zdbmigrate_ | `zeus rake db:migrate db:test:prepare` |
+| _zdbc_ | `zeus rake db:create` |
+| _zdbcm_ | `zeus rake db:create db:migrate db:test:prepare` |
diff --git a/zsh/plugins/zeus/zeus.plugin.zsh b/zsh/plugins/zeus/zeus.plugin.zsh
index 0c01083..5dec1a4 100644
--- a/zsh/plugins/zeus/zeus.plugin.zsh
+++ b/zsh/plugins/zeus/zeus.plugin.zsh
@@ -33,6 +33,7 @@ alias zunner='zeus runner'
# Cucumber
alias zcu='zeus cucumber'
alias zucumber='zeus cucumber'
+alias zwip='zeus cucumber --profile wip'
# Rspec
alias zspec='zeus rspec'
diff --git a/zsh/plugins/zsh-interactive-cd/README.md b/zsh/plugins/zsh-interactive-cd/README.md
new file mode 100644
index 0000000..c8337fb
--- /dev/null
+++ b/zsh/plugins/zsh-interactive-cd/README.md
@@ -0,0 +1,23 @@
+# zsh-interactive-cd
+
+This plugin adds a fish-like interactive tab completion for the `cd` command.
+
+To use it, add `zsh-interactive-cd` to the plugins array of your zshrc file:
+```zsh
+plugins=(... zsh-interactive-cd)
+```
+
+
+
+## Usage
+
+Press tab for completion as usual, it'll launch fzf automatically. Check fzf’s [readme](https://github.com/junegunn/fzf#search-syntax) for more search syntax usage.
+
+## Requirements
+
+This plugin requires [fzf](https://github.com/junegunn/fzf). Install it by following
+its [installation instructions](https://github.com/junegunn/fzf#installation).
+
+## Author
+
+[Henry Chang](https://github.com/changyuheng)
diff --git a/zsh/plugins/zsh-interactive-cd/zsh-interactive-cd.plugin.zsh b/zsh/plugins/zsh-interactive-cd/zsh-interactive-cd.plugin.zsh
new file mode 100644
index 0000000..b0520c2
--- /dev/null
+++ b/zsh/plugins/zsh-interactive-cd/zsh-interactive-cd.plugin.zsh
@@ -0,0 +1,148 @@
+# Copyright (c) 2017 Henry Chang
+
+__zic_fzf_prog() {
+ [ -n "$TMUX_PANE" ] && [ "${FZF_TMUX:-0}" != 0 ] && [ ${LINES:-40} -gt 15 ] \
+ && echo "fzf-tmux -d${FZF_TMUX_HEIGHT:-40%}" || echo "fzf"
+}
+
+__zic_matched_subdir_list() {
+ local dir length seg starts_with_dir
+ if [[ "$1" == */ ]]; then
+ dir="$1"
+ if [[ "$dir" != / ]]; then
+ dir="${dir: : -1}"
+ fi
+ length=$(echo -n "$dir" | wc -c)
+ if [ "$dir" = "/" ]; then
+ length=0
+ fi
+ find -L "$dir" -mindepth 1 -maxdepth 1 -type d 2>/dev/null \
+ | cut -b $(( ${length} + 2 ))- | sed '/^$/d' | while read -r line; do
+ if [[ "${line[1]}" == "." ]]; then
+ continue
+ fi
+ echo "$line"
+ done
+ else
+ dir=$(dirname -- "$1")
+ length=$(echo -n "$dir" | wc -c)
+ if [ "$dir" = "/" ]; then
+ length=0
+ fi
+ seg=$(basename -- "$1")
+ starts_with_dir=$( \
+ find -L "$dir" -mindepth 1 -maxdepth 1 -type d \
+ 2>/dev/null | cut -b $(( ${length} + 2 ))- | sed '/^$/d' \
+ | while read -r line; do
+ if [[ "${seg[1]}" != "." && "${line[1]}" == "." ]]; then
+ continue
+ fi
+ if [[ "$line" == "$seg"* ]]; then
+ echo "$line"
+ fi
+ done
+ )
+ if [ -n "$starts_with_dir" ]; then
+ echo "$starts_with_dir"
+ else
+ find -L "$dir" -mindepth 1 -maxdepth 1 -type d \
+ 2>/dev/null | cut -b $(( ${length} + 2 ))- | sed '/^$/d' \
+ | while read -r line; do
+ if [[ "${seg[1]}" != "." && "${line[1]}" == "." ]]; then
+ continue
+ fi
+ if [[ "$line" == *"$seg"* ]]; then
+ echo "$line"
+ fi
+ done
+ fi
+ fi
+}
+
+_zic_list_generator() {
+ __zic_matched_subdir_list "${(Q)@[-1]}" | sort
+}
+
+_zic_complete() {
+ setopt localoptions nonomatch
+ local l matches fzf tokens base
+
+ l=$(_zic_list_generator $@)
+
+ if [ -z "$l" ]; then
+ zle ${__zic_default_completion:-expand-or-complete}
+ return
+ fi
+
+ fzf=$(__zic_fzf_prog)
+
+ if [ $(echo $l | wc -l) -eq 1 ]; then
+ matches=${(q)l}
+ else
+ matches=$(echo $l \
+ | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} \
+ --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS \
+ --bind 'shift-tab:up,tab:down'" ${=fzf} \
+ | while read -r item; do
+ echo -n "${(q)item} "
+ done)
+ fi
+
+ matches=${matches% }
+ if [ -n "$matches" ]; then
+ tokens=(${(z)LBUFFER})
+ base="${(Q)@[-1]}"
+ if [[ "$base" != */ ]]; then
+ if [[ "$base" == */* ]]; then
+ base="$(dirname -- "$base")"
+ if [[ ${base[-1]} != / ]]; then
+ base="$base/"
+ fi
+ else
+ base=""
+ fi
+ fi
+ LBUFFER="${tokens[1]} "
+ if [ -n "$base" ]; then
+ base="${(q)base}"
+ if [ "${tokens[2][1]}" = "~" ]; then
+ base="${base/#$HOME/~}"
+ fi
+ LBUFFER="${LBUFFER}${base}"
+ fi
+ LBUFFER="${LBUFFER}${matches}/"
+ fi
+ zle redisplay
+ typeset -f zle-line-init >/dev/null && zle zle-line-init
+}
+
+zic-completion() {
+ setopt localoptions noshwordsplit noksh_arrays noposixbuiltins
+ local tokens cmd
+
+ tokens=(${(z)LBUFFER})
+ cmd=${tokens[1]}
+
+ if [[ "$LBUFFER" =~ "^\ *cd$" ]]; then
+ zle ${__zic_default_completion:-expand-or-complete}
+ elif [ "$cmd" = cd ]; then
+ _zic_complete ${tokens[2,${#tokens}]/#\~/$HOME}
+ else
+ zle ${__zic_default_completion:-expand-or-complete}
+ fi
+}
+
+[ -z "$__zic_default_completion" ] && {
+ binding=$(bindkey '^I')
+ # $binding[(s: :w)2]
+ # The command substitution and following word splitting to determine the
+ # default zle widget for ^I formerly only works if the IFS parameter contains
+ # a space via $binding[(w)2]. Now it specifically splits at spaces, regardless
+ # of IFS.
+ [[ $binding =~ 'undefined-key' ]] || __zic_default_completion=$binding[(s: :w)2]
+ unset binding
+}
+
+zle -N zic-completion
+bindkey -M emacs '^I' zic-completion
+bindkey -M viins '^I' zic-completion
diff --git a/zsh/plugins/zsh-navigation-tools/LICENSE b/zsh/plugins/zsh-navigation-tools/LICENSE
index 4ee0281..075c80c 100644
--- a/zsh/plugins/zsh-navigation-tools/LICENSE
+++ b/zsh/plugins/zsh-navigation-tools/LICENSE
@@ -27,7 +27,7 @@ GPLv3 License
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -671,7 +671,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
@@ -690,11 +690,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
- .
+ .
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
-.
+.
diff --git a/zsh/plugins/zsh-navigation-tools/Makefile b/zsh/plugins/zsh-navigation-tools/Makefile
new file mode 100644
index 0000000..f34af0c
--- /dev/null
+++ b/zsh/plugins/zsh-navigation-tools/Makefile
@@ -0,0 +1,35 @@
+NAME=zsh-navigation-tools
+
+INSTALL?=install -c
+PREFIX?=/usr/local
+SHARE_DIR?=$(DESTDIR)$(PREFIX)/share/$(NAME)
+DOC_DIR?=$(DESTDIR)$(PREFIX)/share/doc/$(NAME)
+
+all:
+
+install:
+ $(INSTALL) -d $(SHARE_DIR)
+ $(INSTALL) -d $(SHARE_DIR)/.config
+ $(INSTALL) -d $(SHARE_DIR)/.config/znt
+ $(INSTALL) -d $(DOC_DIR)
+ cp zsh-navigation-tools.plugin.zsh _n-kill doc/znt-tmux.zsh $(SHARE_DIR)
+ cp README.md NEWS LICENSE doc/img/n-history2.png $(DOC_DIR)
+ if [ x"true" = x"`git rev-parse --is-inside-work-tree 2>/dev/null`" ]; then \
+ git rev-parse HEAD; \
+ else \
+ cat .revision-hash; \
+ fi > $(SHARE_DIR)/.revision-hash
+ :
+ for fname in n-*; do cp "$$fname" $(SHARE_DIR); done; \
+ for fname in znt-*; do cp "$$fname" $(SHARE_DIR); done; \
+ for fname in .config/znt/n-*; do cp "$$fname" $(SHARE_DIR)/.config/znt; done;
+
+uninstall:
+ rm -f $(SHARE_DIR)/.revision-hash $(SHARE_DIR)/_* $(SHARE_DIR)/zsh-* $(SHARE_DIR)/n-* $(SHARE_DIR)/znt-* $(SHARE_DIR)/.config/znt/n-*
+ [ -d $(SHARE_DIR)/.config/znt ] && rmdir $(SHARE_DIR)/.config/znt || true
+ [ -d $(SHARE_DIR)/.config ] && rmdir $(SHARE_DIR)/.config || true
+ [ -d $(SHARE_DIR) ] && rmdir $(SHARE_DIR) || true
+ rm -f $(DOC_DIR)/README.md $(DOC_DIR)/LICENSE $(DOC_DIR)/n-history2.png
+ [ -d $(DOC_DIR) ] && rmdir $(DOC_DIR) || true
+
+.PHONY: all install uninstall
diff --git a/zsh/plugins/zsh-navigation-tools/README.md b/zsh/plugins/zsh-navigation-tools/README.md
index ed532a1..7d2ce99 100644
--- a/zsh/plugins/zsh-navigation-tools/README.md
+++ b/zsh/plugins/zsh-navigation-tools/README.md
@@ -1,58 +1,68 @@
+[](./LICENSE)
+[](./LICENSE)
+
+
+
+
+[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=D6XDCHDSBDSDG)
+
# Zsh Navigation Tools
-https://raw.githubusercontent.com/psprint/zsh-navigation-tools/master/doc/img/n-history2.png
+Also check out [ Zsh Command Architect](https://github.com/psprint/zsh-cmd-architect)
+and [Zconvey](https://github.com/psprint/zconvey)
-Set of tools like n-history – multi-word history searcher, n-cd – directory
-bookmark manager, n-kill – htop like kill utility, and more. Based on
-n-list, a tool generating selectable curses-based list of elements that has
-access to current Zsh session, i.e. has broad capabilities to work together
-with it. Feature highlights include incremental multi-word searching, ANSI
-coloring, unique mode, horizontal scroll, non-selectable elements, grepping and
-various integrations with Zsh.
-## History Widget
-To have n-history as multi-word incremental searcher bound to Ctrl-R copy znt-*
-files into the */site-functions dir (unless you use Oh My Zsh) and
-add:
+Videos:
+- [https://youtu.be/QwZ8IJEgXRE](https://youtu.be/QwZ8IJEgXRE)
+- [https://youtu.be/DN9QqssAYB8](https://youtu.be/DN9QqssAYB8)
- autoload znt-history-widget
- zle -N znt-history-widget
- bindkey "^R" znt-history-widget
+Screenshots:
-to .zshrc. This is done automatically when using Oh My Zsh. Two other
-widgets exist, znt-cd-widget and znt-kill-widget, they can be too assigned
-to key combinations (no need for autoload when using Oh My Zsh):
+
- zle -N znt-cd-widget
- bindkey "^A" znt-cd-widget
- zle -N znt-kill-widget
- bindkey "^Y" znt-kill-widget
+
-Oh My Zsh stores history into ~/.zsh_history. When you switch to OMZ you could
-want to copy your previous data (from e.g. ~/.zhistory) into the new location.
+Set of tools like `n-history` – multi-word history searcher, `n-cd` – directory
+bookmark manager, `n-kill` – `htop` like kill utility, and more. Based on
+`n-list`, a tool generating selectable curses-based list of elements that has
+access to current `Zsh` session, i.e. has broad capabilities to work together
+with it. Feature highlights include incremental multi-word searching, approximate
+matching, ANSI coloring, themes, unique mode, horizontal scroll, grepping, advanced
+history management and various integrations with `Zsh`.
## News
-
* 06-10-2016
- - Tmux-integration – Ctrl-b-h in Tmux to open n-history in new window.
+ - **Tmux-integration** – `Ctrl-B H` in Tmux to open `n-history` in new window.
Then select history entry, it will be copied to the original Tmux window.
- Use this to execute local commands on remote hosts. All that is needed is
- this line added to ~/.tmux.conf:
+ Use this to execute local commands on remote hosts:
+ 
+
+ All that is needed is this line added to `~/.tmux.conf`:
+
+ ```
+ bind h run-shell -b "$ZNT_REPO_DIR/doc/znt-tmux.zsh"
+ ```
+
+ or – if Homebrew or other package manager is used:
+
+ ```
bind h run-shell -b "$ZNT_REPO_DIR/znt-tmux.zsh"
+ ```
* 16-05-2016
- - n-kill has completion. It proposes *words* from what's in `ps -A`. Giving n-kill
+ - `n-kill` has completion. It proposes **words** from what's in `ps -A`. Giving `n-kill`
arguments means grepping – it will start only with matching `ps` entries.
* 15-05-2016
- - Fixed problem where zsh-syntax-highlighting could render n-history slow (for
+ - Fixed problem where zsh-syntax-highlighting could render `n-history` slow (for
long history entries).
* 14-05-2016
- - Configuration can be set from zshrc. Example:
+ - Configuration can be set from `zshrc` (starting from `v2.1.12`). Documentation is [below](#configuration). Example:
+ ```zsh
znt_list_instant_select=1
znt_list_border=0
znt_list_bold=1
@@ -63,76 +73,197 @@ want to copy your previous data (from e.g. ~/.zhistory) into the new location.
znt_cd_hotlist=( "~/.config/znt" "/usr/share/zsh/site-functions" "/usr/share/zsh"
"/usr/local/share/zsh/site-functions" "/usr/local/share/zsh"
"/usr/local/bin" )
+ ```
* 10-05-2016
- - Search query rotation – use Ctrl-A to rotate entered words right.
+ - Search query rotation – use `Ctrl-A` to rotate entered words right.
Words `1 2 3` become `3 1 2`.
* 09-05-2016
- - New feature: n-help tool, available also from n-history via H key. It
- displays help screen with various information on ZNT.
+ - New feature: n-help tool, available also from n-history via `H` key. It
+ displays help screen with various information on `ZNT`.
+
+ 
* 08-05-2016
- - Approximate matching – pressing f or Ctrl-F will enter FIX mode, in
- which 1 or 2 errors are allowed in what is searched. This utilizes
+ - Approximate matching – pressing `f` or `Ctrl-F` will enter "`FIX`" mode,
+ in which `1` or `2` errors are allowed in what's searched. This utilizes
original Zsh approximate matching features and is intended to be used
after entering search query, when a typo is discovered.
+ 
+
* 06-05-2016
- - Private history can be edited. Use e key or Ctrl-E for that when in
- n-history. Your $EDITOR will start. This is a way to have handy set
- of bookmarks prepared in private history's file.
- - Border can be disabled. Use following snippet in ~/.config/znt/n-list.conf
+ - Private history can be edited. Use `e` key or `Ctrl-E` for that when in
+ n-history. Your `$EDITOR` will start. This is a way to have handy set of
+ bookmarks prepared in private history's file.
+ - Border can be disabled. Use following snippet in `~/.config/znt/n-list.conf`
or any other tool-targetted config file:
+ ```zsh
# Should draw the border?
local border=0
+ ```
* 30-04-2016
- - New feature: color themes. Use Ctrl-T and Ctrl-G to browse predefined
- themes. They are listed in ~/.config/znt/n-list.conf. Use the file to
- permanently set a color scheme. Also, I sent a patch to Zsh developers
+ - New feature: color themes. Use `Ctrl-T` and `Ctrl-G` to browse predefined
+ themes. They are listed in [~/.config/znt/n-list.conf](https://github.com/psprint/zsh-navigation-tools/blob/master/.config/znt/n-list.conf).
+ Use the file to permanently set a color scheme. Also, I sent a patch to Zsh developers
and starting from Zsh > 5.2 (not yet released) supported will be 256 colors.
- The file ~/.config/znt/n-list.conf already has set of 256-color themes prepared :)
+ The file [~/.config/znt/n-list.conf](https://github.com/psprint/zsh-navigation-tools/blob/master/.config/znt/n-list.conf)
+ already has set of 256-color themes prepared :)
+
+ 
* 29-04-2016
- New feature: private history – n-history tracks selected history entries,
- exposes them via new view (activated with F1)
+ exposes them via new view (activated with `F1`). It is shared across all
+ sessions
* 28-04-2016
- New features:
- 1. New n-history view (activated with F1): Most Frequent History Words
+ 1. New n-history view (activated with `F1`): Most Frequent History Words
2. Predefined search keywords – use F2 to quickly search for chosen
keywords (video: [https://youtu.be/DN9QqssAYB8](https://youtu.be/DN9QqssAYB8))
3. Configuration option for doing instant selection in search mode
+## Installation
+
+```
+sh -c "$(curl -fsSL https://raw.githubusercontent.com/psprint/zsh-navigation-tools/master/doc/install.sh)"
+```
+
+To update run the command again.
+
+`ZNT` will be installed at `~/.config/znt/zsh-navigation-tools`, config files will be copied to `~/.config/znt`. `.zshrc`
+will be updated with only `8` lines of code, which will be added at the bottom.
+
+After installing and reloading shell give `ZNT` a quick try with `Ctrl-R` – this keyboard shortcut will open `n-history`.
+
+## Installation With [Zplugin](https://github.com/psprint/zplugin)
+Add `zplugin load psprint/zsh-navigation-tools` to `.zshrc`. The config files will be in `~/.config/znt`.
+
+## Installation With Zgen
+
+Add `zgen load psprint/zsh-navigation-tools` to `.zshrc` and issue a `zgen reset` (this assumes that there is a proper `zgen save` construct in `.zshrc`).
+The config files will be available in `~/.config/znt`.
+
+## Installation With Antigen
+Add `antigen bundle psprint/zsh-navigation-tools` to `.zshrc`. There also
+should be `antigen apply`. The config files will be in `~/.config/znt`.
+
+## Single File Manual Installation
+
+Running script `doc/generate_single_file` will create single-file version of `ZNT`.
+It can be sourced from `.zshrc`. Don't forget about configuration files as described
+above.
+
+## Manual Installation
+
+After extracting `ZNT` to `{some-directory}` add following two lines
+to `~/.zshrc`:
+
+```zsh
+fpath+=( {some-directory} )
+source "{some-directory}/zsh-navigation-tools.plugin.zsh"
+```
+
+As you can see, no plugin manager is needed to use the `*.plugin.zsh`
+file. The above two lines of code are all that almost **all** plugin
+managers do. In fact, what's actually needed is only:
+
+```zsh
+source "{some-directory}/zsh-navigation-tools.plugin.zsh"
+```
+
+because `ZNT` detects if it is used by **any** plugin manager and can
+handle `$fpath` update by itself.
+
+## Truly Manual Installation
+Copy (or link) all `n-*` and `znt-*` files to **/usr/share/zsh/site-functions/**
+(or **/usr/local/share/zsh/site-functions/**, check with `echo $fpath[1]`) and then add:
+
+ autoload n-list n-cd n-env n-kill n-panelize n-options n-aliases n-functions n-history n-help
+
+to `~/.zshrc`.
+
+Create aliases to avoid typing of the minus sign "-":
+
+```zsh
+alias naliases=n-aliases ncd=n-cd nenv=n-env nfunctions=n-functions nhistory=n-history
+alias nkill=n-kill noptions=n-options npanelize=n-panelize nhelp=n-help
+```
+
+Don't forget to copy [configuration files](https://github.com/psprint/zsh-navigation-tools/tree/master/.config/znt). They should go to `~/.config/znt`. Moreover, `n-cd` works together with option `AUTO_PUSHD` and you should have:
+
+```zsh
+setopt AUTO_PUSHD
+```
+
+in `.zshrc` (also recommend `PUSHD_IGNORE_DUPS`). Without the option `n-cd`
+will just work as incremental searcher of directory bookmarks.
+
+## History Widget
+
+To have `n-history` as the incremental searcher bound to `Ctrl-R` copy `znt-*`
+files into the `*/site-functions` dir (unless you do single file install) and
+add:
+
+```zsh
+autoload znt-history-widget
+zle -N znt-history-widget
+bindkey "^R" znt-history-widget
+```
+
+to `.zshrc`. This is done automatically when using the installer, zgen, antigen
+or single file install. Two other widgets exist, `znt-cd-widget` and
+`znt-kill-widget`, they too can be assigned to key combinations (`autoload` is done
+in `.zshrc` so no need of it):
+
+```zsh
+zle -N znt-cd-widget
+bindkey "^B" znt-cd-widget
+zle -N znt-kill-widget
+bindkey "^Y" znt-kill-widget
+```
+
## Introduction
The tools are:
-- n-aliases - browses aliases, relegates editing to vared
-- n-cd - browses dirstack and bookmarked directories, allows to enter selected directory
-- n-functions - browses functions, relegates editing to zed or vared
-- n-history - browses history, allows to edit and run commands from it
-- n-kill - browses processes list, allows to send signal to selected process
-- n-env - browses environment, relegates editing to vared
-- n-options - browses options, allows to toggle their state
-- n-panelize - loads output of given command into the list for browsing
+- `n-aliases` - browses aliases, relegates editing to `vared`
+- `n-cd` - browses dirstack and bookmarked directories, allows to enter selected directory
+- `n-functions` - browses functions, relegates editing to `zed` or `vared`
+- `n-history` - browses history, allows to edit and run commands from it
+- `n-kill` - browses processes list, allows to send signal to selected process
+- `n-env` - browses environment, relegates editing to `vared`
+- `n-options` - browses options, allows to toggle their state
+- `n-panelize` - loads output of given command into the list for browsing
-All tools support horizontal scroll with <,>, {,}, h,l or left and right
-cursors. Other keys are:
+All tools support horizontal scroll with `<`,`>`, `{`,`}`, `h`,`l` or left and right cursors. Other keys are:
-- [,] - jump directory bookmarks in n-cd and typical signals in n-kill
-- Ctrl-d, Ctrl-u - half page up or down
-- Ctrl-p, Ctrl-n - previous and next (also done with vim's j,k)
-- Ctrl-l - redraw of whole display
-- g, G - beginning and end of the list
-- Ctrl-o, o - enter uniq mode (no duplicate lines)
-- / - start incremental search
-- Enter - finish incremental search, retaining filter
-- Esc - exit incremental search, clearing filter
-- Ctrl-w (in incremental search) - delete whole word
-- Ctrl-k (in incremental search) - delete whole line
+- `H`, `?` (from n-history) - run n-help
+- `Ctrl-R` - start n-history, the incremental, multi-keyword history searcher (Zsh binding)
+- `Ctrl-A` - rotate entered words (1+2+3 -> 3+1+2)
+- `Ctrl-F` - fix mode (approximate matching)
+- `Ctrl-L` - redraw of whole display
+- `Ctrl-T` - browse themes (next theme)
+- `Ctrl-G` - browse themes (previous theme)
+- `Ctrl-U` - half page up
+- `Ctrl-D` - half page down
+- `Ctrl-P` - previous element (also done with vim's k)
+- `Ctrl-N` - next element (also done with vim's j)
+- `[`, `]` - jump directory bookmarks in n-cd and typical signals in n-kill
+- `g`, `G` - beginning and end of the list
+- `/` - show incremental search
+- `F3` - show/hide incremental search
+- `Esc` - exit incremental search, clearing filter
+- `Ctrl-W` (in incremental search) - delete whole word
+- `Ctrl-K` (in incremental search) - delete whole line
+- `Ctrl-O`, `o` - enter uniq mode (no duplicate lines)
+- `Ctrl-E`, `e` - edit private history (when in private history view)
+- `F1` - (in n-history) - switch view
+- `F2`, `Ctrl-X`, `Ctrl-/` - search predefined keywords (defined in config files)
## Configuration
@@ -177,7 +308,7 @@ znt_history_active_text - underline or reverse - how should be active element hi
znt_history_nlist_coloring_pattern - pattern that can be used to colorize elements
znt_history_nlist_coloring_color - color with which to colorize
znt_history_nlist_coloring_match_multiple - should multiple matches be colorized (0 or 1)
-znt_history_keywords (array) - search keywords activated with `Ctrl-X`
+znt_history_keywords (array) - search keywords activated with `Ctrl-X`, `F2` or `Ctrl-/`, e.g. ( "git" "vim" )
```
Above variables will work for `n-history` tool. For other tools, change `_history_` to
@@ -193,52 +324,108 @@ znt_list_themes (array) - list of themes to try out with Ctrl-T, e.g. ( "white/b
znt_list_instant_select - should pressing enter in search mode leave tool (0 or 1)
```
+If you used `ZNT` before `v2.1.12`, remove old configuration files `~/.config/znt/*.conf` so that `ZNT`
+can update them to the latest versions that support integration with `Zshrc`. If you used installer
+then run it again (after the remove of configuration files).
+
## Programming
-The function n-list is used as follows:
+The function `n-list` is used as follows:
- n-list {element1} [element2] ... [elementN]
+```zsh
+n-list {element1} [element2] ... [elementN]
+```
This is all that is needed to be done to have the features like ANSI coloring,
incremental multi-word search, unique mode, horizontal scroll, non-selectable
-elements (grepping is done outside n-list, see the tools for how it can be
+elements (grepping is done outside `n-list`, see the tools for how it can be
done). To set up non-selectable entries add their indices into array
-NLIST_NONSELECTABLE_ELEMENTS:
+`NLIST_NONSELECTABLE_ELEMENTS`:
- typeset -a NLIST_NONSELECTABLE_ELEMENTS
- NLIST_NONSELECTABLE_ELEMENTS=( 1 )
+```zsh
+typeset -a NLIST_NONSELECTABLE_ELEMENTS
+NLIST_NONSELECTABLE_ELEMENTS=( 1 )
+```
-Result is stored as $reply[REPLY] ($ isn't needed before REPLY because
-of arithmetic context inside []). The returned array might be different from
-input arguments as n-list can process them via incremental search or uniq
-mode. $REPLY is the index in that possibly processed array. If $REPLY
-equals -1 it means that no selection have been made (user quitted via q
+Result is stored as `$reply[REPLY]` (`$` isn't needed before `REPLY` because
+of arithmetic context inside `[]`). The returned array might be different from
+input arguments as `n-list` can process them via incremental search or uniq
+mode. `$REPLY` is the index in that possibly processed array. If `$REPLY`
+equals `-1` it means that no selection have been made (user quitted via `q`
key).
-To set up entries that can be jumped to with [,] keys add their indices to
-NLIST_HOP_INDEXES array:
+To set up entries that can be jumped to with `[`,`]` keys add their indices to
+`NLIST_HOP_INDEXES` array:
- typeset -a NLIST_HOP_INDEXES
- NLIST_HOP_INDEXES=( 1 10 )
+```zsh
+typeset -a NLIST_HOP_INDEXES
+NLIST_HOP_INDEXES=( 1 10 )
+```
-n-list can automatically colorize entries according to a Zsh pattern.
+`n-list` can automatically colorize entries according to a `Zsh` pattern.
Following example will colorize all numbers with blue:
- local NLIST_COLORING_PATTERN="[0-9]##"
- local NLIST_COLORING_COLOR=$'\x1b[00;34m'
- local NLIST_COLORING_END_COLOR=$'\x1b[0m'
- local NLIST_COLORING_MATCH_MULTIPLE=1
- n-list "This is a number 123" "This line too has a number: 456"
+```zsh
+local NLIST_COLORING_PATTERN="[0-9]##"
+local NLIST_COLORING_COLOR=$'\x1b[00;34m'
+local NLIST_COLORING_END_COLOR=$'\x1b[0m'
+local NLIST_COLORING_MATCH_MULTIPLE=1
-Blue is the default color, it doesn't have to be set. See zshexpn man page
-for more information on Zsh patterns. Briefly, comparing to regular
-expressions, (#s) is ^, (#e) is $, # is *, ## is +. Alternative
-will work when in parenthesis, i.e. (a|b). BTW by using this method you can
+n-list "This is a number 123" "This line too has a number: 456"
+```
+
+Blue is the default color, it doesn't have to be set. See `zshexpn` man page
+for more information on `Zsh` patterns. Briefly, comparing to regular
+expressions, `(#s)` is `^`, `(#e)` is `$`, `#` is `*`, `##` is `+`. Alternative
+will work when in parenthesis, i.e. `(a|b)`. BTW by using this method you can
colorize output of the tools, via their config files (check out e.g. n-cd.conf,
-it uses this).
+it is using this).
## Performance
-ZNT are fastest with Zsh before 5.0.6 and starting from 5.2
+`ZNT` are fastest with `Zsh` before `5.0.6` and starting from `5.2`
+
+## A tip
+
+Zsh plugins may look scary, as they seem to have some "architecture". In fact, what a plugin really is, is that:
+
+1. It has its directory added to `fpath`
+2. It has any first `*.plugin.zsh` file sourced
+
+That's it. When one contributes to Oh-My-Zsh or creates a plugin for any plugin manager, he only needs to account for this.
+The same with doing any non-typical Zsh Navigation Tools installation.
+
+## More
+
+- be aware of [this](https://github.com/psprint/zsh-navigation-tools/blob/f49f910d239ae5bc6e1a5bb34930307b4f4e3ffe/zsh-navigation-tools.plugin.zsh#L35-L49)
+
+## IRC Channel
+
+Channel `#zplugin@freenode` is a support place for all author's projects. Connect to:
+[chat.freenode.net:6697](ircs://chat.freenode.net:6697/%23zplugin) (SSL) or [chat.freenode.net:6667](irc://chat.freenode.net:6667/%23zplugin)
+ and join #zplugin.
+
+Following is a quick access via Webchat [](https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin)
+
+# Fixing tmux, screen and linux vt
+
+If `TERM=screen-256color` (often a case for `tmux` and `screen` sessions) then
+`ncv` terminfo capability will have `2`nd bit set. This in general means that
+underline won't work. To fix this by creating your own `ncv=0`-equipped
+terminfo file, run:
+
+```zsh
+{ infocmp -x screen-256color; printf '\t%s\n' 'ncv@,'; } > /tmp/t && tic -x /tmp/t
+```
+
+A file will be created in directory `~/.terminfo` and will be automatically
+used, `tmux` and `screen` will work. Similar is for Linux virtual terminal:
+
+```zsh
+{ infocmp -x linux; printf '\t%s\n' 'ncv@,'; } > /tmp/t && tic -x /tmp/t
+```
+
+It will not display underline properly, but will instead highlight by a color,
+which is quite nice. The same will not work for FreeBSD's vt, `ZNT` will detect
+if that vt is used and will revert to highlighting elements via `reverse` mode.
-vim:filetype=conf
diff --git a/zsh/plugins/zsh-navigation-tools/_n-kill b/zsh/plugins/zsh-navigation-tools/_n-kill
index 6f5d479..9da68b9 100644
--- a/zsh/plugins/zsh-navigation-tools/_n-kill
+++ b/zsh/plugins/zsh-navigation-tools/_n-kill
@@ -10,8 +10,8 @@ integer cygwin=0
local IFS="
"
-case "$OSTYPE" in
- cygwin*) list=( `command ps -Wa` ); cygwin=1 ;;
+case "$(uname)" in
+ CYGWIN*) list=( `command ps -Wa` ); cygwin=1 ;;
*) list=( `command ps -o pid,uid,command -A` ) ;;
esac
@@ -36,6 +36,6 @@ for line in "${list[@]}"; do
done
_wanted bits expl "Processes' name bits" \
- compadd "$@" -a - words && ret=0
+ compadd -M 'm:{a-z}={A-Z}' "$@" -a - words && ret=0
return "$ret"
diff --git a/zsh/plugins/zsh-navigation-tools/n-kill b/zsh/plugins/zsh-navigation-tools/n-kill
index 76050f9..0d10565 100644
--- a/zsh/plugins/zsh-navigation-tools/n-kill
+++ b/zsh/plugins/zsh-navigation-tools/n-kill
@@ -42,8 +42,8 @@ NLIST_NONSELECTABLE_ELEMENTS=( 1 )
type ps 2>/dev/null 1>&2 || { echo >&2 "Error: \`ps' not found"; return 1 }
-case "$OSTYPE" in
- cygwin*) list=( `command ps -Wa` ) ;;
+case "$(uname)" in
+ CYGWIN*) list=( `command ps -Wa` ) ;;
*) list=( `command ps -o pid,uid,command -A` ) ;;
esac
diff --git a/zsh/plugins/zsh-navigation-tools/n-list b/zsh/plugins/zsh-navigation-tools/n-list
index 3fe5542..f25db8f 100644
--- a/zsh/plugins/zsh-navigation-tools/n-list
+++ b/zsh/plugins/zsh-navigation-tools/n-list
@@ -261,6 +261,8 @@ done
last_element="$#list"
+zcurses clear main redraw
+zcurses clear inner redraw
while (( 1 )); do
# Do searching (filtering with string)
if [ -n "$NLIST_SEARCH_BUFFER" ]; then
diff --git a/zsh/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh b/zsh/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh
index 32b4ca0..f015620 100644
--- a/zsh/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh
+++ b/zsh/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh
@@ -1,9 +1,30 @@
#!/usr/bin/env zsh
-0="${(%):-%N}" # this gives immunity to functionargzero being unset
-export ZNT_REPO_DIR="${0%/*}"
+#
+# No plugin manager is needed to use this file. All that is needed is adding:
+# source {where-znt-is}/zsh-navigation-tools.plugin.zsh
+#
+# to ~/.zshrc.
+#
+
+# According to the standard:
+# http://zdharma.org/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
+0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
+0="${${(M)0:#/*}:-$PWD/$0}"
+export ZNT_REPO_DIR="${0:h}"
export ZNT_CONFIG_DIR="$HOME/.config/znt"
+#
+# Update FPATH if:
+# 1. Not loading with a plugin manager
+# 2. Not having fpath already updated
+#
+
+if [[ ${zsh_loaded_plugins[-1]} != */zsh-navigation-tools && -z ${fpath[(r)${0:h}]} ]]
+then
+ fpath+=( "${0:h}" )
+fi
+
#
# Copy configs
#
diff --git a/zsh/plugins/zsh_reload/zsh_reload.plugin.zsh b/zsh/plugins/zsh_reload/zsh_reload.plugin.zsh
index 51048ba..0d29a7c 100644
--- a/zsh/plugins/zsh_reload/zsh_reload.plugin.zsh
+++ b/zsh/plugins/zsh_reload/zsh_reload.plugin.zsh
@@ -3,10 +3,20 @@ src() {
autoload -U compinit zrecompile
compinit -i -d "$cache/zcomp-$HOST"
- for f in ~/.zshrc "$cache/zcomp-$HOST"; do
+ for f in ${ZDOTDIR:-~}/.zshrc "$cache/zcomp-$HOST"; do
zrecompile -p $f && command rm -f $f.zwc.old
done
- # Use $SHELL if available; remove leading dash if login shell
- [[ -n "$SHELL" ]] && exec ${SHELL#-} || exec zsh
+ # Use $SHELL if it's available and a zsh shell
+ local shell="$ZSH_ARGZERO"
+ if [[ "${${SHELL:t}#-}" = zsh ]]; then
+ shell="$SHELL"
+ fi
+
+ # Remove leading dash if login shell and run accordingly
+ if [[ "${shell:0:1}" = "-" ]]; then
+ exec -l "${shell#-}"
+ else
+ exec "$shell"
+ fi
}
diff --git a/zsh/templates/zshrc.zsh-template b/zsh/templates/zshrc.zsh-template
index 3cc5ad4..3076181 100644
--- a/zsh/templates/zshrc.zsh-template
+++ b/zsh/templates/zshrc.zsh-template
@@ -7,12 +7,12 @@ export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
-# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
+# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
-# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
+# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
@@ -33,7 +33,7 @@ ZSH_THEME="robbyrussell"
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line if pasting URLs and other text is messed up.
-# DISABLE_MAGIC_FUNCTIONS=true
+# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
@@ -64,8 +64,8 @@ ZSH_THEME="robbyrussell"
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
-# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
-# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
+# Standard plugins can be found in $ZSH/plugins/
+# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
diff --git a/zsh/themes/af-magic.zsh-theme b/zsh/themes/af-magic.zsh-theme
index d185fa1..1d2af34 100644
--- a/zsh/themes/af-magic.zsh-theme
+++ b/zsh/themes/af-magic.zsh-theme
@@ -2,29 +2,33 @@
# Repo: https://github.com/andyfleming/oh-my-zsh
# Direct Link: https://github.com/andyfleming/oh-my-zsh/blob/master/themes/af-magic.zsh-theme
-if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
-local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
+
+# settings
+typeset +H return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
+typeset +H my_gray="$FG[237]"
+typeset +H my_orange="$FG[214]"
+
+# separator dashes size
+function afmagic_dashes {
+ local PYTHON_ENV="$VIRTUAL_ENV"
+ [[ -z "$PYTHON_ENV" ]] && PYTHON_ENV="$CONDA_DEFAULT_ENV"
+
+ if [[ -n "$PYTHON_ENV" && "$PS1" = \(* ]]; then
+ echo $(( COLUMNS - ${#PYTHON_ENV} - 3 ))
+ else
+ echo $COLUMNS
+ fi
+}
# primary prompt
-PROMPT='$FG[237]${(l.COLUMNS..-.)}%{$reset_color%}
-$FG[032]%~\
-$(git_prompt_info)$(hg_prompt_info) \
-$FG[105]%(!.#.»)%{$reset_color%} '
-PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
+PS1='$FG[237]${(l.$(afmagic_dashes)..-.)}%{$reset_color%}
+$FG[032]%~$(git_prompt_info)$(hg_prompt_info) $FG[105]%(!.#.»)%{$reset_color%} '
+PS2='%{$fg[red]%}\ %{$reset_color%}'
RPS1='${return_code}'
-
-# color vars
-eval my_gray='$FG[237]'
-eval my_orange='$FG[214]'
-
# right prompt
-if type "virtualenv_prompt_info" > /dev/null
-then
- RPROMPT='$FG[078]$(virtualenv_prompt_info)%{$reset_color%} $my_gray%n@%m%{$reset_color%}%'
-else
- RPROMPT='$my_gray%n@%m%{$reset_color%}%'
-fi
+(( $+functions[virtualenv_prompt_info] )) && RPS1+='$(virtualenv_prompt_info)'
+RPS1+=' $my_gray%n@%m%{$reset_color%}%'
# git settings
ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075]($FG[078]"
@@ -37,3 +41,7 @@ ZSH_THEME_HG_PROMPT_PREFIX="$FG[075]($FG[078]"
ZSH_THEME_HG_PROMPT_CLEAN=""
ZSH_THEME_HG_PROMPT_DIRTY="$my_orange*%{$reset_color%}"
ZSH_THEME_HG_PROMPT_SUFFIX="$FG[075])%{$reset_color%}"
+
+# virtualenv settings
+ZSH_THEME_VIRTUALENV_PREFIX=" $FG[075]["
+ZSH_THEME_VIRTUALENV_SUFFIX="]%{$reset_color%}"
diff --git a/zsh/themes/agnoster.zsh-theme b/zsh/themes/agnoster.zsh-theme
index 518a14a..99707f6 100644
--- a/zsh/themes/agnoster.zsh-theme
+++ b/zsh/themes/agnoster.zsh-theme
@@ -106,7 +106,7 @@ prompt_git() {
}
local ref dirty mode repo_path
- if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
+ if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
repo_path=$(git rev-parse --git-dir 2>/dev/null)
dirty=$(parse_git_dirty)
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
@@ -131,7 +131,7 @@ prompt_git() {
zstyle ':vcs_info:*' get-revision true
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' stagedstr '✚'
- zstyle ':vcs_info:*' unstagedstr '●'
+ zstyle ':vcs_info:*' unstagedstr '±'
zstyle ':vcs_info:*' formats ' %u%c'
zstyle ':vcs_info:*' actionformats ' %u%c'
vcs_info
@@ -140,24 +140,30 @@ prompt_git() {
}
prompt_bzr() {
- (( $+commands[bzr] )) || return
- if (bzr status >/dev/null 2>&1); then
- status_mod=`bzr status | head -n1 | grep "modified" | wc -m`
- status_all=`bzr status | head -n1 | wc -m`
- revision=`bzr log | head -n2 | tail -n1 | sed 's/^revno: //'`
- if [[ $status_mod -gt 0 ]] ; then
- prompt_segment yellow black
- echo -n "bzr@"$revision "✚ "
- else
- if [[ $status_all -gt 0 ]] ; then
- prompt_segment yellow black
- echo -n "bzr@"$revision
- else
- prompt_segment green black
- echo -n "bzr@"$revision
- fi
- fi
+ (( $+commands[bzr] )) || return
+
+ # Test if bzr repository in directory hierarchy
+ local dir="$PWD"
+ while [[ ! -d "$dir/.bzr" ]]; do
+ [[ "$dir" = "/" ]] && return
+ dir="${dir:h}"
+ done
+
+ local bzr_status status_mod status_all revision
+ if bzr_status=$(bzr status 2>&1); then
+ status_mod=$(echo -n "$bzr_status" | head -n1 | grep "modified" | wc -m)
+ status_all=$(echo -n "$bzr_status" | head -n1 | wc -m)
+ revision=$(bzr log -r-1 --log-format line | cut -d: -f1)
+ if [[ $status_mod -gt 0 ]] ; then
+ prompt_segment yellow black "bzr@$revision ✚"
+ else
+ if [[ $status_all -gt 0 ]] ; then
+ prompt_segment yellow black "bzr@$revision"
+ else
+ prompt_segment green black "bzr@$revision"
+ fi
fi
+ fi
}
prompt_hg() {
@@ -229,7 +235,7 @@ prompt_status() {
# ends in '-prod'
# - displays black on green otherwise
prompt_aws() {
- [[ -z "$AWS_PROFILE" ]] && return
+ [[ -z "$AWS_PROFILE" || "$SHOW_AWS_PROMPT" = false ]] && return
case "$AWS_PROFILE" in
*-prod|*production*) prompt_segment red yellow "AWS: $AWS_PROFILE" ;;
*) prompt_segment green black "AWS: $AWS_PROFILE" ;;
diff --git a/zsh/themes/arrow.zsh-theme b/zsh/themes/arrow.zsh-theme
index a3e77d6..76c031f 100644
--- a/zsh/themes/arrow.zsh-theme
+++ b/zsh/themes/arrow.zsh-theme
@@ -1,7 +1,7 @@
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="yellow"; fi
PROMPT='%{$fg[$NCOLOR]%}%c ➤ %{$reset_color%}'
-RPROMPT='%{$fg[$NCOLOR]%}%p $(git_prompt_info)%{$reset_color%}'
+RPROMPT='%{$fg[$NCOLOR]%} $(git_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:"
ZSH_THEME_GIT_PROMPT_SUFFIX=""
diff --git a/zsh/themes/avit.zsh-theme b/zsh/themes/avit.zsh-theme
index aec14e4..921ed99 100644
--- a/zsh/themes/avit.zsh-theme
+++ b/zsh/themes/avit.zsh-theme
@@ -1,27 +1,20 @@
# AVIT ZSH Theme
+# settings
+typeset +H _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} "
+typeset +H _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}"
+typeset +H _hist_no="%{$fg[grey]%}%h%{$reset_color%}"
+
PROMPT='
-$(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version)
-%{$fg[$CARETCOLOR]%}▶%{$resetcolor%} '
+$(_user_host)${_current_dir} $(git_prompt_info) $(ruby_prompt_info)
+%{%(!.${fg[red]}.${fg[white]})%}▶%{$reset_color%} '
-PROMPT2='%{$fg[$CARETCOLOR]%}◀%{$reset_color%} '
+PROMPT2='%{%(!.${fg[red]}.${fg[white]})%}◀%{$reset_color%} '
-RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}'
-
-local _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} "
-local _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}"
-local _hist_no="%{$fg[grey]%}%h%{$reset_color%}"
-
-function _current_dir() {
- local _max_pwd_length="65"
- if [[ $(echo -n $PWD | wc -c) -gt ${_max_pwd_length} ]]; then
- echo "%{$fg_bold[blue]%}%-2~ ... %3~%{$reset_color%} "
- else
- echo "%{$fg_bold[blue]%}%~%{$reset_color%} "
- fi
-}
+RPROMPT='$(vi_mode_prompt_info)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}'
function _user_host() {
+ local me
if [[ -n $SSH_CONNECTION ]]; then
me="%n@%m"
elif [[ $LOGNAME != $USER ]]; then
@@ -32,61 +25,41 @@ function _user_host() {
fi
}
-function _vi_status() {
- if {echo $fpath | grep -q "plugins/vi-mode"}; then
- echo "$(vi_mode_prompt_info)"
- fi
-}
-
-function _ruby_version() {
- if {echo $fpath | grep -q "plugins/rvm"}; then
- echo "%{$fg[grey]%}$(rvm_prompt_info)%{$reset_color%}"
- elif {echo $fpath | grep -q "plugins/rbenv"}; then
- echo "%{$fg[grey]%}$(rbenv_prompt_info)%{$reset_color%}"
- fi
-}
-
# Determine the time since last commit. If branch is clean,
# use a neutral color, otherwise colors will vary according to time.
function _git_time_since_commit() {
-# Only proceed if there is actually a commit.
+ local last_commit now seconds_since_last_commit
+ local minutes hours days years commit_age
+ # Only proceed if there is actually a commit.
if last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null); then
now=$(date +%s)
seconds_since_last_commit=$((now-last_commit))
# Totals
minutes=$((seconds_since_last_commit / 60))
- hours=$((seconds_since_last_commit/3600))
+ hours=$((minutes / 60))
+ days=$((hours / 24))
+ years=$((days / 365))
- # Sub-hours and sub-minutes
- days=$((seconds_since_last_commit / 86400))
- sub_hours=$((hours % 24))
- sub_minutes=$((minutes % 60))
-
- if [ $hours -ge 24 ]; then
- commit_age="${days}d"
- elif [ $minutes -gt 60 ]; then
- commit_age="${sub_hours}h${sub_minutes}m"
+ if [[ $years -gt 0 ]]; then
+ commit_age="${years}y$((days % 365 ))d"
+ elif [[ $days -gt 0 ]]; then
+ commit_age="${days}d$((hours % 24))h"
+ elif [[ $hours -gt 0 ]]; then
+ commit_age+="${hours}h$(( minutes % 60 ))m"
else
commit_age="${minutes}m"
fi
- color=$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL
- echo "$color$commit_age%{$reset_color%}"
+ echo "${ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL}${commit_age}%{$reset_color%}"
fi
}
-if [[ $USER == "root" ]]; then
- CARETCOLOR="red"
-else
- CARETCOLOR="white"
-fi
-
MODE_INDICATOR="%{$fg_bold[yellow]%}❮%{$reset_color%}%{$fg[yellow]%}❮❮%{$reset_color%}"
+# Git prompt settings
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
-
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}✚ "
@@ -96,6 +69,10 @@ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}▴ "
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}§ "
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[white]%}◒ "
+# Ruby prompt settings
+ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[grey]%}"
+ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}"
+
# Colors vary depending on time lapsed.
ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
diff --git a/zsh/themes/awesomepanda.zsh-theme b/zsh/themes/awesomepanda.zsh-theme
index 1c5d06b..85036e4 100644
--- a/zsh/themes/awesomepanda.zsh-theme
+++ b/zsh/themes/awesomepanda.zsh-theme
@@ -1,6 +1,6 @@
# the svn plugin has to be activated for this to work.
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
-PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}'
+PROMPT='${ret_status}%{$fg_bold[green]%} %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
diff --git a/zsh/themes/bira.zsh-theme b/zsh/themes/bira.zsh-theme
index d00f72f..cdae68d 100644
--- a/zsh/themes/bira.zsh-theme
+++ b/zsh/themes/bira.zsh-theme
@@ -16,7 +16,7 @@ local venv_prompt='$(virtualenv_prompt_info)'
ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
-PROMPT="╭─${venv_prompt}${user_host}${current_dir}${rvm_ruby}${git_branch}
+PROMPT="╭─${user_host}${current_dir}${rvm_ruby}${git_branch}${venv_prompt}
╰─%B${user_symbol}%b "
RPROMPT="%B${return_code}%b"
diff --git a/zsh/themes/candy-kingdom.zsh-theme b/zsh/themes/candy-kingdom.zsh-theme
index 30ce785..ad03cc3 100644
--- a/zsh/themes/candy-kingdom.zsh-theme
+++ b/zsh/themes/candy-kingdom.zsh-theme
@@ -1,16 +1,14 @@
-# neuralsanwich.zsh-theme
-
-if [ "x$OH_MY_ZSH_HG" = "x" ]; then
- OH_MY_ZSH_HG="hg"
-fi
-
-function hg_prompt_info {
- $OH_MY_ZSH_HG prompt --angle-brackets "\
+if ! hg prompt 2>/dev/null; then
+ function hg_prompt_info { }
+else
+ function hg_prompt_info {
+ hg prompt --angle-brackets "\
< on %{$fg[magenta]%}%{$reset_color%}>\
< at %{$fg[yellow]%}%{$reset_color%}>\
%{$fg[green]%}%{$reset_color%}<
patches: >" 2>/dev/null
-}
+ }
+fi
function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST}
@@ -26,5 +24,9 @@ ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[red]%}?"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[orange]%}!"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})"
-local return_status="%{$fg[red]%}%(?..✘)%{$reset_color%}"
-RPROMPT='${return_status}$(battery_time_remaining) $(battery_pct_prompt)%{$reset_color%}'
+RPROMPT='%{$fg[red]%}%(?..✘)%{$reset_color%}'
+
+# Add battery status if the battery plugin is enabled
+if (( $+functions[battery_pct_prompt] )); then
+ RPROMPT+='$(battery_time_remaining) $(battery_pct_prompt)%{$reset_color%}'
+fi
diff --git a/zsh/themes/cloud.zsh-theme b/zsh/themes/cloud.zsh-theme
index 59a3472..e26f786 100644
--- a/zsh/themes/cloud.zsh-theme
+++ b/zsh/themes/cloud.zsh-theme
@@ -2,7 +2,7 @@ if [[ -z $ZSH_THEME_CLOUD_PREFIX ]]; then
ZSH_THEME_CLOUD_PREFIX='☁'
fi
-PROMPT='%{$fg_bold[cyan]%}$ZSH_THEME_CLOUD_PREFIX %{$fg_bold[green]%}%p %{$fg[green]%}%c %{$fg_bold[cyan]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+PROMPT='%{$fg_bold[cyan]%}$ZSH_THEME_CLOUD_PREFIX %{$fg_bold[green]%} %{$fg[green]%}%c %{$fg_bold[cyan]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$fg[cyan]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
diff --git a/zsh/themes/edvardm.zsh-theme b/zsh/themes/edvardm.zsh-theme
index f9ca1a9..d41dd44 100644
--- a/zsh/themes/edvardm.zsh-theme
+++ b/zsh/themes/edvardm.zsh-theme
@@ -1,4 +1,4 @@
-PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg_bold[white]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%} %{$fg_bold[white]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
diff --git a/zsh/themes/eof.zsh-theme b/zsh/themes/eof.zsh-theme
deleted file mode 100644
index e503e7c..0000000
--- a/zsh/themes/eof.zsh-theme
+++ /dev/null
@@ -1,38 +0,0 @@
-# Depends on the git-prompt plugin
-
-# Colors: black red green yellow blue magenta cyan white
-# Symbols: … ● ✔ ✖ ↓ ↑ ➜ ☀ ♻ ⚒
-
-# git-prompt customization
-ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}["
-ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[green]%}]%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_SEPARATOR=" "
-ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[green]%}"
-ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[white]%}%{⚒%G%}"
-ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{✖%G%}"
-ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[yellow]%}%{☀%G%}"
-ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg[white]%}%{↓%G%}"
-ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[white]%}%{↑%G%}"
-ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[blue]%}%{?%G%}"
-ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}%{✔%G%}"
-ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}♻"
-
-# Default mode (Small)
-#ZSH_THEME_EOF_NAMES="${USER%%@*}@%m"
-
-case $ZSH_THEME_EOF_MODE in
- mega)
- ZSH_THEME_EOF_NAMES="%n@%M "
- ;;
- big)
- ZSH_THEME_EOF_NAMES="%n@%m "
- ;;
- small)
- ZSH_THEME_EOF_NAMES="${USER%%@*}@%m "
- ;;
- tiny|*)
- ZSH_THEME_EOF_NAMES=""
- ;;
-esac
-
-PROMPT='%{$fg[green]%}[%B%{$fg[green]%}$ZSH_THEME_EOF_NAMES%b%{$fg[cyan]%}%~% %{$fg[green]%}]%(?.%{$fg[green]%}.%{$fg[red]%})%B%#%b '
diff --git a/zsh/themes/fino-time.zsh-theme b/zsh/themes/fino-time.zsh-theme
index 5679e9f..57c47db 100644
--- a/zsh/themes/fino-time.zsh-theme
+++ b/zsh/themes/fino-time.zsh-theme
@@ -25,16 +25,12 @@ function box_name {
}
-local rvm_ruby='using%{$FG[243]%}$(ruby_prompt_info)'
-local git_info='$(git_prompt_info)'
-
-
-PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}%~%{$reset_color%}${git_info} %{$FG[239]%}${rvm_ruby} %D - %*
-╰─$(virtualenv_info)$(prompt_char) "
+PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}%~%{$reset_color%}\$(git_prompt_info)\$(ruby_prompt_info) %D - %*
+╰─\$(virtualenv_info)\$(prompt_char) "
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$FG[202]%}✘✘✘"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$FG[040]%}✔"
-ZSH_THEME_RUBY_PROMPT_PREFIX="‹"
+ZSH_THEME_RUBY_PROMPT_PREFIX=" %{$FG[239]%}using%{$FG[243]%} ‹"
ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}"
diff --git a/zsh/themes/fino.zsh-theme b/zsh/themes/fino.zsh-theme
index 1d8bb30..2523c17 100644
--- a/zsh/themes/fino.zsh-theme
+++ b/zsh/themes/fino.zsh-theme
@@ -11,26 +11,35 @@
#
# Also borrowing from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
+function virtualenv_prompt_info {
+ [[ -n ${VIRTUAL_ENV} ]] || return
+ echo "${ZSH_THEME_VIRTUALENV_PREFIX:=[}${VIRTUAL_ENV:t}${ZSH_THEME_VIRTUALENV_SUFFIX:=]}"
+}
+
function prompt_char {
- git branch >/dev/null 2>/dev/null && echo "±" && return
- echo '○'
+ command git branch &>/dev/null && echo "±" || echo '○'
}
function box_name {
- [ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST}
+ [ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST}
}
-local ruby_env='using%{$FG[243]%} $(ruby_prompt_info)'
+local ruby_env='$(ruby_prompt_info)'
local git_info='$(git_prompt_info)'
+local virtualenv_info='$(virtualenv_prompt_info)'
local prompt_char='$(prompt_char)'
-
-PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}%~%{$reset_color%}${git_info} %{$FG[239]%}${ruby_env}
+PROMPT="╭─${FG[040]}%n ${FG[239]}at ${FG[033]}$(box_name) ${FG[239]}in %B${FG[226]}%~%b${git_info}${ruby_env}${virtualenv_info}
╰─${prompt_char}%{$reset_color%} "
-ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}"
+ZSH_THEME_GIT_PROMPT_PREFIX=" ${FG[239]}on%{$reset_color%} ${FG[255]}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_DIRTY="%{$FG[202]%}✘✘✘"
-ZSH_THEME_GIT_PROMPT_CLEAN="%{$FG[040]%}✔"
-ZSH_THEME_RUBY_PROMPT_PREFIX="‹"
+ZSH_THEME_GIT_PROMPT_DIRTY="${FG[202]}✘✘✘"
+ZSH_THEME_GIT_PROMPT_CLEAN="${FG[040]}✔"
+
+ZSH_THEME_RUBY_PROMPT_PREFIX=" ${FG[239]}using${FG[243]} ‹"
ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}"
+
+export VIRTUAL_ENV_DISABLE_PROMPT=1
+ZSH_THEME_VIRTUALENV_PREFIX=" ${FG[239]}using${FG[243]} «"
+ZSH_THEME_VIRTUALENV_SUFFIX="»%{$reset_color%}"
diff --git a/zsh/themes/fishy.zsh-theme b/zsh/themes/fishy.zsh-theme
index 00a60f4..2b8d559 100644
--- a/zsh/themes/fishy.zsh-theme
+++ b/zsh/themes/fishy.zsh-theme
@@ -1,12 +1,18 @@
# ZSH Theme emulating the Fish shell's default prompt.
_fishy_collapsed_wd() {
- echo $(pwd | perl -pe '
- BEGIN {
- binmode STDIN, ":encoding(UTF-8)";
- binmode STDOUT, ":encoding(UTF-8)";
- }; s|^$ENV{HOME}|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g
-')
+ local i pwd
+ pwd=("${(s:/:)PWD/#$HOME/~}")
+ if (( $#pwd > 1 )); then
+ for i in {1..$(($#pwd-1))}; do
+ if [[ "$pwd[$i]" = .* ]]; then
+ pwd[$i]="${${pwd[$i]}[1,2]}"
+ else
+ pwd[$i]="${${pwd[$i]}[1]}"
+ fi
+ done
+ fi
+ echo "${(j:/:)pwd}"
}
local user_color='green'; [ $UID -eq 0 ] && user_color='red'
diff --git a/zsh/themes/fwalch.zsh-theme b/zsh/themes/fwalch.zsh-theme
index 24edf55..33f851c 100644
--- a/zsh/themes/fwalch.zsh-theme
+++ b/zsh/themes/fwalch.zsh-theme
@@ -1,4 +1,4 @@
-PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+PROMPT='%{$fg_bold[green]%} %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
diff --git a/zsh/themes/gallifrey.zsh-theme b/zsh/themes/gallifrey.zsh-theme
index 7685470..47b057f 100644
--- a/zsh/themes/gallifrey.zsh-theme
+++ b/zsh/themes/gallifrey.zsh-theme
@@ -1,4 +1,4 @@
-# ZSH Theme - Preview: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#gallifrey
+# ZSH Theme - Preview: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#gallifrey
return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
host_color="%(!.%{$fg[red]%}.%{$fg[green]%})"
diff --git a/zsh/themes/gozilla.zsh-theme b/zsh/themes/gozilla.zsh-theme
index c6b752e..593b8ec 100644
--- a/zsh/themes/gozilla.zsh-theme
+++ b/zsh/themes/gozilla.zsh-theme
@@ -1,4 +1,4 @@
-PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%} %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
diff --git a/zsh/themes/jbergantine.zsh-theme b/zsh/themes/jbergantine.zsh-theme
index d84247c..8e9a8ee 100644
--- a/zsh/themes/jbergantine.zsh-theme
+++ b/zsh/themes/jbergantine.zsh-theme
@@ -1,4 +1,4 @@
-PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[white]%}$(git_prompt_info)%{$fg_bold[white]%} % %{$reset_color%}'
+PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%} %{$fg[cyan]%}%c %{$fg_bold[white]%}$(git_prompt_info)%{$fg_bold[white]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
diff --git a/zsh/themes/jnrowe.zsh-theme b/zsh/themes/jnrowe.zsh-theme
index bae88f7..9d8fb24 100644
--- a/zsh/themes/jnrowe.zsh-theme
+++ b/zsh/themes/jnrowe.zsh-theme
@@ -33,6 +33,6 @@ function {
local ret_status="%(?:%{$fg_bold[green]%}Ξ:%{$fg_bold[red]%}%S↑%s%?)"
-PROMPT='${ret_status}%{$fg[blue]%}${PROMPT_HOST}%{$fg_bold[green]%}%p %{$fg_bold[yellow]%}%2~ ${vcs_info_msg_0_}${dir_status}%{$reset_color%} '
+PROMPT='${ret_status}%{$fg[blue]%}${PROMPT_HOST}%{$fg_bold[green]%} %{$fg_bold[yellow]%}%2~ ${vcs_info_msg_0_}${dir_status}%{$reset_color%} '
# vim: set ft=zsh ts=4 sw=4 et:
diff --git a/zsh/themes/jtriley.zsh-theme b/zsh/themes/jtriley.zsh-theme
index 15d77ed..0f5b16f 100644
--- a/zsh/themes/jtriley.zsh-theme
+++ b/zsh/themes/jtriley.zsh-theme
@@ -1,8 +1,2 @@
-#PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
PROMPT="%{$fg_bold[cyan]%}%T%{$fg_bold[green]%} %{$fg_bold[white]%}%n%{$fg[magenta]%}@%{$fg_bold[white]%}%m %{$fg_bold[green]%}%d
%{$fg_bold[yellow]%}%% %{$reset_color%}"
-
-#ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
-#ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
-#ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
-#ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
diff --git a/zsh/themes/kafeitu.zsh-theme b/zsh/themes/kafeitu.zsh-theme
index c4720b2..af96f5e 100644
--- a/zsh/themes/kafeitu.zsh-theme
+++ b/zsh/themes/kafeitu.zsh-theme
@@ -1,4 +1,4 @@
-PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%n%{$fg[cyan]%}@%{$fg_bold[green]%}%m %{$fg_bold[green]%}%p %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%n%{$fg[cyan]%}@%{$fg_bold[green]%}%m %{$fg_bold[green]%} %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
diff --git a/zsh/themes/kiwi.zsh-theme b/zsh/themes/kiwi.zsh-theme
index f93de2b..94f0ffc 100644
--- a/zsh/themes/kiwi.zsh-theme
+++ b/zsh/themes/kiwi.zsh-theme
@@ -1,6 +1,4 @@
-#
-# Kiwi ZSH Theme
-#
+(( $+functions[battery_pct_prompt] )) || function battery_pct_prompt { }
PROMPT='%{$fg_bold[green]%}┌[%{$fg_bold[cyan]%}kiwish-4.2%{$fg_bold[green]%}]-(%{$fg_bold[white]%}%2~%{$fg_bold[green]%})-$(git_prompt_info)$(svn_prompt_info)$(battery_pct_prompt)
└> % %{$reset_color%}'
diff --git a/zsh/themes/linuxonly.zsh-theme b/zsh/themes/linuxonly.zsh-theme
index f9e0aa0..2afae8f 100644
--- a/zsh/themes/linuxonly.zsh-theme
+++ b/zsh/themes/linuxonly.zsh-theme
@@ -1,7 +1,6 @@
-# vim: set ts=2 textwidth=0
-
autoload -U add-zsh-hook
autoload -Uz vcs_info
+
local c0=$(printf "\033[0m")
local c1=$(printf "\033[38;5;215m")
local c2=$(printf "\033[38;5;209m")
@@ -13,7 +12,6 @@ local c7=$(printf "\033[38;5;149m")
local c8=$(printf "\033[38;5;126m")
local c9=$(printf "\033[38;5;162m")
-
if [ "$TERM" = "linux" ]; then
c1=$(printf "\033[34;1m")
c2=$(printf "\033[35m")
@@ -26,9 +24,6 @@ if [ "$TERM" = "linux" ]; then
c9=$(printf "\033[34m")
fi
-#local newtv=$(perl $HOME/devel/newtv.pl)
-local newtv=''
-
zstyle ':vcs_info:*' actionformats \
'%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
zstyle ':vcs_info:*' formats \
@@ -42,38 +37,23 @@ prompt_jnrowe_precmd () {
vcs_info
if [ "${vcs_info_msg_0_}" = "" ]; then
- #dir_status="|%F{3}%n%F{7}@%F{3}%m%F{7}:%F{9}%l%f"
- #dir_status="$c1%n%F{7}@%F{9}%m%F{7}:%F{12}%/"
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
- #dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$foopath%} %{$c0%}(%{$c5%}%?%{$c0%})"
-
- PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%}
+ PROMPT='${dir_status} ${ret_status}%{$reset_color%}
> '
elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
PROMPT='${vcs_info_msg_0_}
-%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
+${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
> '
-
elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
-
PROMPT='${vcs_info_msg_0_}
-%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
+${dir_status}%{$reset_color%}
%{$c9%}·>%{$c0%} '
else
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
PROMPT='${vcs_info_msg_0_}
-%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
+${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
> '
-
fi
}
-
-
-#PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$reset_color%} ${vcs_info_msg_0_}${dir_status}%{$reset_color%}
-#> '
-
-# vim: set ft=zsh ts=4 sw=4 et:
-
-
diff --git a/zsh/themes/mlh.zsh-theme b/zsh/themes/mlh.zsh-theme
new file mode 100644
index 0000000..a21a546
--- /dev/null
+++ b/zsh/themes/mlh.zsh-theme
@@ -0,0 +1,59 @@
+# The Official Theme of
+## ## ## ## ##
+### ### ## ## ##
+#### #### ## ## ##
+## ### ## ## #########
+## ## ## ## ##
+## ## ## ## ##
+## ## ######## ## ##
+
+# # # # # # # # # # # # # # # # # #
+# # # Feel free to customize! # # #
+# # # # # # # # # # # # # # # # # #
+
+# To easily discover colors and their codes, type `spectrum_ls` in the terminal
+
+AT_SYMBOL=" @ "
+IN_SYMBOL=" in "
+ON_SYMBOL=" on "
+SYMBOL="$"
+
+USER_COLOR="%F{001}"
+DEVICE_COLOR="%F{033}"
+DIR_COLOR="%F{220}"
+BRANCH_COLOR="%F{001}"
+TIME_COLOR="%F{033}"
+
+username() {
+ echo "$USER_COLOR%n%f"
+}
+
+# Returns device name
+device() {
+ echo "$DEVICE_COLOR%m%f"
+}
+
+# The current directory
+directory() {
+ echo "$DIR_COLOR%1~%f"
+}
+
+# Current time with milliseconds
+current_time() {
+ echo "$TIME_COLOR%*%f"
+}
+
+# Return status of the last command
+return_status() {
+ echo "%(?..%F{001}out %?)%f"
+}
+
+# Set the git_prompt_info text
+ZSH_THEME_GIT_PROMPT_PREFIX="${ON_SYMBOL}${BRANCH_COLOR}"
+ZSH_THEME_GIT_PROMPT_SUFFIX="%f"
+ZSH_THEME_GIT_PROMPT_DIRTY=""
+ZSH_THEME_GIT_PROMPT_CLEAN=""
+
+# %B and %b make the text bold
+PROMPT='%b$(username)$AT_SYMBOL$(device)$IN_SYMBOL$(directory)$(git_prompt_info)%b $SYMBOL '
+RPROMPT="$(return_status) $(current_time)"
diff --git a/zsh/themes/muse.zsh-theme b/zsh/themes/muse.zsh-theme
index c7cd9ee..84bee52 100644
--- a/zsh/themes/muse.zsh-theme
+++ b/zsh/themes/muse.zsh-theme
@@ -1,33 +1,16 @@
-#!/usr/bin/env zsh
-#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
+PROMPT="${FG[117]}%~%{$reset_color%}\$(git_prompt_info)\$(virtualenv_prompt_info)${FG[133]}\$(git_prompt_status) ${FG[077]}ᐅ%{$reset_color%} "
-setopt promptsubst
+ZSH_THEME_GIT_PROMPT_PREFIX=" ${FG[012]}("
+ZSH_THEME_GIT_PROMPT_SUFFIX="${FG[012]})%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_DIRTY=" ${FG[133]}✘"
+ZSH_THEME_GIT_PROMPT_CLEAN=" ${FG[118]}✔"
-autoload -U add-zsh-hook
-
-PROMPT_SUCCESS_COLOR=$FG[117]
-PROMPT_FAILURE_COLOR=$FG[124]
-PROMPT_VCS_INFO_COLOR=$FG[242]
-PROMPT_PROMPT=$FG[077]
-GIT_DIRTY_COLOR=$FG[133]
-GIT_CLEAN_COLOR=$FG[118]
-GIT_PROMPT_INFO=$FG[012]
-
-PROMPT='%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%}%{$GIT_PROMPT_INFO%}$(git_prompt_info)$(virtualenv_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ%{$reset_color%} '
-
-#RPS1="${return_code}"
-
-ZSH_THEME_GIT_PROMPT_PREFIX=" ("
-ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%})"
-ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘"
-ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔"
-
-ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[082]%}✚%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[166]%}✹%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[160]%}✖%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[220]%}➜%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[082]%}═%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[190]%}✭%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_ADDED="${FG[082]}✚%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_MODIFIED="${FG[166]}✹%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_DELETED="${FG[160]}✖%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_RENAMED="${FG[220]}➜%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_UNMERGED="${FG[082]}═%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_UNTRACKED="${FG[190]}✭%{$reset_color%}"
ZSH_THEME_VIRTUALENV_PREFIX=" ["
ZSH_THEME_VIRTUALENV_SUFFIX="]"
diff --git a/zsh/themes/nebirhos.zsh-theme b/zsh/themes/nebirhos.zsh-theme
index e242446..fc05e79 100644
--- a/zsh/themes/nebirhos.zsh-theme
+++ b/zsh/themes/nebirhos.zsh-theme
@@ -11,7 +11,7 @@ else
fi
# Get the host name (first 4 chars)
-HOST_PROMPT_="%{$fg_bold[red]%}@$HOST ➜ %{$fg_bold[cyan]%}%c "
+HOST_PROMPT_="%{$fg_bold[red]%}@%m ➜ %{$fg_bold[cyan]%}%c "
GIT_PROMPT="%{$fg_bold[blue]%}\$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}"
PROMPT="$HOST_PROMPT_$RUBY_PROMPT_$GIT_PROMPT"
diff --git a/zsh/themes/norm.zsh-theme b/zsh/themes/norm.zsh-theme
index 13077cc..bd7ca56 100644
--- a/zsh/themes/norm.zsh-theme
+++ b/zsh/themes/norm.zsh-theme
@@ -1,4 +1,7 @@
-PROMPT='%{$fg[yellow]%}λ %m %{$fg[green]%}%c %{$fg[yellow]%}→ $(git_prompt_info)%{$reset_color%}'
+PROMPT='%{$fg[yellow]%}λ %m %{$fg[green]%}%c %{$fg[yellow]%}→ $(git_prompt_info)$(hg_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="λ %{$fg[blue]%}git %{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%} → %{$reset_color%}"
+ZSH_THEME_HG_PROMPT_PREFIX="λ %{$fg[blue]%}hg %{$fg[red]%}"
+ZSH_THEME_HG_PROMPT_SUFFIX="%{$fg[yellow]%} → %{$reset_color%}"
+
diff --git a/zsh/themes/peepcode.zsh-theme b/zsh/themes/peepcode.zsh-theme
index b6dfa68..0445346 100644
--- a/zsh/themes/peepcode.zsh-theme
+++ b/zsh/themes/peepcode.zsh-theme
@@ -4,11 +4,11 @@
#
git_repo_path() {
- git rev-parse --git-dir 2>/dev/null
+ command git rev-parse --git-dir 2>/dev/null
}
git_commit_id() {
- git rev-parse --short HEAD 2>/dev/null
+ command git rev-parse --short HEAD 2>/dev/null
}
git_mode() {
@@ -22,23 +22,26 @@ git_mode() {
}
git_dirty() {
- if [[ "$repo_path" != '.' && `git ls-files -m` != "" ]]; then
+ if [[ "$repo_path" != '.' && -n "$(command git ls-files -m)" ]]; then
echo " %{$fg_bold[grey]%}✗%{$reset_color%}"
fi
}
git_prompt() {
local cb=$(git_current_branch)
- if [ -n "$cb" ]; then
+ if [[ -n "$cb" ]]; then
local repo_path=$(git_repo_path)
echo " %{$fg_bold[grey]%}$cb %{$fg[white]%}$(git_commit_id)%{$reset_color%}$(git_mode)$(git_dirty)"
fi
}
-local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})"
+local smiley='%(?.%F{green}☺%f.%F{red}☹%f)'
PROMPT='
-%~
-${smiley} %{$reset_color%}'
+${VIRTUAL_ENV:+"($VIRTUAL_ENV) "}%~
+${smiley} '
-RPROMPT='%{$fg[white]%} $(ruby_prompt_info)$(git_prompt)%{$reset_color%}'
+RPROMPT='%F{white} $(ruby_prompt_info)$(git_prompt)%{$reset_color%}'
+
+# Disable automatic virtualenv prompt change
+export VIRTUAL_ENV_DISABLE_PROMPT=1
diff --git a/zsh/themes/pygmalion-virtualenv.zsh-theme b/zsh/themes/pygmalion-virtualenv.zsh-theme
index ea28e12..47b0b4f 100644
--- a/zsh/themes/pygmalion-virtualenv.zsh-theme
+++ b/zsh/themes/pygmalion-virtualenv.zsh-theme
@@ -17,6 +17,8 @@ function _virtualenv_prompt_info {
}
prompt_setup_pygmalion(){
+ setopt localoptions extendedglob
+
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
@@ -25,15 +27,18 @@ prompt_setup_pygmalion(){
base_prompt='$(_virtualenv_prompt_info)%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}'
post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} '
- base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
- post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g")
+ base_prompt_nocolor=${base_prompt//\%\{[^\}]##\}}
+ post_prompt_nocolor=${post_prompt//\%\{[^\}]##\}}
- precmd_functions+=(prompt_pygmalion_precmd)
+ autoload -U add-zsh-hook
+ add-zsh-hook precmd prompt_pygmalion_precmd
}
prompt_pygmalion_precmd(){
+ setopt localoptions extendedglob
+
local gitinfo=$(git_prompt_info)
- local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g")
+ local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}}
local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")"
local prompt_length=${#exp_nocolor}
@@ -46,5 +51,3 @@ prompt_pygmalion_precmd(){
}
prompt_setup_pygmalion
-
-
diff --git a/zsh/themes/pygmalion.zsh-theme b/zsh/themes/pygmalion.zsh-theme
index 5f5fe7f..b13adfd 100644
--- a/zsh/themes/pygmalion.zsh-theme
+++ b/zsh/themes/pygmalion.zsh-theme
@@ -1,6 +1,8 @@
# Yay! High voltage and arrows!
prompt_setup_pygmalion(){
+ setopt localoptions extendedglob
+
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
@@ -9,26 +11,22 @@ prompt_setup_pygmalion(){
base_prompt='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}'
post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} '
- base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
- post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g")
+ base_prompt_nocolor=${base_prompt//\%\{[^\}]##\}}
+ post_prompt_nocolor=${post_prompt//\%\{[^\}]##\}}
- precmd_functions+=(prompt_pygmalion_precmd)
+ autoload -U add-zsh-hook
+ add-zsh-hook precmd prompt_pygmalion_precmd
}
prompt_pygmalion_precmd(){
+ setopt localoptions extendedglob
+
local gitinfo=$(git_prompt_info)
- local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g")
+ local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}}
local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")"
local prompt_length=${#exp_nocolor}
- local nl=""
-
- if [[ $prompt_length -gt 40 ]]; then
- nl=$'\n%{\r%}';
- fi
- PROMPT="$base_prompt$gitinfo$nl$post_prompt"
+ PROMPT="${base_prompt}${gitinfo}${post_prompt}"
}
prompt_setup_pygmalion
-
-
diff --git a/zsh/themes/random.zsh-theme b/zsh/themes/random.zsh-theme
new file mode 100644
index 0000000..f0b8e5c
--- /dev/null
+++ b/zsh/themes/random.zsh-theme
@@ -0,0 +1,47 @@
+# Deprecate ZSH_THEME_RANDOM_BLACKLIST
+if [[ -n "$ZSH_THEME_RANDOM_BLACKLIST" ]]; then
+ echo '[oh-my-zsh] ZSH_THEME_RANDOM_BLACKLIST is deprecated. Use `ZSH_THEME_RANDOM_IGNORED` instead.'
+ ZSH_THEME_RANDOM_IGNORED=($ZSH_THEME_RANDOM_BLACKLIST)
+ unset ZSH_THEME_RANDOM_BLACKLIST
+fi
+
+# Make themes a unique array
+typeset -Ua themes
+
+if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = array && ${#ZSH_THEME_RANDOM_CANDIDATES[@]} -gt 0 ]]; then
+ # Use ZSH_THEME_RANDOM_CANDIDATES if properly defined
+ themes=(${(@)ZSH_THEME_RANDOM_CANDIDATES:#random})
+else
+ # Look for themes in $ZSH_CUSTOM and $ZSH and add only the theme name
+ themes=(
+ "$ZSH_CUSTOM"/*.zsh-theme(N:t:r)
+ "$ZSH_CUSTOM"/themes/*.zsh-theme(N:t:r)
+ "$ZSH"/themes/*.zsh-theme(N:t:r)
+ )
+ # Remove ignored themes from the list
+ for theme in random ${ZSH_THEME_RANDOM_IGNORED[@]}; do
+ themes=("${(@)themes:#$theme}")
+ done
+fi
+
+# Choose a theme out of the pool of candidates
+N=${#themes[@]}
+(( N = (RANDOM%N) + 1 ))
+RANDOM_THEME="${themes[$N]}"
+unset N themes theme
+
+# Source theme
+if [[ -f "$ZSH_CUSTOM/$RANDOM_THEME.zsh-theme" ]]; then
+ source "$ZSH_CUSTOM/$RANDOM_THEME.zsh-theme"
+elif [[ -f "$ZSH_CUSTOM/themes/$RANDOM_THEME.zsh-theme" ]]; then
+ source "$ZSH_CUSTOM/themes/$RANDOM_THEME.zsh-theme"
+elif [[ -f "$ZSH/themes/$RANDOM_THEME.zsh-theme" ]]; then
+ source "$ZSH/themes/$RANDOM_THEME.zsh-theme"
+else
+ echo "[oh-my-zsh] Random theme '${RANDOM_THEME}' not found"
+ return 1
+fi
+
+if [[ -z "$ZSH_THEME_RANDOM_QUIET" ]]; then
+ echo "[oh-my-zsh] Random theme '${RANDOM_THEME}' loaded"
+fi
diff --git a/zsh/themes/smt.zsh-theme b/zsh/themes/smt.zsh-theme
index f2b0526..7f54472 100644
--- a/zsh/themes/smt.zsh-theme
+++ b/zsh/themes/smt.zsh-theme
@@ -21,9 +21,9 @@ ZSH_THEME_GIT_PROMPT_SHA_BEFORE="➤ %{$fg_bold[yellow]%}"
ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}"
function prompt_char() {
- git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return
- hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return
- darcs show repo >/dev/null 2>/dev/null && echo "%{$fg_bold[green]%}❉%{$reset_color%}" && return
+ command git branch &>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return
+ command hg root &>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return
+ command darcs show repo &>/dev/null && echo "%{$fg_bold[green]%}❉%{$reset_color%}" && return
echo "%{$fg[cyan]%}◯%{$reset_color%}"
}
@@ -36,47 +36,44 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
# Determine the time since last commit. If branch is clean,
# use a neutral color, otherwise colors will vary according to time.
function git_time_since_commit() {
- if git rev-parse --git-dir > /dev/null 2>&1; then
- # Only proceed if there is actually a commit.
- if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then
- # Get the last commit.
- last_commit=`git log --pretty=format:'%at' -1 2> /dev/null`
- now=`date +%s`
- seconds_since_last_commit=$((now-last_commit))
+ local COLOR MINUTES HOURS DAYS SUB_HOURS SUB_MINUTES
+ local last_commit seconds_since_last_commit
- # Totals
- MINUTES=$((seconds_since_last_commit / 60))
- HOURS=$((seconds_since_last_commit/3600))
+ # Only proceed if there is actually a commit
+ if ! last_commit=$(command git log --pretty=format:'%at' -1 2>/dev/null); then
+ echo "[$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL~%{$reset_color%}]"
+ return
+ fi
- # Sub-hours and sub-minutes
- DAYS=$((seconds_since_last_commit / 86400))
- SUB_HOURS=$((HOURS % 24))
- SUB_MINUTES=$((MINUTES % 60))
+ # Totals
+ seconds_since_last_commit=$(( EPOCHSECONDS - last_commit ))
+ MINUTES=$(( seconds_since_last_commit / 60 ))
+ HOURS=$(( MINUTES / 60 ))
- if [[ -n $(git status -s 2> /dev/null) ]]; then
- if [ "$MINUTES" -gt 30 ]; then
- COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
- elif [ "$MINUTES" -gt 10 ]; then
- COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM"
- else
- COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT"
- fi
- else
- COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
- fi
+ # Sub-hours and sub-minutes
+ DAYS=$(( HOURS / 24 ))
+ SUB_HOURS=$(( HOURS % 24 ))
+ SUB_MINUTES=$(( MINUTES % 60 ))
- if [ "$HOURS" -gt 24 ]; then
- echo "[$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}]"
- elif [ "$MINUTES" -gt 60 ]; then
- echo "[$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}]"
- else
- echo "[$COLOR${MINUTES}m%{$reset_color%}]"
- fi
+ if [[ -z "$(command git status -s 2>/dev/null)" ]]; then
+ COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
+ else
+ if [[ "$MINUTES" -gt 30 ]]; then
+ COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
+ elif [[ "$MINUTES" -gt 10 ]]; then
+ COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM"
else
- COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
- echo "[$COLOR~]"
+ COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT"
fi
fi
+
+ if [[ "$HOURS" -gt 24 ]]; then
+ echo "[${COLOR}${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}]"
+ elif [[ "$MINUTES" -gt 60 ]]; then
+ echo "[${COLOR}${HOURS}h${SUB_MINUTES}m%{$reset_color%}]"
+ else
+ echo "[${COLOR}${MINUTES}m%{$reset_color%}]"
+ fi
}
PROMPT='
diff --git a/zsh/themes/sunrise.zsh-theme b/zsh/themes/sunrise.zsh-theme
index e3f4019..2111576 100644
--- a/zsh/themes/sunrise.zsh-theme
+++ b/zsh/themes/sunrise.zsh-theme
@@ -1,5 +1,5 @@
# Sunrise theme for oh-my-zsh
-# Intended to be used with Solarized: http://ethanschoonover.com/solarized
+# Intended to be used with Solarized: https://ethanschoonover.com/solarized
# Color shortcuts
R=$fg_no_bold[red]
diff --git a/zsh/themes/trapd00r.zsh-theme b/zsh/themes/trapd00r.zsh-theme
index 144d254..4e32383 100644
--- a/zsh/themes/trapd00r.zsh-theme
+++ b/zsh/themes/trapd00r.zsh-theme
@@ -2,7 +2,7 @@
#
# This theme needs a terminal supporting 256 colors as well as unicode.
# In order to avoid external dependencies, it also has a zsh version of
-# the perl script at https://github.com/trapd00r/utils/blob/master/zsh_path,
+# the previously used perl script https://github.com/trapd00r/utils/blob/master/zsh_path,
# which splits up the current path and makes it fancy.
#
# By default it spans over two lines like so:
@@ -109,23 +109,23 @@ prompt_jnrowe_precmd () {
vcs_info
if [ "${vcs_info_msg_0_}" = "" ]; then
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
- PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%}
+ PROMPT='${dir_status} ${ret_status}%{$reset_color%}
> '
# modified, to be committed
elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%}
-%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
+${dir_status}%{$reset_color%}
> '
elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%}
-%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
+${dir_status}%{$reset_color%}
%{$c13%}>%{$c0%} '
else
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
PROMPT='${vcs_info_msg_0_}
-%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
+${dir_status}%{$reset_color%}
> '
fi
}
diff --git a/zsh/themes/wedisagree.zsh-theme b/zsh/themes/wedisagree.zsh-theme
index aea0a45..07006ec 100644
--- a/zsh/themes/wedisagree.zsh-theme
+++ b/zsh/themes/wedisagree.zsh-theme
@@ -5,9 +5,9 @@
# - Place that bundle in ~/Library/Application\ Support/SIMBL/Plugins (create that folder if it doesn't exist)
# - Open Terminal preferences. Go to Settings -> Text -> More
# - Change default colours to your liking.
-#
+#
# Here are the colours from Textmate's Monokai theme:
-#
+#
# Black: 0, 0, 0
# Red: 229, 34, 34
# Green: 166, 227, 45
@@ -25,36 +25,35 @@ PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}'
# The right-hand prompt
-RPROMPT='$(git_super_status)%{$reset_color%}'
+RPROMPT='${time} %{$fg[magenta]%}$(git_prompt_info)%{$reset_color%}$(git_prompt_status)%{$reset_color%}$(git_prompt_ahead)%{$reset_color%}'
# Add this at the start of RPROMPT to include rvm info showing ruby-version@gemset-name
-# %{$fg[yellow]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%}
+# $(ruby_prompt_info)
# local time, color coded by last return code
time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}"
time_disabled="%{$fg[green]%}%*%{$reset_color%}"
time=$time_enabled
-ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%} ⑃ " # ☁
+ZSH_THEME_GIT_PROMPT_PREFIX=" ☁ %{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_DIRTY="" # Ⓓ ☂ %{$fg[yellow]%} ☶
-ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ?" # ⓣ ✭
-ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ✔" # Ⓞ ☀
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%} ☂" # Ⓓ
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" # ⓣ
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ☀" # Ⓞ
-ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[green]%} +" # ⓐ ⑃
-ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[yellow]%} ⚡" # ⓜ ⑁
-ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} -" # ⓧ ⑂
+ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✚" # ⓐ ⑃
+ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ⚡" # ⓜ ⑁
+ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" # ⓧ ⑂
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➜" # ⓡ ⑄
-ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[red]%} ♒" # ⓤ ⑊
-ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[yellow]%} ⩲"
-ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg[yellow]%} ⩱"
-ZSH_THEME_GIT_PROMPT_SEPARATOR=" \\"
+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ♒" # ⓤ ⑊
+ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[blue]%} 𝝙"
-ZSH_THEME_GIT_PROMPT_BRANCH="%{%}"
+ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[yellow]%}"
+ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}"
# More symbols to choose from:
# ☀ ✹ ☄ ♆ ♀ ♁ ♐ ♇ ♈ ♉ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♣ ⚢ ⚲ ⚳ ⚴ ⚥ ⚤ ⚦ ⚒ ⚑ ⚐ ♺ ♻ ♼ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷
-# ✡ ✔ ✖ ✚ ✱ ✤ ✦ ❤ ➜ ➟ ➼ ✂ ✎ ✐ ⨀ ⨁ ⨂ ⨍ ⨎ ⨏ ⨷ ⩚ ⩛ ⩡ ⩱ ⩲ ⩵ ⩶ ⨠
+# ✡ ✔ ✖ ✚ ✱ ✤ ✦ ❤ ➜ ➟ ➼ ✂ ✎ ✐ ⨀ ⨁ ⨂ ⨍ ⨎ ⨏ ⨷ ⩚ ⩛ ⩡ ⩱ ⩲ ⩵ ⩶ ⨠
# ⬅ ⬆ ⬇ ⬈ ⬉ ⬊ ⬋ ⬒ ⬓ ⬔ ⬕ ⬖ ⬗ ⬘ ⬙ ⬟ ⬤ 〒 ǀ ǁ ǂ ĭ Ť Ŧ
# Determine if we are using a gemset.
@@ -62,7 +61,7 @@ function rvm_gemset() {
GEMSET=`rvm gemset list | grep '=>' | cut -b4-`
if [[ -n $GEMSET ]]; then
echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|"
- fi
+ fi
}
# Determine the time since last commit. If branch is clean,
@@ -79,12 +78,12 @@ function git_time_since_commit() {
# Totals
MINUTES=$((seconds_since_last_commit / 60))
HOURS=$((seconds_since_last_commit/3600))
-
+
# Sub-hours and sub-minutes
DAYS=$((seconds_since_last_commit / 86400))
SUB_HOURS=$((HOURS % 24))
SUB_MINUTES=$((MINUTES % 60))
-
+
if [[ -n $(git status -s 2> /dev/null) ]]; then
if [ "$MINUTES" -gt 30 ]; then
COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
diff --git a/zsh/tools/check_for_upgrade.sh b/zsh/tools/check_for_upgrade.sh
index c8dedcf..cadd5fe 100644
--- a/zsh/tools/check_for_upgrade.sh
+++ b/zsh/tools/check_for_upgrade.sh
@@ -1,62 +1,88 @@
-#!/usr/bin/env zsh
-
-zmodload zsh/datetime
-
-function _current_epoch() {
- echo $(( $EPOCHSECONDS / 60 / 60 / 24 ))
-}
-
-function _update_zsh_update() {
- echo "LAST_EPOCH=$(_current_epoch)" >! ${ZSH_CACHE_DIR}/.zsh-update
-}
-
-function _upgrade_zsh() {
- env ZSH=$ZSH sh $ZSH/tools/upgrade.sh
- # update the zsh file
- _update_zsh_update
-}
-
-epoch_target=$UPDATE_ZSH_DAYS
-if [[ -z "$epoch_target" ]]; then
- # Default to old behavior
- epoch_target=13
+# Migrate .zsh-update file to $ZSH_CACHE_DIR
+if [[ -f ~/.zsh-update && ! -f "${ZSH_CACHE_DIR}/.zsh-update" ]]; then
+ mv ~/.zsh-update "${ZSH_CACHE_DIR}/.zsh-update"
fi
-# Cancel upgrade if the current user doesn't have write permissions for the
-# oh-my-zsh directory.
-[[ -w "$ZSH" ]] || return 0
+# Cancel update if:
+# - the automatic update is disabled.
+# - the current user doesn't have write permissions nor owns the $ZSH directory.
+# - git is unavailable on the system.
+if [[ "$DISABLE_AUTO_UPDATE" = true ]] \
+ || [[ ! -w "$ZSH" || ! -O "$ZSH" ]] \
+ || ! command -v git &>/dev/null; then
+ return
+fi
-# Cancel upgrade if git is unavailable on the system
-whence git >/dev/null || return 0
-if mkdir "$ZSH/log/update.lock" 2>/dev/null; then
- if [ -f ${ZSH_CACHE_DIR}/.zsh-update ]; then
- . ${ZSH_CACHE_DIR}/.zsh-update
+function current_epoch() {
+ zmodload zsh/datetime
+ echo $(( EPOCHSECONDS / 60 / 60 / 24 ))
+}
- if [[ -z "$LAST_EPOCH" ]]; then
- _update_zsh_update
- rmdir $ZSH/log/update.lock # TODO: fix later
- return 0
- fi
+function update_last_updated_file() {
+ echo "LAST_EPOCH=$(current_epoch)" >! "${ZSH_CACHE_DIR}/.zsh-update"
+}
- epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
- if [ $epoch_diff -gt $epoch_target ]; then
- if [ "$DISABLE_UPDATE_PROMPT" = "true" ]; then
- _upgrade_zsh
- else
- echo "[Oh My Zsh] Would you like to update? [Y/n]: \c"
- read line
- if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then
- _upgrade_zsh
- else
- _update_zsh_update
+function update_ohmyzsh() {
+ ZSH="$ZSH" sh "$ZSH/tools/upgrade.sh"
+ update_last_updated_file
+}
+
+() {
+ emulate -L zsh
+
+ local epoch_target mtime option LAST_EPOCH
+
+ # Remove lock directory if older than a day
+ zmodload zsh/datetime
+ zmodload -F zsh/stat b:zstat
+ if mtime=$(zstat +mtime "$ZSH/log/update.lock" 2>/dev/null); then
+ if (( (mtime + 3600 * 24) < EPOCHSECONDS )); then
+ command rm -rf "$ZSH/log/update.lock"
fi
- fi
fi
- else
- # create the zsh file
- _update_zsh_update
- fi
- rmdir $ZSH/log/update.lock
-fi
+ # Check for lock directory
+ if ! command mkdir "$ZSH/log/update.lock" 2>/dev/null; then
+ return
+ fi
+
+ # Remove lock directory on exit. `return 1` is important for when trapping a SIGINT:
+ # The return status from the function is handled specially. If it is zero, the signal is
+ # assumed to have been handled, and execution continues normally. Otherwise, the shell
+ # will behave as interrupted except that the return status of the trap is retained.
+ trap "command rm -rf '$ZSH/log/update.lock'; return 1" EXIT INT QUIT
+
+ # Create or update .zsh-update file if missing or malformed
+ if ! source "${ZSH_CACHE_DIR}/.zsh-update" 2>/dev/null || [[ -z "$LAST_EPOCH" ]]; then
+ update_last_updated_file
+ return
+ fi
+
+ # Number of days before trying to update again
+ epoch_target=${UPDATE_ZSH_DAYS:-13}
+ # Test if enough time has passed until the next update
+ if (( ( $(current_epoch) - $LAST_EPOCH ) < $epoch_target )); then
+ return
+ fi
+
+ # Ask for confirmation before updating unless disabled
+ if [[ "$DISABLE_UPDATE_PROMPT" = true ]]; then
+ update_ohmyzsh
+ else
+ # input sink to swallow all characters typed before the prompt
+ # and add a newline if there wasn't one after characters typed
+ while read -t -k 1 option; do true; done
+ [[ "$option" != ($'\n'|"") ]] && echo
+
+ echo -n "[oh-my-zsh] Would you like to update? [Y/n] "
+ read -r -k 1 option
+ [[ "$option" != $'\n' ]] && echo
+ case "$option" in
+ [yY$'\n']) update_ohmyzsh ;;
+ [nN]) update_last_updated_file ;;
+ esac
+ fi
+}
+
+unset -f current_epoch update_last_updated_file update_ohmyzsh
diff --git a/zsh/tools/install.sh b/zsh/tools/install.sh
index 6101021..61b21cb 100755
--- a/zsh/tools/install.sh
+++ b/zsh/tools/install.sh
@@ -1,12 +1,14 @@
#!/bin/sh
#
# This script should be run via curl:
-# sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
-# or wget:
-# sh -c "$(wget -qO- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
+# sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
+# or via wget:
+# sh -c "$(wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
+# or via fetch:
+# sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
#
# As an alternative, you can first download the install script and run it afterwards:
-# wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
+# wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
# sh install.sh
#
# You can tweak the install behavior by setting variables when running the script. For
@@ -15,31 +17,36 @@
#
# Respects the following environment variables:
# ZSH - path to the Oh My Zsh repository folder (default: $HOME/.oh-my-zsh)
-# REPO - name of the GitHub repo to install from (default: robbyrussell/oh-my-zsh)
+# REPO - name of the GitHub repo to install from (default: ohmyzsh/ohmyzsh)
# REMOTE - full remote URL of the git repo to install (default: GitHub via HTTPS)
# BRANCH - branch to check out immediately after install (default: master)
#
# Other options:
-# CHSH - 'no' means the installer will not change the default shell (default: yes)
-# RUNZSH - 'no' means the installer will not run zsh after the install (default: yes)
+# CHSH - 'no' means the installer will not change the default shell (default: yes)
+# RUNZSH - 'no' means the installer will not run zsh after the install (default: yes)
+# KEEP_ZSHRC - 'yes' means the installer will not replace an existing .zshrc (default: no)
#
# You can also pass some arguments to the install script to set some these options:
# --skip-chsh: has the same behavior as setting CHSH to 'no'
# --unattended: sets both CHSH and RUNZSH to 'no'
+# --keep-zshrc: sets KEEP_ZSHRC to 'yes'
# For example:
# sh install.sh --unattended
+# or:
+# sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
#
set -e
# Default settings
ZSH=${ZSH:-~/.oh-my-zsh}
-REPO=${REPO:-robbyrussell/oh-my-zsh}
+REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git}
BRANCH=${BRANCH:-master}
# Other options
CHSH=${CHSH:-yes}
RUNZSH=${RUNZSH:-yes}
+KEEP_ZSHRC=${KEEP_ZSHRC:-no}
command_exists() {
@@ -50,6 +57,10 @@ error() {
echo ${RED}"Error: $@"${RESET} >&2
}
+underline() {
+ echo "$(printf '\033[4m')$@$(printf '\033[24m')"
+}
+
setup_color() {
# Only use colors if connected to a terminal
if [ -t 1 ]; then
@@ -90,7 +101,11 @@ setup_ohmyzsh() {
exit 1
fi
- git clone --depth=1 --branch "$BRANCH" "$REMOTE" "$ZSH" || {
+ git clone -c core.eol=lf -c core.autocrlf=false \
+ -c fsck.zeroPaddedFilemode=ignore \
+ -c fetch.fsck.zeroPaddedFilemode=ignore \
+ -c receive.fsck.zeroPaddedFilemode=ignore \
+ --depth=1 --branch "$BRANCH" "$REMOTE" "$ZSH" || {
error "git clone of oh-my-zsh repo failed"
exit 1
}
@@ -107,6 +122,11 @@ setup_zshrc() {
# Must use this exact name so uninstall.sh can find it
OLD_ZSHRC=~/.zshrc.pre-oh-my-zsh
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
+ # Skip this if the user doesn't want to replace an existing .zshrc
+ if [ $KEEP_ZSHRC = yes ]; then
+ echo "${YELLOW}Found ~/.zshrc.${RESET} ${GREEN}Keeping...${RESET}"
+ return
+ fi
if [ -e "$OLD_ZSHRC" ]; then
OLD_OLD_ZSHRC="${OLD_ZSHRC}-$(date +%Y-%m-%d_%H-%M-%S)"
if [ -e "$OLD_OLD_ZSHRC" ]; then
@@ -125,10 +145,9 @@ setup_zshrc() {
echo "${GREEN}Using the Oh My Zsh template file and adding it to ~/.zshrc.${RESET}"
- cp "$ZSH/templates/zshrc.zsh-template" ~/.zshrc
sed "/^export ZSH=/ c\\
export ZSH=\"$ZSH\"
-" ~/.zshrc > ~/.zshrc-omztemp
+" "$ZSH/templates/zshrc.zsh-template" > ~/.zshrc-omztemp
mv -f ~/.zshrc-omztemp ~/.zshrc
echo
@@ -224,6 +243,7 @@ main() {
case $1 in
--unattended) RUNZSH=no; CHSH=no ;;
--skip-chsh) CHSH=no ;;
+ --keep-zshrc) KEEP_ZSHRC=yes ;;
esac
shift
done
@@ -257,11 +277,13 @@ main() {
/____/ ....is now installed!
- Please look over the ~/.zshrc file to select plugins, themes, and options.
+ EOF
+ cat <<-EOF
+ Before you scream Oh My Zsh! please look over the ~/.zshrc file to select plugins, themes, and options.
- p.s. Follow us on https://twitter.com/ohmyzsh
-
- p.p.s. Get stickers, shirts, and coffee mugs at https://shop.planetargon.com/collections/oh-my-zsh
+ • Follow us on Twitter: $(underline https://twitter.com/ohmyzsh)
+ • Join our Discord server: $(underline https://discord.gg/ohmyzsh)
+ • Get stickers, shirts, coffee mugs and other swag: $(underline https://shop.planetargon.com/collections/oh-my-zsh)
EOF
printf "$RESET"
diff --git a/zsh/tools/uninstall.sh b/zsh/tools/uninstall.sh
index da31a6a..b327a01 100644
--- a/zsh/tools/uninstall.sh
+++ b/zsh/tools/uninstall.sh
@@ -25,18 +25,14 @@ if [ -e "$ZSHRC_ORIG" ]; then
echo "Your original zsh config was restored."
fi
-if hash chsh >/dev/null 2>&1; then
- if [ -f ~/.shell.pre-oh-my-zsh ]; then
- old_shell=$(cat ~/.shell.pre-oh-my-zsh)
- else
- old_shell=/bin/bash
- fi
+if hash chsh >/dev/null 2>&1 && [ -f ~/.shell.pre-oh-my-zsh ]; then
+ old_shell=$(cat ~/.shell.pre-oh-my-zsh)
echo "Switching your shell back to '$old_shell':"
if chsh -s "$old_shell"; then
rm -f ~/.shell.pre-oh-my-zsh
else
echo "Could not change default shell. Change it manually by running chsh"
- echo "or editing the /etc/passwd file."
+ echo "or editing the /etc/passwd file."
fi
fi
diff --git a/zsh/tools/upgrade.sh b/zsh/tools/upgrade.sh
index d234c7f..e005519 100644
--- a/zsh/tools/upgrade.sh
+++ b/zsh/tools/upgrade.sh
@@ -1,39 +1,82 @@
-
# Use colors, but only if connected to a terminal, and that terminal
# supports them.
-if which tput >/dev/null 2>&1; then
- ncolors=$(tput colors)
-fi
-if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
- RED="$(tput setaf 1)"
- GREEN="$(tput setaf 2)"
- YELLOW="$(tput setaf 3)"
- BLUE="$(tput setaf 4)"
- BOLD="$(tput bold)"
- NORMAL="$(tput sgr0)"
+if [ -t 1 ]; then
+ RB_RED=$(printf '\033[38;5;196m')
+ RB_ORANGE=$(printf '\033[38;5;202m')
+ RB_YELLOW=$(printf '\033[38;5;226m')
+ RB_GREEN=$(printf '\033[38;5;082m')
+ RB_BLUE=$(printf '\033[38;5;021m')
+ RB_INDIGO=$(printf '\033[38;5;093m')
+ RB_VIOLET=$(printf '\033[38;5;163m')
+
+ RED=$(printf '\033[31m')
+ GREEN=$(printf '\033[32m')
+ YELLOW=$(printf '\033[33m')
+ BLUE=$(printf '\033[34m')
+ BOLD=$(printf '\033[1m')
+ UNDER=$(printf '\033[4m')
+ RESET=$(printf '\033[m')
else
+ RB_RED=""
+ RB_ORANGE=""
+ RB_YELLOW=""
+ RB_GREEN=""
+ RB_BLUE=""
+ RB_INDIGO=""
+ RB_VIOLET=""
+
RED=""
GREEN=""
YELLOW=""
BLUE=""
+ UNDER=""
BOLD=""
- NORMAL=""
+ RESET=""
fi
-printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh"
cd "$ZSH"
+
+# Set git-config values known to fix git errors
+# Line endings (#4069)
+git config core.eol lf
+git config core.autocrlf false
+# zeroPaddedFilemode fsck errors (#4963)
+git config fsck.zeroPaddedFilemode ignore
+git config fetch.fsck.zeroPaddedFilemode ignore
+git config receive.fsck.zeroPaddedFilemode ignore
+# autostash on rebase (#7172)
+resetAutoStash=$(git config --bool rebase.autoStash 2>&1)
+git config rebase.autoStash true
+
+# Update upstream remote to ohmyzsh org
+remote=$(git remote -v | awk '/https:\/\/github\.com\/robbyrussell\/oh-my-zsh\.git/{ print $1; exit }')
+if [ -n "$remote" ]; then
+ git remote set-url "$remote" "https://github.com/ohmyzsh/ohmyzsh.git"
+fi
+
+printf "${BLUE}%s${RESET}\n" "Updating Oh My Zsh"
if git pull --rebase --stat origin master
then
- printf '%s' "$GREEN"
- printf '%s\n' ' __ __ '
- printf '%s\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
- printf '%s\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
- printf '%s\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
- printf '%s\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
- printf '%s\n' ' /____/ '
+ printf '%s %s__ %s %s %s %s %s__ %s\n' $RB_RED $RB_ORANGE $RB_YELLOW $RB_GREEN $RB_BLUE $RB_INDIGO $RB_VIOLET $RB_RESET
+ printf '%s ____ %s/ /_ %s ____ ___ %s__ __ %s ____ %s_____%s/ /_ %s\n' $RB_RED $RB_ORANGE $RB_YELLOW $RB_GREEN $RB_BLUE $RB_INDIGO $RB_VIOLET $RB_RESET
+ printf '%s / __ \%s/ __ \ %s / __ `__ \%s/ / / / %s /_ / %s/ ___/%s __ \ %s\n' $RB_RED $RB_ORANGE $RB_YELLOW $RB_GREEN $RB_BLUE $RB_INDIGO $RB_VIOLET $RB_RESET
+ printf '%s/ /_/ /%s / / / %s / / / / / /%s /_/ / %s / /_%s(__ )%s / / / %s\n' $RB_RED $RB_ORANGE $RB_YELLOW $RB_GREEN $RB_BLUE $RB_INDIGO $RB_VIOLET $RB_RESET
+ printf '%s\____/%s_/ /_/ %s /_/ /_/ /_/%s\__, / %s /___/%s____/%s_/ /_/ %s\n' $RB_RED $RB_ORANGE $RB_YELLOW $RB_GREEN $RB_BLUE $RB_INDIGO $RB_VIOLET $RB_RESET
+ printf '%s %s %s %s /____/ %s %s %s %s\n' $RB_RED $RB_ORANGE $RB_YELLOW $RB_GREEN $RB_BLUE $RB_INDIGO $RB_VIOLET $RB_RESET
printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version."
- printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh"
- printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh"
+ printf "${BLUE}${BOLD}%s ${UNDER}%s${RESET}\n" "To keep up on the latest news and updates, follow us on Twitter:" "https://twitter.com/ohmyzsh"
+ printf "${BLUE}${BOLD}%s ${UNDER}%s${RESET}\n" "Want to get involved in the community? Join our Discord:" "https://discord.gg/ohmyzsh"
+ printf "${BLUE}${BOLD}%s ${UNDER}%s${RESET}\n" "Get your Oh My Zsh swag at:" "https://shop.planetargon.com/collections/oh-my-zsh"
else
- printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?'
+ status=$?
+ printf "${RED}%s${RESET}\n" 'There was an error updating. Try again later?'
fi
+
+# Unset git-config values set just for the upgrade
+case "$resetAutoStash" in
+ "") git config --unset rebase.autoStash ;;
+ *) git config rebase.autoStash "$resetAutoStash" ;;
+esac
+
+# Exit with `1` if the update failed
+exit $status
diff --git a/zsh/zshrc b/zsh/zshrc
deleted file mode 100644
index 7762af7..0000000
--- a/zsh/zshrc
+++ /dev/null
@@ -1,122 +0,0 @@
-# If you come from bash you might have to change your $PATH.
-# export PATH=$HOME/bin:/usr/local/bin:$PATH
-
-# Path to your oh-my-zsh installation.
-export ZSH=$HOME/.dots/zsh
-
-# Set name of the theme to load --- if set to "random", it will
-# load a random theme each time oh-my-zsh is loaded, in which case,
-# to know which specific one was loaded, run: echo $RANDOM_THEME
-# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
-ZSH_THEME="eof"
-
-# Setup eof theme mode
-# [mega|big|small|tiny]
-#ZSH_THEME_EOF_MODE="small"
-
-# Auto setup eof theme mode
-if [[ -n "$TMUX" ]]; then
- ZSH_THEME_EOF_MODE="tiny"
-else
- ZSH_THEME_EOF_MODE="small"
-fi
-
-# Set list of themes to pick from when loading at random
-# Setting this variable when ZSH_THEME=random will cause zsh to load
-# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
-# If set to an empty array, this variable will have no effect.
-# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
-
-# Uncomment the following line to use case-sensitive completion.
-# CASE_SENSITIVE="true"
-
-# Uncomment the following line to use hyphen-insensitive completion.
-# Case-sensitive completion must be off. _ and - will be interchangeable.
-# HYPHEN_INSENSITIVE="true"
-
-# Uncomment the following line to disable bi-weekly auto-update checks.
-# DISABLE_AUTO_UPDATE="true"
-
-# Uncomment the following line to automatically update without prompting.
-DISABLE_UPDATE_PROMPT="true"
-
-# Uncomment the following line to change how often to auto-update (in days).
-export UPDATE_ZSH_DAYS=5
-
-# Uncomment the following line if pasting URLs and other text is messed up.
-# DISABLE_MAGIC_FUNCTIONS=true
-
-# Uncomment the following line to disable colors in ls.
-# DISABLE_LS_COLORS="true"
-
-# Uncomment the following line to disable auto-setting terminal title.
-# DISABLE_AUTO_TITLE="true"
-
-# Uncomment the following line to enable command auto-correction.
-# ENABLE_CORRECTION="true"
-
-# Uncomment the following line to display red dots whilst waiting for completion.
-# COMPLETION_WAITING_DOTS="true"
-
-# Uncomment the following line if you want to disable marking untracked files
-# under VCS as dirty. This makes repository status check for large repositories
-# much, much faster.
-# DISABLE_UNTRACKED_FILES_DIRTY="true"
-
-# Uncomment the following line if you want to change the command execution time
-# stamp shown in the history command output.
-# You can set one of the optional three formats:
-# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
-# or set a custom format using the strftime function format specifications,
-# see 'man strftime' for details.
-# HIST_STAMPS="mm/dd/yyyy"
-
-# Would you like to use another custom folder than $ZSH/custom?
-# ZSH_CUSTOM=/path/to/new-custom-folder
-
-# Which plugins would you like to load?
-# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
-# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
-# Example format: plugins=(rails git textmate ruby lighthouse)
-# Add wisely, as too many plugins slow down shell startup.
-plugins=(git themes common-aliases git-prompt)
-
-source $ZSH/oh-my-zsh.sh
-
-# User configuration
-
-# export MANPATH="/usr/local/man:$MANPATH"
-
-# You may need to manually set your language environment
-# export LANG=en_US.UTF-8
-
-# Preferred editor for local and remote sessions
-if [[ -n $SSH_CONNECTION ]]; then
- export EDITOR='vim'
-else
- export EDITOR='vim'
-fi
-
-# Compilation flags
-# export ARCHFLAGS="-arch x86_64"
-
-# Set personal aliases, overriding those provided by oh-my-zsh libs,
-# plugins, and themes. Aliases can be placed here, though oh-my-zsh
-# users are encouraged to define aliases within the ZSH_CUSTOM folder.
-# For a full list of active aliases, run `alias`.
-#
-# Example aliases
-# alias zshconfig="mate ~/.zshrc"
-# alias ohmyzsh="mate ~/.oh-my-zsh"
-
-# Autostart tmux in SSH-session
-if $(type tmux &>/dev/null); then
- if [ -n "$SSH_CONNECTION" ]; then
- if [ -z "$TMUX" ]; then
- tmux attach -d || tmux new
- fi
- fi
-fi
-
-# Disable history sharing
-unsetopt share_history