Commit ed37aae5b4821f1a2fc47001d888f889eda8e8ad

Authored by mj
1 parent dcebc9e8fc
Exists in master and in 2 other branches 02-merge, dev

Squashed 'repos/robbyrussell/oh-my-zsh/' changes from 192de6b..8c84342

8c84342 Merge pull request #4519 from evanandrewrose/master
fe02e02 Fix "be" -> "b" typo in coffee plugin README.md.
fdb0e23 Merge pull request #4507 from WhyEee/fix-no-tput
b3c10b9 Merge pull request #4505 from arvindch/checked-upgrade
e0c9ada Merge pull request #4214 from queria/chuck-linefix
662bdcc Merge pull request #4515 from brianloveswords/safer-install-script
c9d9375 Make install script safer
a7b4c09 Merge pull request #4526 from sachin21/fix_typo
2c8697b [FIX #4525]: Fix typo
8c73eb4 Merge pull request #4419 from apjanke/installer-termcap-hack
45f0a28 Merge pull request #4508 from Superbil/master
56345c2 Merge pull request #4473 from apjanke/5_1_1-bracketed-paste-hack
2c54428 Fixd bug for pyenv plugin
75e619b Fix install.sh/upgrade.sh for tput-less systems
e59e1c8 Check for git before trying to upgrade, as per #4504
aa15eba Merge pull request #4492 from arvindch/tweak-pyenv-plugin
8a362b2 Enable pyenv rehash
8a95ced Init pyenv virtualenvs too
306e3e7 Merge pull request #4459 from Scuilion/update-gradle-commands
b28db6b Merge pull request #4475 from apjanke/diagdump-5.1-fix
30d7a66 Merge pull request #4486 from gfvcastro/alias-rails-server-port-option
b18d386 Add option '--port' to 'rails server' alias.
57c2ac1 Merge pull request #4482 from sachin21/add_an_alias_for_upstream
ff1bd95 Merge pull request #4480 from volcov/master
101758f Merge pull request #4481 from apjanke/autoenv-emerg-fix
7597bf8 Add an alias for upstream
2d0e7fb autoenv: actually source autoenv once located
252078d add alias to sort by version
2522ab4 Merge pull request #4204 from DoctorJellyface/patch-1
0be21f0 Merge pull request #4440 from apjanke/autoenv-homebrew
0144802 Merge pull request #4464 from rchiossi/master
dc06e96 Merge pull request #4254 from apjanke/copyfile-portability
b1173d4 Merge pull request #4418 from Gnouc/master
2459add Merge branch 'master' of github.com:robbyrussell/oh-my-zsh
bb509dd Renaming colored-man to colored-man-pages because it needs to be.
1510e7d Merge pull request #4472 from theavish/master
d15521d diagnostics: fix for reserved-word changes in zsh 5.1
3551745 Disable bracketed-paste-magic in zsh 5.1.1, where it is buggy
a7f0c71 Fix ohmyz.sh link
6b73f5e Ask for confirmation before uninstall
f3fa418 Merge branch 'master' of github.com:robbyrussell/oh-my-zsh
d26549b Removing legacy rails-specific aliases from the Textmate plugin. This is probably best handled as a custom plugin.
62c86f5 Merge pull request #4444 from apjanke/git-extras-compatibility
b6d78df clip*: add xsel support
a954739 Update Gradle Commands
f104d16 Merge pull request #4455 from swvjeff/master
2d9df44 Fix 'ack-grep' bug for non-ubuntu users
920ab07 Merge pull request #4423 from gfvcastro/alias-rake-middleware
bff8868 Merge pull request #4429 from RobLoach/removeatom
867d586 Merge pull request #4445 from wweaver/git-hf-aliases
80179c1 Merge pull request #4453 from uberspot/master
5d24ba4 Merge pull request #3165 from hbin/fix-alias-afind-osx
30c7ef7 Merge pull request #4421 from jcpst/master
bd26498 Merge pull request #4424 from Gutem/patch-1
d7e7ef6 Merge pull request #4427 from xavhan/patch-1
df5e1f9 Add 3 more nmap aliases to nmap plugin
b35d78f Add Git Hubflow aliases
7f2656c git-extras: fix for compatibility with zsh _git
c146853 autoenv: also look in the Homebrew installation location for it
56b747a Merge branch 'autoenv-check' of github.com:kudos/oh-my-zsh into autoenv-homebrew
f9c16f9 Remove broken link and move npmg alias position
a9c8820 Merge pull request #4426 from apjanke/turn-off-3889-by-default
0516a39 Remove Atom plugin
df80081 Add alias for npm global install
4589bc6 completion: turn off the #3889 compfix check by default
1e305e0 Update Simulator's Path to XCode 7.x
3e04cd6 Add 'rake middleware' alias.
5af52fb gulp plugin: missing opening double quote & had unneeded parens on function
52e2aae Merge pull request #4411 from TylerCharlesworth/patch-1
e4fdb08 Merge branch 'master' into copyfile-portability
f94fee5 installer: don't bail on errors in color setup
758195c Encode64 Plugin - Fix wrong `echo` usage
2266368 Update sublime.plugin.zsh
b05ef10 Merge pull request #4121 from apjanke/chucknorris-check-for-fortune
a51a916 Merge pull request #4348 from andybateman/patch-1
9e29103 Merge pull request #4394 from PrestanceDesign/new-git-alias
156fa5f Merge pull request #4396 from TylerCharlesworth/patch-1
4b902d7 Merge pull request #4410 from justVitalius/master
dc3413b Fix print rvm version in amuse theme
b75b0b8 Merge pull request #4333 from mbologna/fedora_plugin
935948c Merge pull request #3646 from apjanke/installer-cygwin-support-3
b5a5bc9 Merge pull request #4337 from iCross/master
f186b62 Merge pull request #4387 from mbologna/fix_git_equal_remote
d47219f Merge pull request #4397 from vidakovic/master
c932eb3 Merge pull request #4385 from Philosoft/patch-1
c076fc0 Merge pull request #4392 from ag4ve/patch-1
4204cfd Merge pull request #4408 from DoomHammer/fix-chruby-test-expression
a97a308 Merge pull request #4349 from FishingCactus/fix-atom_plugin_for_cygwin
3b2d036 Merge pull request #4377 from fcrozat/master
ccc86da Merge pull request #4375 from PrestanceDesign/capistrano-plugin-fix
a861719 Merge pull request #4340 from pahnev/master
17088c6 Fix invalid test expression.
0c0450b Accept single and double quotes in Gulp plugin
07f08aa Adds Cygwin support
8e74f7c Add alias for print latest tag name
96ff861 Merge branch 'master' into installer-cygwin-support-3
7a63609 Correct repo dir
12e99b5 fix indentation
5323954 Uniform git prompt equal remote
e957ae4 Update README.md
95296bb also handle missing tput in upgrade script.
76a26a2 Merge pull request #4372 from afh/pull/emotty_theme
326c2b0 Replaced the use of 'print' with 'echo' in order to sanitise track and artist names
993e09c Added function for 'itunes playing' to display state when not playing
9f2acdc You can now use 'itunes status' as well as 'itunes playing' to show current track
29db0e0 Fixed colourisation of Now Playing function
a746e60 Update osx.plugin.zsh
884a879 Do not fail if tput is not available
1bb2715 Fix capistrano problem when generating autocompletion
f850296 Added cygwin support to atom plugin
7576f85 Merge remote-tracking branch 'robyrussel/master' into fix-atom_plugin_for_cygwin
1a51100 Fix issues with character widths in emotty theme
918d26e Merge pull request #3664 from apjanke/installer-portable-colors
6cddf72 Merge branch 'master' into installer-portable-colors
cbc1a08 Merge pull request #4342 from robobenklein/patch-1
25f2d59 Merge pull request #4353 from dzotokan/feat/stackPlugin
4d65dd2 Merge pull request #4310 from ablyler/add-codeclimate-plugin
e268ef3 Merge pull request #4320 from ixti/fix/aws-plugin-rprompt-pollution
183026f Merge pull request #4316 from bronzdoc/feature/rvm_amuse_theme
b29095f Merge pull request #4354 from henrikhodne/patch-1
c4d84f1 Merge pull request #4343 from apjanke/jira-readme
85f53b0 Merge pull request #4359 from noseglid/patch-1
ff780ba Merge pull request #4371 from afh/pull/emotty_theme
ce10457 Merge pull request #4370 from afh/pull/emotty_plugin
2dc980c Merge pull request #4331 from icholy/master
51677da Merge pull request #4091 from apjanke/agnoster-clarify-powerline
36884cc Merge pull request #4189 from bmdhacks/master
db14538 Merge pull request #4315 from mbologna/fancy-ctrl-z
3b29132 Merge pull request #4300 from igordejanovic/vim-escape-fname
cfba05c Merge pull request #4282 from ferenczy/master
ff3e0d5 Merge pull request #4266 from t413/master
3b5300c Merge pull request #4252 from Fice-T/master
9bd88bb Merge pull request #4251 from mcornella/fix-completion-dots
4f1caf0 Merge pull request #4237 from mcornella/fix-taskwarrior-plugin
6eb6017 Merge pull request #4235 from mcornella/fix-xcode-plugin
1e49dfc Merge pull request #4209 from ah450/npm-exec
0756555 Merge pull request #4201 from wkentaro/gnu-utils-findutils
576453c Merge pull request #4173 from sharkySharks/master
bb5bc64 Merge pull request #4155 from honnix/fix_color
681c42a Merge pull request #4154 from sfragis/toggle-sudo
f7c24e1 Merge pull request #4137 from troter/coffee-first-argument-with-double-quote
544eccb Fixing conflict in rails plugin merge with rake test shortcut
e3d305e Merge branch 'skv-headless-rails-rake-test'
04c8acf Merge branch 'rails-rake-test' of https://github.com/skv-headless/oh-my-zsh into skv-headless-rails-rake-test
fb0776e Merge pull request #4134 from boddhisattva/rails-rake-routes-alias
adaf89c Merge pull request #4113 from apjanke/gnzh-remove-eval
dde5540 Merge pull request #4093 from apjanke/osx-fix-tab-for-iterm
1324e61 Merge pull request #4050 from mbologna/michelebologna_fix_git_prompt
763bf63 Merge pull request #3971 from moul/pr-scaleway
0bb3e01 Merge pull request #3940 from apjanke/diagnostic-dump-function
8cf88f2 Merge pull request #3911 from mbologna/git_remote_status_equal
baf1aa1 Merge pull request #3661 from ericbottard/GradleWrapperFix
3c782f7 Merge pull request #3582 from apjanke/fold-terminalapp-plugin-into-termsupport
4bd6c43 Merge pull request #3408 from spacewander/git-extras
93c6b5d Merge pull request #3078 from akoenig/gulpjs
5e45c16 Merge pull request #2751 from drm00/fix-openbsd-colorls
cc53e4c Merge pull request #2471 from phstc/capistrano-multistage
56cdec7 Merge pull request #3889 from leycec/compaudit
550573b Add emotty theme
dce052d Add emotty plugin
5cf0a01 Use local gradlew
8c5b948 chruby: donʼt try to execute .sh files before loading
bb10ad0 Remove unnecessary sandbox fn
a8a8bc3 Add simple Stack commands list
e8639c7 Update to current robbyrussell/oh-my-zsh master
797e1f9 [plugins/bgnotify] fix for iTerm2 notification clicks
6e0fcf8 Fixed atom plugin for cygwin users
c9af79f jira: add README, "emulate -L zsh", add "dumpconfig" action
6642a99 xcode: extend xcselv to list versions and do completion
22287d0 handle multiple paths in GOPATH
36fea45 svn plugin: urldecode repo info
0233979 Fixed broken git branch icon
dca4295 Make Readme much clearer and explain edits.
953e4d8 Make Linux compatible
19c0b18 fix url-quote-magic not working issue
9e9b790 golang: improve go doc completion
6170fa4 Added fedora plugin, based on dnf/yum plugin
82ae41c Reorder xcode plugin file
213f46a Add xcselv documentation in the README
5584aa0 xcode: add version-based xcselv()
86d881c Added aliases for --now commands
d95589d Add README for the xcode plugin
ec3694c Make simulator dependant of currently active dev directory
24bdd8e Replace xcsel function with just an alias
6a830f3 Return error if no xcode files where found
cbdad58 Use zsh globbing instead of ls + grep in xc function
38d25a3 Update taskwarrior completion to latest version (Jul 26 2015)
75844fe Put relevant documentation into README file
b42efeb Switch off line wrapping in case dots occupy extra line
6a8d406 Use prompt expansion sequence to color red the output
3976e04 Use proper if comparison
9c08641 Merge pull request #4299 from mcornella/refactor-frontend-search-plugin
7a63cca Fix aws plugin RPROMPT pollution
46ddd88 diagnostics: switch to shasum, filter sysinfo using lines
d009f24 gnzh theme: fix "eval" and related problems. Switch to normal zsh %F/%f prompt escapes to avoid "eval" and extra variables. Wrap whole thing in anonymous function so the existing `local` statements actually work. Then switch '...' to eager "..." so stuff actually works with local variables. And local-ize the remaining variables that are used only in prompt construction.
93b4a6c Merge branch 'master' into osx-fix-tab-for-iterm
82c76f6 Merge changes from #4241 into installer-portable-colors
502f08b Add Cygwin support to installer. * Balk at incompatible Windows/MSYS git * Test for chsh presence before trying to use it * Replace non-portable `[[ ... ]]` and `[ x = *pattern* ]` constructs
c7d782f Add the update from @mtwentyman https://github.com/phstc/dotfiles/pull/1 to make it work for older versions of capistrano
9a7b2d7 Moved comments and credits from source to README
bec496f Display rvm-prompt output.
6d7c39a Added fancy-ctrl-z plugin
ef4a315 Fix invocation of gradlew
b08431f Add codeclimate autocomplete plugin
c481c62 Refactor and clear up README file
d982e12 Reorder alias definitions
663ac56 Prettify frontend help output and clean up logic
ff706f3 Add "help" method in "frontend-search" plugin
f1472f1 Simplify frontend-search function with assoc array
7f64092 [vim-interaction plugin] Escaping special chars in file names and simplifying code.
0532860 Merge pull request #4285 from nmaggioni/master
7366b56 Merge pull request #4268 from ZhengzhongZhang/patch-1
01b3783 Merge pull request #4302 from kyleheyne/patch-1
022a060 thefuck-alias -> thefuck --alias
ba5fd57 Merge pull request #3989 from eubenesa/master
69f098a Mentioning that you can set the theme to 'random' and it'll possibly bake you a pie.
a77e23a Merge pull request #4109 from zhiyelee/patch-1
da6ece4 Merge pull request #4117 from nextgenthemes/patch-1
eb12ec1 Merge pull request #4146 from perobertson/heroku-help
ac85faa Merge pull request #4171 from linux-china/master
c1bff77 Merge pull request #4195 from jerryling315/master
3f95377 Merge pull request #4198 from matjack1/gclean-gpristine
daabe2a Merge pull request #4205 from mcornella/fix-git-prompt-plugin
c10d5c8 Merge pull request #4244 from Gnouc/master
69a1715 Merge pull request #4239 from yous/fix-linux-gems
adff369 Merge pull request #4220 from andytank123/master
ccaaa99 Merge pull request #4241 from heartinpiece/master
2f6d85d Merge pull request #4248 from gabetax/rbenv_plugin_load_performance
51c3ab7 Merge pull request #4283 from hanschen/master
14e1f0c Merge pull request #4286 from RobinDaugherty/rand-quote-failure
a228604 Merge pull request #4249 from KrauseFx/patch-1
9c9699d Merge pull request #4250 from mcornella/fix-divide-by-zero-emoji
6346cc9 Merge pull request #4260 from fgibaux/patch-1
c084a13 Merge pull request #4259 from apjanke/jira-prefix-and-help-and-stuff
e59f4cb Merge pull request #4271 from loctauxphilippe/patch-1
9bb99e1 Merge pull request #4284 from gsklee/patch-1
50d3294 Merge pull request #4289 from moonfruit/master
869b104 Merge pull request #4292 from cxbig/master
b3f167d Merge pull request #3613 from apjanke/remove-sed-i
a7aed69 Merge pull request #4170 from black-roland/master
b1d57fa Merge pull request #4294 from willmendesneto/master
0a80889 Frontend-search: add search in npm website
acf6039 improved alias conflict between git flow & git fetch
0a2c31f Remove redundant semicolon
fe92ea9 installer: switch twitter link to https
d923ceb Updated with @mcornella suggestions
96aefd2 Remove code, not comment it out
241be2d Fix rand-quote failure when site is unreachable
058bbe4 General compatibility
a127c4f 'ip' command compatibility and much quicker external IP detection
8ab1b6d Update README.markdown
1bf5c58 Update autojump plugin for latest brew installation
76f4871 Added missing commands to Vagrant plugin, updated commands description
18ef1ee Merge remote-tracking branch 'robbyrussell/master'
aaf5c8f added apt-get autoremove in ubuntu plugin
1aeebf6 Update link
7c31c7a Bring bgnotify plugin up to date with t413/zsh-background-notify
a9daea1 plugin symfony2 sf2.7 compatibility fix
dc42e8d jira: add completion
7cf892e Add dashboard support and default-action configuration. Some refactoring.
ee4a423 Merge branch 'pr-4158' into jira-prefix-and-help-and-stuff
caf667f Merge branch PR 4132 into jira-prefix-and-help-and-stuff
5c8b0cc Add clipcopy() and clippaste() generic cross-platform CLI clipboard functions. Change copydir, copyfile, and coffee plugins to use them, instead of the Mac-only `pbcopy` command.
00eb465 Merge branch 'master' into fold-terminalapp-plugin-into-termsupport
47d19cc Add defensive `emulate -L zsh` to termsupport functions
96c34ce Add a deprecation comment.
9121f3e Merge pull request #4 from wkentaro/fix-git-prompt-plugin
c4ba306 Show tag name when detached status if possible
c66c3ae Fix graphical bug in cypher theme when return status is non-zero
3f83331 removes a trailing white space
be667a2 Remove obsolete comment
3c69874 Clean up gitstatus.py
45473c3 Fix for initial or detached status branch info
30bed07 Parse UTF-8 output from git status
94007f7 git-prompt: collect all git status information by one cmd
6ff53d1 Cleanup of git-prompt plugin file
1d133ff Cleanup the rest of gitstatus.py
5642014 Pull in simplified version from @wkentaro
6443626 Pull in latest version from olivierverdier/zsh-git-prompt
c6a5f6e Check that list_size value is not zero before division
88243b8 Use right variable name to avoid zero-length array
de47e2d Use https instead of http
daedfca reduce rbenv plugin load time by 150ms by removing additional brew call
d20c111 rvm plugin: Fix `gems` to work with GNU sed
0238301 Emoji plugin - Fix wrong string comparison
58d2f93 Check if Zsh is installed prior to installing Oh My Zsh
dcd95dd Changes quotes so that path will be set appropriately on multiple runs
14b4ba8 Move urlencode/urldecode functions to core lib
c3fbe4d Add support for Docker images from custom registries
720fb5b Support for 'scw' command (Scaleway CLI)
269ae84 Removes unnecessary single quotes
9c74128 chucknorris: add missing line/quote delimiters
e1353fc Adds npmE alias
800af04 Add sc-launch as a shortcut for start & enable
daa04ba gnu-utils: add findutils (find,xargs,locate)
fb8c446 Thefuck: fix global variable assignment
a2b574b git plugin: make gclean safer, introduce gpristine
96e5346 Merge branch 'master' of gh:robbyrussell/oh-my-zsh
2120b2e Add escaped home
c83575d Add 'man' plugin.
b875df8 agnoster: speed up git prompt
f534b4b Thefuck: fixed compability with latest version
54e2740 Thefuck: replaced static alias with `eval "$(thefuck-alias)"`
8e8a133 Thefuck: combined with @cristim plugin. Code formating
fa25445 diagnostics: include output file name in dump output
803e5db improved the check for availability
0da9a4b fuck: added a basic plugin for https://github.com/nvbn/thefuck
e8caf22 Cygwin-specific "chsh" installation issue fixed.
da395c5 Secure umask enforced during installation.
cb55161 Completion insecurities handled on startup.
cacc6c3 replaced Om spelling so letters would not overlap
5a1dd14 removed incorrect Devanagari conjunct symbol at end of Om
e38455b Added conflict note (thefuck plugin)
b4a8cbf spring boot plugin
f838b56 spring boot plugin readme
cd2213a Thefuck plugin README
7a13a40 Added thefuck plugin https://github.com/nvbn/thefuck
afa3057 Add jira_url_help
46d1338 [theme] Fix color problem of steeef theme
ff8d799 Esc-esc now toggles sudo.
dcb175d Insecure completion handler added.
775ac3a The executable command on Mac OSX is 'ack' rather than 'ack-grep'.
b7617b3 Check for autoenv_init function before trying to source autoenv.
ffe8e54 add '--help' to heroku commands
bca720f diagnostics: include detailed OS version info if possible
1e8196d passing the first argument with double quote
ad4675c Concise local variables declarations
b1772c5 More consistent curly braces variables
37f45eb Making variables local in jira plugin
1e99168 Changing indents to be more consistent (2 spaces)
88a30a3 Changing string comparison for more zsh-like
750de22 rails rake test
dff0374 adds an alias to search for the rails routes that pattern match a string
8cf6100 installer: use terminfo for portable escape sequences Do not use terminal visual effects if not connected to a terminal.
19ea867 install.sh: use portable printf instead of echo
b1da3bb Adding ability to add JIRA_PREFIX as an env variable (e.g. in .zshrc) and minor refactor to bash curly variable braces
c82deed agnoster: Protect Unicode esape sequences with local LC_* settings
a2e01e9 chucknorris: check for strfile dependency Gives a better error message than "command not found: strfile", because it's not obvious to many users that strfile is part of fortune. Also handles the weird /usr/sbin install location for strfile on Cygwin.
2e92ff8 Adds agar = apt-get autoremove
efb04d6 add git alias `gcam` -  git commit -am
9813ff5 omz_diagnostic_dump: Add umask and $fpath listing. This helps catch issues with compinit and insecure directories.
689b5ab osx: fix tab* functions so cd works in iTerm2, exit status is correct, and error messages are not discarded.
4cd281b agnoster: Define Powerline chars with escape sequence, and use same character on all platforms. Add clarifying comments. This makes everything consistent with the current Powerline-patched fonts definitions.
68b792b Change to use omz git_prompt* functions
01e355f In addition to the already existing variables ZSH_THEME_GIT_PROMPT for behind, ahead and diverged remote, I added ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE.
10c92cc Updates to ember-cli plugin
af68165 Fix name of backed-up zshrc
afadb5a diagnostics: add zstyle state to output
82c1288 Include some bash rc files; improve formatting; more version info
ea6adc5 Add omz_diagnostic_dump() to help with bug reports.
cb0718c chucknorris: locate plugin dir using $0 instead of hardcoded $ZSH
88f42b6 Add support for variant "utf8" locale suffix spelling. Fix dumb bug in iconv call that would cause it to hang.
cb37c93 Remove unnecessary braces.
1246c3e install.sh: Replace nonstandard "sed -i" with sed + mv commands. Makes portable to systems whose sed lacks "-i", like OpenBSD.
5f90781 plugins/chucknorris: Add automatic updating of the compiled fortune data file. Use local variable for readability, and anonymous function to provide a scope for the local variable.
187cf07 For unspecified encodings, assume it's UTF-8 or compatible (e.g. ASCII) and muddle through without character encoding conversion.
702ff1c Add support for non-UTF-8 encodings in caller's locale.
3a18c33 In termsupport, use LC_CTYPE instead of LANG to enable byte-by-byte text processing. LANG doesn't seem to actually work.
a9e97e5 Remove terminalapp plugin and fold its implementation in to lib/termsupport.zsh. Replaces the redundant Terminal.app support that was recently added to termsupport.
0c77e4b update git-extras plugin
8f9a72a Moved plugin.
20edd5f gulp.js plugin
f516b7c add check for colored ls on openbsd. (retry of #2225)
c9fbfc9 Uses `shipit` instead of `xcap`
16ae4e1 Adds support capistrano multistage completion

git-subtree-dir: repos/robbyrussell/oh-my-zsh
git-subtree-split: 8c84342b2092f3823e38188bd9ed11e5f5ff2e3f

Showing 116 changed files with 3462 additions and 1080 deletions Side-by-side Diff

... ... @@ -5,7 +5,7 @@ Oh My Zsh is an open source, community-driven framework for managing your [zsh](
5 5  
6 6 __Oh My Zsh is a way of life!__ Once installed, your terminal prompt will become the talk of the town _or your money back!_ Each time you interact with your command prompt, you'll be able take advantage of the hundreds of bundled plugins and pretty themes. Strangers will come up to you in cafés and ask you, _"that is amazing. are you some sort of genius?"_ Finally, you'll begin to get the sort of attention that you always felt that you deserved. ...or maybe you'll just use the time that you saved to start flossing more often.
7 7  
8   -To learn more, visit http://ohmyz.sh and/or follow [ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.
  8 +To learn more, visit [ohmyz.sh](http://ohmyz.sh) and/or follow [ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.
9 9  
10 10 ## Getting Started
11 11  
... ... @@ -65,7 +65,7 @@ Once you find a theme that you want to use, you will need to edit the `~/.zshrc`
65 65 ZSH_THEME="robbyrussell"
66 66 ```
67 67  
68   -To use a different theme, simple change the value to match the name of your desired theme. For example:
  68 +To use a different theme, simply change the value to match the name of your desired theme. For example:
69 69  
70 70 ```shell
71 71 ZSH_THEME="agnoster" # (this is one of the fancy ones)
... ... @@ -77,6 +77,14 @@ Open up a new terminal window and your prompt should look something like...
77 77  
78 78 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).
79 79  
  80 +If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window.
  81 +
  82 +
  83 +```shell
  84 +ZSH_THEME="random" # (...please let it be pie... please be some pie..)
  85 +```
  86 +
  87 +
80 88 ## Advanced Topics
81 89  
82 90 If you're the type that likes to get their hands dirty, these sections might resonate.
... ... @@ -0,0 +1,86 @@
  1 +# System clipboard integration
  2 +#
  3 +# This file has support for doing system clipboard copy and paste operations
  4 +# from the command line in a generic cross-platform fashion.
  5 +#
  6 +# On OS X and Windows, the main system clipboard or "pasteboard" is used. On other
  7 +# Unix-like OSes, this considers the X Windows CLIPBOARD selection to be the
  8 +# "system clipboard", and the X Windows `xclip` command must be installed.
  9 +
  10 +# clipcopy - Copy data to clipboard
  11 +#
  12 +# Usage:
  13 +#
  14 +# <command> | clipcopy - copies stdin to clipboard
  15 +#
  16 +# clipcopy <file> - copies a file's contents to clipboard
  17 +#
  18 +function clipcopy() {
  19 + emulate -L zsh
  20 + local file=$1
  21 + if [[ $OSTYPE == darwin* ]]; then
  22 + if [[ -z $file ]]; then
  23 + pbcopy
  24 + else
  25 + cat $file | pbcopy
  26 + fi
  27 + elif [[ $OSTYPE == cygwin* ]]; then
  28 + if [[ -z $file ]]; then
  29 + cat > /dev/clipboard
  30 + else
  31 + cat $file > /dev/clipboard
  32 + fi
  33 + else
  34 + if which xclip &>/dev/null; then
  35 + if [[ -z $file ]]; then
  36 + xclip -in -selection clipboard
  37 + else
  38 + xclip -in -selection clipboard $file
  39 + fi
  40 + elif which xsel &>/dev/null; then
  41 + if [[ -z $file ]]; then
  42 + xsel --clipboard --input
  43 + else
  44 + cat "$file" | xsel --clipboard --input
  45 + fi
  46 + else
  47 + print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
  48 + return 1
  49 + fi
  50 + fi
  51 +}
  52 +
  53 +# clippaste - "Paste" data from clipboard to stdout
  54 +#
  55 +# Usage:
  56 +#
  57 +# clippaste - writes clipboard's contents to stdout
  58 +#
  59 +# clippaste | <command> - pastes contents and pipes it to another process
  60 +#
  61 +# clippaste > <file> - paste contents to a file
  62 +#
  63 +# Examples:
  64 +#
  65 +# # Pipe to another process
  66 +# clippaste | grep foo
  67 +#
  68 +# # Paste to a file
  69 +# clippaste > file.txt
  70 +function clippaste() {
  71 + emulate -L zsh
  72 + if [[ $OSTYPE == darwin* ]]; then
  73 + pbpaste
  74 + elif [[ $OSTYPE == cygwin* ]]; then
  75 + cat /dev/clipboard
  76 + else
  77 + if which xclip &>/dev/null; then
  78 + xclip -out -selection clipboard
  79 + elif which xsel &>/dev/null; then
  80 + xsel --clipboard --output
  81 + else
  82 + print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
  83 + return 1
  84 + fi
  85 + fi
  86 +}
... ... @@ -0,0 +1,60 @@
  1 +# Handle completions insecurities (i.e., completion-dependent directories with
  2 +# insecure ownership or permissions) by:
  3 +#
  4 +# * Human-readably notifying the user of these insecurities.
  5 +# * Moving away all existing completion caches to a temporary directory. Since
  6 +# any of these caches may have been generated from insecure directories, they
  7 +# are all suspect now. Failing to do so typically causes subsequent compinit()
  8 +# calls to fail with "command not found: compdef" errors. (That's bad.)
  9 +function handle_completion_insecurities() {
  10 + # List of the absolute paths of all unique insecure directories, split on
  11 + # newline from compaudit()'s output resembling:
  12 + #
  13 + # There are insecure directories:
  14 + # /usr/share/zsh/site-functions
  15 + # /usr/share/zsh/5.0.6/functions
  16 + # /usr/share/zsh
  17 + # /usr/share/zsh/5.0.6
  18 + #
  19 + # Since the ignorable first line is printed to stderr and thus not captured,
  20 + # stderr is squelched to prevent this output from leaking to the user.
  21 + local -aU insecure_dirs
  22 + insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
  23 +
  24 + # If no such directories exist, get us out of here.
  25 + if (( ! ${#insecure_dirs} )); then
  26 + print "[oh-my-zsh] No insecure completion-dependent directories detected."
  27 + return
  28 + fi
  29 +
  30 + # List ownership and permissions of all insecure directories.
  31 + print "[oh-my-zsh] Insecure completion-dependent directories detected:"
  32 + ls -ld "${(@)insecure_dirs}"
  33 + print "[oh-my-zsh] For safety, completions will be disabled until you manually fix all"
  34 + print "[oh-my-zsh] insecure directory permissions and ownership and restart oh-my-zsh."
  35 + print "[oh-my-zsh] See the above list for directories with group or other writability.\n"
  36 +
  37 + # Locally enable the "NULL_GLOB" option, thus removing unmatched filename
  38 + # globs from argument lists *AND* printing no warning when doing so. Failing
  39 + # to do so prints an unreadable warning if no completion caches exist below.
  40 + setopt local_options null_glob
  41 +
  42 + # List of the absolute paths of all unique existing completion caches.
  43 + local -aU zcompdump_files
  44 + zcompdump_files=( "${ZSH_COMPDUMP}"(.) "${ZDOTDIR:-${HOME}}"/.zcompdump* )
  45 +
  46 + # Move such caches to a temporary directory.
  47 + if (( ${#zcompdump_files} )); then
  48 + # Absolute path of the directory to which such files will be moved.
  49 + local ZSH_ZCOMPDUMP_BAD_DIR="${ZSH_CACHE_DIR}/zcompdump-bad"
  50 +
  51 + # List such files first.
  52 + print "[oh-my-zsh] Insecure completion caches also detected:"
  53 + ls -l "${(@)zcompdump_files}"
  54 +
  55 + # For safety, move rather than permanently remove such files.
  56 + print "[oh-my-zsh] Moving to \"${ZSH_ZCOMPDUMP_BAD_DIR}/\"...\n"
  57 + mkdir -p "${ZSH_ZCOMPDUMP_BAD_DIR}"
  58 + mv "${(@)zcompdump_files}" "${ZSH_ZCOMPDUMP_BAD_DIR}/"
  59 + fi
  60 +}
... ... @@ -58,9 +58,13 @@ zstyle &#39;:completion:*:*:*:users&#39; ignored-patterns \
58 58 # ... unless we really want to.
59 59 zstyle '*' single-ignored show
60 60  
61   -if [ "x$COMPLETION_WAITING_DOTS" = "xtrue" ]; then
  61 +if [[ $COMPLETION_WAITING_DOTS = true ]]; then
62 62 expand-or-complete-with-dots() {
63   - echo -n "\e[31m......\e[0m"
  63 + # toggle line-wrapping off and back on again
  64 + [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
  65 + print -Pn "%{%F{red}......%f%}"
  66 + [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam
  67 +
64 68 zle expand-or-complete
65 69 zle redisplay
66 70 }
... ... @@ -0,0 +1,353 @@
  1 +# diagnostics.zsh
  2 +#
  3 +# Diagnostic and debugging support for oh-my-zsh
  4 +
  5 +# omz_diagnostic_dump()
  6 +#
  7 +# Author: Andrew Janke <andrew@apjanke.net>
  8 +#
  9 +# Usage:
  10 +#
  11 +# omz_diagnostic_dump [-v] [-V] [file]
  12 +#
  13 +# NOTE: This is a work in progress. Its interface and behavior are going to change,
  14 +# and probably in non-back-compatible ways.
  15 +#
  16 +# Outputs a bunch of information about the state and configuration of
  17 +# oh-my-zsh, zsh, and the user's system. This is intended to provide a
  18 +# bunch of context for diagnosing your own or a third party's problems, and to
  19 +# be suitable for posting to public bug reports.
  20 +#
  21 +# The output is human-readable and its format may change over time. It is not
  22 +# suitable for parsing. All the output is in one single file so it can be posted
  23 +# as a gist or bug comment on GitHub. GitHub doesn't support attaching tarballs
  24 +# or other files to bugs; otherwise, this would probably have an option to produce
  25 +# tarballs that contain copies of the config and customization files instead of
  26 +# catting them all in to one file.
  27 +#
  28 +# This is intended to be widely portable, and run anywhere that oh-my-zsh does.
  29 +# Feel free to report any portability issues as bugs.
  30 +#
  31 +# This is written in a defensive style so it still works (and can detect) cases when
  32 +# basic functionality like echo and which have been redefined. In particular, almost
  33 +# everything is invoked with "builtin" or "command", to work in the face of user
  34 +# redefinitions.
  35 +#
  36 +# OPTIONS
  37 +#
  38 +# [file] Specifies the output file. If not given, a file in the current directory
  39 +# is selected automatically.
  40 +#
  41 +# -v Increase the verbosity of the dump output. May be specified multiple times.
  42 +# Verbosity levels:
  43 +# 0 - Basic info, shell state, omz configuration, git state
  44 +# 1 - (default) Adds key binding info and configuration file contents
  45 +# 2 - Adds zcompdump file contents
  46 +#
  47 +# -V Reduce the verbosity of the dump output. May be specified multiple times.
  48 +#
  49 +# TODO:
  50 +# * Multi-file capture
  51 +# * Add automatic gist uploading
  52 +# * Consider whether to move default output file location to TMPDIR. More robust
  53 +# but less user friendly.
  54 +#
  55 +
  56 +autoload -Uz is-at-least
  57 +
  58 +function omz_diagnostic_dump() {
  59 + emulate -L zsh
  60 +
  61 + builtin echo "Generating diagnostic dump; please be patient..."
  62 +
  63 + local thisfcn=omz_diagnostic_dump
  64 + local -A opts
  65 + local opt_verbose opt_noverbose opt_outfile
  66 + local timestamp=$(date +%Y%m%d-%H%M%S)
  67 + local outfile=omz_diagdump_$timestamp.txt
  68 + builtin zparseopts -A opts -D -- "v+=opt_verbose" "V+=opt_noverbose"
  69 + local verbose n_verbose=${#opt_verbose} n_noverbose=${#opt_noverbose}
  70 + (( verbose = 1 + n_verbose - n_noverbose ))
  71 +
  72 + if [[ ${#*} > 0 ]]; then
  73 + opt_outfile=$1
  74 + fi
  75 + if [[ ${#*} > 1 ]]; then
  76 + builtin echo "$thisfcn: error: too many arguments" >&2
  77 + return 1
  78 + fi
  79 + if [[ -n "$opt_outfile" ]]; then
  80 + outfile="$opt_outfile"
  81 + fi
  82 +
  83 + # Always write directly to a file so terminal escape sequences are
  84 + # captured cleanly
  85 + _omz_diag_dump_one_big_text &> "$outfile"
  86 + if [[ $? != 0 ]]; then
  87 + builtin echo "$thisfcn: error while creating diagnostic dump; see $outfile for details"
  88 + fi
  89 +
  90 + builtin echo
  91 + builtin echo Diagnostic dump file created at: "$outfile"
  92 + builtin echo
  93 + builtin echo To share this with OMZ developers, post it as a gist on GitHub
  94 + builtin echo at "https://gist.github.com" and share the link to the gist.
  95 + builtin echo
  96 + builtin echo "WARNING: This dump file contains all your zsh and omz configuration files,"
  97 + builtin echo "so don't share it publicly if there's sensitive information in them."
  98 + builtin echo
  99 +
  100 +}
  101 +
  102 +function _omz_diag_dump_one_big_text() {
  103 + local program programs progfile md5
  104 +
  105 + builtin echo oh-my-zsh diagnostic dump
  106 + builtin echo
  107 + builtin echo $outfile
  108 + builtin echo
  109 +
  110 + # Basic system and zsh information
  111 + command date
  112 + command uname -a
  113 + builtin echo OSTYPE=$OSTYPE
  114 + builtin echo ZSH_VERSION=$ZSH_VERSION
  115 + builtin echo User: $USER
  116 + builtin echo umask: $(umask)
  117 + builtin echo
  118 + _omz_diag_dump_os_specific_version
  119 + builtin echo
  120 +
  121 + # Installed programs
  122 + programs=(sh zsh ksh bash sed cat grep ls find git posh)
  123 + local progfile="" extra_str="" sha_str=""
  124 + for program in $programs; do
  125 + extra_str="" sha_str=""
  126 + progfile=$(builtin which $program)
  127 + if [[ $? == 0 ]]; then
  128 + if [[ -e $progfile ]]; then
  129 + if builtin whence shasum &>/dev/null; then
  130 + sha_str=($(command shasum $progfile))
  131 + sha_str=$sha_str[1]
  132 + extra_str+=" SHA $sha_str"
  133 + fi
  134 + if [[ -h "$progfile" ]]; then
  135 + extra_str+=" ( -> ${progfile:A} )"
  136 + fi
  137 + fi
  138 + builtin printf '%-9s %-20s %s\n' "$program is" "$progfile" "$extra_str"
  139 + else
  140 + builtin echo "$program: not found"
  141 + fi
  142 + done
  143 + builtin echo
  144 + builtin echo Command Versions:
  145 + builtin echo "zsh: $(zsh --version)"
  146 + builtin echo "this zsh session: $ZSH_VERSION"
  147 + builtin echo "bash: $(bash --version | command grep bash)"
  148 + builtin echo "git: $(git --version)"
  149 + builtin echo "grep: $(grep --version)"
  150 + builtin echo
  151 +
  152 + # Core command definitions
  153 + _omz_diag_dump_check_core_commands || return 1
  154 + builtin echo
  155 +
  156 + # ZSH Process state
  157 + builtin echo Process state:
  158 + builtin echo pwd: $PWD
  159 + if builtin whence pstree &>/dev/null; then
  160 + builtin echo Process tree for this shell:
  161 + pstree -p $$
  162 + else
  163 + ps -fT
  164 + fi
  165 + builtin set | command grep -a '^\(ZSH\|plugins\|TERM\|LC_\|LANG\|precmd\|chpwd\|preexec\|FPATH\|TTY\|DISPLAY\|PATH\)\|OMZ'
  166 + builtin echo
  167 + #TODO: Should this include `env` instead of or in addition to `export`?
  168 + builtin echo Exported:
  169 + builtin echo $(builtin export | command sed 's/=.*//')
  170 + builtin echo
  171 + builtin echo Locale:
  172 + command locale
  173 + builtin echo
  174 +
  175 + # Zsh installation and configuration
  176 + builtin echo Zsh configuration:
  177 + builtin echo setopt: $(builtin setopt)
  178 + builtin echo
  179 + builtin echo zstyle:
  180 + builtin zstyle
  181 + builtin echo
  182 + builtin echo 'compaudit output:'
  183 + compaudit
  184 + builtin echo
  185 + builtin echo '$fpath directories:'
  186 + command ls -lad $fpath
  187 + builtin echo
  188 +
  189 + # Oh-my-zsh installation
  190 + builtin echo oh-my-zsh installation:
  191 + command ls -ld ~/.z*
  192 + command ls -ld ~/.oh*
  193 + builtin echo
  194 + builtin echo oh-my-zsh git state:
  195 + (cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]")
  196 + if [[ $verbose -ge 1 ]]; then
  197 + (cd $ZSH && git reflog --date=default | command grep pull)
  198 + fi
  199 + builtin echo
  200 + if [[ -e $ZSH_CUSTOM ]]; then
  201 + local custom_dir=$ZSH_CUSTOM
  202 + if [[ -h $custom_dir ]]; then
  203 + custom_dir=$(cd $custom_dir && pwd -P)
  204 + fi
  205 + builtin echo "oh-my-zsh custom dir:"
  206 + builtin echo " $ZSH_CUSTOM ($custom_dir)"
  207 + (cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print)
  208 + builtin echo
  209 + fi
  210 +
  211 + # Key binding and terminal info
  212 + if [[ $verbose -ge 1 ]]; then
  213 + builtin echo "bindkey:"
  214 + builtin bindkey
  215 + builtin echo
  216 + builtin echo "infocmp:"
  217 + command infocmp -L
  218 + builtin echo
  219 + fi
  220 +
  221 + # Configuration file info
  222 + local zdotdir=${ZDOTDIR:-$HOME}
  223 + builtin echo "Zsh configuration files:"
  224 + local cfgfile cfgfiles
  225 + # Some files for bash that zsh does not use are intentionally included
  226 + # to help with diagnosing behavior differences between bash and zsh
  227 + cfgfiles=( /etc/zshenv /etc/zprofile /etc/zshrc /etc/zlogin /etc/zlogout
  228 + $zdotdir/.zshenv $zdotdir/.zprofile $zdotdir/.zshrc $zdotdir/.zlogin $zdotdir/.zlogout
  229 + ~/.zsh.pre-oh-my-zsh
  230 + /etc/bashrc /etc/profile ~/.bashrc ~/.profile ~/.bash_profile ~/.bash_logout )
  231 + command ls -lad $cfgfiles 2>&1
  232 + builtin echo
  233 + if [[ $verbose -ge 1 ]]; then
  234 + for cfgfile in $cfgfiles; do
  235 + _omz_diag_dump_echo_file_w_header $cfgfile
  236 + done
  237 + fi
  238 + builtin echo
  239 + builtin echo "Zsh compdump files:"
  240 + local dumpfile dumpfiles
  241 + command ls -lad $zdotdir/.zcompdump*
  242 + dumpfiles=( $zdotdir/.zcompdump*(N) )
  243 + if [[ $verbose -ge 2 ]]; then
  244 + for dumpfile in $dumpfiles; do
  245 + _omz_diag_dump_echo_file_w_header $dumpfile
  246 + done
  247 + fi
  248 +
  249 +}
  250 +
  251 +function _omz_diag_dump_check_core_commands() {
  252 + builtin echo "Core command check:"
  253 + local redefined name builtins externals reserved_words
  254 + redefined=()
  255 + # All the zsh non-module builtin commands
  256 + # These are taken from the zsh reference manual for 5.0.2
  257 + # Commands from modules should not be included.
  258 + # (For back-compatibility, if any of these are newish, they should be removed,
  259 + # or at least made conditional on the version of the current running zsh.)
  260 + # "history" is also excluded because OMZ is known to redefine that
  261 + reserved_words=( do done esac then elif else fi for case if while function
  262 + repeat time until select coproc nocorrect foreach end '!' '[[' '{' '}'
  263 + )
  264 + builtins=( alias autoload bg bindkey break builtin bye cd chdir command
  265 + comparguments compcall compctl compdescribe compfiles compgroups compquote comptags
  266 + comptry compvalues continue dirs disable disown echo echotc echoti emulate
  267 + enable eval exec exit false fc fg functions getln getopts hash
  268 + jobs kill let limit log logout noglob popd print printf
  269 + pushd pushln pwd r read rehash return sched set setopt shift
  270 + source suspend test times trap true ttyctl type ulimit umask unalias
  271 + unfunction unhash unlimit unset unsetopt vared wait whence where which zcompile
  272 + zle zmodload zparseopts zregexparse zstyle )
  273 + if is-at-least 5.1; then
  274 + reserved_word+=( declare export integer float local readonly typeset )
  275 + else
  276 + builtins+=( declare export integer float local readonly typeset )
  277 + fi
  278 + builtins_fatal=( builtin command local )
  279 + externals=( zsh )
  280 + for name in $reserved_words; do
  281 + if [[ $(builtin whence -w $name) != "$name: reserved" ]]; then
  282 + builtin echo "reserved word '$name' has been redefined"
  283 + builtin which $name
  284 + redefined+=$name
  285 + fi
  286 + done
  287 + for name in $builtins; do
  288 + if [[ $(builtin whence -w $name) != "$name: builtin" ]]; then
  289 + builtin echo "builtin '$name' has been redefined"
  290 + builtin which $name
  291 + redefined+=$name
  292 + fi
  293 + done
  294 + for name in $externals; do
  295 + if [[ $(builtin whence -w $name) != "$name: command" ]]; then
  296 + builtin echo "command '$name' has been redefined"
  297 + builtin which $name
  298 + redefined+=$name
  299 + fi
  300 + done
  301 +
  302 + if [[ -n "$redefined" ]]; then
  303 + builtin echo "SOME CORE COMMANDS HAVE BEEN REDEFINED: $redefined"
  304 + else
  305 + builtin echo "All core commands are defined normally"
  306 + fi
  307 +
  308 +}
  309 +
  310 +function _omz_diag_dump_echo_file_w_header() {
  311 + local file=$1
  312 + if [[ ( -f $file || -h $file ) ]]; then
  313 + builtin echo "========== $file =========="
  314 + if [[ -h $file ]]; then
  315 + builtin echo "========== ( => ${file:A} ) =========="
  316 + fi
  317 + command cat $file
  318 + builtin echo "========== end $file =========="
  319 + builtin echo
  320 + elif [[ -d $file ]]; then
  321 + builtin echo "File '$file' is a directory"
  322 + elif [[ ! -e $file ]]; then
  323 + builtin echo "File '$file' does not exist"
  324 + else
  325 + command ls -lad "$file"
  326 + fi
  327 +}
  328 +
  329 +function _omz_diag_dump_os_specific_version() {
  330 + local osname osver version_file version_files
  331 + case "$OSTYPE" in
  332 + darwin*)
  333 + osname=$(command sw_vers -productName)
  334 + osver=$(command sw_vers -productVersion)
  335 + builtin echo "OS Version: $osname $osver build $(sw_vers -buildVersion)"
  336 + ;;
  337 + cygwin)
  338 + command systeminfo | command head -4 | command tail -2
  339 + ;;
  340 + esac
  341 +
  342 + if builtin which lsb_release >/dev/null; then
  343 + builtin echo "OS Release: $(command lsb_release -s -d)"
  344 + fi
  345 +
  346 + version_files=( /etc/*-release(N) /etc/*-version(N) /etc/*_version(N) )
  347 + for version_file in $version_files; do
  348 + builtin echo "$version_file:"
  349 + command cat "$version_file"
  350 + builtin echo
  351 + done
  352 +}
  353 +
... ... @@ -89,3 +89,135 @@ function env_default() {
89 89 env | grep -q "^$1=" && return 0
90 90 export "$1=$2" && return 3
91 91 }
  92 +
  93 +
  94 +# Required for $langinfo
  95 +zmodload zsh/langinfo
  96 +
  97 +# URL-encode a string
  98 +#
  99 +# Encodes a string using RFC 2396 URL-encoding (%-escaped).
  100 +# See: https://www.ietf.org/rfc/rfc2396.txt
  101 +#
  102 +# By default, reserved characters and unreserved "mark" characters are
  103 +# not escaped by this function. This allows the common usage of passing
  104 +# an entire URL in, and encoding just special characters in it, with
  105 +# the expectation that reserved and mark characters are used appropriately.
  106 +# The -r and -m options turn on escaping of the reserved and mark characters,
  107 +# respectively, which allows arbitrary strings to be fully escaped for
  108 +# embedding inside URLs, where reserved characters might be misinterpreted.
  109 +#
  110 +# Prints the encoded string on stdout.
  111 +# Returns nonzero if encoding failed.
  112 +#
  113 +# Usage:
  114 +# omz_urlencode [-r] [-m] <string>
  115 +#
  116 +# -r causes reserved characters (;/?:@&=+$,) to be escaped
  117 +#
  118 +# -m causes "mark" characters (_.!~*''()-) to be escaped
  119 +#
  120 +# -P causes spaces to be encoded as '%20' instead of '+'
  121 +function omz_urlencode() {
  122 + emulate -L zsh
  123 + zparseopts -D -E -a opts r m P
  124 +
  125 + local in_str=$1
  126 + local url_str=""
  127 + local spaces_as_plus
  128 + if [[ -z $opts[(r)-P] ]]; then spaces_as_plus=1; fi
  129 + local str="$in_str"
  130 +
  131 + # URLs must use UTF-8 encoding; convert str to UTF-8 if required
  132 + local encoding=$langinfo[CODESET]
  133 + local safe_encodings
  134 + safe_encodings=(UTF-8 utf8 US-ASCII)
  135 + if [[ -z ${safe_encodings[(r)$encoding]} ]]; then
  136 + str=$(echo -E "$str" | iconv -f $encoding -t UTF-8)
  137 + if [[ $? != 0 ]]; then
  138 + echo "Error converting string from $encoding to UTF-8" >&2
  139 + return 1
  140 + fi
  141 + fi
  142 +
  143 + # Use LC_CTYPE=C to process text byte-by-byte
  144 + local i byte ord LC_ALL=C
  145 + export LC_ALL
  146 + local reserved=';/?:@&=+$,'
  147 + local mark='_.!~*''()-'
  148 + local dont_escape="[A-Za-z0-9"
  149 + if [[ -z $opts[(r)-r] ]]; then
  150 + dont_escape+=$reserved
  151 + fi
  152 + # $mark must be last because of the "-"
  153 + if [[ -z $opts[(r)-m] ]]; then
  154 + dont_escape+=$mark
  155 + fi
  156 + dont_escape+="]"
  157 +
  158 + # Implemented to use a single printf call and avoid subshells in the loop,
  159 + # for performance (primarily on Windows).
  160 + local url_str=""
  161 + for (( i = 1; i <= ${#str}; ++i )); do
  162 + byte="$str[i]"
  163 + if [[ "$byte" =~ "$dont_escape" ]]; then
  164 + url_str+="$byte"
  165 + else
  166 + if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
  167 + url_str+="+"
  168 + else
  169 + ord=$(( [##16] #byte ))
  170 + url_str+="%$ord"
  171 + fi
  172 + fi
  173 + done
  174 + echo -E "$url_str"
  175 +}
  176 +
  177 +# URL-decode a string
  178 +#
  179 +# Decodes a RFC 2396 URL-encoded (%-escaped) string.
  180 +# This decodes the '+' and '%' escapes in the input string, and leaves
  181 +# other characters unchanged. Does not enforce that the input is a
  182 +# valid URL-encoded string. This is a convenience to allow callers to
  183 +# pass in a full URL or similar strings and decode them for human
  184 +# presentation.
  185 +#
  186 +# Outputs the encoded string on stdout.
  187 +# Returns nonzero if encoding failed.
  188 +#
  189 +# Usage:
  190 +# omz_urldecode <urlstring> - prints decoded string followed by a newline
  191 +function omz_urldecode {
  192 + emulate -L zsh
  193 + local encoded_url=$1
  194 +
  195 + # Work bytewise, since URLs escape UTF-8 octets
  196 + local caller_encoding=$langinfo[CODESET]
  197 + local LC_ALL=C
  198 + export LC_ALL
  199 +
  200 + # Change + back to ' '
  201 + local tmp=${encoded_url:gs/+/ /}
  202 + # Protect other escapes to pass through the printf unchanged
  203 + tmp=${tmp:gs/\\/\\\\/}
  204 + # Handle %-escapes by turning them into `\xXX` printf escapes
  205 + tmp=${tmp:gs/%/\\x/}
  206 + local decoded
  207 + eval "decoded=\$'$tmp'"
  208 +
  209 + # Now we have a UTF-8 encoded string in the variable. We need to re-encode
  210 + # it if caller is in a non-UTF-8 locale.
  211 + local safe_encodings
  212 + safe_encodings=(UTF-8 utf8 US-ASCII)
  213 + if [[ -z ${safe_encodings[(r)$caller_encoding]} ]]; then
  214 + decoded=$(echo -E "$decoded" | iconv -f UTF-8 -t $caller_encoding)
  215 + if [[ $? != 0 ]]; then
  216 + echo "Error converting string from UTF-8 to $caller_encoding" >&2
  217 + return 1
  218 + fi
  219 + fi
  220 +
  221 + echo -E "$decoded"
  222 +}
  223 +
... ... @@ -36,7 +36,10 @@ git_remote_status() {
36 36 ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
37 37 behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
38 38  
39   - if [ $ahead -gt 0 ] && [ $behind -eq 0 ]
  39 + if [ $ahead -eq 0 ] && [ $behind -eq 0 ]
  40 + then
  41 + git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE"
  42 + elif [ $ahead -gt 0 ] && [ $behind -eq 0 ]
40 43 then
41 44 git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
42 45 git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}"
... ... @@ -11,7 +11,7 @@ if grep-flag-available --color=auto; then
11 11 fi
12 12  
13 13 # ignore VCS folders (if the necessary grep flags are available)
14   -VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}"
  14 +VCS_FOLDERS="{.bzr,CVS,.git,.hg,.svn}"
15 15  
16 16 if grep-flag-available --exclude-dir=.cvs; then
17 17 GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS"
1 1 ## Load smart urls if available
2   -for d in $fpath; do
3   - if [[ -e "$d/url-quote-magic" ]]; then
4   - autoload -U url-quote-magic
5   - zle -N self-insert url-quote-magic
6   - fi
7   -done
  2 +# bracketed-paste-magic is known buggy in zsh 5.1.1 (only), so skip it there; see #4434
  3 +autoload -Uz is-at-least
  4 +if [[ $ZSH_VERSION != 5.1.1 ]]; then
  5 + for d in $fpath; do
  6 + if [[ -e "$d/url-quote-magic" ]]; then
  7 + if is-at-least 5.1; then
  8 + autoload -Uz bracketed-paste-magic
  9 + zle -N bracketed-paste bracketed-paste-magic
  10 + fi
  11 + autoload -Uz url-quote-magic
  12 + zle -N self-insert url-quote-magic
  13 + break
  14 + fi
  15 + done
  16 +fi
8 17  
9 18 ## jobs
10 19 setopt long_list_jobs
... ... @@ -18,7 +27,11 @@ alias _=&#39;sudo&#39;
18 27 alias please='sudo'
19 28  
20 29 ## more intelligent acking for ubuntu users
21   -alias afind='ack-grep -il'
  30 +if which ack-grep &> /dev/null; then
  31 + alias afind='ack-grep -il'
  32 +else
  33 + alias afind='ack -il'
  34 +fi
22 35  
23 36 # only define LC_CTYPE if undefined
24 37 if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then
... ... @@ -33,6 +33,7 @@ fi
33 33  
34 34 # Runs before showing the prompt
35 35 function omz_termsupport_precmd {
  36 + emulate -L zsh
36 37 if [[ $DISABLE_AUTO_TITLE == true ]]; then
37 38 return
38 39 fi
... ... @@ -42,11 +43,11 @@ function omz_termsupport_precmd {
42 43  
43 44 # Runs before executing the command
44 45 function omz_termsupport_preexec {
  46 + emulate -L zsh
45 47 if [[ $DISABLE_AUTO_TITLE == true ]]; then
46 48 return
47 49 fi
48 50  
49   - emulate -L zsh
50 51 setopt extended_glob
51 52  
52 53 # cmd name only, or if this is sudo or ssh, the next cmd
... ... @@ -60,14 +61,28 @@ precmd_functions+=(omz_termsupport_precmd)
60 61 preexec_functions+=(omz_termsupport_preexec)
61 62  
62 63  
63   -# Runs before showing the prompt, to update the current directory in Terminal.app
64   -function omz_termsupport_cwd {
65   - # Notify Terminal.app of current directory using undocumented OSC sequence
66   - # found in OS X 10.9 and 10.10's /etc/bashrc
67   - if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then
68   - local PWD_URL="file://$HOSTNAME${PWD// /%20}"
69   - printf '\e]7;%s\a' "$PWD_URL"
70   - fi
71   -}
  64 +# Keep Apple Terminal.app's current working directory updated
  65 +# Based on this answer: http://superuser.com/a/315029
  66 +# With extra fixes to handle multibyte chars and non-UTF-8 locales
72 67  
73   -precmd_functions+=(omz_termsupport_cwd)
  68 +if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
  69 +
  70 + # Emits the control sequence to notify Terminal.app of the cwd
  71 + function update_terminalapp_cwd() {
  72 + emulate -L zsh
  73 + # Identify the directory using a "file:" scheme URL, including
  74 + # the host name to disambiguate local vs. remote paths.
  75 +
  76 + # Percent-encode the pathname.
  77 + local URL_PATH=$(omz_urlencode -P $PWD)
  78 + [[ $? != 0 ]] && return 1
  79 + local PWD_URL="file://$HOST$URL_PATH"
  80 + # Undocumented Terminal.app-specific control sequence
  81 + printf '\e]7;%s\a' $PWD_URL
  82 + }
  83 +
  84 + # Use a precmd hook instead of a chpwd hook to avoid contaminating output
  85 + precmd_functions+=(update_terminalapp_cwd)
  86 + # Run once to get initial cwd set
  87 + update_terminalapp_cwd
  88 +fi
lib/theme-and-appearance.zsh
... ... @@ -11,8 +11,11 @@ then
11 11 # otherwise, leave ls as is, because NetBSD's ls doesn't support -G
12 12 gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
13 13 elif [[ "$(uname -s)" == "OpenBSD" ]]; then
14   - # On OpenBSD, test if "colorls" is installed (this one supports colors);
15   - # otherwise, leave ls as is, because OpenBSD's ls doesn't support -G
  14 + # On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base,
  15 + # with color and multibyte support) are available from ports. "colorls"
  16 + # will be installed on purpose and can't be pulled in by installing
  17 + # coreutils, so prefer it to "gls".
  18 + gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
16 19 colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G'
17 20 else
18 21 ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
... ... @@ -8,6 +8,11 @@ fi
8 8 # add a function path
9 9 fpath=($ZSH/functions $ZSH/completions $fpath)
10 10  
  11 +# Load all stock functions (from $fpath files) called below.
  12 +autoload -U compaudit compinit
  13 +
  14 +: ${ZSH_DISABLE_COMPFIX:=true}
  15 +
11 16 # Set ZSH_CUSTOM to the path where your custom config files
12 17 # and plugins exists, or else we will use the default custom/
13 18 if [[ -z "$ZSH_CUSTOM" ]]; then
... ... @@ -59,9 +64,18 @@ if [ -z &quot;$ZSH_COMPDUMP&quot; ]; then
59 64 ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
60 65 fi
61 66  
62   -# Load and run compinit
63   -autoload -U compinit
64   -compinit -i -d "${ZSH_COMPDUMP}"
  67 +if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
  68 + # If completion insecurities exist, warn the user without enabling completions.
  69 + if ! compaudit &>/dev/null; then
  70 + # This function resides in the "lib/compfix.zsh" script sourced above.
  71 + handle_completion_insecurities
  72 + # Else, enable and cache completions to the desired file.
  73 + else
  74 + compinit -d "${ZSH_COMPDUMP}"
  75 + fi
  76 +else
  77 + compinit -i -d "${ZSH_COMPDUMP}"
  78 +fi
65 79  
66 80 # Load all of the plugins that were defined in ~/.zshrc
67 81 for plugin ($plugins); do
plugins/atom/README.md
... ... @@ -1,17 +0,0 @@
1   -## atom
2   -
3   -Plugin for Atom, a cross platform text and code editor, available for Linux, Mac OS X, and Windows.
4   -
5   -### Requirements
6   -
7   - * [Atom](https://atom.io/)
8   -
9   -### Usage
10   -
11   - * If `at` command is called without an argument, launch Atom
12   -
13   - * If `at` is passed a directory, `cd` to it and open it in Atom
14   -
15   - * If `at` is passed a file, open it in Atom
16   -
17   - * if `att` command is called, it is equivalent to `at .`, opening the current folder in Atom
plugins/atom/atom.plugin.zsh
... ... @@ -1,14 +0,0 @@
1   -local _atom_paths > /dev/null 2>&1
2   -_atom_paths=(
3   - "$HOME/Applications/Atom.app"
4   - "/Applications/Atom.app"
5   -)
6   -
7   -for _atom_path in $_atom_paths; do
8   - if [[ -a $_atom_path ]]; then
9   - alias at="open -a '$_atom_path'"
10   - break
11   - fi
12   -done
13   -
14   -alias att='at .'
plugins/autoenv/autoenv.plugin.zsh
1 1 # Activates autoenv or reports its failure
2   -if ! source $HOME/.autoenv/activate.sh 2>/dev/null; then
3   - echo '-------- AUTOENV ---------'
4   - echo 'Could not find ~/.autoenv/activate.sh.'
5   - echo 'Please check if autoenv is correctly installed.'
6   - echo 'In the meantime the autoenv plugin is DISABLED.'
7   - echo '--------------------------'
8   - return 1
  2 +() {
  3 +if ! type autoenv_init >/dev/null; then
  4 + for d (~/.autoenv /usr/local/opt/autoenv); do
  5 + if [[ -e $d/activate.sh ]]; then
  6 + autoenv_dir=$d
  7 + break
  8 + fi
  9 + done
  10 + if [[ -z $autoenv_dir ]]; then
  11 + cat <<END >&2
  12 +-------- AUTOENV ---------
  13 +Could not locate autoenv installation.
  14 +Please check if autoenv is correctly installed.
  15 +In the meantime the autoenv plugin is DISABLED.
  16 +--------------------------
  17 +END
  18 + return 1
  19 + fi
  20 + source $autoenv_dir/activate.sh
9 21 fi
  22 +}
  23 +[[ $? != 0 ]] && return $?
10 24  
11 25 # The use_env call below is a reusable command to activate/create a new Python
12 26 # virtualenv, requiring only a single declarative line of code in your .env files.
plugins/autojump/autojump.plugin.zsh
... ... @@ -15,7 +15,7 @@ if [ $commands[autojump] ]; then # check if autojump is installed
15 15 . /usr/local/share/autojump/autojump.zsh
16 16 elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports
17 17 . /opt/local/etc/profile.d/autojump.zsh
18   - elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.zsh ]; then # mac os x with brew
19   - . `brew --prefix`/etc/autojump.zsh
  18 + elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.sh ]; then # mac os x with brew
  19 + . `brew --prefix`/etc/autojump.sh
20 20 fi
21 21 fi
plugins/aws/aws.plugin.zsh
... ... @@ -11,11 +11,16 @@ export AWS_HOME=~/.aws
11 11 function agp {
12 12 echo $AWS_DEFAULT_PROFILE
13 13 }
  14 +
14 15 function asp {
  16 + local rprompt=${RPROMPT/<aws:$(agp)>/}
  17 +
15 18 export AWS_DEFAULT_PROFILE=$1
16 19 export AWS_PROFILE=$1
17   - export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>$RPROMPT"
  20 +
  21 + export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>$rprompt"
18 22 }
  23 +
19 24 function aws_profiles {
20 25 reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/'))
21 26 }
plugins/bgnotify/bgnotify.plugin.zsh
... ... @@ -11,31 +11,38 @@ autoload -Uz add-zsh-hook || { print &quot;can&#39;t add zsh hook!&quot;; return }
11 11  
12 12 ## definitions ##
13 13  
14   -if ! (type bgnotify_formatted | grep -q 'function'); then
15   - function bgnotify_formatted {
16   - ## exit_status, command, elapsed_time
17   - [ $1 -eq 0 ] && title="#win (took $3 s)" || title="#fail (took $3 s)"
18   - bgnotify "$title" "$2"
  14 +if ! (type bgnotify_formatted | grep -q 'function'); then ## allow custom function override
  15 + function bgnotify_formatted { ## args: (exit_status, command, elapsed_seconds)
  16 + elapsed="$(( $3 % 60 ))s"
  17 + (( $3 >= 60 )) && elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
  18 + (( $3 >= 3600 )) && elapsed="$(( $3 / 3600 ))h $elapsed"
  19 + [ $1 -eq 0 ] && bgnotify "#win (took $elapsed)" "$2" || bgnotify "#fail (took $elapsed)" "$2"
19 20 }
20 21 fi
21 22  
22 23 currentWindowId () {
23 24 if hash osascript 2>/dev/null; then #osx
24 25 osascript -e 'tell application (path to frontmost application as text) to id of front window' 2&> /dev/null || echo "0"
25   - elif hash notify-send 2>/dev/null; then #ubuntu!
26   - xprop -root | awk '/NET_ACTIVE_WINDOW/ { print $5; exit }'
  26 + elif (hash notify-send 2>/dev/null || hash kdialog 2>/dev/null); then #ubuntu!
  27 + xprop -root 2> /dev/null | awk '/NET_ACTIVE_WINDOW/{print $5;exit} END{exit !$5}' || echo "0"
27 28 else
28 29 echo $EPOCHSECONDS #fallback for windows
29 30 fi
30 31 }
31 32  
32   -bgnotify () {
  33 +bgnotify () { ## args: (title, subtitle)
33 34 if hash terminal-notifier 2>/dev/null; then #osx
34   - terminal-notifier -message "$2" -title "$1"
  35 + [[ "$TERM_PROGRAM" == 'iTerm.app' ]] && term_id='com.googlecode.iterm2';
  36 + [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]] && term_id='com.apple.terminal';
  37 + ## now call terminal-notifier, (hopefully with $term_id!)
  38 + [ -z "$term_id" ] && terminal-notifier -message "$2" -title "$1" >/dev/null ||
  39 + terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" >/dev/null
35 40 elif hash growlnotify 2>/dev/null; then #osx growl
36 41 growlnotify -m "$1" "$2"
37   - elif hash notify-send 2>/dev/null; then #ubuntu!
  42 + elif hash notify-send 2>/dev/null; then #ubuntu gnome!
38 43 notify-send "$1" "$2"
  44 + elif hash kdialog 2>/dev/null; then #ubuntu kde!
  45 + kdialog -title "$1" --passivepopup "$2" 5
39 46 elif hash notifu 2>/dev/null; then #cygwyn support!
40 47 notifu /m "$2" /p "$1"
41 48 fi
... ... @@ -46,7 +53,7 @@ bgnotify () {
46 53  
47 54 bgnotify_begin() {
48 55 bgnotify_timestamp=$EPOCHSECONDS
49   - bgnotify_lastcmd=$1
  56 + bgnotify_lastcmd="$1"
50 57 bgnotify_windowid=$(currentWindowId)
51 58 }
52 59  
... ... @@ -63,5 +70,8 @@ bgnotify_end() {
63 70 bgnotify_timestamp=0 #reset it to 0!
64 71 }
65 72  
66   -add-zsh-hook preexec bgnotify_begin
67   -add-zsh-hook precmd bgnotify_end
  73 +## only enable if a local (non-ssh) connection
  74 +if [ -z "$SSH_CLIENT" ] && [ -z "$SSH_TTY" ]; then
  75 + add-zsh-hook preexec bgnotify_begin
  76 + add-zsh-hook precmd bgnotify_end
  77 +fi
plugins/capistrano/_capistrano
1   -#compdef cap
  1 +#compdef shipit
2 2 #autoload
3 3  
4   -if [[ -f config/deploy.rb || -f Capfile ]]; then
5   - if [[ ! -f .cap_tasks~ || config/deploy.rb -nt .cap_tasks~ ]]; then
6   - echo "\nGenerating .cap_tasks~..." > /dev/stderr
7   - cap -v --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~
  4 +# Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work.
  5 +# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module
  6 +
  7 +local curcontext="$curcontext" state line ret=1
  8 +local -a _configs
  9 +
  10 +_arguments -C \
  11 + '1: :->cmds' \
  12 + '2:: :->args' && ret=0
  13 +
  14 +_cap_tasks() {
  15 + if [[ -f config/deploy.rb || -f Capfile ]]; then
  16 + if [[ ! -f .cap_tasks~ ]]; then
  17 + shipit --tasks | sed 's/\(\[\)\(.*\)\(\]\)/\2:/' | awk '{command=$2; $1=$2=$3=""; gsub(/^[ \t\r\n]+/, "", $0); gsub(":", "\\:", command); print command"["$0"]"}' > .cap_tasks~
  18 + fi
  19 +
  20 + OLD_IFS=$IFS
  21 + IFS=$'\n'
  22 + _values 'cap commands' $(< .cap_tasks~)
  23 + IFS=$OLD_IFS
  24 + # zmodload zsh/mapfile
  25 + # _values ${(f)mapfile[.cap_tasks~]}
8 26 fi
9   - compadd `cat .cap_tasks~`
10   -fi
  27 +}
  28 +
  29 +_cap_stages() {
  30 + compadd $(find config/deploy -name \*.rb | cut -d/ -f3 | sed s:.rb::g)
  31 +}
  32 +
  33 +case $state in
  34 + cmds)
  35 + # check if it uses multistage
  36 + if [[ -d config/deploy ]]; then
  37 + _cap_stages
  38 + else
  39 + _cap_tasks
  40 + fi
  41 + ret=0
  42 + ;;
  43 + args)
  44 + _cap_tasks
  45 + ret=0
  46 + ;;
  47 +esac
  48 +
  49 +return ret
plugins/capistrano/capistrano.plugin.zsh
... ... @@ -0,0 +1,11 @@
  1 +# Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work.
  2 +# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module
  3 +
  4 +func shipit() {
  5 + if [ -f Gemfile ]
  6 + then
  7 + bundle exec cap $*
  8 + else
  9 + cap $*
  10 + fi
  11 +}
plugins/chruby/chruby.plugin.zsh
... ... @@ -24,7 +24,7 @@ _homebrew-installed() {
24 24 }
25 25  
26 26 _chruby-from-homebrew-installed() {
27   - [ -r $(brew --prefix chruby)] &> /dev/null
  27 + [ -r $(brew --prefix chruby) ] &> /dev/null
28 28 }
29 29  
30 30 _ruby-build_installed() {
... ... @@ -45,11 +45,11 @@ _source_from_omz_settings() {
45 45 zstyle -s :omz:plugins:chruby path _chruby_path
46 46 zstyle -s :omz:plugins:chruby auto _chruby_auto
47 47  
48   - if ${_chruby_path} && [[ -r ${_chruby_path} ]]; then
  48 + if [[ -r ${_chruby_path} ]]; then
49 49 source ${_chruby_path}
50 50 fi
51 51  
52   - if ${_chruby_auto} && [[ -r ${_chruby_auto} ]]; then
  52 + if [[ -r ${_chruby_auto} ]]; then
53 53 source ${_chruby_auto}
54 54 fi
55 55 }
plugins/chucknorris/chucknorris.plugin.zsh
1   -if [ ! -f $ZSH/plugins/chucknorris/fortunes/chucknorris.dat ]; then
2   - strfile $ZSH/plugins/chucknorris/fortunes/chucknorris $ZSH/plugins/chucknorris/fortunes/chucknorris.dat
  1 +# chucknorris: Chuck Norris fortunes
  2 +
  3 +# Automatically generate or update Chuck's compiled fortune data file
  4 +# $0 must be used outside a local function. This variable name is unlikly to collide.
  5 +CHUCKNORRIS_PLUGIN_DIR=${0:h}
  6 +
  7 +() {
  8 +local DIR=$CHUCKNORRIS_PLUGIN_DIR/fortunes
  9 +if [[ ! -f $DIR/chucknorris.dat ]] || [[ $DIR/chucknorris.dat -ot $DIR/chucknorris ]]; then
  10 + # For some reason, Cygwin puts strfile in /usr/sbin, which is not on the path by default
  11 + local strfile=strfile
  12 + if ! which strfile &>/dev/null && [[ -f /usr/sbin/strfile ]]; then
  13 + strfile=/usr/sbin/strfile
  14 + fi
  15 + if which $strfile &> /dev/null; then
  16 + $strfile $DIR/chucknorris $DIR/chucknorris.dat >/dev/null
  17 + else
  18 + echo "[oh-my-zsh] chucknorris depends on strfile, which is not installed" >&2
  19 + echo "[oh-my-zsh] strfile is often provided as part of the 'fortune' package" >&2
  20 + fi
3 21 fi
4 22  
5   -alias chuck="fortune -a $ZSH/plugins/chucknorris/fortunes"
  23 +# Aliases
  24 +alias chuck="fortune -a $DIR"
6 25 alias chuck_cow="chuck | cowthink"
  26 +}
  27 +
  28 +unset CHUCKNORRIS_PLUGIN_DIR
plugins/chucknorris/fortunes/chucknorris
... ... @@ -17,9 +17,11 @@ Chuck Norris&#39; blood type is AK+. Ass-Kicking Positive. It is compatible only wit
17 17 Chuck Norris is 1/8th Cherokee. This has nothing to do with ancestry, the man ate a fucking Indian.
18 18 %
19 19 In fine print on the last page of the Guinness Book of World Records it notes that all world records are held by Chuck Norris, and those listed in the book are simply the closest anyone else has ever gotten.
  20 +%
20 21 There is no chin behind Chuck Norris' beard. There is only another fist.
21 22 %
22 23 Chuck Norris does not teabag the ladies. He potato-sacks them.
  24 +%
23 25 Pluto is actually an orbiting group of British soldiers from the American Revolution who entered space after the Chuck gave them a roundhouse kick to the face.
24 26 %
25 27 When Chuck Norris goes to donate blood, he declines the syringe, and instead requests a hand gun and a bucket.
... ... @@ -127,6 +129,7 @@ Chuck Norris can drink an entire gallon of milk in thirty-seven seconds.
127 129 Little known medical fact: Chuck Norris invented the Caesarean section when he roundhouse-kicked his way out of his monther's womb.
128 130 %
129 131 Chuck Norris doesn't bowl strikes, he just knocks down one pin and the other nine faint.
  132 +%
130 133 The show Survivor had the original premise of putting people on an island with Chuck Norris. There were no survivors, and nobody is brave enough to go to the island to retrieve the footage.
131 134 %
132 135 It takes Chuck Norris 20 minutes to watch 60 Minutes.
... ... @@ -281,6 +284,7 @@ In a recent survey it was discovered the 94% of American women lost their virgin
281 284 Chuck Norris invented a language that incorporates karate and roundhouse kicks. So next time Chuck Norris is kicking your ass, don't be offended or hurt, he may be just trying to tell you he likes your hat.
282 285 %
283 286 If at first you don't succeed, you're not Chuck Norris.
  287 +%
284 288 If Chuck Norris were a calendar, every month would be named Chucktober, and every day he'd kick your ass.
285 289 %
286 290 Fear is not the only emotion Chuck Norris can smell. He can also detect hope, as in "I hope I don't get a roundhouse kick from Chuck Norris."
... ... @@ -349,7 +353,7 @@ As President Roosevelt said: &quot;We have nothing to fear but fear itself. And Chuck
349 353 %
350 354 Chuck Norris just says "no" to drugs. If he said "yes", it would collapse Colombia's infrastructure.
351 355 %
352   -Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent. 
  356 +Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent.?
353 357 %
354 358 Crime does not pay - unless you are an undertaker following Walker, Texas Ranger, on a routine patrol.
355 359 %
... ... @@ -497,7 +501,8 @@ When Chuck Norris works out on the Total Gym, the Total Gym feels like it&#39;s been
497 501 %
498 502 Chuck Norris can skeletize a cow in two minutes.
499 503 %
500   -The only sure things are Death and Taxes?and when Chuck Norris goes to work for the IRS, they'll be the same thing.
  504 +The only sure things are Death and Taxes, and when Chuck Norris goes to work for the IRS, they'll be the same thing.
  505 +%
501 506 Chuck Norris' first job was as a paperboy. There were no survivors.
502 507 %
503 508 With the rising cost of gasoline, Chuck Norris is beginning to worry about his drinking habit.
... ... @@ -528,8 +533,6 @@ Noah was the only man notified before Chuck Norris relieved himself in the Atlan
528 533 %
529 534 Chuck Norris once invited all of the other badasses from TV to duke it out in order to see who was the supreme badass. Only two showed up-- Jack Bauer and MacGyver.
530 535 %
531   -
532   -%
533 536 MacGyver immediately tried to make a bomb out of some Q-Tips and Gatorade, but Chuck Norris roundhouse-kicked him in the solar plexus. MacGyver promptly threw up his own heart.
534 537 %
535 538 Jack Bauer tried to use his detailed knowledge of torture techniques, but to no avail: Chuck Norris thrives on pain. Chuck Norris then ripped off Jack Bauer's arm and beat him to death with it. Game, set, match.
plugins/codeclimate/_codeclimate
... ... @@ -0,0 +1,82 @@
  1 +#compdef codeclimate
  2 +
  3 +_codeclimate_all_engines() {
  4 + engines_all=(`codeclimate engines:list | tail -n +2 | gawk '{ print $2 }' | gawk -F: '{ print $1 }'`)
  5 +}
  6 +
  7 +_codeclimate_installed_engines() {
  8 + _codeclimate_all_engines
  9 +
  10 + engines_installed=()
  11 +
  12 + if [ -e .codeclimate.yml ]
  13 + then
  14 + for engine in $engines_all
  15 + do
  16 + if grep -q $engine ".codeclimate.yml"
  17 + then
  18 + engines_installed+=$engine
  19 + fi
  20 + done
  21 + fi
  22 +}
  23 +
  24 +_codeclimate_not_installed_engines() {
  25 + _codeclimate_all_engines
  26 +
  27 + engines_not_installed=()
  28 +
  29 + if [ -e .codeclimate.yml ]
  30 + then
  31 + for engine in $engines_all
  32 + do
  33 + if ! grep -q $engine ".codeclimate.yml"
  34 + then
  35 + engines_not_installed+=$engine
  36 + fi
  37 + done
  38 + fi
  39 +}
  40 +
  41 +local curcontext="$curcontext" state line ret=1
  42 +local expl
  43 +local -a engines_all engines_installed engines_not_installed
  44 +
  45 +_arguments \
  46 + '1: :->cmds' \
  47 + '*:: :->args' && ret=0
  48 +
  49 +case $state in
  50 + cmds)
  51 + _values "bundle command" \
  52 + "analyze[Analyze all relevant files in the current working directory]" \
  53 + "console[Start an interactive session providing access to the classes within the CLI]" \
  54 + "engines\:disable[Prevents the engine from being used in this project]" \
  55 + "engines\:enable[This engine will be run the next time your project is analyzed]" \
  56 + "engines\:install[Compares the list of engines in your .codeclimate.yml file to those that are currently installed, then installs any missing engines]" \
  57 + "engines\:list[Lists all available engines in the Code Climate Docker Hub]" \
  58 + "engines\:remove[Removes an engine from your .codeclimate.yml file]" \
  59 + "help[Displays a list of commands that can be passed to the Code Climate CLI]" \
  60 + "init[Generates a new .codeclimate.yml file in the current working directory]" \
  61 + "validate-config[Validates the .codeclimate.yml file in the current working directory]" \
  62 + "version[Displays the current version of the Code Climate CLI]"
  63 + ret=0
  64 + ;;
  65 + args)
  66 + case $line[1] in
  67 + engines:enable)
  68 + _codeclimate_not_installed_engines
  69 + _wanted engines_not_installed expl 'not installed engines' compadd -a engines_not_installed ;;
  70 + engines:disable|engines:remove)
  71 + _codeclimate_installed_engines
  72 + _wanted engines_installed expl 'installed engines' compadd -a engines_installed ;;
  73 + analyze)
  74 + _arguments \
  75 + '-f:Output Format:(text json)'
  76 + ret=0
  77 + ;;
  78 + esac
  79 + ;;
  80 +esac
  81 +
  82 +return ret
plugins/coffee/README.md
... ... @@ -11,7 +11,7 @@ Preview the compiled result of your coffeescript with `cf &quot;code&quot;` as per the
11 11 following:
12 12  
13 13 ```zsh
14   -$ cf 'if a then be else c'
  14 +$ cf 'if a then b else c'
15 15 if (a) {
16 16 b;
17 17 } else {
plugins/coffee/coffee.plugin.zsh
... ... @@ -2,15 +2,15 @@
2 2  
3 3 # compile a string of coffeescript and print to output
4 4 cf () {
5   - coffee -peb $1
  5 + coffee -peb "$1"
6 6 }
7 7 # compile & copy to clipboard
8 8 cfc () {
9   - cf $1 | pbcopy
  9 + cf "$1" | clipcopy
10 10 }
11 11  
12   -# compile from pasteboard & print
13   -alias cfp='coffeeMe "$(pbpaste)"'
  12 +# compile from clipboard & print
  13 +alias cfp='coffeeMe "$(clippaste)"'
14 14  
15   -# compile from pasteboard and copy to clipboard
16   -alias cfpc='cfp | pbcopy'
  15 +# compile from clipboard and copy to clipboard
  16 +alias cfpc='cfp | clipcopy'
plugins/colored-man-pages/colored-man-pages.plugin.zsh
... ... @@ -0,0 +1,32 @@
  1 +if [ "$OSTYPE[0,7]" = "solaris" ]
  2 +then
  3 + if [ ! -x ${HOME}/bin/nroff ]
  4 + then
  5 + mkdir -p ${HOME}/bin
  6 + cat > ${HOME}/bin/nroff <<EOF
  7 +#!/bin/sh
  8 +if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then
  9 + shift
  10 + exec /usr/bin/nroff -u\${_NROFF_U} "\$@"
  11 +fi
  12 +#-- Some other invocation of nroff
  13 +exec /usr/bin/nroff "\$@"
  14 +EOF
  15 + chmod +x ${HOME}/bin/nroff
  16 + fi
  17 +fi
  18 +
  19 +man() {
  20 + env \
  21 + LESS_TERMCAP_mb=$(printf "\e[1;31m") \
  22 + LESS_TERMCAP_md=$(printf "\e[1;31m") \
  23 + LESS_TERMCAP_me=$(printf "\e[0m") \
  24 + LESS_TERMCAP_se=$(printf "\e[0m") \
  25 + LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
  26 + LESS_TERMCAP_ue=$(printf "\e[0m") \
  27 + LESS_TERMCAP_us=$(printf "\e[1;32m") \
  28 + PAGER=/usr/bin/less \
  29 + _NROFF_U=1 \
  30 + PATH=${HOME}/bin:${PATH} \
  31 + man "$@"
  32 +}
plugins/colored-man/colored-man.plugin.zsh
... ... @@ -1,32 +0,0 @@
1   -if [ "$OSTYPE[0,7]" = "solaris" ]
2   -then
3   - if [ ! -x ${HOME}/bin/nroff ]
4   - then
5   - mkdir -p ${HOME}/bin
6   - cat > ${HOME}/bin/nroff <<EOF
7   -#!/bin/sh
8   -if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then
9   - shift
10   - exec /usr/bin/nroff -u\${_NROFF_U} "\$@"
11   -fi
12   -#-- Some other invocation of nroff
13   -exec /usr/bin/nroff "\$@"
14   -EOF
15   - chmod +x ${HOME}/bin/nroff
16   - fi
17   -fi
18   -
19   -man() {
20   - env \
21   - LESS_TERMCAP_mb=$(printf "\e[1;31m") \
22   - LESS_TERMCAP_md=$(printf "\e[1;31m") \
23   - LESS_TERMCAP_me=$(printf "\e[0m") \
24   - LESS_TERMCAP_se=$(printf "\e[0m") \
25   - LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
26   - LESS_TERMCAP_ue=$(printf "\e[0m") \
27   - LESS_TERMCAP_us=$(printf "\e[1;32m") \
28   - PAGER=/usr/bin/less \
29   - _NROFF_U=1 \
30   - PATH=${HOME}/bin:${PATH} \
31   - man "$@"
32   -}
plugins/copydir/copydir.plugin.zsh
  1 +# Copies the pathname of the current directory to the system or X Windows clipboard
1 2 function copydir {
2   - pwd | tr -d "\r\n" | pbcopy
3   -}
4 3 \ No newline at end of file
  4 + emulate -L zsh
  5 + print -n $PWD | clipcopy
  6 +}
plugins/copyfile/copyfile.plugin.zsh
  1 +# Copies the contents of a given file to the system or X Windows clipboard
  2 +#
  3 +# copyfile <file>
1 4 function copyfile {
2   - [[ "$#" != 1 ]] && return 1
3   - local file_to_copy=$1
4   - cat $file_to_copy | pbcopy
  5 + emulate -L zsh
  6 + clipcopy $1
5 7 }
plugins/docker/_docker
... ... @@ -27,7 +27,7 @@ __docker_all_containers() {
27 27 # output a selectable list of all docker images
28 28 __docker_images() {
29 29 declare -a img_cmd
30   - img_cmd=($(docker images | awk 'NR>1{print $1}'))
  30 + img_cmd=($(docker images | awk 'NR>1{print $1}'| sed 's/:/\\:/g'))
31 31 _describe 'images' img_cmd
32 32 }
33 33  
plugins/ember-cli/README.md
1   -# Ember-cli
  1 +# Ember CLI
2 2  
3   -**Maintainer:** [BilalBudhani](http://www.github.com/BilalBudhani)
  3 +**Maintainers:** [BilalBudhani](http://www.github.com/BilalBudhani), [eubenesa](http://www.github.com/eubenesa)
4 4  
5   -Ember-cli (http://www.ember-cli.com/)
  5 +Ember CLI (http://www.ember-cli.com/)
6 6  
7 7 ### List of Aliases
8 8  
9   -alias es='ember serve'
10   -alias ea='ember addon'
11   -alias eb='ember build'
12   -alias ed='ember destroy'
13   -alias eg='ember generate'
14   -alias eh='ember help'
15   -alias ein='ember init'
16   -alias eia='ember install:addon'
17   -alias eib='ember install:bower'
18   -alias ein='ember install:npm'
19   -alias ei='ember install'
20   -alias et='ember test'
21   -alias eu='ember update'
22   -alias ev='ember version'
  9 + alias es='ember serve'
  10 + alias ea='ember addon'
  11 + alias eb='ember build'
  12 + alias ed='ember destroy'
  13 + alias eg='ember generate'
  14 + alias eh='ember help'
  15 + alias ein='ember init'
  16 + alias ei='ember install'
  17 + alias et='ember test'
  18 + alias eu='ember update'
  19 + alias ev='ember version'
plugins/ember-cli/ember-cli.plugin.zsh
1   -# Ember ClI
2   -# visit http://www.ember-cli.com/ to view user guid
  1 +# Ember CLI
  2 +# Visit http://www.ember-cli.com/ to view user guide
3 3  
4 4 alias es='ember serve'
5 5 alias ea='ember addon'
... ... @@ -8,9 +8,6 @@ alias ed=&#39;ember destroy&#39;
8 8 alias eg='ember generate'
9 9 alias eh='ember help'
10 10 alias ein='ember init'
11   -alias eia='ember install:addon'
12   -alias eib='ember install:bower'
13   -alias ein='ember install:npm'
14 11 alias ei='ember install'
15 12 alias et='ember test'
16 13 alias eu='ember update'
plugins/emoji/emoji-char-definitions.zsh
... ... @@ -7,8 +7,12 @@
7 7 # $emoji - which maps character names to Unicode characters
8 8 # $emoji_flags - maps country names to Unicode flag characters using region indicators
9 9  
  10 +# Main emoji
10 11 typeset -gAH emoji
  12 +# National flags
11 13 typeset -gAH emoji_flags
  14 +# Combining modifiers
  15 +typeset -gAH emoji_mod
12 16  
13 17 emoji[copyright_sign]=$'\U00A9'
14 18 emoji[registered_sign]=$'\U00AE'
... ... @@ -448,10 +452,15 @@ emoji[badminton_racquet_and_shuttlecock]=$&#39;\U1F3F8&#39;
448 452 emoji[bow_and_arrow]=$'\U1F3F9'
449 453 emoji[amphora]=$'\U1F3FA'
450 454 emoji[emoji_modifier_fitzpatrick_type_1_2]=$'\U1F3FB'
  455 +emoji_mod[emoji_modifier_fitzpatrick_type_1_2]=$'\U1F3FB'
451 456 emoji[emoji_modifier_fitzpatrick_type_3]=$'\U1F3FC'
  457 +emoji_mod[emoji_modifier_fitzpatrick_type_3]=$'\U1F3FC'
452 458 emoji[emoji_modifier_fitzpatrick_type_4]=$'\U1F3FD'
  459 +emoji_mod[emoji_modifier_fitzpatrick_type_4]=$'\U1F3FD'
453 460 emoji[emoji_modifier_fitzpatrick_type_5]=$'\U1F3FE'
  461 +emoji_mod[emoji_modifier_fitzpatrick_type_5]=$'\U1F3FE'
454 462 emoji[emoji_modifier_fitzpatrick_type_6]=$'\U1F3FF'
  463 +emoji_mod[emoji_modifier_fitzpatrick_type_6]=$'\U1F3FF'
455 464 emoji[rat]=$'\U1F400'
456 465 emoji[mouse]=$'\U1F401'
457 466 emoji[ox]=$'\U1F402'
plugins/emoji/emoji.plugin.zsh
... ... @@ -76,8 +76,6 @@ emoji_skintone[6]=$&#39;\U1F3FF&#39;
76 76 # These are stored in a single associative array, $emoji_groups, to avoid cluttering up the global
77 77 # namespace, and to allow adding additional group definitions at run time.
78 78 # The keys are the group names, and the values are whitespace-separated lists of emoji character names.
79   -#
80   -# These extra local arrays are used to allow more convenient formatting of the source code.
81 79  
82 80 emoji_groups[fruits]="
83 81 tomato
... ... @@ -255,9 +253,10 @@ function random_emoji() {
255 253 if [[ -z "$group" || "$group" == "all" ]]; then
256 254 names=(${(k)emoji})
257 255 else
258   - names=(${=emoji_groups[$group_name]})
  256 + names=(${=emoji_groups[$group]})
259 257 fi
260   - local list_size=$#names
  258 + local list_size=${#names}
  259 + [[ $list_size -eq 0 ]] && return 1
261 260 local random_index=$(( ( RANDOM % $list_size ) + 1 ))
262 261 local name=${names[$random_index]}
263 262 echo ${emoji[$name]}
plugins/emoji/update_emoji.pl
... ... @@ -88,7 +88,7 @@ typeset -gAH emoji_mod
88 88 }
89 89 # Modifiers are included in both the main set and their separate map,
90 90 # because they have a standalone representation as a color swatch.
91   - if ( $modifier_status == "modifier" ) {
  91 + if ( $modifier_status eq "modifier" ) {
92 92 $outfh->print("emoji_mod[$omz_name]=\$'$zsh_code'\n");
93 93 }
94 94 } else {
plugins/emotty/emotty.plugin.zsh
... ... @@ -0,0 +1,43 @@
  1 +# ------------------------------------------------------------------------------
  2 +# FILE: emotty.plugin.zsh
  3 +# DESCRIPTION: Return an emoji for the current $TTY number.
  4 +# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
  5 +# VERSION: 1.0.0
  6 +# DEPENDS: emoji plugin
  7 +#
  8 +# There are different sets of emoji characters available, to choose a different
  9 +# set export emotty_set to the name of the set you would like to use, e.g.:
  10 +# % export emotty_set=nature
  11 +# ------------------------------------------------------------------------------
  12 +
  13 +typeset -gAH _emotty_sets
  14 +local _emotty_plugin_dir="${0:h}"
  15 +source "$_emotty_plugin_dir/emotty_stellar_set.zsh"
  16 +source "$_emotty_plugin_dir/emotty_floral_set.zsh"
  17 +source "$_emotty_plugin_dir/emotty_zodiac_set.zsh"
  18 +source "$_emotty_plugin_dir/emotty_nature_set.zsh"
  19 +source "$_emotty_plugin_dir/emotty_emoji_set.zsh"
  20 +source "$_emotty_plugin_dir/emotty_love_set.zsh"
  21 +unset _emotty_plugin_dir
  22 +
  23 +emotty_default_set=emoji
  24 +
  25 +function emotty() {
  26 + # Use emotty set defined by user, fallback to default
  27 + local emotty=${_emotty_sets[${emotty_set:-$emotty_default_set}]}
  28 + # Parse $TTY number, normalizing it to an emotty set index
  29 + (( tty = (${TTY##/dev/ttys} % ${#${=emotty}}) + 1 ))
  30 + local character_name=${${=emotty}[tty]}
  31 + echo "${emoji[${character_name}]}${emoji2[emoji_style]}"
  32 +}
  33 +
  34 +function display_emotty() {
  35 + local name=$1
  36 + for i in ${=_emotty_sets[$name]}; do
  37 + printf "${emoji[$i]}${emoji2[emoji_style]} "
  38 + done
  39 + print
  40 + for i in ${=_emotty_sets[$name]}; do
  41 + print "${emoji[$i]}${emoji2[emoji_style]} = $i"
  42 + done
  43 +}
plugins/emotty/emotty_emoji_set.zsh
... ... @@ -0,0 +1,24 @@
  1 +#!/usr/bin/env zsh
  2 +# vim:ft=zsh ts=2 sw=2 sts=2
  3 +
  4 +_emotty_sets[emoji]="
  5 + crystal_ball
  6 + ghost
  7 + jack_o_lantern
  8 + see_no_evil_monkey
  9 + hear_no_evil_monkey
  10 + speak_no_evil_monkey
  11 + smiling_cat_face_with_open_mouth
  12 + extraterrestrial_alien
  13 + rocket
  14 + billiards
  15 + bomb
  16 + pill
  17 + japanese_symbol_for_beginner
  18 + direct_hit
  19 + cyclone
  20 + diamond_shape_with_a_dot_inside
  21 + sparkle
  22 + eight_spoked_asterisk
  23 + eight_pointed_black_star
  24 + "
plugins/emotty/emotty_floral_set.zsh
... ... @@ -0,0 +1,18 @@
  1 +#!/usr/bin/env zsh
  2 +# vim:ft=zsh ts=2 sw=2 sts=2
  3 +
  4 +_emotty_sets[floral]="
  5 + hibiscus
  6 + cherry_blossom
  7 + blossom
  8 + sunflower
  9 + bouquet
  10 + tulip
  11 + rose
  12 + four_leaf_clover
  13 + seedling
  14 + herb
  15 + palm_tree
  16 + evergreen_tree
  17 + deciduous_tree
  18 + "
plugins/emotty/emotty_love_set.zsh
... ... @@ -0,0 +1,34 @@
  1 +#!/usr/bin/env zsh
  2 +# vim:ft=zsh ts=2 sw=2 sts=2
  3 +
  4 +# Note: The heavy_black_heart emoji requires $emoji2[emoji_style]
  5 +# to be rendered as the emoji red heart.
  6 +_emotty_sets[love]="
  7 + green_heart
  8 + blue_heart
  9 + purple_heart
  10 + yellow_heart
  11 + heavy_black_heart
  12 + broken_heart
  13 + heart_with_arrow
  14 + heart_with_ribbon
  15 + sparkling_heart
  16 + two_hearts
  17 + revolving_hearts
  18 + growing_heart
  19 + beating_heart
  20 + heart_decoration
  21 + couple_with_heart
  22 + kiss
  23 + man_and_woman_holding_hands
  24 + two_women_holding_hands
  25 + two_men_holding_hands
  26 + kiss_mark
  27 + smiling_face_with_heart_shaped_eyes
  28 + kissing_face
  29 + face_throwing_a_kiss
  30 + kissing_face_with_smiling_eyes
  31 + kissing_face_with_closed_eyes
  32 + smiling_cat_face_with_heart_shaped_eyes
  33 + kissing_cat_face_with_closed_eyes
  34 + "
plugins/emotty/emotty_nature_set.zsh
... ... @@ -0,0 +1,58 @@
  1 +#!/usr/bin/env zsh
  2 +# vim:ft=zsh ts=2 sw=2 sts=2
  3 +
  4 +_emotty_sets[nature]="
  5 + mouse_face
  6 + hamster_face
  7 + rabbit_face
  8 + dog_face
  9 + cat_face
  10 + tiger_face
  11 + bear_face
  12 + monkey_face
  13 + koala
  14 + panda_face
  15 + chicken
  16 + baby_chick
  17 + bird
  18 + penguin
  19 + cow_face
  20 + pig_face
  21 + frog_face
  22 + boar
  23 + wolf_face
  24 + horse_face
  25 + snail
  26 + bug
  27 + ant
  28 + honeybee
  29 + lady_beetle
  30 + spouting_whale
  31 + dolphin
  32 + octopus
  33 + fish
  34 + tropical_fish
  35 + snake
  36 + turtle
  37 + lemon
  38 + tangerine
  39 + peach
  40 + mushroom
  41 + tomato
  42 + strawberry
  43 + red_apple
  44 + cherries
  45 + grapes
  46 + aubergine
  47 + watermelon
  48 + banana
  49 + pineapple
  50 + melon
  51 + pear
  52 + green_apple
  53 + ear_of_maize
  54 + sunflower
  55 + seedling
  56 + herb
  57 + four_leaf_clover
  58 + "
plugins/emotty/emotty_stellar_set.zsh
... ... @@ -0,0 +1,25 @@
  1 +#!/usr/bin/env zsh
  2 +# vim:ft=zsh ts=2 sw=2 sts=2
  3 +
  4 +# NOTE: The following emoji show as $'character' in the title
  5 +# white_medium_star
  6 +# sparkles
  7 +# dizzy_symbol
  8 +
  9 +_emotty_sets[stellar]="
  10 + full_moon_symbol
  11 + waning_gibbous_moon_symbol
  12 + waning_crescent_moon_symbol
  13 + last_quarter_moon_symbol
  14 + new_moon_symbol
  15 + new_moon_with_face
  16 + waxing_crescent_moon_symbol
  17 + first_quarter_moon_symbol
  18 + waxing_gibbous_moon_symbol
  19 + full_moon_with_face
  20 + sun_with_face
  21 + glowing_star
  22 + crescent_moon
  23 + first_quarter_moon_with_face
  24 + last_quarter_moon_with_face
  25 + "
plugins/emotty/emotty_zodiac_set.zsh
... ... @@ -0,0 +1,29 @@
  1 +#!/usr/bin/env zsh
  2 +# vim:ft=zsh ts=2 sw=2 sts=2
  3 +
  4 +_emotty_sets[zodiac]="
  5 + aries
  6 + taurus
  7 + gemini
  8 + cancer
  9 + leo
  10 + virgo
  11 + libra
  12 + scorpius
  13 + sagittarius
  14 + capricorn
  15 + aquarius
  16 + pisces
  17 + rat
  18 + ox
  19 + tiger
  20 + rabbit
  21 + dragon
  22 + snake
  23 + horse
  24 + goat
  25 + monkey
  26 + rooster
  27 + dog
  28 + pig
  29 + "
plugins/encode64/encode64.plugin.zsh
1   -encode64(){ echo -n $1 | base64 }
2   -decode64(){ echo -n $1 | base64 --decode }
  1 +encode64(){ printf '%s' $1 | base64 }
  2 +decode64(){ printf '%s' $1 | base64 --decode }
3 3 alias e64=encode64
4 4 alias d64=decode64
plugins/fancy-ctrl-z/README.md
... ... @@ -0,0 +1,14 @@
  1 +# Use Ctrl-Z to switch back to Vim
  2 +
  3 +I frequently need to execute random command in my shell. To achieve it I pause
  4 +Vim by pressing Ctrl-z, type command and press fg<Enter> to switch back to Vim.
  5 +The fg part really hurt sme. I just wanted to hit Ctrl-z once again to get back
  6 +to Vim. I could not find a solution, so I developed one on my own that
  7 +works wonderfully with ZSH
  8 +
  9 +Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/
  10 +
  11 +Credits:
  12 +- original idea by @sheerun
  13 +- added to OMZ by @mbologna
  14 +
plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh
... ... @@ -0,0 +1,12 @@
  1 +fancy-ctrl-z () {
  2 + if [[ $#BUFFER -eq 0 ]]; then
  3 + BUFFER="fg"
  4 + zle accept-line
  5 + else
  6 + zle push-input
  7 + zle clear-screen
  8 + fi
  9 +}
  10 +zle -N fancy-ctrl-z
  11 +bindkey '^Z' fancy-ctrl-z
  12 +
plugins/fedora/README.md
... ... @@ -0,0 +1,3 @@
  1 +This is a plugin based on yum plugin, but using dnf as main frontend
  2 +(from Fedora 22 onwards, yum is deprecated in favor of dnf).
  3 +
plugins/fedora/fedora.plugin.zsh
... ... @@ -0,0 +1,16 @@
  1 +## Aliases
  2 +
  3 +alias dnfs="dnf search" # search package
  4 +alias dnfp="dnf info" # show package info
  5 +alias dnfl="dnf list" # list packages
  6 +alias dnfgl="dnf grouplist" # list package groups
  7 +alias dnfli="dnf list installed" # print all installed packages
  8 +alias dnfmc="dnf makecache" # rebuilds the dnf package list
  9 +
  10 +alias dnfu="sudo dnf upgrade" # upgrade packages
  11 +alias dnfi="sudo dnf install" # install package
  12 +alias dnfgi="sudo dnf groupinstall" # install package group
  13 +alias dnfr="sudo dnf remove" # remove package
  14 +alias dnfgr="sudo dnf groupremove" # remove pagage group
  15 +alias dnfrl="sudo dnf remove --remove-leaves" # remove package and leaves
  16 +alias dnfc="sudo dnf clean all" # clean cache
plugins/frontend-search/README.md
1   -## Rationale ##
  1 +## Introduction ##
2 2  
3   -> Searches for your Frontend contents more easier
  3 +> Searches for your frontend web development made easier
4 4  
5 5  
6   -## Instalation ##
  6 +## Installation ##
7 7  
  8 +Open your `~/.zshrc` file and enable the `frontend-search` plugin:
8 9  
9   -Open your `.zshrc` file and load `frontend-search` plugin
  10 +```zsh
  11 +
  12 +plugins=( ... frontend-search)
10 13  
11   -```bash
12   -...
13   -plugins=( <your-plugins-list>... frontend-search)
14   -...
15 14 ```
16 15  
17 16  
18   -## Commands ##
19   -
20   -All command searches are accept only in format
21   -
22   -* `frontend <search-content> <search-term>`
23   -
24   -The search content are
25   -
26   -* `jquery <api.jquery.com>`
27   -* `mdn <developer.mozilla.org>`
28   -* `compass <compass-style.org>`
29   -* `html5please <html5please.com>`
30   -* `caniuse <caniuse.com>`
31   -* `aurajs <aurajs.com>`
32   -* `dartlang <api.dartlang.org/apidocs/channels/stable/dartdoc-viewer>`
33   -* `lodash <search>`
34   -* `qunit <api.qunitjs.com>`
35   -* `fontello <fontello.com>`
36   -* `bootsnipp <bootsnipp.com>`
37   -* `cssflow <cssflow.com>`
38   -* `codepen <codepen.io>`
39   -* `unheap <www.unheap.com>`
40   -* `bem <google.com/search?as_q=<search-term>&as_sitesearch=bem.info>`
41   -* `smacss <google.com/search?as_q=<search-term>&as_sitesearch=smacss.com>`
42   -* `angularjs <google.com/search?as_q=<search-term>&as_sitesearch=angularjs.org>`
43   -* `reactjs <google.com/search?as_q=<search-term>&as_sitesearch=facebook.github.io/react>`
44   -* `emberjs <emberjs.com>`
45   -* `stackoverflow <stackoverflow.com>`
46   -
47   -
48   -## Aliases ##
49   -
50   -There are a few aliases presented as well:
51   -
52   -* `jquery` A shorthand for `frontend jquery`
53   -* `mdn` A shorthand for `frontend mdn`
54   -* `compass` A shorthand for `frontend compass`
55   -* `html5please` A shorthand for `frontend html5please`
56   -* `caniuse` A shorthand for `frontend caniuse`
57   -* `aurajs` A shorthand for `frontend aurajs`
58   -* `dartlang` A shorthand for `frontend dartlang`
59   -* `lodash` A shorthand for `frontend lodash`
60   -* `qunit` A shorthand for `frontend qunit`
61   -* `fontello` A shorthand for `frontend fontello`
62   -* `bootsnipp` A shorthand for `frontend bootsnipp`
63   -* `cssflow` A shorthand for `frontend cssflow`
64   -* `codepen` A shorthand for `frontend codepen`
65   -* `unheap` A shorthand for `frontend unheap`
66   -* `bem` A shorthand for `frontend bem`
67   -* `smacss` A shorthand for `frontend smacss`
68   -* `angularjs` A shorthand for `frontend angularjs`
69   -* `reactjs` A shorthand for `frontend reactjs`
70   -* `emberjs` A shorthand for `frontend emberjs`
71   -* `stackoverflow` A shorthand for `frontend stackoverflow`
  17 +## Usage ##
  18 +
  19 +You can use the frontend-search plugin in these two forms:
  20 +
  21 +* `frontend <context> <term> [more terms if you want]`
  22 +* `<context> <term> [more terms if you want]`
  23 +
  24 +For example, these two are equivalent:
  25 +
  26 +```zsh
  27 +$ frontend angularjs dependency injection
  28 +$ angularjs dependency injection
  29 +```
  30 +
  31 +Available search contexts are:
  32 +
  33 +| context | URL |
  34 +|---------------|--------------------------------------------------------------------------|
  35 +| angularjs | `https://google.com/search?as_sitesearch=angularjs.org&as_q=` |
  36 +| aurajs | `http://aurajs.com/api/#stq=` |
  37 +| bem | `https://google.com/search?as_sitesearch=bem.info&as_q=` |
  38 +| bootsnipp | `http://bootsnipp.com/search?q=` |
  39 +| caniuse | `http://caniuse.com/#search=` |
  40 +| codepen | `http://codepen.io/search?q=` |
  41 +| compass | `http://compass-style.org/search?q=` |
  42 +| cssflow | `http://www.cssflow.com/search?q=` |
  43 +| dartlang | `https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:` |
  44 +| emberjs | `http://emberjs.com/api/#stp=1&stq=` |
  45 +| fontello | `http://fontello.com/#search=` |
  46 +| html5please | `http://html5please.com/#` |
  47 +| jquery | `https://api.jquery.com/?s=` |
  48 +| lodash | `https://devdocs.io/lodash/index#` |
  49 +| mdn | `https://developer.mozilla.org/search?q=` |
  50 +| npmjs | `https://www.npmjs.com/search?q=` |
  51 +| qunit | `https://api.qunitjs.com/?s=` |
  52 +| reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` |
  53 +| smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` |
  54 +| stackoverflow | `http://stackoverflow.com/search?q=` |
  55 +| unheap | `http://www.unheap.com/?s=` |
  56 +
  57 +If you want to have another context, open an Issue and tell us!
72 58  
73 59  
74 60 ## Author
... ... @@ -77,5 +63,3 @@ There are a few aliases presented as well:
77 63 + <https://plus.google.com/+WilsonMendes>
78 64 + <https://twitter.com/willmendesneto>
79 65 + <http://github.com/willmendesneto>
80   -
81   -New features comming soon.
plugins/frontend-search/_frontend-search.sh
... ... @@ -37,6 +37,7 @@ function _frontend() {
37 37 'reactjs: Search in React website'
38 38 'emberjs: Search in Ember website'
39 39 'stackoverflow: Search in StackOverflow website'
  40 + 'npmjs: Search in NPMJS website'
40 41 )
41 42  
42 43 _arguments -C \
... ... @@ -110,6 +111,9 @@ function _frontend() {
110 111 stackoverflow)
111 112 _describe -t points "Warp points" frontend_points && ret=0
112 113 ;;
  114 + npmjs)
  115 + _describe -t points "Warp points" frontend_points && ret=0
  116 + ;;
113 117 esac
114 118 ;;
115 119 esac
plugins/frontend-search/frontend-search.plugin.zsh
1   -# frontend from terminal
  1 +alias angularjs='frontend angularjs'
  2 +alias aurajs='frontend aurajs'
  3 +alias bem='frontend bem'
  4 +alias bootsnipp='frontend bootsnipp'
  5 +alias caniuse='frontend caniuse'
  6 +alias codepen='frontend codepen'
  7 +alias compass='frontend compass'
  8 +alias cssflow='frontend cssflow'
  9 +alias dartlang='frontend dartlang'
  10 +alias emberjs='frontend emberjs'
  11 +alias fontello='frontend fontello'
  12 +alias html5please='frontend html5please'
  13 +alias jquery='frontend jquery'
  14 +alias lodash='frontend lodash'
  15 +alias mdn='frontend mdn'
  16 +alias npmjs='frontend npmjs'
  17 +alias qunit='frontend qunit'
  18 +alias reactjs='frontend reactjs'
  19 +alias smacss='frontend smacss'
  20 +alias stackoverflow='frontend stackoverflow'
  21 +alias unheap='frontend unheap'
2 22  
3 23 function frontend() {
4   -
5   - # no keyword provided, simply show how call methods
6   - if [[ $# -le 1 ]]; then
7   - echo "Please provide a search-content and a search-term for app.\nEx:\nfrontend <search-content> <search-term>\n"
8   - return 1
  24 + emulate -L zsh
  25 +
  26 + # define search context URLS
  27 + typeset -A urls
  28 + urls=(
  29 + angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q='
  30 + aurajs 'http://aurajs.com/api/#stq='
  31 + bem 'https://google.com/search?as_sitesearch=bem.info&as_q='
  32 + bootsnipp 'http://bootsnipp.com/search?q='
  33 + caniuse 'http://caniuse.com/#search='
  34 + codepen 'http://codepen.io/search?q='
  35 + compass 'http://compass-style.org/search?q='
  36 + cssflow 'http://www.cssflow.com/search?q='
  37 + dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:'
  38 + emberjs 'http://emberjs.com/api/#stp=1&stq='
  39 + fontello 'http://fontello.com/#search='
  40 + html5please 'http://html5please.com/#'
  41 + jquery 'https://api.jquery.com/?s='
  42 + lodash 'https://devdocs.io/lodash/index#'
  43 + mdn 'https://developer.mozilla.org/search?q='
  44 + npmjs 'https://www.npmjs.com/search?q='
  45 + qunit 'https://api.qunitjs.com/?s='
  46 + reactjs 'https://google.com/search?as_sitesearch=facebook.github.io/react&as_q='
  47 + smacss 'https://google.com/search?as_sitesearch=smacss.com&as_q='
  48 + stackoverflow 'http://stackoverflow.com/search?q='
  49 + unheap 'http://www.unheap.com/?s='
  50 + )
  51 +
  52 + # show help for command list
  53 + if [[ $# -lt 2 ]]
  54 + then
  55 + print -P "Usage: frontend %Ucontext%u %Uterm%u [...%Umore%u] (or just: %Ucontext%u %Uterm%u [...%Umore%u])"
  56 + print -P ""
  57 + print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website,"
  58 + print -P "and %Ucontext%u is one of the following:"
  59 + print -P ""
  60 + print -P " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compass, cssflow,"
  61 + print -P " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs,"
  62 + print -P " qunit, reactjs, smacss, stackoverflow, unheap"
  63 + print -P ""
  64 + print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
  65 + print -P ""
  66 + return 1
9 67 fi
10 68  
11   - # check whether the search engine is supported
12   - if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs|stackoverflow)' ]];
  69 + # check whether the search context is supported
  70 + if [[ -z "$urls[$1]" ]]
13 71 then
14   - echo "Search valid search content $1 not supported."
15   - echo "Valid contents: (formats 'frontend <search-content>' or '<search-content>')"
16   - echo "* jquery"
17   - echo "* mdn"
18   - echo "* compass"
19   - echo "* html5please"
20   - echo "* caniuse"
21   - echo "* aurajs"
22   - echo "* dartlang"
23   - echo "* lodash"
24   - echo "* qunit"
25   - echo "* fontello"
26   - echo "* bootsnipp"
27   - echo "* cssflow"
28   - echo "* codepen"
29   - echo "* unheap"
30   - echo "* bem"
31   - echo "* smacss"
32   - echo "* angularjs"
33   - echo "* reactjs"
34   - echo "* emberjs"
35   - echo "* stackoverflow"
  72 + echo "Search context \"$1\" currently not supported."
  73 + echo ""
  74 + echo "Valid contexts are:"
  75 + echo ""
  76 + echo " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compass, cssflow, "
  77 + echo " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs, "
  78 + echo " qunit, reactjs, smacss, stackoverflow, unheap"
36 79 echo ""
37   -
38 80 return 1
39 81 fi
40 82  
41   - local url="http://"
42   - local query=""
  83 + # build search url:
  84 + # join arguments passed with '+', then append to search context URL
  85 + # TODO substitute for proper urlencode method
  86 + url="${urls[$1]}${(j:+:)@[2,-1]}"
43 87  
44   - case "$1" in
45   - "jquery")
46   - url="${url}api.jquery.com"
47   - url="${url}/?s=$2" ;;
48   - "mdn")
49   - url="${url}developer.mozilla.org"
50   - url="${url}/search?q=$2" ;;
51   - "compass")
52   - url="${url}compass-style.org"
53   - url="${url}/search?q=$2" ;;
54   - "html5please")
55   - url="${url}html5please.com"
56   - url="${url}/#$2" ;;
57   - "caniuse")
58   - url="${url}caniuse.com"
59   - url="${url}/#search=$2" ;;
60   - "aurajs")
61   - url="${url}aurajs.com"
62   - url="${url}/api/#stq=$2" ;;
63   - "dartlang")
64   - url="${url}api.dartlang.org/apidocs/channels/stable/dartdoc-viewer"
65   - url="${url}/dart-$2" ;;
66   - "qunit")
67   - url="${url}api.qunitjs.com"
68   - url="${url}/?s=$2" ;;
69   - "fontello")
70   - url="${url}fontello.com"
71   - url="${url}/#search=$2" ;;
72   - "bootsnipp")
73   - url="${url}bootsnipp.com"
74   - url="${url}/search?q=$2" ;;
75   - "cssflow")
76   - url="${url}cssflow.com"
77   - url="${url}/search?q=$2" ;;
78   - "codepen")
79   - url="${url}codepen.io"
80   - url="${url}/search?q=$2" ;;
81   - "unheap")
82   - url="${url}www.unheap.com"
83   - url="${url}/?s=$2" ;;
84   - "bem")
85   - url="${url}google.com"
86   - url="${url}/search?as_q=$2&as_sitesearch=bem.info" ;;
87   - "smacss")
88   - url="${url}google.com"
89   - url="${url}/search?as_q=$2&as_sitesearch=smacss.com" ;;
90   - "angularjs")
91   - url="${url}google.com"
92   - url="${url}/search?as_q=$2&as_sitesearch=angularjs.org" ;;
93   - "reactjs")
94   - url="${url}google.com"
95   - url="${url}/search?as_q=$2&as_sitesearch=facebook.github.io/react" ;;
96   - "emberjs")
97   - url="${url}emberjs.com"
98   - url="${url}/api/#stq=$2&stp=1" ;;
99   - "stackoverflow")
100   - url="${url}stackoverflow.com"
101   - url="${url}/search?q=$2" ;;
102   - *) echo "INVALID PARAM!"
103   - return ;;
104   - esac
105   -
106   - echo "$url"
  88 + echo "Opening $url ..."
107 89  
108 90 open_command "$url"
109   -
110 91 }
111   -
112   -# javascript
113   -alias jquery='frontend jquery'
114   -alias mdn='frontend mdn'
115   -
116   -# pre processors frameworks
117   -alias compassdoc='frontend compass'
118   -
119   -# important links
120   -alias html5please='frontend html5please'
121   -alias caniuse='frontend caniuse'
122   -
123   -# components and libraries
124   -alias aurajs='frontend aurajs'
125   -alias dartlang='frontend dartlang'
126   -alias lodash='frontend lodash'
127   -
128   -#tests
129   -alias qunit='frontend qunit'
130   -
131   -#fonts
132   -alias fontello='frontend fontello'
133   -
134   -# snippets
135   -alias bootsnipp='frontend bootsnipp'
136   -alias cssflow='frontend cssflow'
137   -alias codepen='frontend codepen'
138   -alias unheap='frontend unheap'
139   -
140   -# css architecture
141   -alias bem='frontend bem'
142   -alias smacss='frontend smacss'
143   -
144   -# frameworks
145   -alias angularjs='frontend angularjs'
146   -alias reactjs='frontend reactjs'
147   -alias emberjs='frontend emberjs'
148   -
149   -# search websites
150   -alias stackoverflow='frontend stackoverflow'
plugins/git-extras/README.md
... ... @@ -0,0 +1,11 @@
  1 +# git-extras
  2 +
  3 +This plugin provides completion definitions for some of the commands defined by [git-extras](http://github.com/tj/git-extras).
  4 +
  5 +## Setup notes
  6 +
  7 +The completions work by augmenting the `_git` completion provided by `zsh`. This only works with the `zsh`-provided `_git`, not the `_git` provided by `git` itself. If you have both `zsh` and `git` installed, you need to make sure that the `zsh`-provided `_git` takes precedence.
  8 +
  9 +### OS X Homebrew Setup
  10 +
  11 +On OS X with Homebrew, you need to install `git` with `brew install git --without-completions`. Otherwise, `git`'s `_git` will take precedence, and you won't see the completions for `git-extras` commands.
plugins/git-extras/git-extras.plugin.zsh
1   -#compdef git
2 1 # ------------------------------------------------------------------------------
3 2 # Description
4 3 # -----------
5 4 #
6   -# Completion script for git-extras (http://github.com/visionmedia/git-extras).
  5 +# Completion script for git-extras (http://github.com/tj/git-extras).
  6 +#
  7 +# This depends on and reueses some of the internals of the _git completion
  8 +# function that ships with zsh itself. It will not work with the _git that ships
  9 +# with git.
7 10 #
8 11 # ------------------------------------------------------------------------------
9 12 # Authors
10 13 # -------
11 14 #
12 15 # * Alexis GRIMALDI (https://github.com/agrimaldi)
  16 +# * spacewander (https://github.com/spacewander)
13 17 #
14 18 # ------------------------------------------------------------------------------
15 19 # Inspirations
16 20 # -----------
17 21 #
18   -# * git-extras (http://github.com/visionmedia/git-extras)
  22 +# * git-extras (http://github.com/tj/git-extras)
19 23 # * git-flow-completion (http://github.com/bobthecow/git-flow-completion)
20 24 #
21 25 # ------------------------------------------------------------------------------
22 26  
23 27  
24   -__git_command_successful () {
25   - if (( ${#pipestatus:#0} > 0 )); then
26   - _message 'not a git repository'
27   - return 1
28   - fi
29   - return 0
  28 +# Internal functions
  29 +# These are a lot like their __git_* equivalents inside _git
  30 +
  31 +__gitex_command_successful () {
  32 + if (( ${#*:#0} > 0 )); then
  33 + _message 'not a git repository'
  34 + return 1
  35 + fi
  36 + return 0
30 37 }
31 38  
  39 +__gitex_commits() {
  40 + declare -A commits
  41 + git log --oneline -15 | sed 's/\([[:alnum:]]\{7\}\) /\1:/' | while read commit
  42 + do
  43 + hash=$(echo $commit | cut -d':' -f1)
  44 + commits[$hash]="$commit"
  45 + done
  46 + local ret=1
  47 + _describe -t commits commit commits && ret=0
  48 +}
32 49  
33   -__git_tag_names() {
  50 +__gitex_tag_names() {
34 51 local expl
35 52 declare -a tag_names
36   - tag_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
  53 + tag_names=(${${(f)"$(_call_program tags git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
37 54 __git_command_successful || return
38 55 _wanted tag-names expl tag-name compadd $* - $tag_names
39 56 }
40 57  
41 58  
42   -__git_branch_names() {
  59 +__gitex_branch_names() {
43 60 local expl
44 61 declare -a branch_names
45 62 branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
... ... @@ -47,44 +64,36 @@ __git_branch_names() {
47 64 _wanted branch-names expl branch-name compadd $* - $branch_names
48 65 }
49 66  
50   -
51   -__git_feature_branch_names() {
  67 +__gitex_specific_branch_names() {
52 68 local expl
53 69 declare -a branch_names
54   - branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/feature 2>/dev/null)"}#refs/heads/feature/})
  70 + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/})
55 71 __git_command_successful || return
56 72 _wanted branch-names expl branch-name compadd $* - $branch_names
57 73 }
58 74  
59   -
60   -__git_refactor_branch_names() {
61   - local expl
62   - declare -a branch_names
63   - branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/refactor 2>/dev/null)"}#refs/heads/refactor/})
64   - __git_command_successful || return
65   - _wanted branch-names expl branch-name compadd $* - $branch_names
  75 +__gitex_feature_branch_names() {
  76 + __gitex_specific_branch_names 'feature'
66 77 }
67 78  
68   -
69   -__git_bug_branch_names() {
70   - local expl
71   - declare -a branch_names
72   - branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/bug 2>/dev/null)"}#refs/heads/bug/})
73   - __git_command_successful || return
74   - _wanted branch-names expl branch-name compadd $* - $branch_names
  79 +__gitex_refactor_branch_names() {
  80 + __gitex_specific_branch_names 'refactor'
75 81 }
76 82  
  83 +__gitex_bug_branch_names() {
  84 + __gitex_specific_branch_names 'bug'
  85 +}
77 86  
78   -__git_submodule_names() {
  87 +__gitex_submodule_names() {
79 88 local expl
80 89 declare -a submodule_names
81   - submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"})
  90 + submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"}) # '
82 91 __git_command_successful || return
83 92 _wanted submodule-names expl submodule-name compadd $* - $submodule_names
84 93 }
85 94  
86 95  
87   -__git_author_names() {
  96 +__gitex_author_names() {
88 97 local expl
89 98 declare -a author_names
90 99 author_names=(${(f)"$(_call_program branchrefs git log --format='%aN' | sort -u)"})
... ... @@ -92,22 +101,46 @@ __git_author_names() {
92 101 _wanted author-names expl author-name compadd $* - $author_names
93 102 }
94 103  
  104 +# subcommands
95 105  
96   -_git-changelog() {
97   - _arguments \
98   - '(-l --list)'{-l,--list}'[list commits]' \
  106 +_git-bug() {
  107 + local curcontext=$curcontext state line ret=1
  108 + declare -A opt_args
  109 +
  110 + _arguments -C \
  111 + ': :->command' \
  112 + '*:: :->option-or-argument' && ret=0
  113 +
  114 + case $state in
  115 + (command)
  116 + declare -a commands
  117 + commands=(
  118 + 'finish:merge bug into the current branch'
  119 + )
  120 + _describe -t commands command commands && ret=0
  121 + ;;
  122 + (option-or-argument)
  123 + curcontext=${curcontext%:*}-$line[1]:
  124 + case $line[1] in
  125 + (finish)
  126 + _arguments -C \
  127 + ':branch-name:__gitex_bug_branch_names'
  128 + ;;
  129 + esac
  130 + esac
99 131 }
100 132  
101 133  
102   -_git-effort() {
  134 +_git-changelog() {
103 135 _arguments \
104   - '--above[ignore file with less than x commits]' \
  136 + '(-l --list)'{-l,--list}'[list commits]' \
105 137 }
106 138  
107 139  
  140 +
108 141 _git-contrib() {
109 142 _arguments \
110   - ':author:__git_author_names'
  143 + ':author:__gitex_author_names'
111 144 }
112 145  
113 146  
... ... @@ -119,19 +152,25 @@ _git-count() {
119 152  
120 153 _git-delete-branch() {
121 154 _arguments \
122   - ':branch-name:__git_branch_names'
  155 + ':branch-name:__gitex_branch_names'
123 156 }
124 157  
125 158  
126 159 _git-delete-submodule() {
127 160 _arguments \
128   - ':submodule-name:__git_submodule_names'
  161 + ':submodule-name:__gitex_submodule_names'
129 162 }
130 163  
131 164  
132 165 _git-delete-tag() {
133 166 _arguments \
134   - ':tag-name:__git_tag_names'
  167 + ':tag-name:__gitex_tag_names'
  168 +}
  169 +
  170 +
  171 +_git-effort() {
  172 + _arguments \
  173 + '--above[ignore file with less than x commits]'
135 174 }
136 175  
137 176  
... ... @@ -154,20 +193,7 @@ _git-extras() {
154 193 esac
155 194  
156 195 _arguments \
157   - '(-v --version)'{-v,--version}'[show current version]' \
158   -}
159   -
160   -
161   -_git-graft() {
162   - _arguments \
163   - ':src-branch-name:__git_branch_names' \
164   - ':dest-branch-name:__git_branch_names'
165   -}
166   -
167   -
168   -_git-squash() {
169   - _arguments \
170   - ':branch-name:__git_branch_names'
  196 + '(-v --version)'{-v,--version}'[show current version]'
171 197 }
172 198  
173 199  
... ... @@ -192,13 +218,34 @@ _git-feature() {
192 218 case $line[1] in
193 219 (finish)
194 220 _arguments -C \
195   - ':branch-name:__git_feature_branch_names'
  221 + ':branch-name:__gitex_feature_branch_names'
196 222 ;;
197 223 esac
198 224 esac
199 225 }
200 226  
201 227  
  228 +_git-graft() {
  229 + _arguments \
  230 + ':src-branch-name:__gitex_branch_names' \
  231 + ':dest-branch-name:__gitex_branch_names'
  232 +}
  233 +
  234 +
  235 +_git-ignore() {
  236 + _arguments -C \
  237 + '(--local -l)'{--local,-l}'[show local gitignore]' \
  238 + '(--global -g)'{--global,-g}'[show global gitignore]'
  239 +}
  240 +
  241 +
  242 +_git-missing() {
  243 + _arguments \
  244 + ':first-branch-name:__gitex_branch_names' \
  245 + ':second-branch-name:__gitex_branch_names'
  246 +}
  247 +
  248 +
202 249 _git-refactor() {
203 250 local curcontext=$curcontext state line ret=1
204 251 declare -A opt_args
... ... @@ -220,66 +267,69 @@ _git-refactor() {
220 267 case $line[1] in
221 268 (finish)
222 269 _arguments -C \
223   - ':branch-name:__git_refactor_branch_names'
  270 + ':branch-name:__gitex_refactor_branch_names'
224 271 ;;
225 272 esac
226 273 esac
227 274 }
228 275  
229 276  
230   -_git-bug() {
231   - local curcontext=$curcontext state line ret=1
232   - declare -A opt_args
233   -
234   - _arguments -C \
235   - ': :->command' \
236   - '*:: :->option-or-argument' && ret=0
  277 +_git-squash() {
  278 + _arguments \
  279 + ':branch-name:__gitex_branch_names'
  280 +}
237 281  
238   - case $state in
239   - (command)
240   - declare -a commands
241   - commands=(
242   - 'finish:merge bug into the current branch'
243   - )
244   - _describe -t commands command commands && ret=0
245   - ;;
246   - (option-or-argument)
247   - curcontext=${curcontext%:*}-$line[1]:
248   - case $line[1] in
249   - (finish)
250   - _arguments -C \
251   - ':branch-name:__git_bug_branch_names'
252   - ;;
253   - esac
254   - esac
  282 +_git-summary() {
  283 + _arguments '--line[summarize with lines rather than commits]'
  284 + __gitex_commits
255 285 }
256 286  
257 287  
  288 +_git-undo(){
  289 + _arguments -C \
  290 + '(--soft -s)'{--soft,-s}'[only rolls back the commit but changes remain un-staged]' \
  291 + '(--hard -h)'{--hard,-h}'[wipes your commit(s)]'
  292 +}
  293 +
258 294 zstyle ':completion:*:*:git:*' user-commands \
  295 + alias:'define, search and show aliases' \
  296 + archive-file:'export the current HEAD of the git repository to a archive' \
  297 + back:'undo and stage latest commits' \
  298 + bug:'create a bug branch' \
259 299 changelog:'populate changelog file with commits since the previous tag' \
  300 + commits-since:'list commits since a given date' \
260 301 contrib:'display author contributions' \
261 302 count:'count commits' \
  303 + create-branch:'create local and remote branch' \
262 304 delete-branch:'delete local and remote branch' \
  305 + delete-merged-branches:'delete merged branches'\
263 306 delete-submodule:'delete submodule' \
264 307 delete-tag:'delete local and remote tag' \
  308 + effort:'display effort statistics' \
265 309 extras:'git-extras' \
266   - graft:'merge commits from source branch to destination branch' \
267   - squash:'merge commits from source branch into the current one as a single commit' \
268 310 feature:'create a feature branch' \
269   - refactor:'create a refactor branch' \
270   - bug:'create a bug branch' \
271   - summary:'repository summary' \
272   - effort:'display effort statistics' \
273   - repl:'read-eval-print-loop' \
274   - commits-since:'list commits since a given date' \
275   - release:'release commit with the given tag' \
276   - alias:'define, search and show aliases' \
  311 + fork:'fork a repo on github' \
  312 + fresh-branch:'create empty local branch' \
  313 + gh-pages:'create the GitHub Pages branch' \
  314 + graft:'merge commits from source branch to destination branch' \
277 315 ignore:'add patterns to .gitignore' \
278 316 info:'show info about the repository' \
279   - create-branch:'create local and remote branch' \
280   - fresh-branch:'create empty local branch' \
281   - undo:'remove the latest commit' \
  317 + local-commits:'list unpushed commits on the local branch' \
  318 + lock:'lock a file excluded from version control' \
  319 + locked:'ls files that have been locked' \
  320 + missing:'show commits missing from another branch' \
  321 + pr:'checks out a pull request locally' \
  322 + rebase-patch:'rebases a patch' \
  323 + refactor:'create a refactor branch' \
  324 + release:'commit, tag and push changes to the repository' \
  325 + rename-tag:'rename a tag' \
  326 + repl:'read-eval-print-loop' \
  327 + reset-file:'reset one file' \
  328 + root:'show path of root' \
282 329 setup:'setup a git repository' \
  330 + show-tree:'show branch tree of commit history' \
  331 + squash:'merge commits from source branch into the current one as a single commit' \
  332 + summary:'repository summary' \
283 333 touch:'one step creation of new files' \
284   - obliterate:'Completely remove a file from the repository, including past commits and tags' \
285   - local-commits:'list unpushed commits on the local branch' \
  334 + undo:'remove the latest commit' \
  335 + unlock:'unlock a file excluded from version control'
plugins/git-flow/git-flow.plugin.zsh
... ... @@ -21,7 +21,7 @@
21 21 #
22 22  
23 23 #Alias
24   -alias gf='git flow'
  24 +alias gfl='git flow'
25 25 alias gcd='git checkout develop'
26 26 alias gch='git checkout hotfix'
27 27 alias gcr='git checkout release'
plugins/git-hubflow/git-hubflow.plugin.zsh
... ... @@ -20,6 +20,13 @@
20 20 # c. Or, use this file as an oh-my-zsh plugin.
21 21 #
22 22  
  23 +alias ghf='git hf'
  24 +alias ghff='git hf feature'
  25 +alias ghfr='git hf release'
  26 +alias ghfh='git hf hotfix'
  27 +alias ghfs='git hf support'
  28 +alias ghfu='git hf update'
  29 +
23 30 _git-hf ()
24 31 {
25 32 local curcontext="$curcontext" state line
plugins/git-prompt/git-prompt.plugin.zsh
1 1 # ZSH Git Prompt Plugin from:
2 2 # http://github.com/olivierverdier/zsh-git-prompt
3   -#
4   -export __GIT_PROMPT_DIR=$ZSH/plugins/git-prompt
5 3  
6   -# Allow for functions in the prompt.
7   -setopt PROMPT_SUBST
  4 +__GIT_PROMPT_DIR="${0:A:h}"
8 5  
9   -## Enable auto-execution of functions.
10   -typeset -ga preexec_functions
11   -typeset -ga precmd_functions
12   -typeset -ga chpwd_functions
13   -
14   -# Append git functions needed for prompt.
15   -preexec_functions+='preexec_update_git_vars'
16   -precmd_functions+='precmd_update_git_vars'
17   -chpwd_functions+='chpwd_update_git_vars'
  6 +## Hook function definitions
  7 +function chpwd_update_git_vars() {
  8 + update_current_git_vars
  9 +}
18 10  
19   -## Function definitions
20 11 function preexec_update_git_vars() {
21 12 case "$2" in
22   - git*)
  13 + git*|hub*|gh*|stg*)
23 14 __EXECUTED_GIT_COMMAND=1
24 15 ;;
25 16 esac
26 17 }
27 18  
28 19 function precmd_update_git_vars() {
29   - if [ -n "$__EXECUTED_GIT_COMMAND" ]; then
  20 + if [ -n "$__EXECUTED_GIT_COMMAND" ] || [ ! -n "$ZSH_THEME_GIT_PROMPT_CACHE" ]; then
30 21 update_current_git_vars
31 22 unset __EXECUTED_GIT_COMMAND
32 23 fi
33 24 }
34 25  
35   -function chpwd_update_git_vars() {
36   - update_current_git_vars
37   -}
  26 +chpwd_functions+=(chpwd_update_git_vars)
  27 +precmd_functions+=(precmd_update_git_vars)
  28 +preexec_functions+=(preexec_update_git_vars)
  29 +
38 30  
  31 +## Function definitions
39 32 function update_current_git_vars() {
40 33 unset __CURRENT_GIT_STATUS
41 34  
42 35 local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py"
43   - _GIT_STATUS=`python ${gitstatus}`
44   - __CURRENT_GIT_STATUS=("${(f)_GIT_STATUS}")
  36 + _GIT_STATUS=$(python ${gitstatus} 2>/dev/null)
  37 + __CURRENT_GIT_STATUS=("${(@s: :)_GIT_STATUS}")
  38 + GIT_BRANCH=$__CURRENT_GIT_STATUS[1]
  39 + GIT_AHEAD=$__CURRENT_GIT_STATUS[2]
  40 + GIT_BEHIND=$__CURRENT_GIT_STATUS[3]
  41 + GIT_STAGED=$__CURRENT_GIT_STATUS[4]
  42 + GIT_CONFLICTS=$__CURRENT_GIT_STATUS[5]
  43 + GIT_CHANGED=$__CURRENT_GIT_STATUS[6]
  44 + GIT_UNTRACKED=$__CURRENT_GIT_STATUS[7]
45 45 }
46 46  
47   -function prompt_git_info() {
  47 +git_super_status() {
  48 + precmd_update_git_vars
48 49 if [ -n "$__CURRENT_GIT_STATUS" ]; then
49   - echo "(%{${fg[red]}%}$__CURRENT_GIT_STATUS[1]%{${fg[default]}%}$__CURRENT_GIT_STATUS[2]%{${fg[magenta]}%}$__CURRENT_GIT_STATUS[3]%{${fg[default]}%})"
  50 + STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}"
  51 + if [ "$GIT_BEHIND" -ne "0" ]; then
  52 + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND$GIT_BEHIND%{${reset_color}%}"
  53 + fi
  54 + if [ "$GIT_AHEAD" -ne "0" ]; then
  55 + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD$GIT_AHEAD%{${reset_color}%}"
  56 + fi
  57 + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR"
  58 + if [ "$GIT_STAGED" -ne "0" ]; then
  59 + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED$GIT_STAGED%{${reset_color}%}"
  60 + fi
  61 + if [ "$GIT_CONFLICTS" -ne "0" ]; then
  62 + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CONFLICTS$GIT_CONFLICTS%{${reset_color}%}"
  63 + fi
  64 + if [ "$GIT_CHANGED" -ne "0" ]; then
  65 + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}"
  66 + fi
  67 + if [ "$GIT_UNTRACKED" -ne "0" ]; then
  68 + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED%{${reset_color}%}"
  69 + fi
  70 + if [ "$GIT_CHANGED" -eq "0" ] && [ "$GIT_CONFLICTS" -eq "0" ] && [ "$GIT_STAGED" -eq "0" ] && [ "$GIT_UNTRACKED" -eq "0" ]; then
  71 + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
  72 + fi
  73 + STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
  74 + echo "$STATUS"
50 75 fi
51 76 }
52 77  
  78 +# Default values for the appearance of the prompt.
  79 +ZSH_THEME_GIT_PROMPT_PREFIX="("
  80 +ZSH_THEME_GIT_PROMPT_SUFFIX=")"
  81 +ZSH_THEME_GIT_PROMPT_SEPARATOR="|"
  82 +ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}"
  83 +ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}%{●%G%}"
  84 +ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{✖%G%}"
  85 +ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}%{✚%G%}"
  86 +ZSH_THEME_GIT_PROMPT_BEHIND="%{↓%G%}"
  87 +ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%G%}"
  88 +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{…%G%}"
  89 +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%G%}"
  90 +
53 91 # Set the prompt.
54   -#PROMPT='%B%m%~%b$(prompt_git_info) %# '
55   -# for a right prompt:
56   -#RPROMPT='%b$(prompt_git_info)'
57   -RPROMPT='$(prompt_git_info)'
  92 +RPROMPT='$(git_super_status)'
plugins/git-prompt/gitstatus.py
1 1 #!/usr/bin/env python
2   -# -*- coding: UTF-8 -*-
3   -from subprocess import Popen, PIPE
4   -import re
  2 +from __future__ import print_function
5 3  
6   -# change those symbols to whatever you prefer
7   -symbols = {
8   - 'ahead of': '↑',
9   - 'behind': '↓',
10   - 'staged': '♦',
11   - 'changed': '‣',
12   - 'untracked': '…',
13   - 'clean': '⚡',
14   - 'unmerged': '≠',
15   - 'sha1': ':'
16   -}
  4 +import sys
  5 +import re
  6 +import shlex
  7 +from subprocess import Popen, PIPE, check_output
17 8  
18   -output, error = Popen(
19   - ['git', 'status'], stdout=PIPE, stderr=PIPE, universal_newlines=True).communicate()
20 9  
21   -if error:
22   - import sys
23   - sys.exit(0)
24   -lines = output.splitlines()
  10 +def get_tagname_or_hash():
  11 + """return tagname if exists else hash"""
  12 + cmd = 'git log -1 --format="%h%d"'
  13 + output = check_output(shlex.split(cmd)).decode('utf-8').strip()
  14 + hash_, tagname = None, None
  15 + # get hash
  16 + m = re.search('\(.*\)$', output)
  17 + if m:
  18 + hash_ = output[:m.start()-1]
  19 + # get tagname
  20 + m = re.search('tag: .*[,\)]', output)
  21 + if m:
  22 + tagname = 'tags/' + output[m.start()+len('tag: '): m.end()-1]
25 23  
26   -behead_re = re.compile(
27   - r"^# Your branch is (ahead of|behind) '(.*)' by (\d+) commit")
28   -diverge_re = re.compile(r"^# and have (\d+) and (\d+) different")
  24 + if tagname:
  25 + return tagname
  26 + elif hash_:
  27 + return hash_
  28 + return None
29 29  
30   -status = ''
31   -staged = re.compile(r'^# Changes to be committed:$', re.MULTILINE)
32   -changed = re.compile(r'^# Changed but not updated:$', re.MULTILINE)
33   -untracked = re.compile(r'^# Untracked files:$', re.MULTILINE)
34   -unmerged = re.compile(r'^# Unmerged paths:$', re.MULTILINE)
35 30  
  31 +# `git status --porcelain --branch` can collect all information
  32 +# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
  33 +po = Popen(['git', 'status', '--porcelain', '--branch'], stdout=PIPE, stderr=PIPE)
  34 +stdout, sterr = po.communicate()
  35 +if po.returncode != 0:
  36 + sys.exit(0) # Not a git repository
36 37  
37   -def execute(*command):
38   - out, err = Popen(stdout=PIPE, stderr=PIPE, *command).communicate()
39   - if not err:
40   - nb = len(out.splitlines())
  38 +# collect git status information
  39 +untracked, staged, changed, conflicts = [], [], [], []
  40 +ahead, behind = 0, 0
  41 +status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()]
  42 +for st in status:
  43 + if st[0] == '#' and st[1] == '#':
  44 + if re.search('Initial commit on', st[2]):
  45 + branch = st[2].split(' ')[-1]
  46 + elif re.search('no branch', st[2]): # detached status
  47 + branch = get_tagname_or_hash()
  48 + elif len(st[2].strip().split('...')) == 1:
  49 + branch = st[2].strip()
  50 + else:
  51 + # current and remote branch info
  52 + branch, rest = st[2].strip().split('...')
  53 + if len(rest.split(' ')) == 1:
  54 + # remote_branch = rest.split(' ')[0]
  55 + pass
  56 + else:
  57 + # ahead or behind
  58 + divergence = ' '.join(rest.split(' ')[1:])
  59 + divergence = divergence.lstrip('[').rstrip(']')
  60 + for div in divergence.split(', '):
  61 + if 'ahead' in div:
  62 + ahead = int(div[len('ahead '):].strip())
  63 + elif 'behind' in div:
  64 + behind = int(div[len('behind '):].strip())
  65 + elif st[0] == '?' and st[1] == '?':
  66 + untracked.append(st)
41 67 else:
42   - nb = '?'
43   - return nb
44   -
45   -if staged.search(output):
46   - nb = execute(
47   - ['git', 'diff', '--staged', '--name-only', '--diff-filter=ACDMRT'])
48   - status += '%s%s' % (symbols['staged'], nb)
49   -if unmerged.search(output):
50   - nb = execute(['git', 'diff', '--staged', '--name-only', '--diff-filter=U'])
51   - status += '%s%s' % (symbols['unmerged'], nb)
52   -if changed.search(output):
53   - nb = execute(['git', 'diff', '--name-only', '--diff-filter=ACDMRT'])
54   - status += '%s%s' % (symbols['changed'], nb)
55   -if untracked.search(output):
56   - status += symbols['untracked']
57   -if status == '':
58   - status = symbols['clean']
59   -
60   -remote = ''
61   -
62   -bline = lines[0]
63   -if bline.find('Not currently on any branch') != -1:
64   - branch = symbols['sha1'] + Popen([
65   - 'git',
66   - 'rev-parse',
67   - '--short',
68   - 'HEAD'], stdout=PIPE).communicate()[0][:-1]
69   -else:
70   - branch = bline.split(' ')[-1]
71   - bstatusline = lines[1]
72   - match = behead_re.match(bstatusline)
73   - if match:
74   - remote = symbols[match.groups()[0]]
75   - remote += match.groups()[2]
76   - elif lines[2:]:
77   - div_match = diverge_re.match(lines[2])
78   - if div_match:
79   - remote = "{behind}{1}{ahead of}{0}".format(
80   - *div_match.groups(), **symbols)
  68 + if st[1] == 'M':
  69 + changed.append(st)
  70 + if st[0] == 'U':
  71 + conflicts.append(st)
  72 + elif st[0] != ' ':
  73 + staged.append(st)
81 74  
82   -print('\n'.join([branch, remote, status]))
  75 +out = ' '.join([
  76 + branch,
  77 + str(ahead),
  78 + str(behind),
  79 + str(len(staged)),
  80 + str(len(conflicts)),
  81 + str(len(changed)),
  82 + str(len(untracked)),
  83 +])
  84 +print(out, end='')
plugins/git/git.plugin.zsh
... ... @@ -68,10 +68,12 @@ alias gc!=&#39;git commit -v --amend&#39;
68 68 alias gca='git commit -v -a'
69 69 alias gca!='git commit -v -a --amend'
70 70 alias gcan!='git commit -v -a -s --no-edit --amend'
  71 +alias gcam='git commit -a -m'
71 72 alias gcb='git checkout -b'
72 73 alias gcf='git config --list'
73 74 alias gcl='git clone --recursive'
74   -alias gclean='git reset --hard && git clean -dfx'
  75 +alias gclean='git clean -fd'
  76 +alias gpristine='git reset --hard && git clean -dfx'
75 77 alias gcm='git checkout master'
76 78 alias gcmsg='git commit -m'
77 79 alias gco='git checkout'
... ... @@ -82,6 +84,7 @@ alias gcs=&#39;git commit -S&#39;
82 84  
83 85 alias gd='git diff'
84 86 alias gdca='git diff --cached'
  87 +alias gdct='git describe --tags `git rev-list --tags --max-count=1`'
85 88 alias gdt='git diff-tree --no-commit-id --name-only -r'
86 89 gdv() { git diff -w "$@" | view - }
87 90 compdef _git gdv=git-diff
... ... @@ -209,11 +212,13 @@ alias gsts=&#39;git stash show --text&#39;
209 212 alias gsu='git submodule update'
210 213  
211 214 alias gts='git tag -s'
  215 +alias gtv='git tag | sort -V'
212 216  
213 217 alias gunignore='git update-index --no-assume-unchanged'
214 218 alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
215 219 alias gup='git pull --rebase'
216 220 alias gupv='git pull --rebase -v'
  221 +alias glum='git pull upstream master'
217 222  
218 223 alias gvt='git verify-tag'
219 224  
plugins/gnu-utils/gnu-utils.plugin.zsh
... ... @@ -29,7 +29,10 @@ if [[ -x &quot;${commands[gwhoami]}&quot; ]]; then
29 29 'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho'
30 30 'gwhoami' 'gyes')
31 31  
32   - # Not part of coreutils, installed separately.
  32 + # findutils
  33 + gcmds+=('gfind' 'gxargs' 'glocate')
  34 +
  35 + # Not part of either coreutils or findutils, installed separately.
33 36 gcmds+=('gsed' 'gtar' 'gtime')
34 37  
35 38 for gcmd in "${gcmds[@]}"; do
plugins/golang/golang.plugin.zsh
... ... @@ -54,23 +54,42 @@ __go_tool_complete() {
54 54 '-installsuffix[suffix to add to package directory]:suffix'
55 55 '-tags[list of build tags to consider satisfied]:tags'
56 56 )
57   - __go_list() {
58   - local expl importpaths
59   - declare -a importpaths
60   - importpaths=($(go list ${words[$CURRENT]}... 2>/dev/null))
61   - _wanted importpaths expl 'import paths' compadd "$@" - "${importpaths[@]}"
  57 + __go_packages() {
  58 + local gopaths
  59 + declare -a gopaths
  60 + gopaths=("${(s/:/)$(go env GOPATH)}")
  61 + gopaths+=("$(go env GOROOT)")
  62 + for p in $gopaths; do
  63 + _path_files -W "$p/src" -/
  64 + done
  65 + }
  66 + __go_identifiers() {
  67 + compadd $(godoc -templates $ZSH/plugins/golang/templates ${words[-2]} 2> /dev/null)
62 68 }
63 69 case ${words[2]} in
64   - clean|doc)
65   - _arguments -s -w : '*:importpaths:__go_list'
  70 + doc)
  71 + _arguments -s -w \
  72 + "-c[symbol matching honors case (paths not affected)]" \
  73 + "-cmd[show symbols with package docs even if package is a command]" \
  74 + "-u[show unexported symbols as well as exported]" \
  75 + "2:importpaths:__go_packages" \
  76 + ":next identifiers:__go_identifiers"
  77 + ;;
  78 + clean)
  79 + _arguments -s -w \
  80 + "-i[remove the corresponding installed archive or binary (what 'go install' would create)]" \
  81 + "-n[print the remove commands it would execute, but not run them]" \
  82 + "-r[apply recursively to all the dependencies of the packages named by the import paths]" \
  83 + "-x[print remove commands as it executes them]" \
  84 + "*:importpaths:__go_packages"
66 85 ;;
67 86 fix|fmt|list|vet)
68   - _alternative ':importpaths:__go_list' ':files:_path_files -g "*.go"'
  87 + _alternative ':importpaths:__go_packages' ':files:_path_files -g "*.go"'
69 88 ;;
70 89 install)
71 90 _arguments -s -w : ${build_flags[@]} \
72 91 "-v[show package names]" \
73   - '*:importpaths:__go_list'
  92 + '*:importpaths:__go_packages'
74 93 ;;
75 94 get)
76 95 _arguments -s -w : \
... ... @@ -81,7 +100,7 @@ __go_tool_complete() {
81 100 ${build_flags[@]} \
82 101 "-v[show package names]" \
83 102 "-o[output file]:file:_files" \
84   - "*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }"
  103 + "*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }"
85 104 ;;
86 105 test)
87 106 _arguments -s -w : \
... ... @@ -103,7 +122,7 @@ __go_tool_complete() {
103 122 "-cpuprofile[write CPU profile to file]:file:_files" \
104 123 "-memprofile[write heap profile to file]:file:_files" \
105 124 "-memprofilerate[set heap profiling rate]:number" \
106   - "*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }"
  125 + "*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }"
107 126 ;;
108 127 help)
109 128 _values "${commands[@]}" \
plugins/golang/templates/package.txt
... ... @@ -0,0 +1,29 @@
  1 +{{with .PDoc}}{{/*
  2 +
  3 +Constants
  4 +---------------------------------------
  5 +
  6 +*/}}{{with .Consts}}{{range .}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{/*
  7 +
  8 +Variables
  9 +---------------------------------------
  10 +
  11 +*/}}{{with .Vars}}{{range .}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{/*
  12 +
  13 +Functions
  14 +---------------------------------------
  15 +
  16 +*/}}{{with .Funcs}}{{range .}}{{ .Name }} {{end}}{{end}}{{/*
  17 +
  18 +Types
  19 +---------------------------------------
  20 +
  21 +*/}}{{with .Types}}{{range .}}{{ $TypeName := .Name }}{{ $TypeName }} {{/*
  22 +
  23 +*/}}{{range .Methods}}{{ $TypeName }}.{{.Name}} {{end}}{{/*
  24 +
  25 +*/}}{{range .Funcs}}{{.Name}} {{end}}{{/*
  26 +
  27 +*/}}{{range .Consts}}{{range .Names}}{{.}} {{end}}{{end}}{{/*
  28 +
  29 +*/}}{{range .Vars}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{end}}{{end}}
plugins/golang/templates/search.txt
plugins/gradle/gradle.plugin.zsh
1 1 #!zsh
2 2 ##############################################################################
3   -# A descriptive listing of core Gradle commands
  3 +# A descriptive listing of core Gradle commands
4 4 ############################################################################
5 5 function _gradle_core_commands() {
6 6 local ret=1 state
... ... @@ -32,14 +32,22 @@ function _gradle_arguments() {
32 32 '--stop[Stop the Gradle daemon]' \
33 33 '--daemon[Use the Gradle daemon]' \
34 34 '--no-daemon[Do not use the Gradle daemon]' \
35   - '--no-opt[Do not perform any task optimization]' \
  35 + '--rerun-task [Specifies that any task optimization is ignored.]' \
36 36 '-i[Log at the info level]' \
37 37 '-m[Dry run]' \
38 38 '-P[Set a project property]' \
  39 + '-p[Specifies the start directory]' \
39 40 '--profile[Profile the build time]' \
40 41 '-q[Log at the quiet level (only show errors)]' \
41 42 '-v[Print the Gradle version info]' \
42 43 '-x[Specify a task to be excluded]' \
  44 + '-b[Specifies the build file.]' \
  45 + '-c[Specifies the settings file.]' \
  46 + '--continue[Continues task execution after a task failure.]' \
  47 + '-g[Specifies the Gradle user home directory.]' \
  48 + '-I[Specifies an initialization script.]' \
  49 + '--refresh-dependencies[Refresh the state of dependencies.]' \
  50 + '-u[Don''t search in parent directories for a settings.gradle file.]' \
43 51 '*::command:->command' \
44 52 && return 0
45 53 }
... ... @@ -82,7 +90,7 @@ _gradlew_tasks () {
82 90 if [ in_gradle ]; then
83 91 _gradle_arguments
84 92 if _gradle_does_task_list_need_generating; then
85   - gradlew tasks --all | grep "^[ ]*[a-zA-Z0-9:]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
  93 + ./gradlew tasks --all | grep "^[ ]*[a-zA-Z0-9:]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
86 94 fi
87 95 compadd -X "==== Gradlew Tasks ====" `cat .gradletasknamecache`
88 96 fi
plugins/gulp/gulp.plugin.zsh
... ... @@ -0,0 +1,29 @@
  1 +#!/usr/bin/env zsh
  2 +
  3 +#
  4 +# gulp-autocompletion-zsh
  5 +#
  6 +# Autocompletion for your gulp.js tasks
  7 +#
  8 +# Copyright(c) 2014 André König <andre.koenig@posteo.de>
  9 +# MIT Licensed
  10 +#
  11 +
  12 +#
  13 +# André König
  14 +# Github: https://github.com/akoenig
  15 +# Twitter: https://twitter.com/caiifr
  16 +#
  17 +
  18 +#
  19 +# Grabs all available tasks from the `gulpfile.js`
  20 +# in the current directory.
  21 +#
  22 +function $$gulp_completion {
  23 + compls="$(grep -Eo "gulp.task\((['\"](([a-zA-Z0-9]|-)*)['\"],)" gulpfile.js 2>/dev/null | grep -Eo "['\"](([a-zA-Z0-9]|-)*)['\"]" | sed s/"['\"]"//g | sort)"
  24 +
  25 + completions=(${=compls})
  26 + compadd -- $completions
  27 +}
  28 +
  29 +compdef $$gulp_completion gulp
plugins/heroku/_heroku
... ... @@ -143,5 +143,6 @@ _arguments \
143 143 $_command_args \
144 144 '(--app)--app[the app name]' \
145 145 '(--remote)--remote[the remote name]' \
  146 + '(--help)--help[help about the current command]' \
146 147 && return 0
147 148  
plugins/jira/README.md
... ... @@ -0,0 +1,64 @@
  1 +# Jira plugin #
  2 +
  3 +CLI support for JIRA interaction
  4 +
  5 +## Description ##
  6 +
  7 +This plugin provides command line tools for interacting with Atlassian's [JIRA](https://www.atlassian.com/software/jira) bug tracking software.
  8 +
  9 +The interaction is all done through the web. No local installation of JIRA is necessary.
  10 +
  11 +In this document, "JIRA" refers to the JIRA issue tracking server, and `jira` refers to the command this plugin supplies.
  12 +
  13 +## Usage ##
  14 +
  15 +This plugin supplies one command, `jira`, through which all its features are exposed. Most forms of this command open a JIRA page in your web browser.
  16 +
  17 +```
  18 +jira # performs the default action
  19 +
  20 +jira new # opens a new issue
  21 +jira dashboard # opens your JIRA dashboard
  22 +jira reported [username] # queries for issues reported by a user
  23 +jira assigned [username] # queries for issues assigned to a user
  24 +jira ABC-123 # opens an existing issue
  25 +jira ABC-123 m # opens an existing issue for adding a comment
  26 +```
  27 +
  28 +#### Debugging usage ####
  29 +
  30 +These calling forms are for developers' use, and may change at any time.
  31 +
  32 +```
  33 +jira dumpconfig # displays the effective configuration
  34 +```
  35 +
  36 +## Setup ##
  37 +
  38 +The URL for your JIRA instance is set by `$JIRA_URL` or a `.jira_url` file.
  39 +
  40 +Add a `.jira-url` file in the base of your project. You can also set `$JIRA_URL` in your `~/.zshrc` or put a `.jira-url` in your home directory. A `.jira-url` in the current directory takes precedence, so you can make per-project customizations.
  41 +
  42 +The same goes with `.jira-prefix` and `$JIRA_PREFIX`. These control the prefix added to all issue IDs, which differentiates projects within a JIRA instance.
  43 +
  44 +For example:
  45 +
  46 +```
  47 +cd to/my/project
  48 +echo "https://jira.atlassian.com" >> .jira-url
  49 +```
  50 +
  51 +(Note: The current implementation only looks in the current directory for `.jira-url` and `.jira-prefix`, not up the path, so if you are in a subdirectory of your project, it will fall back to your default JIRA URL. This will probably change in the future though.)
  52 +
  53 +### Variables ###
  54 +
  55 +* `$JIRA_URL` - Your JIRA instance's URL
  56 +* `$JIRA_NAME` - Your JIRA username; used as the default user for `assigned`/`reported` searches
  57 +* `$JIRA_PREFIX` - Prefix added to issue ID arguments
  58 +* `$JIRA_RAPID_BOARD` - Set to `true` if you use Rapid Board
  59 +* `$JIRA_DEFAULT_ACTION` - Action to do when `jira` is called with no arguments; defaults to "new"
  60 +
  61 +
  62 +### Browser ###
  63 +
  64 +Your default web browser, as determined by how `open_command` handles `http://` URLs, is used for interacting with the JIRA instance. If you change your system's URL handler associations, it will change the browser that `jira` uses.
... ... @@ -0,0 +1,22 @@
  1 +#compdef jira
  2 +#autoload
  3 +
  4 +local -a _1st_arguments
  5 +_1st_arguments=(
  6 + 'new:create a new issue'
  7 + 'dashboard:open the dashboard'
  8 + 'reported:search for issues reported by a user'
  9 + 'assigned:search for issues assigned to a user'
  10 + 'dumpconfig:display effective jira configuration'
  11 +)
  12 +
  13 +_arguments -C \
  14 + ':command:->command' \
  15 + '*::options:->options'
  16 +
  17 +case $state in
  18 + (command)
  19 + _describe -t commands "jira subcommand" _1st_arguments
  20 + return
  21 + ;;
  22 +esac
plugins/jira/jira.plugin.zsh
1   -# To use: add a .jira-url file in the base of your project
2   -# You can also set JIRA_URL in your .zshrc or put .jira-url in your home directory
3   -# .jira-url in the current directory takes precedence
  1 +# CLI support for JIRA interaction
4 2 #
5   -# If you use Rapid Board, set:
6   -#JIRA_RAPID_BOARD="true"
7   -# in you .zshrc
8   -#
9   -# Setup: cd to/my/project
10   -# echo "https://name.jira.com" >> .jira-url
11   -# Usage: jira # opens a new issue
12   -# jira ABC-123 # Opens an existing issue
13   -open_jira_issue () {
14   - if [ -f .jira-url ]; then
  3 +# See README.md for details
  4 +
  5 +: ${JIRA_DEFAULT_ACTION:=new}
  6 +
  7 +function jira() {
  8 + emulate -L zsh
  9 + local action=${1:=$JIRA_DEFAULT_ACTION}
  10 +
  11 + local jira_url jira_prefix
  12 + if [[ -f .jira-url ]]; then
15 13 jira_url=$(cat .jira-url)
16   - elif [ -f ~/.jira-url ]; then
  14 + elif [[ -f ~/.jira-url ]]; then
17 15 jira_url=$(cat ~/.jira-url)
18   - elif [[ "x$JIRA_URL" != "x" ]]; then
19   - jira_url=$JIRA_URL
  16 + elif [[ -n "${JIRA_URL}" ]]; then
  17 + jira_url=${JIRA_URL}
20 18 else
21   - echo "JIRA url is not specified anywhere."
  19 + _jira_url_help
22 20 return 1
23 21 fi
24 22  
25   - if [ -f .jira-prefix ]; then
  23 + if [[ -f .jira-prefix ]]; then
26 24 jira_prefix=$(cat .jira-prefix)
27   - elif [ -f ~/.jira-prefix ]; then
  25 + elif [[ -f ~/.jira-prefix ]]; then
28 26 jira_prefix=$(cat ~/.jira-prefix)
  27 + elif [[ -n "${JIRA_PREFIX}" ]]; then
  28 + jira_prefix=${JIRA_PREFIX}
29 29 else
30 30 jira_prefix=""
31 31 fi
32 32  
33   - if [ -z "$1" ]; then
  33 +
  34 + if [[ $action == "new" ]]; then
34 35 echo "Opening new issue"
35 36 open_command "${jira_url}/secure/CreateIssue!default.jspa"
36   - elif [[ "$1" = "assigned" || "$1" = "reported" ]]; then
37   - jira_query $@
38   - else
39   - local addcomment=''
  37 + elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then
  38 + _jira_query $@
  39 + elif [[ "$action" == "dashboard" ]]; then
  40 + echo "Opening dashboard"
  41 + open_command "${jira_url}/secure/Dashboard.jspa"
  42 + elif [[ "$action" == "dumpconfig" ]]; then
  43 + echo "JIRA_URL=$jira_url"
  44 + echo "JIRA_PREFIX=$jira_prefix"
  45 + echo "JIRA_NAME=$JIRA_NAME"
  46 + echo "JIRA_RAPID_BOARD=$JIRA_RAPID_BOARD"
  47 + echo "JIRA_DEFAULT_ACTION=$JIRA_DEFAULT_ACTION"
  48 + else
  49 + # Anything that doesn't match a special action is considered an issue name
  50 + local issue_arg=$action
  51 + local issue="${jira_prefix}${issue_arg}"
  52 + local url_fragment=''
40 53 if [[ "$2" == "m" ]]; then
41   - addcomment="#add-comment"
42   - echo "Add comment to issue #$1"
  54 + url_fragment="#add-comment"
  55 + echo "Add comment to issue #$issue"
43 56 else
44   - echo "Opening issue #$1"
  57 + echo "Opening issue #$issue"
45 58 fi
46   -
47   - if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then
48   - open_command "$jira_url/issues/$jira_prefix$1$addcomment"
  59 + if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then
  60 + open_command "${jira_url}/issues/${issue}${url_fragment}"
49 61 else
50   - open_command "$jira_url/browse/$jira_prefix$1$addcomment"
  62 + open_command "${jira_url}/browse/${issue}${url_fragment}"
51 63 fi
52 64 fi
53 65 }
54 66  
55   -jira_name () {
56   - if [[ -z "$1" ]]; then
57   - if [[ "x${JIRA_NAME}" != "x" ]]; then
58   - jira_name=${JIRA_NAME}
59   - else
60   - echo "JIRA_NAME not specified"
61   - return 1
62   - fi
  67 +function _jira_url_help() {
  68 + cat << EOF
  69 +error: JIRA URL is not specified anywhere.
  70 +
  71 +Valid options, in order of precedence:
  72 + .jira-url file
  73 + \$HOME/.jira-url file
  74 + \$JIRA_URL environment variable
  75 +EOF
  76 +}
  77 +
  78 +function _jira_query() {
  79 + emulate -L zsh
  80 + local verb="$1"
  81 + local jira_name lookup preposition query
  82 + if [[ "${verb}" == "reported" ]]; then
  83 + lookup=reporter
  84 + preposition=by
  85 + elif [[ "${verb}" == "assigned" ]]; then
  86 + lookup=assignee
  87 + preposition=to
63 88 else
64   - jira_name=$@
  89 + echo "error: not a valid lookup: $verb" >&2
  90 + return 1
  91 + fi
  92 + jira_name=${2:=$JIRA_NAME}
  93 + if [[ -z $jira_name ]]; then
  94 + echo "error: JIRA_NAME not specified" >&2
  95 + return 1
65 96 fi
66   -}
67 97  
68   -jira_query () {
69   - verb="$1"
70   - if [[ "${verb}" = "reported" ]]; then
71   - lookup=reporter
72   - preposition=by
73   - elif [[ "${verb}" = "assigned" ]]; then
74   - lookup=assignee
75   - preposition=to
76   - else
77   - echo "not a valid lookup $verb"
78   - return 1
79   - fi
80   - shift 1
81   - jira_name $@
82   - if [[ $? = 1 ]]; then
83   - return 1
84   - fi
85   - echo "Browsing issues ${verb} ${preposition} ${jira_name}"
86   - open_command "${jira_url}/secure/IssueNavigator.jspa?reset=true&jqlQuery=${lookup}+%3D+%22${jira_name}%22+AND+resolution+%3D+unresolved+ORDER+BY+priority+DESC%2C+created+ASC"
  98 + echo "Browsing issues ${verb} ${preposition} ${jira_name}"
  99 + query="${lookup}+%3D+%22${jira_name}%22+AND+resolution+%3D+unresolved+ORDER+BY+priority+DESC%2C+created+ASC"
  100 + open_command "${jira_url}/secure/IssueNavigator.jspa?reset=true&jqlQuery=${query}"
87 101 }
88 102  
89   -alias jira='open_jira_issue'
90   -
... ... @@ -0,0 +1,27 @@
  1 +# ------------------------------------------------------------------------------
  2 +# Author
  3 +# ------
  4 +#
  5 +# * Jerry Ling<jerryling315@gmail.com>
  6 +#
  7 +# ------------------------------------------------------------------------------
  8 +# Usgae
  9 +# -----
  10 +#
  11 +# man will be inserted before the command
  12 +#
  13 +# ------------------------------------------------------------------------------
  14 +
  15 +man-command-line() {
  16 + [[ -z $BUFFER ]] && zle up-history
  17 + [[ $BUFFER != man\ * ]] && LBUFFER="man $LBUFFER"
  18 +}
  19 +zle -N man-command-line
  20 +# Defined shortcut keys: [Esc]man
  21 +bindkey "\e"man man-command-line
  22 +
  23 +
  24 +# ------------------------------------------------------------------------------
  25 +# Also, you might want to use man-preview included in 'osx' plugin
  26 +# just substitute "man" in the function with "man-preview" after you included OS X in
  27 +# the .zshrc
0 28 \ No newline at end of file
plugins/nmap/README.md
... ... @@ -19,14 +19,19 @@ Nmap options are:
19 19  
20 20 ## Aliases explained
21 21  
22   - * nmap_open_ports - scan for open ports on target
23   - * nmap_list_interfaces - list all network interfaces on host where the command runs
24   - * nmap_slow - slow scan that avoids to spam the targets logs
25   - * nmap_fin - scan to see if hosts are up with TCP FIN scan
26   - * nmap_full - aggressive full scan that scans all ports, tries to determine OS and service versions
  22 + * nmap_open_ports - Scan for open ports on target
  23 + * nmap_list_interfaces - List all network interfaces on host where the command runs
  24 + * nmap_slow - Slow scan that avoids to spam the targets logs
  25 + * nmap_fin - Scan to see if hosts are up with TCP FIN scan
  26 + * nmap_full - Aggressive full scan that scans all ports, tries to determine OS and service versions
27 27 * nmap_check_for_firewall - TCP ACK scan to check for firewall existence
28 28 * nmap_ping_through_firewall - Host discovery with SYN and ACK probes instead of just pings to avoid firewall
29 29 restrictions
30 30 * nmap_fast - Fast scan of the top 300 popular ports
31   - * nmap_detect_versions - detects versions of services and OS, runs on all ports
32   - * nmap_check_for_vulns - uses vulscan script to check target services for vulnerabilities
  31 + * nmap_detect_versions - Detects versions of services and OS, runs on all ports
  32 + * nmap_check_for_vulns - Uses vulscan script to check target services for vulnerabilities
  33 + * nmap_full_udp - Same as full but via UDP
  34 + * nmap_traceroute - Try to traceroute using the most common ports
  35 + * nmap_full_with_scripts - Same as nmap_full but also runs all the scripts
  36 + * nmap_web_safe_osscan - Little "safer" scan for OS version as connecting to only HTTP and HTTPS ports doesn't look so attacking.
  37 +
plugins/nmap/nmap.plugin.zsh
... ... @@ -22,7 +22,11 @@ alias nmap_fin=&quot;nmap -sF -v&quot;
22 22 alias nmap_full="nmap -sS -T4 -PE -PP -PS80,443 -PY -g 53 -A -p1-65535 -v"
23 23 alias nmap_check_for_firewall="nmap -sA -p1-65535 -v -T4"
24 24 alias nmap_ping_through_firewall="nmap -PS -PA"
25   -alias nmap_fast="nmap -F -T5 --top-ports 300"
  25 +alias nmap_fast="nmap -F -T5 --version-light --top-ports 300"
26 26 alias nmap_detect_versions="nmap -sV -p1-65535 -O --osscan-guess -T4 -Pn"
27 27 alias nmap_check_for_vulns="nmap --script=vulscan"
  28 +alias nmap_full_udp="nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443,3389 "
  29 +alias nmap_traceroute="nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute "
  30 +alias nmap_full_with_scripts="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all "
  31 +alias nmap_web_safe_osscan="sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy "
28 32  
plugins/npm/npm.plugin.zsh
1 1 eval "$(npm completion 2>/dev/null)"
2 2  
  3 +# Install dependencies globally
  4 +alias npmg="npm i -g "
3 5  
4 6 # npm package names are lowercase
5   -# - https://twitter.com/substack/status/23122603153150361
6 7 # Thus, we've used camelCase for the following aliases:
7 8  
8 9 # Install and save to dependencies in your package.json
... ... @@ -12,3 +13,7 @@ alias npmS=&quot;npm i -S &quot;
12 13 # Install and save to dev-dependencies in your package.json
13 14 # npmd is used by https://github.com/dominictarr/npmd
14 15 alias npmD="npm i -D "
  16 +
  17 +# Execute command from node_modules folder based on current directory
  18 +# i.e npmE gulp
  19 +alias npmE='PATH="$(npm bin)":"$PATH"'
plugins/osx/osx.plugin.zsh
... ... @@ -5,29 +5,35 @@
5 5 # VERSION: 1.1.0
6 6 # ------------------------------------------------------------------------------
7 7  
8   -function tab() {
9   - local command="cd \\\"$PWD\\\"; clear; "
10   - (( $# > 0 )) && command="${command}; $*"
11   -
12   - the_app=$(
  8 +function _omz_osx_get_frontmost_app() {
  9 + local the_app=$(
13 10 osascript 2>/dev/null <<EOF
14 11 tell application "System Events"
15 12 name of first item of (every process whose frontmost is true)
16 13 end tell
17 14 EOF
18 15 )
  16 + echo "$the_app"
  17 +}
19 18  
20   - [[ "$the_app" == 'Terminal' ]] && {
21   - osascript 2>/dev/null <<EOF
  19 +function tab() {
  20 + # Must not have trailing semicolon, for iTerm compatibility
  21 + local command="cd \\\"$PWD\\\"; clear"
  22 + (( $# > 0 )) && command="${command}; $*"
  23 +
  24 + local the_app=$(_omz_osx_get_frontmost_app)
  25 +
  26 + if [[ "$the_app" == 'Terminal' ]]; then
  27 + # Discarding stdout to quash "tab N of window id XXX" output
  28 + osascript >/dev/null <<EOF
22 29 tell application "System Events"
23 30 tell process "Terminal" to keystroke "t" using command down
24   - tell application "Terminal" to do script "${command}" in front window
25 31 end tell
  32 + tell application "Terminal" to do script "${command}" in front window
26 33 EOF
27   - }
28 34  
29   - [[ "$the_app" == 'iTerm' ]] && {
30   - osascript 2>/dev/null <<EOF
  35 + elif [[ "$the_app" == 'iTerm' ]]; then
  36 + osascript <<EOF
31 37 tell application "iTerm"
32 38 set current_terminal to current terminal
33 39 tell current_terminal
... ... @@ -35,29 +41,27 @@ EOF
35 41 set current_session to current session
36 42 tell current_session
37 43 write text "${command}"
38   - keystroke return
39 44 end tell
40 45 end tell
41 46 end tell
42 47 EOF
43   - }
  48 +
  49 + else
  50 + echo "tab: unsupported terminal app: $the_app"
  51 + false
  52 +
  53 + fi
44 54 }
45 55  
46 56 function vsplit_tab() {
47   - local command="cd \\\"$PWD\\\""
  57 + local command="cd \\\"$PWD\\\"; clear"
48 58 (( $# > 0 )) && command="${command}; $*"
49 59  
50   - the_app=$(
51   - osascript 2>/dev/null <<EOF
52   - tell application "System Events"
53   - name of first item of (every process whose frontmost is true)
54   - end tell
55   -EOF
56   - )
  60 + local the_app=$(_omz_osx_get_frontmost_app)
57 61  
58   - [[ "$the_app" == 'iTerm' ]] && {
59   - osascript 2>/dev/null <<EOF
60   - tell application "iTerm" to activate
  62 + if [[ "$the_app" == 'iTerm' ]]; then
  63 + osascript <<EOF
  64 + -- tell application "iTerm" to activate
61 65  
62 66 tell application "System Events"
63 67 tell process "iTerm"
... ... @@ -65,26 +69,24 @@ EOF
65 69 click
66 70 end tell
67 71 end tell
68   - keystroke "${command}; clear;"
69   - keystroke return
  72 + keystroke "${command} \n"
70 73 end tell
71 74 EOF
72   - }
  75 +
  76 + else
  77 + echo "$0: unsupported terminal app: $the_app" >&2
  78 + false
  79 +
  80 + fi
73 81 }
74 82  
75 83 function split_tab() {
76   - local command="cd \\\"$PWD\\\""
  84 + local command="cd \\\"$PWD\\\"; clear"
77 85 (( $# > 0 )) && command="${command}; $*"
78 86  
79   - the_app=$(
80   - osascript 2>/dev/null <<EOF
81   - tell application "System Events"
82   - name of first item of (every process whose frontmost is true)
83   - end tell
84   -EOF
85   - )
  87 + local the_app=$(_omz_osx_get_frontmost_app)
86 88  
87   - [[ "$the_app" == 'iTerm' ]] && {
  89 + if [[ "$the_app" == 'iTerm' ]]; then
88 90 osascript 2>/dev/null <<EOF
89 91 tell application "iTerm" to activate
90 92  
... ... @@ -94,11 +96,15 @@ EOF
94 96 click
95 97 end tell
96 98 end tell
97   - keystroke "${command}; clear;"
98   - keystroke return
  99 + keystroke "${command} \n"
99 100 end tell
100 101 EOF
101   - }
  102 +
  103 + else
  104 + echo "$0: unsupported terminal app: $the_app" >&2
  105 + false
  106 +
  107 + fi
102 108 }
103 109  
104 110 function pfd() {
... ... @@ -161,6 +167,17 @@ function itunes() {
161 167 vol)
162 168 opt="set sound volume to $1" #$1 Due to the shift
163 169 ;;
  170 + playing|status)
  171 + local state=`osascript -e 'tell application "iTunes" to player state as string'`
  172 + if [[ "$state" = "playing" ]]; then
  173 + currenttrack=`osascript -e 'tell application "iTunes" to name of current track as string'`
  174 + currentartist=`osascript -e 'tell application "iTunes" to artist of current track as string'`
  175 + echo -E "Listening to $fg[yellow]$currenttrack$reset_color by $fg[yellow]$currentartist$reset_color";
  176 + else
  177 + echo "iTunes is" $state;
  178 + fi
  179 + return 0
  180 + ;;
164 181 shuf|shuff|shuffle)
165 182 # The shuffle property of current playlist can't be changed in iTunes 12,
166 183 # so this workaround uses AppleScript to simulate user input instead.
... ... @@ -199,6 +216,7 @@ EOF
199 216 echo "\tnext|previous\tplay next or previous track"
200 217 echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
201 218 echo "\tvol\tSet the volume, takes an argument from 0 to 100"
  219 + echo "\tplaying|status\tShow what song is currently playing in iTunes."
202 220 echo "\thelp\tshow this message and exit"
203 221 return 0
204 222 ;;
plugins/pyenv/pyenv.plugin.zsh
... ... @@ -17,7 +17,11 @@ for pyenvdir in &quot;${pyenvdirs[@]}&quot; ; do
17 17 FOUND_PYENV=1
18 18 export PYENV_ROOT=$pyenvdir
19 19 export PATH=${pyenvdir}/bin:$PATH
20   - eval "$(pyenv init --no-rehash - zsh)"
  20 + eval "$(pyenv init - zsh)"
  21 +
  22 + if pyenv commands | command grep -q virtualenv-init; then
  23 + eval "$(pyenv virtualenv-init - zsh)"
  24 + fi
21 25  
22 26 function pyenv_prompt_info() {
23 27 echo "$(pyenv version-name)"
plugins/rails/rails.plugin.zsh
... ... @@ -42,6 +42,7 @@ alias rp=&#39;rails plugin&#39;
42 42 alias ru='rails runner'
43 43 alias rs='rails server'
44 44 alias rsd='rails server --debugger'
  45 +alias rsp='rails server --port'
45 46  
46 47 # Rake aliases
47 48 alias rdm='rake db:migrate'
... ... @@ -54,10 +55,12 @@ alias rdrs=&#39;rake db:reset&#39;
54 55 alias rdtc='rake db:test:clone'
55 56 alias rdtp='rake db:test:prepare'
56 57 alias rdmtc='rake db:migrate db:test:clone'
57   -
58 58 alias rlc='rake log:clear'
59 59 alias rn='rake notes'
60 60 alias rr='rake routes'
  61 +alias rrg='rake routes | grep'
  62 +alias rt='rake test'
  63 +alias rmd='rake middleware'
61 64  
62 65 # legacy stuff
63 66 alias sstat='thin --stats "/thin/stats" start'
plugins/rand-quote/rand-quote.plugin.zsh
... ... @@ -18,8 +18,6 @@ if [[ -x `which curl` ]]; then
18 18 W=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g')
19 19 if [ "$W" -a "$TXT" ]; then
20 20 echo "${WHO_COLOR}${W}${COLON_COLOR}: ${TEXT_COLOR}“${TXT}”${END_COLOR}"
21   - else
22   - quote
23 21 fi
24 22 }
25 23 #quote
plugins/rbenv/rbenv.plugin.zsh
... ... @@ -2,14 +2,11 @@ _homebrew-installed() {
2 2 type brew &> /dev/null
3 3 }
4 4  
5   -_rbenv-from-homebrew-installed() {
6   - brew --prefix rbenv &> /dev/null
7   -}
8   -
9 5 FOUND_RBENV=0
10 6 rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" "/usr/local/opt/rbenv")
11   -if _homebrew-installed && _rbenv-from-homebrew-installed ; then
12   - rbenvdirs=($(brew --prefix rbenv) "${rbenvdirs[@]}")
  7 +if _homebrew-installed && rbenv_homebrew_path=$(brew --prefix rbenv 2>/dev/null); then
  8 + rbenvdirs=($rbenv_homebrew_path "${rbenvdirs[@]}")
  9 + unset rbenv_homebrew_path
13 10 fi
14 11  
15 12 for rbenvdir in "${rbenvdirs[@]}" ; do
plugins/rvm/rvm.plugin.zsh
... ... @@ -61,11 +61,11 @@ function gems {
61 61 local current_ruby=`rvm-prompt i v p`
62 62 local current_gemset=`rvm-prompt g`
63 63  
64   - gem list $@ | sed \
65   - -Ee "s/\([0-9, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
66   - -Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
67   - -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
68   - -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
  64 + gem list $@ | sed -E \
  65 + -e "s/\([0-9, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
  66 + -e "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
  67 + -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
  68 + -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
69 69 }
70 70  
71 71 function _rvm_completion {
plugins/scw/README.md
... ... @@ -0,0 +1,7 @@
  1 +## Scaleway CLI autocomplete plugin
  2 +
  3 +[scw](https://github.com/scaleway/scaleway-cli): Manage Bare Metal servers from Command Line (as easily as with Docker)
  4 +
  5 +- Adds autocomplete options for all `scw` commands.
  6 +
  7 +Maintainer : Manfred Touron ([@moul](https://github.com/moul))
... ... @@ -0,0 +1,333 @@
  1 +#compdef scw
  2 +#
  3 +# zsh completion for scw (http://scaleway.com)
  4 +#
  5 +# Inspired by https://github.com/felixr/docker-zsh-completion
  6 +
  7 +__scw_get_servers() {
  8 + local expl
  9 + declare -a servers
  10 + servers=(${(f)"$(_call_program commands scw _completion servers-names)"})
  11 + _describe -t servers "servers" servers
  12 +}
  13 +
  14 +__scw_stoppedservers() {
  15 + __scw_get_servers
  16 +}
  17 +
  18 +__scw_runningservers() {
  19 + __scw_get_servers
  20 +}
  21 +
  22 +__scw_servers () {
  23 + __scw_get_servers
  24 +}
  25 +
  26 +__scw_images () {
  27 + local expl
  28 + declare -a images
  29 + images=(${(f)"$(_call_program commands scw _completion images-names)"})
  30 + _describe -t images "images" images
  31 +}
  32 +
  33 +__scw_images_and_snapshots () {
  34 + __scw_images
  35 + __scw_snapshots
  36 +}
  37 +
  38 +__scw_snapshots () {
  39 + local expl
  40 + declare -a snapshots
  41 + snapshots=(${(f)"$(_call_program commands scw _completion --prefix snapshots-names)"})
  42 + _describe -t snapshots "snapshots" snapshots
  43 +}
  44 +
  45 +__scw_bootscripts () {
  46 + local expl
  47 + declare -a bootscripts
  48 + bootscripts=(${(f)"$(_call_program commands scw _completion bootscripts-names)"})
  49 + _describe -t bootscripts "bootscripts" bootscripts
  50 +}
  51 +
  52 +__scw_tags() {
  53 + __scw_images
  54 +}
  55 +
  56 +__scw_repositories_with_tags() {
  57 + __scw_images
  58 +}
  59 +
  60 +__scw_search() {
  61 + # declare -a scwsearch
  62 + local cache_policy
  63 + zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
  64 + if [[ -z "$cache_policy" ]]; then
  65 + zstyle ":completion:${curcontext}:" cache-policy __scw_caching_policy
  66 + fi
  67 +
  68 + local searchterm cachename
  69 + searchterm="${words[$CURRENT]%/}"
  70 + cachename=_scw-search-$searchterm
  71 +
  72 + local expl
  73 + local -a result
  74 + if ( [[ ${(P)+cachename} -eq 0 ]] || _cache_invalid ${cachename#_} ) \
  75 + && ! _retrieve_cache ${cachename#_}; then
  76 + _message "Searching for ${searchterm}..."
  77 + result=(${${${(f)"$(_call_program commands scw search ${searchterm})"}%% *}[2,-1]})
  78 + _store_cache ${cachename#_} result
  79 + fi
  80 + _wanted scwsearch expl 'available images' compadd -a result
  81 +}
  82 +
  83 +__scw_caching_policy()
  84 +{
  85 + oldp=( "$1"(Nmh+1) ) # 1 hour
  86 + (( $#oldp ))
  87 +}
  88 +
  89 +
  90 +__scw_repositories () {
  91 + __scw_images
  92 +}
  93 +
  94 +__scw_commands () {
  95 + # local -a _scw_subcommands
  96 + local cache_policy
  97 +
  98 + zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
  99 + if [[ -z "$cache_policy" ]]; then
  100 + zstyle ":completion:${curcontext}:" cache-policy __scw_caching_policy
  101 + fi
  102 +
  103 + if ( [[ ${+_scw_subcommands} -eq 0 ]] || _cache_invalid scw_subcommands) \
  104 + && ! _retrieve_cache scw_subcommands;
  105 + then
  106 + local -a lines
  107 + lines=(${(f)"$(_call_program commands scw 2>&1)"})
  108 + _scw_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/ ##/:})
  109 + _scw_subcommands=($_scw_subcommands 'help:Show help for a command')
  110 + _store_cache scw_subcommands _scw_subcommands
  111 + fi
  112 + _describe -t scw-commands "scw command" _scw_subcommands
  113 +}
  114 +
  115 +__scw_subcommand () {
  116 + local -a _command_args
  117 + case "$words[1]" in
  118 + (attach)
  119 + _arguments \
  120 + '--no-stdin[Do not attach stdin]' \
  121 + ':servers:__scw_runningservers'
  122 + ;;
  123 + (commit)
  124 + _arguments \
  125 + {-v,--volume=0}'[Volume slot]:volume: ' \
  126 + ':server:__scw_servers' \
  127 + ':repository:__scw_repositories_with_tags'
  128 + ;;
  129 + (cp)
  130 + _arguments \
  131 + ':server:->server' \
  132 + ':hostpath:_files'
  133 + case $state in
  134 + (server)
  135 + if compset -P '*:'; then
  136 + _files
  137 + else
  138 + __scw_servers -qS ":"
  139 + fi
  140 + ;;
  141 + esac
  142 + ;;
  143 + (exec)
  144 + local state ret
  145 + _arguments \
  146 + {-T,--timeout=0}'[Set timeout values to seconds]' \
  147 + {-w,--wait}'[Wait for SSH to be ready]' \
  148 + ':servers:__scw_runningservers' \
  149 + '*::command:->anycommand' && ret=0
  150 +
  151 + case $state in
  152 + (anycommand)
  153 + shift 1 words
  154 + (( CURRENT-- ))
  155 + _normal
  156 + ;;
  157 + esac
  158 +
  159 + return ret
  160 + ;;
  161 + (history)
  162 + _arguments \
  163 + '--no-trunc[Do not truncate output]' \
  164 + {-q,--quiet}'[Only show numeric IDs]' \
  165 + '*:images:__scw_images'
  166 + ;;
  167 + (images)
  168 + _arguments \
  169 + {-a,--all}'[Show all images]' \
  170 + '--no-trunc[Do not truncate output]' \
  171 + {-q,--quiet}'[Only show numeric IDs]' \
  172 + ':repository:__scw_repositories'
  173 + ;;
  174 + (info)
  175 + ;;
  176 + (inspect)
  177 + _arguments \
  178 + {-f,--format=-}'[Format the output using the given go template]:template: ' \
  179 + '*:servers:__scw_servers'
  180 + ;;
  181 + (kill)
  182 + _arguments \
  183 + '*:servers:__scw_runningservers'
  184 + ;;
  185 + (login)
  186 + _arguments \
  187 + {-o,--organization=-}'[Organization]:organization: ' \
  188 + {-t,--token=-}'[Token]:token: ' \
  189 + ':server: '
  190 + ;;
  191 + (logout)
  192 + _arguments \
  193 + ':server: '
  194 + ;;
  195 + (logs)
  196 + _arguments \
  197 + '*:servers:__scw_servers'
  198 + ;;
  199 + (port)
  200 + _arguments \
  201 + '1:servers:__scw_runningservers' \
  202 + '2:port:_ports'
  203 + ;;
  204 + (start)
  205 + _arguments \
  206 + {-T,--timeout=0}'[Set timeout values to seconds]' \
  207 + {-w,--wait}'[Wait for SSH to be ready]' \
  208 + '*:servers:__scw_stoppedservers'
  209 + ;;
  210 + (rm)
  211 + _arguments \
  212 + '*:servers:__scw_stoppedservers'
  213 + ;;
  214 + (rmi)
  215 + _arguments \
  216 + '*:images:__scw_images'
  217 + ;;
  218 + (restart)
  219 + _arguments \
  220 + '*:servers:__scw_runningservers'
  221 + ;;
  222 + (stop)
  223 + _arguments \
  224 + {-t,--terminate}'[Stop and trash a server with its volumes]' \
  225 + {-w,--wait}'[Synchronous stop. Wait for server to be stopped]' \
  226 + '*:servers:__scw_runningservers'
  227 + ;;
  228 + (top)
  229 + _arguments \
  230 + '1:servers:__scw_runningservers' \
  231 + '(-)*:: :->ps-arguments'
  232 + case $state in
  233 + (ps-arguments)
  234 + _ps
  235 + ;;
  236 + esac
  237 + ;;
  238 + (ps)
  239 + _arguments \
  240 + {-a,--all}'[Show all servers. Only running servers are shown by default]' \
  241 + {-l,--latest}'[Show only the latest created server]' \
  242 + '-n[Show n last created servers, include non-running one]:n:(1 5 10 25 50)' \
  243 + '--no-trunc[Do not truncate output]' \
  244 + {-q,--quiet}'[Only show numeric IDs]'
  245 + ;;
  246 + (tag)
  247 + _arguments \
  248 + {-f,--force}'[force]'\
  249 + ':image:__scw_images'\
  250 + ':repository:__scw_repositories_with_tags'
  251 + ;;
  252 + (create|run)
  253 + _arguments \
  254 + {-a,--attach}'[Attach to stdin, stdout or stderr]' \
  255 + '*'{-e,--environment=-}'[Set environment variables]:environment variable: ' \
  256 + '--name=-[Server name]:name: ' \
  257 + '--bootscript=-[Assign a bootscript]:bootscript:__scw_bootscripts ' \
  258 + '*-v[Bind mount a volume]:volume: '\
  259 + '(-):images:__scw_images_and_snapshots' \
  260 + '(-):command: _command_names -e' \
  261 + '*::arguments: _normal'
  262 +
  263 + case $state in
  264 + (link)
  265 + if compset -P '*:'; then
  266 + _wanted alias expl 'Alias' compadd -E ""
  267 + else
  268 + __scw_runningservers -qS ":"
  269 + fi
  270 + ;;
  271 + esac
  272 + ;;
  273 + (rename)
  274 + _arguments \
  275 + ':old name:__scw_servers' \
  276 + ':new name: '
  277 + ;;
  278 + (search)
  279 + _arguments \
  280 + '--no-trunc[Do not truncate output]' \
  281 + ':term: '
  282 + ;;
  283 + (wait)
  284 + _arguments '*:servers:__scw_runningservers'
  285 + ;;
  286 + (help)
  287 + _arguments ':subcommand:__scw_commands'
  288 + ;;
  289 + (*)
  290 + _message 'Unknown sub command'
  291 + esac
  292 +
  293 +}
  294 +
  295 +_scw () {
  296 + # Support for subservices, which allows for `compdef _scw scw-shell=_scw_servers`.
  297 + # Based on /usr/share/zsh/functions/Completion/Unix/_git without support for `ret`.
  298 + if [[ $service != scw ]]; then
  299 + _call_function - _$service
  300 + return
  301 + fi
  302 +
  303 + local curcontext="$curcontext" state line
  304 + typeset -A opt_args
  305 +
  306 + _arguments -C \
  307 + '-H[tcp://host:port to bind/connect to]:socket: ' \
  308 + '(-): :->command' \
  309 + '(-)*:: :->option-or-argument'
  310 +
  311 + if (( CURRENT == 1 )); then
  312 +
  313 + fi
  314 + case $state in
  315 + (command)
  316 + __scw_commands
  317 + ;;
  318 + (option-or-argument)
  319 + curcontext=${curcontext%:*:*}:scw-$words[1]:
  320 + __scw_subcommand
  321 + ;;
  322 + esac
  323 +}
  324 +
  325 +_scw "$@"
  326 +
  327 +# Local Variables:
  328 +# mode: Shell-Script
  329 +# sh-indentation: 4
  330 +# indent-tabs-mode: nil
  331 +# sh-basic-offset: 4
  332 +# End:
  333 +# vim: ft=zsh sw=4 ts=4 et
plugins/spring/README.md
... ... @@ -0,0 +1,25 @@
  1 +# Spring Boot oh-my-zsh plugin
  2 +oh-my-zsh Spring Boot plugin
  3 +
  4 +## Spring Boot autocomplete plugin
  5 +
  6 +- Adds autocomplete options for all spring boot commands.
  7 +
  8 +## Manual Install
  9 +
  10 + $ cd ~/.oh-my-zsh/plugins
  11 + $ git clone git@github.com:linux-china/oh-my-zsh-spring-boot-plugin.git spring
  12 +
  13 +Adjust your .zshrc file and add spring to plugins=(...)
  14 +
  15 +## Tips
  16 +
  17 +* Install Spring Cloud plugin: spring install org.springframework.cloud:spring-cloud-cli:1.0.2.RELEASE
  18 +
  19 +## Reference
  20 +
  21 +* Spring Boot: http://projects.spring.io/spring-boot/
  22 +* Spring Boot CLI: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#cli
  23 +
  24 +Maintainer : linux_china ([@linux_china](https://twitter.com/linux_china))
  25 +
plugins/spring/_spring
... ... @@ -0,0 +1,29 @@
  1 +#compdef spring 'spring'
  2 +#autoload
  3 +
  4 +_spring() {
  5 +
  6 + local cword
  7 + let cword=CURRENT-1
  8 +
  9 + local hints
  10 + hints=()
  11 +
  12 + local reply
  13 + while read -r line; do
  14 + reply=`echo "$line" | awk '{printf $1 ":"; for (i=2; i<NF; i++) printf $i " "; print $NF}'`
  15 + hints+=("$reply")
  16 + done < <(spring hint ${cword} ${words[*]})
  17 +
  18 + if ((cword == 1)) {
  19 + _describe -t commands 'commands' hints
  20 + return 0
  21 + }
  22 +
  23 + _describe -t options 'options' hints
  24 + _files
  25 +
  26 + return 0
  27 +}
  28 +
  29 +_spring "$@"
0 30 \ No newline at end of file
plugins/stack/stack.plugin.zsh
... ... @@ -0,0 +1,37 @@
  1 +function _stack_commands() {
  2 + local ret=1 state
  3 + _arguments ':subcommand:->subcommand' && ret=0
  4 +
  5 + case $state in
  6 + subcommand)
  7 + subcommands=(
  8 + "build:Build the project(s) in this directory/configuration"
  9 + "install:Build executables and install to a user path"
  10 + "test:Build and test the project(s) in this directory/configuration"
  11 + "bench:Build and benchmark the project(s) in this directory/configuration"
  12 + "haddock:Generate haddocks for the project(s) in this directory/configuration"
  13 + "new:Create a brand new project"
  14 + "init:Initialize a stack project based on one or more stack packages"
  15 + "solver:Use a dependency solver to try and determine missing extra-deps"
  16 + "setup:Get the appropriate ghc for your project"
  17 + "path:Print out handy path information"
  18 + "unpack:Unpack one or more packages locally"
  19 + "update:Update the package index"
  20 + "upgrade:Upgrade to the latest stack (experimental)"
  21 + "upload:Upload a package to Hackage"
  22 + "dot:Visualize your project's dependency graph using Graphviz dot"
  23 + "exec:Execute a command"
  24 + "ghc:Run ghc"
  25 + "ghci:Run ghci in the context of project(s)"
  26 + "ide:Run ide-backend-client with the correct arguments"
  27 + "runghc:Run runghc"
  28 + "clean:Clean the local packages"
  29 + "docker:Subcommands specific to Docker use"
  30 + )
  31 + _describe -t subcommands 'stack subcommands' subcommands && ret=0
  32 + esac
  33 +
  34 + return ret
  35 +}
  36 +
  37 +compdef _stack_commands stack
plugins/sublime/sublime.plugin.zsh
1   -# Sublime Text 2 Aliases
2   -
3 1 if [[ $('uname') == 'Linux' ]]; then
4 2 local _sublime_linux_paths > /dev/null 2>&1
5 3 _sublime_linux_paths=(
... ... @@ -33,7 +31,6 @@ elif [[ &quot;$OSTYPE&quot; = darwin* ]]; then
33 31 "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
34 32 "$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
35 33 )
36   -
37 34 for _sublime_path in $_sublime_darwin_paths; do
38 35 if [[ -a $_sublime_path ]]; then
39 36 subl () { "$_sublime_path" $* }
... ... @@ -41,6 +38,21 @@ elif [[ &quot;$OSTYPE&quot; = darwin* ]]; then
41 38 break
42 39 fi
43 40 done
  41 +
  42 +elif [[ "$OSTYPE" = 'cygwin' ]]; then
  43 + local _sublime_cygwin_paths > /dev/null 2>&1
  44 + _sublime_cygwin_paths=(
  45 + "$(cygpath $ProgramW6432/Sublime\ Text\ 2)/sublime_text.exe"
  46 + "$(cygpath $ProgramW6432/Sublime\ Text\ 3)/sublime_text.exe"
  47 + )
  48 + for _sublime_path in $_sublime_cygwin_paths; do
  49 + if [[ -a $_sublime_path ]]; then
  50 + subl () { "$_sublime_path" $* }
  51 + alias st=subl
  52 + break
  53 + fi
  54 + done
  55 +
44 56 fi
45 57  
46 58 alias stt='st .'
plugins/sudo/sudo.plugin.zsh
... ... @@ -14,7 +14,11 @@
14 14  
15 15 sudo-command-line() {
16 16 [[ -z $BUFFER ]] && zle up-history
17   - [[ $BUFFER != sudo\ * ]] && LBUFFER="sudo $LBUFFER"
  17 + if [[ $BUFFER == sudo\ * ]]; then
  18 + LBUFFER="${LBUFFER#sudo }"
  19 + else
  20 + LBUFFER="sudo $LBUFFER"
  21 + fi
18 22 }
19 23 zle -N sudo-command-line
20 24 # Defined shortcut keys: [Esc] [Esc]
plugins/svn/svn.plugin.zsh
1 1 # vim:ft=zsh ts=2 sw=2 sts=2
2 2 #
3 3 function svn_prompt_info() {
  4 + local _DISPLAY
4 5 if in_svn; then
5 6 if [ "x$SVN_SHOW_BRANCH" = "xtrue" ]; then
6 7 unset SVN_SHOW_BRANCH
7 8 _DISPLAY=$(svn_get_branch_name)
8 9 else
9 10 _DISPLAY=$(svn_get_repo_name)
  11 + _DISPLAY=$(omz_urldecode "${_DISPLAY}")
10 12 fi
11 13 echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\
12 14 $ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$(svn_dirty_pwd)$ZSH_PROMPT_BASE_COLOR"
13   - unset _DISPLAY
14 15 fi
15 16 }
16 17  
... ... @@ -30,7 +31,7 @@ function svn_get_repo_name() {
30 31 }
31 32  
32 33 function svn_get_branch_name() {
33   - _DISPLAY=$(
  34 + local _DISPLAY=$(
34 35 svn info 2> /dev/null | \
35 36 awk -F/ \
36 37 '/^URL:/ { \
... ... @@ -49,7 +50,6 @@ function svn_get_branch_name() {
49 50 else
50 51 echo $_DISPLAY
51 52 fi
52   - unset _DISPLAY
53 53 }
54 54  
55 55 function svn_get_rev_nr() {
... ... @@ -60,7 +60,7 @@ function svn_get_rev_nr() {
60 60  
61 61 function svn_dirty_choose() {
62 62 if in_svn; then
63   - root=`svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p'`
  63 + local root=`svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p'`
64 64 if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then
65 65 # Grep exits with 0 when "One or more lines were selected", return "dirty".
66 66 echo $1
... ... @@ -77,7 +77,7 @@ function svn_dirty() {
77 77  
78 78 function svn_dirty_choose_pwd () {
79 79 if in_svn; then
80   - root=$PWD
  80 + local root=$PWD
81 81 if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then
82 82 # Grep exits with 0 when "One or more lines were selected", return "dirty".
83 83 echo $1
plugins/symfony2/symfony2.plugin.zsh
... ... @@ -5,7 +5,7 @@ _symfony_console () {
5 5 }
6 6  
7 7 _symfony2_get_command_list () {
8   - `_symfony_console` --no-ansi | sed "1,/Available commands/d" | awk '/^ ?[a-z]+/ { print $1 }'
  8 + `_symfony_console` --no-ansi | sed "1,/Available commands/d" | awk '/^ ?[^ ]+ / { print $1 }'
9 9 }
10 10  
11 11 _symfony2 () {
plugins/systemadmin/systemadmin.plugin.zsh
... ... @@ -140,12 +140,16 @@ d0() {
140 140  
141 141 # gather external ip address
142 142 geteip() {
143   - curl http://ifconfig.me
  143 + curl -s -S https://icanhazip.com
144 144 }
145 145  
146 146 # determine local IP address
147 147 getip() {
148   - ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
  148 + if (( ${+commands[ip]} )); then
  149 + ip addr | grep "inet " | grep -v '127.0.0.1' | awk '{print $2}'
  150 + else
  151 + ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
  152 + fi
149 153 }
150 154  
151 155 # Clear zombie processes
plugins/systemd/systemd.plugin.zsh
... ... @@ -10,3 +10,7 @@ sudo_commands=(
10 10  
11 11 for c in $user_commands; do; alias sc-$c="systemctl $c"; done
12 12 for c in $sudo_commands; do; alias sc-$c="sudo systemctl $c"; done
  13 +
  14 +alias sc-enable-now="sc-enable --now"
  15 +alias sc-disable-now="sc-disable --now"
  16 +alias sc-mask-now="sc-mask --now"
plugins/taskwarrior/README.md
... ... @@ -0,0 +1,13 @@
  1 +# taskwarrior
  2 +
  3 +This plugin adds smart tab completion for [TaskWarrior](http://taskwarrior.org/).
  4 +It uses the zsh tab completion script (`_task`) shipped with TaskWarrior for the
  5 +completion definitions.
  6 +
  7 +The latest version pulled in from the official project is of January 1st, 2015.
  8 +
  9 +
  10 +## Examples
  11 +
  12 +Typing `task [TAB]` will give you a list of commands, `task 66[TAB]` shows a
  13 +list of available modifications for that task, etcetera.
plugins/taskwarrior/_task
1 1 #compdef task
2   -# zsh completion for taskwarrior
3 2 #
4   -# taskwarrior - a command line task list manager.
5   -#
6   -# Copyright 2010 - 2011 Johannes Schlatow
  3 +# Copyright 2010 - 2015 Johannes Schlatow
7 4 # Copyright 2009 P.C. Shyamshankar
8 5 #
9 6 # Permission is hereby granted, free of charge, to any person obtaining a copy
... ... @@ -30,31 +27,40 @@ typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers
30 27 _task_projects=($(task _projects))
31 28 _task_tags=($(task _tags))
32 29 _task_ids=($(task _ids))
  30 +_task_zshids=( ${(f)"$(task _zshids)"} )
33 31 _task_config=($(task _config))
34 32 _task_columns=($(task _columns))
35 33 _task_modifiers=(
36   - 'before' \
37   - 'after' \
38   - 'none' \
39   - 'any' \
40   - 'is' \
41   - 'isnt' \
42   - 'has' \
43   - 'hasnt' \
44   - 'startswith' \
45   - 'endswith' \
46   - 'word' \
47   - 'noword'
  34 + 'before' \
  35 + 'after' \
  36 + 'none' \
  37 + 'any' \
  38 + 'is' \
  39 + 'isnt' \
  40 + 'has' \
  41 + 'hasnt' \
  42 + 'startswith' \
  43 + 'endswith' \
  44 + 'word' \
  45 + 'noword'
48 46 )
49 47 _task_conjunctions=(
50   - 'and' \
51   - 'or' \
52   - 'xor' \
53   - '\)'
54   - '\('
  48 + 'and' \
  49 + 'or' \
  50 + 'xor' \
  51 + '\)' \
  52 + '\(' \
  53 + '<' \
  54 + '<=' \
  55 + '=' \
  56 + '!=' \
  57 + '>=' \
  58 + '>'
55 59 )
56   -_task_cmds=($(task _commands))
57   -_task_zshcmds=( ${(f)"$(task _zshcommands)"} )
  60 +_task_cmds=($(task _commands; task _aliases))
  61 +_task_zshcmds=( ${(f)"$(task _zshcommands)"} sentinel:sentinel:sentinel )
  62 +
  63 +_task_aliases=($(task _aliases))
58 64  
59 65 _task() {
60 66 _arguments -s -S \
... ... @@ -68,110 +74,130 @@ word=$&#39;[^\0]#\0&#39;
68 74 # priorities
69 75 local -a task_priorities
70 76 _regex_words values 'task priorities' \
71   - 'H:High' \
72   - 'M:Middle' \
73   - 'L:Low'
  77 + 'H:High' \
  78 + 'M:Middle' \
  79 + 'L:Low'
74 80 task_priorities=("$reply[@]")
75 81  
76 82 # projects
77 83 local -a task_projects
78 84 task_projects=(
79   - /"$word"/
80   - ":values:task projects:compadd -a _task_projects"
  85 + /"$word"/
  86 + ":values:task projects:compadd -a _task_projects"
81 87 )
82 88  
83 89 local -a _task_dates
84 90 _regex_words values 'task dates' \
85   - 'tod*ay:Today' \
86   - 'yes*terday:Yesterday' \
87   - 'tom*orrow:Tomorrow' \
88   - 'sow:Start of week' \
89   - 'soww:Start of work week' \
90   - 'socw:Start of calendar week' \
91   - 'som:Start of month' \
92   - 'soy:Start of year' \
93   - 'eow:End of week' \
94   - 'eoww:End of work week' \
95   - 'eocw:End of calendar week' \
96   - 'eom:End of month' \
97   - 'eoy:End of year' \
98   - 'mon:Monday' \
99   - 'tue:Tuesday'\
100   - 'wed:Wednesday' \
101   - 'thu:Thursday' \
102   - 'fri:Friday' \
103   - 'sat:Saturday' \
104   - 'sun:Sunday'
  91 + 'tod*ay:Today' \
  92 + 'yes*terday:Yesterday' \
  93 + 'tom*orrow:Tomorrow' \
  94 + 'sow:Start of week' \
  95 + 'soww:Start of work week' \
  96 + 'socw:Start of calendar week' \
  97 + 'som:Start of month' \
  98 + 'soq:Start of quarter' \
  99 + 'soy:Start of year' \
  100 + 'eow:End of week' \
  101 + 'eoww:End of work week' \
  102 + 'eocw:End of calendar week' \
  103 + 'eom:End of month' \
  104 + 'eoq:End of quarter' \
  105 + 'eoy:End of year' \
  106 + 'mon:Monday' \
  107 + 'tue:Tuesday'\
  108 + 'wed:Wednesday' \
  109 + 'thu:Thursday' \
  110 + 'fri:Friday' \
  111 + 'sat:Saturday' \
  112 + 'sun:Sunday' \
  113 + 'good*friday:Good Friday' \
  114 + 'easter:Easter' \
  115 + 'eastermonday:Easter Monday' \
  116 + 'ascension:Ascension' \
  117 + 'pentecost:Pentecost' \
  118 + 'midsommar:Midsommar' \
  119 + 'midsommarafton:Midsommarafton' \
  120 + 'later:Later' \
  121 + 'someday:Some Day'
105 122 _task_dates=("$reply[@]")
106 123  
107 124 local -a _task_reldates
108 125 _regex_words values 'task reldates' \
109   - 'hrs:n hours' \
110   - 'day:n days' \
111   - '1st:first' \
112   - '2nd:second' \
113   - '3rd:third' \
114   - 'th:4th, 5th, etc.' \
115   - 'wks:weeks'
  126 + 'hrs:n hours' \
  127 + 'day:n days' \
  128 + '1st:first' \
  129 + '2nd:second' \
  130 + '3rd:third' \
  131 + 'th:4th, 5th, etc.' \
  132 + 'wks:weeks'
116 133 _task_reldates=("$reply[@]")
117 134  
118 135 task_dates=(
119   - \( "$_task_dates[@]" \|
  136 + \( "$_task_dates[@]" \|
120 137 \( /$'[0-9][0-9]#'/- \( "$_task_reldates[@]" \) \)
121   - \)
  138 + \)
122 139 )
123 140  
  141 +local -a task_zshids
  142 +_regex_words values 'task IDs' $_task_zshids
  143 +task_zshids=("$reply[@]")
  144 +
124 145 _regex_words values 'task frequencies' \
125   - 'daily:Every day' \
126   - 'day:Every day' \
127   - 'weekdays:Every day skipping weekend days' \
128   - 'weekly:Every week' \
129   - 'biweekly:Every two weeks' \
130   - 'fortnight:Every two weeks' \
131   -+ 'monthly:Every month' \
132   - 'quarterly:Every three months' \
133   - 'semiannual:Every six months' \
134   - 'annual:Every year' \
135   - 'yearly:Every year' \
136   - 'biannual:Every two years' \
137   - 'biyearly:Every two years'
  146 + 'daily:Every day' \
  147 + 'day:Every day' \
  148 + 'weekdays:Every day skipping weekend days' \
  149 + 'weekly:Every week' \
  150 + 'biweekly:Every two weeks' \
  151 + 'fortnight:Every two weeks' \
  152 + 'monthly:Every month' \
  153 + 'quarterly:Every three months' \
  154 + 'semiannual:Every six months' \
  155 + 'annual:Every year' \
  156 + 'yearly:Every year' \
  157 + 'biannual:Every two years' \
  158 + 'biyearly:Every two years'
138 159 _task_freqs=("$reply[@]")
139 160  
140 161 local -a _task_frequencies
141 162 _regex_words values 'task frequencies' \
142   - 'd:days' \
143   - 'w:weeks' \
144   - 'q:quarters' \
145   - 'y:years'
  163 + 'd:days' \
  164 + 'w:weeks' \
  165 + 'q:quarters' \
  166 + 'y:years'
146 167 _task_frequencies=("$reply[@]")
147 168  
148 169 task_freqs=(
149   - \( "$_task_freqs[@]" \|
  170 + \( "$_task_freqs[@]" \|
150 171 \( /$'[0-9][0-9]#'/- \( "$_task_frequencies[@]" \) \)
151   - \)
  172 + \)
152 173 )
153 174  
154 175 # attributes
155 176 local -a task_attributes
156 177 _regex_words -t ':' default 'task attributes' \
157   - 'pro*ject:Project name:$task_projects' \
158   - 'du*e:Due date:$task_dates' \
159   - 'wa*it:Date until task becomes pending:$task_dates' \
160   - 're*cur:Recurrence frequency:$task_freqs' \
161   - 'pri*ority:priority:$task_priorities' \
162   - 'un*til:Recurrence end date:$task_dates' \
163   - 'fg:Foreground color' \
164   - 'bg:Background color' \
165   - 'li*mit:Desired number of rows in report'
  178 + 'des*cription:Task description text' \
  179 + 'status:Status of task - pending, completed, deleted, waiting' \
  180 + 'pro*ject:Project name:$task_projects' \
  181 + 'pri*ority:priority:$task_priorities' \
  182 + 'du*e:Due date:$task_dates' \
  183 + 're*cur:Recurrence frequency:$task_freqs' \
  184 + 'un*til:Expiration date:$task_dates' \
  185 + 'li*mit:Desired number of rows in report' \
  186 + 'wa*it:Date until task becomes pending:$task_dates' \
  187 + 'ent*ry:Date task was created:$task_dates' \
  188 + 'end:Date task was completed/deleted:$task_dates' \
  189 + 'st*art:Date task was started:$task_dates' \
  190 + 'sc*heduled:Date task is scheduled to start:$task_dates' \
  191 + 'dep*ends:Other tasks that this task depends upon:$task_zshids'
166 192 task_attributes=("$reply[@]")
167 193  
168 194 args=(
169   - \( "$task_attributes[@]" \|
170   - \( /'(project|due|wait|recur|priority|until|fg|bg|limit).'/- \( /$'[^:]#:'/ ":default:modifiers:compadd -S ':' -a _task_modifiers" \) \) \|
171   - \( /'(rc).'/- \( /$'[^:]#:'/ ":arguments:config:compadd -S ':' -a _task_config" \) \) \|
172   - \( /'(+|-)'/- \( /"$word"/ ":values:remove tag:compadd -a _task_tags" \) \) \|
173   - \( /"$word"/ \)
174   - \) \#
  195 + \( "$task_attributes[@]" \|
  196 + \( /'(project|description|status|entry|end|start|scheduled|depends|due|wait|recur|priority|until|limit).'/- \( /$'[^:]#:'/ ":default:modifiers:compadd -S ':' -a _task_modifiers" \) \) \|
  197 + \( /'(rc).'/- \( /$'[^:]#:'/ ":arguments:config:compadd -S ':' -a _task_config" \) \) \|
  198 + \( /'(+|-)'/- \( /"$word"/ ":values:remove tag:compadd -a _task_tags" \) \) \|
  199 + \( /"$word"/ \)
  200 + \) \#
175 201 )
176 202 _regex_arguments _task_attributes "${args[@]}"
177 203  
... ... @@ -180,43 +206,50 @@ _regex_arguments _task_attributes &quot;${args[@]}&quot;
180 206 # filter completion
181 207 (( $+functions[_task_filter] )) ||
182 208 _task_filter() {
183   - _task_attributes "$@"
184   -
185   - # TODO complete conjunctions only if the previous word is a filter expression, i.e. attribute, ID, any non-command
186   - _describe -t default 'task conjunctions' _task_conjunctions
187   -}
188   -
189   -# merge completion
190   -(( $+functions[_task_merge] )) ||
191   -_task_merge() {
192   - # TODO match URIs in .taskrc
193   - _files
194   -}
195   -
196   -# push completion
197   -(( $+functions[_task_push] )) ||
198   -_task_push() {
199   - # TODO match URIs in .taskrc
200   - _files
201   -}
  209 + _task_attributes "$@"
202 210  
203   -# pull completion
204   -(( $+functions[_task_pull] )) ||
205   -_task_pull() {
206   - # TODO match URIs in .taskrc
207   - _files
  211 + # TODO complete conjunctions only if the previous word is a filter expression, i.e. attribute, ID, any non-command
  212 + _describe -t default 'task conjunctions' _task_conjunctions
208 213 }
209 214  
210 215 # execute completion
211 216 (( $+functions[_task_execute] )) ||
212 217 _task_execute() {
213   - _files
  218 + _files
214 219 }
215 220  
216 221 # id-only completion
217 222 (( $+functions[_task_id] )) ||
218 223 _task_id() {
219   - _describe -t values 'task IDs' _task_zshids
  224 + _describe -t values 'task IDs' _task_zshids
  225 +}
  226 +
  227 +# subcommand-only function
  228 +(( $+functions[_task_subcommands] )) ||
  229 +_task_subcommands() {
  230 + local -a subcommands
  231 + local _zshcmd
  232 + local cmd category desc
  233 + local lastcategory=''
  234 + # The list is sorted by category, in the right order.
  235 + for _zshcmd in "$_task_zshcmds[@]"; do
  236 + # Parse out the three fields
  237 + cmd=${_zshcmd%%:*}
  238 + category=${${_zshcmd#*:}%%:*}
  239 + desc=${_zshcmd#*:*:}
  240 +
  241 + # Present each category as soon as the first entry in the *next* category
  242 + # is seen.
  243 + if [[ $category != $lastcategory && -n $lastcategory ]]; then
  244 + _describe -t ${lastcategory}-commands "task ${lastcategory} command" subcommands
  245 + subcommands=()
  246 + fi
  247 +
  248 + # Log the subcommand; we will process it in some future iteration.
  249 + subcommands+=( "$cmd:$desc" )
  250 +
  251 + lastcategory=$category
  252 + done
220 253 }
221 254  
222 255 ## first level completion => task sub-command completion
... ... @@ -224,27 +257,28 @@ _task_id() {
224 257 _task_default() {
225 258 local cmd ret=1
226 259  
227   - integer i=1
228   - while (( i < $#words ))
229   - do
230   - cmd="${_task_cmds[(r)$words[$i]]}"
231   - if (( $#cmd )); then
232   - _call_function ret _task_${cmd} ||
233   - _call_function ret _task_filter ||
234   - _message "No command remaining."
235   - return ret
236   - fi
237   - (( i++ ))
238   - done
239   -
240   - # update IDs
241   - _task_zshids=( ${(f)"$(task _zshids)"} )
242   -
243   - _describe -t commands 'task command' _task_zshcmds
244   - _describe -t values 'task IDs' _task_zshids
245   - _call_function ret _task_filter
246   -
247   - return ret
  260 + integer i=1
  261 + while (( i < $#words ))
  262 + do
  263 + cmd="${_task_cmds[(r)$words[$i]]}"
  264 + if (( $#cmd )); then
  265 + _call_function ret _task_${cmd} ||
  266 + _call_function ret _task_filter ||
  267 + _message "No command remaining."
  268 + return ret
  269 + fi
  270 + (( i++ ))
  271 + done
  272 +
  273 + # update IDs
  274 + _task_zshids=( ${(f)"$(task _zshids)"} )
  275 +
  276 + _task_subcommands
  277 + _describe -t tasks 'task IDs' _task_zshids
  278 + _describe -t aliases 'task aliases' _task_aliases
  279 + _call_function ret _task_filter
  280 +
  281 + return ret
248 282 }
249 283  
250   -_task
  284 +_task "$@"
plugins/taskwarrior/taskwarrior.plugin.zsh
1   -################################################################################
2   -# Author: Pete Clark
3   -# Email: pete[dot]clark[at]gmail[dot]com
4   -# Version: 0.1 (05/24/2011)
5   -# License: WTFPL<http://sam.zoy.org/wtfpl/>
6   -#
7   -# This oh-my-zsh plugin adds smart tab completion for
8   -# TaskWarrior<http://taskwarrior.org/>. It uses the zsh tab completion
9   -# script (_task) distributed with TaskWarrior for the completion definitions.
10   -#
11   -# Typing task [tabtab] will give you a list of current tasks, task 66[tabtab]
12   -# gives a list of available modifications for that task, etc.
13   -################################################################################
14   -
15 1 zstyle ':completion:*:*:task:*' verbose yes
16 2 zstyle ':completion:*:*:task:*:descriptions' format '%U%B%d%b%u'
17 3  
plugins/terminalapp/terminalapp.plugin.zsh
1   -# Set Apple Terminal.app resume directory
2   -# based on this answer: http://superuser.com/a/315029
3   -# 2012-10-26: (javageek) Changed code using the updated answer
4   -
5   -# Tell the terminal about the working directory whenever it changes.
6   -if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
7   - update_terminal_cwd() {
8   - # Identify the directory using a "file:" scheme URL, including
9   - # the host name to disambiguate local vs. remote paths.
10   -
11   - # Percent-encode the pathname.
12   - local URL_PATH=''
13   - {
14   - # Use LANG=C to process text byte-by-byte.
15   - local i ch hexch LANG=C
16   - for ((i = 1; i <= ${#PWD}; ++i)); do
17   - ch="$PWD[i]"
18   - if [[ "$ch" =~ [/._~A-Za-z0-9-] ]]; then
19   - URL_PATH+="$ch"
20   - else
21   - hexch=$(printf "%02X" "'$ch")
22   - URL_PATH+="%$hexch"
23   - fi
24   - done
25   - }
26   -
27   - local PWD_URL="file://$HOST$URL_PATH"
28   - #echo "$PWD_URL" # testing
29   - printf '\e]7;%s\a' "$PWD_URL"
30   - }
31   -
32   - # Register the function so it is called whenever the working
33   - # directory changes.
34   - autoload add-zsh-hook
35   - add-zsh-hook precmd update_terminal_cwd
36   -
37   - # Tell the terminal about the initial directory.
38   - update_terminal_cwd
39   -fi
  1 +# This file is intentionally empty.
  2 +#
  3 +# The terminalapp plugin is deprecated and may be removed in a future release.
  4 +# Its functionality has been folded in to the core lib/termsupport.zsh, which
  5 +# is loaded for all users. You can remove terminalapp from your $plugins list
  6 +# once all your systems are updated to the current version of Oh My Zsh.
plugins/textmate/textmate.plugin.zsh
1   -alias et='mate .'
2   -alias ett='mate Gemfile app config features lib db public spec test Rakefile Capfile Todo'
3   -alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
4   -alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
5   -
6   -# Edit Ruby app in TextMate
7   -alias mr='mate CHANGELOG app config db lib public script spec test'
8   -
9 1 # If the tm command is called without an argument, open TextMate in the current directory
10 2 # If tm is passed a directory, cd to it and open it in TextMate
11 3 # If tm is passed a file, open it in TextMate
plugins/thefuck/README.md
... ... @@ -0,0 +1,9 @@
  1 +# The Fuck
  2 +
  3 +[The Fuck](https://github.com/nvbn/thefuck) plugin — magnificent app which corrects your previous console command.
  4 +
  5 +## Usage
  6 +Press `ESC` twice to correct previous console command.
  7 +
  8 +## Notes
  9 +`Esc`-`Esc` key binding conflicts with [sudo](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/sudo) plugin.
plugins/thefuck/thefuck.plugin.zsh
... ... @@ -0,0 +1,17 @@
  1 +if [[ -z $commands[thefuck] ]]; then
  2 + echo 'thefuck is not installed, you should "pip install thefuck" first'
  3 + return -1
  4 +fi
  5 +
  6 +# Register alias
  7 +eval "$(thefuck --alias)"
  8 +
  9 +fuck-command-line() {
  10 + local FUCK="$(THEFUCK_REQUIRE_CONFIRMATION=0 thefuck $(fc -ln -1 | tail -n 1) 2> /dev/null)"
  11 + [[ -z $FUCK ]] && echo -n -e "\a" && return
  12 + BUFFER=$FUCK
  13 + zle end-of-line
  14 +}
  15 +zle -N fuck-command-line
  16 +# Defined shortcut keys: [Esc] [Esc]
  17 +bindkey "\e\e" fuck-command-line
plugins/ubuntu/ubuntu.plugin.zsh
... ... @@ -3,6 +3,7 @@
3 3 # https://github.com/dbb
4 4 # https://github.com/Mappleconfusers
5 5 # Nicolas Jonas nextgenthemes.com
  6 +# https://github.com/loctauxphilippe
6 7 #
7 8 # Debian, Ubuntu and friends related zsh aliases and functions for zsh
8 9  
... ... @@ -28,6 +29,7 @@ compdef _ppap ppap=&#39;sudo ppa-purge&#39;
28 29  
29 30 alias ag='sudo apt-get' # age - but without sudo
30 31 alias aga='sudo apt-get autoclean' # aac
  32 +alias agar='sudo apt-get autoremove'
31 33 alias agb='sudo apt-get build-dep' # abd
32 34 alias agc='sudo apt-get clean' # adc
33 35 alias agd='sudo apt-get dselect-upgrade' # ads
... ... @@ -38,9 +40,11 @@ alias agu=&#39;sudo apt-get update&#39; # ad
38 40 alias agud='sudo apt-get update && sudo apt-get dist-upgrade' #adu
39 41 alias agug='sudo apt-get upgrade' # ag
40 42 alias aguu='sudo apt-get update && sudo apt-get upgrade' #adg
  43 +alias agar='sudo apt-get autoremove'
41 44  
42 45 compdef _ag ag='sudo apt-get'
43 46 compdef _aga aga='sudo apt-get autoclean'
  47 +compdef _agar agar='sudo apt-get autoremove'
44 48 compdef _agb agb='sudo apt-get build-dep'
45 49 compdef _agc agc='sudo apt-get clean'
46 50 compdef _agd agd='sudo apt-get dselect-upgrade'
... ... @@ -51,6 +55,7 @@ compdef _agu agu=&#39;sudo apt-get update&#39;
51 55 compdef _agud agud='sudo apt-get update && sudo apt-get dist-upgrade'
52 56 compdef _agug agug='sudo apt-get upgrade'
53 57 compdef _aguu aguu='sudo apt-get update && sudo apt-get upgrade'
  58 +compdef _agar agar='sudo apt-get autoremove'
54 59  
55 60 # Remove ALL kernel images and headers EXCEPT the one in use
56 61 alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
... ... @@ -65,7 +70,7 @@ alias mydeb=&#39;time dpkg-buildpackage -rfakeroot -us -uc&#39;
65 70  
66 71 # apt-add-repository with automatic install/upgrade of the desired package
67 72 # Usage: aar ppa:xxxxxx/xxxxxx [packagename]
68   -# If packagename is not given as 2nd arument the function will ask for it and guess the defaupt by taking
  73 +# If packagename is not given as 2nd argument the function will ask for it and guess the default by taking
69 74 # the part after the / from the ppa name wich is sometimes the right name for the package you want to install
70 75 aar() {
71 76 if [ -n "$2" ]; then
plugins/vagrant/_vagrant
1   -#compdef vagrant
  1 +#compdef vagrant
2 2 #autoload
3 3  
4 4 # vagrant zsh completion
... ... @@ -6,37 +6,45 @@
6 6 local -a _1st_arguments
7 7 _1st_arguments=(
8 8 'box:Box commands'
9   - 'connect:Connects to a shared, remote Vagrant environment'
  9 + 'connect:Connects to a remotely shared Vagrant environment'
10 10 'destroy:Destroys the vagrant environment'
11   - 'docker-logs:Shows Docker logs'
12   - 'docker-run:Run one-off commands against a Docker container'
  11 + 'docker-logs:Outputs the logs from the Docker container'
  12 + 'docker-run:Run a one-off command in the context of a container'
13 13 'global-status:Reports the status of all active Vagrant environments on the system'
14 14 'halt:Halts the currently running vagrant environment'
  15 + 'help:Shows the help for a subcommand'
15 16 'init:[box_name] [box_url] Initializes current folder for Vagrant usage'
  17 + 'list-commands:Outputs all available Vagrant subcommands, even non-primary ones'
16 18 'login:Authenticates against a Vagrant Cloud server to access protected boxes'
17 19 'package:Packages a vagrant environment for distribution'
18 20 'plugin:Plugin commands'
19 21 'provision:Run the provisioner'
  22 + 'push:Deploys code in this environment to a configured destination'
  23 + 'rdp:Connects to machine via RDP'
20 24 'reload:Reload the vagrant environment'
21 25 'resume:Resumes a suspend vagrant environment'
22   - 'share:Shares the Vagrant environment and allows remote access'
  26 + 'rsync:Syncs rsync synced folders to remote machine'
  27 + 'rsync-auto:Syncs rsync synced folders automatically when files change'
  28 + 'share:Shares your Vagrant environment with anyone in the world'
23 29 'ssh:SSH into the currently running environment'
24   - 'ssh-config:outputs .ssh/config valid syntax for connecting to this environment via ssh'
  30 + 'ssh-config:Outputs .ssh/config valid syntax for connecting to this environment via ssh'
25 31 'status:Shows the status of the current Vagrant environment'
26 32 'suspend:Suspends the currently running vagrant environment'
27 33 'up:Creates the vagrant environment'
28   - 'version:Prints the currently installed Vagrant version and checks for new updates'
  34 + 'version:Prints current and latest Vagrant version'
29 35 '--help:[TASK] Describe available tasks or one specific task'
30 36 '--version:Prints the Vagrant version information'
31 37 )
32 38  
33 39 local -a _box_arguments
34 40 _box_arguments=(
35   - 'add:NAME URI Add a box to the system'
36   - 'help:COMMAND Describe subcommands or one specific subcommand'
  41 + 'add:ADDRESS Adds a box to the system'
  42 + 'help:COMMAND List subcommands'
37 43 'list:Lists all installed boxes'
38   - 'remove:NAME Remove a box from the system'
39   - 'repackage:NAME Repackage an installed box into a `.box` file.'
  44 + 'outdated:Checks if a box has newer version'
  45 + 'remove:NAME Removes a box from the system'
  46 + 'repackage:NAME PROVIDER VERSION Repackages an installed box into a `.box` file'
  47 + 'update:Updates box to a newer version, if available'
40 48 )
41 49  
42 50 __task_list ()
... ... @@ -78,7 +86,7 @@ __vagrant-box ()
78 86 (options)
79 87 case $line[1] in
80 88 (repackage|remove)
81   - _arguments ':feature:__box_list'
  89 + _arguments ':feature:__box_list'
82 90 ;;
83 91 esac
84 92 ;;
... ... @@ -107,14 +115,14 @@ case $state in
107 115 (options)
108 116 case $line[1] in
109 117 (help)
110   - _arguments ':feature:__task_list'
  118 + _arguments ':feature:__task_list'
111 119 ;;
112 120  
113 121 (box)
114 122 __vagrant-box
115 123 ;;
116 124 (up|provision|package|destroy|reload|ssh|ssh-config|halt|resume|status)
117   - _arguments ':feature:__vm_list'
  125 + _arguments ':feature:__vm_list'
118 126 esac
119 127 ;;
120 128 esac
plugins/vi-mode/README.md
... ... @@ -61,8 +61,8 @@ Insertion
61 61 Delete and Insert
62 62 -----------------
63 63  
64   -- `ctrl-h` : While in *Insert mode*: delete character after the cursor
65   -- `ctrl-w` : While in *Insert mode*: delete word after the cursor
  64 +- `ctrl-h` : While in *Insert mode*: delete character before the cursor
  65 +- `ctrl-w` : While in *Insert mode*: delete word before the cursor
66 66 - `d{motion}` : Delete text that {motion} moves over
67 67 - `dd` : Delete line
68 68 - `D` : Delete characters under the cursor until the end of the line
plugins/vim-interaction/vim-interaction.plugin.zsh
... ... @@ -4,17 +4,6 @@
4 4 # Derek Wyatt (derek@{myfirstnamemylastname}.org
5 5 #
6 6  
7   -function resolveFile
8   -{
9   - if [ -f "$1" ]; then
10   - echo $(readlink -f "$1")
11   - elif [[ "${1#/}" == "$1" ]]; then
12   - echo "$PWD/$1"
13   - else
14   - echo $1
15   - fi
16   -}
17   -
18 7 function callvim
19 8 {
20 9 if [[ $# == 0 ]]; then
... ... @@ -48,13 +37,10 @@ EOH
48 37 if [[ ${before#:} != $before && ${before%<cr>} == $before ]]; then
49 38 before="$before<cr>"
50 39 fi
51   - local files=""
52   - for f in $@
53   - do
54   - files="$files $(resolveFile $f)"
55   - done
56   - if [[ -n $files ]]; then
57   - files=':args! '"$files<cr>"
  40 + local files
  41 + if [[ $# -gt 0 ]]; then
  42 + # absolute path of files resolving symlinks (:A) and quoting special chars (:q)
  43 + files=':args! '"${@:A:q}<cr>"
58 44 fi
59 45 cmd="$before$files$after"
60 46 gvim --remote-send "$cmd"
plugins/vundle/vundle.plugin.zsh
1 1 function vundle-init () {
2   - if [ ! -d ~/.vim/bundle/vundle/ ]
  2 + if [ ! -d ~/.vim/bundle/Vundle.vim/ ]
3 3 then
4   - mkdir -p ~/.vim/bundle/vundle/
  4 + mkdir -p ~/.vim/bundle/Vundle.vim/
5 5 fi
6 6  
7   - if [ ! -d ~/.vim/bundle/vundle/.git ] && [ ! -f ~/.vim/bundle/vundle/.git ]
  7 + if [ ! -d ~/.vim/bundle/Vundle.vim/.git ] && [ ! -f ~/.vim/bundle/Vundle.vim/.git ]
8 8 then
9   - git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
10   - echo "\n\tRead about vim configuration for vundle at https://github.com/gmarik/vundle\n"
  9 + git clone git://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
  10 + echo "\n\tRead about vim configuration for vundle at https://github.com/VundleVim/Vundle.vim\n"
11 11 fi
12 12 }
13 13  
plugins/xcode/README.md
... ... @@ -0,0 +1,84 @@
  1 +# Xcode
  2 +
  3 +## Description
  4 +
  5 +This plugin provides a few utilities that can help you on your daily use of Xcode and iOS development.
  6 +
  7 +To start using it, add the `xcode` plugin to your `plugins` array in `~/.zshrc`:
  8 +
  9 +```zsh
  10 +plugins=(... xcode)
  11 +```
  12 +
  13 +
  14 +## Aliases
  15 +
  16 +| Alias | Description | Command |
  17 +|-------|------------------------------------------|------------------------------------------------|
  18 +| xcb | Build Xcode projects and workspaces | xcodebuild |
  19 +| xcdd | Purge all temporary build information | rm -rf ~/Library/Developer/Xcode/DerivedData/* |
  20 +| xcp | Show currently selected Xcode directory | xcode-select --print-path |
  21 +| xcsel | Select different Xcode directory by path | sudo xcode-select --switch |
  22 +
  23 +
  24 +
  25 +## Functions
  26 +
  27 +### `xc`
  28 +
  29 +Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory.
  30 +Returns 1 if it didn't find any relevant files.
  31 +
  32 +### `simulator`
  33 +
  34 +Opens the iOS Simulator from your command line, dependent on whichever is the active developer directory for Xcode. (That is, it respects the `xcsel` setting.)
  35 +
  36 +### `xcselv`
  37 +
  38 +Selects different Xcode installations by version name. This is like `xcsel`, except it takes just a version name as an argument instead of the full path to the Xcode installation. Uses the naming conventions described below.
  39 +
  40 +* `xcselv <version>` selects a version
  41 + * Example: `xcselv 6.2`
  42 +* `xcselv default` selects the default unversioned `Applications/Xcode.app`
  43 +* `xcselv` with no argument lists the available Xcode versions in a human-readable format
  44 +* `xcselv -l` lists the installed Xcode versions
  45 +* `xcselv -L` lists the installed Xcode versions in a short version-name-only format
  46 +* `xcselv -p` prints info about the active Xcode version
  47 +* `xcselv -h` prints a help message
  48 +
  49 +The option parsing for `xcselv` is naive. Options may not be combined, and only the first option is recognized.
  50 +
  51 +## Multiple Xcode Versions
  52 +
  53 +The `xcselv` command provides support for switching between different Xcode installations using just a version number. Different Xcode versions are identified by file naming conventions.
  54 +
  55 +### Versioned Xcode Naming Conventions
  56 +
  57 +Apple does not seem to explicitly define or provide tooling support for a naming convention or other organizational mechanism for managing versioned Xcode installations. Apple seems to have released beta versions with both `Xcode<version>.app` and `Xcode-<version>.app` style names in the past, and both styles show up in forum and blog discussions.
  58 +
  59 +We've adopted the following naming convention:
  60 +
  61 +* Versioned Xcode installations are identified by the name `Xcode-<version>` or `Xcode<version>`.
  62 +* The `-` separating `"Xcode"` and the version name is optional, and may be replaced by a space.
  63 +* The versioned name may be applied to the `Xcode.app` itself, or a subdirectory underneath `Applications/` containing it.
  64 +* You cannot version both the `Xcode.app` filename itself and the containing subfolder.
  65 +* Thus, all of the following are equivalent.
  66 + * `Applications/Xcode-<version>.app`
  67 + * `Applications/Xcode-<version>/Xcode.app`
  68 + * `Applications/Xcode<version>.app`
  69 + * `Applications/Xcode <version>.app`
  70 + * `Applications/Xcode <version>/Xcode.app`
  71 +* Both the system `/Applications/` and user `$HOME/Applications/` directories are searched.
  72 + * The user's `$HOME/Applications/` takes precedence over `/Applications` for a given version.
  73 + * If multiple naming variants within the same `Applications/` folder indicate the same version (for example, `Xcode-3.2.1.app`, `Xcode3.2.1.app`, and `Xcode-3.2.1/Xcode.app`), the precedence order is unspecified and implementation-dependent.
  74 +* The `<version>` may be any string that is valid in a filename.
  75 +* The special version name `"default"` refers to the "default" unversioned Xcode at `Applications/Xcode.app` (in either `/Applications/` or `$HOME/Applications/`).
  76 +* Version names may not start with ``"-"`` or whitespace.
  77 +
  78 +The restrictions on the naming convention may need to be tightened in the future. In particular, if there are other well-known applications whose names begin with the string `"Xcode"`, the strings allowed for `<version>` may need to be restricted to avoid colliding with other applications. If there's evidence that one of these naming techniques is strongly favored either in practice or by Apple, we may tighten the naming convention to favor it.
  79 +
  80 +## Caveats
  81 +
  82 +Using `xcsel` or `xcselv` to select an Xcode that is installed under your `$HOME` may break things for other users, depending on your system setup. We let you do this anyway because some people run OS X as effectively single-user, or have open permissions so this will work. You could also use `$DEVELOPER_DIR` as an alternative to `xcsel` that is scoped to the current user or session, instead of a global setting.
  83 +
  84 +This does not verify that the version name in the Xcode filename matches the actual version of that binary. It is the user's responsibility to get the names right.
plugins/xcode/_xcselv
... ... @@ -0,0 +1,19 @@
  1 +#compdef xcselv
  2 +#autoload
  3 +
  4 +function _xcselv_compl_list_versions() {
  5 + _omz_xcode_list_versions short
  6 +}
  7 +
  8 +_arguments \
  9 + '(-l -L -p)-h[prints a help message]' \
  10 + '(-L -p -h)-l[lists installed Xcode versions]' \
  11 + '(-l -p -h)-L[lists installed Xcode versions (long form)]' \
  12 + '(-h -l -L)-p[prints active Xcode version]' \
  13 + && ret=0
  14 +
  15 +local _xcode_versions
  16 +_xcode_versions=($(_xcselv_compl_list_versions))
  17 +_describe -t _xcode_versions 'version' _xcode_versions
  18 +
  19 +return 1
plugins/xcode/xcode.plugin.zsh
1   -#xc function courtesy of http://gist.github.com/subdigital/5420709
  1 +alias xcb='xcodebuild'
  2 +alias xcdd='rm -rf ~/Library/Developer/Xcode/DerivedData/*'
  3 +alias xcp='xcode-select --print-path'
  4 +alias xcsel='sudo xcode-select --switch'
  5 +
  6 +# original author: @subdigital
  7 +# source: http://gist.github.com/subdigital/5420709
2 8 function xc {
3   - xcode_proj=`ls | grep "\.xc" | sort -r | head -1`
4   - if [[ `echo -n $xcode_proj | wc -m` == 0 ]]
5   - then
  9 + local xcode_proj
  10 + xcode_proj=(*.{xcworkspace,xcodeproj}(N))
  11 +
  12 + if [[ ${#xcode_proj} -eq 0 ]]; then
6 13 echo "No xcworkspace/xcodeproj file found in the current directory."
  14 + return 1
7 15 else
8   - echo "Found $xcode_proj"
9   - open "$xcode_proj"
  16 + echo "Found ${xcode_proj[1]}"
  17 + open "${xcode_proj[1]}"
10 18 fi
11 19 }
12 20  
13   -function xcsel {
14   - sudo xcode-select --switch "$*"
  21 +# "XCode-SELect by Version" - select Xcode by just version number
  22 +# Uses naming convention:
  23 +# - different versions of Xcode are named Xcode-<version>.app or stored
  24 +# in a folder named Xcode-<version>
  25 +# - the special version name "default" refers to the "default" Xcode.app with no suffix
  26 +function xcselv {
  27 + emulate -L zsh
  28 + if [[ $# == 0 ]]; then
  29 + echo "xcselv: error: no option or argument given" >&2
  30 + echo "xcselv: see 'xcselv -h' for help" >&2
  31 + return 1
  32 + elif [[ $1 == "-p" ]]; then
  33 + _omz_xcode_print_active_version
  34 + return
  35 + elif [[ $1 == "-l" ]]; then
  36 + _omz_xcode_list_versions
  37 + return
  38 + elif [[ $1 == "-L" ]]; then
  39 + _omz_xcode_list_versions short
  40 + return
  41 + elif [[ $1 == "-h" ]]; then
  42 + _omz_xcode_print_xcselv_usage
  43 + return 0
  44 + elif [[ $1 == -* && $1 != "-" ]]; then
  45 + echo "xcselv: error: unrecognized option: $1" >&2
  46 + echo "xcselv: see 'xcselv -h' for help" >&2
  47 + return 1
  48 + fi
  49 + # Main case: "xcselv <version>" to select a version
  50 + local version=$1
  51 + local -A xcode_versions
  52 + _omz_xcode_locate_versions
  53 + if [[ -z ${xcode_versions[$version]} ]]; then
  54 + echo "xcselv: error: Xcode version '$version' not found" >&2
  55 + return 1
  56 + fi
  57 + app="${xcode_versions[$version]}"
  58 + echo "selecting Xcode $version: $app"
  59 + xcsel "$app"
15 60 }
16 61  
17   -alias xcb='xcodebuild'
18   -alias xcp='xcode-select --print-path'
19   -alias xcdd='rm -rf ~/Library/Developer/Xcode/DerivedData/*'
  62 +function _omz_xcode_print_xcselv_usage {
  63 + cat << EOF >&2
  64 +Usage:
  65 + xcselv <version>
  66 + xcselv [options]
  67 +
  68 +Options:
  69 + <version> set the active Xcode version
  70 + -h print this help message and exit
  71 + -p print the active Xcode version
  72 + -l list installed Xcode versions (long human-readable form)
  73 + -L list installed Xcode versions (short form, version names only)
  74 +EOF
  75 +}
  76 +
  77 +# Parses the Xcode version from a filename based on our conventions
  78 +# Only meaningful when called from other _omz_xcode functions
  79 +function _omz_xcode_parse_versioned_file {
  80 + local file=$1
  81 + local basename=${app:t}
  82 + local dir=${app:h}
  83 + local parent=${dir:t}
  84 + #echo "parent=$parent basename=$basename verstr=$verstr ver=$ver" >&2
  85 + local verstr
  86 + if [[ $parent == Xcode* ]]; then
  87 + if [[ $basename == "Xcode.app" ]]; then
  88 + # "Xcode-<version>/Xcode.app" format
  89 + verstr=$parent
  90 + else
  91 + # Both file and parent dir are versioned. Reject.
  92 + return 1;
  93 + fi
  94 + elif [[ $basename == Xcode*.app ]]; then
  95 + # "Xcode-<version>.app" format
  96 + verstr=${basename:r}
  97 + else
  98 + # Invalid naming pattern
  99 + return 1;
  100 + fi
20 101  
21   -if [[ -d $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app ]]; then
22   - alias simulator='open $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'
23   -else
24   - alias simulator='open $(xcode-select -p)/Applications/iOS\ Simulator.app'
25   -fi
  102 + local ver=${verstr#Xcode}
  103 + ver=${ver#[- ]}
  104 + if [[ -z $ver ]]; then
  105 + # Unversioned "default" installation location
  106 + ver="default"
  107 + fi
  108 + print -- "$ver"
  109 +}
  110 +
  111 +# Print the active version, using xcselv's notion of versions
  112 +function _omz_xcode_print_active_version {
  113 + emulate -L zsh
  114 + local -A xcode_versions
  115 + local versions version active_path
  116 + _omz_xcode_locate_versions
  117 + active_path=$(xcode-select -p)
  118 + active_path=${active_path%%/Contents/Developer*}
  119 + versions=(${(kni)xcode_versions})
  120 + for version ($versions); do
  121 + if [[ "${xcode_versions[$version]}" == $active_path ]]; then
  122 + printf "%s (%s)\n" $version $active_path
  123 + return
  124 + fi
  125 + done
  126 + printf "%s (%s)\n" "<unknown>" $active_path
  127 +}
  128 +
  129 +# Locates all the installed versions of Xcode on this system, for this
  130 +# plugin's internal use.
  131 +# Populates the $xcode_versions associative array variable
  132 +# Caller should local-ize $xcode_versions with `local -A xcode_versions`
  133 +function _omz_xcode_locate_versions {
  134 + emulate -L zsh
  135 + local -a app_dirs
  136 + local app_dir apps app xcode_ver
  137 + # In increasing precedence order:
  138 + app_dirs=(/Applications $HOME/Applications)
  139 + for app_dir ($app_dirs); do
  140 + apps=( $app_dir/Xcode*.app(N) $app_dir/Xcode*/Xcode.app(N) )
  141 + for app ($apps); do
  142 + xcode_ver=$(_omz_xcode_parse_versioned_file $app)
  143 + if [[ $? != 0 ]]; then
  144 + continue
  145 + fi
  146 + xcode_versions[$xcode_ver]=$app
  147 + done
  148 + done
  149 +}
  150 +
  151 +function _omz_xcode_list_versions {
  152 + emulate -L zsh
  153 + local -A xcode_versions
  154 + _omz_xcode_locate_versions
  155 + local width=1 width_i versions do_short=0
  156 + if [[ $1 == "short" ]]; then
  157 + do_short=1
  158 + fi
  159 + versions=(${(kni)xcode_versions})
  160 + for version ($versions); do
  161 + if [[ $#version > $width ]]; then
  162 + width=$#version;
  163 + fi
  164 + done
  165 + for version ($versions); do
  166 + if [[ $do_short == 1 ]]; then
  167 + printf "%s\n" $version
  168 + else
  169 + printf "%-${width}s -> %s\n" "$version" "${xcode_versions[$version]}"
  170 + fi
  171 + done
  172 +}
  173 +
  174 +function simulator {
  175 + local devfolder
  176 + devfolder="$(xcode-select -p)"
  177 +
  178 + # Xcode ≤ 5.x
  179 + if [[ -d "${devfolder}/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app" ]]; then
  180 + open "${devfolder}/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app"
  181 + # Xcode ≥ 6.x
  182 + elif [[ -d "${devfolder}/Applications/iOS Simulator.app" ]]; then
  183 + open "${devfolder}/Applications/iOS Simulator.app"
  184 + # Xcode ≥ 7.x
  185 + else
  186 + open "${devfolder}/Applications/Simulator.app"
  187 + fi
  188 +}
themes/agnoster.zsh-theme
... ... @@ -7,6 +7,9 @@
7 7 #
8 8 # In order for this theme to render correctly, you will need a
9 9 # [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
  10 +# Make sure you have a recent version: the code points that Powerline
  11 +# uses changed in 2012, and older versions will display incorrectly,
  12 +# in confusing ways.
10 13 #
11 14 # In addition, I recommend the
12 15 # [Solarized theme](https://github.com/altercation/solarized/) and, if you're
... ... @@ -27,12 +30,21 @@
27 30  
28 31 CURRENT_BG='NONE'
29 32  
30   -# Fix odd char on mac
31   -if [[ `uname` == 'Darwin' ]]; then
32   - SEGMENT_SEPARATOR='\ue0b0'
33   -else
34   - SEGMENT_SEPARATOR=''
35   -fi
  33 +# Special Powerline characters
  34 +
  35 +() {
  36 + local LC_ALL="" LC_CTYPE="en_US.UTF-8"
  37 + # NOTE: This segment separator character is correct. In 2012, Powerline changed
  38 + # the code points they use for their special characters. This is the new code point.
  39 + # If this is not working for you, you probably have an old version of the
  40 + # Powerline-patched fonts installed. Download and install the new version.
  41 + # Do not submit PRs to change this unless you have reviewed the Powerline code point
  42 + # history and have new information.
  43 + # This is defined using a Unicode escape sequence so it is unambiguously readable, regardless of
  44 + # what font the user is viewing this source code in. Do not replace the
  45 + # escape sequence with a single literal character.
  46 + SEGMENT_SEPARATOR=$'\ue0b0' # 
  47 +}
36 48  
37 49 # Begin a segment
38 50 # Takes two arguments, background and foreground. Both can be omitted,
... ... @@ -73,12 +85,18 @@ prompt_context() {
73 85  
74 86 # Git: branch/detached head, dirty status
75 87 prompt_git() {
  88 +
  89 + local PL_BRANCH_CHAR
  90 + () {
  91 + local LC_ALL="" LC_CTYPE="en_US.UTF-8"
  92 + PL_BRANCH_CHAR=$'\ue0a0' # 
  93 + }
76 94 local ref dirty mode repo_path
77 95 repo_path=$(git rev-parse --git-dir 2>/dev/null)
78 96  
79 97 if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
80 98 dirty=$(parse_git_dirty)
81   - ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"
  99 + ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
82 100 if [[ -n $dirty ]]; then
83 101 prompt_segment yellow black
84 102 else
... ... @@ -104,7 +122,7 @@ prompt_git() {
104 122 zstyle ':vcs_info:*' formats ' %u%c'
105 123 zstyle ':vcs_info:*' actionformats ' %u%c'
106 124 vcs_info
107   - echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_%% }${mode}"
  125 + echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
108 126 fi
109 127 }
110 128  
themes/amuse.zsh-theme
... ... @@ -12,10 +12,18 @@ PROMPT=&#39;
12 12 %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%}
13 13 $ '
14 14  
15   -ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}⭠ "
  15 +# Must use Powerline font, for \uE0A0 to render.
  16 +ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}\uE0A0 "
16 17 ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
17 18 ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!"
18 19 ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?"
19 20 ZSH_THEME_GIT_PROMPT_CLEAN=""
20 21  
21   -RPROMPT='%{$fg_bold[red]%}$(rbenv_version)%{$reset_color%}'
  22 +if [ -e ~/.rvm/bin/rvm-prompt ]; then
  23 + RPROMPT='%{$fg_bold[red]%}‹$(rvm_current)›%{$reset_color%}'
  24 +else
  25 + if which rbenv &> /dev/null; then
  26 + RPROMPT='%{$fg_bold[red]%}$(rbenv_version)%{$reset_color%}'
  27 + fi
  28 +fi
  29 +
themes/cypher.zsh-theme
1 1 # Based on evan's prompt
2 2 # Shows the exit status of the last command if non-zero
3 3 # Uses "#" instead of "»" when running with elevated privileges
4   -PROMPT="%m %{${fg_bold[red]}%}:: %{${fg[green]}%}%3~%(0?. . ${fg[red]}%? )%{${fg[blue]}%}»%{${reset_color}%} "
  4 +PROMPT="%m %{${fg_bold[red]}%}:: %{${fg[green]}%}%3~%(0?. . %{${fg[red]}%}%? )%{${fg[blue]}%}»%{${reset_color}%} "
themes/dogenpunk.zsh-theme
... ... @@ -3,7 +3,7 @@
3 3 MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}"
4 4 local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}"
5 5  
6   -PROMPT='%{$fg[blue]%}%m%{$reset_color%}%{$fg_bold[white]%} ओम् %{$reset_color%}%{$fg[cyan]%}%~:%{$reset_color%}$(git_time_since_commit)$(git_prompt_info)
  6 +PROMPT='%{$fg[blue]%}%m%{$reset_color%}%{$fg_bold[white]%} %{$reset_color%}%{$fg[cyan]%}%~:%{$reset_color%}$(git_time_since_commit)$(git_prompt_info)
7 7 %{$fg[red]%}%!%{$reset_color%} $(prompt_char) '
8 8  
9 9 ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[green]%}git%{$reset_color%}@%{$bg[white]%}%{$fg[black]%}"
themes/emotty.zsh-theme
... ... @@ -0,0 +1,99 @@
  1 +#!/usr/bin/env zsh
  2 +# ------------------------------------------------------------------------------
  3 +# FILE: emotty.zsh-theme
  4 +# DESCRIPTION: A varying emoji based theme
  5 +# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
  6 +# VERSION: 1.0.0
  7 +# DEPENDS: emotty plugin
  8 +# RECOMMENDS: Hasklig font
  9 +#
  10 +# This theme shows a different emoji for each tty at the main prompt.
  11 +#
  12 +# There are pre-defined different emoji sets to choose from, e.g.:
  13 +# emoji, stellar, floral, zodiac, love (see emotty plugin).
  14 +#
  15 +# To choose a different emotty set than the default (emoji)
  16 +# % export emotty_set=nature
  17 +#
  18 +# For the superuser (root) this theme shows a designated indicator
  19 +# and switches the foreground color to red
  20 +# (see root_prompt variable, default: skull).
  21 +# But you are using sudo (8) instead of designated a root shell, right‽
  22 +#
  23 +# When logged in via SSH the main prompt also shows the user- and hostname.
  24 +#
  25 +# The exit status of the last failed command is displayed in the window title
  26 +# along with an indicator (see warn_glyph variable, default: collision symbol).
  27 +# To clear it just run: $NULL, true or :
  28 +#
  29 +# The right prompt shows the current working directory (3 levels up) in cyan.
  30 +#
  31 +# When in a git repository the main prompt shows the current branch name
  32 +# with a branch indicator in yellow
  33 +# (see vcs_branch_glyph variable, default: Hasklig branch glyph).
  34 +#
  35 +# If there are modified files the prompt switches to red and shows an unstaged
  36 +# indicator (see vcs_unstaged_glyph variable, default: circled letter M).
  37 +#
  38 +# If there are staged files the prompt switches to green and shows an staged
  39 +# indicator (see vcs_staged_glyph variable, default: high voltage sign).
  40 +#
  41 +# In a git repository the right prompt shows the repository name in bold and
  42 +# prepends the current working directory subpath within the repository.
  43 +#
  44 +# When git currently performs an action such as merge or rebase, the action is
  45 +# displayed in red instead of the branch name and a special action indicator
  46 +# is shown (see vcs_action_glyph variable, default: chevron).
  47 +# ------------------------------------------------------------------------------
  48 +
  49 +user_prompt="$(emotty)"
  50 +root_prompt="$emoji[skull]"
  51 +warn_prompt="$emoji[collision_symbol]"
  52 +
  53 +vcs_unstaged_glyph="%{$emoji[circled_latin_capital_letter_m]$emoji2[emoji_style] %2G%}"
  54 +vcs_staged_glyph="%{$emoji[high_voltage_sign] %2G%}"
  55 +vcs_branch_glyph=$(print -P $'\Ue0a0') # 
  56 +vcs_action_glyph=$(print -P $'\U276f') # ❯
  57 +
  58 +red="$FG[001]"
  59 +yellow="$FG[003]"
  60 +green="$FG[002]"
  61 +cyan="$FG[014]"
  62 +
  63 +prompt_glyph="%{%(#.${root_prompt}.${user_prompt}) %2G%}"
  64 +
  65 +# Uncomment the next line if you also like to see the warn_prompt in the prompt on the right.
  66 +#last_command_failed="%(?.. %F{red}%1{${warn_prompt} %1G%}%?%f)"
  67 +
  68 +
  69 +setopt promptsubst
  70 +
  71 +autoload -U add-zsh-hook
  72 +autoload -Uz vcs_info
  73 +
  74 +zstyle ':vcs_info:*' enable git #hg svn cvs
  75 +zstyle ':vcs_info:*' get-revision false
  76 +zstyle ':vcs_info:*' check-for-changes true
  77 +zstyle ':vcs_info:git:*' unstagedstr "${red}${vcs_unstaged_glyph}"
  78 +zstyle ':vcs_info:*' stagedstr "${green}${vcs_staged_glyph}"
  79 +
  80 +# %(K|F){color} set (back|fore)ground color
  81 +# %(k|f) reset (back|fore)ground color
  82 +zstyle ':vcs_info:*' max-exports 3
  83 +zstyle ':vcs_info:*' nvcsformats "${prompt_glyph}" '%3~' ''
  84 +zstyle ':vcs_info:*' formats "${yellow}%u%c%b${vcs_branch_glyph}%f" '%S|' "$FX[bold]%r$FX[no-bold]"
  85 +zstyle ':vcs_info:*' actionformats "${red}%K{white}%a${vcs_action_glyph}%k%f" '%S|' "$FX[bold]%r$FX[no-bold]"
  86 +
  87 +red_if_root="%(!.%F{red}.)"
  88 +sshuser_on_host="${SSH_TTY:+%(!.$red.$yellow)%n@%m$reset_color}"
  89 +
  90 +PROMPT='${sshuser_on_host}${vcs_info_msg_0_}${red_if_root} '
  91 +RPROMPT='${cyan}${vcs_info_msg_1_##.|}${vcs_info_msg_2_}%f${last_command_failed}'
  92 +
  93 +emotty_title() {
  94 + title "${${?/[^0]*/$warn_prompt $?}/0/${prompt_glyph}}"
  95 +}
  96 +add-zsh-hook precmd emotty_title
  97 +add-zsh-hook precmd vcs_info
  98 +
  99 +# vim:ft=zsh ts=2 sw=2 sts=2
themes/gnzh.zsh-theme
1 1 # ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png
2 2 # Based on bira theme
3 3  
4   -# load some modules
5   -autoload -U zsh/terminfo # Used in the colour alias below
6 4 setopt prompt_subst
7 5  
8   -# make some aliases for the colours: (could use normal escape sequences too)
9   -for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
10   - eval PR_$color='%{$fg[${(L)color}]%}'
11   -done
12   -eval PR_NO_COLOR="%{$terminfo[sgr0]%}"
13   -eval PR_BOLD="%{$terminfo[bold]%}"
  6 +() {
  7 +
  8 +local PR_USER PR_USER_OP PR_PROMPT PR_HOST
14 9  
15 10 # Check the UID
16 11 if [[ $UID -ne 0 ]]; then # normal user
17   - eval PR_USER='${PR_GREEN}%n${PR_NO_COLOR}'
18   - eval PR_USER_OP='${PR_GREEN}%#${PR_NO_COLOR}'
19   - local PR_PROMPT='$PR_NO_COLOR➤ $PR_NO_COLOR'
  12 + PR_USER='%F{green}%n%f'
  13 + PR_USER_OP='%F{green}%#%f'
  14 + PR_PROMPT='%f➤ %f'
20 15 else # root
21   - eval PR_USER='${PR_RED}%n${PR_NO_COLOR}'
22   - eval PR_USER_OP='${PR_RED}%#${PR_NO_COLOR}'
23   - local PR_PROMPT='$PR_RED➤ $PR_NO_COLOR'
  16 + PR_USER='%F{red}%n%f'
  17 + PR_USER_OP='%F{red}%#%f'
  18 + PR_PROMPT='%F{red}➤ %f'
24 19 fi
25 20  
26 21 # Check if we are on SSH or not
27 22 if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
28   - eval PR_HOST='${PR_YELLOW}%M${PR_NO_COLOR}' #SSH
  23 + PR_HOST='%F{red}%M%f' # SSH
29 24 else
30   - eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' # no SSH
  25 + PR_HOST='%F{green}%M%f' # no SSH
31 26 fi
32 27  
33   -local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
34 28  
35   -local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}'
36   -local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}'
  29 +local return_code="%(?..%F{red}%? ↵%f)"
  30 +
  31 +local user_host="${PR_USER}%F{cyan}@${PR_HOST}"
  32 +local current_dir="%B%F{blue}%~%f%b"
37 33 local rvm_ruby=''
38   -if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect local user rvm installation
39   - rvm_ruby='%{$PR_RED%}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%{$PR_NO_COLOR%}'
40   -elif which rvm-prompt &> /dev/null; then # detect sysem-wide rvm installation
41   - rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}'
42   -elif which rbenv &> /dev/null; then # detect Simple Ruby Version management
43   - rvm_ruby='%{$PR_RED%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$PR_NO_COLOR%}'
  34 +if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect user-local rvm installation
  35 + rvm_ruby='%F{red}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%f'
  36 +elif which rvm-prompt &> /dev/null; then # detect system-wide rvm installation
  37 + rvm_ruby='%F{red}‹$(rvm-prompt i v g s)›%f'
  38 +elif which rbenv &> /dev/null; then # detect Simple Ruby Version Management
  39 + rvm_ruby='%F{red}‹$(rbenv version | sed -e "s/ (set.*$//")›%f'
44 40 fi
45   -local git_branch='$(git_prompt_info)%{$PR_NO_COLOR%}'
  41 +local git_branch='$(git_prompt_info)'
46 42  
47   -#PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}$PR_PROMPT "
48 43 PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
49 44 ╰─$PR_PROMPT "
50   -RPS1="${return_code}"
  45 +RPROMPT="${return_code}"
  46 +
  47 +ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹"
  48 +ZSH_THEME_GIT_PROMPT_SUFFIX="› %f"
51 49  
52   -ZSH_THEME_GIT_PROMPT_PREFIX="%{$PR_YELLOW%}‹"
53   -ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$PR_NO_COLOR%}"
  50 +}
themes/michelebologna.zsh-theme
... ... @@ -59,16 +59,17 @@ ZSH_THEME_GIT_PROMPT_PREFIX=&quot;&quot;
59 59 ZSH_THEME_GIT_PROMPT_SUFFIX=""
60 60 ZSH_THEME_GIT_PROMPT_DIRTY=""
61 61 ZSH_THEME_GIT_PROMPT_CLEAN=""
62   -ZSH_THEME_GIT_PROMPT_UNTRACKED="%%"
63   -ZSH_THEME_GIT_PROMPT_MODIFIED="*"
64   -ZSH_THEME_GIT_PROMPT_ADDED="+"
65   -ZSH_THEME_GIT_PROMPT_STASHED="$"
66   -ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE="="
  62 +ZSH_THEME_GIT_PROMPT_UNTRACKED="$blue%%"
  63 +ZSH_THEME_GIT_PROMPT_MODIFIED="$red*"
  64 +ZSH_THEME_GIT_PROMPT_ADDED="$green+"
  65 +ZSH_THEME_GIT_PROMPT_STASHED="$blue$"
  66 +ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE="$green="
67 67 ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=">"
68 68 ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="<"
69   -ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="<>"
  69 +ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="$red<>"
70 70  
71 71 PROMPT='$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)'
72   -PROMPT+='$(__git_ps1)'
  72 +GIT_PROMPT='$(out=$(git_prompt_info)$(git_prompt_status)$(git_remote_status);if [[ -n $out ]]; then printf %s " $white($green$out$white)$reset";fi)'
  73 +PROMPT+="$GIT_PROMPT"
73 74 PROMPT+=" $last_command_output%#$reset "
74 75 RPROMPT=''
themes/steeef.zsh-theme
... ... @@ -10,7 +10,7 @@
10 10 export VIRTUAL_ENV_DISABLE_PROMPT=1
11 11  
12 12 function virtualenv_info {
13   - [ $VIRTUAL_ENV ] && echo '('$fg[blue]`basename $VIRTUAL_ENV`%{$reset_color%}') '
  13 + [ $VIRTUAL_ENV ] && echo '('%F{blue}`basename $VIRTUAL_ENV`%f') '
14 14 }
15 15 PR_GIT_UPDATE=1
16 16  
... ... @@ -20,18 +20,18 @@ autoload -U add-zsh-hook
20 20 autoload -Uz vcs_info
21 21  
22 22 #use extended color pallete if available
23   -if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
  23 +if [[ $terminfo[colors] -ge 256 ]]; then
24 24 turquoise="%F{81}"
25 25 orange="%F{166}"
26 26 purple="%F{135}"
27 27 hotpink="%F{161}"
28 28 limegreen="%F{118}"
29 29 else
30   - turquoise="$fg[cyan]"
31   - orange="$fg[yellow]"
32   - purple="$fg[magenta]"
33   - hotpink="$fg[red]"
34   - limegreen="$fg[green]"
  30 + turquoise="%F{cyan}"
  31 + orange="%F{yellow}"
  32 + purple="%F{magenta}"
  33 + hotpink="%F{red}"
  34 + limegreen="%F{green}"
35 35 fi
36 36  
37 37 # enable VCS systems you use
... ... @@ -48,7 +48,7 @@ zstyle &#39;:vcs_info:*:prompt:*&#39; check-for-changes true
48 48 # %a - action (e.g. rebase-i)
49 49 # %R - repository path
50 50 # %S - path in the repository
51   -PR_RST="%{${reset_color}%}"
  51 +PR_RST="%f"
52 52 FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})"
53 53 FMT_ACTION="(%{$limegreen%}%a${PR_RST})"
54 54 FMT_UNSTAGED="%{$orange%}●"
... ... @@ -96,5 +96,5 @@ function steeef_precmd {
96 96 add-zsh-hook precmd steeef_precmd
97 97  
98 98 PROMPT=$'
99   -%{$purple%}%n%{$reset_color%} at %{$orange%}%m%{$reset_color%} in %{$limegreen%}%~%{$reset_color%} $vcs_info_msg_0_$(virtualenv_info)%{$reset_color%}
  99 +%{$purple%}%n${PR_RST} at %{$orange%}%m${PR_RST} in %{$limegreen%}%~${PR_RST} $vcs_info_msg_0_$(virtualenv_info)
100 100 $ '
tools/check_for_upgrade.sh
... ... @@ -26,6 +26,9 @@ fi
26 26 # oh-my-zsh directory.
27 27 [[ -w "$ZSH" ]] || return 0
28 28  
  29 +# Cancel upgrade if git is unavailable on the system
  30 +whence git >/dev/null || return 0
  31 +
29 32 if [ -f ~/.zsh-update ]
30 33 then
31 34 . ~/.zsh-update
... ... @@ -54,4 +57,3 @@ else
54 57 # create the zsh file
55 58 _update_zsh_update
56 59 fi
57   -
  1 +function main() {
  2 +# Use colors, but only if connected to a terminal, and that terminal
  3 +# supports them.
  4 +if which tput >/dev/null 2>&1; then
  5 + ncolors=$(tput colors)
  6 +fi
  7 +if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
  8 + RED="$(tput setaf 1)"
  9 + GREEN="$(tput setaf 2)"
  10 + YELLOW="$(tput setaf 3)"
  11 + BLUE="$(tput setaf 4)"
  12 + BOLD="$(tput bold)"
  13 + NORMAL="$(tput sgr0)"
  14 +else
  15 + RED=""
  16 + GREEN=""
  17 + YELLOW=""
  18 + BLUE=""
  19 + BOLD=""
  20 + NORMAL=""
  21 +fi
  22 +
  23 +# Only enable exit-on-error after the non-critical colorization stuff,
  24 +# which may fail on systems lacking tput or terminfo
1 25 set -e
2 26  
  27 +CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l)
  28 +if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then
  29 + printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n"
  30 + exit
  31 +fi
  32 +unset CHECK_ZSH_INSTALLED
  33 +
3 34 if [ ! -n "$ZSH" ]; then
4 35 ZSH=~/.oh-my-zsh
5 36 fi
6 37  
7 38 if [ -d "$ZSH" ]; then
8   - echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove $ZSH if you want to install"
  39 + printf "${YELLOW}You already have Oh My Zsh installed.${NORMAL}\n"
  40 + printf "You'll need to remove $ZSH if you want to re-install.\n"
9 41 exit
10 42 fi
11 43  
12   -echo "\033[0;34mCloning Oh My Zsh...\033[0m"
13   -hash git >/dev/null 2>&1 && env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
14   - echo "git not installed"
15   - exit
  44 +# Prevent the cloned repository from having insecure permissions. Failing to do
  45 +# so causes compinit() calls to fail with "command not found: compdef" errors
  46 +# for users with insecure umasks (e.g., "002", allowing group writability). Note
  47 +# that this will be ignored under Cygwin by default, as Windows ACLs take
  48 +# precedence over umasks except for filesystems mounted with option "noacl".
  49 +umask g-w,o-w
  50 +
  51 +printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n"
  52 +hash git >/dev/null 2>&1 || {
  53 + echo "Error: git is not installed"
  54 + exit 1
  55 +}
  56 +env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
  57 + printf "Error: git clone of oh-my-zsh repo failed\n"
  58 + exit 1
16 59 }
17 60  
18   -echo "\033[0;34mLooking for an existing zsh config...\033[0m"
  61 +# The Windows (MSYS) Git is not compatible with normal use on cygwin
  62 +if [ "$OSTYPE" = cygwin ]; then
  63 + if git --version | grep msysgit > /dev/null; then
  64 + echo "Error: Windows/MSYS Git is not supported on Cygwin"
  65 + echo "Error: Make sure the Cygwin git package is installed and is first on the path"
  66 + exit 1
  67 + fi
  68 +fi
  69 +
  70 +printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n"
19 71 if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
20   - echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32mBacking up to ~/.zshrc.pre-oh-my-zsh\033[0m";
  72 + printf "${YELLOW}Found ~/.zshrc.${NORMAL} ${GREEN}Backing up to ~/.zshrc.pre-oh-my-zsh${NORMAL}\n";
21 73 mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
22 74 fi
23 75  
24   -echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m"
  76 +printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n"
25 77 cp $ZSH/templates/zshrc.zsh-template ~/.zshrc
26   -sed -i -e "/^export ZSH=/ c\
  78 +sed "/^export ZSH=/ c\
27 79 export ZSH=$ZSH
28   -" ~/.zshrc
  80 +" ~/.zshrc > ~/.zshrc-omztemp
  81 +mv -f ~/.zshrc-omztemp ~/.zshrc
29 82  
30   -echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
31   -sed -i -e "/export PATH=/ c\\
  83 +printf "${BLUE}Copying your current PATH and adding it to the end of ~/.zshrc for you.${NORMAL}\n"
  84 +sed "/export PATH=/ c\\
32 85 export PATH=\"$PATH\"
33   -" ~/.zshrc
  86 +" ~/.zshrc > ~/.zshrc-omztemp
  87 +mv -f ~/.zshrc-omztemp ~/.zshrc
34 88  
  89 +# If this user's login shell is not already "zsh", attempt to switch.
35 90 TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
36 91 if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
37   - echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
  92 + # If this platform provides a "chsh" command (not Cygwin), do it, man!
  93 + if hash chsh >/dev/null 2>&1; then
  94 + printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n"
38 95 chsh -s $(grep /zsh$ /etc/shells | tail -1)
  96 + # Else, suggest the user do so manually.
  97 + else
  98 + printf "I can't change your shell automatically because this system does not have chsh.\n"
  99 + printf "${BLUE}Please manually change your default shell to zsh!${NORMAL}\n"
  100 + fi
39 101 fi
40   -unset TEST_CURRENT_SHELL
41   -
42   -echo "\033[0;32m"' __ __ '"\033[0m"
43   -echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"
44   -echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m"
45   -echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m"
46   -echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m"
47   -echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m"
48   -echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m"
49   -echo "\n\n \033[0;32mp.s. Follow us at http://twitter.com/ohmyzsh.\033[0m"
50   -echo "\n\n \033[0;32mp.p.s. Get stickers and t-shirts at http://shop.planetargon.com.\033[0m"
  102 +
  103 +printf "${GREEN}"
  104 +echo ' __ __ '
  105 +echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
  106 +echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
  107 +echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
  108 +echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
  109 +echo ' /____/ ....is now installed!'
  110 +echo ''
  111 +echo ''
  112 +echo 'Please look over the ~/.zshrc file to select plugins, themes, and options.'
  113 +echo ''
  114 +echo 'p.s. Follow us at https://twitter.com/ohmyzsh.'
  115 +echo ''
  116 +echo 'p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.'
  117 +echo ''
  118 +printf "${NORMAL}"
51 119 env zsh
52   -. ~/.zshrc
  120 +}
  121 +
  122 +main
  1 +read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation
  2 +if ! [[ $confirmation =~ ^[yY]$ ]]
  3 +then
  4 + echo "Uninstall cancelled"
  5 + exit
  6 +fi
  7 +
1 8 echo "Removing ~/.oh-my-zsh"
2   -if [[ -d ~/.oh-my-zsh ]]
  9 +if [ -d ~/.oh-my-zsh ]
3 10 then
4 11 rm -rf ~/.oh-my-zsh
5 12 fi
... ... @@ -20,9 +27,13 @@ then
20 27  
21 28 source ~/.zshrc;
22 29 else
23   - echo "Switching back to bash"
24   - chsh -s /bin/bash
25   - source /etc/profile
  30 + if hash chsh >/dev/null 2>&1
  31 + then
  32 + echo "Switching back to bash"
  33 + chsh -s /bin/bash
  34 + else
  35 + echo "You can edit /etc/passwd to switch your default shell back to bash"
  36 + fi
26 37 fi
27 38  
28 39 echo "Thanks for trying out Oh My Zsh. It's been uninstalled."
1   -printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh"
  1 +
  2 +# Use colors, but only if connected to a terminal, and that terminal
  3 +# supports them.
  4 +if which tput >/dev/null 2>&1; then
  5 + ncolors=$(tput colors)
  6 +fi
  7 +if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
  8 + RED="$(tput setaf 1)"
  9 + GREEN="$(tput setaf 2)"
  10 + YELLOW="$(tput setaf 3)"
  11 + BLUE="$(tput setaf 4)"
  12 + BOLD="$(tput bold)"
  13 + NORMAL="$(tput sgr0)"
  14 +else
  15 + RED=""
  16 + GREEN=""
  17 + YELLOW=""
  18 + BLUE=""
  19 + BOLD=""
  20 + NORMAL=""
  21 +fi
  22 +
  23 +printf "${BLUE}%s${NORMAL}\n" "Upgrading Oh My Zsh"
2 24 cd "$ZSH"
3 25 if git pull --rebase --stat origin master
4 26 then
5   - printf '\033[0;32m%s\033[0m\n' ' __ __ '
6   - printf '\033[0;32m%s\033[0m\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
7   - printf '\033[0;32m%s\033[0m\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
8   - printf '\033[0;32m%s\033[0m\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
9   - printf '\033[0;32m%s\033[0m\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
10   - printf '\033[0;32m%s\033[0m\n' ' /____/ '
11   - printf '\033[0;34m%s\033[0m\n' 'Hooray! Oh My Zsh has been updated and/or is at the current version.'
12   - printf '\033[0;34m%s\033[1m%s\033[0m\n' 'To keep up on the latest news and updates, follow us on twitter: ' 'http://twitter.com/ohmyzsh'
13   - printf '\033[0;34m%s\033[1m%s\033[0m\n' 'Get your Oh My Zsh swag at: ' 'http://shop.planetargon.com/'
  27 + printf '%s' "$GREEN"
  28 + printf '%s\n' ' __ __ '
  29 + printf '%s\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
  30 + printf '%s\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
  31 + printf '%s\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
  32 + printf '%s\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
  33 + printf '%s\n' ' /____/ '
  34 + printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version."
  35 + printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh"
  36 + printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: http://shop.planetargon.com/"
14 37 else
15   - printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?'
  38 + printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?'
16 39 fi