Compare View
-
286c3e5 Merge pull request #4961 from aesopwolf/patch-1
69e1506 Add git user profile functions for prompt display
c458277 Merge pull request #4957 from TorrentKatten/master
e8a9d0e localization support for clock in candy theme
c3b3de5 Merge pull request #4956 from RobLoach/asdf
616ac67 Add 'asdf' plugin
b4a85ec Merge pull request #4728 from atk91/4727
7cc1eab Merge pull request #2752 from isqua/bureau_theme_fix
c74681a Merge pull request #2392 from s7anley/master
d1a5fad Merge pull request #4943 from MattLewin/master
dfccac3 Merge pull request #3892 from delphiki/sf2-plugin
8daa52d Merge pull request #4809 from aried3r/patch-1
5365cca Merge pull request #4849 from gkotian/master
7697c40 Merge pull request #4939 from AntouanK/feature/npm-outdated
fc89773 Update 'tm' function to take multiple files on the command-line
9280f2c Merge pull request #4940 from ysmood/optimize-ys-theme
186f009 Update README.markdown
2cc5976 Merge pull request #4941 from getaaron/patch-1
e0246ed Remove "Mac" from "Mac OS X"
9cc3e8b Optimize the ys.zsh-theme make it simpler
097cc70 [feature/npm-outdated] - add alias for "npm outdated" to check outdated npm modules
8ac1859 Update GitHub download URLs in README
83cf8dc Merge pull request #4790 from lckarssen/avit-theme-fixes
fdff700 Merge pull request #4863 from ysmood/optimize-ys-theme
bbedad8 Merge pull request #4847 from kennethreitz/patch-1
55fed4f Fix use of CARETCOLOR in avit theme
9c36248 Better visible colours in avit for Ubuntu terminal
cfac963 Merge branch 'master' of git://github.com/robbyrussell/oh-my-zsh
9a2376b add: exit code
aeca2ad Optimize the ys.zsh-theme make it more expressive
eee6f08 Minor README fixes
568f481 update kennethreitz.zsh-theme
07424c9 Update kennethreitz.zsh-theme
a6ad7a0 Add missing alias to README of bundler plugin
0a47451 Updated colour of ◀ in PROMPT2 of the avit theme. In commit 729fd53 I incorrectly only changed PROMPT1. Now both ▶ and ◀ follow $CARETCOLOR.
63e216b oh-my-zsh avit theme: instead of only showing the last 3 directories in the $PWD shorten the path by removing some middle parts if $PWD becomes too long.
18801e2 Shorter way of creating bold colours in a ZSH theme (applied to the avit theme).
ceca00a Adapt some colours in the avit theme for better visibility in the default Ubuntu terminal theme.
854c41d Fix in avit theme: $CARETCOLOR was not to actually colour the caret, so change to root user wouldn't show in the prompt.
a67dfae Set colour for user@hostname to red if we're root (or sudo) in the bira theme.
d853ec4 Closes #4727
68e03a0 Changed env based sf2 shortcuts to sfdev & sfprod
a1ed87a Added environment based shortcuts in symfony2 plugin
e2bf7cb Fix checkmark for clean repo in bureau theme
a6ab704 Added a short description of the plugin
b3d27be Update seach parameter
aac85f0 Proper handling of tags
e585904 Geeknote autocomplete and aliasgit-subtree-dir: repos/robbyrussell/oh-my-zsh
git-subtree-split: 286c3e5e28b651c3f629e6aaba589a1cf56da4d8
Changes
Showing 19 changed files Inline Diff
- repos/robbyrussell/oh-my-zsh/README.markdown
- repos/robbyrussell/oh-my-zsh/lib/git.zsh
- repos/robbyrussell/oh-my-zsh/plugins/asdf/README.md
- repos/robbyrussell/oh-my-zsh/plugins/asdf/asdf.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/bundler/README.md
- repos/robbyrussell/oh-my-zsh/plugins/geeknote/README.md
- repos/robbyrussell/oh-my-zsh/plugins/geeknote/_geeknote
- repos/robbyrussell/oh-my-zsh/plugins/geeknote/geeknote.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/git/git.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/github/README.md
- repos/robbyrussell/oh-my-zsh/plugins/npm/npm.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/symfony2/symfony2.plugin.zsh
- repos/robbyrussell/oh-my-zsh/plugins/textmate/textmate.plugin.zsh
- repos/robbyrussell/oh-my-zsh/themes/avit.zsh-theme
- repos/robbyrussell/oh-my-zsh/themes/bira.zsh-theme
- repos/robbyrussell/oh-my-zsh/themes/bureau.zsh-theme
- repos/robbyrussell/oh-my-zsh/themes/candy.zsh-theme
- repos/robbyrussell/oh-my-zsh/themes/kennethreitz.zsh-theme
- repos/robbyrussell/oh-my-zsh/themes/ys.zsh-theme
1 | <p align="center"> | 1 | <p align="center"> |
2 | <img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh"> | 2 | <img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh"> |
3 | </p> | 3 | </p> |
4 | 4 | ||
5 | 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 | 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. |
6 | 6 | ||
7 | __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 | __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. |
8 | 8 | ||
9 | To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. | 9 | To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. |
10 | 10 | ||
11 | ## Getting Started | 11 | ## Getting Started |
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 OS X and Linux._ |
16 | 16 | ||
17 | * Unix-based operating system (Mac OS X or Linux) | 17 | * Unix-based operating system (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.githubusercontent.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.githubusercontent.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="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | 107 | export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubusercontent.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](MIT-LICENSE.txt). | 213 | Oh My Zsh is released under the [MIT license](MIT-LICENSE.txt). |
214 | 214 |
1 | # Outputs current branch info in prompt format | 1 | # Outputs current branch info in prompt format |
2 | function git_prompt_info() { | 2 | function git_prompt_info() { |
3 | local ref | 3 | local ref |
4 | if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then | 4 | if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then |
5 | ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ | 5 | ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ |
6 | ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 | 6 | ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 |
7 | echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" | 7 | echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" |
8 | fi | 8 | fi |
9 | } | 9 | } |
10 | 10 | ||
11 | # Checks if working tree is dirty | 11 | # Checks if working tree is dirty |
12 | function parse_git_dirty() { | 12 | function parse_git_dirty() { |
13 | local STATUS='' | 13 | local STATUS='' |
14 | local FLAGS | 14 | local FLAGS |
15 | FLAGS=('--porcelain') | 15 | FLAGS=('--porcelain') |
16 | if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then | 16 | if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then |
17 | if [[ $POST_1_7_2_GIT -gt 0 ]]; then | 17 | if [[ $POST_1_7_2_GIT -gt 0 ]]; then |
18 | FLAGS+='--ignore-submodules=dirty' | 18 | FLAGS+='--ignore-submodules=dirty' |
19 | fi | 19 | fi |
20 | if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then | 20 | if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then |
21 | FLAGS+='--untracked-files=no' | 21 | FLAGS+='--untracked-files=no' |
22 | fi | 22 | fi |
23 | STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1) | 23 | STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1) |
24 | fi | 24 | fi |
25 | if [[ -n $STATUS ]]; then | 25 | if [[ -n $STATUS ]]; then |
26 | echo "$ZSH_THEME_GIT_PROMPT_DIRTY" | 26 | echo "$ZSH_THEME_GIT_PROMPT_DIRTY" |
27 | else | 27 | else |
28 | echo "$ZSH_THEME_GIT_PROMPT_CLEAN" | 28 | echo "$ZSH_THEME_GIT_PROMPT_CLEAN" |
29 | fi | 29 | fi |
30 | } | 30 | } |
31 | 31 | ||
32 | # Gets the difference between the local and remote branches | 32 | # Gets the difference between the local and remote branches |
33 | function git_remote_status() { | 33 | function git_remote_status() { |
34 | local remote ahead behind git_remote_status git_remote_status_detailed | 34 | local remote ahead behind git_remote_status git_remote_status_detailed |
35 | remote=${$(command git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/} | 35 | remote=${$(command git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/} |
36 | if [[ -n ${remote} ]]; then | 36 | if [[ -n ${remote} ]]; then |
37 | ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l) | 37 | ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l) |
38 | behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l) | 38 | behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l) |
39 | 39 | ||
40 | if [[ $ahead -eq 0 ]] && [[ $behind -eq 0 ]]; then | 40 | if [[ $ahead -eq 0 ]] && [[ $behind -eq 0 ]]; then |
41 | git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE" | 41 | git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE" |
42 | elif [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then | 42 | elif [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then |
43 | git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE" | 43 | git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE" |
44 | git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}" | 44 | git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}" |
45 | elif [[ $behind -gt 0 ]] && [[ $ahead -eq 0 ]]; then | 45 | elif [[ $behind -gt 0 ]] && [[ $ahead -eq 0 ]]; then |
46 | git_remote_status="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE" | 46 | git_remote_status="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE" |
47 | git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}" | 47 | git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}" |
48 | elif [[ $ahead -gt 0 ]] && [[ $behind -gt 0 ]]; then | 48 | elif [[ $ahead -gt 0 ]] && [[ $behind -gt 0 ]]; then |
49 | git_remote_status="$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE" | 49 | git_remote_status="$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE" |
50 | git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}" | 50 | git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}" |
51 | fi | 51 | fi |
52 | 52 | ||
53 | if [[ -n $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then | 53 | if [[ -n $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then |
54 | git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX" | 54 | git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX" |
55 | fi | 55 | fi |
56 | 56 | ||
57 | echo $git_remote_status | 57 | echo $git_remote_status |
58 | fi | 58 | fi |
59 | } | 59 | } |
60 | 60 | ||
61 | # Outputs the name of the current branch | 61 | # Outputs the name of the current branch |
62 | # Usage example: git pull origin $(git_current_branch) | 62 | # Usage example: git pull origin $(git_current_branch) |
63 | # Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if | 63 | # Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if |
64 | # it's not a symbolic ref, but in a Git repo. | 64 | # it's not a symbolic ref, but in a Git repo. |
65 | function git_current_branch() { | 65 | function git_current_branch() { |
66 | local ref | 66 | local ref |
67 | ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null) | 67 | ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null) |
68 | local ret=$? | 68 | local ret=$? |
69 | if [[ $ret != 0 ]]; then | 69 | if [[ $ret != 0 ]]; then |
70 | [[ $ret == 128 ]] && return # no git repo. | 70 | [[ $ret == 128 ]] && return # no git repo. |
71 | ref=$(command git rev-parse --short HEAD 2> /dev/null) || return | 71 | ref=$(command git rev-parse --short HEAD 2> /dev/null) || return |
72 | fi | 72 | fi |
73 | echo ${ref#refs/heads/} | 73 | echo ${ref#refs/heads/} |
74 | } | 74 | } |
75 | 75 | ||
76 | 76 | ||
77 | # Gets the number of commits ahead from remote | 77 | # Gets the number of commits ahead from remote |
78 | function git_commits_ahead() { | 78 | function git_commits_ahead() { |
79 | if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then | 79 | if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then |
80 | local COMMITS | 80 | local COMMITS |
81 | COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ') | 81 | COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ') |
82 | echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX" | 82 | echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX" |
83 | fi | 83 | fi |
84 | } | 84 | } |
85 | 85 | ||
86 | # Outputs if current branch is ahead of remote | 86 | # Outputs if current branch is ahead of remote |
87 | function git_prompt_ahead() { | 87 | function git_prompt_ahead() { |
88 | if [[ -n "$(command git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then | 88 | if [[ -n "$(command git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then |
89 | echo "$ZSH_THEME_GIT_PROMPT_AHEAD" | 89 | echo "$ZSH_THEME_GIT_PROMPT_AHEAD" |
90 | fi | 90 | fi |
91 | } | 91 | } |
92 | 92 | ||
93 | # Outputs if current branch is behind remote | 93 | # Outputs if current branch is behind remote |
94 | function git_prompt_behind() { | 94 | function git_prompt_behind() { |
95 | if [[ -n "$(command git rev-list HEAD..origin/$(git_current_branch) 2> /dev/null)" ]]; then | 95 | if [[ -n "$(command git rev-list HEAD..origin/$(git_current_branch) 2> /dev/null)" ]]; then |
96 | echo "$ZSH_THEME_GIT_PROMPT_BEHIND" | 96 | echo "$ZSH_THEME_GIT_PROMPT_BEHIND" |
97 | fi | 97 | fi |
98 | } | 98 | } |
99 | 99 | ||
100 | # Outputs if current branch exists on remote or not | 100 | # Outputs if current branch exists on remote or not |
101 | function git_prompt_remote() { | 101 | function git_prompt_remote() { |
102 | if [[ -n "$(command git show-ref origin/$(git_current_branch) 2> /dev/null)" ]]; then | 102 | if [[ -n "$(command git show-ref origin/$(git_current_branch) 2> /dev/null)" ]]; then |
103 | echo "$ZSH_THEME_GIT_PROMPT_REMOTE_EXISTS" | 103 | echo "$ZSH_THEME_GIT_PROMPT_REMOTE_EXISTS" |
104 | else | 104 | else |
105 | echo "$ZSH_THEME_GIT_PROMPT_REMOTE_MISSING" | 105 | echo "$ZSH_THEME_GIT_PROMPT_REMOTE_MISSING" |
106 | fi | 106 | fi |
107 | } | 107 | } |
108 | 108 | ||
109 | # Formats prompt string for current git commit short SHA | 109 | # Formats prompt string for current git commit short SHA |
110 | function git_prompt_short_sha() { | 110 | function git_prompt_short_sha() { |
111 | local SHA | 111 | local SHA |
112 | SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" | 112 | SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" |
113 | } | 113 | } |
114 | 114 | ||
115 | # Formats prompt string for current git commit long SHA | 115 | # Formats prompt string for current git commit long SHA |
116 | function git_prompt_long_sha() { | 116 | function git_prompt_long_sha() { |
117 | local SHA | 117 | local SHA |
118 | SHA=$(command git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" | 118 | SHA=$(command git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" |
119 | } | 119 | } |
120 | 120 | ||
121 | # Get the status of the working tree | 121 | # Get the status of the working tree |
122 | function git_prompt_status() { | 122 | function git_prompt_status() { |
123 | local INDEX STATUS | 123 | local INDEX STATUS |
124 | INDEX=$(command git status --porcelain -b 2> /dev/null) | 124 | INDEX=$(command git status --porcelain -b 2> /dev/null) |
125 | STATUS="" | 125 | STATUS="" |
126 | if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then | 126 | if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then |
127 | STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" | 127 | STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" |
128 | fi | 128 | fi |
129 | if $(echo "$INDEX" | grep '^A ' &> /dev/null); then | 129 | if $(echo "$INDEX" | grep '^A ' &> /dev/null); then |
130 | STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" | 130 | STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" |
131 | elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then | 131 | elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then |
132 | STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" | 132 | STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" |
133 | fi | 133 | fi |
134 | if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then | 134 | if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then |
135 | STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" | 135 | STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" |
136 | elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then | 136 | elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then |
137 | STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" | 137 | STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" |
138 | elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then | 138 | elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then |
139 | STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" | 139 | STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" |
140 | fi | 140 | fi |
141 | if $(echo "$INDEX" | grep '^R ' &> /dev/null); then | 141 | if $(echo "$INDEX" | grep '^R ' &> /dev/null); then |
142 | STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" | 142 | STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" |
143 | fi | 143 | fi |
144 | if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then | 144 | if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then |
145 | STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" | 145 | STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" |
146 | elif $(echo "$INDEX" | grep '^D ' &> /dev/null); then | 146 | elif $(echo "$INDEX" | grep '^D ' &> /dev/null); then |
147 | STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" | 147 | STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" |
148 | elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then | 148 | elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then |
149 | STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" | 149 | STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" |
150 | fi | 150 | fi |
151 | if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then | 151 | if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then |
152 | STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS" | 152 | STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS" |
153 | fi | 153 | fi |
154 | if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then | 154 | if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then |
155 | STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" | 155 | STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" |
156 | fi | 156 | fi |
157 | if $(echo "$INDEX" | grep '^## .*ahead' &> /dev/null); then | 157 | if $(echo "$INDEX" | grep '^## .*ahead' &> /dev/null); then |
158 | STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS" | 158 | STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS" |
159 | fi | 159 | fi |
160 | if $(echo "$INDEX" | grep '^## .*behind' &> /dev/null); then | 160 | if $(echo "$INDEX" | grep '^## .*behind' &> /dev/null); then |
161 | STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS" | 161 | STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS" |
162 | fi | 162 | fi |
163 | if $(echo "$INDEX" | grep '^## .*diverged' &> /dev/null); then | 163 | if $(echo "$INDEX" | grep '^## .*diverged' &> /dev/null); then |
164 | STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS" | 164 | STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS" |
165 | fi | 165 | fi |
166 | echo $STATUS | 166 | echo $STATUS |
167 | } | 167 | } |
168 | 168 | ||
169 | # Compares the provided version of git to the version installed and on path | 169 | # Compares the provided version of git to the version installed and on path |
170 | # Outputs -1, 0, or 1 if the installed version is less than, equal to, or | 170 | # Outputs -1, 0, or 1 if the installed version is less than, equal to, or |
171 | # greater than the input version, respectively. | 171 | # greater than the input version, respectively. |
172 | function git_compare_version() { | 172 | function git_compare_version() { |
173 | local INPUT_GIT_VERSION INSTALLED_GIT_VERSION | 173 | local INPUT_GIT_VERSION INSTALLED_GIT_VERSION |
174 | INPUT_GIT_VERSION=(${(s/./)1}) | 174 | INPUT_GIT_VERSION=(${(s/./)1}) |
175 | INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null)) | 175 | INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null)) |
176 | INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]}) | 176 | INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]}) |
177 | 177 | ||
178 | for i in {1..3}; do | 178 | for i in {1..3}; do |
179 | if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then | 179 | if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then |
180 | echo 1 | 180 | echo 1 |
181 | return 0 | 181 | return 0 |
182 | fi | 182 | fi |
183 | if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then | 183 | if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then |
184 | echo -1 | 184 | echo -1 |
185 | return 0 | 185 | return 0 |
186 | fi | 186 | fi |
187 | done | 187 | done |
188 | echo 0 | 188 | echo 0 |
189 | } | 189 | } |
190 | 190 | ||
191 | # Outputs the name of the current user | ||
192 | # Usage example: $(git_current_user_name) | ||
193 | function git_current_user_name() { | ||
194 | command git config user.name 2>/dev/null | ||
195 | } | ||
196 | |||
197 | # Outputs the email of the current user | ||
198 | # Usage example: $(git_current_user_email) | ||
199 | function git_current_user_email() { | ||
200 | command git config user.email 2>/dev/null | ||
201 | } | ||
202 | |||
191 | # This is unlikely to change so make it all statically assigned | 203 | # This is unlikely to change so make it all statically assigned |
192 | POST_1_7_2_GIT=$(git_compare_version "1.7.2") | 204 | POST_1_7_2_GIT=$(git_compare_version "1.7.2") |
193 | # Clean up the namespace slightly by removing the checker function | 205 | # Clean up the namespace slightly by removing the checker function |
194 | unfunction git_compare_version | 206 | unfunction git_compare_version |
195 | 207 |
File was created | 1 | ## asdf | |
2 | |||
3 | **Maintainer:** [@RobLoach](https://github.com/RobLoach) | ||
4 | |||
5 | Adds integration with [asdf](https://github.com/asdf-vm/asdf), the extendable version manager, with support for Ruby, Node.js, Elixir, Erlang and more. | ||
6 | |||
7 | ### Installation | ||
8 | |||
9 | 1. Enable the plugin by adding it to your `plugins` definition in `~/.zshrc`. | ||
10 | |||
11 | ``` | ||
12 | plugins=(asdf) | ||
13 | ``` | ||
14 | |||
15 | 2. [Install asdf](https://github.com/asdf-vm/asdf#setup) by running the following: | ||
16 | ``` | ||
17 | git clone https://github.com/asdf-vm/asdf.git ~/.asdf | ||
18 | ``` | ||
19 | |||
20 | ### Usage | ||
21 | |||
22 | See the [asdf usage documentation](https://github.com/asdf-vm/asdf#usage) for information on how to use asdf: | ||
23 | |||
24 | ``` | ||
25 | asdf plugin-add nodejs git@github.com:asdf-vm/asdf-nodejs.git | ||
26 | asdf install nodejs 5.9.1 | ||
27 | ``` | ||
28 |
File was created | 1 | # Find where asdf should be installed. | |
2 | ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}" | ||
3 | |||
4 | # Load asdf, if found. | ||
5 | if [ -f $ASDF_DIR/asdf.sh ]; then | ||
6 | . $ASDF_DIR/asdf.sh | ||
7 | fi | ||
8 |
1 | # Bundler | 1 | # Bundler |
2 | 2 | ||
3 | - adds completion for basic bundler commands | 3 | - adds completion for basic bundler commands |
4 | - adds short aliases for common bundler commands | 4 | - adds short aliases for common bundler commands |
5 | - `be` aliased to `bundle exec` | 5 | - `be` aliased to `bundle exec` |
6 | - `bl` aliased to `bundle list` | 6 | - `bl` aliased to `bundle list` |
7 | - `bp` aliased to `bundle package` | 7 | - `bp` aliased to `bundle package` |
8 | - `bo` aliased to `bundle open` | 8 | - `bo` aliased to `bundle open` |
9 | - `bout` aliased to `bundle outdated` | ||
9 | - `bu` aliased to `bundle update` | 10 | - `bu` aliased to `bundle update` |
10 | - `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`) | 11 | - `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`) |
11 | - adds a wrapper for common gems: | 12 | - adds a wrapper for common gems: |
12 | - looks for a binstub under `./bin/` and executes it (if present) | 13 | - looks for a binstub under `./bin/` and executes it (if present) |
13 | - calls `bundle exec <gem executable>` otherwise | 14 | - calls `bundle exec <gem executable>` otherwise |
14 | 15 | ||
15 | For a full list of *common gems* being wrapped by default please look at the `bundler.plugin.zsh` file. | 16 | For a full list of *common gems* being wrapped by default please look at the `bundler.plugin.zsh` file. |
16 | 17 | ||
17 | ## Configuration | 18 | ## Configuration |
18 | 19 | ||
19 | Please use the exact name of the executable and not the gem name. | 20 | Please use the exact name of the executable and not the gem name. |
20 | 21 | ||
21 | ### Add additional gems to be wrapped | 22 | ### Add additional gems to be wrapped |
22 | 23 | ||
23 | Add this before the plugin-list in your `.zshrc`: | 24 | Add this before the plugin-list in your `.zshrc`: |
24 | ```sh | 25 | ```sh |
25 | BUNDLED_COMMANDS=(rubocop) | 26 | BUNDLED_COMMANDS=(rubocop) |
26 | plugins=(... bundler ...) | 27 | plugins=(... bundler ...) |
27 | ``` | 28 | ``` |
28 | This will add the wrapper for the `rubocop` gem (i.e. the executable). | 29 | This will add the wrapper for the `rubocop` gem (i.e. the executable). |
29 | 30 | ||
30 | 31 | ||
31 | ### Exclude gems from being wrapped | 32 | ### Exclude gems from being wrapped |
32 | 33 | ||
33 | Add this before the plugin-list in your `.zshrc`: | 34 | Add this before the plugin-list in your `.zshrc`: |
34 | ```sh | 35 | ```sh |
35 | UNBUNDLED_COMMANDS=(foreman spin) | 36 | UNBUNDLED_COMMANDS=(foreman spin) |
36 | plugins=(... bundler ...) | 37 | plugins=(... bundler ...) |
37 | ``` | 38 | ``` |
38 | This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped. | 39 | This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped. |
39 | 40 | ||
40 | ## Excluded gems | 41 | ## Excluded gems |
41 | 42 | ||
42 | These gems should not be called with `bundle exec`. Please see [issue #2923](https://github.com/robbyrussell/oh-my-zsh/pull/2923) on GitHub for clarification. | 43 | These gems should not be called with `bundle exec`. Please see [issue #2923](https://github.com/robbyrussell/oh-my-zsh/pull/2923) on GitHub for clarification. |
43 | 44 | ||
44 | `berks` | 45 | `berks` |
45 | `foreman` | 46 | `foreman` |
46 | `mailcatcher` | 47 | `mailcatcher` |
47 | `rails` | 48 | `rails` |
48 | `ruby` | 49 | `ruby` |
49 | `spin` | 50 | `spin` |
50 | 51 |
File was created | 1 | ## ZSH-Geeknote | |
2 | |||
3 | [Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for [oh-my-zsh framework](http://github.com/robbyrussell/oh-my-zsh). | ||
4 | |||
5 | Plugins provides: | ||
6 | |||
7 | - auto completion of commands and their options | ||
8 | - alias `gn` | ||
9 | |||
10 | You can find information how to install Geeknote and it's available commands on the [project website](http://www.geeknote.me/). | ||
11 | |||
12 | Maintainer : Ján Koščo ([@s7anley](https://twitter.com/s7anley)) | ||
13 |
File was created | 1 | #compdef geeknote | |
2 | # --------------- ------------------------------------------------------------ | ||
3 | # Name : _geeknote | ||
4 | # Synopsis : zsh completion for geeknote | ||
5 | # Author : Ján Koščo <3k.stanley@gmail.com> | ||
6 | # HomePage : http://www.geeknote.me | ||
7 | # Version : 0.1 | ||
8 | # Tag : [ shell, zsh, completion, evernote ] | ||
9 | # Copyright : © 2014 by Ján Koščo, | ||
10 | # Released under current GPL license. | ||
11 | # --------------- ------------------------------------------------------------ | ||
12 | |||
13 | local -a _1st_arguments | ||
14 | _1st_arguments=( | ||
15 | 'login' | ||
16 | 'logout' | ||
17 | 'settings' | ||
18 | 'create' | ||
19 | 'edit' | ||
20 | 'find' | ||
21 | 'show' | ||
22 | 'remove' | ||
23 | 'notebook-list' | ||
24 | 'notebook-create' | ||
25 | 'notebook-edit' | ||
26 | 'tag-list' | ||
27 | 'tag-create' | ||
28 | 'tag-edit' | ||
29 | 'tag-remove' | ||
30 | 'gnsync' | ||
31 | 'user' | ||
32 | ) | ||
33 | |||
34 | _arguments '*:: :->command' | ||
35 | |||
36 | if (( CURRENT == 1 )); then | ||
37 | _describe -t commands "geeknote command" _1st_arguments | ||
38 | return | ||
39 | fi | ||
40 | |||
41 | local -a _command_args | ||
42 | case "$words[1]" in | ||
43 | user) | ||
44 | _command_args=( | ||
45 | '(--full)--full' \ | ||
46 | ) | ||
47 | ;; | ||
48 | logout) | ||
49 | _command_args=( | ||
50 | '(--force)--force' \ | ||
51 | ) | ||
52 | ;; | ||
53 | settings) | ||
54 | _command_args=( | ||
55 | '(--editor)--editor' \ | ||
56 | ) | ||
57 | ;; | ||
58 | create) | ||
59 | _command_args=( | ||
60 | '(-t|--title)'{-t,--title}'[note title]' \ | ||
61 | '(-c|--content)'{-c,--content}'[note content]' \ | ||
62 | '(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \ | ||
63 | '(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \ | ||
64 | ) | ||
65 | ;; | ||
66 | edit) | ||
67 | _command_args=( | ||
68 | '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \ | ||
69 | '(-t|--title)'{-t,--title}'[note title]' \ | ||
70 | '(-c|--content)'{-c,--content}'[note content]' \ | ||
71 | '(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \ | ||
72 | '(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \ | ||
73 | ) | ||
74 | ;; | ||
75 | remove) | ||
76 | _command_args=( | ||
77 | '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \ | ||
78 | '(--force)--force' \ | ||
79 | ) | ||
80 | ;; | ||
81 | show) | ||
82 | _command_args=( | ||
83 | '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \ | ||
84 | ) | ||
85 | ;; | ||
86 | find) | ||
87 | _command_args=( | ||
88 | '(-s|--search)'{-s,--search}'[text to search]' \ | ||
89 | '(-tg|--tags)'{-tg,--tags}'[notes with which tag/tags to search]' \ | ||
90 | '(-nb|--notebook)'{-nb,--notebook}'[in which notebook search the note]' \ | ||
91 | '(-d|--date)'{-d,--date}'[date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy]' \ | ||
92 | '(-cn|--count)'{-cn,--count}'[how many notes show in the result list]' \ | ||
93 | '(-uo|--url-only)'{-uo,--url-only}'[add direct url of each note in results to Evernote web-version]' \ | ||
94 | '(-ee|--exact-entry)'{-ee,--exact-entry}'[search for exact entry of the request]' \ | ||
95 | '(-cs|--content-search)'{-cs,--content-search}'[search by content, not by title]' \ | ||
96 | ) | ||
97 | ;; | ||
98 | notebook-create) | ||
99 | _command_args=( | ||
100 | '(-t|--title)'{-t,--title}'[notebook title]' \ | ||
101 | ) | ||
102 | ;; | ||
103 | notebook-edit) | ||
104 | _command_args=( | ||
105 | '(-nb|--notebook)'{-nb,--notebook}'[name of notebook to rename]' \ | ||
106 | '(-t|--title)'{-t,--title}'[new notebook title]' \ | ||
107 | ) | ||
108 | ;; | ||
109 | notebook-remove) | ||
110 | _command_args=( | ||
111 | '(-nb|--notebook)'{-nb,--notebook}'[name of notebook to remove]' \ | ||
112 | '(--force)--force' \ | ||
113 | ) | ||
114 | ;; | ||
115 | tag-create) | ||
116 | _command_args=( | ||
117 | '(-t|--title)'{-t,--title}'[title of tag]' \ | ||
118 | ) | ||
119 | ;; | ||
120 | tag-edit) | ||
121 | _command_args=( | ||
122 | '(-tgn|--tagname)'{-tgn,--tagname}'[tag to edit]' \ | ||
123 | '(-t|--title)'{-t,--title}'[new tag name]' \ | ||
124 | ) | ||
125 | ;; | ||
126 | tag-remove) | ||
127 | _command_args=( | ||
128 | '(-tgn|--tagname)'{-tgn,--tagname}'[tag to remove]' \ | ||
129 | '(--force)--force' \ | ||
130 | ) | ||
131 | ;; | ||
132 | esac | ||
133 | |||
134 | _arguments \ | ||
135 | $_command_args \ | ||
136 | && return 0 | ||
137 |
File was created | 1 | #Alias | |
2 | alias gn='geeknote' | ||
3 |
1 | # Query/use custom command for `git`. | 1 | # Query/use custom command for `git`. |
2 | zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd | 2 | zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd |
3 | : ${_omz_git_git_cmd:=git} | 3 | : ${_omz_git_git_cmd:=git} |
4 | 4 | ||
5 | # | 5 | # |
6 | # Functions | 6 | # Functions |
7 | # | 7 | # |
8 | 8 | ||
9 | # The name of the current branch | 9 | # The name of the current branch |
10 | # Back-compatibility wrapper for when this function was defined here in | 10 | # Back-compatibility wrapper for when this function was defined here in |
11 | # the plugin, before being pulled in to core lib/git.zsh as git_current_branch() | 11 | # the plugin, before being pulled in to core lib/git.zsh as git_current_branch() |
12 | # to fix the core -> git plugin dependency. | 12 | # to fix the core -> git plugin dependency. |
13 | function current_branch() { | 13 | function current_branch() { |
14 | git_current_branch | 14 | git_current_branch |
15 | } | 15 | } |
16 | # The list of remotes | 16 | # The list of remotes |
17 | function current_repository() { | 17 | function current_repository() { |
18 | if ! $_omz_git_git_cmd rev-parse --is-inside-work-tree &> /dev/null; then | 18 | if ! $_omz_git_git_cmd rev-parse --is-inside-work-tree &> /dev/null; then |
19 | return | 19 | return |
20 | fi | 20 | fi |
21 | echo $($_omz_git_git_cmd remote -v | cut -d':' -f 2) | 21 | echo $($_omz_git_git_cmd remote -v | cut -d':' -f 2) |
22 | } | 22 | } |
23 | # Pretty log messages | 23 | # Pretty log messages |
24 | function _git_log_prettily(){ | 24 | function _git_log_prettily(){ |
25 | if ! [ -z $1 ]; then | 25 | if ! [ -z $1 ]; then |
26 | git log --pretty=$1 | 26 | git log --pretty=$1 |
27 | fi | 27 | fi |
28 | } | 28 | } |
29 | # Warn if the current branch is a WIP | 29 | # Warn if the current branch is a WIP |
30 | function work_in_progress() { | 30 | function work_in_progress() { |
31 | if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then | 31 | if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then |
32 | echo "WIP!!" | 32 | echo "WIP!!" |
33 | fi | 33 | fi |
34 | } | 34 | } |
35 | 35 | ||
36 | # | 36 | # |
37 | # Aliases | 37 | # Aliases |
38 | # (sorted alphabetically) | 38 | # (sorted alphabetically) |
39 | # | 39 | # |
40 | 40 | ||
41 | alias g='git' | 41 | alias g='git' |
42 | 42 | ||
43 | alias ga='git add' | 43 | alias ga='git add' |
44 | alias gaa='git add --all' | 44 | alias gaa='git add --all' |
45 | alias gapa='git add --patch' | 45 | alias gapa='git add --patch' |
46 | 46 | ||
47 | alias gb='git branch' | 47 | alias gb='git branch' |
48 | alias gba='git branch -a' | 48 | alias gba='git branch -a' |
49 | alias gbda='git branch --merged | command grep -vE "^(\*|\s*master\s*$)" | command xargs -n 1 git branch -d' | 49 | alias gbda='git branch --merged | command grep -vE "^(\*|\s*master\s*$)" | command xargs -n 1 git branch -d' |
50 | alias gbl='git blame -b -w' | 50 | alias gbl='git blame -b -w' |
51 | alias gbnm='git branch --no-merged' | 51 | alias gbnm='git branch --no-merged' |
52 | alias gbr='git branch --remote' | 52 | alias gbr='git branch --remote' |
53 | alias gbs='git bisect' | 53 | alias gbs='git bisect' |
54 | alias gbsb='git bisect bad' | 54 | alias gbsb='git bisect bad' |
55 | alias gbsg='git bisect good' | 55 | alias gbsg='git bisect good' |
56 | alias gbsr='git bisect reset' | 56 | alias gbsr='git bisect reset' |
57 | alias gbss='git bisect start' | 57 | alias gbss='git bisect start' |
58 | 58 | ||
59 | alias gc='git commit -v' | 59 | alias gc='git commit -v' |
60 | alias gc!='git commit -v --amend' | 60 | alias gc!='git commit -v --amend' |
61 | alias gca='git commit -v -a' | 61 | alias gca='git commit -v -a' |
62 | alias gca!='git commit -v -a --amend' | 62 | alias gca!='git commit -v -a --amend' |
63 | alias gcan!='git commit -v -a -s --no-edit --amend' | 63 | alias gcan!='git commit -v -a -s --no-edit --amend' |
64 | alias gcam='git commit -a -m' | 64 | alias gcam='git commit -a -m' |
65 | alias gcb='git checkout -b' | 65 | alias gcb='git checkout -b' |
66 | alias gcf='git config --list' | 66 | alias gcf='git config --list' |
67 | alias gcl='git clone --recursive' | 67 | alias gcl='git clone --recursive' |
68 | alias gclean='git clean -fd' | 68 | alias gclean='git clean -fd' |
69 | alias gpristine='git reset --hard && git clean -dfx' | 69 | alias gpristine='git reset --hard && git clean -dfx' |
70 | alias gcm='git checkout master' | 70 | alias gcm='git checkout master' |
71 | alias gcmsg='git commit -m' | 71 | alias gcmsg='git commit -m' |
72 | alias gco='git checkout' | 72 | alias gco='git checkout' |
73 | alias gcount='git shortlog -sn' | 73 | alias gcount='git shortlog -sn' |
74 | compdef gcount=git | 74 | compdef gcount=git |
75 | alias gcp='git cherry-pick' | 75 | alias gcp='git cherry-pick' |
76 | alias gcs='git commit -S' | 76 | alias gcs='git commit -S' |
77 | 77 | ||
78 | alias gd='git diff' | 78 | alias gd='git diff' |
79 | alias gdca='git diff --cached' | 79 | alias gdca='git diff --cached' |
80 | alias gdct='git describe --tags `git rev-list --tags --max-count=1`' | 80 | alias gdct='git describe --tags `git rev-list --tags --max-count=1`' |
81 | alias gdt='git diff-tree --no-commit-id --name-only -r' | 81 | alias gdt='git diff-tree --no-commit-id --name-only -r' |
82 | gdv() { git diff -w "$@" | view - } | 82 | gdv() { git diff -w "$@" | view - } |
83 | compdef _git gdv=git-diff | 83 | compdef _git gdv=git-diff |
84 | alias gdw='git diff --word-diff' | 84 | alias gdw='git diff --word-diff' |
85 | 85 | ||
86 | alias gf='git fetch' | 86 | alias gf='git fetch' |
87 | alias gfa='git fetch --all --prune' | 87 | alias gfa='git fetch --all --prune' |
88 | function gfg() { git ls-files | grep $@ } | 88 | function gfg() { git ls-files | grep $@ } |
89 | compdef gfg=grep | 89 | compdef gfg=grep |
90 | alias gfo='git fetch origin' | 90 | alias gfo='git fetch origin' |
91 | 91 | ||
92 | alias gg='git gui citool' | 92 | alias gg='git gui citool' |
93 | alias gga='git gui citool --amend' | 93 | alias gga='git gui citool --amend' |
94 | ggf() { | 94 | ggf() { |
95 | [[ "$#" != 1 ]] && local b="$(git_current_branch)" | 95 | [[ "$#" != 1 ]] && local b="$(git_current_branch)" |
96 | git push --force origin "${b:=$1}" | 96 | git push --force origin "${b:=$1}" |
97 | } | 97 | } |
98 | compdef _git ggf=git-checkout | 98 | compdef _git ggf=git-checkout |
99 | ggl() { | 99 | ggl() { |
100 | if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then | 100 | if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then |
101 | git pull origin "${*}" | 101 | git pull origin "${*}" |
102 | else | 102 | else |
103 | [[ "$#" == 0 ]] && local b="$(git_current_branch)" | 103 | [[ "$#" == 0 ]] && local b="$(git_current_branch)" |
104 | git pull origin "${b:=$1}" | 104 | git pull origin "${b:=$1}" |
105 | fi | 105 | fi |
106 | } | 106 | } |
107 | compdef _git ggl=git-checkout | 107 | compdef _git ggl=git-checkout |
108 | alias ggpull='git pull origin $(git_current_branch)' | 108 | alias ggpull='git pull origin $(git_current_branch)' |
109 | compdef _git ggpull=git-checkout | 109 | compdef _git ggpull=git-checkout |
110 | ggp() { | 110 | ggp() { |
111 | if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then | 111 | if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then |
112 | git push origin "${*}" | 112 | git push origin "${*}" |
113 | else | 113 | else |
114 | [[ "$#" == 0 ]] && local b="$(git_current_branch)" | 114 | [[ "$#" == 0 ]] && local b="$(git_current_branch)" |
115 | git push origin "${b:=$1}" | 115 | git push origin "${b:=$1}" |
116 | fi | 116 | fi |
117 | } | 117 | } |
118 | compdef _git ggp=git-checkout | 118 | compdef _git ggp=git-checkout |
119 | alias ggpush='git push origin $(git_current_branch)' | 119 | alias ggpush='git push origin $(git_current_branch)' |
120 | compdef _git ggpush=git-checkout | 120 | compdef _git ggpush=git-checkout |
121 | ggpnp() { | 121 | ggpnp() { |
122 | if [[ "$#" == 0 ]]; then | 122 | if [[ "$#" == 0 ]]; then |
123 | ggl && ggp | 123 | ggl && ggp |
124 | else | 124 | else |
125 | ggl "${*}" && ggp "${*}" | 125 | ggl "${*}" && ggp "${*}" |
126 | fi | 126 | fi |
127 | } | 127 | } |
128 | compdef _git ggpnp=git-checkout | 128 | compdef _git ggpnp=git-checkout |
129 | alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' | 129 | alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' |
130 | ggu() { | 130 | ggu() { |
131 | [[ "$#" != 1 ]] && local b="$(git_current_branch)" | 131 | [[ "$#" != 1 ]] && local b="$(git_current_branch)" |
132 | git pull --rebase origin "${b:=$1}" | 132 | git pull --rebase origin "${b:=$1}" |
133 | } | 133 | } |
134 | compdef _git ggu=git-checkout | 134 | compdef _git ggu=git-checkout |
135 | alias ggpur='ggu' | 135 | alias ggpur='ggu' |
136 | compdef _git ggpur=git-checkout | 136 | compdef _git ggpur=git-checkout |
137 | 137 | ||
138 | alias gignore='git update-index --assume-unchanged' | 138 | alias gignore='git update-index --assume-unchanged' |
139 | alias gignored='git ls-files -v | grep "^[[:lower:]]"' | 139 | alias gignored='git ls-files -v | grep "^[[:lower:]]"' |
140 | alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' | 140 | alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' |
141 | compdef git-svn-dcommit-push=git | 141 | compdef git-svn-dcommit-push=git |
142 | 142 | ||
143 | alias gk='\gitk --all --branches' | 143 | alias gk='\gitk --all --branches' |
144 | compdef _git gk='gitk' | 144 | compdef _git gk='gitk' |
145 | alias gke='\gitk --all $(git log -g --pretty=format:%h)' | 145 | alias gke='\gitk --all $(git log -g --pretty=format:%h)' |
146 | compdef _git gke='gitk' | 146 | compdef _git gke='gitk' |
147 | 147 | ||
148 | alias gl='git pull' | 148 | alias gl='git pull' |
149 | alias glg='git log --stat --color' | 149 | alias glg='git log --stat' |
150 | alias glgp='git log --stat --color -p' | 150 | alias glgp='git log --stat -p' |
151 | alias glgg='git log --graph --color' | 151 | alias glgg='git log --graph' |
152 | alias glgga='git log --graph --decorate --all' | 152 | alias glgga='git log --graph --decorate --all' |
153 | alias glgm='git log --graph --max-count=10' | 153 | alias glgm='git log --graph --max-count=10' |
154 | alias glo='git log --oneline --decorate --color' | 154 | alias glo='git log --oneline --decorate' |
155 | alias glol="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" | 155 | alias glol="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" |
156 | alias glola="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all" | 156 | alias glola="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all" |
157 | alias glog='git log --oneline --decorate --color --graph' | 157 | alias glog='git log --oneline --decorate --graph' |
158 | alias glp="_git_log_prettily" | 158 | alias glp="_git_log_prettily" |
159 | compdef _git glp=git-log | 159 | compdef _git glp=git-log |
160 | 160 | ||
161 | alias gm='git merge' | 161 | alias gm='git merge' |
162 | alias gmom='git merge origin/master' | 162 | alias gmom='git merge origin/master' |
163 | alias gmt='git mergetool --no-prompt' | 163 | alias gmt='git mergetool --no-prompt' |
164 | alias gmtvim='git mergetool --no-prompt --tool=vimdiff' | 164 | alias gmtvim='git mergetool --no-prompt --tool=vimdiff' |
165 | alias gmum='git merge upstream/master' | 165 | alias gmum='git merge upstream/master' |
166 | 166 | ||
167 | alias gp='git push' | 167 | alias gp='git push' |
168 | alias gpd='git push --dry-run' | 168 | alias gpd='git push --dry-run' |
169 | alias gpoat='git push origin --all && git push origin --tags' | 169 | alias gpoat='git push origin --all && git push origin --tags' |
170 | compdef _git gpoat=git-push | 170 | compdef _git gpoat=git-push |
171 | alias gpu='git push upstream' | 171 | alias gpu='git push upstream' |
172 | alias gpv='git push -v' | 172 | alias gpv='git push -v' |
173 | 173 | ||
174 | alias gr='git remote' | 174 | alias gr='git remote' |
175 | alias gra='git remote add' | 175 | alias gra='git remote add' |
176 | alias grb='git rebase' | 176 | alias grb='git rebase' |
177 | alias grba='git rebase --abort' | 177 | alias grba='git rebase --abort' |
178 | alias grbc='git rebase --continue' | 178 | alias grbc='git rebase --continue' |
179 | alias grbi='git rebase -i' | 179 | alias grbi='git rebase -i' |
180 | alias grbm='git rebase master' | 180 | alias grbm='git rebase master' |
181 | alias grbs='git rebase --skip' | 181 | alias grbs='git rebase --skip' |
182 | alias grh='git reset HEAD' | 182 | alias grh='git reset HEAD' |
183 | alias grhh='git reset HEAD --hard' | 183 | alias grhh='git reset HEAD --hard' |
184 | alias grmv='git remote rename' | 184 | alias grmv='git remote rename' |
185 | alias grrm='git remote remove' | 185 | alias grrm='git remote remove' |
186 | alias grset='git remote set-url' | 186 | alias grset='git remote set-url' |
187 | alias grt='cd $(git rev-parse --show-toplevel || echo ".")' | 187 | alias grt='cd $(git rev-parse --show-toplevel || echo ".")' |
188 | alias gru='git reset --' | 188 | alias gru='git reset --' |
189 | alias grup='git remote update' | 189 | alias grup='git remote update' |
190 | alias grv='git remote -v' | 190 | alias grv='git remote -v' |
191 | 191 | ||
192 | alias gsb='git status -sb' | 192 | alias gsb='git status -sb' |
193 | alias gsd='git svn dcommit' | 193 | alias gsd='git svn dcommit' |
194 | alias gsi='git submodule init' | 194 | alias gsi='git submodule init' |
195 | alias gsps='git show --pretty=short --show-signature' | 195 | alias gsps='git show --pretty=short --show-signature' |
196 | alias gsr='git svn rebase' | 196 | alias gsr='git svn rebase' |
197 | alias gss='git status -s' | 197 | alias gss='git status -s' |
198 | alias gst='git status' | 198 | alias gst='git status' |
199 | alias gsta='git stash' | 199 | alias gsta='git stash' |
200 | alias gstaa='git stash apply' | 200 | alias gstaa='git stash apply' |
201 | alias gstd='git stash drop' | 201 | alias gstd='git stash drop' |
202 | alias gstl='git stash list' | 202 | alias gstl='git stash list' |
203 | alias gstp='git stash pop' | 203 | alias gstp='git stash pop' |
204 | alias gsts='git stash show --text' | 204 | alias gsts='git stash show --text' |
205 | alias gsu='git submodule update' | 205 | alias gsu='git submodule update' |
206 | 206 | ||
207 | alias gts='git tag -s' | 207 | alias gts='git tag -s' |
208 | alias gtv='git tag | sort -V' | 208 | alias gtv='git tag | sort -V' |
209 | 209 | ||
210 | alias gunignore='git update-index --no-assume-unchanged' | 210 | alias gunignore='git update-index --no-assume-unchanged' |
211 | alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' | 211 | alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' |
212 | alias gup='git pull --rebase' | 212 | alias gup='git pull --rebase' |
213 | alias gupv='git pull --rebase -v' | 213 | alias gupv='git pull --rebase -v' |
214 | alias glum='git pull upstream master' | 214 | alias glum='git pull upstream master' |
215 | 215 | ||
216 | alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' | 216 | alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' |
217 | alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--"' | 217 | alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--"' |
218 | 218 |
1 | # github | 1 | # github |
2 | 2 | ||
3 | This plugin supports working with GitHub the command line. It provides a few things: | 3 | This plugin supports working with GitHub from the command line. It provides a few things: |
4 | 4 | ||
5 | * Sets up the `hub` wrapper and completions for the `git` command if you have `hub` installed. | 5 | * Sets up the `hub` wrapper and completions for the `git` command if you have `hub` installed. |
6 | * Completion for the `github` Ruby gem. | 6 | * Completion for the `github` Ruby gem. |
7 | * Convenience functions for working with repos and URLs. | 7 | * Convenience functions for working with repos and URLs. |
8 | 8 | ||
9 | ### Functions | 9 | ### Functions |
10 | 10 | ||
11 | * `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub | 11 | * `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub |
12 | * `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub | 12 | * `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub |
13 | * `exist_gh` - Takes an existing repo and pushes it to GitHub | 13 | * `exist_gh` - Takes an existing repo and pushes it to GitHub |
14 | * `git.io` - Shortens a URL using [git.io](http://git.io) | 14 | * `git.io` - Shortens a URL using [git.io](http://git.io) |
15 | 15 | ||
16 | 16 | ||
17 | ## Installation | 17 | ## Installation |
18 | 18 | ||
19 | [Hub](http://github.com/github/hub) needs to be installed if you want to use it. On OS X with Homebrew, this can be done with `brew install hub`. The `hub` completion definition needs to be added to your `$FPATH` before initializing OMZ. | 19 | [Hub](http://github.com/github/hub) needs to be installed if you want to use it. On OS X with Homebrew, this can be done with `brew install hub`. The `hub` completion definition needs to be added to your `$FPATH` before initializing OMZ. |
20 | 20 | ||
21 | The [`github` Ruby gem](http://github.com/defunkt/github-gem) needs to be installed if you want to use it. | 21 | The [`github` Ruby gem](http://github.com/defunkt/github-gem) needs to be installed if you want to use it. |
22 | 22 | ||
23 | ### Configuration | 23 | ### Configuration |
24 | 24 | ||
25 | These settings affect `github`'s behavior. | 25 | These settings affect `github`'s behavior. |
26 | 26 | ||
27 | #### Environment variables | 27 | #### Environment variables |
28 | 28 | ||
29 | * `$GITHUB_USER` | 29 | * `$GITHUB_USER` |
30 | * `$GITHUB_PASSWORD` | 30 | * `$GITHUB_PASSWORD` |
31 | 31 | ||
32 | #### Git configuration options | 32 | #### Git configuration options |
33 | 33 | ||
34 | * `github.user` - GitHub username for repo operations | 34 | * `github.user` - GitHub username for repo operations |
35 | 35 | ||
36 | See `man hub` for more details. | 36 | See `man hub` for more details. |
37 | 37 | ||
38 | ### Homebrew installation note | 38 | ### Homebrew installation note |
39 | 39 | ||
40 | If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`. | 40 | If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which will be on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`. |
41 | 41 | ||
42 | ```zsh | 42 | ```zsh |
43 | if (( ! ${fpath[(I)/usr/local/share/zsh/site-functions]} )); then | 43 | if (( ! ${fpath[(I)/usr/local/share/zsh/site-functions]} )); then |
44 | FPATH=/usr/local/share/zsh/site-functions:$FPATH | 44 | FPATH=/usr/local/share/zsh/site-functions:$FPATH |
45 | fi | 45 | fi |
46 | ``` | 46 | ``` |
47 | 47 |
1 | eval "$(npm completion 2>/dev/null)" | 1 | eval "$(npm completion 2>/dev/null)" |
2 | 2 | ||
3 | # Install dependencies globally | 3 | # Install dependencies globally |
4 | alias npmg="npm i -g " | 4 | alias npmg="npm i -g " |
5 | 5 | ||
6 | # npm package names are lowercase | 6 | # npm package names are lowercase |
7 | # Thus, we've used camelCase for the following aliases: | 7 | # Thus, we've used camelCase for the following aliases: |
8 | 8 | ||
9 | # Install and save to dependencies in your package.json | 9 | # Install and save to dependencies in your package.json |
10 | # npms is used by https://www.npmjs.com/package/npms | 10 | # npms is used by https://www.npmjs.com/package/npms |
11 | alias npmS="npm i -S " | 11 | alias npmS="npm i -S " |
12 | 12 | ||
13 | # Install and save to dev-dependencies in your package.json | 13 | # Install and save to dev-dependencies in your package.json |
14 | # npmd is used by https://github.com/dominictarr/npmd | 14 | # npmd is used by https://github.com/dominictarr/npmd |
15 | alias npmD="npm i -D " | 15 | alias npmD="npm i -D " |
16 | 16 | ||
17 | # Execute command from node_modules folder based on current directory | 17 | # Execute command from node_modules folder based on current directory |
18 | # i.e npmE gulp | 18 | # i.e npmE gulp |
19 | alias npmE='PATH="$(npm bin)":"$PATH"' | 19 | alias npmE='PATH="$(npm bin)":"$PATH"' |
20 | |||
21 | # Check which npm modules are outdated | ||
22 | alias npmO="npm outdated" | ||
20 | 23 |
1 | # Symfony2 basic command completion | 1 | # Symfony2 basic command completion |
2 | 2 | ||
3 | _symfony_console () { | 3 | _symfony_console () { |
4 | echo "php $(find . -maxdepth 2 -mindepth 1 -name 'console' -type f | head -n 1)" | 4 | echo "php $(find . -maxdepth 2 -mindepth 1 -name 'console' -type f | head -n 1)" |
5 | } | 5 | } |
6 | 6 | ||
7 | _symfony2_get_command_list () { | 7 | _symfony2_get_command_list () { |
8 | `_symfony_console` --no-ansi | sed "1,/Available commands/d" | awk '/^ ?[^ ]+ / { print $1 }' | 8 | `_symfony_console` --no-ansi | sed "1,/Available commands/d" | awk '/^ ?[^ ]+ / { print $1 }' |
9 | } | 9 | } |
10 | 10 | ||
11 | _symfony2 () { | 11 | _symfony2 () { |
12 | compadd `_symfony2_get_command_list` | 12 | compadd `_symfony2_get_command_list` |
13 | } | 13 | } |
14 | 14 | ||
15 | compdef _symfony2 '`_symfony_console`' | 15 | compdef _symfony2 '`_symfony_console`' |
16 | compdef _symfony2 'app/console' | 16 | compdef _symfony2 'app/console' |
17 | compdef _symfony2 'bin/console' | 17 | compdef _symfony2 'bin/console' |
18 | compdef _symfony2 sf | 18 | compdef _symfony2 sf |
19 | 19 | ||
20 | #Alias | 20 | #Alias |
21 | alias sf='`_symfony_console`' | 21 | alias sf='`_symfony_console`' |
22 | alias sfcl='sf cache:clear' | 22 | alias sfcl='sf cache:clear' |
23 | alias sfsr='sf server:run -vvv' | 23 | alias sfsr='sf server:run -vvv' |
24 | alias sfcw='sf cache:warmup' | 24 | alias sfcw='sf cache:warmup' |
25 | alias sfroute='sf router:debug' | 25 | alias sfroute='sf router:debug' |
26 | alias sfcontainer='sf container:debug' | 26 | alias sfcontainer='sf container:debug' |
27 | alias sfgb='sf generate:bundle' | 27 | alias sfgb='sf generate:bundle' |
28 | alias sfdev='sf --env=dev' | ||
29 | alias sfprod='sf --env=prod' | ||
28 | 30 |
1 | # If the tm command is called without an argument, open TextMate in the current directory | 1 | # If the tm command is called without an argument, open TextMate in the current directory |
2 | # If tm is passed a directory, cd to it and open it in TextMate | 2 | # If tm is passed a directory, cd to it and open it in TextMate |
3 | # If tm is passed a file, open it in TextMate | 3 | # If tm is passed anything else (i.e., a list of files and/or options), pass them all along |
4 | # This allows easy opening of multiple files. | ||
4 | function tm() { | 5 | function tm() { |
5 | if [[ -z $1 ]]; then | 6 | if [[ -z $1 ]]; then |
6 | mate . | 7 | mate . |
7 | else | 8 | elif [[ -d $1 ]]; then |
8 | mate $1 | 9 | mate $1 |
9 | if [[ -d $1 ]]; then | 10 | cd $1 |
10 | cd $1 | 11 | else |
11 | fi | 12 | mate "$@" |
12 | fi | 13 | fi |
13 | } | 14 | } |
14 | 15 |
1 | # AVIT ZSH Theme | 1 | # AVIT ZSH Theme |
2 | 2 | ||
3 | PROMPT=' | 3 | PROMPT=' |
4 | $(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version) | 4 | $(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version) |
5 | ▶ ' | 5 | %{$fg[$CARETCOLOR]%}▶%{$resetcolor%} ' |
6 | 6 | ||
7 | PROMPT2='%{$fg[grey]%}◀%{$reset_color%} ' | 7 | PROMPT2='%{$fg[$CARETCOLOR]%}◀%{$reset_color%} ' |
8 | 8 | ||
9 | RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' | 9 | RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' |
10 | 10 | ||
11 | local _current_dir="%{$fg[blue]%}%3~%{$reset_color%} " | 11 | local _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} " |
12 | local _return_status="%{$fg[red]%}%(?..⍉)%{$reset_color%}" | 12 | local _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}" |
13 | local _hist_no="%{$fg[grey]%}%h%{$reset_color%}" | 13 | local _hist_no="%{$fg[grey]%}%h%{$reset_color%}" |
14 | 14 | ||
15 | function _current_dir() { | ||
16 | local _max_pwd_length="65" | ||
17 | if [[ $(echo -n $PWD | wc -c) -gt ${_max_pwd_length} ]]; then | ||
18 | echo "%{$fg_bold[blue]%}%-2~ ... %3~%{$reset_color%} " | ||
19 | else | ||
20 | echo "%{$fg_bold[blue]%}%~%{$reset_color%} " | ||
21 | fi | ||
22 | } | ||
23 | |||
15 | function _user_host() { | 24 | function _user_host() { |
16 | if [[ -n $SSH_CONNECTION ]]; then | 25 | if [[ -n $SSH_CONNECTION ]]; then |
17 | me="%n@%m" | 26 | me="%n@%m" |
18 | elif [[ $LOGNAME != $USER ]]; then | 27 | elif [[ $LOGNAME != $USER ]]; then |
19 | me="%n" | 28 | me="%n" |
20 | fi | 29 | fi |
21 | if [[ -n $me ]]; then | 30 | if [[ -n $me ]]; then |
22 | echo "%{$fg[cyan]%}$me%{$reset_color%}:" | 31 | echo "%{$fg[cyan]%}$me%{$reset_color%}:" |
23 | fi | 32 | fi |
24 | } | 33 | } |
25 | 34 | ||
26 | function _vi_status() { | 35 | function _vi_status() { |
27 | if {echo $fpath | grep -q "plugins/vi-mode"}; then | 36 | if {echo $fpath | grep -q "plugins/vi-mode"}; then |
28 | echo "$(vi_mode_prompt_info)" | 37 | echo "$(vi_mode_prompt_info)" |
29 | fi | 38 | fi |
30 | } | 39 | } |
31 | 40 | ||
32 | function _ruby_version() { | 41 | function _ruby_version() { |
33 | if {echo $fpath | grep -q "plugins/rvm"}; then | 42 | if {echo $fpath | grep -q "plugins/rvm"}; then |
34 | echo "%{$fg[grey]%}$(rvm_prompt_info)%{$reset_color%}" | 43 | echo "%{$fg[grey]%}$(rvm_prompt_info)%{$reset_color%}" |
35 | fi | 44 | fi |
36 | } | 45 | } |
37 | 46 | ||
38 | # Determine the time since last commit. If branch is clean, | 47 | # Determine the time since last commit. If branch is clean, |
39 | # use a neutral color, otherwise colors will vary according to time. | 48 | # use a neutral color, otherwise colors will vary according to time. |
40 | function _git_time_since_commit() { | 49 | function _git_time_since_commit() { |
41 | # Only proceed if there is actually a commit. | 50 | # Only proceed if there is actually a commit. |
42 | if git log -1 > /dev/null 2>&1; then | 51 | if git log -1 > /dev/null 2>&1; then |
43 | # Get the last commit. | 52 | # Get the last commit. |
44 | last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null) | 53 | last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null) |
45 | now=$(date +%s) | 54 | now=$(date +%s) |
46 | seconds_since_last_commit=$((now-last_commit)) | 55 | seconds_since_last_commit=$((now-last_commit)) |
47 | 56 | ||
48 | # Totals | 57 | # Totals |
49 | minutes=$((seconds_since_last_commit / 60)) | 58 | minutes=$((seconds_since_last_commit / 60)) |
50 | hours=$((seconds_since_last_commit/3600)) | 59 | hours=$((seconds_since_last_commit/3600)) |
51 | 60 | ||
52 | # Sub-hours and sub-minutes | 61 | # Sub-hours and sub-minutes |
53 | days=$((seconds_since_last_commit / 86400)) | 62 | days=$((seconds_since_last_commit / 86400)) |
54 | sub_hours=$((hours % 24)) | 63 | sub_hours=$((hours % 24)) |
55 | sub_minutes=$((minutes % 60)) | 64 | sub_minutes=$((minutes % 60)) |
56 | 65 | ||
57 | if [ $hours -gt 24 ]; then | 66 | if [ $hours -gt 24 ]; then |
58 | commit_age="${days}d" | 67 | commit_age="${days}d" |
59 | elif [ $minutes -gt 60 ]; then | 68 | elif [ $minutes -gt 60 ]; then |
60 | commit_age="${sub_hours}h${sub_minutes}m" | 69 | commit_age="${sub_hours}h${sub_minutes}m" |
61 | else | 70 | else |
62 | commit_age="${minutes}m" | 71 | commit_age="${minutes}m" |
63 | fi | 72 | fi |
64 | 73 | ||
65 | color=$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL | 74 | color=$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL |
66 | echo "$color$commit_age%{$reset_color%}" | 75 | echo "$color$commit_age%{$reset_color%}" |
67 | fi | 76 | fi |
68 | } | 77 | } |
69 | 78 | ||
70 | if [[ $USER == "root" ]]; then | 79 | if [[ $USER == "root" ]]; then |
71 | CARETCOLOR="red" | 80 | CARETCOLOR="red" |
72 | else | 81 | else |
73 | CARETCOLOR="white" | 82 | CARETCOLOR="white" |
74 | fi | 83 | fi |
75 | 84 | ||
76 | MODE_INDICATOR="%{$fg_bold[yellow]%}❮%{$reset_color%}%{$fg[yellow]%}❮❮%{$reset_color%}" | 85 | MODE_INDICATOR="%{$fg_bold[yellow]%}❮%{$reset_color%}%{$fg[yellow]%}❮❮%{$reset_color%}" |
77 | 86 | ||
78 | ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" | 87 | ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" |
79 | ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | 88 | ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" |
80 | 89 | ||
81 | ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗%{$reset_color%}" | 90 | ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗%{$reset_color%}" |
82 | ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$reset_color%}" | 91 | ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$reset_color%}" |
83 | ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}✚ " | 92 | ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}✚ " |
84 | ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}⚑ " | 93 | ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}⚑ " |
85 | ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✖ " | 94 | ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✖ " |
86 | ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}▴ " | 95 | ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}▴ " |
87 | ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}§ " | 96 | ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}§ " |
88 | ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}◒ " | 97 | ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[white]%}◒ " |
89 | 98 | ||
90 | # Colors vary depending on time lapsed. | 99 | # Colors vary depending on time lapsed. |
91 | ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" | 100 | ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" |
92 | ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" | 101 | ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" |
93 | ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" | 102 | ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" |
94 | ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[grey]%}" | 103 | ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[white]%}" |
95 | 104 | ||
96 | # LS colors, made with http://geoff.greer.fm/lscolors/ | 105 | # LS colors, made with http://geoff.greer.fm/lscolors/ |
97 | export LSCOLORS="exfxcxdxbxegedabagacad" | 106 | export LSCOLORS="exfxcxdxbxegedabagacad" |
98 | export LS_COLORS='di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:' | 107 | export LS_COLORS='di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:' |
99 | export GREP_COLOR='1;33' | 108 | export GREP_COLOR='1;33' |
100 | 109 |
1 | # ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png | 1 | # ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png |
2 | local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" | 2 | local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" |
3 | 3 | ||
4 | local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' | 4 | |
5 | if [[ $UID -eq 0 ]]; then | ||
6 | local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}' | ||
7 | else | ||
8 | local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' | ||
9 | fi | ||
10 | |||
5 | local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' | 11 | local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' |
6 | local rvm_ruby='' | 12 | local rvm_ruby='' |
7 | if which rvm-prompt &> /dev/null; then | 13 | if which rvm-prompt &> /dev/null; then |
8 | rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' | 14 | rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' |
9 | else | 15 | else |
10 | if which rbenv &> /dev/null; then | 16 | if which rbenv &> /dev/null; then |
11 | rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}' | 17 | rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}' |
12 | fi | 18 | fi |
13 | fi | 19 | fi |
14 | local git_branch='$(git_prompt_info)%{$reset_color%}' | 20 | local git_branch='$(git_prompt_info)%{$reset_color%}' |
15 | 21 | ||
16 | PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} | 22 | PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} |
17 | ╰─%B$%b " | 23 | ╰─%B$%b " |
18 | RPS1="${return_code}" | 24 | RPS1="${return_code}" |
19 | 25 | ||
20 | ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" | 26 | ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" |
21 | ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" | 27 | ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" |
22 | 28 |
1 | # oh-my-zsh Bureau Theme | 1 | # oh-my-zsh Bureau Theme |
2 | 2 | ||
3 | ### NVM | 3 | ### NVM |
4 | 4 | ||
5 | ZSH_THEME_NVM_PROMPT_PREFIX="%B⬡%b " | 5 | ZSH_THEME_NVM_PROMPT_PREFIX="%B⬡%b " |
6 | ZSH_THEME_NVM_PROMPT_SUFFIX="" | 6 | ZSH_THEME_NVM_PROMPT_SUFFIX="" |
7 | 7 | ||
8 | ### Git [±master ▾●] | 8 | ### Git [±master ▾●] |
9 | 9 | ||
10 | ZSH_THEME_GIT_PROMPT_PREFIX="[%{$fg_bold[green]%}±%{$reset_color%}%{$fg_bold[white]%}" | 10 | ZSH_THEME_GIT_PROMPT_PREFIX="[%{$fg_bold[green]%}±%{$reset_color%}%{$fg_bold[white]%}" |
11 | ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}]" | 11 | ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}]" |
12 | ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓%{$reset_color%}" | 12 | ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓%{$reset_color%}" |
13 | ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[cyan]%}▴%{$reset_color%}" | 13 | ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[cyan]%}▴%{$reset_color%}" |
14 | ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg[magenta]%}▾%{$reset_color%}" | 14 | ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg[magenta]%}▾%{$reset_color%}" |
15 | ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●%{$reset_color%}" | 15 | ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●%{$reset_color%}" |
16 | ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[yellow]%}●%{$reset_color%}" | 16 | ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[yellow]%}●%{$reset_color%}" |
17 | ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}●%{$reset_color%}" | 17 | ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}●%{$reset_color%}" |
18 | 18 | ||
19 | bureau_git_branch () { | 19 | bureau_git_branch () { |
20 | ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ | 20 | ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ |
21 | ref=$(command git rev-parse --short HEAD 2> /dev/null) || return | 21 | ref=$(command git rev-parse --short HEAD 2> /dev/null) || return |
22 | echo "${ref#refs/heads/}" | 22 | echo "${ref#refs/heads/}" |
23 | } | 23 | } |
24 | 24 | ||
25 | bureau_git_status () { | 25 | bureau_git_status () { |
26 | _INDEX=$(command git status --porcelain -b 2> /dev/null) | ||
27 | _STATUS="" | 26 | _STATUS="" |
28 | if $(echo "$_INDEX" | grep '^[AMRD]. ' &> /dev/null); then | 27 | if [[ $(command git status --short 2> /dev/null) != "" ]]; then |
29 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED" | 28 | _INDEX=$(command git status --porcelain -b 2> /dev/null) |
30 | fi | 29 | if $(echo "$_INDEX" | command grep '^[AMRD]. ' &> /dev/null); then |
31 | if $(echo "$_INDEX" | grep '^.[MTD] ' &> /dev/null); then | 30 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED" |
32 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" | 31 | fi |
33 | fi | 32 | if $(echo "$_INDEX" | command grep '^.[MTD] ' &> /dev/null); then |
34 | if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then | 33 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" |
35 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" | 34 | fi |
36 | fi | 35 | if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then |
37 | if $(echo "$_INDEX" | grep '^UU ' &> /dev/null); then | 36 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" |
38 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" | 37 | fi |
39 | fi | 38 | if $(echo "$_INDEX" | command grep '^UU ' &> /dev/null); then |
40 | if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then | 39 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" |
41 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED" | 40 | fi |
42 | fi | 41 | if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then |
43 | if $(echo "$_INDEX" | grep '^## .*ahead' &> /dev/null); then | 42 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED" |
44 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" | 43 | fi |
45 | fi | 44 | if $(echo "$_INDEX" | command grep '^## .*ahead' &> /dev/null); then |
46 | if $(echo "$_INDEX" | grep '^## .*behind' &> /dev/null); then | 45 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" |
47 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" | 46 | fi |
48 | fi | 47 | if $(echo "$_INDEX" | command grep '^## .*behind' &> /dev/null); then |
49 | if $(echo "$_INDEX" | grep '^## .*diverged' &> /dev/null); then | 48 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" |
50 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED" | 49 | fi |
50 | if $(echo "$_INDEX" | command grep '^## .*diverged' &> /dev/null); then | ||
51 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED" | ||
52 | fi | ||
53 | else | ||
54 | _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_CLEAN" | ||
51 | fi | 55 | fi |
52 | 56 | ||
53 | echo $_STATUS | 57 | echo $_STATUS |
54 | } | 58 | } |
55 | 59 | ||
56 | bureau_git_prompt () { | 60 | bureau_git_prompt () { |
57 | local _branch=$(bureau_git_branch) | 61 | local _branch=$(bureau_git_branch) |
58 | local _status=$(bureau_git_status) | 62 | local _status=$(bureau_git_status) |
59 | local _result="" | 63 | local _result="" |
60 | if [[ "${_branch}x" != "x" ]]; then | 64 | if [[ "${_branch}x" != "x" ]]; then |
61 | _result="$ZSH_THEME_GIT_PROMPT_PREFIX$_branch" | 65 | _result="$ZSH_THEME_GIT_PROMPT_PREFIX$_branch" |
62 | if [[ "${_status}x" != "x" ]]; then | 66 | if [[ "${_status}x" != "x" ]]; then |
63 | _result="$_result $_status" | 67 | _result="$_result $_status" |
64 | fi | 68 | fi |
65 | _result="$_result$ZSH_THEME_GIT_PROMPT_SUFFIX" | 69 | _result="$_result$ZSH_THEME_GIT_PROMPT_SUFFIX" |
66 | fi | 70 | fi |
67 | echo $_result | 71 | echo $_result |
68 | } | 72 | } |
69 | 73 | ||
70 | 74 | ||
71 | _PATH="%{$fg_bold[white]%}%~%{$reset_color%}" | 75 | _PATH="%{$fg_bold[white]%}%~%{$reset_color%}" |
72 | 76 | ||
73 | if [[ $EUID -eq 0 ]]; then | 77 | if [[ $EUID -eq 0 ]]; then |
74 | _USERNAME="%{$fg_bold[red]%}%n" | 78 | _USERNAME="%{$fg_bold[red]%}%n" |
75 | _LIBERTY="%{$fg[red]%}#" | 79 | _LIBERTY="%{$fg[red]%}#" |
76 | else | 80 | else |
77 | _USERNAME="%{$fg_bold[white]%}%n" | 81 | _USERNAME="%{$fg_bold[white]%}%n" |
78 | _LIBERTY="%{$fg[green]%}$" | 82 | _LIBERTY="%{$fg[green]%}$" |
79 | fi | 83 | fi |
80 | _USERNAME="$_USERNAME%{$reset_color%}@%m" | 84 | _USERNAME="$_USERNAME%{$reset_color%}@%m" |
81 | _LIBERTY="$_LIBERTY%{$reset_color%}" | 85 | _LIBERTY="$_LIBERTY%{$reset_color%}" |
82 | 86 | ||
83 | 87 | ||
84 | get_space () { | 88 | get_space () { |
85 | local STR=$1$2 | 89 | local STR=$1$2 |
86 | local zero='%([BSUbfksu]|([FB]|){*})' | 90 | local zero='%([BSUbfksu]|([FB]|){*})' |
87 | local LENGTH=${#${(S%%)STR//$~zero/}} | 91 | local LENGTH=${#${(S%%)STR//$~zero/}} |
88 | local SPACES="" | 92 | local SPACES="" |
89 | (( LENGTH = ${COLUMNS} - $LENGTH - 1)) | 93 | (( LENGTH = ${COLUMNS} - $LENGTH - 1)) |
90 | 94 | ||
91 | for i in {0..$LENGTH} | 95 | for i in {0..$LENGTH} |
92 | do | 96 | do |
93 | SPACES="$SPACES " | 97 | SPACES="$SPACES " |
94 | done | 98 | done |
95 | 99 | ||
96 | echo $SPACES | 100 | echo $SPACES |
97 | } | 101 | } |
98 | 102 | ||
99 | _1LEFT="$_USERNAME $_PATH" | 103 | _1LEFT="$_USERNAME $_PATH" |
100 | _1RIGHT="[%*] " | 104 | _1RIGHT="[%*] " |
101 | 105 | ||
102 | bureau_precmd () { | 106 | bureau_precmd () { |
103 | _1SPACES=`get_space $_1LEFT $_1RIGHT` | 107 | _1SPACES=`get_space $_1LEFT $_1RIGHT` |
104 | 108 | ||
105 | print -rP "$_1LEFT$_1SPACES$_1RIGHT" | 109 | print -rP "$_1LEFT$_1SPACES$_1RIGHT" |
106 | } | 110 | } |
107 | 111 | ||
108 | setopt prompt_subst | 112 | setopt prompt_subst |
109 | PROMPT='> $_LIBERTY ' | 113 | PROMPT='> $_LIBERTY ' |
110 | RPROMPT='$(nvm_prompt_info) $(bureau_git_prompt)' | 114 | RPROMPT='$(nvm_prompt_info) $(bureau_git_prompt)' |
111 | 115 | ||
112 | autoload -U add-zsh-hook | 116 | autoload -U add-zsh-hook |
113 | add-zsh-hook precmd bureau_precmd | 117 | add-zsh-hook precmd bureau_precmd |
1 | PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ | 1 | PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%X]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ |
2 | %{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} ' | 2 | %{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} ' |
3 | 3 | ||
4 | ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" | 4 | ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" |
5 | ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" | 5 | ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" |
6 | ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}" | 6 | ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}" |
7 | ZSH_THEME_GIT_PROMPT_CLEAN="" | 7 | ZSH_THEME_GIT_PROMPT_CLEAN="" |
8 | 8 |
1 | local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" | 1 | local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" |
2 | 2 | ||
3 | PROMPT='%{$fg[green]%}%c \ | 3 | PROMPT='$(virtualenv_prompt_info)%{[03m%}%{$fg[green]%}%c \ |
4 | $(git_prompt_info)\ | 4 | $(git_prompt_info)\ |
5 | \ | ||
5 | %{$fg[red]%}%(!.#.»)%{$reset_color%} ' | 6 | %{$fg[red]%}%(!.#.»)%{$reset_color%} ' |
6 | PROMPT2='%{$fg[red]%}\ %{$reset_color%}' | 7 | PROMPT2='%{$fg[red]%}\ %{$reset_color%}' |
7 | RPS1='%{$fg[blue]%}%~%{$reset_color%} ${return_code} ' | 8 | RPS1='%{$fg[blue]%}%~%{$reset_color%} ${return_code} ' |
8 | 9 | ||
9 | ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}:: %{$fg[yellow]%}(" | 10 | ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[yellow]%}(" |
10 | ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%} " | 11 | ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%} " |
11 | ZSH_THEME_GIT_PROMPT_CLEAN="" | 12 | ZSH_THEME_GIT_PROMPT_CLEAN="" |
12 | ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$fg[yellow]%}" | 13 | ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$fg[yellow]%}" |
13 | 14 | ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$reset_color%}%{[03m%}%{$fg[blue]%}" | |
15 | ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="!%{$reset_color%} " |
1 | # Clean, simple, compatible and meaningful. | 1 | # Clean, simple, compatible and meaningful. |
2 | # Tested on Linux, Unix and Windows under ANSI colors. | 2 | # Tested on Linux, Unix and Windows under ANSI colors. |
3 | # It is recommended to use with a dark background and the font Inconsolata. | 3 | # It is recommended to use with a dark background. |
4 | # Colors: black, red, green, yellow, *blue, magenta, cyan, and white. | 4 | # Colors: black, red, green, yellow, *blue, magenta, cyan, and white. |
5 | # | 5 | # |
6 | # http://ysmood.org/wp/2013/03/my-ys-terminal-theme/ | 6 | # Mar 2013 Yad Smood |
7 | # Mar 2013 ys | ||
8 | |||
9 | # Machine name. | ||
10 | function box_name { | ||
11 | [ -f ~/.box-name ] && cat ~/.box-name || echo $HOST | ||
12 | } | ||
13 | |||
14 | # Directory info. | ||
15 | local current_dir='${PWD/#$HOME/~}' | ||
16 | 7 | ||
17 | # VCS | 8 | # VCS |
18 | YS_VCS_PROMPT_PREFIX1=" %{$fg[white]%}on%{$reset_color%} " | 9 | YS_VCS_PROMPT_PREFIX1=" %{$fg[white]%}on%{$reset_color%} " |
19 | YS_VCS_PROMPT_PREFIX2=":%{$fg[cyan]%}" | 10 | YS_VCS_PROMPT_PREFIX2=":%{$fg[cyan]%}" |
20 | YS_VCS_PROMPT_SUFFIX="%{$reset_color%}" | 11 | YS_VCS_PROMPT_SUFFIX="%{$reset_color%}" |
21 | YS_VCS_PROMPT_DIRTY=" %{$fg[red]%}x" | 12 | YS_VCS_PROMPT_DIRTY=" %{$fg[red]%}x" |
22 | YS_VCS_PROMPT_CLEAN=" %{$fg[green]%}o" | 13 | YS_VCS_PROMPT_CLEAN=" %{$fg[green]%}o" |
23 | 14 | ||
24 | # Git info. | 15 | # Git info |
25 | local git_info='$(git_prompt_info)' | 16 | local git_info='$(git_prompt_info)' |
26 | ZSH_THEME_GIT_PROMPT_PREFIX="${YS_VCS_PROMPT_PREFIX1}git${YS_VCS_PROMPT_PREFIX2}" | 17 | ZSH_THEME_GIT_PROMPT_PREFIX="${YS_VCS_PROMPT_PREFIX1}git${YS_VCS_PROMPT_PREFIX2}" |
27 | ZSH_THEME_GIT_PROMPT_SUFFIX="$YS_VCS_PROMPT_SUFFIX" | 18 | ZSH_THEME_GIT_PROMPT_SUFFIX="$YS_VCS_PROMPT_SUFFIX" |
28 | ZSH_THEME_GIT_PROMPT_DIRTY="$YS_VCS_PROMPT_DIRTY" | 19 | ZSH_THEME_GIT_PROMPT_DIRTY="$YS_VCS_PROMPT_DIRTY" |
29 | ZSH_THEME_GIT_PROMPT_CLEAN="$YS_VCS_PROMPT_CLEAN" | 20 | ZSH_THEME_GIT_PROMPT_CLEAN="$YS_VCS_PROMPT_CLEAN" |
30 | 21 | ||
31 | # HG info | 22 | # HG info |
32 | local hg_info='$(ys_hg_prompt_info)' | 23 | local hg_info='$(ys_hg_prompt_info)' |
33 | ys_hg_prompt_info() { | 24 | ys_hg_prompt_info() { |
34 | # make sure this is a hg dir | 25 | # make sure this is a hg dir |
35 | if [ -d '.hg' ]; then | 26 | if [ -d '.hg' ]; then |
36 | echo -n "${YS_VCS_PROMPT_PREFIX1}hg${YS_VCS_PROMPT_PREFIX2}" | 27 | echo -n "${YS_VCS_PROMPT_PREFIX1}hg${YS_VCS_PROMPT_PREFIX2}" |
37 | echo -n $(hg branch 2>/dev/null) | 28 | echo -n $(hg branch 2>/dev/null) |
38 | if [ -n "$(hg status 2>/dev/null)" ]; then | 29 | if [ -n "$(hg status 2>/dev/null)" ]; then |
39 | echo -n "$YS_VCS_PROMPT_DIRTY" | 30 | echo -n "$YS_VCS_PROMPT_DIRTY" |
40 | else | 31 | else |
41 | echo -n "$YS_VCS_PROMPT_CLEAN" | 32 | echo -n "$YS_VCS_PROMPT_CLEAN" |
42 | fi | 33 | fi |
43 | echo -n "$YS_VCS_PROMPT_SUFFIX" | 34 | echo -n "$YS_VCS_PROMPT_SUFFIX" |
44 | fi | 35 | fi |
45 | } | 36 | } |
46 | 37 | ||
47 | # Prompt format: \n # USER at MACHINE in DIRECTORY on git:BRANCH STATE [TIME] \n $ | 38 | local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})" |
48 | PROMPT=" | ||
49 | %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ | ||
50 | %{$fg[cyan]%}%n \ | ||
51 | %{$fg[white]%}at \ | ||
52 | %{$fg[green]%}$(box_name) \ | ||
53 | %{$fg[white]%}in \ | ||
54 | %{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\ | ||
55 | ${hg_info}\ | ||
56 | ${git_info} \ | ||
57 | %{$fg[white]%}[%*] | ||
58 | %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" | ||
59 | 39 | ||
60 | if [[ "$USER" == "root" ]]; then | 40 | # Prompt format: |
41 | # | ||
42 | # PRIVILEGES USER @ MACHINE in DIRECTORY on git:BRANCH STATE [TIME] C:LAST_EXIT_CODE | ||
43 | # $ COMMAND | ||
44 | # | ||
45 | # For example: | ||
46 | # | ||
47 | # % ys @ ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] C:0 | ||
48 | # $ | ||
61 | PROMPT=" | 49 | PROMPT=" |
62 | %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ | 50 | %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ |
63 | %{$bg[yellow]%}%{$fg[cyan]%}%n%{$reset_color%} \ | 51 | %(#,%{$bg[yellow]%}%{$fg[black]%}%n%{$reset_color%},%{$fg[cyan]%}%n) \ |
64 | %{$fg[white]%}at \ | 52 | %{$fg[white]%}@ \ |
65 | %{$fg[green]%}$(box_name) \ | 53 | %{$fg[green]%}%m \ |