Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Guillermo Caracuel 2016-06-20 08:41:47 +02:00
commit 0a1e2957f4
17 changed files with 242 additions and 79 deletions

View File

@ -1,12 +1,27 @@
#!/bin/sh #!/bin/sh
# get list of available X windows. function _emacsfun
x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null` {
# get list of available X windows.
x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`
if [ -z "$x" ] || [ "$x" = "nil" ] ;then if [ -z "$x" ] || [ "$x" = "nil" ] ;then
# Create one if there is no X window yet. # Create one if there is no X window yet.
emacsclient --alternate-editor "" --create-frame "$@" emacsclient --alternate-editor "" --create-frame "$@"
else
# prevent creating another X frame if there is at least one present.
emacsclient --alternate-editor "" "$@"
fi
}
# adopted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh
# If the second argument is - then write stdin to a tempfile and open the
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
if [[ $# -ge 2 ]] && [[ "$2" == - ]]; then
tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)"
cat - > "$tempfile"
_emacsfun --no-wait $tempfile
else else
# prevent creating another X frame if there is at least one present. _emacsfun "$@"
emacsclient --alternate-editor "" "$@"
fi fi

View File

@ -1,41 +1,85 @@
# author: Peter Eisentraut #compdef kitchen
# source: https://gist.github.com/petere/10307599 # ------------------------------------------------------------------------------
# compdef kitchen # Copyright (c) 2014 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for Test Kitchen (http://kitchen.ci/).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Peter Eisentraut (https://github.com/petere)
#
# ------------------------------------------------------------------------------
_kitchen() { _kitchen() {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments '1: :->cmds'\ _arguments '1: :->cmds'\
'2: :->args' '2: :->args'
case $state in case $state in
cmds) cmds)
_arguments "1:Commands:(console converge create destroy diagnose driver help init list login setup test verify version)" _kitchen_commands
;; ;;
args) args)
case $line[1] in case $line[1] in
converge|create|destroy|diagnose|list|setup|test|verify) converge|create|destroy|diagnose|list|setup|test|verify)
compadd "$@" all compadd 'all'
_kitchen_instances _kitchen_instances
;; ;;
login) login)
_kitchen_instances _kitchen_instances
;; ;;
esac esac
;; ;;
esac esac
}
_kitchen_commands() {
local commands
commands=("${(@f)$(_call_program commands $service help | sed -n 's/^ kitchen \([[:alpha:]]*\) [ [].*# \(.*\)$/\1:\2/p')}")
_describe -t commands 'kitchen commands' commands
} }
_kitchen_instances() { _kitchen_instances() {
if [[ $_kitchen_instances_cache_dir != $PWD ]]; then if [[ $_kitchen_instances_cache_dir != $PWD ]]; then
unset _kitchen_instances_cache unset _kitchen_instances_cache
fi fi
if [[ ${+_kitchen_instances_cache} -eq 0 ]]; then if [[ ${+_kitchen_instances_cache} -eq 0 ]]; then
_kitchen_instances_cache=(${(f)"$(bundle exec kitchen list -b 2>/dev/null || kitchen list -b 2>/dev/null)"}) _kitchen_instances_cache=(${(f)"$(_call_program instances $service list -b 2>/dev/null)"})
_kitchen_instances_cache_dir=$PWD _kitchen_instances_cache_dir=$PWD
fi fi
compadd -a _kitchen_instances_cache _wanted instances expl 'instance' compadd -a _kitchen_instances_cache
} }
_kitchen "$@" _kitchen "$@"

View File

@ -3,6 +3,9 @@
# You can override the path to knife.rb and your cookbooks by setting # You can override the path to knife.rb and your cookbooks by setting
# KNIFE_CONF_PATH=/path/to/my/.chef/knife.rb # KNIFE_CONF_PATH=/path/to/my/.chef/knife.rb
# KNIFE_COOKBOOK_PATH=/path/to/my/chef/cookbooks # KNIFE_COOKBOOK_PATH=/path/to/my/chef/cookbooks
# If you want your local cookbooks path to be calculated relative to where you are then
# set the below option
# KNIFE_RELATIVE_PATH=true
# Read around where these are used for more detail. # Read around where these are used for more detail.
# These flags should be available everywhere according to man knife # These flags should be available everywhere according to man knife
@ -119,7 +122,19 @@ _knife() {
_arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))' _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))'
;; ;;
file) file)
_arguments '*:file or directory:_files -g "*.(rb|json)"' case $words[2] in
environment)
_arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/environments"'
;;
node)
_arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/nodes"'
;;
role)
_arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/roles"'
;;
*)
_arguments '*:Subsubcommands:($(_knife_options3))'
esac
;; ;;
list) list)
compadd -a "$@" knife_general_flags compadd -a "$@" knife_general_flags
@ -132,11 +147,22 @@ _knife() {
if (( versioncomp > 0 )); then if (( versioncomp > 0 )); then
compadd "$@" attributes definitions files libraries providers recipes resources templates compadd "$@" attributes definitions files libraries providers recipes resources templates
else else
_arguments '*:Subsubcommands:($(_knife_options2))' case $words[5] in
file)
_arguments '*:directory:_path_files -/ -W "$(_chef_root)/data_bags" -qS \ '
;;
*) _arguments '*:Subsubcommands:($(_knife_options2))'
esac
fi fi
;; ;;
knifesubcmd5) knifesubcmd5)
_arguments '*:Subsubcommands:($(_knife_options3))' case $words[5] in
file)
_arguments '*:files:_path_files -g "*.json" -W "$(_chef_root)/data_bags/$words[6]"'
;;
*)
_arguments '*:Subsubcommands:($(_knife_options3))'
esac
esac esac
} }
@ -184,12 +210,15 @@ _chef_environments_remote() {
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server # The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
_chef_cookbooks_local() { _chef_cookbooks_local() {
if [ $KNIFE_RELATIVE_PATH ]; then
local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb} local cookbook_path="$(_chef_root)/cookbooks"
if [ -f ./.chef/knife.rb ]; then else
knife_rb="./.chef/knife.rb" local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb}
if [ -f ./.chef/knife.rb ]; then
knife_rb="./.chef/knife.rb"
fi
local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )}
fi fi
local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )}
(for i in $cookbook_path; do ls $i; done) (for i in $cookbook_path; do ls $i; done)
} }
@ -198,4 +227,15 @@ _cookbook_versions() {
(knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g') (knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g')
} }
# Searches up from current directory to find the closest folder that has a .chef folder
# Useful for the knife upload/from file commands
_chef_root () {
directory="$PWD"
while [ $directory != '/' ]
do
test -e "$directory/.chef" && echo "$directory" && return
directory="${directory:h}"
done
}
_knife "$@" _knife "$@"

View File

@ -15,6 +15,7 @@ plugins=(... mvn)
| `mvncie` | `mvn clean install eclipse:eclipse` | | `mvncie` | `mvn clean install eclipse:eclipse` |
| `mvnci` | `mvn clean install` | | `mvnci` | `mvn clean install` |
| `mvncist` | `mvn clean install -DskipTests` | | `mvncist` | `mvn clean install -DskipTests` |
| `mvncisto` | `mvn clean install -DskipTests --offline` |
| `mvne` | `mvn eclipse:eclipse` | | `mvne` | `mvn eclipse:eclipse` |
| `mvnd` | `mvn deploy` | | `mvnd` | `mvn deploy` |
| `mvnp` | `mvn package` | | `mvnp` | `mvn package` |

View File

@ -45,6 +45,7 @@ mvn-color()
alias mvncie='mvn clean install eclipse:eclipse' alias mvncie='mvn clean install eclipse:eclipse'
alias mvnci='mvn clean install' alias mvnci='mvn clean install'
alias mvncist='mvn clean install -DskipTests' alias mvncist='mvn clean install -DskipTests'
alias mvncisto='mvn clean install -DskipTests --offline'
alias mvne='mvn eclipse:eclipse' alias mvne='mvn eclipse:eclipse'
alias mvnce='mvn clean eclipse:clean eclipse:eclipse' alias mvnce='mvn clean eclipse:clean eclipse:eclipse'
alias mvnd='mvn deploy' alias mvnd='mvn deploy'

27
plugins/osx/README.md Normal file
View File

@ -0,0 +1,27 @@
# OSX plugin
## Description
This plugin provides a few utilities to make it more enjoyable on OSX.
To start using it, add the `osx` plugin to your plugins array in `~/.zshrc`:
```zsh
plugins=(... osx)
```
Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
## Commands
| Command | Description |
|:--------------|:-----------------------------------------------|
| `tab` | Open the current directory in a new tab |
| `ofd` | Open the current directory in a Finder window |
| `pfd` | Return the path of the frontmost Finder window |
| `pfs` | Return the current Finder selection |
| `cdf` | `cd` to the current Finder directory |
| `pushdf` | `pushd` to the current Finder directory |
| `quick-look` | Quick-Look a specified file |
| `man-preview` | Open a specified man page in Preview app |

View File

@ -1,5 +0,0 @@
#compdef man-preview
#autoload
_man

View File

