diff options
-rw-r--r-- | CONTRIBUTING.md | 42 | ||||
-rw-r--r-- | README.textile | 1 | ||||
-rw-r--r-- | lib/aliases.zsh | 1 | ||||
-rw-r--r-- | lib/functions.zsh | 4 | ||||
-rw-r--r-- | lib/termsupport.zsh | 5 | ||||
-rw-r--r-- | oh-my-zsh.sh | 2 | ||||
-rw-r--r-- | plugins/aws/aws.plugin.zsh | 15 | ||||
-rw-r--r-- | plugins/brew/_brew | 1 | ||||
-rw-r--r-- | plugins/brew/brew.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/bundler/README.md | 49 | ||||
-rw-r--r-- | plugins/bundler/_bundler | 13 | ||||
-rw-r--r-- | plugins/bundler/bundler.plugin.zsh | 45 | ||||
-rw-r--r-- | plugins/composer/composer.plugin.zsh | 4 | ||||
-rw-r--r-- | plugins/git/git.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/rvm/rvm.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/symfony2/symfony2.plugin.zsh | 17 | ||||
-rw-r--r-- | plugins/tmuxinator/_tmuxinator | 6 | ||||
-rw-r--r-- | tools/check_for_upgrade.sh | 2 | ||||
-rwxr-xr-x | tools/install.sh | 4 |
19 files changed, 186 insertions, 31 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..9964c380d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,42 @@ +# CONTRIBUTING GUIDELINE + +1. [Luke, use the search](#luke-use-the-search) +2. [You have a problem](#you-have-a-problem) +3. [You have a solution](#you-have-a-solution) + +**BONUS:** [You have free time to volunteer](#you-have-free-time-to-volunteer) + +## LUKE, USE THE SEARCH + +May the experiences of other people be with you + + +## YOU HAVE A PROBLEM + +See point 1, then look at FAQ or Troubleshooting wiki pages (first we'll have to make them) + + +## YOU HAVE A SOLUTION + +See point 1, then go ahead (unless your solution is yet another theme) + + +## YOU HAVE FREE TIME TO VOLUNTEER + +Cool! Please have a look at the list below to understand how oh-my-zsh categorizes its issues. + +Classification of issues and + +- Bugs, which may be: + - Specific of zsh \* + - Regressions, in which we should summon the author of the offending commit once it is located + +- Feature requests + +- Helpdesk, which may be: + - Specific of zsh \* + - Everything else + +\* In the case of bugs, I see the benefit in going through the trouble of responding to that. After all, oh-my-zsh should be the missing link that makes zsh perfect, and hunting down an upstream bug can lead to a submitted PR. +In the case of helpdesk, minimal response should be done. That is, provide a link to the wiki with the relevant information, or +add it to the FAQ of the wiki and point to it afterwards. diff --git a/README.textile b/README.textile index 28bab6b2c..5900c95d8 100644 --- a/README.textile +++ b/README.textile @@ -7,6 +7,7 @@ bq. "OH MY ZSHELL!" h2. Setup @oh-my-zsh@ should work with any recent release of "zsh":http://www.zsh.org/, the minimum recommended version is 4.3.9. +If not already, install zsh using the command line first. h3. The automatic installer... (do you trust me?) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 3044c9660..aae865046 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -30,7 +30,6 @@ alias lsa='ls -lah' alias l='ls -lah' alias ll='ls -lh' alias la='ls -lAh' -alias sl=ls # often screw this up alias afind='ack-grep -il' diff --git a/lib/functions.zsh b/lib/functions.zsh index fda84a953..17f5f9cbf 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -3,11 +3,11 @@ function zsh_stats() { } function uninstall_oh_my_zsh() { - /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh + env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh } function upgrade_oh_my_zsh() { - /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh + env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh } function take() { diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 9c0a430fb..9d6681603 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -34,6 +34,5 @@ function omz_termsupport_preexec { title '$CMD' '%100>...>$LINE%<<' } -autoload -U add-zsh-hook -add-zsh-hook precmd omz_termsupport_precmd -add-zsh-hook preexec omz_termsupport_preexec +precmd_functions+=(omz_termsupport_precmd) +preexec_functions+=(omz_termsupport_preexec) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c217b91bb..a90b3e98a 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,6 +1,6 @@ # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then - /usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh + env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh fi # Initializes Oh My Zsh diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index 3f7fb1995..8b57d7db1 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -1,3 +1,11 @@ +_homebrew-installed() { + type brew &> /dev/null +} + +_awscli-homebrew-installed() { + brew --prefix awscli &> /dev/null +} + export AWS_HOME=~/.aws function agp { @@ -14,4 +22,9 @@ function aws_profiles { } compctl -K aws_profiles asp -source `which aws_zsh_completer.sh` + +if _homebrew-installed && _awscli-homebrew-installed ; then + source $(brew --prefix)/opt/awscli/libexec/bin/aws_zsh_completer.sh +else + source `which aws_zsh_completer.sh` +fi diff --git a/plugins/brew/_brew b/plugins/brew/_brew index 9eb3bb557..40442a1d3 100644 --- a/plugins/brew/_brew +++ b/plugins/brew/_brew @@ -50,6 +50,7 @@ _1st_arguments=( 'server:start a local web app that lets you browse formulae (requires Sinatra)' 'services:small wrapper around `launchctl` for supported formulae' 'tap:tap a new formula repository from GitHub, or list existing taps' + 'uninstall:uninstall a formula' 'unlink:unlink a formula' 'unpin:unpin specified formulae' 'untap:remove a tapped repository' diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index f9497aefb..42fb80c9a 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -1,2 +1,2 @@ alias brews='brew list -1' -alias bubu="brew update && brew upgrade" +alias bubu="brew update && brew upgrade && brew cleanup" diff --git a/plugins/bundler/README.md b/plugins/bundler/README.md new file mode 100644 index 000000000..56f0c7176 --- /dev/null +++ b/plugins/bundler/README.md @@ -0,0 +1,49 @@ +# Bundler + +- adds completion for basic bundler commands +- adds short aliases for common bundler commands + - `be` aliased to `bundle exec` + - `bl` aliased to `bundle list` + - `bp` aliased to `bundle package` + - `bo` aliased to `bundle open` + - `bu` aliased to `bundle update` + - `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`) +- adds a wrapper for common gems: + - looks for a binstub under `./bin/` and executes it (if present) + - calls `bundle exec <gem executable>` otherwise + +For a full list of *common gems* being wrapped by default please look at the `bundler.plugin.zsh` file. + +## Configuration + +Please use the exact name of the executable and not the gem name. + +### Add additional gems to be wrapped + +Add this before the plugin-list in your `.zshrc`: +```sh +BUNDLED_COMMANDS=(rubocop) +plugins=(... bundler ...) +``` +This will add the wrapper for the `rubocop` gem (i.e. the executable). + + +### Exclude gems from being wrapped + +Add this before the plugin-list in your `.zshrc`: +```sh +UNBUNDLED_COMMANDS=(foreman spin) +plugins=(... bundler ...) +``` +This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped. + +## Excluded gems + +These gems should not be called with `bundle exec`. Please see the Issues on GitHub for clarification. + +`berks` +`foreman` +`mailcatcher` +`rails` +`ruby` +`spin` diff --git a/plugins/bundler/_bundler b/plugins/bundler/_bundler index 2ec3a5f9c..ba647ab80 100644 --- a/plugins/bundler/_bundler +++ b/plugins/bundler/_bundler @@ -18,11 +18,13 @@ case $state in "check[Determine whether the requirements for your application are installed]" \ "list[Show all of the gems in the current bundle]" \ "show[Show the source location of a particular gem in the bundle]" \ + "outdated[Show all of the outdated gems in the current bundle]" \ "console[Start an IRB session in the context of the current bundle]" \ "open[Open an installed gem in the editor]" \ "viz[Generate a visual representation of your dependencies]" \ "init[Generate a simple Gemfile, placed in the current directory]" \ "gem[Create a simple gem, suitable for development with bundler]" \ + "platform[Displays platform compatibility information]" \ "clean[Cleans up unused gems in your bundler directory]" \ "help[Describe available tasks or one specific task]" ret=0 @@ -39,11 +41,13 @@ case $state in 'check' \ 'list' \ 'show' \ + 'outdated' \ 'console' \ 'open' \ 'viz' \ 'init' \ 'gem' \ + 'platform' \ 'help' && ret=0 ;; install) @@ -71,6 +75,15 @@ case $state in '(--verbose)--verbose[Enable verbose output mode]' ret=0 ;; + outdated) + _arguments \ + '(--pre)--pre[Check for newer pre-release gems]' \ + '(--source)--source[Check against a specific source]' \ + '(--local)--local[Do not attempt to fetch gems remotely and use the gem cache instead]' \ + '(--no-color)--no-color[Disable colorization in output]' \ + '(--verbose)--verbose[Enable verbose output mode]' + ret=0 + ;; (open|show) _gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') ) if [[ $_gems != "" ]]; then diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index fbdbc0244..617dcde71 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -5,15 +5,49 @@ alias bo="bundle open" alias bu="bundle update" alias bi="bundle_install" -# The following is based on https://github.com/gma/bundler-exec - -bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard irb jekyll kitchen knife middleman nanoc puma rackup rainbows rake rspec ruby shotgun spec spin spork spring strainer tailor taps thin thor unicorn unicorn_rails) +bundled_commands=( + annotate + cap + capify + cucumber + foodcritic + guard + irb + jekyll + kitchen + knife + middleman + nanoc + pry + puma + rackup + rainbows + rake + rspec + shotgun + sidekiq + spec + spork + spring + strainer + tailor + taps + thin + thor + unicorn + unicorn_rails +) # Remove $UNBUNDLED_COMMANDS from the bundled_commands list for cmd in $UNBUNDLED_COMMANDS; do bundled_commands=(${bundled_commands#$cmd}); done +# Add $BUNDLED_COMMANDS to the bundled_commands list +for cmd in $BUNDLED_COMMANDS; do + bundled_commands+=($cmd); +done + ## Functions bundle_install() { @@ -55,7 +89,7 @@ _binstubbed() { _run-with-bundler() { if _bundler-installed && _within-bundled-project; then if _binstubbed $1; then - bundle exec "./bin/$@" + ./bin/$@ else bundle exec $@ fi @@ -71,7 +105,6 @@ for cmd in $bundled_commands; do alias $cmd=bundled_$cmd if which _$cmd > /dev/null 2>&1; then - compdef _$cmd bundled_$cmd=$cmd + compdef _$cmd bundled_$cmd=$cmd fi done - diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh index 86f2ca4df..2243dd3c1 100644 --- a/plugins/composer/composer.plugin.zsh +++ b/plugins/composer/composer.plugin.zsh @@ -47,5 +47,5 @@ alias cdu='composer dump-autoload' # install composer in the current directory alias cget='curl -s https://getcomposer.org/installer | php' -# Add Composer's global binaries to PATH -export PATH=$PATH:~/.composer/vendor/bin +# Add Composer's global & local binaries to PATH +export PATH=$PATH:~/.composer/vendor/bin:./bin diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 9f7819df3..a76bb1cdf 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -7,6 +7,8 @@ alias gd='git diff' compdef _git gd=git-diff alias gdc='git diff --cached' compdef _git gdc=git-diff +alias gdt='git diff-tree --no-commit-id --name-only -r' +compdef _git gdc=git diff-tree --no-commit-id --name-only -r alias gl='git pull' compdef _git gl=git-pull alias gup='git pull --rebase' diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index ad23e18d7..234ac1642 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -6,7 +6,7 @@ alias gemsets='rvm gemset list' local ruby18='ruby-1.8.7' local ruby19='ruby-1.9.3' local ruby20='ruby-2.0.0' -local ruby21='ruby-2.1.1' +local ruby21='ruby-2.1.2' function rb18 { if [ -z "$1" ]; then diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh index 4c07349a4..1d5177e6d 100644 --- a/plugins/symfony2/symfony2.plugin.zsh +++ b/plugins/symfony2/symfony2.plugin.zsh @@ -1,22 +1,23 @@ # Symfony2 basic command completion _symfony2_get_command_list () { - php app/console --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }' + php $(find . -maxdepth 2 -mindepth 1 -name 'console') --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }' } _symfony2 () { - if [ -f app/console ]; then + if [ -f $(find . -maxdepth 2 -mindepth 1 -name 'console') ]; then compadd `_symfony2_get_command_list` fi } -compdef _symfony2 app/console +compdef _symfony2 $(find . -maxdepth 2 -mindepth 1 -name 'console') compdef _symfony2 sf #Alias -alias sf='php app/console' -alias sfcl='php app/console cache:clear' -alias sfroute='php app/console router:debug' -alias sfcontainer='php app/console container:debug' -alias sfgb='php app/console generate:bundle' +alias sf='php $(find . -maxdepth 2 -mindepth 1 -name 'console') ' +alias sfcl='php $(find . -maxdepth 2 -mindepth 1 -name 'console') cache:clear' +alias sfcw='php $(find . -maxdepth 2 -mindepth 1 -name 'console') cache:warmup' +alias sfroute='php $(find . -maxdepth 2 -mindepth 1 -name 'console') router:debug' +alias sfcontainer='php $(find . -maxdepth 2 -mindepth 1 -name 'console') container:debug' +alias sfgb='php $(find . -maxdepth 2 -mindepth 1 -name 'console') generate:bundle' diff --git a/plugins/tmuxinator/_tmuxinator b/plugins/tmuxinator/_tmuxinator index cd227b7df..e4f8b6ce0 100644 --- a/plugins/tmuxinator/_tmuxinator +++ b/plugins/tmuxinator/_tmuxinator @@ -11,10 +11,12 @@ _arguments -C \ case $state in cmds) _values "tmuxinator command" \ + "new[create a new project file and open it in your editor]" \ "start[start a tmux session using project's tmuxinator config]" \ "open[create a new project file and open it in your editor]" \ "copy[copy source_project project file to a new project called new_project]" \ "delete[deletes the project called project_name]" \ + "debug[output the shell commands generated by a projet]" \ "implode[deletes all existing projects!]" \ "list[list all existing projects]" \ "doctor[look for problems in your configuration]" \ @@ -24,9 +26,9 @@ case $state in ;; args) case $line[1] in - start|open|copy|delete) + start|open|copy|delete|debug) _configs=(`find ~/.tmuxinator -name \*.yml | cut -d/ -f5 | sed s:.yml::g`) - _values 'configs' $_configs + [[ -n "$_configs" ]] && _values 'configs' $_configs ret=0 ;; esac diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 8b8ecae03..35e074297 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -9,7 +9,7 @@ function _update_zsh_update() { } function _upgrade_zsh() { - /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh + env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh # update the zsh file _update_zsh_update } diff --git a/tools/install.sh b/tools/install.sh index fc7ad70cf..7efab10b9 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -10,7 +10,7 @@ if [ -d "$ZSH" ]; then fi echo "\033[0;34mCloning Oh My Zsh...\033[0m" -hash git >/dev/null 2>&1 && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { +hash git >/dev/null 2>&1 && env git clone https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { echo "git not installed" exit } @@ -43,5 +43,5 @@ echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m" echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m" echo "\n\n \033[0;32mp.s. Follow us at http://twitter.com/ohmyzsh.\033[0m" -/usr/bin/env zsh +env zsh . ~/.zshrc |