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 Side-by-side 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
... | ... | @@ -12,9 +12,9 @@ To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://t |
12 | 12 | |
13 | 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 | 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 | 19 | * `curl` or `wget` should be installed |
20 | 20 | * `git` should be installed |
... | ... | @@ -26,13 +26,13 @@ Oh My Zsh is installed by running one of the following commands in your terminal |
26 | 26 | #### via curl |
27 | 27 | |
28 | 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 | 32 | #### via wget |
33 | 33 | |
34 | 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 | 38 | ## Using Oh My Zsh |
... | ... | @@ -104,7 +104,7 @@ The default location is `~/.oh-my-zsh` (hidden in your home directory) |
104 | 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 | 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 | 110 | #### Manual Installation |
... | ... | @@ -188,6 +188,18 @@ function git_compare_version() { |
188 | 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 | 203 | # This is unlikely to change so make it all statically assigned |
192 | 204 | POST_1_7_2_GIT=$(git_compare_version "1.7.2") |
193 | 205 | # Clean up the namespace slightly by removing the checker function |
... | ... | @@ -0,0 +1,27 @@ |
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 | +``` |
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 | - `bl` aliased to `bundle list` |
7 | 7 | - `bp` aliased to `bundle package` |
8 | 8 | - `bo` aliased to `bundle open` |
9 | + - `bout` aliased to `bundle outdated` | |
9 | 10 | - `bu` aliased to `bundle update` |
10 | 11 | - `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`) |
11 | 12 | - adds a wrapper for common gems: |
... | ... | @@ -0,0 +1,12 @@ |
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)) |
... | ... | @@ -0,0 +1,136 @@ |
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 |
... | ... | @@ -146,15 +146,15 @@ alias gke='\gitk --all $(git log -g --pretty=format:%h)' |
146 | 146 | compdef _git gke='gitk' |
147 | 147 | |
148 | 148 | alias gl='git pull' |
149 | -alias glg='git log --stat --color' | |
150 | -alias glgp='git log --stat --color -p' | |
151 | -alias glgg='git log --graph --color' | |
149 | +alias glg='git log --stat' | |
150 | +alias glgp='git log --stat -p' | |
151 | +alias glgg='git log --graph' | |
152 | 152 | alias glgga='git log --graph --decorate --all' |
153 | 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 | 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 | 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 | 158 | alias glp="_git_log_prettily" |
159 | 159 | compdef _git glp=git-log |
160 | 160 |
1 | 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 | 5 | * Sets up the `hub` wrapper and completions for the `git` command if you have `hub` installed. |
6 | 6 | * Completion for the `github` Ruby gem. |
... | ... | @@ -37,7 +37,7 @@ See `man hub` for more details. |
37 | 37 | |
38 | 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 | 42 | ```zsh |
43 | 43 | if (( ! ${fpath[(I)/usr/local/share/zsh/site-functions]} )); then |
1 | 1 | # If the tm command is called without an argument, open TextMate in the current directory |
2 | 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 | 5 | function tm() { |
5 | 6 | if [[ -z $1 ]]; then |
6 | 7 | mate . |
7 | - else | |
8 | + elif [[ -d $1 ]]; then | |
8 | 9 | mate $1 |
9 | - if [[ -d $1 ]]; then | |
10 | - cd $1 | |
11 | - fi | |
10 | + cd $1 | |
11 | + else | |
12 | + mate "$@" | |
12 | 13 | fi |
13 | 14 | } |
... | ... | @@ -2,16 +2,25 @@ |
2 | 2 | |
3 | 3 | PROMPT=' |
4 | 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 | 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%} " | |
12 | -local _return_status="%{$fg[red]%}%(?..⍉)%{$reset_color%}" | |
11 | +local _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} " | |
12 | +local _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}" | |
13 | 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 | 24 | function _user_host() { |
16 | 25 | if [[ -n $SSH_CONNECTION ]]; then |
17 | 26 | me="%n@%m" |
... | ... | @@ -85,13 +94,13 @@ ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}⚑ " |
85 | 94 | ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✖ " |
86 | 95 | ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}▴ " |
87 | 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 | 99 | # Colors vary depending on time lapsed. |
91 | 100 | ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" |
92 | 101 | ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" |
93 | 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 | 105 | # LS colors, made with http://geoff.greer.fm/lscolors/ |
97 | 106 | export LSCOLORS="exfxcxdxbxegedabagacad" |
1 | 1 | # ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png |
2 | 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 | 11 | local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' |
6 | 12 | local rvm_ruby='' |
7 | 13 | if which rvm-prompt &> /dev/null; then |
... | ... | @@ -23,31 +23,35 @@ bureau_git_branch () { |
23 | 23 | } |
24 | 24 | |
25 | 25 | bureau_git_status () { |
26 | - _INDEX=$(command git status --porcelain -b 2> /dev/null) | |
27 | 26 | _STATUS="" |
28 | - if $(echo "$_INDEX" | grep '^[AMRD]. ' &> /dev/null); then | |
29 | - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED" | |
30 | - fi | |
31 | - if $(echo "$_INDEX" | grep '^.[MTD] ' &> /dev/null); then | |
32 | - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" | |
33 | - fi | |
34 | - if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then | |
35 | - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" | |
36 | - fi | |
37 | - if $(echo "$_INDEX" | grep '^UU ' &> /dev/null); then | |
38 | - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" | |
39 | - fi | |
40 | - if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then | |
41 | - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED" | |
42 | - fi | |
43 | - if $(echo "$_INDEX" | grep '^## .*ahead' &> /dev/null); then | |
44 | - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" | |
45 | - fi | |
46 | - if $(echo "$_INDEX" | grep '^## .*behind' &> /dev/null); then | |
47 | - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" | |
48 | - fi | |
49 | - if $(echo "$_INDEX" | grep '^## .*diverged' &> /dev/null); then | |
50 | - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED" | |
27 | + if [[ $(command git status --short 2> /dev/null) != "" ]]; then | |
28 | + _INDEX=$(command git status --porcelain -b 2> /dev/null) | |
29 | + if $(echo "$_INDEX" | command grep '^[AMRD]. ' &> /dev/null); then | |
30 | + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED" | |
31 | + fi | |
32 | + if $(echo "$_INDEX" | command grep '^.[MTD] ' &> /dev/null); then | |
33 | + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" | |
34 | + fi | |
35 | + if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then | |
36 | + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" | |
37 | + fi | |
38 | + if $(echo "$_INDEX" | command grep '^UU ' &> /dev/null); then | |
39 | + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" | |
40 | + fi | |
41 | + if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then | |
42 | + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED" | |
43 | + fi | |
44 | + if $(echo "$_INDEX" | command grep '^## .*ahead' &> /dev/null); then | |
45 | + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" | |
46 | + fi | |
47 | + if $(echo "$_INDEX" | command grep '^## .*behind' &> /dev/null); then | |
48 | + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" | |
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 | 55 | fi |
52 | 56 | |
53 | 57 | echo $_STATUS |
... | ... | @@ -84,10 +88,10 @@ _LIBERTY="$_LIBERTY%{$reset_color%}" |
84 | 88 | get_space () { |
85 | 89 | local STR=$1$2 |
86 | 90 | local zero='%([BSUbfksu]|([FB]|){*})' |
87 | - local LENGTH=${#${(S%%)STR//$~zero/}} | |
91 | + local LENGTH=${#${(S%%)STR//$~zero/}} | |
88 | 92 | local SPACES="" |
89 | 93 | (( LENGTH = ${COLUMNS} - $LENGTH - 1)) |
90 | - | |
94 | + | |
91 | 95 | for i in {0..$LENGTH} |
92 | 96 | do |
93 | 97 | SPACES="$SPACES " |
... | ... | @@ -101,7 +105,7 @@ _1RIGHT="[%*] " |
101 | 105 | |
102 | 106 | bureau_precmd () { |
103 | 107 | _1SPACES=`get_space $_1LEFT $_1RIGHT` |
104 | ||
108 | ||
105 | 109 | print -rP "$_1LEFT$_1SPACES$_1RIGHT" |
106 | 110 | } |
107 | 111 |
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 | 2 | %{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} ' |
3 | 3 | |
4 | 4 | ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" |
1 | 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 | 4 | $(git_prompt_info)\ |
5 | +\ | |
5 | 6 | %{$fg[red]%}%(!.#.»)%{$reset_color%} ' |
6 | 7 | PROMPT2='%{$fg[red]%}\ %{$reset_color%}' |
7 | 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 | 11 | ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%} " |
11 | 12 | ZSH_THEME_GIT_PROMPT_CLEAN="" |
12 | 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%} " | |
14 | 16 | \ No newline at end of file |
1 | 1 | # Clean, simple, compatible and meaningful. |
2 | 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 | 4 | # Colors: black, red, green, yellow, *blue, magenta, cyan, and white. |
5 | -# | |
6 | -# http://ysmood.org/wp/2013/03/my-ys-terminal-theme/ | |
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/~}' | |
5 | +# | |
6 | +# Mar 2013 Yad Smood | |
16 | 7 | |
17 | 8 | # VCS |
18 | 9 | YS_VCS_PROMPT_PREFIX1=" %{$fg[white]%}on%{$reset_color%} " |
... | ... | @@ -21,7 +12,7 @@ YS_VCS_PROMPT_SUFFIX="%{$reset_color%}" |
21 | 12 | YS_VCS_PROMPT_DIRTY=" %{$fg[red]%}x" |
22 | 13 | YS_VCS_PROMPT_CLEAN=" %{$fg[green]%}o" |
23 | 14 | |
24 | -# Git info. | |
15 | +# Git info | |
25 | 16 | local git_info='$(git_prompt_info)' |
26 | 17 | ZSH_THEME_GIT_PROMPT_PREFIX="${YS_VCS_PROMPT_PREFIX1}git${YS_VCS_PROMPT_PREFIX2}" |
27 | 18 | ZSH_THEME_GIT_PROMPT_SUFFIX="$YS_VCS_PROMPT_SUFFIX" |
... | ... | @@ -44,29 +35,26 @@ ys_hg_prompt_info() { |
44 | 35 | fi |
45 | 36 | } |
46 | 37 | |
47 | -# Prompt format: \n # USER at MACHINE in DIRECTORY on git:BRANCH STATE [TIME] \n $ | |
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%}" | |
38 | +local exit_code="%(?,,C:%{$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 | 49 | PROMPT=" |
62 | 50 | %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ |
63 | -%{$bg[yellow]%}%{$fg[cyan]%}%n%{$reset_color%} \ | |
64 | -%{$fg[white]%}at \ | |
65 | -%{$fg[green]%}$(box_name) \ | |
51 | +%(#,%{$bg[yellow]%}%{$fg[black]%}%n%{$reset_color%},%{$fg[cyan]%}%n) \ | |
52 | +%{$fg[white]%}@ \ | |
53 | +%{$fg[green]%}%m \ | |
66 | 54 | %{$fg[white]%}in \ |
67 | -%{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\ | |
55 | +%{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\ | |
68 | 56 | ${hg_info}\ |
69 | -${git_info} \ | |
70 | -%{$fg[white]%}[%*] | |
57 | +${git_info}\ | |
58 | + \ | |
59 | +%{$fg[white]%}[%*] $exit_code | |
71 | 60 | %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" |
72 | -fi |