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

update cs video settings and ohmyzsh

This commit is contained in:
DazAh
2020-10-23 22:21:11 +01:00
parent a4595b285a
commit 6931ddbb33
184 changed files with 8474 additions and 8730 deletions
+2
View File
@@ -28,3 +28,5 @@ test -z "$PROFILEREAD" && . /etc/profile || true
#fi #fi
export PATH="$HOME/.cargo/bin:$PATH" export PATH="$HOME/.cargo/bin:$PATH"
export KWIN_DRM_USE_EGL_STREAMS=1
export MOZ_X11_EGL=1
+1
View File
@@ -117,6 +117,7 @@ alias vim='nvim'
alias ohmyzsh="vim ~/.oh-my-zsh" alias ohmyzsh="vim ~/.oh-my-zsh"
alias weather='curl https://wttr.in/Liverpool' alias weather='curl https://wttr.in/Liverpool'
alias y='youtube-dl' alias y='youtube-dl'
alias zyp='zypper'
function cheat() { function cheat() {
curl https://cheat.sh/$1 curl https://cheat.sh/$1
+33 -39
View File
@@ -1,47 +1,40 @@
<p align="center"> <p align="center"><img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh"></p>
<img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh">
</p>
Oh My Zsh is an open source, community-driven framework for managing your [zsh](https://www.zsh.org/) configuration. Oh My Zsh is an open source, community-driven framework for managing your [zsh](https://www.zsh.org/) configuration.
Sounds boring. Let's try again. Sounds boring. Let's try again.
__Oh My Zsh will not make you a 10x developer...but you may feel like one.__ **Oh My Zsh will not make you a 10x developer...but you may feel like one.**
Once installed, your terminal shell will become the talk of the town _or your money back!_ With each keystroke in your command prompt, you'll take advantage of the hundreds of powerful plugins and beautiful themes. Strangers will come up to you in cafés and ask you, _"that is amazing! are you some sort of genius?"_ Once installed, your terminal shell will become the talk of the town _or your money back!_ With each keystroke in your command prompt, you'll take advantage of the hundreds of powerful plugins and beautiful themes. Strangers will come up to you in cafés and ask you, _"that is amazing! are you some sort of genius?"_
Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often. 😬 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), follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter, and/or join us on Discord. To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter, and join us on [Discord](https://discord.gg/ohmyzsh).
[![CI](https://github.com/ohmyzsh/ohmyzsh/workflows/CI/badge.svg)](https://github.com/ohmyzsh/ohmyzsh/actions?query=workflow%3ACI) [![CI](https://github.com/ohmyzsh/ohmyzsh/workflows/CI/badge.svg)](https://github.com/ohmyzsh/ohmyzsh/actions?query=workflow%3ACI)
[![Follow @ohmyzsh](https://img.shields.io/twitter/follow/ohmyzsh?label=Follow+@ohmyzsh&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh) [![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) [![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/ohmyzsh)
[![Gitpod ready](https://img.shields.io/badge/Gitpod-ready-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ohmyzsh/ohmyzsh)
## 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: WSL2 is preferred, but cygwin or msys also mostly work.
* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (run `zsh --version` to confirm), check the following instructions here: [Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH) - [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent is fine but we prefer 5.0.8 and newer). If not pre-installed (run `zsh --version` to confirm), check the following wiki instructions here: [Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH)
* `curl` or `wget` should be installed - `curl` or `wget` should be installed
* `git` should be installed (recommended v1.7.2 or higher) - `git` should be installed (recommended v2.4.11 or higher)
### Basic Installation ### Basic Installation
Oh My Zsh is installed by running one of the following commands in your terminal. You can install this via the command-line with either `curl` or `wget`. Oh My Zsh is installed by running one of the following commands in your terminal. You can install this via the command-line with either `curl`, `wget` or another similar tool.
#### via curl | Method | Command |
|:----------|:--------------------------------------------------------------------------------------------------|
```shell | **curl** | `sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | **wget** | `sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
``` | **fetch** | `sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
#### via wget
```shell
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
```
#### Manual inspection #### Manual inspection
@@ -50,7 +43,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/ohmyzsh/ohmyzsh/master/tools/install.sh wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
sh install.sh sh install.sh
``` ```
@@ -58,7 +51,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/ohmyzsh/ohmyzsh/tree/master/plugins) directory and/or the [wiki](https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins) to see what's currently available. Oh My Zsh comes with a shitload of plugins for you to take advantage of. You can take a look in the [plugins](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins) directory and/or the [wiki](https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins) to see what's currently available.
#### Enabling Plugins #### Enabling Plugins
@@ -82,15 +75,15 @@ plugins=(
) )
``` ```
_Note that the plugins are separated by whitespace. **Do not** use commas between them._ _Note that the plugins are separated by whitespace (spaces, tabs, new lines...). **Do not** use commas between them or it will break._
#### Using Plugins #### Using Plugins
Most plugins (should! we're working on this) include a __README__, which documents how to use them. Each plugin includes a __README__, documenting it. This README should show the aliases (if the plugin adds any) and extra goodies that are included in that particular plugin.
### Themes ### 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/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki. Check them out! We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred and fifty themes now bundled. Most of them have [screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki (We are working on updating this!). Check them out!
#### Selecting a Theme #### Selecting a Theme
@@ -119,7 +112,6 @@ In case you did not find a suitable theme for your needs, please have a look at
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.
```shell ```shell
ZSH_THEME="random" # (...please let it be pie... please be some pie..) ZSH_THEME="random" # (...please let it be pie... please be some pie..)
``` ```
@@ -133,10 +125,10 @@ ZSH_THEME_RANDOM_CANDIDATES=(
) )
``` ```
If you only know which themes you don't like, you can add them similarly to a blacklist: If you only know which themes you don't like, you can add them similarly to an ignored list:
```shell ```shell
ZSH_THEME_RANDOM_BLACKLIST=(pygmalion tjkirch_mod) ZSH_THEME_RANDOM_IGNORED=(pygmalion tjkirch_mod)
``` ```
### FAQ ### FAQ
@@ -154,7 +146,7 @@ the installer accepts (these settings are also documented at the top of the inst
#### Custom Directory #### Custom Directory
The default location is `~/.oh-my-zsh` (hidden in your home directory) The default location is `~/.oh-my-zsh` (hidden in your home directory, you can access it with `cd ~/.oh-my-zsh`)
If you'd like to change the install directory with the `ZSH` environment variable, either by running If you'd like to change the install directory with the `ZSH` environment variable, either by running
`export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline
@@ -199,13 +191,13 @@ REPO=apjanke/oh-my-zsh BRANCH=edge sh install.sh
#### Manual Installation #### Manual Installation
##### 1. Clone the repository: ##### 1. Clone the repository
```shell ```shell
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
``` ```
##### 2. *Optionally*, backup your existing `~/.zshrc` file: ##### 2. *Optionally*, backup your existing `~/.zshrc` file
```shell ```shell
cp ~/.zshrc ~/.zshrc.orig cp ~/.zshrc ~/.zshrc.orig
@@ -235,9 +227,9 @@ Once you open up a new terminal window, it should load zsh with Oh My Zsh's conf
If you have any hiccups installing, here are a few common fixes. If you have any hiccups installing, here are a few common fixes.
* You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after - You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after
switching to `oh-my-zsh`. switching to `oh-my-zsh`.
* If you installed manually or changed the install location, check the `ZSH` environment variable in - If you installed manually or changed the install location, check the `ZSH` environment variable in
`~/.zshrc`. `~/.zshrc`.
### Custom Plugins and Themes ### Custom Plugins and Themes
@@ -267,7 +259,7 @@ DISABLE_AUTO_UPDATE=true
If you'd like to upgrade at any point in time (maybe someone just released a new plugin and you don't want to wait a week?) you just need to run: If you'd like to upgrade at any point in time (maybe someone just released a new plugin and you don't want to wait a week?) you just need to run:
```shell ```shell
upgrade_oh_my_zsh omz update
``` ```
Magic! 🎉 Magic! 🎉
@@ -300,10 +292,12 @@ Thank you so much!
## Follow Us ## Follow Us
We're on the social media. We're on social media:
* [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. You should follow it. - [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. You should follow it.
* [Oh My Zsh](https://www.facebook.com/Oh-My-Zsh-296616263819290/) on Facebook. - [FaceBook](https://www.facebook.com/Oh-My-Zsh-296616263819290/) poke us.
- [Instagram](https://www.instagram.com/_ohmyzsh/) tag us in your post showing Oh My Zsh!
- [Discord](https://discord.gg/ohmyzsh) to chat with us!
## Merchandise ## Merchandise
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
ae315ded4dba10685dbbafbfa2ff3c1aefeb490d branch 'master' of https://github.com/zsh-users/zsh-autosuggestions ae315ded4dba10685dbbafbfa2ff3c1aefeb490d branch 'master' of https://github.com/zsh-users/zsh-autosuggestions
9ad039443f8fca082d93efb16b36c20c92f444e0 not-for-merge branch 'develop' of https://github.com/zsh-users/zsh-autosuggestions eff0894a138f64f2752c0e2f0612055d71b0af4f not-for-merge branch 'develop' of https://github.com/zsh-users/zsh-autosuggestions
b27277e7ff0f877f3189211ccd57da9ebec5e743 not-for-merge branch 'experiments/strategies-by-pattern' of https://github.com/zsh-users/zsh-autosuggestions b27277e7ff0f877f3189211ccd57da9ebec5e743 not-for-merge branch 'experiments/strategies-by-pattern' of https://github.com/zsh-users/zsh-autosuggestions
767d55eba0355d9ef9270df3ca257a936cf0eac5 not-for-merge branch 'features/background-initialization' of https://github.com/zsh-users/zsh-autosuggestions 767d55eba0355d9ef9270df3ca257a936cf0eac5 not-for-merge branch 'features/background-initialization' of https://github.com/zsh-users/zsh-autosuggestions
36dae44064a7bf088fb1dec74c8463d5b6f3d3c8 not-for-merge branch 'features/hist-words-suggestions' of https://github.com/zsh-users/zsh-autosuggestions 36dae44064a7bf088fb1dec74c8463d5b6f3d3c8 not-for-merge branch 'features/hist-words-suggestions' of https://github.com/zsh-users/zsh-autosuggestions
@@ -9,4 +9,3 @@ b27277e7ff0f877f3189211ccd57da9ebec5e743 not-for-merge branch 'experiments/strat
4ccfdb2435ea4b82983bf22bb2913c0773992cce not-for-merge branch 'fixes/partial-accept-duplicate-word' of https://github.com/zsh-users/zsh-autosuggestions 4ccfdb2435ea4b82983bf22bb2913c0773992cce not-for-merge branch 'fixes/partial-accept-duplicate-word' of https://github.com/zsh-users/zsh-autosuggestions
9fb96753069b919deaaacb6f659be2339dfeb4d2 not-for-merge branch 'fixes/slow_bracketed_paste_magic' of https://github.com/zsh-users/zsh-autosuggestions 9fb96753069b919deaaacb6f659be2339dfeb4d2 not-for-merge branch 'fixes/slow_bracketed_paste_magic' of https://github.com/zsh-users/zsh-autosuggestions
20c0ea841bafa78d8fb75c767e780248bfdf11a4 not-for-merge branch 'no-server' of https://github.com/zsh-users/zsh-autosuggestions 20c0ea841bafa78d8fb75c767e780248bfdf11a4 not-for-merge branch 'no-server' of https://github.com/zsh-users/zsh-autosuggestions
ae315ded4dba10685dbbafbfa2ff3c1aefeb490d not-for-merge tag 'v0.6.4' of https://github.com/zsh-users/zsh-autosuggestions
@@ -1 +1 @@
4016ff795bb184461996c5539327befc8da2af6f ae315ded4dba10685dbbafbfa2ff3c1aefeb490d
@@ -1,2 +1,3 @@
3da421aa47fdcb10bf3d19f1c35946b03c1bd90e bdbe43e667824e0a4e5e16cdc500ce00b9001dc0 Darren Leatherbarrow <darren@DarrenPC.dazeerrcloud.xyz> 1570875469 +0100 pull: fast-forward 3da421aa47fdcb10bf3d19f1c35946b03c1bd90e bdbe43e667824e0a4e5e16cdc500ce00b9001dc0 Darren Leatherbarrow <darren@DarrenPC.dazeerrcloud.xyz> 1570875469 +0100 pull: fast-forward
bdbe43e667824e0a4e5e16cdc500ce00b9001dc0 9ad039443f8fca082d93efb16b36c20c92f444e0 DazAh <9095216+DazAh@users.noreply.github.com> 1587292881 +0100 pull: fast-forward bdbe43e667824e0a4e5e16cdc500ce00b9001dc0 9ad039443f8fca082d93efb16b36c20c92f444e0 DazAh <9095216+DazAh@users.noreply.github.com> 1587292881 +0100 pull: fast-forward
9ad039443f8fca082d93efb16b36c20c92f444e0 eff0894a138f64f2752c0e2f0612055d71b0af4f DazAh <9095216+DazAh@users.noreply.github.com> 1603487399 +0100 pull: fast-forward
@@ -1 +1 @@
9ad039443f8fca082d93efb16b36c20c92f444e0 eff0894a138f64f2752c0e2f0612055d71b0af4f
+1 -1
View File
@@ -1 +1 @@
31eca46ee3b94ca84a038628e0bf6089a7488908 branch 'master' of https://github.com/ohmyzsh/ohmyzsh 3b1699b59527ee8095397b9909a37d55689a0481 branch 'master' of https://github.com/ohmyzsh/ohmyzsh
+1 -1
View File
@@ -1 +1 @@
11ccf2bbf21a52536b408095af0e25574c7e62f5 fab59ebc3d2ce439a70bd7a68a987c0a895b2ca0
@@ -28,3 +28,4 @@ e38099de96e8b62976354b468da1b21ec2d57f68 52f58785645c18aa88ea515d070a42bcfe97508
31eca46ee3b94ca84a038628e0bf6089a7488908 486857f709aa2fa229391097651e043b62d316e5 DazAh <9095216+DazAh@users.noreply.github.com> 1587285078 +0100 rebase (pick): deleted: cache/.gitkeep 31eca46ee3b94ca84a038628e0bf6089a7488908 486857f709aa2fa229391097651e043b62d316e5 DazAh <9095216+DazAh@users.noreply.github.com> 1587285078 +0100 rebase (pick): deleted: cache/.gitkeep
486857f709aa2fa229391097651e043b62d316e5 fab59ebc3d2ce439a70bd7a68a987c0a895b2ca0 DazAh <9095216+DazAh@users.noreply.github.com> 1587285078 +0100 rebase (pick): commit message 486857f709aa2fa229391097651e043b62d316e5 fab59ebc3d2ce439a70bd7a68a987c0a895b2ca0 DazAh <9095216+DazAh@users.noreply.github.com> 1587285078 +0100 rebase (pick): commit message
fab59ebc3d2ce439a70bd7a68a987c0a895b2ca0 fab59ebc3d2ce439a70bd7a68a987c0a895b2ca0 DazAh <9095216+DazAh@users.noreply.github.com> 1587285078 +0100 rebase (finish): returning to refs/heads/master fab59ebc3d2ce439a70bd7a68a987c0a895b2ca0 fab59ebc3d2ce439a70bd7a68a987c0a895b2ca0 DazAh <9095216+DazAh@users.noreply.github.com> 1587285078 +0100 rebase (finish): returning to refs/heads/master
fab59ebc3d2ce439a70bd7a68a987c0a895b2ca0 b4c49847e4ac5e235056165350c3a4be46244ce3 DazAh <9095216+DazAh@users.noreply.github.com> 1603487324 +0100 pull: Merge made by the 'recursive' strategy.
@@ -21,3 +21,4 @@ e38099de96e8b62976354b468da1b21ec2d57f68 52f58785645c18aa88ea515d070a42bcfe97508
05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5 11ccf2bbf21a52536b408095af0e25574c7e62f5 DazAh <9095216+DazAh@users.noreply.github.com> 1587285053 +0100 commit: deleted: cache/.gitkeep 05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5 11ccf2bbf21a52536b408095af0e25574c7e62f5 DazAh <9095216+DazAh@users.noreply.github.com> 1587285053 +0100 commit: deleted: cache/.gitkeep
11ccf2bbf21a52536b408095af0e25574c7e62f5 5fc3c3fca4eb259cbb2a68435a11a8fffec6539f DazAh <9095216+DazAh@users.noreply.github.com> 1587285072 +0100 commit: commit message 11ccf2bbf21a52536b408095af0e25574c7e62f5 5fc3c3fca4eb259cbb2a68435a11a8fffec6539f DazAh <9095216+DazAh@users.noreply.github.com> 1587285072 +0100 commit: commit message
5fc3c3fca4eb259cbb2a68435a11a8fffec6539f fab59ebc3d2ce439a70bd7a68a987c0a895b2ca0 DazAh <9095216+DazAh@users.noreply.github.com> 1587285078 +0100 rebase (finish): refs/heads/master onto 31eca46ee3b94ca84a038628e0bf6089a7488908 5fc3c3fca4eb259cbb2a68435a11a8fffec6539f fab59ebc3d2ce439a70bd7a68a987c0a895b2ca0 DazAh <9095216+DazAh@users.noreply.github.com> 1587285078 +0100 rebase (finish): refs/heads/master onto 31eca46ee3b94ca84a038628e0bf6089a7488908
fab59ebc3d2ce439a70bd7a68a987c0a895b2ca0 b4c49847e4ac5e235056165350c3a4be46244ce3 DazAh <9095216+DazAh@users.noreply.github.com> 1603487324 +0100 pull: Merge made by the 'recursive' strategy.
@@ -18,3 +18,4 @@ e38099de96e8b62976354b468da1b21ec2d57f68 52f58785645c18aa88ea515d070a42bcfe97508
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 3e4d10c4f17b2fe57090a524d5d78781beda204a 05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5 DazAh <9095216+DazAh@users.noreply.github.com> 1580316594 +0000 pull --rebase --stat origin master: fast-forward
05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5 31eca46ee3b94ca84a038628e0bf6089a7488908 DazAh <9095216+DazAh@users.noreply.github.com> 1587285078 +0100 pull --rebase --stat origin master: fast-forward 05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5 31eca46ee3b94ca84a038628e0bf6089a7488908 DazAh <9095216+DazAh@users.noreply.github.com> 1587285078 +0100 pull --rebase --stat origin master: fast-forward
31eca46ee3b94ca84a038628e0bf6089a7488908 3b1699b59527ee8095397b9909a37d55689a0481 DazAh <9095216+DazAh@users.noreply.github.com> 1603487324 +0100 pull: fast-forward
@@ -1 +1 @@
fab59ebc3d2ce439a70bd7a68a987c0a895b2ca0 b4c49847e4ac5e235056165350c3a4be46244ce3
@@ -1 +1 @@
31eca46ee3b94ca84a038628e0bf6089a7488908 3b1699b59527ee8095397b9909a37d55689a0481
Binary file not shown.
@@ -1 +1,4 @@
# Plugin owners
plugins/gitfast/ @felipec plugins/gitfast/ @felipec
plugins/sdk/ @rgoldberg
plugins/git-lfs/ @vietduc01100001
@@ -1,5 +1,7 @@
## Standards checklist: ## Standards checklist:
<!-- Fill with an x the ones that apply. Example: [x] -->
- [ ] The PR title is descriptive. - [ ] The PR title is descriptive.
- [ ] The PR doesn't replicate another PR which is already open. - [ ] The PR doesn't replicate another PR which is already open.
- [ ] I have read the contribution guide and followed all the instructions. - [ ] I have read the contribution guide and followed all the instructions.
@@ -1,7 +1,6 @@
--- ---
name: Bug report name: Bug report
about: Create a report to help us improve Oh My Zsh about: Create a report to help us improve Oh My Zsh
labels: 'Type: support'
--- ---
@@ -26,11 +25,21 @@ A brief description of what should happen.
If applicable, add screenshots to help explain your problem. If applicable, add screenshots to help explain your problem.
You can also record an asciinema session: https://asciinema.org/ You can also record an asciinema session: https://asciinema.org/
**Self Check**
- Have you tried reaching out on the [Discord server](https://discord.gg/ohmyzsh)?
This can help cut down on filling up issues. We always have a few people
online that are in a variety of timezones that are willing to help you!
- Also searching existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=) might help you get quicker support
**Desktop (please complete the following information):** **Desktop (please complete the following information):**
- OS / Distro: [e.g. Arch Linux, macOS] - OS / Distro: [e.g. Arch Linux, macOS]
- Latest ohmyzsh Update?: [e.g. Yes/No] - If on Windows what version of WSL: [e.g. WSL1, WSL2]
- Latest ohmyzsh update?: [e.g. Yes/No]
- ZSH Version: [e.g. 5.6] - ZSH Version: [e.g. 5.6]
- Terminal emulator [e.g. iTerm2] - Terminal emulator: [e.g. iTerm2]
**Additional context** **Additional context**
Add any other context about the problem here. This can be themes, plugins, custom configs. Add any other context about the problem here. This can be themes, plugins, custom configs.
@@ -1,7 +1,7 @@
--- ---
name: Feature request name: Feature request
about: Suggest a feature for Oh My Zsh about: Suggest a feature for Oh My Zsh
labels: 'Type: feature' labels: 'feature'
--- ---
@@ -11,16 +11,19 @@ an issue where no sections have been filled will be deleted without comment.
--> -->
**Is your feature request related to a particular plugin or theme? If so, specify it.** **Is your feature request related to a particular plugin or theme? If so, specify it.**
The name of the plugin or theme that you would like us to improve. [...] The name of the plugin, theme or alias that you would like us to improve. [...]
**Is your feature request related to a problem? Please describe.** **Is your feature request related to a problem? Please describe.**
A description of what the problem is. Ex. I'm always frustrated when [...] A description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like** **Describe the solution you'd like**
A description of what you want to happen. A description of what you want to happen. [...]
**Describe alternatives you've considered** **Describe alternatives you've considered**
A description of any alternative solutions or features you've considered. This can also include other plugins or aliases. A description of any alternative solutions or features you've considered. This can also include other plugins or themes.
**Additional context** **Additional context**
Add any other context or screenshots about the feature request here. Also if you have any PRs related to this issue that are already open that you would like us to look at. Add any other context, screenshots or discord conversations about the feature request here. Also if you have any PRs related to this issue that are already open that you would like us to look at.
**Related Issues**
Is there any open or closed issues that is related to this feature request? If so please link them below! [...]
@@ -1,7 +1,7 @@
--- ---
name: Support name: Support
about: Request support for any problem you're having with Oh My Zsh about: Request support for any problem you're having with Oh My Zsh
labels: 'Type: support' labels: 'support'
--- ---
+7 -8
View File
@@ -41,8 +41,8 @@ fi
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
# Use caching so that commands like apt and dpkg complete are useable # Use caching so that commands like apt and dpkg complete are useable
zstyle ':completion::complete:*' use-cache 1 zstyle ':completion:*' use-cache yes
zstyle ':completion::complete:*' cache-path $ZSH_CACHE_DIR zstyle ':completion:*' cache-path $ZSH_CACHE_DIR
# Don't complete uninteresting users # Don't complete uninteresting users
zstyle ':completion:*:*:*:users' ignored-patterns \ zstyle ':completion:*:*:*:users' ignored-patterns \
@@ -60,16 +60,15 @@ zstyle '*' single-ignored show
if [[ $COMPLETION_WAITING_DOTS = true ]]; then if [[ $COMPLETION_WAITING_DOTS = true ]]; then
expand-or-complete-with-dots() { expand-or-complete-with-dots() {
# toggle line-wrapping off and back on again print -Pn "%F{red}…%f"
[[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
print -Pn "%{%F{red}......%f%}"
[[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam
zle expand-or-complete zle expand-or-complete
zle redisplay zle redisplay
} }
zle -N expand-or-complete-with-dots zle -N expand-or-complete-with-dots
bindkey "^I" expand-or-complete-with-dots # Set the function as the default tab completion widget
bindkey -M emacs "^I" expand-or-complete-with-dots
bindkey -M viins "^I" expand-or-complete-with-dots
bindkey -M vicmd "^I" expand-or-complete-with-dots
fi fi
# automatically load bash completion functions # automatically load bash completion functions
@@ -192,19 +192,19 @@ function _omz_diag_dump_one_big_text() {
command ls -ld ~/.oh* command ls -ld ~/.oh*
builtin echo builtin echo
builtin echo oh-my-zsh git state: builtin echo oh-my-zsh git state:
(cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]") (builtin cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]")
if [[ $verbose -ge 1 ]]; then if [[ $verbose -ge 1 ]]; then
(cd $ZSH && git reflog --date=default | command grep pull) (builtin cd $ZSH && git reflog --date=default | command grep pull)
fi fi
builtin echo builtin echo
if [[ -e $ZSH_CUSTOM ]]; then if [[ -e $ZSH_CUSTOM ]]; then
local custom_dir=$ZSH_CUSTOM local custom_dir=$ZSH_CUSTOM
if [[ -h $custom_dir ]]; then if [[ -h $custom_dir ]]; then
custom_dir=$(cd $custom_dir && pwd -P) custom_dir=$(builtin cd $custom_dir && pwd -P)
fi fi
builtin echo "oh-my-zsh custom dir:" builtin echo "oh-my-zsh custom dir:"
builtin echo " $ZSH_CUSTOM ($custom_dir)" builtin echo " $ZSH_CUSTOM ($custom_dir)"
(cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print) (builtin cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print)
builtin echo builtin echo
fi fi
+12 -1
View File
@@ -1,5 +1,7 @@
function zsh_stats() { function zsh_stats() {
fc -l 1 | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20 fc -l 1 \
| awk '{ CMD[$2]++; count++; } END { for (a in CMD) print CMD[a] " " CMD[a]*100/count "% " a }' \
| grep -v "./" | sort -nr | head -n20 | column -c3 -s " " -t | nl
} }
function uninstall_oh_my_zsh() { function uninstall_oh_my_zsh() {
@@ -7,7 +9,16 @@ function uninstall_oh_my_zsh() {
} }
function upgrade_oh_my_zsh() { function upgrade_oh_my_zsh() {
if (( $+functions[_omz::update] )); then
echo >&2 "${fg[yellow]}Note: \`$0\` is deprecated. Use \`omz update\` instead.$reset_color"
fi
# Run update script
env ZSH="$ZSH" sh "$ZSH/tools/upgrade.sh" env ZSH="$ZSH" sh "$ZSH/tools/upgrade.sh"
# Update last updated file
zmodload zsh/datetime
echo "LAST_EPOCH=$(( EPOCHSECONDS / 60 / 60 / 24 ))" >! "${ZSH_CACHE_DIR}/.zsh-update"
# Remove update lock if it exists
command rm -rf "$ZSH/log/update.lock" command rm -rf "$ZSH/log/update.lock"
} }
+124 -67
View File
@@ -1,9 +1,20 @@
# The git prompt's git commands are read-only and should not interfere with
# other processes. This environment variable is equivalent to running with `git
# --no-optional-locks`, but falls back gracefully for older versions of git.
# See git(1) for and git-status(1) for a description of that flag.
#
# We wrap in a local function instead of exporting the variable directly in
# order to avoid interfering with manually-run git commands by the user.
function __git_prompt_git() {
GIT_OPTIONAL_LOCKS=0 command git "$@"
}
# Outputs current branch info in prompt format # Outputs current branch info in prompt format
function git_prompt_info() { function git_prompt_info() {
local ref local ref
if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ ref=$(__git_prompt_git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) || return 0
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi fi
} }
@@ -13,11 +24,11 @@ function parse_git_dirty() {
local STATUS local STATUS
local -a FLAGS local -a FLAGS
FLAGS=('--porcelain') FLAGS=('--porcelain')
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then if [[ "$(__git_prompt_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 case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in
git) git)
# let git decide (this respects per-repo config in .gitmodules) # let git decide (this respects per-repo config in .gitmodules)
;; ;;
@@ -27,7 +38,7 @@ function parse_git_dirty() {
FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}" FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
;; ;;
esac esac
STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1) STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n1)
fi fi
if [[ -n $STATUS ]]; then if [[ -n $STATUS ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY" echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
@@ -39,10 +50,10 @@ function parse_git_dirty() {
# Gets the difference between the local and remote branches # Gets the difference between the local and remote branches
function git_remote_status() { function git_remote_status() {
local remote ahead behind git_remote_status git_remote_status_detailed local remote ahead behind git_remote_status git_remote_status_detailed
remote=${$(command git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/} remote=${$(__git_prompt_git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
if [[ -n ${remote} ]]; then if [[ -n ${remote} ]]; then
ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l) ahead=$(__git_prompt_git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l) behind=$(__git_prompt_git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
if [[ $ahead -eq 0 ]] && [[ $behind -eq 0 ]]; then if [[ $ahead -eq 0 ]] && [[ $behind -eq 0 ]]; then
git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE" git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE"
@@ -71,11 +82,11 @@ function git_remote_status() {
# it's not a symbolic ref, but in a Git repo. # it's not a symbolic ref, but in a Git repo.
function git_current_branch() { function git_current_branch() {
local ref local ref
ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null) ref=$(__git_prompt_git symbolic-ref --quiet HEAD 2> /dev/null)
local ret=$? local ret=$?
if [[ $ret != 0 ]]; then if [[ $ret != 0 ]]; then
[[ $ret == 128 ]] && return # no git repo. [[ $ret == 128 ]] && return # no git repo.
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) || return
fi fi
echo ${ref#refs/heads/} echo ${ref#refs/heads/}
} }
@@ -83,8 +94,8 @@ function git_current_branch() {
# Gets the number of commits ahead from remote # Gets the number of commits ahead from remote
function git_commits_ahead() { function git_commits_ahead() {
if command git rev-parse --git-dir &>/dev/null; then if __git_prompt_git rev-parse --git-dir &>/dev/null; then
local commits="$(git rev-list --count @{upstream}..HEAD 2>/dev/null)" local commits="$(__git_prompt_git rev-list --count @{upstream}..HEAD 2>/dev/null)"
if [[ -n "$commits" && "$commits" != 0 ]]; then if [[ -n "$commits" && "$commits" != 0 ]]; then
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX" echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
fi fi
@@ -93,8 +104,8 @@ function git_commits_ahead() {
# Gets the number of commits behind remote # Gets the number of commits behind remote
function git_commits_behind() { function git_commits_behind() {
if command git rev-parse --git-dir &>/dev/null; then if __git_prompt_git rev-parse --git-dir &>/dev/null; then
local commits="$(git rev-list --count HEAD..@{upstream} 2>/dev/null)" local commits="$(__git_prompt_git rev-list --count HEAD..@{upstream} 2>/dev/null)"
if [[ -n "$commits" && "$commits" != 0 ]]; then if [[ -n "$commits" && "$commits" != 0 ]]; then
echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX" echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX"
fi fi
@@ -103,21 +114,21 @@ function git_commits_behind() {
# Outputs if current branch is ahead of remote # Outputs if current branch is ahead of remote
function git_prompt_ahead() { function git_prompt_ahead() {
if [[ -n "$(command git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then if [[ -n "$(__git_prompt_git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then
echo "$ZSH_THEME_GIT_PROMPT_AHEAD" echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
fi fi
} }
# Outputs if current branch is behind remote # Outputs if current branch is behind remote
function git_prompt_behind() { function git_prompt_behind() {
if [[ -n "$(command git rev-list HEAD..origin/$(git_current_branch) 2> /dev/null)" ]]; then if [[ -n "$(__git_prompt_git rev-list HEAD..origin/$(git_current_branch) 2> /dev/null)" ]]; then
echo "$ZSH_THEME_GIT_PROMPT_BEHIND" echo "$ZSH_THEME_GIT_PROMPT_BEHIND"
fi fi
} }
# Outputs if current branch exists on remote or not # Outputs if current branch exists on remote or not
function git_prompt_remote() { function git_prompt_remote() {
if [[ -n "$(command git show-ref origin/$(git_current_branch) 2> /dev/null)" ]]; then if [[ -n "$(__git_prompt_git show-ref origin/$(git_current_branch) 2> /dev/null)" ]]; then
echo "$ZSH_THEME_GIT_PROMPT_REMOTE_EXISTS" echo "$ZSH_THEME_GIT_PROMPT_REMOTE_EXISTS"
else else
echo "$ZSH_THEME_GIT_PROMPT_REMOTE_MISSING" echo "$ZSH_THEME_GIT_PROMPT_REMOTE_MISSING"
@@ -127,84 +138,130 @@ function git_prompt_remote() {
# Formats prompt string for current git commit short SHA # Formats prompt string for current git commit short SHA
function git_prompt_short_sha() { function git_prompt_short_sha() {
local SHA local SHA
SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" SHA=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
} }
# Formats prompt string for current git commit long SHA # Formats prompt string for current git commit long SHA
function git_prompt_long_sha() { function git_prompt_long_sha() {
local SHA local SHA
SHA=$(command git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" SHA=$(__git_prompt_git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
} }
# Get the status of the working tree
function git_prompt_status() { function git_prompt_status() {
local INDEX STATUS [[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]] && return
INDEX=$(command git status --porcelain -b 2> /dev/null)
STATUS="" # Maps a git status prefix to an internal constant
if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then # This cannot use the prompt constants, as they may be empty
STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" local -A prefix_constant_map
prefix_constant_map=(
'\?\? ' 'UNTRACKED'
'A ' 'ADDED'
'M ' 'ADDED'
'MM ' 'ADDED'
' M ' 'MODIFIED'
'AM ' 'MODIFIED'
' T ' 'MODIFIED'
'R ' 'RENAMED'
' D ' 'DELETED'
'D ' 'DELETED'
'UU ' 'UNMERGED'
'ahead' 'AHEAD'
'behind' 'BEHIND'
'diverged' 'DIVERGED'
'stashed' 'STASHED'
)
# Maps the internal constant to the prompt theme
local -A constant_prompt_map
constant_prompt_map=(
'UNTRACKED' "$ZSH_THEME_GIT_PROMPT_UNTRACKED"
'ADDED' "$ZSH_THEME_GIT_PROMPT_ADDED"
'MODIFIED' "$ZSH_THEME_GIT_PROMPT_MODIFIED"
'RENAMED' "$ZSH_THEME_GIT_PROMPT_RENAMED"
'DELETED' "$ZSH_THEME_GIT_PROMPT_DELETED"
'UNMERGED' "$ZSH_THEME_GIT_PROMPT_UNMERGED"
'AHEAD' "$ZSH_THEME_GIT_PROMPT_AHEAD"
'BEHIND' "$ZSH_THEME_GIT_PROMPT_BEHIND"
'DIVERGED' "$ZSH_THEME_GIT_PROMPT_DIVERGED"
'STASHED' "$ZSH_THEME_GIT_PROMPT_STASHED"
)
# The order that the prompt displays should be added to the prompt
local status_constants
status_constants=(
UNTRACKED ADDED MODIFIED RENAMED DELETED
STASHED UNMERGED AHEAD BEHIND DIVERGED
)
local status_text="$(__git_prompt_git status --porcelain -b 2> /dev/null)"
# Don't continue on a catastrophic failure
if [[ $? -eq 128 ]]; then
return 1
fi fi
if $(echo "$INDEX" | grep '^A ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" # A lookup table of each git status encountered
elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then local -A statuses_seen
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
elif $(echo "$INDEX" | grep '^MM ' &> /dev/null); then if __git_prompt_git rev-parse --verify refs/stash &>/dev/null; then
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" statuses_seen[STASHED]=1
fi fi
if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" local status_lines
elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then status_lines=("${(@f)${status_text}}")
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
elif $(echo "$INDEX" | grep '^MM ' &> /dev/null); then # If the tracking line exists, get and parse it
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" if [[ "$status_lines[1]" =~ "^## [^ ]+ \[(.*)\]" ]]; then
elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then local branch_statuses
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" branch_statuses=("${(@s/,/)match}")
for branch_status in $branch_statuses; do
if [[ ! $branch_status =~ "(behind|diverged|ahead) ([0-9]+)?" ]]; then
continue
fi fi
if $(echo "$INDEX" | grep '^R ' &> /dev/null); then local last_parsed_status=$prefix_constant_map[$match[1]]
STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" statuses_seen[$last_parsed_status]=$match[2]
done
fi fi
if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" # For each status prefix, do a regex comparison
elif $(echo "$INDEX" | grep '^D ' &> /dev/null); then for status_prefix in ${(k)prefix_constant_map}; do
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" local status_constant="${prefix_constant_map[$status_prefix]}"
elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then local status_regex=$'(^|\n)'"$status_prefix"
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
if [[ "$status_text" =~ $status_regex ]]; then
statuses_seen[$status_constant]=1
fi fi
if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then done
STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS"
# Display the seen statuses in the order specified
local status_prompt
for status_constant in $status_constants; do
if (( ${+statuses_seen[$status_constant]} )); then
local next_display=$constant_prompt_map[$status_constant]
status_prompt="$next_display$status_prompt"
fi fi
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then done
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
fi echo $status_prompt
if $(echo "$INDEX" | grep '^## [^ ]\+ .*ahead' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS"
fi
if $(echo "$INDEX" | grep '^## [^ ]\+ .*behind' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS"
fi
if $(echo "$INDEX" | grep '^## [^ ]\+ .*diverged' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS"
fi
echo $STATUS
} }
# Outputs the name of the current user # Outputs the name of the current user
# Usage example: $(git_current_user_name) # Usage example: $(git_current_user_name)
function git_current_user_name() { function git_current_user_name() {
command git config user.name 2>/dev/null __git_prompt_git config user.name 2>/dev/null
} }
# Outputs the email of the current user # Outputs the email of the current user
# Usage example: $(git_current_user_email) # Usage example: $(git_current_user_email)
function git_current_user_email() { function git_current_user_email() {
command git config user.email 2>/dev/null __git_prompt_git config user.email 2>/dev/null
} }
# Output the name of the root directory of the git repository # Output the name of the root directory of the git repository
# Usage example: $(git_repo_name) # Usage example: $(git_repo_name)
function git_repo_name() { function git_repo_name() {
local repo_path local repo_path
if repo_path="$(git rev-parse --show-toplevel 2>/dev/null)" && [[ -n "$repo_path" ]]; then if repo_path="$(__git_prompt_git rev-parse --show-toplevel 2>/dev/null)" && [[ -n "$repo_path" ]]; then
echo ${repo_path:t} echo ${repo_path:t}
fi fi
} }
+2 -4
View File
@@ -27,8 +27,8 @@ esac
## History file configuration ## History file configuration
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history" [ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
HISTSIZE=50000 [ "$HISTSIZE" -lt 50000 ] && HISTSIZE=50000
SAVEHIST=10000 [ "$SAVEHIST" -lt 10000 ] && SAVEHIST=10000
## History command configuration ## History command configuration
setopt extended_history # record timestamp of command in HISTFILE setopt extended_history # record timestamp of command in HISTFILE
@@ -36,5 +36,3 @@ setopt hist_expire_dups_first # delete duplicates first when HISTFILE size excee
setopt hist_ignore_dups # ignore duplicated commands history list setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it setopt hist_verify # show command with history expansion to user before running it
setopt inc_append_history # add commands to HISTFILE in order of execution
setopt share_history # share command history data
+89 -44
View File
@@ -15,55 +15,100 @@ if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
zle -N zle-line-finish zle -N zle-line-finish
fi fi
bindkey -e # Use emacs key bindings # Use emacs key bindings
bindkey -e
# [PageUp] - Up a line of history
if [[ -n "${terminfo[kpp]}" ]]; then
bindkey -M emacs "${terminfo[kpp]}" up-line-or-history
bindkey -M viins "${terminfo[kpp]}" up-line-or-history
bindkey -M vicmd "${terminfo[kpp]}" up-line-or-history
fi
# [PageDown] - Down a line of history
if [[ -n "${terminfo[knp]}" ]]; then
bindkey -M emacs "${terminfo[knp]}" down-line-or-history
bindkey -M viins "${terminfo[knp]}" down-line-or-history
bindkey -M vicmd "${terminfo[knp]}" down-line-or-history
fi
# Start typing + [Up-Arrow] - fuzzy find history forward
if [[ -n "${terminfo[kcuu1]}" ]]; then
autoload -U up-line-or-beginning-search
zle -N up-line-or-beginning-search
bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search
bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search
bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search
fi
# Start typing + [Down-Arrow] - fuzzy find history backward
if [[ -n "${terminfo[kcud1]}" ]]; then
autoload -U down-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search
bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search
bindkey -M vicmd "${terminfo[kcud1]}" down-line-or-beginning-search
fi
# [Home] - Go to beginning of line
if [[ -n "${terminfo[khome]}" ]]; then
bindkey -M emacs "${terminfo[khome]}" beginning-of-line
bindkey -M viins "${terminfo[khome]}" beginning-of-line
bindkey -M vicmd "${terminfo[khome]}" beginning-of-line
fi
# [End] - Go to end of line
if [[ -n "${terminfo[kend]}" ]]; then
bindkey -M emacs "${terminfo[kend]}" end-of-line
bindkey -M viins "${terminfo[kend]}" end-of-line
bindkey -M vicmd "${terminfo[kend]}" end-of-line
fi
# [Shift-Tab] - move through the completion menu backwards
if [[ -n "${terminfo[kcbt]}" ]]; then
bindkey -M emacs "${terminfo[kcbt]}" reverse-menu-complete
bindkey -M viins "${terminfo[kcbt]}" reverse-menu-complete
bindkey -M vicmd "${terminfo[kcbt]}" reverse-menu-complete
fi
# [Backspace] - delete backward
bindkey -M emacs '^?' backward-delete-char
bindkey -M viins '^?' backward-delete-char
bindkey -M vicmd '^?' backward-delete-char
# [Delete] - delete forward
if [[ -n "${terminfo[kdch1]}" ]]; then
bindkey -M emacs "${terminfo[kdch1]}" delete-char
bindkey -M viins "${terminfo[kdch1]}" delete-char
bindkey -M vicmd "${terminfo[kdch1]}" delete-char
else
bindkey -M emacs "^[[3~" delete-char
bindkey -M viins "^[[3~" delete-char
bindkey -M vicmd "^[[3~" delete-char
bindkey -M emacs "^[3;5~" delete-char
bindkey -M viins "^[3;5~" delete-char
bindkey -M vicmd "^[3;5~" delete-char
fi
# [Ctrl-Delete] - delete whole forward-word
bindkey -M emacs '^[[3;5~' kill-word
bindkey -M viins '^[[3;5~' kill-word
bindkey -M vicmd '^[[3;5~' kill-word
# [Ctrl-RightArrow] - move forward one word
bindkey -M emacs '^[[1;5C' forward-word
bindkey -M viins '^[[1;5C' forward-word
bindkey -M vicmd '^[[1;5C' forward-word
# [Ctrl-LeftArrow] - move backward one word
bindkey -M emacs '^[[1;5D' backward-word
bindkey -M viins '^[[1;5D' backward-word
bindkey -M vicmd '^[[1;5D' backward-word
bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark
bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls
bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line. bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line.
if [[ "${terminfo[kpp]}" != "" ]]; then bindkey ' ' magic-space # [Space] - don't do history expansion
bindkey "${terminfo[kpp]}" up-line-or-history # [PageUp] - Up a line of history
fi
if [[ "${terminfo[knp]}" != "" ]]; then
bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history
fi
# start typing + [Up-Arrow] - fuzzy find history forward
if [[ "${terminfo[kcuu1]}" != "" ]]; then
autoload -U up-line-or-beginning-search
zle -N up-line-or-beginning-search
bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search
fi
# start typing + [Down-Arrow] - fuzzy find history backward
if [[ "${terminfo[kcud1]}" != "" ]]; then
autoload -U down-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey "${terminfo[kcud1]}" down-line-or-beginning-search
fi
if [[ "${terminfo[khome]}" != "" ]]; then
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
fi
if [[ "${terminfo[kend]}" != "" ]]; then
bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
fi
bindkey ' ' magic-space # [Space] - do history expansion
bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word
bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word
if [[ "${terminfo[kcbt]}" != "" ]]; then
bindkey "${terminfo[kcbt]}" reverse-menu-complete # [Shift-Tab] - move through the completion menu backwards
fi
bindkey '^?' backward-delete-char # [Backspace] - delete backward
if [[ "${terminfo[kdch1]}" != "" ]]; then
bindkey "${terminfo[kdch1]}" delete-char # [Delete] - delete forward
else
bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char
bindkey "\e[3~" delete-char
fi
# Edit the current command line in $EDITOR # Edit the current command line in $EDITOR
autoload -U edit-command-line autoload -U edit-command-line
+3 -6
View File
@@ -1,9 +1,6 @@
# get the node.js version # get the nvm-controlled node.js version
function nvm_prompt_info() { function nvm_prompt_info() {
[[ -f "$NVM_DIR/nvm.sh" ]] || return which nvm &>/dev/null || return
local nvm_prompt local nvm_prompt=${$(nvm current)#v}
nvm_prompt=$(node -v 2>/dev/null)
[[ "${nvm_prompt}x" == "x" ]] && return
nvm_prompt=${nvm_prompt:1}
echo "${ZSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt}${ZSH_THEME_NVM_PROMPT_SUFFIX}" echo "${ZSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt}${ZSH_THEME_NVM_PROMPT_SUFFIX}"
} }
@@ -17,17 +17,17 @@ function title {
: ${2=$1} : ${2=$1}
case "$TERM" in case "$TERM" in
cygwin|xterm*|putty*|rxvt*|konsole*|ansi) cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty|st*)
print -Pn "\e]2;$2:q\a" # set window name print -Pn "\e]2;${2:q}\a" # set window name
print -Pn "\e]1;$1:q\a" # set tab name print -Pn "\e]1;${1:q}\a" # set tab name
;; ;;
screen*|tmux*) screen*|tmux*)
print -Pn "\ek$1:q\e\\" # set screen hardstatus print -Pn "\ek${1:q}\e\\" # set screen hardstatus
;; ;;
*) *)
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
print -Pn "\e]2;$2:q\a" # set window name print -Pn "\e]2;${2:q}\a" # set window name
print -Pn "\e]1;$1:q\a" # set tab name print -Pn "\e]1;${1:q}\a" # set tab name
else else
# Try to use terminfo to set the title # Try to use terminfo to set the title
# If the feature is available set title # If the feature is available set title
@@ -50,13 +50,13 @@ fi
# Runs before showing the prompt # Runs before showing the prompt
function omz_termsupport_precmd { function omz_termsupport_precmd {
[[ "$DISABLE_AUTO_TITLE" == true ]] && return [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
} }
# Runs before executing the command # Runs before executing the command
function omz_termsupport_preexec { function omz_termsupport_preexec {
[[ "$DISABLE_AUTO_TITLE" == true ]] && return [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
emulate -L zsh emulate -L zsh
setopt extended_glob setopt extended_glob
@@ -39,6 +39,11 @@ if [[ "$DISABLE_LS_COLORS" != "true" ]]; then
fi fi
fi fi
# enable diff color if possible.
if command diff --color . . &>/dev/null; then
alias diff='diff --color'
fi
setopt auto_cd setopt auto_cd
setopt multios setopt multios
setopt prompt_subst setopt prompt_subst
@@ -208,12 +208,12 @@ function pacmansignkeys() {
if (( $+commands[xdg-open] )); then if (( $+commands[xdg-open] )); then
function pacweb() { function pacweb() {
pkg="$1" pkg="$1"
infos="$(pacman -Si "$pkg")" infos="$(LANG=C pacman -Si "$pkg")"
if [[ -z "$infos" ]]; then if [[ -z "$infos" ]]; then
return return
fi fi
repo="$(grep '^Repo' <<< "$infos" | grep -oP '[^ ]+$')" repo="$(grep -m 1 '^Repo' <<< "$infos" | grep -oP '[^ ]+$')"
arch="$(grep '^Arch' <<< "$infos" | grep -oP '[^ ]+$')" arch="$(grep -m 1 '^Arch' <<< "$infos" | grep -oP '[^ ]+$')"
xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null
} }
fi fi
@@ -3,7 +3,7 @@ ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
ASDF_COMPLETIONS="$ASDF_DIR/completions" ASDF_COMPLETIONS="$ASDF_DIR/completions"
# If not found, check for Homebrew package # If not found, check for Homebrew package
if [[ ! -f "$ASDF_DIR/asdf.sh" ]] && (( $+commands[brew] )); then if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && (( $+commands[brew] )); then
ASDF_DIR="$(brew --prefix asdf)" ASDF_DIR="$(brew --prefix asdf)"
ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d" ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d"
fi fi
@@ -8,4 +8,4 @@ To use it, add `autojump` to the plugins array in your zshrc file:
plugins=(... autojump) plugins=(... autojump)
``` ```
More info on the usage: https://github.com/wting/autojump **Note:** you have to [install autojump](https://github.com/wting/autojump#installation) first.
@@ -29,6 +29,6 @@ if (( ! found && $+commands[brew] )); then
fi fi
fi fi
(( ! found )) && echo '[oh-my-zsh] autojump script not found' (( ! found )) && echo '[oh-my-zsh] autojump not found. Please install it first.'
unset autojump_paths file found unset autojump_paths file found
@@ -31,17 +31,17 @@ function aws_change_access_key() {
echo Insert the credentials when asked. echo Insert the credentials when asked.
asp "$1" || return 1 asp "$1" || return 1
aws iam create-access-key AWS_PAGER="" aws iam create-access-key
aws configure --profile "$1" AWS_PAGER="" aws configure --profile "$1"
echo You can now safely delete the old access key running \`aws iam delete-access-key --access-key-id ID\` echo You can now safely delete the old access key running \`aws iam delete-access-key --access-key-id ID\`
echo Your current keys are: echo Your current keys are:
aws iam list-access-keys AWS_PAGER="" aws iam list-access-keys
} }
function aws_profiles() { function aws_profiles() {
[[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1 [[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1
grep '\[profile' "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/' grep '\[profile' "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9@_\.-]*\).*/\1/'
} }
function _aws_profiles() { function _aws_profiles() {
@@ -63,7 +63,7 @@ fi
# Load awscli completions # Load awscli completions
# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back # AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back
if [[ -x /usr/local/bin/aws_completer ]]; then if command -v aws_completer &> /dev/null; then
autoload -Uz bashcompinit && bashcompinit autoload -Uz bashcompinit && bashcompinit
complete -C aws_completer aws complete -C aws_completer aws
else else
@@ -9,5 +9,14 @@ To use, add `battery` to the list of plugins in your `.zshrc` file:
Then, add the `battery_pct_prompt` function to your custom theme. For example: Then, add the `battery_pct_prompt` function to your custom theme. For example:
``` ```
RPROMPT='$(battery_pct_prompt)' RPROMPT='$(battery_pct_prompt) ...'
```
## Requirements
On Linux, you must have the `acpi` tool installed on your operating system.
Here's an example of how to install with apt:
```
sudo apt-get install acpi
``` ```
@@ -53,7 +53,7 @@ bgnotify () { ## args: (title, subtitle)
bgnotify_begin() { bgnotify_begin() {
bgnotify_timestamp=$EPOCHSECONDS bgnotify_timestamp=$EPOCHSECONDS
bgnotify_lastcmd="$1" bgnotify_lastcmd="${1:-$2}"
bgnotify_windowid=$(currentWindowId) bgnotify_windowid=$(currentWindowId)
} }
@@ -3,19 +3,28 @@
The plugin adds several aliases for common [brew](https://brew.sh) commands. The plugin adds several aliases for common [brew](https://brew.sh) commands.
To use it, add `brew` to the plugins array of your zshrc file: To use it, add `brew` to the plugins array of your zshrc file:
```
```zsh
plugins=(... brew) plugins=(... brew)
``` ```
## Aliases ## Aliases
| Alias | Command | Description | | Alias | Command | Description |
|--------|----------------------|---------------| |----------|------------------------------------------------------------- |---------------------------------------------------------------------|
| brewp | `brew pin` | Pin a specified formulae, preventing them from being upgraded when issuing the brew upgrade <formulae> command. | | `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. |
| brews | `brew list -1` | List installed formulae, one entry per line, or the installed files for a given formulae. | | `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. |
| brewsp | `brew list --pinned` | Show the versions of pinned formulae, or only the specified (pinned) formulae if formulae are given. | | `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. |
| bubo | `brew update && brew outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated formulae. | | `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. |
| bubc | `brew upgrade && brew cleanup` | Upgrade outdated, unpinned brews (with existing install options), then removes stale lock files and outdated downloads for formulae and casks, and removes old versions of installed formulae. | | `bubc` | `brew upgrade && brew cleanup` | Upgrade outdated formulae and casks, then run cleanup. |
| bubu | `bubo && bubc` | Updates Homebrew, lists outdated formulae, upgrades oudated and unpinned formulae, and removes stale and outdated downloads and versions. | | `bubu` | `bubo && bubc` | Do the last two operations above. |
| bcubo | `brew update && brew cask outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated casks. | | `buf` | `brew upgrade --formula` | Upgrade only formulas (not casks). |
| bcubc | `brew cask reinstall $(brew cask outdated) && brew cleanup` | Updates outdated casks, then runs cleanup. | | `bcubo` | `brew update && brew outdated --cask` | Update Homebrew data, then list outdated casks. |
| `bcubc` | `brew cask reinstall $(brew outdated --cask) && brew cleanup` | Update outdated casks, then run cleanup. |
## Completion
With the release of Homebrew 1.0, they decided to bundle the zsh completion as part of the
brew installation, so we no longer ship it with the brew plugin; now it only has brew
aliases. If you find that brew completion no longer works, make sure you have your Homebrew
installation fully up to date.
@@ -4,21 +4,6 @@ alias brewsp='brew list --pinned'
alias bubo='brew update && brew outdated' alias bubo='brew update && brew outdated'
alias bubc='brew upgrade && brew cleanup' alias bubc='brew upgrade && brew cleanup'
alias bubu='bubo && bubc' alias bubu='bubo && bubc'
alias bcubo='brew update && brew cask outdated' alias buf='brew upgrade --formula'
alias bcubc='brew cask reinstall $(brew cask outdated) && brew cleanup' alias bcubo='brew update && brew outdated --cask'
alias bcubc='brew cask reinstall $(brew outdated --cask) && brew cleanup'
if command mkdir "$ZSH_CACHE_DIR/.brew-completion-message" 2>/dev/null; then
print -P '%F{yellow}'Oh My Zsh brew plugin:
cat <<-'EOF'
With the advent of their 1.0 release, Homebrew has decided to bundle
the zsh completion as part of the brew installation, so we no longer
ship it with the brew plugin; now it only has brew aliases.
If you find that brew completion no longer works, make sure you have
your Homebrew installation fully up to date.
You will only see this message once.
EOF
print -P '%f'
fi
@@ -1,52 +1,74 @@
# Bundler # Bundler
- adds completion for basic bundler commands This plugin adds completion for basic bundler commands, as well as aliases and helper functions for
- adds short aliases for common bundler commands an easier experience with bundler.
- `be` aliased to `bundle exec`.
It also supports aliases (if `rs` is `rails server`, `be rs` will bundle-exec `rails server`). To use it, add `bundler` to the plugins array in your zshrc file:
- `bl` aliased to `bundle list`
- `bp` aliased to `bundle package` ```zsh
- `bo` aliased to `bundle open` plugins=(... bundler)
- `bout` aliased to `bundle outdated` ```
- `bu` aliased to `bundle update`
- `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`) ## Aliases
- adds a wrapper for common gems:
- looks for a binstub under `./bin/` and executes it (if present) | Alias | Command | Description |
- calls `bundle exec <gem executable>` otherwise |--------|--------------------------------------|------------------------------------------------------------------------------------------|
| `ba` | `bundle add` | Add gem to the Gemfile and run bundle install |
| `bck` | `bundle check` | Verifies if dependencies are satisfied by installed gems |
| `bcn` | `bundle clean` | Cleans up unused gems in your bundler directory |
| `be` | `bundle exec` | Execute a command in the context of the bundle |
| `bi` | `bundle install --jobs=<core_count>` | Install the dependencies specified in your Gemfile (using all cores in bundler >= 1.4.0) |
| `bl` | `bundle list` | List all the gems in the bundle |
| `bo` | `bundle open` | Opens the source directory for a gem in your bundle |
| `bout` | `bundle outdated` | List installed gems with newer versions available |
| `bp` | `bundle package` | Package your needed .gem files into your application |
| `bu` | `bundle update` | Update your gems to the latest available versions |
## Gem wrapper
The plugin adds a wrapper for common gems, which:
- Looks for a binstub under `./bin/` and executes it if present.
- Calls `bundle exec <gem>` otherwise.
Common gems wrapped by default (by name of the executable): Common gems wrapped by default (by name of the executable):
`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `rubocop`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`. `annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `rubocop`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`.
## Configuration ### Settings
Please use the exact name of the executable and not the gem name. You can add or remove gems from the list of wrapped commands.
Please **use the exact name of the executable** and not the gem name.
### Add additional gems to be wrapped #### Include gems to be wrapped (`BUNDLED_COMMANDS`)
Add this before the plugin list in your `.zshrc`:
Add this before the plugin-list in your `.zshrc`:
```sh ```sh
BUNDLED_COMMANDS=(rubocop) BUNDLED_COMMANDS=(rubocop)
plugins=(... bundler ...) plugins=(... bundler ...)
``` ```
This will add the wrapper for the `rubocop` gem (i.e. the executable). This will add the wrapper for the `rubocop` gem (i.e. the executable).
#### Exclude gems from being wrapped (`UNBUNDLED_COMMANDS`)
### Exclude gems from being wrapped Add this before the plugin list in your `.zshrc`:
Add this before the plugin-list in your `.zshrc`:
```sh ```sh
UNBUNDLED_COMMANDS=(foreman spin) UNBUNDLED_COMMANDS=(foreman spin)
plugins=(... bundler ...) plugins=(... bundler ...)
``` ```
This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped. This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped.
## Excluded gems ### Excluded gems
These gems should not be called with `bundle exec`. Please see [issue #2923](https://github.com/ohmyzsh/ohmyzsh/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`
`mailcatcher` - `mailcatcher`
`rails` - `rails`
`ruby` - `ruby`
`spin` - `spin`
@@ -1,11 +1,49 @@
## Aliases
alias ba="bundle add"
alias bck="bundle check"
alias bcn="bundle clean"
alias be="bundle exec" alias be="bundle exec"
alias bi="bundle_install"
alias bl="bundle list" alias bl="bundle list"
alias bp="bundle package"
alias bo="bundle open" alias bo="bundle open"
alias bout="bundle outdated" alias bout="bundle outdated"
alias bp="bundle package"
alias bu="bundle update" alias bu="bundle update"
alias bi="bundle_install"
alias bcn="bundle clean" ## Functions
bundle_install() {
# Bail out if bundler is not installed
if (( ! $+commands[bundle] )); then
echo "Bundler is not installed"
return 1
fi
# Bail out if not in a bundled project
if ! _within-bundled-project; then
echo "Can't 'bundle install' outside a bundled project"
return 1
fi
# Check the bundler version is at least 1.4.0
autoload -Uz is-at-least
local bundler_version=$(bundle version | cut -d' ' -f3)
if ! is-at-least 1.4.0 "$bundler_version"; then
bundle install "$@"
return $?
fi
# If bundler is at least 1.4.0, use all the CPU cores to bundle install
if [[ "$OSTYPE" = (darwin|freebsd)* ]]; then
local cores_num="$(sysctl -n hw.ncpu)"
else
local cores_num="$(nproc)"
fi
bundle install --jobs="$cores_num" "$@"
}
## Gem wrapper
bundled_commands=( bundled_commands=(
annotate annotate
@@ -52,65 +90,41 @@ for cmd in $BUNDLED_COMMANDS; do
bundled_commands+=($cmd); bundled_commands+=($cmd);
done done
## Functions # Check if in the root or a subdirectory of a bundled project
bundle_install() {
if ! _bundler-installed; then
echo "Bundler is not installed"
elif ! _within-bundled-project; then
echo "Can't 'bundle install' outside a bundled project"
else
local bundler_version=`bundle version | cut -d' ' -f3`
if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
if [[ "$OSTYPE" = (darwin|freebsd)* ]]
then
local cores_num="$(sysctl -n hw.ncpu)"
else
local cores_num="$(nproc)"
fi
bundle install --jobs=$cores_num $@
else
bundle install $@
fi
fi
}
_bundler-installed() {
which bundle > /dev/null 2>&1
}
_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" -o -f "$check_dir/gems.rb" ] && return if [[ -f "$check_dir/Gemfile" || -f "$check_dir/gems.rb" ]]; then
check_dir="$(dirname $check_dir)" return 0
fi
check_dir="${check_dir:h}"
done done
false return 1
}
_binstubbed() {
[ -f "./bin/${1}" ]
} }
_run-with-bundler() { _run-with-bundler() {
if _bundler-installed && _within-bundled-project; then if (( ! $+commands[bundle] )) || ! _within-bundled-project; then
if _binstubbed $1; then "$@"
return $?
fi
if [[ -f "./bin/${1}" ]]; then
./bin/${^^@} ./bin/${^^@}
else else
bundle exec $@ bundle exec "$@"
fi
else
$@
fi fi
} }
## Main program
for cmd in $bundled_commands; do for cmd in $bundled_commands; do
eval "function unbundled_$cmd () { $cmd \$@ }" # Create wrappers for bundled and unbundled execution
eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" eval "function unbundled_$cmd () { \"$cmd\" \"\$@\"; }"
alias $cmd=bundled_$cmd eval "function bundled_$cmd () { _run-with-bundler \"$cmd\" \"\$@\"; }"
alias "$cmd"="bundled_$cmd"
if which _$cmd > /dev/null 2>&1; then # Bind completion function to wrapped gem if available
compdef _$cmd bundled_$cmd=$cmd if (( $+functions[_$cmd] )); then
compdef "_$cmd" "bundled_$cmd"="$cmd"
fi fi
done done
unset cmd bundled_commands
@@ -12,8 +12,8 @@ _cargo() {
'(-q --quiet)*'{-v,--verbose}'[use verbose output]' '(-q --quiet)*'{-v,--verbose}'[use verbose output]'
'(-q --quiet -v --verbose)'{-q,--quiet}'[no output printed to stdout]' '(-q --quiet -v --verbose)'{-q,--quiet}'[no output printed to stdout]'
'-Z+[pass unstable (nightly-only) flags to cargo]: :_cargo_unstable_flags' '-Z+[pass unstable (nightly-only) flags to cargo]: :_cargo_unstable_flags'
'--frozen[require that Cargo.lock and cache are up-to-date]' '--frozen[require that Cargo.lock and cache are up to date]'
'--locked[require that Cargo.lock is up-to-date]' '--locked[require that Cargo.lock is up to date]'
'--color=[specify colorization option]:coloring:(auto always never)' '--color=[specify colorization option]:coloring:(auto always never)'
'(- 1 *)'{-h,--help}'[show help message]' '(- 1 *)'{-h,--help}'[show help message]'
) )
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,7 @@
# CloudApp plugin # CloudApp plugin
## The CloudApp API is deprecated, so the plugin will be removed shortly
[CloudApp](https://www.getcloudapp.com) brings screen recording, screenshots, and GIF creation to the cloud, in an easy-to-use enterprise-level app. The CloudApp plugin allows you to upload a file to your CloadApp account from the command line. [CloudApp](https://www.getcloudapp.com) brings screen recording, screenshots, and GIF creation to the cloud, in an easy-to-use enterprise-level app. The CloudApp plugin allows you to upload a file to your CloadApp account from the command line.
To use it, add `cloudapp` to the plugins array of your `~/.zshrc` file: To use it, add `cloudapp` to the plugins array of your `~/.zshrc` file:
@@ -1,6 +1,4 @@
alias cloudapp="${0:a:h}/cloudapp.rb" print -Pn "%F{yellow}"
print "[oh-my-zsh] The CloudApp API no longer works, so the cloudapp plugin will"
# Ensure only the owner can access the credentials file print "[oh-my-zsh] be removed shortly. Please remove it from your plugins list."
if [[ -f ~/.cloudapp ]]; then print -Pn "%f"
chmod 600 ~/.cloudapp
fi
@@ -1,60 +0,0 @@
#!/usr/bin/env ruby
#
# cloudapp
# Zach Holman / @holman
#
# Uploads a file from the command line to CloudApp, drops it into your
# clipboard (on a Mac, at least).
#
# Example:
#
# cloudapp drunk-blake.png
#
# This requires Aaron Russell's cloudapp_api gem:
#
# gem install cloudapp_api
#
# Requires you set your CloudApp credentials in ~/.cloudapp as a simple file of:
#
# email
# password
require 'rubygems'
begin
require 'cloudapp_api'
rescue LoadError
puts "You need to install cloudapp_api: gem install cloudapp_api"
exit!(1)
end
config_file = "#{ENV['HOME']}/.cloudapp"
unless File.exist?(config_file)
puts "You need to type your email and password (one per line) into "+
"`~/.cloudapp`"
exit!(1)
end
email,password = File.read(config_file).split("\n")
class HTTParty::Response
# Apparently HTTPOK.ok? IS NOT OKAY WTFFFFFFFFFFUUUUUUUUUUUUUU
# LETS MONKEY PATCH IT I FEEL OKAY ABOUT IT
def ok? ; true end
end
if ARGV[0].nil?
puts "You need to specify a file to upload."
exit!(1)
end
CloudApp.authenticate(email,password)
url = CloudApp::Item.create(:upload, {:file => ARGV[0]}).url
# Say it for good measure.
puts "Uploaded to #{url}."
# Get the embed link.
url = "#{url}/#{ARGV[0].split('/').last}"
# Copy it to your (Mac's) clipboard.
`echo '#{url}' | tr -d "\n" | pbcopy`
@@ -38,6 +38,14 @@ Pygments offers multiple styles. By default, the `default` style is used, but yo
ZSH_COLORIZE_STYLE="colorful" ZSH_COLORIZE_STYLE="colorful"
``` ```
### Chroma Formatter Settings
Chroma supports terminal output in 8 color, 256 color, and true-color. If you need to change the default terminal output style from the standard 8 color output, set the `ZSH_COLORIZE_CHROMA_FORMATTER` environment variable:
```
ZSH_COLORIZE_CHROMA_FORMATTER=terminal256
```
## Usage ## 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).
@@ -46,7 +46,7 @@ colorize_cat() {
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
else else
chroma --style="$ZSH_COLORIZE_STYLE" chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}"
fi fi
return $? return $?
fi fi
@@ -62,7 +62,7 @@ colorize_cat() {
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME" pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
fi fi
else else
chroma --style="$ZSH_COLORIZE_STYLE" "$FNAME" chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}" "$FNAME"
fi fi
done done
} }
@@ -13,7 +13,7 @@ alias lS='ls -1FSsh'
alias lart='ls -1Fcart' alias lart='ls -1Fcart'
alias lrt='ls -1Fcrt' alias lrt='ls -1Fcrt'
alias zshrc='${=EDITOR} ~/.zshrc' # Quick access to the ~/.zshrc file alias zshrc='${=EDITOR} ${ZDOTDIR:-$HOME}/.zshrc' # Quick access to the .zshrc file
alias grep='grep --color' alias grep='grep --color'
alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} ' alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
@@ -55,15 +55,15 @@ if is-at-least 4.2.0; then
# open browser on urls # open browser on urls
if [[ -n "$BROWSER" ]]; then if [[ -n "$BROWSER" ]]; then
_browser_fts=(htm html de org net com at cx nl se dk) _browser_fts=(htm html de org net com at cx nl se dk)
for ft in $_browser_fts; do alias -s $ft=$BROWSER; done for ft in $_browser_fts; do alias -s $ft='$BROWSER'; done
fi fi
_editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex) _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex)
for ft in $_editor_fts; do alias -s $ft=$EDITOR; done for ft in $_editor_fts; do alias -s $ft='$EDITOR'; done
if [[ -n "$XIVIEWER" ]]; then if [[ -n "$XIVIEWER" ]]; then
_image_fts=(jpg jpeg png gif mng tiff tif xpm) _image_fts=(jpg jpeg png gif mng tiff tif xpm)
for ft in $_image_fts; do alias -s $ft=$XIVIEWER; done for ft in $_image_fts; do alias -s $ft='$XIVIEWER'; done
fi fi
_media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm) _media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm)
@@ -13,7 +13,7 @@ plugins=(... composer)
## Aliases ## Aliases
| Alias | Command | Description | | Alias | Command | Description |
| ------ | ---------------------------------------------- | -------------------------------------------------------------------------------------- | | ------ | ------------------------------------------- | --------------------------------------------------------------------------------------- |
| `c` | `composer` | Starts composer | | `c` | `composer` | Starts composer |
| `csu` | `composer self-update` | Updates composer to the latest version | | `csu` | `composer self-update` | Updates composer to the latest version |
| `cu` | `composer update` | Updates composer dependencies and `composer.lock` file | | `cu` | `composer update` | Updates composer dependencies and `composer.lock` file |
@@ -22,8 +22,10 @@ plugins=(... composer)
| `ci` | `composer install` | Resolves and installs dependencies from `composer.json` | | `ci` | `composer install` | Resolves and installs dependencies from `composer.json` |
| `ccp` | `composer create-project` | Create new project from an existing package | | `ccp` | `composer create-project` | Create new project from an existing package |
| `cdu` | `composer dump-autoload` | Updates the autoloader | | `cdu` | `composer dump-autoload` | Updates the autoloader |
| `cdo` | `composer dump-autoload --optimize-autoloader` | Converts PSR-0/4 autoloading to classmap for a faster autoloader (good for production) | | `cdo` | `composer dump-autoload -o` | Converts PSR-0/4 autoloading to classmap for a faster autoloader (good for production) |
| `cgu` | `composer global update` | Allows update command to run on COMPOSER_HOME directory | | `cgu` | `composer global update` | Allows update command to run on COMPOSER_HOME directory |
| `cgr` | `composer global require` | Allows require command to run on COMPOSER_HOME directory | | `cgr` | `composer global require` | Allows require command to run on COMPOSER_HOME directory |
| `cgrm` | `composer global remove` | Allows remove command to run on COMPOSER_HOME directory | | `cgrm` | `composer global remove` | Allows remove command to run on COMPOSER_HOME directory |
| `cget` | `curl -s https://getcomposer.org/installer` | Installs composer in the current directory | | `cget` | `curl -s https://getcomposer.org/installer` | Installs composer in the current directory |
| `co` | `composer outdated` | Shows a list of installed packages with available updates |
| `cod` | `composer outdated --direct` | Shows a list of installed packages with available updates which are direct dependencies |
@@ -43,13 +43,27 @@ alias cdo='composer dump-autoload -o'
alias cgu='composer global update' alias cgu='composer global update'
alias cgr='composer global require' alias cgr='composer global require'
alias cgrm='composer global remove' alias cgrm='composer global remove'
alias co='composer outdated'
alias cod='composer outdated --direct'
# install composer in the current directory # install composer in the current directory
alias cget='curl -s https://getcomposer.org/installer | php' alias cget='curl -s https://getcomposer.org/installer | php'
# Add Composer's global binaries to PATH, using Composer if available. # Add Composer's global binaries to PATH, using Composer if available.
if (( $+commands[composer] )); then if (( $+commands[composer] )); then
export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null) autoload -Uz _store_cache _retrieve_cache
_retrieve_cache composer
if [[ -z $__composer_bin_dir ]]; then
__composer_bin_dir=$(composer global config bin-dir --absolute 2>/dev/null)
_store_cache composer __composer_bin_dir
fi
# Add Composer's global binaries to PATH
export PATH="$PATH:$__composer_bin_dir"
unset __composer_bin_dir
else else
[ -d $HOME/.composer/vendor/bin ] && export PATH=$PATH:$HOME/.composer/vendor/bin [ -d $HOME/.composer/vendor/bin ] && export PATH=$PATH:$HOME/.composer/vendor/bin
[ -d $HOME/.config/composer/vendor/bin ] && export PATH=$PATH:$HOME/.config/composer/vendor/bin [ -d $HOME/.config/composer/vendor/bin ] && export PATH=$PATH:$HOME/.config/composer/vendor/bin
@@ -1,3 +1,6 @@
# Don't continue if direnv is not found
command -v direnv &>/dev/null || return
_direnv_hook() { _direnv_hook() {
trap -- '' SIGINT; trap -- '' SIGINT;
eval "$(direnv export zsh)"; eval "$(direnv export zsh)";
@@ -28,3 +28,4 @@ plugins=(... docker-compose)
| dclf | `docker-compose logs -f` | Show logs and follow output | | dclf | `docker-compose logs -f` | Show logs and follow output |
| dcpull | `docker-compose pull` | Pull image of a service | | dcpull | `docker-compose pull` | Pull image of a service |
| dcstart | `docker-compose start` | Start a container | | dcstart | `docker-compose start` | Start a container |
| dck | `docker-compose kill` | Kills containers |
@@ -24,3 +24,4 @@ alias dcl='docker-compose logs'
alias dclf='docker-compose logs -f' alias dclf='docker-compose logs -f'
alias dcpull='docker-compose pull' alias dcpull='docker-compose pull'
alias dcstart='docker-compose start' alias dcstart='docker-compose start'
alias dck='docker-compose kill'
@@ -10,3 +10,25 @@ plugins=(... docker)
A copy of the completion script from the docker/cli git repo: A copy of the completion script from the docker/cli git repo:
https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker
## Settings
By default, the completion doesn't allow option-stacking, meaning if you try to
complete `docker run -it <TAB>` it won't work, because you're _stacking_ the
`-i` and `-t` options.
[You can enable it](https://github.com/docker/cli/commit/b10fb43048) by **adding
the lines below to your zshrc file**, but be aware of the side effects:
> This enables Zsh to understand commands like `docker run -it
> ubuntu`. However, by enabling this, this also makes Zsh complete
> `docker run -u<tab>` with `docker run -uapprox` which is not valid. The
> users have to put the space or the equal sign themselves before trying
> to complete.
>
> Therefore, this behavior is disabled by default. To enable it:
>
> ```
> zstyle ':completion:*:*:docker:*' option-stacking yes
> zstyle ':completion:*:*:docker-*:*' option-stacking yes
> ```
@@ -9,6 +9,7 @@
# - Felix Riedel # - Felix Riedel
# - Steve Durrheimer # - Steve Durrheimer
# - Vincent Bernat # - Vincent Bernat
# - Rohan Verma
# #
# license: # license:
# #
@@ -604,6 +605,7 @@ __docker_container_subcommand() {
"($help)*--blkio-weight-device=[Block IO (relative device weight)]:device:Block IO weight: " "($help)*--blkio-weight-device=[Block IO (relative device weight)]:device:Block IO weight: "
"($help)*--cap-add=[Add Linux capabilities]:capability: " "($help)*--cap-add=[Add Linux capabilities]:capability: "
"($help)*--cap-drop=[Drop Linux capabilities]:capability: " "($help)*--cap-drop=[Drop Linux capabilities]:capability: "
"($help)--cgroupns=[Cgroup namespace mode to use]:cgroup namespace mode: "
"($help)--cgroup-parent=[Parent cgroup for the container]:cgroup: " "($help)--cgroup-parent=[Parent cgroup for the container]:cgroup: "
"($help)--cidfile=[Write the container ID to the file]:CID file:_files" "($help)--cidfile=[Write the container ID to the file]:CID file:_files"
"($help)--cpus=[Number of CPUs (default 0.000)]:cpus: " "($help)--cpus=[Number of CPUs (default 0.000)]:cpus: "
@@ -676,6 +678,7 @@ __docker_container_subcommand() {
"($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: " "($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: "
"($help)--memory-reservation=[Memory soft limit]:Memory limit: " "($help)--memory-reservation=[Memory soft limit]:Memory limit: "
"($help)--memory-swap=[Total memory limit with swap]:Memory limit: " "($help)--memory-swap=[Total memory limit with swap]:Memory limit: "
"($help)--pids-limit[Tune container pids limit (set -1 for unlimited)]"
"($help)--restart=[Restart policy]:restart policy:(no on-failure always unless-stopped)" "($help)--restart=[Restart policy]:restart policy:(no on-failure always unless-stopped)"
) )
opts_help=("(: -)--help[Print usage]") opts_help=("(: -)--help[Print usage]")
@@ -801,7 +804,7 @@ __docker_container_subcommand() {
"($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \ "($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \
"($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \ "($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \
"($help)--no-trunc[Do not truncate output]" \ "($help)--no-trunc[Do not truncate output]" \
"($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ "($help -q --quiet)"{-q,--quiet}"[Only show container IDs]" \
"($help -s --size)"{-s,--size}"[Display total file sizes]" \ "($help -s --size)"{-s,--size}"[Display total file sizes]" \
"($help)--since=[Show only containers created since...]:containers:__docker_complete_containers" && ret=0 "($help)--since=[Show only containers created since...]:containers:__docker_complete_containers" && ret=0
;; ;;
@@ -832,7 +835,7 @@ __docker_container_subcommand() {
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
"($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \ "($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \
"($help -)*:containers:__docker_complete_containers_ids" && ret=0 "($help -)*:containers:__docker_complete_containers" && ret=0
;; ;;
(rm) (rm)
local state local state
@@ -1024,7 +1027,7 @@ __docker_image_subcommand() {
$opts_help \ $opts_help \
"($help -H --human)"{-H,--human}"[Print sizes and dates in human readable format]" \ "($help -H --human)"{-H,--human}"[Print sizes and dates in human readable format]" \
"($help)--no-trunc[Do not truncate output]" \ "($help)--no-trunc[Do not truncate output]" \
"($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ "($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \
"($help -)*: :__docker_complete_images" && ret=0 "($help -)*: :__docker_complete_images" && ret=0
;; ;;
(import) (import)
@@ -1056,7 +1059,7 @@ __docker_image_subcommand() {
"($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_images_filters" \ "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_images_filters" \
"($help)--format=[Pretty-print images using a Go template]:template: " \ "($help)--format=[Pretty-print images using a Go template]:template: " \
"($help)--no-trunc[Do not truncate output]" \ "($help)--no-trunc[Do not truncate output]" \
"($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ "($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \
"($help -): :__docker_complete_repositories" && ret=0 "($help -): :__docker_complete_repositories" && ret=0
;; ;;
(prune) (prune)
@@ -1076,6 +1079,7 @@ __docker_image_subcommand() {
(push) (push)
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
"($help -a --all-tags)"{-a,--all-tags}"[Push all tagged images in the repository]" \
"($help)--disable-content-trust[Skip image signing]" \ "($help)--disable-content-trust[Skip image signing]" \
"($help -): :__docker_complete_images" && ret=0 "($help -): :__docker_complete_images" && ret=0
;; ;;
@@ -1286,7 +1290,7 @@ __docker_network_subcommand() {
"($help)--no-trunc[Do not truncate the output]" \ "($help)--no-trunc[Do not truncate the output]" \
"($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_network_complete_ls_filters" \ "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_network_complete_ls_filters" \
"($help)--format=[Pretty-print networks using a Go template]:template: " \ "($help)--format=[Pretty-print networks using a Go template]:template: " \
"($help -q --quiet)"{-q,--quiet}"[Only display numeric IDs]" && ret=0 "($help -q --quiet)"{-q,--quiet}"[Only display network IDs]" && ret=0
;; ;;
(prune) (prune)
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
@@ -2214,7 +2218,6 @@ __docker_stack_subcommand() {
(deploy|up) (deploy|up)
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
"($help)--bundle-file=[Path to a Distributed Application Bundle file]:dab:_files -g \"*.dab\"" \
"($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file, or '-' to read from stdin]:compose file:_files -g \"*.(yml|yaml)\"" \ "($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file, or '-' to read from stdin]:compose file:_files -g \"*.(yml|yaml)\"" \
"($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \ "($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \
"($help -):stack:__docker_complete_stacks" && ret=0 "($help -):stack:__docker_complete_stacks" && ret=0
@@ -2668,6 +2671,7 @@ __docker_subcommand() {
"($help)*--log-opt=[Default log driver options for containers]:log driver options:__docker_complete_log_options" \ "($help)*--log-opt=[Default log driver options for containers]:log driver options:__docker_complete_log_options" \
"($help)--max-concurrent-downloads[Set the max concurrent downloads for each pull]" \ "($help)--max-concurrent-downloads[Set the max concurrent downloads for each pull]" \
"($help)--max-concurrent-uploads[Set the max concurrent uploads for each push]" \ "($help)--max-concurrent-uploads[Set the max concurrent uploads for each push]" \
"($help)--max-download-attempts[Set the max download attempts for each pull]" \
"($help)--mtu=[Network MTU]:mtu:(0 576 1420 1500 9000)" \ "($help)--mtu=[Network MTU]:mtu:(0 576 1420 1500 9000)" \
"($help)--oom-score-adjust=[Set the oom_score_adj for the daemon]:oom-score:(-500)" \ "($help)--oom-score-adjust=[Set the oom_score_adj for the daemon]:oom-score:(-500)" \
"($help -p --pidfile)"{-p=,--pidfile=}"[Path to use for daemon PID file]:PID file:_files" \ "($help -p --pidfile)"{-p=,--pidfile=}"[Path to use for daemon PID file]:PID file:_files" \
@@ -2783,7 +2787,7 @@ __docker_subcommand() {
$opts_help \ $opts_help \
"($help -p --password)"{-p=,--password=}"[Password]:password: " \ "($help -p --password)"{-p=,--password=}"[Password]:password: " \
"($help)--password-stdin[Read password from stdin]" \ "($help)--password-stdin[Read password from stdin]" \
"($help -u --user)"{-u=,--user=}"[Username]:username: " \ "($help -u --username)"{-u=,--username=}"[Username]:username: " \
"($help -)1:server: " && ret=0 "($help -)1:server: " && ret=0
;; ;;
(logout) (logout)
@@ -53,24 +53,30 @@ Set `ZSH_DOTENV_PROMPT=false` in your zshrc file if you don't want the confirmat
You can also choose the `Always` option when prompted to always allow sourcing the .env file You can also choose the `Always` option when prompted to always allow sourcing the .env file
in that directory. See the next section for more details. in that directory. See the next section for more details.
### ZSH_DOTENV_ALLOWED_LIST ### ZSH_DOTENV_ALLOWED_LIST, ZSH_DOTENV_DISALLOWED_LIST
The default behavior of the plugin is to always ask whether to source a dotenv file. There's The default behavior of the plugin is to always ask whether to source a dotenv file. There's
a **Y**es, **N**o, and **A**lways option. If you choose Always, the directory of the .env file a **Y**es, **N**o, **A**lways and N**e**ver option. If you choose Always, the directory of the .env file
will be added to an allowed list. If a directory is found in this list, the plugin won't ask will be added to an allowed list; if you choose Never, it will be added to a disallowed list.
for confirmation and will instead source the .env file directly. If a directory is found in either of those lists, the plugin won't ask for confirmation and will
instead either source the .env file or proceed without action respectively.
This allowed list is saved by default in `$ZSH_CACHE_DIR/dotenv-allowed.list`. If you want The allowed and disallowed lists are saved by default in `$ZSH_CACHE_DIR/dotenv-allowed.list` and
to change that location, change the `$ZSH_DOTENV_ALLOWED_LIST` variable, like so: `$ZSH_CACHE_DIR/dotenv-disallowed.list` respectively. If you want to change that location,
change the `$ZSH_DOTENV_ALLOWED_LIST` and `$ZSH_DOTENV_DISALLOWED_LIST` variables, like so:
```zsh ```zsh
# in ~/.zshrc, before Oh My Zsh is sourced: # in ~/.zshrc, before Oh My Zsh is sourced:
ZSH_DOTENV_ALLOWED_LIST=/path/to/dotenv/allowed/list ZSH_DOTENV_ALLOWED_LIST=/path/to/dotenv/allowed/list
ZSH_DOTENV_DISALLOWED_LIST=/path/to/dotenv/disallowed/list
``` ```
This file is just a list of directories allowed, separated by a newline character. If you want The file is just a list of directories, separated by a newline character. If you want
to disallow a directory, just edit this file and remove the line for the directory you want to to change your decision, just edit the file and remove the line for the directory you want to
disallow. change.
NOTE: if a directory is found in both the allowed and disallowed lists, the disallowed list
takes preference, _i.e._ the .env file will never be sourced.
## Version Control ## Version Control
@@ -5,6 +5,7 @@
# Path to the file containing allowed paths # Path to the file containing allowed paths
: ${ZSH_DOTENV_ALLOWED_LIST:="${ZSH_CACHE_DIR:-$ZSH/cache}/dotenv-allowed.list"} : ${ZSH_DOTENV_ALLOWED_LIST:="${ZSH_CACHE_DIR:-$ZSH/cache}/dotenv-allowed.list"}
: ${ZSH_DOTENV_DISALLOWED_LIST:="${ZSH_CACHE_DIR:-$ZSH/cache}/dotenv-disallowed.list"}
## Functions ## Functions
@@ -14,19 +15,26 @@ source_env() {
if [[ "$ZSH_DOTENV_PROMPT" != false ]]; then if [[ "$ZSH_DOTENV_PROMPT" != false ]]; then
local confirmation dirpath="${PWD:A}" local confirmation dirpath="${PWD:A}"
# make sure there is an allowed file # make sure there is an (dis-)allowed file
touch "$ZSH_DOTENV_ALLOWED_LIST" touch "$ZSH_DOTENV_ALLOWED_LIST"
touch "$ZSH_DOTENV_DISALLOWED_LIST"
# early return if disallowed
if grep -q "$dirpath" "$ZSH_DOTENV_DISALLOWED_LIST" &>/dev/null; then
return;
fi
# check if current directory's .env file is allowed or ask for confirmation # check if current directory's .env file is allowed or ask for confirmation
if ! grep -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then if ! grep -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then
# print same-line prompt and output newline character if necessary # print same-line prompt and output newline character if necessary
echo -n "dotenv: found '$ZSH_DOTENV_FILE' file. Source it? ([Y]es/[n]o/[a]lways) " echo -n "dotenv: found '$ZSH_DOTENV_FILE' file. Source it? ([Y]es/[n]o/[a]lways/n[e]ver) "
read -k 1 confirmation; [[ "$confirmation" != $'\n' ]] && echo read -k 1 confirmation; [[ "$confirmation" != $'\n' ]] && echo
# check input # check input
case "$confirmation" in case "$confirmation" in
[nN]) return ;; [nN]) return ;;
[aA]) echo "$dirpath" >> "$ZSH_DOTENV_ALLOWED_LIST" ;; [aA]) echo "$dirpath" >> "$ZSH_DOTENV_ALLOWED_LIST" ;;
[eE]) echo "$dirpath" >> "$ZSH_DOTENV_DISALLOWED_LIST"; return ;;
*) ;; # interpret anything else as a yes *) ;; # interpret anything else as a yes
esac esac
fi fi
@@ -26,6 +26,16 @@ if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then
# create a new X frame # create a new X frame
alias eframe='emacsclient --alternate-editor "" --create-frame' alias eframe='emacsclient --alternate-editor "" --create-frame'
# Emacs ANSI Term tracking
if [[ -n "$INSIDE_EMACS" ]]; then
chpwd_emacs() { print -P "\033AnSiTc %d"; }
print -P "\033AnSiTc %d" # Track current working directory
print -P "\033AnSiTu %n" # Track username
# add chpwd hook
autoload -Uz add-zsh-hook
add-zsh-hook chpwd chpwd_emacs
fi
# Write to standard output the path to the file # Write to standard output the path to the file
# opened in the current buffer. # opened in the current buffer.
@@ -53,6 +53,6 @@ plugins=(... encode64)
```console ```console
$ echo "b2gtbXktenNoCg==" | decode64 $ echo "b2gtbXktenNoCg==" | decode64
oh-my-zsh oh-my-zsh
$ echo "b2gtbXktenNoCg==" | decode64 $ echo "b2gtbXktenNoCg==" | d64
oh-my-zsh oh-my-zsh
``` ```
@@ -23,6 +23,7 @@ plugins=(... extract)
| `bz2` | Bzip2 file | | `bz2` | Bzip2 file |
| `deb` | Debian package | | `deb` | Debian package |
| `gz` | Gzip file | | `gz` | Gzip file |
| `ipa` | iOS app package |
| `ipsw` | iOS firmware file | | `ipsw` | iOS firmware file |
| `jar` | Java Archive | | `jar` | Java Archive |
| `lrz` | LRZ archive | | `lrz` | LRZ archive |
@@ -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|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)(-.)'" \ "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipa|ipsw|jar|lrz|lz4|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \
&& return 0 && return 0
@@ -55,7 +55,7 @@ extract() {
(*.lz4) lz4 -d "$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|*.ipa|*.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 .. ;; (*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;;
(*.7z) 7za x "$1" ;; (*.7z) 7za x "$1" ;;
@@ -5,7 +5,7 @@
# If they are not set yet, they will be # If they are not set yet, they will be
# overwritten with their default values # overwritten with their default values
default fastfile_dir "${HOME}/.fastfile/" default fastfile_dir "${HOME}/.fastfile"
default fastfile_var_prefix "§" default fastfile_var_prefix "§"
########################### ###########################
@@ -78,7 +78,7 @@ function fastfile_print() {
# (=> fastfle_print) for each shortcut # (=> fastfle_print) for each shortcut
# #
function fastfile_ls() { function fastfile_ls() {
for f in "${fastfile_dir}"/*; do for f in "${fastfile_dir}"/*(NF); do
file=`basename "$f"` # To enable simpler handeling of spaces in file names file=`basename "$f"` # To enable simpler handeling of spaces in file names
varkey=`echo "$file" | tr " " "_"` varkey=`echo "$file" | tr " " "_"`
@@ -104,7 +104,7 @@ function fastfile_rm() {
# Generate the aliases for the shortcuts # Generate the aliases for the shortcuts
# #
function fastfile_sync() { function fastfile_sync() {
for f in "${fastfile_dir}"/*; do for f in "${fastfile_dir}"/*(NF); do
file=`basename "$f"` # To enable simpler handeling of spaces in file names file=`basename "$f"` # To enable simpler handeling of spaces in file names
varkey=`echo "$file" | tr " " "_"` varkey=`echo "$file" | tr " " "_"`
@@ -1 +0,0 @@
../dnf/dnf.plugin.zsh
@@ -1,6 +1,7 @@
# Open folder in ForkLift.app or ForkLift2.app from console # Open folder in ForkLift.app or ForkLift2.app from console
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de # Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
# Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving # Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving
# Updated to support ForkLift from Setapp by Paul Rudkin
# #
# Usage: # Usage:
# fl [<folder>] # fl [<folder>]
@@ -24,6 +25,13 @@ function fl {
fi fi
osascript 2>&1 1>/dev/null <<END osascript 2>&1 1>/dev/null <<END
try
tell application "Finder"
set forkLiftSetapp to name of application file id "com.binarynights.forklift-setapp"
end tell
on error err_msg number err_num
set forkLiftSetapp to null
end try
try try
tell application "Finder" tell application "Finder"
set forkLift3 to name of application file id "com.binarynights.ForkLift-3" set forkLift3 to name of application file id "com.binarynights.ForkLift-3"
@@ -46,7 +54,12 @@ function fl {
set forkLift to null set forkLift to null
end try end try
if forkLift3 is not null and application forkLift3 is running then if forkLiftSetapp is not null and application forkLiftSetapp is running then
tell application forkLiftSetapp
activate
set forkLiftVersion to version
end tell
else if forkLift3 is not null and application forkLift3 is running then
tell application forkLift3 tell application forkLift3
activate activate
set forkLiftVersion to version set forkLiftVersion to version
@@ -62,7 +75,9 @@ function fl {
set forkLiftVersion to version set forkLiftVersion to version
end tell end tell
else else
if forkLift3 is not null then if forkLiftSetapp is not null then
set appName to forkLiftSetapp
else if forkLift3 is not null then
set appName to forkLift3 set appName to forkLift3
else if forkLift2 is not null then else if forkLift2 is not null then
set appName to forkLift2 set appName to forkLift2
@@ -52,6 +52,7 @@ Available search contexts are:
| mdn | `https://developer.mozilla.org/search?q=` | | mdn | `https://developer.mozilla.org/search?q=` |
| nodejs | `https://www.google.com/search?as_sitesearch=nodejs.org/en/docs/&as_q=` | | nodejs | `https://www.google.com/search?as_sitesearch=nodejs.org/en/docs/&as_q=` |
| npmjs | `https://www.npmjs.com/search?q=` | | npmjs | `https://www.npmjs.com/search?q=` |
| packagephobia | `https://packagephobia.now.sh/result?p=` |
| qunit | `https://api.qunitjs.com/?s=` | | qunit | `https://api.qunitjs.com/?s=` |
| reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` | | reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` |
| smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` | | smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` |
@@ -38,6 +38,7 @@ function _frontend() {
'mdn: Search in MDN website' 'mdn: Search in MDN website'
'nodejs: Search in NodeJS website' 'nodejs: Search in NodeJS website'
'npmjs: Search in NPMJS website' 'npmjs: Search in NPMJS website'
'packagephobia: Search in Packagephobia website'
'qunit: Search in Qunit website' 'qunit: Search in Qunit website'
'reactjs: Search in React website' 'reactjs: Search in React website'
'smacss: Search in SMACSS website' 'smacss: Search in SMACSS website'
@@ -124,6 +125,9 @@ function _frontend() {
bundlephobia) bundlephobia)
_describe -t points "Warp points" frontend_points && ret=0 _describe -t points "Warp points" frontend_points && ret=0
;; ;;
packagephobia)
_describe -t points "Warp points" frontend_points && ret=0
;;
flowtype) flowtype)
_describe -t points "Warp points" frontend_points && ret=0 _describe -t points "Warp points" frontend_points && ret=0
;; ;;
@@ -19,6 +19,7 @@ alias lodash='frontend lodash'
alias mdn='frontend mdn' alias mdn='frontend mdn'
alias nodejs='frontend nodejs' alias nodejs='frontend nodejs'
alias npmjs='frontend npmjs' alias npmjs='frontend npmjs'
alias packagephobia='frontend packagephobia'
alias qunit='frontend qunit' alias qunit='frontend qunit'
alias reactjs='frontend reactjs' alias reactjs='frontend reactjs'
alias smacss='frontend smacss' alias smacss='frontend smacss'
@@ -65,6 +66,7 @@ function frontend() {
mdn 'https://developer.mozilla.org/search?q=' mdn 'https://developer.mozilla.org/search?q='
nodejs $(_frontend_fallback 'nodejs.org/en/docs/') nodejs $(_frontend_fallback 'nodejs.org/en/docs/')
npmjs 'https://www.npmjs.com/search?q=' npmjs 'https://www.npmjs.com/search?q='
packagephobia 'https://packagephobia.now.sh/result?p='
qunit 'https://api.qunitjs.com/?s=' qunit 'https://api.qunitjs.com/?s='
reactjs $(_frontend_fallback 'reactjs.org/') reactjs $(_frontend_fallback 'reactjs.org/')
smacss $(_frontend_fallback 'smacss.com') smacss $(_frontend_fallback 'smacss.com')
@@ -82,7 +84,7 @@ function frontend() {
print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website," print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website,"
print -P "and %Ucontext%u is one of the following:" print -P "and %Ucontext%u is one of the following:"
print -P "" print -P ""
print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow," print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash," print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash,"
print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia" print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
print -P "" print -P ""
@@ -98,7 +100,7 @@ function frontend() {
echo "" echo ""
echo "Valid contexts are:" echo "Valid contexts are:"
echo "" echo ""
echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow," echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash," echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash,"
echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia" echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
echo "" echo ""
@@ -1,19 +1,52 @@
# fzf # fzf
This plugin enables [junegunn's fzf](https://github.com/junegunn/fzf) fuzzy auto-completion and key bindings This plugin tries to find [junegunn's fzf](https://github.com/junegunn/fzf) based on where
it's been installed, and enables its fuzzy auto-completion and key bindings.
To use it, add `fzf` to the plugins array in your zshrc file:
```zsh ```zsh
# Set fzf installation directory path plugins=(... fzf)
export FZF_BASE=/path/to/fzf/install/dir ```
# Uncomment the following line to disable fuzzy completion ## Settings
# export DISABLE_FZF_AUTO_COMPLETION="true"
All these settings should go in your zshrc file, before Oh My Zsh is sourced.
# Uncomment the following line to disable key bindings (CTRL-T, CTRL-R, ALT-C)
# export DISABLE_FZF_KEY_BINDINGS="true" ### `FZF_BASE`
plugins=( Set to fzf installation directory path:
...
fzf ```zsh
) export FZF_BASE=/path/to/fzf/install/dir
```
### `FZF_DEFAULT_COMMAND`
Set default command to use when input is tty:
```zsh
export FZF_DEFAULT_COMMAND='<your fzf default commmand>'
```
If not set, the plugin will try to set it to these, in the order in which they're found:
- [`rg`](https://github.com/BurntSushi/ripgrep)
- [`fd`](https://github.com/sharkdp/fd)
- [`ag`](https://github.com/ggreer/the_silver_searcher)
### `DISABLE_FZF_AUTO_COMPLETION`
Set whether to load fzf auto-completion:
```zsh
DISABLE_FZF_AUTO_COMPLETION="true"
```
### `DISABLE_FZF_KEY_BINDINGS`
Set whether to disable key bindings (CTRL-T, CTRL-R, ALT-C):
```zsh
DISABLE_FZF_KEY_BINDINGS="true"
``` ```
@@ -1,9 +1,5 @@
function setup_using_base_dir() { function setup_using_base_dir() {
# Declare all variables local not no mess with outside env in any way local fzf_base fzf_shell fzfdirs dir
local fzf_base
local fzf_shell
local fzfdirs
local dir
test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}" test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}"
@@ -31,7 +27,10 @@ function setup_using_base_dir() {
fi fi
fi fi
if [[ -d "${fzf_base}" ]]; then if [[ ! -d "${fzf_base}" ]]; then
return 1
fi
# Fix fzf shell directory for Arch Linux, NixOS or Void Linux packages # Fix fzf shell directory for Arch Linux, NixOS or Void Linux packages
if [[ ! -d "${fzf_base}/shell" ]]; then if [[ ! -d "${fzf_base}/shell" ]]; then
fzf_shell="${fzf_base}" fzf_shell="${fzf_base}"
@@ -40,29 +39,25 @@ function setup_using_base_dir() {
fi fi
# Setup fzf binary path # Setup fzf binary path
if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then if (( ! ${+commands[fzf]} )) && [[ "$PATH" != *$fzf_base/bin* ]]; then
export PATH="$PATH:$fzf_base/bin" export PATH="$PATH:$fzf_base/bin"
fi fi
# Auto-completion # Auto-completion
if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
[[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null source "${fzf_shell}/completion.zsh" 2> /dev/null
fi fi
# Key bindings # Key bindings
if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
source "${fzf_shell}/key-bindings.zsh" source "${fzf_shell}/key-bindings.zsh"
fi fi
else
return 1
fi
} }
function setup_using_debian_package() { function setup_using_debian_package() {
(( $+commands[dpkg] )) && dpkg -s fzf &> /dev/null if (( ! $+commands[dpkg] )) || ! dpkg -s fzf &>/dev/null; then
if (( $? )); then # Either not a debian based distro, or no fzf installed
# Either not a debian based distro, or no fzf installed. In any case skip ahead
return 1 return 1
fi fi
@@ -76,7 +71,7 @@ function setup_using_debian_package() {
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
if [[ $- == *i* ]] && [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
source $completions 2> /dev/null source $completions 2> /dev/null
fi fi
@@ -88,13 +83,81 @@ function setup_using_debian_package() {
return 0 return 0
} }
function indicate_error() { function setup_using_opensuse_package() {
print "[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.\n"\ # OpenSUSE installs fzf in /usr/bin/fzf
"Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2 # If the command is not found, the package isn't installed
(( $+commands[fzf] )) || return 1
# The fzf-zsh-completion package installs the auto-completion in
local completions="/usr/share/zsh/site-functions/_fzf"
# The fzf-zsh-completion package installs the key-bindings file in
local key_bindings="/etc/zsh_completion.d/fzf-key-bindings"
# If these are not found: (1) maybe we're not on OpenSUSE, or
# (2) maybe the fzf-zsh-completion package isn't installed.
if [[ ! -f "$completions" || ! -f "$key_bindings" ]]; then
return 1
fi
# Auto-completion
if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
source "$completions" 2>/dev/null
fi
# Key bindings
if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
source "$key_bindings" 2>/dev/null
fi
return 0
} }
# Check for debian package first, because it easy to short cut function setup_using_openbsd_package() {
# Indicate to user that fzf installation not found if nothing worked # openBSD installs fzf in /usr/local/bin/fzf
setup_using_debian_package || setup_using_base_dir || indicate_error if [[ "$OSTYPE" != openbsd* ]] || (( ! $+commands[fzf] )); then
return 1
fi
unset -f setup_using_debian_package setup_using_base_dir indicate_error # The fzf package installs the auto-completion in
local completions="/usr/local/share/zsh/site-functions/_fzf_completion"
# The fzf package installs the key-bindings file in
local key_bindings="/usr/local/share/zsh/site-functions/_fzf_key_bindings"
# Auto-completion
if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
source "$completions" 2>/dev/null
fi
# Key bindings
if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
source "$key_bindings" 2>/dev/null
fi
return 0
}
function indicate_error() {
cat >&2 <<EOF
[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.
Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc
EOF
}
# Indicate to user that fzf installation not found if nothing worked
setup_using_openbsd_package \
|| setup_using_debian_package \
|| setup_using_opensuse_package \
|| setup_using_base_dir \
|| indicate_error
unset -f setup_using_opensuse_package setup_using_debian_package setup_using_base_dir indicate_error
if [[ -z "$FZF_DEFAULT_COMMAND" ]]; then
if (( $+commands[rg] )); then
export FZF_DEFAULT_COMMAND='rg --files --hidden'
elif (( $+commands[fd] )); then
export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude .git'
elif (( $+commands[ag] )); then
export FZF_DEFAULT_COMMAND='ag -l --hidden -g ""'
fi
fi
@@ -11,6 +11,9 @@ plugins=(... git-prompt)
See the [original repository](https://github.com/olivierverdier/zsh-git-prompt). See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
## Prerequisites
This plugin uses `python`, so your host needs to have it installed
## Examples ## Examples
The prompt may look like the following: The prompt may look like the following:
@@ -1,15 +0,0 @@
# git-remote-branch plugin
This plugin adds completion for [`grb`](https://github.com/webmat/git_remote_branch),
or `git_remote_branch`.
To use it, add `git-remote-branch` to the plugins array of your zshrc file:
```zsh
plugins=(... git-remote-branch)
```
## Deprecation
[git_remote_branch was archived in 2018](https://github.com/webmat/git_remote_branch#archived),
meaning it's not actively maintained anymore. Use at your own risk.
@@ -1,19 +0,0 @@
_git_remote_branch() {
ref=$(git symbolic-ref HEAD 2> /dev/null)
if [[ -n $ref ]]; then
if (( CURRENT == 2 )); then
# first arg: operation
compadd create publish rename delete track
elif (( CURRENT == 3 )); then
# second arg: remote branch name
remotes=`git remote | tr '\n' '|' | sed "s/\|$//g"`
compadd `git branch -r | grep -v HEAD | sed "s/$remotes\///" | sed "s/ //g"`
elif (( CURRENT == 4 )); then
# third arg: remote name
compadd `git remote`
fi
else;
_files
fi
}
compdef _git_remote_branch grb
@@ -19,10 +19,11 @@ plugins=(... git)
| gau | git add --update | | gau | git add --update |
| gav | git add --verbose | | gav | git add --verbose |
| gap | git apply | | gap | git apply |
| gapt | git apply --3way |
| gb | git branch | | gb | git branch |
| gba | git branch -a | | gba | git branch -a |
| gbd | git branch -d | | gbd | git branch -d |
| gbda | git branch --no-color --merged \| command grep -vE "^(\+\|\*\|\s*(master\|develop\|dev)\s*$)" \| command xargs -n 1 git branch -d | | gbda | git branch --no-color --merged \| command grep -vE "^(\+\|\*\|\s*($(git_main_branch)\|development\|develop\|devel\|dev)\s*$)" \| command xargs -n 1 git branch -d |
| gbD | git branch -D | | gbD | git branch -D |
| gbl | git blame -b -w | | gbl | git blame -b -w |
| gbnm | git branch --no-merged | | gbnm | git branch --no-merged |
@@ -46,7 +47,7 @@ plugins=(... git)
| gcl | git clone --recurse-submodules | | gcl | git clone --recurse-submodules |
| gclean | git clean -id | | gclean | git clean -id |
| gpristine | git reset --hard && git clean -dffx | | gpristine | git reset --hard && git clean -dffx |
| gcm | git checkout master | | gcm | git checkout $(git_main_branch) |
| gcd | git checkout develop | | gcd | git checkout develop |
| gcmsg | git commit -m | | gcmsg | git commit -m |
| gco | git checkout | | gco | git checkout |
@@ -61,6 +62,7 @@ plugins=(... git)
| gdct | git describe --tags $(git rev-list --tags --max-count=1) | | gdct | git describe --tags $(git rev-list --tags --max-count=1) |
| gds | git diff --staged | | gds | git diff --staged |
| gdt | git diff-tree --no-commit-id --name-only -r | | gdt | git diff-tree --no-commit-id --name-only -r |
| gdnolock | git diff $@ ":(exclude)package-lock.json" ":(exclude)&ast;.lock" |
| gdv | git diff -w $@ \| view - | | gdv | git diff -w $@ \| view - |
| gdw | git diff --word-diff | | gdw | git diff --word-diff |
| gf | git fetch | | gf | git fetch |
@@ -83,7 +85,7 @@ plugins=(... git)
| ghh | git help | | ghh | git help |
| gignore | git update-index --assume-unchanged | | gignore | git update-index --assume-unchanged |
| gignored | git ls-files -v \| grep "^[[:lower:]]" | | gignored | git ls-files -v \| grep "^[[:lower:]]" |
| git-svn-dcommit-push | git svn dcommit && git push github master:svntrunk | | git-svn-dcommit-push | git svn dcommit && git push github $(git_main_branch):svntrunk |
| gk | gitk --all --branches | | gk | gitk --all --branches |
| gke | gitk --all $(git log -g --pretty=%h) | | gke | gitk --all $(git log -g --pretty=%h) |
| gl | git pull | | gl | git pull |
@@ -100,12 +102,12 @@ plugins=(... git)
| glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all | | glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all |
| glog | git log --oneline --decorate --graph | | glog | git log --oneline --decorate --graph |
| gloga | git log --oneline --decorate --graph --all | | gloga | git log --oneline --decorate --graph --all |
| glp | `_git_log_prettily` | | glp | git log --pretty=\<format\> |
| gm | git merge | | gm | git merge |
| gmom | git merge origin/master | | gmom | git merge origin/$(git_main_branch) |
| gmt | git mergetool --no-prompt | | gmt | git mergetool --no-prompt |
| gmtvim | git mergetool --no-prompt --tool=vimdiff | | gmtvim | git mergetool --no-prompt --tool=vimdiff |
| gmum | git merge upstream/master | | gmum | git merge upstream/$(git_main_branch) |
| gma | git merge --abort | | gma | git merge --abort |
| gp | git push | | gp | git push |
| gpd | git push --dry-run | | gpd | git push --dry-run |
@@ -121,7 +123,7 @@ plugins=(... git)
| grbc | git rebase --continue | | grbc | git rebase --continue |
| grbd | git rebase develop | | grbd | git rebase develop |
| grbi | git rebase -i | | grbi | git rebase -i |
| grbm | git rebase master | | grbm | git rebase $(git_main_branch) |
| grbs | git rebase --skip | | grbs | git rebase --skip |
| grev | git revert | | grev | git revert |
| grh | git reset | | grh | git reset |
@@ -168,9 +170,21 @@ plugins=(... git)
| gupv | git pull --rebase -v | | gupv | git pull --rebase -v |
| gupa | git pull --rebase --autostash | | gupa | git pull --rebase --autostash |
| gupav | git pull --rebase --autostash -v | | gupav | git pull --rebase --autostash -v |
| glum | git pull upstream master | | glum | git pull upstream $(git_main_branch) |
| gwch | git whatchanged -p --abbrev-commit --pretty=medium | | gwch | git whatchanged -p --abbrev-commit --pretty=medium |
| gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" | | gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" |
| gam | git am |
| gamc | git am --continue |
| gams | git am --skip |
| gama | git am --abort |
| gamscp | git am --show-current-patch |
### Main branch preference
Following the recent push for removing racially-charged words from our technical vocabulary, the git plugin favors using
a branch name other than `master`. In this case, we favor the shorter, neutral and descriptive term `main`. This means
that any aliases and functions that previously used `master`, will use `main` if that branch exists. We do this via the
function `git_main_branch`.
### Deprecated aliases ### Deprecated aliases
@@ -195,11 +209,12 @@ These are aliases that have been removed, renamed, or otherwise modified in a wa
### Current ### Current
| Command | Description | | Command | Description |
|:-----------------------|:---------------------------------------------------------| |:-----------------------|:-----------------------------------------------------------------------------|
| `grename <old> <new>` | Rename `old` branch to `new`, including in origin remote | | `grename <old> <new>` | Rename `old` branch to `new`, including in origin remote |
| current_branch | Return the name of the current branch | | current_branch | Return the name of the current branch |
| git_current_user_name | Returns the `user.name` config value | | git_current_user_name | Returns the `user.name` config value |
| git_current_user_email | Returns the `user.email` config value | | git_current_user_email | Returns the `user.email` config value |
| git_main_branch | Returns the name of the main branch: `main` if it exists, `master` otherwise |
### Work in Progress (WIP) ### Work in Progress (WIP)
@@ -1,3 +1,7 @@
# Git version checking
autoload -Uz is-at-least
git_version="${${(As: :)$(git version 2>/dev/null)}[3]}"
# #
# Functions # Functions
# #
@@ -25,6 +29,15 @@ function work_in_progress() {
fi fi
} }
# Check if main exists and use instead of master
function git_main_branch() {
if [[ -n "$(git branch --list main)" ]]; then
echo main
else
echo master
fi
}
# #
# Aliases # Aliases
# (sorted alphabetically) # (sorted alphabetically)
@@ -38,11 +51,12 @@ alias gapa='git add --patch'
alias gau='git add --update' alias gau='git add --update'
alias gav='git add --verbose' alias gav='git add --verbose'
alias gap='git apply' alias gap='git apply'
alias gapt='git apply --3way'
alias gb='git branch' alias gb='git branch'
alias gba='git branch -a' alias gba='git branch -a'
alias gbd='git branch -d' alias gbd='git branch -d'
alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d' alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*($(git_main_branch)|development|develop|devel|dev)\s*$)" | command xargs -n 1 git branch -d'
alias gbD='git branch -D' alias gbD='git branch -D'
alias gbl='git blame -b -w' alias gbl='git blame -b -w'
alias gbnm='git branch --no-merged' alias gbnm='git branch --no-merged'
@@ -67,7 +81,7 @@ alias gcf='git config --list'
alias gcl='git clone --recurse-submodules' alias gcl='git clone --recurse-submodules'
alias gclean='git clean -id' alias gclean='git clean -id'
alias gpristine='git reset --hard && git clean -dffx' alias gpristine='git reset --hard && git clean -dffx'
alias gcm='git checkout master' alias gcm='git checkout $(git_main_branch)'
alias gcd='git checkout develop' alias gcd='git checkout develop'
alias gcmsg='git commit -m' alias gcmsg='git commit -m'
alias gco='git checkout' alias gco='git checkout'
@@ -85,11 +99,19 @@ alias gds='git diff --staged'
alias gdt='git diff-tree --no-commit-id --name-only -r' alias gdt='git diff-tree --no-commit-id --name-only -r'
alias gdw='git diff --word-diff' alias gdw='git diff --word-diff'
function gdnolock() {
git diff "$@" ":(exclude)package-lock.json" ":(exclude)*.lock"
}
compdef _git gdnolock=git-diff
function gdv() { git diff -w "$@" | view - } function gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff compdef _git gdv=git-diff
alias gf='git fetch' alias gf='git fetch'
alias gfa='git fetch --all --prune' # --jobs=<n> was added in git 2.8
is-at-least 2.8 "$git_version" \
&& alias gfa='git fetch --all --prune --jobs=10' \
|| alias gfa='git fetch --all --prune'
alias gfo='git fetch origin' alias gfo='git fetch origin'
alias gfg='git ls-files | grep' alias gfg='git ls-files | grep'
@@ -154,7 +176,7 @@ alias ghh='git help'
alias gignore='git update-index --assume-unchanged' alias gignore='git update-index --assume-unchanged'
alias gignored='git ls-files -v | grep "^[[:lower:]]"' alias gignored='git ls-files -v | grep "^[[:lower:]]"'
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk'
alias gk='\gitk --all --branches' alias gk='\gitk --all --branches'
alias gke='\gitk --all $(git log -g --pretty=%h)' alias gke='\gitk --all $(git log -g --pretty=%h)'
@@ -176,10 +198,10 @@ alias gloga='git log --oneline --decorate --graph --all'
alias glp="_git_log_prettily" alias glp="_git_log_prettily"
alias gm='git merge' alias gm='git merge'
alias gmom='git merge origin/master' alias gmom='git merge origin/$(git_main_branch)'
alias gmt='git mergetool --no-prompt' alias gmt='git mergetool --no-prompt'
alias gmtvim='git mergetool --no-prompt --tool=vimdiff' alias gmtvim='git mergetool --no-prompt --tool=vimdiff'
alias gmum='git merge upstream/master' alias gmum='git merge upstream/$(git_main_branch)'
alias gma='git merge --abort' alias gma='git merge --abort'
alias gp='git push' alias gp='git push'
@@ -197,7 +219,7 @@ alias grba='git rebase --abort'
alias grbc='git rebase --continue' alias grbc='git rebase --continue'
alias grbd='git rebase develop' alias grbd='git rebase develop'
alias grbi='git rebase -i' alias grbi='git rebase -i'
alias grbm='git rebase master' alias grbm='git rebase $(git_main_branch)'
alias grbs='git rebase --skip' alias grbs='git rebase --skip'
alias grev='git revert' alias grev='git revert'
alias grh='git reset' alias grh='git reset'
@@ -225,8 +247,7 @@ alias gss='git status -s'
alias gst='git status' alias gst='git status'
# use the default stash push on git 2.13 and newer # use the default stash push on git 2.13 and newer
autoload -Uz is-at-least is-at-least 2.13 "$git_version" \
is-at-least 2.13 "$(git --version 2>/dev/null | awk '{print $3}')" \
&& alias gsta='git stash push' \ && alias gsta='git stash push' \
|| alias gsta='git stash save' || alias gsta='git stash save'
@@ -252,11 +273,17 @@ alias gup='git pull --rebase'
alias gupv='git pull --rebase -v' alias gupv='git pull --rebase -v'
alias gupa='git pull --rebase --autostash' alias gupa='git pull --rebase --autostash'
alias gupav='git pull --rebase --autostash -v' alias gupav='git pull --rebase --autostash -v'
alias glum='git pull upstream master' alias glum='git pull upstream $(git_main_branch)'
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"' alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"'
alias gam='git am'
alias gamc='git am --continue'
alias gams='git am --skip'
alias gama='git am --abort'
alias gamscp='git am --show-current-patch'
function grename() { function grename() {
if [[ -z "$1" || -z "$2" ]]; then if [[ -z "$1" || -z "$2" ]]; then
echo "Usage: $0 old_branch new_branch" echo "Usage: $0 old_branch new_branch"
@@ -270,3 +297,5 @@ function grename() {
git push --set-upstream origin "$2" git push --set-upstream origin "$2"
fi fi
} }
unset git_version
@@ -30,7 +30,7 @@ if [ -z "$script" ]; then
local -a locations local -a locations
local e local e
locations=( locations=(
$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash "$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash"
'/etc/bash_completion.d/git' # fedora, old debian '/etc/bash_completion.d/git' # fedora, old debian
'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian '/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
'/usr/share/bash-completion/git' # gentoo '/usr/share/bash-completion/git' # gentoo
@@ -39,7 +39,7 @@ if [ -z "$script" ]; then
test -f $e && script="$e" && break test -f $e && script="$e" && break
done done
fi fi
GIT_SOURCING_ZSH_COMPLETION=y . "$script" ZSH_VERSION='' . "$script"
__gitcomp () __gitcomp ()
{ {
@@ -93,22 +93,13 @@ __gitcomp_nl_append ()
compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0 compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
} }
__gitcomp_file_direct ()
{
emulate -L zsh
local IFS=$'\n'
compset -P '*[=:]'
compadd -f -- ${=1} && _ret=0
}
__gitcomp_file () __gitcomp_file ()
{ {
emulate -L zsh emulate -L zsh
local IFS=$'\n' local IFS=$'\n'
compset -P '*[=:]' compset -P '*[=:]'
compadd -p "${2-}" -f -- ${=1} && _ret=0 compadd -Q -p "${2-}" -f -- ${=1} && _ret=0
} }
__git_zsh_bash_func () __git_zsh_bash_func ()
@@ -232,8 +223,10 @@ _git ()
if (( $+functions[__${service}_zsh_main] )); then if (( $+functions[__${service}_zsh_main] )); then
__${service}_zsh_main __${service}_zsh_main
else elif (( $+functions[__${service}_main] )); then
emulate ksh -c __${service}_main emulate ksh -c __${service}_main
elif (( $+functions[_${service}] )); then
emulate ksh -c _${service}
fi fi
let _ret && _default && _ret=0 let _ret && _default && _ret=0
File diff suppressed because it is too large Load Diff
@@ -219,7 +219,7 @@ __git_ps1_show_upstream ()
if [[ -n "$count" && -n "$name" ]]; then if [[ -n "$count" && -n "$name" ]]; then
__git_ps1_upstream_name=$(git rev-parse \ __git_ps1_upstream_name=$(git rev-parse \
--abbrev-ref "$upstream" 2>/dev/null) --abbrev-ref "$upstream" 2>/dev/null)
if [ "$pcmode" = yes ] && [ "$ps1_expanded" = yes ]; then if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
p="$p \${__git_ps1_upstream_name}" p="$p \${__git_ps1_upstream_name}"
else else
p="$p ${__git_ps1_upstream_name}" p="$p ${__git_ps1_upstream_name}"
@@ -237,7 +237,7 @@ __git_ps1_show_upstream ()
# to build a gitstring. # to build a gitstring.
__git_ps1_colorize_gitstring () __git_ps1_colorize_gitstring ()
{ {
if [[ -n "${ZSH_VERSION-}" ]]; then if [[ -n ${ZSH_VERSION-} ]]; then
local c_red='%F{red}' local c_red='%F{red}'
local c_green='%F{green}' local c_green='%F{green}'
local c_lblue='%F{blue}' local c_lblue='%F{blue}'
@@ -255,7 +255,7 @@ __git_ps1_colorize_gitstring ()
local flags_color="$c_lblue" local flags_color="$c_lblue"
local branch_color="" local branch_color=""
if [ "$detached" = no ]; then if [ $detached = no ]; then
branch_color="$ok_color" branch_color="$ok_color"
else else
branch_color="$bad_color" branch_color="$bad_color"
@@ -508,13 +508,13 @@ __git_ps1 ()
# NO color option unless in PROMPT_COMMAND mode or it's Zsh # NO color option unless in PROMPT_COMMAND mode or it's Zsh
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
if [ "$pcmode" = yes ] || [ -n "${ZSH_VERSION-}" ]; then if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then
__git_ps1_colorize_gitstring __git_ps1_colorize_gitstring
fi fi
fi fi
b=${b##refs/heads/} b=${b##refs/heads/}
if [ "$pcmode" = yes ] && [ "$ps1_expanded" = yes ]; then if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
__git_ps1_branch_name=$b __git_ps1_branch_name=$b
b="\${__git_ps1_branch_name}" b="\${__git_ps1_branch_name}"
fi fi
@@ -522,7 +522,7 @@ __git_ps1 ()
local f="$w$i$s$u" local f="$w$i$s$u"
local gitstring="$c$b${f:+$z$f}$r$p" local gitstring="$c$b${f:+$z$f}$r$p"
if [ "$pcmode" = yes ]; then if [ $pcmode = yes ]; then
if [ "${__git_printf_supports_v-}" != yes ]; then if [ "${__git_printf_supports_v-}" != yes ]; then
gitstring=$(printf -- "$printf_format" "$gitstring") gitstring=$(printf -- "$printf_format" "$gitstring")
else else
@@ -17,6 +17,9 @@ Then just press `SPACE` to trigger the expansion of a command you've written.
If you only want to insert a space without expanding the command line, press If you only want to insert a space without expanding the command line, press
`CTRL`+`SPACE`. `CTRL`+`SPACE`.
if you would like to filter out any values from expanding set `GLOBALIAS_FILTER_VALUES` to
an array of said values. See [Filtered values](#filtered-values).
## Examples ## Examples
#### Glob expressions #### Glob expressions
@@ -37,7 +40,6 @@ $ ls folder/file.json anotherfolder/another.json
$ mkdir "`date -R`" $ mkdir "`date -R`"
# expands to # expands to
$ mkdir Tue,\ 04\ Oct\ 2016\ 13:54:03\ +0300 $ mkdir Tue,\ 04\ Oct\ 2016\ 13:54:03\ +0300
``` ```
#### Aliases #### Aliases
@@ -60,3 +62,18 @@ $ S<space>
# expands to: # expands to:
$ sudo systemctl $ sudo systemctl
``` ```
#### Filtered values
```
# .zshrc
alias l='ls -lh'
alias la='ls --color=auto -lah'
GLOBALIAS_FILTER_VALUES=(l)
$ l<space>
# does not expand
$ la<space>
# expands to:
$ ls --color=auto -lah
```
@@ -1,6 +1,12 @@
globalias() { globalias() {
# Get last word to the left of the cursor:
# (z) splits into words using shell parsing
# (A) makes it an array even if there's only one element
local word=${${(Az)LBUFFER}[-1]}
if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then
zle _expand_alias zle _expand_alias
zle expand-word zle expand-word
fi
zle self-insert zle self-insert
} }
zle -N globalias zle -N globalias
@@ -1 +0,0 @@
../golang/golang.plugin.zsh
@@ -41,7 +41,7 @@ __go_tool_complete() {
return return
fi fi
build_flags=( build_flags=(
'-a[force reinstallation of packages that are already up-to-date]' '-a[force reinstallation of packages that are already up to date]'
'-n[print the commands but do not run them]' '-n[print the commands but do not run them]'
'-p[number of parallel builds]:number' '-p[number of parallel builds]:number'
'-race[enable data race detection]' '-race[enable data race detection]'
@@ -116,9 +116,9 @@ __gradle-generate-tasks-cache() {
# Reuse Gradle Daemon if IDLE but don't start a new one. # Reuse Gradle Daemon if IDLE but don't start a new one.
local gradle_tasks_output local gradle_tasks_output
if [[ ! -z "$($gradle_cmd --status 2>/dev/null | grep IDLE)" ]]; then if [[ ! -z "$($gradle_cmd --status 2>/dev/null | grep IDLE)" ]]; then
gradle_tasks_output="$($gradle_cmd --daemon --build-file $gradle_build_file -q tasks --all 2>/dev/null)" gradle_tasks_output="$($gradle_cmd --daemon --build-file $gradle_build_file --console plain -q tasks --all 2>/dev/null)"
else else
gradle_tasks_output="$($gradle_cmd --no-daemon --build-file $gradle_build_file -q tasks --all 2>/dev/null)" gradle_tasks_output="$($gradle_cmd --no-daemon --build-file $gradle_build_file --console plain -q tasks --all 2>/dev/null)"
fi fi
local gradle_all_tasks="" root_tasks="" subproject_tasks="" output_line local gradle_all_tasks="" root_tasks="" subproject_tasks="" output_line
local -a match local -a match
@@ -11,4 +11,10 @@ plugins=(... httpie)
It uses completion from [zsh-completions](https://github.com/zsh-users/zsh-completions). It uses completion from [zsh-completions](https://github.com/zsh-users/zsh-completions).
## Aliases
| Alias | Command |
| ------------ | ---------------------------------------------------------------- |
| `https` | `http --default-scheme=https` |
**Maintainer:** [lululau](https://github.com/lululau) **Maintainer:** [lululau](https://github.com/lululau)
@@ -1,4 +1,4 @@
jenvdirs=("$HOME/.jenv" "/usr/local" "/usr/local/jenv" "/opt/jenv") jenvdirs=("$HOME/.jenv" "/usr/local/bin/jenv" "/usr/local/jenv" "/opt/jenv")
FOUND_JENV=0 FOUND_JENV=0
for jenvdir in $jenvdirs; do for jenvdir in $jenvdirs; do
@@ -19,6 +19,7 @@ jira # performs the default action
jira new # opens a new issue jira new # opens a new issue
jira dashboard # opens your JIRA dashboard jira dashboard # opens your JIRA dashboard
jira tempo # opens your JIRA Tempo
jira reported [username] # queries for issues reported by a user jira reported [username] # queries for issues reported by a user
jira assigned [username] # queries for issues assigned to a user jira assigned [username] # queries for issues assigned to a user
jira myissues # queries for you own issues jira myissues # queries for you own issues
@@ -5,6 +5,7 @@ local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'new:create a new issue' 'new:create a new issue'
'dashboard:open the dashboard' 'dashboard:open the dashboard'
'tempo:open the tempo'
'reported:search for issues reported by a user' 'reported:search for issues reported by a user'
'assigned:search for issues assigned to a user' 'assigned:search for issues assigned to a user'
'branch:open the issue named after the git branch of the current directory' 'branch:open the issue named after the git branch of the current directory'
@@ -54,6 +54,9 @@ function jira() {
else else
open_command "${jira_url}/secure/Dashboard.jspa" open_command "${jira_url}/secure/Dashboard.jspa"
fi fi
elif [[ "$action" == "tempo" ]]; then
echo "Opening tempo"
open_command "${jira_url}/secure/Tempo.jspa"
elif [[ "$action" == "dumpconfig" ]]; then elif [[ "$action" == "dumpconfig" ]]; then
echo "JIRA_URL=$jira_url" echo "JIRA_URL=$jira_url"
echo "JIRA_PREFIX=$jira_prefix" echo "JIRA_PREFIX=$jira_prefix"
@@ -29,7 +29,7 @@ curl https://coderwall.com/bobwilliams.json | pp_json
- **is_json**: - **is_json**:
```sh ```sh
# pretty print the contents of an existing json file # Validate if file's content conforms to a valid JSON schema
less data.json | is_json less data.json | is_json
``` ```
@@ -1,7 +1,9 @@
(( $+commands[keychain] )) || return
# Define SHORT_HOST if not defined (%m = host name up to first .) # Define SHORT_HOST if not defined (%m = host name up to first .)
SHORT_HOST=${SHORT_HOST:-${(%):-%m}} SHORT_HOST=${SHORT_HOST:-${(%):-%m}}
function _start_agent() { function {
local agents local agents
local -a identities local -a identities
local -a options local -a options
@@ -28,8 +30,3 @@ function _start_agent() {
[ -f "$_keychain_env_sh" ] && . "$_keychain_env_sh" [ -f "$_keychain_env_sh" ] && . "$_keychain_env_sh"
[ -f "$_keychain_env_sh_gpg" ] && . "$_keychain_env_sh_gpg" [ -f "$_keychain_env_sh_gpg" ] && . "$_keychain_env_sh_gpg"
} }
_start_agent
# tidy up after ourselves
unfunction _start_agent
@@ -6,14 +6,6 @@ configured on `kubectl` to your Bash/Zsh prompt strings (i.e. the `$PS1`).
Inspired by several tools used to simplify usage of `kubectl`. Inspired by several tools used to simplify usage of `kubectl`.
![prompt](img/screenshot2.png)
![prompt_sol_light](img/screenshot-sol-light.png)
![prompt_img](img/screenshot-img.png)
![prompt demo](img/kube-ps1.gif)
## Installing ## Installing
### MacOS ### MacOS
@@ -184,7 +184,7 @@ _kube_ps1_file_newer_than() {
local check_time=$2 local check_time=$2
if [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then if [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then
mtime=$(zstat -L +mtime "${file}") mtime=$(zstat +mtime "${file}")
elif stat -c "%s" /dev/null &> /dev/null; then elif stat -c "%s" /dev/null &> /dev/null; then
# GNU stat # GNU stat
mtime=$(stat -L -c %Y "${file}") mtime=$(stat -L -c %Y "${file}")
@@ -33,7 +33,8 @@ plugins=(... kubectl)
| kep | `kubectl edit pods` | Edit pods from the default editor | | kep | `kubectl edit pods` | Edit pods from the default editor |
| kdp | `kubectl describe pods` | Describe all pods | | kdp | `kubectl describe pods` | Describe all pods |
| kdelp | `kubectl delete pods` | Delete all pods matching passed arguments | | kdelp | `kubectl delete pods` | Delete all pods matching passed arguments |
| kgpl | `kgp -l` | Get pod by label. Example: `kgpl "app=myapp" -n myns` | | kgpl | `kgp -l` | Get pods by label. Example: `kgpl "app=myapp" -n myns` |
| kgpn | `kgp -n` | Get pods by namespace. Example: `kgpn kube-system` |
| | | **Service management** | | | | **Service management** |
| kgs | `kubectl get svc` | List all services in ps output format | | kgs | `kubectl get svc` | List all services in ps output format |
| kgsw | `kgs --watch` | After listing all services, watch for changes | | kgsw | `kgs --watch` | After listing all services, watch for changes |
@@ -94,9 +95,9 @@ plugins=(... kubectl)
| kgpvc | `kubectl get pvc` | List all PVCs | | kgpvc | `kubectl get pvc` | List all PVCs |
| kgpvcw | `kgpvc --watch` | After listing/getting the requested object, watch for changes | | kgpvcw | `kgpvc --watch` | After listing/getting the requested object, watch for changes |
| kepvc | `kubectl edit pvc` | Edit pvcs from the default editor | | kepvc | `kubectl edit pvc` | Edit pvcs from the default editor |
| kdpvc | `kubectl describe pvc` | Descirbe all pvcs | | kdpvc | `kubectl describe pvc` | Describe all pvcs |
| kdelpvc | `kubectl delete pvc` | Delete all pvcs matching passed arguments | | kdelpvc | `kubectl delete pvc` | Delete all pvcs matching passed arguments |
| | | | | | | **StatefulSets management** |
| kgss | `kubectl get statefulset` | List the statefulsets in ps format | | kgss | `kubectl get statefulset` | List the statefulsets in ps format |
| kgssw | `kgss --watch` | After getting the list of statefulsets, watch for changes | | kgssw | `kgss --watch` | After getting the list of statefulsets, watch for changes |
| kgsswide| `kgss -o wide` | After getting the statefulsets, output in plain-text format with any additional information | | kgsswide| `kgss -o wide` | After getting the statefulsets, output in plain-text format with any additional information |
@@ -105,3 +106,26 @@ plugins=(... kubectl)
| kdelss | `kubectl delete statefulset` | Delete the statefulset | | kdelss | `kubectl delete statefulset` | Delete the statefulset |
| ksss | `kubectl scale statefulset` | Scale a statefulset | | ksss | `kubectl scale statefulset` | Scale a statefulset |
| krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment | | krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment |
| | | **Service Accounts management** |
| kgsa | `kubectl get sa` | List all service accounts |
| kdsa | `kubectl describe sa` | Describe a service account in details |
| kdelsa | `kubectl delete sa` | Delete the service account |
| | | **DaemonSet management** |
| kgds | `kubectl get daemonset` | List all DaemonSets in ps output format |
| kgdsw | `kgds --watch` | After listing all DaemonSets, watch for changes |
| keds | `kubectl edit daemonset` | Edit DaemonSets from the default editor |
| kdds | `kubectl describe daemonset` | Describe all DaemonSets in detail |
| kdelds | `kubectl delete daemonset` | Delete all DaemonSets matching passed argument |
| | | **CronJob management** |
| kgcj | `kubectl get cronjob` | List all CronJobs in ps output format |
| kecj | `kubectl edit cronjob` | Edit CronJob from the default editor |
| kdcj | `kubectl describe cronjob` | Describe a CronJob in details |
| kdelcj | `kubectl delete cronjob` | Delete the CronJob |
## Wrappers
This plugin provides 3 wrappers to colorize kubectl output in JSON and YAML using various tools (which must be installed):
- `kj`: JSON, colorized with [`jq`](https://stedolan.github.io/jq/).
- `kjx`: JSON, colorized with [`fx`](https://github.com/antonmedv/fx).
- `ky`: YAML, colorized with [`yh`](https://github.com/andreazorzetto/yh).
@@ -1,7 +1,7 @@
if (( $+commands[kubectl] )); then if (( $+commands[kubectl] )); then
__KUBECTL_COMPLETION_FILE="${ZSH_CACHE_DIR}/kubectl_completion" __KUBECTL_COMPLETION_FILE="${ZSH_CACHE_DIR}/kubectl_completion"
if [[ ! -f $__KUBECTL_COMPLETION_FILE ]]; then if [[ ! -f $__KUBECTL_COMPLETION_FILE || ! -s $__KUBECTL_COMPLETION_FILE ]]; then
kubectl completion zsh >! $__KUBECTL_COMPLETION_FILE kubectl completion zsh >! $__KUBECTL_COMPLETION_FILE
fi fi
@@ -47,6 +47,9 @@ alias kdelp='kubectl delete pods'
# get pod by label: kgpl "app=myapp" -n myns # get pod by label: kgpl "app=myapp" -n myns
alias kgpl='kgp -l' alias kgpl='kgp -l'
# get pod by namespace: kgpn kube-system"
alias kgpn='kgp -n'
# Service management. # Service management.
alias kgs='kubectl get svc' alias kgs='kubectl get svc'
alias kgsa='kubectl get svc --all-namespaces' alias kgsa='kubectl get svc --all-namespaces'
@@ -147,3 +150,31 @@ alias kepvc='kubectl edit pvc'
alias kdpvc='kubectl describe pvc' alias kdpvc='kubectl describe pvc'
alias kdelpvc='kubectl delete pvc' alias kdelpvc='kubectl delete pvc'
# Service account management.
alias kgsa="kubectl get sa"
alias kdsa="kubectl describe sa"
alias kdelsa="kubectl delete sa"
# DaemonSet management.
alias kgds='kubectl get daemonset'
alias kgdsw='kgds --watch'
alias keds='kubectl edit daemonset'
alias kdds='kubectl describe daemonset'
alias kdelds='kubectl delete daemonset'
# CronJob management.
alias kgcj='kubectl get cronjob'
alias kecj='kubectl edit cronjob'
alias kdcj='kubectl describe cronjob'
alias kdelcj='kubectl delete cronjob'
# Only run if the user actually has kubectl installed
if (( ${+_comps[kubectl]} )); then
kj() { kubectl "$@" -o json | jq; }
kjx() { kubectl "$@" -o json | fx; }
ky() { kubectl "$@" -o yaml | yh; }
compdef kj=kubectl
compdef kjx=kubectl
compdef ky=kubectl
fi
@@ -1,20 +1,19 @@
# Alias
alias la5='php artisan'
alias la5cache='php artisan cache:clear'
alias la5routes='php artisan route:list'
alias la5vendor='php artisan vendor:publish'
# Laravel5 basic command completion # Laravel5 basic command completion
_laravel5_get_command_list () { _laravel5_get_command_list () {
php artisan --raw --no-ansi list | sed "s/[[:space:]].*//g" php artisan --raw --no-ansi list | sed "s/[[:space:]].*//g"
} }
_laravel5 () { _laravel5 () {
if [ -f artisan ]; then if [[ -f artisan ]]; then
compadd `_laravel5_get_command_list` compadd $(_laravel5_get_command_list)
fi fi
} }
compdef _laravel5 artisan compdef _laravel5 artisan
compdef _laravel5 la5 compdef _laravel5 la5
#Alias
alias la5='php artisan'
alias la5cache='php artisan cache:clear'
alias la5routes='php artisan route:list'
alias la5vendor='php artisan vendor:publish'
@@ -3,7 +3,6 @@
# Pressing enter in a git directory runs `git status` # Pressing enter in a git directory runs `git status`
# in other directories `ls` # in other directories `ls`
magic-enter () { magic-enter () {
# If commands are not already set, use the defaults # If commands are not already set, use the defaults
[ -z "$MAGIC_ENTER_GIT_COMMAND" ] && MAGIC_ENTER_GIT_COMMAND="git status -u ." [ -z "$MAGIC_ENTER_GIT_COMMAND" ] && MAGIC_ENTER_GIT_COMMAND="git status -u ."
[ -z "$MAGIC_ENTER_OTHER_COMMAND" ] && MAGIC_ENTER_OTHER_COMMAND="ls -lh ." [ -z "$MAGIC_ENTER_OTHER_COMMAND" ] && MAGIC_ENTER_OTHER_COMMAND="ls -lh ."
@@ -20,5 +19,9 @@ magic-enter () {
zle accept-line zle accept-line
fi fi
} }
zle -N magic-enter zle -N magic-enter
bindkey "^M" magic-enter
bindkey -M emacs "^M" magic-enter
bindkey -M vicmd "^M" magic-enter
bindkey -M viins "^M" magic-enter
@@ -16,16 +16,22 @@ man-command-line() {
# if there is no command typed, use the last command # if there is no command typed, use the last command
[[ -z "$BUFFER" ]] && zle up-history [[ -z "$BUFFER" ]] && zle up-history
# prepend man to only the first part of the typed command # if typed command begins with man, do nothing
[[ "$BUFFER" = man\ * ]] && return
# get command and possible subcommand
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags
[[ "$BUFFER" != man\ * ]] && BUFFER="man ${${(Az)BUFFER}[1]}" local -a args
args=(${${(Az)BUFFER}[1]} ${${(Az)BUFFER}[2]})
# check if man page exists for command and first argument
if man "${args[1]}-${args[2]}" >/dev/null 2>&1; then
BUFFER="man $args"
else
BUFFER="man ${args[1]}"
fi
} }
zle -N man-command-line zle -N man-command-line
# Defined shortcut keys: [Esc]man # Defined shortcut keys: [Esc]man
bindkey "\e"man man-command-line bindkey "\e"man man-command-line
# ------------------------------------------------------------------------------
# Also, you might want to use man-preview included in 'osx' plugin
# just substitute "man" in the function with "man-preview" after you included OS X in
# the .zshrc
@@ -1,13 +1,13 @@
# Autocompletion for Minikube. # Autocompletion for Minikube.
# #
if (( $+commands[minikube] )); then if (( $+commands[minikube] )); then
__MINICUBE_COMPLETION_FILE="${ZSH_CACHE_DIR}/minicube_completion" __MINIKUBE_COMPLETION_FILE="${ZSH_CACHE_DIR}/minikube_completion"
if [[ ! -f $__MINICUBE_COMPLETION_FILE ]]; then if [[ ! -f $__MINIKUBE_COMPLETION_FILE ]]; then
minikube completion zsh >! $__MINICUBE_COMPLETION_FILE minikube completion zsh >! $__MINIKUBE_COMPLETION_FILE
fi fi
[[ -f $__MINICUBE_COMPLETION_FILE ]] && source $__MINICUBE_COMPLETION_FILE [[ -f $__MINIKUBE_COMPLETION_FILE ]] && source $__MINIKUBE_COMPLETION_FILE
unset __MINICUBE_COMPLETION_FILE unset __MINIKUBE_COMPLETION_FILE
fi fi
@@ -12,7 +12,7 @@ _mix_does_task_list_need_generating () {
} }
_mix_generate () { _mix_generate () {
mix help | grep -v 'iex -S' | tail -n +2 | cut -d " " -f 2 > .mix_tasks mix help | grep '^mix [^ ]' | sed -E "s/mix ([^ ]*) *# (.*)/\1:\2/" > .mix_tasks
} }
_mix () { _mix () {
@@ -21,7 +21,8 @@ _mix () {
echo "\nGenerating .mix_tasks..." > /dev/stderr echo "\nGenerating .mix_tasks..." > /dev/stderr
_mix_generate _mix_generate
fi fi
compadd `cat .mix_tasks` local tasks=(${(f)"$(cat .mix_tasks)"})
_describe 'tasks' tasks
fi fi
} }

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