Commit 37266112 authored by Sébastien M-B's avatar Sébastien M-B
Browse files

Merge remote branch 'upstream/master'

parents 9969fca2 c133f418
...@@ -3,14 +3,11 @@ HISTFILE=$HOME/.zsh_history ...@@ -3,14 +3,11 @@ HISTFILE=$HOME/.zsh_history
HISTSIZE=10000 HISTSIZE=10000
SAVEHIST=10000 SAVEHIST=10000
setopt hist_ignore_dups # ignore duplication command history list setopt append_history
setopt share_history # share command history data
setopt hist_verify
setopt inc_append_history
setopt extended_history setopt extended_history
setopt hist_expire_dups_first setopt hist_expire_dups_first
setopt hist_ignore_dups # ignore duplication command history list
setopt hist_ignore_space setopt hist_ignore_space
setopt hist_verify
setopt SHARE_HISTORY setopt inc_append_history
setopt APPEND_HISTORY setopt share_history # share command history data
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#Limited support for Apple Terminal (Terminal can't set window or tab separately) #Limited support for Apple Terminal (Terminal can't set window or tab separately)
function title { function title {
[ "$DISABLE_AUTO_TITLE" != "true" ] || return [ "$DISABLE_AUTO_TITLE" != "true" ] || return
if [[ "$TERM" == screen* ]]; then if [[ "$TERM" == screen* ]]; then
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
print -Pn "\e]2;$2:q\a" #set window name print -Pn "\e]2;$2:q\a" #set window name
...@@ -16,14 +16,18 @@ ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD ...@@ -16,14 +16,18 @@ ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
#Appears when you have the prompt #Appears when you have the prompt
function precmd { function omz_termsupport_precmd {
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
} }
#Appears at the beginning of (and during) of command execution #Appears at the beginning of (and during) of command execution
function preexec { function omz_termsupport_preexec {
emulate -L zsh emulate -L zsh
setopt extended_glob setopt extended_glob
local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
title "$CMD" "%100>...>$2%<<" title "$CMD" "%100>...>$2%<<"
} }
autoload -U add-zsh-hook
add-zsh-hook precmd omz_termsupport_precmd
add-zsh-hook preexec omz_termsupport_preexec
...@@ -13,20 +13,27 @@ fpath=($ZSH/functions $ZSH/completions $fpath) ...@@ -13,20 +13,27 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
# TIP: Add files you don't want in git to .gitignore # TIP: Add files you don't want in git to .gitignore
for config_file ($ZSH/lib/*.zsh) source $config_file for config_file ($ZSH/lib/*.zsh) source $config_file
# Add all defined plugins to fpath # Set ZSH_CUSTOM to the path where your custom config files
# and plugins exists, or else we will use the default custom/
if [[ -z "$ZSH_CUSTOM" ]]; then
ZSH_CUSTOM="$ZSH/custom"
fi
# Add all defined plugins to fpath. This must be done
# before running compinit.
plugin=${plugin:=()} plugin=${plugin:=()}
for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath) for plugin ($plugins); do
if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
fpath=($ZSH/plugins/$plugin $fpath)
fi
done
# Load and run compinit # Load and run compinit
autoload -U compinit autoload -U compinit
compinit -i compinit -i
# Set ZSH_CUSTOM to the path where your custom config files
# and plugins exists, or else we will use the default custom/
if [ "$ZSH_CUSTOM" = "" ]
then
ZSH_CUSTOM="$ZSH/custom"
fi
# Load all of the plugins that were defined in ~/.zshrc # Load all of the plugins that were defined in ~/.zshrc
for plugin ($plugins); do for plugin ($plugins); do
......
if [ -f `brew --prefix`/etc/autojump ]; then if [ -f /opt/local/etc/profile.d/autojump.sh ]; then
. /opt/local/etc/profile.d/autojump.sh
elif [ -f `brew --prefix`/etc/autojump ]; then
. `brew --prefix`/etc/autojump . `brew --prefix`/etc/autojump
fi fi
...@@ -3,30 +3,43 @@ ...@@ -3,30 +3,43 @@
# pip zsh completion, based on homebrew completion # pip zsh completion, based on homebrew completion
_pip_all() {
# we cache the list of packages (originally from the macports plugin)
if (( ! $+piplist )); then
echo -n " (caching package index...)"
piplist=($(pip search * | cut -d ' ' -f 1 | tr '[A-Z]' '[a-z]'))
fi
}
_pip_installed() { _pip_installed() {
installed_pkgs=(`pip freeze`) installed_pkgs=(`pip freeze | cut -d '=' -f 1`)
} }
local -a _1st_arguments local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'bundle:Create pybundles (archives containing multiple packages)' 'bundle:create pybundles (archives containing multiple packages)'
'freeze:Output all currently installed packages (exact versions) to stdout' 'freeze:output all currently installed packages (exact versions) to stdout'
'help:Show available commands' 'help:show available commands'
'install:Install packages' 'install:install packages'
'search:Search PyPI' 'search:search PyPI'
'uninstall:Uninstall packages' 'uninstall:uninstall packages'
'unzip:Unzip individual packages' 'unzip:unzip individual packages'
'zip:Zip individual packages' 'zip:zip individual packages'
) )
local expl local expl
local -a pkgs installed_pkgs local -a all_pkgs installed_pkgs
_arguments \ _arguments \
'(--version)--version[Show version number of program and exit]' \ '(--version)--version[show version number of program and exit]' \
'(-v --verbose)'{-v,--verbose}'[Give more output]' \ '(-h --help)'{-h,--help}'[show help]' \
'(-q --quiet)'{-q,--quiet}'[Give less output]' \ '(-E --environment)'{-E,--environment}'[virtualenv environment to run pip in]' \
'(-h --help)'{-h,--help}'[Show help]' \ '(-s --enable-site-packages)'{-s,--enable-site-packages}'[include site-packages in virtualenv]' \
'(-v --verbose)'{-v,--verbose}'[give more output]' \
'(-q --quiet)'{-q,--quiet}'[give less output]' \
'(--log)--log[log file location]' \
'(--proxy)--proxy[proxy in form user:passwd@proxy.server:port]' \
'(--timeout)--timeout[socket timeout (default 15s)]' \
'*:: :->subcmds' && return 0 '*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then
...@@ -35,10 +48,25 @@ if (( CURRENT == 1 )); then ...@@ -35,10 +48,25 @@ if (( CURRENT == 1 )); then
fi fi
case "$words[1]" in case "$words[1]" in
list) search)
if [[ "$state" == forms ]]; then _arguments \
_pip_installed '(--index)--index[base URL of Python Package Index]' ;;
_requested installed_pkgs expl 'installed packages' compadd -a installed_pkgs freeze)
_arguments \
'(-l --local)'{-l,--local}'[report only virtualenv packages]' ;;
install)
_arguments \
'(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' \
'(-f --find-links)'{-f,--find-links}'[URL for finding packages]' \
'(--no-deps --no-dependencies)'{--no-deps,--no-dependencies}'[iIgnore package dependencies]' \
'(--no-install)--no-install[only download packages]' \
'(--no-download)--no-download[only install downloaded packages]' \
'(--install-option)--install-option[extra arguments to be supplied to the setup.py]' \
'1: :->packages' && return 0
if [[ "$state" == packages ]]; then
_pip_all
_wanted piplist expl 'packages' compadd -a piplist
fi ;; fi ;;
uninstall) uninstall)
_pip_installed _pip_installed
......
...@@ -17,3 +17,5 @@ alias rp='_rails_command plugin' ...@@ -17,3 +17,5 @@ alias rp='_rails_command plugin'
alias rs='_rails_command server' alias rs='_rails_command server'
alias rsd='_rails_command server --debugger' alias rsd='_rails_command server --debugger'
alias devlog='tail -f log/development.log' alias devlog='tail -f log/development.log'
alias rdm='rake db:migrate'
alias rdr='rake db:rollback'
This plugin provides a wrapper around the "wakeonlan" tool available from most
distributions' package repositories, or from the following website:
http://gsd.di.uminho.pt/jpo/software/wakeonlan/
In order to use this wrapper, create the ~/.wakeonlan directory, and place in
that directory one file for each device you would like to be able to wake. Give
the file a name that describes the device, such as its hostname. Each file
should contain a line with the mac address of the target device and the network
broadcast address.
For instance, there might be a file ~/.wakeonlan/leto with the following
contents:
00:11:22:33:44:55:66 192.168.0.255
To wake that device, use the following command:
# wake leto
The available device names will be autocompleted, so:
# wake <tab>
...will suggest "leto", along with any other configuration files that were
placed in the ~/.wakeonlan directory.
For more information regarding the configuration file format, check the
wakeonlan man page.
#compdef wake
#autoload
_arguments "1:device to wake:_files -W '$HOME/.wakeonlan'" && return 0
function wake() {
local config_file="$HOME/.wakeonlan/$1"
if [[ ! -f "$config_file" ]]; then
echo "ERROR: There is no configuration file at \"$config_file\"."
return 1
fi
if (( ! $+commands[wakeonlan] )); then
echo "ERROR: Can't find \"wakeonlan\". Are you sure it's installed?"
return 1
fi
wakeonlan -f "$config_file"
}
...@@ -2,7 +2,7 @@ function toon { ...@@ -2,7 +2,7 @@ function toon {
echo -n "" echo -n ""
} }
get_git_dirty() { get_git_dirty() {
git diff --quiet || echo '*' git diff --quiet || echo '*'
} }
...@@ -18,9 +18,12 @@ zstyle ':vcs_info:*' formats \ ...@@ -18,9 +18,12 @@ zstyle ':vcs_info:*' formats \
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' enable git cvs svn zstyle ':vcs_info:*' enable git cvs svn
precmd () { theme_precmd () {
vcs_info vcs_info
} }
setopt prompt_subst setopt prompt_subst
PROMPT='%{$fg[magenta]%}$(toon)%{$reset_color%} %~/ %{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}' PROMPT='%{$fg[magenta]%}$(toon)%{$reset_color%} %~/ %{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}'
autoload -U add-zsh-hook
add-zsh-hook precmd theme_precmd
\ No newline at end of file
...@@ -14,6 +14,8 @@ git_custom_status() { ...@@ -14,6 +14,8 @@ git_custom_status() {
#RVM and git settings #RVM and git settings
if [[ -s ~/.rvm/scripts/rvm ]] ; then if [[ -s ~/.rvm/scripts/rvm ]] ; then
RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1' RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1'
else
RPS1='$(git_custom_status) $EPS1'
fi fi
PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b ' PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '
function precmd { function theme_precmd {
local TERMWIDTH local TERMWIDTH
(( TERMWIDTH = ${COLUMNS} - 1 )) (( TERMWIDTH = ${COLUMNS} - 1 ))
### ###
# Truncate the path if it's too long. # Truncate the path if it's too long.
PR_FILLBAR="" PR_FILLBAR=""
PR_PWDLEN="" PR_PWDLEN=""
local promptsize=${#${(%):---(%n@%m:%l)---()--}} local promptsize=${#${(%):---(%n@%m:%l)---()--}}
local rubyprompt=`rvm_prompt_info` local rubyprompt=`rvm_prompt_info`
local rubypromptsize=${#${rubyprompt}} local rubypromptsize=${#${rubyprompt}}
local pwdsize=${#${(%):-%~}} local pwdsize=${#${(%):-%~}}
if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then
((PR_PWDLEN=$TERMWIDTH - $promptsize)) ((PR_PWDLEN=$TERMWIDTH - $promptsize))
else else
...@@ -24,7 +24,7 @@ function precmd { ...@@ -24,7 +24,7 @@ function precmd {
setopt extended_glob setopt extended_glob
preexec () { theme_preexec () {
if [[ "$TERM" == "screen" ]]; then if [[ "$TERM" == "screen" ]]; then
local CMD=${1[(wr)^(*=*|sudo|-*)]} local CMD=${1[(wr)^(*=*|sudo|-*)]}
echo -n "\ek$CMD\e\\" echo -n "\ek$CMD\e\\"
...@@ -69,7 +69,7 @@ setprompt () { ...@@ -69,7 +69,7 @@ setprompt () {
### ###
# See if we can use extended characters to look nicer. # See if we can use extended characters to look nicer.
typeset -A altchar typeset -A altchar
set -A altchar ${(s..)terminfo[acsc]} set -A altchar ${(s..)terminfo[acsc]}
PR_SET_CHARSET="%{$terminfo[enacs]%}" PR_SET_CHARSET="%{$terminfo[enacs]%}"
...@@ -81,10 +81,10 @@ setprompt () { ...@@ -81,10 +81,10 @@ setprompt () {
PR_LRCORNER=${altchar[j]:--} PR_LRCORNER=${altchar[j]:--}
PR_URCORNER=${altchar[k]:--} PR_URCORNER=${altchar[k]:--}
### ###
# Decide if we need to set titlebar text. # Decide if we need to set titlebar text.
case $TERM in case $TERM in
xterm*) xterm*)
PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}' PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
...@@ -96,8 +96,8 @@ setprompt () { ...@@ -96,8 +96,8 @@ setprompt () {
PR_TITLEBAR='' PR_TITLEBAR=''
;; ;;
esac esac
### ###
# Decide whether to set a screen title # Decide whether to set a screen title
if [[ "$TERM" == "screen" ]]; then if [[ "$TERM" == "screen" ]]; then
...@@ -105,8 +105,8 @@ setprompt () { ...@@ -105,8 +105,8 @@ setprompt () {
else else
PR_STITLE='' PR_STITLE=''
fi fi
### ###
# Finally, the prompt. # Finally, the prompt.
...@@ -135,3 +135,7 @@ $PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR ' ...@@ -135,3 +135,7 @@ $PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR '
} }
setprompt setprompt
autoload -U add-zsh-hook
add-zsh-hook precmd theme_precmd
add-zsh-hook preexec theme_preexec
\ No newline at end of file
...@@ -7,7 +7,7 @@ zstyle ':vcs_info:*' unstagedstr '%F{yellow}●' ...@@ -7,7 +7,7 @@ zstyle ':vcs_info:*' unstagedstr '%F{yellow}●'
zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r' zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
zstyle ':vcs_info:*' enable git svn zstyle ':vcs_info:*' enable git svn
precmd () { theme_precmd () {
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] { if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]' zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]'
} else { } else {
...@@ -19,3 +19,6 @@ precmd () { ...@@ -19,3 +19,6 @@ precmd () {
setopt prompt_subst setopt prompt_subst
PROMPT='%B%F{magenta}%c%B%F{green}${vcs_info_msg_0_}%B%F{magenta} %{$reset_color%}%% ' PROMPT='%B%F{magenta}%c%B%F{green}${vcs_info_msg_0_}%B%F{magenta} %{$reset_color%}%% '
autoload -U add-zsh-hook
add-zsh-hook precmd theme_precmd
# Yay! High voltage and arrows!
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
PROMPT='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}$(git_prompt_info)%{$fg[cyan]%}⇒%{$reset_color%} '
function prompt_char {
git branch >/dev/null 2>/dev/null && echo '±' && return
hg root >/dev/null 2>/dev/null && echo 'Hg' && return
echo '○'
}
function virtualenv_info {
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
}
function collapse_pwd {
echo $(pwd | sed -e "s,^$HOME,~,")
}
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) '
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=""
PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
RPROMPT='%{$reset_color%} %{$fg[red]%}$(~/.rvm/bin/rvm-prompt i v) %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
...@@ -8,6 +8,12 @@ function _update_zsh_update() { ...@@ -8,6 +8,12 @@ function _update_zsh_update() {
echo "LAST_EPOCH=$(_current_epoch)" > ~/.zsh-update echo "LAST_EPOCH=$(_current_epoch)" > ~/.zsh-update
} }
function _upgrade_zsh() {
/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
# update the zsh file
_update_zsh_update
}
if [ -f ~/.zsh-update ] if [ -f ~/.zsh-update ]
then then
. ~/.zsh-update . ~/.zsh-update
...@@ -19,17 +25,21 @@ then ...@@ -19,17 +25,21 @@ then
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH)) epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
if [ $epoch_diff -gt 6 ] if [ $epoch_diff -gt 6 ]
then then
echo "[Oh My Zsh] Would you like to check for updates?" if [ "$DISABLE_UPDATE_PROMPT" = "true" ]
echo "Type Y to update oh-my-zsh: \c"
read line
if [ "$line" = Y ] || [ "$line" = y ]
then then
/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh _upgrade_zsh
# update the zsh file else
_update_zsh_update echo "[Oh My Zsh] Would you like to check for updates?"
echo "Type Y to update oh-my-zsh: \c"
read line
if [ "$line" = Y ] || [ "$line" = y ]
then
_upgrade_zsh
fi
fi fi
fi fi
else else
# create the zsh file # create the zsh file
_update_zsh_update _update_zsh_update
fi fi
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