mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-28 09:19:02 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
65ce765043
10
lib/git.zsh
10
lib/git.zsh
@ -54,11 +54,19 @@ git_remote_status() {
|
||||
|
||||
# Checks if there are commits ahead from remote
|
||||
function git_prompt_ahead() {
|
||||
if $(echo "$(command git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||
fi
|
||||
}
|
||||
|
||||
# Gets the number of commits ahead from remote
|
||||
function git_commits_ahead() {
|
||||
if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ')
|
||||
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
|
||||
fi
|
||||
}
|
||||
|
||||
# Formats prompt string for current git commit short SHA
|
||||
function git_prompt_short_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"
|
||||
|
@ -1 +1,2 @@
|
||||
alias brews='brew list -1'
|
||||
alias bubu="brew update && brew upgrade && brew cleanup"
|
||||
|
49
plugins/bundler/README.md
Normal file
49
plugins/bundler/README.md
Normal file
@ -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`
|
@ -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
|
||||
|
@ -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() {
|
||||
@ -48,9 +82,17 @@ _within-bundled-project() {
|
||||
false
|
||||
}
|
||||
|
||||
_binstubbed() {
|
||||
[ -f "./bin/${1}" ]
|
||||
}
|
||||
|
||||
_run-with-bundler() {
|
||||
if _bundler-installed && _within-bundled-project; then
|
||||
bundle exec $@
|
||||
if _binstubbed $1; then
|
||||
./bin/$@
|
||||
else
|
||||
bundle exec $@
|
||||
fi
|
||||
else
|
||||
$@
|
||||
fi
|
||||
@ -63,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
|
||||
|
||||
|
@ -214,7 +214,7 @@ __save() {
|
||||
__start() {
|
||||
_arguments \
|
||||
'(-a,--attach=)'{-a,--attach=}'[Attach container''s stdout/stderr and forward all signals to the process]' \
|
||||
'(-i,--interactive=)'{-i, --interactive=}'[Attach container''s stdin]'
|
||||
'(-i,--interactive=)'{-i,--interactive=}'[Attach container''s stdin]'
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
|
@ -29,15 +29,23 @@ open_jira_issue () {
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -f .jira-prefix ]; then
|
||||
jira_prefix=$(cat .jira-prefix)
|
||||
elif [ -f ~/.jira-prefix ]; then
|
||||
jira_prefix=$(cat ~/.jira-prefix)
|
||||
else
|
||||
jira_prefix=""
|
||||
fi
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Opening new issue"
|
||||
$open_cmd "$jira_url/secure/CreateIssue!default.jspa"
|
||||
else
|
||||
echo "Opening issue #$1"
|
||||
if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then
|
||||
$open_cmd "$jira_url/issues/$1"
|
||||
$open_cmd "$jira_url/issues/$jira_prefix$1"
|
||||
else
|
||||
$open_cmd "$jira_url/browse/$1"
|
||||
$open_cmd "$jira_url/browse/$jira_prefix$1"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -129,6 +129,8 @@ function listMavenCompletions {
|
||||
tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy
|
||||
# tomcat7
|
||||
tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy
|
||||
# spring-boot
|
||||
spring-boot:run spring-boot:repackage
|
||||
# exec
|
||||
exec:exec exec:java
|
||||
# versions
|
||||
|
@ -174,12 +174,16 @@ function itunes() {
|
||||
next|previous)
|
||||
opt="$opt track"
|
||||
;;
|
||||
vol)
|
||||
opt="set sound volume to $1" #$1 Due to the shift
|
||||
;;
|
||||
""|-h|--help)
|
||||
echo "Usage: itunes <option>"
|
||||
echo "option:"
|
||||
echo "\tlaunch|play|pause|stop|rewind|resume|quit"
|
||||
echo "\tmute|unmute\tcontrol volume set"
|
||||
echo "\tnext|previous\tplay next or previous track"
|
||||
echo "\tvol\tSet the volume, takes an argument from 0 to 100"
|
||||
echo "\thelp\tshow this message and exit"
|
||||
return 0
|
||||
;;
|
||||
@ -190,4 +194,3 @@ function itunes() {
|
||||
esac
|
||||
osascript -e "tell application \"iTunes\" to $opt"
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
# Aliases to stop, start and restart Postgres
|
||||
# Paths noted below are for Postgress installed via Homebrew on OSX
|
||||
# Aliases to control Postgres
|
||||
# Paths noted below are for Postgres installed via Homebrew on OSX
|
||||
|
||||
alias startpost='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'
|
||||
alias stoppost='pg_ctl -D /usr/local/var/postgres stop -s -m fast'
|
||||
alias restartpost='stoppost && sleep 1 && startpost'
|
||||
alias restartpost='stoppost && sleep 1 && startpost'
|
||||
alias reloadpost='pg_ctl reload -D /usr/local/var/postgres -s'
|
||||
alias statuspost='pg_ctl status -D /usr/local/var/postgres -s'
|
@ -6,6 +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'
|
||||
|
||||
function rb18 {
|
||||
if [ -z "$1" ]; then
|
||||
@ -40,6 +41,17 @@ function rb20 {
|
||||
_rb20() {compadd `ls -1 $rvm_path/gems | grep "^$ruby20@" | sed -e "s/^$ruby20@//" | awk '{print $1}'`}
|
||||
compdef _rb20 rb20
|
||||
|
||||
function rb21 {
|
||||
if [ -z "$1" ]; then
|
||||
rvm use "$ruby21"
|
||||
else
|
||||
rvm use "$ruby21@$1"
|
||||
fi
|
||||
}
|
||||
|
||||
_rb21() {compadd `ls -1 $rvm_path/gems | grep "^$ruby21@" | sed -e "s/^$ruby21@//" | awk '{print $1}'`}
|
||||
compdef _rb21 rb21
|
||||
|
||||
function rvm-update {
|
||||
rvm get head
|
||||
}
|
||||
|
@ -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'
|
||||
|
||||
|
@ -58,7 +58,7 @@ wd_warp()
|
||||
#wd_print_msg $BLUE "Warping..."
|
||||
cd ${points[$1]}
|
||||
else
|
||||
wd_print_msg $RED "Unkown warp point '$1'"
|
||||
wd_print_msg $RED "Unknown warp point '$1'"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
PROMPT='%{$fg[green]%} %% '
|
||||
PROMPT='%(?,%{$fg[green]%},%{$fg[red]%}) %% '
|
||||
# RPS1='%{$fg[blue]%}%~%{$reset_color%} '
|
||||
RPS1='%{$fg[white]%}%2~$(git_prompt_info) %{$fg_bold[blue]%}%m%{$reset_color%}'
|
||||
|
||||
@ -6,4 +6,3 @@ ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ⚡%{$fg[yellow]%}"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user