Commit 6952105b authored by Pavol Juhas's avatar Pavol Juhas
Browse files
parents ed19ffee ca900216
function _rails_command () {
if [ -e "script/server" ]; then
ruby script/$@
if [ -e "bin/rails" ]; then
bin/rails $@
elif [ -e "script/rails" ]; then
ruby script/rails $@
elif [ -e "bin/rails" ]; then
bin/rails $@
elif [ -e "script/server" ]; then
ruby script/$@
else
rails $@
fi
......@@ -51,6 +51,7 @@ alias rds='rake db:seed'
alias rdd='rake db:drop'
alias rdtc='rake db:test:clone'
alias rdtp='rake db:test:prepare'
alias rdmtc='rake db:migrate db:test:clone'
alias rlc='rake log:clear'
alias rn='rake notes'
......
# Thank you Jim for everything you contributed to the Ruby and open source community
# over the years. We will miss you dearly.
alias jimweirich="rake"
alias rake="noglob rake" # allows square brackts for rake task invocation
alias brake='noglob bundle exec rake' # execute the bundled rake gem
alias srake='noglob sudo rake' # noglob must come before sudo
......
......@@ -10,12 +10,18 @@ FOUND_RBENV=0
rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv")
if _homebrew-installed && _rbenv-from-homebrew-installed ; then
rbenvdirs=($(brew --prefix rbenv) "${rbenvdirs[@]}")
if [[ $RBENV_ROOT = '' ]]; then
RBENV_ROOT="$HOME/.rbenv"
fi
fi
for rbenvdir in "${rbenvdirs[@]}" ; do
if [ -d $rbenvdir/bin -a $FOUND_RBENV -eq 0 ] ; then
FOUND_RBENV=1
export RBENV_ROOT=$rbenvdir
if [[ $RBENV_ROOT = '' ]]; then
RBENV_ROOT=$rbenvdir
fi
export RBENV_ROOT
export PATH=${rbenvdir}/bin:$PATH
eval "$(rbenv init --no-rehash - zsh)"
......
......@@ -27,7 +27,7 @@
# Florent Thoumie and Jonas Pfenniger
#
local _plugin__ssh_env=$HOME/.ssh/environment-$HOST
local _plugin__ssh_env
local _plugin__forwarding
function _plugin__start_agent()
......@@ -48,6 +48,14 @@ function _plugin__start_agent()
/usr/bin/ssh-add $HOME/.ssh/${^identities}
}
# Get the filename to store/lookup the environment from
if (( $+commands[scutil] )); then
# It's OS X!
_plugin__ssh_env="$HOME/.ssh/environment-$(scutil --get ComputerName)"
else
_plugin__ssh_env="$HOME/.ssh/environment-$HOST"
fi
# test if agent-forwarding is enabled
zstyle -b :omz:plugins:ssh-agent agent-forwarding _plugin__forwarding
if [[ ${_plugin__forwarding} == "yes" && -n "$SSH_AUTH_SOCK" ]]; then
......
# Sublime Text 2 Aliases
local _sublime_darwin_paths > /dev/null 2>&1
_sublime_darwin_paths=(
"/usr/local/bin/subl"
"$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
"$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
"$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
"/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
"/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
)
if [[ $('uname') == 'Linux' ]]; then
if [ -f '/usr/bin/sublime_text' ]; then
st_run() { nohup /usr/bin/sublime_text $@ > /dev/null & }
else
st_run() { nohup /usr/bin/sublime-text $@ > /dev/null & }
fi
local _sublime_linux_paths > /dev/null 2>&1
_sublime_linux_paths=(
"$HOME/bin/sublime_text"
"/opt/sublime_text/sublime_text"
"/usr/bin/sublime_text"
"/usr/local/bin/sublime_text"
)
for _sublime_path in $_sublime_linux_paths; do
if [[ -a $_sublime_path ]]; then
st_run() { $_sublime_path $@ >/dev/null 2>&1 &| }
alias st=st_run
break
fi
done
elif [[ $('uname') == 'Darwin' ]]; then
local _sublime_darwin_paths > /dev/null 2>&1
_sublime_darwin_paths=(
"/usr/local/bin/subl"
"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
"/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
"/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
"$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
"$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
"$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
)
for _sublime_path in $_sublime_darwin_paths; do
if [[ -a $_sublime_path ]]; then
......
# vim:ft=zsh ts=2 sw=2 sts=2 et
#
# Faster alternative to the current SVN plugin implementation.
#
# Works with svn 1.6, 1.7, 1.8.
# Use `svn_prompt_info` method to enquire the svn data.
# It's faster because his efficient use of svn (single svn call) which saves a lot on a huge codebase
# It displays the current status of the local files (added, deleted, modified, replaced, or else...)
#
# Use as a drop-in replacement of the svn plugin not as complementary plugin
function svn_prompt_info() {
local info
info=$(svn info 2>&1) || return 1; # capture stdout and stderr
local repo_need_upgrade=$(svn_repo_need_upgrade $info)
if [[ -n $repo_need_upgrade ]]; then
printf '%s%s%s%s%s%s%s\n' \
$ZSH_PROMPT_BASE_COLOR \
$ZSH_THEME_SVN_PROMPT_PREFIX \
$ZSH_PROMPT_BASE_COLOR \
$repo_need_upgrade \
$ZSH_PROMPT_BASE_COLOR \
$ZSH_THEME_SVN_PROMPT_SUFFIX \
$ZSH_PROMPT_BASE_COLOR
else
printf '%s%s%s %s%s:%s%s%s%s%s' \
$ZSH_PROMPT_BASE_COLOR \
$ZSH_THEME_SVN_PROMPT_PREFIX \
\
"$(svn_status_info $info)" \
$ZSH_PROMPT_BASE_COLOR \
\
$ZSH_THEME_BRANCH_NAME_COLOR \
$(svn_current_branch_name $info) \
$ZSH_PROMPT_BASE_COLOR \
\
$(svn_current_revision $info) \
$ZSH_PROMPT_BASE_COLOR \
\
$ZSH_THEME_SVN_PROMPT_SUFFIX \
$ZSH_PROMPT_BASE_COLOR
fi
}
function svn_repo_need_upgrade() {
grep -q "E155036" <<< ${1:-$(svn info 2> /dev/null)} && \
echo "E155036: upgrade repo with svn upgrade"
}
function svn_current_branch_name() {
grep '^URL:' <<< "${1:-$(svn info 2> /dev/null)}" | egrep -o '(tags|branches)/[^/]+|trunk'
}
function svn_repo_root_name() {
grep '^Repository\ Root:' <<< "${1:-$(svn info 2> /dev/null)}" | sed 's#.*/##'
}
function svn_current_revision() {
echo "${1:-$(svn info 2> /dev/null)}" | sed -n 's/Revision: //p'
}
function svn_status_info() {
local svn_status_string="$ZSH_THEME_SVN_PROMPT_CLEAN"
local svn_status="$(svn status 2> /dev/null)";
if grep -E '^\s*A' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"; fi
if grep -E '^\s*D' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DELETIONS:-}"; fi
if grep -E '^\s*M' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-}"; fi
if grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-}"; fi
if grep -E '^\s*\?' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"; fi
if grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DIRTY:-'!'}"; fi
echo $svn_status_string
}
......@@ -9,7 +9,7 @@ function svn_prompt_info() {
_DISPLAY=$(svn_get_repo_name)
fi
echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\
$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR"
$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$(svn_dirty_pwd)$ZSH_PROMPT_BASE_COLOR"
unset _DISPLAY
fi
}
......@@ -74,3 +74,22 @@ function svn_dirty_choose() {
function svn_dirty() {
svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN
}
function svn_dirty_choose_pwd () {
if in_svn; then
root=`pwd`
if $(svn status $root 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'); then
# Grep exits with 0 when "One or more lines were selected", return "dirty".
echo $1
else
# Otherwise, no lines were found, or an error occurred. Return clean.
echo $2
fi
fi
}
function svn_dirty_pwd () {
svn_dirty_choose_pwd $ZSH_THEME_SVN_PROMPT_DIRTY_PWD $ZSH_THEME_SVN_PROMPT_CLEAN_PWD
}
#compdef wd.sh
zstyle ":completion:*:descriptions" format "%B%d%b"
CONFIG=$HOME/.warprc
local -a main_commands
main_commands=(
add:'Adds the current working directory to your warp points'
#add'\!':'Overwrites existing warp point' # TODO: Fix
rm:'Removes the given warp point'
ls:'Outputs all stored warp points'
show:'Outputs warp points to current directory'
)
local -a points
while read line
do
points+=$(awk "{ gsub(/\/Users\/$USER|\/home\/$USER/,\"~\"); print }" <<< $line)
done < $CONFIG
_wd()
{
# init variables
local curcontext="$curcontext" state line
typeset -A opt_args
# init state
_arguments \
'1: :->command' \
'2: :->argument'
#compdef wd
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion::complete:wd:*:commands' group-name commands
zstyle ':completion::complete:wd:*:warp_points' group-name warp_points
zstyle ':completion::complete:wd::' list-grouped
# Call `_wd()` when when trying to complete the command `wd`
zmodload zsh/mapfile
function _wd() {
local ret=1
local CONFIG=$HOME/.warprc
# Stolen from
# http://stackoverflow.com/questions/9000698/completion-when-program-has-sub-commands
# local curcontext="$curcontext" state line
# typeset -A opt_args
local -a commands
local -a warp_points
warp_points=( "${(f)mapfile[$CONFIG]}" )
# LIST="${mapfile[$FNAME]}" # Not required unless stuff uses it
commands=(
'add:Adds the current working directory to your warp points'
'add!:Overwrites existing warp point'
'rm:Removes the given warp point'
'ls:Outputs all stored warp points'
'show:Outputs all warp points that point to the current directory'
'help:Show this extremely helpful text'
'..:Go back to last directory'
)
_arguments -C \
'1: :->first_arg' \
'2: :->second_arg' && ret=0
case $state in
command)
compadd "$@" add rm ls show
_describe -t warp-points 'Warp points:' points && ret=0
first_arg)
_describe -t warp_points "Warp points" warp_points && ret=0
_describe -t commands "Commands" commands && ret=0
;;
argument)
second_arg)
case $words[2] in
rm|add!)
_describe -t warp-points 'warp points' points && ret=0
add\!|rm)
_describe -t points "Warp points" warp_points && ret=0
;;
add)
_message 'Write the name of your warp point' && ret=0
;;
*)
esac
;;
esac
return $ret
}
_wd "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et
......@@ -6,4 +6,6 @@
#
# @github.com/mfaerevaag/wd
alias wd='. $ZSH/plugins/wd/wd.sh'
wd() {
. $ZSH/plugins/wd/wd.sh
}
......@@ -50,12 +50,12 @@ wd_warp()
wd_print_msg $YELLOW "Warping to current directory?"
else
(( n = $#1 - 1 ))
wd_print_msg $BLUE "Warping..."
#wd_print_msg $BLUE "Warping..."
cd -$n > /dev/null
fi
elif [[ ${points[$1]} != "" ]]
then
wd_print_msg $BLUE "Warping..."
#wd_print_msg $BLUE "Warping..."
cd ${points[$1]}
else
wd_print_msg $RED "Unkown warp point '$1'"
......@@ -64,16 +64,16 @@ wd_warp()
wd_add()
{
if [[ $1 =~ "^\.+$" ]]
if [[ $2 =~ "^\.+$" || $2 =~ "^\s*$" ]]
then
wd_print_msg $RED "Illeagal warp point (see README)."
elif [[ ${points[$1]} == "" ]] || $2
wd_print_msg $RED "Illegal warp point (see README)."
elif [[ ${points[$2]} == "" ]] || $1
then
wd_remove $1 > /dev/null
print "$1:$PWD" >> $CONFIG
wd_remove $2 > /dev/null
print "$2:$PWD" >> $CONFIG
wd_print_msg $GREEN "Warp point added"
else
wd_print_msg $YELLOW "Warp point '$1' alredy exists. Use 'add!' to overwrite."
wd_print_msg $YELLOW "Warp point '$2' already exists. Use 'add!' to overwrite."
fi
}
......@@ -83,7 +83,9 @@ wd_remove()
then
if wd_tmp=`sed "/^$1:/d" $CONFIG`
then
echo $wd_tmp > $CONFIG
# `>!` forces overwrite
# we need this if people use `setopt NO_CLOBBER`
echo $wd_tmp >! $CONFIG
wd_print_msg $GREEN "Warp point removed"
else
wd_print_msg $RED "Warp point unsuccessfully removed. Sorry!"
......@@ -131,9 +133,9 @@ wd_print_usage()
print "\nCommands:"
print "\t add \t Adds the current working directory to your warp points"
print "\t add! \t Overwrites existing warp point"
print "\t remove Removes the given warp point"
print "\t rm \t Removes the given warp point"
print "\t show \t Outputs warp points to current directory"
print "\t list \t Outputs all stored warp points"
print "\t ls \t Outputs all stored warp points"
print "\t help \t Show this extremely helpful text"
}
......@@ -141,7 +143,7 @@ wd_print_usage()
## run
# get opts
args=`getopt -o a:r:lhs -l add:,remove:,list,help,show -- $*`
args=`getopt -o a:r:lhs -l add:,rm:,ls,help,show -- $*`
# check if no arguments were given
if [[ $? -ne 0 || $#* -eq 0 ]]
......@@ -164,45 +166,36 @@ else
case "$i"
in
-a|--add|add)
wd_add $2 false
shift
shift
wd_add false $2
break
;;
-a!|--add!|add!)
wd_add $2 true
shift
shift
wd_add true $2
break
;;
-r|--remove|rm)
wd_remove $2
shift
shift
break
;;
-l|--list|ls)
wd_list_all
shift
break
;;
-h|--help|help)
wd_print_usage
shift
break
;;
-s|--show|show)
wd_show
shift
break
;;
*)
wd_warp $i
shift
break
;;
--)
shift; break;;
break
;;
esac
done
fi
......@@ -211,6 +204,6 @@ fi
## garbage collection
# if not, next time warp will pick up variables from this run
# remember, there's no sub shell
points=""
args=""
unhash -d val &> /dev/null # fixes issue #1
unset points
unset args
unset val &> /dev/null # fixes issue #1
......@@ -16,3 +16,4 @@ function xcsel {
alias xcb='xcodebuild'
alias xcp='xcode-select --print-path'
alias simulator='open $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'
# Yii basic command completion
_yii_get_command_list () {
protected/yiic | awk '/^ - [a-z]+/ { print $2 }'
}
_yii () {
if [ -f protected/yiic ]; then
compadd `_yii_get_command_list`
fi
}
compdef _yii protected/yiic
compdef _yii yiic
# Aliases
alias yiic='protected/yiic'
......@@ -11,13 +11,13 @@ ZSH_THEME="robbyrussell"
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Set to this to use case-sensitive completion
# Set this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Uncomment this to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment to change how often before auto-updates occur? (in days)
# Uncomment to change how often to auto-update? (in days)
# export UPDATE_ZSH_DAYS=13
# Uncomment following line if you want to disable colors in ls
......@@ -37,9 +37,9 @@ ZSH_THEME="robbyrussell"
# much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment following line if you want to shown in the command execution time stamp
# in the history command output. The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|
# yyyy-mm-dd
# Uncomment following line if you want to the command execution time stamp shown
# in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
......@@ -66,4 +66,3 @@ export PATH=$HOME/bin:/usr/local/bin:$PATH
# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"
......@@ -2,7 +2,7 @@
# #
# # #README
# #
# # This theme provides two customizable header functionalities :
# # This theme provides two customizable header functionalities:
# # a) displaying a pseudo-random message from a database of quotations
# # (https://en.wikipedia.org/wiki/Fortune_%28Unix%29)
# # b) displaying randomly command line tips from The command line fu
......@@ -26,10 +26,7 @@
# # -OS X: iTerm 2 (http://www.iterm2.com/)
# # -font Source code pro (https://github.com/adobe/source-code-pro)
# #
# # Author: Adolfo Benedetti
# # email: adolfo.benedetti@gmail.com
# # License: Public Domain
# # This theme's look and feel is based on the Aaron Toponce's zsh theme , more info:
# # This theme's look and feel is based on the Aaron Toponce's zsh theme, more info:
# # http://pthree.org/2008/11/23/727/
# # enjoy!
########## COLOR ###########
......
# af-magic.zsh-theme
#
# Author: Andy Fleming
# URL: http://andyfleming.com/
# Repo: https://github.com/andyfleming/oh-my-zsh
# Direct Link: https://github.com/andyfleming/oh-my-zsh/blob/master/themes/af-magic.zsh-theme
#
# Created on: June 19, 2012
# Last modified on: June 20, 2012
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
......@@ -27,7 +19,12 @@ eval my_gray='$FG[237]'
eval my_orange='$FG[214]'
# right prompt
RPROMPT='$(virtualenv_prompt_info)$my_gray%n@%m%{$reset_color%}%'
if type "virtualenv_prompt_info" > /dev/null
then
RPROMPT='$(virtualenv_prompt_info)$my_gray%n@%m%{$reset_color%}%'
else
RPROMPT='$my_gray%n@%m%{$reset_color%}%'
fi
# git settings
ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075](branch:"
......
......@@ -6,7 +6,7 @@
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://gist.github.com/1595572).
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#
# In addition, I recommend the
# [Solarized theme](https://github.com/altercation/solarized/) and, if you're
......@@ -88,9 +88,9 @@ prompt_git() {
zstyle ':vcs_info:*' stagedstr '✚'
zstyle ':vcs_info:git:*' unstagedstr '●'
zstyle ':vcs_info:*' formats ' %u%c'
zstyle ':vcs_info:*' actionformats '%u%c'
zstyle ':vcs_info:*' actionformats ' %u%c'
vcs_info
echo -n "${ref/refs\/heads\//± }${vcs_info_msg_0_}"
echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_%% }"
fi
}
......
#
# Author:: Andrew Vit (<andrew@avit.ca>)
#
# AVIT ZSH Theme
#
# Copyright 2011, Andrew Vit
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
PROMPT='
$(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version)
......
......@@ -101,12 +101,12 @@ _1RIGHT="[%*] "
bureau_precmd () {
_1SPACES=`get_space $_1LEFT $_1RIGHT`
echo
print
print -rP "$_1LEFT$_1SPACES$_1RIGHT"
}
setopt prompt_subst
PROMPT='$_1LEFT$_1SPACES$_1RIGHT
> $_LIBERTY '
PROMPT='> $_LIBERTY '
RPROMPT='$(nvm_prompt_info) $(bureau_git_prompt)'
autoload -U add-zsh-hook
......
# neuralsanwich.zsh-theme
#
# Author: Sean Jones
# URL: http://www.neuralsandwich.com
# Repo:
# Direct link:
# Create:
# Modified:
if [ "x$OH_MY_ZSH_HG" = "x" ]; then
OH_MY_ZSH_HG="hg"
......
# -----------------------------------------------------------------------------
# FILE: dogenpunk.zsh-theme
# DESCRIPTION: oh-my-zsh theme file.
# AUTHOR: Matthew Nelson (dogenpunk@gmail.com)
# VERSION: 0.1
# SCREENSHOT: coming soon
# -----------------------------------------------------------------------------
# dogenpunk.zsh-theme
MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}"
local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment