commit
8105d4acc9
29 changed files with 231 additions and 145 deletions
@ -1,24 +1,24 @@ |
||||
# |
||||
# Color grep results |
||||
# Examples: http://rubyurl.com/ZXv |
||||
# |
||||
|
||||
GREP_OPTIONS="--color=auto" |
||||
|
||||
# avoid VCS folders (if the necessary grep flags are available) |
||||
# is x grep argument available? |
||||
grep-flag-available() { |
||||
echo | grep $1 "" >/dev/null 2>&1 |
||||
} |
||||
|
||||
# color grep results |
||||
GREP_OPTIONS="--color=auto" |
||||
|
||||
# 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 |
||||
for PATTERN in .cvs .git .hg .svn; do |
||||
GREP_OPTIONS+=" --exclude-dir=$PATTERN" |
||||
done |
||||
GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS" |
||||
elif grep-flag-available --exclude=.cvs; then |
||||
for PATTERN in .cvs .git .hg .svn; do |
||||
GREP_OPTIONS+=" --exclude=$PATTERN" |
||||
done |
||||
GREP_OPTIONS+=" --exclude=$VCS_FOLDERS" |
||||
fi |
||||
unfunction grep-flag-available |
||||
|
||||
export GREP_OPTIONS="$GREP_OPTIONS" |
||||
export GREP_COLOR='1;32' |
||||
# export grep settings |
||||
alias grep="grep $GREP_OPTIONS" |
||||
|
||||
# clean up |
||||
unset GREP_OPTIONS |
||||
unset VCS_FOLDERS |
||||
unfunction grep-flag-available |
||||
|
||||
@ -0,0 +1,7 @@ |
||||
# Yii2 autocomplete plugin |
||||
|
||||
* Adds autocomplete commands and subcommands for yii. |
||||
|
||||
## Requirements |
||||
|
||||
Autocomplete works from directory where your `yii` file contains. |
||||
@ -0,0 +1,29 @@ |
||||
# Yii2 command completion |
||||
|
||||
_yii2_format_command () { |
||||
awk '/^- [a-z]+/ { sub(":", "", $2); print $2 }' |
||||
} |
||||
|
||||
_yii2 () { |
||||
if [ -f ./yii ]; then |
||||
_arguments \ |
||||
'1: :->command'\ |
||||
'*: :->params' |
||||
|
||||
case $state in |
||||
command) |
||||
|
||||
local -a commands |
||||
local -a name |
||||
|
||||
if [[ $words[2] == *\/ ]]; then |
||||
name=$words[2] |
||||
fi |
||||
|
||||
commands=(${(f)"$(./yii help $name --color=0 | _yii2_format_command)"}) |
||||
compadd -Q -S '' -a -- commands |
||||
esac |
||||
fi |
||||
} |
||||
|
||||
compdef _yii2 yii |
||||
@ -0,0 +1,29 @@ |
||||
# Based on bira zsh theme with nvm, rvm and jenv support |
||||
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" |
||||
|
||||
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' |
||||
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' |
||||
|
||||
local rvm_ruby='' |
||||
if which rvm-prompt &> /dev/null; then |
||||
rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' |
||||
else |
||||
if which rbenv &> /dev/null; then |
||||
rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}' |
||||
fi |
||||
fi |
||||
|
||||
local nvm_node='' |
||||
nvm_node='%{$fg[green]%}‹node-$(nvm_prompt_info)›%{$reset_color%}' |
||||
|
||||
local jenv_java='' |
||||
jenv_java='%{$fg[blue]%}‹$(jenv_prompt_info)›%{$reset_color%}' |
||||
|
||||
local git_branch='$(git_prompt_info)%{$reset_color%}' |
||||
|
||||
PROMPT="╭─${user_host} ${current_dir} ${nvm_node} ${rvm_ruby} ${jenv_java} ${git_branch} |
||||
╰─%B$%b " |
||||
RPS1="${return_code}" |
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}(" |
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}" |
||||
Loading…
Reference in new issue