1
0
mirror of https://github.com/DazAh/dotfiles synced 2026-05-21 18:25:46 +01:00

update oh-my-zsh, poetry env and cs setting update

This commit is contained in:
DazAh
2020-01-29 16:57:56 +00:00
parent 0ebc2024e4
commit 469953e5d3
157 changed files with 2230 additions and 1145 deletions
+2 -1
View File
@@ -29,4 +29,5 @@ test -z "$PROFILEREAD" && . /etc/profile || true
export PATH="$HOME/.cargo/bin:$PATH" export PATH="$HOME/.cargo/bin:$PATH"
export KWIN_DRM_USE_EGL_STREAMS=1 export KWIN_DRM_USE_EGL_STREAMS=1
export KWIN_TRIPLE_BUFFER=1 export __GL_THREADED_OPTIMIZATIONS=1
export __GL_MaxFramesAllowed=1
+3
View File
@@ -1,2 +1,5 @@
export PATH="$HOME/.cargo/bin:$PATH" export PATH="$HOME/.cargo/bin:$PATH"
export KWIN_DRM_USE_EGL_STREAMS=1 export KWIN_DRM_USE_EGL_STREAMS=1
export __GL_MaxFramesAllowed=2
export __GL_THREADED_OPTIMIZATIONS=1
export PATH="$HOME/.poetry/bin:$PATH"
+1
View File
@@ -4,6 +4,7 @@
# Dev tools export # Dev tools export
export PATH="$HOME/.cargo/bin:$PATH" export PATH="$HOME/.cargo/bin:$PATH"
export PATH="$HOME/.dotnet:$PATH" export PATH="$HOME/.dotnet:$PATH"
export PATH="$HOME/.poetry/bin:$PATH"
# Path to your oh-my-zsh installation. # Path to your oh-my-zsh installation.
export ZSH="/home/darren/.oh-my-zsh" export ZSH="/home/darren/.oh-my-zsh"
+5 -5
View File
@@ -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.
+2 -3
View File
@@ -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
+22 -14
View File
@@ -12,14 +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.
![Check Suite](https://github.com/ohmyzsh/ohmyzsh/workflows/Check%20Suite/badge.svg)
[![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
* A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL is preferred, but cygwin or msys also mostly work. * A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL is preferred, but cygwin or msys also mostly work.
* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (run `zsh --version` to confirm), check the following instructions here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH) * [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)
* `curl` or `wget` should be installed * `curl` or `wget` should be installed
* `git` should be installed * `git` should be installed
@@ -30,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
@@ -46,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
``` ```
@@ -54,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
@@ -86,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
@@ -102,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._
@@ -111,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.
@@ -129,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.
@@ -157,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
@@ -188,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:
@@ -270,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
+2
View File
@@ -4,3 +4,5 @@ custom/
# temp files directories # temp files directories
cache/ cache/
log/ log/
*.swp
.DS_Store
@@ -1 +1 @@
LAST_EPOCH=18186 LAST_EPOCH=18290
+1 -1
View File
@@ -1 +1 @@
3e4d10c4f17b2fe57090a524d5d78781beda204a branch 'master' of https://github.com/robbyrussell/oh-my-zsh 05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5 branch 'master' of https://github.com/robbyrussell/oh-my-zsh
@@ -20,3 +20,5 @@ e38099de96e8b62976354b468da1b21ec2d57f68 52f58785645c18aa88ea515d070a42bcfe97508
52f58785645c18aa88ea515d070a42bcfe97508d 52f58785645c18aa88ea515d070a42bcfe97508d DazAh <9095216+DazAh@users.noreply.github.com> 1570921257 +0100 reset: moving to HEAD 52f58785645c18aa88ea515d070a42bcfe97508d 52f58785645c18aa88ea515d070a42bcfe97508d DazAh <9095216+DazAh@users.noreply.github.com> 1570921257 +0100 reset: moving to HEAD
52f58785645c18aa88ea515d070a42bcfe97508d 52f58785645c18aa88ea515d070a42bcfe97508d DazAh <9095216+DazAh@users.noreply.github.com> 1571311718 +0100 reset: moving to HEAD 52f58785645c18aa88ea515d070a42bcfe97508d 52f58785645c18aa88ea515d070a42bcfe97508d DazAh <9095216+DazAh@users.noreply.github.com> 1571311718 +0100 reset: moving to HEAD
52f58785645c18aa88ea515d070a42bcfe97508d 3e4d10c4f17b2fe57090a524d5d78781beda204a DazAh <9095216+DazAh@users.noreply.github.com> 1571311756 +0100 pull: Fast-forward 52f58785645c18aa88ea515d070a42bcfe97508d 3e4d10c4f17b2fe57090a524d5d78781beda204a DazAh <9095216+DazAh@users.noreply.github.com> 1571311756 +0100 pull: Fast-forward
3e4d10c4f17b2fe57090a524d5d78781beda204a 3e4d10c4f17b2fe57090a524d5d78781beda204a DazAh <9095216+DazAh@users.noreply.github.com> 1580316543 +0000 reset: moving to HEAD
3e4d10c4f17b2fe57090a524d5d78781beda204a 05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5 DazAh <9095216+DazAh@users.noreply.github.com> 1580316594 +0000 pull --rebase --stat origin master: Fast-forward
@@ -17,3 +17,4 @@ a4f6a9964ceec3d222a8caa8eb3e5cf6027cfbab 32338fd40cae45c775dadc34ae05476811a3834
32338fd40cae45c775dadc34ae05476811a3834b e38099de96e8b62976354b468da1b21ec2d57f68 Darren Leatherbarrow <darren@DarrenPC.dazeerrcloud.xyz> 1570028747 +0100 pull --rebase --stat origin master: Fast-forward 32338fd40cae45c775dadc34ae05476811a3834b e38099de96e8b62976354b468da1b21ec2d57f68 Darren Leatherbarrow <darren@DarrenPC.dazeerrcloud.xyz> 1570028747 +0100 pull --rebase --stat origin master: Fast-forward
e38099de96e8b62976354b468da1b21ec2d57f68 52f58785645c18aa88ea515d070a42bcfe97508d Darren Leatherbarrow <darren@DarrenPC.dazeerrcloud.xyz> 1570875427 +0100 pull: Fast-forward e38099de96e8b62976354b468da1b21ec2d57f68 52f58785645c18aa88ea515d070a42bcfe97508d Darren Leatherbarrow <darren@DarrenPC.dazeerrcloud.xyz> 1570875427 +0100 pull: Fast-forward
52f58785645c18aa88ea515d070a42bcfe97508d 3e4d10c4f17b2fe57090a524d5d78781beda204a DazAh <9095216+DazAh@users.noreply.github.com> 1571311756 +0100 pull: Fast-forward 52f58785645c18aa88ea515d070a42bcfe97508d 3e4d10c4f17b2fe57090a524d5d78781beda204a DazAh <9095216+DazAh@users.noreply.github.com> 1571311756 +0100 pull: Fast-forward
3e4d10c4f17b2fe57090a524d5d78781beda204a 05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5 DazAh <9095216+DazAh@users.noreply.github.com> 1580316594 +0000 pull --rebase --stat origin master: Fast-forward
@@ -16,3 +16,4 @@ a4f6a9964ceec3d222a8caa8eb3e5cf6027cfbab 32338fd40cae45c775dadc34ae05476811a3834
32338fd40cae45c775dadc34ae05476811a3834b e38099de96e8b62976354b468da1b21ec2d57f68 Darren Leatherbarrow <darren@DarrenPC.dazeerrcloud.xyz> 1570028747 +0100 pull --rebase --stat origin master: fast-forward 32338fd40cae45c775dadc34ae05476811a3834b e38099de96e8b62976354b468da1b21ec2d57f68 Darren Leatherbarrow <darren@DarrenPC.dazeerrcloud.xyz> 1570028747 +0100 pull --rebase --stat origin master: fast-forward
e38099de96e8b62976354b468da1b21ec2d57f68 52f58785645c18aa88ea515d070a42bcfe97508d Darren Leatherbarrow <darren@DarrenPC.dazeerrcloud.xyz> 1570875427 +0100 pull: fast-forward e38099de96e8b62976354b468da1b21ec2d57f68 52f58785645c18aa88ea515d070a42bcfe97508d Darren Leatherbarrow <darren@DarrenPC.dazeerrcloud.xyz> 1570875427 +0100 pull: fast-forward
52f58785645c18aa88ea515d070a42bcfe97508d 3e4d10c4f17b2fe57090a524d5d78781beda204a DazAh <9095216+DazAh@users.noreply.github.com> 1571311756 +0100 pull: fast-forward 52f58785645c18aa88ea515d070a42bcfe97508d 3e4d10c4f17b2fe57090a524d5d78781beda204a DazAh <9095216+DazAh@users.noreply.github.com> 1571311756 +0100 pull: fast-forward
3e4d10c4f17b2fe57090a524d5d78781beda204a 05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5 DazAh <9095216+DazAh@users.noreply.github.com> 1580316594 +0000 pull --rebase --stat origin master: fast-forward
@@ -1,3 +1,4 @@
0000000000000000000000000000000000000000 eb431af8f7e08b7771004f9fae70bb616856593c DazAh <9095216+DazAh@users.noreply.github.com> 1570920993 +0100 WIP on master: 52f58785 rust: add README (#8242) 0000000000000000000000000000000000000000 eb431af8f7e08b7771004f9fae70bb616856593c DazAh <9095216+DazAh@users.noreply.github.com> 1570920993 +0100 WIP on master: 52f58785 rust: add README (#8242)
eb431af8f7e08b7771004f9fae70bb616856593c 49dad0cd7bfa681db26f6aa6c6b8a6191fab060e DazAh <9095216+DazAh@users.noreply.github.com> 1570921257 +0100 WIP on master: 52f58785 rust: add README (#8242) eb431af8f7e08b7771004f9fae70bb616856593c 49dad0cd7bfa681db26f6aa6c6b8a6191fab060e DazAh <9095216+DazAh@users.noreply.github.com> 1570921257 +0100 WIP on master: 52f58785 rust: add README (#8242)
49dad0cd7bfa681db26f6aa6c6b8a6191fab060e 56f3414079b2e53d24677bf128b6ddffef6e2ca1 DazAh <9095216+DazAh@users.noreply.github.com> 1571311718 +0100 WIP on master: 52f58785 rust: add README (#8242) 49dad0cd7bfa681db26f6aa6c6b8a6191fab060e 56f3414079b2e53d24677bf128b6ddffef6e2ca1 DazAh <9095216+DazAh@users.noreply.github.com> 1571311718 +0100 WIP on master: 52f58785 rust: add README (#8242)
56f3414079b2e53d24677bf128b6ddffef6e2ca1 778901cd9b55d509149e2c689941938e82ddfa37 DazAh <9095216+DazAh@users.noreply.github.com> 1580316543 +0000 WIP on master: 3e4d10c4 lib: allow alias expansion in _ sudo alias (#8268)
@@ -0,0 +1 @@
x¥OËJÅ0uݯp£\(“ióèEDÁ;w.eLl¡mJøøzƒ¨?à,ÌyÁ yš†Cû*AëÖP@¯}ðºKâ´FèR ÕÅ BÂjáUæ”6* mRÖSm±CÖÔF­³Ny‰LØò¯ßvÁ{ãŒC'*1²ñF ²sHƒ
@@ -0,0 +1 @@
x¥OÑJÄ0ô¹_±à‹rP6iÒ$‡ˆ‚ÿ!›d{
@@ -1 +1 @@
3e4d10c4f17b2fe57090a524d5d78781beda204a 05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5
@@ -1 +1 @@
3e4d10c4f17b2fe57090a524d5d78781beda204a 05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5
@@ -1 +1 @@
56f3414079b2e53d24677bf128b6ddffef6e2ca1 778901cd9b55d509149e2c689941938e82ddfa37
Binary file not shown.
@@ -0,0 +1,36 @@
name: Check Suite
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 -2
View File
@@ -24,7 +24,7 @@ function clipcopy() {
else else
cat $file | pbcopy cat $file | pbcopy
fi fi
elif [[ $OSTYPE == cygwin* ]]; then elif [[ $OSTYPE == (cygwin|msys)* ]]; then
if [[ -z $file ]]; then if [[ -z $file ]]; then
cat > /dev/clipboard cat > /dev/clipboard
else else
@@ -71,7 +71,7 @@ function clippaste() {
emulate -L zsh emulate -L zsh
if [[ $OSTYPE == darwin* ]]; then if [[ $OSTYPE == darwin* ]]; then
pbpaste pbpaste
elif [[ $OSTYPE == cygwin* ]]; then elif [[ $OSTYPE == (cygwin|msys)* ]]; then
cat /dev/clipboard cat /dev/clipboard
else else
if (( $+commands[xclip] )); then if (( $+commands[xclip] )); then
+11 -1
View File
@@ -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
@@ -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
@@ -14,7 +14,7 @@ alias-finder() {
esac esac
done done
cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep
if [[ $(wc -l <<< $cmd) == 1 ]]; then if (( $(wc -l <<< $cmd) == 1 )); then
while [[ $cmd != "" ]]; do while [[ $cmd != "" ]]; do
if [[ $longer = true ]]; then if [[ $longer = true ]]; then
wordStart="'{0,1}" wordStart="'{0,1}"
@@ -43,4 +43,5 @@ preexec_alias-finder() {
fi fi
} }
preexec_functions+=(preexec_alias-finder) autoload -U add-zsh-hook
add-zsh-hook preexec preexec_alias-finder
@@ -2,4 +2,4 @@
**Maintainer:** [@emzar](https://github.com/emzar) **Maintainer:** [@emzar](https://github.com/emzar)
This plugin adds many useful aliases. This plugin adds many useful aliases for [arcanist](https://github.com/phacility/arcanist).
@@ -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`
@@ -82,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
@@ -95,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
@@ -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
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 typeset -A opt_args
common=(
'(-q --quiet)*'{-v,--verbose}'[use verbose output]'
'(-q --quiet -v --verbose)'{-q,--quiet}'[no output printed to stdout]'
'-Z+[pass unstable (nightly-only) flags to cargo]: :_cargo_unstable_flags'
'--frozen[require that Cargo.lock and cache are up-to-date]'
'--locked[require that Cargo.lock is up-to-date]'
'--color=[specify colorization option]:coloring:(auto always never)'
'(- 1 *)'{-h,--help}'[show help message]'
)
# leading items in parentheses are an exclusion list for the arguments following that arg # leading items in parentheses are an exclusion list for the arguments following that arg
# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions # See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions
# - => exclude all other options # - => exclude all other options
# 1 => exclude positional arg 1 # 1 => exclude positional arg 1
# * => exclude all other args # * => exclude all other args
# +blah => exclude +blah # +blah => exclude +blah
_arguments \ _arguments -s -S -C $common \
'(- 1 *)'{-h,--help}'[show help message]' \
'(- 1 *)--list[list installed commands]' \ '(- 1 *)--list[list installed commands]' \
'(- 1 *)--explain=[provide a detailed explanation of an error message]:error code' \
'(- 1 *)'{-V,--version}'[show version information]' \ '(- 1 *)'{-V,--version}'[show version information]' \
{-v,--verbose}'[use verbose output]' \
--color'[colorization option]' \
'(+beta +nightly)+stable[use the stable toolchain]' \ '(+beta +nightly)+stable[use the stable toolchain]' \
'(+stable +nightly)+beta[use the beta toolchain]' \ '(+stable +nightly)+beta[use the beta toolchain]' \
'(+stable +beta)+nightly[use the nightly toolchain]' \ '(+stable +beta)+nightly[use the nightly toolchain]' \
'1: :->command' \ '1: :_cargo_cmds' \
'*:: :->args' '*:: :->args'
case $state in # These flags are mutually exclusive specifiers for the scope of a command; as
command) # they are used in multiple places without change, they are expanded into the
_alternative 'common-commands:common:_cargo_cmds' 'all-commands:all:_cargo_all_cmds' # appropriate command's `_arguments` where appropriate.
;; command_scope_spec=(
'(--bin --example --test --lib)--bench=[specify benchmark name]: :_cargo_benchmark_names'
'(--bench --bin --test --lib)--example=[specify example name]:example name'
'(--bench --example --test --lib)--bin=[specify binary name]:binary name'
'(--bench --bin --example --test)--lib=[specify library name]:library name'
'(--bench --bin --example --lib)--test=[specify test name]:test name'
)
parallel=(
'(-j --jobs)'{-j+,--jobs=}'[specify number of parallel jobs]:jobs [# of CPUs]'
)
features=(
'(--all-features)--features=[specify features to activate]:feature'
'(--features)--all-features[activate all available features]'
"--no-default-features[don't build the default features]"
)
msgfmt='--message-format=[specify error format]:error format [human]:(human json short)'
triple='--target=[specify target triple]:target triple'
target='--target-dir=[specify directory for all generated artifacts]:directory:_directories'
manifest='--manifest-path=[specify path to manifest]:path:_directories'
registry='--registry=[specify registry to use]:registry'
case $state in
args) args)
case $words[1] in curcontext="${curcontext%:*}-${words[1]}:"
case ${words[1]} in
bench) bench)
_arguments \ _arguments -s -A "^--" $common $parallel $features $msgfmt $triple $target $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]' \
"${command_scope_spec[@]}" \ "${command_scope_spec[@]}" \
'--manifest-path=[path to manifest]: :_files -/' \ '--all-targets[benchmark all targets]' \
'--no-default-features[do not build the default features]' \ "--no-run[compile but don't run]" \
'--no-run[compile but do not run]' \ '(-p --package)'{-p+,--package=}'[specify package to run benchmarks for]:package:_cargo_package_names' \
'(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \ '--exclude=[exclude packages from the benchmark]:spec' \
'--target=[target triple]' \ '--no-fail-fast[run all benchmarks regardless of failure]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '1: :_guard "^-*" "bench name"' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '*:args:_default'
'--color=:colorization option:(auto always never)' \
;; ;;
build) build)
_arguments \ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
'--features=[space separated feature list]' \ '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \
'--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[@]}" \ "${command_scope_spec[@]}" \
'--manifest-path=[path to manifest]: :_files -/' \ '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \
'--no-default-features[do not build the default features]' \ '--release[build in release mode]' \
'(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \ '--build-plan[output the build plan in JSON]' \
'--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) check)
_arguments \ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
'--features=[space separated feature list]' \ '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \
'--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[@]}" \ "${command_scope_spec[@]}" \
'--manifest-path=[path to manifest]: :_files -/' \ '(-p --package)'{-p+,--package=}'[specify package to check]:package:_cargo_package_names' \
'--no-default-features[do not check the default features]' \ '--release[check in release mode]' \
'(-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) 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' \
'--manifest-path=[path to manifest]: :_files -/' \ '--release[clean release artifacts]' \
'(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \ '--doc[clean just the documentation directory]'
'(-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) doc)
_arguments \ _arguments -s -S $common $parallel $features $msgfmt $triple $target $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 -/' \
'--no-deps[do not build docs for dependencies]' \ '--no-deps[do not build docs for dependencies]' \
'--no-default-features[do not build the default features]' \ '--document-private-items[include non-public items in the documentation]' \
'--open[open docs in browser after the build]' \ '--open[open docs in browser after the build]' \
'(-p, --package)'{-p,--package}'=[package to document]' \ '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--release[build artifacts in release mode, with optimizations]' \ '--release[build artifacts in release mode, with optimizations]' \
'--target=[build for the target triple]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
;; ;;
fetch) fetch)
_arguments \ _arguments -s -S $common $triple $manifest
'(-h, --help)'{-h,--help}'[show help message]' \ ;;
'--manifest-path=[path to manifest]: :_files -/' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ fix)
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
'--color=:colorization option:(auto always never)' \ "${command_scope_spec[@]}" \
'--broken-code[fix code even if it already has compiler errors]' \
'--edition[fix in preparation for the next edition]' \
'--edition-idioms[fix warnings to migrate to the idioms of an edition]' \
'--allow-no-vcs[fix code even if a VCS was not detected]' \
'--allow-dirty[fix code even if the working directory is dirty]' \
'--allow-staged[fix code even if the working directory has staged changes]'
;; ;;
generate-lockfile) generate-lockfile)
_arguments \ _arguments -s -S $common $manifest
'(-h, --help)'{-h,--help}'[show help message]' \
'--manifest-path=[path to manifest]: :_files -/' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
;; ;;
git-checkout) git-checkout)
_arguments \ _arguments -s -S $common \
'(-h, --help)'{-h,--help}'[show help message]' \ '--reference=:reference' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--url=:url:_urls'
'--reference=[REF]' \
'--url=[URL]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
;; ;;
help) help)
_arguments \ _cargo_cmds
'(-h, --help)'{-h,--help}'[show help message]' \
'*: :_cargo_cmds' \
;; ;;
init) 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)' \
;; ;;
install) install)
_arguments \ _arguments -s -S $common $parallel $features $triple $registry \
'--bin=[only install the specified binary]' \ '(-f --force)'{-f,--force}'[force overwriting of existing crates or binaries]' \
'--branch=[branch to use when installing from git]' \ '--bin=[only install the specified binary]:binary' \
'--color=:colorization option:(auto always never)' \ '--branch=[branch to use when installing from git]:branch' \
'--debug[build in debug mode instead of release mode]' \ '--debug[build in debug mode instead of release mode]' \
'--example[install the specified example instead of binaries]' \ '--example=[install the specified example instead of binaries]:example' \
'--features=[space separated feature list]' \ '--git=[specify URL from which to install the crate]:url:_urls' \
'--all-features[enable all available features]' \ '--path=[local filesystem path to crate to install]: :_directories' \
'--git=[URL from which to install the crate]' \ '--rev=[specific commit to use when installing from git]:commit' \
'(-h, --help)'{-h,--help}'[show help message]' \ '--root=[directory to install packages into]: :_directories' \
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ '--tag=[tag to use when installing from git]:tag' \
'--no-default-features[do not build the default features]' \ '--vers=[version to install from crates.io]:version' \
'--path=[local filesystem path to crate to install]: :_files -/' \ '--list[list all installed packages and their versions]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '*: :_guard "^-*" "crate"'
'--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) locate-project)
_arguments \ _arguments -s -S $common $manifest
'(-h, --help)'{-h,--help}'[show help message]' \
'--manifest-path=[path to manifest]: :_files -/' \
;; ;;
login) login)
_arguments \ _arguments -s -S $common $registry \
'(-h, --help)'{-h,--help}'[show help message]' \ '*: :_guard "^-*" "token"'
'--host=[Host to set the token for]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
;; ;;
metadata) metadata)
_arguments \ _arguments -s -S $common $features $manifest \
'(-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-deps[output information only about the root package and don't fetch dependencies]" \
'--no-default-features[do not include the default feature]' \ '--format-version=[specify format version]:version [1]:(1)'
'--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) new)
_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)' \ '--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]'
'--name=[set the resulting package name]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
;; ;;
owner) owner)
_arguments \ _arguments -s -S $common $registry \
'(-a, --add)'{-a,--add}'[add owner LOGIN]' \ '(-a --add)'{-a,--add}'[specify name of a user or team to invite as an owner]:name' \
'(-h, --help)'{-h,--help}'[show help message]' \ '--index=[specify registry index]:index' \
'--index[registry index]' \ '(-l --list)'{-l,--list}'[list owners of a crate]' \
'(-l, --list)'{-l,--list}'[list owners of a crate]' \ '(-r --remove)'{-r,--remove}'[specify name of a user or team to remove as an owner]:name' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--token=[specify API token to use when authenticating]:token' \
'(-r, --remove)'{-r,--remove}'[remove owner LOGIN]' \ '*: :_guard "^-*" "crate"'
'--token[API token to use when authenticating]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
;; ;;
package) package)
_arguments \ _arguments -s -S $common $parallel $features $triple $target $manifest \
'(-h, --help)'{-h,--help}'[show help message]' \ '(-l --list)'{-l,--list}'[print files included in a package without making one]' \
'(-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-metadata[ignore warnings about a lack of human-usable metadata]' \
'--no-verify[do not build to verify contents]' \ '--allow-dirty[allow dirty working directories to be packaged]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ "--no-verify[don't build to verify contents]"
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
;; ;;
pkgid) pkgid)
_arguments \ _arguments -s -S $common $manifest \
'(-h, --help)'{-h,--help}'[show help message]' \ '(-p --package)'{-p+,--package=}'[specify package to get ID specifier for]:package:_cargo_package_names' \
'--manifest-path=[path to manifest]: :_files -/' \ '*: :_guard "^-*" "spec"'
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
;; ;;
publish) publish)
_arguments \ _arguments -s -S $common $parallel $features $triple $target $manifest $registry \
'(-h, --help)'{-h,--help}'[show help message]' \ '--index=[specify registry index]:index' \
'--host=[Host to set the token for]' \ '--allow-dirty[allow dirty working directories to be packaged]' \
'--manifest-path=[path to manifest]: :_files -/' \ "--no-verify[don't verify the contents by building them]" \
'--no-verify[Do not verify tarball until before publish]' \ '--token=[specify token to use when uploading]:token' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--dry-run[perform all checks without uploading]'
'--token[token to use when uploading]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
;; ;;
read-manifest) read-manifest)
_arguments \ _arguments -s -S $common $manifest
'(-h, --help)'{-h,--help}'[show help message]' \
'--manifest-path=[path to manifest]: :_files -/' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
;; ;;
run) run)
_arguments \ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
'--example=[name of the bin target]' \ '--example=[name of the bin target]:name' \
'--features=[space separated feature list]' \ '--bin=[name of the bin target]:name' \
'--all-features[enable all available features]' \ '(-p --package)'{-p+,--package=}'[specify package with the target to run]:package:_cargo_package_names' \
'(-h, --help)'{-h,--help}'[show help message]' \ '--release[build in release mode]' \
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ '*: :_default'
'--manifest-path=[path to manifest]: :_files -/' \
'--bin=[name of the bin target]' \
'--no-default-features[do not build the default features]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--release=[build in release mode]' \
'--target=[target triple]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
'*: :_normal' \
;; ;;
rustc) rustc)
_arguments \ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
'--color=:colorization option:(auto always never)' \ '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \
'--features=[features to compile for the package]' \ '--profile=[specify profile to build the selected target for]:profile' \
'--all-features[enable all available features]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
'--manifest-path=[path to the manifest to fetch dependencies for]: :_files -/' \
'--no-default-features[do not compile default features for the package]' \
'(-p, --package)'{-p,--package}'=[profile to compile for]' \
'--profile=[profile to build the selected target for]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--release[build artifacts in release mode, with optimizations]' \ '--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[@]}" \ "${command_scope_spec[@]}" \
'*: : _dispatch rustc rustc -default-'
;; ;;
rustdoc) rustdoc)
_arguments \ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
'--color=:colorization option:(auto always never)' \ '--document-private-items[include non-public items in the documentation]' \
'--features=[space-separated list of features to also build]' \
'--all-features[enable all available features]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
'--manifest-path=[path to the manifest to document]: :_files -/' \
'--no-default-features[do not build the `default` feature]' \
'--open[open the docs in a browser after the operation]' \ '--open[open the docs in a browser after the operation]' \
'(-p, --package)'{-p,--package}'=[package to document]' \ '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--release[build artifacts in release mode, with optimizations]' \ '--release[build artifacts in release mode, with optimizations]' \
'--target=[build for the target triple]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
"${command_scope_spec[@]}" \ "${command_scope_spec[@]}" \
'*: : _dispatch rustdoc rustdoc -default-'
;; ;;
search) search)
_arguments \ _arguments -s -S $common $registry \
'--color=:colorization option:(auto always never)' \ '--index=[specify registry index]:index' \
'(-h, --help)'{-h,--help}'[show help message]' \ '--limit=[limit the number of results]:results [10]' \
'--host=[host of a registry to search in]' \ '*: :_guard "^-*" "query"'
'--limit=[limit the number of results]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
;; ;;
test) test)
_arguments \ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
'--features=[space separated feature list]' \ '--test=[test name]: :_cargo_test_names' \
'--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-fail-fast[run all tests regardless of failure]' \
'--no-run[compile but do not run]' \ '--no-run[compile but do not run]' \
'(-p,--package)'{-p=,--package=}'[package to run tests for]:packages:_get_package_names' \ '(-p --package)'{-p+,--package=}'[package to run tests for]:package:_cargo_package_names' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ '--all[test all packages in the workspace]' \
'--release[build artifacts in release mode, with optimizations]' \ '--release[build artifacts in release mode, with optimizations]' \
'--target=[target triple]' \ '1: :_cargo_test_names' \
'(-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]' \ '(--doc --bin --example --test --bench)--lib[only test library]' \
'(--lib --bin --example --test --bench)--doc[only test documentation]' \ '(--lib --bin --example --test --bench)--doc[only test documentation]' \
'(--lib --doc --example --test --bench)--bin=[binary name]' \ '(--lib --doc --example --test --bench)--bin=[binary name]' \
'(--lib --doc --bin --test --bench)--example=[example name]' \ '(--lib --doc --bin --test --bench)--example=[example name]' \
'(--lib --doc --bin --example --bench)--test=[test name]' \ '(--lib --doc --bin --example --bench)--test=[test name]' \
'(--lib --doc --bin --example --test)--bench=[benchmark name]' \ '(--lib --doc --bin --example --test)--bench=[benchmark name]' \
'--message-format:error format:(human json short)' \ '*: :_default'
'--frozen[require lock and cache up to date]' \
'--locked[require lock up to date]'
;; ;;
uninstall) uninstall)
_arguments \ _arguments -s -S $common \
'--bin=[only uninstall the binary NAME]' \ '(-p --package)'{-p+,--package=}'[specify package to uninstall]:package:_cargo_package_names' \
'--color=:colorization option:(auto always never)' \ '--bin=[only uninstall the specified binary]:name' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-q, --quiet)'{-q,--quiet}'[less output printed to stdout]' \
'--root=[directory to uninstall packages from]: :_files -/' \ '--root=[directory to uninstall packages from]: :_files -/' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '*:crate:_cargo_installed_crates -F line'
;; ;;
update) update)
_arguments \ _arguments -s -S $common $manifest \
'--aggressive=[force dependency update]' \ '--aggressive=[force dependency update]' \
'(-h, --help)'{-h,--help}'[show help message]' \ "--dry-run[don't actually write the lockfile]" \
'--manifest-path=[path to manifest]: :_files -/' \ '(-p --package)'{-p+,--package=}'[specify package to update]:package:_cargo_package_names' \
'(-p,--package)'{-p=,--package=}'[package to update]:packages:__get_package_names' \ '--precise=[update single dependency to precise release]:release'
'--precise=[update single dependency to PRECISE]: :' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
;; ;;
verify-project) verify-project)
_arguments \ _arguments -s -S $common $manifest
'(-h, --help)'{-h,--help}'[show help message]' \
'--manifest-path=[path to manifest]: :_files -/' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
;; ;;
version) version)
_arguments \ _arguments -s -S $common
'(-h, --help)'{-h,--help}'[show help message]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
;; ;;
yank) yank)
_arguments \ _arguments -s -S $common $registry \
'(-h, --help)'{-h,--help}'[show help message]' \ '--vers=[specify yank version]:version' \
'--index[registry index]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--token[API token to use when authenticating]' \
'--undo[undo a yank, putting a version back into the index]' \ '--undo[undo a yank, putting a version back into the index]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ '--index=[specify registry index to yank from]:registry index' \
'--color=:colorization option:(auto always never)' \ '--token=[specify API token to use when authenticating]:token' \
'--vers[yank version]' \ '*: :_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
;; ;;
esac esac
} }
_cargo_unstable_flags() {
local flags
flags=( help ${${${(M)${(f)"$(_call_program flags cargo -Z help)"}:#*--*}/ #-- #/:}##*-Z } )
_describe -t flags 'unstable flag' flags
}
_cargo_installed_crates() {
local expl
_description crates expl 'crate'
compadd "$@" "$expl[@]" - ${${${(f)"$(cargo install --list)"}:# *}%% *}
}
_cargo_cmds() { _cargo_cmds() {
local -a commands;commands=( local -a commands
'bench:execute all benchmarks of a local package' # This uses Parameter Expansion Flags, which are a built-in Zsh feature.
'build:compile the current package' # See more: http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags
'check:check the current package without compiling' # and http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion
'clean:remove generated artifacts' #
'doc:build package documentation' # # How this work?
'fetch:fetch package dependencies' #
'generate-lockfile:create lockfile' # First it splits the result of `cargo --list` at newline, then it removes the first line.
'git-checkout:git checkout' # Then it removes indentation (4 whitespaces) before each items. (Note the x## pattern [1]).
'help:get help for commands' # Then it replaces those spaces between item and description with a `:`
'init:create new package in current directory' #
'install:install a Rust binary' # [1]: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org#patterns
'locate-project:print "Cargo.toml" location' commands=( ${${${(M)"${(f)$(_call_program commands cargo --list)}":# *}/ ##/}/ ##/:} )
'login:login to remote server' _describe -t commands 'command' commands
'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(){
local -a commands;commands=($(cargo --list))
_describe -t all-commands 'all commands' 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
$ $
``` ```
@@ -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)
```
@@ -17,7 +17,7 @@ EOF
fi fi
function colored() { 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") \
@@ -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
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g 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 else
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME" pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
fi fi
else
chroma --style="$ZSH_COLORIZE_STYLE" "$FNAME"
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
}
@@ -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
@@ -0,0 +1,21 @@
# .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. |
| 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. |
@@ -0,0 +1,117 @@
# --------------------------------------------------------------------- #
# Aliases and Completions for .NET Core (https://dotnet.microsoft.com/) #
# Author: Shaun Tabone (https://github.com/xontab) #
# --------------------------------------------------------------------- #
# Helper function to cache and load completions
local cache_base_path="${ZSH_CACHE_DIR}/dotnet_"
_dotnet_cache_completion() {
local cache="${cache_base_path}$(echo $1)_completion"
if [[ ! -f $cache ]]; then
$2 $cache
fi
[[ -f $cache ]] && cat $cache
}
_dotnet_cache_completion_cleanup() {
local cache="${cache_base_path}$(echo $1)_completion"
rm -f $cache
}
# --------------------------------------------------------------------- #
# dotnet new #
# ALIAS: dn #
# --------------------------------------------------------------------- #
_dotnet_new_completion() {
if [ $commands[dotnet] ]; then
dotnet new -l | tail -n +21 | sed 's/ \+/:/g' | cut -d : -f 2 >$1
fi
}
_dotnet_new_completion_cached() {
_dotnet_cache_completion 'new' _dotnet_new_completion
}
_dotnet_cache_completion_cleanup 'new'
alias dn='dotnet new'
# --------------------------------------------------------------------- #
# dotnet #
# --------------------------------------------------------------------- #
_dotnet() {
if [ $CURRENT -eq 2 ]; then
_arguments \
'--diagnostics[Enable diagnostic output.]' \
'--help[Show command line help.]' \
'--info[Display .NET Core information.]' \
'--list-runtimes[Display the installed runtimes.]' \
'--list-sdks[Display the installed SDKs.]' \
'--version[Display .NET Core SDK version in use.]'
_values \
'add[Add a package or reference to a .NET project.]' \
'build[Build a .NET project.]' \
'build-server[Interact with servers started by a build.]' \
'clean[Clean build outputs of a .NET project.]' \
'help[Show command line help.]' \
'list[List project references of a .NET project.]' \
'msbuild[Run Microsoft Build Engine (MSBuild) commands.]' \
'new[Create a new .NET project or file.]' \
'nuget[Provides additional NuGet commands.]' \
'pack[Create a NuGet package.]' \
'publish[Publish a .NET project for deployment.]' \
'remove[Remove a package or reference from a .NET project.]' \
'restore[Restore dependencies specified in a .NET project.]' \
'run[Build and run a .NET project output.]' \
'sln[Modify Visual Studio solution files.]' \
'store[Store the specified assemblies in the runtime package store.]' \
'test[Run unit tests using the test runner specified in a .NET project.]' \
'tool[Install or manage tools that extend the .NET experience.]' \
'vstest[Run Microsoft Test Engine (VSTest) commands.]' \
'dev-certs[Create and manage development certificates.]' \
'fsi[Start F# Interactive / execute F# scripts.]' \
'sql-cache[SQL Server cache command-line tools.]' \
'user-secrets[Manage development user secrets.]' \
'watch[Start a file watcher that runs a command when files change.]'
return
fi
if [ $CURRENT -eq 3 ]; then
case ${words[2]} in
"new")
compadd -X ".NET Installed Templates" $(_dotnet_new_completion_cached)
return
;;
"sln")
_values \
'add[Add one or more projects to a solution file.]' \
'list[List all projects in a solution file.]' \
'remove[Remove one or more projects from a solution file.]'
return
;;
"nuget")
_values \
'delete[Deletes a package from the server.]' \
'locals[Clears or lists local NuGet resources such as http requests cache, packages folder, plugin operations cache or machine-wide global packages folder.]' \
'push[Pushes a package to the server and publishes it.]'
return
;;
esac
fi
_arguments '*::arguments: _normal'
}
compdef _dotnet dotnet
# --------------------------------------------------------------------- #
# Other Aliases #
# --------------------------------------------------------------------- #
alias dr='dotnet run'
alias dt='dotnet test'
alias ds='dotnet sln'
alias da='dotnet add'
alias dp='dotnet pack'
alias dng='dotnet nuget'
@@ -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
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -8,7 +8,7 @@ To use it, add emotty to the plugins array in your zshrc file:
plugins=(... emotty) plugins=(... emotty)
``` ```
**NOTE:** it requires the [emoji plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/emoji). **NOTE:** it requires the [emoji plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/emoji).
## Usage ## Usage
@@ -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 || fab --complete 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
@@ -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 |
@@ -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}"
@@ -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
# #
@@ -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.
@@ -0,0 +1,22 @@
# FirewallD Plugin
This plugin adds some aliases and functions for FirewallD using the `firewalld-cmd` command. To use it, add firewalld to your plugins array.
```zsh
plugins=(... firewalld)
```
## Aliases
| Alias | Command | Description |
| :---- | :----------------------------------------- | :--------------------------- |
| fw | `sudo firewall-cmd` | Shorthand |
| fwr | `sudo firewall-cmd --reload` | Reload current configuration |
| fwp | `sudo firewall-cmd --permanent` | Create permanent rule |
| fwrp | `sudo firewall-cmd --runtime-to-permanent` | Save current configuration |
## Functions
| Function | Description |
| :------- | :--------------------------------------------------------- |
| fwl | Lists configuration from all active zones and direct rules |
@@ -12,6 +12,7 @@ function setup_using_base_dir() {
"${HOME}/.fzf" "${HOME}/.fzf"
"/usr/local/opt/fzf" "/usr/local/opt/fzf"
"/usr/share/fzf" "/usr/share/fzf"
"/usr/local/share/examples/fzf"
) )
for dir in ${fzfdirs}; do for dir in ${fzfdirs}; do
if [[ -d "${dir}" ]]; then if [[ -d "${dir}" ]]; then
@@ -67,7 +68,10 @@ function setup_using_debian_package() {
# NOTE: There is no need to configure PATH for debian package, all binaries # NOTE: There is no need to configure PATH for debian package, all binaries
# are installed to /usr/bin by default # are installed to /usr/bin by default
local completions="/usr/share/zsh/vendor-completions/_fzf" # 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" local key_bindings="/usr/share/doc/fzf/examples/key-bindings.zsh"
# Auto-completion # Auto-completion
@@ -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)
```
@@ -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}") ||
@@ -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
@@ -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.
@@ -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)
```
@@ -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,8 +5,11 @@
# VERSION: 1.0.0 # VERSION: 1.0.0
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Detect if GNU coreutils are installed by looking for gwhoami
if [[ ! -x "${commands[gwhoami]}" ]]; then
return
fi
if [[ -x "${commands[gwhoami]}" ]]; then
__gnu_utils() { __gnu_utils() {
emulate -L zsh emulate -L zsh
local gcmds local gcmds
@@ -36,31 +39,29 @@ if [[ -x "${commands[gwhoami]}" ]]; then
gcmds+=('gsed' 'gtar' 'gtime') gcmds+=('gsed' 'gtar' 'gtime')
for gcmd in "${gcmds[@]}"; do 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 # This method allows for builtin commands to be primary but it's
# lost if hash -r or rehash -f is executed. Thus, those two # lost if hash -r or rehash -f is executed. Thus, those two
# functions have to be wrapped. # functions have to be wrapped.
# #
(( ${+commands[$gcmd]} )) && hash ${gcmd[2,-1]}=${commands[$gcmd]} hash ${gcmd[2,-1]}=${commands[$gcmd]}
#
# This method generates wrapper functions. # This method generates wrapper functions.
# It will override shell builtins. # It will override shell builtins.
# #
# (( ${+commands[$gcmd]} )) && \
# eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }" # eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }"
#
# This method is inflexible since the aliases are at risk of being # This method is inflexible since the aliases are at risk of being
# overridden resulting in the BSD coreutils being called. # overridden resulting in the BSD coreutils being called.
# #
# (( ${+commands[$gcmd]} )) && \
# alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}" # alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}"
done done
return 0 return 0
} }
__gnu_utils; __gnu_utils
function hash() { function hash() {
if [[ "$*" =~ "-(r|f)" ]]; then if [[ "$*" =~ "-(r|f)" ]]; then
@@ -79,5 +80,4 @@ if [[ -x "${commands[gwhoami]}" ]]; then
builtin rehash "$@" builtin rehash "$@"
fi fi
} }
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.
@@ -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
@@ -0,0 +1,15 @@
# hitokoto plugin
Displays a random quote taken from [hitokoto.cn](https://v1.hitokoto.cn/)
Created by [Sinrimin](https://github.com/sinrimin)
## Usage
Add the plugin to the plugins array in your zshrc file and restart zsh:
```zsh
plugins=(... hitokoto)
```
Then, run `hitokoto` to get a new random quote.
@@ -0,0 +1,14 @@
if ! (( $+commands[curl] )); then
echo "hitokoto plugin needs curl to work" >&2
return
fi
function hitokoto {
emulate -L zsh
Q=$(curl -s --connect-timeout 2 "https://v1.hitokoto.cn" | jq -j '.hitokoto+"\t"+.from')
TXT=$(echo "$Q" | awk -F '\t' '{print $1}')
WHO=$(echo "$Q" | awk -F '\t' '{print $2}')
[[ -n "$WHO" && -n "$TXT" ]] && print -P "%F{3}${WHO}%f: “%F{5}${TXT}%f”"
}
@@ -0,0 +1,30 @@
# Ionic plugin
This plugin adds completion for the [Ionic CLI](https://ionicframework.com/docs/cli),
as well as some aliases for common Ionic commands.
To use it, add `ionic` to the plugins array in your zshrc file:
```zsh
plugins=(... ionic)
```
## Aliases
| Alias | Command | Description |
|-------|--------------------------------------|------------------------------------------------------------------|
| iv | `ionic --version` | Check Ionic version |
| ih | `ionic --help` | Ionic help command |
| ist | `ionic start` | Create a new project |
| ii | `ionic info` | Print system/environment info |
| is | `ionic serve` | Start a local dev server for app dev/testing |
| icba | `ionic cordova build android` | Build web assets and prepare app for android platform targets |
| icbi | `ionic cordova build ios` | Build web assets and prepare app for ios platform targets |
| icra | `ionic cordova run android` | Run an Ionic project on a connected android device |
| icri | `ionic cordova run ios` | Run an Ionic project on a connected ios device |
| icrsa | `ionic cordova resources android` | Automatically create icon and splash screen resources for android|
| icrsi | `ionic cordova resources ios` | Automatically create icon and splash screen resources for ios |
| icpaa | `ionic cordova platform add android` | Add Cordova android platform targets |
| icpai | `ionic cordova platform add ios` | Add Cordova ios platform targets |
| icpra | `ionic cordova platform rm android` | Remove Cordova platform targets |
| icpri | `ionic cordova platform rm ios` | Remove Cordova platform targets |
@@ -0,0 +1,15 @@
alias iv="ionic --version"
alias ih="ionic --help"
alias ist="ionic start"
alias ii="ionic info"
alias is="ionic serve"
alias icba="ionic cordova build android"
alias icbi="ionic cordova build ios"
alias icra="ionic cordova run android"
alias icri="ionic cordova run ios"
alias icrsa="ionic cordova resources android"
alias icrsi="ionic cordova resources ios"
alias icpaa="ionic cordova platform add android"
alias icpai="ionic cordova platform add ios"
alias icpra="ionic cordova platform rm android"
alias icpri="ionic cordova platform rm ios"
@@ -15,7 +15,7 @@ if [[ $FOUND_JENV -eq 0 ]]; then
fi fi
if [[ $FOUND_JENV -eq 1 ]]; then if [[ $FOUND_JENV -eq 1 ]]; then
export PATH="${jenvdir}/bin:$PATH" (( $+commands[jenv] )) || export PATH="${jenvdir}/bin:$PATH"
eval "$(jenv init - zsh)" eval "$(jenv init - zsh)"
function jenv_prompt_info() { jenv version-name 2>/dev/null } function jenv_prompt_info() { jenv version-name 2>/dev/null }
@@ -11,9 +11,10 @@ if [[ $(whence node) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METH
alias urlencode_json='xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))"' alias urlencode_json='xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))"'
alias urldecode_json='xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"' alias urldecode_json='xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"'
elif [[ $(whence python) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xpython" ) ]]; then elif [[ $(whence python) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xpython" ) ]]; then
alias pp_json='python -mjson.tool' alias pp_json='python -c "import sys; del sys.path[0]; import runpy; runpy._run_module_as_main(\"json.tool\")"'
alias is_json='python -c " alias is_json='python -c "
import json, sys; import sys; del sys.path[0];
import json;
try: try:
json.loads(sys.stdin.read()) json.loads(sys.stdin.read())
except ValueError, e: except ValueError, e:
@@ -22,11 +23,13 @@ else:
print True print True
sys.exit(0)"' sys.exit(0)"'
alias urlencode_json='python -c " alias urlencode_json='python -c "
import urllib, json, sys; import sys; del sys.path[0];
import urllib, json;
print urllib.quote_plus(sys.stdin.read()) print urllib.quote_plus(sys.stdin.read())
sys.exit(0)"' sys.exit(0)"'
alias urldecode_json='python -c " alias urldecode_json='python -c "
import urllib, json, sys; import sys; del sys.path[0];
import urllib, json;
print urllib.unquote_plus(sys.stdin.read()) print urllib.unquote_plus(sys.stdin.read())
sys.exit(0)"' sys.exit(0)"'
elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xruby" ) ]]; then elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xruby" ) ]]; then
@@ -15,7 +15,7 @@ function _start_agent() {
zstyle -a :omz:plugins:keychain options options zstyle -a :omz:plugins:keychain options options
# start keychain... # start keychain...
keychain ${^options:-} --agents ${agents:-gpg} ${^identities} keychain ${^options:-} --agents ${agents:-gpg} ${^identities} --host $SHORT_HOST
# Get the filenames to store/lookup the environment from # Get the filenames to store/lookup the environment from
_keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh" _keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh"
@@ -0,0 +1,25 @@
# knife plugin
This plugin adds completion for [knife](https://docs.chef.io/knife.html), a command-line tool
to interact with [Chef](https://chef.io), a platform to automate and manage infrastructure via
code.
To use it, add `knife` to the plugins array in your zshrc file:
```zsh
plugins=(... knife)
```
## Options
- `KNIFE_RELATIVE_PATH`: if set to `true`, the completion script will look for local cookbooks
under the `cookbooks` folder in the chef root directory. It has preference over the other two
options below. **Default:** empty.
- `KNIFE_COOKBOOK_PATH`: if set, it points to the folder that contains local cookbooks, for
example: `/path/to/my/chef/cookbooks`. **Default:** `cookbook_path` field in `knife.rb`
(see below).
- `KNIFE_CONF_PATH`: variable pointing to the `knife.rb` configuration file, for example
`/path/to/my/.chef/knife.rb`. Only used if `$KNIFE_COOKBOOK_PATH` isn't set. If it exists,
`$PWD/.chef/knife.rb` is used instead. Otherwise, if it's set, its value is used.
**Default**: `$HOME/.chef/knife.rb`.
@@ -38,7 +38,7 @@ _knife() {
;; ;;
knifesubcmd) knifesubcmd)
case $words[2] in case $words[2] in
(bluebox|ec2|rackspace|slicehost|terremark) bluebox|ec2|rackspace|slicehost|terremark)
compadd "$@" server images compadd "$@" server images
;; ;;
client) client)
@@ -76,6 +76,7 @@ _knife() {
;; ;;
*) *)
_arguments '2:Subsubcommands:($(_knife_options1))' _arguments '2:Subsubcommands:($(_knife_options1))'
;;
esac esac
;; ;;
knifesubcmd2) knifesubcmd2)
@@ -89,10 +90,10 @@ _knife() {
site) site)
compadd "$@" vendor show share search download list unshare compadd "$@" vendor show share search download list unshare
;; ;;
(show|delete|edit) show|delete|edit)
_arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))' _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))'
;; ;;
(upload|test) upload|test)
_arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)' _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)'
;; ;;
list) list)
@@ -103,6 +104,7 @@ _knife() {
;; ;;
*) *)
_arguments '3:Subsubcommands:($(_knife_options2))' _arguments '3:Subsubcommands:($(_knife_options2))'
;;
esac esac
;; ;;
knifesubcmd3) knifesubcmd3)
@@ -113,12 +115,14 @@ _knife() {
versioncomp=1 versioncomp=1
_arguments '4:Cookbookversions:($(_cookbook_versions) latest)' _arguments '4:Cookbookversions:($(_cookbook_versions) latest)'
;; ;;
(node|client|role) node|client|role)
compadd "$@" --attribute compadd "$@" --attribute
;;
esac esac
;;
esac esac
case $words[4] in case $words[4] in
(show|edit) show|edit)
_arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))' _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))'
;; ;;
file) file)
@@ -134,6 +138,7 @@ _knife() {
;; ;;
*) *)
_arguments '*:Subsubcommands:($(_knife_options3))' _arguments '*:Subsubcommands:($(_knife_options3))'
;;
esac esac
;; ;;
list) list)
@@ -141,6 +146,7 @@ _knife() {
;; ;;
*) *)
_arguments '*:Subsubcommands:($(_knife_options3))' _arguments '*:Subsubcommands:($(_knife_options3))'
;;
esac esac
;; ;;
knifesubcmd4) knifesubcmd4)
@@ -151,7 +157,7 @@ _knife() {
file) file)
_arguments '*:directory:_path_files -/ -W "$(_chef_root)/data_bags" -qS \ ' _arguments '*:directory:_path_files -/ -W "$(_chef_root)/data_bags" -qS \ '
;; ;;
*) _arguments '*:Subsubcommands:($(_knife_options2))' *) _arguments '*:Subsubcommands:($(_knife_options2))' ;;
esac esac
fi fi
;; ;;
@@ -162,7 +168,9 @@ _knife() {
;; ;;
*) *)
_arguments '*:Subsubcommands:($(_knife_options3))' _arguments '*:Subsubcommands:($(_knife_options3))'
;;
esac esac
;;
esac esac
} }
@@ -231,8 +239,7 @@ _cookbook_versions() {
# Useful for the knife upload/from file commands # Useful for the knife upload/from file commands
_chef_root() { _chef_root() {
directory="$PWD" directory="$PWD"
while [ $directory != '/' ] while [ $directory != '/' ]; do
do
test -e "$directory/.chef" && echo "$directory" && return test -e "$directory/.chef" && echo "$directory" && return
directory="${directory:h}" directory="${directory:h}"
done done
@@ -0,0 +1,14 @@
# knife_ssh plugin
This plugin adds a `knife_ssh` function as well as completion for it, to allow
connecting via ssh to servers managed with [Chef](https://www.chef.io/).
To use it, add `knife_ssh` to the plugins array in your zshrc file:
```zsh
plugins=(... knife_ssh)
```
The plugin creates a cache of the Chef node list via `knife`, and stores it
in `$HOME/.knife_comp~`, when first triggering knife_ssh completion.
**Requirements:** `knife` has to be installed.
@@ -1,17 +1,17 @@
function knife_ssh() { function knife_ssh() {
grep -q $1 ~/.knife_comp~ 2> /dev/null || rm -f ~/.knife_comp~; grep -q $1 ~/.knife_comp~ 2> /dev/null || rm -f ~/.knife_comp~
ssh $(knife node show $1 | awk '/IP:/{print $2}') ssh $(knife node show $1 | awk '/IP:/{print $2}')
} }
_knife_ssh() { _knife_ssh() {
if hash knife 2>/dev/null; then if hash knife 2>/dev/null; then
if [[ ! -f ~/.knife_comp~ ]]; then if [[ ! -f ~/.knife_comp~ ]]; then
echo "\nGenerating ~/.knife_comp~..." >/dev/stderr echo "\nGenerating ~/.knife_comp~..." >&2
knife node list > ~/.knife_comp~ knife node list > ~/.knife_comp~
fi fi
compadd $(< ~/.knife_comp~) compadd $(< ~/.knife_comp~)
else else
echo "Could not find knife" > /dev/stderr; echo "Could not find knife" >&2
fi fi
} }
@@ -37,6 +37,7 @@ alias kdelf='kubectl delete -f'
# Pod management. # Pod management.
alias kgp='kubectl get pods' alias kgp='kubectl get pods'
alias kgpa='kubectl get pods --all-namespaces'
alias kgpw='kgp --watch' alias kgpw='kgp --watch'
alias kgpwide='kgp -o wide' alias kgpwide='kgp -o wide'
alias kep='kubectl edit pods' alias kep='kubectl edit pods'
@@ -48,6 +49,7 @@ alias kgpl='kgp -l'
# Service management. # Service management.
alias kgs='kubectl get svc' alias kgs='kubectl get svc'
alias kgsa='kubectl get svc --all-namespaces'
alias kgsw='kgs --watch' alias kgsw='kgs --watch'
alias kgswide='kgs -o wide' alias kgswide='kgs -o wide'
alias kes='kubectl edit svc' alias kes='kubectl edit svc'
@@ -56,6 +58,7 @@ alias kdels='kubectl delete svc'
# Ingress management # Ingress management
alias kgi='kubectl get ingress' alias kgi='kubectl get ingress'
alias kgia='kubectl get ingress --all-namespaces'
alias kei='kubectl edit ingress' alias kei='kubectl edit ingress'
alias kdi='kubectl describe ingress' alias kdi='kubectl describe ingress'
alias kdeli='kubectl delete ingress' alias kdeli='kubectl delete ingress'
@@ -69,17 +72,20 @@ alias kcn='kubectl config set-context $(kubectl config current-context) --namesp
# ConfigMap management # ConfigMap management
alias kgcm='kubectl get configmaps' alias kgcm='kubectl get configmaps'
alias kgcma='kubectl get configmaps --all-namespaces'
alias kecm='kubectl edit configmap' alias kecm='kubectl edit configmap'
alias kdcm='kubectl describe configmap' alias kdcm='kubectl describe configmap'
alias kdelcm='kubectl delete configmap' alias kdelcm='kubectl delete configmap'
# Secret management # Secret management
alias kgsec='kubectl get secret' alias kgsec='kubectl get secret'
alias kgseca='kubectl get secret --all-namespaces'
alias kdsec='kubectl describe secret' alias kdsec='kubectl describe secret'
alias kdelsec='kubectl delete secret' alias kdelsec='kubectl delete secret'
# Deployment management. # Deployment management.
alias kgd='kubectl get deployment' alias kgd='kubectl get deployment'
alias kgda='kubectl get deployment --all-namespaces'
alias kgdw='kgd --watch' alias kgdw='kgd --watch'
alias kgdwide='kgd -o wide' alias kgdwide='kgd -o wide'
alias ked='kubectl edit deployment' alias ked='kubectl edit deployment'
@@ -98,6 +104,7 @@ alias kru='kubectl rollout undo'
# Statefulset management. # Statefulset management.
alias kgss='kubectl get statefulset' alias kgss='kubectl get statefulset'
alias kgssa='kubectl get statefulset --all-namespaces'
alias kgssw='kgss --watch' alias kgssw='kgss --watch'
alias kgsswide='kgss -o wide' alias kgsswide='kgss -o wide'
alias kess='kubectl edit statefulset' alias kess='kubectl edit statefulset'
@@ -115,7 +122,13 @@ alias kgaa='kubectl get all --all-namespaces'
# Logs # Logs
alias kl='kubectl logs' alias kl='kubectl logs'
alias kl1h='kubectl logs --since 1h'
alias kl1m='kubectl logs --since 1m'
alias kl1s='kubectl logs --since 1s'
alias klf='kubectl logs -f' alias klf='kubectl logs -f'
alias klf1h='kubectl logs --since 1h -f'
alias klf1m='kubectl logs --since 1m -f'
alias klf1s='kubectl logs --since 1s -f'
# File copy # File copy
alias kcp='kubectl cp' alias kcp='kubectl cp'
@@ -128,6 +141,7 @@ alias kdelno='kubectl delete node'
# PVC management. # PVC management.
alias kgpvc='kubectl get pvc' alias kgpvc='kubectl get pvc'
alias kgpvca='kubectl get pvc --all-namespaces'
alias kgpvcw='kgpvc --watch' alias kgpvcw='kgpvc --watch'
alias kepvc='kubectl edit pvc' alias kepvc='kubectl edit pvc'
alias kdpvc='kubectl describe pvc' alias kdpvc='kubectl describe pvc'
@@ -29,6 +29,12 @@ plugins=(... laravel)
| `pamc` | `php artisan make:controller` | | `pamc` | `php artisan make:controller` |
| `pams` | `php artisan make:seeder` | | `pams` | `php artisan make:seeder` |
| `pamt` | `php artisan make:test` | | `pamt` | `php artisan make:test` |
| `pamfa` | `php artisan make:factory` |
| `pamp` | `php artisan make:policy` |
| `pame` | `php artisan make:event` |
| `pamj` | `php artisan make:job` |
| `paml` | `php artisan make:listener` |
| `pamn` | `php artisan make:notification` |
## Clears ## Clears
@@ -38,3 +44,14 @@ plugins=(... laravel)
| `pacoc` | `php artisan config:clear` | | `pacoc` | `php artisan config:clear` |
| `pavic` | `php artisan view:clear` | | `pavic` | `php artisan view:clear` |
| `paroc` | `php artisan route:clear` | | `paroc` | `php artisan route:clear` |
## Queues
| Alias | Description |
|:-:|:-:|
| `paqf` | `php artisan queue:failed` |
| `paqft` | `php artisan queue:failed-table` |
| `paql` | `php artisan queue:listen` |
| `paqr` | `php artisan queue:retry` |
| `paqt` | `php artisan queue:table` |
| `paqw` | `php artisan queue:work` |
@@ -17,6 +17,13 @@ alias pamm='php artisan make:model'
alias pamc='php artisan make:controller' alias pamc='php artisan make:controller'
alias pams='php artisan make:seeder' alias pams='php artisan make:seeder'
alias pamt='php artisan make:test' alias pamt='php artisan make:test'
alias pamfa='php artisan make:factory'
alias pamp='php artisan make:policy'
alias pame='php artisan make:event'
alias pamj='php artisan make:job'
alias paml='php artisan make:listener'
alias pamn='php artisan make:notification'
alias pampp='php artisan make:provider'
# Clears # Clears
@@ -24,3 +31,11 @@ alias pacac='php artisan cache:clear'
alias pacoc='php artisan config:clear' alias pacoc='php artisan config:clear'
alias pavic='php artisan view:clear' alias pavic='php artisan view:clear'
alias paroc='php artisan route:clear' alias paroc='php artisan route:clear'
# queues
alias paqf='php artisan queue:failed'
alias paqft='php artisan queue:failed-table'
alias paql='php artisan queue:listen'
alias paqr='php artisan queue:retry'
alias paqt='php artisan queue:table'
alias paqw='php artisan queue:work'
@@ -2,7 +2,8 @@
typeset -g ZSH_LAST_WORKING_DIRECTORY typeset -g ZSH_LAST_WORKING_DIRECTORY
# Updates the last directory once directory is changed # Updates the last directory once directory is changed
chpwd_functions+=(chpwd_last_working_dir) autoload -U add-zsh-hook
add-zsh-hook chpwd chpwd_last_working_dir
chpwd_last_working_dir() { chpwd_last_working_dir() {
if [ "$ZSH_SUBSHELL" = 0 ]; then if [ "$ZSH_SUBSHELL" = 0 ]; then
local cache_file="$ZSH_CACHE_DIR/last-working-dir" local cache_file="$ZSH_CACHE_DIR/last-working-dir"
@@ -13,10 +13,10 @@ Plugin for adding catspeak aliases, because why not
) )
``` ```
2. Reload the source file or restart your Terminal session: 2. Restart your terminal session or restart the shell:
```console ```console
$ source ~/.zshrc $ exec zsh
$ $
``` ```
@@ -61,7 +61,7 @@ Plugin for adding catspeak aliases, because why not
| `violenz` | `git rebase` | | `violenz` | `git rebase` |
| `visible` | `echo` | | `visible` | `echo` |
| `wtf` | `dmesg` | | `wtf` | `dmesg` |
| `yolo` | `git commit -m "$(curl -s https://whatthecommit.com/index.txt)"` | | `yolo` | `git commit -m "$(curl -s http://whatthecommit.com/index.txt)"` |
## Usage Examples ## Usage Examples
@@ -78,6 +78,6 @@ nowai u=r,go= some.file
# ssh root@catserver.org # ssh root@catserver.org
pwned root@catserver.org pwned root@catserver.org
# git commit -m "$(curl -s https://whatthecommit.com/index.txt)" # git commit -m "$(curl -s http://whatthecommit.com/index.txt)"
yolo yolo
``` ```
@@ -45,7 +45,7 @@ alias bringz='git pull'
alias chicken='git add' alias chicken='git add'
alias oanward='git commit -m' alias oanward='git commit -m'
alias ooanward='git commit -am' alias ooanward='git commit -am'
alias yolo='git commit -m "$(curl -s https://whatthecommit.com/index.txt)"' alias yolo='git commit -m "$(curl -s http://whatthecommit.com/index.txt)"'
alias letcat='git checkout' alias letcat='git checkout'
alias violenz='git rebase' alias violenz='git rebase'
@@ -0,0 +1,17 @@
## Magic Enter plugin
This plugin makes your enter key magical, by binding commonly used commands to it.
To use it, add `magic-enter` to the plugins array in your zshrc file. You can set the
commands to be run in your .zshrc, before the line containing plugins. If no command
is specified in a git directory, `git status` is executed; in other directories, `ls`.
```zsh
# defaults
MAGIC_ENTER_GIT_COMMAND='git status -u .'
MAGIC_ENTER_OTHER_COMMAND='ls -lh .'
plugins=(... magic-enter)
```
**Maintainer:** [@dufferzafar](https://github.com/dufferzafar)
@@ -1,6 +1,6 @@
## Introduction ## Introduction
The [meteor plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/meteor) provides many The [meteor plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/meteor) provides many
[useful aliases](#aliases) as well as completion for the `meteor` command. [useful aliases](#aliases) as well as completion for the `meteor` command.
Enable it by adding `meteor` to the plugins array in your zshrc file: Enable it by adding `meteor` to the plugins array in your zshrc file:
@@ -0,0 +1,24 @@
# MicroK8s plugin
This plugin provides completion and useful aliases for [MicroK8s](https://microk8s.io/).
To use it, add `microk8s` to the plugins array in your zshrc file.
```zsh
plugins=(... microk8s)
```
## Aliases
| Alias | Command | Description |
|-------|------------------|----------------------------------------------------------------------------------------------------------|
| mco | microk8s.config | Shows the Kubernetes config file. |
| mct | microk8s.ctr | Interact with containerd CLI. |
| mdi | microk8s.disable | Disables an addon. |
| me | microk8s.enable | Enables an addon. |
| mh | microk8s.helm | Interact with Helm CLI. |
| mis | microk8s.istio | Interact with Istio CLI. |
| mk | microk8s.kubectl | Interact with Kubernetes CLI. |
| msp | microk8s.stop | Stops all Kubernetes services. |
| mst | microk8s.start | Starts MicroK8s after it is being stopped. |
| msts | microk8s.status | Provides an overview of the MicroK8s state (running / not running) as well as the set of enabled addons. |
@@ -0,0 +1,82 @@
# ---------------------------------------------------------- #
# Aliases and Completions for MicroK8s (https://microk8s.io) #
# Author: Shaun Tabone (https://github.com/xontab) #
# ---------------------------------------------------------- #
# Helper function to cache and load completions
_microk8s_cache_completion() {
local cache="${ZSH_CACHE_DIR}/microk8s_$(echo $1)_completion"
if [[ ! -f $cache ]]; then
$2 $cache
fi
[[ -f $cache ]] && source $cache
}
# ---------------------------------------------------------- #
# microk8s.enable #
# ALIAS: me #
# ---------------------------------------------------------- #
_microk8s_enable_get_command_list() {
microk8s.enable --help | tail -n +7 | awk '{$1=$1;print}'
}
_microk8s_enable() {
compadd -X "MicroK8s Addons" $(_microk8s_enable_get_command_list)
}
compdef _microk8s_enable microk8s.enable
alias me='microk8s.enable'
# ---------------------------------------------------------- #
# microk8s.disable #
# ALIAS: mdi #
# ---------------------------------------------------------- #
_microk8s_disable_get_command_list() {
microk8s.disable --help | tail -n +7 | awk '{$1=$1;print}'
}
_microk8s_disable() {
compadd -X "MicroK8s Addons" $(_microk8s_disable_get_command_list)
}
compdef _microk8s_disable microk8s.disable
alias mdi='microk8s.disable'
# ---------------------------------------------------------- #
# microk8s.kubectl #
# ALIAS: mk #
# ---------------------------------------------------------- #
_microk8s_kubectl_completion() {
if [ $commands[microk8s.kubectl] ]; then
microk8s.kubectl 2>/dev/null >/dev/null && microk8s.kubectl completion zsh | sed 's/__start_kubectl kubectl/__start_kubectl microk8s.kubectl/g' >$1
fi
}
_microk8s_cache_completion 'kubectl' _microk8s_kubectl_completion
alias mk='microk8s.kubectl'
# ---------------------------------------------------------- #
# microk8s.helm #
# ALIAS: mh #
# ---------------------------------------------------------- #
_microk8s_helm_completion() {
if [ $commands[microk8s.helm] ]; then
microk8s.helm completion zsh | sed 's/__start_helm helm/__start_helm microk8s.helm/g' >$1
fi
}
_microk8s_cache_completion 'helm' _microk8s_helm_completion
alias mh='microk8s.helm'
# ---------------------------------------------------------- #
# Other Aliases #
# ---------------------------------------------------------- #
alias mco='microk8s.config'
alias mct='microk8s.ctr'
alias mis='microk8s.istio'
alias mst='microk8s.start'
alias msts='microk8s.status'
alias msp='microk8s.stop'
@@ -55,4 +55,4 @@ has colored output, so this function will be soon removed from the plugin.
### Known bugs ### Known bugs
It has a bug where it will swallow mvn prompts for user input, _e.g._ when using It has a bug where it will swallow mvn prompts for user input, _e.g._ when using
`archetype:generate`. See [#5052](https://github.com/robbyrussell/oh-my-zsh/issues/5052). `archetype:generate`. See [#5052](https://github.com/ohmyzsh/ohmyzsh/issues/5052).
@@ -267,6 +267,8 @@ function listMavenCompletions {
stage:copy stage:copy
# toolchain # toolchain
toolchain:toolchain toolchain:toolchain
#liberty
liberty:clean-server liberty:compile-jsp liberty:configure-arquillian liberty:create-server liberty:debug liberty:debug-server liberty:deploy liberty:dev liberty:display-url liberty:dump-server liberty:install-apps liberty:install-feature liberty:install-server liberty:java-dump-server liberty:package-server liberty:run liberty:run-server liberty:server-status liberty:start liberty:start-server liberty:status liberty:stop liberty:stop-server liberty:test-start-server liberty:test-stop-server liberty:undeploy liberty:uninstall-feature
# options # options
"-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile=" "-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile="
@@ -1,6 +1,6 @@
## NG Plugin ## NG Plugin
This [ng plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/ng) This [ng plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/ng)
adds completion support for Angular's CLI (named ng). adds completion support for Angular's CLI (named ng).
Ng is hosted on [ng home](https://github.com/catull/angular-cli) Ng is hosted on [ng home](https://github.com/catull/angular-cli)
@@ -43,7 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## Commands ## Commands
| Command | Description | | Command | Description |
| :-------------- | :-------------------------------------------------- | | :-------------- | :---------------------------------------------------- |
| `tab` | Open the current directory in a new tab | | `tab` | Open the current directory in a new tab |
| `split_tab` | Split the current terminal tab horizontally | | `split_tab` | Split the current terminal tab horizontally |
| `vsplit_tab` | Split the current terminal tab vertically | | `vsplit_tab` | Split the current terminal tab vertically |
@@ -56,6 +56,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| `man-preview` | Open a specified man page in Preview app | | `man-preview` | Open a specified man page in Preview app |
| `showfiles` | Show hidden files | | `showfiles` | Show hidden files |
| `hidefiles` | Hide the hidden files | | `hidefiles` | Hide the hidden files |
| `itunes` | Control iTunes. Use `itunes -h` for usage details | | `itunes` | DEPRECATED. Use `music` from macOS Catalina on |
| `music` | Control Apple Music. Use `music -h` for usage details |
| `spotify` | Control Spotify and search by artist, album, track… | | `spotify` | Control Spotify and search by artist, album, track… |
| `rmdsstore` | Remove .DS\_Store files recursively in a directory | | `rmdsstore` | Remove .DS\_Store files recursively in a directory |
@@ -219,7 +219,19 @@ function vncviewer() {
} }
# iTunes control function # iTunes control function
function itunes() { function itunes music() {
local APP_NAME=Music
autoload is-at-least
if is-at-least 10.15 $(sw_vers -productVersion); then
if [[ $0 = itunes ]]; then
echo >&2 The itunes function name is deprecated. Use \`music\' instead.
return 1
fi
else
APP_NAME=iTunes
fi
local opt=$1 local opt=$1
local playlist=$2 local playlist=$2
shift shift
@@ -236,7 +248,7 @@ function itunes() {
opt="$opt track" opt="$opt track"
;; ;;
vol) vol)
local new_volume volume=$(osascript -e 'tell application "iTunes" to get sound volume') local new_volume volume=$(osascript -e "tell application \"$APP_NAME\" to get sound volume")
if [[ $# -eq 0 ]]; then if [[ $# -eq 0 ]]; then
echo "Current volume is ${volume}." echo "Current volume is ${volume}."
return 0 return 0
@@ -253,7 +265,7 @@ function itunes() {
playlist) playlist)
# Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f # Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f
if [[ ! -z "$playlist" ]]; then if [[ ! -z "$playlist" ]]; then
osascript -e 'tell application "iTunes"' -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null; osascript -e "tell application \"$APP_NAME\"" -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null;
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
opt="play" opt="play"
else else
@@ -264,13 +276,13 @@ if [[ ! -z "$playlist" ]]; then
fi fi
;; ;;
playing|status) playing|status)
local state=`osascript -e 'tell application "iTunes" to player state as string'` local state=`osascript -e "tell application \"$APP_NAME\" to player state as string"`
if [[ "$state" = "playing" ]]; then if [[ "$state" = "playing" ]]; then
currenttrack=`osascript -e 'tell application "iTunes" to name of current track as string'` currenttrack=`osascript -e "tell application \"$APP_NAME\" to name of current track as string"`
currentartist=`osascript -e 'tell application "iTunes" to artist of current track as string'` currentartist=`osascript -e "tell application \"$APP_NAME\" to artist of current track as string"`
echo -E "Listening to $fg[yellow]$currenttrack$reset_color by $fg[yellow]$currentartist$reset_color"; echo -E "Listening to $fg[yellow]$currenttrack$reset_color by $fg[yellow]$currentartist$reset_color";
else else
echo "iTunes is" $state; echo "$APP_NAME is" $state;
fi fi
return 0 return 0
;; ;;
@@ -284,7 +296,7 @@ if [[ ! -z "$playlist" ]]; then
if [[ -n "$state" && ! "$state" =~ "^(on|off|toggle)$" ]] if [[ -n "$state" && ! "$state" =~ "^(on|off|toggle)$" ]]
then then
print "Usage: itunes shuffle [on|off|toggle]. Invalid option." print "Usage: $0 shuffle [on|off|toggle]. Invalid option."
return 1 return 1
fi fi
@@ -305,14 +317,14 @@ EOF
esac esac
;; ;;
""|-h|--help) ""|-h|--help)
echo "Usage: itunes <option>" echo "Usage: $0 <option>"
echo "option:" echo "option:"
echo "\tlaunch|play|pause|stop|rewind|resume|quit" echo "\tlaunch|play|pause|stop|rewind|resume|quit"
echo "\tmute|unmute\tcontrol volume set" echo "\tmute|unmute\tcontrol volume set"
echo "\tnext|previous\tplay next or previous track" echo "\tnext|previous\tplay next or previous track"
echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer." echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
echo "\tvol [0-100|up|down]\tGet or set the volume. 0 to 100 sets the volume. 'up' / 'down' increases / decreases by 10 points. No argument displays current volume." echo "\tvol [0-100|up|down]\tGet or set the volume. 0 to 100 sets the volume. 'up' / 'down' increases / decreases by 10 points. No argument displays current volume."
echo "\tplaying|status\tShow what song is currently playing in iTunes." echo "\tplaying|status\tShow what song is currently playing in Music."
echo "\tplaylist [playlist name]\t Play specific playlist" echo "\tplaylist [playlist name]\t Play specific playlist"
echo "\thelp\tshow this message and exit" echo "\thelp\tshow this message and exit"
return 0 return 0
@@ -322,7 +334,7 @@ EOF
return 1 return 1
;; ;;
esac esac
osascript -e "tell application \"iTunes\" to $opt" osascript -e "tell application \"$APP_NAME\" to $opt"
} }
# Spotify control function # Spotify control function
@@ -148,11 +148,11 @@ if [ $# = 0 ]; then
else else
if [ ! -d /Applications/Spotify.app ] && [ ! -d $HOME/Applications/Spotify.app ]; then if [ ! -d /Applications/Spotify.app ] && [ ! -d $HOME/Applications/Spotify.app ]; then
echo "The Spotify application must be installed." echo "The Spotify application must be installed."
exit 1 return 1
fi fi
if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then
osascript -e 'tell application "Spotify" to activate' || exit 1 osascript -e 'tell application "Spotify" to activate' || return 1
sleep 2 sleep 2
fi fi
fi fi
@@ -170,12 +170,12 @@ while [ $# -gt 0 ]; do
if [ -z "${CLIENT_ID}" ]; then if [ -z "${CLIENT_ID}" ]; then
cecho "Invalid Client ID, please update ${USER_CONFIG_FILE}"; cecho "Invalid Client ID, please update ${USER_CONFIG_FILE}";
showAPIHelp; showAPIHelp;
exit 1; return 1
fi fi
if [ -z "${CLIENT_SECRET}" ]; then if [ -z "${CLIENT_SECRET}" ]; then
cecho "Invalid Client Secret, please update ${USER_CONFIG_FILE}"; cecho "Invalid Client Secret, please update ${USER_CONFIG_FILE}";
showAPIHelp; showAPIHelp;
exit 1; return 1
fi fi
SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"|tr -d '\r'); SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"|tr -d '\r');
SPOTIFY_PLAY_URI=""; SPOTIFY_PLAY_URI="";
@@ -194,7 +194,7 @@ while [ $# -gt 0 ]; do
cecho "Autorization failed, please check ${USER_CONFG_FILE}" cecho "Autorization failed, please check ${USER_CONFG_FILE}"
cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}" cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}"
showAPIHelp showAPIHelp
exit 1 return 1
fi fi
SPOTIFY_ACCESS_TOKEN=$( \ SPOTIFY_ACCESS_TOKEN=$( \
printf "${SPOTIFY_TOKEN_RESPONSE_DATA}" \ printf "${SPOTIFY_TOKEN_RESPONSE_DATA}" \
@@ -307,7 +307,7 @@ while [ $# -gt 0 ]; do
"quit" ) cecho "Quitting Spotify."; "quit" ) cecho "Quitting Spotify.";
osascript -e 'tell application "Spotify" to quit'; osascript -e 'tell application "Spotify" to quit';
exit 0 ;; break ;;
"next" ) cecho "Going to next track." ; "next" ) cecho "Going to next track." ;
osascript -e 'tell application "Spotify" to next track'; osascript -e 'tell application "Spotify" to next track';
@@ -358,7 +358,7 @@ while [ $# -gt 0 ]; do
echo " vol down # Decreases the volume by 10%."; echo " vol down # Decreases the volume by 10%.";
echo " vol [amount] # Sets the volume to an amount between 0 and 100."; echo " vol [amount] # Sets the volume to an amount between 0 and 100.";
echo " vol # Shows the current Spotify volume."; echo " vol # Shows the current Spotify volume.";
exit 1; return 1
fi fi
osascript -e "tell application \"Spotify\" to set sound volume to $newvol"; osascript -e "tell application \"Spotify\" to set sound volume to $newvol";
@@ -468,9 +468,10 @@ while [ $# -gt 0 ]; do
"help" ) "help" )
showHelp; showHelp;
break ;; break ;;
* ) * )
showHelp; showHelp;
exit 1; return 1 ;;
esac esac
done done
@@ -0,0 +1,22 @@
# otp plugin
This plugin allows you to create one-time passwords using [`oathtool`](https://www.nongnu.org/oath-toolkit/man-oathtool.html),
able to replace MFA devices. The oathtool key is kept in a GPG-encrypted file so the codes
can only be generated by a user able to decrypt it.
To use it, add `otp` to the plugins array in your zshrc file:
```zsh
plugins=(... otp)
```
Provided aliases:
- `otp_add_device`: creates a new encrypted storage for an oathtool key and stores it
on the disk. For encrypting the key, it will ask for a GPG user ID (your GPG key's
email address). Then the OTP key needs to be pasted, followed by a CTRL+D character
inserted on an empty line.
- `ot`: generates a MFA code based on the given key and copies it to the clipboard
(on Linux it relies on xsel, on MacOS X it uses pbcopy instead).
The plugin uses `$HOME/.otp` to store its internal files.
@@ -12,32 +12,23 @@ function ot () {
return 1 return 1
fi fi
if [[ `uname` == 'Darwin' ]] then # MacOS X
export COPY_CMD='pbcopy'
elif command -v xsel > /dev/null 2>&1; then # Any Unix with xsel installed
export COPY_CMD='xsel --clipboard --input'
else
COPY_CMD='true' COPY_CMD='true'
fi
if [[ "x$1" == "x" ]]; then if [[ -z "$1" ]]; then
echo "usage: otpw <profile.name>" echo "usage: $0 <profile.name>"
return 1 return 1
elif [ ! -f $OTP_HOME/$1.otp.asc ]; then elif [ ! -f $OTP_HOME/$1.otp.asc ]; then
echo "missing profile $1, you might need to create it first using otp_add_device" echo "missing profile $1, you might need to create it first using otp_add_device"
return 1 return 1
else else
totpkey=$(gpg --decrypt $OTP_HOME/$1.otp.asc) totpkey=$(gpg --decrypt $OTP_HOME/$1.otp.asc)
oathtool --totp --b $totpkey | tee /dev/stderr | `echo $COPY_CMD` oathtool --totp --b $totpkey | tee /dev/stderr | clipcopy
if [[ $COPY_CMD == 'true' ]] then
echo "Note: you might consider installing xsel for clipboard integration"
fi
fi fi
} }
function otp_add_device () { function otp_add_device () {
if [[ "x$1" == "x" ]] then if [[ "x$1" == "x" ]] then
echo "usage: otp_add <profile.name>" echo "usage: $0 <profile.name>"
return 1 return 1
else else
echo "Enter an email address attached to your GPG private key, then paste the secret configuration key followed by ^D" echo "Enter an email address attached to your GPG private key, then paste the secret configuration key followed by ^D"
@@ -0,0 +1,22 @@
# pass
This plugin provides completion for the [pass](https://www.passwordstore.org/) password manager.
To use it, add `pass` to the plugins array in your zshrc file.
```
plugins=(... pass)
```
## Configuration
### Multiple repositories
If you use multiple repositories, you can configure completion like this:
```zsh
compdef _pass workpass
zstyle ':completion::complete:workpass::' prefix "$HOME/work/pass"
workpass() {
PASSWORD_STORE_DIR=$HOME/work/pass pass $@
}
```
@@ -0,0 +1,12 @@
# Paver
This plugin adds completion for the `paver` command-line tool of [Paver](https://pythonhosted.org/Paver/).
To use it, add `paver` to the plugins array of your zshrc file:
```zsh
plugins=(... paver)
```
The completion function creates a cache of paver tasks with the name `.paver_tasks`,
in the current working directory. It regenerates that cache when the `pavement.py`
changes.

Some files were not shown because too many files have changed in this diff Show More