Merge master into zsh_update_dir

This commit is contained in:
Alexandr Kozlinskiy 2016-10-26 09:04:17 +02:00
commit cd12202f10
9 changed files with 93 additions and 46 deletions

View File

@ -18,9 +18,9 @@ To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://t
### Prerequisites
__Disclaimer:__ _Oh My Zsh works best on OS X and Linux._
__Disclaimer:__ _Oh My Zsh works best on macOS and Linux._
* Unix-based operating system (OS X or Linux)
* Unix-based operating system (macOS or Linux)
* [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH)
* `curl` or `wget` should be installed
* `git` should be installed
@ -49,7 +49,7 @@ Oh My Zsh comes with a shit load of plugins to take advantage of. You can take a
#### Enabling Plugins
If you spot a plugin (or several) that you would like to use with Oh My Zsh, you will need to edit the `~/.zshrc` file. Once you open it with your favorite editor, you'll see a spot to list all the plugins that you'd like Oh My Zsh to load in initialization.
If you spot a plugin (or several) that you would like to use with Oh My Zsh, you will need to edit the `~/.zshrc` file. Once you open it with your favorite editor, you'll see a spot to list all the plugins that you'd like Oh My Zsh to load on initialization.
For example, this line might begin to look like...
@ -67,7 +67,7 @@ We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme
#### Selecting a Theme
_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just right (for him)._
_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just the right one (for him)._
Once you find a theme that you want to use, you will need to edit the `~/.zshrc` file. You'll see an environment variable (all caps) in there that looks like:
@ -79,9 +79,11 @@ 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)
# you might need to install a special Powerline font on your console's host for this to work
# see https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#agnoster
```
Open up a new terminal window and your prompt should look something like...
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)
@ -129,7 +131,7 @@ cp ~/.zshrc ~/.zshrc.orig
##### 3. Create a new zsh configuration file
You can create a new zsh config file by copying the template that we included for you.
You can create a new zsh config file by copying the template that we have included for you.
```shell
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
@ -208,7 +210,7 @@ Thank you so much!
## Follow Us
We're on the social medias.
We're on the social media.
* [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. You should follow it.
* [Oh My Zsh](https://www.facebook.com/Oh-My-Zsh-296616263819290/) on Facebook.

View File

@ -53,7 +53,7 @@ done
# Figure out the SHORT hostname
if [[ "$OSTYPE" = darwin* ]]; then
# OS X's $HOST changes with dhcp, etc. Use ComputerName if possible.
# macOS's $HOST changes with dhcp, etc. Use ComputerName if possible.
SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/}
else
SHORT_HOST=${HOST/.*/}

View File

@ -2,3 +2,19 @@ alias brews='brew list -1'
alias bubo='brew update && brew outdated'
alias bubc='brew upgrade && brew cleanup'
alias bubu='bubo && bubc'
if 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

View File

@ -18,5 +18,6 @@ alias dcrm='docker-compose rm'
alias dcr='docker-compose run'
alias dcstop='docker-compose stop'
alias dcup='docker-compose up'
alias dcdn='docker-compose down'
alias dcl='docker-compose logs'
alias dclf='docker-compose logs -f'

View File

@ -57,7 +57,7 @@ __docker_get_containers() {
type=$1; shift
[[ $kind = (stopped|all) ]] && args=($args -a)
lines=(${(f)"$(_call_program commands docker $docker_options ps --format 'table' --no-trunc $args)"})
lines=(${(f)${:-"$(_call_program commands docker $docker_options ps --format 'table' --no-trunc $args)"$'\n'}})
# Parse header line to find columns
local i=1 j=1 k header=${lines[1]}
@ -153,7 +153,7 @@ __docker_images() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
declare -a images
images=(${${${(f)"$(_call_program commands docker $docker_options images)"}[2,-1]}/(#b)([^ ]##) ##([^ ]##) ##([^ ]##)*/${match[3]}:${(r:15:: :::)match[2]} in ${match[1]}})
images=(${${${(f)${:-"$(_call_program commands docker $docker_options images)"$'\n'}}[2,-1]}/(#b)([^ ]##) ##([^ ]##) ##([^ ]##)*/${match[3]}:${(r:15:: :::)match[2]} in ${match[1]}})
_describe -t docker-images "images" images && ret=0
__docker_repositories_with_tags && ret=0
return ret
@ -162,7 +162,7 @@ __docker_images() {
__docker_repositories() {
[[ $PREFIX = -* ]] && return 1
declare -a repos
repos=(${${${(f)"$(_call_program commands docker $docker_options images)"}%% *}[2,-1]})
repos=(${${${(f)${:-"$(_call_program commands docker $docker_options images)"$'\n'}}%% *}[2,-1]})
repos=(${repos#<none>})
_describe -t docker-repos "repositories" repos
}
@ -172,7 +172,7 @@ __docker_repositories_with_tags() {
integer ret=1
declare -a repos onlyrepos matched
declare m
repos=(${${${${(f)"$(_call_program commands docker $docker_options images)"}[2,-1]}/ ##/:::}%% *})
repos=(${${${${(f)${:-"$(_call_program commands docker $docker_options images)"$'\n'}}[2,-1]}/ ##/:::}%% *})
repos=(${${repos%:::<none>}#<none>})
# Check if we have a prefix-match for the current prefix.
onlyrepos=(${repos%::*})
@ -208,7 +208,7 @@ __docker_search() {
if ( [[ ${(P)+cachename} -eq 0 ]] || _cache_invalid ${cachename#_} ) \
&& ! _retrieve_cache ${cachename#_}; then
_message "Searching for ${searchterm}..."
result=(${${${(f)"$(_call_program commands docker $docker_options search $searchterm)"}%% *}[2,-1]})
result=(${${${(f)${:-"$(_call_program commands docker $docker_options search $searchterm)"$'\n'}}%% *}[2,-1]})
_store_cache ${cachename#_} result
fi
_wanted dockersearch expl 'available images' compadd -a result
@ -219,7 +219,7 @@ __docker_get_log_options() {
integer ret=1
local log_driver=${opt_args[--log-driver]:-"all"}
local -a awslogs_options fluentd_options gelf_options journald_options json_file_options syslog_options splunk_options
local -a awslogs_options fluentd_options gelf_options journald_options json_file_options logentries_options syslog_options splunk_options
awslogs_options=("awslogs-region" "awslogs-group" "awslogs-stream")
fluentd_options=("env" "fluentd-address" "fluentd-async-connect" "fluentd-buffer-limit" "fluentd-retry-wait" "fluentd-max-retries" "labels" "tag")
@ -227,6 +227,7 @@ __docker_get_log_options() {
gelf_options=("env" "gelf-address" "gelf-compression-level" "gelf-compression-type" "labels" "tag")
journald_options=("env" "labels" "tag")
json_file_options=("env" "labels" "max-file" "max-size")
logentries_options=("logentries-token")
syslog_options=("env" "labels" "syslog-address" "syslog-facility" "syslog-format" "syslog-tls-ca-cert" "syslog-tls-cert" "syslog-tls-key" "syslog-tls-skip-verify" "tag")
splunk_options=("env" "labels" "splunk-caname" "splunk-capath" "splunk-format" "splunk-gzip" "splunk-gzip-level" "splunk-index" "splunk-insecureskipverify" "splunk-source" "splunk-sourcetype" "splunk-token" "splunk-url" "splunk-verify-connection" "tag")
@ -236,6 +237,7 @@ __docker_get_log_options() {
[[ $log_driver = (gelf|all) ]] && _describe -t gelf-options "gelf options" gelf_options "$@" && ret=0
[[ $log_driver = (journald|all) ]] && _describe -t journald-options "journald options" journald_options "$@" && ret=0
[[ $log_driver = (json-file|all) ]] && _describe -t json-file-options "json-file options" json_file_options "$@" && ret=0
[[ $log_driver = (logentries|all) ]] && _describe -t logentries-options "logentries options" logentries_options "$@" && ret=0
[[ $log_driver = (syslog|all) ]] && _describe -t syslog-options "syslog options" syslog_options "$@" && ret=0
[[ $log_driver = (splunk|all) ]] && _describe -t splunk-options "splunk options" splunk_options "$@" && ret=0
@ -333,6 +335,9 @@ __docker_complete_ps_filters() {
(id)
__docker_containers_ids && ret=0
;;
(is-task)
_describe -t boolean-filter-opts "filter options" boolean_opts && ret=0
;;
(name)
__docker_containers_names && ret=0
;;
@ -504,7 +509,7 @@ __docker_get_networks() {
type=$1; shift
lines=(${(f)"$(_call_program commands docker $docker_options network ls)"})
lines=(${(f)${:-"$(_call_program commands docker $docker_options network ls)"$'\n'}})
# Parse header line to find columns
local i=1 j=1 k header=${lines[1]}
@ -720,7 +725,7 @@ __docker_nodes() {
filter=$1; shift
[[ $filter != "none" ]] && args=("-f $filter")
lines=(${(f)"$(_call_program commands docker $docker_options node ls $args)"})
lines=(${(f)${:-"$(_call_program commands docker $docker_options node ls $args)"$'\n'}})
# Parse header line to find columns
local i=1 j=1 k header=${lines[1]}
declare -A begin end
@ -792,7 +797,7 @@ __docker_node_commands() {
"ls:List nodes in the swarm"
"promote:Promote a node as manager in the swarm"
"rm:Remove one or more nodes from the swarm"
"ps:List tasks running on a node, defaults to current node"
"ps:List tasks running on one or more nodes, defaults to current node"
"update:Update a node"
)
_describe -t docker-node-commands "docker node command" _docker_node_subcommands
@ -847,7 +852,7 @@ __docker_node_subcommand() {
"($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \
"($help)--no-resolve[Do not map IDs to Names]" \
"($help)--no-trunc[Do not truncate output]" \
"($help -)1:node:__docker_complete_nodes" && ret=0
"($help -)*:node:__docker_complete_nodes" && ret=0
case $state in
(filter-options)
__docker_node_complete_ps_filters && ret=0
@ -881,7 +886,7 @@ __docker_complete_plugins() {
local line s
declare -a lines plugins
lines=(${(f)"$(_call_program commands docker $docker_options plugin ls)"})
lines=(${(f)${:-"$(_call_program commands docker $docker_options plugin ls)"$'\n'}})
# Parse header line to find columns
local i=1 j=1 k header=${lines[1]}
@ -1007,7 +1012,7 @@ __docker_services() {
type=$1; shift
lines=(${(f)"$(_call_program commands docker $docker_options service ls)"})
lines=(${(f)${:-"$(_call_program commands docker $docker_options service ls)"$'\n'}})
# Parse header line to find columns
local i=1 j=1 k header=${lines[1]}
@ -1103,6 +1108,8 @@ __docker_service_subcommand() {
"($help)--stop-grace-period=[Time to wait before force killing a container]:grace period: "
"($help)--update-delay=[Delay between updates]:delay: "
"($help)--update-failure-action=[Action on update failure]:mode:(pause continue)"
"($help)--update-max-failure-ratio=[Failure rate to tolerate during an update]:fraction: "
"($help)--update-monitor=[Duration after each task update to monitor for failure]:window: "
"($help)--update-parallelism=[Maximum number of tasks updated simultaneously]:number: "
"($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users"
"($help)--with-registry-auth[Send registry authentication details to swarm agents]"
@ -1178,8 +1185,10 @@ __docker_service_subcommand() {
"($help)--arg=[Service command args]:arguments: _normal" \
"($help)*--container-label-add=[Add or update container labels]:label: " \
"($help)*--container-label-rm=[Remove a container label by its key]:label: " \
"($help)--force[Force update]" \
"($help)*--group-rm=[Remove previously added user groups from the container]:group:_groups" \
"($help)--image=[Service image tag]:image:__docker_repositories" \
"($help)--rollback[Rollback to previous specification]" \
"($help -)1:service:__docker_complete_services" && ret=0
;;
(help)
@ -1293,7 +1302,7 @@ __docker_volumes() {
integer ret=1
declare -a lines volumes
lines=(${(f)"$(_call_program commands docker $docker_options volume ls)"})
lines=(${(f)${:-"$(_call_program commands docker $docker_options volume ls)"$'\n'}})
# Parse header line to find columns
local i=1 j=1 k header=${lines[1]}
@ -1506,6 +1515,7 @@ __docker_subcommand() {
$opts_build_create_run \
$opts_build_create_run_update \
"($help)*--build-arg[Build-time variables]:<varname>=<value>: " \
"($help)--compress[Compress the build context using gzip]" \
"($help -f --file)"{-f=,--file=}"[Name of the Dockerfile]:Dockerfile:_files" \
"($help)--force-rm[Always remove intermediate containers]" \
"($help)*--label=[Set metadata for an image]:label=value: " \
@ -1594,6 +1604,7 @@ __docker_subcommand() {
"($help -g --graph)"{-g=,--graph=}"[Root of the Docker runtime]:path:_directories" \
"($help -H --host)"{-H=,--host=}"[tcp://host:port to bind/connect to]:host: " \
"($help)--icc[Enable inter-container communication]" \
"($help)--init-path=[Path to the docker-init binary]:docker-init binary:_files" \
"($help)*--insecure-registry=[Enable insecure registry communication]:registry: " \
"($help)--ip=[Default IP when binding container ports]" \
"($help)--ip-forward[Enable net.ipv4.ip_forward]" \
@ -1669,6 +1680,7 @@ __docker_subcommand() {
$opts_help \
$opts_attach_exec_run_start \
"($help -d --detach)"{-d,--detach}"[Detached mode: leave the container running in the background]" \
"($help -e --env)"{-e,--env}"[Set environment variables]" \
"($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]" \
@ -1704,7 +1716,7 @@ __docker_subcommand() {
"($help -a --all)"{-a,--all}"[Show all images]" \
"($help)--digests[Show digests]" \
"($help)*"{-f=,--filter=}"[Filter values]:filter:->filter-options" \
"($help)--format[Pretty-print images using a Go template]:template: " \
"($help)--format=[Pretty-print images using a Go template]:template: " \
"($help)--no-trunc[Do not truncate output]" \
"($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \
"($help -): :__docker_repositories" && ret=0
@ -1726,7 +1738,7 @@ __docker_subcommand() {
(info|version)
_arguments $(__docker_arguments) \
$opts_help \
"($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0
"($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0
;;
(inspect)
local state
@ -1851,7 +1863,7 @@ __docker_subcommand() {
"($help -a --all)"{-a,--all}"[Show all containers]" \
"($help)--before=[Show only container created before...]:containers:__docker_containers" \
"($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_ps_filters" \
"($help)--format[Pretty-print containers using a Go template]:template: " \
"($help)--format=[Pretty-print containers using a Go template]:template: " \
"($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \
"($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \
"($help)--no-trunc[Do not truncate output]" \
@ -1878,12 +1890,18 @@ __docker_subcommand() {
"($help -):old name:__docker_containers" \
"($help -):new name: " && ret=0
;;
(restart|stop)
(stop)
_arguments $(__docker_arguments) \
$opts_help \
"($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \
"($help -)*:containers:__docker_runningcontainers" && ret=0
;;
(restart)
_arguments $(__docker_arguments) \
$opts_help \
"($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \
"($help -)*:containers:__docker_containers_ids" && ret=0
;;
(rm)
_arguments $(__docker_arguments) \
$opts_help \
@ -1999,6 +2017,7 @@ __docker_subcommand() {
_arguments $(__docker_arguments) \
$opts_help \
"($help -a --all)"{-a,--all}"[Show all containers (default shows just running)]" \
"($help)--format=[Pretty-print images using a Go template]:template: " \
"($help)--no-stream[Disable streaming stats and only pull the first result]" \
"($help -)*:containers:__docker_runningcontainers" && ret=0
;;

View File

@ -7,8 +7,8 @@ droplr() {
return 1
fi
if [[ "$1" =~ ^http[|s]:// ]]; then
osascript -e "tell app 'Droplr' to shorten '$1'"
if [[ "$1" =~ ^https?:// ]]; then
osascript -e 'tell app "Droplr" to shorten "'"$1"'"'
else
open -ga /Applications/Droplr.app "$1"
fi

View File

@ -2,6 +2,8 @@ alias rnand='react-native run-android'
alias rnios4s='react-native run-ios --simulator "iPhone 4s"'
alias rnios5='react-native run-ios --simulator "iPhone 5"'
alias rnios5s='react-native run-ios --simulator "iPhone 5s"'
alias rnios6='react-native run-ios --simulator "iPhone 6"'
alias rnios6s='react-native run-ios --simulator "iPhone 6s"'
alias rnios='react-native run-ios'
alias rnlink='react-native link'

View File

@ -4,8 +4,10 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
if [[ $UID -eq 0 ]]; then
local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}'
local user_symbol='#'
else
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
local user_symbol='$'
fi
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
@ -20,8 +22,9 @@ fi
local git_branch='$(git_prompt_info)%{$reset_color%}'
PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
╰─%B$%b "
RPS1="${return_code}"
╰─%B${user_symbol}%b "
RPS1="%B${return_code}%b"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX=" %{$reset_color%}"

View File

@ -5,26 +5,30 @@ function prompt_char {
}
function virtualenv_info {
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
[[ -n "$VIRTUAL_ENV" ]] && echo '('${VIRTUAL_ENV:t}') '
}
function collapse_pwd {
echo $(pwd | sed -e "s,^$HOME,~,")
function ruby_prompt {
if (( $+commands[rvm-prompt] )); then
print -n $ZSH_THEME_RUBY_PROMPT_PREFIX
print -n $(~/.rvm/bin/rvm-prompt)
print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX
elif (( $+commands[rbenv] )); then
print -n $ZSH_THEME_RUBY_PROMPT_PREFIX
print -n $(rbenv version | sed -e "s/ (set.*$//")
print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX
fi
return 0
}
if which rvm-prompt &> /dev/null; then
PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%}
$(virtualenv_info)$(prompt_char) '
else
if which rbenv &> /dev/null; then
PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%}
$(virtualenv_info)$(prompt_char) '
fi
fi
PROMPT='%F{magenta}%n%f at %F{yellow}%m%f in %B%F{green}%~%f%b$(git_prompt_info)$(ruby_prompt)
$(virtualenv_info) $(prompt_char) '
ZSH_THEME_GIT_PROMPT_PREFIX=' on %F{magenta}'
ZSH_THEME_GIT_PROMPT_SUFFIX='%f'
ZSH_THEME_GIT_PROMPT_DIRTY='%F{green}!'
ZSH_THEME_GIT_PROMPT_UNTRACKED='%F{green}?'
ZSH_THEME_GIT_PROMPT_CLEAN=''
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?"
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_RUBY_PROMPT_PREFIX=' using %F{red}'
ZSH_THEME_RUBY_PROMPT_SUFFIX='%f'