Commit f4c442e7d64286914a09505770f3888be768622c
1 parent
4f87835bac
Exists in
master
and in
1 other branch
Squashed 'repos/robbyrussell/oh-my-zsh/' changes from e44aa50..22632aa
22632aa Merge pull request #3859 from gnagy/master 249d222 Cleanup gradle plugin file 950bbcc gradle plugin: also list tasks in subprojects 64e1252 Merge pull request #4623 from apjanke/dircycle-remove-redundant-bindings 5d8fd93 Merge pull request #4617 from ahmadawais/patch-1 7627004 Merge pull request #4612 from stereodenis/patch-1 5289edc Merge pull request #4592 from jstnlef/fix-weird-unstaged-behavior c120417 Merge pull request #4619 from apjanke/mercurial-readme-tweak c8e280f dircycle: remove redundant key bindings 8f823c6 Update README.md cca422e Mercurial plugin: revise README 602cc62 Removed Similar Aliases bee79f0 bundle outdated alias 135c376 Merge pull request #4563 from danhawkins/master 9041a23 Merge pull request #4598 from syk0saje/patch-1 06db648 typo: able take -> able to take 76c4238 I noticed that for certain projects with unstaged changed I would get a 'U' character instead of the '●' character. This should fix that. 8d388e4 use capit instead of shipit as shipit conflicts with npm package shipit git-subtree-dir: repos/robbyrussell/oh-my-zsh git-subtree-split: 22632aac7c99e02ec38223c84b2348435a82d1b5
Showing 10 changed files with 39 additions and 64 deletions Inline Diff
- README.markdown
- plugins/bundler/bundler.plugin.zsh
- plugins/capistrano/_capistrano
- plugins/capistrano/capistrano.plugin.zsh
- plugins/dircycle/dircycle.plugin.zsh
- plugins/gradle/gradle.plugin.zsh
- plugins/mercurial/README.md
- plugins/wp-cli/README.md
- plugins/wp-cli/wp-cli.plugin.zsh
- themes/agnoster.zsh-theme
README.markdown
| 1 |  | 1 |  |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration. That sounds boring. Let's try this again. | 4 | Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration. That sounds boring. Let's try this again. |
| 5 | 5 | ||
| 6 | __Oh My Zsh is a way of life!__ Once installed, your terminal prompt will become the talk of the town _or your money back!_ Each time you interact with your command prompt, you'll be able take advantage of the hundreds of bundled plugins and pretty themes. Strangers will come up to you in cafés and ask you, _"that is amazing. are you some sort of genius?"_ Finally, you'll begin to get the sort of attention that you always felt that you deserved. ...or maybe you'll just use the time that you saved to start flossing more often. | 6 | __Oh My Zsh is a way of life!__ Once installed, your terminal prompt will become the talk of the town _or your money back!_ Each time you interact with your command prompt, you'll be able to take advantage of the hundreds of bundled plugins and pretty themes. Strangers will come up to you in cafés and ask you, _"that is amazing. are you some sort of genius?"_ Finally, you'll begin to get the sort of attention that you always felt that you deserved. ...or maybe you'll just use the time that you saved to start flossing more often. |
| 7 | 7 | ||
| 8 | To learn more, visit [ohmyz.sh](http://ohmyz.sh) and/or follow [ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. | 8 | To learn more, visit [ohmyz.sh](http://ohmyz.sh) and/or follow [ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. |
| 9 | 9 | ||
| 10 | ## Getting Started | 10 | ## Getting Started |
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | ### Prerequisites | 13 | ### Prerequisites |
| 14 | 14 | ||
| 15 | __Disclaimer:__ _Oh My Zsh works best on Mac OS X and Linux._ | 15 | __Disclaimer:__ _Oh My Zsh works best on Mac OS X and Linux._ |
| 16 | 16 | ||
| 17 | * Unix-based operating system (Mac OS X or Linux) | 17 | * Unix-based operating system (Mac OS X or Linux) |
| 18 | * [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing-ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH) | 18 | * [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing-ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH) |
| 19 | * `curl` or `wget` should be installed | 19 | * `curl` or `wget` should be installed |
| 20 | * `git` should be installed | 20 | * `git` should be installed |
| 21 | 21 | ||
| 22 | ### Basic Installation | 22 | ### Basic Installation |
| 23 | 23 | ||
| 24 | 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`. | 24 | 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`. |
| 25 | 25 | ||
| 26 | #### via curl | 26 | #### via curl |
| 27 | 27 | ||
| 28 | ```shell | 28 | ```shell |
| 29 | sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | 29 | sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" |
| 30 | ``` | 30 | ``` |
| 31 | 31 | ||
| 32 | #### via wget | 32 | #### via wget |
| 33 | 33 | ||
| 34 | ```shell | 34 | ```shell |
| 35 | sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" | 35 | sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" |
| 36 | ``` | 36 | ``` |
| 37 | 37 | ||
| 38 | ## Using Oh My Zsh | 38 | ## Using Oh My Zsh |
| 39 | 39 | ||
| 40 | ### Plugins | 40 | ### Plugins |
| 41 | 41 | ||
| 42 | Oh My Zsh comes with a shit load of plugins to take advantage of. You can take a look in the [plugins](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins) directory and/or the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins) to see what's currently available. | 42 | Oh My Zsh comes with a shit load of plugins to take advantage of. You can take a look in the [plugins](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins) directory and/or the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins) to see what's currently available. |
| 43 | 43 | ||
| 44 | #### Enabling Plugins | 44 | #### Enabling Plugins |
| 45 | 45 | ||
| 46 | If you spot a plugin (or several) that you would like to use with Oh My Zsh, you will need to edit the `~/.zshrc` file. Once you open it with your favorite editor, you'll see a spot to list all the plugins that you'd like Oh My Zsh to load in initialization. | 46 | If you spot a plugin (or several) that you would like to use with Oh My Zsh, you will need to edit the `~/.zshrc` file. Once you open it with your favorite editor, you'll see a spot to list all the plugins that you'd like Oh My Zsh to load in initialization. |
| 47 | 47 | ||
| 48 | For example, this line might begin to look like... | 48 | For example, this line might begin to look like... |
| 49 | 49 | ||
| 50 | ```shell | 50 | ```shell |
| 51 | plugins=(git bundler osx rake ruby) | 51 | plugins=(git bundler osx rake ruby) |
| 52 | ``` | 52 | ``` |
| 53 | 53 | ||
| 54 | #### Using Plugins | 54 | #### Using Plugins |
| 55 | 55 | ||
| 56 | Most plugins (should! we're working on this) include a __README__, which documents how to use them. | 56 | Most plugins (should! we're working on this) include a __README__, which documents how to use them. |
| 57 | 57 | ||
| 58 | ### Themes | 58 | ### Themes |
| 59 | 59 | ||
| 60 | 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://wiki.github.com/robbyrussell/oh-my-zsh/themes) on the wiki. Check them out! | 60 | 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://wiki.github.com/robbyrussell/oh-my-zsh/themes) on the wiki. Check them out! |
| 61 | 61 | ||
| 62 | #### Selecting a Theme | 62 | #### Selecting a Theme |
| 63 | 63 | ||
| 64 | _Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just right (for him)._ | 64 | _Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just right (for him)._ |
| 65 | 65 | ||
| 66 | Once you find a theme that you want to use, you will need to edit the `~/.zshrc` file. You'll see an environment variable (all caps) in there that looks like: | 66 | Once you find a theme that you want to use, you will need to edit the `~/.zshrc` file. You'll see an environment variable (all caps) in there that looks like: |
| 67 | 67 | ||
| 68 | ```shell | 68 | ```shell |
| 69 | ZSH_THEME="robbyrussell" | 69 | ZSH_THEME="robbyrussell" |
| 70 | ``` | 70 | ``` |
| 71 | 71 | ||
| 72 | To use a different theme, simply change the value to match the name of your desired theme. For example: | 72 | To use a different theme, simply change the value to match the name of your desired theme. For example: |
| 73 | 73 | ||
| 74 | ```shell | 74 | ```shell |
| 75 | ZSH_THEME="agnoster" # (this is one of the fancy ones) | 75 | ZSH_THEME="agnoster" # (this is one of the fancy ones) |
| 76 | ``` | 76 | ``` |
| 77 | 77 | ||
| 78 | Open up a new terminal window and your prompt should look something like... | 78 | Open up a new terminal window and your prompt should look something like... |
| 79 | 79 | ||
| 80 |  | 80 |  |
| 81 | 81 | ||
| 82 | In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes). | 82 | In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes). |
| 83 | 83 | ||
| 84 | If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window. | 84 | If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window. |
| 85 | 85 | ||
| 86 | 86 | ||
| 87 | ```shell | 87 | ```shell |
| 88 | ZSH_THEME="random" # (...please let it be pie... please be some pie..) | 88 | ZSH_THEME="random" # (...please let it be pie... please be some pie..) |
| 89 | ``` | 89 | ``` |
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | ## Advanced Topics | 92 | ## Advanced Topics |
| 93 | 93 | ||
| 94 | If you're the type that likes to get their hands dirty, these sections might resonate. | 94 | If you're the type that likes to get their hands dirty, these sections might resonate. |
| 95 | 95 | ||
| 96 | ### Advanced Installation | 96 | ### Advanced Installation |
| 97 | 97 | ||
| 98 | Some users may want to change the default path, or manually install Oh My Zsh. | 98 | Some users may want to change the default path, or manually install Oh My Zsh. |
| 99 | 99 | ||
| 100 | #### Custom Directory | 100 | #### Custom Directory |
| 101 | 101 | ||
| 102 | The default location is `~/.oh-my-zsh` (hidden in your home directory) | 102 | The default location is `~/.oh-my-zsh` (hidden in your home directory) |
| 103 | 103 | ||
| 104 | If you'd like to change the install directory with the `ZSH` environment variable, either by running `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this: | 104 | If you'd like to change the install directory with the `ZSH` environment variable, either by running `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this: |
| 105 | 105 | ||
| 106 | ```shell | 106 | ```shell |
| 107 | export ZSH="~/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | 107 | export ZSH="~/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" |
| 108 | ``` | 108 | ``` |
| 109 | 109 | ||
| 110 | #### Manual Installation | 110 | #### Manual Installation |
| 111 | 111 | ||
| 112 | ##### 1. Clone the repository: | 112 | ##### 1. Clone the repository: |
| 113 | 113 | ||
| 114 | ```shell | 114 | ```shell |
| 115 | git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh | 115 | git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh |
| 116 | ``` | 116 | ``` |
| 117 | 117 | ||
| 118 | ##### 2. *Optionally*, backup your existing `~/.zshrc` file: | 118 | ##### 2. *Optionally*, backup your existing `~/.zshrc` file: |
| 119 | 119 | ||
| 120 | ```shell | 120 | ```shell |
| 121 | cp ~/.zshrc ~/.zshrc.orig | 121 | cp ~/.zshrc ~/.zshrc.orig |
| 122 | ``` | 122 | ``` |
| 123 | 123 | ||
| 124 | ##### 3. Create a new zsh configuration file | 124 | ##### 3. Create a new zsh configuration file |
| 125 | 125 | ||
| 126 | You can create a new zsh config file by copying the template that we included for you. | 126 | You can create a new zsh config file by copying the template that we included for you. |
| 127 | 127 | ||
| 128 | ```shell | 128 | ```shell |
| 129 | cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc | 129 | cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc |
| 130 | ``` | 130 | ``` |
| 131 | 131 | ||
| 132 | ##### 4. Change your default shell | 132 | ##### 4. Change your default shell |
| 133 | 133 | ||
| 134 | ```shell | 134 | ```shell |
| 135 | chsh -s /bin/zsh | 135 | chsh -s /bin/zsh |
| 136 | ``` | 136 | ``` |
| 137 | 137 | ||
| 138 | ##### 5. Initialize your new zsh configuration | 138 | ##### 5. Initialize your new zsh configuration |
| 139 | 139 | ||
| 140 | Once you open up a new terminal window, it should load zsh with Oh My Zsh's configuration. | 140 | Once you open up a new terminal window, it should load zsh with Oh My Zsh's configuration. |
| 141 | 141 | ||
| 142 | ### Installation Problems | 142 | ### Installation Problems |
| 143 | 143 | ||
| 144 | If you have any hiccups installing, here are a few common fixes. | 144 | If you have any hiccups installing, here are a few common fixes. |
| 145 | 145 | ||
| 146 | * You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after switching to `oh-my-zsh`. | 146 | * You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after switching to `oh-my-zsh`. |
| 147 | * If you installed manually or changed the install location, check the `ZSH` environment variable in `~/.zshrc`. | 147 | * If you installed manually or changed the install location, check the `ZSH` environment variable in `~/.zshrc`. |
| 148 | 148 | ||
| 149 | ### Custom Plugins and Themes | 149 | ### Custom Plugins and Themes |
| 150 | 150 | ||
| 151 | If you want to override any of the default behaviors, just add a new file (ending in `.zsh`) in the `custom/` directory. | 151 | If you want to override any of the default behaviors, just add a new file (ending in `.zsh`) in the `custom/` directory. |
| 152 | 152 | ||
| 153 | If you have many functions that go well together, you can put them as a `XYZ.plugin.zsh` file in the `custom/plugins/` directory and then enable this plugin. | 153 | If you have many functions that go well together, you can put them as a `XYZ.plugin.zsh` file in the `custom/plugins/` directory and then enable this plugin. |
| 154 | 154 | ||
| 155 | If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`. | 155 | If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`. |
| 156 | 156 | ||
| 157 | ## Getting Updates | 157 | ## Getting Updates |
| 158 | 158 | ||
| 159 | By default, you will be prompted to check for upgrades every few weeks. If you would like `oh-my-zsh` to automatically upgrade itself without prompting you, set the following in your `~/.zshrc`: | 159 | By default, you will be prompted to check for upgrades every few weeks. If you would like `oh-my-zsh` to automatically upgrade itself without prompting you, set the following in your `~/.zshrc`: |
| 160 | 160 | ||
| 161 | ```shell | 161 | ```shell |
| 162 | DISABLE_UPDATE_PROMPT=true | 162 | DISABLE_UPDATE_PROMPT=true |
| 163 | ``` | 163 | ``` |
| 164 | 164 | ||
| 165 | To disable automatic upgrades, set the following in your `~/.zshrc`: | 165 | To disable automatic upgrades, set the following in your `~/.zshrc`: |
| 166 | 166 | ||
| 167 | ```shell | 167 | ```shell |
| 168 | DISABLE_AUTO_UPDATE=true | 168 | DISABLE_AUTO_UPDATE=true |
| 169 | ``` | 169 | ``` |
| 170 | 170 | ||
| 171 | ### Manual Updates | 171 | ### Manual Updates |
| 172 | 172 | ||
| 173 | 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: | 173 | 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: |
| 174 | 174 | ||
| 175 | ```shell | 175 | ```shell |
| 176 | upgrade_oh_my_zsh | 176 | upgrade_oh_my_zsh |
| 177 | ``` | 177 | ``` |
| 178 | 178 | ||
| 179 | Magic! | 179 | Magic! |
| 180 | 180 | ||
| 181 | ## Uninstalling Oh My Zsh | 181 | ## Uninstalling Oh My Zsh |
| 182 | 182 | ||
| 183 | Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy breakup. | 183 | Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy breakup. |
| 184 | 184 | ||
| 185 | If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the command-line. It will remove itself and revert your previous `bash` or `zsh` configuration. | 185 | If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the command-line. It will remove itself and revert your previous `bash` or `zsh` configuration. |
| 186 | 186 | ||
| 187 | ## Contributing | 187 | ## Contributing |
| 188 | 188 | ||
| 189 | I'm far from being a [Zsh](http://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests! | 189 | I'm far from being a [Zsh](http://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests! |
| 190 | 190 | ||
| 191 | We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/robbyrussell/oh-my-zsh/issues) and help where you can. | 191 | We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/robbyrussell/oh-my-zsh/issues) and help where you can. |
| 192 | 192 | ||
| 193 | ### Do NOT send us themes | 193 | ### Do NOT send us themes |
| 194 | 194 | ||
| 195 | We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes) wiki page. | 195 | We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes) wiki page. |
| 196 | 196 | ||
| 197 | ## Contributors | 197 | ## Contributors |
| 198 | 198 | ||
| 199 | Oh My Zsh has a vibrant community of happy users and delightful contributors. Without all the time and help from our contributors, it wouldn't be so awesome. | 199 | Oh My Zsh has a vibrant community of happy users and delightful contributors. Without all the time and help from our contributors, it wouldn't be so awesome. |
| 200 | 200 | ||
| 201 | Thank you so much! | 201 | Thank you so much! |
| 202 | 202 | ||
| 203 | ## Follow Us | 203 | ## Follow Us |
| 204 | 204 | ||
| 205 | We have an [@ohmyzsh](https://twitter.com/ohmyzsh) Twitter account. You should follow it. | 205 | We have an [@ohmyzsh](https://twitter.com/ohmyzsh) Twitter account. You should follow it. |
| 206 | 206 | ||
| 207 | ## Merchandise | 207 | ## Merchandise |
| 208 | 208 | ||
| 209 | We have [stickers](http://shop.planetargon.com/products/ohmyzsh-stickers-set-of-3-stickers) and [shirts](http://shop.planetargon.com/products/ohmyzsh-t-shirts) for you to show off your love of Oh My Zsh. Again, this will help you become the talk of the town! | 209 | We have [stickers](http://shop.planetargon.com/products/ohmyzsh-stickers-set-of-3-stickers) and [shirts](http://shop.planetargon.com/products/ohmyzsh-t-shirts) for you to show off your love of Oh My Zsh. Again, this will help you become the talk of the town! |
| 210 | 210 | ||
| 211 | ## License | 211 | ## License |
| 212 | 212 | ||
| 213 | Oh My Zsh is released under the [MIT license](https://github.com/robbyrussell/oh-my-zsh/blob/master/MIT-LICENSE.txt). | 213 | Oh My Zsh is released under the [MIT license](https://github.com/robbyrussell/oh-my-zsh/blob/master/MIT-LICENSE.txt). |
| 214 | 214 |
plugins/bundler/bundler.plugin.zsh
| 1 | alias be="bundle exec" | 1 | alias be="bundle exec" |
| 2 | alias bl="bundle list" | 2 | alias bl="bundle list" |
| 3 | alias bp="bundle package" | 3 | alias bp="bundle package" |
| 4 | alias bo="bundle open" | 4 | alias bo="bundle open" |
| 5 | alias bout="bundle outdated" | ||
| 5 | alias bu="bundle update" | 6 | alias bu="bundle update" |
| 6 | alias bi="bundle_install" | 7 | alias bi="bundle_install" |
| 7 | alias bcn="bundle clean" | 8 | alias bcn="bundle clean" |
| 8 | 9 | ||
| 9 | bundled_commands=( | 10 | bundled_commands=( |
| 10 | annotate | 11 | annotate |
| 11 | cap | 12 | cap |
| 12 | capify | 13 | capify |
| 13 | cucumber | 14 | cucumber |
| 14 | foodcritic | 15 | foodcritic |
| 15 | guard | 16 | guard |
| 16 | irb | 17 | irb |
| 17 | jekyll | 18 | jekyll |
| 18 | kitchen | 19 | kitchen |
| 19 | knife | 20 | knife |
| 20 | middleman | 21 | middleman |
| 21 | nanoc | 22 | nanoc |
| 22 | pry | 23 | pry |
| 23 | puma | 24 | puma |
| 24 | rackup | 25 | rackup |
| 25 | rainbows | 26 | rainbows |
| 26 | rake | 27 | rake |
| 27 | rspec | 28 | rspec |
| 28 | shotgun | 29 | shotgun |
| 29 | sidekiq | 30 | sidekiq |
| 30 | spec | 31 | spec |
| 31 | spork | 32 | spork |
| 32 | spring | 33 | spring |
| 33 | strainer | 34 | strainer |
| 34 | tailor | 35 | tailor |
| 35 | taps | 36 | taps |
| 36 | thin | 37 | thin |
| 37 | thor | 38 | thor |
| 38 | unicorn | 39 | unicorn |
| 39 | unicorn_rails | 40 | unicorn_rails |
| 40 | ) | 41 | ) |
| 41 | 42 | ||
| 42 | # Remove $UNBUNDLED_COMMANDS from the bundled_commands list | 43 | # Remove $UNBUNDLED_COMMANDS from the bundled_commands list |
| 43 | for cmd in $UNBUNDLED_COMMANDS; do | 44 | for cmd in $UNBUNDLED_COMMANDS; do |
| 44 | bundled_commands=(${bundled_commands#$cmd}); | 45 | bundled_commands=(${bundled_commands#$cmd}); |
| 45 | done | 46 | done |
| 46 | 47 | ||
| 47 | # Add $BUNDLED_COMMANDS to the bundled_commands list | 48 | # Add $BUNDLED_COMMANDS to the bundled_commands list |
| 48 | for cmd in $BUNDLED_COMMANDS; do | 49 | for cmd in $BUNDLED_COMMANDS; do |
| 49 | bundled_commands+=($cmd); | 50 | bundled_commands+=($cmd); |
| 50 | done | 51 | done |
| 51 | 52 | ||
| 52 | ## Functions | 53 | ## Functions |
| 53 | 54 | ||
| 54 | bundle_install() { | 55 | bundle_install() { |
| 55 | if _bundler-installed && _within-bundled-project; then | 56 | if _bundler-installed && _within-bundled-project; then |
| 56 | local bundler_version=`bundle version | cut -d' ' -f3` | 57 | local bundler_version=`bundle version | cut -d' ' -f3` |
| 57 | if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then | 58 | if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then |
| 58 | if [[ "$OSTYPE" = darwin* ]] | 59 | if [[ "$OSTYPE" = darwin* ]] |
| 59 | then | 60 | then |
| 60 | local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" | 61 | local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" |
| 61 | else | 62 | else |
| 62 | local cores_num="$(nproc)" | 63 | local cores_num="$(nproc)" |
| 63 | fi | 64 | fi |
| 64 | bundle install --jobs=$cores_num $@ | 65 | bundle install --jobs=$cores_num $@ |
| 65 | else | 66 | else |
| 66 | bundle install $@ | 67 | bundle install $@ |
| 67 | fi | 68 | fi |
| 68 | else | 69 | else |
| 69 | echo "Can't 'bundle install' outside a bundled project" | 70 | echo "Can't 'bundle install' outside a bundled project" |
| 70 | fi | 71 | fi |
| 71 | } | 72 | } |
| 72 | 73 | ||
| 73 | _bundler-installed() { | 74 | _bundler-installed() { |
| 74 | which bundle > /dev/null 2>&1 | 75 | which bundle > /dev/null 2>&1 |
| 75 | } | 76 | } |
| 76 | 77 | ||
| 77 | _within-bundled-project() { | 78 | _within-bundled-project() { |
| 78 | local check_dir="$PWD" | 79 | local check_dir="$PWD" |
| 79 | while [ "$check_dir" != "/" ]; do | 80 | while [ "$check_dir" != "/" ]; do |
| 80 | [ -f "$check_dir/Gemfile" ] && return | 81 | [ -f "$check_dir/Gemfile" ] && return |
| 81 | check_dir="$(dirname $check_dir)" | 82 | check_dir="$(dirname $check_dir)" |
| 82 | done | 83 | done |
| 83 | false | 84 | false |
| 84 | } | 85 | } |
| 85 | 86 | ||
| 86 | _binstubbed() { | 87 | _binstubbed() { |
| 87 | [ -f "./bin/${1}" ] | 88 | [ -f "./bin/${1}" ] |
| 88 | } | 89 | } |
| 89 | 90 | ||
| 90 | _run-with-bundler() { | 91 | _run-with-bundler() { |
| 91 | if _bundler-installed && _within-bundled-project; then | 92 | if _bundler-installed && _within-bundled-project; then |
| 92 | if _binstubbed $1; then | 93 | if _binstubbed $1; then |
| 93 | ./bin/$@ | 94 | ./bin/$@ |
| 94 | else | 95 | else |
| 95 | bundle exec $@ | 96 | bundle exec $@ |
| 96 | fi | 97 | fi |
| 97 | else | 98 | else |
| 98 | $@ | 99 | $@ |
| 99 | fi | 100 | fi |
| 100 | } | 101 | } |
| 101 | 102 | ||
| 102 | ## Main program | 103 | ## Main program |
| 103 | for cmd in $bundled_commands; do | 104 | for cmd in $bundled_commands; do |
| 104 | eval "function unbundled_$cmd () { $cmd \$@ }" | 105 | eval "function unbundled_$cmd () { $cmd \$@ }" |
| 105 | eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" | 106 | eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" |
| 106 | alias $cmd=bundled_$cmd | 107 | alias $cmd=bundled_$cmd |
| 107 | 108 | ||
| 108 | if which _$cmd > /dev/null 2>&1; then | 109 | if which _$cmd > /dev/null 2>&1; then |
| 109 | compdef _$cmd bundled_$cmd=$cmd | 110 | compdef _$cmd bundled_$cmd=$cmd |
| 110 | fi | 111 | fi |
| 111 | done | 112 | done |
| 112 | 113 |
plugins/capistrano/_capistrano
| 1 | #compdef shipit | 1 | #compdef capit |
| 2 | #autoload | 2 | #autoload |
| 3 | 3 | ||
| 4 | # Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work. | 4 | # Added `capit` because `cap` is a reserved word. `cap` completion doesn't work. |
| 5 | # http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module | 5 | # http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module |
| 6 | 6 | ||
| 7 | local curcontext="$curcontext" state line ret=1 | 7 | local curcontext="$curcontext" state line ret=1 |
| 8 | local -a _configs | 8 | local -a _configs |
| 9 | 9 | ||
| 10 | _arguments -C \ | 10 | _arguments -C \ |
| 11 | '1: :->cmds' \ | 11 | '1: :->cmds' \ |
| 12 | '2:: :->args' && ret=0 | 12 | '2:: :->args' && ret=0 |
| 13 | 13 | ||
| 14 | _cap_tasks() { | 14 | _cap_tasks() { |
| 15 | if [[ -f config/deploy.rb || -f Capfile ]]; then | 15 | if [[ -f config/deploy.rb || -f Capfile ]]; then |
| 16 | if [[ ! -f .cap_tasks~ ]]; then | 16 | if [[ ! -f .cap_tasks~ ]]; then |
| 17 | shipit --tasks | sed 's/\(\[\)\(.*\)\(\]\)/\2:/' | awk '{command=$2; $1=$2=$3=""; gsub(/^[ \t\r\n]+/, "", $0); gsub(":", "\\:", command); print command"["$0"]"}' > .cap_tasks~ | 17 | capit --tasks | sed 's/\(\[\)\(.*\)\(\]\)/\2:/' | awk '{command=$2; $1=$2=$3=""; gsub(/^[ \t\r\n]+/, "", $0); gsub(":", "\\:", command); print command"["$0"]"}' > .cap_tasks~ |
| 18 | fi | 18 | fi |
| 19 | 19 | ||
| 20 | OLD_IFS=$IFS | 20 | OLD_IFS=$IFS |
| 21 | IFS=$'\n' | 21 | IFS=$'\n' |
| 22 | _values 'cap commands' $(< .cap_tasks~) | 22 | _values 'cap commands' $(< .cap_tasks~) |
| 23 | IFS=$OLD_IFS | 23 | IFS=$OLD_IFS |
| 24 | # zmodload zsh/mapfile | 24 | # zmodload zsh/mapfile |
| 25 | # _values ${(f)mapfile[.cap_tasks~]} | 25 | # _values ${(f)mapfile[.cap_tasks~]} |
| 26 | fi | 26 | fi |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | _cap_stages() { | 29 | _cap_stages() { |
| 30 | compadd $(find config/deploy -name \*.rb | cut -d/ -f3 | sed s:.rb::g) | 30 | compadd $(find config/deploy -name \*.rb | cut -d/ -f3 | sed s:.rb::g) |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | case $state in | 33 | case $state in |
| 34 | cmds) | 34 | cmds) |
| 35 | # check if it uses multistage | 35 | # check if it uses multistage |
| 36 | if [[ -d config/deploy ]]; then | 36 | if [[ -d config/deploy ]]; then |
| 37 | _cap_stages | 37 | _cap_stages |
| 38 | else | 38 | else |
| 39 | _cap_tasks | 39 | _cap_tasks |
| 40 | fi | 40 | fi |
| 41 | ret=0 | 41 | ret=0 |
| 42 | ;; | 42 | ;; |
| 43 | args) | 43 | args) |
| 44 | _cap_tasks | 44 | _cap_tasks |
| 45 | ret=0 | 45 | ret=0 |
| 46 | ;; | 46 | ;; |
| 47 | esac | 47 | esac |
| 48 | 48 | ||
| 49 | return ret | 49 | return ret |
| 50 | 50 |
plugins/capistrano/capistrano.plugin.zsh
| 1 | # Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work. | 1 | # Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work. |
| 2 | # http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module | 2 | # http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module |
| 3 | 3 | ||
| 4 | func shipit() { | 4 | func capit() { |
| 5 | if [ -f Gemfile ] | 5 | if [ -f Gemfile ] |
| 6 | then | 6 | then |
| 7 | bundle exec cap $* | 7 | bundle exec cap $* |
| 8 | else | 8 | else |
| 9 | cap $* | 9 | cap $* |
| 10 | fi | 10 | fi |
| 11 | } | 11 | } |
| 12 | 12 |
plugins/dircycle/dircycle.plugin.zsh
| 1 | # enables cycling through the directory stack using | 1 | # enables cycling through the directory stack using |
| 2 | # Ctrl+Shift+Left/Right | 2 | # Ctrl+Shift+Left/Right |
| 3 | # | 3 | # |
| 4 | # left/right direction follows the order in which directories | 4 | # left/right direction follows the order in which directories |
| 5 | # were visited, like left/right arrows do in a browser | 5 | # were visited, like left/right arrows do in a browser |
| 6 | 6 | ||
| 7 | # NO_PUSHD_MINUS syntax: | 7 | # NO_PUSHD_MINUS syntax: |
| 8 | # pushd +N: start counting from left of `dirs' output | 8 | # pushd +N: start counting from left of `dirs' output |
| 9 | # pushd -N: start counting from right of `dirs' output | 9 | # pushd -N: start counting from right of `dirs' output |
| 10 | 10 | ||
| 11 | insert-cycledleft () { | 11 | insert-cycledleft () { |
| 12 | emulate -L zsh | 12 | emulate -L zsh |
| 13 | setopt nopushdminus | 13 | setopt nopushdminus |
| 14 | 14 | ||
| 15 | builtin pushd -q +1 &>/dev/null || true | 15 | builtin pushd -q +1 &>/dev/null || true |
| 16 | zle reset-prompt | 16 | zle reset-prompt |
| 17 | } | 17 | } |
| 18 | zle -N insert-cycledleft | 18 | zle -N insert-cycledleft |
| 19 | 19 | ||
| 20 | insert-cycledright () { | 20 | insert-cycledright () { |
| 21 | emulate -L zsh | 21 | emulate -L zsh |
| 22 | setopt nopushdminus | 22 | setopt nopushdminus |
| 23 | 23 | ||
| 24 | builtin pushd -q -0 &>/dev/null || true | 24 | builtin pushd -q -0 &>/dev/null || true |
| 25 | zle reset-prompt | 25 | zle reset-prompt |
| 26 | } | 26 | } |
| 27 | zle -N insert-cycledright | 27 | zle -N insert-cycledright |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | # add key bindings for iTerm2 | ||
| 31 | if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then | ||
| 32 | bindkey "^[[1;6D" insert-cycledleft | ||
| 33 | bindkey "^[[1;6C" insert-cycledright | ||
| 34 | else | ||
| 35 | bindkey "\e[1;6D" insert-cycledleft | ||
| 36 | bindkey "\e[1;6C" insert-cycledright | ||
| 37 | fi | ||
| 30 | # These sequences work for xterm, Apple Terminal.app, and probably others. |
plugins/gradle/gradle.plugin.zsh
| 1 | #!zsh | ||
| 2 | ############################################################################## | 1 | ############################################################################## |
| 3 | # A descriptive listing of core Gradle commands | 2 | # A descriptive listing of core Gradle commands |
| 4 | ############################################################################ | 3 | ############################################################################ |
| 5 | function _gradle_core_commands() { | 4 | function _gradle_core_commands() { |
| 6 | local ret=1 state | 5 | local ret=1 state |
| 7 | _arguments ':subcommand:->subcommand' && ret=0 | 6 | _arguments ':subcommand:->subcommand' && ret=0 |
| 8 | 7 | ||
| 9 | case $state in | 8 | case $state in |
| 10 | subcommand) | 9 | subcommand) |
| 11 | subcommands=( | 10 | subcommands=( |
| 12 | "properties:Display all project properties" | 11 | "properties:Display all project properties" |
| 13 | "tasks:Calculate and display all tasks" | 12 | "tasks:Calculate and display all tasks" |
| 14 | "dependencies:Calculate and display all dependencies" | 13 | "dependencies:Calculate and display all dependencies" |
| 15 | "projects:Discover and display all sub-projects" | 14 | "projects:Discover and display all sub-projects" |
| 16 | "build:Build the project" | 15 | "build:Build the project" |
| 17 | "help:Display help" | 16 | "help:Display help" |
| 18 | ) | 17 | ) |
| 19 | _describe -t subcommands 'gradle subcommands' subcommands && ret=0 | 18 | _describe -t subcommands 'gradle subcommands' subcommands && ret=0 |
| 20 | esac | 19 | esac |
| 21 | 20 | ||
| 22 | return ret | 21 | return ret |
| 23 | } | 22 | } |
| 24 | 23 | ||
| 25 | function _gradle_arguments() { | 24 | function _gradle_arguments() { |
| 26 | _arguments -C \ | 25 | _arguments -C \ |
| 27 | '-a[Do not rebuild project dependencies]' \ | 26 | '-a[Do not rebuild project dependencies]' \ |
| 28 | '-h[Help]' \ | 27 | '-h[Help]' \ |
| 29 | '-D[System property]' \ | 28 | '-D[System property]' \ |
| 30 | '-d[Log at the debug level]' \ | 29 | '-d[Log at the debug level]' \ |
| 31 | '--gui[Launches the Gradle GUI app]' \ | 30 | '--gui[Launches the Gradle GUI app]' \ |
| 32 | '--stop[Stop the Gradle daemon]' \ | 31 | '--stop[Stop the Gradle daemon]' \ |
| 33 | '--daemon[Use the Gradle daemon]' \ | 32 | '--daemon[Use the Gradle daemon]' \ |
| 34 | '--no-daemon[Do not use the Gradle daemon]' \ | 33 | '--no-daemon[Do not use the Gradle daemon]' \ |
| 35 | '--rerun-task [Specifies that any task optimization is ignored.]' \ | 34 | '--rerun-task [Specifies that any task optimization is ignored.]' \ |
| 36 | '-i[Log at the info level]' \ | 35 | '-i[Log at the info level]' \ |
| 37 | '-m[Dry run]' \ | 36 | '-m[Dry run]' \ |
| 38 | '-P[Set a project property]' \ | 37 | '-P[Set a project property]' \ |
| 39 | '-p[Specifies the start directory]' \ | 38 | '-p[Specifies the start directory]' \ |
| 40 | '--profile[Profile the build time]' \ | 39 | '--profile[Profile the build time]' \ |
| 41 | '-q[Log at the quiet level (only show errors)]' \ | 40 | '-q[Log at the quiet level (only show errors)]' \ |
| 42 | '-v[Print the Gradle version info]' \ | 41 | '-v[Print the Gradle version info]' \ |
| 43 | '-x[Specify a task to be excluded]' \ | 42 | '-x[Specify a task to be excluded]' \ |
| 44 | '-b[Specifies the build file.]' \ | 43 | '-b[Specifies the build file.]' \ |
| 45 | '-c[Specifies the settings file.]' \ | 44 | '-c[Specifies the settings file.]' \ |
| 46 | '--continue[Continues task execution after a task failure.]' \ | 45 | '--continue[Continues task execution after a task failure.]' \ |
| 47 | '-g[Specifies the Gradle user home directory.]' \ | 46 | '-g[Specifies the Gradle user home directory.]' \ |
| 48 | '-I[Specifies an initialization script.]' \ | 47 | '-I[Specifies an initialization script.]' \ |
| 49 | '--refresh-dependencies[Refresh the state of dependencies.]' \ | 48 | '--refresh-dependencies[Refresh the state of dependencies.]' \ |
| 50 | '-u[Don''t search in parent directories for a settings.gradle file.]' \ | 49 | '-u[Don''t search in parent directories for a settings.gradle file.]' \ |
| 51 | '*::command:->command' \ | 50 | '*::command:->command' \ |
| 52 | && return 0 | 51 | && return 0 |
| 53 | } | 52 | } |
| 54 | 53 | ||
| 55 | 54 | ||
| 56 | ############################################################################## | 55 | ############################################################################## |
| 57 | # Are we in a directory containing a build.gradle file? | 56 | # Examine the build.gradle file to see if its timestamp has changed; |
| 58 | ############################################################################ | 57 | # and if so, regenerate the .gradle_tasks cache file |
| 59 | function in_gradle() { | ||
| 60 | if [[ -f build.gradle ]]; then | ||
| 61 | echo 1 | ||
| 62 | fi | ||
| 63 | } | ||
| 64 | |||
| 65 | ############################################################################## Examine the build.gradle file to see if its | ||
| 66 | # timestamp has changed, and if so, regen | ||
| 67 | # the .gradle_tasks cache file | ||
| 68 | ############################################################################ | 58 | ############################################################################ |
| 69 | _gradle_does_task_list_need_generating () { | 59 | _gradle_does_task_list_need_generating () { |
| 70 | [ ! -f .gradletasknamecache ] && return 0; | 60 | [[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache ]] |
| 71 | [ build.gradle -nt .gradletasknamecache ] && return 0; | ||
| 72 | return 1; | ||
| 73 | } | 61 | } |
| 74 | 62 | ||
| 75 | 63 | ||
| 76 | ############################################################################## | 64 | ############################################################################## |
| 77 | # Discover the gradle tasks by running "gradle tasks --all" | 65 | # Discover the gradle tasks by running "gradle tasks --all" |
| 78 | ############################################################################ | 66 | ############################################################################ |
| 79 | _gradle_tasks () { | 67 | _gradle_tasks () { |
| 80 | if [ in_gradle ]; then | 68 | if [[ -f build.gradle ]]; then |
| 81 | _gradle_arguments | 69 | _gradle_arguments |
| 82 | if _gradle_does_task_list_need_generating; then | 70 | if _gradle_does_task_list_need_generating; then |
| 83 | gradle tasks --all | grep "^[ ]*[a-zA-Z0-9:]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache | 71 | gradle tasks --all | awk '/[a-zA-Z0-9:-]* - / {print $1}' > .gradletasknamecache |
| 84 | fi | 72 | fi |
| 85 | compadd -X "==== Gradle Tasks ====" `cat .gradletasknamecache` | 73 | compadd -X "==== Gradle Tasks ====" $(cat .gradletasknamecache) |
| 86 | fi | 74 | fi |
| 87 | } | 75 | } |
| 88 | 76 | ||
| 89 | _gradlew_tasks () { | 77 | _gradlew_tasks () { |
| 90 | if [ in_gradle ]; then | 78 | if [[ -f build.gradle ]]; then |
| 91 | _gradle_arguments | 79 | _gradle_arguments |
| 92 | if _gradle_does_task_list_need_generating; then | 80 | if _gradle_does_task_list_need_generating; then |
| 93 | ./gradlew tasks --all | grep "^[ ]*[a-zA-Z0-9:]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache | 81 | ./gradlew tasks --all | awk '/[a-zA-Z0-9:-]* - / {print $1}' > .gradletasknamecache |
| 94 | fi | 82 | fi |
| 95 | compadd -X "==== Gradlew Tasks ====" `cat .gradletasknamecache` | 83 | compadd -X "==== Gradlew Tasks ====" $(cat .gradletasknamecache) |
| 96 | fi | 84 | fi |
| 97 | } | 85 | } |
| 98 | 86 | ||
| 99 | 87 | ||
| 100 | ############################################################################## | 88 | ############################################################################## |
| 101 | # Register the completions against the gradle and gradlew commands | 89 | # Register the completions against the gradle and gradlew commands |
| 102 | ############################################################################ | 90 | ############################################################################ |
| 103 | compdef _gradle_tasks gradle | 91 | compdef _gradle_tasks gradle |
| 104 | compdef _gradlew_tasks gradlew | 92 | compdef _gradlew_tasks gradlew |
| 105 | |||
| 106 | |||
| 107 | ############################################################################## | ||
| 108 | # Open questions for future improvements: | ||
| 109 | # 1) Should 'gradle tasks' use --all or just the regular set? | ||
| 110 | # 2) Should gradlew use the same approach as gradle? | ||
| 111 | # 3) Should only the " - " be replaced with a colon so it can work | ||
| 112 | # with the richer descriptive method of _arguments? | ||
| 113 | # gradle tasks | grep "^[a-zA-Z0-9]*\ -\ " | sed "s/ - /\:/" | ||
| 114 | ############################################################################# | ||
| 115 | 93 |
plugins/mercurial/README.md
| 1 | # Mercurial plugin | 1 | # Mercurial plugin |
| 2 | ### Usage | 2 | ### Usage |
| 3 | Update .zshrc: | 3 | Update .zshrc: |
| 4 | 4 | ||
| 5 | 1. Add name to the list of plugins, e.g. `plugins = (..., mercurial, ...)` | 5 | 1. Add name to the list of plugins, e.g. `plugins=(... mercurial ...)` |
| 6 | (that is pretty obvious). | 6 | (that is pretty obvious). |
| 7 | 2. Change PROMPT variable of current theme to contain current folder mercurial repo info: | 7 | 2. Switch to a theme which uses `hg_prompt_info`. |
| 8 | 8 | ||
| 9 | robbyrussel theme is used by default, so you need to modify PROMPT var | 9 | Or, customize the `$PROMPT` variable of your current theme to contain current folder mercurial repo info. This can be done by putting a custom version of the theme in `$ZSH_CUSTOM` or by changing `$PROMPT` in `.zshrc` after loading the theme. |
| 10 | from [this file](https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/robbyrussell.zsh-theme) | ||
| 11 | by adding `$(hg_prompt_info)` after `$(git_prompt_info)`, so currently it | ||
| 12 | looks next: | ||
| 13 | 10 | ||
| 14 | ```diff | 11 | The `robbyrussell` theme is used by default, so you need to modify `$PROMPT` var by adding `$(hg_prompt_info)` after `$(git_prompt_info)`, so it looks like this: |
| 15 | - PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' | 12 | |
| 16 | + PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' | 13 | ```zsh |
| 14 | PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' | ||
| 17 | ``` | 15 | ``` |
| 18 | 16 | ||
| 19 | and put modified var at the end of **.zshrc**. | ||
| 20 | 3. Initialize additional vars used in plugin. So in short put next in **.zshrc**: | 17 | 3. Initialize additional vars used in plugin. So in short put next in **.zshrc**: |
| 21 | 18 | ||
| 22 | ``` | 19 | ``` |
| 23 | ZSH_THEME_HG_PROMPT_PREFIX="%{$fg_bold[magenta]%}hg:(%{$fg[red]%}" | 20 | ZSH_THEME_HG_PROMPT_PREFIX="%{$fg_bold[magenta]%}hg:(%{$fg[red]%}" |
| 24 | ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}" | 21 | ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}" |
| 25 | ZSH_THEME_HG_PROMPT_DIRTY="%{$fg[magenta]%}) %{$fg[yellow]%}✗%{$reset_color%}" | 22 | ZSH_THEME_HG_PROMPT_DIRTY="%{$fg[magenta]%}) %{$fg[yellow]%}✗%{$reset_color%}" |
| 26 | ZSH_THEME_HG_PROMPT_CLEAN="%{$fg[magenta]%})" | 23 | ZSH_THEME_HG_PROMPT_CLEAN="%{$fg[magenta]%})" |
| 27 | ``` | 24 | ``` |
| 28 | 25 | ||
| 29 | ### What's inside? | 26 | ### What's inside? |
| 30 | #### Adds handy aliases: | 27 | #### Adds handy aliases: |
| 31 | ###### general | 28 | ###### general |
| 32 | * `hgc` - `hg commit` | 29 | * `hgc` - `hg commit` |
| 33 | * `hgb` - `hg branch` | 30 | * `hgb` - `hg branch` |
| 34 | * `hgba` - `hg branches` | 31 | * `hgba` - `hg branches` |
| 35 | * `hgbk` - `hg bookmarks` | 32 | * `hgbk` - `hg bookmarks` |
| 36 | * `hgco` - `hg checkout` | 33 | * `hgco` - `hg checkout` |
| 37 | * `hgd` - `hg diff` | 34 | * `hgd` - `hg diff` |
| 38 | * `hged` - `hg diffmerge` | 35 | * `hged` - `hg diffmerge` |
| 39 | 36 | ||
| 40 | ###### pull and update | 37 | ###### pull and update |
| 41 | * `hgi` - `hg incoming` | 38 | * `hgi` - `hg incoming` |
| 42 | * `hgl` - `hg pull -u` | 39 | * `hgl` - `hg pull -u` |
| 43 | * `hglr` - `hg pull --rebase` | 40 | * `hglr` - `hg pull --rebase` |
| 44 | * `hgo` - `hg outgoing` | 41 | * `hgo` - `hg outgoing` |
| 45 | * `hgp` - `hg push` | 42 | * `hgp` - `hg push` |
| 46 | * `hgs` - `hg status` | 43 | * `hgs` - `hg status` |
| 47 | * `hgsl` - `hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"` | 44 | * `hgsl` - `hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"` |
| 48 | 45 | ||
| 49 | ###### this is the 'git commit --amend' equivalent | 46 | ###### this is the 'git commit --amend' equivalent |
| 50 | * `hgca` - `hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip` | 47 | * `hgca` - `hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip` |
| 51 | 48 | ||
| 52 | ###### list unresolved files (since hg does not list unmerged files in the status command) | 49 | ###### list unresolved files (since hg does not list unmerged files in the status command) |
| 53 | * `hgun` - `hg resolve --list` | 50 | * `hgun` - `hg resolve --list` |
| 54 | 51 | ||
| 55 | #### Displays repo branch and directory status in prompt | 52 | #### Displays repo branch and directory status in prompt |
| 56 | This is the same as git plugin does. | 53 | This is the same as git plugin does. |
| 57 | 54 | ||
| 58 | **Note**: additional changes to **.zshrc** are required in order for this to | 55 | **Note**: Additional changes to **.zshrc**, or using a theme designed to use `hg_prompt_info`, are required in order for this to work. |
| 59 | work. | ||
| 60 | 56 | ||
| 61 | ### Mantainers | 57 | ### Mantainers |
| 62 | [ptrv](https://github.com/ptrv) - original creator | 58 | [ptrv](https://github.com/ptrv) - original creator |
| 63 | 59 | ||
| 64 | [oshybystyi](https://github.com/oshybystyi) - created this README and know how most of code works | 60 | [oshybystyi](https://github.com/oshybystyi) - created this README and know how most of code works |
plugins/wp-cli/README.md
| 1 | # WP-CLI | 1 | # WP-CLI |
| 2 | 2 | ||
| 3 | **Maintainer:** [joshmedeski](https://github.com/joshmedeski) | 3 | **Maintainer:** [joshmedeski](https://github.com/joshmedeski) |
| 4 | 4 | ||
| 5 | WordPress Command Line Interface (http://wp-cli.org/) | 5 | WordPress Command Line Interface (http://wp-cli.org/) |
| 6 | 6 | ||
| 7 | WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser. | 7 | WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser. |
| 8 | 8 | ||
| 9 | ## List of Aliases | 9 | ## List of Aliases |
| 10 | 10 | ||
| 11 | ### Core | 11 | ### Core |
| 12 | - wpcc='wp core config' | 12 | - wpcc='wp core config' |
| 13 | - wpcd='wp core download' | 13 | - wpcd='wp core download' |
| 14 | - wpci='wp core install' | 14 | - wpci='wp core install' |
| 15 | - wpcii='wp core is-installed' | 15 | - wpcii='wp core is-installed' |
| 16 | - wpcmc='wp core multisite-convert' | 16 | - wpcmc='wp core multisite-convert' |
| 17 | - wpcmi='wp core multisite-install' | 17 | - wpcmi='wp core multisite-install' |
| 18 | - wpcu='wp core update' | 18 | - wpcu='wp core update' |
| 19 | - wpcudb='wp core update-db' | 19 | - wpcudb='wp core update-db' |
| 20 | - wpcvc='wp core verify-checksums' | 20 | - wpcvc='wp core verify-checksums' |
| 21 | 21 | ||
| 22 | ### Cron | 22 | ### Cron |
| 23 | - wpcre='wp cron event' | 23 | - wpcre='wp cron event' |
| 24 | - wpcrs='wp cron schedule' | 24 | - wpcrs='wp cron schedule' |
| 25 | - wpcrt='wp cron test' | 25 | - wpcrt='wp cron test' |
| 26 | 26 | ||
| 27 | ### Menu | 27 | ### Menu |
| 28 | - wpmc='wp menu create' | 28 | - wpmc='wp menu create' |
| 29 | - wpmd='wp menu delete' | 29 | - wpmd='wp menu delete' |
| 30 | - wpmi='wp menu item' | 30 | - wpmi='wp menu item' |
| 31 | - wpml='wp menu list' | 31 | - wpml='wp menu list' |
| 32 | - wpmlo='wp menu location' | 32 | - wpmlo='wp menu location' |
| 33 | 33 | ||
| 34 | ### Plugin | 34 | ### Plugin |
| 35 | - wppa='activate' | 35 | - wppa='activate' |
| 36 | - wppda='deactivate' | 36 | - wppda='deactivate' |
| 37 | - wppd='delete' | 37 | - wppd='delete' |
| 38 | - wppg='get' | 38 | - wppg='get' |
| 39 | - wppi='install' | 39 | - wppi='install' |
| 40 | - wppis='is-installed' | 40 | - wppis='is-installed' |
| 41 | - wppl='list' | 41 | - wppl='list' |
| 42 | - wppp='path' | 42 | - wppp='path' |
| 43 | - wpps='search' | 43 | - wpps='search' |
| 44 | - wppst='status' | 44 | - wppst='status' |
| 45 | - wppt='toggle' | 45 | - wppt='toggle' |
| 46 | - wppu='uninstall' | 46 | - wppun='uninstall' |
| 47 | - wppu='update' | 47 | - wppu='update' |
| 48 | 48 | ||
| 49 | ### Post | 49 | ### Post |
| 50 | - wppoc='wp post create' | 50 | - wppoc='wp post create' |
| 51 | - wppod='wp post delete' | 51 | - wppod='wp post delete' |
| 52 | - wppoe='wp post edit' | 52 | - wppoe='wp post edit' |
| 53 | - wppogen='wp post generate' | 53 | - wppogen='wp post generate' |
| 54 | - wppog='wp post get' | 54 | - wppog='wp post get' |
| 55 | - wppol='wp post list' | 55 | - wppol='wp post list' |
| 56 | - wppom='wp post meta' | 56 | - wppom='wp post meta' |
| 57 | - wppou='wp post update' | 57 | - wppou='wp post update' |
| 58 | - wppou='wp post url' | 58 | - wppourl='wp post url' |
| 59 | 59 | ||
| 60 | ### Sidebar | 60 | ### Sidebar |
| 61 | - wpsbl='wp sidebar list' | 61 | - wpsbl='wp sidebar list' |
| 62 | 62 | ||
| 63 | ### Theme | 63 | ### Theme |
| 64 | - wpta='wp theme activate' | 64 | - wpta='wp theme activate' |
| 65 | - wptd='wp theme delete' | 65 | - wptd='wp theme delete' |
| 66 | - wptdis='wp theme disable' | 66 | - wptdis='wp theme disable' |
| 67 | - wpte='wp theme enable' | 67 | - wpte='wp theme enable' |
| 68 | - wptg='wp theme get' | 68 | - wptg='wp theme get' |
| 69 | - wpti='wp theme install' | 69 | - wpti='wp theme install' |
| 70 | - wptis='wp theme is-installed' | 70 | - wptis='wp theme is-installed' |
| 71 | - wptl='wp theme list' | 71 | - wptl='wp theme list' |
| 72 | - wptm='wp theme mod' | 72 | - wptm='wp theme mod' |
| 73 | - wptp='wp theme path' | 73 | - wptp='wp theme path' |
| 74 | - wpts='wp theme search' | 74 | - wpts='wp theme search' |
| 75 | - wptst='wp theme status' | 75 | - wptst='wp theme status' |
| 76 | - wptu='wp theme updatet' | 76 | - wptu='wp theme updatet' |
| 77 | 77 | ||
| 78 | ### User | 78 | ### User |
| 79 | - wpuac='wp user add-cap' | 79 | - wpuac='wp user add-cap' |
| 80 | - wpuar='wp user add-role' | 80 | - wpuar='wp user add-role' |
| 81 | - wpuc='wp user create' | 81 | - wpuc='wp user create' |
| 82 | - wpud='wp user delete' | 82 | - wpud='wp user delete' |
| 83 | - wpugen='wp user generate' | 83 | - wpugen='wp user generate' |
| 84 | - wpug='wp user get' | 84 | - wpug='wp user get' |
| 85 | - wpui='wp user import-csv' | 85 | - wpui='wp user import-csv' |
| 86 | - wpul='wp user list' | 86 | - wpul='wp user list' |
| 87 | - wpulc='wp user list-caps' | 87 | - wpulc='wp user list-caps' |
| 88 | - wpum='wp user meta' | 88 | - wpum='wp user meta' |
| 89 | - wpurc='wp user remove-cap' | 89 | - wpurc='wp user remove-cap' |
| 90 | - wpurr='wp user remove-role' | 90 | - wpurr='wp user remove-role' |
| 91 | - wpusr='wp user set-role' | 91 | - wpusr='wp user set-role' |
| 92 | - wpuu='wp user update' | 92 | - wpuu='wp user update' |
| 93 | 93 | ||
| 94 | ### Widget | 94 | ### Widget |
| 95 | - wpwa='wp widget add' | 95 | - wpwa='wp widget add' |
| 96 | - wpwda='wp widget deactivate' | 96 | - wpwda='wp widget deactivate' |
| 97 | - wpwd='wp widget delete' | 97 | - wpwd='wp widget delete' |
| 98 | - wpwl='wp widget list' | 98 | - wpwl='wp widget list' |
| 99 | - wpwm='wp widget move' | 99 | - wpwm='wp widget move' |
| 100 | - wpwu='wp widget update' | 100 | - wpwu='wp widget update' |
| 101 | 101 | ||
| 102 | The entire list of wp-cli commands can be found here: http://wp-cli.org/commands/ | 102 | The entire list of wp-cli commands can be found here: http://wp-cli.org/commands/ |
| 103 | 103 | ||
| 104 | I only included the commands that are most used. Please feel free to contribute to this project if you want more commands. | 104 | I only included the commands that are most used. Please feel free to contribute to this project if you want more commands. |
| 105 | 105 | ||
| 106 | 106 |
plugins/wp-cli/wp-cli.plugin.zsh
| 1 | # WP-CLI | 1 | # WP-CLI |
| 2 | # A command line interface for WordPress | 2 | # A command line interface for WordPress |
| 3 | # http://wp-cli.org/ | 3 | # http://wp-cli.org/ |
| 4 | 4 | ||
| 5 | # Cache | 5 | # Cache |
| 6 | 6 | ||
| 7 | # Cap | 7 | # Cap |
| 8 | 8 | ||
| 9 | # CLI | 9 | # CLI |
| 10 | 10 | ||
| 11 | # Comment | 11 | # Comment |
| 12 | 12 | ||
| 13 | # Core | 13 | # Core |
| 14 | alias wpcc='wp core config' | 14 | alias wpcc='wp core config' |
| 15 | alias wpcd='wp core download' | 15 | alias wpcd='wp core download' |
| 16 | alias wpci='wp core install' | 16 | alias wpci='wp core install' |
| 17 | alias wpcii='wp core is-installed' | 17 | alias wpcii='wp core is-installed' |
| 18 | alias wpcmc='wp core multisite-convert' | 18 | alias wpcmc='wp core multisite-convert' |
| 19 | alias wpcmi='wp core multisite-install' | 19 | alias wpcmi='wp core multisite-install' |
| 20 | alias wpcu='wp core update' | 20 | alias wpcu='wp core update' |
| 21 | alias wpcudb='wp core update-db' | 21 | alias wpcudb='wp core update-db' |
| 22 | alias wpcvc='wp core verify-checksums' | 22 | alias wpcvc='wp core verify-checksums' |
| 23 | 23 | ||
| 24 | # Cron | 24 | # Cron |
| 25 | alias wpcre='wp cron event' | 25 | alias wpcre='wp cron event' |
| 26 | alias wpcrs='wp cron schedule' | 26 | alias wpcrs='wp cron schedule' |
| 27 | alias wpcrt='wp cron test' | 27 | alias wpcrt='wp cron test' |
| 28 | 28 | ||
| 29 | # Db | 29 | # Db |
| 30 | 30 | ||
| 31 | # Eval | 31 | # Eval |
| 32 | 32 | ||
| 33 | # Eval-File | 33 | # Eval-File |
| 34 | 34 | ||
| 35 | # Export | 35 | # Export |
| 36 | 36 | ||
| 37 | # Help | 37 | # Help |
| 38 | 38 | ||
| 39 | # Import | 39 | # Import |
| 40 | 40 | ||
| 41 | # Media | 41 | # Media |
| 42 | 42 | ||
| 43 | # Menu | 43 | # Menu |
| 44 | alias wpmc='wp menu create' | 44 | alias wpmc='wp menu create' |
| 45 | alias wpmd='wp menu delete' | 45 | alias wpmd='wp menu delete' |
| 46 | alias wpmi='wp menu item' | 46 | alias wpmi='wp menu item' |
| 47 | alias wpml='wp menu list' | 47 | alias wpml='wp menu list' |
| 48 | alias wpmlo='wp menu location' | 48 | alias wpmlo='wp menu location' |
| 49 | 49 | ||
| 50 | # Network | 50 | # Network |
| 51 | 51 | ||
| 52 | # Option | 52 | # Option |
| 53 | 53 | ||
| 54 | # Plugin | 54 | # Plugin |
| 55 | alias wppa='wp plugin activate' | 55 | alias wppa='wp plugin activate' |
| 56 | alias wppda='wp plugin deactivate' | 56 | alias wppda='wp plugin deactivate' |
| 57 | alias wppd='wp plugin delete' | 57 | alias wppd='wp plugin delete' |
| 58 | alias wppg='wp plugin get' | 58 | alias wppg='wp plugin get' |
| 59 | alias wppi='wp plugin install' | 59 | alias wppi='wp plugin install' |
| 60 | alias wppis='wp plugin is-installed' | 60 | alias wppis='wp plugin is-installed' |
| 61 | alias wppl='wp plugin list' | 61 | alias wppl='wp plugin list' |
| 62 | alias wppp='wp plugin path' | 62 | alias wppp='wp plugin path' |
| 63 | alias wpps='wp plugin search' | 63 | alias wpps='wp plugin search' |
| 64 | alias wppst='wp plugin status' | 64 | alias wppst='wp plugin status' |
| 65 | alias wppt='wp plugin toggle' | 65 | alias wppt='wp plugin toggle' |
| 66 | alias wppu='wp plugin uninstall' | 66 | alias wppun='wp plugin uninstall' |
| 67 | alias wppu='wp plugin update' | 67 | alias wppu='wp plugin update' |
| 68 | 68 | ||
| 69 | # Post | 69 | # Post |
| 70 | alias wppoc='wp post create' | 70 | alias wppoc='wp post create' |
| 71 | alias wppod='wp post delete' | 71 | alias wppod='wp post delete' |
| 72 | alias wppoe='wp post edit' | 72 | alias wppoe='wp post edit' |
| 73 | alias wppogen='wp post generate' | 73 | alias wppogen='wp post generate' |
| 74 | alias wppog='wp post get' | 74 | alias wppog='wp post get' |
| 75 | alias wppol='wp post list' | 75 | alias wppol='wp post list' |
| 76 | alias wppom='wp post meta' | 76 | alias wppom='wp post meta' |
| 77 | alias wppou='wp post update' | 77 | alias wppou='wp post update' |
| 78 | alias wppou='wp post url' | 78 | alias wppourl='wp post url' |
| 79 | 79 | ||
| 80 | # Rewrite | 80 | # Rewrite |
| 81 | 81 | ||
| 82 | # Role | 82 | # Role |
| 83 | 83 | ||
| 84 | # Scaffold | 84 | # Scaffold |
| 85 | 85 | ||
| 86 | # Search-Replace | 86 | # Search-Replace |
| 87 | 87 | ||
| 88 | # Shell | 88 | # Shell |
| 89 | 89 | ||
| 90 | # Sidebar | 90 | # Sidebar |
| 91 | alias wpsbl='wp sidebar list' | 91 | alias wpsbl='wp sidebar list' |
| 92 | 92 | ||
| 93 | # Site | 93 | # Site |
| 94 | 94 | ||
| 95 | # Super-Admin | 95 | # Super-Admin |
| 96 | 96 | ||
| 97 | # Term | 97 | # Term |
| 98 | 98 | ||
| 99 | # Theme | 99 | # Theme |
| 100 | alias wpta='wp theme activate' | 100 | alias wpta='wp theme activate' |
| 101 | alias wptd='wp theme delete' | 101 | alias wptd='wp theme delete' |
| 102 | alias wptdis='wp theme disable' | 102 | alias wptdis='wp theme disable' |
| 103 | alias wpte='wp theme enable' | 103 | alias wpte='wp theme enable' |
| 104 | alias wptg='wp theme get' | 104 | alias wptg='wp theme get' |
| 105 | alias wpti='wp theme install' | 105 | alias wpti='wp theme install' |
| 106 | alias wptis='wp theme is-installed' | 106 | alias wptis='wp theme is-installed' |
| 107 | alias wptl='wp theme list' | 107 | alias wptl='wp theme list' |
| 108 | alias wptm='wp theme mod' | 108 | alias wptm='wp theme mod' |
| 109 | alias wptp='wp theme path' | 109 | alias wptp='wp theme path' |
| 110 | alias wpts='wp theme search' | 110 | alias wpts='wp theme search' |
| 111 | alias wptst='wp theme status' | 111 | alias wptst='wp theme status' |
| 112 | alias wptu='wp theme updatet' | 112 | alias wptu='wp theme updatet' |
| 113 | 113 | ||
| 114 | # Transient | 114 | # Transient |
| 115 | 115 | ||
| 116 | # User | 116 | # User |
| 117 | alias wpuac='wp user add-cap' | 117 | alias wpuac='wp user add-cap' |
| 118 | alias wpuar='wp user add-role' | 118 | alias wpuar='wp user add-role' |
| 119 | alias wpuc='wp user create' | 119 | alias wpuc='wp user create' |
| 120 | alias wpud='wp user delete' | 120 | alias wpud='wp user delete' |
| 121 | alias wpugen='wp user generate' | 121 | alias wpugen='wp user generate' |
| 122 | alias wpug='wp user get' | 122 | alias wpug='wp user get' |
| 123 | alias wpui='wp user import-csv' | 123 | alias wpui='wp user import-csv' |
| 124 | alias wpul='wp user list' | 124 | alias wpul='wp user list' |
| 125 | alias wpulc='wp user list-caps' | 125 | alias wpulc='wp user list-caps' |
| 126 | alias wpum='wp user meta' | 126 | alias wpum='wp user meta' |
| 127 | alias wpurc='wp user remove-cap' | 127 | alias wpurc='wp user remove-cap' |
| 128 | alias wpurr='wp user remove-role' | 128 | alias wpurr='wp user remove-role' |
| 129 | alias wpusr='wp user set-role' | 129 | alias wpusr='wp user set-role' |
| 130 | alias wpuu='wp user update' | 130 | alias wpuu='wp user update' |
| 131 | 131 | ||
| 132 | # Widget | 132 | # Widget |
| 133 | alias wpwa='wp widget add' | 133 | alias wpwa='wp widget add' |
| 134 | alias wpwda='wp widget deactivate' | 134 | alias wpwda='wp widget deactivate' |
| 135 | alias wpwd='wp widget delete' | 135 | alias wpwd='wp widget delete' |
| 136 | alias wpwl='wp widget list' | 136 | alias wpwl='wp widget list' |
| 137 | alias wpwm='wp widget move' | 137 | alias wpwm='wp widget move' |
| 138 | alias wpwu='wp widget update' | 138 | alias wpwu='wp widget update' |
| 139 | 139 | ||
| 140 | 140 | ||
| 141 | autoload -U +X bashcompinit && bashcompinit | 141 | autoload -U +X bashcompinit && bashcompinit |
| 142 | # bash completion for the `wp` command | 142 | # bash completion for the `wp` command |
| 143 | 143 | ||
| 144 | _wp_complete() { | 144 | _wp_complete() { |
| 145 | local cur=${COMP_WORDS[COMP_CWORD]} | 145 | local cur=${COMP_WORDS[COMP_CWORD]} |
| 146 | 146 | ||
| 147 | IFS=$'\n'; # want to preserve spaces at the end | 147 | IFS=$'\n'; # want to preserve spaces at the end |
| 148 | local opts="$(wp cli completions --line="$COMP_LINE" --point="$COMP_POINT")" | 148 | local opts="$(wp cli completions --line="$COMP_LINE" --point="$COMP_POINT")" |
| 149 | 149 | ||
| 150 | if [[ "$opts" =~ \<file\>\s* ]] | 150 | if [[ "$opts" =~ \<file\>\s* ]] |
| 151 | then | 151 | then |
| 152 | COMPREPLY=( $(compgen -f -- $cur) ) | 152 | COMPREPLY=( $(compgen -f -- $cur) ) |
| 153 | elif [[ $opts = "" ]] | 153 | elif [[ $opts = "" ]] |
| 154 | then | 154 | then |
| 155 | COMPREPLY=( $(compgen -f -- $cur) ) | 155 | COMPREPLY=( $(compgen -f -- $cur) ) |
| 156 | else | 156 | else |
| 157 | COMPREPLY=( ${opts[*]} ) | 157 | COMPREPLY=( ${opts[*]} ) |
| 158 | fi | 158 | fi |
| 159 | } | 159 | } |
| 160 | complete -o nospace -F _wp_complete wp | 160 | complete -o nospace -F _wp_complete wp |
| 161 | 161 |
themes/agnoster.zsh-theme
| 1 | # vim:ft=zsh ts=2 sw=2 sts=2 | 1 | # vim:ft=zsh ts=2 sw=2 sts=2 |
| 2 | # | 2 | # |
| 3 | # agnoster's Theme - https://gist.github.com/3712874 | 3 | # agnoster's Theme - https://gist.github.com/3712874 |
| 4 | # A Powerline-inspired theme for ZSH | 4 | # A Powerline-inspired theme for ZSH |
| 5 | # | 5 | # |
| 6 | # # README | 6 | # # README |
| 7 | # | 7 | # |
| 8 | # In order for this theme to render correctly, you will need a | 8 | # In order for this theme to render correctly, you will need a |
| 9 | # [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts). | 9 | # [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts). |
| 10 | # Make sure you have a recent version: the code points that Powerline | 10 | # Make sure you have a recent version: the code points that Powerline |
| 11 | # uses changed in 2012, and older versions will display incorrectly, | 11 | # uses changed in 2012, and older versions will display incorrectly, |
| 12 | # in confusing ways. | 12 | # in confusing ways. |
| 13 | # | 13 | # |
| 14 | # In addition, I recommend the | 14 | # In addition, I recommend the |
| 15 | # [Solarized theme](https://github.com/altercation/solarized/) and, if you're | 15 | # [Solarized theme](https://github.com/altercation/solarized/) and, if you're |
| 16 | # using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over Terminal.app - | 16 | # using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over Terminal.app - |
| 17 | # it has significantly better color fidelity. | 17 | # it has significantly better color fidelity. |
| 18 | # | 18 | # |
| 19 | # # Goals | 19 | # # Goals |
| 20 | # | 20 | # |
| 21 | # The aim of this theme is to only show you *relevant* information. Like most | 21 | # The aim of this theme is to only show you *relevant* information. Like most |
| 22 | # prompts, it will only show git information when in a git working directory. | 22 | # prompts, it will only show git information when in a git working directory. |
| 23 | # However, it goes a step further: everything from the current user and | 23 | # However, it goes a step further: everything from the current user and |
| 24 | # hostname to whether the last call exited with an error to whether background | 24 | # hostname to whether the last call exited with an error to whether background |
| 25 | # jobs are running in this shell will all be displayed automatically when | 25 | # jobs are running in this shell will all be displayed automatically when |
| 26 | # appropriate. | 26 | # appropriate. |
| 27 | 27 | ||
| 28 | ### Segment drawing | 28 | ### Segment drawing |
| 29 | # A few utility functions to make it easy and re-usable to draw segmented prompts | 29 | # A few utility functions to make it easy and re-usable to draw segmented prompts |
| 30 | 30 | ||
| 31 | CURRENT_BG='NONE' | 31 | CURRENT_BG='NONE' |
| 32 | 32 | ||
| 33 | # Special Powerline characters | 33 | # Special Powerline characters |
| 34 | 34 | ||
| 35 | () { | 35 | () { |
| 36 | local LC_ALL="" LC_CTYPE="en_US.UTF-8" | 36 | local LC_ALL="" LC_CTYPE="en_US.UTF-8" |
| 37 | # NOTE: This segment separator character is correct. In 2012, Powerline changed | 37 | # NOTE: This segment separator character is correct. In 2012, Powerline changed |
| 38 | # the code points they use for their special characters. This is the new code point. | 38 | # the code points they use for their special characters. This is the new code point. |
| 39 | # If this is not working for you, you probably have an old version of the | 39 | # If this is not working for you, you probably have an old version of the |
| 40 | # Powerline-patched fonts installed. Download and install the new version. | 40 | # Powerline-patched fonts installed. Download and install the new version. |
| 41 | # Do not submit PRs to change this unless you have reviewed the Powerline code point | 41 | # Do not submit PRs to change this unless you have reviewed the Powerline code point |
| 42 | # history and have new information. | 42 | # history and have new information. |
| 43 | # This is defined using a Unicode escape sequence so it is unambiguously readable, regardless of | 43 | # This is defined using a Unicode escape sequence so it is unambiguously readable, regardless of |
| 44 | # what font the user is viewing this source code in. Do not replace the | 44 | # what font the user is viewing this source code in. Do not replace the |
| 45 | # escape sequence with a single literal character. | 45 | # escape sequence with a single literal character. |
| 46 | SEGMENT_SEPARATOR=$'\ue0b0' # | 46 | SEGMENT_SEPARATOR=$'\ue0b0' # |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | # Begin a segment | 49 | # Begin a segment |
| 50 | # Takes two arguments, background and foreground. Both can be omitted, | 50 | # Takes two arguments, background and foreground. Both can be omitted, |
| 51 | # rendering default background/foreground. | 51 | # rendering default background/foreground. |
| 52 | prompt_segment() { | 52 | prompt_segment() { |
| 53 | local bg fg | 53 | local bg fg |
| 54 | [[ -n $1 ]] && bg="%K{$1}" || bg="%k" | 54 | [[ -n $1 ]] && bg="%K{$1}" || bg="%k" |
| 55 | [[ -n $2 ]] && fg="%F{$2}" || fg="%f" | 55 | [[ -n $2 ]] && fg="%F{$2}" || fg="%f" |
| 56 | if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then | 56 | if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then |
| 57 | echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} " | 57 | echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} " |
| 58 | else | 58 | else |
| 59 | echo -n "%{$bg%}%{$fg%} " | 59 | echo -n "%{$bg%}%{$fg%} " |
| 60 | fi | 60 | fi |
| 61 | CURRENT_BG=$1 | 61 | CURRENT_BG=$1 |
| 62 | [[ -n $3 ]] && echo -n $3 | 62 | [[ -n $3 ]] && echo -n $3 |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | # End the prompt, closing any open segments | 65 | # End the prompt, closing any open segments |
| 66 | prompt_end() { | 66 | prompt_end() { |
| 67 | if [[ -n $CURRENT_BG ]]; then | 67 | if [[ -n $CURRENT_BG ]]; then |
| 68 | echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR" | 68 | echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR" |
| 69 | else | 69 | else |
| 70 | echo -n "%{%k%}" | 70 | echo -n "%{%k%}" |
| 71 | fi | 71 | fi |
| 72 | echo -n "%{%f%}" | 72 | echo -n "%{%f%}" |
| 73 | CURRENT_BG='' | 73 | CURRENT_BG='' |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | ### Prompt components | 76 | ### Prompt components |
| 77 | # Each component will draw itself, and hide itself if no information needs to be shown | 77 | # Each component will draw itself, and hide itself if no information needs to be shown |
| 78 | 78 | ||
| 79 | # Context: user@hostname (who am I and where am I) | 79 | # Context: user@hostname (who am I and where am I) |
| 80 | prompt_context() { | 80 | prompt_context() { |
| 81 | if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then | 81 | if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then |
| 82 | prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m" | 82 | prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m" |
| 83 | fi | 83 | fi |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | # Git: branch/detached head, dirty status | 86 | # Git: branch/detached head, dirty status |
| 87 | prompt_git() { | 87 | prompt_git() { |
| 88 | 88 | ||
| 89 | local PL_BRANCH_CHAR | 89 | local PL_BRANCH_CHAR |
| 90 | () { | 90 | () { |
| 91 | local LC_ALL="" LC_CTYPE="en_US.UTF-8" | 91 | local LC_ALL="" LC_CTYPE="en_US.UTF-8" |
| 92 | PL_BRANCH_CHAR=$'\ue0a0' # | 92 | PL_BRANCH_CHAR=$'\ue0a0' # |
| 93 | } | 93 | } |
| 94 | local ref dirty mode repo_path | 94 | local ref dirty mode repo_path |
| 95 | repo_path=$(git rev-parse --git-dir 2>/dev/null) | 95 | repo_path=$(git rev-parse --git-dir 2>/dev/null) |
| 96 | 96 | ||
| 97 | if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then | 97 | if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then |
| 98 | dirty=$(parse_git_dirty) | 98 | dirty=$(parse_git_dirty) |
| 99 | ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)" | 99 | ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)" |
| 100 | if [[ -n $dirty ]]; then | 100 | if [[ -n $dirty ]]; then |
| 101 | prompt_segment yellow black | 101 | prompt_segment yellow black |
| 102 | else | 102 | else |
| 103 | prompt_segment green black | 103 | prompt_segment green black |
| 104 | fi | 104 | fi |
| 105 | 105 | ||
| 106 | if [[ -e "${repo_path}/BISECT_LOG" ]]; then | 106 | if [[ -e "${repo_path}/BISECT_LOG" ]]; then |
| 107 | mode=" <B>" | 107 | mode=" <B>" |
| 108 | elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then | 108 | elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then |
| 109 | mode=" >M<" | 109 | mode=" >M<" |
| 110 | elif [[ -e "${repo_path}/rebase" || -e "${repo_path}/rebase-apply" || -e "${repo_path}/rebase-merge" || -e "${repo_path}/../.dotest" ]]; then | 110 | elif [[ -e "${repo_path}/rebase" || -e "${repo_path}/rebase-apply" || -e "${repo_path}/rebase-merge" || -e "${repo_path}/../.dotest" ]]; then |
| 111 | mode=" >R>" | 111 | mode=" >R>" |
| 112 | fi | 112 | fi |
| 113 | 113 | ||
| 114 | setopt promptsubst | 114 | setopt promptsubst |
| 115 | autoload -Uz vcs_info | 115 | autoload -Uz vcs_info |
| 116 | 116 | ||
| 117 | zstyle ':vcs_info:*' enable git | 117 | zstyle ':vcs_info:*' enable git |
| 118 | zstyle ':vcs_info:*' get-revision true | 118 | zstyle ':vcs_info:*' get-revision true |
| 119 | zstyle ':vcs_info:*' check-for-changes true | 119 | zstyle ':vcs_info:*' check-for-changes true |
| 120 | zstyle ':vcs_info:*' stagedstr '✚' | 120 | zstyle ':vcs_info:*' stagedstr '✚' |
| 121 | zstyle ':vcs_info:git:*' unstagedstr '●' | 121 | zstyle ':vcs_info:*' unstagedstr '●' |
| 122 | zstyle ':vcs_info:*' formats ' %u%c' | 122 | zstyle ':vcs_info:*' formats ' %u%c' |
| 123 | zstyle ':vcs_info:*' actionformats ' %u%c' | 123 | zstyle ':vcs_info:*' actionformats ' %u%c' |
| 124 | vcs_info | 124 | vcs_info |
| 125 | echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}" | 125 | echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}" |
| 126 | fi | 126 | fi |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | prompt_hg() { | 129 | prompt_hg() { |
| 130 | local rev status | 130 | local rev status |
| 131 | if $(hg id >/dev/null 2>&1); then | 131 | if $(hg id >/dev/null 2>&1); then |
| 132 | if $(hg prompt >/dev/null 2>&1); then | 132 | if $(hg prompt >/dev/null 2>&1); then |
| 133 | if [[ $(hg prompt "{status|unknown}") = "?" ]]; then | 133 | if [[ $(hg prompt "{status|unknown}") = "?" ]]; then |
| 134 | # if files are not added | 134 | # if files are not added |
| 135 | prompt_segment red white | 135 | prompt_segment red white |
| 136 | st='±' | 136 | st='±' |
| 137 | elif [[ -n $(hg prompt "{status|modified}") ]]; then | 137 | elif [[ -n $(hg prompt "{status|modified}") ]]; then |
| 138 | # if any modification | 138 | # if any modification |
| 139 | prompt_segment yellow black | 139 | prompt_segment yellow black |
| 140 | st='±' | 140 | st='±' |
| 141 | else | 141 | else |
| 142 | # if working copy is clean | 142 | # if working copy is clean |
| 143 | prompt_segment green black | 143 | prompt_segment green black |
| 144 | fi | 144 | fi |
| 145 | echo -n $(hg prompt "☿ {rev}@{branch}") $st | 145 | echo -n $(hg prompt "☿ {rev}@{branch}") $st |
| 146 | else | 146 | else |
| 147 | st="" | 147 | st="" |
| 148 | rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g') | 148 | rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g') |
| 149 | branch=$(hg id -b 2>/dev/null) | 149 | branch=$(hg id -b 2>/dev/null) |
| 150 | if `hg st | grep -q "^\?"`; then | 150 | if `hg st | grep -q "^\?"`; then |
| 151 | prompt_segment red black | 151 | prompt_segment red black |
| 152 | st='±' | 152 | st='±' |
| 153 | elif `hg st | grep -q "^[MA]"`; then | 153 | elif `hg st | grep -q "^[MA]"`; then |
| 154 | prompt_segment yellow black | 154 | prompt_segment yellow black |
| 155 | st='±' | 155 | st='±' |
| 156 | else | 156 | else |
| 157 | prompt_segment green black | 157 | prompt_segment green black |
| 158 | fi | 158 | fi |
| 159 | echo -n "☿ $rev@$branch" $st | 159 | echo -n "☿ $rev@$branch" $st |
| 160 | fi | 160 | fi |
| 161 | fi | 161 | fi |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | # Dir: current working directory | 164 | # Dir: current working directory |
| 165 | prompt_dir() { | 165 | prompt_dir() { |
| 166 | prompt_segment blue black '%~' | 166 | prompt_segment blue black '%~' |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | # Virtualenv: current working virtualenv | 169 | # Virtualenv: current working virtualenv |
| 170 | prompt_virtualenv() { | 170 | prompt_virtualenv() { |
| 171 | local virtualenv_path="$VIRTUAL_ENV" | 171 | local virtualenv_path="$VIRTUAL_ENV" |
| 172 | if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then | 172 | if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then |
| 173 | prompt_segment blue black "(`basename $virtualenv_path`)" | 173 | prompt_segment blue black "(`basename $virtualenv_path`)" |
| 174 | fi | 174 | fi |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | # Status: | 177 | # Status: |
| 178 | # - was there an error | 178 | # - was there an error |
| 179 | # - am I root | 179 | # - am I root |
| 180 | # - are there background jobs? | 180 | # - are there background jobs? |
| 181 | prompt_status() { | 181 | prompt_status() { |
| 182 | local symbols | 182 | local symbols |
| 183 | symbols=() | 183 | symbols=() |
| 184 | [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘" | 184 | [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘" |
| 185 | [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" | 185 | [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" |
| 186 | [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙" | 186 | [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙" |
| 187 | 187 | ||
| 188 | [[ -n "$symbols" ]] && prompt_segment black default "$symbols" | 188 | [[ -n "$symbols" ]] && prompt_segment black default "$symbols" |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | ## Main prompt | 191 | ## Main prompt |
| 192 | build_prompt() { | 192 | build_prompt() { |
| 193 | RETVAL=$? | 193 | RETVAL=$? |
| 194 | prompt_status | 194 | prompt_status |
| 195 | prompt_virtualenv | 195 | prompt_virtualenv |
| 196 | prompt_context | 196 | prompt_context |
| 197 | prompt_dir | 197 | prompt_dir |
| 198 | prompt_git | 198 | prompt_git |
| 199 | prompt_hg | 199 | prompt_hg |
| 200 | prompt_end | 200 | prompt_end |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | PROMPT='%{%f%b%k%}$(build_prompt) ' | 203 | PROMPT='%{%f%b%k%}$(build_prompt) ' |
| 204 | 204 |
-
mentioned in commit c1a71b