mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-24 06:40:07 +00:00
Merge branch 'master' into clipboard
This commit is contained in:
commit
18ee5dffdc
261 changed files with 5590 additions and 2782 deletions
33
.github/ISSUE_TEMPLATE/bug_report.md
vendored
33
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
name: Bug report
|
name: Bug report
|
||||||
about: Create a report to help us improve
|
about: Create a report to help us improve Oh My Zsh
|
||||||
labels: 'Type: bug'
|
labels: 'Type: support'
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -11,29 +11,26 @@ an issue where no sections have been filled will be deleted without comment.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
**Describe the bug**
|
**Describe the bug**
|
||||||
<!-- A clear and concise description of what the bug is. -->
|
A clear description of what the bug is.
|
||||||
|
|
||||||
**To Reproduce**
|
**To Reproduce**
|
||||||
<!--
|
Steps to reproduce the behavior, for example:
|
||||||
Steps to reproduce the behavior:
|
1. Enable this plugin '...'
|
||||||
1. Enable plugin '...'
|
2. Run command '...' or try the autocomplete command '...'
|
||||||
2. Run command '...', _or_ try to complete command '...', _etc._
|
|
||||||
3. See error
|
3. See error
|
||||||
-->
|
|
||||||
|
|
||||||
**Expected behavior**
|
**Expected behavior**
|
||||||
<!-- A clear and concise description of what you expected to happen. -->
|
A brief description of what should happen.
|
||||||
|
|
||||||
**Screenshots or recordings**
|
**Screenshots and/or Recordings**
|
||||||
<!--
|
If applicable, add screenshots to help explain your problem.
|
||||||
If applicable, add screenshots or record an asciinema session (https://asciinema.org/)
|
You can also record an asciinema session: https://asciinema.org/
|
||||||
to help explain your problem.
|
|
||||||
-->
|
|
||||||
|
|
||||||
**System:**
|
**Desktop (please complete the following information):**
|
||||||
- OS: [e.g. macOS]
|
- OS / Distro: [e.g. Arch Linux, macOS]
|
||||||
- Zsh version [e.g. 5.6]
|
- Latest ohmyzsh Update?: [e.g. Yes/No]
|
||||||
|
- ZSH Version: [e.g. 5.6]
|
||||||
- Terminal emulator [e.g. iTerm2]
|
- Terminal emulator [e.g. iTerm2]
|
||||||
|
|
||||||
**Additional context**
|
**Additional context**
|
||||||
<!-- Add any other context about the problem here. -->
|
Add any other context about the problem here. This can be themes, plugins, custom configs.
|
||||||
|
|
10
.github/ISSUE_TEMPLATE/feature_request.md
vendored
10
.github/ISSUE_TEMPLATE/feature_request.md
vendored
|
@ -11,16 +11,16 @@ an issue where no sections have been filled will be deleted without comment.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
**Is your feature request related to a particular plugin or theme? If so, specify it.**
|
**Is your feature request related to a particular plugin or theme? If so, specify it.**
|
||||||
<!-- The name of the plugin or theme you'd like us to improve. -->
|
The name of the plugin or theme that you would like us to improve. [...]
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
**Is your feature request related to a problem? Please describe.**
|
||||||
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
|
A description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
**Describe the solution you'd like**
|
**Describe the solution you'd like**
|
||||||
<!-- A clear and concise description of what you want to happen. -->
|
A description of what you want to happen.
|
||||||
|
|
||||||
**Describe alternatives you've considered**
|
**Describe alternatives you've considered**
|
||||||
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
|
A description of any alternative solutions or features you've considered. This can also include other plugins or aliases.
|
||||||
|
|
||||||
**Additional context**
|
**Additional context**
|
||||||
<!-- Add any other context or screenshots about the feature request here. -->
|
Add any other context or screenshots 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.
|
||||||
|
|
2
.github/ISSUE_TEMPLATE/support.md
vendored
2
.github/ISSUE_TEMPLATE/support.md
vendored
|
@ -5,8 +5,6 @@ labels: 'Type: support'
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<!--
|
|
||||||
1. Look for similar issues already posted (including closed ones)
|
1. Look for similar issues already posted (including closed ones)
|
||||||
2. Include as much relevant information as possible
|
2. Include as much relevant information as possible
|
||||||
3. Try to make sure the issue is due to Oh My Zsh
|
3. Try to make sure the issue is due to Oh My Zsh
|
||||||
-->
|
|
||||||
|
|
17
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
17
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
## 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:
|
||||||
|
|
||||||
|
...
|
17
.github/main.workflow
vendored
17
.github/main.workflow
vendored
|
@ -1,17 +0,0 @@
|
||||||
workflow "Triage Pull Request" {
|
|
||||||
on = "pull_request"
|
|
||||||
resolves = ["Triage"]
|
|
||||||
}
|
|
||||||
|
|
||||||
# Only act if there are code changes: if the pull_request
|
|
||||||
# event's action is either 'opened' (new PR) or 'synchronize' (new commits)
|
|
||||||
action "Filter actions" {
|
|
||||||
uses = "actions/bin/filter@0ac6d44"
|
|
||||||
args = "action 'opened|synchronize'"
|
|
||||||
}
|
|
||||||
|
|
||||||
action "Triage" {
|
|
||||||
needs = ["Filter actions"]
|
|
||||||
uses = "ohmyzsh/github-actions/pull-request-triage@master"
|
|
||||||
secrets = ["GITHUB_TOKEN"]
|
|
||||||
}
|
|
36
.github/workflows/main.yml
vendored
Normal file
36
.github/workflows/main.yml
vendored
Normal file
|
@ -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
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,3 +4,5 @@ custom/
|
||||||
# temp files directories
|
# temp files directories
|
||||||
cache/
|
cache/
|
||||||
log/
|
log/
|
||||||
|
*.swp
|
||||||
|
.DS_Store
|
||||||
|
|
|
@ -31,7 +31,7 @@ your problem.
|
||||||
|
|
||||||
If you find one, comment on it so we can know there are more people experiencing it.
|
If you find one, comment on it so we can know there are more people experiencing it.
|
||||||
|
|
||||||
If not, look at the [Troubleshooting](https://github.com/robbyrussell/oh-my-zsh/wiki/Troubleshooting)
|
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.
|
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.
|
Then, you can go ahead and create an issue with as much detail as you can provide.
|
||||||
|
@ -62,7 +62,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa
|
||||||
|
|
||||||
You should be familiar with the basics of
|
You should be familiar with the basics of
|
||||||
[contributing on GitHub](https://help.github.com/articles/using-pull-requests) and have a fork
|
[contributing on GitHub](https://help.github.com/articles/using-pull-requests) and have a fork
|
||||||
[properly set up](https://github.com/robbyrussell/oh-my-zsh/wiki/Contribution-Technical-Practices).
|
[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.
|
You MUST always create PRs with _a dedicated branch_ based on the latest upstream tree.
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa
|
||||||
|
|
||||||
### You have an addition
|
### You have an addition
|
||||||
|
|
||||||
Please [do not](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#dont-send-us-your-theme-for-now)
|
Please [do not](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#dont-send-us-your-theme-for-now)
|
||||||
send themes 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
|
Please be so kind as to [search](#use-the-search-luke) for any pending, merged or rejected Pull Requests
|
||||||
|
@ -109,7 +109,7 @@ to help you check whether a similar contribution to yours already exists. Please
|
||||||
before making any contribution, it avoids duplicates and eases maintenance. Trust me,
|
before making any contribution, it avoids duplicates and eases maintenance. Trust me,
|
||||||
that works 90% of the time.
|
that works 90% of the time.
|
||||||
|
|
||||||
You can also take a look at the [FAQ](https://github.com/robbyrussell/oh-my-zsh/wiki/FAQ)
|
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.
|
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
|
If all fails, your thing has probably not been reported yet, so you can go ahead
|
||||||
|
@ -121,5 +121,5 @@ and [create an issue](#reporting-issues) or [submit a PR](#submitting-pull-reque
|
||||||
|
|
||||||
Very nice!! :)
|
Very nice!! :)
|
||||||
|
|
||||||
Please have a look at the [Volunteer](https://github.com/robbyrussell/oh-my-zsh/wiki/Volunteers)
|
Please have a look at the [Volunteer](https://github.com/ohmyzsh/ohmyzsh/wiki/Volunteers)
|
||||||
page for instructions on where to start and more.
|
page for instructions on where to start and more.
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
The MIT License (MIT)
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2009-2019 Robby Russell and contributors
|
Copyright (c) 2009-2020 Robby Russell and contributors (https://github.com/ohmyzsh/ohmyzsh/contributors)
|
||||||
See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
40
README.md
40
README.md
|
@ -12,16 +12,18 @@ Once installed, your terminal shell will become the talk of the town _or your mo
|
||||||
|
|
||||||
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. 😬
|
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/or join us on Discord.
|
||||||
|
|
||||||
|
[![CI](https://github.com/ohmyzsh/ohmyzsh/workflows/CI/badge.svg)](https://github.com/ohmyzsh/ohmyzsh/actions?query=workflow%3ACI)
|
||||||
|
[![Follow @ohmyzsh](https://img.shields.io/twitter/follow/ohmyzsh?label=Follow+@ohmyzsh&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh)
|
||||||
|
[![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/bpXWhnN)
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
__Disclaimer:__ _Oh My Zsh works best on macOS and Linux._
|
* A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL is preferred, but cygwin or msys also mostly work.
|
||||||
|
* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (run `zsh --version` to confirm), check the following instructions here: [Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH)
|
||||||
* 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
|
* `curl` or `wget` should be installed
|
||||||
* `git` should be installed
|
* `git` should be installed
|
||||||
|
|
||||||
|
@ -32,13 +34,13 @@ Oh My Zsh is installed by running one of the following commands in your terminal
|
||||||
#### via curl
|
#### via curl
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sh -c "$(curl -fsSL 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)"
|
||||||
```
|
```
|
||||||
|
|
||||||
#### via wget
|
#### via wget
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sh -c "$(wget -O- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Manual inspection
|
#### Manual inspection
|
||||||
|
@ -48,7 +50,7 @@ that by downloading the install script first, looking through it so everything l
|
||||||
then running it:
|
then running it:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl -Lo install.sh https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
|
curl -Lo install.sh https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
|
||||||
sh install.sh
|
sh install.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -56,7 +58,7 @@ sh install.sh
|
||||||
|
|
||||||
### Plugins
|
### 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 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
|
#### Enabling Plugins
|
||||||
|
|
||||||
|
@ -88,7 +90,7 @@ Most plugins (should! we're working on this) include a __README__, which documen
|
||||||
|
|
||||||
### Themes
|
### 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 themes now bundled. Most of them have [screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki. Check them out!
|
||||||
|
|
||||||
#### Selecting a Theme
|
#### Selecting a Theme
|
||||||
|
|
||||||
|
@ -104,7 +106,7 @@ To use a different theme, simply change the value to match the name of your desi
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
ZSH_THEME="agnoster" # (this is one of the fancy ones)
|
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._
|
_Note: many themes require installing the [Powerline Fonts](https://github.com/powerline/fonts) in order to render properly._
|
||||||
|
@ -113,7 +115,7 @@ Open up a new terminal window and your prompt should look something like this:
|
||||||
|
|
||||||
![Agnoster theme](https://cloud.githubusercontent.com/assets/2618447/6316862/70f58fb6-ba03-11e4-82c9-c083bf9a6574.png)
|
![Agnoster theme](https://cloud.githubusercontent.com/assets/2618447/6316862/70f58fb6-ba03-11e4-82c9-c083bf9a6574.png)
|
||||||
|
|
||||||
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.
|
If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window.
|
||||||
|
|
||||||
|
@ -131,6 +133,10 @@ ZSH_THEME_RANDOM_CANDIDATES=(
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 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
|
## Advanced Topics
|
||||||
|
|
||||||
If you're the type that likes to get their hands dirty, these sections might resonate.
|
If you're the type that likes to get their hands dirty, these sections might resonate.
|
||||||
|
@ -159,14 +165,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.
|
the default shell, and also won't run `zsh` when the installation has finished.
|
||||||
|
|
||||||
```shell
|
```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
|
#### Installing from a forked repository
|
||||||
|
|
||||||
The install script also accepts these variables to allow installation of a different 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}`.
|
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
|
- `REMOTE` (default: `https://github.com/${REPO}.git`): this is the full URL of the git repository
|
||||||
|
@ -190,7 +196,7 @@ REPO=apjanke/oh-my-zsh BRANCH=edge sh install.sh
|
||||||
##### 1. Clone the repository:
|
##### 1. Clone the repository:
|
||||||
|
|
||||||
```shell
|
```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:
|
||||||
|
@ -272,13 +278,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!
|
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.
|
See [Contributing](CONTRIBUTING.md) for more details.
|
||||||
|
|
||||||
### Do NOT send us themes
|
### 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
|
## Contributors
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ function detect-clipboard() {
|
||||||
if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then
|
if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then
|
||||||
function clipcopy() { pbcopy < "${1:-/dev/stdin}"; }
|
function clipcopy() { pbcopy < "${1:-/dev/stdin}"; }
|
||||||
function clippaste() { pbpaste; }
|
function clippaste() { pbpaste; }
|
||||||
elif [[ "${OSTYPE}" == cygwin* ]]; then
|
elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then
|
||||||
function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; }
|
function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; }
|
||||||
function clippaste() { cat /dev/clipboard; }
|
function clippaste() { cat /dev/clipboard; }
|
||||||
elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
|
elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
|
||||||
|
|
|
@ -71,3 +71,6 @@ if [[ $COMPLETION_WAITING_DOTS = true ]]; then
|
||||||
zle -N expand-or-complete-with-dots
|
zle -N expand-or-complete-with-dots
|
||||||
bindkey "^I" expand-or-complete-with-dots
|
bindkey "^I" expand-or-complete-with-dots
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# automatically load bash completion functions
|
||||||
|
autoload -Uz bashcompinit && bashcompinit
|
||||||
|
|
|
@ -3,11 +3,12 @@ function zsh_stats() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function uninstall_oh_my_zsh() {
|
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() {
|
function upgrade_oh_my_zsh() {
|
||||||
env ZSH=$ZSH sh $ZSH/tools/upgrade.sh
|
env ZSH="$ZSH" sh "$ZSH/tools/upgrade.sh"
|
||||||
|
rm -rf "$ZSH/log/update.lock"
|
||||||
}
|
}
|
||||||
|
|
||||||
function take() {
|
function take() {
|
||||||
|
@ -21,7 +22,7 @@ function open_command() {
|
||||||
case "$OSTYPE" in
|
case "$OSTYPE" in
|
||||||
darwin*) open_cmd='open' ;;
|
darwin*) open_cmd='open' ;;
|
||||||
cygwin*) open_cmd='cygstart' ;;
|
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 ""'
|
open_cmd='cmd.exe /c start ""'
|
||||||
[[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
|
[[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
|
||||||
} ;;
|
} ;;
|
||||||
|
@ -31,12 +32,7 @@ function open_command() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# don't use nohup on OSX
|
${=open_cmd} "$@" &>/dev/null
|
||||||
if [[ "$OSTYPE" == darwin* ]]; then
|
|
||||||
${=open_cmd} "$@" &>/dev/null
|
|
||||||
else
|
|
||||||
nohup ${=open_cmd} "$@" &>/dev/null
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
21
lib/git.zsh
21
lib/git.zsh
|
@ -12,11 +12,21 @@ function git_prompt_info() {
|
||||||
function parse_git_dirty() {
|
function parse_git_dirty() {
|
||||||
local STATUS
|
local STATUS
|
||||||
local -a FLAGS
|
local -a FLAGS
|
||||||
FLAGS=('--porcelain' '--ignore-submodules=dirty')
|
FLAGS=('--porcelain')
|
||||||
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
|
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
|
||||||
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
|
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
|
||||||
FLAGS+='--untracked-files=no'
|
FLAGS+='--untracked-files=no'
|
||||||
fi
|
fi
|
||||||
|
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=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
|
STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
|
||||||
fi
|
fi
|
||||||
if [[ -n $STATUS ]]; then
|
if [[ -n $STATUS ]]; then
|
||||||
|
@ -189,3 +199,12 @@ function git_current_user_name() {
|
||||||
function git_current_user_email() {
|
function git_current_user_email() {
|
||||||
command git config user.email 2>/dev/null
|
command 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 rev-parse --show-toplevel 2>/dev/null)" && [[ -n "$repo_path" ]]; then
|
||||||
|
echo ${repo_path:t}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ env_default 'PAGER' 'less'
|
||||||
env_default 'LESS' '-R'
|
env_default 'LESS' '-R'
|
||||||
|
|
||||||
## super user alias
|
## super user alias
|
||||||
alias _='sudo'
|
alias _='sudo '
|
||||||
|
|
||||||
## more intelligent acking for ubuntu users
|
## more intelligent acking for ubuntu users
|
||||||
if which ack-grep &> /dev/null; then
|
if which ack-grep &> /dev/null; then
|
||||||
|
@ -31,10 +31,5 @@ else
|
||||||
alias afind='ack -il'
|
alias afind='ack -il'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# only define LC_CTYPE if undefined
|
|
||||||
if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then
|
|
||||||
export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG
|
|
||||||
fi
|
|
||||||
|
|
||||||
# recognize comments
|
# recognize comments
|
||||||
setopt interactivecomments
|
setopt interactivecomments
|
||||||
|
|
|
@ -75,8 +75,9 @@ function omz_termsupport_preexec {
|
||||||
title '$CMD' '%100>...>$LINE%<<'
|
title '$CMD' '%100>...>$LINE%<<'
|
||||||
}
|
}
|
||||||
|
|
||||||
precmd_functions+=(omz_termsupport_precmd)
|
autoload -U add-zsh-hook
|
||||||
preexec_functions+=(omz_termsupport_preexec)
|
add-zsh-hook precmd omz_termsupport_precmd
|
||||||
|
add-zsh-hook preexec omz_termsupport_preexec
|
||||||
|
|
||||||
|
|
||||||
# Keep Apple Terminal.app's current working directory updated
|
# Keep Apple Terminal.app's current working directory updated
|
||||||
|
@ -99,7 +100,7 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use a precmd hook instead of a chpwd hook to avoid contaminating output
|
# 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
|
# Run once to get initial cwd set
|
||||||
update_terminalapp_cwd
|
update_terminalapp_cwd
|
||||||
fi
|
fi
|
||||||
|
|
29
oh-my-zsh.sh
29
oh-my-zsh.sh
|
@ -32,8 +32,8 @@ fi
|
||||||
is_plugin() {
|
is_plugin() {
|
||||||
local base_dir=$1
|
local base_dir=$1
|
||||||
local name=$2
|
local name=$2
|
||||||
test -f $base_dir/plugins/$name/$name.plugin.zsh \
|
builtin test -f $base_dir/plugins/$name/$name.plugin.zsh \
|
||||||
|| test -f $base_dir/plugins/$name/_$name
|
|| builtin test -f $base_dir/plugins/$name/_$name
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add all defined plugins to fpath. This must be done
|
# Add all defined plugins to fpath. This must be done
|
||||||
|
@ -97,25 +97,12 @@ done
|
||||||
unset config_file
|
unset config_file
|
||||||
|
|
||||||
# Load the theme
|
# Load the theme
|
||||||
if [[ "$ZSH_THEME" == "random" ]]; then
|
if [ ! "$ZSH_THEME" = "" ]; then
|
||||||
if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = "array" ]] && [[ "${#ZSH_THEME_RANDOM_CANDIDATES[@]}" -gt 0 ]]; then
|
if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then
|
||||||
themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDIDATES}.zsh-theme)
|
source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
|
||||||
|
elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then
|
||||||
|
source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme"
|
||||||
else
|
else
|
||||||
themes=($ZSH/themes/*zsh-theme)
|
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
|
||||||
fi
|
|
||||||
N=${#themes[@]}
|
|
||||||
((N=(RANDOM%N)+1))
|
|
||||||
RANDOM_THEME=${themes[$N]}
|
|
||||||
source "$RANDOM_THEME"
|
|
||||||
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
|
|
||||||
else
|
|
||||||
if [ ! "$ZSH_THEME" = "" ]; then
|
|
||||||
if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then
|
|
||||||
source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
|
|
||||||
elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then
|
|
||||||
source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme"
|
|
||||||
else
|
|
||||||
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
46
plugins/alias-finder/README.md
Normal file
46
plugins/alias-finder/README.md
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
# alias-finder plugin
|
||||||
|
|
||||||
|
This plugin searches the defined aliases and outputs any that match the command inputted. This makes learning new aliases easier.
|
||||||
|
|
||||||
|
To use it, add `alias-finder` to the `plugins` array of your zshrc file:
|
||||||
|
```
|
||||||
|
plugins=(... alias-finder)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
To see if there is an alias defined for the command, pass it as an argument to `alias-finder`. This can also run automatically before each command you input - add `ZSH_ALIAS_FINDER_AUTOMATIC=true` to your zshrc if you want this.
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
- Use `--longer` or `-l` to allow the aliases to be longer than the input (match aliases if they contain the input).
|
||||||
|
- Use `--exact` or `-e` to avoid matching aliases that are shorter than the input.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
```
|
||||||
|
$ alias-finder "git pull"
|
||||||
|
gl='git pull'
|
||||||
|
g=git
|
||||||
|
```
|
||||||
|
```
|
||||||
|
$ alias-finder "web_search google oh my zsh"
|
||||||
|
google='web_search google'
|
||||||
|
```
|
||||||
|
```
|
||||||
|
$ alias-finder "git commit -v"
|
||||||
|
gc="git commit -v"
|
||||||
|
g=git
|
||||||
|
```
|
||||||
|
```
|
||||||
|
$ alias-finder -e "git commit -v"
|
||||||
|
gc='git commit -v'
|
||||||
|
```
|
||||||
|
```
|
||||||
|
$ alias-finder -l "git commit -v"
|
||||||
|
gc='git commit -v'
|
||||||
|
'gc!'='git commit -v --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'
|
||||||
|
'gcn!'='git commit -v --no-edit --amend'
|
||||||
|
```
|
47
plugins/alias-finder/alias-finder.plugin.zsh
Normal file
47
plugins/alias-finder/alias-finder.plugin.zsh
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
alias-finder() {
|
||||||
|
local cmd="" exact="" longer="" wordStart="" wordEnd="" multiWordEnd=""
|
||||||
|
for i in $@; do
|
||||||
|
case $i in
|
||||||
|
-e|--exact) exact=true;;
|
||||||
|
-l|--longer) longer=true;;
|
||||||
|
*)
|
||||||
|
if [[ -z $cmd ]]; then
|
||||||
|
cmd=$i
|
||||||
|
else
|
||||||
|
cmd="$cmd $i"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep
|
||||||
|
if (( $(wc -l <<< $cmd) == 1 )); then
|
||||||
|
while [[ $cmd != "" ]]; do
|
||||||
|
if [[ $longer = true ]]; then
|
||||||
|
wordStart="'{0,1}"
|
||||||
|
else
|
||||||
|
wordEnd="$"
|
||||||
|
multiWordEnd="'$"
|
||||||
|
fi
|
||||||
|
if [[ $cmd == *" "* ]]; then
|
||||||
|
local finder="'$cmd$multiWordEnd"
|
||||||
|
else
|
||||||
|
local finder=$wordStart$cmd$wordEnd
|
||||||
|
fi
|
||||||
|
alias | grep -E "=$finder"
|
||||||
|
if [[ $exact = true || $longer = true ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
cmd=$(sed -E 's/ {0,1}[^ ]*$//' <<< $cmd) # removes last word
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
preexec_alias-finder() {
|
||||||
|
if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then
|
||||||
|
alias-finder $1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
autoload -U add-zsh-hook
|
||||||
|
add-zsh-hook preexec preexec_alias-finder
|
|
@ -1,5 +1,29 @@
|
||||||
## arcanist
|
## arcanist
|
||||||
|
|
||||||
**Maintainer:** [@emzar](https://github.com/emzar)
|
This plugin adds many useful aliases for [arcanist](https://github.com/phacility/arcanist).
|
||||||
|
|
||||||
This plugin adds many useful aliases.
|
To use it, add `arcanist` to the plugins array of your zshrc file:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
plugins=(... arcanist)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Aliases
|
||||||
|
|
||||||
|
| Alias | Command |
|
||||||
|
|---------|------------------------------------|
|
||||||
|
| ara | `arc amend` |
|
||||||
|
| arb | `arc branch` |
|
||||||
|
| arco | `arc cover` |
|
||||||
|
| arci | `arc commit` |
|
||||||
|
| ard | `arc diff` |
|
||||||
|
| ardc | `arc diff --create` |
|
||||||
|
| ardnu | `arc diff --nounit` |
|
||||||
|
| ardnupc | `arc diff --nounit --plan-changes` |
|
||||||
|
| ardpc | `arc diff --plan-changes` |
|
||||||
|
| are | `arc export` |
|
||||||
|
| arh | `arc help` |
|
||||||
|
| arl | `arc land` |
|
||||||
|
| arli | `arc lint` |
|
||||||
|
| arls | `arc list` |
|
||||||
|
| arpa | `arc patch` |
|
||||||
|
|
|
@ -9,6 +9,7 @@ alias arco='arc cover'
|
||||||
alias arci='arc commit'
|
alias arci='arc commit'
|
||||||
|
|
||||||
alias ard='arc diff'
|
alias ard='arc diff'
|
||||||
|
alias ardc='arc diff --create'
|
||||||
alias ardnu='arc diff --nounit'
|
alias ardnu='arc diff --nounit'
|
||||||
alias ardnupc='arc diff --nounit --plan-changes'
|
alias ardnupc='arc diff --nounit --plan-changes'
|
||||||
alias ardpc='arc diff --plan-changes'
|
alias ardpc='arc diff --plan-changes'
|
||||||
|
|
14
plugins/autoenv/README.md
Normal file
14
plugins/autoenv/README.md
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# Autoenv plugin
|
||||||
|
|
||||||
|
This plugin loads the [Autoenv](https://github.com/inishchith/autoenv).
|
||||||
|
|
||||||
|
To use it, add `autoenv` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
plugins=(... autoenv)
|
||||||
|
```
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
In order to make this work, you will need to have the autoenv installed.
|
||||||
|
|
||||||
|
More info on the usage and install: https://github.com/inishchith/autoenv
|
|
@ -1,8 +1,3 @@
|
||||||
(( $+commands[autojump] )) || {
|
|
||||||
echo '[oh-my-zsh] Please install autojump first (https://github.com/wting/autojump)'
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
declare -a autojump_paths
|
declare -a autojump_paths
|
||||||
autojump_paths=(
|
autojump_paths=(
|
||||||
$HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
|
$HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
|
||||||
|
|
|
@ -10,7 +10,8 @@ function asp() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local available_profiles=($(aws_profiles))
|
local -a available_profiles
|
||||||
|
available_profiles=($(aws_profiles))
|
||||||
if [[ -z "${available_profiles[(r)$1]}" ]]; then
|
if [[ -z "${available_profiles[(r)$1]}" ]]; then
|
||||||
echo "${fg[red]}Profile '$1' not found in '${AWS_CONFIG_FILE:-$HOME/.aws/config}'" >&2
|
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
|
echo "Available profiles: ${(j:, :)available_profiles:-no profiles found}${reset_color}" >&2
|
||||||
|
|
|
@ -7,23 +7,25 @@
|
||||||
# Email: neuralsandwich@gmail.com #
|
# Email: neuralsandwich@gmail.com #
|
||||||
# Modified to add support for Apple Mac #
|
# 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() {
|
function battery_is_charging() {
|
||||||
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
|
ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ Yes'
|
||||||
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 plugged_in() {
|
function battery_pct() {
|
||||||
[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ Yes') -eq 1 ]
|
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() {
|
function battery_pct_remaining() {
|
||||||
if plugged_in ; then
|
if battery_is_charging; then
|
||||||
echo "External Power"
|
echo "External Power"
|
||||||
else
|
else
|
||||||
battery_pct
|
battery_pct
|
||||||
|
@ -32,9 +34,9 @@ if [[ "$OSTYPE" = darwin* ]] ; then
|
||||||
|
|
||||||
function battery_time_remaining() {
|
function battery_time_remaining() {
|
||||||
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
|
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
|
||||||
if [[ $(echo $smart_battery_status | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
|
if [[ $(echo $smart_battery_status | command grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]]; then
|
||||||
timeremaining=$(echo $smart_battery_status | grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
|
timeremaining=$(echo $smart_battery_status | command grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
|
||||||
if [ $timeremaining -gt 720 ] ; then
|
if [ $timeremaining -gt 720 ]; then
|
||||||
echo "::"
|
echo "::"
|
||||||
else
|
else
|
||||||
echo "~$((timeremaining / 60)):$((timeremaining % 60))"
|
echo "~$((timeremaining / 60)):$((timeremaining % 60))"
|
||||||
|
@ -45,39 +47,36 @@ if [[ "$OSTYPE" = darwin* ]] ; then
|
||||||
}
|
}
|
||||||
|
|
||||||
function battery_pct_prompt () {
|
function battery_pct_prompt () {
|
||||||
if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
|
local battery_pct color
|
||||||
b=$(battery_pct_remaining)
|
if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ No'; then
|
||||||
if [ $b -gt 50 ] ; then
|
battery_pct=$(battery_pct_remaining)
|
||||||
|
if [[ $battery_pct -gt 50 ]]; then
|
||||||
color='green'
|
color='green'
|
||||||
elif [ $b -gt 20 ] ; then
|
elif [[ $battery_pct -gt 20 ]]; then
|
||||||
color='yellow'
|
color='yellow'
|
||||||
else
|
else
|
||||||
color='red'
|
color='red'
|
||||||
fi
|
fi
|
||||||
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
|
echo "%{$fg[$color]%}[${battery_pct}%%]%{$reset_color%}"
|
||||||
else
|
else
|
||||||
echo "∞"
|
echo "∞"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function battery_is_charging() {
|
elif [[ "$OSTYPE" = freebsd* ]]; then
|
||||||
[[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]]
|
|
||||||
}
|
|
||||||
|
|
||||||
elif [[ "$OSTYPE" = linux* ]] ; then
|
|
||||||
|
|
||||||
function battery_is_charging() {
|
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() {
|
function battery_pct() {
|
||||||
if (( $+commands[acpi] )) ; then
|
if (( $+commands[sysctl] )); then
|
||||||
echo "$(acpi 2>/dev/null | cut -f2 -d ',' | tr -cd '[:digit:]')"
|
sysctl -n hw.acpi.battery.life
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function battery_pct_remaining() {
|
function battery_pct_remaining() {
|
||||||
if [ ! $(battery_is_charging) ] ; then
|
if ! battery_is_charging; then
|
||||||
battery_pct
|
battery_pct
|
||||||
else
|
else
|
||||||
echo "External Power"
|
echo "External Power"
|
||||||
|
@ -85,76 +84,128 @@ elif [[ "$OSTYPE" = linux* ]] ; then
|
||||||
}
|
}
|
||||||
|
|
||||||
function battery_time_remaining() {
|
function battery_time_remaining() {
|
||||||
if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
local remaining_time
|
||||||
echo $(acpi 2>/dev/null | cut -f3 -d ',')
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function battery_pct_prompt() {
|
function battery_pct_prompt() {
|
||||||
b=$(battery_pct_remaining)
|
local battery_pct color
|
||||||
if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
battery_pct=$(battery_pct_remaining)
|
||||||
if [ $b -gt 50 ] ; then
|
if battery_is_charging; then
|
||||||
|
echo "∞"
|
||||||
|
else
|
||||||
|
if [[ $battery_pct -gt 50 ]]; then
|
||||||
color='green'
|
color='green'
|
||||||
elif [ $b -gt 20 ] ; then
|
elif [[ $battery_pct -gt 20 ]]; then
|
||||||
color='yellow'
|
color='yellow'
|
||||||
else
|
else
|
||||||
color='red'
|
color='red'
|
||||||
fi
|
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.*(Disc|C)harging' | cut -f2 -d ',' | tr -cd '[:digit:]'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function battery_pct_remaining() {
|
||||||
|
if ! battery_is_charging; then
|
||||||
|
battery_pct
|
||||||
else
|
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 "∞"
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
# Empty functions so we don't cause errors in prompts
|
# Empty functions so we don't cause errors in prompts
|
||||||
function battery_pct_remaining() {
|
function battery_is_charging { false }
|
||||||
}
|
function battery_pct \
|
||||||
|
battery_pct_remaining \
|
||||||
function battery_time_remaining() {
|
battery_time_remaining \
|
||||||
}
|
battery_pct_prompt { }
|
||||||
|
|
||||||
function battery_pct_prompt() {
|
|
||||||
}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function battery_level_gauge() {
|
function battery_level_gauge() {
|
||||||
local gauge_slots=${BATTERY_GAUGE_SLOTS:-10};
|
local gauge_slots=${BATTERY_GAUGE_SLOTS:-10}
|
||||||
local green_threshold=${BATTERY_GREEN_THRESHOLD:-6};
|
local green_threshold=${BATTERY_GREEN_THRESHOLD:-$(( gauge_slots * 0.6 ))}
|
||||||
local yellow_threshold=${BATTERY_YELLOW_THRESHOLD:-4};
|
local yellow_threshold=${BATTERY_YELLOW_THRESHOLD:-$(( gauge_slots * 0.4 ))}
|
||||||
local color_green=${BATTERY_COLOR_GREEN:-%F{green}};
|
local color_green=${BATTERY_COLOR_GREEN:-%F{green}}
|
||||||
local color_yellow=${BATTERY_COLOR_YELLOW:-%F{yellow}};
|
local color_yellow=${BATTERY_COLOR_YELLOW:-%F{yellow}}
|
||||||
local color_red=${BATTERY_COLOR_RED:-%F{red}};
|
local color_red=${BATTERY_COLOR_RED:-%F{red}}
|
||||||
local color_reset=${BATTERY_COLOR_RESET:-%{%f%k%b%}};
|
local color_reset=${BATTERY_COLOR_RESET:-%{%f%k%b%}}
|
||||||
local battery_prefix=${BATTERY_GAUGE_PREFIX:-'['};
|
local battery_prefix=${BATTERY_GAUGE_PREFIX:-'['}
|
||||||
local battery_suffix=${BATTERY_GAUGE_SUFFIX:-']'};
|
local battery_suffix=${BATTERY_GAUGE_SUFFIX:-']'}
|
||||||
local filled_symbol=${BATTERY_GAUGE_FILLED_SYMBOL:-'▶'};
|
local filled_symbol=${BATTERY_GAUGE_FILLED_SYMBOL:-'▶'}
|
||||||
local empty_symbol=${BATTERY_GAUGE_EMPTY_SYMBOL:-'▷'};
|
local empty_symbol=${BATTERY_GAUGE_EMPTY_SYMBOL:-'▷'}
|
||||||
local charging_color=${BATTERY_CHARGING_COLOR:-$color_yellow};
|
local charging_color=${BATTERY_CHARGING_COLOR:-$color_yellow}
|
||||||
local charging_symbol=${BATTERY_CHARGING_SYMBOL:-'⚡'};
|
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
|
if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then
|
||||||
local filled=$(((( $battery_remaining_percentage + $gauge_slots - 1) / $gauge_slots)));
|
filled=$(( ($battery_remaining_percentage * $gauge_slots) / 100 ))
|
||||||
local empty=$(($gauge_slots - $filled));
|
empty=$(( $gauge_slots - $filled ))
|
||||||
|
|
||||||
if [[ $filled -gt $green_threshold ]]; then local gauge_color=$color_green;
|
if [[ $filled -gt $green_threshold ]]; then
|
||||||
elif [[ $filled -gt $yellow_threshold ]]; then local gauge_color=$color_yellow;
|
gauge_color=$color_green
|
||||||
else local gauge_color=$color_red;
|
elif [[ $filled -gt $yellow_threshold ]]; then
|
||||||
|
gauge_color=$color_yellow
|
||||||
|
else
|
||||||
|
gauge_color=$color_red
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
local filled=$gauge_slots;
|
filled=$gauge_slots
|
||||||
local empty=0;
|
empty=0
|
||||||
filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'};
|
filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local charging=' ' && battery_is_charging && charging=$charging_symbol;
|
local charging=' '
|
||||||
|
battery_is_charging && charging=$charging_symbol
|
||||||
|
|
||||||
|
# Charging status and prefix
|
||||||
printf ${charging_color//\%/\%\%}$charging${color_reset//\%/\%\%}${battery_prefix//\%/\%\%}${gauge_color//\%/\%\%}
|
printf ${charging_color//\%/\%\%}$charging${color_reset//\%/\%\%}${battery_prefix//\%/\%\%}${gauge_color//\%/\%\%}
|
||||||
printf ${filled_symbol//\%/\%\%}'%.0s' {1..$filled}
|
# Filled slots
|
||||||
|
[[ $filled -gt 0 ]] && printf ${filled_symbol//\%/\%\%}'%.0s' {1..$filled}
|
||||||
|
# Empty slots
|
||||||
[[ $filled -lt $gauge_slots ]] && printf ${empty_symbol//\%/\%\%}'%.0s' {1..$empty}
|
[[ $filled -lt $gauge_slots ]] && printf ${empty_symbol//\%/\%\%}'%.0s' {1..$empty}
|
||||||
|
# Suffix
|
||||||
printf ${color_reset//\%/\%\%}${battery_suffix//\%/\%\%}${color_reset//\%/\%\%}
|
printf ${color_reset//\%/\%\%}${battery_suffix//\%/\%\%}${color_reset//\%/\%\%}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
- calls `bundle exec <gem executable>` otherwise
|
- calls `bundle exec <gem executable>` otherwise
|
||||||
|
|
||||||
Common gems wrapped by default (by name of the executable):
|
Common gems wrapped by default (by name of the executable):
|
||||||
`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`.
|
`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `rubocop`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ This will exclude the `foreman` and `spin` gems (i.e. their executable) from bei
|
||||||
|
|
||||||
## 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`
|
`berks`
|
||||||
`foreman`
|
`foreman`
|
||||||
|
|
|
@ -27,6 +27,7 @@ bundled_commands=(
|
||||||
rainbows
|
rainbows
|
||||||
rake
|
rake
|
||||||
rspec
|
rspec
|
||||||
|
rubocop
|
||||||
shotgun
|
shotgun
|
||||||
sidekiq
|
sidekiq
|
||||||
spec
|
spec
|
||||||
|
@ -81,7 +82,7 @@ _bundler-installed() {
|
||||||
_within-bundled-project() {
|
_within-bundled-project() {
|
||||||
local check_dir="$PWD"
|
local check_dir="$PWD"
|
||||||
while [ "$check_dir" != "/" ]; do
|
while [ "$check_dir" != "/" ]; do
|
||||||
[ -f "$check_dir/Gemfile" ] && return
|
[ -f "$check_dir/Gemfile" -o -f "$check_dir/gems.rb" ] && return
|
||||||
check_dir="$(dirname $check_dir)"
|
check_dir="$(dirname $check_dir)"
|
||||||
done
|
done
|
||||||
false
|
false
|
||||||
|
@ -94,7 +95,7 @@ _binstubbed() {
|
||||||
_run-with-bundler() {
|
_run-with-bundler() {
|
||||||
if _bundler-installed && _within-bundled-project; then
|
if _bundler-installed && _within-bundled-project; then
|
||||||
if _binstubbed $1; then
|
if _binstubbed $1; then
|
||||||
./bin/$@
|
./bin/${^^@}
|
||||||
else
|
else
|
||||||
bundle exec $@
|
bundle exec $@
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
# Bwana
|
|
||||||
|
|
||||||
This plugin provides a function to open `man` pages directly with [Bwana](https://www.bruji.com/bwana/).
|
|
||||||
|
|
||||||
To use it add bwana to the plugins array in your zshrc file.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
plugins=(... bwana)
|
|
||||||
```
|
|
||||||
|
|
||||||
The `bwana` function opens the man page of the passed argument in the Bwana app.
|
|
||||||
For example: `bwana ln` opens the man page for `ln` in Bwana.
|
|
|
@ -1,13 +0,0 @@
|
||||||
#
|
|
||||||
# Requires https://www.bruji.com/bwana/
|
|
||||||
#
|
|
||||||
if [[ -e /Applications/Bwana.app ]] ||
|
|
||||||
( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana )
|
|
||||||
then
|
|
||||||
function bwana() {
|
|
||||||
open "man:$1"
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo "Bwana lets you read man files in Safari through a man: URI scheme"
|
|
||||||
echo "To use it within Zsh, install it from https://www.bruji.com/bwana/"
|
|
||||||
fi
|
|
16
plugins/cakephp3/README.md
Normal file
16
plugins/cakephp3/README.md
Normal file
|
@ -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` |
|
|
@ -2,489 +2,367 @@
|
||||||
|
|
||||||
autoload -U regexp-replace
|
autoload -U regexp-replace
|
||||||
|
|
||||||
zstyle -T ':completion:*:*:cargo:*' tag-order && \
|
|
||||||
zstyle ':completion:*:*:cargo:*' tag-order 'common-commands'
|
|
||||||
|
|
||||||
_cargo() {
|
_cargo() {
|
||||||
local context state state_descr line
|
local curcontext="$curcontext" ret=1
|
||||||
typeset -A opt_args
|
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
|
common=(
|
||||||
# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions
|
'(-q --quiet)*'{-v,--verbose}'[use verbose output]'
|
||||||
# - => exclude all other options
|
'(-q --quiet -v --verbose)'{-q,--quiet}'[no output printed to stdout]'
|
||||||
# 1 => exclude positional arg 1
|
'-Z+[pass unstable (nightly-only) flags to cargo]: :_cargo_unstable_flags'
|
||||||
# * => exclude all other args
|
'--frozen[require that Cargo.lock and cache are up-to-date]'
|
||||||
# +blah => exclude +blah
|
'--locked[require that Cargo.lock is up-to-date]'
|
||||||
_arguments \
|
'--color=[specify colorization option]:coloring:(auto always never)'
|
||||||
'(- 1 *)'{-h,--help}'[show help message]' \
|
'(- 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'
|
|
||||||
|
|
||||||
case $state in
|
# leading items in parentheses are an exclusion list for the arguments following that arg
|
||||||
command)
|
# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions
|
||||||
_alternative 'common-commands:common:_cargo_cmds' 'all-commands:all:_cargo_all_cmds'
|
# - => 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)
|
# These flags are mutually exclusive specifiers for the scope of a command; as
|
||||||
case $words[1] in
|
# they are used in multiple places without change, they are expanded into the
|
||||||
bench)
|
# appropriate command's `_arguments` where appropriate.
|
||||||
_arguments \
|
command_scope_spec=(
|
||||||
'--features=[space separated feature list]' \
|
'(--bin --example --test --lib)--bench=[specify benchmark name]: :_cargo_benchmark_names'
|
||||||
'--all-features[enable all available features]' \
|
'(--bench --bin --test --lib)--example=[specify example name]:example name'
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'(--bench --example --test --lib)--bin=[specify binary name]:binary name'
|
||||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
'(--bench --bin --example --test)--lib=[specify library name]:library name'
|
||||||
"${command_scope_spec[@]}" \
|
'(--bench --bin --example --lib)--test=[specify test name]:test name'
|
||||||
'--manifest-path=[path to manifest]: :_files -/' \
|
)
|
||||||
'--no-default-features[do not build the default features]' \
|
|
||||||
'--no-run[compile but do not run]' \
|
|
||||||
'(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \
|
|
||||||
'--target=[target triple]' \
|
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
|
||||||
'--color=:colorization option:(auto always never)' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
build)
|
parallel=(
|
||||||
_arguments \
|
'(-j --jobs)'{-j+,--jobs=}'[specify number of parallel jobs]:jobs [# of CPUs]'
|
||||||
'--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)' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
check)
|
features=(
|
||||||
_arguments \
|
'(--all-features)--features=[specify features to activate]:feature'
|
||||||
'--features=[space separated feature list]' \
|
'(--features)--all-features[activate all available features]'
|
||||||
'--all-features[enable all available features]' \
|
"--no-default-features[don't build the default 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)' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
clean)
|
msgfmt='--message-format=[specify error format]:error format [human]:(human json short)'
|
||||||
_arguments \
|
triple='--target=[specify target triple]:target triple'
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
target='--target-dir=[specify directory for all generated artifacts]:directory:_directories'
|
||||||
'--manifest-path=[path to manifest]: :_files -/' \
|
manifest='--manifest-path=[specify path to manifest]:path:_directories'
|
||||||
'(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \
|
registry='--registry=[specify registry to use]:registry'
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
|
||||||
'--release[whether or not to clean release artifacts]' \
|
|
||||||
'--target=[target triple(default:all)]' \
|
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
|
||||||
'--color=:colorization option:(auto always never)' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
doc)
|
case $state in
|
||||||
_arguments \
|
args)
|
||||||
'--features=[space separated feature list]' \
|
curcontext="${curcontext%:*}-${words[1]}:"
|
||||||
'--all-features[enable all available features]' \
|
case ${words[1]} in
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
bench)
|
||||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
_arguments -s -A "^--" $common $parallel $features $msgfmt $triple $target $manifest \
|
||||||
'--manifest-path=[path to manifest]: :_files -/' \
|
"${command_scope_spec[@]}" \
|
||||||
'--no-deps[do not build docs for dependencies]' \
|
'--all-targets[benchmark all targets]' \
|
||||||
'--no-default-features[do not build the default features]' \
|
"--no-run[compile but don't run]" \
|
||||||
'--open[open docs in browser after the build]' \
|
'(-p --package)'{-p+,--package=}'[specify package to run benchmarks for]:package:_cargo_package_names' \
|
||||||
'(-p, --package)'{-p,--package}'=[package to document]' \
|
'--exclude=[exclude packages from the benchmark]:spec' \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
'--no-fail-fast[run all benchmarks regardless of failure]' \
|
||||||
'--release[build artifacts in release mode, with optimizations]' \
|
'1: :_guard "^-*" "bench name"' \
|
||||||
'--target=[build for the target triple]' \
|
'*:args:_default'
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
;;
|
||||||
'--color=:colorization option:(auto always never)' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
fetch)
|
build)
|
||||||
_arguments \
|
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \
|
||||||
'--manifest-path=[path to manifest]: :_files -/' \
|
"${command_scope_spec[@]}" \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
'(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
'--release[build in release mode]' \
|
||||||
'--color=:colorization option:(auto always never)' \
|
'--build-plan[output the build plan in JSON]' \
|
||||||
;;
|
;;
|
||||||
|
|
||||||
generate-lockfile)
|
check)
|
||||||
_arguments \
|
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \
|
||||||
'--manifest-path=[path to manifest]: :_files -/' \
|
"${command_scope_spec[@]}" \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
'(-p --package)'{-p+,--package=}'[specify package to check]:package:_cargo_package_names' \
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
'--release[check in release mode]' \
|
||||||
'--color=:colorization option:(auto always never)' \
|
;;
|
||||||
;;
|
|
||||||
|
|
||||||
git-checkout)
|
clean)
|
||||||
_arguments \
|
_arguments -s -S $common $triple $target $manifest \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'(-p --package)'{-p+,--package=}'[specify package to clean]:package:_cargo_package_names' \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
'--release[clean release artifacts]' \
|
||||||
'--reference=[REF]' \
|
'--doc[clean just the documentation directory]'
|
||||||
'--url=[URL]' \
|
;;
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
|
||||||
'--color=:colorization option:(auto always never)' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
help)
|
doc)
|
||||||
_arguments \
|
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'--no-deps[do not build docs for dependencies]' \
|
||||||
'*: :_cargo_cmds' \
|
'--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)
|
fetch)
|
||||||
_arguments \
|
_arguments -s -S $common $triple $manifest
|
||||||
'--bin[use binary template]' \
|
;;
|
||||||
'--vcs:initialize a new repo with a given VCS:(git hg none)' \
|
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
|
||||||
'--name=[set the resulting package name]' \
|
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
|
||||||
'--color=:colorization option:(auto always never)' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
install)
|
fix)
|
||||||
_arguments \
|
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
||||||
'--bin=[only install the specified binary]' \
|
"${command_scope_spec[@]}" \
|
||||||
'--branch=[branch to use when installing from git]' \
|
'--broken-code[fix code even if it already has compiler errors]' \
|
||||||
'--color=:colorization option:(auto always never)' \
|
'--edition[fix in preparation for the next edition]' \
|
||||||
'--debug[build in debug mode instead of release mode]' \
|
'--edition-idioms[fix warnings to migrate to the idioms of an edition]' \
|
||||||
'--example[install the specified example instead of binaries]' \
|
'--allow-no-vcs[fix code even if a VCS was not detected]' \
|
||||||
'--features=[space separated feature list]' \
|
'--allow-dirty[fix code even if the working directory is dirty]' \
|
||||||
'--all-features[enable all available features]' \
|
'--allow-staged[fix code even if the working directory has staged changes]'
|
||||||
'--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]' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
locate-project)
|
generate-lockfile)
|
||||||
_arguments \
|
_arguments -s -S $common $manifest
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
;;
|
||||||
'--manifest-path=[path to manifest]: :_files -/' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
login)
|
git-checkout)
|
||||||
_arguments \
|
_arguments -s -S $common \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'--reference=:reference' \
|
||||||
'--host=[Host to set the token for]' \
|
'--url=:url:_urls'
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
;;
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
|
||||||
'--color=:colorization option:(auto always never)' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
metadata)
|
help)
|
||||||
_arguments \
|
_cargo_cmds
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
;;
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
|
||||||
"--no-deps[output information only about the root package and don't fetch dependencies]" \
|
|
||||||
'--no-default-features[do not include the default feature]' \
|
|
||||||
'--manifest-path=[path to manifest]: :_files -/' \
|
|
||||||
'--features=[space separated feature list]' \
|
|
||||||
'--all-features[enable all available features]' \
|
|
||||||
'--format-version=[format version(default: 1)]' \
|
|
||||||
'--color=:colorization option:(auto always never)' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
new)
|
init)
|
||||||
_arguments \
|
_arguments -s -S $common $registry \
|
||||||
'--bin[use binary template]' \
|
'--lib[use library template]' \
|
||||||
'--vcs:initialize a new repo with a given VCS:(git hg none)' \
|
'--edition=[specify edition to set for the crate generated]:edition:(2015 2018)' \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'--vcs=[initialize a new repo with a given VCS]:vcs:(git hg pijul fossil none)' \
|
||||||
'--name=[set the resulting package name]' \
|
'--name=[set the resulting package name]:name' \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
'1:path:_directories'
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
;;
|
||||||
'--color=:colorization option:(auto always never)' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
owner)
|
install)
|
||||||
_arguments \
|
_arguments -s -S $common $parallel $features $triple $registry \
|
||||||
'(-a, --add)'{-a,--add}'[add owner LOGIN]' \
|
'(-f --force)'{-f,--force}'[force overwriting of existing crates or binaries]' \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'--bin=[only install the specified binary]:binary' \
|
||||||
'--index[registry index]' \
|
'--branch=[branch to use when installing from git]:branch' \
|
||||||
'(-l, --list)'{-l,--list}'[list owners of a crate]' \
|
'--debug[build in debug mode instead of release mode]' \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
'--example=[install the specified example instead of binaries]:example' \
|
||||||
'(-r, --remove)'{-r,--remove}'[remove owner LOGIN]' \
|
'--git=[specify URL from which to install the crate]:url:_urls' \
|
||||||
'--token[API token to use when authenticating]' \
|
'--path=[local filesystem path to crate to install]: :_directories' \
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
'--rev=[specific commit to use when installing from git]:commit' \
|
||||||
'--color=:colorization option:(auto always never)' \
|
'--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)
|
locate-project)
|
||||||
_arguments \
|
_arguments -s -S $common $manifest
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
;;
|
||||||
'(-l, --list)'{-l,--list}'[print files included in a package without making one]' \
|
|
||||||
'--manifest-path=[path to manifest]: :_files -/' \
|
|
||||||
'--no-metadata[ignore warnings about a lack of human-usable metadata]' \
|
|
||||||
'--no-verify[do not build to verify contents]' \
|
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
|
||||||
'--color=:colorization option:(auto always never)' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
pkgid)
|
login)
|
||||||
_arguments \
|
_arguments -s -S $common $registry \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'*: :_guard "^-*" "token"'
|
||||||
'--manifest-path=[path to manifest]: :_files -/' \
|
;;
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
|
||||||
'--color=:colorization option:(auto always never)' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
publish)
|
metadata)
|
||||||
_arguments \
|
_arguments -s -S $common $features $manifest \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
"--no-deps[output information only about the root package and don't fetch dependencies]" \
|
||||||
'--host=[Host to set the token for]' \
|
'--format-version=[specify format version]:version [1]:(1)'
|
||||||
'--manifest-path=[path to manifest]: :_files -/' \
|
;;
|
||||||
'--no-verify[Do not verify tarball until before publish]' \
|
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
|
||||||
'--token[token to use when uploading]' \
|
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
|
||||||
'--color=:colorization option:(auto always never)' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
read-manifest)
|
new)
|
||||||
_arguments \
|
_arguments -s -S $common $registry \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'--lib[use library template]' \
|
||||||
'--manifest-path=[path to manifest]: :_files -/' \
|
'--vcs:initialize a new repo with a given VCS:(git hg none)' \
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
'--name=[set the resulting package name]'
|
||||||
'--color=:colorization option:(auto always never)' \
|
;;
|
||||||
;;
|
|
||||||
|
|
||||||
run)
|
owner)
|
||||||
_arguments \
|
_arguments -s -S $common $registry \
|
||||||
'--example=[name of the bin target]' \
|
'(-a --add)'{-a,--add}'[specify name of a user or team to invite as an owner]:name' \
|
||||||
'--features=[space separated feature list]' \
|
'--index=[specify registry index]:index' \
|
||||||
'--all-features[enable all available features]' \
|
'(-l --list)'{-l,--list}'[list owners of a crate]' \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'(-r --remove)'{-r,--remove}'[specify name of a user or team to remove as an owner]:name' \
|
||||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
'--token=[specify API token to use when authenticating]:token' \
|
||||||
'--manifest-path=[path to manifest]: :_files -/' \
|
'*: :_guard "^-*" "crate"'
|
||||||
'--bin=[name of the bin target]' \
|
;;
|
||||||
'--no-default-features[do not build the default features]' \
|
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
|
||||||
'--release=[build in release mode]' \
|
|
||||||
'--target=[target triple]' \
|
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
|
||||||
'--color=:colorization option:(auto always never)' \
|
|
||||||
'*: :_normal' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
rustc)
|
package)
|
||||||
_arguments \
|
_arguments -s -S $common $parallel $features $triple $target $manifest \
|
||||||
'--color=:colorization option:(auto always never)' \
|
'(-l --list)'{-l,--list}'[print files included in a package without making one]' \
|
||||||
'--features=[features to compile for the package]' \
|
'--no-metadata[ignore warnings about a lack of human-usable metadata]' \
|
||||||
'--all-features[enable all available features]' \
|
'--allow-dirty[allow dirty working directories to be packaged]' \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
"--no-verify[don't build to verify contents]"
|
||||||
'(-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[@]}" \
|
|
||||||
;;
|
|
||||||
|
|
||||||
rustdoc)
|
pkgid)
|
||||||
_arguments \
|
_arguments -s -S $common $manifest \
|
||||||
'--color=:colorization option:(auto always never)' \
|
'(-p --package)'{-p+,--package=}'[specify package to get ID specifier for]:package:_cargo_package_names' \
|
||||||
'--features=[space-separated list of features to also build]' \
|
'*: :_guard "^-*" "spec"'
|
||||||
'--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[@]}" \
|
|
||||||
;;
|
|
||||||
|
|
||||||
search)
|
publish)
|
||||||
_arguments \
|
_arguments -s -S $common $parallel $features $triple $target $manifest $registry \
|
||||||
'--color=:colorization option:(auto always never)' \
|
'--index=[specify registry index]:index' \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'--allow-dirty[allow dirty working directories to be packaged]' \
|
||||||
'--host=[host of a registry to search in]' \
|
"--no-verify[don't verify the contents by building them]" \
|
||||||
'--limit=[limit the number of results]' \
|
'--token=[specify token to use when uploading]:token' \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
'--dry-run[perform all checks without uploading]'
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
;;
|
||||||
;;
|
|
||||||
|
|
||||||
test)
|
read-manifest)
|
||||||
_arguments \
|
_arguments -s -S $common $manifest
|
||||||
'--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]'
|
|
||||||
;;
|
|
||||||
|
|
||||||
uninstall)
|
run)
|
||||||
_arguments \
|
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
||||||
'--bin=[only uninstall the binary NAME]' \
|
'--example=[name of the bin target]:name' \
|
||||||
'--color=:colorization option:(auto always never)' \
|
'--bin=[name of the bin target]:name' \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'(-p --package)'{-p+,--package=}'[specify package with the target to run]:package:_cargo_package_names' \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[less output printed to stdout]' \
|
'--release[build in release mode]' \
|
||||||
'--root=[directory to uninstall packages from]: :_files -/' \
|
'*: :_default'
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
;;
|
||||||
;;
|
|
||||||
|
|
||||||
update)
|
rustc)
|
||||||
_arguments \
|
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
||||||
'--aggressive=[force dependency update]' \
|
'(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'--profile=[specify profile to build the selected target for]:profile' \
|
||||||
'--manifest-path=[path to manifest]: :_files -/' \
|
'--release[build artifacts in release mode, with optimizations]' \
|
||||||
'(-p,--package)'{-p=,--package=}'[package to update]:packages:__get_package_names' \
|
"${command_scope_spec[@]}" \
|
||||||
'--precise=[update single dependency to PRECISE]: :' \
|
'*: : _dispatch rustc rustc -default-'
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
;;
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
|
||||||
'--color=:colorization option:(auto always never)' \
|
|
||||||
;;
|
|
||||||
|
|
||||||
verify-project)
|
rustdoc)
|
||||||
_arguments \
|
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'--document-private-items[include non-public items in the documentation]' \
|
||||||
'--manifest-path=[path to manifest]: :_files -/' \
|
'--open[open the docs in a browser after the operation]' \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
'(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
'--release[build artifacts in release mode, with optimizations]' \
|
||||||
'--color=:colorization option:(auto always never)' \
|
"${command_scope_spec[@]}" \
|
||||||
;;
|
'*: : _dispatch rustdoc rustdoc -default-'
|
||||||
|
;;
|
||||||
|
|
||||||
version)
|
search)
|
||||||
_arguments \
|
_arguments -s -S $common $registry \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'--index=[specify registry index]:index' \
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
'--limit=[limit the number of results]:results [10]' \
|
||||||
'--color=:colorization option:(auto always never)' \
|
'*: :_guard "^-*" "query"'
|
||||||
;;
|
;;
|
||||||
|
|
||||||
yank)
|
test)
|
||||||
_arguments \
|
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
||||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
'--test=[test name]: :_cargo_test_names' \
|
||||||
'--index[registry index]' \
|
'--no-fail-fast[run all tests regardless of failure]' \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
'--no-run[compile but do not run]' \
|
||||||
'--token[API token to use when authenticating]' \
|
'(-p --package)'{-p+,--package=}'[package to run tests for]:package:_cargo_package_names' \
|
||||||
'--undo[undo a yank, putting a version back into the index]' \
|
'--all[test all packages in the workspace]' \
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
'--release[build artifacts in release mode, with optimizations]' \
|
||||||
'--color=:colorization option:(auto always never)' \
|
'1: :_cargo_test_names' \
|
||||||
'--vers[yank version]' \
|
'(--doc --bin --example --test --bench)--lib[only test library]' \
|
||||||
;;
|
'(--lib --bin --example --test --bench)--doc[only test documentation]' \
|
||||||
esac
|
'(--lib --doc --example --test --bench)--bin=[binary name]' \
|
||||||
;;
|
'(--lib --doc --bin --test --bench)--example=[example name]' \
|
||||||
esac
|
'(--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(){
|
_cargo_unstable_flags() {
|
||||||
local -a commands;commands=(
|
local flags
|
||||||
'bench:execute all benchmarks of a local package'
|
flags=( help ${${${(M)${(f)"$(_call_program flags cargo -Z help)"}:#*--*}/ #-- #/:}##*-Z } )
|
||||||
'build:compile the current package'
|
_describe -t flags 'unstable flag' flags
|
||||||
'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_all_cmds(){
|
_cargo_installed_crates() {
|
||||||
local -a commands;commands=($(cargo --list))
|
local expl
|
||||||
_describe -t all-commands 'all commands' commands
|
_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
|
#FIXME: Disabled until fixed
|
||||||
#gets package names from the manifest file
|
#gets package names from the manifest file
|
||||||
_get_package_names()
|
_cargo_package_names() {
|
||||||
{
|
_message -e packages package
|
||||||
}
|
|
||||||
|
|
||||||
#TODO:see if it makes sense to have 'locate-project' to have non-json output.
|
|
||||||
#strips package name from json stuff
|
|
||||||
_locate_manifest(){
|
|
||||||
local manifest=`cargo locate-project 2>/dev/null`
|
|
||||||
regexp-replace manifest '\{"root":"|"\}' ''
|
|
||||||
echo $manifest
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Extracts the values of "name" from the array given in $1 and shows them as
|
# Extracts the values of "name" from the array given in $1 and shows them as
|
||||||
# command line options for completion
|
# command line options for completion
|
||||||
_get_names_from_array()
|
_cargo_names_from_array() {
|
||||||
{
|
# strip json from the path
|
||||||
local -a filelist;
|
local manifest=${${${"$(cargo locate-project)"}%\"\}}##*\"}
|
||||||
local manifest=$(_locate_manifest)
|
|
||||||
if [[ -z $manifest ]]; then
|
if [[ -z $manifest ]]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
@ -494,51 +372,36 @@ _get_names_from_array()
|
||||||
local in_block=false
|
local in_block=false
|
||||||
local block_name=$1
|
local block_name=$1
|
||||||
names=()
|
names=()
|
||||||
while read line
|
while read -r line; do
|
||||||
do
|
|
||||||
if [[ $last_line == "[[$block_name]]" ]]; then
|
if [[ $last_line == "[[$block_name]]" ]]; then
|
||||||
in_block=true
|
in_block=true
|
||||||
else
|
else
|
||||||
if [[ $last_line =~ '.*\[\[.*' ]]; then
|
if [[ $last_line =~ '\s*\[\[.*' ]]; then
|
||||||
in_block=false
|
in_block=false
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $in_block == true ]]; then
|
if [[ $in_block == true ]]; then
|
||||||
if [[ $line =~ '.*name.*=' ]]; then
|
if [[ $line =~ '\s*name\s*=' ]]; then
|
||||||
regexp-replace line '^.*name *= *|"' ""
|
regexp-replace line '^\s*name\s*=\s*|"' ''
|
||||||
names+=$line
|
names+=( "$line" )
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
last_line=$line
|
last_line=$line
|
||||||
done < $manifest
|
done < "$manifest"
|
||||||
_describe $block_name names
|
_describe "$block_name" names
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#Gets the test names from the manifest file
|
#Gets the test names from the manifest file
|
||||||
_test_names()
|
_cargo_test_names() {
|
||||||
{
|
_cargo_names_from_array "test"
|
||||||
_get_names_from_array "test"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#Gets the bench names from the manifest file
|
#Gets the bench names from the manifest file
|
||||||
_benchmark_names()
|
_cargo_benchmark_names() {
|
||||||
{
|
_cargo_names_from_array "bench"
|
||||||
_get_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
|
_cargo
|
||||||
|
|
|
@ -17,10 +17,10 @@ Plugin for displaying images on the terminal using the the `catimg.sh` script pr
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Reload the source file or restart your Terminal session:
|
2. Restart the shell or restart your Terminal session:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ source ~/.zshrc
|
$ exec zsh
|
||||||
$
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
20
plugins/chruby/README.md
Normal file
20
plugins/chruby/README.md
Normal file
|
@ -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
|
||||||
|
```
|
24
plugins/cloudapp/README.md
Normal file
24
plugins/cloudapp/README.md
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# CloudApp plugin
|
||||||
|
|
||||||
|
[CloudApp](https://www.getcloudapp.com) brings screen recording, screenshots, and GIF creation to the cloud, in an easy-to-use enterprise-level app. The CloudApp plugin allows you to upload a file to your CloadApp account from the command line.
|
||||||
|
|
||||||
|
To use it, add `cloudapp` to the plugins array of your `~/.zshrc` file:
|
||||||
|
|
||||||
|
```
|
||||||
|
plugins=(... 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 <filename>`: uploads `<filename>` to your CloudApp account, and if you're using
|
||||||
|
macOS, copies the URL to your clipboard.
|
8
plugins/codeclimate/README.md
Normal file
8
plugins/codeclimate/README.md
Normal file
|
@ -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)
|
||||||
|
```
|
48
plugins/colemak/README.md
Normal file
48
plugins/colemak/README.md
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
# Colemak plugin
|
||||||
|
|
||||||
|
This plugin remaps keys in `zsh`'s [`vi`-style navigation mode](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Keymaps)
|
||||||
|
for a [Colemak](https://colemak.com/) keyboard layout, to match the QWERTY position:
|
||||||
|
|
||||||
|
![Colemak layout on a US keyboard](https://colemak.com/wiki/images/6/6c/Colemak2.png)
|
||||||
|
|
||||||
|
To use it, add it to the plugins array in your `~/.zshrc` file:
|
||||||
|
|
||||||
|
```
|
||||||
|
plugins=(... colemak)
|
||||||
|
```
|
||||||
|
|
||||||
|
You will also need to enable `vi` mode, so add another line to `~/.zshrc`:
|
||||||
|
```
|
||||||
|
bindkey -v
|
||||||
|
```
|
||||||
|
|
||||||
|
Restart your shell and hit the `<ESC>` key to activate `vicmd` (navigation) mode,
|
||||||
|
and start navigating `zsh` with your new keybindings!
|
||||||
|
|
||||||
|
## Key bindings for vicmd
|
||||||
|
|
||||||
|
| Old | New | Binding | Description |
|
||||||
|
|------------|------------|---------------------------|----------------------------------------------------|
|
||||||
|
| `CTRL`+`j` | `CTRL`+`n` | accept-line | Insert new line |
|
||||||
|
| `j` | `n` | down-line-or-history | Move one line down or command history forwards |
|
||||||
|
| `k` | `e` | up-line-or-history | Move one line up or command history backwards |
|
||||||
|
| `l` | `i` | vi-forward-char | Move one character to the right |
|
||||||
|
| `n` | `k` | vi-repeat-search | Repeat command search forwards |
|
||||||
|
| `N` | `K` | vi-rev-repeat-search | Repeat command search backwards |
|
||||||
|
| `i` | `u` | vi-insert | Enter insert mode |
|
||||||
|
| `I` | `U` | vi-insert-bol | Move to first non-blank char and enter insert mode |
|
||||||
|
| `<none>` | `l` | vi-undo-change | Undo change |
|
||||||
|
| `J` | `N` | vi-join | Join the current line with the next one |
|
||||||
|
| `e` | `j` | vi-forward-word-end | Move to the end of the next word |
|
||||||
|
| `E` | `J` | vi-forward-blank-word-end | Move to end of the current or next word |
|
||||||
|
|
||||||
|
## Key bindings for less
|
||||||
|
|
||||||
|
| Keyboard shortcut | `less` key binding |
|
||||||
|
|-------------------|--------------------|
|
||||||
|
| `n` | forw-line |
|
||||||
|
| `e` | back-line |
|
||||||
|
| `k` | repeat-search |
|
||||||
|
| `ESC`+`k` | repeat-search-all |
|
||||||
|
| `K` | reverse-search |
|
||||||
|
| `ESC`+`K` | reverse-search-all |
|
15
plugins/colored-man-pages/README.md
Normal file
15
plugins/colored-man-pages/README.md
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# Colored man pages plugin
|
||||||
|
|
||||||
|
This plugin adds colors to man pages.
|
||||||
|
|
||||||
|
To use it, add `colored-man-pages` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
plugins=(... colored-man-pages)
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also try to color other pages by prefixing the respective command with `colored`:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
colored git help clone
|
||||||
|
```
|
|
@ -16,8 +16,8 @@ EOF
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function man() {
|
function colored() {
|
||||||
env \
|
command env \
|
||||||
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
||||||
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
||||||
LESS_TERMCAP_me=$(printf "\e[0m") \
|
LESS_TERMCAP_me=$(printf "\e[0m") \
|
||||||
|
@ -28,5 +28,9 @@ function man() {
|
||||||
PAGER="${commands[less]:-$PAGER}" \
|
PAGER="${commands[less]:-$PAGER}" \
|
||||||
_NROFF_U=1 \
|
_NROFF_U=1 \
|
||||||
PATH="$HOME/bin:$PATH" \
|
PATH="$HOME/bin:$PATH" \
|
||||||
man "$@"
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function man() {
|
||||||
|
colored man "$@"
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,30 +6,43 @@ 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
|
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.
|
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)
|
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:
|
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"
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided).
|
* `ccat <file> [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.
|
If no files are passed it will colorize the standard input.
|
||||||
|
|
||||||
* `cless <file> [files]`: colorize the contents of the file (or files, if more than one are provided) and
|
* `cless [less-options] <file> [files]`: colorize the contents of the file (or files, if more than one are provided) and open less.
|
||||||
open less. If no arguments are passed it will colorize the standard input or stdin.
|
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.
|
||||||
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/)
|
|
||||||
|
|
|
@ -1,57 +1,113 @@
|
||||||
# easier alias to use the plugin
|
# Easier alias to use the plugin
|
||||||
alias ccat='colorize_via_pygmentize'
|
alias ccat="colorize_cat"
|
||||||
alias cless='colorize_via_pygmentize_less'
|
alias cless="colorize_less"
|
||||||
|
|
||||||
colorize_via_pygmentize() {
|
# '$0:A' gets the absolute path of this file
|
||||||
if ! (( $+commands[pygmentize] )); then
|
ZSH_COLORIZE_PLUGIN_PATH=$0:A
|
||||||
echo "package 'Pygments' is not installed!"
|
|
||||||
|
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
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the environment varianle ZSH_COLORIZE_STYLE
|
# If the environment variable ZSH_COLORIZE_STYLE
|
||||||
# is set, use that theme instead. Otherwise,
|
# is set, use that theme instead. Otherwise,
|
||||||
# use the default.
|
# use the default.
|
||||||
if [ -z $ZSH_COLORIZE_STYLE ]; then
|
if [ -z "$ZSH_COLORIZE_STYLE" ]; then
|
||||||
ZSH_COLORIZE_STYLE="default"
|
# Both pygmentize & chroma support 'emacs'
|
||||||
|
ZSH_COLORIZE_STYLE="emacs"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# pygmentize stdin if no arguments passed
|
# Use stdin if no arguments have been passed.
|
||||||
if [ $# -eq 0 ]; then
|
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"
|
||||||
|
fi
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# guess lexer from file extension, or
|
# Guess lexer from file extension, or guess it from file contents if unsuccessful.
|
||||||
# guess it from file contents if unsuccessful
|
|
||||||
|
|
||||||
local FNAME lexer
|
local FNAME lexer
|
||||||
for FNAME in "$@"
|
for FNAME in "$@"; do
|
||||||
do
|
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
|
||||||
lexer=$(pygmentize -N "$FNAME")
|
lexer=$(pygmentize -N "$FNAME")
|
||||||
if [[ $lexer != text ]]; then
|
if [[ $lexer != text ]]; then
|
||||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME"
|
pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME"
|
||||||
|
else
|
||||||
|
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
|
chroma --style="$ZSH_COLORIZE_STYLE" "$FNAME"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
colorize_via_pygmentize_less() (
|
# The less option 'F - Forward forever; like "tail -f".' will not work in this implementation
|
||||||
# this function is a subshell so tmp_files can be shared to cleanup function
|
# caused by the lack of the ability to follow the file within pygmentize.
|
||||||
declare -a tmp_files
|
colorize_less() {
|
||||||
|
if ! colorize_check_requirements; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
cleanup () {
|
_cless() {
|
||||||
[[ ${#tmp_files} -gt 0 ]] && rm -f "${tmp_files[@]}"
|
# LESS="-R $LESS" enables raw ANSI colors, while maintain already set options.
|
||||||
exit
|
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
|
if [ -t 0 ]; then
|
||||||
tmp_file="$(mktemp -t "tmp.colorize.XXXX.$(sed 's/\//./g' <<< "$1")")"
|
_cless "$@"
|
||||||
tmp_files+=("$tmp_file")
|
else
|
||||||
colorize_via_pygmentize "$1" > "$tmp_file"
|
# The input is not associated with a terminal, therefore colorize_cat will
|
||||||
shift 1
|
# colorize this input and pass it to less.
|
||||||
done
|
# 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.
|
||||||
less -f "${tmp_files[@]}"
|
# 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
|
||||||
|
}
|
||||||
|
|
121
plugins/common-aliases/README.md
Normal file
121
plugins/common-aliases/README.md
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
# Common Aliases Plugin
|
||||||
|
|
||||||
|
This plugin creates helpful shortcut aliases for many commonly used commands.
|
||||||
|
|
||||||
|
To use it add `common-aliases` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
plugins=(... common-aliases)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Aliases
|
||||||
|
|
||||||
|
### ls command
|
||||||
|
|
||||||
|
| Alias | Command | Description |
|
||||||
|
|-------|---------------|--------------------------------------------------------------------------------|
|
||||||
|
| l | `ls -lFh` | List files as a long list, show size, type, human-readable |
|
||||||
|
| la | `ls -lAFh` | List almost all files as a long list show size, type, human-readable |
|
||||||
|
| lr | `ls -tRFh` | List files recursively sorted by date, show type, human-readable |
|
||||||
|
| lt | `ls -ltFh` | List files as a long list sorted by date, show type, human-readable |
|
||||||
|
| ll | `ls -l` | List files as a long list |
|
||||||
|
| ldot | `ls -ld .*` | List dot files as a long list |
|
||||||
|
| lS | `ls -1FSsh` | List files showing only size and name sorted by size |
|
||||||
|
| lart | `ls -1Fcart` | List all files sorted in reverse of create/modification time (oldest first) |
|
||||||
|
| lrt | `ls -1Fcrt` | List files sorted in reverse of create/modification time(oldest first) |
|
||||||
|
|
||||||
|
### File handling
|
||||||
|
|
||||||
|
| Alias | Command | Description |
|
||||||
|
|-------|-----------------------|------------------------------------------------------------------------------------|
|
||||||
|
| rm | `rm -i` | Remove a file |
|
||||||
|
| cp | `cp -i` | Copy a file |
|
||||||
|
| mv | `mv -i` | Move a file |
|
||||||
|
| zshrc | `${=EDITOR} ~/.zshrc` | Quickly access the ~/.zshrc file |
|
||||||
|
| dud | `du -d 1 -h` | Display the size of files at depth 1 in current location in human-readable form |
|
||||||
|
| duf | `du -sh` | Display the size of files in current location in human-readable form |
|
||||||
|
| t | `tail -f` | Shorthand for tail which outputs the last part of a file |
|
||||||
|
|
||||||
|
### find and grep
|
||||||
|
|
||||||
|
| Alias | Command | Description |
|
||||||
|
|-------|-----------------------------------------------------|-----------------------------------------|
|
||||||
|
| fd | `find . -type d -name` | Find a directory with the given name |
|
||||||
|
| ff | `find . -type f -name` | Find a file with the given name |
|
||||||
|
| grep | `grep --color` | Searches for a query string |
|
||||||
|
| sgrep | `grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS}` | Useful for searching within files |
|
||||||
|
|
||||||
|
### Other Aliases
|
||||||
|
|
||||||
|
| Alias | Command | Description |
|
||||||
|
|-----------|---------------------|-------------------------------------------------------------|
|
||||||
|
| h | `history` | Lists all recently used commands |
|
||||||
|
| hgrep | `fc -El 0 \| grep` | Searches for a word in the list of previously used commands |
|
||||||
|
| help | `man` | Opens up the man page for a command |
|
||||||
|
| p | `ps -f` | Displays currently executing processes |
|
||||||
|
| sortnr | `sort -n -r` | Used to sort the lines of a text file |
|
||||||
|
| unexport | `unset` | Used to unset an environment variable |
|
||||||
|
|
||||||
|
## Global aliases
|
||||||
|
|
||||||
|
These aliases are expanded in any position in the command line, meaning you can use them even at the
|
||||||
|
end of the command you've typed. Examples:
|
||||||
|
|
||||||
|
Quickly pipe to less:
|
||||||
|
```zsh
|
||||||
|
$ ls -l /var/log L
|
||||||
|
# will run
|
||||||
|
$ ls -l /var/log | less
|
||||||
|
```
|
||||||
|
Silences stderr output:
|
||||||
|
```zsh
|
||||||
|
$ find . -type f NE
|
||||||
|
# will run
|
||||||
|
$ find . -type f 2>/dev/null
|
||||||
|
```
|
||||||
|
|
||||||
|
| Alias | Command | Description |
|
||||||
|
|-------|-----------------------------|-------------------------------------------------------------|
|
||||||
|
| H | `\| head` | Pipes output to head which outputs the first part of a file |
|
||||||
|
| T | `\| tail` | Pipes output to tail which outputs the last part of a file |
|
||||||
|
| G | `\| grep` | Pipes output to grep to search for some word |
|
||||||
|
| L | `\| less` | Pipes output to less, useful for paging |
|
||||||
|
| M | `\| most` | Pipes output to more, useful for paging |
|
||||||
|
| LL | `2>&1 \| less` | Writes stderr to stdout and passes it to less |
|
||||||
|
| CA | `2>&1 \| cat -A` | Writes stderr to stdout and passes it to cat |
|
||||||
|
| NE | `2 > /dev/null` | Silences stderr |
|
||||||
|
| NUL | `> /dev/null 2>&1` | Silences both stdout and stderr |
|
||||||
|
| P | `2>&1\| pygmentize -l pytb` | Writes stderr to stdout and passes it to pygmentize |
|
||||||
|
|
||||||
|
## File extension aliases
|
||||||
|
|
||||||
|
These are special aliases that are triggered when a file name is passed as the command. For example,
|
||||||
|
if the pdf file extension is aliased to `acroread` (a popular Linux pdf reader), when running `file.pdf`
|
||||||
|
that file will be open with `acroread`.
|
||||||
|
|
||||||
|
### Reading Docs
|
||||||
|
|
||||||
|
| Alias | Command | Description |
|
||||||
|
|-------|-------------|-------------------------------------|
|
||||||
|
| pdf | `acroread` | Opens up a document using acroread |
|
||||||
|
| ps | `gv` | Opens up a .ps file using gv |
|
||||||
|
| dvi | `xdvi` | Opens up a .dvi file using xdvi |
|
||||||
|
| chm | `xchm` | Opens up a .chm file using xchm |
|
||||||
|
| djvu | `djview` | Opens up a .djvu file using djview |
|
||||||
|
|
||||||
|
### Listing files inside a packed file
|
||||||
|
|
||||||
|
| Alias | Command | Description |
|
||||||
|
|---------|-------------|-------------------------------------|
|
||||||
|
| zip | `unzip -l` | Lists files inside a .zip file |
|
||||||
|
| rar | `unrar l` | Lists files inside a .rar file |
|
||||||
|
| tar | `tar tf` | Lists files inside a .tar file |
|
||||||
|
| tar.gz | `echo` | Lists files inside a .tar.gz file |
|
||||||
|
| ace | `unace l` | Lists files inside a .ace file |
|
||||||
|
|
||||||
|
### Some other features
|
||||||
|
|
||||||
|
- Opens urls in terminal using browser specified by the variable `$BROWSER`
|
||||||
|
- Opens C, C++, Tex and text files using editor specified by the variable `$EDITOR`
|
||||||
|
- Opens images using image viewer specified by the variable `$XIVIEWER`
|
||||||
|
- Opens videos and other media using mplayer
|
|
@ -50,6 +50,7 @@ alias mv='mv -i'
|
||||||
|
|
||||||
# zsh is able to auto-do some kungfoo
|
# zsh is able to auto-do some kungfoo
|
||||||
# depends on the SUFFIX :)
|
# depends on the SUFFIX :)
|
||||||
|
autoload -Uz is-at-least
|
||||||
if is-at-least 4.2.0; then
|
if is-at-least 4.2.0; then
|
||||||
# open browser on urls
|
# open browser on urls
|
||||||
if [[ -n "$BROWSER" ]]; then
|
if [[ -n "$BROWSER" ]]; then
|
||||||
|
|
8
plugins/compleat/README.md
Normal file
8
plugins/compleat/README.md
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# compleat plugin
|
||||||
|
|
||||||
|
This plugin looks for [compleat](https://github.com/mbrubeck/compleat) and loads its completion.
|
||||||
|
|
||||||
|
To use it, add compleat to the plugins array in your zshrc file:
|
||||||
|
```
|
||||||
|
plugins=(... compleat)
|
||||||
|
```
|
|
@ -1,9 +1,9 @@
|
||||||
# copy the active line from the command line buffer
|
# copy the active line from the command line buffer
|
||||||
# onto the system clipboard (requires clipcopy plugin)
|
# onto the system clipboard
|
||||||
|
|
||||||
copybuffer () {
|
copybuffer () {
|
||||||
if which clipcopy &>/dev/null; then
|
if which clipcopy &>/dev/null; then
|
||||||
echo $BUFFER | clipcopy
|
printf "%s" "$BUFFER" | clipcopy
|
||||||
else
|
else
|
||||||
echo "clipcopy function not found. Please make sure you have Oh My Zsh installed correctly."
|
echo "clipcopy function not found. Please make sure you have Oh My Zsh installed correctly."
|
||||||
fi
|
fi
|
||||||
|
|
28
plugins/dash/README.md
Normal file
28
plugins/dash/README.md
Normal file
|
@ -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
|
||||||
|
```
|
|
@ -35,36 +35,30 @@ _dash() {
|
||||||
if [[ "$locator" == "platform" ]]; then
|
if [[ "$locator" == "platform" ]]; then
|
||||||
# Since these are the only special cases right now, let's not do the
|
# Since these are the only special cases right now, let's not do the
|
||||||
# expensive processing unless we have to
|
# expensive processing unless we have to
|
||||||
if [[ "$keyword" == "python" || "$keyword" == "java" || \
|
if [[ "$keyword" = (python|java|qt|cocos2d) ]]; then
|
||||||
"$keyword" == "qt" || "$keyword" == "cocs2d" ]]; then
|
|
||||||
docsetName=`echo $doc | grep -Eo "docsetName = .*?;" | sed -e "s/docsetName = \(.*\);/\1/" -e "s/[\":]//g"`
|
docsetName=`echo $doc | grep -Eo "docsetName = .*?;" | sed -e "s/docsetName = \(.*\);/\1/" -e "s/[\":]//g"`
|
||||||
if [[ "$keyword" == "python" ]]; then
|
case "$keyword" in
|
||||||
if [[ "$docsetName" == "Python 2" ]]; then
|
python)
|
||||||
keyword="python2"
|
case "$docsetName" in
|
||||||
elif [[ "$docsetName" == "Python 3" ]]; then
|
"Python 2") keyword="python2" ;;
|
||||||
keyword="python3"
|
"Python 3") keyword="python3" ;;
|
||||||
fi
|
esac ;;
|
||||||
elif [[ "$keyword" == "java" ]]; then
|
java)
|
||||||
if [[ "$docsetName" == "Java SE7" ]]; then
|
case "$docsetName" in
|
||||||
keyword="java7"
|
"Java SE7") keyword="java7" ;;
|
||||||
elif [[ "$docsetName" == "Java SE6" ]]; then
|
"Java SE6") keyword="java6" ;;
|
||||||
keyword="java6"
|
"Java SE8") keyword="java8" ;;
|
||||||
elif [[ "$docsetName" == "Java SE8" ]]; then
|
esac ;;
|
||||||
keyword="java8"
|
qt)
|
||||||
fi
|
case "$docsetName" in
|
||||||
elif [[ "$keyword" == "qt" ]]; then
|
"Qt 5") keyword="qt5" ;;
|
||||||
if [[ "$docsetName" == "Qt 5" ]]; then
|
"Qt 4"|Qt) keyword="qt4" ;;
|
||||||
keyword="qt5"
|
esac ;;
|
||||||
elif [[ "$docsetName" == "Qt 4" ]]; then
|
cocos2d)
|
||||||
keyword="qt4"
|
case "$docsetName" in
|
||||||
elif [[ "$docsetName" == "Qt" ]]; then
|
Cocos3D) keyword="cocos3d" ;;
|
||||||
keyword="qt4"
|
esac ;;
|
||||||
fi
|
esac
|
||||||
elif [[ "$keyword" == "cocos2d" ]]; then
|
|
||||||
if [[ "$docsetName" == "Cocos3D" ]]; then
|
|
||||||
keyword="cocos3d"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ if [[ $use_sudo -eq 1 ]]; then
|
||||||
# commands using su #########
|
# commands using su #########
|
||||||
else
|
else
|
||||||
alias aac="su -ls '$apt_pref autoclean' root"
|
alias aac="su -ls '$apt_pref autoclean' root"
|
||||||
abd() {
|
function abd() {
|
||||||
cmd="su -lc '$apt_pref build-dep $@' root"
|
cmd="su -lc '$apt_pref build-dep $@' root"
|
||||||
print "$cmd"
|
print "$cmd"
|
||||||
eval "$cmd"
|
eval "$cmd"
|
||||||
|
@ -83,17 +83,17 @@ else
|
||||||
alias adu="su -lc '$apt_pref update && aptitude dist-upgrade' root"
|
alias adu="su -lc '$apt_pref update && aptitude dist-upgrade' root"
|
||||||
alias afu="su -lc '$apt-file update'"
|
alias afu="su -lc '$apt-file update'"
|
||||||
alias au="su -lc '$apt_pref $apt_upgr' root"
|
alias au="su -lc '$apt_pref $apt_upgr' root"
|
||||||
ai() {
|
function ai() {
|
||||||
cmd="su -lc 'aptitude -P install $@' root"
|
cmd="su -lc 'aptitude -P install $@' root"
|
||||||
print "$cmd"
|
print "$cmd"
|
||||||
eval "$cmd"
|
eval "$cmd"
|
||||||
}
|
}
|
||||||
ap() {
|
function ap() {
|
||||||
cmd="su -lc '$apt_pref -P purge $@' root"
|
cmd="su -lc '$apt_pref -P purge $@' root"
|
||||||
print "$cmd"
|
print "$cmd"
|
||||||
eval "$cmd"
|
eval "$cmd"
|
||||||
}
|
}
|
||||||
ar() {
|
function ar() {
|
||||||
cmd="su -lc '$apt_pref -P remove $@' root"
|
cmd="su -lc '$apt_pref -P remove $@' root"
|
||||||
print "$cmd"
|
print "$cmd"
|
||||||
eval "$cmd"
|
eval "$cmd"
|
||||||
|
@ -114,7 +114,7 @@ fi
|
||||||
# Registers a compdef for $1 that calls $apt_pref with the commands $2
|
# Registers a compdef for $1 that calls $apt_pref with the commands $2
|
||||||
# To do that it creates a new completion function called _apt_pref_$2
|
# To do that it creates a new completion function called _apt_pref_$2
|
||||||
#
|
#
|
||||||
apt_pref_compdef() {
|
function apt_pref_compdef() {
|
||||||
local f fb
|
local f fb
|
||||||
f="_apt_pref_${2}"
|
f="_apt_pref_${2}"
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
|
||||||
|
|
||||||
# Functions #################################################################
|
# Functions #################################################################
|
||||||
# create a simple script that can be used to 'duplicate' a system
|
# create a simple script that can be used to 'duplicate' a system
|
||||||
apt-copy() {
|
function apt-copy() {
|
||||||
print '#!/bin/sh'"\n" > apt-copy.sh
|
print '#!/bin/sh'"\n" > apt-copy.sh
|
||||||
|
|
||||||
cmd='$apt_pref install'
|
cmd='$apt_pref install'
|
||||||
|
@ -173,7 +173,7 @@ apt-copy() {
|
||||||
# apt-history rollback
|
# apt-history rollback
|
||||||
# apt-history list
|
# apt-history list
|
||||||
# Based On: https://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html
|
# Based On: https://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html
|
||||||
apt-history () {
|
function apt-history() {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
install)
|
install)
|
||||||
zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*)
|
zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*)
|
||||||
|
@ -202,7 +202,7 @@ apt-history () {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Kernel-package building shortcut
|
# Kernel-package building shortcut
|
||||||
kerndeb () {
|
function kerndeb() {
|
||||||
# temporarily unset MAKEFLAGS ( '-j3' will fail )
|
# temporarily unset MAKEFLAGS ( '-j3' will fail )
|
||||||
MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )
|
MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )
|
||||||
print '$MAKEFLAGS set to '"'$MAKEFLAGS'"
|
print '$MAKEFLAGS set to '"'$MAKEFLAGS'"
|
||||||
|
@ -216,10 +216,9 @@ kerndeb () {
|
||||||
}
|
}
|
||||||
|
|
||||||
# List packages by size
|
# List packages by size
|
||||||
function apt-list-packages {
|
function apt-list-packages() {
|
||||||
dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | \
|
dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | \
|
||||||
grep -v deinstall | \
|
grep -v deinstall | \
|
||||||
sort -n | \
|
sort -n | \
|
||||||
awk '{print $1" "$2}'
|
awk '{print $1" "$2}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
```console
|
||||||
$ source ~/.zshrc
|
$ exec zsh
|
||||||
$
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,8 @@ function push_future() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Called by zsh when directory changes
|
# Called by zsh when directory changes
|
||||||
chpwd_functions+=(chpwd_dirhistory)
|
autoload -U add-zsh-hook
|
||||||
|
add-zsh-hook chpwd chpwd_dirhistory
|
||||||
function chpwd_dirhistory() {
|
function chpwd_dirhistory() {
|
||||||
push_past $PWD
|
push_past $PWD
|
||||||
# If DIRHISTORY_CD is not set...
|
# If DIRHISTORY_CD is not set...
|
||||||
|
|
|
@ -11,7 +11,8 @@ if [[ -f ${dirstack_file} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then
|
||||||
[[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD
|
[[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chpwd_functions+=(chpwd_dirpersist)
|
autoload -U add-zsh-hook
|
||||||
|
add-zsh-hook chpwd chpwd_dirpersist
|
||||||
chpwd_dirpersist() {
|
chpwd_dirpersist() {
|
||||||
if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi
|
if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi
|
||||||
local -ax my_stack
|
local -ax my_stack
|
||||||
|
|
|
@ -374,7 +374,8 @@ _managepy-commands() {
|
||||||
_applist() {
|
_applist() {
|
||||||
local line
|
local line
|
||||||
local -a apps
|
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\\
|
bn=op.basename(op.abspath(op.curdir));[sys\\
|
||||||
.stdout.write(str(re.sub(r'^%s\.(.*?)$' %
|
.stdout.write(str(re.sub(r'^%s\.(.*?)$' %
|
||||||
bn, r'\1', i)) + '\n') for i in django.conf.settings.\\
|
bn, r'\1', i)) + '\n') for i in django.conf.settings.\\
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
## Docker autocomplete plugin
|
# Docker plugin
|
||||||
|
|
||||||
A copy of the completion script from the
|
This plugin adds auto-completion for [docker](https://www.docker.com/).
|
||||||
[docker/cli](https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker)
|
|
||||||
git repo.
|
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
|
||||||
|
|
|
@ -32,6 +32,8 @@ PORT=3001
|
||||||
```
|
```
|
||||||
You can even mix both formats, although it's probably a bad idea.
|
You can even mix both formats, although it's probably a bad idea.
|
||||||
|
|
||||||
|
## Plugin options
|
||||||
|
|
||||||
### ZSH_DOTENV_FILE
|
### ZSH_DOTENV_FILE
|
||||||
|
|
||||||
You can also modify the name of the file to be loaded with the variable `ZSH_DOTENV_FILE`.
|
You can also modify the name of the file to be loaded with the variable `ZSH_DOTENV_FILE`.
|
||||||
|
@ -43,6 +45,10 @@ For example, this will make the plugin look for files named `.dotenv` and load t
|
||||||
ZSH_DOTENV_FILE=.dotenv
|
ZSH_DOTENV_FILE=.dotenv
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### ZSH_DOTENV_PROMPT
|
||||||
|
|
||||||
|
Set `ZSH_DOTENV_PROMPT=false` in your zshrc file if you don't want the confirmation message.
|
||||||
|
|
||||||
## Version Control
|
## 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.
|
**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.
|
||||||
|
|
|
@ -1,5 +1,17 @@
|
||||||
source_env() {
|
source_env() {
|
||||||
if [[ -f $ZSH_DOTENV_FILE ]]; then
|
if [[ -f $ZSH_DOTENV_FILE ]]; then
|
||||||
|
if [ "$ZSH_DOTENV_PROMPT" != "false" ]; then
|
||||||
|
# confirm before sourcing file
|
||||||
|
local confirmation
|
||||||
|
# print same-line prompt and output newline character if necessary
|
||||||
|
echo -n "dotenv: source '$ZSH_DOTENV_FILE' file in the directory? (Y/n) "
|
||||||
|
read -k 1 confirmation; [[ "$confirmation" != $'\n' ]] && echo
|
||||||
|
# only bail out if confirmation character is n
|
||||||
|
if [[ "$confirmation" = [nN] ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# test .env syntax
|
# test .env syntax
|
||||||
zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2
|
zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2
|
||||||
|
|
||||||
|
|
23
plugins/dotnet/README.md
Normal file
23
plugins/dotnet/README.md
Normal file
|
@ -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. |
|
32
plugins/dotnet/dotnet.plugin.zsh
Normal file
32
plugins/dotnet/dotnet.plugin.zsh
Normal file
|
@ -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'
|
11
plugins/eecms/README.md
Normal file
11
plugins/eecms/README.md
Normal file
|
@ -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.
|
|
@ -20,7 +20,8 @@ _emacsfun()
|
||||||
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
|
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
|
||||||
if [ "$#" -ge "2" -a "$2" = "-" ]
|
if [ "$#" -ge "2" -a "$2" = "-" ]
|
||||||
then
|
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"
|
cat - > "$tempfile"
|
||||||
_emacsfun --no-wait $tempfile
|
_emacsfun --no-wait $tempfile
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# FILE: emoji-clock.plugin.zsh
|
# FILE: emoji-clock.plugin.zsh
|
||||||
# DESCRIPTION: The current time with half hour accuracy as an emoji symbol.
|
# DESCRIPTION: The current time with half hour accuracy as an emoji symbol.
|
||||||
# Inspired by Andre Torrez' "Put A Burger In Your Shell"
|
# 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)
|
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
|
||||||
# VERSION: 1.0.0
|
# VERSION: 1.0.0
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
39
plugins/emotty/README.md
Normal file
39
plugins/emotty/README.md
Normal file
|
@ -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
|
||||||
|
<list of all the emojis in the zodiac character set>
|
||||||
|
```
|
|
@ -20,10 +20,10 @@ Alias plugin for encoding or decoding using `base64` command
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Restart your terminal session or reload configuration by running:
|
2. Restart your terminal session or restart the shell:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
source ~/.zshrc
|
exec zsh
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage and examples
|
## Usage and examples
|
||||||
|
|
|
@ -25,23 +25,32 @@ plugins=(... extract)
|
||||||
| `gz` | Gzip file |
|
| `gz` | Gzip file |
|
||||||
| `ipsw` | iOS firmware file |
|
| `ipsw` | iOS firmware file |
|
||||||
| `jar` | Java Archive |
|
| `jar` | Java Archive |
|
||||||
|
| `lrz` | LRZ archive |
|
||||||
|
| `lz4` | LZ4 archive |
|
||||||
| `lzma` | LZMA archive |
|
| `lzma` | LZMA archive |
|
||||||
| `rar` | WinRAR archive |
|
| `rar` | WinRAR archive |
|
||||||
|
| `rpm` | RPM package |
|
||||||
| `sublime-package` | Sublime Text package |
|
| `sublime-package` | Sublime Text package |
|
||||||
| `tar` | Tarball |
|
| `tar` | Tarball |
|
||||||
| `tar.bz2` | Tarball with bzip2 compression |
|
| `tar.bz2` | Tarball with bzip2 compression |
|
||||||
| `tar.gz` | Tarball with gzip 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.xz` | Tarball with lzma2 compression |
|
||||||
| `tar.zma` | Tarball with lzma compression |
|
| `tar.zma` | Tarball with lzma compression |
|
||||||
|
| `tar.zst` | Tarball with zstd compression |
|
||||||
| `tbz` | Tarball with bzip compression |
|
| `tbz` | Tarball with bzip compression |
|
||||||
| `tbz2` | Tarball with bzip2 compression |
|
| `tbz2` | Tarball with bzip2 compression |
|
||||||
| `tgz` | Tarball with gzip compression |
|
| `tgz` | Tarball with gzip compression |
|
||||||
| `tlz` | Tarball with lzma compression |
|
| `tlz` | Tarball with lzma compression |
|
||||||
| `txz` | Tarball with lzma2 compression |
|
| `txz` | Tarball with lzma2 compression |
|
||||||
|
| `tzst` | Tarball with zstd compression |
|
||||||
| `war` | Web Application archive (Java-based) |
|
| `war` | Web Application archive (Java-based) |
|
||||||
| `xpi` | Mozilla XPI module file |
|
| `xpi` | Mozilla XPI module file |
|
||||||
| `xz` | LZMA2 archive |
|
| `xz` | LZMA2 archive |
|
||||||
| `zip` | Zip archive |
|
| `zip` | Zip archive |
|
||||||
|
| `zst` | Zstandard file (zstd) |
|
||||||
|
|
||||||
See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for
|
See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for
|
||||||
more information regarding archive formats.
|
more information regarding archive formats.
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
|
|
||||||
_arguments \
|
_arguments \
|
||||||
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
|
'(-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|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
|
&& return 0
|
||||||
|
|
|
@ -40,14 +40,24 @@ extract() {
|
||||||
tar --lzma --help &> /dev/null \
|
tar --lzma --help &> /dev/null \
|
||||||
&& tar --lzma -xvf "$1" \
|
&& tar --lzma -xvf "$1" \
|
||||||
|| lzcat "$1" | tar xvf - ;;
|
|| lzcat "$1" | tar xvf - ;;
|
||||||
|
(*.tar.zst|*.tzst)
|
||||||
|
tar --zstd --help &> /dev/null \
|
||||||
|
&& tar --zstd -xvf "$1" \
|
||||||
|
|| zstdcat "$1" | tar xvf - ;;
|
||||||
(*.tar) tar xvf "$1" ;;
|
(*.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" ;;
|
(*.bz2) bunzip2 "$1" ;;
|
||||||
(*.xz) unxz "$1" ;;
|
(*.xz) unxz "$1" ;;
|
||||||
|
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$1" ;;
|
||||||
|
(*.lz4) lz4 -d "$1" ;;
|
||||||
(*.lzma) unlzma "$1" ;;
|
(*.lzma) unlzma "$1" ;;
|
||||||
(*.z) uncompress "$1" ;;
|
(*.z) uncompress "$1" ;;
|
||||||
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;;
|
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;;
|
||||||
(*.rar) unrar x -ad "$1" ;;
|
(*.rar) unrar x -ad "$1" ;;
|
||||||
|
(*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;;
|
||||||
(*.7z) 7za x "$1" ;;
|
(*.7z) 7za x "$1" ;;
|
||||||
(*.deb)
|
(*.deb)
|
||||||
mkdir -p "$extract_dir/control"
|
mkdir -p "$extract_dir/control"
|
||||||
|
@ -58,6 +68,7 @@ extract() {
|
||||||
cd ..; rm *.tar.* debian-binary
|
cd ..; rm *.tar.* debian-binary
|
||||||
cd ..
|
cd ..
|
||||||
;;
|
;;
|
||||||
|
(*.zst) unzstd "$1" ;;
|
||||||
(*)
|
(*)
|
||||||
echo "extract: '$1' cannot be extracted" >&2
|
echo "extract: '$1' cannot be extracted" >&2
|
||||||
success=1
|
success=1
|
||||||
|
|
|
@ -4,10 +4,19 @@
|
||||||
local curcontext=$curcontext state line
|
local curcontext=$curcontext state line
|
||||||
declare -A opt_args
|
declare -A opt_args
|
||||||
|
|
||||||
declare target_list
|
declare -a target_list
|
||||||
target_list=(`fab --shortlist 2>/dev/null`)
|
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
|
_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' \
|
'(-)--shortlist[print non-verbose list of possible commands and exit]: :->noargs' \
|
||||||
'(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \
|
'(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \
|
||||||
'(--no-pty)--no-pty[do not use pseudo-terminal in run/sudo]' \
|
'(--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]' \
|
'(-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]' \
|
'(-r --reject-unknown-hosts)'{-r,--reject-unknown-hosts}'[reject unknown hosts]' \
|
||||||
'(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \
|
'(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \
|
||||||
|
@ -53,7 +62,7 @@ if [[ CURRENT -ge 1 ]]; then
|
||||||
levels)
|
levels)
|
||||||
_describe -t commands "output levels" output_levels;;
|
_describe -t commands "output levels" output_levels;;
|
||||||
*)
|
*)
|
||||||
_targets;;
|
_fab_targets;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
21
plugins/fasd/README.md
Normal file
21
plugins/fasd/README.md
Normal file
|
@ -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 |
|
84
plugins/fastfile/README.md
Normal file
84
plugins/fastfile/README.md
Normal file
|
@ -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 <shortcut_name> <path/to/file/or/folder>`: generate a shortcut.
|
||||||
|
|
||||||
|
- `fastfile_print <shortcut_name>`: prints a shortcut, with the format
|
||||||
|
`<prefix><shortcut_name> -> <shortcut_path>`.
|
||||||
|
|
||||||
|
- `fastfile_ls`: lists all shortcuts.
|
||||||
|
|
||||||
|
- `fastfile_rm <shortcut_name> `: remove a shortcut.
|
||||||
|
|
||||||
|
- `fastfile_sync`: generates the global aliases for the shortcuts.
|
||||||
|
|
||||||
|
|
||||||
|
### Internal functions
|
||||||
|
|
||||||
|
- `fastfile_resolv <shortcut_name>`: resolves the location of the shortcut
|
||||||
|
file, i.e., the file in the fastfile directory where the shortcut path
|
||||||
|
is stored.
|
||||||
|
|
||||||
|
- `fastfile_get <shortcut_name>`: 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 `<variable>=<value>` 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)
|
|
@ -1,13 +1,3 @@
|
||||||
################################################################################
|
|
||||||
# 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
|
||||||
|
|
||||||
|
@ -51,7 +41,7 @@ function fastfile() {
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# 1. name - The name of the shortcut
|
# 1. name - The name of the shortcut
|
||||||
# STDOUT:
|
# STDOUT:
|
||||||
# The path
|
# The path to the shortcut file
|
||||||
#
|
#
|
||||||
function fastfile_resolv() {
|
function fastfile_resolv() {
|
||||||
echo "${fastfile_dir}${1}"
|
echo "${fastfile_dir}${1}"
|
||||||
|
@ -89,11 +79,11 @@ function fastfile_print() {
|
||||||
#
|
#
|
||||||
function fastfile_ls() {
|
function fastfile_ls() {
|
||||||
for f in "${fastfile_dir}"/*; do
|
for f in "${fastfile_dir}"/*; do
|
||||||
file=`basename "$f"` # To enable simpler handeling of spaces in file names
|
file=`basename "$f"` # To enable simpler handeling of spaces in file names
|
||||||
varkey=`echo "$file" | tr " " "_"`
|
varkey=`echo "$file" | tr " " "_"`
|
||||||
|
|
||||||
# Special format for colums
|
# Special format for colums
|
||||||
echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
|
echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
|
||||||
done | column -t -s "|"
|
done | column -t -s "|"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +92,6 @@ function fastfile_ls() {
|
||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# 1. name - The name of the shortcut (default: name of the file)
|
# 1. name - The name of the shortcut (default: name of the file)
|
||||||
# 2. file - The file or directory to make the shortcut for
|
|
||||||
# STDOUT:
|
# STDOUT:
|
||||||
# => fastfle_print
|
# => fastfle_print
|
||||||
#
|
#
|
||||||
|
@ -116,10 +105,10 @@ function fastfile_rm() {
|
||||||
#
|
#
|
||||||
function fastfile_sync() {
|
function fastfile_sync() {
|
||||||
for f in "${fastfile_dir}"/*; do
|
for f in "${fastfile_dir}"/*; do
|
||||||
file=`basename "$f"` # To enable simpler handeling of spaces in file names
|
file=`basename "$f"` # To enable simpler handeling of spaces in file names
|
||||||
varkey=`echo "$file" | tr " " "_"`
|
varkey=`echo "$file" | tr " " "_"`
|
||||||
|
|
||||||
alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
|
alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
9
plugins/fbterm/README.md
Normal file
9
plugins/fbterm/README.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# fbterm
|
||||||
|
|
||||||
|
This plugin automatically starts [fbterm](https://github.com/zhangyuanwei/fbterm)
|
||||||
|
if on a real TTY (`/dev/tty*`).
|
||||||
|
|
||||||
|
To use it, add fbterm to the plugins array of your zshrc file:
|
||||||
|
```
|
||||||
|
plugins=(... fbterm)
|
||||||
|
```
|
|
@ -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.
|
||||||
|
|
21
plugins/flutter/README.md
Normal file
21
plugins/flutter/README.md
Normal file
|
@ -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 |
|
37
plugins/flutter/_flutter
Normal file
37
plugins/flutter/_flutter
Normal file
|
@ -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
|
7
plugins/flutter/flutter.plugin.zsh
Normal file
7
plugins/flutter/flutter.plugin.zsh
Normal file
|
@ -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"
|
|
@ -62,6 +62,10 @@ Available search contexts are:
|
||||||
|
|
||||||
If you want to have another context, open an Issue and tell us!
|
If you want to have another context, open an Issue and tell us!
|
||||||
|
|
||||||
|
## Fallback search behaviour
|
||||||
|
|
||||||
|
The plugin will use Google as a fallback if the docs site for a search context does not have a search function. You can set the fallback search engine to DuckDuckGo by setting `FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced.
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
**Wilson Mendes (willmendesneto)**
|
**Wilson Mendes (willmendesneto)**
|
||||||
|
|
|
@ -27,6 +27,17 @@ alias typescript='frontend typescript'
|
||||||
alias unheap='frontend unheap'
|
alias unheap='frontend unheap'
|
||||||
alias vuejs='frontend vuejs'
|
alias vuejs='frontend vuejs'
|
||||||
|
|
||||||
|
function _frontend_fallback() {
|
||||||
|
local url
|
||||||
|
if [[ "$FRONTEND_SEARCH_FALLBACK" == duckduckgo ]]; then
|
||||||
|
url="https://duckduckgo.com/?sites=$1&q="
|
||||||
|
else
|
||||||
|
url="https://google.com/search?as_sitesearch=$1&as_q="
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$url"
|
||||||
|
}
|
||||||
|
|
||||||
function frontend() {
|
function frontend() {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
|
|
||||||
|
@ -34,8 +45,8 @@ function frontend() {
|
||||||
typeset -A urls
|
typeset -A urls
|
||||||
urls=(
|
urls=(
|
||||||
angular 'https://angular.io/?search='
|
angular 'https://angular.io/?search='
|
||||||
angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q='
|
angularjs $(_frontend_fallback 'angularjs.org')
|
||||||
bem 'https://google.com/search?as_sitesearch=bem.info&as_q='
|
bem $(_frontend_fallback 'bem.info')
|
||||||
bootsnipp 'https://bootsnipp.com/search?q='
|
bootsnipp 'https://bootsnipp.com/search?q='
|
||||||
bundlephobia 'https://bundlephobia.com/result?p='
|
bundlephobia 'https://bundlephobia.com/result?p='
|
||||||
caniuse 'https://caniuse.com/#search='
|
caniuse 'https://caniuse.com/#search='
|
||||||
|
@ -43,24 +54,24 @@ function frontend() {
|
||||||
compassdoc 'http://compass-style.org/search?q='
|
compassdoc 'http://compass-style.org/search?q='
|
||||||
cssflow 'http://www.cssflow.com/search?q='
|
cssflow 'http://www.cssflow.com/search?q='
|
||||||
dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:'
|
dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:'
|
||||||
emberjs 'https://www.google.com/search?as_sitesearch=emberjs.com/&as_q='
|
emberjs $(_frontend_fallback 'emberjs.com/')
|
||||||
flowtype 'https://google.com/search?as_sitesearch=flow.org/en/docs/&as_q='
|
flowtype $(_frontend_fallback 'flow.org/en/docs/')
|
||||||
fontello 'http://fontello.com/#search='
|
fontello 'http://fontello.com/#search='
|
||||||
github 'https://github.com/search?q='
|
github 'https://github.com/search?q='
|
||||||
html5please 'https://html5please.com/#'
|
html5please 'https://html5please.com/#'
|
||||||
jestjs 'https://www.google.com/search?as_sitesearch=jestjs.io&as_q='
|
jestjs $(_frontend_fallback 'jestjs.io')
|
||||||
jquery 'https://api.jquery.com/?s='
|
jquery 'https://api.jquery.com/?s='
|
||||||
lodash 'https://devdocs.io/lodash/index#'
|
lodash 'https://devdocs.io/lodash/index#'
|
||||||
mdn 'https://developer.mozilla.org/search?q='
|
mdn 'https://developer.mozilla.org/search?q='
|
||||||
nodejs 'https://www.google.com/search?as_sitesearch=nodejs.org/en/docs/&as_q='
|
nodejs $(_frontend_fallback 'nodejs.org/en/docs/')
|
||||||
npmjs 'https://www.npmjs.com/search?q='
|
npmjs 'https://www.npmjs.com/search?q='
|
||||||
qunit 'https://api.qunitjs.com/?s='
|
qunit 'https://api.qunitjs.com/?s='
|
||||||
reactjs 'https://google.com/search?as_sitesearch=facebook.github.io/react&as_q='
|
reactjs $(_frontend_fallback 'reactjs.org/')
|
||||||
smacss 'https://google.com/search?as_sitesearch=smacss.com&as_q='
|
smacss $(_frontend_fallback 'smacss.com')
|
||||||
stackoverflow 'https://stackoverflow.com/search?q='
|
stackoverflow 'https://stackoverflow.com/search?q='
|
||||||
typescript 'https://google.com/search?as_sitesearch=www.typescriptlang.org/docs&as_q='
|
typescript $(_frontend_fallback 'www.typescriptlang.org/docs')
|
||||||
unheap 'http://www.unheap.com/?s='
|
unheap 'http://www.unheap.com/?s='
|
||||||
vuejs 'https://www.google.com/search?as_sitesearch=vuejs.org&as_q='
|
vuejs $(_frontend_fallback 'vuejs.org')
|
||||||
)
|
)
|
||||||
|
|
||||||
# show help for command list
|
# show help for command list
|
||||||
|
|
|
@ -1,57 +1,100 @@
|
||||||
test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}"
|
function setup_using_base_dir() {
|
||||||
|
# Declare all variables local not no mess with outside env in any way
|
||||||
|
local fzf_base
|
||||||
|
local fzf_shell
|
||||||
|
local fzfdirs
|
||||||
|
local dir
|
||||||
|
|
||||||
if [[ -z "${fzf_base}" ]]; then
|
test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}"
|
||||||
fzfdirs=(
|
|
||||||
"${HOME}/.fzf"
|
|
||||||
"/usr/local/opt/fzf"
|
|
||||||
"/usr/share/fzf"
|
|
||||||
)
|
|
||||||
for dir in ${fzfdirs}; do
|
|
||||||
if [[ -d "${dir}" ]]; then
|
|
||||||
fzf_base="${dir}"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ -z "${fzf_base}" ]]; then
|
if [[ -z "${fzf_base}" ]]; then
|
||||||
if (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
|
fzfdirs=(
|
||||||
if [[ -d "${dir}" ]]; then
|
"${HOME}/.fzf"
|
||||||
fzf_base="${dir}"
|
"${HOME}/.nix-profile/share/fzf"
|
||||||
fi
|
"/usr/local/opt/fzf"
|
||||||
fi
|
"/usr/share/fzf"
|
||||||
fi
|
"/usr/local/share/examples/fzf"
|
||||||
fi
|
)
|
||||||
|
for dir in ${fzfdirs}; do
|
||||||
|
if [[ -d "${dir}" ]]; then
|
||||||
|
fzf_base="${dir}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
if [[ -n "${fzf_base}" ]]; then
|
if [[ -z "${fzf_base}" ]]; then
|
||||||
|
if (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
|
||||||
|
if [[ -d "${dir}" ]]; then
|
||||||
|
fzf_base="${dir}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Fix fzf shell directory for Archlinux package
|
if [[ -d "${fzf_base}" ]]; then
|
||||||
if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then
|
# Fix fzf shell directory for Arch Linux, NixOS or Void Linux packages
|
||||||
fzf_shell="${fzf_base}"
|
if [[ ! -d "${fzf_base}/shell" ]]; then
|
||||||
else
|
fzf_shell="${fzf_base}"
|
||||||
fzf_shell="${fzf_base}/shell"
|
else
|
||||||
fi
|
fzf_shell="${fzf_base}/shell"
|
||||||
|
fi
|
||||||
|
|
||||||
# Setup fzf
|
# Setup fzf binary path
|
||||||
# ---------
|
if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then
|
||||||
if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then
|
export PATH="$PATH:$fzf_base/bin"
|
||||||
export PATH="$PATH:$fzf_base/bin"
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Auto-completion
|
# Auto-completion
|
||||||
# ---------------
|
if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then
|
||||||
if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then
|
[[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null
|
||||||
[[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Key bindings
|
# Key bindings
|
||||||
# ------------
|
if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
|
||||||
if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
|
source "${fzf_shell}/key-bindings.zsh"
|
||||||
source "${fzf_shell}/key-bindings.zsh"
|
fi
|
||||||
fi
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
else
|
|
||||||
print "[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.\n"\
|
|
||||||
"Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2
|
|
||||||
fi
|
|
||||||
|
|
||||||
unset fzf_base fzf_shell dir fzfdirs
|
function setup_using_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
|
||||||
|
|
9
plugins/gas/README.md
Normal file
9
plugins/gas/README.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# 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)
|
||||||
|
```
|
24
plugins/gcloud/README.md
Normal file
24
plugins/gcloud/README.md
Normal file
|
@ -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.
|
33
plugins/gcloud/gcloud.plugin.zsh
Normal file
33
plugins/gcloud/gcloud.plugin.zsh
Normal file
|
@ -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
|
|
@ -1,16 +1,17 @@
|
||||||
GIT_AUTO_FETCH_INTERVAL=${GIT_AUTO_FETCH_INTERVAL:=60}
|
GIT_AUTO_FETCH_INTERVAL=${GIT_AUTO_FETCH_INTERVAL:=60}
|
||||||
|
|
||||||
function git-fetch-all {
|
function git-fetch-all {
|
||||||
(`git rev-parse --is-inside-work-tree 2>/dev/null` &&
|
(`command git rev-parse --is-inside-work-tree 2>/dev/null` &&
|
||||||
dir=`git rev-parse --git-dir` &&
|
dir=`command git rev-parse --git-dir` &&
|
||||||
[[ ! -f $dir/NO_AUTO_FETCH ]] &&
|
[[ ! -f $dir/NO_AUTO_FETCH ]] &&
|
||||||
(( `date +%s` - `date -r $dir/FETCH_LOG +%s 2>/dev/null || echo 0` > $GIT_AUTO_FETCH_INTERVAL )) &&
|
(( `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 {
|
function git-auto-fetch {
|
||||||
`git rev-parse --is-inside-work-tree 2>/dev/null` || return
|
`command git rev-parse --is-inside-work-tree 2>/dev/null` || return
|
||||||
guard="`git rev-parse --git-dir`/NO_AUTO_FETCH"
|
guard="`command git rev-parse --git-dir`/NO_AUTO_FETCH"
|
||||||
|
|
||||||
(rm $guard 2>/dev/null &&
|
(rm $guard 2>/dev/null &&
|
||||||
echo "${fg_bold[green]}enabled${reset_color}") ||
|
echo "${fg_bold[green]}enabled${reset_color}") ||
|
||||||
|
@ -18,10 +19,18 @@ function git-auto-fetch {
|
||||||
echo "${fg_bold[red]}disabled${reset_color}")
|
echo "${fg_bold[red]}disabled${reset_color}")
|
||||||
}
|
}
|
||||||
|
|
||||||
eval "override-git-auto-fetch-$(declare -f zle-line-init)"
|
# Override zle-line-init if it exists
|
||||||
|
if (( $+functions[zle-line-init] )); then
|
||||||
|
eval "override-git-auto-fetch-$(declare -f zle-line-init)"
|
||||||
|
|
||||||
|
function zle-line-init () {
|
||||||
|
git-fetch-all
|
||||||
|
override-git-auto-fetch-zle-line-init
|
||||||
|
}
|
||||||
|
else
|
||||||
|
function zle-line-init () {
|
||||||
|
git-fetch-all
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
function zle-line-init () {
|
|
||||||
git-fetch-all
|
|
||||||
override-git-auto-fetch-zle-line-init
|
|
||||||
}
|
|
||||||
zle -N zle-line-init
|
zle -N zle-line-init
|
||||||
|
|
16
plugins/git-escape-magic/README.md
Normal file
16
plugins/git-escape-magic/README.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Git Escape Magic
|
||||||
|
|
||||||
|
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 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.
|
||||||
|
|
||||||
|
**NOTE**: If you use url-quote-magic, it must be included before this
|
||||||
|
plugin runs to prevent any conflicts.
|
135
plugins/git-escape-magic/git-escape-magic
Normal file
135
plugins/git-escape-magic/git-escape-magic
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
# -*- mode: sh -*-
|
||||||
|
#
|
||||||
|
# git-escape-magic - zle tweak for git command line arguments
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011, 2012, 2014 Akinori MUSHA
|
||||||
|
# Licensed under the 2-clause BSD license.
|
||||||
|
#
|
||||||
|
# This tweak eliminates the need for manually escaping shell
|
||||||
|
# meta-characters such as [~^{}] that are used for specifying a git
|
||||||
|
# object (commit or tree). Every time you type one of these
|
||||||
|
# characters on a git command line, it is automatically escaped with a
|
||||||
|
# backslash as necessary and as appropriate.
|
||||||
|
#
|
||||||
|
# If you want to use this with url-quote-magic, make sure to enable it
|
||||||
|
# first.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# autoload -Uz git-escape-magic
|
||||||
|
# git-escape-magic
|
||||||
|
#
|
||||||
|
|
||||||
|
git-escape-magic.self-insert() {
|
||||||
|
emulate -L zsh
|
||||||
|
setopt extendedglob
|
||||||
|
local self_insert_function
|
||||||
|
zstyle -s ':git-escape-magic' self-insert-function self_insert_function
|
||||||
|
|
||||||
|
if [[ "$KEYS" == [{}~^]* ]] && {
|
||||||
|
local qkey="${(q)KEYS}"
|
||||||
|
[[ "$KEYS" != "$qkey" ]]
|
||||||
|
} && {
|
||||||
|
local lbuf="$LBUFFER$qkey"
|
||||||
|
[[ "${(Q)LBUFFER}$KEYS" == "${(Q)lbuf}" ]]
|
||||||
|
} && {
|
||||||
|
local -a words
|
||||||
|
words=("${(@Q)${(z)lbuf}}")
|
||||||
|
[[ "$words[(i)(*/|)git(|-[^/]##)]" -le $#words ]]
|
||||||
|
}
|
||||||
|
then
|
||||||
|
local i
|
||||||
|
i="$words[(I)([;(){\&]|\&[\&\!]|\|\||[=<>]\(*)]"
|
||||||
|
if [[ $i -gt 0 ]]; then
|
||||||
|
shift $((i-1)) words
|
||||||
|
if [[ "$words[1]" == [\=\<\>]\(* ]]; then
|
||||||
|
words[1]="${words[1]#[=<>]\(}"
|
||||||
|
else
|
||||||
|
[[ "$words[1]" == \; && $words[2] == (then|else|elif|do) ]] && shift words
|
||||||
|
shift words
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
while [[ "$words[1]" == (if|while|until|\!) ]]; do
|
||||||
|
shift words
|
||||||
|
done
|
||||||
|
while [[ "$words[1]" == [A-Za-z_][A-Za-z0-9_]#=* ]]; do
|
||||||
|
shift words
|
||||||
|
done
|
||||||
|
[[ "$words[1]" == (*/|)git(|-[^/]##) ]] && {
|
||||||
|
local subcommand
|
||||||
|
subcommand="${words[1]##*/git-}"
|
||||||
|
if [[ -z "$subcommand" ]]; then
|
||||||
|
shift words
|
||||||
|
subcommand="$words[1]"
|
||||||
|
fi
|
||||||
|
[[ $#words -ge 2 ]]
|
||||||
|
} &&
|
||||||
|
case "$subcommand" in
|
||||||
|
# commands that may take pathspec but never take refspec with [{}~^]
|
||||||
|
(add|rm|am|apply|check-attr|checkout-index|clean|clone|config|diff-files|hash-object|help|index-pack|mailinfo|mailsplit|merge-file|merge-index|mergetool|mktag|mv|pack-objects|pack-redundant|relink|send-email|show-index|show-ref|stage|status|verify-pack)
|
||||||
|
false ;;
|
||||||
|
# commands that may take pathspec but rarely take refspec with [{}~^]
|
||||||
|
(for-each-ref|grep|ls-files|update-index)
|
||||||
|
false ;;
|
||||||
|
(archive|ls-tree)
|
||||||
|
! [[ $#words -ge 3 &&
|
||||||
|
"$words[-2]" == [^-]* ]] ;;
|
||||||
|
(diff-tree)
|
||||||
|
! [[ $#words -ge 4 &&
|
||||||
|
"$words[-2]" == [^-]* &&
|
||||||
|
"$words[-3]" == [^-]* ]] ;;
|
||||||
|
(*)
|
||||||
|
[[ $words[(i)--] -gt $#words ]] ;;
|
||||||
|
esac &&
|
||||||
|
case "${words[-1]%%"$KEYS"}" in
|
||||||
|
(*[@^])
|
||||||
|
[[ "$KEYS" == [{~^]* ]] ;;
|
||||||
|
(*[@^]\{[^}]##)
|
||||||
|
[[ "$KEYS" == \}* ]] ;;
|
||||||
|
(?*)
|
||||||
|
[[ "$KEYS" == [~^]* ]] ;;
|
||||||
|
(*)
|
||||||
|
false ;;
|
||||||
|
esac &&
|
||||||
|
LBUFFER="$LBUFFER\\"
|
||||||
|
fi
|
||||||
|
|
||||||
|
zle "$self_insert_function"
|
||||||
|
}
|
||||||
|
|
||||||
|
git-escape-magic.on() {
|
||||||
|
emulate -L zsh
|
||||||
|
local self_insert_function="${$(zle -lL | awk \
|
||||||
|
'$1=="zle"&&$2=="-N"&&$3=="self-insert"{print $4;exit}'):-.self-insert}"
|
||||||
|
|
||||||
|
[[ "$self_insert_function" == git-escape-magic.self-insert ]] &&
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# For url-quote-magic which does not zle -N itself
|
||||||
|
zle -la "$self_insert_function" || zle -N "$self_insert_function"
|
||||||
|
|
||||||
|
zstyle ':git-escape-magic' self-insert-function "$self_insert_function"
|
||||||
|
|
||||||
|
zle -A git-escape-magic.self-insert self-insert
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
git-escape-magic.off() {
|
||||||
|
emulate -L zsh
|
||||||
|
local self_insert_function
|
||||||
|
zstyle -s ':git-escape-magic' self-insert-function self_insert_function
|
||||||
|
|
||||||
|
[[ -n "$self_insert_function" ]] &&
|
||||||
|
zle -A "$self_insert_function" self-insert
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
zle -N git-escape-magic.self-insert
|
||||||
|
zle -N git-escape-magic.on
|
||||||
|
zle -N git-escape-magic.off
|
||||||
|
|
||||||
|
git-escape-magic() {
|
||||||
|
git-escape-magic.on
|
||||||
|
}
|
||||||
|
|
||||||
|
[[ -o kshautoload ]] || git-escape-magic "$@"
|
||||||
|
|
9
plugins/git-escape-magic/git-escape-magic.plugin.zsh
Normal file
9
plugins/git-escape-magic/git-escape-magic.plugin.zsh
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# Automatically detect and escape zsh globbing meta-characters when used with
|
||||||
|
# git refspec characters like `[^~{}]`. NOTE: This must be loaded _after_
|
||||||
|
# url-quote-magic.
|
||||||
|
#
|
||||||
|
# This trick is detailed at https://github.com/knu/zsh-git-escape-magic and is
|
||||||
|
# what allowed this plugin to exist.
|
||||||
|
|
||||||
|
autoload -Uz git-escape-magic
|
||||||
|
git-escape-magic
|
|
@ -20,9 +20,10 @@ function precmd_update_git_vars() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
chpwd_functions+=(chpwd_update_git_vars)
|
autoload -U add-zsh-hook
|
||||||
precmd_functions+=(precmd_update_git_vars)
|
add-zsh-hook chpwd chpwd_update_git_vars
|
||||||
preexec_functions+=(preexec_update_git_vars)
|
add-zsh-hook precmd precmd_update_git_vars
|
||||||
|
add-zsh-hook preexec preexec_update_git_vars
|
||||||
|
|
||||||
|
|
||||||
## Function definitions
|
## Function definitions
|
||||||
|
|
|
@ -4,26 +4,21 @@ from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
import shlex
|
|
||||||
from subprocess import Popen, PIPE, check_output
|
from subprocess import Popen, PIPE, check_output
|
||||||
|
|
||||||
|
|
||||||
def get_tagname_or_hash():
|
def get_tagname_or_hash():
|
||||||
"""return tagname if exists else 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
|
# get hash
|
||||||
m = re.search('\(.*\)$', output)
|
hash_cmd = ['git', 'rev-parse', '--short', 'HEAD']
|
||||||
if m:
|
hash_ = check_output(hash_cmd).strip()
|
||||||
hash_ = output[:m.start()-1]
|
|
||||||
# get tagname
|
|
||||||
m = re.search('tag: .*[,\)]', output)
|
|
||||||
if m:
|
|
||||||
tagname = 'tags/' + output[m.start()+len('tag: '): m.end()-1]
|
|
||||||
|
|
||||||
if tagname:
|
# get tagname
|
||||||
return tagname.replace(' ', '')
|
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_:
|
elif hash_:
|
||||||
return hash_
|
return hash_
|
||||||
return None
|
return None
|
||||||
|
|
14
plugins/git-remote-branch/README.md
Normal file
14
plugins/git-remote-branch/README.md
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# git-remote-branch plugin
|
||||||
|
|
||||||
|
This plugin adds completion for [`grb`](https://github.com/webmat/git_remote_branch),
|
||||||
|
or `git_remote_branch`.
|
||||||
|
|
||||||
|
To use it, add `git-remote-branch` to the plugins array of your `.zshrc` file:
|
||||||
|
```
|
||||||
|
plugins=(... git-remote-branch)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deprecation
|
||||||
|
|
||||||
|
[git_remote_branch was archived in 2018](https://github.com/webmat/git_remote_branch#archived),
|
||||||
|
meaning it's not actively maintained anymore. Use at your own risk.
|
|
@ -10,190 +10,196 @@ plugins=(... git)
|
||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Alias | Command |
|
| Alias | Command |
|
||||||
|:---------------------|:------------------------------------------------------------------------------------------------------------------------------|
|
|:---------------------|:---------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| g | git |
|
| g | git |
|
||||||
| ga | git add |
|
| ga | git add |
|
||||||
| gaa | git add --all |
|
| gaa | git add --all |
|
||||||
| gapa | git add --patch |
|
| gapa | git add --patch |
|
||||||
| gau | git add --update |
|
| gau | git add --update |
|
||||||
| gav | git add --verbose |
|
| gav | git add --verbose |
|
||||||
| gap | git apply |
|
| gap | git apply |
|
||||||
| gb | git branch |
|
| gb | git branch |
|
||||||
| gba | git branch -a |
|
| gba | git branch -a |
|
||||||
| gbd | git branch -d |
|
| 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 |
|
| 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 |
|
| gbD | git branch -D |
|
||||||
| gbl | git blame -b -w |
|
| gbl | git blame -b -w |
|
||||||
| gbnm | git branch --no-merged |
|
| gbnm | git branch --no-merged |
|
||||||
| gbr | git branch --remote |
|
| gbr | git branch --remote |
|
||||||
| gbs | git bisect |
|
| gbs | git bisect |
|
||||||
| gbsb | git bisect bad |
|
| gbsb | git bisect bad |
|
||||||
| gbsg | git bisect good |
|
| gbsg | git bisect good |
|
||||||
| gbsr | git bisect reset |
|
| gbsr | git bisect reset |
|
||||||
| gbss | git bisect start |
|
| gbss | git bisect start |
|
||||||
| gc | git commit -v |
|
| gc | git commit -v |
|
||||||
| gc! | git commit -v --amend |
|
| gc! | git commit -v --amend |
|
||||||
| gcn! | git commit -v --no-edit --amend |
|
| gcn! | git commit -v --no-edit --amend |
|
||||||
| gca | git commit -v -a |
|
| gca | git commit -v -a |
|
||||||
| gca! | git commit -v -a --amend |
|
| gca! | git commit -v -a --amend |
|
||||||
| gcan! | git commit -v -a --no-edit --amend |
|
| gcan! | git commit -v -a --no-edit --amend |
|
||||||
| gcans! | git commit -v -a -s --no-edit --amend |
|
| gcans! | git commit -v -a -s --no-edit --amend |
|
||||||
| gcam | git commit -a -m |
|
| gcam | git commit -a -m |
|
||||||
| gcsm | git commit -s -m |
|
| gcsm | git commit -s -m |
|
||||||
| gcb | git checkout -b |
|
| gcb | git checkout -b |
|
||||||
| gcf | git config --list |
|
| gcf | git config --list |
|
||||||
| gcl | git clone --recurse-submodules |
|
| gcl | git clone --recurse-submodules |
|
||||||
| gclean | git clean -id |
|
| gclean | git clean -id |
|
||||||
| gpristine | git reset --hard && git clean -dfx |
|
| gpristine | git reset --hard && git clean -dfx |
|
||||||
| gcm | git checkout master |
|
| gcm | git checkout master |
|
||||||
| gcd | git checkout develop |
|
| gcd | git checkout develop |
|
||||||
| gcmsg | git commit -m |
|
| gcmsg | git commit -m |
|
||||||
| gco | git checkout |
|
| gco | git checkout |
|
||||||
| gcount | git shortlog -sn |
|
| gcount | git shortlog -sn |
|
||||||
| gcp | git cherry-pick |
|
| gcp | git cherry-pick |
|
||||||
| gcpa | git cherry-pick --abort |
|
| gcpa | git cherry-pick --abort |
|
||||||
| gcpc | git cherry-pick --continue |
|
| gcpc | git cherry-pick --continue |
|
||||||
| gcs | git commit -S |
|
| gcs | git commit -S |
|
||||||
| gd | git diff |
|
| gd | git diff |
|
||||||
| gdca | git diff --cached |
|
| gdca | git diff --cached |
|
||||||
| gdcw | git diff --cached --word-diff |
|
| gdcw | git diff --cached --word-diff |
|
||||||
| gdct | git describe --tags $(git rev-list --tags --max-count=1) |
|
| gdct | git describe --tags $(git rev-list --tags --max-count=1) |
|
||||||
| gds | git diff --staged |
|
| gds | git diff --staged |
|
||||||
| gdt | git diff-tree --no-commit-id --name-only -r |
|
| gdt | git diff-tree --no-commit-id --name-only -r |
|
||||||
| gdv | git diff -w $@ \| view - |
|
| gdv | git diff -w $@ \| view - |
|
||||||
| gdw | git diff --word-diff |
|
| gdw | git diff --word-diff |
|
||||||
| gf | git fetch |
|
| gf | git fetch |
|
||||||
| gfa | git fetch --all --prune |
|
| gfa | git fetch --all --prune |
|
||||||
| gfg | git ls-files \| grep |
|
| gfg | git ls-files \| grep |
|
||||||
| gfo | git fetch origin |
|
| gfo | git fetch origin |
|
||||||
| gg | git gui citool |
|
| gg | git gui citool |
|
||||||
| gga | git gui citool --amend |
|
| gga | git gui citool --amend |
|
||||||
| ggf | git push --force origin $(current_branch) |
|
| ggf | git push --force origin $(current_branch) |
|
||||||
| ggfl | git push --force-with-lease origin $(current_branch) |
|
| ggfl | git push --force-with-lease origin $(current_branch) |
|
||||||
| ggl | git pull origin $(current_branch) |
|
| ggl | git pull origin $(current_branch) |
|
||||||
| ggp | git push origin $(current_branch) |
|
| ggp | git push origin $(current_branch) |
|
||||||
| ggpnp | ggl && ggp |
|
| ggpnp | ggl && ggp |
|
||||||
| ggpull | git pull origin "$(git_current_branch)" |
|
| ggpull | git pull origin "$(git_current_branch)" |
|
||||||
| ggpur | ggu |
|
| ggpur | ggu |
|
||||||
| ggpush | git push origin "$(git_current_branch)" |
|
| ggpush | git push origin "$(git_current_branch)" |
|
||||||
| ggsup | git branch --set-upstream-to=origin/$(git_current_branch) |
|
| ggsup | git branch --set-upstream-to=origin/$(git_current_branch) |
|
||||||
| ggu | git pull --rebase origin $(current_branch) |
|
| ggu | git pull --rebase origin $(current_branch) |
|
||||||
| gpsup | git push --set-upstream origin $(git_current_branch) |
|
| gpsup | git push --set-upstream origin $(git_current_branch) |
|
||||||
| ghh | git help |
|
| ghh | git help |
|
||||||
| gignore | git update-index --assume-unchanged |
|
| gignore | git update-index --assume-unchanged |
|
||||||
| gignored | git ls-files -v \| grep "^[[:lower:]]" |
|
| gignored | git ls-files -v \| grep "^[[:lower:]]" |
|
||||||
| git-svn-dcommit-push | git svn dcommit && git push github master:svntrunk |
|
| git-svn-dcommit-push | git svn dcommit && git push github master:svntrunk |
|
||||||
| gk | gitk --all --branches |
|
| gk | gitk --all --branches |
|
||||||
| gke | gitk --all $(git log -g --pretty=%h) |
|
| gke | gitk --all $(git log -g --pretty=%h) |
|
||||||
| gl | git pull |
|
| gl | git pull |
|
||||||
| glg | git log --stat |
|
| glg | git log --stat |
|
||||||
| glgp | git log --stat -p |
|
| glgp | git log --stat -p |
|
||||||
| glgg | git log --graph |
|
| glgg | git log --graph |
|
||||||
| glgga | git log --graph --decorate --all |
|
| glgga | git log --graph --decorate --all |
|
||||||
| glgm | git log --graph --max-count=10 |
|
| glgm | git log --graph --max-count=10 |
|
||||||
| glo | git log --oneline --decorate |
|
| 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' |
|
| 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 |
|
| 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' |
|
| 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 |
|
| 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 |
|
| 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 |
|
| glog | git log --oneline --decorate --graph |
|
||||||
| gloga | git log --oneline --decorate --graph --all |
|
| gloga | git log --oneline --decorate --graph --all |
|
||||||
| glp | `_git_log_prettily` |
|
| glp | `_git_log_prettily` |
|
||||||
| gm | git merge |
|
| gm | git merge |
|
||||||
| gmom | git merge origin/master |
|
| gmom | git merge origin/master |
|
||||||
| gmt | git mergetool --no-prompt |
|
| gmt | git mergetool --no-prompt |
|
||||||
| gmtvim | git mergetool --no-prompt --tool=vimdiff |
|
| gmtvim | git mergetool --no-prompt --tool=vimdiff |
|
||||||
| gmum | git merge upstream/master |
|
| gmum | git merge upstream/master |
|
||||||
| gma | git merge --abort |
|
| gma | git merge --abort |
|
||||||
| gp | git push |
|
| gp | git push |
|
||||||
| gpd | git push --dry-run |
|
| gpd | git push --dry-run |
|
||||||
| gpf | git push --force-with-lease |
|
| gpf | git push --force-with-lease |
|
||||||
| gpf! | git push --force |
|
| gpf! | git push --force |
|
||||||
| gpoat | git push origin --all && git push origin --tags |
|
| gpoat | git push origin --all && git push origin --tags |
|
||||||
| gpu | git push upstream |
|
| gpu | git push upstream |
|
||||||
| gpv | git push -v |
|
| gpv | git push -v |
|
||||||
| gr | git remote |
|
| gr | git remote |
|
||||||
| gra | git remote add |
|
| gra | git remote add |
|
||||||
| grb | git rebase |
|
| grb | git rebase |
|
||||||
| grba | git rebase --abort |
|
| grba | git rebase --abort |
|
||||||
| grbc | git rebase --continue |
|
| grbc | git rebase --continue |
|
||||||
| grbd | git rebase develop |
|
| grbd | git rebase develop |
|
||||||
| grbi | git rebase -i |
|
| grbi | git rebase -i |
|
||||||
| grbm | git rebase master |
|
| grbm | git rebase master |
|
||||||
| grbs | git rebase --skip |
|
| grbs | git rebase --skip |
|
||||||
| grev | git revert |
|
| grev | git revert |
|
||||||
| grh | git reset |
|
| grh | git reset |
|
||||||
| grhh | git reset --hard |
|
| grhh | git reset --hard |
|
||||||
| groh | git reset origin/$(git_current_branch) --hard |
|
| groh | git reset origin/$(git_current_branch) --hard |
|
||||||
| grm | git rm |
|
| grm | git rm |
|
||||||
| grmc | git rm --cached |
|
| grmc | git rm --cached |
|
||||||
| grmv | git remote rename |
|
| grmv | git remote rename |
|
||||||
| grrm | git remote remove |
|
| grrm | git remote remove |
|
||||||
| grset | git remote set-url |
|
| grs | git restore |
|
||||||
| grt | cd "$(git rev-parse --show-toplevel \|\| echo .)" |
|
| grset | git remote set-url |
|
||||||
| gru | git reset -- |
|
| grss | git restore --source |
|
||||||
| grup | git remote update |
|
| grt | cd "$(git rev-parse --show-toplevel \|\| echo .)" |
|
||||||
| grv | git remote -v |
|
| gru | git reset -- |
|
||||||
| gsb | git status -sb |
|
| grup | git remote update |
|
||||||
| gsd | git svn dcommit |
|
| grv | git remote -v |
|
||||||
| gsh | git show |
|
| gsb | git status -sb |
|
||||||
| gsi | git submodule init |
|
| gsd | git svn dcommit |
|
||||||
| gsps | git show --pretty=short --show-signature |
|
| gsh | git show |
|
||||||
| gsr | git svn rebase |
|
| gsi | git submodule init |
|
||||||
| gss | git status -s |
|
| gsps | git show --pretty=short --show-signature |
|
||||||
| gst | git status |
|
| gsr | git svn rebase |
|
||||||
| gsta | git stash push |
|
| gss | git status -s |
|
||||||
| gsta | git stash save |
|
| gst | git status |
|
||||||
| gstaa | git stash apply |
|
| gsta | git stash push |
|
||||||
| gstc | git stash clear |
|
| gsta | git stash save |
|
||||||
| gstd | git stash drop |
|
| gstaa | git stash apply |
|
||||||
| gstl | git stash list |
|
| gstc | git stash clear |
|
||||||
| gstp | git stash pop |
|
| gstd | git stash drop |
|
||||||
| gsts | git stash show --text |
|
| gstl | git stash list |
|
||||||
| gstall | git stash --all |
|
| gstp | git stash pop |
|
||||||
| gsu | git submodule update |
|
| gsts | git stash show --text |
|
||||||
| gts | git tag -s |
|
| gstu | git stash --include-untracked |
|
||||||
| gtv | git tag \| sort -V |
|
| gstall | git stash --all |
|
||||||
| gtl | gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl |
|
| gsu | git submodule update |
|
||||||
| gunignore | git update-index --no-assume-unchanged |
|
| gsw | git switch |
|
||||||
| gunwip | git log -n 1 \| grep -q -c "\-\-wip\-\-" && git reset HEAD~1 |
|
| gswc | git switch -c |
|
||||||
| gup | git pull --rebase |
|
| gts | git tag -s |
|
||||||
| gupv | git pull --rebase -v |
|
| gtv | git tag \| sort -V |
|
||||||
| gupa | git pull --rebase --autostash |
|
| gtl | gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl |
|
||||||
| gupav | git pull --rebase --autostash -v |
|
| gunignore | git update-index --no-assume-unchanged |
|
||||||
| glum | git pull upstream master |
|
| gunwip | git log -n 1 \| grep -q -c "\-\-wip\-\-" && git reset HEAD~1 |
|
||||||
| gwch | git whatchanged -p --abbrev-commit --pretty=medium |
|
| gup | git pull --rebase |
|
||||||
| gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" |
|
| 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]" |
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not, receive further support.
|
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 |
|
| Alias | Command | Modification |
|
||||||
| :----- | :----------------------------------------------------------------------------------| --------------------------------------------------------------------------------------------------- |
|
| :----- | :----------------------------------------------------- | :----------------------------------------------------- |
|
||||||
| gap | git add --patch | new alias `gapa` |
|
| gap | `git add --patch` | new alias `gapa` |
|
||||||
| gcl | git config --list | new alias `gcf` |
|
| gcl | `git config --list` | new alias `gcf` |
|
||||||
| gdc | git diff --cached | new alias `gdca` |
|
| gdc | `git diff --cached` | new alias `gdca` |
|
||||||
| gdt | git difftool | no replacement |
|
| gdt | `git difftool` | no replacement |
|
||||||
| ggpull | git pull origin $(current_branch) | new alias `ggl` (`ggpull` still exists for now though) |
|
| 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) |
|
| 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) |
|
| 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` |
|
| gk | `gitk --all --branches` | now aliased to `gitk --all --branches` |
|
||||||
| glg | git log --stat --max-count = 10 | now aliased to `git log --stat --color` |
|
| 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` |
|
| 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` |
|
| gwc | `git whatchanged -p --abbrev-commit --pretty = medium` | new alias `gwch` |
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
### Current
|
### Current
|
||||||
|
|
||||||
| Command | Description |
|
| Command | Description |
|
||||||
|:-----------------------|:----------------------------------------|
|
|:-----------------------|:---------------------------------------------------------|
|
||||||
| current_branch | Return the name of the current branch |
|
| `grename <old> <new>` | Rename `old` branch to `new`, including in origin remote |
|
||||||
| git_current_user_name | Returns the `user.name` config value |
|
| current_branch | Return the name of the current branch |
|
||||||
| git_current_user_email | Returns the `user.email` config value |
|
| git_current_user_name | Returns the `user.name` config value |
|
||||||
|
| git_current_user_email | Returns the `user.email` config value |
|
||||||
|
|
||||||
### Work in Progress (WIP)
|
### Work in Progress (WIP)
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ alias gap='git apply'
|
||||||
alias gb='git branch'
|
alias gb='git branch'
|
||||||
alias gba='git branch -a'
|
alias gba='git branch -a'
|
||||||
alias gbd='git branch -d'
|
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*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d'
|
||||||
alias gbD='git branch -D'
|
alias gbD='git branch -D'
|
||||||
alias gbl='git blame -b -w'
|
alias gbl='git blame -b -w'
|
||||||
alias gbnm='git branch --no-merged'
|
alias gbnm='git branch --no-merged'
|
||||||
|
@ -207,7 +207,9 @@ alias grm='git rm'
|
||||||
alias grmc='git rm --cached'
|
alias grmc='git rm --cached'
|
||||||
alias grmv='git remote rename'
|
alias grmv='git remote rename'
|
||||||
alias grrm='git remote remove'
|
alias grrm='git remote remove'
|
||||||
|
alias grs='git restore'
|
||||||
alias grset='git remote set-url'
|
alias grset='git remote set-url'
|
||||||
|
alias grss='git restore --source'
|
||||||
alias grt='cd "$(git rev-parse --show-toplevel || echo .)"'
|
alias grt='cd "$(git rev-parse --show-toplevel || echo .)"'
|
||||||
alias gru='git reset --'
|
alias gru='git reset --'
|
||||||
alias grup='git remote update'
|
alias grup='git remote update'
|
||||||
|
@ -234,12 +236,15 @@ alias gstd='git stash drop'
|
||||||
alias gstl='git stash list'
|
alias gstl='git stash list'
|
||||||
alias gstp='git stash pop'
|
alias gstp='git stash pop'
|
||||||
alias gsts='git stash show --text'
|
alias gsts='git stash show --text'
|
||||||
|
alias gstu='git stash --include-untracked'
|
||||||
alias gstall='git stash --all'
|
alias gstall='git stash --all'
|
||||||
alias gsu='git submodule update'
|
alias gsu='git submodule update'
|
||||||
|
alias gsw='git switch'
|
||||||
|
alias gswc='git switch -c'
|
||||||
|
|
||||||
alias gts='git tag -s'
|
alias gts='git tag -s'
|
||||||
alias gtv='git tag | sort -V'
|
alias gtv='git tag | sort -V'
|
||||||
alias gtl='gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl'
|
alias gtl='gtl(){ git tag --sort=-v:refname -n -l "${1}*" }; noglob gtl'
|
||||||
|
|
||||||
alias gunignore='git update-index --no-assume-unchanged'
|
alias gunignore='git update-index --no-assume-unchanged'
|
||||||
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
|
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
|
||||||
|
@ -251,3 +256,17 @@ alias glum='git pull upstream master'
|
||||||
|
|
||||||
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
|
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 gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"'
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
|
@ -11,5 +11,5 @@ plugins=(... gitfast)
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
An earlier version of the plugin also loaded the git plugin. If you want to keep those
|
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.
|
as well.
|
||||||
|
|
|
@ -30,7 +30,7 @@ if [ -z "$script" ]; then
|
||||||
local -a locations
|
local -a locations
|
||||||
local e
|
local e
|
||||||
locations=(
|
locations=(
|
||||||
"$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash"
|
$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
|
||||||
'/etc/bash_completion.d/git' # fedora, old debian
|
'/etc/bash_completion.d/git' # fedora, old debian
|
||||||
'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
|
'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
|
||||||
'/usr/share/bash-completion/git' # gentoo
|
'/usr/share/bash-completion/git' # gentoo
|
||||||
|
@ -39,7 +39,7 @@ if [ -z "$script" ]; then
|
||||||
test -f $e && script="$e" && break
|
test -f $e && script="$e" && break
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
ZSH_VERSION='' . "$script"
|
GIT_SOURCING_ZSH_COMPLETION=y . "$script"
|
||||||
|
|
||||||
__gitcomp ()
|
__gitcomp ()
|
||||||
{
|
{
|
||||||
|
@ -93,13 +93,22 @@ __gitcomp_nl_append ()
|
||||||
compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
|
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 ()
|
__gitcomp_file ()
|
||||||
{
|
{
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
|
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
compset -P '*[=:]'
|
compset -P '*[=:]'
|
||||||
compadd -Q -p "${2-}" -f -- ${=1} && _ret=0
|
compadd -p "${2-}" -f -- ${=1} && _ret=0
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_zsh_bash_func ()
|
__git_zsh_bash_func ()
|
||||||
|
@ -223,10 +232,8 @@ _git ()
|
||||||
|
|
||||||
if (( $+functions[__${service}_zsh_main] )); then
|
if (( $+functions[__${service}_zsh_main] )); then
|
||||||
__${service}_zsh_main
|
__${service}_zsh_main
|
||||||
elif (( $+functions[__${service}_main] )); then
|
else
|
||||||
emulate ksh -c __${service}_main
|
emulate ksh -c __${service}_main
|
||||||
elif (( $+functions[_${service}] )); then
|
|
||||||
emulate ksh -c _${service}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
let _ret && _default && _ret=0
|
let _ret && _default && _ret=0
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -219,7 +219,7 @@ __git_ps1_show_upstream ()
|
||||||
if [[ -n "$count" && -n "$name" ]]; then
|
if [[ -n "$count" && -n "$name" ]]; then
|
||||||
__git_ps1_upstream_name=$(git rev-parse \
|
__git_ps1_upstream_name=$(git rev-parse \
|
||||||
--abbrev-ref "$upstream" 2>/dev/null)
|
--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}"
|
p="$p \${__git_ps1_upstream_name}"
|
||||||
else
|
else
|
||||||
p="$p ${__git_ps1_upstream_name}"
|
p="$p ${__git_ps1_upstream_name}"
|
||||||
|
@ -237,7 +237,7 @@ __git_ps1_show_upstream ()
|
||||||
# to build a gitstring.
|
# to build a gitstring.
|
||||||
__git_ps1_colorize_gitstring ()
|
__git_ps1_colorize_gitstring ()
|
||||||
{
|
{
|
||||||
if [[ -n ${ZSH_VERSION-} ]]; then
|
if [[ -n "${ZSH_VERSION-}" ]]; then
|
||||||
local c_red='%F{red}'
|
local c_red='%F{red}'
|
||||||
local c_green='%F{green}'
|
local c_green='%F{green}'
|
||||||
local c_lblue='%F{blue}'
|
local c_lblue='%F{blue}'
|
||||||
|
@ -255,7 +255,7 @@ __git_ps1_colorize_gitstring ()
|
||||||
local flags_color="$c_lblue"
|
local flags_color="$c_lblue"
|
||||||
|
|
||||||
local branch_color=""
|
local branch_color=""
|
||||||
if [ $detached = no ]; then
|
if [ "$detached" = no ]; then
|
||||||
branch_color="$ok_color"
|
branch_color="$ok_color"
|
||||||
else
|
else
|
||||||
branch_color="$bad_color"
|
branch_color="$bad_color"
|
||||||
|
@ -508,13 +508,13 @@ __git_ps1 ()
|
||||||
|
|
||||||
# NO color option unless in PROMPT_COMMAND mode or it's Zsh
|
# NO color option unless in PROMPT_COMMAND mode or it's Zsh
|
||||||
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
|
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
|
||||||
if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then
|
if [ "$pcmode" = yes ] || [ -n "${ZSH_VERSION-}" ]; then
|
||||||
__git_ps1_colorize_gitstring
|
__git_ps1_colorize_gitstring
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
b=${b##refs/heads/}
|
b=${b##refs/heads/}
|
||||||
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
|
if [ "$pcmode" = yes ] && [ "$ps1_expanded" = yes ]; then
|
||||||
__git_ps1_branch_name=$b
|
__git_ps1_branch_name=$b
|
||||||
b="\${__git_ps1_branch_name}"
|
b="\${__git_ps1_branch_name}"
|
||||||
fi
|
fi
|
||||||
|
@ -522,7 +522,7 @@ __git_ps1 ()
|
||||||
local f="$w$i$s$u"
|
local f="$w$i$s$u"
|
||||||
local gitstring="$c$b${f:+$z$f}$r$p"
|
local gitstring="$c$b${f:+$z$f}$r$p"
|
||||||
|
|
||||||
if [ $pcmode = yes ]; then
|
if [ "$pcmode" = yes ]; then
|
||||||
if [ "${__git_printf_supports_v-}" != yes ]; then
|
if [ "${__git_printf_supports_v-}" != yes ]; then
|
||||||
gitstring=$(printf -- "$printf_format" "$gitstring")
|
gitstring=$(printf -- "$printf_format" "$gitstring")
|
||||||
else
|
else
|
||||||
|
|
9
plugins/glassfish/README.md
Normal file
9
plugins/glassfish/README.md
Normal file
|
@ -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)
|
||||||
|
```
|
|
@ -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'
|
|
38
plugins/gnu-utils/README.md
Normal file
38
plugins/gnu-utils/README.md
Normal file
|
@ -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).
|
|
@ -5,79 +5,79 @@
|
||||||
# VERSION: 1.0.0
|
# VERSION: 1.0.0
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Detect if GNU coreutils are installed by looking for gwhoami
|
||||||
if [[ -x "${commands[gwhoami]}" ]]; then
|
if [[ ! -x "${commands[gwhoami]}" ]]; then
|
||||||
__gnu_utils() {
|
return
|
||||||
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
|
|
||||||
}
|
|
||||||
fi
|
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')
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -7,7 +7,7 @@ gradle-or-gradlew() {
|
||||||
echo "executing gradlew instead of gradle";
|
echo "executing gradlew instead of gradle";
|
||||||
./gradlew "$@";
|
./gradlew "$@";
|
||||||
else
|
else
|
||||||
gradle "$@";
|
command gradle "$@";
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,3 +181,4 @@ _gradlew_tasks () {
|
||||||
############################################################################
|
############################################################################
|
||||||
compdef _gradle_tasks gradle
|
compdef _gradle_tasks gradle
|
||||||
compdef _gradlew_tasks gradlew
|
compdef _gradlew_tasks gradlew
|
||||||
|
compdef _gradlew_tasks gw
|
||||||
|
|
|
@ -9,7 +9,7 @@ You can also use K and J in VI mode or ^P and ^N in EMACS mode for the same.
|
||||||
[1]: https://fishshell.com
|
[1]: https://fishshell.com
|
||||||
[2]: https://www.zsh.org/mla/users/2009/msg00818.html
|
[2]: https://www.zsh.org/mla/users/2009/msg00818.html
|
||||||
[3]: https://sourceforge.net/projects/fizsh/
|
[3]: https://sourceforge.net/projects/fizsh/
|
||||||
[4]: https://github.com/robbyrussell/oh-my-zsh/pull/215
|
[4]: https://github.com/ohmyzsh/ohmyzsh/pull/215
|
||||||
[5]: https://github.com/zsh-users/zsh-history-substring-search
|
[5]: https://github.com/zsh-users/zsh-history-substring-search
|
||||||
[6]: https://github.com/zsh-users/zsh-syntax-highlighting
|
[6]: https://github.com/zsh-users/zsh-syntax-highlighting
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue