From e7247fa93af50268a9b9781e7bf55b241ab4481b Mon Sep 17 00:00:00 2001 From: EeeeKa Date: Thu, 10 Jun 2021 11:49:35 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20ohmyzsh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zsh/.editorconfig | 8 + zsh/.github/CODEOWNERS | 9 + zsh/.github/FUNDING.yml | 2 + zsh/.github/ISSUE_TEMPLATE/bug_report.md | 46 + zsh/.github/ISSUE_TEMPLATE/config.yml | 8 + zsh/.github/ISSUE_TEMPLATE/feature_request.md | 29 + zsh/.github/PULL_REQUEST_TEMPLATE.md | 19 + zsh/.github/workflows/main.yml | 36 + zsh/.gitignore | 8 + zsh/.gitpod.Dockerfile | 5 + zsh/.gitpod.yml | 9 + zsh/CODE_OF_CONDUCT.md | 76 + zsh/CONTRIBUTING.md | 224 ++ zsh/LICENSE.txt | 5 +- zsh/README.md | 96 +- .../yandex-cloud/yandex-cloud.plugin.zsh | 5 + zsh/{ => custom}/themes/eof.zsh-theme | 0 zsh/lib/cli.zsh | 426 +++ zsh/lib/clipboard.zsh | 125 +- zsh/lib/completion.zsh | 22 +- zsh/lib/diagnostics.zsh | 10 +- zsh/lib/functions.zsh | 21 +- zsh/lib/git.zsh | 233 +- zsh/lib/grep.zsh | 61 +- zsh/lib/history.zsh | 8 +- zsh/lib/key-bindings.zsh | 133 +- zsh/lib/misc.zsh | 22 +- zsh/lib/nvm.zsh | 9 +- zsh/lib/prompt_info_functions.zsh | 1 + zsh/lib/spectrum.zsh | 26 +- zsh/lib/termsupport.zsh | 86 +- zsh/lib/theme-and-appearance.zsh | 5 + zsh/oh-my-zsh.sh | 63 +- .../alias-finder/alias-finder.plugin.zsh | 7 +- zsh/plugins/ansible/ansible.plugin.zsh | 4 +- zsh/plugins/apache2-macports/README.md | 26 +- zsh/plugins/arcanist/README.md | 40 +- zsh/plugins/arcanist/arcanist.plugin.zsh | 18 +- zsh/plugins/archlinux/README.md | 294 +- zsh/plugins/archlinux/archlinux.plugin.zsh | 306 +- zsh/plugins/asdf/asdf.plugin.zsh | 2 +- zsh/plugins/autoenv/README.md | 20 + zsh/plugins/autoenv/autoenv.plugin.zsh | 60 +- zsh/plugins/autojump/README.md | 2 +- zsh/plugins/autojump/autojump.plugin.zsh | 2 +- zsh/plugins/aws/README.md | 41 +- zsh/plugins/aws/aws.plugin.zsh | 188 +- zsh/plugins/battery/README.md | 11 +- zsh/plugins/battery/battery.plugin.zsh | 188 +- zsh/plugins/bazel/README.md | 5 + zsh/plugins/bazel/_bazel | 341 ++ zsh/plugins/bgnotify/bgnotify.plugin.zsh | 2 +- zsh/plugins/bower/README.md | 3 +- zsh/plugins/brew/README.md | 31 +- zsh/plugins/brew/brew.plugin.zsh | 21 +- zsh/plugins/bundler/README.md | 78 +- zsh/plugins/bundler/bundler.plugin.zsh | 117 +- zsh/plugins/cake/README.md | 2 +- zsh/plugins/cakephp3/README.md | 16 + zsh/plugins/cargo/_cargo | 789 ++--- zsh/plugins/catimg/README.md | 24 +- zsh/plugins/chruby/README.md | 20 + zsh/plugins/chucknorris/README.md | 28 +- zsh/plugins/chucknorris/fortunes/chucknorris | 3014 +++-------------- zsh/plugins/cloudapp/README.md | 26 + zsh/plugins/cloudapp/cloudapp.plugin.zsh | 10 +- zsh/plugins/cloudapp/cloudapp.rb | 60 - zsh/plugins/codeclimate/README.md | 8 + zsh/plugins/coffee/README.md | 2 +- zsh/plugins/colemak/README.md | 48 + zsh/plugins/colored-man-pages/README.md | 17 + .../colored-man-pages.plugin.zsh | 74 +- zsh/plugins/colored-man-pages/nroff | 12 + zsh/plugins/colorize/README.md | 53 +- zsh/plugins/colorize/colorize.plugin.zsh | 129 +- zsh/plugins/command-not-found/README.md | 1 + .../command-not-found.plugin.zsh | 92 +- zsh/plugins/common-aliases/README.md | 4 +- .../common-aliases/common-aliases.plugin.zsh | 11 +- zsh/plugins/compleat/README.md | 9 + zsh/plugins/composer/README.md | 32 +- zsh/plugins/composer/composer.plugin.zsh | 40 +- zsh/plugins/copybuffer/copybuffer.plugin.zsh | 4 +- zsh/plugins/copyfile/README.md | 3 +- zsh/plugins/cpanm/README.md | 6 +- zsh/plugins/dash/README.md | 28 + zsh/plugins/dash/dash.plugin.zsh | 52 +- zsh/plugins/debian/debian.plugin.zsh | 4 +- zsh/plugins/deno/.gitignore | 1 + zsh/plugins/deno/README.md | 18 + zsh/plugins/deno/deno.plugin.zsh | 23 + zsh/plugins/dircycle/README.md | 4 +- zsh/plugins/direnv/README.md | 15 + zsh/plugins/direnv/direnv.plugin.zsh | 16 + zsh/plugins/dirhistory/README.md | 22 + zsh/plugins/dirhistory/dirhistory.plugin.zsh | 44 +- zsh/plugins/dirpersist/README.md | 3 +- zsh/plugins/dirpersist/dirpersist.plugin.zsh | 3 +- zsh/plugins/django/README.md | 20 - zsh/plugins/django/django.plugin.zsh | 3 +- zsh/plugins/dnf/README.md | 14 +- zsh/plugins/docker-compose/README.md | 39 +- .../docker-compose/docker-compose.plugin.zsh | 2 + zsh/plugins/docker/README.md | 37 +- zsh/plugins/docker/_docker | 33 +- zsh/plugins/dotenv/README.md | 44 +- zsh/plugins/dotenv/dotenv.plugin.zsh | 53 +- zsh/plugins/dotnet/README.md | 23 + zsh/plugins/dotnet/dotnet.plugin.zsh | 32 + zsh/plugins/eecms/README.md | 11 + zsh/plugins/emacs/emacs.plugin.zsh | 10 + zsh/plugins/emacs/emacsclient.sh | 3 +- .../emoji-clock/emoji-clock.plugin.zsh | 2 +- zsh/plugins/emotty/README.md | 39 + zsh/plugins/emotty/emotty.plugin.zsh | 2 +- zsh/plugins/encode64/README.md | 27 +- zsh/plugins/extract/README.md | 11 + zsh/plugins/extract/_extract | 2 +- zsh/plugins/extract/extract.plugin.zsh | 15 +- zsh/plugins/fabric/README.md | 2 +- zsh/plugins/fabric/_fab | 19 +- .../fancy-ctrl-z/fancy-ctrl-z.plugin.zsh | 6 +- zsh/plugins/fasd/README.md | 21 + zsh/plugins/fasd/fasd.plugin.zsh | 26 +- zsh/plugins/fastfile/README.md | 84 + zsh/plugins/fastfile/fastfile.plugin.zsh | 41 +- zsh/plugins/fbterm/README.md | 10 + zsh/plugins/fedora/README.md | 2 +- zsh/plugins/fedora/fedora.plugin.zsh | 4 +- .../firewalld/{readme.md => README.md} | 0 zsh/plugins/flutter/README.md | 21 + zsh/plugins/flutter/_flutter | 37 + zsh/plugins/flutter/flutter.plugin.zsh | 7 + zsh/plugins/forklift/README.md | 18 +- zsh/plugins/forklift/forklift.plugin.zsh | 19 +- zsh/plugins/fossil/fossil.plugin.zsh | 4 +- zsh/plugins/frontend-search/README.md | 1 + .../frontend-search/_frontend-search.sh | 4 + .../frontend-search.plugin.zsh | 6 +- zsh/plugins/fzf/README.md | 61 +- zsh/plugins/fzf/fzf.plugin.zsh | 225 +- zsh/plugins/gas/README.md | 10 + zsh/plugins/gcloud/README.md | 24 + zsh/plugins/gcloud/gcloud.plugin.zsh | 33 + zsh/plugins/geeknote/README.md | 16 +- zsh/plugins/geeknote/_geeknote | 267 +- zsh/plugins/genpass/README.md | 66 + zsh/plugins/genpass/genpass-apple | 79 + zsh/plugins/genpass/genpass-monkey | 32 + zsh/plugins/genpass/genpass-xkcd | 68 + zsh/plugins/genpass/genpass.plugin.zsh | 1 + zsh/plugins/gh/.gitignore | 1 + zsh/plugins/gh/README.md | 23 + zsh/plugins/gh/gh.plugin.zsh | 13 + zsh/plugins/git-auto-fetch/README.md | 45 +- .../git-auto-fetch/git-auto-fetch.plugin.zsh | 80 +- zsh/plugins/git-escape-magic/README.md | 6 +- zsh/plugins/git-extras/README.md | 10 +- zsh/plugins/git-flow/README.md | 13 +- zsh/plugins/git-flow/git-flow.plugin.zsh | 1 - zsh/plugins/git-lfs/README.md | 24 + zsh/plugins/git-lfs/git-lfs.plugin.zsh | 17 + zsh/plugins/git-prompt/README.md | 5 + zsh/plugins/git-prompt/git-prompt.plugin.zsh | 29 +- zsh/plugins/git-prompt/gitstatus.py | 51 +- .../git-remote-branch.plugin.zsh | 19 - zsh/plugins/git/README.md | 381 ++- zsh/plugins/git/git.plugin.zsh | 74 +- zsh/plugins/gitfast/README.md | 4 +- zsh/plugins/gitfast/_git | 229 +- zsh/plugins/gitfast/git-completion.bash | 1080 ++++-- zsh/plugins/gitfast/git-prompt.sh | 84 +- zsh/plugins/gitfast/update | 11 +- zsh/plugins/gitfast/updates.patch | 56 - zsh/plugins/github/README.md | 10 +- zsh/plugins/gitignore/gitignore.plugin.zsh | 2 +- zsh/plugins/glassfish/README.md | 9 + zsh/plugins/glassfish/glassfish.plugin.zsh | 3 - zsh/plugins/globalias/README.md | 19 +- zsh/plugins/globalias/globalias.plugin.zsh | 10 +- zsh/plugins/gnu-utils/README.md | 38 + zsh/plugins/gnu-utils/gnu-utils.plugin.zsh | 148 +- zsh/plugins/go/README.md | 2 +- zsh/plugins/go/go.plugin.zsh | 4 +- zsh/plugins/golang/golang.plugin.zsh | 2 +- zsh/plugins/gpg-agent/README.md | 3 +- zsh/plugins/gradle/README.md | 13 +- zsh/plugins/gradle/_gradle | 421 ++- zsh/plugins/gradle/_gradlew | 1 - zsh/plugins/gradle/gradle.plugin.zsh | 199 +- zsh/plugins/grails/README.md | 55 - zsh/plugins/grc/README.md | 15 + zsh/plugins/grc/grc.plugin.zsh | 17 + zsh/plugins/hanami/README.md | 61 +- zsh/plugins/hanami/hanami.plugin.zsh | 6 +- .../history-substring-search/README.md | 175 +- .../history-substring-search.plugin.zsh | 17 +- .../history-substring-search.zsh | 546 ++- zsh/plugins/history/README.md | 20 +- zsh/plugins/history/history.plugin.zsh | 9 +- zsh/plugins/hitchhiker/.gitignore | 1 + zsh/plugins/hitchhiker/README.md | 44 + zsh/plugins/hitchhiker/fortunes/hitchhiker | 275 ++ zsh/plugins/hitchhiker/hitchhiker.plugin.zsh | 23 + zsh/plugins/hitokoto/README.md | 15 + zsh/plugins/hitokoto/hitokoto.plugin.zsh | 14 + zsh/plugins/httpie/README.md | 5 + zsh/plugins/httpie/httpie.plugin.zsh | 7 + zsh/plugins/ionic/README.md | 30 + zsh/plugins/ionic/ionic.plugin.zsh | 15 + zsh/plugins/ipfs/LICENSE | 22 + zsh/plugins/ipfs/README.md | 17 + zsh/plugins/ipfs/_ipfs | 717 ++++ zsh/plugins/jake-node/jake-node.plugin.zsh | 2 +- zsh/plugins/jenv/jenv.plugin.zsh | 4 +- zsh/plugins/jfrog/README.md | 11 + zsh/plugins/jfrog/jfrog.plugin.zsh | 10 + zsh/plugins/jhbuild/README.md | 34 +- zsh/plugins/jhbuild/jhbuild.plugin.zsh | 16 +- zsh/plugins/jira/README.md | 4 + zsh/plugins/jira/_jira | 1 + zsh/plugins/jira/jira.plugin.zsh | 31 +- zsh/plugins/jruby/README.md | 21 + zsh/plugins/jsontools/README.md | 38 +- zsh/plugins/jsontools/jsontools.plugin.zsh | 13 +- zsh/plugins/jump/README.md | 12 + zsh/plugins/jump/jump.plugin.zsh | 31 +- zsh/plugins/keychain/keychain.plugin.zsh | 14 +- zsh/plugins/kitchen/_kitchen | 2 +- zsh/plugins/knife/README.md | 25 + zsh/plugins/knife/_knife | 226 +- zsh/plugins/knife_ssh/README.md | 14 + zsh/plugins/knife_ssh/knife_ssh.plugin.zsh | 8 +- zsh/plugins/kube-ps1/README.md | 252 +- zsh/plugins/kube-ps1/kube-ps1.plugin.zsh | 322 +- zsh/plugins/kubectl/README.md | 36 +- zsh/plugins/kubectl/kubectl.plugin.zsh | 51 +- zsh/plugins/lando/LICENSE | 21 + zsh/plugins/lando/README.md | 37 + zsh/plugins/lando/lando.plugin.zsh | 40 + zsh/plugins/laravel/README.md | 17 + zsh/plugins/laravel/laravel.plugin.zsh | 15 + zsh/plugins/laravel4/README.md | 12 +- zsh/plugins/laravel5/laravel5.plugin.zsh | 19 +- zsh/plugins/last-working-dir/README.md | 32 +- .../last-working-dir.plugin.zsh | 17 +- zsh/plugins/lein/README.md | 9 + zsh/plugins/lighthouse/README.md | 5 +- zsh/plugins/lol/README.md | 104 +- zsh/plugins/lol/lol.plugin.zsh | 2 +- zsh/plugins/lxd/README.md | 9 + zsh/plugins/lxd/lxd.plugin.zsh | 26 + zsh/plugins/macports/_port | 3 + zsh/plugins/magic-enter/README.md | 17 + zsh/plugins/magic-enter/Readme.md | 14 - .../magic-enter/magic-enter.plugin.zsh | 52 +- zsh/plugins/man/man.plugin.zsh | 26 +- zsh/plugins/mercurial/README.md | 96 +- zsh/plugins/mercurial/mercurial.plugin.zsh | 13 +- zsh/plugins/meteor/README.md | 5 +- zsh/plugins/microk8s/README.md | 24 + zsh/plugins/microk8s/microk8s.plugin.zsh | 82 + zsh/plugins/minikube/minikube.plugin.zsh | 11 +- zsh/plugins/mix-fast/mix-fast.plugin.zsh | 5 +- zsh/plugins/mix/_mix | 3 +- zsh/plugins/mongocli/README.md | 19 + zsh/plugins/mongocli/mongocli.plugin.zsh | 4 + zsh/plugins/mvn/README.md | 5 +- zsh/plugins/mvn/mvn.plugin.zsh | 12 +- zsh/plugins/mysql-macports/README.md | 20 + zsh/plugins/n98-magerun/README.md | 21 + zsh/plugins/ng/README.md | 37 +- zsh/plugins/nmap/README.md | 54 +- zsh/plugins/nmap/nmap.plugin.zsh | 2 +- zsh/plugins/node/README.md | 9 +- zsh/plugins/npm/README.md | 9 +- zsh/plugins/npm/npm.plugin.zsh | 32 +- zsh/plugins/npx/README.md | 28 +- zsh/plugins/nvm/README.md | 21 +- zsh/plugins/nvm/_nvm | 1 + zsh/plugins/nvm/nvm.plugin.zsh | 83 +- zsh/plugins/nyan/README.md | 5 - zsh/plugins/nyan/nyan.plugin.zsh | 10 - zsh/plugins/oc/README.md | 13 + zsh/plugins/osx/README.md | 49 +- zsh/plugins/osx/_security | 90 + zsh/plugins/osx/music | 170 + zsh/plugins/osx/osx.plugin.zsh | 285 +- zsh/plugins/osx/spotify | 17 +- zsh/plugins/otp/README.md | 22 + zsh/plugins/otp/otp.plugin.zsh | 19 +- zsh/plugins/pass/README.md | 22 + zsh/plugins/pass/_pass | 8 + zsh/plugins/paver/README.md | 12 + zsh/plugins/paver/paver.plugin.zsh | 6 +- zsh/plugins/percol/README.md | 4 +- zsh/plugins/perl/README.md | 37 + zsh/plugins/perms/README.md | 14 +- zsh/plugins/phing/README.md | 9 + zsh/plugins/pip/README.md | 19 + zsh/plugins/pip/_pip | 1 + zsh/plugins/pip/pip.plugin.zsh | 6 +- zsh/plugins/pipenv/pipenv.plugin.zsh | 10 +- zsh/plugins/pod/README.md | 10 + zsh/plugins/pow/README.md | 21 + zsh/plugins/powder/README.md | 8 + zsh/plugins/powify/README.md | 10 + zsh/plugins/profiles/README.md | 25 + zsh/plugins/pyenv/README.md | 16 + zsh/plugins/pyenv/pyenv.plugin.zsh | 9 +- zsh/plugins/pylint/README.md | 7 +- zsh/plugins/pylint/pylint.plugin.zsh | 2 - zsh/plugins/python/README.md | 2 + zsh/plugins/python/python.plugin.zsh | 40 +- zsh/plugins/rails/README.md | 7 +- zsh/plugins/rails/rails.plugin.zsh | 6 +- zsh/plugins/rake/README.md | 37 + zsh/plugins/rbenv/README.md | 26 + zsh/plugins/rbenv/rbenv.plugin.zsh | 17 +- zsh/plugins/rbfu/README.md | 17 + zsh/plugins/react-native/README.md | 3 + .../react-native/react-native.plugin.zsh | 7 + zsh/plugins/rebar/README.md | 9 + zsh/plugins/redis-cli/README.md | 15 + zsh/plugins/repo/README.md | 28 +- zsh/plugins/repo/_repo | 2 - zsh/plugins/repo/repo.plugin.zsh | 16 +- zsh/plugins/ros/{README.mkd => README.md} | 0 zsh/plugins/rust/README.md | 9 + zsh/plugins/rustup/README.md | 9 + zsh/plugins/rustup/_rustup | 1143 +++++++ zsh/plugins/rvm/README.md | 20 + zsh/plugins/safe-paste/README.md | 9 + zsh/plugins/safe-paste/safe-paste.plugin.zsh | 122 +- zsh/plugins/salt/_salt | 2 +- zsh/plugins/sbt/README.md | 10 +- zsh/plugins/sbt/_sbt | 20 +- zsh/plugins/sbt/sbt.plugin.zsh | 10 +- zsh/plugins/scala/README.md | 13 +- zsh/plugins/scd/README.md | 54 +- zsh/plugins/scd/_scd | 60 + zsh/plugins/scd/scd | 347 +- zsh/plugins/scd/scd.plugin.zsh | 16 +- zsh/plugins/screen/README.md | 10 + zsh/plugins/screen/screen.plugin.zsh | 4 +- zsh/plugins/sdk/README.md | 8 +- zsh/plugins/sdk/sdk.plugin.zsh | 130 +- zsh/plugins/sfffe/README.md | 17 + zsh/plugins/sfffe/sfffe.plugin.zsh | 6 +- zsh/plugins/shell-proxy/README.md | 52 + zsh/plugins/shell-proxy/proxy.py | 73 + .../shell-proxy/shell-proxy.plugin.zsh | 16 + zsh/plugins/shell-proxy/ssh-agent.py | 16 + zsh/plugins/shell-proxy/ssh-proxy.py | 18 + zsh/plugins/shrink-path/README.md | 88 +- .../shrink-path/shrink-path.plugin.zsh | 64 +- zsh/plugins/singlechar/README.md | 118 + zsh/plugins/singlechar/singlechar.plugin.zsh | 12 +- zsh/plugins/sprunge/README.md | 32 + zsh/plugins/sprunge/sprunge.plugin.zsh | 76 +- zsh/plugins/ssh-agent/README.md | 24 +- zsh/plugins/ssh-agent/ssh-agent.plugin.zsh | 8 +- zsh/plugins/stack/stack.plugin.zsh | 39 +- zsh/plugins/sublime-merge/README.md | 17 + .../sublime-merge/sublime-merge.plugin.zsh | 55 + zsh/plugins/sublime/sublime.plugin.zsh | 10 +- zsh/plugins/sudo/README.md | 22 +- zsh/plugins/sudo/sudo.plugin.zsh | 52 +- zsh/plugins/supervisor/README.md | 13 + zsh/plugins/supervisor/_supervisorctl | 7 + zsh/plugins/svn-fast-info/README.md | 56 + .../svn-fast-info/svn-fast-info.plugin.zsh | 42 +- zsh/plugins/swiftpm/README.md | 2 +- zsh/plugins/swiftpm/_swift | 234 +- zsh/plugins/systemadmin/README.md | 22 +- .../systemadmin/systemadmin.plugin.zsh | 13 +- zsh/plugins/systemd/README.md | 41 + zsh/plugins/systemd/systemd.plugin.zsh | 80 +- zsh/plugins/taskwarrior/README.md | 7 +- zsh/plugins/taskwarrior/_task | 4 +- zsh/plugins/term_tab/README | 16 + zsh/plugins/term_tab/term_tab.plugin.zsh | 41 + .../terminalapp/terminalapp.plugin.zsh | 6 - zsh/plugins/terminitor/README.md | 9 + zsh/plugins/terraform/README.md | 3 +- zsh/plugins/terraform/_terraform | 288 +- zsh/plugins/terraform/terraform.plugin.zsh | 6 +- zsh/plugins/textmate/README.md | 3 +- zsh/plugins/thefuck/README.md | 6 +- zsh/plugins/themes/_theme | 3 - zsh/plugins/themes/themes.plugin.zsh | 45 +- zsh/plugins/thor/README.md | 10 + zsh/plugins/tig/README.md | 2 +- zsh/plugins/timer/README.md | 1 + zsh/plugins/timer/timer.plugin.zsh | 18 +- zsh/plugins/tmux-cssh/README.md | 10 + zsh/plugins/tmux-cssh/_tmux-cssh | 24 +- zsh/plugins/tmux/README.md | 8 +- zsh/plugins/tmux/tmux.extra.conf | 2 +- zsh/plugins/tmux/tmux.plugin.zsh | 14 +- zsh/plugins/tmuxinator/README.md | 12 +- zsh/plugins/tugboat/README.md | 12 + zsh/plugins/ufw/README.md | 18 + zsh/plugins/universalarchive/README.md | 46 + .../universalarchive/_universalarchive | 6 + .../universalarchive.plugin.zsh | 70 + zsh/plugins/urltools/README.md | 8 +- zsh/plugins/urltools/urltools.plugin.zsh | 8 +- .../vagrant-prompt/vagrant-prompt.plugin.zsh | 25 +- zsh/plugins/vagrant/README.md | 30 + zsh/plugins/vagrant/_vagrant | 6 +- zsh/plugins/vagrant/vagrant.plugin.zsh | 33 + zsh/plugins/vi-mode/README.md | 84 +- zsh/plugins/vi-mode/vi-mode.plugin.zsh | 121 +- zsh/plugins/virtualenv/virtualenv.plugin.zsh | 2 +- zsh/plugins/virtualenvwrapper/README.md | 38 + .../virtualenvwrapper.plugin.zsh | 76 +- zsh/plugins/vscode/README.md | 37 +- zsh/plugins/vscode/vscode.plugin.zsh | 27 +- zsh/plugins/wakeonlan/{README => README.md} | 24 +- zsh/plugins/wd/README.md | 247 +- zsh/plugins/wd/_wd.sh | 17 +- zsh/plugins/wd/wd.plugin.zsh | 5 +- zsh/plugins/wd/wd.sh | 202 +- zsh/plugins/web-search/README.md | 27 + zsh/plugins/web-search/web-search.plugin.zsh | 19 +- zsh/plugins/wp-cli/README.md | 204 +- zsh/plugins/wp-cli/wp-cli.plugin.zsh | 51 +- zsh/plugins/yarn/README.md | 59 +- zsh/plugins/yarn/_yarn | 34 +- zsh/plugins/yarn/yarn.plugin.zsh | 7 + zsh/plugins/yii/README.md | 15 + zsh/plugins/yii2/yii2.plugin.zsh | 2 +- zsh/plugins/yum/README.md | 2 +- zsh/plugins/z/README | 8 +- zsh/plugins/z/README.md | 23 + zsh/plugins/z/z.1 | 3 + zsh/plugins/z/z.sh | 44 +- zsh/plugins/zbell/README.md | 30 + zsh/plugins/zbell/zbell.plugin.zsh | 83 + zsh/plugins/zeus/README.md | 96 +- zsh/plugins/zeus/zeus.plugin.zsh | 1 + zsh/plugins/zsh-interactive-cd/README.md | 23 + .../zsh-interactive-cd.plugin.zsh | 148 + zsh/plugins/zsh-navigation-tools/LICENSE | 8 +- zsh/plugins/zsh-navigation-tools/Makefile | 35 + zsh/plugins/zsh-navigation-tools/README.md | 379 ++- zsh/plugins/zsh-navigation-tools/_n-kill | 6 +- zsh/plugins/zsh-navigation-tools/n-kill | 4 +- zsh/plugins/zsh-navigation-tools/n-list | 2 + .../zsh-navigation-tools.plugin.zsh | 25 +- zsh/plugins/zsh_reload/zsh_reload.plugin.zsh | 16 +- zsh/templates/zshrc.zsh-template | 12 +- zsh/themes/adben.zsh-theme | 104 +- zsh/themes/af-magic.zsh-theme | 44 +- zsh/themes/agnoster.zsh-theme | 48 +- zsh/themes/arrow.zsh-theme | 2 +- zsh/themes/avit.zsh-theme | 81 +- zsh/themes/awesomepanda.zsh-theme | 2 +- zsh/themes/bira.zsh-theme | 2 +- zsh/themes/candy-kingdom.zsh-theme | 24 +- zsh/themes/cloud.zsh-theme | 2 +- zsh/themes/edvardm.zsh-theme | 2 +- zsh/themes/essembeh.zsh-theme | 60 +- zsh/themes/fino-time.zsh-theme | 10 +- zsh/themes/fino.zsh-theme | 29 +- zsh/themes/fishy.zsh-theme | 18 +- zsh/themes/flazz.zsh-theme | 2 +- zsh/themes/fwalch.zsh-theme | 2 +- zsh/themes/gallifrey.zsh-theme | 2 +- zsh/themes/gallois.zsh-theme | 15 +- zsh/themes/gentoo.zsh-theme | 30 +- zsh/themes/gozilla.zsh-theme | 2 +- zsh/themes/jbergantine.zsh-theme | 2 +- zsh/themes/jnrowe.zsh-theme | 2 +- zsh/themes/jtriley.zsh-theme | 6 - zsh/themes/kafeitu.zsh-theme | 2 +- zsh/themes/kiwi.zsh-theme | 4 +- zsh/themes/linuxonly.zsh-theme | 30 +- zsh/themes/mlh.zsh-theme | 59 + zsh/themes/muse.zsh-theme | 39 +- zsh/themes/nebirhos.zsh-theme | 2 +- zsh/themes/norm.zsh-theme | 5 +- zsh/themes/obraun.zsh-theme | 2 +- zsh/themes/peepcode.zsh-theme | 19 +- zsh/themes/pygmalion-virtualenv.zsh-theme | 15 +- zsh/themes/pygmalion.zsh-theme | 22 +- zsh/themes/random.zsh-theme | 47 + zsh/themes/re5et.zsh-theme | 2 +- zsh/themes/smt.zsh-theme | 71 +- zsh/themes/sunrise.zsh-theme | 4 +- zsh/themes/trapd00r.zsh-theme | 10 +- zsh/themes/wedisagree.zsh-theme | 39 +- zsh/themes/ys.zsh-theme | 20 +- zsh/tools/changelog.sh | 431 +++ zsh/tools/check_for_upgrade.sh | 137 +- zsh/tools/install.sh | 382 ++- zsh/tools/theme_chooser.sh | 1 + zsh/tools/uninstall.sh | 26 +- zsh/tools/upgrade.sh | 135 +- zsh/zshrc | 2 +- 501 files changed, 18233 insertions(+), 8842 deletions(-) create mode 100644 zsh/.editorconfig create mode 100644 zsh/.github/CODEOWNERS create mode 100644 zsh/.github/FUNDING.yml create mode 100644 zsh/.github/ISSUE_TEMPLATE/bug_report.md create mode 100644 zsh/.github/ISSUE_TEMPLATE/config.yml create mode 100644 zsh/.github/ISSUE_TEMPLATE/feature_request.md create mode 100644 zsh/.github/PULL_REQUEST_TEMPLATE.md create mode 100644 zsh/.github/workflows/main.yml create mode 100644 zsh/.gitignore create mode 100644 zsh/.gitpod.Dockerfile create mode 100644 zsh/.gitpod.yml create mode 100644 zsh/CODE_OF_CONDUCT.md create mode 100644 zsh/CONTRIBUTING.md create mode 100644 zsh/custom/plugins/yandex-cloud/yandex-cloud.plugin.zsh rename zsh/{ => custom}/themes/eof.zsh-theme (100%) create mode 100644 zsh/lib/cli.zsh create mode 100644 zsh/plugins/autoenv/README.md create mode 100644 zsh/plugins/bazel/README.md create mode 100644 zsh/plugins/bazel/_bazel create mode 100644 zsh/plugins/cakephp3/README.md create mode 100644 zsh/plugins/chruby/README.md create mode 100644 zsh/plugins/cloudapp/README.md delete mode 100755 zsh/plugins/cloudapp/cloudapp.rb create mode 100644 zsh/plugins/codeclimate/README.md create mode 100644 zsh/plugins/colemak/README.md create mode 100755 zsh/plugins/colored-man-pages/nroff create mode 100644 zsh/plugins/compleat/README.md create mode 100644 zsh/plugins/dash/README.md create mode 100644 zsh/plugins/deno/.gitignore create mode 100644 zsh/plugins/deno/README.md create mode 100644 zsh/plugins/deno/deno.plugin.zsh create mode 100644 zsh/plugins/direnv/README.md create mode 100644 zsh/plugins/direnv/direnv.plugin.zsh create mode 100644 zsh/plugins/dotnet/README.md create mode 100644 zsh/plugins/dotnet/dotnet.plugin.zsh create mode 100644 zsh/plugins/eecms/README.md create mode 100644 zsh/plugins/emotty/README.md create mode 100644 zsh/plugins/fasd/README.md create mode 100644 zsh/plugins/fastfile/README.md create mode 100644 zsh/plugins/fbterm/README.md mode change 120000 => 100644 zsh/plugins/fedora/fedora.plugin.zsh rename zsh/plugins/firewalld/{readme.md => README.md} (100%) create mode 100644 zsh/plugins/flutter/README.md create mode 100644 zsh/plugins/flutter/_flutter create mode 100644 zsh/plugins/flutter/flutter.plugin.zsh create mode 100644 zsh/plugins/gas/README.md create mode 100644 zsh/plugins/gcloud/README.md create mode 100644 zsh/plugins/gcloud/gcloud.plugin.zsh create mode 100644 zsh/plugins/genpass/README.md create mode 100755 zsh/plugins/genpass/genpass-apple create mode 100755 zsh/plugins/genpass/genpass-monkey create mode 100755 zsh/plugins/genpass/genpass-xkcd create mode 100644 zsh/plugins/genpass/genpass.plugin.zsh create mode 100644 zsh/plugins/gh/.gitignore create mode 100644 zsh/plugins/gh/README.md create mode 100644 zsh/plugins/gh/gh.plugin.zsh create mode 100644 zsh/plugins/git-lfs/README.md create mode 100644 zsh/plugins/git-lfs/git-lfs.plugin.zsh delete mode 100644 zsh/plugins/git-remote-branch/git-remote-branch.plugin.zsh delete mode 100644 zsh/plugins/gitfast/updates.patch create mode 100644 zsh/plugins/glassfish/README.md create mode 100644 zsh/plugins/gnu-utils/README.md mode change 120000 => 100644 zsh/plugins/go/go.plugin.zsh mode change 120000 => 100644 zsh/plugins/gradle/_gradle delete mode 120000 zsh/plugins/gradle/_gradlew create mode 100644 zsh/plugins/grc/README.md create mode 100644 zsh/plugins/grc/grc.plugin.zsh create mode 100644 zsh/plugins/hitchhiker/.gitignore create mode 100644 zsh/plugins/hitchhiker/README.md create mode 100644 zsh/plugins/hitchhiker/fortunes/hitchhiker create mode 100644 zsh/plugins/hitchhiker/hitchhiker.plugin.zsh create mode 100644 zsh/plugins/hitokoto/README.md create mode 100644 zsh/plugins/hitokoto/hitokoto.plugin.zsh create mode 100644 zsh/plugins/httpie/httpie.plugin.zsh create mode 100644 zsh/plugins/ionic/README.md create mode 100644 zsh/plugins/ionic/ionic.plugin.zsh create mode 100644 zsh/plugins/ipfs/LICENSE create mode 100644 zsh/plugins/ipfs/README.md create mode 100644 zsh/plugins/ipfs/_ipfs create mode 100644 zsh/plugins/jfrog/README.md create mode 100644 zsh/plugins/jfrog/jfrog.plugin.zsh create mode 100644 zsh/plugins/jruby/README.md create mode 100644 zsh/plugins/knife/README.md create mode 100644 zsh/plugins/knife_ssh/README.md create mode 100644 zsh/plugins/lando/LICENSE create mode 100644 zsh/plugins/lando/README.md create mode 100644 zsh/plugins/lando/lando.plugin.zsh create mode 100644 zsh/plugins/lein/README.md create mode 100644 zsh/plugins/lxd/README.md create mode 100644 zsh/plugins/lxd/lxd.plugin.zsh create mode 100644 zsh/plugins/magic-enter/README.md delete mode 100644 zsh/plugins/magic-enter/Readme.md create mode 100644 zsh/plugins/microk8s/README.md create mode 100644 zsh/plugins/microk8s/microk8s.plugin.zsh create mode 100644 zsh/plugins/mongocli/README.md create mode 100644 zsh/plugins/mongocli/mongocli.plugin.zsh create mode 100644 zsh/plugins/mysql-macports/README.md create mode 100644 zsh/plugins/n98-magerun/README.md delete mode 100644 zsh/plugins/nyan/README.md delete mode 100644 zsh/plugins/nyan/nyan.plugin.zsh create mode 100644 zsh/plugins/oc/README.md create mode 100644 zsh/plugins/osx/_security create mode 100644 zsh/plugins/osx/music create mode 100644 zsh/plugins/otp/README.md create mode 100644 zsh/plugins/pass/README.md create mode 100644 zsh/plugins/paver/README.md create mode 100644 zsh/plugins/perl/README.md create mode 100644 zsh/plugins/phing/README.md create mode 100644 zsh/plugins/pip/README.md create mode 100644 zsh/plugins/pod/README.md create mode 100644 zsh/plugins/pow/README.md create mode 100644 zsh/plugins/powder/README.md create mode 100644 zsh/plugins/powify/README.md create mode 100644 zsh/plugins/profiles/README.md create mode 100644 zsh/plugins/pyenv/README.md create mode 100644 zsh/plugins/rake/README.md create mode 100644 zsh/plugins/rbenv/README.md create mode 100644 zsh/plugins/rbfu/README.md create mode 100644 zsh/plugins/rebar/README.md create mode 100644 zsh/plugins/redis-cli/README.md rename zsh/plugins/ros/{README.mkd => README.md} (100%) create mode 100644 zsh/plugins/rust/README.md create mode 100644 zsh/plugins/rustup/README.md create mode 100644 zsh/plugins/rustup/_rustup create mode 100644 zsh/plugins/rvm/README.md create mode 100644 zsh/plugins/safe-paste/README.md create mode 100644 zsh/plugins/scd/_scd mode change 100644 => 100755 zsh/plugins/scd/scd create mode 100644 zsh/plugins/screen/README.md create mode 100644 zsh/plugins/sfffe/README.md create mode 100644 zsh/plugins/shell-proxy/README.md create mode 100755 zsh/plugins/shell-proxy/proxy.py create mode 100644 zsh/plugins/shell-proxy/shell-proxy.plugin.zsh create mode 100755 zsh/plugins/shell-proxy/ssh-agent.py create mode 100755 zsh/plugins/shell-proxy/ssh-proxy.py create mode 100644 zsh/plugins/singlechar/README.md create mode 100644 zsh/plugins/sprunge/README.md create mode 100644 zsh/plugins/sublime-merge/README.md create mode 100644 zsh/plugins/sublime-merge/sublime-merge.plugin.zsh create mode 100644 zsh/plugins/supervisor/README.md create mode 100644 zsh/plugins/svn-fast-info/README.md create mode 100644 zsh/plugins/term_tab/README create mode 100644 zsh/plugins/term_tab/term_tab.plugin.zsh delete mode 100644 zsh/plugins/terminalapp/terminalapp.plugin.zsh create mode 100644 zsh/plugins/terminitor/README.md delete mode 100644 zsh/plugins/themes/_theme create mode 100644 zsh/plugins/thor/README.md create mode 100644 zsh/plugins/tmux-cssh/README.md create mode 100644 zsh/plugins/tugboat/README.md create mode 100644 zsh/plugins/ufw/README.md create mode 100644 zsh/plugins/universalarchive/README.md create mode 100644 zsh/plugins/universalarchive/_universalarchive create mode 100644 zsh/plugins/universalarchive/universalarchive.plugin.zsh create mode 100644 zsh/plugins/vagrant/vagrant.plugin.zsh create mode 100644 zsh/plugins/virtualenvwrapper/README.md rename zsh/plugins/wakeonlan/{README => README.md} (67%) create mode 100644 zsh/plugins/yii/README.md create mode 100644 zsh/plugins/z/README.md create mode 100644 zsh/plugins/zbell/README.md create mode 100644 zsh/plugins/zbell/zbell.plugin.zsh create mode 100644 zsh/plugins/zsh-interactive-cd/README.md create mode 100644 zsh/plugins/zsh-interactive-cd/zsh-interactive-cd.plugin.zsh create mode 100644 zsh/plugins/zsh-navigation-tools/Makefile create mode 100644 zsh/themes/mlh.zsh-theme create mode 100644 zsh/themes/random.zsh-theme create mode 100755 zsh/tools/changelog.sh mode change 100644 => 100755 zsh/tools/upgrade.sh diff --git a/zsh/.editorconfig b/zsh/.editorconfig new file mode 100644 index 0000000..b5321de --- /dev/null +++ b/zsh/.editorconfig @@ -0,0 +1,8 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_size = 2 +indent_style = space diff --git a/zsh/.github/CODEOWNERS b/zsh/.github/CODEOWNERS new file mode 100644 index 0000000..1b13405 --- /dev/null +++ b/zsh/.github/CODEOWNERS @@ -0,0 +1,9 @@ +# Plugin owners +plugins/archlinux/ @ratijas +plugins/aws/ @maksyms +plugins/genpass/ @atoponce +plugins/git-lfs/ @hellovietduc +plugins/gitfast/ @felipec +plugins/sdk/ @rgoldberg +plugins/universalarchive/ @Konfekt +plugins/wp-cli/ @joshmedeski diff --git a/zsh/.github/FUNDING.yml b/zsh/.github/FUNDING.yml new file mode 100644 index 0000000..c44bb24 --- /dev/null +++ b/zsh/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: [robbyrussell, mcornella, larson-carter] +open_collective: ohmyzsh diff --git a/zsh/.github/ISSUE_TEMPLATE/bug_report.md b/zsh/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..88a6b81 --- /dev/null +++ b/zsh/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,46 @@ +--- +name: Bug report +about: Create a report to help us improve Oh My Zsh +labels: 'Bug' + +--- + + + +**Describe the bug** +A clear description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior, for example: +1. Enable this plugin '...' +2. Run command '...' or try the autocomplete command '...' +3. See error + +**Expected behavior** +A brief description of what should happen. + +**Screenshots and/or Recordings** +If applicable, add screenshots to help explain your problem. +You can also record an asciinema session: https://asciinema.org/ + +**Self Check** + +- Have you tried reaching out on the [Discord server](https://discord.gg/ohmyzsh)? + This can help cut down on filling up issues. We always have a few people + online that are in a variety of timezones that are willing to help you! + +- Also searching existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=) might help you get quicker support + +**Desktop (please complete the following information):** + + - OS / Distro: [e.g. Arch Linux, macOS] + - If on Windows what version of WSL: [e.g. WSL1, WSL2] + - Latest ohmyzsh update?: [e.g. Yes/No] + - ZSH Version: [e.g. 5.6] + - Terminal emulator: [e.g. iTerm2] + +**Additional context** +Add any other context about the problem here. This can be themes, plugins, custom configs. diff --git a/zsh/.github/ISSUE_TEMPLATE/config.yml b/zsh/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..3ddd72a --- /dev/null +++ b/zsh/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: true +contact_links: + - name: Support + url: https://github.com/ohmyzsh/ohmyzsh/discussions + about: Ask the community for support + - name: Get help on Discord + url: https://discord.gg/ohmyzsh + about: Have a quick question? Join the Discord server and ask on the appropriate channel. diff --git a/zsh/.github/ISSUE_TEMPLATE/feature_request.md b/zsh/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..788f773 --- /dev/null +++ b/zsh/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,29 @@ +--- +name: Feature request +about: Suggest a feature for Oh My Zsh +labels: 'Feature' + +--- + + + +**Is your feature request related to a particular plugin or theme? If so, specify it.** +The name of the plugin, theme or alias that you would like us to improve. [...] + +**Is your feature request related to a problem? Please describe.** +A description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A description of what you want to happen. [...] + +**Describe alternatives you've considered** +A description of any alternative solutions or features you've considered. This can also include other plugins or themes. + +**Additional context** +Add any other context, screenshots or discord conversations about the feature request here. Also if you have any PRs related to this issue that are already open that you would like us to look at. + +**Related Issues** +Is there any open or closed issues that is related to this feature request? If so please link them below! [...] diff --git a/zsh/.github/PULL_REQUEST_TEMPLATE.md b/zsh/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..1abae89 --- /dev/null +++ b/zsh/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,19 @@ +## Standards checklist: + + + +- [ ] The PR title is descriptive. +- [ ] The PR doesn't replicate another PR which is already open. +- [ ] I have read the contribution guide and followed all the instructions. +- [ ] The code follows the code style guide detailed in the wiki. +- [ ] The code is mine or it's from somewhere with an MIT-compatible license. +- [ ] The code is efficient, to the best of my ability, and does not waste computer resources. +- [ ] The code is stable and I have tested it myself, to the best of my abilities. + +## Changes: + +- [...] + +## Other comments: + +... diff --git a/zsh/.github/workflows/main.yml b/zsh/.github/workflows/main.yml new file mode 100644 index 0000000..7ab7efd --- /dev/null +++ b/zsh/.github/workflows/main.yml @@ -0,0 +1,36 @@ +name: CI +on: + pull_request: + types: + - opened + - synchronize + branches: + - master + push: + branches: + - master + +jobs: + tests: + name: Run tests + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + steps: + - name: Set up git repository + uses: actions/checkout@v2 + - name: Install zsh + if: runner.os == 'Linux' + run: sudo apt-get update; sudo apt-get install zsh + - name: Test installer + run: sh ./tools/install.sh + - name: Check syntax + run: | + for file in ./oh-my-zsh.sh \ + ./lib/*.zsh \ + ./plugins/*/*.plugin.zsh \ + ./plugins/*/_* \ + ./themes/*.zsh-theme; do + zsh -n "$file" || return 1 + done diff --git a/zsh/.gitignore b/zsh/.gitignore new file mode 100644 index 0000000..ec24a19 --- /dev/null +++ b/zsh/.gitignore @@ -0,0 +1,8 @@ +# custom files +custom/ + +# temp files directories +cache/ +log/ +*.swp +.DS_Store diff --git a/zsh/.gitpod.Dockerfile b/zsh/.gitpod.Dockerfile new file mode 100644 index 0000000..b35c80d --- /dev/null +++ b/zsh/.gitpod.Dockerfile @@ -0,0 +1,5 @@ +FROM gitpod/workspace-full + +RUN sudo apt-get update && \ + sudo apt-get install -y zsh && \ + sudo rm -rf /var/lib/apt/lists/* diff --git a/zsh/.gitpod.yml b/zsh/.gitpod.yml new file mode 100644 index 0000000..ccc5724 --- /dev/null +++ b/zsh/.gitpod.yml @@ -0,0 +1,9 @@ +image: + file: .gitpod.Dockerfile + +tasks: + - init: | + export EDITOR="command gp open -w" VISUAL="command gp open -w" + cp -f /workspace/ohmyzsh/templates/zshrc.zsh-template ~/.zshrc + ln -sf /workspace/ohmyzsh ~/.oh-my-zsh + command: exec zsh diff --git a/zsh/CODE_OF_CONDUCT.md b/zsh/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..20ad1cc --- /dev/null +++ b/zsh/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies within all project spaces, and it also applies when +an individual is representing the project or its community in public spaces. +Examples of representing a project or community include using an official +project e-mail address, posting via an official social media account, or acting +as an appointed representative at an online or offline event. Representation of +a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ohmyzsh@planetargon.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/zsh/CONTRIBUTING.md b/zsh/CONTRIBUTING.md new file mode 100644 index 0000000..4903584 --- /dev/null +++ b/zsh/CONTRIBUTING.md @@ -0,0 +1,224 @@ +# 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. + +First, please take a moment to review our [code of conduct](CODE_OF_CONDUCT.md). + +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. + + + +- [Reporting Issues](#reporting-issues) + - [You have a problem](#you-have-a-problem) + - [You have a suggestion](#you-have-a-suggestion) +- [Submitting 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) +- [Use the Search, Luke](#use-the-search-luke) +- [Commit Guidelines](#commit-guidelines) + - [Format](#format) + - [Style](#style) +- [Volunteer](#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/ohmyzsh/ohmyzsh/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/ohmyzsh/ohmyzsh/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/ohmyzsh/ohmyzsh/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/ohmyzsh/ohmyzsh/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). + +---- + +## Commit Guidelines + +Oh My Zsh uses the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) +specification. The automatic changelog tool uses these to automatically generate +a changelog based on the commit messages. Here's a guide to writing a commit message +to allow this: + +### Format + +``` +type(scope)!: subject +``` + +- `type`: the type of the commit is one of the following: + + - `feat`: new features. + - `fix`: bug fixes. + - `docs`: documentation changes. + - `refactor`: refactor of a particular code section without introducing + new features or bug fixes. + - `style`: code style improvements. + - `perf`: performance improvements. + - `test`: changes to the test suite. + - `ci`: changes to the CI system. + - `build`: changes to the build system (we don't yet have one so this shouldn't apply). + - `chore`: for other changes that don't match previous types. This doesn't appear + in the changelog. + +- `scope`: section of the codebase that the commit makes changes to. If it makes changes to + many sections, or if no section in particular is modified, leave blank without the parentheses. + Examples: + + - Commit that changes the `git` plugin: + ``` + feat(git): add alias for `git commit` + ``` + + - Commit that changes many plugins: + ``` + style: fix inline declaration of arrays + ``` + + For changes to plugins or themes, the scope should be the plugin or theme name: + + - ✅ `fix(agnoster): commit subject` + - ❌ `fix(theme/agnoster): commit subject` + +- `!`: this goes after the `scope` (or the `type` if scope is empty), to indicate that the commit + introduces breaking changes. + + Optionally, you can specify a message that the changelog tool will display to the user to indicate + what's changed and what they can do to deal with it. You can use multiple lines to type this message; + the changelog parser will keep reading until the end of the commit message or until it finds an empty + line. + + Example (made up): + + ``` + style(agnoster)!: change dirty git repo glyph + + BREAKING CHANGE: the glyph to indicate when a git repository is dirty has + changed from a Powerline character to a standard UTF-8 emoji. You can + change it back by setting `ZSH_THEME_DIRTY_GLYPH`. + + Fixes #420 + + Co-authored-by: Username + ``` + +- `subject`: a brief description of the changes. This will be displayed in the changelog. If you need + to specify other details you can use the commit body but it won't be visible. + + Formatting tricks: the commit subject may contain: + + - Links to related issues or PRs by writing `#issue`. This will be highlighted by the changelog tool: + ``` + feat(archlinux): add support for aura AUR helper (#9467) + ``` + + - Formatted inline code by using backticks: the text inbetween backticks will also be highlighted by + the changelog tool: + ``` + feat(shell-proxy): enable unexported `DEFAULT_PROXY` setting (#9774) + ``` + +### Style + +Try to keep the first commit line short. This is harder to do using this commit style but try to be +concise and if you need more space, you can use the commit body. Try to make sure that the commit +subject is clear and precise enough that users will know what change by just looking at the changelog. + +---- + +## Volunteer + +Very nice!! :) + +Please have a look at the [Volunteer](https://github.com/ohmyzsh/ohmyzsh/wiki/Volunteers) +page for instructions on where to start and more. diff --git a/zsh/LICENSE.txt b/zsh/LICENSE.txt index 4d465b1..becd6a7 100644 --- a/zsh/LICENSE.txt +++ b/zsh/LICENSE.txt @@ -1,7 +1,6 @@ -The MIT License (MIT) +MIT License -Copyright (c) 2009-2019 Robby Russell and contributors -See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors +Copyright (c) 2009-2021 Robby Russell and contributors (https://github.com/ohmyzsh/ohmyzsh/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 diff --git a/zsh/README.md b/zsh/README.md index 78a5b56..3ebea91 100644 --- a/zsh/README.md +++ b/zsh/README.md @@ -1,45 +1,40 @@ -

- Oh My Zsh -

+

Oh My Zsh

Oh My Zsh is an open source, community-driven framework for managing your [zsh](https://www.zsh.org/) configuration. Sounds boring. Let's try again. -__Oh My Zsh will not make you a 10x developer...but you may feel like one.__ +**Oh My Zsh will not make you a 10x developer...but you may 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](https://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. +To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter, and join us on [Discord](https://discord.gg/ohmyzsh). + +[![CI](https://github.com/ohmyzsh/ohmyzsh/workflows/CI/badge.svg)](https://github.com/ohmyzsh/ohmyzsh/actions?query=workflow%3ACI) +[![Follow @ohmyzsh](https://img.shields.io/twitter/follow/ohmyzsh?label=Follow+@ohmyzsh&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh) +[![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/ohmyzsh) +[![Gitpod ready](https://img.shields.io/badge/Gitpod-ready-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ohmyzsh/ohmyzsh) ## Getting Started ### Prerequisites -__Disclaimer:__ _Oh My Zsh works best on macOS and Linux._ - -* Unix-like operating system (macOS or Linux) -* [Zsh](https://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 +- A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL2 is preferred, but cygwin or msys also mostly work. +- [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent is fine but we prefer 5.0.8 and newer). If not pre-installed (run `zsh --version` to confirm), check the following wiki instructions here: [Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH) +- `curl` or `wget` should be installed +- `git` should be installed (recommended v2.4.11 or higher) ### 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`. +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`, `wget` or another similar tool. -#### 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 -O- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" -``` +| Method | Command | +|:----------|:--------------------------------------------------------------------------------------------------| +| **curl** | `sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` | +| **wget** | `sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` | +| **fetch** | `sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` | #### Manual inspection @@ -48,7 +43,7 @@ that by downloading the install script first, looking through it so everything l then running it: ```shell -curl -Lo install.sh https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh +wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh sh install.sh ``` @@ -56,7 +51,7 @@ sh install.sh ### 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. +Oh My Zsh comes with a shitload of plugins for you to take advantage of. You can take a look in the [plugins](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins) directory and/or the [wiki](https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins) to see what's currently available. #### Enabling Plugins @@ -80,15 +75,15 @@ plugins=( ) ``` -_Note that the plugins are separated by whitespace. **Do not** use commas between them._ +_Note that the plugins are separated by whitespace (spaces, tabs, new lines...). **Do not** use commas between them or it will break._ #### Using Plugins -Most plugins (should! we're working on this) include a __README__, which documents how to use them. +Each plugin includes a __README__, documenting it. This README should show the aliases (if the plugin adds any) and extra goodies that are included in that particular plugin. ### 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://github.com/robbyrussell/oh-my-zsh/wiki/Themes) on the wiki. Check them out! +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 and fifty themes now bundled. Most of them have [screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki (We are working on updating this!). Check them out! #### Selecting a Theme @@ -104,7 +99,7 @@ To use a different theme, simply change the value to match the name of your desi ```shell ZSH_THEME="agnoster" # (this is one of the fancy ones) -# see https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#agnoster +# see https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster ``` _Note: many themes require installing the [Powerline Fonts](https://github.com/powerline/fonts) in order to render properly._ @@ -113,11 +108,10 @@ 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). +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/ohmyzsh/ohmyzsh/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..) ``` @@ -131,6 +125,16 @@ ZSH_THEME_RANDOM_CANDIDATES=( ) ``` +If you only know which themes you don't like, you can add them similarly to an ignored list: + +```shell +ZSH_THEME_RANDOM_IGNORED=(pygmalion tjkirch_mod) +``` + +### FAQ + +If you have some more questions or issues, you might find a solution in our [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ). + ## Advanced Topics If you're the type that likes to get their hands dirty, these sections might resonate. @@ -142,7 +146,7 @@ the installer accepts (these settings are also documented at the top of the inst #### Custom Directory -The default location is `~/.oh-my-zsh` (hidden in your home directory) +The default location is `~/.oh-my-zsh` (hidden in your home directory, you can access it with `cd ~/.oh-my-zsh`) 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 @@ -159,14 +163,14 @@ flag `--unattended` to the `install.sh` script. This will have the effect of not the default shell, and also won't run `zsh` when the installation has finished. ```shell -sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" "" --unattended +sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended ``` #### Installing from a forked repository The install script also accepts these variables to allow installation of a different repository: -- `REPO` (default: `robbyrussell/oh-my-zsh`): this takes the form of `owner/repository`. If you set +- `REPO` (default: `ohmyzsh/ohmyzsh`): this takes the form of `owner/repository`. If you set this variable, the installer will look for a repository at `https://github.com/{owner}/{repository}`. - `REMOTE` (default: `https://github.com/${REPO}.git`): this is the full URL of the git repository @@ -187,13 +191,13 @@ REPO=apjanke/oh-my-zsh BRANCH=edge sh install.sh #### Manual Installation -##### 1. Clone the repository: +##### 1. Clone the repository ```shell -git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh +git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh ``` -##### 2. *Optionally*, backup your existing `~/.zshrc` file: +##### 2. *Optionally*, backup your existing `~/.zshrc` file ```shell cp ~/.zshrc ~/.zshrc.orig @@ -223,9 +227,9 @@ Once you open up a new terminal window, it should load zsh with Oh My Zsh's conf 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 +- 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 +- If you installed manually or changed the install location, check the `ZSH` environment variable in `~/.zshrc`. ### Custom Plugins and Themes @@ -255,7 +259,7 @@ DISABLE_AUTO_UPDATE=true 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 +omz update ``` Magic! 🎉 @@ -272,13 +276,13 @@ Before you participate in our delightful community, please read the [code of con I'm far from being a [Zsh](https://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. +We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/ohmyzsh/ohmyzsh/issues) and help where you can. See [Contributing](CONTRIBUTING.md) for more details. ### 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. +We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes) wiki page. ## Contributors @@ -288,10 +292,12 @@ Thank you so much! ## Follow Us -We're on the social media. +We're on 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. +- [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. You should follow it. +- [Facebook](https://www.facebook.com/Oh-My-Zsh-296616263819290/) poke us. +- [Instagram](https://www.instagram.com/_ohmyzsh/) tag us in your post showing Oh My Zsh! +- [Discord](https://discord.gg/ohmyzsh) to chat with us! ## Merchandise diff --git a/zsh/custom/plugins/yandex-cloud/yandex-cloud.plugin.zsh b/zsh/custom/plugins/yandex-cloud/yandex-cloud.plugin.zsh new file mode 100644 index 0000000..7027bac --- /dev/null +++ b/zsh/custom/plugins/yandex-cloud/yandex-cloud.plugin.zsh @@ -0,0 +1,5 @@ +# The next line updates PATH for Yandex Cloud CLI. +if [ -f '$HOME/yandex-cloud/path.bash.inc' ]; then source '$HOME/yandex-cloud/path.bash.inc'; fi + +# The next line enables shell command completion for yc. +if [ -f '$HOME/yandex-cloud/completion.zsh.inc' ]; then source '$HOME/yandex-cloud/completion.zsh.inc'; fi diff --git a/zsh/themes/eof.zsh-theme b/zsh/custom/themes/eof.zsh-theme similarity index 100% rename from zsh/themes/eof.zsh-theme rename to zsh/custom/themes/eof.zsh-theme diff --git a/zsh/lib/cli.zsh b/zsh/lib/cli.zsh new file mode 100644 index 0000000..38e2f72 --- /dev/null +++ b/zsh/lib/cli.zsh @@ -0,0 +1,426 @@ +#!/usr/bin/env zsh + +function omz { + [[ $# -gt 0 ]] || { + _omz::help + return 1 + } + + local command="$1" + shift + + # Subcommand functions start with _ so that they don't + # appear as completion entries when looking for `omz` + (( $+functions[_omz::$command] )) || { + _omz::help + return 1 + } + + _omz::$command "$@" +} + +function _omz { + local -a cmds subcmds + cmds=( + 'changelog:Print the changelog' + 'help:Usage information' + 'plugin:Manage plugins' + 'pr:Manage Oh My Zsh Pull Requests' + 'theme:Manage themes' + 'update:Update Oh My Zsh' + ) + + if (( CURRENT == 2 )); then + _describe 'command' cmds + elif (( CURRENT == 3 )); then + case "$words[2]" in + changelog) local -a refs + refs=("${(@f)$(command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}") + _describe 'command' refs ;; + plugin) subcmds=('info:Get plugin information' 'list:List plugins') + _describe 'command' subcmds ;; + pr) subcmds=('test:Test a Pull Request' 'clean:Delete all Pull Request branches') + _describe 'command' subcmds ;; + theme) subcmds=('use:Load a theme' 'list:List themes') + _describe 'command' subcmds ;; + esac + elif (( CURRENT == 4 )); then + case "$words[2]::$words[3]" in + plugin::info) compadd "$ZSH"/plugins/*/README.md(.N:h:t) \ + "$ZSH_CUSTOM"/plugins/*/README.md(.N:h:t) ;; + theme::use) compadd "$ZSH"/themes/*.zsh-theme(.N:t:r) \ + "$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::) ;; + esac + fi + + return 0 +} + +compdef _omz omz + +## Utility functions + +function _omz::confirm { + # If question supplied, ask it before reading the answer + # NOTE: uses the logname of the caller function + if [[ -n "$1" ]]; then + _omz::log prompt "$1" "${${functrace[1]#_}%:*}" + fi + + # Read one character + read -r -k 1 + + # If no newline entered, add a newline + if [[ "$REPLY" != $'\n' ]]; then + echo + fi +} + +function _omz::log { + # if promptsubst is set, a message with `` or $() + # will be run even if quoted due to `print -P` + setopt localoptions nopromptsubst + + # $1 = info|warn|error|debug + # $2 = text + # $3 = (optional) name of the logger + + local logtype=$1 + local logname=${3:-${${functrace[1]#_}%:*}} + + # Don't print anything if debug is not active + if [[ $logtype = debug && -z $_OMZ_DEBUG ]]; then + return + fi + + # Choose coloring based on log type + case "$logtype" in + prompt) print -Pn "%S%F{blue}$logname%f%s: $2" ;; + debug) print -P "%F{white}$logname%f: $2" ;; + info) print -P "%F{green}$logname%f: $2" ;; + warn) print -P "%S%F{yellow}$logname%f%s: $2" ;; + error) print -P "%S%F{red}$logname%f%s: $2" ;; + esac >&2 +} + +## User-facing commands + +function _omz::help { + cat < [options] + +Available commands: + + help Print this help message + changelog Print the changelog + plugin Manage plugins + pr Manage Oh My Zsh Pull Requests + theme Manage themes + update Update Oh My Zsh + +EOF +} + +function _omz::changelog { + local version=${1:-HEAD} format=${3:-"--text"} + + if ! command git -C "$ZSH" show-ref --verify refs/heads/$version &>/dev/null && \ + ! command git -C "$ZSH" show-ref --verify refs/tags/$version &>/dev/null && \ + ! command git -C "$ZSH" rev-parse --verify "${version}^{commit}" &>/dev/null; then + cat < must be a valid branch, tag or commit. +EOF + return 1 + fi + + "$ZSH/tools/changelog.sh" "$version" "${2:-}" "$format" +} + +function _omz::plugin { + (( $# > 0 && $+functions[_omz::plugin::$1] )) || { + cat < [options] + +Available commands: + + info Get information of a plugin + list List all available Oh My Zsh plugins + +EOF + return 1 + } + + local command="$1" + shift + + _omz::plugin::$command "$@" +} + +function _omz::plugin::info { + if [[ -z "$1" ]]; then + echo >&2 "Usage: omz plugin info " + return 1 + fi + + local readme + for readme in "$ZSH_CUSTOM/plugins/$1/README.md" "$ZSH/plugins/$1/README.md"; do + if [[ -f "$readme" ]]; then + (( ${+commands[less]} )) && less "$readme" || cat "$readme" + return 0 + fi + done + + if [[ -d "$ZSH_CUSTOM/plugins/$1" || -d "$ZSH/plugins/$1" ]]; then + _omz::log error "the '$1' plugin doesn't have a README file" + else + _omz::log error "'$1' plugin not found" + fi + + return 1 +} + +function _omz::plugin::list { + local -a custom_plugins builtin_plugins + custom_plugins=("$ZSH_CUSTOM"/plugins/*(-/N:t)) + builtin_plugins=("$ZSH"/plugins/*(-/N:t)) + + # If the command is being piped, print all found line by line + if [[ ! -t 1 ]]; then + print -l ${(q-)custom_plugins} ${(q-)builtin_plugins} + return + fi + + if (( ${#custom_plugins} )); then + print -P "%U%BCustom plugins%b%u:" + print -l ${(q-)custom_plugins} | column + fi + + if (( ${#builtin_plugins} )); then + (( ${#custom_plugins} )) && echo # add a line of separation + + print -P "%U%BBuilt-in plugins%b%u:" + print -l ${(q-)builtin_plugins} | column + fi +} + +function _omz::pr { + (( $# > 0 && $+functions[_omz::pr::$1] )) || { + cat < [options] + +Available commands: + + clean Delete all PR branches (ohmyzsh/pull-*) + test Fetch PR #NUMBER and rebase against master + +EOF + return 1 + } + + local command="$1" + shift + + _omz::pr::$command "$@" +} + +function _omz::pr::clean { + ( + set -e + builtin cd -q "$ZSH" + + # Check if there are PR branches + local fmt branches + fmt="%(color:bold blue)%(align:18,right)%(refname:short)%(end)%(color:reset) %(color:dim bold red)%(objectname:short)%(color:reset) %(color:yellow)%(contents:subject)" + branches="$(command git for-each-ref --sort=-committerdate --color --format="$fmt" "refs/heads/ohmyzsh/pull-*")" + + # Exit if there are no PR branches + if [[ -z "$branches" ]]; then + _omz::log info "there are no Pull Request branches to remove." + return + fi + + # Print found PR branches + echo "$branches\n" + # Confirm before removing the branches + _omz::confirm "do you want remove these Pull Request branches? [Y/n] " + # Only proceed if the answer is a valid yes option + [[ "$REPLY" != [yY$'\n'] ]] && return + + _omz::log info "removing all Oh My Zsh Pull Request branches..." + command git branch --list 'ohmyzsh/pull-*' | while read branch; do + command git branch -D "$branch" + done + ) +} + +function _omz::pr::test { + # Allow $1 to be a URL to the pull request + if [[ "$1" = https://* ]]; then + 1="${1:t}" + fi + + # Check the input + if ! [[ -n "$1" && "$1" =~ ^[[:digit:]]+$ ]]; then + echo >&2 "Usage: omz pr test " + return 1 + fi + + # Save current git HEAD + local branch + branch=$(builtin cd -q "$ZSH"; git symbolic-ref --short HEAD) || { + _omz::log error "error when getting the current git branch. Aborting..." + return 1 + } + + + # Fetch PR onto ohmyzsh/pull- branch and rebase against master + # If any of these operations fail, undo the changes made + ( + set -e + builtin cd -q "$ZSH" + + # Get the ohmyzsh git remote + command git remote -v | while read remote url _; do + case "$url" in + https://github.com/ohmyzsh/ohmyzsh(|.git)) found=1; break ;; + git@github.com:ohmyzsh/ohmyzsh(|.git)) found=1; break ;; + esac + done + + (( $found )) || { + _omz::log error "could not found the ohmyzsh git remote. Aborting..." + return 1 + } + + # Fetch pull request head + _omz::log info "fetching PR #$1 to ohmyzsh/pull-$1..." + command git fetch -f "$remote" refs/pull/$1/head:ohmyzsh/pull-$1 || { + _omz::log error "error when trying to fetch PR #$1." + return 1 + } + + # Rebase pull request branch against the current master + _omz::log info "rebasing PR #$1..." + command git rebase master ohmyzsh/pull-$1 || { + command git rebase --abort &>/dev/null + _omz::log warn "could not rebase PR #$1 on top of master." + _omz::log warn "you might not see the latest stable changes." + _omz::log info "run \`zsh\` to test the changes." + return 1 + } + + _omz::log info "fetch of PR #${1} successful." + ) + + # If there was an error, abort running zsh to test the PR + [[ $? -eq 0 ]] || return 1 + + # Run zsh to test the changes + _omz::log info "running \`zsh\` to test the changes. Run \`exit\` to go back." + command zsh -l + + # After testing, go back to the previous HEAD if the user wants + _omz::confirm "do you want to go back to the previous branch? [Y/n] " + # Only proceed if the answer is a valid yes option + [[ "$REPLY" != [yY$'\n'] ]] && return + + ( + set -e + builtin cd -q "$ZSH" + + command git checkout "$branch" -- || { + _omz::log error "could not go back to the previous branch ('$branch')." + return 1 + } + ) +} + +function _omz::theme { + (( $# > 0 && $+functions[_omz::theme::$1] )) || { + cat < [options] + +Available commands: + + list List all available Oh My Zsh themes + use Load an Oh My Zsh theme + +EOF + return 1 + } + + local command="$1" + shift + + _omz::theme::$command "$@" +} + +function _omz::theme::list { + local -a custom_themes builtin_themes + custom_themes=("$ZSH_CUSTOM"/**/*.zsh-theme(-.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::)) + builtin_themes=("$ZSH"/themes/*.zsh-theme(-.N:t:r)) + + # If the command is being piped, print all found line by line + if [[ ! -t 1 ]]; then + print -l ${(q-)custom_themes} ${(q-)builtin_themes} + return + fi + + if (( ${#custom_themes} )); then + print -P "%U%BCustom themes%b%u:" + print -l ${(q-)custom_themes} | column + fi + + if (( ${#builtin_themes} )); then + (( ${#custom_themes} )) && echo # add a line of separation + + print -P "%U%BBuilt-in themes%b%u:" + print -l ${(q-)builtin_themes} | column + fi +} + +function _omz::theme::use { + if [[ -z "$1" ]]; then + echo >&2 "Usage: omz theme use " + return 1 + fi + + # Respect compatibility with old lookup order + if [[ -f "$ZSH_CUSTOM/$1.zsh-theme" ]]; then + source "$ZSH_CUSTOM/$1.zsh-theme" + elif [[ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ]]; then + source "$ZSH_CUSTOM/themes/$1.zsh-theme" + elif [[ -f "$ZSH/themes/$1.zsh-theme" ]]; then + source "$ZSH/themes/$1.zsh-theme" + else + _omz::log error "theme '$1' not found" + return 1 + fi +} + +function _omz::update { + local last_commit=$(cd "$ZSH"; git rev-parse HEAD) + + # Run update script + if [[ "$1" != --unattended ]]; then + ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive + else + ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" + fi + + # Update last updated file + zmodload zsh/datetime + echo "LAST_EPOCH=$(( EPOCHSECONDS / 60 / 60 / 24 ))" >! "${ZSH_CACHE_DIR}/.zsh-update" + # Remove update lock if it exists + command rm -rf "$ZSH/log/update.lock" + + # Restart the zsh session if there were changes + if [[ "$1" != --unattended && "$(cd "$ZSH"; git rev-parse HEAD)" != "$last_commit" ]]; then + # Old zsh versions don't have ZSH_ARGZERO + local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}" + # Check whether to run a login shell + [[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh" + fi +} diff --git a/zsh/lib/clipboard.zsh b/zsh/lib/clipboard.zsh index 2c93d1b..122145f 100644 --- a/zsh/lib/clipboard.zsh +++ b/zsh/lib/clipboard.zsh @@ -3,10 +3,23 @@ # 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. - +# This is uses essentially the same heuristic as neovim, with the additional +# special support for Cygwin. +# See: https://github.com/neovim/neovim/blob/e682d799fa3cf2e80a02d00c6ea874599d58f0e7/runtime/autoload/provider/clipboard.vim#L55-L121 +# +# - pbcopy, pbpaste (macOS) +# - cygwin (Windows running Cygwin) +# - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set) +# - xclip (if $DISPLAY is set) +# - xsel (if $DISPLAY is set) +# - lemonade (for SSH) https://github.com/pocke/lemonade +# - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/ +# - win32yank (Windows) +# - tmux (if $TMUX is set) +# +# Defines two functions, clipcopy and clippaste, based on the detected platform. +## +# # clipcopy - Copy data to clipboard # # Usage: @@ -15,41 +28,8 @@ # # clipcopy - 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: @@ -67,20 +47,61 @@ function clipcopy() { # # # Paste to a file # clippaste > file.txt -function clippaste() { +# +function detect-clipboard() { emulate -L zsh - if [[ $OSTYPE == darwin* ]]; then - pbpaste - elif [[ $OSTYPE == cygwin* ]]; then - cat /dev/clipboard + + if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then + function clipcopy() { pbcopy < "${1:-/dev/stdin}"; } + function clippaste() { pbpaste; } + elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then + function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; } + function clippaste() { cat /dev/clipboard; } + elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then + function clipcopy() { wl-copy < "${1:-/dev/stdin}"; } + function clippaste() { wl-paste; } + elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then + function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}"; } + function clippaste() { xclip -out -selection clipboard; } + elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then + function clipcopy() { xsel --clipboard --input < "${1:-/dev/stdin}"; } + function clippaste() { xsel --clipboard --output; } + elif (( ${+commands[lemonade]} )); then + function clipcopy() { lemonade copy < "${1:-/dev/stdin}"; } + function clippaste() { lemonade paste; } + elif (( ${+commands[doitclient]} )); then + function clipcopy() { doitclient wclip < "${1:-/dev/stdin}"; } + function clippaste() { doitclient wclip -r; } + elif (( ${+commands[win32yank]} )); then + function clipcopy() { win32yank -i < "${1:-/dev/stdin}"; } + function clippaste() { win32yank -o; } + elif [[ $OSTYPE == linux-android* ]] && (( $+commands[termux-clipboard-set] )); then + function clipcopy() { termux-clipboard-set "${1:-/dev/stdin}"; } + function clippaste() { termux-clipboard-get; } + elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then + function clipcopy() { tmux load-buffer "${1:--}"; } + function clippaste() { tmux save-buffer -; } + elif [[ $(uname -r) = *icrosoft* ]]; then + function clipcopy() { clip.exe < "${1:-/dev/stdin}"; } + function clippaste() { powershell.exe -noprofile -command Get-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 + function _retry_clipboard_detection_or_fail() { + local clipcmd="${1}"; shift + if detect-clipboard; then + "${clipcmd}" "$@" + else + print "${clipcmd}: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 + return 1 + fi + } + function clipcopy() { _retry_clipboard_detection_or_fail clipcopy "$@"; } + function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; } + return 1 fi } + +# Detect at startup. A non-zero exit here indicates that the dummy clipboards were set, +# which is not really an error. If the user calls them, they will attempt to redetect +# (for example, perhaps the user has now installed xclip) and then either print an error +# or proceed successfully. +detect-clipboard || true diff --git a/zsh/lib/completion.zsh b/zsh/lib/completion.zsh index c7db2eb..ebaab08 100644 --- a/zsh/lib/completion.zsh +++ b/zsh/lib/completion.zsh @@ -32,17 +32,17 @@ 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" + zstyle ':completion:*:*:*:*:processes' command "ps -u $USERNAME -o pid,user,comm" else - zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w" + zstyle ':completion:*:*:*:*:processes' command "ps -u $USERNAME -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 +zstyle ':completion:*' use-cache yes +zstyle ':completion:*' cache-path $ZSH_CACHE_DIR # Don't complete uninteresting users zstyle ':completion:*:*:*:users' ignored-patterns \ @@ -60,14 +60,16 @@ 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 - + print -Pn "%F{red}…%f" zle expand-or-complete zle redisplay } zle -N expand-or-complete-with-dots - bindkey "^I" expand-or-complete-with-dots + # Set the function as the default tab completion widget + bindkey -M emacs "^I" expand-or-complete-with-dots + bindkey -M viins "^I" expand-or-complete-with-dots + bindkey -M vicmd "^I" expand-or-complete-with-dots fi + +# automatically load bash completion functions +autoload -U +X bashcompinit && bashcompinit diff --git a/zsh/lib/diagnostics.zsh b/zsh/lib/diagnostics.zsh index 9c9905e..6505207 100644 --- a/zsh/lib/diagnostics.zsh +++ b/zsh/lib/diagnostics.zsh @@ -112,7 +112,7 @@ function _omz_diag_dump_one_big_text() { command uname -a builtin echo OSTYPE=$OSTYPE builtin echo ZSH_VERSION=$ZSH_VERSION - builtin echo User: $USER + builtin echo User: $USERNAME builtin echo umask: $(umask) builtin echo _omz_diag_dump_os_specific_version @@ -192,19 +192,19 @@ function _omz_diag_dump_one_big_text() { 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:]]") + (builtin 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) + (builtin 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) + custom_dir=$(builtin 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 cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print) builtin echo fi diff --git a/zsh/lib/functions.zsh b/zsh/lib/functions.zsh index 9f8736b..c4340f1 100644 --- a/zsh/lib/functions.zsh +++ b/zsh/lib/functions.zsh @@ -1,13 +1,16 @@ 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 + fc -l 1 \ + | awk '{ CMD[$2]++; count++; } END { for (a in CMD) print CMD[a] " " CMD[a]*100/count "% " a }' \ + | grep -v "./" | sort -nr | head -20 | column -c3 -s " " -t | nl } function uninstall_oh_my_zsh() { - env ZSH=$ZSH sh $ZSH/tools/uninstall.sh + env ZSH="$ZSH" sh "$ZSH/tools/uninstall.sh" } function upgrade_oh_my_zsh() { - env ZSH=$ZSH sh $ZSH/tools/upgrade.sh + echo >&2 "${fg[yellow]}Note: \`$0\` is deprecated. Use \`omz update\` instead.$reset_color" + omz update } function take() { @@ -21,7 +24,7 @@ function open_command() { case "$OSTYPE" in darwin*) open_cmd='open' ;; cygwin*) open_cmd='cygstart' ;; - linux*) ! [[ $(uname -a) =~ "Microsoft" ]] && open_cmd='xdg-open' || { + linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || { open_cmd='cmd.exe /c start ""' [[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 } } ;; @@ -31,12 +34,7 @@ function open_command() { ;; esac - # don't use nohup on OSX - if [[ "$OSTYPE" == darwin* ]]; then - ${=open_cmd} "$@" &>/dev/null - else - nohup ${=open_cmd} "$@" &>/dev/null - fi + ${=open_cmd} "$@" &>/dev/null } # @@ -93,7 +91,7 @@ function default() { # 0 if the env variable exists, 3 if it was set # function env_default() { - (( ${${(@f):-$(typeset +xg)}[(I)$1]} )) && return 0 + [[ ${parameters[$1]} = *-export* ]] && return 0 export "$1=$2" && return 3 } @@ -127,6 +125,7 @@ zmodload zsh/langinfo # -P causes spaces to be encoded as '%20' instead of '+' function omz_urlencode() { emulate -L zsh + local -a opts zparseopts -D -E -a opts r m P local in_str=$1 diff --git a/zsh/lib/git.zsh b/zsh/lib/git.zsh index 640561e..c936327 100644 --- a/zsh/lib/git.zsh +++ b/zsh/lib/git.zsh @@ -1,23 +1,57 @@ -# Outputs current branch info in prompt format +# The git prompt's git commands are read-only and should not interfere with +# other processes. This environment variable is equivalent to running with `git +# --no-optional-locks`, but falls back gracefully for older versions of git. +# See git(1) for and git-status(1) for a description of that flag. +# +# We wrap in a local function instead of exporting the variable directly in +# order to avoid interfering with manually-run git commands by the user. +function __git_prompt_git() { + GIT_OPTIONAL_LOCKS=0 command git "$@" +} + 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" + # If we are on a folder not tracked by git, get out. + # Otherwise, check for hide-info at global and local repository level + if ! __git_prompt_git rev-parse --git-dir &> /dev/null \ + || [[ "$(__git_prompt_git config --get oh-my-zsh.hide-info 2>/dev/null)" == 1 ]]; then + return 0 fi + + local ref + ref=$(__git_prompt_git symbolic-ref --short HEAD 2> /dev/null) \ + || ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) \ + || return 0 + + # Use global ZSH_THEME_GIT_SHOW_UPSTREAM=1 for including upstream remote info + local upstream + if (( ${+ZSH_THEME_GIT_SHOW_UPSTREAM} )); then + upstream=$(__git_prompt_git rev-parse --abbrev-ref --symbolic-full-name "@{upstream}" 2>/dev/null) \ + && upstream=" -> ${upstream}" + fi + + echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref}${upstream}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}" } # Checks if working tree is dirty function parse_git_dirty() { local STATUS local -a FLAGS - FLAGS=('--porcelain' '--ignore-submodules=dirty') - if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then - if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then + FLAGS=('--porcelain') + if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then + if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then FLAGS+='--untracked-files=no' fi - STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1) + case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in + git) + # let git decide (this respects per-repo config in .gitmodules) + ;; + *) + # if unset: ignore dirty submodules + # other values are passed to --ignore-submodules + FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}" + ;; + esac + STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -1) fi if [[ -n $STATUS ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" @@ -29,10 +63,10 @@ function parse_git_dirty() { # 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\/} + remote=${$(__git_prompt_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) + ahead=$(__git_prompt_git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l) + behind=$(__git_prompt_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" @@ -61,11 +95,11 @@ function git_remote_status() { # 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) + ref=$(__git_prompt_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 + ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) || return fi echo ${ref#refs/heads/} } @@ -73,8 +107,8 @@ function git_current_branch() { # 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 2>/dev/null)" + if __git_prompt_git rev-parse --git-dir &>/dev/null; then + local commits="$(__git_prompt_git rev-list --count @{upstream}..HEAD 2>/dev/null)" if [[ -n "$commits" && "$commits" != 0 ]]; then echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX" fi @@ -83,8 +117,8 @@ function git_commits_ahead() { # 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} 2>/dev/null)" + if __git_prompt_git rev-parse --git-dir &>/dev/null; then + local commits="$(__git_prompt_git rev-list --count HEAD..@{upstream} 2>/dev/null)" if [[ -n "$commits" && "$commits" != 0 ]]; then echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX" fi @@ -93,21 +127,21 @@ function git_commits_behind() { # 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 + if [[ -n "$(__git_prompt_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 + if [[ -n "$(__git_prompt_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 + if [[ -n "$(__git_prompt_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" @@ -117,75 +151,130 @@ function git_prompt_remote() { # 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" + SHA=$(__git_prompt_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" + SHA=$(__git_prompt_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" + [[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]] && return + + # Maps a git status prefix to an internal constant + # This cannot use the prompt constants, as they may be empty + local -A prefix_constant_map + prefix_constant_map=( + '\?\? ' 'UNTRACKED' + 'A ' 'ADDED' + 'M ' 'ADDED' + 'MM ' 'MODIFIED' + ' M ' 'MODIFIED' + 'AM ' 'MODIFIED' + ' T ' 'MODIFIED' + 'R ' 'RENAMED' + ' D ' 'DELETED' + 'D ' 'DELETED' + 'UU ' 'UNMERGED' + 'ahead' 'AHEAD' + 'behind' 'BEHIND' + 'diverged' 'DIVERGED' + 'stashed' 'STASHED' + ) + + # Maps the internal constant to the prompt theme + local -A constant_prompt_map + constant_prompt_map=( + 'UNTRACKED' "$ZSH_THEME_GIT_PROMPT_UNTRACKED" + 'ADDED' "$ZSH_THEME_GIT_PROMPT_ADDED" + 'MODIFIED' "$ZSH_THEME_GIT_PROMPT_MODIFIED" + 'RENAMED' "$ZSH_THEME_GIT_PROMPT_RENAMED" + 'DELETED' "$ZSH_THEME_GIT_PROMPT_DELETED" + 'UNMERGED' "$ZSH_THEME_GIT_PROMPT_UNMERGED" + 'AHEAD' "$ZSH_THEME_GIT_PROMPT_AHEAD" + 'BEHIND' "$ZSH_THEME_GIT_PROMPT_BEHIND" + 'DIVERGED' "$ZSH_THEME_GIT_PROMPT_DIVERGED" + 'STASHED' "$ZSH_THEME_GIT_PROMPT_STASHED" + ) + + # The order that the prompt displays should be added to the prompt + local status_constants + status_constants=( + UNTRACKED ADDED MODIFIED RENAMED DELETED + STASHED UNMERGED AHEAD BEHIND DIVERGED + ) + + local status_text="$(__git_prompt_git status --porcelain -b 2> /dev/null)" + + # Don't continue on a catastrophic failure + if [[ $? -eq 128 ]]; then + return 1 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" + + # A lookup table of each git status encountered + local -A statuses_seen + + if __git_prompt_git rev-parse --verify refs/stash &>/dev/null; then + statuses_seen[STASHED]=1 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" + + local status_lines + status_lines=("${(@f)${status_text}}") + + # If the tracking line exists, get and parse it + if [[ "$status_lines[1]" =~ "^## [^ ]+ \[(.*)\]" ]]; then + local branch_statuses + branch_statuses=("${(@s/,/)match}") + for branch_status in $branch_statuses; do + if [[ ! $branch_status =~ "(behind|diverged|ahead) ([0-9]+)?" ]]; then + continue + fi + local last_parsed_status=$prefix_constant_map[$match[1]] + statuses_seen[$last_parsed_status]=$match[2] + done 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 + + # For each status prefix, do a regex comparison + for status_prefix in ${(k)prefix_constant_map}; do + local status_constant="${prefix_constant_map[$status_prefix]}" + local status_regex=$'(^|\n)'"$status_prefix" + + if [[ "$status_text" =~ $status_regex ]]; then + statuses_seen[$status_constant]=1 + fi + done + + # Display the seen statuses in the order specified + local status_prompt + for status_constant in $status_constants; do + if (( ${+statuses_seen[$status_constant]} )); then + local next_display=$constant_prompt_map[$status_constant] + status_prompt="$next_display$status_prompt" + fi + done + + echo $status_prompt } # 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 + __git_prompt_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 + __git_prompt_git config user.email 2>/dev/null +} + +# Output the name of the root directory of the git repository +# Usage example: $(git_repo_name) +function git_repo_name() { + local repo_path + if repo_path="$(__git_prompt_git rev-parse --show-toplevel 2>/dev/null)" && [[ -n "$repo_path" ]]; then + echo ${repo_path:t} + fi } diff --git a/zsh/lib/grep.zsh b/zsh/lib/grep.zsh index abc1650..a725e0f 100644 --- a/zsh/lib/grep.zsh +++ b/zsh/lib/grep.zsh @@ -1,28 +1,41 @@ -# is x grep argument available? -grep-flag-available() { - echo | grep $1 "" >/dev/null 2>&1 -} +__GREP_CACHE_FILE="$ZSH_CACHE_DIR"/grep-alias -GREP_OPTIONS="" +# See if there's a cache file modified in the last day +__GREP_ALIAS_CACHES=("$__GREP_CACHE_FILE"(Nm-1)) +if [[ -n "$__GREP_ALIAS_CACHES" ]]; then + source "$__GREP_CACHE_FILE" +else + grep-flags-available() { + command grep "$@" "" &>/dev/null <<< "" + } -# color grep results -if grep-flag-available --color=auto; then - GREP_OPTIONS+=" --color=auto" + # Ignore these folders (if the necessary grep flags are available) + EXC_FOLDERS="{.bzr,CVS,.git,.hg,.svn,.idea,.tox}" + + # Check for --exclude-dir, otherwise check for --exclude. If --exclude + # isn't available, --color won't be either (they were released at the same + # time (v2.5): https://git.savannah.gnu.org/cgit/grep.git/tree/NEWS?id=1236f007 + if grep-flags-available --color=auto --exclude-dir=.cvs; then + GREP_OPTIONS="--color=auto --exclude-dir=$EXC_FOLDERS" + elif grep-flags-available --color=auto --exclude=.cvs; then + GREP_OPTIONS="--color=auto --exclude=$EXC_FOLDERS" + fi + + if [[ -n "$GREP_OPTIONS" ]]; then + # export grep, egrep and fgrep settings + alias grep="grep $GREP_OPTIONS" + alias egrep="egrep $GREP_OPTIONS" + alias fgrep="fgrep $GREP_OPTIONS" + + # write to cache file if cache directory is writable + if [[ -w "$ZSH_CACHE_DIR" ]]; then + alias -L grep egrep fgrep >| "$__GREP_CACHE_FILE" + fi + fi + + # Clean up + unset GREP_OPTIONS EXC_FOLDERS + unfunction grep-flags-available 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 +unset __GREP_CACHE_FILE __GREP_ALIAS_CACHES diff --git a/zsh/lib/history.zsh b/zsh/lib/history.zsh index 52e45bf..7940769 100644 --- a/zsh/lib/history.zsh +++ b/zsh/lib/history.zsh @@ -6,7 +6,8 @@ function omz_history { if [[ -n "$clear" ]]; then # if -c provided, clobber the history file echo -n >| "$HISTFILE" - echo >&2 History file deleted. Reload the session to see its effects. + fc -p "$HISTFILE" + echo >&2 History file deleted. elif [[ -n "$list" ]]; then # if -l provided, run as if calling `fc' directly builtin fc "$@" @@ -27,8 +28,8 @@ esac ## History file configuration [ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history" -HISTSIZE=50000 -SAVEHIST=10000 +[ "$HISTSIZE" -lt 50000 ] && HISTSIZE=50000 +[ "$SAVEHIST" -lt 10000 ] && SAVEHIST=10000 ## History command configuration setopt extended_history # record timestamp of command in HISTFILE @@ -36,5 +37,4 @@ setopt hist_expire_dups_first # delete duplicates first when HISTFILE size excee setopt hist_ignore_dups # ignore duplicated commands history list setopt hist_ignore_space # ignore commands that start with space setopt hist_verify # show command with history expansion to user before running it -setopt inc_append_history # add commands to HISTFILE in order of execution setopt share_history # share command history data diff --git a/zsh/lib/key-bindings.zsh b/zsh/lib/key-bindings.zsh index 0e056dc..aaa7304 100644 --- a/zsh/lib/key-bindings.zsh +++ b/zsh/lib/key-bindings.zsh @@ -15,55 +15,100 @@ if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then zle -N zle-line-finish fi -bindkey -e # Use emacs key bindings +# Use emacs key bindings +bindkey -e + +# [PageUp] - Up a line of history +if [[ -n "${terminfo[kpp]}" ]]; then + bindkey -M emacs "${terminfo[kpp]}" up-line-or-history + bindkey -M viins "${terminfo[kpp]}" up-line-or-history + bindkey -M vicmd "${terminfo[kpp]}" up-line-or-history +fi +# [PageDown] - Down a line of history +if [[ -n "${terminfo[knp]}" ]]; then + bindkey -M emacs "${terminfo[knp]}" down-line-or-history + bindkey -M viins "${terminfo[knp]}" down-line-or-history + bindkey -M vicmd "${terminfo[knp]}" down-line-or-history +fi + +# Start typing + [Up-Arrow] - fuzzy find history forward +if [[ -n "${terminfo[kcuu1]}" ]]; then + autoload -U up-line-or-beginning-search + zle -N up-line-or-beginning-search + + bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search + bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search + bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search +fi +# Start typing + [Down-Arrow] - fuzzy find history backward +if [[ -n "${terminfo[kcud1]}" ]]; then + autoload -U down-line-or-beginning-search + zle -N down-line-or-beginning-search + + bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search + bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search + bindkey -M vicmd "${terminfo[kcud1]}" down-line-or-beginning-search +fi + +# [Home] - Go to beginning of line +if [[ -n "${terminfo[khome]}" ]]; then + bindkey -M emacs "${terminfo[khome]}" beginning-of-line + bindkey -M viins "${terminfo[khome]}" beginning-of-line + bindkey -M vicmd "${terminfo[khome]}" beginning-of-line +fi +# [End] - Go to end of line +if [[ -n "${terminfo[kend]}" ]]; then + bindkey -M emacs "${terminfo[kend]}" end-of-line + bindkey -M viins "${terminfo[kend]}" end-of-line + bindkey -M vicmd "${terminfo[kend]}" end-of-line +fi + +# [Shift-Tab] - move through the completion menu backwards +if [[ -n "${terminfo[kcbt]}" ]]; then + bindkey -M emacs "${terminfo[kcbt]}" reverse-menu-complete + bindkey -M viins "${terminfo[kcbt]}" reverse-menu-complete + bindkey -M vicmd "${terminfo[kcbt]}" reverse-menu-complete +fi + +# [Backspace] - delete backward +bindkey -M emacs '^?' backward-delete-char +bindkey -M viins '^?' backward-delete-char +bindkey -M vicmd '^?' backward-delete-char +# [Delete] - delete forward +if [[ -n "${terminfo[kdch1]}" ]]; then + bindkey -M emacs "${terminfo[kdch1]}" delete-char + bindkey -M viins "${terminfo[kdch1]}" delete-char + bindkey -M vicmd "${terminfo[kdch1]}" delete-char +else + bindkey -M emacs "^[[3~" delete-char + bindkey -M viins "^[[3~" delete-char + bindkey -M vicmd "^[[3~" delete-char + + bindkey -M emacs "^[3;5~" delete-char + bindkey -M viins "^[3;5~" delete-char + bindkey -M vicmd "^[3;5~" delete-char +fi + +# [Ctrl-Delete] - delete whole forward-word +bindkey -M emacs '^[[3;5~' kill-word +bindkey -M viins '^[[3;5~' kill-word +bindkey -M vicmd '^[[3;5~' kill-word + +# [Ctrl-RightArrow] - move forward one word +bindkey -M emacs '^[[1;5C' forward-word +bindkey -M viins '^[[1;5C' forward-word +bindkey -M vicmd '^[[1;5C' forward-word +# [Ctrl-LeftArrow] - move backward one word +bindkey -M emacs '^[[1;5D' backward-word +bindkey -M viins '^[[1;5D' backward-word +bindkey -M vicmd '^[[1;5D' backward-word + 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 +bindkey ' ' magic-space # [Space] - don't do history expansion -# 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 diff --git a/zsh/lib/misc.zsh b/zsh/lib/misc.zsh index 36c3ae2..a5d3af9 100644 --- a/zsh/lib/misc.zsh +++ b/zsh/lib/misc.zsh @@ -3,15 +3,15 @@ autoload -Uz is-at-least # *-magic is known buggy in some versions; disable if so if [[ $DISABLE_MAGIC_FUNCTIONS != true ]]; 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 + 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 @@ -22,10 +22,10 @@ env_default 'PAGER' 'less' env_default 'LESS' '-R' ## super user alias -alias _='sudo' +alias _='sudo ' ## more intelligent acking for ubuntu users -if which ack-grep &> /dev/null; then +if (( $+commands[ack-grep] )); then alias afind='ack-grep -il' else alias afind='ack -il' diff --git a/zsh/lib/nvm.zsh b/zsh/lib/nvm.zsh index 4a8b681..2fe57a8 100644 --- a/zsh/lib/nvm.zsh +++ b/zsh/lib/nvm.zsh @@ -1,9 +1,6 @@ -# get the node.js version +# get the nvm-controlled 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} + which nvm &>/dev/null || return + local nvm_prompt=${$(nvm current)#v} echo "${ZSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt}${ZSH_THEME_NVM_PROMPT_SUFFIX}" } diff --git a/zsh/lib/prompt_info_functions.zsh b/zsh/lib/prompt_info_functions.zsh index 5069c4b..48f033d 100644 --- a/zsh/lib/prompt_info_functions.zsh +++ b/zsh/lib/prompt_info_functions.zsh @@ -18,6 +18,7 @@ function chruby_prompt_info \ vi_mode_prompt_info \ virtualenv_prompt_info \ jenv_prompt_info \ + tf_prompt_info \ { return 1 } diff --git a/zsh/lib/spectrum.zsh b/zsh/lib/spectrum.zsh index 312ab22..d5c22a8 100644 --- a/zsh/lib/spectrum.zsh +++ b/zsh/lib/spectrum.zsh @@ -1,4 +1,3 @@ -#! /bin/zsh # A script to make using 256 colors in zsh less painful. # P.C. Shyamshankar # Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ @@ -6,32 +5,31 @@ typeset -AHg FX FG BG FX=( - reset "%{%}" - bold "%{%}" no-bold "%{%}" - italic "%{%}" no-italic "%{%}" - underline "%{%}" no-underline "%{%}" - blink "%{%}" no-blink "%{%}" - reverse "%{%}" no-reverse "%{%}" + reset "%{%}" + bold "%{%}" no-bold "%{%}" + italic "%{%}" no-italic "%{%}" + underline "%{%}" no-underline "%{%}" + blink "%{%}" no-blink "%{%}" + reverse "%{%}" no-reverse "%{%}" ) for color in {000..255}; do - FG[$color]="%{[38;5;${color}m%}" - BG[$color]="%{[48;5;${color}m%}" + 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() { + local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris} for code in {000..255}; do - print -P -- "$code: %{$FG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}" + 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() { + local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris} for code in {000..255}; do - print -P -- "$code: %{$BG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}" + print -P -- "$code: $BG[$code]$ZSH_SPECTRUM_TEXT%{$reset_color%}" done } diff --git a/zsh/lib/termsupport.zsh b/zsh/lib/termsupport.zsh index aa14f3f..33451ef 100644 --- a/zsh/lib/termsupport.zsh +++ b/zsh/lib/termsupport.zsh @@ -10,39 +10,39 @@ function title { emulate -L zsh setopt prompt_subst - [[ "$EMACS" == *term* ]] && return + [[ "$INSIDE_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 + cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty|st*) + print -Pn "\e]2;${2:q}\a" # set window name + print -Pn "\e]1;${1:q}\a" # set tab name ;; screen*|tmux*) - print -Pn "\ek$1:q\e\\" # set screen hardstatus + 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 + 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 + 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: %~" +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" @@ -50,22 +50,52 @@ fi # Runs before showing the prompt function omz_termsupport_precmd { - emulate -L zsh - - if [[ "$DISABLE_AUTO_TITLE" == true ]]; then - return - fi - + [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE } # Runs before executing the command function omz_termsupport_preexec { + [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return + emulate -L zsh setopt extended_glob - if [[ "$DISABLE_AUTO_TITLE" == true ]]; then - return + # split command into array of arguments + local -a cmdargs + cmdargs=("${(z)2}") + # if running fg, extract the command from the job description + if [[ "${cmdargs[1]}" = fg ]]; then + # get the job id from the first argument passed to the fg command + local job_id jobspec="${cmdargs[2]#%}" + # logic based on jobs arguments: + # http://zsh.sourceforge.net/Doc/Release/Jobs-_0026-Signals.html#Jobs + # https://www.zsh.org/mla/users/2007/msg00704.html + case "$jobspec" in + <->) # %number argument: + # use the same passed as an argument + job_id=${jobspec} ;; + ""|%|+) # empty, %% or %+ argument: + # use the current job, which appears with a + in $jobstates: + # suspended:+:5071=suspended (tty output) + job_id=${(k)jobstates[(r)*:+:*]} ;; + -) # %- argument: + # use the previous job, which appears with a - in $jobstates: + # suspended:-:6493=suspended (signal) + job_id=${(k)jobstates[(r)*:-:*]} ;; + [?]*) # %?string argument: + # use $jobtexts to match for a job whose command *contains* + job_id=${(k)jobtexts[(r)*${(Q)jobspec}*]} ;; + *) # %string argument: + # use $jobtexts to match for a job whose command *starts with* + job_id=${(k)jobtexts[(r)${(Q)jobspec}*]} ;; + esac + + # override preexec function arguments with job command + if [[ -n "${jobtexts[$job_id]}" ]]; then + 1="${jobtexts[$job_id]}" + 2="${jobtexts[$job_id]}" + fi fi # cmd name only, or if this is sudo or ssh, the next cmd @@ -75,8 +105,9 @@ function omz_termsupport_preexec { title '$CMD' '%100>...>$LINE%<<' } -precmd_functions+=(omz_termsupport_precmd) -preexec_functions+=(omz_termsupport_preexec) +autoload -U add-zsh-hook +add-zsh-hook precmd omz_termsupport_precmd +add-zsh-hook preexec omz_termsupport_preexec # Keep Apple Terminal.app's current working directory updated @@ -90,16 +121,17 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then function update_terminalapp_cwd() { emulate -L zsh - # Percent-encode the pathname. - local URL_PATH="$(omz_urlencode -P $PWD)" - [[ $? != 0 ]] && return 1 + # Percent-encode the host and path names. + local URL_HOST URL_PATH + URL_HOST="$(omz_urlencode -P $HOST)" || return 1 + URL_PATH="$(omz_urlencode -P $PWD)" || return 1 # Undocumented Terminal.app-specific control sequence - printf '\e]7;%s\a' "file://$HOST$URL_PATH" + printf '\e]7;%s\a' "file://$URL_HOST$URL_PATH" } # Use a precmd hook instead of a chpwd hook to avoid contaminating output - precmd_functions+=(update_terminalapp_cwd) + add-zsh-hook precmd update_terminalapp_cwd # Run once to get initial cwd set update_terminalapp_cwd fi diff --git a/zsh/lib/theme-and-appearance.zsh b/zsh/lib/theme-and-appearance.zsh index 5016d86..0b71de3 100644 --- a/zsh/lib/theme-and-appearance.zsh +++ b/zsh/lib/theme-and-appearance.zsh @@ -39,6 +39,11 @@ if [[ "$DISABLE_LS_COLORS" != "true" ]]; then fi fi +# enable diff color if possible. +if command diff --color . . &>/dev/null; then + alias diff='diff --color' +fi + setopt auto_cd setopt multios setopt prompt_subst diff --git a/zsh/oh-my-zsh.sh b/zsh/oh-my-zsh.sh index 6b2662d..16e244b 100644 --- a/zsh/oh-my-zsh.sh +++ b/zsh/oh-my-zsh.sh @@ -1,17 +1,15 @@ +# If ZSH is not defined, use the current script's directory. +[[ -z "$ZSH" ]] && export ZSH="${${(%):-%x}:a:h}" + # 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 -# Migrate .zsh-update file to $ZSH_CACHE_DIR -if [ -f ~/.zsh-update ] && [ ! -f ${ZSH_CACHE_DIR}/.zsh-update ]; then - mv ~/.zsh-update ${ZSH_CACHE_DIR}/.zsh-update -fi - # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then - env ZSH=$ZSH ZSH_CACHE_DIR=$ZSH_CACHE_DIR DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh + source $ZSH/tools/check_for_upgrade.sh fi # Initializes Oh My Zsh @@ -32,8 +30,8 @@ fi 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 + builtin test -f $base_dir/plugins/$name/$name.plugin.zsh \ + || builtin test -f $base_dir/plugins/$name/_$name } # Add all defined plugins to fpath. This must be done @@ -61,6 +59,17 @@ if [ -z "$ZSH_COMPDUMP" ]; then ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" fi +# Construct zcompdump OMZ metadata +zcompdump_revision="#omz revision: $(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)" +zcompdump_fpath="#omz fpath: $fpath" + +# Delete the zcompdump file if OMZ zcompdump metadata changed +if ! command grep -q -Fx "$zcompdump_revision" "$ZSH_COMPDUMP" 2>/dev/null \ + || ! command grep -q -Fx "$zcompdump_fpath" "$ZSH_COMPDUMP" 2>/dev/null; then + command rm -f "$ZSH_COMPDUMP" + zcompdump_refresh=1 +fi + if [[ $ZSH_DISABLE_COMPFIX != true ]]; then source $ZSH/lib/compfix.zsh # If completion insecurities exist, warn the user @@ -72,6 +81,19 @@ else compinit -u -C -d "${ZSH_COMPDUMP}" fi +# Append zcompdump metadata if missing +if (( $zcompdump_refresh )); then + # Use `tee` in case the $ZSH_COMPDUMP filename is invalid, to silence the error + # See https://github.com/ohmyzsh/ohmyzsh/commit/dd1a7269#commitcomment-39003489 + tee -a "$ZSH_COMPDUMP" &>/dev/null <` as well as ``. + +| Function | Command | +| ------------------------- | --------------------------------- | +| ardu [URL or revision_id] | `arc diff --update` [revision_id] | +| arpa [URL or revision_id] | `arc patch` [revision_id] | diff --git a/zsh/plugins/arcanist/arcanist.plugin.zsh b/zsh/plugins/arcanist/arcanist.plugin.zsh index 3f4eb07..88e6713 100644 --- a/zsh/plugins/arcanist/arcanist.plugin.zsh +++ b/zsh/plugins/arcanist/arcanist.plugin.zsh @@ -9,13 +9,29 @@ alias arco='arc cover' alias arci='arc commit' alias ard='arc diff' +alias ardc='arc diff --create' alias ardnu='arc diff --nounit' alias ardnupc='arc diff --nounit --plan-changes' alias ardpc='arc diff --plan-changes' +alias ardp='arc diff --preview' # creates a new diff in the phab interface alias are='arc export' alias arh='arc help' alias arl='arc land' alias arli='arc lint' alias arls='arc list' -alias arpa='arc patch' + +# +# Functions +# (sorted alphabetically) +# + +ardu() { + # Both `ardu https://arcanist-url.com/`, and `ardu ` work. + arc diff --update "${1:t}" +} + +arpa() { + # Both `arpa https://arcanist-url.com/`, and `arpa ` work. + arc patch "${1:t}" +} diff --git a/zsh/plugins/archlinux/README.md b/zsh/plugins/archlinux/README.md index ff2b6a4..d6b41ee 100644 --- a/zsh/plugins/archlinux/README.md +++ b/zsh/plugins/archlinux/README.md @@ -1,146 +1,198 @@ -# Archlinux plugin +# Arch Linux plugin + +This plugin adds some aliases and functions to work with Arch Linux. + +To use it, add `archlinux` to the plugins array in your zshrc file: + +```zsh +plugins=(... archlinux) +``` ## Features -#### YAY +### Pacman -| Alias | Command | Description | -|---------|------------------------------------|---------------------------------------------------------------------| -| yaconf | yay -Pg | Print current configuration | -| yain | yay -S | Install packages from the repositories | -| yains | yay -U | Install a package from a local file | -| yainsd | yay -S --asdeps | Install packages as dependencies of another package | -| yaloc | yay -Qi | Display information about a package in the local database | -| yalocs | yay -Qs | Search for packages in the local database | -| yalst | yay -Qe | List installed packages including from AUR (tagged as "local") | -| yamir | yay -Syy | Force refresh of all package lists after updating mirrorlist | -| yaorph | yay -Qtd | Remove orphans using yay | -| yare | yay -R | Remove packages, keeping its settings and dependencies | -| yarem | yay -Rns | Remove packages, including its settings and unneeded dependencies | -| yarep | yay -Si | Display information about a package in the repositories | -| yareps | yay -Ss | Search for packages in the repositories | -| yaupg | yay -Syu | Sync with repositories before upgrading packages | -| yasu | yay -Syu --no-confirm | Same as `yaupg`, but without confirmation | +| 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` | Update and refresh local package, ABS and AUR databases | +| pacupg | `sudo pacman -Syu` | Sync with repositories before upgrading packages | +| pacfileupg | `sudo pacman -Fy` | Download fresh package databases from the server | +| pacfiles | `pacman -F` | Search package file names for matching strings | +| pacls | `pacman -Ql` | List files in a package | +| pacown | `pacman -Qo` | Show which package owns a file | +| upgrade[²](#f2) | `sudo pacman -Syu` | Sync with repositories before upgrading packages | -#### TRIZEN +| Function | Description | +|----------------|-----------------------------------------------------------| +| pacdisowned | List all disowned files in your system | +| paclist | List all explicitly installed packages with a description | +| pacmanallkeys | Get all keys for developers and trusted users | +| pacmansignkeys | Locally trust all keys passed as parameters | +| pacweb | Open the website of an ArchLinux package | -| Alias | Command | Description | -|---------|------------------------------------|---------------------------------------------------------------------| -| trconf | trizen -C | Fix all configuration files with vimdiff | -| trin | trizen -S | Install packages from the repositories | -| trins | trizen -U | Install a package from a local file | -| trinsd | trizen -S --asdeps | Install packages as dependencies of another package | -| trloc | trizen -Qi | Display information about a package in the local database | -| trlocs | trizen -Qs | Search for packages in the local database | -| trlst | trizen -Qe | List installed packages including from AUR (tagged as "local") | -| trmir | trizen -Syy | Force refresh of all package lists after updating mirrorlist | -| trorph | trizen -Qtd | Remove orphans using yaourt | -| trre | trizen -R | Remove packages, keeping its settings and dependencies | -| trrem | trizen -Rns | Remove packages, including its settings and unneeded dependencies | -| trrep | trizen -Si | Display information about a package in the repositories | -| trreps | trizen -Ss | Search for packages in the repositories | -| trupd | trizen -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases | -| trupd | trizen -Sy && sudo abs | Update and refresh the local package and ABS databases | -| trupd | trizen -Sy && sudo aur | Update and refresh the local package and AUR databases | -| trupd | trizen -Sy | Update and refresh the local package database | -| trupg | trizen -Syua | Sync with repositories before upgrading all packages (from AUR too) | -| trsu | trizen -Syua --no-confirm | Same as `trupg`, but without confirmation | -| upgrade | trizen -Syu | Sync with repositories before upgrading packages | +Note: paclist used to print packages with a description which are (1) explicitly installed +and (2) available for upgrade. Due to flawed scripting, it also printed all packages if no +upgrades were available. Use `pacman -Que` instead. -#### YAOURT +### AUR helpers -| 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 | +#### Aura -#### PACAUR +| Alias | Command | Description | +|---------|-------------------------------------------------|-------------------------------------------------------------------------| +| auin | `sudo aura -S` | Install packages from the repositories | +| aurin | `sudo aura -A` | Install packages from the repositories | +| auins | `sudo aura -U` | Install a package from a local file | +| auinsd | `sudo aura -S --asdeps` | Install packages as dependencies of another package (repositories only) | +| aurinsd | `sudo aura -A --asdeps` | Install packages as dependencies of another package (AUR only) | +| auloc | `aura -Qi` | Display information about a package in the local database | +| aulocs | `aura -Qs` | Search for packages in the local database | +| auls | `aura -Qql` | List all files owned by a given package | +| aulst | `aura -Qe` | List installed packages including from AUR (tagged as "local") | +| aumir | `sudo aura -Syy` | Force refresh of all package lists after updating mirrorlist | +| aurph | `sudo aura -Oj` | Remove orphans using aura | +| auown | `aura -Qqo` | Search for packages that own the specified file(s) | +| aure | `sudo aura -R` | Remove packages, keeping its settings and dependencies | +| aurem | `sudo aura -Rns` | Remove packages, including its settings and unneeded dependencies | +| aurep | `aura -Si` | Display information about a package in the repositories | +| aurrep | `aura -Ai` | Display information about a package from AUR | +| aureps | `aura -As --both` | Search for packages in the repositories and AUR | +| auras | `aura -As --both` | Same as above | +| auupd | `sudo aura -Sy` | Update and refresh local package, ABS and AUR databases | +| auupg | `sudo sh -c "aura -Syu && aura -Au"` | Sync with repositories before upgrading all packages (from AUR too) | +| ausu | `sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm"` | Same as `auupg`, but without confirmation | +| upgrade[²](#f2) | `sudo aura -Syu` | Sync with repositories before upgrading packages | -| 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 | +| Function | Description | +|-----------------|---------------------------------------------------------------------| +| auownloc _file_ | Display information about a package that owns the specified file(s) | +| auownls _file_ | List all files owned by a package that owns the specified file(s) | -#### PACMAN +#### Pacaur -| 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 | -| pacls | pacman -Ql | List files in a package | -| pacown | pacman -Qo | Show which package owns a file | +| 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` | Update and refresh local package, ABS and AUR databases | +| 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[²](#f2) | `pacaur -Syu` | Sync with repositories before upgrading packages | -| 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 | -| pacweb | Open the website of an ArchLinux package | +#### Trizen + +| Alias | Command | Description | +|---------|-----------------------------------|---------------------------------------------------------------------| +| trconf | `trizen -C` | Fix all configuration files with vimdiff | +| trin | `trizen -S` | Install packages from the repositories | +| trins | `trizen -U` | Install a package from a local file | +| trinsd | `trizen -S --asdeps` | Install packages as dependencies of another package | +| trloc | `trizen -Qi` | Display information about a package in the local database | +| trlocs | `trizen -Qs` | Search for packages in the local database | +| trlst | `trizen -Qe` | List installed packages including from AUR (tagged as "local") | +| trmir | `trizen -Syy` | Force refresh of all package lists after updating mirrorlist | +| trorph | `trizen -Qtd` | Remove orphans using yaourt | +| trre | `trizen -R` | Remove packages, keeping its settings and dependencies | +| trrem | `trizen -Rns` | Remove packages, including its settings and unneeded dependencies | +| trrep | `trizen -Si` | Display information about a package in the repositories | +| trreps | `trizen -Ss` | Search for packages in the repositories | +| trupd | `trizen -Sy` | Update and refresh local package, ABS and AUR databases | +| trupg | `trizen -Syua` | Sync with repositories before upgrading all packages (from AUR too) | +| trsu | `trizen -Syua --no-confirm` | Same as `trupg`, but without confirmation | +| upgrade[²](#f2) | `trizen -Syu` | Sync with repositories before upgrading packages | + +#### Yaourt[¹](#f1) + +| 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` | Update and refresh local package, ABS and AUR databases | +| 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[²](#f2) | `yaourt -Syu` | Sync with repositories before upgrading packages | + +#### Yay[¹](#f1) + +| Alias | Command | Description | +|---------|--------------------------------|-------------------------------------------------------------------| +| yaconf | `yay -Pg` | Print current configuration | +| yain | `yay -S` | Install packages from the repositories | +| yains | `yay -U` | Install a package from a local file | +| yainsd | `yay -S --asdeps` | Install packages as dependencies of another package | +| yaloc | `yay -Qi` | Display information about a package in the local database | +| yalocs | `yay -Qs` | Search for packages in the local database | +| yalst | `yay -Qe` | List installed packages including from AUR (tagged as "local") | +| yamir | `yay -Syy` | Force refresh of all package lists after updating mirrorlist | +| yaorph | `yay -Qtd` | Remove orphans using yay | +| yare | `yay -R` | Remove packages, keeping its settings and dependencies | +| yarem | `yay -Rns` | Remove packages, including its settings and unneeded dependencies | +| yarep | `yay -Si` | Display information about a package in the repositories | +| yareps | `yay -Ss` | Search for packages in the repositories | +| yaupd | `yay -Sy` | Update and refresh local package, ABS and AUR databases | +| yaupg | `yay -Syu` | Sync with repositories before upgrading packages | +| yasu | `yay -Syu --no-confirm` | Same as `yaupg`, but without confirmation | +| upgrade[²](#f2) | `yay -Syu` | Sync with repositories before upgrading packages | --- +¹ +Yay and Yaourt aliases overlap. If both are installed, yay will take precedence. + +² +The `upgrade` alias is set for all package managers. Its value will depend on +whether the package manager is installed, checked in the following order: + +1. `yay` +2. `yaourt` +3. `trizen` +4. `pacaur` +5. `aura` +6. `pacman` + ## Contributors - Benjamin Boudreau - dreurmail@gmail.com - Celso Miranda - contacto@celsomiranda.net +- ratijas (ivan tkachenko) - me@ratijas.tk +- Juraj Fiala - doctorjellyface@riseup.net - KhasMek - Boushh@gmail.com +- Majora320 (Moses Miller) - Majora320@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 - Ybalrid (Arthur Brainville) - ybalrid@ybalrid.info +- Jeff M. Hubbard - jeffmhubbard@gmail.com diff --git a/zsh/plugins/archlinux/archlinux.plugin.zsh b/zsh/plugins/archlinux/archlinux.plugin.zsh index e0101c7..c94fb8f 100644 --- a/zsh/plugins/archlinux/archlinux.plugin.zsh +++ b/zsh/plugins/archlinux/archlinux.plugin.zsh @@ -1,3 +1,138 @@ +####################################### +# Pacman # +####################################### + +# 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 -F' +alias pacls='pacman -Ql' +alias pacown='pacman -Qo' +alias pacupd="sudo pacman -Sy" +alias upgrade='sudo pacman -Syu' + +function paclist() { + # Based on https://bbs.archlinux.org/viewtopic.php?id=93683 + pacman -Qqe | \ + xargs -I '{}' \ + expac "${bold_color}% 20n ${fg_no_bold[white]}%d${reset_color}" '{}' +} + +function pacdisowned() { + local tmp db fs + 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" +} + +alias pacmanallkeys='sudo pacman-key --refresh-keys' + +function pacmansignkeys() { + local key + 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 +} + +if (( $+commands[xdg-open] )); then + function pacweb() { + if [[ $# = 0 || "$1" =~ '--help|-h' ]]; then + local underline_color="\e[${color[underline]}m" + echo "$0 - open the website of an ArchLinux package" + echo + echo "Usage:" + echo " $bold_color$0$reset_color ${underline_color}target${reset_color}" + return 1 + fi + + local pkg="$1" + local infos="$(LANG=C pacman -Si "$pkg")" + if [[ -z "$infos" ]]; then + return + fi + local repo="$(grep -m 1 '^Repo' <<< "$infos" | grep -oP '[^ ]+$')" + local arch="$(grep -m 1 '^Arch' <<< "$infos" | grep -oP '[^ ]+$')" + xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null + } +fi + +####################################### +# AUR helpers # +####################################### + +if (( $+commands[aura] )); then + alias auin='sudo aura -S' + alias aurin='sudo aura -A' + alias auins='sudo aura -U' + alias auinsd='sudo aura -S --asdeps' + alias aurinsd='sudo aura -A --asdeps' + alias auloc='aura -Qi' + alias aulocs='aura -Qs' + alias aulst='aura -Qe' + alias aumir='sudo aura -Syy' + alias aurph='sudo aura -Oj' + alias aure='sudo aura -R' + alias aurem='sudo aura -Rns' + alias aurep='aura -Si' + alias aurrep='aura -Ai' + alias aureps='aura -As --both' + alias auras='aura -As --both' + alias auupd="sudo aura -Sy" + alias auupg='sudo sh -c "aura -Syu && aura -Au"' + alias ausu='sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm"' + alias upgrade='sudo aura -Syu' + + # extra bonus specially for aura + alias auown="aura -Qqo" + alias auls="aura -Qql" + function auownloc() { aura -Qi $(aura -Qqo $@); } + function auownls () { aura -Qql $(aura -Qqo $@); } +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' + alias paupd="pacaur -Sy" + alias upgrade='pacaur -Syu' +fi + if (( $+commands[trizen] )); then alias trconf='trizen -C' alias trupg='trizen -Syua' @@ -14,17 +149,8 @@ if (( $+commands[trizen] )); then alias trorph='trizen -Qtd' alias trinsd='trizen -S --asdeps' alias trmir='trizen -Syy' - - - if (( $+commands[abs] && $+commands[aur] )); then - alias trupd='trizen -Sy && sudo abs && sudo aur' - elif (( $+commands[abs] )); then - alias trupd='trizen -Sy && sudo abs' - elif (( $+commands[aur] )); then - alias trupd='trizen -Sy && sudo aur' - else - alias trupd='trizen -Sy' - fi + alias trupd="trizen -Sy" + alias upgrade='trizen -Syu' fi if (( $+commands[yaourt] )); then @@ -43,17 +169,8 @@ if (( $+commands[yaourt] )); then 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 + alias yaupd="yaourt -Sy" + alias upgrade='yaourt -Syu' fi if (( $+commands[yay] )); then @@ -72,148 +189,7 @@ if (( $+commands[yay] )); then alias yaorph='yay -Qtd' alias yainsd='yay -S --asdeps' alias yamir='yay -Syy' - - - if (( $+commands[abs] && $+commands[aur] )); then - alias yaupd='yay -Sy && sudo abs && sudo aur' - elif (( $+commands[abs] )); then - alias yaupd='yay -Sy && sudo abs' - elif (( $+commands[aur] )); then - alias yaupd='yay -Sy && sudo aur' - else - alias yaupd='yay -Sy' - fi + alias yaupd="yay -Sy" + alias upgrade='yay -Syu' 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[trizen] )); then - function upgrade() { - trizen -Syu - } -elif (( $+commands[pacaur] )); then - function upgrade() { - pacaur -Syu - } -elif (( $+commands[yaourt] )); then - function upgrade() { - yaourt -Syu - } -elif (( $+commands[yay] )); then - function upgrade() { - yay -Syu - } -else - function 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 -Fs' -alias pacls='pacman -Ql' -alias pacown='pacman -Qo' - - -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 - -function 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}' -} - -function 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" -} - -function 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 -} - -function 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 -} - -if (( $+commands[xdg-open] )); then - function pacweb() { - pkg="$1" - infos="$(pacman -Si "$pkg")" - if [[ -z "$infos" ]]; then - return - fi - repo="$(grep '^Repo' <<< "$infos" | grep -oP '[^ ]+$')" - arch="$(grep '^Arch' <<< "$infos" | grep -oP '[^ ]+$')" - xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null - } -fi diff --git a/zsh/plugins/asdf/asdf.plugin.zsh b/zsh/plugins/asdf/asdf.plugin.zsh index 38b2255..c386d57 100644 --- a/zsh/plugins/asdf/asdf.plugin.zsh +++ b/zsh/plugins/asdf/asdf.plugin.zsh @@ -3,7 +3,7 @@ ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}" ASDF_COMPLETIONS="$ASDF_DIR/completions" # If not found, check for Homebrew package -if [[ ! -f "$ASDF_DIR/asdf.sh" ]] && (( $+commands[brew] )); then +if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && (( $+commands[brew] )); then ASDF_DIR="$(brew --prefix asdf)" ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d" fi diff --git a/zsh/plugins/autoenv/README.md b/zsh/plugins/autoenv/README.md new file mode 100644 index 0000000..5dfb5fb --- /dev/null +++ b/zsh/plugins/autoenv/README.md @@ -0,0 +1,20 @@ +# Autoenv plugin + +This plugin loads the [Autoenv](https://github.com/inishchith/autoenv). + +To use it, add `autoenv` to the plugins array in your zshrc file: + +```zsh +plugins=(... autoenv) +``` + +## Functions + +* `use_env()`: creates and/or activates a virtualenv. For use in `.env` files. + See the source code for details. + +## Requirements + +In order to make this work, you will need to have the autoenv installed. + +More info on the usage and install at [the project's homepage](https://github.com/inishchith/autoenv). diff --git a/zsh/plugins/autoenv/autoenv.plugin.zsh b/zsh/plugins/autoenv/autoenv.plugin.zsh index 3c1b0fa..bd03cf4 100644 --- a/zsh/plugins/autoenv/autoenv.plugin.zsh +++ b/zsh/plugins/autoenv/autoenv.plugin.zsh @@ -1,12 +1,39 @@ -# Activates autoenv or reports its failure +# Initialization: activate autoenv or report its absence () { +local d autoenv_dir install_locations if ! type autoenv_init >/dev/null; then - for d (~/.autoenv ~/.local/bin /usr/local/opt/autoenv /usr/local/bin); do + # Check if activate.sh is in $PATH + if (( $+commands[activate.sh] )); then + autoenv_dir="${commands[activate.sh]:h}" + fi + + # Locate autoenv installation + if [[ -z $autoenv_dir ]]; then + install_locations=( + ~/.autoenv + ~/.local/bin + /usr/local/opt/autoenv + /usr/local/bin + /usr/share/autoenv-git + ~/Library/Python/bin + ) + for d ( $install_locations ); do + if [[ -e $d/activate.sh ]]; then + autoenv_dir=$d + break + fi + done + fi + + # Look for Homebrew path as a last resort + if [[ -z "$autoenv_dir" ]] && (( $+commands[brew] )); then + d=$(brew --prefix)/opt/autoenv if [[ -e $d/activate.sh ]]; then autoenv_dir=$d - break fi - done + fi + + # Complain if autoenv is not installed if [[ -z $autoenv_dir ]]; then cat <&2 -------- AUTOENV --------- @@ -17,6 +44,7 @@ In the meantime the autoenv plugin is DISABLED. END return 1 fi + # Load autoenv source $autoenv_dir/activate.sh fi } @@ -27,17 +55,17 @@ fi # 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 + local 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/zsh/plugins/autojump/README.md b/zsh/plugins/autojump/README.md index 18ff793..750ff56 100644 --- a/zsh/plugins/autojump/README.md +++ b/zsh/plugins/autojump/README.md @@ -8,4 +8,4 @@ To use it, add `autojump` to the plugins array in your zshrc file: plugins=(... autojump) ``` -More info on the usage: https://github.com/wting/autojump +**Note:** you have to [install autojump](https://github.com/wting/autojump#installation) first. diff --git a/zsh/plugins/autojump/autojump.plugin.zsh b/zsh/plugins/autojump/autojump.plugin.zsh index d80c888..f40b0e9 100644 --- a/zsh/plugins/autojump/autojump.plugin.zsh +++ b/zsh/plugins/autojump/autojump.plugin.zsh @@ -29,6 +29,6 @@ if (( ! found && $+commands[brew] )); then fi fi -(( ! found )) && echo '[oh-my-zsh] autojump script not found' +(( ! found )) && echo '[oh-my-zsh] autojump not found. Please install it first.' unset autojump_paths file found diff --git a/zsh/plugins/aws/README.md b/zsh/plugins/aws/README.md index 57c3b54..011bbd8 100644 --- a/zsh/plugins/aws/README.md +++ b/zsh/plugins/aws/README.md @@ -15,6 +15,13 @@ plugins=(... aws) It also sets `$AWS_EB_PROFILE` to `` for the Elastic Beanstalk CLI. Run `asp` without arguments to clear the profile. +* `acp []`: in addition to `asp` functionality, it actually changes the profile by + assuming the role specified in the `` configuration. It supports MFA and sets + `$AWS_ACCESS_KEY_ID`, `$AWS_SECRET_ACCESS_KEY` and `$AWS_SESSION_TOKEN`, if obtained. It + requires the roles to be configured as per the + [official guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html). + Run `acp` without arguments to clear the profile. + * `agp`: gets the current value of `$AWS_PROFILE`. * `aws_change_access_key`: changes the AWS access key of a profile. @@ -33,6 +40,36 @@ plugins=(... aws) The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays the current `$AWS_PROFILE`. It uses two variables to control how that is shown: -- ZSH_THEME_AWS_PREFIX: sets the prefix of the AWS_PROFILE. Defaults to ``. +* ZSH_THEME_AWS_SUFFIX: sets the suffix of the AWS_PROFILE. Defaults to `>`. + +## Configuration + +[Configuration and credential file settings](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) by AWS + +### Scenario: IAM roles with a source profile and MFA authentication + +Source profile credentials in `~/.aws/credentials`: + +``` +[source-profile-name] +aws_access_key_id = ... +aws_secret_access_key = ... +``` + +Role configuration in `~/.aws/config`: + +``` +[profile source-profile-name] +mfa_serial = arn:aws:iam::111111111111:mfa/myuser +region = us-east-1 +output = json + +[profile profile-with-role] +role_arn = arn:aws:iam::9999999999999:role/myrole +mfa_serial = arn:aws:iam::111111111111:mfa/myuser +source_profile = source-profile-name +region = us-east-1 +output = json +``` diff --git a/zsh/plugins/aws/aws.plugin.zsh b/zsh/plugins/aws/aws.plugin.zsh index 231ac5a..e1566b1 100644 --- a/zsh/plugins/aws/aws.plugin.zsh +++ b/zsh/plugins/aws/aws.plugin.zsh @@ -10,7 +10,8 @@ function asp() { return fi - local available_profiles=($(aws_profiles)) + local -a available_profiles + available_profiles=($(aws_profiles)) if [[ -z "${available_profiles[(r)$1]}" ]]; then echo "${fg[red]}Profile '$1' not found in '${AWS_CONFIG_FILE:-$HOME/.aws/config}'" >&2 echo "Available profiles: ${(j:, :)available_profiles:-no profiles found}${reset_color}" >&2 @@ -22,31 +23,131 @@ function asp() { export AWS_EB_PROFILE=$1 } +# AWS profile switch +function acp() { + if [[ -z "$1" ]]; then + unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE + unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN + echo AWS profile cleared. + return + fi + + local -a available_profiles + available_profiles=($(aws_profiles)) + if [[ -z "${available_profiles[(r)$1]}" ]]; then + echo "${fg[red]}Profile '$1' not found in '${AWS_CONFIG_FILE:-$HOME/.aws/config}'" >&2 + echo "Available profiles: ${(j:, :)available_profiles:-no profiles found}${reset_color}" >&2 + return 1 + fi + + local profile="$1" + + # Get fallback credentials for if the aws command fails or no command is run + local aws_access_key_id="$(aws configure get aws_access_key_id --profile $profile)" + local aws_secret_access_key="$(aws configure get aws_secret_access_key --profile $profile)" + local aws_session_token="$(aws configure get aws_session_token --profile $profile)" + + + # First, if the profile has MFA configured, lets get the token and session duration + local mfa_serial="$(aws configure get mfa_serial --profile $profile)" + local sess_duration="$(aws configure get duration_seconds --profile $profile)" + + if [[ -n "$mfa_serial" ]]; then + local -a mfa_opt + local mfa_token + echo -n "Please enter your MFA token for $mfa_serial: " + read -r mfa_token + if [[ -z "$sess_duration" ]]; then + echo -n "Please enter the session duration in seconds (900-43200; default: 3600, which is the default maximum for a role): " + read -r sess_duration + fi + mfa_opt=(--serial-number "$mfa_serial" --token-code "$mfa_token" --duration-seconds "${sess_duration:-3600}") + + # Now see whether we need to just MFA for the current role, or assume a different one + local role_arn="$(aws configure get role_arn --profile $profile)" + local sess_name="$(aws configure get role_session_name --profile $profile)" + + if [[ -n "$role_arn" ]]; then + # Means we need to assume a specified role + aws_command=(aws sts assume-role --role-arn "$role_arn" "${mfa_opt[@]}") + + # Check whether external_id is configured to use while assuming the role + local external_id="$(aws configure get external_id --profile $profile)" + if [[ -n "$external_id" ]]; then + aws_command+=(--external-id "$external_id") + fi + + # Get source profile to use to assume role + local source_profile="$(aws configure get source_profile --profile $profile)" + if [[ -z "$sess_name" ]]; then + sess_name="${source_profile:-profile}" + fi + aws_command+=(--profile="${source_profile:-profile}" --role-session-name "${sess_name}") + + echo "Assuming role $role_arn using profile ${source_profile:-profile}" + else + # Means we only need to do MFA + aws_command=(aws sts get-session-token --profile="$profile" "${mfa_opt[@]}") + echo "Obtaining session token for profile $profile" + fi + + # Format output of aws command for easier processing + aws_command+=(--query '[Credentials.AccessKeyId,Credentials.SecretAccessKey,Credentials.SessionToken]' --output text) + + # Run the aws command to obtain credentials + local -a credentials + credentials=(${(ps:\t:)"$(${aws_command[@]})"}) + + if [[ -n "$credentials" ]]; then + aws_access_key_id="${credentials[1]}" + aws_secret_access_key="${credentials[2]}" + aws_session_token="${credentials[3]}" + fi + fi + + # Switch to AWS profile + if [[ -n "${aws_access_key_id}" && -n "$aws_secret_access_key" ]]; then + export AWS_DEFAULT_PROFILE="$profile" + export AWS_PROFILE="$profile" + export AWS_EB_PROFILE="$profile" + export AWS_ACCESS_KEY_ID="$aws_access_key_id" + export AWS_SECRET_ACCESS_KEY="$aws_secret_access_key" + + if [[ -n "$aws_session_token" ]]; then + export AWS_SESSION_TOKEN="$aws_session_token" + else + unset AWS_SESSION_TOKEN + fi + + echo "Switched to AWS Profile: $profile" + fi +} + function aws_change_access_key() { if [[ -z "$1" ]]; then echo "usage: $0 " return 1 fi - echo Insert the credentials when asked. + echo "Insert the credentials when asked." asp "$1" || return 1 - aws iam create-access-key - aws configure --profile "$1" + AWS_PAGER="" aws iam create-access-key + AWS_PAGER="" aws configure --profile "$1" - echo You can now safely delete the old access key running \`aws iam delete-access-key --access-key-id ID\` - echo Your current keys are: - aws iam list-access-keys + echo "You can now safely delete the old access key running \`aws iam delete-access-key --access-key-id ID\`" + echo "Your current keys are:" + AWS_PAGER="" aws iam list-access-keys } function aws_profiles() { [[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1 - grep '\[profile' "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/' + grep --color=never -Eo '\[.*\]' "${AWS_CONFIG_FILE:-$HOME/.aws/config}" | sed -E 's/^[[:space:]]*\[(profile)?[[:space:]]*([-_[:alnum:]\.@]+)\][[:space:]]*$/\2/g' } function _aws_profiles() { reply=($(aws_profiles)) } -compctl -K _aws_profiles asp aws_change_access_key +compctl -K _aws_profiles asp acp aws_change_access_key # AWS prompt function aws_prompt_info() { @@ -54,43 +155,52 @@ function aws_prompt_info() { echo "${ZSH_THEME_AWS_PREFIX:=}" } -if [ "$SHOW_AWS_PROMPT" != false ]; then +if [[ "$SHOW_AWS_PROMPT" != false && "$RPROMPT" != *'$(aws_prompt_info)'* ]]; then RPROMPT='$(aws_prompt_info)'"$RPROMPT" fi # Load awscli completions -function _awscli-homebrew-installed() { - # check if Homebrew is installed - (( $+commands[brew] )) || return 1 +# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back +if command -v aws_completer &> /dev/null; then + autoload -Uz bashcompinit && bashcompinit + complete -C aws_completer aws +else + function _awscli-homebrew-installed() { + # check if Homebrew is installed + (( $+commands[brew] )) || return 1 - # speculatively check default brew prefix - if [ -h /usr/local/opt/awscli ]; then - _brew_prefix=/usr/local/opt/awscli - else - # ok, it is not in the 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) + # speculatively check default brew prefix + if [ -h /usr/local/opt/awscli ]; then + _brew_prefix=/usr/local/opt/awscli + else + # ok, it is not in the 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 + } + + # get aws_zsh_completer.sh location from $PATH + _aws_zsh_completer_path="$commands[aws_zsh_completer.sh]" + + # otherwise check common locations + if [[ -z $_aws_zsh_completer_path ]]; then + # Homebrew + if _awscli-homebrew-installed; then + _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh + # Ubuntu + elif [[ -e /usr/share/zsh/vendor-completions/_awscli ]]; then + _aws_zsh_completer_path=/usr/share/zsh/vendor-completions/_awscli + # NixOS + elif [[ -e "${commands[aws]:P:h:h}/share/zsh/site-functions/aws_zsh_completer.sh" ]]; then + _aws_zsh_completer_path="${commands[aws]:P:h:h}/share/zsh/site-functions/aws_zsh_completer.sh" + # RPM + else + _aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh + fi fi -} -# get aws_zsh_completer.sh location from $PATH -_aws_zsh_completer_path="$commands[aws_zsh_completer.sh]" - -# otherwise check common locations -if [[ -z $_aws_zsh_completer_path ]]; then - # Homebrew - if _awscli-homebrew-installed; then - _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh - # Ubuntu - elif [[ -e /usr/share/zsh/vendor-completions/_awscli ]]; then - _aws_zsh_completer_path=/usr/share/zsh/vendor-completions/_awscli - # RPM - else - _aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh - fi + [[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path + unset _aws_zsh_completer_path _brew_prefix fi - -[[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path -unset _aws_zsh_completer_path _brew_prefix diff --git a/zsh/plugins/battery/README.md b/zsh/plugins/battery/README.md index b7a13a7..c2554a3 100644 --- a/zsh/plugins/battery/README.md +++ b/zsh/plugins/battery/README.md @@ -9,5 +9,14 @@ To use, add `battery` to the list of plugins in your `.zshrc` file: Then, add the `battery_pct_prompt` function to your custom theme. For example: ``` -RPROMPT='$(battery_pct_prompt)' +RPROMPT='$(battery_pct_prompt) ...' +``` + +## Requirements + +On Linux, you must have the `acpi` tool installed on your operating system. + +Here's an example of how to install with apt: +``` +sudo apt-get install acpi ``` diff --git a/zsh/plugins/battery/battery.plugin.zsh b/zsh/plugins/battery/battery.plugin.zsh index 8f398cf..a525fd7 100644 --- a/zsh/plugins/battery/battery.plugin.zsh +++ b/zsh/plugins/battery/battery.plugin.zsh @@ -7,23 +7,22 @@ # Email: neuralsandwich@gmail.com # # Modified to add support for Apple Mac # ########################################### +# Author: J (927589452) # +# Modified to add support for FreeBSD # +########################################### -if [[ "$OSTYPE" = darwin* ]] ; then +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 battery_is_charging() { + ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ Yes' } - function plugged_in() { - [ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ Yes') -eq 1 ] + function battery_pct() { + pmset -g batt | grep -Eo "\d+%" | cut -d% -f1 } function battery_pct_remaining() { - if plugged_in ; then + if battery_is_charging; then echo "External Power" else battery_pct @@ -32,9 +31,9 @@ if [[ "$OSTYPE" = darwin* ]] ; then 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 + if [[ $(echo $smart_battery_status | command grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]]; then + timeremaining=$(echo $smart_battery_status | command grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //') + if [ $timeremaining -gt 720 ]; then echo "::" else echo "~$((timeremaining / 60)):$((timeremaining % 60))" @@ -45,39 +44,36 @@ if [[ "$OSTYPE" = darwin* ]] ; then } function battery_pct_prompt () { - if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then - b=$(battery_pct_remaining) - if [ $b -gt 50 ] ; then + local battery_pct color + if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ No'; then + battery_pct=$(battery_pct_remaining) + if [[ $battery_pct -gt 50 ]]; then color='green' - elif [ $b -gt 20 ] ; then + elif [[ $battery_pct -gt 20 ]]; then color='yellow' else color='red' fi - echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}" + echo "%{$fg[$color]%}[${battery_pct}%%]%{$reset_color%}" else echo "∞" fi } - function battery_is_charging() { - [[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]] - } - -elif [[ "$OSTYPE" = linux* ]] ; then +elif [[ "$OSTYPE" = freebsd* ]]; then function battery_is_charging() { - ! [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] + [[ $(sysctl -n hw.acpi.battery.state) -eq 2 ]] } function battery_pct() { - if (( $+commands[acpi] )) ; then - echo "$(acpi 2>/dev/null | cut -f2 -d ',' | tr -cd '[:digit:]')" + if (( $+commands[sysctl] )); then + sysctl -n hw.acpi.battery.life fi } function battery_pct_remaining() { - if [ ! $(battery_is_charging) ] ; then + if ! battery_is_charging; then battery_pct else echo "External Power" @@ -85,76 +81,128 @@ elif [[ "$OSTYPE" = linux* ]] ; then } function battery_time_remaining() { - if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then - echo $(acpi 2>/dev/null | cut -f3 -d ',') + local remaining_time + remaining_time=$(sysctl -n hw.acpi.battery.time) + if [[ $remaining_time -ge 0 ]]; then + ((hour = $remaining_time / 60 )) + ((minute = $remaining_time % 60 )) + printf %02d:%02d $hour $minute 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 + local battery_pct color + battery_pct=$(battery_pct_remaining) + if battery_is_charging; then + echo "∞" + else + if [[ $battery_pct -gt 50 ]]; then color='green' - elif [ $b -gt 20 ] ; then + elif [[ $battery_pct -gt 20 ]]; then color='yellow' else color='red' fi - echo "%{$fg[$color]%}$(battery_pct_remaining)%%%{$reset_color%}" + echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}" + fi + } + +elif [[ "$OSTYPE" = linux* ]]; then + + function battery_is_charging() { + ! acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -q '^Battery.*Discharging' + } + + function battery_pct() { + if (( $+commands[acpi] )); then + acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -E '^Battery.*(Full|(Disc|C)harging)' | 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 ! battery_is_charging; then + acpi 2>/dev/null | command grep -v "rate information unavailable" | cut -f3 -d ',' + fi + } + + function battery_pct_prompt() { + local battery_pct color + battery_pct=$(battery_pct_remaining) + if battery_is_charging; then echo "∞" + else + if [[ $battery_pct -gt 50 ]]; then + color='green' + elif [[ $battery_pct -gt 20 ]]; then + color='yellow' + else + color='red' + fi + echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}" fi } else # Empty functions so we don't cause errors in prompts - function battery_pct_remaining() { - } - - function battery_time_remaining() { - } - - function battery_pct_prompt() { - } + function battery_is_charging { false } + function battery_pct \ + battery_pct_remaining \ + battery_time_remaining \ + 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 gauge_slots=${BATTERY_GAUGE_SLOTS:-10} + local green_threshold=${BATTERY_GREEN_THRESHOLD:-$(( gauge_slots * 0.6 ))} + local yellow_threshold=${BATTERY_YELLOW_THRESHOLD:-$(( gauge_slots * 0.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); + local battery_remaining_percentage=$(battery_pct) + local filled empty gauge_color if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then - local filled=$(((( $battery_remaining_percentage + $gauge_slots - 1) / $gauge_slots))); - local empty=$(($gauge_slots - $filled)); + filled=$(( ($battery_remaining_percentage * $gauge_slots) / 100 )) + 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; + if [[ $filled -gt $green_threshold ]]; then + gauge_color=$color_green + elif [[ $filled -gt $yellow_threshold ]]; then + gauge_color=$color_yellow + else + gauge_color=$color_red fi else - local filled=$gauge_slots; - local empty=0; - filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'}; + filled=$gauge_slots + empty=0 + filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'} fi - local charging=' ' && battery_is_charging && charging=$charging_symbol; + local charging=' ' + battery_is_charging && charging=$charging_symbol - printf ${charging_color//\%/\%\%}$charging${color_reset//\%/\%\%}${battery_prefix//\%/\%\%}${gauge_color//\%/\%\%} - printf ${filled_symbol//\%/\%\%}'%.0s' {1..$filled} + # Charging status and prefix + print -n ${charging_color}${charging}${color_reset}${battery_prefix}${gauge_color} + # Filled slots + [[ $filled -gt 0 ]] && printf ${filled_symbol//\%/\%\%}'%.0s' {1..$filled} + # Empty slots [[ $filled -lt $gauge_slots ]] && printf ${empty_symbol//\%/\%\%}'%.0s' {1..$empty} - printf ${color_reset//\%/\%\%}${battery_suffix//\%/\%\%}${color_reset//\%/\%\%} + # Suffix + print -n ${color_reset}${battery_suffix}${color_reset} } - - diff --git a/zsh/plugins/bazel/README.md b/zsh/plugins/bazel/README.md new file mode 100644 index 0000000..e5ffe6e --- /dev/null +++ b/zsh/plugins/bazel/README.md @@ -0,0 +1,5 @@ +## Bazel autocomplete plugin + +A copy of the completion script from the +[bazelbuild/bazel](https://github.com/bazelbuild/bazel/master/scripts/zsh_completion/_bazel) +git repo. diff --git a/zsh/plugins/bazel/_bazel b/zsh/plugins/bazel/_bazel new file mode 100644 index 0000000..827ce54 --- /dev/null +++ b/zsh/plugins/bazel/_bazel @@ -0,0 +1,341 @@ +#compdef bazel + +# Copyright 2015 The Bazel Authors. All rights reserved. +# +# 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. + +# Installation +# ------------ +# +# 1. Add this script to a directory on your $fpath: +# fpath[1,0]=~/.zsh/completion/ +# mkdir -p ~/.zsh/completion/ +# cp scripts/zsh_completion/_bazel ~/.zsh/completion +# +# 2. Optionally, add the following to your .zshrc. +# zstyle ':completion:*' use-cache on +# zstyle ':completion:*' cache-path ~/.zsh/cache +# +# This way, the completion script does not have to parse Bazel's options +# repeatedly. The directory in cache-path must be created manually. +# +# 3. Restart the shell +# +# Options +# ------- +# completion:init:bazel:* cache-lifetime +# Lifetime for the completion cache (if turned on, default: 1 week) + +local curcontext="$curcontext" state line + +: ${BAZEL_COMPLETION_PACKAGE_PATH:=%workspace%} +: ${BAZEL:=bazel} +_bazel_b() { ${BAZEL} --noblock_for_lock "$@" 2>/dev/null; } + +# Default cache lifetime is 1 week +zstyle -s ":completion:${curcontext}:" cache-lifetime lifetime +if [[ -z "${lifetime}" ]]; then + lifetime=$((60*60*24*7)) +fi + +_bazel_cache_policy() { + local -a oldp + oldp=( "$1"(Nms+${lifetime}) ) + (( $#oldp )) +} + +_set_cache_policy() { + zstyle -s ":completion:*:$curcontext*" cache-policy update_policy + + if [[ -z "$update_policy" ]]; then + zstyle ":completion:$curcontext*" cache-policy _bazel_cache_policy + fi +} + +# Skips over all global arguments. After invocation, OFFSET contains the +# position of the bazel command in $words. +_adapt_subcommand_offset() { + OFFSET=2 + for w in ${words[2,-1]}; do + if [[ $w == (#b)-* ]]; then + (( OFFSET++ )) + else + return + fi + done +} + +# Retrieve the cache but also check that the value is not empty. +_bazel_safe_retrieve_cache() { + _retrieve_cache $1 && [[ ${(P)#2} -gt 0 ]] +} + +# Puts the name of the variable that contains the options for the bazel +# subcommand handed in as the first argument into the global variable +# _bazel_cmd_options. +_bazel_get_options() { + local lcmd=$1 + _bazel_cmd_options=_bazel_${lcmd}_options + _bazel_cmd_args=_bazel_${lcmd}_args + if [[ ${(P)#_bazel_cmd_options} != 0 ]]; then + return + fi + if _cache_invalid BAZEL_${lcmd}_options || _cache_invalid BAZEL_${lcmd}_args \ + || ! _bazel_safe_retrieve_cache BAZEL_${lcmd}_options ${_bazel_cmd_options} \ + || ! _retrieve_cache BAZEL_${lcmd}_args ${_bazel_cmd_args}; then + if ! eval "$(_bazel_b help completion)"; then + return + fi + local opts_var + if [[ $lcmd == "startup_options" ]]; then + opts_var="BAZEL_STARTUP_OPTIONS" + else + opts_var="BAZEL_COMMAND_${lcmd:u}_FLAGS" + fi + local -a raw_options + if ! eval "raw_options=(\${(@f)$opts_var})"; then + return + fi + + local -a option_list + for opt in $raw_options; do + case $opt in + --*"={"*) + local lst="${${opt##*"={"}%"}"}" + local opt="${opt%%=*}=" + option_list+=("${opt}:string:_values '' ${lst//,/ }") ;; + --*=path) + option_list+=("${opt%path}:path:_files") ;; + --*=label) + option_list+=("${opt%label}:target:_bazel_complete_target") ;; + --*=*) + option_list+=("${opt}:string:") ;; + *) + option_list+=("$opt") ;; + esac + done + + local -a cmd_args + local cmd_type + if eval "cmd_type=\${BAZEL_COMMAND_${lcmd:u}_ARGUMENT}" && [[ -n $cmd_type ]]; then + case $cmd_type in + label|label-*) + cmd_args+=("*::${cmd_type}:_bazel_complete_target_${cmd_type//-/_}") ;; + info-key) + cmd_args+=('1::key:_bazel_info_key') ;; + path) + cmd_args+=('1::profile:_path_files') ;; + "command|{"*"}") + local lst=${${cmd_type#"command|{"}%"}"} + cmd_args+=("1::topic:_bazel_help_topic -- ${lst//,/ }") ;; + esac + fi + + typeset -g "${_bazel_cmd_options}"="${(pj:|:)option_list[*]}" + _store_cache BAZEL_${lcmd}_options ${_bazel_cmd_options} + typeset -g "${_bazel_cmd_args}"="${(pj:|:)cmd_args[*]}" + _store_cache BAZEL_${lcmd}_args ${_bazel_cmd_args} + fi +} + +_get_build_targets() { + local pkg=$1 + local rule_re + typeset -a completions + case $target_type in + test) + rule_re=".*_test" + ;; + build) + rule_re=".*" + ;; + bin) + rule_re=".*_test|.*_binary" + ;; + esac + completions=(${$(_bazel_b query "kind(\"${rule_re}\", ${pkg}:all)" 2>/dev/null)##*:}) + if ( (( ${#completions} > 0 )) && [[ $target_type != run ]] ); then + completions+=(all) + fi + echo ${completions[*]} +} + +# Returns all packages that match $PREFIX. PREFIX may start with //, in which +# case the workspace roots are searched. Otherwise, they are completed based on +# PWD. +_get_build_packages() { + local workspace pfx + typeset -a package_roots paths final_paths + workspace=$PWD + package_roots=(${(ps.:.)BAZEL_COMPLETION_PACKAGE_PATH}) + package_roots=(${^package_roots//\%workspace\%/$workspace}) + if [[ "${(e)PREFIX}" == //* ]]; then + pfx=${(e)PREFIX[2,-1]} + else + pfx=${(e)PREFIX} + fi + paths=(${^package_roots}/${pfx}*(/)) + for p in ${paths[*]}; do + if [[ -f ${p}/BUILD || -f ${p}/BUILD.bazel ]]; then + final_paths+=(${p##*/}:) + fi + final_paths+=(${p##*/}/) + done + echo ${final_paths[*]} +} + +_package_remove_slash() { + if [[ $KEYS == ':' && $LBUFFER == */ ]]; then + LBUFFER=${LBUFFER[1,-2]} + fi +} + +# Completion function for BUILD targets, called by the completion system. +_bazel_complete_target() { + local expl + typeset -a packages targets + if [[ "${(e)PREFIX}" != *:* ]]; then + # There is no : in the prefix, completion can be either + # a package or a target, if the cwd is a package itself. + if [[ -f $PWD/BUILD || -f $PWD/BUILD.bazel ]]; then + targets=($(_get_build_targets "")) + _description build_target expl "BUILD target" + compadd "${expl[@]}" -a targets + fi + packages=($(_get_build_packages)) + _description build_package expl "BUILD package" + # Chop of the leading path segments from the prefix for display. + compset -P '*/' + compadd -R _package_remove_slash -S '' "${expl[@]}" -a packages + else + targets=($(_get_build_targets "${${(e)PREFIX}%:*}")) + _description build_target expl "BUILD target" + # Ignore the current prefix for the upcoming completion, since we only list + # the names of the targets, not the full path. + compset -P '*:' + compadd "${expl[@]}" -a targets + fi +} + +_bazel_complete_target_label() { + typeset -g target_type=build + _bazel_complete_target +} + +_bazel_complete_target_label_test() { + typeset -g target_type=test + _bazel_complete_target +} + +_bazel_complete_target_label_bin() { + typeset -g target_type=bin + _bazel_complete_target +} + +### Actual completion commands + +_bazel() { + _adapt_subcommand_offset + if (( CURRENT - OFFSET > 0 )); then + # Remember the subcommand name, stored globally so we can access it + # from any subsequent function + cmd=${words[OFFSET]//-/_} + + # Set the context for the subcommand. + curcontext="${curcontext%:*:*}:bazel-$cmd:" + _set_cache_policy + + # Narrow the range of words we are looking at to exclude cmd + # name and any leading options + (( CURRENT = CURRENT - OFFSET + 1 )) + shift $((OFFSET - 1)) words + # Run the completion for the subcommand + _bazel_get_options $cmd + _arguments : \ + ${(Pps:|:)_bazel_cmd_options} \ + ${(Pps:|:)_bazel_cmd_args} + else + _set_cache_policy + # Start special handling for global options, + # which can be retrieved by calling + # $ bazel help startup_options + _bazel_get_options startup_options + _arguments : \ + ${(Pps:|:)_bazel_cmd_options} \ + "*:commands:_bazel_commands" + fi + return +} + +_get_commands() { + # bazel_cmd_list is a global (g) array (a) + typeset -ga _bazel_cmd_list + # Use `bazel help` instead of `bazel help completion` to get command + # descriptions. + if _bazel_cmd_list=("${(@f)$(_bazel_b help | awk ' +/Available commands/ { command=1; } +/ [-a-z]+[ \t]+.+/ { if (command) { printf "%s:", $1; for (i=2; i<=NF; i++) printf "%s ", $i; print "" } } +/^$/ { command=0; }')}"); then + _store_cache BAZEL_commands _bazel_cmd_list + fi +} + +# Completion function for bazel subcommands, called by the completion system. +_bazel_commands() { + if [[ ${#_bazel_cmd_list} == 0 ]]; then + if _cache_invalid BAZEL_commands \ + || ! _bazel_safe_retrieve_cache BAZEL_commands _bazel_cmd_list; then + _get_commands + fi + fi + + _describe -t bazel-commands 'Bazel command' _bazel_cmd_list +} + +# Completion function for bazel help options, called by the completion system. +_bazel_help_topic() { + if [[ ${#_bazel_cmd_list} == 0 ]]; then + if _cache_invalid BAZEL_commands \ + || ! _bazel_safe_retrieve_cache BAZEL_commands _bazel_cmd_list; then + _get_commands + fi + fi + + while [[ $# -gt 0 ]]; do + if [[ $1 == -- ]]; then + shift + break + fi + shift + done + _bazel_help_list=($@) + _bazel_help_list+=($_bazel_cmd_list) + _describe -t bazel-help 'Help topic' _bazel_help_list +} + +# Completion function for bazel info keys, called by the completion system. +_bazel_info_key() { + if [[ ${#_bazel_info_keys_list} == 0 ]]; then + if _cache_invalid BAZEL_info_keys \ + || ! _bazel_safe_retrieve_cache BAZEL_info_keys _bazel_info_keys_list; then + typeset -ga _bazel_info_keys_list + # Use `bazel help` instead of `bazel help completion` to get info-key + # descriptions. + if _bazel_info_keys_list=("${(@f)$(_bazel_b help info-keys | awk ' + { printf "%s:", $1; for (i=2; i<=NF; i++) printf "%s ", $i; print "" }')}"); then + _store_cache BAZEL_info_keys _bazel_info_keys_list + fi + fi + fi + _describe -t bazel-info 'Key' _bazel_info_keys_list +} diff --git a/zsh/plugins/bgnotify/bgnotify.plugin.zsh b/zsh/plugins/bgnotify/bgnotify.plugin.zsh index b3a6890..aecde20 100644 --- a/zsh/plugins/bgnotify/bgnotify.plugin.zsh +++ b/zsh/plugins/bgnotify/bgnotify.plugin.zsh @@ -53,7 +53,7 @@ bgnotify () { ## args: (title, subtitle) bgnotify_begin() { bgnotify_timestamp=$EPOCHSECONDS - bgnotify_lastcmd="$1" + bgnotify_lastcmd="${1:-$2}" bgnotify_windowid=$(currentWindowId) } diff --git a/zsh/plugins/bower/README.md b/zsh/plugins/bower/README.md index 743b6a0..8877fbd 100644 --- a/zsh/plugins/bower/README.md +++ b/zsh/plugins/bower/README.md @@ -4,7 +4,7 @@ This plugin adds completion for [Bower](https://bower.io/) and a few useful alia To use it, add `bower` to the plugins array in your zshrc file: -``` +```zsh plugins=(... bower) ``` @@ -15,4 +15,3 @@ plugins=(... bower) | bi | `bower install` | Installs the project dependencies listed in bower.json | | bl | `bower list` | List local packages and possible updates | | bs | `bower search` | Finds all packages or a specific package. | - diff --git a/zsh/plugins/brew/README.md b/zsh/plugins/brew/README.md index c129a76..bf952bf 100644 --- a/zsh/plugins/brew/README.md +++ b/zsh/plugins/brew/README.md @@ -3,19 +3,28 @@ The plugin adds several aliases for common [brew](https://brew.sh) commands. To use it, add `brew` to the plugins array of your zshrc file: -``` + +```zsh plugins=(... brew) ``` ## Aliases -| Alias | Command | Description | -|--------|----------------------|---------------| -| brewp | `brew pin` | Pin a specified formulae, preventing them from being upgraded when issuing the brew upgrade command. | -| brews | `brew list -1` | List installed formulae, one entry per line, or the installed files for a given formulae. | -| brewsp | `brew list --pinned` | Show the versions of pinned formulae, or only the specified (pinned) formulae if formulae are given. | -| bubo | `brew update && brew outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated formulae. | -| bubc | `brew upgrade && brew cleanup` | Upgrade outdated, unpinned brews (with existing install options), then removes stale lock files and outdated downloads for formulae and casks, and removes old versions of installed formulae. | -| bubu | `bubo && bubc` | Updates Homebrew, lists outdated formulae, upgrades oudated and unpinned formulae, and removes stale and outdated downloads and versions. | -| bcubo | `brew update && brew cask outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated casks. | -| bcubc | `brew cask reinstall $(brew cask outdated) && brew cleanup` | Updates outdated casks, then runs cleanup. | \ No newline at end of file +| Alias | Command | Description | +|----------|---------------------------------------|---------------------------------------------------------------------| +| `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. | +| `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. | +| `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. | +| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. | +| `bubc` | `brew upgrade && brew cleanup` | Upgrade outdated formulae and casks, then run cleanup. | +| `bubu` | `bubo && bubc` | Do the last two operations above. | +| `buf` | `brew upgrade --formula` | Upgrade only formulas (not casks). | +| `bcubo` | `brew update && brew outdated --cask` | Update Homebrew data, then list outdated casks. | +| `bcubc` | `brew upgrade --cask && brew cleanup` | Update outdated casks, then run cleanup. | + +## Completion + +With the release of Homebrew 1.0, they 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. diff --git a/zsh/plugins/brew/brew.plugin.zsh b/zsh/plugins/brew/brew.plugin.zsh index cfbaa34..532dd9b 100644 --- a/zsh/plugins/brew/brew.plugin.zsh +++ b/zsh/plugins/brew/brew.plugin.zsh @@ -4,21 +4,6 @@ alias brewsp='brew list --pinned' alias bubo='brew update && brew outdated' alias bubc='brew upgrade && brew cleanup' alias bubu='bubo && bubc' -alias bcubo='brew update && brew cask outdated' -alias bcubc='brew cask reinstall $(brew cask outdated) && brew cleanup' - -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 +alias buf='brew upgrade --formula' +alias bcubo='brew update && brew outdated --cask' +alias bcubc='brew upgrade --cask && brew cleanup' diff --git a/zsh/plugins/bundler/README.md b/zsh/plugins/bundler/README.md index dc2f170..7b79cbc 100644 --- a/zsh/plugins/bundler/README.md +++ b/zsh/plugins/bundler/README.md @@ -1,52 +1,74 @@ # Bundler -- adds completion for basic bundler commands -- adds short aliases for common bundler commands - - `be` aliased to `bundle exec`. - It also supports aliases (if `rs` is `rails server`, `be rs` will bundle-exec `rails server`). - - `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=` (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 ` otherwise +This plugin adds completion for basic bundler commands, as well as aliases and helper functions for +an easier experience with bundler. + +To use it, add `bundler` to the plugins array in your zshrc file: + +```zsh +plugins=(... bundler) +``` + +## Aliases + +| Alias | Command | Description | +|--------|--------------------------------------|------------------------------------------------------------------------------------------| +| `ba` | `bundle add` | Add gem to the Gemfile and run bundle install | +| `bck` | `bundle check` | Verifies if dependencies are satisfied by installed gems | +| `bcn` | `bundle clean` | Cleans up unused gems in your bundler directory | +| `be` | `bundle exec` | Execute a command in the context of the bundle | +| `bi` | `bundle install --jobs=` | Install the dependencies specified in your Gemfile (using all cores in bundler >= 1.4.0) | +| `bl` | `bundle list` | List all the gems in the bundle | +| `bo` | `bundle open` | Opens the source directory for a gem in your bundle | +| `bout` | `bundle outdated` | List installed gems with newer versions available | +| `bp` | `bundle package` | Package your needed .gem files into your application | +| `bu` | `bundle update` | Update your gems to the latest available versions | + +## Gem wrapper + +The plugin adds a wrapper for common gems, which: + +- Looks for a binstub under `./bin/` and executes it if present. +- Calls `bundle exec ` otherwise. Common gems wrapped by default (by name of the executable): -`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` and `unicorn_rails`. -## Configuration +`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `rubocop`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`. -Please use the exact name of the executable and not the gem name. +### Settings -### Add additional gems to be wrapped +You can add or remove gems from the list of wrapped commands. +Please **use the exact name of the executable** and not the gem name. + +#### Include gems to be wrapped (`BUNDLED_COMMANDS`) + +Add this before the plugin list in your `.zshrc`: -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 (`UNBUNDLED_COMMANDS`) -### Exclude gems from being wrapped +Add this before the plugin list in your `.zshrc`: -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 +### 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. +These gems should not be called with `bundle exec`. Please see [issue #2923](https://github.com/ohmyzsh/ohmyzsh/pull/2923) on GitHub for clarification: -`berks` -`foreman` -`mailcatcher` -`rails` -`ruby` -`spin` +- `berks` +- `foreman` +- `mailcatcher` +- `rails` +- `ruby` +- `spin` diff --git a/zsh/plugins/bundler/bundler.plugin.zsh b/zsh/plugins/bundler/bundler.plugin.zsh index 668e15d..6293dc2 100644 --- a/zsh/plugins/bundler/bundler.plugin.zsh +++ b/zsh/plugins/bundler/bundler.plugin.zsh @@ -1,11 +1,49 @@ +## Aliases + +alias ba="bundle add" +alias bck="bundle check" +alias bcn="bundle clean" alias be="bundle exec" +alias bi="bundle_install" alias bl="bundle list" -alias bp="bundle package" alias bo="bundle open" alias bout="bundle outdated" +alias bp="bundle package" alias bu="bundle update" -alias bi="bundle_install" -alias bcn="bundle clean" + +## Functions + +bundle_install() { + # Bail out if bundler is not installed + if (( ! $+commands[bundle] )); then + echo "Bundler is not installed" + return 1 + fi + + # Bail out if not in a bundled project + if ! _within-bundled-project; then + echo "Can't 'bundle install' outside a bundled project" + return 1 + fi + + # Check the bundler version is at least 1.4.0 + autoload -Uz is-at-least + local bundler_version=$(bundle version | cut -d' ' -f3) + if ! is-at-least 1.4.0 "$bundler_version"; then + bundle install "$@" + return $? + fi + + # If bundler is at least 1.4.0, use all the CPU cores to bundle install + if [[ "$OSTYPE" = (darwin|freebsd)* ]]; then + local cores_num="$(sysctl -n hw.ncpu)" + else + local cores_num="$(nproc)" + fi + bundle install --jobs="$cores_num" "$@" +} + +## Gem wrapper bundled_commands=( annotate @@ -27,6 +65,7 @@ bundled_commands=( rainbows rake rspec + rubocop shotgun sidekiq spec @@ -51,65 +90,41 @@ for cmd in $BUNDLED_COMMANDS; do bundled_commands+=($cmd); done -## Functions - -bundle_install() { - if ! _bundler-installed; then - echo "Bundler is not installed" - elif ! _within-bundled-project; then - echo "Can't 'bundle install' outside a bundled project" - else - local bundler_version=`bundle version | cut -d' ' -f3` - if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then - if [[ "$OSTYPE" = (darwin|freebsd)* ]] - then - local cores_num="$(sysctl -n hw.ncpu)" - else - local cores_num="$(nproc)" - fi - bundle install --jobs=$cores_num $@ - else - bundle install $@ - fi - fi -} - -_bundler-installed() { - which bundle > /dev/null 2>&1 -} - +# Check if in the root or a subdirectory of a bundled project _within-bundled-project() { local check_dir="$PWD" - while [ "$check_dir" != "/" ]; do - [ -f "$check_dir/Gemfile" ] && return - check_dir="$(dirname $check_dir)" + while [[ "$check_dir" != "/" ]]; do + if [[ -f "$check_dir/Gemfile" || -f "$check_dir/gems.rb" ]]; then + return 0 + fi + check_dir="${check_dir:h}" done - false -} - -_binstubbed() { - [ -f "./bin/${1}" ] + return 1 } _run-with-bundler() { - if _bundler-installed && _within-bundled-project; then - if _binstubbed $1; then - ./bin/$@ - else - bundle exec $@ - fi + if (( ! $+commands[bundle] )) || ! _within-bundled-project; then + "$@" + return $? + fi + + if [[ -f "./bin/${1}" ]]; then + ./bin/${^^@} else - $@ + bundle exec "$@" 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 + # Create wrappers for bundled and unbundled execution + 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 + # Bind completion function to wrapped gem if available + if (( $+functions[_$cmd] )); then + compdef "_$cmd" "bundled_$cmd"="$cmd" fi done + +unset cmd bundled_commands diff --git a/zsh/plugins/cake/README.md b/zsh/plugins/cake/README.md index aad92a3..2c2a280 100644 --- a/zsh/plugins/cake/README.md +++ b/zsh/plugins/cake/README.md @@ -10,6 +10,6 @@ plugins=(... cake) ## Note -This plugin generates a cache file of the cake tasks found, named `.cake_task_cache`, in the current working directory. +This plugin generates a cache file of the cake tasks found, named `.cake_task_cache`, in the current working directory. It is regenerated when the Cakefile is newer than the cache file. It is advised that you add the cake file to your `.gitignore` files. diff --git a/zsh/plugins/cakephp3/README.md b/zsh/plugins/cakephp3/README.md new file mode 100644 index 0000000..7e8f664 --- /dev/null +++ b/zsh/plugins/cakephp3/README.md @@ -0,0 +1,16 @@ +# cakephp3 plugin + +The plugin adds aliases and autocompletion for [cakephp3](https://book.cakephp.org/3.0/en/index.html). + +To use it, add `cakephp3` to the plugins array of your zshrc file: +``` +plugins=(... cakephp3) +``` + +## Aliases + +| Alias | Command | +|-----------|-------------------------------| +| c3 | `bin/cake` | +| c3cache | `bin/cake orm_cache clear` | +| c3migrate | `bin/cake migrations migrate` | diff --git a/zsh/plugins/cargo/_cargo b/zsh/plugins/cargo/_cargo index 395c517..ebff993 100644 --- a/zsh/plugins/cargo/_cargo +++ b/zsh/plugins/cargo/_cargo @@ -2,489 +2,367 @@ autoload -U regexp-replace -zstyle -T ':completion:*:*:cargo:*' tag-order && \ - zstyle ':completion:*:*:cargo:*' tag-order 'common-commands' - _cargo() { -local context state state_descr line -typeset -A opt_args + local curcontext="$curcontext" ret=1 + local -a command_scope_spec common parallel features msgfmt triple target registry + local -a state line state_descr # These are set by _arguments + typeset -A opt_args -# leading items in parentheses are an exclusion list for the arguments following that arg -# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions -# - => exclude all other options -# 1 => exclude positional arg 1 -# * => exclude all other args -# +blah => exclude +blah -_arguments \ - '(- 1 *)'{-h,--help}'[show help message]' \ - '(- 1 *)--list[list installed commands]' \ - '(- 1 *)'{-V,--version}'[show version information]' \ - {-v,--verbose}'[use verbose output]' \ - --color'[colorization option]' \ - '(+beta +nightly)+stable[use the stable toolchain]' \ - '(+stable +nightly)+beta[use the beta toolchain]' \ - '(+stable +beta)+nightly[use the nightly toolchain]' \ - '1: :->command' \ - '*:: :->args' + common=( + '(-q --quiet)*'{-v,--verbose}'[use verbose output]' + '(-q --quiet -v --verbose)'{-q,--quiet}'[no output printed to stdout]' + '-Z+[pass unstable (nightly-only) flags to cargo]: :_cargo_unstable_flags' + '--frozen[require that Cargo.lock and cache are up to date]' + '--locked[require that Cargo.lock is up to date]' + '--color=[specify colorization option]:coloring:(auto always never)' + '(- 1 *)'{-h,--help}'[show help message]' + ) -case $state in - command) - _alternative 'common-commands:common:_cargo_cmds' 'all-commands:all:_cargo_all_cmds' - ;; + # leading items in parentheses are an exclusion list for the arguments following that arg + # See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions + # - => exclude all other options + # 1 => exclude positional arg 1 + # * => exclude all other args + # +blah => exclude +blah + _arguments -s -S -C $common \ + '(- 1 *)--list[list installed commands]' \ + '(- 1 *)--explain=[provide a detailed explanation of an error message]:error code' \ + '(- 1 *)'{-V,--version}'[show version information]' \ + '(+beta +nightly)+stable[use the stable toolchain]' \ + '(+stable +nightly)+beta[use the beta toolchain]' \ + '(+stable +beta)+nightly[use the nightly toolchain]' \ + '1: :_cargo_cmds' \ + '*:: :->args' - 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)' \ - ;; + # These flags are mutually 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. + command_scope_spec=( + '(--bin --example --test --lib)--bench=[specify benchmark name]: :_cargo_benchmark_names' + '(--bench --bin --test --lib)--example=[specify example name]:example name' + '(--bench --example --test --lib)--bin=[specify binary name]:binary name' + '(--bench --bin --example --test)--lib=[specify library name]:library name' + '(--bench --bin --example --lib)--test=[specify test name]:test name' + ) - 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)' \ - ;; + parallel=( + '(-j --jobs)'{-j+,--jobs=}'[specify number of parallel jobs]:jobs [# of CPUs]' + ) - check) - _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 check the default features]' \ - '(-p,--package)'{-p=,--package=}'[package to check]:packages:_get_package_names' \ - '--release=[check 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)' \ - ;; + features=( + '(--all-features)--features=[specify features to activate]:feature' + '(--features)--all-features[activate all available features]' + "--no-default-features[don't build the default features]" + ) - 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)' \ - ;; + msgfmt='--message-format=[specify error format]:error format [human]:(human json short)' + triple='--target=[specify target triple]:target triple' + target='--target-dir=[specify directory for all generated artifacts]:directory:_directories' + manifest='--manifest-path=[specify path to manifest]:path:_directories' + registry='--registry=[specify registry to use]:registry' - 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)' \ - ;; + case $state in + args) + curcontext="${curcontext%:*}-${words[1]}:" + case ${words[1]} in + bench) + _arguments -s -A "^--" $common $parallel $features $msgfmt $triple $target $manifest \ + "${command_scope_spec[@]}" \ + '--all-targets[benchmark all targets]' \ + "--no-run[compile but don't run]" \ + '(-p --package)'{-p+,--package=}'[specify package to run benchmarks for]:package:_cargo_package_names' \ + '--exclude=[exclude packages from the benchmark]:spec' \ + '--no-fail-fast[run all benchmarks regardless of failure]' \ + '1: :_guard "^-*" "bench name"' \ + '*:args:_default' + ;; - 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)' \ - ;; + build|b) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \ + "${command_scope_spec[@]}" \ + '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \ + '--release[build in release mode]' \ + '--build-plan[output the build plan in JSON]' \ + ;; - 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)' \ - ;; + check|c) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \ + "${command_scope_spec[@]}" \ + '(-p --package)'{-p+,--package=}'[specify package to check]:package:_cargo_package_names' \ + '--release[check in release mode]' \ + ;; - git-checkout) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '(-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)' \ - ;; + clean) + _arguments -s -S $common $triple $target $manifest \ + '(-p --package)'{-p+,--package=}'[specify package to clean]:package:_cargo_package_names' \ + '--release[clean release artifacts]' \ + '--doc[clean just the documentation directory]' + ;; - help) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '*: :_cargo_cmds' \ - ;; + doc) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--no-deps[do not build docs for dependencies]' \ + '--document-private-items[include non-public items in the documentation]' \ + '--open[open docs in browser after the build]' \ + '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \ + '--release[build artifacts in release mode, with optimizations]' \ + ;; - 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)' \ - ;; + fetch) + _arguments -s -S $common $triple $manifest + ;; - 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]: :_files -/' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--rev=[specific commit to use when installing from git]' \ - '--root=[directory to install packages into]: :_files -/' \ - '--tag=[tag to use when installing from git]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--vers=[version to install from crates.io]' \ - ;; + fix) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + "${command_scope_spec[@]}" \ + '--broken-code[fix code even if it already has compiler errors]' \ + '--edition[fix in preparation for the next edition]' \ + '--edition-idioms[fix warnings to migrate to the idioms of an edition]' \ + '--allow-no-vcs[fix code even if a VCS was not detected]' \ + '--allow-dirty[fix code even if the working directory is dirty]' \ + '--allow-staged[fix code even if the working directory has staged changes]' + ;; - locate-project) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '--manifest-path=[path to manifest]: :_files -/' \ - ;; + generate-lockfile) + _arguments -s -S $common $manifest + ;; - 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)' \ - ;; + git-checkout) + _arguments -s -S $common \ + '--reference=:reference' \ + '--url=:url:_urls' + ;; - 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)' \ - ;; + help) + _cargo_cmds + ;; - 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)' \ - ;; + init) + _arguments -s -S $common $registry \ + '--lib[use library template]' \ + '--edition=[specify edition to set for the crate generated]:edition:(2015 2018)' \ + '--vcs=[initialize a new repo with a given VCS]:vcs:(git hg pijul fossil none)' \ + '--name=[set the resulting package name]:name' \ + '1:path:_directories' + ;; - 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)' \ - ;; + install) + _arguments -s -S $common $parallel $features $triple $registry \ + '(-f --force)'{-f,--force}'[force overwriting of existing crates or binaries]' \ + '--bin=[only install the specified binary]:binary' \ + '--branch=[branch to use when installing from git]:branch' \ + '--debug[build in debug mode instead of release mode]' \ + '--example=[install the specified example instead of binaries]:example' \ + '--git=[specify URL from which to install the crate]:url:_urls' \ + '--path=[local filesystem path to crate to install]: :_directories' \ + '--rev=[specific commit to use when installing from git]:commit' \ + '--root=[directory to install packages into]: :_directories' \ + '--tag=[tag to use when installing from git]:tag' \ + '--vers=[version to install from crates.io]:version' \ + '--list[list all installed packages and their versions]' \ + '*: :_guard "^-*" "crate"' + ;; - 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)' \ - ;; + locate-project) + _arguments -s -S $common $manifest + ;; - 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)' \ - ;; + login) + _arguments -s -S $common $registry \ + '*: :_guard "^-*" "token"' + ;; - 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)' \ - ;; + metadata) + _arguments -s -S $common $features $manifest \ + "--no-deps[output information only about the root package and don't fetch dependencies]" \ + '--format-version=[specify format version]:version [1]:(1)' + ;; - 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)' \ - ;; + new) + _arguments -s -S $common $registry \ + '--lib[use library template]' \ + '--vcs:initialize a new repo with a given VCS:(git hg none)' \ + '--name=[set the resulting package name]' + ;; - 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' \ - ;; + owner) + _arguments -s -S $common $registry \ + '(-a --add)'{-a,--add}'[specify name of a user or team to invite as an owner]:name' \ + '--index=[specify registry index]:index' \ + '(-l --list)'{-l,--list}'[list owners of a crate]' \ + '(-r --remove)'{-r,--remove}'[specify name of a user or team to remove as an owner]:name' \ + '--token=[specify API token to use when authenticating]:token' \ + '*: :_guard "^-*" "crate"' + ;; - 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]: :_files -/' \ - '--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[@]}" \ - ;; + package) + _arguments -s -S $common $parallel $features $triple $target $manifest \ + '(-l --list)'{-l,--list}'[print files included in a package without making one]' \ + '--no-metadata[ignore warnings about a lack of human-usable metadata]' \ + '--allow-dirty[allow dirty working directories to be packaged]' \ + "--no-verify[don't build to verify contents]" + ;; - 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]: :_files -/' \ - '--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[@]}" \ - ;; + pkgid) + _arguments -s -S $common $manifest \ + '(-p --package)'{-p+,--package=}'[specify package to get ID specifier for]:package:_cargo_package_names' \ + '*: :_guard "^-*" "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]' \ - ;; + publish) + _arguments -s -S $common $parallel $features $triple $target $manifest $registry \ + '--index=[specify registry index]:index' \ + '--allow-dirty[allow dirty working directories to be packaged]' \ + "--no-verify[don't verify the contents by building them]" \ + '--token=[specify token to use when uploading]:token' \ + '--dry-run[perform all checks without uploading]' + ;; - 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' \ - '(--doc --bin --example --test --bench)--lib[only test library]' \ - '(--lib --bin --example --test --bench)--doc[only test documentation]' \ - '(--lib --doc --example --test --bench)--bin=[binary name]' \ - '(--lib --doc --bin --test --bench)--example=[example name]' \ - '(--lib --doc --bin --example --bench)--test=[test name]' \ - '(--lib --doc --bin --example --test)--bench=[benchmark name]' \ - '--message-format:error format:(human json short)' \ - '--frozen[require lock and cache up to date]' \ - '--locked[require lock up to date]' - ;; + read-manifest) + _arguments -s -S $common $manifest + ;; - 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]: :_files -/' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - ;; + run|r) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--example=[name of the bin target]:name' \ + '--bin=[name of the bin target]:name' \ + '(-p --package)'{-p+,--package=}'[specify package with the target to run]:package:_cargo_package_names' \ + '--release[build in release mode]' \ + '*: :_default' + ;; - 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)' \ - ;; + rustc) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \ + '--profile=[specify profile to build the selected target for]:profile' \ + '--release[build artifacts in release mode, with optimizations]' \ + "${command_scope_spec[@]}" \ + '*: : _dispatch rustc rustc -default-' + ;; - 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)' \ - ;; + rustdoc) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--document-private-items[include non-public items in the documentation]' \ + '--open[open the docs in a browser after the operation]' \ + '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \ + '--release[build artifacts in release mode, with optimizations]' \ + "${command_scope_spec[@]}" \ + '*: : _dispatch rustdoc rustdoc -default-' + ;; - version) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + search) + _arguments -s -S $common $registry \ + '--index=[specify registry index]:index' \ + '--limit=[limit the number of results]:results [10]' \ + '*: :_guard "^-*" "query"' + ;; - 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 + test|t) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--test=[test name]: :_cargo_test_names' \ + '--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]:package:_cargo_package_names' \ + '--all[test all packages in the workspace]' \ + '--release[build artifacts in release mode, with optimizations]' \ + '1: :_cargo_test_names' \ + '(--doc --bin --example --test --bench)--lib[only test library]' \ + '(--lib --bin --example --test --bench)--doc[only test documentation]' \ + '(--lib --doc --example --test --bench)--bin=[binary name]' \ + '(--lib --doc --bin --test --bench)--example=[example name]' \ + '(--lib --doc --bin --example --bench)--test=[test name]' \ + '(--lib --doc --bin --example --test)--bench=[benchmark name]' \ + '*: :_default' + ;; + + uninstall) + _arguments -s -S $common \ + '(-p --package)'{-p+,--package=}'[specify package to uninstall]:package:_cargo_package_names' \ + '--bin=[only uninstall the specified binary]:name' \ + '--root=[directory to uninstall packages from]: :_files -/' \ + '*:crate:_cargo_installed_crates -F line' + ;; + + update) + _arguments -s -S $common $manifest \ + '--aggressive=[force dependency update]' \ + "--dry-run[don't actually write the lockfile]" \ + '(-p --package)'{-p+,--package=}'[specify package to update]:package:_cargo_package_names' \ + '--precise=[update single dependency to precise release]:release' + ;; + + verify-project) + _arguments -s -S $common $manifest + ;; + + version) + _arguments -s -S $common + ;; + + yank) + _arguments -s -S $common $registry \ + '--vers=[specify yank version]:version' \ + '--undo[undo a yank, putting a version back into the index]' \ + '--index=[specify registry index to yank from]:registry index' \ + '--token=[specify API token to use when authenticating]:token' \ + '*: :_guard "^-*" "crate"' + ;; + *) + # allow plugins to define their own functions + if ! _call_function ret _cargo-${words[1]}; then + # fallback on default completion for unknown commands + _default && ret=0 + fi + (( ! ret )) + ;; + esac + ;; + esac } -_cargo_cmds(){ -local -a commands;commands=( -'bench:execute all benchmarks of a local package' -'build:compile the current package' -'check:check the current package without compiling' -'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 package in current directory' -'install:install a Rust binary' -'locate-project:print "Cargo.toml" location' -'login:login to remote server' -'metadata:the metadata for a package in json' -'new:create a new package' -'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 -t common-commands 'common commands' commands +_cargo_unstable_flags() { + local flags + flags=( help ${${${(M)${(f)"$(_call_program flags cargo -Z help)"}:#*--*}/ #-- #/:}##*-Z } ) + _describe -t flags 'unstable flag' flags } -_cargo_all_cmds(){ -local -a commands;commands=($(cargo --list)) -_describe -t all-commands 'all commands' commands +_cargo_installed_crates() { + local expl + _description crates expl 'crate' + compadd "$@" "$expl[@]" - ${${${(f)"$(cargo install --list)"}:# *}%% *} +} + +_cargo_cmds() { + local -a commands + # This uses Parameter Expansion Flags, which are a built-in Zsh feature. + # See more: http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags + # and http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion + # + # # How this work? + # + # First it splits the result of `cargo --list` at newline, then it removes the first line. + # Then it removes indentation (4 whitespaces) before each items. (Note the x## pattern [1]). + # Then it replaces those spaces between item and description with a `:` + # + # [1]: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org#patterns + commands=( ${${${(M)"${(f)$(_call_program commands cargo --list)}":# *}/ ##/}/ ##/:} ) + _describe -t commands '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 +_cargo_package_names() { + _message -e packages package } # 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) +_cargo_names_from_array() { + # strip json from the path + local manifest=${${${"$(cargo locate-project)"}%\"\}}##*\"} if [[ -z $manifest ]]; then return 0 fi @@ -494,51 +372,36 @@ _get_names_from_array() local in_block=false local block_name=$1 names=() - while read line - do + while read -r line; do if [[ $last_line == "[[$block_name]]" ]]; then in_block=true else - if [[ $last_line =~ '.*\[\[.*' ]]; then + if [[ $last_line =~ '\s*\[\[.*' ]]; then in_block=false fi fi if [[ $in_block == true ]]; then - if [[ $line =~ '.*name.*=' ]]; then - regexp-replace line '^.*name *= *|"' "" - names+=$line + if [[ $line =~ '\s*name\s*=' ]]; then + regexp-replace line '^\s*name\s*=\s*|"' '' + names+=( "$line" ) fi fi last_line=$line - done < $manifest - _describe $block_name names + done < "$manifest" + _describe "$block_name" names } #Gets the test names from the manifest file -_test_names() -{ - _get_names_from_array "test" +_cargo_test_names() { + _cargo_names_from_array "test" } #Gets the bench names from the manifest file -_benchmark_names() -{ - _get_names_from_array "bench" +_cargo_benchmark_names() { + _cargo_names_from_array "bench" } -# These flags are mutually 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/zsh/plugins/catimg/README.md b/zsh/plugins/catimg/README.md index 2fc28a1..8f26880 100644 --- a/zsh/plugins/catimg/README.md +++ b/zsh/plugins/catimg/README.md @@ -2,28 +2,16 @@ Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/catimg) +To use it, add `catimg` to the plugins array in your zshrc file: + +```zsh +plugins=(... catimg) +``` + ## Requirements - `convert` (ImageMagick) -## Enabling the plugin - -1. Open your `.zshrc` file and add `catimg` in the plugins section: - - ```zsh - plugins=( - # all your enabled plugins - catimg - ) - ``` - -2. Reload the source file or restart your Terminal session: - - ```console - $ source ~/.zshrc - $ - ``` - ## Functions | Function | Description | diff --git a/zsh/plugins/chruby/README.md b/zsh/plugins/chruby/README.md new file mode 100644 index 0000000..d373006 --- /dev/null +++ b/zsh/plugins/chruby/README.md @@ -0,0 +1,20 @@ +# chruby plugin + +This plugin loads [chruby](https://github.com/postmodern/chruby), a tool that changes the +current Ruby version, and completion and a prompt function to display the Ruby version. +Supports brew and manual installation of chruby. + +To use it, add `chruby` to the plugins array in your zshrc file: +```zsh +plugins=(... chruby) +``` + +## Usage + +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 +``` diff --git a/zsh/plugins/chucknorris/README.md b/zsh/plugins/chucknorris/README.md index be7b97e..35f9891 100644 --- a/zsh/plugins/chucknorris/README.md +++ b/zsh/plugins/chucknorris/README.md @@ -1,6 +1,6 @@ # chucknorris -Chuck Norris fortunes plugin for oh-my-zsh +Chuck Norris fortunes plugin for oh-my-zsh. Perfectly suitable as MOTD. **Maintainers**: [apjanke](https://github.com/apjanke) [maff](https://github.com/maff) @@ -10,11 +10,31 @@ To use it add `chucknorris` to the plugins array in you zshrc file. plugins=(... chucknorris) ``` - -Depends on fortune (and cowsay if using chuck_cow) being installed (available via homebrew, apt, ...). Perfectly suitable as MOTD. - +## Usage | Command | Description | | ----------- | ------------------------------- | | `chuck` | Print random Chuck Norris quote | | `chuck_cow` | Print quote in cowthink | + +Example: output of `chuck_cow`: + +``` +Last login: Fri Jan 30 23:12:26 on ttys001 + ______________________________________ +( When Chuck Norris plays Monopoly, it ) +( affects the actual world economy. ) + -------------------------------------- + o ^__^ + o (oo)\_______ + (__)\ )\/\ + ||----w | + || || +``` + +## Requirements + +- `fortune` +- `cowsay` if using `chuck_cow` + +Available via homebrew, apt, ... diff --git a/zsh/plugins/chucknorris/fortunes/chucknorris b/zsh/plugins/chucknorris/fortunes/chucknorris index 2a13b06..0ddb6c0 100644 --- a/zsh/plugins/chucknorris/fortunes/chucknorris +++ b/zsh/plugins/chucknorris/fortunes/chucknorris @@ -1,2544 +1,560 @@ -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -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 does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -Chuck Norris can win in a top spinning tournament with a cube -% -Beware of dogs... Dogs, beware of Chuck Norris. -% -Chuck Norris can dig a hole in air. -% -The apple falls far from the tree, when a roundhouse kick is taken to the trunk. -% -Chuck Norris - the new standard. -% -Chuck Norris told me to put this here. -% -Chuck Norris doesn't exhale. The air runs desperately scared out of his lungs. -% -Fear of spiders is aracnaphobia, fear of tight spaces is chlaustraphobia, fear of Chuck Norris is called Logic -% -When Chuck Norris goes to rodeos, bulls ride him. -% -Chuck Norris once walked down a street with his fists in his pockets. He was then arrested for concealing two deadly weapons. -% -The meaning of life is Chuck Norris -% -Chuck Norris is the meaning of life. Too bad he's also the meaning of death. -% -If God doesn't know, Chuck does -% -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. -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -When God said "Let there be light!", Chuck Norris said "Only for half the day -% -Chuck Norris went up the creek without a paddle... or a canoe -% -Chuck Norris once asked a man to turn down his music, he refused, that man's baby was born deaf. -% -Chuck Norris found the hay in the needle stack. -% -Chuck Norris doesn't need to brush his teeth, his spit acts as a bleach. -% -Chuck Norris once had a street named after him. But the name removed at once, because nobody crosses Chuck Norris, and lives -% -The planes in 9/11 were not hijacked. Chuck Norris was just playing with his old radio controller. -% -Machiavelli said it is better to be feared than loved because he was inspired by Chuck Norris. -% -Chuck Norris Can Play the Theme from the Twilight Zone with His Beard -% -Chuck Norris pees Adamantium -% -The Beatles are on iTunes because Chuck Norris bought a Mac. -% -Chuck Norris once rounhouse kicked a football ...... it is now considered as a planet -% -Chuck Norris yells at Drill Sergeants -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -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. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent.? -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -There is no such thing as being hard its called the Chuck Norris factor. -% -When Chuck Norris goes to the library, he looks for the guinness book of records in the comedy section. -% -Chuck Norris can shoot a person 28 times with an unloaded gun. -% -Chuck Norris' personal airplane is called Air Force Chuck -% -The letters in Chuck Norris cannot be unscrambled. -% -Cops don't need a badges in their wallets but only a picture of Chuck Norris. -% -Chuck Norris was the reason why the Great Wall of China was constructed. It failed miserably. -% -If you see a man in the street who looks like Chuck Norris, but isn't, run: you don't want to be caught in the resulting roundhouse kick to his face. -% -The red phone in the oval office...Rings directly to Chuck Norris Cell Phone -% -The only way sharks will come near CN underwater is when CN is inside of a cage. -% -Chuck Norris uses a real mouse to move the cursor, type on the keyboard, write e-mails, code entire websites, use photoshop, bring coffee. -% -If Chuck Norris were to get into a fight with another Chuck Norris, Chuck Norris would win. +King Kong climbed the Empire State building in fear of Chuck Norris who was downstairs at the time. % "2012" is code for, Chuck Norris when he is pissed. % -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -In the back of the book of world records, it says "All records are held by Chuck Norris. The ones listed are in second place." -% -The only place where the Starship Enterprise refuses to boldly go is Chuck Norris' planet...which is all of them. -% -Chuck Norris once had a pet monkey........his name was KING KONG -% -Chuck Norris can make his own megazord "The Chuck Norris Roundhouse Kickers Ultimate Super Awesome Megazord" -% -Simon doesn't say...Chuck Norris says. -% -When does Chuck Norris run out of shotgun bullets?.....whenever he wants to. -% -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. -% -Chuck Norris can turn toast back into bread -% -Chuck Norris started Chuck Norris. -% -Ever wonder what really happened to the dinosaurs? They all dug their own graves when they heard Chuck Norris was coming -% -Chuck Norris killed Kemper -% -Did you here about the boy who cried Chuck Norris? -% -Chuck Norris can't perform Hadoukens, he IS a Hadouken -% -Behind every successful man is Chuck Norris -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -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. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -The square root of Chuck Norris is pain. Do not try to square Chuck Norris. The result is death -% -Chuck Norris doesn't read. He just stares at the book until he gets the information he wants. -% -Why didn't the chicken cross the road? Because Chuck Norris got to it first. -% -When taking the SAT, write "Chuck Norris" for every answer. You will score over 8000. -% -Chuck Norris can milk an alligator -% -Chuck Norris doesn't eat, he just sucks the energy out of food by staring at it -% -Chuck Norris once proved p^~p by induction on his beard hairs. -% -The reason why batman only comes out at night is because he's afraid he might encounter Chuck Norris in the Morning and afternoon. -% -Chuck Norris can bake in a Freezer. -% -Chuck Norris is currently suing any broadway theater that plays "The Nutcracker". He claims its an infringement on his "other" roundhouse kick. -% -Chuck Norris once had a weak moment, just to know what it felt like. -% -Note to everyone: Please do not give beans to Chuck Norris or do you want another atombomb on hiroshima? -% -Chuck Norris has made a 148 break a snooker. -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -http://chucknorrisfacts.com/ is built in Drupal because Chuck Norris knows a good CMS when he sees one. -% -The producers of the movie "The Last Airbender" are now in talks with Chuck Norris in Order to star him in their next sequal "The Last Skull Bender". -% -Some boots were made for walking. Some boots may walk all over you, but Chuck Norris' boot walk THROUGH you. -% -World War II began because Chuck Norris took a nap. When he woke up, Hitler found out and killed himself out of fear Chuck Norris would kill him. -% -The best part of waking up is not Folgers in your cup, it's knowing that Chuck Norris let you live. -% -Only Chuck Norris can win the mind game, 'cause he never minds. -% -Do you know why Chuck Norris didn't star in The Expandebles? Because all the others guys would have surrended at the beginning. -% -Bruce Lee didn't defeat Chuck Norris. Chuck hit Bruce with a Delayed roundhouse kick that was so fast that Lee only felt the impact a year later! -% -Chuck Norris doesn't need a bulletproof vest to be bulletproof -% -When Chuck Norris goes to Vegas, he doesn't have to gamble. The casinos just give him stacks of money. -% -Merlin was Chuck Norris' assistant. -% -If you put in the correct cheat code in Halo 2, you can have Master Cheif play without his helmet; revealing to be Chuck Norris. -% -Those who ignore history, are doomed by Chuck Norris. -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -Some kids pee their name in snow. Chuck Norris pees his name in concrete. -% -The Matrix Trilogy would have ended on the first movie if Keanu Reeves said, “I know Chuck Norris.” -% -Chuck Norris created Heavy Metal when he was upset -% -Some people ask for a Kleenex when they sneeze, Chuck Norris asks for a body bag. -% -When things go bump in the night.... it's Chuck Norris -% -Chuck Norris fed the Hunger Games -% -Chuck Norris played "Got your Nose" with Voldemort and won. -% -Chuck Norris had a knife thrown at him............ the knife didn't impale him, he impaled the knife -% -Chuck Norris doesn't let it go. -% -You know Chuck Norris' pet lizard, right? Last I heard, he was in the movie "Godzilla". Oh, and his pet turtle starred in "Gamera" as well. -% -Whatever Chuck Norris wants, it will instantly appear. -% -Chuck Norris once cut a knife with a stick of butter. -% -Chuck Norris shops at Sam's Club, but leaves without having his receipt checked -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -In 1945 The US army asked if they could clone Chuck Norris. instead he said he could sort out the Japanese. -% -One glance from Chuck Norris and snow turns itself yellow. -% -Chuck Norris checks under his bed for Fedor Emelianenko because he takes Fedor to the vet regularly. -% -Chuck Norris was the image used for Papa Smurf. -% -Chuck Norris is so scary he makes Sharks swim backwards away from him -% -When Chuck Norris tosses a coin, it lands on both head and tail. -% -Chuck Norris found the last digit of pie -% -Chuck Norris Watches "the Nat.Geo. Specials" on Discovery Channel -% -James Bond has a license to kill. He got it from Chuck Norris. -% -Chuck Norris is Chuck Norris -% "The Big Chuck Norris Roundhouse-Kick Theory" % -That's not an eclipse....that's the sun hiding from Chuck Norris. -% -Chuck Norris doesn't like Mudkipz -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -Chuck Norris doesn’t eat salad, he eats vegetarians -% -Every time there's an earthquake, you know Chuck Norris is hungry. The earthquake is caused by his stomach growling. -% -Chuck Norris wasn't born on his birthday -% -One time a test cheated on Chuck Norris. -% -Chuck Norris won a stepdance contest by standing on his hands -% -Chuck Norris thretened to kill Michael Jackson, MJ got so scared to turned white. -% -When Steven Seagal kills a ninja, he only takes its hide. When Chuck Norris kills a ninja, he uses every part. -% -Chuck Norris is the life of parties he dosen't attend -% -Chuck Norris can rub two fires together and make a stick! -% -Contrary to popular beleif, Rome WAS built in a day, by Chuck Norris. -% -Chuck Norris rolled a 20 on a 6 sided die. -% -When chuck Norris was in school, he made his PE teacher run laps. -% -Chuck Norris wins NASCAR races with all right turns. -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -Chuck Norris is waiting for Mt. St. Helens to erupt again. He's hoping the lava is hot enough to soften his beard so he can shave for the first time. -% -Chuck Norris is overra... -% -Chuck Norris was originally in Mortal Kombat, but that version was deleted because no one can beat Chuck Norris in a fight. -% -Chuck Norris likes everyone on the earth, cause everyone he didn't like... Is dead... -% -Chunk Norris can make sour milk turn fresh -% -There is no limbo, only a world that doesn't know of Chuck Norris -% -Chuck Norris CAN believe it's not butter -% -Dog the Bounty Hunter can't track Chuck Norris down. -% -Abraham Lincoln didn't die because he was shot, Chuck Norris roundhouse-kicked so fast his foot went back in time and killed Abraham Lincoln. -% -When Chuck Norris inhales helium, his voice doesn't change. -% -When Chuck Norris drinks water, the water automatically pasteurized. -% -Chuck Norris once punched the ground to stop an earthquake. The resulting aftershock caused the BP oil spill -% -Chuck Norris can play the death waltz with his chin. -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -More of a question than a fact: in a fight between Chuck Norris and Gordan Freeman who would win? -% -Chuck Norris once round-house kicked a salesman. Over the phone. -% -Chuck Norris can grill a popsicle -% -Chuck Norris' films are factual documentaries. -% -Casinos pay Chuck Norris not to play at anything or wish anyone good luck. -% -Chuck Norris once got a 200 yard punt return -% -Every line in a Chuck Norris haiku is "A roundhouse kick to the face." And they all have the correct number of syllables. -% -An angry glare from Chuck Norris is known to kill on the spot. -% -Evolution's driving mechanism is nature's desperate attempt to escape Chuck Norris. -% -When President Roosevelt dropped the atomic bomb on Hiroshima, he did so only because it was more human then sending Chuck Norris. -% -Don't get Chuck Norris angry, last time somebody did that Chuck Norris made the Grand Canyon. -% -In Texas, there are five sizes for fountain drinks: small, medium, large, Texas sized, and Chuck Norris Sized. It is a cup made of a human skull. -% -After Chuck counted to infinity the first time, he vowed to count to infinity a second time....by counting the bodies of those previously roundhoused. -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -Taking Karate Lessons = $100, Buying MMA DVD's= $150, Subscribing to a UFC event = $50, Getting a Roundhouse Kick from Chuck Norris = PRICELESS -% -Chuck Norris played the game of thrones and won -% -Chuck Norris doesn't need sunglasses, the sun needs Chuck Norris glasses -% -Chuck Norris doesn't call the wrong number, you just answer the wrong phone. -% -Chuck Norris once won the tour de france riding a " big wheel" -% -May the Force be with Chuck Norris... for it's own good. -% -Chuck Norris once played Duck Duck Goose with a group of Kindergarteners. Only one kid made it to first grade -% -During the Civil War Chuck Norris was a slave, his master would often beg him for mercy -% -Chuck Norris' glass is never half full or half empty. It stays full even after he takes a drink. -% - King Kong climbed the Empire State building in fear of Chuck Norris who was downstairs at the time. -% -Chuck Norris can French kiss his elbow. -% -Chuck Norris never trains, because he's Chuck Norris. -% -Every phobia known to man has a phobia of Chuck Norris -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -Once upon a time, Chuck Norris found himself in a town called Shit Creek.....He opened a Paddle Store. -% -Chuck Norris Can Power Solar Panels. At Night. -% -When Betty White gets angry, she turns into the Hulk. When Valerie Bertinelli gets mad, she turns into Chuck Norris. -% -Chuck Norris is so hard, he uses diamonds as stress balls. -% -Chuck Norris can roundhouse kick someone through a window without breaking the glass -% -Chuck Norris. Enough said. -% -The letters in Chuck Norris cannot be unscrambled. -% -Chuck Norris once taught a class of martial arts.Unfortunately Chuck had forgiven to take elephant tranquilizers and killed every one just by saluting -% -Chuck Norris was heard in a soundproof room! -% -Chuck Norris can see in 3D with just one eye. -% -Chuck Norris owns all number 1 pencils. -% -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 doesn’t brew up tea. He sucks the bag. -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -They say death by a 1000 lashes was the most painful way to die, that was before they got roundhouse kicked in the face by Chuck Norris -% -Chuck Norris made a statue bleed. -% -Dead bodies were found of people that are still alive. These people will cross Chuck Norris in the future and will be round-house kicked back in time. -% -The reason why batman only comes out at night is because he's afraid he might encounter Chuck Norris in the Morning and afternoon. -% -The kids said when Chuck was eating Trix cereal ´´silly Chuck, Trix are for kids´´...what happened next?..............................Darfur happened. -% -Chuck Norris can roundhouse-kick round houses into squares. -% -Chuck Norris is allowed two carry-ons. -% -Chuck Norris can divide by zero. -% -Chuck Norris does not have a cell phone because he hears everything -% -Chuck Norris isn't appropriate...appropriate isn't Chuck Norris -% -Earth's rotation is purely governed by the direction that Chuck Norris is walking. -% -Chuck Norris drowned a man ON LAND. -% -The Jone's are trying to keep up with Chuck Norris -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -Chuck Norris bowled a 301 after constructing another pin out of his beard hair -% -The only reason that USA lost the 2011 world cup to Japan is because Chuck Norris wasn't there. -% -Unlike Jack Bauer, Chuck Norris doesn't need bullets. A quick roundhouse to the face kills twice as fast. -% -There is no such thing as global warming. Chuck Norris was cold, so he turned the sun up. -% -Chuck Norris' dog pick up after him. -% -Jedis are now taught to use the "Chuck" -% -Chuck Norris dosent carry a list. He always knows what to do. -% -When Chuck Norris performs a roundhouse kick, he's actually measuring the circumference of the universe. -% -Walker: Texas Ranger went into syndication before the first episode was shot. -% -Chuck Norris doesn't throw up if he drinks too much. Chuck Norris throws down! -% -"Walker Texas Ranger: The Movie 3-D" was considered by Warner Brothers; however the technology to create the visual effects will never be possible. -% -When Chuck Norris creates a login, it tells him "password not strong enough", he types in his name and it tells him "password too strong." -% -Chuck Norris isn't allowed at the zoo because when he's there the animals are terriefied to come out their cages -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -Aliens fear that Chuck Norris might abduct them. -% -Chuck Norris splattered tiger blood and Adonis' dna on Charlie Sheen with 1 roundhouse kick! -% -How much wood could a woodchuck chuck if a woodchuck could chuck wood? No woodchuck could chuck Chuck's wood! -% -The sun only rises every morning because Chuck Norris allows it to. -% -Chuck Norris can do a regime change with a roundhouse kick. -% -Chuck Norris CAN spell with an I before E even after C. -% -Ghosts can see Chuck Norris -% -The answer to life, the universe and everything isnt 42. It's Chuck Norris. -% -When Chuck Norris pokes the Pillsbury Doughboy, it's not a laughing matter. -% -Chuck Norris once thought he was wrong. He was, however, mistaken. -% -Ever wonder what really happened to the dinosaurs? They all dug their own graves when they heard Chuck Norris was coming -% "The wind cries Chuck Norris" % -Chuck Norris doesn't need a bulletproof vest. He catches them with his bare hands. -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. +"Walker Texas Ranger: The Movie 3-D" was considered by Warner Brothers; however the technology to create the visual effects will never be possible. % A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. % -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -Chuck Norris: even Naruto can't believe it -% -Chuck Norris can fit 10 gallons of water in a 5 gallon water bucket -% -Chuck Norris roundhouse kicks people in the face first and asks questions later. -% -Chuck Norris is the only one who can tear a facebook page! -% -Chuck Norris doesn't need air, he is air -% -Chuck Norris once tried to teach a fat, stupid kid Martial Arts. Unsuccessfully. The kid grew up to be Steven Seagal. +Abraham Lincoln didn't die because he was shot, Chuck Norris roundhouse-kicked so fast his foot went back in time and killed Abraham Lincoln. % Achievement Unlocked: Chuck Norris of Death % -Chuck Norris is the ghost in paranormal activity. +After Chuck counted to infinity the first time, he vowed to count to infinity a second time....by counting the bodies of those previously roundhoused. % -Chuck Norris can't get fired by Donald Trump +Aliens fear that Chuck Norris might abduct them. % -Ozzy Osbourne once accidentally bit the head off a live bat - Chuck Norris once deliberately bit the head off a live pterodactyl. +An angry glare from Chuck Norris is known to kill on the spot. % -Note to self: Don’t be the cashier to tell Chuck Norris his coupons have expired. +Behind every successful man is Chuck Norris. % -Chuck Norris was what Willis was talking about. +Beware of dogs... Dogs, beware of Chuck Norris. % -Chuck Norris is entitiled to his own facts. -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. +Bruce Lee didn't defeat Chuck Norris. Chuck hit Bruce with a Delayed roundhouse kick that was so fast that Lee only felt the impact a year later! % CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. % -Chuck Norris can win a game of Connect Four in only three moves. +Casinos pay Chuck Norris not to play at anything or wish anyone good luck. % -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -While visiting the hexagon, Chuck Norris was asked to demonstrate his famous roundhouse kick. Henceforth, it has been known as the Pentagon. -% -When Chuck Norris played the card game War with a friend, France surrendered. -% -If Goliath listened to Chuck Norris he would have won. -% -Chuck Norris can defuse bomb even if he cut the wrong wire -% -Chuck Norris sleeps in Seattle. -% -Chuck Norris shot a man with a knife -% -The dictionary references Chuck Norris several times, he is metioned under Fear, Law, Order and Chucktatorship. +Chuck Norris - the new standard. % Chuck Norris CAN balance the light-switch between ON and OFF. % -If Chuck was ever captured, he could win a game of Russian Roulette with six bullets in the revolver, he would shoot everyone else! +Chuck Norris CAN believe it's not butter. % -In a rain storm Chuck Norris stays dry. Rain drops are scared to hit him. +Chuck Norris CAN spell with an I before E even after C. % -Chuck Norris is the reason tumbleweeds tumble +Chuck Norris can play the theme from the Twilight Zone with his beard. % -The Earth was almost destroyed by a 50 km wide asteroid in 1984, but Chuck Norris roundhouse kicked it into the Sun. +Chuck Norris can power solar panels. At night. % -Chuck Norris can terminate a repeating decimal. +Chuck Norris watches "the Nat.Geo. Specials" on Discovery Channel. % -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -Chuck Norris doesn't look for fun. The fun looks for Chuck Norris. -% -Chuck Norris starts his day with 6 live chickens two cows, three pigs and a boiling hot cup of pure fury -% -The only word that rhymes with orange is Chuck Norris -% -Everyone is so scared of Chuck Norris that they kiss his arse by writing these facts, too right they should -% -gmail@chucknorris.com -% -Chuck Norris play's Texas hold em with Zeus, every second Wednesday of the month -% -Chuck Norris has killed the Dead Sea -% -On the keyboard there is no control button because Chuck Norris is always in control. -% -The truth hurts dosen't it, Chuck Norris' truth kills. -% -Chuck Norris sent a BBM to an iphone. -% -When Presidents speak, their nation listens. When Chuck Norris blinks, the whole World listens. -% -Chuck Norris once cried just to see what it was like. The end result was the creation of life. -% -Chuck Norris is the reason that the world will end in 2012. He was getting bored with the Earth -% -When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. -% -Chuck Norris doesn't read books. He stares them down until he gets the information he wants. -% -There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live. -% -Outer space exists because it's afraid to be on the same planet with Chuck Norris. -% -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. -% -Chuck Norris is the reason why Waldo is hiding. -% -Chuck Norris counted to infinity - twice. -% -There is no chin behind Chuck Norris’ beard. There is only another fist. -% -When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. -% -Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. -% -Chuck Norris' hand is the only hand that can beat a Royal Flush. -% -Chuck Norris can lead a horse to water AND make it drink. -% -Chuck Norris doesn’t wear a watch. HE decides what time it is. -% -Chuck Norris can slam a revolving door. -% -Chuck Norris does not get frostbite. Chuck Norris bites frost. -% -Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. -% -Contrary to popular belief, America is not a democracy, it is a Chucktatorship. -% -If you spell Chuck Norris in Scrabble, you win. Forever. -% -Guns don't kill people. Chuck Norris kills people. -% -There is no theory of evolution. Just a list of animals Chuck Norris allows to live. -% -The chief export of Chuck Norris is Pain. -% -Chuck Norris has two speeds. Walk, and Kill. -% -The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. -% -Chuck Norris drives an ice cream truck covered in human skulls. -% -Chuck Norris is my Homeboy. -% -Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. -% -Chuck Norris uses pepper spray to spice up his steaks. -% -Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light, went back in time, and killed Amelia Earhart while she was flying over the Pacific Ocean. -% -Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. -% -Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. -% -The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. -% -Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on earth. -% -Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. -% -If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. -% -When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. -% -The quickest way to a man's heart is with Chuck Norris' fist. -% -Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. -% -CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time. -% -Chuck Norris can win a game of Connect Four in only three moves. -% -What was going through the minds of all of Chuck Norris' victims before they died? His shoe. -% -Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. -% -Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. -% -Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. -% -Chuck Norris doesn’t wash his clothes, he disembowels them. -% -A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there. -% -Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. -% -Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. -% -Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." -% -Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. -% -Only Chuck Norris is stronger than an Altoid. -% -Chuck Norris has a battlecruiser AND a car. +Chuck Norris bowled a 301 after constructing another pin out of his beard hair. % Chuck Norris burnt a fire proof vest, UNDERWATER! % -Chuck Norris was once turned down for American Idol. When Simon was questioned about it, he replied "I'm retiring after this season". I wonder why? +Chuck Norris can French kiss his elbow. +% +Chuck Norris can bake in a freezer. +% +Chuck Norris can defuse a bomb by cutting the wrong wire. +% +Chuck Norris can dig a hole in air. +% +Chuck Norris can divide by zero. +% +Chuck Norris can do a regime change with a roundhouse kick. +% +Chuck Norris can fit 10 gallons of water in a 5 gallon bucket. +% +Chuck Norris can grill a popsicle. +% +Chuck Norris can lead a horse to water AND make it drink. +% +Chuck Norris can make his own megazord "The Chuck Norris Roundhouse Kickers Ultimate Super Awesome Megazord". +% +Chuck Norris can milk an alligator. +% +Chuck Norris can play the death waltz with his chin. +% +Chuck Norris can roundhouse kick someone through a window without breaking the glass. +% +Chuck Norris can roundhouse-kick round houses into squares. +% +Chuck Norris can rub two fires together and make a stick! +% +Chuck Norris can see in 3D with just one eye. +% +Chuck Norris can slam a revolving door. +% +Chuck Norris can terminate a repeating decimal. +% +Chuck Norris can turn toast back into bread. +% +Chuck Norris can win a game of Connect Four in only three moves. +% +Chuck Norris can win in a top spinning tournament with a cube. +% +Chuck Norris can't perform Hadoukens, he IS a Hadouken. +% +Chuck Norris checks under his bed for Fedor Emelianenko because he takes Fedor to the vet regularly. +% +Chuck Norris counted to infinity - twice. +% +Chuck Norris created Heavy Metal when he was upset. +% +Chuck Norris does not get frostbite. Chuck Norris bites frost. +% +Chuck Norris does not have a cell phone because he hears everything. +% +Chuck Norris does not sleep. He waits. +% +Chuck Norris doesn't bowl strikes, he just knocks down one pin and the other nine faint. +% +Chuck Norris doesn't call the wrong number, you just answer the wrong phone. % Chuck Norris doesn't cheat death, he beats it fair and square. % -When Chuck Norris roundhouse-kicks you HE decides when you will feel the impact . +Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out. % -Chuck Norris made the big bang just by clicking his fingers +Chuck Norris doesn't eat, he just sucks the energy out of food by staring at it. % -Trick me once, shame on you, trick Chuck Norris.....rest in peace. +Chuck Norris doesn't exhale. The air runs desperately scared out of his lungs. % -Chuck Norris doesn't fight. He gives motivational seminars to die on their own to avoid a roundhouse kick to the face. +Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING. % -This one time at band camp... BAM! Chuck Norris. +Chuck Norris doesn't let it go. % -Chuck Norris protects his body guards. +Chuck Norris doesn't like Mudkipz. % -Chuck Norris watched the first steps on the moon... From his summer home on Mars +Chuck Norris doesn't look for fun. The fun looks for Chuck Norris. +% +Chuck Norris doesn't need a bulletproof vest. He catches them with his bare hands. +% +Chuck Norris doesn't need air, he is air. +% +Chuck Norris doesn't need sunglasses, the sun needs Chuck Norris glasses. +% +Chuck Norris doesn't need to brush his teeth, his spit acts as a bleach. +% +Chuck Norris doesn't read books. He stares them down until he gets the information he wants. +% +Chuck Norris doesn't throw up if he drinks too much. Chuck Norris throws down! +% +Chuck Norris doesn't eat salad, he eats vegetarians. +% +Chuck Norris doesn't wash his clothes, he disembowels them. +% +Chuck Norris doesn't wear a watch. HE decides what time it is. +% +Chuck Norris doesn't carry a list. He always knows what to do. +% +Chuck Norris drives an ice cream truck covered in human skulls. +% +Chuck Norris drowned a man ON LAND. +% +Chuck Norris fed the Hunger Games. +% +Chuck Norris found the hay in the needle stack. +% +Chuck Norris found the last digit of pi. +% +Chuck Norris had a knife thrown at him. The knife didn't impale him; he impaled the knife. +% +Chuck Norris has a battle cruiser AND a car. +% +Chuck Norris has killed the Dead Sea. +% +Chuck Norris has made a 148 break at snooker. +% +Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear. +% +Chuck Norris is allowed two carry-ons. +% +Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs. +% +Chuck Norris is currently suing any broadway theater that plays "The Nutcracker". He claims its an infringement on his "other" roundhouse kick. +% +Chuck Norris is entitled to his own facts. +% +Chuck Norris is my Homeboy. +% +Chuck Norris is so fast, he can run around the world and punch himself in the back of the head. +% +Chuck Norris is so hard, he uses diamonds as stress balls. +% +Chuck Norris is so scary, he makes sharks swim backwards away from him. +% +Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing. +% +Chuck Norris is the ghost in paranormal activity. +% +Chuck Norris is the life of parties he doesn't attend. +% +Chuck Norris is the meaning of life. Too bad he's also the meaning of death. +% +Chuck Norris is the only man to ever defeat a brick wall in a game of tennis. +% +Chuck Norris is the only one who can tear a facebook page! +% +Chuck Norris is the reason that the world will end in 2012. He was getting bored with the Earth. +% +Chuck Norris is the reason tumbleweeds tumble. +% +Chuck Norris is the reason why Waldo is hiding. +% +Chuck Norris is waiting for Mt. St. Helens to erupt again. He's hoping the lava is hot enough to soften his beard so he can shave for the first time. +% +Chuck Norris isn't allowed at the zoo, because when he's there the animals are too terrified to come out of their cages. +% +Chuck Norris made a statue bleed. +% +Chuck Norris made the big bang just by clicking his fingers. +% +Chuck Norris never trains, because he's Chuck Norris. +% +Chuck Norris once cried just to see what it was like. The end result was the creation of life. +% +Chuck Norris once cut a knife with a stick of butter. +% +Chuck Norris once got a 200 yard punt return. +% +Chuck Norris once had a pet monkey named KING KONG. +% +Chuck Norris once had a street named after him. The name removed at once, because nobody crosses Chuck Norris, and lives. +% +Chuck Norris once had a weak moment, just to know what it felt like. +% +Chuck Norris once played Duck Duck Goose with a group of Kindergarteners. Only one kid made it to first grade. +% +Chuck Norris once proved p^~p by induction on his beard hairs. +% +Chuck Norris once punched the ground to stop an earthquake. The resulting aftershock caused the BP oil spill. +% +Chuck Norris once round-house kicked a salesman. Over the phone. +% +Chuck Norris once rounhouse kicked a football. The astronomical society now considers it a planet. +% +Chuck Norris once thought he was wrong. He was, however, mistaken. +% +Chuck Norris once walked down a street with his fists in his pockets. He was then arrested for concealing two deadly weapons. +% +Chuck Norris once won the Tour de France riding a "big wheel". +% +Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch." +% +Chuck Norris owns all number 1 pencils. +% +Chuck Norris pees Adamantium. +% +Chuck Norris plays Texas Hold'Em with Zeus, every second Wednesday of the month. +% +Chuck Norris played "Got your Nose" with Voldemort and won. +% +Chuck Norris played the game of thrones and won. +% +Chuck Norris protects his bodyguards. +% +Chuck Norris rolled a 20 on a 6 sided die. +% +Chuck Norris roundhouse kicks people in the face first and asks questions later. +% +Chuck Norris sent a BBM to an iPhone. +% +Chuck Norris shops at Sam's Club, but leaves without having his receipt checked. +% +Chuck Norris splattered tiger blood and Adonis' DNA on Charlie Sheen with 1 roundhouse kick! +% +Chuck Norris started Chuck Norris. +% +Chuck Norris starts his day with 6 live chickens, two cows, three pigs, and a boiling hot cup of pure fury. +% +Chuck Norris told me to put this here. +% +Chuck Norris uses a real mouse to move the cursor, type on the keyboard, write e-mails, code entire websites, and make coffee. +% +Chuck Norris uses pepper spray to spice up his steaks. +% +Chuck Norris was heard in a soundproof room! +% +Chuck Norris was once turned down for American Idol. When Simon was questioned about it, he replied "I'm retiring after this season". I wonder why? +% +Chuck Norris was originally in Mortal Kombat, but that version was deleted because no one can beat Chuck Norris in a fight. +% +Chuck Norris was the image used for Papa Smurf. +% +Chuck Norris was the reason why the Great Wall of China was constructed. It failed miserably. +% +Chuck Norris was what Willis was talking about. +% +Chuck Norris wasn't born on his birthday. +% +Chuck Norris watched the first steps on the moon... from his summer home on Mars. +% +Chuck Norris went up the creek without a paddle... or a canoe. +% +Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia. +% +Chuck Norris wins NASCAR races with all right turns. +% +Chuck Norris won a stepdance contest by standing on his hands. +% +Chuck Norris yells at drill Sergeants. +% +Chuck Norris' dog picks up after him. +% +Chuck Norris' films are factual documentaries. +% +Chuck Norris' first job was as a paperboy. There were no survivors. +% +Chuck Norris' glass is never half full or half empty. It stays full even after he takes a drink. +% +Chuck Norris' hand is the only hand that can beat a Royal Flush. +% +Chuck Norris' personal airplane is called Air Force Chuck. +% +Chuck Norris. Enough said. +% +Chuck Norris: even Naruto can't believe it. +% +Chuck Norris can make sour milk turn fresh. +% +Contrary to popular belief, Rome WAS built in a day, by Chuck Norris. +% +Contrary to popular belief, America is not a democracy, it is a Chucktatorship. +% +Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on Earth. +% +Cops don't need badges in their wallets, but only a picture of Chuck Norris. +% +Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down. +% +Did you hear about the boy who cried Chuck Norris? +% +Dog the Bounty Hunter can't track Chuck Norris down. +% +Don't get Chuck Norris angry. Last time somebody did that, Chuck Norris made the Grand Canyon. +% +Earth's rotation is purely governed by the direction that Chuck Norris is walking. +% +Ever wonder what really happened to the dinosaurs? They all dug their own graves when they heard Chuck Norris was coming. +% +Every line in a Chuck Norris haiku is "A roundhouse kick to the face." And they all have the correct number of syllables. +% +Every phobia known to man has a phobia of Chuck Norris. +% +Every time there's an earthquake, you know Chuck Norris is hungry. The earthquake is caused by his stomach growling. +% +Evolution's driving mechanism is nature's desperate attempt to escape Chuck Norris. +% +Fear of spiders is arachnaphobia. Fear of tight spaces is claustrophobia. Fear of Chuck Norris is called Logic. +% +Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. +% +Ghosts can see Chuck Norris. +% +Guns don't kill people. Chuck Norris kills people. +% +How much wood could a woodchuck chuck if a woodchuck could chuck wood? No woodchuck could chuck Chuck's wood! +% +If Chuck Norris were a calendar, every month would be named Chucktober, and every day he'd kick your ass. +% +If Chuck Norris were to get into a fight with another Chuck Norris, Chuck Norris would win. +% +If God doesn't know, Chuck does. +% +If Goliath listened to Chuck Norris, he would have won. +% +If at first you don't succeed, you're not Chuck Norris. +% +If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face. +% +If you put in the correct cheat code in Halo 2, you can have Master Chief play without his helmet, revealing himself to be Chuck Norris. +% +If you see a man in the street who looks like Chuck Norris, but isn't, run: you don't want to be caught in the resulting roundhouse kick to his face. +% +If you spell Chuck Norris in Scrabble, you win. Forever. +% +In 1945 The US army asked if they could clone Chuck Norris. Instead he said he could sort out the Japanese. +% +In Texas, there are five sizes for fountain drinks: small, medium, large, Texas sized, and Chuck Norris sized. It is a cup made of a human skull. +% +In a rain storm Chuck Norris stays dry. Rain drops are scared to hit him. +% +In the back of the book of world records, it says "All records are held by Chuck Norris. The ones listed are in second place." +% +James Bond has a license to kill. He got it from Chuck Norris. +% +Jedis are now taught to use the "Chuck". +% +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. +% +Machiavelli said it is better to be feared than loved because he was inspired by Chuck Norris. +% +May the Force be with Chuck Norris... for its own good. +% +Merlin was Chuck Norris' assistant. +% +Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous. +% +Note to self: Don't be the cashier to tell Chuck Norris his coupons have expired. +% +Chuck Norris' keyboard has no control key. Chuck Norris is always in control. +% +Once upon a time, Chuck Norris found himself in a town called Shit Creek. He opened a Paddle Store. +% +One glance from Chuck Norris and snow turns itself yellow. +% +One time a test cheated on Chuck Norris. +% +Only Chuck Norris can win the mind game, 'cause he never minds. +% +Only Chuck Norris is stronger than an Altoid. +% +Outer space exists because it's afraid to be on the same planet with Chuck Norris. +% +Ozzy Osbourne once accidentally bit the head off a live bat - Chuck Norris once deliberately bit the head off a live pterodactyl. +% +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. +% +Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide. +% +Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV. +% +Simon doesn't say... Chuck Norris says. +% +Some boots were made for walking. Some boots may walk all over you, but Chuck Norris' boots walk THROUGH you. +% +Some kids pee their name in snow. Chuck Norris pees his name in concrete. +% +Some people ask for a Kleenex when they sneeze, Chuck Norris asks for a body bag. +% +Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. +% +Staring at Chuck Norris for extended periods of time without proper eye protection will cause blindess, and possibly foot sized brusies on the face. +% +Taking Karate Lessons = $100, Buying MMA DVD's = $150, Subscribing to a UFC event = $50, Getting a Roundhouse Kick from Chuck Norris = PRICELESS. +% +That's not an eclipse. That's the sun hiding from Chuck Norris. +% +The Beatles are on iTunes because Chuck Norris bought a Mac. % The Earth is made up of two-thirds water and one-third Chuck Norris. % +The Earth was almost destroyed by a 50 km wide asteroid in 1984, but Chuck Norris roundhouse kicked it into the Sun. +% +The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably. +% +The Joneses are trying to keep up with Chuck Norris. +% +The Matrix Trilogy would have ended on the first movie had Keanu Reeves said, “I know Chuck Norris.” +% +The answer to life, the universe and everything isn't 42. It's Chuck Norris. +% +The apple falls far from the tree, when Chuck's roundhouse kick is taken to the trunk. +% +The best part of waking up is not Folgers in your cup. it's knowing that Chuck Norris let you live. +% +The chief export of Chuck Norris is pain. +% +The dictionary references Chuck Norris several times, he is metioned under Fear, Law, Order and Chucktatorship. +% +The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. +% +The letters in Chuck Norris cannot be unscrambled. +% +The only place where the Starship Enterprise refuses to boldly go is Chuck Norris' planet... which is all of them. +% +The only reason that USA lost the 2011 world cup to Japan is because Chuck Norris wasn't there. +% +The only sure things are Death and Taxes, and when Chuck Norris goes to work for the IRS, they'll be the same thing. +% +The only way sharks will come near CN underwater is when CN is inside of a cage. +% +The only word that rhymes with orange is Chuck Norris. +% +The producers of the movie "The Last Airbender" are now in talks with Chuck Norris in Order to star him in their next sequal "The Last Skull Bender". +% +The quickest way to a man's heart is with Chuck Norris' fist. +% +The reason why Batman only comes out at night is because he's afraid he might encounter Chuck Norris in the morning and afternoon. +% +The red phone in the oval office rings directly to Chuck Norris' cell phone. +% +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. +% +The square root of Chuck Norris is pain. Do not try to square Chuck Norris. The result is death. +% +The sun only rises every morning because Chuck Norris allows it to. +% +The truth hurts, doesn't it? Chuck Norris' truth kills. +% +There is no chin behind Chuck Norris' beard. There is only another fist. +% +There is no limbo, only a world that doesn't know of Chuck Norris. +% +There is no such thing as global warming. Chuck Norris was cold, so he turned the sun up. +% +There is no theory of evolution, just a list of creatures Chuck Norris has allowed to live. +% +This one time at band camp... BAM! Chuck Norris. +% +Those who ignore history, are doomed by Chuck Norris. +% +Trick me once, shame on you, trick Chuck Norris.. rest in peace. +% +Unlike Jack Bauer, Chuck Norris doesn't need bullets. A quick roundhouse to the face kills twice as fast. +% +Walker: Texas Ranger went into syndication before the first episode was shot. +% +What was going through the minds of all of Chuck Norris' victims before they died? His shoe. +% +Whatever Chuck Norris wants, it will instantly appear. +% +When Betty White gets angry, she turns into the Hulk. When Valerie Bertinelli gets mad, she turns into Chuck Norris. +% +When Chuck Norris creates a login, it tells him "password not strong enough." He types in his name and it tells him "password too strong." +% +When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down. +% +When Chuck Norris drinks water, the water automatically pasteurized. +% +When Chuck Norris goes to Vegas, he doesn't have to gamble. The casinos just give him stacks of money. +% +When Chuck Norris goes to rodeos, bulls ride him. +% +When Chuck Norris goes to the library, he looks for the Guinness book of records in the comedy section. +% +When Chuck Norris inhales helium, his voice doesn't change. +% +When Chuck Norris performs a roundhouse kick, he's actually measuring the circumference of the universe. +% +When Chuck Norris played the card game War with a friend, France surrendered. +% +When Chuck Norris pokes the Pillsbury Doughboy, it's not a laughing matter. +% +When Chuck Norris roundhouse-kicks you, he decides when you will feel the impact. +% +When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever. +% +When Chuck Norris tosses a coin, it lands on both heads and tails. +% +When God said "Let there be light!", Chuck Norris said "Only for half the day." +% +When Presidents speak, their nation listens. When Chuck Norris blinks, the whole world listens. +% +When Steven Seagal kills a ninja, he only takes its hide. When Chuck Norris kills a ninja, he uses every part. +% +When chuck Norris was in school, he made his PE teacher run laps. +% +When does Chuck Norris run out of shotgun bullets? whenever he wants to. +% +When taking the SAT, write "Chuck Norris" for every answer. You will score over 8000. +% +When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris. +% +When things go bump in the night, it's Chuck Norris +% +While visiting the Hexagon, Chuck Norris was asked to demonstrate his famous roundhouse kick. Henceforth, it has been known as the Pentagon. +% +Why didn't the chicken cross the road? Because Chuck Norris got to it first. +% +You know Chuck Norris' pet lizard, right? Last I heard, he was in the movie "Godzilla". Oh, and his pet turtle starred in "Gamera" as well. +% +http://chucknorrisfacts.com/ is built in Drupal because Chuck Norris knows a good CMS when he sees one. +% diff --git a/zsh/plugins/cloudapp/README.md b/zsh/plugins/cloudapp/README.md new file mode 100644 index 0000000..ef304ed --- /dev/null +++ b/zsh/plugins/cloudapp/README.md @@ -0,0 +1,26 @@ +# CloudApp plugin + +## The CloudApp API is deprecated, so the plugin will be removed shortly + +[CloudApp](https://www.getcloudapp.com) brings screen recording, screenshots, and GIF creation to the cloud, in an easy-to-use enterprise-level app. The CloudApp plugin allows you to upload a file to your CloadApp account from the command line. + +To use it, add `cloudapp` to the plugins array of your `~/.zshrc` file: + +```zsh +plugins=(... cloudapp) +``` + +## Requirements + +1. [Aaron Russell's `cloudapp_api` gem](https://github.com/aaronrussell/cloudapp_api#installation) + +2. That you set your CloudApp credentials in `~/.cloudapp` as a simple text file like below: + ``` + email + password + ``` + +## Usage + +- `cloudapp `: uploads `` to your CloudApp account, and if you're using + macOS, copies the URL to your clipboard. diff --git a/zsh/plugins/cloudapp/cloudapp.plugin.zsh b/zsh/plugins/cloudapp/cloudapp.plugin.zsh index 3b363c8..a4d92a0 100644 --- a/zsh/plugins/cloudapp/cloudapp.plugin.zsh +++ b/zsh/plugins/cloudapp/cloudapp.plugin.zsh @@ -1,6 +1,4 @@ -alias cloudapp="${0:a:h}/cloudapp.rb" - -# Ensure only the owner can access the credentials file -if [[ -f ~/.cloudapp ]]; then - chmod 600 ~/.cloudapp -fi +print -Pn "%F{yellow}" +print "[oh-my-zsh] The CloudApp API no longer works, so the cloudapp plugin will" +print "[oh-my-zsh] be removed shortly. Please remove it from your plugins list." +print -Pn "%f" diff --git a/zsh/plugins/cloudapp/cloudapp.rb b/zsh/plugins/cloudapp/cloudapp.rb deleted file mode 100755 index a11cfdb..0000000 --- a/zsh/plugins/cloudapp/cloudapp.rb +++ /dev/null @@ -1,60 +0,0 @@ -#!/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/zsh/plugins/codeclimate/README.md b/zsh/plugins/codeclimate/README.md new file mode 100644 index 0000000..0d712ac --- /dev/null +++ b/zsh/plugins/codeclimate/README.md @@ -0,0 +1,8 @@ +# codeclimate plugin + +This plugin adds autocompletion for the [`codeclimate` CLI](https://github.com/codeclimate/codeclimate). + +To use it, add `codeclimate` to the plugins array in your zshrc file: +```zsh +plugins=(... codeclimate) +``` diff --git a/zsh/plugins/coffee/README.md b/zsh/plugins/coffee/README.md index d6cd074..2baade8 100644 --- a/zsh/plugins/coffee/README.md +++ b/zsh/plugins/coffee/README.md @@ -1,4 +1,4 @@ -## Coffeescript Plugin +# Coffeescript Plugin This plugin provides aliases for quickly compiling and previewing your coffeescript code. diff --git a/zsh/plugins/colemak/README.md b/zsh/plugins/colemak/README.md new file mode 100644 index 0000000..4da4bc1 --- /dev/null +++ b/zsh/plugins/colemak/README.md @@ -0,0 +1,48 @@ +# Colemak plugin + +This plugin remaps keys in `zsh`'s [`vi`-style navigation mode](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Keymaps) +for a [Colemak](https://colemak.com/) keyboard layout, to match the QWERTY position: + +![Colemak layout on a US keyboard](https://colemak.com/wiki/images/6/6c/Colemak2.png) + +To use it, add it to the plugins array in your `~/.zshrc` file: + +``` +plugins=(... colemak) +``` + +You will also need to enable `vi` mode, so add another line to `~/.zshrc`: +``` +bindkey -v +``` + +Restart your shell and hit the `` key to activate `vicmd` (navigation) mode, +and start navigating `zsh` with your new keybindings! + +## Key bindings for vicmd + +| Old | New | Binding | Description | +|------------|------------|---------------------------|----------------------------------------------------| +| `CTRL`+`j` | `CTRL`+`n` | accept-line | Insert new line | +| `j` | `n` | down-line-or-history | Move one line down or command history forwards | +| `k` | `e` | up-line-or-history | Move one line up or command history backwards | +| `l` | `i` | vi-forward-char | Move one character to the right | +| `n` | `k` | vi-repeat-search | Repeat command search forwards | +| `N` | `K` | vi-rev-repeat-search | Repeat command search backwards | +| `i` | `u` | vi-insert | Enter insert mode | +| `I` | `U` | vi-insert-bol | Move to first non-blank char and enter insert mode | +| `` | `l` | vi-undo-change | Undo change | +| `J` | `N` | vi-join | Join the current line with the next one | +| `e` | `j` | vi-forward-word-end | Move to the end of the next word | +| `E` | `J` | vi-forward-blank-word-end | Move to end of the current or next word | + +## Key bindings for less + +| Keyboard shortcut | `less` key binding | +|-------------------|--------------------| +| `n` | forw-line | +| `e` | back-line | +| `k` | repeat-search | +| `ESC`+`k` | repeat-search-all | +| `K` | reverse-search | +| `ESC`+`K` | reverse-search-all | diff --git a/zsh/plugins/colored-man-pages/README.md b/zsh/plugins/colored-man-pages/README.md index d9f6acb..4cbf64d 100644 --- a/zsh/plugins/colored-man-pages/README.md +++ b/zsh/plugins/colored-man-pages/README.md @@ -8,8 +8,25 @@ To use it, add `colored-man-pages` to the plugins array in your zshrc file: plugins=(... colored-man-pages) ``` +It will also automatically colorize man pages displayed by `dman` or `debman`, +from [`debian-goodies`](https://packages.debian.org/stable/debian-goodies). + You can also try to color other pages by prefixing the respective command with `colored`: ```zsh colored git help clone ``` + +## Customization + +The plugin declares global associative array `less_termcap`, which maps termcap capabilities to escape +sequences for the `less` pager. This mapping can be further customized by the user after the plugin is +loaded. Check out sources for more. + +For example: `less_termcap[md]` maps to `LESS_TERMCAP_md` which is the escape sequence that tells `less` +how to print something in bold. It's currently shown in bold red, but if you want to change it, you +can redefine `less_termcap[md]` in your zshrc file, after OMZ is sourced: + +```zsh +less_termcap[md]="${fg_bold[blue]}" # this tells less to print bold text in bold blue +``` diff --git a/zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh index ac6a946..37faed6 100644 --- a/zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh +++ b/zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh @@ -1,36 +1,48 @@ -if [[ "$OSTYPE" = solaris* ]] -then - if [[ ! -x "$HOME/bin/nroff" ]] - then - mkdir -p "$HOME/bin" - cat > "$HOME/bin/nroff" < [files]`: colorize the contents of the file (or files, if more than one are provided). - If no arguments are passed it will colorize the standard input or stdin. +* `ccat [files]`: colorize the contents of the file (or files, if more than one are provided). + If no files are passed it will colorize the standard input. -* `cless [files]`: colorize the contents of the file (or files, if more than one are provided) and - open less. If no arguments are passed it will colorize the standard input or stdin. - -Note that `cless` will behave as less when provided more than one file: you have to navigate files with -the commands `:n` for next and `:p` for previous. The downside is that less options are not supported. -But you can circumvent this by either using the LESS environment variable, or by running `ccat file1 file2|less --opts`. -In the latter form, the file contents will be concatenated and presented by less as a single file. - -## Requirements - -You have to install Pygments first: [pygments.org](http://pygments.org/download/) +* `cless [less-options] [files]`: colorize the contents of the file (or files, if more than one are provided) and open less. + If no files are passed it will colorize the standard input. + The LESSOPEN and LESSCLOSE will be overwritten for this to work, but only in a local scope. diff --git a/zsh/plugins/colorize/colorize.plugin.zsh b/zsh/plugins/colorize/colorize.plugin.zsh index 565ba5a..8ea98f8 100644 --- a/zsh/plugins/colorize/colorize.plugin.zsh +++ b/zsh/plugins/colorize/colorize.plugin.zsh @@ -1,57 +1,114 @@ -# easier alias to use the plugin -alias ccat='colorize_via_pygmentize' -alias cless='colorize_via_pygmentize_less' +# Easier alias to use the plugin +alias ccat="colorize_cat" +alias cless="colorize_less" -colorize_via_pygmentize() { - if ! (( $+commands[pygmentize] )); then - echo "package 'Pygments' is not installed!" +# '$0:A' gets the absolute path of this file +ZSH_COLORIZE_PLUGIN_PATH=$0:A + +colorize_check_requirements() { + local -a available_tools + available_tools=("chroma" "pygmentize") + + if [ -z "$ZSH_COLORIZE_TOOL" ]; then + if (( $+commands[pygmentize] )); then + ZSH_COLORIZE_TOOL="pygmentize" + elif (( $+commands[chroma] )); then + ZSH_COLORIZE_TOOL="chroma" + else + echo "Neither 'pygments' nor 'chroma' is installed!" >&2 + return 1 + fi + fi + + if [[ ${available_tools[(Ie)$ZSH_COLORIZE_TOOL]} -eq 0 ]]; then + echo "ZSH_COLORIZE_TOOL '$ZSH_COLORIZE_TOOL' not recognized. Available options are 'pygmentize' and 'chroma'." >&2 + return 1 + elif (( $+commands["$ZSH_COLORIZE_TOOL"] )); then + echo "Package '$ZSH_COLORIZE_TOOL' is not installed!" >&2 + return 1 + fi +} + +colorize_cat() { + if ! colorize_check_requirements; then return 1 fi - # If the environment varianle ZSH_COLORIZE_STYLE + # If the environment variable ZSH_COLORIZE_STYLE # is set, use that theme instead. Otherwise, # use the default. - if [ -z $ZSH_COLORIZE_STYLE ]; then - ZSH_COLORIZE_STYLE="default" + if [ -z "$ZSH_COLORIZE_STYLE" ]; then + # Both pygmentize & chroma support 'emacs' + ZSH_COLORIZE_STYLE="emacs" fi - # pygmentize stdin if no arguments passed + # Use stdin if no arguments have been passed. if [ $# -eq 0 ]; then - pygmentize -O style="$ZSH_COLORIZE_STYLE" -g + if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then + pygmentize -O style="$ZSH_COLORIZE_STYLE" -g + else + chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}" + fi return $? fi - # guess lexer from file extension, or - # guess it from file contents if unsuccessful - + # Guess lexer from file extension, or guess it from file contents if unsuccessful. local FNAME lexer - for FNAME in "$@" - do - lexer=$(pygmentize -N "$FNAME") - if [[ $lexer != text ]]; then - pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME" + for FNAME in "$@"; do + if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then + lexer=$(pygmentize -N "$FNAME") + if [[ $lexer != text ]]; then + pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME" + else + pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME" + fi else - pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME" + chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}" "$FNAME" fi done } -colorize_via_pygmentize_less() ( - # this function is a subshell so tmp_files can be shared to cleanup function - declare -a tmp_files +# The less option 'F - Forward forever; like "tail -f".' will not work in this implementation +# caused by the lack of the ability to follow the file within pygmentize. +colorize_less() { + if ! colorize_check_requirements; then + return 1 + fi - cleanup () { - [[ ${#tmp_files} -gt 0 ]] && rm -f "${tmp_files[@]}" - exit + _cless() { + # LESS="-R $LESS" enables raw ANSI colors, while maintain already set options. + local LESS="-R $LESS" + + # This variable tells less to pipe every file through the specified command + # (see the man page of less INPUT PREPROCESSOR). + # 'zsh -ic "colorize_cat %s 2> /dev/null"' would not work for huge files like + # the ~/.zsh_history. For such files the tty of the preprocessor will be supended. + # Therefore we must source this file to make colorize_cat available in the + # preprocessor without the interactive mode. + # `2>/dev/null` will suppress the error for large files 'broken pipe' of the python + # script pygmentize, which will show up if less has not fully "loaded the file" + # (e.g. when not scrolled to the bottom) while already the next file will be displayed. + local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \ + ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \ + colorize_cat %s 2> /dev/null'" + + # LESSCLOSE will be set to prevent any errors by executing a user script + # which assumes that his LESSOPEN has been executed. + local LESSCLOSE="" + + LESS="$LESS" LESSOPEN="$LESSOPEN" LESSCLOSE="$LESSCLOSE" command less "$@" } - trap 'cleanup' EXIT HUP TERM INT - while (( $# != 0 )); do #TODO: filter out less opts - tmp_file="$(mktemp -t "tmp.colorize.XXXX.$(sed 's/\//./g' <<< "$1")")" - tmp_files+=("$tmp_file") - colorize_via_pygmentize "$1" > "$tmp_file" - shift 1 - done - - less -f "${tmp_files[@]}" -) + if [ -t 0 ]; then + _cless "$@" + else + # The input is not associated with a terminal, therefore colorize_cat will + # colorize this input and pass it to less. + # Less has now to decide what to use. If any files have been provided, less + # will ignore the input by default, otherwise the colorized input will be used. + # If files have been supplied and the input has been redirected, this will + # lead to unnecessary overhead, but retains the ability to use the less options + # without checking for them inside this script. + colorize_cat | _cless "$@" + fi +} diff --git a/zsh/plugins/command-not-found/README.md b/zsh/plugins/command-not-found/README.md index 1cf4ba6..f267f0c 100644 --- a/zsh/plugins/command-not-found/README.md +++ b/zsh/plugins/command-not-found/README.md @@ -28,5 +28,6 @@ It works out of the box with the command-not-found packages for: - [macOS (Homebrew)](https://github.com/Homebrew/homebrew-command-not-found) - [Fedora](https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound) - [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found) +- [Termux](https://github.com/termux/command-not-found) You can add support for other platforms by submitting a Pull Request. diff --git a/zsh/plugins/command-not-found/command-not-found.plugin.zsh b/zsh/plugins/command-not-found/command-not-found.plugin.zsh index dd1186e..3ec1342 100644 --- a/zsh/plugins/command-not-found/command-not-found.plugin.zsh +++ b/zsh/plugins/command-not-found/command-not-found.plugin.zsh @@ -1,40 +1,62 @@ -# Uses the command-not-found package zsh support -# as seen in https://www.porcheron.info/command-not-found-for-zsh/ -# this is installed in Ubuntu +## Platforms with a built-in command-not-found handler init file -[[ -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)"; +for file ( + # Arch Linux. Must have pkgfile installed: https://wiki.archlinux.org/index.php/Pkgfile#Command_not_found + /usr/share/doc/pkgfile/command-not-found.zsh + # macOS (M1 and classic Homebrew): https://github.com/Homebrew/homebrew-command-not-found + /opt/homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh + /usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh +); do + if [[ -r "$file" ]]; then + source "$file" + unset file + return 0 fi +done +unset file + + +## Platforms with manual command_not_found_handler() setup + +# Debian and derivatives: https://launchpad.net/ubuntu/+source/command-not-found +if [[ -x /usr/lib/command-not-found || -x /usr/share/command-not-found/command-not-found ]]; then + command_not_found_handler() { + if [[ -x /usr/lib/command-not-found ]]; then + /usr/lib/command-not-found -- "$1" + return $? + elif [[ -x /usr/share/command-not-found/command-not-found ]]; then + /usr/share/command-not-found/command-not-found -- "$1" + return $? + else + printf "zsh: command not found: %s\n" "$1" >&2 + return 127 + fi + } fi -# NixOS command-not-found support -if [ -x /run/current-system/sw/bin/command-not-found ]; then - command_not_found_handler () { - /run/current-system/sw/bin/command-not-found $@ - } +# Fedora: https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound +if [[ -x /usr/libexec/pk-command-not-found ]]; then + command_not_found_handler() { + if [[ -S /var/run/dbus/system_bus_socket && -x /usr/libexec/packagekitd ]]; then + /usr/libexec/pk-command-not-found "$@" + return $? + fi + + printf "zsh: command not found: %s\n" "$1" >&2 + return 127 + } +fi + +# NixOS: https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found +if [[ -x /run/current-system/sw/bin/command-not-found ]]; then + command_not_found_handler() { + /run/current-system/sw/bin/command-not-found -- "$@" + } +fi + +# Termux: https://github.com/termux/command-not-found +if [[ -x /data/data/com.termux/files/usr/libexec/termux/command-not-found ]]; then + command_not_found_handler() { + /data/data/com.termux/files/usr/libexec/termux/command-not-found -- "$1" + } fi diff --git a/zsh/plugins/common-aliases/README.md b/zsh/plugins/common-aliases/README.md index d198a29..b6f34cb 100644 --- a/zsh/plugins/common-aliases/README.md +++ b/zsh/plugins/common-aliases/README.md @@ -40,11 +40,13 @@ plugins=(... common-aliases) | Alias | Command | Description | |-------|-----------------------------------------------------|-----------------------------------------| -| fd | `find . -type d -name` | Find a directory with the given name | +| fd\* | `find . -type d -name` | Find a directory with the given name | | ff | `find . -type f -name` | Find a file with the given name | | grep | `grep --color` | Searches for a query string | | sgrep | `grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS}` | Useful for searching within files | +\* Only if the [`fd`](https://github.com/sharkdp/fd) command isn't installed. + ### Other Aliases | Alias | Command | Description | diff --git a/zsh/plugins/common-aliases/common-aliases.plugin.zsh b/zsh/plugins/common-aliases/common-aliases.plugin.zsh index 785a09c..4e5ff84 100644 --- a/zsh/plugins/common-aliases/common-aliases.plugin.zsh +++ b/zsh/plugins/common-aliases/common-aliases.plugin.zsh @@ -13,7 +13,7 @@ alias lS='ls -1FSsh' alias lart='ls -1Fcart' alias lrt='ls -1Fcrt' -alias zshrc='${=EDITOR} ~/.zshrc' # Quick access to the ~/.zshrc file +alias zshrc='${=EDITOR} ${ZDOTDIR:-$HOME}/.zshrc' # Quick access to the .zshrc file alias grep='grep --color' alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} ' @@ -34,7 +34,7 @@ alias -g P="2>&1| pygmentize -l pytb" alias dud='du -d 1 -h' alias duf='du -sh *' -alias fd='find . -type d -name' +(( $+commands[fd] )) || alias fd='find . -type d -name' alias ff='find . -type f -name' alias h='history' @@ -50,19 +50,20 @@ alias mv='mv -i' # zsh is able to auto-do some kungfoo # depends on the SUFFIX :) +autoload -Uz is-at-least 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 + 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 + 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 + 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) diff --git a/zsh/plugins/compleat/README.md b/zsh/plugins/compleat/README.md new file mode 100644 index 0000000..af0e383 --- /dev/null +++ b/zsh/plugins/compleat/README.md @@ -0,0 +1,9 @@ +# compleat plugin + +This plugin looks for [compleat](https://github.com/mbrubeck/compleat) and loads its completion. + +To use it, add compleat to the plugins array in your zshrc file: + +```zsh +plugins=(... compleat) +``` diff --git a/zsh/plugins/composer/README.md b/zsh/plugins/composer/README.md index 2b4bae5..7a5f725 100644 --- a/zsh/plugins/composer/README.md +++ b/zsh/plugins/composer/README.md @@ -12,18 +12,20 @@ plugins=(... composer) ## Aliases -| Alias | Command | Description | -| ------ | -------------------------------------------- | -------------------------------------------------------------------------------------- | -| `c` | composer | Starts composer | -| `csu` | composer self-update | Updates composer to the latest version | -| `cu` | composer update | Updates composer dependencies and `composer.lock` file | -| `cr` | composer require | Adds new packages to `composer.json` | -| `crm` | composer remove | Removes packages from `composer.json` | -| `ci` | composer install | Resolves and installs dependencies from `composer.json` | -| `ccp` | composer create-project | Create new project from an existing package | -| `cdu` | composer dump-autoload | Updates the autoloader | -| `cdo` | composer dump-autoload --optimize-autoloader | Converts PSR-0/4 autoloading to classmap for a faster autoloader (good for production) | -| `cgu` | composer global update | Allows update command to run on COMPOSER_HOME directory | -| `cgr` | composer global require | Allows require command to run on COMPOSER_HOME directory | -| `cgrm` | composer global remove | Allows remove command to run on COMPOSER_HOME directory | -| `cget` | `curl -s https://getcomposer.org/installer` | Installs composer in the current directory | +| Alias | Command | Description | +| ------ | ------------------------------------------- | --------------------------------------------------------------------------------------- | +| `c` | `composer` | Starts composer | +| `csu` | `composer self-update` | Updates composer to the latest version | +| `cu` | `composer update` | Updates composer dependencies and `composer.lock` file | +| `cr` | `composer require` | Adds new packages to `composer.json` | +| `crm` | `composer remove` | Removes packages from `composer.json` | +| `ci` | `composer install` | Resolves and installs dependencies from `composer.json` | +| `ccp` | `composer create-project` | Create new project from an existing package | +| `cdu` | `composer dump-autoload` | Updates the autoloader | +| `cdo` | `composer dump-autoload -o` | Converts PSR-0/4 autoloading to classmap for a faster autoloader (good for production) | +| `cgu` | `composer global update` | Allows update command to run on COMPOSER_HOME directory | +| `cgr` | `composer global require` | Allows require command to run on COMPOSER_HOME directory | +| `cgrm` | `composer global remove` | Allows remove command to run on COMPOSER_HOME directory | +| `cget` | `curl -s https://getcomposer.org/installer` | Installs composer in the current directory | +| `co` | `composer outdated` | Shows a list of installed packages with available updates | +| `cod` | `composer outdated --direct` | Shows a list of installed packages with available updates which are direct dependencies | diff --git a/zsh/plugins/composer/composer.plugin.zsh b/zsh/plugins/composer/composer.plugin.zsh index 6349610..218a13e 100644 --- a/zsh/plugins/composer/composer.plugin.zsh +++ b/zsh/plugins/composer/composer.plugin.zsh @@ -15,20 +15,16 @@ _composer_get_required_list () { } _composer () { - local curcontext="$curcontext" state line - typeset -A opt_args - _arguments \ - '1: :->command'\ - '*: :->args' + local curcontext="$curcontext" state line + typeset -A opt_args + _arguments \ + '*:: :->subcmds' - case $state in - command) - compadd $(_composer_get_command_list) - ;; - *) - compadd $(_composer_get_required_list) - ;; - esac + if (( CURRENT == 1 )) || ( ((CURRENT == 2)) && [ "$words[1]" = "global" ] ) ; then + compadd $(_composer_get_command_list) + else + compadd $(_composer_get_required_list) + fi } compdef _composer composer @@ -43,17 +39,31 @@ 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 cdo='composer dump-autoload -o' alias cgu='composer global update' alias cgr='composer global require' alias cgrm='composer global remove' +alias co='composer outdated' +alias cod='composer outdated --direct' # install composer in the current directory alias cget='curl -s https://getcomposer.org/installer | php' # Add Composer's global binaries to PATH, using Composer if available. if (( $+commands[composer] )); then - export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null) + autoload -Uz _store_cache _retrieve_cache _cache_invalid + + _retrieve_cache composer + + if [[ -z $__composer_bin_dir ]]; then + __composer_bin_dir=$(composer global config bin-dir --absolute 2>/dev/null) + _store_cache composer __composer_bin_dir + fi + + # Add Composer's global binaries to PATH + export PATH="$PATH:$__composer_bin_dir" + + unset __composer_bin_dir else [ -d $HOME/.composer/vendor/bin ] && export PATH=$PATH:$HOME/.composer/vendor/bin [ -d $HOME/.config/composer/vendor/bin ] && export PATH=$PATH:$HOME/.config/composer/vendor/bin diff --git a/zsh/plugins/copybuffer/copybuffer.plugin.zsh b/zsh/plugins/copybuffer/copybuffer.plugin.zsh index cc205d4..483ed5a 100644 --- a/zsh/plugins/copybuffer/copybuffer.plugin.zsh +++ b/zsh/plugins/copybuffer/copybuffer.plugin.zsh @@ -1,9 +1,9 @@ # copy the active line from the command line buffer -# onto the system clipboard (requires clipcopy plugin) +# onto the system clipboard copybuffer () { if which clipcopy &>/dev/null; then - echo $BUFFER | clipcopy + printf "%s" "$BUFFER" | clipcopy else echo "clipcopy function not found. Please make sure you have Oh My Zsh installed correctly." fi diff --git a/zsh/plugins/copyfile/README.md b/zsh/plugins/copyfile/README.md index 53138ad..a110b83 100644 --- a/zsh/plugins/copyfile/README.md +++ b/zsh/plugins/copyfile/README.md @@ -3,7 +3,8 @@ Puts the contents of a file in your system clipboard so you can paste it anywhere. To use, add `copyfile` to your plugins array: -``` + +```zsh plugins=(... copyfile) ``` diff --git a/zsh/plugins/cpanm/README.md b/zsh/plugins/cpanm/README.md index 3803e3e..13e93d0 100644 --- a/zsh/plugins/cpanm/README.md +++ b/zsh/plugins/cpanm/README.md @@ -1,9 +1,9 @@ # Cpanm This plugin provides completion for [Cpanm](https://github.com/miyagawa/cpanminus) ([docs](https://metacpan.org/pod/App::cpanminus)). - + To use it add cpanm to the plugins array in your zshrc file. - - ```bash + +```zsh plugins=(... cpanm) ``` diff --git a/zsh/plugins/dash/README.md b/zsh/plugins/dash/README.md new file mode 100644 index 0000000..0ca3e4e --- /dev/null +++ b/zsh/plugins/dash/README.md @@ -0,0 +1,28 @@ +# Dash plugin + +This plugin adds command line functionality for [Dash](https://kapeli.com/dash), +an API Documentation Browser for macOS. This plugin requires Dash to be installed +to work. + +To use it, add `dash` to the plugins array in your zshrc file: + +```zsh +plugins=(... dash) +``` + +## Usage + +- Open and switch to the dash application. +``` +dash +``` + +- Query for something in dash app: `dash query` +``` +dash golang +``` + +- You can optionally provide a keyword: `dash [keyword:]query` +``` +dash python:tuple +``` diff --git a/zsh/plugins/dash/dash.plugin.zsh b/zsh/plugins/dash/dash.plugin.zsh index b00d487..ace2e33 100644 --- a/zsh/plugins/dash/dash.plugin.zsh +++ b/zsh/plugins/dash/dash.plugin.zsh @@ -35,36 +35,30 @@ _dash() { if [[ "$locator" == "platform" ]]; then # Since these are the only special cases right now, let's not do the # expensive processing unless we have to - if [[ "$keyword" == "python" || "$keyword" == "java" || \ - "$keyword" == "qt" || "$keyword" == "cocs2d" ]]; then + if [[ "$keyword" = (python|java|qt|cocos2d) ]]; then docsetName=`echo $doc | grep -Eo "docsetName = .*?;" | sed -e "s/docsetName = \(.*\);/\1/" -e "s/[\":]//g"` - if [[ "$keyword" == "python" ]]; then - if [[ "$docsetName" == "Python 2" ]]; then - keyword="python2" - elif [[ "$docsetName" == "Python 3" ]]; then - keyword="python3" - fi - elif [[ "$keyword" == "java" ]]; then - if [[ "$docsetName" == "Java SE7" ]]; then - keyword="java7" - elif [[ "$docsetName" == "Java SE6" ]]; then - keyword="java6" - elif [[ "$docsetName" == "Java SE8" ]]; then - keyword="java8" - fi - elif [[ "$keyword" == "qt" ]]; then - if [[ "$docsetName" == "Qt 5" ]]; then - keyword="qt5" - elif [[ "$docsetName" == "Qt 4" ]]; then - keyword="qt4" - elif [[ "$docsetName" == "Qt" ]]; then - keyword="qt4" - fi - elif [[ "$keyword" == "cocos2d" ]]; then - if [[ "$docsetName" == "Cocos3D" ]]; then - keyword="cocos3d" - fi - fi + case "$keyword" in + python) + case "$docsetName" in + "Python 2") keyword="python2" ;; + "Python 3") keyword="python3" ;; + esac ;; + java) + case "$docsetName" in + "Java SE7") keyword="java7" ;; + "Java SE6") keyword="java6" ;; + "Java SE8") keyword="java8" ;; + esac ;; + qt) + case "$docsetName" in + "Qt 5") keyword="qt5" ;; + "Qt 4"|Qt) keyword="qt4" ;; + esac ;; + cocos2d) + case "$docsetName" in + Cocos3D) keyword="cocos3d" ;; + esac ;; + esac fi fi diff --git a/zsh/plugins/debian/debian.plugin.zsh b/zsh/plugins/debian/debian.plugin.zsh index 68c6df1..1083967 100644 --- a/zsh/plugins/debian/debian.plugin.zsh +++ b/zsh/plugins/debian/debian.plugin.zsh @@ -66,7 +66,7 @@ if [[ $use_sudo -eq 1 ]]; then 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)))' + alias kclean='sudo aptitude remove -P "?and(~i~nlinux-(ima|hea) ?not(~n$(uname -r)))"' # commands using su ######### @@ -105,7 +105,7 @@ else 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' + alias kclean='su -lc "aptitude remove -P \"?and(~i~nlinux-(ima|hea) ?not(~n$(uname -r)))\"" root' fi # Completion ################################################################ diff --git a/zsh/plugins/deno/.gitignore b/zsh/plugins/deno/.gitignore new file mode 100644 index 0000000..cba5b03 --- /dev/null +++ b/zsh/plugins/deno/.gitignore @@ -0,0 +1 @@ +_deno diff --git a/zsh/plugins/deno/README.md b/zsh/plugins/deno/README.md new file mode 100644 index 0000000..828e6af --- /dev/null +++ b/zsh/plugins/deno/README.md @@ -0,0 +1,18 @@ +# Deno Plugin + +This plugin sets up completion and aliases for [Deno](https://deno.land). + +## Aliases + +| Alias | Full command | +| ----- | ---------------- | +| db | deno bundle | +| dc | deno compile | +| dca | deno cache | +| dfmt | deno fmt | +| dh | deno help | +| dli | deno lint | +| drn | deno run | +| drw | deno run --watch | +| dts | deno test | +| dup | deno upgrade | diff --git a/zsh/plugins/deno/deno.plugin.zsh b/zsh/plugins/deno/deno.plugin.zsh new file mode 100644 index 0000000..a37b3be --- /dev/null +++ b/zsh/plugins/deno/deno.plugin.zsh @@ -0,0 +1,23 @@ +# ALIASES +alias db='deno bundle' +alias dc='deno compile' +alias dca='deno cache' +alias dfmt='deno fmt' +alias dh='deno help' +alias dli='deno lint' +alias drn='deno run' +alias drw='deno run --watch' +alias dts='deno test' +alias dup='deno upgrade' + +# COMPLETION FUNCTION +if (( $+commands[deno] )); then + if [[ ! -f $ZSH_CACHE_DIR/deno_version ]] \ + || [[ "$(deno --version)" != "$(< "$ZSH_CACHE_DIR/deno_version")" ]] \ + || [[ ! -f $ZSH/plugins/deno/_deno ]]; then + deno completions zsh > $ZSH/plugins/deno/_deno + deno --version > $ZSH_CACHE_DIR/deno_version + fi + autoload -Uz _deno + _comps[deno]=_deno +fi diff --git a/zsh/plugins/dircycle/README.md b/zsh/plugins/dircycle/README.md index 3ac162f..3c9b3a9 100644 --- a/zsh/plugins/dircycle/README.md +++ b/zsh/plugins/dircycle/README.md @@ -15,10 +15,10 @@ This plugin enables directory navigation similar to using back and forward on br ) ``` -2. Reload the source file or restart your Terminal session: +2. Restart the shell or restart your Terminal session: ```console - $ source ~/.zshrc + $ exec zsh $ ``` diff --git a/zsh/plugins/direnv/README.md b/zsh/plugins/direnv/README.md new file mode 100644 index 0000000..8deaf38 --- /dev/null +++ b/zsh/plugins/direnv/README.md @@ -0,0 +1,15 @@ +# direnv plugin + +This plugin creates the [Direnv](https://direnv.net/) hook. + +To use it, add `direnv` to the plugins array in your zshrc file: + +```zsh +plugins=(... direnv) +``` + +## Requirements + +In order to make this work, you will need to have the direnv installed. + +More info on the usage and install: https://github.com/direnv/direnv diff --git a/zsh/plugins/direnv/direnv.plugin.zsh b/zsh/plugins/direnv/direnv.plugin.zsh new file mode 100644 index 0000000..5e32c4c --- /dev/null +++ b/zsh/plugins/direnv/direnv.plugin.zsh @@ -0,0 +1,16 @@ +# Don't continue if direnv is not found +command -v direnv &>/dev/null || return + +_direnv_hook() { + trap -- '' SIGINT; + eval "$(direnv export zsh)"; + trap - SIGINT; +} +typeset -ag precmd_functions; +if [[ -z ${precmd_functions[(r)_direnv_hook]} ]]; then + precmd_functions=( _direnv_hook ${precmd_functions[@]} ) +fi +typeset -ag chpwd_functions; +if [[ -z ${chpwd_functions[(r)_direnv_hook]} ]]; then + chpwd_functions=( _direnv_hook ${chpwd_functions[@]} ) +fi diff --git a/zsh/plugins/dirhistory/README.md b/zsh/plugins/dirhistory/README.md index 511f2be..2236507 100644 --- a/zsh/plugins/dirhistory/README.md +++ b/zsh/plugins/dirhistory/README.md @@ -7,6 +7,7 @@ To use it, add `dirhistory` to the plugins array in your zshrc file: ```zsh plugins=(... dirhistory) ``` + ## Keyboard Shortcuts | Shortcut | Description | @@ -15,3 +16,24 @@ plugins=(... dirhistory) | alt + right | Undo alt + left | | alt + up | Move into the parent directory | | alt + down | Move into the first child directory by alphabetical order | + +## Usage + +This plugin allows you to navigate the history of previous current-working-directories 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. MAC users may alternately use OPT-LEFT and OPT-RIGHT. + +Also, navigate directory **hierarchy** using ALT-UP and ALT-DOWN. (mac keybindings not yet implemented). ALT-UP moves to higher hierarchy (shortcut for 'cd ..'). ALT-DOWN moves into the first directory found in alphabetical order (useful to navigate long empty directories e.g. java packages) + +For example, if the shell was started, and the following commands were entered: + +```shell +cd ~ +cd /usr +cd share +cd doc +``` + +Then entering ALT-LEFT at the prompt would change directory from /usr/share/doc to /usr/share, then if pressed again to /usr/, then ~. If ALT-RIGHT were pressed the directory would be changed to /usr/ again. + +After that, ALT-DOWN will probably go to /usr/bin (depends on your /usr structure), ALT-UP will return to /usr, then ALT-UP will get you to / + +**Currently the max history size is 30**. The navigation should work for xterm, PuTTY xterm mode, GNU screen, and on MAC with alternate keys as mentioned above. diff --git a/zsh/plugins/dirhistory/dirhistory.plugin.zsh b/zsh/plugins/dirhistory/dirhistory.plugin.zsh index 239915e..cbac846 100644 --- a/zsh/plugins/dirhistory/dirhistory.plugin.zsh +++ b/zsh/plugins/dirhistory/dirhistory.plugin.zsh @@ -2,7 +2,7 @@ # 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. # -# Navigate directory hierarchy using ALT-UP and ALT-DOWN. (mac keybindings not yet implemented) +# Navigate directory hierarchy using ALT-UP and ALT-DOWN. # ALT-UP moves to higher hierarchy (cd ..) # ALT-DOWN moves into the first directory found in alphabetical order # @@ -53,7 +53,8 @@ function push_future() { } # Called by zsh when directory changes -chpwd_functions+=(chpwd_dirhistory) +autoload -U add-zsh-hook +add-zsh-hook chpwd chpwd_dirhistory function chpwd_dirhistory() { push_past $PWD # If DIRHISTORY_CD is not set... @@ -107,26 +108,30 @@ function dirhistory_forward() { # Bind keys to history navigation function dirhistory_zle_dirhistory_back() { # Erase current line in buffer - zle kill-buffer - dirhistory_back - zle accept-line + zle .kill-buffer + dirhistory_back + zle .accept-line } function dirhistory_zle_dirhistory_future() { # Erase current line in buffer - zle kill-buffer + zle .kill-buffer dirhistory_forward - zle accept-line + 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) +# Terminal.app if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then bindkey "^[b" dirhistory_zle_dirhistory_back fi +# iTerm2 +if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + bindkey "^[^[[D" dirhistory_zle_dirhistory_back +fi # Putty: bindkey "\e\e[D" dirhistory_zle_dirhistory_back # GNU screen: @@ -135,9 +140,14 @@ 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 +# Terminal.app if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then bindkey "^[f" dirhistory_zle_dirhistory_future fi +# iTerm2 +if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + bindkey "^[^[[C" dirhistory_zle_dirhistory_future +fi bindkey "\e\e[C" dirhistory_zle_dirhistory_future bindkey "\eO3C" dirhistory_zle_dirhistory_future @@ -159,23 +169,24 @@ function dirhistory_down() { # Bind keys to hierarchy navigation function dirhistory_zle_dirhistory_up() { - zle kill-buffer # Erase current line in buffer + zle .kill-buffer # Erase current line in buffer dirhistory_up - zle accept-line + zle .accept-line } function dirhistory_zle_dirhistory_down() { - zle kill-buffer # Erase current line in buffer + zle .kill-buffer # Erase current line in buffer dirhistory_down - zle accept-line + zle .accept-line } zle -N dirhistory_zle_dirhistory_up # xterm in normal mode bindkey "\e[3A" dirhistory_zle_dirhistory_up bindkey "\e[1;3A" dirhistory_zle_dirhistory_up -# Mac teminal (alt+up) - #bindkey "^[?" dirhistory_zle_dirhistory_up #dont know it +if [[ "$TERM_PROGRAM" == "Apple_Terminal" || "$TERM_PROGRAM" == "iTerm.app" ]]; then + bindkey "^[[A" dirhistory_zle_dirhistory_up +fi # Putty: bindkey "\e\e[A" dirhistory_zle_dirhistory_up # GNU screen: @@ -184,7 +195,8 @@ bindkey "\eO3A" dirhistory_zle_dirhistory_up zle -N dirhistory_zle_dirhistory_down bindkey "\e[3B" dirhistory_zle_dirhistory_down bindkey "\e[1;3B" dirhistory_zle_dirhistory_down -# Mac teminal (alt+down) - #bindkey "^[?" dirhistory_zle_dirhistory_down #dont know it +if [[ "$TERM_PROGRAM" == "Apple_Terminal" || "$TERM_PROGRAM" == "iTerm.app" ]]; then + bindkey "^[[B" dirhistory_zle_dirhistory_down +fi bindkey "\e\e[B" dirhistory_zle_dirhistory_down bindkey "\eO3B" dirhistory_zle_dirhistory_down diff --git a/zsh/plugins/dirpersist/README.md b/zsh/plugins/dirpersist/README.md index 9880bc5..792fb4b 100644 --- a/zsh/plugins/dirpersist/README.md +++ b/zsh/plugins/dirpersist/README.md @@ -1,6 +1,7 @@ # Dirpersist plugin -This plugin keeps a running tally of the previous 20 unique directories in the $HOME/.zdirs file. When you cd to a new directory, it is prepended to the beginning of the file. +This plugin keeps a running tally of the previous 20 unique directories in the `$HOME/.zdirs` file. +When you cd to a new directory, it is prepended to the beginning of the file. To use it, add `dirpersist` to the plugins array in your zshrc file: diff --git a/zsh/plugins/dirpersist/dirpersist.plugin.zsh b/zsh/plugins/dirpersist/dirpersist.plugin.zsh index 616e2c3..daadc38 100644 --- a/zsh/plugins/dirpersist/dirpersist.plugin.zsh +++ b/zsh/plugins/dirpersist/dirpersist.plugin.zsh @@ -11,7 +11,8 @@ if [[ -f ${dirstack_file} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then [[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD fi -chpwd_functions+=(chpwd_dirpersist) +autoload -U add-zsh-hook +add-zsh-hook chpwd chpwd_dirpersist chpwd_dirpersist() { if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi local -ax my_stack diff --git a/zsh/plugins/django/README.md b/zsh/plugins/django/README.md index 415f6b7..1740e55 100644 --- a/zsh/plugins/django/README.md +++ b/zsh/plugins/django/README.md @@ -34,23 +34,3 @@ runfcgi -- run this project as a fastcgi runserver -- start a lightweight web server for development ... ``` - -If you want to see the options available for a specific command, try: - -```zsh -$> python manage.py makemessages (press here) -``` - -And that would result in: - -```zsh ---all -a -- re-examine all code and templates ---domain -d -- domain of the message files (default: "django") ---extensions -e -- file extension(s) to examine (default: ".html") ---help -- display help information ---locale -l -- locale to process (default: all) ---pythonpath -- directory to add to the Python path ---settings -- python path to settings module -... -``` - diff --git a/zsh/plugins/django/django.plugin.zsh b/zsh/plugins/django/django.plugin.zsh index 86558ff..c2d00c1 100644 --- a/zsh/plugins/django/django.plugin.zsh +++ b/zsh/plugins/django/django.plugin.zsh @@ -374,7 +374,8 @@ _managepy-commands() { _applist() { local line local -a apps - _call_program help-command "python -c \"import os.path as op, re, django.conf, sys;\\ + _call_program help-command "python -c \"import sys; del sys.path[0];\\ + import os.path as op, re, django.conf;\\ 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.\\ diff --git a/zsh/plugins/dnf/README.md b/zsh/plugins/dnf/README.md index f9ef496..dc0d1e0 100644 --- a/zsh/plugins/dnf/README.md +++ b/zsh/plugins/dnf/README.md @@ -1,10 +1,14 @@ -## Description +# dnf plugin -This plugin makes `dnf` usage easier by adding aliases for the most -common commands. +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`. +`dnf` is the new package manager for RPM-based distributions, which replaces `yum`. + +To use it, add `dnf` to the plugins array in your zshrc file: + +```zsh +plugins=(... dnf) +``` ## Aliases diff --git a/zsh/plugins/docker-compose/README.md b/zsh/plugins/docker-compose/README.md index 07a87bc..13f3c2c 100644 --- a/zsh/plugins/docker-compose/README.md +++ b/zsh/plugins/docker-compose/README.md @@ -4,26 +4,29 @@ This plugin provides completion for [docker-compose](https://docs.docker.com/com aliases for frequent docker-compose commands. To use it, add docker-compose to the plugins array of your zshrc file: -``` + +```zsh plugins=(... docker-compose) ``` ## Aliases -| Alias | Command | Description | -|-----------|--------------------------|------------------------------------------------------------------| -| dco | `docker-compose` | Docker-compose main command | -| dcb | `docker-compose build` | Build containers | -| dce | `docker-compose exec` | Execute command inside a container | -| dcps | `docker-compose ps` | List containers | -| dcrestart | `docker-compose restart` | Restart container | -| dcrm | `docker-compose rm` | Remove container | -| dcr | `docker-compose run` | Run a command in container | -| dcstop | `docker-compose stop` | Stop a container | -| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service | -| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon | -| dcdn | `docker-compose down` | Stop and remove containers | -| dcl | `docker-compose logs` | Show logs of container | -| dclf | `docker-compose logs -f` | Show logs and follow output | -| dcpull | `docker-compose pull` | Pull image of a service | -| dcstart | `docker-compose start` | Start a container | +| Alias | Command | Description | +|-----------|--------------------------------|------------------------------------------------------------------| +| dco | `docker-compose` | Docker-compose main command | +| dcb | `docker-compose build` | Build containers | +| dce | `docker-compose exec` | Execute command inside a container | +| dcps | `docker-compose ps` | List containers | +| dcrestart | `docker-compose restart` | Restart container | +| dcrm | `docker-compose rm` | Remove container | +| dcr | `docker-compose run` | Run a command in container | +| dcstop | `docker-compose stop` | Stop a container | +| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service | +| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers | +| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon | +| dcdn | `docker-compose down` | Stop and remove containers | +| dcl | `docker-compose logs` | Show logs of container | +| dclf | `docker-compose logs -f` | Show logs and follow output | +| dcpull | `docker-compose pull` | Pull image of a service | +| dcstart | `docker-compose start` | Start a container | +| dck | `docker-compose kill` | Kills containers | diff --git a/zsh/plugins/docker-compose/docker-compose.plugin.zsh b/zsh/plugins/docker-compose/docker-compose.plugin.zsh index 9ffe1ed..85e03d3 100644 --- a/zsh/plugins/docker-compose/docker-compose.plugin.zsh +++ b/zsh/plugins/docker-compose/docker-compose.plugin.zsh @@ -18,9 +18,11 @@ alias dcrm='docker-compose rm' alias dcr='docker-compose run' alias dcstop='docker-compose stop' alias dcup='docker-compose up' +alias dcupb='docker-compose up --build' alias dcupd='docker-compose up -d' 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' +alias dck='docker-compose kill' diff --git a/zsh/plugins/docker/README.md b/zsh/plugins/docker/README.md index e917984..fab7aa8 100644 --- a/zsh/plugins/docker/README.md +++ b/zsh/plugins/docker/README.md @@ -1,5 +1,34 @@ -## Docker autocomplete plugin +# Docker plugin -A copy of the completion script from the -[docker/cli](https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker) -git repo. +This plugin adds auto-completion for [docker](https://www.docker.com/). + +To use it add `docker` to the plugins array in your zshrc file. + +```zsh +plugins=(... docker) +``` + +A copy of the completion script from the docker/cli git repo: +https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker + +## Settings + +By default, the completion doesn't allow option-stacking, meaning if you try to +complete `docker run -it ` it won't work, because you're _stacking_ the +`-i` and `-t` options. + +[You can enable it](https://github.com/docker/cli/commit/b10fb43048) by **adding +the lines below to your zshrc file**, but be aware of the side effects: + +> This enables Zsh to understand commands like `docker run -it +> ubuntu`. However, by enabling this, this also makes Zsh complete +> `docker run -u` with `docker run -uapprox` which is not valid. The +> users have to put the space or the equal sign themselves before trying +> to complete. +> +> Therefore, this behavior is disabled by default. To enable it: +> +> ``` +> zstyle ':completion:*:*:docker:*' option-stacking yes +> zstyle ':completion:*:*:docker-*:*' option-stacking yes +> ``` diff --git a/zsh/plugins/docker/_docker b/zsh/plugins/docker/_docker index 54b5e59..7fe2043 100644 --- a/zsh/plugins/docker/_docker +++ b/zsh/plugins/docker/_docker @@ -9,6 +9,7 @@ # - Felix Riedel # - Steve Durrheimer # - Vincent Bernat +# - Rohan Verma # # license: # @@ -604,6 +605,7 @@ __docker_container_subcommand() { "($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)--cgroupns=[Cgroup namespace mode to use]:cgroup namespace mode: " "($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: " @@ -622,7 +624,8 @@ __docker_container_subcommand() { "($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)*--gpus=[GPU devices to add to the container ('all' to pass all GPUs)]:device: " + "($help)*--group-add=[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]" @@ -676,6 +679,7 @@ __docker_container_subcommand() { "($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)--pids-limit[Tune container pids limit (set -1 for unlimited)]" "($help)--restart=[Restart policy]:restart policy:(no on-failure always unless-stopped)" ) opts_help=("(: -)--help[Print usage]") @@ -747,6 +751,7 @@ __docker_container_subcommand() { $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)*--env-file=[Read environment variables from a file]:environment file:_files" \ "($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]" \ @@ -788,7 +793,7 @@ __docker_container_subcommand() { "($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 -n --tail)"{-n=,--tail=}"[Number of lines to show from the end of the logs]:lines:(1 10 20 50 all)" \ "($help -)*:containers:__docker_complete_containers" && ret=0 ;; (ls|list) @@ -801,7 +806,7 @@ __docker_container_subcommand() { "($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 -q --quiet)"{-q,--quiet}"[Only show container IDs]" \ "($help -s --size)"{-s,--size}"[Display total file sizes]" \ "($help)--since=[Show only containers created since...]:containers:__docker_complete_containers" && ret=0 ;; @@ -832,7 +837,7 @@ __docker_container_subcommand() { _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 + "($help -)*:containers:__docker_complete_containers" && ret=0 ;; (rm) local state @@ -1015,6 +1020,7 @@ __docker_image_subcommand() { "($help)*--shm-size=[Size of '/dev/shm' (format is '')]: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)--target=[Set the target build stage to build.]" \ "($help)*--ulimit=[ulimit options]:ulimit: " \ "($help)--userns=[Container user namespace]:user namespace:(host)" \ "($help -):path or URL:_directories" && ret=0 @@ -1024,7 +1030,7 @@ __docker_image_subcommand() { $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 -q --quiet)"{-q,--quiet}"[Only show image IDs]" \ "($help -)*: :__docker_complete_images" && ret=0 ;; (import) @@ -1056,7 +1062,7 @@ __docker_image_subcommand() { "($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 -q --quiet)"{-q,--quiet}"[Only show image IDs]" \ "($help -): :__docker_complete_repositories" && ret=0 ;; (prune) @@ -1076,6 +1082,7 @@ __docker_image_subcommand() { (push) _arguments $(__docker_arguments) \ $opts_help \ + "($help -a --all-tags)"{-a,--all-tags}"[Push all tagged images in the repository]" \ "($help)--disable-content-trust[Skip image signing]" \ "($help -): :__docker_complete_images" && ret=0 ;; @@ -1286,7 +1293,7 @@ __docker_network_subcommand() { "($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 + "($help -q --quiet)"{-q,--quiet}"[Only display network IDs]" && ret=0 ;; (prune) _arguments $(__docker_arguments) \ @@ -1954,6 +1961,8 @@ __docker_service_subcommand() { opts_help=("(: -)--help[Print usage]") opts_create_update=( + "($help)*--cap-add=[Add Linux capabilities]:capability: " + "($help)*--cap-drop=[Drop Linux capabilities]:capability: " "($help)*--constraint=[Placement constraints]:constraint: " "($help)--endpoint-mode=[Placement constraints]:mode:(dnsrr vip)" "($help)*"{-e=,--env=}"[Set environment variables]:env: " @@ -1966,6 +1975,7 @@ __docker_service_subcommand() { "($help)*--label=[Service labels]:label: " "($help)--limit-cpu=[Limit CPUs]:value: " "($help)--limit-memory=[Limit Memory]:value: " + "($help)--limit-pids[Limit maximum number of processes (default 0 = unlimited)]" "($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: " @@ -2008,6 +2018,7 @@ __docker_service_subcommand() { "($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)*--group=[Set one or more supplementary user groups for the container]:group: _groups " \ "($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" \ @@ -2031,7 +2042,7 @@ __docker_service_subcommand() { "($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 -n --tail)"{-n=,--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 ;; @@ -2214,7 +2225,6 @@ __docker_stack_subcommand() { (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, or '-' to read from stdin]:compose file:_files -g \"*.(yml|yaml)\"" \ "($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \ "($help -):stack:__docker_complete_stacks" && ret=0 @@ -2636,6 +2646,8 @@ __docker_subcommand() { "($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)--containerd-namespace=[Containerd namespace to use]:containerd namespace:" \ + "($help)--containerd-plugins-namespace=[Containerd namespace to use for plugins]:containerd namespace:" \ "($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: " \ @@ -2668,6 +2680,7 @@ __docker_subcommand() { "($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)--max-download-attempts[Set the max download attempts for each pull]" \ "($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" \ @@ -2783,7 +2796,7 @@ __docker_subcommand() { $opts_help \ "($help -p --password)"{-p=,--password=}"[Password]:password: " \ "($help)--password-stdin[Read password from stdin]" \ - "($help -u --user)"{-u=,--user=}"[Username]:username: " \ + "($help -u --username)"{-u=,--username=}"[Username]:username: " \ "($help -)1:server: " && ret=0 ;; (logout) diff --git a/zsh/plugins/dotenv/README.md b/zsh/plugins/dotenv/README.md index cac5524..ab9d329 100644 --- a/zsh/plugins/dotenv/README.md +++ b/zsh/plugins/dotenv/README.md @@ -4,9 +4,7 @@ Automatically load your project ENV variables from `.env` file when you `cd` int Storing configuration in the environment is one of the tenets of a [twelve-factor app](https://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`: +To use it, add `dotenv` to the plugins array in your zshrc file: ```sh plugins=(... dotenv) @@ -17,32 +15,69 @@ plugins=(... dotenv) Create `.env` file inside your project root directory and put your 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 ``` + You can even mix both formats, although it's probably a bad idea. +## Settings + ### ZSH_DOTENV_FILE You can also modify the name of the file to be loaded with the variable `ZSH_DOTENV_FILE`. If the variable isn't set, the plugin will default to use `.env`. For example, this will make the plugin look for files named `.dotenv` and load them: -``` +```zsh # in ~/.zshrc, before Oh My Zsh is sourced: ZSH_DOTENV_FILE=.dotenv ``` +### ZSH_DOTENV_PROMPT + +Set `ZSH_DOTENV_PROMPT=false` in your zshrc file if you don't want the confirmation message. +You can also choose the `Always` option when prompted to always allow sourcing the .env file +in that directory. See the next section for more details. + +### ZSH_DOTENV_ALLOWED_LIST, ZSH_DOTENV_DISALLOWED_LIST + +The default behavior of the plugin is to always ask whether to source a dotenv file. There's +a **Y**es, **N**o, **A**lways and N**e**ver option. If you choose Always, the directory of the .env file +will be added to an allowed list; if you choose Never, it will be added to a disallowed list. +If a directory is found in either of those lists, the plugin won't ask for confirmation and will +instead either source the .env file or proceed without action respectively. + +The allowed and disallowed lists are saved by default in `$ZSH_CACHE_DIR/dotenv-allowed.list` and +`$ZSH_CACHE_DIR/dotenv-disallowed.list` respectively. If you want to change that location, +change the `$ZSH_DOTENV_ALLOWED_LIST` and `$ZSH_DOTENV_DISALLOWED_LIST` variables, like so: + +```zsh +# in ~/.zshrc, before Oh My Zsh is sourced: +ZSH_DOTENV_ALLOWED_LIST=/path/to/dotenv/allowed/list +ZSH_DOTENV_DISALLOWED_LIST=/path/to/dotenv/disallowed/list +``` + +The file is just a list of directories, separated by a newline character. If you want +to change your decision, just edit the file and remove the line for the directory you want to +change. + +NOTE: if a directory is found in both the allowed and disallowed lists, the disallowed list +takes preference, _i.e._ the .env file will never be sourced. + ## Version Control **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's supposed to be local only. @@ -52,5 +87,6 @@ ZSH_DOTENV_FILE=.dotenv This plugin only sources the `.env` file. Nothing less, nothing more. It doesn't do any checks. It's designed to be the fastest and simplest option. You're responsible for the `.env` file content. You can put some code (or weird symbols) there, but do it on your own risk. `dotenv` is the basic tool, yet it does the job. If you need more advanced and feature-rich ENV management, check out these awesome projects: + * [direnv](https://github.com/direnv/direnv) * [zsh-autoenv](https://github.com/Tarrasch/zsh-autoenv) diff --git a/zsh/plugins/dotenv/dotenv.plugin.zsh b/zsh/plugins/dotenv/dotenv.plugin.zsh index 89763d0..24f285d 100644 --- a/zsh/plugins/dotenv/dotenv.plugin.zsh +++ b/zsh/plugins/dotenv/dotenv.plugin.zsh @@ -1,23 +1,54 @@ +## Settings + +# Filename of the dotenv file to look for +: ${ZSH_DOTENV_FILE:=.env} + +# Path to the file containing allowed paths +: ${ZSH_DOTENV_ALLOWED_LIST:="${ZSH_CACHE_DIR:-$ZSH/cache}/dotenv-allowed.list"} +: ${ZSH_DOTENV_DISALLOWED_LIST:="${ZSH_CACHE_DIR:-$ZSH/cache}/dotenv-disallowed.list"} + + +## Functions + source_env() { if [[ -f $ZSH_DOTENV_FILE ]]; then + if [[ "$ZSH_DOTENV_PROMPT" != false ]]; then + local confirmation dirpath="${PWD:A}" + + # make sure there is an (dis-)allowed file + touch "$ZSH_DOTENV_ALLOWED_LIST" + touch "$ZSH_DOTENV_DISALLOWED_LIST" + + # early return if disallowed + if grep -q "$dirpath" "$ZSH_DOTENV_DISALLOWED_LIST" &>/dev/null; then + return; + fi + + # check if current directory's .env file is allowed or ask for confirmation + if ! grep -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then + # print same-line prompt and output newline character if necessary + echo -n "dotenv: found '$ZSH_DOTENV_FILE' file. Source it? ([Y]es/[n]o/[a]lways/n[e]ver) " + read -k 1 confirmation; [[ "$confirmation" != $'\n' ]] && echo + + # check input + case "$confirmation" in + [nN]) return ;; + [aA]) echo "$dirpath" >> "$ZSH_DOTENV_ALLOWED_LIST" ;; + [eE]) echo "$dirpath" >> "$ZSH_DOTENV_DISALLOWED_LIST"; return ;; + *) ;; # interpret anything else as a yes + esac + fi + fi + # test .env syntax zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2 - if [[ -o a ]]; then - source $ZSH_DOTENV_FILE - else - set -a - source $ZSH_DOTENV_FILE - set +a - fi + setopt localoptions allexport + source $ZSH_DOTENV_FILE fi } autoload -U add-zsh-hook add-zsh-hook chpwd source_env -if [[ -z $ZSH_DOTENV_FILE ]]; then - ZSH_DOTENV_FILE=.env -fi - source_env diff --git a/zsh/plugins/dotnet/README.md b/zsh/plugins/dotnet/README.md new file mode 100644 index 0000000..7554b4e --- /dev/null +++ b/zsh/plugins/dotnet/README.md @@ -0,0 +1,23 @@ +# .NET Core CLI plugin + +This plugin provides completion and useful aliases for [.NET Core CLI](https://dotnet.microsoft.com/). + +To use it, add `dotnet` to the plugins array in your zshrc file. + +``` +plugins=(... dotnet) +``` + +## Aliases + +| Alias | Command | Description | +|-------|------------------|-------------------------------------------------------------------| +| dn | dotnet new | Create a new .NET project or file. | +| dr | dotnet run | Build and run a .NET project output. | +| dt | dotnet test | Run unit tests using the test runner specified in a .NET project. | +| dw | dotnet watch | Watch for source file changes and restart the dotnet command. | +| dwr | dotnet watch run | Watch for source file changes and restart the `run` command. | +| ds | dotnet sln | Modify Visual Studio solution files. | +| da | dotnet add | Add a package or reference to a .NET project. | +| dp | dotnet pack | Create a NuGet package. | +| dng | dotnet nuget | Provides additional NuGet commands. | diff --git a/zsh/plugins/dotnet/dotnet.plugin.zsh b/zsh/plugins/dotnet/dotnet.plugin.zsh new file mode 100644 index 0000000..6bd4b7a --- /dev/null +++ b/zsh/plugins/dotnet/dotnet.plugin.zsh @@ -0,0 +1,32 @@ +# This scripts is copied from (MIT License): +# https://github.com/dotnet/toolset/blob/master/scripts/register-completions.zsh + +_dotnet_zsh_complete() +{ + local completions=("$(dotnet complete "$words")") + + # If the completion list is empty, just continue with filename selection + if [ -z "$completions" ] + then + _arguments '*::arguments: _normal' + return + fi + + # This is not a variable assigment, don't remove spaces! + _values = "${(ps:\n:)completions}" +} + +compdef _dotnet_zsh_complete dotnet + +# Aliases bellow are here for backwards compatibility +# added by Shaun Tabone (https://github.com/xontab) + +alias dn='dotnet new' +alias dr='dotnet run' +alias dt='dotnet test' +alias dw='dotnet watch' +alias dwr='dotnet watch run' +alias ds='dotnet sln' +alias da='dotnet add' +alias dp='dotnet pack' +alias dng='dotnet nuget' diff --git a/zsh/plugins/eecms/README.md b/zsh/plugins/eecms/README.md new file mode 100644 index 0000000..c538355 --- /dev/null +++ b/zsh/plugins/eecms/README.md @@ -0,0 +1,11 @@ +# eecms plugin + +This plugin adds auto-completion of console commands for [`eecms`](https://github.com/ExpressionEngine/ExpressionEngine). + +To use it, add `eecms` to the plugins array of your `.zshrc` file: +``` +plugins=(... eecms) +``` + +It also adds the alias `eecms` which finds the eecms file in the current project +and runs it with php. diff --git a/zsh/plugins/emacs/emacs.plugin.zsh b/zsh/plugins/emacs/emacs.plugin.zsh index db0ab13..0b602d1 100644 --- a/zsh/plugins/emacs/emacs.plugin.zsh +++ b/zsh/plugins/emacs/emacs.plugin.zsh @@ -26,6 +26,16 @@ if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then # create a new X frame alias eframe='emacsclient --alternate-editor "" --create-frame' + # Emacs ANSI Term tracking + if [[ -n "$INSIDE_EMACS" ]]; then + chpwd_emacs() { print -P "\033AnSiTc %d"; } + print -P "\033AnSiTc %d" # Track current working directory + print -P "\033AnSiTu %n" # Track username + + # add chpwd hook + autoload -Uz add-zsh-hook + add-zsh-hook chpwd chpwd_emacs + fi # Write to standard output the path to the file # opened in the current buffer. diff --git a/zsh/plugins/emacs/emacsclient.sh b/zsh/plugins/emacs/emacsclient.sh index 26b28d4..04a2c2a 100755 --- a/zsh/plugins/emacs/emacsclient.sh +++ b/zsh/plugins/emacs/emacsclient.sh @@ -20,7 +20,8 @@ _emacsfun() # 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)" + tempfile="$(mktemp --tmpdir emacs-stdin-$USERNAME.XXXXXXX 2>/dev/null \ + || mktemp -t emacs-stdin-$USERNAME)" # support BSD mktemp cat - > "$tempfile" _emacsfun --no-wait $tempfile else diff --git a/zsh/plugins/emoji-clock/emoji-clock.plugin.zsh b/zsh/plugins/emoji-clock/emoji-clock.plugin.zsh index 0a55528..bdd606f 100644 --- a/zsh/plugins/emoji-clock/emoji-clock.plugin.zsh +++ b/zsh/plugins/emoji-clock/emoji-clock.plugin.zsh @@ -2,7 +2,7 @@ # 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 +# https://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html # AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net) # VERSION: 1.0.0 # ----------------------------------------------------------------------------- diff --git a/zsh/plugins/emotty/README.md b/zsh/plugins/emotty/README.md new file mode 100644 index 0000000..ee57170 --- /dev/null +++ b/zsh/plugins/emotty/README.md @@ -0,0 +1,39 @@ +# emotty plugin + +This plugin returns an emoji for the current $TTY number so it can be used +in a prompt. + +To use it, add emotty to the plugins array in your zshrc file: +``` +plugins=(... emotty) +``` + +**NOTE:** it requires the [emoji plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/emoji). + +## Usage + +The function `emotty` displays an emoji from the current character set (default: `emoji`), based +on the number associated to the `$TTY`. + +There are different sets of emoji characters available, to choose a different +set, set `$emotty_set` to the name of the set you would like to use, e.g.: +``` +emotty_set=nature +``` + +### Character Sets + +- emoji +- loral +- love +- nature +- stellar +- zodiac + +Use the `display_emotty` function to list the emojis in the current character set, or +the character set passed as the first argument. For example: + +``` +$ display_emotty zodiac + +``` diff --git a/zsh/plugins/emotty/emotty.plugin.zsh b/zsh/plugins/emotty/emotty.plugin.zsh index e288b5c..4511275 100644 --- a/zsh/plugins/emotty/emotty.plugin.zsh +++ b/zsh/plugins/emotty/emotty.plugin.zsh @@ -29,7 +29,7 @@ function emotty() { # Parse tty number via prompt expansion. %l equals: # - N if tty = /dev/ttyN # - pts/N if tty = /dev/pts/N - local tty = ${${(%):-%l}##pts/} + local tty=${${(%):-%l}##pts/} # Normalize it to an emotty set index (( tty = (tty % ${#${=emotty}}) + 1 )) diff --git a/zsh/plugins/encode64/README.md b/zsh/plugins/encode64/README.md index 9850da8..86320cf 100644 --- a/zsh/plugins/encode64/README.md +++ b/zsh/plugins/encode64/README.md @@ -1,6 +1,12 @@ # encode64 -Alias plugin for encoding or decoding using `base64` command +Alias plugin for encoding or decoding using `base64` command. + +To use it, add `encode64` to the plugins array in your zshrc file: + +```zsh +plugins=(... encode64) +``` ## Functions and Aliases @@ -9,23 +15,6 @@ Alias plugin for encoding or decoding using `base64` command | `encode64` | `e64` | Encodes given data to base64 | | `decode64` | `d64` | Decodes given data from base64 | -## Enabling plugin - -1. Edit your `.zshrc` file and add `encode64` to the list of plugins: - - ```sh - plugins=( - # ...other enabled plugins - encode64 - ) - ``` - -2. Restart your terminal session or reload configuration by running: - - ```sh - source ~/.zshrc - ``` - ## Usage and examples ### Encoding @@ -64,6 +53,6 @@ Alias plugin for encoding or decoding using `base64` command ```console $ echo "b2gtbXktenNoCg==" | decode64 oh-my-zsh - $ echo "b2gtbXktenNoCg==" | decode64 + $ echo "b2gtbXktenNoCg==" | d64 oh-my-zsh ``` diff --git a/zsh/plugins/extract/README.md b/zsh/plugins/extract/README.md index 83b878c..f2e6ad1 100644 --- a/zsh/plugins/extract/README.md +++ b/zsh/plugins/extract/README.md @@ -22,26 +22,37 @@ plugins=(... extract) | `aar` | Android library file | | `bz2` | Bzip2 file | | `deb` | Debian package | +| `ear` | Enterprise Application aRchive | | `gz` | Gzip file | +| `ipa` | iOS app package | | `ipsw` | iOS firmware file | | `jar` | Java Archive | +| `lrz` | LRZ archive | +| `lz4` | LZ4 archive | | `lzma` | LZMA archive | | `rar` | WinRAR archive | +| `rpm` | RPM package | | `sublime-package` | Sublime Text package | | `tar` | Tarball | | `tar.bz2` | Tarball with bzip2 compression | | `tar.gz` | Tarball with gzip compression | +| `tar.lrz` | Tarball with lrzip compression | +| `tar.lz` | Tarball with lzip compression | +| `tar.lz4` | Tarball with lz4 compression | | `tar.xz` | Tarball with lzma2 compression | | `tar.zma` | Tarball with lzma compression | +| `tar.zst` | Tarball with zstd 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 | +| `tzst` | Tarball with zstd compression | | `war` | Web Application archive (Java-based) | | `xpi` | Mozilla XPI module file | | `xz` | LZMA2 archive | | `zip` | Zip archive | +| `zst` | Zstandard file (zstd) | See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for more information regarding archive formats. diff --git a/zsh/plugins/extract/_extract b/zsh/plugins/extract/_extract index 33d49fc..267c4d4 100644 --- a/zsh/plugins/extract/_extract +++ b/zsh/plugins/extract/_extract @@ -3,5 +3,5 @@ _arguments \ '(-r --remove)'{-r,--remove}'[Remove archive.]' \ - "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lzma|rar|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|whl|xpi|xz|zip)(-.)'" \ + "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \ && return 0 diff --git a/zsh/plugins/extract/extract.plugin.zsh b/zsh/plugins/extract/extract.plugin.zsh index 5e9b9ff..e390e2d 100644 --- a/zsh/plugins/extract/extract.plugin.zsh +++ b/zsh/plugins/extract/extract.plugin.zsh @@ -40,14 +40,24 @@ extract() { tar --lzma --help &> /dev/null \ && tar --lzma -xvf "$1" \ || lzcat "$1" | tar xvf - ;; + (*.tar.zst|*.tzst) + tar --zstd --help &> /dev/null \ + && tar --zstd -xvf "$1" \ + || zstdcat "$1" | tar xvf - ;; (*.tar) tar xvf "$1" ;; - (*.gz) (( $+commands[pigz] )) && pigz -d "$1" || gunzip "$1" ;; + (*.tar.lz) (( $+commands[lzip] )) && tar xvf "$1" ;; + (*.tar.lz4) lz4 -c -d "$1" | tar xvf - ;; + (*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$1" ;; + (*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;; (*.bz2) bunzip2 "$1" ;; (*.xz) unxz "$1" ;; + (*.lrz) (( $+commands[lrunzip] )) && lrunzip "$1" ;; + (*.lz4) lz4 -d "$1" ;; (*.lzma) unlzma "$1" ;; (*.z) uncompress "$1" ;; - (*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;; + (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;; (*.rar) unrar x -ad "$1" ;; + (*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;; (*.7z) 7za x "$1" ;; (*.deb) mkdir -p "$extract_dir/control" @@ -58,6 +68,7 @@ extract() { cd ..; rm *.tar.* debian-binary cd .. ;; + (*.zst) unzstd "$1" ;; (*) echo "extract: '$1' cannot be extracted" >&2 success=1 diff --git a/zsh/plugins/fabric/README.md b/zsh/plugins/fabric/README.md index cf0fa81..f121d2e 100644 --- a/zsh/plugins/fabric/README.md +++ b/zsh/plugins/fabric/README.md @@ -4,6 +4,6 @@ This plugin provides completion for [Fabric](https://www.fabfile.org/). To use it add fabric to the plugins array in your zshrc file. -```bash +```zsh plugins=(... fabric) ``` diff --git a/zsh/plugins/fabric/_fab b/zsh/plugins/fabric/_fab index 4c2e613..9102dad 100644 --- a/zsh/plugins/fabric/_fab +++ b/zsh/plugins/fabric/_fab @@ -4,10 +4,19 @@ local curcontext=$curcontext state line declare -A opt_args -declare target_list -target_list=(`fab --shortlist 2>/dev/null || fab --complete 2>/dev/null`) +declare -a target_list +target_list=("${(@f)$(fab -l 2>/dev/null | awk '{ + if (NF == 0 || NR == 1) next + if (NF < 2) print $1 + else { + docstring=substr($0, index($0,$2)) + gsub(":", "\\:", docstring) + print $1":"docstring + } +}')}") -_targets() { +_fab_targets() { + [[ -n "$target_list" ]] || return _describe -t commands "fabric targets" target_list } @@ -28,7 +37,7 @@ _arguments -w -S -C \ '(-)--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+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_fab_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]: :' \ @@ -53,7 +62,7 @@ if [[ CURRENT -ge 1 ]]; then levels) _describe -t commands "output levels" output_levels;; *) - _targets;; + _fab_targets;; esac return diff --git a/zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh b/zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh index 8ab2979..82b9688 100644 --- a/zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh +++ b/zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh @@ -1,10 +1,10 @@ fancy-ctrl-z () { if [[ $#BUFFER -eq 0 ]]; then BUFFER="fg" - zle accept-line + zle accept-line -w else - zle push-input - zle clear-screen + zle push-input -w + zle clear-screen -w fi } zle -N fancy-ctrl-z diff --git a/zsh/plugins/fasd/README.md b/zsh/plugins/fasd/README.md new file mode 100644 index 0000000..a5c74e5 --- /dev/null +++ b/zsh/plugins/fasd/README.md @@ -0,0 +1,21 @@ +# fasd + +[`Fasd`](https://github.com/clvv/fasd) (pronounced similar to "fast") is a command-line productivity booster. Fasd offers quick access to files and directories for POSIX shells. + +To use it, add `fasd` to the plugins array in your zshrc file: + +```zsh +plugins=(... fasd) +``` + +## Installation + +Please find detailed installation guide [`here`](https://github.com/clvv/fasd#install) + +## Aliases + +| Alias | Command | Description | +|-------|-------------------------------------------|-------------------------------------------------------------| +| v | `fasd -f -e "$EDITOR"` | List frequent/recent files matching the given filename. | +| o | `fasd -a -e xdg-open` | List frequent/recent files and directories matching. | +| j | `fasd_cd -d -i` | cd with interactive selection | diff --git a/zsh/plugins/fasd/fasd.plugin.zsh b/zsh/plugins/fasd/fasd.plugin.zsh index ec2e518..6538d09 100644 --- a/zsh/plugins/fasd/fasd.plugin.zsh +++ b/zsh/plugins/fasd/fasd.plugin.zsh @@ -1,12 +1,16 @@ -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 xdg-open' - alias j='zz' +# check if fasd is installed +if (( ! ${+commands[fasd]} )); then + return fi + +fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache" +if [[ "$commands[fasd]" -nt "$fasd_cache" || ! -s "$fasd_cache" ]]; then + fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install \ + zsh-wcomp zsh-wcomp-install >| "$fasd_cache" +fi +source "$fasd_cache" +unset fasd_cache + +alias v='f -e "$EDITOR"' +alias o='a -e xdg-open' +alias j='zz' diff --git a/zsh/plugins/fastfile/README.md b/zsh/plugins/fastfile/README.md new file mode 100644 index 0000000..37f5b2f --- /dev/null +++ b/zsh/plugins/fastfile/README.md @@ -0,0 +1,84 @@ +# Fastfile plugin + +This plugin adds a way to reference certain files or folders used frequently using +a global alias or shortcut. + +To use it, add `fastfile` to the plugins array in your zshrc file: +```zsh +plugins=(... fastfile) +``` + +## Usage + +Example: you access folder `/code/project/backend/database` very frequently. + +First, generate a shortcut with the name `pjdb`: +```zsh +$ fastfile pjdb /code/project/backend/database +``` + +Next time you want to access it, use `§pjdb`. For example: +```zsh +$ cd §pjdb +$ subl §pjdb +``` +where § is the fastfile prefix (see [below](#options) for how to change). + +**Note:** shortcuts with spaces in the name are assigned a global alias +where the spaces have been substituted with underscores (`_`). For example: +a shortcut named `"hello world"` corresponds with `§hello_world`. + + +## Functions + +- `fastfile `: generate a shortcut. + +- `fastfile_print `: prints a shortcut, with the format + ` -> `. + +- `fastfile_ls`: lists all shortcuts. + +- `fastfile_rm `: remove a shortcut. + +- `fastfile_sync`: generates the global aliases for the shortcuts. + + +### Internal functions + +- `fastfile_resolv `: resolves the location of the shortcut + file, i.e., the file in the fastfile directory where the shortcut path + is stored. + +- `fastfile_get `: get the real path of the shortcut. + + +## Aliases + +| Alias | Function | +|--------|------------------| +| ff | `fastfile` | +| ffp | `fastfile_print` | +| ffrm | `fastfile_rm` | +| ffls | `fastfile_ls` | +| ffsync | `fastfile_sync` | + + +## Options + +These are options you can set to change certain parts of the plugin. To change +them, add `=` to your zshrc file, before Oh My Zsh is sourced. +For example: `fastfile_var_prefix='@'`. + +- `fastfile_var_prefix`: prefix for the global aliases created. Controls the prefix of the + created global aliases. + **Default:** `§` (section sign), easy to type in a german keyboard via the combination + [`⇧ Shift`+`3`](https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg), + or using `⌥ Option`+`6` in macOS. + +- `fastfile_dir`: directory where the fastfile shortcuts are stored. Needs to end + with a trailing slash. + **Default:** `$HOME/.fastfile/`. + +## Author + +- [Karolin Varner](https://github.com/koraa) diff --git a/zsh/plugins/fastfile/fastfile.plugin.zsh b/zsh/plugins/fastfile/fastfile.plugin.zsh index 775e948..ccbbce3 100644 --- a/zsh/plugins/fastfile/fastfile.plugin.zsh +++ b/zsh/plugins/fastfile/fastfile.plugin.zsh @@ -1,21 +1,11 @@ -################################################################################ -# 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 +# 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_dir "${HOME}/.fastfile" default fastfile_var_prefix "§" ########################### @@ -33,7 +23,7 @@ default fastfile_var_prefix "§" function fastfile() { test "$2" || 2="." file=$(readlink -f "$2") - + test "$1" || 1="$(basename "$file")" name=$(echo "$1" | tr " " "_") @@ -51,7 +41,7 @@ function fastfile() { # Arguments: # 1. name - The name of the shortcut # STDOUT: -# The path +# The path to the shortcut file # function fastfile_resolv() { echo "${fastfile_dir}${1}" @@ -88,12 +78,12 @@ function fastfile_print() { # (=> 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 " " "_"` + for f in "${fastfile_dir}"/*(NF); 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")" + # Special format for colums + echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")" done | column -t -s "|" } @@ -102,7 +92,6 @@ function fastfile_ls() { # # 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 # @@ -115,11 +104,11 @@ function fastfile_rm() { # 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 " " "_"` + for f in "${fastfile_dir}"/*(NF); 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")'" + alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'" done } @@ -133,6 +122,6 @@ alias ffls=fastfile_ls alias ffsync=fastfile_sync ################################## -# Init +# Init -fastfile_sync \ No newline at end of file +fastfile_sync diff --git a/zsh/plugins/fbterm/README.md b/zsh/plugins/fbterm/README.md new file mode 100644 index 0000000..70ce56d --- /dev/null +++ b/zsh/plugins/fbterm/README.md @@ -0,0 +1,10 @@ +# fbterm + +This plugin automatically starts [fbterm](https://github.com/zhangyuanwei/fbterm) +if on a real TTY (`/dev/tty*`). + +To use it, add `fbterm` to the plugins array of your zshrc file: + +```zsh +plugins=(... fbterm) +``` diff --git a/zsh/plugins/fedora/README.md b/zsh/plugins/fedora/README.md index 6594799..85d8d7d 100644 --- a/zsh/plugins/fedora/README.md +++ b/zsh/plugins/fedora/README.md @@ -1 +1 @@ -The fedora plugin is deprecated. Use the [dnf plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/dnf) instead. +The fedora plugin is deprecated. Use the [dnf plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dnf) instead. diff --git a/zsh/plugins/fedora/fedora.plugin.zsh b/zsh/plugins/fedora/fedora.plugin.zsh deleted file mode 120000 index 16a2143..0000000 --- a/zsh/plugins/fedora/fedora.plugin.zsh +++ /dev/null @@ -1 +0,0 @@ -../dnf/dnf.plugin.zsh \ No newline at end of file diff --git a/zsh/plugins/fedora/fedora.plugin.zsh b/zsh/plugins/fedora/fedora.plugin.zsh new file mode 100644 index 0000000..226506c --- /dev/null +++ b/zsh/plugins/fedora/fedora.plugin.zsh @@ -0,0 +1,3 @@ +print -P "%F{yellow}The 'fedora' plugin is deprecated. Use the '%Udnf%u' plugin instead.%f" + +source "$ZSH/plugins/dnf/dnf.plugin.zsh" diff --git a/zsh/plugins/firewalld/readme.md b/zsh/plugins/firewalld/README.md similarity index 100% rename from zsh/plugins/firewalld/readme.md rename to zsh/plugins/firewalld/README.md diff --git a/zsh/plugins/flutter/README.md b/zsh/plugins/flutter/README.md new file mode 100644 index 0000000..be41914 --- /dev/null +++ b/zsh/plugins/flutter/README.md @@ -0,0 +1,21 @@ +## Flutter plugin + +The Flutter plugin provides completion and useful aliases + +To use it, add flutter to the plugins array of your zshrc file: + +``` +plugins=(... flutter) +``` + +## Aliases + +| Alias | Command | Description | +| :--------- | :--------------------- | :------------------------------------------------------------------------- | +| `fl` | `flutter` | Shorthand for flutter command | +| `flr` | `flutter run` | Runs flutter app | +| `fldoc` | `flutter doctor` | Runs flutter doctor | +| `flb` | `flutter build` | Build flutter application | +| `flattach` | `flutter attach` | Attaches flutter to a running flutter application with enabled observatory | +| `flget` | `flutter packages get` | Installs dependencies | +| `flc` | `flutter clean` | Cleans flutter porject | diff --git a/zsh/plugins/flutter/_flutter b/zsh/plugins/flutter/_flutter new file mode 100644 index 0000000..ab6ce42 --- /dev/null +++ b/zsh/plugins/flutter/_flutter @@ -0,0 +1,37 @@ +#compdef flutter +#autoload + +local -a _1st_arguments +_1st_arguments=( + "analyze":"Analyze the project's Dart code." + "assemble":"Assemble and build flutter resources." + "attach":"Attach to a running application." + "build":"Flutter build commands." + "channel":"List or switch flutter channels." + "clean":"Delete the build/ and .dart_tool/ directories." + "config":"Configure Flutter settings." + "create":"Create a new Flutter project." + "devices":"List all connected devices." + "doctor":"Show information about the installed tooling." + "drive":"Runs Flutter Driver tests for the current project." + "emulators":"List, launch and create emulators." + "format":" Format one or more dart files." + "help":"Display help information for flutter." + "install":"Install a Flutter app on an attached device." + "logs":"Show log output for running Flutter apps." + "make-host-app-editable":"Moves host apps from generated directories to non-generated directories so that they can be edited by developers." + "precache":"Populates the Flutter tool's cache of binary artifacts." + "pub":"Commands for managing Flutter packages." + "run":"Run your Flutter app on an attached device." + "screenshot":"Take a screenshot from a connected device." + "test":"Run Flutter unit tests for the current project." + "upgrade":"Upgrade your copy of Flutter." + "version":"List or switch flutter versions." +) + +_arguments -C '*:: :->subcmds' + +if (( CURRENT == 1 )); then + _describe -t commands "flutter command" _1st_arguments + return +fi diff --git a/zsh/plugins/flutter/flutter.plugin.zsh b/zsh/plugins/flutter/flutter.plugin.zsh new file mode 100644 index 0000000..01c4c9f --- /dev/null +++ b/zsh/plugins/flutter/flutter.plugin.zsh @@ -0,0 +1,7 @@ +alias fl="flutter" +alias flr="flutter run" +alias fldoc="flutter doctor" +alias flb="flutter build" +alias flattach="flutter attach" +alias flget="flutter packages get" +alias flc="flutter clean" diff --git a/zsh/plugins/forklift/README.md b/zsh/plugins/forklift/README.md index 6c4ce1e..7dfd8bf 100644 --- a/zsh/plugins/forklift/README.md +++ b/zsh/plugins/forklift/README.md @@ -1,15 +1,23 @@ -## forklift +# forklift Plugin for ForkLift, an FTP application for OS X. -### Requirements +To use it, add `forklift` to the plugins array in your zshrc file: + +```zsh +plugins=(... forklift) +``` + +## Requirements * [ForkLift](https://binarynights.com/) -### Usage +## Usage -fl [*file_or_folder*] +`fl []` * 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. +* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift + +* If `fl` is called with a non-directory file as the argument, then the file's parent directory is opened. diff --git a/zsh/plugins/forklift/forklift.plugin.zsh b/zsh/plugins/forklift/forklift.plugin.zsh index 274c4a8..8588948 100644 --- a/zsh/plugins/forklift/forklift.plugin.zsh +++ b/zsh/plugins/forklift/forklift.plugin.zsh @@ -1,6 +1,7 @@ # Open folder in ForkLift.app or ForkLift2.app from console # Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de # Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving +# Updated to support ForkLift from Setapp by Paul Rudkin # # Usage: # fl [] @@ -24,6 +25,13 @@ function fl { fi osascript 2>&1 1>/dev/null < /dev/null + fi + + # Key bindings + if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then + source "${fzf_shell}/key-bindings.zsh" + fi +} + + +function setup_using_debian_package() { + if (( ! $+commands[dpkg] )) || ! dpkg -s fzf &>/dev/null; then + # Either not a debian based distro, or no fzf installed + return 1 + fi + + # NOTE: There is no need to configure PATH for debian package, all binaries + # are installed to /usr/bin by default + + local completions key_bindings + + case $PREFIX in + *com.termux*) + # Support Termux package + completions="${PREFIX}/share/fzf/completion.zsh" + key_bindings="${PREFIX}/share/fzf/key-bindings.zsh" + ;; + *) + # Determine completion file path: first bullseye/sid, then buster/stretch + completions="/usr/share/doc/fzf/examples/completion.zsh" + [[ -f "$completions" ]] || completions="/usr/share/zsh/vendor-completions/_fzf" + key_bindings="/usr/share/doc/fzf/examples/key-bindings.zsh" + ;; + esac + + # Auto-completion + if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then + source $completions 2> /dev/null + fi + + # Key bindings + if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then + source $key_bindings + fi + + return 0 +} + +function setup_using_opensuse_package() { + # OpenSUSE installs fzf in /usr/bin/fzf + # If the command is not found, the package isn't installed + (( $+commands[fzf] )) || return 1 + + # The fzf-zsh-completion package installs the auto-completion in + local completions="/usr/share/zsh/site-functions/_fzf" + # The fzf-zsh-completion package installs the key-bindings file in + local key_bindings="/etc/zsh_completion.d/fzf-key-bindings" + + # If these are not found: (1) maybe we're not on OpenSUSE, or + # (2) maybe the fzf-zsh-completion package isn't installed. + if [[ ! -f "$completions" || ! -f "$key_bindings" ]]; then + return 1 + fi + + # Auto-completion + if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then + source "$completions" 2>/dev/null + fi + + # Key bindings + if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then + source "$key_bindings" 2>/dev/null + fi + + return 0 +} + +function setup_using_openbsd_package() { + # openBSD installs fzf in /usr/local/bin/fzf + if [[ "$OSTYPE" != openbsd* ]] || (( ! $+commands[fzf] )); then + return 1 + fi + + # The fzf package installs the auto-completion in + local completions="/usr/local/share/zsh/site-functions/_fzf_completion" + # The fzf package installs the key-bindings file in + local key_bindings="/usr/local/share/zsh/site-functions/_fzf_key_bindings" + + # Auto-completion + if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then + source "$completions" 2>/dev/null + fi + + # Key bindings + if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then + source "$key_bindings" 2>/dev/null + fi + + return 0 +} + +function indicate_error() { + cat >&2 < /dev/null - fi - - # Key bindings - # ------------ - if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then - source "${fzf_shell}/key-bindings.zsh" - fi - -else - print "[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.\n"\ - "Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2 -fi - -unset fzf_base fzf_shell dir fzfdirs diff --git a/zsh/plugins/gas/README.md b/zsh/plugins/gas/README.md new file mode 100644 index 0000000..47b3fb9 --- /dev/null +++ b/zsh/plugins/gas/README.md @@ -0,0 +1,10 @@ +# Gas plugin + +This plugin adds autocompletion for the [gas](http://walle.github.com/gas) command, +a utility to manage Git authors. + +To use it, add `gas` to the plugins array of your zshrc file: + +```zsh +plugins=(... gas) +``` diff --git a/zsh/plugins/gcloud/README.md b/zsh/plugins/gcloud/README.md new file mode 100644 index 0000000..e7ce0e0 --- /dev/null +++ b/zsh/plugins/gcloud/README.md @@ -0,0 +1,24 @@ +# gcloud + +This plugin provides completion support for the +[Google Cloud SDK CLI](https://cloud.google.com/sdk/gcloud/). + +To use it, add `gcloud` to the plugins array in your zshrc file. + +```zsh +plugins=(... gcloud) +``` + +It relies on you having installed the SDK using one of the supported options +listed [here](https://cloud.google.com/sdk/install). + +## Plugin Options + +* Set `CLOUDSDK_HOME` in your `zshrc` file before you load oh-my-zsh if you have +your GCloud SDK installed in a non-standard location. The plugin will use this +as the base for your SDK if it finds it set already. + +* If you do not have a `python2` in your `PATH` you'll also need to set the +`CLOUDSDK_PYTHON` environment variable at the end of your `.zshrc`. This is +used by the SDK to call a compatible interpreter when you run one of the +SDK commands. diff --git a/zsh/plugins/gcloud/gcloud.plugin.zsh b/zsh/plugins/gcloud/gcloud.plugin.zsh new file mode 100644 index 0000000..c7aebe6 --- /dev/null +++ b/zsh/plugins/gcloud/gcloud.plugin.zsh @@ -0,0 +1,33 @@ +##################################################### +# gcloud plugin for oh-my-zsh # +# Author: Ian Chesal (github.com/ianchesal) # +##################################################### + +if [[ -z "${CLOUDSDK_HOME}" ]]; then + search_locations=( + "$HOME/google-cloud-sdk" + "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk" + "/usr/share/google-cloud-sdk" + "/snap/google-cloud-sdk/current" + "/usr/lib64/google-cloud-sdk/" + "/opt/google-cloud-sdk" + ) + + for gcloud_sdk_location in $search_locations; do + if [[ -d "${gcloud_sdk_location}" ]]; then + CLOUDSDK_HOME="${gcloud_sdk_location}" + break + fi + done +fi + +if (( ${+CLOUDSDK_HOME} )); then + if (( ! $+commands[gcloud] )); then + # Only source this if GCloud isn't already on the path + if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then + source "${CLOUDSDK_HOME}/path.zsh.inc" + fi + fi + source "${CLOUDSDK_HOME}/completion.zsh.inc" + export CLOUDSDK_HOME +fi diff --git a/zsh/plugins/geeknote/README.md b/zsh/plugins/geeknote/README.md index 3f23531..95b3aa7 100644 --- a/zsh/plugins/geeknote/README.md +++ b/zsh/plugins/geeknote/README.md @@ -1,12 +1,10 @@ -## ZSH-Geeknote +# Geeknote plugin -[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for oh-my-zsh. +This plugin provides autocompletion for [Geeknote](https://github.com/VitaliyRodnenko/geeknote) +and an alias for `geeknote` called `gn`. -Plugins provides: +To use it, add `geeknote` to the plugins array in your zshrc file: -- 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)) +```zsh +plugins=( ... geeknote ...) +``` diff --git a/zsh/plugins/geeknote/_geeknote b/zsh/plugins/geeknote/_geeknote index cf1a187..a34be59 100644 --- a/zsh/plugins/geeknote/_geeknote +++ b/zsh/plugins/geeknote/_geeknote @@ -1,136 +1,157 @@ #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. -# --------------- ------------------------------------------------------------ + +# Geeknote Autocomplete plugin for Zsh +# Requires: Geeknote installed +# Author : Ján Koščo (@s7anley) + +__login() { + # no arguments +} + +__logout() { + _arguments \ + '--force[Do not ask about logging out.]' +} + +__settings() { + _arguments \ + "--editor+[Set the editor, which use to edit and create notes.]::" +} + +__create() { + _arguments \ + '--title+[The note title.]::' \ + '--content+[The note content.]::' \ + '--tags+[One tag or the list of tags which will be added to the note.]::' \ + '--notebook+[Set the notebook where to save note.]::' \ + '--resource+[Add a resource to the note.]::' +} + +__edit() { + _arguments \ + '--note+[The name or ID from the previous search of a note to edit.]::' \ + '--title+[Set new title of the note.]::' \ + '--content+[Set new content of the note.]::' \ + '--tags+[Set new list o tags for the note.]::' \ + '--notebook+[Assign new notebook for the note.]::' \ + '--resource+[Add a resource to the note.]::' +} + +__find() { + _arguments \ + '--search+[Text to search.]::' \ + '--tags+[Notes with which tag/tags to search.]::' \ + '--notebook+[In which notebook search the note.]::' \ + '--date+[Set date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy.]::' \ + '--count+[How many notes show in the result list.]::' \ + '--with-url[Add direct url of each note in results to Evernote web-version.]' \ + '--content-search[Search by content, not by title.]' \ + '--exact-entry[Search for exact entry of the request.]' +} + +__show() { + _arguments \ + '--note+[The name or ID from the previous search of a note to show.]::' \ + '--raw[Show the raw note body.]' +} + +__remove() { + _arguments \ + '--note+[The name or ID from the previous search of a note to remove.]::' \ + '--force[Do not ask about removing.]' +} + +__notebook-list() { + # no arguments +} + +__notebook-create() { + _arguments \ + '--title+[Set the title of new notebook.]::' +} + +__notebook-edit() { + _arguments \ + '--title+[Set the title of new notebook.]::' \ + '--notebook+[The name of a notebook to rename.]::' +} + +__tag-list() { + # no arguments +} + +__tag-create() { + _arguments \ + '--title+[Set the title of new tag.]::' +} + +__tag-edit() { + _arguments \ + '--tagname+[The name of a tag to rename.]::' \ + '--title+[Set the new name of tag.]::' +} + +__user() { + _arguments \ + '--full[Show full information.]' +} 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' + 'login':'Authorize in Evernote.' + 'logout':'Logout from Evernote.' + 'settings':'Show and edit current settings.' + 'create':'Create note in Evernote.' + 'edit':'Edit note in Evernote.' + 'find':'Search notes in Evernote.' + 'show':'Output note in the terminal.' + 'remove':'Remove note from Evernote.' + 'notebook-list':'Show the list of existing notebooks in your Evernote.' + 'notebook-create':'Create new notebook.' + 'notebook-edit':'Edit/rename notebook.' + 'tag-list':'Show the list of existing tags in your Evernote.' + 'tag-create':'Create new tag.' + 'tag-edit':'Edit/rename tag.' + 'user':'Show information about active user.' ) _arguments '*:: :->command' if (( CURRENT == 1 )); then - _describe -t commands "geeknote command" _1st_arguments - return + _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 + login) + __login ;; + logout) + __logout ;; + settings) + __settings ;; + create) + __create ;; + edit) + __edit ;; + find) + __find ;; + show) + __show ;; + remove) + __remove ;; + notebook-list) + __notebook-list ;; + notebook-create) + __notebook-create ;; + notebook-edit) + __notebook-edit ;; + tag-list) + __tag-list ;; + tag-create) + __tag-create ;; + tag-edit) + __tag-edit ;; + user) + __user ;; +esac diff --git a/zsh/plugins/genpass/README.md b/zsh/plugins/genpass/README.md new file mode 100644 index 0000000..a5ff4a8 --- /dev/null +++ b/zsh/plugins/genpass/README.md @@ -0,0 +1,66 @@ +# genpass + +This plugin provides three unique password generators for ZSH. Each generator +has at least a 128-bit security margin and generates passwords from the +cryptographically secure `/dev/urandom`. Each generator can also take an +optional numeric argument to generate multiple passwords. + +To use it from an interactive ZSH, add `genpass` to the plugins array in your +zshrc file: + + plugins=(... genpass) + +You can also invoke password generators directly (they are implemented as +standalone executable files), which can be handy when you need to generate +passwords in a script: + + ~/.oh-my-zsh/plugins/genpass/genpass-apple 3 + +## genpass-apple + +Generates a pronounceable pseudoword passphrase of the "cvccvc" consonant/vowel +syntax, inspired by [Apple's iCloud Keychain password generator][1]. Each +password has exactly 1 digit placed at the edge of a "word" and exactly 1 +capital letter to satisfy most password security requirements. + + % genpass-apple + gelcyv-foqtam-fotqoh-viMleb-lexduv-6ixfuk + + % genpass-apple 3 + japvyz-qyjti4-kajrod-nubxaW-hukkan-dijcaf + vydpig-fucnul-3ukpog-voggom-zygNad-jepgad + zocmez-byznis-hegTaj-jecdyq-qiqmiq-5enwom + +[1]: https://developer.apple.com/password-rules/ + +## genpass-monkey + +Generates visually unambiguous random meaningless strings using [Crockford's +base32][2]. + + % genpass-monkey + xt7gn976e7jj3fstgpy27330x3 + + % genpass-monkey 3 + n1qqwtzgejwgqve9yzf2gxvx4m + r2n3f5s6vbqs2yx7xjnmahqewy + 296w9y9rts3p5r9yay0raek8e5 + +[2]: https://www.crockford.com/base32.html + +## genpass-xkcd + +Generates passphrases from `/usr/share/dict/words` inspired by the [famous (and +slightly misleading) XKCD comic][3]. Each passphrase is prepended with a digit +showing the number of words in the passphrase to adhere to password security +requirements that require digits. Each word is 6 characters or less. + + % genpass-xkcd + 9-eaten-Slav-rife-aired-hill-cordon-splits-welsh-napes + + % genpass-xkcd 3 + 9-worker-Vlad-horde-shrubs-smite-thwart-paw-alters-prawns + 9-tutors-stink-rhythm-junk-snappy-hooray-barbs-mewl-clomp + 9-vital-escape-Angkor-Huff-wet-Mayra-abbés-putts-guzzle + +[3]: https://xkcd.com/936/ diff --git a/zsh/plugins/genpass/genpass-apple b/zsh/plugins/genpass/genpass-apple new file mode 100755 index 0000000..963ab64 --- /dev/null +++ b/zsh/plugins/genpass/genpass-apple @@ -0,0 +1,79 @@ +#!/usr/bin/env zsh +# +# Usage: genpass-apple [NUM] +# +# Generate a password made of 6 pseudowords of 6 characters each +# with the security margin of at least 128 bits. +# +# Example password: xudmec-4ambyj-tavric-mumpub-mydVop-bypjyp +# +# If given a numerical argument, generate that many passwords. + +emulate -L zsh -o no_unset -o warn_create_global -o warn_nested_var + +if [[ ARGC -gt 1 || ${1-1} != ${~:-<1-$((16#7FFFFFFF))>} ]]; then + print -ru2 -- "usage: $0 [NUM]" + return 1 +fi + +zmodload zsh/system zsh/mathfunc || return + +{ + local -r vowels=aeiouy + local -r consonants=bcdfghjklmnpqrstvwxz + local -r digits=0123456789 + + # Sets REPLY to a uniformly distributed random number in [1, $1]. + # Requires: $1 <= 256. + function -$0-rand() { + local c + while true; do + sysread -s1 c || return + # Avoid bias towards smaller numbers. + (( #c < 256 / $1 * $1 )) && break + done + typeset -g REPLY=$((#c % $1 + 1)) + } + + local REPLY chars + + repeat ${1-1}; do + # Generate 6 pseudowords of the form cvccvc where c and v + # denote random consonants and vowels respectively. + local words=() + repeat 6; do + words+=('') + repeat 2; do + for chars in $consonants $vowels $consonants; do + -$0-rand $#chars || return + words[-1]+=$chars[REPLY] + done + done + done + + local pwd=${(j:-:)words} + + # Replace either the first or the last character in one of + # the words with a random digit. + -$0-rand $#digits || return + local digit=$digits[REPLY] + -$0-rand $((2 * $#words)) || return + pwd[REPLY/2*7+2*(REPLY%2)-1]=$digit + + # Convert one lower-case character to upper case. + while true; do + -$0-rand $#pwd || return + [[ $vowels$consonants == *$pwd[REPLY]* ]] && break + done + # NOTE: We aren't using ${(U)c} here because its results are + # locale-dependent. For example, when upper-casing 'i' in Turkish + # locale we would get 'İ', a.k.a. latin capital letter i with dot + # above. We could set LC_CTYPE=C locally but then we would run afoul + # of this zsh bug: https://www.zsh.org/mla/workers/2020/msg00588.html. + local c=$pwd[REPLY] + printf -v c '%o' $((#c - 32)) + printf "%s\\$c%s\\n" "$pwd[1,REPLY-1]" "$pwd[REPLY+1,-1]" || return + done +} always { + unfunction -m -- "-${(b)0}-*" +} } ]]; then + print -ru2 -- "usage: $0 [NUM]" + return 1 +fi + +zmodload zsh/system || return + +{ + local -r chars=abcdefghjkmnpqrstvwxyz0123456789 + local c + repeat ${1-1}; do + repeat 26; do + sysread -s1 c || return + # There is uniform because $#chars divides 256. + print -rn -- $chars[#c%$#chars+1] + done + print + done +} } ]]; then + print -ru2 -- "usage: $0 [NUM]" + return 1 +fi + +zmodload zsh/system zsh/mathfunc || return + +local -r dict=/usr/share/dict/words + +if [[ ! -e $dict ]]; then + print -ru2 -- "$0: file not found: $dict" + return 1 +fi + +# Read all dictionary words and leave only those made of 1-6 characters. +local -a words +words=(${(M)${(f)"$(<$dict)"}:#[a-zA-Z](#c1,6)}) || return + +if (( $#words < 2 )); then + print -ru2 -- "$0: not enough suitable words in $dict" + return 1 +fi + +if (( $#words > 16#7FFFFFFF )); then + print -ru2 -- "$0: too many words in $dict" + return 1 +fi + +# Figure out how many words we need for 128 bits of security margin. +# Each word adds log2($#words) bits. +local -i n=$((ceil(128. / (log($#words) / log(2))))) + +{ + local c + repeat ${1-1}; do + print -rn -- $n + repeat $n; do + while true; do + # Generate a random number in [0, 2**31). + local -i rnd=0 + repeat 4; do + sysread -s1 c || return + (( rnd = (~(1 << 23) & rnd) << 8 | #c )) + done + # Avoid bias towards words in the beginning of the list. + (( rnd < 16#7FFFFFFF / $#words * $#words )) || continue + print -rn -- -$words[rnd%$#words+1] + break + done + done + print + done +} $ZSH/plugins/gh/_gh + gh --version > $ZSH_CACHE_DIR/gh_version + fi + autoload -Uz _gh + _comps[gh]=_gh +fi + diff --git a/zsh/plugins/git-auto-fetch/README.md b/zsh/plugins/git-auto-fetch/README.md index 35f3c2f..e96ab42 100644 --- a/zsh/plugins/git-auto-fetch/README.md +++ b/zsh/plugins/git-auto-fetch/README.md @@ -1,26 +1,29 @@ # Git auto-fetch -Automatically fetches all changes from all remotes while you are working in git-initialized directory. +Automatically fetches all changes from all remotes while you are working in a git-initialized directory. -#### Usage - -Add `git-auto-fetch` to the plugins array in your zshrc file: +To use it, add `git-auto-fetch` to the plugins array in your zshrc file: ```shell plugins=(... git-auto-fetch) ``` -Every time you launch a command in your shell all remotes will be fetched in background. -By default autofetch will be triggered only if last fetch was done at least 60 seconds ago. -You can change fetch interval in your .zshrc: -``` -GIT_AUTO_FETCH_INTERVAL=1200 #in seconds -``` -Log of `git fetch --all` will be saved into `.git/FETCH_LOG` +## Usage +Every time the command prompt is shown all remotes will be fetched in the background. By default, +`git-auto-fetch` will be triggered only if the last auto-fetch was done at least 60 seconds ago. +You can change the fetch interval in your .zshrc: -#### Toggle auto fetch per folder -If you are using mobile connection or for any other reason you can disable git-auto-fetch for any folder: +```sh +GIT_AUTO_FETCH_INTERVAL=1200 # in seconds +``` + +A log of `git fetch --all` will be saved in `.git/FETCH_LOG`. + +## Toggle auto-fetch per folder + +If you are using a mobile connection or for any other reason you can disable git-auto-fetch +for any folder: ```shell $ cd to/your/project @@ -29,3 +32,19 @@ disabled $ git-auto-fetch enabled ``` + +## Caveats + +Automatically fetching all changes defeats the purpose of `git push --force-with-lease`, +and makes it behave like `git push --force` in some cases. For example: + +Consider that you made some changes and possibly rebased some stuff, which means you'll +need to use `--force-with-lease` to overwrite the remote history of a branch. Between the +time when you make the changes (maybe do a `git log`) and the time when you `git push`, +it's possible that someone else updates the branch you're working on. + +If `git-auto-fetch` triggers then, you'll have fetched the remote changes without knowing +it, and even though you're running the push with `--force-with-lease`, git will overwrite +the recent changes because you already have them in your local repository. The +[`git push --force-with-lease` docs](https://git-scm.com/docs/git-push) talk about possible +solutions to this problem. diff --git a/zsh/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/zsh/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh index 56ab86d..0da84f2 100644 --- a/zsh/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh +++ b/zsh/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -1,35 +1,61 @@ -GIT_AUTO_FETCH_INTERVAL=${GIT_AUTO_FETCH_INTERVAL:=60} +# Default auto-fetch interval: 60 seconds +: ${GIT_AUTO_FETCH_INTERVAL:=60} + +# Necessary for the git-fetch-all function +zmodload zsh/datetime zsh/stat function git-fetch-all { - (`git rev-parse --is-inside-work-tree 2>/dev/null` && - dir=`git rev-parse --git-dir` && - [[ ! -f $dir/NO_AUTO_FETCH ]] && - (( `date +%s` - `date -r $dir/FETCH_LOG +%s 2>/dev/null || echo 0` > $GIT_AUTO_FETCH_INTERVAL )) && - git fetch --all 2>/dev/null &>! $dir/FETCH_LOG &) + ( + # Get git root directory + if ! gitdir="$(command git rev-parse --git-dir 2>/dev/null)"; then + return 0 + fi + + # Do nothing if auto-fetch disabled + if [[ -z "$gitdir" || -f "$gitdir/NO_AUTO_FETCH" ]]; then + return 0 + fi + + # Get time (seconds) when auto-fetch was last run + lastrun="$(zstat +mtime "$gitdir/FETCH_LOG" 2>/dev/null || echo 0)" + # Do nothing if not enough time has passed since last auto-fetch + if (( EPOCHSECONDS - lastrun < $GIT_AUTO_FETCH_INTERVAL )); then + return 0 + fi + + # Fetch all remotes (avoid ssh passphrase prompt) + GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \ + command git fetch --all 2>/dev/null &>! "$gitdir/FETCH_LOG" + ) &| } function git-auto-fetch { - `git rev-parse --is-inside-work-tree 2>/dev/null` || return - guard="`git rev-parse --git-dir`/NO_AUTO_FETCH" + # Do nothing if not in a git repository + command git rev-parse --is-inside-work-tree &>/dev/null || return 0 - (rm $guard 2>/dev/null && - echo "${fg_bold[green]}enabled${reset_color}") || - (touch $guard && - echo "${fg_bold[red]}disabled${reset_color}") + # Remove or create guard file depending on its existence + local guard="$(command git rev-parse --git-dir)/NO_AUTO_FETCH" + if [[ -f "$guard" ]]; then + command rm "$guard" && echo "${fg_bold[green]}enabled${reset_color}" + else + command touch "$guard" && echo "${fg_bold[red]}disabled${reset_color}" + fi } -# Override zle-line-init if it exists -if (( $+functions[zle-line-init] )); then - eval "override-git-auto-fetch-$(declare -f zle-line-init)" - - function zle-line-init () { - git-fetch-all - override-git-auto-fetch-zle-line-init - } -else - function zle-line-init () { - git-fetch-all - } -fi - -zle -N zle-line-init +# zle-line-init widget (don't redefine if already defined) +(( ! ${+functions[_git-auto-fetch_zle-line-init]} )) || return 0 + +case "$widgets[zle-line-init]" in + # Simply define the function if zle-line-init doesn't yet exist + builtin|"") function _git-auto-fetch_zle-line-init() { + git-fetch-all + } ;; + # Override the current zle-line-init widget, calling the old one + user:*) zle -N _git-auto-fetch_orig_zle-line-init "${widgets[zle-line-init]#user:}" + function _git-auto-fetch_zle-line-init() { + git-fetch-all + zle _git-auto-fetch_orig_zle-line-init -- "$@" + } ;; +esac + +zle -N zle-line-init _git-auto-fetch_zle-line-init diff --git a/zsh/plugins/git-escape-magic/README.md b/zsh/plugins/git-escape-magic/README.md index c3e3898..7fefed3 100644 --- a/zsh/plugins/git-escape-magic/README.md +++ b/zsh/plugins/git-escape-magic/README.md @@ -4,13 +4,13 @@ This plugin is copied from the original at https://github.com/knu/zsh-git-escape-magic. All credit for the functionality enabled by this plugin should go to @knu. -An excerpt from that project's readme explains it's purpose. +An excerpt from that project's readme explains its purpose. > It eliminates the need for manually escaping those meta-characters. The zle function it provides is context aware and recognizes the characteristics of each subcommand of git. Every time you type one of these meta-characters on a git command line, it automatically escapes the meta-character with a backslash as necessary and as appropriate. ## Usage -To use this plugin add it to your list of plugins in your `.zshrc` file. +To use this plugin, add it to your list of plugins in your `.zshrc` file. -**NOTE**: If you use url-quote-magic it must be included before this +**NOTE**: If you use url-quote-magic, it must be included before this plugin runs to prevent any conflicts. diff --git a/zsh/plugins/git-extras/README.md b/zsh/plugins/git-extras/README.md index 987f0d8..2adc9d4 100644 --- a/zsh/plugins/git-extras/README.md +++ b/zsh/plugins/git-extras/README.md @@ -2,10 +2,16 @@ This plugin provides completion definitions for some of the commands defined by [git-extras](https://github.com/tj/git-extras). -## Setup notes +To use it, add `git-extras` to the plugins array in your zshrc file: + +```zsh +plugins=(... 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. +**NOTE:** this no longer works on current Homebrew distributions of git. ~~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/zsh/plugins/git-flow/README.md b/zsh/plugins/git-flow/README.md index 5d8049e..9c25dec 100644 --- a/zsh/plugins/git-flow/README.md +++ b/zsh/plugins/git-flow/README.md @@ -1,18 +1,15 @@ # Git-Flow plugin -This plugin adds completion and aliases for the `git-flow` command. More information -at https://github.com/nvie/gitflow. +This plugin adds completion and aliases for the [`git-flow` command](https://github.com/nvie/gitflow). -Enable git-flow plugin in your zshrc file: -``` +To use it, add `git-flow` to the plugins array in your zshrc file: + +```zsh 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 | @@ -30,3 +27,5 @@ https://github.com/nvie/gitflow/wiki/Command-Line-Arguments | `gflfp` | `git flow feature publish` | Publish feature: `gflfp ` | | `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf ` | | `gflrf` | `git flow release finish` | Finish release: `gflrf ` | + +[More information about `git-flow` commands](https://github.com/nvie/gitflow/wiki/Command-Line-Arguments). diff --git a/zsh/plugins/git-flow/git-flow.plugin.zsh b/zsh/plugins/git-flow/git-flow.plugin.zsh index eab969d..916cd56 100644 --- a/zsh/plugins/git-flow/git-flow.plugin.zsh +++ b/zsh/plugins/git-flow/git-flow.plugin.zsh @@ -36,7 +36,6 @@ alias gflff='git flow feature finish' alias gflfp='git flow feature publish' 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' diff --git a/zsh/plugins/git-lfs/README.md b/zsh/plugins/git-lfs/README.md new file mode 100644 index 0000000..1222b27 --- /dev/null +++ b/zsh/plugins/git-lfs/README.md @@ -0,0 +1,24 @@ +# git lfs plugin + +The git lfs plugin provides [aliases](#aliases) and [functions](#functions) for [git-lfs](https://github.com/git-lfs/git-lfs). + +To use it, add `git-lfs` to the plugins array in your zshrc file: + +```zsh +plugins=(... git-lfs) +``` + +## Aliases + +| Alias | Command | +| :------- | :---------------------------------- | +| `glfsi` | `git lfs install` | +| `glfst` | `git lfs track` | +| `glfsls` | `git lfs ls-files` | +| `glfsmi` | `git lfs migrate import --include=` | + +## Functions + +| Function | Command | +| :------- | :---------------------------------------------- | +| `gplfs` | `git lfs push origin "$(current_branch)" --all` | diff --git a/zsh/plugins/git-lfs/git-lfs.plugin.zsh b/zsh/plugins/git-lfs/git-lfs.plugin.zsh new file mode 100644 index 0000000..e7bb676 --- /dev/null +++ b/zsh/plugins/git-lfs/git-lfs.plugin.zsh @@ -0,0 +1,17 @@ +# +# Aliases +# + +alias glfsi='git lfs install' +alias glfst='git lfs track' +alias glfsls='git lfs ls-files' +alias glfsmi='git lfs migrate import --include=' + +# +# Functions +# + +function gplfs() { + local b="$(git_current_branch)" + git lfs push origin "$b" --all +} diff --git a/zsh/plugins/git-prompt/README.md b/zsh/plugins/git-prompt/README.md index e3b2d62..c6610fa 100644 --- a/zsh/plugins/git-prompt/README.md +++ b/zsh/plugins/git-prompt/README.md @@ -11,6 +11,9 @@ plugins=(... git-prompt) See the [original repository](https://github.com/olivierverdier/zsh-git-prompt). +## Prerequisites +This plugin uses `python`, so your host needs to have it installed + ## Examples The prompt may look like the following: @@ -21,6 +24,7 @@ The prompt may look like the following: - `(master|✖2✚3)`: on branch `master`, 2 conflicts, 3 files changed - `(experimental↓2↑3|✔)`: on branch `experimental`; your branch has diverged by 3 commits, remote by 2 commits; the repository is otherwise clean - `(:70c2952|✔)`: not on any branch; parent commit has hash `70c2952`; the repository is otherwise clean +- `(master|⚑2)`: on branch `master`, there are 2 stashed changes ## Prompt Structure @@ -40,6 +44,7 @@ The symbols are as follows: | ●n | there are `n` staged files | | ✖n | there are `n` unmerged files | | ✚n | there are `n` unstaged files | +| ⚑n | there are `n` stashed changes | | … | there are some untracked files | ### Branch Tracking Symbols diff --git a/zsh/plugins/git-prompt/git-prompt.plugin.zsh b/zsh/plugins/git-prompt/git-prompt.plugin.zsh index 1742429..a4c9524 100644 --- a/zsh/plugins/git-prompt/git-prompt.plugin.zsh +++ b/zsh/plugins/git-prompt/git-prompt.plugin.zsh @@ -1,6 +1,3 @@ -# ZSH Git Prompt Plugin from: -# http://github.com/olivierverdier/zsh-git-prompt - __GIT_PROMPT_DIR="${0:A:h}" ## Hook function definitions @@ -23,9 +20,10 @@ function precmd_update_git_vars() { fi } -chpwd_functions+=(chpwd_update_git_vars) -precmd_functions+=(precmd_update_git_vars) -preexec_functions+=(preexec_update_git_vars) +autoload -U add-zsh-hook +add-zsh-hook chpwd chpwd_update_git_vars +add-zsh-hook precmd precmd_update_git_vars +add-zsh-hook preexec preexec_update_git_vars ## Function definitions @@ -42,19 +40,18 @@ function update_current_git_vars() { GIT_CONFLICTS=$__CURRENT_GIT_STATUS[5] GIT_CHANGED=$__CURRENT_GIT_STATUS[6] GIT_UNTRACKED=$__CURRENT_GIT_STATUS[7] - GIT_DELETED=$__CURRENT_GIT_STATUS[8] + GIT_STASHED=$__CURRENT_GIT_STATUS[8] + GIT_CLEAN=$__CURRENT_GIT_STATUS[9] } 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_SEPARATOR" + 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_SEPARATOR" STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD$GIT_AHEAD%{${reset_color}%}" fi STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR" @@ -67,13 +64,13 @@ git_super_status() { if [ "$GIT_CHANGED" -ne "0" ]; then STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}" fi - if [ "$GIT_DELETED" -ne "0" ]; then - STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_DELETED$GIT_DELETED%{${reset_color}%}" - fi if [ "$GIT_UNTRACKED" -ne "0" ]; then STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED$GIT_UNTRACKED%{${reset_color}%}" fi - if [ "$GIT_CHANGED" -eq "0" ] && [ "$GIT_CONFLICTS" -eq "0" ] && [ "$GIT_STAGED" -eq "0" ] && [ "$GIT_UNTRACKED" -eq "0" ]; then + if [ "$GIT_STASHED" -ne "0" ]; then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STASHED$GIT_STASHED%{${reset_color}%}" + fi + if [ "$GIT_CLEAN" -eq "1" ]; then STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN" fi STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX" @@ -91,9 +88,9 @@ 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_UNTRACKED="%{$fg[cyan]%}%{…%G%}" +ZSH_THEME_GIT_PROMPT_STASHED="%{$fg_bold[blue]%}%{⚑%G%}" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%G%}" -ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}-" # Set the prompt. RPROMPT='$(git_super_status)' diff --git a/zsh/plugins/git-prompt/gitstatus.py b/zsh/plugins/git-prompt/gitstatus.py index 709de9e..786274a 100644 --- a/zsh/plugins/git-prompt/gitstatus.py +++ b/zsh/plugins/git-prompt/gitstatus.py @@ -1,47 +1,55 @@ #!/usr/bin/env python from __future__ import print_function +import os 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] + hash_cmd = ['git', 'rev-parse', '--short', 'HEAD'] + hash_ = check_output(hash_cmd).decode('utf-8').strip() - if tagname: - return tagname + # get tagname + tags_cmd = ['git', 'for-each-ref', '--points-at=HEAD', '--count=2', '--sort=-version:refname', '--format=%(refname:short)', 'refs/tags'] + tags = check_output(tags_cmd).decode('utf-8').split() + + if tags: + return tags[0] + ('+' if len(tags) > 1 else '') elif hash_: return hash_ return None +# Re-use method from https://github.com/magicmonty/bash-git-prompt to get stashs count +def get_stash(): + cmd = Popen(['git', 'rev-parse', '--git-dir'], stdout=PIPE, stderr=PIPE) + so, se = cmd.communicate() + stash_file = '%s%s' % (so.decode('utf-8').rstrip(), '/logs/refs/stash') + + try: + with open(stash_file) as f: + return sum(1 for _ in f) + except IOError: + return 0 + # `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) +po = Popen(['git', 'status', '--porcelain', '--branch'], env=dict(os.environ, LANG="C"), 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, deleted = [], [], [], [], [] +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]): + if re.search('Initial commit on', st[2]) or re.search('No commits yet on', st[2]): branch = st[2].split(' ')[-1] elif re.search('no branch', st[2]): # detached status branch = get_tagname_or_hash() @@ -67,13 +75,17 @@ for st in status: else: if st[1] == 'M': changed.append(st) - if st[1] == 'D': - deleted.append(st) if st[0] == 'U': conflicts.append(st) elif st[0] != ' ': staged.append(st) +stashed = get_stash() +if not changed and not staged and not conflicts and not untracked and not stashed: + clean = 1 +else: + clean = 0 + out = ' '.join([ branch, str(ahead), @@ -82,6 +94,7 @@ out = ' '.join([ str(len(conflicts)), str(len(changed)), str(len(untracked)), - str(len(deleted)), + str(stashed), + str(clean) ]) print(out, end='') diff --git a/zsh/plugins/git-remote-branch/git-remote-branch.plugin.zsh b/zsh/plugins/git-remote-branch/git-remote-branch.plugin.zsh deleted file mode 100644 index 6c5ab8f..0000000 --- a/zsh/plugins/git-remote-branch/git-remote-branch.plugin.zsh +++ /dev/null @@ -1,19 +0,0 @@ -_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/zsh/plugins/git/README.md b/zsh/plugins/git/README.md index 7878f74..4f051db 100644 --- a/zsh/plugins/git/README.md +++ b/zsh/plugins/git/README.md @@ -10,194 +10,215 @@ plugins=(... git) ## Aliases -| Alias | Command | -|:---------------------|:------------------------------------------------------------------------------------------------------------------------------| -| g | git | -| ga | git add | -| gaa | git add --all | -| gapa | git add --patch | -| gau | git add --update | -| gav | git add --verbose | -| gap | git apply | -| gb | git branch | -| gba | git branch -a | -| gbd | git branch -d | -| gbda | git branch --no-color --merged \| command grep -vE "^(\+|\*\|\s*(master\|develop\|dev)\s*$)" \| command xargs -n 1 git branch -d | -| gbD | git branch -D | -| gbl | git blame -b -w | -| gbnm | git branch --no-merged | -| gbr | git branch --remote | -| gbs | git bisect | -| gbsb | git bisect bad | -| gbsg | git bisect good | -| gbsr | git bisect reset | -| gbss | git bisect start | -| gc | git commit -v | -| gc! | git commit -v --amend | -| gcn! | git commit -v --no-edit --amend | -| gca | git commit -v -a | -| gca! | git commit -v -a --amend | -| gcan! | git commit -v -a --no-edit --amend | -| gcans! | git commit -v -a -s --no-edit --amend | -| gcam | git commit -a -m | -| gcsm | git commit -s -m | -| gcb | git checkout -b | -| gcf | git config --list | -| gcl | git clone --recurse-submodules | -| gclean | git clean -id | -| gpristine | git reset --hard && git clean -dfx | -| gcm | git checkout master | -| gcd | git checkout develop | -| gcmsg | git commit -m | -| gco | git checkout | -| gcount | git shortlog -sn | -| gcp | git cherry-pick | -| gcpa | git cherry-pick --abort | -| gcpc | git cherry-pick --continue | -| gcs | git commit -S | -| gd | git diff | -| gdca | git diff --cached | -| gdcw | git diff --cached --word-diff | -| gdct | git describe --tags $(git rev-list --tags --max-count=1) | -| gds | git diff --staged | -| gdt | git diff-tree --no-commit-id --name-only -r | -| gdv | git diff -w $@ \| view - | -| gdw | git diff --word-diff | -| gf | git fetch | -| gfa | git fetch --all --prune | -| gfg | git ls-files \| grep | -| gfo | git fetch origin | -| gg | git gui citool | -| gga | git gui citool --amend | -| ggf | git push --force origin $(current_branch) | -| ggfl | git push --force-with-lease origin $(current_branch) | -| ggl | git pull origin $(current_branch) | -| ggp | git push origin $(current_branch) | -| ggpnp | ggl && ggp | -| ggpull | git pull origin "$(git_current_branch)" | -| ggpur | ggu | -| ggpush | git push origin "$(git_current_branch)" | -| ggsup | git branch --set-upstream-to=origin/$(git_current_branch) | -| ggu | git pull --rebase origin $(current_branch) | -| gpsup | git push --set-upstream origin $(git_current_branch) | -| ghh | git help | -| gignore | git update-index --assume-unchanged | -| gignored | git ls-files -v \| grep "^[[:lower:]]" | -| git-svn-dcommit-push | git svn dcommit && git push github master:svntrunk | -| gk | gitk --all --branches | -| gke | gitk --all $(git log -g --pretty=%h) | -| gl | git pull | -| glg | git log --stat | -| glgp | git log --stat -p | -| glgg | git log --graph | -| glgga | git log --graph --decorate --all | -| glgm | git log --graph --max-count=10 | -| glo | git log --oneline --decorate | -| glol | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' | -| glols | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat | -| glod | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' | -| glods | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short | -| glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all | -| glog | git log --oneline --decorate --graph | -| gloga | git log --oneline --decorate --graph --all | -| glp | `_git_log_prettily` | -| gm | git merge | -| gmom | git merge origin/master | -| gmt | git mergetool --no-prompt | -| gmtvim | git mergetool --no-prompt --tool=vimdiff | -| gmum | git merge upstream/master | -| gma | git merge --abort | -| gp | git push | -| gpd | git push --dry-run | -| gpf | git push --force-with-lease | -| gpf! | git push --force | -| gpoat | git push origin --all && git push origin --tags | -| gpu | git push upstream | -| gpv | git push -v | -| gr | git remote | -| gra | git remote add | -| grb | git rebase | -| grba | git rebase --abort | -| grbc | git rebase --continue | -| grbd | git rebase develop | -| grbi | git rebase -i | -| grbm | git rebase master | -| grbs | git rebase --skip | -| grev | git revert | -| grh | git reset | -| grhh | git reset --hard | -| groh | git reset origin/$(git_current_branch) --hard | -| grm | git rm | -| grmc | git rm --cached | -| grmv | git remote rename | -| grrm | git remote remove | -| grs | git restore | -| grset | git remote set-url | -| grss | git restore --source | -| grt | cd "$(git rev-parse --show-toplevel \|\| echo .)" | -| gru | git reset -- | -| grup | git remote update | -| grv | git remote -v | -| gsb | git status -sb | -| gsd | git svn dcommit | -| gsh | git show | -| gsi | git submodule init | -| gsps | git show --pretty=short --show-signature | -| gsr | git svn rebase | -| gss | git status -s | -| gst | git status | -| gsta | git stash push | -| gsta | git stash save | -| gstaa | git stash apply | -| gstc | git stash clear | -| gstd | git stash drop | -| gstl | git stash list | -| gstp | git stash pop | -| gsts | git stash show --text | -| gstall | git stash --all | -| gsu | git submodule update | -| gsw | git switch | -| gswc | git switch -c | -| gts | git tag -s | -| gtv | git tag \| sort -V | -| gtl | gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl | -| gunignore | git update-index --no-assume-unchanged | -| gunwip | git log -n 1 \| grep -q -c "\-\-wip\-\-" && git reset HEAD~1 | -| gup | git pull --rebase | -| gupv | git pull --rebase -v | -| gupa | git pull --rebase --autostash | -| gupav | git pull --rebase --autostash -v | -| glum | git pull upstream master | -| gwch | git whatchanged -p --abbrev-commit --pretty=medium | -| gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" | +| Alias | Command | +|:---------------------|:---------------------------------------------------------------------------------------------------------------------------------| +| g | git | +| ga | git add | +| gaa | git add --all | +| gapa | git add --patch | +| gau | git add --update | +| gav | git add --verbose | +| gap | git apply | +| gapt | git apply --3way | +| gb | git branch | +| gba | git branch -a | +| gbd | git branch -d | +| gbda | git branch --no-color --merged \| command grep -vE "^(\+\|\*\|\s*($(git_main_branch)\|development\|develop\|devel\|dev)\s*$)" \| command xargs -n 1 git branch -d | +| gbD | git branch -D | +| gbl | git blame -b -w | +| gbnm | git branch --no-merged | +| gbr | git branch --remote | +| gbs | git bisect | +| gbsb | git bisect bad | +| gbsg | git bisect good | +| gbsr | git bisect reset | +| gbss | git bisect start | +| gc | git commit -v | +| gc! | git commit -v --amend | +| gcn! | git commit -v --no-edit --amend | +| gca | git commit -v -a | +| gca! | git commit -v -a --amend | +| gcan! | git commit -v -a --no-edit --amend | +| gcans! | git commit -v -a -s --no-edit --amend | +| gcam | git commit -a -m | +| gcas | git commit -a -s | +| gcasm | git commit -a -s -m | +| gcsm | git commit -s -m | +| gcb | git checkout -b | +| gcf | git config --list | +| gcl | git clone --recurse-submodules | +| gclean | git clean -id | +| gpristine | git reset --hard && git clean -dffx | +| gcm | git checkout $(git_main_branch) | +| gcd | git checkout develop | +| gcmsg | git commit -m | +| gco | git checkout | +| gcount | git shortlog -sn | +| gcp | git cherry-pick | +| gcpa | git cherry-pick --abort | +| gcpc | git cherry-pick --continue | +| gcs | git commit -S | +| gd | git diff | +| gdca | git diff --cached | +| gdcw | git diff --cached --word-diff | +| gdct | git describe --tags $(git rev-list --tags --max-count=1) | +| gds | git diff --staged | +| gdt | git diff-tree --no-commit-id --name-only -r | +| gdnolock | git diff $@ ":(exclude)package-lock.json" ":(exclude)*.lock" | +| gdv | git diff -w $@ \| view - | +| gdw | git diff --word-diff | +| gf | git fetch | +| gfa | git fetch --all --prune | +| gfg | git ls-files \| grep | +| gfo | git fetch origin | +| gg | git gui citool | +| gga | git gui citool --amend | +| ggf | git push --force origin $(current_branch) | +| ggfl | git push --force-with-lease origin $(current_branch) | +| ggl | git pull origin $(current_branch) | +| ggp | git push origin $(current_branch) | +| ggpnp | ggl && ggp | +| ggpull | git pull origin "$(git_current_branch)" | +| ggpur | ggu | +| ggpush | git push origin "$(git_current_branch)" | +| ggsup | git branch --set-upstream-to=origin/$(git_current_branch) | +| ggu | git pull --rebase origin $(current_branch) | +| gpsup | git push --set-upstream origin $(git_current_branch) | +| ghh | git help | +| gignore | git update-index --assume-unchanged | +| gignored | git ls-files -v \| grep "^[[:lower:]]" | +| git-svn-dcommit-push | git svn dcommit && git push github $(git_main_branch):svntrunk | +| gk | gitk --all --branches | +| gke | gitk --all $(git log -g --pretty=%h) | +| gl | git pull | +| glg | git log --stat | +| glgp | git log --stat -p | +| glgg | git log --graph | +| glgga | git log --graph --decorate --all | +| glgm | git log --graph --max-count=10 | +| glo | git log --oneline --decorate | +| glol | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' | +| glols | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat | +| glod | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' | +| glods | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short | +| glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all | +| glog | git log --oneline --decorate --graph | +| gloga | git log --oneline --decorate --graph --all | +| glp | git log --pretty=\ | +| gm | git merge | +| gmom | git merge origin/$(git_main_branch) | +| gmt | git mergetool --no-prompt | +| gmtvim | git mergetool --no-prompt --tool=vimdiff | +| gmum | git merge upstream/$(git_main_branch) | +| gma | git merge --abort | +| gp | git push | +| gpd | git push --dry-run | +| gpf | git push --force-with-lease | +| gpf! | git push --force | +| gpoat | git push origin --all && git push origin --tags | +| gpu | git push upstream | +| gpv | git push -v | +| gr | git remote | +| gra | git remote add | +| grb | git rebase | +| grba | git rebase --abort | +| grbc | git rebase --continue | +| grbd | git rebase develop | +| grbi | git rebase -i | +| grbm | git rebase $(git_main_branch) | +| grbo | git rebase --onto | +| grbs | git rebase --skip | +| grev | git revert | +| grh | git reset | +| grhh | git reset --hard | +| groh | git reset origin/$(git_current_branch) --hard | +| grm | git rm | +| grmc | git rm --cached | +| grmv | git remote rename | +| grrm | git remote remove | +| grs | git restore | +| grset | git remote set-url | +| grss | git restore --source | +| grst | git restore --staged | +| grt | cd "$(git rev-parse --show-toplevel \|\| echo .)" | +| gru | git reset -- | +| grup | git remote update | +| grv | git remote -v | +| gsb | git status -sb | +| gsd | git svn dcommit | +| gsh | git show | +| gsi | git submodule init | +| gsps | git show --pretty=short --show-signature | +| gsr | git svn rebase | +| gss | git status -s | +| gst | git status | +| gsta | git stash push | +| gsta | git stash save | +| gstaa | git stash apply | +| gstc | git stash clear | +| gstd | git stash drop | +| gstl | git stash list | +| gstp | git stash pop | +| gsts | git stash show --text | +| gstu | git stash --include-untracked | +| gstall | git stash --all | +| gsu | git submodule update | +| gsw | git switch | +| gswc | git switch -c | +| gts | git tag -s | +| gtv | git tag \| sort -V | +| gtl | gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl | +| gunignore | git update-index --no-assume-unchanged | +| gunwip | git log -n 1 \| grep -q -c "\-\-wip\-\-" && git reset HEAD~1 | +| gup | git pull --rebase | +| gupv | git pull --rebase -v | +| gupa | git pull --rebase --autostash | +| gupav | git pull --rebase --autostash -v | +| glum | git pull upstream $(git_main_branch) | +| gwch | git whatchanged -p --abbrev-commit --pretty=medium | +| gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" | +| gam | git am | +| gamc | git am --continue | +| gams | git am --skip | +| gama | git am --abort | +| gamscp | git am --show-current-patch | -### Deprecated +### Main branch preference + +Following the recent push for removing racially-charged words from our technical vocabulary, the git plugin favors using +a branch name other than `master`. In this case, we favor the shorter, neutral and descriptive term `main`. This means +that any aliases and functions that previously used `master`, will use `main` if that branch exists. We do this via the +function `git_main_branch`. + +### Deprecated aliases These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not, receive further support. -| Alias | Command | Modification | -| :----- | :----------------------------------------------------------------------------------| --------------------------------------------------------------------------------------------------- | -| gap | git add --patch | new alias `gapa` | -| gcl | git config --list | new alias `gcf` | -| gdc | git diff --cached | new alias `gdca` | -| gdt | git difftool | no replacement | -| ggpull | git pull origin $(current_branch) | new alias `ggl` (`ggpull` still exists for now though) | -| ggpur | git pull --rebase origin $(current_branch) | new alias `ggu` (`ggpur` still exists for now though) | -| ggpush | git push origin $(current_branch) | new alias `ggp` (`ggpush` still exists for now though) | -| gk | gitk --all --branches | now aliased to `gitk --all --branches` | -| glg | git log --stat --max-count = 10 | now aliased to `git log --stat --color` | -| glgg | git log --graph --max-count = 10 | now aliased to `git log --graph --color` | -| gwc | git whatchanged -p --abbrev-commit --pretty = medium | new alias `gwch` | +| Alias | Command | Modification | +| :----- | :----------------------------------------------------- | :----------------------------------------------------- | +| gap | `git add --patch` | new alias `gapa` | +| gcl | `git config --list` | new alias `gcf` | +| gdc | `git diff --cached` | new alias `gdca` | +| gdt | `git difftool` | no replacement | +| ggpull | `git pull origin $(current_branch)` | new alias `ggl` (`ggpull` still exists for now though) | +| ggpur | `git pull --rebase origin $(current_branch)` | new alias `ggu` (`ggpur` still exists for now though) | +| ggpush | `git push origin $(current_branch)` | new alias `ggp` (`ggpush` still exists for now though) | +| gk | `gitk --all --branches` | now aliased to `gitk --all --branches` | +| glg | `git log --stat --max-count = 10` | now aliased to `git log --stat --color` | +| glgg | `git log --graph --max-count = 10` | now aliased to `git log --graph --color` | +| gwc | `git whatchanged -p --abbrev-commit --pretty = medium` | new alias `gwch` | ## Functions ### Current -| Command | Description | -|:-----------------------|:----------------------------------------| -| current_branch | Return the name of the current branch | -| git_current_user_name | Returns the `user.name` config value | -| git_current_user_email | Returns the `user.email` config value | +| Command | Description | +|:-----------------------|:-----------------------------------------------------------------------------| +| `grename ` | Rename `old` branch to `new`, including in origin remote | +| current_branch | Return the name of the current branch | +| git_current_user_name | Returns the `user.name` config value | +| git_current_user_email | Returns the `user.email` config value | +| git_main_branch | Returns the name of the main branch: `main` if it exists, `master` otherwise | ### Work in Progress (WIP) @@ -209,7 +230,7 @@ These features allow to pause a branch development and switch to another one (_" | gwip | Commit wip branch | | gunwip | Uncommit wip branch | -### Deprecated +### Deprecated functions | Command | Description | Reason | |:-----------------------|:----------------------------------------|:----------------------------------------------------------------| diff --git a/zsh/plugins/git/git.plugin.zsh b/zsh/plugins/git/git.plugin.zsh index d8c4cff..35ebfbf 100644 --- a/zsh/plugins/git/git.plugin.zsh +++ b/zsh/plugins/git/git.plugin.zsh @@ -1,3 +1,7 @@ +# Git version checking +autoload -Uz is-at-least +git_version="${${(As: :)$(git version 2>/dev/null)}[3]}" + # # Functions # @@ -25,6 +29,19 @@ function work_in_progress() { fi } +# Check if main exists and use instead of master +function git_main_branch() { + command git rev-parse --git-dir &>/dev/null || return + local branch + for branch in main trunk; do + if command git show-ref -q --verify refs/heads/$branch; then + echo $branch + return + fi + done + echo master +} + # # Aliases # (sorted alphabetically) @@ -38,11 +55,12 @@ alias gapa='git add --patch' alias gau='git add --update' alias gav='git add --verbose' alias gap='git apply' +alias gapt='git apply --3way' 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 gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*($(git_main_branch)|development|develop|devel|dev)\s*$)" | command xargs -n 1 git branch -d' alias gbD='git branch -D' alias gbl='git blame -b -w' alias gbnm='git branch --no-merged' @@ -62,12 +80,14 @@ 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 gcas='git commit -a -s' +alias gcasm='git commit -a -s -m' alias gcb='git checkout -b' alias gcf='git config --list' alias gcl='git clone --recurse-submodules' alias gclean='git clean -id' -alias gpristine='git reset --hard && git clean -dfx' -alias gcm='git checkout master' +alias gpristine='git reset --hard && git clean -dffx' +alias gcm='git checkout $(git_main_branch)' alias gcd='git checkout develop' alias gcmsg='git commit -m' alias gco='git checkout' @@ -85,11 +105,19 @@ alias gds='git diff --staged' alias gdt='git diff-tree --no-commit-id --name-only -r' alias gdw='git diff --word-diff' +function gdnolock() { + git diff "$@" ":(exclude)package-lock.json" ":(exclude)*.lock" +} +compdef _git gdnolock=git-diff + function gdv() { git diff -w "$@" | view - } compdef _git gdv=git-diff alias gf='git fetch' -alias gfa='git fetch --all --prune' +# --jobs= was added in git 2.8 +is-at-least 2.8 "$git_version" \ + && alias gfa='git fetch --all --prune --jobs=10' \ + || alias gfa='git fetch --all --prune' alias gfo='git fetch origin' alias gfg='git ls-files | grep' @@ -154,7 +182,7 @@ 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' +alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk' alias gk='\gitk --all --branches' alias gke='\gitk --all $(git log -g --pretty=%h)' @@ -176,10 +204,10 @@ alias gloga='git log --oneline --decorate --graph --all' alias glp="_git_log_prettily" alias gm='git merge' -alias gmom='git merge origin/master' +alias gmom='git merge origin/$(git_main_branch)' alias gmt='git mergetool --no-prompt' alias gmtvim='git mergetool --no-prompt --tool=vimdiff' -alias gmum='git merge upstream/master' +alias gmum='git merge upstream/$(git_main_branch)' alias gma='git merge --abort' alias gp='git push' @@ -197,7 +225,8 @@ alias grba='git rebase --abort' alias grbc='git rebase --continue' alias grbd='git rebase develop' alias grbi='git rebase -i' -alias grbm='git rebase master' +alias grbm='git rebase $(git_main_branch)' +alias grbo='git rebase --onto' alias grbs='git rebase --skip' alias grev='git revert' alias grh='git reset' @@ -210,6 +239,7 @@ alias grrm='git remote remove' alias grs='git restore' alias grset='git remote set-url' alias grss='git restore --source' +alias grst='git restore --staged' alias grt='cd "$(git rev-parse --show-toplevel || echo .)"' alias gru='git reset --' alias grup='git remote update' @@ -225,8 +255,7 @@ alias gss='git status -s' alias gst='git status' # use the default stash push on git 2.13 and newer -autoload -Uz is-at-least -is-at-least 2.13 "$(git --version 2>/dev/null | awk '{print $3}')" \ +is-at-least 2.13 "$git_version" \ && alias gsta='git stash push' \ || alias gsta='git stash save' @@ -236,6 +265,7 @@ alias gstd='git stash drop' alias gstl='git stash list' alias gstp='git stash pop' alias gsts='git stash show --text' +alias gstu='gsta --include-untracked' alias gstall='git stash --all' alias gsu='git submodule update' alias gsw='git switch' @@ -251,7 +281,29 @@ alias gup='git pull --rebase' alias gupv='git pull --rebase -v' alias gupa='git pull --rebase --autostash' alias gupav='git pull --rebase --autostash -v' -alias glum='git pull upstream master' +alias glum='git pull upstream $(git_main_branch)' 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 --no-gpg-sign -m "--wip-- [skip ci]"' + +alias gam='git am' +alias gamc='git am --continue' +alias gams='git am --skip' +alias gama='git am --abort' +alias gamscp='git am --show-current-patch' + +function grename() { + if [[ -z "$1" || -z "$2" ]]; then + echo "Usage: $0 old_branch new_branch" + return 1 + fi + + # Rename branch locally + git branch -m "$1" "$2" + # Rename branch in origin remote + if git push origin :"$1"; then + git push --set-upstream origin "$2" + fi +} + +unset git_version diff --git a/zsh/plugins/gitfast/README.md b/zsh/plugins/gitfast/README.md index 84e35d7..fed4b12 100644 --- a/zsh/plugins/gitfast/README.md +++ b/zsh/plugins/gitfast/README.md @@ -1,6 +1,6 @@ # Gitfast plugin -This plugin adds completion for Git, using the zsh completion from git.git folks, which is much faster than the official one from zsh. A lot of zsh-specific features are not supported, like descriptions for every argument, but everything the bash completion has, this one does too (as it is using it behind the scenes). Not only is it faster, it should be more robust, and updated regularly to the latest git upstream version.. +This plugin adds completion for Git, using the zsh completion from git.git folks, which is much faster than the official one from zsh. A lot of zsh-specific features are not supported, like descriptions for every argument, but everything the bash completion has, this one does too (as it is using it behind the scenes). Not only is it faster, it should be more robust, and updated regularly to the latest git upstream version. To use it, add `gitfast` to the plugins array in your zshrc file: @@ -11,5 +11,5 @@ plugins=(... gitfast) ## Aliases An earlier version of the plugin also loaded the git plugin. If you want to keep those -aliases enable the [git plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/git) +aliases enable the [git plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git) as well. diff --git a/zsh/plugins/gitfast/_git b/zsh/plugins/gitfast/_git index 886bf95..988f5b1 100644 --- a/zsh/plugins/gitfast/_git +++ b/zsh/plugins/gitfast/_git @@ -2,25 +2,24 @@ # zsh completion wrapper for git # -# Copyright (c) 2012-2013 Felipe Contreras +# Copyright (c) 2012-2020 Felipe Contreras # -# You need git's bash completion script installed somewhere, by default it -# would be the location bash-completion uses. +# The recommended way to install this script is to make a copy of it as a +# file named '_git' inside any directory in your fpath. # -# If your script is somewhere else, you can configure it on your ~/.zshrc: -# -# zstyle ':completion:*:*:git:*' script ~/.git-completion.zsh -# -# The recommended way to install this script is to copy to '~/.zsh/_git', and -# then add the following to your ~/.zshrc file: +# For example, create a directory '~/.zsh/', copy this file to '~/.zsh/_git', +# and then add the following to your ~/.zshrc file: # # fpath=(~/.zsh $fpath) - -complete () -{ - # do nothing - return 0 -} +# +# You need git's bash completion script installed. By default bash-completion's +# location will be used (e.g. pkg-config --variable=completionsdir bash-completion). +# +# If your bash completion script is somewhere else, you can specify the +# location in your ~/.zshrc: +# +# zstyle ':completion:*:*:git:*' script ~/.git-completion.bash +# zstyle -T ':completion:*:*:git:*' tag-order && \ zstyle ':completion:*:*:git:*' tag-order 'common-commands' @@ -28,18 +27,32 @@ zstyle -T ':completion:*:*:git:*' tag-order && \ zstyle -s ":completion:*:*:git:*" script script if [ -z "$script" ]; then local -a locations - local e + local e bash_completion + + bash_completion=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null) || + bash_completion='/usr/share/bash-completion/completions/' + 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 + "$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash + "$HOME/.local/share/bash-completion/completions/git" + "$bash_completion/git" + '/etc/bash_completion.d/git' # old debian ) for e in $locations; do test -f $e && script="$e" && break done fi + +local old_complete="$functions[complete]" +functions[complete]=: +COMP_WORDBREAKS=':' GIT_SOURCING_ZSH_COMPLETION=y . "$script" +functions[complete]="$old_complete" + +__gitcompadd () +{ + compadd -Q -p "${2-}" -S "${3- }" ${@[4,-1]} -- ${=1} && _ret=0 +} __gitcomp () { @@ -47,68 +60,85 @@ __gitcomp () local cur_="${3-$cur}" - case "$cur_" in - --*=) - ;; - *) - local c IFS=$' \t\n' - local -a array - for c in ${=1}; do - c="$c${4-}" + [[ "$cur_" == *= ]] && return + + local c IFS=$' \t\n' sfx + for c in ${=1}; do + if [[ $c == "--" ]]; then + [[ "$cur_" == --no-* ]] && continue + __gitcompadd "--no-..." + break + fi + + if [[ -z "${4-}" ]]; then case $c in - --*=*|*.) ;; - *) c="$c " ;; + *=) c="${c%=}"; sfx="=" ;; + *.) sfx="" ;; + *) sfx=" " ;; esac - array+=("$c") - done - compset -P '*[=:]' - compadd -Q -S '' -p "${2-}" -a -- array && _ret=0 - ;; - esac -} - -__gitcomp_direct () -{ - emulate -L zsh - - local IFS=$'\n' - compset -P '*[=:]' - compadd -Q -- ${=1} && _ret=0 + else + sfx="$4" + fi + __gitcompadd "$c" "${2-}" "$sfx" -q + done } __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_direct () -{ - emulate -L zsh - - local IFS=$'\n' - compset -P '*[=:]' - compadd -f -- ${=1} && _ret=0 + IFS=$'\n' __gitcompadd "$1" "${2-}" "${4- }" } __gitcomp_file () { emulate -L zsh - local IFS=$'\n' + compadd -f -p "${2-}" -- ${(f)1} && _ret=0 +} + +__gitcomp_direct () +{ + __gitcomp_nl "$1" "" "" "" +} + +__gitcomp_file_direct () +{ + __gitcomp_file "$1" "" +} + +__gitcomp_nl_append () +{ + __gitcomp_nl "$@" +} + +__gitcomp_direct_append () +{ + __gitcomp_direct "$@" +} + +_git_zsh () +{ + __gitcomp "v1.2" +} + +__git_complete_command () +{ + emulate -L zsh + compset -P '*[=:]' - compadd -p "${2-}" -f -- ${=1} && _ret=0 + + local command="$1" + local completion_func="_git_${command//-/_}" + if (( $+functions[$completion_func] )); then + emulate ksh -c $completion_func + return 0 + elif emulate ksh -c "__git_support_parseopt_helper $command"; then + emulate ksh -c "__git_complete_common $command" + return 0 + else + return 1 + fi } __git_zsh_bash_func () @@ -117,14 +147,12 @@ __git_zsh_bash_func () local command=$1 - local completion_func="_git_${command//-/_}" - declare -f $completion_func >/dev/null && $completion_func && return + __git_complete_command "$command" && 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 + __git_complete_command "$expansion" fi } @@ -149,9 +177,11 @@ __git_zsh_cmd_common () 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' + restore:'restore working tree files' rm:'remove files from the working tree and from the index' show:'show various types of objects' status:'show the working tree status' + switch:'switch branches' tag:'create, list, delete or verify a tag object signed with GPG') _describe -t common-commands 'common commands' list && _ret=0 } @@ -159,8 +189,9 @@ __git_zsh_cmd_common () __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 + list=(${${(0)"$(git config -z --get-regexp '^alias\.*')"}#alias.}) + list=(${(f)"$(printf "%s:alias for '%s'\n" ${(f@)list})"}) + _describe -t alias-commands 'aliases' list && _ret=0 } __git_zsh_cmd_all () @@ -175,33 +206,43 @@ __git_zsh_main () { local curcontext="$curcontext" state state_descr line typeset -A opt_args - local -a orig_words + local -a orig_words __git_C_args 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]' \ + '(-p --paginate -P --no-pager)'{-p,--paginate}'[pipe all output into ''less'']' \ + '(-p --paginate -P --no-pager)'{-P,--no-pager}'[do not pipe git output into a pager]' \ + '(--bare)--git-dir=[set the path to the repository]: :_directories' \ + '(--git-dir)--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]' \ + '--exec-path=[path to where your core git programs are installed]: :_directories' \ + '(- :)--exec-path[print the path where your core git programs are installed]' \ + '(- :)--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' \ + '*-C[run as if git was started in the given path]: :_directories' \ + '*-c[pass a configuration parameter to the command]: :->config' \ '(-): :->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 + _tags common-commands alias-commands all-commands + while _tags; do + _requested common-commands && __git_zsh_cmd_common + _requested alias-commands && __git_zsh_cmd_alias + _requested all-commands && __git_zsh_cmd_all + let _ret || break + done + ;; + (config) + compset -P '*[=:]' + emulate ksh -c __git_complete_config_variable_name_and_value ;; (arg) local command="${words[1]}" __git_dir @@ -209,9 +250,13 @@ __git_zsh_main () if (( $+opt_args[--bare] )); then __git_dir='.' else - __git_dir=${opt_args[--git-dir]} + __git_dir=${~opt_args[--git-dir]} fi + for x in ${(s.:.)opt_args[-C]}; do + __git_C_args+=('-C' ${~x}) + done + (( $+opt_args[--help] )) && command='help' words=( ${orig_words[@]} ) @@ -232,8 +277,12 @@ _git () if (( $+functions[__${service}_zsh_main] )); then __${service}_zsh_main - else + elif (( $+functions[__${service}_main] )); then emulate ksh -c __${service}_main + elif (( $+functions[_${service}] )); then + emulate ksh -c _${service} + elif (( $+functions[_${service//-/_}] )); then + emulate ksh -c _${service//-/_} fi let _ret && _default && _ret=0 diff --git a/zsh/plugins/gitfast/git-completion.bash b/zsh/plugins/gitfast/git-completion.bash index e087c4b..4497a29 100644 --- a/zsh/plugins/gitfast/git-completion.bash +++ b/zsh/plugins/gitfast/git-completion.bash @@ -39,18 +39,18 @@ # When set to "1", do not include "DWIM" suggestions in git-checkout # and git-switch completion (e.g., completing "foo" when "origin/foo" # exists). - -case "$COMP_WORDBREAKS" in -*:*) : great ;; -*) COMP_WORDBREAKS="$COMP_WORDBREAKS:" -esac +# +# GIT_COMPLETION_SHOW_ALL +# +# When set to "1" suggest all options, including options which are +# typically hidden (e.g. '--allow-empty' for 'git commit'). # Discovers the path to the git repository taking any '--git-dir=' and # '-C ' options into account and stores it in the $__git_repo_path # variable. __git_find_repo_path () { - if [ -n "$__git_repo_path" ]; then + if [ -n "${__git_repo_path-}" ]; then # we already know where it is return fi @@ -301,6 +301,19 @@ __gitcomp_direct () COMPREPLY=($1) } +# Similar to __gitcomp_direct, but appends to COMPREPLY instead. +# Callers must take care of providing only words that match the current word +# to be completed and adding any prefix and/or suffix (trailing space!), if +# necessary. +# 1: List of newline-separated matching completion words, complete with +# prefix and suffix. +__gitcomp_direct_append () +{ + local IFS=$'\n' + + COMPREPLY+=($1) +} + __gitcompappend () { local x i=${#COMPREPLY[@]} @@ -329,7 +342,7 @@ __gitcomp () local cur_="${3-$cur}" case "$cur_" in - --*=) + *=) ;; --no-*) local c i=0 IFS=$' \t\n' @@ -340,7 +353,7 @@ __gitcomp () c="$c${4-}" if [[ $c == "$cur_"* ]]; then case $c in - --*=*|*.) ;; + --*=|*.) ;; *) c="$c " ;; esac COMPREPLY[i++]="${2-}$c" @@ -360,7 +373,7 @@ __gitcomp () c="$c${4-}" if [[ $c == "$cur_"* ]]; then case $c in - --*=*|*.) ;; + *=|*.) ;; *) c="$c " ;; esac COMPREPLY[i++]="${2-}$c" @@ -373,11 +386,118 @@ __gitcomp () # Clear the variables caching builtins' options when (re-)sourcing # the completion script. if [[ -n ${ZSH_VERSION-} ]]; then - unset $(set |sed -ne 's/^\(__gitcomp_builtin_[a-zA-Z0-9_][a-zA-Z0-9_]*\)=.*/\1/p') 2>/dev/null + unset ${(M)${(k)parameters[@]}:#__gitcomp_builtin_*} 2>/dev/null else unset $(compgen -v __gitcomp_builtin_) fi +__gitcomp_builtin_add_default=" --dry-run --verbose --interactive --patch --edit --force --update --renormalize --intent-to-add --all --ignore-removal --refresh --ignore-errors --ignore-missing --chmod= --pathspec-from-file= --pathspec-file-nul --no-dry-run -- --no-verbose --no-interactive --no-patch --no-edit --no-force --no-update --no-renormalize --no-intent-to-add --no-all --no-ignore-removal --no-refresh --no-ignore-errors --no-ignore-missing --no-chmod --no-pathspec-from-file --no-pathspec-file-nul" +__gitcomp_builtin_am_default=" --interactive --3way --quiet --signoff --utf8 --keep --keep-non-patch --message-id --keep-cr --no-keep-cr --scissors --whitespace= --ignore-space-change --ignore-whitespace --directory= --exclude= --include= --patch-format= --reject --resolvemsg= --continue --resolved --skip --abort --quit --show-current-patch --committer-date-is-author-date --ignore-date --rerere-autoupdate --gpg-sign -- --no-interactive --no-3way --no-quiet --no-signoff --no-utf8 --no-keep --no-keep-non-patch --no-message-id --no-scissors --no-whitespace --no-ignore-space-change --no-ignore-whitespace --no-directory --no-exclude --no-include --no-patch-format --no-reject --no-resolvemsg --no-committer-date-is-author-date --no-ignore-date --no-rerere-autoupdate --no-gpg-sign" +__gitcomp_builtin_apply_default=" --exclude= --include= --no-add --stat --numstat --summary --check --index --intent-to-add --cached --apply --3way --build-fake-ancestor= --whitespace= --ignore-space-change --ignore-whitespace --reverse --unidiff-zero --reject --allow-overlap --verbose --inaccurate-eof --recount --directory= --add -- --no-stat --no-numstat --no-summary --no-check --no-index --no-intent-to-add --no-cached --no-apply --no-3way --no-build-fake-ancestor --no-whitespace --no-ignore-space-change --no-ignore-whitespace --no-reverse --no-unidiff-zero --no-reject --no-allow-overlap --no-verbose --no-inaccurate-eof --no-recount --no-directory" +__gitcomp_builtin_archive_default=" --output= --remote= --exec= --no-output -- --no-remote --no-exec" +__gitcomp_builtin_bisect__helper_default=" --next-all --write-terms --bisect-clean-state --check-expected-revs --bisect-reset --bisect-write --check-and-set-terms --bisect-next-check --bisect-terms --bisect-start --bisect-next --bisect-auto-next --bisect-autostart --no-log --log" +__gitcomp_builtin_blame_default=" --incremental --root --show-stats --progress --score-debug --show-name --show-number --porcelain --line-porcelain --show-email --ignore-rev= --ignore-revs-file= --color-lines --color-by-age --minimal --contents= --abbrev --no-incremental -- --no-root --no-show-stats --no-progress --no-score-debug --no-show-name --no-show-number --no-porcelain --no-line-porcelain --no-show-email --no-ignore-rev --no-ignore-revs-file --no-color-lines --no-color-by-age --no-minimal --no-contents --no-abbrev" +__gitcomp_builtin_branch_default=" --verbose --quiet --track --set-upstream-to= --unset-upstream --color --remotes --contains --no-contains --abbrev --all --delete --move --copy --list --show-current --create-reflog --edit-description --merged --no-merged --column --sort= --points-at= --ignore-case --format= -- --no-verbose --no-quiet --no-track --no-set-upstream-to --no-unset-upstream --no-color --no-remotes --no-abbrev --no-all --no-delete --no-move --no-copy --no-list --no-show-current --no-create-reflog --no-edit-description --no-column --no-points-at --no-ignore-case --no-format" +__gitcomp_builtin_bugreport_default=" --output-directory= --suffix= --no-output-directory -- --no-suffix" +__gitcomp_builtin_cat_file_default=" --textconv --filters --path= --allow-unknown-type --buffer --batch --batch-check --follow-symlinks --batch-all-objects --unordered --no-path -- --no-allow-unknown-type --no-buffer --no-follow-symlinks --no-batch-all-objects --no-unordered" +__gitcomp_builtin_check_attr_default=" --all --cached --stdin --no-all -- --no-cached --no-stdin" +__gitcomp_builtin_check_ignore_default=" --quiet --verbose --stdin --non-matching --no-index --index -- --no-quiet --no-verbose --no-stdin --no-non-matching" +__gitcomp_builtin_check_mailmap_default=" --stdin --no-stdin" +__gitcomp_builtin_checkout_default=" --guess --overlay --quiet --recurse-submodules --progress --merge --conflict= --detach --track --orphan= --ignore-other-worktrees --ours --theirs --patch --ignore-skip-worktree-bits --pathspec-from-file= --pathspec-file-nul --no-guess -- --no-overlay --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-detach --no-track --no-orphan --no-ignore-other-worktrees --no-patch --no-ignore-skip-worktree-bits --no-pathspec-from-file --no-pathspec-file-nul" +__gitcomp_builtin_checkout_index_default=" --all --force --quiet --no-create --index --stdin --temp --prefix= --stage= --create -- --no-all --no-force --no-quiet --no-index --no-stdin --no-temp --no-prefix" +__gitcomp_builtin_cherry_default=" --abbrev --verbose --no-abbrev -- --no-verbose" +__gitcomp_builtin_cherry_pick_default=" --quit --continue --abort --skip --cleanup= --no-commit --edit --signoff --mainline= --rerere-autoupdate --strategy= --strategy-option= --gpg-sign --ff --allow-empty --allow-empty-message --keep-redundant-commits --commit -- --no-cleanup --no-edit --no-signoff --no-mainline --no-rerere-autoupdate --no-strategy --no-strategy-option --no-gpg-sign --no-ff --no-allow-empty --no-allow-empty-message --no-keep-redundant-commits" +__gitcomp_builtin_clean_default=" --quiet --dry-run --interactive --exclude= --no-quiet -- --no-dry-run --no-interactive" +__gitcomp_builtin_clone_default=" --verbose --quiet --progress --no-checkout --bare --mirror --local --no-hardlinks --shared --recurse-submodules --recursive --jobs= --template= --reference= --reference-if-able= --dissociate --origin= --branch= --upload-pack= --depth= --shallow-since= --shallow-exclude= --single-branch --no-tags --shallow-submodules --separate-git-dir= --config= --server-option= --ipv4 --ipv6 --filter= --remote-submodules --sparse --checkout --hardlinks --tags -- --no-verbose --no-quiet --no-progress --no-bare --no-mirror --no-local --no-shared --no-recurse-submodules --no-recursive --no-jobs --no-template --no-reference --no-reference-if-able --no-dissociate --no-origin --no-branch --no-upload-pack --no-depth --no-shallow-since --no-shallow-exclude --no-single-branch --no-shallow-submodules --no-separate-git-dir --no-config --no-server-option --no-ipv4 --no-ipv6 --no-filter --no-remote-submodules --no-sparse" +__gitcomp_builtin_column_default=" --command= --mode --raw-mode= --width= --indent= --nl= --padding= --no-command -- --no-mode --no-raw-mode --no-width --no-indent --no-nl --no-padding" +__gitcomp_builtin_commit_default=" --quiet --verbose --file= --author= --date= --message= --reedit-message= --reuse-message= --fixup= --squash= --reset-author --signoff --template= --edit --cleanup= --status --gpg-sign --all --include --interactive --patch --only --no-verify --dry-run --short --branch --ahead-behind --porcelain --long --null --amend --no-post-rewrite --untracked-files --pathspec-from-file= --pathspec-file-nul --verify --post-rewrite -- --no-quiet --no-verbose --no-file --no-author --no-date --no-message --no-reedit-message --no-reuse-message --no-fixup --no-squash --no-reset-author --no-signoff --no-template --no-edit --no-cleanup --no-status --no-gpg-sign --no-all --no-include --no-interactive --no-patch --no-only --no-dry-run --no-short --no-branch --no-ahead-behind --no-porcelain --no-long --no-null --no-amend --no-untracked-files --no-pathspec-from-file --no-pathspec-file-nul" +__gitcomp_builtin_commit_graph_default=" --object-dir= --no-object-dir" +__gitcomp_builtin_config_default=" --global --system --local --worktree --file= --blob= --get --get-all --get-regexp --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section --list --edit --get-color --get-colorbool --type= --bool --int --bool-or-int --bool-or-str --path --expiry-date --null --name-only --includes --show-origin --show-scope --default= --no-global -- --no-system --no-local --no-worktree --no-file --no-blob --no-get --no-get-all --no-get-regexp --no-get-urlmatch --no-replace-all --no-add --no-unset --no-unset-all --no-rename-section --no-remove-section --no-list --no-edit --no-get-color --no-get-colorbool --no-type --no-null --no-name-only --no-includes --no-show-origin --no-show-scope --no-default" +__gitcomp_builtin_count_objects_default=" --verbose --human-readable --no-verbose -- --no-human-readable" +__gitcomp_builtin_credential_cache_default=" --timeout= --socket= --no-timeout -- --no-socket" +__gitcomp_builtin_credential_cache__daemon_default=" --debug --no-debug" +__gitcomp_builtin_credential_store_default=" --file= --no-file" +__gitcomp_builtin_describe_default=" --contains --debug --all --tags --long --first-parent --abbrev --exact-match --candidates= --match= --exclude= --always --dirty --broken --no-contains -- --no-debug --no-all --no-tags --no-long --no-first-parent --no-abbrev --no-exact-match --no-candidates --no-match --no-exclude --no-always --no-dirty --no-broken" +__gitcomp_builtin_difftool_default=" --gui --dir-diff --no-prompt --symlinks --tool= --tool-help --trust-exit-code --extcmd= --no-index -- --no-gui --no-dir-diff --no-symlinks --no-tool --no-tool-help --no-trust-exit-code --no-extcmd" +__gitcomp_builtin_env__helper_default=" --type= --default= --exit-code --no-default -- --no-exit-code" +__gitcomp_builtin_fast_export_default=" --progress= --signed-tags= --tag-of-filtered-object= --reencode= --export-marks= --import-marks= --import-marks-if-exists= --fake-missing-tagger --full-tree --use-done-feature --no-data --refspec= --anonymize --anonymize-map= --reference-excluded-parents --show-original-ids --mark-tags --data -- --no-progress --no-signed-tags --no-tag-of-filtered-object --no-reencode --no-export-marks --no-import-marks --no-import-marks-if-exists --no-fake-missing-tagger --no-full-tree --no-use-done-feature --no-refspec --no-anonymize --no-reference-excluded-parents --no-show-original-ids --no-mark-tags" +__gitcomp_builtin_fetch_default=" --verbose --quiet --all --set-upstream --append --upload-pack= --force --multiple --tags --jobs= --prune --prune-tags --recurse-submodules --dry-run --write-fetch-head --keep --update-head-ok --progress --depth= --shallow-since= --shallow-exclude= --deepen= --unshallow --update-shallow --refmap= --server-option= --ipv4 --ipv6 --negotiation-tip= --filter= --auto-maintenance --auto-gc --show-forced-updates --write-commit-graph --stdin --no-verbose -- --no-quiet --no-all --no-set-upstream --no-append --no-upload-pack --no-force --no-multiple --no-tags --no-jobs --no-prune --no-prune-tags --no-recurse-submodules --no-dry-run --no-write-fetch-head --no-keep --no-update-head-ok --no-progress --no-depth --no-shallow-since --no-shallow-exclude --no-deepen --no-update-shallow --no-server-option --no-ipv4 --no-ipv6 --no-negotiation-tip --no-filter --no-auto-maintenance --no-auto-gc --no-show-forced-updates --no-write-commit-graph --no-stdin" +__gitcomp_builtin_fmt_merge_msg_default=" --log --message= --file= --no-log -- --no-message --no-file" +__gitcomp_builtin_for_each_ref_default=" --shell --perl --python --tcl --count= --format= --color --sort= --points-at= --merged --no-merged --contains --no-contains --ignore-case -- --no-shell --no-perl --no-python --no-tcl --no-count --no-format --no-color --no-points-at --no-ignore-case" +__gitcomp_builtin_format_patch_default=" --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --to= --cc= --from --in-reply-to= --attach --inline --thread --signature= --base= --signature-file= --quiet --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-numbered --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-to --no-cc --no-from --no-in-reply-to --no-attach --no-thread --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor" +__gitcomp_builtin_fsck_default=" --verbose --unreachable --dangling --tags --root --cache --reflogs --full --connectivity-only --strict --lost-found --progress --name-objects --no-verbose -- --no-unreachable --no-dangling --no-tags --no-root --no-cache --no-reflogs --no-full --no-connectivity-only --no-strict --no-lost-found --no-progress --no-name-objects" +__gitcomp_builtin_fsck_objects_default=" --verbose --unreachable --dangling --tags --root --cache --reflogs --full --connectivity-only --strict --lost-found --progress --name-objects --no-verbose -- --no-unreachable --no-dangling --no-tags --no-root --no-cache --no-reflogs --no-full --no-connectivity-only --no-strict --no-lost-found --no-progress --no-name-objects" +__gitcomp_builtin_gc_default=" --quiet --prune --aggressive --keep-largest-pack --no-quiet -- --no-prune --no-aggressive --no-keep-largest-pack" +__gitcomp_builtin_grep_default=" --cached --no-index --untracked --exclude-standard --recurse-submodules --invert-match --ignore-case --word-regexp --text --textconv --recursive --max-depth= --extended-regexp --basic-regexp --fixed-strings --perl-regexp --line-number --column --full-name --files-with-matches --name-only --files-without-match --only-matching --count --color --break --heading --context= --before-context= --after-context= --threads= --show-function --function-context --and --or --not --quiet --all-match --index -- --no-cached --no-untracked --no-exclude-standard --no-recurse-submodules --no-invert-match --no-ignore-case --no-word-regexp --no-text --no-textconv --no-recursive --no-extended-regexp --no-basic-regexp --no-fixed-strings --no-perl-regexp --no-line-number --no-column --no-full-name --no-files-with-matches --no-name-only --no-files-without-match --no-only-matching --no-count --no-color --no-break --no-heading --no-context --no-before-context --no-after-context --no-threads --no-show-function --no-function-context --no-or --no-quiet --no-all-match" +__gitcomp_builtin_hash_object_default=" --stdin --stdin-paths --no-filters --literally --path= --filters -- --no-stdin --no-stdin-paths --no-literally --no-path" +__gitcomp_builtin_help_default=" --all --guides --config --man --web --info --verbose --no-all -- --no-guides --no-config --no-man --no-web --no-info --no-verbose" +__gitcomp_builtin_init_default=" --template= --bare --shared --quiet --separate-git-dir= --initial-branch= --object-format= --no-template -- --no-bare --no-quiet --no-separate-git-dir --no-initial-branch --no-object-format" +__gitcomp_builtin_init_db_default=" --template= --bare --shared --quiet --separate-git-dir= --initial-branch= --object-format= --no-template -- --no-bare --no-quiet --no-separate-git-dir --no-initial-branch --no-object-format" +__gitcomp_builtin_interpret_trailers_default=" --in-place --trim-empty --where= --if-exists= --if-missing= --only-trailers --only-input --unfold --parse --no-divider --trailer= --divider -- --no-in-place --no-trim-empty --no-where --no-if-exists --no-if-missing --no-only-trailers --no-only-input --no-unfold --no-trailer" +__gitcomp_builtin_log_default=" --quiet --source --use-mailmap --mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate" +__gitcomp_builtin_ls_files_default=" --cached --deleted --modified --others --ignored --stage --killed --directory --eol --empty-directory --unmerged --resolve-undo --exclude= --exclude-from= --exclude-per-directory= --exclude-standard --full-name --recurse-submodules --error-unmatch --with-tree= --abbrev --debug --no-cached -- --no-deleted --no-modified --no-others --no-ignored --no-stage --no-killed --no-directory --no-eol --no-empty-directory --no-unmerged --no-resolve-undo --no-exclude-per-directory --no-recurse-submodules --no-error-unmatch --no-with-tree --no-abbrev --no-debug" +__gitcomp_builtin_ls_remote_default=" --quiet --upload-pack= --tags --heads --refs --get-url --sort= --symref --server-option= --no-quiet -- --no-upload-pack --no-tags --no-heads --no-refs --no-get-url --no-symref --no-server-option" +__gitcomp_builtin_ls_tree_default=" --long --name-only --name-status --full-name --full-tree --abbrev --no-long -- --no-name-only --no-name-status --no-full-name --no-full-tree --no-abbrev" +__gitcomp_builtin_merge_default=" --stat --summary --log --squash --commit --edit --cleanup= --ff --ff-only --rerere-autoupdate --verify-signatures --strategy= --strategy-option= --message= --file --verbose --quiet --abort --quit --continue --allow-unrelated-histories --progress --gpg-sign --autostash --overwrite-ignore --signoff --no-verify --verify -- --no-stat --no-summary --no-log --no-squash --no-commit --no-edit --no-cleanup --no-ff --no-rerere-autoupdate --no-verify-signatures --no-strategy --no-strategy-option --no-message --no-verbose --no-quiet --no-abort --no-quit --no-continue --no-allow-unrelated-histories --no-progress --no-gpg-sign --no-autostash --no-overwrite-ignore --no-signoff" +__gitcomp_builtin_merge_base_default=" --all --octopus --independent --is-ancestor --fork-point --no-all" +__gitcomp_builtin_merge_file_default=" --stdout --diff3 --ours --theirs --union --marker-size= --quiet --no-stdout -- --no-diff3 --no-ours --no-theirs --no-union --no-marker-size --no-quiet" +__gitcomp_builtin_mktree_default=" --missing --batch --no-missing -- --no-batch" +__gitcomp_builtin_multi_pack_index_default=" --object-dir= --progress --batch-size= --no-object-dir -- --no-progress" +__gitcomp_builtin_mv_default=" --verbose --dry-run --no-verbose -- --no-dry-run" +__gitcomp_builtin_name_rev_default=" --name-only --tags --refs= --exclude= --all --stdin --undefined --always --no-name-only -- --no-tags --no-refs --no-exclude --no-all --no-stdin --no-undefined --no-always" +__gitcomp_builtin_notes_default=" --ref= --no-ref" +__gitcomp_builtin_pack_objects_default=" --quiet --progress --all-progress --all-progress-implied --index-version= --max-pack-size= --local --incremental --window= --window-memory= --depth= --reuse-delta --reuse-object --delta-base-offset --threads= --non-empty --revs --unpacked --all --reflog --indexed-objects --stdout --include-tag --keep-unreachable --pack-loose-unreachable --unpack-unreachable --sparse --thin --shallow --honor-pack-keep --keep-pack= --compression= --keep-true-parents --use-bitmap-index --write-bitmap-index --filter= --missing= --exclude-promisor-objects --delta-islands --uri-protocol= --no-quiet -- --no-progress --no-all-progress --no-all-progress-implied --no-local --no-incremental --no-window --no-depth --no-reuse-delta --no-reuse-object --no-delta-base-offset --no-threads --no-non-empty --no-revs --no-stdout --no-include-tag --no-keep-unreachable --no-pack-loose-unreachable --no-unpack-unreachable --no-sparse --no-thin --no-shallow --no-honor-pack-keep --no-keep-pack --no-compression --no-keep-true-parents --no-use-bitmap-index --no-write-bitmap-index --no-filter --no-exclude-promisor-objects --no-delta-islands --no-uri-protocol" +__gitcomp_builtin_pack_refs_default=" --all --prune --no-all -- --no-prune" +__gitcomp_builtin_pickaxe_default=" --incremental --root --show-stats --progress --score-debug --show-name --show-number --porcelain --line-porcelain --show-email --ignore-rev= --ignore-revs-file= --color-lines --color-by-age --minimal --contents= --abbrev --no-incremental -- --no-root --no-show-stats --no-progress --no-score-debug --no-show-name --no-show-number --no-porcelain --no-line-porcelain --no-show-email --no-ignore-rev --no-ignore-revs-file --no-color-lines --no-color-by-age --no-minimal --no-contents --no-abbrev" +__gitcomp_builtin_prune_default=" --dry-run --verbose --progress --expire= --exclude-promisor-objects --no-dry-run -- --no-verbose --no-progress --no-expire --no-exclude-promisor-objects" +__gitcomp_builtin_prune_packed_default=" --dry-run --quiet --no-dry-run -- --no-quiet" +__gitcomp_builtin_pull_default=" --verbose --quiet --progress --recurse-submodules --rebase --stat --log --signoff --squash --commit --edit --cleanup= --ff --ff-only --verify-signatures --autostash --strategy= --strategy-option= --gpg-sign --allow-unrelated-histories --all --append --upload-pack= --force --tags --prune --jobs --dry-run --keep --depth= --shallow-since= --shallow-exclude= --deepen= --unshallow --update-shallow --refmap= --server-option= --ipv4 --ipv6 --negotiation-tip= --show-forced-updates --set-upstream --no-verbose -- --no-quiet --no-progress --no-recurse-submodules --no-rebase --no-stat --no-log --no-signoff --no-squash --no-commit --no-edit --no-cleanup --no-ff --no-verify-signatures --no-autostash --no-strategy --no-strategy-option --no-gpg-sign --no-allow-unrelated-histories --no-all --no-append --no-upload-pack --no-force --no-tags --no-prune --no-jobs --no-dry-run --no-keep --no-depth --no-shallow-since --no-shallow-exclude --no-deepen --no-update-shallow --no-server-option --no-ipv4 --no-ipv6 --no-negotiation-tip --no-show-forced-updates --no-set-upstream" +__gitcomp_builtin_push_default=" --verbose --quiet --repo= --all --mirror --delete --tags --dry-run --porcelain --force --force-with-lease --recurse-submodules= --receive-pack= --exec= --set-upstream --progress --prune --no-verify --follow-tags --signed --atomic --push-option= --ipv4 --ipv6 --verify -- --no-verbose --no-quiet --no-repo --no-all --no-mirror --no-delete --no-tags --no-dry-run --no-porcelain --no-force --no-force-with-lease --no-recurse-submodules --no-receive-pack --no-exec --no-set-upstream --no-progress --no-prune --no-follow-tags --no-signed --no-atomic --no-push-option --no-ipv4 --no-ipv6" +__gitcomp_builtin_range_diff_default=" --creation-factor= --no-dual-color --notes --patch --no-patch --unified --function-context --raw --patch-with-raw --patch-with-stat --numstat --shortstat --dirstat --cumulative --dirstat-by-file --check --summary --name-only --name-status --stat --stat-width= --stat-name-width= --stat-graph-width= --stat-count= --compact-summary --binary --full-index --color --ws-error-highlight= --abbrev --src-prefix= --dst-prefix= --line-prefix= --no-prefix --inter-hunk-context= --output-indicator-new= --output-indicator-old= --output-indicator-context= --break-rewrites --find-renames --irreversible-delete --find-copies --find-copies-harder --no-renames --rename-empty --follow --minimal --ignore-all-space --ignore-space-change --ignore-space-at-eol --ignore-cr-at-eol --ignore-blank-lines --indent-heuristic --patience --histogram --diff-algorithm= --anchored= --word-diff --word-diff-regex= --color-words --color-moved --color-moved-ws= --relative --text --exit-code --quiet --ext-diff --textconv --ignore-submodules --submodule --ita-invisible-in-index --ita-visible-in-index --pickaxe-all --pickaxe-regex --find-object= --diff-filter= --output= --dual-color -- --no-creation-factor --no-notes --no-function-context --no-compact-summary --no-full-index --no-color --no-abbrev --no-find-copies-harder --no-rename-empty --no-follow --no-minimal --no-indent-heuristic --no-color-moved --no-color-moved-ws --no-relative --no-text --no-exit-code --no-quiet --no-ext-diff --no-textconv" +__gitcomp_builtin_read_tree_default=" --index-output= --empty --verbose --trivial --aggressive --reset --prefix= --exclude-per-directory= --dry-run --no-sparse-checkout --debug-unpack --recurse-submodules --quiet --sparse-checkout -- --no-empty --no-verbose --no-trivial --no-aggressive --no-reset --no-dry-run --no-debug-unpack --no-recurse-submodules --no-quiet" +__gitcomp_builtin_rebase_default=" --onto= --keep-base --no-verify --quiet --verbose --no-stat --signoff --committer-date-is-author-date --reset-author-date --ignore-whitespace --whitespace= --force-rebase --no-ff --continue --skip --abort --quit --edit-todo --show-current-patch --apply --merge --interactive --rerere-autoupdate --empty= --autosquash --gpg-sign --autostash --exec= --rebase-merges --fork-point --strategy= --strategy-option= --root --reschedule-failed-exec --reapply-cherry-picks --verify --stat --ff -- --no-onto --no-keep-base --no-quiet --no-verbose --no-signoff --no-committer-date-is-author-date --no-reset-author-date --no-ignore-whitespace --no-whitespace --no-force-rebase --no-rerere-autoupdate --no-autosquash --no-gpg-sign --no-autostash --no-exec --no-rebase-merges --no-fork-point --no-strategy --no-strategy-option --no-root --no-reschedule-failed-exec --no-reapply-cherry-picks" +__gitcomp_builtin_rebase__interactive_default=" --ff --rebase-merges --rebase-cousins --autosquash --signoff --verbose --continue --skip --edit-todo --show-current-patch --shorten-ids --expand-ids --check-todo-list --rearrange-squash --add-exec-commands --onto= --restrict-revision= --squash-onto= --upstream= --head-name= --gpg-sign --strategy= --strategy-opts= --switch-to= --onto-name= --cmd= --rerere-autoupdate --reschedule-failed-exec --no-ff -- --no-rebase-merges --no-rebase-cousins --no-autosquash --no-signoff --no-verbose --no-head-name --no-gpg-sign --no-strategy --no-strategy-opts --no-switch-to --no-onto-name --no-cmd --no-rerere-autoupdate --no-reschedule-failed-exec" +__gitcomp_builtin_receive_pack_default=" --quiet --no-quiet" +__gitcomp_builtin_reflog_default=" --quiet --source --use-mailmap --mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate" +__gitcomp_builtin_remote_default=" --verbose --no-verbose" +__gitcomp_builtin_repack_default=" --quiet --local --write-bitmap-index --delta-islands --unpack-unreachable= --keep-unreachable --window= --window-memory= --depth= --threads= --max-pack-size= --pack-kept-objects --keep-pack= --no-quiet -- --no-local --no-write-bitmap-index --no-delta-islands --no-unpack-unreachable --no-keep-unreachable --no-window --no-window-memory --no-depth --no-threads --no-max-pack-size --no-pack-kept-objects --no-keep-pack" +__gitcomp_builtin_replace_default=" --list --delete --edit --graft --convert-graft-file --raw --format= --no-raw -- --no-format" +__gitcomp_builtin_rerere_default=" --rerere-autoupdate --no-rerere-autoupdate" +__gitcomp_builtin_reset_default=" --quiet --mixed --soft --hard --merge --keep --recurse-submodules --patch --intent-to-add --pathspec-from-file= --pathspec-file-nul --no-quiet -- --no-mixed --no-soft --no-hard --no-merge --no-keep --no-recurse-submodules --no-patch --no-intent-to-add --no-pathspec-from-file --no-pathspec-file-nul" +__gitcomp_builtin_restore_default=" --source= --staged --worktree --ignore-unmerged --overlay --quiet --recurse-submodules --progress --merge --conflict= --ours --theirs --patch --ignore-skip-worktree-bits --pathspec-from-file= --pathspec-file-nul --no-source -- --no-staged --no-worktree --no-ignore-unmerged --no-overlay --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-patch --no-ignore-skip-worktree-bits --no-pathspec-from-file --no-pathspec-file-nul" +__gitcomp_builtin_revert_default=" --quit --continue --abort --skip --cleanup= --no-commit --edit --signoff --mainline= --rerere-autoupdate --strategy= --strategy-option= --gpg-sign --commit -- --no-cleanup --no-edit --no-signoff --no-mainline --no-rerere-autoupdate --no-strategy --no-strategy-option --no-gpg-sign" +__gitcomp_builtin_rm_default=" --dry-run --quiet --cached --ignore-unmatch --pathspec-from-file= --pathspec-file-nul --no-dry-run -- --no-quiet --no-cached --no-ignore-unmatch --no-pathspec-from-file --no-pathspec-file-nul" +__gitcomp_builtin_send_pack_default=" --verbose --quiet --receive-pack= --exec= --remote= --all --dry-run --mirror --force --signed --push-option= --progress --thin --atomic --stateless-rpc --stdin --helper-status --force-with-lease --no-verbose -- --no-quiet --no-receive-pack --no-exec --no-remote --no-all --no-dry-run --no-mirror --no-force --no-signed --no-push-option --no-progress --no-thin --no-atomic --no-stateless-rpc --no-stdin --no-helper-status --no-force-with-lease" +__gitcomp_builtin_shortlog_default=" --committer --numbered --summary --email --group= --no-committer -- --no-numbered --no-summary --no-email --no-group" +__gitcomp_builtin_show_default=" --quiet --source --use-mailmap --mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate" +__gitcomp_builtin_show_branch_default=" --all --remotes --color --more --list --no-name --current --sha1-name --merge-base --independent --topo-order --topics --sparse --date-order --reflog --name -- --no-all --no-remotes --no-color --no-more --no-list --no-current --no-sha1-name --no-merge-base --no-independent --no-topo-order --no-topics --no-sparse --no-date-order" +__gitcomp_builtin_show_index_default=" --object-format= --no-object-format" +__gitcomp_builtin_show_ref_default=" --tags --heads --verify --head --dereference --hash --abbrev --quiet --exclude-existing --no-tags -- --no-heads --no-verify --no-head --no-dereference --no-hash --no-abbrev --no-quiet" +__gitcomp_builtin_sparse_checkout_default="" +__gitcomp_builtin_stage_default=" --dry-run --verbose --interactive --patch --edit --force --update --renormalize --intent-to-add --all --ignore-removal --refresh --ignore-errors --ignore-missing --chmod= --pathspec-from-file= --pathspec-file-nul --no-dry-run -- --no-verbose --no-interactive --no-patch --no-edit --no-force --no-update --no-renormalize --no-intent-to-add --no-all --no-ignore-removal --no-refresh --no-ignore-errors --no-ignore-missing --no-chmod --no-pathspec-from-file --no-pathspec-file-nul" +__gitcomp_builtin_stash_default="" +__gitcomp_builtin_status_default=" --verbose --short --branch --show-stash --ahead-behind --porcelain --long --null --untracked-files --ignored --ignore-submodules --column --no-renames --find-renames --renames -- --no-verbose --no-short --no-branch --no-show-stash --no-ahead-behind --no-porcelain --no-long --no-null --no-untracked-files --no-ignored --no-ignore-submodules --no-column" +__gitcomp_builtin_stripspace_default=" --strip-comments --comment-lines" +__gitcomp_builtin_switch_default=" --create= --force-create= --guess --discard-changes --quiet --recurse-submodules --progress --merge --conflict= --detach --track --orphan= --ignore-other-worktrees --no-create -- --no-force-create --no-guess --no-discard-changes --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-detach --no-track --no-orphan --no-ignore-other-worktrees" +__gitcomp_builtin_symbolic_ref_default=" --quiet --delete --short --no-quiet -- --no-delete --no-short" +__gitcomp_builtin_tag_default=" --list --delete --verify --annotate --message= --file= --edit --sign --cleanup= --local-user= --force --create-reflog --column --contains --no-contains --merged --no-merged --sort= --points-at --format= --color --ignore-case -- --no-annotate --no-file --no-edit --no-sign --no-cleanup --no-local-user --no-force --no-create-reflog --no-column --no-points-at --no-format --no-color --no-ignore-case" +__gitcomp_builtin_update_index_default=" --ignore-submodules --add --replace --remove --unmerged --refresh --really-refresh --cacheinfo --chmod= --assume-unchanged --no-assume-unchanged --skip-worktree --no-skip-worktree --ignore-skip-worktree-entries --info-only --force-remove --stdin --index-info --unresolve --again --ignore-missing --verbose --clear-resolve-undo --index-version= --split-index --untracked-cache --test-untracked-cache --force-untracked-cache --force-write-index --fsmonitor --fsmonitor-valid --no-fsmonitor-valid -- --no-ignore-submodules --no-add --no-replace --no-remove --no-unmerged --no-ignore-skip-worktree-entries --no-info-only --no-force-remove --no-ignore-missing --no-verbose --no-index-version --no-split-index --no-untracked-cache --no-test-untracked-cache --no-force-untracked-cache --no-force-write-index --no-fsmonitor" +__gitcomp_builtin_update_ref_default=" --no-deref --stdin --create-reflog --deref -- --no-stdin --no-create-reflog" +__gitcomp_builtin_update_server_info_default=" --force --no-force" +__gitcomp_builtin_upload_pack_default=" --stateless-rpc --advertise-refs --strict --timeout= --no-stateless-rpc -- --no-advertise-refs --no-strict --no-timeout" +__gitcomp_builtin_verify_commit_default=" --verbose --raw --no-verbose -- --no-raw" +__gitcomp_builtin_verify_pack_default=" --verbose --stat-only --object-format= --no-verbose -- --no-stat-only --no-object-format" +__gitcomp_builtin_verify_tag_default=" --verbose --raw --format= --no-verbose -- --no-raw --no-format" +__gitcomp_builtin_version_default=" --build-options --no-build-options" +__gitcomp_builtin_whatchanged_default=" --quiet --source --use-mailmap --mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate" +__gitcomp_builtin_write_tree_default=" --missing-ok --prefix= --no-missing-ok -- --no-prefix" +__gitcomp_builtin_send_email_default=" --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --to= --cc= --from --in-reply-to= --attach --inline --thread --signature= --base= --signature-file= --quiet --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-numbered --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-to --no-cc --no-from --no-in-reply-to --no-attach --no-thread --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor" + +__gitcomp_builtin_get_default () +{ + eval "test -n \"\$${1}_default\" && echo \"\$${1}_default\"" +} + # This function is equivalent to # # __gitcomp "$(git xxx --git-completion-helper) ..." @@ -391,17 +511,25 @@ __gitcomp_builtin () # spaces must be replaced with underscore for multi-word # commands, e.g. "git remote add" becomes remote_add. local cmd="$1" - local incl="$2" - local excl="$3" + local incl="${2-}" + local excl="${3-}" - local var=__gitcomp_builtin_"${cmd/-/_}" + local var=__gitcomp_builtin_"${cmd//-/_}" local options - eval "options=\$$var" + eval "options=\${$var-}" if [ -z "$options" ]; then + local completion_helper + if [ "$GIT_COMPLETION_SHOW_ALL" = "1" ]; then + completion_helper="--git-completion-helper-all" + else + completion_helper="--git-completion-helper" + fi + completion="$(__git ${cmd/_/ } $completion_helper || + __gitcomp_builtin_get_default $var)" || return # leading and trailing spaces are significant to make # option removal work correctly. - options=" $incl $(__git ${cmd/_/ } --git-completion-helper) " || return + options=" $incl $completion " for i in $excl; do options="${options/ $i / }" @@ -504,7 +632,7 @@ __git_index_files () { local root="$2" match="$3" - __git_ls_files_helper "$root" "$1" "$match" | + __git_ls_files_helper "$root" "$1" "${match:-?}" | awk -F / -v pfx="${2//\\/\\\\}" '{ paths[$1] = 1 } @@ -524,7 +652,7 @@ __git_index_files () # Even when a directory name itself does not contain # any special characters, it will still be quoted if # any of its (stripped) trailing path components do. - # Because of this we may have seen the same direcory + # Because of this we may have seen the same directory # both quoted and unquoted. if (p in paths) # We have seen the same directory unquoted, @@ -550,7 +678,7 @@ __git_index_files () esc_idx, 1) } else if (esc == "n") { # Uh-oh, a newline character. - # We cant reliably put a pathname + # We cannot reliably put a pathname # containing a newline into COMPREPLY, # and the newline would create a mess. # Skip this path. @@ -565,7 +693,7 @@ __git_index_files () } } # Drop closing double quote, if there is one. - # (There isnt any if this is a directory, as it was + # (There is not any if this is a directory, as it was # already stripped with the trailing path components.) if (substr(p, length(p), 1) == "\"") out = out substr(p, 1, length(p) - 1) @@ -611,6 +739,19 @@ __git_heads () "refs/heads/$cur_*" "refs/heads/$cur_*/**" } +# Lists branches from remote repositories. +# 1: A prefix to be added to each listed branch (optional). +# 2: List only branches matching this word (optional; list all branches if +# unset or empty). +# 3: A suffix to be appended to each listed branch (optional). +__git_remote_heads () +{ + local pfx="${1-}" cur_="${2-}" sfx="${3-}" + + __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ + "refs/remotes/$cur_*" "refs/remotes/$cur_*/**" +} + # Lists tags from the local repository. # Accepts the same positional parameters as __git_heads() above. __git_tags () @@ -621,6 +762,26 @@ __git_tags () "refs/tags/$cur_*" "refs/tags/$cur_*/**" } +# List unique branches from refs/remotes used for 'git checkout' and 'git +# switch' tracking DWIMery. +# 1: A prefix to be added to each listed branch (optional) +# 2: List only branches matching this word (optional; list all branches if +# unset or empty). +# 3: A suffix to be appended to each listed branch (optional). +__git_dwim_remote_heads () +{ + local pfx="${1-}" cur_="${2-}" sfx="${3-}" + local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers + + # employ the heuristic used by git checkout and git switch + # Try to find a remote branch that cur_es the completion word + # but only output if the branch name is unique + __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \ + --sort="refname:strip=3" \ + "refs/remotes/*/$cur_*" "refs/remotes/*/$cur_*/**" | \ + uniq -u +} + # Lists refs from the local (by default) or from a remote repository. # It accepts 0, 1 or 2 arguments: # 1: The remote to list refs from (optional; ignored, if set but empty). @@ -696,13 +857,7 @@ __git_refs () __git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" \ "${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 - __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \ - --sort="refname:strip=3" \ - "refs/remotes/*/$match*" "refs/remotes/*/$match*/**" | \ - uniq -u + __git_dwim_remote_heads "$pfx" "$match" "$sfx" fi return fi @@ -749,29 +904,51 @@ __git_refs () # Usage: __git_complete_refs [