@ -1,9 +1,5 @@
# ------------------------------------------------------------------------------ # Open the current directory in a Finder window
# FILE: osx.plugin.zsh alias ofd='open_command $PWD'
# DESCRIPTION: oh-my-zsh plugin file.
# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
# VERSION: 1.1.0
# ------------------------------------------------------------------------------
function _omz_osx_get_frontmost_app() { function _omz_osx_get_frontmost_app() {
local the_app=$( local the_app=$(
@ -179,6 +175,7 @@ function quick-look() {
function man-preview() { function man-preview() {
man -t "$@" | open -f -a Preview man -t "$@" | open -f -a Preview
} }
compdef man-preview=man
function vncviewer() { function vncviewer() {
open vnc://$@ open vnc://$@

View File

@ -1,6 +1,6 @@
#compdef task #compdef task
# #
# Copyright 2010 - 2015 Johannes Schlatow # Copyright 2010 - 2016 Johannes Schlatow
# Copyright 2009 P.C. Shyamshankar # Copyright 2009 P.C. Shyamshankar
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
@ -26,7 +26,6 @@
typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers
_task_projects=($(task _projects)) _task_projects=($(task _projects))
_task_tags=($(task _tags)) _task_tags=($(task _tags))
_task_ids=($(task _ids))
_task_zshids=( ${(f)"$(task _zshids)"} ) _task_zshids=( ${(f)"$(task _zshids)"} )
_task_config=($(task _config)) _task_config=($(task _config))
_task_columns=($(task _columns)) _task_columns=($(task _columns))
@ -139,8 +138,10 @@ task_dates=(
) )
local -a task_zshids local -a task_zshids
_regex_words values 'task IDs' $_task_zshids if (( $#_task_zshids )); then
task_zshids=("$reply[@]") _regex_words values 'task IDs' $_task_zshids
task_zshids=("$reply[@]")
fi
_regex_words values 'task frequencies' \ _regex_words values 'task frequencies' \
'daily:Every day' \ 'daily:Every day' \

View File

@ -8,7 +8,7 @@ local active_text=reverse
# This doesn't cover scripts named "[0-9]## *", which should be very rare # This doesn't cover scripts named "[0-9]## *", which should be very rare
# (#s) is ^, (#e) is $, # is *, ## is + (comparing to regex) # (#s) is ^, (#e) is $, # is *, ## is + (comparing to regex)
# | is alternative, but only in () # | is alternative, but only in ()
local NLIST_COLORING_PATTERN="((#s) #[0-9]## |[[][^]]#](#e)|[^ 0-9/?\\\\][^/\\\\]#(#e)|[^ /\\\\]##[^0-9/\\\\ ]##[^/\\\\]#(#e))" local NLIST_COLORING_PATTERN="((#s) #[0-9]## |[[][^]]#](#e)|[^ 0-9/?\\\\][^/\\\\]#(#e))"
local NLIST_COLORING_COLOR=$'\x1b[00;33m' local NLIST_COLORING_COLOR=$'\x1b[00;33m'
local NLIST_COLORING_MATCH_MULTIPLE=1 local NLIST_COLORING_MATCH_MULTIPLE=1

View File

@ -6,7 +6,7 @@ local bold=0
local colorpair="white/black" local colorpair="white/black"
# Should draw the border? # Should draw the border?
local border=1 local border=0
# Combinations of colors to try out with Ctrl-T and Ctrl-G # Combinations of colors to try out with Ctrl-T and Ctrl-G
# The last number is the bold option, 0 or 1 # The last number is the bold option, 0 or 1

View File

@ -1,11 +1,11 @@
autoload colors autoload colors
colors colors
local h1="$fg_bold[cyan]" local h1="$fg_bold[magenta]"
local h2="$fg_bold[green]" local h2="$fg_bold[green]"
local h3="$fg_bold[blue]" local h3="$fg_bold[blue]"
local h4="$fg_bold[yellow]" local h4="$fg_bold[yellow]"
local h5="$fg_bold[magenta]" local h5="$fg_bold[cyan]"
local rst="$reset_color" local rst="$reset_color"
LESS="-iRc" less <<<" LESS="-iRc" less <<<"
@ -93,4 +93,43 @@ start. This is a way to have handy set of bookmarks prepared in private
history's file. history's file.
Private history is instantly shared among sessions. Private history is instantly shared among sessions.
${h1}Zshrc integration${rst}
There are 5 standard configuration variables that can be set in zshrc:
${h4}znt_history_active_text${rst}
\"underline\" or \"reverse\" - how should be active element highlighted
${h4}znt_history_nlist_coloring_pattern${rst}
Pattern that can be used to colorize elements
${h4}znt_history_nlist_coloring_color${rst}
Color with which to colorize via the pattern
${h4}znt_history_nlist_coloring_match_multiple${rst}
Should multiple matches be colorized (${h2}\"0\"${rst} or ${h2}\"1\"${rst})
${h4}znt_history_keywords ${h2}(array)${rst}
Search keywords activated with Ctrl-X, F2, Ctrl-/, e.g. ( ${h2}\"git\"${rst} ${h2}\"vim\"${rst} )
Above variables will work for n-history tool. For other tools, change
\"_history_\" to e.g. \"_cd_\", for the n-cd tool. The same works for
all 8 tools.
Common configuration of the tools uses variables with \"_list_\" in them:
${h4}znt_list_bold${rst}
Should draw text in bold (${h2}\"0\"${rst} or ${h2}\"1\"${rst})
${h4}znt_list_colorpair${rst}
Main pair of colors to be used, e.g ${h2}\"green/black\"${rst}
${h4}znt_list_border${rst}
Should draw borders around windows (${h2}\"0\"${rst} or ${h2}\"1\"${rst})
${h4}znt_list_themes ${h2}(array)${rst}
List of themes to try out with Ctrl-T, e.g. ( ${h2}\"white/black/1\"${rst}
${h2}\"green/black/0\"${rst} )
${h4}znt_list_instant_select${rst}
Should pressing enter in search mode leave tool (${h2}\"0\"${rst} or ${h2}\"1\"${rst})
If you used ZNT before v2.1.12 then remove old configuration files
${h3}~/.config/znt/*.conf${rst} so that ZNT can update them to the latest versions
that support integration with Zshrc. If you used installer then run it
again (after the remove of configuration files), that is not needed when
using as plugin.
" "

View File

@ -157,7 +157,7 @@ _nhistory_generate_most_frequent() {
vk+="$v"$'\t'"$k" vk+="$v"$'\t'"$k"
done done
print -rl "$title" "${(On)vk[@]}" > "$most_frequent_db" print -rl -- "$title" "${(On)vk[@]}" > "$most_frequent_db"
} }
# Load configuration # Load configuration
@ -337,16 +337,16 @@ if [ "$REPLY" -gt 0 ]; then
selected="$reply[REPLY]" selected="$reply[REPLY]"
# ZLE? # ZLE?
if [ "${(t)CURSOR}" = "integer-local-special" ]; then if [ "${(t)CURSOR}" = "integer-local-special" ]; then
zle redisplay zle .redisplay
zle kill-buffer zle .kill-buffer
LBUFFER+="$selected" LBUFFER+="$selected"
# Append to private history # Append to private history
local newline=$'\n' local newline=$'\n'
selected="${selected//$newline/\\$newline}" selected="${selected//$newline/\\$newline}"
[ "$active_view" = "0" ] && print -r "$selected" >> "$private_history_db" [ "$active_view" = "0" ] && print -r -- "$selected" >> "$private_history_db"
else else
print -zr "$selected" print -zr -- "$selected"
fi fi
else else
[ "${(t)CURSOR}" = "integer-local-special" ] && zle redisplay [ "${(t)CURSOR}" = "integer-local-special" ] && zle redisplay

View File

@ -445,7 +445,10 @@ while (( 1 )); do
[ "$border" = "1" ] && zcurses border main [ "$border" = "1" ] && zcurses border main
local top_msg=" F1-change view, ${(C)ZSH_NAME} $ZSH_VERSION, shell level $SHLVL " local top_msg=" ${(C)ZSH_NAME} $ZSH_VERSION, shell level $SHLVL "
if [[ "${NLIST_ENABLED_EVENTS[(r)F1]}" = "F1" ]]; then
top_msg=" F1-change view,$top_msg"
fi
zcurses move main 0 $(( term_width / 2 - $#top_msg / 2 )) zcurses move main 0 $(( term_width / 2 - $#top_msg / 2 ))
zcurses string main $top_msg zcurses string main $top_msg

View File

@ -53,7 +53,7 @@ plugins=(git)
# User configuration # User configuration
export PATH=$HOME/bin:/usr/local/bin:$PATH # export PATH="/usr/bin:/bin:/usr/sbin:/sbin:$PATH"
# export MANPATH="/usr/local/man:$MANPATH" # export MANPATH="/usr/local/man:$MANPATH"
source $ZSH/oh-my-zsh.sh source $ZSH/oh-my-zsh.sh

View File

@ -41,4 +41,10 @@ PROMPT='
%~ %~
${smiley} %{$reset_color%}' ${smiley} %{$reset_color%}'
RPROMPT='%{$fg[white]%} $(~/.rvm/bin/rvm-prompt)$(git_prompt)%{$reset_color%}' if [[ -d ~/.rvm ]] && [[ -e ~/.rvm/bin/rvm-prompt ]]; then
rvm_prompt='$(~/.rvm/bin/rvm-prompt)'
else
rvm_prompt=''
fi
RPROMPT='%{$fg[white]%} $rvm_prompt$(git_prompt)%{$reset_color%}'

View File

@ -80,12 +80,6 @@ main() {
" ~/.zshrc > ~/.zshrc-omztemp " ~/.zshrc > ~/.zshrc-omztemp
mv -f ~/.zshrc-omztemp ~/.zshrc mv -f ~/.zshrc-omztemp ~/.zshrc
printf "${BLUE}Copying your current PATH and adding it to the end of ~/.zshrc for you.${NORMAL}\n"
sed "/export PATH=/ c\\
export PATH=\"$PATH\"
" ~/.zshrc > ~/.zshrc-omztemp
mv -f ~/.zshrc-omztemp ~/.zshrc
# If this user's login shell is not already "zsh", attempt to switch. # If this user's login shell is not already "zsh", attempt to switch.
TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then