commit eda4a36c6c59d944299ef66aee71d27baa830fc6 parent 35d274552996e91cf91552bb4bdd6492b218a986 Author: Alex Balgavy <a.balgavy@gmail.com> Date: Wed, 16 May 2018 18:29:17 +0200 Made files visible Diffstat:
A | DS_Store | | | 0 | |
A | bin/AMSTracker | | | 0 | |
A | bin/Desktop Changer.app/Contents/Info.plist | | | 52 | ++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | bin/Desktop Changer.app/Contents/MacOS/applet | | | 0 | |
A | bin/Desktop Changer.app/Contents/PkgInfo | | | 2 | ++ |
A | bin/Desktop Changer.app/Contents/Resources/Scripts/main.scpt | | | 0 | |
A | bin/Desktop Changer.app/Contents/Resources/applet.icns | | | 0 | |
A | bin/Desktop Changer.app/Contents/Resources/applet.rsrc | | | 0 | |
A | bin/Desktop Changer.app/Contents/Resources/description.rtfd/TXT.rtf | | | 6 | ++++++ |
A | bin/README.md | | | 20 | ++++++++++++++++++++ |
A | bin/anythingtogif | | | 8 | ++++++++ |
A | bin/class-dump | | | 0 | |
A | bin/clonedisk | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | bin/clonedisk-ignore | | | 15 | +++++++++++++++ |
A | bin/cs_record_tasks.rb | | | 22 | ++++++++++++++++++++++ |
A | bin/epub-convert | | | 1 | + |
A | bin/executable | | | 42 | ++++++++++++++++++++++++++++++++++++++++++ |
A | bin/gfx2gfx | | | 0 | |
A | bin/icalBuddy | | | 0 | |
A | bin/itunes_style_getter | | | 122 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | bin/itunes_style_getter_helper.rb | | | 41 | +++++++++++++++++++++++++++++++++++++++++ |
A | bin/modified_cfscrape.py | | | 7 | +++++++ |
A | bin/mp3tagger.jar | | | 0 | |
A | bin/percerr.rb | | | 21 | +++++++++++++++++++++ |
A | bin/radio | | | 46 | ++++++++++++++++++++++++++++++++++++++++++++++ |
A | bin/smack.pl | | | 74 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | bin/strip-html-tags | | | 4 | ++++ |
A | bin/tag | | | 31 | +++++++++++++++++++++++++++++++ |
A | bin/tcprelay.py | | | 148 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | bin/topdf | | | 9 | +++++++++ |
A | bin/upx.out | | | 0 | |
A | bin/usbmux.py | | | 246 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | bin/usbmux.pyc | | | 0 | |
A | bin/wattpad-scrape | | | 15 | +++++++++++++++ |
A | bin/xld | | | 11 | +++++++++++ |
A | commonprofile | | | 2 | ++ |
A | gitconfig | | | 2 | ++ |
A | gitignore | | | 2 | ++ |
A | oh-my-zsh/.oh-my-zsh | | | 2 | ++ |
A | oh-my-zsh/CONTRIBUTING.md | | | 123 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/LICENSE.txt | | | 22 | ++++++++++++++++++++++ |
A | oh-my-zsh/README.md | | | 251 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/cache/.gitkeep | | | 0 | |
A | oh-my-zsh/custom/example.zsh | | | 10 | ++++++++++ |
A | oh-my-zsh/custom/plugins/example/example.plugin.zsh | | | 2 | ++ |
A | oh-my-zsh/custom/themes/powerlevel9k | | | 1 | + |
A | oh-my-zsh/lib/bzr.zsh | | | 11 | +++++++++++ |
A | oh-my-zsh/lib/clipboard.zsh | | | 86 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/lib/compfix.zsh | | | 60 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/lib/completion.zsh | | | 70 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/lib/correction.zsh | | | 13 | +++++++++++++ |
A | oh-my-zsh/lib/diagnostics.zsh | | | 353 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/lib/directories.zsh | | | 34 | ++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/lib/functions.zsh | | | 231 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/lib/git.zsh | | | 221 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/lib/grep.zsh | | | 28 | ++++++++++++++++++++++++++++ |
A | oh-my-zsh/lib/history.zsh | | | 24 | ++++++++++++++++++++++++ |
A | oh-my-zsh/lib/key-bindings.zsh | | | 93 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/lib/misc.zsh | | | 42 | ++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/lib/nvm.zsh | | | 9 | +++++++++ |
A | oh-my-zsh/lib/prompt_info_functions.zsh | | | 33 | +++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/lib/spectrum.zsh | | | 37 | +++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/lib/termsupport.zsh | | | 105 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/lib/theme-and-appearance.zsh | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/log/.gitkeep | | | 0 | |
A | oh-my-zsh/oh-my-zsh.sh | | | 117 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/adb/README.md | | | 8 | ++++++++ |
A | oh-my-zsh/plugins/adb/_adb | | | 63 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/ant/ant.plugin.zsh | | | 16 | ++++++++++++++++ |
A | oh-my-zsh/plugins/apache2-macports/README.md | | | 19 | +++++++++++++++++++ |
A | oh-my-zsh/plugins/apache2-macports/apache2-macports.plugin.zsh | | | 6 | ++++++ |
A | oh-my-zsh/plugins/arcanist/README.md | | | 5 | +++++ |
A | oh-my-zsh/plugins/arcanist/arcanist.plugin.zsh | | | 21 | +++++++++++++++++++++ |
A | oh-my-zsh/plugins/archlinux/README.md | | | 97 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/archlinux/archlinux.plugin.zsh | | | 138 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/asdf/README.md | | | 27 | +++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/asdf/asdf.plugin.zsh | | | 7 | +++++++ |
A | oh-my-zsh/plugins/autoenv/autoenv.plugin.zsh | | | 43 | +++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/autojump/autojump.plugin.zsh | | | 23 | +++++++++++++++++++++++ |
A | oh-my-zsh/plugins/autopep8/_autopep8 | | | 32 | ++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/autopep8/autopep8.plugin.zsh | | | 0 | |
A | oh-my-zsh/plugins/aws/aws.plugin.zsh | | | 52 | ++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/battery/battery.plugin.zsh | | | 160 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/bbedit/README.md | | | 20 | ++++++++++++++++++++ |
A | oh-my-zsh/plugins/bbedit/bbedit.plugin.zsh | | | 21 | +++++++++++++++++++++ |
A | oh-my-zsh/plugins/bgnotify/README.md | | | 54 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/bgnotify/bgnotify.plugin.zsh | | | 77 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/boot2docker/README.md | | | 6 | ++++++ |
A | oh-my-zsh/plugins/boot2docker/_boot2docker | | | 73 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/bower/_bower | | | 58 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/bower/bower.plugin.zsh | | | 82 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/branch/README.md | | | 33 | +++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/branch/branch.plugin.zsh | | | 31 | +++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/brew/brew.plugin.zsh | | | 20 | ++++++++++++++++++++ |
A | oh-my-zsh/plugins/bundler/README.md | | | 50 | ++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/bundler/_bundler | | | 104 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/bundler/bundler.plugin.zsh | | | 113 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/bwana/bwana.plugin.zsh | | | 13 | +++++++++++++ |
A | oh-my-zsh/plugins/cabal/cabal.plugin.zsh | | | 93 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/cake/cake.plugin.zsh | | | 33 | +++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/cakephp3/cakephp3.plugin.zsh | | | 38 | ++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/capistrano/_capistrano | | | 49 | +++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/capistrano/capistrano.plugin.zsh | | | 11 | +++++++++++ |
A | oh-my-zsh/plugins/cargo/README.md | | | 11 | +++++++++++ |
A | oh-my-zsh/plugins/cargo/_cargo | | | 500 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/cask/README.md | | | 15 | +++++++++++++++ |
A | oh-my-zsh/plugins/cask/cask.plugin.zsh | | | 26 | ++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/catimg/catimg.plugin.zsh | | | 17 | +++++++++++++++++ |
A | oh-my-zsh/plugins/catimg/catimg.sh | | | 88 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/catimg/colors.png | | | 0 | |
A | oh-my-zsh/plugins/celery/_celery | | | 129 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/chruby/chruby.plugin.zsh | | | 115 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/chucknorris/.gitignore | | | 1 | + |
A | oh-my-zsh/plugins/chucknorris/LICENSE | | | 2 | ++ |
A | oh-my-zsh/plugins/chucknorris/chucknorris.plugin.zsh | | | 28 | ++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/chucknorris/fortunes/chucknorris | | | 907 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/cloudapp/cloudapp.plugin.zsh | | | 2 | ++ |
A | oh-my-zsh/plugins/cloudapp/cloudapp.rb | | | 60 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/codeclimate/_codeclimate | | | 82 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/coffee/README.md | | | 31 | +++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/coffee/_coffee | | | 81 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/coffee/coffee.plugin.zsh | | | 16 | ++++++++++++++++ |
A | oh-my-zsh/plugins/colemak/colemak-less | | | 6 | ++++++ |
A | oh-my-zsh/plugins/colemak/colemak.plugin.zsh | | | 22 | ++++++++++++++++++++++ |
A | oh-my-zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh | | | 32 | ++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/colorize/colorize.plugin.zsh | | | 29 | +++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/command-not-found/command-not-found.plugin.zsh | | | 33 | +++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/common-aliases/common-aliases.plugin.zsh | | | 89 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/compleat/compleat.plugin.zsh | | | 20 | ++++++++++++++++++++ |
A | oh-my-zsh/plugins/composer/composer.plugin.zsh | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/copybuffer/README.md | | | 11 | +++++++++++ |
A | oh-my-zsh/plugins/copybuffer/copybuffer.plugin.zsh | | | 14 | ++++++++++++++ |
A | oh-my-zsh/plugins/copydir/copydir.plugin.zsh | | | 5 | +++++ |
A | oh-my-zsh/plugins/copyfile/copyfile.plugin.zsh | | | 7 | +++++++ |
A | oh-my-zsh/plugins/cp/README.md | | | 32 | ++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/cp/cp.plugin.zsh | | | 4 | ++++ |
A | oh-my-zsh/plugins/cpanm/_cpanm | | | 67 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/debian/debian.plugin.zsh | | | 229 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/dircycle/dircycle.plugin.zsh | | | 49 | +++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/dirhistory/dirhistory.plugin.zsh | | | 136 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/dirpersist/dirpersist.plugin.zsh | | | 20 | ++++++++++++++++++++ |
A | oh-my-zsh/plugins/django/django.plugin.zsh | | | 403 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/dnf/README.md | | | 25 | +++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/dnf/dnf.plugin.zsh | | | 15 | +++++++++++++++ |
A | oh-my-zsh/plugins/docker-compose/README.md | | | 4 | ++++ |
A | oh-my-zsh/plugins/docker-compose/_docker-compose | | | 475 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/docker-compose/docker-compose.plugin.zsh | | | 25 | +++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/docker-machine/README.md | | | 20 | ++++++++++++++++++++ |
A | oh-my-zsh/plugins/docker-machine/docker-machine.plugin.zsh | | | 34 | ++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/docker/README.md | | | 5 | +++++ |
A | oh-my-zsh/plugins/docker/_docker | | | 3028 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/dotenv/README.md | | | 34 | ++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/dotenv/dotenv.plugin.zsh | | | 10 | ++++++++++ |
A | oh-my-zsh/plugins/droplr/README.md | | | 19 | +++++++++++++++++++ |
A | oh-my-zsh/plugins/droplr/droplr.plugin.zsh | | | 15 | +++++++++++++++ |
A | oh-my-zsh/plugins/eecms/eecms.plugin.zsh | | | 20 | ++++++++++++++++++++ |
A | oh-my-zsh/plugins/emacs/emacs.plugin.zsh | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/emacs/emacsclient.sh | | | 28 | ++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/ember-cli/README.md | | | 21 | +++++++++++++++++++++ |
A | oh-my-zsh/plugins/ember-cli/ember-cli.plugin.zsh | | | 16 | ++++++++++++++++ |
A | oh-my-zsh/plugins/emoji-clock/emoji-clock.plugin.zsh | | | 33 | +++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/emoji/README.md | | | 135 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/emoji/emoji-char-definitions.zsh | | | 1303 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/emoji/emoji-data.txt | | | 1308 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/emoji/emoji.plugin.zsh | | | 288 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/emoji/update_emoji.pl | | | 113 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/emotty/emotty.plugin.zsh | | | 43 | +++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/emotty/emotty_emoji_set.zsh | | | 24 | ++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/emotty/emotty_floral_set.zsh | | | 18 | ++++++++++++++++++ |
A | oh-my-zsh/plugins/emotty/emotty_love_set.zsh | | | 34 | ++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/emotty/emotty_nature_set.zsh | | | 58 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/emotty/emotty_stellar_set.zsh | | | 25 | +++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/emotty/emotty_zodiac_set.zsh | | | 29 | +++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/encode64/encode64.plugin.zsh | | | 17 | +++++++++++++++++ |
A | oh-my-zsh/plugins/extract/README.md | | | 46 | ++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/extract/_extract | | | 7 | +++++++ |
A | oh-my-zsh/plugins/extract/extract.plugin.zsh | | | 71 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/fabric/_fab | | | 60 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/fabric/fabric.plugin.zsh | | | 1 | + |
A | oh-my-zsh/plugins/fancy-ctrl-z/README.md | | | 14 | ++++++++++++++ |
A | oh-my-zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh | | | 12 | ++++++++++++ |
A | oh-my-zsh/plugins/fasd/fasd.plugin.zsh | | | 11 | +++++++++++ |
A | oh-my-zsh/plugins/fastfile/fastfile.plugin.zsh | | | 139 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/fbterm/fbterm.plugin.zsh | | | 7 | +++++++ |
A | oh-my-zsh/plugins/fedora/README.md | | | 3 | +++ |
A | oh-my-zsh/plugins/fedora/fedora.plugin.zsh | | | 16 | ++++++++++++++++ |
A | oh-my-zsh/plugins/firewalld/firewalld.plugin.zsh | | | 17 | +++++++++++++++++ |
A | oh-my-zsh/plugins/firewalld/readme.md | | | 22 | ++++++++++++++++++++++ |
A | oh-my-zsh/plugins/forklift/README.md | | | 15 | +++++++++++++++ |
A | oh-my-zsh/plugins/forklift/forklift.plugin.zsh | | | 69 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/fossil/README.md | | | 7 | +++++++ |
A | oh-my-zsh/plugins/fossil/fossil.plugin.zsh | | | 89 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/frontend-search/README.md | | | 65 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/frontend-search/_frontend-search.sh | | | 132 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/frontend-search/frontend-search.plugin.zsh | | | 91 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/gas/_gas | | | 39 | +++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/gb/README.md | | | 21 | +++++++++++++++++++++ |
A | oh-my-zsh/plugins/gb/_gb | | | 111 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/geeknote/README.md | | | 12 | ++++++++++++ |
A | oh-my-zsh/plugins/geeknote/_geeknote | | | 136 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/geeknote/geeknote.plugin.zsh | | | 2 | ++ |
A | oh-my-zsh/plugins/gem/_gem | | | 72 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/gem/gem.plugin.zsh | | | 8 | ++++++++ |
A | oh-my-zsh/plugins/git-extras/README.md | | | 11 | +++++++++++ |
A | oh-my-zsh/plugins/git-extras/git-extras.plugin.zsh | | | 335 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/git-flow-avh/git-flow-avh.plugin.zsh | | | 419 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/git-flow/README.md | | | 31 | +++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/git-flow/git-flow.plugin.zsh | | | 369 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/git-hubflow/git-hubflow.plugin.zsh | | | 355 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/git-prompt/git-prompt.plugin.zsh | | | 92 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/git-prompt/gitstatus.py | | | 84 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/git-remote-branch/git-remote-branch.plugin.zsh | | | 19 | +++++++++++++++++++ |
A | oh-my-zsh/plugins/git/README.md | | | 10 | ++++++++++ |
A | oh-my-zsh/plugins/git/git.plugin.zsh | | | 248 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/gitfast/_git | | | 227 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/gitfast/git-completion.bash | | | 2776 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/gitfast/git-prompt.sh | | | 533 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/gitfast/gitfast.plugin.zsh | | | 8 | ++++++++ |
A | oh-my-zsh/plugins/github/README.md | | | 46 | ++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/github/_hub | | | 163 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/github/github.plugin.zsh | | | 78 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/gitignore/gitignore.plugin.zsh | | | 12 | ++++++++++++ |
A | oh-my-zsh/plugins/glassfish/_asadmin | | | 1150 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/glassfish/glassfish.plugin.zsh | | | 4 | ++++ |
A | oh-my-zsh/plugins/globalias/README.md | | | 62 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/globalias/globalias.plugin.zsh | | | 17 | +++++++++++++++++ |
A | oh-my-zsh/plugins/gnu-utils/gnu-utils.plugin.zsh | | | 83 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/go/go.plugin.zsh | | | 193 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/golang/golang.plugin.zsh | | | 193 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/golang/templates/package.txt | | | 29 | +++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/golang/templates/search.txt | | | 0 | |
A | oh-my-zsh/plugins/gpg-agent/gpg-agent.plugin.zsh | | | 14 | ++++++++++++++ |
A | oh-my-zsh/plugins/gradle/_gradle | | | 171 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/gradle/_gradlew | | | 171 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/gradle/gradle.plugin.zsh | | | 171 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/grails/grails.plugin.zsh | | | 60 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/grunt/grunt.plugin.zsh | | | 256 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/gulp/gulp.plugin.zsh | | | 29 | +++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/helm/helm.plugin.zsh | | | 7 | +++++++ |
A | oh-my-zsh/plugins/heroku/_heroku | | | 151 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/history-substring-search/README.md | | | 149 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/history-substring-search/history-substring-search.plugin.zsh | | | 26 | ++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/history-substring-search/history-substring-search.zsh | | | 585 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/history-substring-search/update-from-upstream.zsh | | | 129 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/history/README.md | | | 16 | ++++++++++++++++ |
A | oh-my-zsh/plugins/history/history.plugin.zsh | | | 8 | ++++++++ |
A | oh-my-zsh/plugins/httpie/README.md | | | 6 | ++++++ |
A | oh-my-zsh/plugins/httpie/httpie.plugin.zsh | | | 34 | ++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/iterm2/iterm2.plugin.zsh | | | 68 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/iwhois/iwhois.plugin.zsh | | | 8 | ++++++++ |
A | oh-my-zsh/plugins/jake-node/jake-node.plugin.zsh | | | 15 | +++++++++++++++ |
A | oh-my-zsh/plugins/jhbuild/README.md | | | 4 | ++++ |
A | oh-my-zsh/plugins/jhbuild/jhbuild.plugin.zsh | | | 28 | ++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/jira/README.md | | | 65 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/jira/_jira | | | 23 | +++++++++++++++++++++++ |
A | oh-my-zsh/plugins/jira/jira.plugin.zsh | | | 119 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/jruby/jruby.plugin.zsh | | | 4 | ++++ |
A | oh-my-zsh/plugins/jsontools/README.md | | | 43 | +++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/jsontools/jsontools.plugin.zsh | | | 40 | ++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/jump/jump.plugin.zsh | | | 57 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/kate/kate.plugin.zsh | | | 10 | ++++++++++ |
A | oh-my-zsh/plugins/kitchen/_kitchen | | | 85 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/knife/_knife | | | 241 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/knife_ssh/knife_ssh.plugin.zsh | | | 18 | ++++++++++++++++++ |
A | oh-my-zsh/plugins/kops/kops.plugin.zsh | | | 9 | +++++++++ |
A | oh-my-zsh/plugins/kube-ps1/README.md | | | 76 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/kube-ps1/kube-ps1.zsh | | | 123 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/kubectl/kubectl.plugin.zsh | | | 56 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/laravel/_artisan | | | 40 | ++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/laravel/laravel.plugin.zsh | | | 3 | +++ |
A | oh-my-zsh/plugins/laravel4/laravel4.plugin.zsh | | | 20 | ++++++++++++++++++++ |
A | oh-my-zsh/plugins/laravel5/laravel5.plugin.zsh | | | 20 | ++++++++++++++++++++ |
A | oh-my-zsh/plugins/last-working-dir/README.md | | | 9 | +++++++++ |
A | oh-my-zsh/plugins/last-working-dir/last-working-dir.plugin.zsh | | | 23 | +++++++++++++++++++++++ |
A | oh-my-zsh/plugins/lein/lein.plugin.zsh | | | 43 | +++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/lighthouse/lighthouse.plugin.zsh | | | 16 | ++++++++++++++++ |
A | oh-my-zsh/plugins/lol/lol.plugin.zsh | | | 51 | +++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/macports/_port | | | 89 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/macports/macports.plugin.zsh | | | 8 | ++++++++ |
A | oh-my-zsh/plugins/man/man.zsh | | | 28 | ++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/marked2/README.md | | | 13 | +++++++++++++ |
A | oh-my-zsh/plugins/marked2/marked2.plugin.zsh | | | 12 | ++++++++++++ |
A | oh-my-zsh/plugins/mercurial/README.md | | | 60 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/mercurial/mercurial.plugin.zsh | | | 65 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/meteor/README.md | | | 45 | +++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/meteor/_meteor | | | 49 | +++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/meteor/meteor.plugin.zsh | | | 33 | +++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/mix-fast/README.md | | | 29 | +++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/mix-fast/mix-fast.plugin.zsh | | | 29 | +++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/mix/_mix | | | 111 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/mosh/mosh.plugin.zsh | | | 2 | ++ |
A | oh-my-zsh/plugins/mvn/README.md | | | 34 | ++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/mvn/mvn.plugin.zsh | | | 276 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/mysql-macports/mysql-macports.plugin.zsh | | | 8 | ++++++++ |
A | oh-my-zsh/plugins/n98-magerun/n98-magerun.plugin.zsh | | | 34 | ++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/nanoc/_nanoc | | | 44 | ++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/nanoc/nanoc.plugin.zsh | | | 9 | +++++++++ |
A | oh-my-zsh/plugins/ng/README.md | | | 37 | +++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/ng/ng.plugin.zsh | | | 77 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/nmap/README.md | | | 37 | +++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/nmap/nmap.plugin.zsh | | | 32 | ++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/node/node.plugin.zsh | | | 6 | ++++++ |
A | oh-my-zsh/plugins/nomad/README.md | | | 15 | +++++++++++++++ |
A | oh-my-zsh/plugins/nomad/_nomad | | | 153 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/npm/npm.plugin.zsh | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/npx/README.md | | | 18 | ++++++++++++++++++ |
A | oh-my-zsh/plugins/npx/npx.plugin.zsh | | | 7 | +++++++ |
A | oh-my-zsh/plugins/nvm/_nvm | | | 27 | +++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/nvm/nvm.plugin.zsh | | | 5 | +++++ |
A | oh-my-zsh/plugins/nyan/nyan.plugin.zsh | | | 5 | +++++ |
A | oh-my-zsh/plugins/oc/oc.plugin.zsh | | | 7 | +++++++ |
A | oh-my-zsh/plugins/osx/README.md | | | 60 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/osx/osx.plugin.zsh | | | 284 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/osx/spotify | | | 438 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/pass/_pass | | | 138 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/paver/paver.plugin.zsh | | | 16 | ++++++++++++++++ |
A | oh-my-zsh/plugins/pep8/_pep8 | | | 34 | ++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/per-directory-history/README.md | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/per-directory-history/per-directory-history.plugin.zsh | | | 151 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/per-directory-history/per-directory-history.zsh | | | 151 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/perl/perl.plugin.zsh | | | 56 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/perms/README.md | | | 10 | ++++++++++ |
A | oh-my-zsh/plugins/perms/perms.plugin.zsh | | | 78 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/phing/phing.plugin.zsh | | | 7 | +++++++ |
A | oh-my-zsh/plugins/pip/_pip | | | 99 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/pip/pip.plugin.zsh | | | 81 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/pj/README.md | | | 45 | +++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/pj/pj.plugin.zsh | | | 37 | +++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/pod/_pod | | | 682 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/postgres/postgres.plugin.zsh | | | 9 | +++++++++ |
A | oh-my-zsh/plugins/pow/pow.plugin.zsh | | | 85 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/powder/_powder | | | 4 | ++++ |
A | oh-my-zsh/plugins/powify/_powify | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/profiles/profiles.plugin.zsh | | | 12 | ++++++++++++ |
A | oh-my-zsh/plugins/pyenv/pyenv.plugin.zsh | | | 50 | ++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/pylint/_pylint | | | 31 | +++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/pylint/pylint.plugin.zsh | | | 3 | +++ |
A | oh-my-zsh/plugins/python/_python | | | 54 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/python/python.plugin.zsh | | | 14 | ++++++++++++++ |
A | oh-my-zsh/plugins/rails/_rails | | | 63 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/rails/rails.plugin.zsh | | | 86 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/rake-fast/README.md | | | 35 | +++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/rake-fast/rake-fast.plugin.zsh | | | 43 | +++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/rake/rake.plugin.zsh | | | 10 | ++++++++++ |
A | oh-my-zsh/plugins/rand-quote/rand-quote.plugin.zsh | | | 26 | ++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/rbenv/rbenv.plugin.zsh | | | 60 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/rbfu/rbfu.plugin.zsh | | | 42 | ++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/react-native/README.md | | | 29 | +++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/react-native/_react-native | | | 32 | ++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/react-native/react-native.plugin.zsh | | | 14 | ++++++++++++++ |
A | oh-my-zsh/plugins/rebar/_rebar | | | 79 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/redis-cli/_redis-cli | | | 143 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/repo/README.md | | | 7 | +++++++ |
A | oh-my-zsh/plugins/repo/_repo | | | 272 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/repo/repo.plugin.zsh | | | 18 | ++++++++++++++++++ |
A | oh-my-zsh/plugins/rsync/rsync.plugin.zsh | | | 4 | ++++ |
A | oh-my-zsh/plugins/ruby/ruby.plugin.zsh | | | 14 | ++++++++++++++ |
A | oh-my-zsh/plugins/rust/_rust | | | 228 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/rvm/rvm.plugin.zsh | | | 74 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/safe-paste/safe-paste.plugin.zsh | | | 54 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/sbt/_sbt | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/sbt/sbt.plugin.zsh | | | 24 | ++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/scala/_scala | | | 249 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/scd/README.md | | | 123 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/scd/scd | | | 390 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/scd/scd.plugin.zsh | | | 19 | +++++++++++++++++++ |
A | oh-my-zsh/plugins/screen/screen.plugin.zsh | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/scw/README.md | | | 7 | +++++++ |
A | oh-my-zsh/plugins/scw/_scw | | | 333 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/sfffe/sfffe.plugin.zsh | | | 28 | ++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/shrink-path/README.md | | | 68 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/shrink-path/shrink-path.plugin.zsh | | | 127 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/singlechar/singlechar.plugin.zsh | | | 134 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/spring/README.md | | | 25 | +++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/spring/_spring | | | 30 | ++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/sprunge/sprunge.plugin.zsh | | | 62 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/ssh-agent/README.md | | | 38 | ++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/ssh-agent/ssh-agent.plugin.zsh | | | 42 | ++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/stack/stack.plugin.zsh | | | 37 | +++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/sublime/README.md | | | 25 | +++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/sublime/sublime.plugin.zsh | | | 118 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/sudo/sudo.plugin.zsh | | | 31 | +++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/supervisor/_supervisorctl | | | 136 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/supervisor/_supervisord | | | 33 | +++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/supervisor/supervisor.plugin.zsh | | | 1 | + |
A | oh-my-zsh/plugins/suse/suse.plugin.zsh | | | 61 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/svn-fast-info/svn-fast-info.plugin.zsh | | | 73 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/svn/README.md | | | 67 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/svn/svn.plugin.zsh | | | 87 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/swiftpm/README.md | | | 22 | ++++++++++++++++++++++ |
A | oh-my-zsh/plugins/swiftpm/swiftpm.plugin.zsh | | | 8 | ++++++++ |
A | oh-my-zsh/plugins/symfony/symfony.plugin.zsh | | | 13 | +++++++++++++ |
A | oh-my-zsh/plugins/symfony2/symfony2.plugin.zsh | | | 29 | +++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/systemadmin/systemadmin.plugin.zsh | | | 163 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/systemd/systemd.plugin.zsh | | | 16 | ++++++++++++++++ |
A | oh-my-zsh/plugins/taskwarrior/README.md | | | 13 | +++++++++++++ |
A | oh-my-zsh/plugins/taskwarrior/_task | | | 285 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/taskwarrior/taskwarrior.plugin.zsh | | | 7 | +++++++ |
A | oh-my-zsh/plugins/terminalapp/terminalapp.plugin.zsh | | | 6 | ++++++ |
A | oh-my-zsh/plugins/terminitor/_terminitor | | | 38 | ++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/terraform/README.md | | | 21 | +++++++++++++++++++++ |
A | oh-my-zsh/plugins/terraform/_terraform | | | 179 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/terraform/terraform.plugin.zsh | | | 7 | +++++++ |
A | oh-my-zsh/plugins/textastic/README.md | | | 15 | +++++++++++++++ |
A | oh-my-zsh/plugins/textastic/textastic.plugin.zsh | | | 17 | +++++++++++++++++ |
A | oh-my-zsh/plugins/textmate/textmate.plugin.zsh | | | 14 | ++++++++++++++ |
A | oh-my-zsh/plugins/thefuck/README.md | | | 9 | +++++++++ |
A | oh-my-zsh/plugins/thefuck/thefuck.plugin.zsh | | | 17 | +++++++++++++++++ |
A | oh-my-zsh/plugins/themes/_theme | | | 3 | +++ |
A | oh-my-zsh/plugins/themes/themes.plugin.zsh | | | 24 | ++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/thor/_thor | | | 4 | ++++ |
A | oh-my-zsh/plugins/tig/README.md | | | 16 | ++++++++++++++++ |
A | oh-my-zsh/plugins/tig/tig.plugin.zsh | | | 3 | +++ |
A | oh-my-zsh/plugins/tmux-cssh/_tmux-cssh | | | 25 | +++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/tmux/tmux.extra.conf | | | 2 | ++ |
A | oh-my-zsh/plugins/tmux/tmux.only.conf | | | 1 | + |
A | oh-my-zsh/plugins/tmux/tmux.plugin.zsh | | | 98 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/tmuxinator/_tmuxinator | | | 40 | ++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/torrent/torrent.plugin.zsh | | | 18 | ++++++++++++++++++ |
A | oh-my-zsh/plugins/tugboat/_tugboat | | | 106 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/ubuntu/readme.md | | | 21 | +++++++++++++++++++++ |
A | oh-my-zsh/plugins/ubuntu/ubuntu.plugin.zsh | | | 154 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/urltools/urltools.plugin.zsh | | | 42 | ++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/vagrant/_vagrant | | | 130 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/vault/README.md | | | 19 | +++++++++++++++++++ |
A | oh-my-zsh/plugins/vault/_vault | | | 400 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/vi-mode/README.md | | | 75 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/vi-mode/vi-mode.plugin.zsh | | | 50 | ++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/vim-interaction/README.md | | | 82 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/vim-interaction/vim-interaction.plugin.zsh | | | 58 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/virtualenv/virtualenv.plugin.zsh | | | 7 | +++++++ |
A | oh-my-zsh/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh | | | 86 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/vundle/vundle.plugin.zsh | | | 27 | +++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/wakeonlan/README | | | 29 | +++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/wakeonlan/_wake | | | 4 | ++++ |
A | oh-my-zsh/plugins/wakeonlan/wakeonlan.plugin.zsh | | | 14 | ++++++++++++++ |
A | oh-my-zsh/plugins/wd/LICENSE | | | 22 | ++++++++++++++++++++++ |
A | oh-my-zsh/plugins/wd/README.md | | | 159 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/wd/_wd.sh | | | 93 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/wd/wd.plugin.zsh | | | 11 | +++++++++++ |
A | oh-my-zsh/plugins/wd/wd.sh | | | 479 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/web-search/web-search.plugin.zsh | | | 59 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/wp-cli/README.md | | | 107 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/wp-cli/wp-cli.plugin.zsh | | | 160 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/xcode/README.md | | | 84 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/xcode/_xcselv | | | 19 | +++++++++++++++++++ |
A | oh-my-zsh/plugins/xcode/xcode.plugin.zsh | | | 197 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/yarn/yarn.plugin.zsh | | | 88 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/yii/yii.plugin.zsh | | | 17 | +++++++++++++++++ |
A | oh-my-zsh/plugins/yii2/README.md | | | 7 | +++++++ |
A | oh-my-zsh/plugins/yii2/yii2.plugin.zsh | | | 30 | ++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/yum/yum.plugin.zsh | | | 17 | +++++++++++++++++ |
A | oh-my-zsh/plugins/z/Makefile | | | 4 | ++++ |
A | oh-my-zsh/plugins/z/README | | | 144 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/z/z.1 | | | 166 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/z/z.plugin.zsh | | | 1 | + |
A | oh-my-zsh/plugins/z/z.sh | | | 243 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zeus/README.md | | | 56 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zeus/_zeus | | | 34 | ++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zeus/zeus.plugin.zsh | | | 70 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/README.txt | | | 1 | + |
A | oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-aliases.conf | | | 33 | +++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-cd.conf | | | 68 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-env.conf | | | 38 | ++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-functions.conf | | | 41 | +++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-history.conf | | | 43 | +++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-kill.conf | | | 46 | ++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-list.conf | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-options.conf | | | 34 | ++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-panelize.conf | | | 34 | ++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/LICENSE | | | 700 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/NEWS | | | 17 | +++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/README.md | | | 244 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/_n-kill | | | 41 | +++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/n-aliases | | | 47 | +++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/n-cd | | | 71 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/n-env | | | 47 | +++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/n-functions | | | 54 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/n-help | | | 135 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/n-history | | | 371 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/n-kill | | | 96 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/n-list | | | 515 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/n-list-draw | | | 133 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/n-list-input | | | 377 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/n-options | | | 84 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/n-panelize | | | 68 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/znt-cd-widget | | | 8 | ++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/znt-history-widget | | | 22 | ++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/znt-kill-widget | | | 8 | ++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/znt-tmux.zsh | | | 50 | ++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/znt-usetty-wrapper | | | 40 | ++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/plugins/zsh_reload/zsh_reload.plugin.zsh | | | 13 | +++++++++++++ |
A | oh-my-zsh/templates/zshrc.zsh-template | | | 94 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/3den.zsh-theme | | | 7 | +++++++ |
A | oh-my-zsh/themes/Soliah.zsh-theme | | | 87 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/adben.zsh-theme | | | 114 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/af-magic.zsh-theme | | | 33 | +++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/afowler.zsh-theme | | | 10 | ++++++++++ |
A | oh-my-zsh/themes/agnoster.zsh-theme | | | 228 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/alanpeabody.zsh-theme | | | 28 | ++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/amuse.zsh-theme | | | 29 | +++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/apple.zsh-theme | | | 29 | +++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/arrow.zsh-theme | | | 14 | ++++++++++++++ |
A | oh-my-zsh/themes/aussiegeek.zsh-theme | | | 8 | ++++++++ |
A | oh-my-zsh/themes/avit.zsh-theme | | | 110 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/awesomepanda.zsh-theme | | | 16 | ++++++++++++++++ |
A | oh-my-zsh/themes/bira.zsh-theme | | | 30 | ++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/blinks.zsh-theme | | | 30 | ++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/bureau.zsh-theme | | | 123 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/candy-kingdom.zsh-theme | | | 30 | ++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/candy.zsh-theme | | | 7 | +++++++ |
A | oh-my-zsh/themes/clean.zsh-theme | | | 14 | ++++++++++++++ |
A | oh-my-zsh/themes/cloud.zsh-theme | | | 11 | +++++++++++ |
A | oh-my-zsh/themes/crcandy.zsh-theme | | | 8 | ++++++++ |
A | oh-my-zsh/themes/crunch.zsh-theme | | | 43 | +++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/cypher.zsh-theme | | | 4 | ++++ |
A | oh-my-zsh/themes/dallas.zsh-theme | | | 32 | ++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/darkblood.zsh-theme | | | 9 | +++++++++ |
A | oh-my-zsh/themes/daveverwer.zsh-theme | | | 7 | +++++++ |
A | oh-my-zsh/themes/dieter.zsh-theme | | | 56 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/dogenpunk.zsh-theme | | | 79 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/dpoggi.zsh-theme | | | 14 | ++++++++++++++ |
A | oh-my-zsh/themes/dst.zsh-theme | | | 16 | ++++++++++++++++ |
A | oh-my-zsh/themes/dstufft.zsh-theme | | | 19 | +++++++++++++++++++ |
A | oh-my-zsh/themes/duellj.zsh-theme | | | 7 | +++++++ |
A | oh-my-zsh/themes/eastwood.zsh-theme | | | 23 | +++++++++++++++++++++++ |
A | oh-my-zsh/themes/edvardm.zsh-theme | | | 6 | ++++++ |
A | oh-my-zsh/themes/emotty.zsh-theme | | | 99 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/essembeh.zsh-theme | | | 30 | ++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/evan.zsh-theme | | | 3 | +++ |
A | oh-my-zsh/themes/example.zsh-theme | | | 6 | ++++++ |
A | oh-my-zsh/themes/fino-time.zsh-theme | | | 39 | +++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/fino.zsh-theme | | | 43 | +++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/fishy.zsh-theme | | | 29 | +++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/flazz.zsh-theme | | | 19 | +++++++++++++++++++ |
A | oh-my-zsh/themes/fletcherm.zsh-theme | | | 12 | ++++++++++++ |
A | oh-my-zsh/themes/fox.zsh-theme | | | 9 | +++++++++ |
A | oh-my-zsh/themes/frisk.zsh-theme | | | 12 | ++++++++++++ |
A | oh-my-zsh/themes/frontcube.zsh-theme | | | 12 | ++++++++++++ |
A | oh-my-zsh/themes/funky.zsh-theme | | | 15 | +++++++++++++++ |
A | oh-my-zsh/themes/fwalch.zsh-theme | | | 6 | ++++++ |
A | oh-my-zsh/themes/gallifrey.zsh-theme | | | 8 | ++++++++ |
A | oh-my-zsh/themes/gallois.zsh-theme | | | 23 | +++++++++++++++++++++++ |
A | oh-my-zsh/themes/garyblessington.zsh-theme | | | 6 | ++++++ |
A | oh-my-zsh/themes/gentoo.zsh-theme | | | 8 | ++++++++ |
A | oh-my-zsh/themes/geoffgarside.zsh-theme | | | 5 | +++++ |
A | oh-my-zsh/themes/gianu.zsh-theme | | | 6 | ++++++ |
A | oh-my-zsh/themes/gnzh.zsh-theme | | | 50 | ++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/gozilla.zsh-theme | | | 15 | +++++++++++++++ |
A | oh-my-zsh/themes/half-life.zsh-theme | | | 96 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/humza.zsh-theme | | | 26 | ++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/imajes.zsh-theme | | | 6 | ++++++ |
A | oh-my-zsh/themes/intheloop.zsh-theme | | | 23 | +++++++++++++++++++++++ |
A | oh-my-zsh/themes/itchy.zsh-theme | | | 18 | ++++++++++++++++++ |
A | oh-my-zsh/themes/jaischeema.zsh-theme | | | 16 | ++++++++++++++++ |
A | oh-my-zsh/themes/jbergantine.zsh-theme | | | 6 | ++++++ |
A | oh-my-zsh/themes/jispwoso.zsh-theme | | | 10 | ++++++++++ |
A | oh-my-zsh/themes/jnrowe.zsh-theme | | | 38 | ++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/jonathan.zsh-theme | | | 153 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/josh.zsh-theme | | | 43 | +++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/jreese.zsh-theme | | | 16 | ++++++++++++++++ |
A | oh-my-zsh/themes/jtriley.zsh-theme | | | 8 | ++++++++ |
A | oh-my-zsh/themes/juanghurtado.zsh-theme | | | 41 | +++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/junkfood.zsh-theme | | | 30 | ++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/kafeitu.zsh-theme | | | 6 | ++++++ |
A | oh-my-zsh/themes/kardan.zsh-theme | | | 13 | +++++++++++++ |
A | oh-my-zsh/themes/kennethreitz.zsh-theme | | | 16 | ++++++++++++++++ |
A | oh-my-zsh/themes/kiwi.zsh-theme | | | 12 | ++++++++++++ |
A | oh-my-zsh/themes/kolo.zsh-theme | | | 22 | ++++++++++++++++++++++ |
A | oh-my-zsh/themes/kphoen.zsh-theme | | | 43 | +++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/lambda.zsh-theme | | | 6 | ++++++ |
A | oh-my-zsh/themes/linuxonly.zsh-theme | | | 79 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/lukerandall.zsh-theme | | | 24 | ++++++++++++++++++++++++ |
A | oh-my-zsh/themes/macovsky-ruby.zsh-theme | | | 15 | +++++++++++++++ |
A | oh-my-zsh/themes/macovsky.zsh-theme | | | 14 | ++++++++++++++ |
A | oh-my-zsh/themes/maran.zsh-theme | | | 6 | ++++++ |
A | oh-my-zsh/themes/mgutz.zsh-theme | | | 6 | ++++++ |
A | oh-my-zsh/themes/mh.zsh-theme | | | 24 | ++++++++++++++++++++++++ |
A | oh-my-zsh/themes/michelebologna.zsh-theme | | | 75 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/mikeh.zsh-theme | | | 22 | ++++++++++++++++++++++ |
A | oh-my-zsh/themes/miloshadzic.zsh-theme | | | 8 | ++++++++ |
A | oh-my-zsh/themes/minimal.zsh-theme | | | 24 | ++++++++++++++++++++++++ |
A | oh-my-zsh/themes/mira.zsh-theme | | | 29 | +++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/mortalscumbag.zsh-theme | | | 59 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/mrtazz.zsh-theme | | | 7 | +++++++ |
A | oh-my-zsh/themes/murilasso.zsh-theme | | | 14 | ++++++++++++++ |
A | oh-my-zsh/themes/muse.zsh-theme | | | 33 | +++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/nanotech.zsh-theme | | | 7 | +++++++ |
A | oh-my-zsh/themes/nebirhos.zsh-theme | | | 21 | +++++++++++++++++++++ |
A | oh-my-zsh/themes/nicoulaj.zsh-theme | | | 43 | +++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/norm.zsh-theme | | | 4 | ++++ |
A | oh-my-zsh/themes/obraun.zsh-theme | | | 11 | +++++++++++ |
A | oh-my-zsh/themes/peepcode.zsh-theme | | | 44 | ++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/philips.zsh-theme | | | 14 | ++++++++++++++ |
A | oh-my-zsh/themes/pmcgee.zsh-theme | | | 16 | ++++++++++++++++ |
A | oh-my-zsh/themes/pure.zsh-theme | | | 10 | ++++++++++ |
A | oh-my-zsh/themes/pygmalion.zsh-theme | | | 34 | ++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/re5et.zsh-theme | | | 15 | +++++++++++++++ |
A | oh-my-zsh/themes/refined.zsh-theme | | | 106 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/rgm.zsh-theme | | | 8 | ++++++++ |
A | oh-my-zsh/themes/risto.zsh-theme | | | 6 | ++++++ |
A | oh-my-zsh/themes/rixius.zsh-theme | | | 21 | +++++++++++++++++++++ |
A | oh-my-zsh/themes/rkj-repos.zsh-theme | | | 36 | ++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/rkj.zsh-theme | | | 9 | +++++++++ |
A | oh-my-zsh/themes/robbyrussell.zsh-theme | | | 7 | +++++++ |
A | oh-my-zsh/themes/sammy.zsh-theme | | | 6 | ++++++ |
A | oh-my-zsh/themes/simonoff.zsh-theme | | | 138 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/simple.zsh-theme | | | 6 | ++++++ |
A | oh-my-zsh/themes/skaro.zsh-theme | | | 7 | +++++++ |
A | oh-my-zsh/themes/smt.zsh-theme | | | 86 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/sonicradish.zsh-theme | | | 37 | +++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/sorin.zsh-theme | | | 42 | ++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/sporty_256.zsh-theme | | | 13 | +++++++++++++ |
A | oh-my-zsh/themes/steeef.zsh-theme | | | 100 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/strug.zsh-theme | | | 25 | +++++++++++++++++++++++++ |
A | oh-my-zsh/themes/sunaku.zsh-theme | | | 26 | ++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/sunrise.zsh-theme | | | 93 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/superjarin.zsh-theme | | | 18 | ++++++++++++++++++ |
A | oh-my-zsh/themes/suvash.zsh-theme | | | 34 | ++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/takashiyoshida.zsh-theme | | | 27 | +++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/terminalparty.zsh-theme | | | 8 | ++++++++ |
A | oh-my-zsh/themes/theunraveler.zsh-theme | | | 17 | +++++++++++++++++ |
A | oh-my-zsh/themes/tjkirch.zsh-theme | | | 15 | +++++++++++++++ |
A | oh-my-zsh/themes/tjkirch_mod.zsh-theme | | | 13 | +++++++++++++ |
A | oh-my-zsh/themes/tonotdo.zsh-theme | | | 13 | +++++++++++++ |
A | oh-my-zsh/themes/trapd00r.zsh-theme | | | 94 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/wedisagree.zsh-theme | | | 108 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/wezm+.zsh-theme | | | 7 | +++++++ |
A | oh-my-zsh/themes/wezm.zsh-theme | | | 7 | +++++++ |
A | oh-my-zsh/themes/wuffers.zsh-theme | | | 5 | +++++ |
A | oh-my-zsh/themes/xiong-chiamiov-plus.zsh-theme | | | 6 | ++++++ |
A | oh-my-zsh/themes/xiong-chiamiov.zsh-theme | | | 6 | ++++++ |
A | oh-my-zsh/themes/ys.zsh-theme | | | 60 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/themes/zhann.zsh-theme | | | 23 | +++++++++++++++++++++++ |
A | oh-my-zsh/tools/check_for_upgrade.sh | | | 60 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/tools/install.sh | | | 116 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/tools/require_tool.sh | | | 161 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/tools/theme_chooser.sh | | | 97 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/tools/uninstall.sh | | | 34 | ++++++++++++++++++++++++++++++++++ |
A | oh-my-zsh/tools/upgrade.sh | | | 39 | +++++++++++++++++++++++++++++++++++++++ |
A | shpotify.cfg | | | 2 | ++ |
A | zshrc | | | 2 | ++ |
643 files changed, 48688 insertions(+), 0 deletions(-)
diff --git a/DS_Store b/DS_Store Binary files differ. diff --git a/bin/AMSTracker b/bin/AMSTracker Binary files differ. diff --git a/bin/Desktop Changer.app/Contents/Info.plist b/bin/Desktop Changer.app/Contents/Info.plist @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleAllowMixedLocalizations</key> + <true/> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>applet</string> + <key>CFBundleIconFile</key> + <string>applet</string> + <key>CFBundleIdentifier</key> + <string>com.apple.ScriptEditor.id.Desktop-Changer</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>Desktop Changer</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleSignature</key> + <string>aplt</string> + <key>LSMinimumSystemVersionByArchitecture</key> + <dict> + <key>x86_64</key> + <string>10.6</string> + </dict> + <key>LSRequiresCarbon</key> + <true/> + <key>WindowState</key> + <dict> + <key>bundleDividerCollapsed</key> + <true/> + <key>bundlePositionOfDivider</key> + <real>0.0</real> + <key>dividerCollapsed</key> + <false/> + <key>eventLogLevel</key> + <integer>2</integer> + <key>name</key> + <string>ScriptWindowState</string> + <key>positionOfDivider</key> + <real>529</real> + <key>savedFrame</key> + <string>0 98 1440 780 0 0 1440 878 </string> + <key>selectedTab</key> + <string>result</string> + </dict> +</dict> +</plist> diff --git a/bin/Desktop Changer.app/Contents/MacOS/applet b/bin/Desktop Changer.app/Contents/MacOS/applet Binary files differ. diff --git a/bin/Desktop Changer.app/Contents/PkgInfo b/bin/Desktop Changer.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPLaplt+ \ No newline at end of file diff --git a/bin/Desktop Changer.app/Contents/Resources/Scripts/main.scpt b/bin/Desktop Changer.app/Contents/Resources/Scripts/main.scpt Binary files differ. diff --git a/bin/Desktop Changer.app/Contents/Resources/applet.icns b/bin/Desktop Changer.app/Contents/Resources/applet.icns Binary files differ. diff --git a/bin/Desktop Changer.app/Contents/Resources/applet.rsrc b/bin/Desktop Changer.app/Contents/Resources/applet.rsrc Binary files differ. diff --git a/bin/Desktop Changer.app/Contents/Resources/description.rtfd/TXT.rtf b/bin/Desktop Changer.app/Contents/Resources/description.rtfd/TXT.rtf @@ -0,0 +1,5 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf830 +{\fonttbl} +{\colortbl;\red255\green255\blue255;} +{\*\expandedcolortbl;;} +}+ \ No newline at end of file diff --git a/bin/README.md b/bin/README.md @@ -0,0 +1,20 @@ +# My personal scripts folder +--- +## Catalog of items: +* `anythingtogif`: converts (almost) anything to a gif. Usage: `anythingtogif clip.mov clip.gif` +* `batteryCheck.scpt`: AppleScript that monitors battery and notifies when it's charged/empty +* `Desktop Changer.app`: an Automator application that changes the desktop background to a random image on login +* `epub-convert`: uses Calibre's ebook converter program to convert anything to an epub +* `executable`: my first script. Makes any file executable, along with further options. Usage: `executable file.sh` +* `gfx2gfx`: convert SWF into PDF. Usage: `gfx2gfx page.swf -o page.pdf` +* `icalBuddy`: can extract information about events from the iCal application +* `itunes_style_getter`: can find and set the genre in a track in iTunes (along with its Ruby helper). Usage: click on a track in iTunes, and run the program. +* `modified_cfscrape.py`: can scrape and download CloudFlare-protected websites. Usage: `python3 modified_cfscrape.py http://url.com` +* `mp3tagger.jar`: a Java application to tag MP3 files +* `percerr.rb`: a simple tool for calculating percent error. Just run the Ruby script. +* `strip-html-tags`: remove HTML tags from a file +* `tag`: a command-line `mp3tagger.jar`. Usage: `tag filename.mp3` +* `topdf`: converts a file to a PDF using cupsfilter. Works well on docx files. Usage: `topdf file [file2 file3 file4...]` +* `upx.out`: Fixes a fucked CORE keygen. Check Info.plist in bundle. If the version is lower than system version, and the crash log says "UPX compressed binary", just run `upx.out -d $coreKeygenBinaryPath` and you good. +* `usbmux`, `tcprelay`: port forwarding. If you want to SSH to an iPhone over USB, you can run `tcprelay 22:2222` to forward local port 2222 to the iPhone's SSH port (22), and then `ssh -p 2222 root@localhost`. +* `wattpad-scrape`: downloads a Wattpad book as an EPUB file. Usage: `wattpad-scrape $wattpad_url` diff --git a/bin/anythingtogif b/bin/anythingtogif @@ -0,0 +1,8 @@ +#!/bin/sh + +palette="/tmp/palette.png" + +filters="fps=24,scale=0:-1:flags=lanczos" + +ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette +ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2 diff --git a/bin/class-dump b/bin/class-dump Binary files differ. diff --git a/bin/clonedisk b/bin/clonedisk @@ -0,0 +1,55 @@ +#!/bin/bash + +# Disc backup/clone script +# Requires rsync 3 + +# Ask for the administrator password upfront +sudo -v + +if [ $# -ne 2 ]; then + echo "Usage: clonedisk [source] [destination]" + exit 1 +else + SRC=$1 + DST=$2 +fi + +EXCLUDE="clonedisk-ignore" + +PROG=$0 + +if [ ! -r "$SRC" ]; then + logger -t $PROG "Source $SRC not readable - Cannot start the sync process" + exit; +fi + +if [ ! -w "$DST" ]; then + logger -t $PROG "Destination $DST not writeable - Cannot start the sync process" + exit; +fi + +logger -t $PROG "Start rsync" + +sudo /usr/local/bin/rsync --acls \ + --archive \ + --delete \ + --delete-excluded \ + --exclude-from=$EXCLUDE \ + --hard-links \ + --one-file-system \ + --sparse \ + --verbose \ + --xattrs \ + "$SRC" "$DST" + +logger -t $PROG "End rsync" + +echo -n "Make the backup disk bootable? [Y/n]: " +read -nq shouldboot + +if [ $shouldboot == "y" ]; then + # Make the backup bootable + sudo bless -folder "$DST"/System/Library/CoreServices +fi + +exit 0 diff --git a/bin/clonedisk-ignore b/bin/clonedisk-ignore @@ -0,0 +1,15 @@ +.Spotlight-*/ +.Trashes +/afs/* +/automount/* +/cores/* +/dev/* +/Network/* +/private/tmp/* +/private/var/run/* +/private/var/spool/postfix/* +/private/var/vm/* +/Previous Systems.localized +/tmp/* +/Volumes/* +*/.Trash diff --git a/bin/cs_record_tasks.rb b/bin/cs_record_tasks.rb @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby +## CHANGE THIS TO THE FOLDER WHERE YOU WANT TO STORE YOUR FILE ## +filepath="/Users/alex/Desktop/ /Computer Science/IA/" + +## DO NOT MODIFY UNDER THIS COMMENT +require 'date' +print "Do you have a date? (y/n) " +if (gets.chomp=="y") + print "Enter the date (y-m-d): " + date=gets.chomp +else + date=Date.today.to_s +end + +print "Enter your task: " +task=gets.chomp + +finalpath="#{filepath}record_of_tasks.csv" +File.open(finalpath, 'a') { |file| + file.puts("#{date},#{task}") +}+ \ No newline at end of file diff --git a/bin/epub-convert b/bin/epub-convert @@ -0,0 +1 @@ +/Applications/Calibre.app/Contents/MacOS/ebook-convert "$1" "${1%.}.epub" diff --git a/bin/executable b/bin/executable @@ -0,0 +1,41 @@ +# CREATED BY ALEX BALGAVY OF INSIGHTDEV +# COPYRIGHT (C)2013 ALEX BALGAVY +# FREE TO USE OR SHARE + +#!/bin/bash +# Sets the parameters equal to variables +FILENAME="${1}" + +# Sets the exit error +NO_FILE="Exit error 85: No file found." + +# Starts the parameter case +# Checks if $FILENAME exists +if [ ! -e "$FILENAME" ]; then + echo "There is no file called $FILENAME" + echo "Please check spelling" + exit +else + echo "Congratulations found $FILENAME. " + + # Does some stuff to make it look cool + ls -lah $FILENAME + read -p "Process $FILENAME? Y or N:" PROCEED + case $PROCEED in + Y* | y*) + chmod +x $FILENAME + echo "Successfully changed to executable." + read -p "Do you want to run $FILENAME? Y or N:" RUN_OR_NOT + case $RUN_OR_NOT in + Y* | y*) + ./$FILENAME + ;; + *) + echo "File not run. You can manually run by doing ./$FILENAME" + ;; + *) + echo "File not processed." + ;; + esac +esac +fi+ \ No newline at end of file diff --git a/bin/gfx2gfx b/bin/gfx2gfx Binary files differ. diff --git a/bin/icalBuddy b/bin/icalBuddy Binary files differ. diff --git a/bin/itunes_style_getter b/bin/itunes_style_getter @@ -0,0 +1,121 @@ +#!/bin/bash + +if [ $# -ne 0 ]; then + case $1 in + "-p") + artist=`osascript -e "tell application \"iTunes\" to return artist of current track"`; + album=`osascript -e "tell application \"iTunes\" to return album of current track"`; + name=`osascript -e "tell application \"iTunes\" to return name of current track"`; + ;; + "-s") + artist=`osascript -e "tell application \"iTunes\" to return artist of selection"`; + album=`osascript -e "tell application \"iTunes\" to return album of selection"`; + name=`osascript -e "tell application \"iTunes\" to return name of selection"`; + esac +else + echo "Which track?" + select sc in "Selected" "Playing"; do + case $sc in + Selected) + artist=`osascript -e "tell application \"iTunes\" to return artist of selection"`; + album=`osascript -e "tell application \"iTunes\" to return album of selection"`; + name=`osascript -e "tell application \"iTunes\" to return name of selection"`; + break;; + Playing) + artist=`osascript -e "tell application \"iTunes\" to return artist of current track"`; + album=`osascript -e "tell application \"iTunes\" to return album of current track"`; + name=`osascript -e "tell application \"iTunes\" to return name of current track"`; + esac + done +fi + +if [ -z "$album" ]; then + # If there's no album, query without an album + genre=$(ruby /Users/alex/.bin/itunes_style_getter_helper.rb g "$artist" "$name"); + style=$(ruby /Users/alex/.bin/itunes_style_getter_helper.rb s "$artist" "$name"); + url=$(ruby /Users/alex/.bin/itunes_style_getter_helper.rb u "$artist" "$name"); +else + # Otherwise, add the album to query for precision + genre=$(ruby /Users/alex/.bin/itunes_style_getter_helper.rb g "$artist" "$album" "$name"); + style=$(ruby /Users/alex/.bin/itunes_style_getter_helper.rb s "$artist" "$album" "$name"); + url=$(ruby /Users/alex/.bin/itunes_style_getter_helper.rb u "$artist" "$name"); +fi + +# Parsing the arrays +# Split the Ruby arrays into Bash arrays, do some replacements to make it look nice +IFS=',' read -ra genre <<< "${genre}" +genre[0]=$(echo ${genre[0]} | sed -e 's/\[//') # Remove front [ +genre[$((${#genre[@]}-1))]=$(echo ${genre[$((${#genre[@]}-1))]} | sed -e 's/\]//') # Remove back ] + +IFS=',' read -ra style <<< "${style}" +style[0]=$(echo ${style[0]} | sed -e 's/\[//') # Remove front [ +style[$((${#style[@]}-1))]=$(echo ${style[$((${#style[@]}-1))]} | sed -e 's/\]//') # Remove back ] + +IFS=',' read -ra url <<< "${url}" +url[0]=$(echo ${url[0]} | sed -e 's/\[//') # Remove front [ +url[$((${#url[@]}-1))]=$(echo ${url[$((${#url[@]}-1))]} | sed -e 's/\]//') # Remove back ] + +# Give the user the source information +echo "URL: $url" +echo "You're changing the album \"$album\" by \"$artist\"" +printf '\n' + +# Select menu for genre +echo "Genre options:" +printf '%s\n' "${genre[@]}" +printf "\nWould you like to use one of these?\n" +select yn in "Yes" "No"; do + case $yn in + Yes) + select opt in "${genre[@]}"; do + case $opt in + *) + finalg=$(echo $opt | sed -e 's/"//g') + if [[ $finalg = "Hip Hop" ]]; then finalg="Hip-Hop"; fi + break;; + esac + done + break;; + No) + echo "Write your own then:" + read finalg + if [[ $finalg = "Hip Hop" ]]; then finalg="Hip-Hop"; fi + if [[ $finalg = "Post-Rock" ]]; then finalg="Post Rock"; fi + break;; + esac +done + +# Select menu for style +echo "Style options:" +printf '%s\n' "${style[@]}" +printf "\nWould you like to use one of these?\n" +select yn in "Yes" "No" "None needed"; do + case $yn in + Yes) + select opt in "${style[@]}"; do + case $opt in + *) + finals=$(echo \/$opt | sed -e 's/"//g') + break;; + esac + done + break;; + No) + echo "Write your own then:" + read finals + finals="/$finals" + break;; + "None needed") + break;; + esac +done + +# Finally, write the info to the iTunes track (AppleScript) +if [ -z "$album" ]; then + osascript -e "tell application \"iTunes\" to set the genre of every track whose name is \"$name\" and artist is \"${artist}\" to \"$finalg$finals\"" > /dev/null +else + osascript -e "tell application \"iTunes\" to set the genre of every track whose album is \"$album\" and artist is \"${artist}\" to \"$finalg$finals\"" > /dev/null +fi + +# ...and give a status message. +printf "\nGenre set to: $finalg$finals\n"+ \ No newline at end of file diff --git a/bin/itunes_style_getter_helper.rb b/bin/itunes_style_getter_helper.rb @@ -0,0 +1,40 @@ +require "discogs-wrapper" # Needed for API access + +# Remove this if sharing. This is required and unique for each user. +my_user_token = ENV["DISCOGS_API_TOKEN"] + +flag=ARGV.shift # Whether searching for genre or style +query=ARGV.join(" ") # Join the rest of the arguments into a search string + +# Search, and wrap the results in an array +wrapper=Discogs::Wrapper.new("iTunesStyleGetter", user_token: my_user_token) +res=[] +search=wrapper.search("#{query}") + +# If searching for a genre +if (flag=="g") + search.results.each do |result| + if result.genre? && !result.genre.empty? + result.genre.each do |g| + res.push("#{g}") + end + p res + end +end +# If searching for a style +elsif (flag=="s") + search.results.each do |result| + if result.style? && !result.style.empty? + result.style.to_a.each {|x| res.push x} + end + p res + end +# If searching for url +else + search.results.each do |result| + if result.style? && !result.style.empty? + res="http://discogs.com#{result.uri}".split(" ") + end + p res + end +end+ \ No newline at end of file diff --git a/bin/modified_cfscrape.py b/bin/modified_cfscrape.py @@ -0,0 +1,6 @@ +import cfscrape, sys +scraper=cfscrape.create_scraper() +url=sys.argv[1] +cfurl = scraper.get(url).content +name = url.split('/')[-1].replace("$20", "") +with open(name, 'wb') as f: f.write(cfurl)+ \ No newline at end of file diff --git a/bin/mp3tagger.jar b/bin/mp3tagger.jar Binary files differ. diff --git a/bin/percerr.rb b/bin/percerr.rb @@ -0,0 +1,20 @@ +#!/usr/bin/env ruby + +puts "Welcome to the Percent Error Calculator." +print "What is your estimated value? >> " +estimated=gets.chomp.to_f +print "What is your measured value? >> " +measured=gets.chomp.to_f + +if estimated>measured + err=estimated-measured +else + err=(estimated-measured)*-1 +end + +puts "Your error is " + err.to_s + "." + +percerr=(err/measured)*100 + +puts "Your percent error is " + percerr.to_s + "%." +puts "Rounded, this is " + percerr.round().to_s + "%."+ \ No newline at end of file diff --git a/bin/radio b/bin/radio @@ -0,0 +1,46 @@ +#!/bin/bash + +# Initial config, setting $radios and $radio_names +if [ -e ~/.radio-config ]; then + source ~/.radio-config +elif [ -e ~/.config/radio-config ]; then + source ~/.config/radio-config +else + echo "No radios set up. Please create a config file." + exit 1 +fi + +## MAIN SCRIPT ## + +VISUALISER=true +while getopts ":n" opt; do + case ${opt} in + n ) + VISUALISER=false + esac +done + +clear +echo "Welcome to the command line radio player." +PS3="Select a radio, or type q to exit: " +select RADIO in "${radio_names[@]}" +do + if [[ $RADIO = "q" ]]; then + break + else + for i in "${!radio_names[@]}"; do + if [[ "${radio_names[$i]}" = "${RADIO}" ]]; then + clear + echo "Now playing $RADIO" + echo "Loading..." + if $VISUALISER; then + nice -n 20 mpv ${radios[$i]} --script="/Users/alex/.config/mpv/visualizer.lua" --really-quiet -vo caca + else + nice -n 20 mpv ${radios[$i]} + fi + break + fi + done + break + fi +done diff --git a/bin/smack.pl b/bin/smack.pl @@ -0,0 +1,74 @@ +#!/usr/bin/perl -w + +# Smackbook for Yosemite Spaces +# ============================ +# Updated for OS X Yosemite by Steven Bock +# stevenbockster@gmail.com +# bocksg@plu.edu +# November 4th, 2014 +# +# Originally rebuilt by Jason Shen for OS X Leopard +# iamreal2@hotmail.com +# 16 Nov 2007 +# +# Based on Brian Jepson's Smaxpose2.command +# http://www.jepstone.net/blog/2006/05/25/expose-smackbook-pro-style/ +# Which is +# Based on Erling Ellingsen's SmackBook Pro scripts: +# http://blog.medallia.com/2006/05/smacbook_pro.html +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# ===================================================================== + +# USAGE: +# +# Save this script into a file called smackleopard.command, and make +# it executable with the Terminal command: +# +# chmod +x smackleopard.command +# +# Then, run it from the Terminal or double-click it in the Finder. + +use strict; +my $stable = 0; + +# Get AMSTracker from Amit Singh's site: +# http://www.osxbook.com/software/sms/amstracker/ +# and put AMSTracker in same directory as smackleopard.command +# +open F,"./AMSTracker -s -u0.01 |"; +while(<F>) { + my @a = /(-?\d+)/g; + print, next if @a != 3; + + # we get a signed short written as two unsigned bytes + $a[0] += 256 if $a[0] < 0; + my $x = $a[1]*256 + $a[0]; + + if(abs($x) < 20) { + $stable++; + } + + # you can adjust sensitivity here + # original file uses 30. 20 is better for me. + if(abs($x) > 10 && $stable > 10 ) { + $stable = 0; + + # check if it is LEFT or RIGHT tap + # I use ^ArrowKeys for Leopard Spaces to switch. + if ($x < 0) { + `osascript -e 'tell application \"System Events\" to keystroke (ASCII character 29) using control down'` + } else { + `osascript -e 'tell application \"System Events\" to keystroke (ASCII character 28) using control down'` + } + } +} diff --git a/bin/strip-html-tags b/bin/strip-html-tags @@ -0,0 +1,4 @@ +#!/usr/local/bin/ruby +text = File.read("text.txt") +newtext = text.gsub(/<\/?[^>]+(>|$)/, "") +File.open("text.txt","w") { |file| file.puts newtext} diff --git a/bin/tag b/bin/tag @@ -0,0 +1,30 @@ +#!/bin/bash +clear +cd ~ +echo Welcome to MP3 Tagger! +if [ $# -eq 0 ]; then + echo 'Sorry, you have not specified a file. Please specify a file while invoking the command, such as "tag filename.mp3"' + echo "Do you want to list all of the files available? (y/n) " + read ANSWER + if [ $ANSWER == "y" ]; then + ls ~/Music/iTunes/iTunes\ Music/ + else + exit 0 + fi +else + echo The file that will be tagged is $1 + java -jar ~/.bin/mp3tagger.jar Music/iTunes/iTunes\ Music/$1 + cd Music/iTunes/iTunes\ Music/ + echo The file $1 was tagged successfully. + cp *.mp3.tag ~/Desktop/ + rm *.mp3.tag + echo "The file with the information about the tag was moved to your Desktop. Would you like to display the information it contains? (y/n)" + read INFODISPLAY + if [ $INFODISPLAY == "y" ]; then + clear + cd ~/Desktop + cat $1.tag + else + echo Okay, the .tag file was saved. Now exiting. + fi +fi+ \ No newline at end of file diff --git a/bin/tcprelay.py b/bin/tcprelay.py @@ -0,0 +1,148 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# tcprelay.py - TCP connection relay for usbmuxd +# +# Copyright (C) 2009 Hector Martin "marcan" <hector@marcansoft.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 or version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +import usbmux +import SocketServer +import select +from optparse import OptionParser +import sys +import threading + +class SocketRelay(object): + def __init__(self, a, b, maxbuf=65535): + self.a = a + self.b = b + self.atob = "" + self.btoa = "" + self.maxbuf = maxbuf + def handle(self): + while True: + rlist = [] + wlist = [] + xlist = [self.a, self.b] + if self.atob: + wlist.append(self.b) + if self.btoa: + wlist.append(self.a) + if len(self.atob) < self.maxbuf: + rlist.append(self.a) + if len(self.btoa) < self.maxbuf: + rlist.append(self.b) + rlo, wlo, xlo = select.select(rlist, wlist, xlist) + if xlo: + return + if self.a in wlo: + n = self.a.send(self.btoa) + self.btoa = self.btoa[n:] + if self.b in wlo: + n = self.b.send(self.atob) + self.atob = self.atob[n:] + if self.a in rlo: + s = self.a.recv(self.maxbuf - len(self.atob)) + if not s: + return + self.atob += s + if self.b in rlo: + s = self.b.recv(self.maxbuf - len(self.btoa)) + if not s: + return + self.btoa += s + #print "Relay iter: %8d atob, %8d btoa, lists: %r %r %r"%(len(self.atob), len(self.btoa), rlo, wlo, xlo) + +class TCPRelay(SocketServer.BaseRequestHandler): + def handle(self): + print "Incoming connection to %d"%self.server.server_address[1] + mux = usbmux.USBMux(options.sockpath) + print "Waiting for devices..." + if not mux.devices: + mux.process(1.0) + if not mux.devices: + print "No device found" + self.request.close() + return + dev = mux.devices[0] + print "Connecting to device %s"%str(dev) + dsock = mux.connect(dev, self.server.rport) + lsock = self.request + print "Connection established, relaying data" + try: + fwd = SocketRelay(dsock, lsock, self.server.bufsize * 1024) + fwd.handle() + finally: + dsock.close() + lsock.close() + print "Connection closed" + +class TCPServer(SocketServer.TCPServer): + allow_reuse_address = True + +class ThreadedTCPServer(SocketServer.ThreadingMixIn, TCPServer): + pass + +HOST = "localhost" + +parser = OptionParser(usage="usage: %prog [OPTIONS] RemotePort[:LocalPort] [RemotePort[:LocalPort]]...") +parser.add_option("-t", "--threaded", dest='threaded', action='store_true', default=False, help="use threading to handle multiple connections at once") +parser.add_option("-b", "--bufsize", dest='bufsize', action='store', metavar='KILOBYTES', type='int', default=128, help="specify buffer size for socket forwarding") +parser.add_option("-s", "--socket", dest='sockpath', action='store', metavar='PATH', type='str', default=None, help="specify the path of the usbmuxd socket") + +options, args = parser.parse_args() + +serverclass = TCPServer +if options.threaded: + serverclass = ThreadedTCPServer + +if len(args) == 0: + parser.print_help() + sys.exit(1) + +ports = [] + +for arg in args: + try: + if ':' in arg: + rport, lport = arg.split(":") + rport = int(rport) + lport = int(lport) + ports.append((rport, lport)) + else: + ports.append((int(arg), int(arg))) + except: + parser.print_help() + sys.exit(1) + +servers=[] + +for rport, lport in ports: + print "Forwarding local port %d to remote port %d"%(lport, rport) + server = serverclass((HOST, lport), TCPRelay) + server.rport = rport + server.bufsize = options.bufsize + servers.append(server) + +alive = True + +while alive: + try: + rl, wl, xl = select.select(servers, [], []) + for server in rl: + server.handle_request() + except: + alive = False diff --git a/bin/topdf b/bin/topdf @@ -0,0 +1,8 @@ +#!/bin/bash +for f in "$@" +do + filePathNoExtension="${f%.*}" + textutil -convert html -output "$filePathNoExtension.html" "$f" + cupsfilter "$filePathNoExtension.html" > "$filePathNoExtension.pdf" + rm "$filePathNoExtension.html" > /dev/null +done+ \ No newline at end of file diff --git a/bin/upx.out b/bin/upx.out Binary files differ. diff --git a/bin/usbmux.py b/bin/usbmux.py @@ -0,0 +1,246 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# usbmux.py - usbmux client library for Python +# +# Copyright (C) 2009 Hector Martin "marcan" <hector@marcansoft.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 or version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +import socket, struct, select, sys + +try: + import plistlib + haveplist = True +except: + haveplist = False + +class MuxError(Exception): + pass + +class MuxVersionError(MuxError): + pass + +class SafeStreamSocket: + def __init__(self, address, family): + self.sock = socket.socket(family, socket.SOCK_STREAM) + self.sock.connect(address) + def send(self, msg): + totalsent = 0 + while totalsent < len(msg): + sent = self.sock.send(msg[totalsent:]) + if sent == 0: + raise MuxError("socket connection broken") + totalsent = totalsent + sent + def recv(self, size): + msg = '' + while len(msg) < size: + chunk = self.sock.recv(size-len(msg)) + if chunk == '': + raise MuxError("socket connection broken") + msg = msg + chunk + return msg + +class MuxDevice(object): + def __init__(self, devid, usbprod, serial, location): + self.devid = devid + self.usbprod = usbprod + self.serial = serial + self.location = location + def __str__(self): + return "<MuxDevice: ID %d ProdID 0x%04x Serial '%s' Location 0x%x>"%(self.devid, self.usbprod, self.serial, self.location) + +class BinaryProtocol(object): + TYPE_RESULT = 1 + TYPE_CONNECT = 2 + TYPE_LISTEN = 3 + TYPE_DEVICE_ADD = 4 + TYPE_DEVICE_REMOVE = 5 + VERSION = 0 + def __init__(self, socket): + self.socket = socket + self.connected = False + + def _pack(self, req, payload): + if req == self.TYPE_CONNECT: + return struct.pack("IH", payload['DeviceID'], payload['PortNumber']) + "\x00\x00" + elif req == self.TYPE_LISTEN: + return "" + else: + raise ValueError("Invalid outgoing request type %d"%req) + + def _unpack(self, resp, payload): + if resp == self.TYPE_RESULT: + return {'Number':struct.unpack("I", payload)[0]} + elif resp == self.TYPE_DEVICE_ADD: + devid, usbpid, serial, pad, location = struct.unpack("IH256sHI", payload) + serial = serial.split("\0")[0] + return {'DeviceID': devid, 'Properties': {'LocationID': location, 'SerialNumber': serial, 'ProductID': usbpid}} + elif resp == self.TYPE_DEVICE_REMOVE: + devid = struct.unpack("I", payload)[0] + return {'DeviceID': devid} + else: + raise MuxError("Invalid incoming request type %d"%req) + + def sendpacket(self, req, tag, payload={}): + payload = self._pack(req, payload) + if self.connected: + raise MuxError("Mux is connected, cannot issue control packets") + length = 16 + len(payload) + data = struct.pack("IIII", length, self.VERSION, req, tag) + payload + self.socket.send(data) + def getpacket(self): + if self.connected: + raise MuxError("Mux is connected, cannot issue control packets") + dlen = self.socket.recv(4) + dlen = struct.unpack("I", dlen)[0] + body = self.socket.recv(dlen - 4) + version, resp, tag = struct.unpack("III",body[:0xc]) + if version != self.VERSION: + raise MuxVersionError("Version mismatch: expected %d, got %d"%(self.VERSION,version)) + payload = self._unpack(resp, body[0xc:]) + return (resp, tag, payload) + +class PlistProtocol(BinaryProtocol): + TYPE_RESULT = "Result" + TYPE_CONNECT = "Connect" + TYPE_LISTEN = "Listen" + TYPE_DEVICE_ADD = "Attached" + TYPE_DEVICE_REMOVE = "Detached" #??? + TYPE_PLIST = 8 + VERSION = 1 + def __init__(self, socket): + if not haveplist: + raise Exception("You need the plistlib module") + BinaryProtocol.__init__(self, socket) + + def _pack(self, req, payload): + return payload + + def _unpack(self, resp, payload): + return payload + + def sendpacket(self, req, tag, payload={}): + payload['ClientVersionString'] = 'usbmux.py by marcan' + if isinstance(req, int): + req = [self.TYPE_CONNECT, self.TYPE_LISTEN][req-2] + payload['MessageType'] = req + payload['ProgName'] = 'tcprelay' + BinaryProtocol.sendpacket(self, self.TYPE_PLIST, tag, plistlib.writePlistToString(payload)) + def getpacket(self): + resp, tag, payload = BinaryProtocol.getpacket(self) + if resp != self.TYPE_PLIST: + raise MuxError("Received non-plist type %d"%resp) + payload = plistlib.readPlistFromString(payload) + return payload['MessageType'], tag, payload + +class MuxConnection(object): + def __init__(self, socketpath, protoclass): + self.socketpath = socketpath + if sys.platform in ['win32', 'cygwin']: + family = socket.AF_INET + address = ('127.0.0.1', 27015) + else: + family = socket.AF_UNIX + address = self.socketpath + self.socket = SafeStreamSocket(address, family) + self.proto = protoclass(self.socket) + self.pkttag = 1 + self.devices = [] + + def _getreply(self): + while True: + resp, tag, data = self.proto.getpacket() + if resp == self.proto.TYPE_RESULT: + return tag, data + else: + raise MuxError("Invalid packet type received: %d"%resp) + def _processpacket(self): + resp, tag, data = self.proto.getpacket() + if resp == self.proto.TYPE_DEVICE_ADD: + self.devices.append(MuxDevice(data['DeviceID'], data['Properties']['ProductID'], data['Properties']['SerialNumber'], data['Properties']['LocationID'])) + elif resp == self.proto.TYPE_DEVICE_REMOVE: + for dev in self.devices: + if dev.devid == data['DeviceID']: + self.devices.remove(dev) + elif resp == self.proto.TYPE_RESULT: + raise MuxError("Unexpected result: %d"%resp) + else: + raise MuxError("Invalid packet type received: %d"%resp) + def _exchange(self, req, payload={}): + mytag = self.pkttag + self.pkttag += 1 + self.proto.sendpacket(req, mytag, payload) + recvtag, data = self._getreply() + if recvtag != mytag: + raise MuxError("Reply tag mismatch: expected %d, got %d"%(mytag, recvtag)) + return data['Number'] + + def listen(self): + ret = self._exchange(self.proto.TYPE_LISTEN) + if ret != 0: + raise MuxError("Listen failed: error %d"%ret) + def process(self, timeout=None): + if self.proto.connected: + raise MuxError("Socket is connected, cannot process listener events") + rlo, wlo, xlo = select.select([self.socket.sock], [], [self.socket.sock], timeout) + if xlo: + self.socket.sock.close() + raise MuxError("Exception in listener socket") + if rlo: + self._processpacket() + def connect(self, device, port): + ret = self._exchange(self.proto.TYPE_CONNECT, {'DeviceID':device.devid, 'PortNumber':((port<<8) & 0xFF00) | (port>>8)}) + if ret != 0: + raise MuxError("Connect failed: error %d"%ret) + self.proto.connected = True + return self.socket.sock + def close(self): + self.socket.sock.close() + +class USBMux(object): + def __init__(self, socketpath=None): + if socketpath is None: + if sys.platform == 'darwin': + socketpath = "/var/run/usbmuxd" + else: + socketpath = "/var/run/usbmuxd" + self.socketpath = socketpath + self.listener = MuxConnection(socketpath, BinaryProtocol) + try: + self.listener.listen() + self.version = 0 + self.protoclass = BinaryProtocol + except MuxVersionError: + self.listener = MuxConnection(socketpath, PlistProtocol) + self.listener.listen() + self.protoclass = PlistProtocol + self.version = 1 + self.devices = self.listener.devices + def process(self, timeout=None): + self.listener.process(timeout) + def connect(self, device, port): + connector = MuxConnection(self.socketpath, self.protoclass) + return connector.connect(device, port) + +if __name__ == "__main__": + mux = USBMux() + print "Waiting for devices..." + if not mux.devices: + mux.process(0.1) + while True: + print "Devices:" + for dev in mux.devices: + print dev + mux.process() diff --git a/bin/usbmux.pyc b/bin/usbmux.pyc Binary files differ. diff --git a/bin/wattpad-scrape b/bin/wattpad-scrape @@ -0,0 +1,15 @@ +#!/bin/bash +current_directory=`pwd` +if [ $# -eq 0 ]; + then + echo "Pass the URL as an argument." + exit 0 +fi +cd ~/.bin/wattpad-ebook-scraper/ +python3 scrape.py $1 +book_title=`ls | grep *.epub` +mv $book_title $current_directory/ +folder_title=`echo $book_title | sed s/\.epub//g` +rm -r $folder_title +cd $current_directory +echo "Book $book_title extracted!" diff --git a/bin/xld b/bin/xld @@ -0,0 +1,11 @@ +#!/bin/sh + +#Edit this line to define a path to XLD.app +XLD_APP="/Applications/XLD.app" + +if [ ! -d "${XLD_APP}" ] ; then + echo "XLD.app not found" + exit; +fi + +"${XLD_APP}/Contents/MacOS/XLD" --cmdline "$@" diff --git a/commonprofile b/commonprofile @@ -0,0 +1 @@ +.commonprofile+ \ No newline at end of file diff --git a/gitconfig b/gitconfig @@ -0,0 +1 @@ +.gitconfig+ \ No newline at end of file diff --git a/gitignore b/gitignore @@ -0,0 +1,2 @@ +batteryCheck.scpt +.DS_Store diff --git a/oh-my-zsh/.oh-my-zsh b/oh-my-zsh/.oh-my-zsh @@ -0,0 +1 @@ +.oh-my-zsh+ \ No newline at end of file diff --git a/oh-my-zsh/CONTRIBUTING.md b/oh-my-zsh/CONTRIBUTING.md @@ -0,0 +1,123 @@ +# CONTRIBUTING GUIDELINES + +Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged and appreciated. +It is also essential for the development of the project. + +These guidelines are an attempt at better addressing the huge amount of pending +issues and pull requests. Please read them closely. + +Foremost, be so kind as to [search](#use-the-search-luke). This ensures any contribution +you would make is not already covered. + +* [Issues](#reporting-issues) + * [You have a problem](#you-have-a-problem) + * [You have a suggestion](#you-have-a-suggestion) +* [Pull Requests](#submitting-pull-requests) + * [Getting started](#getting-started) + * [You have a solution](#you-have-a-solution) + * [You have an addition](#you-have-an-addition) +* [Information sources (_aka_ search)](#use-the-search-luke) + +**BONUS:** [Volunteering](#you-have-spare-time-to-volunteer) + +## Reporting Issues + +### You have a problem + +Please be so kind as to [search](#use-the-search-luke) for any open issue already covering +your problem. + +If you find one, comment on it so we can know there are more people experiencing it. + +If not, look at the [Troubleshooting](https://github.com/robbyrussell/oh-my-zsh/wiki/Troubleshooting) +page for instructions on how to gather data to better debug your problem. + +Then, you can go ahead and create an issue with as much detail as you can provide. +It should include the data gathered as indicated above, along with: + +1. How to reproduce the problem +2. What the correct behavior should be +3. What the actual behavior is + +Please copy to anyone relevant (_eg_ plugin maintainers) by mentioning their GitHub handle +(starting with `@`) in your message. + +We will do our very best to help you. + +### You have a suggestion + +Please be so kind as to [search](#use-the-search-luke) for any open issue already covering +your suggestion. + +If you find one, comment on it so we can know there are more people supporting it. + +If not, you can go ahead and create an issue. Please copy to anyone relevant (_eg_ plugin +maintainers) by mentioning their GitHub handle (starting with `@`) in your message. + +## Submitting Pull Requests + +### Getting started + +You should be familiar with the basics of +[contributing on GitHub](https://help.github.com/articles/using-pull-requests) and have a fork +[properly set up](https://github.com/robbyrussell/oh-my-zsh/wiki/Contribution-Technical-Practices). + +You MUST always create PRs with _a dedicated branch_ based on the latest upstream tree. + +If you create your own PR, please make sure you do it right. Also be so kind as to reference +any issue that would be solved in the PR description body, +[for instance](https://help.github.com/articles/closing-issues-via-commit-messages/) +_"Fixes #XXXX"_ for issue number XXXX. + +### You have a solution + +Please be so kind as to [search](#use-the-search-luke) for any open issue already covering +your [problem](#you-have-a-problem), and any pending/merged/rejected PR covering your solution. + +If the solution is already reported, try it out and +1 the pull request if the +solution works ok. On the other hand, if you think your solution is better, post +it with a reference to the other one so we can have both solutions to compare. + +If not, then go ahead and submit a PR. Please copy to anyone relevant (e.g. plugin +maintainers) by mentioning their GitHub handle (starting with `@`) in your message. + +### You have an addition + +Please [do not](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#dont-send-us-your-theme-for-now) +send themes for now. + +Please be so kind as to [search](#use-the-search-luke) for any pending, merged or rejected Pull Requests +covering or related to what you want to add. + +If you find one, try it out and work with the author on a common solution. + +If not, then go ahead and submit a PR. Please copy to anyone relevant (_eg_ plugin +maintainers) by mentioning their GitHub handle (starting with `@`) in your message. + +For any extensive change, _eg_ a new plugin, you will have to find testers to +1 your PR. + +---- + +## Use the Search, Luke + +_May the Force (of past experiences) be with you_ + +GitHub offers [many search features](https://help.github.com/articles/searching-github/) +to help you check whether a similar contribution to yours already exists. Please search +before making any contribution, it avoids duplicates and eases maintenance. Trust me, +that works 90% of the time. + +You can also take a look at the [FAQ](https://github.com/robbyrussell/oh-my-zsh/wiki/FAQ) +to be sure your contribution has not already come up. + +If all fails, your thing has probably not been reported yet, so you can go ahead +and [create an issue](#reporting-issues) or [submit a PR](#submitting-pull-requests). + +---- + +### You have spare time to volunteer + +Very nice!! :) + +Please have a look at the [Volunteer](https://github.com/robbyrussell/oh-my-zsh/wiki/Volunteers) +page for instructions on where to start and more. diff --git a/oh-my-zsh/LICENSE.txt b/oh-my-zsh/LICENSE.txt @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2009-2018 Robby Russell and contributors +See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/oh-my-zsh/README.md b/oh-my-zsh/README.md @@ -0,0 +1,251 @@ +<p align="center"> + <img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh"> +</p> + +Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration. + +Sounds boring. Let's try again. + +__Oh My Zsh will not make you a 10x developer...but you might feel like one.__ + +Once installed, your terminal shell will become the talk of the town _or your money back!_ With each keystroke in your command prompt, you'll take advantage of the hundreds of powerful plugins and beautiful themes. Strangers will come up to you in cafés and ask you, _"that is amazing! are you some sort of genius?"_ + +Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often. 😬 + +To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. + +## Getting Started + +### Prerequisites + +__Disclaimer:__ _Oh My Zsh works best on macOS and Linux._ + +* Unix-like operating system (macOS or Linux) +* [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH) +* `curl` or `wget` should be installed +* `git` should be installed + +### Basic Installation + +Oh My Zsh is installed by running one of the following commands in your terminal. You can install this via the command-line with either `curl` or `wget`. + +#### via curl + +```shell +sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +``` + +#### via wget + +```shell +sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" +``` + +## Using Oh My Zsh + +### Plugins + +Oh My Zsh comes with a shitload of plugins to take advantage of. You can take a look in the [plugins](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins) directory and/or the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins) to see what's currently available. + +#### Enabling Plugins + +Once you spot a plugin (or several) that you'd like to use with Oh My Zsh, you'll need to enable them in the `.zshrc` file. You'll find the zshrc file in your `$HOME` directory. Open it with your favorite text editor and you'll see a spot to list all the plugins you want to load. + +```shell +vi ~/.zshrc +``` + +For example, this might begin to look like this: + +```shell +plugins=( + git + bundler + dotenv + osx + rake + rbenv + ruby +) +``` + +#### Using Plugins + +Most plugins (should! we're working on this) include a __README__, which documents how to use them. + +### Themes + +We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://wiki.github.com/robbyrussell/oh-my-zsh/themes) on the wiki. Check them out! + +#### Selecting a Theme + +_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just the right one (for him)._ + +Once you find a theme that you'd like to use, you will need to edit the `~/.zshrc` file. You'll see an environment variable (all caps) in there that looks like: + +```shell +ZSH_THEME="robbyrussell" +``` + +To use a different theme, simply change the value to match the name of your desired theme. For example: + +```shell +ZSH_THEME="agnoster" # (this is one of the fancy ones) +# see https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#agnoster +``` + +_Note: many themes require installing the [Powerline Fonts](https://github.com/powerline/fonts) in order to render properly._ + +Open up a new terminal window and your prompt should look something like this: + +![Agnoster theme](https://cloud.githubusercontent.com/assets/2618447/6316862/70f58fb6-ba03-11e4-82c9-c083bf9a6574.png) + +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). + +If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window. + + +```shell +ZSH_THEME="random" # (...please let it be pie... please be some pie..) +``` + +And if you want to pick random theme from a list of your favorite themes: + +```shell +ZSH_THEME_RANDOM_CANDIDATES=( + "robbyrussell" + "agnoster" +) +``` + +## Advanced Topics + +If you're the type that likes to get their hands dirty, these sections might resonate. + +### Advanced Installation + +Some users may want to change the default path, or manually install Oh My Zsh. + +#### Custom Directory + +The default location is `~/.oh-my-zsh` (hidden in your home directory) + +If you'd like to change the install directory with the `ZSH` environment variable, either by running `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this: + +```shell +export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +``` + +#### Manual Installation + +##### 1. Clone the repository: + +```shell +git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh +``` + +##### 2. *Optionally*, backup your existing `~/.zshrc` file: + +```shell +cp ~/.zshrc ~/.zshrc.orig +``` + +##### 3. Create a new zsh configuration file + +You can create a new zsh config file by copying the template that we have included for you. + +```shell +cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc +``` + +##### 4. Change your default shell + +```shell +chsh -s /bin/zsh +``` + +##### 5. Initialize your new zsh configuration + +Once you open up a new terminal window, it should load zsh with Oh My Zsh's configuration. + +### Installation Problems + +If you have any hiccups installing, here are a few common fixes. + +* You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after switching to `oh-my-zsh`. +* If you installed manually or changed the install location, check the `ZSH` environment variable in `~/.zshrc`. + +### Custom Plugins and Themes + +If you want to override any of the default behaviors, just add a new file (ending in `.zsh`) in the `custom/` directory. + +If you have many functions that go well together, you can put them as a `XYZ.plugin.zsh` file in the `custom/plugins/` directory and then enable this plugin. + +If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`. + +## Getting Updates + +By default, you will be prompted to check for upgrades every few weeks. If you would like `oh-my-zsh` to automatically upgrade itself without prompting you, set the following in your `~/.zshrc`: + +```shell +DISABLE_UPDATE_PROMPT=true +``` + +To disable automatic upgrades, set the following in your `~/.zshrc`: + +```shell +DISABLE_AUTO_UPDATE=true +``` + +### Manual Updates + +If you'd like to upgrade at any point in time (maybe someone just released a new plugin and you don't want to wait a week?) you just need to run: + +```shell +upgrade_oh_my_zsh +``` + +Magic! 🎉 + +## Uninstalling Oh My Zsh + +Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy breakup. + +If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the command-line. It will remove itself and revert your previous `bash` or `zsh` configuration. + +## Contributing + +I'm far from being a [Zsh](http://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests! + +We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/robbyrussell/oh-my-zsh/issues) and help where you can. + +### Do NOT send us themes + +We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes) wiki page. + +## Contributors + +Oh My Zsh has a vibrant community of happy users and delightful contributors. Without all the time and help from our contributors, it wouldn't be so awesome. + +Thank you so much! + +## Follow Us + +We're on the social media. + +* [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. You should follow it. +* [Oh My Zsh](https://www.facebook.com/Oh-My-Zsh-296616263819290/) on Facebook. + +## Merchandise + +We have [stickers](https://shop.planetargon.com/products/ohmyzsh-stickers-set-of-3-stickers) and [shirts](http://shop.planetargon.com/products/ohmyzsh-t-shirts) for you to show off your love of Oh My Zsh. Again, this will help you become the talk of the town! + +## License + +Oh My Zsh is released under the [MIT license](LICENSE.txt). + +## About Planet Argon + +![Planet Argon](https://pa-github-assets.s3.amazonaws.com/PARGON_logo_digital_COL-small.jpg) + +Oh My Zsh was started by the team at [Planet Argon](https://www.planetargon.com/?utm_source=github), a [Ruby on Rails development agency](https://www.planetargon.com/skills/ruby-on-rails-development?utm_source=github). Check out our [other open source projects](https://www.planetargon.com/open-source?utm_source=github). diff --git a/oh-my-zsh/cache/.gitkeep b/oh-my-zsh/cache/.gitkeep diff --git a/oh-my-zsh/custom/example.zsh b/oh-my-zsh/custom/example.zsh @@ -0,0 +1,10 @@ +# You can put files here to add functionality separated per file, which +# will be ignored by git. +# Files on the custom/ directory will be automatically loaded by the init +# script, in alphabetical order. + +# For example: add yourself some shortcuts to projects you often work on. +# +# brainstormr=~/Projects/development/planetargon/brainstormr +# cd $brainstormr +# diff --git a/oh-my-zsh/custom/plugins/example/example.plugin.zsh b/oh-my-zsh/custom/plugins/example/example.plugin.zsh @@ -0,0 +1,2 @@ +# Add your own custom plugins in the custom/plugins directory. Plugins placed +# here will override ones with the same name in the main plugins directory. diff --git a/oh-my-zsh/custom/themes/powerlevel9k b/oh-my-zsh/custom/themes/powerlevel9k @@ -0,0 +1 @@ +Subproject commit 13b0e383a066c9c37d5cf71d4af521f9b73a173e diff --git a/oh-my-zsh/lib/bzr.zsh b/oh-my-zsh/lib/bzr.zsh @@ -0,0 +1,10 @@ +## Bazaar integration +## Just works with the GIT integration just add $(bzr_prompt_info) to the PROMPT +function bzr_prompt_info() { + BZR_CB=`bzr nick 2> /dev/null | grep -v "ERROR" | cut -d ":" -f2 | awk -F / '{print "bzr::"$1}'` + if [ -n "$BZR_CB" ]; then + BZR_DIRTY="" + [[ -n `bzr status` ]] && BZR_DIRTY=" %{$fg[red]%} * %{$fg[green]%}" + echo "$ZSH_THEME_SCM_PROMPT_PREFIX$BZR_CB$BZR_DIRTY$ZSH_THEME_GIT_PROMPT_SUFFIX" + fi +}+ \ No newline at end of file diff --git a/oh-my-zsh/lib/clipboard.zsh b/oh-my-zsh/lib/clipboard.zsh @@ -0,0 +1,86 @@ +# System clipboard integration +# +# This file has support for doing system clipboard copy and paste operations +# from the command line in a generic cross-platform fashion. +# +# On OS X and Windows, the main system clipboard or "pasteboard" is used. On other +# Unix-like OSes, this considers the X Windows CLIPBOARD selection to be the +# "system clipboard", and the X Windows `xclip` command must be installed. + +# clipcopy - Copy data to clipboard +# +# Usage: +# +# <command> | clipcopy - copies stdin to clipboard +# +# clipcopy <file> - copies a file's contents to clipboard +# +function clipcopy() { + emulate -L zsh + local file=$1 + if [[ $OSTYPE == darwin* ]]; then + if [[ -z $file ]]; then + pbcopy + else + cat $file | pbcopy + fi + elif [[ $OSTYPE == cygwin* ]]; then + if [[ -z $file ]]; then + cat > /dev/clipboard + else + cat $file > /dev/clipboard + fi + else + if (( $+commands[xclip] )); then + if [[ -z $file ]]; then + xclip -in -selection clipboard + else + xclip -in -selection clipboard $file + fi + elif (( $+commands[xsel] )); then + if [[ -z $file ]]; then + xsel --clipboard --input + else + cat "$file" | xsel --clipboard --input + fi + else + print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 + return 1 + fi + fi +} + +# clippaste - "Paste" data from clipboard to stdout +# +# Usage: +# +# clippaste - writes clipboard's contents to stdout +# +# clippaste | <command> - pastes contents and pipes it to another process +# +# clippaste > <file> - paste contents to a file +# +# Examples: +# +# # Pipe to another process +# clippaste | grep foo +# +# # Paste to a file +# clippaste > file.txt +function clippaste() { + emulate -L zsh + if [[ $OSTYPE == darwin* ]]; then + pbpaste + elif [[ $OSTYPE == cygwin* ]]; then + cat /dev/clipboard + else + if (( $+commands[xclip] )); then + xclip -out -selection clipboard + elif (( $+commands[xsel] )); then + xsel --clipboard --output + else + print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 + return 1 + fi + fi +} diff --git a/oh-my-zsh/lib/compfix.zsh b/oh-my-zsh/lib/compfix.zsh @@ -0,0 +1,60 @@ +# Handle completions insecurities (i.e., completion-dependent directories with +# insecure ownership or permissions) by: +# +# * Human-readably notifying the user of these insecurities. +# * Moving away all existing completion caches to a temporary directory. Since +# any of these caches may have been generated from insecure directories, they +# are all suspect now. Failing to do so typically causes subsequent compinit() +# calls to fail with "command not found: compdef" errors. (That's bad.) +function handle_completion_insecurities() { + # List of the absolute paths of all unique insecure directories, split on + # newline from compaudit()'s output resembling: + # + # There are insecure directories: + # /usr/share/zsh/site-functions + # /usr/share/zsh/5.0.6/functions + # /usr/share/zsh + # /usr/share/zsh/5.0.6 + # + # Since the ignorable first line is printed to stderr and thus not captured, + # stderr is squelched to prevent this output from leaking to the user. + local -aU insecure_dirs + insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} ) + + # If no such directories exist, get us out of here. + if (( ! ${#insecure_dirs} )); then + print "[oh-my-zsh] No insecure completion-dependent directories detected." + return + fi + + # List ownership and permissions of all insecure directories. + print "[oh-my-zsh] Insecure completion-dependent directories detected:" + ls -ld "${(@)insecure_dirs}" + print "[oh-my-zsh] For safety, completions will be disabled until you manually fix all" + print "[oh-my-zsh] insecure directory permissions and ownership and restart oh-my-zsh." + print "[oh-my-zsh] See the above list for directories with group or other writability.\n" + + # Locally enable the "NULL_GLOB" option, thus removing unmatched filename + # globs from argument lists *AND* printing no warning when doing so. Failing + # to do so prints an unreadable warning if no completion caches exist below. + setopt local_options null_glob + + # List of the absolute paths of all unique existing completion caches. + local -aU zcompdump_files + zcompdump_files=( "${ZSH_COMPDUMP}"(.) "${ZDOTDIR:-${HOME}}"/.zcompdump* ) + + # Move such caches to a temporary directory. + if (( ${#zcompdump_files} )); then + # Absolute path of the directory to which such files will be moved. + local ZSH_ZCOMPDUMP_BAD_DIR="${ZSH_CACHE_DIR}/zcompdump-bad" + + # List such files first. + print "[oh-my-zsh] Insecure completion caches also detected:" + ls -l "${(@)zcompdump_files}" + + # For safety, move rather than permanently remove such files. + print "[oh-my-zsh] Moving to \"${ZSH_ZCOMPDUMP_BAD_DIR}/\"...\n" + mkdir -p "${ZSH_ZCOMPDUMP_BAD_DIR}" + mv "${(@)zcompdump_files}" "${ZSH_ZCOMPDUMP_BAD_DIR}/" + fi +} diff --git a/oh-my-zsh/lib/completion.zsh b/oh-my-zsh/lib/completion.zsh @@ -0,0 +1,70 @@ +# fixme - the load process here seems a bit bizarre +zmodload -i zsh/complist + +WORDCHARS='' + +unsetopt menu_complete # do not autoselect the first completion entry +unsetopt flowcontrol +setopt auto_menu # show completion menu on successive tab press +setopt complete_in_word +setopt always_to_end + +# should this be in keybindings? +bindkey -M menuselect '^o' accept-and-infer-next-history +zstyle ':completion:*:*:*:*:*' menu select + +# case insensitive (all), partial-word and substring completion +if [[ "$CASE_SENSITIVE" = true ]]; then + zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*' +else + if [[ "$HYPHEN_INSENSITIVE" = true ]]; then + zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*' + else + zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*' + fi +fi +unset CASE_SENSITIVE HYPHEN_INSENSITIVE + +zstyle ':completion:*' list-colors '' +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' + +if [[ "$OSTYPE" = solaris* ]]; then + zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm" +else + zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w" +fi + +# disable named-directories autocompletion +zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories + +# Use caching so that commands like apt and dpkg complete are useable +zstyle ':completion::complete:*' use-cache 1 +zstyle ':completion::complete:*' cache-path $ZSH_CACHE_DIR + +# Don't complete uninteresting users +zstyle ':completion:*:*:*:users' ignored-patterns \ + adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \ + clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \ + gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \ + ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \ + named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \ + operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \ + rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \ + usbmux uucp vcsa wwwrun xfs '_*' + +# ... unless we really want to. +zstyle '*' single-ignored show + +if [[ $COMPLETION_WAITING_DOTS = true ]]; then + expand-or-complete-with-dots() { + # toggle line-wrapping off and back on again + [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam + print -Pn "%{%F{red}......%f%}" + [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam + + zle expand-or-complete + zle redisplay + } + zle -N expand-or-complete-with-dots + bindkey "^I" expand-or-complete-with-dots +fi diff --git a/oh-my-zsh/lib/correction.zsh b/oh-my-zsh/lib/correction.zsh @@ -0,0 +1,13 @@ +if [[ "$ENABLE_CORRECTION" == "true" ]]; then + alias ebuild='nocorrect ebuild' + alias gist='nocorrect gist' + alias heroku='nocorrect heroku' + alias hpodder='nocorrect hpodder' + alias man='nocorrect man' + alias mkdir='nocorrect mkdir' + alias mv='nocorrect mv' + alias mysql='nocorrect mysql' + alias sudo='nocorrect sudo' + + setopt correct_all +fi diff --git a/oh-my-zsh/lib/diagnostics.zsh b/oh-my-zsh/lib/diagnostics.zsh @@ -0,0 +1,353 @@ +# diagnostics.zsh +# +# Diagnostic and debugging support for oh-my-zsh + +# omz_diagnostic_dump() +# +# Author: Andrew Janke <andrew@apjanke.net> +# +# Usage: +# +# omz_diagnostic_dump [-v] [-V] [file] +# +# NOTE: This is a work in progress. Its interface and behavior are going to change, +# and probably in non-back-compatible ways. +# +# Outputs a bunch of information about the state and configuration of +# oh-my-zsh, zsh, and the user's system. This is intended to provide a +# bunch of context for diagnosing your own or a third party's problems, and to +# be suitable for posting to public bug reports. +# +# The output is human-readable and its format may change over time. It is not +# suitable for parsing. All the output is in one single file so it can be posted +# as a gist or bug comment on GitHub. GitHub doesn't support attaching tarballs +# or other files to bugs; otherwise, this would probably have an option to produce +# tarballs that contain copies of the config and customization files instead of +# catting them all in to one file. +# +# This is intended to be widely portable, and run anywhere that oh-my-zsh does. +# Feel free to report any portability issues as bugs. +# +# This is written in a defensive style so it still works (and can detect) cases when +# basic functionality like echo and which have been redefined. In particular, almost +# everything is invoked with "builtin" or "command", to work in the face of user +# redefinitions. +# +# OPTIONS +# +# [file] Specifies the output file. If not given, a file in the current directory +# is selected automatically. +# +# -v Increase the verbosity of the dump output. May be specified multiple times. +# Verbosity levels: +# 0 - Basic info, shell state, omz configuration, git state +# 1 - (default) Adds key binding info and configuration file contents +# 2 - Adds zcompdump file contents +# +# -V Reduce the verbosity of the dump output. May be specified multiple times. +# +# TODO: +# * Multi-file capture +# * Add automatic gist uploading +# * Consider whether to move default output file location to TMPDIR. More robust +# but less user friendly. +# + +autoload -Uz is-at-least + +function omz_diagnostic_dump() { + emulate -L zsh + + builtin echo "Generating diagnostic dump; please be patient..." + + local thisfcn=omz_diagnostic_dump + local -A opts + local opt_verbose opt_noverbose opt_outfile + local timestamp=$(date +%Y%m%d-%H%M%S) + local outfile=omz_diagdump_$timestamp.txt + builtin zparseopts -A opts -D -- "v+=opt_verbose" "V+=opt_noverbose" + local verbose n_verbose=${#opt_verbose} n_noverbose=${#opt_noverbose} + (( verbose = 1 + n_verbose - n_noverbose )) + + if [[ ${#*} > 0 ]]; then + opt_outfile=$1 + fi + if [[ ${#*} > 1 ]]; then + builtin echo "$thisfcn: error: too many arguments" >&2 + return 1 + fi + if [[ -n "$opt_outfile" ]]; then + outfile="$opt_outfile" + fi + + # Always write directly to a file so terminal escape sequences are + # captured cleanly + _omz_diag_dump_one_big_text &> "$outfile" + if [[ $? != 0 ]]; then + builtin echo "$thisfcn: error while creating diagnostic dump; see $outfile for details" + fi + + builtin echo + builtin echo Diagnostic dump file created at: "$outfile" + builtin echo + builtin echo To share this with OMZ developers, post it as a gist on GitHub + builtin echo at "https://gist.github.com" and share the link to the gist. + builtin echo + builtin echo "WARNING: This dump file contains all your zsh and omz configuration files," + builtin echo "so don't share it publicly if there's sensitive information in them." + builtin echo + +} + +function _omz_diag_dump_one_big_text() { + local program programs progfile md5 + + builtin echo oh-my-zsh diagnostic dump + builtin echo + builtin echo $outfile + builtin echo + + # Basic system and zsh information + command date + command uname -a + builtin echo OSTYPE=$OSTYPE + builtin echo ZSH_VERSION=$ZSH_VERSION + builtin echo User: $USER + builtin echo umask: $(umask) + builtin echo + _omz_diag_dump_os_specific_version + builtin echo + + # Installed programs + programs=(sh zsh ksh bash sed cat grep ls find git posh) + local progfile="" extra_str="" sha_str="" + for program in $programs; do + extra_str="" sha_str="" + progfile=$(builtin which $program) + if [[ $? == 0 ]]; then + if [[ -e $progfile ]]; then + if builtin whence shasum &>/dev/null; then + sha_str=($(command shasum $progfile)) + sha_str=$sha_str[1] + extra_str+=" SHA $sha_str" + fi + if [[ -h "$progfile" ]]; then + extra_str+=" ( -> ${progfile:A} )" + fi + fi + builtin printf '%-9s %-20s %s\n' "$program is" "$progfile" "$extra_str" + else + builtin echo "$program: not found" + fi + done + builtin echo + builtin echo Command Versions: + builtin echo "zsh: $(zsh --version)" + builtin echo "this zsh session: $ZSH_VERSION" + builtin echo "bash: $(bash --version | command grep bash)" + builtin echo "git: $(git --version)" + builtin echo "grep: $(grep --version)" + builtin echo + + # Core command definitions + _omz_diag_dump_check_core_commands || return 1 + builtin echo + + # ZSH Process state + builtin echo Process state: + builtin echo pwd: $PWD + if builtin whence pstree &>/dev/null; then + builtin echo Process tree for this shell: + pstree -p $$ + else + ps -fT + fi + builtin set | command grep -a '^\(ZSH\|plugins\|TERM\|LC_\|LANG\|precmd\|chpwd\|preexec\|FPATH\|TTY\|DISPLAY\|PATH\)\|OMZ' + builtin echo + #TODO: Should this include `env` instead of or in addition to `export`? + builtin echo Exported: + builtin echo $(builtin export | command sed 's/=.*//') + builtin echo + builtin echo Locale: + command locale + builtin echo + + # Zsh installation and configuration + builtin echo Zsh configuration: + builtin echo setopt: $(builtin setopt) + builtin echo + builtin echo zstyle: + builtin zstyle + builtin echo + builtin echo 'compaudit output:' + compaudit + builtin echo + builtin echo '$fpath directories:' + command ls -lad $fpath + builtin echo + + # Oh-my-zsh installation + builtin echo oh-my-zsh installation: + command ls -ld ~/.z* + command ls -ld ~/.oh* + builtin echo + builtin echo oh-my-zsh git state: + (cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]") + if [[ $verbose -ge 1 ]]; then + (cd $ZSH && git reflog --date=default | command grep pull) + fi + builtin echo + if [[ -e $ZSH_CUSTOM ]]; then + local custom_dir=$ZSH_CUSTOM + if [[ -h $custom_dir ]]; then + custom_dir=$(cd $custom_dir && pwd -P) + fi + builtin echo "oh-my-zsh custom dir:" + builtin echo " $ZSH_CUSTOM ($custom_dir)" + (cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print) + builtin echo + fi + + # Key binding and terminal info + if [[ $verbose -ge 1 ]]; then + builtin echo "bindkey:" + builtin bindkey + builtin echo + builtin echo "infocmp:" + command infocmp -L + builtin echo + fi + + # Configuration file info + local zdotdir=${ZDOTDIR:-$HOME} + builtin echo "Zsh configuration files:" + local cfgfile cfgfiles + # Some files for bash that zsh does not use are intentionally included + # to help with diagnosing behavior differences between bash and zsh + cfgfiles=( /etc/zshenv /etc/zprofile /etc/zshrc /etc/zlogin /etc/zlogout + $zdotdir/.zshenv $zdotdir/.zprofile $zdotdir/.zshrc $zdotdir/.zlogin $zdotdir/.zlogout + ~/.zsh.pre-oh-my-zsh + /etc/bashrc /etc/profile ~/.bashrc ~/.profile ~/.bash_profile ~/.bash_logout ) + command ls -lad $cfgfiles 2>&1 + builtin echo + if [[ $verbose -ge 1 ]]; then + for cfgfile in $cfgfiles; do + _omz_diag_dump_echo_file_w_header $cfgfile + done + fi + builtin echo + builtin echo "Zsh compdump files:" + local dumpfile dumpfiles + command ls -lad $zdotdir/.zcompdump* + dumpfiles=( $zdotdir/.zcompdump*(N) ) + if [[ $verbose -ge 2 ]]; then + for dumpfile in $dumpfiles; do + _omz_diag_dump_echo_file_w_header $dumpfile + done + fi + +} + +function _omz_diag_dump_check_core_commands() { + builtin echo "Core command check:" + local redefined name builtins externals reserved_words + redefined=() + # All the zsh non-module builtin commands + # These are taken from the zsh reference manual for 5.0.2 + # Commands from modules should not be included. + # (For back-compatibility, if any of these are newish, they should be removed, + # or at least made conditional on the version of the current running zsh.) + # "history" is also excluded because OMZ is known to redefine that + reserved_words=( do done esac then elif else fi for case if while function + repeat time until select coproc nocorrect foreach end '!' '[[' '{' '}' + ) + builtins=( alias autoload bg bindkey break builtin bye cd chdir command + comparguments compcall compctl compdescribe compfiles compgroups compquote comptags + comptry compvalues continue dirs disable disown echo echotc echoti emulate + enable eval exec exit false fc fg functions getln getopts hash + jobs kill let limit log logout noglob popd print printf + pushd pushln pwd r read rehash return sched set setopt shift + source suspend test times trap true ttyctl type ulimit umask unalias + unfunction unhash unlimit unset unsetopt vared wait whence where which zcompile + zle zmodload zparseopts zregexparse zstyle ) + if is-at-least 5.1; then + reserved_word+=( declare export integer float local readonly typeset ) + else + builtins+=( declare export integer float local readonly typeset ) + fi + builtins_fatal=( builtin command local ) + externals=( zsh ) + for name in $reserved_words; do + if [[ $(builtin whence -w $name) != "$name: reserved" ]]; then + builtin echo "reserved word '$name' has been redefined" + builtin which $name + redefined+=$name + fi + done + for name in $builtins; do + if [[ $(builtin whence -w $name) != "$name: builtin" ]]; then + builtin echo "builtin '$name' has been redefined" + builtin which $name + redefined+=$name + fi + done + for name in $externals; do + if [[ $(builtin whence -w $name) != "$name: command" ]]; then + builtin echo "command '$name' has been redefined" + builtin which $name + redefined+=$name + fi + done + + if [[ -n "$redefined" ]]; then + builtin echo "SOME CORE COMMANDS HAVE BEEN REDEFINED: $redefined" + else + builtin echo "All core commands are defined normally" + fi + +} + +function _omz_diag_dump_echo_file_w_header() { + local file=$1 + if [[ ( -f $file || -h $file ) ]]; then + builtin echo "========== $file ==========" + if [[ -h $file ]]; then + builtin echo "========== ( => ${file:A} ) ==========" + fi + command cat $file + builtin echo "========== end $file ==========" + builtin echo + elif [[ -d $file ]]; then + builtin echo "File '$file' is a directory" + elif [[ ! -e $file ]]; then + builtin echo "File '$file' does not exist" + else + command ls -lad "$file" + fi +} + +function _omz_diag_dump_os_specific_version() { + local osname osver version_file version_files + case "$OSTYPE" in + darwin*) + osname=$(command sw_vers -productName) + osver=$(command sw_vers -productVersion) + builtin echo "OS Version: $osname $osver build $(sw_vers -buildVersion)" + ;; + cygwin) + command systeminfo | command head -4 | command tail -2 + ;; + esac + + if builtin which lsb_release >/dev/null; then + builtin echo "OS Release: $(command lsb_release -s -d)" + fi + + version_files=( /etc/*-release(N) /etc/*-version(N) /etc/*_version(N) ) + for version_file in $version_files; do + builtin echo "$version_file:" + command cat "$version_file" + builtin echo + done +} + diff --git a/oh-my-zsh/lib/directories.zsh b/oh-my-zsh/lib/directories.zsh @@ -0,0 +1,34 @@ +# Changing/making/removing directory +setopt auto_pushd +setopt pushd_ignore_dups +setopt pushdminus + +alias -g ...='../..' +alias -g ....='../../..' +alias -g .....='../../../..' +alias -g ......='../../../../..' + +alias -- -='cd -' +alias 1='cd -' +alias 2='cd -2' +alias 3='cd -3' +alias 4='cd -4' +alias 5='cd -5' +alias 6='cd -6' +alias 7='cd -7' +alias 8='cd -8' +alias 9='cd -9' + +alias md='mkdir -p' +alias rd=rmdir +alias d='dirs -v | head -10' + +# List directory contents +alias lsa='ls -lah' +alias l='ls -lah' +alias ll='ls -lh' +alias la='ls -lAh' + +# Push and pop directories on directory stack +alias pu='pushd' +alias po='popd' diff --git a/oh-my-zsh/lib/functions.zsh b/oh-my-zsh/lib/functions.zsh @@ -0,0 +1,231 @@ +function zsh_stats() { + fc -l 1 | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20 +} + +function uninstall_oh_my_zsh() { + env ZSH=$ZSH sh $ZSH/tools/uninstall.sh +} + +function upgrade_oh_my_zsh() { + env ZSH=$ZSH sh $ZSH/tools/upgrade.sh +} + +function take() { + mkdir -p $1 + cd $1 +} + +function open_command() { + emulate -L zsh + setopt shwordsplit + + local open_cmd + + # define the open command + case "$OSTYPE" in + darwin*) open_cmd='open' ;; + cygwin*) open_cmd='cygstart' ;; + linux*) open_cmd='xdg-open' ;; + msys*) open_cmd='start ""' ;; + *) echo "Platform $OSTYPE not supported" + return 1 + ;; + esac + + # don't use nohup on OSX + if [[ "$OSTYPE" == darwin* ]]; then + $open_cmd "$@" &>/dev/null + else + nohup $open_cmd "$@" &>/dev/null + fi +} + +# +# Get the value of an alias. +# +# Arguments: +# 1. alias - The alias to get its value from +# STDOUT: +# The value of alias $1 (if it has one). +# Return value: +# 0 if the alias was found, +# 1 if it does not exist +# +function alias_value() { + alias "$1" | sed "s/^$1='\(.*\)'$/\1/" + test $(alias "$1") +} + +# +# Try to get the value of an alias, +# otherwise return the input. +# +# Arguments: +# 1. alias - The alias to get its value from +# STDOUT: +# The value of alias $1, or $1 if there is no alias $1. +# Return value: +# Always 0 +# +function try_alias_value() { + alias_value "$1" || echo "$1" +} + +# +# Set variable "$1" to default value "$2" if "$1" is not yet defined. +# +# Arguments: +# 1. name - The variable to set +# 2. val - The default value +# Return value: +# 0 if the variable exists, 3 if it was set +# +function default() { + test `typeset +m "$1"` && return 0 + typeset -g "$1"="$2" && return 3 +} + +# +# Set environment variable "$1" to default value "$2" if "$1" is not yet defined. +# +# Arguments: +# 1. name - The env variable to set +# 2. val - The default value +# Return value: +# 0 if the env variable exists, 3 if it was set +# +function env_default() { + env | grep -q "^$1=" && return 0 + export "$1=$2" && return 3 +} + + +# Required for $langinfo +zmodload zsh/langinfo + +# URL-encode a string +# +# Encodes a string using RFC 2396 URL-encoding (%-escaped). +# See: https://www.ietf.org/rfc/rfc2396.txt +# +# By default, reserved characters and unreserved "mark" characters are +# not escaped by this function. This allows the common usage of passing +# an entire URL in, and encoding just special characters in it, with +# the expectation that reserved and mark characters are used appropriately. +# The -r and -m options turn on escaping of the reserved and mark characters, +# respectively, which allows arbitrary strings to be fully escaped for +# embedding inside URLs, where reserved characters might be misinterpreted. +# +# Prints the encoded string on stdout. +# Returns nonzero if encoding failed. +# +# Usage: +# omz_urlencode [-r] [-m] [-P] <string> +# +# -r causes reserved characters (;/?:@&=+$,) to be escaped +# +# -m causes "mark" characters (_.!~*''()-) to be escaped +# +# -P causes spaces to be encoded as '%20' instead of '+' +function omz_urlencode() { + emulate -L zsh + zparseopts -D -E -a opts r m P + + local in_str=$1 + local url_str="" + local spaces_as_plus + if [[ -z $opts[(r)-P] ]]; then spaces_as_plus=1; fi + local str="$in_str" + + # URLs must use UTF-8 encoding; convert str to UTF-8 if required + local encoding=$langinfo[CODESET] + local safe_encodings + safe_encodings=(UTF-8 utf8 US-ASCII) + if [[ -z ${safe_encodings[(r)$encoding]} ]]; then + str=$(echo -E "$str" | iconv -f $encoding -t UTF-8) + if [[ $? != 0 ]]; then + echo "Error converting string from $encoding to UTF-8" >&2 + return 1 + fi + fi + + # Use LC_CTYPE=C to process text byte-by-byte + local i byte ord LC_ALL=C + export LC_ALL + local reserved=';/?:@&=+$,' + local mark='_.!~*''()-' + local dont_escape="[A-Za-z0-9" + if [[ -z $opts[(r)-r] ]]; then + dont_escape+=$reserved + fi + # $mark must be last because of the "-" + if [[ -z $opts[(r)-m] ]]; then + dont_escape+=$mark + fi + dont_escape+="]" + + # Implemented to use a single printf call and avoid subshells in the loop, + # for performance (primarily on Windows). + local url_str="" + for (( i = 1; i <= ${#str}; ++i )); do + byte="$str[i]" + if [[ "$byte" =~ "$dont_escape" ]]; then + url_str+="$byte" + else + if [[ "$byte" == " " && -n $spaces_as_plus ]]; then + url_str+="+" + else + ord=$(( [##16] #byte )) + url_str+="%$ord" + fi + fi + done + echo -E "$url_str" +} + +# URL-decode a string +# +# Decodes a RFC 2396 URL-encoded (%-escaped) string. +# This decodes the '+' and '%' escapes in the input string, and leaves +# other characters unchanged. Does not enforce that the input is a +# valid URL-encoded string. This is a convenience to allow callers to +# pass in a full URL or similar strings and decode them for human +# presentation. +# +# Outputs the encoded string on stdout. +# Returns nonzero if encoding failed. +# +# Usage: +# omz_urldecode <urlstring> - prints decoded string followed by a newline +function omz_urldecode { + emulate -L zsh + local encoded_url=$1 + + # Work bytewise, since URLs escape UTF-8 octets + local caller_encoding=$langinfo[CODESET] + local LC_ALL=C + export LC_ALL + + # Change + back to ' ' + local tmp=${encoded_url:gs/+/ /} + # Protect other escapes to pass through the printf unchanged + tmp=${tmp:gs/\\/\\\\/} + # Handle %-escapes by turning them into `\xXX` printf escapes + tmp=${tmp:gs/%/\\x/} + local decoded + eval "decoded=\$'$tmp'" + + # Now we have a UTF-8 encoded string in the variable. We need to re-encode + # it if caller is in a non-UTF-8 locale. + local safe_encodings + safe_encodings=(UTF-8 utf8 US-ASCII) + if [[ -z ${safe_encodings[(r)$caller_encoding]} ]]; then + decoded=$(echo -E "$decoded" | iconv -f UTF-8 -t $caller_encoding) + if [[ $? != 0 ]]; then + echo "Error converting string from UTF-8 to $caller_encoding" >&2 + return 1 + fi + fi + + echo -E "$decoded" +} diff --git a/oh-my-zsh/lib/git.zsh b/oh-my-zsh/lib/git.zsh @@ -0,0 +1,221 @@ +# Outputs current branch info in prompt format +function git_prompt_info() { + local ref + if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then + ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ + ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" + fi +} + +# Checks if working tree is dirty +function parse_git_dirty() { + local STATUS='' + local -a FLAGS + FLAGS=('--porcelain') + if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then + if [[ $POST_1_7_2_GIT -gt 0 ]]; then + FLAGS+='--ignore-submodules=dirty' + fi + if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then + FLAGS+='--untracked-files=no' + fi + STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1) + fi + if [[ -n $STATUS ]]; then + echo "$ZSH_THEME_GIT_PROMPT_DIRTY" + else + echo "$ZSH_THEME_GIT_PROMPT_CLEAN" + fi +} + +# Gets the difference between the local and remote branches +function git_remote_status() { + local remote ahead behind git_remote_status git_remote_status_detailed + remote=${$(command git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/} + if [[ -n ${remote} ]]; then + ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l) + behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l) + + if [[ $ahead -eq 0 ]] && [[ $behind -eq 0 ]]; then + git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE" + elif [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then + git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE" + git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}" + elif [[ $behind -gt 0 ]] && [[ $ahead -eq 0 ]]; then + git_remote_status="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE" + git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}" + elif [[ $ahead -gt 0 ]] && [[ $behind -gt 0 ]]; then + git_remote_status="$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE" + git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}" + fi + + if [[ -n $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then + git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX" + fi + + echo $git_remote_status + fi +} + +# Outputs the name of the current branch +# Usage example: git pull origin $(git_current_branch) +# Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if +# it's not a symbolic ref, but in a Git repo. +function git_current_branch() { + local ref + ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null) + local ret=$? + if [[ $ret != 0 ]]; then + [[ $ret == 128 ]] && return # no git repo. + ref=$(command git rev-parse --short HEAD 2> /dev/null) || return + fi + echo ${ref#refs/heads/} +} + + +# Gets the number of commits ahead from remote +function git_commits_ahead() { + if command git rev-parse --git-dir &>/dev/null; then + local commits="$(git rev-list --count @{upstream}..HEAD)" + if [[ "$commits" != 0 ]]; then + echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX" + fi + fi +} + +# Gets the number of commits behind remote +function git_commits_behind() { + if command git rev-parse --git-dir &>/dev/null; then + local commits="$(git rev-list --count HEAD..@{upstream})" + if [[ "$commits" != 0 ]]; then + echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX" + fi + fi +} + +# Outputs if current branch is ahead of remote +function git_prompt_ahead() { + if [[ -n "$(command git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then + echo "$ZSH_THEME_GIT_PROMPT_AHEAD" + fi +} + +# Outputs if current branch is behind remote +function git_prompt_behind() { + if [[ -n "$(command git rev-list HEAD..origin/$(git_current_branch) 2> /dev/null)" ]]; then + echo "$ZSH_THEME_GIT_PROMPT_BEHIND" + fi +} + +# Outputs if current branch exists on remote or not +function git_prompt_remote() { + if [[ -n "$(command git show-ref origin/$(git_current_branch) 2> /dev/null)" ]]; then + echo "$ZSH_THEME_GIT_PROMPT_REMOTE_EXISTS" + else + echo "$ZSH_THEME_GIT_PROMPT_REMOTE_MISSING" + fi +} + +# Formats prompt string for current git commit short SHA +function git_prompt_short_sha() { + local SHA + SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" +} + +# Formats prompt string for current git commit long SHA +function git_prompt_long_sha() { + local SHA + SHA=$(command git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" +} + +# Get the status of the working tree +function git_prompt_status() { + local INDEX STATUS + INDEX=$(command git status --porcelain -b 2> /dev/null) + STATUS="" + if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" + fi + if $(echo "$INDEX" | grep '^A ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" + elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" + elif $(echo "$INDEX" | grep '^MM ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" + fi + if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" + elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" + elif $(echo "$INDEX" | grep '^MM ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" + elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" + fi + if $(echo "$INDEX" | grep '^R ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" + fi + if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" + elif $(echo "$INDEX" | grep '^D ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" + elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" + fi + if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then + STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS" + fi + if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" + fi + if $(echo "$INDEX" | grep '^## [^ ]\+ .*ahead' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS" + fi + if $(echo "$INDEX" | grep '^## [^ ]\+ .*behind' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS" + fi + if $(echo "$INDEX" | grep '^## [^ ]\+ .*diverged' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS" + fi + echo $STATUS +} + +# Compares the provided version of git to the version installed and on path +# Outputs -1, 0, or 1 if the installed version is less than, equal to, or +# greater than the input version, respectively. +function git_compare_version() { + local INPUT_GIT_VERSION INSTALLED_GIT_VERSION + INPUT_GIT_VERSION=(${(s/./)1}) + INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null)) + INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]}) + + for i in {1..3}; do + if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then + echo 1 + return 0 + fi + if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then + echo -1 + return 0 + fi + done + echo 0 +} + +# Outputs the name of the current user +# Usage example: $(git_current_user_name) +function git_current_user_name() { + command git config user.name 2>/dev/null +} + +# Outputs the email of the current user +# Usage example: $(git_current_user_email) +function git_current_user_email() { + command git config user.email 2>/dev/null +} + +# This is unlikely to change so make it all statically assigned +POST_1_7_2_GIT=$(git_compare_version "1.7.2") +# Clean up the namespace slightly by removing the checker function +unfunction git_compare_version diff --git a/oh-my-zsh/lib/grep.zsh b/oh-my-zsh/lib/grep.zsh @@ -0,0 +1,28 @@ +# is x grep argument available? +grep-flag-available() { + echo | grep $1 "" >/dev/null 2>&1 +} + +GREP_OPTIONS="" + +# color grep results +if grep-flag-available --color=auto; then + GREP_OPTIONS+=" --color=auto" +fi + +# ignore VCS folders (if the necessary grep flags are available) +VCS_FOLDERS="{.bzr,CVS,.git,.hg,.svn}" + +if grep-flag-available --exclude-dir=.cvs; then + GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS" +elif grep-flag-available --exclude=.cvs; then + GREP_OPTIONS+=" --exclude=$VCS_FOLDERS" +fi + +# export grep settings +alias grep="grep $GREP_OPTIONS" + +# clean up +unset GREP_OPTIONS +unset VCS_FOLDERS +unfunction grep-flag-available diff --git a/oh-my-zsh/lib/history.zsh b/oh-my-zsh/lib/history.zsh @@ -0,0 +1,24 @@ +## Command history configuration +if [ -z "$HISTFILE" ]; then + HISTFILE=$HOME/.zsh_history +fi + +HISTSIZE=10000 +SAVEHIST=10000 + +# Show history +case $HIST_STAMPS in + "mm/dd/yyyy") alias history='fc -fl 1' ;; + "dd.mm.yyyy") alias history='fc -El 1' ;; + "yyyy-mm-dd") alias history='fc -il 1' ;; + *) alias history='fc -l 1' ;; +esac + +setopt append_history +setopt extended_history +setopt hist_expire_dups_first +setopt hist_ignore_dups # ignore duplication command history list +setopt hist_ignore_space +setopt hist_verify +setopt inc_append_history +setopt share_history # share command history data diff --git a/oh-my-zsh/lib/key-bindings.zsh b/oh-my-zsh/lib/key-bindings.zsh @@ -0,0 +1,93 @@ +# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html +# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Builtins +# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Standard-Widgets + +# Make sure that the terminal is in application mode when zle is active, since +# only then values from $terminfo are valid +if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then + function zle-line-init() { + echoti smkx + } + function zle-line-finish() { + echoti rmkx + } + zle -N zle-line-init + zle -N zle-line-finish +fi + +bindkey -e # Use emacs key bindings + +bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark +bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls +bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line. +if [[ "${terminfo[kpp]}" != "" ]]; then + bindkey "${terminfo[kpp]}" up-line-or-history # [PageUp] - Up a line of history +fi +if [[ "${terminfo[knp]}" != "" ]]; then + bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history +fi + +# start typing + [Up-Arrow] - fuzzy find history forward +if [[ "${terminfo[kcuu1]}" != "" ]]; then + autoload -U up-line-or-beginning-search + zle -N up-line-or-beginning-search + bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search +fi +# start typing + [Down-Arrow] - fuzzy find history backward +if [[ "${terminfo[kcud1]}" != "" ]]; then + autoload -U down-line-or-beginning-search + zle -N down-line-or-beginning-search + bindkey "${terminfo[kcud1]}" down-line-or-beginning-search +fi + +if [[ "${terminfo[khome]}" != "" ]]; then + bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line +fi +if [[ "${terminfo[kend]}" != "" ]]; then + bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line +fi + +bindkey ' ' magic-space # [Space] - do history expansion + +bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word +bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word + +if [[ "${terminfo[kcbt]}" != "" ]]; then + bindkey "${terminfo[kcbt]}" reverse-menu-complete # [Shift-Tab] - move through the completion menu backwards +fi + +bindkey '^?' backward-delete-char # [Backspace] - delete backward +if [[ "${terminfo[kdch1]}" != "" ]]; then + bindkey "${terminfo[kdch1]}" delete-char # [Delete] - delete forward +else + bindkey "^[[3~" delete-char + bindkey "^[3;5~" delete-char + bindkey "\e[3~" delete-char +fi + +# Edit the current command line in $EDITOR +autoload -U edit-command-line +zle -N edit-command-line +bindkey '\C-x\C-e' edit-command-line + +# file rename magick +bindkey "^[m" copy-prev-shell-word + +# consider emacs keybindings: + +#bindkey -e ## emacs key bindings +# +#bindkey '^[[A' up-line-or-search +#bindkey '^[[B' down-line-or-search +#bindkey '^[^[[C' emacs-forward-word +#bindkey '^[^[[D' emacs-backward-word +# +#bindkey -s '^X^Z' '%-^M' +#bindkey '^[e' expand-cmd-path +#bindkey '^[^I' reverse-menu-complete +#bindkey '^X^N' accept-and-infer-next-history +#bindkey '^W' kill-region +#bindkey '^I' complete-word +## Fix weird sequence that rxvt produces +#bindkey -s '^[[Z' '\t' +# diff --git a/oh-my-zsh/lib/misc.zsh b/oh-my-zsh/lib/misc.zsh @@ -0,0 +1,42 @@ +## Load smart urls if available +# bracketed-paste-magic is known buggy in zsh 5.1.1 (only), so skip it there; see #4434 +autoload -Uz is-at-least +if [[ $ZSH_VERSION != 5.1.1 ]]; then + for d in $fpath; do + if [[ -e "$d/url-quote-magic" ]]; then + if is-at-least 5.1; then + autoload -Uz bracketed-paste-magic + zle -N bracketed-paste bracketed-paste-magic + fi + autoload -Uz url-quote-magic + zle -N self-insert url-quote-magic + break + fi + done +fi + +## jobs +setopt long_list_jobs + +## pager +env_default PAGER 'less' +env_default LESS '-R' + +## super user alias +alias _='sudo' +alias please='sudo' + +## more intelligent acking for ubuntu users +if which ack-grep &> /dev/null; then + alias afind='ack-grep -il' +else + alias afind='ack -il' +fi + +# only define LC_CTYPE if undefined +if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then + export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG +fi + +# recognize comments +setopt interactivecomments diff --git a/oh-my-zsh/lib/nvm.zsh b/oh-my-zsh/lib/nvm.zsh @@ -0,0 +1,9 @@ +# get the node.js version +function nvm_prompt_info() { + [[ -f "$NVM_DIR/nvm.sh" ]] || return + local nvm_prompt + nvm_prompt=$(node -v 2>/dev/null) + [[ "${nvm_prompt}x" == "x" ]] && return + nvm_prompt=${nvm_prompt:1} + echo "${ZSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt}${ZSH_THEME_NVM_PROMPT_SUFFIX}" +} diff --git a/oh-my-zsh/lib/prompt_info_functions.zsh b/oh-my-zsh/lib/prompt_info_functions.zsh @@ -0,0 +1,33 @@ +# *_prompt_info functions for usage in your prompt +# +# Plugin creators, please add your *_prompt_info function to the list +# of dummy implementations to help theme creators not receiving errors +# without the need of implementing conditional clauses. +# +# See also lib/bzr.zsh, lib/git.zsh and lib/nvm.zsh for +# git_prompt_info, bzr_prompt_info and nvm_prompt_info + +# Dummy implementations that return false to prevent command_not_found +# errors with themes, that implement these functions +# Real implementations will be used when the respective plugins are loaded +function chruby_prompt_info hg_prompt_info pyenv_prompt_info \ + rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \ + virtualenv_prompt_info { + return 1 +} + +# oh-my-zsh supports an rvm prompt by default +# get the name of the rvm ruby version +function rvm_prompt_info() { + [ -f $HOME/.rvm/bin/rvm-prompt ] || return 1 + local rvm_prompt + rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${=ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null) + [[ "${rvm_prompt}x" == "x" ]] && return 1 + echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}" +} + +# use this to enable users to see their ruby version, no matter which +# version management system they use +function ruby_prompt_info() { + echo $(rvm_prompt_info || rbenv_prompt_info || chruby_prompt_info) +} diff --git a/oh-my-zsh/lib/spectrum.zsh b/oh-my-zsh/lib/spectrum.zsh @@ -0,0 +1,37 @@ +#! /bin/zsh +# A script to make using 256 colors in zsh less painful. +# P.C. Shyamshankar <sykora@lucentbeing.com> +# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ + +typeset -AHg FX FG BG + +FX=( + reset "%{[00m%}" + bold "%{[01m%}" no-bold "%{[22m%}" + italic "%{[03m%}" no-italic "%{[23m%}" + underline "%{[04m%}" no-underline "%{[24m%}" + blink "%{[05m%}" no-blink "%{[25m%}" + reverse "%{[07m%}" no-reverse "%{[27m%}" +) + +for color in {000..255}; do + FG[$color]="%{[38;5;${color}m%}" + BG[$color]="%{[48;5;${color}m%}" +done + + +ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris} + +# Show all 256 colors with color number +function spectrum_ls() { + for code in {000..255}; do + print -P -- "$code: %{$FG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}" + done +} + +# Show all 256 colors where the background is set to specific color +function spectrum_bls() { + for code in {000..255}; do + print -P -- "$code: %{$BG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}" + done +} diff --git a/oh-my-zsh/lib/termsupport.zsh b/oh-my-zsh/lib/termsupport.zsh @@ -0,0 +1,105 @@ +# Set terminal window and tab/icon title +# +# usage: title short_tab_title [long_window_title] +# +# See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 +# Fully supports screen, iterm, and probably most modern xterm and rxvt +# (In screen, only short_tab_title is used) +# Limited support for Apple Terminal (Terminal can't set window and tab separately) +function title { + emulate -L zsh + setopt prompt_subst + + [[ "$EMACS" == *term* ]] && return + + # if $2 is unset use $1 as default + # if it is set and empty, leave it as is + : ${2=$1} + + case "$TERM" in + cygwin|xterm*|putty*|rxvt*|ansi) + print -Pn "\e]2;$2:q\a" # set window name + print -Pn "\e]1;$1:q\a" # set tab name + ;; + screen*) + print -Pn "\ek$1:q\e\\" # set screen hardstatus + ;; + *) + if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + print -Pn "\e]2;$2:q\a" # set window name + print -Pn "\e]1;$1:q\a" # set tab name + else + # Try to use terminfo to set the title + # If the feature is available set title + if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then + echoti tsl + print -Pn "$1" + echoti fsl + fi + fi + ;; + esac +} + +ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD +ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" +# Avoid duplication of directory in terminals with independent dir display +if [[ "$TERM_PROGRAM" == Apple_Terminal ]]; then + ZSH_THEME_TERM_TITLE_IDLE="%n@%m" +fi + +# Runs before showing the prompt +function omz_termsupport_precmd { + emulate -L zsh + + if [[ "$DISABLE_AUTO_TITLE" == true ]]; then + return + fi + + title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE +} + +# Runs before executing the command +function omz_termsupport_preexec { + emulate -L zsh + setopt extended_glob + + if [[ "$DISABLE_AUTO_TITLE" == true ]]; then + return + fi + + # cmd name only, or if this is sudo or ssh, the next cmd + local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%} + local LINE="${2:gs/%/%%}" + + title '$CMD' '%100>...>$LINE%<<' +} + +precmd_functions+=(omz_termsupport_precmd) +preexec_functions+=(omz_termsupport_preexec) + + +# Keep Apple Terminal.app's current working directory updated +# Based on this answer: http://superuser.com/a/315029 +# With extra fixes to handle multibyte chars and non-UTF-8 locales + +if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then + # Emits the control sequence to notify Terminal.app of the cwd + # Identifies the directory using a file: URI scheme, including + # the host name to disambiguate local vs. remote paths. + function update_terminalapp_cwd() { + emulate -L zsh + + # Percent-encode the pathname. + local URL_PATH="$(omz_urlencode -P $PWD)" + [[ $? != 0 ]] && return 1 + + # Undocumented Terminal.app-specific control sequence + printf '\e]7;%s\a' "file://$HOST$URL_PATH" + } + + # Use a precmd hook instead of a chpwd hook to avoid contaminating output + precmd_functions+=(update_terminalapp_cwd) + # Run once to get initial cwd set + update_terminalapp_cwd +fi diff --git a/oh-my-zsh/lib/theme-and-appearance.zsh b/oh-my-zsh/lib/theme-and-appearance.zsh @@ -0,0 +1,55 @@ +# ls colors +autoload -U colors && colors + +# Enable ls colors +export LSCOLORS="Gxfxcxdxbxegedabagacad" + +# TODO organise this chaotic logic + +if [[ "$DISABLE_LS_COLORS" != "true" ]]; then + # Find the option for using colors in ls, depending on the version + if [[ "$OSTYPE" == netbsd* ]]; then + # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); + # otherwise, leave ls as is, because NetBSD's ls doesn't support -G + gls --color -d . &>/dev/null && alias ls='gls --color=tty' + elif [[ "$OSTYPE" == openbsd* ]]; then + # On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base, + # with color and multibyte support) are available from ports. "colorls" + # will be installed on purpose and can't be pulled in by installing + # coreutils, so prefer it to "gls". + gls --color -d . &>/dev/null && alias ls='gls --color=tty' + colorls -G -d . &>/dev/null && alias ls='colorls -G' + elif [[ "$OSTYPE" == darwin* ]]; then + # this is a good alias, it works by default just using $LSCOLORS + ls -G . &>/dev/null && alias ls='ls -G' + + # only use coreutils ls if there is a dircolors customization present ($LS_COLORS or .dircolors file) + # otherwise, gls will use the default color scheme which is ugly af + [[ -n "$LS_COLORS" || -f "$HOME/.dircolors" ]] && gls --color -d . &>/dev/null && alias ls='gls --color=tty' + else + # For GNU ls, we use the default ls color theme. They can later be overwritten by themes. + if [[ -z "$LS_COLORS" ]]; then + (( $+commands[dircolors] )) && eval "$(dircolors -b)" + fi + + ls --color -d . &>/dev/null && alias ls='ls --color=tty' || { ls -G . &>/dev/null && alias ls='ls -G' } + + # Take advantage of $LS_COLORS for completion as well. + zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" + fi +fi + +setopt auto_cd +setopt multios +setopt prompt_subst + +[[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO="" + +# Apply theming defaults +PS1="%n@%m:%~%# " + +# git theming default: Variables for theming the git info prompt +ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name +ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt +ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty +ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean diff --git a/oh-my-zsh/log/.gitkeep b/oh-my-zsh/log/.gitkeep diff --git a/oh-my-zsh/oh-my-zsh.sh b/oh-my-zsh/oh-my-zsh.sh @@ -0,0 +1,117 @@ +# Check for updates on initial load... +if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then + env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh +fi + +# Initializes Oh My Zsh + +# add a function path +fpath=($ZSH/functions $ZSH/completions $fpath) + +# Load all stock functions (from $fpath files) called below. +autoload -U compaudit compinit + +: ${ZSH_DISABLE_COMPFIX:=true} + +# Set ZSH_CUSTOM to the path where your custom config files +# and plugins exists, or else we will use the default custom/ +if [[ -z "$ZSH_CUSTOM" ]]; then + ZSH_CUSTOM="$ZSH/custom" +fi + +# Set ZSH_CACHE_DIR to the path where cache files should be created +# or else we will use the default cache/ +if [[ -z "$ZSH_CACHE_DIR" ]]; then + ZSH_CACHE_DIR="$ZSH/cache" +fi + + +# Load all of the config files in ~/oh-my-zsh that end in .zsh +# TIP: Add files you don't want in git to .gitignore +for config_file ($ZSH/lib/*.zsh); do + custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}" + [ -f "${custom_config_file}" ] && config_file=${custom_config_file} + source $config_file +done + + +is_plugin() { + local base_dir=$1 + local name=$2 + test -f $base_dir/plugins/$name/$name.plugin.zsh \ + || test -f $base_dir/plugins/$name/_$name +} +# Add all defined plugins to fpath. This must be done +# before running compinit. +for plugin ($plugins); do + if is_plugin $ZSH_CUSTOM $plugin; then + fpath=($ZSH_CUSTOM/plugins/$plugin $fpath) + elif is_plugin $ZSH $plugin; then + fpath=($ZSH/plugins/$plugin $fpath) + fi +done + +# Figure out the SHORT hostname +if [[ "$OSTYPE" = darwin* ]]; then + # macOS's $HOST changes with dhcp, etc. Use ComputerName if possible. + SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/} +else + SHORT_HOST=${HOST/.*/} +fi + +# Save the location of the current completion dump file. +if [ -z "$ZSH_COMPDUMP" ]; then + ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" +fi + +if [[ $ZSH_DISABLE_COMPFIX != true ]]; then + # If completion insecurities exist, warn the user without enabling completions. + if ! compaudit &>/dev/null; then + # This function resides in the "lib/compfix.zsh" script sourced above. + handle_completion_insecurities + # Else, enable and cache completions to the desired file. + else + compinit -d "${ZSH_COMPDUMP}" + fi +else + compinit -i -d "${ZSH_COMPDUMP}" +fi + +# Load all of the plugins that were defined in ~/.zshrc +for plugin ($plugins); do + if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then + source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh + elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then + source $ZSH/plugins/$plugin/$plugin.plugin.zsh + fi +done + +# Load all of your custom configurations from custom/ +for config_file ($ZSH_CUSTOM/*.zsh(N)); do + source $config_file +done +unset config_file + +# Load the theme +if [[ "$ZSH_THEME" == "random" ]]; then + if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = "array" ]] && [[ "${#ZSH_THEME_RANDOM_CANDIDATES[@]}" -gt 0 ]]; then + themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDIDATES}.zsh-theme) + else + themes=($ZSH/themes/*zsh-theme) + fi + N=${#themes[@]} + ((N=(RANDOM%N)+1)) + RANDOM_THEME=${themes[$N]} + source "$RANDOM_THEME" + echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." +else + if [ ! "$ZSH_THEME" = "" ]; then + if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then + source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" + elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then + source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" + else + source "$ZSH/themes/$ZSH_THEME.zsh-theme" + fi + fi +fi diff --git a/oh-my-zsh/plugins/adb/README.md b/oh-my-zsh/plugins/adb/README.md @@ -0,0 +1,8 @@ +# adb autocomplete plugin + +* Adds autocomplete options for all adb commands. +* Add autocomplete for `adb -s` + +## Requirements + +In order to make this work, you will need to have the Android adb tools set up in your path. diff --git a/oh-my-zsh/plugins/adb/_adb b/oh-my-zsh/plugins/adb/_adb @@ -0,0 +1,62 @@ +#compdef adb +#autoload + +# in order to make this work, you will need to have the android adb tools + +# adb zsh completion, based on homebrew completion + +local -a _1st_arguments +_1st_arguments=( +'bugreport:return all information from the device that should be included in a bug report.' +'connect:connect to a device via TCP/IP Port 5555 is default.' +'devices:list all connected devices' +'disconnect:disconnect from a TCP/IP device. Port 5555 is default.' +'emu:run emulator console command' +'forward:forward socket connections' +'get-devpath:print the device path' +'get-serialno:print the serial number of the device' +'get-state:print the current state of the device: offline | bootloader | device' +'help:show the help message' +'install:push this package file to the device and install it' +'jdwp:list PIDs of processes hosting a JDWP transport' +'keygen:generate adb public/private key' +'kill-server:kill the server if it is running' +'logcat:view device log' +'pull:copy file/dir from device' +'push:copy file/dir to device' +'reboot:reboots the device, optionally into the bootloader or recovery program' +'reboot-bootloader:reboots the device into the bootloader' +'remount:remounts the partitions on the device read-write' +'root:restarts the adbd daemon with root permissions' +'sideload:push a ZIP to device and install it' +'shell:run remote shell interactively' +'sync:copy host->device only if changed (-l means list but dont copy)' +'start-server:ensure that there is a server running' +'tcpip:restart host adb in tcpip mode' +'uninstall:remove this app package from the device' +'usb:restart the adbd daemon listing on USB' +'version:show version num' +'wait-for-device:block until device is online' +) + +local expl +local -a pkgs installed_pkgs + +_arguments \ + '-s[devices]:specify device:->specify_device' \ + '*:: :->subcmds' && return 0 + +case "$state" in + specify_device) + _values 'devices' $(adb devices -l|awk 'NR>1&& $1 ~ /^[a-zA-Z0-9].*$/ \ + {printf "%s[%s] ",$1,$6 }') + return + ;; +esac + +if (( CURRENT == 1 )); then + _describe -t commands "adb subcommand" _1st_arguments + return +fi + +_files+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/ant/ant.plugin.zsh b/oh-my-zsh/plugins/ant/ant.plugin.zsh @@ -0,0 +1,16 @@ +_ant_does_target_list_need_generating () { + [ ! -f .ant_targets ] && return 0; + [ build.xml -nt .ant_targets ] && return 0; + return 1; +} + +_ant () { + if [ -f build.xml ]; then + if _ant_does_target_list_need_generating; then + ant -p | awk -F " " 'NR > 5 { print lastTarget }{lastTarget = $1}' > .ant_targets + fi + compadd -- `cat .ant_targets` + fi +} + +compdef _ant ant diff --git a/oh-my-zsh/plugins/apache2-macports/README.md b/oh-my-zsh/plugins/apache2-macports/README.md @@ -0,0 +1,19 @@ +## APACHE2 MACPORTS PLUGIN + + +--- + +### FEATURES + +| Alias | Function | Description | +|:--------------:|:-------------------------------------------------------------------------------|----------------------:| +| apache2restart | sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart | Restart apache daemon | +| apache2start | sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start | Start apache daemon | +| apache2stop | sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop | Stop apache daemon | + +--- + +### CONTRIBUTORS + - Alexander Rinass (alex@rinass.net) + +--- diff --git a/oh-my-zsh/plugins/apache2-macports/apache2-macports.plugin.zsh b/oh-my-zsh/plugins/apache2-macports/apache2-macports.plugin.zsh @@ -0,0 +1,6 @@ +# commands to control local apache2 server installation +# paths are for osx installation via macports + +alias apache2start='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start' +alias apache2stop='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop' +alias apache2restart='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart' diff --git a/oh-my-zsh/plugins/arcanist/README.md b/oh-my-zsh/plugins/arcanist/README.md @@ -0,0 +1,5 @@ +## arcanist + +**Maintainer:** [@emzar](https://github.com/emzar) + +This plugin adds many useful aliases. diff --git a/oh-my-zsh/plugins/arcanist/arcanist.plugin.zsh b/oh-my-zsh/plugins/arcanist/arcanist.plugin.zsh @@ -0,0 +1,21 @@ +# +# Aliases +# (sorted alphabetically) +# + +alias ara='arc amend' +alias arb='arc branch' +alias arco='arc cover' +alias arci='arc commit' + +alias ard='arc diff' +alias ardnu='arc diff --nounit' +alias ardnupc='arc diff --nounit --plan-changes' +alias ardpc='arc diff --plan-changes' + +alias are='arc export' +alias arh='arc help' +alias arl='arc land' +alias arli='arc lint' +alias arls='arc list' +alias arpa='arc patch' diff --git a/oh-my-zsh/plugins/archlinux/README.md b/oh-my-zsh/plugins/archlinux/README.md @@ -0,0 +1,97 @@ +# Archlinux plugin + +## Features + +#### YAOURT + +| Alias | Command | Description | +|---------|------------------------------------|---------------------------------------------------------------------| +| yaconf | yaourt -C | Fix all configuration files with vimdiff | +| yain | yaourt -S | Install packages from the repositories | +| yains | yaourt -U | Install a package from a local file | +| yainsd | yaourt -S --asdeps | Install packages as dependencies of another package | +| yaloc | yaourt -Qi | Display information about a package in the local database | +| yalocs | yaourt -Qs | Search for packages in the local database | +| yalst | yaourt -Qe | List installed packages including from AUR (tagged as "local") | +| yamir | yaourt -Syy | Force refresh of all package lists after updating mirrorlist | +| yaorph | yaourt -Qtd | Remove orphans using yaourt | +| yare | yaourt -R | Remove packages, keeping its settings and dependencies | +| yarem | yaourt -Rns | Remove packages, including its settings and unneeded dependencies | +| yarep | yaourt -Si | Display information about a package in the repositories | +| yareps | yaourt -Ss | Search for packages in the repositories | +| yaupd | yaourt -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases | +| yaupd | yaourt -Sy && sudo abs | Update and refresh the local package and ABS databases | +| yaupd | yaourt -Sy && sudo aur | Update and refresh the local package and AUR databases | +| yaupd | yaourt -Sy | Update and refresh the local package database | +| yaupg | yaourt -Syua | Sync with repositories before upgrading all packages (from AUR too) | +| yasu | yaourt -Syua --no-confirm | Same as `yaupg`, but without confirmation | +| upgrade | yaourt -Syu | Sync with repositories before upgrading packages | + +### PACAUR + +| Alias | Command | Description | +|---------|------------------------------------|---------------------------------------------------------------------| +| pain | pacaur -S | Install packages from the repositories | +| pains | pacaur -U | Install a package from a local file | +| painsd | pacaur -S --asdeps | Install packages as dependencies of another package | +| paloc | pacaur -Qi | Display information about a package in the local database | +| palocs | pacaur -Qs | Search for packages in the local database | +| palst | pacaur -Qe | List installed packages including from AUR (tagged as "local") | +| pamir | pacaur -Syy | Force refresh of all package lists after updating mirrorlist | +| paorph | pacaur -Qtd | Remove orphans using pacaur | +| pare | pacaur -R | Remove packages, keeping its settings and dependencies | +| parem | pacaur -Rns | Remove packages, including its settings and unneeded dependencies | +| parep | pacaur -Si | Display information about a package in the repositories | +| pareps | pacaur -Ss | Search for packages in the repositories | +| paupd | pacaur -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases | +| paupd | pacaur -Sy && sudo abs | Update and refresh the local package and ABS databases | +| paupd | pacaur -Sy && sudo aur | Update and refresh the local package and AUR databases | +| paupd | pacaur -Sy | Update and refresh the local package database | +| paupg | pacaur -Syua | Sync with repositories before upgrading all packages (from AUR too) | +| pasu | pacaur -Syua --no-confirm | Same as `paupg`, but without confirmation | +| upgrade | pacaur -Syu | Sync with repositories before upgrading packages | + +#### PACMAN + +| Alias | Command | Description | +|--------------|-----------------------------------------|--------------------------------------------------------------| +| pacin | sudo pacman -S | Install packages from the repositories | +| pacins | sudo pacman -U | Install a package from a local file | +| pacinsd | sudo pacman -S --asdeps | Install packages as dependencies of another package | +| pacloc | pacman -Qi | Display information about a package in the local database | +| paclocs | pacman -Qs | Search for packages in the local database | +| paclsorphans | sudo pacman -Qdt | List all orphaned packages | +| pacmir | sudo pacman -Syy | Force refresh of all package lists after updating mirrorlist | +| pacre | sudo pacman -R | Remove packages, keeping its settings and dependencies | +| pacrem | sudo pacman -Rns | Remove packages, including its settings and dependencies | +| pacrep | pacman -Si | Display information about a package in the repositories | +| pacreps | pacman -Ss | Search for packages in the repositories | +| pacrmorphans | sudo pacman -Rs $(pacman -Qtdq) | Delete all orphaned packages | +| pacupd | sudo pacman -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases | +| pacupd | sudo pacman -Sy && sudo abs | Update and refresh the local package and ABS databases | +| pacupd | sudo pacman -Sy && sudo aur | Update and refresh the local package and AUR databases | +| pacupd | sudo pacman -Sy | Update and refresh the local package database | +| pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages | +| upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages | +| pacfileupg | sudo pacman -Fy | Download fresh package databases from the server | +| pacfiles | pacman -Fs | Search package file names for matching strings. | + +| Function | Description | +|----------------|------------------------------------------------------| +| pacdisowned | List all disowned files in your system | +| paclist | List all installed packages with a short description | +| pacmanallkeys | Get all keys for developers and trusted users | +| pacmansignkeys | Locally trust all keys passed as parameters | + +--- + +## Contributors + +- Benjamin Boudreau - dreurmail@gmail.com +- Celso Miranda - contacto@celsomiranda.net +- KhasMek - Boushh@gmail.com +- Martin Putniorz - mputniorz@gmail.com +- MatthR3D - matthr3d@gmail.com +- ornicar - thibault.duplessis@gmail.com +- Juraj Fiala - doctorjellyface@riseup.net +- Majora320 (Moses Miller) - Majora320@gmail.com diff --git a/oh-my-zsh/plugins/archlinux/archlinux.plugin.zsh b/oh-my-zsh/plugins/archlinux/archlinux.plugin.zsh @@ -0,0 +1,138 @@ +if (( $+commands[yaourt] )); then + alias yaconf='yaourt -C' + alias yaupg='yaourt -Syua' + alias yasu='yaourt -Syua --noconfirm' + alias yain='yaourt -S' + alias yains='yaourt -U' + alias yare='yaourt -R' + alias yarem='yaourt -Rns' + alias yarep='yaourt -Si' + alias yareps='yaourt -Ss' + alias yaloc='yaourt -Qi' + alias yalocs='yaourt -Qs' + alias yalst='yaourt -Qe' + alias yaorph='yaourt -Qtd' + alias yainsd='yaourt -S --asdeps' + alias yamir='yaourt -Syy' + + + if (( $+commands[abs] && $+commands[aur] )); then + alias yaupd='yaourt -Sy && sudo abs && sudo aur' + elif (( $+commands[abs] )); then + alias yaupd='yaourt -Sy && sudo abs' + elif (( $+commands[aur] )); then + alias yaupd='yaourt -Sy && sudo aur' + else + alias yaupd='yaourt -Sy' + fi +fi + +if (( $+commands[pacaur] )); then + alias paupg='pacaur -Syu' + alias pasu='pacaur -Syu --noconfirm' + alias pain='pacaur -S' + alias pains='pacaur -U' + alias pare='pacaur -R' + alias parem='pacaur -Rns' + alias parep='pacaur -Si' + alias pareps='pacaur -Ss' + alias paloc='pacaur -Qi' + alias palocs='pacaur -Qs' + alias palst='pacaur -Qe' + alias paorph='pacaur -Qtd' + alias painsd='pacaur -S --asdeps' + alias pamir='pacaur -Syy' + + if (( $+commands[abs] && $+commands[aur] )); then + alias paupd='pacaur -Sy && sudo abs && sudo aur' + elif (( $+commands[abs] )); then + alias paupd='pacaur -Sy && sudo abs' + elif (( $+commands[aur] )); then + alias paupd='pacaur -Sy && sudo aur' + else + alias paupd='pacaur -Sy' + fi +fi + +if (( $+commands[pacaur] )); then + upgrade() { + pacaur -Syu + } +elif (( $+commands[yaourt] )); then + upgrade() { + yaourt -Syu + } +else + upgrade() { + sudo pacman -Syu + } +fi + +# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips +alias pacupg='sudo pacman -Syu' +alias pacin='sudo pacman -S' +alias pacins='sudo pacman -U' +alias pacre='sudo pacman -R' +alias pacrem='sudo pacman -Rns' +alias pacrep='pacman -Si' +alias pacreps='pacman -Ss' +alias pacloc='pacman -Qi' +alias paclocs='pacman -Qs' +alias pacinsd='sudo pacman -S --asdeps' +alias pacmir='sudo pacman -Syy' +alias paclsorphans='sudo pacman -Qdt' +alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' +alias pacfileupg='sudo pacman -Fy' +alias pacfiles='pacman tFs' + + +if (( $+commands[abs] && $+commands[aur] )); then + alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' +elif (( $+commands[abs] )); then + alias pacupd='sudo pacman -Sy && sudo abs' +elif (( $+commands[aur] )); then + alias pacupd='sudo pacman -Sy && sudo aur' +else + alias pacupd='sudo pacman -Sy' +fi + +paclist() { + # Source: https://bbs.archlinux.org/viewtopic.php?id=93683 + LC_ALL=C pacman -Qei $(pacman -Qu | cut -d " " -f 1) | \ + awk 'BEGIN {FS=":"} /^Name/{printf("\033[1;36m%s\033[1;37m", $2)} /^Description/{print $2}' +} + +pacdisowned() { + emulate -L zsh + + tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$ + db=$tmp/db + fs=$tmp/fs + + mkdir "$tmp" + trap 'rm -rf "$tmp"' EXIT + + pacman -Qlq | sort -u > "$db" + + find /bin /etc /lib /sbin /usr ! -name lost+found \ + \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" + + comm -23 "$fs" "$db" +} + +pacmanallkeys() { + emulate -L zsh + curl -s https://www.archlinux.org/people/{developers,trustedusers}/ | \ + awk -F\" '(/pgp.mit.edu/) { sub(/.*search=0x/,""); print $1}' | \ + xargs sudo pacman-key --recv-keys +} + +pacmansignkeys() { + emulate -L zsh + for key in $*; do + sudo pacman-key --recv-keys $key + sudo pacman-key --lsign-key $key + printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \ + --no-permission-warning --command-fd 0 --edit-key $key + done +} diff --git a/oh-my-zsh/plugins/asdf/README.md b/oh-my-zsh/plugins/asdf/README.md @@ -0,0 +1,27 @@ +## asdf + +**Maintainer:** [@RobLoach](https://github.com/RobLoach) + +Adds integration with [asdf](https://github.com/asdf-vm/asdf), the extendable version manager, with support for Ruby, Node.js, Elixir, Erlang and more. + +### Installation + +1. Enable the plugin by adding it to your `plugins` definition in `~/.zshrc`. + + ``` + plugins=(asdf) + ``` + +2. [Install asdf](https://github.com/asdf-vm/asdf#setup) by running the following: + ``` + git clone https://github.com/asdf-vm/asdf.git ~/.asdf + ``` + +### Usage + +See the [asdf usage documentation](https://github.com/asdf-vm/asdf#usage) for information on how to use asdf: + +``` +asdf plugin-add nodejs git@github.com:asdf-vm/asdf-nodejs.git +asdf install nodejs 5.9.1 +``` diff --git a/oh-my-zsh/plugins/asdf/asdf.plugin.zsh b/oh-my-zsh/plugins/asdf/asdf.plugin.zsh @@ -0,0 +1,7 @@ +# Find where asdf should be installed. +ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}" + +# Load asdf, if found. +if [ -f $ASDF_DIR/asdf.sh ]; then + . $ASDF_DIR/asdf.sh +fi diff --git a/oh-my-zsh/plugins/autoenv/autoenv.plugin.zsh b/oh-my-zsh/plugins/autoenv/autoenv.plugin.zsh @@ -0,0 +1,43 @@ +# Activates autoenv or reports its failure +() { +if ! type autoenv_init >/dev/null; then + for d (~/.autoenv ~/.local/bin /usr/local/opt/autoenv /usr/local/bin); do + if [[ -e $d/activate.sh ]]; then + autoenv_dir=$d + break + fi + done + if [[ -z $autoenv_dir ]]; then + cat <<END >&2 +-------- AUTOENV --------- +Could not locate autoenv installation. +Please check if autoenv is correctly installed. +In the meantime the autoenv plugin is DISABLED. +-------------------------- +END + return 1 + fi + source $autoenv_dir/activate.sh +fi +} +[[ $? != 0 ]] && return $? + +# The use_env call below is a reusable command to activate/create a new Python +# virtualenv, requiring only a single declarative line of code in your .env files. +# It only performs an action if the requested virtualenv is not the current one. + +use_env() { + typeset venv + venv="$1" + if [[ "${VIRTUAL_ENV:t}" != "$venv" ]]; then + if workon | grep -q "$venv"; then + workon "$venv" + else + echo -n "Create virtualenv $venv now? (Yn) " + read answer + if [[ "$answer" == "Y" ]]; then + mkvirtualenv "$venv" + fi + fi + fi +} diff --git a/oh-my-zsh/plugins/autojump/autojump.plugin.zsh b/oh-my-zsh/plugins/autojump/autojump.plugin.zsh @@ -0,0 +1,23 @@ +if [ $commands[autojump] ]; then # check if autojump is installed + if [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation + . $HOME/.autojump/etc/profile.d/autojump.zsh + elif [ -f $HOME/.autojump/share/autojump/autojump.zsh ]; then # another manual user-local installation + . $HOME/.autojump/share/autojump/autojump.zsh + elif [ -f $HOME/.nix-profile/etc/profile.d/autojump.zsh ]; then # nix installation + . $HOME/.nix-profile/etc/profile.d/autojump.zsh + elif [ -f /run/current-system/sw/share/autojump/autojump.zsh ]; then # nixos installation + . /run/current-system/sw/share/autojump/autojump.zsh + elif [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package + . /usr/share/autojump/autojump.zsh + elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation + . /etc/profile.d/autojump.zsh + elif [ -f /etc/profile.d/autojump.sh ]; then # gentoo installation + . /etc/profile.d/autojump.sh + elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation + . /usr/local/share/autojump/autojump.zsh + elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports + . /opt/local/etc/profile.d/autojump.zsh + elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.sh ]; then # mac os x with brew + . `brew --prefix`/etc/autojump.sh + fi +fi diff --git a/oh-my-zsh/plugins/autopep8/_autopep8 b/oh-my-zsh/plugins/autopep8/_autopep8 @@ -0,0 +1,32 @@ +#compdef autopep8 +# +# this is zsh completion function file. +# generated by genzshcomp(ver: 0.5.1) +# + +typeset -A opt_args +local context state line + +_arguments -s -S \ + "--help[show this help message and exit]:" \ + "-h[show this help message and exit]:" \ + "--version[show program's version number and exit]:" \ + "--verbose[print verbose messages; multiple -v result in more verbose messages]" \ + "-v[print verbose messages; multiple -v result in more verbose messages]" \ + "--diff[print the diff for the fixed source]" \ + "-d[print the diff for the fixed source]" \ + "--in-place[make changes to files in place]" \ + "-i[make changes to files in place]" \ + "--recursive[run recursively; must be used with --in-place or --diff]" \ + "-r[run recursively; must be used with --in-place or --diff]" \ + "--jobs[number of parallel jobs; match CPU count if value is less than 1]::n number of parallel jobs; match CPU count if value is:_files" \ + "-j[number of parallel jobs; match CPU count if value is less than 1]::n number of parallel jobs; match CPU count if value is:_files" \ + "--pep8-passes[maximum number of additional pep8 passes (default: 100)]::n:_files" \ + "-p[maximum number of additional pep8 passes (default: 100)]::n:_files" \ + "-a[-a result in more aggressive changes]::result:_files" \ + "--exclude[exclude files/directories that match these comma- separated globs]::globs:_files" \ + "--list-fixes[list codes for fixes; used by --ignore and --select]" \ + "--ignore[do not fix these errors/warnings (default E226,E24)]::errors:_files" \ + "--select[fix only these errors/warnings (e.g. E4,W)]::errors:_files" \ + "--max-line-length[set maximum allowed line length (default: 79)]::n:_files" \ + "*::args:_files" diff --git a/oh-my-zsh/plugins/autopep8/autopep8.plugin.zsh b/oh-my-zsh/plugins/autopep8/autopep8.plugin.zsh diff --git a/oh-my-zsh/plugins/aws/aws.plugin.zsh b/oh-my-zsh/plugins/aws/aws.plugin.zsh @@ -0,0 +1,52 @@ +_homebrew-installed() { + type brew &> /dev/null + _xit=$? + if [ $_xit -eq 0 ];then + # ok , we have brew installed + # speculatively we check default brew prefix + if [ -h /usr/local/opt/awscli ];then + _brew_prefix="/usr/local/opt/awscli" + else + # ok , it is not default prefix + # this call to brew is expensive ( about 400 ms ), so at least let's make it only once + _brew_prefix=$(brew --prefix awscli) + fi + return 0 + else + return $_xit + fi +} + +_awscli-homebrew-installed() { + [ -r $_brew_prefix/libexec/bin/aws_zsh_completer.sh ] &> /dev/null +} + +export AWS_HOME=~/.aws + +function agp { + echo $AWS_DEFAULT_PROFILE +} + +function asp { + local rprompt=${RPROMPT/<aws:$(agp)>/} + + export AWS_DEFAULT_PROFILE=$1 + export AWS_PROFILE=$1 + + export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>$rprompt" +} + +function aws_profiles { + reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/')) +} + +compctl -K aws_profiles asp + +if _homebrew-installed && _awscli-homebrew-installed ; then + _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh +else + _aws_zsh_completer_path=$(which aws_zsh_completer.sh) +fi + +[ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path +unset _aws_zsh_completer_path diff --git a/oh-my-zsh/plugins/battery/battery.plugin.zsh b/oh-my-zsh/plugins/battery/battery.plugin.zsh @@ -0,0 +1,160 @@ +########################################### +# Battery plugin for oh-my-zsh # +# Original Author: Peter hoeg (peterhoeg) # +# Email: peter@speartail.com # +########################################### +# Author: Sean Jones (neuralsandwich) # +# Email: neuralsandwich@gmail.com # +# Modified to add support for Apple Mac # +########################################### + +if [[ "$OSTYPE" = darwin* ]] ; then + + function battery_pct() { + local smart_battery_status="$(ioreg -rc "AppleSmartBattery")" + typeset -F maxcapacity=$(echo $smart_battery_status | grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //') + typeset -F currentcapacity=$(echo $smart_battery_status | grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //') + integer i=$(((currentcapacity/maxcapacity) * 100)) + echo $i + } + + function plugged_in() { + [ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ Yes') -eq 1 ] + } + + function battery_pct_remaining() { + if plugged_in ; then + echo "External Power" + else + battery_pct + fi + } + + function battery_time_remaining() { + local smart_battery_status="$(ioreg -rc "AppleSmartBattery")" + if [[ $(echo $smart_battery_status | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then + timeremaining=$(echo $smart_battery_status | grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //') + if [ $timeremaining -gt 720 ] ; then + echo "::" + else + echo "~$((timeremaining / 60)):$((timeremaining % 60))" + fi + else + echo "∞" + fi + } + + function battery_pct_prompt () { + if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then + b=$(battery_pct_remaining) + if [ $b -gt 50 ] ; then + color='green' + elif [ $b -gt 20 ] ; then + color='yellow' + else + color='red' + fi + echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}" + else + echo "∞" + fi + } + + function battery_is_charging() { + [[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]] + } + +elif [[ "$OSTYPE" = linux* ]] ; then + + function battery_is_charging() { + ! [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] + } + + function battery_pct() { + if (( $+commands[acpi] )) ; then + echo "$(acpi 2>/dev/null | cut -f2 -d ',' | tr -cd '[:digit:]')" + fi + } + + function battery_pct_remaining() { + if [ ! $(battery_is_charging) ] ; then + battery_pct + else + echo "External Power" + fi + } + + function battery_time_remaining() { + if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then + echo $(acpi 2>/dev/null | cut -f3 -d ',') + fi + } + + function battery_pct_prompt() { + b=$(battery_pct_remaining) + if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then + if [ $b -gt 50 ] ; then + color='green' + elif [ $b -gt 20 ] ; then + color='yellow' + else + color='red' + fi + echo "%{$fg[$color]%}$(battery_pct_remaining)%%%{$reset_color%}" + else + echo "∞" + fi + } + +else + # Empty functions so we don't cause errors in prompts + function battery_pct_remaining() { + } + + function battery_time_remaining() { + } + + function battery_pct_prompt() { + } +fi + +function battery_level_gauge() { + local gauge_slots=${BATTERY_GAUGE_SLOTS:-10}; + local green_threshold=${BATTERY_GREEN_THRESHOLD:-6}; + local yellow_threshold=${BATTERY_YELLOW_THRESHOLD:-4}; + local color_green=${BATTERY_COLOR_GREEN:-%F{green}}; + local color_yellow=${BATTERY_COLOR_YELLOW:-%F{yellow}}; + local color_red=${BATTERY_COLOR_RED:-%F{red}}; + local color_reset=${BATTERY_COLOR_RESET:-%{%f%k%b%}}; + local battery_prefix=${BATTERY_GAUGE_PREFIX:-'['}; + local battery_suffix=${BATTERY_GAUGE_SUFFIX:-']'}; + local filled_symbol=${BATTERY_GAUGE_FILLED_SYMBOL:-'▶'}; + local empty_symbol=${BATTERY_GAUGE_EMPTY_SYMBOL:-'▷'}; + local charging_color=${BATTERY_CHARGING_COLOR:-$color_yellow}; + local charging_symbol=${BATTERY_CHARGING_SYMBOL:-'⚡'}; + + local battery_remaining_percentage=$(battery_pct); + + if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then + local filled=$(((( $battery_remaining_percentage + $gauge_slots - 1) / $gauge_slots))); + local empty=$(($gauge_slots - $filled)); + + if [[ $filled -gt $green_threshold ]]; then local gauge_color=$color_green; + elif [[ $filled -gt $yellow_threshold ]]; then local gauge_color=$color_yellow; + else local gauge_color=$color_red; + fi + else + local filled=$gauge_slots; + local empty=0; + filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'}; + fi + + local charging=' ' && battery_is_charging && charging=$charging_symbol; + + printf ${charging_color//\%/\%\%}$charging${color_reset//\%/\%\%}${battery_prefix//\%/\%\%}${gauge_color//\%/\%\%} + printf ${filled_symbol//\%/\%\%}'%.0s' {1..$filled} + [[ $filled -lt $gauge_slots ]] && printf ${empty_symbol//\%/\%\%}'%.0s' {1..$empty} + printf ${color_reset//\%/\%\%}${battery_suffix//\%/\%\%}${color_reset//\%/\%\%} +} + + diff --git a/oh-my-zsh/plugins/bbedit/README.md b/oh-my-zsh/plugins/bbedit/README.md @@ -0,0 +1,20 @@ +## bbedit + +Plugin for BBEdit, an HTML and text editor for Mac OS X + +### Requirements + + * [BBEdit](http://www.barebones.com/products/bbedit/) + * [BBEdit Command-Line Tools](http://www.barebones.com/support/bbedit/cmd-line-tools.html) + +### Usage + + * If the `bb` command is called without an argument, launch BBEdit + + * If `bb` is passed a directory, cd to it and open it in BBEdit + + * If `bb` is passed a file, open it in BBEdit + + * If `bbpb` create a new BBEdit document with the contents of the clipboard + + * If `bbd` alias for BBEdit diff tool diff --git a/oh-my-zsh/plugins/bbedit/bbedit.plugin.zsh b/oh-my-zsh/plugins/bbedit/bbedit.plugin.zsh @@ -0,0 +1,21 @@ +alias bbpb='pbpaste | bbedit --clean --view-top' + +alias bbd=bbdiff + +# +# If the bb command is called without an argument, launch BBEdit +# If bb is passed a directory, cd to it and open it in BBEdit +# If bb is passed a file, open it in BBEdit +# +function bb() { + if [[ -z "$1" ]] + then + bbedit --launch + else + bbedit "$1" + if [[ -d "$1" ]] + then + cd "$1" + fi + fi +} diff --git a/oh-my-zsh/plugins/bgnotify/README.md b/oh-my-zsh/plugins/bgnotify/README.md @@ -0,0 +1,54 @@ +# bgnotify zsh plugin + +cross-platform background notifications for long running commands! Supports OSX and Ubuntu linux. + +Standalone homepage: [t413/zsh-background-notify](https://github.com/t413/zsh-background-notify) + +---------------------------------- + +## How to use! + +Just add bgnotify to your plugins list in your `.zshrc` + +- On OS X you'll need [terminal-notifier](https://github.com/alloy/terminal-notifier) + * `brew install terminal-notifier` (or `gem install terminal-notifier`) +- On ubuntu you're already all set! +- On windows you can use [notifu](http://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package + + +## Screenshots + +**Linux** + +![screenshot from 2014-11-07 15 58 36](https://cloud.githubusercontent.com/assets/326829/4962187/256b465c-66da-11e4-927d-cc2fc105e31f.png) + +**OS X** + +![screenshot 2014-11-08 14 15 12](https://cloud.githubusercontent.com/assets/326829/4965780/19fa3eac-6795-11e4-8ed6-0355711123a9.png) + +**Windows** + +![screenshot from 2014-11-07 15 55 00](https://cloud.githubusercontent.com/assets/326829/4962159/a2625ca0-66d9-11e4-9e91-c5834913190e.png) + + +## Configuration + +One can configure a few things: + +- `bgnotify_threshold` sets the notification threshold time (default 6 seconds) +- `function bgnotify_formatted` lets you change the notification + +Use these by adding a function definition before the your call to source. Example: + +~~~ sh +bgnotify_threshold=4 ## set your own notification threshold + +function bgnotify_formatted { + ## $1=exit_status, $2=command, $3=elapsed_time + [ $1 -eq 0 ] && title="Holy Smokes Batman!" || title="Holy Graf Zeppelin!" + bgnotify "$title -- after $3 s" "$2"; +} + +plugins=(git bgnotify) ## add to plugins list +source $ZSH/oh-my-zsh.sh ## existing source call +~~~ diff --git a/oh-my-zsh/plugins/bgnotify/bgnotify.plugin.zsh b/oh-my-zsh/plugins/bgnotify/bgnotify.plugin.zsh @@ -0,0 +1,77 @@ +#!/usr/bin/env zsh + +## setup ## + +[[ -o interactive ]] || return #interactive only! +zmodload zsh/datetime || { print "can't load zsh/datetime"; return } # faster than date() +autoload -Uz add-zsh-hook || { print "can't add zsh hook!"; return } + +(( ${+bgnotify_threshold} )) || bgnotify_threshold=5 #default 10 seconds + + +## definitions ## + +if ! (type bgnotify_formatted | grep -q 'function'); then ## allow custom function override + function bgnotify_formatted { ## args: (exit_status, command, elapsed_seconds) + elapsed="$(( $3 % 60 ))s" + (( $3 >= 60 )) && elapsed="$((( $3 % 3600) / 60 ))m $elapsed" + (( $3 >= 3600 )) && elapsed="$(( $3 / 3600 ))h $elapsed" + [ $1 -eq 0 ] && bgnotify "#win (took $elapsed)" "$2" || bgnotify "#fail (took $elapsed)" "$2" + } +fi + +currentWindowId () { + if hash osascript 2>/dev/null; then #osx + osascript -e 'tell application (path to frontmost application as text) to id of front window' 2&> /dev/null || echo "0" + elif (hash notify-send 2>/dev/null || hash kdialog 2>/dev/null); then #ubuntu! + xprop -root 2> /dev/null | awk '/NET_ACTIVE_WINDOW/{print $5;exit} END{exit !$5}' || echo "0" + else + echo $EPOCHSECONDS #fallback for windows + fi +} + +bgnotify () { ## args: (title, subtitle) + if hash terminal-notifier 2>/dev/null; then #osx + [[ "$TERM_PROGRAM" == 'iTerm.app' ]] && term_id='com.googlecode.iterm2'; + [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]] && term_id='com.apple.terminal'; + ## now call terminal-notifier, (hopefully with $term_id!) + [ -z "$term_id" ] && terminal-notifier -message "$2" -title "$1" >/dev/null || + terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" >/dev/null + elif hash growlnotify 2>/dev/null; then #osx growl + growlnotify -m "$1" "$2" + elif hash notify-send 2>/dev/null; then #ubuntu gnome! + notify-send "$1" "$2" + elif hash kdialog 2>/dev/null; then #ubuntu kde! + kdialog -title "$1" --passivepopup "$2" 5 + elif hash notifu 2>/dev/null; then #cygwyn support! + notifu /m "$2" /p "$1" + fi +} + + +## Zsh hooks ## + +bgnotify_begin() { + bgnotify_timestamp=$EPOCHSECONDS + bgnotify_lastcmd="$1" + bgnotify_windowid=$(currentWindowId) +} + +bgnotify_end() { + didexit=$? + elapsed=$(( EPOCHSECONDS - bgnotify_timestamp )) + past_threshold=$(( elapsed >= bgnotify_threshold )) + if (( bgnotify_timestamp > 0 )) && (( past_threshold )); then + if [ $(currentWindowId) != "$bgnotify_windowid" ]; then + print -n "\a" + bgnotify_formatted "$didexit" "$bgnotify_lastcmd" "$elapsed" + fi + fi + bgnotify_timestamp=0 #reset it to 0! +} + +## only enable if a local (non-ssh) connection +if [ -z "$SSH_CLIENT" ] && [ -z "$SSH_TTY" ]; then + add-zsh-hook preexec bgnotify_begin + add-zsh-hook precmd bgnotify_end +fi diff --git a/oh-my-zsh/plugins/boot2docker/README.md b/oh-my-zsh/plugins/boot2docker/README.md @@ -0,0 +1,6 @@ +## Boot2docker autocomplete plugin + +- Adds autocomplete options for all boot2docker commands. + + +Maintainer : Manfred Touron ([@moul](https://github.com/moul)) diff --git a/oh-my-zsh/plugins/boot2docker/_boot2docker b/oh-my-zsh/plugins/boot2docker/_boot2docker @@ -0,0 +1,73 @@ +#compdef boot2docker + +# Boot2docker autocompletion for oh-my-zsh +# Requires: Boot2docker installed +# Author: Manfred Touron (@moul) + +local -a _1st_arguments +_1st_arguments=( + "init":"Create a new Boot2Docker VM." + "up":"Start VM from any states." + "start":"Start VM from any states." + "boot":"Start VM from any states." + "ssh":"[ssh-command] Login to VM via SSH." + "save":"Suspend VM and save state to disk." + "suspend":"Suspend VM and save state to disk." + "down":"Gracefully shutdown the VM." + "stop":"Gracefully shutdown the VM." + "halt":"Gracefully shutdown the VM." + "restart":"Gracefully reboot the VM." + "poweroff":"Forcefully power off the VM (may corrupt disk image)." + "reset":"Forcefully power cycle the VM (may corrupt disk image)." + "delete":"Delete Boot2Docker VM and its disk image." + "destroy":"Delete Boot2Docker VM and its disk image." + "config":"Show selected profile file settings." + "cfg":"Show selected profile file settings." + "info":"Display detailed information of VM." + "ip":"Display the IP address of the VM's Host-only network." + "socket":"Display the DOCKER_HOST socket to connect to." + "shellinit":"Display the shell command to set up the Docker client." + "status":"Display current state of VM." + "download":"Download Boot2Docker ISO image." + "upgrade":"Upgrade the Boot2Docker ISO image (restart if running)." + "version":"Display version information." +) + +_arguments \ + '(--basevmdk)--basevmdk[Path to VMDK to use as base for persistent partition]' \ + '(--cpus)'{-c,--cpus}'[number of CPUs for boot2docker.]' \ + '(--clobber)--clobber[overwrite Docker client binary on boot2docker upgrade]' \ + '(--dhcp)--dhcp[enable VirtualBox host-only network DHCP.]' \ + '(--dhcpip)--dhcpip[VirtualBox host-only network DHCP server address.]' \ + '(-s --disksize)'{-s,--disksize}'[boot2docker disk image size (in MB).]' \ + '(--dockerport)--dockerport[host Docker port (forward to port 2376 in VM). (deprecated - use with care)]' \ + '(--driver)--driver[hypervisor driver.]' \ + '(--force-upgrade-download)--force-upgrade-download[always download on boot2docker upgrade, never skip.]' \ + '(--hostip)--hostip[VirtualBox host-only network IP address.]' \ + '(--iso)--iso[path to boot2docker ISO image.]' \ + '(--iso-url)--iso-url[/api.github.com/repos/boot2docker/boot2docker/releases": source URL to provision the boot2docker ISO image.]' \ + '(--lowerip)--lowerip[VirtualBox host-only network DHCP lower bound.]' \ + '(--memory)'{-m,--memory}'[virtual machine memory size (in MB).]' \ + '(--netmask)--netmask[VirtualBox host-only network mask.]' \ + '(--no-dummy)--no-dummy[Example parameter for the dummy driver.]' \ + '(--retries)--retries[number of port knocking retries during 'start']' \ + '(--serial)--serial[try serial console to get IP address (experimental)]' \ + '(--serialfile)--serialfile[path to the serial socket/pipe.]' \ + '(--ssh)--ssh[path to SSH client utility.]' \ + '(--ssh-keygen)--ssh-keygen[path to ssh-keygen utility.]' \ + '(--sshkey)--sshkey[path to SSH key to use.]' \ + '(--sshport)--sshport[host SSH port (forward to port 22 in VM).]' \ + '(--upperip)--upperip[VirtualBox host-only network DHCP upper bound.]' \ + '(--vbm)--vbm[path to VirtualBox management utility.]' \ + '(--vbox-share)--vbox-share[(defaults to "/Users=Users" if no shares are specified; use "disable" to explicitly prevent any shares from being created) List of directories to share during "up|start|boot" via VirtualBox Guest Additions, with optional labels]' \ + '(--verbose)'{-v,--verbose}'[display verbose command invocations.]' \ + '(--vm)--vm[virtual machine name.]' \ + '(--waittime)--waittime[Time in milliseconds to wait between port knocking retries during 'start']' \ + '*:: :->subcmds' && return 0 + +#_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "boot2docker command" _1st_arguments + return +fi diff --git a/oh-my-zsh/plugins/bower/_bower b/oh-my-zsh/plugins/bower/_bower @@ -0,0 +1,58 @@ + + +# Credits to npm's awesome completion utility. +# +# Bower completion script, based on npm completion script. + +###-begin-bower-completion-### +# +# Installation: bower completion >> ~/.bashrc (or ~/.zshrc) +# Or, maybe: bower completion > /usr/local/etc/bash_completion.d/bower +# + +COMP_WORDBREAKS=${COMP_WORDBREAKS/=/} +COMP_WORDBREAKS=${COMP_WORDBREAKS/@/} +export COMP_WORDBREAKS + +if type complete &>/dev/null; then + _bower_completion () { + local si="$IFS" + IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \ + COMP_LINE="$COMP_LINE" \ + COMP_POINT="$COMP_POINT" \ + bower completion -- "${COMP_WORDS[@]}" \ + 2>/dev/null)) || return $? + IFS="$si" + } + complete -F _bower_completion bower +elif type compdef &>/dev/null; then + _bower_completion() { + si=$IFS + compadd -- $(COMP_CWORD=$((CURRENT-1)) \ + COMP_LINE=$BUFFER \ + COMP_POINT=0 \ + bower completion -- "${words[@]}" \ + 2>/dev/null) + IFS=$si + } + compdef _bower_completion bower +elif type compctl &>/dev/null; then + _bower_completion () { + local cword line point words si + read -Ac words + read -cn cword + let cword-=1 + read -l line + read -ln point + si="$IFS" + IFS=$'\n' reply=($(COMP_CWORD="$cword" \ + COMP_LINE="$line" \ + COMP_POINT="$point" \ + bower completion -- "${words[@]}" \ + 2>/dev/null)) || return $? + IFS="$si" + } + compctl -K _bower_completion bower +fi +###-end-bower-completion-### + diff --git a/oh-my-zsh/plugins/bower/bower.plugin.zsh b/oh-my-zsh/plugins/bower/bower.plugin.zsh @@ -0,0 +1,82 @@ +alias bi="bower install" +alias bl="bower list" +alias bs="bower search" + +_bower_installed_packages () { + bower_package_list=$(bower ls --no-color 2>/dev/null| awk 'NR>3{print p}{p=$0}'| cut -d ' ' -f 2|sed 's/#.*//') +} +_bower () +{ + local -a _1st_arguments _no_color _dopts _save_dev _force_lastest _production + local expl + typeset -A opt_args + + _no_color=('--no-color[Do not print colors (available in all commands)]') + + _dopts=( + '(--save)--save[Save installed packages into the project"s bower.json dependencies]' + '(--force)--force[Force fetching remote resources even if a local copy exists on disk]' + ) + + _save_dev=('(--save-dev)--save-dev[Save installed packages into the project"s bower.json devDependencies]') + + _force_lastest=('(--force-latest)--force-latest[Force latest version on conflict]') + + _production=('(--production)--production[Do not install project devDependencies]') + + _1st_arguments=( + 'cache-clean:Clean the Bower cache, or the specified package caches' \ + 'help:Display help information about Bower' \ + 'info:Version info and description of a particular package' \ + 'init:Interactively create a bower.json file' \ + 'install:Install a package locally' \ + 'link:Symlink a package folder' \ + 'lookup:Look up a package URL by name' \ + 'register:Register a package' \ + 'search:Search for a package by name' \ + 'uninstall:Remove a package' \ + 'update:Update a package' \ + {ls,list}:'[List all installed packages]' + ) + _arguments \ + $_no_color \ + '*:: :->subcmds' && return 0 + + if (( CURRENT == 1 )); then + _describe -t commands "bower subcommand" _1st_arguments + return + fi + + case "$words[1]" in + install) + _arguments \ + $_dopts \ + $_save_dev \ + $_force_lastest \ + $_no_color \ + $_production + ;; + update) + _arguments \ + $_dopts \ + $_no_color \ + $_force_lastest + _bower_installed_packages + compadd "$@" $(echo $bower_package_list) + ;; + uninstall) + _arguments \ + $_no_color \ + $_dopts + _bower_installed_packages + compadd "$@" $(echo $bower_package_list) + ;; + *) + _arguments \ + $_no_color \ + ;; + esac + +} + +compdef _bower bower diff --git a/oh-my-zsh/plugins/branch/README.md b/oh-my-zsh/plugins/branch/README.md @@ -0,0 +1,33 @@ +# Branch + +Displays the current Git or Mercurial branch fast. + +## Speed test + +### Mercurial + +```shell +$ time hg branch +0.11s user 0.14s system 70% cpu 0.355 total +``` + +### Branch plugin + +```shell +$ time zsh /tmp/branch_prompt_info_test.zsh +0.00s user 0.01s system 78% cpu 0.014 total +``` + +## Usage + +Edit your theme file (eg.: `~/.oh-my-zsh/theme/robbyrussell.zsh-theme`) +adding `$(branch_prompt_info)` in your prompt like this: + +```diff +- PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' ++ PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(branch_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +``` + +## Maintainer + +Victor Torres (<vpaivatorres@gmail.com>) diff --git a/oh-my-zsh/plugins/branch/branch.plugin.zsh b/oh-my-zsh/plugins/branch/branch.plugin.zsh @@ -0,0 +1,31 @@ +# Branch: displays the current Git or Mercurial branch fast. +# Victor Torres <vpaivatorres@gmail.com> +# Oct 2, 2015 + +function branch_prompt_info() { + # Defines path as current directory + local current_dir=$PWD + # While current path is not root path + while [[ $current_dir != '/' ]] + do + # Git repository + if [[ -d "${current_dir}/.git" ]] + then + echo '±' ${"$(<"$current_dir/.git/HEAD")"##*/} + return; + fi + # Mercurial repository + if [[ -d "${current_dir}/.hg" ]] + then + if [[ -f "$current_dir/.hg/branch" ]] + then + echo '☿' $(<"$current_dir/.hg/branch") + else + echo '☿ default' + fi + return; + fi + # Defines path as parent directory and keeps looking for :) + current_dir="${current_dir:h}" + done +} diff --git a/oh-my-zsh/plugins/brew/brew.plugin.zsh b/oh-my-zsh/plugins/brew/brew.plugin.zsh @@ -0,0 +1,20 @@ +alias brews='brew list -1' +alias bubo='brew update && brew outdated' +alias bubc='brew upgrade && brew cleanup' +alias bubu='bubo && bubc' + +if command mkdir "$ZSH_CACHE_DIR/.brew-completion-message" 2>/dev/null; then + print -P '%F{yellow}'Oh My Zsh brew plugin: + cat <<-'EOF' + + With the advent of their 1.0 release, Homebrew has decided to bundle + the zsh completion as part of the brew installation, so we no longer + ship it with the brew plugin; now it only has brew aliases. + + If you find that brew completion no longer works, make sure you have + your Homebrew installation fully up to date. + + You will only see this message once. + EOF + print -P '%f' +fi diff --git a/oh-my-zsh/plugins/bundler/README.md b/oh-my-zsh/plugins/bundler/README.md @@ -0,0 +1,50 @@ +# Bundler + +- adds completion for basic bundler commands +- adds short aliases for common bundler commands + - `be` aliased to `bundle exec` + - `bl` aliased to `bundle list` + - `bp` aliased to `bundle package` + - `bo` aliased to `bundle open` + - `bout` aliased to `bundle outdated` + - `bu` aliased to `bundle update` + - `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`) +- adds a wrapper for common gems: + - looks for a binstub under `./bin/` and executes it (if present) + - calls `bundle exec <gem executable>` otherwise + +For a full list of *common gems* being wrapped by default please look at the `bundler.plugin.zsh` file. + +## Configuration + +Please use the exact name of the executable and not the gem name. + +### Add additional gems to be wrapped + +Add this before the plugin-list in your `.zshrc`: +```sh +BUNDLED_COMMANDS=(rubocop) +plugins=(... bundler ...) +``` +This will add the wrapper for the `rubocop` gem (i.e. the executable). + + +### Exclude gems from being wrapped + +Add this before the plugin-list in your `.zshrc`: +```sh +UNBUNDLED_COMMANDS=(foreman spin) +plugins=(... bundler ...) +``` +This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped. + +## Excluded gems + +These gems should not be called with `bundle exec`. Please see [issue #2923](https://github.com/robbyrussell/oh-my-zsh/pull/2923) on GitHub for clarification. + +`berks` +`foreman` +`mailcatcher` +`rails` +`ruby` +`spin` diff --git a/oh-my-zsh/plugins/bundler/_bundler b/oh-my-zsh/plugins/bundler/_bundler @@ -0,0 +1,104 @@ +#compdef bundle + +local curcontext="$curcontext" state line _gems _opts ret=1 + +_arguments -C -A "-v" -A "--version" \ + '(- 1 *)'{-v,--version}'[display version information]' \ + '1: :->cmds' \ + '*:: :->args' && ret=0 + +case $state in + cmds) + _values "bundle command" \ + "install[Install the gems specified by the Gemfile or Gemfile.lock]" \ + "update[Update dependencies to their latest versions]" \ + "package[Package the .gem files required by your application]" \ + "exec[Execute a script in the context of the current bundle]" \ + "config[Specify and read configuration options for bundler]" \ + "check[Determine whether the requirements for your application are installed]" \ + "list[Show all of the gems in the current bundle]" \ + "show[Show the source location of a particular gem in the bundle]" \ + "outdated[Show all of the outdated gems in the current bundle]" \ + "console[Start an IRB session in the context of the current bundle]" \ + "open[Open an installed gem in the editor]" \ + "viz[Generate a visual representation of your dependencies]" \ + "init[Generate a simple Gemfile, placed in the current directory]" \ + "gem[Create a simple gem, suitable for development with bundler]" \ + "platform[Displays platform compatibility information]" \ + "clean[Cleans up unused gems in your bundler directory]" \ + "help[Describe available tasks or one specific task]" + ret=0 + ;; + args) + case $line[1] in + help) + _values 'commands' \ + 'install' \ + 'update' \ + 'package' \ + 'exec' \ + 'config' \ + 'check' \ + 'list' \ + 'show' \ + 'outdated' \ + 'console' \ + 'open' \ + 'viz' \ + 'init' \ + 'gem' \ + 'platform' \ + 'help' && ret=0 + ;; + install) + _arguments \ + '(--no-color)--no-color[disable colorization in output]' \ + '(--local)--local[do not attempt to connect to rubygems.org]' \ + '(--quiet)--quiet[only output warnings and errors]' \ + '(--gemfile)--gemfile=-[use the specified gemfile instead of Gemfile]:gemfile' \ + '(--system)--system[install to the system location]' \ + '(--deployment)--deployment[install using defaults tuned for deployment environments]' \ + '(--frozen)--frozen[do not allow the Gemfile.lock to be updated after this install]' \ + '(--path)--path=-[specify a different path than the system default]:path:_files' \ + '(--binstubs)--binstubs=-[generate bin stubs for bundled gems to ./bin]:directory:_files' \ + '(--without)--without=-[exclude gems that are part of the specified named group]:groups' + ret=0 + ;; + exec) + _normal && ret=0 + ;; + clean) + _arguments \ + '(--force)--force[forces clean even if --path is not set]' \ + '(--dry-run)--dry-run[only print out changes, do not actually clean gems]' \ + '(--no-color)--no-color[Disable colorization in output]' \ + '(--verbose)--verbose[Enable verbose output mode]' + ret=0 + ;; + outdated) + _arguments \ + '(--pre)--pre[Check for newer pre-release gems]' \ + '(--source)--source[Check against a specific source]' \ + '(--local)--local[Do not attempt to fetch gems remotely and use the gem cache instead]' \ + '(--no-color)--no-color[Disable colorization in output]' \ + '(--verbose)--verbose[Enable verbose output mode]' + ret=0 + ;; + (open|show) + _gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') ) + if [[ $_gems != "" ]]; then + _values 'gems' $_gems && ret=0 + fi + ;; + *) + _opts=( $(bundle help $line[1] | sed -e '/^ \[-/!d; s/^ \[\(-[^=]*\)=.*/\1/') ) + _opts+=( $(bundle help $line[1] | sed -e '/^ -/!d; s/^ \(-.\), \[\(-[^=]*\)=.*/\1 \2/') ) + if [[ $_opts != "" ]]; then + _values 'options' $_opts && ret=0 + fi + ;; + esac + ;; +esac + +return ret diff --git a/oh-my-zsh/plugins/bundler/bundler.plugin.zsh b/oh-my-zsh/plugins/bundler/bundler.plugin.zsh @@ -0,0 +1,113 @@ +alias be="bundle exec" +alias bl="bundle list" +alias bp="bundle package" +alias bo="bundle open" +alias bout="bundle outdated" +alias bu="bundle update" +alias bi="bundle_install" +alias bcn="bundle clean" + +bundled_commands=( + annotate + cap + capify + cucumber + foodcritic + guard + hanami + irb + jekyll + kitchen + knife + middleman + nanoc + pry + puma + rackup + rainbows + rake + rspec + shotgun + sidekiq + spec + spork + spring + strainer + tailor + taps + thin + thor + unicorn + unicorn_rails +) + +# Remove $UNBUNDLED_COMMANDS from the bundled_commands list +for cmd in $UNBUNDLED_COMMANDS; do + bundled_commands=(${bundled_commands#$cmd}); +done + +# Add $BUNDLED_COMMANDS to the bundled_commands list +for cmd in $BUNDLED_COMMANDS; do + bundled_commands+=($cmd); +done + +## Functions + +bundle_install() { + if _bundler-installed && _within-bundled-project; then + local bundler_version=`bundle version | cut -d' ' -f3` + if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then + if [[ "$OSTYPE" = darwin* ]] + then + local cores_num="$(sysctl -n hw.ncpu)" + else + local cores_num="$(nproc)" + fi + bundle install --jobs=$cores_num $@ + else + bundle install $@ + fi + else + echo "Can't 'bundle install' outside a bundled project" + fi +} + +_bundler-installed() { + which bundle > /dev/null 2>&1 +} + +_within-bundled-project() { + local check_dir="$PWD" + while [ "$check_dir" != "/" ]; do + [ -f "$check_dir/Gemfile" ] && return + check_dir="$(dirname $check_dir)" + done + false +} + +_binstubbed() { + [ -f "./bin/${1}" ] +} + +_run-with-bundler() { + if _bundler-installed && _within-bundled-project; then + if _binstubbed $1; then + ./bin/$@ + else + bundle exec $@ + fi + else + $@ + fi +} + +## Main program +for cmd in $bundled_commands; do + eval "function unbundled_$cmd () { $cmd \$@ }" + eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" + alias $cmd=bundled_$cmd + + if which _$cmd > /dev/null 2>&1; then + compdef _$cmd bundled_$cmd=$cmd + fi +done diff --git a/oh-my-zsh/plugins/bwana/bwana.plugin.zsh b/oh-my-zsh/plugins/bwana/bwana.plugin.zsh @@ -0,0 +1,13 @@ +# +# Requires http://www.bruji.com/bwana/ +# +if [[ -e /Applications/Bwana.app ]] || + ( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana ) +then + function man() { + open "man:$1" + } +else + echo "Bwana lets you read man files in Safari through a man: URI scheme" + echo "To use it within Zsh, install it from http://www.bruji.com/bwana/" +fi diff --git a/oh-my-zsh/plugins/cabal/cabal.plugin.zsh b/oh-my-zsh/plugins/cabal/cabal.plugin.zsh @@ -0,0 +1,93 @@ +function cabal_sandbox_info() { + cabal_files=(*.cabal(N)) + if [ $#cabal_files -gt 0 ]; then + if [ -f cabal.sandbox.config ]; then + echo "%{$fg[green]%}sandboxed%{$reset_color%}" + else + echo "%{$fg[red]%}not sandboxed%{$reset_color%}" + fi + fi +} + +function _cabal_commands() { + local ret=1 state + _arguments ':subcommand:->subcommand' && ret=0 + + case $state in + subcommand) + subcommands=( + "bench:Run the benchmark, if any (configure with UserHooks)" + "build:Compile all targets or specific target." + "check:Check the package for common mistakes" + "clean:Clean up after a build" + "copy:Copy the files into the install locations" + "configure:Prepare to build the package" + "exec:Run a command with the cabal environment" + "fetch:Downloads packages for later installation" + "freeze:Freeze dependencies." + "get:Gets a package's source code" + "haddock:Generate Haddock HTML documentation" + "help:Help about commands" + "hscolour:Generate HsColour colourised code, in HTML format" + "info:Display detailed information about a particular package" + "init:Interactively create a .cabal file" + "install:Installs a list of packages" + "list:List packages matching a search string" + "register:Register this package with the compiler" + "repl:Open an interpreter session for the given target" + "report:Upload build reports to a remote server" + "run:Runs the compiled executable" + "sandbox:Create/modify/delete a sandbox" + "sdist:Generate a source distribution file (.tar.gz)" + "test:Run the test suite, if any (configure with UserHooks)" + "unpack:Unpacks packages for user inspection" + "update:Updates list of known packages" + "upload:Uploads source packages to Hackage" + ) + _describe -t subcommands 'cabal subcommands' subcommands && ret=0 + esac + + return ret +} + +compdef _cabal_commands cabal + +function _cab_commands() { + local ret=1 state + _arguments ':subcommand:->subcommand' && ret=0 + + case $state in + subcommand) + subcommands=( + "sync:Fetch the latest package index" + "install:Install packages" + "uninstall:Uninstall packages" + "installed:List installed packages" + "configure:Configure a cabal package" + "build:Build a cabal package" + "clean:Clean up a build directory" + "outdated:Display outdated packages" + "info:Display information of a package" + "sdist:Make tar.gz for source distribution" + "upload:Uploading tar.gz to HackageDB" + "get:Untar a package in the current directory" + "deps:Show dependencies of this package" + "revdeps:Show reverse dependencies of this package" + "check:Check consistency of packages" + "genpaths:Generate Paths_<pkg>.hs" + "search:Search available packages by package name" + "add:Add a source directory" + "test:Run tests" + "bench:Run benchmarks" + "doc:Generate manuals" + "ghci:Run GHCi (with a sandbox)" + "init:Initialize a sandbox" + "help:Display the help message of the command" + ) + _describe -t subcommands 'cab subcommands' subcommands && ret=0 + esac + + return ret +} + +command -v cab >/dev/null 2>&1 && { compdef _cab_commands cab } diff --git a/oh-my-zsh/plugins/cake/cake.plugin.zsh b/oh-my-zsh/plugins/cake/cake.plugin.zsh @@ -0,0 +1,33 @@ +# Set this to 1 if you want to cache the tasks +_cake_cache_task_list=1 + +# Cache filename +_cake_task_cache_file='.cake_task_cache' + +_cake_get_target_list () { + cake | grep '^cake ' | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$' +} + +_cake_does_target_list_need_generating () { + + if [ ${_cake_cache_task_list} -eq 0 ]; then + return 1; + fi + + [ ! -f ${_cake_task_cache_file} ] && return 0; + [ Cakefile -nt ${_cake_task_cache_file} ] && return 0; + return 1; +} + +_cake () { + if [ -f Cakefile ]; then + if _cake_does_target_list_need_generating; then + _cake_get_target_list > ${_cake_task_cache_file} + compadd `cat ${_cake_task_cache_file}` + else + compadd `_cake_get_target_list` + fi + fi +} + +compdef _cake cake diff --git a/oh-my-zsh/plugins/cakephp3/cakephp3.plugin.zsh b/oh-my-zsh/plugins/cakephp3/cakephp3.plugin.zsh @@ -0,0 +1,38 @@ +# CakePHP 3 basic command completion +_cakephp3_get_command_list () { + bin/cake Completion commands +} + +_cakephp3_get_sub_command_list () { + bin/cake Completion subcommands ${words[2]} +} + +_cakephp3_get_3rd_argument () { + bin/cake ${words[2]} ${words[3]} | \grep '\-\ '| \awk '{print $2}' +} + +_cakephp3 () { + local -a has3rdargument + has3rdargument=("all" "controller" "fixture" "model" "template") + if [ -f bin/cake ]; then + if (( CURRENT == 2 )); then + compadd $(_cakephp3_get_command_list) + fi + if (( CURRENT == 3 )); then + compadd $(_cakephp3_get_sub_command_list) + fi + if (( CURRENT == 4 )); then + if [[ ${has3rdargument[(i)${words[3]}]} -le ${#has3rdargument} ]]; then + compadd $(_cakephp3_get_3rd_argument) + fi + fi + fi +} + +compdef _cakephp3 bin/cake +compdef _cakephp3 cake + +#Alias +alias c3='bin/cake' +alias c3cache='bin/cake orm_cache clear' +alias c3migrate='bin/cake migrations migrate' diff --git a/oh-my-zsh/plugins/capistrano/_capistrano b/oh-my-zsh/plugins/capistrano/_capistrano @@ -0,0 +1,49 @@ +#compdef capit +#autoload + +# Added `capit` because `cap` is a reserved word. `cap` completion doesn't work. +# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module + +local curcontext="$curcontext" state line ret=1 +local -a _configs + +_arguments -C \ + '1: :->cmds' \ + '2:: :->args' && ret=0 + +_cap_tasks() { + if [[ -f config/deploy.rb || -f Capfile ]]; then + if [[ ! -f .cap_tasks~ ]]; then + capit --tasks | sed 's/\(\[\)\(.*\)\(\]\)/\2:/' | awk '{command=$2; $1=$2=$3=""; gsub(/^[ \t\r\n]+/, "", $0); gsub(":", "\\:", command); print command"["$0"]"}' > .cap_tasks~ + fi + + OLD_IFS=$IFS + IFS=$'\n' + _values 'cap commands' $(< .cap_tasks~) + IFS=$OLD_IFS + # zmodload zsh/mapfile + # _values ${(f)mapfile[.cap_tasks~]} + fi +} + +_cap_stages() { + compadd $(find config/deploy -name \*.rb | cut -d/ -f3 | sed s:.rb::g) +} + +case $state in + cmds) + # check if it uses multistage + if [[ -d config/deploy ]]; then + _cap_stages + else + _cap_tasks + fi + ret=0 + ;; + args) + _cap_tasks + ret=0 + ;; +esac + +return ret diff --git a/oh-my-zsh/plugins/capistrano/capistrano.plugin.zsh b/oh-my-zsh/plugins/capistrano/capistrano.plugin.zsh @@ -0,0 +1,11 @@ +# Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work. +# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module + +func capit() { + if [ -f Gemfile ] + then + bundle exec cap $* + else + cap $* + fi +} diff --git a/oh-my-zsh/plugins/cargo/README.md b/oh-my-zsh/plugins/cargo/README.md @@ -0,0 +1,11 @@ +# cargo + +This plugin adds completion for the Rust build tool [`cargo`](https://github.com/rust-lang/cargo). + +To use it, add `cargo` to the plugins array in your zshrc file: + +```zsh +plugins=(... cargo) +``` + +Updated on October 4th, 2016. diff --git a/oh-my-zsh/plugins/cargo/_cargo b/oh-my-zsh/plugins/cargo/_cargo @@ -0,0 +1,500 @@ +#compdef cargo + +typeset -A opt_args +autoload -U regexp-replace + +_cargo() { + +_arguments \ + '(- 1 *)'{-h,--help}'[show help message]' \ + '(- 1 *)'{-V,--version}'[show version information]' \ + '(- 1 *)'--list'[list installed commands]' \ + '(- 1 *)'--explain'[Run `rustc --explain CODE`]' \ + '(- 1 *)'{-v,--verbose}'[use verbose output]' \ + '(- 1 *)'--color'[colorization option]' \ + '(- 1 *)'--frozen'[Require Cargo.lock and cache are up to date]' \ + '(- 1 *)'--locked'[Require Cargo.lock is up to date]' \ + '1: :_cargo_cmds' \ + '*:: :->args' + +case $state in + args) + case $words[1] in + bench) + _arguments \ + '--features=[space separated feature list]' \ + '--all-features[enable all available features]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ + "${command_scope_spec[@]}" \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--no-default-features[do not build the default features]' \ + '--no-run[compile but do not run]' \ + '(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \ + '--target=[target triple]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + build) + _arguments \ + '--features=[space separated feature list]' \ + '--all-features[enable all available features]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ + "${command_scope_spec[@]}" \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--no-default-features[do not build the default features]' \ + '(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \ + '--release=[build in release mode]' \ + '--target=[target triple]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + clean) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--release[whether or not to clean release artifacts]' \ + '--target=[target triple(default:all)]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + doc) + _arguments \ + '--features=[space separated feature list]' \ + '--all-features[enable all available features]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--no-deps[do not build docs for dependencies]' \ + '--no-default-features[do not build the default features]' \ + '--open[open docs in browser after the build]' \ + '(-p, --package)'{-p,--package}'=[package to document]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--release[build artifacts in release mode, with optimizations]' \ + '--target=[build for the target triple]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + fetch) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + generate-lockfile) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + git-checkout) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + 'q(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--reference=[REF]' \ + '--url=[URL]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + help) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '*: :_cargo_cmds' \ + ;; + + init) + _arguments \ + '--bin[use binary template]' \ + '--vcs:initialize a new repo with a given VCS:(git hg none)' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--name=[set the resulting package name]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + install) + _arguments \ + '--bin=[only install the specified binary]' \ + '--branch=[branch to use when installing from git]' \ + '--color=:colorization option:(auto always never)' \ + '--debug[build in debug mode instead of release mode]' \ + '--example[install the specified example instead of binaries]' \ + '--features=[space separated feature list]' \ + '--all-features[enable all available features]' \ + '--git=[URL from which to install the crate]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ + '--no-default-features[do not build the default features]' \ + '--path=[local filesystem path to crate to install]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--rev=[specific commit to use when installing from git]' \ + '--root=[directory to install packages into]' \ + '--tag=[tag to use when installing from git]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--vers=[version to install from crates.io]' \ + ;; + + locate-project) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + ;; + + login) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--host=[Host to set the token for]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + metadata) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + "--no-deps[output information only about the root package and don't fetch dependencies]" \ + '--no-default-features[do not include the default feature]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--features=[space separated feature list]' \ + '--all-features[enable all available features]' \ + '--format-version=[format version(default: 1)]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + new) + _arguments \ + '--bin[use binary template]' \ + '--vcs:initialize a new repo with a given VCS:(git hg none)' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--name=[set the resulting package name]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + owner) + _arguments \ + '(-a, --add)'{-a,--add}'[add owner LOGIN]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--index[registry index]' \ + '(-l, --list)'{-l,--list}'[list owners of a crate]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-r, --remove)'{-r,--remove}'[remove owner LOGIN]' \ + '--token[API token to use when authenticating]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + package) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-l, --list)'{-l,--list}'[print files included in a package without making one]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--no-metadata[ignore warnings about a lack of human-usable metadata]' \ + '--no-verify[do not build to verify contents]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + pkgid) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + publish) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--host=[Host to set the token for]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--no-verify[Do not verify tarball until before publish]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--token[token to use when uploading]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + read-manifest) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + run) + _arguments \ + '--example=[name of the bin target]' \ + '--features=[space separated feature list]' \ + '--all-features[enable all available features]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--bin=[name of the bin target]' \ + '--no-default-features[do not build the default features]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--release=[build in release mode]' \ + '--target=[target triple]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + '*: :_normal' \ + ;; + + rustc) + _arguments \ + '--color=:colorization option:(auto always never)' \ + '--features=[features to compile for the package]' \ + '--all-features[enable all available features]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \ + '--manifest-path=[path to the manifest to fetch dependencies for]' \ + '--no-default-features[do not compile default features for the package]' \ + '(-p, --package)'{-p,--package}'=[profile to compile for]' \ + '--profile=[profile to build the selected target for]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--release[build artifacts in release mode, with optimizations]' \ + '--target=[target triple which compiles will be for]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + "${command_scope_spec[@]}" \ + ;; + + rustdoc) + _arguments \ + '--color=:colorization option:(auto always never)' \ + '--features=[space-separated list of features to also build]' \ + '--all-features[enable all available features]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \ + '--manifest-path=[path to the manifest to document]' \ + '--no-default-features[do not build the `default` feature]' \ + '--open[open the docs in a browser after the operation]' \ + '(-p, --package)'{-p,--package}'=[package to document]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--release[build artifacts in release mode, with optimizations]' \ + '--target=[build for the target triple]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + "${command_scope_spec[@]}" \ + ;; + + search) + _arguments \ + '--color=:colorization option:(auto always never)' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--host=[host of a registry to search in]' \ + '--limit=[limit the number of results]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + ;; + + test) + _arguments \ + '--features=[space separated feature list]' \ + '--all-features[enable all available features]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--test=[test name]: :_test_names' \ + '--no-default-features[do not build the default features]' \ + '--no-fail-fast[run all tests regardless of failure]' \ + '--no-run[compile but do not run]' \ + '(-p,--package)'{-p=,--package=}'[package to run tests for]:packages:_get_package_names' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--release[build artifacts in release mode, with optimizations]' \ + '--target=[target triple]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + '1: :_test_names' \ + ;; + + uninstall) + _arguments \ + '--bin=[only uninstall the binary NAME]' \ + '--color=:colorization option:(auto always never)' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-q, --quiet)'{-q,--quiet}'[less output printed to stdout]' \ + '--root=[directory to uninstall packages from]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + ;; + + update) + _arguments \ + '--aggressive=[force dependency update]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '(-p,--package)'{-p=,--package=}'[package to update]:packages:__get_package_names' \ + '--precise=[update single dependency to PRECISE]: :' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + verify-project) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + version) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + yank) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--index[registry index]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--token[API token to use when authenticating]' \ + '--undo[undo a yank, putting a version back into the index]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + '--vers[yank version]' \ + ;; + esac + ;; +esac +} + +_cargo_cmds(){ +local -a commands;commands=( +'bench:execute all benchmarks of a local package' +'build:compile the current project' +'clean:remove generated artifacts' +'doc:build package documentation' +'fetch:fetch package dependencies' +'generate-lockfile:create lockfile' +'git-checkout:git checkout' +'help:get help for commands' +'init:create new project in current directory' +'install:install a Rust binary' +'locate-project:print "Cargo.toml" location' +'login:login to remote server' +'metadata:the metadata for a project in json' +'new:create a new project' +'owner:manage the owners of a crate on the registry' +'package:assemble local package into a distributable tarball' +'pkgid:print a fully qualified package specification' +'publish:upload package to the registry' +'read-manifest:print manifest in JSON format' +'run:run the main binary of the local package' +'rustc:compile a package and all of its dependencies' +'rustdoc:build documentation for a package' +'search:search packages on crates.io' +'test:execute all unit and tests of a local package' +'uninstall:remove a Rust binary' +'update:update dependencies' +'verify-project:check Cargo.toml' +'version:show version information' +'yank:remove pushed file from index' +) +_describe 'command' commands + +} + + +#FIXME: Disabled until fixed +#gets package names from the manifest file +_get_package_names() +{ +} + +#TODO:see if it makes sense to have 'locate-project' to have non-json output. +#strips package name from json stuff +_locate_manifest(){ +local manifest=`cargo locate-project 2>/dev/null` +regexp-replace manifest '\{"root":"|"\}' '' +echo $manifest +} + +# Extracts the values of "name" from the array given in $1 and shows them as +# command line options for completion +_get_names_from_array() +{ + local -a filelist; + local manifest=$(_locate_manifest) + if [[ -z $manifest ]]; then + return 0 + fi + + local last_line + local -a names; + local in_block=false + local block_name=$1 + names=() + while read line + do + if [[ $last_line == "[[$block_name]]" ]]; then + in_block=true + else + if [[ $last_line =~ '.*\[\[.*' ]]; then + in_block=false + fi + fi + + if [[ $in_block == true ]]; then + if [[ $line =~ '.*name.*=' ]]; then + regexp-replace line '^.*name *= *|"' "" + names+=$line + fi + fi + + last_line=$line + done < $manifest + _describe $block_name names + +} + +#Gets the test names from the manifest file +_test_names() +{ + _get_names_from_array "test" +} + +#Gets the bench names from the manifest file +_benchmark_names() +{ + _get_names_from_array "bench" +} + +# These flags are mutally exclusive specifiers for the scope of a command; as +# they are used in multiple places without change, they are expanded into the +# appropriate command's `_arguments` where appropriate. +set command_scope_spec +command_scope_spec=( + '(--bin --example --test --lib)--bench=[benchmark name]: :_benchmark_names' + '(--bench --bin --test --lib)--example=[example name]' + '(--bench --example --test --lib)--bin=[binary name]' + '(--bench --bin --example --test)--lib=[library name]' + '(--bench --bin --example --lib)--test=[test name]' +) + + +_cargo diff --git a/oh-my-zsh/plugins/cask/README.md b/oh-my-zsh/plugins/cask/README.md @@ -0,0 +1,15 @@ +# Cask plugin + +[Cask](https://github.com/cask/cask) is a project management tool for Emacs that helps +automate the package development cycle; development, dependencies, testing, building, +packaging and more. + +This plugin loads `cask` completion from non-standard locations, such as if installed +via Homebrew or others. To enable it, add `cask` to your plugins array: + +```zsh +plugins=(... cask) +``` + +Make sure you have the `cask` directory in your `$PATH` before loading Oh My Zsh, +otherwise you'll get a "command not found" error. diff --git a/oh-my-zsh/plugins/cask/cask.plugin.zsh b/oh-my-zsh/plugins/cask/cask.plugin.zsh @@ -0,0 +1,26 @@ +() { + emulate -L zsh + + if ! (( $+commands[cask] )); then + print "zsh cask plugin: cask command not found" >&2 + return + fi + + cask_base=${commands[cask]:h:h} + + # Plain cask installation location (for Cask 0.7.2 and earlier) + comp_files=($cask_base/etc/cask_completion.zsh) + + # Mac Homebrew installs the completion in a different location + if (( $+commands[brew] )); then + comp_files+=($(brew --prefix)/share/zsh/site-functions/cask_completion.zsh) + fi + + # Load first found file + for f in $comp_files; do + if [[ -f "$f" ]]; then + source "$f" + break + fi + done +} diff --git a/oh-my-zsh/plugins/catimg/catimg.plugin.zsh b/oh-my-zsh/plugins/catimg/catimg.plugin.zsh @@ -0,0 +1,17 @@ +################################################################################ +# catimg script by Eduardo San Martin Morote aka Posva # +# http://posva.net # +# # +# Ouput the content of an image to the stdout using the 256 colors of the # +# terminal. # +# Github: https://github.com/posva/catimg # +################################################################################ + + +function catimg() { + if [[ -x `which convert` ]]; then + zsh $ZSH/plugins/catimg/catimg.sh $@ + else + echo "catimg need convert (ImageMagick) to work)" + fi +} diff --git a/oh-my-zsh/plugins/catimg/catimg.sh b/oh-my-zsh/plugins/catimg/catimg.sh @@ -0,0 +1,88 @@ +################################################################################ +# catimg script by Eduardo San Martin Morote aka Posva # +# http://posva.net # +# # +# Ouput the content of an image to the stdout using the 256 colors of the # +# terminal. # +# Github: https://github.com/posva/catimg # +################################################################################ + +function help() { + echo "Usage catimg [-h] [-w width] [-c char] img" + echo "By default char is \" \" and w is the terminal width" +} + +# VARIABLES +COLOR_FILE=$(dirname $0)/colors.png +CHAR=" " + +WIDTH="" +IMG="" + +while getopts qw:c:h opt; do + case "$opt" in + w) WIDTH="$OPTARG" ;; + c) CHAR="$OPTARG" ;; + h) help; exit ;; + *) help ; exit 1;; + esac + done + +while [ "$1" ]; do + IMG="$1" + shift +done + +if [ "$IMG" = "" -o ! -f "$IMG" ]; then + help + exit 1 +fi + +if [ ! "$WIDTH" ]; then + COLS=$(expr $(tput cols) "/" $(echo -n "$CHAR" | wc -c)) +else + COLS=$(expr $WIDTH "/" $(echo -n "$CHAR" | wc -c)) +fi +WIDTH=$(convert "$IMG" -print "%w\n" /dev/null) +if [ "$WIDTH" -gt "$COLS" ]; then + WIDTH=$COLS +fi + +REMAP="" +if convert "$IMG" -resize $COLS\> +dither -remap $COLOR_FILE /dev/null ; then + REMAP="-remap $COLOR_FILE" +else + echo "The version of convert is too old, don't expect good results :(" >&2 + #convert "$IMG" -colors 256 PNG8:tmp.png + #IMG="tmp.png" +fi + +# Display the image +I=0 +convert "$IMG" -resize $COLS\> +dither `echo $REMAP` txt:- 2>/dev/null | +sed -e 's/.*none.*/NO NO NO/g' -e '1d;s/^.*(\(.*\)[,)].*$/\1/g;y/,/ /' | +while read R G B f; do + if [ ! "$R" = "NO" ]; then + if [ "$R" -eq "$G" -a "$G" -eq "$B" ]; then + (( + I++, + IDX = 232 + R * 23 / 255 + )) + else + (( + I++, + IDX = 16 + + R * 5 / 255 * 36 + + G * 5 / 255 * 6 + + B * 5 / 255 + )) + fi + #echo "$R,$G,$B: $IDX" + echo -ne "\e[48;5;${IDX}m${CHAR}" + else + (( I++ )) + echo -ne "\e[0m${CHAR}" + fi + # New lines + (( $I % $WIDTH )) || echo -e "\e[0m" +done diff --git a/oh-my-zsh/plugins/catimg/colors.png b/oh-my-zsh/plugins/catimg/colors.png Binary files differ. diff --git a/oh-my-zsh/plugins/celery/_celery b/oh-my-zsh/plugins/celery/_celery @@ -0,0 +1,129 @@ +#compdef celery +#autoload + +#celery zsh completion + +_celery () { +local -a _1st_arguments ifargs dopts controlargs + +typeset -A opt_args + +_1st_arguments=('worker' 'events' 'beat' 'shell' 'multi' 'amqp' 'status' 'inspect' \ + 'control' 'purge' 'list' 'migrate' 'call' 'result' 'report') +ifargs=('--app=' '--broker=' '--loader=' '--config=' '--version') +dopts=('--detach' '--umask=' '--gid=' '--uid=' '--pidfile=' '--logfile=' '--loglevel=') +controlargs=('--timeout' '--destination') +_arguments \ + '(-A --app=)'{-A,--app}'[app instance to use (e.g. module.attr_name):APP]' \ + '(-b --broker=)'{-b,--broker}'[url to broker. default is "amqp://guest@localhost//":BROKER]' \ + '(--loader)--loader[name of custom loader class to use.:LOADER]' \ + '(--config)--config[Name of the configuration module:CONFIG]' \ + '(--workdir)--workdir[Optional directory to change to after detaching.:WORKING_DIRECTORY]' \ + '(-q --quiet)'{-q,--quiet}'[Don"t show as much output.]' \ + '(-C --no-color)'{-C,--no-color}'[Don"t display colors.]' \ + '(--version)--version[show program"s version number and exit]' \ + '(- : *)'{-h,--help}'[show this help message and exit]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "celery subcommand" _1st_arguments + return +fi + +case "$words[1]" in + worker) + _arguments \ + '(-C --concurrency=)'{-C,--concurrency=}'[Number of child processes processing the queue. The default is the number of CPUs.]' \ + '(--pool)--pool=:::(processes eventlet gevent threads solo)' \ + '(--purge --discard)'{--discard,--purge}'[Purges all waiting tasks before the daemon is started.]' \ + '(-f --logfile=)'{-f,--logfile=}'[Path to log file. If no logfile is specified, stderr is used.]' \ + '(--loglevel=)--loglevel=:::(critical error warning info debug)' \ + '(-N --hostname=)'{-N,--hostname=}'[Set custom hostname, e.g. "foo.example.com".]' \ + '(-B --beat)'{-B,--beat}'[Also run the celerybeat periodic task scheduler.]' \ + '(-s --schedule=)'{-s,--schedule=}'[Path to the schedule database if running with the -B option. Defaults to celerybeat-schedule.]' \ + '(-S --statedb=)'{-S,--statedb=}'[Path to the state database.Default: None]' \ + '(-E --events)'{-E,--events}'[Send events that can be captured by monitors like celeryev, celerymon, and others.]' \ + '(--time-limit=)--time-limit=[nables a hard time limit (in seconds int/float) for tasks]' \ + '(--soft-time-limit=)--soft-time-limit=[Enables a soft time limit (in seconds int/float) for tasks]' \ + '(--maxtasksperchild=)--maxtasksperchild=[Maximum number of tasks a pool worker can execute before it"s terminated and replaced by a new worker.]' \ + '(-Q --queues=)'{-Q,--queues=}'[List of queues to enable for this worker, separated by comma. By default all configured queues are enabled.]' \ + '(-I --include=)'{-I,--include=}'[Comma separated list of additional modules to import.]' \ + '(--pidfile=)--pidfile=[Optional file used to store the process pid.]' \ + '(--autoscale=)--autoscale=[Enable autoscaling by providing max_concurrency, min_concurrency.]' \ + '(--autoreload)--autoreload[Enable autoreloading.]' \ + '(--no-execv)--no-execv[Don"t do execv after multiprocessing child fork.]' + compadd -a ifargs + ;; + inspect) + _values -s \ + 'active[dump active tasks (being processed)]' \ + 'active_queues[dump queues being consumed from]' \ + 'ping[ping worker(s)]' \ + 'registered[dump of registered tasks]' \ + 'report[get bugreport info]' \ + 'reserved[dump reserved tasks (waiting to be processed)]' \ + 'revoked[dump of revoked task ids]' \ + 'scheduled[dump scheduled tasks (eta/countdown/retry)]' \ + 'stats[dump worker statistics]' + compadd -a controlargs ifargs + ;; + control) + _values -s \ + 'add_consumer[tell worker(s) to start consuming a queue]' \ + 'autoscale[change autoscale settings]' \ + 'cancel_consumer[tell worker(s) to stop consuming a queue]' \ + 'disable_events[tell worker(s) to disable events]' \ + 'enable_events[tell worker(s) to enable events]' \ + 'pool_grow[start more pool processes]' \ + 'pool_shrink[use less pool processes]' \ + 'rate_limit[tell worker(s) to modify the rate limit for a task type]' \ + 'time_limit[tell worker(s) to modify the time limit for a task type.]' + compadd -a controlargs ifargs + ;; + multi) + _values -s \ + '--nosplash[Don"t display program info.]' \ + '--verbose[Show more output.]' \ + '--no-color[Don"t display colors.]' \ + '--quiet[Don"t show as much output.]' \ + 'start' 'restart' 'stopwait' 'stop' 'show' \ + 'names' 'expand' 'get' 'kill' + compadd -a ifargs + ;; + amqp) + _values -s \ + 'queue.declare' 'queue.purge' 'exchange.delete' 'basic.publish' \ + 'exchange.declare' 'queue.delete' 'queue.bind' 'basic.get' + ;; + list) + _values -s, 'bindings' + ;; + shell) + _values -s \ + '--ipython[force iPython.]' \ + '--bpython[force bpython.]' \ + '--python[force default Python shell.]' \ + '--without-tasks[don"t add tasks to locals.]' \ + '--eventlet[use eventlet.]' \ + '--gevent[use gevent.]' + compadd -a ifargs + ;; + beat) + _arguments \ + '(-s --schedule=)'{-s,--schedule=}'[Path to the schedule database. Defaults to celerybeat-schedule.]' \ + '(-S --scheduler=)'{-S,--scheduler=}'[Scheduler class to use. Default is celery.beat.PersistentScheduler.]' \ + '(--max-interval)--max-interval[]' + compadd -a dopts fargs + ;; + events) + _arguments \ + '(-d --dump)'{-d,--dump}'[Dump events to stdout.]' \ + '(-c --camera=)'{-c,--camera=}'[Take snapshots of events using this camera.]' \ + '(-F --frequency=)'{-F,--frequency=}'[Camera: Shutter frequency. Default is every 1.0 seconds.]' \ + '(-r --maxrate=)'{-r,--maxrate=}'[Camera: Optional shutter rate limit (e.g. 10/m).]' + compadd -a dopts fargs + ;; + *) + ;; + esac +} diff --git a/oh-my-zsh/plugins/chruby/chruby.plugin.zsh b/oh-my-zsh/plugins/chruby/chruby.plugin.zsh @@ -0,0 +1,115 @@ +# +# INSTRUCTIONS +# +# With either a manual or brew installed chruby things should just work. +# +# If you'd prefer to specify an explicit path to load chruby from +# you can set variables like so: +# +# zstyle :omz:plugins:chruby path /local/path/to/chruby.sh +# zstyle :omz:plugins:chruby auto /local/path/to/auto.sh +# +# TODO +# - autodetermine correct source path on non OS X systems +# - completion if ruby-install exists + +# rvm and rbenv plugins also provide this alias +alias rubies='chruby' + + +_homebrew-installed() { + whence brew &> /dev/null + _xit=$? + if [ $_xit -eq 0 ];then + # ok , we have brew installed + # speculatively we check default brew prefix + if [ -h /usr/local/opt/chruby ];then + _brew_prefix="/usr/local/opt/chruby" + else + # ok , it is not default prefix + # this call to brew is expensive ( about 400 ms ), so at least let's make it only once + _brew_prefix=$(brew --prefix chruby) + fi + return 0 + else + return $_xit + fi +} + +_chruby-from-homebrew-installed() { + [ -r _brew_prefix ] &> /dev/null +} + +_ruby-build_installed() { + whence ruby-build &> /dev/null +} + +_ruby-install-installed() { + whence ruby-install &> /dev/null +} + +# Simple definition completer for ruby-build +if _ruby-build_installed; then + _ruby-build() { compadd $(ruby-build --definitions) } + compdef _ruby-build ruby-build +fi + +_source_from_omz_settings() { + local _chruby_path + local _chruby_auto + + zstyle -s :omz:plugins:chruby path _chruby_path + zstyle -s :omz:plugins:chruby auto _chruby_auto + + if [[ -r ${_chruby_path} ]]; then + source ${_chruby_path} + fi + + if [[ -r ${_chruby_auto} ]]; then + source ${_chruby_auto} + fi +} + +_chruby_dirs() { + chrubydirs=($HOME/.rubies/ $PREFIX/opt/rubies) + for dir in chrubydirs; do + if [[ -d $dir ]]; then + RUBIES+=$dir + fi + done +} + +if _homebrew-installed && _chruby-from-homebrew-installed ; then + source $_brew_prefix/share/chruby/chruby.sh + source $_brew_prefix/share/chruby/auto.sh + _chruby_dirs +elif [[ -r "/usr/local/share/chruby/chruby.sh" ]] ; then + source /usr/local/share/chruby/chruby.sh + source /usr/local/share/chruby/auto.sh + _chruby_dirs +else + _source_from_omz_settings + _chruby_dirs +fi + +function ensure_chruby() { + $(whence chruby) +} + +function current_ruby() { + local _ruby + _ruby="$(chruby |grep \* |tr -d '* ')" + if [[ $(chruby |grep -c \*) -eq 1 ]]; then + echo ${_ruby} + else + echo "system" + fi +} + +function chruby_prompt_info() { + echo "$(current_ruby)" +} + +# complete on installed rubies +_chruby() { compadd $(chruby | tr -d '* ') } +compdef _chruby chruby diff --git a/oh-my-zsh/plugins/chucknorris/.gitignore b/oh-my-zsh/plugins/chucknorris/.gitignore @@ -0,0 +1 @@ +fortunes/chucknorris.dat diff --git a/oh-my-zsh/plugins/chucknorris/LICENSE b/oh-my-zsh/plugins/chucknorris/LICENSE @@ -0,0 +1,2 @@ +License: GPL v2 +Thanks to http://www.k-lug.org/~kessler/projects.html for the fortune file. diff --git a/oh-my-zsh/plugins/chucknorris/chucknorris.plugin.zsh b/oh-my-zsh/plugins/chucknorris/chucknorris.plugin.zsh @@ -0,0 +1,28 @@ +# chucknorris: Chuck Norris fortunes + +# Automatically generate or update Chuck's compiled fortune data file +# $0 must be used outside a local function. This variable name is unlikly to collide. +CHUCKNORRIS_PLUGIN_DIR=${0:h} + +() { +local DIR=$CHUCKNORRIS_PLUGIN_DIR/fortunes +if [[ ! -f $DIR/chucknorris.dat ]] || [[ $DIR/chucknorris.dat -ot $DIR/chucknorris ]]; then + # For some reason, Cygwin puts strfile in /usr/sbin, which is not on the path by default + local strfile=strfile + if ! which strfile &>/dev/null && [[ -f /usr/sbin/strfile ]]; then + strfile=/usr/sbin/strfile + fi + if which $strfile &> /dev/null; then + $strfile $DIR/chucknorris $DIR/chucknorris.dat >/dev/null + else + echo "[oh-my-zsh] chucknorris depends on strfile, which is not installed" >&2 + echo "[oh-my-zsh] strfile is often provided as part of the 'fortune' package" >&2 + fi +fi + +# Aliases +alias chuck="fortune -a $DIR" +alias chuck_cow="chuck | cowthink" +} + +unset CHUCKNORRIS_PLUGIN_DIR diff --git a/oh-my-zsh/plugins/chucknorris/fortunes/chucknorris b/oh-my-zsh/plugins/chucknorris/fortunes/chucknorris @@ -0,0 +1,907 @@ +Chuck Norris' tears cure cancer. Too bad he has never cried. Ever. +% +Chuck Norris does not sleep. He waits. +% +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. +% +The chief export of Chuck Norris is pain. +% +If you can see Chuck Norris, he can see you. If you can't see Chuck Norris, you may be only seconds away from death. +% +Chuck Norris has counted to infinity. Twice. +% +Chuck Norris does not hunt because the word hunting implies the probability of failure. Chuck Norris goes killing. +% +Chuck Norris' blood type is AK+. Ass-Kicking Positive. It is compatible only with heavy construction equipment, tanks, and fighter jets. +% +Chuck Norris is 1/8th Cherokee. This has nothing to do with ancestry, the man ate a fucking Indian. +% +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. +% +There is no chin behind Chuck Norris' beard. There is only another fist. +% +Chuck Norris does not teabag the ladies. He potato-sacks them. +% +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. +% +When Chuck Norris goes to donate blood, he declines the syringe, and instead requests a hand gun and a bucket. +% +There are no steroids in baseball. Just players Chuck Norris has breathed on. +% +Chuck Norris once challenged Lance Armstrong in a "Who has more testicles?" contest. Chuck Norris won by 5. +% +Chuck Norris was the fourth wise man, who gave baby Jesus the gift of beard, which he carried with him until he died. The other three wise men were enraged by the preference that Jesus showed to Chuck's gift, and arranged to have him written out of the bible. All three died soon after of mysterious roundhouse-kick related injuries. +% +Chuck Norris sheds his skin twice a year. +% +When Chuck Norris calls 1-900 numbers, he doesnt get charged. He holds up the phone and money falls out. +% +Chuck Norris once ate a whole cake before his friends could tell him there was a stripper in it. +% +Some people like to eat frogs' legs. Chuck Norris likes to eat lizard legs. Hence, snakes. +% +There are no races, only countries of people Chuck Norris has beaten to different shades of black and blue. +% +When Chuck Norris was denied an Egg McMuffin at McDonald's because it was 10:35, he roundhouse kicked the store so hard it became a Wendy's. +% +Chuck Norris can't finish a "color by numbers" because his markers are filled with the blood of his victims. Unfortunately, all blood is dark red. +% +A Chuck Norris-delivered Roundhouse Kick is the preferred method of execution in 16 states. +% +When Chuck Norris falls in water, Chuck Norris doesn't get wet. Water gets Chuck Norris. +% +Scientists have estimated that the energy given off during the Big Bang is roughly equal to 1CNRhK (Chuck Norris Roundhouse Kick) +% +Chuck Norris' house has no doors, only walls that he walks through. +% +When Chuck Norris has sex with a man, it won't be because he is gay. It will be because he has run out of women. +% +How much wood would a woodchuck chuck if a woodchuck could Chuck Norris? ...All of it. +% +Chuck Norris doesn't actually write books, the words assemble themselves out of fear. +% +In honor of Chuck Norris, all McDonald's in Texas have an even larger size than the super-size. When ordering, just ask to be "Norrisized". +% +Chuck Norris CAN believe it's not butter. +% +If tapped, a Chuck Norris roundhouse kick could power the country of Australia for 44 minutes. +% +Chuck Norris can divide by zero. +% +The grass is always greener on the other side, unless Chuck Norris has been there. In that case the grass is most likely soaked in blood and tears. +% +A picture is worth a thousand words. A Chuck Norris is worth 1 billion words. +% +Newton's Third Law is wrong: Although it states that for each action, there is an equal and opposite reaction, there is no force equal in reaction to a Chuck Norris roundhouse kick. +% +Chuck Norris invented his own type of karate. It's called Chuck-Will-Kill. +% +When an episode of Walker Texas Ranger was aired in France, the French surrendered to Chuck Norris just to be on the safe side. +% +While urinating, Chuck Norris is easily capable of welding titanium. +% +Chuck Norris once sued the Houghton-Mifflin textbook company when it became apparent that their account of the war of 1812 was plagiarized from his autobiography. +% +When Chuck Norris talks, everybody listens. And dies. +% +When Steven Seagal kills a ninja, he only takes its hide. When Chuck Norris kills a ninja, he uses every part. +% +Wilt Chamberlain claims to have slept with more than 20,000 women in his lifetime. Chuck Norris calls this "a slow Tuesday." +% +Contrary to popular belief, there is indeed enough Chuck Norris to go around. +% +Chuck Norris doesnt shave; he kicks himself in the face. The only thing that can cut Chuck Norris is Chuck Norris. +% +For some, the left testicle is larger than the right one. For Chuck Norris, each testicle is larger than the other one. +% +Chuck Norris always knows the EXACT location of Carmen SanDiego. +% +When taking the SAT, write "Chuck Norris" for every answer. You will score over 8000. +% +Chuck Norris invented black. In fact, he invented the entire spectrum of visible light. Except pink. Tom Cruise invented pink. +% +When you're Chuck Norris, anything + anything is equal to 1. One roundhouse kick to the face. +% +Chuck Norris has the greatest Poker-Face of all time. He won the 1983 World Series of Poker, despite holding only a Joker, a Get out of Jail Free Monopoloy card, a 2 of clubs, 7 of spades and a green #4 card from the game UNO. +% +On his birthday, Chuck Norris randomly selects one lucky child to be thrown into the sun. +% +Nobody doesn't like Sara Lee. Except Chuck Norris. +% +Chuck Norris doesn't throw up if he drinks too much. Chuck Norris throws down! +% +In the beginning there was nothing...then Chuck Norris Roundhouse kicked that nothing in the face and said "Get a job". That is the story of the universe. +% +Chuck Norris has 12 moons. One of those moons is the Earth. +% +Chuck Norris grinds his coffee with his teeth and boils the water with his own rage. +% +Archeologists unearthed an old english dictionary dating back to the year 1236. It defined "victim" as "one who has encountered Chuck Norris" +% +Chuck Norris ordered a Big Mac at Burger King, and got one. +% +Chuck Norris and Mr. T walked into a bar. The bar was instantly destroyed, as that level of awesome cannot be contained in one building. +% +If you Google search "Chuck Norris getting his ass kicked" you will generate zero results. It just doesn't happen. +% +Chuck Norris can drink an entire gallon of milk in thirty-seven seconds. +% +Little known medical fact: Chuck Norris invented the Caesarean section when he roundhouse-kicked his way out of his monther's womb. +% +Chuck Norris doesn't bowl strikes, he just knocks down one pin and the other nine faint. +% +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. +% +It takes Chuck Norris 20 minutes to watch 60 Minutes. +% +You know how they say if you die in your dream then you will die in real life? In actuality, if you dream of death then Chuck Norris will find you and kill you. +% +Chuck Norris has a deep and abiding respect for human life... unless it gets in his way. +% +The Bermuda Triangle used to be the Bermuda Square, until Chuck Norris Roundhouse kicked one of the corners off. +% +There are no weapons of mass destruction in Iraq, Chuck Norris lives in Oklahoma. +% +Chuck Norris doesn't believe in Germany. +% +When Chuck Norris is in a crowded area, he doesn't walk around people. He walks through them. +% +Chuck Norris once ate an entire bottle of sleeping pills. They made him blink. +% +James Cameron wanted Chuck Norris to play the Terminator. However, upon reflection, he realized that would have turned his movie into a documentary, so he went with Arnold Schwarzenegger. +% +Chuck Norris can touch MC Hammer. +% +Thousands of years ago Chuck Norris came across a bear. It was so terrified that it fled north into the arctic. It was also so terrified that all of its decendents now have white hair. +% +Chuck Norris played Russian Roulette with a fully loaded gun and won. +% +It takes 14 puppeteers to make Chuck Norris smile, but only 2 to make him destroy an orphanage. +% +Chuck Norris is responsible for China's over-population. He hosted a Karate tournament in Beijing and all women within 1,000 miles became pregnant instantly. +% +Some people wear Superman pajamas. Superman wears Chuck Norris pajamas. +% +Chuck Norris once worked as a weatherman for the San Diego evening news. Every night he would make the same forecast: Partly cloudy with a 75% chance of Pain. +% +Simply by pulling on both ends, Chuck Norris can stretch diamonds back into coal. +% +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. +% +Chuck Norris invented the bolt-action rifle, liquor, sexual intercourse, and football-- in that order. +% +A high tide means Chuck Norris is flying over your coast. The tide is caused by God pissing his pants. +% +Chuck Norris keeps his friends close and his enemies closer. Close enough to drop them with one round house kick to the face. +% +There is in fact an "I" in Norris, but there is no "team"? not even close. +% +Scotty in Star Trek often says "Ye cannae change the laws of physics." This is untrue. Chuck Norris can change the laws of physics. With his fists. +% +An anagram for Walker Texas Ranger is KARATE WRANGLER SEX. I don't know what that is, but it sounds AWESOME. +% +Chuck Norris doesn't stub his toes. He accidentally destroys chairs, bedframes, and sidewalks. +% +Using his trademark roundhouse kick, Chuck Norris once made a fieldgoal in RJ Stadium in Tampa Bay from the 50 yard line of Qualcomm stadium in San Diego. +% +Chuck Norris roundhouse kicks don't really kill people. They wipe out their entire existence from the space-time continuum. +% +Chuck Norris does not own a stove, oven, or microwave , because revenge is a dish best served cold. +% +Tom Clancy has to pay royalties to Chuck Norris because "The Sum of All Fears" is the name of Chuck Norris' autobiography. +% +Chuck Norris can slam a revolving door. +% +Chuck Norris is expected to win gold in every swimming competition at the 2008 Beijing Olympics, even though Chuck Norris does not swim. This is because when Chuck Norris enters the water, the water gets out of his way and Chuck Norris simply walks across the pool floor. +% +Chuck Norris built a better mousetrap, but the world was too frightened to beat a path to his door. +% +The original draft of The Lord of the Rings featured Chuck Norris instead of Frodo Baggins. It was only 5 pages long, as Chuck roundhouse-kicked Sauron's ass halfway through the first chapter. +% +Hellen Keller's favorite color is Chuck Norris. +% +Chuck Norris eats beef jerky and craps gunpowder. Then, he uses that gunpowder to make a bullet, which he uses to kill a cow and make more beef jerky. Some people refer to this as the "Circle of Life." +% +If, by some incredible space-time paradox, Chuck Norris would ever fight himself, he'd win. Period. +% +Chuck Norris is currently suing myspace for taking the name of what he calls everything around you. +% +The crossing lights in Chuck Norris's home town say "Die slowly" and "die quickly". They each have a picture of Chuck Norris punching or kicking a pedestrian. +% +Science Fact: Roundhouse kicks are comprised primarily of an element called Chucktanium. +% +The Sherman tank was originaly called the Norris tank until Chuck Norris decided it wasn't tough enough to be associated with him. The Army, for fear of Chuck Norris, renamed the tank and promised to develop a weapon more fitting of his name. To date, no weapon created has been badass enough to be named after Chuck Norris. +% +Chuck Norris proved that we are alone in the universe. We weren't before his first space expedition. +% +Superman once watched an episode of Walker, Texas Ranger. He then cried himself to sleep. +% +Chuck Norris doesn't step on toes. Chuck Norris steps on necks. +% +The movie "Delta Force" was extremely hard to make because Chuck had to downplay his abilities. The first few cuts were completely unbelievable. +% +Movie trivia: The movie "Invasion U.S.A." is, in fact, a documentary. +% +Chuck Norris does not "style" his hair. It lays perfectly in place out of sheer terror. +% +There is no such thing as global warming. Chuck Norris was cold, so he turned the sun up. +% +A study showed the leading causes of death in the United States are: +1:Heart disease +2:Chuck Norris +3:Cancer +% +It's widely believed that Jesus was Chuck Norris' stunt double for crucifixion due to the fact that it is impossible for nails to pierce Chuck Norris' skin. +% +Chuck Norris did in fact, build Rome in a day. +% +Along with his black belt, Chuck Norris often chooses to wear brown shoes. No one has DARED call him on it. Ever. +% +Anytime someone is elected president in the United States, they must ask permission from Chuck Norris to live in the White House. The reason for this is because Chuck Norris had won every Federal, State, and Local election since 1777. He just allows others to run the country in his place. +% +Once you go Norris, you are physically unable to go back. +% +Ninjas want to grow up to be just like Chuck Norris. But usually they grow up just to be killed by Chuck Norris. +% +Chuck Norris once sued Burger King after they refused to put razor wire in his Whopper Jr, insisting that that actually is "his" way. +% +The last thing you hear before Chuck Norris gives you a roundhouse kick? No one knows because dead men tell no tales. +% +Chuck Norris doesn't play god. Playing is for children. +% +As a teen, Chuck Norris had sex with every nun in a convent tucked away in the hills of Tuscany. Nine months later the nuns gave birth to the 1972 Miami Dolphins, the only undefeated and untied team in professional football history. +% +Chuck Norris is the only person in the world that can actually email a roundhouse kick. +% +Chuck Norris won super bowls VII and VIII singlehandedly before unexpectedly retiring to pursue a career in ass-kicking. +% +Wo hu cang long. The translation from Mandarin Chinese reads: "Crouching Chuck, Hidden Norris" +% +Chuck Norris can set ants on fire with a magnifying glass. At night. +% +Some kids play Kick the can. Chuck Norris played Kick the keg. +% +'Icy-Hot' is too weak for Chuck Norris. After a workout, Chuck Norris rubs his muscles down with liquid-hot MAGMA. +% +Chuck Norris cannot love, he can only not kill. +% +When Chuck Norris was a baby, he didn't suck his mother's breast. His mother served him whiskey, straight out of the bottle. +% +According to Einstein's theory of relativity, Chuck Norris can actually roundhouse kick you yesterday. +% +Chuck Norris once pulled out a single hair from his beard and skewered three men through the heart with it. +% +In an act of great philanthropy, Chuck made a generous donation to the American Cancer Society. He donated 6,000 dead bodies for scientific research. +% +Chuck Norris' favourite cut of meat is the roundhouse. +% +When J. Robert Oppenheimer said "I am become death, the destroyer Of worlds", He was not referring to the atomic bomb. He was referring to the Chuck Norris halloween costume he was wearing. +% +Chuck Norris recently had the idea to sell his urine as a canned beverage. We know this beverage as Red Bull. +% +In a recent survey it was discovered the 94% of American women lost their virginity to Chuck Norris. The other 6% were incredibly fat or ugly. +% +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. +% +If at first you don't succeed, you're not Chuck Norris. +% +If Chuck Norris were a calendar, every month would be named Chucktober, and every day he'd kick your ass. +% +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." +Too late, asshole. +% +Chuck Norris's show is called Walker: Texas Ranger, because Chuck Norris doesn't run. +% +MacGyver can build an airplane out of gum and paper clips, but Chuck Norris can roundhouse-kick his head through a wall and take it. +% +Behind every successful man, there is a woman. Behind every dead man, there is Chuck Norris. +% +What's known as the UFC, or Ultimate Fighting Championship, doesn't use its full name, which happens to be "Ultimate Fighting Championship, Non-Chuck-Norris-Division". +% +Chuck Norris brushes his teeth with a mixture of iron shavings, industrial paint remover, and wood-grain alcohol. +% +The easiest way to determine Chuck Norris' age is to cut him in half and count the rings. +% +There is endless debate about the existence of the human soul. Well it does exist, and Chuck Norris finds it delicious. +% +Most boots are made for walkin'. Chuck Norris' boots ain't that merciful. +% +The US did not boycott the 1980 Summer Olympics in Moscow due to political reasons: Chuck Norris killed the entire US team with a single round-house kick during TaeKwonDo practice. +% +Chuck Norris wears a live rattlesnake as a condom. +% +When the movie Pulp Fiction was filmed they had to borrow Chuck Norris's wallet... It's the one that says "Bad Mother Fucker" on it +% +The Bible was originally titled "Chuck Norris and Friends" +% +Chuck Norris began selling the Total Gym as an ill-fated attempt to make his day-to-day opponents less laughably pathetic. +% +Do you know why Baskin Robbins only has 31 flavors? Because Chuck Norris doesn't like Fudge Ripple. +% +When Chuck Norris says "More cowbell", he fucking MEANS it. +% +On the set of Walker Texas Ranger Chuck Norris brought a dying lamb back to life by nuzzling it with his beard. As the onlookers gathered, the lamb sprang to life. Chuck Norris then roundhouse kicked it, killing it instantly. This was just to prove that the good Chuck giveth, and the good Chuck, he taketh away. +% +Chuck Norris was what Willis was talkin' about. +% +Google won't search for Chuck Norris because it knows you don't find Chuck Norris, he finds you. +% +Chuck Norris can lead a horse to water AND make it drink. +% +Nagasaki never had a bomb dropped on it. Chuck Norris jumped out of a plane and punched the ground. +% +It is scientifically impossible for Chuck Norris to have had a mortal father. The most popular theory is that he went back in time and fathered himself. +% +Chuck Norris destroyed the periodic table, because Chuck Norris only recognizes the element of surprise. +% +It is believed dinosaurs are extinct due to a giant meteor. That's true if you want to call Chuck Norris a giant meteor. +% +Chuck Norris shot the sheriff, but he round house kicked the deputy. +% +That's not Chuck Norris doing push-ups -- that's Chuck Norris moving the Earth away from the path of a deadly asteroid. +% +Chuck Norris can judge a book by its cover. +% +Nothing can escape the gravity of a black hole, except for Chuck Norris. Chuck Norris eats black holes. They taste like chicken. +% +Chuck Norris does not play the lottery. It doesn't have nearly enough balls. +% +Q: How many Chuck Norris' does it take to change a light bulb? +A: None, Chuck Norris prefers to kill in the dark. +% +As President Roosevelt said: "We have nothing to fear but fear itself. And Chuck Norris." +% +Chuck Norris just says "no" to drugs. If he said "yes", it would collapse Colombia's infrastructure. +% +Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent.? +% +Crime does not pay - unless you are an undertaker following Walker, Texas Ranger, on a routine patrol. +% +Chuck Norris invented the internet? just so he had a place to store his porn. +% +Chuck Norris does not own a house. He walks into random houses and people move. +% +It is better to give than to receive. This is especially true of a Chuck Norris roundhouse kick. +% +Chuck Norris is the only person to ever win a staring contest against Ray Charles and Stevie Wonder at the same time. +% +Industrial logging isn't the cause of deforestation. Chuck Norris needs toothpicks. +% +Chuck Norris smells what the Rock is cooking... because the Rock is Chuck Norris' personal chef. +% +When Chuck Norris plays Oregon Trail, his family does not die from cholera or dysentery, but rather, roundhouse kicks to the face. He also requires no wagon, since he carries the oxen, axels, and buffalo meat on his back. He always makes it to Oregon before you. +% +Chuck Norris is the reason why Waldo is hiding. +% +"Brokeback Mountain" is not just a movie. It's also what Chuck Norris calls the pile of dead ninjas in his front yard. +% +When God said, "let there be light", Chuck Norris said, "say 'please'." +% +Chuck Norris does not eat. Food understands that the only safe haven from Chuck Norris' fists is inside his own body. +% +One day Chuck Norris walked down the street with a massive erection. There were no survivors. +% +Chuck Norris built a time machine and went back in time to stop the JFK assassination. As Oswald shot, Chuck met all three bullets with his beard, deflecting them. JFK's head exploded out of sheer amazement. +% +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. +% +Chuck Norris uses a night light. Not because Chuck Norris is afraid of the dark, but the dark is afraid of Chuck Norris. +% +Chuck Norris is not capable of hitting a target on the broad side of a barn. Every time he tries, the whole damn barn falls down. +% +Before each filming of Walker: Texas Ranger, Chuck Norris is injected with fourteen times the lethal dose of elephant tranquilzer. This is, of course, to limit his strength and mobility, in an attempt to lower the fatality rate of the actors he fights. +% +When Bruce Banner gets mad, he turns into the Hulk. When the Hulk gets mad, he turns into Chuck Norris. +% +Chuck Norris kills anyone that asks, "You want fries with that" because by now everyone should know that Chuck doesn't ever want fries with anything. Ever. +% +Chuck Norris once kicked a horse in the chin. Its decendants are known today as Giraffes. +% +Sticks and stones may break your bones, but a Chuck Norris glare will liquefy your kidneys. +% +Human cloning is outlawed because if Chuck Norris were cloned, then it would be possible for a Chuck Norris roundhouse kick to meet another chuck Norris roundhouse kick. Physicists theorize that this contact would end the universe. +% +Chuck Norris once went skydiving, but promised never to do it again. One Grand Canyon is enough. +% +Chuck Norris's version of a "chocolate milkshake" is a raw porterhouse wrapped around ten Hershey bars, and doused in diesel fuel. +% +If Chuck Norris round-house kicks you, you will die. If Chuck Norris' misses you with the round-house kick, the wind behind the kick will tear out your pancreas. +% +In a fight between Batman and Darth Vader, the winner would be Chuck Norris. +% +Chuck Norris puts his pants on one leg at a time, just like the rest of us. The only difference is, then he fucking kills people. +% +Everybody loves Raymond. Except Chuck Norris. +% +Contrary to popular belief, the Titanic didn't hit an iceberg. The ship was off course and accidentally ran into Chuck Norris while he was doing the backstroke across the Atlantic. +% +Chuck Norris got his drivers license at the age of 16. Seconds. +% +The original title for Alien vs. Predator was Alien and Predator vs Chuck Norris. The film was cancelled shortly after going into preproduction. No one would pay nine dollars to see a movie fourteen seconds long. +% +Chuck Norris' sperm is so badass, he had sex with Nicole Kidman, and 7 months later she prematurely gave birth to a Ford Excursion. +% +Chuck Norris can win at solitaire with only 18 cards. +% +Chuck Norris once shat blood - the blood of 11,940 natives he had killed and eaten. +% +Maslow's theory of higher needs does not apply to Chuck Norris. He only has two needs: killing people and finding people to kill. +% +The truth will set you free. Unless Chuck Norris has you, in which case, forget it buddy! +% +For most people, home is where the heart is. For Chuck Norris, home is where he stores his collection of human skulls. +% +Kryptonite has been found to contain trace elements of Chuck Norris roundhouse kicks to the face. This is why it is so deadly to Superman. +% +Saddam Hussein was not found hiding in a "hole." Saddam was roundhouse-kicked in the head by Chuck Norris in Kansas, which sent him through the earth, stopping just short of the surface of Iraq. +% +Coroners refer to dead people as "ABC's". Already Been Chucked. +% +Chuck Norris doesn't look both ways before he crosses the street... he just roundhouses any cars that get too close. +% +Chuck Norris does not have to answer the phone. His beard picks up the incoming electrical impulses and translates them into audible sound. +% +How many roundhouse kicks does it take to get to the center of a tootsie pop? Just one. From Chuck Norris. +% +Chuck Norris doesnt wear a watch, HE decides what time it is. +% +The phrase 'break a leg' was originally coined by Chuck Norris's co-stars in Walker, Texas Ranger as a good luck charm, indicating that a broken leg might be the worst extent of their injuries. This never proved to be the case. +% +When chuck Norris does division, there are no remainders. +% +If you rearrange the letters in "Chuck Norris", they also spell "Crush Rock In". The words "with his fists" are understood. +% +Never look a gift Chuck Norris in the mouth, because he will bite your damn eyes off. +% +Give a man a fish, and you will feed him for a day. Give a man anything that is better than a fish, and Chuck Norris will beat his ass and take it. +% +Chuck Norris used to play baseball. When Babe Ruth was hailed as the better player, Chuck Norris killed him with a baseball bat to the throat. Lou Gehrig got off easy. +% +The original title for Star Wars was "Skywalker: Texas Ranger". Starring Chuck Norris. +% +Guantuanamo Bay, Cuba, is the military code-word for "Chuck Norris' basement". +% +The phrase 'balls to the wall' was originally conceived to describe Chuck Norris entering any building smaller than an aircraft hangar. +% +Chuck Norris' roundhouse kick is so powerful, it can be seen from outer space by the naked eye. +% +Ozzy Osbourne bites the heads off of bats. Chuck Norris bites the heads off of Siberian Tigers. +% +He who lives by the sword, dies by the sword. He who lives by Chuck Norris, dies by the roundhouse kick. +% +The best-laid plans of mice and men often go awry. Even the worst-laid plans of Chuck Norris come off without a hitch. +% +The phrase 'dead ringer' refers to someone who sits behind Chuck Norris in a movie theater and forgets to turn their cell phone off. +% +Chuck Norris' Roundhouse kick is so powerful, that on the set of Sidekicks he single-footedly destroyed Jonathan Brandis' Career. +% +Staring at Chuck Norris for extended periods of time without proper eye protection will cause blindess, and possibly foot sized brusies on the face. +% +Chuck Norris can taste lies. +% +Chuck Norris does not kick ass and take names. In fact, Chuck Norris kicks ass and assigns the corpse a number. It is currently recorded to be in the billions. +% +One time, Chuck Norris accidentally stubbed his toe. It destroyed the entire state of Ohio. +% +Little Miss Muffet sat on her tuffet, until Chuck Norris roundhouse kicked her into a glacier. +% +In 1990, Chuck Norris founded the non-profit organization "Kick Drugs Out of America". If the organization's name were "Roundhouse Kick Drugs out of America", there wouldn't be any drugs in the Western Hemisphere. Anywhere. +% +Chuck Norris can blow bubbles with beef jerky. +% +They had to edit the first ending of 'Lone Wolf McQuade' after Chuck Norris kicked David Carradine's ass, then proceeded to barbecue and eat him. +% +Chuck Norris does, in fact, live in a round house. +% +Chuck Norris was once on Jeopardy. This show is notable in that it was the first occasion in Jeopardy history that Alex Trebek had appeared without a mustache. And a head. +% +When Chuck Norris works out on the Total Gym, the Total Gym feels like it's been raped. +% +4 out of 5 doctors fail to recommend Chuck Norris as a solution to most problems. Also, 80% of doctors die unexplained, needlessly brutal deaths. +% +Chuck Norris can skeletize a cow in two minutes. +% +The only sure things are Death and Taxes, and when Chuck Norris goes to work for the IRS, they'll be the same thing. +% +Chuck Norris' first job was as a paperboy. There were no survivors. +% +With the rising cost of gasoline, Chuck Norris is beginning to worry about his drinking habit. +% +The square root of Chuck Norris is pain. Do not try to square Chuck Norris, the result is death. +% +Chuck Norris' testicles do not produce sperm. They produce tiny white ninjas that recognize only one mission: seek and destroy. +% +To be or not to be? That is the question. The answer? Chuck Norris. +% +Chuck Norris has never been in a fight, ever. Do you call one roundhouse kick to the face a fight? +% +There are two types of people in the world... people that suck, and Chuck Norris. +% +Chuck Norris never wet his bed as a child. The bed wet itself out of fear. +% +If you were somehow able to land a punch on Chuck Norris your entire arm would shatter upon impact. This is only in theory, since, come on, who in their right mind would try this? +% +70% of a human's weight is water. 70% of Chuck Norris' weight is his dick. +% +Jean-Claude Van Damme once kicked Chuck Norris' ass. He was then awakened from his dream by a roundhouse kick to the face. +% +The pie scene in "American Pie" is based on a dare Chuck Norris took when he was younger. However, in Chuck Norris' case, the "pie" was the molten crater of an active volcano. +% +Chuck Norris uses 8'x10' sheets of plywood as toilet paper. +% +Noah was the only man notified before Chuck Norris relieved himself in the Atlantic Ocean. +% +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. +% +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. +% +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. +% +Chuck Norris eats steak for every single meal. Most times he forgets to kill the cow. +% +The First Law of Thermodynamics states that energy can neither be created nor destroyed... unless it meets Chuck Norris. +% +Chuck Norris doesn't go on the internet, he has every internet site stored in his memory. He refreshes webpages by blinking. +% +Fact: Chuck Norris doesn't consider it sex if the woman survives. +% +It is said that looking into Chuck Norris' eyes will reveal your future. Unfortunately, everybody's future is always the same: death by a roundhouse-kick to the face. +% +Chuck Norris knows everything there is to know - Except for the definition of mercy. +% +Scientifically speaking, it is impossible to charge Chuck Norris with "obstruction of justice." This is because even Chuck Norris cannot be in two places at the same time. +% +Chuck Norris never has to wax his skis because they're always slick with blood. +% +When you say "no one's perfect", Chuck Norris takes this as a personal insult. +% +Chuck Norris can win a game of Trivial Pursuit with one roll of the dice, and without answering a single question... just a nod of the head, and a stroke of the beard. +% +182,000 Americans die from Chuck Norris-related accidents every year. +% +Paper beats rock, rock beats scissors, and scissors beats paper, but Chuck Norris beats all 3 at the same time. +% +Jesus can walk on water, but Chuck Norris can walk on Jesus. +% +All roads lead to Chuck Norris. And by the transitive property, a roundhouse kick to the face. +% +If you're driving down the road and you think Chuck Norris just cut you off, you better thank your lucky stars it wasn't the other way around. +% +July 4th is Independence day. And the day Chuck Norris was born. Coincidence? i think not. +% +Chuck Norris never goes to the dentist because his teeth are unbreakable. His enemies never go to the dentist because they have no teeth. +% +In the medical community, death is referred to as "Chuck Norris Disease" +% +Chuck Norris was once in a knife fight, and the knife lost. +% +If you work in an office with Chuck Norris, don't ask him for his three-hole-punch. +% +In the Words of Julius Caesar, "Veni, Vidi, Vici, Chuck Norris". Translation: I came, I saw, and I was roundhouse-kicked inthe face by Chuck Norris. +% +The First rule of Chuck Norris is: you do not talk about Chuck Norris. +% +Chuck Norris is widely predicted to be first black president. If you're thinking to yourself, "But Chuck Norris isn't black", then you are dead wrong. And stop being a racist. +% +When Chuck Norris plays Monopoly, it affects the actual world economy. +% +Chuck Norris can be unlocked on the hardest level of Tekken. But only Chuck Norris is skilled enough to unlock himself. Then he roundhouse kicks the Playstation back to Japan. +% +Chuck Norris drinks napalm to quell his heartburn. +% +Every time someone uses the word "intense", Chuck Norris always replies "you know what else is intense?" followed by a roundhouse kick to the face. +% +As an infant, Chuck Norris' parents gave him a toy hammer. He gave the world Stonehenge. +% +Chuck Norris once ordered a steak in a restaurant. The steak did what it was told. +% +Most people fear the Reaper. Chuck Norris considers him "a promising Rookie". +% +There are only two things that can cut diamonds: other diamonds, and Chuck Norris. +% +President Roosevelt once rode his horse 100 miles. Chuck Norris carried his the same distance in half the time. +% +Chuck Norris once ate four 30lb bowling balls without chewing. +% +What many people dont know is chuck norris is the founder of planned parenthood. Not even unborn children can escape his wrath. +% +Chuck Norris was banned from competitive bullriding after a 1992 exhibition in San Antonio, when he rode the bull 1,346 miles from Texas to Milwaukee Wisconsin to pick up his dry cleaning. +% +Chuck Norris qualified with a top speed of 324 mph at the Daytona 500, without a car. +% +Chuck Norris likes his coffee half and half: half coffee grounds, half wood-grain alcohol. +% +Chuck Norris uses tabasco sauce instead of visine. +% +The chemical formula for the highly toxic cyanide ion is CN-. These are also Chuck Norris' initials. This is not a coincidence. +% +Chuck Norris' credit cards have no limit. Last weekend, he maxed them out. +% +Think of a hot woman. Chuck Norris did her. +% +A man once claimed Chuck Norris kicked his ass twice, but it was promptly dismissed as false - no one could survive it the first time. +% +Chuck Norris sleeps with a pillow under his gun. +% +Chuck Norris owns a chain of fast-food restaurants throughout the southwest. They serve nothing but barbecue-flavored ice cream and Hot Pockets. +% +Chuck Norris doesn't chew gum. Chuck Norris chews tin foil. +% +Aliens DO indeed exist. They just know better than to visit a planet that Chuck Norris is on. +% +When in a bar, you can order a drink called a "Chuck Norris". It is also known as a "Bloody Mary", if your name happens to be Mary. +% +Every time Chuck Norris smiles, someone dies. Unless he smiles while he's roundhouse kicking someone in the face. Then two people die. +% +Some people ask for a Kleenex when they sneeze, Chuck Norris asks for a body bag. +% +There's an order to the universe: space, time, Chuck Norris.... Just kidding, Chuck Norris is first. +% +A man once asked Chuck Norris if his real name is "Charles". Chuck Norris did not respond, he simply stared at him until he exploded. +% +Chuck Norris starts everyday with a protein shake made from Carnation Instant Breakfast, one dozen eggs, pure Colombian cocaine, and rattlesnake venom. He injects it directly into his neck with a syringe. +% +In a tagteam match, Chuck Norris was teamed with Hulk Hogan against King Kong Bundy and Andre The Giant. He pinned all 3 at the same time. +% +Chuck Norris doesn't see dead people. He makes people dead. +% +Chuck Norris is the only person who can simultaneously hold and fire FIVE Uzis: One in each hand, one in each foot -- and the 5th one he roundhouse-kicks into the air, so that it sprays bullets. +% +For undercover police work, Chuck Norris pins his badge underneath his shirt, directly into his chest. +% +In the X-Men movies, none of the X-Men super-powers are done with special effects. Chuck Norris is the stuntman for every character. +% +We live in an expanding universe. All of it is trying to get away from Chuck Norris. +% +Chuck Norris went looking for a bar but couldn't find one. He walked to a vacant lot and sat there. Sure enough within an hour an a half someone constructed a bar around him. He then ordered a shot, drank it, and then burned the place to the ground. Chuck Norris yelled over the roar of the flames, "always leave things the way you found em!" +% +It is said that every time you masturbate, God kills a kitten. Every time God masturbates, Chuck Norris kills a lion. +% +The word 'Kill' was invented by Chuck Norris. Other words were 'Die', 'Beer', and 'What'. +% +Chuck Norris is a vegetarian. Meaning, he does not eat animals until first he puts them into vegetative state with his fists. +% +The 11th commandment is "Thou shalt not piss off Chuck Norris" This commandment is rarely enforced, as it is impossible to accomplish. +% +Chuck Norris is his own line at the DMV. +% +Two wrongs don't make a right. Unless you're Chuck Norris. Then two wrongs make a roundhouse kick to the face. +% +Who let the dogs out? Chuck Norris let the dogs out... and then roundhouse kicked them through an Oldsmobile. +% +Chuck Norris can do a roundhouse kick faster than the speed of light. This means that if you turn on a light switch, you will be dead before the lightbulb turns on. +% +When Chuck Norris goes to out to eat, he orders a whole chicken, but he only eats its soul. +% +Chuck Norris sold his soul to the devil for his rugged good looks and unparalleled martial arts ability. Shortly after the transaction was finalized, Chuck roundhouse-kicked the devil in the face and took his soul back. The devil, who appreciates irony, couldn't stay mad and admitted he should have seen it coming. They now play poker every second Wednesday of the month. +% +Chuck Norris has never won an Academy Award for acting... because he's not acting. +% +If Chuck Norris wants your opinion, he'll beat it into you. +% +Not everyone that Chuck Norris is mad at gets killed. Some get away. They are called astronauts. +% +Chuck Norris has to register every part of his body as a separate lethal weapon. His spleen is considered a concealed weapon in over 50 states. +% +A movie scene depicting Chuck Norris losing a fight with Bruce Lee was the product of history's most expensive visual effect. When adjusted for inflation, the effect cost more than the Gross National Product of Paraguay. +% +Godzilla is a Japanese rendition of Chuck Norris' first visit to Tokyo. +% +They once made a Chuck Norris toilet paper, but there was a problem-- It wouldn't take shit from anybody. +% +Chuck Norris once rode a nine foot grizzly bear through an automatic car wash, instead of taking a shower. +% +"Sweating bullets" is literally what happens when Chuck Norris gets too hot. +% +Chuck Norris' sperm can be seen with the naked eye. Each one is the size of a quarter. +% +After taking a steroids test doctors informed Chuck Norris that he had tested positive. He laughed upon receiving this information, and said "of course my urine tested positive, what do you think they make steroids from?" +% +Chuck Norris doesn't daydream. He's too busy giving other people nightmares. +% +When Arnold says the line "I'll be back" in the first Terminator movie it is implied that is he going to ask Chuck Norris for help. +% +There are no such things as tornados. Chuck Norris just hates trailer parks. +% +Chuck Norris' Penis is a third degree blackbelt, and an honorable 32nd-degree mason. +% +Chuck Norris does not follow fashion trends, they follow him. But then he turns around and kicks their ass. Nobody follows Chuck Norris. +% +The phrase 'break a leg' was originally coined by Chuck Norris's co-stars in Walker, Texas Ranger as a good luck charm indicating that a broken leg might be the worst extent of their injuries. This never proved to be the case. +% +Chuck Norris' roundhouse kick is so powerful, it can be seen from outer space by the naked eye. +% +Diamonds are not, despite popular belief, carbon. They are, in fact, Chuck Norris fecal matter. This was proven a recently, when scientific analysis revealed what appeared to be Jean-Claude Van Damme bone fragments inside the Hope Diamond. +% +Chuck Norris once participated in the running of the bulls. He walked. +% +The Drummer for Def Leppard's only got one arm. Chuck Norris needed a back scratcher. +% +Chuck Norris was the orginal sculptor of Mount Rushmore. He completed the entire project using only a bottle opener and a drywall trowel. +% +Chuck Norris once rode a bull, and nine months later it had a calf. +% +Chuck Norris once lost the remote, but maintained control of the TV by yelling at it in between bites of his "Filet of Child" sandwich. +% +For Spring Break '05, Chuck Norris drove to Madagascar, riding a chariot pulled by two electric eels. +% +The Manhattan Project was not intended to create nuclear weapons, it was meant to recreate the destructive power in a Chuck Norris Roundhouse Kick. They didn't even come close. +% +Chuck Norris has banned rainbows from the state of North Dakota. +% +Divide Chuck Norris by zero and you will in fact get one........one bad-ass motherfucker that is. +% +TNT was originally developed by Chuck Norris to cure indigestion. +% +After returning from World War 2 unscathed, Bob Dole was congratulated by Chuck Norris with a handshake. The rest is history. +% +Chuck Norris runs on batteries. Specifically, Die Hards. +% +"Let the Bodies Hit the Floor" was originally written as Chuck Norris' theme song. +% +Chuck Norris will never have a heart attack. His heart isn't nearly foolish enough to attack him. +% +Only Chuck Norris can prevent forest fires. +% +When Chuck Norris makes a burrito, its main ingredient is real toes. +% +Chuck Norris is not Irish. His hair is soaked in the blood of his victims. +% +In the movie "The Matrix", Chuck Norris is the Matrix. If you pay close attention in the green "falling code" scenes, you can make out the faint texture of his beard. +% +Chuck Norris' dick is so big, it has it's own dick, and that dick is still bigger than yours. +% +They say curiosity killed the cat. This is false. Chuck Norris killed the cat. Every single one of them. +% +There is no such thing as a lesbian, just a woman who has never met Chuck Norris. +% +Chuck Norris crossed the road. No one has ever dared question his motives. +% +When Chuck Norris was born, he immediately had sex with the first nurse he saw. He was her first. She was his third. That afternoon. +% +One time, at band camp, Chuck Norris ate a percussionist. +% +Chuck Norris doesn't say "who's your daddy", because he knows the answer. +% +Chuck Norris originally wrote the first dictionary. The definition for each word is as follows - A swift roundhouse kick to the face. +% +Love does not hurt. Chuck Norris does. +% +The term "Cleveland Steamer" got its name from Chuck Norris, when he took a dump while visiting the Rock and Roll Hall of fame and buried northern Ohio under a glacier of fecal matter. +% +Chuck Norris once round-house kicked a salesman. Over the phone. +% +The pen is mighter than the sword, but only if the pen is held by Chuck Norris. +% +Chuck Norris doesn't kill two birds with one stone. Chuck Norris kills all birds, with two stones. The ones in his pants. +% +Chuck Norris knows the last digit of pi. +% +Those aren't credits that roll after Walker Texas Ranger. It is actually a list of fatalities that occurred during the making of the episode. +% +The air around Chuck Norris is always a balmy 78 degrees. +% +When Chuck Norris wants an egg, he cracks open a chicken. +% +Chuck Norris plays racquetball with a waffle iron and a bowling ball. +% +According to the Bible, God created the universe in six days. Before that, Chuck Norris created God by snapping his fingers. +% +Chuck Norris doesn't believe in ravioli. He stuffs a live turtle with beef and smothers it in pig's blood. +% +Count from one to ten. That's how long it would take Chuck Norris to kill you...Fourty seven times. +% +The 1972 Miami Dolphins lost one game, it was an exhibition game vs. Chuck Norris and three seven year old girls. Chuck Norris won with a roundhouse-kick to the face in overtime. +% +Chuck Norris is not Politically Correct. He is just Correct. Always. +% +Mr. T pities the fool. Chuck Norris rips the fool's fucking head off. +% +Chuck Norris had to stop washing his clothes in the ocean. The tsunamis were killing people. +% +Chuck Norris has volunteered to remain on earth after the Rapture; he will spend his time fighting the Anti-Christ. +% +They were going to release a Chuck Norris edition of Clue, but the answer always turns out to be "Chuck Norris. In The Library. With a Roundhouse Kick." +% +Chuck Norris is the only known mammal in history to have an opposable thumb. On his penis. +% +A man once taunted Chuck Norris with a bag of Lay's potato chips, saying "Betcha can't eat just one!" Chuck Norris proceeded to eat the chips, the bag, and the man in one deft move. +% +Chuck Norris' favorite cereal is Kellogg's Nails 'N' Gravel. +% +In the first Jurassic Park movie, the Tyrannosaurus Rex wasn't chasing the jeep. Chuck Norris was chasing the Tyrannosaurus AND the jeep. +% +Chuck Norris has never been accused of murder for the simple fact that his roundhouse kicks are recognized world-wide as "acts of God." +% +"Brokeback Mountain" is not just a movie. It's also what Chuck Norris calls the pile of dead ninjas in his front yard. +% +Chuck Norris does not wear a condom. Because there is no such thing as protection from Chuck Norris. +% +Chuck Norris once had sex with a cigarette machine in the Osaka airport. +% +Rules of fighting: 1) Don't bring a knife to a gun fight. 2) Don't bring a gun to a Chuck Norris fight. +% +Chuck Norris is the only man who has, literally, beaten the odds. With his fists. +% +In ancient China there is a legend that one day a child will be born from a dragon, grow to be a man, and vanquish evil from the land. That man is not Chuck Norris, because Chuck Norris killed that man. +% +Chuck Norris wipes his ass with chain mail and sandpaper. +% +When you play Monopoly with Chuck Norris, you do not pass go, and you do not collect two hundred dollars. You will be lucky if you make it out alive. +% +Chuck Norris describes human beings as "a sociable holder for blood and guts". +% +Chuck Norris once got into a fight with a one-armed Ninja. Seeing that he had an unfair advantage, Chuck Norris ripped both of his arms off and one of his legs. He then roundhouse-kicked the ninja in the head, killing him instantly, and proceeded to sow his limbs back on using only a rusty tent spike and bailing wire. +% +Chuck Norris likes his ice like he likes his skulls: crushed. +% +Chuck Norris can kick through all 6 degrees of separation, hitting anyone, anywhere, in the face, at any time. +% +Most tough men eat nails for breakfast. chuck Norris does all of his grocery shopping at Home Depot. +% +Chuck Norris did not "lose" his virginity, he stalked it and then destroyed it with extreme prejudice. +% +Everything King Midas touches turnes to gold. Everything Chuck Norris touches turns up dead. +% +Chuck Norris' pulse is measured on the richter scale. +% +Most people know that Descarte said, "I think, therefore I am." What most people don't know is that that quote continues, "...afraid of Chuck Norris." +% +Chuck Norris once roundhouse-kicked a ten dollar bill into 200 nickels. +% +For every movie about Vietnam starring Chuck Norris, the historical duration of the war decreases. Just 3 more "Missing in Action" sequels, and that war will have never actually existed. +% +Chuck Norris' penis has a Hemi. +% +Chuck Norris enjoys a good practical joke. His favorite is where he removes your lower intestine and pretends to make a balloon animal out of it. Then he cracks your skull open with a Volvo for not complimenting him on his balloon animal. +% +Chuck Norris CAN in fact 'raise the roof'. And he can do it with one hand. +% +Kenny G is allowed to live because Chuck Norris doesn't kill women. +% +Life is not, in fact, like a box of chocolates. It is more like a box of Chuck Norris, roundhouse kicking you in the face. And if you receive a box of Chuck Norris, you ALWAYS know what you are going to get. +% +For Chuck Norris, every street is "one way". HIS WAY. +% +There are now five cup sizes at Starbucks: Short, Tall, Grande, Venti, and Chuck Norris. +% +During the Vietnam War, Chuck Norris allowed himself to be captured. For torture, they made him eat his own entrails. He asked for seconds. +% +Chuck Norris once created a flamethrower by urinating into a lighter. +% +Instead of having a cigarette after sex, Chuck Norris heads outside and brands his cattle. +% +Chuck Norris actually built the stairway to heaven. +% +Whoever said "only the good die young" was probably in Chuck Norris's kindergarten class. +% +Chuck Norris once skewered a man with the Eiffel tower. +% +The best part of waking up, is not Folgers in your cup, but knowing that Chuck Norris didn't kill you in your sleep. +% +Chuck Norris doesn't own a can opener, he just chews through the can. +% +Occam's Razor says that the simplest answer tends to be the correct one. Norris' Razor involves a flick of the wrist and a Columbian Necktie. +% +Chuck Norris needs a monkeywrench and a blowtorch to masturbate. +% +Proponents of higher-order theories of consciousness argue that consciousness is explained by the relation between two levels of mental states in which a higher-order mental state takes another mental state. If you mention this to Chuck Norris, expect an explosive roundhouse kick to the face for spouting too much fancy-talk. +% +Chuck Norris invented all 32 letters of the alphabet. +% +Remember The Ultimate Warrior? He quit wrestling because Chuck Norris wanted his nickname back. +% +If a tree falls in the forest, does anybody hear? Yes. Chuck Norris hears it. Chuck Norris can hear everything. Chuck Norris can hear the shrieking terror in your soul. +% +Chuck Norris actually owns IBM. It was an extremely hostile takeover. +% +He, who laughs last, laughs best. He who laughs at Chuck Norris ? dies. +% +Chuck Norris is like a dog, not only because he can smell fear, but because he can piss on whatever the fuck he wants. +% +Chuck Norris can jump-start a car using jumper cables attached to his nipples. +% +Chuck Norris neither melts in your mouth nor in your hand. He shreds your trachea before ravaging your soul with a combination of chocolate, whickey, roundhouse kicks and death. Oh, and pain. Lots of pain. +% +Chuck Norris doesn't have blood. He is filled with magma. +% diff --git a/oh-my-zsh/plugins/cloudapp/cloudapp.plugin.zsh b/oh-my-zsh/plugins/cloudapp/cloudapp.plugin.zsh @@ -0,0 +1,2 @@ +#!/bin/zsh +alias cloudapp=$ZSH/plugins/cloudapp/cloudapp.rb diff --git a/oh-my-zsh/plugins/cloudapp/cloudapp.rb b/oh-my-zsh/plugins/cloudapp/cloudapp.rb @@ -0,0 +1,60 @@ +#!/usr/bin/env ruby +# +# cloudapp +# Zach Holman / @holman +# +# Uploads a file from the command line to CloudApp, drops it into your +# clipboard (on a Mac, at least). +# +# Example: +# +# cloudapp drunk-blake.png +# +# This requires Aaron Russell's cloudapp_api gem: +# +# gem install cloudapp_api +# +# Requires you set your CloudApp credentials in ~/.cloudapp as a simple file of: +# +# email +# password + +require 'rubygems' +begin + require 'cloudapp_api' +rescue LoadError + puts "You need to install cloudapp_api: gem install cloudapp_api" + exit!(1) +end + +config_file = "#{ENV['HOME']}/.cloudapp" +unless File.exist?(config_file) + puts "You need to type your email and password (one per line) into "+ + "`~/.cloudapp`" + exit!(1) +end + +email,password = File.read(config_file).split("\n") + +class HTTParty::Response + # Apparently HTTPOK.ok? IS NOT OKAY WTFFFFFFFFFFUUUUUUUUUUUUUU + # LETS MONKEY PATCH IT I FEEL OKAY ABOUT IT + def ok? ; true end +end + +if ARGV[0].nil? + puts "You need to specify a file to upload." + exit!(1) +end + +CloudApp.authenticate(email,password) +url = CloudApp::Item.create(:upload, {:file => ARGV[0]}).url + +# Say it for good measure. +puts "Uploaded to #{url}." + +# Get the embed link. +url = "#{url}/#{ARGV[0].split('/').last}" + +# Copy it to your (Mac's) clipboard. +`echo '#{url}' | tr -d "\n" | pbcopy` diff --git a/oh-my-zsh/plugins/codeclimate/_codeclimate b/oh-my-zsh/plugins/codeclimate/_codeclimate @@ -0,0 +1,82 @@ +#compdef codeclimate + +_codeclimate_all_engines() { + engines_all=(`codeclimate engines:list | tail -n +2 | gawk '{ print $2 }' | gawk -F: '{ print $1 }'`) +} + +_codeclimate_installed_engines() { + _codeclimate_all_engines + + engines_installed=() + + if [ -e .codeclimate.yml ] + then + for engine in $engines_all + do + if grep -q $engine ".codeclimate.yml" + then + engines_installed+=$engine + fi + done + fi +} + +_codeclimate_not_installed_engines() { + _codeclimate_all_engines + + engines_not_installed=() + + if [ -e .codeclimate.yml ] + then + for engine in $engines_all + do + if ! grep -q $engine ".codeclimate.yml" + then + engines_not_installed+=$engine + fi + done + fi +} + +local curcontext="$curcontext" state line ret=1 +local expl +local -a engines_all engines_installed engines_not_installed + +_arguments \ + '1: :->cmds' \ + '*:: :->args' && ret=0 + +case $state in + cmds) + _values "bundle command" \ + "analyze[Analyze all relevant files in the current working directory]" \ + "console[Start an interactive session providing access to the classes within the CLI]" \ + "engines\:disable[Prevents the engine from being used in this project]" \ + "engines\:enable[This engine will be run the next time your project is analyzed]" \ + "engines\:install[Compares the list of engines in your .codeclimate.yml file to those that are currently installed, then installs any missing engines]" \ + "engines\:list[Lists all available engines in the Code Climate Docker Hub]" \ + "engines\:remove[Removes an engine from your .codeclimate.yml file]" \ + "help[Displays a list of commands that can be passed to the Code Climate CLI]" \ + "init[Generates a new .codeclimate.yml file in the current working directory]" \ + "validate-config[Validates the .codeclimate.yml file in the current working directory]" \ + "version[Displays the current version of the Code Climate CLI]" + ret=0 + ;; + args) + case $line[1] in + engines:enable) + _codeclimate_not_installed_engines + _wanted engines_not_installed expl 'not installed engines' compadd -a engines_not_installed ;; + engines:disable|engines:remove) + _codeclimate_installed_engines + _wanted engines_installed expl 'installed engines' compadd -a engines_installed ;; + analyze) + _arguments \ + '-f:Output Format:(text json)' + ret=0 + ;; + esac + ;; +esac + +return ret diff --git a/oh-my-zsh/plugins/coffee/README.md b/oh-my-zsh/plugins/coffee/README.md @@ -0,0 +1,31 @@ +## Coffeescript Plugin + +This plugin provides aliases for quickly compiling and previewing your +coffeescript code. + +When writing Coffeescript it's very common to want to preview the output of a +certain snippet of code, either because you want to test the output or because +you'd like to execute it in a browser console which doesn't accept Coffeescript. + +Preview the compiled result of your coffeescript with `cf "code"` as per the +following: + +```zsh +$ cf 'if a then b else c' +if (a) { + b; +} else { + c; +} +``` + +Also provides the following aliases: + +* **cfc:** Copies the compiled JS to your clipboard. Very useful when you want + to run the code in a JS console. + +* **cfp:** Compiles from your currently copied clipboard. Useful when you want + to compile large/multi-line snippets + +* **cfpc:** Paste coffeescript from clipboard, compile to JS, then copy the + the result back to clipboard. diff --git a/oh-my-zsh/plugins/coffee/_coffee b/oh-my-zsh/plugins/coffee/_coffee @@ -0,0 +1,81 @@ +#compdef coffee +# ------------------------------------------------------------------------------ +# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for Coffee.js v0.6.11 (http://coffeejs.org) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Mario Fernandez (https://github.com/sirech) +# * Dong Weiming (https://github.com/dongweiming) +# +# ------------------------------------------------------------------------------ + +local curcontext="$curcontext" state line ret=1 version opts first second third +typeset -A opt_args +version=(${(f)"$(_call_program version $words[1] --version)"}) +version=${${(z)${version[1]}}[3]} +first=$(echo $version|cut -d '.' -f 1) +second=$(echo $version|cut -d '.' -f 2) +third=$(echo $version|cut -d '.' -f 3) +if (( $first < 2 )) && (( $second < 7 )) && (( $third < 3 ));then + opts+=('(-l --lint)'{-l,--lint}'[pipe the compiled JavaScript through JavaScript Lint]' + '(-r --require)'{-r,--require}'[require a library before executing your script]:library') +fi + + +_arguments -C \ + '(- *)'{-h,--help}'[display this help message]' \ + '(- *)'{-v,--version}'[display the version number]' \ + $opts \ + '(-b --bare)'{-b,--bare}'[compile without a top-level function wrapper]' \ + '(-e --eval)'{-e,--eval}'[pass a string from the command line as input]:Inline Script' \ + '(-i --interactive)'{-i,--interactive}'[run an interactive CoffeeScript REPL]' \ + '(-j --join)'{-j,--join}'[concatenate the source CoffeeScript before compiling]:Destination JS file:_files -g "*.js"' \ + '(--nodejs)--nodejs[pass options directly to the "node" binary]' \ + '(-c --compile)'{-c,--compile}'[compile to JavaScript and save as .js files]' \ + '(-o --output)'{-o,--output}'[set the output directory for compiled JavaScript]:Output Directory:_files -/' \ + '(-n -t -p)'{-n,--nodes}'[print out the parse tree that the parser produces]' \ + '(-n -t -p)'{-p,--print}'[print out the compiled JavaScript]' \ + '(-n -t -p)'{-t,--tokens}'[print out the tokens that the lexer/rewriter produce]' \ + '(-s --stdio)'{-s,--stdio}'[listen for and compile scripts over stdio]' \ + '(-w --watch)'{-w,--watch}'[watch scripts for changes and rerun commands]' \ + '*:script or directory:_files' && ret=0 + +return ret + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et diff --git a/oh-my-zsh/plugins/coffee/coffee.plugin.zsh b/oh-my-zsh/plugins/coffee/coffee.plugin.zsh @@ -0,0 +1,16 @@ +#!/bin/zsh + +# compile a string of coffeescript and print to output +cf () { + coffee -peb "$1" +} +# compile & copy to clipboard +cfc () { + cf "$1" | clipcopy +} + +# compile from clipboard & print +alias cfp='cf "$(clippaste)"' + +# compile from clipboard and copy to clipboard +alias cfpc='cfp | clipcopy' diff --git a/oh-my-zsh/plugins/colemak/colemak-less b/oh-my-zsh/plugins/colemak/colemak-less @@ -0,0 +1,6 @@ +n forw-line +e back-line +k repeat-search +\ek repeat-search-all +K reverse-search +\eK reverse-search-all diff --git a/oh-my-zsh/plugins/colemak/colemak.plugin.zsh b/oh-my-zsh/plugins/colemak/colemak.plugin.zsh @@ -0,0 +1,22 @@ +# ctrl-j newline +bindkey '^n' accept-line +bindkey -a '^n' accept-line + +# another rotation to match qwerty +bindkey -a 'n' down-line-or-history +bindkey -a 'e' up-line-or-history +bindkey -a 'i' vi-forward-char + +# make qwerty +bindkey -a 'k' vi-repeat-search +bindkey -a 'K' vi-rev-repeat-search +bindkey -a 'u' vi-insert +bindkey -a 'U' vi-insert-bol +bindkey -a 'l' vi-undo-change +bindkey -a 'N' vi-join + +# spare +bindkey -a 'j' vi-forward-word-end +bindkey -a 'J' vi-forward-blank-word-end + +lesskey $ZSH/plugins/colemak/colemak-less diff --git a/oh-my-zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/oh-my-zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh @@ -0,0 +1,32 @@ +if [[ "$OSTYPE" = solaris* ]] +then + if [[ ! -x "$HOME/bin/nroff" ]] + then + mkdir -p "$HOME/bin" + cat > "$HOME/bin/nroff" <<EOF +#!/bin/sh +if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then + shift + exec /usr/bin/nroff -u\$_NROFF_U "\$@" +fi +#-- Some other invocation of nroff +exec /usr/bin/nroff "\$@" +EOF + chmod +x "$HOME/bin/nroff" + fi +fi + +function man() { + env \ + LESS_TERMCAP_mb=$(printf "\e[1;31m") \ + LESS_TERMCAP_md=$(printf "\e[1;31m") \ + LESS_TERMCAP_me=$(printf "\e[0m") \ + LESS_TERMCAP_se=$(printf "\e[0m") \ + LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ + LESS_TERMCAP_ue=$(printf "\e[0m") \ + LESS_TERMCAP_us=$(printf "\e[1;32m") \ + PAGER="${commands[less]:-$PAGER}" \ + _NROFF_U=1 \ + PATH="$HOME/bin:$PATH" \ + man "$@" +} diff --git a/oh-my-zsh/plugins/colorize/colorize.plugin.zsh b/oh-my-zsh/plugins/colorize/colorize.plugin.zsh @@ -0,0 +1,29 @@ +# Plugin for highlighting file content +# Plugin highlights file content based on the filename extension. +# If no highlighting method supported for given extension then it tries +# guess it by looking for file content. + +#easier alias to use plugin +alias ccat='colorize_via_pygmentize' + +colorize_via_pygmentize() { + if [ ! -x "$(which pygmentize)" ]; then + echo "package \'Pygments\' is not installed!" + return -1 + fi + + if [ $# -eq 0 ]; then + pygmentize -g $@ + fi + + for FNAME in $@ + do + filename=$(basename "$FNAME") + lexer=`pygmentize -N \"$filename\"` + if [ "Z$lexer" != "Ztext" ]; then + pygmentize -l $lexer "$FNAME" + else + pygmentize -g "$FNAME" + fi + done +} diff --git a/oh-my-zsh/plugins/command-not-found/command-not-found.plugin.zsh b/oh-my-zsh/plugins/command-not-found/command-not-found.plugin.zsh @@ -0,0 +1,33 @@ +# Uses the command-not-found package zsh support +# as seen in http://www.porcheron.info/command-not-found-for-zsh/ +# this is installed in Ubuntu + +[[ -e /etc/zsh_command_not_found ]] && source /etc/zsh_command_not_found + +# Arch Linux command-not-found support, you must have package pkgfile installed +# https://wiki.archlinux.org/index.php/Pkgfile#.22Command_not_found.22_hook +[[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && source /usr/share/doc/pkgfile/command-not-found.zsh + +# Fedora command-not-found support +if [ -f /usr/libexec/pk-command-not-found ]; then + command_not_found_handler () { + runcnf=1 + retval=127 + [ ! -S /var/run/dbus/system_bus_socket ] && runcnf=0 + [ ! -x /usr/libexec/packagekitd ] && runcnf=0 + if [ $runcnf -eq 1 ] + then + /usr/libexec/pk-command-not-found $@ + retval=$? + fi + return $retval + } +fi + +# OSX command-not-found support +# https://github.com/Homebrew/homebrew-command-not-found +if type brew &> /dev/null; then + if brew command command-not-found-init > /dev/null 2>&1; then + eval "$(brew command-not-found-init)"; + fi +fi diff --git a/oh-my-zsh/plugins/common-aliases/common-aliases.plugin.zsh b/oh-my-zsh/plugins/common-aliases/common-aliases.plugin.zsh @@ -0,0 +1,89 @@ +# Advanced Aliases. +# Use with caution +# + +# ls, the common ones I use a lot shortened for rapid fire usage +alias l='ls -lFh' #size,show type,human readable +alias la='ls -lAFh' #long list,show almost all,show type,human readable +alias lr='ls -tRFh' #sorted by date,recursive,show type,human readable +alias lt='ls -ltFh' #long list,sorted by date,show type,human readable +alias ll='ls -l' #long list +alias ldot='ls -ld .*' +alias lS='ls -1FSsh' +alias lart='ls -1Fcart' +alias lrt='ls -1Fcrt' + +alias zshrc='$EDITOR ~/.zshrc' # Quick access to the ~/.zshrc file + +alias grep='grep --color' +alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} ' + +alias t='tail -f' + +# Command line head / tail shortcuts +alias -g H='| head' +alias -g T='| tail' +alias -g G='| grep' +alias -g L="| less" +alias -g M="| most" +alias -g LL="2>&1 | less" +alias -g CA="2>&1 | cat -A" +alias -g NE="2> /dev/null" +alias -g NUL="> /dev/null 2>&1" +alias -g P="2>&1| pygmentize -l pytb" + +alias dud='du -d 1 -h' +alias duf='du -sh *' +alias fd='find . -type d -name' +alias ff='find . -type f -name' + +alias h='history' +alias hgrep="fc -El 0 | grep" +alias help='man' +alias p='ps -f' +alias sortnr='sort -n -r' +alias unexport='unset' + +alias whereami=display_info + +alias rm='rm -i' +alias cp='cp -i' +alias mv='mv -i' + +# zsh is able to auto-do some kungfoo +# depends on the SUFFIX :) +if is-at-least 4.2.0; then + # open browser on urls + if [[ -n "$BROWSER" ]]; then + _browser_fts=(htm html de org net com at cx nl se dk) + for ft in $_browser_fts; do alias -s $ft=$BROWSER; done + fi + + _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex) + for ft in $_editor_fts; do alias -s $ft=$EDITOR; done + + if [[ -n "$XIVIEWER" ]]; then + _image_fts=(jpg jpeg png gif mng tiff tif xpm) + for ft in $_image_fts; do alias -s $ft=$XIVIEWER; done + fi + + _media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm) + for ft in $_media_fts; do alias -s $ft=mplayer; done + + #read documents + alias -s pdf=acroread + alias -s ps=gv + alias -s dvi=xdvi + alias -s chm=xchm + alias -s djvu=djview + + #list whats inside packed file + alias -s zip="unzip -l" + alias -s rar="unrar l" + alias -s tar="tar tf" + alias -s tar.gz="echo " + alias -s ace="unace l" +fi + +# Make zsh know about hosts already accessed by SSH +zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })' diff --git a/oh-my-zsh/plugins/compleat/compleat.plugin.zsh b/oh-my-zsh/plugins/compleat/compleat.plugin.zsh @@ -0,0 +1,20 @@ +# ------------------------------------------------------------------------------ +# FILE: compleat.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) +# VERSION: 1.0.0 +# ------------------------------------------------------------------------------ + +if (( ${+commands[compleat]} )); then + local prefix="${commands[compleat]:h:h}" + local setup="${prefix}/share/compleat-1.0/compleat_setup" + + if [[ -f "$setup" ]]; then + if ! bashcompinit >/dev/null 2>&1; then + autoload -U bashcompinit + bashcompinit -i + fi + + source "$setup" + fi +fi diff --git a/oh-my-zsh/plugins/composer/composer.plugin.zsh b/oh-my-zsh/plugins/composer/composer.plugin.zsh @@ -0,0 +1,55 @@ +# ------------------------------------------------------------------------------ +# FILE: composer.plugin.zsh +# DESCRIPTION: oh-my-zsh composer plugin file. +# AUTHOR: Daniel Gomes (me@danielcsgomes.com) +# VERSION: 1.0.0 +# ------------------------------------------------------------------------------ + +# Composer basic command completion +_composer_get_command_list () { + $_comp_command1 --no-ansi 2>/dev/null | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }' +} + +_composer_get_required_list () { + $_comp_command1 show -s --no-ansi 2>/dev/null | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }' +} + +_composer () { + local curcontext="$curcontext" state line + typeset -A opt_args + _arguments \ + '1: :->command'\ + '*: :->args' + + case $state in + command) + compadd $(_composer_get_command_list) + ;; + *) + compadd $(_composer_get_required_list) + ;; + esac +} + +compdef _composer composer +compdef _composer composer.phar + +# Aliases +alias c='composer' +alias csu='composer self-update' +alias cu='composer update' +alias cr='composer require' +alias crm='composer remove' +alias ci='composer install' +alias ccp='composer create-project' +alias cdu='composer dump-autoload' +alias cdo='composer dump-autoload --optimize-autoloader' +alias cgu='composer global update' +alias cgr='composer global require' +alias cgrm='composer global remove' + +# install composer in the current directory +alias cget='curl -s https://getcomposer.org/installer | php' + +# Add Composer's global binaries to PATH +export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null) diff --git a/oh-my-zsh/plugins/copybuffer/README.md b/oh-my-zsh/plugins/copybuffer/README.md @@ -0,0 +1,11 @@ +# `copybuffer` plugin + +This plugin binds the ctrl-o keyboard shortcut to a command that copies the text +that is currently typed in the command line ($BUFFER) to the system clipboard. + +This is useful if you type a command - and before you hit enter to execute it - want +to copy it maybe so you can paste it into a script, gist or whatnot. + +```zsh +plugins=(... copybuffer) +``` diff --git a/oh-my-zsh/plugins/copybuffer/copybuffer.plugin.zsh b/oh-my-zsh/plugins/copybuffer/copybuffer.plugin.zsh @@ -0,0 +1,14 @@ +# copy the active line from the command line buffer +# onto the system clipboard (requires clipcopy plugin) + +copybuffer () { + if which clipcopy &>/dev/null; then + echo $BUFFER | clipcopy + else + echo "clipcopy function not found. Please make sure you have Oh My Zsh installed correctly." + fi +} + +zle -N copybuffer + +bindkey "^O" copybuffer diff --git a/oh-my-zsh/plugins/copydir/copydir.plugin.zsh b/oh-my-zsh/plugins/copydir/copydir.plugin.zsh @@ -0,0 +1,5 @@ +# Copies the pathname of the current directory to the system or X Windows clipboard +function copydir { + emulate -L zsh + print -n $PWD | clipcopy +} diff --git a/oh-my-zsh/plugins/copyfile/copyfile.plugin.zsh b/oh-my-zsh/plugins/copyfile/copyfile.plugin.zsh @@ -0,0 +1,7 @@ +# Copies the contents of a given file to the system or X Windows clipboard +# +# copyfile <file> +function copyfile { + emulate -L zsh + clipcopy $1 +} diff --git a/oh-my-zsh/plugins/cp/README.md b/oh-my-zsh/plugins/cp/README.md @@ -0,0 +1,32 @@ +# cp plugin + +This plugin defines a `cpv` function that uses `rsync` so that you +get the features and security of this command. + +To enable, add `cp` to your `plugins` array in your zshrc file: + +```zsh +plugins=(... cp) +``` + +## Description + +The enabled options for rsync are: + +- `-p`: preserves permissions. + +- `-o`: preserves owner. + +* `-g`: preserves group. + +* `-b`: make a backup of the original file instead of overwriting it, if it exists. + +* `-r`: recurse directories. + +* `-hhh`: outputs numbers in human-readable format, in units of 1024 (K, M, G, T). + +* `--backup-dir=/tmp/rsync`: move backup copies to "/tmp/rsync". + +* `-e /dev/null`: only work on local files (disable remote shells). + +* `--progress`: display progress. diff --git a/oh-my-zsh/plugins/cp/cp.plugin.zsh b/oh-my-zsh/plugins/cp/cp.plugin.zsh @@ -0,0 +1,4 @@ +cpv() { + rsync -pogbr -hhh --backup-dir=/tmp/rsync -e /dev/null --progress "$@" +} +compdef _files cpv diff --git a/oh-my-zsh/plugins/cpanm/_cpanm b/oh-my-zsh/plugins/cpanm/_cpanm @@ -0,0 +1,67 @@ +#compdef cpanm + +## +# cpanminus Z Shell completion script +## +# +# Current supported cpanm version: 1.4000 (Tue Mar 8 01:00:49 PST 2011) +# +# The latest code is always located at: +# https://github.com/rshhh/cpanminus/blob/master/etc/_cpanm +# + +local arguments curcontext="$curcontext" +typeset -A opt_args + + +arguments=( + +# Commands +# '(--install -i)'{--install,-i}'[Installs the modules]' + '(- :)--self-upgrade[Upgrades itself]' + '(- :)--info[Displays distribution info on CPAN]' + '(--installdeps)--installdeps[Only install dependencies]' + '(--look)--look[Download/unpack the distribution and then open the directory with your shell]' + '(- :)'{--help,-h}'[Displays help information]' + '(- :)'{--version,-V}'[Displays software version]' + +# Options + {--force,-f}'[Force install]' + {--notest,-n}'[Do not run unit tests]' + {--sudo,-S}'[sudo to run install commands]' + '(-v --verbose --quiet -q)'{--verbose,-v}'[Turns on chatty output]' + '(-q --quiet --verbose -v)'{--quiet,-q}'[Turns off all output]' + {--local-lib,-l}'[Specify the install base to install modules]' + {--local-lib-contained,-L}'[Specify the install base to install all non-core modules]' + '--mirror[Specify the base URL for the mirror (e.g. http://cpan.cpantesters.org/)]:URLs:_urls' + '--mirror-only[Use the mirror\''s index file instead of the CPAN Meta DB]' + '--prompt[Prompt when configure/build/test fails]' + '--reinstall[Reinstall the distribution even if you already have the latest version installed]' + '--interactive[Turn on interactive configure]' + + '--scandeps[Scan the depencencies of given modules and output the tree in a text format]' + '--format[Specify what format to display the scanned dependency tree]:scandeps format:(tree json yaml dists)' + + '--save-dists[Specify the optional directory path to copy downloaded tarballs]' +# '--uninst-shadows[Uninstalls the shadow files of the distribution that you\''re installing]' + + '--auto-cleanup[Number of days that cpanm\''s work directories expire in. Defaults to 7]' + '(--no-man-pages)--man-pages[Generates man pages for executables (man1) and libraries (man3)]' + '(--man-pages)--no-man-pages[Do not generate man pages]' + + + # Note: Normally with "--lwp", "--wget" and "--curl" options set to true (which is the default) cpanm tries LWP, + # Wget, cURL and HTTP::Tiny (in that order) and uses the first one available. + # (So that the exclusions are not enabled here for the completion) + '(--lwp)--lwp[Use LWP module to download stuff]' + '(--wget)--wget[Use GNU Wget (if available) to download stuff]' + '(--curl)--curl[Use cURL (if available) to download stuff]' + +# Other completions + '*:Local directory or archive:_files -/ -g "*.(tar.gz|tgz|tar.bz2|zip)(-.)"' + # '*::args: _normal' # this looks for default files (any files) +) +_arguments -s $arguments \ + && return 0 + +return 1 diff --git a/oh-my-zsh/plugins/debian/debian.plugin.zsh b/oh-my-zsh/plugins/debian/debian.plugin.zsh @@ -0,0 +1,229 @@ +# Authors: +# https://github.com/AlexBio +# https://github.com/dbb +# https://github.com/Mappleconfusers +# +# Debian-related zsh aliases and functions for zsh + +# Use aptitude if installed, or apt-get if not. +# You can just set apt_pref='apt-get' to override it. +if [[ -e $( which -p aptitude 2>&1 ) ]]; then + apt_pref='aptitude' + apt_upgr='safe-upgrade' +else + apt_pref='apt-get' + apt_upgr='upgrade' +fi + +# Use sudo by default if it's installed +if [[ -e $( which -p sudo 2>&1 ) ]]; then + use_sudo=1 +fi + +# Aliases ################################################################### +# These are for more obscure uses of apt-get and aptitude that aren't covered +# below. +alias age='apt-get' +alias api='aptitude' + +# Some self-explanatory aliases +alias acs="apt-cache search" +alias aps='aptitude search' +alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \ + --no-gui --disable-columns search" # search package + +# apt-file +alias afs='apt-file search --regexp' + + +# These are apt-get only +alias asrc='apt-get source' +alias app='apt-cache policy' + +# superuser operations ###################################################### +if [[ $use_sudo -eq 1 ]]; then +# commands using sudo ####### + alias aac='sudo $apt_pref autoclean' + alias abd='sudo $apt_pref build-dep' + alias ac='sudo $apt_pref clean' + alias ad='sudo $apt_pref update' + alias adg='sudo $apt_pref update && sudo $apt_pref $apt_upgr' + alias adu='sudo $apt_pref update && sudo $apt_pref dist-upgrade' + alias afu='sudo apt-file update' + alias au='sudo $apt_pref $apt_upgr' + alias ai='sudo $apt_pref install' + # Install all packages given on the command line while using only the first word of each line: + # acs ... | ail + alias ail="sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | "' xargs sudo $apt_pref install' + alias ap='sudo $apt_pref purge' + alias ar='sudo $apt_pref remove' + + # apt-get only + alias ads='sudo apt-get dselect-upgrade' + + # Install all .deb files in the current directory. + # Warning: you will need to put the glob in single quotes if you use: + # glob_subst + alias dia='sudo dpkg -i ./*.deb' + alias di='sudo dpkg -i' + + # Remove ALL kernel images and headers EXCEPT the one in use + alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \ + ?not(~n`uname -r`))' + + +# commands using su ######### +else + alias aac='su -ls \'$apt_pref autoclean\' root' + abd() { + cmd="su -lc '$apt_pref build-dep $@' root" + print "$cmd" + eval "$cmd" + } + alias ac='su -ls \'$apt_pref clean\' root' + alias ad='su -lc \'$apt_pref update\' root' + alias adg='su -lc \'$apt_pref update && aptitude $apt_upgr\' root' + alias adu='su -lc \'$apt_pref update && aptitude dist-upgrade\' root' + alias afu='su -lc "apt-file update"' + alias ag='su -lc \'$apt_pref $apt_upgr\' root' + ai() { + cmd="su -lc 'aptitude -P install $@' root" + print "$cmd" + eval "$cmd" + } + ap() { + cmd="su -lc '$apt_pref -P purge $@' root" + print "$cmd" + eval "$cmd" + } + ar() { + cmd="su -lc '$apt_pref -P remove $@' root" + print "$cmd" + eval "$cmd" + } + + # Install all .deb files in the current directory + # Assumes glob_subst is off + alias dia='su -lc "dpkg -i ./*.deb" root' + alias di='su -lc "dpkg -i" root' + + # Remove ALL kernel images and headers EXCEPT the one in use + alias kclean='su -lc '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) \ + ?not(~n`uname -r`))'\'' root' +fi + +# Completion ################################################################ + +# +# Registers a compdef for $1 that calls $apt_pref with the commands $2 +# To do that it creates a new completion function called _apt_pref_$2 +# +apt_pref_compdef() { + local f fb + f="_apt_pref_${2}" + + eval "function ${f}() { + shift words; + service=\"\$apt_pref\"; + words=(\"\$apt_pref\" '$2' \$words); + ((CURRENT++)) + test \"\${apt_pref}\" = 'aptitude' && _aptitude || _apt + }" + + compdef "$f" "$1" +} + +apt_pref_compdef aac "autoclean" +apt_pref_compdef abd "build-dep" +apt_pref_compdef ac "clean" +apt_pref_compdef ad "update" +apt_pref_compdef afu "update" +apt_pref_compdef ag "$apt_upgr" +apt_pref_compdef ai "install" +apt_pref_compdef ail "install" +apt_pref_compdef ap "purge" +apt_pref_compdef ar "remove" +apt_pref_compdef ads "dselect-upgrade" + +# Misc. ##################################################################### +# print all installed packages +alias allpkgs='aptitude search -F "%p" --disable-columns ~i' + +# Create a basic .deb package +alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' + + +# Functions ################################################################# +# create a simple script that can be used to 'duplicate' a system +apt-copy() { + print '#!/bin/sh'"\n" > apt-copy.sh + + cmd='$apt_pref install' + + for p in ${(f)"$(aptitude search -F "%p" --disable-columns \~i)"}; { + cmd="${cmd} ${p}" + } + + print $cmd "\n" >> apt-copy.sh + + chmod +x apt-copy.sh +} + +# Prints apt history +# Usage: +# apt-history install +# apt-history upgrade +# apt-history remove +# apt-history rollback +# apt-history list +# Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html +apt-history () { + case "$1" in + install) + zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*) + ;; + upgrade|remove) + zgrep --no-filename $1 $(ls -rt /var/log/dpkg*) + ;; + rollback) + zgrep --no-filename upgrade $(ls -rt /var/log/dpkg*) | \ + grep "$2" -A10000000 | \ + grep "$3" -B10000000 | \ + awk '{print $4"="$5}' + ;; + list) + zgrep --no-filename '' $(ls -rt /var/log/dpkg*) + ;; + *) + echo "Parameters:" + echo " install - Lists all packages that have been installed." + echo " upgrade - Lists all packages that have been upgraded." + echo " remove - Lists all packages that have been removed." + echo " rollback - Lists rollback information." + echo " list - Lists all contains of dpkg logs." + ;; + esac +} + +# Kernel-package building shortcut +kerndeb () { + # temporarily unset MAKEFLAGS ( '-j3' will fail ) + MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' ) + print '$MAKEFLAGS set to '"'$MAKEFLAGS'" + appendage='-custom' # this shows up in $ (uname -r ) + revision=$(date +"%Y%m%d") # this shows up in the .deb file name + + make-kpkg clean + + time fakeroot make-kpkg --append-to-version "$appendage" --revision \ + "$revision" kernel_image kernel_headers +} + +# List packages by size +function apt-list-packages { + dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | \ + grep -v deinstall | \ + sort -n | \ + awk '{print $1" "$2}' +} + diff --git a/oh-my-zsh/plugins/dircycle/dircycle.plugin.zsh b/oh-my-zsh/plugins/dircycle/dircycle.plugin.zsh @@ -0,0 +1,49 @@ +# enables cycling through the directory stack using +# Ctrl+Shift+Left/Right +# +# left/right direction follows the order in which directories +# were visited, like left/right arrows do in a browser + +# NO_PUSHD_MINUS syntax: +# pushd +N: start counting from left of `dirs' output +# pushd -N: start counting from right of `dirs' output + +switch-to-dir () { + [[ ${#dirstack} -eq 0 ]] && return + + while ! builtin pushd -q $1 &>/dev/null; do + # We found a missing directory: pop it out of the dir stack + builtin popd -q $1 + + # Stop trying if there are no more directories in the dir stack + [[ ${#dirstack} -eq 0 ]] && break + done +} + +insert-cycledleft () { + emulate -L zsh + setopt nopushdminus + + switch-to-dir +1 + zle reset-prompt +} +zle -N insert-cycledleft + +insert-cycledright () { + emulate -L zsh + setopt nopushdminus + + switch-to-dir -0 + zle reset-prompt +} +zle -N insert-cycledright + + +# These sequences work for xterm, Apple Terminal.app, and probably others. +# Not for rxvt-unicode, but it doesn't seem differentiate Ctrl-Shift-Arrow +# from plain Shift-Arrow, at least by default. +# iTerm2 does not have these key combinations defined by default; you will need +# to add them under "Keys" in your profile if you want to use this. You can do +# this conveniently by loading the "xterm with Numeric Keypad" preset. +bindkey "\e[1;6D" insert-cycledleft +bindkey "\e[1;6C" insert-cycledright diff --git a/oh-my-zsh/plugins/dirhistory/dirhistory.plugin.zsh b/oh-my-zsh/plugins/dirhistory/dirhistory.plugin.zsh @@ -0,0 +1,136 @@ +## +# Navigate directory history using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories +# that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT. +# + +dirhistory_past=($PWD) +dirhistory_future=() +export dirhistory_past +export dirhistory_future + +export DIRHISTORY_SIZE=30 + +# Pop the last element of dirhistory_past. +# Pass the name of the variable to return the result in. +# Returns the element if the array was not empty, +# otherwise returns empty string. +function pop_past() { + eval "$1='$dirhistory_past[$#dirhistory_past]'" + if [[ $#dirhistory_past -gt 0 ]]; then + dirhistory_past[$#dirhistory_past]=() + fi +} + +function pop_future() { + eval "$1='$dirhistory_future[$#dirhistory_future]'" + if [[ $#dirhistory_future -gt 0 ]]; then + dirhistory_future[$#dirhistory_future]=() + fi +} + +# Push a new element onto the end of dirhistory_past. If the size of the array +# is >= DIRHISTORY_SIZE, the array is shifted +function push_past() { + if [[ $#dirhistory_past -ge $DIRHISTORY_SIZE ]]; then + shift dirhistory_past + fi + if [[ $#dirhistory_past -eq 0 || $dirhistory_past[$#dirhistory_past] != "$1" ]]; then + dirhistory_past+=($1) + fi +} + +function push_future() { + if [[ $#dirhistory_future -ge $DIRHISTORY_SIZE ]]; then + shift dirhistory_future + fi + if [[ $#dirhistory_future -eq 0 || $dirhistory_futuret[$#dirhistory_future] != "$1" ]]; then + dirhistory_future+=($1) + fi +} + +# Called by zsh when directory changes +chpwd_functions+=(chpwd_dirhistory) +function chpwd_dirhistory() { + push_past $PWD + # If DIRHISTORY_CD is not set... + if [[ -z "${DIRHISTORY_CD+x}" ]]; then + # ... clear future. + dirhistory_future=() + fi +} + +function dirhistory_cd(){ + DIRHISTORY_CD="1" + cd $1 + unset DIRHISTORY_CD +} + +# Move backward in directory history +function dirhistory_back() { + local cw="" + local d="" + # Last element in dirhistory_past is the cwd. + + pop_past cw + if [[ "" == "$cw" ]]; then + # Someone overwrote our variable. Recover it. + dirhistory_past=($PWD) + return + fi + + pop_past d + if [[ "" != "$d" ]]; then + dirhistory_cd $d + push_future $cw + else + push_past $cw + fi +} + + +# Move forward in directory history +function dirhistory_forward() { + local d="" + + pop_future d + if [[ "" != "$d" ]]; then + dirhistory_cd $d + push_past $d + fi +} + + +# Bind keys to history navigation +function dirhistory_zle_dirhistory_back() { + # Erase current line in buffer + zle kill-buffer + dirhistory_back + zle accept-line +} + +function dirhistory_zle_dirhistory_future() { + # Erase current line in buffer + zle kill-buffer + dirhistory_forward + zle accept-line +} + +zle -N dirhistory_zle_dirhistory_back +# xterm in normal mode +bindkey "\e[3D" dirhistory_zle_dirhistory_back +bindkey "\e[1;3D" dirhistory_zle_dirhistory_back +# Mac teminal (alt+left/right) +bindkey "^[b" dirhistory_zle_dirhistory_back +# Putty: +bindkey "\e\e[D" dirhistory_zle_dirhistory_back +# GNU screen: +bindkey "\eO3D" dirhistory_zle_dirhistory_back + +zle -N dirhistory_zle_dirhistory_future +bindkey "\e[3C" dirhistory_zle_dirhistory_future +bindkey "\e[1;3C" dirhistory_zle_dirhistory_future +bindkey "^[f" dirhistory_zle_dirhistory_future +bindkey "\e\e[C" dirhistory_zle_dirhistory_future +bindkey "\eO3C" dirhistory_zle_dirhistory_future + + diff --git a/oh-my-zsh/plugins/dirpersist/dirpersist.plugin.zsh b/oh-my-zsh/plugins/dirpersist/dirpersist.plugin.zsh @@ -0,0 +1,20 @@ +# Save dirstack history to .zdirs +# adapted from: +# github.com/grml/grml-etc-core/blob/master/etc/zsh/zshrc#L1547 + +DIRSTACKSIZE=${DIRSTACKSIZE:-20} +dirstack_file=${dirstack_file:-${HOME}/.zdirs} + +if [[ -f ${dirstack_file} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then + dirstack=( ${(f)"$(< $dirstack_file)"} ) + # "cd -" won't work after login by just setting $OLDPWD, so + [[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD +fi + +chpwd_functions+=(chpwd_dirpersist) +chpwd_dirpersist() { + if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi + local -ax my_stack + my_stack=( ${PWD} ${dirstack} ) + builtin print -l ${(u)my_stack} >! ${dirstack_file} +} diff --git a/oh-my-zsh/plugins/django/django.plugin.zsh b/oh-my-zsh/plugins/django/django.plugin.zsh @@ -0,0 +1,403 @@ +#compdef manage.py + +typeset -ga nul_args +nul_args=( + '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' + '--settings=-[the Python path to a settings module.]:file:_files' + '--pythonpath=-[a directory to add to the Python path.]:directory:_directories' + '--traceback[print traceback on exception.]' + "--no-color[Don't colorize the command output.]" + "--version[show program's version number and exit.]" + {-h,--help}'[show this help message and exit.]' +) + +typeset -ga start_args +start_args=( + '--template=-[The path or URL to load the template from.]:directory:_directories' + '--extension=-[The file extension(s) to render (default: "py").]' + '--name=-[The file name(s) to render.]:file:_files' +) + +typeset -ga db_args +db_args=( + '--database=-[Nominates a database. Defaults to the "default" database.]' +) + +typeset -ga noinput_args +noinput_args=( + '--noinput[tells Django to NOT prompt the user for input of any kind.]' +) + +typeset -ga no_init_data_args +no_init_data_args=( + '--no-initial-data[Tells Django not to load any initial data after database synchronization.]' +) + +typeset -ga tag_args +tag_args=( + '--tag=-[Run only checks labeled with given tag.]' + '--list-tags[List available tags.]' +) + +_managepy-check(){ + _arguments -s : \ + $tag_args \ + $nul_args && ret=0 +} + +_managepy-changepassword(){ + _arguments -s : \ + $db_args \ + $nul_args && ret=0 +} + +_managepy-createcachetable(){ + _arguments -s : \ + $db_args \ + $nul_args && ret=0 +} + +_managepy-createsuperuser(){ + _arguments -s : \ + '--username=-[Specifies the login for the superuser.]' \ + '--email=-[Specifies the email for the superuser.]' \ + $noinput_args \ + $db_args \ + $nul_args && ret=0 +} + +_managepy-collectstatic(){ + _arguments -s : \ + '--link[Create a symbolic link to each file instead of copying.]' \ + '--no-post-process[Do NOT post process collected files.]' \ + '--ignore=-[Ignore files or directories matching this glob-style pattern. Use multiple times to ignore more.]' \ + '--dry-run[Do everything except modify the filesystem.]' \ + '--clear[Clear the existing files using the storage before trying to copy or link the original file.]' \ + '--link[Create a symbolic link to each file instead of copying.]' \ + '--no-default-ignore[Do not ignore the common private glob-style patterns "CVS", ".*" and "*~".]' \ + $noinput_args \ + $nul_args && ret=0 +} + +_managepy-dbshell(){ + _arguments -s : \ + $db_args \ + $nul_args && ret=0 +} + +_managepy-diffsettings(){ + _arguments -s : \ + "--all[Display all settings, regardless of their value.]" + $nul_args && ret=0 +} + +_managepy-dumpdata(){ + _arguments -s : \ + '--format=-[Specifies the output serialization format for fixtures.]:format:(json yaml xml)' \ + '--indent=-[Specifies the indent level to use when pretty-printing output.]' \ + '--exclude=-[An app_label or app_label.ModelName to exclude (use multiple --exclude to exclude multiple apps/models).]' \ + '--natural-foreign[Use natural foreign keys if they are available.]' \ + '--natural-primary[Use natural primary keys if they are available.]' \ + "--all[Use Django's base manager to dump all models stored in the database.]" \ + '--pks=-[Only dump objects with given primary keys.]' \ + $db_args \ + $nul_args \ + '*::appname:_applist' && ret=0 +} + +_managepy-flush(){ + _arguments -s : \ + $no_init_data_args \ + $db_args \ + $noinput_args \ + $nul_args && ret=0 +} + +_managepy-help(){ + _arguments -s : \ + '*:command:_managepy_cmds' \ + $nul_args && ret=0 +} + +_managepy_cmds(){ + local line + local -a cmd + _call_program help-command ./manage.py help \ + |& sed -n '/^ /s/[(), ]/ /gp' \ + | while read -A line; do cmd=($line $cmd) done + _describe -t managepy-command 'manage.py command' cmd +} + +_managepy-inspectdb(){ + _arguments -s : \ + $db_args \ + $nul_args && ret=0 +} + +_managepy-loaddata(){ + _arguments -s : \ + '--ignorenonexistent[Ignores entries in the serialized data for fields that do not currently exist on the model.]' \ + '--app=-[Only look for fixtures in the specified app.]:appname:_applist' \ + '*::file:_files' \ + $db_args \ + $nul_args && ret=0 +} + +_managepy-makemessages(){ + _arguments -s : \ + '--locale=-[Creates or updates the message files for the given locale(s) (e.g. pt_BR).]' \ + '--domain=-[The domain of the message files (default: "django").]' \ + '--all[Updates the message files for all existing locales.]' \ + '--extension=-[The file extension(s) to examine (default: "html,txt", or "js" if the domain is "djangojs").]' \ + '--symlinks[Follows symlinks to directories when examining source code and templates for translation strings.]' \ + '--ignore=-[Ignore files or directories matching this glob-style pattern.]' \ + "--no-default-ignore[Don't ignore the common glob-style patterns 'CVS', '.*', '*~' and '*.pyc'.]" \ + "--no-wrap[Don't break long message lines into several lines.]" \ + "--no-location[Don't write '#: filename:line' lines.]" \ + '--no-obsolete[emove obsolete message strings.]' \ + '--keep-pot[Keep .pot file after making messages.]' \ + $nul_args && ret=0 +} +_managepy-makemigrations(){ + _arguments -s : \ + '--dry-run[Just show what migrations would be made]' \ + '--merge[Enable fixing of migration conflicts.]' \ + '--empty[Create an empty migration.]' \ + $noinput_args \ + $nul_args && ret=0 +} +_managepy-migrate(){ + _arguments -s : \ + '--fake[Mark migrations as run without actually running them]' \ + '--list[Show a list of all known migrations and which are applied]' \ + $no_init_data_args \ + $noinput_args \ + $db_args \ + $nul_args && ret=0 +} + +_managepy-runfcgi(){ + local state + + local fcgi_opts + fcgi_opts=( + 'protocol[fcgi, scgi, ajp, ... (default fcgi)]:protocol:(fcgi scgi ajp)' + 'host[hostname to listen on..]:' + 'port[port to listen on.]:' + 'socket[UNIX socket to listen on.]:file:_files' + 'method[prefork or threaded (default prefork)]:method:(prefork threaded)' + 'maxrequests[number of requests a child handles before it is killed and a new child is forked (0 = no limit).]:' + 'maxspare[max number of spare processes / threads.]:' + 'minspare[min number of spare processes / threads.]:' + 'maxchildren[hard limit number of processes / threads.]:' + 'daemonize[whether to detach from terminal.]:boolean:(False True)' + 'pidfile[write the spawned process-id to this file.]:file:_files' + 'workdir[change to this directory when daemonizing.]:directory:_files' + 'outlog[write stdout to this file.]:file:_files' + 'errlog[write stderr to this file.]:file:_files' + ) + + _arguments -s : \ + $nul_args \ + '*: :_values "FCGI Setting" $fcgi_opts' && ret=0 +} + +_managepy-runserver(){ + _arguments -s : \ + '--ipv6[Tells Django to use an IPv6 address.]' \ + '--nothreading[Tells Django to NOT use threading.]' \ + '--noreload[Tells Django to NOT use the auto-reloader.]' \ + '--nostatic[Tells Django to NOT automatically serve static files at STATIC_URL.]' \ + '--insecure[Allows serving static files even if DEBUG is False.]' \ + $nul_args && ret=0 +} + +_managepy-shell(){ + _arguments -s : \ + '--plain[Tells Django to use plain Python, not IPython.]' \ + '--no-startup[When using plain Python, ignore the PYTHONSTARTUP environment variable and ~/.pythonrc.py script.]' \ + '--interface=-[Specify an interactive interpreter interface.]:INTERFACE:((ipython bpython))' \ + $nul_args && ret=0 +} + +_managepy-sql(){ + _arguments -s : \ + $db_args \ + $nul_args && ret=0 +} + +_managepy-sqlall(){ + _arguments -s : \ + $db_args \ + $nul_args && ret=0 +} + +_managepy-sqlclear(){ + _arguments -s : \ + $db_args \ + $nul_args && ret=0 +} + +_managepy-sqlcustom(){ + _arguments -s : \ + $db_args \ + $nul_args && ret=0 +} + +_managepy-dropindexes(){ + _arguments -s : \ + $db_args \ + $nul_args && ret=0 +} + +_managepy-sqlflush(){ + _arguments -s : \ + $db_args \ + $nul_args && ret=0 +} + +_managepy-sqlindexes(){ + _arguments -s : \ + $db_args \ + $nul_args && ret=0 +} + +_managepy-sqlinitialdata(){ + _arguments -s : \ + $nul_args && ret=0 +} + +_managepy-sqlsequencereset(){ + _arguments -s : \ + $db_args \ + $nul_args && ret=0 +} + +_managepy-squashmigrations(){ + _arguments -s : \ + '--no-optimize[Do not try to optimize the squashed operations.]' \ + $noinput_args \ + $nul_args && ret=0 +} + +_managepy-startapp(){ + _arguments -s : \ + $start_args \ + $nul_args && ret=0 +} +_managepy-startproject(){ + _arguments -s : \ + $start_args \ + $nul_args && ret=0 +} + +_managepy-syncdb() { + _arguments -s : \ + $noinput_args \ + $no_init_data_args \ + $db_args \ + $nul_args && ret=0 +} + +_managepy-test() { + _arguments -s : \ + '--failfast[Tells Django to stop running the test suite after first failed test.]' \ + '--testrunner=-[Tells Django to use specified test runner class instead of the one specified by the TEST_RUNNER setting.]' \ + '--liveserver=-[Overrides the default address where the live server (used with LiveServerTestCase) is expected to run from. The default value is localhost:8081.]' \ + '--top-level-directory=-[Top level of project for unittest discovery.]' \ + '--pattern=-[The test matching pattern. Defaults to test*.py.]:' \ + $noinput_args \ + '*::appname:_applist' \ + $nul_args && ret=0 +} + +_managepy-testserver() { + _arguments -s : \ + '--addrport=-[port number or ipaddr:port to run the server on.]' \ + '--ipv6[Tells Django to use an IPv6 address.]' \ + $noinput_args \ + '*::fixture:_files' \ + $nul_args && ret=0 +} + +_managepy-validate() { + _arguments -s : \ + $tag_args \ + $nul_args && ret=0 +} + +_managepy-commands() { + local -a commands + + commands=( + "changepassword:Change a user's password for django.contrib.auth." + 'check:Checks the entire Django project for potential problems.' + 'compilemessages:Compiles .po files to .mo files for use with builtin gettext support.' + 'createcachetable:Creates the table needed to use the SQL cache backend.' + 'createsuperuser:Used to create a superuser.' + 'collectstatic:Collect static files in a single location.' + 'dbshell:Runs the command-line client for the current DATABASE_ENGINE.' + "diffsettings:Displays differences between the current settings.py and Django's default settings." + 'dumpdata:Output the contents of the database as a fixture of the given format.' + 'flush:Executes ``sqlflush`` on the current database.' + 'help:manage.py help.' + 'inspectdb:Introspects the database tables in the given database and outputs a Django model module.' + 'loaddata:Installs the named fixture(s) in the database.' + 'makemessages:Runs over the entire source tree of the current directory and pulls out all strings marked for translation.' + 'makemigrations:Creates new migration(s) for apps.' + 'migrate:Updates database schema. Manages both apps with migrations and those without.' + 'runfcgi:Run this project as a fastcgi (or some other protocol supported by flup) application,' + 'runserver:Starts a lightweight Web server for development.' + 'shell:Runs a Python interactive interpreter.' + 'showmigrations:Shows all available migrations for the current project.' + 'sql:Prints the CREATE TABLE SQL statements for the given app name(s).' + 'sqlall:Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).' + 'sqlclear:Prints the DROP TABLE SQL statements for the given app name(s).' + 'sqlcustom:Prints the custom table modifying SQL statements for the given app name(s).' + 'sqldropindexes:Prints the DROP INDEX SQL statements for the given model module name(s).' + 'sqlflush:Returns a list of the SQL statements required to return all tables in the database to the state they were in just after they were installed.' + 'sqlindexes:Prints the CREATE INDEX SQL statements for the given model module name(s).' + "sqlinitialdata:RENAMED: see 'sqlcustom'" + 'sqlsequencereset:Prints the SQL statements for resetting sequences for the given app name(s).' + 'squashmigrations:Squashes an existing set of migrations (from first until specified) into a single new one.' + "startapp:Creates a Django app directory structure for the given app name in this project's directory." + "startproject:Creates a Django project directory structure for the given project name in this current directory." + "syncdb:Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created." + 'test:Runs the test suite for the specified applications, or the entire site if no apps are specified.' + 'testserver:Runs a development server with data from the given fixture(s).' + 'validate:Validates all installed models.' + ) + + _describe -t commands 'manage.py command' commands && ret=0 +} + +_applist() { + local line + local -a apps + _call_program help-command "python -c \"import os.path as op, re, django.conf, sys;\\ + bn=op.basename(op.abspath(op.curdir));[sys\\ + .stdout.write(str(re.sub(r'^%s\.(.*?)$' % + bn, r'\1', i)) + '\n') for i in django.conf.settings.\\ + INSTALLED_APPS if re.match(r'^%s' % bn, i)]\"" \ + | while read -A line; do apps=($line $apps) done + _values 'Application' $apps && ret=0 +} + +_managepy() { + local curcontext=$curcontext ret=1 + + if ((CURRENT == 2)); then + _managepy-commands + else + shift words + (( CURRENT -- )) + curcontext="${curcontext%:*:*}:managepy-$words[1]:" + _call_function ret _managepy-$words[1] + fi +} + +compdef _managepy manage.py +compdef _managepy django +compdef _managepy django-admin +compdef _managepy django-admin.py +compdef _managepy django-manage diff --git a/oh-my-zsh/plugins/dnf/README.md b/oh-my-zsh/plugins/dnf/README.md @@ -0,0 +1,25 @@ +## Description + +This plugin makes `dnf` usage easier by adding aliases for the most +common commands. + +`dnf` is the new package manager for RPM-based distributions, which +replaces `yum`. + +## Aliases + +| Alias | Command | Description | +|-------|-------------------------|--------------------------| +| dnfl | `dnf list` | List packages | +| dnfli | `dnf list installed` | List installed packages | +| dnfgl | `dnf grouplist` | List package groups | +| dnfmc | `dnf makecache` | Generate metadata cache | +| dnfp | `dnf info` | Show package information | +| dnfs | `dnf search` | Search package | +| **Use `sudo`** | +| dnfu | `sudo dnf upgrade` | Upgrade package | +| dnfi | `sudo dnf install` | Install package | +| dnfgi | `sudo dnf groupinstall` | Install package group | +| dnfr | `sudo dnf remove` | Remove package | +| dnfgr | `sudo dnf groupremove` | Remove package group | +| dnfc | `sudo dnf clean all` | Clean cache | diff --git a/oh-my-zsh/plugins/dnf/dnf.plugin.zsh b/oh-my-zsh/plugins/dnf/dnf.plugin.zsh @@ -0,0 +1,15 @@ +## Aliases + +alias dnfl="dnf list" # List packages +alias dnfli="dnf list installed" # List installed packages +alias dnfgl="dnf grouplist" # List package groups +alias dnfmc="dnf makecache" # Generate metadata cache +alias dnfp="dnf info" # Show package information +alias dnfs="dnf search" # Search package + +alias dnfu="sudo dnf upgrade" # Upgrade package +alias dnfi="sudo dnf install" # Install package +alias dnfgi="sudo dnf groupinstall" # Install package group +alias dnfr="sudo dnf remove" # Remove package +alias dnfgr="sudo dnf groupremove" # Remove package group +alias dnfc="sudo dnf clean all" # Clean cache diff --git a/oh-my-zsh/plugins/docker-compose/README.md b/oh-my-zsh/plugins/docker-compose/README.md @@ -0,0 +1,4 @@ +# Docker-compose plugin for oh my zsh + +A copy of the completion script from the [docker-compose](https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose) git repo. + diff --git a/oh-my-zsh/plugins/docker-compose/_docker-compose b/oh-my-zsh/plugins/docker-compose/_docker-compose @@ -0,0 +1,475 @@ +#compdef docker-compose + +# Description +# ----------- +# zsh completion for docker-compose +# ------------------------------------------------------------------------- +# Authors +# ------- +# * Steve Durrheimer <s.durrheimer@gmail.com> +# ------------------------------------------------------------------------- +# Inspiration +# ----------- +# * @albers docker-compose bash completion script +# * @felixr docker zsh completion script : https://github.com/felixr/docker-zsh-completion +# ------------------------------------------------------------------------- + +__docker-compose_q() { + docker-compose 2>/dev/null $compose_options "$@" +} + +# All services defined in docker-compose.yml +__docker-compose_all_services_in_compose_file() { + local already_selected + local -a services + already_selected=$(echo $words | tr " " "|") + __docker-compose_q config --services \ + | grep -Ev "^(${already_selected})$" +} + +# All services, even those without an existing container +__docker-compose_services_all() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + services=$(__docker-compose_all_services_in_compose_file) + _alternative "args:services:($services)" && ret=0 + + return ret +} + +# All services that have an entry with the given key in their docker-compose.yml section +__docker-compose_services_with_key() { + local already_selected + local -a buildable + already_selected=$(echo $words | tr " " "|") + # flatten sections to one line, then filter lines containing the key and return section name. + __docker-compose_q config \ + | sed -n -e '/^services:/,/^[^ ]/p' \ + | sed -n 's/^ //p' \ + | awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' \ + | grep " \+$1:" \ + | cut -d: -f1 \ + | grep -Ev "^(${already_selected})$" +} + +# All services that are defined by a Dockerfile reference +__docker-compose_services_from_build() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + buildable=$(__docker-compose_services_with_key build) + _alternative "args:buildable services:($buildable)" && ret=0 + + return ret +} + +# All services that are defined by an image +__docker-compose_services_from_image() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + pullable=$(__docker-compose_services_with_key image) + _alternative "args:pullable services:($pullable)" && ret=0 + + return ret +} + +__docker-compose_get_services() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + local kind + declare -a running paused stopped lines args services + + docker_status=$(docker ps > /dev/null 2>&1) + if [ $? -ne 0 ]; then + _message "Error! Docker is not running." + return 1 + fi + + kind=$1 + shift + [[ $kind =~ (stopped|all) ]] && args=($args -a) + + lines=(${(f)"$(_call_program commands docker $docker_options ps $args)"}) + services=(${(f)"$(_call_program commands docker-compose 2>/dev/null $compose_options ps -q)"}) + + # Parse header line to find columns + local i=1 j=1 k header=${lines[1]} + declare -A begin end + while (( j < ${#header} - 1 )); do + i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) + j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) + k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) + begin[${header[$i,$((j-1))]}]=$i + end[${header[$i,$((j-1))]}]=$k + done + lines=(${lines[2,-1]}) + + # Container ID + local line s name + local -a names + for line in $lines; do + if [[ ${services[@]} == *"${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"* ]]; then + names=(${(ps:,:)${${line[${begin[NAMES]},-1]}%% *}}) + for name in $names; do + s="${${name%_*}#*_}:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}" + s="$s, ${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}" + s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}" + if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = Exit* ]]; then + stopped=($stopped $s) + else + if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = *\(Paused\)* ]]; then + paused=($paused $s) + fi + running=($running $s) + fi + done + fi + done + + [[ $kind =~ (running|all) ]] && _describe -t services-running "running services" running "$@" && ret=0 + [[ $kind =~ (paused|all) ]] && _describe -t services-paused "paused services" paused "$@" && ret=0 + [[ $kind =~ (stopped|all) ]] && _describe -t services-stopped "stopped services" stopped "$@" && ret=0 + + return ret +} + +__docker-compose_pausedservices() { + [[ $PREFIX = -* ]] && return 1 + __docker-compose_get_services paused "$@" +} + +__docker-compose_stoppedservices() { + [[ $PREFIX = -* ]] && return 1 + __docker-compose_get_services stopped "$@" +} + +__docker-compose_runningservices() { + [[ $PREFIX = -* ]] && return 1 + __docker-compose_get_services running "$@" +} + +__docker-compose_services() { + [[ $PREFIX = -* ]] && return 1 + __docker-compose_get_services all "$@" +} + +__docker-compose_caching_policy() { + oldp=( "$1"(Nmh+1) ) # 1 hour + (( $#oldp )) +} + +__docker-compose_commands() { + local cache_policy + + zstyle -s ":completion:${curcontext}:" cache-policy cache_policy + if [[ -z "$cache_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy __docker-compose_caching_policy + fi + + if ( [[ ${+_docker_compose_subcommands} -eq 0 ]] || _cache_invalid docker_compose_subcommands) \ + && ! _retrieve_cache docker_compose_subcommands; + then + local -a lines + lines=(${(f)"$(_call_program commands docker-compose 2>&1)"}) + _docker_compose_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/ ##/:}) + (( $#_docker_compose_subcommands > 0 )) && _store_cache docker_compose_subcommands _docker_compose_subcommands + fi + _describe -t docker-compose-commands "docker-compose command" _docker_compose_subcommands +} + +__docker-compose_subcommand() { + local opts_help opts_force_recreate opts_no_recreate opts_no_build opts_remove_orphans opts_timeout opts_no_color opts_no_deps + + opts_help='(: -)--help[Print usage]' + opts_force_recreate="(--no-recreate)--force-recreate[Recreate containers even if their configuration and image haven't changed. Incompatible with --no-recreate.]" + opts_no_recreate="(--force-recreate)--no-recreate[If containers already exist, don't recreate them. Incompatible with --force-recreate.]" + opts_no_build="(--build)--no-build[Don't build an image, even if it's missing.]" + opts_remove_orphans="--remove-orphans[Remove containers for services not defined in the Compose file]" + opts_timeout=('(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: ") + opts_no_color='--no-color[Produce monochrome output.]' + opts_no_deps="--no-deps[Don't start linked services.]" + + integer ret=1 + + case "$words[1]" in + (build) + _arguments \ + $opts_help \ + "*--build-arg=[Set build-time variables for one service.]:<varname>=<value>: " \ + '--force-rm[Always remove intermediate containers.]' \ + '--memory[Memory limit for the build container.]' \ + '--no-cache[Do not use cache when building the image.]' \ + '--pull[Always attempt to pull a newer version of the image.]' \ + '*:services:__docker-compose_services_from_build' && ret=0 + ;; + (bundle) + _arguments \ + $opts_help \ + '--push-images[Automatically push images for any services which have a `build` option specified.]' \ + '(--output -o)'{--output,-o}'[Path to write the bundle file to. Defaults to "<project name>.dab".]:file:_files' && ret=0 + ;; + (config) + _arguments \ + $opts_help \ + '(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \ + '--resolve-image-digests[Pin image tags to digests.]' \ + '--services[Print the service names, one per line.]' \ + '--volumes[Print the volume names, one per line.]' && ret=0 + ;; + (create) + _arguments \ + $opts_help \ + $opts_force_recreate \ + $opts_no_recreate \ + $opts_no_build \ + "(--no-build)--build[Build images before creating containers.]" \ + '*:services:__docker-compose_services_all' && ret=0 + ;; + (down) + _arguments \ + $opts_help \ + "--rmi[Remove images. Type must be one of: 'all': Remove all images used by any service. 'local': Remove only images that don't have a custom tag set by the \`image\` field.]:type:(all local)" \ + '(-v --volumes)'{-v,--volumes}"[Remove named volumes declared in the \`volumes\` section of the Compose file and anonymous volumes attached to containers.]" \ + $opts_remove_orphans && ret=0 + ;; + (events) + _arguments \ + $opts_help \ + '--json[Output events as a stream of json objects]' \ + '*:services:__docker-compose_services_all' && ret=0 + ;; + (exec) + _arguments \ + $opts_help \ + '-d[Detached mode: Run command in the background.]' \ + '--privileged[Give extended privileges to the process.]' \ + '(-u --user)'{-u,--user=}'[Run the command as this user.]:username:_users' \ + '-T[Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY.]' \ + '--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \ + '(-):running services:__docker-compose_runningservices' \ + '(-):command: _command_names -e' \ + '*::arguments: _normal' && ret=0 + ;; + (help) + _arguments ':subcommand:__docker-compose_commands' && ret=0 + ;; + (images) + _arguments \ + $opts_help \ + '-q[Only display IDs]' \ + '*:services:__docker-compose_services_all' && ret=0 + ;; + (kill) + _arguments \ + $opts_help \ + '-s[SIGNAL to send to the container. Default signal is SIGKILL.]:signal:_signals' \ + '*:running services:__docker-compose_runningservices' && ret=0 + ;; + (logs) + _arguments \ + $opts_help \ + '(-f --follow)'{-f,--follow}'[Follow log output]' \ + $opts_no_color \ + '--tail=[Number of lines to show from the end of the logs for each container.]:number of lines: ' \ + '(-t --timestamps)'{-t,--timestamps}'[Show timestamps]' \ + '*:services:__docker-compose_services_all' && ret=0 + ;; + (pause) + _arguments \ + $opts_help \ + '*:running services:__docker-compose_runningservices' && ret=0 + ;; + (port) + _arguments \ + $opts_help \ + '--protocol=[tcp or udp \[default: tcp\]]:protocol:(tcp udp)' \ + '--index=[index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \ + '1:running services:__docker-compose_runningservices' \ + '2:port:_ports' && ret=0 + ;; + (ps) + _arguments \ + $opts_help \ + '-q[Only display IDs]' \ + '*:services:__docker-compose_services_all' && ret=0 + ;; + (pull) + _arguments \ + $opts_help \ + '--ignore-pull-failures[Pull what it can and ignores images with pull failures.]' \ + '*:services:__docker-compose_services_from_image' && ret=0 + ;; + (push) + _arguments \ + $opts_help \ + '--ignore-push-failures[Push what it can and ignores images with push failures.]' \ + '*:services:__docker-compose_services' && ret=0 + ;; + (rm) + _arguments \ + $opts_help \ + '(-f --force)'{-f,--force}"[Don't ask to confirm removal]" \ + '-v[Remove any anonymous volumes attached to containers]' \ + '*:stopped services:__docker-compose_stoppedservices' && ret=0 + ;; + (run) + _arguments \ + $opts_help \ + $opts_no_deps \ + '-d[Detached mode: Run container in the background, print new container name.]' \ + '*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \ + '--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \ + '--name=[Assign a name to the container]:name: ' \ + '(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \ + '--rm[Remove container after run. Ignored in detached mode.]' \ + "--service-ports[Run command with the service's ports enabled and mapped to the host.]" \ + '-T[Disable pseudo-tty allocation. By default `docker-compose run` allocates a TTY.]' \ + '(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \ + '(-v --volume)*'{-v,--volume=}'[Bind mount a volume]:volume: ' \ + '(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \ + '(-):services:__docker-compose_services' \ + '(-):command: _command_names -e' \ + '*::arguments: _normal' && ret=0 + ;; + (scale) + _arguments \ + $opts_help \ + $opts_timeout \ + '*:running services:__docker-compose_runningservices' && ret=0 + ;; + (start) + _arguments \ + $opts_help \ + '*:stopped services:__docker-compose_stoppedservices' && ret=0 + ;; + (stop|restart) + _arguments \ + $opts_help \ + $opts_timeout \ + '*:running services:__docker-compose_runningservices' && ret=0 + ;; + (top) + _arguments \ + $opts_help \ + '*:running services:__docker-compose_runningservices' && ret=0 + ;; + (unpause) + _arguments \ + $opts_help \ + '*:paused services:__docker-compose_pausedservices' && ret=0 + ;; + (up) + _arguments \ + $opts_help \ + '(--abort-on-container-exit)-d[Detached mode: Run containers in the background, print new container names. Incompatible with --abort-on-container-exit.]' \ + $opts_no_color \ + $opts_no_deps \ + $opts_force_recreate \ + $opts_no_recreate \ + $opts_no_build \ + "(--no-build)--build[Build images before starting containers.]" \ + "(-d)--abort-on-container-exit[Stops all containers if any container was stopped. Incompatible with -d.]" \ + '(-t --timeout)'{-t,--timeout}"[Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)]:seconds: " \ + $opts_remove_orphans \ + '*:services:__docker-compose_services_all' && ret=0 + ;; + (version) + _arguments \ + $opts_help \ + "--short[Shows only Compose's version number.]" && ret=0 + ;; + (*) + _message 'Unknown sub command' && ret=1 + ;; + esac + + return ret +} + +_docker-compose() { + # Support for subservices, which allows for `compdef _docker docker-shell=_docker_containers`. + # Based on /usr/share/zsh/functions/Completion/Unix/_git without support for `ret`. + if [[ $service != docker-compose ]]; then + _call_function - _$service + return + fi + + local curcontext="$curcontext" state line + integer ret=1 + typeset -A opt_args + + local file_description + + if [[ -n ${words[(r)-f]} || -n ${words[(r)--file]} ]] ; then + file_description="Specify an override docker-compose file (default: docker-compose.override.yml)" + else + file_description="Specify an alternate docker-compose file (default: docker-compose.yml)" + fi + + _arguments -C \ + '(- :)'{-h,--help}'[Get help]' \ + '*'{-f,--file}"[${file_description}]:file:_files -g '*.yml'" \ + '(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \ + '--verbose[Show more output]' \ + '(- :)'{-v,--version}'[Print version and exit]' \ + '(-H --host)'{-H,--host}'[Daemon socket to connect to]:host:' \ + '--tls[Use TLS; implied by --tlsverify]' \ + '--tlscacert=[Trust certs signed only by this CA]:ca path:' \ + '--tlscert=[Path to TLS certificate file]:client cert path:' \ + '--tlskey=[Path to TLS key file]:tls key path:' \ + '--tlsverify[Use TLS and verify the remote]' \ + "--skip-hostname-check[Don't check the daemon's hostname against the name specified in the client certificate (for example if your docker host is an IP address)]" \ + '(-): :->command' \ + '(-)*:: :->option-or-argument' && ret=0 + + local -a relevant_compose_flags relevant_docker_flags compose_options docker_options + + relevant_compose_flags=( + "--file" "-f" + "--host" "-H" + "--project-name" "-p" + "--tls" + "--tlscacert" + "--tlscert" + "--tlskey" + "--tlsverify" + "--skip-hostname-check" + ) + + relevant_docker_flags=( + "--host" "-H" + "--tls" + "--tlscacert" + "--tlscert" + "--tlskey" + "--tlsverify" + ) + + for k in "${(@k)opt_args}"; do + if [[ -n "${relevant_docker_flags[(r)$k]}" ]]; then + docker_options+=$k + if [[ -n "$opt_args[$k]" ]]; then + docker_options+=$opt_args[$k] + fi + fi + if [[ -n "${relevant_compose_flags[(r)$k]}" ]]; then + compose_options+=$k + if [[ -n "$opt_args[$k]" ]]; then + compose_options+=$opt_args[$k] + fi + fi + done + + case $state in + (command) + __docker-compose_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-compose-$words[1]: + __docker-compose_subcommand && ret=0 + ;; + esac + + return ret +} + +_docker-compose "$@" diff --git a/oh-my-zsh/plugins/docker-compose/docker-compose.plugin.zsh b/oh-my-zsh/plugins/docker-compose/docker-compose.plugin.zsh @@ -0,0 +1,25 @@ +# Authors: +# https://github.com/tristola +# +# Docker-compose related zsh aliases + +# Aliases ################################################################### + +# Use dco as alias for docker-compose, since dc on *nix is 'dc - an arbitrary precision calculator' +# https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html + +alias dco='docker-compose' + +alias dcb='docker-compose build' +alias dce='docker-compose exec' +alias dcps='docker-compose ps' +alias dcrestart='docker-compose restart' +alias dcrm='docker-compose rm' +alias dcr='docker-compose run' +alias dcstop='docker-compose stop' +alias dcup='docker-compose up' +alias dcdn='docker-compose down' +alias dcl='docker-compose logs' +alias dclf='docker-compose logs -f' +alias dcpull='docker-compose pull' +alias dcstart='docker-compose start' diff --git a/oh-my-zsh/plugins/docker-machine/README.md b/oh-my-zsh/plugins/docker-machine/README.md @@ -0,0 +1,19 @@ +# docker-machine plugin for oh my zsh + +### Usage + +#### docker-vm +Will create a docker-machine with the name "dev" (required only once) +To create a second machine call "docker-vm foobar" or pass any other name + +#### docker-up +This will start your "dev" docker-machine (if necessary) and set it as the active one +To start a named machine use "docker-up foobar" + +#### docker-switch dev +Use this to activate a running docker-machine (or to switch between multiple machines) +You need to call either this or docker-up when opening a new terminal + +#### docker-stop +This will stop your "dev" docker-machine +To stop a named machine use "docker-stop foobar"+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/docker-machine/docker-machine.plugin.zsh b/oh-my-zsh/plugins/docker-machine/docker-machine.plugin.zsh @@ -0,0 +1,33 @@ +DEFAULT_MACHINE="default" + +docker-up() { + if [ -z "$1" ] + then + docker-machine start "${DEFAULT_MACHINE}" + eval $(docker-machine env "${DEFAULT_MACHINE}") + else + docker-machine start $1 + eval $(docker-machine env $1) + fi + echo $DOCKER_HOST +} +docker-stop() { + if [ -z "$1" ] + then + docker-machine stop "${DEFAULT_MACHINE}" + else + docker-machine stop $1 + fi +} +docker-switch() { + eval $(docker-machine env $1) + echo $DOCKER_HOST +} +docker-vm() { + if [ -z "$1" ] + then + docker-machine create -d virtualbox --virtualbox-disk-size 20000 --virtualbox-memory 4096 --virtualbox-cpu-count 2 "${DEFAULT_MACHINE}" + else + docker-machine create -d virtualbox --virtualbox-disk-size 20000 --virtualbox-memory 4096 --virtualbox-cpu-count 2 $1 + fi +}+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/docker/README.md b/oh-my-zsh/plugins/docker/README.md @@ -0,0 +1,5 @@ +## Docker autocomplete plugin + +A copy of the completion script from the +[docker/cli](https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker) +git repo. diff --git a/oh-my-zsh/plugins/docker/_docker b/oh-my-zsh/plugins/docker/_docker @@ -0,0 +1,3027 @@ +#compdef docker dockerd +# +# zsh completion for docker (http://docker.com) +# +# version: 0.3.0 +# github: https://github.com/felixr/docker-zsh-completion +# +# contributors: +# - Felix Riedel +# - Steve Durrheimer +# - Vincent Bernat +# +# license: +# +# Copyright (c) 2013, Felix Riedel +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the <organization> nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +# Short-option stacking can be enabled with: +# zstyle ':completion:*:*:docker:*' option-stacking yes +# zstyle ':completion:*:*:docker-*:*' option-stacking yes +__docker_arguments() { + if zstyle -t ":completion:${curcontext}:" option-stacking; then + print -- -s + fi +} + +__docker_get_containers() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + local kind type line s + declare -a running stopped lines args names + + kind=$1; shift + type=$1; shift + [[ $kind = (stopped|all) ]] && args=($args -a) + + lines=(${(f)${:-"$(_call_program commands docker $docker_options ps --format 'table' --no-trunc $args)"$'\n'}}) + + # Parse header line to find columns + local i=1 j=1 k header=${lines[1]} + declare -A begin end + while (( j < ${#header} - 1 )); do + i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) + j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) + k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) + begin[${header[$i,$((j-1))]}]=$i + end[${header[$i,$((j-1))]}]=$k + done + end[${header[$i,$((j-1))]}]=-1 # Last column, should go to the end of the line + lines=(${lines[2,-1]}) + + # Container ID + if [[ $type = (ids|all) ]]; then + for line in $lines; do + s="${${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}[0,12]}" + s="$s:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}" + s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}" + if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = (Exit*|Created*) ]]; then + stopped=($stopped $s) + else + running=($running $s) + fi + done + fi + + # Names: we only display the one without slash. All other names + # are generated and may clutter the completion. However, with + # Swarm, all names may be prefixed by the swarm node name. + if [[ $type = (names|all) ]]; then + for line in $lines; do + names=(${(ps:,:)${${line[${begin[NAMES]},${end[NAMES]}]}%% *}}) + # First step: find a common prefix and strip it (swarm node case) + (( ${#${(u)names%%/*}} == 1 )) && names=${names#${names[1]%%/*}/} + # Second step: only keep the first name without a / + s=${${names:#*/*}[1]} + # If no name, well give up. + (( $#s != 0 )) || continue + s="$s:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}" + s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}" + if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = (Exit*|Created*) ]]; then + stopped=($stopped $s) + else + running=($running $s) + fi + done + fi + + [[ $kind = (running|all) ]] && _describe -t containers-running "running containers" running "$@" && ret=0 + [[ $kind = (stopped|all) ]] && _describe -t containers-stopped "stopped containers" stopped "$@" && ret=0 + return ret +} + +__docker_complete_stopped_containers() { + [[ $PREFIX = -* ]] && return 1 + __docker_get_containers stopped all "$@" +} + +__docker_complete_running_containers() { + [[ $PREFIX = -* ]] && return 1 + __docker_get_containers running all "$@" +} + +__docker_complete_containers() { + [[ $PREFIX = -* ]] && return 1 + __docker_get_containers all all "$@" +} + +__docker_complete_containers_ids() { + [[ $PREFIX = -* ]] && return 1 + __docker_get_containers all ids "$@" +} + +__docker_complete_containers_names() { + [[ $PREFIX = -* ]] && return 1 + __docker_get_containers all names "$@" +} + +__docker_complete_info_plugins() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + emulate -L zsh + setopt extendedglob + local -a plugins + plugins=(${(ps: :)${(M)${(f)${${"$(_call_program commands docker $docker_options info)"##*$'\n'Plugins:}%%$'\n'^ *}}:# $1: *}## $1: }) + _describe -t plugins "$1 plugins" plugins && ret=0 + return ret +} + +__docker_complete_images() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + declare -a images + images=(${${${(f)${:-"$(_call_program commands docker $docker_options images)"$'\n'}}[2,-1]}/(#b)([^ ]##) ##([^ ]##) ##([^ ]##)*/${match[3]}:${(r:15:: :::)match[2]} in ${match[1]}}) + _describe -t docker-images "images" images && ret=0 + __docker_complete_repositories_with_tags && ret=0 + return ret +} + +__docker_complete_repositories() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + declare -a repos + repos=(${${${(f)${:-"$(_call_program commands docker $docker_options images)"$'\n'}}%% *}[2,-1]}) + repos=(${repos#<none>}) + _describe -t docker-repos "repositories" repos && ret=0 + return ret +} + +__docker_complete_repositories_with_tags() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + declare -a repos onlyrepos matched + declare m + repos=(${${${${(f)${:-"$(_call_program commands docker $docker_options images)"$'\n'}}[2,-1]}/ ##/:::}%% *}) + repos=(${${repos%:::<none>}#<none>}) + # Check if we have a prefix-match for the current prefix. + onlyrepos=(${repos%::*}) + for m in $onlyrepos; do + [[ ${PREFIX##${~~m}} != ${PREFIX} ]] && { + # Yes, complete with tags + repos=(${${repos/:::/:}/:/\\:}) + _describe -t docker-repos-with-tags "repositories with tags" repos && ret=0 + return ret + } + done + # No, only complete repositories + onlyrepos=(${${repos%:::*}/:/\\:}) + _describe -t docker-repos "repositories" onlyrepos -qS : && ret=0 + + return ret +} + +__docker_search() { + [[ $PREFIX = -* ]] && return 1 + local cache_policy + zstyle -s ":completion:${curcontext}:" cache-policy cache_policy + if [[ -z "$cache_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy __docker_caching_policy + fi + + local searchterm cachename + searchterm="${words[$CURRENT]%/}" + cachename=_docker-search-$searchterm + + local expl + local -a result + if ( [[ ${(P)+cachename} -eq 0 ]] || _cache_invalid ${cachename#_} ) \ + && ! _retrieve_cache ${cachename#_}; then + _message "Searching for ${searchterm}..." + result=(${${${(f)${:-"$(_call_program commands docker $docker_options search $searchterm)"$'\n'}}%% *}[2,-1]}) + _store_cache ${cachename#_} result + fi + _wanted dockersearch expl 'available images' compadd -a result +} + +__docker_get_log_options() { + [[ $PREFIX = -* ]] && return 1 + + integer ret=1 + local log_driver=${opt_args[--log-driver]:-"all"} + local -a common_options common_options2 awslogs_options fluentd_options gelf_options journald_options json_file_options logentries_options syslog_options splunk_options + + common_options=("max-buffer-size" "mode") + common_options2=("env" "env-regex" "labels") + awslogs_options=($common_options "awslogs-create-group" "awslogs-datetime-format" "awslogs-group" "awslogs-multiline-pattern" "awslogs-region" "awslogs-stream" "tag") + fluentd_options=($common_options $common_options2 "fluentd-address" "fluentd-async-connect" "fluentd-buffer-limit" "fluentd-retry-wait" "fluentd-max-retries" "fluentd-sub-second-precision" "tag") + gcplogs_options=($common_options $common_options2 "gcp-log-cmd" "gcp-meta-id" "gcp-meta-name" "gcp-meta-zone" "gcp-project") + gelf_options=($common_options $common_options2 "gelf-address" "gelf-compression-level" "gelf-compression-type" "tag") + journald_options=($common_options $common_options2 "tag") + json_file_options=($common_options $common_options2 "max-file" "max-size") + logentries_options=($common_options $common_options2 "logentries-token" "tag") + syslog_options=($common_options $common_options2 "syslog-address" "syslog-facility" "syslog-format" "syslog-tls-ca-cert" "syslog-tls-cert" "syslog-tls-key" "syslog-tls-skip-verify" "tag") + splunk_options=($common_options $common_options2 "splunk-caname" "splunk-capath" "splunk-format" "splunk-gzip" "splunk-gzip-level" "splunk-index" "splunk-insecureskipverify" "splunk-source" "splunk-sourcetype" "splunk-token" "splunk-url" "splunk-verify-connection" "tag") + + [[ $log_driver = (awslogs|all) ]] && _describe -t awslogs-options "awslogs options" awslogs_options "$@" && ret=0 + [[ $log_driver = (fluentd|all) ]] && _describe -t fluentd-options "fluentd options" fluentd_options "$@" && ret=0 + [[ $log_driver = (gcplogs|all) ]] && _describe -t gcplogs-options "gcplogs options" gcplogs_options "$@" && ret=0 + [[ $log_driver = (gelf|all) ]] && _describe -t gelf-options "gelf options" gelf_options "$@" && ret=0 + [[ $log_driver = (journald|all) ]] && _describe -t journald-options "journald options" journald_options "$@" && ret=0 + [[ $log_driver = (json-file|all) ]] && _describe -t json-file-options "json-file options" json_file_options "$@" && ret=0 + [[ $log_driver = (logentries|all) ]] && _describe -t logentries-options "logentries options" logentries_options "$@" && ret=0 + [[ $log_driver = (syslog|all) ]] && _describe -t syslog-options "syslog options" syslog_options "$@" && ret=0 + [[ $log_driver = (splunk|all) ]] && _describe -t splunk-options "splunk options" splunk_options "$@" && ret=0 + + return ret +} + +__docker_complete_log_drivers() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + drivers=(awslogs etwlogs fluentd gcplogs gelf journald json-file none splunk syslog) + _describe -t log-drivers "log drivers" drivers && ret=0 + return ret +} + +__docker_complete_log_options() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (syslog-format) + local opts=('rfc3164' 'rfc5424' 'rfc5424micro') + _describe -t syslog-format-opts "syslog format options" opts && ret=0 + ;; + (mode) + local opts=('blocking' 'non-blocking') + _describe -t mode-opts "mode options" opts && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + __docker_get_log_options -qS "=" && ret=0 + fi + + return ret +} + +__docker_complete_detach_keys() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + compset -P "*," + keys=(${:-{a-z}}) + ctrl_keys=(${:-ctrl-{{a-z},{@,'[','\\','^',']',_}}}) + _describe -t detach_keys "[a-z]" keys -qS "," && ret=0 + _describe -t detach_keys-ctrl "'ctrl-' + 'a-z @ [ \\\\ ] ^ _'" ctrl_keys -qS "," && ret=0 +} + +__docker_complete_pid() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + local -a opts vopts + + opts=('host') + vopts=('container') + + if compset -P '*:'; then + case "${${words[-1]%:*}#*=}" in + (container) + __docker_complete_running_containers && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + _describe -t pid-value-opts "PID Options with value" vopts -qS ":" && ret=0 + _describe -t pid-opts "PID Options" opts && ret=0 + fi + + return ret +} + +__docker_complete_runtimes() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + emulate -L zsh + setopt extendedglob + local -a runtimes_opts + runtimes_opts=(${(ps: :)${(f)${${"$(_call_program commands docker $docker_options info)"##*$'\n'Runtimes: }%%$'\n'^ *}}}) + _describe -t runtimes-opts "runtimes options" runtimes_opts && ret=0 +} + +__docker_complete_ps_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (ancestor) + __docker_complete_images && ret=0 + ;; + (before|since) + __docker_complete_containers && ret=0 + ;; + (health) + health_opts=('healthy' 'none' 'starting' 'unhealthy') + _describe -t health-filter-opts "health filter options" health_opts && ret=0 + ;; + (id) + __docker_complete_containers_ids && ret=0 + ;; + (is-task) + _describe -t boolean-filter-opts "filter options" boolean_opts && ret=0 + ;; + (name) + __docker_complete_containers_names && ret=0 + ;; + (network) + __docker_complete_networks && ret=0 + ;; + (status) + status_opts=('created' 'dead' 'exited' 'paused' 'restarting' 'running' 'removing') + _describe -t status-filter-opts "status filter options" status_opts && ret=0 + ;; + (volume) + __docker_complete_volumes && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + opts=('ancestor' 'before' 'exited' 'expose' 'health' 'id' 'label' 'name' 'network' 'publish' 'since' 'status' 'volume') + _describe -t filter-opts "Filter Options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_complete_search_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + declare -a boolean_opts opts + + boolean_opts=('true' 'false') + opts=('is-automated' 'is-official' 'stars') + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (is-automated|is-official) + _describe -t boolean-filter-opts "filter options" boolean_opts && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + _describe -t filter-opts "filter options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_complete_images_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + declare -a boolean_opts opts + + boolean_opts=('true' 'false') + opts=('before' 'dangling' 'label' 'reference' 'since') + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (before|reference|since) + __docker_complete_images && ret=0 + ;; + (dangling) + _describe -t boolean-filter-opts "filter options" boolean_opts && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + _describe -t filter-opts "Filter Options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_complete_events_filter() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + declare -a opts + + opts=('container' 'daemon' 'event' 'image' 'label' 'network' 'type' 'volume') + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (container) + __docker_complete_containers && ret=0 + ;; + (daemon) + emulate -L zsh + setopt extendedglob + local -a daemon_opts + daemon_opts=( + ${(f)${${"$(_call_program commands docker $docker_options info)"##*$'\n'Name: }%%$'\n'^ *}} + ${${(f)${${"$(_call_program commands docker $docker_options info)"##*$'\n'ID: }%%$'\n'^ *}}//:/\\:} + ) + _describe -t daemon-filter-opts "daemon filter options" daemon_opts && ret=0 + ;; + (event) + local -a event_opts + event_opts=('attach' 'commit' 'connect' 'copy' 'create' 'delete' 'destroy' 'detach' 'die' 'disconnect' 'exec_create' 'exec_detach' + 'exec_start' 'export' 'health_status' 'import' 'kill' 'load' 'mount' 'oom' 'pause' 'pull' 'push' 'reload' 'rename' 'resize' 'restart' 'save' 'start' + 'stop' 'tag' 'top' 'unmount' 'unpause' 'untag' 'update') + _describe -t event-filter-opts "event filter options" event_opts && ret=0 + ;; + (image) + __docker_complete_images && ret=0 + ;; + (network) + __docker_complete_networks && ret=0 + ;; + (type) + local -a type_opts + type_opts=('container' 'daemon' 'image' 'network' 'volume') + _describe -t type-filter-opts "type filter options" type_opts && ret=0 + ;; + (volume) + __docker_complete_volumes && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + _describe -t filter-opts "filter options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_complete_prune_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + declare -a opts + + opts=('until') + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + *) + _message 'value' && ret=0 + ;; + esac + else + _describe -t filter-opts "filter options" opts -qS "=" && ret=0 + fi + + return ret +} + +# BO checkpoint + +__docker_checkpoint_commands() { + local -a _docker_checkpoint_subcommands + _docker_checkpoint_subcommands=( + "create:Create a checkpoint from a running container" + "ls:List checkpoints for a container" + "rm:Remove a checkpoint" + ) + _describe -t docker-checkpoint-commands "docker checkpoint command" _docker_checkpoint_subcommands +} + +__docker_checkpoint_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (create) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--checkpoint-dir=[Use a custom checkpoint storage directory]:dir:_directories" \ + "($help)--leave-running[Leave the container running after checkpoint]" \ + "($help -)1:container:__docker_complete_running_containers" \ + "($help -)2:checkpoint: " && ret=0 + ;; + (ls|list) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--checkpoint-dir=[Use a custom checkpoint storage directory]:dir:_directories" \ + "($help -)1:container:__docker_complete_containers" && ret=0 + ;; + (rm|remove) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--checkpoint-dir=[Use a custom checkpoint storage directory]:dir:_directories" \ + "($help -)1:container:__docker_complete_containers" \ + "($help -)2:checkpoint: " && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_checkpoint_commands" && ret=0 + ;; + esac + + return ret +} + +# EO checkpoint + +# BO container + +__docker_container_commands() { + local -a _docker_container_subcommands + _docker_container_subcommands=( + "attach:Attach to a running container" + "commit:Create a new image from a container's changes" + "cp:Copy files/folders between a container and the local filesystem" + "create:Create a new container" + "diff:Inspect changes on a container's filesystem" + "exec:Run a command in a running container" + "export:Export a container's filesystem as a tar archive" + "inspect:Display detailed information on one or more containers" + "kill:Kill one or more running containers" + "logs:Fetch the logs of a container" + "ls:List containers" + "pause:Pause all processes within one or more containers" + "port:List port mappings or a specific mapping for the container" + "prune:Remove all stopped containers" + "rename:Rename a container" + "restart:Restart one or more containers" + "rm:Remove one or more containers" + "run:Run a command in a new container" + "start:Start one or more stopped containers" + "stats:Display a live stream of container(s) resource usage statistics" + "stop:Stop one or more running containers" + "top:Display the running processes of a container" + "unpause:Unpause all processes within one or more containers" + "update:Update configuration of one or more containers" + "wait:Block until one or more containers stop, then print their exit codes" + ) + _describe -t docker-container-commands "docker container command" _docker_container_subcommands +} + +__docker_container_subcommand() { + local -a _command_args opts_help opts_attach_exec_run_start opts_create_run opts_create_run_update + local expl help="--help" + integer ret=1 + + opts_attach_exec_run_start=( + "($help)--detach-keys=[Escape key sequence used to detach a container]:sequence:__docker_complete_detach_keys" + ) + opts_create_run=( + "($help -a --attach)"{-a=,--attach=}"[Attach to stdin, stdout or stderr]:device:(STDIN STDOUT STDERR)" + "($help)*--add-host=[Add a custom host-to-IP mapping]:host\:ip mapping: " + "($help)*--blkio-weight-device=[Block IO (relative device weight)]:device:Block IO weight: " + "($help)*--cap-add=[Add Linux capabilities]:capability: " + "($help)*--cap-drop=[Drop Linux capabilities]:capability: " + "($help)--cgroup-parent=[Parent cgroup for the container]:cgroup: " + "($help)--cidfile=[Write the container ID to the file]:CID file:_files" + "($help)--cpus=[Number of CPUs (default 0.000)]:cpus: " + "($help)*--device=[Add a host device to the container]:device:_files" + "($help)*--device-cgroup-rule=[Add a rule to the cgroup allowed devices list]:device:cgroup: " + "($help)*--device-read-bps=[Limit the read rate (bytes per second) from a device]:device:IO rate: " + "($help)*--device-read-iops=[Limit the read rate (IO per second) from a device]:device:IO rate: " + "($help)*--device-write-bps=[Limit the write rate (bytes per second) to a device]:device:IO rate: " + "($help)*--device-write-iops=[Limit the write rate (IO per second) to a device]:device:IO rate: " + "($help)--disable-content-trust[Skip image verification]" + "($help)*--dns=[Custom DNS servers]:DNS server: " + "($help)*--dns-option=[Custom DNS options]:DNS option: " + "($help)*--dns-search=[Custom DNS search domains]:DNS domains: " + "($help)*"{-e=,--env=}"[Environment variables]:environment variable: " + "($help)--entrypoint=[Overwrite the default entrypoint of the image]:entry point: " + "($help)*--env-file=[Read environment variables from a file]:environment file:_files" + "($help)*--expose=[Expose a port from the container without publishing it]: " + "($help)*--group=[Set one or more supplementary user groups for the container]:group:_groups" + "($help -h --hostname)"{-h=,--hostname=}"[Container host name]:hostname:_hosts" + "($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]" + "($help)--init[Run an init inside the container that forwards signals and reaps processes]" + "($help)--ip=[IPv4 address]:IPv4: " + "($help)--ip6=[IPv6 address]:IPv6: " + "($help)--ipc=[IPC namespace to use]:IPC namespace: " + "($help)--isolation=[Container isolation technology]:isolation:(default hyperv process)" + "($help)*--link=[Add link to another container]:link:->link" + "($help)*--link-local-ip=[Container IPv4/IPv6 link-local addresses]:IPv4/IPv6: " + "($help)*"{-l=,--label=}"[Container metadata]:label: " + "($help)--log-driver=[Default driver for container logs]:logging driver:__docker_complete_log_drivers" + "($help)*--log-opt=[Log driver specific options]:log driver options:__docker_complete_log_options" + "($help)--mac-address=[Container MAC address]:MAC address: " + "($help)*--mount=[Attach a filesystem mount to the container]:mount: " + "($help)--name=[Container name]:name: " + "($help)--network=[Connect a container to a network]:network mode:(bridge none container host)" + "($help)*--network-alias=[Add network-scoped alias for the container]:alias: " + "($help)--oom-kill-disable[Disable OOM Killer]" + "($help)--oom-score-adj[Tune the host's OOM preferences for containers (accepts -1000 to 1000)]" + "($help)--pids-limit[Tune container pids limit (set -1 for unlimited)]" + "($help -P --publish-all)"{-P,--publish-all}"[Publish all exposed ports]" + "($help)*"{-p=,--publish=}"[Expose a container's port to the host]:port:_ports" + "($help)--pid=[PID namespace to use]:PID namespace:__docker_complete_pid" + "($help)--privileged[Give extended privileges to this container]" + "($help)--read-only[Mount the container's root filesystem as read only]" + "($help)*--security-opt=[Security options]:security option: " + "($help)*--shm-size=[Size of '/dev/shm' (format is '<number><unit>')]:shm size: " + "($help)--stop-signal=[Signal to kill a container]:signal:_signals" + "($help)--stop-timeout=[Timeout (in seconds) to stop a container]:time: " + "($help)*--sysctl=-[sysctl options]:sysctl: " + "($help -t --tty)"{-t,--tty}"[Allocate a pseudo-tty]" + "($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users" + "($help)*--ulimit=[ulimit options]:ulimit: " + "($help)--userns=[Container user namespace]:user namespace:(host)" + "($help)--tmpfs[mount tmpfs]" + "($help)*-v[Bind mount a volume]:volume: " + "($help)--volume-driver=[Optional volume driver for the container]:volume driver:(local)" + "($help)*--volumes-from=[Mount volumes from the specified container]:volume: " + "($help -w --workdir)"{-w=,--workdir=}"[Working directory inside the container]:directory:_directories" + ) + opts_create_run_update=( + "($help)--blkio-weight=[Block IO (relative weight), between 10 and 1000]:Block IO weight:(10 100 500 1000)" + "($help -c --cpu-shares)"{-c=,--cpu-shares=}"[CPU shares (relative weight)]:CPU shares:(0 10 100 200 500 800 1000)" + "($help)--cpu-period=[Limit the CPU CFS (Completely Fair Scheduler) period]:CPU period: " + "($help)--cpu-quota=[Limit the CPU CFS (Completely Fair Scheduler) quota]:CPU quota: " + "($help)--cpu-rt-period=[Limit the CPU real-time period]:CPU real-time period in microseconds: " + "($help)--cpu-rt-runtime=[Limit the CPU real-time runtime]:CPU real-time runtime in microseconds: " + "($help)--cpuset-cpus=[CPUs in which to allow execution]:CPUs: " + "($help)--cpuset-mems=[MEMs in which to allow execution]:MEMs: " + "($help)--kernel-memory=[Kernel memory limit in bytes]:Memory limit: " + "($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: " + "($help)--memory-reservation=[Memory soft limit]:Memory limit: " + "($help)--memory-swap=[Total memory limit with swap]:Memory limit: " + "($help)--restart=[Restart policy]:restart policy:(no on-failure always unless-stopped)" + ) + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (attach) + _arguments $(__docker_arguments) \ + $opts_help \ + $opts_attach_exec_run_start \ + "($help)--no-stdin[Do not attach stdin]" \ + "($help)--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]" \ + "($help -):containers:__docker_complete_running_containers" && ret=0 + ;; + (commit) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --author)"{-a=,--author=}"[Author]:author: " \ + "($help)*"{-c=,--change=}"[Apply Dockerfile instruction to the created image]:Dockerfile:_files" \ + "($help -m --message)"{-m=,--message=}"[Commit message]:message: " \ + "($help -p --pause)"{-p,--pause}"[Pause container during commit]" \ + "($help -):container:__docker_complete_containers" \ + "($help -): :__docker_complete_repositories_with_tags" && ret=0 + ;; + (cp) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -L --follow-link)"{-L,--follow-link}"[Always follow symbol link]" \ + "($help -)1:container:->container" \ + "($help -)2:hostpath:_files" && ret=0 + case $state in + (container) + if compset -P "*:"; then + _files && ret=0 + else + __docker_complete_containers -qS ":" && ret=0 + fi + ;; + esac + ;; + (create) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + $opts_create_run \ + $opts_create_run_update \ + "($help -): :__docker_complete_images" \ + "($help -):command: _command_names -e" \ + "($help -)*::arguments: _normal" && ret=0 + case $state in + (link) + if compset -P "*:"; then + _wanted alias expl "Alias" compadd -E "" && ret=0 + else + __docker_complete_running_containers -qS ":" && ret=0 + fi + ;; + esac + ;; + (diff) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)*:containers:__docker_complete_containers" && ret=0 + ;; + (exec) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + $opts_attach_exec_run_start \ + "($help -d --detach)"{-d,--detach}"[Detached mode: leave the container running in the background]" \ + "($help)*"{-e=,--env=}"[Set environment variables]:environment variable: " \ + "($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]" \ + "($help)--privileged[Give extended Linux capabilities to the command]" \ + "($help -t --tty)"{-t,--tty}"[Allocate a pseudo-tty]" \ + "($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users" \ + "($help -w --workdir)"{-w=,--workdir=}"[Working directory inside the container]:directory:_directories" \ + "($help -):containers:__docker_complete_running_containers" \ + "($help -)*::command:->anycommand" && ret=0 + case $state in + (anycommand) + shift 1 words + (( CURRENT-- )) + _normal && ret=0 + ;; + esac + ;; + (export) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -o --output)"{-o=,--output=}"[Write to a file, instead of stdout]:output file:_files" \ + "($help -)*:containers:__docker_complete_containers" && ret=0 + ;; + (inspect) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ + "($help -s --size)"{-s,--size}"[Display total file sizes]" \ + "($help -)*:containers:__docker_complete_containers" && ret=0 + ;; + (kill) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -s --signal)"{-s=,--signal=}"[Signal to send]:signal:_signals" \ + "($help -)*:containers:__docker_complete_running_containers" && ret=0 + ;; + (logs) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--details[Show extra details provided to logs]" \ + "($help -f --follow)"{-f,--follow}"[Follow log output]" \ + "($help -s --since)"{-s=,--since=}"[Show logs since this timestamp]:timestamp: " \ + "($help -t --timestamps)"{-t,--timestamps}"[Show timestamps]" \ + "($help)--tail=[Output the last K lines]:lines:(1 10 20 50 all)" \ + "($help -)*:containers:__docker_complete_containers" && ret=0 + ;; + (ls|list) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --all)"{-a,--all}"[Show all containers]" \ + "($help)--before=[Show only container created before...]:containers:__docker_complete_containers" \ + "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_ps_filters" \ + "($help)--format=[Pretty-print containers using a Go template]:template: " \ + "($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \ + "($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \ + "($help)--no-trunc[Do not truncate output]" \ + "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ + "($help -s --size)"{-s,--size}"[Display total file sizes]" \ + "($help)--since=[Show only containers created since...]:containers:__docker_complete_containers" && ret=0 + ;; + (pause|unpause) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)*:containers:__docker_complete_running_containers" && ret=0 + ;; + (port) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)1:containers:__docker_complete_running_containers" \ + "($help -)2:port:_ports" && ret=0 + ;; + (prune) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*--filter=[Filter values]:filter:__docker_complete_prune_filters" \ + "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 + ;; + (rename) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -):old name:__docker_complete_containers" \ + "($help -):new name: " && ret=0 + ;; + (restart) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \ + "($help -)*:containers:__docker_complete_containers_ids" && ret=0 + ;; + (rm) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --force)"{-f,--force}"[Force removal]" \ + "($help -l --link)"{-l,--link}"[Remove the specified link and not the underlying container]" \ + "($help -v --volumes)"{-v,--volumes}"[Remove the volumes associated to the container]" \ + "($help -)*:containers:->values" && ret=0 + case $state in + (values) + if [[ ${words[(r)-f]} == -f || ${words[(r)--force]} == --force ]]; then + __docker_complete_containers && ret=0 + else + __docker_complete_stopped_containers && ret=0 + fi + ;; + esac + ;; + (run) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + $opts_create_run \ + $opts_create_run_update \ + $opts_attach_exec_run_start \ + "($help -d --detach)"{-d,--detach}"[Detached mode: leave the container running in the background]" \ + "($help)--health-cmd=[Command to run to check health]:command: " \ + "($help)--health-interval=[Time between running the check]:time: " \ + "($help)--health-retries=[Consecutive failures needed to report unhealthy]:retries:(1 2 3 4 5)" \ + "($help)--health-timeout=[Maximum time to allow one check to run]:time: " \ + "($help)--no-healthcheck[Disable any container-specified HEALTHCHECK]" \ + "($help)--rm[Remove intermediate containers when it exits]" \ + "($help)--runtime=[Name of the runtime to be used for that container]:runtime:__docker_complete_runtimes" \ + "($help)--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]" \ + "($help)--storage-opt=[Storage driver options for the container]:storage options:->storage-opt" \ + "($help -): :__docker_complete_images" \ + "($help -):command: _command_names -e" \ + "($help -)*::arguments: _normal" && ret=0 + case $state in + (link) + if compset -P "*:"; then + _wanted alias expl "Alias" compadd -E "" && ret=0 + else + __docker_complete_running_containers -qS ":" && ret=0 + fi + ;; + (storage-opt) + if compset -P "*="; then + _message "value" && ret=0 + else + opts=('size') + _describe -t filter-opts "storage options" opts -qS "=" && ret=0 + fi + ;; + esac + ;; + (start) + _arguments $(__docker_arguments) \ + $opts_help \ + $opts_attach_exec_run_start \ + "($help -a --attach)"{-a,--attach}"[Attach container's stdout/stderr and forward all signals]" \ + "($help -i --interactive)"{-i,--interactive}"[Attach container's stding]" \ + "($help -)*:containers:__docker_complete_stopped_containers" && ret=0 + ;; + (stats) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --all)"{-a,--all}"[Show all containers (default shows just running)]" \ + "($help)--format=[Pretty-print images using a Go template]:template: " \ + "($help)--no-stream[Disable streaming stats and only pull the first result]" \ + "($help)--no-trunc[Do not truncate output]" \ + "($help -)*:containers:__docker_complete_running_containers" && ret=0 + ;; + (stop) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \ + "($help -)*:containers:__docker_complete_running_containers" && ret=0 + ;; + (top) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)1:containers:__docker_complete_running_containers" \ + "($help -)*:: :->ps-arguments" && ret=0 + case $state in + (ps-arguments) + _ps && ret=0 + ;; + esac + ;; + (update) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + opts_create_run_update \ + "($help -)*: :->values" && ret=0 + case $state in + (values) + if [[ ${words[(r)--kernel-memory*]} = (--kernel-memory*) ]]; then + __docker_complete_stopped_containers && ret=0 + else + __docker_complete_containers && ret=0 + fi + ;; + esac + ;; + (wait) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)*:containers:__docker_complete_running_containers" && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_container_commands" && ret=0 + ;; + esac + + return ret +} + +# EO container + +# BO image + +__docker_image_commands() { + local -a _docker_image_subcommands + _docker_image_subcommands=( + "build:Build an image from a Dockerfile" + "history:Show the history of an image" + "import:Import the contents from a tarball to create a filesystem image" + "inspect:Display detailed information on one or more images" + "load:Load an image from a tar archive or STDIN" + "ls:List images" + "prune:Remove unused images" + "pull:Pull an image or a repository from a registry" + "push:Push an image or a repository to a registry" + "rm:Remove one or more images" + "save:Save one or more images to a tar archive (streamed to STDOUT by default)" + "tag:Tag an image into a repository" + ) + _describe -t docker-image-commands "docker image command" _docker_image_subcommands +} + +__docker_image_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (build) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*--add-host=[Add a custom host-to-IP mapping]:host\:ip mapping: " \ + "($help)*--build-arg=[Build-time variables]:<varname>=<value>: " \ + "($help)*--cache-from=[Images to consider as cache sources]: :__docker_complete_repositories_with_tags" \ + "($help -c --cpu-shares)"{-c=,--cpu-shares=}"[CPU shares (relative weight)]:CPU shares:(0 10 100 200 500 800 1000)" \ + "($help)--cgroup-parent=[Parent cgroup for the container]:cgroup: " \ + "($help)--compress[Compress the build context using gzip]" \ + "($help)--cpu-period=[Limit the CPU CFS (Completely Fair Scheduler) period]:CPU period: " \ + "($help)--cpu-quota=[Limit the CPU CFS (Completely Fair Scheduler) quota]:CPU quota: " \ + "($help)--cpu-rt-period=[Limit the CPU real-time period]:CPU real-time period in microseconds: " \ + "($help)--cpu-rt-runtime=[Limit the CPU real-time runtime]:CPU real-time runtime in microseconds: " \ + "($help)--cpuset-cpus=[CPUs in which to allow execution]:CPUs: " \ + "($help)--cpuset-mems=[MEMs in which to allow execution]:MEMs: " \ + "($help)--disable-content-trust[Skip image verification]" \ + "($help -f --file)"{-f=,--file=}"[Name of the Dockerfile]:Dockerfile:_files" \ + "($help)--force-rm[Always remove intermediate containers]" \ + "($help)--isolation=[Container isolation technology]:isolation:(default hyperv process)" \ + "($help)*--label=[Set metadata for an image]:label=value: " \ + "($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: " \ + "($help)--memory-swap=[Total memory limit with swap]:Memory limit: " \ + "($help)--network=[Connect a container to a network]:network mode:(bridge none container host)" \ + "($help)--no-cache[Do not use cache when building the image]" \ + "($help)--pull[Attempt to pull a newer version of the image]" \ + "($help -q --quiet)"{-q,--quiet}"[Suppress verbose build output]" \ + "($help)--rm[Remove intermediate containers after a successful build]" \ + "($help)*--shm-size=[Size of '/dev/shm' (format is '<number><unit>')]:shm size: " \ + "($help)--squash[Squash newly built layers into a single new layer]" \ + "($help -t --tag)*"{-t=,--tag=}"[Repository, name and tag for the image]: :__docker_complete_repositories_with_tags" \ + "($help)*--ulimit=[ulimit options]:ulimit: " \ + "($help)--userns=[Container user namespace]:user namespace:(host)" \ + "($help -):path or URL:_directories" && ret=0 + ;; + (history) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -H --human)"{-H,--human}"[Print sizes and dates in human readable format]" \ + "($help)--no-trunc[Do not truncate output]" \ + "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ + "($help -)*: :__docker_complete_images" && ret=0 + ;; + (import) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*"{-c=,--change=}"[Apply Dockerfile instruction to the created image]:Dockerfile:_files" \ + "($help -m --message)"{-m=,--message=}"[Commit message for imported image]:message: " \ + "($help -):URL:(- http:// file://)" \ + "($help -): :__docker_complete_repositories_with_tags" && ret=0 + ;; + (inspect) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ + "($help -)*:images:__docker_complete_images" && ret=0 + ;; + (load) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -i --input)"{-i=,--input=}"[Read from tar archive file]:archive file:_files -g \"*.((tar|TAR)(.gz|.GZ|.Z|.bz2|.lzma|.xz|)|(tbz|tgz|txz))(-.)\"" \ + "($help -q --quiet)"{-q,--quiet}"[Suppress the load output]" && ret=0 + ;; + (ls|list) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --all)"{-a,--all}"[Show all images]" \ + "($help)--digests[Show digests]" \ + "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_images_filters" \ + "($help)--format=[Pretty-print images using a Go template]:template: " \ + "($help)--no-trunc[Do not truncate output]" \ + "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ + "($help -): :__docker_complete_repositories" && ret=0 + ;; + (prune) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --all)"{-a,--all}"[Remove all unused images, not just dangling ones]" \ + "($help)*--filter=[Filter values]:filter:__docker_complete_prune_filters" \ + "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 + ;; + (pull) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --all-tags)"{-a,--all-tags}"[Download all tagged images]" \ + "($help)--disable-content-trust[Skip image verification]" \ + "($help -):name:__docker_search" && ret=0 + ;; + (push) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--disable-content-trust[Skip image signing]" \ + "($help -): :__docker_complete_images" && ret=0 + ;; + (rm) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --force)"{-f,--force}"[Force removal]" \ + "($help)--no-prune[Do not delete untagged parents]" \ + "($help -)*: :__docker_complete_images" && ret=0 + ;; + (save) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -o --output)"{-o=,--output=}"[Write to file]:file:_files" \ + "($help -)*: :__docker_complete_images" && ret=0 + ;; + (tag) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -):source:__docker_complete_images"\ + "($help -):destination:__docker_complete_repositories_with_tags" && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_container_commands" && ret=0 + ;; + esac + + return ret +} + +# EO image + +# BO network + +__docker_network_complete_ls_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (driver) + __docker_complete_info_plugins Network && ret=0 + ;; + (id) + __docker_complete_networks_ids && ret=0 + ;; + (name) + __docker_complete_networks_names && ret=0 + ;; + (scope) + opts=('global' 'local' 'swarm') + _describe -t scope-filter-opts "Scope filter options" opts && ret=0 + ;; + (type) + opts=('builtin' 'custom') + _describe -t type-filter-opts "Type filter options" opts && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + opts=('driver' 'id' 'label' 'name' 'scope' 'type') + _describe -t filter-opts "Filter Options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_get_networks() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + local line s + declare -a lines networks + + type=$1; shift + + lines=(${(f)${:-"$(_call_program commands docker $docker_options network ls)"$'\n'}}) + + # Parse header line to find columns + local i=1 j=1 k header=${lines[1]} + declare -A begin end + while (( j < ${#header} - 1 )); do + i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) + j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) + k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) + begin[${header[$i,$((j-1))]}]=$i + end[${header[$i,$((j-1))]}]=$k + done + end[${header[$i,$((j-1))]}]=-1 + lines=(${lines[2,-1]}) + + # Network ID + if [[ $type = (ids|all) ]]; then + for line in $lines; do + s="${line[${begin[NETWORK ID]},${end[NETWORK ID]}]%% ##}" + s="$s:${(l:7:: :::)${${line[${begin[DRIVER]},${end[DRIVER]}]}%% ##}}" + s="$s, ${${line[${begin[SCOPE]},${end[SCOPE]}]}%% ##}" + networks=($networks $s) + done + fi + + # Names + if [[ $type = (names|all) ]]; then + for line in $lines; do + s="${line[${begin[NAME]},${end[NAME]}]%% ##}" + s="$s:${(l:7:: :::)${${line[${begin[DRIVER]},${end[DRIVER]}]}%% ##}}" + s="$s, ${${line[${begin[SCOPE]},${end[SCOPE]}]}%% ##}" + networks=($networks $s) + done + fi + + _describe -t networks-list "networks" networks "$@" && ret=0 + return ret +} + +__docker_complete_networks() { + [[ $PREFIX = -* ]] && return 1 + __docker_get_networks all "$@" +} + +__docker_complete_networks_ids() { + [[ $PREFIX = -* ]] && return 1 + __docker_get_networks ids "$@" +} + +__docker_complete_networks_names() { + [[ $PREFIX = -* ]] && return 1 + __docker_get_networks names "$@" +} + +__docker_network_commands() { + local -a _docker_network_subcommands + _docker_network_subcommands=( + "connect:Connect a container to a network" + "create:Creates a new network with a name specified by the user" + "disconnect:Disconnects a container from a network" + "inspect:Displays detailed information on a network" + "ls:Lists all the networks created by the user" + "prune:Remove all unused networks" + "rm:Deletes one or more networks" + ) + _describe -t docker-network-commands "docker network command" _docker_network_subcommands +} + +__docker_network_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (connect) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*--alias=[Add network-scoped alias for the container]:alias: " \ + "($help)--ip=[IPv4 address]:IPv4: " \ + "($help)--ip6=[IPv6 address]:IPv6: " \ + "($help)*--link=[Add a link to another container]:link:->link" \ + "($help)*--link-local-ip=[Add a link-local address for the container]:IPv4/IPv6: " \ + "($help -)1:network:__docker_complete_networks" \ + "($help -)2:containers:__docker_complete_containers" && ret=0 + + case $state in + (link) + if compset -P "*:"; then + _wanted alias expl "Alias" compadd -E "" && ret=0 + else + __docker_complete_running_containers -qS ":" && ret=0 + fi + ;; + esac + ;; + (create) + _arguments $(__docker_arguments) -A '-*' \ + $opts_help \ + "($help)--attachable[Enable manual container attachment]" \ + "($help)*--aux-address[Auxiliary IPv4 or IPv6 addresses used by network driver]:key=IP: " \ + "($help -d --driver)"{-d=,--driver=}"[Driver to manage the Network]:driver:(null host bridge overlay)" \ + "($help)*--gateway=[IPv4 or IPv6 Gateway for the master subnet]:IP: " \ + "($help)--internal[Restricts external access to the network]" \ + "($help)*--ip-range=[Allocate container ip from a sub-range]:IP/mask: " \ + "($help)--ipam-driver=[IP Address Management Driver]:driver:(default)" \ + "($help)*--ipam-opt=[Custom IPAM plugin options]:opt=value: " \ + "($help)--ipv6[Enable IPv6 networking]" \ + "($help)*--label=[Set metadata on a network]:label=value: " \ + "($help)*"{-o=,--opt=}"[Driver specific options]:opt=value: " \ + "($help)*--subnet=[Subnet in CIDR format that represents a network segment]:IP/mask: " \ + "($help -)1:Network Name: " && ret=0 + ;; + (disconnect) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)1:network:__docker_complete_networks" \ + "($help -)2:containers:__docker_complete_containers" && ret=0 + ;; + (inspect) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ + "($help)--verbose[Show detailed information]" \ + "($help -)*:network:__docker_complete_networks" && ret=0 + ;; + (ls) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--no-trunc[Do not truncate the output]" \ + "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_network_complete_ls_filters" \ + "($help)--format=[Pretty-print networks using a Go template]:template: " \ + "($help -q --quiet)"{-q,--quiet}"[Only display numeric IDs]" && ret=0 + ;; + (prune) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*--filter=[Filter values]:filter:__docker_complete_prune_filters" \ + "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 + ;; + (rm) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)*:network:__docker_complete_networks" && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_network_commands" && ret=0 + ;; + esac + + return ret +} + +# EO network + +# BO node + +__docker_node_complete_ls_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (id) + __docker_complete_nodes_ids && ret=0 + ;; + (membership) + membership_opts=('accepted' 'pending' 'rejected') + _describe -t membership-opts "membership options" membership_opts && ret=0 + ;; + (name) + __docker_complete_nodes_names && ret=0 + ;; + (role) + role_opts=('manager' 'worker') + _describe -t role-opts "role options" role_opts && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + opts=('id' 'label' 'membership' 'name' 'role') + _describe -t filter-opts "filter options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_node_complete_ps_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (desired-state) + state_opts=('accepted' 'running' 'shutdown') + _describe -t state-opts "desired state options" state_opts && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + opts=('desired-state' 'id' 'label' 'name') + _describe -t filter-opts "filter options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_nodes() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + local line s + declare -a lines nodes args + + type=$1; shift + filter=$1; shift + [[ $filter != "none" ]] && args=("-f $filter") + + lines=(${(f)${:-"$(_call_program commands docker $docker_options node ls $args)"$'\n'}}) + # Parse header line to find columns + local i=1 j=1 k header=${lines[1]} + declare -A begin end + while (( j < ${#header} - 1 )); do + i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) + j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) + k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) + begin[${header[$i,$((j-1))]}]=$i + end[${header[$i,$((j-1))]}]=$k + done + end[${header[$i,$((j-1))]}]=-1 + lines=(${lines[2,-1]}) + + # Node ID + if [[ $type = (ids|all) ]]; then + for line in $lines; do + s="${line[${begin[ID]},${end[ID]}]%% ##}" + nodes=($nodes $s) + done + fi + + # Names + if [[ $type = (names|all) ]]; then + for line in $lines; do + s="${line[${begin[HOSTNAME]},${end[HOSTNAME]}]%% ##}" + nodes=($nodes $s) + done + fi + + _describe -t nodes-list "nodes" nodes "$@" && ret=0 + return ret +} + +__docker_complete_nodes() { + [[ $PREFIX = -* ]] && return 1 + __docker_nodes all none "$@" +} + +__docker_complete_nodes_ids() { + [[ $PREFIX = -* ]] && return 1 + __docker_nodes ids none "$@" +} + +__docker_complete_nodes_names() { + [[ $PREFIX = -* ]] && return 1 + __docker_nodes names none "$@" +} + +__docker_complete_pending_nodes() { + [[ $PREFIX = -* ]] && return 1 + __docker_nodes all "membership=pending" "$@" +} + +__docker_complete_manager_nodes() { + [[ $PREFIX = -* ]] && return 1 + __docker_nodes all "role=manager" "$@" +} + +__docker_complete_worker_nodes() { + [[ $PREFIX = -* ]] && return 1 + __docker_nodes all "role=worker" "$@" +} + +__docker_node_commands() { + local -a _docker_node_subcommands + _docker_node_subcommands=( + "demote:Demote a node as manager in the swarm" + "inspect:Display detailed information on one or more nodes" + "ls:List nodes in the swarm" + "promote:Promote a node as manager in the swarm" + "rm:Remove one or more nodes from the swarm" + "ps:List tasks running on one or more nodes, defaults to current node" + "update:Update a node" + ) + _describe -t docker-node-commands "docker node command" _docker_node_subcommands +} + +__docker_node_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (rm|remove) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --force)"{-f,--force}"[Force remove a node from the swarm]" \ + "($help -)*:node:__docker_complete_pending_nodes" && ret=0 + ;; + (demote) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)*:node:__docker_complete_manager_nodes" && ret=0 + ;; + (inspect) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ + "($help)--pretty[Print the information in a human friendly format]" \ + "($help -)*:node:__docker_complete_nodes" && ret=0 + ;; + (ls|list) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_node_complete_ls_filters" \ + "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0 + ;; + (promote) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)*:node:__docker_complete_worker_nodes" && ret=0 + ;; + (ps) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --all)"{-a,--all}"[Display all instances]" \ + "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_node_complete_ps_filters" \ + "($help)--format=[Format the output using the given go template]:template: " \ + "($help)--no-resolve[Do not map IDs to Names]" \ + "($help)--no-trunc[Do not truncate output]" \ + "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" \ + "($help -)*:node:__docker_complete_nodes" && ret=0 + ;; + (update) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--availability=[Availability of the node]:availability:(active pause drain)" \ + "($help)*--label-add=[Add or update a node label]:key=value: " \ + "($help)*--label-rm=[Remove a node label if exists]:label: " \ + "($help)--role=[Role of the node]:role:(manager worker)" \ + "($help -)1:node:__docker_complete_nodes" && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_node_commands" && ret=0 + ;; + esac + + return ret +} + +# EO node + +# BO plugin + +__docker_plugin_complete_ls_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (capability) + opts=('authz' 'ipamdriver' 'logdriver' 'metricscollector' 'networkdriver' 'volumedriver') + _describe -t capability-opts "capability options" opts && ret=0 + ;; + (enabled) + opts=('false' 'true') + _describe -t enabled-opts "enabled options" opts && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + opts=('capability' 'enabled') + _describe -t filter-opts "filter options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_plugins() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + local line s + declare -a lines plugins args + + filter=$1; shift + [[ $filter != "none" ]] && args=("-f $filter") + + lines=(${(f)${:-"$(_call_program commands docker $docker_options plugin ls $args)"$'\n'}}) + + # Parse header line to find columns + local i=1 j=1 k header=${lines[1]} + declare -A begin end + while (( j < ${#header} - 1 )); do + i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) + j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) + k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) + begin[${header[$i,$((j-1))]}]=$i + end[${header[$i,$((j-1))]}]=$k + done + end[${header[$i,$((j-1))]}]=-1 + lines=(${lines[2,-1]}) + + # Name + for line in $lines; do + s="${line[${begin[NAME]},${end[NAME]}]%% ##}" + s="$s:${(l:7:: :::)${${line[${begin[TAG]},${end[TAG]}]}%% ##}}" + plugins=($plugins $s) + done + + _describe -t plugins-list "plugins" plugins "$@" && ret=0 + return ret +} + +__docker_complete_plugins() { + [[ $PREFIX = -* ]] && return 1 + __docker_plugins none "$@" +} + +__docker_complete_enabled_plugins() { + [[ $PREFIX = -* ]] && return 1 + __docker_plugins enabled=true "$@" +} + +__docker_complete_disabled_plugins() { + [[ $PREFIX = -* ]] && return 1 + __docker_plugins enabled=false "$@" +} + +__docker_plugin_commands() { + local -a _docker_plugin_subcommands + _docker_plugin_subcommands=( + "disable:Disable a plugin" + "enable:Enable a plugin" + "inspect:Return low-level information about a plugin" + "install:Install a plugin" + "ls:List plugins" + "push:Push a plugin" + "rm:Remove a plugin" + "set:Change settings for a plugin" + "upgrade:Upgrade an existing plugin" + ) + _describe -t docker-plugin-commands "docker plugin command" _docker_plugin_subcommands +} + +__docker_plugin_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (disable) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --force)"{-f,--force}"[Force the disable of an active plugin]" \ + "($help -)1:plugin:__docker_complete_enabled_plugins" && ret=0 + ;; + (enable) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--timeout=[HTTP client timeout (in seconds)]:timeout: " \ + "($help -)1:plugin:__docker_complete_disabled_plugins" && ret=0 + ;; + (inspect) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given Go template]:template: " \ + "($help -)*:plugin:__docker_complete_plugins" && ret=0 + ;; + (install) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--alias=[Local name for plugin]:alias: " \ + "($help)--disable[Do not enable the plugin on install]" \ + "($help)--disable-content-trust[Skip image verification (default true)]" \ + "($help)--grant-all-permissions[Grant all permissions necessary to run the plugin]" \ + "($help -)1:plugin:__docker_complete_plugins" \ + "($help -)*:key=value: " && ret=0 + ;; + (ls|list) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_plugin_complete_ls_filters" \ + "($help --format)--format=[Format the output using the given Go template]:template: " \ + "($help)--no-trunc[Don't truncate output]" \ + "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0 + ;; + (push) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--disable-content-trust[Skip image verification (default true)]" \ + "($help -)1:plugin:__docker_complete_plugins" && ret=0 + ;; + (rm|remove) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --force)"{-f,--force}"[Force the removal of an active plugin]" \ + "($help -)*:plugin:__docker_complete_plugins" && ret=0 + ;; + (set) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)1:plugin:__docker_complete_plugins" \ + "($help -)*:key=value: " && ret=0 + ;; + (upgrade) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--disable-content-trust[Skip image verification (default true)]" \ + "($help)--grant-all-permissions[Grant all permissions necessary to run the plugin]" \ + "($help)--skip-remote-check[Do not check if specified remote plugin matches existing plugin image]" \ + "($help -)1:plugin:__docker_complete_plugins" \ + "($help -):remote: " && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_plugin_commands" && ret=0 + ;; + esac + + return ret +} + +# EO plugin + +# BO secret + +__docker_secrets() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + local line s + declare -a lines secrets + + type=$1; shift + + lines=(${(f)${:-"$(_call_program commands docker $docker_options secret ls)"$'\n'}}) + + # Parse header line to find columns + local i=1 j=1 k header=${lines[1]} + declare -A begin end + while (( j < ${#header} - 1 )); do + i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) + j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) + k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) + begin[${header[$i,$((j-1))]}]=$i + end[${header[$i,$((j-1))]}]=$k + done + end[${header[$i,$((j-1))]}]=-1 + lines=(${lines[2,-1]}) + + # ID + if [[ $type = (ids|all) ]]; then + for line in $lines; do + s="${line[${begin[ID]},${end[ID]}]%% ##}" + secrets=($secrets $s) + done + fi + + # Names + if [[ $type = (names|all) ]]; then + for line in $lines; do + s="${line[${begin[NAME]},${end[NAME]}]%% ##}" + secrets=($secrets $s) + done + fi + + _describe -t secrets-list "secrets" secrets "$@" && ret=0 + return ret +} + +__docker_complete_secrets() { + [[ $PREFIX = -* ]] && return 1 + __docker_secrets all "$@" +} + +__docker_secret_commands() { + local -a _docker_secret_subcommands + _docker_secret_subcommands=( + "create:Create a secret using stdin as content" + "inspect:Display detailed information on one or more secrets" + "ls:List secrets" + "rm:Remove one or more secrets" + ) + _describe -t docker-secret-commands "docker secret command" _docker_secret_subcommands +} + +__docker_secret_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (create) + _arguments $(__docker_arguments) -A '-*' \ + $opts_help \ + "($help)*"{-l=,--label=}"[Secret labels]:label: " \ + "($help -):secret: " && ret=0 + ;; + (inspect) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given Go template]:template: " \ + "($help -)*:secret:__docker_complete_secrets" && ret=0 + ;; + (ls|list) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--format=[Format the output using the given go template]:template: " \ + "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0 + ;; + (rm|remove) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)*:secret:__docker_complete_secrets" && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_secret_commands" && ret=0 + ;; + esac + + return ret +} + +# EO secret + +# BO service + +__docker_service_complete_ls_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (id) + __docker_complete_services_ids && ret=0 + ;; + (mode) + opts=('global' 'replicated') + _describe -t mode-opts "mode options" opts && ret=0 + ;; + (name) + __docker_complete_services_names && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + opts=('id' 'label' 'mode' 'name') + _describe -t filter-opts "filter options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_service_complete_ps_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (desired-state) + state_opts=('accepted' 'running' 'shutdown') + _describe -t state-opts "desired state options" state_opts && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + opts=('desired-state' 'id' 'label' 'name') + _describe -t filter-opts "filter options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_service_complete_placement_pref() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (spread) + opts=('engine.labels' 'node.labels') + _describe -t spread-opts "spread options" opts -qS "." && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + opts=('spread') + _describe -t pref-opts "placement pref options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_services() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + local line s + declare -a lines services + + type=$1; shift + + lines=(${(f)${:-"$(_call_program commands docker $docker_options service ls)"$'\n'}}) + + # Parse header line to find columns + local i=1 j=1 k header=${lines[1]} + declare -A begin end + while (( j < ${#header} - 1 )); do + i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) + j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) + k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) + begin[${header[$i,$((j-1))]}]=$i + end[${header[$i,$((j-1))]}]=$k + done + end[${header[$i,$((j-1))]}]=-1 + lines=(${lines[2,-1]}) + + # Service ID + if [[ $type = (ids|all) ]]; then + for line in $lines; do + s="${line[${begin[ID]},${end[ID]}]%% ##}" + s="$s:${(l:7:: :::)${${line[${begin[IMAGE]},${end[IMAGE]}]}%% ##}}" + services=($services $s) + done + fi + + # Names + if [[ $type = (names|all) ]]; then + for line in $lines; do + s="${line[${begin[NAME]},${end[NAME]}]%% ##}" + s="$s:${(l:7:: :::)${${line[${begin[IMAGE]},${end[IMAGE]}]}%% ##}}" + services=($services $s) + done + fi + + _describe -t services-list "services" services "$@" && ret=0 + return ret +} + +__docker_complete_services() { + [[ $PREFIX = -* ]] && return 1 + __docker_services all "$@" +} + +__docker_complete_services_ids() { + [[ $PREFIX = -* ]] && return 1 + __docker_services ids "$@" +} + +__docker_complete_services_names() { + [[ $PREFIX = -* ]] && return 1 + __docker_services names "$@" +} + +__docker_service_commands() { + local -a _docker_service_subcommands + _docker_service_subcommands=( + "create:Create a new service" + "inspect:Display detailed information on one or more services" + "logs:Fetch the logs of a service or task" + "ls:List services" + "rm:Remove one or more services" + "rollback:Revert changes to a service's configuration" + "scale:Scale one or multiple replicated services" + "ps:List the tasks of a service" + "update:Update a service" + ) + _describe -t docker-service-commands "docker service command" _docker_service_subcommands +} + +__docker_service_subcommand() { + local -a _command_args opts_help opts_create_update + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + opts_create_update=( + "($help)*--constraint=[Placement constraints]:constraint: " + "($help)--endpoint-mode=[Placement constraints]:mode:(dnsrr vip)" + "($help)*"{-e=,--env=}"[Set environment variables]:env: " + "($help)--health-cmd=[Command to run to check health]:command: " + "($help)--health-interval=[Time between running the check]:time: " + "($help)--health-retries=[Consecutive failures needed to report unhealthy]:retries:(1 2 3 4 5)" + "($help)--health-timeout=[Maximum time to allow one check to run]:time: " + "($help)--hostname=[Service container hostname]:hostname: " \ + "($help)--isolation=[Service container isolation mode]:isolation:(default process hyperv)" \ + "($help)*--label=[Service labels]:label: " + "($help)--limit-cpu=[Limit CPUs]:value: " + "($help)--limit-memory=[Limit Memory]:value: " + "($help)--log-driver=[Logging driver for service]:logging driver:__docker_complete_log_drivers" + "($help)*--log-opt=[Logging driver options]:log driver options:__docker_complete_log_options" + "($help)*--mount=[Attach a filesystem mount to the service]:mount: " + "($help)*--network=[Network attachments]:network: " + "($help)--no-healthcheck[Disable any container-specified HEALTHCHECK]" + "($help)--read-only[Mount the container's root filesystem as read only]" + "($help)--replicas=[Number of tasks]:replicas: " + "($help)--reserve-cpu=[Reserve CPUs]:value: " + "($help)--reserve-memory=[Reserve Memory]:value: " + "($help)--restart-condition=[Restart when condition is met]:mode:(any none on-failure)" + "($help)--restart-delay=[Delay between restart attempts]:delay: " + "($help)--restart-max-attempts=[Maximum number of restarts before giving up]:max-attempts: " + "($help)--restart-window=[Window used to evaluate the restart policy]:duration: " + "($help)--rollback-delay=[Delay between task rollbacks]:duration: " + "($help)--rollback-failure-action=[Action on rollback failure]:action:(continue pause)" + "($help)--rollback-max-failure-ratio=[Failure rate to tolerate during a rollback]:failure rate: " + "($help)--rollback-monitor=[Duration after each task rollback to monitor for failure]:duration: " + "($help)--rollback-parallelism=[Maximum number of tasks rolled back simultaneously]:number: " + "($help)*--secret=[Specify secrets to expose to the service]:secret:__docker_complete_secrets" + "($help)--stop-grace-period=[Time to wait before force killing a container]:grace period: " + "($help)--stop-signal=[Signal to stop the container]:signal:_signals" + "($help -t --tty)"{-t,--tty}"[Allocate a pseudo-TTY]" + "($help)--update-delay=[Delay between updates]:delay: " + "($help)--update-failure-action=[Action on update failure]:mode:(continue pause rollback)" + "($help)--update-max-failure-ratio=[Failure rate to tolerate during an update]:fraction: " + "($help)--update-monitor=[Duration after each task update to monitor for failure]:window: " + "($help)--update-parallelism=[Maximum number of tasks updated simultaneously]:number: " + "($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users" + "($help)--with-registry-auth[Send registry authentication details to swarm agents]" + "($help -w --workdir)"{-w=,--workdir=}"[Working directory inside the container]:directory:_directories" + ) + + case "$words[1]" in + (create) + _arguments $(__docker_arguments) \ + $opts_help \ + $opts_create_update \ + "($help)*--container-label=[Container labels]:label: " \ + "($help)*--dns=[Set custom DNS servers]:DNS: " \ + "($help)*--dns-option=[Set DNS options]:DNS option: " \ + "($help)*--dns-search=[Set custom DNS search domains]:DNS search: " \ + "($help)*--env-file=[Read environment variables from a file]:environment file:_files" \ + "($help)--mode=[Service Mode]:mode:(global replicated)" \ + "($help)--name=[Service name]:name: " \ + "($help)*--placement-pref=[Add a placement preference]:pref:__docker_service_complete_placement_pref" \ + "($help)*"{-p=,--publish=}"[Publish a port as a node port]:port: " \ + "($help -): :__docker_complete_images" \ + "($help -):command: _command_names -e" \ + "($help -)*::arguments: _normal" && ret=0 + ;; + (inspect) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ + "($help)--pretty[Print the information in a human friendly format]" \ + "($help -)*:service:__docker_complete_services" && ret=0 + ;; + (logs) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --follow)"{-f,--follow}"[Follow log output]" \ + "($help)--no-resolve[Do not map IDs to Names]" \ + "($help)--no-task-ids[Do not include task IDs]" \ + "($help)--no-trunc[Do not truncate output]" \ + "($help)--since=[Show logs since timestamp]:timestamp: " \ + "($help)--tail=[Number of lines to show from the end of the logs]:lines:(1 10 20 50 all)" \ + "($help -t --timestamps)"{-t,--timestamps}"[Show timestamps]" \ + "($help -)1:service:__docker_complete_services" && ret=0 + ;; + (ls|list) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_service_complete_ls_filters" \ + "($help)--format=[Pretty-print services using a Go template]:template: " \ + "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0 + ;; + (rm|remove) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)*:service:__docker_complete_services" && ret=0 + ;; + (rollback) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -d --detach)"{-d=false,--detach=false}"[Disable detached mode]" \ + "($help -q --quiet)"{-q,--quiet}"[Suppress progress output]" \ + "($help -)*:service:__docker_complete_services" && ret=0 + ;; + (scale) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -d --detach)"{-d=false,--detach=false}"[Disable detached mode]" \ + "($help -)*:service:->values" && ret=0 + case $state in + (values) + if compset -P '*='; then + _message 'replicas' && ret=0 + else + __docker_complete_services -qS "=" + fi + ;; + esac + ;; + (ps) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_service_complete_ps_filters" \ + "($help)--format=[Format the output using the given go template]:template: " \ + "($help)--no-resolve[Do not map IDs to Names]" \ + "($help)--no-trunc[Do not truncate output]" \ + "($help -q --quiet)"{-q,--quiet}"[Only display task IDs]" \ + "($help -)*:service:__docker_complete_services" && ret=0 + ;; + (update) + _arguments $(__docker_arguments) \ + $opts_help \ + $opts_create_update \ + "($help)--arg=[Service command args]:arguments: _normal" \ + "($help)*--container-label-add=[Add or update container labels]:label: " \ + "($help)*--container-label-rm=[Remove a container label by its key]:label: " \ + "($help)*--dns-add=[Add or update custom DNS servers]:DNS: " \ + "($help)*--dns-rm=[Remove custom DNS servers]:DNS: " \ + "($help)*--dns-option-add=[Add or update DNS options]:DNS option: " \ + "($help)*--dns-option-rm=[Remove DNS options]:DNS option: " \ + "($help)*--dns-search-add=[Add or update custom DNS search domains]:DNS search: " \ + "($help)*--dns-search-rm=[Remove DNS search domains]:DNS search: " \ + "($help)--force[Force update]" \ + "($help)*--group-add=[Add additional supplementary user groups to the container]:group:_groups" \ + "($help)*--group-rm=[Remove previously added supplementary user groups from the container]:group:_groups" \ + "($help)--image=[Service image tag]:image:__docker_complete_repositories" \ + "($help)*--placement-pref-add=[Add a placement preference]:pref:__docker_service_complete_placement_pref" \ + "($help)*--placement-pref-rm=[Remove a placement preference]:pref:__docker_service_complete_placement_pref" \ + "($help)*--publish-add=[Add or update a port]:port: " \ + "($help)*--publish-rm=[Remove a port(target-port mandatory)]:port: " \ + "($help)--rollback[Rollback to previous specification]" \ + "($help -)1:service:__docker_complete_services" && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_service_commands" && ret=0 + ;; + esac + + return ret +} + +# EO service + +# BO stack + +__docker_stack_complete_ps_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (desired-state) + state_opts=('accepted' 'running' 'shutdown') + _describe -t state-opts "desired state options" state_opts && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + opts=('desired-state' 'id' 'name') + _describe -t filter-opts "filter options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_stack_complete_services_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + *) + _message 'value' && ret=0 + ;; + esac + else + opts=('id' 'label' 'name') + _describe -t filter-opts "filter options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_stacks() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + local line s + declare -a lines stacks + + lines=(${(f)${:-"$(_call_program commands docker $docker_options stack ls)"$'\n'}}) + + # Parse header line to find columns + local i=1 j=1 k header=${lines[1]} + declare -A begin end + while (( j < ${#header} - 1 )); do + i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) + j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) + k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) + begin[${header[$i,$((j-1))]}]=$i + end[${header[$i,$((j-1))]}]=$k + done + end[${header[$i,$((j-1))]}]=-1 + lines=(${lines[2,-1]}) + + # Service NAME + for line in $lines; do + s="${line[${begin[NAME]},${end[NAME]}]%% ##}" + stacks=($stacks $s) + done + + _describe -t stacks-list "stacks" stacks "$@" && ret=0 + return ret +} + +__docker_complete_stacks() { + [[ $PREFIX = -* ]] && return 1 + __docker_stacks "$@" +} + +__docker_stack_commands() { + local -a _docker_stack_subcommands + _docker_stack_subcommands=( + "deploy:Deploy a new stack or update an existing stack" + "ls:List stacks" + "ps:List the tasks in the stack" + "rm:Remove the stack" + "services:List the services in the stack" + ) + _describe -t docker-stack-commands "docker stack command" _docker_stack_subcommands +} + +__docker_stack_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (deploy|up) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--bundle-file=[Path to a Distributed Application Bundle file]:dab:_files -g \"*.dab\"" \ + "($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file]:compose file:_files -g \"*.(yml|yaml)\"" \ + "($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \ + "($help -):stack:__docker_complete_stacks" && ret=0 + ;; + (ls|list) + _arguments $(__docker_arguments) \ + $opts_help && ret=0 + ;; + (ps) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --all)"{-a,--all}"[Display all tasks]" \ + "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_stack_complete_ps_filters" \ + "($help)--format=[Format the output using the given go template]:template: " \ + "($help)--no-resolve[Do not map IDs to Names]" \ + "($help)--no-trunc[Do not truncate output]" \ + "($help -q --quiet)"{-q,--quiet}"[Only display task IDs]" \ + "($help -):stack:__docker_complete_stacks" && ret=0 + ;; + (rm|remove|down) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -):stack:__docker_complete_stacks" && ret=0 + ;; + (services) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_stack_complete_services_filters" \ + "($help)--format=[Pretty-print services using a Go template]:template: " \ + "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" \ + "($help -):stack:__docker_complete_stacks" && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_stack_commands" && ret=0 + ;; + esac + + return ret +} + +# EO stack + +# BO swarm + +__docker_swarm_commands() { + local -a _docker_swarm_subcommands + _docker_swarm_subcommands=( + "init:Initialize a swarm" + "join:Join a swarm as a node and/or manager" + "join-token:Manage join tokens" + "leave:Leave a swarm" + "unlock:Unlock swarm" + "unlock-key:Manage the unlock key" + "update:Update the swarm" + ) + _describe -t docker-swarm-commands "docker swarm command" _docker_swarm_subcommands +} + +__docker_swarm_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (init) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--advertise-addr=[Advertised address]:ip\:port: " \ + "($help)--data-path-addr=[Data path IP or interface]:ip " \ + "($help)--autolock[Enable manager autolocking]" \ + "($help)--availability=[Availability of the node]:availability:(active drain pause)" \ + "($help)--cert-expiry=[Validity period for node certificates]:duration: " \ + "($help)--dispatcher-heartbeat=[Dispatcher heartbeat period]:duration: " \ + "($help)*--external-ca=[Specifications of one or more certificate signing endpoints]:endpoint: " \ + "($help)--force-new-cluster[Force create a new cluster from current state]" \ + "($help)--listen-addr=[Listen address]:ip\:port: " \ + "($help)--max-snapshots[Number of additional Raft snapshots to retain]" \ + "($help)--snapshot-interval[Number of log entries between Raft snapshots]" \ + "($help)--task-history-limit=[Task history retention limit]:limit: " && ret=0 + ;; + (join) + _arguments $(__docker_arguments) -A '-*' \ + $opts_help \ + "($help)--advertise-addr=[Advertised address]:ip\:port: " \ + "($help)--data-path-addr=[Data path IP or interface]:ip " \ + "($help)--availability=[Availability of the node]:availability:(active drain pause)" \ + "($help)--listen-addr=[Listen address]:ip\:port: " \ + "($help)--token=[Token for entry into the swarm]:secret: " \ + "($help -):host\:port: " && ret=0 + ;; + (join-token) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -q --quiet)"{-q,--quiet}"[Only display token]" \ + "($help)--rotate[Rotate join token]" \ + "($help -):role:(manager worker)" && ret=0 + ;; + (leave) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --force)"{-f,--force}"[Force this node to leave the swarm, ignoring warnings]" && ret=0 + ;; + (unlock) + _arguments $(__docker_arguments) \ + $opts_help && ret=0 + ;; + (unlock-key) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -q --quiet)"{-q,--quiet}"[Only display token]" \ + "($help)--rotate[Rotate unlock token]" && ret=0 + ;; + (update) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--autolock[Enable manager autolocking]" \ + "($help)--cert-expiry=[Validity period for node certificates]:duration: " \ + "($help)--dispatcher-heartbeat=[Dispatcher heartbeat period]:duration: " \ + "($help)*--external-ca=[Specifications of one or more certificate signing endpoints]:endpoint: " \ + "($help)--max-snapshots[Number of additional Raft snapshots to retain]" \ + "($help)--snapshot-interval[Number of log entries between Raft snapshots]" \ + "($help)--task-history-limit=[Task history retention limit]:limit: " && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_network_commands" && ret=0 + ;; + esac + + return ret +} + +# EO swarm + +# BO system + +__docker_system_commands() { + local -a _docker_system_subcommands + _docker_system_subcommands=( + "df:Show docker filesystem usage" + "events:Get real time events from the server" + "info:Display system-wide information" + "prune:Remove unused data" + ) + _describe -t docker-system-commands "docker system command" _docker_system_subcommands +} + +__docker_system_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (df) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -v --verbose)"{-v,--verbose}"[Show detailed information on space usage]" && ret=0 + ;; + (events) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_events_filter" \ + "($help)--since=[Events created since this timestamp]:timestamp: " \ + "($help)--until=[Events created until this timestamp]:timestamp: " \ + "($help)--format=[Format the output using the given go template]:template: " && ret=0 + ;; + (info) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0 + ;; + (prune) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --all)"{-a,--all}"[Remove all unused data, not just dangling ones]" \ + "($help)*--filter=[Filter values]:filter:__docker_complete_prune_filters" \ + "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" \ + "($help)--volumes=[Remove all unused volumes]" && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_volume_commands" && ret=0 + ;; + esac + + return ret +} + +# EO system + +# BO volume + +__docker_volume_complete_ls_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (dangling) + dangling_opts=('true' 'false') + _describe -t dangling-filter-opts "Dangling Filter Options" dangling_opts && ret=0 + ;; + (driver) + __docker_complete_info_plugins Volume && ret=0 + ;; + (name) + __docker_complete_volumes && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + opts=('dangling' 'driver' 'label' 'name') + _describe -t filter-opts "Filter Options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_complete_volumes() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + declare -a lines volumes + + lines=(${(f)${:-"$(_call_program commands docker $docker_options volume ls)"$'\n'}}) + + # Parse header line to find columns + local i=1 j=1 k header=${lines[1]} + declare -A begin end + while (( j < ${#header} - 1 )); do + i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) + j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) + k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) + begin[${header[$i,$((j-1))]}]=$i + end[${header[$i,$((j-1))]}]=$k + done + end[${header[$i,$((j-1))]}]=-1 + lines=(${lines[2,-1]}) + + # Names + local line s + for line in $lines; do + s="${line[${begin[VOLUME NAME]},${end[VOLUME NAME]}]%% ##}" + s="$s:${(l:7:: :::)${${line[${begin[DRIVER]},${end[DRIVER]}]}%% ##}}" + volumes=($volumes $s) + done + + _describe -t volumes-list "volumes" volumes && ret=0 + return ret +} + +__docker_volume_commands() { + local -a _docker_volume_subcommands + _docker_volume_subcommands=( + "create:Create a volume" + "inspect:Display detailed information on one or more volumes" + "ls:List volumes" + "prune:Remove all unused volumes" + "rm:Remove one or more volumes" + ) + _describe -t docker-volume-commands "docker volume command" _docker_volume_subcommands +} + +__docker_volume_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (create) + _arguments $(__docker_arguments) -A '-*' \ + $opts_help \ + "($help -d --driver)"{-d=,--driver=}"[Volume driver name]:Driver name:(local)" \ + "($help)*--label=[Set metadata for a volume]:label=value: " \ + "($help)*"{-o=,--opt=}"[Driver specific options]:Driver option: " \ + "($help -)1:Volume name: " && ret=0 + ;; + (inspect) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ + "($help -)1:volume:__docker_complete_volumes" && ret=0 + ;; + (ls) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_volume_complete_ls_filters" \ + "($help)--format=[Pretty-print volumes using a Go template]:template: " \ + "($help -q --quiet)"{-q,--quiet}"[Only display volume names]" && ret=0 + ;; + (prune) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 + ;; + (rm) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --force)"{-f,--force}"[Force the removal of one or more volumes]" \ + "($help -):volume:__docker_complete_volumes" && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_volume_commands" && ret=0 + ;; + esac + + return ret +} + +# EO volume + +__docker_caching_policy() { + oldp=( "$1"(Nmh+1) ) # 1 hour + (( $#oldp )) +} + +__docker_commands() { + local cache_policy + integer force_invalidation=0 + + zstyle -s ":completion:${curcontext}:" cache-policy cache_policy + if [[ -z "$cache_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy __docker_caching_policy + fi + + if ( (( ! ${+_docker_hide_legacy_commands} )) || _cache_invalid docker_hide_legacy_commands ) \ + && ! _retrieve_cache docker_hide_legacy_commands; + then + _docker_hide_legacy_commands="${DOCKER_HIDE_LEGACY_COMMANDS}" + _store_cache docker_hide_legacy_commands _docker_hide_legacy_commands + fi + + if [[ "${_docker_hide_legacy_commands}" != "${DOCKER_HIDE_LEGACY_COMMANDS}" ]]; then + force_invalidation=1 + _docker_hide_legacy_commands="${DOCKER_HIDE_LEGACY_COMMANDS}" + _store_cache docker_hide_legacy_commands _docker_hide_legacy_commands + fi + + if ( [[ ${+_docker_subcommands} -eq 0 ]] || _cache_invalid docker_subcommands ) \ + && ! _retrieve_cache docker_subcommands || [[ ${force_invalidation} -eq 1 ]]; + then + local -a lines + lines=(${(f)"$(_call_program commands docker 2>&1)"}) + _docker_subcommands=(${${${(M)${lines[$((${lines[(i)*Commands:]} + 1)),-1]}:# *}## #}/ ##/:}) + _docker_subcommands=($_docker_subcommands 'daemon:Enable daemon mode' 'help:Show help for a command') + (( $#_docker_subcommands > 2 )) && _store_cache docker_subcommands _docker_subcommands + fi + _describe -t docker-commands "docker command" _docker_subcommands +} + +__docker_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (attach|commit|cp|create|diff|exec|export|kill|logs|pause|unpause|port|rename|restart|rm|run|start|stats|stop|top|update|wait) + __docker_container_subcommand && ret=0 + ;; + (build|history|import|load|pull|push|save|tag) + __docker_image_subcommand && ret=0 + ;; + (checkpoint) + local curcontext="$curcontext" state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_checkpoint_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_checkpoint_subcommand && ret=0 + ;; + esac + ;; + (container) + local curcontext="$curcontext" state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_container_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_container_subcommand && ret=0 + ;; + esac + ;; + (daemon) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*--add-runtime=[Register an additional OCI compatible runtime]:runtime:__docker_complete_runtimes" \ + "($help)*--allow-nondistributable-artifacts=[Push nondistributable artifacts to specified registries]:registry: " \ + "($help)--api-cors-header=[CORS headers in the Engine API]:CORS headers: " \ + "($help)*--authorization-plugin=[Authorization plugins to load]" \ + "($help -b --bridge)"{-b=,--bridge=}"[Attach containers to a network bridge]:bridge:_net_interfaces" \ + "($help)--bip=[Network bridge IP]:IP address: " \ + "($help)--cgroup-parent=[Parent cgroup for all containers]:cgroup: " \ + "($help)--cluster-advertise=[Address or interface name to advertise]:Instance to advertise (host\:port): " \ + "($help)--cluster-store=[URL of the distributed storage backend]:Cluster Store:->cluster-store" \ + "($help)*--cluster-store-opt=[Cluster store options]:Cluster options:->cluster-store-options" \ + "($help)--config-file=[Path to daemon configuration file]:Config File:_files" \ + "($help)--containerd=[Path to containerd socket]:socket:_files -g \"*.sock\"" \ + "($help)--data-root=[Root directory of persisted Docker data]:path:_directories" \ + "($help -D --debug)"{-D,--debug}"[Enable debug mode]" \ + "($help)--default-gateway[Container default gateway IPv4 address]:IPv4 address: " \ + "($help)--default-gateway-v6[Container default gateway IPv6 address]:IPv6 address: " \ + "($help)--default-shm-size=[Default shm size for containers]:size:" \ + "($help)*--default-ulimit=[Default ulimits for containers]:ulimit: " \ + "($help)*--dns=[DNS server to use]:DNS: " \ + "($help)*--dns-opt=[DNS options to use]:DNS option: " \ + "($help)*--dns-search=[DNS search domains to use]:DNS search: " \ + "($help)*--exec-opt=[Runtime execution options]:runtime execution options: " \ + "($help)--exec-root=[Root directory for execution state files]:path:_directories" \ + "($help)--experimental[Enable experimental features]" \ + "($help)--fixed-cidr=[IPv4 subnet for fixed IPs]:IPv4 subnet: " \ + "($help)--fixed-cidr-v6=[IPv6 subnet for fixed IPs]:IPv6 subnet: " \ + "($help -G --group)"{-G=,--group=}"[Group for the unix socket]:group:_groups" \ + "($help -H --host)"{-H=,--host=}"[tcp://host:port to bind/connect to]:host: " \ + "($help)--icc[Enable inter-container communication]" \ + "($help)--init[Run an init inside containers to forward signals and reap processes]" \ + "($help)--init-path=[Path to the docker-init binary]:docker-init binary:_files" \ + "($help)*--insecure-registry=[Enable insecure registry communication]:registry: " \ + "($help)--ip=[Default IP when binding container ports]" \ + "($help)--ip-forward[Enable net.ipv4.ip_forward]" \ + "($help)--ip-masq[Enable IP masquerading]" \ + "($help)--iptables[Enable addition of iptables rules]" \ + "($help)--ipv6[Enable IPv6 networking]" \ + "($help -l --log-level)"{-l=,--log-level=}"[Logging level]:level:(debug info warn error fatal)" \ + "($help)*--label=[Key=value labels]:label: " \ + "($help)--live-restore[Enable live restore of docker when containers are still running]" \ + "($help)--log-driver=[Default driver for container logs]:logging driver:__docker_complete_log_drivers" \ + "($help)*--log-opt=[Default log driver options for containers]:log driver options:__docker_complete_log_options" \ + "($help)--max-concurrent-downloads[Set the max concurrent downloads for each pull]" \ + "($help)--max-concurrent-uploads[Set the max concurrent uploads for each push]" \ + "($help)--mtu=[Network MTU]:mtu:(0 576 1420 1500 9000)" \ + "($help)--oom-score-adjust=[Set the oom_score_adj for the daemon]:oom-score:(-500)" \ + "($help -p --pidfile)"{-p=,--pidfile=}"[Path to use for daemon PID file]:PID file:_files" \ + "($help)--raw-logs[Full timestamps without ANSI coloring]" \ + "($help)*--registry-mirror=[Preferred Docker registry mirror]:registry mirror: " \ + "($help)--seccomp-profile=[Path to seccomp profile]:path:_files -g \"*.json\"" \ + "($help -s --storage-driver)"{-s=,--storage-driver=}"[Storage driver to use]:driver:(aufs btrfs devicemapper overlay overlay2 vfs zfs)" \ + "($help)--selinux-enabled[Enable selinux support]" \ + "($help)--shutdown-timeout=[Set the shutdown timeout value in seconds]:time: " \ + "($help)*--storage-opt=[Storage driver options]:storage driver options: " \ + "($help)--tls[Use TLS]" \ + "($help)--tlscacert=[Trust certs signed only by this CA]:PEM file:_files -g \"*.(pem|crt)\"" \ + "($help)--tlscert=[Path to TLS certificate file]:PEM file:_files -g \"*.(pem|crt)\"" \ + "($help)--tlskey=[Path to TLS key file]:Key file:_files -g \"*.(pem|key)\"" \ + "($help)--tlsverify[Use TLS and verify the remote]" \ + "($help)--userns-remap=[User/Group setting for user namespaces]:user\:group:->users-groups" \ + "($help)--userland-proxy[Use userland proxy for loopback traffic]" \ + "($help)--userland-proxy-path=[Path to the userland proxy binary]:binary:_files" && ret=0 + + case $state in + (cluster-store) + if compset -P '*://'; then + _message 'host:port' && ret=0 + else + store=('consul' 'etcd' 'zk') + _describe -t cluster-store "Cluster Store" store -qS "://" && ret=0 + fi + ;; + (cluster-store-options) + if compset -P '*='; then + _files && ret=0 + else + opts=('discovery.heartbeat' 'discovery.ttl' 'kv.cacertfile' 'kv.certfile' 'kv.keyfile' 'kv.path') + _describe -t cluster-store-opts "Cluster Store Options" opts -qS "=" && ret=0 + fi + ;; + (users-groups) + if compset -P '*:'; then + _groups && ret=0 + else + _describe -t userns-default "default Docker user management" '(default)' && ret=0 + _users && ret=0 + fi + ;; + esac + ;; + (events|info) + __docker_system_subcommand && ret=0 + ;; + (image) + local curcontext="$curcontext" state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_image_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_image_subcommand && ret=0 + ;; + esac + ;; + (images) + words[1]='ls' + __docker_image_subcommand && ret=0 + ;; + (inspect) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ + "($help -s --size)"{-s,--size}"[Display total file sizes if the type is container]" \ + "($help)--type=[Return JSON for specified type]:type:(container image network node plugin service volume)" \ + "($help -)*: :->values" && ret=0 + + case $state in + (values) + if [[ ${words[(r)--type=container]} == --type=container ]]; then + __docker_complete_containers && ret=0 + elif [[ ${words[(r)--type=image]} == --type=image ]]; then + __docker_complete_images && ret=0 + elif [[ ${words[(r)--type=network]} == --type=network ]]; then + __docker_complete_networks && ret=0 + elif [[ ${words[(r)--type=node]} == --type=node ]]; then + __docker_complete_nodes && ret=0 + elif [[ ${words[(r)--type=plugin]} == --type=plugin ]]; then + __docker_complete_plugins && ret=0 + elif [[ ${words[(r)--type=service]} == --type=secrets ]]; then + __docker_complete_secrets && ret=0 + elif [[ ${words[(r)--type=service]} == --type=service ]]; then + __docker_complete_services && ret=0 + elif [[ ${words[(r)--type=volume]} == --type=volume ]]; then + __docker_complete_volumes && ret=0 + else + __docker_complete_containers + __docker_complete_images + __docker_complete_networks + __docker_complete_nodes + __docker_complete_plugins + __docker_complete_secrets + __docker_complete_services + __docker_complete_volumes && ret=0 + fi + ;; + esac + ;; + (login) + _arguments $(__docker_arguments) -A '-*' \ + $opts_help \ + "($help -p --password)"{-p=,--password=}"[Password]:password: " \ + "($help)--password-stdin[Read password from stdin]" \ + "($help -u --user)"{-u=,--user=}"[Username]:username: " \ + "($help -)1:server: " && ret=0 + ;; + (logout) + _arguments $(__docker_arguments) -A '-*' \ + $opts_help \ + "($help -)1:server: " && ret=0 + ;; + (network) + local curcontext="$curcontext" state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_network_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_network_subcommand && ret=0 + ;; + esac + ;; + (node) + local curcontext="$curcontext" state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_node_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_node_subcommand && ret=0 + ;; + esac + ;; + (plugin) + local curcontext="$curcontext" state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_plugin_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_plugin_subcommand && ret=0 + ;; + esac + ;; + (ps) + words[1]='ls' + __docker_container_subcommand && ret=0 + ;; + (rmi) + words[1]='rm' + __docker_image_subcommand && ret=0 + ;; + (search) + _arguments $(__docker_arguments) -A '-*' \ + $opts_help \ + "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_search_filters" \ + "($help)--limit=[Maximum returned search results]:limit:(1 5 10 25 50)" \ + "($help)--no-trunc[Do not truncate output]" \ + "($help -):term: " && ret=0 + ;; + (secret) + local curcontext="$curcontext" state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_secret_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_secret_subcommand && ret=0 + ;; + esac + ;; + (service) + local curcontext="$curcontext" state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_service_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_service_subcommand && ret=0 + ;; + esac + ;; + (stack) + local curcontext="$curcontext" state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_stack_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_stack_subcommand && ret=0 + ;; + esac + ;; + (swarm) + local curcontext="$curcontext" state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_swarm_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_swarm_subcommand && ret=0 + ;; + esac + ;; + (system) + local curcontext="$curcontext" state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_system_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_system_subcommand && ret=0 + ;; + esac + ;; + (version) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0 + ;; + (volume) + local curcontext="$curcontext" state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_volume_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_volume_subcommand && ret=0 + ;; + esac + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_commands" && ret=0 + ;; + esac + + return ret +} + +_docker() { + # Support for subservices, which allows for `compdef _docker docker-shell=_docker_containers`. + # Based on /usr/share/zsh/functions/Completion/Unix/_git without support for `ret`. + if [[ $service != docker ]]; then + _call_function - _$service + return + fi + + local curcontext="$curcontext" state line help="-h --help" + integer ret=1 + typeset -A opt_args + + _arguments $(__docker_arguments) -C \ + "(: -)"{-h,--help}"[Print usage]" \ + "($help)--config[Location of client config files]:path:_directories" \ + "($help -D --debug)"{-D,--debug}"[Enable debug mode]" \ + "($help -H --host)"{-H=,--host=}"[tcp://host:port to bind/connect to]:host: " \ + "($help -l --log-level)"{-l=,--log-level=}"[Logging level]:level:(debug info warn error fatal)" \ + "($help)--tls[Use TLS]" \ + "($help)--tlscacert=[Trust certs signed only by this CA]:PEM file:_files -g "*.(pem|crt)"" \ + "($help)--tlscert=[Path to TLS certificate file]:PEM file:_files -g "*.(pem|crt)"" \ + "($help)--tlskey=[Path to TLS key file]:Key file:_files -g "*.(pem|key)"" \ + "($help)--tlsverify[Use TLS and verify the remote]" \ + "($help)--userland-proxy[Use userland proxy for loopback traffic]" \ + "($help -v --version)"{-v,--version}"[Print version information and quit]" \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + local host=${opt_args[-H]}${opt_args[--host]} + local config=${opt_args[--config]} + local docker_options="${host:+--host $host} ${config:+--config $config}" + + case $state in + (command) + __docker_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-$words[1]: + __docker_subcommand && ret=0 + ;; + esac + + return ret +} + +_dockerd() { + integer ret=1 + words[1]='daemon' + __docker_subcommand && ret=0 + return ret +} + +_docker "$@" + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 4 +# indent-tabs-mode: nil +# sh-basic-offset: 4 +# End: +# vim: ft=zsh sw=4 ts=4 et+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/dotenv/README.md b/oh-my-zsh/plugins/dotenv/README.md @@ -0,0 +1,34 @@ +# dotenv + +Automatically load your project ENV variables from `.env` file when you `cd` into project root directory. + +Storing configuration in the environment is one of the tenets of a [twelve-factor app](http://www.12factor.net). Anything that is likely to change between deployment environments–such as resource handles for databases or credentials for external services–should be extracted from the code into environment variables. + +## Installation + +Just add the plugin to your `.zshrc`: + +```sh +plugins=(git man dotenv) +``` + +## Usage + +Create `.env` file inside your project directory and put your local ENV variables there. + +For example: +```sh +export AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a +export SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f +export MONGO_URI=mongodb://127.0.0.1:27017 +export PORT=3001 +``` +`export` is optional. This format works as well: +```sh +AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a +SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f +MONGO_URI=mongodb://127.0.0.1:27017 +PORT=3001 +``` + +**It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it supposed to be local only. diff --git a/oh-my-zsh/plugins/dotenv/dotenv.plugin.zsh b/oh-my-zsh/plugins/dotenv/dotenv.plugin.zsh @@ -0,0 +1,10 @@ +#!/bin/zsh + +source_env() { + if [[ -f .env ]]; then + source .env + fi +} + +autoload -U add-zsh-hook +add-zsh-hook chpwd source_env diff --git a/oh-my-zsh/plugins/droplr/README.md b/oh-my-zsh/plugins/droplr/README.md @@ -0,0 +1,19 @@ +# droplr + +Use [Droplr](https://droplr.com/) from the command line to upload files and shorten +links. It needs to have [Droplr.app](https://droplr.com/apps) installed and logged +in. MacOS only. + +To use it, add `droplr` to the `$plugins` variable in your zshrc file: + +```zsh +plugins=(... droplr) +``` + +Author: [Fabio Fernandes](https://github.com/fabiofl) + +## Examples + +- Upload a file: `droplr ./path/to/file/` + +- Shorten a link: `droplr http://example.com` diff --git a/oh-my-zsh/plugins/droplr/droplr.plugin.zsh b/oh-my-zsh/plugins/droplr/droplr.plugin.zsh @@ -0,0 +1,15 @@ +# Only compatible with MacOS +[[ "$OSTYPE" == darwin* ]] || return + +droplr() { + if [[ $# -eq 0 ]]; then + echo You need to specify a parameter. >&2 + return 1 + fi + + if [[ "$1" =~ ^https?:// ]]; then + osascript -e 'tell app "Droplr" to shorten "'"$1"'"' + else + open -ga /Applications/Droplr.app "$1" + fi +} diff --git a/oh-my-zsh/plugins/eecms/eecms.plugin.zsh b/oh-my-zsh/plugins/eecms/eecms.plugin.zsh @@ -0,0 +1,20 @@ +# ExpressionEngine CMS basic command completion + +_eecms_console () { + echo "php $(find . -maxdepth 3 -mindepth 1 -name 'eecms' -type f | head -n 1)" +} + +_eecms_get_command_list () { + `_eecms_console` | sed "/Available commands/,/^/d" | sed "s/[[:space:]].*//g" +} + +_eecms () { + compadd `_eecms_get_command_list` +} + +compdef _eecms '`_eecms_console`' +compdef _eecms 'system/ee/eecms' +compdef _eecms eecms + +#Alias +alias eecms='`_eecms_console`' diff --git a/oh-my-zsh/plugins/emacs/emacs.plugin.zsh b/oh-my-zsh/plugins/emacs/emacs.plugin.zsh @@ -0,0 +1,55 @@ +# Emacs 23 daemon capability is a killing feature. +# One emacs process handles all your frames whether +# you use a frame opened in a terminal via a ssh connection or X frames +# opened on the same host. + +# Benefits are multiple +# - You don't have the cost of starting Emacs all the time anymore +# - Opening a file is as fast as Emacs does not have anything else to do. +# - You can share opened buffered across opened frames. +# - Configuration changes made at runtime are applied to all frames. + + +if "$ZSH/tools/require_tool.sh" emacs 24 2>/dev/null ; then + export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh" + + # set EDITOR if not already defined. + export EDITOR="${EDITOR:-${EMACS_PLUGIN_LAUNCHER}}" + + alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait" + alias e=emacs + # open terminal emacsclient + alias te="$EMACS_PLUGIN_LAUNCHER -nw" + + # same than M-x eval but from outside Emacs. + alias eeval="$EMACS_PLUGIN_LAUNCHER --eval" + # create a new X frame + alias eframe='emacsclient --alternate-editor "" --create-frame' + + + # Write to standard output the path to the file + # opened in the current buffer. + function efile { + local cmd="(buffer-file-name (window-buffer))" + "$EMACS_PLUGIN_LAUNCHER" --eval "$cmd" | tr -d \" + } + + # Write to standard output the directory of the file + # opened in the the current buffer + function ecd { + local cmd="(let ((buf-name (buffer-file-name (window-buffer)))) + (if buf-name (file-name-directory buf-name)))" + + local dir="$($EMACS_PLUGIN_LAUNCHER --eval $cmd | tr -d \")" + if [ -n "$dir" ] ;then + echo "$dir" + else + echo "can not deduce current buffer filename." >/dev/stderr + return 1 + fi + } +fi + +## Local Variables: +## mode: sh +## End: diff --git a/oh-my-zsh/plugins/emacs/emacsclient.sh b/oh-my-zsh/plugins/emacs/emacsclient.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +_emacsfun() +{ + # get list of emacs frames. + frameslist=`emacsclient --alternate-editor '' --eval '(frame-list)' 2>/dev/null | egrep -o '(frame)+'` + + if [ "$(echo "$frameslist" | sed -n '$=')" -ge 2 ] ;then + # prevent creating another X frame if there is at least one present. + emacsclient --alternate-editor "" "$@" + else + # Create one if there is no X window yet. + emacsclient --alternate-editor "" --create-frame "$@" + fi +} + + +# adopted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh +# If the second argument is - then write stdin to a tempfile and open the +# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh) +if [ "$#" -ge "2" -a "$2" = "-" ] +then + tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)" + cat - > "$tempfile" + _emacsfun --no-wait $tempfile +else + _emacsfun "$@" +fi diff --git a/oh-my-zsh/plugins/ember-cli/README.md b/oh-my-zsh/plugins/ember-cli/README.md @@ -0,0 +1,21 @@ +# Ember CLI + +**Maintainers:** [BilalBudhani](http://www.github.com/BilalBudhani), [eubenesa](http://www.github.com/eubenesa) + +Ember CLI (http://www.ember-cli.com/) + +### List of Aliases + +Alias | Ember-CLI command +----- | ----------------- +**es** | *ember serve* +**ea** | *ember addon* +**eb** | *ember build* +**ed** | *ember destroy* +**eg** | *ember generate* +**eh** | *ember help* +**ein** | *ember init* +**ei** | *ember install* +**et** | *ember test* +**eu** | *ember update* +**ev** | *ember version* diff --git a/oh-my-zsh/plugins/ember-cli/ember-cli.plugin.zsh b/oh-my-zsh/plugins/ember-cli/ember-cli.plugin.zsh @@ -0,0 +1,16 @@ +# Ember CLI +# Visit http://www.ember-cli.com/ to view user guide + +alias es='ember serve' +alias ea='ember addon' +alias eb='ember build' +alias ed='ember destroy' +alias eg='ember generate' +alias eh='ember help' +alias ein='ember init' +alias ei='ember install' +alias et='ember test' +alias eu='ember update' + +# version +alias ev='ember version' diff --git a/oh-my-zsh/plugins/emoji-clock/emoji-clock.plugin.zsh b/oh-my-zsh/plugins/emoji-clock/emoji-clock.plugin.zsh @@ -0,0 +1,33 @@ +# ------------------------------------------------------------------------------ +# FILE: emoji-clock.plugin.zsh +# DESCRIPTION: The current time with half hour accuracy as an emoji symbol. +# Inspired by Andre Torrez' "Put A Burger In Your Shell" +# http://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html +# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net) +# VERSION: 1.0.0 +# ----------------------------------------------------------------------------- + +function emoji-clock() { + # Add 15 minutes to the current time and save the value as $minutes. + (( minutes = $(date '+%M') + 15 )) + (( hour = $(date '+%I') + minutes / 60 )) + # make sure minutes and hours don't exceed 60 nor 12 respectively + (( minutes %= 60 )); (( hour %= 12 )) + + case $hour in + 0) clock="🕛"; [ $minutes -ge 30 ] && clock="🕧";; + 1) clock="🕐"; [ $minutes -ge 30 ] && clock="🕜";; + 2) clock="🕑"; [ $minutes -ge 30 ] && clock="🕝";; + 3) clock="🕒"; [ $minutes -ge 30 ] && clock="🕞";; + 4) clock="🕓"; [ $minutes -ge 30 ] && clock="🕟";; + 5) clock="🕔"; [ $minutes -ge 30 ] && clock="🕠";; + 6) clock="🕕"; [ $minutes -ge 30 ] && clock="🕡";; + 7) clock="🕖"; [ $minutes -ge 30 ] && clock="🕢";; + 8) clock="🕗"; [ $minutes -ge 30 ] && clock="🕣";; + 9) clock="🕘"; [ $minutes -ge 30 ] && clock="🕤";; + 10) clock="🕙"; [ $minutes -ge 30 ] && clock="🕥";; + 11) clock="🕚"; [ $minutes -ge 30 ] && clock="🕦";; + *) clock="⌛";; + esac + echo $clock +} diff --git a/oh-my-zsh/plugins/emoji/README.md b/oh-my-zsh/plugins/emoji/README.md @@ -0,0 +1,135 @@ +# emoji plugin + +Support for conveniently working with Unicode emoji in Zsh. + +## Features + +This plugin provides support for working with Unicode emoji characters in `zsh` using human-readable identifiers. It provides global variables which map emoji names to the actual characters, country names to their flags, and some named groupings of emoji. It also provides associated functions for displaying them. + +#### Variables + +Variable | Description +----------------- | -------------------------------- + $emoji | Maps emoji names to characters + $emoji_flags | Maps country names to flag characters (using region indicators) + $emoji_groups | Named groups of emoji. Keys are group names; values are whitespace-separated lists of character names + +You may define new emoji groups at run time by modifying `$emoji_groups`. The special group name `all` is reserved for use by the plugin. You should not modify `$emoji` or `$emoji_flags`. + +#### Functions + +Function | Description +---------------- | ------------------------------- + random_emoji | Prints a random emoji character + display_emoji | Displays emoji, along with their names + +## Usage and Examples + +To output a specific emoji, use: +``` +$> echo $emoji[<name>] +``` +E.g.: +``` +$> echo $emoji[mouse_face] +``` + +To output a random emoji, use: +``` +$> random_emoji +``` +To output a random emoji from a particular group, use: +``` +$> random_emoji <group> +``` +E.g.: +``` +$> random_emoji fruits +$> random_emoji animals +$> random_emoji vehicles +$> random_emoji faces +``` + +The defined group names can be found with `echo ${(k)emoji_groups}`. + +To list all available emoji with their names, use: +``` +$> display_emoji +$> display_emoji fruits +$> display_emoji animals +$> display_emoji vehicles +$> display_emoji faces +``` + +To use emoji in a prompt: +``` +PROMPT="$emoji[penguin] > "" +PROMPT='$(random_emoji fruits) > ' +surfer=$emoji[surfer] +PROMPT="$surfer > " +``` + +## Technical Details + +The emoji names and codes are sourced from Unicode Technical Report \#51, which provides information on emoji support in Unicode. It can be found at http://www.unicode.org/reports/tr51/index.html. + +The group definitions are added by this OMZ plugin. They are not based on external definitions. (As far as I can tell. -apjanke) + +The values in the `$emoji*` maps are the emoji characters themselves, not escape sequences or other forms that require interpretation. They can be used in any context and do not require escape sequence support from commands like `echo` or `print`. + +The emoji in the main `$emoji` map are standalone character sequences which can all be output on their own, without worrying about combining characters. The values may actually be multi-code-point sequences, instead of a single code point, and may include combining characters in those sequences. But they're arranged so their effects do not extend beyond that sequence. + +The exception to this is the skin tone variation selectors. These are included in the main `$emoji` map because they can be displayed on their own, as well as used as combining characters. (If they follow a character that is not one of the emoji characters they combine with, they are displayed as color swatches.) + + +## Experimental Features + +This defines some additional variables and functions, but these are experimental and subject to change at any time. You shouldn't rely on them being available. They're mostly for the use of emoji plugin developers to help decide what to include in future revisions. + +Variables: + +Variable | Description +----------------- | -------------------------------- + $emoji2 | Auxiliary and combining characters + $emoji_skintone | Skin tone modifiers (from Unicode 8.0) + + +#### Skin Tone Variation Selection + +This includes experimental support for the skin tone Variation Selectors introduced with Unicode 8.0, which let you select different skin tones for emoji involving humans. + +NOTE: This really is experimental. The skin tone selectors are a relatively new feature and may not be supported by all systems. And the support in this plugin is a work in progress. It may not work in all places. In fact, I haven't gotten it to work anywhere yet. -apjanke + +The "variation selectors" are combining characters which change the appearance of the preceding character. A variation selector character can be output immediately following a human emoji to change its skin tone color. You can also output a variation selector on its own to display a color swatch of that skin tone. + +The `$emoji_skintone` associative array maps skin tone IDs to the variation selector characters. To use one, output it immediately following a smiley or other human emoji. + +``` +echo "$emoji[smiling_face_with_open_mouth]$emoji_skintone[4]" +``` + +Note that `$emoji_skintone` is an associative array, and its keys are the *names* of "Fitzpatrick Skin Type" groups, not linear indexes into a normal array. The names are `1_2`, `3`, `4`, `5`, and `6`. (Types 1 and 2 are combined into a single color.) See the [Diversity section in Unicode TR 51](http://www.unicode.org/reports/tr51/index.html#Diversity) for details. + +## TODO + +These are things that could be enhanced in future revisions of the plugin. + +* Incorporate CLDR data for ordering and groupings +* Short :bracket: style names (from gemoji) +* Incorporate `gemoji` data +* Country codes for flags +* ZWJ combining function? + +#### Gemoji support + +The [gemoji project](https://github.com/github/gemoji) seems to be the de facto main source for short names and other emoji-related metadata that isn't included in the official Unicode reports. (I'm saying this just from looking at the google results for "emoji short names" and related searches. -apjanke) + +If this plugin is updated to provide short names, CLDR sorting data, and similar stuff, it should probably be changed to use the Gemoji project, and the `update_emoji.pl` script be rewritten in Ruby so it can use the Gemoji library directly instead of parsing its data files. + +This does *not* mean that it should use Gemoji at run time. None of the `zsh` plugin stuff should call Gemoji or Ruby code. Rather, the "build time" `update_emoji.pl` script should be rewritten to use Gemoji to generate a pure-native-`zsh` character definition file which would be checked in to the repo and can be called by OMZ users without having Gemoji installed. + +#### ZWJ combining function + +One of the newer features of Unicode emoji is the ability to use the "Zero-Width Joiner" character to compose multiple emoji characters in to a single "emoji ligature" glyph. For example, this is [how Apple supports "family" emoji with various genders and skin tones](http://www.unicode.org/reports/tr51/index.html#ZWJ_Sequences). + +These are a pain to write out (and probably worse to read), and it might be convenient to have a couple functions for concisely composing them, if wider support for them appears. diff --git a/oh-my-zsh/plugins/emoji/emoji-char-definitions.zsh b/oh-my-zsh/plugins/emoji/emoji-char-definitions.zsh @@ -0,0 +1,1303 @@ + +# emoji-char-definitions.zsh - Emoji character definitions for oh-my-zsh emoji plugin +# +# This file is auto-generated by update_emoji.pl. Do not edit it manually. +# +# This contains the definition for: +# $emoji - which maps character names to Unicode characters +# $emoji_flags - maps country names to Unicode flag characters using region indicators + +# Main emoji +typeset -gAH emoji +# National flags +typeset -gAH emoji_flags +# Combining modifiers +typeset -gAH emoji_mod + +emoji[copyright_sign]=$'\U00A9' +emoji[registered_sign]=$'\U00AE' +emoji[double_exclamation_mark]=$'\U203C' +emoji[exclamation_question_mark]=$'\U2049' +emoji[trade_mark_sign]=$'\U2122' +emoji[information_source]=$'\U2139' +emoji[left_right_arrow]=$'\U2194' +emoji[up_down_arrow]=$'\U2195' +emoji[north_west_arrow]=$'\U2196' +emoji[north_east_arrow]=$'\U2197' +emoji[south_east_arrow]=$'\U2198' +emoji[south_west_arrow]=$'\U2199' +emoji[leftwards_arrow_with_hook]=$'\U21A9' +emoji[rightwards_arrow_with_hook]=$'\U21AA' +emoji[watch]=$'\U231A' +emoji[hourglass]=$'\U231B' +emoji[keyboard]=$'\U2328' +emoji[eject_symbol]=$'\U23CF' +emoji[black_right_pointing_double_triangle]=$'\U23E9' +emoji[black_left_pointing_double_triangle]=$'\U23EA' +emoji[black_up_pointing_double_triangle]=$'\U23EB' +emoji[black_down_pointing_double_triangle]=$'\U23EC' +emoji[black_right_pointing_double_triangle_with_vertical_bar]=$'\U23ED' +emoji[black_left_pointing_double_triangle_with_vertical_bar]=$'\U23EE' +emoji[black_right_pointing_triangle_with_double_vertical_bar]=$'\U23EF' +emoji[alarm_clock]=$'\U23F0' +emoji[stopwatch]=$'\U23F1' +emoji[timer_clock]=$'\U23F2' +emoji[hourglass_with_flowing_sand]=$'\U23F3' +emoji[double_vertical_bar]=$'\U23F8' +emoji[black_square_for_stop]=$'\U23F9' +emoji[black_circle_for_record]=$'\U23FA' +emoji[circled_latin_capital_letter_m]=$'\U24C2' +emoji[black_small_square]=$'\U25AA' +emoji[white_small_square]=$'\U25AB' +emoji[black_right_pointing_triangle]=$'\U25B6' +emoji[black_left_pointing_triangle]=$'\U25C0' +emoji[white_medium_square]=$'\U25FB' +emoji[black_medium_square]=$'\U25FC' +emoji[white_medium_small_square]=$'\U25FD' +emoji[black_medium_small_square]=$'\U25FE' +emoji[black_sun_with_rays]=$'\U2600' +emoji[cloud]=$'\U2601' +emoji[umbrella]=$'\U2602' +emoji[snowman]=$'\U2603' +emoji[comet]=$'\U2604' +emoji[black_telephone]=$'\U260E' +emoji[ballot_box_with_check]=$'\U2611' +emoji[umbrella_with_rain_drops]=$'\U2614' +emoji[hot_beverage]=$'\U2615' +emoji[shamrock]=$'\U2618' +emoji[white_up_pointing_index]=$'\U261D' +emoji[skull_and_crossbones]=$'\U2620' +emoji[radioactive_sign]=$'\U2622' +emoji[biohazard_sign]=$'\U2623' +emoji[orthodox_cross]=$'\U2626' +emoji[star_and_crescent]=$'\U262A' +emoji[peace_symbol]=$'\U262E' +emoji[yin_yang]=$'\U262F' +emoji[wheel_of_dharma]=$'\U2638' +emoji[white_frowning_face]=$'\U2639' +emoji[white_smiling_face]=$'\U263A' +emoji[aries]=$'\U2648' +emoji[taurus]=$'\U2649' +emoji[gemini]=$'\U264A' +emoji[cancer]=$'\U264B' +emoji[leo]=$'\U264C' +emoji[virgo]=$'\U264D' +emoji[libra]=$'\U264E' +emoji[scorpius]=$'\U264F' +emoji[sagittarius]=$'\U2650' +emoji[capricorn]=$'\U2651' +emoji[aquarius]=$'\U2652' +emoji[pisces]=$'\U2653' +emoji[black_spade_suit]=$'\U2660' +emoji[black_club_suit]=$'\U2663' +emoji[black_heart_suit]=$'\U2665' +emoji[black_diamond_suit]=$'\U2666' +emoji[hot_springs]=$'\U2668' +emoji[black_universal_recycling_symbol]=$'\U267B' +emoji[wheelchair_symbol]=$'\U267F' +emoji[hammer_and_pick]=$'\U2692' +emoji[anchor]=$'\U2693' +emoji[crossed_swords]=$'\U2694' +emoji[scales]=$'\U2696' +emoji[alembic]=$'\U2697' +emoji[gear]=$'\U2699' +emoji[atom_symbol]=$'\U269B' +emoji[fleur_de_lis]=$'\U269C' +emoji[warning_sign]=$'\U26A0' +emoji[high_voltage_sign]=$'\U26A1' +emoji[medium_white_circle]=$'\U26AA' +emoji[medium_black_circle]=$'\U26AB' +emoji[coffin]=$'\U26B0' +emoji[funeral_urn]=$'\U26B1' +emoji[soccer_ball]=$'\U26BD' +emoji[baseball]=$'\U26BE' +emoji[snowman_without_snow]=$'\U26C4' +emoji[sun_behind_cloud]=$'\U26C5' +emoji[thunder_cloud_and_rain]=$'\U26C8' +emoji[ophiuchus]=$'\U26CE' +emoji[pick]=$'\U26CF' +emoji[helmet_with_white_cross]=$'\U26D1' +emoji[chains]=$'\U26D3' +emoji[no_entry]=$'\U26D4' +emoji[shinto_shrine]=$'\U26E9' +emoji[church]=$'\U26EA' +emoji[mountain]=$'\U26F0' +emoji[umbrella_on_ground]=$'\U26F1' +emoji[fountain]=$'\U26F2' +emoji[flag_in_hole]=$'\U26F3' +emoji[ferry]=$'\U26F4' +emoji[sailboat]=$'\U26F5' +emoji[skier]=$'\U26F7' +emoji[ice_skate]=$'\U26F8' +emoji[person_with_ball]=$'\U26F9' +emoji[tent]=$'\U26FA' +emoji[fuel_pump]=$'\U26FD' +emoji[black_scissors]=$'\U2702' +emoji[white_heavy_check_mark]=$'\U2705' +emoji[airplane]=$'\U2708' +emoji[envelope]=$'\U2709' +emoji[raised_fist]=$'\U270A' +emoji[raised_hand]=$'\U270B' +emoji[victory_hand]=$'\U270C' +emoji[writing_hand]=$'\U270D' +emoji[pencil]=$'\U270F' +emoji[black_nib]=$'\U2712' +emoji[heavy_check_mark]=$'\U2714' +emoji[heavy_multiplication_x]=$'\U2716' +emoji[latin_cross]=$'\U271D' +emoji[star_of_david]=$'\U2721' +emoji[sparkles]=$'\U2728' +emoji[eight_spoked_asterisk]=$'\U2733' +emoji[eight_pointed_black_star]=$'\U2734' +emoji[snowflake]=$'\U2744' +emoji[sparkle]=$'\U2747' +emoji[cross_mark]=$'\U274C' +emoji[negative_squared_cross_mark]=$'\U274E' +emoji[black_question_mark_ornament]=$'\U2753' +emoji[white_question_mark_ornament]=$'\U2754' +emoji[white_exclamation_mark_ornament]=$'\U2755' +emoji[heavy_exclamation_mark_symbol]=$'\U2757' +emoji[heavy_heart_exclamation_mark_ornament]=$'\U2763' +emoji[heavy_black_heart]=$'\U2764' +emoji[heavy_plus_sign]=$'\U2795' +emoji[heavy_minus_sign]=$'\U2796' +emoji[heavy_division_sign]=$'\U2797' +emoji[black_rightwards_arrow]=$'\U27A1' +emoji[curly_loop]=$'\U27B0' +emoji[double_curly_loop]=$'\U27BF' +emoji[arrow_pointing_rightwards_then_curving_upwards]=$'\U2934' +emoji[arrow_pointing_rightwards_then_curving_downwards]=$'\U2935' +emoji[leftwards_black_arrow]=$'\U2B05' +emoji[upwards_black_arrow]=$'\U2B06' +emoji[downwards_black_arrow]=$'\U2B07' +emoji[black_large_square]=$'\U2B1B' +emoji[white_large_square]=$'\U2B1C' +emoji[white_medium_star]=$'\U2B50' +emoji[heavy_large_circle]=$'\U2B55' +emoji[wavy_dash]=$'\U3030' +emoji[part_alternation_mark]=$'\U303D' +emoji[circled_ideograph_congratulation]=$'\U3297' +emoji[circled_ideograph_secret]=$'\U3299' +emoji[mahjong_tile_red_dragon]=$'\U1F004' +emoji[playing_card_black_joker]=$'\U1F0CF' +emoji[negative_squared_latin_capital_letter_a]=$'\U1F170' +emoji[negative_squared_latin_capital_letter_b]=$'\U1F171' +emoji[negative_squared_latin_capital_letter_o]=$'\U1F17E' +emoji[negative_squared_latin_capital_letter_p]=$'\U1F17F' +emoji[negative_squared_ab]=$'\U1F18E' +emoji[squared_cl]=$'\U1F191' +emoji[squared_cool]=$'\U1F192' +emoji[squared_free]=$'\U1F193' +emoji[squared_id]=$'\U1F194' +emoji[squared_new]=$'\U1F195' +emoji[squared_ng]=$'\U1F196' +emoji[squared_ok]=$'\U1F197' +emoji[squared_sos]=$'\U1F198' +emoji[squared_up_with_exclamation_mark]=$'\U1F199' +emoji[squared_vs]=$'\U1F19A' +emoji[squared_katakana_koko]=$'\U1F201' +emoji[squared_katakana_sa]=$'\U1F202' +emoji[squared_cjk_unified_ideograph_7121]=$'\U1F21A' +emoji[squared_cjk_unified_ideograph_6307]=$'\U1F22F' +emoji[squared_cjk_unified_ideograph_7981]=$'\U1F232' +emoji[squared_cjk_unified_ideograph_7a7a]=$'\U1F233' +emoji[squared_cjk_unified_ideograph_5408]=$'\U1F234' +emoji[squared_cjk_unified_ideograph_6e80]=$'\U1F235' +emoji[squared_cjk_unified_ideograph_6709]=$'\U1F236' +emoji[squared_cjk_unified_ideograph_6708]=$'\U1F237' +emoji[squared_cjk_unified_ideograph_7533]=$'\U1F238' +emoji[squared_cjk_unified_ideograph_5272]=$'\U1F239' +emoji[squared_cjk_unified_ideograph_55b6]=$'\U1F23A' +emoji[circled_ideograph_advantage]=$'\U1F250' +emoji[circled_ideograph_accept]=$'\U1F251' +emoji[cyclone]=$'\U1F300' +emoji[foggy]=$'\U1F301' +emoji[closed_umbrella]=$'\U1F302' +emoji[night_with_stars]=$'\U1F303' +emoji[sunrise_over_mountains]=$'\U1F304' +emoji[sunrise]=$'\U1F305' +emoji[cityscape_at_dusk]=$'\U1F306' +emoji[sunset_over_buildings]=$'\U1F307' +emoji[rainbow]=$'\U1F308' +emoji[bridge_at_night]=$'\U1F309' +emoji[water_wave]=$'\U1F30A' +emoji[volcano]=$'\U1F30B' +emoji[milky_way]=$'\U1F30C' +emoji[earth_globe_europe_africa]=$'\U1F30D' +emoji[earth_globe_americas]=$'\U1F30E' +emoji[earth_globe_asia_australia]=$'\U1F30F' +emoji[globe_with_meridians]=$'\U1F310' +emoji[new_moon_symbol]=$'\U1F311' +emoji[waxing_crescent_moon_symbol]=$'\U1F312' +emoji[first_quarter_moon_symbol]=$'\U1F313' +emoji[waxing_gibbous_moon_symbol]=$'\U1F314' +emoji[full_moon_symbol]=$'\U1F315' +emoji[waning_gibbous_moon_symbol]=$'\U1F316' +emoji[last_quarter_moon_symbol]=$'\U1F317' +emoji[waning_crescent_moon_symbol]=$'\U1F318' +emoji[crescent_moon]=$'\U1F319' +emoji[new_moon_with_face]=$'\U1F31A' +emoji[first_quarter_moon_with_face]=$'\U1F31B' +emoji[last_quarter_moon_with_face]=$'\U1F31C' +emoji[full_moon_with_face]=$'\U1F31D' +emoji[sun_with_face]=$'\U1F31E' +emoji[glowing_star]=$'\U1F31F' +emoji[shooting_star]=$'\U1F320' +emoji[thermometer]=$'\U1F321' +emoji[white_sun_with_small_cloud]=$'\U1F324' +emoji[white_sun_behind_cloud]=$'\U1F325' +emoji[white_sun_behind_cloud_with_rain]=$'\U1F326' +emoji[cloud_with_rain]=$'\U1F327' +emoji[cloud_with_snow]=$'\U1F328' +emoji[cloud_with_lightning]=$'\U1F329' +emoji[cloud_with_tornado]=$'\U1F32A' +emoji[fog]=$'\U1F32B' +emoji[wind_blowing_face]=$'\U1F32C' +emoji[hot_dog]=$'\U1F32D' +emoji[taco]=$'\U1F32E' +emoji[burrito]=$'\U1F32F' +emoji[chestnut]=$'\U1F330' +emoji[seedling]=$'\U1F331' +emoji[evergreen_tree]=$'\U1F332' +emoji[deciduous_tree]=$'\U1F333' +emoji[palm_tree]=$'\U1F334' +emoji[cactus]=$'\U1F335' +emoji[hot_pepper]=$'\U1F336' +emoji[tulip]=$'\U1F337' +emoji[cherry_blossom]=$'\U1F338' +emoji[rose]=$'\U1F339' +emoji[hibiscus]=$'\U1F33A' +emoji[sunflower]=$'\U1F33B' +emoji[blossom]=$'\U1F33C' +emoji[ear_of_maize]=$'\U1F33D' +emoji[ear_of_rice]=$'\U1F33E' +emoji[herb]=$'\U1F33F' +emoji[four_leaf_clover]=$'\U1F340' +emoji[maple_leaf]=$'\U1F341' +emoji[fallen_leaf]=$'\U1F342' +emoji[leaf_fluttering_in_wind]=$'\U1F343' +emoji[mushroom]=$'\U1F344' +emoji[tomato]=$'\U1F345' +emoji[aubergine]=$'\U1F346' +emoji[grapes]=$'\U1F347' +emoji[melon]=$'\U1F348' +emoji[watermelon]=$'\U1F349' +emoji[tangerine]=$'\U1F34A' +emoji[lemon]=$'\U1F34B' +emoji[banana]=$'\U1F34C' +emoji[pineapple]=$'\U1F34D' +emoji[red_apple]=$'\U1F34E' +emoji[green_apple]=$'\U1F34F' +emoji[pear]=$'\U1F350' +emoji[peach]=$'\U1F351' +emoji[cherries]=$'\U1F352' +emoji[strawberry]=$'\U1F353' +emoji[hamburger]=$'\U1F354' +emoji[slice_of_pizza]=$'\U1F355' +emoji[meat_on_bone]=$'\U1F356' +emoji[poultry_leg]=$'\U1F357' +emoji[rice_cracker]=$'\U1F358' +emoji[rice_ball]=$'\U1F359' +emoji[cooked_rice]=$'\U1F35A' +emoji[curry_and_rice]=$'\U1F35B' +emoji[steaming_bowl]=$'\U1F35C' +emoji[spaghetti]=$'\U1F35D' +emoji[bread]=$'\U1F35E' +emoji[french_fries]=$'\U1F35F' +emoji[roasted_sweet_potato]=$'\U1F360' +emoji[dango]=$'\U1F361' +emoji[oden]=$'\U1F362' +emoji[sushi]=$'\U1F363' +emoji[fried_shrimp]=$'\U1F364' +emoji[fish_cake_with_swirl_design]=$'\U1F365' +emoji[soft_ice_cream]=$'\U1F366' +emoji[shaved_ice]=$'\U1F367' +emoji[ice_cream]=$'\U1F368' +emoji[doughnut]=$'\U1F369' +emoji[cookie]=$'\U1F36A' +emoji[chocolate_bar]=$'\U1F36B' +emoji[candy]=$'\U1F36C' +emoji[lollipop]=$'\U1F36D' +emoji[custard]=$'\U1F36E' +emoji[honey_pot]=$'\U1F36F' +emoji[shortcake]=$'\U1F370' +emoji[bento_box]=$'\U1F371' +emoji[pot_of_food]=$'\U1F372' +emoji[cooking]=$'\U1F373' +emoji[fork_and_knife]=$'\U1F374' +emoji[teacup_without_handle]=$'\U1F375' +emoji[sake_bottle_and_cup]=$'\U1F376' +emoji[wine_glass]=$'\U1F377' +emoji[cocktail_glass]=$'\U1F378' +emoji[tropical_drink]=$'\U1F379' +emoji[beer_mug]=$'\U1F37A' +emoji[clinking_beer_mugs]=$'\U1F37B' +emoji[baby_bottle]=$'\U1F37C' +emoji[fork_and_knife_with_plate]=$'\U1F37D' +emoji[bottle_with_popping_cork]=$'\U1F37E' +emoji[popcorn]=$'\U1F37F' +emoji[ribbon]=$'\U1F380' +emoji[wrapped_present]=$'\U1F381' +emoji[birthday_cake]=$'\U1F382' +emoji[jack_o_lantern]=$'\U1F383' +emoji[christmas_tree]=$'\U1F384' +emoji[father_christmas]=$'\U1F385' +emoji[fireworks]=$'\U1F386' +emoji[firework_sparkler]=$'\U1F387' +emoji[balloon]=$'\U1F388' +emoji[party_popper]=$'\U1F389' +emoji[confetti_ball]=$'\U1F38A' +emoji[tanabata_tree]=$'\U1F38B' +emoji[crossed_flags]=$'\U1F38C' +emoji[pine_decoration]=$'\U1F38D' +emoji[japanese_dolls]=$'\U1F38E' +emoji[carp_streamer]=$'\U1F38F' +emoji[wind_chime]=$'\U1F390' +emoji[moon_viewing_ceremony]=$'\U1F391' +emoji[school_satchel]=$'\U1F392' +emoji[graduation_cap]=$'\U1F393' +emoji[military_medal]=$'\U1F396' +emoji[reminder_ribbon]=$'\U1F397' +emoji[studio_microphone]=$'\U1F399' +emoji[level_slider]=$'\U1F39A' +emoji[control_knobs]=$'\U1F39B' +emoji[film_frames]=$'\U1F39E' +emoji[admission_tickets]=$'\U1F39F' +emoji[carousel_horse]=$'\U1F3A0' +emoji[ferris_wheel]=$'\U1F3A1' +emoji[roller_coaster]=$'\U1F3A2' +emoji[fishing_pole_and_fish]=$'\U1F3A3' +emoji[microphone]=$'\U1F3A4' +emoji[movie_camera]=$'\U1F3A5' +emoji[cinema]=$'\U1F3A6' +emoji[headphone]=$'\U1F3A7' +emoji[artist_palette]=$'\U1F3A8' +emoji[top_hat]=$'\U1F3A9' +emoji[circus_tent]=$'\U1F3AA' +emoji[ticket]=$'\U1F3AB' +emoji[clapper_board]=$'\U1F3AC' +emoji[performing_arts]=$'\U1F3AD' +emoji[video_game]=$'\U1F3AE' +emoji[direct_hit]=$'\U1F3AF' +emoji[slot_machine]=$'\U1F3B0' +emoji[billiards]=$'\U1F3B1' +emoji[game_die]=$'\U1F3B2' +emoji[bowling]=$'\U1F3B3' +emoji[flower_playing_cards]=$'\U1F3B4' +emoji[musical_note]=$'\U1F3B5' +emoji[multiple_musical_notes]=$'\U1F3B6' +emoji[saxophone]=$'\U1F3B7' +emoji[guitar]=$'\U1F3B8' +emoji[musical_keyboard]=$'\U1F3B9' +emoji[trumpet]=$'\U1F3BA' +emoji[violin]=$'\U1F3BB' +emoji[musical_score]=$'\U1F3BC' +emoji[running_shirt_with_sash]=$'\U1F3BD' +emoji[tennis_racquet_and_ball]=$'\U1F3BE' +emoji[ski_and_ski_boot]=$'\U1F3BF' +emoji[basketball_and_hoop]=$'\U1F3C0' +emoji[chequered_flag]=$'\U1F3C1' +emoji[snowboarder]=$'\U1F3C2' +emoji[runner]=$'\U1F3C3' +emoji[surfer]=$'\U1F3C4' +emoji[sports_medal]=$'\U1F3C5' +emoji[trophy]=$'\U1F3C6' +emoji[horse_racing]=$'\U1F3C7' +emoji[american_football]=$'\U1F3C8' +emoji[rugby_football]=$'\U1F3C9' +emoji[swimmer]=$'\U1F3CA' +emoji[weight_lifter]=$'\U1F3CB' +emoji[golfer]=$'\U1F3CC' +emoji[racing_motorcycle]=$'\U1F3CD' +emoji[racing_car]=$'\U1F3CE' +emoji[cricket_bat_and_ball]=$'\U1F3CF' +emoji[volleyball]=$'\U1F3D0' +emoji[field_hockey_stick_and_ball]=$'\U1F3D1' +emoji[ice_hockey_stick_and_puck]=$'\U1F3D2' +emoji[table_tennis_paddle_and_ball]=$'\U1F3D3' +emoji[snow_capped_mountain]=$'\U1F3D4' +emoji[camping]=$'\U1F3D5' +emoji[beach_with_umbrella]=$'\U1F3D6' +emoji[building_construction]=$'\U1F3D7' +emoji[house_buildings]=$'\U1F3D8' +emoji[cityscape]=$'\U1F3D9' +emoji[derelict_house_building]=$'\U1F3DA' +emoji[classical_building]=$'\U1F3DB' +emoji[desert]=$'\U1F3DC' +emoji[desert_island]=$'\U1F3DD' +emoji[national_park]=$'\U1F3DE' +emoji[stadium]=$'\U1F3DF' +emoji[house_building]=$'\U1F3E0' +emoji[house_with_garden]=$'\U1F3E1' +emoji[office_building]=$'\U1F3E2' +emoji[japanese_post_office]=$'\U1F3E3' +emoji[european_post_office]=$'\U1F3E4' +emoji[hospital]=$'\U1F3E5' +emoji[bank]=$'\U1F3E6' +emoji[automated_teller_machine]=$'\U1F3E7' +emoji[hotel]=$'\U1F3E8' +emoji[love_hotel]=$'\U1F3E9' +emoji[convenience_store]=$'\U1F3EA' +emoji[school]=$'\U1F3EB' +emoji[department_store]=$'\U1F3EC' +emoji[factory]=$'\U1F3ED' +emoji[izakaya_lantern]=$'\U1F3EE' +emoji[japanese_castle]=$'\U1F3EF' +emoji[european_castle]=$'\U1F3F0' +emoji[waving_white_flag]=$'\U1F3F3' +emoji[waving_black_flag]=$'\U1F3F4' +emoji[rosette]=$'\U1F3F5' +emoji[label]=$'\U1F3F7' +emoji[badminton_racquet_and_shuttlecock]=$'\U1F3F8' +emoji[bow_and_arrow]=$'\U1F3F9' +emoji[amphora]=$'\U1F3FA' +emoji[emoji_modifier_fitzpatrick_type_1_2]=$'\U1F3FB' +emoji_mod[emoji_modifier_fitzpatrick_type_1_2]=$'\U1F3FB' +emoji[emoji_modifier_fitzpatrick_type_3]=$'\U1F3FC' +emoji_mod[emoji_modifier_fitzpatrick_type_3]=$'\U1F3FC' +emoji[emoji_modifier_fitzpatrick_type_4]=$'\U1F3FD' +emoji_mod[emoji_modifier_fitzpatrick_type_4]=$'\U1F3FD' +emoji[emoji_modifier_fitzpatrick_type_5]=$'\U1F3FE' +emoji_mod[emoji_modifier_fitzpatrick_type_5]=$'\U1F3FE' +emoji[emoji_modifier_fitzpatrick_type_6]=$'\U1F3FF' +emoji_mod[emoji_modifier_fitzpatrick_type_6]=$'\U1F3FF' +emoji[rat]=$'\U1F400' +emoji[mouse]=$'\U1F401' +emoji[ox]=$'\U1F402' +emoji[water_buffalo]=$'\U1F403' +emoji[cow]=$'\U1F404' +emoji[tiger]=$'\U1F405' +emoji[leopard]=$'\U1F406' +emoji[rabbit]=$'\U1F407' +emoji[cat]=$'\U1F408' +emoji[dragon]=$'\U1F409' +emoji[crocodile]=$'\U1F40A' +emoji[whale]=$'\U1F40B' +emoji[snail]=$'\U1F40C' +emoji[snake]=$'\U1F40D' +emoji[horse]=$'\U1F40E' +emoji[ram]=$'\U1F40F' +emoji[goat]=$'\U1F410' +emoji[sheep]=$'\U1F411' +emoji[monkey]=$'\U1F412' +emoji[rooster]=$'\U1F413' +emoji[chicken]=$'\U1F414' +emoji[dog]=$'\U1F415' +emoji[pig]=$'\U1F416' +emoji[boar]=$'\U1F417' +emoji[elephant]=$'\U1F418' +emoji[octopus]=$'\U1F419' +emoji[spiral_shell]=$'\U1F41A' +emoji[bug]=$'\U1F41B' +emoji[ant]=$'\U1F41C' +emoji[honeybee]=$'\U1F41D' +emoji[lady_beetle]=$'\U1F41E' +emoji[fish]=$'\U1F41F' +emoji[tropical_fish]=$'\U1F420' +emoji[blowfish]=$'\U1F421' +emoji[turtle]=$'\U1F422' +emoji[hatching_chick]=$'\U1F423' +emoji[baby_chick]=$'\U1F424' +emoji[front_facing_baby_chick]=$'\U1F425' +emoji[bird]=$'\U1F426' +emoji[penguin]=$'\U1F427' +emoji[koala]=$'\U1F428' +emoji[poodle]=$'\U1F429' +emoji[dromedary_camel]=$'\U1F42A' +emoji[bactrian_camel]=$'\U1F42B' +emoji[dolphin]=$'\U1F42C' +emoji[mouse_face]=$'\U1F42D' +emoji[cow_face]=$'\U1F42E' +emoji[tiger_face]=$'\U1F42F' +emoji[rabbit_face]=$'\U1F430' +emoji[cat_face]=$'\U1F431' +emoji[dragon_face]=$'\U1F432' +emoji[spouting_whale]=$'\U1F433' +emoji[horse_face]=$'\U1F434' +emoji[monkey_face]=$'\U1F435' +emoji[dog_face]=$'\U1F436' +emoji[pig_face]=$'\U1F437' +emoji[frog_face]=$'\U1F438' +emoji[hamster_face]=$'\U1F439' +emoji[wolf_face]=$'\U1F43A' +emoji[bear_face]=$'\U1F43B' +emoji[panda_face]=$'\U1F43C' +emoji[pig_nose]=$'\U1F43D' +emoji[paw_prints]=$'\U1F43E' +emoji[chipmunk]=$'\U1F43F' +emoji[eyes]=$'\U1F440' +emoji[eye]=$'\U1F441' +emoji[ear]=$'\U1F442' +emoji[nose]=$'\U1F443' +emoji[mouth]=$'\U1F444' +emoji[tongue]=$'\U1F445' +emoji[white_up_pointing_backhand_index]=$'\U1F446' +emoji[white_down_pointing_backhand_index]=$'\U1F447' +emoji[white_left_pointing_backhand_index]=$'\U1F448' +emoji[white_right_pointing_backhand_index]=$'\U1F449' +emoji[fisted_hand_sign]=$'\U1F44A' +emoji[waving_hand_sign]=$'\U1F44B' +emoji[ok_hand_sign]=$'\U1F44C' +emoji[thumbs_up_sign]=$'\U1F44D' +emoji[thumbs_down_sign]=$'\U1F44E' +emoji[clapping_hands_sign]=$'\U1F44F' +emoji[open_hands_sign]=$'\U1F450' +emoji[crown]=$'\U1F451' +emoji[womans_hat]=$'\U1F452' +emoji[eyeglasses]=$'\U1F453' +emoji[necktie]=$'\U1F454' +emoji[t_shirt]=$'\U1F455' +emoji[jeans]=$'\U1F456' +emoji[dress]=$'\U1F457' +emoji[kimono]=$'\U1F458' +emoji[bikini]=$'\U1F459' +emoji[womans_clothes]=$'\U1F45A' +emoji[purse]=$'\U1F45B' +emoji[handbag]=$'\U1F45C' +emoji[pouch]=$'\U1F45D' +emoji[mans_shoe]=$'\U1F45E' +emoji[athletic_shoe]=$'\U1F45F' +emoji[high_heeled_shoe]=$'\U1F460' +emoji[womans_sandal]=$'\U1F461' +emoji[womans_boots]=$'\U1F462' +emoji[footprints]=$'\U1F463' +emoji[bust_in_silhouette]=$'\U1F464' +emoji[busts_in_silhouette]=$'\U1F465' +emoji[boy]=$'\U1F466' +emoji[girl]=$'\U1F467' +emoji[man]=$'\U1F468' +emoji[woman]=$'\U1F469' +emoji[family]=$'\U1F46A' +emoji[man_and_woman_holding_hands]=$'\U1F46B' +emoji[two_men_holding_hands]=$'\U1F46C' +emoji[two_women_holding_hands]=$'\U1F46D' +emoji[police_officer]=$'\U1F46E' +emoji[woman_with_bunny_ears]=$'\U1F46F' +emoji[bride_with_veil]=$'\U1F470' +emoji[person_with_blond_hair]=$'\U1F471' +emoji[man_with_gua_pi_mao]=$'\U1F472' +emoji[man_with_turban]=$'\U1F473' +emoji[older_man]=$'\U1F474' +emoji[older_woman]=$'\U1F475' +emoji[baby]=$'\U1F476' +emoji[construction_worker]=$'\U1F477' +emoji[princess]=$'\U1F478' +emoji[japanese_ogre]=$'\U1F479' +emoji[japanese_goblin]=$'\U1F47A' +emoji[ghost]=$'\U1F47B' +emoji[baby_angel]=$'\U1F47C' +emoji[extraterrestrial_alien]=$'\U1F47D' +emoji[alien_monster]=$'\U1F47E' +emoji[imp]=$'\U1F47F' +emoji[skull]=$'\U1F480' +emoji[information_desk_person]=$'\U1F481' +emoji[guardsman]=$'\U1F482' +emoji[dancer]=$'\U1F483' +emoji[lipstick]=$'\U1F484' +emoji[nail_polish]=$'\U1F485' +emoji[face_massage]=$'\U1F486' +emoji[haircut]=$'\U1F487' +emoji[barber_pole]=$'\U1F488' +emoji[syringe]=$'\U1F489' +emoji[pill]=$'\U1F48A' +emoji[kiss_mark]=$'\U1F48B' +emoji[love_letter]=$'\U1F48C' +emoji[ring]=$'\U1F48D' +emoji[gem_stone]=$'\U1F48E' +emoji[kiss]=$'\U1F48F' +emoji[bouquet]=$'\U1F490' +emoji[couple_with_heart]=$'\U1F491' +emoji[wedding]=$'\U1F492' +emoji[beating_heart]=$'\U1F493' +emoji[broken_heart]=$'\U1F494' +emoji[two_hearts]=$'\U1F495' +emoji[sparkling_heart]=$'\U1F496' +emoji[growing_heart]=$'\U1F497' +emoji[heart_with_arrow]=$'\U1F498' +emoji[blue_heart]=$'\U1F499' +emoji[green_heart]=$'\U1F49A' +emoji[yellow_heart]=$'\U1F49B' +emoji[purple_heart]=$'\U1F49C' +emoji[heart_with_ribbon]=$'\U1F49D' +emoji[revolving_hearts]=$'\U1F49E' +emoji[heart_decoration]=$'\U1F49F' +emoji[diamond_shape_with_a_dot_inside]=$'\U1F4A0' +emoji[electric_light_bulb]=$'\U1F4A1' +emoji[anger_symbol]=$'\U1F4A2' +emoji[bomb]=$'\U1F4A3' +emoji[sleeping_symbol]=$'\U1F4A4' +emoji[collision_symbol]=$'\U1F4A5' +emoji[splashing_sweat_symbol]=$'\U1F4A6' +emoji[droplet]=$'\U1F4A7' +emoji[dash_symbol]=$'\U1F4A8' +emoji[pile_of_poo]=$'\U1F4A9' +emoji[flexed_biceps]=$'\U1F4AA' +emoji[dizzy_symbol]=$'\U1F4AB' +emoji[speech_balloon]=$'\U1F4AC' +emoji[thought_balloon]=$'\U1F4AD' +emoji[white_flower]=$'\U1F4AE' +emoji[hundred_points_symbol]=$'\U1F4AF' +emoji[money_bag]=$'\U1F4B0' +emoji[currency_exchange]=$'\U1F4B1' +emoji[heavy_dollar_sign]=$'\U1F4B2' +emoji[credit_card]=$'\U1F4B3' +emoji[banknote_with_yen_sign]=$'\U1F4B4' +emoji[banknote_with_dollar_sign]=$'\U1F4B5' +emoji[banknote_with_euro_sign]=$'\U1F4B6' +emoji[banknote_with_pound_sign]=$'\U1F4B7' +emoji[money_with_wings]=$'\U1F4B8' +emoji[chart_with_upwards_trend_and_yen_sign]=$'\U1F4B9' +emoji[seat]=$'\U1F4BA' +emoji[personal_computer]=$'\U1F4BB' +emoji[briefcase]=$'\U1F4BC' +emoji[minidisc]=$'\U1F4BD' +emoji[floppy_disk]=$'\U1F4BE' +emoji[optical_disc]=$'\U1F4BF' +emoji[dvd]=$'\U1F4C0' +emoji[file_folder]=$'\U1F4C1' +emoji[open_file_folder]=$'\U1F4C2' +emoji[page_with_curl]=$'\U1F4C3' +emoji[page_facing_up]=$'\U1F4C4' +emoji[calendar]=$'\U1F4C5' +emoji[tear_off_calendar]=$'\U1F4C6' +emoji[card_index]=$'\U1F4C7' +emoji[chart_with_upwards_trend]=$'\U1F4C8' +emoji[chart_with_downwards_trend]=$'\U1F4C9' +emoji[bar_chart]=$'\U1F4CA' +emoji[clipboard]=$'\U1F4CB' +emoji[pushpin]=$'\U1F4CC' +emoji[round_pushpin]=$'\U1F4CD' +emoji[paperclip]=$'\U1F4CE' +emoji[straight_ruler]=$'\U1F4CF' +emoji[triangular_ruler]=$'\U1F4D0' +emoji[bookmark_tabs]=$'\U1F4D1' +emoji[ledger]=$'\U1F4D2' +emoji[notebook]=$'\U1F4D3' +emoji[notebook_with_decorative_cover]=$'\U1F4D4' +emoji[closed_book]=$'\U1F4D5' +emoji[open_book]=$'\U1F4D6' +emoji[green_book]=$'\U1F4D7' +emoji[blue_book]=$'\U1F4D8' +emoji[orange_book]=$'\U1F4D9' +emoji[books]=$'\U1F4DA' +emoji[name_badge]=$'\U1F4DB' +emoji[scroll]=$'\U1F4DC' +emoji[memo]=$'\U1F4DD' +emoji[telephone_receiver]=$'\U1F4DE' +emoji[pager]=$'\U1F4DF' +emoji[fax_machine]=$'\U1F4E0' +emoji[satellite_antenna]=$'\U1F4E1' +emoji[public_address_loudspeaker]=$'\U1F4E2' +emoji[cheering_megaphone]=$'\U1F4E3' +emoji[outbox_tray]=$'\U1F4E4' +emoji[inbox_tray]=$'\U1F4E5' +emoji[package]=$'\U1F4E6' +emoji[e_mail_symbol]=$'\U1F4E7' +emoji[incoming_envelope]=$'\U1F4E8' +emoji[envelope_with_downwards_arrow_above]=$'\U1F4E9' +emoji[closed_mailbox_with_lowered_flag]=$'\U1F4EA' +emoji[closed_mailbox_with_raised_flag]=$'\U1F4EB' +emoji[open_mailbox_with_raised_flag]=$'\U1F4EC' +emoji[open_mailbox_with_lowered_flag]=$'\U1F4ED' +emoji[postbox]=$'\U1F4EE' +emoji[postal_horn]=$'\U1F4EF' +emoji[newspaper]=$'\U1F4F0' +emoji[mobile_phone]=$'\U1F4F1' +emoji[mobile_phone_with_rightwards_arrow_at_left]=$'\U1F4F2' +emoji[vibration_mode]=$'\U1F4F3' +emoji[mobile_phone_off]=$'\U1F4F4' +emoji[no_mobile_phones]=$'\U1F4F5' +emoji[antenna_with_bars]=$'\U1F4F6' +emoji[camera]=$'\U1F4F7' +emoji[camera_with_flash]=$'\U1F4F8' +emoji[video_camera]=$'\U1F4F9' +emoji[television]=$'\U1F4FA' +emoji[radio]=$'\U1F4FB' +emoji[videocassette]=$'\U1F4FC' +emoji[film_projector]=$'\U1F4FD' +emoji[prayer_beads]=$'\U1F4FF' +emoji[twisted_rightwards_arrows]=$'\U1F500' +emoji[clockwise_rightwards_and_leftwards_open_circle_arrows]=$'\U1F501' +emoji[clockwise_rightwards_and_leftwards_open_circle_arrows_with_circled_one_overlay]=$'\U1F502' +emoji[clockwise_downwards_and_upwards_open_circle_arrows]=$'\U1F503' +emoji[anticlockwise_downwards_and_upwards_open_circle_arrows]=$'\U1F504' +emoji[low_brightness_symbol]=$'\U1F505' +emoji[high_brightness_symbol]=$'\U1F506' +emoji[speaker_with_cancellation_stroke]=$'\U1F507' +emoji[speaker]=$'\U1F508' +emoji[speaker_with_one_sound_wave]=$'\U1F509' +emoji[speaker_with_three_sound_waves]=$'\U1F50A' +emoji[battery]=$'\U1F50B' +emoji[electric_plug]=$'\U1F50C' +emoji[left_pointing_magnifying_glass]=$'\U1F50D' +emoji[right_pointing_magnifying_glass]=$'\U1F50E' +emoji[lock_with_ink_pen]=$'\U1F50F' +emoji[closed_lock_with_key]=$'\U1F510' +emoji[key]=$'\U1F511' +emoji[lock]=$'\U1F512' +emoji[open_lock]=$'\U1F513' +emoji[bell]=$'\U1F514' +emoji[bell_with_cancellation_stroke]=$'\U1F515' +emoji[bookmark]=$'\U1F516' +emoji[link_symbol]=$'\U1F517' +emoji[radio_button]=$'\U1F518' +emoji[back_with_leftwards_arrow_above]=$'\U1F519' +emoji[end_with_leftwards_arrow_above]=$'\U1F51A' +emoji[on_with_exclamation_mark_with_left_right_arrow_above]=$'\U1F51B' +emoji[soon_with_rightwards_arrow_above]=$'\U1F51C' +emoji[top_with_upwards_arrow_above]=$'\U1F51D' +emoji[no_one_under_eighteen_symbol]=$'\U1F51E' +emoji[keycap_ten]=$'\U1F51F' +emoji[input_symbol_for_latin_capital_letters]=$'\U1F520' +emoji[input_symbol_for_latin_small_letters]=$'\U1F521' +emoji[input_symbol_for_numbers]=$'\U1F522' +emoji[input_symbol_for_symbols]=$'\U1F523' +emoji[input_symbol_for_latin_letters]=$'\U1F524' +emoji[fire]=$'\U1F525' +emoji[electric_torch]=$'\U1F526' +emoji[wrench]=$'\U1F527' +emoji[hammer]=$'\U1F528' +emoji[nut_and_bolt]=$'\U1F529' +emoji[hocho]=$'\U1F52A' +emoji[pistol]=$'\U1F52B' +emoji[microscope]=$'\U1F52C' +emoji[telescope]=$'\U1F52D' +emoji[crystal_ball]=$'\U1F52E' +emoji[six_pointed_star_with_middle_dot]=$'\U1F52F' +emoji[japanese_symbol_for_beginner]=$'\U1F530' +emoji[trident_emblem]=$'\U1F531' +emoji[black_square_button]=$'\U1F532' +emoji[white_square_button]=$'\U1F533' +emoji[large_red_circle]=$'\U1F534' +emoji[large_blue_circle]=$'\U1F535' +emoji[large_orange_diamond]=$'\U1F536' +emoji[large_blue_diamond]=$'\U1F537' +emoji[small_orange_diamond]=$'\U1F538' +emoji[small_blue_diamond]=$'\U1F539' +emoji[up_pointing_red_triangle]=$'\U1F53A' +emoji[down_pointing_red_triangle]=$'\U1F53B' +emoji[up_pointing_small_red_triangle]=$'\U1F53C' +emoji[down_pointing_small_red_triangle]=$'\U1F53D' +emoji[om_symbol]=$'\U1F549' +emoji[dove_of_peace]=$'\U1F54A' +emoji[kaaba]=$'\U1F54B' +emoji[mosque]=$'\U1F54C' +emoji[synagogue]=$'\U1F54D' +emoji[menorah_with_nine_branches]=$'\U1F54E' +emoji[clock_face_one_oclock]=$'\U1F550' +emoji[clock_face_two_oclock]=$'\U1F551' +emoji[clock_face_three_oclock]=$'\U1F552' +emoji[clock_face_four_oclock]=$'\U1F553' +emoji[clock_face_five_oclock]=$'\U1F554' +emoji[clock_face_six_oclock]=$'\U1F555' +emoji[clock_face_seven_oclock]=$'\U1F556' +emoji[clock_face_eight_oclock]=$'\U1F557' +emoji[clock_face_nine_oclock]=$'\U1F558' +emoji[clock_face_ten_oclock]=$'\U1F559' +emoji[clock_face_eleven_oclock]=$'\U1F55A' +emoji[clock_face_twelve_oclock]=$'\U1F55B' +emoji[clock_face_one_thirty]=$'\U1F55C' +emoji[clock_face_two_thirty]=$'\U1F55D' +emoji[clock_face_three_thirty]=$'\U1F55E' +emoji[clock_face_four_thirty]=$'\U1F55F' +emoji[clock_face_five_thirty]=$'\U1F560' +emoji[clock_face_six_thirty]=$'\U1F561' +emoji[clock_face_seven_thirty]=$'\U1F562' +emoji[clock_face_eight_thirty]=$'\U1F563' +emoji[clock_face_nine_thirty]=$'\U1F564' +emoji[clock_face_ten_thirty]=$'\U1F565' +emoji[clock_face_eleven_thirty]=$'\U1F566' +emoji[clock_face_twelve_thirty]=$'\U1F567' +emoji[candle]=$'\U1F56F' +emoji[mantelpiece_clock]=$'\U1F570' +emoji[hole]=$'\U1F573' +emoji[man_in_business_suit_levitating]=$'\U1F574' +emoji[sleuth_or_spy]=$'\U1F575' +emoji[dark_sunglasses]=$'\U1F576' +emoji[spider]=$'\U1F577' +emoji[spider_web]=$'\U1F578' +emoji[joystick]=$'\U1F579' +emoji[linked_paperclips]=$'\U1F587' +emoji[lower_left_ballpoint_pen]=$'\U1F58A' +emoji[lower_left_fountain_pen]=$'\U1F58B' +emoji[lower_left_paintbrush]=$'\U1F58C' +emoji[lower_left_crayon]=$'\U1F58D' +emoji[raised_hand_with_fingers_splayed]=$'\U1F590' +emoji[reversed_hand_with_middle_finger_extended]=$'\U1F595' +emoji[raised_hand_with_part_between_middle_and_ring_fingers]=$'\U1F596' +emoji[desktop_computer]=$'\U1F5A5' +emoji[printer]=$'\U1F5A8' +emoji[three_button_mouse]=$'\U1F5B1' +emoji[trackball]=$'\U1F5B2' +emoji[frame_with_picture]=$'\U1F5BC' +emoji[card_index_dividers]=$'\U1F5C2' +emoji[card_file_box]=$'\U1F5C3' +emoji[file_cabinet]=$'\U1F5C4' +emoji[wastebasket]=$'\U1F5D1' +emoji[spiral_note_pad]=$'\U1F5D2' +emoji[spiral_calendar_pad]=$'\U1F5D3' +emoji[compression]=$'\U1F5DC' +emoji[old_key]=$'\U1F5DD' +emoji[rolled_up_newspaper]=$'\U1F5DE' +emoji[dagger_knife]=$'\U1F5E1' +emoji[speaking_head_in_silhouette]=$'\U1F5E3' +emoji[right_anger_bubble]=$'\U1F5EF' +emoji[ballot_box_with_ballot]=$'\U1F5F3' +emoji[world_map]=$'\U1F5FA' +emoji[mount_fuji]=$'\U1F5FB' +emoji[tokyo_tower]=$'\U1F5FC' +emoji[statue_of_liberty]=$'\U1F5FD' +emoji[silhouette_of_japan]=$'\U1F5FE' +emoji[moyai]=$'\U1F5FF' +emoji[grinning_face]=$'\U1F600' +emoji[grinning_face_with_smiling_eyes]=$'\U1F601' +emoji[face_with_tears_of_joy]=$'\U1F602' +emoji[smiling_face_with_open_mouth]=$'\U1F603' +emoji[smiling_face_with_open_mouth_and_smiling_eyes]=$'\U1F604' +emoji[smiling_face_with_open_mouth_and_cold_sweat]=$'\U1F605' +emoji[smiling_face_with_open_mouth_and_tightly_closed_eyes]=$'\U1F606' +emoji[smiling_face_with_halo]=$'\U1F607' +emoji[smiling_face_with_horns]=$'\U1F608' +emoji[winking_face]=$'\U1F609' +emoji[smiling_face_with_smiling_eyes]=$'\U1F60A' +emoji[face_savouring_delicious_food]=$'\U1F60B' +emoji[relieved_face]=$'\U1F60C' +emoji[smiling_face_with_heart_shaped_eyes]=$'\U1F60D' +emoji[smiling_face_with_sunglasses]=$'\U1F60E' +emoji[smirking_face]=$'\U1F60F' +emoji[neutral_face]=$'\U1F610' +emoji[expressionless_face]=$'\U1F611' +emoji[unamused_face]=$'\U1F612' +emoji[face_with_cold_sweat]=$'\U1F613' +emoji[pensive_face]=$'\U1F614' +emoji[confused_face]=$'\U1F615' +emoji[confounded_face]=$'\U1F616' +emoji[kissing_face]=$'\U1F617' +emoji[face_throwing_a_kiss]=$'\U1F618' +emoji[kissing_face_with_smiling_eyes]=$'\U1F619' +emoji[kissing_face_with_closed_eyes]=$'\U1F61A' +emoji[face_with_stuck_out_tongue]=$'\U1F61B' +emoji[face_with_stuck_out_tongue_and_winking_eye]=$'\U1F61C' +emoji[face_with_stuck_out_tongue_and_tightly_closed_eyes]=$'\U1F61D' +emoji[disappointed_face]=$'\U1F61E' +emoji[worried_face]=$'\U1F61F' +emoji[angry_face]=$'\U1F620' +emoji[pouting_face]=$'\U1F621' +emoji[crying_face]=$'\U1F622' +emoji[persevering_face]=$'\U1F623' +emoji[face_with_look_of_triumph]=$'\U1F624' +emoji[disappointed_but_relieved_face]=$'\U1F625' +emoji[frowning_face_with_open_mouth]=$'\U1F626' +emoji[anguished_face]=$'\U1F627' +emoji[fearful_face]=$'\U1F628' +emoji[weary_face]=$'\U1F629' +emoji[sleepy_face]=$'\U1F62A' +emoji[tired_face]=$'\U1F62B' +emoji[grimacing_face]=$'\U1F62C' +emoji[loudly_crying_face]=$'\U1F62D' +emoji[face_with_open_mouth]=$'\U1F62E' +emoji[hushed_face]=$'\U1F62F' +emoji[face_with_open_mouth_and_cold_sweat]=$'\U1F630' +emoji[face_screaming_in_fear]=$'\U1F631' +emoji[astonished_face]=$'\U1F632' +emoji[flushed_face]=$'\U1F633' +emoji[sleeping_face]=$'\U1F634' +emoji[dizzy_face]=$'\U1F635' +emoji[face_without_mouth]=$'\U1F636' +emoji[face_with_medical_mask]=$'\U1F637' +emoji[grinning_cat_face_with_smiling_eyes]=$'\U1F638' +emoji[cat_face_with_tears_of_joy]=$'\U1F639' +emoji[smiling_cat_face_with_open_mouth]=$'\U1F63A' +emoji[smiling_cat_face_with_heart_shaped_eyes]=$'\U1F63B' +emoji[cat_face_with_wry_smile]=$'\U1F63C' +emoji[kissing_cat_face_with_closed_eyes]=$'\U1F63D' +emoji[pouting_cat_face]=$'\U1F63E' +emoji[crying_cat_face]=$'\U1F63F' +emoji[weary_cat_face]=$'\U1F640' +emoji[slightly_frowning_face]=$'\U1F641' +emoji[slightly_smiling_face]=$'\U1F642' +emoji[upside_down_face]=$'\U1F643' +emoji[face_with_rolling_eyes]=$'\U1F644' +emoji[face_with_no_good_gesture]=$'\U1F645' +emoji[face_with_ok_gesture]=$'\U1F646' +emoji[person_bowing_deeply]=$'\U1F647' +emoji[see_no_evil_monkey]=$'\U1F648' +emoji[hear_no_evil_monkey]=$'\U1F649' +emoji[speak_no_evil_monkey]=$'\U1F64A' +emoji[happy_person_raising_one_hand]=$'\U1F64B' +emoji[person_raising_both_hands_in_celebration]=$'\U1F64C' +emoji[person_frowning]=$'\U1F64D' +emoji[person_with_pouting_face]=$'\U1F64E' +emoji[person_with_folded_hands]=$'\U1F64F' +emoji[rocket]=$'\U1F680' +emoji[helicopter]=$'\U1F681' +emoji[steam_locomotive]=$'\U1F682' +emoji[railway_car]=$'\U1F683' +emoji[high_speed_train]=$'\U1F684' +emoji[high_speed_train_with_bullet_nose]=$'\U1F685' +emoji[train]=$'\U1F686' +emoji[metro]=$'\U1F687' +emoji[light_rail]=$'\U1F688' +emoji[station]=$'\U1F689' +emoji[tram]=$'\U1F68A' +emoji[tram_car]=$'\U1F68B' +emoji[bus]=$'\U1F68C' +emoji[oncoming_bus]=$'\U1F68D' +emoji[trolleybus]=$'\U1F68E' +emoji[bus_stop]=$'\U1F68F' +emoji[minibus]=$'\U1F690' +emoji[ambulance]=$'\U1F691' +emoji[fire_engine]=$'\U1F692' +emoji[police_car]=$'\U1F693' +emoji[oncoming_police_car]=$'\U1F694' +emoji[taxi]=$'\U1F695' +emoji[oncoming_taxi]=$'\U1F696' +emoji[automobile]=$'\U1F697' +emoji[oncoming_automobile]=$'\U1F698' +emoji[recreational_vehicle]=$'\U1F699' +emoji[delivery_truck]=$'\U1F69A' +emoji[articulated_lorry]=$'\U1F69B' +emoji[tractor]=$'\U1F69C' +emoji[monorail]=$'\U1F69D' +emoji[mountain_railway]=$'\U1F69E' +emoji[suspension_railway]=$'\U1F69F' +emoji[mountain_cableway]=$'\U1F6A0' +emoji[aerial_tramway]=$'\U1F6A1' +emoji[ship]=$'\U1F6A2' +emoji[rowboat]=$'\U1F6A3' +emoji[speedboat]=$'\U1F6A4' +emoji[horizontal_traffic_light]=$'\U1F6A5' +emoji[vertical_traffic_light]=$'\U1F6A6' +emoji[construction_sign]=$'\U1F6A7' +emoji[police_cars_revolving_light]=$'\U1F6A8' +emoji[triangular_flag_on_post]=$'\U1F6A9' +emoji[door]=$'\U1F6AA' +emoji[no_entry_sign]=$'\U1F6AB' +emoji[smoking_symbol]=$'\U1F6AC' +emoji[no_smoking_symbol]=$'\U1F6AD' +emoji[put_litter_in_its_place_symbol]=$'\U1F6AE' +emoji[do_not_litter_symbol]=$'\U1F6AF' +emoji[potable_water_symbol]=$'\U1F6B0' +emoji[non_potable_water_symbol]=$'\U1F6B1' +emoji[bicycle]=$'\U1F6B2' +emoji[no_bicycles]=$'\U1F6B3' +emoji[bicyclist]=$'\U1F6B4' +emoji[mountain_bicyclist]=$'\U1F6B5' +emoji[pedestrian]=$'\U1F6B6' +emoji[no_pedestrians]=$'\U1F6B7' +emoji[children_crossing]=$'\U1F6B8' +emoji[mens_symbol]=$'\U1F6B9' +emoji[womens_symbol]=$'\U1F6BA' +emoji[restroom]=$'\U1F6BB' +emoji[baby_symbol]=$'\U1F6BC' +emoji[toilet]=$'\U1F6BD' +emoji[water_closet]=$'\U1F6BE' +emoji[shower]=$'\U1F6BF' +emoji[bath]=$'\U1F6C0' +emoji[bathtub]=$'\U1F6C1' +emoji[passport_control]=$'\U1F6C2' +emoji[customs]=$'\U1F6C3' +emoji[baggage_claim]=$'\U1F6C4' +emoji[left_luggage]=$'\U1F6C5' +emoji[couch_and_lamp]=$'\U1F6CB' +emoji[sleeping_accommodation]=$'\U1F6CC' +emoji[shopping_bags]=$'\U1F6CD' +emoji[bellhop_bell]=$'\U1F6CE' +emoji[bed]=$'\U1F6CF' +emoji[place_of_worship]=$'\U1F6D0' +emoji[hammer_and_wrench]=$'\U1F6E0' +emoji[shield]=$'\U1F6E1' +emoji[oil_drum]=$'\U1F6E2' +emoji[motorway]=$'\U1F6E3' +emoji[railway_track]=$'\U1F6E4' +emoji[motor_boat]=$'\U1F6E5' +emoji[small_airplane]=$'\U1F6E9' +emoji[airplane_departure]=$'\U1F6EB' +emoji[airplane_arriving]=$'\U1F6EC' +emoji[satellite]=$'\U1F6F0' +emoji[passenger_ship]=$'\U1F6F3' +emoji[zipper_mouth_face]=$'\U1F910' +emoji[money_mouth_face]=$'\U1F911' +emoji[face_with_thermometer]=$'\U1F912' +emoji[nerd_face]=$'\U1F913' +emoji[thinking_face]=$'\U1F914' +emoji[face_with_head_bandage]=$'\U1F915' +emoji[robot_face]=$'\U1F916' +emoji[hugging_face]=$'\U1F917' +emoji[sign_of_the_horns]=$'\U1F918' +emoji[crab]=$'\U1F980' +emoji[lion_face]=$'\U1F981' +emoji[scorpion]=$'\U1F982' +emoji[turkey]=$'\U1F983' +emoji[unicorn_face]=$'\U1F984' +emoji[cheese_wedge]=$'\U1F9C0' +emoji[keycap_number_sign]=$'\U0023\U20E3' +emoji[keycap_asterisk]=$'\U002A\U20E3' +emoji[keycap_digit_zero]=$'\U0030\U20E3' +emoji[keycap_digit_one]=$'\U0031\U20E3' +emoji[keycap_digit_two]=$'\U0032\U20E3' +emoji[keycap_digit_three]=$'\U0033\U20E3' +emoji[keycap_digit_four]=$'\U0034\U20E3' +emoji[keycap_digit_five]=$'\U0035\U20E3' +emoji[keycap_digit_six]=$'\U0036\U20E3' +emoji[keycap_digit_seven]=$'\U0037\U20E3' +emoji[keycap_digit_eight]=$'\U0038\U20E3' +emoji[keycap_digit_nine]=$'\U0039\U20E3' +emoji_flags[Ascension_Island]=$'\U1F1E6\U1F1E8' +emoji_flags[Andorra]=$'\U1F1E6\U1F1E9' +emoji_flags[United_Arab_Emirates]=$'\U1F1E6\U1F1EA' +emoji_flags[Afghanistan]=$'\U1F1E6\U1F1EB' +emoji_flags[Antigua___Barbuda]=$'\U1F1E6\U1F1EC' +emoji_flags[Anguilla]=$'\U1F1E6\U1F1EE' +emoji_flags[Albania]=$'\U1F1E6\U1F1F1' +emoji_flags[Armenia]=$'\U1F1E6\U1F1F2' +emoji_flags[Angola]=$'\U1F1E6\U1F1F4' +emoji_flags[Antarctica]=$'\U1F1E6\U1F1F6' +emoji_flags[Argentina]=$'\U1F1E6\U1F1F7' +emoji_flags[American_Samoa]=$'\U1F1E6\U1F1F8' +emoji_flags[Austria]=$'\U1F1E6\U1F1F9' +emoji_flags[Australia]=$'\U1F1E6\U1F1FA' +emoji_flags[Aruba]=$'\U1F1E6\U1F1FC' +emoji_flags[_land_Islands]=$'\U1F1E6\U1F1FD' +emoji_flags[Azerbaijan]=$'\U1F1E6\U1F1FF' +emoji_flags[Bosnia___Herzegovina]=$'\U1F1E7\U1F1E6' +emoji_flags[Barbados]=$'\U1F1E7\U1F1E7' +emoji_flags[Bangladesh]=$'\U1F1E7\U1F1E9' +emoji_flags[Belgium]=$'\U1F1E7\U1F1EA' +emoji_flags[Burkina_Faso]=$'\U1F1E7\U1F1EB' +emoji_flags[Bulgaria]=$'\U1F1E7\U1F1EC' +emoji_flags[Bahrain]=$'\U1F1E7\U1F1ED' +emoji_flags[Burundi]=$'\U1F1E7\U1F1EE' +emoji_flags[Benin]=$'\U1F1E7\U1F1EF' +emoji_flags[St__Barth_lemy]=$'\U1F1E7\U1F1F1' +emoji_flags[Bermuda]=$'\U1F1E7\U1F1F2' +emoji_flags[Brunei]=$'\U1F1E7\U1F1F3' +emoji_flags[Bolivia]=$'\U1F1E7\U1F1F4' +emoji_flags[Caribbean_Netherlands]=$'\U1F1E7\U1F1F6' +emoji_flags[Brazil]=$'\U1F1E7\U1F1F7' +emoji_flags[Bahamas]=$'\U1F1E7\U1F1F8' +emoji_flags[Bhutan]=$'\U1F1E7\U1F1F9' +emoji_flags[Bouvet_Island]=$'\U1F1E7\U1F1FB' +emoji_flags[Botswana]=$'\U1F1E7\U1F1FC' +emoji_flags[Belarus]=$'\U1F1E7\U1F1FE' +emoji_flags[Belize]=$'\U1F1E7\U1F1FF' +emoji_flags[Canada]=$'\U1F1E8\U1F1E6' +emoji_flags[Cocos__Islands]=$'\U1F1E8\U1F1E8' +emoji_flags[Congo___Kinshasa]=$'\U1F1E8\U1F1E9' +emoji_flags[Central_African_Republic]=$'\U1F1E8\U1F1EB' +emoji_flags[Congo___Brazzaville]=$'\U1F1E8\U1F1EC' +emoji_flags[Switzerland]=$'\U1F1E8\U1F1ED' +emoji_flags[C_te_d__Ivoire]=$'\U1F1E8\U1F1EE' +emoji_flags[Cook_Islands]=$'\U1F1E8\U1F1F0' +emoji_flags[Chile]=$'\U1F1E8\U1F1F1' +emoji_flags[Cameroon]=$'\U1F1E8\U1F1F2' +emoji_flags[China]=$'\U1F1E8\U1F1F3' +emoji_flags[Colombia]=$'\U1F1E8\U1F1F4' +emoji_flags[Clipperton_Island]=$'\U1F1E8\U1F1F5' +emoji_flags[Costa_Rica]=$'\U1F1E8\U1F1F7' +emoji_flags[Cuba]=$'\U1F1E8\U1F1FA' +emoji_flags[Cape_Verde]=$'\U1F1E8\U1F1FB' +emoji_flags[Cura_ao]=$'\U1F1E8\U1F1FC' +emoji_flags[Christmas_Island]=$'\U1F1E8\U1F1FD' +emoji_flags[Cyprus]=$'\U1F1E8\U1F1FE' +emoji_flags[Czech_Republic]=$'\U1F1E8\U1F1FF' +emoji_flags[Germany]=$'\U1F1E9\U1F1EA' +emoji_flags[Diego_Garcia]=$'\U1F1E9\U1F1EC' +emoji_flags[Djibouti]=$'\U1F1E9\U1F1EF' +emoji_flags[Denmark]=$'\U1F1E9\U1F1F0' +emoji_flags[Dominica]=$'\U1F1E9\U1F1F2' +emoji_flags[Dominican_Republic]=$'\U1F1E9\U1F1F4' +emoji_flags[Algeria]=$'\U1F1E9\U1F1FF' +emoji_flags[Ceuta___Melilla]=$'\U1F1EA\U1F1E6' +emoji_flags[Ecuador]=$'\U1F1EA\U1F1E8' +emoji_flags[Estonia]=$'\U1F1EA\U1F1EA' +emoji_flags[Egypt]=$'\U1F1EA\U1F1EC' +emoji_flags[Western_Sahara]=$'\U1F1EA\U1F1ED' +emoji_flags[Eritrea]=$'\U1F1EA\U1F1F7' +emoji_flags[Spain]=$'\U1F1EA\U1F1F8' +emoji_flags[Ethiopia]=$'\U1F1EA\U1F1F9' +emoji_flags[European_Union]=$'\U1F1EA\U1F1FA' +emoji_flags[Finland]=$'\U1F1EB\U1F1EE' +emoji_flags[Fiji]=$'\U1F1EB\U1F1EF' +emoji_flags[Falkland_Islands]=$'\U1F1EB\U1F1F0' +emoji_flags[Micronesia]=$'\U1F1EB\U1F1F2' +emoji_flags[Faroe_Islands]=$'\U1F1EB\U1F1F4' +emoji_flags[France]=$'\U1F1EB\U1F1F7' +emoji_flags[Gabon]=$'\U1F1EC\U1F1E6' +emoji_flags[United_Kingdom]=$'\U1F1EC\U1F1E7' +emoji_flags[Grenada]=$'\U1F1EC\U1F1E9' +emoji_flags[Georgia]=$'\U1F1EC\U1F1EA' +emoji_flags[French_Guiana]=$'\U1F1EC\U1F1EB' +emoji_flags[Guernsey]=$'\U1F1EC\U1F1EC' +emoji_flags[Ghana]=$'\U1F1EC\U1F1ED' +emoji_flags[Gibraltar]=$'\U1F1EC\U1F1EE' +emoji_flags[Greenland]=$'\U1F1EC\U1F1F1' +emoji_flags[Gambia]=$'\U1F1EC\U1F1F2' +emoji_flags[Guinea]=$'\U1F1EC\U1F1F3' +emoji_flags[Guadeloupe]=$'\U1F1EC\U1F1F5' +emoji_flags[Equatorial_Guinea]=$'\U1F1EC\U1F1F6' +emoji_flags[Greece]=$'\U1F1EC\U1F1F7' +emoji_flags[South_Georgia___South_Sandwich_Islands]=$'\U1F1EC\U1F1F8' +emoji_flags[Guatemala]=$'\U1F1EC\U1F1F9' +emoji_flags[Guam]=$'\U1F1EC\U1F1FA' +emoji_flags[Guinea_Bissau]=$'\U1F1EC\U1F1FC' +emoji_flags[Guyana]=$'\U1F1EC\U1F1FE' +emoji_flags[Hong_Kong]=$'\U1F1ED\U1F1F0' +emoji_flags[Heard___McDonald_Islands]=$'\U1F1ED\U1F1F2' +emoji_flags[Honduras]=$'\U1F1ED\U1F1F3' +emoji_flags[Croatia]=$'\U1F1ED\U1F1F7' +emoji_flags[Haiti]=$'\U1F1ED\U1F1F9' +emoji_flags[Hungary]=$'\U1F1ED\U1F1FA' +emoji_flags[Canary_Islands]=$'\U1F1EE\U1F1E8' +emoji_flags[Indonesia]=$'\U1F1EE\U1F1E9' +emoji_flags[Ireland]=$'\U1F1EE\U1F1EA' +emoji_flags[Israel]=$'\U1F1EE\U1F1F1' +emoji_flags[Isle_of_Man]=$'\U1F1EE\U1F1F2' +emoji_flags[India]=$'\U1F1EE\U1F1F3' +emoji_flags[British_Indian_Ocean_Territory]=$'\U1F1EE\U1F1F4' +emoji_flags[Iraq]=$'\U1F1EE\U1F1F6' +emoji_flags[Iran]=$'\U1F1EE\U1F1F7' +emoji_flags[Iceland]=$'\U1F1EE\U1F1F8' +emoji_flags[Italy]=$'\U1F1EE\U1F1F9' +emoji_flags[Jersey]=$'\U1F1EF\U1F1EA' +emoji_flags[Jamaica]=$'\U1F1EF\U1F1F2' +emoji_flags[Jordan]=$'\U1F1EF\U1F1F4' +emoji_flags[Japan]=$'\U1F1EF\U1F1F5' +emoji_flags[Kenya]=$'\U1F1F0\U1F1EA' +emoji_flags[Kyrgyzstan]=$'\U1F1F0\U1F1EC' +emoji_flags[Cambodia]=$'\U1F1F0\U1F1ED' +emoji_flags[Kiribati]=$'\U1F1F0\U1F1EE' +emoji_flags[Comoros]=$'\U1F1F0\U1F1F2' +emoji_flags[St__Kitts___Nevis]=$'\U1F1F0\U1F1F3' +emoji_flags[North_Korea]=$'\U1F1F0\U1F1F5' +emoji_flags[South_Korea]=$'\U1F1F0\U1F1F7' +emoji_flags[Kuwait]=$'\U1F1F0\U1F1FC' +emoji_flags[Cayman_Islands]=$'\U1F1F0\U1F1FE' +emoji_flags[Kazakhstan]=$'\U1F1F0\U1F1FF' +emoji_flags[Laos]=$'\U1F1F1\U1F1E6' +emoji_flags[Lebanon]=$'\U1F1F1\U1F1E7' +emoji_flags[St__Lucia]=$'\U1F1F1\U1F1E8' +emoji_flags[Liechtenstein]=$'\U1F1F1\U1F1EE' +emoji_flags[Sri_Lanka]=$'\U1F1F1\U1F1F0' +emoji_flags[Liberia]=$'\U1F1F1\U1F1F7' +emoji_flags[Lesotho]=$'\U1F1F1\U1F1F8' +emoji_flags[Lithuania]=$'\U1F1F1\U1F1F9' +emoji_flags[Luxembourg]=$'\U1F1F1\U1F1FA' +emoji_flags[Latvia]=$'\U1F1F1\U1F1FB' +emoji_flags[Libya]=$'\U1F1F1\U1F1FE' +emoji_flags[Morocco]=$'\U1F1F2\U1F1E6' +emoji_flags[Monaco]=$'\U1F1F2\U1F1E8' +emoji_flags[Moldova]=$'\U1F1F2\U1F1E9' +emoji_flags[Montenegro]=$'\U1F1F2\U1F1EA' +emoji_flags[St__Martin]=$'\U1F1F2\U1F1EB' +emoji_flags[Madagascar]=$'\U1F1F2\U1F1EC' +emoji_flags[Marshall_Islands]=$'\U1F1F2\U1F1ED' +emoji_flags[Macedonia]=$'\U1F1F2\U1F1F0' +emoji_flags[Mali]=$'\U1F1F2\U1F1F1' +emoji_flags[Myanmar]=$'\U1F1F2\U1F1F2' +emoji_flags[Mongolia]=$'\U1F1F2\U1F1F3' +emoji_flags[Macau]=$'\U1F1F2\U1F1F4' +emoji_flags[Northern_Mariana_Islands]=$'\U1F1F2\U1F1F5' +emoji_flags[Martinique]=$'\U1F1F2\U1F1F6' +emoji_flags[Mauritania]=$'\U1F1F2\U1F1F7' +emoji_flags[Montserrat]=$'\U1F1F2\U1F1F8' +emoji_flags[Malta]=$'\U1F1F2\U1F1F9' +emoji_flags[Mauritius]=$'\U1F1F2\U1F1FA' +emoji_flags[Maldives]=$'\U1F1F2\U1F1FB' +emoji_flags[Malawi]=$'\U1F1F2\U1F1FC' +emoji_flags[Mexico]=$'\U1F1F2\U1F1FD' +emoji_flags[Malaysia]=$'\U1F1F2\U1F1FE' +emoji_flags[Mozambique]=$'\U1F1F2\U1F1FF' +emoji_flags[Namibia]=$'\U1F1F3\U1F1E6' +emoji_flags[New_Caledonia]=$'\U1F1F3\U1F1E8' +emoji_flags[Niger]=$'\U1F1F3\U1F1EA' +emoji_flags[Norfolk_Island]=$'\U1F1F3\U1F1EB' +emoji_flags[Nigeria]=$'\U1F1F3\U1F1EC' +emoji_flags[Nicaragua]=$'\U1F1F3\U1F1EE' +emoji_flags[Netherlands]=$'\U1F1F3\U1F1F1' +emoji_flags[Norway]=$'\U1F1F3\U1F1F4' +emoji_flags[Nepal]=$'\U1F1F3\U1F1F5' +emoji_flags[Nauru]=$'\U1F1F3\U1F1F7' +emoji_flags[Niue]=$'\U1F1F3\U1F1FA' +emoji_flags[New_Zealand]=$'\U1F1F3\U1F1FF' +emoji_flags[Oman]=$'\U1F1F4\U1F1F2' +emoji_flags[Panama]=$'\U1F1F5\U1F1E6' +emoji_flags[Peru]=$'\U1F1F5\U1F1EA' +emoji_flags[French_Polynesia]=$'\U1F1F5\U1F1EB' +emoji_flags[Papua_New_Guinea]=$'\U1F1F5\U1F1EC' +emoji_flags[Philippines]=$'\U1F1F5\U1F1ED' +emoji_flags[Pakistan]=$'\U1F1F5\U1F1F0' +emoji_flags[Poland]=$'\U1F1F5\U1F1F1' +emoji_flags[St__Pierre___Miquelon]=$'\U1F1F5\U1F1F2' +emoji_flags[Pitcairn_Islands]=$'\U1F1F5\U1F1F3' +emoji_flags[Puerto_Rico]=$'\U1F1F5\U1F1F7' +emoji_flags[Palestinian_Territories]=$'\U1F1F5\U1F1F8' +emoji_flags[Portugal]=$'\U1F1F5\U1F1F9' +emoji_flags[Palau]=$'\U1F1F5\U1F1FC' +emoji_flags[Paraguay]=$'\U1F1F5\U1F1FE' +emoji_flags[Qatar]=$'\U1F1F6\U1F1E6' +emoji_flags[R_union]=$'\U1F1F7\U1F1EA' +emoji_flags[Romania]=$'\U1F1F7\U1F1F4' +emoji_flags[Serbia]=$'\U1F1F7\U1F1F8' +emoji_flags[Russia]=$'\U1F1F7\U1F1FA' +emoji_flags[Rwanda]=$'\U1F1F7\U1F1FC' +emoji_flags[Saudi_Arabia]=$'\U1F1F8\U1F1E6' +emoji_flags[Solomon_Islands]=$'\U1F1F8\U1F1E7' +emoji_flags[Seychelles]=$'\U1F1F8\U1F1E8' +emoji_flags[Sudan]=$'\U1F1F8\U1F1E9' +emoji_flags[Sweden]=$'\U1F1F8\U1F1EA' +emoji_flags[Singapore]=$'\U1F1F8\U1F1EC' +emoji_flags[St__Helena]=$'\U1F1F8\U1F1ED' +emoji_flags[Slovenia]=$'\U1F1F8\U1F1EE' +emoji_flags[Svalbard___Jan_Mayen]=$'\U1F1F8\U1F1EF' +emoji_flags[Slovakia]=$'\U1F1F8\U1F1F0' +emoji_flags[Sierra_Leone]=$'\U1F1F8\U1F1F1' +emoji_flags[San_Marino]=$'\U1F1F8\U1F1F2' +emoji_flags[Senegal]=$'\U1F1F8\U1F1F3' +emoji_flags[Somalia]=$'\U1F1F8\U1F1F4' +emoji_flags[Suriname]=$'\U1F1F8\U1F1F7' +emoji_flags[South_Sudan]=$'\U1F1F8\U1F1F8' +emoji_flags[S_o_Tom____Pr_ncipe]=$'\U1F1F8\U1F1F9' +emoji_flags[El_Salvador]=$'\U1F1F8\U1F1FB' +emoji_flags[Sint_Maarten]=$'\U1F1F8\U1F1FD' +emoji_flags[Syria]=$'\U1F1F8\U1F1FE' +emoji_flags[Swaziland]=$'\U1F1F8\U1F1FF' +emoji_flags[Tristan_da_Cunha]=$'\U1F1F9\U1F1E6' +emoji_flags[Turks___Caicos_Islands]=$'\U1F1F9\U1F1E8' +emoji_flags[Chad]=$'\U1F1F9\U1F1E9' +emoji_flags[French_Southern_Territories]=$'\U1F1F9\U1F1EB' +emoji_flags[Togo]=$'\U1F1F9\U1F1EC' +emoji_flags[Thailand]=$'\U1F1F9\U1F1ED' +emoji_flags[Tajikistan]=$'\U1F1F9\U1F1EF' +emoji_flags[Tokelau]=$'\U1F1F9\U1F1F0' +emoji_flags[Timor_Leste]=$'\U1F1F9\U1F1F1' +emoji_flags[Turkmenistan]=$'\U1F1F9\U1F1F2' +emoji_flags[Tunisia]=$'\U1F1F9\U1F1F3' +emoji_flags[Tonga]=$'\U1F1F9\U1F1F4' +emoji_flags[Turkey]=$'\U1F1F9\U1F1F7' +emoji_flags[Trinidad___Tobago]=$'\U1F1F9\U1F1F9' +emoji_flags[Tuvalu]=$'\U1F1F9\U1F1FB' +emoji_flags[Taiwan]=$'\U1F1F9\U1F1FC' +emoji_flags[Tanzania]=$'\U1F1F9\U1F1FF' +emoji_flags[Ukraine]=$'\U1F1FA\U1F1E6' +emoji_flags[Uganda]=$'\U1F1FA\U1F1EC' +emoji_flags[U_S__Outlying_Islands]=$'\U1F1FA\U1F1F2' +emoji_flags[United_States]=$'\U1F1FA\U1F1F8' +emoji_flags[Uruguay]=$'\U1F1FA\U1F1FE' +emoji_flags[Uzbekistan]=$'\U1F1FA\U1F1FF' +emoji_flags[Vatican_City]=$'\U1F1FB\U1F1E6' +emoji_flags[St__Vincent___Grenadines]=$'\U1F1FB\U1F1E8' +emoji_flags[Venezuela]=$'\U1F1FB\U1F1EA' +emoji_flags[British_Virgin_Islands]=$'\U1F1FB\U1F1EC' +emoji_flags[U_S__Virgin_Islands]=$'\U1F1FB\U1F1EE' +emoji_flags[Vietnam]=$'\U1F1FB\U1F1F3' +emoji_flags[Vanuatu]=$'\U1F1FB\U1F1FA' +emoji_flags[Wallis___Futuna]=$'\U1F1FC\U1F1EB' +emoji_flags[Samoa]=$'\U1F1FC\U1F1F8' +emoji_flags[Kosovo]=$'\U1F1FD\U1F1F0' +emoji_flags[Yemen]=$'\U1F1FE\U1F1EA' +emoji_flags[Mayotte]=$'\U1F1FE\U1F1F9' +emoji_flags[South_Africa]=$'\U1F1FF\U1F1E6' +emoji_flags[Zambia]=$'\U1F1FF\U1F1F2' +emoji_flags[Zimbabwe]=$'\U1F1FF\U1F1FC' + diff --git a/oh-my-zsh/plugins/emoji/emoji-data.txt b/oh-my-zsh/plugins/emoji/emoji-data.txt @@ -0,0 +1,1308 @@ +# DRAFT emoji-data.txt +# For details about the format and other information, see /../../../reports/tr51/index.html#Data_Files. +# +# Format: Code ; Default_Emoji_Style ; Emoji_Level ; Emoji_Modifier_Status ; Emoji_Sources # Comment +# +# Field 1 — Default_Emoji_Style: +# text: default text presentation +# emoji: default emoji presentation +# Field 2 — Emoji_Level: +# L1: level 1 emoji +# L2: level 2 emoji +# NA: not applicable +# Field 3 — Emoji_Modifier_Status: +# modifier: an emoji modifier +# primary: a primary emoji modifier base +# secondary: a secondary emoji modifier base +# none: not applicable +# Field 4 — Emoji_Sources: +# one or more values from {z, a, j, w, x} +# see the key in http://www.unicode.org/draft/reports/tr51/tr51.html#Major_Sources +# NA: not applicable +# Comment — currently contains the version where the character was first encoded, +# followed by: +# - a character name in uppercase (for a single character), +# - a keycap name, +# - an associated flag, where is associated with value unicode region code +# +00A9 ; text ; L1 ; none ; j # V1.1 (©) COPYRIGHT SIGN +00AE ; text ; L1 ; none ; j # V1.1 (®) REGISTERED SIGN +203C ; text ; L1 ; none ; a j # V1.1 (‼) DOUBLE EXCLAMATION MARK +2049 ; text ; L1 ; none ; a j # V3.0 (⁉) EXCLAMATION QUESTION MARK +2122 ; text ; L1 ; none ; j # V1.1 (™) TRADE MARK SIGN +2139 ; text ; L1 ; none ; j # V3.0 (ℹ) INFORMATION SOURCE +2194 ; text ; L1 ; none ; z j # V1.1 (↔) LEFT RIGHT ARROW +2195 ; text ; L1 ; none ; z j # V1.1 (↕) UP DOWN ARROW +2196 ; text ; L1 ; none ; j # V1.1 (↖) NORTH WEST ARROW +2197 ; text ; L1 ; none ; j # V1.1 (↗) NORTH EAST ARROW +2198 ; text ; L1 ; none ; j # V1.1 (↘) SOUTH EAST ARROW +2199 ; text ; L1 ; none ; j # V1.1 (↙) SOUTH WEST ARROW +21A9 ; text ; L1 ; none ; j # V1.1 (↩) LEFTWARDS ARROW WITH HOOK +21AA ; text ; L1 ; none ; j # V1.1 (↪) RIGHTWARDS ARROW WITH HOOK +231A ; emoji ; L1 ; none ; j # V1.1 (⌚) WATCH +231B ; emoji ; L1 ; none ; j # V1.1 (⌛) HOURGLASS +2328 ; text ; L2 ; none ; x # V1.1 (⌨) KEYBOARD +23CF ; text ; L2 ; none ; x # V4.0 (⏏) EJECT SYMBOL +23E9 ; emoji ; L1 ; none ; j w # V6.0 (⏩) BLACK RIGHT-POINTING DOUBLE TRIANGLE +23EA ; emoji ; L1 ; none ; j w # V6.0 (⏪) BLACK LEFT-POINTING DOUBLE TRIANGLE +23EB ; emoji ; L1 ; none ; j # V6.0 (⏫) BLACK UP-POINTING DOUBLE TRIANGLE +23EC ; emoji ; L1 ; none ; j # V6.0 (⏬) BLACK DOWN-POINTING DOUBLE TRIANGLE +23ED ; text ; L2 ; none ; w # V6.0 (⏭) BLACK RIGHT-POINTING DOUBLE TRIANGLE WITH VERTICAL BAR +23EE ; text ; L2 ; none ; w # V6.0 (⏮) BLACK LEFT-POINTING DOUBLE TRIANGLE WITH VERTICAL BAR +23EF ; text ; L2 ; none ; x # V6.0 (⏯) BLACK RIGHT-POINTING TRIANGLE WITH DOUBLE VERTICAL BAR +23F0 ; emoji ; L1 ; none ; j # V6.0 (⏰) ALARM CLOCK +23F1 ; text ; L2 ; none ; x # V6.0 (⏱) STOPWATCH +23F2 ; text ; L2 ; none ; x # V6.0 (⏲) TIMER CLOCK +23F3 ; emoji ; L1 ; none ; j w # V6.0 (⏳) HOURGLASS WITH FLOWING SAND +23F8 ; text ; L2 ; none ; w # V7.0 (⏸) DOUBLE VERTICAL BAR +23F9 ; text ; L2 ; none ; w # V7.0 (⏹) BLACK SQUARE FOR STOP +23FA ; text ; L2 ; none ; w # V7.0 (⏺) BLACK CIRCLE FOR RECORD +24C2 ; text ; L1 ; none ; j # V1.1 (Ⓜ) CIRCLED LATIN CAPITAL LETTER M +25AA ; text ; L1 ; none ; j w # V1.1 (▪) BLACK SMALL SQUARE +25AB ; text ; L1 ; none ; j # V1.1 (▫) WHITE SMALL SQUARE +25B6 ; text ; L1 ; none ; a j w # V1.1 (▶) BLACK RIGHT-POINTING TRIANGLE +25C0 ; text ; L1 ; none ; a j w # V1.1 (◀) BLACK LEFT-POINTING TRIANGLE +25FB ; text ; L1 ; none ; j # V3.2 (◻) WHITE MEDIUM SQUARE +25FC ; text ; L1 ; none ; j w # V3.2 (◼) BLACK MEDIUM SQUARE +25FD ; emoji ; L1 ; none ; j # V3.2 (◽) WHITE MEDIUM SMALL SQUARE +25FE ; emoji ; L1 ; none ; j w # V3.2 (◾) BLACK MEDIUM SMALL SQUARE +2600 ; text ; L1 ; none ; a j # V1.1 (☀) BLACK SUN WITH RAYS +2601 ; text ; L1 ; none ; a j w # V1.1 (☁) CLOUD +2602 ; text ; L2 ; none ; a # V1.1 (☂) UMBRELLA +2603 ; text ; L2 ; none ; a # V1.1 (☃) SNOWMAN +2604 ; text ; L2 ; none ; x # V1.1 (☄) COMET +260E ; text ; L1 ; none ; z a j # V1.1 (☎) BLACK TELEPHONE +2611 ; text ; L1 ; none ; j w # V1.1 (☑) BALLOT BOX WITH CHECK +2614 ; emoji ; L1 ; none ; a j # V4.0 (☔) UMBRELLA WITH RAIN DROPS +2615 ; emoji ; L1 ; none ; j # V4.0 (☕) HOT BEVERAGE +2618 ; text ; L2 ; none ; x # V4.1 (☘) SHAMROCK +261D ; text ; L1 ; secondary ; j w # V1.1 (☝) WHITE UP POINTING INDEX +2620 ; text ; L2 ; none ; x # V1.1 (☠) SKULL AND CROSSBONES +2622 ; text ; L2 ; none ; x # V1.1 (☢) RADIOACTIVE SIGN +2623 ; text ; L2 ; none ; x # V1.1 (☣) BIOHAZARD SIGN +2626 ; text ; L2 ; none ; x # V1.1 (☦) ORTHODOX CROSS +262A ; text ; L2 ; none ; w # V1.1 (☪) STAR AND CRESCENT +262E ; text ; L2 ; none ; x # V1.1 (☮) PEACE SYMBOL +262F ; text ; L2 ; none ; w # V1.1 (☯) YIN YANG +2638 ; text ; L2 ; none ; w # V1.1 (☸) WHEEL OF DHARMA +2639 ; text ; L2 ; secondary ; w # V1.1 (☹) WHITE FROWNING FACE +263A ; text ; L1 ; secondary ; j w # V1.1 (☺) WHITE SMILING FACE +2648 ; emoji ; L1 ; none ; j w # V1.1 (♈) ARIES +2649 ; emoji ; L1 ; none ; j w # V1.1 (♉) TAURUS +264A ; emoji ; L1 ; none ; j w # V1.1 (♊) GEMINI +264B ; emoji ; L1 ; none ; j w # V1.1 (♋) CANCER +264C ; emoji ; L1 ; none ; j w # V1.1 (♌) LEO +264D ; emoji ; L1 ; none ; j w # V1.1 (♍) VIRGO +264E ; emoji ; L1 ; none ; j w # V1.1 (♎) LIBRA +264F ; emoji ; L1 ; none ; j w # V1.1 (♏) SCORPIUS +2650 ; emoji ; L1 ; none ; j w # V1.1 (♐) SAGITTARIUS +2651 ; emoji ; L1 ; none ; j w # V1.1 (♑) CAPRICORN +2652 ; emoji ; L1 ; none ; j w # V1.1 (♒) AQUARIUS +2653 ; emoji ; L1 ; none ; j w # V1.1 (♓) PISCES +2660 ; text ; L1 ; none ; z a j # V1.1 (♠) BLACK SPADE SUIT +2663 ; text ; L1 ; none ; z a j # V1.1 (♣) BLACK CLUB SUIT +2665 ; text ; L1 ; none ; z a j # V1.1 (♥) BLACK HEART SUIT +2666 ; text ; L1 ; none ; z a j # V1.1 (♦) BLACK DIAMOND SUIT +2668 ; text ; L1 ; none ; a j # V1.1 (♨) HOT SPRINGS +267B ; text ; L1 ; none ; j # V3.2 (♻) BLACK UNIVERSAL RECYCLING SYMBOL +267F ; emoji ; L1 ; none ; j w # V4.1 (♿) WHEELCHAIR SYMBOL +2692 ; text ; L2 ; none ; x # V4.1 (⚒) HAMMER AND PICK +2693 ; emoji ; L1 ; none ; a j # V4.1 (⚓) ANCHOR +2694 ; text ; L2 ; none ; x # V4.1 (⚔) CROSSED SWORDS +2696 ; text ; L2 ; none ; x # V4.1 (⚖) SCALES +2697 ; text ; L2 ; none ; x # V4.1 (⚗) ALEMBIC +2699 ; text ; L2 ; none ; x # V4.1 (⚙) GEAR +269B ; text ; L2 ; none ; x # V4.1 (⚛) ATOM SYMBOL +269C ; text ; L2 ; none ; x # V4.1 (⚜) FLEUR-DE-LIS +26A0 ; text ; L1 ; none ; j # V4.0 (⚠) WARNING SIGN +26A1 ; emoji ; L1 ; none ; a j # V4.0 (⚡) HIGH VOLTAGE SIGN +26AA ; emoji ; L1 ; none ; j # V4.1 (⚪) MEDIUM WHITE CIRCLE +26AB ; emoji ; L1 ; none ; j w # V4.1 (⚫) MEDIUM BLACK CIRCLE +26B0 ; text ; L2 ; none ; x # V4.1 (⚰) COFFIN +26B1 ; text ; L2 ; none ; x # V4.1 (⚱) FUNERAL URN +26BD ; emoji ; L1 ; none ; j # V5.2 (⚽) SOCCER BALL +26BE ; emoji ; L1 ; none ; a j # V5.2 (⚾) BASEBALL +26C4 ; emoji ; L1 ; none ; a j # V5.2 (⛄) SNOWMAN WITHOUT SNOW +26C5 ; emoji ; L1 ; none ; a j # V5.2 (⛅) SUN BEHIND CLOUD +26C8 ; text ; L2 ; none ; a # V5.2 (⛈) THUNDER CLOUD AND RAIN +26CE ; emoji ; L1 ; none ; a j # V6.0 (⛎) OPHIUCHUS +26CF ; text ; L2 ; none ; a # V5.2 (⛏) PICK +26D1 ; text ; L2 ; none ; a # V5.2 (⛑) HELMET WITH WHITE CROSS +26D3 ; text ; L2 ; none ; a # V5.2 (⛓) CHAINS +26D4 ; emoji ; L1 ; none ; a j # V5.2 (⛔) NO ENTRY +26E9 ; text ; L2 ; none ; a # V5.2 (⛩) SHINTO SHRINE +26EA ; emoji ; L1 ; none ; a j # V5.2 (⛪) CHURCH +26F0 ; text ; L2 ; none ; a # V5.2 (⛰) MOUNTAIN +26F1 ; text ; L2 ; none ; a # V5.2 (⛱) UMBRELLA ON GROUND +26F2 ; emoji ; L1 ; none ; a j # V5.2 (⛲) FOUNTAIN +26F3 ; emoji ; L1 ; none ; a j w # V5.2 (⛳) FLAG IN HOLE +26F4 ; text ; L2 ; none ; a # V5.2 (⛴) FERRY +26F5 ; emoji ; L1 ; none ; a j # V5.2 (⛵) SAILBOAT +26F7 ; text ; L2 ; none ; a w # V5.2 (⛷) SKIER +26F8 ; text ; L2 ; none ; a # V5.2 (⛸) ICE SKATE +26F9 ; text ; L2 ; none ; a # V5.2 (⛹) PERSON WITH BALL +26FA ; emoji ; L1 ; none ; a j # V5.2 (⛺) TENT +26FD ; emoji ; L1 ; none ; a j # V5.2 (⛽) FUEL PUMP +2702 ; text ; L1 ; none ; z j w # V1.1 (✂) BLACK SCISSORS +2705 ; emoji ; L1 ; none ; j # V6.0 (✅) WHITE HEAVY CHECK MARK +2708 ; text ; L1 ; none ; z a j w # V1.1 (✈) AIRPLANE +2709 ; text ; L1 ; none ; z j # V1.1 (✉) ENVELOPE +270A ; emoji ; L1 ; secondary ; j # V6.0 (✊) RAISED FIST +270B ; emoji ; L1 ; secondary ; j # V6.0 (✋) RAISED HAND +270C ; text ; L1 ; secondary ; z j w # V1.1 (✌) VICTORY HAND +270D ; text ; L2 ; secondary ; z w # V1.1 (✍) WRITING HAND +270F ; text ; L1 ; none ; z j # V1.1 (✏) PENCIL +2712 ; text ; L1 ; none ; z j # V1.1 (✒) BLACK NIB +2714 ; text ; L1 ; none ; z j w # V1.1 (✔) HEAVY CHECK MARK +2716 ; text ; L1 ; none ; z j # V1.1 (✖) HEAVY MULTIPLICATION X +271D ; text ; L2 ; none ; w # V1.1 (✝) LATIN CROSS +2721 ; text ; L2 ; none ; w # V1.1 (✡) STAR OF DAVID +2728 ; emoji ; L1 ; none ; j # V6.0 (✨) SPARKLES +2733 ; text ; L1 ; none ; z j # V1.1 (✳) EIGHT SPOKED ASTERISK +2734 ; text ; L1 ; none ; z j # V1.1 (✴) EIGHT POINTED BLACK STAR +2744 ; text ; L1 ; none ; z j w # V1.1 (❄) SNOWFLAKE +2747 ; text ; L1 ; none ; z j # V1.1 (❇) SPARKLE +274C ; emoji ; L1 ; none ; j # V6.0 (❌) CROSS MARK +274E ; emoji ; L1 ; none ; j # V6.0 (❎) NEGATIVE SQUARED CROSS MARK +2753 ; emoji ; L1 ; none ; j w # V6.0 (❓) BLACK QUESTION MARK ORNAMENT +2754 ; emoji ; L1 ; none ; j # V6.0 (❔) WHITE QUESTION MARK ORNAMENT +2755 ; emoji ; L1 ; none ; j # V6.0 (❕) WHITE EXCLAMATION MARK ORNAMENT +2757 ; emoji ; L1 ; none ; j # V5.2 (❗) HEAVY EXCLAMATION MARK SYMBOL +2763 ; text ; L2 ; none ; z # V1.1 (❣) HEAVY HEART EXCLAMATION MARK ORNAMENT +2764 ; text ; L1 ; none ; z j # V1.1 (❤) HEAVY BLACK HEART +2795 ; emoji ; L1 ; none ; j # V6.0 (➕) HEAVY PLUS SIGN +2796 ; emoji ; L1 ; none ; j # V6.0 (➖) HEAVY MINUS SIGN +2797 ; emoji ; L1 ; none ; j # V6.0 (➗) HEAVY DIVISION SIGN +27A1 ; text ; L1 ; none ; z a j # V1.1 (➡) BLACK RIGHTWARDS ARROW +27B0 ; emoji ; L1 ; none ; j # V6.0 (➰) CURLY LOOP +27BF ; emoji ; L1 ; none ; x # V6.0 (➿) DOUBLE CURLY LOOP +2934 ; text ; L1 ; none ; j # V3.2 (⤴) ARROW POINTING RIGHTWARDS THEN CURVING UPWARDS +2935 ; text ; L1 ; none ; j # V3.2 (⤵) ARROW POINTING RIGHTWARDS THEN CURVING DOWNWARDS +2B05 ; text ; L1 ; none ; a j # V4.0 (⬅) LEFTWARDS BLACK ARROW +2B06 ; text ; L1 ; none ; a j # V4.0 (⬆) UPWARDS BLACK ARROW +2B07 ; text ; L1 ; none ; a j # V4.0 (⬇) DOWNWARDS BLACK ARROW +2B1B ; emoji ; L1 ; none ; a j w # V5.1 (⬛) BLACK LARGE SQUARE +2B1C ; emoji ; L1 ; none ; j w # V5.1 (⬜) WHITE LARGE SQUARE +2B50 ; emoji ; L1 ; none ; j # V5.1 (⭐) WHITE MEDIUM STAR +2B55 ; emoji ; L1 ; none ; j # V5.2 (⭕) HEAVY LARGE CIRCLE +3030 ; text ; L1 ; none ; j # V1.1 (〰) WAVY DASH +303D ; text ; L1 ; none ; j # V3.2 (〽) PART ALTERNATION MARK +3297 ; text ; L1 ; none ; j # V1.1 (㊗) CIRCLED IDEOGRAPH CONGRATULATION +3299 ; text ; L1 ; none ; a j # V1.1 (㊙) CIRCLED IDEOGRAPH SECRET +1F004 ; emoji ; L1 ; none ; j # V5.1 (🀄) MAHJONG TILE RED DRAGON +1F0CF ; emoji ; L1 ; none ; j # V6.0 (🃏) PLAYING CARD BLACK JOKER +1F170 ; text ; L1 ; none ; j # V6.0 (🅰) NEGATIVE SQUARED LATIN CAPITAL LETTER A +1F171 ; text ; L1 ; none ; j # V6.0 (🅱) NEGATIVE SQUARED LATIN CAPITAL LETTER B +1F17E ; text ; L1 ; none ; j # V6.0 (🅾) NEGATIVE SQUARED LATIN CAPITAL LETTER O +1F17F ; text ; L1 ; none ; a j # V5.2 (🅿) NEGATIVE SQUARED LATIN CAPITAL LETTER P +1F18E ; emoji ; L1 ; none ; j # V6.0 (🆎) NEGATIVE SQUARED AB +1F191 ; emoji ; L1 ; none ; j # V6.0 (🆑) SQUARED CL +1F192 ; emoji ; L1 ; none ; j # V6.0 (🆒) SQUARED COOL +1F193 ; emoji ; L1 ; none ; j # V6.0 (🆓) SQUARED FREE +1F194 ; emoji ; L1 ; none ; j # V6.0 (🆔) SQUARED ID +1F195 ; emoji ; L1 ; none ; j # V6.0 (🆕) SQUARED NEW +1F196 ; emoji ; L1 ; none ; j # V6.0 (🆖) SQUARED NG +1F197 ; emoji ; L1 ; none ; j # V6.0 (🆗) SQUARED OK +1F198 ; emoji ; L1 ; none ; j # V6.0 (🆘) SQUARED SOS +1F199 ; emoji ; L1 ; none ; j # V6.0 (🆙) SQUARED UP WITH EXCLAMATION MARK +1F19A ; emoji ; L1 ; none ; j # V6.0 (🆚) SQUARED VS +1F201 ; emoji ; L1 ; none ; j # V6.0 (🈁) SQUARED KATAKANA KOKO +1F202 ; text ; L1 ; none ; j # V6.0 (🈂) SQUARED KATAKANA SA +1F21A ; emoji ; L1 ; none ; a j # V5.2 (🈚) SQUARED CJK UNIFIED IDEOGRAPH-7121 +1F22F ; emoji ; L1 ; none ; a j # V5.2 (🈯) SQUARED CJK UNIFIED IDEOGRAPH-6307 +1F232 ; emoji ; L1 ; none ; j # V6.0 (🈲) SQUARED CJK UNIFIED IDEOGRAPH-7981 +1F233 ; emoji ; L1 ; none ; j # V6.0 (🈳) SQUARED CJK UNIFIED IDEOGRAPH-7A7A +1F234 ; emoji ; L1 ; none ; j # V6.0 (🈴) SQUARED CJK UNIFIED IDEOGRAPH-5408 +1F235 ; emoji ; L1 ; none ; j # V6.0 (🈵) SQUARED CJK UNIFIED IDEOGRAPH-6E80 +1F236 ; emoji ; L1 ; none ; j # V6.0 (🈶) SQUARED CJK UNIFIED IDEOGRAPH-6709 +1F237 ; text ; L1 ; none ; j # V6.0 (🈷) SQUARED CJK UNIFIED IDEOGRAPH-6708 +1F238 ; emoji ; L1 ; none ; j # V6.0 (🈸) SQUARED CJK UNIFIED IDEOGRAPH-7533 +1F239 ; emoji ; L1 ; none ; j # V6.0 (🈹) SQUARED CJK UNIFIED IDEOGRAPH-5272 +1F23A ; emoji ; L1 ; none ; j # V6.0 (🈺) SQUARED CJK UNIFIED IDEOGRAPH-55B6 +1F250 ; emoji ; L1 ; none ; j # V6.0 (🉐) CIRCLED IDEOGRAPH ADVANTAGE +1F251 ; emoji ; L1 ; none ; j # V6.0 (🉑) CIRCLED IDEOGRAPH ACCEPT +1F300 ; emoji ; L1 ; none ; j # V6.0 (🌀) CYCLONE +1F301 ; emoji ; L1 ; none ; j # V6.0 (🌁) FOGGY +1F302 ; emoji ; L1 ; none ; j # V6.0 (🌂) CLOSED UMBRELLA +1F303 ; emoji ; L1 ; none ; j # V6.0 (🌃) NIGHT WITH STARS +1F304 ; emoji ; L1 ; none ; j # V6.0 (🌄) SUNRISE OVER MOUNTAINS +1F305 ; emoji ; L1 ; none ; j # V6.0 (🌅) SUNRISE +1F306 ; emoji ; L1 ; none ; j # V6.0 (🌆) CITYSCAPE AT DUSK +1F307 ; emoji ; L1 ; none ; j # V6.0 (🌇) SUNSET OVER BUILDINGS +1F308 ; emoji ; L1 ; none ; j # V6.0 (🌈) RAINBOW +1F309 ; emoji ; L1 ; none ; j # V6.0 (🌉) BRIDGE AT NIGHT +1F30A ; emoji ; L1 ; none ; j # V6.0 (🌊) WATER WAVE +1F30B ; emoji ; L1 ; none ; j # V6.0 (🌋) VOLCANO +1F30C ; emoji ; L1 ; none ; j # V6.0 (🌌) MILKY WAY +1F30D ; emoji ; L1 ; none ; w # V6.0 (🌍) EARTH GLOBE EUROPE-AFRICA +1F30E ; emoji ; L1 ; none ; w # V6.0 (🌎) EARTH GLOBE AMERICAS +1F30F ; emoji ; L1 ; none ; j w # V6.0 (🌏) EARTH GLOBE ASIA-AUSTRALIA +1F310 ; emoji ; L1 ; none ; x # V6.0 (🌐) GLOBE WITH MERIDIANS +1F311 ; emoji ; L1 ; none ; j # V6.0 (🌑) NEW MOON SYMBOL +1F312 ; emoji ; L1 ; none ; x # V6.0 (🌒) WAXING CRESCENT MOON SYMBOL +1F313 ; emoji ; L1 ; none ; j # V6.0 (🌓) FIRST QUARTER MOON SYMBOL +1F314 ; emoji ; L1 ; none ; j # V6.0 (🌔) WAXING GIBBOUS MOON SYMBOL +1F315 ; emoji ; L1 ; none ; j w # V6.0 (🌕) FULL MOON SYMBOL +1F316 ; emoji ; L1 ; none ; x # V6.0 (🌖) WANING GIBBOUS MOON SYMBOL +1F317 ; emoji ; L1 ; none ; x # V6.0 (🌗) LAST QUARTER MOON SYMBOL +1F318 ; emoji ; L1 ; none ; x # V6.0 (🌘) WANING CRESCENT MOON SYMBOL +1F319 ; emoji ; L1 ; none ; j # V6.0 (🌙) CRESCENT MOON +1F31A ; emoji ; L1 ; none ; x # V6.0 (🌚) NEW MOON WITH FACE +1F31B ; emoji ; L1 ; none ; j # V6.0 (🌛) FIRST QUARTER MOON WITH FACE +1F31C ; emoji ; L1 ; none ; w # V6.0 (🌜) LAST QUARTER MOON WITH FACE +1F31D ; emoji ; L1 ; none ; x # V6.0 (🌝) FULL MOON WITH FACE +1F31E ; emoji ; L1 ; none ; x # V6.0 (🌞) SUN WITH FACE +1F31F ; emoji ; L1 ; none ; j # V6.0 (🌟) GLOWING STAR +1F320 ; emoji ; L1 ; none ; j # V6.0 (🌠) SHOOTING STAR +1F321 ; text ; L2 ; none ; w # V7.0 (🌡) THERMOMETER +1F324 ; text ; L2 ; none ; w # V7.0 (🌤) WHITE SUN WITH SMALL CLOUD +1F325 ; text ; L2 ; none ; w # V7.0 (🌥) WHITE SUN BEHIND CLOUD +1F326 ; text ; L2 ; none ; w # V7.0 (🌦) WHITE SUN BEHIND CLOUD WITH RAIN +1F327 ; text ; L2 ; none ; w # V7.0 (🌧) CLOUD WITH RAIN +1F328 ; text ; L2 ; none ; w # V7.0 (🌨) CLOUD WITH SNOW +1F329 ; text ; L2 ; none ; w # V7.0 (🌩) CLOUD WITH LIGHTNING +1F32A ; text ; L2 ; none ; w # V7.0 (🌪) CLOUD WITH TORNADO +1F32B ; text ; L2 ; none ; w # V7.0 (🌫) FOG +1F32C ; text ; L2 ; none ; w # V7.0 (🌬) WIND BLOWING FACE +1F32D ; emoji ; L2 ; none ; x # V8.0 (🌭) HOT DOG +1F32E ; emoji ; L2 ; none ; x # V8.0 (🌮) TACO +1F32F ; emoji ; L2 ; none ; x # V8.0 (🌯) BURRITO +1F330 ; emoji ; L1 ; none ; j # V6.0 (🌰) CHESTNUT +1F331 ; emoji ; L1 ; none ; j # V6.0 (🌱) SEEDLING +1F332 ; emoji ; L1 ; none ; x # V6.0 (🌲) EVERGREEN TREE +1F333 ; emoji ; L1 ; none ; x # V6.0 (🌳) DECIDUOUS TREE +1F334 ; emoji ; L1 ; none ; j # V6.0 (🌴) PALM TREE +1F335 ; emoji ; L1 ; none ; j # V6.0 (🌵) CACTUS +1F336 ; text ; L2 ; none ; w # V7.0 (🌶) HOT PEPPER +1F337 ; emoji ; L1 ; none ; j # V6.0 (🌷) TULIP +1F338 ; emoji ; L1 ; none ; j # V6.0 (🌸) CHERRY BLOSSOM +1F339 ; emoji ; L1 ; none ; j # V6.0 (🌹) ROSE +1F33A ; emoji ; L1 ; none ; j # V6.0 (🌺) HIBISCUS +1F33B ; emoji ; L1 ; none ; j # V6.0 (🌻) SUNFLOWER +1F33C ; emoji ; L1 ; none ; j # V6.0 (🌼) BLOSSOM +1F33D ; emoji ; L1 ; none ; j # V6.0 (🌽) EAR OF MAIZE +1F33E ; emoji ; L1 ; none ; j # V6.0 (🌾) EAR OF RICE +1F33F ; emoji ; L1 ; none ; j # V6.0 (🌿) HERB +1F340 ; emoji ; L1 ; none ; j # V6.0 (🍀) FOUR LEAF CLOVER +1F341 ; emoji ; L1 ; none ; j # V6.0 (🍁) MAPLE LEAF +1F342 ; emoji ; L1 ; none ; j # V6.0 (🍂) FALLEN LEAF +1F343 ; emoji ; L1 ; none ; j # V6.0 (🍃) LEAF FLUTTERING IN WIND +1F344 ; emoji ; L1 ; none ; j # V6.0 (🍄) MUSHROOM +1F345 ; emoji ; L1 ; none ; j # V6.0 (🍅) TOMATO +1F346 ; emoji ; L1 ; none ; j # V6.0 (🍆) AUBERGINE +1F347 ; emoji ; L1 ; none ; j # V6.0 (🍇) GRAPES +1F348 ; emoji ; L1 ; none ; j # V6.0 (🍈) MELON +1F349 ; emoji ; L1 ; none ; j # V6.0 (🍉) WATERMELON +1F34A ; emoji ; L1 ; none ; j # V6.0 (🍊) TANGERINE +1F34B ; emoji ; L1 ; none ; x # V6.0 (🍋) LEMON +1F34C ; emoji ; L1 ; none ; j # V6.0 (🍌) BANANA +1F34D ; emoji ; L1 ; none ; j # V6.0 (🍍) PINEAPPLE +1F34E ; emoji ; L1 ; none ; j # V6.0 (🍎) RED APPLE +1F34F ; emoji ; L1 ; none ; j # V6.0 (🍏) GREEN APPLE +1F350 ; emoji ; L1 ; none ; x # V6.0 (🍐) PEAR +1F351 ; emoji ; L1 ; none ; j # V6.0 (🍑) PEACH +1F352 ; emoji ; L1 ; none ; j # V6.0 (🍒) CHERRIES +1F353 ; emoji ; L1 ; none ; j # V6.0 (🍓) STRAWBERRY +1F354 ; emoji ; L1 ; none ; j # V6.0 (🍔) HAMBURGER +1F355 ; emoji ; L1 ; none ; j # V6.0 (🍕) SLICE OF PIZZA +1F356 ; emoji ; L1 ; none ; j # V6.0 (🍖) MEAT ON BONE +1F357 ; emoji ; L1 ; none ; j # V6.0 (🍗) POULTRY LEG +1F358 ; emoji ; L1 ; none ; j # V6.0 (🍘) RICE CRACKER +1F359 ; emoji ; L1 ; none ; j # V6.0 (🍙) RICE BALL +1F35A ; emoji ; L1 ; none ; j # V6.0 (🍚) COOKED RICE +1F35B ; emoji ; L1 ; none ; j # V6.0 (🍛) CURRY AND RICE +1F35C ; emoji ; L1 ; none ; j # V6.0 (🍜) STEAMING BOWL +1F35D ; emoji ; L1 ; none ; j # V6.0 (🍝) SPAGHETTI +1F35E ; emoji ; L1 ; none ; j # V6.0 (🍞) BREAD +1F35F ; emoji ; L1 ; none ; j # V6.0 (🍟) FRENCH FRIES +1F360 ; emoji ; L1 ; none ; j # V6.0 (🍠) ROASTED SWEET POTATO +1F361 ; emoji ; L1 ; none ; j # V6.0 (🍡) DANGO +1F362 ; emoji ; L1 ; none ; j # V6.0 (🍢) ODEN +1F363 ; emoji ; L1 ; none ; j # V6.0 (🍣) SUSHI +1F364 ; emoji ; L1 ; none ; j # V6.0 (🍤) FRIED SHRIMP +1F365 ; emoji ; L1 ; none ; j # V6.0 (🍥) FISH CAKE WITH SWIRL DESIGN +1F366 ; emoji ; L1 ; none ; j # V6.0 (🍦) SOFT ICE CREAM +1F367 ; emoji ; L1 ; none ; j # V6.0 (🍧) SHAVED ICE +1F368 ; emoji ; L1 ; none ; j # V6.0 (🍨) ICE CREAM +1F369 ; emoji ; L1 ; none ; j # V6.0 (🍩) DOUGHNUT +1F36A ; emoji ; L1 ; none ; j # V6.0 (🍪) COOKIE +1F36B ; emoji ; L1 ; none ; j # V6.0 (🍫) CHOCOLATE BAR +1F36C ; emoji ; L1 ; none ; j # V6.0 (🍬) CANDY +1F36D ; emoji ; L1 ; none ; j # V6.0 (🍭) LOLLIPOP +1F36E ; emoji ; L1 ; none ; j # V6.0 (🍮) CUSTARD +1F36F ; emoji ; L1 ; none ; j # V6.0 (🍯) HONEY POT +1F370 ; emoji ; L1 ; none ; j # V6.0 (🍰) SHORTCAKE +1F371 ; emoji ; L1 ; none ; j # V6.0 (🍱) BENTO BOX +1F372 ; emoji ; L1 ; none ; j # V6.0 (🍲) POT OF FOOD +1F373 ; emoji ; L1 ; none ; j # V6.0 (🍳) COOKING +1F374 ; emoji ; L1 ; none ; j # V6.0 (🍴) FORK AND KNIFE +1F375 ; emoji ; L1 ; none ; j # V6.0 (🍵) TEACUP WITHOUT HANDLE +1F376 ; emoji ; L1 ; none ; j # V6.0 (🍶) SAKE BOTTLE AND CUP +1F377 ; emoji ; L1 ; none ; j # V6.0 (🍷) WINE GLASS +1F378 ; emoji ; L1 ; none ; j w # V6.0 (🍸) COCKTAIL GLASS +1F379 ; emoji ; L1 ; none ; j # V6.0 (🍹) TROPICAL DRINK +1F37A ; emoji ; L1 ; none ; j # V6.0 (🍺) BEER MUG +1F37B ; emoji ; L1 ; none ; j # V6.0 (🍻) CLINKING BEER MUGS +1F37C ; emoji ; L1 ; none ; x # V6.0 (🍼) BABY BOTTLE +1F37D ; text ; L2 ; none ; w # V7.0 (🍽) FORK AND KNIFE WITH PLATE +1F37E ; emoji ; L2 ; none ; x # V8.0 (🍾) BOTTLE WITH POPPING CORK +1F37F ; emoji ; L2 ; none ; x # V8.0 (🍿) POPCORN +1F380 ; emoji ; L1 ; none ; j # V6.0 (🎀) RIBBON +1F381 ; emoji ; L1 ; none ; j # V6.0 (🎁) WRAPPED PRESENT +1F382 ; emoji ; L1 ; none ; j # V6.0 (🎂) BIRTHDAY CAKE +1F383 ; emoji ; L1 ; none ; j # V6.0 (🎃) JACK-O-LANTERN +1F384 ; emoji ; L1 ; none ; j # V6.0 (🎄) CHRISTMAS TREE +1F385 ; emoji ; L1 ; primary ; j # V6.0 (🎅) FATHER CHRISTMAS +1F386 ; emoji ; L1 ; none ; j # V6.0 (🎆) FIREWORKS +1F387 ; emoji ; L1 ; none ; j # V6.0 (🎇) FIREWORK SPARKLER +1F388 ; emoji ; L1 ; none ; j # V6.0 (🎈) BALLOON +1F389 ; emoji ; L1 ; none ; j # V6.0 (🎉) PARTY POPPER +1F38A ; emoji ; L1 ; none ; j # V6.0 (🎊) CONFETTI BALL +1F38B ; emoji ; L1 ; none ; j # V6.0 (🎋) TANABATA TREE +1F38C ; emoji ; L1 ; none ; j # V6.0 (🎌) CROSSED FLAGS +1F38D ; emoji ; L1 ; none ; j # V6.0 (🎍) PINE DECORATION +1F38E ; emoji ; L1 ; none ; j # V6.0 (🎎) JAPANESE DOLLS +1F38F ; emoji ; L1 ; none ; j # V6.0 (🎏) CARP STREAMER +1F390 ; emoji ; L1 ; none ; j # V6.0 (🎐) WIND CHIME +1F391 ; emoji ; L1 ; none ; j # V6.0 (🎑) MOON VIEWING CEREMONY +1F392 ; emoji ; L1 ; none ; j # V6.0 (🎒) SCHOOL SATCHEL +1F393 ; emoji ; L1 ; none ; j w # V6.0 (🎓) GRADUATION CAP +1F396 ; text ; L2 ; none ; w # V7.0 (🎖) MILITARY MEDAL +1F397 ; text ; L2 ; none ; w # V7.0 (🎗) REMINDER RIBBON +1F399 ; text ; L2 ; none ; w # V7.0 (🎙) STUDIO MICROPHONE +1F39A ; text ; L2 ; none ; w # V7.0 (🎚) LEVEL SLIDER +1F39B ; text ; L2 ; none ; w # V7.0 (🎛) CONTROL KNOBS +1F39E ; text ; L2 ; none ; w # V7.0 (🎞) FILM FRAMES +1F39F ; text ; L2 ; none ; w # V7.0 (🎟) ADMISSION TICKETS +1F3A0 ; emoji ; L1 ; none ; j # V6.0 (🎠) CAROUSEL HORSE +1F3A1 ; emoji ; L1 ; none ; j # V6.0 (🎡) FERRIS WHEEL +1F3A2 ; emoji ; L1 ; none ; j # V6.0 (🎢) ROLLER COASTER +1F3A3 ; emoji ; L1 ; none ; j # V6.0 (🎣) FISHING POLE AND FISH +1F3A4 ; emoji ; L1 ; none ; j # V6.0 (🎤) MICROPHONE +1F3A5 ; emoji ; L1 ; none ; j # V6.0 (🎥) MOVIE CAMERA +1F3A6 ; emoji ; L1 ; none ; j # V6.0 (🎦) CINEMA +1F3A7 ; emoji ; L1 ; none ; j w # V6.0 (🎧) HEADPHONE +1F3A8 ; emoji ; L1 ; none ; j # V6.0 (🎨) ARTIST PALETTE +1F3A9 ; emoji ; L1 ; none ; j # V6.0 (🎩) TOP HAT +1F3AA ; emoji ; L1 ; none ; j # V6.0 (🎪) CIRCUS TENT +1F3AB ; emoji ; L1 ; none ; j # V6.0 (🎫) TICKET +1F3AC ; emoji ; L1 ; none ; j w # V6.0 (🎬) CLAPPER BOARD +1F3AD ; emoji ; L1 ; none ; j w # V6.0 (🎭) PERFORMING ARTS +1F3AE ; emoji ; L1 ; none ; j w # V6.0 (🎮) VIDEO GAME +1F3AF ; emoji ; L1 ; none ; j # V6.0 (🎯) DIRECT HIT +1F3B0 ; emoji ; L1 ; none ; j # V6.0 (🎰) SLOT MACHINE +1F3B1 ; emoji ; L1 ; none ; j # V6.0 (🎱) BILLIARDS +1F3B2 ; emoji ; L1 ; none ; j # V6.0 (🎲) GAME DIE +1F3B3 ; emoji ; L1 ; none ; j # V6.0 (🎳) BOWLING +1F3B4 ; emoji ; L1 ; none ; j # V6.0 (🎴) FLOWER PLAYING CARDS +1F3B5 ; emoji ; L1 ; none ; j # V6.0 (🎵) MUSICAL NOTE +1F3B6 ; emoji ; L1 ; none ; j # V6.0 (🎶) MULTIPLE MUSICAL NOTES +1F3B7 ; emoji ; L1 ; none ; j # V6.0 (🎷) SAXOPHONE +1F3B8 ; emoji ; L1 ; none ; j # V6.0 (🎸) GUITAR +1F3B9 ; emoji ; L1 ; none ; j # V6.0 (🎹) MUSICAL KEYBOARD +1F3BA ; emoji ; L1 ; none ; j # V6.0 (🎺) TRUMPET +1F3BB ; emoji ; L1 ; none ; j # V6.0 (🎻) VIOLIN +1F3BC ; emoji ; L1 ; none ; j # V6.0 (🎼) MUSICAL SCORE +1F3BD ; emoji ; L1 ; none ; j # V6.0 (🎽) RUNNING SHIRT WITH SASH +1F3BE ; emoji ; L1 ; none ; j # V6.0 (🎾) TENNIS RACQUET AND BALL +1F3BF ; emoji ; L1 ; none ; j # V6.0 (🎿) SKI AND SKI BOOT +1F3C0 ; emoji ; L1 ; none ; j # V6.0 (🏀) BASKETBALL AND HOOP +1F3C1 ; emoji ; L1 ; none ; j # V6.0 (🏁) CHEQUERED FLAG +1F3C2 ; emoji ; L1 ; secondary ; j w # V6.0 (🏂) SNOWBOARDER +1F3C3 ; emoji ; L1 ; secondary ; j # V6.0 (🏃) RUNNER +1F3C4 ; emoji ; L1 ; secondary ; j w # V6.0 (🏄) SURFER +1F3C5 ; emoji ; L2 ; none ; x # V7.0 (🏅) SPORTS MEDAL +1F3C6 ; emoji ; L1 ; none ; j w # V6.0 (🏆) TROPHY +1F3C7 ; emoji ; L1 ; secondary ; x # V6.0 (🏇) HORSE RACING +1F3C8 ; emoji ; L1 ; none ; j # V6.0 (🏈) AMERICAN FOOTBALL +1F3C9 ; emoji ; L1 ; none ; x # V6.0 (🏉) RUGBY FOOTBALL +1F3CA ; emoji ; L1 ; secondary ; j w # V6.0 (🏊) SWIMMER +1F3CB ; text ; L2 ; none ; w # V7.0 (🏋) WEIGHT LIFTER +1F3CC ; text ; L2 ; none ; w # V7.0 (🏌) GOLFER +1F3CD ; text ; L2 ; none ; w # V7.0 (🏍) RACING MOTORCYCLE +1F3CE ; text ; L2 ; none ; w # V7.0 (🏎) RACING CAR +1F3CF ; emoji ; L2 ; none ; x # V8.0 (🏏) CRICKET BAT AND BALL +1F3D0 ; emoji ; L2 ; none ; x # V8.0 (🏐) VOLLEYBALL +1F3D1 ; emoji ; L2 ; none ; x # V8.0 (🏑) FIELD HOCKEY STICK AND BALL +1F3D2 ; emoji ; L2 ; none ; x # V8.0 (🏒) ICE HOCKEY STICK AND PUCK +1F3D3 ; emoji ; L2 ; none ; x # V8.0 (🏓) TABLE TENNIS PADDLE AND BALL +1F3D4 ; text ; L2 ; none ; w # V7.0 (🏔) SNOW CAPPED MOUNTAIN +1F3D5 ; text ; L2 ; none ; w # V7.0 (🏕) CAMPING +1F3D6 ; text ; L2 ; none ; w # V7.0 (🏖) BEACH WITH UMBRELLA +1F3D7 ; text ; L2 ; none ; w # V7.0 (🏗) BUILDING CONSTRUCTION +1F3D8 ; text ; L2 ; none ; w # V7.0 (🏘) HOUSE BUILDINGS +1F3D9 ; text ; L2 ; none ; w # V7.0 (🏙) CITYSCAPE +1F3DA ; text ; L2 ; none ; w # V7.0 (🏚) DERELICT HOUSE BUILDING +1F3DB ; text ; L2 ; none ; w # V7.0 (🏛) CLASSICAL BUILDING +1F3DC ; text ; L2 ; none ; w # V7.0 (🏜) DESERT +1F3DD ; text ; L2 ; none ; w # V7.0 (🏝) DESERT ISLAND +1F3DE ; text ; L2 ; none ; w # V7.0 (🏞) NATIONAL PARK +1F3DF ; text ; L2 ; none ; w # V7.0 (🏟) STADIUM +1F3E0 ; emoji ; L1 ; none ; j w # V6.0 (🏠) HOUSE BUILDING +1F3E1 ; emoji ; L1 ; none ; j # V6.0 (🏡) HOUSE WITH GARDEN +1F3E2 ; emoji ; L1 ; none ; j # V6.0 (🏢) OFFICE BUILDING +1F3E3 ; emoji ; L1 ; none ; j # V6.0 (🏣) JAPANESE POST OFFICE +1F3E4 ; emoji ; L1 ; none ; x # V6.0 (🏤) EUROPEAN POST OFFICE +1F3E5 ; emoji ; L1 ; none ; j # V6.0 (🏥) HOSPITAL +1F3E6 ; emoji ; L1 ; none ; j # V6.0 (🏦) BANK +1F3E7 ; emoji ; L1 ; none ; j # V6.0 (🏧) AUTOMATED TELLER MACHINE +1F3E8 ; emoji ; L1 ; none ; j # V6.0 (🏨) HOTEL +1F3E9 ; emoji ; L1 ; none ; j # V6.0 (🏩) LOVE HOTEL +1F3EA ; emoji ; L1 ; none ; j # V6.0 (🏪) CONVENIENCE STORE +1F3EB ; emoji ; L1 ; none ; j # V6.0 (🏫) SCHOOL +1F3EC ; emoji ; L1 ; none ; j # V6.0 (🏬) DEPARTMENT STORE +1F3ED ; emoji ; L1 ; none ; j w # V6.0 (🏭) FACTORY +1F3EE ; emoji ; L1 ; none ; j # V6.0 (🏮) IZAKAYA LANTERN +1F3EF ; emoji ; L1 ; none ; j # V6.0 (🏯) JAPANESE CASTLE +1F3F0 ; emoji ; L1 ; none ; j # V6.0 (🏰) EUROPEAN CASTLE +1F3F3 ; text ; L2 ; none ; w # V7.0 (🏳) WAVING WHITE FLAG +1F3F4 ; emoji ; L2 ; none ; x # V7.0 (🏴) WAVING BLACK FLAG +1F3F5 ; text ; L2 ; none ; w # V7.0 (🏵) ROSETTE +1F3F7 ; text ; L2 ; none ; w # V7.0 (🏷) LABEL +1F3F8 ; emoji ; L2 ; none ; x # V8.0 (🏸) BADMINTON RACQUET AND SHUTTLECOCK +1F3F9 ; emoji ; L2 ; none ; x # V8.0 (🏹) BOW AND ARROW +1F3FA ; emoji ; L2 ; none ; x # V8.0 (🏺) AMPHORA +1F3FB ; emoji ; L2 ; modifier ; x # V8.0 (🏻) EMOJI MODIFIER FITZPATRICK TYPE-1-2 +1F3FC ; emoji ; L2 ; modifier ; x # V8.0 (🏼) EMOJI MODIFIER FITZPATRICK TYPE-3 +1F3FD ; emoji ; L2 ; modifier ; x # V8.0 (🏽) EMOJI MODIFIER FITZPATRICK TYPE-4 +1F3FE ; emoji ; L2 ; modifier ; x # V8.0 (🏾) EMOJI MODIFIER FITZPATRICK TYPE-5 +1F3FF ; emoji ; L2 ; modifier ; x # V8.0 (🏿) EMOJI MODIFIER FITZPATRICK TYPE-6 +1F400 ; emoji ; L1 ; none ; x # V6.0 (🐀) RAT +1F401 ; emoji ; L1 ; none ; x # V6.0 (🐁) MOUSE +1F402 ; emoji ; L1 ; none ; x # V6.0 (🐂) OX +1F403 ; emoji ; L1 ; none ; x # V6.0 (🐃) WATER BUFFALO +1F404 ; emoji ; L1 ; none ; x # V6.0 (🐄) COW +1F405 ; emoji ; L1 ; none ; x # V6.0 (🐅) TIGER +1F406 ; emoji ; L1 ; none ; x # V6.0 (🐆) LEOPARD +1F407 ; emoji ; L1 ; none ; x # V6.0 (🐇) RABBIT +1F408 ; emoji ; L1 ; none ; w # V6.0 (🐈) CAT +1F409 ; emoji ; L1 ; none ; x # V6.0 (🐉) DRAGON +1F40A ; emoji ; L1 ; none ; x # V6.0 (🐊) CROCODILE +1F40B ; emoji ; L1 ; none ; x # V6.0 (🐋) WHALE +1F40C ; emoji ; L1 ; none ; j # V6.0 (🐌) SNAIL +1F40D ; emoji ; L1 ; none ; j # V6.0 (🐍) SNAKE +1F40E ; emoji ; L1 ; none ; j # V6.0 (🐎) HORSE +1F40F ; emoji ; L1 ; none ; x # V6.0 (🐏) RAM +1F410 ; emoji ; L1 ; none ; x # V6.0 (🐐) GOAT +1F411 ; emoji ; L1 ; none ; j # V6.0 (🐑) SHEEP +1F412 ; emoji ; L1 ; none ; j # V6.0 (🐒) MONKEY +1F413 ; emoji ; L1 ; none ; x # V6.0 (🐓) ROOSTER +1F414 ; emoji ; L1 ; none ; j # V6.0 (🐔) CHICKEN +1F415 ; emoji ; L1 ; none ; w # V6.0 (🐕) DOG +1F416 ; emoji ; L1 ; none ; x # V6.0 (🐖) PIG +1F417 ; emoji ; L1 ; none ; j # V6.0 (🐗) BOAR +1F418 ; emoji ; L1 ; none ; j # V6.0 (🐘) ELEPHANT +1F419 ; emoji ; L1 ; none ; j # V6.0 (🐙) OCTOPUS +1F41A ; emoji ; L1 ; none ; j # V6.0 (🐚) SPIRAL SHELL +1F41B ; emoji ; L1 ; none ; j # V6.0 (🐛) BUG +1F41C ; emoji ; L1 ; none ; j # V6.0 (🐜) ANT +1F41D ; emoji ; L1 ; none ; j # V6.0 (🐝) HONEYBEE +1F41E ; emoji ; L1 ; none ; j # V6.0 (🐞) LADY BEETLE +1F41F ; emoji ; L1 ; none ; j w # V6.0 (🐟) FISH +1F420 ; emoji ; L1 ; none ; j # V6.0 (🐠) TROPICAL FISH +1F421 ; emoji ; L1 ; none ; j # V6.0 (🐡) BLOWFISH +1F422 ; emoji ; L1 ; none ; j # V6.0 (🐢) TURTLE +1F423 ; emoji ; L1 ; none ; j # V6.0 (🐣) HATCHING CHICK +1F424 ; emoji ; L1 ; none ; j # V6.0 (🐤) BABY CHICK +1F425 ; emoji ; L1 ; none ; j # V6.0 (🐥) FRONT-FACING BABY CHICK +1F426 ; emoji ; L1 ; none ; j w # V6.0 (🐦) BIRD +1F427 ; emoji ; L1 ; none ; j # V6.0 (🐧) PENGUIN +1F428 ; emoji ; L1 ; none ; j # V6.0 (🐨) KOALA +1F429 ; emoji ; L1 ; none ; j # V6.0 (🐩) POODLE +1F42A ; emoji ; L1 ; none ; x # V6.0 (🐪) DROMEDARY CAMEL +1F42B ; emoji ; L1 ; none ; j # V6.0 (🐫) BACTRIAN CAMEL +1F42C ; emoji ; L1 ; none ; j # V6.0 (🐬) DOLPHIN +1F42D ; emoji ; L1 ; none ; j # V6.0 (🐭) MOUSE FACE +1F42E ; emoji ; L1 ; none ; j # V6.0 (🐮) COW FACE +1F42F ; emoji ; L1 ; none ; j # V6.0 (🐯) TIGER FACE +1F430 ; emoji ; L1 ; none ; j # V6.0 (🐰) RABBIT FACE +1F431 ; emoji ; L1 ; none ; j # V6.0 (🐱) CAT FACE +1F432 ; emoji ; L1 ; none ; j # V6.0 (🐲) DRAGON FACE +1F433 ; emoji ; L1 ; none ; j # V6.0 (🐳) SPOUTING WHALE +1F434 ; emoji ; L1 ; none ; j # V6.0 (🐴) HORSE FACE +1F435 ; emoji ; L1 ; none ; j # V6.0 (🐵) MONKEY FACE +1F436 ; emoji ; L1 ; none ; j # V6.0 (🐶) DOG FACE +1F437 ; emoji ; L1 ; none ; j # V6.0 (🐷) PIG FACE +1F438 ; emoji ; L1 ; none ; j # V6.0 (🐸) FROG FACE +1F439 ; emoji ; L1 ; none ; j # V6.0 (🐹) HAMSTER FACE +1F43A ; emoji ; L1 ; none ; j # V6.0 (🐺) WOLF FACE +1F43B ; emoji ; L1 ; none ; j # V6.0 (🐻) BEAR FACE +1F43C ; emoji ; L1 ; none ; j # V6.0 (🐼) PANDA FACE +1F43D ; emoji ; L1 ; none ; j # V6.0 (🐽) PIG NOSE +1F43E ; emoji ; L1 ; none ; j # V6.0 (🐾) PAW PRINTS +1F43F ; text ; L2 ; none ; w # V7.0 (🐿) CHIPMUNK +1F440 ; emoji ; L1 ; none ; j # V6.0 (👀) EYES +1F441 ; text ; L2 ; none ; w # V7.0 (👁) EYE +1F442 ; emoji ; L1 ; secondary ; j w # V6.0 (👂) EAR +1F443 ; emoji ; L1 ; secondary ; j # V6.0 (👃) NOSE +1F444 ; emoji ; L1 ; none ; j # V6.0 (👄) MOUTH +1F445 ; emoji ; L1 ; none ; j # V6.0 (👅) TONGUE +1F446 ; emoji ; L1 ; secondary ; j w # V6.0 (👆) WHITE UP POINTING BACKHAND INDEX +1F447 ; emoji ; L1 ; secondary ; j w # V6.0 (👇) WHITE DOWN POINTING BACKHAND INDEX +1F448 ; emoji ; L1 ; secondary ; j w # V6.0 (👈) WHITE LEFT POINTING BACKHAND INDEX +1F449 ; emoji ; L1 ; secondary ; j w # V6.0 (👉) WHITE RIGHT POINTING BACKHAND INDEX +1F44A ; emoji ; L1 ; secondary ; j # V6.0 (👊) FISTED HAND SIGN +1F44B ; emoji ; L1 ; secondary ; j # V6.0 (👋) WAVING HAND SIGN +1F44C ; emoji ; L1 ; secondary ; j # V6.0 (👌) OK HAND SIGN +1F44D ; emoji ; L1 ; secondary ; j w # V6.0 (👍) THUMBS UP SIGN +1F44E ; emoji ; L1 ; secondary ; j w # V6.0 (👎) THUMBS DOWN SIGN +1F44F ; emoji ; L1 ; secondary ; j # V6.0 (👏) CLAPPING HANDS SIGN +1F450 ; emoji ; L1 ; secondary ; j # V6.0 (👐) OPEN HANDS SIGN +1F451 ; emoji ; L1 ; none ; j # V6.0 (👑) CROWN +1F452 ; emoji ; L1 ; none ; j # V6.0 (👒) WOMANS HAT +1F453 ; emoji ; L1 ; none ; j w # V6.0 (👓) EYEGLASSES +1F454 ; emoji ; L1 ; none ; j # V6.0 (👔) NECKTIE +1F455 ; emoji ; L1 ; none ; j # V6.0 (👕) T-SHIRT +1F456 ; emoji ; L1 ; none ; j # V6.0 (👖) JEANS +1F457 ; emoji ; L1 ; none ; j # V6.0 (👗) DRESS +1F458 ; emoji ; L1 ; none ; j # V6.0 (👘) KIMONO +1F459 ; emoji ; L1 ; none ; j # V6.0 (👙) BIKINI +1F45A ; emoji ; L1 ; none ; j # V6.0 (👚) WOMANS CLOTHES +1F45B ; emoji ; L1 ; none ; j # V6.0 (👛) PURSE +1F45C ; emoji ; L1 ; none ; j # V6.0 (👜) HANDBAG +1F45D ; emoji ; L1 ; none ; j # V6.0 (👝) POUCH +1F45E ; emoji ; L1 ; none ; j # V6.0 (👞) MANS SHOE +1F45F ; emoji ; L1 ; none ; j # V6.0 (👟) ATHLETIC SHOE +1F460 ; emoji ; L1 ; none ; j # V6.0 (👠) HIGH-HEELED SHOE +1F461 ; emoji ; L1 ; none ; j # V6.0 (👡) WOMANS SANDAL +1F462 ; emoji ; L1 ; none ; j # V6.0 (👢) WOMANS BOOTS +1F463 ; emoji ; L1 ; none ; j # V6.0 (👣) FOOTPRINTS +1F464 ; emoji ; L1 ; none ; j # V6.0 (👤) BUST IN SILHOUETTE +1F465 ; emoji ; L1 ; none ; x # V6.0 (👥) BUSTS IN SILHOUETTE +1F466 ; emoji ; L1 ; primary ; j # V6.0 (👦) BOY +1F467 ; emoji ; L1 ; primary ; j # V6.0 (👧) GIRL +1F468 ; emoji ; L1 ; primary ; j # V6.0 (👨) MAN +1F469 ; emoji ; L1 ; primary ; j # V6.0 (👩) WOMAN +1F46A ; emoji ; L1 ; none ; j w # V6.0 (👪) FAMILY +1F46B ; emoji ; L1 ; none ; j # V6.0 (👫) MAN AND WOMAN HOLDING HANDS +1F46C ; emoji ; L1 ; none ; x # V6.0 (👬) TWO MEN HOLDING HANDS +1F46D ; emoji ; L1 ; none ; x # V6.0 (👭) TWO WOMEN HOLDING HANDS +1F46E ; emoji ; L1 ; primary ; j # V6.0 (👮) POLICE OFFICER +1F46F ; emoji ; L1 ; none ; j # V6.0 (👯) WOMAN WITH BUNNY EARS +1F470 ; emoji ; L1 ; primary ; j # V6.0 (👰) BRIDE WITH VEIL +1F471 ; emoji ; L1 ; primary ; j # V6.0 (👱) PERSON WITH BLOND HAIR +1F472 ; emoji ; L1 ; primary ; j # V6.0 (👲) MAN WITH GUA PI MAO +1F473 ; emoji ; L1 ; primary ; j # V6.0 (👳) MAN WITH TURBAN +1F474 ; emoji ; L1 ; primary ; j # V6.0 (👴) OLDER MAN +1F475 ; emoji ; L1 ; primary ; j # V6.0 (👵) OLDER WOMAN +1F476 ; emoji ; L1 ; primary ; j # V6.0 (👶) BABY +1F477 ; emoji ; L1 ; primary ; j # V6.0 (👷) CONSTRUCTION WORKER +1F478 ; emoji ; L1 ; primary ; j # V6.0 (👸) PRINCESS +1F479 ; emoji ; L1 ; none ; j # V6.0 (👹) JAPANESE OGRE +1F47A ; emoji ; L1 ; none ; j # V6.0 (👺) JAPANESE GOBLIN +1F47B ; emoji ; L1 ; none ; j # V6.0 (👻) GHOST +1F47C ; emoji ; L1 ; primary ; j # V6.0 (👼) BABY ANGEL +1F47D ; emoji ; L1 ; none ; j w # V6.0 (👽) EXTRATERRESTRIAL ALIEN +1F47E ; emoji ; L1 ; none ; j # V6.0 (👾) ALIEN MONSTER +1F47F ; emoji ; L1 ; secondary ; j # V6.0 (👿) IMP +1F480 ; emoji ; L1 ; none ; j # V6.0 (💀) SKULL +1F481 ; emoji ; L1 ; primary ; j # V6.0 (💁) INFORMATION DESK PERSON +1F482 ; emoji ; L1 ; primary ; j # V6.0 (💂) GUARDSMAN +1F483 ; emoji ; L1 ; secondary ; j # V6.0 (💃) DANCER +1F484 ; emoji ; L1 ; none ; j # V6.0 (💄) LIPSTICK +1F485 ; emoji ; L1 ; secondary ; j # V6.0 (💅) NAIL POLISH +1F486 ; emoji ; L1 ; primary ; j # V6.0 (💆) FACE MASSAGE +1F487 ; emoji ; L1 ; primary ; j # V6.0 (💇) HAIRCUT +1F488 ; emoji ; L1 ; none ; j # V6.0 (💈) BARBER POLE +1F489 ; emoji ; L1 ; none ; j # V6.0 (💉) SYRINGE +1F48A ; emoji ; L1 ; none ; j # V6.0 (💊) PILL +1F48B ; emoji ; L1 ; none ; j # V6.0 (💋) KISS MARK +1F48C ; emoji ; L1 ; none ; j # V6.0 (💌) LOVE LETTER +1F48D ; emoji ; L1 ; none ; j # V6.0 (💍) RING +1F48E ; emoji ; L1 ; none ; j # V6.0 (💎) GEM STONE +1F48F ; emoji ; L1 ; none ; j # V6.0 (💏) KISS +1F490 ; emoji ; L1 ; none ; j # V6.0 (💐) BOUQUET +1F491 ; emoji ; L1 ; none ; j # V6.0 (💑) COUPLE WITH HEART +1F492 ; emoji ; L1 ; none ; j # V6.0 (💒) WEDDING +1F493 ; emoji ; L1 ; none ; j # V6.0 (💓) BEATING HEART +1F494 ; emoji ; L1 ; none ; j # V6.0 (💔) BROKEN HEART +1F495 ; emoji ; L1 ; none ; j # V6.0 (💕) TWO HEARTS +1F496 ; emoji ; L1 ; none ; j # V6.0 (💖) SPARKLING HEART +1F497 ; emoji ; L1 ; none ; j # V6.0 (💗) GROWING HEART +1F498 ; emoji ; L1 ; none ; j # V6.0 (💘) HEART WITH ARROW +1F499 ; emoji ; L1 ; none ; j # V6.0 (💙) BLUE HEART +1F49A ; emoji ; L1 ; none ; j # V6.0 (💚) GREEN HEART +1F49B ; emoji ; L1 ; none ; j # V6.0 (💛) YELLOW HEART +1F49C ; emoji ; L1 ; none ; j # V6.0 (💜) PURPLE HEART +1F49D ; emoji ; L1 ; none ; j # V6.0 (💝) HEART WITH RIBBON +1F49E ; emoji ; L1 ; none ; j # V6.0 (💞) REVOLVING HEARTS +1F49F ; emoji ; L1 ; none ; j # V6.0 (💟) HEART DECORATION +1F4A0 ; emoji ; L1 ; none ; j # V6.0 (💠) DIAMOND SHAPE WITH A DOT INSIDE +1F4A1 ; emoji ; L1 ; none ; j # V6.0 (💡) ELECTRIC LIGHT BULB +1F4A2 ; emoji ; L1 ; none ; j # V6.0 (💢) ANGER SYMBOL +1F4A3 ; emoji ; L1 ; none ; j w # V6.0 (💣) BOMB +1F4A4 ; emoji ; L1 ; none ; j # V6.0 (💤) SLEEPING SYMBOL +1F4A5 ; emoji ; L1 ; none ; j # V6.0 (💥) COLLISION SYMBOL +1F4A6 ; emoji ; L1 ; none ; j # V6.0 (💦) SPLASHING SWEAT SYMBOL +1F4A7 ; emoji ; L1 ; none ; j # V6.0 (💧) DROPLET +1F4A8 ; emoji ; L1 ; none ; j # V6.0 (💨) DASH SYMBOL +1F4A9 ; emoji ; L1 ; none ; j # V6.0 (💩) PILE OF POO +1F4AA ; emoji ; L1 ; secondary ; j # V6.0 (💪) FLEXED BICEPS +1F4AB ; emoji ; L1 ; none ; j # V6.0 (💫) DIZZY SYMBOL +1F4AC ; emoji ; L1 ; none ; j # V6.0 (💬) SPEECH BALLOON +1F4AD ; emoji ; L1 ; none ; x # V6.0 (💭) THOUGHT BALLOON +1F4AE ; emoji ; L1 ; none ; j # V6.0 (💮) WHITE FLOWER +1F4AF ; emoji ; L1 ; none ; j # V6.0 (💯) HUNDRED POINTS SYMBOL +1F4B0 ; emoji ; L1 ; none ; j w # V6.0 (💰) MONEY BAG +1F4B1 ; emoji ; L1 ; none ; j # V6.0 (💱) CURRENCY EXCHANGE +1F4B2 ; emoji ; L1 ; none ; j # V6.0 (💲) HEAVY DOLLAR SIGN +1F4B3 ; emoji ; L1 ; none ; j w # V6.0 (💳) CREDIT CARD +1F4B4 ; emoji ; L1 ; none ; j # V6.0 (💴) BANKNOTE WITH YEN SIGN +1F4B5 ; emoji ; L1 ; none ; j # V6.0 (💵) BANKNOTE WITH DOLLAR SIGN +1F4B6 ; emoji ; L1 ; none ; x # V6.0 (💶) BANKNOTE WITH EURO SIGN +1F4B7 ; emoji ; L1 ; none ; x # V6.0 (💷) BANKNOTE WITH POUND SIGN +1F4B8 ; emoji ; L1 ; none ; j # V6.0 (💸) MONEY WITH WINGS +1F4B9 ; emoji ; L1 ; none ; j # V6.0 (💹) CHART WITH UPWARDS TREND AND YEN SIGN +1F4BA ; emoji ; L1 ; none ; j # V6.0 (💺) SEAT +1F4BB ; emoji ; L1 ; none ; j w # V6.0 (💻) PERSONAL COMPUTER +1F4BC ; emoji ; L1 ; none ; j # V6.0 (💼) BRIEFCASE +1F4BD ; emoji ; L1 ; none ; j # V6.0 (💽) MINIDISC +1F4BE ; emoji ; L1 ; none ; j # V6.0 (💾) FLOPPY DISK +1F4BF ; emoji ; L1 ; none ; j w # V6.0 (💿) OPTICAL DISC +1F4C0 ; emoji ; L1 ; none ; j # V6.0 (📀) DVD +1F4C1 ; emoji ; L1 ; none ; j # V6.0 (📁) FILE FOLDER +1F4C2 ; emoji ; L1 ; none ; j # V6.0 (📂) OPEN FILE FOLDER +1F4C3 ; emoji ; L1 ; none ; j # V6.0 (📃) PAGE WITH CURL +1F4C4 ; emoji ; L1 ; none ; j # V6.0 (📄) PAGE FACING UP +1F4C5 ; emoji ; L1 ; none ; j # V6.0 (📅) CALENDAR +1F4C6 ; emoji ; L1 ; none ; j # V6.0 (📆) TEAR-OFF CALENDAR +1F4C7 ; emoji ; L1 ; none ; j # V6.0 (📇) CARD INDEX +1F4C8 ; emoji ; L1 ; none ; j # V6.0 (📈) CHART WITH UPWARDS TREND +1F4C9 ; emoji ; L1 ; none ; j # V6.0 (📉) CHART WITH DOWNWARDS TREND +1F4CA ; emoji ; L1 ; none ; j # V6.0 (📊) BAR CHART +1F4CB ; emoji ; L1 ; none ; j w # V6.0 (📋) CLIPBOARD +1F4CC ; emoji ; L1 ; none ; j # V6.0 (📌) PUSHPIN +1F4CD ; emoji ; L1 ; none ; j # V6.0 (📍) ROUND PUSHPIN +1F4CE ; emoji ; L1 ; none ; j # V6.0 (📎) PAPERCLIP +1F4CF ; emoji ; L1 ; none ; j # V6.0 (📏) STRAIGHT RULER +1F4D0 ; emoji ; L1 ; none ; j # V6.0 (📐) TRIANGULAR RULER +1F4D1 ; emoji ; L1 ; none ; j # V6.0 (📑) BOOKMARK TABS +1F4D2 ; emoji ; L1 ; none ; j # V6.0 (📒) LEDGER +1F4D3 ; emoji ; L1 ; none ; j # V6.0 (📓) NOTEBOOK +1F4D4 ; emoji ; L1 ; none ; j # V6.0 (📔) NOTEBOOK WITH DECORATIVE COVER +1F4D5 ; emoji ; L1 ; none ; j # V6.0 (📕) CLOSED BOOK +1F4D6 ; emoji ; L1 ; none ; j # V6.0 (📖) OPEN BOOK +1F4D7 ; emoji ; L1 ; none ; j # V6.0 (📗) GREEN BOOK +1F4D8 ; emoji ; L1 ; none ; j # V6.0 (📘) BLUE BOOK +1F4D9 ; emoji ; L1 ; none ; j # V6.0 (📙) ORANGE BOOK +1F4DA ; emoji ; L1 ; none ; j w # V6.0 (📚) BOOKS +1F4DB ; emoji ; L1 ; none ; j # V6.0 (📛) NAME BADGE +1F4DC ; emoji ; L1 ; none ; j # V6.0 (📜) SCROLL +1F4DD ; emoji ; L1 ; none ; j # V6.0 (📝) MEMO +1F4DE ; emoji ; L1 ; none ; j # V6.0 (📞) TELEPHONE RECEIVER +1F4DF ; emoji ; L1 ; none ; j w # V6.0 (📟) PAGER +1F4E0 ; emoji ; L1 ; none ; j # V6.0 (📠) FAX MACHINE +1F4E1 ; emoji ; L1 ; none ; j # V6.0 (📡) SATELLITE ANTENNA +1F4E2 ; emoji ; L1 ; none ; j # V6.0 (📢) PUBLIC ADDRESS LOUDSPEAKER +1F4E3 ; emoji ; L1 ; none ; j # V6.0 (📣) CHEERING MEGAPHONE +1F4E4 ; emoji ; L1 ; none ; j w # V6.0 (📤) OUTBOX TRAY +1F4E5 ; emoji ; L1 ; none ; j w # V6.0 (📥) INBOX TRAY +1F4E6 ; emoji ; L1 ; none ; j w # V6.0 (📦) PACKAGE +1F4E7 ; emoji ; L1 ; none ; j # V6.0 (📧) E-MAIL SYMBOL +1F4E8 ; emoji ; L1 ; none ; j # V6.0 (📨) INCOMING ENVELOPE +1F4E9 ; emoji ; L1 ; none ; j # V6.0 (📩) ENVELOPE WITH DOWNWARDS ARROW ABOVE +1F4EA ; emoji ; L1 ; none ; j w # V6.0 (📪) CLOSED MAILBOX WITH LOWERED FLAG +1F4EB ; emoji ; L1 ; none ; j w # V6.0 (📫) CLOSED MAILBOX WITH RAISED FLAG +1F4EC ; emoji ; L1 ; none ; w # V6.0 (📬) OPEN MAILBOX WITH RAISED FLAG +1F4ED ; emoji ; L1 ; none ; w # V6.0 (📭) OPEN MAILBOX WITH LOWERED FLAG +1F4EE ; emoji ; L1 ; none ; j # V6.0 (📮) POSTBOX +1F4EF ; emoji ; L1 ; none ; x # V6.0 (📯) POSTAL HORN +1F4F0 ; emoji ; L1 ; none ; j # V6.0 (📰) NEWSPAPER +1F4F1 ; emoji ; L1 ; none ; j # V6.0 (📱) MOBILE PHONE +1F4F2 ; emoji ; L1 ; none ; j # V6.0 (📲) MOBILE PHONE WITH RIGHTWARDS ARROW AT LEFT +1F4F3 ; emoji ; L1 ; none ; j # V6.0 (📳) VIBRATION MODE +1F4F4 ; emoji ; L1 ; none ; j # V6.0 (📴) MOBILE PHONE OFF +1F4F5 ; emoji ; L1 ; none ; x # V6.0 (📵) NO MOBILE PHONES +1F4F6 ; emoji ; L1 ; none ; j # V6.0 (📶) ANTENNA WITH BARS +1F4F7 ; emoji ; L1 ; none ; j w # V6.0 (📷) CAMERA +1F4F8 ; emoji ; L2 ; none ; x # V7.0 (📸) CAMERA WITH FLASH +1F4F9 ; emoji ; L1 ; none ; j w # V6.0 (📹) VIDEO CAMERA +1F4FA ; emoji ; L1 ; none ; j w # V6.0 (📺) TELEVISION +1F4FB ; emoji ; L1 ; none ; j w # V6.0 (📻) RADIO +1F4FC ; emoji ; L1 ; none ; j # V6.0 (📼) VIDEOCASSETTE +1F4FD ; text ; L2 ; none ; w # V7.0 (📽) FILM PROJECTOR +1F4FF ; emoji ; L2 ; none ; x # V8.0 (📿) PRAYER BEADS +1F500 ; emoji ; L1 ; none ; x # V6.0 (🔀) TWISTED RIGHTWARDS ARROWS +1F501 ; emoji ; L1 ; none ; x # V6.0 (🔁) CLOCKWISE RIGHTWARDS AND LEFTWARDS OPEN CIRCLE ARROWS +1F502 ; emoji ; L1 ; none ; x # V6.0 (🔂) CLOCKWISE RIGHTWARDS AND LEFTWARDS OPEN CIRCLE ARROWS WITH CIRCLED ONE OVERLAY +1F503 ; emoji ; L1 ; none ; j # V6.0 (🔃) CLOCKWISE DOWNWARDS AND UPWARDS OPEN CIRCLE ARROWS +1F504 ; emoji ; L1 ; none ; x # V6.0 (🔄) ANTICLOCKWISE DOWNWARDS AND UPWARDS OPEN CIRCLE ARROWS +1F505 ; emoji ; L1 ; none ; x # V6.0 (🔅) LOW BRIGHTNESS SYMBOL +1F506 ; emoji ; L1 ; none ; x # V6.0 (🔆) HIGH BRIGHTNESS SYMBOL +1F507 ; emoji ; L1 ; none ; x # V6.0 (🔇) SPEAKER WITH CANCELLATION STROKE +1F508 ; emoji ; L1 ; none ; w # V6.0 (🔈) SPEAKER +1F509 ; emoji ; L1 ; none ; x # V6.0 (🔉) SPEAKER WITH ONE SOUND WAVE +1F50A ; emoji ; L1 ; none ; j # V6.0 (🔊) SPEAKER WITH THREE SOUND WAVES +1F50B ; emoji ; L1 ; none ; j # V6.0 (🔋) BATTERY +1F50C ; emoji ; L1 ; none ; j # V6.0 (🔌) ELECTRIC PLUG +1F50D ; emoji ; L1 ; none ; j w # V6.0 (🔍) LEFT-POINTING MAGNIFYING GLASS +1F50E ; emoji ; L1 ; none ; j # V6.0 (🔎) RIGHT-POINTING MAGNIFYING GLASS +1F50F ; emoji ; L1 ; none ; j # V6.0 (🔏) LOCK WITH INK PEN +1F510 ; emoji ; L1 ; none ; j # V6.0 (🔐) CLOSED LOCK WITH KEY +1F511 ; emoji ; L1 ; none ; j # V6.0 (🔑) KEY +1F512 ; emoji ; L1 ; none ; j w # V6.0 (🔒) LOCK +1F513 ; emoji ; L1 ; none ; j w # V6.0 (🔓) OPEN LOCK +1F514 ; emoji ; L1 ; none ; j # V6.0 (🔔) BELL +1F515 ; emoji ; L1 ; none ; x # V6.0 (🔕) BELL WITH CANCELLATION STROKE +1F516 ; emoji ; L1 ; none ; j # V6.0 (🔖) BOOKMARK +1F517 ; emoji ; L1 ; none ; j # V6.0 (🔗) LINK SYMBOL +1F518 ; emoji ; L1 ; none ; j # V6.0 (🔘) RADIO BUTTON +1F519 ; emoji ; L1 ; none ; j # V6.0 (🔙) BACK WITH LEFTWARDS ARROW ABOVE +1F51A ; emoji ; L1 ; none ; j # V6.0 (🔚) END WITH LEFTWARDS ARROW ABOVE +1F51B ; emoji ; L1 ; none ; j # V6.0 (🔛) ON WITH EXCLAMATION MARK WITH LEFT RIGHT ARROW ABOVE +1F51C ; emoji ; L1 ; none ; j # V6.0 (🔜) SOON WITH RIGHTWARDS ARROW ABOVE +1F51D ; emoji ; L1 ; none ; j # V6.0 (🔝) TOP WITH UPWARDS ARROW ABOVE +1F51E ; emoji ; L1 ; none ; j # V6.0 (🔞) NO ONE UNDER EIGHTEEN SYMBOL +1F51F ; emoji ; L1 ; none ; j # V6.0 (🔟) KEYCAP TEN +1F520 ; emoji ; L1 ; none ; j # V6.0 (🔠) INPUT SYMBOL FOR LATIN CAPITAL LETTERS +1F521 ; emoji ; L1 ; none ; j # V6.0 (🔡) INPUT SYMBOL FOR LATIN SMALL LETTERS +1F522 ; emoji ; L1 ; none ; j # V6.0 (🔢) INPUT SYMBOL FOR NUMBERS +1F523 ; emoji ; L1 ; none ; j # V6.0 (🔣) INPUT SYMBOL FOR SYMBOLS +1F524 ; emoji ; L1 ; none ; j # V6.0 (🔤) INPUT SYMBOL FOR LATIN LETTERS +1F525 ; emoji ; L1 ; none ; j # V6.0 (🔥) FIRE +1F526 ; emoji ; L1 ; none ; j # V6.0 (🔦) ELECTRIC TORCH +1F527 ; emoji ; L1 ; none ; j # V6.0 (🔧) WRENCH +1F528 ; emoji ; L1 ; none ; j # V6.0 (🔨) HAMMER +1F529 ; emoji ; L1 ; none ; j # V6.0 (🔩) NUT AND BOLT +1F52A ; emoji ; L1 ; none ; j # V6.0 (🔪) HOCHO +1F52B ; emoji ; L1 ; none ; j # V6.0 (🔫) PISTOL +1F52C ; emoji ; L1 ; none ; x # V6.0 (🔬) MICROSCOPE +1F52D ; emoji ; L1 ; none ; x # V6.0 (🔭) TELESCOPE +1F52E ; emoji ; L1 ; none ; j # V6.0 (🔮) CRYSTAL BALL +1F52F ; emoji ; L1 ; none ; j # V6.0 (🔯) SIX POINTED STAR WITH MIDDLE DOT +1F530 ; emoji ; L1 ; none ; j # V6.0 (🔰) JAPANESE SYMBOL FOR BEGINNER +1F531 ; emoji ; L1 ; none ; j # V6.0 (🔱) TRIDENT EMBLEM +1F532 ; emoji ; L1 ; none ; j # V6.0 (🔲) BLACK SQUARE BUTTON +1F533 ; emoji ; L1 ; none ; j # V6.0 (🔳) WHITE SQUARE BUTTON +1F534 ; emoji ; L1 ; none ; j # V6.0 (🔴) LARGE RED CIRCLE +1F535 ; emoji ; L1 ; none ; j # V6.0 (🔵) LARGE BLUE CIRCLE +1F536 ; emoji ; L1 ; none ; j # V6.0 (🔶) LARGE ORANGE DIAMOND +1F537 ; emoji ; L1 ; none ; j # V6.0 (🔷) LARGE BLUE DIAMOND +1F538 ; emoji ; L1 ; none ; j # V6.0 (🔸) SMALL ORANGE DIAMOND +1F539 ; emoji ; L1 ; none ; j # V6.0 (🔹) SMALL BLUE DIAMOND +1F53A ; emoji ; L1 ; none ; j # V6.0 (🔺) UP-POINTING RED TRIANGLE +1F53B ; emoji ; L1 ; none ; j # V6.0 (🔻) DOWN-POINTING RED TRIANGLE +1F53C ; emoji ; L1 ; none ; j # V6.0 (🔼) UP-POINTING SMALL RED TRIANGLE +1F53D ; emoji ; L1 ; none ; j # V6.0 (🔽) DOWN-POINTING SMALL RED TRIANGLE +1F549 ; text ; L2 ; none ; w # V7.0 (🕉) OM SYMBOL +1F54A ; text ; L2 ; none ; w # V7.0 (🕊) DOVE OF PEACE +1F54B ; emoji ; L2 ; none ; x # V8.0 (🕋) KAABA +1F54C ; emoji ; L2 ; none ; x # V8.0 (🕌) MOSQUE +1F54D ; emoji ; L2 ; none ; x # V8.0 (🕍) SYNAGOGUE +1F54E ; emoji ; L2 ; none ; x # V8.0 (🕎) MENORAH WITH NINE BRANCHES +1F550 ; emoji ; L1 ; none ; j w # V6.0 (🕐) CLOCK FACE ONE OCLOCK +1F551 ; emoji ; L1 ; none ; j w # V6.0 (🕑) CLOCK FACE TWO OCLOCK +1F552 ; emoji ; L1 ; none ; j w # V6.0 (🕒) CLOCK FACE THREE OCLOCK +1F553 ; emoji ; L1 ; none ; j w # V6.0 (🕓) CLOCK FACE FOUR OCLOCK +1F554 ; emoji ; L1 ; none ; j w # V6.0 (🕔) CLOCK FACE FIVE OCLOCK +1F555 ; emoji ; L1 ; none ; j w # V6.0 (🕕) CLOCK FACE SIX OCLOCK +1F556 ; emoji ; L1 ; none ; j w # V6.0 (🕖) CLOCK FACE SEVEN OCLOCK +1F557 ; emoji ; L1 ; none ; j w # V6.0 (🕗) CLOCK FACE EIGHT OCLOCK +1F558 ; emoji ; L1 ; none ; j w # V6.0 (🕘) CLOCK FACE NINE OCLOCK +1F559 ; emoji ; L1 ; none ; j w # V6.0 (🕙) CLOCK FACE TEN OCLOCK +1F55A ; emoji ; L1 ; none ; j w # V6.0 (🕚) CLOCK FACE ELEVEN OCLOCK +1F55B ; emoji ; L1 ; none ; j w # V6.0 (🕛) CLOCK FACE TWELVE OCLOCK +1F55C ; emoji ; L1 ; none ; w # V6.0 (🕜) CLOCK FACE ONE-THIRTY +1F55D ; emoji ; L1 ; none ; w # V6.0 (🕝) CLOCK FACE TWO-THIRTY +1F55E ; emoji ; L1 ; none ; w # V6.0 (🕞) CLOCK FACE THREE-THIRTY +1F55F ; emoji ; L1 ; none ; w # V6.0 (🕟) CLOCK FACE FOUR-THIRTY +1F560 ; emoji ; L1 ; none ; w # V6.0 (🕠) CLOCK FACE FIVE-THIRTY +1F561 ; emoji ; L1 ; none ; w # V6.0 (🕡) CLOCK FACE SIX-THIRTY +1F562 ; emoji ; L1 ; none ; w # V6.0 (🕢) CLOCK FACE SEVEN-THIRTY +1F563 ; emoji ; L1 ; none ; w # V6.0 (🕣) CLOCK FACE EIGHT-THIRTY +1F564 ; emoji ; L1 ; none ; w # V6.0 (🕤) CLOCK FACE NINE-THIRTY +1F565 ; emoji ; L1 ; none ; w # V6.0 (🕥) CLOCK FACE TEN-THIRTY +1F566 ; emoji ; L1 ; none ; w # V6.0 (🕦) CLOCK FACE ELEVEN-THIRTY +1F567 ; emoji ; L1 ; none ; w # V6.0 (🕧) CLOCK FACE TWELVE-THIRTY +1F56F ; text ; L2 ; none ; w # V7.0 (🕯) CANDLE +1F570 ; text ; L2 ; none ; w # V7.0 (🕰) MANTELPIECE CLOCK +1F573 ; text ; L2 ; none ; w # V7.0 (🕳) HOLE +1F574 ; text ; L2 ; none ; w # V7.0 (🕴) MAN IN BUSINESS SUIT LEVITATING +1F575 ; text ; L2 ; none ; w # V7.0 (🕵) SLEUTH OR SPY +1F576 ; text ; L2 ; none ; w # V7.0 (🕶) DARK SUNGLASSES +1F577 ; text ; L2 ; none ; w # V7.0 (🕷) SPIDER +1F578 ; text ; L2 ; none ; w # V7.0 (🕸) SPIDER WEB +1F579 ; text ; L2 ; none ; w # V7.0 (🕹) JOYSTICK +1F587 ; text ; L2 ; none ; w # V7.0 (🖇) LINKED PAPERCLIPS +1F58A ; text ; L2 ; none ; w # V7.0 (🖊) LOWER LEFT BALLPOINT PEN +1F58B ; text ; L2 ; none ; w # V7.0 (🖋) LOWER LEFT FOUNTAIN PEN +1F58C ; text ; L2 ; none ; w # V7.0 (🖌) LOWER LEFT PAINTBRUSH +1F58D ; text ; L2 ; none ; w # V7.0 (🖍) LOWER LEFT CRAYON +1F590 ; text ; L2 ; secondary ; w # V7.0 (🖐) RAISED HAND WITH FINGERS SPLAYED +1F595 ; emoji ; L2 ; secondary ; x # V7.0 (🖕) REVERSED HAND WITH MIDDLE FINGER EXTENDED +1F596 ; emoji ; L2 ; secondary ; x # V7.0 (🖖) RAISED HAND WITH PART BETWEEN MIDDLE AND RING FINGERS +1F5A5 ; text ; L2 ; none ; w # V7.0 (🖥) DESKTOP COMPUTER +1F5A8 ; text ; L2 ; none ; w # V7.0 (🖨) PRINTER +1F5B1 ; text ; L2 ; none ; w # V7.0 (🖱) THREE BUTTON MOUSE +1F5B2 ; text ; L2 ; none ; w # V7.0 (🖲) TRACKBALL +1F5BC ; text ; L2 ; none ; w # V7.0 (🖼) FRAME WITH PICTURE +1F5C2 ; text ; L2 ; none ; w # V7.0 (🗂) CARD INDEX DIVIDERS +1F5C3 ; text ; L2 ; none ; w # V7.0 (🗃) CARD FILE BOX +1F5C4 ; text ; L2 ; none ; w # V7.0 (🗄) FILE CABINET +1F5D1 ; text ; L2 ; none ; w # V7.0 (🗑) WASTEBASKET +1F5D2 ; text ; L2 ; none ; w # V7.0 (🗒) SPIRAL NOTE PAD +1F5D3 ; text ; L2 ; none ; w # V7.0 (🗓) SPIRAL CALENDAR PAD +1F5DC ; text ; L2 ; none ; w # V7.0 (🗜) COMPRESSION +1F5DD ; text ; L2 ; none ; w # V7.0 (🗝) OLD KEY +1F5DE ; text ; L2 ; none ; w # V7.0 (🗞) ROLLED-UP NEWSPAPER +1F5E1 ; text ; L2 ; none ; w # V7.0 (🗡) DAGGER KNIFE +1F5E3 ; text ; L2 ; none ; w # V7.0 (🗣) SPEAKING HEAD IN SILHOUETTE +1F5EF ; text ; L2 ; none ; w # V7.0 (🗯) RIGHT ANGER BUBBLE +1F5F3 ; text ; L2 ; none ; w # V7.0 (🗳) BALLOT BOX WITH BALLOT +1F5FA ; text ; L2 ; none ; w # V7.0 (🗺) WORLD MAP +1F5FB ; emoji ; L1 ; none ; j # V6.0 (🗻) MOUNT FUJI +1F5FC ; emoji ; L1 ; none ; j # V6.0 (🗼) TOKYO TOWER +1F5FD ; emoji ; L1 ; none ; j # V6.0 (🗽) STATUE OF LIBERTY +1F5FE ; emoji ; L1 ; none ; j # V6.0 (🗾) SILHOUETTE OF JAPAN +1F5FF ; emoji ; L1 ; none ; j # V6.0 (🗿) MOYAI +1F600 ; emoji ; L1 ; secondary ; x # V6.1 (😀) GRINNING FACE +1F601 ; emoji ; L1 ; secondary ; j # V6.0 (😁) GRINNING FACE WITH SMILING EYES +1F602 ; emoji ; L1 ; secondary ; j # V6.0 (😂) FACE WITH TEARS OF JOY +1F603 ; emoji ; L1 ; secondary ; j # V6.0 (😃) SMILING FACE WITH OPEN MOUTH +1F604 ; emoji ; L1 ; secondary ; j # V6.0 (😄) SMILING FACE WITH OPEN MOUTH AND SMILING EYES +1F605 ; emoji ; L1 ; secondary ; j # V6.0 (😅) SMILING FACE WITH OPEN MOUTH AND COLD SWEAT +1F606 ; emoji ; L1 ; secondary ; j # V6.0 (😆) SMILING FACE WITH OPEN MOUTH AND TIGHTLY-CLOSED EYES +1F607 ; emoji ; L1 ; secondary ; x # V6.0 (😇) SMILING FACE WITH HALO +1F608 ; emoji ; L1 ; secondary ; x # V6.0 (😈) SMILING FACE WITH HORNS +1F609 ; emoji ; L1 ; secondary ; j # V6.0 (😉) WINKING FACE +1F60A ; emoji ; L1 ; secondary ; j # V6.0 (😊) SMILING FACE WITH SMILING EYES +1F60B ; emoji ; L1 ; secondary ; j # V6.0 (😋) FACE SAVOURING DELICIOUS FOOD +1F60C ; emoji ; L1 ; secondary ; j # V6.0 (😌) RELIEVED FACE +1F60D ; emoji ; L1 ; secondary ; j # V6.0 (😍) SMILING FACE WITH HEART-SHAPED EYES +1F60E ; emoji ; L1 ; secondary ; x # V6.0 (😎) SMILING FACE WITH SUNGLASSES +1F60F ; emoji ; L1 ; secondary ; j # V6.0 (😏) SMIRKING FACE +1F610 ; emoji ; L1 ; secondary ; w # V6.0 (😐) NEUTRAL FACE +1F611 ; emoji ; L1 ; secondary ; x # V6.1 (😑) EXPRESSIONLESS FACE +1F612 ; emoji ; L1 ; secondary ; j # V6.0 (😒) UNAMUSED FACE +1F613 ; emoji ; L1 ; secondary ; j # V6.0 (😓) FACE WITH COLD SWEAT +1F614 ; emoji ; L1 ; secondary ; j # V6.0 (😔) PENSIVE FACE +1F615 ; emoji ; L1 ; secondary ; x # V6.1 (😕) CONFUSED FACE +1F616 ; emoji ; L1 ; secondary ; j # V6.0 (😖) CONFOUNDED FACE +1F617 ; emoji ; L1 ; secondary ; x # V6.1 (😗) KISSING FACE +1F618 ; emoji ; L1 ; secondary ; j # V6.0 (😘) FACE THROWING A KISS +1F619 ; emoji ; L1 ; secondary ; x # V6.1 (😙) KISSING FACE WITH SMILING EYES +1F61A ; emoji ; L1 ; secondary ; j # V6.0 (😚) KISSING FACE WITH CLOSED EYES +1F61B ; emoji ; L1 ; secondary ; x # V6.1 (😛) FACE WITH STUCK-OUT TONGUE +1F61C ; emoji ; L1 ; secondary ; j # V6.0 (😜) FACE WITH STUCK-OUT TONGUE AND WINKING EYE +1F61D ; emoji ; L1 ; secondary ; j # V6.0 (😝) FACE WITH STUCK-OUT TONGUE AND TIGHTLY-CLOSED EYES +1F61E ; emoji ; L1 ; secondary ; j # V6.0 (😞) DISAPPOINTED FACE +1F61F ; emoji ; L1 ; secondary ; x # V6.1 (😟) WORRIED FACE +1F620 ; emoji ; L1 ; secondary ; j # V6.0 (😠) ANGRY FACE +1F621 ; emoji ; L1 ; secondary ; j # V6.0 (😡) POUTING FACE +1F622 ; emoji ; L1 ; secondary ; j # V6.0 (😢) CRYING FACE +1F623 ; emoji ; L1 ; secondary ; j # V6.0 (😣) PERSEVERING FACE +1F624 ; emoji ; L1 ; secondary ; j # V6.0 (😤) FACE WITH LOOK OF TRIUMPH +1F625 ; emoji ; L1 ; secondary ; j # V6.0 (😥) DISAPPOINTED BUT RELIEVED FACE +1F626 ; emoji ; L1 ; secondary ; x # V6.1 (😦) FROWNING FACE WITH OPEN MOUTH +1F627 ; emoji ; L1 ; secondary ; x # V6.1 (😧) ANGUISHED FACE +1F628 ; emoji ; L1 ; secondary ; j # V6.0 (😨) FEARFUL FACE +1F629 ; emoji ; L1 ; secondary ; j # V6.0 (😩) WEARY FACE +1F62A ; emoji ; L1 ; secondary ; j # V6.0 (😪) SLEEPY FACE +1F62B ; emoji ; L1 ; secondary ; j # V6.0 (😫) TIRED FACE +1F62C ; emoji ; L1 ; secondary ; x # V6.1 (😬) GRIMACING FACE +1F62D ; emoji ; L1 ; secondary ; j # V6.0 (😭) LOUDLY CRYING FACE +1F62E ; emoji ; L1 ; secondary ; x # V6.1 (😮) FACE WITH OPEN MOUTH +1F62F ; emoji ; L1 ; secondary ; x # V6.1 (😯) HUSHED FACE +1F630 ; emoji ; L1 ; secondary ; j # V6.0 (😰) FACE WITH OPEN MOUTH AND COLD SWEAT +1F631 ; emoji ; L1 ; secondary ; j # V6.0 (😱) FACE SCREAMING IN FEAR +1F632 ; emoji ; L1 ; secondary ; j # V6.0 (😲) ASTONISHED FACE +1F633 ; emoji ; L1 ; secondary ; j # V6.0 (😳) FLUSHED FACE +1F634 ; emoji ; L1 ; secondary ; x # V6.1 (😴) SLEEPING FACE +1F635 ; emoji ; L1 ; secondary ; j # V6.0 (😵) DIZZY FACE +1F636 ; emoji ; L1 ; secondary ; x # V6.0 (😶) FACE WITHOUT MOUTH +1F637 ; emoji ; L1 ; secondary ; j # V6.0 (😷) FACE WITH MEDICAL MASK +1F638 ; emoji ; L1 ; none ; j # V6.0 (😸) GRINNING CAT FACE WITH SMILING EYES +1F639 ; emoji ; L1 ; none ; j # V6.0 (😹) CAT FACE WITH TEARS OF JOY +1F63A ; emoji ; L1 ; none ; j # V6.0 (😺) SMILING CAT FACE WITH OPEN MOUTH +1F63B ; emoji ; L1 ; none ; j # V6.0 (😻) SMILING CAT FACE WITH HEART-SHAPED EYES +1F63C ; emoji ; L1 ; none ; j # V6.0 (😼) CAT FACE WITH WRY SMILE +1F63D ; emoji ; L1 ; none ; j # V6.0 (😽) KISSING CAT FACE WITH CLOSED EYES +1F63E ; emoji ; L1 ; none ; j # V6.0 (😾) POUTING CAT FACE +1F63F ; emoji ; L1 ; none ; j # V6.0 (😿) CRYING CAT FACE +1F640 ; emoji ; L1 ; none ; j # V6.0 (🙀) WEARY CAT FACE +1F641 ; emoji ; L2 ; secondary ; x # V7.0 (🙁) SLIGHTLY FROWNING FACE +1F642 ; emoji ; L2 ; secondary ; x # V7.0 (🙂) SLIGHTLY SMILING FACE +1F643 ; emoji ; L2 ; secondary ; x # V8.0 (🙃) UPSIDE-DOWN FACE +1F644 ; emoji ; L2 ; secondary ; x # V8.0 (🙄) FACE WITH ROLLING EYES +1F645 ; emoji ; L1 ; primary ; j # V6.0 (🙅) FACE WITH NO GOOD GESTURE +1F646 ; emoji ; L1 ; primary ; j # V6.0 (🙆) FACE WITH OK GESTURE +1F647 ; emoji ; L1 ; primary ; j # V6.0 (🙇) PERSON BOWING DEEPLY +1F648 ; emoji ; L1 ; none ; j # V6.0 (🙈) SEE-NO-EVIL MONKEY +1F649 ; emoji ; L1 ; none ; j # V6.0 (🙉) HEAR-NO-EVIL MONKEY +1F64A ; emoji ; L1 ; none ; j # V6.0 (🙊) SPEAK-NO-EVIL MONKEY +1F64B ; emoji ; L1 ; primary ; j # V6.0 (🙋) HAPPY PERSON RAISING ONE HAND +1F64C ; emoji ; L1 ; secondary ; j # V6.0 (🙌) PERSON RAISING BOTH HANDS IN CELEBRATION +1F64D ; emoji ; L1 ; primary ; j # V6.0 (🙍) PERSON FROWNING +1F64E ; emoji ; L1 ; primary ; j # V6.0 (🙎) PERSON WITH POUTING FACE +1F64F ; emoji ; L1 ; secondary ; j # V6.0 (🙏) PERSON WITH FOLDED HANDS +1F680 ; emoji ; L1 ; none ; j # V6.0 (🚀) ROCKET +1F681 ; emoji ; L1 ; none ; x # V6.0 (🚁) HELICOPTER +1F682 ; emoji ; L1 ; none ; x # V6.0 (🚂) STEAM LOCOMOTIVE +1F683 ; emoji ; L1 ; none ; j # V6.0 (🚃) RAILWAY CAR +1F684 ; emoji ; L1 ; none ; j # V6.0 (🚄) HIGH-SPEED TRAIN +1F685 ; emoji ; L1 ; none ; j # V6.0 (🚅) HIGH-SPEED TRAIN WITH BULLET NOSE +1F686 ; emoji ; L1 ; none ; x # V6.0 (🚆) TRAIN +1F687 ; emoji ; L1 ; none ; j w # V6.0 (🚇) METRO +1F688 ; emoji ; L1 ; none ; x # V6.0 (🚈) LIGHT RAIL +1F689 ; emoji ; L1 ; none ; j # V6.0 (🚉) STATION +1F68A ; emoji ; L1 ; none ; x # V6.0 (🚊) TRAM +1F68B ; emoji ; L1 ; none ; x # V6.0 (🚋) TRAM CAR +1F68C ; emoji ; L1 ; none ; j # V6.0 (🚌) BUS +1F68D ; emoji ; L1 ; none ; w # V6.0 (🚍) ONCOMING BUS +1F68E ; emoji ; L1 ; none ; x # V6.0 (🚎) TROLLEYBUS +1F68F ; emoji ; L1 ; none ; j # V6.0 (🚏) BUS STOP +1F690 ; emoji ; L1 ; none ; x # V6.0 (🚐) MINIBUS +1F691 ; emoji ; L1 ; none ; j w # V6.0 (🚑) AMBULANCE +1F692 ; emoji ; L1 ; none ; j # V6.0 (🚒) FIRE ENGINE +1F693 ; emoji ; L1 ; none ; j # V6.0 (🚓) POLICE CAR +1F694 ; emoji ; L1 ; none ; w # V6.0 (🚔) ONCOMING POLICE CAR +1F695 ; emoji ; L1 ; none ; j # V6.0 (🚕) TAXI +1F696 ; emoji ; L1 ; none ; x # V6.0 (🚖) ONCOMING TAXI +1F697 ; emoji ; L1 ; none ; j # V6.0 (🚗) AUTOMOBILE +1F698 ; emoji ; L1 ; none ; w # V6.0 (🚘) ONCOMING AUTOMOBILE +1F699 ; emoji ; L1 ; none ; j # V6.0 (🚙) RECREATIONAL VEHICLE +1F69A ; emoji ; L1 ; none ; j # V6.0 (🚚) DELIVERY TRUCK +1F69B ; emoji ; L1 ; none ; x # V6.0 (🚛) ARTICULATED LORRY +1F69C ; emoji ; L1 ; none ; x # V6.0 (🚜) TRACTOR +1F69D ; emoji ; L1 ; none ; x # V6.0 (🚝) MONORAIL +1F69E ; emoji ; L1 ; none ; x # V6.0 (🚞) MOUNTAIN RAILWAY +1F69F ; emoji ; L1 ; none ; x # V6.0 (🚟) SUSPENSION RAILWAY +1F6A0 ; emoji ; L1 ; none ; x # V6.0 (🚠) MOUNTAIN CABLEWAY +1F6A1 ; emoji ; L1 ; none ; x # V6.0 (🚡) AERIAL TRAMWAY +1F6A2 ; emoji ; L1 ; none ; j # V6.0 (🚢) SHIP +1F6A3 ; emoji ; L1 ; secondary ; x # V6.0 (🚣) ROWBOAT +1F6A4 ; emoji ; L1 ; none ; j # V6.0 (🚤) SPEEDBOAT +1F6A5 ; emoji ; L1 ; none ; j # V6.0 (🚥) HORIZONTAL TRAFFIC LIGHT +1F6A6 ; emoji ; L1 ; none ; x # V6.0 (🚦) VERTICAL TRAFFIC LIGHT +1F6A7 ; emoji ; L1 ; none ; j # V6.0 (🚧) CONSTRUCTION SIGN +1F6A8 ; emoji ; L1 ; none ; j # V6.0 (🚨) POLICE CARS REVOLVING LIGHT +1F6A9 ; emoji ; L1 ; none ; j # V6.0 (🚩) TRIANGULAR FLAG ON POST +1F6AA ; emoji ; L1 ; none ; j # V6.0 (🚪) DOOR +1F6AB ; emoji ; L1 ; none ; j # V6.0 (🚫) NO ENTRY SIGN +1F6AC ; emoji ; L1 ; none ; j # V6.0 (🚬) SMOKING SYMBOL +1F6AD ; emoji ; L1 ; none ; j w # V6.0 (🚭) NO SMOKING SYMBOL +1F6AE ; emoji ; L1 ; none ; x # V6.0 (🚮) PUT LITTER IN ITS PLACE SYMBOL +1F6AF ; emoji ; L1 ; none ; x # V6.0 (🚯) DO NOT LITTER SYMBOL +1F6B0 ; emoji ; L1 ; none ; x # V6.0 (🚰) POTABLE WATER SYMBOL +1F6B1 ; emoji ; L1 ; none ; x # V6.0 (🚱) NON-POTABLE WATER SYMBOL +1F6B2 ; emoji ; L1 ; none ; j w # V6.0 (🚲) BICYCLE +1F6B3 ; emoji ; L1 ; none ; x # V6.0 (🚳) NO BICYCLES +1F6B4 ; emoji ; L1 ; secondary ; x # V6.0 (🚴) BICYCLIST +1F6B5 ; emoji ; L1 ; secondary ; x # V6.0 (🚵) MOUNTAIN BICYCLIST +1F6B6 ; emoji ; L1 ; secondary ; j # V6.0 (🚶) PEDESTRIAN +1F6B7 ; emoji ; L1 ; none ; x # V6.0 (🚷) NO PEDESTRIANS +1F6B8 ; emoji ; L1 ; none ; x # V6.0 (🚸) CHILDREN CROSSING +1F6B9 ; emoji ; L1 ; none ; j w # V6.0 (🚹) MENS SYMBOL +1F6BA ; emoji ; L1 ; none ; j w # V6.0 (🚺) WOMENS SYMBOL +1F6BB ; emoji ; L1 ; none ; j # V6.0 (🚻) RESTROOM +1F6BC ; emoji ; L1 ; none ; j w # V6.0 (🚼) BABY SYMBOL +1F6BD ; emoji ; L1 ; none ; j # V6.0 (🚽) TOILET +1F6BE ; emoji ; L1 ; none ; j # V6.0 (🚾) WATER CLOSET +1F6BF ; emoji ; L1 ; none ; x # V6.0 (🚿) SHOWER +1F6C0 ; emoji ; L1 ; secondary ; j # V6.0 (🛀) BATH +1F6C1 ; emoji ; L1 ; none ; x # V6.0 (🛁) BATHTUB +1F6C2 ; emoji ; L1 ; none ; x # V6.0 (🛂) PASSPORT CONTROL +1F6C3 ; emoji ; L1 ; none ; x # V6.0 (🛃) CUSTOMS +1F6C4 ; emoji ; L1 ; none ; x # V6.0 (🛄) BAGGAGE CLAIM +1F6C5 ; emoji ; L1 ; none ; x # V6.0 (🛅) LEFT LUGGAGE +1F6CB ; text ; L2 ; none ; w # V7.0 (🛋) COUCH AND LAMP +1F6CC ; emoji ; L2 ; none ; x # V7.0 (🛌) SLEEPING ACCOMMODATION +1F6CD ; text ; L2 ; none ; w # V7.0 (🛍) SHOPPING BAGS +1F6CE ; text ; L2 ; none ; w # V7.0 (🛎) BELLHOP BELL +1F6CF ; text ; L2 ; none ; w # V7.0 (🛏) BED +1F6D0 ; emoji ; L2 ; none ; x # V8.0 (🛐) PLACE OF WORSHIP +1F6E0 ; text ; L2 ; none ; w # V7.0 (🛠) HAMMER AND WRENCH +1F6E1 ; text ; L2 ; none ; w # V7.0 (🛡) SHIELD +1F6E2 ; text ; L2 ; none ; w # V7.0 (🛢) OIL DRUM +1F6E3 ; text ; L2 ; none ; w # V7.0 (🛣) MOTORWAY +1F6E4 ; text ; L2 ; none ; w # V7.0 (🛤) RAILWAY TRACK +1F6E5 ; text ; L2 ; none ; w # V7.0 (🛥) MOTOR BOAT +1F6E9 ; text ; L2 ; none ; w # V7.0 (🛩) SMALL AIRPLANE +1F6EB ; emoji ; L2 ; none ; x # V7.0 (🛫) AIRPLANE DEPARTURE +1F6EC ; emoji ; L2 ; none ; x # V7.0 (🛬) AIRPLANE ARRIVING +1F6F0 ; text ; L2 ; none ; w # V7.0 (🛰) SATELLITE +1F6F3 ; text ; L2 ; none ; w # V7.0 (🛳) PASSENGER SHIP +1F910 ; emoji ; L2 ; secondary ; x # V8.0 (🤐) ZIPPER-MOUTH FACE +1F911 ; emoji ; L2 ; secondary ; x # V8.0 (🤑) MONEY-MOUTH FACE +1F912 ; emoji ; L2 ; secondary ; x # V8.0 (🤒) FACE WITH THERMOMETER +1F913 ; emoji ; L2 ; secondary ; x # V8.0 (🤓) NERD FACE +1F914 ; emoji ; L2 ; secondary ; x # V8.0 (🤔) THINKING FACE +1F915 ; emoji ; L2 ; secondary ; x # V8.0 (🤕) FACE WITH HEAD-BANDAGE +1F916 ; emoji ; L2 ; none ; x # V8.0 (🤖) ROBOT FACE +1F917 ; emoji ; L2 ; secondary ; x # V8.0 (🤗) HUGGING FACE +1F918 ; emoji ; L2 ; secondary ; x # V8.0 (🤘) SIGN OF THE HORNS +1F980 ; emoji ; L2 ; none ; x # V8.0 (🦀) CRAB +1F981 ; emoji ; L2 ; none ; x # V8.0 (🦁) LION FACE +1F982 ; emoji ; L2 ; none ; x # V8.0 (🦂) SCORPION +1F983 ; emoji ; L2 ; none ; x # V8.0 (🦃) TURKEY +1F984 ; emoji ; L2 ; none ; x # V8.0 (🦄) UNICORN FACE +1F9C0 ; emoji ; L2 ; none ; x # V8.0 (🧀) CHEESE WEDGE +0023 20E3 ; text ; L1 ; none ; j # V3.0 (#⃣) keycap NUMBER SIGN +002A 20E3 ; text ; L2 ; none ; x # V3.0 (*⃣) keycap ASTERISK +0030 20E3 ; text ; L1 ; none ; j # V3.0 (0⃣) keycap DIGIT ZERO +0031 20E3 ; text ; L1 ; none ; j # V3.0 (1⃣) keycap DIGIT ONE +0032 20E3 ; text ; L1 ; none ; j # V3.0 (2⃣) keycap DIGIT TWO +0033 20E3 ; text ; L1 ; none ; j # V3.0 (3⃣) keycap DIGIT THREE +0034 20E3 ; text ; L1 ; none ; j # V3.0 (4⃣) keycap DIGIT FOUR +0035 20E3 ; text ; L1 ; none ; j # V3.0 (5⃣) keycap DIGIT FIVE +0036 20E3 ; text ; L1 ; none ; j # V3.0 (6⃣) keycap DIGIT SIX +0037 20E3 ; text ; L1 ; none ; j # V3.0 (7⃣) keycap DIGIT SEVEN +0038 20E3 ; text ; L1 ; none ; j # V3.0 (8⃣) keycap DIGIT EIGHT +0039 20E3 ; text ; L1 ; none ; j # V3.0 (9⃣) keycap DIGIT NINE +1F1E6 1F1E8 ; emoji ; L2 ; none ; x # V6.0 (🇦🇨) flag for Ascension Island +1F1E6 1F1E9 ; emoji ; L2 ; none ; x # V6.0 (🇦🇩) flag for Andorra +1F1E6 1F1EA ; emoji ; L2 ; none ; x # V6.0 (🇦🇪) flag for United Arab Emirates +1F1E6 1F1EB ; emoji ; L2 ; none ; x # V6.0 (🇦🇫) flag for Afghanistan +1F1E6 1F1EC ; emoji ; L2 ; none ; x # V6.0 (🇦🇬) flag for Antigua & Barbuda +1F1E6 1F1EE ; emoji ; L2 ; none ; x # V6.0 (🇦🇮) flag for Anguilla +1F1E6 1F1F1 ; emoji ; L2 ; none ; x # V6.0 (🇦🇱) flag for Albania +1F1E6 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇦🇲) flag for Armenia +1F1E6 1F1F4 ; emoji ; L2 ; none ; x # V6.0 (🇦🇴) flag for Angola +1F1E6 1F1F6 ; emoji ; L2 ; none ; x # V6.0 (🇦🇶) flag for Antarctica +1F1E6 1F1F7 ; emoji ; L2 ; none ; x # V6.0 (🇦🇷) flag for Argentina +1F1E6 1F1F8 ; emoji ; L2 ; none ; x # V6.0 (🇦🇸) flag for American Samoa +1F1E6 1F1F9 ; emoji ; L2 ; none ; x # V6.0 (🇦🇹) flag for Austria +1F1E6 1F1FA ; emoji ; L2 ; none ; x # V6.0 (🇦🇺) flag for Australia +1F1E6 1F1FC ; emoji ; L2 ; none ; x # V6.0 (🇦🇼) flag for Aruba +1F1E6 1F1FD ; emoji ; L2 ; none ; x # V6.0 (🇦🇽) flag for Åland Islands +1F1E6 1F1FF ; emoji ; L2 ; none ; x # V6.0 (🇦🇿) flag for Azerbaijan +1F1E7 1F1E6 ; emoji ; L2 ; none ; x # V6.0 (🇧🇦) flag for Bosnia & Herzegovina +1F1E7 1F1E7 ; emoji ; L2 ; none ; x # V6.0 (🇧🇧) flag for Barbados +1F1E7 1F1E9 ; emoji ; L2 ; none ; x # V6.0 (🇧🇩) flag for Bangladesh +1F1E7 1F1EA ; emoji ; L2 ; none ; x # V6.0 (🇧🇪) flag for Belgium +1F1E7 1F1EB ; emoji ; L2 ; none ; x # V6.0 (🇧🇫) flag for Burkina Faso +1F1E7 1F1EC ; emoji ; L2 ; none ; x # V6.0 (🇧🇬) flag for Bulgaria +1F1E7 1F1ED ; emoji ; L2 ; none ; x # V6.0 (🇧🇭) flag for Bahrain +1F1E7 1F1EE ; emoji ; L2 ; none ; x # V6.0 (🇧🇮) flag for Burundi +1F1E7 1F1EF ; emoji ; L2 ; none ; x # V6.0 (🇧🇯) flag for Benin +1F1E7 1F1F1 ; emoji ; L2 ; none ; x # V6.0 (🇧🇱) flag for St. Barthélemy +1F1E7 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇧🇲) flag for Bermuda +1F1E7 1F1F3 ; emoji ; L2 ; none ; x # V6.0 (🇧🇳) flag for Brunei +1F1E7 1F1F4 ; emoji ; L2 ; none ; x # V6.0 (🇧🇴) flag for Bolivia +1F1E7 1F1F6 ; emoji ; L2 ; none ; x # V6.0 (🇧🇶) flag for Caribbean Netherlands +1F1E7 1F1F7 ; emoji ; L2 ; none ; x # V6.0 (🇧🇷) flag for Brazil +1F1E7 1F1F8 ; emoji ; L2 ; none ; x # V6.0 (🇧🇸) flag for Bahamas +1F1E7 1F1F9 ; emoji ; L2 ; none ; x # V6.0 (🇧🇹) flag for Bhutan +1F1E7 1F1FB ; emoji ; L2 ; none ; x # V6.0 (🇧🇻) flag for Bouvet Island +1F1E7 1F1FC ; emoji ; L2 ; none ; x # V6.0 (🇧🇼) flag for Botswana +1F1E7 1F1FE ; emoji ; L2 ; none ; x # V6.0 (🇧🇾) flag for Belarus +1F1E7 1F1FF ; emoji ; L2 ; none ; x # V6.0 (🇧🇿) flag for Belize +1F1E8 1F1E6 ; emoji ; L2 ; none ; x # V6.0 (🇨🇦) flag for Canada +1F1E8 1F1E8 ; emoji ; L2 ; none ; x # V6.0 (🇨🇨) flag for Cocos Islands +1F1E8 1F1E9 ; emoji ; L2 ; none ; x # V6.0 (🇨🇩) flag for Congo - Kinshasa +1F1E8 1F1EB ; emoji ; L2 ; none ; x # V6.0 (🇨🇫) flag for Central African Republic +1F1E8 1F1EC ; emoji ; L2 ; none ; x # V6.0 (🇨🇬) flag for Congo - Brazzaville +1F1E8 1F1ED ; emoji ; L2 ; none ; x # V6.0 (🇨🇭) flag for Switzerland +1F1E8 1F1EE ; emoji ; L2 ; none ; x # V6.0 (🇨🇮) flag for Côte d’Ivoire +1F1E8 1F1F0 ; emoji ; L2 ; none ; x # V6.0 (🇨🇰) flag for Cook Islands +1F1E8 1F1F1 ; emoji ; L2 ; none ; x # V6.0 (🇨🇱) flag for Chile +1F1E8 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇨🇲) flag for Cameroon +1F1E8 1F1F3 ; emoji ; L1 ; none ; j # V6.0 (🇨🇳) flag for China +1F1E8 1F1F4 ; emoji ; L2 ; none ; x # V6.0 (🇨🇴) flag for Colombia +1F1E8 1F1F5 ; emoji ; L2 ; none ; x # V6.0 (🇨🇵) flag for Clipperton Island +1F1E8 1F1F7 ; emoji ; L2 ; none ; x # V6.0 (🇨🇷) flag for Costa Rica +1F1E8 1F1FA ; emoji ; L2 ; none ; x # V6.0 (🇨🇺) flag for Cuba +1F1E8 1F1FB ; emoji ; L2 ; none ; x # V6.0 (🇨🇻) flag for Cape Verde +1F1E8 1F1FC ; emoji ; L2 ; none ; x # V6.0 (🇨🇼) flag for Curaçao +1F1E8 1F1FD ; emoji ; L2 ; none ; x # V6.0 (🇨🇽) flag for Christmas Island +1F1E8 1F1FE ; emoji ; L2 ; none ; x # V6.0 (🇨🇾) flag for Cyprus +1F1E8 1F1FF ; emoji ; L2 ; none ; x # V6.0 (🇨🇿) flag for Czech Republic +1F1E9 1F1EA ; emoji ; L1 ; none ; j # V6.0 (🇩🇪) flag for Germany +1F1E9 1F1EC ; emoji ; L2 ; none ; x # V6.0 (🇩🇬) flag for Diego Garcia +1F1E9 1F1EF ; emoji ; L2 ; none ; x # V6.0 (🇩🇯) flag for Djibouti +1F1E9 1F1F0 ; emoji ; L2 ; none ; x # V6.0 (🇩🇰) flag for Denmark +1F1E9 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇩🇲) flag for Dominica +1F1E9 1F1F4 ; emoji ; L2 ; none ; x # V6.0 (🇩🇴) flag for Dominican Republic +1F1E9 1F1FF ; emoji ; L2 ; none ; x # V6.0 (🇩🇿) flag for Algeria +1F1EA 1F1E6 ; emoji ; L2 ; none ; x # V6.0 (🇪🇦) flag for Ceuta & Melilla +1F1EA 1F1E8 ; emoji ; L2 ; none ; x # V6.0 (🇪🇨) flag for Ecuador +1F1EA 1F1EA ; emoji ; L2 ; none ; x # V6.0 (🇪🇪) flag for Estonia +1F1EA 1F1EC ; emoji ; L2 ; none ; x # V6.0 (🇪🇬) flag for Egypt +1F1EA 1F1ED ; emoji ; L2 ; none ; x # V6.0 (🇪🇭) flag for Western Sahara +1F1EA 1F1F7 ; emoji ; L2 ; none ; x # V6.0 (🇪🇷) flag for Eritrea +1F1EA 1F1F8 ; emoji ; L1 ; none ; j # V6.0 (🇪🇸) flag for Spain +1F1EA 1F1F9 ; emoji ; L2 ; none ; x # V6.0 (🇪🇹) flag for Ethiopia +1F1EA 1F1FA ; emoji ; L2 ; none ; x # V6.0 (🇪🇺) flag for European Union +1F1EB 1F1EE ; emoji ; L2 ; none ; x # V6.0 (🇫🇮) flag for Finland +1F1EB 1F1EF ; emoji ; L2 ; none ; x # V6.0 (🇫🇯) flag for Fiji +1F1EB 1F1F0 ; emoji ; L2 ; none ; x # V6.0 (🇫🇰) flag for Falkland Islands +1F1EB 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇫🇲) flag for Micronesia +1F1EB 1F1F4 ; emoji ; L2 ; none ; x # V6.0 (🇫🇴) flag for Faroe Islands +1F1EB 1F1F7 ; emoji ; L1 ; none ; j # V6.0 (🇫🇷) flag for France +1F1EC 1F1E6 ; emoji ; L2 ; none ; x # V6.0 (🇬🇦) flag for Gabon +1F1EC 1F1E7 ; emoji ; L1 ; none ; j # V6.0 (🇬🇧) flag for United Kingdom +1F1EC 1F1E9 ; emoji ; L2 ; none ; x # V6.0 (🇬🇩) flag for Grenada +1F1EC 1F1EA ; emoji ; L2 ; none ; x # V6.0 (🇬🇪) flag for Georgia +1F1EC 1F1EB ; emoji ; L2 ; none ; x # V6.0 (🇬🇫) flag for French Guiana +1F1EC 1F1EC ; emoji ; L2 ; none ; x # V6.0 (🇬🇬) flag for Guernsey +1F1EC 1F1ED ; emoji ; L2 ; none ; x # V6.0 (🇬🇭) flag for Ghana +1F1EC 1F1EE ; emoji ; L2 ; none ; x # V6.0 (🇬🇮) flag for Gibraltar +1F1EC 1F1F1 ; emoji ; L2 ; none ; x # V6.0 (🇬🇱) flag for Greenland +1F1EC 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇬🇲) flag for Gambia +1F1EC 1F1F3 ; emoji ; L2 ; none ; x # V6.0 (🇬🇳) flag for Guinea +1F1EC 1F1F5 ; emoji ; L2 ; none ; x # V6.0 (🇬🇵) flag for Guadeloupe +1F1EC 1F1F6 ; emoji ; L2 ; none ; x # V6.0 (🇬🇶) flag for Equatorial Guinea +1F1EC 1F1F7 ; emoji ; L2 ; none ; x # V6.0 (🇬🇷) flag for Greece +1F1EC 1F1F8 ; emoji ; L2 ; none ; x # V6.0 (🇬🇸) flag for South Georgia & South Sandwich Islands +1F1EC 1F1F9 ; emoji ; L2 ; none ; x # V6.0 (🇬🇹) flag for Guatemala +1F1EC 1F1FA ; emoji ; L2 ; none ; x # V6.0 (🇬🇺) flag for Guam +1F1EC 1F1FC ; emoji ; L2 ; none ; x # V6.0 (🇬🇼) flag for Guinea-Bissau +1F1EC 1F1FE ; emoji ; L2 ; none ; x # V6.0 (🇬🇾) flag for Guyana +1F1ED 1F1F0 ; emoji ; L2 ; none ; x # V6.0 (🇭🇰) flag for Hong Kong +1F1ED 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇭🇲) flag for Heard & McDonald Islands +1F1ED 1F1F3 ; emoji ; L2 ; none ; x # V6.0 (🇭🇳) flag for Honduras +1F1ED 1F1F7 ; emoji ; L2 ; none ; x # V6.0 (🇭🇷) flag for Croatia +1F1ED 1F1F9 ; emoji ; L2 ; none ; x # V6.0 (🇭🇹) flag for Haiti +1F1ED 1F1FA ; emoji ; L2 ; none ; x # V6.0 (🇭🇺) flag for Hungary +1F1EE 1F1E8 ; emoji ; L2 ; none ; x # V6.0 (🇮🇨) flag for Canary Islands +1F1EE 1F1E9 ; emoji ; L2 ; none ; x # V6.0 (🇮🇩) flag for Indonesia +1F1EE 1F1EA ; emoji ; L2 ; none ; x # V6.0 (🇮🇪) flag for Ireland +1F1EE 1F1F1 ; emoji ; L2 ; none ; x # V6.0 (🇮🇱) flag for Israel +1F1EE 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇮🇲) flag for Isle of Man +1F1EE 1F1F3 ; emoji ; L2 ; none ; x # V6.0 (🇮🇳) flag for India +1F1EE 1F1F4 ; emoji ; L2 ; none ; x # V6.0 (🇮🇴) flag for British Indian Ocean Territory +1F1EE 1F1F6 ; emoji ; L2 ; none ; x # V6.0 (🇮🇶) flag for Iraq +1F1EE 1F1F7 ; emoji ; L2 ; none ; x # V6.0 (🇮🇷) flag for Iran +1F1EE 1F1F8 ; emoji ; L2 ; none ; x # V6.0 (🇮🇸) flag for Iceland +1F1EE 1F1F9 ; emoji ; L1 ; none ; j # V6.0 (🇮🇹) flag for Italy +1F1EF 1F1EA ; emoji ; L2 ; none ; x # V6.0 (🇯🇪) flag for Jersey +1F1EF 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇯🇲) flag for Jamaica +1F1EF 1F1F4 ; emoji ; L2 ; none ; x # V6.0 (🇯🇴) flag for Jordan +1F1EF 1F1F5 ; emoji ; L1 ; none ; j # V6.0 (🇯🇵) flag for Japan +1F1F0 1F1EA ; emoji ; L2 ; none ; x # V6.0 (🇰🇪) flag for Kenya +1F1F0 1F1EC ; emoji ; L2 ; none ; x # V6.0 (🇰🇬) flag for Kyrgyzstan +1F1F0 1F1ED ; emoji ; L2 ; none ; x # V6.0 (🇰🇭) flag for Cambodia +1F1F0 1F1EE ; emoji ; L2 ; none ; x # V6.0 (🇰🇮) flag for Kiribati +1F1F0 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇰🇲) flag for Comoros +1F1F0 1F1F3 ; emoji ; L2 ; none ; x # V6.0 (🇰🇳) flag for St. Kitts & Nevis +1F1F0 1F1F5 ; emoji ; L2 ; none ; x # V6.0 (🇰🇵) flag for North Korea +1F1F0 1F1F7 ; emoji ; L1 ; none ; j # V6.0 (🇰🇷) flag for South Korea +1F1F0 1F1FC ; emoji ; L2 ; none ; x # V6.0 (🇰🇼) flag for Kuwait +1F1F0 1F1FE ; emoji ; L2 ; none ; x # V6.0 (🇰🇾) flag for Cayman Islands +1F1F0 1F1FF ; emoji ; L2 ; none ; x # V6.0 (🇰🇿) flag for Kazakhstan +1F1F1 1F1E6 ; emoji ; L2 ; none ; x # V6.0 (🇱🇦) flag for Laos +1F1F1 1F1E7 ; emoji ; L2 ; none ; x # V6.0 (🇱🇧) flag for Lebanon +1F1F1 1F1E8 ; emoji ; L2 ; none ; x # V6.0 (🇱🇨) flag for St. Lucia +1F1F1 1F1EE ; emoji ; L2 ; none ; x # V6.0 (🇱🇮) flag for Liechtenstein +1F1F1 1F1F0 ; emoji ; L2 ; none ; x # V6.0 (🇱🇰) flag for Sri Lanka +1F1F1 1F1F7 ; emoji ; L2 ; none ; x # V6.0 (🇱🇷) flag for Liberia +1F1F1 1F1F8 ; emoji ; L2 ; none ; x # V6.0 (🇱🇸) flag for Lesotho +1F1F1 1F1F9 ; emoji ; L2 ; none ; x # V6.0 (🇱🇹) flag for Lithuania +1F1F1 1F1FA ; emoji ; L2 ; none ; x # V6.0 (🇱🇺) flag for Luxembourg +1F1F1 1F1FB ; emoji ; L2 ; none ; x # V6.0 (🇱🇻) flag for Latvia +1F1F1 1F1FE ; emoji ; L2 ; none ; x # V6.0 (🇱🇾) flag for Libya +1F1F2 1F1E6 ; emoji ; L2 ; none ; x # V6.0 (🇲🇦) flag for Morocco +1F1F2 1F1E8 ; emoji ; L2 ; none ; x # V6.0 (🇲🇨) flag for Monaco +1F1F2 1F1E9 ; emoji ; L2 ; none ; x # V6.0 (🇲🇩) flag for Moldova +1F1F2 1F1EA ; emoji ; L2 ; none ; x # V6.0 (🇲🇪) flag for Montenegro +1F1F2 1F1EB ; emoji ; L2 ; none ; x # V6.0 (🇲🇫) flag for St. Martin +1F1F2 1F1EC ; emoji ; L2 ; none ; x # V6.0 (🇲🇬) flag for Madagascar +1F1F2 1F1ED ; emoji ; L2 ; none ; x # V6.0 (🇲🇭) flag for Marshall Islands +1F1F2 1F1F0 ; emoji ; L2 ; none ; x # V6.0 (🇲🇰) flag for Macedonia +1F1F2 1F1F1 ; emoji ; L2 ; none ; x # V6.0 (🇲🇱) flag for Mali +1F1F2 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇲🇲) flag for Myanmar +1F1F2 1F1F3 ; emoji ; L2 ; none ; x # V6.0 (🇲🇳) flag for Mongolia +1F1F2 1F1F4 ; emoji ; L2 ; none ; x # V6.0 (🇲🇴) flag for Macau +1F1F2 1F1F5 ; emoji ; L2 ; none ; x # V6.0 (🇲🇵) flag for Northern Mariana Islands +1F1F2 1F1F6 ; emoji ; L2 ; none ; x # V6.0 (🇲🇶) flag for Martinique +1F1F2 1F1F7 ; emoji ; L2 ; none ; x # V6.0 (🇲🇷) flag for Mauritania +1F1F2 1F1F8 ; emoji ; L2 ; none ; x # V6.0 (🇲🇸) flag for Montserrat +1F1F2 1F1F9 ; emoji ; L2 ; none ; x # V6.0 (🇲🇹) flag for Malta +1F1F2 1F1FA ; emoji ; L2 ; none ; x # V6.0 (🇲🇺) flag for Mauritius +1F1F2 1F1FB ; emoji ; L2 ; none ; x # V6.0 (🇲🇻) flag for Maldives +1F1F2 1F1FC ; emoji ; L2 ; none ; x # V6.0 (🇲🇼) flag for Malawi +1F1F2 1F1FD ; emoji ; L2 ; none ; x # V6.0 (🇲🇽) flag for Mexico +1F1F2 1F1FE ; emoji ; L2 ; none ; x # V6.0 (🇲🇾) flag for Malaysia +1F1F2 1F1FF ; emoji ; L2 ; none ; x # V6.0 (🇲🇿) flag for Mozambique +1F1F3 1F1E6 ; emoji ; L2 ; none ; x # V6.0 (🇳🇦) flag for Namibia +1F1F3 1F1E8 ; emoji ; L2 ; none ; x # V6.0 (🇳🇨) flag for New Caledonia +1F1F3 1F1EA ; emoji ; L2 ; none ; x # V6.0 (🇳🇪) flag for Niger +1F1F3 1F1EB ; emoji ; L2 ; none ; x # V6.0 (🇳🇫) flag for Norfolk Island +1F1F3 1F1EC ; emoji ; L2 ; none ; x # V6.0 (🇳🇬) flag for Nigeria +1F1F3 1F1EE ; emoji ; L2 ; none ; x # V6.0 (🇳🇮) flag for Nicaragua +1F1F3 1F1F1 ; emoji ; L2 ; none ; x # V6.0 (🇳🇱) flag for Netherlands +1F1F3 1F1F4 ; emoji ; L2 ; none ; x # V6.0 (🇳🇴) flag for Norway +1F1F3 1F1F5 ; emoji ; L2 ; none ; x # V6.0 (🇳🇵) flag for Nepal +1F1F3 1F1F7 ; emoji ; L2 ; none ; x # V6.0 (🇳🇷) flag for Nauru +1F1F3 1F1FA ; emoji ; L2 ; none ; x # V6.0 (🇳🇺) flag for Niue +1F1F3 1F1FF ; emoji ; L2 ; none ; x # V6.0 (🇳🇿) flag for New Zealand +1F1F4 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇴🇲) flag for Oman +1F1F5 1F1E6 ; emoji ; L2 ; none ; x # V6.0 (🇵🇦) flag for Panama +1F1F5 1F1EA ; emoji ; L2 ; none ; x # V6.0 (🇵🇪) flag for Peru +1F1F5 1F1EB ; emoji ; L2 ; none ; x # V6.0 (🇵🇫) flag for French Polynesia +1F1F5 1F1EC ; emoji ; L2 ; none ; x # V6.0 (🇵🇬) flag for Papua New Guinea +1F1F5 1F1ED ; emoji ; L2 ; none ; x # V6.0 (🇵🇭) flag for Philippines +1F1F5 1F1F0 ; emoji ; L2 ; none ; x # V6.0 (🇵🇰) flag for Pakistan +1F1F5 1F1F1 ; emoji ; L2 ; none ; x # V6.0 (🇵🇱) flag for Poland +1F1F5 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇵🇲) flag for St. Pierre & Miquelon +1F1F5 1F1F3 ; emoji ; L2 ; none ; x # V6.0 (🇵🇳) flag for Pitcairn Islands +1F1F5 1F1F7 ; emoji ; L2 ; none ; x # V6.0 (🇵🇷) flag for Puerto Rico +1F1F5 1F1F8 ; emoji ; L2 ; none ; x # V6.0 (🇵🇸) flag for Palestinian Territories +1F1F5 1F1F9 ; emoji ; L2 ; none ; x # V6.0 (🇵🇹) flag for Portugal +1F1F5 1F1FC ; emoji ; L2 ; none ; x # V6.0 (🇵🇼) flag for Palau +1F1F5 1F1FE ; emoji ; L2 ; none ; x # V6.0 (🇵🇾) flag for Paraguay +1F1F6 1F1E6 ; emoji ; L2 ; none ; x # V6.0 (🇶🇦) flag for Qatar +1F1F7 1F1EA ; emoji ; L2 ; none ; x # V6.0 (🇷🇪) flag for Réunion +1F1F7 1F1F4 ; emoji ; L2 ; none ; x # V6.0 (🇷🇴) flag for Romania +1F1F7 1F1F8 ; emoji ; L2 ; none ; x # V6.0 (🇷🇸) flag for Serbia +1F1F7 1F1FA ; emoji ; L1 ; none ; j # V6.0 (🇷🇺) flag for Russia +1F1F7 1F1FC ; emoji ; L2 ; none ; x # V6.0 (🇷🇼) flag for Rwanda +1F1F8 1F1E6 ; emoji ; L2 ; none ; x # V6.0 (🇸🇦) flag for Saudi Arabia +1F1F8 1F1E7 ; emoji ; L2 ; none ; x # V6.0 (🇸🇧) flag for Solomon Islands +1F1F8 1F1E8 ; emoji ; L2 ; none ; x # V6.0 (🇸🇨) flag for Seychelles +1F1F8 1F1E9 ; emoji ; L2 ; none ; x # V6.0 (🇸🇩) flag for Sudan +1F1F8 1F1EA ; emoji ; L2 ; none ; x # V6.0 (🇸🇪) flag for Sweden +1F1F8 1F1EC ; emoji ; L2 ; none ; x # V6.0 (🇸🇬) flag for Singapore +1F1F8 1F1ED ; emoji ; L2 ; none ; x # V6.0 (🇸🇭) flag for St. Helena +1F1F8 1F1EE ; emoji ; L2 ; none ; x # V6.0 (🇸🇮) flag for Slovenia +1F1F8 1F1EF ; emoji ; L2 ; none ; x # V6.0 (🇸🇯) flag for Svalbard & Jan Mayen +1F1F8 1F1F0 ; emoji ; L2 ; none ; x # V6.0 (🇸🇰) flag for Slovakia +1F1F8 1F1F1 ; emoji ; L2 ; none ; x # V6.0 (🇸🇱) flag for Sierra Leone +1F1F8 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇸🇲) flag for San Marino +1F1F8 1F1F3 ; emoji ; L2 ; none ; x # V6.0 (🇸🇳) flag for Senegal +1F1F8 1F1F4 ; emoji ; L2 ; none ; x # V6.0 (🇸🇴) flag for Somalia +1F1F8 1F1F7 ; emoji ; L2 ; none ; x # V6.0 (🇸🇷) flag for Suriname +1F1F8 1F1F8 ; emoji ; L2 ; none ; x # V6.0 (🇸🇸) flag for South Sudan +1F1F8 1F1F9 ; emoji ; L2 ; none ; x # V6.0 (🇸🇹) flag for São Tomé & Príncipe +1F1F8 1F1FB ; emoji ; L2 ; none ; x # V6.0 (🇸🇻) flag for El Salvador +1F1F8 1F1FD ; emoji ; L2 ; none ; x # V6.0 (🇸🇽) flag for Sint Maarten +1F1F8 1F1FE ; emoji ; L2 ; none ; x # V6.0 (🇸🇾) flag for Syria +1F1F8 1F1FF ; emoji ; L2 ; none ; x # V6.0 (🇸🇿) flag for Swaziland +1F1F9 1F1E6 ; emoji ; L2 ; none ; x # V6.0 (🇹🇦) flag for Tristan da Cunha +1F1F9 1F1E8 ; emoji ; L2 ; none ; x # V6.0 (🇹🇨) flag for Turks & Caicos Islands +1F1F9 1F1E9 ; emoji ; L2 ; none ; x # V6.0 (🇹🇩) flag for Chad +1F1F9 1F1EB ; emoji ; L2 ; none ; x # V6.0 (🇹🇫) flag for French Southern Territories +1F1F9 1F1EC ; emoji ; L2 ; none ; x # V6.0 (🇹🇬) flag for Togo +1F1F9 1F1ED ; emoji ; L2 ; none ; x # V6.0 (🇹🇭) flag for Thailand +1F1F9 1F1EF ; emoji ; L2 ; none ; x # V6.0 (🇹🇯) flag for Tajikistan +1F1F9 1F1F0 ; emoji ; L2 ; none ; x # V6.0 (🇹🇰) flag for Tokelau +1F1F9 1F1F1 ; emoji ; L2 ; none ; x # V6.0 (🇹🇱) flag for Timor-Leste +1F1F9 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇹🇲) flag for Turkmenistan +1F1F9 1F1F3 ; emoji ; L2 ; none ; x # V6.0 (🇹🇳) flag for Tunisia +1F1F9 1F1F4 ; emoji ; L2 ; none ; x # V6.0 (🇹🇴) flag for Tonga +1F1F9 1F1F7 ; emoji ; L2 ; none ; x # V6.0 (🇹🇷) flag for Turkey +1F1F9 1F1F9 ; emoji ; L2 ; none ; x # V6.0 (🇹🇹) flag for Trinidad & Tobago +1F1F9 1F1FB ; emoji ; L2 ; none ; x # V6.0 (🇹🇻) flag for Tuvalu +1F1F9 1F1FC ; emoji ; L2 ; none ; x # V6.0 (🇹🇼) flag for Taiwan +1F1F9 1F1FF ; emoji ; L2 ; none ; x # V6.0 (🇹🇿) flag for Tanzania +1F1FA 1F1E6 ; emoji ; L2 ; none ; x # V6.0 (🇺🇦) flag for Ukraine +1F1FA 1F1EC ; emoji ; L2 ; none ; x # V6.0 (🇺🇬) flag for Uganda +1F1FA 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇺🇲) flag for U.S. Outlying Islands +1F1FA 1F1F8 ; emoji ; L1 ; none ; j # V6.0 (🇺🇸) flag for United States +1F1FA 1F1FE ; emoji ; L2 ; none ; x # V6.0 (🇺🇾) flag for Uruguay +1F1FA 1F1FF ; emoji ; L2 ; none ; x # V6.0 (🇺🇿) flag for Uzbekistan +1F1FB 1F1E6 ; emoji ; L2 ; none ; x # V6.0 (🇻🇦) flag for Vatican City +1F1FB 1F1E8 ; emoji ; L2 ; none ; x # V6.0 (🇻🇨) flag for St. Vincent & Grenadines +1F1FB 1F1EA ; emoji ; L2 ; none ; x # V6.0 (🇻🇪) flag for Venezuela +1F1FB 1F1EC ; emoji ; L2 ; none ; x # V6.0 (🇻🇬) flag for British Virgin Islands +1F1FB 1F1EE ; emoji ; L2 ; none ; x # V6.0 (🇻🇮) flag for U.S. Virgin Islands +1F1FB 1F1F3 ; emoji ; L2 ; none ; x # V6.0 (🇻🇳) flag for Vietnam +1F1FB 1F1FA ; emoji ; L2 ; none ; x # V6.0 (🇻🇺) flag for Vanuatu +1F1FC 1F1EB ; emoji ; L2 ; none ; x # V6.0 (🇼🇫) flag for Wallis & Futuna +1F1FC 1F1F8 ; emoji ; L2 ; none ; x # V6.0 (🇼🇸) flag for Samoa +1F1FD 1F1F0 ; emoji ; L2 ; none ; x # V6.0 (🇽🇰) flag for Kosovo +1F1FE 1F1EA ; emoji ; L2 ; none ; x # V6.0 (🇾🇪) flag for Yemen +1F1FE 1F1F9 ; emoji ; L2 ; none ; x # V6.0 (🇾🇹) flag for Mayotte +1F1FF 1F1E6 ; emoji ; L2 ; none ; x # V6.0 (🇿🇦) flag for South Africa +1F1FF 1F1F2 ; emoji ; L2 ; none ; x # V6.0 (🇿🇲) flag for Zambia +1F1FF 1F1FC ; emoji ; L2 ; none ; x # V6.0 (🇿🇼) flag for Zimbabwe diff --git a/oh-my-zsh/plugins/emoji/emoji.plugin.zsh b/oh-my-zsh/plugins/emoji/emoji.plugin.zsh @@ -0,0 +1,288 @@ +# emoji plugin +# +# Makes emoji support available within ZSH +# +# See the README for documentation. + +_omz_emoji_plugin_dir="${0:h}" + +() { + +local LC_ALL=en_US.UTF-8 + +typeset -gAH emoji_groups +typeset -gAH emoji_con +typeset -gAH emoji2 +typeset -gAH emoji_skintone + +source "$_omz_emoji_plugin_dir/emoji-char-definitions.zsh" +unset _omz_emoji_plugin_dir + +# These additional emoji are not in the definition file, but are useful in conjunction with it + +# This is a combinin character that can be placed after any other character to surround +# it in a "keycap" symbol. +# The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc. +# It's unclear whether this should be in the $emoji array, because those characters are all ones +# which can be displayed on their own. +#emoji[combining_enclosing_keycap]="\U20E3" + +emoji[regional_indicator_symbol_letter_d_regional_indicator_symbol_letter_e]=$'\xF0\x9F\x87\xA9\xF0\x9F\x87\xAA' +emoji[regional_indicator_symbol_letter_g_regional_indicator_symbol_letter_b]=$'\xF0\x9F\x87\xAC\xF0\x9F\x87\xA7' +emoji[regional_indicator_symbol_letter_c_regional_indicator_symbol_letter_n]=$'\xF0\x9F\x87\xA8\xF0\x9F\x87\xB3' +emoji[regional_indicator_symbol_letter_j_regional_indicator_symbol_letter_p]=$'\xF0\x9F\x87\xAF\xF0\x9F\x87\xB5' +emoji[regional_indicator_symbol_letter_k_regional_indicator_symbol_letter_r]=$'\xF0\x9F\x87\xB0\xF0\x9F\x87\xB7' +emoji[regional_indicator_symbol_letter_f_regional_indicator_symbol_letter_r]=$'\xF0\x9F\x87\xAB\xF0\x9F\x87\xB7' +emoji[regional_indicator_symbol_letter_e_regional_indicator_symbol_letter_s]=$'\xF0\x9F\x87\xAA\xF0\x9F\x87\xB8' +emoji[regional_indicator_symbol_letter_i_regional_indicator_symbol_letter_t]=$'\xF0\x9F\x87\xAE\xF0\x9F\x87\xB9' +emoji[regional_indicator_symbol_letter_u_regional_indicator_symbol_letter_s]=$'\xF0\x9F\x87\xBA\xF0\x9F\x87\xB8' +emoji[regional_indicator_symbol_letter_r_regional_indicator_symbol_letter_u]=$'\xF0\x9F\x87\xB7\xF0\x9F\x87\xBA' + +# Nonstandard alias names +emoji[vulcan_salute]=$'\U1F596' + + +# Emoji combining and auxiliary characters + +# "Variation Selectors" for controlling text vs emoji style presentation +# These apply to the immediately preceding character +emoji2[text_style]=$'\UFE0E' +emoji2[emoji_style]=$'\UFE0F' +# Joiner that indicates a single combined-form glyph (ligature) should be used +emoji2[zero_width_joiner]=$'\U200D' +# Skin tone modifiers +emoji2[emoji_modifier_fitzpatrick_type_1_2]=$'\U1F3FB' +emoji2[emoji_modifier_fitzpatrick_type_3]=$'\U1F3FC' +emoji2[emoji_modifier_fitzpatrick_type_4]=$'\U1F3FD' +emoji2[emoji_modifier_fitzpatrick_type_5]=$'\U1F3FE' +emoji2[emoji_modifier_fitzpatrick_type_6]=$'\U1F3FF' +# Various other combining characters. (Incomplete list; I selected ones that sound useful) +emoji2[combining_enclosing_circle]=$'\U20DD' +emoji2[combining_enclosing_square]=$'\U20DE' +emoji2[combining_enclosing_diamond]=$'\U20DF' +emoji2[combining_enclosing_circle_backslash]=$'\U20E0' +emoji2[combining_enclosing_screen]=$'\U20E2' +emoji2[combining_enclosing_keycap]=$'\U20E3' +emoji2[combining_enclosing_upward_pointing_triangle]=$'\U20E4' + +# Easier access to skin tone modifiers +emoji_skintone[1_2]=$'\U1F3FB' +emoji_skintone[3]=$'\U1F3FC' +emoji_skintone[4]=$'\U1F3FD' +emoji_skintone[5]=$'\U1F3FE' +emoji_skintone[6]=$'\U1F3FF' + +# Emoji groups +# These are stored in a single associative array, $emoji_groups, to avoid cluttering up the global +# namespace, and to allow adding additional group definitions at run time. +# The keys are the group names, and the values are whitespace-separated lists of emoji character names. + +emoji_groups[fruits]=" + tomato + aubergine + grapes + melon + watermelon + tangerine + banana + pineapple + red_apple + green_apple + peach + cherries + strawberry + lemon + pear +" + +emoji_groups[vehicles]=" + airplane + rocket + railway_car + high_speed_train + high_speed_train_with_bullet_nose + bus + ambulance + fire_engine + police_car + taxi + automobile + recreational_vehicle + delivery_truck + ship + speedboat + bicycle + helicopter + steam_locomotive + train + light_rail + tram + oncoming_bus + trolleybus + minibus + oncoming_police_car + oncoming_taxi + oncoming_automobile + articulated_lorry + tractor + monorail + mountain_railway + suspension_railway + mountain_cableway + aerial_tramway + rowboat + bicyclist + mountain_bicyclist + sailboat +" + +emoji_groups[animals]=" + snail + snake + horse + sheep + monkey + chicken + boar + elephant + octopus + spiral_shell + bug + ant + honeybee + lady_beetle + fish + tropical_fish + blowfish + turtle + hatching_chick + baby_chick + front_facing_baby_chick + bird + penguin + koala + poodle + bactrian_camel + dolphin + mouse_face + cow_face + tiger_face + rabbit_face + cat_face + dragon_face + spouting_whale + horse_face + monkey_face + dog_face + pig_face + frog_face + hamster_face + wolf_face + bear_face + panda_face + rat + mouse + ox + water_buffalo + cow + tiger + leopard + rabbit + cat + dragon + crocodile + whale + ram + goat + rooster + dog + pig + dromedary_camel +" + +emoji_groups[faces]=" + grinning_face_with_smiling_eyes + face_with_tears_of_joy + smiling_face_with_open_mouth + smiling_face_with_open_mouth_and_smiling_eyes + smiling_face_with_open_mouth_and_cold_sweat + smiling_face_with_open_mouth_and_tightly_closed_eyes + winking_face + smiling_face_with_smiling_eyes + face_savouring_delicious_food + relieved_face + smiling_face_with_heart_shaped_eyes + smirking_face + unamused_face + face_with_cold_sweat + pensive_face + confounded_face + face_throwing_a_kiss + kissing_face_with_closed_eyes + face_with_stuck_out_tongue_and_winking_eye + face_with_stuck_out_tongue_and_tightly_closed_eyes + disappointed_face + angry_face + pouting_face + crying_face + persevering_face + face_with_look_of_triumph + disappointed_but_relieved_face + fearful_face + weary_face + sleepy_face + tired_face + loudly_crying_face + face_with_open_mouth_and_cold_sweat + face_screaming_in_fear + astonished_face + flushed_face + dizzy_face + face_with_medical_mask +" + +} + +# Prints a random emoji character +# +# random_emoji [group] +# +function random_emoji() { + local group=$1 + local names + if [[ -z "$group" || "$group" == "all" ]]; then + names=(${(k)emoji}) + else + names=(${=emoji_groups[$group]}) + fi + local list_size=${#names} + [[ $list_size -eq 0 ]] && return 1 + local random_index=$(( ( RANDOM % $list_size ) + 1 )) + local name=${names[$random_index]} + echo ${emoji[$name]} +} + +# Displays a listing of emoji with their names +# +# display_emoji [group] +# +function display_emoji() { + local group=$1 + local names + if [[ -z "$group" || "$group" == "all" ]]; then + names=(${(k)emoji}) + else + names=(${=emoji_groups[$group]}) + fi + # The extra spaces in output here are a hack for readability, since some + # terminals treat these emoji chars as single-width. + for i in $names; do + printf '%s ' "$emoji[$i]" + done + print + for i in $names; do + echo "${emoji[$i]} = $i" + done +} + + diff --git a/oh-my-zsh/plugins/emoji/update_emoji.pl b/oh-my-zsh/plugins/emoji/update_emoji.pl @@ -0,0 +1,113 @@ +#!/usr/bin/perl -w +# +# update_emoji.pl +# +# This script generates the emoji.plugin.zsh emoji definitions from the Unicode +# character data for the emoji characters. +# +# The data file can be found at http://unicode.org/Public/emoji/latest/emoji-data.txt +# as referenced in Unicode TR51 (http://www.unicode.org/reports/tr51/index.html). +# +# This is known to work with the data file from version 1.0. It may not work with later +# versions if the format changes. In particular, this reads line comments to get the +# emoji character name and unicode version. +# +# Country names have punctuation and other non-letter characters removed from their name, +# to avoid possible complications with having to escape the strings when using them as +# array subscripts. The definition file seems to use some combining characters like accents +# that get stripped during this process. + +use strict; +use warnings; +use 5.010; +use autodie; + +use Path::Class; +use File::Copy; + +# Parse definitions out of the data file and convert +sub process_emoji_data_file { + my ( $infile, $outfilename ) = @_; + my $file = file($infile); + my $outfile = file($outfilename); + my $outfilebase = $outfile->basename(); + my $tempfilename = "$outfilename.tmp"; + my $tempfile = file($tempfilename); + my $outfh = $tempfile->openw(); + $outfh->print(" +# $outfilebase - Emoji character definitions for oh-my-zsh emoji plugin +# +# This file is auto-generated by update_emoji.pl. Do not edit it manually. +# +# This contains the definition for: +# \$emoji - which maps character names to Unicode characters +# \$emoji_flags - maps country names to Unicode flag characters using region indicators + +# Main emoji +typeset -gAH emoji +# National flags +typeset -gAH emoji_flags +# Combining modifiers +typeset -gAH emoji_mod + +"); + + my $fh = $file->openr(); + my $line_num = 0; + while ( my $line = $fh->getline() ) { + $line_num++; + $_ = $line; + # Skip all-comment lines (from the header) and blank lines + # (But don't strip comments on normal lines; we need to parse those for + # the emoji names.) + next if /^\s*#/ or /^\s*$/; + + if (/^(\S.*?\S)\s*;\s*(\w+)\s*;\s*(\w+)\s*;\s*(\w+)\s*;\s*(\w.*?)\s*#\s*V(\S+)\s\(.*?\)\s*(\w.*\S)\s*$/) { + my ($code, $style, $level, $modifier_status, $sources, $version, $keycap_name) + = ($1, $2, $3, $4, $5, $6, $7); + #print "code=$code style=$style level=$level modifier_status=$modifier_status sources=$sources version=$version name=$keycap_name\n"; + my @code_points = split /\s+/, $code; + my @sources = split /\s+/, $sources; + + my $flag_country = ""; + if ( $keycap_name =~ /^flag for (\S.*?)\s*$/) { + $flag_country = $1; + } + + my $zsh_code = join '', map { "\\U$_" } @code_points; + # Convert keycap names to valid associative array names that do not require any + # quoting. Works fine for most stuff, but is clumsy for flags. + my $omz_name = lc($keycap_name); + $omz_name =~ s/[^A-Za-z0-9]/_/g; + my $zsh_flag_country = $flag_country; + $zsh_flag_country =~ s/[^\p{Letter}]/_/g; + if ($flag_country) { + $outfh->print("emoji_flags[$zsh_flag_country]=\$'$zsh_code'\n"); + } else { + $outfh->print("emoji[$omz_name]=\$'$zsh_code'\n"); + } + # Modifiers are included in both the main set and their separate map, + # because they have a standalone representation as a color swatch. + if ( $modifier_status eq "modifier" ) { + $outfh->print("emoji_mod[$omz_name]=\$'$zsh_code'\n"); + } + } else { + die "Failed parsing line $line_num: '$_'"; + } + } + $fh->close(); + $outfh->print("\n"); + $outfh->close(); + + move($tempfilename, $outfilename) + or die "Failed moving temp file to $outfilename: $!"; +} + +my $datafile = "emoji-data.txt"; +my $zsh_def_file = "emoji-char-definitions.zsh"; +process_emoji_data_file($datafile, $zsh_def_file); + +print "Updated definition file $zsh_def_file\n"; + + + diff --git a/oh-my-zsh/plugins/emotty/emotty.plugin.zsh b/oh-my-zsh/plugins/emotty/emotty.plugin.zsh @@ -0,0 +1,43 @@ +# ------------------------------------------------------------------------------ +# FILE: emotty.plugin.zsh +# DESCRIPTION: Return an emoji for the current $TTY number. +# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net) +# VERSION: 1.0.0 +# DEPENDS: emoji plugin +# +# There are different sets of emoji characters available, to choose a different +# set export emotty_set to the name of the set you would like to use, e.g.: +# % export emotty_set=nature +# ------------------------------------------------------------------------------ + +typeset -gAH _emotty_sets +local _emotty_plugin_dir="${0:h}" +source "$_emotty_plugin_dir/emotty_stellar_set.zsh" +source "$_emotty_plugin_dir/emotty_floral_set.zsh" +source "$_emotty_plugin_dir/emotty_zodiac_set.zsh" +source "$_emotty_plugin_dir/emotty_nature_set.zsh" +source "$_emotty_plugin_dir/emotty_emoji_set.zsh" +source "$_emotty_plugin_dir/emotty_love_set.zsh" +unset _emotty_plugin_dir + +emotty_default_set=emoji + +function emotty() { + # Use emotty set defined by user, fallback to default + local emotty=${_emotty_sets[${emotty_set:-$emotty_default_set}]} + # Parse $TTY number, normalizing it to an emotty set index + (( tty = (${TTY##/dev/ttys} % ${#${=emotty}}) + 1 )) + local character_name=${${=emotty}[tty]} + echo "${emoji[${character_name}]}${emoji2[emoji_style]}" +} + +function display_emotty() { + local name=$1 + for i in ${=_emotty_sets[$name]}; do + printf "${emoji[$i]}${emoji2[emoji_style]} " + done + print + for i in ${=_emotty_sets[$name]}; do + print "${emoji[$i]}${emoji2[emoji_style]} = $i" + done +} diff --git a/oh-my-zsh/plugins/emotty/emotty_emoji_set.zsh b/oh-my-zsh/plugins/emotty/emotty_emoji_set.zsh @@ -0,0 +1,24 @@ +#!/usr/bin/env zsh +# vim:ft=zsh ts=2 sw=2 sts=2 + +_emotty_sets[emoji]=" + crystal_ball + ghost + jack_o_lantern + see_no_evil_monkey + hear_no_evil_monkey + speak_no_evil_monkey + smiling_cat_face_with_open_mouth + extraterrestrial_alien + rocket + billiards + bomb + pill + japanese_symbol_for_beginner + direct_hit + cyclone + diamond_shape_with_a_dot_inside + sparkle + eight_spoked_asterisk + eight_pointed_black_star + " diff --git a/oh-my-zsh/plugins/emotty/emotty_floral_set.zsh b/oh-my-zsh/plugins/emotty/emotty_floral_set.zsh @@ -0,0 +1,18 @@ +#!/usr/bin/env zsh +# vim:ft=zsh ts=2 sw=2 sts=2 + +_emotty_sets[floral]=" + hibiscus + cherry_blossom + blossom + sunflower + bouquet + tulip + rose + four_leaf_clover + seedling + herb + palm_tree + evergreen_tree + deciduous_tree + " diff --git a/oh-my-zsh/plugins/emotty/emotty_love_set.zsh b/oh-my-zsh/plugins/emotty/emotty_love_set.zsh @@ -0,0 +1,34 @@ +#!/usr/bin/env zsh +# vim:ft=zsh ts=2 sw=2 sts=2 + +# Note: The heavy_black_heart emoji requires $emoji2[emoji_style] +# to be rendered as the emoji red heart. +_emotty_sets[love]=" + green_heart + blue_heart + purple_heart + yellow_heart + heavy_black_heart + broken_heart + heart_with_arrow + heart_with_ribbon + sparkling_heart + two_hearts + revolving_hearts + growing_heart + beating_heart + heart_decoration + couple_with_heart + kiss + man_and_woman_holding_hands + two_women_holding_hands + two_men_holding_hands + kiss_mark + smiling_face_with_heart_shaped_eyes + kissing_face + face_throwing_a_kiss + kissing_face_with_smiling_eyes + kissing_face_with_closed_eyes + smiling_cat_face_with_heart_shaped_eyes + kissing_cat_face_with_closed_eyes + " diff --git a/oh-my-zsh/plugins/emotty/emotty_nature_set.zsh b/oh-my-zsh/plugins/emotty/emotty_nature_set.zsh @@ -0,0 +1,58 @@ +#!/usr/bin/env zsh +# vim:ft=zsh ts=2 sw=2 sts=2 + +_emotty_sets[nature]=" + mouse_face + hamster_face + rabbit_face + dog_face + cat_face + tiger_face + bear_face + monkey_face + koala + panda_face + chicken + baby_chick + bird + penguin + cow_face + pig_face + frog_face + boar + wolf_face + horse_face + snail + bug + ant + honeybee + lady_beetle + spouting_whale + dolphin + octopus + fish + tropical_fish + snake + turtle + lemon + tangerine + peach + mushroom + tomato + strawberry + red_apple + cherries + grapes + aubergine + watermelon + banana + pineapple + melon + pear + green_apple + ear_of_maize + sunflower + seedling + herb + four_leaf_clover + " diff --git a/oh-my-zsh/plugins/emotty/emotty_stellar_set.zsh b/oh-my-zsh/plugins/emotty/emotty_stellar_set.zsh @@ -0,0 +1,25 @@ +#!/usr/bin/env zsh +# vim:ft=zsh ts=2 sw=2 sts=2 + +# NOTE: The following emoji show as $'character' in the title +# white_medium_star +# sparkles +# dizzy_symbol + +_emotty_sets[stellar]=" + full_moon_symbol + waning_gibbous_moon_symbol + waning_crescent_moon_symbol + last_quarter_moon_symbol + new_moon_symbol + new_moon_with_face + waxing_crescent_moon_symbol + first_quarter_moon_symbol + waxing_gibbous_moon_symbol + full_moon_with_face + sun_with_face + glowing_star + crescent_moon + first_quarter_moon_with_face + last_quarter_moon_with_face + " diff --git a/oh-my-zsh/plugins/emotty/emotty_zodiac_set.zsh b/oh-my-zsh/plugins/emotty/emotty_zodiac_set.zsh @@ -0,0 +1,29 @@ +#!/usr/bin/env zsh +# vim:ft=zsh ts=2 sw=2 sts=2 + +_emotty_sets[zodiac]=" + aries + taurus + gemini + cancer + leo + virgo + libra + scorpius + sagittarius + capricorn + aquarius + pisces + rat + ox + tiger + rabbit + dragon + snake + horse + goat + monkey + rooster + dog + pig + " diff --git a/oh-my-zsh/plugins/encode64/encode64.plugin.zsh b/oh-my-zsh/plugins/encode64/encode64.plugin.zsh @@ -0,0 +1,17 @@ +encode64() { + if [[ $# -eq 0 ]]; then + cat | base64 + else + printf '%s' $1 | base64 + fi +} + +decode64() { + if [[ $# -eq 0 ]]; then + cat | base64 --decode + else + printf '%s' $1 | base64 --decode + fi +} +alias e64=encode64 +alias d64=decode64 diff --git a/oh-my-zsh/plugins/extract/README.md b/oh-my-zsh/plugins/extract/README.md @@ -0,0 +1,46 @@ +# extract plugin + +This plugin defines a function called `extract` that extracts the archive file +you pass it, and it supports a wide variety of archive filetypes. + +This way you don't have to know what specific command extracts a file, you just +do `extract <filename>` and the function takes care of the rest. + +To use it, add `extract` to the plugins array in your zshrc file: + +```zsh +plugins=(... extract) +``` + +## Supported file extensions + +| Extension | Description | +|:------------------|:-------------------------------------| +| `7z` | 7zip file | +| `Z` | Z archive (LZW) | +| `apk` | Android app file | +| `bz2` | Bzip2 file | +| `deb` | Debian package | +| `gz` | Gzip file | +| `ipsw` | iOS firmware file | +| `jar` | Java Archive | +| `lzma` | LZMA archive | +| `rar` | WinRAR archive | +| `sublime-package` | Sublime Text package | +| `tar` | Tarball | +| `tar.bz2` | Tarball with bzip2 compression | +| `tar.gz` | Tarball with gzip compression | +| `tar.xz` | Tarball with lzma2 compression | +| `tar.zma` | Tarball with lzma compression | +| `tbz` | Tarball with bzip compression | +| `tbz2` | Tarball with bzip2 compression | +| `tgz` | Tarball with gzip compression | +| `tlz` | Tarball with lzma compression | +| `txz` | Tarball with lzma2 compression | +| `war` | Web Application archive (Java-based) | +| `xpi` | Mozilla XPI module file | +| `xz` | LZMA2 archive | +| `zip` | Zip archive | + +See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for +more information regarding archive formats. diff --git a/oh-my-zsh/plugins/extract/_extract b/oh-my-zsh/plugins/extract/_extract @@ -0,0 +1,7 @@ +#compdef extract +#autoload + +_arguments \ + '(-r --remove)'{-r,--remove}'[Remove archive.]' \ + "*::archive file:_files -g '(#i)*.(7z|Z|apk|bz2|deb|gz|ipsw|jar|lzma|rar|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|xpi|xz|zip)(-.)'" \ + && return 0 diff --git a/oh-my-zsh/plugins/extract/extract.plugin.zsh b/oh-my-zsh/plugins/extract/extract.plugin.zsh @@ -0,0 +1,71 @@ +alias x=extract + +extract() { + local remove_archive + local success + local extract_dir + + if (( $# == 0 )); then + cat <<-'EOF' >&2 + Usage: extract [-option] [file ...] + + Options: + -r, --remove Remove archive after unpacking. + EOF + fi + + remove_archive=1 + if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then + remove_archive=0 + shift + fi + + while (( $# > 0 )); do + if [[ ! -f "$1" ]]; then + echo "extract: '$1' is not a valid file" >&2 + shift + continue + fi + + success=0 + extract_dir="${1:t:r}" + case "$1" in + (*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$1" | tar xv } || tar zxvf "$1" ;; + (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; + (*.tar.xz|*.txz) + tar --xz --help &> /dev/null \ + && tar --xz -xvf "$1" \ + || xzcat "$1" | tar xvf - ;; + (*.tar.zma|*.tlz) + tar --lzma --help &> /dev/null \ + && tar --lzma -xvf "$1" \ + || lzcat "$1" | tar xvf - ;; + (*.tar) tar xvf "$1" ;; + (*.gz) (( $+commands[pigz] )) && pigz -d "$1" || gunzip "$1" ;; + (*.bz2) bunzip2 "$1" ;; + (*.xz) unxz "$1" ;; + (*.lzma) unlzma "$1" ;; + (*.Z) uncompress "$1" ;; + (*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk) unzip "$1" -d $extract_dir ;; + (*.rar) unrar x -ad "$1" ;; + (*.7z) 7za x "$1" ;; + (*.deb) + mkdir -p "$extract_dir/control" + mkdir -p "$extract_dir/data" + cd "$extract_dir"; ar vx "../${1}" > /dev/null + cd control; tar xzvf ../control.tar.gz + cd ../data; extract ../data.tar.* + cd ..; rm *.tar.* debian-binary + cd .. + ;; + (*) + echo "extract: '$1' cannot be extracted" >&2 + success=1 + ;; + esac + + (( success = $success > 0 ? $success : $? )) + (( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1" + shift + done +} diff --git a/oh-my-zsh/plugins/fabric/_fab b/oh-my-zsh/plugins/fabric/_fab @@ -0,0 +1,60 @@ +#compdef fab +#autoload + +local curcontext=$curcontext state line +declare -A opt_args + +declare target_list +target_list=(`fab --shortlist 2>/dev/null`) + +_targets() { + _describe -t commands "fabric targets" target_list +} + +output_levels=( + 'status: Status messages, i.e. noting when Fabric is done running, if the user used a keyboard interrupt, or when servers are disconnected from. These messages are almost always relevant and rarely verbose.' + 'aborts: Abort messages. Like status messages, these should really only be turned off when using Fabric as a library, and possibly not even then. Note that even if this output group is turned off, aborts will still occur – there just won’t be any output about why Fabric aborted!' + 'warnings: Warning messages. These are often turned off when one expects a given operation to fail, such as when using grep to test existence of text in a file. If paired with setting env.warn_only to True, this can result in fully silent warnings when remote programs fail. As with aborts, this setting does not control actual warning behavior, only whether warning messages are printed or hidden.' + 'running: Printouts of commands being executed or files transferred, e.g. [myserver] run: ls /var/www. Also controls printing of tasks being run, e.g. [myserver] Executing task ''foo''.' + 'stdout: Local, or remote, stdout, i.e. non-error output from commands.' + 'stderr: Local, or remote, stderr, i.e. error-related output from commands.' + 'user: User-generated output, i.e. local output printed by fabfile code via use of the fastprint or puts functions.' +) + +_arguments -w -S -C \ + '(-)'{-h,--help}'[show this help message and exit]: :->noargs' \ + '(-)'{-V,--version}'[show program''s version number and exit]: :->noargs' \ + '(-)--list[print list of possible commands and exit]: :->noargs' \ + '(-)--shortlist[print non-verbose list of possible commands and exit]: :->noargs' \ + '(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \ + '(--no-pty)--no-pty[do not use pseudo-terminal in run/sudo]' \ + "(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_targets" \ + '(-D --disable-known-hosts)'{-D,--disable-known-hosts}'[do not load user known_hosts file]' \ + '(-r --reject-unknown-hosts)'{-r,--reject-unknown-hosts}'[reject unknown hosts]' \ + '(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \ + '(-p+ --password=-)'{-p+,--password=-}'[password for use with authentication and/or sudo]: :' \ + '(-H+ --hosts=-)'{-H+,--hosts=-}'[comma separated list of hosts to operate on]: :' \ + '(-R+ --roles=-)'{-R+,--roles=-}'[comma separated list of roles to operate on]: :' \ + '(-a --no-agent)'{-a,--no-agent}'[don''t use the running SSH agent]' \ + '(-k --no-keys)'{-k,--no-keys}'[don''t load private key files from ~/.ssh/]' \ + '(-w --warn-only)'{-w,--warn-only}'[warn instead of abort, when commands fail]' \ + '-i+[path to SSH private key file. May be repeated]: :_files' \ + "(-f+ --fabfile=)"{-f+,--fabfile=}"[Python module file to import]: :_files -g *.py" \ + '(-c+ --config=-)'{-c+,--config=-}'[specify location of config file to use]: :_files' \ + '(-s+ --shell=-)'{-s+,--shell=-}'[specify a new shell, defaults to ''/bin/bash -l -c'']: :' \ + '(--hide=-)--hide=-[comma-separated list of output levels to hide]: :->levels' \ + '(--show=-)--show=-[comma-separated list of output levels to show]: :->levels' \ + '*::: :->subcmds' && return 0 + +if [[ CURRENT -ge 1 ]]; then + case $state in + noargs) + _message "nothing to complete";; + levels) + _describe -t commands "output levels" output_levels;; + *) + _targets;; + esac + + return +fi diff --git a/oh-my-zsh/plugins/fabric/fabric.plugin.zsh b/oh-my-zsh/plugins/fabric/fabric.plugin.zsh @@ -0,0 +1 @@ +# DECLARION: This plugin was created by vhbit. What I did is just making a portal from https://github.com/vhbit/fabric-zsh-autocomplete. diff --git a/oh-my-zsh/plugins/fancy-ctrl-z/README.md b/oh-my-zsh/plugins/fancy-ctrl-z/README.md @@ -0,0 +1,14 @@ +# Use Ctrl-Z to switch back to Vim + +I frequently need to execute random command in my shell. To achieve it I pause +Vim by pressing Ctrl-z, type command and press fg<Enter> to switch back to Vim. +The fg part really hurt sme. I just wanted to hit Ctrl-z once again to get back +to Vim. I could not find a solution, so I developed one on my own that +works wonderfully with ZSH + +Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/ + +Credits: +- original idea by @sheerun +- added to OMZ by @mbologna + diff --git a/oh-my-zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh b/oh-my-zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh @@ -0,0 +1,12 @@ +fancy-ctrl-z () { + if [[ $#BUFFER -eq 0 ]]; then + BUFFER="fg" + zle accept-line + else + zle push-input + zle clear-screen + fi +} +zle -N fancy-ctrl-z +bindkey '^Z' fancy-ctrl-z + diff --git a/oh-my-zsh/plugins/fasd/fasd.plugin.zsh b/oh-my-zsh/plugins/fasd/fasd.plugin.zsh @@ -0,0 +1,11 @@ +if [ $commands[fasd] ]; then # check if fasd is installed + fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache" + if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then + fasd --init auto >| "$fasd_cache" + fi + source "$fasd_cache" + unset fasd_cache + + alias v="f -e $EDITOR" + alias o='a -e open_command' +fi diff --git a/oh-my-zsh/plugins/fastfile/fastfile.plugin.zsh b/oh-my-zsh/plugins/fastfile/fastfile.plugin.zsh @@ -0,0 +1,138 @@ +################################################################################ +# FILE: fastfile.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Michael Varner (musikmichael@web.de) +# VERSION: 1.0.0 +# +# This plugin adds the ability to on the fly generate and access file shortcuts. +# +################################################################################ + +########################### +# Settings + +# These can be overwritten any time. +# If they are not set yet, they will be +# overwritten with their default values + +default fastfile_dir "${HOME}/.fastfile/" +default fastfile_var_prefix "§" + +########################### +# Impl + +# +# Generate a shortcut +# +# Arguments: +# 1. name - The name of the shortcut (default: name of the file) +# 2. file - The file or directory to make the shortcut for +# STDOUT: +# => fastfle_print +# +function fastfile() { + test "$2" || 2="." + file=$(readlink -f "$2") + + test "$1" || 1="$(basename "$file")" + name=$(echo "$1" | tr " " "_") + + + mkdir -p "${fastfile_dir}" + echo "$file" > "$(fastfile_resolv "$name")" + + fastfile_sync + fastfile_print "$name" +} + +# +# Resolve the location of a shortcut file (the database file, where the value is written!) +# +# Arguments: +# 1. name - The name of the shortcut +# STDOUT: +# The path +# +function fastfile_resolv() { + echo "${fastfile_dir}${1}" +} + +# +# Get the real path of a shortcut +# +# Arguments: +# 1. name - The name of the shortcut +# STDOUT: +# The path +# +function fastfile_get() { + cat "$(fastfile_resolv "$1")" +} + +# +# Print a shortcut +# +# Arguments: +# 1. name - The name of the shortcut +# STDOUT: +# Name and value of the shortcut +# +function fastfile_print() { + echo "${fastfile_var_prefix}${1} -> $(fastfile_get "$1")" +} + +# +# List all shortcuts +# +# STDOUT: +# (=> fastfle_print) for each shortcut +# +function fastfile_ls() { + for f in "${fastfile_dir}"/*; do + file=`basename "$f"` # To enable simpler handeling of spaces in file names + varkey=`echo "$file" | tr " " "_"` + + # Special format for colums + echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")" + done | column -t -s "|" +} + +# +# Remove a shortcut +# +# Arguments: +# 1. name - The name of the shortcut (default: name of the file) +# 2. file - The file or directory to make the shortcut for +# STDOUT: +# => fastfle_print +# +function fastfile_rm() { + fastfile_print "$1" + rm "$(fastfile_resolv "$1")" +} + +# +# Generate the aliases for the shortcuts +# +function fastfile_sync() { + for f in "${fastfile_dir}"/*; do + file=`basename "$f"` # To enable simpler handeling of spaces in file names + varkey=`echo "$file" | tr " " "_"` + + alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'" + done +} + +################################## +# Shortcuts + +alias ff=fastfile +alias ffp=fastfile_print +alias ffrm=fastfile_rm +alias ffls=fastfile_ls +alias ffsync=fastfile_sync + +################################## +# Init + +fastfile_sync+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/fbterm/fbterm.plugin.zsh b/oh-my-zsh/plugins/fbterm/fbterm.plugin.zsh @@ -0,0 +1,7 @@ +# start fbterm automatically in /dev/tty* + +if (( ${+commands[fbterm]} )); then + if [[ "$TTY" = /dev/tty* ]] ; then + fbterm && exit + fi +fi diff --git a/oh-my-zsh/plugins/fedora/README.md b/oh-my-zsh/plugins/fedora/README.md @@ -0,0 +1,3 @@ +This is a plugin based on yum plugin, but using dnf as main frontend +(from Fedora 22 onwards, yum is deprecated in favor of dnf). + diff --git a/oh-my-zsh/plugins/fedora/fedora.plugin.zsh b/oh-my-zsh/plugins/fedora/fedora.plugin.zsh @@ -0,0 +1,16 @@ +## Aliases + +alias dnfs="dnf search" # search package +alias dnfp="dnf info" # show package info +alias dnfl="dnf list" # list packages +alias dnfgl="dnf grouplist" # list package groups +alias dnfli="dnf list installed" # print all installed packages +alias dnfmc="dnf makecache" # rebuilds the dnf package list + +alias dnfu="sudo dnf upgrade" # upgrade packages +alias dnfi="sudo dnf install" # install package +alias dnfgi="sudo dnf groupinstall" # install package group +alias dnfr="sudo dnf remove" # remove package +alias dnfgr="sudo dnf groupremove" # remove pagage group +alias dnfrl="sudo dnf remove --remove-leaves" # remove package and leaves +alias dnfc="sudo dnf clean all" # clean cache diff --git a/oh-my-zsh/plugins/firewalld/firewalld.plugin.zsh b/oh-my-zsh/plugins/firewalld/firewalld.plugin.zsh @@ -0,0 +1,17 @@ +alias fw="sudo firewall-cmd" +alias fwp="sudo firewall-cmd --permanent" +alias fwr="sudo firewall-cmd --reload" +alias fwrp="sudo firewall-cmd --runtime-to-permanent" + +function fwl () { + # converts output to zsh array () + # @f flag split on new line + zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v interfaces)}") + + for i in $zones; do + sudo firewall-cmd --zone $i --list-all + done + + echo 'Direct Rules:' + sudo firewall-cmd --direct --get-all-rules +} diff --git a/oh-my-zsh/plugins/firewalld/readme.md b/oh-my-zsh/plugins/firewalld/readme.md @@ -0,0 +1,22 @@ +# FirewallD Plugin + +This plugin adds some aliases and functions for FirewallD using the `firewalld-cmd` command. To use it, add firewalld to your plugins array. + +```zsh +plugins=(... firewalld) +``` + +## Aliases + +| Alias | Command | Description | +| :---- | :----------------------------------------- | :--------------------------- | +| fw | `sudo firewall-cmd` | Shorthand | +| fwr | `sudo firewall-cmd --reload` | Reload current configuration | +| fwp | `sudo firewall-cmd --permanent` | Create permanent rule | +| fwrp | `sudo firewall-cmd --runtime-to-permanent` | Save current configuration | + +## Functions + +| Function | Description | +| :------- | :--------------------------------------------------------- | +| fwl | Lists configuration from all active zones and direct rules | diff --git a/oh-my-zsh/plugins/forklift/README.md b/oh-my-zsh/plugins/forklift/README.md @@ -0,0 +1,15 @@ +## forklift + +Plugin for ForkLift, an FTP application for OS X. + +### Requirements + +* [ForkLift](http://www.binarynights.com/forklift/) + +### Usage + +<code>fl [*file_or_folder*]</code> + +* If `fl` is called without arguments then the current folder is opened in ForkLift. This is equivalent to `fl .`. + +* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift. If called with a non-directory file as the argument, then the file's parent directory is opened. diff --git a/oh-my-zsh/plugins/forklift/forklift.plugin.zsh b/oh-my-zsh/plugins/forklift/forklift.plugin.zsh @@ -0,0 +1,69 @@ +# Open folder in ForkLift.app or ForkLift2.app from console +# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de +# Updated to support ForkLift2 by Johan Kaving +# +# Usage: +# fl [<folder>] +# +# Opens specified directory or current working directory in ForkLift.app +# +# Notes: +# It assumes Shift+Cmd+G launches go to folder panel and Cmd+N opens new +# app window. +# +# https://gist.github.com/3313481 +function fl { + if [ ! -z "$1" ]; then + DIR=$1 + if [ ! -d "$DIR" ]; then + DIR=$(dirname $DIR) + fi + if [ "$DIR" != "." ]; then + PWD=`cd "$DIR";pwd` + fi + fi + osascript 2>&1 1>/dev/null <<END + + try + tell application "Finder" + set appName to name of application file id "com.binarynights.ForkLift2" + end tell + on error err_msg number err_num + tell application "Finder" + set appName to name of application file id "com.binarynights.ForkLift" + end tell + end try + + if application appName is running + tell application appName + activate + end tell + else + tell application appName + activate + end tell + repeat until application appName is running + delay 1 + end repeat + tell application appName + activate + end tell + end if + + tell application "System Events" + tell application process "ForkLift" + try + set topWindow to window 1 + on error + keystroke "n" using command down + set topWindow to window 1 + end try + keystroke "g" using {command down, shift down} + tell sheet 1 of topWindow + set value of text field 1 to "$PWD" + keystroke return + end tell + end tell + end tell +END +} diff --git a/oh-my-zsh/plugins/fossil/README.md b/oh-my-zsh/plugins/fossil/README.md @@ -0,0 +1,7 @@ +## Fossil Plugin + +This plugin adds completion support and prompt for fossil repositories. +The prompt will display the current branch and status been dirty or clean. + +### CONTRIBUTOR + - Jefferson González ([jgmdev](https://github.com/jgmdev)) diff --git a/oh-my-zsh/plugins/fossil/fossil.plugin.zsh b/oh-my-zsh/plugins/fossil/fossil.plugin.zsh @@ -0,0 +1,89 @@ +_FOSSIL_PROMPT="" + +# Prefix at the very beginning of the prompt, before the branch name +ZSH_THEME_FOSSIL_PROMPT_PREFIX="%{$fg_bold[blue]%}fossil:(%{$fg_bold[red]%}" + +# At the very end of the prompt +ZSH_THEME_FOSSIL_PROMPT_SUFFIX="%{$fg_bold[blue]%})" + +# Text to display if the branch is dirty +ZSH_THEME_FOSSIL_PROMPT_DIRTY=" %{$fg_bold[red]%}✖" + +# Text to display if the branch is clean +ZSH_THEME_FOSSIL_PROMPT_CLEAN=" %{$fg_bold[green]%}✔" + +function fossil_prompt_info () { + local _OUTPUT=`fossil branch 2>&1` + local _STATUS=`echo $_OUTPUT | grep "use --repo"` + if [ "$_STATUS" = "" ]; then + local _EDITED=`fossil changes` + local _EDITED_SYM="$ZSH_THEME_FOSSIL_PROMPT_CLEAN" + local _BRANCH=`echo $_OUTPUT | grep "* " | sed 's/* //g'` + + if [ "$_EDITED" != "" ]; then + _EDITED_SYM="$ZSH_THEME_FOSSIL_PROMPT_DIRTY" + fi + + echo "$ZSH_THEME_FOSSIL_PROMPT_PREFIX" \ + "$_BRANCH" \ + "$ZSH_THEME_FOSSIL_PROMPT_SUFFIX" \ + "$_EDITED_SYM"\ + "%{$reset_color%}" + fi +} + +function _fossil_get_command_list () { + fossil help -a | grep -v "Usage|Common|This is" +} + +function _fossil () { + local context state state_descr line + typeset -A opt_args + + _arguments \ + '1: :->command'\ + '2: :->subcommand' + + case $state in + command) + local _OUTPUT=`fossil branch 2>&1 | grep "use --repo"` + if [ "$_OUTPUT" = "" ]; then + compadd `_fossil_get_command_list` + else + compadd clone init import help version + fi + ;; + subcommand) + if [ "$words[2]" = "help" ]; then + compadd `_fossil_get_command_list` + else + compcall -D + fi + ;; + esac +} + +function _fossil_prompt () { + local current=`echo $PROMPT $RPROMPT | grep fossil` + + if [ "$_FOSSIL_PROMPT" = "" -o "$current" = "" ]; then + local _prompt=${PROMPT} + local _rprompt=${RPROMPT} + + local is_prompt=`echo $PROMPT | grep git` + + if [ "$is_prompt" = "" ]; then + export RPROMPT="$_rprompt"'$(fossil_prompt_info)' + else + export PROMPT="$_prompt"'$(fossil_prompt_info) ' + fi + + _FOSSIL_PROMPT="1" + fi +} + +compdef _fossil fossil + +autoload -U add-zsh-hook + +add-zsh-hook precmd _fossil_prompt diff --git a/oh-my-zsh/plugins/frontend-search/README.md b/oh-my-zsh/plugins/frontend-search/README.md @@ -0,0 +1,65 @@ +## Introduction ## + +> Searches for your frontend web development made easier + + +## Installation ## + +Open your `~/.zshrc` file and enable the `frontend-search` plugin: + +```zsh + +plugins=( ... frontend-search) + +``` + + +## Usage ## + +You can use the frontend-search plugin in these two forms: + +* `frontend <context> <term> [more terms if you want]` +* `<context> <term> [more terms if you want]` + +For example, these two are equivalent: + +```zsh +$ frontend angularjs dependency injection +$ angularjs dependency injection +``` + +Available search contexts are: + +| context | URL | +|---------------|--------------------------------------------------------------------------| +| angularjs | `https://google.com/search?as_sitesearch=angularjs.org&as_q=` | +| aurajs | `http://aurajs.com/api/#stq=` | +| bem | `https://google.com/search?as_sitesearch=bem.info&as_q=` | +| bootsnipp | `http://bootsnipp.com/search?q=` | +| caniuse | `http://caniuse.com/#search=` | +| codepen | `http://codepen.io/search?q=` | +| compassdoc | `http://compass-style.org/search?q=` | +| cssflow | `http://www.cssflow.com/search?q=` | +| dartlang | `https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:` | +| emberjs | `http://emberjs.com/api/#stp=1&stq=` | +| fontello | `http://fontello.com/#search=` | +| html5please | `http://html5please.com/#` | +| jquery | `https://api.jquery.com/?s=` | +| lodash | `https://devdocs.io/lodash/index#` | +| mdn | `https://developer.mozilla.org/search?q=` | +| npmjs | `https://www.npmjs.com/search?q=` | +| qunit | `https://api.qunitjs.com/?s=` | +| reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` | +| smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` | +| stackoverflow | `http://stackoverflow.com/search?q=` | +| unheap | `http://www.unheap.com/?s=` | + +If you want to have another context, open an Issue and tell us! + + +## Author + +**Wilson Mendes (willmendesneto)** ++ <https://plus.google.com/+WilsonMendes> ++ <https://twitter.com/willmendesneto> ++ <http://github.com/willmendesneto> diff --git a/oh-my-zsh/plugins/frontend-search/_frontend-search.sh b/oh-my-zsh/plugins/frontend-search/_frontend-search.sh @@ -0,0 +1,132 @@ +#compdef frontend + +zstyle ':completion:*:descriptions' format '%B%d%b' +zstyle ':completion::complete:frontend:*:commands' group-name commands +zstyle ':completion::complete:frontend:*:frontend_points' group-name frontend_points +zstyle ':completion::complete:frontend::' list-grouped + +zmodload zsh/mapfile + +function _frontend() { + local CONFIG=$HOME/.frontend-search + local ret=1 + + local -a commands + local -a frontend_points + + frontend_points=( "${(f)mapfile[$CONFIG]//$HOME/~}" ) + + commands=( + 'jquery: Search in jQuery website' + 'mdn: Search in MDN website' + 'compassdoc: Search in COMPASS website' + 'html5please: Search in HTML5 Please website' + 'caniuse: Search in Can I Use website' + 'aurajs: Search in AuraJs website' + 'dartlang: Search in Dart website' + 'lodash: Search in Lo-Dash website' + 'qunit: Search in Qunit website' + 'fontello: Search in fontello website' + 'bootsnipp: Search in bootsnipp website' + 'cssflow: Search in cssflow website' + 'codepen: Search in codepen website' + 'unheap: Search in unheap website' + 'bem: Search in BEM website' + 'smacss: Search in SMACSS website' + 'angularjs: Search in Angular website' + 'reactjs: Search in React website' + 'emberjs: Search in Ember website' + 'stackoverflow: Search in StackOverflow website' + 'npmjs: Search in NPMJS website' + ) + + _arguments -C \ + '1: :->first_arg' \ + '2: :->second_arg' && ret=0 + + case $state in + first_arg) + _describe -t frontend_points "Warp points" frontend_points && ret=0 + _describe -t commands "Commands" commands && ret=0 + ;; + second_arg) + case $words[2] in + jquery) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + mdn) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + compassdoc) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + html5please) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + caniuse) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + aurajs) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + dartlang) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + lodash) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + qunit) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + fontello) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + bootsnipp) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + cssflow) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + codepen) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + unheap) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + bem) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + smacss) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + angularjs) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + reactjs) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + emberjs) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + stackoverflow) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + npmjs) + _describe -t points "Warp points" frontend_points && ret=0 + ;; + esac + ;; + esac + + return $ret +} + +_frontend "$@" + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et diff --git a/oh-my-zsh/plugins/frontend-search/frontend-search.plugin.zsh b/oh-my-zsh/plugins/frontend-search/frontend-search.plugin.zsh @@ -0,0 +1,91 @@ +alias angularjs='frontend angularjs' +alias aurajs='frontend aurajs' +alias bem='frontend bem' +alias bootsnipp='frontend bootsnipp' +alias caniuse='frontend caniuse' +alias codepen='frontend codepen' +alias compassdoc='frontend compassdoc' +alias cssflow='frontend cssflow' +alias dartlang='frontend dartlang' +alias emberjs='frontend emberjs' +alias fontello='frontend fontello' +alias html5please='frontend html5please' +alias jquery='frontend jquery' +alias lodash='frontend lodash' +alias mdn='frontend mdn' +alias npmjs='frontend npmjs' +alias qunit='frontend qunit' +alias reactjs='frontend reactjs' +alias smacss='frontend smacss' +alias stackoverflow='frontend stackoverflow' +alias unheap='frontend unheap' + +function frontend() { + emulate -L zsh + + # define search context URLS + typeset -A urls + urls=( + angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q=' + aurajs 'http://aurajs.com/api/#stq=' + bem 'https://google.com/search?as_sitesearch=bem.info&as_q=' + bootsnipp 'http://bootsnipp.com/search?q=' + caniuse 'http://caniuse.com/#search=' + codepen 'http://codepen.io/search?q=' + compassdoc 'http://compass-style.org/search?q=' + cssflow 'http://www.cssflow.com/search?q=' + dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:' + emberjs 'http://emberjs.com/api/#stp=1&stq=' + fontello 'http://fontello.com/#search=' + html5please 'http://html5please.com/#' + jquery 'https://api.jquery.com/?s=' + lodash 'https://devdocs.io/lodash/index#' + mdn 'https://developer.mozilla.org/search?q=' + npmjs 'https://www.npmjs.com/search?q=' + qunit 'https://api.qunitjs.com/?s=' + reactjs 'https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=' + smacss 'https://google.com/search?as_sitesearch=smacss.com&as_q=' + stackoverflow 'http://stackoverflow.com/search?q=' + unheap 'http://www.unheap.com/?s=' + ) + + # show help for command list + if [[ $# -lt 2 ]] + then + print -P "Usage: frontend %Ucontext%u %Uterm%u [...%Umore%u] (or just: %Ucontext%u %Uterm%u [...%Umore%u])" + print -P "" + print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website," + print -P "and %Ucontext%u is one of the following:" + print -P "" + print -P " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow," + print -P " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs," + print -P " qunit, reactjs, smacss, stackoverflow, unheap" + print -P "" + print -P "For example: frontend npmjs mocha (or just: npmjs mocha)." + print -P "" + return 1 + fi + + # check whether the search context is supported + if [[ -z "$urls[$1]" ]] + then + echo "Search context \"$1\" currently not supported." + echo "" + echo "Valid contexts are:" + echo "" + echo " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, " + echo " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs, " + echo " qunit, reactjs, smacss, stackoverflow, unheap" + echo "" + return 1 + fi + + # build search url: + # join arguments passed with '+', then append to search context URL + # TODO substitute for proper urlencode method + url="${urls[$1]}${(j:+:)@[2,-1]}" + + echo "Opening $url ..." + + open_command "$url" +} diff --git a/oh-my-zsh/plugins/gas/_gas b/oh-my-zsh/plugins/gas/_gas @@ -0,0 +1,39 @@ +#compdef gas + +local curcontext="$curcontext" state line cmds ret=1 + +_arguments -C \ + '(- 1 *)'{-v,--version}'[display version information]' \ + '(-h|--help)'{-h,--help}'[show help information]' \ + '1: :->cmds' \ + '*: :->args' && ret=0 + +case $state in + cmds) + cmds=( + "version:Prints Gas's version" + "use:Uses author" + "ssh:Creates a new ssh key for an existing gas author" + "show:Shows your current user" + "list:Lists your authors" + "import:Imports current user to gasconfig" + "help:Describe available tasks or one specific task" + "delete:Deletes author" + "add:Adds author to gasconfig" + ) + _describe -t commands 'gas command' cmds && ret=0 + ;; + args) + case $line[1] in + (use|delete) + VERSION=$(gas -v) + if [[ $VERSION == <1->.*.* ]] || [[ $VERSION == 0.<2->.* ]] || [[ $VERSION == 0.1.<6-> ]] then + _values -S , 'authors' $(cat ~/.gas/gas.authors | sed -n -e 's/^.*\[\(.*\)\]/\1/p') && ret=0 + else + _values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0 + fi + esac + ;; +esac + +return ret diff --git a/oh-my-zsh/plugins/gb/README.md b/oh-my-zsh/plugins/gb/README.md @@ -0,0 +1,21 @@ +# `gb` plugin + +> A project based build tool for the Go programming language. + +See https://getgb.io for the full `gb` documentation + +* * * * + +- Adds completion support for all `gb` commands. +- Also supports completion for the [`gb-vendor` plugin](https://godoc.org/github.com/constabulary/gb/cmd/gb-vendor). + +To use it, add `gb` to your plugins array: +```sh +plugins=(... gb) +``` + +## Caveats + +The `git` plugin defines an alias `gb` that usually conflicts with the `gb` program. +If you're having trouble with it, remove it by adding `unalias gb` at the end of your +zshrc file. diff --git a/oh-my-zsh/plugins/gb/_gb b/oh-my-zsh/plugins/gb/_gb @@ -0,0 +1,111 @@ +#compdef gb +#autoload + +_gb () { + local ret=1 state + _arguments -C ':command:->command' '*::options:->options' && ret=0 + + case $state in + (command) + local -a subcommands + subcommands=( + "build:build a package" + "doc:show documentation for a package or symbol" + "env:print project environment variables" + "generate:generate Go files by processing source" + "help:displays the help" + "info:info returns information about this project" + "list:list the packages named by the importpaths" + "test:test packages" + "vendor:manage your vendored dependencies" + ) + _describe -t subcommands 'gb subcommands' subcommands && ret=0 + ;; + (options) + case $line[1] in + (build) + _arguments \ + -f'[ignore cached packages]' \ + -F'[do not cache packages]' \ + -q'[decreases verbosity]' \ + -P'[the number of build jobs to run in parallel]' \ + -R'[sets the base of the project root search path]' \ + -dotfile'[output a dot formatted file of the build steps]' \ + -ldflags'["flag list" arguments to pass to the linker]' \ + -gcflags'["arg list" arguments to pass to the compiler]' \ + -race'[enable data race detection]' \ + -tags'["tag list" additional build tags]' + ;; + (list) + _arguments \ + -f'[alternate format for the list, using the syntax of package template]' \ + -s'[read format template from STDIN]' \ + -json'[prints output in structured JSON format]' + ;; + (test) + _arguments \ + -v'[print output from test subprocess]' \ + -ldflags'["flag list" arguments to pass to the linker]' \ + -gcflags'["arg list" arguments to pass to the compiler]' \ + -race'[enable data race detection]' \ + -tags'["tag list" additional build tags]' + ;; + (vendor) + _gb-vendor + esac + ;; + esac + + return ret +} + +_gb-vendor () { + local curcontext="$curcontext" state line + _arguments -C ':command:->command' '*::options:->options' + + case $state in + (command) + local -a subcommands + subcommands=( + 'delete:deletes a local dependency' + 'fetch:fetch a remote dependency' + 'list:lists dependencies, one per line' + 'purge:remove all unreferenced dependencies' + 'restore:restore dependencies from the manifest' + 'update:update a local dependency' + ) + _describe -t subcommands 'gb vendor subcommands' subcommands && ret=0 + ;; + (options) + case $line[1] in + (delete) + _arguments \ + -all'[remove all dependencies]' + ;; + (fetch) + _arguments \ + -branch'[fetch from a particular branch]' \ + -no-recurse'[do not fetch recursively]' \ + -tag'[fetch the specified tag]' \ + -revision'[fetch the specific revision from the branch (if supplied)]' \ + -precaire'[allow the use of insecure protocols]' \ + ;; + (list) + _arguments \ + -f'[controls the template used for printing each manifest entry]' + ;; + (restore) + _arguments \ + -precaire'[allow the use of insecure protocols]' + ;; + (update) + _arguments \ + -all'[update all dependencies in the manifest or supply a given dependency]' \ + -precaire'[allow the use of insecure protocols]' + ;; + esac + ;; + esac +} + +_gb diff --git a/oh-my-zsh/plugins/geeknote/README.md b/oh-my-zsh/plugins/geeknote/README.md @@ -0,0 +1,12 @@ +## ZSH-Geeknote + +[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for [oh-my-zsh framework](http://github.com/robbyrussell/oh-my-zsh). + +Plugins provides: + +- auto completion of commands and their options +- alias `gn` + +You can find information how to install Geeknote and it's available commands on the [project website](http://www.geeknote.me/). + +Maintainer : Ján Koščo ([@s7anley](https://twitter.com/s7anley)) diff --git a/oh-my-zsh/plugins/geeknote/_geeknote b/oh-my-zsh/plugins/geeknote/_geeknote @@ -0,0 +1,136 @@ +#compdef geeknote +# --------------- ------------------------------------------------------------ +# Name : _geeknote +# Synopsis : zsh completion for geeknote +# Author : Ján Koščo <3k.stanley@gmail.com> +# HomePage : http://www.geeknote.me +# Version : 0.1 +# Tag : [ shell, zsh, completion, evernote ] +# Copyright : © 2014 by Ján Koščo, +# Released under current GPL license. +# --------------- ------------------------------------------------------------ + +local -a _1st_arguments +_1st_arguments=( + 'login' + 'logout' + 'settings' + 'create' + 'edit' + 'find' + 'show' + 'remove' + 'notebook-list' + 'notebook-create' + 'notebook-edit' + 'tag-list' + 'tag-create' + 'tag-edit' + 'tag-remove' + 'gnsync' + 'user' +) + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "geeknote command" _1st_arguments + return +fi + +local -a _command_args +case "$words[1]" in + user) + _command_args=( + '(--full)--full' \ + ) + ;; + logout) + _command_args=( + '(--force)--force' \ + ) + ;; + settings) + _command_args=( + '(--editor)--editor' \ + ) + ;; + create) + _command_args=( + '(-t|--title)'{-t,--title}'[note title]' \ + '(-c|--content)'{-c,--content}'[note content]' \ + '(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \ + '(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \ + ) + ;; + edit) + _command_args=( + '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \ + '(-t|--title)'{-t,--title}'[note title]' \ + '(-c|--content)'{-c,--content}'[note content]' \ + '(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \ + '(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \ + ) + ;; + remove) + _command_args=( + '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \ + '(--force)--force' \ + ) + ;; + show) + _command_args=( + '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \ + ) + ;; + find) + _command_args=( + '(-s|--search)'{-s,--search}'[text to search]' \ + '(-tg|--tags)'{-tg,--tags}'[notes with which tag/tags to search]' \ + '(-nb|--notebook)'{-nb,--notebook}'[in which notebook search the note]' \ + '(-d|--date)'{-d,--date}'[date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy]' \ + '(-cn|--count)'{-cn,--count}'[how many notes show in the result list]' \ + '(-uo|--url-only)'{-uo,--url-only}'[add direct url of each note in results to Evernote web-version]' \ + '(-ee|--exact-entry)'{-ee,--exact-entry}'[search for exact entry of the request]' \ + '(-cs|--content-search)'{-cs,--content-search}'[search by content, not by title]' \ + ) + ;; + notebook-create) + _command_args=( + '(-t|--title)'{-t,--title}'[notebook title]' \ + ) + ;; + notebook-edit) + _command_args=( + '(-nb|--notebook)'{-nb,--notebook}'[name of notebook to rename]' \ + '(-t|--title)'{-t,--title}'[new notebook title]' \ + ) + ;; + notebook-remove) + _command_args=( + '(-nb|--notebook)'{-nb,--notebook}'[name of notebook to remove]' \ + '(--force)--force' \ + ) + ;; + tag-create) + _command_args=( + '(-t|--title)'{-t,--title}'[title of tag]' \ + ) + ;; + tag-edit) + _command_args=( + '(-tgn|--tagname)'{-tgn,--tagname}'[tag to edit]' \ + '(-t|--title)'{-t,--title}'[new tag name]' \ + ) + ;; + tag-remove) + _command_args=( + '(-tgn|--tagname)'{-tgn,--tagname}'[tag to remove]' \ + '(--force)--force' \ + ) + ;; + esac + +_arguments \ + $_command_args \ + && return 0 diff --git a/oh-my-zsh/plugins/geeknote/geeknote.plugin.zsh b/oh-my-zsh/plugins/geeknote/geeknote.plugin.zsh @@ -0,0 +1,2 @@ +#Alias +alias gn='geeknote' diff --git a/oh-my-zsh/plugins/gem/_gem b/oh-my-zsh/plugins/gem/_gem @@ -0,0 +1,72 @@ +#compdef gem +#autoload + +# gem zsh completion, based on homebrew completion + +_gem_installed() { + installed_gems=(${(f)"$(gem list --local --no-versions)"}) +} + +local -a _1st_arguments + +_1st_arguments=( + 'build:Build a gem from a gemspec' + 'cert:Manage RubyGems certificates and signing settings' + 'check:Check a gem repository for added or missing files' + 'cleanup:Clean up old versions of installed gems in the local repository' + 'contents:Display the contents of the installed gems' + 'dependency:Show the dependencies of an installed gem' + 'environment:Display information about the RubyGems environment' + 'fetch:Download a gem and place it in the current directory' + 'generate_index:Generates the index files for a gem server directory' + 'help:Provide help on the `gem` command' + 'install:Install a gem into the local repository' + 'list:Display gems whose name starts with STRING' + 'lock:Generate a lockdown list of gems' + 'mirror:Mirror all gem files (requires rubygems-mirror)' + 'outdated:Display all gems that need updates' + 'owner:Manage gem owners on RubyGems.org.' + 'pristine:Restores installed gems to pristine condition from files located in the gem cache' + 'push:Push a gem up to RubyGems.org' + 'query:Query gem information in local or remote repositories' + 'rdoc:Generates RDoc for pre-installed gems' + 'search:Display all gems whose name contains STRING' + 'server:Documentation and gem repository HTTP server' + 'sources:Manage the sources and cache file RubyGems uses to search for gems' + 'specification:Display gem specification (in yaml)' + 'stale:List gems along with access times' + 'uninstall:Uninstall gems from the local repository' + 'unpack:Unpack an installed gem to the current directory' + 'update:Update installed gems to the latest version' + 'which:Find the location of a library file you can require' + 'yank:Remove a specific gem version release from RubyGems.org' +) + +local expl +local -a gems installed_gems + +_arguments \ + '(-v --version)'{-v,--version}'[show version]' \ + '(-h --help)'{-h,--help}'[show help]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "gem subcommand" _1st_arguments + return +fi + +case "$words[1]" in + build) + _files -g "*.gemspec" + ;; + install) + _files ;; + list) + if [[ "$state" == forms ]]; then + _gem_installed + _requested installed_gems expl 'installed gems' compadd -a installed_gems + fi ;; + uninstall|update) + _gem_installed + _wanted installed_gems expl 'installed gems' compadd -a installed_gems ;; +esac diff --git a/oh-my-zsh/plugins/gem/gem.plugin.zsh b/oh-my-zsh/plugins/gem/gem.plugin.zsh @@ -0,0 +1,7 @@ +alias gemb="gem build *.gemspec" +alias gemp="gem push *.gem" + +# gemy GEM 0.0.0 = gem yank GEM -v 0.0.0 +function gemy { + gem yank $1 -v $2 +}+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/git-extras/README.md b/oh-my-zsh/plugins/git-extras/README.md @@ -0,0 +1,11 @@ +# git-extras + +This plugin provides completion definitions for some of the commands defined by [git-extras](http://github.com/tj/git-extras). + +## Setup notes + +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. + +### OS X Homebrew Setup + +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. diff --git a/oh-my-zsh/plugins/git-extras/git-extras.plugin.zsh b/oh-my-zsh/plugins/git-extras/git-extras.plugin.zsh @@ -0,0 +1,335 @@ +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for git-extras (http://github.com/tj/git-extras). +# +# This depends on and reuses some of the internals of the _git completion +# function that ships with zsh itself. It will not work with the _git that ships +# with git. +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Alexis GRIMALDI (https://github.com/agrimaldi) +# * spacewander (https://github.com/spacewander) +# +# ------------------------------------------------------------------------------ +# Inspirations +# ----------- +# +# * git-extras (http://github.com/tj/git-extras) +# * git-flow-completion (http://github.com/bobthecow/git-flow-completion) +# +# ------------------------------------------------------------------------------ + + +# Internal functions +# These are a lot like their __git_* equivalents inside _git + +__gitex_command_successful () { + if (( ${#*:#0} > 0 )); then + _message 'not a git repository' + return 1 + fi + return 0 +} + +__gitex_commits() { + declare -A commits + git log --oneline -15 | sed 's/\([[:alnum:]]\{7\}\) /\1:/' | while read commit + do + hash=$(echo $commit | cut -d':' -f1) + commits[$hash]="$commit" + done + local ret=1 + _describe -t commits commit commits && ret=0 +} + +__gitex_tag_names() { + local expl + declare -a tag_names + tag_names=(${${(f)"$(_call_program tags git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/}) + __git_command_successful || return + _wanted tag-names expl tag-name compadd $* - $tag_names +} + + +__gitex_branch_names() { + local expl + declare -a branch_names + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) + __git_command_successful || return + _wanted branch-names expl branch-name compadd $* - $branch_names +} + +__gitex_specific_branch_names() { + local expl + declare -a branch_names + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/}) + __git_command_successful || return + _wanted branch-names expl branch-name compadd $* - $branch_names +} + +__gitex_feature_branch_names() { + __gitex_specific_branch_names 'feature' +} + +__gitex_refactor_branch_names() { + __gitex_specific_branch_names 'refactor' +} + +__gitex_bug_branch_names() { + __gitex_specific_branch_names 'bug' +} + +__gitex_submodule_names() { + local expl + declare -a submodule_names + submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"}) # ' + __git_command_successful || return + _wanted submodule-names expl submodule-name compadd $* - $submodule_names +} + + +__gitex_author_names() { + local expl + declare -a author_names + author_names=(${(f)"$(_call_program branchrefs git log --format='%aN' | sort -u)"}) + __git_command_successful || return + _wanted author-names expl author-name compadd $* - $author_names +} + +# subcommands + +_git-bug() { + local curcontext=$curcontext state line ret=1 + declare -A opt_args + + _arguments -C \ + ': :->command' \ + '*:: :->option-or-argument' && ret=0 + + case $state in + (command) + declare -a commands + commands=( + 'finish:merge bug into the current branch' + ) + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + (finish) + _arguments -C \ + ':branch-name:__gitex_bug_branch_names' + ;; + esac + esac +} + + +_git-changelog() { + _arguments \ + '(-l --list)'{-l,--list}'[list commits]' \ +} + + + +_git-contrib() { + _arguments \ + ':author:__gitex_author_names' +} + + +_git-count() { + _arguments \ + '--all[detailed commit count]' +} + + +_git-delete-branch() { + _arguments \ + ':branch-name:__gitex_branch_names' +} + + +_git-delete-submodule() { + _arguments \ + ':submodule-name:__gitex_submodule_names' +} + + +_git-delete-tag() { + _arguments \ + ':tag-name:__gitex_tag_names' +} + + +_git-effort() { + _arguments \ + '--above[ignore file with less than x commits]' +} + + +_git-extras() { + local curcontext=$curcontext state line ret=1 + declare -A opt_args + + _arguments -C \ + ': :->command' \ + '*:: :->option-or-argument' && ret=0 + + case $state in + (command) + declare -a commands + commands=( + 'update:update git-extras' + ) + _describe -t commands command commands && ret=0 + ;; + esac + + _arguments \ + '(-v --version)'{-v,--version}'[show current version]' +} + + +_git-feature() { + local curcontext=$curcontext state line ret=1 + declare -A opt_args + + _arguments -C \ + ': :->command' \ + '*:: :->option-or-argument' && ret=0 + + case $state in + (command) + declare -a commands + commands=( + 'finish:merge feature into the current branch' + ) + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + (finish) + _arguments -C \ + ':branch-name:__gitex_feature_branch_names' + ;; + esac + esac +} + + +_git-graft() { + _arguments \ + ':src-branch-name:__gitex_branch_names' \ + ':dest-branch-name:__gitex_branch_names' +} + + +_git-ignore() { + _arguments -C \ + '(--local -l)'{--local,-l}'[show local gitignore]' \ + '(--global -g)'{--global,-g}'[show global gitignore]' +} + + +_git-missing() { + _arguments \ + ':first-branch-name:__gitex_branch_names' \ + ':second-branch-name:__gitex_branch_names' +} + + +_git-refactor() { + local curcontext=$curcontext state line ret=1 + declare -A opt_args + + _arguments -C \ + ': :->command' \ + '*:: :->option-or-argument' && ret=0 + + case $state in + (command) + declare -a commands + commands=( + 'finish:merge refactor into the current branch' + ) + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + (finish) + _arguments -C \ + ':branch-name:__gitex_refactor_branch_names' + ;; + esac + esac +} + + +_git-squash() { + _arguments \ + ':branch-name:__gitex_branch_names' +} + +_git-summary() { + _arguments '--line[summarize with lines rather than commits]' + __gitex_commits +} + + +_git-undo(){ + _arguments -C \ + '(--soft -s)'{--soft,-s}'[only rolls back the commit but changes remain un-staged]' \ + '(--hard -h)'{--hard,-h}'[wipes your commit(s)]' +} + +zstyle ':completion:*:*:git:*' user-commands \ + alias:'define, search and show aliases' \ + archive-file:'export the current HEAD of the git repository to a archive' \ + back:'undo and stage latest commits' \ + bug:'create a bug branch' \ + changelog:'populate changelog file with commits since the previous tag' \ + commits-since:'list commits since a given date' \ + contrib:'display author contributions' \ + count:'count commits' \ + create-branch:'create local and remote branch' \ + delete-branch:'delete local and remote branch' \ + delete-merged-branches:'delete merged branches'\ + delete-submodule:'delete submodule' \ + delete-tag:'delete local and remote tag' \ + effort:'display effort statistics' \ + extras:'git-extras' \ + feature:'create a feature branch' \ + fork:'fork a repo on github' \ + fresh-branch:'create empty local branch' \ + gh-pages:'create the GitHub Pages branch' \ + graft:'merge commits from source branch to destination branch' \ + ignore:'add patterns to .gitignore' \ + info:'show info about the repository' \ + local-commits:'list unpushed commits on the local branch' \ + lock:'lock a file excluded from version control' \ + locked:'ls files that have been locked' \ + missing:'show commits missing from another branch' \ + pr:'checks out a pull request locally' \ + rebase-patch:'rebases a patch' \ + refactor:'create a refactor branch' \ + release:'commit, tag and push changes to the repository' \ + rename-tag:'rename a tag' \ + repl:'read-eval-print-loop' \ + reset-file:'reset one file' \ + root:'show path of root' \ + setup:'setup a git repository' \ + show-tree:'show branch tree of commit history' \ + squash:'merge commits from source branch into the current one as a single commit' \ + summary:'repository summary' \ + touch:'one step creation of new files' \ + undo:'remove the latest commit' \ + unlock:'unlock a file excluded from version control' diff --git a/oh-my-zsh/plugins/git-flow-avh/git-flow-avh.plugin.zsh b/oh-my-zsh/plugins/git-flow-avh/git-flow-avh.plugin.zsh @@ -0,0 +1,419 @@ +#!zsh +# +# Installation +# ------------ +# +# To achieve git-flow completion nirvana: +# +# 0. Update your zsh's git-completion module to the newest verion. +# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD +# +# 1. Install this file. Either: +# +# a. Place it in your .zshrc: +# +# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.zsh) and put the following line in +# your .zshrc: +# +# source ~/.git-flow-completion.zsh +# +# c. Or, use this file as a oh-my-zsh plugin. +# + +_git-flow () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'init:Initialize a new git repo with support for the branching model.' + 'feature:Manage your feature branches.' + 'config:Manage your configuration.' + 'release:Manage your release branches.' + 'hotfix:Manage your hotfix branches.' + 'support:Manage your support branches.' + 'version:Shows version information.' + 'finish:Finish the branch you are currently on.' + 'delete:Delete the branch you are currently on.' + 'publish:Publish the branch you are currently on.' + ) + _describe -t commands 'git flow' subcommands + ;; + + (options) + case $line[1] in + + (init) + _arguments \ + -f'[Force setting of gitflow branches, even if already configured]' + ;; + + (version) + ;; + + (hotfix) + __git-flow-hotfix + ;; + + (release) + __git-flow-release + ;; + + (feature) + __git-flow-feature + ;; + (config) + __git-flow-config + ;; + + esac + ;; + esac +} + +__git-flow-release () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new release branch.' + 'finish:Finish a release branch.' + 'list:List all your release branches. (Alias to `git flow release`)' + 'publish:Publish release branch to remote.' + 'track:Checkout remote release branch.' + 'delete:Delete a release branch.' + ) + _describe -t commands 'git flow release' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':version:__git_flow_version_list' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + ':version:__git_flow_version_list' + ;; + + (delete) + _arguments \ + -f'[Force deletion]' \ + -r'[Delete remote branch]' \ + ':version:__git_flow_version_list' + ;; + + (publish) + _arguments \ + ':version:__git_flow_version_list' + ;; + + (track) + _arguments \ + ':version:__git_flow_version_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-flow-hotfix () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new hotfix branch.' + 'finish:Finish a hotfix branch.' + 'delete:Delete a hotfix branch.' + 'list:List all your hotfix branches. (Alias to `git flow hotfix`)' + ) + _describe -t commands 'git flow hotfix' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':hotfix:__git_flow_version_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + ':hotfix:__git_flow_hotfix_list' + ;; + + (delete) + _arguments \ + -f'[Force deletion]' \ + -r'[Delete remote branch]' \ + ':hotfix:__git_flow_hotfix_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-flow-feature () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new feature branch.' + 'finish:Finish a feature branch.' + 'delete:Delete a feature branch.' + 'list:List all your feature branches. (Alias to `git flow feature`)' + 'publish:Publish feature branch to remote.' + 'track:Checkout remote feature branch.' + 'diff:Show all changes.' + 'rebase:Rebase from integration branch.' + 'checkout:Checkout local feature branch.' + 'pull:Pull changes from remote.' + ) + _describe -t commands 'git flow feature' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':feature:__git_flow_feature_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -r'[Rebase instead of merge]'\ + ':feature:__git_flow_feature_list' + ;; + + (delete) + _arguments \ + -f'[Force deletion]' \ + -r'[Delete remote branch]' \ + ':feature:__git_flow_feature_list' + ;; + + (publish) + _arguments \ + ':feature:__git_flow_feature_list'\ + ;; + + (track) + _arguments \ + ':feature:__git_flow_feature_list'\ + ;; + + (diff) + _arguments \ + ':branch:__git_branch_names'\ + ;; + + (rebase) + _arguments \ + -i'[Do an interactive rebase]' \ + ':branch:__git_branch_names' + ;; + + (checkout) + _arguments \ + ':branch:__git_flow_feature_list'\ + ;; + + (pull) + _arguments \ + ':remote:__git_remotes'\ + ':branch:__git_branch_names' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-flow-config () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'list:List the configuration. (Alias to `git flow config`)' + 'set:Set the configuration option' + ) + _describe -t commands 'git flow config' subcommands + ;; + + (options) + case $line[1] in + + (set) + _arguments \ + --local'[Use repository config file]' \ + --global'[Use global config file]'\ + --system'[Use system config file]'\ + --file'[Use given config file]'\ + ':option:(master develop feature hotfix release support versiontagprefix)' + ;; + + *) + _arguments \ + --local'[Use repository config file]' \ + --global'[Use global config file]'\ + --system'[Use system config file]'\ + --file'[Use given config file]' + ;; + esac + ;; + esac +} +__git_flow_version_list () +{ + local expl + declare -a versions + + versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted versions expl 'version' compadd $versions +} + +__git_flow_feature_list () +{ + local expl + declare -a features + + features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted features expl 'feature' compadd $features +} + +__git_remotes () { + local expl gitdir remotes + + gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) + __git_command_successful || return + + remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]}) + __git_command_successful || return + + # TODO: Should combine the two instead of either or. + if (( $#remotes > 0 )); then + _wanted remotes expl remote compadd $* - $remotes + else + _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*" + fi +} + +__git_flow_hotfix_list () +{ + local expl + declare -a hotfixes + + hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted hotfixes expl 'hotfix' compadd $hotfixes +} + +__git_branch_names () { + local expl + declare -a branch_names + + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) + __git_command_successful || return + + _wanted branch-names expl branch-name compadd $* - $branch_names +} + +__git_command_successful () { + if (( ${#pipestatus:#0} > 0 )); then + _message 'not a git repository' + return 1 + fi + return 0 +} + +zstyle ':completion:*:*:git:*' user-commands flow:'provide high-level repository operations' diff --git a/oh-my-zsh/plugins/git-flow/README.md b/oh-my-zsh/plugins/git-flow/README.md @@ -0,0 +1,31 @@ +# Git-Flow plugin + +This plugin adds completion and aliases for the `git-flow` command. More information +at https://github.com/nvie/gitflow. + +Enable git-flow plugin in your zshrc file: +``` +plugins=(... git-flow) +``` + +## Aliases + +More information about `git-flow` commands: +https://github.com/nvie/gitflow/wiki/Command-Line-Arguments + +| Alias | Command | Description | +|---------|---------------------------|----------------------------------------| +| `gfl` | `git flow` | Git-Flow command | +| `gfli` | `git flow init` | Initialize git-flow repository | +| `gcd` | `git checkout develop` | Check out develop branch | +| `gch` | `git checkout hotfix` | Check out hotfix branch | +| `gcr` | `git checkout release` | Check out release branch | +| `gflf` | `git flow feature` | List existing feature branches | +| `gflh` | `git flow hotfix` | List existing hotfix branches | +| `gflr` | `git flow release` | List existing release branches | +| `gflfs` | `git flow feature start` | Start a new feature: `gflfs <name>` | +| `gflhs` | `git flow hotfix start` | Start a new hotfix: `gflhs <version>` | +| `gflrs` | `git flow release start` | Start a new release: `gflrs <version>` | +| `gflff` | `git flow feature finish` | Finish feature: `gflff <name>` | +| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` | +| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` | diff --git a/oh-my-zsh/plugins/git-flow/git-flow.plugin.zsh b/oh-my-zsh/plugins/git-flow/git-flow.plugin.zsh @@ -0,0 +1,369 @@ +#!zsh +# +# Installation +# ------------ +# +# To achieve git-flow completion nirvana: +# +# 0. Update your zsh's git-completion module to the newest version. +# From here. https://raw.githubusercontent.com/zsh-users/zsh/master/Completion/Unix/Command/_git +# +# 1. Install this file. Either: +# +# a. Place it in your .zshrc: +# +# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.zsh) and put the following line in +# your .zshrc: +# +# source ~/.git-flow-completion.zsh +# +# c. Or, use this file as an oh-my-zsh plugin. +# + +#Alias +alias gfl='git flow' +alias gfli='git flow init' +alias gcd='git checkout develop' +alias gch='git checkout hotfix' +alias gcr='git checkout release' +alias gflf='git flow feature' +alias gflh='git flow hotfix' +alias gflr='git flow release' +alias gflfs='git flow feature start' +alias gflhs='git flow hotfix start' +alias gflrs='git flow release start' +alias gflff='git flow feature finish' +alias gflhf='git flow hotfix finish' +alias gflrf='git flow release finish' +alias gflfp='git flow feature publish' +alias gflhp='git flow hotfix publish' +alias gflrp='git flow release publish' +alias gflfpll='git flow feature pull' + +_git-flow () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'init:Initialize a new git repo with support for the branching model.' + 'feature:Manage your feature branches.' + 'release:Manage your release branches.' + 'hotfix:Manage your hotfix branches.' + 'support:Manage your support branches.' + 'version:Shows version information.' + ) + _describe -t commands 'git flow' subcommands + ;; + + (options) + case $line[1] in + + (init) + _arguments \ + -f'[Force setting of gitflow branches, even if already configured]' + ;; + + (version) + ;; + + (hotfix) + __git-flow-hotfix + ;; + + (release) + __git-flow-release + ;; + + (feature) + __git-flow-feature + ;; + esac + ;; + esac +} + +__git-flow-release () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new release branch.' + 'finish:Finish a release branch.' + 'list:List all your release branches. (Alias to `git flow release`)' + 'publish: public' + 'track: track' + ) + _describe -t commands 'git flow release' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':version:__git_flow_version_list' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + -k'[Keep branch after performing finish]'\ + -n"[Don't tag this release]"\ + ':version:__git_flow_version_list' + ;; + + (publish) + _arguments \ + ':version:__git_flow_version_list'\ + ;; + + (track) + _arguments \ + ':version:__git_flow_version_list'\ + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-flow-hotfix () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new hotfix branch.' + 'finish:Finish a hotfix branch.' + 'list:List all your hotfix branches. (Alias to `git flow hotfix`)' + ) + _describe -t commands 'git flow hotfix' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':hotfix:__git_flow_version_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + -k'[Keep branch after performing finish]'\ + -n"[Don't tag this release]"\ + ':hotfix:__git_flow_hotfix_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-flow-feature () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new feature branch.' + 'finish:Finish a feature branch.' + 'list:List all your feature branches. (Alias to `git flow feature`)' + 'publish: publish' + 'track: track' + 'diff: diff' + 'rebase: rebase' + 'checkout: checkout' + 'pull: pull' + ) + _describe -t commands 'git flow feature' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':feature:__git_flow_feature_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -r'[Rebase instead of merge]'\ + -k'[Keep branch after performing finish]'\ + ':feature:__git_flow_feature_list' + ;; + + (publish) + _arguments \ + ':feature:__git_flow_feature_list'\ + ;; + + (track) + _arguments \ + ':feature:__git_flow_feature_list'\ + ;; + + (diff) + _arguments \ + ':branch:__git_flow_feature_list'\ + ;; + + (rebase) + _arguments \ + -i'[Do an interactive rebase]' \ + ':branch:__git_flow_feature_list' + ;; + + (checkout) + _arguments \ + ':branch:__git_flow_feature_list'\ + ;; + + (pull) + _arguments \ + ':remote:__git_remotes'\ + ':branch:__git_flow_feature_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git_flow_version_list () +{ + local expl + declare -a versions + + versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted versions expl 'version' compadd $versions +} + +__git_flow_feature_list () +{ + local expl + declare -a features + + features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted features expl 'feature' compadd $features +} + +__git_remotes () { + local expl gitdir remotes + + gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) + __git_command_successful || return + + remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]}) + __git_command_successful || return + + # TODO: Should combine the two instead of either or. + if (( $#remotes > 0 )); then + _wanted remotes expl remote compadd $* - $remotes + else + _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*" + fi +} + +__git_flow_hotfix_list () +{ + local expl + declare -a hotfixes + + hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted hotfixes expl 'hotfix' compadd $hotfixes +} + +__git_branch_names () { + local expl + declare -a branch_names + + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) + __git_command_successful || return + + _wanted branch-names expl branch-name compadd $* - $branch_names +} + +__git_command_successful () { + if (( ${#pipestatus:#0} > 0 )); then + _message 'not a git repository' + return 1 + fi + return 0 +} + +zstyle ':completion:*:*:git:*' user-commands flow:'description for foo' diff --git a/oh-my-zsh/plugins/git-hubflow/git-hubflow.plugin.zsh b/oh-my-zsh/plugins/git-hubflow/git-hubflow.plugin.zsh @@ -0,0 +1,355 @@ +#!zsh +# +# Installation +# ------------ +# +# To achieve git-hubflow completion nirvana: +# +# 0. Update your zsh's git-completion module to the newest version. +# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD +# +# 1. Install this file. Either: +# +# a. Place it in your .zshrc: +# +# b. Or, copy it somewhere (e.g. ~/.git-hubflow-completion.zsh) and put the following line in +# your .zshrc: +# +# source ~/.git-hubflow-completion.zsh +# +# c. Or, use this file as an oh-my-zsh plugin. +# + +alias ghf='git hf' +alias ghff='git hf feature' +alias ghfr='git hf release' +alias ghfh='git hf hotfix' +alias ghfs='git hf support' +alias ghfu='git hf update' + +_git-hf () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'init:Initialize a new git repo with support for the branching model.' + 'feature:Manage your feature branches.' + 'release:Manage your release branches.' + 'hotfix:Manage your hotfix branches.' + 'support:Manage your support branches.' + 'update:Pull upstream changes down into your master and develop branches.' + 'version:Shows version information.' + ) + _describe -t commands 'git hf' subcommands + ;; + + (options) + case $line[1] in + + (init) + _arguments \ + -f'[Force setting of gitflow branches, even if already configured]' + ;; + + (version) + ;; + + (hotfix) + __git-hf-hotfix + ;; + + (release) + __git-hf-release + ;; + + (feature) + __git-hf-feature + ;; + esac + ;; + esac +} + +__git-hf-release () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new release branch.' + 'finish:Finish a release branch.' + 'list:List all your release branches. (Alias to `git hf release`)' + 'cancel:Cancel release' + 'push:Push release to github' + 'pull:Pull release from github' + 'track:Track release' + ) + _describe -t commands 'git hf release' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':version:__git_hf_version_list' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + -k'[Keep branch after performing finish]'\ + -n"[Don't tag this release]"\ + ':version:__git_hf_version_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-hf-hotfix () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new hotfix branch.' + 'finish:Finish a hotfix branch.' + 'list:List all your hotfix branches. (Alias to `git hf hotfix`)' + 'publish:Publish the hotfix branch.' + 'track:Track the hotfix branch.' + 'pull:Pull the hotfix from github.' + 'push:Push the hotfix to github.' + 'cancel:Cancel the hotfix.' + ) + _describe -t commands 'git hf hotfix' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':hotfix:__git_hf_version_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + -k'[Keep branch after performing finish]'\ + -n"[Don't tag this release]"\ + ':hotfix:__git_hf_hotfix_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-hf-feature () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'list:List all your feature branches. (Alias to `git hf feature`)' + 'start:Start a new feature branch' + 'finish:Finish a feature branch' + 'submit:submit' + 'track:track' + 'diff:Diff' + 'rebase:Rebase feature branch against develop' + 'checkout:Checkout feature' + 'pull:Pull feature branch from github' + 'push:Push feature branch to github' + 'cancel:Cancel feature' + ) + _describe -t commands 'git hf feature' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':feature:__git_hf_feature_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -r'[Rebase instead of merge]'\ + ':feature:__git_hf_feature_list' + ;; + + (publish) + _arguments \ + ':feature:__git_hf_feature_list'\ + ;; + + (track) + _arguments \ + ':feature:__git_hf_feature_list'\ + ;; + + (diff) + _arguments \ + ':branch:__git_branch_names'\ + ;; + + (rebase) + _arguments \ + -i'[Do an interactive rebase]' \ + ':branch:__git_branch_names' + ;; + + (checkout) + _arguments \ + ':branch:__git_hf_feature_list'\ + ;; + + (pull) + _arguments \ + ':remote:__git_remotes'\ + ':branch:__git_branch_names' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git_hf_version_list () +{ + local expl + declare -a versions + + versions=(${${(f)"$(_call_program versions git hf release list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted versions expl 'version' compadd $versions +} + +__git_hf_feature_list () +{ + local expl + declare -a features + + features=(${${(f)"$(_call_program features git hf feature list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted features expl 'feature' compadd $features +} + +__git_remotes () { + local expl gitdir remotes + + gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) + __git_command_successful || return + + remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]}) + __git_command_successful || return + + # TODO: Should combine the two instead of either or. + if (( $#remotes > 0 )); then + _wanted remotes expl remote compadd $* - $remotes + else + _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*" + fi +} + +__git_hf_hotfix_list () +{ + local expl + declare -a hotfixes + + hotfixes=(${${(f)"$(_call_program hotfixes git hf hotfix list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted hotfixes expl 'hotfix' compadd $hotfixes +} + +__git_branch_names () { + local expl + declare -a branch_names + + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) + __git_command_successful || return + + _wanted branch-names expl branch-name compadd $* - $branch_names +} + +__git_command_successful () { + if (( ${#pipestatus:#0} > 0 )); then + _message 'not a git repository' + return 1 + fi + return 0 +} + +zstyle ':completion:*:*:git:*' user-commands flow:'description for foo' diff --git a/oh-my-zsh/plugins/git-prompt/git-prompt.plugin.zsh b/oh-my-zsh/plugins/git-prompt/git-prompt.plugin.zsh @@ -0,0 +1,92 @@ +# ZSH Git Prompt Plugin from: +# http://github.com/olivierverdier/zsh-git-prompt + +__GIT_PROMPT_DIR="${0:A:h}" + +## Hook function definitions +function chpwd_update_git_vars() { + update_current_git_vars +} + +function preexec_update_git_vars() { + case "$2" in + git*|hub*|gh*|stg*) + __EXECUTED_GIT_COMMAND=1 + ;; + esac +} + +function precmd_update_git_vars() { + if [ -n "$__EXECUTED_GIT_COMMAND" ] || [ ! -n "$ZSH_THEME_GIT_PROMPT_CACHE" ]; then + update_current_git_vars + unset __EXECUTED_GIT_COMMAND + fi +} + +chpwd_functions+=(chpwd_update_git_vars) +precmd_functions+=(precmd_update_git_vars) +preexec_functions+=(preexec_update_git_vars) + + +## Function definitions +function update_current_git_vars() { + unset __CURRENT_GIT_STATUS + + local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py" + _GIT_STATUS=$(python ${gitstatus} 2>/dev/null) + __CURRENT_GIT_STATUS=("${(@s: :)_GIT_STATUS}") + GIT_BRANCH=$__CURRENT_GIT_STATUS[1] + GIT_AHEAD=$__CURRENT_GIT_STATUS[2] + GIT_BEHIND=$__CURRENT_GIT_STATUS[3] + GIT_STAGED=$__CURRENT_GIT_STATUS[4] + GIT_CONFLICTS=$__CURRENT_GIT_STATUS[5] + GIT_CHANGED=$__CURRENT_GIT_STATUS[6] + GIT_UNTRACKED=$__CURRENT_GIT_STATUS[7] +} + +git_super_status() { + precmd_update_git_vars + if [ -n "$__CURRENT_GIT_STATUS" ]; then + STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}" + if [ "$GIT_BEHIND" -ne "0" ]; then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND$GIT_BEHIND%{${reset_color}%}" + fi + if [ "$GIT_AHEAD" -ne "0" ]; then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD$GIT_AHEAD%{${reset_color}%}" + fi + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR" + if [ "$GIT_STAGED" -ne "0" ]; then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED$GIT_STAGED%{${reset_color}%}" + fi + if [ "$GIT_CONFLICTS" -ne "0" ]; then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CONFLICTS$GIT_CONFLICTS%{${reset_color}%}" + fi + if [ "$GIT_CHANGED" -ne "0" ]; then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}" + fi + if [ "$GIT_UNTRACKED" -ne "0" ]; then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED%{${reset_color}%}" + fi + if [ "$GIT_CHANGED" -eq "0" ] && [ "$GIT_CONFLICTS" -eq "0" ] && [ "$GIT_STAGED" -eq "0" ] && [ "$GIT_UNTRACKED" -eq "0" ]; then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN" + fi + STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX" + echo "$STATUS" + fi +} + +# Default values for the appearance of the prompt. +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")" +ZSH_THEME_GIT_PROMPT_SEPARATOR="|" +ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}" +ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}%{●%G%}" +ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{✖%G%}" +ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}%{✚%G%}" +ZSH_THEME_GIT_PROMPT_BEHIND="%{↓%G%}" +ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%G%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{…%G%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%G%}" + +# Set the prompt. +RPROMPT='$(git_super_status)' diff --git a/oh-my-zsh/plugins/git-prompt/gitstatus.py b/oh-my-zsh/plugins/git-prompt/gitstatus.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +from __future__ import print_function + +import sys +import re +import shlex +from subprocess import Popen, PIPE, check_output + + +def get_tagname_or_hash(): + """return tagname if exists else hash""" + cmd = 'git log -1 --format="%h%d"' + output = check_output(shlex.split(cmd)).decode('utf-8').strip() + hash_, tagname = None, None + # get hash + m = re.search('\(.*\)$', output) + if m: + hash_ = output[:m.start()-1] + # get tagname + m = re.search('tag: .*[,\)]', output) + if m: + tagname = 'tags/' + output[m.start()+len('tag: '): m.end()-1] + + if tagname: + return tagname + elif hash_: + return hash_ + return None + + +# `git status --porcelain --branch` can collect all information +# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind +po = Popen(['git', 'status', '--porcelain', '--branch'], stdout=PIPE, stderr=PIPE) +stdout, sterr = po.communicate() +if po.returncode != 0: + sys.exit(0) # Not a git repository + +# collect git status information +untracked, staged, changed, conflicts = [], [], [], [] +ahead, behind = 0, 0 +status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()] +for st in status: + if st[0] == '#' and st[1] == '#': + if re.search('Initial commit on', st[2]): + branch = st[2].split(' ')[-1] + elif re.search('no branch', st[2]): # detached status + branch = get_tagname_or_hash() + elif len(st[2].strip().split('...')) == 1: + branch = st[2].strip() + else: + # current and remote branch info + branch, rest = st[2].strip().split('...') + if len(rest.split(' ')) == 1: + # remote_branch = rest.split(' ')[0] + pass + else: + # ahead or behind + divergence = ' '.join(rest.split(' ')[1:]) + divergence = divergence.lstrip('[').rstrip(']') + for div in divergence.split(', '): + if 'ahead' in div: + ahead = int(div[len('ahead '):].strip()) + elif 'behind' in div: + behind = int(div[len('behind '):].strip()) + elif st[0] == '?' and st[1] == '?': + untracked.append(st) + else: + if st[1] == 'M': + changed.append(st) + if st[0] == 'U': + conflicts.append(st) + elif st[0] != ' ': + staged.append(st) + +out = ' '.join([ + branch, + str(ahead), + str(behind), + str(len(staged)), + str(len(conflicts)), + str(len(changed)), + str(len(untracked)), +]) +print(out, end='') diff --git a/oh-my-zsh/plugins/git-remote-branch/git-remote-branch.plugin.zsh b/oh-my-zsh/plugins/git-remote-branch/git-remote-branch.plugin.zsh @@ -0,0 +1,19 @@ +_git_remote_branch() { + ref=$(git symbolic-ref HEAD 2> /dev/null) + if [[ -n $ref ]]; then + if (( CURRENT == 2 )); then + # first arg: operation + compadd create publish rename delete track + elif (( CURRENT == 3 )); then + # second arg: remote branch name + remotes=`git remote | tr '\n' '|' | sed "s/\|$//g"` + compadd `git branch -r | grep -v HEAD | sed "s/$remotes\///" | sed "s/ //g"` + elif (( CURRENT == 4 )); then + # third arg: remote name + compadd `git remote` + fi + else; + _files + fi +} +compdef _git_remote_branch grb diff --git a/oh-my-zsh/plugins/git/README.md b/oh-my-zsh/plugins/git/README.md @@ -0,0 +1,10 @@ +## git + +**Maintainer:** [@ncanceill](https://github.com/ncanceill) + +This plugin adds many useful aliases and functions. + +### Usage + +See the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugin:git) for a list of aliases and functions provided by the plugin. + diff --git a/oh-my-zsh/plugins/git/git.plugin.zsh b/oh-my-zsh/plugins/git/git.plugin.zsh @@ -0,0 +1,248 @@ +# Query/use custom command for `git`. +zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd +: ${_omz_git_git_cmd:=git} + +# +# Functions +# + +# The name of the current branch +# Back-compatibility wrapper for when this function was defined here in +# the plugin, before being pulled in to core lib/git.zsh as git_current_branch() +# to fix the core -> git plugin dependency. +function current_branch() { + git_current_branch +} +# The list of remotes +function current_repository() { + if ! $_omz_git_git_cmd rev-parse --is-inside-work-tree &> /dev/null; then + return + fi + echo $($_omz_git_git_cmd remote -v | cut -d':' -f 2) +} +# Pretty log messages +function _git_log_prettily(){ + if ! [ -z $1 ]; then + git log --pretty=$1 + fi +} +# Warn if the current branch is a WIP +function work_in_progress() { + if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then + echo "WIP!!" + fi +} + +# +# Aliases +# (sorted alphabetically) +# + +alias g='git' + +alias ga='git add' +alias gaa='git add --all' +alias gapa='git add --patch' +alias gau='git add --update' +alias gap='git apply' + +alias gb='git branch' +alias gba='git branch -a' +alias gbd='git branch -d' +alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d' +alias gbl='git blame -b -w' +alias gbnm='git branch --no-merged' +alias gbr='git branch --remote' +alias gbs='git bisect' +alias gbsb='git bisect bad' +alias gbsg='git bisect good' +alias gbsr='git bisect reset' +alias gbss='git bisect start' + +alias gc='git commit -v' +alias gc!='git commit -v --amend' +alias gcn!='git commit -v --no-edit --amend' +alias gca='git commit -v -a' +alias gca!='git commit -v -a --amend' +alias gcan!='git commit -v -a --no-edit --amend' +alias gcans!='git commit -v -a -s --no-edit --amend' +alias gcam='git commit -a -m' +alias gcsm='git commit -s -m' +alias gcb='git checkout -b' +alias gcf='git config --list' +alias gcl='git clone --recursive' +alias gclean='git clean -fd' +alias gpristine='git reset --hard && git clean -dfx' +alias gcm='git checkout master' +alias gcd='git checkout develop' +alias gcmsg='git commit -m' +alias gco='git checkout' +alias gcount='git shortlog -sn' +compdef _git gcount +alias gcp='git cherry-pick' +alias gcpa='git cherry-pick --abort' +alias gcpc='git cherry-pick --continue' +alias gcs='git commit -S' + +alias gd='git diff' +alias gdca='git diff --cached' +alias gdcw='git diff --cached --word-diff' +alias gdct='git describe --tags `git rev-list --tags --max-count=1`' +alias gdt='git diff-tree --no-commit-id --name-only -r' +alias gdw='git diff --word-diff' + +gdv() { git diff -w "$@" | view - } +compdef _git gdv=git-diff + +alias gf='git fetch' +alias gfa='git fetch --all --prune' +alias gfo='git fetch origin' + +function gfg() { git ls-files | grep $@ } +compdef _grep gfg + +alias gg='git gui citool' +alias gga='git gui citool --amend' + +ggf() { + [[ "$#" != 1 ]] && local b="$(git_current_branch)" + git push --force origin "${b:=$1}" +} +ggfl() { +[[ "$#" != 1 ]] && local b="$(git_current_branch)" +git push --force-with-lease origin "${b:=$1}" +} +compdef _git ggf=git-checkout + +ggl() { + if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then + git pull origin "${*}" + else + [[ "$#" == 0 ]] && local b="$(git_current_branch)" + git pull origin "${b:=$1}" + fi +} +compdef _git ggl=git-checkout + +ggp() { + if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then + git push origin "${*}" + else + [[ "$#" == 0 ]] && local b="$(git_current_branch)" + git push origin "${b:=$1}" + fi +} +compdef _git ggp=git-checkout + +ggpnp() { + if [[ "$#" == 0 ]]; then + ggl && ggp + else + ggl "${*}" && ggp "${*}" + fi +} +compdef _git ggpnp=git-checkout + +ggu() { + [[ "$#" != 1 ]] && local b="$(git_current_branch)" + git pull --rebase origin "${b:=$1}" +} +compdef _git ggu=git-checkout + +alias ggpur='ggu' +compdef _git ggpur=git-checkout + +alias ggpull='git pull origin $(git_current_branch)' +compdef _git ggpull=git-checkout + +alias ggpush='git push origin $(git_current_branch)' +compdef _git ggpush=git-checkout + +alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' +alias gpsup='git push --set-upstream origin $(git_current_branch)' + +alias ghh='git help' + +alias gignore='git update-index --assume-unchanged' +alias gignored='git ls-files -v | grep "^[[:lower:]]"' +alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' +compdef _git git-svn-dcommit-push=git + +alias gk='\gitk --all --branches' +compdef _git gk='gitk' +alias gke='\gitk --all $(git log -g --pretty=%h)' +compdef _git gke='gitk' + +alias gl='git pull' +alias glg='git log --stat' +alias glgp='git log --stat -p' +alias glgg='git log --graph' +alias glgga='git log --graph --decorate --all' +alias glgm='git log --graph --max-count=10' +alias glo='git log --oneline --decorate' +alias glol="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" +alias glola="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all" +alias glog='git log --oneline --decorate --graph' +alias gloga='git log --oneline --decorate --graph --all' +alias glp="_git_log_prettily" +compdef _git glp=git-log + +alias gm='git merge' +alias gmom='git merge origin/master' +alias gmt='git mergetool --no-prompt' +alias gmtvim='git mergetool --no-prompt --tool=vimdiff' +alias gmum='git merge upstream/master' +alias gma='git merge --abort' + +alias gp='git push' +alias gpd='git push --dry-run' +alias gpoat='git push origin --all && git push origin --tags' +compdef _git gpoat=git-push +alias gpu='git push upstream' +alias gpv='git push -v' + +alias gr='git remote' +alias gra='git remote add' +alias grb='git rebase' +alias grba='git rebase --abort' +alias grbc='git rebase --continue' +alias grbi='git rebase -i' +alias grbm='git rebase master' +alias grbs='git rebase --skip' +alias grh='git reset HEAD' +alias grhh='git reset HEAD --hard' +alias grmv='git remote rename' +alias grrm='git remote remove' +alias grset='git remote set-url' +alias grt='cd $(git rev-parse --show-toplevel || echo ".")' +alias gru='git reset --' +alias grup='git remote update' +alias grv='git remote -v' + +alias gsb='git status -sb' +alias gsd='git svn dcommit' +alias gsi='git submodule init' +alias gsps='git show --pretty=short --show-signature' +alias gsr='git svn rebase' +alias gss='git status -s' +alias gst='git status' +alias gsta='git stash save' +alias gstaa='git stash apply' +alias gstc='git stash clear' +alias gstd='git stash drop' +alias gstl='git stash list' +alias gstp='git stash pop' +alias gsts='git stash show --text' +alias gsu='git submodule update' + +alias gts='git tag -s' +alias gtv='git tag | sort -V' + +alias gunignore='git update-index --no-assume-unchanged' +alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' +alias gup='git pull --rebase' +alias gupv='git pull --rebase -v' +alias glum='git pull upstream master' + +alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' +alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip-- [skip ci]"' diff --git a/oh-my-zsh/plugins/gitfast/_git b/oh-my-zsh/plugins/gitfast/_git @@ -0,0 +1,227 @@ +#compdef git gitk + +# zsh completion wrapper for git +# +# Copyright (c) 2012-2013 Felipe Contreras <felipe.contreras@gmail.com> +# +# You need git's bash completion script installed somewhere, by default it +# would be the location bash-completion uses. +# +# If your script is somewhere else, you can configure it on your ~/.zshrc: +# +# zstyle ':completion:*:*:git:*' script ~/.git-completion.sh +# +# The recommended way to install this script is to copy to '~/.zsh/_git', and +# then add the following to your ~/.zshrc file: +# +# fpath=(~/.zsh $fpath) + +complete () +{ + # do nothing + return 0 +} + +zstyle -T ':completion:*:*:git:*' tag-order && \ + zstyle ':completion:*:*:git:*' tag-order 'common-commands' + +zstyle -s ":completion:*:*:git:*" script script +if [ -z "$script" ]; then + local -a locations + local e + locations=( + "$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash" + '/etc/bash_completion.d/git' # fedora, old debian + '/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian + '/usr/share/bash-completion/git' # gentoo + ) + for e in $locations; do + test -f $e && script="$e" && break + done +fi +ZSH_VERSION='' . "$script" + +__gitcomp () +{ + emulate -L zsh + + local cur_="${3-$cur}" + + case "$cur_" in + --*=) + ;; + *) + local c IFS=$' \t\n' + local -a array + for c in ${=1}; do + c="$c${4-}" + case $c in + --*=*|*.) ;; + *) c="$c " ;; + esac + array+=("$c") + done + compset -P '*[=:]' + compadd -Q -S '' -p "${2-}" -a -- array && _ret=0 + ;; + esac +} + +__gitcomp_nl () +{ + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0 +} + +__gitcomp_nl_append () +{ + emulate -L zsh + + local IFS=$'\n' + compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0 +} + +__gitcomp_file () +{ + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -Q -p "${2-}" -f -- ${=1} && _ret=0 +} + +__git_zsh_bash_func () +{ + emulate -L ksh + + local command=$1 + + local completion_func="_git_${command//-/_}" + declare -f $completion_func >/dev/null && $completion_func && return + + local expansion=$(__git_aliased_command "$command") + if [ -n "$expansion" ]; then + words[1]=$expansion + completion_func="_git_${expansion//-/_}" + declare -f $completion_func >/dev/null && $completion_func + fi +} + +__git_zsh_cmd_common () +{ + local -a list + list=( + add:'add file contents to the index' + bisect:'find by binary search the change that introduced a bug' + branch:'list, create, or delete branches' + checkout:'checkout a branch or paths to the working tree' + clone:'clone a repository into a new directory' + commit:'record changes to the repository' + diff:'show changes between commits, commit and working tree, etc' + fetch:'download objects and refs from another repository' + grep:'print lines matching a pattern' + init:'create an empty Git repository or reinitialize an existing one' + log:'show commit logs' + merge:'join two or more development histories together' + mv:'move or rename a file, a directory, or a symlink' + pull:'fetch from and merge with another repository or a local branch' + push:'update remote refs along with associated objects' + rebase:'forward-port local commits to the updated upstream head' + reset:'reset current HEAD to the specified state' + rm:'remove files from the working tree and from the index' + show:'show various types of objects' + status:'show the working tree status' + tag:'create, list, delete or verify a tag object signed with GPG') + _describe -t common-commands 'common commands' list && _ret=0 +} + +__git_zsh_cmd_alias () +{ + local -a list + list=(${${${(0)"$(git config -z --get-regexp '^alias\.')"}#alias.}%$'\n'*}) + _describe -t alias-commands 'aliases' list $* && _ret=0 +} + +__git_zsh_cmd_all () +{ + local -a list + emulate ksh -c __git_compute_all_commands + list=( ${=__git_all_commands} ) + _describe -t all-commands 'all commands' list && _ret=0 +} + +__git_zsh_main () +{ + local curcontext="$curcontext" state state_descr line + typeset -A opt_args + local -a orig_words + + orig_words=( ${words[@]} ) + + _arguments -C \ + '(-p --paginate --no-pager)'{-p,--paginate}'[pipe all output into ''less'']' \ + '(-p --paginate)--no-pager[do not pipe git output into a pager]' \ + '--git-dir=-[set the path to the repository]: :_directories' \ + '--bare[treat the repository as a bare repository]' \ + '(- :)--version[prints the git suite version]' \ + '--exec-path=-[path to where your core git programs are installed]:: :_directories' \ + '--html-path[print the path where git''s HTML documentation is installed]' \ + '--info-path[print the path where the Info files are installed]' \ + '--man-path[print the manpath (see `man(1)`) for the man pages]' \ + '--work-tree=-[set the path to the working tree]: :_directories' \ + '--namespace=-[set the git namespace]' \ + '--no-replace-objects[do not use replacement refs to replace git objects]' \ + '(- :)--help[prints the synopsis and a list of the most commonly used commands]: :->arg' \ + '(-): :->command' \ + '(-)*:: :->arg' && return + + case $state in + (command) + _alternative \ + 'alias-commands:alias:__git_zsh_cmd_alias' \ + 'common-commands:common:__git_zsh_cmd_common' \ + 'all-commands:all:__git_zsh_cmd_all' && _ret=0 + ;; + (arg) + local command="${words[1]}" __git_dir + + if (( $+opt_args[--bare] )); then + __git_dir='.' + else + __git_dir=${opt_args[--git-dir]} + fi + + (( $+opt_args[--help] )) && command='help' + + words=( ${orig_words[@]} ) + + __git_zsh_bash_func $command + ;; + esac +} + +_git () +{ + local _ret=1 + local cur cword prev + + cur=${words[CURRENT]} + prev=${words[CURRENT-1]} + let cword=CURRENT-1 + + if (( $+functions[__${service}_zsh_main] )); then + __${service}_zsh_main + elif (( $+functions[__${service}_main] )); then + emulate ksh -c __${service}_main + elif (( $+functions[_${service}] )); then + emulate ksh -c _${service} + fi + + let _ret && _default && _ret=0 + return _ret +} + +_git diff --git a/oh-my-zsh/plugins/gitfast/git-completion.bash b/oh-my-zsh/plugins/gitfast/git-completion.bash @@ -0,0 +1,2776 @@ +# bash/zsh completion support for core Git. +# +# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> +# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). +# Distributed under the GNU General Public License, version 2.0. +# +# The contained completion routines provide support for completing: +# +# *) local and remote branch names +# *) local and remote tag names +# *) .git/remotes file names +# *) git 'subcommands' +# *) git email aliases for git-send-email +# *) tree paths within 'ref:path/to/file' expressions +# *) file paths within current working directory and index +# *) common --long-options +# +# To use these routines: +# +# 1) Copy this file to somewhere (e.g. ~/.git-completion.bash). +# 2) Add the following line to your .bashrc/.zshrc: +# source ~/.git-completion.bash +# 3) Consider changing your PS1 to also show the current branch, +# see git-prompt.sh for details. +# +# If you use complex aliases of form '!f() { ... }; f', you can use the null +# command ':' as the first command in the function body to declare the desired +# completion style. For example '!f() { : git commit ; ... }; f' will +# tell the completion to use commit completion. This also works with aliases +# of form "!sh -c '...'". For example, "!sh -c ': git commit ; ... '". + +case "$COMP_WORDBREAKS" in +*:*) : great ;; +*) COMP_WORDBREAKS="$COMP_WORDBREAKS:" +esac + +# __gitdir accepts 0 or 1 arguments (i.e., location) +# returns location of .git repo +__gitdir () +{ + if [ -z "${1-}" ]; then + if [ -n "${__git_dir-}" ]; then + echo "$__git_dir" + elif [ -n "${GIT_DIR-}" ]; then + test -d "${GIT_DIR-}" || return 1 + echo "$GIT_DIR" + elif [ -d .git ]; then + echo .git + else + git rev-parse --git-dir 2>/dev/null + fi + elif [ -d "$1/.git" ]; then + echo "$1/.git" + else + echo "$1" + fi +} + +# The following function is based on code from: +# +# bash_completion - programmable completion functions for bash 3.2+ +# +# Copyright © 2006-2008, Ian Macdonald <ian@caliban.org> +# © 2009-2010, Bash Completion Maintainers +# <bash-completion-devel@lists.alioth.debian.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# The latest version of this software can be obtained here: +# +# http://bash-completion.alioth.debian.org/ +# +# RELEASE: 2.x + +# This function can be used to access a tokenized list of words +# on the command line: +# +# __git_reassemble_comp_words_by_ref '=:' +# if test "${words_[cword_-1]}" = -w +# then +# ... +# fi +# +# The argument should be a collection of characters from the list of +# word completion separators (COMP_WORDBREAKS) to treat as ordinary +# characters. +# +# This is roughly equivalent to going back in time and setting +# COMP_WORDBREAKS to exclude those characters. The intent is to +# make option types like --date=<type> and <rev>:<path> easy to +# recognize by treating each shell word as a single token. +# +# It is best not to set COMP_WORDBREAKS directly because the value is +# shared with other completion scripts. By the time the completion +# function gets called, COMP_WORDS has already been populated so local +# changes to COMP_WORDBREAKS have no effect. +# +# Output: words_, cword_, cur_. + +__git_reassemble_comp_words_by_ref() +{ + local exclude i j first + # Which word separators to exclude? + exclude="${1//[^$COMP_WORDBREAKS]}" + cword_=$COMP_CWORD + if [ -z "$exclude" ]; then + words_=("${COMP_WORDS[@]}") + return + fi + # List of word completion separators has shrunk; + # re-assemble words to complete. + for ((i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)); do + # Append each nonempty word consisting of just + # word separator characters to the current word. + first=t + while + [ $i -gt 0 ] && + [ -n "${COMP_WORDS[$i]}" ] && + # word consists of excluded word separators + [ "${COMP_WORDS[$i]//[^$exclude]}" = "${COMP_WORDS[$i]}" ] + do + # Attach to the previous token, + # unless the previous token is the command name. + if [ $j -ge 2 ] && [ -n "$first" ]; then + ((j--)) + fi + first= + words_[$j]=${words_[j]}${COMP_WORDS[i]} + if [ $i = $COMP_CWORD ]; then + cword_=$j + fi + if (($i < ${#COMP_WORDS[@]} - 1)); then + ((i++)) + else + # Done. + return + fi + done + words_[$j]=${words_[j]}${COMP_WORDS[i]} + if [ $i = $COMP_CWORD ]; then + cword_=$j + fi + done +} + +if ! type _get_comp_words_by_ref >/dev/null 2>&1; then +_get_comp_words_by_ref () +{ + local exclude cur_ words_ cword_ + if [ "$1" = "-n" ]; then + exclude=$2 + shift 2 + fi + __git_reassemble_comp_words_by_ref "$exclude" + cur_=${words_[cword_]} + while [ $# -gt 0 ]; do + case "$1" in + cur) + cur=$cur_ + ;; + prev) + prev=${words_[$cword_-1]} + ;; + words) + words=("${words_[@]}") + ;; + cword) + cword=$cword_ + ;; + esac + shift + done +} +fi + +__gitcompappend () +{ + local x i=${#COMPREPLY[@]} + for x in $1; do + if [[ "$x" == "$3"* ]]; then + COMPREPLY[i++]="$2$x$4" + fi + done +} + +__gitcompadd () +{ + COMPREPLY=() + __gitcompappend "$@" +} + +# Generates completion reply, appending a space to possible completion words, +# if necessary. +# It accepts 1 to 4 arguments: +# 1: List of possible completion words. +# 2: A prefix to be added to each possible completion word (optional). +# 3: Generate possible completion matches for this word (optional). +# 4: A suffix to be appended to each possible completion word (optional). +__gitcomp () +{ + local cur_="${3-$cur}" + + case "$cur_" in + --*=) + ;; + *) + local c i=0 IFS=$' \t\n' + for c in $1; do + c="$c${4-}" + if [[ $c == "$cur_"* ]]; then + case $c in + --*=*|*.) ;; + *) c="$c " ;; + esac + COMPREPLY[i++]="${2-}$c" + fi + done + ;; + esac +} + +# Variation of __gitcomp_nl () that appends to the existing list of +# completion candidates, COMPREPLY. +__gitcomp_nl_append () +{ + local IFS=$'\n' + __gitcompappend "$1" "${2-}" "${3-$cur}" "${4- }" +} + +# Generates completion reply from newline-separated possible completion words +# by appending a space to all of them. +# It accepts 1 to 4 arguments: +# 1: List of possible completion words, separated by a single newline. +# 2: A prefix to be added to each possible completion word (optional). +# 3: Generate possible completion matches for this word (optional). +# 4: A suffix to be appended to each possible completion word instead of +# the default space (optional). If specified but empty, nothing is +# appended. +__gitcomp_nl () +{ + COMPREPLY=() + __gitcomp_nl_append "$@" +} + +# Generates completion reply with compgen from newline-separated possible +# completion filenames. +# It accepts 1 to 3 arguments: +# 1: List of possible completion filenames, separated by a single newline. +# 2: A directory prefix to be added to each possible completion filename +# (optional). +# 3: Generate possible completion matches for this word (optional). +__gitcomp_file () +{ + local IFS=$'\n' + + # XXX does not work when the directory prefix contains a tilde, + # since tilde expansion is not applied. + # This means that COMPREPLY will be empty and Bash default + # completion will be used. + __gitcompadd "$1" "${2-}" "${3-$cur}" "" + + # use a hack to enable file mode in bash < 4 + compopt -o filenames +o nospace 2>/dev/null || + compgen -f /non-existing-dir/ > /dev/null +} + +# Execute 'git ls-files', unless the --committable option is specified, in +# which case it runs 'git diff-index' to find out the files that can be +# committed. It return paths relative to the directory specified in the first +# argument, and using the options specified in the second argument. +__git_ls_files_helper () +{ + if [ "$2" == "--committable" ]; then + git -C "$1" diff-index --name-only --relative HEAD + else + # NOTE: $2 is not quoted in order to support multiple options + git -C "$1" ls-files --exclude-standard $2 + fi 2>/dev/null +} + + +# __git_index_files accepts 1 or 2 arguments: +# 1: Options to pass to ls-files (required). +# 2: A directory path (optional). +# If provided, only files within the specified directory are listed. +# Sub directories are never recursed. Path must have a trailing +# slash. +__git_index_files () +{ + local dir="$(__gitdir)" root="${2-.}" file + + if [ -d "$dir" ]; then + __git_ls_files_helper "$root" "$1" | + while read -r file; do + case "$file" in + ?*/*) echo "${file%%/*}" ;; + *) echo "$file" ;; + esac + done | sort | uniq + fi +} + +__git_heads () +{ + local dir="$(__gitdir)" + if [ -d "$dir" ]; then + git --git-dir="$dir" for-each-ref --format='%(refname:short)' \ + refs/heads + return + fi +} + +__git_tags () +{ + local dir="$(__gitdir)" + if [ -d "$dir" ]; then + git --git-dir="$dir" for-each-ref --format='%(refname:short)' \ + refs/tags + return + fi +} + +# __git_refs accepts 0, 1 (to pass to __gitdir), or 2 arguments +# presence of 2nd argument means use the guess heuristic employed +# by checkout for tracking branches +__git_refs () +{ + local i hash dir="$(__gitdir "${1-}")" track="${2-}" + local format refs + if [ -d "$dir" ]; then + case "$cur" in + refs|refs/*) + format="refname" + refs="${cur%/*}" + track="" + ;; + *) + for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do + if [ -e "$dir/$i" ]; then echo $i; fi + done + format="refname:short" + refs="refs/tags refs/heads refs/remotes" + ;; + esac + git --git-dir="$dir" for-each-ref --format="%($format)" \ + $refs + if [ -n "$track" ]; then + # employ the heuristic used by git checkout + # Try to find a remote branch that matches the completion word + # but only output if the branch name is unique + local ref entry + git --git-dir="$dir" for-each-ref --shell --format="ref=%(refname:short)" \ + "refs/remotes/" | \ + while read -r entry; do + eval "$entry" + ref="${ref#*/}" + if [[ "$ref" == "$cur"* ]]; then + echo "$ref" + fi + done | sort | uniq -u + fi + return + fi + case "$cur" in + refs|refs/*) + git ls-remote "$dir" "$cur*" 2>/dev/null | \ + while read -r hash i; do + case "$i" in + *^{}) ;; + *) echo "$i" ;; + esac + done + ;; + *) + echo "HEAD" + git for-each-ref --format="%(refname:short)" -- \ + "refs/remotes/$dir/" 2>/dev/null | sed -e "s#^$dir/##" + ;; + esac +} + +# __git_refs2 requires 1 argument (to pass to __git_refs) +__git_refs2 () +{ + local i + for i in $(__git_refs "$1"); do + echo "$i:$i" + done +} + +# __git_refs_remotes requires 1 argument (to pass to ls-remote) +__git_refs_remotes () +{ + local i hash + git ls-remote "$1" 'refs/heads/*' 2>/dev/null | \ + while read -r hash i; do + echo "$i:refs/remotes/$1/${i#refs/heads/}" + done +} + +__git_remotes () +{ + local d="$(__gitdir)" + test -d "$d/remotes" && ls -1 "$d/remotes" + git --git-dir="$d" remote +} + +__git_list_merge_strategies () +{ + git merge -s help 2>&1 | + sed -n -e '/[Aa]vailable strategies are: /,/^$/{ + s/\.$// + s/.*:// + s/^[ ]*// + s/[ ]*$// + p + }' +} + +__git_merge_strategies= +# 'git merge -s help' (and thus detection of the merge strategy +# list) fails, unfortunately, if run outside of any git working +# tree. __git_merge_strategies is set to the empty string in +# that case, and the detection will be repeated the next time it +# is needed. +__git_compute_merge_strategies () +{ + test -n "$__git_merge_strategies" || + __git_merge_strategies=$(__git_list_merge_strategies) +} + +__git_complete_revlist_file () +{ + local pfx ls ref cur_="$cur" + case "$cur_" in + *..?*:*) + return + ;; + ?*:*) + ref="${cur_%%:*}" + cur_="${cur_#*:}" + case "$cur_" in + ?*/*) + pfx="${cur_%/*}" + cur_="${cur_##*/}" + ls="$ref:$pfx" + pfx="$pfx/" + ;; + *) + ls="$ref" + ;; + esac + + case "$COMP_WORDBREAKS" in + *:*) : great ;; + *) pfx="$ref:$pfx" ;; + esac + + __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" 2>/dev/null \ + | sed '/^100... blob /{ + s,^.* ,, + s,$, , + } + /^120000 blob /{ + s,^.* ,, + s,$, , + } + /^040000 tree /{ + s,^.* ,, + s,$,/, + } + s/^.* //')" \ + "$pfx" "$cur_" "" + ;; + *...*) + pfx="${cur_%...*}..." + cur_="${cur_#*...}" + __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" + ;; + *..*) + pfx="${cur_%..*}.." + cur_="${cur_#*..}" + __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" + ;; + *) + __gitcomp_nl "$(__git_refs)" + ;; + esac +} + + +# __git_complete_index_file requires 1 argument: +# 1: the options to pass to ls-file +# +# The exception is --committable, which finds the files appropriate commit. +__git_complete_index_file () +{ + local pfx="" cur_="$cur" + + case "$cur_" in + ?*/*) + pfx="${cur_%/*}" + cur_="${cur_##*/}" + pfx="${pfx}/" + ;; + esac + + __gitcomp_file "$(__git_index_files "$1" ${pfx:+"$pfx"})" "$pfx" "$cur_" +} + +__git_complete_file () +{ + __git_complete_revlist_file +} + +__git_complete_revlist () +{ + __git_complete_revlist_file +} + +__git_complete_remote_or_refspec () +{ + local cur_="$cur" cmd="${words[1]}" + local i c=2 remote="" pfx="" lhs=1 no_complete_refspec=0 + if [ "$cmd" = "remote" ]; then + ((c++)) + fi + while [ $c -lt $cword ]; do + i="${words[c]}" + case "$i" in + --mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;; + --all) + case "$cmd" in + push) no_complete_refspec=1 ;; + fetch) + return + ;; + *) ;; + esac + ;; + -*) ;; + *) remote="$i"; break ;; + esac + ((c++)) + done + if [ -z "$remote" ]; then + __gitcomp_nl "$(__git_remotes)" + return + fi + if [ $no_complete_refspec = 1 ]; then + return + fi + [ "$remote" = "." ] && remote= + case "$cur_" in + *:*) + case "$COMP_WORDBREAKS" in + *:*) : great ;; + *) pfx="${cur_%%:*}:" ;; + esac + cur_="${cur_#*:}" + lhs=0 + ;; + +*) + pfx="+" + cur_="${cur_#+}" + ;; + esac + case "$cmd" in + fetch) + if [ $lhs = 1 ]; then + __gitcomp_nl "$(__git_refs2 "$remote")" "$pfx" "$cur_" + else + __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" + fi + ;; + pull|remote) + if [ $lhs = 1 ]; then + __gitcomp_nl "$(__git_refs "$remote")" "$pfx" "$cur_" + else + __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" + fi + ;; + push) + if [ $lhs = 1 ]; then + __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" + else + __gitcomp_nl "$(__git_refs "$remote")" "$pfx" "$cur_" + fi + ;; + esac +} + +__git_complete_strategy () +{ + __git_compute_merge_strategies + case "$prev" in + -s|--strategy) + __gitcomp "$__git_merge_strategies" + return 0 + esac + case "$cur" in + --strategy=*) + __gitcomp "$__git_merge_strategies" "" "${cur##--strategy=}" + return 0 + ;; + esac + return 1 +} + +__git_commands () { + if test -n "${GIT_TESTING_COMMAND_COMPLETION:-}" + then + printf "%s" "${GIT_TESTING_COMMAND_COMPLETION}" + else + git help -a|egrep '^ [a-zA-Z0-9]' + fi +} + +__git_list_all_commands () +{ + local i IFS=" "$'\n' + for i in $(__git_commands) + do + case $i in + *--*) : helper pattern;; + *) echo $i;; + esac + done +} + +__git_all_commands= +__git_compute_all_commands () +{ + test -n "$__git_all_commands" || + __git_all_commands=$(__git_list_all_commands) +} + +__git_list_porcelain_commands () +{ + local i IFS=" "$'\n' + __git_compute_all_commands + for i in $__git_all_commands + do + case $i in + *--*) : helper pattern;; + applymbox) : ask gittus;; + applypatch) : ask gittus;; + archimport) : import;; + cat-file) : plumbing;; + check-attr) : plumbing;; + check-ignore) : plumbing;; + check-mailmap) : plumbing;; + check-ref-format) : plumbing;; + checkout-index) : plumbing;; + column) : internal helper;; + commit-tree) : plumbing;; + count-objects) : infrequent;; + credential) : credentials;; + credential-*) : credentials helper;; + cvsexportcommit) : export;; + cvsimport) : import;; + cvsserver) : daemon;; + daemon) : daemon;; + diff-files) : plumbing;; + diff-index) : plumbing;; + diff-tree) : plumbing;; + fast-import) : import;; + fast-export) : export;; + fsck-objects) : plumbing;; + fetch-pack) : plumbing;; + fmt-merge-msg) : plumbing;; + for-each-ref) : plumbing;; + hash-object) : plumbing;; + http-*) : transport;; + index-pack) : plumbing;; + init-db) : deprecated;; + local-fetch) : plumbing;; + ls-files) : plumbing;; + ls-remote) : plumbing;; + ls-tree) : plumbing;; + mailinfo) : plumbing;; + mailsplit) : plumbing;; + merge-*) : plumbing;; + mktree) : plumbing;; + mktag) : plumbing;; + pack-objects) : plumbing;; + pack-redundant) : plumbing;; + pack-refs) : plumbing;; + parse-remote) : plumbing;; + patch-id) : plumbing;; + prune) : plumbing;; + prune-packed) : plumbing;; + quiltimport) : import;; + read-tree) : plumbing;; + receive-pack) : plumbing;; + remote-*) : transport;; + rerere) : plumbing;; + rev-list) : plumbing;; + rev-parse) : plumbing;; + runstatus) : plumbing;; + sh-setup) : internal;; + shell) : daemon;; + show-ref) : plumbing;; + send-pack) : plumbing;; + show-index) : plumbing;; + ssh-*) : transport;; + stripspace) : plumbing;; + symbolic-ref) : plumbing;; + unpack-file) : plumbing;; + unpack-objects) : plumbing;; + update-index) : plumbing;; + update-ref) : plumbing;; + update-server-info) : daemon;; + upload-archive) : plumbing;; + upload-pack) : plumbing;; + write-tree) : plumbing;; + var) : infrequent;; + verify-pack) : infrequent;; + verify-tag) : plumbing;; + *) echo $i;; + esac + done +} + +__git_porcelain_commands= +__git_compute_porcelain_commands () +{ + test -n "$__git_porcelain_commands" || + __git_porcelain_commands=$(__git_list_porcelain_commands) +} + +# Lists all set config variables starting with the given section prefix, +# with the prefix removed. +__git_get_config_variables () +{ + local section="$1" i IFS=$'\n' + for i in $(git --git-dir="$(__gitdir)" config --name-only --get-regexp "^$section\..*" 2>/dev/null); do + echo "${i#$section.}" + done +} + +__git_pretty_aliases () +{ + __git_get_config_variables "pretty" +} + +__git_aliases () +{ + __git_get_config_variables "alias" +} + +# __git_aliased_command requires 1 argument +__git_aliased_command () +{ + local word cmdline=$(git --git-dir="$(__gitdir)" \ + config --get "alias.$1") + for word in $cmdline; do + case "$word" in + \!gitk|gitk) + echo "gitk" + return + ;; + \!*) : shell command alias ;; + -*) : option ;; + *=*) : setting env ;; + git) : git itself ;; + \(\)) : skip parens of shell function definition ;; + {) : skip start of shell helper function ;; + :) : skip null command ;; + \'*) : skip opening quote after sh -c ;; + *) + echo "$word" + return + esac + done +} + +# __git_find_on_cmdline requires 1 argument +__git_find_on_cmdline () +{ + local word subcommand c=1 + while [ $c -lt $cword ]; do + word="${words[c]}" + for subcommand in $1; do + if [ "$subcommand" = "$word" ]; then + echo "$subcommand" + return + fi + done + ((c++)) + done +} + +__git_has_doubledash () +{ + local c=1 + while [ $c -lt $cword ]; do + if [ "--" = "${words[c]}" ]; then + return 0 + fi + ((c++)) + done + return 1 +} + +# Try to count non option arguments passed on the command line for the +# specified git command. +# When options are used, it is necessary to use the special -- option to +# tell the implementation were non option arguments begin. +# XXX this can not be improved, since options can appear everywhere, as +# an example: +# git mv x -n y +# +# __git_count_arguments requires 1 argument: the git command executed. +__git_count_arguments () +{ + local word i c=0 + + # Skip "git" (first argument) + for ((i=1; i < ${#words[@]}; i++)); do + word="${words[i]}" + + case "$word" in + --) + # Good; we can assume that the following are only non + # option arguments. + ((c = 0)) + ;; + "$1") + # Skip the specified git command and discard git + # main options + ((c = 0)) + ;; + ?*) + ((c++)) + ;; + esac + done + + printf "%d" $c +} + +__git_whitespacelist="nowarn warn error error-all fix" + +_git_am () +{ + local dir="$(__gitdir)" + if [ -d "$dir"/rebase-apply ]; then + __gitcomp "--skip --continue --resolved --abort" + return + fi + case "$cur" in + --whitespace=*) + __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" + return + ;; + --*) + __gitcomp " + --3way --committer-date-is-author-date --ignore-date + --ignore-whitespace --ignore-space-change + --interactive --keep --no-utf8 --signoff --utf8 + --whitespace= --scissors + " + return + esac +} + +_git_apply () +{ + case "$cur" in + --whitespace=*) + __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" + return + ;; + --*) + __gitcomp " + --stat --numstat --summary --check --index + --cached --index-info --reverse --reject --unidiff-zero + --apply --no-add --exclude= + --ignore-whitespace --ignore-space-change + --whitespace= --inaccurate-eof --verbose + " + return + esac +} + +_git_add () +{ + case "$cur" in + --*) + __gitcomp " + --interactive --refresh --patch --update --dry-run + --ignore-errors --intent-to-add + " + return + esac + + # XXX should we check for --update and --all options ? + __git_complete_index_file "--others --modified --directory --no-empty-directory" +} + +_git_archive () +{ + case "$cur" in + --format=*) + __gitcomp "$(git archive --list)" "" "${cur##--format=}" + return + ;; + --remote=*) + __gitcomp_nl "$(__git_remotes)" "" "${cur##--remote=}" + return + ;; + --*) + __gitcomp " + --format= --list --verbose + --prefix= --remote= --exec= + " + return + ;; + esac + __git_complete_file +} + +_git_bisect () +{ + __git_has_doubledash && return + + local subcommands="start bad good skip reset visualize replay log run" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + if [ -f "$(__gitdir)"/BISECT_START ]; then + __gitcomp "$subcommands" + else + __gitcomp "replay start" + fi + return + fi + + case "$subcommand" in + bad|good|reset|skip|start) + __gitcomp_nl "$(__git_refs)" + ;; + *) + ;; + esac +} + +_git_branch () +{ + local i c=1 only_local_ref="n" has_r="n" + + while [ $c -lt $cword ]; do + i="${words[c]}" + case "$i" in + -d|-m) only_local_ref="y" ;; + -r) has_r="y" ;; + esac + ((c++)) + done + + case "$cur" in + --set-upstream-to=*) + __gitcomp_nl "$(__git_refs)" "" "${cur##--set-upstream-to=}" + ;; + --*) + __gitcomp " + --color --no-color --verbose --abbrev= --no-abbrev + --track --no-track --contains --merged --no-merged + --set-upstream-to= --edit-description --list + --unset-upstream + " + ;; + *) + if [ $only_local_ref = "y" -a $has_r = "n" ]; then + __gitcomp_nl "$(__git_heads)" + else + __gitcomp_nl "$(__git_refs)" + fi + ;; + esac +} + +_git_bundle () +{ + local cmd="${words[2]}" + case "$cword" in + 2) + __gitcomp "create list-heads verify unbundle" + ;; + 3) + # looking for a file + ;; + *) + case "$cmd" in + create) + __git_complete_revlist + ;; + esac + ;; + esac +} + +_git_checkout () +{ + __git_has_doubledash && return + + case "$cur" in + --conflict=*) + __gitcomp "diff3 merge" "" "${cur##--conflict=}" + ;; + --*) + __gitcomp " + --quiet --ours --theirs --track --no-track --merge + --conflict= --orphan --patch + " + ;; + *) + # check if --track, --no-track, or --no-guess was specified + # if so, disable DWIM mode + local flags="--track --no-track --no-guess" track=1 + if [ -n "$(__git_find_on_cmdline "$flags")" ]; then + track='' + fi + __gitcomp_nl "$(__git_refs '' $track)" + ;; + esac +} + +_git_cherry () +{ + __gitcomp_nl "$(__git_refs)" +} + +_git_cherry_pick () +{ + local dir="$(__gitdir)" + if [ -f "$dir"/CHERRY_PICK_HEAD ]; then + __gitcomp "--continue --quit --abort" + return + fi + case "$cur" in + --*) + __gitcomp "--edit --no-commit --signoff --strategy= --mainline" + ;; + *) + __gitcomp_nl "$(__git_refs)" + ;; + esac +} + +_git_clean () +{ + case "$cur" in + --*) + __gitcomp "--dry-run --quiet" + return + ;; + esac + + # XXX should we check for -x option ? + __git_complete_index_file "--others --directory" +} + +_git_clone () +{ + case "$cur" in + --*) + __gitcomp " + --local + --no-hardlinks + --shared + --reference + --quiet + --no-checkout + --bare + --mirror + --origin + --upload-pack + --template= + --depth + --single-branch + --branch + " + return + ;; + esac +} + +_git_commit () +{ + case "$prev" in + -c|-C) + __gitcomp_nl "$(__git_refs)" "" "${cur}" + return + ;; + esac + + case "$cur" in + --cleanup=*) + __gitcomp "default scissors strip verbatim whitespace + " "" "${cur##--cleanup=}" + return + ;; + --reuse-message=*|--reedit-message=*|\ + --fixup=*|--squash=*) + __gitcomp_nl "$(__git_refs)" "" "${cur#*=}" + return + ;; + --untracked-files=*) + __gitcomp "all no normal" "" "${cur##--untracked-files=}" + return + ;; + --*) + __gitcomp " + --all --author= --signoff --verify --no-verify + --edit --no-edit + --amend --include --only --interactive + --dry-run --reuse-message= --reedit-message= + --reset-author --file= --message= --template= + --cleanup= --untracked-files --untracked-files= + --verbose --quiet --fixup= --squash= + " + return + esac + + if git rev-parse --verify --quiet HEAD >/dev/null; then + __git_complete_index_file "--committable" + else + # This is the first commit + __git_complete_index_file "--cached" + fi +} + +_git_describe () +{ + case "$cur" in + --*) + __gitcomp " + --all --tags --contains --abbrev= --candidates= + --exact-match --debug --long --match --always + " + return + esac + __gitcomp_nl "$(__git_refs)" +} + +__git_diff_algorithms="myers minimal patience histogram" + +__git_diff_common_options="--stat --numstat --shortstat --summary + --patch-with-stat --name-only --name-status --color + --no-color --color-words --no-renames --check + --full-index --binary --abbrev --diff-filter= + --find-copies-harder + --text --ignore-space-at-eol --ignore-space-change + --ignore-all-space --ignore-blank-lines --exit-code + --quiet --ext-diff --no-ext-diff + --no-prefix --src-prefix= --dst-prefix= + --inter-hunk-context= + --patience --histogram --minimal + --raw --word-diff --word-diff-regex= + --dirstat --dirstat= --dirstat-by-file + --dirstat-by-file= --cumulative + --diff-algorithm= +" + +_git_diff () +{ + __git_has_doubledash && return + + case "$cur" in + --diff-algorithm=*) + __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" + return + ;; + --*) + __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex + --base --ours --theirs --no-index + $__git_diff_common_options + " + return + ;; + esac + __git_complete_revlist_file +} + +__git_mergetools_common="diffuse diffmerge ecmerge emerge kdiff3 meld opendiff + tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc codecompare +" + +_git_difftool () +{ + __git_has_doubledash && return + + case "$cur" in + --tool=*) + __gitcomp "$__git_mergetools_common kompare" "" "${cur##--tool=}" + return + ;; + --*) + __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex + --base --ours --theirs + --no-renames --diff-filter= --find-copies-harder + --relative --ignore-submodules + --tool=" + return + ;; + esac + __git_complete_revlist_file +} + +__git_fetch_recurse_submodules="yes on-demand no" + +__git_fetch_options=" + --quiet --verbose --append --upload-pack --force --keep --depth= + --tags --no-tags --all --prune --dry-run --recurse-submodules= +" + +_git_fetch () +{ + case "$cur" in + --recurse-submodules=*) + __gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}" + return + ;; + --*) + __gitcomp "$__git_fetch_options" + return + ;; + esac + __git_complete_remote_or_refspec +} + +__git_format_patch_options=" + --stdout --attach --no-attach --thread --thread= --no-thread + --numbered --start-number --numbered-files --keep-subject --signoff + --signature --no-signature --in-reply-to= --cc= --full-index --binary + --not --all --cover-letter --no-prefix --src-prefix= --dst-prefix= + --inline --suffix= --ignore-if-in-upstream --subject-prefix= + --output-directory --reroll-count --to= --quiet --notes +" + +_git_format_patch () +{ + case "$cur" in + --thread=*) + __gitcomp " + deep shallow + " "" "${cur##--thread=}" + return + ;; + --*) + __gitcomp "$__git_format_patch_options" + return + ;; + esac + __git_complete_revlist +} + +_git_fsck () +{ + case "$cur" in + --*) + __gitcomp " + --tags --root --unreachable --cache --no-reflogs --full + --strict --verbose --lost-found + " + return + ;; + esac +} + +_git_gc () +{ + case "$cur" in + --*) + __gitcomp "--prune --aggressive" + return + ;; + esac +} + +_git_gitk () +{ + _gitk +} + +__git_match_ctag() { + awk "/^${1//\//\\/}/ { print \$1 }" "$2" +} + +_git_grep () +{ + __git_has_doubledash && return + + case "$cur" in + --*) + __gitcomp " + --cached + --text --ignore-case --word-regexp --invert-match + --full-name --line-number + --extended-regexp --basic-regexp --fixed-strings + --perl-regexp + --threads + --files-with-matches --name-only + --files-without-match + --max-depth + --count + --and --or --not --all-match + " + return + ;; + esac + + case "$cword,$prev" in + 2,*|*,-*) + if test -r tags; then + __gitcomp_nl "$(__git_match_ctag "$cur" tags)" + return + fi + ;; + esac + + __gitcomp_nl "$(__git_refs)" +} + +_git_help () +{ + case "$cur" in + --*) + __gitcomp "--all --info --man --web" + return + ;; + esac + __git_compute_all_commands + __gitcomp "$__git_all_commands $(__git_aliases) + attributes cli core-tutorial cvs-migration + diffcore gitk glossary hooks ignore modules + namespaces repository-layout tutorial tutorial-2 + workflows + " +} + +_git_init () +{ + case "$cur" in + --shared=*) + __gitcomp " + false true umask group all world everybody + " "" "${cur##--shared=}" + return + ;; + --*) + __gitcomp "--quiet --bare --template= --shared --shared=" + return + ;; + esac +} + +_git_ls_files () +{ + case "$cur" in + --*) + __gitcomp "--cached --deleted --modified --others --ignored + --stage --directory --no-empty-directory --unmerged + --killed --exclude= --exclude-from= + --exclude-per-directory= --exclude-standard + --error-unmatch --with-tree= --full-name + --abbrev --ignored --exclude-per-directory + " + return + ;; + esac + + # XXX ignore options like --modified and always suggest all cached + # files. + __git_complete_index_file "--cached" +} + +_git_ls_remote () +{ + __gitcomp_nl "$(__git_remotes)" +} + +_git_ls_tree () +{ + __git_complete_file +} + +# Options that go well for log, shortlog and gitk +__git_log_common_options=" + --not --all + --branches --tags --remotes + --first-parent --merges --no-merges + --max-count= + --max-age= --since= --after= + --min-age= --until= --before= + --min-parents= --max-parents= + --no-min-parents --no-max-parents +" +# Options that go well for log and gitk (not shortlog) +__git_log_gitk_options=" + --dense --sparse --full-history + --simplify-merges --simplify-by-decoration + --left-right --notes --no-notes +" +# Options that go well for log and shortlog (not gitk) +__git_log_shortlog_options=" + --author= --committer= --grep= + --all-match --invert-grep +" + +__git_log_pretty_formats="oneline short medium full fuller email raw format:" +__git_log_date_formats="relative iso8601 rfc2822 short local default raw" + +_git_log () +{ + __git_has_doubledash && return + + local g="$(git rev-parse --git-dir 2>/dev/null)" + local merge="" + if [ -f "$g/MERGE_HEAD" ]; then + merge="--merge" + fi + case "$cur" in + --pretty=*|--format=*) + __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) + " "" "${cur#*=}" + return + ;; + --date=*) + __gitcomp "$__git_log_date_formats" "" "${cur##--date=}" + return + ;; + --decorate=*) + __gitcomp "full short no" "" "${cur##--decorate=}" + return + ;; + --*) + __gitcomp " + $__git_log_common_options + $__git_log_shortlog_options + $__git_log_gitk_options + --root --topo-order --date-order --reverse + --follow --full-diff + --abbrev-commit --abbrev= + --relative-date --date= + --pretty= --format= --oneline + --show-signature + --cherry-pick + --graph + --decorate --decorate= + --walk-reflogs + --parents --children + $merge + $__git_diff_common_options + --pickaxe-all --pickaxe-regex + " + return + ;; + esac + __git_complete_revlist +} + +# Common merge options shared by git-merge(1) and git-pull(1). +__git_merge_options=" + --no-commit --no-stat --log --no-log --squash --strategy + --commit --stat --no-squash --ff --no-ff --ff-only --edit --no-edit + --verify-signatures --no-verify-signatures --gpg-sign + --quiet --verbose --progress --no-progress +" + +_git_merge () +{ + __git_complete_strategy && return + + case "$cur" in + --*) + __gitcomp "$__git_merge_options + --rerere-autoupdate --no-rerere-autoupdate --abort" + return + esac + __gitcomp_nl "$(__git_refs)" +} + +_git_mergetool () +{ + case "$cur" in + --tool=*) + __gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}" + return + ;; + --*) + __gitcomp "--tool=" + return + ;; + esac +} + +_git_merge_base () +{ + case "$cur" in + --*) + __gitcomp "--octopus --independent --is-ancestor --fork-point" + return + ;; + esac + __gitcomp_nl "$(__git_refs)" +} + +_git_mv () +{ + case "$cur" in + --*) + __gitcomp "--dry-run" + return + ;; + esac + + if [ $(__git_count_arguments "mv") -gt 0 ]; then + # We need to show both cached and untracked files (including + # empty directories) since this may not be the last argument. + __git_complete_index_file "--cached --others --directory" + else + __git_complete_index_file "--cached" + fi +} + +_git_name_rev () +{ + __gitcomp "--tags --all --stdin" +} + +_git_notes () +{ + local subcommands='add append copy edit list prune remove show' + local subcommand="$(__git_find_on_cmdline "$subcommands")" + + case "$subcommand,$cur" in + ,--*) + __gitcomp '--ref' + ;; + ,*) + case "$prev" in + --ref) + __gitcomp_nl "$(__git_refs)" + ;; + *) + __gitcomp "$subcommands --ref" + ;; + esac + ;; + add,--reuse-message=*|append,--reuse-message=*|\ + add,--reedit-message=*|append,--reedit-message=*) + __gitcomp_nl "$(__git_refs)" "" "${cur#*=}" + ;; + add,--*|append,--*) + __gitcomp '--file= --message= --reedit-message= + --reuse-message=' + ;; + copy,--*) + __gitcomp '--stdin' + ;; + prune,--*) + __gitcomp '--dry-run --verbose' + ;; + prune,*) + ;; + *) + case "$prev" in + -m|-F) + ;; + *) + __gitcomp_nl "$(__git_refs)" + ;; + esac + ;; + esac +} + +_git_pull () +{ + __git_complete_strategy && return + + case "$cur" in + --recurse-submodules=*) + __gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}" + return + ;; + --*) + __gitcomp " + --rebase --no-rebase + $__git_merge_options + $__git_fetch_options + " + return + ;; + esac + __git_complete_remote_or_refspec +} + +__git_push_recurse_submodules="check on-demand" + +__git_complete_force_with_lease () +{ + local cur_=$1 + + case "$cur_" in + --*=) + ;; + *:*) + __gitcomp_nl "$(__git_refs)" "" "${cur_#*:}" + ;; + *) + __gitcomp_nl "$(__git_refs)" "" "$cur_" + ;; + esac +} + +_git_push () +{ + case "$prev" in + --repo) + __gitcomp_nl "$(__git_remotes)" + return + ;; + --recurse-submodules) + __gitcomp "$__git_push_recurse_submodules" + return + ;; + esac + case "$cur" in + --repo=*) + __gitcomp_nl "$(__git_remotes)" "" "${cur##--repo=}" + return + ;; + --recurse-submodules=*) + __gitcomp "$__git_push_recurse_submodules" "" "${cur##--recurse-submodules=}" + return + ;; + --force-with-lease=*) + __git_complete_force_with_lease "${cur##--force-with-lease=}" + return + ;; + --*) + __gitcomp " + --all --mirror --tags --dry-run --force --verbose + --quiet --prune --delete --follow-tags + --receive-pack= --repo= --set-upstream + --force-with-lease --force-with-lease= --recurse-submodules= + " + return + ;; + esac + __git_complete_remote_or_refspec +} + +_git_rebase () +{ + local dir="$(__gitdir)" + if [ -f "$dir"/rebase-merge/interactive ]; then + __gitcomp "--continue --skip --abort --edit-todo" + return + elif [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then + __gitcomp "--continue --skip --abort" + return + fi + __git_complete_strategy && return + case "$cur" in + --whitespace=*) + __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" + return + ;; + --*) + __gitcomp " + --onto --merge --strategy --interactive + --preserve-merges --stat --no-stat + --committer-date-is-author-date --ignore-date + --ignore-whitespace --whitespace= + --autosquash --no-autosquash + --fork-point --no-fork-point + --autostash --no-autostash + --verify --no-verify + --keep-empty --root --force-rebase --no-ff + --exec + " + + return + esac + __gitcomp_nl "$(__git_refs)" +} + +_git_reflog () +{ + local subcommands="show delete expire" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + else + __gitcomp_nl "$(__git_refs)" + fi +} + +__git_send_email_confirm_options="always never auto cc compose" +__git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all" + +_git_send_email () +{ + case "$prev" in + --to|--cc|--bcc|--from) + __gitcomp " + $(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null) + " + return + ;; + esac + + case "$cur" in + --confirm=*) + __gitcomp " + $__git_send_email_confirm_options + " "" "${cur##--confirm=}" + return + ;; + --suppress-cc=*) + __gitcomp " + $__git_send_email_suppresscc_options + " "" "${cur##--suppress-cc=}" + + return + ;; + --smtp-encryption=*) + __gitcomp "ssl tls" "" "${cur##--smtp-encryption=}" + return + ;; + --thread=*) + __gitcomp " + deep shallow + " "" "${cur##--thread=}" + return + ;; + --to=*|--cc=*|--bcc=*|--from=*) + __gitcomp " + $(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null) + " "" "${cur#--*=}" + return + ;; + --*) + __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to + --compose --confirm= --dry-run --envelope-sender + --from --identity + --in-reply-to --no-chain-reply-to --no-signed-off-by-cc + --no-suppress-from --no-thread --quiet + --signed-off-by-cc --smtp-pass --smtp-server + --smtp-server-port --smtp-encryption= --smtp-user + --subject --suppress-cc= --suppress-from --thread --to + --validate --no-validate + $__git_format_patch_options" + return + ;; + esac + __git_complete_revlist +} + +_git_stage () +{ + _git_add +} + +__git_config_get_set_variables () +{ + local prevword word config_file= c=$cword + while [ $c -gt 1 ]; do + word="${words[c]}" + case "$word" in + --system|--global|--local|--file=*) + config_file="$word" + break + ;; + -f|--file) + config_file="$word $prevword" + break + ;; + esac + prevword=$word + c=$((--c)) + done + + git --git-dir="$(__gitdir)" config $config_file --name-only --list 2>/dev/null +} + +_git_config () +{ + case "$prev" in + branch.*.remote|branch.*.pushremote) + __gitcomp_nl "$(__git_remotes)" + return + ;; + branch.*.merge) + __gitcomp_nl "$(__git_refs)" + return + ;; + branch.*.rebase) + __gitcomp "false true preserve interactive" + return + ;; + remote.pushdefault) + __gitcomp_nl "$(__git_remotes)" + return + ;; + remote.*.fetch) + local remote="${prev#remote.}" + remote="${remote%.fetch}" + if [ -z "$cur" ]; then + __gitcomp_nl "refs/heads/" "" "" "" + return + fi + __gitcomp_nl "$(__git_refs_remotes "$remote")" + return + ;; + remote.*.push) + local remote="${prev#remote.}" + remote="${remote%.push}" + __gitcomp_nl "$(git --git-dir="$(__gitdir)" \ + for-each-ref --format='%(refname):%(refname)' \ + refs/heads)" + return + ;; + pull.twohead|pull.octopus) + __git_compute_merge_strategies + __gitcomp "$__git_merge_strategies" + return + ;; + color.branch|color.diff|color.interactive|\ + color.showbranch|color.status|color.ui) + __gitcomp "always never auto" + return + ;; + color.pager) + __gitcomp "false true" + return + ;; + color.*.*) + __gitcomp " + normal black red green yellow blue magenta cyan white + bold dim ul blink reverse + " + return + ;; + diff.submodule) + __gitcomp "log short" + return + ;; + help.format) + __gitcomp "man info web html" + return + ;; + log.date) + __gitcomp "$__git_log_date_formats" + return + ;; + sendemail.aliasesfiletype) + __gitcomp "mutt mailrc pine elm gnus" + return + ;; + sendemail.confirm) + __gitcomp "$__git_send_email_confirm_options" + return + ;; + sendemail.suppresscc) + __gitcomp "$__git_send_email_suppresscc_options" + return + ;; + sendemail.transferencoding) + __gitcomp "7bit 8bit quoted-printable base64" + return + ;; + --get|--get-all|--unset|--unset-all) + __gitcomp_nl "$(__git_config_get_set_variables)" + return + ;; + *.*) + return + ;; + esac + case "$cur" in + --*) + __gitcomp " + --system --global --local --file= + --list --replace-all + --get --get-all --get-regexp + --add --unset --unset-all + --remove-section --rename-section + --name-only + " + return + ;; + branch.*.*) + local pfx="${cur%.*}." cur_="${cur##*.}" + __gitcomp "remote pushremote merge mergeoptions rebase" "$pfx" "$cur_" + return + ;; + branch.*) + local pfx="${cur%.*}." cur_="${cur#*.}" + __gitcomp_nl "$(__git_heads)" "$pfx" "$cur_" "." + __gitcomp_nl_append $'autosetupmerge\nautosetuprebase\n' "$pfx" "$cur_" + return + ;; + guitool.*.*) + local pfx="${cur%.*}." cur_="${cur##*.}" + __gitcomp " + argprompt cmd confirm needsfile noconsole norescan + prompt revprompt revunmerged title + " "$pfx" "$cur_" + return + ;; + difftool.*.*) + local pfx="${cur%.*}." cur_="${cur##*.}" + __gitcomp "cmd path" "$pfx" "$cur_" + return + ;; + man.*.*) + local pfx="${cur%.*}." cur_="${cur##*.}" + __gitcomp "cmd path" "$pfx" "$cur_" + return + ;; + mergetool.*.*) + local pfx="${cur%.*}." cur_="${cur##*.}" + __gitcomp "cmd path trustExitCode" "$pfx" "$cur_" + return + ;; + pager.*) + local pfx="${cur%.*}." cur_="${cur#*.}" + __git_compute_all_commands + __gitcomp_nl "$__git_all_commands" "$pfx" "$cur_" + return + ;; + remote.*.*) + local pfx="${cur%.*}." cur_="${cur##*.}" + __gitcomp " + url proxy fetch push mirror skipDefaultUpdate + receivepack uploadpack tagopt pushurl + " "$pfx" "$cur_" + return + ;; + remote.*) + local pfx="${cur%.*}." cur_="${cur#*.}" + __gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "." + __gitcomp_nl_append "pushdefault" "$pfx" "$cur_" + return + ;; + url.*.*) + local pfx="${cur%.*}." cur_="${cur##*.}" + __gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_" + return + ;; + esac + __gitcomp " + add.ignoreErrors + advice.commitBeforeMerge + advice.detachedHead + advice.implicitIdentity + advice.pushNonFastForward + advice.resolveConflict + advice.statusHints + alias. + am.keepcr + apply.ignorewhitespace + apply.whitespace + branch.autosetupmerge + branch.autosetuprebase + browser. + clean.requireForce + color.branch + color.branch.current + color.branch.local + color.branch.plain + color.branch.remote + color.decorate.HEAD + color.decorate.branch + color.decorate.remoteBranch + color.decorate.stash + color.decorate.tag + color.diff + color.diff.commit + color.diff.frag + color.diff.func + color.diff.meta + color.diff.new + color.diff.old + color.diff.plain + color.diff.whitespace + color.grep + color.grep.context + color.grep.filename + color.grep.function + color.grep.linenumber + color.grep.match + color.grep.selected + color.grep.separator + color.interactive + color.interactive.error + color.interactive.header + color.interactive.help + color.interactive.prompt + color.pager + color.showbranch + color.status + color.status.added + color.status.changed + color.status.header + color.status.nobranch + color.status.unmerged + color.status.untracked + color.status.updated + color.ui + commit.status + commit.template + core.abbrev + core.askpass + core.attributesfile + core.autocrlf + core.bare + core.bigFileThreshold + core.compression + core.createObject + core.deltaBaseCacheLimit + core.editor + core.eol + core.excludesfile + core.fileMode + core.fsyncobjectfiles + core.gitProxy + core.ignoreStat + core.ignorecase + core.logAllRefUpdates + core.loosecompression + core.notesRef + core.packedGitLimit + core.packedGitWindowSize + core.pager + core.preferSymlinkRefs + core.preloadindex + core.quotepath + core.repositoryFormatVersion + core.safecrlf + core.sharedRepository + core.sparseCheckout + core.symlinks + core.trustctime + core.untrackedCache + core.warnAmbiguousRefs + core.whitespace + core.worktree + diff.autorefreshindex + diff.external + diff.ignoreSubmodules + diff.mnemonicprefix + diff.noprefix + diff.renameLimit + diff.renames + diff.statGraphWidth + diff.submodule + diff.suppressBlankEmpty + diff.tool + diff.wordRegex + diff.algorithm + difftool. + difftool.prompt + fetch.recurseSubmodules + fetch.unpackLimit + format.attach + format.cc + format.coverLetter + format.headers + format.numbered + format.pretty + format.signature + format.signoff + format.subjectprefix + format.suffix + format.thread + format.to + gc. + gc.aggressiveWindow + gc.auto + gc.autopacklimit + gc.packrefs + gc.pruneexpire + gc.reflogexpire + gc.reflogexpireunreachable + gc.rerereresolved + gc.rerereunresolved + gitcvs.allbinary + gitcvs.commitmsgannotation + gitcvs.dbTableNamePrefix + gitcvs.dbdriver + gitcvs.dbname + gitcvs.dbpass + gitcvs.dbuser + gitcvs.enabled + gitcvs.logfile + gitcvs.usecrlfattr + guitool. + gui.blamehistoryctx + gui.commitmsgwidth + gui.copyblamethreshold + gui.diffcontext + gui.encoding + gui.fastcopyblame + gui.matchtrackingbranch + gui.newbranchtemplate + gui.pruneduringfetch + gui.spellingdictionary + gui.trustmtime + help.autocorrect + help.browser + help.format + http.lowSpeedLimit + http.lowSpeedTime + http.maxRequests + http.minSessions + http.noEPSV + http.postBuffer + http.proxy + http.sslCipherList + http.sslVersion + http.sslCAInfo + http.sslCAPath + http.sslCert + http.sslCertPasswordProtected + http.sslKey + http.sslVerify + http.useragent + i18n.commitEncoding + i18n.logOutputEncoding + imap.authMethod + imap.folder + imap.host + imap.pass + imap.port + imap.preformattedHTML + imap.sslverify + imap.tunnel + imap.user + init.templatedir + instaweb.browser + instaweb.httpd + instaweb.local + instaweb.modulepath + instaweb.port + interactive.singlekey + log.date + log.decorate + log.showroot + mailmap.file + man. + man.viewer + merge. + merge.conflictstyle + merge.log + merge.renameLimit + merge.renormalize + merge.stat + merge.tool + merge.verbosity + mergetool. + mergetool.keepBackup + mergetool.keepTemporaries + mergetool.prompt + notes.displayRef + notes.rewrite. + notes.rewrite.amend + notes.rewrite.rebase + notes.rewriteMode + notes.rewriteRef + pack.compression + pack.deltaCacheLimit + pack.deltaCacheSize + pack.depth + pack.indexVersion + pack.packSizeLimit + pack.threads + pack.window + pack.windowMemory + pager. + pretty. + pull.octopus + pull.twohead + push.default + push.followTags + rebase.autosquash + rebase.stat + receive.autogc + receive.denyCurrentBranch + receive.denyDeleteCurrent + receive.denyDeletes + receive.denyNonFastForwards + receive.fsckObjects + receive.unpackLimit + receive.updateserverinfo + remote.pushdefault + remotes. + repack.usedeltabaseoffset + rerere.autoupdate + rerere.enabled + sendemail. + sendemail.aliasesfile + sendemail.aliasfiletype + sendemail.bcc + sendemail.cc + sendemail.cccmd + sendemail.chainreplyto + sendemail.confirm + sendemail.envelopesender + sendemail.from + sendemail.identity + sendemail.multiedit + sendemail.signedoffbycc + sendemail.smtpdomain + sendemail.smtpencryption + sendemail.smtppass + sendemail.smtpserver + sendemail.smtpserveroption + sendemail.smtpserverport + sendemail.smtpuser + sendemail.suppresscc + sendemail.suppressfrom + sendemail.thread + sendemail.to + sendemail.validate + showbranch.default + status.relativePaths + status.showUntrackedFiles + status.submodulesummary + submodule. + tar.umask + transfer.unpackLimit + url. + user.email + user.name + user.signingkey + web.browser + branch. remote. + " +} + +_git_remote () +{ + local subcommands="add rename remove set-head set-branches set-url show prune update" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + return + fi + + case "$subcommand" in + rename|remove|set-url|show|prune) + __gitcomp_nl "$(__git_remotes)" + ;; + set-head|set-branches) + __git_complete_remote_or_refspec + ;; + update) + __gitcomp "$(__git_get_config_variables "remotes")" + ;; + *) + ;; + esac +} + +_git_replace () +{ + __gitcomp_nl "$(__git_refs)" +} + +_git_reset () +{ + __git_has_doubledash && return + + case "$cur" in + --*) + __gitcomp "--merge --mixed --hard --soft --patch" + return + ;; + esac + __gitcomp_nl "$(__git_refs)" +} + +_git_revert () +{ + local dir="$(__gitdir)" + if [ -f "$dir"/REVERT_HEAD ]; then + __gitcomp "--continue --quit --abort" + return + fi + case "$cur" in + --*) + __gitcomp "--edit --mainline --no-edit --no-commit --signoff" + return + ;; + esac + __gitcomp_nl "$(__git_refs)" +} + +_git_rm () +{ + case "$cur" in + --*) + __gitcomp "--cached --dry-run --ignore-unmatch --quiet" + return + ;; + esac + + __git_complete_index_file "--cached" +} + +_git_shortlog () +{ + __git_has_doubledash && return + + case "$cur" in + --*) + __gitcomp " + $__git_log_common_options + $__git_log_shortlog_options + --numbered --summary + " + return + ;; + esac + __git_complete_revlist +} + +_git_show () +{ + __git_has_doubledash && return + + case "$cur" in + --pretty=*|--format=*) + __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) + " "" "${cur#*=}" + return + ;; + --diff-algorithm=*) + __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" + return + ;; + --*) + __gitcomp "--pretty= --format= --abbrev-commit --oneline + --show-signature + $__git_diff_common_options + " + return + ;; + esac + __git_complete_revlist_file +} + +_git_show_branch () +{ + case "$cur" in + --*) + __gitcomp " + --all --remotes --topo-order --date-order --current --more= + --list --independent --merge-base --no-name + --color --no-color + --sha1-name --sparse --topics --reflog + " + return + ;; + esac + __git_complete_revlist +} + +_git_stash () +{ + local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked' + local subcommands='save list show apply clear drop pop create branch' + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + case "$cur" in + --*) + __gitcomp "$save_opts" + ;; + *) + if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then + __gitcomp "$subcommands" + fi + ;; + esac + else + case "$subcommand,$cur" in + save,--*) + __gitcomp "$save_opts" + ;; + apply,--*|pop,--*) + __gitcomp "--index --quiet" + ;; + drop,--*) + __gitcomp "--quiet" + ;; + show,--*|branch,--*) + ;; + branch,*) + if [ $cword -eq 3 ]; then + __gitcomp_nl "$(__git_refs)"; + else + __gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \ + | sed -n -e 's/:.*//p')" + fi + ;; + show,*|apply,*|drop,*|pop,*) + __gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \ + | sed -n -e 's/:.*//p')" + ;; + *) + ;; + esac + fi +} + +_git_submodule () +{ + __git_has_doubledash && return + + local subcommands="add status init deinit update summary foreach sync" + if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then + case "$cur" in + --*) + __gitcomp "--quiet --cached" + ;; + *) + __gitcomp "$subcommands" + ;; + esac + return + fi +} + +_git_svn () +{ + local subcommands=" + init fetch clone rebase dcommit log find-rev + set-tree commit-diff info create-ignore propget + proplist show-ignore show-externals branch tag blame + migrate mkdirs reset gc + " + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + else + local remote_opts="--username= --config-dir= --no-auth-cache" + local fc_opts=" + --follow-parent --authors-file= --repack= + --no-metadata --use-svm-props --use-svnsync-props + --log-window-size= --no-checkout --quiet + --repack-flags --use-log-author --localtime + --ignore-paths= --include-paths= $remote_opts + " + local init_opts=" + --template= --shared= --trunk= --tags= + --branches= --stdlayout --minimize-url + --no-metadata --use-svm-props --use-svnsync-props + --rewrite-root= --prefix= --use-log-author + --add-author-from $remote_opts + " + local cmt_opts=" + --edit --rmdir --find-copies-harder --copy-similarity= + " + + case "$subcommand,$cur" in + fetch,--*) + __gitcomp "--revision= --fetch-all $fc_opts" + ;; + clone,--*) + __gitcomp "--revision= $fc_opts $init_opts" + ;; + init,--*) + __gitcomp "$init_opts" + ;; + dcommit,--*) + __gitcomp " + --merge --strategy= --verbose --dry-run + --fetch-all --no-rebase --commit-url + --revision --interactive $cmt_opts $fc_opts + " + ;; + set-tree,--*) + __gitcomp "--stdin $cmt_opts $fc_opts" + ;; + create-ignore,--*|propget,--*|proplist,--*|show-ignore,--*|\ + show-externals,--*|mkdirs,--*) + __gitcomp "--revision=" + ;; + log,--*) + __gitcomp " + --limit= --revision= --verbose --incremental + --oneline --show-commit --non-recursive + --authors-file= --color + " + ;; + rebase,--*) + __gitcomp " + --merge --verbose --strategy= --local + --fetch-all --dry-run $fc_opts + " + ;; + commit-diff,--*) + __gitcomp "--message= --file= --revision= $cmt_opts" + ;; + info,--*) + __gitcomp "--url" + ;; + branch,--*) + __gitcomp "--dry-run --message --tag" + ;; + tag,--*) + __gitcomp "--dry-run --message" + ;; + blame,--*) + __gitcomp "--git-format" + ;; + migrate,--*) + __gitcomp " + --config-dir= --ignore-paths= --minimize + --no-auth-cache --username= + " + ;; + reset,--*) + __gitcomp "--revision= --parent" + ;; + *) + ;; + esac + fi +} + +_git_tag () +{ + local i c=1 f=0 + while [ $c -lt $cword ]; do + i="${words[c]}" + case "$i" in + -d|-v) + __gitcomp_nl "$(__git_tags)" + return + ;; + -f) + f=1 + ;; + esac + ((c++)) + done + + case "$prev" in + -m|-F) + ;; + -*|tag) + if [ $f = 1 ]; then + __gitcomp_nl "$(__git_tags)" + fi + ;; + *) + __gitcomp_nl "$(__git_refs)" + ;; + esac + + case "$cur" in + --*) + __gitcomp " + --list --delete --verify --annotate --message --file + --sign --cleanup --local-user --force --column --sort + --contains --points-at + " + ;; + esac +} + +_git_whatchanged () +{ + _git_log +} + +__git_main () +{ + local i c=1 command __git_dir + + while [ $c -lt $cword ]; do + i="${words[c]}" + case "$i" in + --git-dir=*) __git_dir="${i#--git-dir=}" ;; + --git-dir) ((c++)) ; __git_dir="${words[c]}" ;; + --bare) __git_dir="." ;; + --help) command="help"; break ;; + -c|--work-tree|--namespace) ((c++)) ;; + -*) ;; + *) command="$i"; break ;; + esac + ((c++)) + done + + if [ -z "$command" ]; then + case "$cur" in + --*) __gitcomp " + --paginate + --no-pager + --git-dir= + --bare + --version + --exec-path + --exec-path= + --html-path + --man-path + --info-path + --work-tree= + --namespace= + --no-replace-objects + --help + " + ;; + *) __git_compute_porcelain_commands + __gitcomp "$__git_porcelain_commands $(__git_aliases)" ;; + esac + return + fi + + local completion_func="_git_${command//-/_}" + declare -f $completion_func >/dev/null && $completion_func && return + + local expansion=$(__git_aliased_command "$command") + if [ -n "$expansion" ]; then + words[1]=$expansion + completion_func="_git_${expansion//-/_}" + declare -f $completion_func >/dev/null && $completion_func + fi +} + +__gitk_main () +{ + __git_has_doubledash && return + + local g="$(__gitdir)" + local merge="" + if [ -f "$g/MERGE_HEAD" ]; then + merge="--merge" + fi + case "$cur" in + --*) + __gitcomp " + $__git_log_common_options + $__git_log_gitk_options + $merge + " + return + ;; + esac + __git_complete_revlist +} + +if [[ -n ${ZSH_VERSION-} ]]; then + echo "WARNING: this script is deprecated, please see git-completion.zsh" 1>&2 + + autoload -U +X compinit && compinit + + __gitcomp () + { + emulate -L zsh + + local cur_="${3-$cur}" + + case "$cur_" in + --*=) + ;; + *) + local c IFS=$' \t\n' + local -a array + for c in ${=1}; do + c="$c${4-}" + case $c in + --*=*|*.) ;; + *) c="$c " ;; + esac + array[${#array[@]}+1]="$c" + done + compset -P '*[=:]' + compadd -Q -S '' -p "${2-}" -a -- array && _ret=0 + ;; + esac + } + + __gitcomp_nl () + { + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0 + } + + __gitcomp_file () + { + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -Q -p "${2-}" -f -- ${=1} && _ret=0 + } + + _git () + { + local _ret=1 cur cword prev + cur=${words[CURRENT]} + prev=${words[CURRENT-1]} + let cword=CURRENT-1 + emulate ksh -c __${service}_main + let _ret && _default && _ret=0 + return _ret + } + + compdef _git git gitk + return +fi + +__git_func_wrap () +{ + local cur words cword prev + _get_comp_words_by_ref -n =: cur words cword prev + $1 +} + +# Setup completion for certain functions defined above by setting common +# variables and workarounds. +# This is NOT a public function; use at your own risk. +__git_complete () +{ + local wrapper="__git_wrap${2}" + eval "$wrapper () { __git_func_wrap $2 ; }" + complete -o bashdefault -o default -o nospace -F $wrapper $1 2>/dev/null \ + || complete -o default -o nospace -F $wrapper $1 +} + +# wrapper for backwards compatibility +_git () +{ + __git_wrap__git_main +} + +# wrapper for backwards compatibility +_gitk () +{ + __git_wrap__gitk_main +} + +__git_complete git __git_main +__git_complete gitk __gitk_main + +# The following are necessary only for Cygwin, and only are needed +# when the user has tab-completed the executable name and consequently +# included the '.exe' suffix. +# +if [[ "$OSTYPE" = cygwin* ]]; then +__git_complete git.exe __git_main +fi diff --git a/oh-my-zsh/plugins/gitfast/git-prompt.sh b/oh-my-zsh/plugins/gitfast/git-prompt.sh @@ -0,0 +1,533 @@ +# bash/zsh git prompt support +# +# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> +# Distributed under the GNU General Public License, version 2.0. +# +# This script allows you to see repository status in your prompt. +# +# To enable: +# +# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh). +# 2) Add the following line to your .bashrc/.zshrc: +# source ~/.git-prompt.sh +# 3a) Change your PS1 to call __git_ps1 as +# command-substitution: +# Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ ' +# ZSH: setopt PROMPT_SUBST ; PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ ' +# the optional argument will be used as format string. +# 3b) Alternatively, for a slightly faster prompt, __git_ps1 can +# be used for PROMPT_COMMAND in Bash or for precmd() in Zsh +# with two parameters, <pre> and <post>, which are strings +# you would put in $PS1 before and after the status string +# generated by the git-prompt machinery. e.g. +# Bash: PROMPT_COMMAND='__git_ps1 "\u@\h:\w" "\\\$ "' +# will show username, at-sign, host, colon, cwd, then +# various status string, followed by dollar and SP, as +# your prompt. +# ZSH: precmd () { __git_ps1 "%n" ":%~$ " "|%s" } +# will show username, pipe, then various status string, +# followed by colon, cwd, dollar and SP, as your prompt. +# Optionally, you can supply a third argument with a printf +# format string to finetune the output of the branch status +# +# The repository status will be displayed only if you are currently in a +# git repository. The %s token is the placeholder for the shown status. +# +# The prompt status always includes the current branch name. +# +# In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty value, +# unstaged (*) and staged (+) changes will be shown next to the branch +# name. You can configure this per-repository with the +# bash.showDirtyState variable, which defaults to true once +# GIT_PS1_SHOWDIRTYSTATE is enabled. +# +# You can also see if currently something is stashed, by setting +# GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed, +# then a '$' will be shown next to the branch name. +# +# If you would like to see if there're untracked files, then you can set +# GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked +# files, then a '%' will be shown next to the branch name. You can +# configure this per-repository with the bash.showUntrackedFiles +# variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is +# enabled. +# +# If you would like to see the difference between HEAD and its upstream, +# set GIT_PS1_SHOWUPSTREAM="auto". A "<" indicates you are behind, ">" +# indicates you are ahead, "<>" indicates you have diverged and "=" +# indicates that there is no difference. You can further control +# behaviour by setting GIT_PS1_SHOWUPSTREAM to a space-separated list +# of values: +# +# verbose show number of commits ahead/behind (+/-) upstream +# name if verbose, then also show the upstream abbrev name +# legacy don't use the '--count' option available in recent +# versions of git-rev-list +# git always compare HEAD to @{upstream} +# svn always compare HEAD to your SVN upstream +# +# You can change the separator between the branch name and the above +# state symbols by setting GIT_PS1_STATESEPARATOR. The default separator +# is SP. +# +# By default, __git_ps1 will compare HEAD to your SVN upstream if it can +# find one, or @{upstream} otherwise. Once you have set +# GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by +# setting the bash.showUpstream config variable. +# +# If you would like to see more information about the identity of +# commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE +# to one of these values: +# +# contains relative to newer annotated tag (v1.6.3.2~35) +# branch relative to newer tag or branch (master~4) +# describe relative to older annotated tag (v1.6.3.1-13-gdd42c2f) +# default exactly matching tag +# +# If you would like a colored hint about the current dirty state, set +# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on +# the colored output of "git status -sb" and are available only when +# using __git_ps1 for PROMPT_COMMAND or precmd. +# +# If you would like __git_ps1 to do nothing in the case when the current +# directory is set up to be ignored by git, then set +# GIT_PS1_HIDE_IF_PWD_IGNORED to a nonempty value. Override this on the +# repository level by setting bash.hideIfPwdIgnored to "false". + +# check whether printf supports -v +__git_printf_supports_v= +printf -v __git_printf_supports_v -- '%s' yes >/dev/null 2>&1 + +# stores the divergence from upstream in $p +# used by GIT_PS1_SHOWUPSTREAM +__git_ps1_show_upstream () +{ + local key value + local svn_remote svn_url_pattern count n + local upstream=git legacy="" verbose="" name="" + + svn_remote=() + # get some config options from git-config + local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')" + while read -r key value; do + case "$key" in + bash.showupstream) + GIT_PS1_SHOWUPSTREAM="$value" + if [[ -z "${GIT_PS1_SHOWUPSTREAM}" ]]; then + p="" + return + fi + ;; + svn-remote.*.url) + svn_remote[$((${#svn_remote[@]} + 1))]="$value" + svn_url_pattern="$svn_url_pattern\\|$value" + upstream=svn+git # default upstream is SVN if available, else git + ;; + esac + done <<< "$output" + + # parse configuration values + for option in ${GIT_PS1_SHOWUPSTREAM}; do + case "$option" in + git|svn) upstream="$option" ;; + verbose) verbose=1 ;; + legacy) legacy=1 ;; + name) name=1 ;; + esac + done + + # Find our upstream + case "$upstream" in + git) upstream="@{upstream}" ;; + svn*) + # get the upstream from the "git-svn-id: ..." in a commit message + # (git-svn uses essentially the same procedure internally) + local -a svn_upstream + svn_upstream=($(git log --first-parent -1 \ + --grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null)) + if [[ 0 -ne ${#svn_upstream[@]} ]]; then + svn_upstream=${svn_upstream[${#svn_upstream[@]} - 2]} + svn_upstream=${svn_upstream%@*} + local n_stop="${#svn_remote[@]}" + for ((n=1; n <= n_stop; n++)); do + svn_upstream=${svn_upstream#${svn_remote[$n]}} + done + + if [[ -z "$svn_upstream" ]]; then + # default branch name for checkouts with no layout: + upstream=${GIT_SVN_ID:-git-svn} + else + upstream=${svn_upstream#/} + fi + elif [[ "svn+git" = "$upstream" ]]; then + upstream="@{upstream}" + fi + ;; + esac + + # Find how many commits we are ahead/behind our upstream + if [[ -z "$legacy" ]]; then + count="$(git rev-list --count --left-right \ + "$upstream"...HEAD 2>/dev/null)" + else + # produce equivalent output to --count for older versions of git + local commits + if commits="$(git rev-list --left-right "$upstream"...HEAD 2>/dev/null)" + then + local commit behind=0 ahead=0 + for commit in $commits + do + case "$commit" in + "<"*) ((behind++)) ;; + *) ((ahead++)) ;; + esac + done + count="$behind $ahead" + else + count="" + fi + fi + + # calculate the result + if [[ -z "$verbose" ]]; then + case "$count" in + "") # no upstream + p="" ;; + "0 0") # equal to upstream + p="=" ;; + "0 "*) # ahead of upstream + p=">" ;; + *" 0") # behind upstream + p="<" ;; + *) # diverged from upstream + p="<>" ;; + esac + else + case "$count" in + "") # no upstream + p="" ;; + "0 0") # equal to upstream + p=" u=" ;; + "0 "*) # ahead of upstream + p=" u+${count#0 }" ;; + *" 0") # behind upstream + p=" u-${count% 0}" ;; + *) # diverged from upstream + p=" u+${count#* }-${count% *}" ;; + esac + if [[ -n "$count" && -n "$name" ]]; then + __git_ps1_upstream_name=$(git rev-parse \ + --abbrev-ref "$upstream" 2>/dev/null) + if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then + p="$p \${__git_ps1_upstream_name}" + else + p="$p ${__git_ps1_upstream_name}" + # not needed anymore; keep user's + # environment clean + unset __git_ps1_upstream_name + fi + fi + fi + +} + +# Helper function that is meant to be called from __git_ps1. It +# injects color codes into the appropriate gitstring variables used +# to build a gitstring. +__git_ps1_colorize_gitstring () +{ + if [[ -n ${ZSH_VERSION-} ]]; then + local c_red='%F{red}' + local c_green='%F{green}' + local c_lblue='%F{blue}' + local c_clear='%f' + else + # Using \[ and \] around colors is necessary to prevent + # issues with command line editing/browsing/completion! + local c_red='\[\e[31m\]' + local c_green='\[\e[32m\]' + local c_lblue='\[\e[1;34m\]' + local c_clear='\[\e[0m\]' + fi + local bad_color=$c_red + local ok_color=$c_green + local flags_color="$c_lblue" + + local branch_color="" + if [ $detached = no ]; then + branch_color="$ok_color" + else + branch_color="$bad_color" + fi + c="$branch_color$c" + + z="$c_clear$z" + if [ "$w" = "*" ]; then + w="$bad_color$w" + fi + if [ -n "$i" ]; then + i="$ok_color$i" + fi + if [ -n "$s" ]; then + s="$flags_color$s" + fi + if [ -n "$u" ]; then + u="$bad_color$u" + fi + r="$c_clear$r" +} + +__git_eread () +{ + local f="$1" + shift + test -r "$f" && read "$@" <"$f" +} + +# __git_ps1 accepts 0 or 1 arguments (i.e., format string) +# when called from PS1 using command substitution +# in this mode it prints text to add to bash PS1 prompt (includes branch name) +# +# __git_ps1 requires 2 or 3 arguments when called from PROMPT_COMMAND (pc) +# in that case it _sets_ PS1. The arguments are parts of a PS1 string. +# when two arguments are given, the first is prepended and the second appended +# to the state string when assigned to PS1. +# The optional third parameter will be used as printf format string to further +# customize the output of the git-status string. +# In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true +__git_ps1 () +{ + # preserve exit status + local exit=$? + local pcmode=no + local detached=no + local ps1pc_start='\u@\h:\w ' + local ps1pc_end='\$ ' + local printf_format=' (%s)' + + case "$#" in + 2|3) pcmode=yes + ps1pc_start="$1" + ps1pc_end="$2" + printf_format="${3:-$printf_format}" + # set PS1 to a plain prompt so that we can + # simply return early if the prompt should not + # be decorated + PS1="$ps1pc_start$ps1pc_end" + ;; + 0|1) printf_format="${1:-$printf_format}" + ;; + *) return $exit + ;; + esac + + # ps1_expanded: This variable is set to 'yes' if the shell + # subjects the value of PS1 to parameter expansion: + # + # * bash does unless the promptvars option is disabled + # * zsh does not unless the PROMPT_SUBST option is set + # * POSIX shells always do + # + # If the shell would expand the contents of PS1 when drawing + # the prompt, a raw ref name must not be included in PS1. + # This protects the user from arbitrary code execution via + # specially crafted ref names. For example, a ref named + # 'refs/heads/$(IFS=_;cmd=sudo_rm_-rf_/;$cmd)' might cause the + # shell to execute 'sudo rm -rf /' when the prompt is drawn. + # + # Instead, the ref name should be placed in a separate global + # variable (in the __git_ps1_* namespace to avoid colliding + # with the user's environment) and that variable should be + # referenced from PS1. For example: + # + # __git_ps1_foo=$(do_something_to_get_ref_name) + # PS1="...stuff...\${__git_ps1_foo}...stuff..." + # + # If the shell does not expand the contents of PS1, the raw + # ref name must be included in PS1. + # + # The value of this variable is only relevant when in pcmode. + # + # Assume that the shell follows the POSIX specification and + # expands PS1 unless determined otherwise. (This is more + # likely to be correct if the user has a non-bash, non-zsh + # shell and safer than the alternative if the assumption is + # incorrect.) + # + local ps1_expanded=yes + [ -z "$ZSH_VERSION" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no + [ -z "$BASH_VERSION" ] || shopt -q promptvars || ps1_expanded=no + + local repo_info rev_parse_exit_code + repo_info="$(git rev-parse --git-dir --is-inside-git-dir \ + --is-bare-repository --is-inside-work-tree \ + --short HEAD 2>/dev/null)" + rev_parse_exit_code="$?" + + if [ -z "$repo_info" ]; then + return $exit + fi + + local short_sha + if [ "$rev_parse_exit_code" = "0" ]; then + short_sha="${repo_info##*$'\n'}" + repo_info="${repo_info%$'\n'*}" + fi + local inside_worktree="${repo_info##*$'\n'}" + repo_info="${repo_info%$'\n'*}" + local bare_repo="${repo_info##*$'\n'}" + repo_info="${repo_info%$'\n'*}" + local inside_gitdir="${repo_info##*$'\n'}" + local g="${repo_info%$'\n'*}" + + if [ "true" = "$inside_worktree" ] && + [ -n "${GIT_PS1_HIDE_IF_PWD_IGNORED-}" ] && + [ "$(git config --bool bash.hideIfPwdIgnored)" != "false" ] && + git check-ignore -q . + then + return $exit + fi + + local r="" + local b="" + local step="" + local total="" + if [ -d "$g/rebase-merge" ]; then + __git_eread "$g/rebase-merge/head-name" b + __git_eread "$g/rebase-merge/msgnum" step + __git_eread "$g/rebase-merge/end" total + if [ -f "$g/rebase-merge/interactive" ]; then + r="|REBASE-i" + else + r="|REBASE-m" + fi + else + if [ -d "$g/rebase-apply" ]; then + __git_eread "$g/rebase-apply/next" step + __git_eread "$g/rebase-apply/last" total + if [ -f "$g/rebase-apply/rebasing" ]; then + __git_eread "$g/rebase-apply/head-name" b + r="|REBASE" + elif [ -f "$g/rebase-apply/applying" ]; then + r="|AM" + else + r="|AM/REBASE" + fi + elif [ -f "$g/MERGE_HEAD" ]; then + r="|MERGING" + elif [ -f "$g/CHERRY_PICK_HEAD" ]; then + r="|CHERRY-PICKING" + elif [ -f "$g/REVERT_HEAD" ]; then + r="|REVERTING" + elif [ -f "$g/BISECT_LOG" ]; then + r="|BISECTING" + fi + + if [ -n "$b" ]; then + : + elif [ -h "$g/HEAD" ]; then + # symlink symbolic ref + b="$(git symbolic-ref HEAD 2>/dev/null)" + else + local head="" + if ! __git_eread "$g/HEAD" head; then + return $exit + fi + # is it a symbolic ref? + b="${head#ref: }" + if [ "$head" = "$b" ]; then + detached=yes + b="$( + case "${GIT_PS1_DESCRIBE_STYLE-}" in + (contains) + git describe --contains HEAD ;; + (branch) + git describe --contains --all HEAD ;; + (describe) + git describe HEAD ;; + (* | default) + git describe --tags --exact-match HEAD ;; + esac 2>/dev/null)" || + + b="$short_sha..." + b="($b)" + fi + fi + fi + + if [ -n "$step" ] && [ -n "$total" ]; then + r="$r $step/$total" + fi + + local w="" + local i="" + local s="" + local u="" + local c="" + local p="" + + if [ "true" = "$inside_gitdir" ]; then + if [ "true" = "$bare_repo" ]; then + c="BARE:" + else + b="GIT_DIR!" + fi + elif [ "true" = "$inside_worktree" ]; then + if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] && + [ "$(git config --bool bash.showDirtyState)" != "false" ] + then + git diff --no-ext-diff --quiet || w="*" + git diff --no-ext-diff --cached --quiet || i="+" + if [ -z "$short_sha" ] && [ -z "$i" ]; then + i="#" + fi + fi + if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] && + git rev-parse --verify --quiet refs/stash >/dev/null + then + s="$" + fi + + if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] && + [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] && + git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- ':/*' >/dev/null 2>/dev/null + then + u="%${ZSH_VERSION+%}" + fi + + if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then + __git_ps1_show_upstream + fi + fi + + local z="${GIT_PS1_STATESEPARATOR-" "}" + + # NO color option unless in PROMPT_COMMAND mode or it's Zsh + if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then + if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then + __git_ps1_colorize_gitstring + fi + fi + + b=${b##refs/heads/} + if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then + __git_ps1_branch_name=$b + b="\${__git_ps1_branch_name}" + fi + + local f="$w$i$s$u" + local gitstring="$c$b${f:+$z$f}$r$p" + + if [ $pcmode = yes ]; then + if [ "${__git_printf_supports_v-}" != yes ]; then + gitstring=$(printf -- "$printf_format" "$gitstring") + else + printf -v gitstring -- "$printf_format" "$gitstring" + fi + PS1="$ps1pc_start$gitstring$ps1pc_end" + else + printf -- "$printf_format" "$gitstring" + fi + + return $exit +} diff --git a/oh-my-zsh/plugins/gitfast/gitfast.plugin.zsh b/oh-my-zsh/plugins/gitfast/gitfast.plugin.zsh @@ -0,0 +1,8 @@ +dir=$(dirname $0) +source $dir/../git/git.plugin.zsh +source $dir/git-prompt.sh + +function git_prompt_info() { + dirty="$(parse_git_dirty)" + __git_ps1 "${ZSH_THEME_GIT_PROMPT_PREFIX//\%/%%}%s${dirty//\%/%%}${ZSH_THEME_GIT_PROMPT_SUFFIX//\%/%%}" +} diff --git a/oh-my-zsh/plugins/github/README.md b/oh-my-zsh/plugins/github/README.md @@ -0,0 +1,46 @@ +# github + +This plugin supports working with GitHub from the command line. It provides a few things: + +* Sets up the `hub` wrapper and completions for the `git` command if you have `hub` installed. +* Completion for the `github` Ruby gem. +* Convenience functions for working with repos and URLs. + +### Functions + +* `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub +* `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub +* `exist_gh` - Takes an existing repo and pushes it to GitHub +* `git.io` - Shortens a URL using [git.io](http://git.io) + + +## Installation + +[Hub](http://github.com/github/hub) needs to be installed if you want to use it. On OS X with Homebrew, this can be done with `brew install hub`. The `hub` completion definition needs to be added to your `$FPATH` before initializing OMZ. + +The [`github` Ruby gem](http://github.com/defunkt/github-gem) needs to be installed if you want to use it. + +### Configuration + +These settings affect `github`'s behavior. + +#### Environment variables + +* `$GITHUB_USER` +* `$GITHUB_PASSWORD` + +#### Git configuration options + +* `github.user` - GitHub username for repo operations + +See `man hub` for more details. + +### Homebrew installation note + +If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which will be on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`. + +```zsh +if (( ! ${fpath[(I)/usr/local/share/zsh/site-functions]} )); then + FPATH=/usr/local/share/zsh/site-functions:$FPATH +fi +``` diff --git a/oh-my-zsh/plugins/github/_hub b/oh-my-zsh/plugins/github/_hub @@ -0,0 +1,163 @@ +#compdef hub + +# Zsh will source this file when attempting to autoload the "_hub" function, +# typically on the first attempt to complete the hub command. We define two new +# setup helper routines (one for the zsh-distributed version, one for the +# git-distributed, bash-based version). Then we redefine the "_hub" function to +# call "_git" after some other interception. +# +# This is pretty fragile, if you think about it. Any number of implementation +# changes in the "_git" scripts could cause problems down the road. It would be +# better if the stock git completions were just a bit more permissive about how +# it allowed third-party commands to be added. + +(( $+functions[__hub_setup_zsh_fns] )) || +__hub_setup_zsh_fns () { + (( $+functions[_git-alias] )) || + _git-alias () { + _arguments \ + '-s[output shell script suitable for eval]' \ + '1::shell:(zsh bash csh)' + } + + (( $+functions[_git-browse] )) || + _git-browse () { + _arguments \ + '-u[output the URL]' \ + '2::subpage:(wiki commits issues)' + } + + (( $+functions[_git-compare] )) || + _git-compare () { + _arguments \ + '-u[output the URL]' \ + ':[start...]end range:' + } + + (( $+functions[_git-create] )) || + _git-create () { + _arguments \ + '::name (REPOSITORY or ORGANIZATION/REPOSITORY):' \ + '-p[make repository private]' \ + '-d[description]:description' \ + '-h[home page]:repository home page URL:_urls' + } + + (( $+functions[_git-fork] )) || + _git-fork () { + _arguments \ + '--no-remote[do not add a remote for the new fork]' + } + + (( $+functions[_git-pull-request] )) || + _git-pull-request () { + _arguments \ + '-f[force (skip check for local commits)]' \ + '-b[base]:base ("branch", "owner\:branch", "owner/repo\:branch"):' \ + '-h[head]:head ("branch", "owner\:branch", "owner/repo\:branch"):' \ + - set1 \ + '-m[message]' \ + '-F[file]' \ + '-a[user]' \ + '-M[milestone]' \ + '-l[labels]' \ + - set2 \ + '-i[issue]:issue number:' \ + - set3 \ + '::issue-url:_urls' + } + + # stash the "real" command for later + functions[_hub_orig_git_commands]=$functions[_git_commands] + + # Replace it with our own wrapper. + declare -f _git_commands >& /dev/null && unfunction _git_commands + _git_commands () { + local ret=1 + # call the original routine + _call_function ret _hub_orig_git_commands + + # Effectively "append" our hub commands to the behavior of the original + # _git_commands function. Using this wrapper function approach ensures + # that we only offer the user the hub subcommands when the user is + # actually trying to complete subcommands. + hub_commands=( + alias:'show shell instructions for wrapping git' + pull-request:'open a pull request on GitHub' + fork:'fork origin repo on GitHub' + create:'create new repo on GitHub for the current project' + browse:'browse the project on GitHub' + compare:'open GitHub compare view' + ci-status:'lookup commit in GitHub Status API' + ) + _describe -t hub-commands 'hub command' hub_commands && ret=0 + + return ret + } +} + +(( $+functions[__hub_setup_bash_fns] )) || +__hub_setup_bash_fns () { + # TODO more bash-style fns needed here to complete subcommand args. They take + # the form "_git_CMD" where "CMD" is something like "pull-request". + + # Duplicate and rename the 'list_all_commands' function + eval "$(declare -f __git_list_all_commands | \ + sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')" + + # Wrap the 'list_all_commands' function with extra hub commands + __git_list_all_commands() { + cat <<-EOF +alias +pull-request +fork +create +browse +compare +ci-status +EOF + __git_list_all_commands_without_hub + } + + # Ensure cached commands are cleared + __git_all_commands="" +} + +# redefine _hub to a much smaller function in the steady state +_hub () { + # only attempt to intercept the normal "_git" helper functions once + (( $+__hub_func_replacement_done )) || + () { + # At this stage in the shell's execution the "_git" function has not yet + # been autoloaded, so the "_git_commands" or "__git_list_all_commands" + # functions will not be defined. Call it now (with a bogus no-op service + # to prevent premature completion) so that we can wrap them. + if declare -f _git >& /dev/null ; then + _hub_noop () { __hub_zsh_provided=1 } # zsh-provided will call this one + __hub_noop_main () { __hub_git_provided=1 } # git-provided will call this one + local service=hub_noop + _git + unfunction _hub_noop + unfunction __hub_noop_main + service=git + fi + + if (( $__hub_zsh_provided )) ; then + __hub_setup_zsh_fns + elif (( $__hub_git_provided )) ; then + __hub_setup_bash_fns + fi + + __hub_func_replacement_done=1 + } + + # Now perform the actual completion, allowing the "_git" function to call our + # replacement "_git_commands" function as needed. Both versions expect + # service=git or they will call nonexistent routines or end up in an infinite + # loop. + service=git + declare -f _git >& /dev/null && _git +} + +# make sure we actually attempt to complete on the first "tab" from the user +_hub diff --git a/oh-my-zsh/plugins/github/github.plugin.zsh b/oh-my-zsh/plugins/github/github.plugin.zsh @@ -0,0 +1,78 @@ +# Set up hub wrapper for git, if it is available; http://github.com/github/hub +if [ "$commands[(I)hub]" ]; then + if hub --version &>/dev/null; then + eval $(hub alias -s zsh) + fi +fi + +# Functions ################################################################# + +# Based on https://github.com/dbb/githome/blob/master/.config/zsh/functions + +# empty_gh <NAME_OF_REPO> +# +# Use this when creating a new repo from scratch. +# Creates a new repo with a blank README.md in it and pushes it up to GitHub. +empty_gh() { # [NAME_OF_REPO] + emulate -L zsh + local repo=$1 + + mkdir "$repo" + touch "$repo/README.md" + new_gh "$repo" +} + +# new_gh [DIRECTORY] +# +# Use this when you have a directory that is not yet set up for git. +# This function will add all non-hidden files to git. +new_gh() { # [DIRECTORY] + emulate -L zsh + local repo="$1" + cd "$repo" \ + || return + + git init \ + || return + # add all non-dot files + print '.*'"\n"'*~' >> .gitignore + git add [^.]* \ + || return + git add .gitignore \ + || return + git commit -m 'Initial commit.' \ + || return + hub create \ + || return + git push -u origin master \ + || return +} + +# exist_gh [DIRECTORY] +# +# Use this when you have a git repo that's ready to go and you want to add it +# to your GitHub. +exist_gh() { # [DIRECTORY] + emulate -L zsh + local repo=$1 + cd "$repo" + + hub create \ + || return + git push -u origin master +} + +# git.io "GitHub URL" +# +# Shorten GitHub url, example: +# https://github.com/nvogel/dotzsh > http://git.io/8nU25w +# source: https://github.com/nvogel/dotzsh +# documentation: https://github.com/blog/985-git-io-github-url-shortener +# +git.io() { + emulate -L zsh + curl -i -s https://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " " +} + +# End Functions ############################################################# + diff --git a/oh-my-zsh/plugins/gitignore/gitignore.plugin.zsh b/oh-my-zsh/plugins/gitignore/gitignore.plugin.zsh @@ -0,0 +1,12 @@ +function gi() { curl -sL https://www.gitignore.io/api/${(j:,:)@} } + +_gitignoreio_get_command_list() { + curl -sL https://www.gitignore.io/api/list | tr "," "\n" +} + +_gitignoreio () { + compset -P '*,' + compadd -S '' `_gitignoreio_get_command_list` +} + +compdef _gitignoreio gi diff --git a/oh-my-zsh/plugins/glassfish/_asadmin b/oh-my-zsh/plugins/glassfish/_asadmin @@ -0,0 +1,1150 @@ +#compdef asadmin +#autoload + +local -a _1st_arguments +_1st_arguments=( + "add-library:adds one or more library JAR files to GlassFish Server" + "add-resources:creates the resources specified in an XML file" + "apply-http-lb-changes:applies load balancer configuration changes to the load balancer" + "backup-domain:performs a backup on the domain" + "change-admin-password:changes the administrator password" + "change-master-broker:changes the master broker in a Message Queue cluster providing JMS services for a GlassFish Server cluster." + "change-master-password:changes the master password" + "collect-log-files:creates a ZIP archive of all available log files" + "configure-jms-cluster:configures the Message Queue cluster providing JMS services to a GlassFish Server cluster" + "configure-lb-weight:sets load balancing weights for clustered instances" + "configure-ldap-for-admin:configures the authentication realm named admin-realm for the given LDAP" + "copy-config:copies an existing named configuration to create another configuration" + "create-admin-object:adds the administered object with the specified JNDI name for a resource adapter" + "create-application-ref:creates a reference to an application" + "create-audit-module:adds an audit module" + "create-auth-realm:adds the named authentication realm" + "create-cluster:creates a GlassFish Server cluster" + "create-connector-connection-pool:adds a connection pool with the specified connection pool name" + "create-connector-resource:registers the connector resource with the specified JNDI name" + "create-connector-security-map:creates a security map for the specified connector connection pool" + "create-connector-work-security-map:creates a work security map for the specified resource adapter" + "create-custom-resource:creates a custom resource" + "create-domain:creates a domain" + "create-file-user:creates a new file user" + "create-http:sets HTTP parameters for a protocol" + "create-http-health-checker:creates a health-checker for a specified load balancer configuration" + "create-http-lb:creates a load balancer" + "create-http-lb-config:creates a configuration for the load balancer" + "create-http-lb-ref:adds an existing cluster or server instance to an existing load balancer configuration or load balancer" + "create-http-listener:adds a new HTTP network listener socket" + "create-http-redirect:adds a new HTTP redirect" + "create-iiop-listener:adds an IIOP listener" + "create-instance:creates a GlassFish Server instance" + "create-jacc-provider:enables administrators to create a JACC provider that can be used by third-party authorization modules for applications running in GlassFish Server" + "create-javamail-resource:creates a JavaMail session resource" + "create-jdbc-connection-pool:registers a JDBC connection pool" + "create-jdbc-resource:creates a JDBC resource with the specified JNDI name" + "create-jms-host:creates a JMS host" + "create-jms-resource:creates a JMS resource" + "create-jmsdest:creates a JMS physical destination" + "create-jndi-resource:registers a JNDI resource" + "create-jvm-options:creates options for the Java application launcher" + "create-lifecycle-module:creates a lifecycle module" + "create-local-instance:creates a GlassFish Server instance on the host where the subcommand is run" + "create-message-security-provider:enables administrators to create a message security provider, which specifies how SOAP messages will be secured." + "create-network-listener:adds a new network listener socket" + "create-node-config:creates a node that is not enabled for remote communication" + "create-node-dcom:creates a node that is enabled for com munication over DCOM" + "create-node-ssh:creates a node that is enabled for communication over SSH" + "create-password-alias:creates a password alias" + "create-profiler:creates the profiler element" + "create-protocol:adds a new protocol" + "create-protocol-filter:adds a new protocol filter" + "create-protocol-finder:adds a new protocol finder" + "create-resource-adapter-config:creates the configuration information for the connector module" + "create-resource-ref:creates a reference to a resource" + "create-service:configures the starting of a DAS or a GlassFish Server instance on an unattended boot" + "create-ssl:creates and configures the SSL element in the selected HTTP listener, IIOP listener, or IIOP service" + "create-system-properties:adds one or more system property elements that can be referenced elsewhere in the configuration." + "create-threadpool:adds a thread pool" + "create-transport:adds a new transport" + "create-virtual-server:creates the named virtual server" + "delete-admin-object:removes the administered object with the specified JNDI name." + "delete-application-ref:removes a reference to an applica tion" + "delete-audit-module:removes the named audit-module" + "delete-auth-realm:removes the named authentication realm" + "delete-cluster:deletes a GlassFish Server cluster" + "delete-config:deletes an existing named configuration" + "delete-connector-connection-pool:removes the specified connector connection pool" + "delete-connector-resource:removes the connector resource with the specified JNDI name" + "delete-connector-security-map:deletes a security map for the specified connector connection pool" + "delete-connector-work-security-map:deletes a work security map for the specified resource adapter" + "delete-custom-resource:removes a custom resource" + "delete-domain:deletes a domain" + "delete-file-user:removes the named file user" + "delete-http:removes HTTP parameters from a protocol" + "delete-http-health-checker:deletes the health-checker for a specified load balancer configuration" + "delete-http-lb:deletes a load balancer" + "delete-http-lb-config:deletes a load balancer configuration" + "delete-http-lb-ref:deletes the cluster or server instance from a load balancer" + "delete-http-listener:removes a network listener" + "delete-http-redirect:removes an HTTP redirect" + "delete-iiop-listener:removes an IIOP listener" + "delete-instance:deletes a GlassFish Server instance" + "delete-jacc-provider:enables administrators to delete JACC providers defined for a domain" + "delete-javamail-resource:removes a JavaMail session resource" + "delete-jdbc-connection-pool:removes the specified JDBC connection pool" + "delete-jdbc-resource:removes a JDBC resource with the specified JNDI name" + "delete-jms-host:removes a JMS host" + "delete-jms-resource:removes a JMS resource" + "delete-jmsdest:removes a JMS physical destination" + "delete-jndi-resource:removes a JNDI resource" + "delete-jvm-options:removes one or more options for the Java application launcher" + "delete-lifecycle-module:removes the lifecycle module" + "delete-local-instance:deletes a GlassFish Server instance on the machine where the subcommand is run" + "delete-log-levels:" + "delete-message-security-provider:enables administrators to delete a message security provider" + "delete-network-listener:removes a network listener" + "delete-node-config:deletes a node that is not enabled for remote communication" + "delete-node-dcom:deletes a node that is enabled for communication over DCOM" + "delete-node-ssh:deletes a node that is enabled for communication over SSH" + "delete-password-alias:deletes a password alias" + "delete-profiler:removes the profiler element" + "delete-protocol:removes a protocol" + "delete-protocol-filter:removes a protocol filter" + "delete-protocol-finder:removes a protocol finder" + "delete-resource-adapter-config:deletes the resource adapter configuration" + "delete-resource-ref:removes a reference to a resource" + "delete-ssl:deletes the SSL element in the selected HTTP listener, IIOP listener, or IIOP service" + "delete-system-property:removes a system property of the domain, configuration, cluster, or server instance, one at a time" + "delete-threadpool:removes a thread pool" + "delete-transport:removes a transport" + "delete-virtual-server:removes a virtual server" + "deploy:deploys the specified component" + "deploydir:deploys an exploded format of application archive" + "environment variable" + "disable:disables the component" + "disable-http-lb-application:disables an application managed by a load balancer" + "disable-http-lb-server:disables a sever or cluster managed by a load balancer" + "disable-monitoring:disables monitoring for the server or for specific monitorable modules" + "disable-secure-admin:disables secure admin if it is already enabled." + "disable-secure-admin-internal-user:Instructs the GlassFish Server DAS and instances to not use the specified admin user to authenticate with each other and to authorize admin operations." + "disable-secure-admin-principal:disables the certificate for authorizing access in secure administration." + "enable:enables the component" + "enable-http-lb-application:enables a previously-disabled application managed by a load balancer" + "enable-http-lb-server:enables a previously disabled sever or cluster managed by a load balancer" + "enable-monitoring:enables monitoring for the server or for specific monitorable modules" + "enable-secure-admin:enables secure admin (if it is not already enabled), optionally changing the alias used for DAS-to-instance admin messages or the alias used for instance-to-DAS admin messages." + "enable-secure-admin-internal-user:Instructs the GlassFish Server DAS and instances to use the specified admin user and the password associated with the password alias to authenticate with each other and to authorize admin operations." + "enable-secure-admin-principal:Instructs GlassFish Server, when secure admin is enabled, to accept admin requests from clients identified by the specified SSL certificate." + "export:marks a variable name for automatic export to the environment of subsequent commands in multimode" + "export-http-lb-config:exports the load balancer configuration or load balancer to a file" + "export-sync-bundle:exports the configuration data of a cluster or standalone instance to an archive file" + "flush-connection-pool:reintializes all connections established in the specified connection pool" + "flush-jmsdest:purges messages in a JMS destination." + "freeze-transaction-service:freezes the transaction subsystem" + "generate-domain-schema:" + "generate-jvm-report:shows the JVM machine statistics for a given target instance" + "get:gets the values of configurable or monitorable attributes" + "get-client-stubs:retrieves the application JAR files needed to launch the application client." + "get-health:provides information on the cluster health" + "help" + "asadmin:utility for performing administrative tasks for Oracle GlassFish Server" + "import-sync-bundle:imports the configuration data of a clustered instance or standalone instance from an archive file" + "install-node:installs GlassFish Server software on specified SSH-enabled hosts" + "install-node-dcom:installs GlassFish Server software on specified DCOM-enabled hosts" + "install-node-ssh:installs GlassFish Server software on specified SSH-enabled hosts" + "jms-ping:checks if the JMS service is up and running" + "list:lists configurable or monitorable elements" + "list-admin-objects:gets all the administered objects" + "list-application-refs:lists the existing application references" + "list-applications:lists deployed applications" + "list-audit-modules:gets all audit modules and displays them" + "list-auth-realms:lists the authentication realms" + "list-backups:lists all backups" + "list-clusters:lists existing clusters in a domain" + "list-commands:lists available commands" + "list-components:lists deployed components" + "list-configs:lists named configurations" + "list-connector-connection-pools:lists the existing connector connection pools" + "list-connector-resources:lists all connector resources" + "list-connector-security-maps:lists the security maps belonging to the specified connector connection pool" + "list-connector-work-security-maps:lists the work security maps belonging to the specified resource adapter" + "list-containers:lists application containers" + "list-custom-resources:gets all custom resources" + "list-domains:lists the domains in the specified directory" + "list-file-groups:lists file groups" + "list-file-users:lists the file users" + "list-http-lb-configs:lists load balancer configurations" + "list-http-lbs:lists load balancers" + "list-http-listeners:lists the existing network listeners" + "list-iiop-listeners:lists the existing IIOP listeners" + "list-instances:lists GlassFish Server instances in a domain" + "list-jacc-providers:enables administrators to list JACC providers defined for a domain" + "list-javamail-resources:lists the existing JavaMail session resources" + "list-jdbc-connection-pools:lists all JDBC connection pools" + "list-jdbc-resources:lists all JDBC resources" + "list-jms-hosts:lists the existing JMS hosts" + "list-jms-resources:lists the JMS resources" + "list-jmsdest:lists the existing JMS physical destinations" + "list-jndi-entries:browses and queries the JNDI tree" + "list-jndi-resources:lists all existing JNDI resources" + "list-jvm-options:lists options for the Java application launcher" + "list-libraries:lists library JAR files on GlassFish Server" + "list-lifecycle-modules:lists the lifecycle modules" + "list-log-attributes:lists all logging attributes defined for a specified target in a domain" + "list-log-levels:lists the loggers and their log levels" + "list-message-security-providers:lists all security message providers for the given message layer" + "list-modules:lists GlassFish Server modules" + "list-network-listeners:lists the existing network listeners" + "list-nodes:lists all GlassFish Server nodes in a domain" + "list-nodes-config:lists all GlassFish Server nodes that do not support remote communication in a domain" + "list-nodes-dcom:lists all GlassFish Server nodes that support communication over DCOM in a domain" + "list-nodes-ssh:lists all GlassFish Server nodes that support communication over SSH in a domain" + "list-password-aliases:lists all password aliases" + "list-persistence-types:lists registered persistence types for HTTP sessions and SFSB instances" + "list-protocol-filters:lists the existing protocol filters" + "list-protocol-finders:lists the existing protocol finders" + "list-protocols:lists the existing protocols" + "list-resource-adapter-configs:lists the names of the current resource adapter configurations" + "list-resource-refs:lists existing resource references" + "list-secure-admin-internal-users:lists the user names that the GlassFish Server DAS and instances use to authenticate with each other and to authorize admin operations." + "list-secure-admin-principals:lists the certificates for which GlassFish Server accepts admin requests from clients." + "list-sub-components:lists EJB or servlet components in a deployed module or module of a deployed application" + "list-supported-cipher-suites:enables administrators to list the cipher suites that are supported and available to a specified GlassFish Server target" + "list-system-properties:lists the system properties of the domain, configuration, cluster, or server instance" + "list-threadpools:lists all the thread pools" + "list-timers:lists all of the persistent timers owned by server instance(s)" + "list-transports:lists the existing transports" + "list-virtual-servers:lists the existing virtual servers" + "list-web-context-param:lists servlet contextinitialization parameters of a deployed web application or module" + "list-web-env-entry:lists environment entries for a deployed web application or module" + "login:logs you into a domain" + "migrate-timers:moves EJB timers when a clustered instance was stopped or has crashed" + "monitor:displays monitoring data for commonly used components and services" + "multimode:allows multiple subcommands to be run while preserving environment settings and remaining in the asadmin utility" + "ping-connection-pool:tests if a connection pool is usable" + "ping-node-dcom:tests if a node that is enabled for communication over DCOM is usable" + "ping-node-ssh:tests if a node that is enabled for communication over SSH is usable" + "recover-transactions:manually recovers pending transactions" + "redeploy:redeploys the specified component" + "remove-library:removes one or more library JAR files from GlassFish Server" + "restart-domain:restarts the DAS of the specified domain" + "restart-instance:restarts a running GlassFish Server instance" + "restart-local-instance:restarts a running GlassFish Server instance on the host where the subcommand is run" + "restore-domain:restores files from backup" + "rollback-transaction:rolls back the named transaction" + "rotate-log:rotates the log file" + "set:sets the values of configurable attributes" + "set-log-attributes:sets the logging attributes for one or more loggers" + "set-log-levels:sets the log level for one or more loggers" + "set-web-context-param:sets a servlet context initialization parameter of a deployed web application or module" + "set-web-env-entry:sets an environment entry for a deployed web application or module" + "setup-ssh:sets up an SSH key on specified hosts" + "show-component-status:displays the status of the deployed component" + "start-cluster:starts a cluster" + "start-database:starts the Java DB" + "start-domain:starts the DAS of the specified domain" + "start-instance:starts a GlassFish Server instance" + "start-local-instance:starts a GlassFish Server instance on the host where the subcommand is run" + "stop-cluster:stops a GlassFish Server cluster" + "stop-database:stops the Java DB" + "stop-domain:stops the Domain Administration Server of the specified domain" + "stop-instance:stops a running GlassFish Server instance" + "stop-local-instance:stops a GlassFish Server instance on the machine where the subcommand is run" + "undeploy:removes a deployed component" + "unfreeze-transaction-service:resumes all suspended transactions" + "uninstall-node:uninstalls GlassFish Server software from specified hosts" + "uninstall-node-dcom:uninstalls GlassFish Server software from specified DCOM-enabled hosts" + "uninstall-node-ssh:uninstalls GlassFish Server software from specified SSH-enabled hosts" + "unset:removes one or more variables from the multimode environment" + "unset-web-context-param:unsets a servlet context initialization parameter of a deployed web application or module" + "unset-web-env-entry:unsets an environment entry for a deployed web application or module" + "update-connector-security-map:modifies a security map for the specified connector connection pool" + "update-connector-work-security-map:modifies a work security map for the specified resource adapter" + "update-file-user:updates a current file user as specified" + "update-node-config:updates the configuration data of anode" + "update-node-dcom:updates the configuration data of a node" + "update-node-ssh:updates the configuration data of a node" + "update-password-alias:updates a password alias" + "uptime:returns the length of time that the DAS has been running" + "validate-dcom:tests the connection over DCOM to a remote host" + "validate-multicast:validates that multicast transport is available for clusters" + "verify-domain-xml:verifies the content of the domain.xml file" + "version:displays version information forGlassFish Server" +) + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "asadmin command" _1st_arguments + return +fi + +local -a _command_args +case "$words[1]" in + add-library) + _command_args=('*:directory:_files' '--host+:' '--port+:' '--type+:type:(common ext app)') + ;; + add-resources) + _command_args=('*:directory:_files' '--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance') + ;; + apply-http-lb-changes) + _command_args=('--host+:' '--ping+:' '--port+:') + ;; + backup-domain) + _command_args=('--backupconfig+:' '--backupdir+:' '--description+:' '--domaindir+:' '--long+:long:(true false)') + ;; + change-admin-password) + _command_args=('--domain_name+:' '--domaindir+:') + ;; + change-master-broker) + _command_args=('--host+:' '--port+:') + ;; + change-master-password) + _command_args=('--domaindir+:' '--nodedir+:' '--savemasterpassword+:savemasterpassword:(true false)') + ;; + collect-log-files) + _command_args=('--host+:' '--port+:' '--retrieve+:retrieve:(true false)' '--target+:') + ;; + configure-jms-cluster) + _command_args=('--clustertype+:' '--configstoretype+:' '--dburl+:' '--dbuser+:' '--dbvendor+:' '--host+:' '--jmsdbpassword+:' '--messagestoretype+:' '--port+:' '--property+:') + ;; + configure-lb-weight) + _command_args=('--cluster+:cluster:_asadmin_clusters' '--host+:' '--port+:') + ;; + configure-ldap-for-admin) + _command_args=('--basedn+:' '--host+:' '--ldap-group+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance' '--url+:') + ;; + copy-config) + _command_args=('--host+:' '--port+:' '--systemproperties+:') + ;; + create-admin-object) + _command_args=('--classname+:' '--description+:' '--enabled+:enabled:(true false)' '--host+:' '--port+:' '--property+:' '--raname+:' '--restype+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + create-application-ref) + _command_args=('--enabled+:enabled:(true false)' '--host+:' '--lbenabled+:lbenabled:(true false)' '--port+:' '--target+:target:_asadmin_targets_cluster_das_standalone_instance' '--virtualservers+:') + ;; + create-audit-module) + _command_args=('--classname+:' '--host+:' '--port+:' '--property+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + create-auth-realm) + _command_args=('--classname+:' '--host+:' '--port+:' '--property+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + create-connector-connection-pool) + _command_args=('--associatewiththread+:associatewiththread:(true false)' '--connectiondefinition+:' '--creationretryattempts+:' '--creationretryinterval+:' '--description+:' '--failconnection+:failconnection:(true false)' '--host+:' '--idletimeout+:' '--isconnectvalidatereq+:isconnectvalidatereq:(true false)' '--lazyconnectionassociation+:lazyconnectionassociation:(true false)' '--lazyconnectionenlistment+:lazyconnectionenlistment:(true false)' '--leakreclaim+:leakreclaim:(true false)' '--leaktimeout+:' '--matchconnections+:matchconnections:(true false)' '--maxconnectionusagecount+:' '--maxpoolsize+:' '--maxwait+:' '--ping+:ping:(true false)' '--pooling+:pooling:(true false)' '--poolresize+:' '--port+:' '--property+:' '--raname+:' '--steadypoolsize+:' '--target+:' '--transactionsupport+:transactionsupport:(XATransaction LocalTransaction NoTransaction)' '--validateatmostonceperiod+:') + ;; + create-connector-resource) + _command_args=('--description+:' '--enabled+:enabled:(true false)' '--host+:' '--objecttype+:' '--poolname+:' '--port+:' '--property+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance') + ;; + create-connector-security-map) + _command_args=('--host+:' '--mappedpassword+:' '--mappedusername+:' '--poolname+:' '--port+:' '--principals+:' '--target+:' '--usergroups+:') + ;; + create-connector-work-security-map) + _command_args=('--description+:' '--groupsmap+:' '--host+:' '--port+:' '--principalsmap+:' '--raname+:') + ;; + create-custom-resource) + _command_args=('--description+:' '--enabled+:enabled:(true false)' '--factoryclass+:' '--host+:' '--port+:' '--property+:' '--restype+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance') + ;; + create-domain) + _command_args=('--adminport+:' '--checkports+:checkports:(true false)' '--domaindir+:' '--domainproperties+:' '--instanceport+:' '--keytooloptions+:' '--nopassword+:nopassword:(true false)' '--portbase+:' '--profile+:' '--savelogin+:savelogin:(true false)' '--savemasterpassword+:savemasterpassword:(true false)' '--template+:' '--usemasterpassword+:usemasterpassword:(true false)') + ;; + create-file-user) + _command_args=('--authrealmname+:' '--groups+:' '--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance' '--userpassword+:') + ;; + create-http) + _command_args=('--default-virtual-server+:' '--dns-lookup-enabled+:dns-lookup-enabled:(true false)' '--host+:' '--max-connection+:' '--port+:' '--request-timeout-seconds+:' '--servername+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance' '--timeout-seconds+:' '--xpowered+:xpowered:(true false)') + ;; + create-http-health-checker) + _command_args=('--config+:' '--host+:' '--interval+:' '--port+:' '--timeout+:' '--url+:') + ;; + create-http-lb) + _command_args=('--autoapplyenabled+:autoapplyenabled:(true false)' '--devicehost+:' '--deviceport+:' '--healthcheckerinterval+:' '--healthcheckertimeout+:' '--healthcheckerurl+:' '--host+:' '--httpsrouting+:httpsrouting:(true false)' '--lbenableallapplications+:' '--lbenableallinstances+:' '--lbpolicy+:' '--lbpolicymodule+:' '--lbweight+:' '--monitor+:monitor:(true false)' '--port+:' '--property+:' '--reloadinterval+:' '--responsetimeout+:' '--routecookie+:routecookie:(true false)' '--sslproxyhost+:' '--sslproxyport+:' '--target+:target:_asadmin_targets_cluster_standalone_instance') + ;; + create-http-lb-ref) + _command_args=('--config+:' '--healthcheckerinterval+:' '--healthcheckertimeout+:' '--healthcheckerurl+:' '--host+:' '--lbenableallapplications+:' '--lbenableallinstances+:' '--lbname+:' '--lbpolicy+:' '--lbpolicymodule+:' '--lbweight+:' '--port+:') + ;; + create-http-listener) + _command_args=('--acceptorthreads+:' '--default-virtual-server+:' '--defaultvs+:' '--enabled+:enabled:(true false)' '--host+:' '--listeneraddress+:' '--listenerport+:' '--port+:' '--redirectport+:' '--secure+:secure:(true false)' '--securityenabled+:securityenabled:(true false)' '--servername+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance' '--xpowered+:xpowered:(true false)') + ;; + create-http-redirect) + _command_args=('--host+:' '--port+:' '--redirect-port+:' '--secure-redirect+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + create-iiop-listener) + _command_args=('--enabled+:enabled:(true false)' '--host+:' '--iiopport+:' '--listeneraddress+:' '--port+:' '--property+:' '--securityenabled+:securityenabled:(true false)' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + create-instance) + _command_args=('--checkports+:checkports:(true false)' '--cluster+:cluster:_asadmin_clusters' '--config+:' '--host+:' '--lbenabled+:lbenabled:(true false)' '--node+:node:_asadmin_nodes' '--port+:' '--portbase+:' '--systemproperties+:' '--terse+:terse:(true false)') + ;; + create-jacc-provider) + _command_args=('--host+:' '--policyconfigfactoryclass+:' '--policyproviderclass+:' '--port+:' '--property+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + create-javamail-resource) + _command_args=('--debug+:debug:(true false)' '--description+:' '--enabled+:enabled:(true false)' '--fromaddress+:' '--host+:' '--mailhost+:' '--mailuser+:' '--port+:' '--property+:' '--storeprotocol+:' '--storeprotocolclass+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance' '--transprotocol+:' '--transprotocolclass+:') + ;; + create-jdbc-connection-pool) + _command_args=('--allownoncomponentcallers+:allownoncomponentcallers:(true false)' '--associatewiththread+:associatewiththread:(true false)' '--creationretryattempts+:' '--creationretryinterval+:' '--datasourceclassname+:' '--description+:' '--driverclassname+:' '--failconnection+:failconnection:(true false)' '--host+:' '--idletimeout+:' '--initsql+:' '--isconnectvalidatereq+:isconnectvalidatereq:(true false)' '--isisolationguaranteed+:isisolationguaranteed:(true false)' '--isolationlevel+:' '--lazyconnectionassociation+:lazyconnectionassociation:(true false)' '--lazyconnectionenlistment+:lazyconnectionenlistment:(true false)' '--leakreclaim+:leakreclaim:(true false)' '--leaktimeout+:' '--matchconnections+:matchconnections:(true false)' '--maxconnectionusagecount+:' '--maxpoolsize+:' '--maxwait+:' '--nontransactionalconnections+:nontransactionalconnections:(true false)' '--ping+:ping:(true false)' '--pooling+:pooling:(true false)' '--poolresize+:' '--port+:' '--property+:' '--restype+:restype:(javax.sql.DataSource javax.sql.XADataSource javax.sql.ConnectionPoolDataSource java.sql.Driver)' '--sqltracelisteners+:' '--statementcachesize+:' '--statementleakreclaim+:statementleakreclaim:(true false)' '--statementleaktimeout+:' '--statementtimeout+:' '--steadypoolsize+:' '--target+:' '--validateatmostonceperiod+:' '--validationclassname+:' '--validationmethod+:validationmethod:(auto-commit meta-data table custom-validation)' '--validationtable+:' '--wrapjdbcobjects+:wrapjdbcobjects:(true false)') + ;; + create-jdbc-resource) + _command_args=('--connectionpoolid+:' '--description+:' '--enabled+:enabled:(true false)' '--host+:' '--port+:' '--property+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance') + ;; + create-jms-host) + _command_args=('--host+:' '--mqhost+:' '--mqpassword+:' '--mqport+:' '--mquser+:' '--port+:' '--property+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + create-jms-resource) + _command_args=('--description+:' '--enabled+:enabled:(true false)' '--host+:' '--port+:' '--property+:' '--restype+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance') + ;; + create-jmsdest) + _command_args=('--desttype+:' '--host+:' '--port+:' '--property+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + create-jndi-resource) + _command_args=('--description+:' '--enabled+:enabled:(true false)' '--factoryclass+:' '--host+:' '--jndilookupname+:' '--port+:' '--property+:' '--restype+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance') + ;; + create-jvm-options) + _command_args=('--host+:' '--port+:' '--profiler+:profiler:(true false)' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + create-lifecycle-module) + _command_args=('--classname+:' '--classpath+:' '--description+:' '--enabled+:enabled:(true false)' '--failurefatal+:failurefatal:(true false)' '--host+:' '--loadorder+:' '--port+:' '--property+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance') + ;; + create-local-instance) + _command_args=('--checkports+:checkports:(true false)' '--cluster+:cluster:_asadmin_clusters' '--config+:' '--lbenabled+:lbenabled:(true false)' '--node+:node:_asadmin_nodes' '--nodedir+:' '--portbase+:' '--savemasterpassword+:savemasterpassword:(true false)' '--systemproperties+:' '--usemasterpassword+:usemasterpassword:(true false)') + ;; + create-message-security-provider) + _command_args=('--classname+:' '--host+:' '--isdefaultprovider+:isdefaultprovider:(true false)' '--layer+:layer:(SOAP HttpServlet)' '--port+:' '--property+:' '--providertype+:providertype:(client server client-server)' '--requestauthrecipient+:' '--requestauthsource+:' '--responseauthrecipient+:' '--responseauthsource+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + create-network-listener) + _command_args=('--address+:' '--enabled+:enabled:(true false)' '--host+:' '--jkenabled+:jkenabled:(true false)' '--listenerport+:' '--port+:' '--protocol+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance' '--threadpool+:' '--transport+:') + ;; + create-node-config) + _command_args=('--host+:' '--installdir+:' '--nodedir+:' '--nodehost+:' '--port+:') + ;; + create-node-dcom) + _command_args=('--archive+:' '--force+:force:(true false)' '--host+:' '--install+:install:(true false)' '--installdir+:' '--nodedir+:' '--nodehost+:' '--port+:' '--windowsdomain+:' '--windowspassword+:' '--windowsuser+:') + ;; + create-node-ssh) + _command_args=('--archive+:' '--force+:force:(true false)' '--host+:' '--install+:install:(true false)' '--installdir+:' '--nodedir+:' '--nodehost+:' '--port+:' '--sshkeyfile+:' '--sshkeypassphrase+:' '--sshpassword+:' '--sshport+:' '--sshuser+:') + ;; + create-password-alias) + _command_args=('--aliaspassword+:' '--host+:' '--port+:') + ;; + create-profiler) + _command_args=('--classpath+:' '--enabled+:enabled:(true false)' '--host+:' '--nativelibrarypath+:' '--port+:' '--property+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + create-protocol) + _command_args=('--host+:' '--port+:' '--securityenabled+:securityenabled:(true false)' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + create-protocol-filter) + _command_args=('--classname+:' '--host+:' '--port+:' '--protocol+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + create-protocol-finder) + _command_args=('--classname+:' '--host+:' '--port+:' '--protocol+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance' '--targetprotocol+:') + ;; + create-resource-adapter-config) + _command_args=('--host+:' '--objecttype+:' '--port+:' '--property+:' '--target+:' '--threadpoolid+:') + ;; + create-resource-ref) + _command_args=('--enabled+:enabled:(true false)' '--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_das_standalone_instance') + ;; + create-service) + _command_args=('*:instances:_asadmin_instances' '--domaindir+:domaindir:directory:_files' '--dry-run+:dry-run:(true false)' '--force+:force:(true false)' '--name+:' '--node+:node:_asadmin_nodes' '--nodedir+:' '--serviceproperties+:' '--serviceuser+:') + ;; + create-ssl) + _command_args=('--certname+:' '--clientauthenabled+:clientauthenabled:(true false)' '--host+:' '--port+:' '--ssl2ciphers+:' '--ssl2enabled+:ssl2enabled:(true false)' '--ssl3enabled+:ssl3enabled:(true false)' '--ssl3tlsciphers+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance' '--tlsenabled+:tlsenabled:(true false)' '--tlsrollbackenabled+:tlsrollbackenabled:(true false)' '--type+:type:(network-listener http-listener iiop-listener iiop-service jmx-connector)') + ;; + create-system-properties) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_clustered_instance_config_das_domain_standalone_instance') + ;; + create-threadpool) + _command_args=('--host+:' '--idletimeout+:' '--maxqueuesize+:' '--maxthreadpoolsize+:' '--minthreadpoolsize+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance' '--workqueues+:') + ;; + create-transport) + _command_args=('--acceptorthreads+:' '--buffersizebytes+:' '--bytebuffertype+:' '--classname+:' '--displayconfiguration+:displayconfiguration:(true false)' '--enablesnoop+:enablesnoop:(true false)' '--host+:' '--idlekeytimeoutseconds+:' '--maxconnectionscount+:' '--port+:' '--readtimeoutmillis+:' '--selectionkeyhandler+:' '--selectorpolltimeoutmillis+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance' '--tcpnodelay+:tcpnodelay:(true false)' '--writetimeoutmillis+:') + ;; + create-virtual-server) + _command_args=('--defaultwebmodule+:' '--host+:' '--hosts+:' '--httplisteners+:' '--logfile+:' '--networklisteners+:' '--port+:' '--property+:' '--state+:state:(on off disabled)' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-admin-object) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-application-ref) + _command_args=('--cascade+:cascade:(true false)' '--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_das_standalone_instance') + ;; + delete-audit-module) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-auth-realm) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-config) + _command_args=('--host+:' '--port+:') + ;; + delete-connector-connection-pool) + _command_args=('--cascade+:cascade:(true false)' '--host+:' '--port+:' '--target+:') + ;; + delete-connector-resource) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance') + ;; + delete-connector-security-map) + _command_args=('--host+:' '--poolname+:' '--port+:' '--target+:') + ;; + delete-connector-work-security-map) + _command_args=('--host+:' '--port+:' '--raname+:') + ;; + delete-custom-resource) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance') + ;; + delete-domain) + _command_args=('--domaindir+:') + ;; + delete-file-user) + _command_args=('--authrealmname+:' '--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-http) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-http-health-checker) + _command_args=('--config+:' '--host+:' '--port+:') + ;; + delete-http-lb-ref) + _command_args=('--config+:' '--force+:' '--host+:' '--lbname+:' '--port+:') + ;; + delete-http-listener) + _command_args=('--host+:' '--port+:' '--secure+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-http-redirect) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-iiop-listener) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-instance) + _command_args=('*:instances:_asadmin_instances' '--host+:' '--port+:' '--terse+:terse:(true false)') + ;; + delete-jacc-provider) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-javamail-resource) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance') + ;; + delete-jdbc-connection-pool) + _command_args=('--cascade+:cascade:(true false)' '--host+:' '--port+:' '--target+:') + ;; + delete-jdbc-resource) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance') + ;; + delete-jms-host) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-jms-resource) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance') + ;; + delete-jmsdest) + _command_args=('--desttype+:' '--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-jndi-resource) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance') + ;; + delete-jvm-options) + _command_args=('--host+:' '--port+:' '--profiler+:profiler:(true false)' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-lifecycle-module) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance') + ;; + delete-local-instance) + _command_args=('*:instances:_asadmin_instances' '--node+:node:_asadmin_nodes' '--nodedir+:') + ;; + delete-log-levels) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-message-security-provider) + _command_args=('--host+:' '--layer+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-network-listener) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-node-config) + _command_args=('*:nodes:_asadmin_nodes_config' '--host+:' '--port+:') + ;; + delete-node-dcom) + _command_args=('*:nodes:_asadmin_nodes_dcom' '--force+:force:(true false)' '--host+:' '--port+:' '--uninstall+:uninstall:(true false)') + ;; + delete-node-ssh) + _command_args=('*:nodes:_asadmin_nodes_ssh' '--force+:force:(true false)' '--host+:' '--port+:' '--uninstall+:uninstall:(true false)') + ;; + delete-password-alias) + _command_args=('--host+:' '--port+:') + ;; + delete-profiler) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-protocol) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-protocol-filter) + _command_args=('--host+:' '--port+:' '--protocol+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-protocol-finder) + _command_args=('--host+:' '--port+:' '--protocol+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-resource-adapter-config) + _command_args=('--host+:' '--port+:' '--target+:') + ;; + delete-resource-ref) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_das_standalone_instance') + ;; + delete-ssl) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance' '--type+:type:(network-listener http-listener iiop-listener iiop-service jmx-connector)') + ;; + delete-system-property) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_clustered_instance_config_das_domain_standalone_instance') + ;; + delete-threadpool) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-transport) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + delete-virtual-server) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + deploy) + _command_args=('*:directory:_files' '--asyncreplication+:asyncreplication:(true false)' '--availabilityenabled+:availabilityenabled:(true false)' '--contextroot+:' '--createtables+:createtables:(true false)' '--dbvendorname+:' '--deploymentplan+:deploymentplan:directory:_files' '--description+:' '--dropandcreatetables+:dropandcreatetables:(true false)' '--enabled+:enabled:(true false)' '--force+:force:(true false)' '--generatermistubs+:generatermistubs:(true false)' '--host+:' '--isredeploy+:isredeploy:(true false)' '--keepfailedstubs+:keepfailedstubs:(true false)' '--keepreposdir+:keepreposdir:(true false)' '--keepstate+:keepstate:(true false)' '--lbenabled+:lbenabled:(true false)' '--libraries+:' '--logreportederrors+:logreportederrors:(true false)' '--name+:' '--port+:' '--precompilejsp+:precompilejsp:(true false)' '--properties+:' '--property+:' '--retrieve+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance' '--type+:' '--uniquetablenames+:uniquetablenames:(true false)' '--verify+:verify:(true false)' '--virtualservers+:') + ;; + deploydir) + _command_args=('*:directory:_files' '--asyncreplication+:asyncreplication:(true false)' '--availabilityenabled+:availabilityenabled:(true false)' '--contextroot+:' '--createtables+:createtables:(true false)' '--dbvendorname+:' '--deploymentplan+:deploymentplan:directory:_files' '--description+:' '--dropandcreatetables+:dropandcreatetables:(true false)' '--enabled+:enabled:(true false)' '--force+:force:(true false)' '--generatermistubs+:generatermistubs:(true false)' '--host+:' '--isredeploy+:isredeploy:(true false)' '--keepfailedstubs+:keepfailedstubs:(true false)' '--keepreposdir+:keepreposdir:(true false)' '--keepstate+:keepstate:(true false)' '--lbenabled+:lbenabled:(true false)' '--libraries+:' '--logreportederrors+:logreportederrors:(true false)' '--name+:' '--port+:' '--precompilejsp+:precompilejsp:(true false)' '--properties+:' '--property+:' '--retrieve+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance' '--type+:' '--uniquetablenames+:uniquetablenames:(true false)' '--verify+:verify:(true false)' '--virtualservers+:') + ;; + disable) + _command_args=('--cascade+:cascade:(true false)' '--droptables+:droptables:(true false)' '--host+:' '--isredeploy+:isredeploy:(true false)' '--isundeploy+:isundeploy:(true false)' '--keepreposdir+:keepreposdir:(true false)' '--keepstate+:keepstate:(true false)' '--port+:' '--properties+:' '--target+:target:_asadmin_targets_cluster_clustered_instance_das_domain_standalone_instance') + ;; + disable-http-lb-application) + _command_args=('--host+:' '--name+:' '--port+:' '--timeout+:') + ;; + disable-http-lb-server) + _command_args=('--host+:' '--port+:' '--timeout+:') + ;; + disable-monitoring) + _command_args=('--host+:' '--modules+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + disable-secure-admin) + _command_args=('--host+:' '--port+:') + ;; + enable) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_clustered_instance_das_domain_standalone_instance') + ;; + enable-http-lb-application) + _command_args=('--host+:' '--name+:' '--port+:') + ;; + enable-http-lb-server) + _command_args=('--host+:' '--port+:') + ;; + enable-monitoring) + _command_args=('--dtrace+:dtrace:(true false)' '--host+:' '--mbean+:mbean:(true false)' '--modules+:' '--options+:' '--pid+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + enable-secure-admin) + _command_args=('--adminalias+:' '--host+:' '--instancealias+:' '--port+:') + ;; + export-http-lb-config) + _command_args=('--config+:' '--host+:' '--lbname+:' '--lbtargets+:' '--port+:' '--property+:' '--retrievefile+:retrievefile:(true false)') + ;; + export-sync-bundle) + _command_args=('--host+:' '--port+:' '--retrieve+:retrieve:(true false)' '--target+:') + ;; + flush-connection-pool) + _command_args=('--appname+:' '--host+:' '--modulename+:' '--port+:') + ;; + flush-jmsdest) + _command_args=('--desttype+:' '--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + freeze-transaction-service) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_clustered_instance_config_das_standalone_instance') + ;; + generate-domain-schema) + _command_args=('--format+:' '--host+:' '--port+:' '--showdeprecated+:showdeprecated:(true false)' '--showsubclasses+:showsubclasses:(true false)') + ;; + generate-jvm-report) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_clustered_instance_das_standalone_instance' '--type+:type:(summary thread class memory log)') + ;; + get) + _command_args=('--host+:' '--monitor+:monitor:(true false)' '--port+:') + ;; + get-client-stubs) + _command_args=('--appname+:' '--host+:' '--port+:') + ;; + get-health) + _command_args=('--host+:' '--port+:') + ;; + help) + _describe -t help-commands "asadmin help command" _1st_arguments + ;; + import-sync-bundle) + _command_args=('--instance+:' '--node+:node:_asadmin_nodes' '--nodedir+:') + ;; + install-node) + _command_args=('--archive+:' '--create+:create:(true false)' '--force+:force:(true false)' '--installdir+:' '--save+:save:(true false)' '--sshkeyfile+:' '--sshport+:' '--sshuser+:') + ;; + install-node-dcom) + _command_args=('--archive+:' '--create+:create:(true false)' '--force+:force:(true false)' '--installdir+:' '--save+:save:(true false)' '--windowsdomain+:' '--windowsuser+:') + ;; + install-node-ssh) + _command_args=('--archive+:' '--create+:create:(true false)' '--force+:force:(true false)' '--installdir+:' '--save+:save:(true false)' '--sshkeyfile+:' '--sshport+:' '--sshuser+:') + ;; + jms-ping) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_clustered_instance_config_das_standalone_instance') + ;; + list) + _command_args=('--host+:' '--monitor+:monitor:(true false)' '--port+:') + ;; + list-admin-objects) + _command_args=('*:targets:_asadmin_targets_cluster_clustered_instance_config_das_standalone_instance' '--host+:' '--port+:') + ;; + list-application-refs) + _command_args=('*:targets:_asadmin_targets_cluster_das_standalone_instance' '--host+:' '--long+:long:(true false)' '--port+:' '--terse+:terse:(true false)') + ;; + list-applications) + _command_args=('*:targets:_asadmin_targets_cluster_das_domain_standalone_instance' '--host+:' '--long+:long:(true false)' '--port+:' '--resources+:resources:(true false)' '--subcomponents+:subcomponents:(true false)' '--terse+:terse:(true false)' '--type+:') + ;; + list-audit-modules) + _command_args=('*:targets:_asadmin_targets_cluster_clustered_instance_config_das_standalone_instance' '--host+:' '--port+:') + ;; + list-auth-realms) + _command_args=('*:targets:_asadmin_targets_cluster_clustered_instance_config_das_standalone_instance' '--host+:' '--port+:') + ;; + list-backups) + _command_args=('--backupconfig+:' '--backupdir+:' '--domaindir+:' '--long+:long:(true false)') + ;; + list-clusters) + _command_args=('--host+:' '--port+:') + ;; + list-commands) + _command_args=('--localonly+:localonly:(true false)' '--remoteonly+:remoteonly:(true false)') + ;; + list-components) + _command_args=('*:targets:_asadmin_targets_cluster_das_domain_standalone_instance' '--host+:' '--long+:long:(true false)' '--port+:' '--resources+:resources:(true false)' '--subcomponents+:subcomponents:(true false)' '--terse+:terse:(true false)' '--type+:') + ;; + list-configs) + _command_args=('*:targets:_asadmin_targets_cluster_clustered_instance_config_das_domain_standalone_instance' '--host+:' '--port+:') + ;; + list-connector-connection-pools) + _command_args=('--host+:' '--port+:') + ;; + list-connector-resources) + _command_args=('*:targets:_asadmin_targets_cluster_clustered_instance_das_domain_standalone_instance' '--host+:' '--port+:') + ;; + list-connector-security-maps) + _command_args=('--host+:' '--long+:long:(true false)' '--port+:' '--securitymap+:' '--target+:target:_asadmin_targets_cluster_clustered_instance_das_domain_standalone_instance') + ;; + list-connector-work-security-maps) + _command_args=('--host+:' '--port+:' '--securitymap+:') + ;; + list-containers) + _command_args=('--host+:' '--port+:') + ;; + list-custom-resources) + _command_args=('*:targets:_asadmin_targets_cluster_clustered_instance_das_domain_standalone_instance' '--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_clustered_instance_das_domain_standalone_instance') + ;; + list-descriptors) + _command_args=('--host+:' '--port+:') + ;; + list-domains) + _command_args=('--domaindir+:') + ;; + list-file-groups) + _command_args=('--authrealmname+:' '--host+:' '--name+:' '--port+:') + ;; + list-file-users) + _command_args=('*:targets:_asadmin_targets_cluster_clustered_instance_config_das_standalone_instance' '--authrealmname+:' '--host+:' '--port+:') + ;; + list-http-lb-configs) + _command_args=('--host+:' '--port+:') + ;; + list-http-listeners) + _command_args=('*:targets:_asadmin_targets_cluster_config_das_standalone_instance' '--host+:' '--long+:long:(true false)' '--port+:') + ;; + list-iiop-listeners) + _command_args=('*:targets:_asadmin_targets_cluster_clustered_instance_config_das_domain_standalone_instance' '--host+:' '--port+:') + ;; + list-instances) + _command_args=('--host+:' '--long+:long:(true false)' '--nostatus+:nostatus:(true false)' '--port+:' '--standaloneonly+:standaloneonly:(true false)' '--timeoutmsec+:') + ;; + list-jacc-providers) + _command_args=('*:targets:_asadmin_targets_cluster_clustered_instance_config_das_standalone_instance' '--host+:' '--port+:') + ;; + list-javamail-resources) + _command_args=('*:targets:_asadmin_targets_cluster_clustered_instance_das_domain_standalone_instance' '--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_clustered_instance_das_domain_standalone_instance') + ;; + list-jdbc-connection-pools) + _command_args=('--host+:' '--port+:') + ;; + list-jdbc-resources) + _command_args=('--host+:' '--port+:') + ;; + list-jms-hosts) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + list-jms-resources) + _command_args=('*:targets:_asadmin_targets_cluster_das_domain_standalone_instance' '--host+:' '--port+:' '--restype+:') + ;; + list-jmsdest) + _command_args=('*:targets:_asadmin_targets_cluster_config_das_standalone_instance' '--desttype+:' '--host+:' '--port+:' '--property+:') + ;; + list-jndi-entries) + _command_args=('*:targets:_asadmin_targets_cluster_clustered_instance_das_domain_standalone_instance' '--context+:' '--host+:' '--port+:') + ;; + list-jndi-resources) + _command_args=('*:targets:_asadmin_targets_cluster_clustered_instance_das_domain_standalone_instance' '--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_clustered_instance_das_domain_standalone_instance') + ;; + list-jvm-options) + _command_args=('--host+:' '--port+:' '--profiler+:profiler:(true false)' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + list-libraries) + _command_args=('--host+:' '--port+:' '--type+:type:(common ext app)') + ;; + list-lifecycle-modules) + _command_args=('*:targets:_asadmin_targets_cluster_das_domain_standalone_instance' '--host+:' '--port+:' '--terse+:terse:(true false)') + ;; + list-log-attributes) + _command_args=('*:targets:_asadmin_targets_cluster_clustered_instance_config_das_standalone_instance' '--host+:' '--port+:') + ;; + list-log-levels) + _command_args=('--host+:' '--port+:') + ;; + list-message-security-providers) + _command_args=('*:targets:_asadmin_targets_cluster_clustered_instance_config_das_standalone_instance' '--host+:' '--layer+:layer:(SOAP HttpServlet)' '--port+:') + ;; + list-modules) + _command_args=('--host+:' '--port+:') + ;; + list-network-listeners) + _command_args=('*:targets:_asadmin_targets_cluster_config_das_standalone_instance' '--host+:' '--port+:') + ;; + list-nodes) + _command_args=('--host+:' '--long+:long:(true false)' '--port+:' '--terse+:terse:(true false)') + ;; + list-nodes-config) + _command_args=('--host+:' '--long+:long:(true false)' '--port+:' '--terse+:terse:(true false)') + ;; + list-nodes-dcom) + _command_args=('--host+:' '--long+:long:(true false)' '--port+:' '--terse+:terse:(true false)') + ;; + list-nodes-ssh) + _command_args=('--host+:' '--long+:long:(true false)' '--port+:' '--terse+:terse:(true false)') + ;; + list-password-aliases) + _command_args=('--host+:' '--port+:') + ;; + list-persistence-types) + _command_args=('--host+:' '--port+:' '--type+:') + ;; + list-protocol-filters) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + list-protocol-finders) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + list-protocols) + _command_args=('*:targets:_asadmin_targets_cluster_config_das_standalone_instance' '--host+:' '--port+:') + ;; + list-resource-adapter-configs) + _command_args=('--host+:' '--long+:long:(true false)' '--port+:' '--raname+:') + ;; + list-resource-refs) + _command_args=('*:targets:_asadmin_targets_cluster_clustered_instance_das_standalone_instance' '--host+:' '--port+:') + ;; + list-sub-components) + _command_args=('--appname+:' '--host+:' '--port+:' '--resources+:resources:(true false)' '--terse+:terse:(true false)' '--type+:') + ;; + list-supported-cipher-suites) + _command_args=('--host+:' '--port+:') + ;; + list-system-properties) + _command_args=('*:targets:_asadmin_targets_cluster_clustered_instance_config_das_domain_standalone_instance' '--host+:' '--port+:') + ;; + list-threadpools) + _command_args=('--host+:' '--port+:') + ;; + list-timers) + _command_args=('*:targets:_asadmin_targets_cluster_das_standalone_instance' '--host+:' '--port+:') + ;; + list-transports) + _command_args=('*:targets:_asadmin_targets_cluster_config_das_standalone_instance' '--host+:' '--port+:') + ;; + list-virtual-servers) + _command_args=('*:targets:_asadmin_targets_cluster_config_das_standalone_instance' '--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + list-web-context-param) + _command_args=('--host+:' '--name+:' '--port+:') + ;; + list-web-env-entry) + _command_args=('--host+:' '--name+:' '--port+:') + ;; + login) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_das_standalone_instance') + ;; + migrate-timers) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_clustered_instance_das') + ;; + monitor) + _command_args=('--filename+:filename:directory:_files' '--filter+:' '--interval+:' '--type+:') + ;; + multimode) + _command_args=('--encoding+:' '--file+:file:directory:_files' '--printprompt+:printprompt:(true false)') + ;; + ping-connection-pool) + _command_args=('--appname+:' '--host+:' '--modulename+:' '--port+:' '--target+:') + ;; + ping-node-dcom) + _command_args=('*:nodes:_asadmin_nodes_dcom' '--host+:' '--port+:' '--validate+:validate:(true false)') + ;; + ping-node-ssh) + _command_args=('*:nodes:_asadmin_nodes_ssh' '--host+:' '--port+:' '--validate+:validate:(true false)') + ;; + recover-transactions) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_clustered_instance_das_standalone_instance' '--transactionlogdir+:') + ;; + redeploy) + _command_args=('*:directory:_files' '--asyncreplication+:asyncreplication:(true false)' '--availabilityenabled+:availabilityenabled:(true false)' '--contextroot+:' '--createtables+:createtables:(true false)' '--dbvendorname+:' '--deploymentplan+:deploymentplan:directory:_files' '--description+:' '--dropandcreatetables+:dropandcreatetables:(true false)' '--enabled+:enabled:(true false)' '--force+:force:(true false)' '--generatermistubs+:generatermistubs:(true false)' '--host+:' '--isredeploy+:isredeploy:(true false)' '--keepfailedstubs+:keepfailedstubs:(true false)' '--keepreposdir+:keepreposdir:(true false)' '--keepstate+:keepstate:(true false)' '--lbenabled+:lbenabled:(true false)' '--libraries+:' '--logreportederrors+:logreportederrors:(true false)' '--name+:' '--port+:' '--precompilejsp+:precompilejsp:(true false)' '--properties+:' '--property+:' '--retrieve+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance' '--type+:' '--uniquetablenames+:uniquetablenames:(true false)' '--verify+:verify:(true false)' '--virtualservers+:') + ;; + remove-library) + _command_args=('*:libraries:_asadmin_libraries' '--host+:' '--port+:' '--type+:type:(common ext app)') + ;; + restart-domain) + _command_args=('--debug+:debug:(true false)' '--domaindir+:' '--force+:force:(true false)' '--kill+:kill:(true false)') + ;; + restart-instance) + _command_args=('*:instances:_asadmin_instances' '--debug+:' '--host+:' '--port+:') + ;; + restart-local-instance) + _command_args=('*:instances:_asadmin_instances' '--debug+:debug:(true false)' '--force+:force:(true false)' '--kill+:kill:(true false)' '--node+:node:_asadmin_nodes' '--nodedir+:') + ;; + restore-domain) + _command_args=('--backupconfig+:' '--backupdir+:' '--description+:' '--domaindir+:' '--filename+:' '--force+:force:(true false)' '--long+:long:(true false)') + ;; + rollback-transaction) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_clustered_instance_das_standalone_instance' '--transaction_id+:') + ;; + rotate-log) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_clustered_instance_das_standalone_instance') + ;; + set) + _command_args=('--host+:' '--port+:') + ;; + set-log-attributes) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + set-log-levels) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance') + ;; + set-web-context-param) + _command_args=('--description+:' '--host+:' '--ignoredescriptoritem+:ignoredescriptoritem:(true false)' '--name+:' '--port+:' '--value+:') + ;; + set-web-env-entry) + _command_args=('--description+:' '--host+:' '--ignoredescriptoritem+:ignoredescriptoritem:(true false)' '--name+:' '--port+:' '--type+:' '--value+:') + ;; + setup-ssh) + _command_args=('--generatekey+:generatekey:(true false)' '--sshkeyfile+:' '--sshport+:' '--sshpublickeyfile+:' '--sshuser+:') + ;; + show-component-status) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_clustered_instance_das_domain_standalone_instance') + ;; + start-cluster) + _command_args=('*:clusters:_asadmin_clusters' '--autohadboverride+:autohadboverride:(true false)' '--host+:' '--port+:' '--verbose+:verbose:(true false)') + ;; + start-database) + _command_args=('--dbhome+:' '--dbhost+:' '--dbport+:' '--jvmoptions+:') + ;; + start-domain) + _command_args=('--debug+:debug:(true false)' '--domaindir+:' '--upgrade+:upgrade:(true false)' '--verbose+:verbose:(true false)') + ;; + start-instance) + _command_args=('*:instances:_asadmin_instances' '--debug+:debug:(true false)' '--host+:' '--port+:' '--setenv+:' '--sync+:sync:(none normal full)' '--terse+:terse:(true false)') + ;; + start-local-instance) + _command_args=('*:instances:_asadmin_instances' '--debug+:debug:(true false)' '--node+:node:_asadmin_nodes' '--nodedir+:' '--sync+:sync:(none normal full)' '--verbose+:verbose:(true false)') + ;; + stop-cluster) + _command_args=('*:clusters:_asadmin_clusters' '--autohadboverride+:autohadboverride:(true false)' '--host+:' '--kill+:kill:(true false)' '--port+:' '--verbose+:verbose:(true false)') + ;; + stop-database) + _command_args=('--dbhost+:' '--dbport+:' '--dbuser+:') + ;; + stop-domain) + _command_args=('--domaindir+:' '--force+:force:(true false)' '--kill+:kill:(true false)') + ;; + stop-instance) + _command_args=('*:instances:_asadmin_instances' '--force+:force:(true false)' '--host+:' '--kill+:kill:(true false)' '--port+:') + ;; + stop-local-instance) + _command_args=('*:instances:_asadmin_instances' '--force+:force:(true false)' '--kill+:kill:(true false)' '--node+:node:_asadmin_nodes' '--nodedir+:') + ;; + test-upgrade) + _command_args=('--host+:' '--port+:') + ;; + undeploy) + _command_args=('*:applications:_asadmin_applications' '--cascade+:cascade:(true false)' '--droptables+:droptables:(true false)' '--host+:' '--isredeploy+:isredeploy:(true false)' '--keepreposdir+:keepreposdir:(true false)' '--keepstate+:keepstate:(true false)' '--port+:' '--properties+:' '--target+:target:_asadmin_targets_cluster_das_domain_standalone_instance') + ;; + unfreeze-transaction-service) + _command_args=('--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_clustered_instance_config_das_standalone_instance') + ;; + uninstall-node) + _command_args=('--force+:force:(true false)' '--installdir+:' '--sshkeyfile+:' '--sshport+:' '--sshuser+:') + ;; + uninstall-node-dcom) + _command_args=('--force+:force:(true false)' '--installdir+:' '--windowsdomain+:' '--windowsuser+:') + ;; + uninstall-node-ssh) + _command_args=('--force+:force:(true false)' '--installdir+:' '--sshkeyfile+:' '--sshport+:' '--sshuser+:') + ;; + unset-web-context-param) + _command_args=('--host+:' '--name+:' '--port+:') + ;; + unset-web-env-entry) + _command_args=('--host+:' '--name+:' '--port+:') + ;; + update-connector-security-map) + _command_args=('--addprincipals+:' '--addusergroups+:' '--host+:' '--mappedpassword+:' '--mappedusername+:' '--poolname+:' '--port+:' '--removeprincipals+:' '--removeusergroups+:' '--target+:') + ;; + update-connector-work-security-map) + _command_args=('--addgroups+:' '--addprincipals+:' '--host+:' '--port+:' '--raname+:' '--removegroups+:' '--removeprincipals+:') + ;; + update-file-user) + _command_args=('--authrealmname+:' '--groups+:' '--host+:' '--port+:' '--target+:target:_asadmin_targets_cluster_config_das_standalone_instance' '--userpassword+:') + ;; + update-node-config) + _command_args=('*:nodes:_asadmin_nodes_config' '--host+:' '--installdir+:' '--nodedir+:' '--nodehost+:' '--port+:') + ;; + update-node-dcom) + _command_args=('*:nodes:_asadmin_nodes_dcom' '--force+:force:(true false)' '--host+:' '--installdir+:' '--nodedir+:' '--nodehost+:' '--port+:' '--windowsdomain+:' '--windowspassword+:' '--windowsuser+:') + ;; + update-node-ssh) + _command_args=('*:nodes:_asadmin_nodes_ssh' '--force+:force:(true false)' '--host+:' '--installdir+:' '--nodedir+:' '--nodehost+:' '--port+:' '--sshkeyfile+:' '--sshkeypassphrase+:' '--sshpassword+:' '--sshport+:' '--sshuser+:') + ;; + update-password-alias) + _command_args=('--aliaspassword+:' '--host+:' '--port+:') + ;; + uptime) + _command_args=('--host+:' '--milliseconds+:milliseconds:(true false)' '--port+:') + ;; + validate-dcom) + _command_args=('--host+:' '--port+:' '--remotetestdir+:' '--verbose+:verbose:(true false)' '--windowsdomain+:' '--windowspassword+:' '--windowsuser+:') + ;; + validate-multicast) + _command_args=('--bindaddress+:' '--multicastaddress+:' '--multicastport+:' '--sendperiod+:' '--timeout+:' '--timetolive+:' '--verbose+:verbose:(true false)') + ;; + verify-domain-xml) + _command_args=('--domaindir+:') + ;; + version) + _command_args=('--local+:local:(true false)' '--terse+:terse:(true false)' '--verbose+:verbose:(true false)') + ;; +esac + + +_asadmin_applications() { + compadd $(command asadmin list-applications --terse | sed 's/\s.*//') +} + +_asadmin_clusters() { + compadd $(command asadmin list-clusters --terse | sed 's/\s.*//') +} + +_asadmin_configs() { + compadd $(command asadmin list-configs --terse) +} + +_asadmin_instances() { + compadd $(command asadmin list-instances --terse --nostatus domain) +} + +_asadmin_instances_standalone() { + compadd $(command asadmin list-instances --terse --standaloneonly --nostatus domain) +} + +_asadmin_libraries() { + compadd $(command asadmin list-libraries --terse) +} + +_asadmin_nodes() { + compadd $(command asadmin list-nodes --terse) +} + +_asadmin_nodes_config() { + compadd $(command asadmin list-nodes-config --terse) +} + +_asadmin_nodes_dcom() { + compadd $(command asadmin list-nodes-dcom --terse) +} + +_asadmin_nodes_ssh() { + compadd $(command asadmin list-nodes-ssh --terse) +} + +_asadmin_targets() { + _asadmin_instances + _asadmin_clusters + _asadmin_configs + compadd domain server +} + +_asadmin_targets_cluster_clustered_instance_config_das_domain_standalone_instance() { + _asadmin_instances + _asadmin_clusters + _asadmin_configs + compadd domain server +} + +_asadmin_targets_cluster_clustered_instance_config_das_standalone_instance() { + _asadmin_instances + _asadmin_clusters + _asadmin_configs + compadd server +} + +_asadmin_targets_cluster_clustered_instance_das_domain_standalone_instance() { + _asadmin_instances + _asadmin_clusters + compadd domain server +} + +_asadmin_targets_cluster_clustered_instance_das_standalone_instance() { + _asadmin_instances + _asadmin_clusters + _asadmin_configs + compadd server +} + +_asadmin_targets_cluster_config_das_standalone_instance() { + _asadmin_instances_standalone + _asadmin_clusters + _asadmin_configs + compadd server +} + +_asadmin_targets_cluster_das_domain_standalone_instance() { + _asadmin_instances_standalone + _asadmin_clusters + compadd domain server +} + +_asadmin_targets_cluster_das_standalone_instance() { + _asadmin_instances_standalone + _asadmin_clusters + compadd server +} + +_asadmin_targets_clustered_instance_das() { + _asadmin_instances + compadd server +} + +_asadmin_targets_clustered_instance_das_standalone_instance() { + _asadmin_instances + compadd server +} + +_asadmin_targets_cluster_standalone_instance() { + _asadmin_clusters + _asadmin_instances_standalone +} + + +compadd '--help' +_arguments \ + $_command_args \ + && return 0; diff --git a/oh-my-zsh/plugins/glassfish/glassfish.plugin.zsh b/oh-my-zsh/plugins/glassfish/glassfish.plugin.zsh @@ -0,0 +1,3 @@ +# if there is a user named 'glassfish' on the system, we'll assume +# that is the user asadmin should be run as +# grep -e '^glassfish' /etc/passwd > /dev/null && alias asadmin='sudo -u glassfish asadmin'+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/globalias/README.md b/oh-my-zsh/plugins/globalias/README.md @@ -0,0 +1,62 @@ +# Globalias plugin + +Expands all glob expressions, subcommands and aliases (including global). + +Idea from: http://blog.patshead.com/2012/11/automatically-expaning-zsh-global-aliases---simplified.html. + +## Usage + +Add `globalias` to the plugins array in your zshrc file: + +```zsh +plugins=(... globalias) +``` + +Then just press `SPACE` to trigger the expansion of a command you've written. + +If you only want to insert a space without expanding the command line, press +`CTRL`+`SPACE`. + +## Examples + +#### Glob expressions + +``` +$ touch {1..10}<space> +# expands to +$ touch 1 2 3 4 5 6 7 8 9 10 + +$ ls **/*.json<space> +# expands to +$ ls folder/file.json anotherfolder/another.json +``` + +#### Subcommands + +``` +$ mkdir "`date -R`" +# expands to +$ mkdir Tue,\ 04\ Oct\ 2016\ 13:54:03\ +0300 + +``` + +#### Aliases + +``` +# .zshrc: +alias -g G="| grep --color=auto -P" +alias l='ls --color=auto -lah' + +$ l<space>G<space> +# expands to +$ ls --color=auto -lah | grep --color=auto -P +``` + +``` +# .zsrc: +alias S="sudo systemctl" + +$ S<space> +# expands to: +$ sudo systemctl +``` diff --git a/oh-my-zsh/plugins/globalias/globalias.plugin.zsh b/oh-my-zsh/plugins/globalias/globalias.plugin.zsh @@ -0,0 +1,17 @@ +globalias() { + zle _expand_alias + zle expand-word + zle self-insert +} +zle -N globalias + +# space expands all aliases, including global +bindkey -M emacs " " globalias +bindkey -M viins " " globalias + +# control-space to make a normal space +bindkey -M emacs "^ " magic-space +bindkey -M viins "^ " magic-space + +# normal space during searches +bindkey -M isearch " " magic-space diff --git a/oh-my-zsh/plugins/gnu-utils/gnu-utils.plugin.zsh b/oh-my-zsh/plugins/gnu-utils/gnu-utils.plugin.zsh @@ -0,0 +1,83 @@ +# ------------------------------------------------------------------------------ +# FILE: gnu-utils.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) +# VERSION: 1.0.0 +# ------------------------------------------------------------------------------ + + +if [[ -x "${commands[gwhoami]}" ]]; then + __gnu_utils() { + emulate -L zsh + local gcmds + local gcmd + local cmd + local prefix + + # coreutils + gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod' + 'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate' + 'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand' + 'gexpr' 'gfactor' 'gfalse' 'gfmt' 'gfold' 'ggroups' 'ghead' 'ghostid' + 'gid' 'ginstall' 'gjoin' 'gkill' 'glink' 'gln' 'glogname' 'gls' 'gmd5sum' + 'gmkdir' 'gmkfifo' 'gmknod' 'gmktemp' 'gmv' 'gnice' 'gnl' 'gnohup' 'gnproc' + 'god' 'gpaste' 'gpathchk' 'gpinky' 'gpr' 'gprintenv' 'gprintf' 'gptx' 'gpwd' + 'greadlink' 'grm' 'grmdir' 'gruncon' 'gseq' 'gsha1sum' 'gsha224sum' + 'gsha256sum' 'gsha384sum' 'gsha512sum' 'gshred' 'gshuf' 'gsleep' 'gsort' + 'gsplit' 'gstat' 'gstty' 'gsum' 'gsync' 'gtac' 'gtail' 'gtee' 'gtest' + 'gtimeout' 'gtouch' 'gtr' 'gtrue' 'gtruncate' 'gtsort' 'gtty' 'guname' + 'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho' + 'gwhoami' 'gyes') + + # findutils + gcmds+=('gfind' 'gxargs' 'glocate') + + # Not part of either coreutils or findutils, installed separately. + gcmds+=('gsed' 'gtar' 'gtime') + + for gcmd in "${gcmds[@]}"; do + # + # This method allows for builtin commands to be primary but it's + # lost if hash -r or rehash -f is executed. Thus, those two + # functions have to be wrapped. + # + (( ${+commands[$gcmd]} )) && hash ${gcmd[2,-1]}=${commands[$gcmd]} + + # + # This method generates wrapper functions. + # It will override shell builtins. + # + # (( ${+commands[$gcmd]} )) && \ + # eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }" + + # + # This method is inflexible since the aliases are at risk of being + # overridden resulting in the BSD coreutils being called. + # + # (( ${+commands[$gcmd]} )) && \ + # alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}" + done + + return 0 + } + __gnu_utils; + + function hash() { + if [[ "$*" =~ "-(r|f)" ]]; then + builtin hash "$@" + __gnu_utils + else + builtin hash "$@" + fi + } + + function rehash() { + if [[ "$*" =~ "-f" ]]; then + builtin rehash "$@" + __gnu_utils + else + builtin rehash "$@" + fi + } +fi + diff --git a/oh-my-zsh/plugins/go/go.plugin.zsh b/oh-my-zsh/plugins/go/go.plugin.zsh @@ -0,0 +1,193 @@ +# install in /etc/zsh/zshrc or your personal .zshrc + +# gc +prefixes=(5 6 8) +for p in $prefixes; do + compctl -g "*.${p}" ${p}l + compctl -g "*.go" ${p}g +done + +# standard go tools +compctl -g "*.go" gofmt + +# gccgo +compctl -g "*.go" gccgo + +# go tool +__go_tool_complete() { + typeset -a commands build_flags + commands+=( + 'build[compile packages and dependencies]' + 'clean[remove object files]' + 'doc[run godoc on package sources]' + 'env[print Go environment information]' + 'fix[run go tool fix on packages]' + 'fmt[run gofmt on package sources]' + 'generate[generate Go files by processing source]' + 'get[download and install packages and dependencies]' + 'help[display help]' + 'install[compile and install packages and dependencies]' + 'list[list packages]' + 'run[compile and run Go program]' + 'test[test packages]' + 'tool[run specified go tool]' + 'version[print Go version]' + 'vet[run go tool vet on packages]' + ) + if (( CURRENT == 2 )); then + # explain go commands + _values 'go tool commands' ${commands[@]} + return + fi + build_flags=( + '-a[force reinstallation of packages that are already up-to-date]' + '-n[print the commands but do not run them]' + '-p[number of parallel builds]:number' + '-race[enable data race detection]' + '-x[print the commands]' + '-work[print temporary directory name and keep it]' + '-ccflags[flags for 5c/6c/8c]:flags' + '-gcflags[flags for 5g/6g/8g]:flags' + '-ldflags[flags for 5l/6l/8l]:flags' + '-gccgoflags[flags for gccgo]:flags' + '-compiler[name of compiler to use]:name' + '-installsuffix[suffix to add to package directory]:suffix' + '-tags[list of build tags to consider satisfied]:tags' + ) + __go_packages() { + local gopaths + declare -a gopaths + gopaths=("${(s/:/)$(go env GOPATH)}") + gopaths+=("$(go env GOROOT)") + for p in $gopaths; do + _path_files -W "$p/src" -/ + done + } + __go_identifiers() { + compadd $(godoc -templates $ZSH/plugins/golang/templates ${words[-2]} 2> /dev/null) + } + case ${words[2]} in + doc) + _arguments -s -w \ + "-c[symbol matching honors case (paths not affected)]" \ + "-cmd[show symbols with package docs even if package is a command]" \ + "-u[show unexported symbols as well as exported]" \ + "2:importpaths:__go_packages" \ + ":next identifiers:__go_identifiers" + ;; + clean) + _arguments -s -w \ + "-i[remove the corresponding installed archive or binary (what 'go install' would create)]" \ + "-n[print the remove commands it would execute, but not run them]" \ + "-r[apply recursively to all the dependencies of the packages named by the import paths]" \ + "-x[print remove commands as it executes them]" \ + "*:importpaths:__go_packages" + ;; + fix|fmt|list|vet) + _alternative ':importpaths:__go_packages' ':files:_path_files -g "*.go"' + ;; + install) + _arguments -s -w : ${build_flags[@]} \ + "-v[show package names]" \ + '*:importpaths:__go_packages' + ;; + get) + _arguments -s -w : \ + ${build_flags[@]} + ;; + build) + _arguments -s -w : \ + ${build_flags[@]} \ + "-v[show package names]" \ + "-o[output file]:file:_files" \ + "*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }" + ;; + test) + _arguments -s -w : \ + ${build_flags[@]} \ + "-c[do not run, compile the test binary]" \ + "-i[do not run, install dependencies]" \ + "-v[print test output]" \ + "-x[print the commands]" \ + "-short[use short mode]" \ + "-parallel[number of parallel tests]:number" \ + "-cpu[values of GOMAXPROCS to use]:number list" \ + "-run[run tests and examples matching regexp]:regexp" \ + "-bench[run benchmarks matching regexp]:regexp" \ + "-benchmem[print memory allocation stats]" \ + "-benchtime[run each benchmark until taking this long]:duration" \ + "-blockprofile[write goroutine blocking profile to file]:file" \ + "-blockprofilerate[set sampling rate of goroutine blocking profile]:number" \ + "-timeout[kill test after that duration]:duration" \ + "-cpuprofile[write CPU profile to file]:file:_files" \ + "-memprofile[write heap profile to file]:file:_files" \ + "-memprofilerate[set heap profiling rate]:number" \ + "*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }" + ;; + help) + _values "${commands[@]}" \ + 'gopath[GOPATH environment variable]' \ + 'packages[description of package lists]' \ + 'remote[remote import path syntax]' \ + 'testflag[description of testing flags]' \ + 'testfunc[description of testing functions]' + ;; + run) + _arguments -s -w : \ + ${build_flags[@]} \ + '*:file:_path_files -g "*.go"' + ;; + tool) + if (( CURRENT == 3 )); then + _values "go tool" $(go tool) + return + fi + case ${words[3]} in + [568]g) + _arguments -s -w : \ + '-I[search for packages in DIR]:includes:_path_files -/' \ + '-L[show full path in file:line prints]' \ + '-S[print the assembly language]' \ + '-V[print the compiler version]' \ + '-e[no limit on number of errors printed]' \ + '-h[panic on an error]' \ + '-l[disable inlining]' \ + '-m[print optimization decisions]' \ + '-o[file specify output file]:file' \ + '-p[assumed import path for this code]:importpath' \ + '-u[disable package unsafe]' \ + "*:file:_files -g '*.go'" + ;; + [568]l) + local O=${words[3]%l} + _arguments -s -w : \ + '-o[file specify output file]:file' \ + '-L[search for packages in DIR]:includes:_path_files -/' \ + "*:file:_files -g '*.[ao$O]'" + ;; + dist) + _values "dist tool" banner bootstrap clean env install version + ;; + *) + # use files by default + _files + ;; + esac + ;; + esac +} + +compdef __go_tool_complete go + +# aliases: go<~> +alias gob='go build' +alias goc='go clean' +alias god='go doc' +alias gof='go fmt' +alias gofa='go fmt . ./...' +alias gog='go get' +alias goi='go install' +alias gol='go list' +alias gor='go run' +alias got='go test' +alias gov='go vet' diff --git a/oh-my-zsh/plugins/golang/golang.plugin.zsh b/oh-my-zsh/plugins/golang/golang.plugin.zsh @@ -0,0 +1,193 @@ +# install in /etc/zsh/zshrc or your personal .zshrc + +# gc +prefixes=(5 6 8) +for p in $prefixes; do + compctl -g "*.${p}" ${p}l + compctl -g "*.go" ${p}g +done + +# standard go tools +compctl -g "*.go" gofmt + +# gccgo +compctl -g "*.go" gccgo + +# go tool +__go_tool_complete() { + typeset -a commands build_flags + commands+=( + 'build[compile packages and dependencies]' + 'clean[remove object files]' + 'doc[run godoc on package sources]' + 'env[print Go environment information]' + 'fix[run go tool fix on packages]' + 'fmt[run gofmt on package sources]' + 'generate[generate Go files by processing source]' + 'get[download and install packages and dependencies]' + 'help[display help]' + 'install[compile and install packages and dependencies]' + 'list[list packages]' + 'run[compile and run Go program]' + 'test[test packages]' + 'tool[run specified go tool]' + 'version[print Go version]' + 'vet[run go tool vet on packages]' + ) + if (( CURRENT == 2 )); then + # explain go commands + _values 'go tool commands' ${commands[@]} + return + fi + build_flags=( + '-a[force reinstallation of packages that are already up-to-date]' + '-n[print the commands but do not run them]' + '-p[number of parallel builds]:number' + '-race[enable data race detection]' + '-x[print the commands]' + '-work[print temporary directory name and keep it]' + '-ccflags[flags for 5c/6c/8c]:flags' + '-gcflags[flags for 5g/6g/8g]:flags' + '-ldflags[flags for 5l/6l/8l]:flags' + '-gccgoflags[flags for gccgo]:flags' + '-compiler[name of compiler to use]:name' + '-installsuffix[suffix to add to package directory]:suffix' + '-tags[list of build tags to consider satisfied]:tags' + ) + __go_packages() { + local gopaths + declare -a gopaths + gopaths=("${(s/:/)$(go env GOPATH)}") + gopaths+=("$(go env GOROOT)") + for p in $gopaths; do + _path_files -W "$p/src" -/ + done + } + __go_identifiers() { + compadd $(godoc -templates $ZSH/plugins/golang/templates ${words[-2]} 2> /dev/null) + } + case ${words[2]} in + doc) + _arguments -s -w \ + "-c[symbol matching honors case (paths not affected)]" \ + "-cmd[show symbols with package docs even if package is a command]" \ + "-u[show unexported symbols as well as exported]" \ + "2:importpaths:__go_packages" \ + ":next identifiers:__go_identifiers" + ;; + clean) + _arguments -s -w \ + "-i[remove the corresponding installed archive or binary (what 'go install' would create)]" \ + "-n[print the remove commands it would execute, but not run them]" \ + "-r[apply recursively to all the dependencies of the packages named by the import paths]" \ + "-x[print remove commands as it executes them]" \ + "*:importpaths:__go_packages" + ;; + fix|fmt|list|vet) + _alternative ':importpaths:__go_packages' ':files:_path_files -g "*.go"' + ;; + install) + _arguments -s -w : ${build_flags[@]} \ + "-v[show package names]" \ + '*:importpaths:__go_packages' + ;; + get) + _arguments -s -w : \ + ${build_flags[@]} + ;; + build) + _arguments -s -w : \ + ${build_flags[@]} \ + "-v[show package names]" \ + "-o[output file]:file:_files" \ + "*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }" + ;; + test) + _arguments -s -w : \ + ${build_flags[@]} \ + "-c[do not run, compile the test binary]" \ + "-i[do not run, install dependencies]" \ + "-v[print test output]" \ + "-x[print the commands]" \ + "-short[use short mode]" \ + "-parallel[number of parallel tests]:number" \ + "-cpu[values of GOMAXPROCS to use]:number list" \ + "-run[run tests and examples matching regexp]:regexp" \ + "-bench[run benchmarks matching regexp]:regexp" \ + "-benchmem[print memory allocation stats]" \ + "-benchtime[run each benchmark until taking this long]:duration" \ + "-blockprofile[write goroutine blocking profile to file]:file" \ + "-blockprofilerate[set sampling rate of goroutine blocking profile]:number" \ + "-timeout[kill test after that duration]:duration" \ + "-cpuprofile[write CPU profile to file]:file:_files" \ + "-memprofile[write heap profile to file]:file:_files" \ + "-memprofilerate[set heap profiling rate]:number" \ + "*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }" + ;; + help) + _values "${commands[@]}" \ + 'gopath[GOPATH environment variable]' \ + 'packages[description of package lists]' \ + 'remote[remote import path syntax]' \ + 'testflag[description of testing flags]' \ + 'testfunc[description of testing functions]' + ;; + run) + _arguments -s -w : \ + ${build_flags[@]} \ + '*:file:_path_files -g "*.go"' + ;; + tool) + if (( CURRENT == 3 )); then + _values "go tool" $(go tool) + return + fi + case ${words[3]} in + [568]g) + _arguments -s -w : \ + '-I[search for packages in DIR]:includes:_path_files -/' \ + '-L[show full path in file:line prints]' \ + '-S[print the assembly language]' \ + '-V[print the compiler version]' \ + '-e[no limit on number of errors printed]' \ + '-h[panic on an error]' \ + '-l[disable inlining]' \ + '-m[print optimization decisions]' \ + '-o[file specify output file]:file' \ + '-p[assumed import path for this code]:importpath' \ + '-u[disable package unsafe]' \ + "*:file:_files -g '*.go'" + ;; + [568]l) + local O=${words[3]%l} + _arguments -s -w : \ + '-o[file specify output file]:file' \ + '-L[search for packages in DIR]:includes:_path_files -/' \ + "*:file:_files -g '*.[ao$O]'" + ;; + dist) + _values "dist tool" banner bootstrap clean env install version + ;; + *) + # use files by default + _files + ;; + esac + ;; + esac +} + +compdef __go_tool_complete go + +# aliases: go<~> +alias gob='go build' +alias goc='go clean' +alias god='go doc' +alias gof='go fmt' +alias gofa='go fmt . ./...' +alias gog='go get' +alias goi='go install' +alias gol='go list' +alias gor='go run' +alias got='go test' +alias gov='go vet' diff --git a/oh-my-zsh/plugins/golang/templates/package.txt b/oh-my-zsh/plugins/golang/templates/package.txt @@ -0,0 +1,29 @@ +{{with .PDoc}}{{/* + +Constants +--------------------------------------- + +*/}}{{with .Consts}}{{range .}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{/* + +Variables +--------------------------------------- + +*/}}{{with .Vars}}{{range .}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{/* + +Functions +--------------------------------------- + +*/}}{{with .Funcs}}{{range .}}{{ .Name }} {{end}}{{end}}{{/* + +Types +--------------------------------------- + +*/}}{{with .Types}}{{range .}}{{ $TypeName := .Name }}{{ $TypeName }} {{/* + +*/}}{{range .Methods}}{{ $TypeName }}.{{.Name}} {{end}}{{/* + +*/}}{{range .Funcs}}{{.Name}} {{end}}{{/* + +*/}}{{range .Consts}}{{range .Names}}{{.}} {{end}}{{end}}{{/* + +*/}}{{range .Vars}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{end}}{{end}} diff --git a/oh-my-zsh/plugins/golang/templates/search.txt b/oh-my-zsh/plugins/golang/templates/search.txt diff --git a/oh-my-zsh/plugins/gpg-agent/gpg-agent.plugin.zsh b/oh-my-zsh/plugins/gpg-agent/gpg-agent.plugin.zsh @@ -0,0 +1,14 @@ +# Enable gpg-agent if it is not running +GPG_AGENT_SOCKET="${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.ssh" +if [ ! -S $GPG_AGENT_SOCKET ]; then + gpg-agent --daemon >/dev/null 2>&1 + export GPG_TTY=$(tty) +fi + +# Set SSH to use gpg-agent if it is configured to do so +GNUPGCONFIG="${GNUPGHOME:-"$HOME/.gnupg"}/gpg-agent.conf" +if [ -r "$GNUPGCONFIG" ] && grep -q enable-ssh-support "$GNUPGCONFIG"; then + unset SSH_AGENT_PID + export SSH_AUTH_SOCK=$GPG_AGENT_SOCKET +fi + diff --git a/oh-my-zsh/plugins/gradle/_gradle b/oh-my-zsh/plugins/gradle/_gradle @@ -0,0 +1,171 @@ +############################################################################## +# A descriptive listing of core Gradle commands +############################################################################ +function _gradle_core_commands() { + local ret=1 state + _arguments ':subcommand:->subcommand' && ret=0 + + case $state in + subcommand) + subcommands=( + "properties:Display all project properties" + "tasks:Calculate and display all tasks" + "dependencies:Calculate and display all dependencies" + "projects:Discover and display all sub-projects" + "build:Build the project" + "help:Display help" + ) + _describe -t subcommands 'gradle subcommands' subcommands && ret=0 + esac + + return ret +} + +function _gradle_arguments() { + _arguments -C \ + '-a[Do not rebuild project dependencies]' \ + '-b[Specifies the build file]' \ + '-c[Specifies the settings file]' \ + '-d[Log at the debug level]' \ + '-g[Specifies the Gradle user home directory]' \ + '-h[Shows a help message]' \ + '-i[Set log level to INFO]' \ + '-m[Runs the build with all task actions disabled]' \ + '-p[Specifies the start directory for Gradle]' \ + '-q[Log errors only]' \ + '-s[Print out the stacktrace also for user exceptions]' \ + '-t[Continuous mode. Automatically re-run build after changes]' \ + '-u[Don''t search in parent directories for a settings.gradle file]' \ + '-v[Prints Gradle version info]' \ + '-x[Specify a task to be excluded]' \ + '-D[Set a system property]' \ + '-I[Specifies an initialization script]' \ + '-P[Sets a project property of the root project]' \ + '-S[Print out the full (very verbose) stacktrace]' \ + '--build-file[Specifies the build file]' \ + '--configure-on-demand[Only relevant projects are configured]' \ + '--console[Type of console output to generate (plain, auto, or rich)]' \ + '--continue[Continues task execution after a task failure]' \ + '--continuous[Continuous mode. Automatically re-run build after changes]' \ + '--daemon[Use the Gradle Daemon]' \ + '--debug[Log at the debug level]' \ + '--dry-run[Runs the build with all task actions disabled]' \ + '--exclude-task[Specify a task to be excluded]' \ + '--full-stacktrace[Print out the full (very verbose) stacktrace]' \ + '--gradle-user-home[Specifies the Gradle user home directory]' \ + '--gui[Launches the Gradle GUI app (Deprecated)]' \ + '--help[Shows a help message]' \ + '--include-build[Run the build as a composite, including the specified build]' \ + '--info[Set log level to INFO]' \ + '--init-script[Specifies an initialization script]' \ + '--max-workers[Set the maximum number of workers that Gradle may use]' \ + '--no-daemon[Do not use the Gradle Daemon]' \ + '--no-rebuild[Do not rebuild project dependencies]' \ + '--no-search-upwards[Don''t search in parent directories for a settings.gradle file]' \ + '--offline[Build without accessing network resources]' \ + '--parallel[Build projects in parallel]' \ + '--profile[Profile build time and create report]' \ + '--project-cache-dir[Specifies the project-specific cache directory]' \ + '--project-dir[Specifies the start directory for Gradle]' \ + '--project-prop[Sets a project property of the root project]' \ + '--quiet[Log errors only]' \ + '--recompile-scripts[Forces scripts to be recompiled, bypassing caching]' \ + '--refresh-dependencies[Refresh the state of dependencies]' \ + '--rerun-task[Specifies that any task optimization is ignored]' \ + '--settings-file[Specifies the settings file]' \ + '--stacktrace[Print out the stacktrace also for user exceptions]' \ + '--status[Print Gradle Daemon status]' \ + '--stop[Stop all Gradle Daemons]' \ + '--system-prop[Set a system property]' \ + '--version[Prints Gradle version info]' \ + '*::command:->command' \ + && return 0 +} + + +############################################################################## +# Examine the build.gradle file to see if its timestamp has changed; +# and if so, regenerate the .gradle_tasks cache file +############################################################################ +_gradle_does_task_list_need_generating () { + [[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache ]] +} + +############## +# Parse the tasks from `gradle(w) tasks --all` and return them to the calling function. +# All lines in the output from gradle(w) that are between /^-+$/ and /^\s*$/ +# are considered to be tasks. If and when gradle adds support for listing tasks +# for programmatic parsing, this method can be deprecated. +############## +_gradle_parse_tasks () { + lines_might_be_tasks=false + task_name_buffer="" + while read -r line; do + if [[ $line =~ ^-+$ ]]; then + lines_might_be_tasks=true + # Empty buffer, because it contains items that are not tasks + task_name_buffer="" + elif [[ $line =~ ^\s*$ ]]; then + if [[ "$lines_might_be_tasks" = true ]]; then + # If a newline is found, echo the buffer to the calling function + while read -r task; do + echo $task | awk '/[a-zA-Z0-9:-]+/ {print $1}' + done <<< "$task_name_buffer" + # Empty buffer, because we are done with the tasks + task_name_buffer="" + fi + lines_might_be_tasks=false + elif [[ "$lines_might_be_tasks" = true ]]; then + task_name_buffer="${task_name_buffer}\n${line}" + fi + done <<< "$1" +} + + +############## +# Gradle tasks from subprojects are allowed to be executed without specifying +# the subproject; that task will then be called on all subprojects. +# gradle(w) tasks --all only lists tasks per subproject, but when autocompleting +# we often want to be able to run a specific task on all subprojects, e.g. +# "gradle clean". +# This function uses the list of tasks from "gradle tasks --all", and for each +# line grabs everything after the last ":" and combines that output with the original +# output. The combined list is returned as the result of this function. +############## +_gradle_parse_and_extract_tasks () { + # All tasks + tasks=$(_gradle_parse_tasks "$1") + # Task name without sub project(s) prefix + simple_tasks=$(echo $tasks | awk 'BEGIN { FS = ":" } { print $NF }') + echo "$tasks\n$simple_tasks" +} + +############################################################################## +# Discover the gradle tasks by running "gradle tasks --all" +############################################################################ +_gradle_tasks () { + if [[ -f build.gradle ]]; then + _gradle_arguments + if _gradle_does_task_list_need_generating; then + _gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache + fi + compadd -X "==== Gradle Tasks ====" $(cat .gradletasknamecache) + fi +} + +_gradlew_tasks () { + if [[ -f build.gradle ]]; then + _gradle_arguments + if _gradle_does_task_list_need_generating; then + _gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache + fi + compadd -X "==== Gradlew Tasks ====" $(cat .gradletasknamecache) + fi +} + + +############################################################################## +# Register the completions against the gradle and gradlew commands +############################################################################ +compdef _gradle_tasks gradle +compdef _gradlew_tasks gradlew diff --git a/oh-my-zsh/plugins/gradle/_gradlew b/oh-my-zsh/plugins/gradle/_gradlew @@ -0,0 +1,171 @@ +############################################################################## +# A descriptive listing of core Gradle commands +############################################################################ +function _gradle_core_commands() { + local ret=1 state + _arguments ':subcommand:->subcommand' && ret=0 + + case $state in + subcommand) + subcommands=( + "properties:Display all project properties" + "tasks:Calculate and display all tasks" + "dependencies:Calculate and display all dependencies" + "projects:Discover and display all sub-projects" + "build:Build the project" + "help:Display help" + ) + _describe -t subcommands 'gradle subcommands' subcommands && ret=0 + esac + + return ret +} + +function _gradle_arguments() { + _arguments -C \ + '-a[Do not rebuild project dependencies]' \ + '-b[Specifies the build file]' \ + '-c[Specifies the settings file]' \ + '-d[Log at the debug level]' \ + '-g[Specifies the Gradle user home directory]' \ + '-h[Shows a help message]' \ + '-i[Set log level to INFO]' \ + '-m[Runs the build with all task actions disabled]' \ + '-p[Specifies the start directory for Gradle]' \ + '-q[Log errors only]' \ + '-s[Print out the stacktrace also for user exceptions]' \ + '-t[Continuous mode. Automatically re-run build after changes]' \ + '-u[Don''t search in parent directories for a settings.gradle file]' \ + '-v[Prints Gradle version info]' \ + '-x[Specify a task to be excluded]' \ + '-D[Set a system property]' \ + '-I[Specifies an initialization script]' \ + '-P[Sets a project property of the root project]' \ + '-S[Print out the full (very verbose) stacktrace]' \ + '--build-file[Specifies the build file]' \ + '--configure-on-demand[Only relevant projects are configured]' \ + '--console[Type of console output to generate (plain, auto, or rich)]' \ + '--continue[Continues task execution after a task failure]' \ + '--continuous[Continuous mode. Automatically re-run build after changes]' \ + '--daemon[Use the Gradle Daemon]' \ + '--debug[Log at the debug level]' \ + '--dry-run[Runs the build with all task actions disabled]' \ + '--exclude-task[Specify a task to be excluded]' \ + '--full-stacktrace[Print out the full (very verbose) stacktrace]' \ + '--gradle-user-home[Specifies the Gradle user home directory]' \ + '--gui[Launches the Gradle GUI app (Deprecated)]' \ + '--help[Shows a help message]' \ + '--include-build[Run the build as a composite, including the specified build]' \ + '--info[Set log level to INFO]' \ + '--init-script[Specifies an initialization script]' \ + '--max-workers[Set the maximum number of workers that Gradle may use]' \ + '--no-daemon[Do not use the Gradle Daemon]' \ + '--no-rebuild[Do not rebuild project dependencies]' \ + '--no-search-upwards[Don''t search in parent directories for a settings.gradle file]' \ + '--offline[Build without accessing network resources]' \ + '--parallel[Build projects in parallel]' \ + '--profile[Profile build time and create report]' \ + '--project-cache-dir[Specifies the project-specific cache directory]' \ + '--project-dir[Specifies the start directory for Gradle]' \ + '--project-prop[Sets a project property of the root project]' \ + '--quiet[Log errors only]' \ + '--recompile-scripts[Forces scripts to be recompiled, bypassing caching]' \ + '--refresh-dependencies[Refresh the state of dependencies]' \ + '--rerun-task[Specifies that any task optimization is ignored]' \ + '--settings-file[Specifies the settings file]' \ + '--stacktrace[Print out the stacktrace also for user exceptions]' \ + '--status[Print Gradle Daemon status]' \ + '--stop[Stop all Gradle Daemons]' \ + '--system-prop[Set a system property]' \ + '--version[Prints Gradle version info]' \ + '*::command:->command' \ + && return 0 +} + + +############################################################################## +# Examine the build.gradle file to see if its timestamp has changed; +# and if so, regenerate the .gradle_tasks cache file +############################################################################ +_gradle_does_task_list_need_generating () { + [[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache ]] +} + +############## +# Parse the tasks from `gradle(w) tasks --all` and return them to the calling function. +# All lines in the output from gradle(w) that are between /^-+$/ and /^\s*$/ +# are considered to be tasks. If and when gradle adds support for listing tasks +# for programmatic parsing, this method can be deprecated. +############## +_gradle_parse_tasks () { + lines_might_be_tasks=false + task_name_buffer="" + while read -r line; do + if [[ $line =~ ^-+$ ]]; then + lines_might_be_tasks=true + # Empty buffer, because it contains items that are not tasks + task_name_buffer="" + elif [[ $line =~ ^\s*$ ]]; then + if [[ "$lines_might_be_tasks" = true ]]; then + # If a newline is found, echo the buffer to the calling function + while read -r task; do + echo $task | awk '/[a-zA-Z0-9:-]+/ {print $1}' + done <<< "$task_name_buffer" + # Empty buffer, because we are done with the tasks + task_name_buffer="" + fi + lines_might_be_tasks=false + elif [[ "$lines_might_be_tasks" = true ]]; then + task_name_buffer="${task_name_buffer}\n${line}" + fi + done <<< "$1" +} + + +############## +# Gradle tasks from subprojects are allowed to be executed without specifying +# the subproject; that task will then be called on all subprojects. +# gradle(w) tasks --all only lists tasks per subproject, but when autocompleting +# we often want to be able to run a specific task on all subprojects, e.g. +# "gradle clean". +# This function uses the list of tasks from "gradle tasks --all", and for each +# line grabs everything after the last ":" and combines that output with the original +# output. The combined list is returned as the result of this function. +############## +_gradle_parse_and_extract_tasks () { + # All tasks + tasks=$(_gradle_parse_tasks "$1") + # Task name without sub project(s) prefix + simple_tasks=$(echo $tasks | awk 'BEGIN { FS = ":" } { print $NF }') + echo "$tasks\n$simple_tasks" +} + +############################################################################## +# Discover the gradle tasks by running "gradle tasks --all" +############################################################################ +_gradle_tasks () { + if [[ -f build.gradle ]]; then + _gradle_arguments + if _gradle_does_task_list_need_generating; then + _gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache + fi + compadd -X "==== Gradle Tasks ====" $(cat .gradletasknamecache) + fi +} + +_gradlew_tasks () { + if [[ -f build.gradle ]]; then + _gradle_arguments + if _gradle_does_task_list_need_generating; then + _gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache + fi + compadd -X "==== Gradlew Tasks ====" $(cat .gradletasknamecache) + fi +} + + +############################################################################## +# Register the completions against the gradle and gradlew commands +############################################################################ +compdef _gradle_tasks gradle +compdef _gradlew_tasks gradlew diff --git a/oh-my-zsh/plugins/gradle/gradle.plugin.zsh b/oh-my-zsh/plugins/gradle/gradle.plugin.zsh @@ -0,0 +1,171 @@ +############################################################################## +# A descriptive listing of core Gradle commands +############################################################################ +function _gradle_core_commands() { + local ret=1 state + _arguments ':subcommand:->subcommand' && ret=0 + + case $state in + subcommand) + subcommands=( + "properties:Display all project properties" + "tasks:Calculate and display all tasks" + "dependencies:Calculate and display all dependencies" + "projects:Discover and display all sub-projects" + "build:Build the project" + "help:Display help" + ) + _describe -t subcommands 'gradle subcommands' subcommands && ret=0 + esac + + return ret +} + +function _gradle_arguments() { + _arguments -C \ + '-a[Do not rebuild project dependencies]' \ + '-b[Specifies the build file]' \ + '-c[Specifies the settings file]' \ + '-d[Log at the debug level]' \ + '-g[Specifies the Gradle user home directory]' \ + '-h[Shows a help message]' \ + '-i[Set log level to INFO]' \ + '-m[Runs the build with all task actions disabled]' \ + '-p[Specifies the start directory for Gradle]' \ + '-q[Log errors only]' \ + '-s[Print out the stacktrace also for user exceptions]' \ + '-t[Continuous mode. Automatically re-run build after changes]' \ + '-u[Don''t search in parent directories for a settings.gradle file]' \ + '-v[Prints Gradle version info]' \ + '-x[Specify a task to be excluded]' \ + '-D[Set a system property]' \ + '-I[Specifies an initialization script]' \ + '-P[Sets a project property of the root project]' \ + '-S[Print out the full (very verbose) stacktrace]' \ + '--build-file[Specifies the build file]' \ + '--configure-on-demand[Only relevant projects are configured]' \ + '--console[Type of console output to generate (plain, auto, or rich)]' \ + '--continue[Continues task execution after a task failure]' \ + '--continuous[Continuous mode. Automatically re-run build after changes]' \ + '--daemon[Use the Gradle Daemon]' \ + '--debug[Log at the debug level]' \ + '--dry-run[Runs the build with all task actions disabled]' \ + '--exclude-task[Specify a task to be excluded]' \ + '--full-stacktrace[Print out the full (very verbose) stacktrace]' \ + '--gradle-user-home[Specifies the Gradle user home directory]' \ + '--gui[Launches the Gradle GUI app (Deprecated)]' \ + '--help[Shows a help message]' \ + '--include-build[Run the build as a composite, including the specified build]' \ + '--info[Set log level to INFO]' \ + '--init-script[Specifies an initialization script]' \ + '--max-workers[Set the maximum number of workers that Gradle may use]' \ + '--no-daemon[Do not use the Gradle Daemon]' \ + '--no-rebuild[Do not rebuild project dependencies]' \ + '--no-search-upwards[Don''t search in parent directories for a settings.gradle file]' \ + '--offline[Build without accessing network resources]' \ + '--parallel[Build projects in parallel]' \ + '--profile[Profile build time and create report]' \ + '--project-cache-dir[Specifies the project-specific cache directory]' \ + '--project-dir[Specifies the start directory for Gradle]' \ + '--project-prop[Sets a project property of the root project]' \ + '--quiet[Log errors only]' \ + '--recompile-scripts[Forces scripts to be recompiled, bypassing caching]' \ + '--refresh-dependencies[Refresh the state of dependencies]' \ + '--rerun-task[Specifies that any task optimization is ignored]' \ + '--settings-file[Specifies the settings file]' \ + '--stacktrace[Print out the stacktrace also for user exceptions]' \ + '--status[Print Gradle Daemon status]' \ + '--stop[Stop all Gradle Daemons]' \ + '--system-prop[Set a system property]' \ + '--version[Prints Gradle version info]' \ + '*::command:->command' \ + && return 0 +} + + +############################################################################## +# Examine the build.gradle file to see if its timestamp has changed; +# and if so, regenerate the .gradle_tasks cache file +############################################################################ +_gradle_does_task_list_need_generating () { + [[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache ]] +} + +############## +# Parse the tasks from `gradle(w) tasks --all` and return them to the calling function. +# All lines in the output from gradle(w) that are between /^-+$/ and /^\s*$/ +# are considered to be tasks. If and when gradle adds support for listing tasks +# for programmatic parsing, this method can be deprecated. +############## +_gradle_parse_tasks () { + lines_might_be_tasks=false + task_name_buffer="" + while read -r line; do + if [[ $line =~ ^-+$ ]]; then + lines_might_be_tasks=true + # Empty buffer, because it contains items that are not tasks + task_name_buffer="" + elif [[ $line =~ ^\s*$ ]]; then + if [[ "$lines_might_be_tasks" = true ]]; then + # If a newline is found, echo the buffer to the calling function + while read -r task; do + echo $task | awk '/[a-zA-Z0-9:-]+/ {print $1}' + done <<< "$task_name_buffer" + # Empty buffer, because we are done with the tasks + task_name_buffer="" + fi + lines_might_be_tasks=false + elif [[ "$lines_might_be_tasks" = true ]]; then + task_name_buffer="${task_name_buffer}\n${line}" + fi + done <<< "$1" +} + + +############## +# Gradle tasks from subprojects are allowed to be executed without specifying +# the subproject; that task will then be called on all subprojects. +# gradle(w) tasks --all only lists tasks per subproject, but when autocompleting +# we often want to be able to run a specific task on all subprojects, e.g. +# "gradle clean". +# This function uses the list of tasks from "gradle tasks --all", and for each +# line grabs everything after the last ":" and combines that output with the original +# output. The combined list is returned as the result of this function. +############## +_gradle_parse_and_extract_tasks () { + # All tasks + tasks=$(_gradle_parse_tasks "$1") + # Task name without sub project(s) prefix + simple_tasks=$(echo $tasks | awk 'BEGIN { FS = ":" } { print $NF }') + echo "$tasks\n$simple_tasks" +} + +############################################################################## +# Discover the gradle tasks by running "gradle tasks --all" +############################################################################ +_gradle_tasks () { + if [[ -f build.gradle ]]; then + _gradle_arguments + if _gradle_does_task_list_need_generating; then + _gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache + fi + compadd -X "==== Gradle Tasks ====" $(cat .gradletasknamecache) + fi +} + +_gradlew_tasks () { + if [[ -f build.gradle ]]; then + _gradle_arguments + if _gradle_does_task_list_need_generating; then + _gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache + fi + compadd -X "==== Gradlew Tasks ====" $(cat .gradletasknamecache) + fi +} + + +############################################################################## +# Register the completions against the gradle and gradlew commands +############################################################################ +compdef _gradle_tasks gradle +compdef _gradlew_tasks gradlew diff --git a/oh-my-zsh/plugins/grails/grails.plugin.zsh b/oh-my-zsh/plugins/grails/grails.plugin.zsh @@ -0,0 +1,60 @@ +_enumerateGrailsScripts() { + # Default directoryies + directories=($GRAILS_HOME/scripts ~/.grails/scripts ./scripts) + + # Check all of the plugins directories, if they exist + if [ -d plugins ] + then + directories+=(plugins/*/scripts) + fi + + # Enumerate all of the Groovy files + files=() + for dir in $directories; + do + if [ -d $dir ] + then + files+=($dir/[^_]*.groovy) + fi + done + + # Don't try to basename () + if [ ${#files} -eq 0 ]; + then + return + fi + + scripts=() + for file in $files + do + # - Strip the path + # - Remove all scripts with a leading '_' + # - PackagePlugin_.groovy -> PackagePlugin + # - PackagePlugin -> Package-Plugin + # - Package-Plugin -> package-plugin + command=$(basename $file \ + | sed -E -e 's/^_?([^_]+)_?.groovy/\1/'\ + -e 's/([a-z])([A-Z])/\1-\2/g' \ + | tr "[:upper:]" "[:lower:]" \ + | sort \ + | uniq) + scripts+=($command) + done + echo $scripts +} + +_grails() { + if (( CURRENT == 2 )); then + scripts=( $(_enumerateGrailsScripts) ) + + if [ ${#scripts} -ne 0 ]; + then + _multi_parts / scripts + return + fi + fi + + _files +} + +compdef _grails grails diff --git a/oh-my-zsh/plugins/grunt/grunt.plugin.zsh b/oh-my-zsh/plugins/grunt/grunt.plugin.zsh @@ -0,0 +1,255 @@ +#compdef grunt +#autoload +# ----------------------------------------------------------------------------- +# _grunt +# +# Completion script for grunt. +# - https://github.com/gruntjs/grunt +# - https://github.com/gruntjs/grunt-cli +# +# ----------------------------------------------------------------------------- +# +# Version : 0.1.2 +# Author : Yonchu <yuyuchu3333@gmail.com> +# License : MIT License +# Repository : https://github.com/yonchu/grunt-zsh-completion +# Last Change : 20 Aug 2014. +# +# Copyright (c) 2013 Yonchu. +# +# ----------------------------------------------------------------------------- +# USAGE +# ----- +# +# Enable caching: +# +# If you want to use the cache, set the followings in your .zshrc: +# +# zstyle ':completion:*' use-cache yes +# +# +# Settings: +# +# - Show grunt file path: +# zstyle ':completion::complete:grunt::options:' show_grunt_path yes +# +# - Cache expiration days (default: 7): +# zstyle ':completion::complete:grunt::options:' expire 1 +# +# - Not update options cache if target gruntfile is changed. +# zstyle ':completion::complete:grunt::options:' no_update_options yes +# +# Note that if you change the zstyle settings, +# you should delete the cache file and restart zsh. +# +# $ rm ~/.zcompcache/grunt +# $ exec zsh +# +# ----------------------------------------------------------------------------- + +function __grunt() { + local curcontext="$curcontext" update_policy state + local show_grunt_path update_msg gruntfile opts tasks + + # Setup cache-policy. + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z $update_policy ]]; then + zstyle ":completion:${curcontext}:" cache-policy __grunt_caching_policy + fi + + # Check show_path option. + zstyle -b ":completion:${curcontext}:options:" show_grunt_path show_grunt_path + + # Get current gruntfile. + gruntfile=$(__grunt_get_gruntfile) + + # Initialize opts and tasks. + opts=() + tasks=() + + # Add help options. + opts+=('(- 1 *)'{-h,--help}'[Display this help text.]') + + ## Complete without gruntfile. + if [[ ! -f $gruntfile ]]; then + _arguments "${opts[@]}" + return + fi + + ## Complete with gruntfile. + # Retrieve cache. + if ! __grunt_update_cache "$gruntfile"; then + update_msg=' (cache updated)' + fi + + # Make optioins completion. + if [[ ${#__grunt_opts} -gt 0 ]]; then + opts+=("${__grunt_opts[@]}") + fi + + # Complete arguments. + _arguments \ + "${opts[@]}" \ + '*: :->tasks' \ + && return + + case $state in + tasks) + if [[ $show_grunt_path == 'yes' ]]; then + update_msg="$update_msg: ${${gruntfile/#$HOME/~}%/}" + fi + # Make tasks completion. + if [[ ${#__grunt_tasks} -gt 0 ]]; then + tasks+=("${__grunt_tasks[@]}") + _describe -t grunt-task "$verbose grunt task$update_msg" tasks || return 1 + fi + ;; + esac + + return 0 +} + +# Cache policy: +# The cache file name: grunt +# The cache variable name: __grunt_version __grunt_gruntfile __grunt_opts __grunt_tasks +function __grunt_update_cache() { + # TODO + local version='0.1.2' + local is_updating=0 + local gruntfile="$1" + local grunt_info no_update_options cache_path + + # Check no_update_options option. + zstyle -b ":completion:${curcontext}:options:" no_update_options no_update_options + + + if ! ( (( $+__grunt_gruntfile )) \ + && (( $+__grunt_opts )) \ + && (( $+__grunt_tasks )) ) \ + && ! _retrieve_cache 'grunt'; then + is_updating=1 + fi + + if [[ $gruntfile != $__grunt_gruntfile ]]; then + # Except for --help options. + __grunt_gruntfile=$gruntfile + if [[ $no_update_options == 'yes' ]]; then + if [[ $PREFIX == ${PREFIX#-} ]]; then + # Not options completions. + is_updating=1 + elif [[ ${#__grunt_opts} -lt 2 ]]; then + is_updating=1 + else + unset __grunt_gruntfile + fi + else + is_updating=1 + fi + else + if [[ $PREFIX != ${PREFIX#-} && ${#__grunt_opts} -gt 1 ]]; then + unset __grunt_gruntfile + fi + fi + + if _cache_invalid 'grunt'; then + is_updating=1 + fi + + # Check _grunt version. + if [[ $__grunt_version != $version ]]; then + is_updating=1 + fi + + if [[ $is_updating -ne 0 ]]; then + # Update caceh. + __grunt_version=$version + __grunt_gruntfile=$gruntfile + is_updating=1 + grunt_info=$(grunt --help --no-color --gruntfile "$__grunt_gruntfile" 2>/dev/null) + __grunt_opts=(${(f)"$(__grunt_get_opts "$grunt_info")"}) + __grunt_tasks=(${(f)"$(__grunt_get_tasks "$grunt_info")"}) + _store_cache 'grunt' __grunt_version __grunt_gruntfile __grunt_opts __grunt_tasks + fi + return $is_updating +} + +function __grunt_get_tasks() { + echo -E "$1" \ + | grep 'Available tasks' -A 100 \ + | grep '^ ' \ + | sed -e 's/^[[:blank:]]*//' -e 's/[[:blank:]]*$//' \ + | sed -e 's/:/\\:/g' \ + | sed -e 's/ /:/' +} + +function __grunt_get_opts() { + local opt_hunk opt_sep opt_num line opt + opt_hunk=$(echo -E "$1" \ + | grep 'Options$' -A 100 \ + | sed '1 d' \ + | sed -e 's/[[:blank:]]*$//' \ + ) + + opt_sep=() + opt_hunk=(${(f)opt_hunk}) + opt_num=0 + for line in "$opt_hunk[@]"; do + opt=$(echo -E "$line" | sed -e 's/^[[:blank:]]*//') + if [[ $line == $opt ]]; then + break + fi + if [[ $opt != ${opt#-} ]]; then + # Start with - + (( opt_num++ )) + opt=$(echo -E "$opt" | sed 's/^\(\(--[^ ]*\)\(, \(-[^ ]*\)\)*\) */\2\\t\4\\\t/') + fi + opt_sep[$opt_num]=("${opt_sep[$opt_num]}${opt}") + done + + for line in "$opt_sep[@]"; do + opt=(${(s:\t:)line}) + if [[ ${opt[1]} == '--help' ]]; then + continue + fi + if [[ ${#opt} -eq 2 ]]; then + echo -E "(${opt[1]})${opt[1]}[${opt[2]}]" + else + echo -E "(${opt[1]},${opt[2]})${opt[1]}[${opt[3]}]" + echo -E "(${opt[1]},${opt[2]})${opt[2]}[${opt[3]}]" + fi + done +} + +function __grunt_get_gruntfile() { + local gruntfile + local curpath="$PWD" + while [ "$curpath" ]; do + for gruntfile in "$curpath/"{G,g}runtfile.{js,coffee}; do + if [[ -e "$gruntfile" ]]; then + echo "$gruntfile" + return + fi + done + curpath=${curpath%/*} + done + return 1 +} + +function __grunt_caching_policy() { + # Returns status zero if the completions cache needs rebuilding. + + # Rebuild if .agignore more recent than cache. + if [[ -f $__grunt_gruntfile && $__grunt_gruntfile -nt $1 ]]; then + # Invalid cache because gruntfile is old. + return 0 + fi + + local -a oldp + local expire + zstyle -s ":completion:${curcontext}:options:" expire expire || expire=7 + # Rebuild if cache is more than $expire days. + oldp=( "$1"(Nm+$expire) ) + (( $#oldp )) +} + +compdef __grunt grunt+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/gulp/gulp.plugin.zsh b/oh-my-zsh/plugins/gulp/gulp.plugin.zsh @@ -0,0 +1,29 @@ +#!/usr/bin/env zsh + +# +# gulp-autocompletion-zsh +# +# Autocompletion for your gulp.js tasks +# +# Copyright(c) 2014 André König <andre.koenig@posteo.de> +# MIT Licensed +# + +# +# André König +# Github: https://github.com/akoenig +# Twitter: https://twitter.com/caiifr +# + +# +# Grabs all available tasks from the `gulpfile.js` +# in the current directory. +# +function $$gulp_completion { + compls=$(gulp --tasks-simple 2>/dev/null) + + completions=(${=compls}) + compadd -- $completions +} + +compdef $$gulp_completion gulp diff --git a/oh-my-zsh/plugins/helm/helm.plugin.zsh b/oh-my-zsh/plugins/helm/helm.plugin.zsh @@ -0,0 +1,7 @@ +# Autocompletion for helm. +# +# Copy from kubectl : https://github.com/pstadler + +if [ $commands[helm] ]; then + source <(helm completion zsh) +fi diff --git a/oh-my-zsh/plugins/heroku/_heroku b/oh-my-zsh/plugins/heroku/_heroku @@ -0,0 +1,151 @@ +#compdef heroku + +# Heroku Autocomplete plugin for Oh-My-Zsh +# Requires: The Heroku client gem (https://github.com/heroku/heroku) +# Author: Ali B. (http://awhitebox.com) + +local -a _1st_arguments +_1st_arguments=( + "account\:confirm_billing":"Confirm that your account can be billed at the end of the month" + "addons":"list installed addons" + "addons\:list":"list all available addons" + "addons\:add":"install an addon" + "addons\:upgrade":"upgrade an existing addon" + "addons\:downgrade":"downgrade an existing addon" + "addons\:remove":"uninstall an addon" + "addons\:open":"open an addon's dashboard in your browser" + "apps":"list your apps" + "apps\:info":"show detailed app information" + "apps\:create":"create a new app" + "apps\:rename":"rename the app" + "apps\:open":"open the app in a web browser" + "apps\:destroy":"permanently destroy an app" + "auth\:login":"log in with your heroku credentials" + "auth\:logout":"clear local authentication credentials" + "config":"display the config vars for an app" + "config\:pull":"pull heroku config vars down to the local environment" + "config\:push":"push local config vars to heroku" + "config\:set":"set one or more config vars" + "config\:unset":"unset one or more config vars" + "domains":"list custom domains for an app" + "domains\:add":"add a custom domain to an app" + "domains\:remove":"remove a custom domain from an app" + "domains\:clear":"remove all custom domains from an app" + "features":"list available app features" + "features\:disable":"disables a feature" + "features\:enable":"enables an feature" + "features\:info":"displays additional information about feature" + "help":"list available commands or display help for a specific command" + "keys":"display keys for the current user" + "keys\:add":"add a key for the current user" + "keys\:remove":"remove a key from the current user" + "keys\:clear":"remove all authentication keys from the current user" + "logs":"display recent log output" + "logs\:cron":"DEPRECATED: display cron logs from legacy logging" + "logs\:drains":"manage syslog drains" + "maintenance\:on":"put the app into maintenance mode" + "maintenance\:off":"take the app out of maintenance mode" + "pg\:credentials":"display the DATABASE credentials" + "pg\:diagnose":"run diagnostics report on DATABASE" + "pg\:info":"display database information" + "pg\:kill":"kill a query" + "pg\:killall":"terminates ALL connections" + "pg\:maintenance":"manage maintenance for DATABASE" + "pg\:promote":"sets DATABASE as your DATABASE_URL" + "pg\:ps":"view active queries with execution time" + "pg\:psql":"open a psql shell to the database" + "pg\:pull":"pull from REMOTE_SOURCE_DATABASE to LOCAL_TARGET_DATABASE" + "pg\:push":"push from LOCAL_SOURCE_DATABASE to REMOTE_TARGET_DATABASE" + "pg\:reset":"delete all data in DATABASE" + "pg\:unfollow":"stop a replica from following and make it a read/write database" + "pg\:upgrade":"unfollow a database and upgrade it to the latest PostgreSQL version" + "pg\:wait":"monitor database creation, exit when complete" + "pgbackups":"list captured backups" + "pgbackups\:url":"get a temporary URL for a backup" + "pgbackups\:capture":"capture a backup from a database id" + "pgbackups\:restore":"restore a backup to a database" + "pgbackups\:destroy":"destroys a backup" + "plugins":"list installed plugins" + "plugins\:install":"install a plugin" + "plugins\:uninstall":"uninstall a plugin" + "ps\:dynos":"scale to QTY web processes" + "ps\:workers":"scale to QTY background processes" + "ps":"list processes for an app" + "ps\:restart":"restart an app process" + "ps\:scale":"scale processes by the given amount" + "releases":"list releases" + "releases\:info":"view detailed information for a release" + "rollback":"roll back to an older release" + "run":"run an attached process" + "run\:rake":"remotely execute a rake command" + "run\:console":"open a remote console session" + "sharing":"list collaborators on an app" + "sharing\:add":"add a collaborator to an app" + "sharing\:remove":"remove a collaborator from an app" + "sharing\:transfer":"transfer an app to a new owner" + "ssl":"list certificates for an app" + "ssl\:add":"add an ssl certificate to an app" + "ssl\:remove":"remove an ssl certificate from an app" + "ssl\:clear":"remove all ssl certificates from an app" + "stack":"show the list of available stacks" + "stack\:migrate":"prepare migration of this app to a new stack" + "version":"show heroku client version" +) + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "heroku command" _1st_arguments + return +fi + +local -a _command_args +case "$words[1]" in + apps:info) + _command_args=( + '(-r|--raw)'{-r,--raw}'[output info as raw key/value pairs]' \ + ) + ;; + apps:create) + _command_args=( + '(-a|--addons)'{-a,--addons}'[a list of addons to install]' \ + '(-r|--remote)'{-r,--remote}'[the git remote to create, default "heroku"]' \ + '(-s|--stack)'{-s,--stack}'[the stack on which to create the app]' \ + ) + ;; + config) + _command_args=( + '(-s|--shell)'{-s,--shell}'[output config vars in shell format]' \ + ) + ;; + keys) + _command_args=( + '(-l|--long)'{-l,--long}'[display extended information for each key]' \ + ) + ;; + logs) + _command_args=( + '(-n|--num)'{-n,--num}'[the number of lines to display]' \ + '(-p|--ps)'{-p,--ps}'[only display logs from the given process]' \ + '(-s|--source)'{-s,--source}'[only display logs from the given source]' \ + '(-t|--tail)'{-t,--tail}'[continually stream logs]' \ + ) + ;; + pgbackups:capture) + _command_args=( + '(-e|--expire)'{-e,--expire}'[if no slots are available to capture, delete the oldest backup to make room]' \ + ) + ;; + stack) + _command_args=( + '(-a|--all)'{-a,--all}'[include deprecated stacks]' \ + ) + ;; + esac + +_arguments \ + $_command_args \ + '(--app)--app[the app name]' \ + '(--remote)--remote[the remote name]' \ + '(--help)--help[help about the current command]' \ + && return 0 diff --git a/oh-my-zsh/plugins/history-substring-search/README.md b/oh-my-zsh/plugins/history-substring-search/README.md @@ -0,0 +1,149 @@ +zsh-history-substring-search +============================================================================== + +This is a clean-room implementation of the [Fish shell][1]'s history search +feature, where you can type in any part of any previously entered command +and press the UP and DOWN arrow keys to cycle through the matching commands. +You can also use K and J in VI mode or ^P and ^N in EMACS mode for the same. + +[1]: http://fishshell.com +[2]: http://www.zsh.org/mla/users/2009/msg00818.html +[3]: http://sourceforge.net/projects/fizsh/ +[4]: https://github.com/robbyrussell/oh-my-zsh/pull/215 +[5]: https://github.com/zsh-users/zsh-history-substring-search +[6]: https://github.com/zsh-users/zsh-syntax-highlighting + +------------------------------------------------------------------------------ +Requirements +------------------------------------------------------------------------------ + +* [ZSH](http://zsh.sourceforge.net) 4.3 or newer + +------------------------------------------------------------------------------ +Usage +------------------------------------------------------------------------------ + +1. Load this script into your interactive ZSH session: + + % source zsh-history-substring-search.zsh + + If you want to use [zsh-syntax-highlighting][6] along with this script, + then make sure that you load it *before* you load this script: + + % source zsh-syntax-highlighting.zsh + % source zsh-history-substring-search.zsh + +2. Bind keyboard shortcuts to this script's functions: + + # bind UP and DOWN arrow keys + zmodload zsh/terminfo + bindkey "$terminfo[kcuu1]" history-substring-search-up + bindkey "$terminfo[kcud1]" history-substring-search-down + + # bind UP and DOWN arrow keys (compatibility fallback + # for Ubuntu 12.04, Fedora 21, and MacOSX 10.9 users) + bindkey '^[[A' history-substring-search-up + bindkey '^[[B' history-substring-search-down + + # bind P and N for EMACS mode + bindkey -M emacs '^P' history-substring-search-up + bindkey -M emacs '^N' history-substring-search-down + + # bind k and j for VI mode + bindkey -M vicmd 'k' history-substring-search-up + bindkey -M vicmd 'j' history-substring-search-down + +3. Type any part of any previous command and then: + + * Press the UP arrow key to select the nearest command that (1) contains + your query and (2) is older than the current command in the command + history. + + * Press the DOWN arrow key to select the nearest command that (1) + contains your query and (2) is newer than the current command in the + command history. + + * Press ^U (the Control and U keys simultaneously) to abort the search. + +4. If a matching command spans more than one line of text, press the LEFT + arrow key to move the cursor away from the end of the command, and then: + + * Press the UP arrow key to move the cursor to the line above. When the + cursor reaches the first line of the command, pressing the UP arrow + key again will cause this script to perform another search. + + * Press the DOWN arrow key to move the cursor to the line below. When + the cursor reaches the last line of the command, pressing the DOWN + arrow key again will cause this script to perform another search. + +------------------------------------------------------------------------------ +Configuration +------------------------------------------------------------------------------ + +This script defines the following global variables. You may override their +default values only after having loaded this script into your ZSH session. + +* HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND is a global variable that defines + how the query should be highlighted inside a matching command. Its default + value causes this script to highlight using bold, white text on a magenta + background. See the "Character Highlighting" section in the zshzle(1) man + page to learn about the kinds of values you may assign to this variable. + +* HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND is a global variable that + defines how the query should be highlighted when no commands in the + history match it. Its default value causes this script to highlight using + bold, white text on a red background. See the "Character Highlighting" + section in the zshzle(1) man page to learn about the kinds of values you + may assign to this variable. + +* HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS is a global variable that defines + how the command history will be searched for your query. Its default value + causes this script to perform a case-insensitive search. See the "Globbing + Flags" section in the zshexpn(1) man page to learn about the kinds of + values you may assign to this variable. + +To always receive _unique_ search results, use `setopt HIST_IGNORE_ALL_DUPS`. +Alternatively, use `setopt HIST_FIND_NO_DUPS` which makes this plugin skip +duplicate _adjacent_ search results as you cycle through them---however, this +does not guarantee that search results are unique: if your search results were +"Dog", "Dog", "HotDog", "Dog", then cycling them gives "Dog", "HotDog", "Dog". +Notice that the "Dog" search result appeared twice as you cycled through them! +If you wish to avoid this limitation, then use `setopt HIST_IGNORE_ALL_DUPS`. + +------------------------------------------------------------------------------ +History +------------------------------------------------------------------------------ + +This script was originally written by [Peter Stephenson][2], who published it +to the ZSH users mailing list (thereby making it public domain) in September +2009. It was later revised by Guido van Steen and released under the BSD +license (see below) as part of [the fizsh project][3] in January 2011. + +It was later extracted from fizsh release 1.0.1, refactored heavily, and +repackaged as both an [oh-my-zsh plugin][4] and as an independently loadable +[ZSH script][5] by Suraj N. Kurapati in 2011. + +It was [further developed][4] by Guido van Steen, Suraj N. Kurapati, Sorin +Ionescu, and Vincent Guerci in 2011. + +------------------------------------------------------------------------------ +Oh My Zsh Distribution Notes +------------------------------------------------------------------------------ + +What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search +as an OMZ module inside the Oh My Zsh distribution. + +The upstream repo, zsh-users/zsh-history-substring-search, can be found on GitHub at +https://github.com/zsh-users/zsh-history-substring-search. + +This downstream copy was last updated from the following upstream commit: + + SHA: 2c295432175990c1bb4e90bc13f609daa67a25d6 + Commit date: 2015-09-28 10:47:34 -0700 + +Everything above this section is a copy of the original upstream's README, so things +may differ slightly when you're using this inside OMZ. In particular, you do not +need to set up key bindings for the up and down arrows yourself in `~/.zshrc`; the OMZ +plugin does that for you. You may still want to set up additional emacs- or vi-specific +bindings as mentioned above. + diff --git a/oh-my-zsh/plugins/history-substring-search/history-substring-search.plugin.zsh b/oh-my-zsh/plugins/history-substring-search/history-substring-search.plugin.zsh @@ -0,0 +1,26 @@ +# This file integrates the zsh-history-substring-search script into oh-my-zsh. + +source "${0:r:r}.zsh" + +if test "$CASE_SENSITIVE" = true; then + unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS +fi + +if test "$DISABLE_COLOR" = true; then + unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND +fi + + +# Bind terminal-specific up and down keys +# Bind in both emacs and vi modes so it works in both, and is not +# sensitive to whether this is loaded before or after the vi-mode plugin +if [[ -n "$terminfo[kcuu1]" ]]; then + bindkey -M emacs "$terminfo[kcuu1]" history-substring-search-up + bindkey -M viins "$terminfo[kcuu1]" history-substring-search-up +fi +if [[ -n "$terminfo[kcud1]" ]]; then + bindkey -M emacs "$terminfo[kcud1]" history-substring-search-down + bindkey -M viins "$terminfo[kcud1]" history-substring-search-down +fi + diff --git a/oh-my-zsh/plugins/history-substring-search/history-substring-search.zsh b/oh-my-zsh/plugins/history-substring-search/history-substring-search.zsh @@ -0,0 +1,585 @@ +#!/usr/bin/env zsh +############################################################################## +# +# Copyright (c) 2009 Peter Stephenson +# Copyright (c) 2011 Guido van Steen +# Copyright (c) 2011 Suraj N. Kurapati +# Copyright (c) 2011 Sorin Ionescu +# Copyright (c) 2011 Vincent Guerci +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * Neither the name of the FIZSH nor the names of its contributors +# may be used to endorse or promote products derived from this +# software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################## + +#----------------------------------------------------------------------------- +# configuration variables +#----------------------------------------------------------------------------- + +HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold' +HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold' +HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i' + +#----------------------------------------------------------------------------- +# the main ZLE widgets +#----------------------------------------------------------------------------- + +history-substring-search-up() { + _history-substring-search-begin + + _history-substring-search-up-history || + _history-substring-search-up-buffer || + _history-substring-search-up-search + + _history-substring-search-end +} + +history-substring-search-down() { + _history-substring-search-begin + + _history-substring-search-down-history || + _history-substring-search-down-buffer || + _history-substring-search-down-search + + _history-substring-search-end +} + +zle -N history-substring-search-up +zle -N history-substring-search-down + +#----------------------------------------------------------------------------- +# implementation details +#----------------------------------------------------------------------------- + +zmodload -F zsh/parameter + +# +# We have to "override" some keys and widgets if the +# zsh-syntax-highlighting plugin has not been loaded: +# +# https://github.com/nicoulaj/zsh-syntax-highlighting +# +if [[ $+functions[_zsh_highlight] -eq 0 ]]; then + # + # Dummy implementation of _zsh_highlight() that + # simply removes any existing highlights when the + # user inserts printable characters into $BUFFER. + # + _zsh_highlight() { + if [[ $KEYS == [[:print:]] ]]; then + region_highlight=() + fi + } + + # + # The following snippet was taken from the zsh-syntax-highlighting project: + # + # https://github.com/zsh-users/zsh-syntax-highlighting/blob/56b134f5d62ae3d4e66c7f52bd0cc2595f9b305b/zsh-syntax-highlighting.zsh#L126-161 + # + # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are + # met: + # + # * Redistributions of source code must retain the above copyright + # notice, this list of conditions and the following disclaimer. + # + # * Redistributions in binary form must reproduce the above copyright + # notice, this list of conditions and the following disclaimer in the + # documentation and/or other materials provided with the distribution. + # + # * Neither the name of the zsh-syntax-highlighting contributors nor the + # names of its contributors may be used to endorse or promote products + # derived from this software without specific prior written permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + # + #--------------8<-------------------8<-------------------8<----------------- + # Rebind all ZLE widgets to make them invoke _zsh_highlights. + _zsh_highlight_bind_widgets() + { + # Load ZSH module zsh/zleparameter, needed to override user defined widgets. + zmodload zsh/zleparameter 2>/dev/null || { + echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' >&2 + return 1 + } + + # Override ZLE widgets to make them invoke _zsh_highlight. + local cur_widget + for cur_widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|run-help|which-command|beep|yank*)}; do + case $widgets[$cur_widget] in + + # Already rebound event: do nothing. + user:$cur_widget|user:_zsh_highlight_widget_*);; + + # User defined widget: override and rebind old one with prefix "orig-". + user:*) eval "zle -N orig-$cur_widget ${widgets[$cur_widget]#*:}; \ + _zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget -- \"\$@\" && _zsh_highlight }; \ + zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; + + # Completion widget: override and rebind old one with prefix "orig-". + completion:*) eval "zle -C orig-$cur_widget ${${widgets[$cur_widget]#*:}/:/ }; \ + _zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget -- \"\$@\" && _zsh_highlight }; \ + zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; + + # Builtin widget: override and make it call the builtin ".widget". + builtin) eval "_zsh_highlight_widget_$cur_widget() { builtin zle .$cur_widget -- \"\$@\" && _zsh_highlight }; \ + zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; + + # Default: unhandled case. + *) echo "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;; + esac + done + } + #-------------->8------------------->8------------------->8----------------- + + _zsh_highlight_bind_widgets +fi + +_history-substring-search-begin() { + setopt localoptions extendedglob + + _history_substring_search_refresh_display= + _history_substring_search_query_highlight= + + # + # Continue using the previous $_history_substring_search_result by default, + # unless the current query was cleared or a new/different query was entered. + # + if [[ -z $BUFFER || $BUFFER != $_history_substring_search_result ]]; then + # + # For the purpose of highlighting we will also keep + # a version without doubly-escaped meta characters. + # + _history_substring_search_query=$BUFFER + + # + # $BUFFER contains the text that is in the command-line currently. + # we put an extra "\\" before meta characters such as "\(" and "\)", + # so that they become "\\\(" and "\\\)". + # + _history_substring_search_query_escaped=${BUFFER//(#m)[\][()|\\*?#<>~^]/\\$MATCH} + + # + # Find all occurrences of the search query in the history file. + # + # (k) returns the "keys" (history index numbers) instead of the values + # (Oa) reverses the order, because (R) returns results reversed. + # + _history_substring_search_matches=(${(kOa)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)*${_history_substring_search_query_escaped}*]}) + + # + # Define the range of values that $_history_substring_search_match_index + # can take: [0, $_history_substring_search_matches_count_plus]. + # + _history_substring_search_matches_count=$#_history_substring_search_matches + _history_substring_search_matches_count_plus=$(( _history_substring_search_matches_count + 1 )) + _history_substring_search_matches_count_sans=$(( _history_substring_search_matches_count - 1 )) + + # + # If $_history_substring_search_match_index is equal to + # $_history_substring_search_matches_count_plus, this indicates that we + # are beyond the beginning of $_history_substring_search_matches. + # + # If $_history_substring_search_match_index is equal to 0, this indicates + # that we are beyond the end of $_history_substring_search_matches. + # + # If we have initially pressed "up" we have to initialize + # $_history_substring_search_match_index to + # $_history_substring_search_matches_count_plus so that it will be + # decreased to $_history_substring_search_matches_count. + # + # If we have initially pressed "down" we have to initialize + # $_history_substring_search_match_index to + # $_history_substring_search_matches_count so that it will be increased to + # $_history_substring_search_matches_count_plus. + # + if [[ $WIDGET == history-substring-search-down ]]; then + _history_substring_search_match_index=$_history_substring_search_matches_count + else + _history_substring_search_match_index=$_history_substring_search_matches_count_plus + fi + fi +} + +_history-substring-search-end() { + setopt localoptions extendedglob + + _history_substring_search_result=$BUFFER + + # the search was successful so display the result properly by clearing away + # existing highlights and moving the cursor to the end of the result buffer + if [[ $_history_substring_search_refresh_display -eq 1 ]]; then + region_highlight=() + CURSOR=${#BUFFER} + fi + + # highlight command line using zsh-syntax-highlighting + _zsh_highlight + + # highlight the search query inside the command line + if [[ -n $_history_substring_search_query_highlight && -n $_history_substring_search_query ]]; then + # + # The following expression yields a variable $MBEGIN, which + # indicates the begin position + 1 of the first occurrence + # of _history_substring_search_query_escaped in $BUFFER. + # + : ${(S)BUFFER##(#m$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)($_history_substring_search_query##)} + local begin=$(( MBEGIN - 1 )) + local end=$(( begin + $#_history_substring_search_query )) + region_highlight+=("$begin $end $_history_substring_search_query_highlight") + fi + + # For debugging purposes: + # zle -R "mn: "$_history_substring_search_match_index" m#: "${#_history_substring_search_matches} + # read -k -t 200 && zle -U $REPLY + + # Exit successfully from the history-substring-search-* widgets. + return 0 +} + +_history-substring-search-up-buffer() { + # + # Check if the UP arrow was pressed to move the cursor within a multi-line + # buffer. This amounts to three tests: + # + # 1. $#buflines -gt 1. + # + # 2. $CURSOR -ne $#BUFFER. + # + # 3. Check if we are on the first line of the current multi-line buffer. + # If so, pressing UP would amount to leaving the multi-line buffer. + # + # We check this by adding an extra "x" to $LBUFFER, which makes + # sure that xlbuflines is always equal to the number of lines + # until $CURSOR (including the line with the cursor on it). + # + local buflines XLBUFFER xlbuflines + buflines=(${(f)BUFFER}) + XLBUFFER=$LBUFFER"x" + xlbuflines=(${(f)XLBUFFER}) + + if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xlbuflines -ne 1 ]]; then + zle up-line-or-history + return 0 + fi + + return 1 +} + +_history-substring-search-down-buffer() { + # + # Check if the DOWN arrow was pressed to move the cursor within a multi-line + # buffer. This amounts to three tests: + # + # 1. $#buflines -gt 1. + # + # 2. $CURSOR -ne $#BUFFER. + # + # 3. Check if we are on the last line of the current multi-line buffer. + # If so, pressing DOWN would amount to leaving the multi-line buffer. + # + # We check this by adding an extra "x" to $RBUFFER, which makes + # sure that xrbuflines is always equal to the number of lines + # from $CURSOR (including the line with the cursor on it). + # + local buflines XRBUFFER xrbuflines + buflines=(${(f)BUFFER}) + XRBUFFER="x"$RBUFFER + xrbuflines=(${(f)XRBUFFER}) + + if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xrbuflines -ne 1 ]]; then + zle down-line-or-history + return 0 + fi + + return 1 +} + +_history-substring-search-up-history() { + # + # Behave like up in ZSH, except clear the $BUFFER + # when beginning of history is reached like in Fish. + # + if [[ -z $_history_substring_search_query ]]; then + + # we have reached the absolute top of history + if [[ $HISTNO -eq 1 ]]; then + BUFFER= + + # going up from somewhere below the top of history + else + zle up-line-or-history + fi + + return 0 + fi + + return 1 +} + +_history-substring-search-down-history() { + # + # Behave like down-history in ZSH, except clear the + # $BUFFER when end of history is reached like in Fish. + # + if [[ -z $_history_substring_search_query ]]; then + + # going down from the absolute top of history + if [[ $HISTNO -eq 1 && -z $BUFFER ]]; then + BUFFER=${history[1]} + _history_substring_search_refresh_display=1 + + # going down from somewhere above the bottom of history + else + zle down-line-or-history + fi + + return 0 + fi + + return 1 +} + +_history-substring-search-not-found() { + # + # Nothing matched the search query, so put it back into the $BUFFER while + # highlighting it accordingly so the user can revise it and search again. + # + _history_substring_search_old_buffer=$BUFFER + BUFFER=$_history_substring_search_query + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND +} + +_history-substring-search-up-search() { + _history_substring_search_refresh_display=1 + + # + # Highlight matches during history-substring-up-search: + # + # The following constants have been initialized in + # _history-substring-search-up/down-search(): + # + # $_history_substring_search_matches is the current list of matches + # $_history_substring_search_matches_count is the current number of matches + # $_history_substring_search_matches_count_plus is the current number of matches + 1 + # $_history_substring_search_matches_count_sans is the current number of matches - 1 + # $_history_substring_search_match_index is the index of the current match + # + # The range of values that $_history_substring_search_match_index can take + # is: [0, $_history_substring_search_matches_count_plus]. A value of 0 + # indicates that we are beyond the end of + # $_history_substring_search_matches. A value of + # $_history_substring_search_matches_count_plus indicates that we are beyond + # the beginning of $_history_substring_search_matches. + # + # In _history-substring-search-up-search() the initial value of + # $_history_substring_search_match_index is + # $_history_substring_search_matches_count_plus. This value is set in + # _history-substring-search-begin(). _history-substring-search-up-search() + # will initially decrease it to $_history_substring_search_matches_count. + # + if [[ $_history_substring_search_match_index -ge 2 ]]; then + # + # Highlight the next match: + # + # 1. Decrease the value of $_history_substring_search_match_index. + # + # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index-- )) + BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]] + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + + elif [[ $_history_substring_search_match_index -eq 1 ]]; then + # + # We will move beyond the end of $_history_substring_search_matches: + # + # 1. Decrease the value of $_history_substring_search_match_index. + # + # 2. Save the current buffer in $_history_substring_search_old_buffer, + # so that it can be retrieved by + # _history-substring-search-down-search() later. + # + # 3. Make $BUFFER equal to $_history_substring_search_query. + # + # 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index-- )) + _history-substring-search-not-found + + elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count_plus ]]; then + # + # We were beyond the beginning of $_history_substring_search_matches but + # UP makes us move back to $_history_substring_search_matches: + # + # 1. Decrease the value of $_history_substring_search_match_index. + # + # 2. Restore $BUFFER from $_history_substring_search_old_buffer. + # + # 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index-- )) + BUFFER=$_history_substring_search_old_buffer + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + + else + # + # We are at the beginning of history and there are no further matches. + # + _history-substring-search-not-found + return + fi + + # + # When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from + # history should be matched, make sure the new and old results are different. + # But when HIST_IGNORE_ALL_DUPS is set, ZSH already ensures a unique history. + # + if [[ ! -o HIST_IGNORE_ALL_DUPS && -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then + # + # Repeat the current search so that a different (unique) match is found. + # + _history-substring-search-up-search + fi +} + +_history-substring-search-down-search() { + _history_substring_search_refresh_display=1 + + # + # Highlight matches during history-substring-up-search: + # + # The following constants have been initialized in + # _history-substring-search-up/down-search(): + # + # $_history_substring_search_matches is the current list of matches + # $_history_substring_search_matches_count is the current number of matches + # $_history_substring_search_matches_count_plus is the current number of matches + 1 + # $_history_substring_search_matches_count_sans is the current number of matches - 1 + # $_history_substring_search_match_index is the index of the current match + # + # The range of values that $_history_substring_search_match_index can take + # is: [0, $_history_substring_search_matches_count_plus]. A value of 0 + # indicates that we are beyond the end of + # $_history_substring_search_matches. A value of + # $_history_substring_search_matches_count_plus indicates that we are beyond + # the beginning of $_history_substring_search_matches. + # + # In _history-substring-search-down-search() the initial value of + # $_history_substring_search_match_index is + # $_history_substring_search_matches_count. This value is set in + # _history-substring-search-begin(). + # _history-substring-search-down-search() will initially increase it to + # $_history_substring_search_matches_count_plus. + # + if [[ $_history_substring_search_match_index -le $_history_substring_search_matches_count_sans ]]; then + # + # Highlight the next match: + # + # 1. Increase $_history_substring_search_match_index by 1. + # + # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index++ )) + BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]] + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + + elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count ]]; then + # + # We will move beyond the beginning of $_history_substring_search_matches: + # + # 1. Increase $_history_substring_search_match_index by 1. + # + # 2. Save the current buffer in $_history_substring_search_old_buffer, so + # that it can be retrieved by _history-substring-search-up-search() + # later. + # + # 3. Make $BUFFER equal to $_history_substring_search_query. + # + # 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index++ )) + _history-substring-search-not-found + + elif [[ $_history_substring_search_match_index -eq 0 ]]; then + # + # We were beyond the end of $_history_substring_search_matches but DOWN + # makes us move back to the $_history_substring_search_matches: + # + # 1. Increase $_history_substring_search_match_index by 1. + # + # 2. Restore $BUFFER from $_history_substring_search_old_buffer. + # + # 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index++ )) + BUFFER=$_history_substring_search_old_buffer + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + + else + # + # We are at the end of history and there are no further matches. + # + _history-substring-search-not-found + return + fi + + # + # When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from + # history should be matched, make sure the new and old results are different. + # But when HIST_IGNORE_ALL_DUPS is set, ZSH already ensures a unique history. + # + if [[ ! -o HIST_IGNORE_ALL_DUPS && -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then + # + # Repeat the current search so that a different (unique) match is found. + # + _history-substring-search-down-search + fi +} + +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et diff --git a/oh-my-zsh/plugins/history-substring-search/update-from-upstream.zsh b/oh-my-zsh/plugins/history-substring-search/update-from-upstream.zsh @@ -0,0 +1,129 @@ +#!/usr/bin/env zsh +# +# update-from-upstream.zsh +# +# This script updates the Oh My Zsh version of the zsh-history-substring-search +# plugin from the independent upstream repo. This is to be run by OMZ developers +# when they want to pull in new changes from upstream to OMZ. It is not run +# during normal use of the plugin. +# +# The official upstream repo is zsh-users/zsh-history-substring-search +# https://github.com/zsh-users/zsh-history-substring-search +# +# This is a zsh script, not a function. Call it with `zsh update-from-upstream.zsh` +# from the command line, running it from within the plugin directory. +# +# You can set the environment variable REPO_PATH to point it at an upstream +# repo you have already prepared. Otherwise, it will do a clean checkout of +# upstream's HEAD to a temporary local repo and use that. + + +# Just bail on any error so we don't have to do extra checking. +# This is a developer-use script, so terse output like that should +# be fine. +set -e + + +upstream_basename=zsh-history-substring-search +plugin_basename=history-substring-search +UPSTREAM_REPO=zsh-users/$upstream_basename +need_repo_cleanup=false +upstream_github_url="https://github.com/$UPSTREAM_REPO" + +if [[ -z "$UPSTREAM_REPO_PATH" ]]; then + # Do a clean checkout + my_tempdir=$(mktemp -d -t omz-update-histsubstrsrch) + UPSTREAM_REPO_PATH="$my_tempdir/$upstream_basename" + git clone "$upstream_github_url" "$UPSTREAM_REPO_PATH" + need_repo_cleanup=true + print "Checked out upstream repo to $UPSTREAM_REPO_PATH" +else + print "Using existing $upstream_basename repo at $UPSTREAM_REPO_PATH" +fi + +upstream="$UPSTREAM_REPO_PATH" + +# Figure out what we're pulling in +upstream_sha=$(cd $upstream && git rev-parse HEAD) +upstream_commit_date=$(cd $upstream && git log -1 --pretty=format:%ci) +upstream_just_date=${${=upstream_commit_date}[1]} +print "upstream SHA: $upstream_sha" +print "upstream commit time: $upstream_commit_date" +print "upstream commit date: $upstream_just_date" +print + +# Copy the files over, using the OMZ plugin's names where needed +cp -v "$upstream"/* . +mv -v zsh-history-substring-search.zsh $plugin_basename.zsh +mv -v zsh-history-substring-search.plugin.zsh $plugin_basename.plugin.zsh + +if [[ $need_repo_cleanup == true ]]; then + print "Removing temporary repo at $my_tempdir" + rm -rf "$my_tempdir" +fi + +# Do OMZ-specific edits + +print +print "Updating files with OMZ-specific stuff" +print + +# OMZ binds the keys as part of the plugin loading + +cat >> $plugin_basename.plugin.zsh <<EOF + + +# Bind terminal-specific up and down keys + +if [[ -n "\$terminfo[kcuu1]" ]]; then + bindkey -M emacs "\$terminfo[kcuu1]" history-substring-search-up + bindkey -M viins "\$terminfo[kcuu1]" history-substring-search-up +fi +if [[ -n "\$terminfo[kcud1]" ]]; then + bindkey -M emacs "\$terminfo[kcud1]" history-substring-search-down + bindkey -M viins "\$terminfo[kcud1]" history-substring-search-down +fi + +EOF + +# Tack OMZ-specific notes on to readme + +thin_line="------------------------------------------------------------------------------" +cat >> README.md <<EOF + +$thin_line +Oh My Zsh Distribution Notes +$thin_line + +What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search +as an OMZ module inside the Oh My Zsh distribution. + +The upstream repo, $UPSTREAM_REPO, can be found on GitHub at +$upstream_github_url. + +This downstream copy was last updated from the following upstream commit: + + SHA: $upstream_sha + Commit date: $upstream_commit_date + +Everything above this section is a copy of the original upstream's README, so things +may differ slightly when you're using this inside OMZ. In particular, you do not +need to set up key bindings for the up and down arrows yourself in \`~/.zshrc\`; the OMZ +plugin does that for you. You may still want to set up additional emacs- or vi-specific +bindings as mentioned above. + +EOF + +# Announce success and generate git commit messages + +cat <<EOF +Done OK + +Now you can check the results and commit like this: + + git add * + git commit -m "history-substring-search: update to upstream version $upstream_just_date" \\ + -m "Updates OMZ's copy to commit $upstream_sha from $UPSTREAM_REPO" + +EOF + diff --git a/oh-my-zsh/plugins/history/README.md b/oh-my-zsh/plugins/history/README.md @@ -0,0 +1,15 @@ +## history + +Provides a couple of convenient aliases for using the `history` command to examine your command line history. + +### Requirements + +* None. + +### Usage + +* If `h` is called, your command history is listed. Equivalent to using `history` + +* If `hsi` is called with an argument, a **case insensitive** `grep` search is performed on your command history, looking for commands that match the argument provided + +* If `hsi` is called without an argument you will help on `grep` arguments+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/history/history.plugin.zsh b/oh-my-zsh/plugins/history/history.plugin.zsh @@ -0,0 +1,8 @@ +alias h='history' + +function hs +{ + history | grep $* +} + +alias hsi='hs -i' diff --git a/oh-my-zsh/plugins/httpie/README.md b/oh-my-zsh/plugins/httpie/README.md @@ -0,0 +1,6 @@ +## HTTPie +**Maintainer:** [lululau](https://github.com/lululau) + +This plugin adds completion for HTTPie, which is a command line HTTP client, a user-friendly cURL replacement. + +[HTTPie Homepage](http://httpie.org) diff --git a/oh-my-zsh/plugins/httpie/httpie.plugin.zsh b/oh-my-zsh/plugins/httpie/httpie.plugin.zsh @@ -0,0 +1,33 @@ +function _httpie_completion() { + _arguments -C \ + '(- 1 *)--version[display version information]' \ + '(-j|--json)'{-j,--json}'[(default) Data items from the command line are serialized as a JSON object]' \ + '(-f|--form)'{-f,--form}'[Data items from the command line are serialized as form fields]' \ + '(--pretty)--pretty[<all,colors,format,none> Controls output processing]:options' \ + '(-s|--style)'{-s,--style}'[Output coloring style]' \ + '(-p|--print)'{-p,--print}'[String specifying what the output should contain: H(request headers), B(request body), h(response headers), b(response body)]' \ + '(-v|--verbose)'{-v,--verbose}'[Print the whole request as well as the response. Shortcut for --print=HBbh.]' \ + '(-h|--headers)'{-h,--headers}'[Print only the response headers. Shortcut for --print=h]' \ + '(-b|--body)'{-b,--body}'[Print only the response body. Shortcut for --print=b]' \ + '(-S|--stream)'{-S,--stream}'[Always stream the output by line, i.e., behave like `tail -f'"'"']' \ + '(-o|--output)'{-o,--output}'[Save output to FILE]:file:_files' \ + '(-d|--download)'{-d,--download}'[Do not print the response body to stdout. Rather, download it and store it in a file. The filename is guessed unless specified with --output filename. This action is similar to the default behaviour of wget.]' \ + '(-c|--continue)'{-c,--continue}'[Resume an interrupted download. Note that the --output option needs to be specified as well.]' \ + '(--session)--session[Create, or reuse and update a session. Within a session, custom headers, auth credential, as well as any cookies sent by the server persist between requests]:file:_files' \ + '(--session-read-only)--session-read-only[Create or read a session without updating it form the request/response exchange]:file:_files' \ + '(-a|--auth)'{-a,--auth}'[<USER:PASS> If only the username is provided (-a username), HTTPie will prompt for the password]' \ + '(--auth-type)--auth-type[<basic, digest> The authentication mechanism to be used. Defaults to "basic".]' \ + '(--proxy)--proxy[<PROTOCOL:PROXY_URL> String mapping protocol to the URL of the proxy]' \ + '(--follow)--follow[Set this flag if full redirects are allowed (e.g. re-POST-ing of data at new Location).]' \ + '(--verify)--verify[<VERIFY> Set to "no" to skip checking the host'"'"'s SSL certificate. You can also pass the path to a CA_BUNDLE file for private certs. You can also set the REQUESTS_CA_BUNDLE environment variable. Defaults to "yes".]' \ + '(--timeout)--timeout[<SECONDS> The connection timeout of the request in seconds. The default value is 30 seconds]' \ + '(--check-status)--check-status[By default, HTTPie exits with 0 when no network or other fatal errors occur. This flag instructs HTTPie to also check the HTTP status code and exit with an error if the status indicates one.]' \ + '(--ignore-stdin)--ignore-stdin[Do not attempt to read stdin]' \ + '(--help)--help[Show this help message and exit]' \ + '(--traceback)--traceback[Prints exception traceback should one occur]' \ + '(--debug)--debug[Prints exception traceback should one occur, and also other information that is useful for debugging HTTPie itself and for reporting bugs]' \ + '1: :->cmds' \ + '*: :->args' && ret=0 +} + +compdef _httpie_completion http+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/iterm2/iterm2.plugin.zsh b/oh-my-zsh/plugins/iterm2/iterm2.plugin.zsh @@ -0,0 +1,68 @@ +##################################################### +# iTerm2 plugin for oh-my-zsh # +# Author: Aviv Rosenberg (github.com/avivrosenberg) # +##################################################### + +### +# This plugin is only relevant if the terminal is iTerm2 on OSX. +if [[ "$OSTYPE" == darwin* ]] && [[ -n "$ITERM_SESSION_ID" ]] ; then + + ### + # Executes an arbitrary iTerm2 command via an escape code sequce. + # See https://iterm2.com/documentation-escape-codes.html for all supported commands. + # Example: $ _iterm2_command "1337;StealFocus" + function _iterm2_command() { + local cmd="$1" + + # Escape codes for wrapping commands for iTerm2. + local iterm2_prefix="\x1B]" + local iterm2_suffix="\x07" + + # If we're in tmux, a special escape code must be prepended/appended so that + # the iTerm2 escape code is passed on into iTerm2. + if [[ -n $TMUX ]]; then + local tmux_prefix="\x1BPtmux;\x1B" + local tmux_suffix="\x1B\\" + fi + + echo -n "${tmux_prefix}${iterm2_prefix}${cmd}${iterm2_suffix}${tmux_suffix}" + } + + ### + # iterm2_profile(): Function for changing the current terminal window's + # profile (colors, fonts, settings, etc). + # To change the current iTerm2 profile, call this function and pass in a name + # of another existing iTerm2 profile (name can contain spaces). + function iterm2_profile() { + # Desired name of profile + local profile="$1" + + # iTerm2 command for changing profile + local cmd="1337;SetProfile=$profile" + + # send the sequence + _iterm2_command "${cmd}" + + # update shell variable + ITERM_PROFILE="$profile" + } + + ### + # iterm2_tab_color(): Changes the color of iTerm2's currently active tab. + # Usage: iterm2_tab_color <red> <green> <blue> + # where red/green/blue are on the range 0-255. + function iterm2_tab_color() { + _iterm2_command "6;1;bg;red;brightness;$1" + _iterm2_command "6;1;bg;green;brightness;$2" + _iterm2_command "6;1;bg;blue;brightness;$3" + } + + + ### + # iterm2_tab_color_reset(): Resets the color of iTerm2's current tab back to + # default. + function iterm2_tab_color_reset() { + _iterm2_command "6;1;bg;*;default" + } + +fi diff --git a/oh-my-zsh/plugins/iwhois/iwhois.plugin.zsh b/oh-my-zsh/plugins/iwhois/iwhois.plugin.zsh @@ -0,0 +1,8 @@ +# provide a whois command with a more accurate and up to date list of whois +# servers using CNAMES via whois.geek.nz + +function iwhois() { + resolver="whois.geek.nz" + tld=`echo ${@: -1} | awk -F "." '{print $NF}'` + whois -h ${tld}.${resolver} "$@" ; +} diff --git a/oh-my-zsh/plugins/jake-node/jake-node.plugin.zsh b/oh-my-zsh/plugins/jake-node/jake-node.plugin.zsh @@ -0,0 +1,14 @@ +#---oh-my-zsh plugin : task Autocomplete for Jake tool--- +# Jake : https://github.com/mde/jake +# Warning : Jakefile should have the right case : Jakefile or jakefile +# Tested on : MacOSX 10.7 (Lion), Ubuntu 11.10 +# Author : Alexandre Lacheze (@al3xstrat) +# Inspiration : http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh + +function _jake () { + if [ -f Jakefile ]||[ -f jakefile ]; then + compadd `jake -T | cut -d " " -f 2 | sed -E "s/.\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"` + fi +} + +compdef _jake jake+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/jhbuild/README.md b/oh-my-zsh/plugins/jhbuild/README.md @@ -0,0 +1,4 @@ +## JHBuild +**Maintainer:** [Miguel Vaello](https://github.com/miguxbe) + +This plugin adds some jhbuild aliases and increase the completion function provided by zsh. diff --git a/oh-my-zsh/plugins/jhbuild/jhbuild.plugin.zsh b/oh-my-zsh/plugins/jhbuild/jhbuild.plugin.zsh @@ -0,0 +1,28 @@ +# Aliases +# +alias jh='jhbuild' +# Build +alias jhb='jhbuild build' +alias jhbo='jhbuild buildone' +# Checks +alias jhckb='jhbuild checkbranches' +alias jhckm='jhbuild checkmodulesets' +# Info & list +alias jhi='jhbuild info' +alias jhl='jhbuild list' +# Clean +alias jhc='jhbuild clean' +alias jhco='jhbuild cleanone' +# Run +alias jhr='jhbuild run' +# Depends +alias jhrd='jhbuild rdepends' +alias jhsd='jhbuild sysdeps' +# Update +alias jhu='jhbuild update' +alias jhuo='jhbuild updateone' +# Uninstall +alias jhun='jhbuild uninstall' + + + diff --git a/oh-my-zsh/plugins/jira/README.md b/oh-my-zsh/plugins/jira/README.md @@ -0,0 +1,65 @@ +# Jira plugin # + +CLI support for JIRA interaction + +## Description ## + +This plugin provides command line tools for interacting with Atlassian's [JIRA](https://www.atlassian.com/software/jira) bug tracking software. + +The interaction is all done through the web. No local installation of JIRA is necessary. + +In this document, "JIRA" refers to the JIRA issue tracking server, and `jira` refers to the command this plugin supplies. + +## Usage ## + +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. + +``` +jira # performs the default action + +jira new # opens a new issue +jira dashboard # opens your JIRA dashboard +jira reported [username] # queries for issues reported by a user +jira assigned [username] # queries for issues assigned to a user +jira branch # opens an existing issue matching the current branch name +jira ABC-123 # opens an existing issue +jira ABC-123 m # opens an existing issue for adding a comment +``` + +#### Debugging usage #### + +These calling forms are for developers' use, and may change at any time. + +``` +jira dumpconfig # displays the effective configuration +``` + +## Setup ## + +The URL for your JIRA instance is set by `$JIRA_URL` or a `.jira_url` file. + +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. + +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. + +For example: + +``` +cd to/my/project +echo "https://jira.atlassian.com" >> .jira-url +``` + +(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.) + +### Variables ### + +* `$JIRA_URL` - Your JIRA instance's URL +* `$JIRA_NAME` - Your JIRA username; used as the default user for `assigned`/`reported` searches +* `$JIRA_PREFIX` - Prefix added to issue ID arguments +* `$JIRA_RAPID_BOARD` - Set to `true` if you use Rapid Board +* `$JIRA_DEFAULT_ACTION` - Action to do when `jira` is called with no arguments; defaults to "new" + + +### Browser ### + +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. diff --git a/oh-my-zsh/plugins/jira/_jira b/oh-my-zsh/plugins/jira/_jira @@ -0,0 +1,23 @@ +#compdef jira +#autoload + +local -a _1st_arguments +_1st_arguments=( + 'new:create a new issue' + 'dashboard:open the dashboard' + 'reported:search for issues reported by a user' + 'assigned:search for issues assigned to a user' + 'br:open the issue named after the git branch of the current directory' + 'dumpconfig:display effective jira configuration' +) + +_arguments -C \ + ':command:->command' \ + '*::options:->options' + +case $state in + (command) + _describe -t commands "jira subcommand" _1st_arguments + return + ;; +esac diff --git a/oh-my-zsh/plugins/jira/jira.plugin.zsh b/oh-my-zsh/plugins/jira/jira.plugin.zsh @@ -0,0 +1,119 @@ +# CLI support for JIRA interaction +# +# See README.md for details + +function jira() { + emulate -L zsh + local action jira_url jira_prefix + if [[ -n "$1" ]]; then + action=$1 + elif [[ -f .jira-default-action ]]; then + action=$(cat .jira-default-action) + elif [[ -f ~/.jira-default-action ]]; then + action=$(cat ~/.jira-default-action) + elif [[ -n "${JIRA_DEFAULT_ACTION}" ]]; then + action=${JIRA_DEFAULT_ACTION} + else + action="new" + fi + + if [[ -f .jira-url ]]; then + jira_url=$(cat .jira-url) + elif [[ -f ~/.jira-url ]]; then + jira_url=$(cat ~/.jira-url) + elif [[ -n "${JIRA_URL}" ]]; then + jira_url=${JIRA_URL} + else + _jira_url_help + return 1 + fi + + if [[ -f .jira-prefix ]]; then + jira_prefix=$(cat .jira-prefix) + elif [[ -f ~/.jira-prefix ]]; then + jira_prefix=$(cat ~/.jira-prefix) + elif [[ -n "${JIRA_PREFIX}" ]]; then + jira_prefix=${JIRA_PREFIX} + else + jira_prefix="" + fi + + + if [[ $action == "new" ]]; then + echo "Opening new issue" + open_command "${jira_url}/secure/CreateIssue!default.jspa" + elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then + _jira_query $@ + elif [[ "$action" == "dashboard" ]]; then + echo "Opening dashboard" + if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then + open_command "${jira_url}/secure/RapidBoard.jspa" + else + open_command "${jira_url}/secure/Dashboard.jspa" + fi + elif [[ "$action" == "dumpconfig" ]]; then + echo "JIRA_URL=$jira_url" + echo "JIRA_PREFIX=$jira_prefix" + echo "JIRA_NAME=$JIRA_NAME" + echo "JIRA_RAPID_BOARD=$JIRA_RAPID_BOARD" + echo "JIRA_DEFAULT_ACTION=$JIRA_DEFAULT_ACTION" + else + # Anything that doesn't match a special action is considered an issue name + # but `branch` is a special case that will parse the current git branch + if [[ "$action" == "branch" ]]; then + local issue_arg=$(git rev-parse --abbrev-ref HEAD) + local issue="${jira_prefix}${issue_arg}" + else + local issue_arg=$action + local issue="${jira_prefix}${issue_arg}" + fi + local url_fragment='' + if [[ "$2" == "m" ]]; then + url_fragment="#add-comment" + echo "Add comment to issue #$issue" + else + echo "Opening issue #$issue" + fi + if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then + open_command "${jira_url}/issues/${issue}${url_fragment}" + else + open_command "${jira_url}/browse/${issue}${url_fragment}" + fi + fi +} + +function _jira_url_help() { + cat << EOF +error: JIRA URL is not specified anywhere. + +Valid options, in order of precedence: + .jira-url file + \$HOME/.jira-url file + \$JIRA_URL environment variable +EOF +} + +function _jira_query() { + emulate -L zsh + local verb="$1" + local jira_name lookup preposition query + if [[ "${verb}" == "reported" ]]; then + lookup=reporter + preposition=by + elif [[ "${verb}" == "assigned" ]]; then + lookup=assignee + preposition=to + else + echo "error: not a valid lookup: $verb" >&2 + return 1 + fi + jira_name=${2:=$JIRA_NAME} + if [[ -z $jira_name ]]; then + echo "error: JIRA_NAME not specified" >&2 + return 1 + fi + + echo "Browsing issues ${verb} ${preposition} ${jira_name}" + query="${lookup}+%3D+%22${jira_name}%22+AND+resolution+%3D+unresolved+ORDER+BY+priority+DESC%2C+created+ASC" + open_command "${jira_url}/secure/IssueNavigator.jspa?reset=true&jqlQuery=${query}" +} diff --git a/oh-my-zsh/plugins/jruby/jruby.plugin.zsh b/oh-my-zsh/plugins/jruby/jruby.plugin.zsh @@ -0,0 +1,4 @@ +# Aliases +alias jrspec='jruby --debug -S rspec --debug' +alias jprofile='jruby --profile.api -S rspec' +alias jexec='jruby -S' diff --git a/oh-my-zsh/plugins/jsontools/README.md b/oh-my-zsh/plugins/jsontools/README.md @@ -0,0 +1,42 @@ +# jsontools + +Handy command line tools for dealing with json data. + +## Tools + +- **pp_json** - pretty prints json +- **is_json** - returns true if valid json; false otherwise +- **urlencode_json** - returns a url encoded string for the given json +- **urldecode_json** - returns decoded json for the given url encoded string + +## Usage +Usage is simple...just take your json data and pipe it into the appropriate jsontool. +```sh +<json data> | <jsontools tool> +``` +## Examples + +##### pp_json + +```sh +# curl json data and pretty print the results +curl https://coderwall.com/bobwilliams.json | pp_json +``` + +##### is_json +```sh +# pretty print the contents of an existing json file +less data.json | is_json +``` + +##### urlencode_json +```sh +# json data directly from the command line +echo '{"b":2, "a":1}' | urlencode_json +``` + +##### urldecode_json +```sh +# url encoded string to decode +echo '%7B%22b%22:2,%20%22a%22:1%7D%0A' | urldecode_json +```+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/jsontools/jsontools.plugin.zsh b/oh-my-zsh/plugins/jsontools/jsontools.plugin.zsh @@ -0,0 +1,39 @@ +# JSON Tools +# Adds command line aliases useful for dealing with JSON + +if [[ $(whence $JSONTOOLS_METHOD) = "" ]]; then + JSONTOOLS_METHOD="" +fi + +if [[ $(whence node) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xnode" ) ]]; then + alias pp_json='xargs -0 node -e "console.log(JSON.stringify(JSON.parse(process.argv[1]), null, 4));"' + alias is_json='xargs -0 node -e "try {json = JSON.parse(process.argv[1]);} catch (e) { console.log(false); json = null; } if(json) { console.log(true); }"' + alias urlencode_json='xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))"' + alias urldecode_json='xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"' +elif [[ $(whence python) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xpython" ) ]]; then + alias pp_json='python -mjson.tool' + alias is_json='python -c " +import json, sys; +try: + json.loads(sys.stdin.read()) +except ValueError, e: + print False +else: + print True +sys.exit(0)"' + alias urlencode_json='python -c " +import urllib, json, sys; +print urllib.quote_plus(sys.stdin.read()) +sys.exit(0)"' + alias urldecode_json='python -c " +import urllib, json, sys; +print urllib.unquote_plus(sys.stdin.read()) +sys.exit(0)"' +elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xruby" ) ]]; then + alias pp_json='ruby -e "require \"json\"; require \"yaml\"; puts JSON.parse(STDIN.read).to_yaml"' + alias is_json='ruby -e "require \"json\"; begin; JSON.parse(STDIN.read); puts true; rescue Exception => e; puts false; end"' + alias urlencode_json='ruby -e "require \"uri\"; puts URI.escape(STDIN.read)"' + alias urldecode_json='ruby -e "require \"uri\"; puts URI.unescape(STDIN.read)"' +fi + +unset JSONTOOLS_METHOD+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/jump/jump.plugin.zsh b/oh-my-zsh/plugins/jump/jump.plugin.zsh @@ -0,0 +1,57 @@ +# Easily jump around the file system by manually adding marks +# marks are stored as symbolic links in the directory $MARKPATH (default $HOME/.marks) +# +# jump FOO: jump to a mark named FOO +# mark FOO: create a mark named FOO +# unmark FOO: delete a mark +# marks: lists all marks +# +export MARKPATH=$HOME/.marks + +jump() { + cd -P "$MARKPATH/$1" 2>/dev/null || {echo "No such mark: $1"; return 1} +} + +mark() { + if [[ ( $# == 0 ) || ( "$1" == "." ) ]]; then + MARK=$(basename "$PWD") + else + MARK="$1" + fi + if read -q \?"Mark $PWD as ${MARK}? (y/n) "; then + mkdir -p "$MARKPATH"; ln -s "$PWD" "$MARKPATH/$MARK" + fi +} + +unmark() { + rm -i "$MARKPATH/$1" +} + +marks() { + for link in $MARKPATH/*(@); do + local markname="$fg[cyan]${link:t}$reset_color" + local markpath="$fg[blue]$(readlink $link)$reset_color" + printf "%s\t" $markname + printf "-> %s \t\n" $markpath + done +} + +_completemarks() { + if [[ $(ls "${MARKPATH}" | wc -l) -gt 1 ]]; then + reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_a-zA-Z0-9\.\-]*):$/\2/g')) + else + if readlink -e "${MARKPATH}"/* &>/dev/null; then + reply=($(ls "${MARKPATH}")) + fi + fi +} +compctl -K _completemarks jump +compctl -K _completemarks unmark + +_mark_expansion() { + setopt extendedglob + autoload -U modify-current-argument + modify-current-argument '$(readlink "$MARKPATH/$ARG")' +} +zle -N _mark_expansion +bindkey "^g" _mark_expansion diff --git a/oh-my-zsh/plugins/kate/kate.plugin.zsh b/oh-my-zsh/plugins/kate/kate.plugin.zsh @@ -0,0 +1,9 @@ + +# Kate +# Start kate always silent +alias kate='kate >/dev/null 2>&1' + +function kt () { + cd $1 + kate $1 +}+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/kitchen/_kitchen b/oh-my-zsh/plugins/kitchen/_kitchen @@ -0,0 +1,85 @@ +#compdef kitchen +# ------------------------------------------------------------------------------ +# Copyright (c) 2014 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for Test Kitchen (http://kitchen.ci/). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Peter Eisentraut (https://github.com/petere) +# +# ------------------------------------------------------------------------------ + + +_kitchen() { + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments '1: :->cmds'\ + '2: :->args' + + case $state in + cmds) + _kitchen_commands + ;; + args) + case $line[1] in + converge|create|destroy|diagnose|list|setup|test|verify) + compadd 'all' + _kitchen_instances + ;; + login) + _kitchen_instances + ;; + esac + ;; + esac +} + +_kitchen_commands() { + local commands + + commands=("${(@f)$(_call_program commands $service help | sed -n 's/^ kitchen \([[:alpha:]]*\) [ [].*# \(.*\)$/\1:\2/p')}") + _describe -t commands 'kitchen commands' commands +} + +_kitchen_instances() { + if [[ $_kitchen_instances_cache_dir != $PWD ]]; then + unset _kitchen_instances_cache + fi + if [[ ${+_kitchen_instances_cache} -eq 0 ]]; then + _kitchen_instances_cache=(${(f)"$(_call_program instances $service list -b 2>/dev/null)"}) + _kitchen_instances_cache_dir=$PWD + fi + _wanted instances expl 'instance' compadd -a _kitchen_instances_cache +} + +_kitchen "$@" diff --git a/oh-my-zsh/plugins/knife/_knife b/oh-my-zsh/plugins/knife/_knife @@ -0,0 +1,241 @@ +#compdef knife + +# You can override the path to knife.rb and your cookbooks by setting +# KNIFE_CONF_PATH=/path/to/my/.chef/knife.rb +# KNIFE_COOKBOOK_PATH=/path/to/my/chef/cookbooks +# If you want your local cookbooks path to be calculated relative to where you are then +# set the below option +# KNIFE_RELATIVE_PATH=true +# Read around where these are used for more detail. + +# These flags should be available everywhere according to man knife +knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes ) + +# knife has a very special syntax, some example calls are: +# knife status +# knife cookbook list +# knife role show ROLENAME +# knife data bag show DATABAGNAME +# knife role show ROLENAME --attribute ATTRIBUTENAME +# knife cookbook show COOKBOOKNAME COOKBOOKVERSION recipes + +# The -Q switch in compadd allow for completions of things like "data bag" without having to go through two rounds of completion and avoids zsh inserting a \ for escaping spaces +_knife() { + local curcontext="$curcontext" state line + typeset -A opt_args + cloudproviders=(bluebox ec2 rackspace slicehost terremark) + _arguments \ + '1: :->knifecmd'\ + '2: :->knifesubcmd'\ + '3: :->knifesubcmd2' \ + '4: :->knifesubcmd3' \ + '5: :->knifesubcmd4' \ + '6: :->knifesubcmd5' + + case $state in + knifecmd) + compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" diff exec environment index node recipe role search ssh status upload vault windows $cloudproviders + ;; + knifesubcmd) + case $words[2] in + (bluebox|ec2|rackspace|slicehost|terremark) + compadd "$@" server images + ;; + client) + compadd -Q "$@" "bulk delete" list create show delete edit reregister + ;; + configure) + compadd "$@" client + ;; + cookbook) + compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload + ;; + diff) + _arguments '*:file or directory:_files -g "*"' + ;; + environment) + compadd -Q "$@" list create delete edit show "from file" + ;; + node) + compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete" + ;; + recipe) + compadd "$@" list + ;; + role) + compadd -Q "$@" "bulk delete" create delete edit "from file" list show + ;; + upload) + _arguments '*:file or directory:_files -g "*"' + ;; + vault) + compadd -Q "$@" create decrypt delete edit remove "rotate all keys" "rotate keys" show update + ;; + windows) + compadd "$@" bootstrap + ;; + *) + _arguments '2:Subsubcommands:($(_knife_options1))' + esac + ;; + knifesubcmd2) + case $words[3] in + server) + compadd "$@" list create delete + ;; + images) + compadd "$@" list + ;; + site) + compadd "$@" vendor show share search download list unshare + ;; + (show|delete|edit) + _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))' + ;; + (upload|test) + _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)' + ;; + list) + compadd -a "$@" knife_general_flags + ;; + bag) + compadd -Q "$@" show edit list "from file" create delete + ;; + *) + _arguments '3:Subsubcommands:($(_knife_options2))' + esac + ;; + knifesubcmd3) + case $words[3] in + show) + case $words[2] in + cookbook) + versioncomp=1 + _arguments '4:Cookbookversions:($(_cookbook_versions) latest)' + ;; + (node|client|role) + compadd "$@" --attribute + esac + esac + case $words[4] in + (show|edit) + _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))' + ;; + file) + case $words[2] in + environment) + _arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/environments"' + ;; + node) + _arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/nodes"' + ;; + role) + _arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/roles"' + ;; + *) + _arguments '*:Subsubcommands:($(_knife_options3))' + esac + ;; + list) + compadd -a "$@" knife_general_flags + ;; + *) + _arguments '*:Subsubcommands:($(_knife_options3))' + esac + ;; + knifesubcmd4) + if (( versioncomp > 0 )); then + compadd "$@" attributes definitions files libraries providers recipes resources templates + else + case $words[5] in + file) + _arguments '*:directory:_path_files -/ -W "$(_chef_root)/data_bags" -qS \ ' + ;; + *) _arguments '*:Subsubcommands:($(_knife_options2))' + esac + fi + ;; + knifesubcmd5) + case $words[5] in + file) + _arguments '*:files:_path_files -g "*.json" -W "$(_chef_root)/data_bags/$words[6]"' + ;; + *) + _arguments '*:Subsubcommands:($(_knife_options3))' + esac + esac +} + +# Helper functions to provide the argument completion for several depths of commands +_knife_options1() { + ( for line in $( knife $words[2] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) +} + +_knife_options2() { + ( for line in $( knife $words[2] $words[3] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) +} + +_knife_options3() { + ( for line in $( knife $words[2] $words[3] $words[4] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) +} + +# The chef_x_remote functions use knife to get a list of objects of type x on the server +_chef_roles_remote() { + (knife role list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +_chef_clients_remote() { + (knife client list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +_chef_nodes_remote() { + (knife node list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +_chef_cookbooks_remote() { + (knife cookbook list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +_chef_sitecookbooks_remote() { + (knife cookbook site list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +_chef_data_bags_remote() { + (knife data bag list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +_chef_environments_remote() { + (knife environment list | awk '{print $1}') +} + +# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server +_chef_cookbooks_local() { + if [ $KNIFE_RELATIVE_PATH ]; then + local cookbook_path="$(_chef_root)/cookbooks" + else + local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb} + if [ -f ./.chef/knife.rb ]; then + knife_rb="./.chef/knife.rb" + fi + local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )} + fi + (for i in $cookbook_path; do ls $i; done) +} + +# This function extracts the available cookbook versions on the chef server +_cookbook_versions() { + (knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g') +} + +# Searches up from current directory to find the closest folder that has a .chef folder +# Useful for the knife upload/from file commands +_chef_root () { + directory="$PWD" + while [ $directory != '/' ] + do + test -e "$directory/.chef" && echo "$directory" && return + directory="${directory:h}" + done +} + +_knife "$@" diff --git a/oh-my-zsh/plugins/knife_ssh/knife_ssh.plugin.zsh b/oh-my-zsh/plugins/knife_ssh/knife_ssh.plugin.zsh @@ -0,0 +1,18 @@ +function knife_ssh() { + grep -q $1 ~/.knife_comp~ 2> /dev/null || rm -f ~/.knife_comp~; + ssh $(knife node show $1 | awk '/IP:/{print $2}') +} + +_knife_ssh() { + if hash knife 2>/dev/null; then + if [[ ! -f ~/.knife_comp~ ]]; then + echo "\nGenerating ~/.knife_comp~..." >/dev/stderr + knife node list > ~/.knife_comp~ + fi + compadd $(<~/.knife_comp~) + else + echo "Could not find knife" > /dev/stderr; + fi +} + +compdef _knife_ssh knife_ssh diff --git a/oh-my-zsh/plugins/kops/kops.plugin.zsh b/oh-my-zsh/plugins/kops/kops.plugin.zsh @@ -0,0 +1,9 @@ +# Autocompletion for kops (Kubernetes Operations), +# the command line interface to get a production grade +# Kubernetes cluster up and running + +# Author: https://github.com/nmrony + +if [ $commands[kops] ]; then + source <(kops completion zsh) +fi diff --git a/oh-my-zsh/plugins/kube-ps1/README.md b/oh-my-zsh/plugins/kube-ps1/README.md @@ -0,0 +1,76 @@ +Kubernetes prompt for zsh +========================= + +A Kubernetes (k8s) zsh prompt that displays the current cluster cluster +and the namespace. + +Inspired by several tools used to simplify usage of kubectl + +NOTE: If you are not using zsh, check out [kube-ps1](https://github.com/jonmosco/kube-ps1) designed for bash +as well as zsh. + +## Requirements + +The default prompt assumes you have the kubectl command line utility installed. It +can be obtained here: + +[Install and Set up kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) + +If using this with OpenShift, the oc tool needs installed. It can be obtained from here: + +[OC Client Tools](https://www.openshift.org/download.html) + +## Helper utilities + +There are several great tools that make using kubectl very enjoyable. + +[kubectx and kubenx](https://github.com/ahmetb/kubectx) are great for +fast switching between clusters and namespaces. + +## Prompt Structure + +The prompt layout is: + +``` +(<logo>|<cluster>:<namespace>) +``` + +Supported platforms: +* k8s - Kubernetes +* ocp - OpenShift + +## Install + +1. Clone this repository +2. Source the kube-ps1.zsh in your ~./.zshrc + +ZSH: +``` +source path/kube-ps1.sh +PROMPT='$(kube_ps1) ' +``` + +## Colors + +The colors are of my opinion. Blue was used as the prefix to match the Kubernetes +color as closely as possible. Red was chosen as the cluster name to stand out, and cyan +for the namespace. These can of course be changed. + +## Customization + +The default settings can be overridden in ~/.zshrc + +| Variable | Default | Meaning | +| :------- | :-----: | ------- | +| `KUBE_PS1_DEFAULT` | `true` | Default settings for the prompt | +| `KUBE_PS1_PREFIX` | `(` | Prompt opening character | +| `KUBE_PS1_DEFAULT_LABEL` | `⎈ ` | Default prompt symbol | +| `KUBE_PS1_SEPERATOR` | `\|` | Separator between symbol and cluster name | +| `KUBE_PS1_PLATFORM` | `kubectl` | Cluster type and binary to use | +| `KUBE_PS1_DIVIDER` | `:` | Separator between cluster and namespace | +| `KUBE_PS1_SUFFIX` | `)` | Prompt closing character | +| `KUBE_PS1_DEFAULT_LABEL_IMG` | `false` | Use Kubernetes img as the label: ☸️ | + +## Contributors + +Jared Yanovich diff --git a/oh-my-zsh/plugins/kube-ps1/kube-ps1.zsh b/oh-my-zsh/plugins/kube-ps1/kube-ps1.zsh @@ -0,0 +1,123 @@ +#!/bin/zsh + +# Kubernetes prompt helper for bash/zsh +# Displays current context and namespace + +# Copyright 2017 Jon Mosco +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Debug +[[ -n $DEBUG ]] && set -x + +setopt PROMPT_SUBST +add-zsh-hook precmd _kube_ps1_load +zmodload zsh/stat + +# Default values for the prompt +# Override these values in ~/.zshrc or ~/.bashrc +KUBE_PS1_DEFAULT="${KUBE_PS1_DEFAULT:=true}" +KUBE_PS1_PREFIX="(" +KUBE_PS1_DEFAULT_LABEL="${KUBE_PS1_DEFAULT_LABEL:="⎈ "}" +KUBE_PS1_DEFAULT_LABEL_IMG="${KUBE_PS1_DEFAULT_LABEL_IMG:=false}" +KUBE_PS1_SEPERATOR="|" +KUBE_PS1_PLATFORM="${KUBE_PS1_PLATFORM:="kubectl"}" +KUBE_PS1_DIVIDER=":" +KUBE_PS1_SUFFIX=")" +KUBE_PS1_UNAME=$(uname) +KUBE_PS1_LAST_TIME=0 + +kube_ps1_label () { + + [[ "${KUBE_PS1_DEFAULT_LABEL_IMG}" == false ]] && return + + if [[ "${KUBE_PS1_DEFAULT_LABEL_IMG}" == true ]]; then + local KUBE_LABEL="☸️ " + fi + + KUBE_PS1_DEFAULT_LABEL="${KUBE_LABEL}" + +} + +_kube_ps1_split() { + type setopt >/dev/null 2>&1 && setopt SH_WORD_SPLIT + local IFS=$1 + echo $2 +} + +_kube_ps1_file_newer_than() { + + local mtime + local file=$1 + local check_time=$2 + mtime=$(stat +mtime "${file}") + + [ "${mtime}" -gt "${check_time}" ] + +} + +_kube_ps1_load() { + # kubectl will read the environment variable $KUBECONFIG + # otherwise set it to ~/.kube/config + KUBECONFIG="${KUBECONFIG:=$HOME/.kube/config}" + + for conf in $(_kube_ps1_split : "${KUBECONFIG}"); do + # TODO: check existence of $conf + if _kube_ps1_file_newer_than "${conf}" "${KUBE_PS1_LAST_TIME}"; then + _kube_ps1_get_context_ns + return + fi + done +} + +_kube_ps1_get_context_ns() { + + # Set the command time + KUBE_PS1_LAST_TIME=$(date +%s) + + if [[ "${KUBE_PS1_DEFAULT}" == true ]]; then + local KUBE_BINARY="${KUBE_PS1_PLATFORM}" + elif [[ "${KUBE_PS1_DEFAULT}" == false ]] && [[ "${KUBE_PS1_PLATFORM}" == "kubectl" ]];then + local KUBE_BINARY="kubectl" + elif [[ "${KUBE_PS1_PLATFORM}" == "oc" ]]; then + local KUBE_BINARY="oc" + fi + + KUBE_PS1_CONTEXT="$(${KUBE_BINARY} config current-context)" + KUBE_PS1_NAMESPACE="$(${KUBE_BINARY} config view --minify --output 'jsonpath={..namespace}')" + # Set namespace to default if it is not defined + KUBE_PS1_NAMESPACE="${KUBE_PS1_NAMESPACE:-default}" + +} + +# source our symbol +kube_ps1_label + +# Build our prompt +kube_ps1 () { + local reset_color="%f" + local blue="%F{blue}" + local red="%F{red}" + local cyan="%F{cyan}" + + KUBE_PS1="${reset_color}$KUBE_PS1_PREFIX" + KUBE_PS1+="${blue}$KUBE_PS1_DEFAULT_LABEL" + KUBE_PS1+="${reset_color}$KUBE_PS1_SEPERATOR" + KUBE_PS1+="${red}$KUBE_PS1_CONTEXT${reset_color}" + KUBE_PS1+="$KUBE_PS1_DIVIDER" + KUBE_PS1+="${cyan}$KUBE_PS1_NAMESPACE${reset_color}" + KUBE_PS1+="$KUBE_PS1_SUFFIX" + + echo "${KUBE_PS1}" + +} diff --git a/oh-my-zsh/plugins/kubectl/kubectl.plugin.zsh b/oh-my-zsh/plugins/kubectl/kubectl.plugin.zsh @@ -0,0 +1,56 @@ +# Autocompletion for kubectl, the command line interface for Kubernetes +# +# Author: https://github.com/pstadler + +if [ $commands[kubectl] ]; then + source <(kubectl completion zsh) +fi + +# This command is used ALOT both below and in daily life +alias k=kubectl + +# Apply a YML file +alias kaf='k apply -f' + +# Drop into an interactive terminal on a container +alias keti='k exec -ti' + +# Manage configuration quickly to switch contexts between local, dev ad staging. +alias kcuc='k config use-context' +alias kcsc='k config set-context' +alias kcdc='k config delete-context' +alias kccc='k config current-context' + +# Pod management. +alias kgp='k get pods' +alias kep='k edit pods' +alias kdp='k describe pods' +alias kdelp='k delete pods' + +# Service management. +alias kgs='k get svc' +alias kes='k edit svc' +alias kds='k describe svc' +alias kdels='k delete svc' + +# Secret management +alias kgsec='k get secret' +alias kdsec='k describe secret' +alias kdelsec='k delete secret' + +# Deployment management. +alias kgd='k get deployment' +alias ked='k edit deployment' +alias kdd='k describe deployment' +alias kdeld='k delete deployment' +alias ksd='k scale deployment' +alias krsd='k rollout status deployment' + +# Rollout management. +alias kgrs='k get rs' +alias krh='k rollout history' +alias kru='k rollout undo' + +# Logs +alias kl='k logs' +alias klf='k logs -f' diff --git a/oh-my-zsh/plugins/laravel/_artisan b/oh-my-zsh/plugins/laravel/_artisan @@ -0,0 +1,40 @@ +#compdef artisan + +# Laravel autocompletion +# Author: John Hamelink <john@johnhamelink.com> +# +# This plugin does the following: +# - Adds aliases and autocompletion for artisan +# - Adds aliases and autocompletion for bob + +local curcontext="$curcontext" state line _opts _bundles ret=1 +_arguments -C \ + '1: :->cmds' \ + '*:: :->args' && ret=0 + +case $state in + cmds) + + _values "Artisan command" \ + 'session\:install[Create a session table]' \ + 'migrate[Manage Migrations]' \ + 'test[Run a test]' \ + 'route\:\:call[Call a route in the CLI]' \ + 'key\:\:generate[Generate a key]' + ret=0 + ;; + args) + case $line[1] in + migrate) + _values \ + 'install[Create the Laravel migration table' \ + 'make[Create a migration]' \ + 'rollback[Roll back to the last migration operation]' \ + 'reset[Roll back all migrations that have ever run]' + ret=0 + ;; + esac + ;; +esac + +return ret diff --git a/oh-my-zsh/plugins/laravel/laravel.plugin.zsh b/oh-my-zsh/plugins/laravel/laravel.plugin.zsh @@ -0,0 +1,3 @@ +#!zsh +alias artisan='php artisan' +alias bob='php artisan bob::build' diff --git a/oh-my-zsh/plugins/laravel4/laravel4.plugin.zsh b/oh-my-zsh/plugins/laravel4/laravel4.plugin.zsh @@ -0,0 +1,20 @@ +# Laravel4 basic command completion +_laravel4_get_command_list () { + php artisan --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z]+/ { print $1 }' +} + +_laravel4 () { + if [ -f artisan ]; then + compadd `_laravel4_get_command_list` + fi +} + +compdef _laravel4 artisan +compdef _laravel4 la4 + +#Alias +alias la4='php artisan' + +alias la4dump='php artisan dump-autoload' +alias la4cache='php artisan cache:clear' +alias la4routes='php artisan routes' diff --git a/oh-my-zsh/plugins/laravel5/laravel5.plugin.zsh b/oh-my-zsh/plugins/laravel5/laravel5.plugin.zsh @@ -0,0 +1,20 @@ +# Laravel5 basic command completion +_laravel5_get_command_list () { + php artisan --raw --no-ansi list | sed "s/[[:space:]].*//g" +} + +_laravel5 () { + if [ -f artisan ]; then + compadd `_laravel5_get_command_list` + fi +} + +compdef _laravel5 artisan +compdef _laravel5 la5 + +#Alias +alias la5='php artisan' + +alias la5cache='php artisan cache:clear' +alias la5routes='php artisan route:list' +alias la5vendor='php artisan vendor:publish' diff --git a/oh-my-zsh/plugins/last-working-dir/README.md b/oh-my-zsh/plugins/last-working-dir/README.md @@ -0,0 +1,9 @@ +# last-working-dir plugin + +Keeps track of the last used working directory and automatically jumps into it +for new shells, unless: + +- The plugin is already loaded. +- The current `$PWD` is not `$HOME`. + +Adds `lwd` function to jump to the last working directory. diff --git a/oh-my-zsh/plugins/last-working-dir/last-working-dir.plugin.zsh b/oh-my-zsh/plugins/last-working-dir/last-working-dir.plugin.zsh @@ -0,0 +1,23 @@ +# Flag indicating if we've previously jumped to last directory +typeset -g ZSH_LAST_WORKING_DIRECTORY + +# Updates the last directory once directory is changed +chpwd_functions+=(chpwd_last_working_dir) +chpwd_last_working_dir() { + local cache_file="$ZSH_CACHE_DIR/last-working-dir" + pwd >| "$cache_file" +} + +# Changes directory to the last working directory +lwd() { + local cache_file="$ZSH_CACHE_DIR/last-working-dir" + [[ -r "$cache_file" ]] && cd "$(cat "$cache_file")" +} + +# Jump to last directory automatically unless: +# - this isn't the first time the plugin is loaded +# - it's not in $HOME directory +[[ -n "$ZSH_LAST_WORKING_DIRECTORY" ]] && return +[[ "$PWD" != "$HOME" ]] && return + +lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true diff --git a/oh-my-zsh/plugins/lein/lein.plugin.zsh b/oh-my-zsh/plugins/lein/lein.plugin.zsh @@ -0,0 +1,43 @@ +function _lein_commands() { + local ret=1 state + _arguments ':subcommand:->subcommand' && ret=0 + + case $state in + subcommand) + subcommands=( + "classpath:print the classpath of the current project" + "clean:remove compiled files and dependencies from project" + "compile:ahead-of-time compile the project" + "deploy:build jar and deploy to remote repository" + "deps:download and install all dependencies" + "help:display a list of tasks or help for a given task" + "install:install the project and its dependencies in your local repository" + "int:enter an interactive task shell" + "interactive:enter an interactive task shell" + "jack-in:jack in to a clojure slime session from emacs." + "jar:create a jar file containing the compiled .class files" + "javac:compile java source files" + "new:create a new project skeleton" + "plugin:manage user-level plugins" + "pom:write a pom.xml file to disk for maven interop" + "repl:start a repl session either with the current project or standalone" + "retest:run only the test namespaces which failed last time around" + "run:run the project's -main function" + "search:search remote maven repositories for matching jars" + "swank:launch swank server for Emacs to connect" + "test:run the project's tests" + "test!:run a project's tests after cleaning and fetching dependencies" + "trampoline:run a task without nesting the project's JVM inside Leiningen's." + "uberjar:Create a jar including the contents of each of deps" + "upgrade:upgrade leiningen to the latest stable release" + "version:print leiningen's version" + ) + _describe -t subcommands 'leiningen subcommands' subcommands && ret=0 + ;; + *) _files + esac + + return ret +} + +compdef _lein_commands lein diff --git a/oh-my-zsh/plugins/lighthouse/lighthouse.plugin.zsh b/oh-my-zsh/plugins/lighthouse/lighthouse.plugin.zsh @@ -0,0 +1,16 @@ +# To use: add a .lighthouse file into your directory with the URL to the +# individual project. For example: +# https://rails.lighthouseapp.com/projects/8994 +# Example usage: http://screencast.com/t/ZDgwNDUwNT +open_lighthouse_ticket () { + if [ ! -f .lighthouse-url ]; then + echo "There is no .lighthouse-url file in the current directory..." + return 0; + else + lighthouse_url=$(cat .lighthouse-url); + echo "Opening ticket #$1"; + open_command "$lighthouse_url/tickets/$1"; + fi +} + +alias lho='open_lighthouse_ticket' diff --git a/oh-my-zsh/plugins/lol/lol.plugin.zsh b/oh-my-zsh/plugins/lol/lol.plugin.zsh @@ -0,0 +1,51 @@ +# LOL!!1 +# Source: http://aur.archlinux.org/packages/lolbash/lolbash/lolbash.sh + +alias wtf='dmesg' +alias onoz='cat /var/log/errors.log' +alias rtfm='man' + +alias :3='echo' +alias visible='echo' +alias invisible='cat' +alias moar='more' +alias tldr='less' +alias alwayz='tail -f' + +alias icanhas='mkdir' +alias gimmeh='touch' +alias donotwant='rm' +alias dowant='cp' +alias gtfo='mv' +alias nowai='chmod' + +alias hai='cd' +alias iz='ls' +alias plz='pwd' +alias ihasbucket='df -h' + +alias inur='locate' +alias iminurbase='finger' + +alias btw='nice' +alias obtw='nohup' + +alias nomz='ps aux' +alias nomnom='killall' + +alias byes='exit' +alias cya='reboot' +alias kthxbai='halt' + +alias pwned='ssh' + +alias hackzor='git init' +alias rulz='git push' +alias bringz='git pull' +alias chicken='git add' +alias oanward='git commit -m' +alias ooanward='git commit -am' +alias yolo='git commit -m "$(curl -s whatthecommit.com/index.txt)"' +alias letcat='git checkout' +alias violenz='git rebase' + diff --git a/oh-my-zsh/plugins/macports/_port b/oh-my-zsh/plugins/macports/_port @@ -0,0 +1,89 @@ +#compdef port + +local subcmds + +# we cache the list of ports +# we shall use some cache policy to avoid problems with new ports +if (( ! $+portlist )); then + portlist=($(port echo all; echo "all current active inactive installed uninstalled outdated")) +fi + +subcmds=( +'activate' +'archive' +'build' +'cat' +'clean' +'configure' +'contents' +'deactivate' +'dependents' +'deps' +'destroot' +'dir' +'distcheck' +'distclean' +'dmg' +'echo' +'edit' +'extract' +'fetch' +'file' +'help' +'info' +'install' +'installed' +'list' +'livecheck' +'location' +'mpkg' +'outdated' +'patch' +'pkg' +'provides' +'rpmpackage' +'search' +'selfupdate' +'sync' +'test' +'unarchive' +'uninstall' +'upgrade' +'variants' +'version' +) + +_arguments -C \ +'-v[verbose mode (generate verbose messages)]' \ +'-d[debug mode (generate debugging messages)]' \ +'-q[quiet mode (suppress messages)]' \ +'-D[specify portdir]' \ +'-k[keep mode (do not autoclean after install)]' \ +'-n[dont follow dependencies in upgrade (only for upgrading)]' \ +'-a[upgrade all installed ports (only for upgrading)]' \ +'-u[uninstall non-active ports when upgrading and uninstalling]' \ +'-f[force mode (ignore state file)]' \ +'-s[source-only mode]' \ +'-b[binary-only mode]' \ +'-o[honor state files older than Portfile]' \ +'*::command:->command' \ +&& return 0 + +case $state in + command) + if ((CURRENT == 1)); then + state=subcommands + else + state=portname + fi + ;; +esac + +case $state in + subcommands) + _describe -t commands 'port commands' subcmds + ;; + portname) + _describe -t commands 'available ports' portlist + ;; +esac diff --git a/oh-my-zsh/plugins/macports/macports.plugin.zsh b/oh-my-zsh/plugins/macports/macports.plugin.zsh @@ -0,0 +1,8 @@ +#Aliases +alias pc="sudo port clean --all installed" +alias pi="sudo port install $1" +alias psu="sudo port selfupdate" +alias puni="sudo port uninstall inactive" +alias puo="sudo port upgrade outdated" +alias pup="psu && puo" + diff --git a/oh-my-zsh/plugins/man/man.zsh b/oh-my-zsh/plugins/man/man.zsh @@ -0,0 +1,27 @@ +# ------------------------------------------------------------------------------ +# Author +# ------ +# +# * Jerry Ling<jerryling315@gmail.com> +# +# ------------------------------------------------------------------------------ +# Usgae +# ----- +# +# man will be inserted before the command +# +# ------------------------------------------------------------------------------ + +man-command-line() { + [[ -z $BUFFER ]] && zle up-history + [[ $BUFFER != man\ * ]] && LBUFFER="man $LBUFFER" +} +zle -N man-command-line +# Defined shortcut keys: [Esc]man +bindkey "\e"man man-command-line + + +# ------------------------------------------------------------------------------ +# Also, you might want to use man-preview included in 'osx' plugin +# just substitute "man" in the function with "man-preview" after you included OS X in +# the .zshrc+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/marked2/README.md b/oh-my-zsh/plugins/marked2/README.md @@ -0,0 +1,13 @@ +## marked2 + +Plugin for Marked 2, a previewer for Markdown files on Mac OS X + +### Requirements + + * [Marked 2](http://marked2app.com) + +### Usage + + * If `marked` is called without an argument, open Marked + + * If `marked` is passed a file, open it in Marked diff --git a/oh-my-zsh/plugins/marked2/marked2.plugin.zsh b/oh-my-zsh/plugins/marked2/marked2.plugin.zsh @@ -0,0 +1,12 @@ +# +# If marked is called without an argument, open Marked +# If marked is passed a file, open it in Marked +# +function marked() { + if [ "$1" ] + then + open -a "marked 2.app" "$1" + else + open -a "marked 2.app" + fi +} diff --git a/oh-my-zsh/plugins/mercurial/README.md b/oh-my-zsh/plugins/mercurial/README.md @@ -0,0 +1,60 @@ +# Mercurial plugin +### Usage +Update .zshrc: + +1. Add name to the list of plugins, e.g. `plugins=(... mercurial ...)` + (that is pretty obvious). +2. Switch to a theme which uses `hg_prompt_info`. + + Or, customize the `$PROMPT` variable of your current theme to contain current folder mercurial repo info. This can be done by putting a custom version of the theme in `$ZSH_CUSTOM` or by changing `$PROMPT` in `.zshrc` after loading the theme. + + The `robbyrussell` theme is used by default, so you need to modify `$PROMPT` var by adding `$(hg_prompt_info)` after `$(git_prompt_info)`, so it looks like this: + + ```zsh + PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' + ``` + +3. Initialize additional vars used in plugin. So in short put next in **.zshrc**: + + ``` + ZSH_THEME_HG_PROMPT_PREFIX="%{$fg_bold[magenta]%}hg:(%{$fg[red]%}" + ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}" + ZSH_THEME_HG_PROMPT_DIRTY="%{$fg[magenta]%}) %{$fg[yellow]%}✗%{$reset_color%}" + ZSH_THEME_HG_PROMPT_CLEAN="%{$fg[magenta]%})" + ``` + +### What's inside? +#### Adds handy aliases: +###### general +* `hgc` - `hg commit` +* `hgb` - `hg branch` +* `hgba` - `hg branches` +* `hgbk` - `hg bookmarks` +* `hgco` - `hg checkout` +* `hgd` - `hg diff` +* `hged` - `hg diffmerge` + +###### pull and update +* `hgi` - `hg incoming` +* `hgl` - `hg pull -u` +* `hglr` - `hg pull --rebase` +* `hgo` - `hg outgoing` +* `hgp` - `hg push` +* `hgs` - `hg status` +* `hgsl` - `hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"` + +###### this is the 'git commit --amend' equivalent +* `hgca` - `hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip` + +###### list unresolved files (since hg does not list unmerged files in the status command) +* `hgun` - `hg resolve --list` + +#### Displays repo branch and directory status in prompt +This is the same as git plugin does. + +**Note**: Additional changes to **.zshrc**, or using a theme designed to use `hg_prompt_info`, are required in order for this to work. + +### Mantainers +[ptrv](https://github.com/ptrv) - original creator + +[oshybystyi](https://github.com/oshybystyi) - created this README and know how most of code works diff --git a/oh-my-zsh/plugins/mercurial/mercurial.plugin.zsh b/oh-my-zsh/plugins/mercurial/mercurial.plugin.zsh @@ -0,0 +1,65 @@ +# Mercurial +alias hgc='hg commit' +alias hgb='hg branch' +alias hgba='hg branches' +alias hgbk='hg bookmarks' +alias hgco='hg checkout' +alias hgd='hg diff' +alias hged='hg diffmerge' +# pull and update +alias hgi='hg incoming' +alias hgl='hg pull -u' +alias hglr='hg pull --rebase' +alias hgo='hg outgoing' +alias hgp='hg push' +alias hgs='hg status' +alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n" ' +alias hgca='hg commit --amend' +# list unresolved files (since hg does not list unmerged files in the status command) +alias hgun='hg resolve --list' + +function in_hg() { + if [[ -d .hg ]] || $(hg summary > /dev/null 2>&1); then + echo 1 + fi +} + +function hg_get_branch_name() { + if [ $(in_hg) ]; then + echo $(hg branch) + fi +} + +function hg_prompt_info { + if [ $(in_hg) ]; then + _DISPLAY=$(hg_get_branch_name) + echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_PREFIX\ +$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_PROMPT_BASE_COLOR$(hg_dirty)$ZSH_THEME_HG_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR" + unset _DISPLAY + fi +} + +function hg_dirty_choose { + if [ $(in_hg) ]; then + hg status 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]' + if [ $pipestatus[-1] -eq 0 ]; then + # Grep exits with 0 when "One or more lines were selected", return "dirty". + echo $1 + else + # Otherwise, no lines were found, or an error occurred. Return clean. + echo $2 + fi + fi +} + +function hg_dirty { + hg_dirty_choose $ZSH_THEME_HG_PROMPT_DIRTY $ZSH_THEME_HG_PROMPT_CLEAN +} + +function hgic() { + hg incoming "$@" | grep "changeset" | wc -l +} + +function hgoc() { + hg outgoing "$@" | grep "changeset" | wc -l +} diff --git a/oh-my-zsh/plugins/meteor/README.md b/oh-my-zsh/plugins/meteor/README.md @@ -0,0 +1,45 @@ +## Introduction + +The [meteor plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/meteor) provides many +[useful aliases](#aliases) as well as completion for the `meteor` command. + +Enable it by adding `meteor` to the plugins array in your zshrc file: +```zsh +plugins=(... meteor) +``` + +## Aliases + +| Alias | Command | Description | +|---------|----------------------------|------------------------------------------------------------------| +| `ma` | `meteor add` | Add a package to this project | +| `map` | `meteor add-platform` | Add a platform to this project | +| `mad` | `meteor admin` | Administrative commands | +| `mau` | `meteor authorized` | View or change authorized users and organizations for a site | +| `mb` | `meteor build` | Build this project for all platforms | +| `mcl` | `meteor claim` | Claim a site deployed with an old Meteor version | +| `mca` | `meteor configure-android` | Run the Android configuration tool from Meteor's ADK environment | +| `mc` | `meteor create` | Create a new project | +| `mdb` | `meteor debug` | Run the project, but suspend the server process for debugging | +| `mde` | `meteor deploy` | Deploy this project to Meteor | +| `mis` | `meteor install-sdk` | Installs SDKs for a platform | +| `ml` | `meteor list` | List the packages explicitly used by your project | +| `mlp` | `meteor list-platforms` | List the platforms added to your project | +| `mls` | `meteor list-sites` | List sites for which you are authorized | +| `mli` | `meteor login` | Log in to your Meteor developer account | +| `mlo` | `meteor logout` | Log out of your Meteor developer account | +| `mlog` | `meteor logs` | Show logs for specified site | +| `mm` | `meteor mongo` | Connect to the Mongo database for the specified site | +| `mp` | `meteor publish` | Publish a new version of a package to the package server | +| `mpa` | `meteor publish-for-arch` | Builds an already-published package for a new platform | +| `mpr` | `meteor publish-release` | Publish a new meteor release to the package server | +| `mr` | `meteor remove` | Remove a package from this project | +| `mrp` | `meteor remove-platform` | Remove a platform from this project | +| `mre` | `meteor reset` | Reset the project state. Erases the local database | +| `m` | `meteor run` | **[default]** Run this project in local development mode | +| `ms` | `meteor search` | Search through the package server database | +| `msh` | `meteor shell` | Launch a Node REPL for interactively evaluating server-side code | +| `msw` | `meteor show` | Show detailed information about a release or package | +| `mt` | `meteor test-packages` | Test one or more packages | +| `mu` | `meteor update` | Upgrade this project's dependencies to their latest versions | +| `mw` | `meteor whoami` | Prints the username of your Meteor developer account | diff --git a/oh-my-zsh/plugins/meteor/_meteor b/oh-my-zsh/plugins/meteor/_meteor @@ -0,0 +1,48 @@ +#compdef meteor +#autoload + +# Meteor Autocomplete plugin for Oh-My-Zsh, based on homebrew completion +# Original author: Dimitri JORGE (https://github.com/jorge-d) + +_meteor_all_packages() { + packages=(`meteor list | cut -d" " -f1`) +} +_meteor_installed_packages() { + installed_packages=(`meteor list --using`) +} + +local -a _1st_arguments +_1st_arguments=( + 'run:[Default] Run this project in local development mode' + 'create:Create a new project' + 'update:Upgrade this project to the latest version of Meteor' + 'add:Add a package to this project' + 'remove:Remove a package from this project' + 'list:List available packages' + 'help:Display Meteor help' + 'bundle:Pack this project up into a tarball' + 'mongo:Connect to the Mongo database for the specified site' + 'deploy:Deploy this project to Meteor' + 'logs:Show logs for specified site' + 'reset:Reset the project state. Erases the local database.' + 'test-packages:Test one or more packages' +) + +local expl +local -a packages installed_packages + +if (( CURRENT == 2 )); then + _describe -t commands "meteor subcommand" _1st_arguments + return +fi + +case "$words[2]" in + help) + _describe -t commands "meteor subcommand" _1st_arguments ;; + remove) + _meteor_installed_packages + _wanted installed_packages expl 'installed packages' compadd -a installed_packages ;; + add) + _meteor_all_packages + _wanted packages expl 'all packages' compadd -a packages ;; +esac+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/meteor/meteor.plugin.zsh b/oh-my-zsh/plugins/meteor/meteor.plugin.zsh @@ -0,0 +1,33 @@ +# Aliases in alphabetical order + +alias ma='meteor add' # Add a package to this project. +alias map='meteor add-platform' # Add a platform to this project. +alias mad='meteor admin' # Administrative commands. +alias mau='meteor authorized' # View or change authorized users and organizations for a site. +alias mb='meteor build' # Build this project for all platforms. +alias mcl='meteor claim' # Claim a site deployed with an old Meteor version. +alias mca='meteor configure-android' # Run the Android configuration tool from Meteor's ADK environment. +alias mc='meteor create' # Create a new project. +alias mdb='meteor debug' # Run the project, but suspend the server process for debugging. +alias mde='meteor deploy' # Deploy this project to Meteor. +alias mis='meteor install-sdk' # Installs SDKs for a platform. +alias ml='meteor list' # List the packages explicitly used by your project. +alias mlp='meteor list-platforms' # List the platforms added to your project. +alias mls='meteor list-sites' # List sites for which you are authorized. +alias mli='meteor login' # Log in to your Meteor developer account. +alias mlo='meteor logout' # Log out of your Meteor developer account. +alias mlog='meteor logs' # Show logs for specified site. +alias mm='meteor mongo' # Connect to the Mongo database for the specified site. +alias mp='meteor publish' # Publish a new version of a package to the package server. +alias mpa='meteor publish-for-arch' # Builds an already-published package for a new platform. +alias mpr='meteor publish-release' # Publish a new meteor release to the package server. +alias mr='meteor remove' # Remove a package from this project. +alias mrp='meteor remove-platform' # Remove a platform from this project. +alias mre='meteor reset' # Reset the project state. Erases the local database. +alias m='meteor run' # [default] Run this project in local development mode. +alias ms='meteor search' # Search through the package server database. +alias msh='meteor shell' # Launch a Node REPL for interactively evaluating server-side code. +alias msw='meteor show' # Show detailed information about a release or package. +alias mt='meteor test-packages' # Test one or more packages. +alias mu='meteor update' # Upgrade this project's dependencies to their latest versions. +alias mw='meteor whoami' # Prints the username of your Meteor developer account. diff --git a/oh-my-zsh/plugins/mix-fast/README.md b/oh-my-zsh/plugins/mix-fast/README.md @@ -0,0 +1,28 @@ +# mix-fast + +Fast mix autocompletion plugin. + +This script caches the output for later usage and significantly speeds it up. +It generates a .mix_tasks cache file for current project. Currently if you want +to update cache you should remove .mix_tasks file + +Inspired by and based on rake-fast zsh plugin. + +This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/), which is inspired by [this Ruby on Rails trick from 2006](http://weblog.rubyonrails.org/2006/3/9/fast-mix-task-completion-for-zsh/). + + +## Installation + +Just add the plugin to your `.zshrc`: + +```bash +plugins=(foo bar mix-fast) +``` + +You might consider adding `.mix_tasks` to your [global .gitignore](https://help.github.com/articles/ignoring-files#global-gitignore) + +## Usage + +`mix`, then press tab + +Currently maintained by [styx](https://github.com/styx/)+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/mix-fast/mix-fast.plugin.zsh b/oh-my-zsh/plugins/mix-fast/mix-fast.plugin.zsh @@ -0,0 +1,29 @@ +_mix_refresh () { + if [ -f .mix_tasks ]; then + rm .mix_tasks + fi + echo "Generating .mix_tasks..." > /dev/stderr + _mix_generate + cat .mix_tasks +} + +_mix_does_task_list_need_generating () { + [ ! -f .mix_tasks ]; +} + +_mix_generate () { + mix --help | grep -v 'iex -S' | tail -n +2 | cut -d " " -f 2 > .mix_tasks +} + +_mix () { + if [ -f mix.exs ]; then + if _mix_does_task_list_need_generating; then + echo "\nGenerating .mix_tasks..." > /dev/stderr + _mix_generate + fi + compadd `cat .mix_tasks` + fi +} + +compdef _mix mix +alias mix_refresh='_mix_refresh' diff --git a/oh-my-zsh/plugins/mix/_mix b/oh-my-zsh/plugins/mix/_mix @@ -0,0 +1,111 @@ +#compdef mix +#autoload + +# Elixir mix zsh completion + +local -a _1st_arguments +_1st_arguments=( + 'app.start:Start all registered apps' + 'archive:List all archives' + 'archive.build:Archive this project into a .ez file' + 'archive.install:Install an archive locally' + 'archive.uninstall:Uninstall archives' + 'clean:Delete generated application files' + 'cmd:Executes the given command' + 'compile:Compile source files' + 'compile.protocols:Consolidates all protocols in all paths' + 'deps:List dependencies and their status' + "deps.clean:Remove the given dependencies' files" + 'deps.compile:Compile dependencies' + 'deps.get:Get all out of date dependencies' + 'deps.unlock:Unlock the given dependencies' + 'deps.update:Update the given dependencies' + 'do:Executes the tasks separated by comma' + 'escript.build:Builds an escript for the project' + 'help:Print help information for tasks' + 'hex:Print hex help information' + 'hex.config:Read or update hex config' + 'hex.docs:Publish docs for package' + 'hex.info:Print hex information' + 'hex.key:Hex API key tasks' + 'hex.outdated:Shows outdated hex deps for the current project' + 'hex.owner:Hex package ownership tasks' + 'hex.publish:Publish a new package version' + 'hex.search:Search for package names' + 'hex.user:Hex user tasks' + 'loadconfig:Loads and persists the given configuration' + 'local:List local tasks' + 'local.hex:Install hex locally' + 'local.phoenix:Updates Phoenix locally' + 'local.phx:Updates the Phoenix project generator locally' + 'local.rebar:Install rebar locally' + 'new:Create a new Elixir project' + 'phoenix.digest:Digests and compress static files' + 'phoenix.gen.channel:Generates a Phoenix channel' + 'phoenix.gen.html:Generates controller, model and views for an HTML based resource' + 'phoenix.gen.json:Generates a controller and model for a JSON based resource' + 'phoenix.gen.model:Generates an Ecto model' + 'phoenix.gen.secret:Generates a secret' + 'phoenix.new:Creates a new Phoenix v1.2.1 application' + 'phoenix.routes:Prints all routes' + 'phoenix.server:Starts applications and their servers' + 'phx.digest:Digests and compresses static files' + 'phx.digest.clean:Removes old versions of static assets.' + 'phx.gen.channel:Generates a Phoenix channel' + 'phx.gen.context:Generates a context with functions around an Ecto schema' + 'phx.gen.embedded:Generates an embedded Ecto schema file' + 'phx.gen.html:Generates controller, views, and context for an HTML resource' + 'phx.gen.json:Generates controller, views, and context for a JSON resource' + 'phx.gen.presence:Generates a Presence tracker' + 'phx.gen.schema:Generates an Ecto schema and migration file' + 'phx.gen.secret:Generates a secret' + 'phx.new:Creates a new Phoenix v1.3.0 application' + 'phx.new.ecto:Creates a new Ecto project within an umbrella project' + 'phx.new.web:Creates a new Phoenix web project within an umbrella project' + 'phx.routes:Prints all routes' + 'phx.server:Starts applications and their servers' + 'run:Run the given file or expression' + "test:Run a project's tests" + '--help:Describe available tasks' + '--version:Prints the Elixir version information' +) + +__task_list () +{ + local expl + declare -a tasks + + tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.presence phx.gen.schema phx.gen.secret phx.new phx.new.ecto phx.new.web phx.routes phx.server run test) + + _wanted tasks expl 'help' compadd $tasks +} + +local expl + +local curcontext="$curcontext" state line +typeset -A opt_args + +_arguments -C \ + ':command:->command' \ + '*::options:->options' + +case $state in + (command) + _describe -t commands "mix subcommand" _1st_arguments + return + ;; + + (options) + case $line[1] in + (help) + _arguments ':feature:__task_list' + ;; + (test) + _files + ;; + (run) + _files + ;; + esac + ;; +esac diff --git a/oh-my-zsh/plugins/mosh/mosh.plugin.zsh b/oh-my-zsh/plugins/mosh/mosh.plugin.zsh @@ -0,0 +1,2 @@ +# Allow SSH tab completion for mosh hostnames +compdef mosh=ssh diff --git a/oh-my-zsh/plugins/mvn/README.md b/oh-my-zsh/plugins/mvn/README.md @@ -0,0 +1,34 @@ +## Introduction + +The [mvn plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/mvn) provides many +[useful aliases](#aliases) as well as completion for the `mvn` command. + +Enable it by adding `mvn` to the plugins array in your zshrc file: +```zsh +plugins=(... mvn) +``` + +## Aliases + +| Alias | Command | +|:---------------------|:------------------------------------------------| +| `mvncie` | `mvn clean install eclipse:eclipse` | +| `mvnci` | `mvn clean install` | +| `mvncist` | `mvn clean install -DskipTests` | +| `mvncisto` | `mvn clean install -DskipTests --offline` | +| `mvne` | `mvn eclipse:eclipse` | +| `mvncv` | `mvn clean verify` | +| `mvnd` | `mvn deploy` | +| `mvnp` | `mvn package` | +| `mvnc` | `mvn clean` | +| `mvncom` | `mvn compile` | +| `mvnct` | `mvn clean test` | +| `mvnt` | `mvn test` | +| `mvnag` | `mvn archetype:generate` | +| `mvn-updates` | `mvn versions:display-dependency-updates` | +| `mvntc7` | `mvn tomcat7:run` | +| `mvnjetty` | `mvn jetty:run` | +| `mvndt` | `mvn dependency:tree` | +| `mvns` | `mvn site` | +| `mvnsrc` | `mvn dependency:sources` | +| `mvndocs` | `mvn dependency:resolve -Dclassifier=javadoc` | diff --git a/oh-my-zsh/plugins/mvn/mvn.plugin.zsh b/oh-my-zsh/plugins/mvn/mvn.plugin.zsh @@ -0,0 +1,276 @@ +# mvn-color based on https://gist.github.com/1027800 +BOLD=$(tput bold) +UNDERLINE_ON=$(tput smul) +UNDERLINE_OFF=$(tput rmul) +TEXT_BLACK=$(tput setaf 0) +TEXT_RED=$(tput setaf 1) +TEXT_GREEN=$(tput setaf 2) +TEXT_YELLOW=$(tput setaf 3) +TEXT_BLUE=$(tput setaf 4) +TEXT_MAGENTA=$(tput setaf 5) +TEXT_CYAN=$(tput setaf 6) +TEXT_WHITE=$(tput setaf 7) +BACKGROUND_BLACK=$(tput setab 0) +BACKGROUND_RED=$(tput setab 1) +BACKGROUND_GREEN=$(tput setab 2) +BACKGROUND_YELLOW=$(tput setab 3) +BACKGROUND_BLUE=$(tput setab 4) +BACKGROUND_MAGENTA=$(tput setab 5) +BACKGROUND_CYAN=$(tput setab 6) +BACKGROUND_WHITE=$(tput setab 7) +RESET_FORMATTING=$(tput sgr0) + + +# Wrapper function for Maven's mvn command. +mvn-color() { + ( + # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations + unset LANG + LC_CTYPE=C mvn "$@" | sed -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \ + -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \ + -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g" + + # Make sure formatting is reset + echo -ne "${RESET_FORMATTING}" + ) +} + +# Override the mvn command with the colorized one. +#alias mvn="mvn-color" + +# aliases +alias mvncie='mvn clean install eclipse:eclipse' +alias mvnci='mvn clean install' +alias mvncist='mvn clean install -DskipTests' +alias mvncisto='mvn clean install -DskipTests --offline' +alias mvne='mvn eclipse:eclipse' +alias mvnce='mvn clean eclipse:clean eclipse:eclipse' +alias mvncv='mvn clean verify' +alias mvnd='mvn deploy' +alias mvnp='mvn package' +alias mvnc='mvn clean' +alias mvncom='mvn compile' +alias mvnct='mvn clean test' +alias mvnt='mvn test' +alias mvnag='mvn archetype:generate' +alias mvn-updates='mvn versions:display-dependency-updates' +alias mvntc7='mvn tomcat7:run' +alias mvntc='mvn tomcat:run' +alias mvnjetty='mvn jetty:run' +alias mvndt='mvn dependency:tree' +alias mvns='mvn site' +alias mvnsrc='mvn dependency:sources' +alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' + +function listMavenCompletions { + reply=( + # common lifecycle + clean process-resources compile process-test-resources test-compile test integration-test package verify install deploy site + + # common plugins + deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt + + # deploy + deploy:deploy-file + # failsafe + failsafe:integration-test failsafe:verify + # install + install:install-file install:help + # site + site:site site:deploy site:run site:stage site:stage-deploy site:attach-descriptor site:jar site:effective-site + # surefire + surefire:test + + # checkstyle + checkstyle:checkstyle checkstyle:check checkstyle:checkstyle-aggregate + # javadoc + javadoc:javadoc javadoc:test-javadoc javadoc:javadoc-no-fork javadoc:test-javadoc-no-fork javadoc:aggregate javadoc:test-aggregate javadoc:jar javadoc:test-jar javadoc:aggregate-jar javadoc:test-aggregate-jar javadoc:fix javadoc:test-fix javadoc:resource-bundle javadoc:test-resource-bundle + # jxr + jxr:jxr jxr:aggregate jxr:test-jxr jxr:test-aggregate + # pmd + pmd:pmd pmd:cpd pmd:check pmd:cpd-check + + # ant + ant:ant ant:clean + # antrun + antrun:run + # archetype + archetype:generate archetype:create-from-project archetype:crawl + # assembly + assembly:single assembly:assembly + # dependency + dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:analyze-duplicate dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:display-ancestors dependency:get dependency:go-offline dependency:list dependency:list-repositories dependency:properties dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies + # enforcer + enforcer:enforce enforcer:display-info + # gpg + gpg:sign gpg:sign-and-deploy-file + # help + help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system + # release + release:clean release:prepare release:prepare-with-pom release:rollback release:perform release:stage release:branch release:update-versions + # jgitflow + jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number + # repository + repository:bundle-create repository:bundle-pack + # source + source:aggregate source:jar source:jar-no-fork source:test-jar source:test-jar-no-fork + + # eclipse + eclipse:clean eclipse:eclipse + # idea + idea:clean idea:idea + + # jetty + jetty:run jetty:run-exploded + # cargo + cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help + # jboss + jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy + # tomcat + tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:redeploy + # tomcat6 + tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy + # tomcat7 + tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy + # tomee + tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy + # spring-boot + spring-boot:run spring-boot:repackage + # exec + exec:exec exec:java + # versions + versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert + # scm + scm:add scm:bootstrap scm:branch scm:changelog scm:check-local-modification scm:checkin scm:checkout scm:diff scm:edit scm:export scm:list scm:remove scm:status scm:tag scm:unedit scm:update scm:update-subprojects scm:validate + # buildnumber + buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset + + # war + war:war war:exploded war:inplace war:manifest + # ear + ear:ear ear:generate-application-xml + # ejb + ejb:ejb + # android + android:apk android:apklib android:deploy android:deploy-dependencies android:dex android:emulator-start android:emulator-stop android:emulator-stop-all android:generate-sources android:help android:instrument android:manifest-update android:pull android:push android:redeploy android:run android:undeploy android:unpack android:version-update android:zipalign android:devices + # nexus + nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download + # repository + repository:bundle-create repository:bundle-pack repository:help + + # sonar + sonar:sonar + # license + license:format license:check + # hibernate3 + hibernate3:hbm2ddl hibernate3:help + # liquibase + liquibase:changelogSync liquibase:changelogSyncSQL liquibase:clearCheckSums liquibase:dbDoc liquibase:diff liquibase:dropAll liquibase:help liquibase:migrate liquibase:listLocks liquibase:migrateSQL liquibase:releaseLocks liquibase:rollback liquibase:rollbackSQL liquibase:status liquibase:tag liquibase:update liquibase:updateSQL liquibase:updateTestingRollback + # flyway + flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate + # gwt + gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test + # asciidoctor + asciidoctor:process-asciidoc asciidoctor:auto-refresh asciidoctor:http asciidoctor:zip + # compiler + compiler:compile compiler:testCompile + # resources + resources:resources resources:testResources resources:copy-resources + # verifier + verifier:verify + # jar + jar:jar jar:test-jar + # rar + rar:rar + # acr + acr:acr + # shade + shade:shade + # changelog + changelog:changelog changelog:dev-activity changelog:file-activity + # changes + changes:announcement-mail changes:announcement-generate changes:changes-check changes:changes-validate changes:changes-report changes:jira-report changes:trac-report changes:github-report + # doap + doap:generate + # docck + docck:check + # jdeps + jdeps:jdkinternals jdeps:test-jdkinternals + # linkcheck + linkcheck:linkcheck + # project-info-reports + project-info-reports:cim project-info-reports:dependencies project-info-reports:dependency-convergence project-info-reports:dependency-info project-info-reports:dependency-management project-info-reports:distribution-management project-info-reports:help project-info-reports:index project-info-reports:issue-tracking project-info-reports:license project-info-reports:mailing-list project-info-reports:modules project-info-reports:plugin-management project-info-reports:plugins project-info-reports:project-team project-info-reports:scm project-info-reports:summary + # surefire-report + surefire-report:failsafe-report-only surefire-report:report surefire-report:report-only + # invoker + invoker:install invoker:integration-test invoker:verify invoker:run + # jarsigner + jarsigner:sign jarsigner:verify + # patch + patch:apply + # pdf + pdf:pdf + # plugin + plugin:descriptor plugin:report plugin:updateRegistry plugin:addPluginArtifactMetadata plugin:helpmojo + # remote-resources + remote-resources:bundle remote-resources:process + # scm-publish + scm-publish:help scm-publish:publish-scm scm-publish:scmpublish + # stage + stage:copy + # toolchain + toolchain:toolchain + + # options + "-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile=" + + # arguments + -am --also-make + -amd --also-make-dependents-am + -B --batch-mode + -b --builder + -C --strict-checksums + -c --lax-checksums + -cpu --check-plugin-updates + -D --define + -e --errors + -emp --encrypt-master-password + -ep --encrypt-password + -f --file + -fae --fail-at-end + -ff --fail-fast + -fn --fail-never + -gs --global-settings + -gt --global-toolchains + -h --help + -l --log-file + -llr --legacy-local-repository + -N --non-recursive + -npr --no-plugin-registry + -npu --no-plugin-updates + -nsu --no-snapshot-updates + -o --offline + -P --activate-profiles + -pl --projects + -q --quiet + -rf --resume-from + -s --settings + -t --toolchains + -T --threads + -U --update-snapshots + -up --update-plugins + -v --version + -V --show-version + -X --debug + + cli:execute cli:execute-phase + archetype:generate generate-sources + cobertura:cobertura + -Dtest=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi) + -Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi) + ); +} + +compctl -K listMavenCompletions mvn diff --git a/oh-my-zsh/plugins/mysql-macports/mysql-macports.plugin.zsh b/oh-my-zsh/plugins/mysql-macports/mysql-macports.plugin.zsh @@ -0,0 +1,8 @@ +# commands to control local mysql-server installation +# paths are for osx installation via macports + +alias mysqlstart='sudo /opt/local/share/mysql5/mysql/mysql.server start' +alias mysqlstop='sudo /opt/local/share/mysql5/mysql/mysql.server stop' +alias mysqlrestart='sudo /opt/local/share/mysql5/mysql/mysql.server restart' + +alias mysqlstatus='mysqladmin5 -u root -p ping' diff --git a/oh-my-zsh/plugins/n98-magerun/n98-magerun.plugin.zsh b/oh-my-zsh/plugins/n98-magerun/n98-magerun.plugin.zsh @@ -0,0 +1,34 @@ +# ------------------------------------------------------------------------------ +# FILE: n98-magerun.plugin.zsh +# DESCRIPTION: oh-my-zsh n98-magerun plugin file. Adapted from composer plugin +# AUTHOR: Andrew Dwyer (andrewrdwyer at gmail dot com) +# VERSION: 1.0.0 +# ------------------------------------------------------------------------------ + +# n98-magerun basic command completion +_n98_magerun_get_command_list () { + $_comp_command1 --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z\-:]+/ { print $1 }' +} + + +_n98_magerun () { + _arguments '1: :->command' '*:optional arg:_files' + + case $state in + command) + compadd $(_n98_magerun_get_command_list) + ;; + *) + esac +} + +compdef _n98_magerun n98-magerun.phar +compdef _n98_magerun n98-magerun + +# Aliases +alias n98='n98-magerun.phar' +alias mage='n98-magerun.phar' +alias magefl='n98-magerun.phar cache:flush' + +# Install n98-magerun into the current directory +alias mage-get='wget https://raw.github.com/netz98/n98-magerun/master/n98-magerun.phar' diff --git a/oh-my-zsh/plugins/nanoc/_nanoc b/oh-my-zsh/plugins/nanoc/_nanoc @@ -0,0 +1,44 @@ +#compdef nanoc +#autoload + +# nanoc zsh completion - based on the homebrew zsh completion +# requires the 'nanoc' gem to be installed + +local -a _1st_arguments +_1st_arguments=( + 'autocompile:start the autocompiler' + 'compile:compile items of this site' + 'create-item:create an item' + 'create-layout:create a layout' + 'create-site:create a site' + 'deploy:deploy the compiled site' + 'help:show help' + 'prune:remove files not managed by nanoc from the output directory' + 'show-data:show data in this site' + 'show-plugins:show all available plugins' + 'show-rules:describe the rules for each item' + 'update:update the data stored by the data source to a newer version' + 'validate-css:validate the site’s CSS' + 'validate-html:validate the site’s HTML' + 'validate-links:validate links in site' + 'view:start the web server that serves static files' + 'watch:start the watcher' +) + +local expl +local -a pkgs installed_pkgs + +_arguments \ + '(--color)--color[enable color]' \ + '(--debug)--debug[enable debugging]' \ + '(--help)--help[show the help message and quit]' \ + '(--no-color)--no-color[disable color]' \ + '(--verbose)--verbose[make nanoc output more detailed]' \ + '(--version)--version[show version information and quit]' \ + '(--warn)--warn[enable warnings]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "nanoc subcommand" _1st_arguments + return +fi diff --git a/oh-my-zsh/plugins/nanoc/nanoc.plugin.zsh b/oh-my-zsh/plugins/nanoc/nanoc.plugin.zsh @@ -0,0 +1,9 @@ +alias n='nanoc' +alias na='nanoc autocompile' +alias nco='nanoc compile' +alias nci='nanoc create_item' +alias ncl='nanoc create_layout' +alias ncs='nanoc create_site' +alias nd='nanoc deploy' +alias nv='nanoc view' +alias nw='nanoc watch' diff --git a/oh-my-zsh/plugins/ng/README.md b/oh-my-zsh/plugins/ng/README.md @@ -0,0 +1,37 @@ +## NG Plugin + +This [ng plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/ng) + adds completion support for Angular's CLI (named ng). + +Ng is hosted on [ng home](https://github.com/catull/angular-cli) + +It is used to generate Angular 2 app "stubs", build those apps, configure them, +test them, lint them etc. + +Ahem, "stubs" is not what Angular engineers refer to the items ng can generate +for you. + +"Stubs" can be any one of: +- class +- component +- directive +- enum +- module +- pipe +- route +- service + +At the moment, `ng completion` creates a very rough completion for Zsh and +Bash. + +It is missing most of the options and a few arguments. +In future, this plugin may be shortened to simply being + +```zsh +eval `ng completion` +``` + +There is hope this materialises in the 21st century. + +### CONTRIBUTOR + - Carlo Dapor ([catull](https://github.com/catull)) diff --git a/oh-my-zsh/plugins/ng/ng.plugin.zsh b/oh-my-zsh/plugins/ng/ng.plugin.zsh @@ -0,0 +1,77 @@ + +ng_opts='addon asset-sizes b build completion d destroy doc e2e g generate get github-pages:deploy gh-pages:deploy h help i init install lint make-this-awesome new s serve server set t test v version -h --help' + +_ng_completion () { + local words cword opts + read -Ac words + read -cn cword + let cword-=1 + + case $words[cword] in + addon ) + opts='-b --blueprint -d -dir --directory --dry-run -sb --skip-bower -sg --skip-git -sn --skip-npm -v --verbose' + ;; + + asset-sizes ) + opts='-o --output-path' + ;; + + b | build ) + opts='--environment --output-path --suppress-sizes --target --watch --watcher -dev -e -prod' + ;; + + d | destroy ) + opts='--dry-run --verbose --pod --classic --dummy --in-repo --in-repo-addon -d -v -p -c -dum -id -ir' + ;; + + g | generate ) + opts='class component directive enum module pipe route service --generate -d --dry-run --verbose -v --pod -p --classic -c --dummy -dum -id --in-repo --in-repo-addon -ir' + ;; + + gh-pages:deploy | github-pages:deploy ) + opts='--environment --gh-token --gh-username --skip-build --user-page --message' + ;; + + h | help | -h | --help) + opts='--json --verbose -v' + ;; + + init ) + opts='--blueprint --dry-run --link-cli --mobile --name --prefix --skip-bower --skip-npm --source-dir --style --verbose -b -d -lc -n -p -sb -sd -sn -v' + ;; + + new ) + opts='--blueprint --directory --dry-run --link-cli --mobile --prefix --skip-bower --skip-git --skip-npm --source-dir --style --verbose -b -d -dir -lc -p -sb -sd -sg -sn -v' + ;; + + s | serve | server ) + opts='--environment --host --insecure-proxy --inspr --live-reload --live-reload-base-url --live-reload-host --live-reload-live-css --live-reload-port --output-path --port --proxy --ssl --ssl-cert --ssl-key --target --watcher -H -dev -e -lr -lrbu -lrh -lrp -op -out -p -pr -prod -pxy -t -w' + ;; + + set ) + opts='--global -g' + ;; + + t | test ) + opts='--browsers --colors --config-file --environment --filter --host --launch --log-level --module --path --port --query --reporter --server --silent --test-page --test-port --watch -H -c -cf -e -f -m -r -s -tp -w' + ;; + + v | version ) + opts='--verbose' + ;; + + ng ) + opts=$ng_opts + ;; + + * ) + opts='' + ;; + esac + + setopt shwordsplit + reply=($opts) + unset shwordsplit +} + +compctl -K _ng_completion ng diff --git a/oh-my-zsh/plugins/nmap/README.md b/oh-my-zsh/plugins/nmap/README.md @@ -0,0 +1,37 @@ +# Nmap aliases plugin + +Adds some useful aliases for nmap similar to the profiles in zenmap. + +Nmap options are: + * -sS - TCP SYN scan + * -v - verbose + * -T1 - timing of scan. Options are paranoid (0), sneaky (1), polite (2), normal (3), aggressive (4), and insane (5) + * -sF - FIN scan (can sneak through non-stateful firewalls) + * -PE - ICMP echo discovery probe + * -PP - timestamp discovery probe + * -PY - SCTP init ping + * -g - use given number as source port + * -A - enable OS detection, version detection, script scanning, and traceroute (aggressive) + * -O - enable OS detection + * -sA - TCP ACK scan + * -F - fast scan + * --script=vulscan - also access vulnerabilities in target + +## Aliases explained + + * nmap_open_ports - Scan for open ports on target + * nmap_list_interfaces - List all network interfaces on host where the command runs + * nmap_slow - Slow scan that avoids to spam the targets logs + * nmap_fin - Scan to see if hosts are up with TCP FIN scan + * nmap_full - Aggressive full scan that scans all ports, tries to determine OS and service versions + * nmap_check_for_firewall - TCP ACK scan to check for firewall existence + * nmap_ping_through_firewall - Host discovery with SYN and ACK probes instead of just pings to avoid firewall + restrictions + * nmap_fast - Fast scan of the top 300 popular ports + * nmap_detect_versions - Detects versions of services and OS, runs on all ports + * nmap_check_for_vulns - Uses vulscan script to check target services for vulnerabilities + * nmap_full_udp - Same as full but via UDP + * nmap_traceroute - Try to traceroute using the most common ports + * nmap_full_with_scripts - Same as nmap_full but also runs all the scripts + * nmap_web_safe_osscan - Little "safer" scan for OS version as connecting to only HTTP and HTTPS ports doesn't look so attacking. + diff --git a/oh-my-zsh/plugins/nmap/nmap.plugin.zsh b/oh-my-zsh/plugins/nmap/nmap.plugin.zsh @@ -0,0 +1,32 @@ +# Some useful nmap aliases for scan modes + +# Nmap options are: +# -sS - TCP SYN scan +# -v - verbose +# -T1 - timing of scan. Options are paranoid (0), sneaky (1), polite (2), normal (3), aggressive (4), and insane (5) +# -sF - FIN scan (can sneak through non-stateful firewalls) +# -PE - ICMP echo discovery probe +# -PP - timestamp discovery probe +# -PY - SCTP init ping +# -g - use given number as source port +# -A - enable OS detection, version detection, script scanning, and traceroute (aggressive) +# -O - enable OS detection +# -sA - TCP ACK scan +# -F - fast scan +# --script=vulscan - also access vulnerabilities in target + +alias nmap_open_ports="nmap --open" +alias nmap_list_interfaces="nmap --iflist" +alias nmap_slow="nmap -sS -v -T1" +alias nmap_fin="nmap -sF -v" +alias nmap_full="nmap -sS -T4 -PE -PP -PS80,443 -PY -g 53 -A -p1-65535 -v" +alias nmap_check_for_firewall="nmap -sA -p1-65535 -v -T4" +alias nmap_ping_through_firewall="nmap -PS -PA" +alias nmap_fast="nmap -F -T5 --version-light --top-ports 300" +alias nmap_detect_versions="nmap -sV -p1-65535 -O --osscan-guess -T4 -Pn" +alias nmap_check_for_vulns="nmap --script=vulscan" +alias nmap_full_udp="nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443,3389 " +alias nmap_traceroute="nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute " +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 " +alias nmap_web_safe_osscan="sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy " + diff --git a/oh-my-zsh/plugins/node/node.plugin.zsh b/oh-my-zsh/plugins/node/node.plugin.zsh @@ -0,0 +1,6 @@ +# Open the node api for your current version to the optional section. +# TODO: Make the section part easier to use. +function node-docs { + local section=${1:-all} + open_command "https://nodejs.org/docs/$(node --version)/api/$section.html" +} diff --git a/oh-my-zsh/plugins/nomad/README.md b/oh-my-zsh/plugins/nomad/README.md @@ -0,0 +1,15 @@ +# Nomad + +The `nomad` plugin provides a simple autocompletion for [Nomad](https://nomadproject.io/), a tool from Hashicorp for easily deploy applications at any scale. + +## Usage + +1. Enable the `nomad` plugin: + + ```zsh + plugins=(... nomad) + ``` + +2. Install [Nomad](https://nomadproject.io/) + +3. Type `nomad` into your prompt and hit `TAB` to see available completion options. diff --git a/oh-my-zsh/plugins/nomad/_nomad b/oh-my-zsh/plugins/nomad/_nomad @@ -0,0 +1,153 @@ +#compdef nomad + +local -a _nomad_cmds +_nomad_cmds=( + 'agent:Runs a Nomad agent' + 'agent-info:Display status information about the local agent' + 'alloc-status:Display allocation status information and metadata' + 'client-config:View or modify client configuration details' + 'eval-status:Display evaluation status and placement failure reasons' + 'fs:Inspect the contents of an allocation directory' + 'init:Create an example job file' + 'inspect:Inspect a submitted job' + 'logs:Streams the logs of a task.' + 'node-drain:Toggle drain mode on a given node' + 'node-status:Display status information about nodes' + 'plan:Dry-run a job update to determine its effects' + 'run:Run a new job or update an existing' + 'server-force-leave:Force a server into the left state' + 'server-join:Join server nodes together' + 'server-members:Display a list of known servers and their' + 'status:Display status information about jobs' + 'stop:Stop a running job' + 'validate:Checks if a given job specification is valid' + 'version:Prints the Nomad version' +) + +__allocstatus() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-short[Display short output. Shows only the most recent task event.]' \ + '-stats[Display detailed resource usage statistics.]' \ + '-verbose[Show full information.]' \ + '-json[Output the allocation in its JSON format.]' \ + '-t[Format and display allocation using a Go template.]' +} + +__evalstatus() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-monitor[Monitor an outstanding evaluation.]' \ + '-verbose[Show full information.]' \ + '-json[Output the allocation in its JSON format.]' \ + '-t[Format and display allocation using a Go template.]' +} + +__inspect() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-json[Output the allocation in its JSON format.]' \ + '-t[Format and display allocation using a Go template.]' +} + +__logs() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-stderr[ Display stderr logs.]' \ + '-job[<job-id> Use a random allocation from the specified job ID.]' \ + '-verbose[Show full information.]' \ + '-f[Causes the output to not stop when the end of the logs are reached, but rather to wait for additional output.]' \ + '-tail[Show the logs contents with offsets relative to the end of the logs. If no offset is given, -n is defaulted to 10.]' \ + '-n[Sets the tail location in best-efforted number of lines relative to the end of the logs.]' \ + '-c[Sets the tail location in number of bytes relative to the end of the logs.]' +} + +__nodestatus() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-self[Query the status of the local node.]' \ + '-allocs[ Display a count of running allocations for each node.]' \ + '-short[Display short output. Shows only the most recent task event.]' \ + '-stats[Display detailed resource usage statistics.]' \ + '-verbose[Show full information.]' \ + '-json[Output the allocation in its JSON format.]' \ + '-t[Format and display allocation using a Go template.]' +} + +__plan() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-diff[Determines whether the diff between the remote job and planned job is shown. Defaults to true.]' +} + +__run() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-check-index[If set, the job is only registered or updated if the the passed job modify index matches the server side version. If a check-index value of zero is passed, the job is only registered if it does not yet exist. If a non-zero value is passed, it ensures that the job is being updated from a known state. The use of this flag is most common in conjunction with plan command.]' \ + '-detach[Return immediately instead of entering monitor mode. After job submission, the evaluation ID will be printed to the screen, which can be used to examine the evaluation using the eval-status command.]' \ + '-output[Output the JSON that would be submitted to the HTTP API without submitting the job.]' \ + '-verbose[Show full information.]' +} + +__status() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-short[Display short output. Shows only the most recent task event.]' \ + '-evals[Display the evaluations associated with the job.]' \ + '-verbose[Show full information.]' +} + +__stop() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-detach[Return immediately instead of entering monitor mode. After the deregister command is submitted, a new evaluation ID is printed to the screen, which can be used to examine the evaluation using the eval-status command.]' \ + '-yes[Automatic yes to prompts.]' \ + '-verbose[Show full information.]' +} + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "nomad command" _nomad_cmds + return +fi + +local -a _command_args +case "$words[1]" in + alloc-status) + __allocstatus ;; + eval-status) + __evalstatus ;; + inspect) + __inspect ;; + logs) + __logs ;; + node-status) + __nodestatus ;; + plan) + __plan ;; + run) + __run ;; + status) + __status ;; + stop) + __stop ;; +esac diff --git a/oh-my-zsh/plugins/npm/npm.plugin.zsh b/oh-my-zsh/plugins/npm/npm.plugin.zsh @@ -0,0 +1,54 @@ +(( $+commands[npm] )) && { + __NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion" + + if [[ ! -f $__NPM_COMPLETION_FILE ]]; then + npm completion >! $__NPM_COMPLETION_FILE 2>/dev/null + [[ $? -ne 0 ]] && rm -f $__NPM_COMPLETION_FILE + fi + + [[ -f $__NPM_COMPLETION_FILE ]] && source $__NPM_COMPLETION_FILE + + unset __NPM_COMPLETION_FILE +} + +# Install dependencies globally +alias npmg="npm i -g " + +# npm package names are lowercase +# Thus, we've used camelCase for the following aliases: + +# Install and save to dependencies in your package.json +# npms is used by https://www.npmjs.com/package/npms +alias npmS="npm i -S " + +# Install and save to dev-dependencies in your package.json +# npmd is used by https://github.com/dominictarr/npmd +alias npmD="npm i -D " + +# Execute command from node_modules folder based on current directory +# i.e npmE gulp +alias npmE='PATH="$(npm bin)":"$PATH"' + +# Check which npm modules are outdated +alias npmO="npm outdated" + +# Check package versions +alias npmV="npm -v" + +# List packages +alias npmL="npm list" + +# List top-level installed packages +alias npmL0="npm ls --depth=0" + +# Run npm start +alias npmst="npm start" + +# Run npm test +alias npmt="npm test" + +# Run npm scripts +alias npmR="npm run" + +# Run npm publish +alias npmP="npm publish"+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/npx/README.md b/oh-my-zsh/plugins/npx/README.md @@ -0,0 +1,17 @@ +# NPX Plugin +> npx(1) -- execute npm package binaries. ([more info](https://github.com/zkat/npx)) + +This plugin automatically registers npx command-not-found handler if `npx` exists in your `$PATH`. + +## Setup + +- Add plugin to `~/.zshrc` + +```bash +plugins=(.... npx) +``` + +- Globally install npx binary (you need node.js installed too!) +```bash +sudo npm install -g npx +```+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/npx/npx.plugin.zsh b/oh-my-zsh/plugins/npx/npx.plugin.zsh @@ -0,0 +1,7 @@ +# NPX Plugin +# https://www.npmjs.com/package/npx +# Maintainer: Pooya Parsa <pooya@pi0.ir> + +(( $+commands[npx] )) && { + source <(npx --shell-auto-fallback zsh) +} diff --git a/oh-my-zsh/plugins/nvm/_nvm b/oh-my-zsh/plugins/nvm/_nvm @@ -0,0 +1,26 @@ +#compdef nvm +#autoload + +[[ -f "$NVM_DIR/nvm.sh" ]] || return 0 + +local -a _1st_arguments +_1st_arguments=( + 'help:show help' + 'install:download and install a version' + 'uninstall:uninstall a version' + 'use:modify PATH to use version' + 'run:run version with given arguments' + 'ls:list installed versions or versions matching a given description' + 'ls-remote:list remote versions available for install' + 'deactivate:undo effects of NVM on current shell' + 'alias:show or set aliases' + 'unalias:deletes an alias' + 'copy-packages:install global NPM packages to current version' +) + +_arguments -C '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "nvm subcommand" _1st_arguments + return +fi+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/nvm/nvm.plugin.zsh b/oh-my-zsh/plugins/nvm/nvm.plugin.zsh @@ -0,0 +1,5 @@ +# Set NVM_DIR if it isn't already defined +[[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm" + +# Load nvm if it exists +[[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" diff --git a/oh-my-zsh/plugins/nyan/nyan.plugin.zsh b/oh-my-zsh/plugins/nyan/nyan.plugin.zsh @@ -0,0 +1,5 @@ +if [[ -x `which nc` ]]; then + alias nyan='nc -v nyancat.dakko.us 23' # nyan cat +fi + + diff --git a/oh-my-zsh/plugins/oc/oc.plugin.zsh b/oh-my-zsh/plugins/oc/oc.plugin.zsh @@ -0,0 +1,7 @@ +# Autocompletion for oc, the command line interface for OpenShift +# +# Author: https://github.com/kevinkirkup + +if [ $commands[oc] ]; then + source <(oc completion zsh) +fi diff --git a/oh-my-zsh/plugins/osx/README.md b/oh-my-zsh/plugins/osx/README.md @@ -0,0 +1,60 @@ +# OSX plugin + +## Description + +This plugin provides a few utilities to make it more enjoyable on OSX. + +To start using it, add the `osx` plugin to your plugins array in `~/.zshrc`: + +```zsh +plugins=(... osx) +``` + +Original author: [Sorin Ionescu](https://github.com/sorin-ionescu) + +## Acknowledgements + +This application makes use of the following third party scripts: + +[shpotify](https://github.com/hnarayanan/shpotify) + +Copyright (c) 2012–2017 [Harish Narayanan](https://harishnarayanan.org/). + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +## Commands + +| Command | Description | +| :-------------- | :----------------------------------------------- | +| `tab` | Open the current directory in a new tab | +| `split_tab` | Split the current terminal tab horizontally | +| `vsplit_tab` | Split the current terminal tab vertically | +| `ofd` | Open the current directory in a Finder window | +| `pfd` | Return the path of the frontmost Finder window | +| `pfs` | Return the current Finder selection | +| `cdf` | `cd` to the current Finder directory | +| `pushdf` | `pushd` to the current Finder directory | +| `quick-look` | Quick-Look a specified file | +| `man-preview` | Open a specified man page in Preview app | +| `showfiles` | Show hidden files | +| `hidefiles` | Hide the hidden files | +| `itunes` | Control iTunes. User `itunes -h` for usage details | +| `spotify` | Control Spotify and search by artist, album, track and etc.| diff --git a/oh-my-zsh/plugins/osx/osx.plugin.zsh b/oh-my-zsh/plugins/osx/osx.plugin.zsh @@ -0,0 +1,284 @@ +# Open the current directory in a Finder window +alias ofd='open_command $PWD' + +function _omz_osx_get_frontmost_app() { + local the_app=$( + osascript 2>/dev/null <<EOF + tell application "System Events" + name of first item of (every process whose frontmost is true) + end tell +EOF + ) + echo "$the_app" +} + +function tab() { + # Must not have trailing semicolon, for iTerm compatibility + local command="cd \\\"$PWD\\\"; clear" + (( $# > 0 )) && command="${command}; $*" + + local the_app=$(_omz_osx_get_frontmost_app) + + if [[ "$the_app" == 'Terminal' ]]; then + # Discarding stdout to quash "tab N of window id XXX" output + osascript >/dev/null <<EOF + tell application "System Events" + tell process "Terminal" to keystroke "t" using command down + end tell + tell application "Terminal" to do script "${command}" in front window +EOF + + elif [[ "$the_app" == 'iTerm' ]]; then + osascript <<EOF + tell application "iTerm" + set current_terminal to current terminal + tell current_terminal + launch session "Default Session" + set current_session to current session + tell current_session + write text "${command}" + end tell + end tell + end tell +EOF + + elif [[ "$the_app" == 'iTerm2' ]]; then + osascript <<EOF + tell application "iTerm2" + tell current window + create tab with default profile + tell current session to write text "${command}" + end tell + end tell +EOF + + else + echo "tab: unsupported terminal app: $the_app" + false + + fi +} + +function vsplit_tab() { + local command="cd \\\"$PWD\\\"; clear" + (( $# > 0 )) && command="${command}; $*" + + local the_app=$(_omz_osx_get_frontmost_app) + + if [[ "$the_app" == 'iTerm' ]]; then + osascript <<EOF + -- tell application "iTerm" to activate + + tell application "System Events" + tell process "iTerm" + tell menu item "Split Vertically With Current Profile" of menu "Shell" of menu bar item "Shell" of menu bar 1 + click + end tell + end tell + keystroke "${command} \n" + end tell +EOF + + elif [[ "$the_app" == 'iTerm2' ]]; then + osascript <<EOF + tell application "iTerm2" + tell current session of first window + set newSession to (split vertically with same profile) + tell newSession + write text "${command}" + select + end tell + end tell + end tell +EOF + + else + echo "$0: unsupported terminal app: $the_app" >&2 + false + + fi +} + +function split_tab() { + local command="cd \\\"$PWD\\\"; clear" + (( $# > 0 )) && command="${command}; $*" + + local the_app=$(_omz_osx_get_frontmost_app) + + if [[ "$the_app" == 'iTerm' ]]; then + osascript 2>/dev/null <<EOF + tell application "iTerm" to activate + + tell application "System Events" + tell process "iTerm" + tell menu item "Split Horizontally With Current Profile" of menu "Shell" of menu bar item "Shell" of menu bar 1 + click + end tell + end tell + keystroke "${command} \n" + end tell +EOF + + elif [[ "$the_app" == 'iTerm2' ]]; then + osascript <<EOF + tell application "iTerm2" + tell current session of first window + set newSession to (split horizontally with same profile) + tell newSession + write text "${command}" + select + end tell + end tell + end tell +EOF + + else + echo "$0: unsupported terminal app: $the_app" >&2 + false + + fi +} + +function pfd() { + osascript 2>/dev/null <<EOF + tell application "Finder" + return POSIX path of (target of window 1 as alias) + end tell +EOF +} + +function pfs() { + osascript 2>/dev/null <<EOF + set output to "" + tell application "Finder" to set the_selection to selection + set item_count to count the_selection + repeat with item_index from 1 to count the_selection + if item_index is less than item_count then set the_delimiter to "\n" + if item_index is item_count then set the_delimiter to "" + set output to output & ((item item_index of the_selection as alias)'s POSIX path) & the_delimiter + end repeat +EOF +} + +function cdf() { + cd "$(pfd)" +} + +function pushdf() { + pushd "$(pfd)" +} + +function quick-look() { + (( $# > 0 )) && qlmanage -p $* &>/dev/null & +} + +function man-preview() { + man -t "$@" | open -f -a Preview +} +compdef _man man-preview + +function vncviewer() { + open vnc://$@ +} + +# iTunes control function +function itunes() { + local opt=$1 + local playlist=$2 + shift + case "$opt" in + launch|play|pause|stop|rewind|resume|quit) + ;; + mute) + opt="set mute to true" + ;; + unmute) + opt="set mute to false" + ;; + next|previous) + opt="$opt track" + ;; + vol) + opt="set sound volume to $1" #$1 Due to the shift + ;; + playlist) + # Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f +if [[ ! -z "$playlist" ]]; then + osascript -e 'tell application "iTunes"' -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null; + if [[ $? -eq 0 ]]; then + opt="play" + else + opt="stop" + fi + else + opt="set allPlaylists to (get name of every playlist)" + fi + ;; + playing|status) + local state=`osascript -e 'tell application "iTunes" to player state as string'` + if [[ "$state" = "playing" ]]; then + currenttrack=`osascript -e 'tell application "iTunes" to name of current track as string'` + currentartist=`osascript -e 'tell application "iTunes" to artist of current track as string'` + echo -E "Listening to $fg[yellow]$currenttrack$reset_color by $fg[yellow]$currentartist$reset_color"; + else + echo "iTunes is" $state; + fi + return 0 + ;; + shuf|shuff|shuffle) + # The shuffle property of current playlist can't be changed in iTunes 12, + # so this workaround uses AppleScript to simulate user input instead. + # Defaults to toggling when no options are given. + # The toggle option depends on the shuffle button being visible in the Now playing area. + # On and off use the menu bar items. + local state=$1 + + if [[ -n "$state" && ! "$state" =~ "^(on|off|toggle)$" ]] + then + print "Usage: itunes shuffle [on|off|toggle]. Invalid option." + return 1 + fi + + case "$state" in + on|off) + # Inspired by: http://stackoverflow.com/a/14675583 + osascript 1>/dev/null 2>&1 <<-EOF + tell application "System Events" to perform action "AXPress" of (menu item "${state}" of menu "Shuffle" of menu item "Shuffle" of menu "Controls" of menu bar item "Controls" of menu bar 1 of application process "iTunes" ) +EOF + return 0 + ;; + toggle|*) + osascript 1>/dev/null 2>&1 <<-EOF + tell application "System Events" to perform action "AXPress" of (button 2 of process "iTunes"'s window "iTunes"'s scroll area 1) +EOF + return 0 + ;; + esac + ;; + ""|-h|--help) + echo "Usage: itunes <option>" + echo "option:" + echo "\tlaunch|play|pause|stop|rewind|resume|quit" + echo "\tmute|unmute\tcontrol volume set" + echo "\tnext|previous\tplay next or previous track" + echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer." + echo "\tvol\tSet the volume, takes an argument from 0 to 100" + echo "\tplaying|status\tShow what song is currently playing in iTunes." + echo "\tplaylist [playlist name]\t Play specific playlist" + echo "\thelp\tshow this message and exit" + return 0 + ;; + *) + print "Unknown option: $opt" + return 1 + ;; + esac + osascript -e "tell application \"iTunes\" to $opt" +} + +# Spotify control function +source ${ZSH}/plugins/osx/spotify + +# Show/hide hidden files in the Finder +alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" +alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" diff --git a/oh-my-zsh/plugins/osx/spotify b/oh-my-zsh/plugins/osx/spotify @@ -0,0 +1,438 @@ +#!/usr/bin/env bash + +function spotify() { +# Copyright (c) 2012--2017 Harish Narayanan <mail@harishnarayanan.org> +# +# Contains numerous helpful contributions from Jorge Colindres, Thomas +# Pritchard, iLan Epstein, Gabriele Bonetti, Sean Heller, Eric Martin +# and Peter Fonseca. + +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation files +# (the "Software"), to deal in the Software without restriction, +# including without limitation the rights to use, copy, modify, merge, +# publish, distribute, sublicense, and/or sell copies of the Software, +# and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +USER_CONFIG_DEFAULTS="CLIENT_ID=\"\"\nCLIENT_SECRET=\"\""; +USER_CONFIG_FILE="${HOME}/.shpotify.cfg"; +if ! [[ -f "${USER_CONFIG_FILE}" ]]; then + touch "${USER_CONFIG_FILE}"; + echo -e "${USER_CONFIG_DEFAULTS}" > "${USER_CONFIG_FILE}"; +fi +source "${USER_CONFIG_FILE}"; + +showAPIHelp() { + echo; + echo "Connecting to Spotify's API:"; + echo; + echo " This command line application needs to connect to Spotify's API in order to"; + echo " find music by name. It is very likely you want this feature!"; + echo; + echo " To get this to work, you need to sign up (or in) and create an 'Application' at:"; + echo " https://developer.spotify.com/my-applications/#!/applications/create"; + echo; + echo " Once you've created an application, find the 'Client ID' and 'Client Secret'"; + echo " values, and enter them into your shpotify config file at '${USER_CONFIG_FILE}'"; + echo; + echo " Be sure to quote your values and don't add any extra spaces!"; + echo " When done, it should look like this (but with your own values):"; + echo ' CLIENT_ID="abc01de2fghijk345lmnop"'; + echo ' CLIENT_SECRET="qr6stu789vwxyz"'; +} + +showHelp () { + echo "Usage:"; + echo; + echo " `basename $0` <command>"; + echo; + echo "Commands:"; + echo; + echo " play # Resumes playback where Spotify last left off."; + echo " play <song name> # Finds a song by name and plays it."; + echo " play album <album name> # Finds an album by name and plays it."; + echo " play artist <artist name> # Finds an artist by name and plays it."; + echo " play list <playlist name> # Finds a playlist by name and plays it."; + echo " play uri <uri> # Play songs from specific uri."; + echo; + echo " next # Skips to the next song in a playlist."; + echo " prev # Returns to the previous song in a playlist."; + echo " replay # Replays the current track from the begining."; + echo " pos <time> # Jumps to a time (in secs) in the current song."; + echo " pause # Pauses (or resumes) Spotify playback."; + echo " stop # Stops playback."; + echo " quit # Stops playback and quits Spotify."; + echo; + echo " vol up # Increases the volume by 10%."; + echo " vol down # Decreases the volume by 10%."; + echo " vol <amount> # Sets the volume to an amount between 0 and 100."; + echo " vol [show] # Shows the current Spotify volume."; + echo; + echo " status # Shows the current player status."; + echo; + echo " share # Displays the current song's Spotify URL and URI." + echo " share url # Displays the current song's Spotify URL and copies it to the clipboard." + echo " share uri # Displays the current song's Spotify URI and copies it to the clipboard." + echo; + echo " toggle shuffle # Toggles shuffle playback mode."; + echo " toggle repeat # Toggles repeat playback mode."; + showAPIHelp +} + +cecho(){ + bold=$(tput bold); + green=$(tput setaf 2); + reset=$(tput sgr0); + echo $bold$green"$1"$reset; +} + +showStatus () { + state=`osascript -e 'tell application "Spotify" to player state as string'`; + cecho "Spotify is currently $state."; + artist=`osascript -e 'tell application "Spotify" to artist of current track as string'`; + album=`osascript -e 'tell application "Spotify" to album of current track as string'`; + track=`osascript -e 'tell application "Spotify" to name of current track as string'`; + duration=`osascript -e 'tell application "Spotify" + set durSec to (duration of current track / 1000) as text + set tM to (round (durSec / 60) rounding down) as text + if length of ((durSec mod 60 div 1) as text) is greater than 1 then + set tS to (durSec mod 60 div 1) as text + else + set tS to ("0" & (durSec mod 60 div 1)) as text + end if + set myTime to tM as text & ":" & tS as text + end tell + return myTime'`; + position=`osascript -e 'tell application "Spotify" + set pos to player position + set nM to (round (pos / 60) rounding down) as text + if length of ((round (pos mod 60) rounding down) as text) is greater than 1 then + set nS to (round (pos mod 60) rounding down) as text + else + set nS to ("0" & (round (pos mod 60) rounding down)) as text + end if + set nowAt to nM as text & ":" & nS as text + end tell + return nowAt'`; + + echo -e $reset"Artist: $artist\nAlbum: $album\nTrack: $track \nPosition: $position / $duration"; +} + +if [ $# = 0 ]; then + showHelp; +else + if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then + osascript -e 'tell application "Spotify" to activate' + sleep 2 + fi +fi +while [ $# -gt 0 ]; do + arg=$1; + + case $arg in + "play" ) + if [ $# != 1 ]; then + # There are additional arguments, so find out how many + array=( $@ ); + len=${#array[@]}; + SPOTIFY_SEARCH_API="https://api.spotify.com/v1/search"; + SPOTIFY_TOKEN_URI="https://accounts.spotify.com/api/token"; + if [ -z "${CLIENT_ID}" ]; then + cecho "Invalid Client ID, please update ${USER_CONFIG_FILE}"; + showAPIHelp; + exit 1; + fi + if [ -z "${CLIENT_SECRET}" ]; then + cecho "Invalid Client Secret, please update ${USER_CONFIG_FILE}"; + showAPIHelp; + exit 1; + fi + SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"); + SPOTIFY_PLAY_URI=""; + + getAccessToken() { + cecho "Connecting to Spotify's API"; + + SPOTIFY_TOKEN_RESPONSE_DATA=$( \ + curl "${SPOTIFY_TOKEN_URI}" \ + --silent \ + -X "POST" \ + -H "Authorization: Basic ${SHPOTIFY_CREDENTIALS}" \ + -d "grant_type=client_credentials" \ + ) + if ! [[ "${SPOTIFY_TOKEN_RESPONSE_DATA}" =~ "access_token" ]]; then + cecho "Autorization failed, please check ${USER_CONFG_FILE}" + cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}" + showAPIHelp + exit 1 + fi + SPOTIFY_ACCESS_TOKEN=$( \ + printf "${SPOTIFY_TOKEN_RESPONSE_DATA}" \ + | grep -E -o '"access_token":".*",' \ + | sed 's/"access_token"://g' \ + | sed 's/"//g' \ + | sed 's/,.*//g' \ + ) + } + + searchAndPlay() { + type="$1" + Q="$2" + + getAccessToken; + + cecho "Searching ${type}s for: $Q"; + + SPOTIFY_PLAY_URI=$( \ + curl -s -G $SPOTIFY_SEARCH_API \ + -H "Authorization: Bearer ${SPOTIFY_ACCESS_TOKEN}" \ + -H "Accept: application/json" \ + --data-urlencode "q=$Q" \ + -d "type=$type&limit=1&offset=0" \ + | grep -E -o "spotify:$type:[a-zA-Z0-9]+" -m 1 + ) + echo "play uri: ${SPOTIFY_PLAY_URI}" + } + + case $2 in + "list" ) + _args=${array[@]:2:$len}; + Q=$_args; + + getAccessToken; + + cecho "Searching playlists for: $Q"; + + results=$( \ + curl -s -G $SPOTIFY_SEARCH_API --data-urlencode "q=$Q" -d "type=playlist&limit=10&offset=0" -H "Accept: application/json" -H "Authorization: Bearer ${SPOTIFY_ACCESS_TOKEN}" \ + | grep -E -o "spotify:user:[a-zA-Z0-9_]+:playlist:[a-zA-Z0-9]+" -m 10 \ + ) + + count=$( \ + echo "$results" | grep -c "spotify:user" \ + ) + + if [ "$count" -gt 0 ]; then + random=$(( $RANDOM % $count)); + + SPOTIFY_PLAY_URI=$( \ + echo "$results" | awk -v random="$random" '/spotify:user:[a-zA-Z0-9]+:playlist:[a-zA-Z0-9]+/{i++}i==random{print; exit}' \ + ) + fi;; + + "album" | "artist" | "track" ) + _args=${array[@]:2:$len}; + searchAndPlay $2 "$_args";; + + "uri" ) + SPOTIFY_PLAY_URI=${array[@]:2:$len};; + + * ) + _args=${array[@]:1:$len}; + searchAndPlay track "$_args";; + esac + + if [ "$SPOTIFY_PLAY_URI" != "" ]; then + if [ "$2" = "uri" ]; then + cecho "Playing Spotify URI: $SPOTIFY_PLAY_URI"; + else + cecho "Playing ($Q Search) -> Spotify URI: $SPOTIFY_PLAY_URI"; + fi + + osascript -e "tell application \"Spotify\" to play track \"$SPOTIFY_PLAY_URI\""; + + else + cecho "No results when searching for $Q"; + fi + + else + + # play is the only param + cecho "Playing Spotify."; + osascript -e 'tell application "Spotify" to play'; + fi + break ;; + + "pause" ) + state=`osascript -e 'tell application "Spotify" to player state as string'`; + if [ $state = "playing" ]; then + cecho "Pausing Spotify."; + else + cecho "Playing Spotify."; + fi + + osascript -e 'tell application "Spotify" to playpause'; + break ;; + + "stop" ) + state=`osascript -e 'tell application "Spotify" to player state as string'`; + if [ $state = "playing" ]; then + cecho "Pausing Spotify."; + osascript -e 'tell application "Spotify" to playpause'; + else + cecho "Spotify is already stopped." + fi + + break ;; + + "quit" ) cecho "Quitting Spotify."; + osascript -e 'tell application "Spotify" to quit'; + exit 1 ;; + + "next" ) cecho "Going to next track." ; + osascript -e 'tell application "Spotify" to next track'; + showStatus; + break ;; + + "prev" ) cecho "Going to previous track."; + osascript -e ' + tell application "Spotify" + set player position to 0 + previous track + end tell'; + showStatus; + break ;; + + "replay" ) cecho "Replaying current track."; + osascript -e 'tell application "Spotify" to set player position to 0' + break ;; + + "vol" ) + vol=`osascript -e 'tell application "Spotify" to sound volume as integer'`; + if [[ $2 = "" || $2 = "show" ]]; then + cecho "Current Spotify volume level is $vol."; + break ; + elif [ "$2" = "up" ]; then + if [ $vol -le 90 ]; then + newvol=$(( vol+10 )); + cecho "Increasing Spotify volume to $newvol."; + else + newvol=100; + cecho "Spotify volume level is at max."; + fi + elif [ "$2" = "down" ]; then + if [ $vol -ge 10 ]; then + newvol=$(( vol-10 )); + cecho "Reducing Spotify volume to $newvol."; + else + newvol=0; + cecho "Spotify volume level is at min."; + fi + elif [[ $2 =~ ^[0-9]+$ ]] && [[ $2 -ge 0 && $2 -le 100 ]]; then + newvol=$2; + cecho "Setting Spotify volume level to $newvol"; + else + echo "Improper use of 'vol' command" + echo "The 'vol' command should be used as follows:" + echo " vol up # Increases the volume by 10%."; + echo " vol down # Decreases the volume by 10%."; + echo " vol [amount] # Sets the volume to an amount between 0 and 100."; + echo " vol # Shows the current Spotify volume."; + break + fi + + osascript -e "tell application \"Spotify\" to set sound volume to $newvol"; + break ;; + + "toggle" ) + if [ "$2" = "shuffle" ]; then + osascript -e 'tell application "Spotify" to set shuffling to not shuffling'; + curr=`osascript -e 'tell application "Spotify" to shuffling'`; + cecho "Spotify shuffling set to $curr"; + elif [ "$2" = "repeat" ]; then + osascript -e 'tell application "Spotify" to set repeating to not repeating'; + curr=`osascript -e 'tell application "Spotify" to repeating'`; + cecho "Spotify repeating set to $curr"; + fi + break ;; + + "status" ) + showStatus; + break ;; + + "info" ) + info=`osascript -e 'tell application "Spotify" + set durSec to (duration of current track / 1000) + set tM to (round (durSec / 60) rounding down) as text + if length of ((durSec mod 60 div 1) as text) is greater than 1 then + set tS to (durSec mod 60 div 1) as text + else + set tS to ("0" & (durSec mod 60 div 1)) as text + end if + set myTime to tM as text & "min " & tS as text & "s" + set pos to player position + set nM to (round (pos / 60) rounding down) as text + if length of ((round (pos mod 60) rounding down) as text) is greater than 1 then + set nS to (round (pos mod 60) rounding down) as text + else + set nS to ("0" & (round (pos mod 60) rounding down)) as text + end if + set nowAt to nM as text & "min " & nS as text & "s" + set info to "" & "\nArtist: " & artist of current track + set info to info & "\nTrack: " & name of current track + set info to info & "\nAlbum Artist: " & album artist of current track + set info to info & "\nAlbum: " & album of current track + set info to info & "\nSeconds: " & durSec + set info to info & "\nSeconds played: " & pos + set info to info & "\nDuration: " & mytime + set info to info & "\nNow at: " & nowAt + set info to info & "\nPlayed Count: " & played count of current track + set info to info & "\nTrack Number: " & track number of current track + set info to info & "\nPopularity: " & popularity of current track + set info to info & "\nId: " & id of current track + set info to info & "\nSpotify URL: " & spotify url of current track + set info to info & "\nArtwork: " & artwork url of current track + set info to info & "\nPlayer: " & player state + set info to info & "\nVolume: " & sound volume + set info to info & "\nShuffle: " & shuffling + set info to info & "\nRepeating: " & repeating + end tell + return info'` + cecho "$info"; + break ;; + + "share" ) + uri=`osascript -e 'tell application "Spotify" to spotify url of current track'`; + remove='spotify:track:' + url=${uri#$remove} + url="http://open.spotify.com/track/$url" + + if [ "$2" = "" ]; then + cecho "Spotify URL: $url" + cecho "Spotify URI: $uri" + echo "To copy the URL or URI to your clipboard, use:" + echo "\`spotify share url\` or" + echo "\`spotify share uri\` respectively." + elif [ "$2" = "url" ]; then + cecho "Spotify URL: $url"; + echo -n $url | pbcopy + elif [ "$2" = "uri" ]; then + cecho "Spotify URI: $uri"; + echo -n $uri | pbcopy + fi + break;; + + "pos" ) + cecho "Adjusting Spotify play position." + osascript -e "tell application \"Spotify\" to set player position to $2"; + break;; + + "help" | * ) + showHelp; + break ;; + esac +done +} diff --git a/oh-my-zsh/plugins/pass/_pass b/oh-my-zsh/plugins/pass/_pass @@ -0,0 +1,138 @@ +#compdef pass +#autoload + +# Copyright (C) 2012 - 2014: +# Johan Venant <jvenant@invicem.pro> +# Brian Mattern <rephorm@rephorm.com> +# Jason A. Donenfeld <Jason@zx2c4.com>. +# All Rights Reserved. +# +# This file is licensed under the GPLv2+. +# Please visit http://git.zx2c4.com/password-store/tree/COPYING for more information. +# +# Oh my zsh plugin maintainer: Santiago Borrazás <sanbor@gmail.com> + + +_pass () { + local cmd + if (( CURRENT > 2)); then + cmd=${words[2]} + # Set the context for the subcommand. + curcontext="${curcontext%:*:*}:pass-$cmd" + # Narrow the range of words we are looking at to exclude `pass' + (( CURRENT-- )) + shift words + # Run the completion for the subcommand + case "${cmd}" in + init) + _arguments : \ + "-p[gpg-id will only be applied to this subfolder]" \ + "--path[gpg-id will only be applied to this subfolder]" + _pass_complete_keys + ;; + ls|list|edit) + _pass_complete_entries_with_subdirs + ;; + insert) + _arguments : \ + "-e[echo password to console]" \ + "--echo[echo password to console]" \ + "-m[multiline]" \ + "--multiline[multiline]" + _pass_complete_entries_with_subdirs + ;; + generate) + _arguments : \ + "-n[don't include symbols in password]" \ + "--no-symbols[don't include symbols in password]" \ + "-c[copy password to the clipboard]" \ + "--clip[copy password to the clipboard]" \ + "-f[force overwrite]" \ + "--force[force overwrite]" \ + "-i[replace first line]" \ + "--in-place[replace first line]" + _pass_complete_entries_with_subdirs + ;; + cp|copy|mv|rename) + _arguments : \ + "-f[force rename]" \ + "--force[force rename]" + _pass_complete_entries_with_subdirs + ;; + rm) + _arguments : \ + "-f[force deletion]" \ + "--force[force deletion]" \ + "-r[recursively delete]" \ + "--recursive[recursively delete]" + _pass_complete_entries_with_subdirs + ;; + git) + local -a subcommands + subcommands=( + "init:Initialize git repository" + "push:Push to remote repository" + "pull:Pull from remote repository" + "config:Show git config" + "log:Show git log" + "reflog:Show git reflog" + ) + _describe -t commands 'pass git' subcommands + ;; + show|*) + _pass_cmd_show + ;; + esac + else + local -a subcommands + subcommands=( + "init:Initialize new password storage" + "ls:List passwords" + "find:Find password files or directories based on pattern" + "grep:Search inside decrypted password files for matching pattern" + "show:Decrypt and print a password" + "insert:Insert a new password" + "generate:Generate a new password using pwgen" + "edit:Edit a password with \$EDITOR" + "mv:Rename the password" + "cp:Copy the password" + "rm:Remove the password" + "git:Call git on the password store" + "version:Output version information" + "help:Output help message" + ) + _describe -t commands 'pass' subcommands + _arguments : \ + "--version[Output version information]" \ + "--help[Output help message]" + _pass_cmd_show + fi +} + +_pass_cmd_show () { + _arguments : \ + "-c[put it on the clipboard]" \ + "--clip[put it on the clipboard]" + _pass_complete_entries +} +_pass_complete_entries_helper () { + local IFS=$'\n' + local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}" + _values -C 'passwords' ${$(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print 2>/dev/null | sed -e "s#${prefix}/\{0,1\}##" -e 's#\.gpg##' | sort):-""} +} + +_pass_complete_entries_with_subdirs () { + _pass_complete_entries_helper +} + +_pass_complete_entries () { + _pass_complete_entries_helper -type f +} + +_pass_complete_keys () { + local IFS=$'\n' + # Extract names and email addresses from gpg --list-keys + _values 'gpg keys' $(gpg2 --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d') +} + +_pass diff --git a/oh-my-zsh/plugins/paver/paver.plugin.zsh b/oh-my-zsh/plugins/paver/paver.plugin.zsh @@ -0,0 +1,16 @@ +_paver_does_target_list_need_generating () { + [ ! -f .paver_targets ] && return 0; + [ pavement.py -nt .paver_targets ] && return 0; + return 1; +} + +_paver () { + if [ -f pavement.py ]; then + if _paver_does_target_list_need_generating; then + paver --help 2>&1 |grep '-'|grep -v -e '--'|awk -F '-' '{print $1}'|tr -d ' ' > .paver_targets + fi + compadd `cat .paver_targets` + fi +} + +compdef _paver paver diff --git a/oh-my-zsh/plugins/pep8/_pep8 b/oh-my-zsh/plugins/pep8/_pep8 @@ -0,0 +1,34 @@ +#compdef pep8 +# +# this is zsh completion function file. +# generated by genzshcomp(ver: 0.5.1) +# + +typeset -A opt_args +local context state line + +_arguments -s -S \ + "--help[show this help message and exit]:" \ + "-h[show this help message and exit]:" \ + "--version[show program's version number and exit]:" \ + "--verbose[print status messages, or debug with -vv]" \ + "-v[print status messages, or debug with -vv]" \ + "--quiet[report only file names, or nothing with -qq]" \ + "-q[report only file names, or nothing with -qq]" \ + "--repeat[(obsolete) show all occurrences of the same error]" \ + "-r[(obsolete) show all occurrences of the same error]" \ + "--first[show first occurrence of each error]" \ + "--exclude[exclude files or directories which match these comma separated patterns (default: .svn,CVS,.bzr,.hg,.git,__pycache__)]::patterns:_files" \ + "--filename[when parsing directories, only check filenames matching these comma separated patterns (default: *.py)]::patterns:_files" \ + "--select[select errors and warnings (e.g. E,W6)]::errors:_files" \ + "--ignore[skip errors and warnings (e.g. E4,W)]::errors:_files" \ + "--show-source[show source code for each error]" \ + "--show-pep8[show text of PEP 8 for each error (implies --first)]" \ + "--statistics[count errors and warnings]" \ + "--count[print total number of errors and warnings to standard error and set exit code to 1 if total is not null]" \ + "--max-line-length[set maximum allowed line length (default: 79)]::n:_files" \ + "--format[set the error format \[default|pylint|<custom>\]]::format:_files" \ + "--diff[report only lines changed according to the unified diff received on STDIN]" \ + "--benchmark[measure processing speed are read from the \[pep8\] section of the tox.ini fg file located in any parent folder of the path(s) llowed options are: exclude, filename, select, ngth, count, format, quiet, show-pep8, show-source, .]" \ + "--config[user config file location (default: /home/gsemet/.config/pep8)]::path:_files" \ + "*::args:_files" diff --git a/oh-my-zsh/plugins/per-directory-history/README.md b/oh-my-zsh/plugins/per-directory-history/README.md @@ -0,0 +1,55 @@ +[Per-Directory-History][6] +========================= + +Per directory history for zsh, as well as global history, and the +ability to toggle between them with ^G. + +This is a implementation of per directory history for zsh, some +implementations of which exist in bash[1][],[2][]. It also implements +a per-directory-history-toggle-history function to change from using the +directory history to using the global history. In both cases the history is +always saved to both the global history and the directory history, so the +toggle state will not effect the saved histories. Being able to switch +between global and directory histories on the fly is a novel feature as far +as I am aware. + +This is a standalone repository for the script, however it is also included in +[oh-my-zsh][4] as a plugin. + +---------------------------------------------------------------------------- +Usage +---------------------------------------------------------------------------- + +1. Load this script into your interactive ZSH session: + + % source zsh-per-directory-history.zsh + +2. The default mode if per directory history, interact with your history as normal. + +3. Press ^G (the Control and G keys simultaneously) to toggle between local + and global histories. If you would prefer a different shortcut to toggle + set the PER_DIRECTORY_HISTORY_TOGGLE environment variable. + +------------------------------------------------------------------------------- +Configuration +------------------------------------------------------------------------------- + +* HISTORY_BASE a global variable that defines the base directory in which the + directory histories are stored +* per-directory-history-toggle-history is the function to toggle the history + +------------------------------------------------------------------------------- +History +------------------------------------------------------------------------------- + +The idea/inspiration for a per directory history is from [Stewart MacArthur][1] +and [Dieter][2], the implementation idea is from [Bart Schaefer][3]. The +implementation is by [Jim Hester][5] in September 2012. + +[1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html +[2]: http://dieter.plaetinck.be/per_directory_bash +[3]: http://www.zsh.org/mla/users/1997/msg00226.html +[4]: https://github.com/robbyrussell/oh-my-zsh +[5]: http://jimhester.com +[6]: http://github.com/jimhester/per-directory-history + diff --git a/oh-my-zsh/plugins/per-directory-history/per-directory-history.plugin.zsh b/oh-my-zsh/plugins/per-directory-history/per-directory-history.plugin.zsh @@ -0,0 +1,151 @@ +#!/usr/bin/env zsh +# +# This is a implementation of per directory history for zsh, some +# implementations of which exist in bash[1,2]. It also implements +# a per-directory-history-toggle-history function to change from using the +# directory history to using the global history. In both cases the history is +# always saved to both the global history and the directory history, so the +# toggle state will not effect the saved histories. Being able to switch +# between global and directory histories on the fly is a novel feature as far +# as I am aware. +# +#------------------------------------------------------------------------------- +# Configuration +#------------------------------------------------------------------------------- +# +# HISTORY_BASE a global variable that defines the base directory in which the +# directory histories are stored +# +#------------------------------------------------------------------------------- +# History +#------------------------------------------------------------------------------- +# +# The idea/inspiration for a per directory history is from Stewart MacArthur[1] +# and Dieter[2], the implementation idea is from Bart Schaefer on the the zsh +# mailing list[3]. The implementation is by Jim Hester in September 2012. +# +# [1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html +# [2]: http://dieter.plaetinck.be/per_directory_bash +# [3]: http://www.zsh.org/mla/users/1997/msg00226.html +# +################################################################################ +# +# Copyright (c) 2014 Jim Hester +# +# This software is provided 'as-is', without any express or implied warranty. +# In no event will the authors be held liable for any damages arising from the +# use of this software. +# +# Permission is granted to anyone to use this software for any purpose, +# including commercial applications, and to alter it and redistribute it +# freely, subject to the following restrictions: +# +# 1. The origin of this software must not be misrepresented; you must not claim +# that you wrote the original software. If you use this software in a product, +# an acknowledgment in the product documentation would be appreciated but is +# not required. +# +# 2. Altered source versions must be plainly marked as such, and must not be +# misrepresented as being the original software. +# +# 3. This notice may not be removed or altered from any source distribution.. +# +################################################################################ + +#------------------------------------------------------------------------------- +# configuration, the base under which the directory histories are stored +#------------------------------------------------------------------------------- + +[[ -z $HISTORY_BASE ]] && HISTORY_BASE="$HOME/.directory_history" +[[ -z $PER_DIRECTORY_HISTORY_TOGGLE ]] && PER_DIRECTORY_HISTORY_TOGGLE='^G' + +#------------------------------------------------------------------------------- +# toggle global/directory history used for searching - ctrl-G by default +#------------------------------------------------------------------------------- + +function per-directory-history-toggle-history() { + if [[ $_per_directory_history_is_global == true ]]; then + _per-directory-history-set-directory-history + print -n "\nusing local history" + else + _per-directory-history-set-global-history + print -n "\nusing global history" + fi + zle .push-line + zle .accept-line +} + +autoload per-directory-history-toggle-history +zle -N per-directory-history-toggle-history +bindkey $PER_DIRECTORY_HISTORY_TOGGLE per-directory-history-toggle-history + +#------------------------------------------------------------------------------- +# implementation details +#------------------------------------------------------------------------------- + +_per_directory_history_directory="$HISTORY_BASE${PWD:A}/history" + +function _per-directory-history-change-directory() { + _per_directory_history_directory="$HISTORY_BASE${PWD:A}/history" + mkdir -p ${_per_directory_history_directory:h} + if [[ $_per_directory_history_is_global == false ]]; then + #save to the global history + fc -AI $HISTFILE + #save history to previous file + local prev="$HISTORY_BASE${OLDPWD:A}/history" + mkdir -p ${prev:h} + fc -AI $prev + + #discard previous directory's history + local original_histsize=$HISTSIZE + HISTSIZE=0 + HISTSIZE=$original_histsize + + #read history in new file + if [[ -e $_per_directory_history_directory ]]; then + fc -R $_per_directory_history_directory + fi + fi +} + +function _per-directory-history-addhistory() { + print -Sr -- "${1%%$'\n'}" + fc -p $_per_directory_history_directory +} + + +function _per-directory-history-set-directory-history() { + if [[ $_per_directory_history_is_global == true ]]; then + fc -AI $HISTFILE + local original_histsize=$HISTSIZE + HISTSIZE=0 + HISTSIZE=$original_histsize + if [[ -e "$_per_directory_history_directory" ]]; then + fc -R "$_per_directory_history_directory" + fi + fi + _per_directory_history_is_global=false +} +function _per-directory-history-set-global-history() { + if [[ $_per_directory_history_is_global == false ]]; then + fc -AI $_per_directory_history_directory + local original_histsize=$HISTSIZE + HISTSIZE=0 + HISTSIZE=$original_histsize + if [[ -e "$HISTFILE" ]]; then + fc -R "$HISTFILE" + fi + fi + _per_directory_history_is_global=true +} + + +#add functions to the exec list for chpwd and zshaddhistory +autoload -U add-zsh-hook +add-zsh-hook chpwd _per-directory-history-change-directory +add-zsh-hook zshaddhistory _per-directory-history-addhistory + +#start in directory mode +mkdir -p ${_per_directory_history_directory:h} +_per_directory_history_is_global=true +_per-directory-history-set-directory-history diff --git a/oh-my-zsh/plugins/per-directory-history/per-directory-history.zsh b/oh-my-zsh/plugins/per-directory-history/per-directory-history.zsh @@ -0,0 +1,151 @@ +#!/usr/bin/env zsh +# +# This is a implementation of per directory history for zsh, some +# implementations of which exist in bash[1,2]. It also implements +# a per-directory-history-toggle-history function to change from using the +# directory history to using the global history. In both cases the history is +# always saved to both the global history and the directory history, so the +# toggle state will not effect the saved histories. Being able to switch +# between global and directory histories on the fly is a novel feature as far +# as I am aware. +# +#------------------------------------------------------------------------------- +# Configuration +#------------------------------------------------------------------------------- +# +# HISTORY_BASE a global variable that defines the base directory in which the +# directory histories are stored +# +#------------------------------------------------------------------------------- +# History +#------------------------------------------------------------------------------- +# +# The idea/inspiration for a per directory history is from Stewart MacArthur[1] +# and Dieter[2], the implementation idea is from Bart Schaefer on the the zsh +# mailing list[3]. The implementation is by Jim Hester in September 2012. +# +# [1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html +# [2]: http://dieter.plaetinck.be/per_directory_bash +# [3]: http://www.zsh.org/mla/users/1997/msg00226.html +# +################################################################################ +# +# Copyright (c) 2014 Jim Hester +# +# This software is provided 'as-is', without any express or implied warranty. +# In no event will the authors be held liable for any damages arising from the +# use of this software. +# +# Permission is granted to anyone to use this software for any purpose, +# including commercial applications, and to alter it and redistribute it +# freely, subject to the following restrictions: +# +# 1. The origin of this software must not be misrepresented; you must not claim +# that you wrote the original software. If you use this software in a product, +# an acknowledgment in the product documentation would be appreciated but is +# not required. +# +# 2. Altered source versions must be plainly marked as such, and must not be +# misrepresented as being the original software. +# +# 3. This notice may not be removed or altered from any source distribution.. +# +################################################################################ + +#------------------------------------------------------------------------------- +# configuration, the base under which the directory histories are stored +#------------------------------------------------------------------------------- + +[[ -z $HISTORY_BASE ]] && HISTORY_BASE="$HOME/.directory_history" +[[ -z $PER_DIRECTORY_HISTORY_TOGGLE ]] && PER_DIRECTORY_HISTORY_TOGGLE='^G' + +#------------------------------------------------------------------------------- +# toggle global/directory history used for searching - ctrl-G by default +#------------------------------------------------------------------------------- + +function per-directory-history-toggle-history() { + if [[ $_per_directory_history_is_global == true ]]; then + _per-directory-history-set-directory-history + print -n "\nusing local history" + else + _per-directory-history-set-global-history + print -n "\nusing global history" + fi + zle .push-line + zle .accept-line +} + +autoload per-directory-history-toggle-history +zle -N per-directory-history-toggle-history +bindkey $PER_DIRECTORY_HISTORY_TOGGLE per-directory-history-toggle-history + +#------------------------------------------------------------------------------- +# implementation details +#------------------------------------------------------------------------------- + +_per_directory_history_directory="$HISTORY_BASE${PWD:A}/history" + +function _per-directory-history-change-directory() { + _per_directory_history_directory="$HISTORY_BASE${PWD:A}/history" + mkdir -p ${_per_directory_history_directory:h} + if [[ $_per_directory_history_is_global == false ]]; then + #save to the global history + fc -AI $HISTFILE + #save history to previous file + local prev="$HISTORY_BASE${OLDPWD:A}/history" + mkdir -p ${prev:h} + fc -AI $prev + + #discard previous directory's history + local original_histsize=$HISTSIZE + HISTSIZE=0 + HISTSIZE=$original_histsize + + #read history in new file + if [[ -e $_per_directory_history_directory ]]; then + fc -R $_per_directory_history_directory + fi + fi +} + +function _per-directory-history-addhistory() { + print -Sr -- "${1%%$'\n'}" + fc -p $_per_directory_history_directory +} + + +function _per-directory-history-set-directory-history() { + if [[ $_per_directory_history_is_global == true ]]; then + fc -AI $HISTFILE + local original_histsize=$HISTSIZE + HISTSIZE=0 + HISTSIZE=$original_histsize + if [[ -e "$_per_directory_history_directory" ]]; then + fc -R "$_per_directory_history_directory" + fi + fi + _per_directory_history_is_global=false +} +function _per-directory-history-set-global-history() { + if [[ $_per_directory_history_is_global == false ]]; then + fc -AI $_per_directory_history_directory + local original_histsize=$HISTSIZE + HISTSIZE=0 + HISTSIZE=$original_histsize + if [[ -e "$HISTFILE" ]]; then + fc -R "$HISTFILE" + fi + fi + _per_directory_history_is_global=true +} + + +#add functions to the exec list for chpwd and zshaddhistory +autoload -U add-zsh-hook +add-zsh-hook chpwd _per-directory-history-change-directory +add-zsh-hook zshaddhistory _per-directory-history-addhistory + +#start in directory mode +mkdir -p ${_per_directory_history_directory:h} +_per_directory_history_is_global=true +_per-directory-history-set-directory-history diff --git a/oh-my-zsh/plugins/perl/perl.plugin.zsh b/oh-my-zsh/plugins/perl/perl.plugin.zsh @@ -0,0 +1,56 @@ +# https://github.com/dbbolton +# +# Below are some useful Perl-related aliases/functions that I use with zsh. + + +# Aliases ################################################################### + +# perlbrew ######## +alias pbi='perlbrew install' +alias pbl='perlbrew list' +alias pbo='perlbrew off' +alias pbs='perlbrew switch' +alias pbu='perlbrew use' + +# Perl ############ + +# perldoc` +alias pd='perldoc' + +# use perl like awk/sed +alias ple='perl -wlne' + +# show the latest stable release of Perl +alias latest-perl='curl -s http://www.perl.org/get.html | perl -wlne '\''if (/perl\-([\d\.]+)\.tar\.gz/) { print $1; exit;}'\' + + + +# Functions ################################################################# + +# newpl - creates a basic Perl script file and opens it with $EDITOR +newpl () { + # set $EDITOR to 'vim' if it is undefined + [[ -z $EDITOR ]] && EDITOR=vim + + # if the file exists, just open it + [[ -e $1 ]] && print "$1 exists; not modifying.\n" && $EDITOR $1 + + # if it doesn't, make it, and open it + [[ ! -e $1 ]] && print '#!/usr/bin/perl'"\n"'use strict;'"\n"'use warnings;'\ + "\n\n" > $1 && $EDITOR $1 +} + + +# pgs - Perl Global Substitution +# find pattern = 1st arg +# replace pattern = 2nd arg +# filename = 3rd arg +pgs() { # [find] [replace] [filename] + perl -i.orig -pe 's/'"$1"'/'"$2"'/g' "$3" +} + + +# Perl grep, because 'grep -P' is terrible. Lets you work with pipes or files. +prep() { # [pattern] [filename unless STDOUT] + perl -nle 'print if /'"$1"'/;' $2 +} diff --git a/oh-my-zsh/plugins/perms/README.md b/oh-my-zsh/plugins/perms/README.md @@ -0,0 +1,9 @@ +## Perms + +Plugin to handle some unix filesystem permissions quickly + +### Usage + +* `set755` recursively sets all directories located within the current working directory and sub directories to octal 755. +* `set644` recursively sets all files located within the current working directory and sub directories to octal 644. +* `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases.+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/perms/perms.plugin.zsh b/oh-my-zsh/plugins/perms/perms.plugin.zsh @@ -0,0 +1,78 @@ +# Some useful commands for setting permissions. +# +# Rory Hardy [GneatGeek] +# Andrew Janke [apjanke] + +### Aliases + +# Set all files' permissions to 644 recursively in a directory +alias set644='find . -type f ! -perm 644 -print0 | xargs -0 chmod 644' + +# Set all directories' permissions to 755 recursively in a directory +alias set755='find . -type d ! -perm 755 -print0 | xargs -0 chmod 755' + +### Functions + +# fixperms - fix permissions on files and directories, with confirmation +# Returns 0 on success, nonzero if any errors occurred +fixperms () { + local opts confirm target exit_status chmod_opts use_slow_mode + zparseopts -E -D -a opts -help -slow v+=chmod_opts + if [[ $# > 1 || -n "${opts[(r)--help]}" ]]; then + cat <<EOF +Usage: fixperms [-v] [--help] [--slow] [target] + + target is the file or directory to change permissions on. If omitted, + the current directory is taken to be the target. + + -v enables verbose output (may be supplied multiple times) + + --slow will use a slower but more robust mode, which is effective if + directories themselves have permissions that forbid you from + traversing them. + +EOF + exit_status=$(( $# > 1 )) + return $exit_status + fi + + if [[ $# == 0 ]]; then + target="." + else + target="$1" + fi + if [[ -n ${opts[(r)--slow]} ]]; then use_slow=true; else use_slow=false; fi + + # Because this requires confirmation, bail in noninteractive shells + if [[ ! -o interactive ]]; then + echo "fixperms: cannot run in noninteractive shell" + return 1 + fi + + echo "Fixing perms on $target?" + printf '%s' "Proceed? (y|n) " + read confirm + if [[ "$confirm" != y ]]; then + # User aborted + return 1 + fi + + # This xargs form is faster than -exec chmod <N> {} \; but will encounter + # issues if the directories themselves have permissions such that you can't + # recurse in to them. If that happens, just rerun this a few times. + exit_status=0; + if [[ $use_slow == true ]]; then + # Process directories first so non-traversable ones are fixed as we go + find "$target" -type d ! -perm 755 -exec chmod $chmod_opts 755 {} \; + if [[ $? != 0 ]]; then exit_status=$?; fi + find "$target" -type f ! -perm 644 -exec chmod $chmod_opts 644 {} \; + if [[ $? != 0 ]]; then exit_status=$?; fi + else + find "$target" -type d ! -perm 755 -print0 | xargs -0 chmod $chmod_opts 755 + if [[ $? != 0 ]]; then exit_status=$?; fi + find "$target" -type f ! -perm 644 -print0 | xargs -0 chmod $chmod_opts 644 + if [[ $? != 0 ]]; then exit_status=$?; fi + fi + echo "Complete" + return $exit_status +} diff --git a/oh-my-zsh/plugins/phing/phing.plugin.zsh b/oh-my-zsh/plugins/phing/phing.plugin.zsh @@ -0,0 +1,7 @@ +_phing () { + if [ -f build.xml ]; then + compadd $(phing -l|grep -v "\[property\]"|grep -v "Buildfile"|sed 1d|grep -v ":$" |grep -v "^\-*$"|grep -v "Warning:"|awk '{print $1}') + fi +} + +compdef _phing phing diff --git a/oh-my-zsh/plugins/pip/_pip b/oh-my-zsh/plugins/pip/_pip @@ -0,0 +1,99 @@ +#compdef pip pip2 pip-2.7 pip3 pip-3.2 pip-3.3 pip-3.4 +#autoload + +# pip zsh completion, based on last stable release (pip8) +# homebrew completion and backwards compatibility + +_pip_all() { + # we cache the list of packages (originally from the macports plugin) + if (( ! $+piplist )); then + zsh-pip-cache-packages + piplist=($(cat $ZSH_PIP_CACHE_FILE)) + fi +} + +_pip_installed() { + installed_pkgs=(`pip freeze | cut -d '=' -f 1`) +} + +local -a _1st_arguments +_1st_arguments=( + 'install:install packages' + 'download:download packages' + 'uninstall:uninstall packages' + 'freeze:output all currently installed packages (exact versions) to stdout' + 'list:list installed packages' + 'show:show information about installed packages' + 'search:search PyPI' + 'wheel:build individual wheel archives for your requirements and dependencies' + 'hash:compute a hash of a local package archive' + 'help:show available commands' + 'bundle:create pybundles (archives containing multiple packages)(deprecated)' + 'unzip:unzip individual packages(deprecated)' + 'zip:zip individual packages(deprecated)' +) + +local expl +local -a all_pkgs installed_pkgs + +_arguments \ + '(-h --help)'{-h,--help}'[show help]' \ + '(--isolated)--isolated[run pip in isolated mode, ignores environment variables and user configuration]' \ + '(-v --verbose)'{-v,--verbose}'[give more output]' \ + '(-V --version)'{-V,--version}'[show version number of program and exit]' \ + '(-q --quiet)'{-q,--quiet}'[give less output]' \ + '(--log)--log[log file location]' \ + '(--proxy)--proxy[proxy in form user:passwd@proxy.server:port]' \ + '(--retries)--retries[max number of retries per connection (default 5 times)]' \ + '(--timeout)--timeout[socket timeout (default 15s)]' \ + '(--exists-action)--exists-action[default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup]' \ + '(--trusted-host)--trusted-host[mark this host as trusted]' \ + '(--cert)--cert[path to alternate CA bundle]' \ + '(--client-cert)--client-cert[path to SSL client certificate]' \ + '(--cache-dir)--cache-dir[store the cache data in specified directory]' \ + '(--no-cache-dir)--no-cache-dir[disable de cache]' \ + '(--disable-pip-version-check)--disable-pip-version-check[do not check periodically for new pip version downloads]' \ + '(-E --environment)'{-E,--environment}'[virtualenv environment to run pip in (deprecated)]' \ + '(-s --enable-site-packages)'{-s,--enable-site-packages}'[include site-packages in virtualenv (deprecated)]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "pip subcommand" _1st_arguments + return +fi + +case "$words[1]" in + search) + _arguments \ + '(--index)--index[base URL of Python Package Index]' ;; + freeze) + _arguments \ + '(-l --local)'{-l,--local}'[report only virtualenv packages]' ;; + install) + _arguments \ + '(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' \ + '(--user)--user[install packages to user home]' \ + '(-f --find-links)'{-f,--find-links}'[URL for finding packages]' \ + '(-r --requirement)'{-r,--requirement}'[Requirements file for packages to install]:File:_files' \ + '(--no-deps --no-dependencies)'{--no-deps,--no-dependencies}'[iIgnore package dependencies]' \ + '(--no-install)--no-install[only download packages]' \ + '(--no-download)--no-download[only install downloaded packages]' \ + '(--install-option)--install-option[extra arguments to be supplied to the setup.py]' \ + '(--single-version-externally-managed)--single-version-externally-managed[do not download/install dependencies. requires --record or --root]'\ + '(--root)--root[treat this path as a fake chroot, installing into it. implies --single-version-externally-managed]'\ + '(--record)--record[file to record all installed files to.]'\ + '(-r --requirement)'{-r,--requirement}'[requirements file]: :_files'\ + '(-e --editable)'{-e,--editable}'[path of or url to source to link to instead of installing.]: :_files -/'\ + '1: :->packages' && return 0 + + if [[ "$state" == packages ]]; then + _pip_all + _wanted piplist expl 'packages' compadd -a piplist + fi ;; + uninstall) + _pip_installed + _wanted installed_pkgs expl 'installed packages' compadd -a installed_pkgs ;; + show) + _pip_installed + _wanted installed_pkgs expl 'installed packages' compadd -a installed_pkgs ;; +esac diff --git a/oh-my-zsh/plugins/pip/pip.plugin.zsh b/oh-my-zsh/plugins/pip/pip.plugin.zsh @@ -0,0 +1,81 @@ +# Usage: +# Just add pip to your installed plugins. + +# If you would like to change the cheeseshops used for autocomplete set +# ZSH_PIP_INDEXES in your zshrc. If one of your indexes are bogus you won't get +# any kind of error message, pip will just not autocomplete from them. Double +# check! +# +# If you would like to clear your cache, go ahead and do a +# "zsh-pip-clear-cache". + +ZSH_PIP_CACHE_FILE=~/.pip/zsh-cache +ZSH_PIP_INDEXES=(https://pypi.python.org/simple/) + +zsh-pip-clear-cache() { + rm $ZSH_PIP_CACHE_FILE + unset piplist +} + +zsh-pip-clean-packages() { + sed -n '/<a href/ s/.*>\([^<]\{1,\}\).*/\1/p' +} + +zsh-pip-cache-packages() { + if [[ ! -d ${ZSH_PIP_CACHE_FILE:h} ]]; then + mkdir -p ${ZSH_PIP_CACHE_FILE:h} + fi + + if [[ ! -f $ZSH_PIP_CACHE_FILE ]]; then + echo -n "(...caching package index...)" + tmp_cache=/tmp/zsh_tmp_cache + for index in $ZSH_PIP_INDEXES ; do + # well... I've already got two problems + curl $index 2>/dev/null | \ + zsh-pip-clean-packages \ + >> $tmp_cache + done + sort $tmp_cache | uniq | tr '\n' ' ' > $ZSH_PIP_CACHE_FILE + rm $tmp_cache + fi +} + +# A test function that validates the regex against known forms of the simple +# index. If you modify the regex to make it work for you, you should add a test +# case in here and make sure that your changes don't break things for someone +# else. +zsh-pip-test-clean-packages() { + local expected + local actual + expected="0x10c-asm +1009558_nester" + + actual=$(echo -n "<html><head><title>Simple Index</title><meta name=\"api-version\" value=\"2\" /></head><body> +<a href='0x10c-asm'>0x10c-asm</a><br/> +<a href='1009558_nester'>1009558_nester</a><br/> +</body></html>" | zsh-pip-clean-packages) + + if [[ $actual != $expected ]] ; then + echo -e "python's simple index is broken:\n$actual\n !=\n$expected" + else + echo "python's simple index is fine" + fi + + actual=$(echo -n '<html> + <head> + <title>Simple Package Index</title> + </head> + <body> + <a href="0x10c-asm">0x10c-asm</a><br/> + <a href="1009558_nester">1009558_nester</a><br/> +</body></html>' | zsh-pip-clean-packages) + + if [[ $actual != $expected ]] ; then + echo -e "the djangopypi2 index is broken:\n$actual\n !=\n$expected" + else + echo "the djangopypi2 index is fine" + fi +} + +alias pip="noglob pip" # allows square brackets for pip command invocation + diff --git a/oh-my-zsh/plugins/pj/README.md b/oh-my-zsh/plugins/pj/README.md @@ -0,0 +1,45 @@ +# pj + +The `pj` plugin (short for `Project Jump`) allows you to define several +folders where you store your projects, so that you can jump there directly +by just using the name of the project directory. + +Original idea and code by Jan De Poorter ([@DefV](https://github.com/DefV)) +Source: https://gist.github.com/pjaspers/368394#gistcomment-1016 + +## Usage + +1. Enable the `pj` plugin: + + ```zsh + plugins=(... pj) + ``` + +2. Set `$PROJECT_PATHS` in your ~/.zshrc: + + ```zsh + PROJECT_PATHS=(~/src ~/work ~/"dir with spaces") + ``` + +You can now use one of the following commands: + +##### `pj my-project`: + +`cd` to the directory named "my-project" found in one of the `$PROJECT_PATHS` +directories. If there are several directories named the same, the first one +to appear in `$PROJECT_PATHS` has preference. + +For example: +```zsh +PROJECT_PATHS=(~/code ~/work) +$ ls ~/code # ~/code/blog ~/code/react +$ ls ~/work # ~/work/blog ~/work/project +$ pj blog # <-- will cd to ~/code/blog +``` + +##### `pjo my-project` + +Open the project directory with your defined `$EDITOR`. This follows the same +directory rules as the `pj` command above. + +Note: `pjo` is an alias of `pj open`. diff --git a/oh-my-zsh/plugins/pj/pj.plugin.zsh b/oh-my-zsh/plugins/pj/pj.plugin.zsh @@ -0,0 +1,37 @@ +alias pjo="pj open" + +pj () { + emulate -L zsh + + cmd="cd" + project=$1 + + if [[ "open" == "$project" ]]; then + shift + project=$* + cmd=${=EDITOR} + else + project=$* + fi + + for basedir ($PROJECT_PATHS); do + if [[ -d "$basedir/$project" ]]; then + $cmd "$basedir/$project" + return + fi + done + + echo "No such project '${project}'." +} + +_pj () { + emulate -L zsh + + typeset -a projects + for basedir ($PROJECT_PATHS); do + projects+=(${basedir}/*(/N)) + done + + compadd ${projects:t} +} +compdef _pj pj diff --git a/oh-my-zsh/plugins/pod/_pod b/oh-my-zsh/plugins/pod/_pod @@ -0,0 +1,682 @@ +#compdef pod +#autoload +# setopt XTRACE VERBOSE +# vim: ft=zsh sw=2 ts=2 et + + +# ----------------------------------------------------------------------------- +# FILE: _pod +# DESCRIPTION: Cocoapods (0.33.1) autocomplete plugin for Oh-My-Zsh +# http://cocoapods.org +# Generated with `pod --completion-script +# AUTHOR: Alexandre Joly (alexandre.joly@mekanics.ch) +# GITHUB: https://github.com/mekanics +# TWITTER: @jolyAlexandre +# VERSION: 0.0.5 +# ----------------------------------------------------------------------------- + +local -a _subcommands +local -a _options + +case "$words[2]" in + help) + case "$words[3]" in + *) # pod help + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod help options" _options + ;; + esac + ;; + ipc) + case "$words[3]" in + list) + case "$words[4]" in + *) # pod ipc list + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod ipc list options" _options + ;; + esac + ;; + podfile) + case "$words[4]" in + *) # pod ipc podfile + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod ipc podfile options" _options + ;; + esac + ;; + repl) + case "$words[4]" in + *) # pod ipc repl + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod ipc repl options" _options + ;; + esac + ;; + spec) + case "$words[4]" in + *) # pod ipc spec + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod ipc spec options" _options + ;; + esac + ;; + update-search-index) + case "$words[4]" in + *) # pod ipc update-search-index + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod ipc update-search-index options" _options + ;; + esac + ;; + *) # pod ipc + _subcommands=( + "list:Lists the specifications known to CocoaPods." + "podfile:Converts a Podfile to YAML." + "repl:The repl listens to commands on standard input." + "spec:Converts a podspec to JSON." + "update-search-index:Updates the search index." + ) + _describe -t commands "pod ipc subcommands" _subcommands + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod ipc options" _options + ;; + esac + ;; + init) + case "$words[3]" in + *) # pod init + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod init options" _options + ;; + esac + ;; + install) + case "$words[3]" in + *) # pod install + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--no-clean:Leave SCM dirs like \`.git\` and \`.svn\` intact after downloading" + "--no-integrate:Skip integration of the Pods libraries in the Xcode project(s)" + "--no-repo-update:Skip running \`pod repo update\` before install" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod install options" _options + ;; + esac + ;; + lib) + case "$words[3]" in + create) + case "$words[4]" in + *) # pod lib create + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod lib create options" _options + ;; + esac + ;; + lint) + case "$words[4]" in + *) # pod lib lint + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--no-clean:Lint leaves the build directory intact for inspection" + "--no-subspecs:Lint skips validation of subspecs" + "--only-errors:Lint validates even if warnings are present" + "--quick:Lint skips checks that would require to download and build the spec" + "--silent:Show nothing" + "--subspec=NAME:Lint validates only the given subspec" + "--verbose:Show more debugging information" + ) + _describe -t options "pod lib lint options" _options + ;; + esac + ;; + *) # pod lib + _subcommands=( + "create:Creates a new Pod" + "lint:Validates a Pod" + ) + _describe -t commands "pod lib subcommands" _subcommands + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod lib options" _options + ;; + esac + ;; + list) + case "$words[3]" in + new) + case "$words[4]" in + *) # pod list new + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--update:Run \`pod repo update\` before listing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod list new options" _options + ;; + esac + ;; + *) # pod list + _subcommands=( + "new:Lists pods introduced in the master spec-repo since the last check" + ) + _describe -t commands "pod list subcommands" _subcommands + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--update:Run \`pod repo update\` before listing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod list options" _options + ;; + esac + ;; + outdated) + case "$words[3]" in + *) # pod outdated + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--no-repo-update:Skip running \`pod repo update\` before install" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod outdated options" _options + ;; + esac + ;; + plugins) + case "$words[3]" in + create) + case "$words[4]" in + *) # pod plugins create + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod plugins create options" _options + ;; + esac + ;; + list) + case "$words[4]" in + *) # pod plugins list + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--verbose:Show more debugging information" + ) + _describe -t options "pod plugins list options" _options + ;; + esac + ;; + search) + case "$words[4]" in + *) # pod plugins search + _options=( + "--full:Search by name, author, and description" + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--verbose:Show more debugging information" + ) + _describe -t options "pod plugins search options" _options + ;; + esac + ;; + *) # pod plugins + _subcommands=( + "create:Creates a new plugin" + "list:List all known plugins" + "search:Search for known plugins" + ) + _describe -t commands "pod plugins subcommands" _subcommands + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod plugins options" _options + ;; + esac + ;; + push) + case "$words[3]" in + *) # pod push + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod push options" _options + ;; + esac + ;; + repo) + case "$words[3]" in + add) + case "$words[4]" in + *) # pod repo add + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--shallow:Create a shallow clone (fast clone, but no push capabilities)" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod repo add options" _options + ;; + esac + ;; + lint) + case "$words[4]" in + *) # pod repo lint + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--only-errors:Lint presents only the errors" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod repo lint options" _options + ;; + esac + ;; + push) + case "$words[4]" in + *) # pod repo push + _options=( + "--allow-warnings:Allows pushing even if there are warnings" + "--help:Show help banner of specified command" + "--local-only:Does not perform the step of pushing REPO to its remote" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod repo push options" _options + ;; + esac + ;; + remove) + case "$words[4]" in + *) # pod repo remove + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod repo remove options" _options + ;; + esac + ;; + update) + case "$words[4]" in + *) # pod repo update + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod repo update options" _options + ;; + esac + ;; + *) # pod repo + _subcommands=( + "add:Add a spec repo." + "lint:Validates all specs in a repo." + "push:Push new specifications to a spec-repo" + "remove:Remove a spec repo" + "update:Update a spec repo." + ) + _describe -t commands "pod repo subcommands" _subcommands + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod repo options" _options + ;; + esac + ;; + search) + case "$words[3]" in + *) # pod search + _options=( + "--full:Search by name, summary, and description" + "--help:Show help banner of specified command" + "--ios:Restricts the search to Pods supported on iOS" + "--no-ansi:Show output without ANSI codes" + "--osx:Restricts the search to Pods supported on OS X" + "--stats:Show additional stats (like GitHub watchers and forks)" + "--verbose:Show more debugging information" + "--web:Searches on cocoapods.org" + ) + _describe -t options "pod search options" _options + ;; + esac + ;; + setup) + case "$words[3]" in + *) # pod setup + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--no-shallow:Clone full history so push will work" + "--push:Use this option to enable push access once granted" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod setup options" _options + ;; + esac + ;; + spec) + case "$words[3]" in + cat) + case "$words[4]" in + *) # pod spec cat + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--show-all:Pick from all versions of the given podspec" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod spec cat options" _options + ;; + esac + ;; + create) + case "$words[4]" in + *) # pod spec create + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod spec create options" _options + ;; + esac + ;; + edit) + case "$words[4]" in + *) # pod spec edit + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--show-all:Pick which spec to edit from all available versions of the given podspec" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod spec edit options" _options + ;; + esac + ;; + lint) + case "$words[4]" in + *) # pod spec lint + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--no-clean:Lint leaves the build directory intact for inspection" + "--no-subspecs:Lint skips validation of subspecs" + "--only-errors:Lint validates even if warnings are present" + "--quick:Lint skips checks that would require to download and build the spec" + "--silent:Show nothing" + "--subspec=NAME:Lint validates only the given subspec" + "--verbose:Show more debugging information" + ) + _describe -t options "pod spec lint options" _options + ;; + esac + ;; + which) + case "$words[4]" in + *) # pod spec which + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--show-all:Print all versions of the given podspec" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod spec which options" _options + ;; + esac + ;; + *) # pod spec + _subcommands=( + "cat:Prints a spec file." + "create:Create spec file stub." + "edit:Edit a spec file." + "lint:Validates a spec file." + "which:Prints the path of the given spec." + ) + _describe -t commands "pod spec subcommands" _subcommands + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod spec options" _options + ;; + esac + ;; + trunk) + case "$words[3]" in + add-owner) + case "$words[4]" in + *) # pod trunk add-owner + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod trunk add-owner options" _options + ;; + esac + ;; + me) + case "$words[4]" in + clean-sessions) + case "$words[5]" in + *) # pod trunk me clean-sessions + _options=( + "--all:Removes all your sessions, except for the current one" + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod trunk me clean-sessions options" _options + ;; + esac + ;; + *) # pod trunk me + _subcommands=( + "clean-sessions:Remove sessions" + ) + _describe -t commands "pod trunk me subcommands" _subcommands + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod trunk me options" _options + ;; + esac + ;; + push) + case "$words[4]" in + *) # pod trunk push + _options=( + "--allow-warnings:Allows push even if there are lint warnings" + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod trunk push options" _options + ;; + esac + ;; + register) + case "$words[4]" in + *) # pod trunk register + _options=( + "--description=DESCRIPTION:An arbitrary description to easily identify your session later on." + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod trunk register options" _options + ;; + esac + ;; + *) # pod trunk + _subcommands=( + "add-owner:Add an owner to a pod" + "me:Display information about your sessions" + "push:Publish a podspec" + "register:Manage sessions" + ) + _describe -t commands "pod trunk subcommands" _subcommands + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod trunk options" _options + ;; + esac + ;; + try) + case "$words[3]" in + *) # pod try + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod try options" _options + ;; + esac + ;; + update) + case "$words[3]" in + *) # pod update + _options=( + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--no-clean:Leave SCM dirs like \`.git\` and \`.svn\` intact after downloading" + "--no-integrate:Skip integration of the Pods libraries in the Xcode project(s)" + "--no-repo-update:Skip running \`pod repo update\` before install" + "--silent:Show nothing" + "--verbose:Show more debugging information" + ) + _describe -t options "pod update options" _options + ;; + esac + ;; + *) # pod + _subcommands=( + "help:Show help for the given command." + "ipc:Inter-process communication" + "init:Generate a Podfile for the current directory." + "install:Install project dependencies" + "lib:Develop pods" + "list:List pods" + "outdated:Show outdated project dependencies" + "plugins:Show available CocoaPods plugins" + "push:Temporary alias for the \`pod repo push\` command" + "repo:Manage spec-repositories" + "search:Searches for pods" + "setup:Setup the CocoaPods environment" + "spec:Manage pod specs" + "trunk:Interact with the CocoaPods API (e.g. publishing new specs)" + "try:Try a Pod!" + "update:Update outdated project dependencies" + ) + _describe -t commands "pod subcommands" _subcommands + _options=( + "--completion-script:Print the auto-completion script" + "--help:Show help banner of specified command" + "--no-ansi:Show output without ANSI codes" + "--silent:Show nothing" + "--verbose:Show more debugging information" + "--version:Show the version of the tool" + ) + _describe -t options "pod options" _options + ;; +esac diff --git a/oh-my-zsh/plugins/postgres/postgres.plugin.zsh b/oh-my-zsh/plugins/postgres/postgres.plugin.zsh @@ -0,0 +1,8 @@ +# Aliases to control Postgres +# Paths noted below are for Postgres installed via Homebrew on OSX + +alias startpost='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start' +alias stoppost='pg_ctl -D /usr/local/var/postgres stop -s -m fast' +alias restartpost='stoppost && sleep 1 && startpost' +alias reloadpost='pg_ctl reload -D /usr/local/var/postgres -s' +alias statuspost='pg_ctl status -D /usr/local/var/postgres -s'+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/pow/pow.plugin.zsh b/oh-my-zsh/plugins/pow/pow.plugin.zsh @@ -0,0 +1,85 @@ +# Restart a rack app running under pow +# http://pow.cx/ +# +# Adds a kapow command that will restart an app +# +# $ kapow myapp +# +# Supports command completion. +# +# If you are not already using completion you might need to enable it with +# +# autoload -U compinit compinit +# +# Changes: +# +# Defaults to the current application, and will walk up the tree to find +# a config.ru file and restart the corresponding app +# +# Will Detect if a app does not exist in pow and print a (slightly) helpful +# error message + +rack_root(){ + setopt chaselinks + local orgdir="$PWD" + local basedir="$PWD" + + while [[ $basedir != '/' ]]; do + test -e "$basedir/config.ru" && break + builtin cd ".." 2>/dev/null + basedir="$PWD" + done + + builtin cd "$orgdir" 2>/dev/null + [[ ${basedir} == "/" ]] && return 1 + echo $basedir +} + +rack_root_detect(){ + basedir=$(rack_root) + echo `basename $basedir | sed -E "s/.(com|net|org)//"` +} + +kapow(){ + local vhost=$1 + [ ! -n "$vhost" ] && vhost=$(rack_root_detect) + if [ ! -h ~/.pow/$vhost ] + then + echo "pow: This domain isn’t set up yet. Symlink your application to ${vhost} first." + return 1 + fi + + [ ! -d ~/.pow/${vhost}/tmp ] && mkdir -p ~/.pow/$vhost/tmp + touch ~/.pow/$vhost/tmp/restart.txt; + [ $? -eq 0 ] && echo "pow: restarting $vhost.dev" +} +compctl -W ~/.pow -/ kapow + +powit(){ + local basedir="$PWD" + local vhost=$1 + [ ! -n "$vhost" ] && vhost=$(rack_root_detect) + if [ ! -h ~/.pow/$vhost ] + then + echo "pow: Symlinking your app with pow. ${vhost}" + [ ! -d ~/.pow/${vhost} ] && ln -s "$basedir" ~/.pow/$vhost + return 1 + fi +} + +powed(){ + local basedir="$(rack_root)" + find ~/.pow/ -type l -lname "*$basedir*" -exec basename {}'.dev' \; +} + +# Restart pow process +# taken from http://www.matthewratzloff.com/blog/2011/12/23/restarting-pow-when-dns-stops-responding +repow(){ + lsof | grep 20560 | awk '{print $2}' | xargs kill -9 + launchctl unload ~/Library/LaunchAgents/cx.pow.powd.plist + launchctl load ~/Library/LaunchAgents/cx.pow.powd.plist + echo "restarted pow" +} + +# View the standard out (puts) from any pow app +alias kaput="tail -f ~/Library/Logs/Pow/apps/*" diff --git a/oh-my-zsh/plugins/powder/_powder b/oh-my-zsh/plugins/powder/_powder @@ -0,0 +1,4 @@ +#compdef powder +#autoload + +compadd `powder help | grep powder | cut -d " " -f 4` diff --git a/oh-my-zsh/plugins/powify/_powify b/oh-my-zsh/plugins/powify/_powify @@ -0,0 +1,55 @@ +#compdef powify + +_powify_all_servers() { + all_servers=(`ls $HOME/.pow/ 2>/dev/null`) +} + +local -a all_servers + +local -a _1st_arguments +_1st_arguments=( + 'server:server specific commands' + 'utils:manage powify' + 'create:creates a pow app from the current directory (to change the name append name as an argument)' + 'destroy:destroys the pow app linked to the current directory' + 'restart:restarts the pow app linked to the current directory' + 'always_restart:reload the pow app after each request' + 'always_restart_off:do not reload the pow app after each request' + 'rename:rename the current pow app to [NAME] or renmae [OLD] to [NEW]' + 'environment:run the this pow app in a different environment (aliased `env`)' + 'browse:opens and navigates the default browser to this app' + 'logs:tail the application logs' +) + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "powify command" _1st_arguments + return +fi + +case "$words[1]" in + server) + _values , \ + 'install[install pow server]' \ + 'reinstall[reinstall pow server]' \ + 'update[update pow server]' \ + 'uninstall[uninstall pow server]' \ + 'list[list all pow apps]' \ + 'start[start the pow server]' \ + 'stop[stop the pow server]' \ + 'restart[restart the pow server]' \ + 'host[adds all pow apps to /etc/hosts file]' \ + 'unhost[removes all pow apps from /etc/hosts file]' \ + 'status[print the current server status]' \ + 'config[print the current server configuration]' \ + 'logs[tails the pow server logs]' ;; + utils) + _values , \ + 'install[install powify.dev server management tool]' \ + 'reinstall[reinstall powify.dev server management tool]' \ + 'uninstall[uninstall powify.dev server management tool]' ;; + destroy|restart|always_restart|always_restart_off|rename|browse|logs) + _powify_all_servers + _wanted all_servers expl 'all pow servers' compadd -a all_servers ;; +esac diff --git a/oh-my-zsh/plugins/profiles/profiles.plugin.zsh b/oh-my-zsh/plugins/profiles/profiles.plugin.zsh @@ -0,0 +1,12 @@ +# You will probably want to list this plugin as the first in your .zshrc. + +# This will look for a custom profile for the local machine and each domain or +# subdomain it belongs to. (e.g. com, example.com and foo.example.com) +parts=(${(s:.:)HOST}) +for i in {${#parts}..1}; do + profile=${(j:.:)${parts[$i,${#parts}]}} + file=$ZSH_CUSTOM/profiles/$profile + if [ -f $file ]; then + source $file + fi +done diff --git a/oh-my-zsh/plugins/pyenv/pyenv.plugin.zsh b/oh-my-zsh/plugins/pyenv/pyenv.plugin.zsh @@ -0,0 +1,50 @@ +_homebrew-installed() { + type brew &> /dev/null +} + +_pyenv-from-homebrew-installed() { + brew --prefix pyenv &> /dev/null +} + +FOUND_PYENV=0 +pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv") + +for pyenvdir in "${pyenvdirs[@]}" ; do + if [ -d $pyenvdir/bin -a $FOUND_PYENV -eq 0 ] ; then + FOUND_PYENV=1 + export PYENV_ROOT=$pyenvdir + export PATH=${pyenvdir}/bin:$PATH + eval "$(pyenv init - zsh)" + + if pyenv commands | command grep -q virtualenv-init; then + eval "$(pyenv virtualenv-init - zsh)" + fi + + function pyenv_prompt_info() { + echo "$(pyenv version-name)" + } + fi +done +unset pyenvdir + +if [ $FOUND_PYENV -eq 0 ] ; then + pyenvdir=$(brew --prefix pyenv 2> /dev/null) + if [ $? -eq 0 -a -d $pyenvdir/bin ] ; then + FOUND_PYENV=1 + export PYENV_ROOT=$pyenvdir + export PATH=${pyenvdir}/bin:$PATH + eval "$(pyenv init - zsh)" + + if pyenv commands | command grep -q virtualenv-init; then + eval "$(pyenv virtualenv-init - zsh)" + fi + + function pyenv_prompt_info() { + echo "$(pyenv version-name)" + } + fi +fi + +if [ $FOUND_PYENV -eq 0 ] ; then + function pyenv_prompt_info() { echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')" } +fi diff --git a/oh-my-zsh/plugins/pylint/_pylint b/oh-my-zsh/plugins/pylint/_pylint @@ -0,0 +1,31 @@ +#compdef pylint +# +# this is zsh completion function file. +# generated by genzshcomp(ver: 0.5.1) +# + +typeset -A opt_args +local context state line + +_arguments -s -S \ + "--help[show this help message and exit]:" \ + "-h[show this help message and exit]:" \ + "--version[show program's version number and exit]:" \ + "--long-help[more verbose help.]" \ + "--rcfile[Specify a configuration file.]::<file>:_files" \ + "--errors-only[In error mode, checkers without error messages are disabled and for others, only the ERROR messages are displayed, and no reports are done by default]" \ + "-E[In error mode, checkers without error messages are disabled and for others, only the ERROR messages are displayed, and no reports are done by default]" \ + "--ignore[Add files or directories to the blacklist. They should be base names, not paths. \[current: CVS\]]::<file>[,<file>...]:_files" \ + "--help-msg[Display a help message for the given message id and exit. The value may be a comma separated list of message ids.]::<msg-id>:_files" \ + "--generate-rcfile[Generate a sample configuration file according to the current configuration. You can put other options before this one to get them in the generated configuration.]" \ + "--enable[Enable the message, report, category or checker with the given id(s). You can either give multiple identifier separated by comma (,) or put this option multiple time.]::<msg ids>:_files" \ + "-e[Enable the message, report, category or checker with the given id(s). You can either give multiple identifier separated by comma (,) or put this option multiple time.]::<msg ids>:_files" \ + "--disable[Disable the message, report, category or checker with the given id(s). You can either give multiple identifier separated by comma (,) or put this option multiple time (only on the command line, not in the configuration file where it should appear only once).]::<msg ids>:_files" \ + "-d[Disable the message, report, category or checker with the given id(s). You can either give multiple identifier separated by comma (,) or put this option multiple time (only on the command line, not in the configuration file where it should appear only once).]::<msg ids>:_files" \ + "--output-format[Set the output format. Available formats are text, parseable, colorized, msvs (visual studio) and html \[current: text\]]::<format>:_files" \ + "-f[Set the output format. Available formats are text, parseable, colorized, msvs (visual studio) and html \[current: text\]]::<format>:_files" \ + "--include-ids[Include message's id in output \[current: no\]]::<y_or_n>:_files" \ + "-i[Include message's id in output \[current: no\]]::<y_or_n>:_files" \ + "--reports[Tells whether to display a full report or only the messages \[current: yes\]]::<y_or_n>:_files" \ + "-r[Tells whether to display a full report or only the messages \[current: yes\]]::<y_or_n>:_files" \ + "*::args:_files" diff --git a/oh-my-zsh/plugins/pylint/pylint.plugin.zsh b/oh-my-zsh/plugins/pylint/pylint.plugin.zsh @@ -0,0 +1,3 @@ +# Aliases +alias pylint-quick='pylint --reports=n' +compdef _pylint-quick pylint-quick='pylint --reports=n' diff --git a/oh-my-zsh/plugins/python/_python b/oh-my-zsh/plugins/python/_python @@ -0,0 +1,54 @@ +#compdef python + +# Python 2.6 +# Python 3.0 + +local curcontext="$curcontext" state line expl +typeset -A opt_args + +local -a args + +if _pick_variant python3=Python\ 3 python2 --version; then + args=( + '(-bb)-b[issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]' + '(-b)-bb[issue errors about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]' + ) +else + args=( + '-Q+[division options]:division option:(old warn warnall new)' + '(-tt)-t[issue warnings about inconsistent tab usage]' + '(-t)-tt[issue errors about inconsistent tab usage]' + '-3[warn about Python 3.x incompatibilities]' + ) +fi + +_arguments -C -s -S "$args[@]" \ + "-B[don't write .py\[co\] files on import]" \ + '(1 -)-c+[program passed in as string (terminates option list)]:python command:' \ + '-d[debug output from parser]' \ + '-E[ignore PYTHON* environment variables (such as PYTHONPATH)]' \ + '(1 * -)-h[display help information]' \ + '-i[inspect interactively after running script]' \ + '(1 * -)-m[run library module as a script (terminates option list)]:module:->modules' \ + '-O[optimize generated bytecode slightly]' \ + '-OO[remove doc-strings in addition to the -O optimizations]' \ + "-s[don't add user site directory to sys.path]" \ + "-S[don't imply 'import site' on initialization]" \ + '-u[unbuffered binary stdout and stderr]' \ + '-v[verbose (trace import statements)]' \ + '(1 * -)'{-V,--version}'[display version information]' \ + '-W+[warning control]:warning filter (action\:message\:category\:module\:lineno):(default always ignore module once error)' \ + '-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \ + '(-)1:script file:_files -g "*.py(|c|o)(-.)"' \ + '*::script argument: _normal' && return + +if [[ "$state" = modules ]]; then + local -a modules + modules=( + ${${=${(f)"$(_call_program modules $words[1] -c \ + 'from\ pydoc\ import\ help\;\ help\(\"modules\"\)')"}[2,-3]}:#\(package\)} + ) + _wanted modules expl module compadd -a modules && return +fi + +return 1 diff --git a/oh-my-zsh/plugins/python/python.plugin.zsh b/oh-my-zsh/plugins/python/python.plugin.zsh @@ -0,0 +1,14 @@ +# Find python file +alias pyfind='find . -name "*.py"' + +# Remove python compiled byte-code in either current directory or in a +# list of specified directories +function pyclean() { + ZSH_PYCLEAN_PLACES=${*:-'.'} + find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete + find ${ZSH_PYCLEAN_PLACES} -type d -name "__pycache__" -delete +} + +# Grep among .py files +alias pygrep='grep --include="*.py"' + diff --git a/oh-my-zsh/plugins/rails/_rails b/oh-my-zsh/plugins/rails/_rails @@ -0,0 +1,63 @@ +#compdef rails +#autoload + +local -a _1st_arguments +_1st_arguments=( + 'generate:Generate new code (short-cut alias: "g")' + 'console:Start the Rails console (short-cut alias: "c")' + 'server:Start the Rails server (short-cut alias: "s")' + 'dbconsole:Start a console for the database specified in config/database.yml (short-cut alias: "db")' + 'new:Create a new Rails application. "rails new my_app" creates a new application called MyApp in "./my_app"' + 'application:Generate the Rails application code' + 'destroy:Undo code generated with "generate"' + + 'benchmarker:See how fast a piece of code runs' + 'profiler:Get profile information from a piece of code' + 'plugin:Install a plugin' + + 'plugin new:Generates skeleton for developing a Rails plugin' + 'runner:Run a piece of code in the application environment (short-cut alias: "r")' +) + +_rails_generate_arguments() { + generate_arguments=( + assets + controller + decorator + generator + helper + integration_test + mailer + migration + model + observer + performance_test + plugin + resource + scaffold + scaffold_controller + session_migration + stylesheets + task + ) +} + + +_arguments \ + '(--version)--version[show version]' \ + '(--help)--help[show help]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "rails subcommand" _1st_arguments + return +fi + +case "$words[1]" in + g|generate) + _rails_generate_arguments + _wanted generate_arguments expl 'all generate' compadd -a generate_arguments ;; + d|destroy) + _rails_generate_arguments + _wanted generate_arguments expl 'all generate' compadd -a generate_arguments ;; +esac diff --git a/oh-my-zsh/plugins/rails/rails.plugin.zsh b/oh-my-zsh/plugins/rails/rails.plugin.zsh @@ -0,0 +1,86 @@ +function _rails_command () { + if [ -e "bin/stubs/rails" ]; then + bin/stubs/rails $@ + elif [ -e "bin/rails" ]; then + bin/rails $@ + elif [ -e "script/rails" ]; then + ruby script/rails $@ + elif [ -e "script/server" ]; then + ruby script/$@ + else + command rails $@ + fi +} + +function _rake_command () { + if [ -e "bin/stubs/rake" ]; then + bin/stubs/rake $@ + elif [ -e "bin/rake" ]; then + bin/rake $@ + elif type bundle &> /dev/null && [ -e "Gemfile" ]; then + bundle exec rake $@ + else + command rake $@ + fi +} + +alias rails='_rails_command' +compdef _rails_command=rails + +alias rake='_rake_command' +compdef _rake_command=rake + +alias devlog='tail -f log/development.log' +alias prodlog='tail -f log/production.log' +alias testlog='tail -f log/test.log' + +alias -g RED='RAILS_ENV=development' +alias -g REP='RAILS_ENV=production' +alias -g RET='RAILS_ENV=test' + +# Rails aliases +alias rc='rails console' +alias rcs='rails console --sandbox' +alias rd='rails destroy' +alias rdb='rails dbconsole' +alias rg='rails generate' +alias rgm='rails generate migration' +alias rp='rails plugin' +alias ru='rails runner' +alias rs='rails server' +alias rsd='rails server --debugger' +alias rsp='rails server --port' + +# Rake aliases +alias rdm='rake db:migrate' +alias rdms='rake db:migrate:status' +alias rdr='rake db:rollback' +alias rdc='rake db:create' +alias rds='rake db:seed' +alias rdd='rake db:drop' +alias rdrs='rake db:reset' +alias rdtc='rake db:test:clone' +alias rdtp='rake db:test:prepare' +alias rdmtc='rake db:migrate db:test:clone' +alias rdsl='rake db:schema:load' +alias rlc='rake log:clear' +alias rn='rake notes' +alias rr='rake routes' +alias rrg='rake routes | grep' +alias rt='rake test' +alias rmd='rake middleware' +alias rsts='rake stats' + +# legacy stuff +alias sstat='thin --stats "/thin/stats" start' +alias sg='ruby script/generate' +alias sd='ruby script/destroy' +alias sp='ruby script/plugin' +alias sr='ruby script/runner' +alias ssp='ruby script/spec' +alias sc='ruby script/console' +alias sd='ruby script/server --debugger' + +function remote_console() { + /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )" +} diff --git a/oh-my-zsh/plugins/rake-fast/README.md b/oh-my-zsh/plugins/rake-fast/README.md @@ -0,0 +1,35 @@ +# rake-fast + +Fast rake autocompletion plugin. + +This plugin caches the output for later usage and significantly speeds it up. +It generates a `.rake_tasks` cache file in parallel to the Rakefile. It also +checks the file modification time to see if it needs to regenerate the cache +file. + +This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/), +which is inspired by [this Ruby on Rails trick from 2006](http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh/). + +Think about that. 2006. + +---------- + +Since August of 2016, it also checks if it's in a Rails project and looks at +rake files inside `lib/tasks` and their modification time to know if the +cache file needs to be regenerated. + +## Installation + +Just add the plugin to your `.zshrc`: + +```zsh +plugins=(... rake-fast) +``` + +You might consider adding `.rake_tasks` to your [global .gitignore](https://help.github.com/articles/ignoring-files#global-gitignore) + +## Usage + +Type `rake`, then press tab. + +If you want to force the regeneration of the `.rake_tasks` file, run `rake_refresh`. diff --git a/oh-my-zsh/plugins/rake-fast/rake-fast.plugin.zsh b/oh-my-zsh/plugins/rake-fast/rake-fast.plugin.zsh @@ -0,0 +1,43 @@ +_rake_does_task_list_need_generating () { + [[ ! -f .rake_tasks ]] || [[ Rakefile -nt .rake_tasks ]] || { _is_rails_app && _tasks_changed } +} + +_is_rails_app () { + [[ -e "bin/rails" ]] || [[ -e "script/rails" ]] +} + +_tasks_changed () { + local -a files + files=(lib/tasks lib/tasks/**/*(N)) + + for file in $files; do + if [[ "$file" -nt .rake_tasks ]]; then + return 0 + fi + done + + return 1 +} + +_rake_generate () { + rake --silent --tasks | cut -d " " -f 2 > .rake_tasks +} + +_rake () { + if [[ -f Rakefile ]]; then + if _rake_does_task_list_need_generating; then + echo "\nGenerating .rake_tasks..." >&2 + _rake_generate + fi + compadd $(cat .rake_tasks) + fi +} +compdef _rake rake + +rake_refresh () { + [[ -f .rake_tasks ]] && rm -f .rake_tasks + + echo "Generating .rake_tasks..." >&2 + _rake_generate + cat .rake_tasks +} diff --git a/oh-my-zsh/plugins/rake/rake.plugin.zsh b/oh-my-zsh/plugins/rake/rake.plugin.zsh @@ -0,0 +1,10 @@ +# Thank you Jim for everything you contributed to the Ruby and open source community +# over the years. We will miss you dearly. +alias jimweirich="rake" + +alias rake="noglob rake" # allows square brackts for rake task invocation +alias brake='noglob bundle exec rake' # execute the bundled rake gem +alias srake='noglob sudo rake' # noglob must come before sudo +alias sbrake='noglob sudo bundle exec rake' # altogether now ... + + diff --git a/oh-my-zsh/plugins/rand-quote/rand-quote.plugin.zsh b/oh-my-zsh/plugins/rand-quote/rand-quote.plugin.zsh @@ -0,0 +1,26 @@ +# Get a random quote fron the site http://www.quotationspage.com/random.php3 +# Created by Eduardo San Martin Morote aka Posva +# http://posva.github.io +# Sun Jun 09 10:59:36 CEST 2013 +# Don't remove this header, thank you +# Usage: quote + +WHO_COLOR="\e[0;33m" +TEXT_COLOR="\e[0;35m" +COLON_COLOR="\e[0;35m" +END_COLOR="\e[m" + +if [[ -x `which curl` ]]; then + function quote() + { + Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php3" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ") + TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g') + W=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g') + if [ "$W" -a "$TXT" ]; then + echo "${WHO_COLOR}${W}${COLON_COLOR}: ${TEXT_COLOR}“${TXT}”${END_COLOR}" + fi + } + #quote +else + echo "rand-quote plugin needs curl to work" >&2 +fi diff --git a/oh-my-zsh/plugins/rbenv/rbenv.plugin.zsh b/oh-my-zsh/plugins/rbenv/rbenv.plugin.zsh @@ -0,0 +1,60 @@ +_homebrew-installed() { + type brew &> /dev/null +} + +FOUND_RBENV=0 +rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" "/usr/local/opt/rbenv") +if _homebrew-installed && rbenv_homebrew_path=$(brew --prefix rbenv 2>/dev/null); then + rbenvdirs=($rbenv_homebrew_path "${rbenvdirs[@]}") + unset rbenv_homebrew_path + if [[ $RBENV_ROOT = '' ]]; then + RBENV_ROOT="$HOME/.rbenv" + fi +fi + +for rbenvdir in "${rbenvdirs[@]}" ; do + if [ -d $rbenvdir/bin -a $FOUND_RBENV -eq 0 ] ; then + FOUND_RBENV=1 + if [[ $RBENV_ROOT = '' ]]; then + RBENV_ROOT=$rbenvdir + fi + export RBENV_ROOT + export PATH=${rbenvdir}/bin:$PATH + eval "$(rbenv init --no-rehash - zsh)" + + alias rubies="rbenv versions" + alias gemsets="rbenv gemset list" + + function current_ruby() { + echo "$(rbenv version-name)" + } + + function current_gemset() { + echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)" + } + + function gems { + local rbenv_path=$(rbenv prefix) + gem list $@ | sed -E \ + -e "s/\([0-9a-z, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \ + -e "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \ + -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ + -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" + } + + function rbenv_prompt_info() { + if [[ -n $(current_gemset) ]] ; then + echo "$(current_ruby)@$(current_gemset)" + else + echo "$(current_ruby)" + fi + } + fi +done +unset rbenvdir + +if [ $FOUND_RBENV -eq 0 ] ; then + alias rubies='ruby -v' + function gemsets() { echo 'not supported' } + function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" } +fi diff --git a/oh-my-zsh/plugins/rbfu/rbfu.plugin.zsh b/oh-my-zsh/plugins/rbfu/rbfu.plugin.zsh @@ -0,0 +1,42 @@ +# Enables rbfu with --auto option, if available. +# +# Also provides a command to list all installed/available +# rubies. To ensure compatibility with themes, creates the +# rvm_prompt_info function to return the $RBFU_RUBY_VERSION +# version. + +command -v rbfu &>/dev/null + +if [[ $? -eq 0 ]]; then + eval "$(rbfu --init --auto)" + + # Internal: Print ruby version details, if it's currently + # active etc. + function _rbfu_rubies_print() { + local rb rb_out + rb=$(basename $1) + rb_out="$rb" + [[ -h $1 ]] && rb_out="$rb_out${fg[green]}@${reset_color}" + [[ "x$rb" == "x$2" ]] && rb_out="${fg[red]}$rb_out ${fg[red]}*${reset_color}" + echo $rb_out + } + + # Public: Provide a list with all available rubies, this basically depends + # on `ls -1` and .rfbu/rubies. Highlights the currently active ruby version + # and aliases. + function rbfu-rubies() { + local rbfu_dir active_rb + rbfu_dir=$RBFU_RUBIES + active_rb=$RBFU_RUBY_VERSION + [[ -z "$rbfu_dir" ]] && rbfu_dir="${HOME}/.rbfu/rubies" + [[ -z "$active_rb" ]] && active_rb="system" + _rbfu_rubies_print "${rbfu_dir}/system" $active_rb + for rb in $(ls -1 $rbfu_dir); do + _rbfu_rubies_print "${rbfu_dir}/${rb}" $active_rb + done + } + + # Public: Create rvm_prompt_info command for themes compatibility, unless + # it has already been defined. + [ ! -x rvm_prompt_info ] && function rvm_prompt_info() { echo "${RBFU_RUBY_VERSION:=system}" } +fi diff --git a/oh-my-zsh/plugins/react-native/README.md b/oh-my-zsh/plugins/react-native/README.md @@ -0,0 +1,29 @@ +# React Native plugin + +This plugin adds completion for [`react-native`](https://facebook.github.io/react-native/). +It also defines a few [aliases](#aliases) for the commands more frequently used. + +To enable, add `react-native` to your `plugins` array in your zshrc file: + +```zsh +plugins=(... react-native) +``` + +## Aliases + +| Alias | React Native command | +|:------------|:-----------------------------------------------| +| **rn** | `react-native` | +| **rns** | `react-native start` | +| **rnlink** | `react-native link` | +| _App testing_ | +| **rnand** | `react-native run-android` | +| **rnios** | `react-native run-ios` | +| **rnios4s** | `react-native run-ios --simulator "iPhone 4s"` | +| **rnios5** | `react-native run-ios --simulator "iPhone 5"` | +| **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` | +| **rnios6** | `react-native run-ios --simulator "iPhone 6"` | +| **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` | +| _Logging_ | +| **rnland** | `react-native log-android` | +| **rnlios** | `react-native log-ios` | diff --git a/oh-my-zsh/plugins/react-native/_react-native b/oh-my-zsh/plugins/react-native/_react-native @@ -0,0 +1,32 @@ +#compdef react-native +#autoload + +local -a _1st_arguments +_1st_arguments=( + 'init:<ProjectName> generates a new project and installs its dependencies' + 'android:creates an empty android project' + 'start:starts the webserver' + 'run-ios:builds your app and starts it on iOS simulator' + 'run-android:builds your app and starts it on a connected Android emulator or device' + 'new-library:generates a native library bridge' + 'bundle:builds the javascript bundle for offline use' + 'unbundle:builds javascript as "unbundle" for offline use' + 'link:[options] <packageName> links all native dependencies' + 'unlink:[options] <packageName> unlink native dependency' + 'install:[options] <packageName> install and link native dependencies' + 'uninstall:[options] <packageName> uninstall and unlink native dependencies' + "upgrade:upgrade your app's template files to the latest version; run this after updating the react-native version in your package.json and running npm install" + 'log-android:starts adb logcat' + 'log-ios:starts iOS device syslog tail' +) + + +_arguments \ + '(--version)--version[show version]' \ + '(--help)--help[show help]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "react-native subcommand" _1st_arguments + return +fi diff --git a/oh-my-zsh/plugins/react-native/react-native.plugin.zsh b/oh-my-zsh/plugins/react-native/react-native.plugin.zsh @@ -0,0 +1,14 @@ +alias rn='react-native' +alias rns='react-native start' +alias rnlink='react-native link' + +alias rnand='react-native run-android' +alias rnios='react-native run-ios' +alias rnios4s='react-native run-ios --simulator "iPhone 4s"' +alias rnios5='react-native run-ios --simulator "iPhone 5"' +alias rnios5s='react-native run-ios --simulator "iPhone 5s"' +alias rnios6='react-native run-ios --simulator "iPhone 6"' +alias rnios6s='react-native run-ios --simulator "iPhone 6s"' + +alias rnland='react-native log-android' +alias rnlios='react-native log-ios' diff --git a/oh-my-zsh/plugins/rebar/_rebar b/oh-my-zsh/plugins/rebar/_rebar @@ -0,0 +1,79 @@ +#compdef rebar + +local curcontext=$curcontext state ret=1 +typeset -ga _rebar_global_opts + +_rebar_global_opts=( + '(--help -h)'{--help,-h}'[Show the program options]' + '(--commands -c)'{--commands,-c}'[Show available commands]' + '(--version -V)'{--version,-V}'[Show version information]' + '(-vvv -vv -v)'--verbose+'[Verbosity level. Default: 0]:verbosity level:(0 1 2 3)' + '(-vvv)-v[Slightly more verbose output]' + '(-vvv)-vv[More verbose output]' + '(-v -vv)-vvv[Most verbose output]' + '(--force -f)'{--force,-f}'[Force]' + '-D+[Define compiler macro]' + '(--jobs -j)'{--jobs+,-j+}'[Number of concurrent workers a command may use. Default: 3]:workers:(1 2 3 4 5 6 7 8 9)' + '(--config -C)'{--config,-C}'[Rebar config file to use]:files:_files' + '(--profile -p)'{--profile,-p}'[Profile this run of rebar]' + '(--keep-going -k)'{--keep-going,-k}'[Keep running after a command fails]' +) + +_rebar () { + _arguments -C $_rebar_global_opts \ + '*::command and variable:->cmd_and_var' \ + && return + + case $state in + cmd_and_var) + _values -S = 'variables' \ + 'clean[Clean]' \ + 'compile[Compile sources]' \ + 'create[Create skel based on template and vars]' \ + 'create-app[Create simple app skel]' \ + 'create-node[Create simple node skel]' \ + 'list-template[List avaiavle templates]' \ + 'doc[Generate Erlang program documentation]' \ + 'check-deps[Display to be fetched dependencies]' \ + 'get-deps[Fetch dependencies]' \ + 'update-deps[Update fetched dependencies]' \ + 'delete-deps[Delete fetched dependencies]' \ + 'list-deps[List dependencies]' \ + 'generate[Build release with reltool]' \ + 'overlay[Run reltool overlays only]' \ + 'generate-appups[Generate appup files]' \ + 'generate-upgrade[Build an upgrade package]' \ + 'eunit[Run eunit tests]' \ + 'ct[Run common_test suites]' \ + 'qc[Test QuickCheck properties]' \ + 'xref[Run cross reference analysis]' \ + 'help[Show the program options]' \ + 'version[Show version information]' \ + 'apps[Application names to process]:' \ + 'case[Common Test case]:' \ + 'dump_spec[Dump reltool spec]:' \ + 'jobs[Number of workers]::workers:(0 1 2 3 4 5 6 7 8 9)' \ + 'suites[Common Test suites]::suite name:_path_files -W "(src test)" -g "*.erl(:r)"' \ + 'verbose[Verbosity level]::verbosity level:(0 1 2 3)' \ + 'appid[Application id]:' \ + 'previous_release[Previous release path]:' \ + 'nodeid[Node id]:' \ + 'root_dir[Reltool config root directory]::directory:_files -/' \ + 'skip_deps[Skip deps]::flag:(true false)' \ + 'skip_apps[Application names to not process]::flag:(true false)' \ + 'template[Template name]:' \ + 'template_dir[Template directory]::directory:_files -/' \ + && ret=0 + ;; + esac +} + +_rebar + +# Local variables: +# mode: shell-script +# sh-basic-offset: 2 +# sh-indent-comment: t +# indent-tabs-mode: nil +# End: +# ex: sw=2 ts=2 et filetype=sh diff --git a/oh-my-zsh/plugins/redis-cli/_redis-cli b/oh-my-zsh/plugins/redis-cli/_redis-cli @@ -0,0 +1,142 @@ +#compdef redis-cli rec +#autoload + +#redis cli completion, based off homebrew completion (ref. 2011-04-14) + +local -a _1st_arguments +_1st_arguments=( + 'append:append a value to a key' + 'auth:authenticate to the server' + 'bgrewriteeaof:asynchronously rewrite the append-only file' + 'bgsave:asynchornously save the dataset to disk' + 'blpop:remove and get the first element in a list, or block until one is available' + 'brpop:remove and get the last element in a list, or block until one is available' + 'brpoplpush:pop a value from a list, push it to another list and return it; or block until one is available' + # 'config get:get the value of a configuration parameter' + # 'config set:set a configuration parameter to the given value' + # 'config resetstat: reset the stats returned by INFO' + 'dbsize:return the number of keys in the selected database' + # 'debug object:get debugging information about a key' + # 'debug setgfault:make the server crash' + 'decr:decrement the integer value of a key by one' + 'decrby:decrement the integet value of a key by the given number' + 'del:delete a key' + 'discard:discard all commands issued after MULTI' + 'echo:echo the given string' + 'exec:execute all commands issued after a MULTI' + 'exists:determine if a key exists' + 'expire:set the time to live for a key, in seconds' + 'expireat:set the expiration for a key as a UNIX timestamp' + 'flushall:remove all keys from all databases' + 'flushdb:remove all keys from the current database' + 'get:get the value of a key' + 'getbit:returns the bit value at offset in the string value stored at key' + 'getrange:get a substring of the string stored at a key' + 'getset:set the string value of a key and return its old value' + 'hdel:delete a hash field' + 'hexists:determine if a hash field exists' + 'hget:get the value of a hash field' + 'hgetall:get all the fields and values in a hash' + 'hincrby:increment the integer value of a hash field by the given number' + 'hkeys:get all the fields in a hash' + 'hlen:get the number of fields in a hash' + 'hmget:get the values of all the given hash fields' + 'hmset:set multiple hash fields to multiple values' + 'hset:set the string value of a hash field' + 'hsetnx:set the value of a hash field, only if the field does not exist' + 'hvals:get all the values in a hash' + 'incr:increment the integer value of a key by one' + 'incrby:increment the integer value of a key by the given number' + 'info:get information and statistics about the server' + 'keys:find all keys matching the given pattern' + 'lastsave:get the UNIX timestamp of the last successful save to disk' + 'lindex:get an element from a list by its index' + 'linsert:insert an element before or after another element in a list' + 'llen:get the length of a list' + 'lpop:remove and get the first element in a list' + 'lpush:prepend a value to a list' + 'lpushx:prepend a value to a list, only if the list exists' + 'lrange:get a range of elements from a list' + 'lrem:remove elements from a list' + 'lset:set the value of an element in a list by its index' + 'ltrim:trim a list to the specified range' + 'mget:get the values of all the given keys' + 'monitor:listen for all requests received by the server in real time' + 'move:move a key to another database' + 'mset:set multiple keys to muliple values' + 'msetnx:set multiple keys tom ultiple values, only if none of the keys exist' + 'multi:mark the start of a transaction block' + 'object:inspect the internals of Redis objects' + 'persist:remove the expiration from a key' + 'ping:ping the server' + 'psubscribe:listen for messages published to channels matching the given patterns' + 'publish:post a message to a channel' + 'punsubscribe:stop listening for messages posted to channels matching the given patterns' + 'quit:close the connection' + 'randomkey:return a random key from the keyspace' + 'rename:rename a key' + 'renamenx:rename a key, only if the new key does not exist' + 'rpop:remove and get the last element in a list' + 'rpoplpush:remove the last element in a list, append it to another list and return it' + 'rpush:append a value to a list' + 'rpushx:append a value to a list, only if the list exists' + 'sadd:add a member to a set' + 'save:synchronously save the dataset to disk' + 'scard:get the number of members in a set' + 'sdiff:subtract multiple sets' + 'sdiffstore:subtract multiple sets and store the resulting set in a key' + 'select:change the selected database for the current connection' + 'set:set the string value of a key' + 'setbit:sets or clears the bit at offset in the string value stored at key' + 'setex:set the value and expiration of a key' + 'setnx:set the value of a key, only if the key does not exist' + 'setrange:overwrite part of a string at key starting at the specified offset' + 'shutdown:synchronously save the dataset to disk and then shut down the server' + 'sinter:intersect multiple sets' + 'sinterstore:intersect multiple sets and store the resulting set in a key' + 'sismember:determine if a given value is a member of a set' + 'slaveof:make the server a slave of another instance, or promote it as master' + 'smembers:get all the members in a set' + 'smove:move a member from one set to another' + 'sort:sort the elements in a list, set or sorted set' + 'spop:remove and return a random member from a set' + 'srandmember:get a random member from a set' + 'srem:remove a member from a set' + 'strlen:get the length of the value stored in a key' + 'subscribe:listen for messages published to the given channels' + 'sunion:add multiple sets' + 'sunionstore:add multiple sets and store the resulting set in a key' + 'ttl:get the time to live for a key' + 'type:determine the type stored at key' + 'unsubscribe:stop listening for messages posted to the given channels' + 'unwatch:forget about all watched keys' + 'watch:watch the given keys to determine execution of the MULTI/EXEC block' + 'zadd:add a member to a sorted set, or update its score if it already exists' + 'zcard:get the number of members in a sorted set' + 'zcount:count the members in a sorted set with scores within the given values' + 'zincrby:increment the score of a member in a sorted set' + 'zinterstore:intersect multiple sorted sets and store the resulting sorted set in a new key' + 'zrange:return a range of members in a sorted set, by index' + 'zrangebyscore:return a range of members in a sorted set, by score' + 'zrank:determine the index of a member in a sorted set' + 'zrem:remove a member from a sorted set' + 'zremrangebyrank:remove all members in a sorted set within the given indexes' + 'zremrangebyscore:remove all members in a sorted set within the given scores' + 'zrevrange:return a range of membrs in a sorted set, by index, with scores ordered from high to low' + 'zrevrangebyscore:return a range of members in a sorted set, by score, with scores ordered from high to low' + 'zrevrank:determine the index of a member in a sorted set, with scores ordered from high to low' + 'zscore:get the score associated with the given member in a sorted set' + 'zunionstore:add multiple sorted sets and store te resulting sorted set in a new key' +) + +local expl + +_arguments \ + '(-v --version)'{-v,--version}'[show version]' \ + '(-h --help)'{-h,--help}'[show help]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "redis-cli subcommand" _1st_arguments + return +fi+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/repo/README.md b/oh-my-zsh/plugins/repo/README.md @@ -0,0 +1,7 @@ +## repo +**Maintainer:** [Stibbons](https://github.com/Stibbons) + +This plugin mainly add support automatic completion for the repo command line tool: +http://code.google.com/p/git-repo/ + +* `r` aliases `repo` diff --git a/oh-my-zsh/plugins/repo/_repo b/oh-my-zsh/plugins/repo/_repo @@ -0,0 +1,272 @@ +#compdef repo + + +__git_apply_whitespace_strategies () +{ + declare -a strategies + + strategies=( + 'nowarn:turn off the trailing-whitespace warning' + 'warn:output trailing-whitespace warning, but apply patch' + 'fix:output trailing-whitespace warning and strip trailing whitespace' + 'error:output trailing-whitespace warning and refuse to apply patch' + 'error-all:same as "error", but output warnings for all files') + + _describe -t strategies 'trailing-whitespace resolution strategy' strategies $* +} + + +_repo() +{ + local context state state_descr line curcontext="$curcontext" + typeset -A opt_args + + local ret=1 + + _arguments -C \ + '(- 1 *)--help[show usage]'\ + '1:command:->command'\ + '*::args:->args' && ret=0 + + case $state in + (command) + repo list 2> /dev/null > /dev/null + if [[ $? == 0 ]]; then + local commands; + commands=( + 'abandon:Permanently abandon a development branch' + 'branch:View current topic branches' + 'branches:View current topic branches' + 'checkout:Checkout a branch for development' + 'cherry-pick:Cherry-pick a change.' + 'diff:Show changes between commit and working tree' + 'download:Download and checkout a change' + 'forall:execute command on several project' + 'grep:Print lines matching a pattern' + 'help:Display detailed help on a command' + 'init:Initialize repo in the current directory' + 'list:List projects and their associated directories' + 'manifest:Manifest inspection utility' + 'overview:Display overview of unmerged project branches' + 'prune:Prune (delete) already merged topics' + 'rebase:Rebase local branches on upstream branch' + 'selfupdate:Update repo to the latest version' + 'smartsync:Update working tree to the latest known good revision' + 'stage:Stage file(s) for commit' + 'start:Start a new branch for development' + 'status:Show the working tree status' + 'sync:Update working tree to the latest revision' + 'upload:Upload changes for code review' + 'version:Display the version of repo' + ) + _describe -t commands 'command' commands && ret=0 + else + local commands; + commands=( + 'init:Install repo in the current working directory' + 'help:Display detailed help on a command' + ) + _describe -t commands 'command' commands && ret=0 + fi + ;; + (args) + case $words[1] in + (branch | branches) + # TODO : list available projects and add them in list to feed compadd with + _arguments : \ + "(-h --help)"{-h,--help}"[Show help]" \ + ': :__repo_projects' \ + && ret=0 + ;; + (abandon) + # TODO : list available projects and add them in list to feed compadd with + _arguments : \ + "(-h --help)"{-h,--help}"[Show help]" \ + ':branch name:__repo_branch' \ + ': :__repo_projects'\ + && ret=0 + ;; + (checkout) + # TODO : list available projects and add them in list to feed compadd with + _arguments : \ + "(-h --help)"{-h,--help}"[Show help]" \ + ':branch name:__repo_branch' \ + ': :__repo_projects'\ + && ret=0 + ;; + (init) + _arguments : \ + "(-h --help)"{-h,--help}"[Show help]" \ + "(-q --quiet)"{-q,--quiet}"[be quiet]" \ + "(-u --manifest-url)"{-u,--manifest-url=}"[manifest repository location]":url:__repo_url_prompt \ + "(-b --manifest-branch)"{-b,--manifest-branch=}"[manifest branch or revision]":branch:__repo_branch\ + "(-m --manifest-name)"{-m,--manifest-name=}"[initial manifest file]":manifest_name:__repo_manifest_name\ + "(--mirror)--mirror[mirror the forrest]"\ + "(--reference)--reference=[location of mirror directory]":dir:_dirs\ + "(--depth)--depth=[create a shallow clone with given depth; see git clone]":depth:__repo_depth_prompt\ + "(-g --group=)"{-g,--group=}"[restrict manifest projects to ones with a specified group]":group:_group\ + "(-p --platform=)"{-p,--platform=}"[restrict manifest projects to ones with a specified platform group(auto|all|none|linux|darwin|...)]":platform:"(auto all none linux darwin)"\ + "(--repo-url)--repo-url=[repo repository location]":url:__repo_url_prompt\ + "(--repo-branch)--repo-branch[repo branch or revision]":branch_or_rev:__repo__repo_branch_or_rev\ + "(--no-repo-verify)--no-repo-verify[do not verify repo source code]"\ + "(--config-name)--config-name[Always prompt for name/e-mail]"\ + && ret=0 + ;; + (start) + _arguments : \ + "(-h --help)"{-h,--help}"[Show help]" \ + "(--all)--all=[begin branch in all projects]"\ + ':branch name:__repo_new__repo_branch_name' \ + ':projects:__repo_projects_or_all' \ + && ret=0 + ;; + (rebase) + _arguments : \ + "(-h --help)"{-h,--help}"[Show help]" \ + "(-i --interactive)"{-i,--interactive}"[interactive rebase (single project only)]: :__repo_projects" \ + "(-f --force-rebase)"{-f,--force-rebase}"[Pass --force-rebase to git rebase]" \ + "(--no-ff)--no-ff=[Pass --no-ff to git rebase]"\ + "(-q --quiet)"{-q,--quiet}"[Pass --quiet to git rebase]" \ + "(--autosquash)--no-ff[Pass --autosquash to git rebase]"\ + "(--whitespace=)--whitespace=[Pass --whitespace to git rebase]: :__git_apply_whitespace_strategies"\ + "(--auto-stash)--auto-stash[Stash local modifications before starting]"\ + && ret=0 + ;; + (checkout) + _arguments : \ + "(-h --help)"{-h,--help}"[Show help]" \ + ':branch name:__git_branch_names' \ + ':projects:__repo_projects' \ + && ret=0 + ;; + (list) + _arguments : \ + "(-h --help)"{-h,--help}"[Show help]" \ + && ret=0 + ;; + (status) + _arguments : \ + "(-h --help)"{-h,--help}"[Show help]" \ + "(-j --jobs)"{-j,--jobs}"[number of projects to check simultaneously]" \ + ':projects:__repo_projects' \ + && ret=0 + ;; + (sync) + _arguments : \ + "(-h --help)"{-h,--help}"[Show help]" \ + "(--no-force-broken)--no-force-broken[stop sync if a project fails to sync (probably because of permissions)]" \ + "(-l --local-only)"{-l,--local-only}"[only update working tree, don't fetch]" \ + "(-n --network-only)"{-n,--network-branch}"[fetch only, don't update working tree]" \ + "(-d --detach)"{-d,--detach}"[detach projects back to manifest revision]" \ + "(-c --current-branch)"{-c,--current-branch}"[fetch only current branch from server]" \ + "(-q --quiet)"{-q,--quiet}"[be more quiet]" \ + "(-j --jobs=)"{-j,--jobs=}"[projects to fetch simultaneously (default 1) (limited to 5)]:projects to fetch simultaneously (default 1) (limited to 5)" \ + "(-m --manifest-name=)"{-m,--manifest-name=}"[temporary manifest to use for this sync]:manifest xml file:_files -g *.xml" \ + "(--no-clone-bundle)--no-clone-bundle[disable use of /clone.bundle on HTTP/HTTPS]" \ + "(-s --smart-sync)"{-s,--smart-sync=}"[smart sync using manifest from a known tag]:tag:" \ + '(--no-repo-verify)--no-repo-verify[do not verify repo source code]' \ + ': :__repo_projects' \ + && ret=0 + ;; + (upload) + _arguments : \ + "(-h --help)"{-h,--help}"[Show help]" \ + "(-t)-t[Send local branch name to Gerrit Code Review]" \ + "(--re= --reviewers=)"{--re=,--reviewers=}"[Request reviews from these people]:Request reviews from these people:" \ + "(--cc=)--cc=[Also send email to these email addresses.]:email addresses:_email_addresses" \ + "(--br=)--br=[Branch to upload.]:branch:__repo_branch" \ + "(--cbr --current-branch)"{--cbr,--current-branch}"[Upload current git branch]" \ + "(-d --draft)"{-d,--draft}"[If specified, upload as a draft.]" \ + "(--verify --no-verify)--no-verify[Do not run the upload hook.]" \ + '(--verify --no-verify)--verify[Run the upload hook without prompting]' \ + ': :__repo_projects' \ + && ret=0 + ;; + (forall) + _arguments : \ + "(-h --help)"{-h,--help}"[Show help]" \ + "(-v --verbose)"{-v,--verbose}"[Show command error messages]" \ + '(-p)-p[Show project headers before output]' \ + ': :__repo_projects_mandatory' \ + "(-c --command -h --help -v --verbose -p)"{-c,--command}"[Command (and arguments) to execute]" \ + && ret=0 + ;; + *) + ret=0 + esac + ;; + esac + + return $ret +} + +__repo_reviewers() +{ + # _message -e url 'reviewers' +} + +__repo_url_prompt() +{ + _message -e url 'url' +} + +__repo_manifest_name() +{ + _message -e manifest_name 'manifest name' +} + +_group() +{ + _message -e group 'group' +} + +__repo_branch() +{ + #_message -e branch 'Repo branch' + branches=($(repo branches| cut -c4- | grep '|' | cut -d' ' -f1)) + _describe -t branches 'Select repo branch' branches +} + +__repo__repo_branch_or_rev() +{ + _message -e branch_or_rev 'repo branch or revision' +} + +__repo_depth_prompt() +{ + _message -e depth 'depth' +} + +__repo_projects() +{ + _message -e depth 'Optional option : <projects>...' + projects=($(repo list | cut -d' ' -f1)) + _describe -t projects 'Select projects (keep empty for selecting all projects)' projects +} + +__repo_projects_mandatory() +{ + projects=($(repo list | cut -d' ' -f1)) + #_describe -t projects 'Select projects to apply commands' projects + _values -s ' ' "Select projects to apply commands" $projects +} + +__repo_new__repo_branch_name() +{ + branches=($(repo branches| cut -c4- | grep '|' | cut -d' ' -f1)) + _describe "" branches + _message -e "branch name" 'Enter new branch name or select an existing repo branch' +} + +__repo_projects_or_all() +{ + #_message -e depth '[--all | <project>...]' + + projects=(--all $(repo list | cut -d' ' -f1)) + _describe -t projects 'Select projects or --all' projects + _describe -t --all 'All projects' +} + +_repo "$@" +return $? + diff --git a/oh-my-zsh/plugins/repo/repo.plugin.zsh b/oh-my-zsh/plugins/repo/repo.plugin.zsh @@ -0,0 +1,18 @@ +# Aliases +alias r='repo' +compdef _repo r=repo + +alias rra='repo rebase --auto-stash' +compdef _repo rra='repo rebase --auto-stash' + +alias rs='repo sync' +compdef _repo rs='repo sync' + +alias rsrra='repo sync ; repo rebase --auto-stash' +compdef _repo rsrra='repo sync ; repo rebase --auto-stash' + +alias ru='repo upload' +compdef _repo ru='repo upload' + +alias rst='repo status' +compdef _repo rst='repo status' diff --git a/oh-my-zsh/plugins/rsync/rsync.plugin.zsh b/oh-my-zsh/plugins/rsync/rsync.plugin.zsh @@ -0,0 +1,4 @@ +alias rsync-copy="rsync -avz --progress -h" +alias rsync-move="rsync -avz --progress -h --remove-source-files" +alias rsync-update="rsync -avzu --progress -h" +alias rsync-synchronize="rsync -avzu --delete --progress -h" diff --git a/oh-my-zsh/plugins/ruby/ruby.plugin.zsh b/oh-my-zsh/plugins/ruby/ruby.plugin.zsh @@ -0,0 +1,14 @@ +# TODO: Make this compatible with rvm. +# Run sudo gem on the system ruby, not the active ruby. +alias sgem='sudo gem' + +# Find ruby file +alias rfind='find . -name "*.rb" | xargs grep -n' + +# Shorthand Ruby +alias rb="ruby" + +# Gem Command Shorthands +alias gin="gem install" +alias gun="gem uninstall" +alias gli="gem list" diff --git a/oh-my-zsh/plugins/rust/_rust b/oh-my-zsh/plugins/rust/_rust @@ -0,0 +1,228 @@ +#compdef rustc + +local -a _rustc_opts_switches _rustc_opts_lint _rustc_opts_debug + +typeset -A opt_args + +_rustc_debuginfo_levels=( + "0[no debug info]" + "1[line-tables only (for stacktraces and breakpoints)]" + "2[full debug info with variable and type information (same as -g)]" +) + +_rustc_crate_types=( + 'bin' + 'lib' + 'rlib' + 'dylib' + 'cdylib' + 'staticlib' + 'proc-macro' +) + +_rustc_emit_types=( + 'asm' + 'llvm-bc' + 'llvm-ir' + 'obj' + 'metadata' + 'link' + 'dep-info' + 'mir' +) +_rustc_print_types=( + 'crate-name' + 'file-names' + 'sysroot' + 'cfg' + 'target-list' + 'target-cpus' + 'target-features' + 'relocation-models' + 'code-models' + 'target-spec-json' + 'native-static-libs' +) +_rustc_pretty_types=( + 'normal[un-annotated source]' + 'expanded[crates expanded]' + 'expanded,identified[fully parenthesized, AST nodes with IDs]' +) +_rustc_unpretty_types=( + 'normal[un-annotated source]' + 'expanded[crates expanded]' + 'expanded,identified[fully parenthesized, AST nodes with IDs]' + 'flowgraph=[graphviz formatted flowgraph for node]:NODEID:' + 'everybody_loops[all function bodies replaced with `loop {}`]' + 'hir[the HIR]' + 'hir,identified' + 'hir,typed[HIR with types for each node]' +) +_rustc_color_types=( + 'auto[colorize, if output goes to a tty (default)]' + 'always[always colorize output]' + 'never[never colorize output]' +) +_rustc_error_format=( + 'human' + 'json' +) + +_rustc_opts_vals=( + --cfg='[Configure the compilation environment]:SPEC:' + -L'[Add a directory to the library search path]:DIR:_files -/' + --crate-name='[Specify the name of the crate being built]' + --crate-type='[Comma separated list of types of crates for the compiler to emit]:TYPES:_values -s "," "Crate types" "$_rustc_crate_types[@]"' + --emit='[Comma separated list of types of output for the compiler to emit]:TYPES:_values -s "," "Emit Targets" "$_rustc_emit_types[@]"' + --print='[Comma separated list of compiler information to print on stdout]:TYPES:_values -s "," "Printable info" "$_rustc_print_types[@]"' + -o'[Write output to <filename>. Ignored if more than one --emit is specified.]:FILENAME:_files' + --out-dir='[Write output to compiler-chosen filename in <dir>. Ignored if -o is specified. (default the current directory)]:DIR:_files -/' + --explain='[Provide a detailed explanation of an error message]:OPT:' + --target='[Target triple cpu-manufacturer-kernel\[-os\] to compile]:TRIPLE:' + --extern'[Specify where an external rust library is located]:ARG:' + --sysroot='[Override the system root]:PATH:_files -/' + --error-format='[How errors and other messages are produced]:TYPES:_values "$_rustc_error_format"' + --debuginfo='[Emit DWARF debug info to the objects created]:LEVEL:_values "Debug Levels" "$_rustc_debuginfo_levels[@]"' + --dep-info='[Output dependency info to <filename> after compiling]::FILE:_files -/' + --opt-level='[Optimize with possible levels 0-3]:LEVEL:(0 1 2 3)' + --pretty='[Pretty-print the input instead of compiling]::TYPE:_values "TYPES" "$_rustc_pretty_types[@]"' + --unpretty='[Present the input source, unstable (and less-pretty)]::TYPE:_values "TYPES" "$_rustc_unpretty_types[@]"' + --color='[Configure coloring of output]:CONF:_values "COLORS" "$_rustc_color_types[@]"' + {-v,--version}'[Print version info and exit]::VERBOSE:(verbose)' +) + +_rustc_opts_switches=( + -g'[Equivalent to --debuginfo=2]' + -O'[Equivalent to --opt-level=2]' + --test'[Build a test harness]' + --verbose'[Use verbose output]' + {-h,--help}'[Display this message]' + --no-analysis'[Parse and expand the output, but run no analysis or produce output]' + --no-trans'[Run all passes except translation; no output]' + --parse-only'[Parse only; do not compile, assemble, or link]' + --print-crate-name'[Output the crate name and exit]' + --print-file-name'[Output the file(s) that would be written if compilation continued and exit]' +) +_rustc_opts_codegen=( + 'ar=[Path to the archive utility to use when assembling archives.]:BIN:_path_files' + 'linker=[Path to the linker utility to use when linking libraries, executables, and objects.]:BIN:_path_files' + 'link-args=[A space-separated list of extra arguments to pass to the linker when the linker is invoked.]:ARGS:' + 'target-cpu=[Selects a target processor. If the value is "help", then a list of available CPUs is printed.]:CPU:' + 'target-feature=[A space-separated list of features to enable or disable for the target. A preceding "+" enables a feature while a preceding "-" disables it. Available features can be discovered through target-cpu=help.]:FEATURE:' + 'passes=[A space-separated list of extra LLVM passes to run. A value of "list" will cause rustc to print all known passes and exit. The passes specified are appended at the end of the normal pass manager.]:LIST:' + 'llvm-args=[A space-separated list of arguments to pass through to LLVM.]:ARGS:' + 'save-temps[If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated throughout compilation in the output directory.]' + 'rpath[If specified, then the rpath value for dynamic libraries will be set in either dynamic library or executable outputs.]' + 'no-prepopulate-passes[Suppresses pre-population of the LLVM pass manager that is run over the module.]' + 'no-vectorize-loops[Suppresses running the loop vectorization LLVM pass, regardless of optimization level.]' + 'no-vectorize-slp[Suppresses running the LLVM SLP vectorization pass, regardless of optimization level.]' + 'soft-float[Generates software floating point library calls instead of hardware instructions.]' + 'prefer-dynamic[Prefers dynamic linking to static linking.]' + "no-integrated-as[Force usage of an external assembler rather than LLVM's integrated one.]" + 'no-redzone[disable the use of the redzone]' + 'relocation-model=[The relocation model to use. (default: pic)]:MODEL:(pic static dynamic-no-pic)' + 'code-model=[choose the code model to use (llc -code-model for details)]:MODEL:' + 'metadata=[metadata to mangle symbol names with]:VAL:' + 'extra-filenames=[extra data to put in each output filename]:VAL:' + 'codegen-units=[divide crate into N units to optimize in parallel]:N:' + 'help[Show all codegen options]' +) + +_rustc_opts_lint=( + 'help[Show a list of all lints]' + 'experimental[detects use of #\[experimental\] items]' + 'heap-memory[use of any (Box type or @ type) heap memory]' + 'managed-heap-memory[use of managed (@ type) heap memory]' + 'missing-doc[detects missing documentation for public members]' + 'non-uppercase-statics[static constants should have uppercase identifiers]' + 'owned-heap-memory[use of owned (~ type) heap memory]' + 'unnecessary-qualification[detects unnecessarily qualified names]' + 'unsafe-block[usage of an `unsafe` block]' + 'unstable[detects use of #\[unstable\] items (incl. items with no stability attribute)]' + 'unused-result[unused result of an expression in a statement]' + 'variant-size-difference[detects enums with widely varying variant sizes]' + 'ctypes[proper use of libc types in foreign modules]' + 'dead-assignment[detect assignments that will never be read]' + 'dead-code[detect piece of code that will never be used]' + 'deprecated[detects use of #\[deprecated\] items]' + 'non-camel-case-types[types, variants and traits should have camel case names]' + 'non-snake-case[methods, functions, lifetime parameters and modules should have snake case names]' + 'path-statement[path statements with no effect]' + 'raw-pointer-deriving[uses of #\[deriving\] with raw pointers are rarely correct]' + 'type-limits[comparisons made useless by limits of the types involved]' + 'type-overflow[literal out of range for its type]' + 'unnecessary-allocation[detects unnecessary allocations that can be eliminated]' + 'unnecessary-parens[`if`, `match`, `while` and `return` do not need parentheses]' + 'unreachable-code[detects unreachable code]' + 'unrecognized-lint[unrecognized lint attribute]' + 'unsigned-negate[using an unary minus operator on unsigned type]' + 'unused-attribute[detects attributes that were not used by the compiler]' + 'unused-imports[imports that are never used]' + 'unused-must-use[unused result of a type flagged as #\[must_use\]]' + "unused-mut[detect mut variables which don't need to be mutable]" + 'unused-unsafe[unnecessary use of an `unsafe` block]' + 'unused-variable[detect variables which are not used in any way]' + 'visible-private-types[detect use of private types in exported type signatures]' + 'warnings[mass-change the level for lints which produce warnings]' + 'while-true[suggest using `loop { }` instead of `while true { }`]' + 'unknown-crate-type[unknown crate type found in #\[crate_type\] directive]' + 'unknown-features[unknown features found in crate-level #\[feature\] directives]' + 'bad-style[group of non_camel_case_types, non_snake_case, non_uppercase_statics]' + 'unused[group of unused_imports, unused_variable, dead_assignment, dead_code, unused_mut, unreachable_code]' +) + +_rustc_opts_debug=( + 'verbose[in general, enable more debug printouts]' + 'span-free-formats[when debug-printing compiler state, do not include spans]' + "identify-regions[make unnamed regions display as '# (where # is some non-ident unique id)]" + 'emit-end-regions[emit EndRegion as part of MIR; enable transforms that solely process EndRegion]' + 'time-passes[measure time of each rustc pass]' + 'count-llvm-insns[count where LLVM instrs originate]' + 'time-llvm-passes[measure time of each LLVM pass]' + 'trans-stats[gather trans statistics]' + 'asm-comments[generate comments into the assembly (may change behavior)]' + 'no-verify[skip LLVM verification]' + 'borrowck-stats[gather borrowck statistics]' + 'no-landing-pads[omit landing pads for unwinding]' + 'debug-llvm[enable debug output from LLVM]' + 'show-span[show spans for compiler debugging]' + 'count-type-sizes[count the sizes of aggregate types]' + 'meta-stats[gather metadata statistics]' + 'no-opt[do not optimize, even if -O is passed]' + 'print-link-args[Print the arguments passed to the linker]' + 'gc[Garbage collect shared data (experimental)]' + 'print-llvm-passes[Prints the llvm optimization passes being run]' + 'lto[Perform LLVM link-time optimizations]' + 'ast-json[Print the AST as JSON and halt]' + 'ast-json-noexpand[Print the pre-expansion AST as JSON and halt]' + 'ls[List the symbols defined by a library crate]' + 'save-analysis[Write syntax and type analysis information in addition to normal output]' + 'flowgraph-print-loans[Include loan analysis data in --pretty flowgraph output]' + 'flowgraph-print-moves[Include move analysis data in --pretty flowgraph output]' + 'flowgraph-print-assigns[Include assignment analysis data in --pretty flowgraph output]' + 'flowgraph-print-all[Include all dataflow analysis data in --pretty flowgraph output]' +) + +_rustc_opts_fun_lint(){ + _values -s , 'options' \ + "$_rustc_opts_lint[@]" +} + +_rustc_opts_fun_debug(){ + _values 'options' "$_rustc_opts_debug[@]" +} + +_rustc_opts_fun_codegen(){ + _values 'options' "$_rustc_opts_codegen[@]" +} + +_arguments -s : \ + '(-W --warn)'{-W,--warn=}'[Set lint warnings]:lint options:_rustc_opts_fun_lint' \ + '(-A --allow)'{-A,--allow=}'[Set lint allowed]:lint options:_rustc_opts_fun_lint' \ + '(-D --deny)'{-D,--deny=}'[Set lint denied]:lint options:_rustc_opts_fun_lint' \ + '(-F --forbid)'{-F,--forbid=}'[Set lint forbidden]:lint options:_rustc_opts_fun_lint' \ + '*-Z[Set internal debugging options]:debug options:_rustc_opts_fun_debug' \ + '*-C[Set internal Codegen options]:codegen options:_rustc_opts_fun_codegen' \ + "$_rustc_opts_switches[@]" \ + "$_rustc_opts_vals[@]" \ + '::files:_files -g "*.rs"' diff --git a/oh-my-zsh/plugins/rvm/rvm.plugin.zsh b/oh-my-zsh/plugins/rvm/rvm.plugin.zsh @@ -0,0 +1,74 @@ +fpath=($rvm_path/scripts/zsh/Completion $fpath) + +alias rubies='rvm list rubies' +alias gemsets='rvm gemset list' + +local ruby18='ruby-1.8.7' +local ruby19='ruby-1.9.3' +local ruby20='ruby-2.0.0' +local ruby21='ruby-2.1.2' + +function rb18 { + if [ -z "$1" ]; then + rvm use "$ruby18" + else + rvm use "$ruby18@$1" + fi +} + +_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`} +compdef _rb18 rb18 + +function rb19 { + if [ -z "$1" ]; then + rvm use "$ruby19" + else + rvm use "$ruby19@$1" + fi +} + +_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`} +compdef _rb19 rb19 + +function rb20 { + if [ -z "$1" ]; then + rvm use "$ruby20" + else + rvm use "$ruby20@$1" + fi +} + +_rb20() {compadd `ls -1 $rvm_path/gems | grep "^$ruby20@" | sed -e "s/^$ruby20@//" | awk '{print $1}'`} +compdef _rb20 rb20 + +function rb21 { + if [ -z "$1" ]; then + rvm use "$ruby21" + else + rvm use "$ruby21@$1" + fi +} + +_rb21() {compadd `ls -1 $rvm_path/gems | grep "^$ruby21@" | sed -e "s/^$ruby21@//" | awk '{print $1}'`} +compdef _rb21 rb21 + +function rvm-update { + rvm get head +} + +# TODO: Make this usable w/o rvm. +function gems { + local current_ruby=`rvm-prompt i v p` + local current_gemset=`rvm-prompt g` + + gem list $@ | sed -E \ + -e "s/\([0-9, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \ + -e "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \ + -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ + -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" +} + +function _rvm_completion { + source $rvm_path"/scripts/zsh/Completion/_rvm" +} +compdef _rvm_completion rvm diff --git a/oh-my-zsh/plugins/safe-paste/safe-paste.plugin.zsh b/oh-my-zsh/plugins/safe-paste/safe-paste.plugin.zsh @@ -0,0 +1,54 @@ +# Code from Mikael Magnusson: http://www.zsh.org/mla/users/2011/msg00367.html +# +# Requires xterm, urxvt, iTerm2 or any other terminal that supports bracketed +# paste mode as documented: http://www.xfree86.org/current/ctlseqs.html + +# create a new keymap to use while pasting +bindkey -N paste +# make everything in this keymap call our custom widget +bindkey -R -M paste "^@"-"\M-^?" paste-insert +# these are the codes sent around the pasted text in bracketed +# paste mode. +# do the first one with both -M viins and -M vicmd in vi mode +bindkey '^[[200~' _start_paste +bindkey -M paste '^[[201~' _end_paste +# insert newlines rather than carriage returns when pasting newlines +bindkey -M paste -s '^M' '^J' + +zle -N _start_paste +zle -N _end_paste +zle -N zle-line-init _zle_line_init +zle -N zle-line-finish _zle_line_finish +zle -N paste-insert _paste_insert + +# switch the active keymap to paste mode +function _start_paste() { + bindkey -A paste main +} + +# go back to our normal keymap, and insert all the pasted text in the +# command line. this has the nice effect of making the whole paste be +# a single undo/redo event. +function _end_paste() { +#use bindkey -v here with vi mode probably. maybe you want to track +#if you were in ins or cmd mode and restore the right one. + bindkey -e + LBUFFER+=$_paste_content + unset _paste_content +} + +function _paste_insert() { + _paste_content+=$KEYS +} + +function _zle_line_init() { + # Tell terminal to send escape codes around pastes. + [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color || $TERM = screen || $TERM = screen-256color ]] && printf '\e[?2004h' +} + +function _zle_line_finish() { + # Tell it to stop when we leave zle, so pasting in other programs + # doesn't get the ^[[200~ codes around the pasted text. + [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color || $TERM = screen || $TERM = screen-256color ]] && printf '\e[?2004l' +} + diff --git a/oh-my-zsh/plugins/sbt/_sbt b/oh-my-zsh/plugins/sbt/_sbt @@ -0,0 +1,55 @@ +#compdef sbt +#autoload + +local -a _sbt_commands +_sbt_commands=( + 'clean:delete files produced by the build' + 'compile:compile sources' + 'console:start the Scala REPL with project classes on the classpath' + 'console-quick:start the Scala REPL with project deps on the classpath' + 'console-project:start the Scala REPL w/sbt+build-def on the classpath' + 'dist:generate distribution artifacts' + 'dist\:clean:clean distribution artifacts' + 'doc:generate API documentation' + 'gen-idea:generate Intellij Idea project files' + 'package:produce the main artifact, such as a binary jar' + 'package-doc:produce a doc artifact, such as a jar containing API docs' + 'package-src:produce a source artifact, such as a jar containing sources' + 'publish:publish artifacts to a repository' + 'publish-local:publish artifacts to the local repository' + 'run:run a main class' + 'run-main:run the main class selected by the first argument' + 'test:execute all tests' + 'test-only:execute the tests provided as arguments' + 'test-quick:execute previously failed tests' + 'update:resolve and optionally retrieve dependencies' +) + +local expl + +_arguments \ + '(-help)-h[prints an help message]' \ + '(-h)-help[prints an help message]' \ + '(-verbose)-v[this runner is chattier]' \ + '(-v)-verbose[this runner is chattier]' \ + '(-debug)-d[set sbt log level to debug]' \ + '(-d)-debug[set sbt log level to debug]' \ + '-no-colors[disable ANSI color codes]' \ + '-sbt-create[start even if current dir contains no sbt project]' \ + '-sbt-dir[path to global settings/plugins dir (default: ~/.sbt)]' \ + '-sbt-boot[path to shared boot dir (default: ~/.sbt/boot)]' \ + '-ivy[path to local Ivy repository (default: ~/.ivy2)]' \ + '-mem[set memory options]' \ + '-no-share[use all local caches; no sharing]' \ + '-no-global[use global caches, but do not use global ~/.sbt dir]' \ + '-jvm-debug[turn on JVM debugging, open at the given port]' \ + '-batch[disable interactive mode]' \ + '-sbt-version[use the specified version of sbt]' \ + '-sbt-jar[use the specified jar as the sbt launcher]' \ + '(-sbt-snapshot)-sbt-rc[use an RC version of sbt]' \ + '(-sbt-rc)-sbt-snapshot[use a snapshot version of sbt]' \ + '-java-home[alternate JAVA_HOME]' \ + '*:: :->subcmds' && return 0 + +_describe -t commands "sbt subcommand" _sbt_commands +return diff --git a/oh-my-zsh/plugins/sbt/sbt.plugin.zsh b/oh-my-zsh/plugins/sbt/sbt.plugin.zsh @@ -0,0 +1,24 @@ +# ------------------------------------------------------------------------------ +# FILE: sbt.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Mirko Caserta (mirko.caserta@gmail.com) +# VERSION: 1.0.2 +# ------------------------------------------------------------------------------ + +# aliases - mnemonic: prefix is 'sb' +alias sbc='sbt compile' +alias sbco='sbt console' +alias sbcq='sbt console-quick' +alias sbcl='sbt clean' +alias sbcp='sbt console-project' +alias sbd='sbt doc' +alias sbdc='sbt dist:clean' +alias sbdi='sbt dist' +alias sbgi='sbt gen-idea' +alias sbp='sbt publish' +alias sbpl='sbt publish-local' +alias sbr='sbt run' +alias sbrm='sbt run-main' +alias sbu='sbt update' +alias sbx='sbt test' +alias sba='sbt assembly' diff --git a/oh-my-zsh/plugins/scala/_scala b/oh-my-zsh/plugins/scala/_scala @@ -0,0 +1,249 @@ +#compdef scala scalac +# ------------------------------------------------------------------------------ +# Copyright (c) 2012 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for scala and scalac (http://www.scala-lang.org/). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Tony Sloane <inkytonik@gmail.com> +# +# ------------------------------------------------------------------------------ + +typeset -A opt_args +local context state line + +_scala_features () { + compadd "postfixOps" "reflectiveCalls" "implicitConversions" "higherKinds" \ + "existentials" "experimental.macros" "_" +} + +_scala_phases () { + compadd "parser" "namer" "packageobjects" "typer" "patmat" "superaccessors" \ + "extmethods" "pickler" "refchecks" "selectiveanf" "selectivecps" "uncurry" \ + "tailcalls" "specialize" "explicitouter" "erasure" "posterasure" "lazyvals" \ + "lambdalift" "constructors" "flatten" "mixin" "cleanup" "icode" "inliner" \ + "inlineExceptionHandlers" "closelim" "dce" "jvm" "terminal" +} + +local -a shared_opts +shared_opts=( + "-bootclasspath+[Override location of bootstrap class files]:bootstrap class directory:_files -/" + "-classpath+[Specify where to find user class files]:directory:_files -/" + "-D-[Pass -Dproperty=value directly to the runtime system]" + "-d+[Destination for generated classfiles]: directory or jar file:_files" + "-dependencyfile+[Set dependency tracking file]:dependency tracking file:_files" + "-deprecation[Emit warning and location for usages of deprecated APIs]" + "-encoding+[Specify character encoding used by source files]:encoding:" + "-explaintypes[Explain type errors in more detail]" + "-extdirs+[Override location of installed extensions]:extensions directory:_files -/" + "-g\:-[Set level of generated debugging info (default\: vars)]:debugging info level:(none source line vars notailcalls)" + "-help[Print a synopsis of standard options]" + "-J-[pass argument directly to Java runtime system]:JVM argument:" + "-javabootclasspath+[Override java boot classpath]:Java boot class path directory]:_files -/" + "-javaextdirs+[Override java extdirs classpath]:Java extdirs directory:_files -/" + "-language\:-[Enable one or more language features]:feature:_scala_features" + "-no-specialization[Ignore @specialize annotations]" + "-nobootcp[Do not use the boot classpath for the scala jars]" + "-nowarn[Generate no warnings]" + "-optimise[Generate faster bytecode by applying optimisations to the program]" + "-P\:-[Pass an option to a plugin (written plugin\:opt)]:plugin option:" + "-print[Print program with Scala-specific features removed]" + "-sourcepath+[Specify location(s) of source files]:source file directory:_files -/" + "-target\:-[Target platform for object files (default\: jvm-1.5)]:platform name:(jvm-1.5 msil)" + "-toolcp+[Add to the runner classpath]:directory:_files -/" + "-unchecked[Enable detailed unchecked (erasure) warnings]" + "-uniqid[Uniquely tag all identifiers in debugging output]" + "-usejavacp[Utilize the java.class.path in classpath resolution]" + "-verbose[Output messages about what the compiler is doing]" + "-version[Print product version and exit]" + "-X[Print a synopsis of advanced options]" + "-Y[Print a synopsis of private options]" +) + +local -a X_opts +X_opts=( + "-Xcheck-null[Warn upon selection of nullable reference]" + "-Xcheckinit[Wrap field accessors to throw an exception on uninitialized access]" + "-Xdisable-assertions[Generate no assertions or assumptions]" + "-Xelide-below+[Calls to @elidable methods are omitted if method priority is lower than integer argument]" + "-Xexperimental[Enable experimental extensions]" + "-Xfatal-warnings[Fail the compilation if there are any warnings]" + "-Xfull-lubs[Retains pre 2.10 behavior of less aggressive truncation of least upper bounds]" + "-Xfuture[Turn on future language features]" + "-Xgenerate-phase-graph+[Generate the phase graphs (outputs .dot files) to fileX.dot]:output file:_files" + "-Xlint[Enable recommended additional warnings]" + "-Xlog-free-terms[Print a message when reification creates a free term]" + "-Xlog-free-types[Print a message when reification resorts to generating a free type]" + "-Xlog-implicits[Show more detail on why some implicits are not applicable]" + "-Xlog-implicit-conversions[Print a message whenever an implicit conversion is inserted]" + "-Xlog-reflective-calls[Print a message when a reflective method call is generated]" + "-Xmacro-settings\:-[Custom settings for macros]:option" + "-Xmain-class+[Class for manifest's Main-Class entry (only useful with -d jar)]:path:" + "-Xmax-classfile-name+[Maximum filename length for generated classes]" + "-Xmigration[Warn about constructs whose behavior may have changed]" + "-Xno-forwarders[Do not generate static forwarders in mirror classes]" + "-Xno-patmat-analysis[Don't perform exhaustivity/unreachability analysis. Also, ignore @switch annotation]" + "-Xno-uescape[Disable handling of \u unicode escapes]" + "-Xnojline[Do not use JLine for editing]" + "-Xoldpatmat[Use the pre-2.10 pattern matcher. Otherwise, the 'virtualizing' pattern matcher is used in 2.10]" + "-Xprint\:-[Print out program after <phase>]:phase name:_scala_phases" + "-Xprint-icode\:-[Log internal icode to *.icode files after phase (default\: icode)]:phase name:_scala_phases" + "-Xprint-pos[Print tree positions, as offsets]" + "-Xprint-types[Print tree types (debugging option)]" + "-Xprompt[Display a prompt after each error (debugging option)]" + "-Xresident[Compiler stays resident: read source filenames from standard input]" + "-Xscript+[Treat the source file as a script and wrap it in a main method]:main object name" + "-Xshow-class+[Show internal representation of class]:class name" + "-Xshow-object+[Show internal representation of object]:object name" + "-Xshow-phases[Print a synopsis of compiler phases]" + "-Xsource-reader+[Specify a class name for a custom method of reading source files]:class name" + "-Xverify[Verify generic signatures in generated bytecode]" + + "-Xassem-extdirs+[List of directories containing assemblies (requires -target:msil) (default\: lib)]:assembly directory:_files -/" + "-Xassem-name+[Name of the output assembly (requires -target:msil)]:assembly name:_files" + "-Xassem-path+[List of assemblies referenced by the program (requires -target:msil)]:assembly path:_files" + "-Xsourcedir+[Mirror source folder structure in output directory (requires -target:msil)]:source directory:_files -/" + + "-Xplugin\:-[Load one or more plugins from file]:plugin file:_files" + "-Xpluginsdir+[Path to search compiler plugins]:plugin directory:_files -/" + "-Xplugin-list[Print a synopsis of loaded plugins]" + "-Xplugin-disable\:-[Disable the given plugin(s)]" + "-Xplugin-require\:-[Abort unless the given plugin(s) are available]" +) + +local -a Y_opts +Y_opts=( + "-Y[Print a synopsis of private options]" + "-Ybuild-manager-debug[Generate debug information for the Refined Build Manager compiler]" + "-Ybuilder-debug\:-[Compile using the specified build manager (default\: none)]:build manager:(none refined simple)" + "-Yclosure-elim[Perform closure elimination]" + "-Ycompact-trees[Use compact tree printer when displaying trees]" + "-Ydead-code[Perform dead code elimination]" + "-Ydependent-method-types[Allow dependent method types]" + "-Ydump-classes+[Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders)]:output directory:_files -/" + "-Yeta-expand-keeps-star[Eta-expand varargs methods to T* rather than Seq[T]. This is a temporary option to ease transition.]" + "-Ygen-javap+[Generate a parallel output directory of .javap files]:output directory:_files -/" + "-Yinfer-argument-types[Infer types for arguments of overridden methods]" + "-Yinline[Perform inlining when possible]" + "-Yinline-handlers[Perform exception handler inlining when possible]" + "-Yinline-warnings[Emit inlining warnings (normally suppressed due to high volume)]" + "-Yinvalidate+[Invalidate classpath entry before run]:classpath entry" + "-Ylinearizer\:-[Linearizer to use (default\: rpo)]:linearizer:(normal dfs rpo dump)" + "-Ylog-classpath[Output information about what classpath is being applied]" + "-Yno-adapted-args[Do not adapt an argument list (either by inserting unit or creating a tuple) to match the receiver]" + "-Ymacro-debug-lite[Trace essential macro-related activities]" + "-Ymacro-debug-verbose[Trace all macro-related activities: compilation, generation of synthetics, classloading, expansion, exceptions]" + "-Yno-completion[Disable tab-completion in the REPL]" + "-Yno-generic-signatures[Suppress generation of generic signatures for Java]" + "-Yno-imports[Compile without any implicit imports]" + "-Yno-predef[Compile without importing Predef]" + "-Yno-self-type-checks[Suppress check for self-type conformance among inherited members]" + "-Yno-squeeze[Disable creation of compact code in matching]" + "-Ynotnull[Enable (experimental and incomplete) scala.NotNull]" + "-Yoverride-objects[Allow member objects to be overridden]" + "-Yoverride-vars[Allow vars to be overridden]" + "-Ypmat-naive[Desugar matches as naively as possible]" + "-Ypresentation-delay+[Wait number of ms after typing before starting typechecking]" + "-Ypresentation-log+[Log presentation compiler events into file]:log file:_files" + "-Ypresentation-replay+[Replay presentation compiler events from file]:log file:_files" + "-Ypresentation-strict[Do not report type errors in sources with syntax errors]" + "-Ypresentation-verbose[Print information about presentation compiler tasks]" + "-Yprofile-class+[Specify name of profiler class]:profiler class name" + "-Yprofile-memory[Heap snapshot after compiler run (requires jgpagent on JVM -agentpath)]" + "-Yrangepos[Use range positions for syntax trees]" + "-Yrecursion+[Set recursion depth used when locking symbols]" + "-Yreify-copypaste[Dump the reified trees in copypasteable representation]" + "-Yrepl-sync[Do not use asynchronous code for REPL startup]" + "-Yresolve-term-conflict\:-[Resolve term conflicts (default\: error)]:resolution strategy:(package object error)" + "-Yself-in-annots[Include a \"self\" identifier inside of annotations]" + "-Yshow\:-[Show after <phase> (requires -Xshow-class or -Xshow-object)]:phase name:_scala_phases" + "-Yshow-syms[Print the AST symbol hierarchy after each phase]" + "-Yshow-symkinds[Print abbreviated symbol kinds next to symbol names]" + "-Yshow-trees[Print detailed ASTs (requires -Xprint\:phase)]" + "-Yshow-trees-compact[Print detailed ASTs in compact form (requires -Xprint\:)]" + "-Yshow-trees-stringified[Print stringifications along with detailed ASTs (requires -Xprint\:)]" + "-Ystatistics[Print compiler statistics]" + "-Ystruct-dispatch\:-[Structural method dispatch policy (default\: poly-cache)]:policy name:(no-cache mono-cache poly-cache invoke-dynamic)" + + "-Ybrowse\:-[Browse the abstract syntax tree after <phase>]:phase name:_scala_phases" + "-Ycheck\:-[Check the tree at the end of <phase>]:phase name:_scala_phases" + "-Ylog\:-[Log operations during <phase>]:phase name:_scala_phases" + "-Yprofile\:-[Profile CPU usage of given phases (requires jgpagent on JVM -agentpath)]:phase name:_scala_phases" + "-Yskip\:-[Skip <phase>]:phase name:_scala_phases" + "-Ystop-after\:-[Stop after given phase <phase>]:phase name:_scala_phases" + "-Ystop-before\:-[Stop before given phase <phase>]:phase name:_scala_phases" + + "-Ywarn-adapted-args[Warn if an argument list is modified to match the receiver]" + "-Ywarn-all[Enable all -Y warnings]" + "-Ywarn-dead-code[Warn when dead code is identified]" + "-Ywarn-inaccessible[Warn about inaccessible types in method signatures]" + "-Ywarn-nullary-override[Warn when non-nullary overrides nullary, e.g. def foo() over def foo]" + "-Ywarn-nullary-unit[Warn when nullary methods return Unit]" + "-Ywarn-numeric-widen[Warn when numerics are widened]" + "-Ywarn-value-discard[Warn when non-Unit expression results are unused]" + + "-Ybuild-manager-debug[Generate debug information for the Refined Build Manager compiler]" + "-Ybuilder-debug\:-[Compile using the specified build manager (default\: none)]:manager:(none refined simple)" + "-Ycompletion-debug[Trace all tab completion activity]" + "-Ydebug[Increase the quantity of debugging output]" + "-Ydoc-debug[Trace all scaladoc activity]" + "-Yide-debug[Generate, validate and output trees using the interactive compiler]" + "-Yinfer-debug[Trace type inference and implicit search]" + "-Yissue-debug[Print stack traces when a context issues an error]" + "-Ypatmat-debug[Trace pattern matching translation]" + "-Ypmat-debug[Trace all pattern matcher activity]" + "-Ypos-debug[Trace position validation]" + "-Ypresentation-debug[Enable debugging output for the presentation compiler]" + "-Yreify-debug[Trace reification]" + "-Yrepl-debug[Trace all REPL activity]" + "-Ytyper-debug[Trace all type assignments]" +) + +local -a scala_opts +scala_opts=( + "-e+[execute <string> as if entered in the repl]:string" \ + "-howtorun+[what to run (default\: guess)]:execution mode:(script object jar guess)" \ + "-i+[preload <file> before starting the repl]:file to preload:_files" \ + "-nc[no compilation daemon\: do not use the fsc offline compiler]" \ + "-save[save the compiled script in a jar for future use]" +) + +case $words[$CURRENT] in + -X*) _arguments $X_opts;; + -Y*) _arguments $Y_opts;; + *) case $service in + scala) _arguments $scala_opts $shared_opts "*::filename:_files";; + scalac) _arguments $shared_opts "*::filename:_files";; + esac +esac + +return 0 diff --git a/oh-my-zsh/plugins/scd/README.md b/oh-my-zsh/plugins/scd/README.md @@ -0,0 +1,123 @@ +# scd - smart change of directory + +Define `scd` shell function for changing to any directory with +a few keystrokes. + +`scd` keeps history of the visited directories, which serves as an index of +the known paths. The directory index is updated after every `cd` command in +the shell and can be also filled manually by running `scd -a`. To switch to +some directory, `scd` needs few fragments of the desired path to match with +the index. A selection menu is displayed in case of several matches, with a +preference given to recently visited paths. `scd` can create permanent +directory aliases, which appear as named directories in zsh session. + +## INSTALLATION NOTES + +Besides oh-my-zsh, `scd` can be used with *bash*, *dash* or *tcsh* +shells and is also available as [Vim](http://www.vim.org/) plugin and +[IPython](http://ipython.org/) extension. For installation details, see +https://github.com/pavoljuhas/smart-change-directory. + +## SYNOPSIS + +```sh +scd [options] [pattern1 pattern2 ...] +``` + +## OPTIONS + +<dl><dt> +-a, --add</dt><dd> + add specified directories to the directory index.</dd><dt> + +--unindex</dt><dd> + remove current or specified directories from the index.</dd><dt> + +-r, --recursive</dt><dd> + apply options <em>--add</em> or <em>--unindex</em> recursively.</dd><dt> + +--alias=ALIAS</dt><dd> + create alias for the current or specified directory and save it to + <em>~/.scdalias.zsh</em>.</dd><dt> + +--unalias</dt><dd> + remove ALIAS definition for the current or specified directory from + <em>~/.scdalias.zsh</em>.</dd><dt> + +-A, --all</dt><dd> + include all matching directories. Disregard matching by directory + alias and filtering of less likely paths.</dd><dt> + +--list</dt><dd> + show matching directories and exit.</dd><dt> + +-v, --verbose</dt><dd> + display directory rank in the selection menu.</dd><dt> + +-h, --help</dt><dd> + display this options summary and exit.</dd> +</dl> + +## Examples + +```sh +# Index recursively some paths for the very first run +scd -ar ~/Documents/ + +# Change to a directory path matching "doc" +scd doc + +# Change to a path matching all of "a", "b" and "c" +scd a b c + +# Change to a directory path that ends with "ts" +scd "ts$" + +# Show selection menu and ranking of 20 most likely directories +scd -v + +# Alias current directory as "xray" +scd --alias=xray + +# Jump to a previously defined aliased directory +scd xray +``` + +# FILES + +<dl><dt> +~/.scdhistory</dt><dd> + time-stamped index of visited directories.</dd><dt> + +~/.scdalias.zsh</dt><dd> + scd-generated definitions of directory aliases.</dd> +</dl> + +# ENVIRONMENT + +<dl><dt> +SCD_HISTFILE</dt><dd> + path to the scd index file (by default ~/.scdhistory).</dd><dt> + +SCD_HISTSIZE</dt><dd> + maximum number of entries in the index (5000). Index is trimmed when it + exceeds <em>SCD_HISTSIZE</em> by more than 20%.</dd><dt> + +SCD_MENUSIZE</dt><dd> + maximum number of items for directory selection menu (20).</dd><dt> + +SCD_MEANLIFE</dt><dd> + mean lifetime in seconds for exponential decay of directory + likelihood (86400).</dd><dt> + +SCD_THRESHOLD</dt><dd> + threshold for cumulative directory likelihood. Directories with + a lower likelihood compared to the best match are excluded (0.005). + </dd><dt> + +SCD_SCRIPT</dt><dd> + command script file where scd writes the final <code>cd</code> + command. This variable must be defined when scd runs in its own + process rather than as a shell function. It is up to the + scd caller to use the output in <em>SCD_SCRIPT</em>.</dd> +</dl> diff --git a/oh-my-zsh/plugins/scd/scd b/oh-my-zsh/plugins/scd/scd @@ -0,0 +1,390 @@ +#!/bin/zsh -f + +emulate -L zsh +local EXIT=return +if [[ $(whence -w $0) == *:' 'command ]]; then + emulate -R zsh + local RUNNING_AS_COMMAND=1 + EXIT=exit +fi + +local DOC='scd -- smart change to a recently used directory +usage: scd [options] [pattern1 pattern2 ...] +Go to a directory path that contains all fixed string patterns. Prefer +recent or frequently visited directories as found in the directory index. +Display a selection menu in case of multiple matches. + +Options: + -a, --add add specified directories to the directory index. + --unindex remove current or specified directories from the index. + -r, --recursive apply options --add or --unindex recursively. + --alias=ALIAS create alias for the current or specified directory and + store it in ~/.scdalias.zsh. + --unalias remove ALIAS definition for the current or specified + directory from ~/.scdalias.zsh. + -A, --all include all matching directories. Disregard matching by + directory alias and filtering of less likely paths. + --list show matching directories and exit. + -v, --verbose display directory rank in the selection menu. + -h, --help display this message and exit. +' + +local SCD_HISTFILE=${SCD_HISTFILE:-${HOME}/.scdhistory} +local SCD_HISTSIZE=${SCD_HISTSIZE:-5000} +local SCD_MENUSIZE=${SCD_MENUSIZE:-20} +local SCD_MEANLIFE=${SCD_MEANLIFE:-86400} +local SCD_THRESHOLD=${SCD_THRESHOLD:-0.005} +local SCD_SCRIPT=${RUNNING_AS_COMMAND:+$SCD_SCRIPT} +local SCD_ALIAS=~/.scdalias.zsh + +local ICASE a d m p i maxrank threshold +local opt_help opt_add opt_unindex opt_recursive opt_verbose +local opt_alias opt_unalias opt_all opt_list +local -A drank dalias +local dmatching +local last_directory + +setopt extendedhistory extendedglob noautonamedirs brace_ccl + +# If SCD_SCRIPT is defined make sure the file exists and is empty. +# This removes any previous old commands. +[[ -n "$SCD_SCRIPT" ]] && [[ -s $SCD_SCRIPT || ! -f $SCD_SCRIPT ]] && ( + umask 077 + : >| $SCD_SCRIPT +) + +# process command line options +zmodload -i zsh/zutil +zmodload -i zsh/datetime +zparseopts -D -- a=opt_add -add=opt_add -unindex=opt_unindex \ + r=opt_recursive -recursive=opt_recursive \ + -alias:=opt_alias -unalias=opt_unalias \ + A=opt_all -all=opt_all -list=opt_list \ + v=opt_verbose -verbose=opt_verbose h=opt_help -help=opt_help \ + || $EXIT $? + +if [[ -n $opt_help ]]; then + print $DOC + $EXIT +fi + +# load directory aliases if they exist +[[ -r $SCD_ALIAS ]] && source $SCD_ALIAS + +# Private internal functions are prefixed with _scd_Y19oug_. +# Clean them up when the scd function returns. +setopt localtraps +trap 'unfunction -m "_scd_Y19oug_*"' EXIT + +# works faster than the (:a) modifier and is compatible with zsh 4.2.6 +_scd_Y19oug_abspath() { + set -A $1 ${(ps:\0:)"$( + unfunction -m "*"; shift + for d; do + cd $d && print -Nr -- $PWD && cd $OLDPWD + done + )"} +} + +# define directory alias +if [[ -n $opt_alias ]]; then + if [[ -n $1 && ! -d $1 ]]; then + print -u2 "'$1' is not a directory." + $EXIT 1 + fi + a=${opt_alias[-1]#=} + _scd_Y19oug_abspath d ${1:-$PWD} + # alias in the current shell, update alias file if successful + hash -d -- $a=$d && + ( + umask 077 + hash -dr + [[ -r $SCD_ALIAS ]] && source $SCD_ALIAS + hash -d -- $a=$d + hash -dL >| $SCD_ALIAS + ) + $EXIT $? +fi + +# undefine directory alias +if [[ -n $opt_unalias ]]; then + if [[ -n $1 && ! -d $1 ]]; then + print -u2 "'$1' is not a directory." + $EXIT 1 + fi + _scd_Y19oug_abspath a ${1:-$PWD} + a=$(print -rD ${a}) + if [[ $a != [~][^/]## ]]; then + $EXIT + fi + a=${a#[~]} + # unalias in the current shell, update alias file if successful + if unhash -d -- $a 2>/dev/null && [[ -r $SCD_ALIAS ]]; then + ( + umask 077 + hash -dr + source $SCD_ALIAS + unhash -d -- $a 2>/dev/null && + hash -dL >| $SCD_ALIAS + ) + fi + $EXIT $? +fi + +# The "compress" function collapses repeated directories to +# one entry with a time stamp that gives equivalent-probability. +_scd_Y19oug_compress() { + awk -v epochseconds=$EPOCHSECONDS -v meanlife=$SCD_MEANLIFE ' + BEGIN { FS = "[:;]"; } + length($0) < 4096 && $2 > 0 { + tau = 1.0 * ($2 - epochseconds) / meanlife; + if (tau < -6.9078) tau = -6.9078; + prob = exp(tau); + sub(/^[^;]*;/, ""); + if (NF) { + dlist[last[$0]] = ""; + dlist[NR] = $0; + last[$0] = NR; + ptot[$0] += prob; + } + } + END { + for (i = 1; i <= NR; ++i) { + d = dlist[i]; + if (d) { + ts = log(ptot[d]) * meanlife + epochseconds; + printf(": %.0f:0;%s\n", ts, d); + } + } + } + ' $* +} + +# Rewrite directory index if it is at least 20% oversized +if [[ -s $SCD_HISTFILE ]] && \ +(( $(wc -l <$SCD_HISTFILE) > 1.2 * $SCD_HISTSIZE )); then + # compress repeated entries + m=( ${(f)"$(_scd_Y19oug_compress $SCD_HISTFILE)"} ) + # purge non-existent directories + m=( ${(f)"$( + for a in $m; do + if [[ -d ${a#*;} ]]; then print -r -- $a; fi + done + )"} + ) + # cut old entries if still oversized + if [[ $#m -gt $SCD_HISTSIZE ]]; then + m=( ${m[-$SCD_HISTSIZE,-1]} ) + fi + print -lr -- $m >| ${SCD_HISTFILE} +fi + +# Determine the last recorded directory +if [[ -s ${SCD_HISTFILE} ]]; then + last_directory=${"$(tail -1 ${SCD_HISTFILE})"#*;} +fi + +# The "record" function adds its arguments to the directory index. +_scd_Y19oug_record() { + while [[ -n $last_directory && $1 == $last_directory ]]; do + shift + done + if [[ $# -gt 0 ]]; then + ( umask 077 + p=": ${EPOCHSECONDS}:0;" + print -lr -- ${p}${^*} >>| $SCD_HISTFILE ) + fi +} + +if [[ -n $opt_add ]]; then + for d; do + if [[ ! -d $d ]]; then + print -u2 "Directory '$d' does not exist." + $EXIT 2 + fi + done + _scd_Y19oug_abspath m ${*:-$PWD} + _scd_Y19oug_record $m + if [[ -n $opt_recursive ]]; then + for d in $m; do + print -n "scanning ${d} ... " + _scd_Y19oug_record ${d}/**/*(-/N) + print "[done]" + done + fi + $EXIT +fi + +# take care of removing entries from the directory index +if [[ -n $opt_unindex ]]; then + if [[ ! -s $SCD_HISTFILE ]]; then + $EXIT + fi + # expand existing directories in the argument list + for i in {1..$#}; do + if [[ -d ${argv[i]} ]]; then + _scd_Y19oug_abspath d ${argv[i]} + argv[i]=${d} + fi + done + m="$(awk -v recursive=${opt_recursive} ' + BEGIN { + for (i = 2; i < ARGC; ++i) { + argset[ARGV[i]] = 1; + delete ARGV[i]; + } + } + 1 { + d = $0; sub(/^[^;]*;/, "", d); + if (d in argset) next; + } + recursive { + for (a in argset) { + if (substr(d, 1, length(a) + 1) == a"/") next; + } + } + { print $0 } + ' $SCD_HISTFILE ${*:-$PWD} )" || $EXIT $? + : >| ${SCD_HISTFILE} + [[ ${#m} == 0 ]] || print -r -- $m >> ${SCD_HISTFILE} + $EXIT +fi + +# The "action" function is called when there is just one target directory. +_scd_Y19oug_action() { + cd $1 || return $? + if [[ -z $SCD_SCRIPT && -n $RUNNING_AS_COMMAND ]]; then + print -u2 "Warning: running as command with SCD_SCRIPT undefined." + fi + if [[ -n $SCD_SCRIPT ]]; then + print -r "cd ${(q)1}" >| $SCD_SCRIPT + fi +} + +# Match and rank patterns to the index file +# set global arrays dmatching and drank +_scd_Y19oug_match() { + ## single argument that is an existing directory or directory alias + if [[ -z $opt_all && $# == 1 ]] && \ + [[ -d ${d::=$1} || -d ${d::=${nameddirs[$1]}} ]] && [[ -x $d ]]; + then + _scd_Y19oug_abspath dmatching $d + drank[${dmatching[1]}]=1 + return + fi + + # ignore case unless there is an argument with an uppercase letter + [[ "$*" == *[[:upper:]]* ]] || ICASE='(#i)' + # support "$" as an anchor for the directory name ending + argv=( ${argv/(#m)?[$](#e)/${MATCH[1]}(#e)} ) + + # calculate rank of all directories in the SCD_HISTFILE and keep it as drank + # include a dummy entry for splitting of an empty string is buggy + [[ -s $SCD_HISTFILE ]] && drank=( ${(f)"$( + print -l /dev/null -10 + <$SCD_HISTFILE \ + awk -v epochseconds=$EPOCHSECONDS -v meanlife=$SCD_MEANLIFE ' + BEGIN { FS = "[:;]"; } + length($0) < 4096 && $2 > 0 { + tau = 1.0 * ($2 - epochseconds) / meanlife; + if (tau < -6.9078) tau = -6.9078; + prob = exp(tau); + sub(/^[^;]*;/, ""); + if (NF) ptot[$0] += prob; + } + END { for (di in ptot) { print di; print ptot[di]; } }' + )"} + ) + unset "drank[/dev/null]" + + # filter drank to the entries that match all arguments + for a; do + p=${ICASE}"*(${a})*" + drank=( ${(kv)drank[(I)${~p}]} ) + done + # require at least one argument matches the directory name + p=${ICASE}"*(${(j:|:)argv})[^/]#" + drank=( ${(kv)drank[(I)${~p}]} ) + + # build a list of matching directories reverse-sorted by their probabilities + dmatching=( ${(f)"$( + for d p in ${(kv)drank}; do + print -r -- "$p $d"; + done | sort -grk1 | cut -d ' ' -f 2- + )"} + ) + + # do not match $HOME or $PWD when run without arguments + if [[ $# == 0 ]]; then + dmatching=( ${dmatching:#(${HOME}|${PWD})} ) + fi + + # keep at most SCD_MENUSIZE of matching and valid directories + m=( ) + for d in $dmatching; do + [[ ${#m} == $SCD_MENUSIZE ]] && break + [[ -d $d && -x $d ]] && m+=$d + done + dmatching=( $m ) + + # find the maximum rank + maxrank=0.0 + for d in $dmatching; do + [[ ${drank[$d]} -lt maxrank ]] || maxrank=${drank[$d]} + done + + # discard all directories below the rank threshold + threshold=$(( maxrank * SCD_THRESHOLD )) + if [[ -n ${opt_all} ]]; then + threshold=0 + fi + dmatching=( ${^dmatching}(Ne:'(( ${drank[$REPLY]} >= threshold ))':) ) +} + +_scd_Y19oug_match $* + +## process whatever directories that remained +if [[ ${#dmatching} == 0 ]]; then + print -u2 "No matching directory." + $EXIT 1 +fi + +## build formatted directory aliases for selection menu or list display +for d in $dmatching; do + if [[ -n ${opt_verbose} ]]; then + dalias[$d]=$(printf "%.3g %s" ${drank[$d]} $d) + else + dalias[$d]=$(print -Dr -- $d) + fi +done + +## process the --list option +if [[ -n $opt_list ]]; then + for d in $dmatching; do + print -r -- "# ${dalias[$d]}" + print -r -- $d + done + $EXIT +fi + +## process single directory match +if [[ ${#dmatching} == 1 ]]; then + _scd_Y19oug_action $dmatching + $EXIT $? +fi + +## here we have multiple matches - display selection menu +a=( {a-z} {A-Z} ) +a=( ${a[1,${#dmatching}]} ) +p=( ) +for i in {1..${#dmatching}}; do + [[ -n ${a[i]} ]] || break + p+="${a[i]}) ${dalias[${dmatching[i]}]}" +done + +print -c -r -- $p + +if read -s -k 1 d && [[ ${i::=${a[(I)$d]}} -gt 0 ]]; then + _scd_Y19oug_action ${dmatching[i]} + $EXIT $? +fi diff --git a/oh-my-zsh/plugins/scd/scd.plugin.zsh b/oh-my-zsh/plugins/scd/scd.plugin.zsh @@ -0,0 +1,19 @@ +## The scd script should autoload as a shell function. +autoload scd + + +## If the scd function exists, define a change-directory-hook function +## to record visited directories in the scd index. +if [[ ${+functions[scd]} == 1 ]]; then + scd_chpwd_hook() { scd --add $PWD } + autoload add-zsh-hook + add-zsh-hook chpwd scd_chpwd_hook +fi + + +## Allow scd usage with unquoted wildcard characters such as "*" or "?". +alias scd='noglob scd' + + +## Load the directory aliases created by scd if any. +if [[ -s ~/.scdalias.zsh ]]; then source ~/.scdalias.zsh; fi diff --git a/oh-my-zsh/plugins/screen/screen.plugin.zsh b/oh-my-zsh/plugins/screen/screen.plugin.zsh @@ -0,0 +1,54 @@ +# if using GNU screen, let the zsh tell screen what the title and hardstatus +# of the tab window should be. +if [[ "$TERM" == screen* ]]; then + if [[ $_GET_PATH == '' ]]; then + _GET_PATH='echo $PWD | sed "s/^\/Users\//~/;s/^\/home\//~/;s/^~$USER/~/"' + fi + if [[ $_GET_HOST == '' ]]; then + _GET_HOST='echo $HOST | sed "s/\..*//"' + fi + + # use the current user as the prefix of the current tab title + TAB_TITLE_PREFIX='"`'$_GET_HOST'`:`'$_GET_PATH' | sed "s:..*/::"`$PROMPT_CHAR"' + # when at the shell prompt, show a truncated version of the current path (with + # standard ~ replacement) as the rest of the title. + TAB_TITLE_PROMPT='$SHELL:t' + # when running a command, show the title of the command as the rest of the + # title (truncate to drop the path to the command) + TAB_TITLE_EXEC='$cmd[1]:t' + + # use the current path (with standard ~ replacement) in square brackets as the + # prefix of the tab window hardstatus. + TAB_HARDSTATUS_PREFIX='"[`'$_GET_PATH'`] "' + # when at the shell prompt, use the shell name (truncated to remove the path to + # the shell) as the rest of the title + TAB_HARDSTATUS_PROMPT='$SHELL:t' + # when running a command, show the command name and arguments as the rest of + # the title + TAB_HARDSTATUS_EXEC='$cmd' + + # tell GNU screen what the tab window title ($1) and the hardstatus($2) should be + function screen_set() + { + # set the tab window title (%t) for screen + print -nR $'\033k'$1$'\033'\\\ + + # set hardstatus of tab window (%h) for screen + print -nR $'\033]0;'$2$'\a' + } + # called by zsh before executing a command + function preexec() + { + local -a cmd; cmd=(${(z)1}) # the command string + eval "tab_title=$TAB_TITLE_PREFIX:$TAB_TITLE_EXEC" + eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX:$TAB_HARDSTATUS_EXEC" + screen_set $tab_title $tab_hardstatus + } + # called by zsh before showing the prompt + function precmd() + { + eval "tab_title=$TAB_TITLE_PREFIX:$TAB_TITLE_PROMPT" + eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX:$TAB_HARDSTATUS_PROMPT" + screen_set $tab_title $tab_hardstatus + } +fi+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/scw/README.md b/oh-my-zsh/plugins/scw/README.md @@ -0,0 +1,7 @@ +## Scaleway CLI autocomplete plugin + +[scw](https://github.com/scaleway/scaleway-cli): Manage Bare Metal servers from Command Line (as easily as with Docker) + +- Adds autocomplete options for all `scw` commands. + +Maintainer : Manfred Touron ([@moul](https://github.com/moul)) diff --git a/oh-my-zsh/plugins/scw/_scw b/oh-my-zsh/plugins/scw/_scw @@ -0,0 +1,333 @@ +#compdef scw +# +# zsh completion for scw (http://scaleway.com) +# +# Inspired by https://github.com/felixr/docker-zsh-completion + +__scw_get_servers() { + local expl + declare -a servers + servers=(${(f)"$(_call_program commands scw _completion servers-names)"}) + _describe -t servers "servers" servers +} + +__scw_stoppedservers() { + __scw_get_servers +} + +__scw_runningservers() { + __scw_get_servers +} + +__scw_servers () { + __scw_get_servers +} + +__scw_images () { + local expl + declare -a images + images=(${(f)"$(_call_program commands scw _completion images-names)"}) + _describe -t images "images" images +} + +__scw_images_and_snapshots () { + __scw_images + __scw_snapshots +} + +__scw_snapshots () { + local expl + declare -a snapshots + snapshots=(${(f)"$(_call_program commands scw _completion --prefix snapshots-names)"}) + _describe -t snapshots "snapshots" snapshots +} + +__scw_bootscripts () { + local expl + declare -a bootscripts + bootscripts=(${(f)"$(_call_program commands scw _completion bootscripts-names)"}) + _describe -t bootscripts "bootscripts" bootscripts +} + +__scw_tags() { + __scw_images +} + +__scw_repositories_with_tags() { + __scw_images +} + +__scw_search() { + # declare -a scwsearch + local cache_policy + zstyle -s ":completion:${curcontext}:" cache-policy cache_policy + if [[ -z "$cache_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy __scw_caching_policy + fi + + local searchterm cachename + searchterm="${words[$CURRENT]%/}" + cachename=_scw-search-$searchterm + + local expl + local -a result + if ( [[ ${(P)+cachename} -eq 0 ]] || _cache_invalid ${cachename#_} ) \ + && ! _retrieve_cache ${cachename#_}; then + _message "Searching for ${searchterm}..." + result=(${${${(f)"$(_call_program commands scw search ${searchterm})"}%% *}[2,-1]}) + _store_cache ${cachename#_} result + fi + _wanted scwsearch expl 'available images' compadd -a result +} + +__scw_caching_policy() +{ + oldp=( "$1"(Nmh+1) ) # 1 hour + (( $#oldp )) +} + + +__scw_repositories () { + __scw_images +} + +__scw_commands () { + # local -a _scw_subcommands + local cache_policy + + zstyle -s ":completion:${curcontext}:" cache-policy cache_policy + if [[ -z "$cache_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy __scw_caching_policy + fi + + if ( [[ ${+_scw_subcommands} -eq 0 ]] || _cache_invalid scw_subcommands) \ + && ! _retrieve_cache scw_subcommands; + then + local -a lines + lines=(${(f)"$(_call_program commands scw 2>&1)"}) + _scw_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/ ##/:}) + _scw_subcommands=($_scw_subcommands 'help:Show help for a command') + _store_cache scw_subcommands _scw_subcommands + fi + _describe -t scw-commands "scw command" _scw_subcommands +} + +__scw_subcommand () { + local -a _command_args + case "$words[1]" in + (attach) + _arguments \ + '--no-stdin[Do not attach stdin]' \ + ':servers:__scw_runningservers' + ;; + (commit) + _arguments \ + {-v,--volume=0}'[Volume slot]:volume: ' \ + ':server:__scw_servers' \ + ':repository:__scw_repositories_with_tags' + ;; + (cp) + _arguments \ + ':server:->server' \ + ':hostpath:_files' + case $state in + (server) + if compset -P '*:'; then + _files + else + __scw_servers -qS ":" + fi + ;; + esac + ;; + (exec) + local state ret + _arguments \ + {-T,--timeout=0}'[Set timeout values to seconds]' \ + {-w,--wait}'[Wait for SSH to be ready]' \ + ':servers:__scw_runningservers' \ + '*::command:->anycommand' && ret=0 + + case $state in + (anycommand) + shift 1 words + (( CURRENT-- )) + _normal + ;; + esac + + return ret + ;; + (history) + _arguments \ + '--no-trunc[Do not truncate output]' \ + {-q,--quiet}'[Only show numeric IDs]' \ + '*:images:__scw_images' + ;; + (images) + _arguments \ + {-a,--all}'[Show all images]' \ + '--no-trunc[Do not truncate output]' \ + {-q,--quiet}'[Only show numeric IDs]' \ + ':repository:__scw_repositories' + ;; + (info) + ;; + (inspect) + _arguments \ + {-f,--format=-}'[Format the output using the given go template]:template: ' \ + '*:servers:__scw_servers' + ;; + (kill) + _arguments \ + '*:servers:__scw_runningservers' + ;; + (login) + _arguments \ + {-o,--organization=-}'[Organization]:organization: ' \ + {-t,--token=-}'[Token]:token: ' \ + ':server: ' + ;; + (logout) + _arguments \ + ':server: ' + ;; + (logs) + _arguments \ + '*:servers:__scw_servers' + ;; + (port) + _arguments \ + '1:servers:__scw_runningservers' \ + '2:port:_ports' + ;; + (start) + _arguments \ + {-T,--timeout=0}'[Set timeout values to seconds]' \ + {-w,--wait}'[Wait for SSH to be ready]' \ + '*:servers:__scw_stoppedservers' + ;; + (rm) + _arguments \ + '*:servers:__scw_stoppedservers' + ;; + (rmi) + _arguments \ + '*:images:__scw_images' + ;; + (restart) + _arguments \ + '*:servers:__scw_runningservers' + ;; + (stop) + _arguments \ + {-t,--terminate}'[Stop and trash a server with its volumes]' \ + {-w,--wait}'[Synchronous stop. Wait for server to be stopped]' \ + '*:servers:__scw_runningservers' + ;; + (top) + _arguments \ + '1:servers:__scw_runningservers' \ + '(-)*:: :->ps-arguments' + case $state in + (ps-arguments) + _ps + ;; + esac + ;; + (ps) + _arguments \ + {-a,--all}'[Show all servers. Only running servers are shown by default]' \ + {-l,--latest}'[Show only the latest created server]' \ + '-n[Show n last created servers, include non-running one]:n:(1 5 10 25 50)' \ + '--no-trunc[Do not truncate output]' \ + {-q,--quiet}'[Only show numeric IDs]' + ;; + (tag) + _arguments \ + {-f,--force}'[force]'\ + ':image:__scw_images'\ + ':repository:__scw_repositories_with_tags' + ;; + (create|run) + _arguments \ + {-a,--attach}'[Attach to stdin, stdout or stderr]' \ + '*'{-e,--environment=-}'[Set environment variables]:environment variable: ' \ + '--name=-[Server name]:name: ' \ + '--bootscript=-[Assign a bootscript]:bootscript:__scw_bootscripts ' \ + '*-v[Bind mount a volume]:volume: '\ + '(-):images:__scw_images_and_snapshots' \ + '(-):command: _command_names -e' \ + '*::arguments: _normal' + + case $state in + (link) + if compset -P '*:'; then + _wanted alias expl 'Alias' compadd -E "" + else + __scw_runningservers -qS ":" + fi + ;; + esac + ;; + (rename) + _arguments \ + ':old name:__scw_servers' \ + ':new name: ' + ;; + (search) + _arguments \ + '--no-trunc[Do not truncate output]' \ + ':term: ' + ;; + (wait) + _arguments '*:servers:__scw_runningservers' + ;; + (help) + _arguments ':subcommand:__scw_commands' + ;; + (*) + _message 'Unknown sub command' + esac + +} + +_scw () { + # Support for subservices, which allows for `compdef _scw scw-shell=_scw_servers`. + # Based on /usr/share/zsh/functions/Completion/Unix/_git without support for `ret`. + if [[ $service != scw ]]; then + _call_function - _$service + return + fi + + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + '-H[tcp://host:port to bind/connect to]:socket: ' \ + '(-): :->command' \ + '(-)*:: :->option-or-argument' + + if (( CURRENT == 1 )); then + + fi + case $state in + (command) + __scw_commands + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:scw-$words[1]: + __scw_subcommand + ;; + esac +} + +_scw "$@" + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 4 +# indent-tabs-mode: nil +# sh-basic-offset: 4 +# End: +# vim: ft=zsh sw=4 ts=4 et diff --git a/oh-my-zsh/plugins/sfffe/sfffe.plugin.zsh b/oh-my-zsh/plugins/sfffe/sfffe.plugin.zsh @@ -0,0 +1,28 @@ +# ------------------------------------------------------------------------------ +# FILE: sfffe.plugin.zsh +# DESCRIPTION: search file for FE +# AUTHOR: yleo77 (ylep77@gmail.com) +# VERSION: 0.1 +# REQUIRE: ack +# ------------------------------------------------------------------------------ + +if [ ! -x $(which ack) ]; then + echo \'ack\' is not installed! + exit -1 +fi + +ajs() { + ack "$@" --type js +} + +acss() { + ack "$@" --type css +} + +fjs() { + find ./ -name "$@*" -type f | grep '\.js' +} + +fcss() { + find ./ -name "$@*" -type f | grep '\.css' +} diff --git a/oh-my-zsh/plugins/shrink-path/README.md b/oh-my-zsh/plugins/shrink-path/README.md @@ -0,0 +1,68 @@ +# A plugin to shrink directory paths for brevity and pretty-printing + + +## Examples + +For this directory tree: +``` + /home/ + me/ + foo/ + bar/ + quux/ + biz/ # The prefix b is ambiguous between bar and biz. +``` +here are the results of calling `shrink_path <option> /home/me/foo/bar/quux`: +``` + Option Result + <none> /h/m/f/ba/q + -l|--last /h/m/f/ba/quux + -s|--short /h/m/f/b/q + -t|--tilde ~/f/ba/q + -f|--fish ~/f/b/quux +``` + + +## Usage + +For a fish-style working directory in your command prompt, add the following to +your theme or zshrc: + +``` + setopt prompt_subst + PS1='%n@%m $(shrink_path -f)>' +``` + +The following options are available: + +``` + -f, --fish fish simulation, equivalent to -l -s -t. + -l, --last Print the last directory's full name. + -s, --short Truncate directory names to the first character. Without + -s, names are truncated without making them ambiguous. + -t, --tilde Substitute ~ for the home directory. + -T, --nameddirs Substitute named directories as well. +``` + +The long options can also be set via zstyle, like +``` + zstyle :prompt:shrink_path fish yes +``` + +Note: Directory names containing two or more consecutive spaces are not yet +supported. + + +## License + +Copyright (C) 2008 by Daniel Friesel <derf@xxxxxxxxxxxxxxxxxx> + +License: WTFPL <http://sam.zoy.org/wtfpl> + +Ref: http://www.zsh.org/mla/workers/2009/msg00415.html + http://www.zsh.org/mla/workers/2009/msg00419.html + + +## Misc + +Keywords: prompt directory truncate shrink collapse fish diff --git a/oh-my-zsh/plugins/shrink-path/shrink-path.plugin.zsh b/oh-my-zsh/plugins/shrink-path/shrink-path.plugin.zsh @@ -0,0 +1,127 @@ +# Shrink directory paths, e.g. /home/me/foo/bar/quux -> ~/f/b/quux. +# +# For a fish-style working directory in your command prompt, add the following +# to your theme or zshrc: +# +# setopt prompt_subst +# PS1='%n@%m $(shrink_path -f)>' +# +# The following options are available: +# +# -f, --fish fish simulation, equivalent to -l -s -t. +# -l, --last Print the last directory's full name. +# -s, --short Truncate directory names to the first character. Without +# -s, names are truncated without making them ambiguous. +# -t, --tilde Substitute ~ for the home directory. +# -T, --nameddirs Substitute named directories as well. +# +# The long options can also be set via zstyle, like +# zstyle :prompt:shrink_path fish yes +# +# Note: Directory names containing two or more consecutive spaces are not yet +# supported. +# +# Keywords: prompt directory truncate shrink collapse fish +# +# Copyright (C) 2008 by Daniel Friesel <derf@xxxxxxxxxxxxxxxxxx> +# License: WTFPL <http://sam.zoy.org/wtfpl> +# +# Ref: http://www.zsh.org/mla/workers/2009/msg00415.html +# http://www.zsh.org/mla/workers/2009/msg00419.html + +shrink_path () { + setopt localoptions + setopt rc_quotes null_glob + + typeset -i lastfull=0 + typeset -i short=0 + typeset -i tilde=0 + typeset -i named=0 + + if zstyle -t ':prompt:shrink_path' fish; then + lastfull=1 + short=1 + tilde=1 + fi + if zstyle -t ':prompt:shrink_path' nameddirs; then + tilde=1 + named=1 + fi + zstyle -t ':prompt:shrink_path' last && lastfull=1 + zstyle -t ':prompt:shrink_path' short && short=1 + zstyle -t ':prompt:shrink_path' tilde && tilde=1 + + while [[ $1 == -* ]]; do + case $1 in + -f|--fish) + lastfull=1 + short=1 + tilde=1 + ;; + -h|--help) + print 'Usage: shrink_path [-f -l -s -t] [directory]' + print ' -f, --fish fish-simulation, like -l -s -t' + print ' -l, --last Print the last directory''s full name' + print ' -s, --short Truncate directory names to the first character' + print ' -t, --tilde Substitute ~ for the home directory' + print ' -T, --nameddirs Substitute named directories as well' + print 'The long options can also be set via zstyle, like' + print ' zstyle :prompt:shrink_path fish yes' + return 0 + ;; + -l|--last) lastfull=1 ;; + -s|--short) short=1 ;; + -t|--tilde) tilde=1 ;; + -T|--nameddirs) + tilde=1 + named=1 + ;; + esac + shift + done + + typeset -a tree expn + typeset result part dir=${1-$PWD} + typeset -i i + + [[ -d $dir ]] || return 0 + + if (( named )) { + for part in ${(k)nameddirs}; { + [[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/${nameddirs[$part]}/\~$part} + } + } + (( tilde )) && dir=${dir/$HOME/\~} + tree=(${(s:/:)dir}) + ( + unfunction chpwd 2> /dev/null + if [[ $tree[1] == \~* ]] { + cd ${~tree[1]} + result=$tree[1] + shift tree + } else { + cd / + } + for dir in $tree; { + if (( lastfull && $#tree == 1 )) { + result+="/$tree" + break + } + expn=(a b) + part='' + i=0 + until [[ (( ${#expn} == 1 )) || $dir = $expn || $i -gt 99 ]] do + (( i++ )) + part+=$dir[$i] + expn=($(echo ${part}*(-/))) + (( short )) && break + done + result+="/$part" + cd $dir + shift tree + } + echo ${result:-/} + ) +} + +## vim:ft=zsh diff --git a/oh-my-zsh/plugins/singlechar/singlechar.plugin.zsh b/oh-my-zsh/plugins/singlechar/singlechar.plugin.zsh @@ -0,0 +1,133 @@ +################################################################################ +# FILE: singlechar.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Michael Varner (musikmichael@web.de) +# VERSION: 1.0.0 +# +# This plugin adds single char shortcuts (and combinations) for some commands. +# +################################################################################ + +########################### +# Settings + +# These can be overwritten any time. +# If they are not set yet, they will be +# overwritten with their default values + +default GREP grep +default ROOT sudo +default WGET wget +default CURL curl + +env_default PAGER less + +########################### +# Alias + +# CAT, GREP, CURL, WGET + +alias y='"$GREP" -Ri' +alias n='"$GREP" -Rvi' + +alias f.='find . | "$GREP"' +alias f:='find' + +alias f='"$GREP" -Rli' +alias fn='"$GREP" -Rlvi' + +alias w='echo >' +alias a='echo >>' + +alias c='cat' +alias p='"$PAGER"' + +alias m='man' + +alias d='"$WGET"' +alias u='"$CURL"' + +# enhanced writing + +alias w:='cat >' +alias a:='cat >>' + +# XARGS + +alias x='xargs' + +alias xy='xargs "$GREP" -Ri' +alias xn='xargs "$GREP" -Riv' + +alias xf.='xargs find | "$GREP"' +alias xf:='xargs find' + +alias xf='xargs "$GREP" -Rli' +alias xfn='xargs "$GREP" -Rlvi' + +alias xw='xargs echo >' +alias xa='xargs echo >>' + +alias xc='xargs cat' +alias xp='xargs "$PAGER"' + +alias xm='xargs man' + +alias xd='xargs "$WGET"' +alias xu='xargs "$CURL"' + +alias xw:='xargs cat >' +alias xa:='xargs >>' + +# SUDO + +alias s='"$ROOT"' + +alias sy='"$ROOT" "$GREP" -Ri' +alias sn='"$ROOT" "$GREP" -Riv' + +alias sf.='"$ROOT" find . | "$GREP"' +alias sf:='"$ROOT" find' + +alias sf='"$ROOT" "$GREP" -Rli' +alias sfn='"$ROOT" "$GREP" -Rlvi' + +alias sw='"$ROOT" echo >' +alias sa='"$ROOT" echo >>' + +alias sc='"$ROOT" cat' +alias sp='"$ROOT" "$PAGER"' + +alias sm='"$ROOT" man' + +alias sd='"$ROOT" "$WGET"' + +alias sw:='"$ROOT" cat >' +alias sa:='"$ROOT" cat >>' + +# SUDO-XARGS + +alias sx='"$ROOT" xargs' + +alias sxy='"$ROOT" xargs "$GREP" -Ri' +alias sxn='"$ROOT" xargs "$GREP" -Riv' + +alias sxf.='"$ROOT" xargs find | "$GREP"' +alias sxf:='"$ROOT" xargs find' + +alias sxf='"$ROOT" xargs "$GREP" -li' +alias sxfn='"$ROOT" xargs "$GREP" -lvi' + +alias sxw='"$ROOT" xargs echo >' +alias sxa='"$ROOT" xargs echo >>' + +alias sxc='"$ROOT" xargs cat' +alias sxp='"$ROOT" xargs "$PAGER"' + +alias sxm='"$ROOT" xargs man' + +alias sxd='"$ROOT" xargs "$WGET"' +alias sxu='"$ROOT" xargs "$CURL"' + +alias sxw:='"$ROOT" xargs cat >' +alias sxa:='"$ROOT" xargs cat >>'+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/spring/README.md b/oh-my-zsh/plugins/spring/README.md @@ -0,0 +1,25 @@ +# Spring Boot oh-my-zsh plugin +oh-my-zsh Spring Boot plugin + +## Spring Boot autocomplete plugin + +- Adds autocomplete options for all spring boot commands. + +## Manual Install + + $ cd ~/.oh-my-zsh/plugins + $ git clone git@github.com:linux-china/oh-my-zsh-spring-boot-plugin.git spring + +Adjust your .zshrc file and add spring to plugins=(...) + +## Tips + +* Install Spring Cloud plugin: spring install org.springframework.cloud:spring-cloud-cli:1.0.2.RELEASE + +## Reference + +* Spring Boot: http://projects.spring.io/spring-boot/ +* Spring Boot CLI: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#cli + +Maintainer : linux_china ([@linux_china](https://twitter.com/linux_china)) + diff --git a/oh-my-zsh/plugins/spring/_spring b/oh-my-zsh/plugins/spring/_spring @@ -0,0 +1,29 @@ +#compdef spring 'spring' +#autoload + +_spring() { + + local cword + let cword=CURRENT-1 + + local hints + hints=() + + local reply + while read -r line; do + reply=`echo "$line" | awk '{printf $1 ":"; for (i=2; i<NF; i++) printf $i " "; print $NF}'` + hints+=("$reply") + done < <(spring hint ${cword} ${words[*]}) + + if ((cword == 1)) { + _describe -t commands 'commands' hints + return 0 + } + + _describe -t options 'options' hints + _files + + return 0 +} + +_spring "$@"+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/sprunge/sprunge.plugin.zsh b/oh-my-zsh/plugins/sprunge/sprunge.plugin.zsh @@ -0,0 +1,62 @@ +# Contributed and SLIGHTLY modded by Matt Parnell/ilikenwf <parwok -at- gmail> +# Created by the blogger at the URL below...I don't know where to find his/her name +# Original found at http://www.shellperson.net/sprunge-pastebin-script/ + +usage() { +description | fmt -s >&2 +} + +description() { +cat << HERE + +DESCRIPTION + Upload data and fetch URL from the pastebin http://sprunge.us + +USAGE + $0 filename.txt + $0 text string + $0 < filename.txt + piped_data | $0 + +NOTES +-------------------------------------------------------------------------- +* INPUT METHODS * +$0 can accept piped data, STDIN redirection [<filename.txt], text strings following the command as arguments, or filenames as arguments. Only one of these methods can be used at a time, so please see the note on precedence. Also, note that using a pipe or STDIN redirection will treat tabs as spaces, or disregard them entirely (if they appear at the beginning of a line). So I suggest using a filename as an argument if tabs are important either to the function or readability of the code. + +* PRECEDENCE * +STDIN redirection has precedence, then piped input, then a filename as an argument, and finally text strings as an arguments. + + EXAMPLE: + echo piped | "$0" arguments.txt < stdin_redirection.txt + +In this example, the contents of file_as_stdin_redirection.txt would be uploaded. Both the piped_text and the file_as_argument.txt are ignored. If there is piped input and arguments, the arguments will be ignored, and the piped input uploaded. + +* FILENAMES * +If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but will instead treat it as a text string and upload it. +-------------------------------------------------------------------------- + +HERE +exit +} + +sprunge() { + if [ -t 0 ]; then + echo Running interactively, checking for arguments... >&2 + if [ "$*" ]; then + echo Arguments present... >&2 + if [ -f "$*" ]; then + echo Uploading the contents of "$*"... >&2 + cat "$*" + else + echo Uploading the text: \""$*"\"... >&2 + echo "$*" + fi | curl -F 'sprunge=<-' http://sprunge.us + else + echo No arguments found, printing USAGE and exiting. >&2 + usage + fi + else + echo Using input from a pipe or STDIN redirection... >&2 + curl -F 'sprunge=<-' http://sprunge.us + fi +} diff --git a/oh-my-zsh/plugins/ssh-agent/README.md b/oh-my-zsh/plugins/ssh-agent/README.md @@ -0,0 +1,38 @@ +# ssh-agent plugin + +This plugin starts automatically `ssh-agent` to set up and load whichever +credentials you want for ssh connections. + +To enable it, add `ssh-agent` to your plugins: + +```zsh +plugins=(... ssh-agent) +``` + +## Instructions + +To enable **agent forwarding support** add the following to your zshrc file: + +```zsh +zstyle :omz:plugins:ssh-agent agent-forwarding on +``` + +To **load multiple identities** use the `identities` style, For example: + +```zsh +zstyle :omz:plugins:ssh-agent identities id_rsa id_rsa2 id_github +``` + +To **set the maximum lifetime of the identities**, use the `lifetime` style. +The lifetime may be specified in seconds or as described in sshd_config(5) +(see _TIME FORMATS_). If left unspecified, the default lifetime is forever. + +```zsh +zstyle :omz:plugins:ssh-agent lifetime 4h +``` + +## Credits + +Based on code from Joseph M. Reagle: http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html + +Agent-forwarding support based on ideas from Florent Thoumie and Jonas Pfenniger diff --git a/oh-my-zsh/plugins/ssh-agent/ssh-agent.plugin.zsh b/oh-my-zsh/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -0,0 +1,42 @@ +typeset _agent_forwarding _ssh_env_cache + +function _start_agent() { + local lifetime + local -a identities + + # start ssh-agent and setup environment + zstyle -s :omz:plugins:ssh-agent lifetime lifetime + + ssh-agent -s ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' >! $_ssh_env_cache + chmod 600 $_ssh_env_cache + . $_ssh_env_cache > /dev/null + + # load identies + zstyle -a :omz:plugins:ssh-agent identities identities + + echo starting ssh-agent... + ssh-add $HOME/.ssh/${^identities} +} + +# Get the filename to store/lookup the environment from +_ssh_env_cache="$HOME/.ssh/environment-$SHORT_HOST" + +# test if agent-forwarding is enabled +zstyle -b :omz:plugins:ssh-agent agent-forwarding _agent_forwarding + +if [[ $_agent_forwarding == "yes" && -n "$SSH_AUTH_SOCK" ]]; then + # Add a nifty symlink for screen/tmux if agent forwarding + [[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen +elif [[ -f "$_ssh_env_cache" ]]; then + # Source SSH settings, if applicable + . $_ssh_env_cache > /dev/null + ps x | grep ssh-agent | grep -q $SSH_AGENT_PID || { + _start_agent + } +else + _start_agent +fi + +# tidy up after ourselves +unset _agent_forwarding _ssh_env_cache +unfunction _start_agent diff --git a/oh-my-zsh/plugins/stack/stack.plugin.zsh b/oh-my-zsh/plugins/stack/stack.plugin.zsh @@ -0,0 +1,37 @@ +function _stack_commands() { + local ret=1 state + _arguments ':subcommand:->subcommand' && ret=0 + + case $state in + subcommand) + subcommands=( + "build:Build the project(s) in this directory/configuration" + "install:Build executables and install to a user path" + "test:Build and test the project(s) in this directory/configuration" + "bench:Build and benchmark the project(s) in this directory/configuration" + "haddock:Generate haddocks for the project(s) in this directory/configuration" + "new:Create a brand new project" + "init:Initialize a stack project based on one or more stack packages" + "solver:Use a dependency solver to try and determine missing extra-deps" + "setup:Get the appropriate ghc for your project" + "path:Print out handy path information" + "unpack:Unpack one or more packages locally" + "update:Update the package index" + "upgrade:Upgrade to the latest stack (experimental)" + "upload:Upload a package to Hackage" + "dot:Visualize your project's dependency graph using Graphviz dot" + "exec:Execute a command" + "ghc:Run ghc" + "ghci:Run ghci in the context of project(s)" + "ide:Run ide-backend-client with the correct arguments" + "runghc:Run runghc" + "clean:Clean the local packages" + "docker:Subcommands specific to Docker use" + ) + _describe -t subcommands 'stack subcommands' subcommands && ret=0 + esac + + return ret +} + +compdef _stack_commands stack diff --git a/oh-my-zsh/plugins/sublime/README.md b/oh-my-zsh/plugins/sublime/README.md @@ -0,0 +1,25 @@ +## sublime + +Plugin for Sublime Text, a cross platform text and code editor, available for Linux, Mac OS X, and Windows. + +### Requirements + + * [Sublime Text](http://www.sublimetext.com/) + +### Usage + + * If `st` command is called without an argument, launch Sublime Text + + * If `st` is passed a directory, `cd` to it and open it in Sublime Text + + * If `st` is passed a file, open it in Sublime Text + + * If `stt` command is called, it is equivalent to `st .`, opening the current folder in Sublime Text + + * If `sst` command is called, it is like `sudo st`, opening the file or folder in Sublime Text. Useful for editing system protected files. + + * If `stp` command is called, it find a `.sublime-project` file by traversing up the directory structure. If there is no `.sublime-project` file, but if the current folder is a Git repo, opens up the root directory of the repo. If the current folder is not a Git repo, then opens up the current directory. + + * If `stn` command is called without an argument, create a stub `.sublime-project` file in the current working directory if one does not already exist + + * If `stn` is passed a directory, create a stub `.sublime-project` file in it diff --git a/oh-my-zsh/plugins/sublime/sublime.plugin.zsh b/oh-my-zsh/plugins/sublime/sublime.plugin.zsh @@ -0,0 +1,118 @@ +if [[ "$OSTYPE" == linux* ]]; then + local _sublime_linux_paths > /dev/null 2>&1 + _sublime_linux_paths=( + "$HOME/bin/sublime_text" + "/opt/sublime_text/sublime_text" + "/opt/sublime_text_3/sublime_text" + "/usr/bin/sublime_text" + "/usr/local/bin/sublime_text" + "/usr/bin/subl" + "/opt/sublime_text_3/sublime_text" + "/usr/bin/subl3" + ) + for _sublime_path in $_sublime_linux_paths; do + if [[ -a $_sublime_path ]]; then + st_run() { $_sublime_path $@ >/dev/null 2>&1 &| } + st_run_sudo() {sudo $_sublime_path $@ >/dev/null 2>&1} + alias sst=st_run_sudo + alias st=st_run + break + fi + done + +elif [[ "$OSTYPE" = darwin* ]]; then + local _sublime_darwin_paths > /dev/null 2>&1 + _sublime_darwin_paths=( + "/usr/local/bin/subl" + "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" + "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl" + "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" + "$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" + "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl" + "$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" + ) + for _sublime_path in $_sublime_darwin_paths; do + if [[ -a $_sublime_path ]]; then + subl () { "$_sublime_path" $* } + alias st=subl + break + fi + done + +elif [[ "$OSTYPE" = 'cygwin' ]]; then + local _sublime_cygwin_paths > /dev/null 2>&1 + _sublime_cygwin_paths=( + "$(cygpath $ProgramW6432/Sublime\ Text\ 2)/sublime_text.exe" + "$(cygpath $ProgramW6432/Sublime\ Text\ 3)/sublime_text.exe" + ) + for _sublime_path in $_sublime_cygwin_paths; do + if [[ -a $_sublime_path ]]; then + subl () { "$_sublime_path" $* } + alias st=subl + break + fi + done + +fi + +alias stt='st .' + +find_project() +{ + local PROJECT_ROOT="${PWD}" + local FINAL_DEST="." + + while [[ $PROJECT_ROOT != "/" && ! -d "$PROJECT_ROOT/.git" ]]; do + PROJECT_ROOT=$(dirname $PROJECT_ROOT) + done + + if [[ $PROJECT_ROOT != "/" ]]; then + local PROJECT_NAME="${PROJECT_ROOT##*/}" + + local SUBL_DIR=$PROJECT_ROOT + while [[ $SUBL_DIR != "/" && ! -f "$SUBL_DIR/$PROJECT_NAME.sublime-project" ]]; do + SUBL_DIR=$(dirname $SUBL_DIR) + done + + if [[ $SUBL_DIR != "/" ]]; then + FINAL_DEST="$SUBL_DIR/$PROJECT_NAME.sublime-project" + else + FINAL_DEST=$PROJECT_ROOT + fi + fi + + st $FINAL_DEST +} + +function create_project() { + + local _target=$1 + + if [[ "${_target}" == "" ]]; then + _target=$(pwd); + elif [[ ! -d ${_target} ]]; then + echo "${_target} is not a valid directory" + return 1 + fi + + local _sublime_project_file=$_target/$(basename $_target).sublime-project + + if [[ ! -f $_sublime_project_file ]]; then + + touch $_sublime_project_file + + echo -e "{" >> $_sublime_project_file + echo -e "\t\"folders\":" >> $_sublime_project_file + echo -e "\t\t[{" >> $_sublime_project_file + echo -e "\t\t\t\"path\": \".\"," >> $_sublime_project_file + echo -e "\t\t\t\"file_exclude_patterns\": []" >> $_sublime_project_file + echo -e "\t\t}]" >> $_sublime_project_file + echo -e "}" >> $_sublime_project_file + + echo -e "New Sublime Text project created:\n\t${_sublime_project_file}" + + fi +} + +alias stp=find_project +alias stn=create_project diff --git a/oh-my-zsh/plugins/sudo/sudo.plugin.zsh b/oh-my-zsh/plugins/sudo/sudo.plugin.zsh @@ -0,0 +1,31 @@ +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# sudo or sudoedit will be inserted before the command +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Dongweiming <ciici123@gmail.com> +# +# ------------------------------------------------------------------------------ + +sudo-command-line() { + [[ -z $BUFFER ]] && zle up-history + if [[ $BUFFER == sudo\ * ]]; then + LBUFFER="${LBUFFER#sudo }" + elif [[ $BUFFER == $EDITOR\ * ]]; then + LBUFFER="${LBUFFER#$EDITOR }" + LBUFFER="sudoedit $LBUFFER" + elif [[ $BUFFER == sudoedit\ * ]]; then + LBUFFER="${LBUFFER#sudoedit }" + LBUFFER="$EDITOR $LBUFFER" + else + LBUFFER="sudo $LBUFFER" + fi +} +zle -N sudo-command-line +# Defined shortcut keys: [Esc] [Esc] +bindkey "\e\e" sudo-command-line diff --git a/oh-my-zsh/plugins/supervisor/_supervisorctl b/oh-my-zsh/plugins/supervisor/_supervisorctl @@ -0,0 +1,136 @@ +#compdef supervisorctl + +typeset -A opt_args +local context state line + +_supervisorctl() { + _arguments -s -S \ + {--configuration,-c}"[configuration file path (default /etc/supervisor.conf)]:FILENAME:_files" \ + {--help,-h}"[print usage message and exit]:" \ + {--interactive,-i}"[start an interactive shell after executing commands]" \ + {--serverurl,-s}"[URL on which supervisord server is listening (default "http://localhost:9001").]" \ + {--username,-u}"[username to use for authentication with server]:USERNAME:_users" \ + {--password,-p}"[password to use for authentication with server]:PASSWORD:" \ + {--history-file,-r}"[keep a readline history (if readline is available)]:FILENAME:_files" \ + "*::supervisorctl commands:_supervisorctl_command" +} + +(( $+functions[_supervisorctl_command] )) || +_supervisorctl_command() { + local cmd ret=1 + + (( $+supervisorctl_cmds )) || _supervisorctl_cmds=( + "add:Activates any updates in config for process/group" \ + "avail:Display all configured processes" \ + "clear:Clear process/multiple-process/all-process log files" \ + "exit:Exit the supervisor shell." \ + "fg:Connect to a process in foreground mode" \ + "maintail:tail of supervisor main log file" \ + "open:Connect to a remote supervisord process. (for UNIX domain socket, use unix:///socket/path)" \ + "pid:Get the PID of supervisord." \ + "quit:Exit the supervisor shell." \ + "reload:Restart the remote supervisord." \ + "remove:Removes process/group from active config" \ + "reread:Reload the daemon's configuration files" \ + "restart:Restart process or group." \ + "shutdown:Shut the remote supervisord down." \ + "start:Start process or groups." \ + "status:Get process status info." \ + "stop:Stop process or group." \ + "tail:tail of process stdout" \ + "update:Reload config and add/remove as necessary" \ + "version:Show the version of the remote supervisord process" \ + "help:Show help" \ + ) + + if (( CURRENT == 1 )); then + _describe -t commands 'supervisorctl subcommand' _supervisorctl_cmds \ + || compadd "$@" - ${(s.:.)${(j.:.)_supervisorctl_syns}} + else + local curcontext="$curcontext" + + cmd="${${_supervisorctl_cmds[(r)$words[1]:*]%%:*}:-${(k)_supervisorctl_syns[(r)(*:|)$words[1](:*|)]}}" + if (( $#cmd )); then + curcontext="${curcontext%:*:*}:supervisorctl-${cmd}:" + _call_function ret _supervisorctl_$cmd || _message 'no more arguments' + else + _message "unknown supervisorctl command: $words[1]" + fi + return ret + fi +} + +# get supervisor contoroll processes +(( $+functions[_get_supervisor_procs] )) || +_get_supervisor_procs() { + local cache_policy + zstyle -s ":completion:${curcontext}:" cache-policy cache_policy + if [[ -z "$cache_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy _supervisor_procs_caching_policy + fi + + if ( [[ ${+_supervisor_procs} -eq 0 ]] || _cache_invalid supervisor_procs ) \ + && ! _retrieve_cache supervisor_procs; then + + _supervisor_procs=(${${(f)"$(supervisorctl status >/dev/null 2>&1 | awk -F' ' '{print $1}')"}}) + _store_cache supervisor_procs _supervisor_procs + fi + + local expl + _wanted supervisor_procs expl 'supervisor processes' compadd -a _supervisor_procs +} + +_supervisor_procs_caching_policy() { + local -a oldp + oldp=( "$1"(Nmw+1) ) + (( $#oldp )) +} + +(( $+functions[_supervisorctl_add] )) || +_supervisorctl_add() { + _arguments -s \ + "--help[use help system]" \ + "*::supervisorctl commands:_supervisorctl" +} + +(( $+functions[_supervisorctl_help] )) || +_supervisorctl_help() { + _arguments -s \ + "*:supervisorctl commands:_supervisorctl" +} + +(( $+functions[_supervisorctl_maintail] )) || +_supervisorctl_maintail() { + _arguments -s \ + '-f[Continuous tail of supervisor main log file (Ctrl-C to exit)]' +} + +(( $+functions[_supervisorctl_start] )) || +_supervisorctl_start() { + # TODO: add 'all' + _arguments -s \ + '*::supvervisor process:_get_supervisor_procs' +} + +(( $+functions[_supervisorctl_status] )) || +_supervisorctl_status() { + _arguments \ + '*::supvervisor process:_get_supervisor_procs' +} + +(( $+functions[_supervisorctl_stop] )) || +_supervisorctl_stop() { + # TODO: add 'all' + _arguments -s \ + '*::supvervisor process:_get_supervisor_procs' +} + +(( $+functions[_supervisorctl_tail] )) || +_supervisorctl_tail() { + # TODO: add 'stderr' + _arguments -s \ + '-f[Continuous tail of named process stdout Ctrl-C to exit.]' \ + '*::supvervisor process:_get_supervisor_procs' +} + +_supervisorctl "$@" diff --git a/oh-my-zsh/plugins/supervisor/_supervisord b/oh-my-zsh/plugins/supervisor/_supervisord @@ -0,0 +1,33 @@ +#compdef supervisord + +typeset -A opt_args +local context state line + +_arguments \ + {--configuration,-c}"[configuration file]:FILENAME:_files" \ + {--nodaemon,-n}"[run in the foreground (same as 'nodaemon true' in config file)]" \ + {--help,-h}"[print this usage message and exit]:" \ + {--version,-v}"[print supervisord version number and exit]:" \ + {--user,-u}"[run supervisord as this user]:USER:_users" \ + {--umask,-m}"[use this umask for daemon subprocess (default is 022)]" \ + {--directory,-d}"[directory to chdir to when daemonized]" \ + {--logfile,-l}"[use FILENAME as logfile path]:FILENAME:_files" \ + {--logfile_maxbytes,-y}"[use BYTES to limit the max size of logfile]" \ + {--logfile_backups,-z}"[number of backups to keep when max bytes reached]" \ + {--loglevel,-e}"[use LEVEL as log level (debug,info,warn,error,critical)]:level:->levels" \ + {--pidfile,-j}"[write a pid file for the daemon process to FILENAME]:FILENAME:_files" \ + {--identifier,-i}"[identifier used for this instance of supervisord]" \ + {--childlogdir,-q}"[the log directory for child process logs]:child log directory:_files -/" \ + {--nocleanup,-k}"[prevent the process from performing cleanup (removal of old automatic child log files) at startup.]" \ + {--minfds,-a}"[the minimum number of file descriptors for start success]" \ + {--strip_ansi,-t}"[strip ansi escape codes from process output]" \ + "--minprocs[the minimum number of processes available for start success]" \ + "--profile_options[run supervisord under profiler and output results based on OPTIONS, which is a comma-sep'd list of 'cumulative', 'calls', and/or 'callers', e.g. 'cumulative,callers')]" \ + "*::args:_gnu_generic" + +case $state in +levels) + levels=("debug" "info" "warn" "error" "critical") + _describe -t levels 'supervisord levels' levels && return 0 + ;; +esac diff --git a/oh-my-zsh/plugins/supervisor/supervisor.plugin.zsh b/oh-my-zsh/plugins/supervisor/supervisor.plugin.zsh @@ -0,0 +1 @@ +# DECLARION: This plugin was created by hhatto. What I did is just making a portal from https://bitbucket.org/hhatto/zshcompfunc4supervisor. diff --git a/oh-my-zsh/plugins/suse/suse.plugin.zsh b/oh-my-zsh/plugins/suse/suse.plugin.zsh @@ -0,0 +1,61 @@ +#Alias for Zypper according to the official Zypper's alias + +#Main commands +alias z='sudo zypper' #call zypper +alias zh='sudo zypper -h' #print help +alias zhse='sudo zypper -h se' #print help for the search command +alias zlicenses='sudo zypper licenses' #prints a report about licenses and EULAs of installed packages +alias zps='sudo zypper ps' #list process using deleted files +alias zshell='sudo zypper shell' #open a zypper shell session +alias zsource-download='sudo zypper source-download' #download source rpms for all installed packages +alias ztos='sudo zypper tos' #shows the ID string of the target operating system +alias zvcmp='sudo zypper vcmp' #tell whether version1 is older or newer than version2 + +#Packages commands +alias zin='sudo zypper in' #install packages +alias zinr='sudo zypper inr' #install newly added packages recommended by already installed ones +alias zrm='sudo zypper rm' #remove packages +alias zsi='sudo zypper si' #install source of a package +alias zve='sudo zypper ve' #verify dependencies of installed packages + +#Updates commands +alias zdup='sudo zypper dup' #upgrade packages +alias zlp='sudo zypper lp' #list necessary patchs +alias zlu='sudo zypper lu' #list updates +alias zpchk='sudo zypper pchk' #check for patches +alias zup='sudo zypper up' #update packages +alias zpatch='sudo zypper patch' #install patches + +#Request commands +alias zif='sudo zypper if' #display info about packages +alias zpa='sudo zypper pa' #list packages +alias zpatch-info='sudo zypper patch-info' #display info about patches +alias zpattern-info='sudo zypper patch-info' #display info about patterns +alias zproduct-info='sudo zypper patch-info' #display info about products +alias zpch='sudo zypper pch' #list all patches +alias zpd='sudo zypper pd' #list products +alias zpt='sudo zypper pt' #list patterns +alias zse='sudo zypper se' #search for packages +alias zwp='sudo zypper wp' #list all packages providing the specified capability + +#Repositories commands +alias zar='sudo zypper ar' #add a repository +alias zcl='sudo zypper clean' #clean cache +alias zlr='sudo zypper lr' #list repositories +alias zmr='sudo zypper mr' #modify repositories +alias znr='sudo zypper nr' #rename repositories (for the alias only) +alias zref='sudo zypper ref' #refresh repositories +alias zrr='sudo zypper rr' #remove repositories + +#Services commands +alias zas='sudo zypper as' #adds a service specified by URI to the system +alias zms='sudo zypper ms' #modify properties of specified services +alias zrefs='sudo zypper refs' #refreshing a service mean executing the service's special task +alias zrs='sudo zypper rs' #remove specified repository index service from the system +alias zls='sudo zypper ls' #list services defined on the system + +#Package Locks Management commands +alias zal='sudo zypper al' #add a package lock +alias zcl='sudo zypper cl' #Remove unused locks +alias zll='sudo zypper ll' #list currently active package locks +alias zrl='sudo zypper rl' #remove specified package lock diff --git a/oh-my-zsh/plugins/svn-fast-info/svn-fast-info.plugin.zsh b/oh-my-zsh/plugins/svn-fast-info/svn-fast-info.plugin.zsh @@ -0,0 +1,73 @@ +# vim:ft=zsh ts=2 sw=2 sts=2 et +# +# Faster alternative to the current SVN plugin implementation. +# +# Works with svn 1.6, 1.7, 1.8. +# Use `svn_prompt_info` method to enquire the svn data. +# It's faster because his efficient use of svn (single svn call) which saves a lot on a huge codebase +# It displays the current status of the local files (added, deleted, modified, replaced, or else...) +# +# Use as a drop-in replacement of the svn plugin not as complementary plugin + +function svn_prompt_info() { + local info + info=$(svn info 2>&1) || return 1; # capture stdout and stderr + local repo_need_upgrade=$(svn_repo_need_upgrade $info) + + if [[ -n $repo_need_upgrade ]]; then + printf '%s%s%s%s%s%s%s\n' \ + $ZSH_PROMPT_BASE_COLOR \ + $ZSH_THEME_SVN_PROMPT_PREFIX \ + $ZSH_PROMPT_BASE_COLOR \ + $repo_need_upgrade \ + $ZSH_PROMPT_BASE_COLOR \ + $ZSH_THEME_SVN_PROMPT_SUFFIX \ + $ZSH_PROMPT_BASE_COLOR + else + printf '%s%s%s %s%s:%s%s%s%s%s' \ + $ZSH_PROMPT_BASE_COLOR \ + $ZSH_THEME_SVN_PROMPT_PREFIX \ + \ + "$(svn_status_info $info)" \ + $ZSH_PROMPT_BASE_COLOR \ + \ + $ZSH_THEME_BRANCH_NAME_COLOR \ + $(svn_current_branch_name $info) \ + $ZSH_PROMPT_BASE_COLOR \ + \ + $(svn_current_revision $info) \ + $ZSH_PROMPT_BASE_COLOR \ + \ + $ZSH_THEME_SVN_PROMPT_SUFFIX \ + $ZSH_PROMPT_BASE_COLOR + fi +} + +function svn_repo_need_upgrade() { + grep -q "E155036" <<< ${1:-$(svn info 2> /dev/null)} && \ + echo "E155036: upgrade repo with svn upgrade" +} + +function svn_current_branch_name() { + grep '^URL:' <<< "${1:-$(svn info 2> /dev/null)}" | egrep -o '(tags|branches)/[^/]+|trunk' +} + +function svn_repo_root_name() { + grep '^Repository\ Root:' <<< "${1:-$(svn info 2> /dev/null)}" | sed 's#.*/##' +} + +function svn_current_revision() { + echo "${1:-$(svn info 2> /dev/null)}" | sed -n 's/Revision: //p' +} + +function svn_status_info() { + local svn_status_string="$ZSH_THEME_SVN_PROMPT_CLEAN" + local svn_status="$(svn status 2> /dev/null)"; + if command grep -E '^\s*A' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"; fi + if command grep -E '^\s*D' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DELETIONS:-✖}"; fi + if command grep -E '^\s*M' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-✎}"; fi + if command grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-∿}"; fi + if command grep -E '^\s*\?' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"; fi + if command grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DIRTY:-'!'}"; fi + echo $svn_status_string +} diff --git a/oh-my-zsh/plugins/svn/README.md b/oh-my-zsh/plugins/svn/README.md @@ -0,0 +1,67 @@ +# `svn` plugin + +This plugin adds some utility functions to display additional information regarding your current +svn repository. See http://subversion.apache.org/ for the full svn documentation. + +To use it, add `svn` to your plugins array: + +```zsh +plugins=(... svn) +``` + +## Functions + +| Command | Description | +|:----------------------|:--------------------------------------------| +| `svn_prompt_info` | Shows svn prompt in themes | +| `in_svn` | Checks if we're in an svn repository | +| `svn_get_repo_name` | Get repository name | +| `svn_get_branch_name` | Get branch name (see [caveats](#caveats)) | +| `svn_get_rev_nr` | Get revision number | +| `svn_dirty` | Checks if there are changes in the svn repo | + +## Caveats + +The plugin expects the first directory to be the current branch / tag / trunk. So it returns +the first path element if you don't use branches. + +## Usage on themes + +To use this in the `agnoster` theme follow these instructions: + +1. Enable the svn plugin + +2. Add the following lines to your `zshrc` file: + + ```shell + prompt_svn() { + local rev branch + if in_svn; then + rev=$(svn_get_rev_nr) + branch=$(svn_get_branch_name) + if [[ $(svn_dirty_choose_pwd 1 0) -eq 1 ]]; then + prompt_segment yellow black + echo -n "$rev@$branch" + echo -n "±" + else + prompt_segment green black + echo -n "$rev@$branch" + fi + fi + } + ``` + +3. Override the agnoster `build_prompt()` function: + + ```zsh + build_prompt() { + RETVAL=$? + prompt_status + prompt_context + prompt_dir + prompt_git + prompt_svn + prompt_end + } + ``` + diff --git a/oh-my-zsh/plugins/svn/svn.plugin.zsh b/oh-my-zsh/plugins/svn/svn.plugin.zsh @@ -0,0 +1,87 @@ +svn_prompt_info() { + local _DISPLAY + if in_svn; then + if [[ "$SVN_SHOW_BRANCH" = true ]]; then + unset SVN_SHOW_BRANCH + _DISPLAY=$(svn_get_branch_name) + else + _DISPLAY=$(svn_get_repo_name) + _DISPLAY=$(omz_urldecode "${_DISPLAY}") + fi + echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\ +$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" + fi +} + + +in_svn() { + svn info >/dev/null 2>&1 +} + +svn_get_repo_name() { + if in_svn; then + LANG=C svn info | sed -n 's/^Repository\ Root:\ .*\///p' | read SVN_ROOT + LANG=C svn info | sed -n "s/^URL:\ .*$SVN_ROOT\///p" + fi +} + +svn_get_branch_name() { + local _DISPLAY=$( + LANG=C svn info 2> /dev/null | \ + awk -F/ \ + '/^URL:/ { \ + for (i=0; i<=NF; i++) { \ + if ($i == "branches" || $i == "tags" ) { \ + print $(i+1); \ + break;\ + }; \ + if ($i == "trunk") { print $i; break; } \ + } \ + }' + ) + + if [[ -z "$_DISPLAY" ]]; then + svn_get_repo_name + else + echo $_DISPLAY + fi +} + +svn_get_rev_nr() { + if in_svn; then + LANG=C svn info 2> /dev/null | sed -n 's/Revision:\ //p' + fi +} + +svn_dirty() { + svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN +} + +svn_dirty_choose() { + if in_svn; then + local root=$(LANG=C svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p') + if svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'; then + # Grep exits with 0 when "One or more lines were selected", return "dirty". + echo $1 + else + # Otherwise, no lines were found, or an error occurred. Return clean. + echo $2 + fi + fi +} + +svn_dirty_pwd () { + svn_dirty_choose_pwd $ZSH_THEME_SVN_PROMPT_DIRTY_PWD $ZSH_THEME_SVN_PROMPT_CLEAN_PWD +} + +svn_dirty_choose_pwd () { + if in_svn; then + if svn status "$PWD" 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'; then + # Grep exits with 0 when "One or more lines were selected", return "dirty". + echo $1 + else + # Otherwise, no lines were found, or an error occurred. Return clean. + echo $2 + fi + fi +} diff --git a/oh-my-zsh/plugins/swiftpm/README.md b/oh-my-zsh/plugins/swiftpm/README.md @@ -0,0 +1,22 @@ +# Swift Package Manager + +## Description + +This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager). + +To start using it, add the `swiftpm` plugin to your `plugins` array in `~/.zshrc`: + +```zsh +plugins=(... swiftpm) +``` + +## Aliases + +| Alias | Description | Command | +|-------|-------------------------------------|------------------------------------| +| `spi` | Initialize a new package | `swift package init` | +| `spf` | Fetch package dependencies | `swift package fetch` | +| `spu` | Update package dependencies | `swift package update` | +| `spx` | Generates an Xcode project | `swift package generate-xcodeproj` | +| `sps` | Print the resolved dependency graph | `swift package show-dependencies` | +| `spd` | Print parsed Package.swift as JSON | `swift package dump-package` | diff --git a/oh-my-zsh/plugins/swiftpm/swiftpm.plugin.zsh b/oh-my-zsh/plugins/swiftpm/swiftpm.plugin.zsh @@ -0,0 +1,8 @@ +# Some aliases to make your life with the Swift Package Manager faster ✌️ + +alias spi='swift package init' +alias spf='swift package fetch' +alias spu='swift package update' +alias spx='swift package generate-xcodeproj' +alias sps='swift package show-dependencies' +alias spd='swift package dump-package' diff --git a/oh-my-zsh/plugins/symfony/symfony.plugin.zsh b/oh-my-zsh/plugins/symfony/symfony.plugin.zsh @@ -0,0 +1,13 @@ +# symfony basic command completion + +_symfony_get_command_list () { + php symfony | sed "1,/Available tasks/d" | awk 'BEGIN { cat=null; } /^[A-Za-z]+$/ { cat = $1; } /^ :[a-z]+/ { print cat $1; }' +} + +_symfony () { + if [ -f symfony ]; then + compadd `_symfony_get_command_list` + fi +} + +compdef _symfony symfony diff --git a/oh-my-zsh/plugins/symfony2/symfony2.plugin.zsh b/oh-my-zsh/plugins/symfony2/symfony2.plugin.zsh @@ -0,0 +1,29 @@ +# Symfony2 basic command completion + +_symfony_console () { + echo "php $(find . -maxdepth 2 -mindepth 1 -name 'console' -type f | head -n 1)" +} + +_symfony2_get_command_list () { + `_symfony_console` --no-ansi | sed "1,/Available commands/d" | awk '/^ ?[^ ]+ / { print $1 }' +} + +_symfony2 () { + compadd `_symfony2_get_command_list` +} + +compdef _symfony2 '`_symfony_console`' +compdef _symfony2 'app/console' +compdef _symfony2 'bin/console' +compdef _symfony2 sf + +#Alias +alias sf='`_symfony_console`' +alias sfcl='sf cache:clear' +alias sfsr='sf server:run -vvv' +alias sfcw='sf cache:warmup' +alias sfroute='sf debug:router' +alias sfcontainer='sf debug:container' +alias sfgb='sf generate:bundle' +alias sfdev='sf --env=dev' +alias sfprod='sf --env=prod' diff --git a/oh-my-zsh/plugins/systemadmin/systemadmin.plugin.zsh b/oh-my-zsh/plugins/systemadmin/systemadmin.plugin.zsh @@ -0,0 +1,163 @@ +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# This is one for the system administrator, operation and maintenance. +# Some of which come from http://justinlilly.com/dotfiles/zsh.html +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Dongweiming <ciici123@gmail.com> +# +# ------------------------------------------------------------------------------ + +function retval() { + if [[ -z $1 ]];then + echo '.' + else + echo $1 + fi +} + +function retlog() { + if [[ -z $1 ]];then + echo '/var/log/nginx/access.log' + else + echo $1 + fi +} + +alias ping='ping -c 5' +alias clr='clear;echo "Currently logged in on $(tty), as $USER in directory $PWD."' +alias path='echo -e ${PATH//:/\\n}' +alias mkdir='mkdir -pv' +# get top process eating memory +alias psmem='ps -e -orss=,args= | sort -b -k1,1n' +alias psmem10='ps -e -orss=,args= | sort -b -k1,1n| head -10' +# get top process eating cpu if not work try excute : export LC_ALL='C' +alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1 -nr' +alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1 -nr | head -10' +# top10 of the history +alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10' + +# directory LS +dls () { + ls -l | grep "^d" | awk '{ print $9 }' | tr -d "/" +} +psgrep() { + ps aux | grep "$(retval $1)" | grep -v grep +} +# Kills any process that matches a regexp passed to it +killit() { + ps aux | grep -v "grep" | grep "$@" | awk '{print $2}' | xargs sudo kill +} + +# list contents of directories in a tree-like format +if [ -z "\${which tree}" ]; then + tree () { + find $@ -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' + } +fi + +# Sort connection state +sortcons() { + netstat -nat |awk '{print $6}'|sort|uniq -c|sort -rn +} + +# View all 80 Port Connections +con80() { + netstat -nat|grep -i ":80"|wc -l +} + +# On the connected IP sorted by the number of connections +sortconip() { + netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n +} + +# top20 of Find the number of requests on 80 port +req20() { + netstat -anlp|grep 80|grep tcp|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -n20 +} + +# top20 of Using tcpdump port 80 access to view +http20() { + sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -20 +} + +# top20 of Find time_wait connection +timewait20() { + netstat -n|grep TIME_WAIT|awk '{print $5}'|sort|uniq -c|sort -rn|head -n20 +} + +# top20 of Find SYN connection +syn20() { + netstat -an | grep SYN | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr|head -n20 +} + +# Printing process according to the port number +port_pro() { + netstat -ntlp | grep "$(retval $1)" | awk '{print $7}' | cut -d/ -f1 +} + +# top10 of gain access to the ip address +accessip10() { + awk '{counts[$(11)]+=1}; END {for(url in counts) print counts[url], url}' "$(retlog)" +} + +# top20 of Most Visited file or page +visitpage20() { + awk '{print $11}' "$(retlog)"|sort|uniq -c|sort -nr|head -20 +} + +# top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences +consume100() { + awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -100 + # if django website or other webiste make by no suffix language + # awk '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -100 +} + +# Website traffic statistics (G) +webtraffic() { + awk "{sum+=$10} END {print sum/1024/1024/1024}" "$(retlog)" +} + +# Statistical connections 404 +c404() { + awk '($9 ~/404/)' "$(retlog)" | awk '{print $9,$7}' | sort +} + +# Statistical http status. +httpstatus() { + awk '{counts[$(9)]+=1}; END {for(code in counts) print code, counts[code]}' "$(retlog)" +} + +# Delete 0 byte file +d0() { + find "$(retval $1)" -type f -size 0 -exec rm -rf {} \; +} + +# gather external ip address +geteip() { + curl -s -S https://icanhazip.com +} + +# determine local IP address +getip() { + if (( ${+commands[ip]} )); then + ip addr | grep "inet " | grep -v '127.0.0.1' | awk '{print $2}' + else + ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}' + fi +} + +# Clear zombie processes +clrz() { + ps -eal | awk '{ if ($2 == "Z") {print $4}}' | kill -9 +} + +# Second concurrent +conssec() { + awk '{if($9~/200|30|404/)COUNT[$4]++}END{for( a in COUNT) print a,COUNT[a]}' "$(retlog)"|sort -k 2 -nr|head -n10 +} diff --git a/oh-my-zsh/plugins/systemd/systemd.plugin.zsh b/oh-my-zsh/plugins/systemd/systemd.plugin.zsh @@ -0,0 +1,16 @@ +user_commands=( + list-units is-active status show help list-unit-files + is-enabled list-jobs show-environment cat list-timers) + +sudo_commands=( + start stop reload restart try-restart isolate kill + reset-failed enable disable reenable preset mask unmask + link load cancel set-environment unset-environment + edit) + +for c in $user_commands; do; alias sc-$c="systemctl $c"; done +for c in $sudo_commands; do; alias sc-$c="sudo systemctl $c"; done + +alias sc-enable-now="sc-enable --now" +alias sc-disable-now="sc-disable --now" +alias sc-mask-now="sc-mask --now" diff --git a/oh-my-zsh/plugins/taskwarrior/README.md b/oh-my-zsh/plugins/taskwarrior/README.md @@ -0,0 +1,13 @@ +# taskwarrior + +This plugin adds smart tab completion for [TaskWarrior](http://taskwarrior.org/). +It uses the zsh tab completion script (`_task`) shipped with TaskWarrior for the +completion definitions. + +The latest version pulled in from the official project is of January 1st, 2015. + + +## Examples + +Typing `task [TAB]` will give you a list of commands, `task 66[TAB]` shows a +list of available modifications for that task, etcetera. diff --git a/oh-my-zsh/plugins/taskwarrior/_task b/oh-my-zsh/plugins/taskwarrior/_task @@ -0,0 +1,285 @@ +#compdef task +# +# Copyright 2010 - 2016 Johannes Schlatow +# Copyright 2009 P.C. Shyamshankar +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# http://www.opensource.org/licenses/mit-license.php +# +typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers +_task_projects=($(task _projects)) +_task_tags=($(task _tags)) +_task_zshids=( ${(f)"$(task _zshids)"} ) +_task_config=($(task _config)) +_task_columns=($(task _columns)) +_task_modifiers=( + 'before' \ + 'after' \ + 'none' \ + 'any' \ + 'is' \ + 'isnt' \ + 'has' \ + 'hasnt' \ + 'startswith' \ + 'endswith' \ + 'word' \ + 'noword' +) +_task_conjunctions=( + 'and' \ + 'or' \ + 'xor' \ + '\)' \ + '\(' \ + '<' \ + '<=' \ + '=' \ + '!=' \ + '>=' \ + '>' +) +_task_cmds=($(task _commands; task _aliases)) +_task_zshcmds=( ${(f)"$(task _zshcommands)"} sentinel:sentinel:sentinel ) + +_task_aliases=($(task _aliases)) + +_task() { + _arguments -s -S \ + "*::task default:_task_default" + return 0 +} + +local -a reply args word +word=$'[^\0]#\0' + +# priorities +local -a task_priorities +_regex_words values 'task priorities' \ + 'H:High' \ + 'M:Middle' \ + 'L:Low' +task_priorities=("$reply[@]") + +# projects +local -a task_projects +task_projects=( + /"$word"/ + ":values:task projects:compadd -a _task_projects" +) + +local -a _task_dates +_regex_words values 'task dates' \ + 'tod*ay:Today' \ + 'yes*terday:Yesterday' \ + 'tom*orrow:Tomorrow' \ + 'sow:Start of week' \ + 'soww:Start of work week' \ + 'socw:Start of calendar week' \ + 'som:Start of month' \ + 'soq:Start of quarter' \ + 'soy:Start of year' \ + 'eow:End of week' \ + 'eoww:End of work week' \ + 'eocw:End of calendar week' \ + 'eom:End of month' \ + 'eoq:End of quarter' \ + 'eoy:End of year' \ + 'mon:Monday' \ + 'tue:Tuesday'\ + 'wed:Wednesday' \ + 'thu:Thursday' \ + 'fri:Friday' \ + 'sat:Saturday' \ + 'sun:Sunday' \ + 'good*friday:Good Friday' \ + 'easter:Easter' \ + 'eastermonday:Easter Monday' \ + 'ascension:Ascension' \ + 'pentecost:Pentecost' \ + 'midsommar:Midsommar' \ + 'midsommarafton:Midsommarafton' \ + 'later:Later' \ + 'someday:Some Day' +_task_dates=("$reply[@]") + +local -a _task_reldates +_regex_words values 'task reldates' \ + 'hrs:n hours' \ + 'day:n days' \ + '1st:first' \ + '2nd:second' \ + '3rd:third' \ + 'th:4th, 5th, etc.' \ + 'wks:weeks' +_task_reldates=("$reply[@]") + +task_dates=( + \( "$_task_dates[@]" \| + \( /$'[0-9][0-9]#'/- \( "$_task_reldates[@]" \) \) + \) +) + +local -a task_zshids +if (( $#_task_zshids )); then + _regex_words values 'task IDs' $_task_zshids + task_zshids=("$reply[@]") +fi + +_regex_words values 'task frequencies' \ + 'daily:Every day' \ + 'day:Every day' \ + 'weekdays:Every day skipping weekend days' \ + 'weekly:Every week' \ + 'biweekly:Every two weeks' \ + 'fortnight:Every two weeks' \ + 'monthly:Every month' \ + 'quarterly:Every three months' \ + 'semiannual:Every six months' \ + 'annual:Every year' \ + 'yearly:Every year' \ + 'biannual:Every two years' \ + 'biyearly:Every two years' +_task_freqs=("$reply[@]") + +local -a _task_frequencies +_regex_words values 'task frequencies' \ + 'd:days' \ + 'w:weeks' \ + 'q:quarters' \ + 'y:years' +_task_frequencies=("$reply[@]") + +task_freqs=( + \( "$_task_freqs[@]" \| + \( /$'[0-9][0-9]#'/- \( "$_task_frequencies[@]" \) \) + \) +) + +# attributes +local -a task_attributes +_regex_words -t ':' default 'task attributes' \ + 'des*cription:Task description text' \ + 'status:Status of task - pending, completed, deleted, waiting' \ + 'pro*ject:Project name:$task_projects' \ + 'pri*ority:priority:$task_priorities' \ + 'du*e:Due date:$task_dates' \ + 're*cur:Recurrence frequency:$task_freqs' \ + 'un*til:Expiration date:$task_dates' \ + 'li*mit:Desired number of rows in report' \ + 'wa*it:Date until task becomes pending:$task_dates' \ + 'ent*ry:Date task was created:$task_dates' \ + 'end:Date task was completed/deleted:$task_dates' \ + 'st*art:Date task was started:$task_dates' \ + 'sc*heduled:Date task is scheduled to start:$task_dates' \ + 'dep*ends:Other tasks that this task depends upon:$task_zshids' +task_attributes=("$reply[@]") + +args=( + \( "$task_attributes[@]" \| + \( /'(project|description|status|entry|end|start|scheduled|depends|due|wait|recur|priority|until|limit).'/- \( /$'[^:]#:'/ ":default:modifiers:compadd -S ':' -a _task_modifiers" \) \) \| + \( /'(rc).'/- \( /$'[^:]#:'/ ":arguments:config:compadd -S ':' -a _task_config" \) \) \| + \( /'(+|-)'/- \( /"$word"/ ":values:remove tag:compadd -a _task_tags" \) \) \| + \( /"$word"/ \) + \) \# +) +_regex_arguments _task_attributes "${args[@]}" + +## task commands + +# filter completion +(( $+functions[_task_filter] )) || +_task_filter() { + _task_attributes "$@" + + # TODO complete conjunctions only if the previous word is a filter expression, i.e. attribute, ID, any non-command + _describe -t default 'task conjunctions' _task_conjunctions +} + +# execute completion +(( $+functions[_task_execute] )) || +_task_execute() { + _files +} + +# id-only completion +(( $+functions[_task_id] )) || +_task_id() { + _describe -t values 'task IDs' _task_zshids +} + +# subcommand-only function +(( $+functions[_task_subcommands] )) || +_task_subcommands() { + local -a subcommands + local _zshcmd + local cmd category desc + local lastcategory='' + # The list is sorted by category, in the right order. + for _zshcmd in "$_task_zshcmds[@]"; do + # Parse out the three fields + cmd=${_zshcmd%%:*} + category=${${_zshcmd#*:}%%:*} + desc=${_zshcmd#*:*:} + + # Present each category as soon as the first entry in the *next* category + # is seen. + if [[ $category != $lastcategory && -n $lastcategory ]]; then + _describe -t ${lastcategory}-commands "task ${lastcategory} command" subcommands + subcommands=() + fi + + # Log the subcommand; we will process it in some future iteration. + subcommands+=( "$cmd:$desc" ) + + lastcategory=$category + done +} + +## first level completion => task sub-command completion +(( $+functions[_task_default] )) || +_task_default() { + local cmd ret=1 + + integer i=1 + while (( i < $#words )) + do + cmd="${_task_cmds[(r)$words[$i]]}" + if (( $#cmd )); then + _call_function ret _task_${cmd} || + _call_function ret _task_filter || + _message "No command remaining." + return ret + fi + (( i++ )) + done + + # update IDs + _task_zshids=( ${(f)"$(task _zshids)"} ) + + _task_subcommands + _describe -t tasks 'task IDs' _task_zshids + _describe -t aliases 'task aliases' _task_aliases + _call_function ret _task_filter + + return ret +} + +_task "$@" diff --git a/oh-my-zsh/plugins/taskwarrior/taskwarrior.plugin.zsh b/oh-my-zsh/plugins/taskwarrior/taskwarrior.plugin.zsh @@ -0,0 +1,7 @@ +zstyle ':completion:*:*:task:*' verbose yes +zstyle ':completion:*:*:task:*:descriptions' format '%U%B%d%b%u' + +zstyle ':completion:*:*:task:*' group-name '' + +alias t=task +compdef _task t=task diff --git a/oh-my-zsh/plugins/terminalapp/terminalapp.plugin.zsh b/oh-my-zsh/plugins/terminalapp/terminalapp.plugin.zsh @@ -0,0 +1,6 @@ +# This file is intentionally empty. +# +# The terminalapp plugin is deprecated and may be removed in a future release. +# Its functionality has been folded in to the core lib/termsupport.zsh, which +# is loaded for all users. You can remove terminalapp from your $plugins list +# once all your systems are updated to the current version of Oh My Zsh. diff --git a/oh-my-zsh/plugins/terminitor/_terminitor b/oh-my-zsh/plugins/terminitor/_terminitor @@ -0,0 +1,38 @@ +#compdef terminitor +#autoload + +# terminitor zsh completion + +_terminitor_available_scripts() { + scripts=(`for SCRIPT in ~/.config/terminitor/*.term ; do basename $SCRIPT .term ; done`) +} + +local -a _1st_arguments +_1st_arguments=( + 'create:create a Termfile in directory' + 'delete:delete terminitor script' + 'edit:open termitor script' + 'fetch:clone the designated repo and run setup' + 'help:Describe available tasks or one specific task' + 'init:create initial root terminitor folder' + 'list:lists all terminitor scripts' + 'setup:execute setup in the terminitor script' + 'start:runs the terminitor script' + 'update:update Terminitor to new global path(.config/.terminitor)' +) + +local expl + +_arguments \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "terminitor task" _1st_arguments + return +fi + +case "$words[1]" in + start|edit|delete|setup) + _terminitor_available_scripts + _wanted scripts expl 'installed scripts' compadd -a scripts ;; +esac diff --git a/oh-my-zsh/plugins/terraform/README.md b/oh-my-zsh/plugins/terraform/README.md @@ -0,0 +1,21 @@ +## atom + +Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely and efficiently. + +### Requirements + + * [Terraform](https://terraform.io/) + +### Usage + + * Type `terraform` into your prompt and hit `TAB` to see available completion options + +### Expanding ZSH prompt with current Terraform workspace name + +If you want to get current Terraform workspace name in your ZSH prompt open +your .zsh-theme file and in a choosen place insert: + +``` +$FG[045]\ +$(tf_prompt_info)\ +``` diff --git a/oh-my-zsh/plugins/terraform/_terraform b/oh-my-zsh/plugins/terraform/_terraform @@ -0,0 +1,179 @@ +#compdef terraform + +local -a _terraform_cmds +_terraform_cmds=( + 'apply:Builds or changes infrastructure' + 'destroy:Destroy Terraform-managed infrastructure' + 'get:Download and install modules for the configuration' + 'graph:Create a visual graph of Terraform resources' + 'init:Initializes Terraform configuration from a module' + 'output:Read an output from a state file' + 'plan:Generate and show an execution plan' + 'pull:Refreshes the local state copy from the remote server' + 'push:Uploads the local state to the remote server' + 'refresh:Update local state file against real resources' + 'remote:Configures remote state management' + 'show:Inspect Terraform state or plan' + 'taint:Manually forcing a destroy and recreate on the next plan/apply' + 'version:Prints the Terraform version' +) + +__apply() { + _arguments \ + '-auto-approve[Skip interactive approval of plan before applying.]' \ + '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \ + '-input=[(true) Ask for input for variables if not directly set.]' \ + '-no-color[If specified, output will not contain any color.]' \ + '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \ + '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ + '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \ + '-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \ + '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ + '-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' +} + +__destroy() { + _arguments \ + '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \ + '-force[If set, then the destroy confirmation will not be shown.]' \ + '-input=[(true) Ask for input for variables if not directly set.]' \ + '-no-color[If specified, output will not contain any color.]' \ + '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \ + '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ + '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \ + '-target=[(resource) Instead of affecting "dependencies" will instead also destroy any resources that depend on the target(s) specified.]' \ + '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ + '-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' +} + +__get() { + _arguments \ + '-update=[(false) If true, modules already downloaded will be checked for updates and updated if necessary.]' +} + +__graph() { + _arguments \ + '-draw-cycles[Highlight any cycles in the graph with colored edges. This helps when diagnosing cycle errors.]' \ + '-module-depth=[(n) The maximum depth to expand modules. By default this is zero, which will not expand modules at all.]' \ + '-verbose[Generate a verbose, "worst-case" graph, with all nodes for potential operations in place.]' +} + +__init() { + _arguments \ + '-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \ + '-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \ + '-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \ + '-backend-config=[(path) Specifies the path to remote backend config file.]' \ + '-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \ + '-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]' +} + +__output() { + _arguments \ + '-state=[(path) Path to the state file to read. Defaults to "terraform.tfstate".]' \ + '-module=[(module_name) The module path which has needed output. By default this is the root path. Other modules can be specified by a period-separated list.]' +} + +__plan() { + _arguments \ + '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with" .backup" extension. Set to "-" to disable backup.]' \ + '-destroy[If set, a plan will be generated to destroy all resources managed by the given configuration and state.]' \ + '-detailed-exitcode[Return a detailed exit code when the command exits. When provided, this argument changes the exit codes and their meanings to provide more granular information about what the resulting plan contains]' \ + '-input=[(true) Ask for input for variables if not directly set.]' \ + '-module-depth=[(n) Specifies the depth of modules to show in the output. This does not affect the plan itself, only the output shown. By default, this is zero. -1 will expand all.]' \ + '-no-color[If specified, output will not contain any color.]' \ + '-out=[(path) Write a plan file to the given path. This can be used as input to the "apply" command.]' \ + '-refresh=[(true) Update state prior to checking for differences.]' \ + '-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]' \ + '-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \ + '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ + '-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' +} + +__push() { + _arguments \ + '-atlas-address=[(url) An alternate address to an Atlas instance. Defaults to https://atlas.hashicorp.com.]' \ + '-upload-modules=[(true) If true (default), then the modules being used are all locked at their current checkout and uploaded completely to Atlas. This prevents Atlas from running terraform get for you.]' \ + '-name=[(name) Name of the infrastructure configuration in Atlas. The format of this is: "username/name" so that you can upload configurations not just to your account but to other accounts and organizations. This setting can also be set in the configuration in the Atlas section.]' \ + '-no-color[Disables output with coloring]' \ + '-overwrite=[(foo) Marks a specific variable to be updated on Atlas. Normally, if a variable is already set in Atlas, Terraform will not send the local value (even if it is different). This forces it to send the local value to Atlas. This flag can be repeated multiple times.]' \ + '-token=[(token) Atlas API token to use to authorize the upload. If blank or unspecified, the ATLAS_TOKEN environmental variable will be used.]' \ + '-var=[("foo=bar") Set the value of a variable for the Terraform configuration.]' \ + '-var-file=[(foo) Set the value of variables using a variable file.]' \ + '-vcs=[(true) If true (default), then Terraform will detect if a VCS is in use, such as Git, and will only upload files that are committed to version control. If no version control system is detected, Terraform will upload all files in path (parameter to the command).]' +} + +__refresh() { + _arguments \ + '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \ + '-no-color[If specified, output will not contain any color.]' \ + '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ + '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \ + '-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \ + '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ + '-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' +} + +__remote() { + _arguments \ + '-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \ + '-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \ + '-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \ + '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \ + '-disable[Disables remote state management and migrates the state to the -state path.]' \ + '-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \ + '-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]' \ + '-pull=[(true) Controls if the remote state is pulled before disabling. This defaults to true to ensure the latest state is cached before disabling.]' \ + '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' +} + +__show() { + _arguments \ + '-module-depth=[(n) The maximum depth to expand modules. By default this is zero, which will not expand modules at all.]' \ + '-no-color[If specified, output will not contain any color.]' +} + +__taint() { + _arguments \ + '-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \ + '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \ + '-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \ + '-no-color[If specified, output will not contain any color.]' \ + '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ + '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]' +} + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "terraform command" _terraform_cmds + return +fi + +local -a _command_args +case "$words[1]" in + apply) + __apply ;; + destroy) + __destroy ;; + get) + __get ;; + graph) + __graph ;; + init) + __init ;; + output) + __output ;; + plan) + __plan ;; + push) + __push ;; + refresh) + __refresh ;; + remote) + __remote ;; + show) + __show ;; + taint) + __taint ;; +esac diff --git a/oh-my-zsh/plugins/terraform/terraform.plugin.zsh b/oh-my-zsh/plugins/terraform/terraform.plugin.zsh @@ -0,0 +1,7 @@ +function tf_prompt_info() { + # check if in terraform dir + if [ -d .terraform ]; then + workspace=$(terraform workspace show 2> /dev/null) || return + echo "[${workspace}]" + fi +} diff --git a/oh-my-zsh/plugins/textastic/README.md b/oh-my-zsh/plugins/textastic/README.md @@ -0,0 +1,15 @@ +## textastic + +Plugin for Textastic, a text and code editor for Mac OS X + +### Requirements + + * [Textastic](http://www.textasticapp.com/mac.html) + +### Usage + + * If `tt` command is called without an argument, launch Textastic + + * If `tt` is passed a directory, cd to it and open it in Textastic + + * If `tt` is passed a file, open it in Textastic diff --git a/oh-my-zsh/plugins/textastic/textastic.plugin.zsh b/oh-my-zsh/plugins/textastic/textastic.plugin.zsh @@ -0,0 +1,17 @@ +# +# If the tt command is called without an argument, launch Textastic +# If tt is passed a directory, cd to it and open it in Textastic +# If tt is passed a file, open it in Textastic +# +function tt() { + if [[ -z "$1" ]] + then + open -a "textastic.app" + else + open -a "textastic.app" "$1" + if [[ -d "$1" ]] + then + cd "$1" + fi + fi +} diff --git a/oh-my-zsh/plugins/textmate/textmate.plugin.zsh b/oh-my-zsh/plugins/textmate/textmate.plugin.zsh @@ -0,0 +1,14 @@ +# If the tm command is called without an argument, open TextMate in the current directory +# If tm is passed a directory, cd to it and open it in TextMate +# If tm is passed anything else (i.e., a list of files and/or options), pass them all along +# This allows easy opening of multiple files. +function tm() { + if [[ -z $1 ]]; then + mate . + elif [[ -d $1 ]]; then + mate $1 + cd $1 + else + mate "$@" + fi +} diff --git a/oh-my-zsh/plugins/thefuck/README.md b/oh-my-zsh/plugins/thefuck/README.md @@ -0,0 +1,9 @@ +# The Fuck + +[The Fuck](https://github.com/nvbn/thefuck) plugin — magnificent app which corrects your previous console command. + +## Usage +Press `ESC` twice to correct previous console command. + +## Notes +`Esc`-`Esc` key binding conflicts with [sudo](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/sudo) plugin. diff --git a/oh-my-zsh/plugins/thefuck/thefuck.plugin.zsh b/oh-my-zsh/plugins/thefuck/thefuck.plugin.zsh @@ -0,0 +1,17 @@ +if [[ -z $commands[thefuck] ]]; then + echo 'thefuck is not installed, you should "pip install thefuck" first' + return -1 +fi + +# Register alias +eval "$(thefuck --alias)" + +fuck-command-line() { + local FUCK="$(THEFUCK_REQUIRE_CONFIRMATION=0 thefuck $(fc -ln -1 | tail -n 1) 2> /dev/null)" + [[ -z $FUCK ]] && echo -n -e "\a" && return + BUFFER=$FUCK + zle end-of-line +} +zle -N fuck-command-line +# Defined shortcut keys: [Esc] [Esc] +bindkey "\e\e" fuck-command-line diff --git a/oh-my-zsh/plugins/themes/_theme b/oh-my-zsh/plugins/themes/_theme @@ -0,0 +1,3 @@ +#compdef theme + +_arguments "1: :($(lstheme | tr "\n" " "))" diff --git a/oh-my-zsh/plugins/themes/themes.plugin.zsh b/oh-my-zsh/plugins/themes/themes.plugin.zsh @@ -0,0 +1,24 @@ +function theme +{ + if [ -z "$1" ] || [ "$1" = "random" ]; then + themes=($ZSH/themes/*zsh-theme) + N=${#themes[@]} + ((N=(RANDOM%N)+1)) + RANDOM_THEME=${themes[$N]} + source "$RANDOM_THEME" + echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." + else + if [ -f "$ZSH_CUSTOM/$1.zsh-theme" ] + then + source "$ZSH_CUSTOM/$1.zsh-theme" + else + source "$ZSH/themes/$1.zsh-theme" + fi + fi +} + +function lstheme +{ + cd $ZSH/themes + ls *zsh-theme | sed 's,\.zsh-theme$,,' +} diff --git a/oh-my-zsh/plugins/thor/_thor b/oh-my-zsh/plugins/thor/_thor @@ -0,0 +1,4 @@ +#compdef thor +#autoload + +compadd `thor list | grep thor | cut -d " " -f 2` diff --git a/oh-my-zsh/plugins/tig/README.md b/oh-my-zsh/plugins/tig/README.md @@ -0,0 +1,16 @@ +# `tig` plugin + +This plugin adds some aliases for people who work with `tig` in +a regular basis. To use it, add `tig` to your plugins array: + +```zsh +plugins=(... tig) +``` + +## Features + +| Alias | Command | Description | +|-------|----------------|-------------------------------------------------| +| `tis` | `tig status` | Show git status | +| `til` | `tig log` | Show git log | +| `tib` | `tig blame -C` | `git-blame` a file detecting copies and renames | diff --git a/oh-my-zsh/plugins/tig/tig.plugin.zsh b/oh-my-zsh/plugins/tig/tig.plugin.zsh @@ -0,0 +1,3 @@ +alias tis='tig status' +alias til='tig log' +alias tib='tig blame -C' diff --git a/oh-my-zsh/plugins/tmux-cssh/_tmux-cssh b/oh-my-zsh/plugins/tmux-cssh/_tmux-cssh @@ -0,0 +1,25 @@ +#compdef tmux-cssh + +# tmux-cssh autocompletion for oh-my-zsh +# Requires: tmux-cssh installed +# Author: Manfred Touron (@moul) + +_arguments \ +'(-h --help)'{-h,--help}'[This help.]' \ +'(-u --user)'{-u,--user}'[User to use.]' \ +'(-c --certificate)'{-c,--certificate}'[Path to ssh-certificate to use.]' \ +'(-sc --ssh)'{-sc,--ssh}'[SSH-connection-string, multiple.]' \ +'(-sa --ssh)'{-sa,--ssh}'[SSH connection arguments, used on every session.]' \ +'(-ts --tmux)'{-ts,--tmux}'[Alternative tmux-session-name, default: tmux-cssh]' \ +'(-ns --new)'{-ns,--new}'[Initializes a new session, like -ts \[name\].]' \ +'(-q --quiet)'{-q,--quiet}'[Quiet-mode.]' \ +'(-f --filename)'{-f,--filename}'[Filename of textfile to get -sc connection-strings from, line separated.]' \ +'(-cs --config)'{-cs,--config}'[Name of config-settings which should be get from config-file "$HOME/.tmux-cssh". Which can be a grep-regular expression to find the name(s).]' \ + ':hosts:_hosts' \ + '*:: :->subcmds' \ + && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "tmux-cssh command" + return +fi diff --git a/oh-my-zsh/plugins/tmux/tmux.extra.conf b/oh-my-zsh/plugins/tmux/tmux.extra.conf @@ -0,0 +1,2 @@ +set -g default-terminal $ZSH_TMUX_TERM +source $HOME/.tmux.conf diff --git a/oh-my-zsh/plugins/tmux/tmux.only.conf b/oh-my-zsh/plugins/tmux/tmux.only.conf @@ -0,0 +1 @@ +set -g default-terminal $ZSH_TMUX_TERM diff --git a/oh-my-zsh/plugins/tmux/tmux.plugin.zsh b/oh-my-zsh/plugins/tmux/tmux.plugin.zsh @@ -0,0 +1,98 @@ +# +# Aliases +# + +alias ta='tmux attach -t' +alias tad='tmux attach -d -t' +alias ts='tmux new-session -s' +alias tl='tmux list-sessions' +alias tksv='tmux kill-server' +alias tkss='tmux kill-session -t' + +# Only run if tmux is actually installed +if which tmux &> /dev/null + then + # Configuration variables + # + # Automatically start tmux + [[ -n "$ZSH_TMUX_AUTOSTART" ]] || ZSH_TMUX_AUTOSTART=false + # Only autostart once. If set to false, tmux will attempt to + # autostart every time your zsh configs are reloaded. + [[ -n "$ZSH_TMUX_AUTOSTART_ONCE" ]] || ZSH_TMUX_AUTOSTART_ONCE=true + # Automatically connect to a previous session if it exists + [[ -n "$ZSH_TMUX_AUTOCONNECT" ]] || ZSH_TMUX_AUTOCONNECT=true + # Automatically close the terminal when tmux exits + [[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT=$ZSH_TMUX_AUTOSTART + # Set term to screen or screen-256color based on current terminal support + [[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true + # Set '-CC' option for iTerm2 tmux integration + [[ -n "$ZSH_TMUX_ITERM2" ]] || ZSH_TMUX_ITERM2=false + # The TERM to use for non-256 color terminals. + # Tmux states this should be screen, but you may need to change it on + # systems without the proper terminfo + [[ -n "$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITHOUT_256COLOR="screen" + # The TERM to use for 256 color terminals. + # Tmux states this should be screen-256color, but you may need to change it on + # systems without the proper terminfo + [[ -n "$ZSH_TMUX_FIXTERM_WITH_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITH_256COLOR="screen-256color" + + + # Get the absolute path to the current directory + local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)" + + # Determine if the terminal supports 256 colors + if [[ `tput colors` == "256" ]] + then + export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR + else + export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR + fi + + # Set the correct local config file to use. + if [[ "$ZSH_TMUX_ITERM2" == "false" ]] && [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] + then + #use this when they have a ~/.tmux.conf + export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.extra.conf" + else + #use this when they don't have a ~/.tmux.conf + export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.only.conf" + fi + + # Wrapper function for tmux. + function _zsh_tmux_plugin_run() + { + # We have other arguments, just run them + if [[ -n "$@" ]] + then + \tmux $@ + # Try to connect to an existing session. + elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] + then + \tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` attach || \tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session + [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit + # Just run tmux, fixing the TERM variable if requested. + else + \tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` + [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit + fi + } + + # Use the completions for tmux for our function + compdef _tmux _zsh_tmux_plugin_run + + # Alias tmux to our wrapper function. + alias tmux=_zsh_tmux_plugin_run + + # Autostart if not already in tmux and enabled. + if [[ ! -n "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" ]] + then + # Actually don't autostart if we already did and multiple autostarts are disabled. + if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]] + then + export ZSH_TMUX_AUTOSTARTED=true + _zsh_tmux_plugin_run + fi + fi +else + print "zsh tmux plugin: tmux not found. Please install tmux before using this plugin." +fi diff --git a/oh-my-zsh/plugins/tmuxinator/_tmuxinator b/oh-my-zsh/plugins/tmuxinator/_tmuxinator @@ -0,0 +1,40 @@ +#compdef tmuxinator mux +#autoload + +local curcontext="$curcontext" state line ret=1 +local -a _configs + +_arguments -C \ + '1: :->cmds' \ + '2:: :->args' && ret=0 + +_configs=(${$(echo ~/.tmuxinator/*.yml):r:t}) + +case $state in + cmds) + _values "tmuxinator command" \ + "new[create a new project file and open it in your editor]" \ + "start[start a tmux session using project's tmuxinator config]" \ + "open[create a new project file and open it in your editor]" \ + "copy[copy source_project project file to a new project called new_project]" \ + "delete[deletes the project called project_name]" \ + "debug[output the shell commands generated by a projet]" \ + "implode[deletes all existing projects!]" \ + "list[list all existing projects]" \ + "doctor[look for problems in your configuration]" \ + "help[shows this help document]" \ + "version[shows tmuxinator version number]" \ + $_configs + ret=0 + ;; + args) + case $line[1] in + start|open|copy|delete|debug) + [[ -n "$_configs" ]] && _values 'configs' $_configs + ret=0 + ;; + esac + ;; +esac + +return ret diff --git a/oh-my-zsh/plugins/torrent/torrent.plugin.zsh b/oh-my-zsh/plugins/torrent/torrent.plugin.zsh @@ -0,0 +1,17 @@ +# +# Algorithm borrowed from http://wiki.rtorrent.org/MagnetUri and adapted to work with zsh. +# + +function magnet_to_torrent() { + [[ "$1" =~ xt=urn:btih:([^\&/]+) ]] || return 1 + + hashh=${match[1]} + + if [[ "$1" =~ dn=([^\&/]+) ]];then + filename=${match[1]} + else + filename=$hashh + fi + + echo "d10:magnet-uri${#1}:${1}e" > "$filename.torrent" +}+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/tugboat/_tugboat b/oh-my-zsh/plugins/tugboat/_tugboat @@ -0,0 +1,106 @@ +#compdef tugboat +#autoload + +# Tugboat zsh autocompletion + + +local -a _commands +_commands=( + 'add-key:[NAME] Upload an ssh public key.' + 'authorize:Authorize a DigitalOcean account with tugboat.' + 'create:[NAME] Create a droplet.' + 'destroy:[FUZZY_NAME] Destroy a droplet.' + 'destroy_image:[FUZZY_NAME] Destroy an image.' + 'droplets:Retrieve a list of your droplets.' + 'halt:[FUZZY_NAME] Shutdown a droplet.' + 'help:[COMMAND] Describe commands or a specific command.' + 'images:Retrieve a list of your images.' + 'info:[FUZZY_NAME] [OPTIONS] Show a droplets information.' + 'info_image:[FUZZY_NAME] [OPTIONS] Show an images information.' + 'keys:Show available SSH keys.' + 'password-reset:[FUZZY_NAME] Reset root password.' + 'rebuild:[FUZZY_NAME] [IMAGE_NAME] Rebuild a droplet.' + 'regions:Show regions.' + 'resize:[FUZZY_NAME -s, --size=N] Resize a droplet.' + 'restart:[FUZZY_NAME] Restart a droplet.' + 'sizes:Show available droplet sizes.' + 'snapshot:[SNAPSHOT_NAME] [FUZZY_NAME] [OPTIONS] Queue a snapshot of the droplet.' + 'ssh:[FUZZY_NAME] SSH into a droplet.' + 'start:[FUZZY_NAME] Start a droplet.' + 'verify:Check your DigitalOcean credentials.' + 'version:Show version.' + 'wait:[FUZZY_NAME] Wait for a droplet to reach a state.' +) + +local -a _create_arguments +_create_arguments=( + '-s:[--size=N] The size_id of the droplet' + '-i:[--image=N] The image_id of the droplet' + '-r:[--region=N] The region_id of the droplet' + '-k:[--keys=KEYS] A comma separated list of SSH key ids to add to the droplet' + '-p:[--private-networking] Enable private networking on the droplet' + '-b:[--backups-enabled] Enable backups on the droplet' + '-q:[--quiet]' +) + +__task_list () +{ + local expl + declare -a tasks + + arguments=(add-key authorize create destroy destroy_image droplets halt help images info info_image keys password-reset rebuild regions resize restart sizes snapshot ssh start verify version wait) + + _wanted tasks expl 'help' compadd $arguments +} + +__droplets_list () +{ + _wanted application expl 'command' compadd $(command tugboat droplets | cut -d " " -f1) +} + +__tugboat-create () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + _describe -t commands "gem subcommand" _create_arguments + return + ;; + esac +} + +local curcontext="$curcontext" state line +typeset -A opt_args + +_arguments -C \ + ':command:->command' \ + '*::options:->options' + +case $state in + (command) + _describe -t commands "gem subcommand" _commands + return + ;; + + (options) + case $line[1] in + (help) + _arguments ':feature:__task_list' + ;; + + (ssh) + _arguments ':feature:__droplets_list' + ;; + + (create) + _arguments ':feature:__tugboat-create' + ;; + esac + ;; +esac diff --git a/oh-my-zsh/plugins/ubuntu/readme.md b/oh-my-zsh/plugins/ubuntu/readme.md @@ -0,0 +1,21 @@ +This plugin was created because the aliases in the debian plugin are inconsistent and hard to remember. Also this apt-priority detection that switched between apt-get and aptitude was dropped to keep it simpler. This plugin uses apt-get for everything but a few things that are only possible with aptitude I guess. Ubuntu does not have aptitude installed by default. + +acs = Apt-Cache Search +acp = Apt-Cache Policy + +ag = sudo Apt-Get +agi = sudo Apt-Get Install +agd = sudo Apt-Get Dselect-upgrade +By now you already can guess almost all aliases + +There are two exeptions since ... +agu = sudo Apt-Get Update - we have ... +agug = sudo Apt-Get UpGrade - as the exceptional 4 letter alias for a single command. + +afs = Apt-File Search --regexp - this has the regexp switch on without being represented in the alias, I guess this makes sense since the debian plugin has it, I never used that command. + +Then there are the 2 other 4 letter aliases for combined commands, that are straight forward and easy to remember. +aguu = sudo Apt-Get Update && sudo apt-get Upgrade - better then adg or not? +agud = sudo Apt-Get Update && sudo apt-get full-upgrade + +For a full list aliases and the functions just watch the plugins code https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/ubuntu/ubuntu.plugin.zsh, look at the comments if you want to switch from the debian plugin. Ubuntu, Mint and & co users will like the new aar function to install packages from ppas with a single command. diff --git a/oh-my-zsh/plugins/ubuntu/ubuntu.plugin.zsh b/oh-my-zsh/plugins/ubuntu/ubuntu.plugin.zsh @@ -0,0 +1,154 @@ +# Authors: +# https://github.com/AlexBio +# https://github.com/dbb +# https://github.com/Mappleconfusers +# https://github.com/trinaldi +# Nicolas Jonas nextgenthemes.com +# https://github.com/loctauxphilippe +# +# Debian, Ubuntu and friends related zsh aliases and functions for zsh + +alias acs='apt-cache search' +compdef _acs acs='apt-cache search' + +alias afs='apt-file search --regexp' +compdef _afs afs='apt-file search --regexp' + +# These are apt-get only +alias ags='apt-get source' # asrc +compdef _ags ags='apt-get source' + +alias acp='apt-cache policy' # app +compdef _acp acp='apt-cache policy' + +#List all installed packages +alias agli='apt list --installed' +compdef _agli agli='apt list --installed' + +# superuser operations ###################################################### + +# List available updates only +alias aglu='sudo apt-get -u upgrade --assume-no' +compdef _aglu aglu='sudo apt-get -u upgrade --assume-no' + +alias afu='sudo apt-file update' +compdef _afu afu='sudo apt-file update' + +alias ppap='sudo ppa-purge' +compdef _ppap ppap='sudo ppa-purge' + +alias apg='sudo apt-get' # age - but without sudo +alias aga='sudo apt-get autoclean' # aac +alias agb='sudo apt-get build-dep' # abd +alias agc='sudo apt-get clean' # adc +alias agd='sudo apt-get dselect-upgrade' # ads +alias agi='sudo apt-get install' # ai +alias agp='sudo apt-get purge' # ap +alias agr='sudo apt-get remove' # ar +alias agu='sudo apt-get update' # ad +alias agud='sudo apt-get update && sudo apt-get full-upgrade' #adu +alias agug='sudo apt-get upgrade' # ag +alias aguu='sudo apt-get update && sudo apt-get upgrade' #adg +alias agar='sudo apt-get autoremove' + +compdef _ag apg='sudo apt-get' +compdef _aga aga='sudo apt-get autoclean' +compdef _agb agb='sudo apt-get build-dep' +compdef _agc agc='sudo apt-get clean' +compdef _agd agd='sudo apt-get dselect-upgrade' +compdef _agi agi='sudo apt-get install' +compdef _agp agp='sudo apt-get purge' +compdef _agr agr='sudo apt-get remove' +compdef _agu agu='sudo apt-get update' +compdef _agud agud='sudo apt-get update && sudo apt-get full-upgrade' +compdef _agug agug='sudo apt-get upgrade' +compdef _aguu aguu='sudo apt-get update && sudo apt-get upgrade' +compdef _agar agar='sudo apt-get autoremove' + +# Remove ALL kernel images and headers EXCEPT the one in use +alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \ + ?not(~n`uname -r`))' + +# Misc. ##################################################################### +# print all installed packages +alias allpkgs='dpkg --get-selections | grep -v deinstall' + +# Create a basic .deb package +alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' + +# apt-add-repository with automatic install/upgrade of the desired package +# Usage: aar ppa:xxxxxx/xxxxxx [packagename] +# If packagename is not given as 2nd argument the function will ask for it and guess the default by taking +# the part after the / from the ppa name which is sometimes the right name for the package you want to install +aar() { + if [ -n "$2" ]; then + PACKAGE=$2 + else + read "PACKAGE?Type in the package name to install/upgrade with this ppa [${1##*/}]: " + fi + + if [ -z "$PACKAGE" ]; then + PACKAGE=${1##*/} + fi + + sudo apt-add-repository $1 && sudo apt-get update + sudo apt-get install $PACKAGE +} + +# Prints apt history +# Usage: +# apt-history install +# apt-history upgrade +# apt-history remove +# apt-history rollback +# apt-history list +# Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html +apt-history () { + case "$1" in + install) + zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*) + ;; + upgrade|remove) + zgrep --no-filename $1 $(ls -rt /var/log/dpkg*) + ;; + rollback) + zgrep --no-filename upgrade $(ls -rt /var/log/dpkg*) | \ + grep "$2" -A10000000 | \ + grep "$3" -B10000000 | \ + awk '{print $4"="$5}' + ;; + list) + zgrep --no-filename '' $(ls -rt /var/log/dpkg*) + ;; + *) + echo "Parameters:" + echo " install - Lists all packages that have been installed." + echo " upgrade - Lists all packages that have been upgraded." + echo " remove - Lists all packages that have been removed." + echo " rollback - Lists rollback information." + echo " list - Lists all contains of dpkg logs." + ;; + esac +} + +# Kernel-package building shortcut +kerndeb () { + # temporarily unset MAKEFLAGS ( '-j3' will fail ) + MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' ) + print '$MAKEFLAGS set to '"'$MAKEFLAGS'" + appendage='-custom' # this shows up in $ (uname -r ) + revision=$(date +"%Y%m%d") # this shows up in the .deb file name + + make-kpkg clean + + time fakeroot make-kpkg --append-to-version "$appendage" --revision \ + "$revision" kernel_image kernel_headers +} + +# List packages by size +function apt-list-packages { + dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | \ + grep -v deinstall | \ + sort -n | \ + awk '{print $1" "$2}' +} diff --git a/oh-my-zsh/plugins/urltools/urltools.plugin.zsh b/oh-my-zsh/plugins/urltools/urltools.plugin.zsh @@ -0,0 +1,42 @@ +# URL Tools +# Adds handy command line aliases useful for dealing with URLs +# +# Taken from: +# http://ruslanspivak.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/ + +if [[ $(whence $URLTOOLS_METHOD) = "" ]]; then + URLTOOLS_METHOD="" +fi + +if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xnode" ) ]]; then + alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"' + alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"' +elif [[ $(whence python3) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then + alias urlencode='python3 -c "import sys, urllib.parse as up; print(up.quote_plus(sys.argv[1]))"' + alias urldecode='python3 -c "import sys, urllib.parse as up; print(up.unquote_plus(sys.argv[1]))"' +elif [[ $(whence python2) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then + alias urlencode='python2 -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"' + alias urldecode='python2 -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"' +elif [[ $(whence xxd) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xshell" ) ]]; then + function urlencode() {echo $@ | tr -d "\n" | xxd -plain | sed "s/\(..\)/%\1/g"} + function urldecode() {printf $(echo -n $@ | sed 's/\\/\\\\/g;s/\(%\)\([0-9a-fA-F][0-9a-fA-F]\)/\\x\2/g')"\n"} +elif [[ $(whence ruby) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xruby" ) ]]; then + alias urlencode='ruby -r cgi -e "puts CGI.escape(ARGV[0])"' + alias urldecode='ruby -r cgi -e "puts CGI.unescape(ARGV[0])"' +elif [[ $(whence php) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xphp" ) ]]; then + alias urlencode='php -r "echo rawurlencode(\$argv[1]); echo \"\n\";"' + alias urldecode='php -r "echo rawurldecode(\$argv[1]); echo \"\\n\";"' +elif [[ $(whence perl) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xperl" ) ]]; then + if perl -MURI::Encode -e 1&> /dev/null; then + alias urlencode='perl -MURI::Encode -ep "uri_encode($ARGV[0]);"' + alias urldecode='perl -MURI::Encode -ep "uri_decode($ARGV[0]);"' + elif perl -MURI::Escape -e 1 &> /dev/null; then + alias urlencode='perl -MURI::Escape -ep "uri_escape($ARGV[0]);"' + alias urldecode='perl -MURI::Escape -ep "uri_unescape($ARGV[0]);"' + else + alias urlencode="perl -e '\$new=\$ARGV[0]; \$new =~ s/([^A-Za-z0-9])/sprintf(\"%%%02X\", ord(\$1))/seg; print \"\$new\n\";'" + alias urldecode="perl -e '\$new=\$ARGV[0]; \$new =~ s/\%([A-Fa-f0-9]{2})/pack(\"C\", hex(\$1))/seg; print \"\$new\n\";'" + fi +fi + +unset URLTOOLS_METHOD diff --git a/oh-my-zsh/plugins/vagrant/_vagrant b/oh-my-zsh/plugins/vagrant/_vagrant @@ -0,0 +1,130 @@ +#compdef vagrant +#autoload + +# vagrant zsh completion + +local -a _1st_arguments +_1st_arguments=( + 'box:Box commands' + 'connect:Connects to a remotely shared Vagrant environment' + 'destroy:Destroys the vagrant environment' + 'docker-logs:Outputs the logs from the Docker container' + 'docker-run:Run a one-off command in the context of a container' + 'global-status:Reports the status of all active Vagrant environments on the system' + 'halt:Halts the currently running vagrant environment' + 'help:Shows the help for a subcommand' + 'init:[box_name] [box_url] Initializes current folder for Vagrant usage' + 'list-commands:Outputs all available Vagrant subcommands, even non-primary ones' + 'login:Authenticates against a Vagrant Cloud server to access protected boxes' + 'package:Packages a vagrant environment for distribution' + 'plugin:Plugin commands' + 'provision:Run the provisioner' + 'push:Deploys code in this environment to a configured destination' + 'rdp:Connects to machine via RDP' + 'reload:Reload the vagrant environment' + 'resume:Resumes a suspend vagrant environment' + 'rsync:Syncs rsync synced folders to remote machine' + 'rsync-auto:Syncs rsync synced folders automatically when files change' + 'share:Shares your Vagrant environment with anyone in the world' + 'snapshot:Manage snapshots with the guest machine' + 'ssh:SSH into the currently running environment' + 'ssh-config:Outputs .ssh/config valid syntax for connecting to this environment via ssh' + 'status:Shows the status of the current Vagrant environment' + 'suspend:Suspends the currently running vagrant environment' + 'snapshot:Used to manage snapshots with the guest machine' + 'up:Creates the vagrant environment' + 'version:Prints current and latest Vagrant version' + '--help:[TASK] Describe available tasks or one specific task' + '--version:Prints the Vagrant version information' +) + +local -a _box_arguments +_box_arguments=( + 'add:ADDRESS Adds a box to the system' + 'help:COMMAND List subcommands' + 'list:Lists all installed boxes' + 'outdated:Checks if a box has newer version' + 'remove:NAME Removes a box from the system' + 'repackage:NAME PROVIDER VERSION Repackages an installed box into a `.box` file' + 'update:Updates box to a newer version, if available' +) + +__task_list () +{ + local expl + declare -a tasks + + tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version) + + _wanted tasks expl 'help' compadd $tasks +} + +__box_list () +{ + _wanted application expl 'command' compadd $(command vagrant box list | sed -e 's/ /\\ /g') +} + +__vm_list () +{ + _wanted application expl 'command' compadd $(command grep Vagrantfile -oe '^[^#]*\.vm\.define *[:"]\([a-zA-Z0-9_-]\+\)' 2>/dev/null | awk '{print substr($2, 2)}') + _wanted application expl 'command' compadd $(command ls .vagrant/machines/ 2>/dev/null) +} + +__vagrant-box () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + _describe -t commands "gem subcommand" _box_arguments + return + ;; + + (options) + case $line[1] in + (repackage|remove) + _arguments ':feature:__box_list' + ;; + esac + ;; + esac +} + + + + +local expl +local -a boxes installed_boxes + +local curcontext="$curcontext" state line +typeset -A opt_args + +_arguments -C \ + ':command:->command' \ + '*::options:->options' + +case $state in + (command) + _describe -t commands "gem subcommand" _1st_arguments + return + ;; + + (options) + case $line[1] in + (help) + _arguments ':feature:__task_list' + ;; + + (box) + __vagrant-box + ;; + (up|provision|package|destroy|reload|ssh|ssh-config|halt|resume|status) + _arguments ':feature:__vm_list' + esac + ;; +esac diff --git a/oh-my-zsh/plugins/vault/README.md b/oh-my-zsh/plugins/vault/README.md @@ -0,0 +1,18 @@ +## Vault (https://www.vaultproject.io) autocomplete plugin + +- Adds autocomplete options for all vault commands. + +####Show help for all commands +![General Help](http://i.imgur.com/yv5Db1r.png "Help for all commands") + + +####Create new Vault token +![Create token](http://i.imgur.com/xMegNgh.png "Create token") + + +####Enable audit backends +![Audit backends](http://i.imgur.com/fKLeiSF.png "Audit backends") + + + +Crafted with <3 by Valentin Bud ([@valentinbud](https://twitter.com/valentinbud))+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/vault/_vault b/oh-my-zsh/plugins/vault/_vault @@ -0,0 +1,400 @@ +#compdef vault + +typeset -a main_args +main_args=( + '(-version)-version[Prints the Vault version]' + '(-help)-help[Prints Vault Help]' +) + +typeset -a general_args +general_args=( + '(-help)-help[Prints Help]' + '(-address)-address=-[The address of the Vault server. Overrides the VAULT_ADDR environment variable if set.]:address:' + '(-ca-cert)-ca-cert=-[Path to a PEM encoded CA cert file to use to verify the Vault server SSL certificate. Overrides the VAULT_CACERT environment variable if set.]:file:_files -g "*.pem"' + '(-ca-path)-ca-path=-[Path to a directory of PEM encoded CA cert files to verify the Vault server SSL certificate. If both -ca-cert and -ca-path are specified, -ca-path is used.Overrides the VAULT_CAPATH environment variable if set.]:directory:_directories' + '(-client-cert)-client-cert=-[Path to a PEM encoded client certificate for TLS authentication to the Vault server. Must also specify -client-key. Overrides the VAULT_CLIENT_CERT environment variable if set.]:file:_files -g "*.pem"' + '(-client-key)-client-key=-[Path to an unencrypted PEM encoded private key matching the client certificate from -client-cert. Overrides the VAULT_CLIENT_KEY environment variable if set.]:file:_files -g "*.pem"' + '(-tls-skip-verify)-tls-skip-verify[Do not verify TLS certificate. This is highly not recommended. Verification will also be skipped if VAULT_SKIP_VERIFY is set.]' +) + +typeset -a audit_enable_args +audit_enable_args=( + '(-description)-description=-[A human-friendly description for the backend. This shows up only when querying the enabled backends.]:description:' + '(-id)-id=-[Specify a unique ID for this audit backend. This is purely for referencing this audit backend. By default this will be the backend type.]:id:' +) + +typeset -a auth_args +auth_args=( + '(-method)-method=-[Outputs help for the authentication method with the given name for the remote server. If this authentication method is not available, exit with code 1.]:method:(cert ldap github userpass app-id)' + '(-method-help)-method-help[If set, the help for the selected method will be shown.]' + '(-methods)-methods[List the available auth methods.]' + '(-no-verify)-no-verify[Do not verify the token after creation; avoids a use count]' +) + +typeset -a auth_enable_args +auth_enable_args=( + '(-description)-description=-[Human-friendly description of the purpose for the auth provider. This shows up in the auth-list command.]:description:' + '(-path)-path=-[Mount point for the auth provider. This defaults to the type of the mount. This will make the auth provider available at "/auth/<path>"]:path:' +) + +typeset -a init_args +init_args=( + '(-key-shares)-key-shares=-[(default: 5) The number of key shares to split the master key into.]:keyshares:' + '(-key-threshold)-key-threshold=-[(default: 3) The number of key shares required to reconstruct the master key.]:keythreshold:' + '(-pgp-keys)-pgp-keys[If provided, must be a comma-separated list of files on disk containing binary- or base64-format public PGP keys. The number of files must match "key-shares". The output unseal keys will encrypted and hex-encoded, in order, with the given public keys. If you want to use them with the "vault unseal" command, you will need to hex decode and decrypt; this will be the plaintext unseal key.]:pgpkeys:_files' +) + +typeset -a mount_tune_args +mount_tune_args=( + '(-default-lease-ttl)-default-lease-ttl=-[Default lease time-to-live for this backend. If not specified, uses the system default, or the previously set value. Set to "system" to explicitly set it to use the system default.]:defaultleasettl:' + '(-max-lease-ttl)-max-lease-ttl=-[Max lease time-to-live for this backend. If not specified, uses the system default, or the previously set value. Set to "system" to explicitly set it to use the system default.]:maxleasettl:' +) + +typeset -a mount_args +mount_args=( + $mount_tune_args + '(-path)-path=-[Mount point for the logical backend. This defauls to the type of the mount.]:path:' + '(-description)-description=-[Human-friendly description of the purpose for the mount. This shows up in the mounts command.]:description:' +) + +typeset -a rekey_args +rekey_args=( + $init_args + '(-init)-init[Initialize the rekey operation by setting the desired number of shares and the key threshold. This can only be done if no rekey is already initiated.]:init:' + '(-cancel)-cancel[Reset the rekey process by throwing away prior keys and the rekey configuration.]:cancel:' + '(-status)-status[Prints the status of the current rekey operation. This can be used to see the status without attempting to provide an unseal key.]:status:' +) + +typeset -a ssh_args +ssh_args=( + '(-role)-role[Role to be used to create the key. ]:role:' + '(-no-exec)-no-exec[Shows the credentials but does not establish connection.]:noexec:' + '(-mount-point)-mount-point[Mount point of SSH backend. If the backend is mounted at "ssh", which is the default as well, this parameter can be skipped.]:mountpoint:' + '(-format)-format[If no-exec option is enabled, then the credentials will be printed out and SSH connection will not be established. The format of the output can be "json" or "table". JSON output is useful when writing scripts. Default is "table".]:format:(json table)' +) + +typeset -a token_create_args +token_create_args=( + '(-id)-id=-[The token value that clients will use to authenticate with vault. If not provided this defaults to a 36 character UUID. A root token is required to specify the ID of a token.]:id:' + '(-display-name)-display-name=-[A display name to associate with this token. This is a non-security sensitive value used to help identify created secrets, i.e. prefixes.]:displayname:' + '(-ttl)-ttl=-[TTL to associate with the token. This option enables the tokens to be renewable.]:ttl:' + '*-metadata=-[Metadata to associate with the token. This shows up in the audit log. This can be specified multiple times.]:metadata:' + '(-orphan)-orphan[If specified, the token will have no parent. Only root tokens can create orphan tokens. This prevents the new token from being revoked with your token.]:orphan:' + '(-no-default-policy)-no-default-policy[If specified, the token will not have the "default" policy included in its policy set.]:nodefaultpolicy:' + '*-policy=-[Policy to associate with this token. This can be specified multiple times.]:policy:__vault_policies' + '(-use-limit)-use-limit=-[The number of times this token can be used until it is automatically revoked.]:uselimit:' + '(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' +) + +typeset -a server_args +server_args=( + '*-config=-[Path to the configuration file or directory. This can be specified multiple times. If it is a directory, all files with a ".hcl" or ".json" suffix will be loaded.]:config:_files' + '-dev[Enables Dev mode. In this mode, Vault is completely in-memory and unsealed. Do not run the Dev server in production!]:dev:' + '-log-level=-[Log verbosity. Defaults to "info", will be outputtedto stderr. Supported values: "trace", "debug", "info", "warn", "err"]:loglevel:(trace debug info warn err)' +) + +_vault_audit-list() { + _arguments : \ + ${general_args[@]} && ret=0 +} + +_vault_audit-disable() { + # vault audit-list doesn't print the backend id so for now + # no *smart* autocompletion for this subcommand. + _arguments : \ + ${general_args[@]} \ + ':::(file syslog)' && ret=0 +} + +_vault_audit-enable() { + _arguments : \ + ${general_args[@]} \ + ${audit_enable_args[@]} \ + ': :->backends' \ + '*:: :->backendconfig' && ret=0 + + case $state in + backends) + local -a backends + backends=( + 'file:The "file" audit backend writes audit logs to a file.' + 'syslog:The "syslog" audit backend writes audit logs to syslog.' + ) + _describe -t backends 'vault audit backends' backends && ret=0 + ;; + backendconfig) + case ${line[1]} in + file) + _values -w "Audit Backend File" \ + 'path[(required) - The path to where the file will be written. If this path exists, the audit backend will append to it.]:file:_files' \ + 'log_raw[(optional) Should security sensitive information be logged raw. Defaults to "false".]:log_raw:(true false)' && ret=0 + ;; + syslog) + _values -w "Audit Backend Syslog" \ + 'facility[(optional) - The syslog facility to use. Defaults to "AUTH".]:facility:(kern user mail daemon auth syslog lpr news uucp authpriv ftp cron local0 local1 local2 local3 local4 local5 local6 local7)' \ + 'tag[(optional) - The syslog tag to use. Defaults to "vault".]:tag:' \ + 'log_raw[(optional) Should security sensitive information be logged raw.]:log_raw:(true false)' && ret=0 + ;; + esac + ;; + esac +} + +_vault_auth() { + _arguments : \ + ${general_args[@]} \ + ${auth_args[@]} && ret=0 +} + +_vault_auth-enable() { + _arguments : \ + ${general_args[@]} \ + ${auth_enable_args[@]} \ + ':::(cert ldap github userpass app-id)' && ret=0 +} + +__vault_auth_methods() { + local -a authmethods + authmethods=($(vault auth -methods | awk 'NR>1{split ($1,a,"/"); print a[1]":["$2"]"}')) + _describe -t authmethods 'authmethods' authmethods && ret=0 +} + +_vault_auth-disable() { + _arguments : \ + ${general_args[@]} \ + ':::__vault_auth_methods' && ret=0 + +} + +_vault_init() { + _arguments : \ + ${general_args[@]} \ + ${init_args[@]} && ret=0 +} + +_vault_key-status() { + _arguments : \ + ${general_args[@]} && ret=0 +} + +__vault_mounts() { + local -a mounts + mounts=($(vault mounts | awk 'NR>1{split ($1,a,"/"); print a[1]":["$2"]"}')) + _describe -t mounts 'mounts' mounts && ret=0 +} + +_vault_mounts() { + _arguments : \ + ${general_args[@]} && ret=0 +} + +_vault_mount() { + # to find out how many types of backens are there + _arguments : \ + ${general_args[@]} \ + ${mount_args[@]} \ + ':::(generic ssh)' && ret=0 +} + +_vault_mount-tune() { + _arguments : \ + ${general_args[@]} \ + ${mount_tune_args[@]} \ + ':::__vault_mounts' && ret=0 +} + +_vault_unmount() { + _arguments : \ + ${general_args[@]} \ + ':::__vault_mounts' && ret=0 +} + +_vault_remount() { + _arguments : \ + ${general_args[@]} \ + ':::__vault_mounts' \ + ':::' && ret=0 +} + +__vault_policies() { + local -a policies + policies=($(vault policies | awk '{print $1":["$1"]"}')) + _describe -t policies 'policies' policies && ret=0 +} + +_vault_policies() { + _arguments : \ + ${general_args[@]} \ + ':::__vault_policies' && ret=0 +} + +_vault_policy-delete() { + _arguments : \ + ${general_args[@]} \ + ':::__vault_policies' && ret=0 +} + +_vault_policy-write() { + _arguments : \ + ${general_args[@]} \ + ': ::' \ + '::policy:_files' && ret=0 +} + +_vault_status() { + _arguments : \ + ${general_args[@]} && ret=0 +} + +_vault_rekey() { + _arguments : \ + ${general_args[@]} \ + ${rekey_args[@]} \ + ': ::' && ret=0 +} + +_vault_rotate() { + _arguments : \ + ${general_args[@]} && ret=0 +} + +_vault_seal() { + _arguments : \ + ${general_args[@]} && ret=0 +} + +_vault_ssh() { + _arguments : \ + ${general_args[@]} \ + ${ssh_args[@]} \ + ': ::' && ret=0 +} + +_vault_token-create() { + _arguments : \ + ${general_args[@]} \ + ${token_create_args[@]} && ret=0 +} + +_vault_token-renew() { + _arguments : \ + ${general_args[@]} \ + '(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' \ + ': ::' \ + ': ::' && ret=0 +} + +_vault_token-revoke() { + _arguments : \ + ${general_args[@]} \ + '(-mode)-mode=-[The type of revocation to do. See the documentation above for more information.]:mode:( orphan path)' \ + ': ::' && ret=0 +} + +_vault_unseal() { + _arguments : \ + ${general_args[@]} \ + '(-reset)-reset[Reset the unsealing process by throwing away prior keys in process to unseal the vault.]:reset:' \ + ': ::' && ret=0 +} + +_vault_version() { + # no args +} + +_vault_delete() { + _arguments : \ + ${general_args[@]} \ + ': ::' && ret=0 +} + +_vault_path-help() { + _arguments : \ + ${general_args[@]} \ + ': ::' && ret=0 +} + +_vault_revoke() { + _arguments : \ + ${general_args[@]} \ + '(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' \ + ': ::' \ + ': ::' && ret=0 +} + +_vault_server() { + _arguments : \ + ${server_args[@]} && ret=0 + +} + +_vault_write() { + _arguments : \ + ${general_args[@]} \ + '(-f -force)'{-f,-force}'[Force the write to continue without any data values specified. This allows writing to keys that do not need or expect any fields to be specified.]:force:' \ + ': ::' \ + ': ::' && ret=0 +} + +_vault_read() { + _arguments : \ + ${general_args[@]} \ + '(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' \ + '(-field)-field=-[If included, the raw value of the specified field will be output raw to stdout.]:field:' \ + ': ::' && ret=0 +} + +_vault_commands() { + local -a commands + + commands=( + "delete":"Delete operation on secrets in Vault" + "path-help":"Look up the help for a path" + "read":"Read data or secrets from Vault" + "renew":"Renew the lease of a secret" + "revoke":"Revoke a secret" + "server":"Start a Vault server" + "status":"Outputs status of whether Vault is sealed and if HA mode is enabled" + "write":"Write secrets or configuration into Vault" + "audit-disable":"Disable an audit backend" + "audit-enable":"Enable an audit backend" + "audit-list":"Lists enabled audit backends in Vault" + "auth":"Prints information about how to authenticate with Vault" + "auth-disable":"Disable an auth provider" + "auth-enable":"Enable a new auth provider" + "init":"Initialize a new Vault server" + "key-status":"Provides information about the active encryption key" + "mount":"Mount a logical backend" + "mount-tune":"Tune mount configuration parameters" + "mounts":"Lists mounted backends in Vault" + "policies":"List the policies on the server" + "policy-delete":"Delete a policy from the server" + "policy-write":"Write a policy to the server" + "rekey":"Rekeys Vault to generate new unseal keys" + "remount":"Remount a secret backend to a new path" + "rotate":"Rotates the backend encryption key used to persist data" + "seal":"Seals the vault server" + "ssh":"Initiate a SSH session" + "token-create":"Create a new auth token" + "token-renew":"Renew an auth token if there is an associated lease" + "token-revoke":"Revoke one or more auth tokens" + "unmount":"Unmount a secret backend" + "unseal":"Unseals the vault server" + "version":"Prints the Vault version" + ) + + _describe -t commands 'vault command' commands && ret=0 +} + +local curcontext=$curcontext ret=1 +_arguments : \ + ${main_args[@]} \ + '*:: :->subcommands' && ret=0 +if ((CURRENT == 1 )); then + _vault_commands && ret=0 +fi +if [[ $state == subcommands ]]; then + # (( CURRENT -- )) + curcontext="${curcontext%:*:*}:vault-$words[1]:" + _call_function ret _vault_$words[1] +fi diff --git a/oh-my-zsh/plugins/vi-mode/README.md b/oh-my-zsh/plugins/vi-mode/README.md @@ -0,0 +1,75 @@ +vi-mode +======= +This plugin increase `vi-like` zsh functionality. + +Use `ESC` or `CTRL-[` to enter `Normal mode`. + + +History +------- + +- `ctrl-p` : Previous command in history +- `ctrl-n` : Next command in history +- `/` : Search backward in history +- `n` : Repeat the last `/` + + +Mode indicators +--------------- + +*Normal mode* is indicated with red `<<<` mark at the right prompt, when it +wasn't defined by theme. + + +Vim edition +----------- + +- `v` : Edit current command line in Vim + + +Movement +-------- + +- `$` : To the end of the line +- `^` : To the first non-blank character of the line +- `0` : To the first character of the line +- `w` : [count] words forward +- `W` : [count] WORDS forward +- `e` : Forward to the end of word [count] inclusive +- `E` : Forward to the end of WORD [count] inclusive +- `b` : [count] words backward +- `B` : [count] WORDS backward +- `t{char}` : Till before [count]'th occurrence of {char} to the right +- `T{char}` : Till before [count]'th occurrence of {char} to the left +- `f{char}` : To [count]'th occurrence of {char} to the right +- `F{char}` : To [count]'th occurrence of {char} to the left +- `;` : Repeat latest f, t, F or T [count] times +- `,` : Repeat latest f, t, F or T in opposite direction + + +Insertion +--------- + +- `i` : Insert text before the cursor +- `I` : Insert text before the first character in the line +- `a` : Append text after the cursor +- `A` : Append text at the end of the line +- `o` : Insert new command line below the current one +- `O` : Insert new command line above the current one + + +Delete and Insert +----------------- + +- `ctrl-h` : While in *Insert mode*: delete character before the cursor +- `ctrl-w` : While in *Insert mode*: delete word before the cursor +- `d{motion}` : Delete text that {motion} moves over +- `dd` : Delete line +- `D` : Delete characters under the cursor until the end of the line +- `c{motion}` : Delete {motion} text and start insert +- `cc` : Delete line and start insert +- `C` : Delete to the end of the line and start insert +- `r{char}` : Replace the character under the cursor with {char} +- `R` : Enter replace mode: Each character replaces existing one +- `x` : Delete [count] characters under and after the cursor +- `X` : Delete [count] characters before the cursor diff --git a/oh-my-zsh/plugins/vi-mode/vi-mode.plugin.zsh b/oh-my-zsh/plugins/vi-mode/vi-mode.plugin.zsh @@ -0,0 +1,50 @@ +# Updates editor information when the keymap changes. +function zle-keymap-select() { + zle reset-prompt + zle -R +} + +# Ensure that the prompt is redrawn when the terminal size changes. +TRAPWINCH() { + zle && zle -R +} + +zle -N zle-keymap-select +zle -N edit-command-line + + +bindkey -v + +# allow v to edit the command line (standard behaviour) +autoload -Uz edit-command-line +bindkey -M vicmd 'v' edit-command-line + +# allow ctrl-p, ctrl-n for navigate history (standard behaviour) +bindkey '^P' up-history +bindkey '^N' down-history + +# allow ctrl-h, ctrl-w, ctrl-? for char and word deletion (standard behaviour) +bindkey '^?' backward-delete-char +bindkey '^h' backward-delete-char +bindkey '^w' backward-kill-word + +# allow ctrl-r to perform backward search in history +bindkey '^r' history-incremental-search-backward + +# allow ctrl-a and ctrl-e to move to beginning/end of line +bindkey '^a' beginning-of-line +bindkey '^e' end-of-line + +# if mode indicator wasn't setup by theme, define default +if [[ "$MODE_INDICATOR" == "" ]]; then + MODE_INDICATOR="%{$fg_bold[red]%}<%{$fg[red]%}<<%{$reset_color%}" +fi + +function vi_mode_prompt_info() { + echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}" +} + +# define right prompt, if it wasn't defined by a theme +if [[ "$RPS1" == "" && "$RPROMPT" == "" ]]; then + RPS1='$(vi_mode_prompt_info)' +fi diff --git a/oh-my-zsh/plugins/vim-interaction/README.md b/oh-my-zsh/plugins/vim-interaction/README.md @@ -0,0 +1,82 @@ +# Vim Interaction # + +The plugin presents a function called `callvim` whose usage is: + + usage: callvim [-b cmd] [-a cmd] [file ... fileN] + + -b cmd Run this command in GVIM before editing the first file + -a cmd Run this command in GVIM after editing the first file + file The file to edit + ... fileN The other files to add to the argslist + +## Rationale ## + +The idea for this script is to give you some decent interaction with a running +GVim session. Normally you'll be running around your filesystem doing any +number of amazing things and you'll need to load some files into GVim for +editing, inspecting, destruction, or other bits of mayhem. This script lets you +do that. + +## Aliases ## + +There are a few aliases presented as well: + +* `v` A shorthand for `callvim` +* `vvsp` Edits the passed in file but first makes a vertical split +* `vhsp` Edits the passed in file but first makes a horizontal split + +## Post Callout ## + +At the end of the `callvim` function we invoke the `postCallVim` function if it +exists. If you're using MacVim, for example, you could define a function that +brings window focus to it after the file is loaded: + + function postCallVim + { + osascript -e 'tell application "MacVim" to activate' + } + +This'll be different depending on your OS / Window Manager. + +## Examples ## + +This will load `/tmp/myfile.scala` into the running GVim session: + + > v /tmp/myfile.scala + +This will load it after first doing a vertical split: + + > vvsp /tmp/myfile.scala + or + > v -b':vsp' /tmp/myfile.scala + +This will load it after doing a horizontal split, then moving to the bottom of +the file: + + > vhsp -aG /tmp/myfile.scala + or + > v -b':sp' -aG /tmp/myfile.scala + +This will load the file and then copy the first line to the end (Why you would +ever want to do this... I dunno): + + > v -a':1t$' /tmp/myfile.scala + +And this will load all of the `*.txt` files into the args list: + + > v *.txt + +If you want to load files into areas that are already split, use one of the +aliases for that: + + # Do a ':wincmd h' first + > vh /tmp/myfile.scala + + # Do a ':wincmd j' first + > vj /tmp/myfile.scala + + # Do a ':wincmd k' first + > vk /tmp/myfile.scala + + # Do a ':wincmd l' first + > vl /tmp/myfile.scala diff --git a/oh-my-zsh/plugins/vim-interaction/vim-interaction.plugin.zsh b/oh-my-zsh/plugins/vim-interaction/vim-interaction.plugin.zsh @@ -0,0 +1,58 @@ +# +# See README.md +# +# Derek Wyatt (derek@{myfirstnamemylastname}.org +# + +function callvim +{ + if [[ $# == 0 ]]; then + cat <<EOH +usage: callvim [-b cmd] [-a cmd] [file ... fileN] + + -b cmd Run this command in GVIM before editing the first file + -a cmd Run this command in GVIM after editing the first file + file The file to edit + ... fileN The other files to add to the argslist +EOH + return 0 + fi + + local cmd="" + local before="<esc>" + local after="" + while getopts ":b:a:" option + do + case $option in + a) after="$OPTARG" + ;; + b) before="$OPTARG" + ;; + esac + done + shift $((OPTIND-1)) + if [[ ${after#:} != $after && ${after%<cr>} == $after ]]; then + after="$after<cr>" + fi + if [[ ${before#:} != $before && ${before%<cr>} == $before ]]; then + before="$before<cr>" + fi + local files + if [[ $# -gt 0 ]]; then + # absolute path of files resolving symlinks (:A) and quoting special chars (:q) + files=':args! '"${@:A:q}<cr>" + fi + cmd="$before$files$after" + gvim --remote-send "$cmd" + if typeset -f postCallVim > /dev/null; then + postCallVim + fi +} + +alias v=callvim +alias vvsp="callvim -b':vsp'" +alias vhsp="callvim -b':sp'" +alias vk="callvim -b':wincmd k'" +alias vj="callvim -b':wincmd j'" +alias vl="callvim -b':wincmd l'" +alias vh="callvim -b':wincmd h'" diff --git a/oh-my-zsh/plugins/virtualenv/virtualenv.plugin.zsh b/oh-my-zsh/plugins/virtualenv/virtualenv.plugin.zsh @@ -0,0 +1,7 @@ +function virtualenv_prompt_info(){ + [[ -n ${VIRTUAL_ENV} ]] || return + echo "${ZSH_THEME_VIRTUALENV_PREFIX:=[}${VIRTUAL_ENV:t}${ZSH_THEME_VIRTUALENV_SUFFIX:=]}" +} + +# disables prompt mangling in virtual_env/bin/activate +export VIRTUAL_ENV_DISABLE_PROMPT=1 diff --git a/oh-my-zsh/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/oh-my-zsh/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh @@ -0,0 +1,86 @@ +virtualenvwrapper='virtualenvwrapper.sh' + +if (( $+commands[$virtualenvwrapper] )); then + function { + setopt local_options + unsetopt equals + source ${${virtualenvwrapper}:c} + } +elif [[ -f "/etc/bash_completion.d/virtualenvwrapper" ]]; then + function { + setopt local_options + unsetopt equals + virtualenvwrapper="/etc/bash_completion.d/virtualenvwrapper" + source "/etc/bash_completion.d/virtualenvwrapper" + } +else + print "[oh-my-zsh] virtualenvwrapper plugin: Cannot find ${virtualenvwrapper}.\n"\ + "Please install with \`pip install virtualenvwrapper\`" >&2 + return +fi +if ! type workon &>/dev/null; then + print "[oh-my-zsh] virtualenvwrapper plugin: shell function 'workon' not defined.\n"\ + "Please check ${virtualenvwrapper}" >&2 + return +fi + +if [[ "$WORKON_HOME" == "" ]]; then + print "[oh-my-zsh] \$WORKON_HOME is not defined so plugin virtualenvwrapper will not work" >&2 + return +fi + +if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then + # Automatically activate Git projects or other customized virtualenvwrapper projects based on the + # directory name of the project. Virtual environment name can be overridden + # by placing a .venv file in the project root with a virtualenv name in it. + function workon_cwd { + if [[ -z "$WORKON_CWD" ]]; then + local WORKON_CWD=1 + # Check if this is a Git repo + local GIT_REPO_ROOT="" + local GIT_TOPLEVEL="$(git rev-parse --show-toplevel 2> /dev/null)" + if [[ $? == 0 ]]; then + GIT_REPO_ROOT="$GIT_TOPLEVEL" + fi + # Get absolute path, resolving symlinks + local PROJECT_ROOT="${PWD:A}" + while [[ "$PROJECT_ROOT" != "/" && ! -e "$PROJECT_ROOT/.venv" \ + && ! -d "$PROJECT_ROOT/.git" && "$PROJECT_ROOT" != "$GIT_REPO_ROOT" ]]; do + PROJECT_ROOT="${PROJECT_ROOT:h}" + done + if [[ "$PROJECT_ROOT" == "/" ]]; then + PROJECT_ROOT="." + fi + # Check for virtualenv name override + if [[ -f "$PROJECT_ROOT/.venv" ]]; then + ENV_NAME="$(cat "$PROJECT_ROOT/.venv")" + elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]];then + ENV_NAME="$PROJECT_ROOT/.venv" + elif [[ "$PROJECT_ROOT" != "." ]]; then + ENV_NAME="${PROJECT_ROOT:t}" + else + ENV_NAME="" + fi + if [[ "$ENV_NAME" != "" ]]; then + # Activate the environment only if it is not already active + if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then + if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then + workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME" + elif [[ -e "$ENV_NAME/bin/activate" ]]; then + source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME" + fi + fi + elif [[ -n $CD_VIRTUAL_ENV && -n $VIRTUAL_ENV ]]; then + # We've just left the repo, deactivate the environment + # Note: this only happens if the virtualenv was activated automatically + deactivate && unset CD_VIRTUAL_ENV + fi + fi + } + + # Append workon_cwd to the chpwd_functions array, so it will be called on cd + # http://zsh.sourceforge.net/Doc/Release/Functions.html + if ! (( $chpwd_functions[(I)workon_cwd] )); then + chpwd_functions+=(workon_cwd) + fi +fi diff --git a/oh-my-zsh/plugins/vundle/vundle.plugin.zsh b/oh-my-zsh/plugins/vundle/vundle.plugin.zsh @@ -0,0 +1,27 @@ +function vundle-init () { + if [ ! -d ~/.vim/bundle/Vundle.vim/ ] + then + mkdir -p ~/.vim/bundle/Vundle.vim/ + fi + + if [ ! -d ~/.vim/bundle/Vundle.vim/.git ] && [ ! -f ~/.vim/bundle/Vundle.vim/.git ] + then + git clone git://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim + echo "\n\tRead about vim configuration for vundle at https://github.com/VundleVim/Vundle.vim\n" + fi +} + +function vundle () { + vundle-init + vim -c "execute \"PluginInstall\" | qa" +} + +function vundle-update () { + vundle-init + vim -c "execute \"PluginInstall!\" | qa" +} + +function vundle-clean () { + vundle-init + vim -c "execute \"PluginClean!\" | qa" +} diff --git a/oh-my-zsh/plugins/wakeonlan/README b/oh-my-zsh/plugins/wakeonlan/README @@ -0,0 +1,29 @@ +This plugin provides a wrapper around the "wakeonlan" tool available from most +distributions' package repositories, or from the following website: + +http://gsd.di.uminho.pt/jpo/software/wakeonlan/ + +In order to use this wrapper, create the ~/.wakeonlan directory, and place in +that directory one file for each device you would like to be able to wake. Give +the file a name that describes the device, such as its hostname. Each file +should contain a line with the mac address of the target device and the network +broadcast address. + +For instance, there might be a file ~/.wakeonlan/leto with the following +contents: + +00:11:22:33:44:55:66 192.168.0.255 + +To wake that device, use the following command: + +# wake leto + +The available device names will be autocompleted, so: + +# wake <tab> + +...will suggest "leto", along with any other configuration files that were +placed in the ~/.wakeonlan directory. + +For more information regarding the configuration file format, check the +wakeonlan man page. diff --git a/oh-my-zsh/plugins/wakeonlan/_wake b/oh-my-zsh/plugins/wakeonlan/_wake @@ -0,0 +1,4 @@ +#compdef wake +#autoload + +_arguments "1:device to wake:_files -W '$HOME/.wakeonlan'" && return 0 diff --git a/oh-my-zsh/plugins/wakeonlan/wakeonlan.plugin.zsh b/oh-my-zsh/plugins/wakeonlan/wakeonlan.plugin.zsh @@ -0,0 +1,14 @@ +function wake() { + local config_file="$HOME/.wakeonlan/$1" + if [[ ! -f "$config_file" ]]; then + echo "ERROR: There is no configuration file at \"$config_file\"." + return 1 + fi + + if (( ! $+commands[wakeonlan] )); then + echo "ERROR: Can't find \"wakeonlan\". Are you sure it's installed?" + return 1 + fi + + wakeonlan -f "$config_file" +} diff --git a/oh-my-zsh/plugins/wd/LICENSE b/oh-my-zsh/plugins/wd/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Markus Færevaag + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/wd/README.md b/oh-my-zsh/plugins/wd/README.md @@ -0,0 +1,159 @@ +wd +== + +[![Build Status](https://travis-ci.org/mfaerevaag/wd.png?branch=master)](https://travis-ci.org/mfaerevaag/wd) + +`wd` (*warp directory*) lets you jump to custom directories in zsh, without using `cd`. Why? Because `cd` seems inefficient when the folder is frequently visited or has a long path. + +![tty.gif](https://raw.githubusercontent.com/mfaerevaag/wd/master/tty.gif) + +*NEWS*: If you are not using zsh, check out the c-port, [wd-c](https://github.com/mfaerevaag/wd-c), which works with all shells using wrapper functions. + +### Setup + +### oh-my-zsh + +`wd` comes bundled with [oh-my-zshell](https://github.com/robbyrussell/oh-my-zsh)! + +Just add the plugin in your `~/.zshrc` file: + + plugins=(... wd) + + +#### Automatic + +Run either in terminal: + + * `curl -L https://github.com/mfaerevaag/wd/raw/master/install.sh | sh` + + * `wget --no-check-certificate https://github.com/mfaerevaag/wd/raw/master/install.sh -O - | sh` + +##### Arch ([AUR](https://aur.archlinux.org/)) + + # yaourt -S zsh-plugin-wd-git + + +#### Manual + + * Clone this repo to your liking + + * Add `wd` function to `.zshrc` (or `.profile` etc.): + + wd() { + . ~/path/to/cloned/repo/wd/wd.sh + } + + * Install manpage. From `wd`'s base directory (requires root permissions): + + # cp wd.1 /usr/share/man/man1/wd.1 + # chmod 644 /usr/share/man/man1/wd.1 + + Note, when pulling and updating `wd`, you'll need to do this again in case of changes to the manpage. + + +#### Completion + +If you're NOT using [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) and you want to utilize the zsh-completion feature, you will also need to add the path to your `wd` installation (`~/bin/wd` if you used the automatic installer) to your `fpath`. E.g. in your `~/.zshrc`: + + fpath=(~/path/to/wd $fpath) + +Also, you may have to force a rebuild of `zcompdump` by running: + + $ rm -f ~/.zcompdump; compinit + + + +### Usage + + * Add warp point to current working directory: + + $ wd add foo + + If a warp point with the same name exists, use `add!` to overwrite it. + + Note, a warp point cannot contain colons, or only consist of only spaces and dots. The first will conflict in how `wd` stores the warp points, and the second will conflict with other features, as below. + + You can omit point name to use the current directory's name instead. + + * From an other directory (not necessarily), warp to `foo` with: + + $ wd foo + + * You can warp back to previous directory, and so on, with this dot syntax: + + $ wd .. + $ wd ... + + This is a wrapper for the zsh `dirs` function. + (You might need `setopt AUTO_PUSHD` in your `.zshrc` if you hare not using [oh-my-zshell](https://github.com/robbyrussell/oh-my-zsh)). + + * Remove warp point test point: + + $ wd rm foo + + You can omit point name to use the current directory's name instead. + + * List all warp points (stored in `~/.warprc`): + + $ wd list + + * List files in given warp point: + + $ wd ls foo + + * Show path of given warp point: + + $ wd path foo + + * List warp points to current directory, or optionally, path to given warp point: + + $ wd show + + * Remove warp points to non-existent directories. + + $ wd clean + + Use `clean!` to not be prompted with confirmation (force). + + * Print usage with no opts or the `help` argument: + + $ wd help + + * Print the running version of `wd`: + + $ wd --version + + * Specifically set the config file (default `~/.warprc`), which is useful when testing: + + $ wd --config ./file <action> + + * Force `exit` with return code after running. This is not default, as it will *exit your terminal*, though required when testing/debugging. + + $ wd --debug <action> + + * Silence all output: + + $ wd --quiet <action> + + +### Testing + +`wd` comes with a small test suite, run with [shunit2](https://code.google.com/p/shunit2/). This can be used to confirm that things are working as it should on your setup, or to demonstrate an issue. + +To run, simply `cd` into the `test` directory and run the `tests.sh`. + + $ ./tests.sh + + +### License + +The project is licensed under the [MIT-license](https://github.com/mfaerevaag/wd/blob/master/LICENSE). + + +### Finally + +If you have issues, feedback or improvements, don't hesitate to report it or submit a pull-request. In the case of an issue, we would much appreciate if you would include a failing test in `test/tests.sh`. For an explanation on how to run the tests, read the section "Testing" in this README. + +Credit to [altschuler](https://github.com/altschuler) for an awesome idea. + +Hope you enjoy! diff --git a/oh-my-zsh/plugins/wd/_wd.sh b/oh-my-zsh/plugins/wd/_wd.sh @@ -0,0 +1,93 @@ +#compdef wd + +zstyle ':completion:*:descriptions' format '%B%d%b' +zstyle ':completion::complete:wd:*:commands' group-name commands +zstyle ':completion::complete:wd:*:warp_points' group-name warp_points +zstyle ':completion::complete:wd::' list-grouped + +zmodload zsh/mapfile + +function _wd() { + local CONFIG=$HOME/.warprc + local ret=1 + + local -a commands + local -a warp_points + + warp_points=( "${(f)mapfile[$CONFIG]//$HOME/~}" ) + + typeset -A points + while read -r line + do + arr=(${(s,:,)line}) + name=${arr[1]} + target_path=${arr[2]} + + # replace ~ from path to fix completion (#17) + target_path=${target_path/#\~/$HOME} + + points[$name]=$target_path + done < $CONFIG + + commands=( + 'add:Adds the current working directory to your warp points' + 'add!:Overwrites existing warp point' + 'rm:Removes the given warp point' + 'list:Outputs all stored warp points' + 'ls:Show files from given warp point' + 'path:Show path to given warp point' + 'show:Outputs all warp points that point to the current directory or shows a specific target directory for a point' + 'help:Show this extremely helpful text' + 'clean:Remove points warping to nonexistent directories' + 'clean!:Remove nonexistent directories without confirmation' + '..:Go back to last directory' + ) + + _arguments -C \ + '1: :->first_arg' \ + '2: :->second_arg' && ret=0 + + local target=$words[2] + + case $state in + first_arg) + _describe -t warp_points "Warp points" warp_points && ret=0 + _describe -t commands "Commands" commands && ret=0 + ;; + second_arg) + case $target in + add\!|rm) + _describe -t points "Warp points" warp_points && ret=0 + ;; + add) + _message 'Write the name of your warp point' && ret=0 + ;; + show) + _describe -t points "Warp points" warp_points && ret=0 + ;; + ls) + _describe -t points "Warp points" warp_points && ret=0 + ;; + path) + _describe -t points "Warp points" warp_points && ret=0 + ;; + *) + # complete sub directories from the warp point + _path_files -W "(${points[$target]})" -/ && ret=0 + ;; + esac + ;; + esac + + return $ret +} + +_wd "$@" + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et diff --git a/oh-my-zsh/plugins/wd/wd.plugin.zsh b/oh-my-zsh/plugins/wd/wd.plugin.zsh @@ -0,0 +1,11 @@ +#!/bin/zsh + +# WARP DIRECTORY +# ============== +# oh-my-zsh plugin +# +# @github.com/mfaerevaag/wd + +wd() { + . $ZSH/plugins/wd/wd.sh +} diff --git a/oh-my-zsh/plugins/wd/wd.sh b/oh-my-zsh/plugins/wd/wd.sh @@ -0,0 +1,479 @@ +#!/bin/zsh + +# WARP DIRECTORY +# ============== +# Jump to custom directories in terminal +# because `cd` takes too long... +# +# @github.com/mfaerevaag/wd + +# version +readonly WD_VERSION=0.4.6 + +# colors +readonly WD_BLUE="\033[96m" +readonly WD_GREEN="\033[92m" +readonly WD_YELLOW="\033[93m" +readonly WD_RED="\033[91m" +readonly WD_NOC="\033[m" + +## functions + +# helpers +wd_yesorno() +{ + # variables + local question="${1}" + local prompt="${question} " + local yes_RETVAL="0" + local no_RETVAL="3" + local RETVAL="" + local answer="" + + # read-eval loop + while true ; do + printf $prompt + read -r answer + + case ${answer:=${default}} in + Y|y|YES|yes|Yes ) + RETVAL=${yes_RETVAL} && \ + break + ;; + N|n|NO|no|No ) + RETVAL=${no_RETVAL} && \ + break + ;; + * ) + echo "Please provide a valid answer (y or n)" + ;; + esac + done + + return ${RETVAL} +} + +wd_print_msg() +{ + if [[ -z $wd_quiet_mode ]] + then + local color=$1 + local msg=$2 + + if [[ $color == "" || $msg == "" ]] + then + print " ${WD_RED}*${WD_NOC} Could not print message. Sorry!" + else + print " ${color}*${WD_NOC} ${msg}" + fi + fi +} + +wd_print_usage() +{ + cat <<- EOF +Usage: wd [command] [point] + +Commands: + add <point> Adds the current working directory to your warp points + add Adds the current working directory to your warp points with current directory's name + add! <point> Overwrites existing warp point + add! Overwrites existing warp point with current directory's name + rm <point> Removes the given warp point + rm Removes the given warp point with current directory's name + show <point> Print path to given warp point + show Print warp points to current directory + list Print all stored warp points + ls <point> Show files from given warp point (ls) + path <point> Show the path to given warp point (pwd) + clean! Remove points warping to nonexistent directories + + -v | --version Print version + -d | --debug Exit after execution with exit codes (for testing) + -c | --config Specify config file (default ~/.warprc) + -q | --quiet Suppress all output + + help Show this extremely helpful text +EOF +} + +wd_exit_fail() +{ + local msg=$1 + + wd_print_msg $WD_RED $msg + WD_EXIT_CODE=1 +} + +wd_exit_warn() +{ + local msg=$1 + + wd_print_msg $WD_YELLOW $msg + WD_EXIT_CODE=1 +} + +wd_getdir() +{ + local name_arg=$1 + + point=$(wd_show $name_arg) + dir=${point:28+$#name_arg+7} + + if [[ -z $name_arg ]]; then + wd_exit_fail "You must enter a warp point" + break + elif [[ -z $dir ]]; then + wd_exit_fail "Unknown warp point '${name_arg}'" + break + fi +} + +# core + +wd_warp() +{ + local point=$1 + local sub=$2 + + if [[ $point =~ "^\.+$" ]] + then + if [[ $#1 < 2 ]] + then + wd_exit_warn "Warping to current directory?" + else + (( n = $#1 - 1 )) + cd -$n > /dev/null + fi + elif [[ ${points[$point]} != "" ]] + then + if [[ $sub != "" ]] + then + cd ${points[$point]/#\~/$HOME}/$sub + else + cd ${points[$point]/#\~/$HOME} + fi + else + wd_exit_fail "Unknown warp point '${point}'" + fi +} + +wd_add() +{ + local force=$1 + local point=$2 + + if [[ $point == "" ]] + then + point=$(basename $PWD) + fi + + if [[ $point =~ "^[\.]+$" ]] + then + wd_exit_fail "Warp point cannot be just dots" + elif [[ $point =~ "[[:space:]]+" ]] + then + wd_exit_fail "Warp point should not contain whitespace" + elif [[ $point == *:* ]] + then + wd_exit_fail "Warp point cannot contain colons" + elif [[ ${points[$point]} == "" ]] || $force + then + wd_remove $point > /dev/null + printf "%q:%s\n" "${point}" "${PWD/#$HOME/~}" >> $WD_CONFIG + + wd_print_msg $WD_GREEN "Warp point added" + + # override exit code in case wd_remove did not remove any points + # TODO: we should handle this kind of logic better + WD_EXIT_CODE=0 + else + wd_exit_warn "Warp point '${point}' already exists. Use 'add!' to overwrite." + fi +} + +wd_remove() +{ + local point=$1 + + if [[ $point == "" ]] + then + point=$(basename $PWD) + fi + + if [[ ${points[$point]} != "" ]] + then + local config_tmp=$WD_CONFIG.tmp + if sed -n "/^${point}:.*$/!p" $WD_CONFIG > $config_tmp && mv $config_tmp $WD_CONFIG + then + wd_print_msg $WD_GREEN "Warp point removed" + else + wd_exit_fail "Something bad happened! Sorry." + fi + else + wd_exit_fail "Warp point was not found" + fi +} + +wd_list_all() +{ + wd_print_msg $WD_BLUE "All warp points:" + + entries=$(sed "s:${HOME}:~:g" $WD_CONFIG) + + max_warp_point_length=0 + while IFS= read -r line + do + arr=(${(s,:,)line}) + key=${arr[1]} + + length=${#key} + if [[ length -gt max_warp_point_length ]] + then + max_warp_point_length=$length + fi + done <<< $entries + + while IFS= read -r line + do + if [[ $line != "" ]] + then + arr=(${(s,:,)line}) + key=${arr[1]} + val=${arr[2]} + + if [[ -z $wd_quiet_mode ]] + then + printf "%${max_warp_point_length}s -> %s\n" $key $val + fi + fi + done <<< $entries +} + +wd_ls() +{ + wd_getdir $1 + ls ${dir/#\~/$HOME} +} + +wd_path() +{ + wd_getdir $1 + echo $(echo $dir | sed "s:${HOME}:~:g") +} + +wd_show() +{ + local name_arg=$1 + # if there's an argument we look up the value + if [[ ! -z $name_arg ]] + then + if [[ -z $points[$name_arg] ]] + then + wd_print_msg $WD_BLUE "No warp point named $name_arg" + else + wd_print_msg $WD_GREEN "Warp point: ${WD_GREEN}$name_arg${WD_NOC} -> $points[$name_arg]" + fi + else + # hax to create a local empty array + local wd_matches + wd_matches=() + # do a reverse lookup to check whether PWD is in $points + PWD="${PWD/$HOME/~}" + if [[ ${points[(r)$PWD]} == $PWD ]] + then + for name in ${(k)points} + do + if [[ $points[$name] == $PWD ]] + then + wd_matches[$(($#wd_matches+1))]=$name + fi + done + + wd_print_msg $WD_BLUE "$#wd_matches warp point(s) to current directory: ${WD_GREEN}$wd_matches${WD_NOC}" + else + wd_print_msg $WD_YELLOW "No warp point to $(echo $PWD | sed "s:$HOME:~:")" + fi + fi +} + +wd_clean() { + local force=$1 + local count=0 + local wd_tmp="" + + while read line + do + if [[ $line != "" ]] + then + arr=(${(s,:,)line}) + key=${arr[1]} + val=${arr[2]} + + if [ -d "${val/#\~/$HOME}" ] + then + wd_tmp=$wd_tmp"\n"`echo $line` + else + wd_print_msg $WD_YELLOW "Nonexistent directory: ${key} -> ${val}" + count=$((count+1)) + fi + fi + done < $WD_CONFIG + + if [[ $count -eq 0 ]] + then + wd_print_msg $WD_BLUE "No warp points to clean, carry on!" + else + if $force || wd_yesorno "Removing ${count} warp points. Continue? (Y/n)" + then + echo $wd_tmp >! $WD_CONFIG + wd_print_msg $WD_GREEN "Cleanup complete. ${count} warp point(s) removed" + else + wd_print_msg $WD_BLUE "Cleanup aborted" + fi + fi +} + +local WD_CONFIG=$HOME/.warprc +local WD_QUIET=0 +local WD_EXIT_CODE=0 +local WD_DEBUG=0 + +# Parse 'meta' options first to avoid the need to have them before +# other commands. The `-D` flag consumes recognized options so that +# the actual command parsing won't be affected. + +zparseopts -D -E \ + c:=wd_alt_config -config:=wd_alt_config \ + q=wd_quiet_mode -quiet=wd_quiet_mode \ + v=wd_print_version -version=wd_print_version \ + d=wd_debug_mode -debug=wd_debug_mode + +if [[ ! -z $wd_print_version ]] +then + echo "wd version $WD_VERSION" +fi + +if [[ ! -z $wd_alt_config ]] +then + WD_CONFIG=$wd_alt_config[2] +fi + +# check if config file exists +if [ ! -e $WD_CONFIG ] +then + # if not, create config file + touch $WD_CONFIG +fi + +# load warp points +typeset -A points +while read -r line +do + arr=(${(s,:,)line}) + key=${arr[1]} + # join the rest, in case the path contains colons + val=${(j,:,)arr[2,-1]} + + points[$key]=$val +done < $WD_CONFIG + +# get opts +args=$(getopt -o a:r:c:lhs -l add:,rm:,clean\!,list,ls:,path:,help,show -- $*) + +# check if no arguments were given, and that version is not set +if [[ ($? -ne 0 || $#* -eq 0) && -z $wd_print_version ]] +then + wd_print_usage + + # check if config file is writeable +elif [ ! -w $WD_CONFIG ] +then + # do nothing + # can't run `exit`, as this would exit the executing shell + wd_exit_fail "\'$WD_CONFIG\' is not writeable." + +else + + # parse rest of options + for o + do + case "$o" + in + -a|--add|add) + wd_add false $2 + break + ;; + -a!|--add!|add!) + wd_add true $2 + break + ;; + -r|--remove|rm) + wd_remove $2 + break + ;; + -l|list) + wd_list_all + break + ;; + -ls|ls) + wd_ls $2 + break + ;; + -p|--path|path) + wd_path $2 + break + ;; + -h|--help|help) + wd_print_usage + break + ;; + -s|--show|show) + wd_show $2 + break + ;; + -c|--clean|clean) + wd_clean false + break + ;; + -c!|--clean!|clean!) + wd_clean true + break + ;; + *) + wd_warp $o $2 + break + ;; + --) + break + ;; + esac + done +fi + +## garbage collection +# if not, next time warp will pick up variables from this run +# remember, there's no sub shell + +unset wd_warp +unset wd_add +unset wd_remove +unset wd_show +unset wd_list_all +unset wd_print_msg +unset wd_yesorno +unset wd_print_usage +unset wd_alt_config +unset wd_quiet_mode +unset wd_print_version + +unset args +unset points +unset val &> /dev/null # fixes issue #1 + +if [[ ! -z $wd_debug_mode ]] +then + exit $WD_EXIT_CODE +else + unset wd_debug_mode +fi diff --git a/oh-my-zsh/plugins/web-search/web-search.plugin.zsh b/oh-my-zsh/plugins/web-search/web-search.plugin.zsh @@ -0,0 +1,59 @@ +# web_search from terminal + +function web_search() { + emulate -L zsh + + # define search engine URLS + typeset -A urls + urls=( + google "https://www.google.com/search?q=" + bing "https://www.bing.com/search?q=" + yahoo "https://search.yahoo.com/search?p=" + duckduckgo "https://www.duckduckgo.com/?q=" + startpage "https://www.startpage.com/do/search?q=" + yandex "https://yandex.ru/yandsearch?text=" + github "https://github.com/search?q=" + baidu "https://www.baidu.com/s?wd=" + ecosia "https://www.ecosia.org/search?q=" + goodreads "https://www.goodreads.com/search?q=" + ) + + # check whether the search engine is supported + if [[ -z "$urls[$1]" ]]; then + echo "Search engine $1 not supported." + return 1 + fi + + # search or go to main page depending on number of arguments passed + if [[ $# -gt 1 ]]; then + # build search url: + # join arguments passed with '+', then append to search engine URL + url="${urls[$1]}${(j:+:)@[2,-1]}" + else + # build main page url: + # split by '/', then rejoin protocol (1) and domain (2) parts with '//' + url="${(j://:)${(s:/:)urls[$1]}[1,2]}" + fi + + open_command "$url" +} + + +alias bing='web_search bing' +alias google='web_search google' +alias yahoo='web_search yahoo' +alias ddg='web_search duckduckgo' +alias sp='web_search startpage' +alias yandex='web_search yandex' +alias github='web_search github' +alias baidu='web_search baidu' +alias ecosia='web_search ecosia' +alias goodreads='web_search goodreads' + +#add your own !bang searches here +alias wiki='web_search duckduckgo \!w' +alias news='web_search duckduckgo \!n' +alias youtube='web_search duckduckgo \!yt' +alias map='web_search duckduckgo \!m' +alias image='web_search duckduckgo \!i' +alias ducky='web_search duckduckgo \!' diff --git a/oh-my-zsh/plugins/wp-cli/README.md b/oh-my-zsh/plugins/wp-cli/README.md @@ -0,0 +1,107 @@ +# WP-CLI + +**Maintainer:** [joshmedeski](https://github.com/joshmedeski) + +WordPress Command Line Interface (http://wp-cli.org/) + +WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser. + +This plugin adds [tab completion](http://wp-cli.org/#complete) for `wp-cli` as well as several aliases. + +## List of Aliases + +### Core +- wpcc='wp core config' +- wpcd='wp core download' +- wpci='wp core install' +- wpcii='wp core is-installed' +- wpcmc='wp core multisite-convert' +- wpcmi='wp core multisite-install' +- wpcu='wp core update' +- wpcudb='wp core update-db' +- wpcvc='wp core verify-checksums' + +### Cron +- wpcre='wp cron event' +- wpcrs='wp cron schedule' +- wpcrt='wp cron test' + +### Menu +- wpmc='wp menu create' +- wpmd='wp menu delete' +- wpmi='wp menu item' +- wpml='wp menu list' +- wpmlo='wp menu location' + +### Plugin +- wppa='activate' +- wppda='deactivate' +- wppd='delete' +- wppg='get' +- wppi='install' +- wppis='is-installed' +- wppl='list' +- wppp='path' +- wpps='search' +- wppst='status' +- wppt='toggle' +- wppun='uninstall' +- wppu='update' + +### Post +- wppoc='wp post create' +- wppod='wp post delete' +- wppoe='wp post edit' +- wppogen='wp post generate' +- wppog='wp post get' +- wppol='wp post list' +- wppom='wp post meta' +- wppou='wp post update' +- wppourl='wp post url' + +### Sidebar +- wpsbl='wp sidebar list' + +### Theme +- wpta='wp theme activate' +- wptd='wp theme delete' +- wptdis='wp theme disable' +- wpte='wp theme enable' +- wptg='wp theme get' +- wpti='wp theme install' +- wptis='wp theme is-installed' +- wptl='wp theme list' +- wptm='wp theme mod' +- wptp='wp theme path' +- wpts='wp theme search' +- wptst='wp theme status' +- wptu='wp theme updatet' + +### User +- wpuac='wp user add-cap' +- wpuar='wp user add-role' +- wpuc='wp user create' +- wpud='wp user delete' +- wpugen='wp user generate' +- wpug='wp user get' +- wpui='wp user import-csv' +- wpul='wp user list' +- wpulc='wp user list-caps' +- wpum='wp user meta' +- wpurc='wp user remove-cap' +- wpurr='wp user remove-role' +- wpusr='wp user set-role' +- wpuu='wp user update' + +### Widget +- wpwa='wp widget add' +- wpwda='wp widget deactivate' +- wpwd='wp widget delete' +- wpwl='wp widget list' +- wpwm='wp widget move' +- wpwu='wp widget update' + +The entire list of wp-cli commands can be found here: http://wp-cli.org/commands/ + +I only included the commands that are most used. Please feel free to contribute to this project if you want more commands. + diff --git a/oh-my-zsh/plugins/wp-cli/wp-cli.plugin.zsh b/oh-my-zsh/plugins/wp-cli/wp-cli.plugin.zsh @@ -0,0 +1,160 @@ +# WP-CLI +# A command line interface for WordPress +# http://wp-cli.org/ + +# Cache + +# Cap + +# CLI + +# Comment + +# Core +alias wpcc='wp core config' +alias wpcd='wp core download' +alias wpci='wp core install' +alias wpcii='wp core is-installed' +alias wpcmc='wp core multisite-convert' +alias wpcmi='wp core multisite-install' +alias wpcu='wp core update' +alias wpcudb='wp core update-db' +alias wpcvc='wp core verify-checksums' + +# Cron +alias wpcre='wp cron event' +alias wpcrs='wp cron schedule' +alias wpcrt='wp cron test' + +# Db + +# Eval + +# Eval-File + +# Export + +# Help + +# Import + +# Media + +# Menu +alias wpmc='wp menu create' +alias wpmd='wp menu delete' +alias wpmi='wp menu item' +alias wpml='wp menu list' +alias wpmlo='wp menu location' + +# Network + +# Option + +# Plugin +alias wppa='wp plugin activate' +alias wppda='wp plugin deactivate' +alias wppd='wp plugin delete' +alias wppg='wp plugin get' +alias wppi='wp plugin install' +alias wppis='wp plugin is-installed' +alias wppl='wp plugin list' +alias wppp='wp plugin path' +alias wpps='wp plugin search' +alias wppst='wp plugin status' +alias wppt='wp plugin toggle' +alias wppun='wp plugin uninstall' +alias wppu='wp plugin update' + +# Post +alias wppoc='wp post create' +alias wppod='wp post delete' +alias wppoe='wp post edit' +alias wppogen='wp post generate' +alias wppog='wp post get' +alias wppol='wp post list' +alias wppom='wp post meta' +alias wppou='wp post update' +alias wppourl='wp post url' + +# Rewrite + +# Role + +# Scaffold + +# Search-Replace + +# Shell + +# Sidebar +alias wpsbl='wp sidebar list' + +# Site + +# Super-Admin + +# Term + +# Theme +alias wpta='wp theme activate' +alias wptd='wp theme delete' +alias wptdis='wp theme disable' +alias wpte='wp theme enable' +alias wptg='wp theme get' +alias wpti='wp theme install' +alias wptis='wp theme is-installed' +alias wptl='wp theme list' +alias wptm='wp theme mod' +alias wptp='wp theme path' +alias wpts='wp theme search' +alias wptst='wp theme status' +alias wptu='wp theme updatet' + +# Transient + +# User +alias wpuac='wp user add-cap' +alias wpuar='wp user add-role' +alias wpuc='wp user create' +alias wpud='wp user delete' +alias wpugen='wp user generate' +alias wpug='wp user get' +alias wpui='wp user import-csv' +alias wpul='wp user list' +alias wpulc='wp user list-caps' +alias wpum='wp user meta' +alias wpurc='wp user remove-cap' +alias wpurr='wp user remove-role' +alias wpusr='wp user set-role' +alias wpuu='wp user update' + +# Widget +alias wpwa='wp widget add' +alias wpwda='wp widget deactivate' +alias wpwd='wp widget delete' +alias wpwl='wp widget list' +alias wpwm='wp widget move' +alias wpwu='wp widget update' + + +autoload -U +X bashcompinit && bashcompinit +# bash completion for the `wp` command + +_wp_complete() { + local cur=${COMP_WORDS[COMP_CWORD]} + + IFS=$'\n'; # want to preserve spaces at the end + local opts="$(wp cli completions --line="$COMP_LINE" --point="$COMP_POINT")" + + if [[ "$opts" =~ \<file\>\s* ]] + then + COMPREPLY=( $(compgen -f -- $cur) ) + elif [[ $opts = "" ]] + then + COMPREPLY=( $(compgen -f -- $cur) ) + else + COMPREPLY=( ${opts[*]} ) + fi +} +complete -o nospace -F _wp_complete wp diff --git a/oh-my-zsh/plugins/xcode/README.md b/oh-my-zsh/plugins/xcode/README.md @@ -0,0 +1,84 @@ +# Xcode + +## Description + +This plugin provides a few utilities that can help you on your daily use of Xcode and iOS development. + +To start using it, add the `xcode` plugin to your `plugins` array in `~/.zshrc`: + +```zsh +plugins=(... xcode) +``` + + +## Aliases + +| Alias | Description | Command | +|-------|------------------------------------------|------------------------------------------------| +| xcb | Build Xcode projects and workspaces | xcodebuild | +| xcdd | Purge all temporary build information | rm -rf ~/Library/Developer/Xcode/DerivedData/* | +| xcp | Show currently selected Xcode directory | xcode-select --print-path | +| xcsel | Select different Xcode directory by path | sudo xcode-select --switch | + + + +## Functions + +### `xc` + +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. You can also specify a directory to look in for the Xcode files. +Returns 1 if it didn't find any relevant files. + +### `simulator` + +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.) + +### `xcselv` + +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. + +* `xcselv <version>` selects a version + * Example: `xcselv 6.2` +* `xcselv default` selects the default unversioned `Applications/Xcode.app` +* `xcselv` with no argument lists the available Xcode versions in a human-readable format +* `xcselv -l` lists the installed Xcode versions +* `xcselv -L` lists the installed Xcode versions in a short version-name-only format +* `xcselv -p` prints info about the active Xcode version +* `xcselv -h` prints a help message + +The option parsing for `xcselv` is naive. Options may not be combined, and only the first option is recognized. + +## Multiple Xcode Versions + +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. + +### Versioned Xcode Naming Conventions + +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. + +We've adopted the following naming convention: + +* Versioned Xcode installations are identified by the name `Xcode-<version>` or `Xcode<version>`. +* The `-` separating `"Xcode"` and the version name is optional, and may be replaced by a space. +* The versioned name may be applied to the `Xcode.app` itself, or a subdirectory underneath `Applications/` containing it. +* You cannot version both the `Xcode.app` filename itself and the containing subfolder. +* Thus, all of the following are equivalent. + * `Applications/Xcode-<version>.app` + * `Applications/Xcode-<version>/Xcode.app` + * `Applications/Xcode<version>.app` + * `Applications/Xcode <version>.app` + * `Applications/Xcode <version>/Xcode.app` +* Both the system `/Applications/` and user `$HOME/Applications/` directories are searched. + * The user's `$HOME/Applications/` takes precedence over `/Applications` for a given version. + * 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. +* The `<version>` may be any string that is valid in a filename. +* The special version name `"default"` refers to the "default" unversioned Xcode at `Applications/Xcode.app` (in either `/Applications/` or `$HOME/Applications/`). +* Version names may not start with ``"-"`` or whitespace. + +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. + +## Caveats + +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. + +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. diff --git a/oh-my-zsh/plugins/xcode/_xcselv b/oh-my-zsh/plugins/xcode/_xcselv @@ -0,0 +1,19 @@ +#compdef xcselv +#autoload + +function _xcselv_compl_list_versions() { + _omz_xcode_list_versions short +} + +_arguments \ + '(-l -L -p)-h[prints a help message]' \ + '(-L -p -h)-l[lists installed Xcode versions]' \ + '(-l -p -h)-L[lists installed Xcode versions (long form)]' \ + '(-h -l -L)-p[prints active Xcode version]' \ + && ret=0 + +local _xcode_versions +_xcode_versions=($(_xcselv_compl_list_versions)) +_describe -t _xcode_versions 'version' _xcode_versions + +return 1 diff --git a/oh-my-zsh/plugins/xcode/xcode.plugin.zsh b/oh-my-zsh/plugins/xcode/xcode.plugin.zsh @@ -0,0 +1,197 @@ +alias xcb='xcodebuild' +alias xcdd='rm -rf ~/Library/Developer/Xcode/DerivedData/*' +alias xcp='xcode-select --print-path' +alias xcsel='sudo xcode-select --switch' + +# original author: @subdigital +# source: http://gist.github.com/subdigital/5420709 +function xc { + local xcode_proj + if [[ $# == 0 ]]; then + xcode_proj=(*.{xcworkspace,xcodeproj}(N)) + else + xcode_proj=($1/*.{xcworkspace,xcodeproj}(N)) + fi + + + if [[ ${#xcode_proj} -eq 0 ]]; then + if [[ $# == 0 ]]; then + echo "No xcworkspace/xcodeproj file found in the current directory." + else + echo "No xcworkspace/xcodeproj file found in $1." + fi + return 1 + else + echo "Found ${xcode_proj[1]}" + open "${xcode_proj[1]}" + fi +} + +# "XCode-SELect by Version" - select Xcode by just version number +# Uses naming convention: +# - different versions of Xcode are named Xcode-<version>.app or stored +# in a folder named Xcode-<version> +# - the special version name "default" refers to the "default" Xcode.app with no suffix +function xcselv { + emulate -L zsh + if [[ $# == 0 ]]; then + echo "xcselv: error: no option or argument given" >&2 + echo "xcselv: see 'xcselv -h' for help" >&2 + return 1 + elif [[ $1 == "-p" ]]; then + _omz_xcode_print_active_version + return + elif [[ $1 == "-l" ]]; then + _omz_xcode_list_versions + return + elif [[ $1 == "-L" ]]; then + _omz_xcode_list_versions short + return + elif [[ $1 == "-h" ]]; then + _omz_xcode_print_xcselv_usage + return 0 + elif [[ $1 == -* && $1 != "-" ]]; then + echo "xcselv: error: unrecognized option: $1" >&2 + echo "xcselv: see 'xcselv -h' for help" >&2 + return 1 + fi + # Main case: "xcselv <version>" to select a version + local version=$1 + local -A xcode_versions + _omz_xcode_locate_versions + if [[ -z ${xcode_versions[$version]} ]]; then + echo "xcselv: error: Xcode version '$version' not found" >&2 + return 1 + fi + app="${xcode_versions[$version]}" + echo "selecting Xcode $version: $app" + xcsel "$app" +} + +function _omz_xcode_print_xcselv_usage { + cat << EOF >&2 +Usage: + xcselv <version> + xcselv [options] + +Options: + <version> set the active Xcode version + -h print this help message and exit + -p print the active Xcode version + -l list installed Xcode versions (long human-readable form) + -L list installed Xcode versions (short form, version names only) +EOF +} + +# Parses the Xcode version from a filename based on our conventions +# Only meaningful when called from other _omz_xcode functions +function _omz_xcode_parse_versioned_file { + local file=$1 + local basename=${app:t} + local dir=${app:h} + local parent=${dir:t} + #echo "parent=$parent basename=$basename verstr=$verstr ver=$ver" >&2 + local verstr + if [[ $parent == Xcode* ]]; then + if [[ $basename == "Xcode.app" ]]; then + # "Xcode-<version>/Xcode.app" format + verstr=$parent + else + # Both file and parent dir are versioned. Reject. + return 1; + fi + elif [[ $basename == Xcode*.app ]]; then + # "Xcode-<version>.app" format + verstr=${basename:r} + else + # Invalid naming pattern + return 1; + fi + + local ver=${verstr#Xcode} + ver=${ver#[- ]} + if [[ -z $ver ]]; then + # Unversioned "default" installation location + ver="default" + fi + print -- "$ver" +} + +# Print the active version, using xcselv's notion of versions +function _omz_xcode_print_active_version { + emulate -L zsh + local -A xcode_versions + local versions version active_path + _omz_xcode_locate_versions + active_path=$(xcode-select -p) + active_path=${active_path%%/Contents/Developer*} + versions=(${(kni)xcode_versions}) + for version ($versions); do + if [[ "${xcode_versions[$version]}" == $active_path ]]; then + printf "%s (%s)\n" $version $active_path + return + fi + done + printf "%s (%s)\n" "<unknown>" $active_path +} + +# Locates all the installed versions of Xcode on this system, for this +# plugin's internal use. +# Populates the $xcode_versions associative array variable +# Caller should local-ize $xcode_versions with `local -A xcode_versions` +function _omz_xcode_locate_versions { + emulate -L zsh + local -a app_dirs + local app_dir apps app xcode_ver + # In increasing precedence order: + app_dirs=(/Applications $HOME/Applications) + for app_dir ($app_dirs); do + apps=( $app_dir/Xcode*.app(N) $app_dir/Xcode*/Xcode.app(N) ) + for app ($apps); do + xcode_ver=$(_omz_xcode_parse_versioned_file $app) + if [[ $? != 0 ]]; then + continue + fi + xcode_versions[$xcode_ver]=$app + done + done +} + +function _omz_xcode_list_versions { + emulate -L zsh + local -A xcode_versions + _omz_xcode_locate_versions + local width=1 width_i versions do_short=0 + if [[ $1 == "short" ]]; then + do_short=1 + fi + versions=(${(kni)xcode_versions}) + for version ($versions); do + if [[ $#version > $width ]]; then + width=$#version; + fi + done + for version ($versions); do + if [[ $do_short == 1 ]]; then + printf "%s\n" $version + else + printf "%-${width}s -> %s\n" "$version" "${xcode_versions[$version]}" + fi + done +} + +function simulator { + local devfolder + devfolder="$(xcode-select -p)" + + # Xcode ≤ 5.x + if [[ -d "${devfolder}/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app" ]]; then + open "${devfolder}/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app" + # Xcode ≥ 6.x + elif [[ -d "${devfolder}/Applications/iOS Simulator.app" ]]; then + open "${devfolder}/Applications/iOS Simulator.app" + # Xcode ≥ 7.x + else + open "${devfolder}/Applications/Simulator.app" + fi +} diff --git a/oh-my-zsh/plugins/yarn/yarn.plugin.zsh b/oh-my-zsh/plugins/yarn/yarn.plugin.zsh @@ -0,0 +1,88 @@ +# Alias sorted alphabetically + +alias y="yarn " +alias ya="yarn add" +alias ycc="yarn cache clean" +alias yh="yarn help" +alias yo="yarn outdated" +alias yui="yarn upgrade-interactive" + +_yarn () +{ + local -a _1st_arguments _dopts _dev _production + local expl + typeset -A opt_args + + _dopts=( + '(--force)--force[This refetches all packages, even ones that were previously installed.]' + ) + + _installopts=( + '(--flat)--flat[Only allow one version of a package. On the first run this will prompt you to choose a single version for each package that is depended on at multiple version ranges.]' + '(--har)--har[Outputs an HTTP archive from all the network requests performed during the installation.]' + '(--no-lockfile)--no-lockfile[Don’t read or generate a yarn.lock lockfile.]' + '(--pure-lockfile)--pure-lockfile[Don’t generate a yarn.lock lockfile.]' + ) + + _dev=('(--dev)--dev[Save installed packages into the project"s package.json devDependencies]') + + _production=('(--production)--production[Do not install project devDependencies]') + + _1st_arguments=( + 'help:Display help information about yarn' \ + 'init:Initialize for the development of a package.' \ + 'add:Add a package to use in your current package.' \ + 'install:Install all the dependencies listed within package.json in the local node_modules folder.' \ + 'publish:Publish a package to a package manager.' \ + 'remove:Remove a package that will no longer be used in your current package.' \ + 'cache:Clear the local cache. It will be populated again the next time yarn or yarn install is run.' \ + 'clean:Frees up space by removing unnecessary files and folders from dependencies.' \ + 'check:Verifies that versions of the package dependencies in the current project’s package.json matches that of yarn’s lock file.' \ + 'ls:List all installed packages.' \ + 'global:Makes binaries available to use on your operating system.' \ + 'info:<package> [<field>] - fetch information about a package and return it in a tree format.' \ + 'outdated:Checks for outdated package dependencies.' \ + 'run:Runs a defined package script.' \ + 'self-update:Updates Yarn to the latest version.' \ + 'upgrade:Upgrades packages to their latest version based on the specified range.' \ + 'why:<query> - Show information about why a package is installed.' + ) + _arguments \ + '*:: :->subcmds' && return 0 + + if (( CURRENT == 1 )); then + _describe -t commands "yarn subcommand" _1st_arguments + return + fi + + case "$words[1]" in + add) + _arguments \ + $_dopts \ + $_dev \ + $_production + ;; + install) + _arguments \ + $_installopts \ + $_dopts \ + $_dev \ + $_no_color \ + $_production + ;; + update) + _arguments \ + $_dopts + ;; + remove) + _arguments \ + $_dopts + ;; + *) + _arguments \ + ;; + esac + +} + +compdef _yarn yarn diff --git a/oh-my-zsh/plugins/yii/yii.plugin.zsh b/oh-my-zsh/plugins/yii/yii.plugin.zsh @@ -0,0 +1,17 @@ +# Yii basic command completion + +_yii_get_command_list () { + protected/yiic | awk '/^ - [a-z]+/ { print $2 }' +} + +_yii () { + if [ -f protected/yiic ]; then + compadd `_yii_get_command_list` + fi +} + +compdef _yii protected/yiic +compdef _yii yiic + +# Aliases +alias yiic='protected/yiic' diff --git a/oh-my-zsh/plugins/yii2/README.md b/oh-my-zsh/plugins/yii2/README.md @@ -0,0 +1,7 @@ +# Yii2 autocomplete plugin + +* Adds autocomplete commands and subcommands for yii. + +## Requirements + +Autocomplete works from directory where your `yii` file contains. diff --git a/oh-my-zsh/plugins/yii2/yii2.plugin.zsh b/oh-my-zsh/plugins/yii2/yii2.plugin.zsh @@ -0,0 +1,29 @@ +# Yii2 command completion + +_yii2_format_command () { + awk '/^- [a-z]+/ { sub(":", "", $2); print $2 }' +} + +_yii2 () { + if [ -f ./yii ]; then + _arguments \ + '1: :->command'\ + '*: :->params' + + case $state in + command) + + local -a commands + local -a name + + if [[ $words[2] == *\/ ]]; then + name=$words[2] + fi + + commands=(${(f)"$(./yii help $name --color=0 | _yii2_format_command)"}) + compadd -Q -S '' -a -- commands + esac + fi +} + +compdef _yii2 yii+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/yum/yum.plugin.zsh b/oh-my-zsh/plugins/yum/yum.plugin.zsh @@ -0,0 +1,16 @@ +## Aliases + +alias ys="yum search" # search package +alias yp="yum info" # show package info +alias yl="yum list" # list packages +alias ygl="yum grouplist" # list package groups +alias yli="yum list installed" # print all installed packages +alias ymc="yum makecache" # rebuilds the yum package list + +alias yu="sudo yum update" # upgrate packages +alias yi="sudo yum install" # install package +alias ygi="sudo yum groupinstall" # install package group +alias yr="sudo yum remove" # remove package +alias ygr="sudo yum groupremove" # remove pagage group +alias yrl="sudo yum remove --remove-leaves" # remove package and leaves +alias yc="sudo yum clean all" # clean cache+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/z/Makefile b/oh-my-zsh/plugins/z/Makefile @@ -0,0 +1,4 @@ +readme: + @groff -man -Tascii z.1 | col -bx + +.PHONY: readme diff --git a/oh-my-zsh/plugins/z/README b/oh-my-zsh/plugins/z/README @@ -0,0 +1,144 @@ +Z(1) User Commands Z(1) + + + +NAME + z - jump around + +SYNOPSIS + z [-chlrtx] [regex1 regex2 ... regexn] + +AVAILABILITY + bash, zsh + +DESCRIPTION + Tracks your most used directories, based on 'frecency'. + + After a short learning phase, z will take you to the most 'frecent' + directory that matches ALL of the regexes given on the command line, in + order. + + For example, z foo bar would match /foo/bar but not /bar/foo. + +OPTIONS + -c restrict matches to subdirectories of the current directory + + -h show a brief help message + + -l list only + + -r match by rank only + + -t match by recent access only + + -x remove the current directory from the datafile + +EXAMPLES + z foo cd to most frecent dir matching foo + + z foo bar cd to most frecent dir matching foo, then bar + + z -r foo cd to highest ranked dir matching foo + + z -t foo cd to most recently accessed dir matching foo + + z -l foo list all dirs matching foo (by frecency) + +NOTES + Installation: + Put something like this in your $HOME/.bashrc or $HOME/.zshrc: + + . /path/to/z.sh + + cd around for a while to build up the db. + + PROFIT!! + + Optionally: + Set $_Z_CMD to change the command name (default z). + Set $_Z_DATA to change the datafile (default $HOME/.z). + Set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution. + Set $_Z_NO_PROMPT_COMMAND to handle PROMPT_COMMAND/precmd your- + self. + Set $_Z_EXCLUDE_DIRS to an array of directory trees to exclude. + Set $_Z_OWNER to allow usage when in 'sudo -s' mode. + (These settings should go in .bashrc/.zshrc before the line + added above.) + Install the provided man page z.1 somewhere like + /usr/local/man/man1. + + Aging: + The rank of directories maintained by z undergoes aging based on a sim- + ple formula. The rank of each entry is incremented every time it is + accessed. When the sum of ranks is over 9000, all ranks are multiplied + by 0.99. Entries with a rank lower than 1 are forgotten. + + Frecency: + Frecency is a portmanteau of 'recent' and 'frequency'. It is a weighted + rank that depends on how often and how recently something occurred. As + far as I know, Mozilla came up with the term. + + To z, a directory that has low ranking but has been accessed recently + will quickly have higher rank than a directory accessed frequently a + long time ago. + + Frecency is determined at runtime. + + Common: + When multiple directories match all queries, and they all have a common + prefix, z will cd to the shortest matching directory, without regard to + priority. This has been in effect, if undocumented, for quite some + time, but should probably be configurable or reconsidered. + + Tab Completion: + z supports tab completion. After any number of arguments, press TAB to + complete on directories that match each argument. Due to limitations of + the completion implementations, only the last argument will be com- + pleted in the shell. + + Internally, z decides you've requested a completion if the last argu- + ment passed is an absolute path to an existing directory. This may + cause unexpected behavior if the last argument to z begins with /. + +ENVIRONMENT + A function _z() is defined. + + The contents of the variable $_Z_CMD is aliased to _z 2>&1. If not set, + $_Z_CMD defaults to z. + + The environment variable $_Z_DATA can be used to control the datafile + location. If it is not defined, the location defaults to $HOME/.z. + + The environment variable $_Z_NO_RESOLVE_SYMLINKS can be set to prevent + resolving of symlinks. If it is not set, symbolic links will be + resolved when added to the datafile. + + In bash, z appends a command to the PROMPT_COMMAND environment variable + to maintain its database. In zsh, z appends a function _z_precmd to the + precmd_functions array. + + The environment variable $_Z_NO_PROMPT_COMMAND can be set if you want + to handle PROMPT_COMMAND or precmd yourself. + + The environment variable $_Z_EXCLUDE_DIRS can be set to an array of + directory trees to exclude from tracking. $HOME is always excluded. + Directories must be full paths without trailing slashes. + + The environment variable $_Z_OWNER can be set to your username, to + allow usage of z when your sudo environment keeps $HOME set. + +FILES + Data is stored in $HOME/.z. This can be overridden by setting the + $_Z_DATA environment variable. When initialized, z will raise an error + if this path is a directory, and not function correctly. + + A man page (z.1) is provided. + +SEE ALSO + regex(7), pushd, popd, autojump, cdargs + + Please file bugs at https://github.com/rupa/z/ + + + +z January 2013 Z(1) diff --git a/oh-my-zsh/plugins/z/z.1 b/oh-my-zsh/plugins/z/z.1 @@ -0,0 +1,166 @@ +.TH "Z" "1" "January 2013" "z" "User Commands" +.SH +NAME +z \- jump around +.SH +SYNOPSIS +z [\-chlrtx] [regex1 regex2 ... regexn] +.SH +AVAILABILITY +bash, zsh +.SH +DESCRIPTION +Tracks your most used directories, based on 'frecency'. +.P +After a short learning phase, \fBz\fR will take you to the most 'frecent' +directory that matches ALL of the regexes given on the command line, in order. + +For example, \fBz foo bar\fR would match \fB/foo/bar\fR but not \fB/bar/foo\fR. +.SH +OPTIONS +.TP +\fB\-c\fR +restrict matches to subdirectories of the current directory +.TP +\fB\-h\fR +show a brief help message +.TP +\fB\-l\fR +list only +.TP +\fB\-r\fR +match by rank only +.TP +\fB\-t\fR +match by recent access only +.TP +\fB\-x\fR +remove the current directory from the datafile +.SH EXAMPLES +.TP 14 +\fBz foo\fR +cd to most frecent dir matching foo +.TP 14 +\fBz foo bar\fR +cd to most frecent dir matching foo, then bar +.TP 14 +\fBz -r foo\fR +cd to highest ranked dir matching foo +.TP 14 +\fBz -t foo\fR +cd to most recently accessed dir matching foo +.TP 14 +\fBz -l foo\fR +list all dirs matching foo (by frecency) +.SH +NOTES +.SS +Installation: +.P +Put something like this in your \fB$HOME/.bashrc\fR or \fB$HOME/.zshrc\fR: +.RS +.P +\fB. /path/to/z.sh\fR +.RE +.P +\fBcd\fR around for a while to build up the db. +.P +PROFIT!! +.P +Optionally: +.RS +Set \fB$_Z_CMD\fR to change the command name (default \fBz\fR). +.RE +.RS +Set \fB$_Z_DATA\fR to change the datafile (default \fB$HOME/.z\fR). +.RE +.RS +Set \fB$_Z_NO_RESOLVE_SYMLINKS\fR to prevent symlink resolution. +.RE +.RS +Set \fB$_Z_NO_PROMPT_COMMAND\fR to handle \fBPROMPT_COMMAND/precmd\fR yourself. +.RE +.RS +Set \fB$_Z_EXCLUDE_DIRS\fR to an array of directory trees to exclude. +.RE +.RS +Set \fB$_Z_OWNER\fR to allow usage when in 'sudo -s' mode. +.RE +.RS +(These settings should go in .bashrc/.zshrc before the line added above.) +.RE +.RS +Install the provided man page \fBz.1\fR somewhere like \fB/usr/local/man/man1\fR. +.RE +.SS +Aging: +The rank of directories maintained by \fBz\fR undergoes aging based on a simple +formula. The rank of each entry is incremented every time it is accessed. When +the sum of ranks is over 9000, all ranks are multiplied by 0.99. Entries with a +rank lower than 1 are forgotten. +.SS +Frecency: +Frecency is a portmanteau of 'recent' and 'frequency'. It is a weighted rank +that depends on how often and how recently something occurred. As far as I +know, Mozilla came up with the term. +.P +To \fBz\fR, a directory that has low ranking but has been accessed recently +will quickly have higher rank than a directory accessed frequently a long time +ago. +.P +Frecency is determined at runtime. +.SS +Common: +When multiple directories match all queries, and they all have a common prefix, +\fBz\fR will cd to the shortest matching directory, without regard to priority. +This has been in effect, if undocumented, for quite some time, but should +probably be configurable or reconsidered. +.SS +Tab Completion: +\fBz\fR supports tab completion. After any number of arguments, press TAB to +complete on directories that match each argument. Due to limitations of the +completion implementations, only the last argument will be completed in the +shell. +.P +Internally, \fBz\fR decides you've requested a completion if the last argument +passed is an absolute path to an existing directory. This may cause unexpected +behavior if the last argument to \fBz\fR begins with \fB/\fR. +.SH +ENVIRONMENT +A function \fB_z()\fR is defined. +.P +The contents of the variable \fB$_Z_CMD\fR is aliased to \fB_z 2>&1\fR. If not +set, \fB$_Z_CMD\fR defaults to \fBz\fR. +.P +The environment variable \fB$_Z_DATA\fR can be used to control the datafile +location. If it is not defined, the location defaults to \fB$HOME/.z\fR. +.P +The environment variable \fB$_Z_NO_RESOLVE_SYMLINKS\fR can be set to prevent +resolving of symlinks. If it is not set, symbolic links will be resolved when +added to the datafile. +.P +In bash, \fBz\fR appends a command to the \fBPROMPT_COMMAND\fR environment +variable to maintain its database. In zsh, \fBz\fR appends a function +\fB_z_precmd\fR to the \fBprecmd_functions\fR array. +.P +The environment variable \fB$_Z_NO_PROMPT_COMMAND\fR can be set if you want to +handle \fBPROMPT_COMMAND\fR or \fBprecmd\fR yourself. +.P +The environment variable \fB$_Z_EXCLUDE_DIRS\fR can be set to an array of +directory trees to exclude from tracking. \fB$HOME\fR is always excluded. +Directories must be full paths without trailing slashes. +.P +The environment variable \fB$_Z_OWNER\fR can be set to your username, to +allow usage of \fBz\fR when your sudo environment keeps \fB$HOME\fR set. +.SH +FILES +Data is stored in \fB$HOME/.z\fR. This can be overridden by setting the +\fB$_Z_DATA\fR environment variable. When initialized, \fBz\fR will raise an +error if this path is a directory, and not function correctly. +.P +A man page (\fBz.1\fR) is provided. +.SH +SEE ALSO +regex(7), pushd, popd, autojump, cdargs +.P +Please file bugs at https://github.com/rupa/z/ diff --git a/oh-my-zsh/plugins/z/z.plugin.zsh b/oh-my-zsh/plugins/z/z.plugin.zsh @@ -0,0 +1 @@ +source "${0:h}/z.sh" diff --git a/oh-my-zsh/plugins/z/z.sh b/oh-my-zsh/plugins/z/z.sh @@ -0,0 +1,243 @@ +# Copyright (c) 2009 rupa deadwyler under the WTFPL license + +# maintains a jump-list of the directories you actually use +# +# INSTALL: +# * put something like this in your .bashrc/.zshrc: +# . /path/to/z.sh +# * cd around for a while to build up the db +# * PROFIT!! +# * optionally: +# set $_Z_CMD in .bashrc/.zshrc to change the command (default z). +# set $_Z_DATA in .bashrc/.zshrc to change the datafile (default ~/.z). +# set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution. +# set $_Z_NO_PROMPT_COMMAND if you're handling PROMPT_COMMAND yourself. +# set $_Z_EXCLUDE_DIRS to an array of directories to exclude. +# set $_Z_OWNER to your username if you want use z while sudo with $HOME kept +# +# USE: +# * z foo # cd to most frecent dir matching foo +# * z foo bar # cd to most frecent dir matching foo and bar +# * z -r foo # cd to highest ranked dir matching foo +# * z -t foo # cd to most recently accessed dir matching foo +# * z -l foo # list matches instead of cd +# * z -c foo # restrict matches to subdirs of $PWD + +[ -d "${_Z_DATA:-$HOME/.z}" ] && { + echo "ERROR: z.sh's datafile (${_Z_DATA:-$HOME/.z}) is a directory." +} + +_z() { + + local datafile="${_Z_DATA:-$HOME/.z}" + + # bail if we don't own ~/.z and $_Z_OWNER not set + [ -z "$_Z_OWNER" -a -f "$datafile" -a ! -O "$datafile" ] && return + + # add entries + if [ "$1" = "--add" ]; then + shift + + # $HOME isn't worth matching + [ "$*" = "$HOME" ] && return + + # don't track excluded directory trees + local exclude + for exclude in "${_Z_EXCLUDE_DIRS[@]}"; do + case "$*" in "$exclude*") return;; esac + done + + # maintain the data file + local tempfile="$datafile.$RANDOM" + while read line; do + # only count directories + [ -d "${line%%\|*}" ] && echo $line + done < "$datafile" | awk -v path="$*" -v now="$(date +%s)" -F"|" ' + BEGIN { + rank[path] = 1 + time[path] = now + } + $2 >= 1 { + # drop ranks below 1 + if( $1 == path ) { + rank[$1] = $2 + 1 + time[$1] = now + } else { + rank[$1] = $2 + time[$1] = $3 + } + count += $2 + } + END { + if( count > 9000 ) { + # aging + for( x in rank ) print x "|" 0.99*rank[x] "|" time[x] + } else for( x in rank ) print x "|" rank[x] "|" time[x] + } + ' 2>/dev/null >| "$tempfile" + # do our best to avoid clobbering the datafile in a race condition + if [ $? -ne 0 -a -f "$datafile" ]; then + env rm -f "$tempfile" + else + [ "$_Z_OWNER" ] && chown $_Z_OWNER:$(id -ng $_Z_OWNER) "$tempfile" + env mv -f "$tempfile" "$datafile" || env rm -f "$tempfile" + fi + + # tab completion + elif [ "$1" = "--complete" -a -s "$datafile" ]; then + while read line; do + [ -d "${line%%\|*}" ] && echo $line + done < "$datafile" | awk -v q="$2" -F"|" ' + BEGIN { + if( q == tolower(q) ) imatch = 1 + q = substr(q, 3) + gsub(" ", ".*", q) + } + { + if( imatch ) { + if( tolower($1) ~ tolower(q) ) print $1 + } else if( $1 ~ q ) print $1 + } + ' 2>/dev/null + + else + # list/go + while [ "$1" ]; do case "$1" in + --) while [ "$1" ]; do shift; local fnd="$fnd${fnd:+ }$1";done;; + -*) local opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in + c) local fnd="^$PWD $fnd";; + h) echo "${_Z_CMD:-z} [-chlrtx] args" >&2; return;; + x) sed -i -e "\:^${PWD}|.*:d" "$datafile";; + l) local list=1;; + r) local typ="rank";; + t) local typ="recent";; + esac; opt=${opt:1}; done;; + *) local fnd="$fnd${fnd:+ }$1";; + esac; local last=$1; [ "$#" -gt 0 ] && shift; done + [ "$fnd" -a "$fnd" != "^$PWD " ] || local list=1 + + # if we hit enter on a completion just go there + case "$last" in + # completions will always start with / + /*) [ -z "$list" -a -d "$last" ] && cd "$last" && return;; + esac + + # no file yet + [ -f "$datafile" ] || return + + local cd + cd="$(while read line; do + [ -d "${line%%\|*}" ] && echo $line + done < "$datafile" | awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" ' + function frecent(rank, time) { + # relate frequency and time + dx = t - time + if( dx < 3600 ) return rank * 4 + if( dx < 86400 ) return rank * 2 + if( dx < 604800 ) return rank / 2 + return rank / 4 + } + function output(files, out, common) { + # list or return the desired directory + if( list ) { + cmd = "sort -n >&2" + for( x in files ) { + if( files[x] ) printf "%-10s %s\n", files[x], x | cmd + } + if( common ) { + printf "%-10s %s\n", "common:", common > "/dev/stderr" + } + } else { + if( common ) out = common + print out + } + } + function common(matches) { + # find the common root of a list of matches, if it exists + for( x in matches ) { + if( matches[x] && (!short || length(x) < length(short)) ) { + short = x + } + } + if( short == "/" ) return + # use a copy to escape special characters, as we want to return + # the original. yeah, this escaping is awful. + clean_short = short + gsub(/\[\(\)\[\]\|\]/, "\\\\&", clean_short) + for( x in matches ) if( matches[x] && x !~ clean_short ) return + return short + } + BEGIN { + gsub(" ", ".*", q) + hi_rank = ihi_rank = -9999999999 + } + { + if( typ == "rank" ) { + rank = $2 + } else if( typ == "recent" ) { + rank = $3 - t + } else rank = frecent($2, $3) + if( $1 ~ q ) { + matches[$1] = rank + } else if( tolower($1) ~ tolower(q) ) imatches[$1] = rank + if( matches[$1] && matches[$1] > hi_rank ) { + best_match = $1 + hi_rank = matches[$1] + } else if( imatches[$1] && imatches[$1] > ihi_rank ) { + ibest_match = $1 + ihi_rank = imatches[$1] + } + } + END { + # prefer case sensitive + if( best_match ) { + output(matches, best_match, common(matches)) + } else if( ibest_match ) { + output(imatches, ibest_match, common(imatches)) + } + } + ')" + [ $? -gt 0 ] && return + [ "$cd" ] && cd "$cd" + fi +} + +alias ${_Z_CMD:-z}='_z 2>&1' + +[ "$_Z_NO_RESOLVE_SYMLINKS" ] || _Z_RESOLVE_SYMLINKS="-P" + +if type compctl >/dev/null 2>&1; then + # zsh + [ "$_Z_NO_PROMPT_COMMAND" ] || { + # populate directory list, avoid clobbering any other precmds. + if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then + _z_precmd() { + _z --add "${PWD:a}" + } + else + _z_precmd() { + _z --add "${PWD:A}" + } + fi + [[ -n "${precmd_functions[(r)_z_precmd]}" ]] || { + precmd_functions[$(($#precmd_functions+1))]=_z_precmd + } + } + _z_zsh_tab_completion() { + # tab completion + local compl + read -l compl + reply=(${(f)"$(_z --complete "$compl")"}) + } + compctl -U -K _z_zsh_tab_completion _z +elif type complete >/dev/null 2>&1; then + # bash + # tab completion + complete -o filenames -C '_z --complete "$COMP_LINE"' ${_Z_CMD:-z} + [ "$_Z_NO_PROMPT_COMMAND" ] || { + # populate directory list. avoid clobbering other PROMPT_COMMANDs. + grep "_z --add" <<< "$PROMPT_COMMAND" >/dev/null || { + PROMPT_COMMAND="$PROMPT_COMMAND"$'\n''_z --add "$(command pwd '$_Z_RESOLVE_SYMLINKS' 2>/dev/null)" 2>/dev/null;' + } + } +fi diff --git a/oh-my-zsh/plugins/zeus/README.md b/oh-my-zsh/plugins/zeus/README.md @@ -0,0 +1,56 @@ +## zeus +**Maintainer:** [b4mboo](https://github.com/b4mboo) + +* `zi` aliases `zeus init` +* `zinit` aliases `zeus init` + +* `zs` aliases `zeus start` +* `ztart` aliases `zeus start` + +* `zc` aliases `zeus console` +* `zonsole` aliases `zeus console` + +* `zsr` aliases `zeus server` +* `zerver` aliases `zeus server` + +* `zr` aliases `zeus rake` +* `zake` aliases `zeus rake` + +* `zg` aliases `zeus generate` +* `zenerate` aliases `zeus generate` + +* `zrn` aliases `zeus runner` +* `zunner` aliases `zeus runner` + +* `zcu` aliases `zeus cucumber` +* `zucumber` aliases `zeus cucumber` + +* `zspec` aliases `zeus rspec` + +* `zt` aliases `zeus test` +* `zest` aliases `zeus test` + +* `zu` aliases `zeus test test/unit/*` +* `zunits` aliases `zeus test test/unit/*` + +* `zf` aliases `zeus test test/functional/*` +* `zunctional` aliases `zeus test test/functional/*` + +* `za` aliases `zeus test test/unit/*; zeus test test/functional/; zeus cucumber` +* `zall` aliases `zeus test test/unit/*; zeus test test/functional/; zeus cucumber` + +* `zsw` aliases `rm .zeus.sock` +* `zweep` aliases `rm .zeus.sock` + +* `zdbr` aliases `zeus rake db:reset db:test:prepare` +* `zdbreset` aliases `zeus rake db:reset db:test:prepare` + +* `zdbm` aliases `zeus rake db:migrate db:test:prepare` +* `zdbmigrate` aliases `zeus rake db:migrate db:test:prepare` + +* `zdbc` aliases `zeus rake db:create` + +* `zdbcm` aliases `zeus rake db:create db:migrate db:test:prepare` + +## Installation +Add zeus to the plugins line of your `.zshconfig` file (e.g. `plugins=(rails git zeus)`) diff --git a/oh-my-zsh/plugins/zeus/_zeus b/oh-my-zsh/plugins/zeus/_zeus @@ -0,0 +1,34 @@ +#compdef zeus +#autoload + +# in order to make this work, you will need to have the gem zeus installed + +# zeus zsh completion, based on adb completion + +local -a _1st_arguments +_1st_arguments=( +'console:Lets you interact with your Rails application from the command line. (alias = c)' +'cucumber:Runs cucumber.' +'dbconsole:Figures out which database you are using and drops you into whichever command line interface.' +'destroy:Figures out what generate did, and undoes it. (alias = d)' +'generate:Uses templates to create a whole lot of things. (alias = g)' +'rake:Execute rake tasks.' +'runner:Runs Ruby code in the context of Rails non-interactively. (alias = r)' +'server:Launches a small web server named WEBrick which comes bundled with Ruby. (alias = s)' +'start:Preloads the zeus environment' +'test:Runs RSpec tests. (alias = rspec, testrb)' +'version:Shows the version number.' +) + +local expl +local -a pkgs installed_pkgs + +_arguments \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "zeus subcommand" _1st_arguments + return +fi + +_files diff --git a/oh-my-zsh/plugins/zeus/zeus.plugin.zsh b/oh-my-zsh/plugins/zeus/zeus.plugin.zsh @@ -0,0 +1,69 @@ +# Some aliases for zeus. (See: https://github.com/burke/zeus) +# Zeus preloads your Rails environment and forks that process whenever +# needed. This effectively speeds up Rails' boot process to under 1 sec. + +# Init +alias zi='zeus init' +alias zinit='zeus init' + +# Start +alias zs='zeus start' +alias ztart='zeus start' + +# Console +alias zc='zeus console' +alias zonsole='zeus console' + +# Server +alias zsr='zeus server' +alias zerver='zeus server' + +# Rake +alias zr='noglob zeus rake' +alias zake='noglob zeus rake' + +# Generate +alias zg='zeus generate' +alias zenerate='zeus generate' + +# Runner +alias zrn='zeus runner' +alias zunner='zeus runner' + +# Cucumber +alias zcu='zeus cucumber' +alias zucumber='zeus cucumber' + +# Rspec +alias zspec='zeus rspec' + +# Test +alias zt='zeus test' +alias zest='zeus test' + +alias zu='zeus test test/unit/*' +alias zunits='zeus test test/unit/*' + +alias zf='zeus test test/functional/*' +alias zunctional='zeus test test/functional/*' + +alias za='zeus test test/unit/*; zeus test test/functional/; zeus cucumber' +alias zall='zeus test test/unit/*; zeus test test/functional/; zeus cucumber' + +# Clean up crashed zeus instances. +alias zsw='rm .zeus.sock' +alias zweep='rm .zeus.sock' + +# Reset database +alias zdbr='zeus rake db:reset db:test:prepare' +alias zdbreset='zeus rake db:reset db:test:prepare' + +# Migrate and prepare database +alias zdbm='zeus rake db:migrate db:test:prepare' +alias zdbmigrate='zeus rake db:migrate db:test:prepare' + +# Create database +alias zdbc='zeus rake db:create' + +# Create, migrate and prepare database +alias zdbcm='zeus rake db:create db:migrate db:test:prepare'+ \ No newline at end of file diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/README.txt b/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/README.txt @@ -0,0 +1 @@ +These are skeletons, configuration is read from ~/.config/znt/* diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-aliases.conf b/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-aliases.conf @@ -0,0 +1,33 @@ +# How should be current element of the list drawn. Possible values: reverse, +# underline. +# On Linux virtual terminal this will be enforced to reverse (because of poor +# underline support on that terminal). The same for screen/tmux. +local active_text=reverse + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_aliases_active_text +active_text=${znt_aliases_active_text:-$active_text} + +# 2. znt_aliases_nlist_coloring_pattern +NLIST_COLORING_PATTERN=${znt_aliases_nlist_coloring_pattern:-$NLIST_COLORING_PATTERN} + +# 3. znt_aliases_nlist_coloring_color +NLIST_COLORING_COLOR=${znt_aliases_nlist_coloring_color:-$NLIST_COLORING_COLOR} + +# 4. znt_aliases_nlist_coloring_match_multiple +NLIST_COLORING_MATCH_MULTIPLE=${znt_aliases_nlist_coloring_match_multiple:-$NLIST_COLORING_MATCH_MULTIPLE} + +# 5. znt_aliases_keywords (array) +if (( ${+znt_aliases_keywords} )); then + keywords=( "${znt_aliases_keywords[@]}" ) +fi diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-cd.conf b/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-cd.conf @@ -0,0 +1,68 @@ +# Hotlist +# Can use e.g. $ZSH_VERSION, e.g. /usr/share/zsh/$ZSH_VERSION/functions +local -a hotlist +hotlist=( + ~/.config/znt + /usr/share/zsh/site-functions + /usr/share/zsh + /usr/local/share/zsh/site-functions + /usr/local/share/zsh + /usr/local/bin + /usr/lib +) + +# Suppress adding (to directory stack) directories visited by n-cd +# Value 0 is the default (directories will be added to dirstack) +local NCD_DONT_PUSHD=0 + +# How should be current element of the list drawn. Possible values: reverse, +# underline. +# On Linux virtual terminal this will be enforced to reverse (because of poor +# underline support on that terminal). The same for screen/tmux. +local active_text=reverse + +# Colorize last segments of the paths +# (#s) is ^, (#e) is $, # is *, ## is + (comparing to regex) +local NLIST_COLORING_PATTERN="[a-zA-Z0-9 ._-]##/#(#e)" +local NLIST_COLORING_COLOR=$'\x1b[00;33m' + +# Search keywords, iterated with F2 or Ctrl-X or Ctrl-/ +local -a keywords +keywords=( "zsh" "local" "git" ) + + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_cd_hotlist (array) +if (( ${+znt_cd_hotlist} )); then + hotlist=( "${znt_cd_hotlist[@]}" ) +fi + +# 2. znt_cd_dont_pushd +NCD_DONT_PUSHD=${znt_cd_dont_pushd:-$NCD_DONT_PUSHD} + +# 3. znt_cd_active_text +active_text=${znt_cd_active_text:-$active_text} + +# 4. znt_cd_nlist_coloring_pattern +NLIST_COLORING_PATTERN=${znt_cd_nlist_coloring_pattern:-$NLIST_COLORING_PATTERN} + +# 5. znt_cd_nlist_coloring_color +NLIST_COLORING_COLOR=${znt_cd_nlist_coloring_color:-$NLIST_COLORING_COLOR} + +# 6. znt_cd_nlist_coloring_match_multiple +NLIST_COLORING_MATCH_MULTIPLE=${znt_cd_nlist_coloring_match_multiple:-$NLIST_COLORING_MATCH_MULTIPLE} + +# 7. znt_cd_keywords (array) +if (( ${+znt_cd_keywords} )); then + keywords=( "${znt_cd_keywords[@]}" ) +fi diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-env.conf b/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-env.conf @@ -0,0 +1,38 @@ +# How should be current element of the list drawn. Possible values: reverse, +# underline. +# On Linux virtual terminal this will be enforced to reverse (because of poor +# underline support on that terminal). The same for screen/tmux. +local active_text=reverse + +# (#s) is ^, (#e) is $, # is *, ## is + (comparing to regex) +local NLIST_COLORING_PATTERN="[a-zA-Z0-9_]##" +local NLIST_COLORING_MATCH_MULTIPLE=0 + + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_env_active_text +active_text=${znt_env_active_text:-$active_text} + +# 2. znt_env_nlist_coloring_pattern +NLIST_COLORING_PATTERN=${znt_env_nlist_coloring_pattern:-$NLIST_COLORING_PATTERN} + +# 3. znt_env_nlist_coloring_color +NLIST_COLORING_COLOR=${znt_env_nlist_coloring_color:-$NLIST_COLORING_COLOR} + +# 4. znt_env_nlist_coloring_match_multiple +NLIST_COLORING_MATCH_MULTIPLE=${znt_env_nlist_coloring_match_multiple:-$NLIST_COLORING_MATCH_MULTIPLE} + +# 5. znt_env_keywords (array) +if (( ${+znt_env_keywords} )); then + keywords=( "${znt_env_keywords[@]}" ) +fi diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-functions.conf b/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-functions.conf @@ -0,0 +1,41 @@ +# Which editor to use, zed or vared +# vared is the default +local feditor="zed" +# local feditor="vared" + +# How should be current element of the list drawn. Possible values: reverse, +# underline. +# On Linux virtual terminal this will be enforced to reverse (because of poor +# underline support on that terminal). The same for screen/tmux. +local active_text=reverse + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_functions_feditor +feditor=${znt_functions_feditor:-$feditor} + +# 2. znt_functions_active_text +active_text=${znt_functions_active_text:-$active_text} + +# 3. znt_functions_nlist_coloring_pattern +NLIST_COLORING_PATTERN=${znt_functions_nlist_coloring_pattern:-$NLIST_COLORING_PATTERN} + +# 4. znt_functions_nlist_coloring_color +NLIST_COLORING_COLOR=${znt_functions_nlist_coloring_color:-$NLIST_COLORING_COLOR} + +# 5. znt_functions_nlist_coloring_match_multiple +NLIST_COLORING_MATCH_MULTIPLE=${znt_functions_nlist_coloring_match_multiple:-$NLIST_COLORING_MATCH_MULTIPLE} + +# 6. znt_functions_keywords (array) +if (( ${+znt_functions_keywords} )); then + keywords=( "${znt_functions_keywords[@]}" ) +fi diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-history.conf b/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-history.conf @@ -0,0 +1,43 @@ +# How should be current element of the list drawn. Possible values: reverse, +# underline. +# On Linux virtual terminal this will be enforced to reverse (because of poor +# underline support on that terminal). The same for screen/tmux. +local active_text=underline + +# Highlight a few keywords +local NLIST_COLORING_PATTERN="(while|for |sudo|make|(#s)git|vim(#e)|vim |emacs(#e)|emacs )" +local NLIST_COLORING_COLOR=$'\x1b[00;33m' +local NLIST_COLORING_MATCH_MULTIPLE=1 + +# Search keywords, iterated with F2 or Ctrl-X or Ctrl-/ +local -a keywords +keywords=( "git" "vim" "mplayer" ) + + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_history_active_text +active_text=${znt_history_active_text:-$active_text} + +# 2. znt_history_nlist_coloring_pattern +NLIST_COLORING_PATTERN=${znt_history_nlist_coloring_pattern:-$NLIST_COLORING_PATTERN} + +# 3. znt_history_nlist_coloring_color +NLIST_COLORING_COLOR=${znt_history_nlist_coloring_color:-$NLIST_COLORING_COLOR} + +# 4. znt_history_nlist_coloring_match_multiple +NLIST_COLORING_MATCH_MULTIPLE=${znt_history_nlist_coloring_match_multiple:-$NLIST_COLORING_MATCH_MULTIPLE} + +# 5. znt_history_keywords (array) +if (( ${+znt_history_keywords} )); then + keywords=( "${znt_history_keywords[@]}" ) +fi diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-kill.conf b/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-kill.conf @@ -0,0 +1,46 @@ +# How should be current element of the list drawn. Possible values: reverse, +# underline. +# On Linux virtual terminal this will be enforced to reverse (because of poor +# underline support on that terminal). The same for screen/tmux. +local active_text=reverse + +# Colorize first number column and last path segment +# This doesn't cover scripts named "[0-9]## *", which should be very rare +# (#s) is ^, (#e) is $, # is *, ## is + (comparing to regex) +# | is alternative, but only in () +local NLIST_COLORING_PATTERN="((#s) #[0-9]## |[[][^]]#](#e)|[^ 0-9/?\\\\][^/\\\\]#(#e))" +local NLIST_COLORING_COLOR=$'\x1b[00;33m' +local NLIST_COLORING_MATCH_MULTIPLE=1 + +# Search keywords, iterated with F2 or Ctrl-X or Ctrl-/ +local -a keywords +keywords=( "vim" "git" "git commit" "firefox" "mplayer" ) + + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_kill_active_text +active_text=${znt_kill_active_text:-$active_text} + +# 2. znt_kill_nlist_coloring_pattern +NLIST_COLORING_PATTERN=${znt_kill_nlist_coloring_pattern:-$NLIST_COLORING_PATTERN} + +# 3. znt_kill_nlist_coloring_color +NLIST_COLORING_COLOR=${znt_kill_nlist_coloring_color:-$NLIST_COLORING_COLOR} + +# 4. znt_kill_nlist_coloring_match_multiple +NLIST_COLORING_MATCH_MULTIPLE=${znt_kill_nlist_coloring_match_multiple:-$NLIST_COLORING_MATCH_MULTIPLE} + +# 5. znt_kill_keywords (array) +if (( ${+znt_kill_keywords} )); then + keywords=( "${znt_kill_keywords[@]}" ) +fi diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-list.conf b/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-list.conf @@ -0,0 +1,55 @@ +# Should the list (text, borders) be drawn in bold +# Value 1 is the default +local bold=0 + +# Main color pair (foreground/background) +local colorpair="white/black" + +# Should draw the border? +local border=0 + +# Combinations of colors to try out with Ctrl-T and Ctrl-G +# The last number is the bold option, 0 or 1 +local -a themes +themes=( "white/black/1" "green/black/0" "green/black/1" "white/blue/0" "white/blue/1" + "magenta/black/0" "magenta/black/1" ) + +# Uncomment when using new (>5.2) Zsh version that supports 256 colors in zcurses +#themes=( "white/17/0" "10/17/1" "white/24/1" "white/22/0" "white/22/1" "white/25/0" "white/25/1" +# "white/59/0" "white/59/1" "white/60/0" "white/60/1" "white/61/0" "white/61/1" "black/65/0" +# "black/244/0" ) + +# When 1, pressing enter when in search mode will not +# only leave the mode, but also do selection and leave +# n-history +local NLIST_INSTANT_SELECT=0 + + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_list_bold +bold=${znt_list_bold:-$bold} + +# 2. znt_list_colorpair +colorpair=${znt_list_colorpair:-$colorpair} + +# 3. znt_list_border +border=${znt_list_border:-$border} + +# 4. znt_list_themes (array) +if (( ${+znt_list_themes} )); then + themes=( "${znt_list_themes[@]}" ) +fi + +# 5. znt_list_instant_select +NLIST_INSTANT_SELECT=${znt_list_instant_select:-$NLIST_INSTANT_SELECT} + diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-options.conf b/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-options.conf @@ -0,0 +1,34 @@ +# How should be current element of the list drawn. Possible values: reverse, +# underline. +# On Linux virtual terminal this will be enforced to reverse (because of poor +# underline support on that terminal). The same for screen/tmux. +local active_text=reverse + + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_options_active_text +active_text=${znt_options_active_text:-$active_text} + +# 2. znt_options_nlist_coloring_pattern +NLIST_COLORING_PATTERN=${znt_options_nlist_coloring_pattern:-$NLIST_COLORING_PATTERN} + +# 3. znt_options_nlist_coloring_color +NLIST_COLORING_COLOR=${znt_options_nlist_coloring_color:-$NLIST_COLORING_COLOR} + +# 4. znt_options_nlist_coloring_match_multiple +NLIST_COLORING_MATCH_MULTIPLE=${znt_options_nlist_coloring_match_multiple:-$NLIST_COLORING_MATCH_MULTIPLE} + +# 5. znt_options_keywords (array) +if (( ${+znt_options_keywords} )); then + keywords=( "${znt_options_keywords[@]}" ) +fi diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-panelize.conf b/oh-my-zsh/plugins/zsh-navigation-tools/.config/znt/n-panelize.conf @@ -0,0 +1,34 @@ +# How should be current element of the list drawn. Possible values: reverse, +# underline. +# On Linux virtual terminal this will be enforced to reverse (because of poor +# underline support on that terminal). The same for screen/tmux. +local active_text=reverse + + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_panelize_active_text +active_text=${znt_panelize_active_text:-$active_text} + +# 2. znt_panelize_nlist_coloring_pattern +NLIST_COLORING_PATTERN=${znt_panelize_nlist_coloring_pattern:-$NLIST_COLORING_PATTERN} + +# 3. znt_panelize_nlist_coloring_color +NLIST_COLORING_COLOR=${znt_panelize_nlist_coloring_color:-$NLIST_COLORING_COLOR} + +# 4. znt_panelize_nlist_coloring_match_multiple +NLIST_COLORING_MATCH_MULTIPLE=${znt_panelize_nlist_coloring_match_multiple:-$NLIST_COLORING_MATCH_MULTIPLE} + +# 5. znt_panelize_keywords (array) +if (( ${+znt_panelize_keywords} )); then + keywords=( "${znt_panelize_keywords[@]}" ) +fi diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/LICENSE b/oh-my-zsh/plugins/zsh-navigation-tools/LICENSE @@ -0,0 +1,700 @@ +This software is dual-licensed under MIT and GPLv3. + +MIT License +----------- + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +GPLv3 License +-------------- + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/NEWS b/oh-my-zsh/plugins/zsh-navigation-tools/NEWS @@ -0,0 +1,17 @@ +------------------------------------- +CHANGES FROM PREVIOUS VERSIONS OF ZNT +------------------------------------- + +Changes from 2.2.1 to 2.2.7 +--------------------------- + +Tmux integration has been added – bind file znt-tmux.zsh in Tmux as +described in README.md and e.g. run local history on remote hosts. Tmux +opens new window with n-history, and pastes selected history entry into +immediate previous window (e.g. a remote session). Fixed plugin.zsh file +to not use (outer scope) positional parameters. This fixes problem with +Grlm's Zsh configuration. The file now doesn't use "test" builtin (but +[[ instead), because it can be shadowed by alias or command. Private +history has been fixed to not overwrite its history file with the same +content. This improves performance when switching to private history +view. diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/README.md b/oh-my-zsh/plugins/zsh-navigation-tools/README.md @@ -0,0 +1,244 @@ +# Zsh Navigation Tools + +https://raw.githubusercontent.com/psprint/zsh-navigation-tools/master/doc/img/n-history2.png + +Set of tools like n-history – multi-word history searcher, n-cd – directory +bookmark manager, n-kill – htop like kill utility, and more. Based on +n-list, a tool generating selectable curses-based list of elements that has +access to current Zsh session, i.e. has broad capabilities to work together +with it. Feature highlights include incremental multi-word searching, ANSI +coloring, unique mode, horizontal scroll, non-selectable elements, grepping and +various integrations with Zsh. + +## History Widget + +To have n-history as multi-word incremental searcher bound to Ctrl-R copy znt-* +files into the */site-functions dir (unless you use Oh My Zsh) and +add: + + autoload znt-history-widget + zle -N znt-history-widget + bindkey "^R" znt-history-widget + +to .zshrc. This is done automatically when using Oh My Zsh. Two other +widgets exist, znt-cd-widget and znt-kill-widget, they can be too assigned +to key combinations (no need for autoload when using Oh My Zsh): + + zle -N znt-cd-widget + bindkey "^A" znt-cd-widget + zle -N znt-kill-widget + bindkey "^Y" znt-kill-widget + +Oh My Zsh stores history into ~/.zsh_history. When you switch to OMZ you could +want to copy your previous data (from e.g. ~/.zhistory) into the new location. + +## News + +* 06-10-2016 + - Tmux-integration – Ctrl-b-h in Tmux to open n-history in new window. + Then select history entry, it will be copied to the original Tmux window. + Use this to execute local commands on remote hosts. All that is needed is + this line added to ~/.tmux.conf: + + bind h run-shell -b "$ZNT_REPO_DIR/znt-tmux.zsh" + +* 16-05-2016 + - n-kill has completion. It proposes *words* from what's in `ps -A`. Giving n-kill + arguments means grepping – it will start only with matching `ps` entries. + +* 15-05-2016 + - Fixed problem where zsh-syntax-highlighting could render n-history slow (for + long history entries). + +* 14-05-2016 + - Configuration can be set from zshrc. Example: + + znt_list_instant_select=1 + znt_list_border=0 + znt_list_bold=1 + znt_list_colorpair="green/black" + znt_functions_keywords=( "zplg" "zgen" "match" ) + znt_cd_active_text="underline" + znt_env_nlist_coloring_color=$'\x1b[00;33m' + znt_cd_hotlist=( "~/.config/znt" "/usr/share/zsh/site-functions" "/usr/share/zsh" + "/usr/local/share/zsh/site-functions" "/usr/local/share/zsh" + "/usr/local/bin" ) + +* 10-05-2016 + - Search query rotation – use Ctrl-A to rotate entered words right. + Words `1 2 3` become `3 1 2`. + +* 09-05-2016 + - New feature: n-help tool, available also from n-history via H key. It + displays help screen with various information on ZNT. + +* 08-05-2016 + - Approximate matching – pressing f or Ctrl-F will enter FIX mode, in + which 1 or 2 errors are allowed in what is searched. This utilizes + original Zsh approximate matching features and is intended to be used + after entering search query, when a typo is discovered. + +* 06-05-2016 + - Private history can be edited. Use e key or Ctrl-E for that when in + n-history. Your $EDITOR will start. This is a way to have handy set + of bookmarks prepared in private history's file. + - Border can be disabled. Use following snippet in ~/.config/znt/n-list.conf + or any other tool-targetted config file: + + # Should draw the border? + local border=0 + +* 30-04-2016 + - New feature: color themes. Use Ctrl-T and Ctrl-G to browse predefined + themes. They are listed in ~/.config/znt/n-list.conf. Use the file to + permanently set a color scheme. Also, I sent a patch to Zsh developers + and starting from Zsh > 5.2 (not yet released) supported will be 256 colors. + The file ~/.config/znt/n-list.conf already has set of 256-color themes prepared :) + +* 29-04-2016 + - New feature: private history – n-history tracks selected history entries, + exposes them via new view (activated with F1) + +* 28-04-2016 + - New features: + 1. New n-history view (activated with F1): Most Frequent History Words + 2. Predefined search keywords – use F2 to quickly search for chosen + keywords (video: [https://youtu.be/DN9QqssAYB8](https://youtu.be/DN9QqssAYB8)) + 3. Configuration option for doing instant selection in search mode + +## Introduction + +The tools are: + +- n-aliases - browses aliases, relegates editing to vared +- n-cd - browses dirstack and bookmarked directories, allows to enter selected directory +- n-functions - browses functions, relegates editing to zed or vared +- n-history - browses history, allows to edit and run commands from it +- n-kill - browses processes list, allows to send signal to selected process +- n-env - browses environment, relegates editing to vared +- n-options - browses options, allows to toggle their state +- n-panelize - loads output of given command into the list for browsing + +All tools support horizontal scroll with <,>, {,}, h,l or left and right +cursors. Other keys are: + +- [,] - jump directory bookmarks in n-cd and typical signals in n-kill +- Ctrl-d, Ctrl-u - half page up or down +- Ctrl-p, Ctrl-n - previous and next (also done with vim's j,k) +- Ctrl-l - redraw of whole display +- g, G - beginning and end of the list +- Ctrl-o, o - enter uniq mode (no duplicate lines) +- / - start incremental search +- Enter - finish incremental search, retaining filter +- Esc - exit incremental search, clearing filter +- Ctrl-w (in incremental search) - delete whole word +- Ctrl-k (in incremental search) - delete whole line + +## Configuration + +`ZNT` has configuration files located in `~/.config/znt`. The files are: + +``` +n-aliases.conf +n-cd.conf +n-env.conf +n-functions.conf +n-history.conf +n-kill.conf +n-list.conf +n-options.conf +n-panelize.conf +``` + +`n-list.conf` contains main configuration variables: + +```zsh +# Should the list (text, borders) be drawn in bold +local bold=0 + +# Main color pair (foreground/background) +local colorpair="white/black" + +# Should draw the border? +local border=1 + +# Combinations of colors to try out with Ctrl-T and Ctrl-G +# The last number is the bold option, 0 or 1 +local -a themes +themes=( "white/black/1" "green/black/0" "green/black/1" "white/blue/0" "white/blue/1" + "magenta/black/0" "magenta/black/1" ) +``` + +Read remaining configuration files to see what's in them. Nevertheless, configuration +can be also set from `zshrc`. There are `5` standard `zshrc` configuration variables: + +``` +znt_history_active_text - underline or reverse - how should be active element highlighted +znt_history_nlist_coloring_pattern - pattern that can be used to colorize elements +znt_history_nlist_coloring_color - color with which to colorize +znt_history_nlist_coloring_match_multiple - should multiple matches be colorized (0 or 1) +znt_history_keywords (array) - search keywords activated with `Ctrl-X` +``` + +Above variables will work for `n-history` tool. For other tools, change `_history_` to +e.g. `_cd_`, for the `n-cd` tool. The same works for all `8` tools. + +Common configuration of the tools uses variables with `_list_` in them: + +``` +znt_list_bold - should draw text in bold (0 or 1) +znt_list_colorpair - main pair of colors to be used, e.g "green/black" +znt_list_border - should draw borders around windows (0 or 1) +znt_list_themes (array) - list of themes to try out with Ctrl-T, e.g. ( "white/black/1" "green/black/0" ) +znt_list_instant_select - should pressing enter in search mode leave tool (0 or 1) +``` + +## Programming + +The function n-list is used as follows: + + n-list {element1} [element2] ... [elementN] + +This is all that is needed to be done to have the features like ANSI coloring, +incremental multi-word search, unique mode, horizontal scroll, non-selectable +elements (grepping is done outside n-list, see the tools for how it can be +done). To set up non-selectable entries add their indices into array +NLIST_NONSELECTABLE_ELEMENTS: + + typeset -a NLIST_NONSELECTABLE_ELEMENTS + NLIST_NONSELECTABLE_ELEMENTS=( 1 ) + +Result is stored as $reply[REPLY] ($ isn't needed before REPLY because +of arithmetic context inside []). The returned array might be different from +input arguments as n-list can process them via incremental search or uniq +mode. $REPLY is the index in that possibly processed array. If $REPLY +equals -1 it means that no selection have been made (user quitted via q +key). + +To set up entries that can be jumped to with [,] keys add their indices to +NLIST_HOP_INDEXES array: + + typeset -a NLIST_HOP_INDEXES + NLIST_HOP_INDEXES=( 1 10 ) + +n-list can automatically colorize entries according to a Zsh pattern. +Following example will colorize all numbers with blue: + + local NLIST_COLORING_PATTERN="[0-9]##" + local NLIST_COLORING_COLOR=$'\x1b[00;34m' + local NLIST_COLORING_END_COLOR=$'\x1b[0m' + local NLIST_COLORING_MATCH_MULTIPLE=1 + n-list "This is a number 123" "This line too has a number: 456" + +Blue is the default color, it doesn't have to be set. See zshexpn man page +for more information on Zsh patterns. Briefly, comparing to regular +expressions, (#s) is ^, (#e) is $, # is *, ## is +. Alternative +will work when in parenthesis, i.e. (a|b). BTW by using this method you can +colorize output of the tools, via their config files (check out e.g. n-cd.conf, +it uses this). + +## Performance +ZNT are fastest with Zsh before 5.0.6 and starting from 5.2 + + +vim:filetype=conf diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/_n-kill b/oh-my-zsh/plugins/zsh-navigation-tools/_n-kill @@ -0,0 +1,41 @@ +#compdef n-kill + +local context ret=1 + +typeset -a list linewords +typeset -aU words wordbits +local line word +integer cygwin=0 + +local IFS=" +" + +case "$OSTYPE" in + cygwin*) list=( `command ps -Wa` ); cygwin=1 ;; + *) list=( `command ps -o pid,uid,command -A` ) ;; +esac + +shift list + +IFS=" " +for line in "${list[@]}"; do + linewords=( $=line ) + if [ "$cygwin" = "1" ]; then + linewords=( "${(@)linewords[8,-1]}" ) + else + linewords=( "${(@)linewords[3,-1]}" ) + fi + for word in "${linewords[@]}"; do + if [ "$cygwin" = "1" ]; then + wordbits=( "${(@s:\:)word}" ) + else + wordbits=( "${(@s:/:)word}" ) + fi + words+=( "${wordbits[@]}" ) + done +done + +_wanted bits expl "Processes' name bits" \ + compadd "$@" -a - words && ret=0 + +return "$ret" diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/n-aliases b/oh-my-zsh/plugins/zsh-navigation-tools/n-aliases @@ -0,0 +1,47 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-aliases` to .zshrc +# +# This function allows to choose an alias for edition with vared +# +# Uses n-list + +emulate -L zsh + +setopt extendedglob +zmodload zsh/curses +zmodload zsh/parameter + +local IFS=" +" + +unset NLIST_COLORING_PATTERN + +[ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-aliases.conf ] && builtin source ~/.config/znt/n-aliases.conf + +local list +local selected + +NLIST_REMEMBER_STATE=0 + +list=( "${(@k)aliases}" ) +list=( "${(@M)list:#(#i)*$1*}" ) + +local NLIST_GREP_STRING="$1" + +if [ "$#list" -eq 0 ]; then + echo "No matching aliases" + return 1 +fi + +list=( "${(@i)list}" ) +n-list "$list[@]" + +if [ "$REPLY" -gt 0 ]; then + selected="$reply[REPLY]" + echo "Editing \`$selected':" + print -rs "vared aliases\\[$selected\\]" + vared aliases\[$selected\] +fi + +# vim: set filetype=zsh: diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/n-cd b/oh-my-zsh/plugins/zsh-navigation-tools/n-cd @@ -0,0 +1,71 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-cd` to .zshrc +# +# This function allows to choose a directory from pushd stack +# +# Uses n-list + +emulate -L zsh + +setopt extendedglob pushdignoredups + +zmodload zsh/curses +local IFS=" +" + +# Unset before configuration is read +unset NLIST_COLORING_PATTERN + +[ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-cd.conf ] && builtin source ~/.config/znt/n-cd.conf + +local list +local selected + +NLIST_REMEMBER_STATE=0 + +list=( `dirs -p` ) +list=( "${(@M)list:#(#i)*$1*}" ) + +local NLIST_GREP_STRING="$1" + +[ "$#list" -eq 0 ] && echo "No matching directories" + +if [ "$#hotlist" -ge 1 ]; then + typeset -a NLIST_NONSELECTABLE_ELEMENTS NLIST_HOP_INDEXES + local tmp_list_size="$#list" + NLIST_NONSELECTABLE_ELEMENTS=( $(( tmp_list_size+1 )) $(( tmp_list_size+2 )) ) + list=( "$list[@]" "" $'\x1b[00;31m'"Hotlist"$'\x1b[00;00m': "$hotlist[@]" ) + (( tmp_list_size+=3 )) + local middle_hop=$(( (tmp_list_size+$#list) / 2 )) + [[ "$middle_hop" -eq $tmp_list_size || "$middle_hop" -eq $#list ]] && middle_hop="" + [ "$tmp_list_size" -eq $#list ] && tmp_list_size="" + NLIST_HOP_INDEXES=( 1 $tmp_list_size $middle_hop $#list ) +else + [ "$#list" -eq 0 ] && return 1 +fi + +n-list "${list[@]}" + +if [ "$REPLY" -gt 0 ]; then + selected="$reply[REPLY]" + selected="${selected/#\~/$HOME}" + + (( NCD_DONT_PUSHD )) && setopt NO_AUTO_PUSHD + cd "$selected" + local code=$? + (( NCD_DONT_PUSHD )) && setopt AUTO_PUSHD + + if [ "$code" -eq "0" ]; then + # ZLE? + if [ "${(t)CURSOR}" = "integer-local-special" ]; then + zle -M "You have selected $selected" + else + echo "You have selected $selected" + fi + fi +else + [ "${(t)CURSOR}" = "integer-local-special" ] && zle redisplay +fi + +# vim: set filetype=zsh: diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/n-env b/oh-my-zsh/plugins/zsh-navigation-tools/n-env @@ -0,0 +1,47 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-env` to .zshrc +# +# This function allows to choose an environment variable +# for edition with vared +# +# Uses n-list + +emulate -L zsh + +setopt extendedglob +unsetopt equals +zmodload zsh/curses + +local IFS=" +" + +[ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-env.conf ] && builtin source ~/.config/znt/n-env.conf + +local list +local selected + +NLIST_REMEMBER_STATE=0 + +list=( `env` ) +list=( "${(@M)list:#(#i)*$1*}" ) + +local NLIST_GREP_STRING="$1" + +if [ "$#list" -eq 0 ]; then + echo "No matching variables" + return 1 +fi + +list=( "${(@i)list}" ) +n-list "$list[@]" + +if [ "$REPLY" -gt 0 ]; then + selected="$reply[REPLY]" + selected="${selected%%=*}" + echo "Editing \`$selected':" + print -rs "vared \"$selected\"" + vared "$selected" +fi + +# vim: set filetype=zsh: diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/n-functions b/oh-my-zsh/plugins/zsh-navigation-tools/n-functions @@ -0,0 +1,54 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-functions` to .zshrc +# +# This function allows to choose a function for edition with vared +# +# Uses n-list + +emulate -L zsh + +setopt extendedglob +zmodload zsh/curses +zmodload zsh/parameter + +local IFS=" +" + +unset NLIST_COLORING_PATTERN + +[ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-functions.conf ] && builtin source ~/.config/znt/n-functions.conf + +local list +local selected + +NLIST_REMEMBER_STATE=0 + +list=( "${(@k)functions}" ) +list=( "${(@M)list:#(#i)*$1*}" ) + +local NLIST_GREP_STRING="$1" + +if [ "$#list" -eq 0 ]; then + echo "No matching functions" + return 1 +fi + +list=( "${(@i)list}" ) +n-list "$list[@]" + +if [ "$REPLY" -gt 0 ]; then + selected="$reply[REPLY]" + if [ "$feditor" = "zed" ]; then + echo "Editing \`$selected' (ESC ZZ or Ctrl-x-w to finish):" + autoload zed + print -rs "zed -f -- \"$selected\"" + zed -f -- "$selected" + else + echo "Editing \`$selected':" + print -rs "vared functions\\[$selected\\]" + vared functions\[$selected\] + fi +fi + +# vim: set filetype=zsh: diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/n-help b/oh-my-zsh/plugins/zsh-navigation-tools/n-help @@ -0,0 +1,135 @@ +autoload colors +colors + +local h1="$fg_bold[magenta]" +local h2="$fg_bold[green]" +local h3="$fg_bold[blue]" +local h4="$fg_bold[yellow]" +local h5="$fg_bold[cyan]" +local rst="$reset_color" + +LESS="-iRc" less <<<" +${h1}Key Bindings${rst} + +${h2}H${rst}, ${h2}?${rst} (from n-history) - run n-help +${h2}Ctrl-A${rst} - rotate entered words (1+2+3 -> 3+1+2) +${h2}Ctrl-F${rst} - fix mode (approximate matching) +${h2}Ctrl-L${rst} - redraw of whole display +${h2}Ctrl-T${rst} - browse themes (next theme) +${h2}Ctrl-G${rst} - browse themes (previous theme) +${h2}Ctrl-U${rst} - half page up +${h2}Ctrl-D${rst} - half page down +${h2}Ctrl-P${rst} - previous element (also done with vim's k) +${h2}Ctrl-N${rst} - next element (also done with vim's j) +${h2}[${rst}, ${h2}]${rst} - jump directory bookmarks in n-cd and typical signals in n-kill +${h2}g, ${h2}G${rst} - beginning and end of the list +${h2}/${rst} - show incremental search +${h2}F3${rst} - show/hide incremental search +${h2}Esc${rst} - exit incremental search, clearing filter +${h2}Ctrl-W${rst} (in incremental search) - delete whole word +${h2}Ctrl-K${rst} (in incremental search) - delete whole line +${h2}Ctrl-O, ${h2}o${rst} - enter uniq mode (no duplicate lines) +${h2}Ctrl-E, ${h2}e${rst} - edit private history (when in private history view) +${h2}F1${rst} - (in n-history) - switch view +${h2}F2${rst}, ${h2}Ctrl-X${rst}, ${h2}Ctrl-/${rst} - search predefined keywords (defined in config files) + +${h1}Configuration files${rst} + +Location of the files is ${h3}~/.config/znt${rst}. Skeletons are copied there +when using ${h3}zsh-navigation-tools.plugin.zsh${rst} file (sourcing it or using +a plugin manager). There's a main config file ${h3}n-list.conf${rst} and files +for each tool. + +To have a skeleton copied again into ${h3}~/.config/znt${rst}, delete it from +there and restart Zsh a few times (3-7 or so; there's a random check +that optimizes startup time). + +${h1}Predefined search keywords${rst} + +Following block of code in e.g. ${h3}~/.config/znt/n-history.conf${rst} defines +set of keywords that can be invoked (i.e. searched for) via ${h2}F2${rst}, ${h2}Ctrl-X${rst} +or ${h2}Ctrl-/${rst}: + + ${h4}# Search keywords, iterated with F2 or Ctrl-X or Ctrl-/${rst} + ${h2}local${rst} -a keywords + keywords=( ${h2}\"git\" \"vim\" \"mplayer\"${rst} ) + +${h1}Search query rotation${rst} + +When searching, after pressing ${h2}Ctrl-A${rst}, words 1 2 3 will become 3 1 2, etc. +This can be used to edit some not-last word. + +${h1}Fix mode${rst} + +Approximate matching - pressing ${h2}f${rst} or ${h2}Ctrl-F${rst} will enter "FIX" mode, in which +1 or 2 errors are allowed in what's searched. This utilizes original Zsh +approximate matching features and is intended to be used after entering +search query, when a typo is discovered. + +${h1}Color themes${rst} + +Following block of code in ${h3}~/.config/znt/n-list.conf${rst} defines set of +themes that can be browsed with ${h2}Ctrl-T${rst} and ${h2}Ctrl-G${rst}: + + ${h4}# Combinations of colors to try out with Ctrl-T and Ctrl-G + # The last number is the bold option, 0 or 1${rst} + ${h2}local${rst} -a themes + themes=( ${h2}\"white/black/1\" \"green/black/0\" \"green/black/1\"${rst} + ${h2}\"white/blue/0\" \"white/blue/1\" \"magenta/black/0\"${rst} + ${h2}\"magenta/black/1\"${rst} ) + +It's \"foreground/background/bold\". There's support for 256-color themes +for Zsh > 5.2, defined like e.g.: + + themes=( ${h2}\"white/17/0\" \"10/17/1\" \"white/24/1\"${rst} ) + +i.e. with use of numbers, from 0 to 254. + +${h1}Private history${rst} + +N-history stores what's selected in its own history file. It can be +edited. Use ${h2}e${rst} or ${h2}Ctrl-E${rst} for that when in n-history. Your \$EDITOR will +start. This is a way to have handy set of bookmarks prepared in private +history's file. + +Private history is instantly shared among sessions. + +${h1}Zshrc integration${rst} + +There are 5 standard configuration variables that can be set in zshrc: + +${h4}znt_history_active_text${rst} +\"underline\" or \"reverse\" - how should be active element highlighted +${h4}znt_history_nlist_coloring_pattern${rst} +Pattern that can be used to colorize elements +${h4}znt_history_nlist_coloring_color${rst} +Color with which to colorize via the pattern +${h4}znt_history_nlist_coloring_match_multiple${rst} +Should multiple matches be colorized (${h2}\"0\"${rst} or ${h2}\"1\"${rst}) +${h4}znt_history_keywords ${h2}(array)${rst} +Search keywords activated with Ctrl-X, F2, Ctrl-/, e.g. ( ${h2}\"git\"${rst} ${h2}\"vim\"${rst} ) + +Above variables will work for n-history tool. For other tools, change +\"_history_\" to e.g. \"_cd_\", for the n-cd tool. The same works for +all 8 tools. + +Common configuration of the tools uses variables with \"_list_\" in them: + +${h4}znt_list_bold${rst} +Should draw text in bold (${h2}\"0\"${rst} or ${h2}\"1\"${rst}) +${h4}znt_list_colorpair${rst} +Main pair of colors to be used, e.g ${h2}\"green/black\"${rst} +${h4}znt_list_border${rst} +Should draw borders around windows (${h2}\"0\"${rst} or ${h2}\"1\"${rst}) +${h4}znt_list_themes ${h2}(array)${rst} +List of themes to try out with Ctrl-T, e.g. ( ${h2}\"white/black/1\"${rst} +${h2}\"green/black/0\"${rst} ) +${h4}znt_list_instant_select${rst} +Should pressing enter in search mode leave tool (${h2}\"0\"${rst} or ${h2}\"1\"${rst}) + +If you used ZNT before v2.1.12 then remove old configuration files +${h3}~/.config/znt/*.conf${rst} so that ZNT can update them to the latest versions +that support integration with Zshrc. If you used installer then run it +again (after the remove of configuration files), that is not needed when +using as plugin. +" diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/n-history b/oh-my-zsh/plugins/zsh-navigation-tools/n-history @@ -0,0 +1,371 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-history` to .zshrc +# +# This function allows to browse Z shell's history and use the +# entries +# +# Uses n-list + +emulate -L zsh + +setopt extendedglob +zmodload zsh/curses +zmodload zsh/parameter + +local IFS=" +" + +# Variables to save list's state when switching views +# The views are: history and "most frequent history words" +local one_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN +local one_NLIST_CURRENT_IDX +local one_NLIST_IS_SEARCH_MODE +local one_NLIST_SEARCH_BUFFER +local one_NLIST_TEXT_OFFSET +local one_NLIST_IS_UNIQ_MODE +local one_NLIST_IS_F_MODE +local one_NLIST_GREP_STRING +local one_NLIST_NONSELECTABLE_ELEMENTS +local one_NLIST_REMEMBER_STATE +local one_NLIST_ENABLED_EVENTS + +local two_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN +local two_NLIST_CURRENT_IDX +local two_NLIST_IS_SEARCH_MODE +local two_NLIST_SEARCH_BUFFER +local two_NLIST_TEXT_OFFSET +local two_NLIST_IS_UNIQ_MODE +local two_NLIST_IS_F_MODE +local two_NLIST_GREP_STRING +local two_NLIST_NONSELECTABLE_ELEMENTS +local two_NLIST_REMEMBER_STATE +local two_NLIST_ENABLED_EVENTS + +local three_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN +local three_NLIST_CURRENT_IDX +local three_NLIST_IS_SEARCH_MODE +local three_NLIST_SEARCH_BUFFER +local three_NLIST_TEXT_OFFSET +local three_NLIST_IS_UNIQ_MODE +local three_NLIST_IS_F_MODE +local three_NLIST_GREP_STRING +local three_NLIST_NONSELECTABLE_ELEMENTS +local three_NLIST_REMEMBER_STATE +local three_NLIST_ENABLED_EVENTS + +# history view +integer active_view=0 + +# Lists are "0", "1", "2" - 1st, 2nd, 3rd +# Switching is done in cyclic manner +# i.e. 0 -> 1, 1 -> 2, 2 -> 0 +_nhistory_switch_lists_states() { + # First argument is current, newly selected list, i.e. $active_view + # This implies that we are switching from previous view + + if [ "$1" = "0" ]; then + # Switched to 1st list, save 3rd list's state + three_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + three_NLIST_CURRENT_IDX=$NLIST_CURRENT_IDX + three_NLIST_IS_SEARCH_MODE=$NLIST_IS_SEARCH_MODE + three_NLIST_SEARCH_BUFFER=$NLIST_SEARCH_BUFFER + three_NLIST_TEXT_OFFSET=$NLIST_TEXT_OFFSET + three_NLIST_IS_UNIQ_MODE=$NLIST_IS_UNIQ_MODE + three_NLIST_IS_F_MODE=$NLIST_IS_F_MODE + three_NLIST_GREP_STRING=$NLIST_GREP_STRING + three_NLIST_NONSELECTABLE_ELEMENTS=( ${NLIST_NONSELECTABLE_ELEMENTS[@]} ) + three_NLIST_REMEMBER_STATE=$NLIST_REMEMBER_STATE + three_NLIST_ENABLED_EVENTS=( ${NLIST_ENABLED_EVENTS[@]} ) + + # ..and restore 1st list's state + NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=$one_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + NLIST_CURRENT_IDX=$one_NLIST_CURRENT_IDX + NLIST_IS_SEARCH_MODE=$one_NLIST_IS_SEARCH_MODE + NLIST_SEARCH_BUFFER=$one_NLIST_SEARCH_BUFFER + NLIST_TEXT_OFFSET=$one_NLIST_TEXT_OFFSET + NLIST_IS_UNIQ_MODE=$one_NLIST_IS_UNIQ_MODE + NLIST_IS_F_MODE=$one_NLIST_IS_F_MODE + NLIST_GREP_STRING=$one_NLIST_GREP_STRING + NLIST_NONSELECTABLE_ELEMENTS=( ${one_NLIST_NONSELECTABLE_ELEMENTS[@]} ) + NLIST_REMEMBER_STATE=$one_NLIST_REMEMBER_STATE + NLIST_ENABLED_EVENTS=( ${one_NLIST_ENABLED_EVENTS[@]} ) + elif [ "$1" = "1" ]; then + # Switched to 2nd list, save 1st list's state + one_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + one_NLIST_CURRENT_IDX=$NLIST_CURRENT_IDX + one_NLIST_IS_SEARCH_MODE=$NLIST_IS_SEARCH_MODE + one_NLIST_SEARCH_BUFFER=$NLIST_SEARCH_BUFFER + one_NLIST_TEXT_OFFSET=$NLIST_TEXT_OFFSET + one_NLIST_IS_UNIQ_MODE=$NLIST_IS_UNIQ_MODE + one_NLIST_IS_F_MODE=$NLIST_IS_F_MODE + one_NLIST_GREP_STRING=$NLIST_GREP_STRING + one_NLIST_NONSELECTABLE_ELEMENTS=( ${NLIST_NONSELECTABLE_ELEMENTS[@]} ) + one_NLIST_REMEMBER_STATE=$NLIST_REMEMBER_STATE + one_NLIST_ENABLED_EVENTS=( ${NLIST_ENABLED_EVENTS[@]} ) + + # ..and restore 2nd list's state + NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=$two_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + NLIST_CURRENT_IDX=$two_NLIST_CURRENT_IDX + NLIST_IS_SEARCH_MODE=$two_NLIST_IS_SEARCH_MODE + NLIST_SEARCH_BUFFER=$two_NLIST_SEARCH_BUFFER + NLIST_TEXT_OFFSET=$two_NLIST_TEXT_OFFSET + NLIST_IS_UNIQ_MODE=$two_NLIST_IS_UNIQ_MODE + NLIST_IS_F_MODE=$two_NLIST_IS_F_MODE + NLIST_GREP_STRING=$two_NLIST_GREP_STRING + NLIST_NONSELECTABLE_ELEMENTS=( ${two_NLIST_NONSELECTABLE_ELEMENTS[@]} ) + NLIST_REMEMBER_STATE=$two_NLIST_REMEMBER_STATE + NLIST_ENABLED_EVENTS=( ${two_NLIST_ENABLED_EVENTS[@]} ) + elif [ "$1" = "2" ]; then + # Switched to 3rd list, save 2nd list's state + two_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + two_NLIST_CURRENT_IDX=$NLIST_CURRENT_IDX + two_NLIST_IS_SEARCH_MODE=$NLIST_IS_SEARCH_MODE + two_NLIST_SEARCH_BUFFER=$NLIST_SEARCH_BUFFER + two_NLIST_TEXT_OFFSET=$NLIST_TEXT_OFFSET + two_NLIST_IS_UNIQ_MODE=$NLIST_IS_UNIQ_MODE + two_NLIST_IS_F_MODE=$NLIST_IS_F_MODE + two_NLIST_GREP_STRING=$NLIST_GREP_STRING + two_NLIST_NONSELECTABLE_ELEMENTS=( ${NLIST_NONSELECTABLE_ELEMENTS[@]} ) + two_NLIST_REMEMBER_STATE=$NLIST_REMEMBER_STATE + two_NLIST_ENABLED_EVENTS=( ${NLIST_ENABLED_EVENTS[@]} ) + + # ..and restore 3rd list's state + NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=$three_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + NLIST_CURRENT_IDX=$three_NLIST_CURRENT_IDX + NLIST_IS_SEARCH_MODE=$three_NLIST_IS_SEARCH_MODE + NLIST_SEARCH_BUFFER=$three_NLIST_SEARCH_BUFFER + NLIST_TEXT_OFFSET=$three_NLIST_TEXT_OFFSET + NLIST_IS_UNIQ_MODE=$three_NLIST_IS_UNIQ_MODE + NLIST_IS_F_MODE=$three_NLIST_IS_F_MODE + NLIST_GREP_STRING=$three_NLIST_GREP_STRING + NLIST_NONSELECTABLE_ELEMENTS=( ${three_NLIST_NONSELECTABLE_ELEMENTS[@]} ) + NLIST_REMEMBER_STATE=$three_NLIST_REMEMBER_STATE + NLIST_ENABLED_EVENTS=( ${three_NLIST_ENABLED_EVENTS[@]} ) + fi +} + +local most_frequent_db="$HOME/.config/znt/mostfrequent.db" +_nhistory_generate_most_frequent() { + local title=$'\x1b[00;31m'"Most frequent history words:"$'\x1b[00;00m\0' + + typeset -A uniq + for k in "${historywords[@]}"; do + uniq[$k]=$(( ${uniq[$k]:-0} + 1 )) + done + vk=() + for k v in ${(kv)uniq}; do + vk+="$v"$'\t'"$k" + done + + print -rl -- "$title" "${(On)vk[@]}" > "$most_frequent_db" +} + +# Load configuration +unset NLIST_COLORING_PATTERN +[ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-history.conf ] && builtin source ~/.config/znt/n-history.conf + +local list +local selected +local private_history_db="$HOME/.config/znt/privhist.db" + +local NLIST_GREP_STRING="$1" +# 2 is: init once, then remember +local NLIST_REMEMBER_STATE=2 +two_NLIST_REMEMBER_STATE=2 +three_NLIST_REMEMBER_STATE=2 + +# Only Private history has EDIT +local -a NLIST_ENABLED_EVENTS +NLIST_ENABLED_EVENTS=( "F1" "HELP" ) +two_NLIST_ENABLED_EVENTS=( "F1" "EDIT" "HELP" ) +three_NLIST_ENABLED_EVENTS=( "F1" "HELP" ) + +# All view should attempt to replace new lines with \n +local NLIST_REPLACE_NEWLINES="1" +two_NLIST_REPLACE_NEWLINES="1" +three_NLIST_REPLACE_NEWLINES="1" + +# Only second and third view has non-selectable first entry +local -a NLIST_NONSELECTABLE_ELEMENTS +NLIST_NONSELECTABLE_ELEMENTS=( ) +two_NLIST_NONSELECTABLE_ELEMENTS=( 1 ) +three_NLIST_NONSELECTABLE_ELEMENTS=( 1 ) + +while (( 1 )); do + + # + # View 1 - history + # + if [ "$active_view" = "0" ]; then + list=( "$history[@]" ) + list=( "${(@M)list:#(#i)*$NLIST_GREP_STRING*}" ) + + if [ "$#list" -eq 0 ]; then + echo "No matching history entries" + return 1 + fi + + n-list "${list[@]}" + + # Selection or quit? + if [[ "$REPLY" = -(#c0,1)[0-9]## && ("$REPLY" -lt 0 || "$REPLY" -gt 0) ]]; then + break + fi + + # View change? + if [ "$REPLY" = "F1" ]; then + # Target view: 2 + active_view=1 + _nhistory_switch_lists_states "1" + elif [ "$REPLY" = "HELP" ]; then + n-help + fi + + # + # View 3 - most frequent words in history + # + elif [ "$active_view" = "2" ]; then + local -a dbfile + dbfile=( $most_frequent_db(Nm+1) ) + + # Compute most frequent history words + if [[ "${#NHISTORY_WORDS}" -eq "0" || "${#dbfile}" -ne "0" ]]; then + # Read the list if it's there + local -a list + list=() + [ -s "$most_frequent_db" ] && list=( ${(f)"$(<$most_frequent_db)"} ) + + # Will wait for the data? + local message=0 + if [[ "${#list}" -eq 0 ]]; then + message=1 + _nlist_alternate_screen 1 + zcurses init + zcurses delwin info 2>/dev/null + zcurses addwin info "$term_height" "$term_width" 0 0 + zcurses bg info white/black + zcurses string info "Computing most frequent history words..."$'\n' + zcurses string info "(This is done once per day, from now on transparently)"$'\n' + zcurses refresh info + sleep 3 + fi + + # Start periodic list regeneration? + if [[ "${#list}" -eq 0 || "${#dbfile}" -ne "0" ]]; then + # Mark the file with current time, to prevent double + # regeneration (on quick double change of view) + print >> "$most_frequent_db" + (_nhistory_generate_most_frequent &) &> /dev/null + fi + + # Ensure we got the list, wait for it if needed + while [[ "${#list}" -eq 0 ]]; do + zcurses string info "." + zcurses refresh info + LANG=C sleep 0.5 + [ -s "$most_frequent_db" ] && list=( ${(f)"$(<$most_frequent_db)"} ) + done + + NHISTORY_WORDS=( "${list[@]}" ) + + if [ "$message" -eq "1" ]; then + zcurses delwin info 2>/dev/null + zcurses refresh + zcurses end + _nlist_alternate_screen 0 + fi + else + # Reuse most frequent history words + local -a list + list=( "${NHISTORY_WORDS[@]}" ) + fi + + n-list "${list[@]}" + + if [ "$REPLY" = "F1" ]; then + # Target view: 1 + active_view=0 + _nhistory_switch_lists_states "0" + elif [[ "$REPLY" = -(#c0,1)[0-9]## && "$REPLY" -lt 0 ]]; then + break + elif [[ "$REPLY" = -(#c0,1)[0-9]## && "$REPLY" -gt 0 ]]; then + local word="${reply[REPLY]#(#s) #[0-9]##$'\t'}" + one_NLIST_SEARCH_BUFFER="$word" + one_NLIST_SEARCH_BUFFER="${one_NLIST_SEARCH_BUFFER## ##}" + + # Target view: 1 + active_view=0 + _nhistory_switch_lists_states "0" + elif [ "$REPLY" = "HELP" ]; then + n-help + fi + + # + # View 2 - private history + # + elif [ "$active_view" = "1" ]; then + if [ -s "$private_history_db" ]; then + local title=$'\x1b[00;32m'"Private history:"$'\x1b[00;00m\0' + () { fc -Rap "$private_history_db" 20000 0; list=( "$title" ${history[@]} ) } + else + list=( "Private history - history entries selected via this tool will be put here" ) + fi + + n-list "${list[@]}" + + # Selection or quit? + if [[ "$REPLY" = -(#c0,1)[0-9]## && ("$REPLY" -lt 0 || "$REPLY" -gt 0) ]]; then + break + fi + + # View change? + if [ "$REPLY" = "F1" ]; then + # Target view: 3 + active_view=2 + _nhistory_switch_lists_states "2" + # Edit of the history? + elif [ "$REPLY" = "EDIT" ]; then + "${EDITOR:-vim}" "$private_history_db" + elif [ "$REPLY" = "HELP" ]; then + n-help + fi + fi +done + +if [ "$REPLY" -gt 0 ]; then + selected="$reply[REPLY]" + + # Append to private history + if [[ "$active_view" = "0" ]]; then + local newline=$'\n' + local selected_ph="${selected//$newline/\\$newline}" + print -r -- "$selected_ph" >> "$private_history_db" + fi + + # TMUX? + if [[ "$ZNT_TMUX_MODE" = "1" ]]; then + tmux send -t "$ZNT_TMUX_ORIGIN_SESSION:$ZNT_TMUX_ORIGIN_WINDOW.$ZNT_TMUX_ORIGIN_PANE" "$selected" + tmux kill-window + return 0 + # ZLE? + elif [ "${(t)CURSOR}" = "integer-local-special" ]; then + zle .redisplay + zle .kill-buffer + LBUFFER+="$selected" + else + print -zr -- "$selected" + fi +else + # TMUX? + if [[ "$ZNT_TMUX_MODE" = "1" ]]; then + tmux kill-window + # ZLE? + elif [[ "${(t)CURSOR}" = "integer-local-special" ]]; then + zle redisplay + fi +fi + +return 0 + +# vim: set filetype=zsh: diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/n-kill b/oh-my-zsh/plugins/zsh-navigation-tools/n-kill @@ -0,0 +1,96 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-kill` to .zshrc +# +# This function allows to choose a process and a signal to send to it +# +# Uses n-list + +emulate -L zsh + +setopt extendedglob +zmodload zsh/curses + +local IFS=" +" + +[ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-kill.conf ] && builtin source ~/.config/znt/n-kill.conf + +typeset -A signals +signals=( + 1 "1 - HUP" + 2 "2 - INT" + 3 "3 - QUIT" + 6 "6 - ABRT" + 9 "9 - KILL" + 14 "14 - ALRM" + 15 "15 - TERM" + 17 "17 - STOP" + 19 "19 - CONT" +) + +local list +local selected +local signal +local -a signal_names +local title + +NLIST_REMEMBER_STATE=0 + +typeset -a NLIST_NONSELECTABLE_ELEMENTS +NLIST_NONSELECTABLE_ELEMENTS=( 1 ) + +type ps 2>/dev/null 1>&2 || { echo >&2 "Error: \`ps' not found"; return 1 } + +case "$OSTYPE" in + cygwin*) list=( `command ps -Wa` ) ;; + *) list=( `command ps -o pid,uid,command -A` ) ;; +esac + +# Ask of PID +title=$'\x1b[00;31m'"${list[1]}"$'\x1b[00;00m\0' +shift list +list=( "$title" "${(@M)list:#(#i)*$1*}" ) + +local NLIST_GREP_STRING="$1" + +if [ "$#list" -eq 1 ]; then + echo "No matching processes" + return 1 +fi + +n-list "$list[@]" + +# Got answer? (could be Ctrl-C or 'q') +if [ "$REPLY" -gt 0 ]; then + selected="$reply[REPLY]" + selected="${selected## #}" + pid="${selected%% *}" + + # Now ask of signal + signal_names=( ${(vin)signals} ) + typeset -a NLIST_HOP_INDEXES + NLIST_HOP_INDEXES=( 3 6 8 ) + unset NLIST_COLORING_PATTERN + n-list $'\x1b[00;31mSelect signal:\x1b[00;00m' "$signal_names[@]" + + if [ "$REPLY" -gt 0 ]; then + selected="$reply[REPLY]" + signal="${(k)signals[(r)$selected]}" + + # ZLE? + if [ "${(t)CURSOR}" = "integer-local-special" ]; then + zle redisplay + zle kill-whole-line + zle -U "kill -$signal $pid" + else + print -zr "kill -$signal $pid" + fi + else + [ "${(t)CURSOR}" = "integer-local-special" ] && zle redisplay + fi +else + [ "${(t)CURSOR}" = "integer-local-special" ] && zle redisplay +fi + +# vim: set filetype=zsh: diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/n-list b/oh-my-zsh/plugins/zsh-navigation-tools/n-list @@ -0,0 +1,515 @@ +# $1, $2, ... - elements of the list +# $NLIST_NONSELECTABLE_ELEMENTS - array of indexes (1-based) that cannot be selected +# $REPLY is the output variable - contains index (1-based) or -1 when no selection +# $reply (array) is the second part of the output - use the index (REPLY) to get selected element +# +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-list` to .zshrc +# +# This function outputs a list of elements that can be +# navigated with keyboard. Uses curses library + +emulate -LR zsh + +setopt typesetsilent extendedglob noshortloops + +_nlist_has_terminfo=0 + +zmodload zsh/curses +zmodload zsh/terminfo 2>/dev/null && _nlist_has_terminfo=1 + +trap "REPLY=-2; reply=(); return" TERM INT QUIT +trap "_nlist_exit" EXIT + +# Drawing and input +autoload n-list-draw n-list-input + +# Cleanup before any exit +_nlist_exit() { + setopt localoptions + setopt extendedglob + + [[ "$REPLY" = -(#c0,1)[0-9]## || "$REPLY" = F<-> || "$REPLY" = "EDIT" || "$REPLY" = "HELP" ]] || REPLY="-1" + zcurses 2>/dev/null delwin inner + zcurses 2>/dev/null delwin main + zcurses 2>/dev/null refresh + zcurses end + _nlist_alternate_screen 0 + _nlist_cursor_visibility 1 + unset _nlist_has_terminfo +} + +# Outputs a message in the bottom of the screen +_nlist_status_msg() { + # -1 for border, -1 for 0-based indexing + zcurses move main $(( term_height - 1 - 1 )) 2 + zcurses clear main eol + zcurses string main "$1" + #status_msg_strlen is localized in caller + status_msg_strlen=$#1 +} + +# Prefer tput, then module terminfo +_nlist_cursor_visibility() { + if type tput 2>/dev/null 1>&2; then + [ "$1" = "1" ] && { tput cvvis; tput cnorm } + [ "$1" = "0" ] && tput civis + elif [ "$_nlist_has_terminfo" = "1" ]; then + [ "$1" = "1" ] && { [ -n $terminfo[cvvis] ] && echo -n $terminfo[cvvis]; + [ -n $terminfo[cnorm] ] && echo -n $terminfo[cnorm] } + [ "$1" = "0" ] && [ -n $terminfo[civis] ] && echo -n $terminfo[civis] + fi +} + +# Reason for this function is that on some systems +# smcup and rmcup are not knowing why left empty +_nlist_alternate_screen() { + [ "$_nlist_has_terminfo" -ne "1" ] && return + [[ "$1" = "1" && -n "$terminfo[smcup]" ]] && return + [[ "$1" = "0" && -n "$terminfo[rmcup]" ]] && return + + case "$TERM" in + *rxvt*) + [ "$1" = "1" ] && echo -n $'\x1b7\x1b[?47h' + [ "$1" = "0" ] && echo -n $'\x1b[2J\x1b[?47l\x1b8' + ;; + *) + [ "$1" = "1" ] && echo -n $'\x1b[?1049h' + [ "$1" = "0" ] && echo -n $'\x1b[?1049l' + # just to remember two other that work: $'\x1b7\x1b[r\x1b[?47h', $'\x1b[?47l\x1b8' + ;; + esac +} + +_nlist_compute_user_vars_difference() { + if [[ "${(t)NLIST_NONSELECTABLE_ELEMENTS}" != "array" && + "${(t)NLIST_NONSELECTABLE_ELEMENTS}" != "array-local" ]] + then + last_element_difference=0 + current_difference=0 + else + last_element_difference=$#NLIST_NONSELECTABLE_ELEMENTS + current_difference=0 + local idx + for idx in "${(n)NLIST_NONSELECTABLE_ELEMENTS[@]}"; do + [ "$idx" -le "$NLIST_CURRENT_IDX" ] && current_difference+=1 || break + done + fi +} + +# List was processed, check if variables aren't off range +_nlist_verify_vars() { + [ "$NLIST_CURRENT_IDX" -gt "$last_element" ] && NLIST_CURRENT_IDX="$last_element" + [[ "$NLIST_CURRENT_IDX" -eq 0 && "$last_element" -ne 0 ]] && NLIST_CURRENT_IDX=1 + (( NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=0+((NLIST_CURRENT_IDX-1)/page_height)*page_height+1 )) +} + +# Compute the variables which are shown to the user +_nlist_setup_user_vars() { + if [ "$1" = "1" ]; then + # Basic values when there are no non-selectables + NLIST_USER_CURRENT_IDX="$NLIST_CURRENT_IDX" + NLIST_USER_LAST_ELEMENT="$last_element" + else + _nlist_compute_user_vars_difference + NLIST_USER_CURRENT_IDX=$(( NLIST_CURRENT_IDX - current_difference )) + NLIST_USER_LAST_ELEMENT=$(( last_element - last_element_difference )) + fi +} + +_nlist_colorify_disp_list() { + local col=$'\x1b[00;34m' reset=$'\x1b[0m' + [ -n "$NLIST_COLORING_COLOR" ] && col="$NLIST_COLORING_COLOR" + [ -n "$NLIST_COLORING_END_COLOR" ] && reset="$NLIST_COLORING_END_COLOR" + + if [ "$NLIST_COLORING_MATCH_MULTIPLE" -eq 1 ]; then + disp_list=( "${(@)disp_list//(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" ) + else + disp_list=( "${(@)disp_list/(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" ) + fi +} + +# +# Main code +# + +# Check if there is proper input +if [ "$#" -lt 1 ]; then + echo "Usage: n-list element_1 ..." + return 1 +fi + +REPLY="-1" +typeset -ga reply +reply=() + +integer term_height="$LINES" +integer term_width="$COLUMNS" +if [[ "$term_height" -lt 1 || "$term_width" -lt 1 ]]; then + local stty_out=$( stty size ) + term_height="${stty_out% *}" + term_width="${stty_out#* }" +fi +integer inner_height=term_height-3 +integer inner_width=term_width-3 +integer page_height=inner_height +integer page_width=inner_width + +typeset -a list disp_list +integer last_element=$# +local action +local final_key +integer selection +integer last_element_difference=0 +integer current_difference=0 +local prev_search_buffer="" +integer prev_uniq_mode=0 +integer prev_start_idx=-1 +local MBEGIN MEND MATCH mbegin mend match + +# Iteration over predefined keywords +integer curkeyword nkeywords +local keywordisfresh="0" +if [[ "${(t)keywords}" != *array* ]]; then + local -a keywords + keywords=() +fi +curkeyword=0 +nkeywords=${#keywords} + +# Iteration over themes +integer curtheme nthemes +local themeisfresh="0" +if [[ "${(t)themes}" != *array* ]]; then + local -a themes + themes=() +fi +curtheme=0 +nthemes=${#themes} + +# Ability to remember the list between calls +if [[ -z "$NLIST_REMEMBER_STATE" || "$NLIST_REMEMBER_STATE" -eq 0 || "$NLIST_REMEMBER_STATE" -eq 2 ]]; then + NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=1 + NLIST_CURRENT_IDX=1 + NLIST_IS_SEARCH_MODE=0 + NLIST_SEARCH_BUFFER="" + NLIST_TEXT_OFFSET=0 + NLIST_IS_UNIQ_MODE=0 + NLIST_IS_F_MODE=0 + + # Zero - because it isn't known, unless we + # confirm that first element is selectable + NLIST_USER_CURRENT_IDX=0 + [[ ${NLIST_NONSELECTABLE_ELEMENTS[(r)1]} != 1 ]] && NLIST_USER_CURRENT_IDX=1 + NLIST_USER_LAST_ELEMENT=$(( last_element - $#NLIST_NONSELECTABLE_ELEMENTS )) + + # 2 is init once, then remember + [ "$NLIST_REMEMBER_STATE" -eq 2 ] && NLIST_REMEMBER_STATE=1 +fi + +if [ "$NLIST_START_IN_SEARCH_MODE" -eq 1 ]; then + NLIST_START_IN_SEARCH_MODE=0 + NLIST_IS_SEARCH_MODE=1 +fi + +if [ -n "$NLIST_SET_SEARCH_TO" ]; then + NLIST_SEARCH_BUFFER="$NLIST_SET_SEARCH_TO" + NLIST_SET_SEARCH_TO="" +fi + +if [ "$NLIST_START_IN_UNIQ_MODE" -eq 1 ]; then + NLIST_START_IN_UNIQ_MODE=0 + NLIST_IS_UNIQ_MODE=1 +fi + +_nlist_alternate_screen 1 +zcurses init +zcurses delwin main 2>/dev/null +zcurses delwin inner 2>/dev/null +zcurses addwin main "$term_height" "$term_width" 0 0 +zcurses addwin inner "$inner_height" "$inner_width" 1 2 +# From n-list.conf +[ "$colorpair" = "" ] && colorpair="white/black" +[ "$border" = "0" ] || border="1" +local background="${colorpair#*/}" +local backuptheme="$colorpair/$bold" +zcurses bg main "$colorpair" +zcurses bg inner "$colorpair" +if [ "$NLIST_IS_SEARCH_MODE" -ne 1 ]; then + _nlist_cursor_visibility 0 +fi + +zcurses refresh + +# +# Listening for input +# + +local key keypad + +# Clear input buffer +zcurses timeout main 0 +zcurses input main key keypad +zcurses timeout main -1 +key="" +keypad="" + +# This loop makes script faster on some Zsh's (e.g. 5.0.8) +repeat 1; do + list=( "$@" ) +done + +last_element="$#list" + +while (( 1 )); do + # Do searching (filtering with string) + if [ -n "$NLIST_SEARCH_BUFFER" ]; then + # Compute new list? + if [[ "$NLIST_SEARCH_BUFFER" != "$prev_search_buffer" || "$NLIST_IS_UNIQ_MODE" -ne "$prev_uniq_mode" + || "$NLIST_IS_F_MODE" -ne "$prev_f_mode" ]] + then + prev_search_buffer="$NLIST_SEARCH_BUFFER" + prev_uniq_mode="$NLIST_IS_UNIQ_MODE" + prev_f_mode="$NLIST_IS_F_MODE" + # regenerating list -> regenerating disp_list + prev_start_idx=-1 + + # Take all elements, including duplicates and non-selectables + typeset +U list + repeat 1; do + list=( "$@" ) + done + + # Remove non-selectable elements + [ "$#NLIST_NONSELECTABLE_ELEMENTS" -gt 0 ] && for i in "${(nO)NLIST_NONSELECTABLE_ELEMENTS[@]}"; do + if [[ "$i" = <-> ]]; then + list[$i]=() + fi + done + + # Remove duplicates + [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && typeset -U list + + last_element="$#list" + + # Next do the filtering + local search_buffer="${NLIST_SEARCH_BUFFER%% ##}" + search_buffer="${search_buffer## ##}" + search_buffer="${search_buffer//(#m)[][*?|#~^()><\\]/\\$MATCH}" + local search_pattern="" + local colsearch_pattern="" + if [ -n "$search_buffer" ]; then + # The repeat will make the matching work on a fresh heap + repeat 1; do + if [ "$NLIST_IS_F_MODE" -eq "1" ]; then + search_pattern="${search_buffer// ##/*~^(#a1)*}" + colsearch_pattern="${search_buffer// ##/|(#a1)}" + list=( "${(@M)list:#(#ia1)*$~search_pattern*}" ) + elif [ "$NLIST_IS_F_MODE" -eq "2" ]; then + search_pattern="${search_buffer// ##/*~^(#a2)*}" + colsearch_pattern="${search_buffer// ##/|(#a2)}" + list=( "${(@M)list:#(#ia2)*$~search_pattern*}" ) + else + # Pattern will be *foo*~^*bar* (inventor: Mikael Magnusson) + search_pattern="${search_buffer// ##/*~^*}" + # Pattern will be (foo|bar) + colsearch_pattern="${search_buffer// ##/|}" + list=( "${(@M)list:#(#i)*$~search_pattern*}" ) + fi + done + + last_element="$#list" + fi + + # Called after processing list + _nlist_verify_vars + fi + + _nlist_setup_user_vars 1 + + integer end_idx=$(( NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + page_height - 1 )) + [ "$end_idx" -gt "$last_element" ] && end_idx=last_element + + if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then + prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" + disp_list=( "${(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) + + if [ -n "$colsearch_pattern" ]; then + local red=$'\x1b[00;31m' reset=$'\x1b[00;00m' + # The repeat will make the matching work on a fresh heap + repeat 1; do + if [ "$NLIST_IS_F_MODE" -eq "1" ]; then + disp_list=( "${(@)disp_list//(#mia1)($~colsearch_pattern)/$red${MATCH}$reset}" ) + elif [ "$NLIST_IS_F_MODE" -eq "2" ]; then + disp_list=( "${(@)disp_list//(#mia2)($~colsearch_pattern)/$red${MATCH}$reset}" ) + else + disp_list=( "${(@)disp_list//(#mi)($~colsearch_pattern)/$red${MATCH}$reset}" ) + fi + done + fi + + # We have display list, lets replace newlines with "\n" when needed (1/2) + [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) + fi + + # Output colored list + zcurses clear inner + n-list-draw "$(( (NLIST_CURRENT_IDX-1) % page_height + 1 ))" \ + "$page_height" "$page_width" 0 0 "$NLIST_TEXT_OFFSET" inner \ + "$disp_list[@]" + else + # There is no search, but there was in previous loop + # OR + # Uniq mode was entered or left out + # -> compute new list + if [[ -n "$prev_search_buffer" || "$NLIST_IS_UNIQ_MODE" -ne "$prev_uniq_mode" ]]; then + prev_search_buffer="" + prev_uniq_mode="$NLIST_IS_UNIQ_MODE" + # regenerating list -> regenerating disp_list + prev_start_idx=-1 + + # Take all elements, including duplicates and non-selectables + typeset +U list + repeat 1; do + list=( "$@" ) + done + + # Remove non-selectable elements only when in uniq mode + [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && [ "$#NLIST_NONSELECTABLE_ELEMENTS" -gt 0 ] && + for i in "${(nO)NLIST_NONSELECTABLE_ELEMENTS[@]}"; do + if [[ "$i" = <-> ]]; then + list[$i]=() + fi + done + + # Remove duplicates when in uniq mode + [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && typeset -U list + + last_element="$#list" + # Called after processing list + _nlist_verify_vars + fi + + # "1" - shouldn't bother with non-selectables + _nlist_setup_user_vars "$NLIST_IS_UNIQ_MODE" + + integer end_idx=$(( NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + page_height - 1 )) + [ "$end_idx" -gt "$last_element" ] && end_idx=last_element + + if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then + prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" + disp_list=( "${(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) + + [ -n "$NLIST_COLORING_PATTERN" ] && _nlist_colorify_disp_list + + # We have display list, lets replace newlines with "\n" when needed (2/2) + [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) + fi + + # Output the list + zcurses clear inner + n-list-draw "$(( (NLIST_CURRENT_IDX-1) % page_height + 1 ))" \ + "$page_height" "$page_width" 0 0 "$NLIST_TEXT_OFFSET" inner \ + "$disp_list[@]" + fi + + local status_msg_strlen + local keywordmsg="" + if [ "$keywordisfresh" = "1" ]; then + keywordmsg="($curkeyword/$nkeywords) " + keywordisfresh="0" + fi + + local thememsg="" + if [ "$themeisfresh" = "1" ]; then + local theme="$backuptheme" + [ "$curtheme" -gt 0 ] && theme="${themes[curtheme]}" + thememsg="($curtheme/$nthemes $theme) " + themeisfresh="0" + fi + + local _txt2="" _txt3="" + [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && _txt2="[-UNIQ-] " + [ "$NLIST_IS_F_MODE" -eq 1 ] && _txt3="[-FIX-] " + [ "$NLIST_IS_F_MODE" -eq 2 ] && _txt3="[-FIX2-] " + + if [ "$NLIST_IS_SEARCH_MODE" = "1" ]; then + _nlist_status_msg "${_txt2}${_txt3}${keywordmsg}${thememsg}Filtering with: ${NLIST_SEARCH_BUFFER// /+}" + elif [[ ${NLIST_NONSELECTABLE_ELEMENTS[(r)$NLIST_CURRENT_IDX]} != $NLIST_CURRENT_IDX || + -n "$NLIST_SEARCH_BUFFER" || "$NLIST_IS_UNIQ_MODE" -eq 1 ]]; then + local _txt="" + [ -n "$NLIST_GREP_STRING" ] && _txt=" [$NLIST_GREP_STRING]" + _nlist_status_msg "${_txt2}${_txt3}${keywordmsg}${thememsg}Current #$NLIST_USER_CURRENT_IDX (of #$NLIST_USER_LAST_ELEMENT entries)$_txt" + else + _nlist_status_msg "${keywordmsg}${thememsg}" + fi + + [ "$border" = "1" ] && zcurses border main + + local top_msg=" ${(C)ZSH_NAME} $ZSH_VERSION, shell level $SHLVL " + if [[ "${NLIST_ENABLED_EVENTS[(r)F1]}" = "F1" ]]; then + top_msg=" F1-change view,$top_msg" + fi + zcurses move main 0 $(( term_width / 2 - $#top_msg / 2 )) + zcurses string main $top_msg + + zcurses refresh main inner + zcurses move main $(( term_height - 1 - 1 )) $(( status_msg_strlen + 2 )) + + # Wait for input + zcurses input main key keypad + + # Get the special (i.e. "keypad") key or regular key + if [ -n "$key" ]; then + final_key="$key" + elif [ -n "$keypad" ]; then + final_key="$keypad" + else + _nlist_status_msg "Inproper input detected" + zcurses refresh main inner + fi + + n-list-input "$NLIST_CURRENT_IDX" "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" \ + "$page_height" "$page_width" "$last_element" "$NLIST_TEXT_OFFSET" \ + "$final_key" "$NLIST_IS_SEARCH_MODE" "$NLIST_SEARCH_BUFFER" \ + "$NLIST_IS_UNIQ_MODE" "$NLIST_IS_F_MODE" + + selection="$reply[1]" + action="$reply[2]" + NLIST_CURRENT_IDX="$reply[3]" + NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN="$reply[4]" + NLIST_TEXT_OFFSET="$reply[5]" + NLIST_IS_SEARCH_MODE="$reply[6]" + NLIST_SEARCH_BUFFER="$reply[7]" + NLIST_IS_UNIQ_MODE="$reply[8]" + NLIST_IS_F_MODE="$reply[9]" + + if [ -z "$action" ]; then + continue + elif [ "$action" = "SELECT" ]; then + REPLY="$selection" + reply=( "$list[@]" ) + break + elif [ "$action" = "QUIT" ]; then + REPLY=-1 + reply=( "$list[@]" ) + break + elif [ "$action" = "REDRAW" ]; then + zcurses clear main redraw + zcurses clear inner redraw + elif [[ "$action" = F<-> ]]; then + REPLY="$action" + reply=( "$list[@]" ) + break + elif [[ "$action" = "EDIT" ]]; then + REPLY="EDIT" + reply=( "$list[@]" ) + break + elif [[ "$action" = "HELP" ]]; then + REPLY="HELP" + reply=( "$list[@]" ) + break + fi +done + +# vim: set filetype=zsh: diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/n-list-draw b/oh-my-zsh/plugins/zsh-navigation-tools/n-list-draw @@ -0,0 +1,133 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-list-draw` to .zshrc +# +# This is an internal function not for direct use + +emulate -L zsh + +zmodload zsh/curses + +setopt typesetsilent extendedglob + +_nlist_print_with_ansi() { + local win="$1" text="$2" out col chunk Xout + integer text_offset="$3" max_text_len="$4" text_len=0 no_match=0 nochunk_text_len to_skip_from_chunk to_chop_off_from_chunk before_len + + # 1 - non-escaped text, 2 - first number in the escaped text, with ; + # 3 - second number, 4 - text after whole escape text + + typeset -a c + c=( black red green yellow blue magenta cyan white ) + + while [[ -n "$text" && "$no_match" -eq 0 ]]; do + if [[ "$text" = (#b)([^$'\x1b']#)$'\x1b'\[([0-9](#c0,2))(#B)(\;|)(#b)([0-9](#c0,2))m(*) ]]; then + # Text for further processing + text="$match[4]" + # Text chunk to output now + out="$match[1]" + # Save color + col="$match[2]" + (( match[3] >= 30 && match[3] <= 37 )) && col="$match[3]" + else + out="$text" + no_match=1 + fi + + if [ -n "$out" ]; then +################ Expand tabs ################ + chunk="$out" + before_len="$text_len" + Xout="" + + while [ -n "$chunk" ]; do + [[ "$chunk" = (#b)([^$'\t']#)$'\t'(*) ]] && { + (( all_text_len=((before_len+${#match[1]})/8+1)*8 )) + + Xout+="${(r:all_text_len-before_len:: :)match[1]}" + + before_len+=all_text_len-before_len + chunk="$match[2]" + } || { + Xout+="$chunk" + break + } + done +############################################# + + # Input text length without the current chunk + nochunk_text_len=text_len + # Input text length up to current chunk + text_len+="$#Xout" + + # Should start displaying with this chunk? + # I.e. stop skipping left part of the input text? + if (( text_len > text_offset )); then + to_skip_from_chunk=text_offset-nochunk_text_len + + # LEFT - is chunk off the left skip boundary? +1 for 1-based index in string + (( to_skip_from_chunk > 0 )) && Xout="${Xout[to_skip_from_chunk+1,-1]}" + + # RIGHT - is text off the screen? + if (( text_len-text_offset > max_text_len )); then + to_chop_off_from_chunk=0+(text_len-text_offset)-max_text_len + Xout="${Xout[1,-to_chop_off_from_chunk-1]}" + fi + + [ -n "$Xout" ] && zcurses string "$win" "$Xout" + fi + fi + + if (( no_match == 0 )); then + if (( col >= 30 && col <= 37 )); then + zcurses attr "$win" $c[col-29]/"$background" + elif [[ "$col" -eq 0 ]]; then + zcurses attr "$win" "$colorpair" + fi + fi + done +} + +integer highlight="$1" +integer page_height="$2" +integer page_width="$3" +local y_offset="$4" +local x_offset="$5" +local text_offset="$6" +local win="$7" +shift 7 +integer max_text_len=page_width-x_offset + +[[ "$bold" = "0" || "$bold" = "-bold" ]] && bold="-bold" || bold="+bold" +[[ "$active_text" = "underline" || "$active_text" = "reverse" ]] || local active_text="reverse" +# Linux has ncv 18, screen* has ncv 3 - underline won't work properly +(( ${terminfo[ncv]:-0} & 2 )) && active_text="reverse" +# FreeBSD uses TERM=xterm for newcons but doesn't actually support underline +[[ "$TERM" = "xterm" && -z "$DISPLAY" ]] && active_text="reverse" + +integer max_idx=page_height +integer end_idx=max_idx +[ "$end_idx" -gt "$#" ] && end_idx="$#" +integer y=y_offset + +zcurses attr "$win" "$bold" "$colorpair" + +integer i text_len +local text +for (( i=1; i<=end_idx; i++ )); do + zcurses move "$win" $y "$x_offset" + + [ "$i" = "$highlight" ] && zcurses attr "$win" +"$active_text" + _nlist_print_with_ansi "$win" "$@[i]" "$text_offset" "$max_text_len" + zcurses clear "$win" eol + [ "$i" = "$highlight" ] && zcurses attr "$win" -"$active_text" + + y+=1 +done + +if [ "$end_idx" -lt "$max_idx" ]; then + zcurses move "$win" $y "$x_offset" + zcurses clear "$win" eol +fi + +zcurses attr "$win" white/black +# vim: set filetype=zsh: diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/n-list-input b/oh-my-zsh/plugins/zsh-navigation-tools/n-list-input @@ -0,0 +1,377 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-list-input` to .zshrc +# +# This is an internal function not for direct use + +emulate -L zsh + +zmodload zsh/curses + +setopt typesetsilent + +# Compute first to show index +_nlist_compute_first_to_show_idx() { + from_what_idx_list_is_shown=0+((current_idx-1)/page_height)*page_height+1 +} + +_nlist_update_from_keywords() { + keywordisfresh="1" + if [ "$nkeywords" -gt 0 ]; then + curkeyword=$(( (curkeyword+1) % (nkeywords+1) )) + if [ "$curkeyword" -eq "0" ]; then + buffer="" + else + buffer="${keywords[curkeyword]}" + fi + fi +} + +_nlist_iterate_theme() { + themeisfresh="1" + if [ "$1" = "1" ]; then + curtheme=$(( (curtheme+1) % (nthemes+1) )) + else + curtheme=curtheme-1 + [ "$curtheme" -lt 0 ] && curtheme=nthemes + fi + + if [ "$nthemes" -gt 0 ]; then + local theme=${themes[curtheme]} + [ "$curtheme" -eq "0" ] && theme="$backuptheme" + + colorpair="${theme%/*}" + bold="${theme##*/}" + background="${colorpair#*/}" + zcurses bg main "$colorpair" + zcurses bg inner "$colorpair" + fi +} + +_nlist_rotate_buffer() { + setopt localoptions noglob + + local -a words + words=( ${(s: :)buffer} ) + words=( ${words[-1]} ${words[1,-2]} ) + + local space="" + [ "${buffer[-1]}" = " " ] && space=" " + + buffer="${(j: :)words}$space" +} + +typeset -ga reply +reply=( -1 '' ) +integer current_idx="$1" +integer from_what_idx_list_is_shown="$2" +integer page_height="$3" +integer page_width="$4" +integer last_element="$5" +integer hscroll="$6" +local key="$7" +integer search="$8" +local buffer="$9" +integer uniq_mode="$10" +integer f_mode="$11" + +# +# Listening for input +# + +if [ "$search" = "0" ]; then + +case "$key" in + (UP|k|$'\C-P') + # Are there any elements before the current one? + [ "$current_idx" -gt 1 ] && current_idx=current_idx-1; + _nlist_compute_first_to_show_idx + ;; + (DOWN|j|$'\C-N') + # Are there any elements after the current one? + [ "$current_idx" -lt "$last_element" ] && current_idx=current_idx+1; + _nlist_compute_first_to_show_idx + ;; + (PPAGE|$'\b'|$'\C-?'|BACKSPACE) + current_idx=current_idx-page_height + [ "$current_idx" -lt 1 ] && current_idx=1; + _nlist_compute_first_to_show_idx + ;; + (NPAGE|" ") + current_idx=current_idx+page_height + [ "$current_idx" -gt "$last_element" ] && current_idx=last_element; + _nlist_compute_first_to_show_idx + ;; + ($'\C-U') + current_idx=current_idx-page_height/2 + [ "$current_idx" -lt 1 ] && current_idx=1; + _nlist_compute_first_to_show_idx + ;; + ($'\C-D') + current_idx=current_idx+page_height/2 + [ "$current_idx" -gt "$last_element" ] && current_idx=last_element; + _nlist_compute_first_to_show_idx + ;; + (HOME|g) + current_idx=1 + _nlist_compute_first_to_show_idx + ;; + (END|G) + current_idx=last_element + _nlist_compute_first_to_show_idx + ;; + ($'\n'|ENTER) + # Is that element selectable? + # Check for this only when there is no search + if [[ "$NLIST_SEARCH_BUFFER" != "" || "$NLIST_IS_UNIQ_MODE" -eq 1 || + ${NLIST_NONSELECTABLE_ELEMENTS[(r)$current_idx]} != $current_idx ]] + then + # Save current element in the result variable + reply=( $current_idx "SELECT" ) + fi + ;; + (H|'?') + # This event needs to be enabled + if [[ "${NLIST_ENABLED_EVENTS[(r)HELP]}" = "HELP" ]]; then + reply=( -1 "HELP" ) + fi + ;; + (F1) + # This event needs to be enabled + if [[ "${NLIST_ENABLED_EVENTS[(r)F1]}" = "F1" ]]; then + reply=( -1 "$key" ) + fi + ;; + (F4|F5|F6|F7|F8|F9|F10|DC) + # ignore; F2, F3 are used below + ;; + (q) + reply=( -1 "QUIT" ) + ;; + (/) + search=1 + _nlist_cursor_visibility 1 + ;; + ($'\t') + reply=( $current_idx "LEAVE" ) + ;; + ($'\C-L') + reply=( -1 "REDRAW" ) + ;; + (\]) + [[ "${(t)NLIST_HOP_INDEXES}" = "array" || "${(t)NLIST_HOP_INDEXES}" = "array-local" ]] && + [ -z "$NLIST_SEARCH_BUFFER" ] && [ "$NLIST_IS_UNIQ_MODE" -eq 0 ] && + for idx in "${(n)NLIST_HOP_INDEXES[@]}"; do + if [ "$idx" -gt "$current_idx" ]; then + current_idx=$idx + _nlist_compute_first_to_show_idx + break + fi + done + ;; + (\[) + [[ "${(t)NLIST_HOP_INDEXES}" = "array" || "${(t)NLIST_HOP_INDEXES}" = "array-local" ]] && + [ -z "$NLIST_SEARCH_BUFFER" ] && [ "$NLIST_IS_UNIQ_MODE" -eq 0 ] && + for idx in "${(nO)NLIST_HOP_INDEXES[@]}"; do + if [ "$idx" -lt "$current_idx" ]; then + current_idx=$idx + _nlist_compute_first_to_show_idx + break + fi + done + ;; + ('<'|'{'|LEFT|'h') + hscroll=hscroll-7 + [ "$hscroll" -lt 0 ] && hscroll=0 + ;; + ('>'|'}'|RIGHT|'l') + hscroll+=7 + ;; + ($'\E') + buffer="" + ;; + (F3) + if [ "$search" = "1" ]; then + search=0 + _nlist_cursor_visibility 0 + else + search=1 + _nlist_cursor_visibility 1 + fi + ;; + (o|$'\C-O') + uniq_mode=1-uniq_mode + ;; + (f|$'\C-F') + (( f_mode=(f_mode+1) % 3 )) + ;; + ($'\x1F'|F2|$'\C-X') + search=1 + _nlist_cursor_visibility 1 + _nlist_update_from_keywords + ;; + ($'\C-T') + _nlist_iterate_theme 1 + ;; + ($'\C-G') + _nlist_iterate_theme 0 + ;; + ($'\C-E'|e) + # This event needs to be enabled + if [[ "${NLIST_ENABLED_EVENTS[(r)EDIT]}" = "EDIT" ]]; then + reply=( -1 "EDIT" ) + fi + ;; + ($'\C-A') + _nlist_rotate_buffer + ;; + (*) + ;; +esac + +else + +case "$key" in + ($'\n'|ENTER) + if [ "$NLIST_INSTANT_SELECT" = "1" ]; then + if [[ "$NLIST_SEARCH_BUFFER" != "" || "$NLIST_IS_UNIQ_MODE" -eq 1 || + ${NLIST_NONSELECTABLE_ELEMENTS[(r)$current_idx]} != $current_idx ]] + then + reply=( $current_idx "SELECT" ) + fi + else + search=0 + _nlist_cursor_visibility 0 + fi + ;; + ($'\C-L') + reply=( -1 "REDRAW" ) + ;; + + # + # Slightly limited navigation + # + + (UP|$'\C-P') + [ "$current_idx" -gt 1 ] && current_idx=current_idx-1; + _nlist_compute_first_to_show_idx + ;; + (DOWN|$'\C-N') + [ "$current_idx" -lt "$last_element" ] && current_idx=current_idx+1; + _nlist_compute_first_to_show_idx + ;; + (PPAGE) + current_idx=current_idx-page_height + [ "$current_idx" -lt 1 ] && current_idx=1; + _nlist_compute_first_to_show_idx + ;; + (NPAGE) + current_idx=current_idx+page_height + [ "$current_idx" -gt "$last_element" ] && current_idx=last_element; + _nlist_compute_first_to_show_idx + ;; + ($'\C-U') + current_idx=current_idx-page_height/2 + [ "$current_idx" -lt 1 ] && current_idx=1; + _nlist_compute_first_to_show_idx + ;; + ($'\C-D') + current_idx=current_idx+page_height/2 + [ "$current_idx" -gt "$last_element" ] && current_idx=last_element; + _nlist_compute_first_to_show_idx + ;; + (HOME) + current_idx=1 + _nlist_compute_first_to_show_idx + ;; + (END) + current_idx=last_element + _nlist_compute_first_to_show_idx + ;; + (LEFT) + hscroll=hscroll-7 + [ "$hscroll" -lt 0 ] && hscroll=0 + ;; + (RIGHT) + hscroll+=7 + ;; + (F1) + # This event needs to be enabled + if [[ "${NLIST_ENABLED_EVENTS[(r)F1]}" = "F1" ]]; then + reply=( -1 "$key" ) + fi + ;; + (F4|F5|F6|F7|F8|F9|F10|DC) + # ignore; F2, F3 are used below + ;; + + # + # The input + # + + ($'\b'|$'\C-?'|BACKSPACE) + buffer="${buffer%?}" + ;; + ($'\C-W') + [ "$buffer" = "${buffer% *}" ] && buffer="" || buffer="${buffer% *}" + ;; + ($'\C-K') + buffer="" + ;; + ($'\E') + buffer="" + search=0 + _nlist_cursor_visibility 0 + ;; + (F3) + if [ "$search" = "1" ]; then + search=0 + _nlist_cursor_visibility 0 + else + search=1 + _nlist_cursor_visibility 1 + fi + ;; + ($'\C-O') + uniq_mode=1-uniq_mode + ;; + ($'\C-F') + (( f_mode=(f_mode+1) % 3 )) + ;; + ($'\x1F'|F2|$'\C-X') + _nlist_update_from_keywords + ;; + ($'\C-T') + _nlist_iterate_theme 1 + ;; + ($'\C-G') + _nlist_iterate_theme 0 + ;; + ($'\C-E') + # This event needs to be enabled + if [[ "${NLIST_ENABLED_EVENTS[(r)EDIT]}" = "EDIT" ]]; then + reply=( -1 "EDIT" ) + fi + ;; + ($'\C-A') + _nlist_rotate_buffer + ;; + (*) + if [[ $#key == 1 && $((#key)) -lt 31 ]]; then + # ignore all other control keys + else + buffer+="$key" + fi + ;; +esac + +fi + +reply[3]="$current_idx" +reply[4]="$from_what_idx_list_is_shown" +reply[5]="$hscroll" +reply[6]="$search" +reply[7]="$buffer" +reply[8]="$uniq_mode" +reply[9]="$f_mode" + +# vim: set filetype=zsh: diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/n-options b/oh-my-zsh/plugins/zsh-navigation-tools/n-options @@ -0,0 +1,84 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-options` to .zshrc +# +# This function allows to browse and toggle shell's options +# +# Uses n-list + +#emulate -L zsh + +zmodload zsh/curses + +local IFS=" +" + +unset NLIST_COLORING_PATTERN + +[ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-options.conf ] && builtin source ~/.config/znt/n-options.conf + +# TODO restore options +unsetopt localoptions + +integer kshoptionprint=0 +[[ -o kshoptionprint ]] && kshoptionprint=1 +setopt kshoptionprint + +local list +local selected +local option +local state + +# 0 - don't remember, 1 - remember, 2 - init once, then remember +NLIST_REMEMBER_STATE=2 + +local NLIST_GREP_STRING="${1:=}" + +while (( 1 )); do + list=( `setopt` ) + list=( "${(M)list[@]:#*${1:=}*}" ) + list=( "${list[@]:#kshoptionprint*}" ) + + if [ "$#list" -eq 0 ]; then + echo "No matching options" + break + fi + + local red=$'\x1b[00;31m' green=$'\x1b[00;32m' reset=$'\x1b[00;00m' + list=( "${list[@]/ off/${red} off$reset}" ) + #list=( "${list[@]/ on/${green} on$reset}" ) + list=( "${(i)list[@]}" ) + + n-list "${list[@]}" + + if [ "$REPLY" -gt 0 ]; then + [[ -o ksharrays ]] && selected="${reply[$(( REPLY - 1 ))]}" || selected="${reply[$REPLY]}" + option="${selected%% *}" + state="${selected##* }" + + if [[ -o globsubst ]]; then + unsetopt globsubst + state="${state%$reset}" + setopt globsubst + else + state="${state%$reset}" + fi + + # Toggle the option + if [ "$state" = "on" ]; then + echo "Setting |$option| to off" + unsetopt "$option" + else + echo "Setting |$option| to on" + setopt "$option" + fi + else + break + fi +done + +NLIST_REMEMBER_STATE=0 + +[[ "$kshoptionprint" -eq 0 ]] && unsetopt kshoptionprint + +# vim: set filetype=zsh: diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/n-panelize b/oh-my-zsh/plugins/zsh-navigation-tools/n-panelize @@ -0,0 +1,68 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-panelize` to .zshrc +# +# This function somewhat reminds the panelize feature from Midnight Commander +# It allows browsing output of arbitrary command. Example usage: +# v-panelize ls /usr/local/bin +# +# Uses n-list + +emulate -L zsh + +setopt extendedglob +zmodload zsh/curses + +local IFS=" +" + +unset NLIST_COLORING_PATTERN + +[ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-panelize.conf ] && builtin source ~/.config/znt/n-panelize.conf + +local list +local selected + +NLIST_REMEMBER_STATE=0 + +if [ -t 0 ]; then + # Check if there is proper input + if [ "$#" -lt 1 ]; then + echo "Usage: n-panelize {command} [option|argument] ... or command | n-panelize" + return 1 + fi + + # This loop makes script faster on some Zsh's (e.g. 5.0.8) + repeat 1; do + list=( `"$@"` ) + done + + # TODO: $? doesn't reach user + [ "$?" -eq 127 ] && return $? +else + # Check if can reattach to terminal + if [[ ! -c /dev/tty && ! -t 2 ]]; then + echo "No terminal available (no /dev/tty)" + return 1 + fi + + # This loop makes script faster on some Zsh's (e.g. 5.0.8) + repeat 1; do + list=( "${(@f)"$(<&0)"}" ) + done + + if [[ ! -c /dev/tty ]]; then + exec <&2 + else + exec </dev/tty + fi +fi + +n-list "${list[@]}" + +if [ "$REPLY" -gt 0 ]; then + selected="$reply[REPLY]" + print -zr "# $selected" +fi + +# vim: set filetype=zsh: diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/znt-cd-widget b/oh-my-zsh/plugins/zsh-navigation-tools/znt-cd-widget @@ -0,0 +1,8 @@ +autoload znt-usetty-wrapper n-cd +local NLIST_START_IN_SEARCH_MODE=0 +local NLIST_START_IN_UNIQ_MODE=0 + +znt-usetty-wrapper n-cd "$@" + +unset NLIST_START_IN_SEARCH_MODE +unset NLIST_START_IN_UNIQ_MODE diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/znt-history-widget b/oh-my-zsh/plugins/zsh-navigation-tools/znt-history-widget @@ -0,0 +1,22 @@ +autoload znt-usetty-wrapper n-history +local NLIST_START_IN_SEARCH_MODE=1 +local NLIST_START_IN_UNIQ_MODE=1 + +# Only if current $BUFFER doesn't come from history +if [ "$HISTCMD" = "$HISTNO" ]; then + () { + setopt localoptions extendedglob + local -a match mbegin mend + local MATCH; integer MBEGIN MEND + + [ -n "$BUFFER" ] && BUFFER="${BUFFER%% ##} " + } + + local NLIST_SET_SEARCH_TO="$BUFFER" +fi + +znt-usetty-wrapper n-history "$@" + +unset NLIST_START_IN_SEARCH_MODE +unset NLIST_START_IN_UNIQ_MODE +unset NLIST_SET_SEARCH_TO diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/znt-kill-widget b/oh-my-zsh/plugins/zsh-navigation-tools/znt-kill-widget @@ -0,0 +1,8 @@ +autoload znt-usetty-wrapper n-kill +local NLIST_START_IN_SEARCH_MODE=0 +local NLIST_START_IN_UNIQ_MODE=0 + +znt-usetty-wrapper n-kill "$@" + +unset NLIST_START_IN_SEARCH_MODE +unset NLIST_START_IN_UNIQ_MODE diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/znt-tmux.zsh b/oh-my-zsh/plugins/zsh-navigation-tools/znt-tmux.zsh @@ -0,0 +1,50 @@ +#!/usr/bin/env zsh + +# Copyright (c) 2016, Zsolt Lengyel +# Modifications copyright (c) 2016, Sebastian Gniazdowski + +# +# This script opens a new, temporary tmux pane and runs n-history. When +# a selection is made, the result (history entry) is pasted back into +# original tmux pane, and the temporary pane is closed. This allows to +# use local history on remote machines. +# +# To use, put this line to your ~/.tmux.conf. The tool is invoked with: +# Ctrl+b h +# +# bind h run-shell -b "$ZNT_REPO_DIR/znt-tmux.zsh" +# + +# get and save the current active tmux pane id +active_pane=$(tmux display -p -F ':#{session_id}:#I:#P:#{pane_active}:#{window_active}:#{session_attached}' ) +a_active_pane=("${(@s/:/)active_pane}") + +active_session=${a_active_pane[2]//$} +active_window=$a_active_pane[3] +active_pane=$a_active_pane[4] + +# set variables for upcoming window +tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_MODE" 1 +tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_SESSION" "$active_session" +tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_WINDOW" "$active_window" +tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_PANE" "$active_pane" + +# create a new window in the active session and call it znt-hist +tmux new-window -t $active_session: -n znt-hist + +# unset the variables, so only above single window has them +tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_MODE" +tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_SESSION" +tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_WINDOW" +tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_PANE" + +# znt's session id +znt_active_pane=$(tmux display -p -F ':#{session_id}:#I:#P:#{pane_active}:#{window_active}:#{session_attached}' ) +znt_a_active_pane=("${(@s/:/)znt_active_pane}") + +znt_active_session=${znt_a_active_pane[2]//$} +znt_active_window=$znt_a_active_pane[3] +znt_active_pane=$znt_a_active_pane[4] + +# call znt +tmux send -t "$znt_active_session:$znt_active_window.$znt_active_pane" n-history ENTER diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/znt-usetty-wrapper b/oh-my-zsh/plugins/zsh-navigation-tools/znt-usetty-wrapper @@ -0,0 +1,40 @@ +emulate -L zsh + +zmodload zsh/curses + +test_fd0() { + true <&0 +} + +local restore=0 FD + +# Reattach to terminal +if [ ! -t 0 ]; then + # Check if can reattach to terminal in any way + if [[ ! -c /dev/tty && ! -t 2 ]]; then + echo "No terminal available (no /dev/tty and no terminal at stderr)" + return 1 + fi + + if test_fd0 2>/dev/null; then + exec {FD}<&0 + restore=2 + else + restore=1 + fi + + if [[ ! -c /dev/tty ]]; then + exec <&2 + else + exec </dev/tty + fi +fi + +# Run the command +"$@" + +# Restore FD state +(( restore == 1 )) && exec <&- +(( restore == 2 )) && exec <&$FD && exec {FD}<&- + +# vim: set filetype=zsh: diff --git a/oh-my-zsh/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh b/oh-my-zsh/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh @@ -0,0 +1,55 @@ +#!/usr/bin/env zsh + +0="${(%):-%N}" # this gives immunity to functionargzero being unset +export ZNT_REPO_DIR="${0%/*}" +export ZNT_CONFIG_DIR="$HOME/.config/znt" + +# +# Copy configs +# + +if [[ ! -d "$HOME/.config" ]]; then + command mkdir "$HOME/.config" +fi + +if [[ ! -d "$ZNT_CONFIG_DIR" ]]; then + command mkdir "$ZNT_CONFIG_DIR" +fi + +# 9 files +unset __ZNT_CONFIG_FILES +typeset -ga __ZNT_CONFIG_FILES +set +A __ZNT_CONFIG_FILES n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf + +# Check for random 2 files if they exist +# This will shift 0 - 7 elements +shift $(( RANDOM % 8 )) __ZNT_CONFIG_FILES +if [[ ! -f "$ZNT_CONFIG_DIR/${__ZNT_CONFIG_FILES[1]}" || ! -f "$ZNT_CONFIG_DIR/${__ZNT_CONFIG_FILES[2]}" ]]; then + # Something changed - examine every file + set +A __ZNT_CONFIG_FILES n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf + unset __ZNT_CONFIG_FILE + typeset -g __ZNT_CONFIG_FILE + for __ZNT_CONFIG_FILE in "${__ZNT_CONFIG_FILES[@]}"; do + if [[ ! -f "$ZNT_CONFIG_DIR/$__ZNT_CONFIG_FILE" ]]; then + command cp "$ZNT_REPO_DIR/.config/znt/$__ZNT_CONFIG_FILE" "$ZNT_CONFIG_DIR" + fi + done + unset __ZNT_CONFIG_FILE +fi + +unset __ZNT_CONFIG_FILES + +# +# Load functions +# + +autoload n-aliases n-cd n-env n-functions n-history n-kill n-list n-list-draw n-list-input n-options n-panelize n-help +autoload znt-usetty-wrapper znt-history-widget znt-cd-widget znt-kill-widget +alias naliases=n-aliases ncd=n-cd nenv=n-env nfunctions=n-functions nhistory=n-history +alias nkill=n-kill noptions=n-options npanelize=n-panelize nhelp=n-help + +zle -N znt-history-widget +bindkey '^R' znt-history-widget +setopt AUTO_PUSHD HIST_IGNORE_DUPS PUSHD_IGNORE_DUPS +zstyle ':completion::complete:n-kill::bits' matcher 'r:|=** l:|=*' + diff --git a/oh-my-zsh/plugins/zsh_reload/zsh_reload.plugin.zsh b/oh-my-zsh/plugins/zsh_reload/zsh_reload.plugin.zsh @@ -0,0 +1,13 @@ +# reload zshrc +function src() +{ + local cache=$ZSH_CACHE_DIR + autoload -U compinit zrecompile + compinit -d "$cache/zcomp-$HOST" + + for f in ~/.zshrc "$cache/zcomp-$HOST"; do + zrecompile -p $f && command rm -f $f.zwc.old + done + + source ~/.zshrc +} diff --git a/oh-my-zsh/templates/zshrc.zsh-template b/oh-my-zsh/templates/zshrc.zsh-template @@ -0,0 +1,94 @@ +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:/usr/local/bin:$PATH + +# Path to your oh-my-zsh installation. +export ZSH=$HOME/.oh-my-zsh + +# Set name of the theme to load. Optionally, if you set this to "random" +# it'll load a random theme each time that oh-my-zsh is loaded. +# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes +ZSH_THEME="robbyrussell" + +# Set list of themes to load +# Setting this variable when ZSH_THEME=random +# cause zsh load theme from this variable instead of +# looking in ~/.oh-my-zsh/themes/ +# An empty array have no effect +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. Case +# sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment the following line to disable bi-weekly auto-update checks. +# DISABLE_AUTO_UPDATE="true" + +# Uncomment the following line to change how often to auto-update (in days). +# export UPDATE_ZSH_DAYS=13 + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) +# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=( + git +) + +source $ZSH/oh-my-zsh.sh + +# User configuration + +# export MANPATH="/usr/local/man:$MANPATH" + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 + +# Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='mvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# ssh +# export SSH_KEY_PATH="~/.ssh/rsa_id" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" diff --git a/oh-my-zsh/themes/3den.zsh-theme b/oh-my-zsh/themes/3den.zsh-theme @@ -0,0 +1,7 @@ +PROMPT=$'%{$fg[white]%}$(~/.rvm/bin/rvm-prompt) %{$fg_bold[cyan]%}%~%{$reset_color%}$(git_prompt_info) %{$fg[cyan]%}%D{[%I:%M:%S]}\ +%{$fg_bold[green]%}%n$%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[white]%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="*" +ZSH_THEME_GIT_PROMPT_CLEAN="" diff --git a/oh-my-zsh/themes/Soliah.zsh-theme b/oh-my-zsh/themes/Soliah.zsh-theme @@ -0,0 +1,87 @@ +PROMPT='%{$fg[blue]%}%n%{$reset_color%} on %{$fg[red]%}%M%{$reset_color%} in %{$fg[blue]%}%~%b%{$reset_color%}$(git_time_since_commit)$(check_git_prompt_info) +$ ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" + +# Text to display if the branch is dirty +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" + +# Text to display if the branch is clean +ZSH_THEME_GIT_PROMPT_CLEAN="" + +# Colors vary depending on time lapsed. +ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" +ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" + + +# Git sometimes goes into a detached head state. git_prompt_info doesn't +# return anything in this case. So wrap it in another function and check +# for an empty string. +function check_git_prompt_info() { + if git rev-parse --git-dir > /dev/null 2>&1; then + if [[ -z $(git_prompt_info) ]]; then + echo "%{$fg[magenta]%}detached-head%{$reset_color%})" + else + echo "$(git_prompt_info)" + fi + fi +} + +# Determine if we are using a gemset. +function rvm_gemset() { + if hash rvm 2>/dev/null; then + GEMSET=`rvm gemset list | grep '=>' | cut -b4-` + if [[ -n $GEMSET ]]; then + echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|" + fi + fi +} + +# Determine the time since last commit. If branch is clean, +# use a neutral color, otherwise colors will vary according to time. +function git_time_since_commit() { + if git rev-parse --git-dir > /dev/null 2>&1; then + # Only proceed if there is actually a commit. + if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then + # Get the last commit. + last_commit=`git log --pretty=format:'%at' -1 2> /dev/null` + now=`date +%s` + seconds_since_last_commit=$((now-last_commit)) + + # Totals + MINUTES=$((seconds_since_last_commit / 60)) + HOURS=$((seconds_since_last_commit/3600)) + + # Sub-hours and sub-minutes + DAYS=$((seconds_since_last_commit / 86400)) + SUB_HOURS=$((HOURS % 24)) + SUB_MINUTES=$((MINUTES % 60)) + + if [[ -n $(git status -s 2> /dev/null) ]]; then + if [ "$MINUTES" -gt 30 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" + elif [ "$MINUTES" -gt 10 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM" + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + fi + + if [ "$HOURS" -gt 24 ]; then + echo "($(rvm_gemset)$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + elif [ "$MINUTES" -gt 60 ]; then + echo "($(rvm_gemset)$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + else + echo "($(rvm_gemset)$COLOR${MINUTES}m%{$reset_color%}|" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + echo "($(rvm_gemset)$COLOR~|" + fi + fi +} diff --git a/oh-my-zsh/themes/adben.zsh-theme b/oh-my-zsh/themes/adben.zsh-theme @@ -0,0 +1,114 @@ +#!/usr/bin/env zsh +# # +# # #README +# # +# # This theme provides two customizable header functionalities: +# # a) displaying a pseudo-random message from a database of quotations +# # (https://en.wikipedia.org/wiki/Fortune_%28Unix%29) +# # b) displaying randomly command line tips from The command line fu +# # (http://www.commandlinefu.com) community: in order to make use of this functionality +# # you will need Internet connection. +# # This theme provides as well information for the current user's context, like; +# # branch and status for the current version control system (git and svn currently +# # supported) and time, presented to the user in a non invasive volatile way. +# # +# # #REQUIREMENTS +# # This theme requires wget:: +# # -Homebrew-osx- brew install wget +# # -Debian/Ubuntu- apt-get install wget +# # and fortune :: +# # -Homebrew-osx- brew install fortune +# # -Debian/Ubuntu- apt-get install fortune +# # +# # optionally: +# # -Oh-myzsh vcs plug-ins git and svn. +# # -Solarized theme (https://github.com/altercation/solarized/) +# # -OS X: iTerm 2 (http://www.iterm2.com/) +# # -font Source code pro (https://github.com/adobe/source-code-pro) +# # +# # This theme's look and feel is based on the Aaron Toponce's zsh theme, more info: +# # http://pthree.org/2008/11/23/727/ +# # enjoy! +########## COLOR ########### +for COLOR in CYAN WHITE YELLOW MAGENTA BLACK BLUE RED DEFAULT GREEN GREY; do + eval PR_$COLOR='%{$fg[${(L)COLOR}]%}' + eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}' +done +PR_RESET="%{$reset_color%}" +RED_START="${PR_RESET}${PR_GREY}<${PR_RESET}${PR_RED}<${PR_BRIGHT_RED}<${PR_RESET} " +RED_END="${PR_RESET}${PR_BRIGHT_RED}>${PR_RESET}${PR_RED}>${PR_GREY}>${PR_RESET} " +GREEN_END="${PR_RESET}${PR_BRIGHT_GREEN}>${PR_RESET}${PR_GREEN}>${PR_GREY}>${PR_RESET} " +GREEN_BASE_START="${PR_RESET}${PR_GREY}>${PR_RESET}${PR_GREEN}>${PR_BRIGHT_GREEN}>${PR_RESET}" +GREEN_START_P1="${PR_RESET}${GREEN_BASE_START}${PR_RESET} " +DIVISION="${PR_RESET}${PR_RED} < ${PR_RESET}" +VCS_DIRTY_COLOR="${PR_RESET}${PR_YELLOW}" +VCS_CLEAN_COLOR="${PR_RESET}${PR_GREEN}" +VCS_SUFIX_COLOR="${PR_RESET}${PR_RED}› ${PR_RESET}" +# ########## COLOR ########### +# ########## SVN ########### +ZSH_THEME_SVN_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹svn:" +ZSH_THEME_SVN_PROMPT_SUFFIX="" +ZSH_THEME_SVN_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}" +ZSH_THEME_SVN_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}" +# ########## SVN ########### +# ########## GIT ########### +ZSH_THEME_GIT_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹git:" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}" +ZSH_THEME_GIT_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}" +ZSH_THEME_GIT_PROMPT_ADDED="${PR_RESET}${PR_YELLOW} ✚${PR_RESET}" +ZSH_THEME_GIT_PROMPT_MODIFIED="${PR_RESET}${PR_YELLOW} ✹${PR_RESET}" +ZSH_THEME_GIT_PROMPT_DELETED="${PR_RESET}${PR_YELLOW} ✖${PR_RESET}" +ZSH_THEME_GIT_PROMPT_RENAMED="${PR_RESET}${PR_YELLOW} ➜${PR_RESET}" +ZSH_THEME_GIT_PROMPT_UNMERGED="${PR_RESET}${PR_YELLOW} ═${PR_RESET}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="${PR_RESET}${PR_YELLOW} ✭${PR_RESET}" +# ########## GIT ########### +function precmd { + #gets the fortune + ps1_fortune () { + #Choose from all databases, regardless of whether they are considered "offensive" + fortune -a + } + #obtains the tip + ps1_command_tip () { + wget -qO - http://www.commandlinefu.com/commands/random/plaintext | sed 1d | sed '/^$/d' + } + prompt_header () { + if [[ "true" == "$ENABLE_COMMAND_TIP" ]]; then + ps1_command_tip + else + ps1_fortune + fi + } + PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}" + # set a simple variable to show when in screen + if [[ -n "${WINDOW}" ]]; then + SCREEN="" + fi +} + +# Context: user@directory or just directory +prompt_context () { + if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then + echo -n "${PR_RESET}${PR_RED}$USER@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" + else + echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" + fi +} + +set_prompt () { + # required for the prompt + setopt prompt_subst + autoload zsh/terminfo + + # ######### PROMPT ######### + PROMPT='${PROMPT_HEAD} +${RED_START}$(prompt_context) +${GREEN_START_P1}' + RPROMPT='${PR_RESET}$(git_prompt_info)$(svn_prompt_info)${PR_YELLOW}%D{%R.%S %a %b %d %Y} ${GREEN_END}${PR_RESET}' + # Matching continuation prompt + PROMPT2='${GREEN_BASE_START}${PR_RESET} %_ ${GREEN_BASE_START}${PR_RESET} ' + # ######### PROMPT ######### +} + +set_prompt diff --git a/oh-my-zsh/themes/af-magic.zsh-theme b/oh-my-zsh/themes/af-magic.zsh-theme @@ -0,0 +1,33 @@ +# af-magic.zsh-theme +# Repo: https://github.com/andyfleming/oh-my-zsh +# Direct Link: https://github.com/andyfleming/oh-my-zsh/blob/master/themes/af-magic.zsh-theme + +if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +# primary prompt +PROMPT='$FG[237]------------------------------------------------------------%{$reset_color%} +$FG[032]%~\ +$(git_prompt_info) \ +$FG[105]%(!.#.»)%{$reset_color%} ' +PROMPT2='%{$fg[red]%}\ %{$reset_color%}' +RPS1='${return_code}' + + +# color vars +eval my_gray='$FG[237]' +eval my_orange='$FG[214]' + +# right prompt +if type "virtualenv_prompt_info" > /dev/null +then + RPROMPT='$(virtualenv_prompt_info)$my_gray%n@%m%{$reset_color%}%' +else + RPROMPT='$my_gray%n@%m%{$reset_color%}%' +fi + +# git settings +ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075]($FG[078]" +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="$my_orange*%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="$FG[075])%{$reset_color%}" diff --git a/oh-my-zsh/themes/afowler.zsh-theme b/oh-my-zsh/themes/afowler.zsh-theme @@ -0,0 +1,10 @@ +if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi + +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='%m %{${fg_bold[blue]}%}:: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' + +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" diff --git a/oh-my-zsh/themes/agnoster.zsh-theme b/oh-my-zsh/themes/agnoster.zsh-theme @@ -0,0 +1,228 @@ +# vim:ft=zsh ts=2 sw=2 sts=2 +# +# agnoster's Theme - https://gist.github.com/3712874 +# A Powerline-inspired theme for ZSH +# +# # README +# +# In order for this theme to render correctly, you will need a +# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts). +# Make sure you have a recent version: the code points that Powerline +# uses changed in 2012, and older versions will display incorrectly, +# in confusing ways. +# +# In addition, I recommend the +# [Solarized theme](https://github.com/altercation/solarized/) and, if you're +# using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over Terminal.app - +# it has significantly better color fidelity. +# +# # Goals +# +# The aim of this theme is to only show you *relevant* information. Like most +# prompts, it will only show git information when in a git working directory. +# However, it goes a step further: everything from the current user and +# hostname to whether the last call exited with an error to whether background +# jobs are running in this shell will all be displayed automatically when +# appropriate. + +### Segment drawing +# A few utility functions to make it easy and re-usable to draw segmented prompts + +CURRENT_BG='NONE' + +# Special Powerline characters + +() { + local LC_ALL="" LC_CTYPE="en_US.UTF-8" + # NOTE: This segment separator character is correct. In 2012, Powerline changed + # the code points they use for their special characters. This is the new code point. + # If this is not working for you, you probably have an old version of the + # Powerline-patched fonts installed. Download and install the new version. + # Do not submit PRs to change this unless you have reviewed the Powerline code point + # history and have new information. + # This is defined using a Unicode escape sequence so it is unambiguously readable, regardless of + # what font the user is viewing this source code in. Do not replace the + # escape sequence with a single literal character. + # Do not change this! Do not make it '\u2b80'; that is the old, wrong code point. + SEGMENT_SEPARATOR=$'\ue0b0' +} + +# Begin a segment +# Takes two arguments, background and foreground. Both can be omitted, +# rendering default background/foreground. +prompt_segment() { + local bg fg + [[ -n $1 ]] && bg="%K{$1}" || bg="%k" + [[ -n $2 ]] && fg="%F{$2}" || fg="%f" + if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then + echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} " + else + echo -n "%{$bg%}%{$fg%} " + fi + CURRENT_BG=$1 + [[ -n $3 ]] && echo -n $3 +} + +# End the prompt, closing any open segments +prompt_end() { + if [[ -n $CURRENT_BG ]]; then + echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR" + else + echo -n "%{%k%}" + fi + echo -n "%{%f%}" + CURRENT_BG='' +} + +### Prompt components +# Each component will draw itself, and hide itself if no information needs to be shown + +# Context: user@hostname (who am I and where am I) +prompt_context() { + if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then + prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m" + fi +} + +# Git: branch/detached head, dirty status +prompt_git() { + (( $+commands[git] )) || return + local PL_BRANCH_CHAR + () { + local LC_ALL="" LC_CTYPE="en_US.UTF-8" + PL_BRANCH_CHAR=$'\ue0a0' # + } + local ref dirty mode repo_path + repo_path=$(git rev-parse --git-dir 2>/dev/null) + + if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then + dirty=$(parse_git_dirty) + ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)" + if [[ -n $dirty ]]; then + prompt_segment yellow black + else + prompt_segment green black + fi + + if [[ -e "${repo_path}/BISECT_LOG" ]]; then + mode=" <B>" + elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then + mode=" >M<" + elif [[ -e "${repo_path}/rebase" || -e "${repo_path}/rebase-apply" || -e "${repo_path}/rebase-merge" || -e "${repo_path}/../.dotest" ]]; then + mode=" >R>" + fi + + setopt promptsubst + autoload -Uz vcs_info + + zstyle ':vcs_info:*' enable git + zstyle ':vcs_info:*' get-revision true + zstyle ':vcs_info:*' check-for-changes true + zstyle ':vcs_info:*' stagedstr '✚' + zstyle ':vcs_info:*' unstagedstr '●' + zstyle ':vcs_info:*' formats ' %u%c' + zstyle ':vcs_info:*' actionformats ' %u%c' + vcs_info + echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}" + fi +} + +prompt_bzr() { + (( $+commands[bzr] )) || return + if (bzr status >/dev/null 2>&1); then + status_mod=`bzr status | head -n1 | grep "modified" | wc -m` + status_all=`bzr status | head -n1 | wc -m` + revision=`bzr log | head -n2 | tail -n1 | sed 's/^revno: //'` + if [[ $status_mod -gt 0 ]] ; then + prompt_segment yellow black + echo -n "bzr@"$revision "✚ " + else + if [[ $status_all -gt 0 ]] ; then + prompt_segment yellow black + echo -n "bzr@"$revision + + else + prompt_segment green black + echo -n "bzr@"$revision + fi + fi + fi +} + +prompt_hg() { + (( $+commands[hg] )) || return + local rev status + if $(hg id >/dev/null 2>&1); then + if $(hg prompt >/dev/null 2>&1); then + if [[ $(hg prompt "{status|unknown}") = "?" ]]; then + # if files are not added + prompt_segment red white + st='±' + elif [[ -n $(hg prompt "{status|modified}") ]]; then + # if any modification + prompt_segment yellow black + st='±' + else + # if working copy is clean + prompt_segment green black + fi + echo -n $(hg prompt "☿ {rev}@{branch}") $st + else + st="" + rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g') + branch=$(hg id -b 2>/dev/null) + if `hg st | grep -q "^\?"`; then + prompt_segment red black + st='±' + elif `hg st | grep -q "^[MA]"`; then + prompt_segment yellow black + st='±' + else + prompt_segment green black + fi + echo -n "☿ $rev@$branch" $st + fi + fi +} + +# Dir: current working directory +prompt_dir() { + prompt_segment blue black '%~' +} + +# Virtualenv: current working virtualenv +prompt_virtualenv() { + local virtualenv_path="$VIRTUAL_ENV" + if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then + prompt_segment blue black "(`basename $virtualenv_path`)" + fi +} + +# Status: +# - was there an error +# - am I root +# - are there background jobs? +prompt_status() { + local symbols + symbols=() + [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘" + [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" + [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙" + + [[ -n "$symbols" ]] && prompt_segment black default "$symbols" +} + +## Main prompt +build_prompt() { + RETVAL=$? + prompt_status + prompt_virtualenv + prompt_context + prompt_dir + prompt_git + prompt_bzr + prompt_hg + prompt_end +} + +PROMPT='%{%f%b%k%}$(build_prompt) ' diff --git a/oh-my-zsh/themes/alanpeabody.zsh-theme b/oh-my-zsh/themes/alanpeabody.zsh-theme @@ -0,0 +1,28 @@ + +local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}' +local pwd='%{$fg[blue]%}%~%{$reset_color%}' +local rvm='' +if which rvm-prompt &> /dev/null; then + rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}' +else + if which rbenv &> /dev/null; then + rvm='%{$fg[green]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}' + fi +fi +local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})' +local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" + +PROMPT="${user} ${pwd}$ " +RPROMPT="${return_code} ${git_branch} ${rvm}" diff --git a/oh-my-zsh/themes/amuse.zsh-theme b/oh-my-zsh/themes/amuse.zsh-theme @@ -0,0 +1,29 @@ +# vim:ft=zsh ts=2 sw=2 sts=2 + +rvm_current() { + rvm current 2>/dev/null +} + +rbenv_version() { + rbenv version 2>/dev/null | awk '{print $1}' +} + +PROMPT=' +%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%} +$ ' + +# Must use Powerline font, for \uE0A0 to render. +ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}\uE0A0 " +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +if [ -e ~/.rvm/bin/rvm-prompt ]; then + RPROMPT='%{$fg_bold[red]%}‹$(rvm_current)›%{$reset_color%}' +else + if which rbenv &> /dev/null; then + RPROMPT='%{$fg_bold[red]%}$(rbenv_version)%{$reset_color%}' + fi +fi + diff --git a/oh-my-zsh/themes/apple.zsh-theme b/oh-my-zsh/themes/apple.zsh-theme @@ -0,0 +1,28 @@ +function toon { + echo -n "" +} + +get_git_dirty() { + git diff --quiet || echo '*' +} + +autoload -Uz vcs_info +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:*' unstagedstr '%F{red}*' # display this when there are unstaged changes +zstyle ':vcs_info:*' stagedstr '%F{yellow}+' # display this when there are staged changes +zstyle ':vcs_info:*' actionformats \ + '%F{5}%F{5}[%F{2}%b%F{3}|%F{1}%a%c%u%F{5}]%f ' +zstyle ':vcs_info:*' formats \ + '%F{5}%F{5}[%F{2}%b%c%u%F{5}]%f ' +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' +zstyle ':vcs_info:*' enable git cvs svn + +theme_precmd () { + vcs_info +} + +setopt prompt_subst +PROMPT='%{$fg[magenta]%}$(toon)%{$reset_color%} %~/ %{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}' + +autoload -U add-zsh-hook +add-zsh-hook precmd theme_precmd+ \ No newline at end of file diff --git a/oh-my-zsh/themes/arrow.zsh-theme b/oh-my-zsh/themes/arrow.zsh-theme @@ -0,0 +1,14 @@ +if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="yellow"; fi + +PROMPT='%{$fg[$NCOLOR]%}%c ➤ %{$reset_color%}' +RPROMPT='%{$fg[$NCOLOR]%}%p $(git_prompt_info)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="git:" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="*" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +# See http://geoff.greer.fm/lscolors/ +export LSCOLORS="exfxcxdxbxbxbxbxbxbxbx" +export LS_COLORS="di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=31;40:cd=31;40:su=31;40:sg=31;40:tw=31;40:ow=31;40:" + diff --git a/oh-my-zsh/themes/aussiegeek.zsh-theme b/oh-my-zsh/themes/aussiegeek.zsh-theme @@ -0,0 +1,8 @@ + +PROMPT='$fg_bold[blue][ $fg[red]%t $fg_bold[blue]] $fg_bold[blue] [ $fg[red]%n@%m:%~$(git_prompt_info)$fg[yellow]$(rvm_prompt_info)$fg_bold[blue] ]$reset_color + $ ' +# git theming +ZSH_THEME_GIT_PROMPT_PREFIX="$fg_bold[green](" +ZSH_THEME_GIT_PROMPT_SUFFIX=")" +ZSH_THEME_GIT_PROMPT_CLEAN="✔" +ZSH_THEME_GIT_PROMPT_DIRTY="✗" diff --git a/oh-my-zsh/themes/avit.zsh-theme b/oh-my-zsh/themes/avit.zsh-theme @@ -0,0 +1,110 @@ +# AVIT ZSH Theme + +PROMPT=' +$(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version) +%{$fg[$CARETCOLOR]%}▶%{$resetcolor%} ' + +PROMPT2='%{$fg[$CARETCOLOR]%}◀%{$reset_color%} ' + +RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' + +local _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} " +local _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}" +local _hist_no="%{$fg[grey]%}%h%{$reset_color%}" + +function _current_dir() { + local _max_pwd_length="65" + if [[ $(echo -n $PWD | wc -c) -gt ${_max_pwd_length} ]]; then + echo "%{$fg_bold[blue]%}%-2~ ... %3~%{$reset_color%} " + else + echo "%{$fg_bold[blue]%}%~%{$reset_color%} " + fi +} + +function _user_host() { + if [[ -n $SSH_CONNECTION ]]; then + me="%n@%m" + elif [[ $LOGNAME != $USER ]]; then + me="%n" + fi + if [[ -n $me ]]; then + echo "%{$fg[cyan]%}$me%{$reset_color%}:" + fi +} + +function _vi_status() { + if {echo $fpath | grep -q "plugins/vi-mode"}; then + echo "$(vi_mode_prompt_info)" + fi +} + +function _ruby_version() { + if {echo $fpath | grep -q "plugins/rvm"}; then + echo "%{$fg[grey]%}$(rvm_prompt_info)%{$reset_color%}" + elif {echo $fpath | grep -q "plugins/rbenv"}; then + echo "%{$fg[grey]%}$(rbenv_prompt_info)%{$reset_color%}" + fi +} + +# Determine the time since last commit. If branch is clean, +# use a neutral color, otherwise colors will vary according to time. +function _git_time_since_commit() { +# Only proceed if there is actually a commit. + if git log -1 > /dev/null 2>&1; then + # Get the last commit. + last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null) + now=$(date +%s) + seconds_since_last_commit=$((now-last_commit)) + + # Totals + minutes=$((seconds_since_last_commit / 60)) + hours=$((seconds_since_last_commit/3600)) + + # Sub-hours and sub-minutes + days=$((seconds_since_last_commit / 86400)) + sub_hours=$((hours % 24)) + sub_minutes=$((minutes % 60)) + + if [ $hours -gt 24 ]; then + commit_age="${days}d" + elif [ $minutes -gt 60 ]; then + commit_age="${sub_hours}h${sub_minutes}m" + else + commit_age="${minutes}m" + fi + + color=$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL + echo "$color$commit_age%{$reset_color%}" + fi +} + +if [[ $USER == "root" ]]; then + CARETCOLOR="red" +else + CARETCOLOR="white" +fi + +MODE_INDICATOR="%{$fg_bold[yellow]%}❮%{$reset_color%}%{$fg[yellow]%}❮❮%{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}✚ " +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}⚑ " +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✖ " +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}▴ " +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}§ " +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[white]%}◒ " + +# Colors vary depending on time lapsed. +ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" +ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[white]%}" + +# LS colors, made with http://geoff.greer.fm/lscolors/ +export LSCOLORS="exfxcxdxbxegedabagacad" +export LS_COLORS='di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:' +export GREP_COLOR='1;33' diff --git a/oh-my-zsh/themes/awesomepanda.zsh-theme b/oh-my-zsh/themes/awesomepanda.zsh-theme @@ -0,0 +1,16 @@ +# the svn plugin has to be activated for this to work. +local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)" +PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[yellow]%} ✗ %{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) " + +ZSH_PROMPT_BASE_COLOR="%{$fg_bold[blue]%}" +ZSH_THEME_REPO_NAME_COLOR="%{$fg_bold[red]%}" + +ZSH_THEME_SVN_PROMPT_PREFIX="svn:(" +ZSH_THEME_SVN_PROMPT_SUFFIX=")" +ZSH_THEME_SVN_PROMPT_DIRTY="%{$fg[red]%} ✘ %{$reset_color%}" +ZSH_THEME_SVN_PROMPT_CLEAN=" " diff --git a/oh-my-zsh/themes/bira.zsh-theme b/oh-my-zsh/themes/bira.zsh-theme @@ -0,0 +1,30 @@ +# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + + +if [[ $UID -eq 0 ]]; then + local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}' + local user_symbol='#' +else + local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' + local user_symbol='$' +fi + +local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}' +local rvm_ruby='' +if which rvm-prompt &> /dev/null; then + rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' +else + if which rbenv &> /dev/null; then + rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}' + fi +fi +local git_branch='$(git_prompt_info)%{$reset_color%}' + +PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} +╰─%B${user_symbol}%b " +RPS1="%B${return_code}%b" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" + diff --git a/oh-my-zsh/themes/blinks.zsh-theme b/oh-my-zsh/themes/blinks.zsh-theme @@ -0,0 +1,30 @@ +# https://github.com/blinks zsh theme + +function _prompt_char() { + if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then + echo "%{%F{blue}%}±%{%f%k%b%}" + else + echo ' ' + fi +} + +# This theme works with both the "dark" and "light" variants of the +# Solarized color schema. Set the SOLARIZED_THEME variable to one of +# these two values to choose. If you don't specify, we'll assume you're +# using the "dark" variant. + +case ${SOLARIZED_THEME:-dark} in + light) bkg=white;; + *) bkg=black;; +esac + +ZSH_THEME_GIT_PROMPT_PREFIX=" [%{%B%F{blue}%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{%f%k%b%K{${bkg}}%B%F{green}%}]" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{%F{red}%}*%{%f%k%b%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +PROMPT='%{%f%k%b%} +%{%K{${bkg}}%B%F{green}%}%n%{%B%F{blue}%}@%{%B%F{cyan}%}%m%{%B%F{green}%} %{%b%F{yellow}%K{${bkg}}%}%~%{%B%F{green}%}$(git_prompt_info)%E%{%f%k%b%} +%{%K{${bkg}}%}$(_prompt_char)%{%K{${bkg}}%} %#%{%f%k%b%} ' + +RPROMPT='!%{%B%F{cyan}%}%!%{%f%k%b%}' diff --git a/oh-my-zsh/themes/bureau.zsh-theme b/oh-my-zsh/themes/bureau.zsh-theme @@ -0,0 +1,123 @@ +# oh-my-zsh Bureau Theme + +### NVM + +ZSH_THEME_NVM_PROMPT_PREFIX="%B⬡%b " +ZSH_THEME_NVM_PROMPT_SUFFIX="" + +### Git [±master ▾●] + +ZSH_THEME_GIT_PROMPT_PREFIX="[%{$fg_bold[green]%}±%{$reset_color%}%{$fg_bold[white]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}]" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[cyan]%}▴%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg[magenta]%}▾%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[yellow]%}●%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}●%{$reset_color%}" + +bureau_git_branch () { + ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ + ref=$(command git rev-parse --short HEAD 2> /dev/null) || return + echo "${ref#refs/heads/}" +} + +bureau_git_status() { + _STATUS="" + + # check status of files + _INDEX=$(command git status --porcelain 2> /dev/null) + if [[ -n "$_INDEX" ]]; then + if $(echo "$_INDEX" | command grep -q '^[AMRD]. '); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED" + fi + if $(echo "$_INDEX" | command grep -q '^.[MTD] '); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" + fi + if $(echo "$_INDEX" | command grep -q -E '^\?\? '); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" + fi + if $(echo "$_INDEX" | command grep -q '^UU '); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" + fi + else + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_CLEAN" + fi + + # check status of local repository + _INDEX=$(command git status --porcelain -b 2> /dev/null) + if $(echo "$_INDEX" | command grep -q '^## .*ahead'); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" + fi + if $(echo "$_INDEX" | command grep -q '^## .*behind'); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" + fi + if $(echo "$_INDEX" | command grep -q '^## .*diverged'); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED" + fi + + if $(command git rev-parse --verify refs/stash &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED" + fi + + echo $_STATUS +} + +bureau_git_prompt () { + local _branch=$(bureau_git_branch) + local _status=$(bureau_git_status) + local _result="" + if [[ "${_branch}x" != "x" ]]; then + _result="$ZSH_THEME_GIT_PROMPT_PREFIX$_branch" + if [[ "${_status}x" != "x" ]]; then + _result="$_result $_status" + fi + _result="$_result$ZSH_THEME_GIT_PROMPT_SUFFIX" + fi + echo $_result +} + + +_PATH="%{$fg_bold[white]%}%~%{$reset_color%}" + +if [[ $EUID -eq 0 ]]; then + _USERNAME="%{$fg_bold[red]%}%n" + _LIBERTY="%{$fg[red]%}#" +else + _USERNAME="%{$fg_bold[white]%}%n" + _LIBERTY="%{$fg[green]%}$" +fi +_USERNAME="$_USERNAME%{$reset_color%}@%m" +_LIBERTY="$_LIBERTY%{$reset_color%}" + + +get_space () { + local STR=$1$2 + local zero='%([BSUbfksu]|([FB]|){*})' + local LENGTH=${#${(S%%)STR//$~zero/}} + local SPACES="" + (( LENGTH = ${COLUMNS} - $LENGTH - 1)) + + for i in {0..$LENGTH} + do + SPACES="$SPACES " + done + + echo $SPACES +} + +_1LEFT="$_USERNAME $_PATH" +_1RIGHT="[%*] " + +bureau_precmd () { + _1SPACES=`get_space $_1LEFT $_1RIGHT` + print + print -rP "$_1LEFT$_1SPACES$_1RIGHT" +} + +setopt prompt_subst +PROMPT='> $_LIBERTY ' +RPROMPT='$(nvm_prompt_info) $(bureau_git_prompt)' + +autoload -U add-zsh-hook +add-zsh-hook precmd bureau_precmd diff --git a/oh-my-zsh/themes/candy-kingdom.zsh-theme b/oh-my-zsh/themes/candy-kingdom.zsh-theme @@ -0,0 +1,30 @@ +# neuralsanwich.zsh-theme + +if [ "x$OH_MY_ZSH_HG" = "x" ]; then + OH_MY_ZSH_HG="hg" +fi + +function hg_prompt_info { + $OH_MY_ZSH_HG prompt --angle-brackets "\ +< on %{$fg[magenta]%}<branch>%{$reset_color%}>\ +< at %{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\ +%{$fg[green]%}<status|modified|unknown><update>%{$reset_color%}< +patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null +} + +function box_name { + [ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST} +} + +PROMPT=' +%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}$(box_name)%{$reset_color%}:%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(hg_prompt_info)$(git_prompt_info) +%(?,,%{${fg_bold[white]}%}[%?]%{$reset_color%} )$ ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[magenta]%}branch: " +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[red]%}?" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[orange]%}!" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" + +local return_status="%{$fg[red]%}%(?..✘)%{$reset_color%}" +RPROMPT='${return_status}$(battery_time_remaining) $(battery_pct_prompt)%{$reset_color%}' diff --git a/oh-my-zsh/themes/candy.zsh-theme b/oh-my-zsh/themes/candy.zsh-theme @@ -0,0 +1,7 @@ +PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%X]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ +%{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" diff --git a/oh-my-zsh/themes/clean.zsh-theme b/oh-my-zsh/themes/clean.zsh-theme @@ -0,0 +1,14 @@ +if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="white"; fi + +PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' +RPROMPT='[%*]' + +# git theming +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[yellow]%}%B" +ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✗" + +# LS colors, made with http://geoff.greer.fm/lscolors/ +export LSCOLORS="Gxfxcxdxbxegedabagacad" +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' diff --git a/oh-my-zsh/themes/cloud.zsh-theme b/oh-my-zsh/themes/cloud.zsh-theme @@ -0,0 +1,10 @@ +if [[ -z $ZSH_THEME_CLOUD_PREFIX ]]; then + ZSH_THEME_CLOUD_PREFIX='☁' +fi + +PROMPT='%{$fg_bold[cyan]%}$ZSH_THEME_CLOUD_PREFIX %{$fg_bold[green]%}%p %{$fg[green]%}%c %{$fg_bold[cyan]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$fg[cyan]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}] %{$fg[yellow]%}⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]"+ \ No newline at end of file diff --git a/oh-my-zsh/themes/crcandy.zsh-theme b/oh-my-zsh/themes/crcandy.zsh-theme @@ -0,0 +1,8 @@ +PROMPT=$' +%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ +%{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" diff --git a/oh-my-zsh/themes/crunch.zsh-theme b/oh-my-zsh/themes/crunch.zsh-theme @@ -0,0 +1,43 @@ +# CRUNCH - created from Steve Eley's cat waxing. +# Initially hacked from the Dallas theme. Thanks, Dallas Reedy. +# +# This theme assumes you do most of your oh-my-zsh'ed "colorful" work at a single machine, +# and eschews the standard space-consuming user and hostname info. Instead, only the +# things that vary in my own workflow are shown: +# +# * The time (not the date) +# * The RVM version and gemset (omitting the 'ruby' name if it's MRI) +# * The current directory +# * The Git branch and its 'dirty' state +# +# Colors are at the top so you can mess with those separately if you like. +# For the most part I stuck with Dallas's. + +CRUNCH_BRACKET_COLOR="%{$fg[white]%}" +CRUNCH_TIME_COLOR="%{$fg[yellow]%}" +CRUNCH_RVM_COLOR="%{$fg[magenta]%}" +CRUNCH_DIR_COLOR="%{$fg[cyan]%}" +CRUNCH_GIT_BRANCH_COLOR="%{$fg[green]%}" +CRUNCH_GIT_CLEAN_COLOR="%{$fg[green]%}" +CRUNCH_GIT_DIRTY_COLOR="%{$fg[red]%}" + +# These Git variables are used by the oh-my-zsh git_prompt_info helper: +ZSH_THEME_GIT_PROMPT_PREFIX="$CRUNCH_BRACKET_COLOR:$CRUNCH_GIT_BRANCH_COLOR" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_CLEAN=" $CRUNCH_GIT_CLEAN_COLOR✓" +ZSH_THEME_GIT_PROMPT_DIRTY=" $CRUNCH_GIT_DIRTY_COLOR✗" + +# Our elements: +CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}" +if [ -e ~/.rvm/bin/rvm-prompt ]; then + CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}" +else + if which rbenv &> /dev/null; then + CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(rbenv version | sed -e 's/ (set.*$//' -e 's/^ruby-//')}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}" + fi +fi +CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) " +CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ " + +# Put it all together! +PROMPT="$CRUNCH_TIME_$CRUNCH_RVM_$CRUNCH_DIR_$CRUNCH_PROMPT%{$reset_color%}" diff --git a/oh-my-zsh/themes/cypher.zsh-theme b/oh-my-zsh/themes/cypher.zsh-theme @@ -0,0 +1,4 @@ +# Based on evan's prompt +# Shows the exit status of the last command if non-zero +# Uses "#" instead of "»" when running with elevated privileges +PROMPT="%m %{${fg_bold[red]}%}:: %{${fg[green]}%}%3~%(0?. . %{${fg[red]}%}%? )%{${fg[blue]}%}»%{${reset_color}%} " diff --git a/oh-my-zsh/themes/dallas.zsh-theme b/oh-my-zsh/themes/dallas.zsh-theme @@ -0,0 +1,32 @@ +# Personalized! + +# Grab the current date (%D) and time (%T) wrapped in {}: {%D %T} +DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%D %T%{$fg[white]%}}%{$reset_color%}" +# Grab the current version of ruby in use (via RVM): [ruby-1.8.7] +if [ -e ~/.rvm/bin/rvm-prompt ]; then + DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}" +else + if which rbenv &> /dev/null; then + DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg[white]%}]%{$reset_color%}" + fi +fi +# Grab the current machine name: muscato +DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}" +# Grab the current filepath, use shortcuts: ~/Desktop +# Append the current git branch, if in a git repository: ~aw@master +DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}\$(parse_git_dirty)" +# Grab the current username: dallas +DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}" +# Use a % for normal users and a # for privelaged (root) users. +DALLAS_PROMPT_CHAR_="%{$fg[white]%}%(!.#.%%)%{$reset_color%}" +# For the git prompt, use a white @ and blue text for the branch name +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}@%{$fg[blue]%}" +# Close it all off by resetting the color and styles. +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +# Do nothing if the branch is clean (no changes). +ZSH_THEME_GIT_PROMPT_CLEAN="" +# Add 3 cyan ✗s if this branch is diiirrrty! Dirty branch! +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[cyan]%}✗✗✗" + +# Put it all together! +PROMPT="$DALLAS_CURRENT_TIME_$DALLAS_CURRENT_RUBY_$DALLAS_CURRENT_MACH_$DALLAS_CURRENT_LOCA_ $DALLAS_CURRENT_USER_$DALLAS_PROMPT_CHAR_ " diff --git a/oh-my-zsh/themes/darkblood.zsh-theme b/oh-my-zsh/themes/darkblood.zsh-theme @@ -0,0 +1,9 @@ +# meh. Dark Blood Rewind, a new beginning. + +PROMPT=$'%{$fg[red]%}┌[%{$fg_bold[white]%}%n%{$reset_color%}%{$fg[red]%}@%{$fg_bold[white]%}%m%{$reset_color%}%{$fg[red]%}] [%{$fg_bold[white]%}/dev/%y%{$reset_color%}%{$fg[red]%}] %{$(git_prompt_info)%}%(?,,%{$fg[red]%}[%{$fg_bold[white]%}%?%{$reset_color%}%{$fg[red]%}]) +%{$fg[red]%}└[%{$fg_bold[white]%}%~%{$reset_color%}%{$fg[red]%}]>%{$reset_color%} ' +PS2=$' %{$fg[red]%}|>%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}[%{$fg_bold[white]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}%{$fg[red]%}] " +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}⚡%{$reset_color%}" diff --git a/oh-my-zsh/themes/daveverwer.zsh-theme b/oh-my-zsh/themes/daveverwer.zsh-theme @@ -0,0 +1,7 @@ +# Copied and modified from the oh-my-zsh theme from geoffgarside +# Red server name, green cwd, blue git status + +PROMPT='%{$fg[red]%}%m%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$(git_prompt_info) %(!.#.$) ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" diff --git a/oh-my-zsh/themes/dieter.zsh-theme b/oh-my-zsh/themes/dieter.zsh-theme @@ -0,0 +1,56 @@ +# the idea of this theme is to contain a lot of info in a small string, by +# compressing some parts and colorcoding, which bring useful visual cues, +# while limiting the amount of colors and such to keep it easy on the eyes. +# When a command exited >0, the timestamp will be in red and the exit code +# will be on the right edge. +# The exit code visual cues will only display once. +# (i.e. they will be reset, even if you hit enter a few times on empty command prompts) + +typeset -A host_repr + +# translate hostnames into shortened, colorcoded strings +host_repr=('dieter-ws-a7n8x-arch' "%{$fg_bold[green]%}ws" 'dieter-p4sci-arch' "%{$fg_bold[blue]%}p4") + +# local time, color coded by last return code +time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}" +time_disabled="%{$fg[green]%}%*%{$reset_color%}" +time=$time_enabled + +# user part, color coded by privileges +local user="%(!.%{$fg[blue]%}.%{$fg[blue]%})%n%{$reset_color%}" + +# Hostname part. compressed and colorcoded per host_repr array +# if not found, regular hostname in default color +local host="@${host_repr[$HOST]:-$HOST}%{$reset_color%}" + +# Compacted $PWD +local pwd="%{$fg[blue]%}%c%{$reset_color%}" + +PROMPT='${time} ${user}${host} ${pwd} $(git_prompt_info)' + +# i would prefer 1 icon that shows the "most drastic" deviation from HEAD, +# but lets see how this works out +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}?%{$fg[green]%}%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}" + +# elaborate exitcode on the right when >0 +return_code_enabled="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +return_code_disabled= +return_code=$return_code_enabled + +RPS1='${return_code}' + +function accept-line-or-clear-warning () { + if [[ -z $BUFFER ]]; then + time=$time_disabled + return_code=$return_code_disabled + else + time=$time_enabled + return_code=$return_code_enabled + fi + zle accept-line +} +zle -N accept-line-or-clear-warning +bindkey '^M' accept-line-or-clear-warning diff --git a/oh-my-zsh/themes/dogenpunk.zsh-theme b/oh-my-zsh/themes/dogenpunk.zsh-theme @@ -0,0 +1,79 @@ +# dogenpunk.zsh-theme + +MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" +local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}" + +PROMPT='%{$fg[blue]%}%m%{$reset_color%}%{$fg_bold[white]%} ॐ %{$reset_color%}%{$fg[cyan]%}%~:%{$reset_color%}$(git_time_since_commit)$(git_prompt_info) +%{$fg[red]%}%!%{$reset_color%} $(prompt_char) ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[green]%}git%{$reset_color%}@%{$bg[white]%}%{$fg[black]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +RPROMPT='${return_status}$(git_prompt_status)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" + +function prompt_char() { + git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return + hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return + echo "%{$fg[cyan]%}◯ %{$reset_color%}" +} + +# Colors vary depending on time lapsed. +ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" +ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" + +# Determine the time since last commit. If branch is clean, +# use a neutral color, otherwise colors will vary according to time. +function git_time_since_commit() { + if git rev-parse --git-dir > /dev/null 2>&1; then + # Only proceed if there is actually a commit. + if git log -n 1 > /dev/null 2>&1; then + # Get the last commit. + last_commit=`git log --pretty=format:'%at' -1 2> /dev/null` + now=`date +%s` + seconds_since_last_commit=$((now-last_commit)) + + # Totals + MINUTES=$((seconds_since_last_commit / 60)) + HOURS=$((seconds_since_last_commit/3600)) + + # Sub-hours and sub-minutes + DAYS=$((seconds_since_last_commit / 86400)) + SUB_HOURS=$((HOURS % 24)) + SUB_MINUTES=$((MINUTES % 60)) + + if [[ -n $(git status -s 2> /dev/null) ]]; then + if [ "$MINUTES" -gt 30 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" + elif [ "$MINUTES" -gt 10 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM" + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + fi + + if [ "$HOURS" -gt 24 ]; then + echo "($COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + elif [ "$MINUTES" -gt 60 ]; then + echo "($COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + else + echo "($COLOR${MINUTES}m%{$reset_color%}|" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + echo "($COLOR~|" + fi + fi +} diff --git a/oh-my-zsh/themes/dpoggi.zsh-theme b/oh-my-zsh/themes/dpoggi.zsh-theme @@ -0,0 +1,14 @@ +if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='%{$fg[$NCOLOR]%}%n%{$reset_color%}@%{$fg[cyan]%}%m\ +%{$reset_color%}:%{$fg[magenta]%}%~\ +$(git_prompt_info) \ +%{$fg[red]%}%(!.#.»)%{$reset_color%} ' +PROMPT2='%{$fg[red]%}\ %{$reset_color%}' +RPS1='${return_code}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}(" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}○%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%})%{$reset_color%}" diff --git a/oh-my-zsh/themes/dst.zsh-theme b/oh-my-zsh/themes/dst.zsh-theme @@ -0,0 +1,16 @@ + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +function prompt_char { + if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi +} + +PROMPT='%(?, ,%{$fg[red]%}FAIL%{$reset_color%} +) +%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) +%_ $(prompt_char) ' + +RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' diff --git a/oh-my-zsh/themes/dstufft.zsh-theme b/oh-my-zsh/themes/dstufft.zsh-theme @@ -0,0 +1,19 @@ +function prompt_char { + git branch >/dev/null 2>/dev/null && echo '±' && return + hg root >/dev/null 2>/dev/null && echo 'Hg' && return + echo '○' +} + +function virtualenv_info { + [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' +} + +PROMPT=' +%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) +$(virtualenv_info)$(prompt_char) ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" +ZSH_THEME_GIT_PROMPT_CLEAN="" diff --git a/oh-my-zsh/themes/duellj.zsh-theme b/oh-my-zsh/themes/duellj.zsh-theme @@ -0,0 +1,7 @@ +# user, host, full path, and time/date +# on two lines for easier vgrepping +# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 +PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;34m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}%!%{\e[0;34m%}%B]%b%{\e[0m%} +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]%{\e[0m%}%b ' +RPROMPT='[%*]' +PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' diff --git a/oh-my-zsh/themes/eastwood.zsh-theme b/oh-my-zsh/themes/eastwood.zsh-theme @@ -0,0 +1,23 @@ +# RVM settings +if [[ -s ~/.rvm/scripts/rvm ]] ; then + RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1" +else + if which rbenv &> /dev/null; then + RPS1="%{$fg[yellow]%}rbenv:%{$reset_color%}%{$fg[red]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$reset_color%} $EPS1" + fi +fi + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +# Customized git status, oh-my-zsh currently does not allow render dirty status before branch +git_custom_status() { + local cb=$(git_current_branch) + if [ -n "$cb" ]; then + echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(git_current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" + fi +} + +PROMPT='$(git_custom_status)%{$fg[cyan]%}[%~% ]%{$reset_color%}%B$%b ' diff --git a/oh-my-zsh/themes/edvardm.zsh-theme b/oh-my-zsh/themes/edvardm.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg_bold[white]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/oh-my-zsh/themes/emotty.zsh-theme b/oh-my-zsh/themes/emotty.zsh-theme @@ -0,0 +1,99 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------ +# FILE: emotty.zsh-theme +# DESCRIPTION: A varying emoji based theme +# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net) +# VERSION: 1.0.0 +# DEPENDS: emotty plugin +# RECOMMENDS: Hasklig font +# +# This theme shows a different emoji for each tty at the main prompt. +# +# There are pre-defined different emoji sets to choose from, e.g.: +# emoji, stellar, floral, zodiac, love (see emotty plugin). +# +# To choose a different emotty set than the default (emoji) +# % export emotty_set=nature +# +# For the superuser (root) this theme shows a designated indicator +# and switches the foreground color to red +# (see root_prompt variable, default: skull). +# But you are using sudo (8) instead of designated a root shell, right‽ +# +# When logged in via SSH the main prompt also shows the user- and hostname. +# +# The exit status of the last failed command is displayed in the window title +# along with an indicator (see warn_glyph variable, default: collision symbol). +# To clear it just run: $NULL, true or : +# +# The right prompt shows the current working directory (3 levels up) in cyan. +# +# When in a git repository the main prompt shows the current branch name +# with a branch indicator in yellow +# (see vcs_branch_glyph variable, default: Hasklig branch glyph). +# +# If there are modified files the prompt switches to red and shows an unstaged +# indicator (see vcs_unstaged_glyph variable, default: circled letter M). +# +# If there are staged files the prompt switches to green and shows an staged +# indicator (see vcs_staged_glyph variable, default: high voltage sign). +# +# In a git repository the right prompt shows the repository name in bold and +# prepends the current working directory subpath within the repository. +# +# When git currently performs an action such as merge or rebase, the action is +# displayed in red instead of the branch name and a special action indicator +# is shown (see vcs_action_glyph variable, default: chevron). +# ------------------------------------------------------------------------------ + +user_prompt="$(emotty)" +root_prompt="$emoji[skull]" +warn_prompt="$emoji[collision_symbol]" + +vcs_unstaged_glyph="%{$emoji[circled_latin_capital_letter_m]$emoji2[emoji_style] %2G%}" +vcs_staged_glyph="%{$emoji[high_voltage_sign] %2G%}" +vcs_branch_glyph=$(print -P $'\Ue0a0') # +vcs_action_glyph=$(print -P $'\U276f') # ❯ + +red="$FG[001]" +yellow="$FG[003]" +green="$FG[002]" +cyan="$FG[014]" + +prompt_glyph="%{%(#.${root_prompt}.${user_prompt}) %2G%}" + +# Uncomment the next line if you also like to see the warn_prompt in the prompt on the right. +#last_command_failed="%(?.. %F{red}%1{${warn_prompt} %1G%}%?%f)" + + +setopt promptsubst + +autoload -U add-zsh-hook +autoload -Uz vcs_info + +zstyle ':vcs_info:*' enable git #hg svn cvs +zstyle ':vcs_info:*' get-revision false +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:git:*' unstagedstr "${red}${vcs_unstaged_glyph}" +zstyle ':vcs_info:*' stagedstr "${green}${vcs_staged_glyph}" + +# %(K|F){color} set (back|fore)ground color +# %(k|f) reset (back|fore)ground color +zstyle ':vcs_info:*' max-exports 3 +zstyle ':vcs_info:*' nvcsformats "${prompt_glyph}" '%3~' '' +zstyle ':vcs_info:*' formats "${yellow}%u%c%b${vcs_branch_glyph}%f" '%S|' "$FX[bold]%r$FX[no-bold]" +zstyle ':vcs_info:*' actionformats "${red}%K{white}%a${vcs_action_glyph}%k%f" '%S|' "$FX[bold]%r$FX[no-bold]" + +red_if_root="%(!.%F{red}.)" +sshuser_on_host="${SSH_TTY:+%(!.$red.$yellow)%n@%m$reset_color}" + +PROMPT='${sshuser_on_host}${vcs_info_msg_0_}${red_if_root} ' +RPROMPT='${cyan}${vcs_info_msg_1_##.|}${vcs_info_msg_2_}%f${last_command_failed}' + +emotty_title() { + title "${${?/[^0]*/$warn_prompt $?}/0/${prompt_glyph}}" +} +add-zsh-hook precmd emotty_title +add-zsh-hook precmd vcs_info + +# vim:ft=zsh ts=2 sw=2 sts=2 diff --git a/oh-my-zsh/themes/essembeh.zsh-theme b/oh-my-zsh/themes/essembeh.zsh-theme @@ -0,0 +1,30 @@ +# Theme with full path names and hostname +# Handy if you work on different servers all the time; + +local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})" + +function my_git_prompt_info() { + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + GIT_STATUS=$(git_prompt_status) + [[ -n $GIT_STATUS ]] && GIT_STATUS=" $GIT_STATUS" + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$GIT_STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX" +} + +# Colored prompt +ZSH_THEME_COLOR_USER="green" +ZSH_THEME_COLOR_HOST="green" +ZSH_THEME_COLOR_PWD="yellow" +test -n "$SSH_CONNECTION" && ZSH_THEME_COLOR_USER="red" && ZSH_THEME_COLOR_HOST="red" +test `id -u` = 0 && ZSH_THEME_COLOR_USER="magenta" && ZSH_THEME_COLOR_HOST="magenta" +PROMPT='%{$fg_bold[$ZSH_THEME_COLOR_USER]%}%n@%{$fg_bold[$ZSH_THEME_COLOR_HOST]%}%M%{$reset_color%}:%{$fg_bold[$ZSH_THEME_COLOR_PWD]%}%~%{$reset_color%} $(my_git_prompt_info)%(!.#.$) ' +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%%" +ZSH_THEME_GIT_PROMPT_ADDED="+" +ZSH_THEME_GIT_PROMPT_MODIFIED="*" +ZSH_THEME_GIT_PROMPT_RENAMED="~" +ZSH_THEME_GIT_PROMPT_DELETED="!" +ZSH_THEME_GIT_PROMPT_UNMERGED="?" + diff --git a/oh-my-zsh/themes/evan.zsh-theme b/oh-my-zsh/themes/evan.zsh-theme @@ -0,0 +1,2 @@ +# Evan describes this sexy prompt as: "a skinny, topless prompt" +PROMPT='%m :: %2~ %B»%b '+ \ No newline at end of file diff --git a/oh-my-zsh/themes/example.zsh-theme b/oh-my-zsh/themes/example.zsh-theme @@ -0,0 +1,5 @@ +# Found on the ZshWiki +# http://zshwiki.org/home/config/prompt +# + +PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "+ \ No newline at end of file diff --git a/oh-my-zsh/themes/fino-time.zsh-theme b/oh-my-zsh/themes/fino-time.zsh-theme @@ -0,0 +1,39 @@ +# fino-time.zsh-theme + +# Use with a dark background and 256-color terminal! +# Meant for people with RVM and git. Tested only on OS X 10.7. + +# You can set your computer name in the ~/.box-name file if you want. + +# Borrowing shamelessly from these oh-my-zsh themes: +# bira +# robbyrussell +# +# Also borrowing from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/ + +function virtualenv_info { + [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' +} + +function prompt_char { + git branch >/dev/null 2>/dev/null && echo '⠠⠵' && return + echo '○' +} + +function box_name { + [ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST} +} + + +local rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}' +local current_dir='${PWD/#$HOME/~}' +local git_info='$(git_prompt_info)' + + +PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}using%{$FG[243]%} ${rvm_ruby} %D - %* +╰─$(virtualenv_info)$(prompt_char) " + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$FG[202]%}✘✘✘" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$FG[040]%}✔" diff --git a/oh-my-zsh/themes/fino.zsh-theme b/oh-my-zsh/themes/fino.zsh-theme @@ -0,0 +1,43 @@ +# fino.zsh-theme + +# Use with a dark background and 256-color terminal! +# Meant for people with rbenv and git. Tested only on OS X 10.7. + +# You can set your computer name in the ~/.box-name file if you want. + +# Borrowing shamelessly from these oh-my-zsh themes: +# bira +# robbyrussell +# +# Also borrowing from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/ + +function prompt_char { + git branch >/dev/null 2>/dev/null && echo "±" && return + echo '○' +} + +function box_name { + [ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST} +} + +local ruby_env='' +if which rvm-prompt &> /dev/null; then + ruby_env=' ‹$(rvm-prompt i v g)›%{$reset_color%}' +else + if which rbenv &> /dev/null; then + ruby_env=' ‹$(rbenv version-name)›%{$reset_color%}' + fi +fi + +local current_dir='${PWD/#$HOME/~}' +local git_info='$(git_prompt_info)' +local prompt_char='$(prompt_char)' + + +PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}using%{$FG[243]%}${ruby_env} +╰─${prompt_char}%{$reset_color%} " + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$FG[202]%}✘✘✘" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$FG[040]%}✔" diff --git a/oh-my-zsh/themes/fishy.zsh-theme b/oh-my-zsh/themes/fishy.zsh-theme @@ -0,0 +1,29 @@ +# ZSH Theme emulating the Fish shell's default prompt. + +_fishy_collapsed_wd() { + echo $(pwd | perl -pe ' + BEGIN { + binmode STDIN, ":encoding(UTF-8)"; + binmode STDOUT, ":encoding(UTF-8)"; + }; s|^$ENV{HOME}|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g +') +} + +local user_color='green'; [ $UID -eq 0 ] && user_color='red' +PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) ' +PROMPT2='%{$fg[red]%}\ %{$reset_color%}' + +local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}" +RPROMPT='${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX=" " +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg_bold[green]%}+" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg_bold[blue]%}!" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg_bold[red]%}-" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg_bold[magenta]%}>" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[yellow]%}#" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[cyan]%}?" diff --git a/oh-my-zsh/themes/flazz.zsh-theme b/oh-my-zsh/themes/flazz.zsh-theme @@ -0,0 +1,19 @@ +if [ "$USER" = "root" ] +then CARETCOLOR="red" +else CARETCOLOR="blue" +fi + +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='%m%{${fg_bold[magenta]}%} :: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}%#%{${reset_color}%} ' + +RPS1='$(vi_mode_prompt_info) ${return_code}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[cyan]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" + +MODE_INDICATOR="%{$fg_bold[magenta]%}<%{$reset_color%}%{$fg[magenta]%}<<%{$reset_color%}" + +# TODO use 265 colors +#MODE_INDICATOR="$FX[bold]$FG[020]<$FX[no_bold]%{$fg[blue]%}<<%{$reset_color%}" +# TODO use two lines if git diff --git a/oh-my-zsh/themes/fletcherm.zsh-theme b/oh-my-zsh/themes/fletcherm.zsh-theme @@ -0,0 +1,12 @@ +# Copied from old version of tonotdo's theme. LSCOLORS modified. +PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[magenta]%}•%{$fg_no_bold[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' +RPROMPT='[%*]' + +# git theming +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[blue]%})" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[yellow]%}⚡%{$fg_bold[blue]%})" + +export LSCOLORS="exfxcxdxbxegedabagacad" +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' diff --git a/oh-my-zsh/themes/fox.zsh-theme b/oh-my-zsh/themes/fox.zsh-theme @@ -0,0 +1,9 @@ +# fox.zsh-theme + +PROMPT='%{$fg[cyan]%}┌[%{$fg_bold[white]%}%n%{$reset_color%}%{$fg[cyan]%}☮%{$fg_bold[white]%}%M%{$reset_color%}%{$fg[cyan]%}]%{$fg[white]%}-%{$fg[cyan]%}(%{$fg_bold[white]%}%~%{$reset_color%}%{$fg[cyan]%})$(git_prompt_info) +└> % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="-[%{$reset_color%}%{$fg[white]%}git://%{$fg_bold[white]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}%{$fg[cyan]%}]-" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$reset_color%}" diff --git a/oh-my-zsh/themes/frisk.zsh-theme b/oh-my-zsh/themes/frisk.zsh-theme @@ -0,0 +1,12 @@ +PROMPT=$' +%{$fg[blue]%}%/%{$reset_color%} $(git_prompt_info)$(bzr_prompt_info)%{$fg[white]%}[%n@%m]%{$reset_color%} %{$fg[white]%}[%T]%{$reset_color%} +%{$fg_bold[black]%}>%{$reset_color%} ' + +PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}" + +GIT_CB="git::" +ZSH_THEME_SCM_PROMPT_PREFIX="%{$fg[green]%}[" +ZSH_THEME_GIT_PROMPT_PREFIX=$ZSH_THEME_SCM_PROMPT_PREFIX$GIT_CB +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" diff --git a/oh-my-zsh/themes/frontcube.zsh-theme b/oh-my-zsh/themes/frontcube.zsh-theme @@ -0,0 +1,12 @@ +local rvm="%{$fg[green]%}[$(rvm-prompt i v g)]%{$reset_color%}" + +PROMPT=' +%{$fg_bold[gray]%}%~%{$fg_bold[blue]%}%{$fg_bold[blue]%} % %{$reset_color%} +%{$fg[green]%}➞ %{$reset_color%' + +RPROMPT='$(git_prompt_info) ${rvm}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}[git:" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}] %{$fg[red]%}✖ %{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}] %{$fg[green]%}✔%{$reset_color%}" diff --git a/oh-my-zsh/themes/funky.zsh-theme b/oh-my-zsh/themes/funky.zsh-theme @@ -0,0 +1,14 @@ +# Taken from Tassilo's Blog +# http://tsdh.wordpress.com/2007/12/06/my-funky-zsh-prompt/ + +local blue_op="%{$fg[blue]%}[%{$reset_color%}" +local blue_cp="%{$fg[blue]%}]%{$reset_color%}" +local path_p="${blue_op}%~${blue_cp}" +local user_host="${blue_op}%n@%m${blue_cp}" +local ret_status="${blue_op}%?${blue_cp}" +local hist_no="${blue_op}%h${blue_cp}" +local smiley="%(?,%{$fg[green]%}:%)%{$reset_color%},%{$fg[red]%}:(%{$reset_color%})" +PROMPT="╭─${path_p}─${user_host}─${ret_status}─${hist_no} +╰─${blue_op}${smiley}${blue_cp} %# " +local cur_cmd="${blue_op}%_${blue_cp}" +PROMPT2="${cur_cmd}> "+ \ No newline at end of file diff --git a/oh-my-zsh/themes/fwalch.zsh-theme b/oh-my-zsh/themes/fwalch.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/oh-my-zsh/themes/gallifrey.zsh-theme b/oh-my-zsh/themes/gallifrey.zsh-theme @@ -0,0 +1,8 @@ +# ZSH Theme - Preview: https://flic.kr/p/ZFvivf +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='%{$fg[green]%}%m%{$reset_color%} %2~ $(git_prompt_info)%{$reset_color%}%B»%b ' +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" diff --git a/oh-my-zsh/themes/gallois.zsh-theme b/oh-my-zsh/themes/gallois.zsh-theme @@ -0,0 +1,23 @@ +# Depends on the git plugin for work_in_progress() + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +#Customized git status, oh-my-zsh currently does not allow render dirty status before branch +git_custom_status() { + local cb=$(git_current_branch) + if [ -n "$cb" ]; then + echo "$(parse_git_dirty)%{$fg_bold[yellow]%}$(work_in_progress)%{$reset_color%}$ZSH_THEME_GIT_PROMPT_PREFIX$(git_current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" + fi +} + +# RVM component of prompt +ZSH_THEME_RVM_PROMPT_PREFIX="%{$fg[red]%}[" +ZSH_THEME_RVM_PROMPT_SUFFIX="]%{$reset_color%}" + +# Combine it all into a final right-side prompt +RPS1='$(git_custom_status)$(ruby_prompt_info) $EPS1' + +PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b ' diff --git a/oh-my-zsh/themes/garyblessington.zsh-theme b/oh-my-zsh/themes/garyblessington.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}: ' + +ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[blue]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[red]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/oh-my-zsh/themes/gentoo.zsh-theme b/oh-my-zsh/themes/gentoo.zsh-theme @@ -0,0 +1,8 @@ +function prompt_char { + if [ $UID -eq 0 ]; then echo "#"; else echo $; fi +} + +PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%_$(prompt_char)%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX=") " diff --git a/oh-my-zsh/themes/geoffgarside.zsh-theme b/oh-my-zsh/themes/geoffgarside.zsh-theme @@ -0,0 +1,5 @@ +# PROMPT="[%*] %n:%c $(git_prompt_info)%(!.#.$) " +PROMPT='[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$(git_prompt_info) %(!.#.$) ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}git:(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" diff --git a/oh-my-zsh/themes/gianu.zsh-theme b/oh-my-zsh/themes/gianu.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='[%{$fg_bold[white]%}%n%{$reset_color%}@%{$fg_bold[red]%}%m%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)%{$reset_color%}]$ ' + +ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg_bold[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX=")" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}" diff --git a/oh-my-zsh/themes/gnzh.zsh-theme b/oh-my-zsh/themes/gnzh.zsh-theme @@ -0,0 +1,50 @@ +# ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png +# Based on bira theme + +setopt prompt_subst + +() { + +local PR_USER PR_USER_OP PR_PROMPT PR_HOST + +# Check the UID +if [[ $UID -ne 0 ]]; then # normal user + PR_USER='%F{green}%n%f' + PR_USER_OP='%F{green}%#%f' + PR_PROMPT='%f➤ %f' +else # root + PR_USER='%F{red}%n%f' + PR_USER_OP='%F{red}%#%f' + PR_PROMPT='%F{red}➤ %f' +fi + +# Check if we are on SSH or not +if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then + PR_HOST='%F{red}%M%f' # SSH +else + PR_HOST='%F{green}%M%f' # no SSH +fi + + +local return_code="%(?..%F{red}%? ↵%f)" + +local user_host="${PR_USER}%F{cyan}@${PR_HOST}" +local current_dir="%B%F{blue}%~%f%b" +local rvm_ruby='' +if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect user-local rvm installation + rvm_ruby='%F{red}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%f' +elif which rvm-prompt &> /dev/null; then # detect system-wide rvm installation + rvm_ruby='%F{red}‹$(rvm-prompt i v g s)›%f' +elif which rbenv &> /dev/null; then # detect Simple Ruby Version Management + rvm_ruby='%F{red}‹$(rbenv version | sed -e "s/ (set.*$//")›%f' +fi +local git_branch='$(git_prompt_info)' + +PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} +╰─$PR_PROMPT " +RPROMPT="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %f" + +} diff --git a/oh-my-zsh/themes/gozilla.zsh-theme b/oh-my-zsh/themes/gozilla.zsh-theme @@ -0,0 +1,15 @@ +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +RPROMPT='$(git_prompt_status)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ✂" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ✱" diff --git a/oh-my-zsh/themes/half-life.zsh-theme b/oh-my-zsh/themes/half-life.zsh-theme @@ -0,0 +1,96 @@ +# prompt style and colors based on Steve Losh's Prose theme: +# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme +# +# vcs_info modifications from Bart Trojanowski's zsh prompt: +# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt +# +# git untracked files modification from Brian Carper: +# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt + +function virtualenv_info { + [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' +} +PR_GIT_UPDATE=1 + +setopt prompt_subst + +autoload -U add-zsh-hook +autoload -Uz vcs_info + +#use extended color palette if available +if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then + turquoise="%F{81}" + orange="%F{166}" + purple="%F{135}" + hotpink="%F{161}" + limegreen="%F{118}" +else + turquoise="$fg[cyan]" + orange="$fg[yellow]" + purple="$fg[magenta]" + hotpink="$fg[red]" + limegreen="$fg[green]" +fi + +# enable VCS systems you use +zstyle ':vcs_info:*' enable git svn + +# check-for-changes can be really slow. +# you should disable it, if you work with large repositories +zstyle ':vcs_info:*:prompt:*' check-for-changes true + +# set formats +# %b - branchname +# %u - unstagedstr (see below) +# %c - stagedstr (see below) +# %a - action (e.g. rebase-i) +# %R - repository path +# %S - path in the repository +PR_RST="%{${reset_color}%}" +FMT_BRANCH=" on %{$turquoise%}%b%u%c${PR_RST}" +FMT_ACTION=" performing a %{$limegreen%}%a${PR_RST}" +FMT_UNSTAGED="%{$orange%} ●" +FMT_STAGED="%{$limegreen%} ●" + +zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}" +zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}" +zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}" +zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" +zstyle ':vcs_info:*:prompt:*' nvcsformats "" + + +function steeef_preexec { + case "$(history $HISTCMD)" in + *git*) + PR_GIT_UPDATE=1 + ;; + *svn*) + PR_GIT_UPDATE=1 + ;; + esac +} +add-zsh-hook preexec steeef_preexec + +function steeef_chpwd { + PR_GIT_UPDATE=1 +} +add-zsh-hook chpwd steeef_chpwd + +function steeef_precmd { + if [[ -n "$PR_GIT_UPDATE" ]] ; then + # check for untracked files or updated submodules, since vcs_info doesn't + if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then + PR_GIT_UPDATE=1 + FMT_BRANCH="${PM_RST} on %{$turquoise%}%b%u%c%{$hotpink%} ●${PR_RST}" + else + FMT_BRANCH="${PM_RST} on %{$turquoise%}%b%u%c${PR_RST}" + fi + zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" + + vcs_info 'prompt' + PR_GIT_UPDATE= + fi +} +add-zsh-hook precmd steeef_precmd + +PROMPT=$'%{$purple%}%n%{$reset_color%} in %{$limegreen%}%~%{$reset_color%}$(ruby_prompt_info " with%{$fg[red]%} " v g "%{$reset_color%}")$vcs_info_msg_0_%{$orange%} λ%{$reset_color%} ' diff --git a/oh-my-zsh/themes/humza.zsh-theme b/oh-my-zsh/themes/humza.zsh-theme @@ -0,0 +1,26 @@ +# ZSH THEME Preview: https://skitch.com/huyy/rk979/humza.zshtheme + +let TotalBytes=0 +for Bytes in $(ls -l | grep "^-" | awk '{ print $5 }') +do + let TotalBytes=$TotalBytes+$Bytes +done + # should it say b, kb, Mb, or Gb +if [ $TotalBytes -lt 1024 ]; then + TotalSize=$(echo -e "scale=3 \n$TotalBytes \nquit" | bc) + suffix="b" +elif [ $TotalBytes -lt 1048576 ]; then + TotalSize=$(echo -e "scale=3 \n$TotalBytes/1024 \nquit" | bc) + suffix="kb" +elif [ $TotalBytes -lt 1073741824 ]; then + TotalSize=$(echo -e "scale=3 \n$TotalBytes/1048576 \nquit" | bc) + suffix="Mb" +else + TotalSize=$(echo -e "scale=3 \n$TotalBytes/1073741824 \nquit" | bc) + suffix="Gb" +fi + +PROMPT='%{$reset_color%}%n %{$fg[green]%}{%{$reset_color%}%~%{$fg[green]%}}%{$reset_color%}$(git_prompt_info) greetings, earthling %{$fg[green]%}[%{$reset_color%}%{$TotalSize%}%{$suffix%}%{$fg[green]%}]%{$fg[red]%}$%{$reset_color%} ☞ ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}±(" +ZSH_THEME_GIT_PROMPT_SUFFIX=");%{$reset_color%}" diff --git a/oh-my-zsh/themes/imajes.zsh-theme b/oh-my-zsh/themes/imajes.zsh-theme @@ -0,0 +1,5 @@ +# Found on the ZshWiki +# http://zshwiki.org/home/config/prompt +# + +PROMPT="%{$fg[red]%}%%%{$reset_color%} "+ \ No newline at end of file diff --git a/oh-my-zsh/themes/intheloop.zsh-theme b/oh-my-zsh/themes/intheloop.zsh-theme @@ -0,0 +1,23 @@ +# A multiline prompt with username, hostname, full path, return status, git branch, git dirty status, git remote status + +local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}" + +local host_color="green" +if [ -n "$SSH_CLIENT" ]; then + local host_color="red" +fi + +PROMPT=' +%{$fg_bold[grey]%}[%{$reset_color%}%{$fg_bold[${host_color}]%}%n@%m%{$reset_color%}%{$fg_bold[grey]%}]%{$reset_color%} %{$fg_bold[blue]%}%10c%{$reset_color%} $(git_prompt_info) $(git_remote_status) +%{$fg_bold[cyan]%}❯%{$reset_color%} ' + + +RPROMPT='${return_status}%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[grey]%}(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[grey]%}) %{$fg[yellow]%}⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[grey]%})" +ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="%{$fg_bold[magenta]%}↓%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE="%{$fg_bold[magenta]%}↑%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="%{$fg_bold[magenta]%}↕%{$reset_color%}" diff --git a/oh-my-zsh/themes/itchy.zsh-theme b/oh-my-zsh/themes/itchy.zsh-theme @@ -0,0 +1,18 @@ +# Inspired by http://peepcode.com/blog/2012/my-command-line-prompt + +local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})" + +local user="%{$fg[cyan]%}%n%{$reset_color%}" +local host="%{$fg[cyan]%}@%m%{$reset_color%}" +local pwd="%{$fg[yellow]%}%~%{$reset_color%}" + +PROMPT='${user}${host} ${pwd} +${smiley} ' + +RPROMPT='$(rvm-prompt || rbenv version) %{$fg[white]%}$(git_prompt_info)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ✔%{$reset_color%}" + diff --git a/oh-my-zsh/themes/jaischeema.zsh-theme b/oh-my-zsh/themes/jaischeema.zsh-theme @@ -0,0 +1,16 @@ +# jaischeema.zsh-theme + +PROMPT='%{$fg_bold[magenta]%}%m%{$reset_color%} at %{$fg_bold[green]%}%~%{$reset_color%} %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}%{$fg[red]%}❯%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="±(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) " + +if which rbenv &> /dev/null; then + RPROMPT='%{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%}' +else + if which rvm-prompt &> /dev/null; then + RPROMPT='%{$fg[red]%}$(rvm-prompt)%{$reset_color%}' + fi +fi diff --git a/oh-my-zsh/themes/jbergantine.zsh-theme b/oh-my-zsh/themes/jbergantine.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[white]%}$(git_prompt_info)%{$fg_bold[white]%} % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[white]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[white]%})" diff --git a/oh-my-zsh/themes/jispwoso.zsh-theme b/oh-my-zsh/themes/jispwoso.zsh-theme @@ -0,0 +1,10 @@ +local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)" +PROMPT=$'%{$fg[green]%}%n@%m: %{$reset_color%}%{$fg[blue]%}%/ %{$reset_color%}%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%} +${ret_status} %{$reset_color%} ' + +PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/oh-my-zsh/themes/jnrowe.zsh-theme b/oh-my-zsh/themes/jnrowe.zsh-theme @@ -0,0 +1,38 @@ +autoload -U add-zsh-hook +autoload -Uz vcs_info + +zstyle ':vcs_info:*' actionformats \ + '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' +zstyle ':vcs_info:*' formats '%F{2}%s%F{7}:%F{2}(%F{1}%b%F{2})%f ' +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' +zstyle ':vcs_info:*' enable git + +add-zsh-hook precmd prompt_vcs + +prompt_vcs () { + vcs_info + + if [ "${vcs_info_msg_0_}" = "" ]; then + dir_status="%F{2}→%f" + elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then + dir_status="%F{1}▶%f" + elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then + dir_status="%F{3}▶%f" + else + dir_status="%F{2}▶%f" + fi +} + +function { + if [[ -n "$SSH_CLIENT" ]]; then + PROMPT_HOST=" ($HOST)" + else + PROMPT_HOST='' + fi +} + +local ret_status="%(?:%{$fg_bold[green]%}Ξ:%{$fg_bold[red]%}%S↑%s%?)" + +PROMPT='${ret_status}%{$fg[blue]%}${PROMPT_HOST}%{$fg_bold[green]%}%p %{$fg_bold[yellow]%}%2~ ${vcs_info_msg_0_}${dir_status}%{$reset_color%} ' + +# vim: set ft=zsh ts=4 sw=4 et: diff --git a/oh-my-zsh/themes/jonathan.zsh-theme b/oh-my-zsh/themes/jonathan.zsh-theme @@ -0,0 +1,153 @@ +functions rbenv_prompt_info >& /dev/null || rbenv_prompt_info(){} + +function theme_precmd { + local TERMWIDTH + (( TERMWIDTH = ${COLUMNS} - 1 )) + + + ### + # Truncate the path if it's too long. + + PR_FILLBAR="" + PR_PWDLEN="" + + local promptsize=${#${(%):---(%n@%m:%l)---()--}} + local rubyprompt=`rvm_prompt_info || rbenv_prompt_info` + local rubypromptsize=${#${rubyprompt}} + local pwdsize=${#${(%):-%~}} + + if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then + ((PR_PWDLEN=$TERMWIDTH - $promptsize)) + else + PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $rubypromptsize + $pwdsize)))..${PR_HBAR}.)}" + fi + +} + + +setopt extended_glob +theme_preexec () { + if [[ "$TERM" == "screen" ]]; then + local CMD=${1[(wr)^(*=*|sudo|-*)]} + echo -n "\ek$CMD\e\\" + fi +} + + +setprompt () { + ### + # Need this so the prompt will work. + + setopt prompt_subst + + + ### + # See if we can use colors. + + autoload zsh/terminfo + for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do + eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' + eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' + (( count = $count + 1 )) + done + PR_NO_COLOUR="%{$terminfo[sgr0]%}" + + ### + # Modify Git prompt + ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + ZSH_THEME_GIT_PROMPT_DIRTY="" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" + ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" + ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" + ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" + ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" + ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" + + ### + # See if we can use extended characters to look nicer. + # UTF-8 Fixed + + if [[ $(locale charmap) == "UTF-8" ]]; then + PR_SET_CHARSET="" + PR_SHIFT_IN="" + PR_SHIFT_OUT="" + PR_HBAR="─" + PR_ULCORNER="┌" + PR_LLCORNER="└" + PR_LRCORNER="┘" + PR_URCORNER="┐" + else + typeset -A altchar + set -A altchar ${(s..)terminfo[acsc]} + # Some stuff to help us draw nice lines + PR_SET_CHARSET="%{$terminfo[enacs]%}" + PR_SHIFT_IN="%{$terminfo[smacs]%}" + PR_SHIFT_OUT="%{$terminfo[rmacs]%}" + PR_HBAR='$PR_SHIFT_IN${altchar[q]:--}$PR_SHIFT_OUT' + PR_ULCORNER='$PR_SHIFT_IN${altchar[l]:--}$PR_SHIFT_OUT' + PR_LLCORNER='$PR_SHIFT_IN${altchar[m]:--}$PR_SHIFT_OUT' + PR_LRCORNER='$PR_SHIFT_IN${altchar[j]:--}$PR_SHIFT_OUT' + PR_URCORNER='$PR_SHIFT_IN${altchar[k]:--}$PR_SHIFT_OUT' + fi + + + ### + # Decide if we need to set titlebar text. + + case $TERM in + xterm*) + PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}' + ;; + screen) + PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' + ;; + *) + PR_TITLEBAR='' + ;; + esac + + + ### + # Decide whether to set a screen title + if [[ "$TERM" == "screen" ]]; then + PR_STITLE=$'%{\ekzsh\e\\%}' + else + PR_STITLE='' + fi + + + ### + # Finally, the prompt. + + PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ +$PR_CYAN$PR_ULCORNER$PR_HBAR$PR_GREY(\ +$PR_GREEN%$PR_PWDLEN<...<%~%<<\ +$PR_GREY)`rvm_prompt_info || rbenv_prompt_info`$PR_CYAN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_GREY(\ +$PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\ +$PR_GREY)$PR_CYAN$PR_HBAR$PR_URCORNER\ + +$PR_CYAN$PR_LLCORNER$PR_BLUE$PR_HBAR(\ +$PR_YELLOW%D{%H:%M:%S}\ +$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_HBAR\ +$PR_HBAR\ +>$PR_NO_COLOUR ' + + # display exitcode on the right when >0 + return_code="%(?..%{$fg[red]%}%? ↵ %{$reset_color%})" + RPROMPT=' $return_code$PR_CYAN$PR_HBAR$PR_BLUE$PR_HBAR\ +($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_NO_COLOUR' + + PS2='$PR_CYAN$PR_HBAR\ +$PR_BLUE$PR_HBAR(\ +$PR_LIGHT_GREEN%_$PR_BLUE)$PR_HBAR\ +$PR_CYAN$PR_HBAR$PR_NO_COLOUR ' +} + +setprompt + +autoload -U add-zsh-hook +add-zsh-hook precmd theme_precmd +add-zsh-hook preexec theme_preexec diff --git a/oh-my-zsh/themes/josh.zsh-theme b/oh-my-zsh/themes/josh.zsh-theme @@ -0,0 +1,43 @@ +grey='\e[0;90m' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$grey%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$grey%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$grey%})" + +function josh_prompt { + (( spare_width = ${COLUMNS} )) + prompt=" " + + branch=$(git_current_branch) + ruby_version=$(rvm_prompt_info || rbenv_prompt_info) + path_size=${#PWD} + branch_size=${#branch} + ruby_size=${#ruby_version} + user_machine_size=${#${(%):-%n@%m-}} + + if [[ ${#branch} -eq 0 ]] + then (( ruby_size = ruby_size + 1 )) + else + (( branch_size = branch_size + 4 )) + if [[ -n $(git status -s 2> /dev/null) ]]; then + (( branch_size = branch_size + 2 )) + fi + fi + + (( spare_width = ${spare_width} - (${user_machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) )) + + while [ ${#prompt} -lt $spare_width ]; do + prompt=" $prompt" + done + + prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(git_current_branch)" + + echo $prompt +} + +setopt prompt_subst + +PROMPT=' +%n@%m $(josh_prompt) +%(?,%{%F{green}%},%{%F{red}%})⚡%{$reset_color%} ' diff --git a/oh-my-zsh/themes/jreese.zsh-theme b/oh-my-zsh/themes/jreese.zsh-theme @@ -0,0 +1,16 @@ +# ZSH Theme - Preview: http://dl.dropbox.com/u/1552408/Screenshots/2010-04-08-oh-my-zsh.png + +if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='%{$fg[$NCOLOR]%}%n%{$fg[green]%}@%m%{$reset_color%} %~ \ +$(git_prompt_info)\ +%{$fg[red]%}%(!.#.»)%{$reset_color%} ' +PROMPT2='%{$fg[red]%}\ %{$reset_color%}' +RPS1='${return_code}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}±%{$fg[yellow]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="⚡" + diff --git a/oh-my-zsh/themes/jtriley.zsh-theme b/oh-my-zsh/themes/jtriley.zsh-theme @@ -0,0 +1,8 @@ +#PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +PROMPT="%{$fg_bold[cyan]%}%T%{$fg_bold[green]%} %{$fg_bold[white]%}%n%{$fg[magenta]%}@%{$fg_bold[white]%}%m %{$fg_bold[green]%}%d +%{$fg_bold[yellow]%}%% %{$reset_color%}" + +#ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +#ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +#ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +#ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/oh-my-zsh/themes/juanghurtado.zsh-theme b/oh-my-zsh/themes/juanghurtado.zsh-theme @@ -0,0 +1,41 @@ +# Color shortcuts +RED=$fg[red] +YELLOW=$fg[yellow] +GREEN=$fg[green] +WHITE=$fg[white] +BLUE=$fg[blue] +RED_BOLD=$fg_bold[red] +YELLOW_BOLD=$fg_bold[yellow] +GREEN_BOLD=$fg_bold[green] +WHITE_BOLD=$fg_bold[white] +BLUE_BOLD=$fg_bold[blue] +RESET_COLOR=$reset_color + +# Format for git_prompt_info() +ZSH_THEME_GIT_PROMPT_PREFIX="" +ZSH_THEME_GIT_PROMPT_SUFFIX="" + +# Format for parse_git_dirty() +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RED%}(*)" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +# Format for git_prompt_status() +ZSH_THEME_GIT_PROMPT_UNMERGED=" %{$RED%}unmerged" +ZSH_THEME_GIT_PROMPT_DELETED=" %{$RED%}deleted" +ZSH_THEME_GIT_PROMPT_RENAMED=" %{$YELLOW%}renamed" +ZSH_THEME_GIT_PROMPT_MODIFIED=" %{$YELLOW%}modified" +ZSH_THEME_GIT_PROMPT_ADDED=" %{$GREEN%}added" +ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$WHITE%}untracked" + +# Format for git_prompt_ahead() +ZSH_THEME_GIT_PROMPT_AHEAD=" %{$RED%}(!)" + +# Format for git_prompt_long_sha() and git_prompt_short_sha() +ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$WHITE%}[%{$YELLOW%}" +ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$WHITE%}]" + +# Prompt format +PROMPT=' +%{$GREEN_BOLD%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$(parse_git_dirty)$(git_prompt_ahead)%{$RESET_COLOR%} +%{$BLUE%}>%{$RESET_COLOR%} ' +RPROMPT='%{$GREEN_BOLD%}$(git_current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}' diff --git a/oh-my-zsh/themes/junkfood.zsh-theme b/oh-my-zsh/themes/junkfood.zsh-theme @@ -0,0 +1,30 @@ +# Totally ripped off Dallas theme + +# Grab the current date (%W) and time (%t): +JUNKFOOD_TIME_="%{$fg_bold[red]%}#%{$fg_bold[white]%}( %{$fg_bold[yellow]%}%W%{$reset_color%}@%{$fg_bold[white]%}%t )( %{$reset_color%}" + +# Grab the current machine name +JUNKFOOD_MACHINE_="%{$fg_bold[blue]%}%m%{$fg[white]%} ):%{$reset_color%}" + +# Grab the current username +JUNKFOOD_CURRENT_USER_="%{$fg_bold[green]%}%n%{$reset_color%}" + +# Grab the current filepath, use shortcuts: ~/Desktop +# Append the current git branch, if in a git repository: ~aw@master +JUNKFOOD_LOCA_="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}" + +# For the git prompt, use a white @ and blue text for the branch name +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}@%{$fg_bold[white]%}" + +# Close it all off by resetting the color and styles. +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + +# Do nothing if the branch is clean (no changes). +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✔" + +# Add 3 cyan ✗s if this branch is diiirrrty! Dirty branch! +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✗✗✗" + +# Put it all together! +PROMPT="$JUNKFOOD_TIME_$JUNKFOOD_CURRENT_USER_@$JUNKFOOD_MACHINE_$JUNKFOOD_LOCA_ + " diff --git a/oh-my-zsh/themes/kafeitu.zsh-theme b/oh-my-zsh/themes/kafeitu.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%n%{$fg[cyan]%}@%{$fg_bold[green]%}%m %{$fg_bold[green]%}%p %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/oh-my-zsh/themes/kardan.zsh-theme b/oh-my-zsh/themes/kardan.zsh-theme @@ -0,0 +1,12 @@ +# Simple theme based on my old zsh settings. + +function get_host { + echo '@'$HOST +} + +PROMPT='> ' +RPROMPT='%~$(git_prompt_info)$(get_host)' + +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")"+ \ No newline at end of file diff --git a/oh-my-zsh/themes/kennethreitz.zsh-theme b/oh-my-zsh/themes/kennethreitz.zsh-theme @@ -0,0 +1,15 @@ +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='$(virtualenv_prompt_info)%{[03m%}%{$fg[green]%}%c \ +$(git_prompt_info)\ +\ +%{$fg[red]%}%(!.#.»)%{$reset_color%} ' +PROMPT2='%{$fg[red]%}\ %{$reset_color%}' +RPS1='%{$fg[blue]%}%~%{$reset_color%} ${return_code} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[yellow]%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$fg[yellow]%}" +ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$reset_color%}%{[03m%}%{$fg[blue]%}" +ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="!%{$reset_color%} "+ \ No newline at end of file diff --git a/oh-my-zsh/themes/kiwi.zsh-theme b/oh-my-zsh/themes/kiwi.zsh-theme @@ -0,0 +1,12 @@ +# +# Kiwi ZSH Theme +# + +PROMPT='%{$fg_bold[green]%}┌[%{$fg_bold[cyan]%}kiwish-4.2%{$fg_bold[green]%}]-(%{$fg_bold[white]%}%2~%{$fg_bold[green]%})-$(git_prompt_info)$(svn_prompt_info)$(battery_pct_prompt) +└> % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="[%{$reset_color%}%{$fg[white]%}git:%{$fg_bold[white]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg_bold[green]%}]-" + +ZSH_THEME_SVN_PROMPT_PREFIX="[%{$reset_color%}%{$fg[white]%}svn:%{$fg_bold[white]%}/" +ZSH_THEME_SVN_PROMPT_SUFFIX="%{$fg_bold[green]%}]-" diff --git a/oh-my-zsh/themes/kolo.zsh-theme b/oh-my-zsh/themes/kolo.zsh-theme @@ -0,0 +1,22 @@ +autoload -Uz vcs_info + +zstyle ':vcs_info:*' stagedstr '%F{green}●' +zstyle ':vcs_info:*' unstagedstr '%F{yellow}●' +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r' +zstyle ':vcs_info:*' enable git svn +theme_precmd () { + if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] { + zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]' + } else { + zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{red}●%F{green}]' + } + + vcs_info +} + +setopt prompt_subst +PROMPT='%B%F{magenta}%c%B%F{green}${vcs_info_msg_0_}%B%F{magenta} %{$reset_color%}%% ' + +autoload -U add-zsh-hook +add-zsh-hook precmd theme_precmd diff --git a/oh-my-zsh/themes/kphoen.zsh-theme b/oh-my-zsh/themes/kphoen.zsh-theme @@ -0,0 +1,43 @@ +# kphoen.zsh-theme + +if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then + PROMPT='[%{$fg[red]%}%n%{$reset_color%}@%{$fg[magenta]%}%m%{$reset_color%}:%{$fg[blue]%}%~%{$reset_color%}$(git_prompt_info)] +%# ' + + ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + ZSH_THEME_GIT_PROMPT_DIRTY="" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + # display exitcode on the right when >0 + return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + + RPROMPT='${return_code}$(git_prompt_status)%{$reset_color%}' + + ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" + ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" + ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" + ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" + ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" + ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" +else + PROMPT='[%n@%m:%~$(git_prompt_info)] +%# ' + + ZSH_THEME_GIT_PROMPT_PREFIX=" on" + ZSH_THEME_GIT_PROMPT_SUFFIX="" + ZSH_THEME_GIT_PROMPT_DIRTY="" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + # display exitcode on the right when >0 + return_code="%(?..%? ↵)" + + RPROMPT='${return_code}$(git_prompt_status)' + + ZSH_THEME_GIT_PROMPT_ADDED=" ✚" + ZSH_THEME_GIT_PROMPT_MODIFIED=" ✹" + ZSH_THEME_GIT_PROMPT_DELETED=" ✖" + ZSH_THEME_GIT_PROMPT_RENAMED=" ➜" + ZSH_THEME_GIT_PROMPT_UNMERGED=" ═" + ZSH_THEME_GIT_PROMPT_UNTRACKED=" ✭" +fi diff --git a/oh-my-zsh/themes/lambda.zsh-theme b/oh-my-zsh/themes/lambda.zsh-theme @@ -0,0 +1,6 @@ +# ZSH Theme - Preview: http://cl.ly/350F0F0k1M2y3A2i3p1S + +PROMPT='λ %~/ $(git_prompt_info)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " diff --git a/oh-my-zsh/themes/linuxonly.zsh-theme b/oh-my-zsh/themes/linuxonly.zsh-theme @@ -0,0 +1,79 @@ +# vim: set ts=2 textwidth=0 + +autoload -U add-zsh-hook +autoload -Uz vcs_info +local c0=$(printf "\033[0m") +local c1=$(printf "\033[38;5;215m") +local c2=$(printf "\033[38;5;209m") +local c3=$(printf "\033[38;5;203m") +local c4=$(printf "\033[33;4m") +local c5=$(printf "\033[38;5;137m") +local c6=$(printf "\033[38;5;240m") +local c7=$(printf "\033[38;5;149m") +local c8=$(printf "\033[38;5;126m") +local c9=$(printf "\033[38;5;162m") + + +if [ "$TERM" = "linux" ]; then + c1=$(printf "\033[34;1m") + c2=$(printf "\033[35m") + c3=$(printf "\033[31m") + c4=$(printf "\033[31;1m") + c5=$(printf "\033[32m") + c6=$(printf "\033[32;1m") + c7=$(printf "\033[33m") + c8=$(printf "\033[33;1m") + c9=$(printf "\033[34m") +fi + +#local newtv=$(perl $HOME/devel/newtv.pl) +local newtv='' + +zstyle ':vcs_info:*' actionformats \ + '%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' +zstyle ':vcs_info:*' formats \ + "%{$c8%}%s%{$c7%}:%{$c7%}(%{$c9%}%b%{$c7%})%f " +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' +zstyle ':vcs_info:*' enable git + +add-zsh-hook precmd prompt_jnrowe_precmd + +prompt_jnrowe_precmd () { + vcs_info + + if [ "${vcs_info_msg_0_}" = "" ]; then + #dir_status="|%F{3}%n%F{7}@%F{3}%m%F{7}:%F{9}%l%f" + #dir_status="$c1%n%F{7}@%F{9}%m%F{7}:%F{12}%/" + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" + #dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$foopath%} %{$c0%}(%{$c5%}%?%{$c0%})" + + PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} +> ' + elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='${vcs_info_msg_0_} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} +> ' + + elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" + + PROMPT='${vcs_info_msg_0_} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} +%{$c9%}·>%{$c0%} ' + else + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='${vcs_info_msg_0_} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} +> ' + + fi +} + + +#PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$reset_color%} ${vcs_info_msg_0_}${dir_status}%{$reset_color%} +#> ' + +# vim: set ft=zsh ts=4 sw=4 et: + + diff --git a/oh-my-zsh/themes/lukerandall.zsh-theme b/oh-my-zsh/themes/lukerandall.zsh-theme @@ -0,0 +1,24 @@ +# ZSH Theme - Preview: http://cl.ly/f701d00760f8059e06dc +# Thanks to gallifrey, upon whose theme this is based + +local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})" + +function my_git_prompt_info() { + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + GIT_STATUS=$(git_prompt_status) + [[ -n $GIT_STATUS ]] && GIT_STATUS=" $GIT_STATUS" + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$GIT_STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX" +} + +PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[blue]%}%2~%{$reset_color%} $(my_git_prompt_info)%{$reset_color%}%B»%b ' +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%%" +ZSH_THEME_GIT_PROMPT_ADDED="+" +ZSH_THEME_GIT_PROMPT_MODIFIED="*" +ZSH_THEME_GIT_PROMPT_RENAMED="~" +ZSH_THEME_GIT_PROMPT_DELETED="!" +ZSH_THEME_GIT_PROMPT_UNMERGED="?" + diff --git a/oh-my-zsh/themes/macovsky-ruby.zsh-theme b/oh-my-zsh/themes/macovsky-ruby.zsh-theme @@ -0,0 +1,15 @@ +# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +if [ -e ~/.rvm/bin/rvm-prompt ]; then + PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' +else + if which rbenv &> /dev/null; then + PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' + fi +fi + +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" diff --git a/oh-my-zsh/themes/macovsky.zsh-theme b/oh-my-zsh/themes/macovsky.zsh-theme @@ -0,0 +1,14 @@ +# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +if [ -e ~/.rvm/bin/rvm-prompt ]; then + PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' +else + if which rbenv &> /dev/null; then + PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' + fi +fi +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" diff --git a/oh-my-zsh/themes/maran.zsh-theme b/oh-my-zsh/themes/maran.zsh-theme @@ -0,0 +1,6 @@ +# Theme with full path names and hostname +# Handy if you work on different servers all the time; +PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@%{$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}git:(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" diff --git a/oh-my-zsh/themes/mgutz.zsh-theme b/oh-my-zsh/themes/mgutz.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg_bold[magenta]%}%1~$(git_prompt_info) %{$fg_bold[magenta]%}%# %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="*]" +ZSH_THEME_GIT_PROMPT_CLEAN="]" diff --git a/oh-my-zsh/themes/mh.zsh-theme b/oh-my-zsh/themes/mh.zsh-theme @@ -0,0 +1,24 @@ +# mh theme +# preview: http://cl.ly/1y2x0W0E3t2C0F29043z + +# features: +# path is autoshortened to ~30 characters +# displays git status (if applicable in current folder) +# turns username green if superuser, otherwise it is white + +# if superuser make the username green +if [ $UID -eq 0 ]; then NCOLOR="green"; else NCOLOR="white"; fi + +# prompt +PROMPT='[%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[red]%}%30<...<%~%<<%{$reset_color%}]%(!.#.$) ' +RPROMPT='$(git_prompt_info)' + +# git theming +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[gray]%}(%{$fg_no_bold[yellow]%}%B" +ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[gray]%})%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✱" + +# LS colors, made with http://geoff.greer.fm/lscolors/ +export LSCOLORS="Gxfxcxdxbxegedabagacad" +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' diff --git a/oh-my-zsh/themes/michelebologna.zsh-theme b/oh-my-zsh/themes/michelebologna.zsh-theme @@ -0,0 +1,75 @@ +# Michele Bologna's theme +# http://michelebologna.net +# +# This a theme for oh-my-zsh. Features a colored prompt with: +# * username@host: [jobs] [git] workdir % +# * hostname color is based on hostname characters. When using as root, the +# prompt shows only the hostname in red color. +# * [jobs], if applicable, counts the number of suspended jobs tty +# * [git], if applicable, represents the status of your git repo (more on that +# later) +# * '%' prompt will be green if last command return value is 0, yellow otherwise. +# +# git prompt is inspired by official git contrib prompt: +# https://github.com/git/git/tree/master/contrib/completion/git-prompt.sh +# and it adds: +# * the current branch +# * '%' if there are untracked files +# * '$' if there are stashed changes +# * '*' if there are modified files +# * '+' if there are added files +# * '<' if local repo is behind remote repo +# * '>' if local repo is ahead remote repo +# * '=' if local repo is equal to remote repo (in sync) +# * '<>' if local repo is diverged + +local green="%{$fg_bold[green]%}" +local red="%{$fg_bold[red]%}" +local cyan="%{$fg_bold[cyan]%}" +local yellow="%{$fg_bold[yellow]%}" +local blue="%{$fg_bold[blue]%}" +local magenta="%{$fg_bold[magenta]%}" +local white="%{$fg_bold[white]%}" +local reset="%{$reset_color%}" + +local -a color_array +color_array=($green $red $cyan $yellow $blue $magenta $white) + +local username_normal_color=$white +local username_root_color=$red +local hostname_root_color=$red + +# calculating hostname color with hostname characters +for i in `hostname`; local hostname_normal_color=$color_array[$[((#i))%7+1]] +local -a hostname_color +hostname_color=%(!.$hostname_root_color.$hostname_normal_color) + +local current_dir_color=$blue +local username_command="%n" +local hostname_command="%m" +local current_dir="%~" + +local username_output="%(!..$username_normal_color$username_command$reset@)" +local hostname_output="$hostname_color$hostname_command$reset" +local current_dir_output="$current_dir_color$current_dir$reset" +local jobs_bg="${red}fg: %j$reset" +local last_command_output="%(?.%(!.$red.$green).$yellow)" + +ZSH_THEME_GIT_PROMPT_PREFIX="" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_UNTRACKED="$blue%%" +ZSH_THEME_GIT_PROMPT_MODIFIED="$red*" +ZSH_THEME_GIT_PROMPT_ADDED="$green+" +ZSH_THEME_GIT_PROMPT_STASHED="$blue$" +ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE="$green=" +ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=">" +ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="<" +ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="$red<>" + +PROMPT='$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)' +GIT_PROMPT='$(out=$(git_prompt_info)$(git_prompt_status)$(git_remote_status);if [[ -n $out ]]; then printf %s " $white($green$out$white)$reset";fi)' +PROMPT+="$GIT_PROMPT" +PROMPT+=" $last_command_output%#$reset " +RPROMPT='' diff --git a/oh-my-zsh/themes/mikeh.zsh-theme b/oh-my-zsh/themes/mikeh.zsh-theme @@ -0,0 +1,21 @@ +setopt prompt_subst + +autoload -U add-zsh-hook +autoload -Uz vcs_info + +# check-for-changes can be really slow. +# you should disable it, if you work with large repositories +zstyle ':vcs_info:*:prompt:*' check-for-changes true + +add-zsh-hook precmd mikeh_precmd + +mikeh_precmd() { + vcs_info +} + +# user, host, full path, and time/date +# on two lines for easier vgrepping +# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 +PROMPT=$'%{\e[0;34m%}%B..[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +%{\e[0;34m%}%B..%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <($vcs_info_msg_0_)>%{\e[0m%}%b ' +PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '+ \ No newline at end of file diff --git a/oh-my-zsh/themes/miloshadzic.zsh-theme b/oh-my-zsh/themes/miloshadzic.zsh-theme @@ -0,0 +1,8 @@ +# Yay! High voltage and arrows! + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +PROMPT='%{$fg[cyan]%}%1~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}$(git_prompt_info)%{$fg[cyan]%}⇒%{$reset_color%} ' diff --git a/oh-my-zsh/themes/minimal.zsh-theme b/oh-my-zsh/themes/minimal.zsh-theme @@ -0,0 +1,24 @@ +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[white]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$fg[white]%}]%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="]%{$reset_color%} " +ZSH_THEME_SVN_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX +ZSH_THEME_SVN_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX +ZSH_THEME_SVN_PROMPT_DIRTY=$ZSH_THEME_GIT_PROMPT_DIRTY +ZSH_THEME_SVN_PROMPT_CLEAN=$ZSH_THEME_GIT_PROMPT_CLEAN +ZSH_THEME_HG_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX +ZSH_THEME_HG_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX +ZSH_THEME_HG_PROMPT_DIRTY=$ZSH_THEME_GIT_PROMPT_DIRTY +ZSH_THEME_HG_PROMPT_CLEAN=$ZSH_THEME_GIT_PROMPT_CLEAN + +vcs_status() { + if [[ $(whence in_svn) != "" ]] && in_svn; then + svn_prompt_info + elif [[ $(whence in_hg) != "" ]] && in_hg; then + hg_prompt_info + else + git_prompt_info + fi +} + +PROMPT='%2~ $(vcs_status)»%b ' diff --git a/oh-my-zsh/themes/mira.zsh-theme b/oh-my-zsh/themes/mira.zsh-theme @@ -0,0 +1,29 @@ +# Based on bira zsh theme with nvm, rvm and jenv support +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' +local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' + +local rvm_ruby='' +if which rvm-prompt &> /dev/null; then + rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' +else + if which rbenv &> /dev/null; then + rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}' + fi +fi + +local nvm_node='' +nvm_node='%{$fg[green]%}‹node-$(nvm_prompt_info)›%{$reset_color%}' + +local jenv_java='' +jenv_java='%{$fg[blue]%}‹$(jenv_prompt_info)›%{$reset_color%}' + +local git_branch='$(git_prompt_info)%{$reset_color%}' + +PROMPT="╭─${user_host} ${current_dir} ${nvm_node} ${rvm_ruby} ${jenv_java} ${git_branch} +╰─%B$%b " +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}" diff --git a/oh-my-zsh/themes/mortalscumbag.zsh-theme b/oh-my-zsh/themes/mortalscumbag.zsh-theme @@ -0,0 +1,59 @@ +function my_git_prompt() { + tester=$(git rev-parse --git-dir 2> /dev/null) || return + + INDEX=$(git status --porcelain 2> /dev/null) + STATUS="" + + # is branch ahead? + if $(echo "$(git log origin/$(git_current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" + fi + + # is anything staged? + if $(echo "$INDEX" | command grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED" + fi + + # is anything unstaged? + if $(echo "$INDEX" | command grep -E -e '^[ MARC][MD] ' &> /dev/null); then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" + fi + + # is anything untracked? + if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" + fi + + # is anything unmerged? + if $(echo "$INDEX" | command grep -E -e '^(A[AU]|D[DU]|U[ADU]) ' &> /dev/null); then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" + fi + + if [[ -n $STATUS ]]; then + STATUS=" $STATUS" + fi + + echo "$ZSH_THEME_GIT_PROMPT_PREFIX$(my_current_branch)$STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX" +} + +function my_current_branch() { + echo $(git_current_branch || echo "(no branch)") +} + +function ssh_connection() { + if [[ -n $SSH_CONNECTION ]]; then + echo "%{$fg_bold[red]%}(ssh) " + fi +} + +local ret_status="%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%})%?%{$reset_color%}" +PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n[${ret_status}] %# ' + +ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}" +ZSH_THEME_GIT_PROMPT_PREFIX=" $fg[white]‹ %{$fg_bold[yellow]%}" +ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[magenta]%}↑" +ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●" +ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[red]%}●" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[white]%}●" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[red]%}✕" +ZSH_THEME_GIT_PROMPT_SUFFIX=" $fg_bold[white]›%{$reset_color%}" diff --git a/oh-my-zsh/themes/mrtazz.zsh-theme b/oh-my-zsh/themes/mrtazz.zsh-theme @@ -0,0 +1,7 @@ +PROMPT='%{$fg_bold[red]%}%m%{$reset_color%}:%{$fg[cyan]%}%c%{$reset_color%}:%# ' +RPROMPT='%{$fg_bold[green]%}$(git_prompt_info)%{$reset_color%}% ' + +ZSH_THEME_GIT_PROMPT_PREFIX="<%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}✗%{$fg[green]%}>%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}>" diff --git a/oh-my-zsh/themes/murilasso.zsh-theme b/oh-my-zsh/themes/murilasso.zsh-theme @@ -0,0 +1,14 @@ +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' +local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}' +local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%}' +local git_branch='%{$fg[blue]%}$(git_prompt_info)%{$reset_color%}' + +PROMPT="${user_host}:${current_dir} ${rvm_ruby} +${git_branch} %B$%b " +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$reset_color%}" diff --git a/oh-my-zsh/themes/muse.zsh-theme b/oh-my-zsh/themes/muse.zsh-theme @@ -0,0 +1,33 @@ +#!/usr/bin/env zsh +#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +setopt promptsubst + +autoload -U add-zsh-hook + +PROMPT_SUCCESS_COLOR=$FG[117] +PROMPT_FAILURE_COLOR=$FG[124] +PROMPT_VCS_INFO_COLOR=$FG[242] +PROMPT_PROMPT=$FG[077] +GIT_DIRTY_COLOR=$FG[133] +GIT_CLEAN_COLOR=$FG[118] +GIT_PROMPT_INFO=$FG[012] + +PROMPT='%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%}%{$GIT_PROMPT_INFO%}$(git_prompt_info)$(virtualenv_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ%{$reset_color%} ' + +#RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX=" (" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%})" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔" + +ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[082]%}✚%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[166]%}✹%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[160]%}✖%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[220]%}➜%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[082]%}═%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[190]%}✭%{$reset_color%}" + +ZSH_THEME_VIRTUALENV_PREFIX=" [" +ZSH_THEME_VIRTUALENV_SUFFIX="]" diff --git a/oh-my-zsh/themes/nanotech.zsh-theme b/oh-my-zsh/themes/nanotech.zsh-theme @@ -0,0 +1,7 @@ +PROMPT='%F{green}%2c%F{blue} [%f ' +RPROMPT='$(git_prompt_info) %F{blue}] %F{green}%D{%L:%M} %F{yellow}%D{%p}%f' + +ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%f" +ZSH_THEME_GIT_PROMPT_DIRTY=" %F{red}*%f" +ZSH_THEME_GIT_PROMPT_CLEAN="" diff --git a/oh-my-zsh/themes/nebirhos.zsh-theme b/oh-my-zsh/themes/nebirhos.zsh-theme @@ -0,0 +1,21 @@ +# Based on robbyrussell's theme, with host and rvm indicators. Example: +# @host ➜ currentdir rvm:(rubyversion@gemset) git:(branchname) + +# Get the current ruby version in use with RVM: +if [ -e ~/.rvm/bin/rvm-prompt ]; then + RUBY_PROMPT_="%{$fg_bold[blue]%}rvm:(%{$fg[green]%}\$(~/.rvm/bin/rvm-prompt s i v g)%{$fg_bold[blue]%})%{$reset_color%} " +else + if which rbenv &> /dev/null; then + RUBY_PROMPT_="%{$fg_bold[blue]%}rbenv:(%{$fg[green]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg_bold[blue]%})%{$reset_color%} " + fi +fi + +# Get the host name (first 4 chars) +HOST_PROMPT_="%{$fg_bold[red]%}@$HOST ➜ %{$fg_bold[cyan]%}%c " +GIT_PROMPT="%{$fg_bold[blue]%}\$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}" +PROMPT="$HOST_PROMPT_$RUBY_PROMPT_$GIT_PROMPT" + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/oh-my-zsh/themes/nicoulaj.zsh-theme b/oh-my-zsh/themes/nicoulaj.zsh-theme @@ -0,0 +1,43 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------ +# Prompt for the Zsh shell: +# * One line. +# * VCS info on the right prompt. +# * Only shows the path on the left prompt by default. +# * Crops the path to a defined length and only shows the path relative to +# the current VCS repository root. +# * Wears a different color wether the last command succeeded/failed. +# * Shows user@hostname if connected through SSH. +# * Shows if logged in as root or not. +# ------------------------------------------------------------------------------ + +# Customizable parameters. +PROMPT_PATH_MAX_LENGTH=30 +PROMPT_DEFAULT_END=❯ +PROMPT_ROOT_END=❯❯❯ +PROMPT_SUCCESS_COLOR=$FG[071] +PROMPT_FAILURE_COLOR=$FG[124] +PROMPT_VCS_INFO_COLOR=$FG[242] + +# Set required options. +setopt promptsubst + +# Load required modules. +autoload -U add-zsh-hook +autoload -Uz vcs_info + +# Add hook for calling vcs_info before each command. +add-zsh-hook precmd vcs_info + +# Set vcs_info parameters. +zstyle ':vcs_info:*' enable hg bzr git +zstyle ':vcs_info:*:*' check-for-changes true # Can be slow on big repos. +zstyle ':vcs_info:*:*' unstagedstr '!' +zstyle ':vcs_info:*:*' stagedstr '+' +zstyle ':vcs_info:*:*' actionformats "%S" "%r/%s/%b %u%c (%a)" +zstyle ':vcs_info:*:*' formats "%S" "%r/%s/%b %u%c" +zstyle ':vcs_info:*:*' nvcsformats "%~" "" + +# Define prompts. +PROMPT="%(0?.%{$PROMPT_SUCCESS_COLOR%}.%{$PROMPT_FAILURE_COLOR%})${SSH_TTY:+[%n@%m]}%{$FX[bold]%}%$PROMPT_PATH_MAX_LENGTH<..<"'${vcs_info_msg_0_%%.}'"%<<%(!.$PROMPT_ROOT_END.$PROMPT_DEFAULT_END)%{$FX[no-bold]%}%{$FX[reset]%} " +RPROMPT="%{$PROMPT_VCS_INFO_COLOR%}"'$vcs_info_msg_1_'"%{$FX[reset]%}" diff --git a/oh-my-zsh/themes/norm.zsh-theme b/oh-my-zsh/themes/norm.zsh-theme @@ -0,0 +1,4 @@ +PROMPT='%{$fg[yellow]%}λ %m %{$fg[green]%}%c %{$fg[yellow]%}→ $(git_prompt_info)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="λ %{$fg[blue]%}git %{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%} → %{$reset_color%}" diff --git a/oh-my-zsh/themes/obraun.zsh-theme b/oh-my-zsh/themes/obraun.zsh-theme @@ -0,0 +1,11 @@ +if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi + +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='%{$fg[green]%}[%*]%{$reset_color%} %{$fg_no_bold[cyan]%}%n %{${fg_bold[blue]}%}::%{$reset_color%} %{$fg[yellow]%}%m%{$reset_color%} %{$fg_no_bold[magenta]%} ➜ %{$reset_color%} %{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' + +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" + diff --git a/oh-my-zsh/themes/peepcode.zsh-theme b/oh-my-zsh/themes/peepcode.zsh-theme @@ -0,0 +1,44 @@ +# +# Based on Geoffrey Grosenbach's peepcode zsh theme from +# https://github.com/topfunky/zsh-simple +# + +git_repo_path() { + git rev-parse --git-dir 2>/dev/null +} + +git_commit_id() { + git rev-parse --short HEAD 2>/dev/null +} + +git_mode() { + if [[ -e "$repo_path/BISECT_LOG" ]]; then + echo "+bisect" + elif [[ -e "$repo_path/MERGE_HEAD" ]]; then + echo "+merge" + elif [[ -e "$repo_path/rebase" || -e "$repo_path/rebase-apply" || -e "$repo_path/rebase-merge" || -e "$repo_path/../.dotest" ]]; then + echo "+rebase" + fi +} + +git_dirty() { + if [[ "$repo_path" != '.' && `git ls-files -m` != "" ]]; then + echo " %{$fg_bold[grey]%}✗%{$reset_color%}" + fi +} + +git_prompt() { + local cb=$(git_current_branch) + if [ -n "$cb" ]; then + local repo_path=$(git_repo_path) + echo " %{$fg_bold[grey]%}$cb %{$fg[white]%}$(git_commit_id)%{$reset_color%}$(git_mode)$(git_dirty)" + fi +} + +local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})" + +PROMPT=' +%~ +${smiley} %{$reset_color%}' + +RPROMPT='%{$fg[white]%} $(ruby_prompt_info)$(git_prompt)%{$reset_color%}' diff --git a/oh-my-zsh/themes/philips.zsh-theme b/oh-my-zsh/themes/philips.zsh-theme @@ -0,0 +1,14 @@ +if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi + +PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' +RPROMPT='[%*]' + +# git theming +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[red]%}%B" +ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="*" + +# LS colors, made with http://geoff.greer.fm/lscolors/ +export LSCOLORS="Gxfxcxdxbxegedabagacad" +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:*.patch=00;34:*.o=00;32:*.so=01;35:*.ko=01;31:*.la=00;33' diff --git a/oh-my-zsh/themes/pmcgee.zsh-theme b/oh-my-zsh/themes/pmcgee.zsh-theme @@ -0,0 +1,16 @@ +if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi + +PROMPT=' +%{$fg[$NCOLOR]%}%B%n@%m%b%{$reset_color%} %{$fg[white]%}%B${PWD/#$HOME/~}%b%{$reset_color%} +$(git_prompt_info)%(!.#.$) ' +RPROMPT='[%*]' + +# git theming +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_no_bold[yellow]%}%B" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}*" + +# LS colors, made with http://geoff.greer.fm/lscolors/ +export LSCOLORS="Gxfxcxdxbxegedabagacad" +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' diff --git a/oh-my-zsh/themes/pure.zsh-theme b/oh-my-zsh/themes/pure.zsh-theme @@ -0,0 +1,10 @@ +print -P '%F{yellow}'Oh My Zsh pure theme: +cat <<-EOF + + The pure theme has been renamed as 'refined' as per the original author's + request. Change your ZSH_THEME to 'refined' to avoid seeing this warning. + +EOF +print -P '%f' + +source ${0:h:A}/refined.zsh-theme diff --git a/oh-my-zsh/themes/pygmalion.zsh-theme b/oh-my-zsh/themes/pygmalion.zsh-theme @@ -0,0 +1,34 @@ +# Yay! High voltage and arrows! + +prompt_setup_pygmalion(){ + ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " + ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + base_prompt='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}' + post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} ' + + base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") + post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g") + + precmd_functions+=(prompt_pygmalion_precmd) +} + +prompt_pygmalion_precmd(){ + local gitinfo=$(git_prompt_info) + local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g") + local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")" + local prompt_length=${#exp_nocolor} + + local nl="" + + if [[ $prompt_length -gt 40 ]]; then + nl=$'\n%{\r%}'; + fi + PROMPT="$base_prompt$gitinfo$nl$post_prompt" +} + +prompt_setup_pygmalion + + diff --git a/oh-my-zsh/themes/re5et.zsh-theme b/oh-my-zsh/themes/re5et.zsh-theme @@ -0,0 +1,15 @@ +if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi + +local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})" + +PROMPT=' +%{$fg_bold[cyan]%}%n%{$reset_color%}%{$fg[yellow]%}@%{$reset_color%}%{$fg_bold[blue]%}%m%{$reset_color%}:%{${fg_bold[green]}%}%~%{$reset_color%}$(git_prompt_info) +%{${fg[$CARETCOLOR]}%}%# %{${reset_color}%}' + +RPS1='${return_code} %D - %*' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[magenta]%}^%{$reset_color%}%{$fg_bold[yellow]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} ±" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ?" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[red]%} ♥" diff --git a/oh-my-zsh/themes/refined.zsh-theme b/oh-my-zsh/themes/refined.zsh-theme @@ -0,0 +1,106 @@ +#!/usr/bin/env zsh + +# ------------------------------------------------------------------------------ +# +# Pure - A minimal and beautiful theme for oh-my-zsh +# +# Based on the custom Zsh-prompt of the same name by Sindre Sorhus. A huge +# thanks goes out to him for designing the fantastic Pure prompt in the first +# place! I'd also like to thank Julien Nicoulaud for his "nicoulaj" theme from +# which I've borrowed both some ideas and some actual code. You can find out +# more about both of these fantastic two people here: +# +# Sindre Sorhus +# Github: https://github.com/sindresorhus +# Twitter: https://twitter.com/sindresorhus +# +# Julien Nicoulaud +# Github: https://github.com/nicoulaj +# Twitter: https://twitter.com/nicoulaj +# +# ------------------------------------------------------------------------------ + +# Set required options +# +setopt prompt_subst + +# Load required modules +# +autoload -Uz vcs_info + +# Set vcs_info parameters +# +zstyle ':vcs_info:*' enable hg bzr git +zstyle ':vcs_info:*:*' unstagedstr '!' +zstyle ':vcs_info:*:*' stagedstr '+' +zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%%u%c" +zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%u%c (%a)" +zstyle ':vcs_info:*:*' nvcsformats "%~" "" "" + +# Fastest possible way to check if repo is dirty +# +git_dirty() { + # Check if we're in a git repo + command git rev-parse --is-inside-work-tree &>/dev/null || return + # Check if it's dirty + command git diff --quiet --ignore-submodules HEAD &>/dev/null; [ $? -eq 1 ] && echo "*" +} + +# Display information about the current repository +# +repo_information() { + echo "%F{blue}${vcs_info_msg_0_%%/.} %F{8}$vcs_info_msg_1_`git_dirty` $vcs_info_msg_2_%f" +} + +# Displays the exec time of the last command if set threshold was exceeded +# +cmd_exec_time() { + local stop=`date +%s` + local start=${cmd_timestamp:-$stop} + let local elapsed=$stop-$start + [ $elapsed -gt 5 ] && echo ${elapsed}s +} + +# Get the initial timestamp for cmd_exec_time +# +preexec() { + cmd_timestamp=`date +%s` +} + +# Output additional information about paths, repos and exec time +# +precmd() { + vcs_info # Get version control info before we start outputting stuff + print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f" +} + +# Define prompts +# +PROMPT="%(?.%F{magenta}.%F{red})❯%f " # Display a red prompt char on failure +RPROMPT="%F{8}${SSH_TTY:+%n@%m}%f" # Display username if connected via SSH + +# ------------------------------------------------------------------------------ +# +# List of vcs_info format strings: +# +# %b => current branch +# %a => current action (rebase/merge) +# %s => current version control system +# %r => name of the root directory of the repository +# %S => current path relative to the repository root directory +# %m => in case of Git, show information about stashes +# %u => show unstaged changes in the repository +# %c => show staged changes in the repository +# +# List of prompt format strings: +# +# prompt: +# %F => color dict +# %f => reset color +# %~ => current path +# %* => time +# %n => username +# %m => shortname host +# %(?..) => prompt conditional - %(condition.true.false) +# +# ------------------------------------------------------------------------------ diff --git a/oh-my-zsh/themes/rgm.zsh-theme b/oh-my-zsh/themes/rgm.zsh-theme @@ -0,0 +1,8 @@ +PROMPT=' +%n@%m %{$fg[cyan]%}%~ +%? $(git_prompt_info)%{$fg_bold[blue]%}%% %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}" diff --git a/oh-my-zsh/themes/risto.zsh-theme b/oh-my-zsh/themes/risto.zsh-theme @@ -0,0 +1,6 @@ +# -*- sh -*- vim:set ft=sh ai et sw=4 sts=4: +# It might be bash like, but I can't have my co-workers knowing I use zsh +PROMPT='%{$fg[green]%}%n@%m:%{$fg_bold[blue]%}%2~ $(git_prompt_info)%{$reset_color%}%(!.#.$) ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="›%{$reset_color%}" diff --git a/oh-my-zsh/themes/rixius.zsh-theme b/oh-my-zsh/themes/rixius.zsh-theme @@ -0,0 +1,21 @@ +# name in folder (github) +# ± if in github repo, or ≥ if otherwise Time in 24-hour format is on right. +function collapse_pwd { + echo $(pwd | sed -e "s,^$HOME,~,") +} +function prompt_char { + echo -n "%{$bg[white]%}%{$fg[red]%}" + git branch >/dev/null 2>/dev/null && echo "±%{$reset_color%}" && return + echo "≥%{$reset_color%}" +} +RIXIUS_PRE="%{$bg[white]%}%{$fg[red]%}" + +PROMPT=' +%{$RIXIUS_PRE%}%n%{$reset_color%} in %{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(git_prompt_info) +$(prompt_char) ' +RPROMPT='%{$RIXIUS_PRE%}%T%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RIXIUS_PRE%}!%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$RIXIUS_PRE%}√%{$reset_color%}" diff --git a/oh-my-zsh/themes/rkj-repos.zsh-theme b/oh-my-zsh/themes/rkj-repos.zsh-theme @@ -0,0 +1,36 @@ +# user, host, full path, and time/date +# on two lines for easier vgrepping +# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 + +function hg_prompt_info { + hg prompt --angle-brackets "\ +<hg:%{$fg[magenta]%}<branch>%{$reset_color%}><:%{$fg[magenta]%}<bookmark>%{$reset_color%}>\ +</%{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\ +%{$fg[red]%}<status|modified|unknown><update>%{$reset_color%}< +patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null +} + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}✱" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✗" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}➦" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%}✂" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[blue]%}✈" +ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$fg[blue]%}" +ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}" + +function mygit() { + if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then + ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ + ref=$(command git rev-parse --short HEAD 2> /dev/null) || return + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(git_prompt_short_sha)$(git_prompt_status)%{$fg_bold[blue]%}$ZSH_THEME_GIT_PROMPT_SUFFIX " + fi +} + +function retcode() {} + +# alternate prompt with git & hg +PROMPT=$'%{$fg_bold[blue]%}┌─[%{$fg_bold[green]%}%n%b%{$fg[black]%}@%{$fg[cyan]%}%m%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%{$fg_bold[white]%}%~%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%b%{$fg[yellow]%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{$fg_bold[blue]%}] +%{$fg_bold[blue]%}└─[%{$fg_bold[magenta]%}%?$(retcode)%{$fg_bold[blue]%}] <$(mygit)$(hg_prompt_info)>%{$reset_color%} ' +PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' + diff --git a/oh-my-zsh/themes/rkj.zsh-theme b/oh-my-zsh/themes/rkj.zsh-theme @@ -0,0 +1,9 @@ +# user, host, full path, and time/date +# on two lines for easier vgrepping +# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 + +function retcode() {} + +PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B]%{\e[0m%}%b ' + diff --git a/oh-my-zsh/themes/robbyrussell.zsh-theme b/oh-my-zsh/themes/robbyrussell.zsh-theme @@ -0,0 +1,7 @@ +local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )" +PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/oh-my-zsh/themes/sammy.zsh-theme b/oh-my-zsh/themes/sammy.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg[white]%}%c$(git_prompt_info)$ % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="*)" +ZSH_THEME_GIT_PROMPT_CLEAN=")" diff --git a/oh-my-zsh/themes/simonoff.zsh-theme b/oh-my-zsh/themes/simonoff.zsh-theme @@ -0,0 +1,138 @@ +# Prompt +# +# Below are the color init strings for the basic file types. A color init +# string consists of one or more of the following numeric codes: +# Attribute codes: +# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed +# Text color codes: +# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white +# Background color codes: +# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white +function precmd { + + local TERMWIDTH + (( TERMWIDTH = ${COLUMNS} - 1 )) + + + ### + # Truncate the path if it's too long. + + PR_FILLBAR="" + PR_PWDLEN="" + + local promptsize=${#${(%):---(%n@%M:%l)---()}} + local pwdsize=${#${(%):-%~}} + local gitbranch="$(git_prompt_info)" + local rvmprompt="$(rvm_prompt_info)" + local gitbranchsize=${#${gitbranch:-''}} + local rvmpromptsize=${#${rvmprompt:-''}} + + if [[ "$promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize" -gt $TERMWIDTH ]]; then + ((PR_PWDLEN=$TERMWIDTH - $promptsize)) + else + PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize)))..${PR_SPACE}.)}" + fi +} + + +setopt extended_glob + +preexec () { + if [[ "$TERM" == "screen" ]]; then + local CMD=${1[(wr)^(*=*|sudo|-*)]} + echo -n "\ek$CMD\e\\" + fi + + if [[ "$TERM" == "xterm" ]]; then + print -Pn "\e]0;$1\a" + fi + + if [[ "$TERM" == "rxvt" ]]; then + print -Pn "\e]0;$1\a" + fi + +} + +setprompt () { +### +# Need this so the prompt will work. + + setopt prompt_subst + + +### +# See if we can use colors. + + autoload zsh/terminfo + for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do + eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' + eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' + (( count = $count + 1 )) + done + PR_NO_COLOUR="%{$terminfo[sgr0]%}" + + +### +# See if we can use extended characters to look nicer. + + typeset -A altchar +# set -A altchar "${(s..)terminfo[acsc]}" + PR_SET_CHARSET="%{$terminfo[enacs]%}" + PR_HBAR=${altchar[q]:--} + PR_ULCORNER=${altchar[l]:--} + PR_LLCORNER=${altchar[m]:--} + PR_LRCORNER=${altchar[j]:--} + PR_URCORNER=${altchar[k]:--} + + ### + # Modify Git prompt + ZSH_THEME_GIT_PROMPT_PREFIX=" [" + ZSH_THEME_GIT_PROMPT_SUFFIX="]" + ### + # Modify RVM prompt + ZSH_THEME_RVM_PROMPT_PREFIX=" [" + ZSH_THEME_RVM_PROMPT_SUFFIX="]" + + +### +# Decide if we need to set titlebar text. + + case $TERM in + xterm*|*rxvt*) + PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%M:%~ $(git_prompt_info) $(rvm_prompt_info) | ${COLUMNS}x${LINES} | %y\a%}' + ;; + screen) + PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' + ;; + *) + PR_TITLEBAR='' + ;; + esac + + +### +# Decide whether to set a screen title + if [[ "$TERM" == "screen" ]]; then + PR_STITLE=$'%{\ekzsh\e\\%}' + else + PR_STITLE='' + fi + +### +# Finally, the prompt. +# + PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ +$PR_RED$PR_HBAR<\ +$PR_BLUE%(!.$PR_RED%SROOT%s.%n)$PR_GREEN@$PR_BLUE%M:$PR_GREEN%$PR_PWDLEN<...<%~$PR_CYAN$(git_prompt_info)$(rvm_prompt_info)\ +$PR_RED>$PR_HBAR$PR_SPACE${(e)PR_FILLBAR}\ +$PR_RED$PR_HBAR<\ +$PR_GREEN%l$PR_RED>$PR_HBAR\ + +$PR_RED$PR_HBAR<\ +%(?..$PR_LIGHT_RED%?$PR_BLUE:)\ +$PR_LIGHT_BLUE%(!.$PR_RED.$PR_WHITE)%#$PR_RED>$PR_HBAR\ +$PR_NO_COLOUR ' + +} + +setprompt diff --git a/oh-my-zsh/themes/simple.zsh-theme b/oh-my-zsh/themes/simple.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg[green]%}%~%{$fg_bold[blue]%}$(git_prompt_info)%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")" +ZSH_THEME_GIT_PROMPT_DIRTY=" ✗" +ZSH_THEME_GIT_PROMPT_CLEAN=" ✔" diff --git a/oh-my-zsh/themes/skaro.zsh-theme b/oh-my-zsh/themes/skaro.zsh-theme @@ -0,0 +1,7 @@ +PROMPT='%{$fg_bold[green]%}%h %{$fg[cyan]%}%2~ %{$fg_bold[blue]%}$(git_prompt_info) %{$reset_color%}» ' + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" + diff --git a/oh-my-zsh/themes/smt.zsh-theme b/oh-my-zsh/themes/smt.zsh-theme @@ -0,0 +1,86 @@ +# smt.zsh-theme, based on dogenpunk by Matthew Nelson. + +MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" +local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%} " + +ZSH_THEME_GIT_PROMPT_PREFIX="|" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[red]%}!%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓%{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" + +# Format for git_prompt_long_sha() and git_prompt_short_sha() +ZSH_THEME_GIT_PROMPT_SHA_BEFORE="➤ %{$fg_bold[yellow]%}" +ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}" + +function prompt_char() { + git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return + hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return + darcs show repo >/dev/null 2>/dev/null && echo "%{$fg_bold[green]%}❉%{$reset_color%}" && return + echo "%{$fg[cyan]%}◯%{$reset_color%}" +} + +# Colors vary depending on time lapsed. +ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" +ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" + +# Determine the time since last commit. If branch is clean, +# use a neutral color, otherwise colors will vary according to time. +function git_time_since_commit() { + if git rev-parse --git-dir > /dev/null 2>&1; then + # Only proceed if there is actually a commit. + if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then + # Get the last commit. + last_commit=`git log --pretty=format:'%at' -1 2> /dev/null` + now=`date +%s` + seconds_since_last_commit=$((now-last_commit)) + + # Totals + MINUTES=$((seconds_since_last_commit / 60)) + HOURS=$((seconds_since_last_commit/3600)) + + # Sub-hours and sub-minutes + DAYS=$((seconds_since_last_commit / 86400)) + SUB_HOURS=$((HOURS % 24)) + SUB_MINUTES=$((MINUTES % 60)) + + if [[ -n $(git status -s 2> /dev/null) ]]; then + if [ "$MINUTES" -gt 30 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" + elif [ "$MINUTES" -gt 10 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM" + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + fi + + if [ "$HOURS" -gt 24 ]; then + echo "[$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}]" + elif [ "$MINUTES" -gt 60 ]; then + echo "[$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}]" + else + echo "[$COLOR${MINUTES}m%{$reset_color%}]" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + echo "[$COLOR~]" + fi + fi +} + +PROMPT=' +%{$fg[blue]%}%m%{$reset_color%} 福 %{$fg[cyan]%}%~ %{$reset_color%}$(git_prompt_short_sha)$(git_prompt_info) +%{$fg[red]%}%!%{$reset_color%} $(prompt_char) : ' + +RPROMPT='${return_status}$(git_time_since_commit)$(git_prompt_status)%{$reset_color%}' diff --git a/oh-my-zsh/themes/sonicradish.zsh-theme b/oh-my-zsh/themes/sonicradish.zsh-theme @@ -0,0 +1,37 @@ +#!/usr/bin/env zsh +#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +setopt promptsubst + +autoload -U add-zsh-hook +ROOT_ICON_COLOR=$FG[111] +MACHINE_NAME_COLOR=$FG[208] +PROMPT_SUCCESS_COLOR=$FG[103] +PROMPT_FAILURE_COLOR=$FG[124] +PROMPT_VCS_INFO_COLOR=$FG[242] +PROMPT_PROMPT=$FG[208] +GIT_DIRTY_COLOR=$FG[124] +GIT_CLEAN_COLOR=$FG[148] +GIT_PROMPT_INFO=$FG[148] + +# Hash +ROOT_ICON="# " +if [[ $EUID -ne 0 ]] ; then + ROOT_ICON="" +fi + +PROMPT='%{$ROOT_ICON_COLOR%}$ROOT_ICON%{$reset_color%}%{$MACHINE_NAME_COLOR%}%m➜ %{$reset_color%}%{$PROMPT_SUCCESS_COLOR%}%c%{$reset_color%} %{$GIT_PROMPT_INFO%}$(git_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ %{$reset_color%} ' + +#RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX=": " +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%} :" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔" + +ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[103]%}✚%{$rset_color%}" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[103]%}✹%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[103]%}✖%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[103]%}➜%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[103]%}═%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[103]%}✭%{$reset_color%}" diff --git a/oh-my-zsh/themes/sorin.zsh-theme b/oh-my-zsh/themes/sorin.zsh-theme @@ -0,0 +1,42 @@ +# sorin.zsh-theme +# screenshot: http://i.imgur.com/aipDQ.png + +if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then + MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" + local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}" + + PROMPT='%{$fg[cyan]%}%c$(git_prompt_info) %(!.%{$fg_bold[red]%}#.%{$fg_bold[green]%}❯)%{$reset_color%} ' + + ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}git%{$reset_color%}:%{$fg[red]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + ZSH_THEME_GIT_PROMPT_DIRTY="" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + RPROMPT='${return_status}$(git_prompt_status)%{$reset_color%}' + + ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" + ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" + ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" + ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" + ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" + ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" +else + MODE_INDICATOR="❮❮❮" + local return_status="%(?::⏎)" + + PROMPT='%c$(git_prompt_info) %(!.#.❯) ' + + ZSH_THEME_GIT_PROMPT_PREFIX=" git:" + ZSH_THEME_GIT_PROMPT_SUFFIX="" + ZSH_THEME_GIT_PROMPT_DIRTY="" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + RPROMPT='${return_status}$(git_prompt_status)' + + ZSH_THEME_GIT_PROMPT_ADDED=" ✚" + ZSH_THEME_GIT_PROMPT_MODIFIED=" ✹" + ZSH_THEME_GIT_PROMPT_DELETED=" ✖" + ZSH_THEME_GIT_PROMPT_RENAMED=" ➜" + ZSH_THEME_GIT_PROMPT_UNMERGED=" ═" + ZSH_THEME_GIT_PROMPT_UNTRACKED=" ✭" +fi diff --git a/oh-my-zsh/themes/sporty_256.zsh-theme b/oh-my-zsh/themes/sporty_256.zsh-theme @@ -0,0 +1,13 @@ +# zsh theme requires 256 color enabled terminal +# i.e TERM=xterm-256color +# Preview - http://www.flickr.com/photos/adelcampo/4556482563/sizes/o/ +# based on robbyrussell's shell but louder! + +PROMPT='%{$fg_bold[blue]%}$(git_prompt_info) %F{208}%c%f +%{$fg_bold[white]%}%# %{$reset_color%}' +RPROMPT='%B%F{208}%n%f%{$fg_bold[white]%}@%F{039}%m%f%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%F{154}±|%f%F{124}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}%B✘%b%F{154}|%f%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%F{154}|" diff --git a/oh-my-zsh/themes/steeef.zsh-theme b/oh-my-zsh/themes/steeef.zsh-theme @@ -0,0 +1,100 @@ +# prompt style and colors based on Steve Losh's Prose theme: +# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme +# +# vcs_info modifications from Bart Trojanowski's zsh prompt: +# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt +# +# git untracked files modification from Brian Carper: +# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt + +export VIRTUAL_ENV_DISABLE_PROMPT=1 + +function virtualenv_info { + [ $VIRTUAL_ENV ] && echo '('%F{blue}`basename $VIRTUAL_ENV`%f') ' +} +PR_GIT_UPDATE=1 + +setopt prompt_subst + +autoload -U add-zsh-hook +autoload -Uz vcs_info + +#use extended color palette if available +if [[ $terminfo[colors] -ge 256 ]]; then + turquoise="%F{81}" + orange="%F{166}" + purple="%F{135}" + hotpink="%F{161}" + limegreen="%F{118}" +else + turquoise="%F{cyan}" + orange="%F{yellow}" + purple="%F{magenta}" + hotpink="%F{red}" + limegreen="%F{green}" +fi + +# enable VCS systems you use +zstyle ':vcs_info:*' enable git svn + +# check-for-changes can be really slow. +# you should disable it, if you work with large repositories +zstyle ':vcs_info:*:prompt:*' check-for-changes true + +# set formats +# %b - branchname +# %u - unstagedstr (see below) +# %c - stagedstr (see below) +# %a - action (e.g. rebase-i) +# %R - repository path +# %S - path in the repository +PR_RST="%f" +FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})" +FMT_ACTION="(%{$limegreen%}%a${PR_RST})" +FMT_UNSTAGED="%{$orange%}●" +FMT_STAGED="%{$limegreen%}●" + +zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}" +zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}" +zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}" +zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" +zstyle ':vcs_info:*:prompt:*' nvcsformats "" + + +function steeef_preexec { + case "$(history $HISTCMD)" in + *git*) + PR_GIT_UPDATE=1 + ;; + *svn*) + PR_GIT_UPDATE=1 + ;; + esac +} +add-zsh-hook preexec steeef_preexec + +function steeef_chpwd { + PR_GIT_UPDATE=1 +} +add-zsh-hook chpwd steeef_chpwd + +function steeef_precmd { + if [[ -n "$PR_GIT_UPDATE" ]] ; then + # check for untracked files or updated submodules, since vcs_info doesn't + if git ls-files --other --exclude-standard 2> /dev/null | grep -q "."; then + PR_GIT_UPDATE=1 + FMT_BRANCH="(%{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST})" + else + FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})" + fi + zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH} " + + vcs_info 'prompt' + PR_GIT_UPDATE= + fi +} +add-zsh-hook precmd steeef_precmd + +PROMPT=$' +%{$purple%}%n${PR_RST} at %{$orange%}%m${PR_RST} in %{$limegreen%}%~${PR_RST} $vcs_info_msg_0_$(virtualenv_info) +$ ' diff --git a/oh-my-zsh/themes/strug.zsh-theme b/oh-my-zsh/themes/strug.zsh-theme @@ -0,0 +1,25 @@ +# terminal coloring +export CLICOLOR=1 +export LSCOLORS=dxFxCxDxBxegedabagacad + +local git_branch='$(git_prompt_info)%{$reset_color%}$(git_remote_status)' + +PROMPT="%{$fg[green]%}╭─%n@%m %{$reset_color%}%{$fg[yellow]%}in %~ %{$reset_color%}${git_branch} +%{$fg[green]%}╰\$ %{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%}on " +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_DIRTY="%{$reset_color%}%{$fg[red]%} ✘ %{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ✔ %{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED=true +ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX="%{$fg[yellow]%}(" +ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX="%{$fg[yellow]%})%{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=" +" +ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR=%{$fg[green]%} + +ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE=" -" +ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR=%{$fg[red]%} + diff --git a/oh-my-zsh/themes/sunaku.zsh-theme b/oh-my-zsh/themes/sunaku.zsh-theme @@ -0,0 +1,26 @@ +# Git-centric variation of the "fishy" theme. +# See screenshot at http://ompldr.org/vOHcwZg + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}+" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[magenta]%}!" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}-" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}>" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}#" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[yellow]%}?" + +ZSH_THEME_GIT_PROMPT_PREFIX="" +ZSH_THEME_GIT_PROMPT_SUFFIX=" " +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +local user_color='green' +test $UID -eq 0 && user_color='red' + +PROMPT='%(?..%{$fg_bold[red]%}exit %? +%{$reset_color%})'\ +'%{$bold_color%}$(git_prompt_status)%{$reset_color%}'\ +'$(git_prompt_info)'\ +'%{$fg[$user_color]%}%~%{$reset_color%}'\ +'%(!.#.>) ' + +PROMPT2='%{$fg[red]%}\ %{$reset_color%}' diff --git a/oh-my-zsh/themes/sunrise.zsh-theme b/oh-my-zsh/themes/sunrise.zsh-theme @@ -0,0 +1,93 @@ +# Sunrise theme for oh-my-zsh +# Intended to be used with Solarized: http://ethanschoonover.com/solarized + +# Color shortcuts +R=$fg_no_bold[red] +G=$fg_no_bold[green] +M=$fg_no_bold[magenta] +Y=$fg_no_bold[yellow] +B=$fg_no_bold[blue] +RESET=$reset_color + +if [ "$USER" = "root" ]; then + PROMPTCOLOR="%{$R%}" PROMPTPREFIX="-!-"; +else + PROMPTCOLOR="" PROMPTPREFIX="---"; +fi + +local return_code="%(?..%{$R%}%? ↵%{$RESET%})" + +# Get the status of the working tree (copied and modified from git.zsh) +custom_git_prompt_status() { + INDEX=$(git status --porcelain 2> /dev/null) + STATUS="" + # Non-staged + if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" + fi + if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" + fi + if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" + fi + if $(echo "$INDEX" | grep '^.M ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" + elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" + elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" + fi + # Staged + if $(echo "$INDEX" | grep '^D ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_DELETED$STATUS" + fi + if $(echo "$INDEX" | grep '^R' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_RENAMED$STATUS" + fi + if $(echo "$INDEX" | grep '^M' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_MODIFIED$STATUS" + fi + if $(echo "$INDEX" | grep '^A' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_ADDED$STATUS" + fi + + if $(echo -n "$STATUS" | grep '.*' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_STATUS_PREFIX$STATUS" + fi + + echo $STATUS +} + +# get the name of the branch we are on (copied and modified from git.zsh) +function custom_git_prompt() { + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$(git_prompt_ahead)$(custom_git_prompt_status)$ZSH_THEME_GIT_PROMPT_SUFFIX" +} + +# %B sets bold text +PROMPT='%B$PROMPTPREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} ' +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$Y%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$Y%}›%{$RESET%} " + +ZSH_THEME_GIT_PROMPT_DIRTY="%{$R%}*" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +ZSH_THEME_GIT_PROMPT_AHEAD="%{$B%}➔" + + +ZSH_THEME_GIT_STATUS_PREFIX=" " + +# Staged +ZSH_THEME_GIT_PROMPT_STAGED_ADDED="%{$G%}A" +ZSH_THEME_GIT_PROMPT_STAGED_MODIFIED="%{$G%}M" +ZSH_THEME_GIT_PROMPT_STAGED_RENAMED="%{$G%}R" +ZSH_THEME_GIT_PROMPT_STAGED_DELETED="%{$G%}D" + +# Not-staged +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$R%}?" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$R%}M" +ZSH_THEME_GIT_PROMPT_DELETED="%{$R%}D" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$R%}UU" diff --git a/oh-my-zsh/themes/superjarin.zsh-theme b/oh-my-zsh/themes/superjarin.zsh-theme @@ -0,0 +1,18 @@ +# Grab the current version of ruby in use: [ruby-1.8.7] +JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(ruby_prompt_info)%{$fg[white]%}]%{$reset_color%}" + +# Grab the current filepath, use shortcuts: ~/Desktop +# Append the current git branch, if in a git repository +JARIN_CURRENT_LOCA_="%{$fg_bold[cyan]%}%~\$(git_prompt_info)%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%} <%{$fg[magenta]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[white]%}" + +# Do nothing if the branch is clean (no changes). +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[white]%}>" + +# Add a yellow ✗ if the branch is dirty +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[white]%}> %{$fg[yellow]%}✗" + +# Put it all together! +PROMPT="$JARIN_CURRENT_RUBY_ $JARIN_CURRENT_LOCA_ " + diff --git a/oh-my-zsh/themes/suvash.zsh-theme b/oh-my-zsh/themes/suvash.zsh-theme @@ -0,0 +1,34 @@ +function prompt_char { + git branch >/dev/null 2>/dev/null && echo '±' && return + hg root >/dev/null 2>/dev/null && echo 'Hg' && return + echo '○' +} + +function virtualenv_info { + [[ -n "$VIRTUAL_ENV" ]] && echo '('${VIRTUAL_ENV:t}') ' +} + +function ruby_prompt { + if (( $+commands[rvm-prompt] )); then + print -n $ZSH_THEME_RUBY_PROMPT_PREFIX + print -n $(~/.rvm/bin/rvm-prompt) + print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX + elif (( $+commands[rbenv] )); then + print -n $ZSH_THEME_RUBY_PROMPT_PREFIX + print -n $(rbenv version | sed -e "s/ (set.*$//") + print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX + fi + return 0 +} + +PROMPT='%F{magenta}%n%f at %F{yellow}%m%f in %B%F{green}%~%f%b$(git_prompt_info)$(ruby_prompt) +$(virtualenv_info) $(prompt_char) ' + +ZSH_THEME_GIT_PROMPT_PREFIX=' on %F{magenta}' +ZSH_THEME_GIT_PROMPT_SUFFIX='%f' +ZSH_THEME_GIT_PROMPT_DIRTY='%F{green}!' +ZSH_THEME_GIT_PROMPT_UNTRACKED='%F{green}?' +ZSH_THEME_GIT_PROMPT_CLEAN='' + +ZSH_THEME_RUBY_PROMPT_PREFIX=' using %F{red}' +ZSH_THEME_RUBY_PROMPT_SUFFIX='%f' diff --git a/oh-my-zsh/themes/takashiyoshida.zsh-theme b/oh-my-zsh/themes/takashiyoshida.zsh-theme @@ -0,0 +1,27 @@ +# +# PROMPT +# +PROMPT_BRACKET_BEGIN='%{$fg_bold[white]%}[' +PROMPT_HOST='%{$fg_bold[cyan]%}%m' +PROMPT_SEPARATOR='%{$reset_color%}:' +PROMPT_DIR='%{$fg_bold[yellow]%}%c' +PROMPT_BRACKET_END='%{$fg_bold[white]%}]' + +PROMPT_USER='%{$fg_bold[white]%}%n' +PROMPT_SIGN='%{$reset_color%}%#' + +GIT_PROMPT_INFO='$(git_prompt_info)' + +# My current prompt looks like: +# [host:current_dir] (git_prompt_info) +# [username]% +PROMPT="${PROMPT_BRACKET_BEGIN}${PROMPT_HOST}${PROMPT_SEPARATOR}${PROMPT_DIR}${PROMPT_BRACKET_END}${GIT_PROMPT_INFO} +${PROMPT_BRACKET_BEGIN}${PROMPT_USER}${PROMPT_BRACKET_END}${PROMPT_SIGN} " + +# +# Git repository +# +ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" +ZSH_THEME_GIT_PROMPT_CLEAN='' diff --git a/oh-my-zsh/themes/terminalparty.zsh-theme b/oh-my-zsh/themes/terminalparty.zsh-theme @@ -0,0 +1,8 @@ +PROMPT='%(?,%{$fg[green]%},%{$fg[red]%}) %% ' +# RPS1='%{$fg[blue]%}%~%{$reset_color%} ' +RPS1='%{$fg[white]%}%2~$(git_prompt_info) %{$fg_bold[blue]%}%m%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ⚡%{$fg[yellow]%}" diff --git a/oh-my-zsh/themes/theunraveler.zsh-theme b/oh-my-zsh/themes/theunraveler.zsh-theme @@ -0,0 +1,16 @@ +# Comment + +PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}' + +RPROMPT='%{$fg[magenta]%}$(git_prompt_info)%{$reset_color%} $(git_prompt_status)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ✂" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ✱"+ \ No newline at end of file diff --git a/oh-my-zsh/themes/tjkirch.zsh-theme b/oh-my-zsh/themes/tjkirch.zsh-theme @@ -0,0 +1,15 @@ +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}⚡" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +function prompt_char { + if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi +} + +PROMPT='%(?, ,%{$fg[red]%}FAIL: $?%{$reset_color%} +) +%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) +%_$(prompt_char) ' + +RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' diff --git a/oh-my-zsh/themes/tjkirch_mod.zsh-theme b/oh-my-zsh/themes/tjkirch_mod.zsh-theme @@ -0,0 +1,13 @@ +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}⚡" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +function prompt_char { + if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi +} + +PROMPT='%(?,,%{$fg[red]%}FAIL: $?%{$reset_color%} +)%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) %_$(prompt_char) ' + +RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' diff --git a/oh-my-zsh/themes/tonotdo.zsh-theme b/oh-my-zsh/themes/tonotdo.zsh-theme @@ -0,0 +1,12 @@ +PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[magenta]%}➜%{$fg_no_bold[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' +RPROMPT='[%*]' + +# git theming +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[blue]%})" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[yellow]%}✗%{$fg_bold[blue]%})" + +# LS colors, made with http://geoff.greer.fm/lscolors/ +export LSCOLORS="Gxfxcxdxbxegedabagacad" +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:'+ \ No newline at end of file diff --git a/oh-my-zsh/themes/trapd00r.zsh-theme b/oh-my-zsh/themes/trapd00r.zsh-theme @@ -0,0 +1,94 @@ +# trapd00r.zsh-theme +# +# This theme needs a terminal supporting 256 colors as well as unicode. It also +# needs the script that splits up the current path and makes it fancy as located +# here: https://github.com/trapd00r/utils/blob/master/zsh_path +# +# By default it spans over two lines like so: +# +# scp1@shiva:pts/9-> /home » scp1 (0) +# > +# +# that's user@host:pts/-> splitted path (return status) +# +# If the current directory is a git repository, we span 3 lines; +# +# git❨ master ❩ DIRTY +# scp1@shiva:pts/4-> /home » scp1 » dev » utils (0) +# > + +autoload -U add-zsh-hook +autoload -Uz vcs_info + +local c0=$( printf "\e[m") +local c1=$( printf "\e[38;5;245m") +local c2=$( printf "\e[38;5;250m") +local c3=$( printf "\e[38;5;242m") +local c4=$( printf "\e[38;5;197m") +local c5=$( printf "\e[38;5;225m") +local c6=$( printf "\e[38;5;240m") +local c7=$( printf "\e[38;5;242m") +local c8=$( printf "\e[38;5;244m") +local c9=$( printf "\e[38;5;162m") +local c10=$(printf "\e[1m") +local c11=$(printf "\e[38;5;208m\e[1m") +local c12=$(printf "\e[38;5;142m\e[1m") +local c13=$(printf "\e[38;5;196m\e[1m") + + +# We don't want to use the extended colorset in the TTY / VC. +if [ "$TERM" = "linux" ]; then + c1=$( printf "\e[34;1m") + c2=$( printf "\e[35m") + c3=$( printf "\e[31m") + c4=$( printf "\e[31;1m") + c5=$( printf "\e[32m") + c6=$( printf "\e[32;1m") + c7=$( printf "\e[33m") + c8=$( printf "\e[33;1m") + c9=$( printf "\e[34m") + + c11=$(printf "\e[35;1m") + c12=$(printf "\e[36m") + c13=$(printf "\e[31;1m") +fi + +zstyle ':vcs_info:*' actionformats \ + '%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' + +zstyle ':vcs_info:*' formats \ + "%{$c8%}%s%%{$c7%}❨ %{$c9%}%{$c11%}%b%{$c7%} ❩%{$reset_color%}%f " + +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' +zstyle ':vcs_info:*' enable git + +add-zsh-hook precmd prompt_jnrowe_precmd + +prompt_jnrowe_precmd () { + vcs_info + if [ "${vcs_info_msg_0_}" = "" ]; then + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} +> ' + +# modified, to be committed + elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} +> ' + + elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} +%{$c13%}>%{$c0%} ' + else + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='${vcs_info_msg_0_} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} +> ' +fi +} + +# vim: set ft=zsh sw=2 et tw=0: diff --git a/oh-my-zsh/themes/wedisagree.zsh-theme b/oh-my-zsh/themes/wedisagree.zsh-theme @@ -0,0 +1,108 @@ +# On a mac with snow leopard, for nicer terminal colours: + +# - Install SIMBL: http://www.culater.net/software/SIMBL/SIMBL.php +# - Download'Terminal-Colours': http://bwaht.net/code/TerminalColours.bundle.zip +# - Place that bundle in ~/Library/Application\ Support/SIMBL/Plugins (create that folder if it doesn't exist) +# - Open Terminal preferences. Go to Settings -> Text -> More +# - Change default colours to your liking. +# +# Here are the colours from Textmate's Monokai theme: +# +# Black: 0, 0, 0 +# Red: 229, 34, 34 +# Green: 166, 227, 45 +# Yellow: 252, 149, 30 +# Blue: 196, 141, 255 +# Magenta: 250, 37, 115 +# Cyan: 103, 217, 240 +# White: 242, 242, 242 + +# Thanks to Steve Losh: http://stevelosh.com/blog/2009/03/candy-colored-terminal/ + +# The prompt + +PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}' + +# The right-hand prompt + +RPROMPT='${time} %{$fg[magenta]%}$(git_prompt_info)%{$reset_color%}$(git_prompt_status)%{$reset_color%}$(git_prompt_ahead)%{$reset_color%}' + +# Add this at the start of RPROMPT to include rvm info showing ruby-version@gemset-name +# %{$fg[yellow]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%} + +# local time, color coded by last return code +time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}" +time_disabled="%{$fg[green]%}%*%{$reset_color%}" +time=$time_enabled + +ZSH_THEME_GIT_PROMPT_PREFIX=" ☁ %{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%} ☂" # Ⓓ +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" # ⓣ +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ☀" # Ⓞ + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✚" # ⓐ ⑃ +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ⚡" # ⓜ ⑁ +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" # ⓧ ⑂ +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➜" # ⓡ ⑄ +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ♒" # ⓤ ⑊ +ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[blue]%} 𝝙" + +# More symbols to choose from: +# ☀ ✹ ☄ ♆ ♀ ♁ ♐ ♇ ♈ ♉ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♣ ⚢ ⚲ ⚳ ⚴ ⚥ ⚤ ⚦ ⚒ ⚑ ⚐ ♺ ♻ ♼ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷ +# ✡ ✔ ✖ ✚ ✱ ✤ ✦ ❤ ➜ ➟ ➼ ✂ ✎ ✐ ⨀ ⨁ ⨂ ⨍ ⨎ ⨏ ⨷ ⩚ ⩛ ⩡ ⩱ ⩲ ⩵ ⩶ ⨠ +# ⬅ ⬆ ⬇ ⬈ ⬉ ⬊ ⬋ ⬒ ⬓ ⬔ ⬕ ⬖ ⬗ ⬘ ⬙ ⬟ ⬤ 〒 ǀ ǁ ǂ ĭ Ť Ŧ + +# Determine if we are using a gemset. +function rvm_gemset() { + GEMSET=`rvm gemset list | grep '=>' | cut -b4-` + if [[ -n $GEMSET ]]; then + echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|" + fi +} + +# Determine the time since last commit. If branch is clean, +# use a neutral color, otherwise colors will vary according to time. +function git_time_since_commit() { + if git rev-parse --git-dir > /dev/null 2>&1; then + # Only proceed if there is actually a commit. + if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then + # Get the last commit. + last_commit=`git log --pretty=format:'%at' -1 2> /dev/null` + now=`date +%s` + seconds_since_last_commit=$((now-last_commit)) + + # Totals + MINUTES=$((seconds_since_last_commit / 60)) + HOURS=$((seconds_since_last_commit/3600)) + + # Sub-hours and sub-minutes + DAYS=$((seconds_since_last_commit / 86400)) + SUB_HOURS=$((HOURS % 24)) + SUB_MINUTES=$((MINUTES % 60)) + + if [[ -n $(git status -s 2> /dev/null) ]]; then + if [ "$MINUTES" -gt 30 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" + elif [ "$MINUTES" -gt 10 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM" + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + fi + + if [ "$HOURS" -gt 24 ]; then + echo "($(rvm_gemset)$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + elif [ "$MINUTES" -gt 60 ]; then + echo "($(rvm_gemset)$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + else + echo "($(rvm_gemset)$COLOR${MINUTES}m%{$reset_color%}|" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + echo "($(rvm_gemset)$COLOR~|" + fi + fi +} diff --git a/oh-my-zsh/themes/wezm+.zsh-theme b/oh-my-zsh/themes/wezm+.zsh-theme @@ -0,0 +1,7 @@ +PROMPT='%{${fg_bold[yellow]}%}%n%{$reset_color%}%{${fg[yellow]}%}@%m%{$reset_color%} $(git_prompt_info)%(?,,%{${fg_bold[white]}%}[%?]%{$reset_color%} )%{$fg[yellow]%}%#%{$reset_color%} ' +RPROMPT='%{$fg[green]%}%~%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[blue]%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[red]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/oh-my-zsh/themes/wezm.zsh-theme b/oh-my-zsh/themes/wezm.zsh-theme @@ -0,0 +1,7 @@ +PROMPT='$(git_prompt_info)%(?,,%{${fg_bold[white]}%}[%?]%{$reset_color%} )%{$fg[yellow]%}%#%{$reset_color%} ' +RPROMPT='%{$fg[green]%}%~%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[blue]%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[red]%}⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/oh-my-zsh/themes/wuffers.zsh-theme b/oh-my-zsh/themes/wuffers.zsh-theme @@ -0,0 +1,5 @@ +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} x%{$fg_bold[blue]%}" + +PROMPT='%{$(git_prompt_info)%}%{$fg_bold[green]%}{%{$(rvm current 2>/dev/null || rbenv version-name 2>/dev/null)%}}%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} ' diff --git a/oh-my-zsh/themes/xiong-chiamiov-plus.zsh-theme b/oh-my-zsh/themes/xiong-chiamiov-plus.zsh-theme @@ -0,0 +1,6 @@ +# user, host, full path, and time/date +# on two lines for easier vgrepping +# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 +PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %H:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(git_prompt_info)>%{\e[0m%}%b ' +PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' diff --git a/oh-my-zsh/themes/xiong-chiamiov.zsh-theme b/oh-my-zsh/themes/xiong-chiamiov.zsh-theme @@ -0,0 +1,6 @@ +# user, host, full path, and time/date +# on two lines for easier vgrepping +# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 +PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %H:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]>%{\e[0m%}%b ' +PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' diff --git a/oh-my-zsh/themes/ys.zsh-theme b/oh-my-zsh/themes/ys.zsh-theme @@ -0,0 +1,60 @@ +# Clean, simple, compatible and meaningful. +# Tested on Linux, Unix and Windows under ANSI colors. +# It is recommended to use with a dark background. +# Colors: black, red, green, yellow, *blue, magenta, cyan, and white. +# +# Mar 2013 Yad Smood + +# VCS +YS_VCS_PROMPT_PREFIX1=" %{$fg[white]%}on%{$reset_color%} " +YS_VCS_PROMPT_PREFIX2=":%{$fg[cyan]%}" +YS_VCS_PROMPT_SUFFIX="%{$reset_color%}" +YS_VCS_PROMPT_DIRTY=" %{$fg[red]%}x" +YS_VCS_PROMPT_CLEAN=" %{$fg[green]%}o" + +# Git info +local git_info='$(git_prompt_info)' +ZSH_THEME_GIT_PROMPT_PREFIX="${YS_VCS_PROMPT_PREFIX1}git${YS_VCS_PROMPT_PREFIX2}" +ZSH_THEME_GIT_PROMPT_SUFFIX="$YS_VCS_PROMPT_SUFFIX" +ZSH_THEME_GIT_PROMPT_DIRTY="$YS_VCS_PROMPT_DIRTY" +ZSH_THEME_GIT_PROMPT_CLEAN="$YS_VCS_PROMPT_CLEAN" + +# HG info +local hg_info='$(ys_hg_prompt_info)' +ys_hg_prompt_info() { + # make sure this is a hg dir + if [ -d '.hg' ]; then + echo -n "${YS_VCS_PROMPT_PREFIX1}hg${YS_VCS_PROMPT_PREFIX2}" + echo -n $(hg branch 2>/dev/null) + if [ -n "$(hg status 2>/dev/null)" ]; then + echo -n "$YS_VCS_PROMPT_DIRTY" + else + echo -n "$YS_VCS_PROMPT_CLEAN" + fi + echo -n "$YS_VCS_PROMPT_SUFFIX" + fi +} + +local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})" + +# Prompt format: +# +# PRIVILEGES USER @ MACHINE in DIRECTORY on git:BRANCH STATE [TIME] C:LAST_EXIT_CODE +# $ COMMAND +# +# For example: +# +# % ys @ ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] C:0 +# $ +PROMPT=" +%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ +%(#,%{$bg[yellow]%}%{$fg[black]%}%n%{$reset_color%},%{$fg[cyan]%}%n) \ +%{$fg[white]%}@ \ +%{$fg[green]%}%m \ +%{$fg[white]%}in \ +%{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\ +${hg_info}\ +${git_info}\ + \ +%{$fg[white]%}[%*] $exit_code +%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" diff --git a/oh-my-zsh/themes/zhann.zsh-theme b/oh-my-zsh/themes/zhann.zsh-theme @@ -0,0 +1,23 @@ +autoload -Uz vcs_info + +zstyle ':vcs_info:*' stagedstr '%F{green}●' +zstyle ':vcs_info:*' unstagedstr '%F{yellow}●' +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r' +zstyle ':vcs_info:*' enable git svn +theme_precmd () { + if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] { + zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]' + } else { + zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{red}●%F{green}]' + } + + vcs_info +} + +setopt prompt_subst +PROMPT='%B%F{blue}%c%B%F{green}${vcs_info_msg_0_}%B%F{magenta} %{$reset_color%}% ' + +autoload -U add-zsh-hook +add-zsh-hook precmd theme_precmd + diff --git a/oh-my-zsh/tools/check_for_upgrade.sh b/oh-my-zsh/tools/check_for_upgrade.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env zsh + +zmodload zsh/datetime + +function _current_epoch() { + echo $(( $EPOCHSECONDS / 60 / 60 / 24 )) +} + +function _update_zsh_update() { + echo "LAST_EPOCH=$(_current_epoch)" >! ~/.zsh-update +} + +function _upgrade_zsh() { + env ZSH=$ZSH sh $ZSH/tools/upgrade.sh + # update the zsh file + _update_zsh_update +} + +epoch_target=$UPDATE_ZSH_DAYS +if [[ -z "$epoch_target" ]]; then + # Default to old behavior + epoch_target=13 +fi + +# Cancel upgrade if the current user doesn't have write permissions for the +# oh-my-zsh directory. +[[ -w "$ZSH" ]] || return 0 + +# Cancel upgrade if git is unavailable on the system +whence git >/dev/null || return 0 + +if mkdir "$ZSH/log/update.lock" 2>/dev/null; then + if [ -f ~/.zsh-update ]; then + . ~/.zsh-update + + if [[ -z "$LAST_EPOCH" ]]; then + _update_zsh_update && return 0; + fi + + epoch_diff=$(($(_current_epoch) - $LAST_EPOCH)) + if [ $epoch_diff -gt $epoch_target ]; then + if [ "$DISABLE_UPDATE_PROMPT" = "true" ]; then + _upgrade_zsh + else + echo "[Oh My Zsh] Would you like to check for updates? [Y/n]: \c" + read line + if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then + _upgrade_zsh + else + _update_zsh_update + fi + fi + fi + else + # create the zsh file + _update_zsh_update + fi + + rmdir $ZSH/log/update.lock +fi diff --git a/oh-my-zsh/tools/install.sh b/oh-my-zsh/tools/install.sh @@ -0,0 +1,116 @@ +main() { + # Use colors, but only if connected to a terminal, and that terminal + # supports them. + if which tput >/dev/null 2>&1; then + ncolors=$(tput colors) + fi + if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then + RED="$(tput setaf 1)" + GREEN="$(tput setaf 2)" + YELLOW="$(tput setaf 3)" + BLUE="$(tput setaf 4)" + BOLD="$(tput bold)" + NORMAL="$(tput sgr0)" + else + RED="" + GREEN="" + YELLOW="" + BLUE="" + BOLD="" + NORMAL="" + fi + + # Only enable exit-on-error after the non-critical colorization stuff, + # which may fail on systems lacking tput or terminfo + set -e + + CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l) + if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then + printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n" + exit + fi + unset CHECK_ZSH_INSTALLED + + if [ ! -n "$ZSH" ]; then + ZSH=~/.oh-my-zsh + fi + + if [ -d "$ZSH" ]; then + printf "${YELLOW}You already have Oh My Zsh installed.${NORMAL}\n" + printf "You'll need to remove $ZSH if you want to re-install.\n" + exit + fi + + # Prevent the cloned repository from having insecure permissions. Failing to do + # so causes compinit() calls to fail with "command not found: compdef" errors + # for users with insecure umasks (e.g., "002", allowing group writability). Note + # that this will be ignored under Cygwin by default, as Windows ACLs take + # precedence over umasks except for filesystems mounted with option "noacl". + umask g-w,o-w + + printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n" + hash git >/dev/null 2>&1 || { + echo "Error: git is not installed" + exit 1 + } + # The Windows (MSYS) Git is not compatible with normal use on cygwin + if [ "$OSTYPE" = cygwin ]; then + if git --version | grep msysgit > /dev/null; then + echo "Error: Windows/MSYS Git is not supported on Cygwin" + echo "Error: Make sure the Cygwin git package is installed and is first on the path" + exit 1 + fi + fi + env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { + printf "Error: git clone of oh-my-zsh repo failed\n" + exit 1 + } + + + printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n" + if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then + printf "${YELLOW}Found ~/.zshrc.${NORMAL} ${GREEN}Backing up to ~/.zshrc.pre-oh-my-zsh${NORMAL}\n"; + mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh; + fi + + printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n" + cp $ZSH/templates/zshrc.zsh-template ~/.zshrc + sed "/^export ZSH=/ c\\ + export ZSH=$ZSH + " ~/.zshrc > ~/.zshrc-omztemp + mv -f ~/.zshrc-omztemp ~/.zshrc + + # If this user's login shell is not already "zsh", attempt to switch. + TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') + if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then + # If this platform provides a "chsh" command (not Cygwin), do it, man! + if hash chsh >/dev/null 2>&1; then + printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n" + chsh -s $(grep /zsh$ /etc/shells | tail -1) + # Else, suggest the user do so manually. + else + printf "I can't change your shell automatically because this system does not have chsh.\n" + printf "${BLUE}Please manually change your default shell to zsh!${NORMAL}\n" + fi + fi + + printf "${GREEN}" + echo ' __ __ ' + echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' + echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' + echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' + echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' + echo ' /____/ ....is now installed!' + echo '' + echo '' + echo 'Please look over the ~/.zshrc file to select plugins, themes, and options.' + echo '' + echo 'p.s. Follow us at https://twitter.com/ohmyzsh.' + echo '' + echo 'p.p.s. Get stickers and t-shirts at https://shop.planetargon.com.' + echo '' + printf "${NORMAL}" + env zsh +} + +main diff --git a/oh-my-zsh/tools/require_tool.sh b/oh-my-zsh/tools/require_tool.sh @@ -0,0 +1,161 @@ +__require_tool_version_compare () +{ + ( + # Locally ignore failures, otherwise we'll exit whenever $1 and $2 + # are not equal! + set +e + +awk_strverscmp=' + # Use only awk features that work with 7th edition Unix awk (1978). + # My, what an old awk you have, Mr. Solaris! + END { + while (length(v1) || length(v2)) { + # Set d1 to be the next thing to compare from v1, and likewise for d2. + # Normally this is a single character, but if v1 and v2 contain digits, + # compare them as integers and fractions as strverscmp does. + if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) { + # Split v1 and v2 into their leading digit string components d1 and d2, + # and advance v1 and v2 past the leading digit strings. + for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue + for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue + d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1) + d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1) + if (d1 ~ /^0/) { + if (d2 ~ /^0/) { + # Compare two fractions. + while (d1 ~ /^0/ && d2 ~ /^0/) { + d1 = substr(d1, 2); len1-- + d2 = substr(d2, 2); len2-- + } + if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) { + # The two components differ in length, and the common prefix + # contains only leading zeros. Consider the longer to be less. + d1 = -len1 + d2 = -len2 + } else { + # Otherwise, compare as strings. + d1 = "x" d1 + d2 = "x" d2 + } + } else { + # A fraction is less than an integer. + exit 1 + } + } else { + if (d2 ~ /^0/) { + # An integer is greater than a fraction. + exit 2 + } else { + # Compare two integers. + d1 += 0 + d2 += 0 + } + } + } else { + # The normal case, without worrying about digits. + if (v1 == "") d1 = v1; else { d1 = substr(v1, 1, 1); v1 = substr(v1,2) } + if (v2 == "") d2 = v2; else { d2 = substr(v2, 1, 1); v2 = substr(v2,2) } + } + if (d1 < d2) exit 1 + if (d1 > d2) exit 2 + } + } +' + awk "$awk_strverscmp" v1="$1" v2="$2" /dev/null + case $? in + 1) echo '<';; + 0) echo '=';; + 2) echo '>';; + esac + ) +} + + +__require_tool_fatal () +{ + echo $@ >/dev/stderr + return 1 +} + +# Usage: require_tool program version +# Returns: 0 if $1 version if greater equals than $2, 1 otherwise. +# In case of error, message is written on error output. +# +# Example: require_tool gcc 4.6 +# Use GCC environment variable if defined instead of lookup for the tool +# in the environment. +require_tool () +{ + envvar_name=$(echo $1 | tr '[:lower:]' '[:upper:]') + tool=$(printenv $envvar_name || echo $1) + local version=$($tool --version 2>/dev/null| \ + sed -n 's/.*[^0-9.]\([0-9]*\.[0-9.]*\).*/\1/p;q') + if test x"$version" = x ; then + echo "$tool is required" >/dev/stderr + return 1 + fi + case $(__require_tool_version_compare "$2" "$version") in + '>') + echo "$1 $2 or better is required: this is $tool $version" >/dev/stderr + return 1 + ;; + esac +} + +usage() { + cat <<EOF +NAME + require_tool.sh - Ensure version of a tool is greater than the one expected + +SYNOPSYS + require_tool.sh [ -h ] + [ --help ] + [ TOOL MIN_VERSION ] + +DESCRIPTION + TOOL is the name or path of the program to check. If the name is specified, its + path is deduced from PATH environment variable. If environment variable TOOL + (in upper-case characters) is defined, considers its value as path to the tool. + + MIN_VERSION is a string representing the minimum required version. + +BEHAVIOR + * locate path to the program. + * execute $ TOOL_PATH --version + * extract version from standard output. + * compare this version to the expected one. + +OPTIONS + -h --help + Display this message and exit 0 + +ERRORS + if program is not found or its version is prior to expected version, + a message is written to error output. + +EXIT VALUE + returns 0 if program version if greater equals than expected version, + returns 1 otherwise. + +EXAMPLE + $ require_tool.sh emacs 23 + $ CC=g++ require_tool.sh cc 4.6 + $ require_tool.sh zsh 4.5 + +EOF +} + +for arg in $@; do + case $arg in + -h|--help) + usage + exit 0 + ;; + esac +done +if [ $# -gt 2 ] ; then + echo "ERROR: expecting 2 parameters. Please see option --help" + exit 1 +fi + +require_tool $@ diff --git a/oh-my-zsh/tools/theme_chooser.sh b/oh-my-zsh/tools/theme_chooser.sh @@ -0,0 +1,97 @@ +#!/bin/zsh + +# Zsh Theme Chooser by fox (fox91 at anche dot no) +# This program is free software. It comes without any warranty, to +# the extent permitted by applicable law. You can redistribute it +# and/or modify it under the terms of the Do What The Fuck You Want +# To Public License, Version 2, as published by Sam Hocevar. See +# http://sam.zoy.org/wtfpl/COPYING for more details. + +THEMES_DIR="$ZSH/themes" +FAVLIST="${HOME}/.zsh_favlist" +source $ZSH/oh-my-zsh.sh + +function noyes() { + read "a?$1 [y/N] " + if [[ $a == "N" || $a == "n" || $a = "" ]]; then + return 0 + fi + return 1 +} + +function theme_preview() { + THEME=$1 + THEME_NAME=`echo $THEME | sed s/\.zsh-theme$//` + print "$fg[blue]${(l.((${COLUMNS}-${#THEME_NAME}-5))..─.)}$reset_color $THEME_NAME $fg[blue]───$reset_color" + source "$THEMES_DIR/$THEME" + cols=$(tput cols) + print -P "$PROMPT $RPROMPT" +} + +function banner() { + echo + echo "[0;1;35;95m╺━[0;1;31;91m┓┏[0;1;33;93m━┓[0;1;32;92m╻[0m [0;1;36;96m╻[0m [0;1;35;95m╺┳[0;1;31;91m╸╻[0m [0;1;33;93m╻[0;1;32;92m┏━[0;1;36;96m╸┏[0;1;34;94m┳┓[0;1;35;95m┏━[0;1;31;91m╸[0m [0;1;32;92m┏━[0;1;36;96m╸╻[0m [0;1;34;94m╻[0;1;35;95m┏━[0;1;31;91m┓┏[0;1;33;93m━┓[0;1;32;92m┏━[0;1;36;96m┓┏[0;1;34;94m━╸[0;1;35;95m┏━[0;1;31;91m┓[0m" + echo "[0;1;31;91m┏━[0;1;33;93m┛┗[0;1;32;92m━┓[0;1;36;96m┣━[0;1;34;94m┫[0m [0;1;31;91m┃[0m [0;1;33;93m┣[0;1;32;92m━┫[0;1;36;96m┣╸[0m [0;1;34;94m┃[0;1;35;95m┃┃[0;1;31;91m┣╸[0m [0;1;36;96m┃[0m [0;1;34;94m┣[0;1;35;95m━┫[0;1;31;91m┃[0m [0;1;33;93m┃┃[0m [0;1;32;92m┃[0;1;36;96m┗━[0;1;34;94m┓┣[0;1;35;95m╸[0m [0;1;31;91m┣┳[0;1;33;93m┛[0m" + echo "[0;1;33;93m┗━[0;1;32;92m╸┗[0;1;36;96m━┛[0;1;34;94m╹[0m [0;1;35;95m╹[0m [0;1;33;93m╹[0m [0;1;32;92m╹[0m [0;1;36;96m╹[0;1;34;94m┗━[0;1;35;95m╸╹[0m [0;1;31;91m╹[0;1;33;93m┗━[0;1;32;92m╸[0m [0;1;34;94m┗━[0;1;35;95m╸╹[0m [0;1;31;91m╹[0;1;33;93m┗━[0;1;32;92m┛┗[0;1;36;96m━┛[0;1;34;94m┗━[0;1;35;95m┛┗[0;1;31;91m━╸[0;1;33;93m╹┗[0;1;32;92m╸[0m" + echo +} + +function usage() { + echo "Usage: $0 [options] [theme]" + echo + echo "Options" + echo " -l List available themes" + echo " -s Show all themes" + echo " -h Get this help message" + exit 1 +} + +function list_themes() { + for THEME in $(ls $THEMES_DIR); do + THEME_NAME=`echo $THEME | sed s/\.zsh-theme$//` + echo $THEME_NAME + done +} + +function insert_favlist() { + if grep -q "$THEME_NAME" $FAVLIST 2> /dev/null ; then + echo "Already in favlist" + else + echo $THEME_NAME >> $FAVLIST + echo "Saved to favlist" + fi + +} + +function theme_chooser() { + for THEME in $(ls $THEMES_DIR); do + echo + theme_preview $THEME + echo + if [[ -z $1 ]]; then + noyes "Do you want to add it to your favourite list ($FAVLIST)?" || \ + insert_favlist $THEME_NAME + echo + fi + done +} + +while getopts ":lhs" Option +do + case $Option in + l ) list_themes ;; + s ) theme_chooser 0 ;; + h ) usage ;; + * ) usage ;; # Default. + esac +done + +if [[ -z $Option ]]; then + if [[ -z $1 ]]; then + banner + echo + theme_chooser + else + theme_preview $1".zsh-theme" + fi +fi diff --git a/oh-my-zsh/tools/uninstall.sh b/oh-my-zsh/tools/uninstall.sh @@ -0,0 +1,34 @@ +read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation +if [ "$confirmation" != y ] && [ "$confirmation" != Y ]; then + echo "Uninstall cancelled" + exit +fi + +echo "Removing ~/.oh-my-zsh" +if [ -d ~/.oh-my-zsh ]; then + rm -rf ~/.oh-my-zsh +fi + +echo "Looking for original zsh config..." +if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]; then + echo "Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc"; + + if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then + ZSHRC_SAVE=".zshrc.omz-uninstalled-$(date +%Y%m%d%H%M%S)"; + echo "Found ~/.zshrc -- Renaming to ~/${ZSHRC_SAVE}"; + mv ~/.zshrc ~/"${ZSHRC_SAVE}"; + fi + + mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc; + + echo "Your original zsh config was restored. Please restart your session." +else + if hash chsh >/dev/null 2>&1; then + echo "Switching back to bash" + chsh -s /bin/bash + else + echo "You can edit /etc/passwd to switch your default shell back to bash" + fi +fi + +echo "Thanks for trying out Oh My Zsh. It's been uninstalled." diff --git a/oh-my-zsh/tools/upgrade.sh b/oh-my-zsh/tools/upgrade.sh @@ -0,0 +1,39 @@ + +# Use colors, but only if connected to a terminal, and that terminal +# supports them. +if which tput >/dev/null 2>&1; then + ncolors=$(tput colors) +fi +if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then + RED="$(tput setaf 1)" + GREEN="$(tput setaf 2)" + YELLOW="$(tput setaf 3)" + BLUE="$(tput setaf 4)" + BOLD="$(tput bold)" + NORMAL="$(tput sgr0)" +else + RED="" + GREEN="" + YELLOW="" + BLUE="" + BOLD="" + NORMAL="" +fi + +printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh" +cd "$ZSH" +if git pull --rebase --stat origin master +then + printf '%s' "$GREEN" + printf '%s\n' ' __ __ ' + printf '%s\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' + printf '%s\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' + printf '%s\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' + printf '%s\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' + printf '%s\n' ' /____/ ' + printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version." + printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh" + printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/" +else + printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?' +fi diff --git a/shpotify.cfg b/shpotify.cfg @@ -0,0 +1,2 @@ +CLIENT_ID="7ee4bbd51eaf4846850b7382e75405d1" +CLIENT_SECRET="91da8a9660874d2093951b4fe0f29e40" diff --git a/zshrc b/zshrc @@ -0,0 +1 @@ +.zshrc+ \ No newline at end of file