Merge remote-tracking branch 'upstream/master' into refactor-plugin-loading-functionality

This commit is contained in:
João Távora 2014-12-13 17:37:46 +00:00
commit 61d57131c2
115 changed files with 1763 additions and 473 deletions

View File

@ -1,110 +1,111 @@
!https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png!
oh-my-zsh is an open source, community-driven framework for managing your ZSH configuration. It comes bundled with a ton of helpful functions, helpers, plugins, themes, and few things that make you shout...
@oh-my-zsh@ is an open source, community-driven framework for managing your "Zsh":http://www.zsh.org/ configuration.
It comes bundled with a ton of helpful functions, helpers, plugins, themes, and a few things that make you shout…
bq. "OH MY ZSHELL!"
h2. Setup
@oh-my-zsh@ should work with any recent release of "zsh":http://www.zsh.org/, the minimum recommended version is 4.3.9.
@oh-my-zsh@ should work with any recent release of "Zsh":http://www.zsh.org/. The minimum recommended version is *4.3.9*.
h3. The automatic installer... (do you trust me?)
If not already installed, you can install "Zsh":http://www.zsh.org/ using the command-line.
You can install this via the command line with either `curl` or `wget`.
h3. The automatic installer… do you trust me?
h4. via `curl`
You can install this via the command-line with either @curl@ or @wget@.
h4. via @curl@:
@curl -L http://install.ohmyz.sh | sh@
h4. via `wget`
h4. via @wget@:
@wget --no-check-certificate http://install.ohmyz.sh -O - | sh@
h4. Optional: change the install directory
h4. *Optionally*, change the install directory:
The default location is `~/.oh-my-zsh` (hidden in your home directory).
The default location is @~/.oh-my-zsh@ (hidden in your home directory).
You can change the install directory with the ZSH environment variable, either
by running `export ZSH=/your/path` before installing, or setting it before the
end of the install pipeline like this:
You can change the install directory with the @ZSH@ environment variable, either by running @export ZSH=/your/path@ before installing, or by setting it before the end of the install pipeline like this:
@curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | ZSH=~/.dotfiles/zsh sh@
h3. The manual way
1. Clone the repository
1. Clone the repository:
@git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@
@git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@
2. *OPTIONAL* Backup your existing ~/.zshrc file
2. *Optionally*, backup your existing @~/.zshrc@ file:
@cp ~/.zshrc ~/.zshrc.orig@
@cp ~/.zshrc ~/.zshrc.orig@
3. Create a new zsh config by copying the zsh template we've provided.
3. Create a new "Zsh":http://www.zsh.org/ config file by copying the "Zsh":http://www.zsh.org/ template we've provided:
@cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc@
@cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc@
4. Set zsh as your default shell:
4. Set "Zsh":http://www.zsh.org/ as your default shell:
@chsh -s /bin/zsh@
@chsh -s /bin/zsh@
5. Start / restart zsh (open a new terminal is easy enough...)
5. Start or restart "Zsh":http://www.zsh.org/ by opening a new command-line window.
h3. Problems?
You _might_ need to modify your PATH in ~/.zshrc if you're not able to find some commands after switching to _Oh My Zsh_.
You _might_ need to modify your @PATH@ in @~/.zshrc@ if you're not able to find some commands after switching to @oh-my-zsh@.
If you installed manually or changed the install location, check ZSH in ~/.zshrc
If you installed manually or changed the install location, check the @ZSH@ environment variable in @~/.zshrc@.
h2. Usage
* enable the plugins you want in your @~/.zshrc@ (take a look at the @plugins/@ directory and the "wiki":https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins to see what's possible)
* enable the plugins you want in your @~/.zshrc@ (take a look at the @plugins/@ directory and the "wiki":https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins to see what's available)
** example: @plugins=(git osx ruby)@
* Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@.
** Take a look at the "current themes":https://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with _Oh My Zsh_.
* much much more... take a look at @lib/@ what _Oh My Zsh_ offers...
* theme support: change the @ZSH_THEME@ environment variable in @~/.zshrc@
** take a look at the @themes/@ directory and the "wiki":https://wiki.github.com/robbyrussell/oh-my-zsh/themes to see what comes bundled with @oh-my-zsh@
* & much, much more… take a look at the @lib/@ directory to see what @oh-my-zsh@ has to offer…
h2. Useful
the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty for tips.
The "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty useful for tips.
h3. Customization
If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory.
If you have many functions which go well together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin.
If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@.
If you want to override any of the default behaviors, just add a new file (ending in @.zsh@) in the @custom/@ directory.
If you have many functions that go well together, you can put them as a @*.plugin.zsh@ file in the @custom/plugins/@ directory and then enable this plugin (see '"Usage":https://github.com/robbyrussell/oh-my-zsh#usage' above).
If you would like to override the functionality of a plugin distributed with @oh-my-zsh@, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@.
h3. Updates
By default you will be prompted to check for updates. If you would like oh-my-zsh to automatically update itself without prompting you, set the following in your ~/.zshrc
By default you will be prompted to check for upgrades. If you would like @oh-my-zsh@ to automatically upgrade itself without prompting you, set the following in your @~/.zshrc@:
@DISABLE_UPDATE_PROMPT=true@
To disable updates entirely, put this in your ~/.zshrc
To disable upgrades entirely, set the following in your @~/.zshrc@:
@DISABLE_AUTO_UPDATE=true@
To upgrade directly from the command line, just run @upgrade_oh_my_zsh@
To upgrade directly from the command-line, just run @upgrade_oh_my_zsh@.
h3. Uninstalling
If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command line and it'll remove itself and revert you to bash (or your previous zsh config).
If you want to uninstall @oh-my-zsh@, just run @uninstall_oh_my_zsh@ from the command-line and it'll remove itself and revert you to @bash@ (or your previous "Zsh":http://www.zsh.org/ configuration).
h2. Help out!
I'm far from being a zsh-expert and suspect there are many ways to improve. If you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
I'm far from being a "Zsh":http://www.zsh.org/ expert and suspect there are many ways to improve if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
h3. (Don't) Send us your theme! (for now)
h3. (Don't) send us your theme (for now)!
-I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory.-
-I'm hoping to collect a bunch of themes you can see existing ones in the @themes/@ directory.-
We have enough themes for the time being. Please fork the project and add on in there, you can let people know how to grab it from there.
We have enough themes for the time being. Please fork the project and add on in there you can let people know how to grab it from there.
h2. Contributors
This project wouldn't exist without all of our awesome users and contributors.
* "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors
This project wouldn't exist without all of our awesome users and contributors: "view our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors
Thank you so much!

4
cache/.easter-egg vendored Normal file
View File

@ -0,0 +1,4 @@
This file is only here so that Git will keep a cache directory as .gitignore is ignoring all the files within it.
Feel free to add love notes for people here.

View File

@ -30,7 +30,6 @@ alias lsa='ls -lah'
alias l='ls -lah'
alias ll='ls -lh'
alias la='ls -lAh'
alias sl=ls # often screw this up
alias afind='ack-grep -il'

View File

@ -25,7 +25,12 @@ bindkey -M menuselect '^o' accept-and-infer-next-history
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
if [ "$OSTYPE[0,7]" = "solaris" ]
then
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm"
else
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
fi
# disable named-directories autocompletion
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
@ -44,7 +49,7 @@ zstyle ':completion:*:*:*:users' ignored-patterns \
named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
usbmux uucp vcsa wwwrun xfs
usbmux uucp vcsa wwwrun xfs '_*'
# ... unless we really want to.
zstyle '*' single-ignored show

View File

@ -1,13 +1,13 @@
alias man='nocorrect man'
alias mv='nocorrect mv'
alias mysql='nocorrect mysql'
alias mkdir='nocorrect mkdir'
alias gist='nocorrect gist'
alias heroku='nocorrect heroku'
alias ebuild='nocorrect ebuild'
alias hpodder='nocorrect hpodder'
alias sudo='nocorrect sudo'
if [[ "$ENABLE_CORRECTION" == "true" ]]; then
alias ebuild='nocorrect ebuild'
alias gist='nocorrect gist'
alias heroku='nocorrect heroku'
alias hpodder='nocorrect hpodder'
alias man='nocorrect man'
alias mkdir='nocorrect mkdir'
alias mv='nocorrect mv'
alias mysql='nocorrect mysql'
alias sudo='nocorrect sudo'
setopt correct_all
fi

View File

@ -1,5 +1,4 @@
# Changing/making/removing directory
setopt auto_name_dirs
setopt auto_pushd
setopt pushd_ignore_dups
setopt pushdminus

View File

@ -3,11 +3,11 @@ function zsh_stats() {
}
function uninstall_oh_my_zsh() {
/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh
env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh
}
function upgrade_oh_my_zsh() {
/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
}
function take() {

View File

@ -1,8 +1,8 @@
# get the name of the branch we are on
function git_prompt_info() {
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi
}
@ -10,23 +10,20 @@ function git_prompt_info() {
# Checks if working tree is dirty
parse_git_dirty() {
local SUBMODULE_SYNTAX=''
local GIT_STATUS=''
local CLEAN_MESSAGE='nothing to commit (working directory clean)'
if [[ "$(command git config --get oh-my-zsh.hide-status)" != "1" ]]; then
local STATUS=''
local FLAGS
FLAGS=('--porcelain')
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
FLAGS+='--ignore-submodules=dirty'
fi
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1)
else
GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
fi
if [[ -n $GIT_STATUS ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
FLAGS+='--untracked-files=no'
fi
STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
fi
if [[ -n $STATUS ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
@ -54,11 +51,19 @@ git_remote_status() {
# Checks if there are commits ahead from remote
function git_prompt_ahead() {
if $(echo "$(command git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
fi
}
# Gets the number of commits ahead from remote
function git_commits_ahead() {
if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ')
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
fi
}
# Formats prompt string for current git commit short SHA
function git_prompt_short_sha() {
SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
@ -127,17 +132,19 @@ function git_compare_version() {
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
for i in {1..3}; do
if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then
echo 1
return 0
fi
if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then
echo -1
return 0
fi
done
echo 1
echo 0
}
#this is unlikely to change so make it all statically assigned
POST_1_7_2_GIT=$(git_compare_version "1.7.2")
#clean up the namespace slightly by removing the checker function
unset -f git_compare_version

View File

@ -34,6 +34,5 @@ function omz_termsupport_preexec {
title '$CMD' '%100>...>$LINE%<<'
}
autoload -U add-zsh-hook
add-zsh-hook precmd omz_termsupport_precmd
add-zsh-hook preexec omz_termsupport_preexec
precmd_functions+=(omz_termsupport_precmd)
preexec_functions+=(omz_termsupport_preexec)

View File

@ -1,6 +1,6 @@
# Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
/usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
fi
# Initializes Oh My Zsh
@ -8,18 +8,20 @@ fi
# add a function path
fpath=($ZSH/functions $ZSH/completions $fpath)
# Load all of the config files in ~/oh-my-zsh that end in .zsh
# TIP: Add files you don't want in git to .gitignore
for config_file ($ZSH/lib/*.zsh); do
source $config_file
done
# 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
# Load all of the config files in ~/oh-my-zsh that end in .zsh
# TIP: Add files you don't want in git to .gitignore
for config_file ($ZSH/lib/*.zsh); do
custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}"
[ -f "${custom_config_file}" ] && config_file=${custom_config_file}
source $config_file
done
is_plugin() {
local base_dir=$1
@ -57,15 +59,17 @@ for plugin ($plugins); do
done
# Figure out the SHORT hostname
if [ -n "$commands[scutil]" ]; then
# OS X
SHORT_HOST=$(scutil --get ComputerName)
if [[ "$OSTYPE" = darwin* ]]; then
# OS X'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/.*/}
fi
# Save the location of the current completion dump file.
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
if [ -z "$ZSH_COMPDUMP" ]; then
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
fi
# Load and run compinit
autoload -U compinit

8
plugins/adb/README.md Normal file
View File

@ -0,0 +1,8 @@
# adb autocomplete plugin
* Adds autocomplete options for all adb commands.
## Requirements
In order to make this work, you will need to have the Android adb tools set up in your path.

39
plugins/adb/_adb Normal file
View File

@ -0,0 +1,39 @@
#compdef adb
#autoload
# in order to make this work, you will need to have the android adb tools
# adb zsh completion, based on homebrew completion
local -a _1st_arguments
_1st_arguments=(
'bugreport:return all information from the device that should be included in a bug report.'
'connect:connect to a device via TCP/IP Port 5555 is default.'
'devices:list all connected devices'
'disconnect:disconnect from a TCP/IP device. Port 5555 is default.'
'emu:run emulator console command'
'forward:forward socket connections'
'help:show the help message'
'install:push this package file to the device and install it'
'jdwp:list PIDs of processes hosting a JDWP transport'
'logcat:View device log'
'pull:copy file/dir from device'
'push:copy file/dir to device'
'shell:run remote shell interactively'
'sync:copy host->device only if changed (-l means list but dont copy)'
'uninstall:remove this app package from the device'
'version:show version num'
)
local expl
local -a pkgs installed_pkgs
_arguments \
'*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "adb subcommand" _1st_arguments
return
fi
_files

View File

@ -21,10 +21,14 @@ if [[ -x `which yaourt` ]]; then
alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local")
alias yaorph='yaourt -Qtd' # Remove orphans using yaourt
# Additional yaourt alias examples
if [[ -x `which abs` ]]; then
if [[ -x `which abs` && -x `which aur` ]]; then
alias yaupd='yaourt -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
elif [[ -x `which abs` ]]; then
alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
elif [[ -x `which aur` ]]; then
alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
else
alias yaupd='yaourt -Sy' # Update and refresh the local package and ABS databases against repositories
alias yaupd='yaourt -Sy' # Update and refresh the local package database against repositories
fi
alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package
alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
@ -45,10 +49,14 @@ alias pacreps='pacman -Ss' # Search for package(s) in the repositori
alias pacloc='pacman -Qi' # Display information about a given package in the local database
alias paclocs='pacman -Qs' # Search for package(s) in the local database
# Additional pacman alias examples
if [[ -x `which abs` ]]; then
alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
if [[ -x `which abs` && -x `which aur` ]]; then
alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
elif [[ -x `which abs` ]]; then
alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
elif [[ -x `which aur` ]]; then
alias pacupd='sudo pacman -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
else
alias pacupd='sudo pacman -Sy' # Update and refresh the local package and ABS databases against repositories
alias pacupd='sudo pacman -Sy' # Update and refresh the local package database against repositories
fi
alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package
alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist

View File

@ -1,5 +1,9 @@
if [ $commands[autojump] ]; then # check if autojump is installed
if [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package
if [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
. $HOME/.autojump/etc/profile.d/autojump.zsh
elif [ -f $HOME/.nix-profile/etc/profile.d/autojump.zsh ]; then # nix installation
. $HOME/.nix-profile/etc/profile.d/autojump.zsh
elif [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package
. /usr/share/autojump/autojump.zsh
elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
. /etc/profile.d/autojump.zsh
@ -7,8 +11,6 @@ if [ $commands[autojump] ]; then # check if autojump is installed
. /etc/profile.d/autojump.sh
elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation
. /usr/local/share/autojump/autojump.zsh
elif [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
. $HOME/.autojump/etc/profile.d/autojump.zsh
elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports
. /opt/local/etc/profile.d/autojump.zsh
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.zsh ]; then # mac os x with brew

View File

@ -1,17 +1,28 @@
_homebrew-installed() {
type brew &> /dev/null
}
_awscli-homebrew-installed() {
brew list awscli &> /dev/null
}
export AWS_HOME=~/.aws
function agp {
echo $AWS_DEFAULT_PROFILE
}
function asp {
export AWS_DEFAULT_PROFILE=$1
export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>"
export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>"
}
function aws_profiles {
reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/'))
}
compctl -K aws_profiles asp
source `which aws_zsh_completer.sh`
if _homebrew-installed && _awscli-homebrew-installed ; then
source $(brew --prefix)/opt/awscli/libexec/bin/aws_zsh_completer.sh
else
source `which aws_zsh_completer.sh`
fi

View File

@ -8,7 +8,7 @@
# Modified to add support for Apple Mac #
###########################################
if [[ $(uname) == "Darwin" ]] ; then
if [[ "$OSTYPE" = darwin* ]] ; then
function battery_pct() {
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"

20
plugins/bbedit/README.md Normal file
View File

@ -0,0 +1,20 @@
## bbedit
Plugin for BBEdit, an HTML and text editor for Mac OS X
### Requirements
* [BBEdit](http://www.barebones.com/products/bbedit/)
* [BBEdit Command-Line Tools](http://www.barebones.com/support/bbedit/cmd-line-tools.html)
### Usage
* If the `bb` command is called without an argument, launch BBEdit
* If `bb` is passed a directory, cd to it and open it in BBEdit
* If `bb` is passed a file, open it in BBEdit
* If `bbpb` create a new BBEdit document with the contents of the clipboard
* If `bbd` alias for BBEdit diff tool

View File

@ -0,0 +1,21 @@
alias bbpb='pbpaste | bbedit --clean --view-top'
alias bbd=bbdiff
#
# If the bb command is called without an argument, launch BBEdit
# If bb is passed a directory, cd to it and open it in BBEdit
# If bb is passed a file, open it in BBEdit
#
function bb() {
if [[ -z "$1" ]]
then
bbedit --launch
else
bbedit "$1"
if [[ -d "$1" ]]
then
cd "$1"
fi
fi
}

0
plugins/bower/_bower Executable file → Normal file
View File

View File

@ -50,6 +50,7 @@ _1st_arguments=(
'server:start a local web app that lets you browse formulae (requires Sinatra)'
'services:small wrapper around `launchctl` for supported formulae'
'tap:tap a new formula repository from GitHub, or list existing taps'
'uninstall:uninstall a formula'
'unlink:unlink a formula'
'unpin:unpin specified formulae'
'untap:remove a tapped repository'

View File

@ -1 +1,2 @@
alias brews='brew list -1'
alias bubu="brew update && brew upgrade && brew cleanup"

49
plugins/bundler/README.md Normal file
View File

@ -0,0 +1,49 @@
# Bundler
- adds completion for basic bundler commands
- adds short aliases for common bundler commands
- `be` aliased to `bundle exec`
- `bl` aliased to `bundle list`
- `bp` aliased to `bundle package`
- `bo` aliased to `bundle open`
- `bu` aliased to `bundle update`
- `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`)
- adds a wrapper for common gems:
- looks for a binstub under `./bin/` and executes it (if present)
- calls `bundle exec <gem executable>` otherwise
For a full list of *common gems* being wrapped by default please look at the `bundler.plugin.zsh` file.
## Configuration
Please use the exact name of the executable and not the gem name.
### Add additional gems to be wrapped
Add this before the plugin-list in your `.zshrc`:
```sh
BUNDLED_COMMANDS=(rubocop)
plugins=(... bundler ...)
```
This will add the wrapper for the `rubocop` gem (i.e. the executable).
### Exclude gems from being wrapped
Add this before the plugin-list in your `.zshrc`:
```sh
UNBUNDLED_COMMANDS=(foreman spin)
plugins=(... bundler ...)
```
This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped.
## Excluded gems
These gems should not be called with `bundle exec`. Please see the Issues on GitHub for clarification.
`berks`
`foreman`
`mailcatcher`
`rails`
`ruby`
`spin`

View File

@ -18,11 +18,13 @@ case $state in
"check[Determine whether the requirements for your application are installed]" \
"list[Show all of the gems in the current bundle]" \
"show[Show the source location of a particular gem in the bundle]" \
"outdated[Show all of the outdated gems in the current bundle]" \
"console[Start an IRB session in the context of the current bundle]" \
"open[Open an installed gem in the editor]" \
"viz[Generate a visual representation of your dependencies]" \
"init[Generate a simple Gemfile, placed in the current directory]" \
"gem[Create a simple gem, suitable for development with bundler]" \
"platform[Displays platform compatibility information]" \
"clean[Cleans up unused gems in your bundler directory]" \
"help[Describe available tasks or one specific task]"
ret=0
@ -39,11 +41,13 @@ case $state in
'check' \
'list' \
'show' \
'outdated' \
'console' \
'open' \
'viz' \
'init' \
'gem' \
'platform' \
'help' && ret=0
;;
install)
@ -71,6 +75,15 @@ case $state in
'(--verbose)--verbose[Enable verbose output mode]'
ret=0
;;
outdated)
_arguments \
'(--pre)--pre[Check for newer pre-release gems]' \
'(--source)--source[Check against a specific source]' \
'(--local)--local[Do not attempt to fetch gems remotely and use the gem cache instead]' \
'(--no-color)--no-color[Disable colorization in output]' \
'(--verbose)--verbose[Enable verbose output mode]'
ret=0
;;
(open|show)
_gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') )
if [[ $_gems != "" ]]; then

View File

@ -3,23 +3,58 @@ alias bl="bundle list"
alias bp="bundle package"
alias bo="bundle open"
alias bu="bundle update"
alias bi="bundle_install"
# The following is based on https://github.com/gma/bundler-exec
bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard irb jekyll kitchen knife middleman nanoc puma rackup rainbows rake rspec ruby shotgun spec spin spork strainer tailor taps thin thor unicorn unicorn_rails)
bundled_commands=(
annotate
cap
capify
cucumber
foodcritic
guard
irb
jekyll
kitchen
knife
middleman
nanoc
pry
puma
rackup
rainbows
rake
rspec
shotgun
sidekiq
spec
spork
spring
strainer
tailor
taps
thin
thor
unicorn
unicorn_rails
)
# Remove $UNBUNDLED_COMMANDS from the bundled_commands list
for cmd in $UNBUNDLED_COMMANDS; do
bundled_commands=(${bundled_commands#$cmd});
done
# Add $BUNDLED_COMMANDS to the bundled_commands list
for cmd in $BUNDLED_COMMANDS; do
bundled_commands+=($cmd);
done
## Functions
bi() {
bundle_install() {
if _bundler-installed && _within-bundled-project; then
local bundler_version=`bundle version | cut -d' ' -f3`
if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
if [[ "$(uname)" == 'Darwin' ]]
if [[ "$OSTYPE" = darwin* ]]
then
local cores_num="$(sysctl hw.ncpu | awk '{print $2}')"
else
@ -39,17 +74,25 @@ _bundler-installed() {
}
_within-bundled-project() {
local check_dir=$PWD
while [ $check_dir != "/" ]; do
local check_dir="$PWD"
while [ "$check_dir" != "/" ]; do
[ -f "$check_dir/Gemfile" ] && return
check_dir="$(dirname $check_dir)"
done
false
}
_binstubbed() {
[ -f "./bin/${1}" ]
}
_run-with-bundler() {
if _bundler-installed && _within-bundled-project; then
bundle exec $@
if _binstubbed $1; then
./bin/$@
else
bundle exec $@
fi
else
$@
fi
@ -62,7 +105,6 @@ for cmd in $bundled_commands; do
alias $cmd=bundled_$cmd
if which _$cmd > /dev/null 2>&1; then
compdef _$cmd bundled_$cmd=$cmd
compdef _$cmd bundled_$cmd=$cmd
fi
done

View File

@ -19,4 +19,4 @@ bindkey -a 'N' vi-join
bindkey -a 'j' vi-forward-word-end
bindkey -a 'J' vi-forward-blank-word-end
lesskey $ZSH_CUSTOM/plugins/colemak/colemak-less
lesskey $ZSH/plugins/colemak/colemak-less

View File

@ -1,3 +1,21 @@
if [ "$OSTYPE[0,7]" = "solaris" ]
then
if [ ! -x ${HOME}/bin/nroff ]
then
mkdir -p ${HOME}/bin
cat > ${HOME}/bin/nroff <<EOF
#!/bin/sh
if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then
shift
exec /usr/bin/nroff -u\${_NROFF_U} "\$@"
fi
#-- Some other invocation of nroff
exec /usr/bin/nroff "\$@"
EOF
chmod +x ${HOME}/bin/nroff
fi
fi
man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
@ -7,5 +25,8 @@ man() {
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
PAGER=/usr/bin/less \
_NROFF_U=1 \
PATH=${HOME}/bin:${PATH} \
man "$@"
}

View File

@ -1,4 +1,4 @@
# Plugin for highligthing file content
# Plugin for highlighting file content
# Plugin highlights file content based on the filename extension.
# If no highlighting method supported for given extension then it tries
# guess it by looking for file content.
@ -6,9 +6,9 @@
alias colorize='colorize_via_pygmentize'
colorize_via_pygmentize() {
if [ ! -x $(which pygmentize) ]; then
echo package \'pygmentize\' is not installed!
exit -1
if [ ! -x "$(which pygmentize)" ]; then
echo "package \'pygmentize\' is not installed!"
return -1
fi
if [ $# -eq 0 ]; then

View File

@ -3,7 +3,6 @@
#
# ls, the common ones I use a lot shortened for rapid fire usage
alias ls='ls --color' #I like color
alias l='ls -lFh' #size,show type,human readable
alias la='ls -lAFh' #long list,show almost all,show type,human readable
alias lr='ls -tRFh' #sorted by date,recursive,show type,human readable
@ -39,7 +38,7 @@ alias -g NE="2> /dev/null"
alias -g NUL="> /dev/null 2>&1"
alias -g P="2>&1| pygmentize -l pytb"
alias dud='du --max-depth=1 -h'
alias dud='du -d 1 -h'
alias duf='du -sh *'
alias fd='find . -type d -name'
alias ff='find . -type f -name'
@ -47,7 +46,6 @@ alias ff='find . -type f -name'
alias h='history'
alias hgrep="fc -El 0 | grep"
alias help='man'
alias j='jobs'
alias p='ps -f'
alias sortnr='sort -n -r'
alias unexport='unset'

View File

@ -46,3 +46,6 @@ alias cdu='composer dump-autoload'
# install composer in the current directory
alias cget='curl -s https://getcomposer.org/installer | php'
# Add Composer's global binaries to PATH
export PATH=$PATH:~/.composer/vendor/bin

View File

@ -3,7 +3,7 @@
# that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT.
#
dirhistory_past=(`pwd`)
dirhistory_past=($PWD)
dirhistory_future=()
export dirhistory_past
export dirhistory_future
@ -50,7 +50,7 @@ function push_future() {
# Called by zsh when directory changes
function chpwd() {
push_past `pwd`
push_past $PWD
# If DIRHISTORY_CD is not set...
if [[ -z "${DIRHISTORY_CD+x}" ]]; then
# ... clear future.
@ -73,7 +73,7 @@ function dirhistory_back() {
pop_past cw
if [[ "" == "$cw" ]]; then
# Someone overwrote our variable. Recover it.
dirhistory_past=(`pwd`)
dirhistory_past=($PWD)
return
fi

View File

@ -141,6 +141,7 @@ _managepy-sqlinitialdata(){}
_managepy-sqlreset(){}
_managepy-sqlsequencereset(){}
_managepy-startapp(){}
_managepy-startproject(){}
_managepy-syncdb() {
_arguments -s : \
@ -198,6 +199,7 @@ _managepy-commands() {
'sqlreset:Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s).'
'sqlsequencereset:Prints the SQL statements for resetting sequences for the given app name(s).'
"startapp:Creates a Django app directory structure for the given app name in this project's directory."
"startproject:Creates a Django project directory structure for the given project name in this current directory."
"syncdb:Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created."
'test:Runs the test suite for the specified applications, or the entire site if no apps are specified.'
'testserver:Runs a development server with data from the given fixture(s).'

View File

@ -214,7 +214,7 @@ __save() {
__start() {
_arguments \
'(-a,--attach=)'{-a,--attach=}'[Attach container''s stdout/stderr and forward all signals to the process]' \
'(-i,--interactive=)'{-i, --interactive=}'[Attach container''s stdin]'
'(-i,--interactive=)'{-i,--interactive=}'[Attach container''s stdin]'
__docker_containers
}

View File

@ -8,21 +8,25 @@
# -----------------------------------------------------------------------------
function emoji-clock() {
hour=$(date '+%I')
minutes=$(date '+%M')
# Add 15 minutes to the current time and save the value as $minutes.
(( minutes = $(date '+%M') + 15 ))
(( hour = $(date '+%I') + minutes / 60 ))
# make sure minutes and hours don't exceed 60 nor 12 respectively
(( minutes %= 60 )); (( hour %= 12 ))
case $hour in
01) clock="🕐"; [ $minutes -ge 30 ] && clock="🕜";;
02) clock="🕑"; [ $minutes -ge 30 ] && clock="🕝";;
03) clock="🕒"; [ $minutes -ge 30 ] && clock="🕞";;
04) clock="🕓"; [ $minutes -ge 30 ] && clock="🕟";;
05) clock="🕔"; [ $minutes -ge 30 ] && clock="🕠";;
06) clock="🕕"; [ $minutes -ge 30 ] && clock="🕡";;
07) clock="🕖"; [ $minutes -ge 30 ] && clock="🕢";;
08) clock="🕗"; [ $minutes -ge 30 ] && clock="🕣";;
09) clock="🕘"; [ $minutes -ge 30 ] && clock="🕤";;
0) clock="🕛"; [ $minutes -ge 30 ] && clock="🕧";;
1) clock="🕐"; [ $minutes -ge 30 ] && clock="🕜";;
2) clock="🕑"; [ $minutes -ge 30 ] && clock="🕝";;
3) clock="🕒"; [ $minutes -ge 30 ] && clock="🕞";;
4) clock="🕓"; [ $minutes -ge 30 ] && clock="🕟";;
5) clock="🕔"; [ $minutes -ge 30 ] && clock="🕠";;
6) clock="🕕"; [ $minutes -ge 30 ] && clock="🕡";;
7) clock="🕖"; [ $minutes -ge 30 ] && clock="🕢";;
8) clock="🕗"; [ $minutes -ge 30 ] && clock="🕣";;
9) clock="🕘"; [ $minutes -ge 30 ] && clock="🕤";;
10) clock="🕙"; [ $minutes -ge 30 ] && clock="🕥";;
11) clock="🕚"; [ $minutes -ge 30 ] && clock="🕦";;
12) clock="🕛"; [ $minutes -ge 30 ] && clock="🕧";;
*) clock="⌛";;
esac
echo $clock

View File

@ -38,7 +38,7 @@ function extract() {
file_name="$( basename "$1" )"
extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )"
case "$1" in
(*.tar.gz|*.tgz) tar xvzf "$1" ;;
(*.tar.gz|*.tgz) [ -z $commands[pigz] ] && tar zxvf "$1" || pigz -dc "$1" | tar xv ;;
(*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
(*.tar.xz|*.txz) tar --xz --help &> /dev/null \
&& tar --xz -xvf "$1" \
@ -47,12 +47,12 @@ function extract() {
&& tar --lzma -xvf "$1" \
|| lzcat "$1" | tar xvf - ;;
(*.tar) tar xvf "$1" ;;
(*.gz) gunzip "$1" ;;
(*.gz) [ -z $commands[pigz] ] && gunzip "$1" || pigz -d "$1" ;;
(*.bz2) bunzip2 "$1" ;;
(*.xz) unxz "$1" ;;
(*.lzma) unlzma "$1" ;;
(*.Z) uncompress "$1" ;;
(*.zip|*.war|*.jar) unzip "$1" -d $extract_dir ;;
(*.zip|*.war|*.jar|*.sublime-package) unzip "$1" -d $extract_dir ;;
(*.rar) unrar x -ad "$1" ;;
(*.7z) 7za x "$1" ;;
(*.deb)

View File

@ -1,4 +1,4 @@
# Open folder in ForkLift.app of ForkLift2.app from console
# Open folder in ForkLift.app or ForkLift2.app from console
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
# Updated to support ForkLift2 by Johan Kaving
#

View File

@ -0,0 +1,82 @@
## Rationale ##
The idea for this script is to help searches in important doc contents from frontend.
## Instalation ##
I will send a Pull Request with this plugin for .oh-my-zsh official repository. If accept them, it's only add in plugins list that exists in ```.zshrc``` file.
For now, you can clone this repository and add in ```custom/plugins``` folder
```bash
$ git clone git://github.com/willmendesneto/frontend-search.git ~/.oh-my-zsh/custom/plugins/frontend-search
```
After this, restart your terminal and frontend-search plugin is configurated in you CLI.
```bash
...
plugins=( <your-plugins-list>... frontend-search)
...
```
## Commands ##
All command searches are accept only in format
* `frontend <search-content> <search-term>`
The search content are
* `jquery <api.jquery.com>`
* `mdn <developer.mozilla.org>`
* `compass <compass-style.org>`
* `html5please <html5please.com>`
* `caniuse <caniuse.com>`
* `aurajs <aurajs.com>`
* `dartlang <api.dartlang.org/apidocs/channels/stable/dartdoc-viewer>`
* `lodash <search>`
* `qunit <api.qunitjs.com>`
* `fontello <fontello.com>`
* `bootsnipp <bootsnipp.com>`
* `cssflow <cssflow.com>`
* `codepen <codepen.io>`
* `unheap <www.unheap.com>`
* `bem <google.com/search?as_q=<search-term>&as_sitesearch=bem.info>`
* `smacss <google.com/search?as_q=<search-term>&as_sitesearch=smacss.com>`
* `angularjs <google.com/search?as_q=<search-term>&as_sitesearch=angularjs.org>`
* `reactjs <google.com/search?as_q=<search-term>&as_sitesearch=facebook.github.io/react>`
* `emberjs <emberjs.com>`
## Aliases ##
There are a few aliases presented as well:
* `jquery` A shorthand for `frontend jquery`
* `mdn` A shorthand for `frontend mdn`
* `compass` A shorthand for `frontend compass`
* `html5please` A shorthand for `frontend html5please`
* `caniuse` A shorthand for `frontend caniuse`
* `aurajs` A shorthand for `frontend aurajs`
* `dartlang` A shorthand for `frontend dartlang`
* `lodash` A shorthand for `frontend lodash`
* `qunit` A shorthand for `frontend qunit`
* `fontello` A shorthand for `frontend fontello`
* `bootsnipp` A shorthand for `frontend bootsnipp`
* `cssflow` A shorthand for `frontend cssflow`
* `codepen` A shorthand for `frontend codepen`
* `unheap` A shorthand for `frontend unheap`
* `bem` A shorthand for `frontend bem`
* `smacss` A shorthand for `frontend smacss`
* `angularjs` A shorthand for `frontend angularjs`
* `reactjs` A shorthand for `frontend reactjs`
* `emberjs` A shorthand for `frontend emberjs`
## Author
**Wilson Mendes (willmendesneto)**
+ <https://twitter.com/willmendesneto>
+ <http://github.com/willmendesneto>
New features comming soon.

View File

@ -0,0 +1,151 @@
# frontend from terminal
function frontend() {
# get the open command
local open_cmd
if [[ $(uname -s) == 'Darwin' ]]; then
open_cmd='open'
else
open_cmd='xdg-open'
fi
# no keyword provided, simply show how call methods
if [[ $# -le 1 ]]; then
echo "Please provide a search-content and a search-term for app.\nEx:\nfrontend <search-content> <search-term>\n"
return 1
fi
# check whether the search engine is supported
if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs)' ]];
then
echo "Search valid search content $1 not supported."
echo "Valid contents: (formats 'frontend <search-content>' or '<search-content>')"
echo "* jquery"
echo "* mdn"
echo "* compass"
echo "* html5please"
echo "* caniuse"
echo "* aurajs"
echo "* dartlang"
echo "* lodash"
echo "* qunit"
echo "* fontello"
echo "* bootsnipp"
echo "* cssflow"
echo "* codepen"
echo "* unheap"
echo "* bem"
echo "* smacss"
echo "* angularjs"
echo "* reactjs"
echo "* emberjs"
echo ""
return 1
fi
local url="http://"
local query=""
case "$1" in
"jquery")
url="${url}api.jquery.com"
url="${url}/?s=$2" ;;
"mdn")
url="${url}developer.mozilla.org"
url="${url}/search?q=$2" ;;
"compass")
url="${url}compass-style.org"
url="${url}/search?q=$2" ;;
"html5please")
url="${url}html5please.com"
url="${url}/#$2" ;;
"caniuse")
url="${url}caniuse.com"
url="${url}/#search=$2" ;;
"aurajs")
url="${url}aurajs.com"
url="${url}/api/#stq=$2" ;;
"dartlang")
url="${url}api.dartlang.org/apidocs/channels/stable/dartdoc-viewer"
url="${url}/dart-$2" ;;
"qunit")
url="${url}api.qunitjs.com"
url="${url}/?s=$2" ;;
"fontello")
url="${url}fontello.com"
url="${url}/#search=$2" ;;
"bootsnipp")
url="${url}bootsnipp.com"
url="${url}/search?q=$2" ;;
"cssflow")
url="${url}cssflow.com"
url="${url}/search?q=$2" ;;
"codepen")
url="${url}codepen.io"
url="${url}/search?q=$2" ;;
"unheap")
url="${url}www.unheap.com"
url="${url}/?s=$2" ;;
"bem")
url="${url}google.com"
url="${url}/search?as_q=$2&as_sitesearch=bem.info" ;;
"smacss")
url="${url}google.com"
url="${url}/search?as_q=$2&as_sitesearch=smacss.com" ;;
"angularjs")
url="${url}google.com"
url="${url}/search?as_q=$2&as_sitesearch=angularjs.org" ;;
"reactjs")
url="${url}google.com"
url="${url}/search?as_q=$2&as_sitesearch=facebook.github.io/react" ;;
"emberjs")
url="${url}emberjs.com"
url="${url}/api/#stq=$2&stp=1" ;;
*) echo "INVALID PARAM!"
return ;;
esac
echo "$url"
$open_cmd "$url"
}
# javascript
alias jquery='frontend jquery'
alias mdn='frontend mdn'
# pre processors frameworks
alias compassdoc='frontend compass'
# important links
alias html5please='frontend html5please'
alias caniuse='frontend caniuse'
# components and libraries
alias aurajs='frontend aurajs'
alias dartlang='frontend dartlang'
alias lodash='frontend lodash'
#tests
alias qunit='frontend qunit'
#fonts
alias fontello='frontend fontello'
# snippets
alias bootsnipp='frontend bootsnipp'
alias cssflow='frontend cssflow'
alias codepen='frontend codepen'
alias unheap='frontend unheap'
# css architecture
alias bem='frontend bem'
alias smacss='frontend smacss'
# frameworks
alias angularjs='frontend angularjs'
alias reactjs='frontend reactjs'
alias emberjs='frontend emberjs'

View File

@ -59,6 +59,8 @@ case "$words[1]" in
build)
_files -g "*.gemspec"
;;
install)
_files ;;
list)
if [[ "$state" == forms ]]; then
_gem_installed

View File

@ -7,6 +7,8 @@ alias gd='git diff'
compdef _git gd=git-diff
alias gdc='git diff --cached'
compdef _git gdc=git-diff
alias gdt='git diff-tree --no-commit-id --name-only -r'
compdef _git gdc=git diff-tree --no-commit-id --name-only -r
alias gl='git pull'
compdef _git gl=git-pull
alias gup='git pull --rebase'
@ -16,6 +18,7 @@ compdef _git gp=git-push
alias gd='git diff'
gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff
alias gdt='git difftool'
alias gc='git commit -v'
compdef _git gc=git-commit
alias gc!='git commit -v --amend'
@ -51,6 +54,7 @@ alias gb='git branch'
compdef _git gb=git-branch
alias gba='git branch -a'
compdef _git gba=git-branch
alias gbr='git branch --remote'
alias gcount='git shortlog -sn'
compdef gcount=git
alias gcl='git config --list'
@ -70,6 +74,7 @@ alias gss='git status -s'
compdef _git gss=git-status
alias ga='git add'
compdef _git ga=git-add
alias gap='git add --patch'
alias gm='git merge'
compdef _git gm=git-merge
alias grh='git reset HEAD'
@ -77,6 +82,18 @@ alias grhh='git reset HEAD --hard'
alias gclean='git reset --hard && git clean -dfx'
alias gwc='git whatchanged -p --abbrev-commit --pretty=medium'
# Sign and verify commits with GPG
alias gcs='git commit -S'
compdef _git gcs=git-commit
alias gsps='git show --pretty=short --show-signature'
compdef _git gsps=git-show
# Sign and verify tags with GPG
alias gts='git tag -s'
compdef _git gts=git-tag
alias gvt='git verify-tag'
compdef _git gvt=git verify-tag
#remove the gf alias
#alias gf='git ls-files | grep'

View File

@ -40,7 +40,7 @@ fi
#
# Use this when creating a new repo from scratch.
empty_gh() { # [NAME_OF_REPO]
repo = $1
repo=$1
ghuser=$( git config github.user )
mkdir "$repo"

View File

@ -1,12 +1,12 @@
function gi() { curl http://www.gitignore.io/api/$@ ;}
function gi() { curl -sL https://www.gitignore.io/api/$@ ;}
_gitignireio_get_command_list() {
curl -s http://www.gitignore.io/api/list | tr "," "\n"
_gitignoreio_get_command_list() {
curl -sL https://www.gitignore.io/api/list | tr "," "\n"
}
_gitignireio () {
_gitignoreio () {
compset -P '*,'
compadd -S '' `_gitignireio_get_command_list`
compadd -S '' `_gitignoreio_get_command_list`
}
compdef _gitignireio gi
compdef _gitignoreio gi

View File

@ -158,3 +158,6 @@ __go_tool_complete() {
}
compdef __go_tool_complete go
# aliases
alias gfa='go fmt . ./...'

View File

@ -60,7 +60,7 @@ function in_gradle() {
############################################################################
_gradle_does_task_list_need_generating () {
[ ! -f .gradletasknamecache ] && return 0;
[ .gradletasknamecache -nt build.gradle ] && return 0;
[ build.gradle -nt .gradletasknamecache ] && return 0;
return 1;
}

0
plugins/grails/grails.plugin.zsh Executable file → Normal file
View File

View File

@ -12,7 +12,7 @@
# jira ABC-123 # Opens an existing issue
open_jira_issue () {
local open_cmd
if [[ $(uname -s) == 'Darwin' ]]; then
if [[ "$OSTYPE" = darwin* ]]; then
open_cmd='open'
else
open_cmd='xdg-open'
@ -26,20 +26,65 @@ open_jira_issue () {
jira_url=$JIRA_URL
else
echo "JIRA url is not specified anywhere."
return 0
return 1
fi
if [ -f .jira-prefix ]; then
jira_prefix=$(cat .jira-prefix)
elif [ -f ~/.jira-prefix ]; then
jira_prefix=$(cat ~/.jira-prefix)
else
jira_prefix=""
fi
if [ -z "$1" ]; then
echo "Opening new issue"
$open_cmd "$jira_url/secure/CreateIssue!default.jspa"
$open_cmd "${jira_url}/secure/CreateIssue!default.jspa"
elif [[ "$1" = "assigned" || "$1" = "reported" ]]; then
jira_query $@
else
echo "Opening issue #$1"
if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then
$open_cmd "$jira_url/issues/$1"
$open_cmd "$jira_url/issues/$jira_prefix$1"
else
$open_cmd "$jira_url/browse/$1"
$open_cmd "$jira_url/browse/$jira_prefix$1"
fi
fi
}
jira_name () {
if [[ -z "$1" ]]; then
if [[ "x${JIRA_NAME}" != "x" ]]; then
jira_name=${JIRA_NAME}
else
echo "JIRA_NAME not specified"
return 1
fi
else
jira_name=$@
fi
}
jira_query () {
verb="$1"
if [[ "${verb}" = "reported" ]]; then
lookup=reporter
preposition=by
elif [[ "${verb}" = "assigned" ]]; then
lookup=assignee
preposition=to
else
echo "not a valid lookup $verb"
return 1
fi
shift 1
jira_name $@
if [[ $? = 1 ]]; then
return 1
fi
echo "Browsing issues ${verb} ${preposition} ${jira_name}"
$open_cmd "${jira_url}/secure/IssueNavigator.jspa?reset=true&jqlQuery=${lookup}+%3D+%22${jira_name}%22+AND+resolution+%3D+unresolved+ORDER+BY+priority+DESC%2C+created+ASC"
}
alias jira='open_jira_issue'

0
plugins/jruby/jruby.plugin.zsh Executable file → Normal file
View File

View File

@ -14,12 +14,12 @@ jump() {
mark() {
if (( $# == 0 )); then
MARK=$(basename "$(pwd)")
MARK=$(basename "$PWD")
else
MARK="$1"
fi
if read -q \?"Mark $(pwd) as ${MARK}? (y/n) "; then
mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$MARK"
if read -q \?"Mark $PWD as ${MARK}? (y/n) "; then
mkdir -p "$MARKPATH"; ln -s "$PWD" "$MARKPATH/$MARK"
fi
}
@ -39,7 +39,7 @@ marks() {
_completemarks() {
if [[ $(ls "${MARKPATH}" | wc -l) -gt 1 ]]; then
reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_\da-zA-Z\-]*):$/\2/g'))
reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_a-zA-Z0-9\.\-]*):$/\2/g'))
else
if readlink -e "${MARKPATH}"/* &>/dev/null; then
reply=($(ls "${MARKPATH}"))

13
plugins/marked2/README.md Normal file
View File

@ -0,0 +1,13 @@
## marked2
Plugin for Marked 2, a previewer for Markdown files on Mac OS X
### Requirements
* [Marked 2](http://marked2app.com)
### Usage
* If `marked` is called without an argument, open Marked
* If `marked` is passed a file, open it in Marked

View File

@ -0,0 +1,12 @@
#
# If marked is called without an argument, open Marked
# If marked is passed a file, open it in Marked
#
function marked() {
if [ "$1" ]
then
open -a "marked 2.app" "$1"
else
open -a "marked 2.app"
fi
}

View File

@ -16,6 +16,8 @@ alias hgs='hg status'
alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n" '
# this is the 'git commit --amend' equivalent
alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
# list unresolved files (since hg does not list unmerged files in the status command)
alias hgun='hg resolve --list'
function in_hg() {
if [[ -d .hg ]] || $(hg summary > /dev/null 2>&1); then

View File

@ -44,24 +44,27 @@ mvn-color()
# aliases
alias mvncie='mvn clean install eclipse:eclipse'
alias mvnci='mvn clean install'
alias mvncist='mvn clean install -DskipTests'
alias mvne='mvn eclipse:eclipse'
alias mvnce='mvn clean eclipse:clean eclipse:eclipse'
alias mvnd='mvn deploy'
alias mvnp='mvn package'
alias mvnc='mvn clean'
alias mvncom='mvn compile'
alias mvnct='mvn clean test'
alias mvnt='mvn test'
alias mvnag='mvn archetype:generate'
alias mvn-updates='mvn versions:display-dependency-updates'
alias mvntc7='mvn tomcat7:run'
alias mvntc='mvn tomcat:run'
alias mvnjetty='mvn jetty:run'
alias mvndt='mvn dependency:tree'
alias mvns='mvn site'
function listMavenCompletions {
reply=(
# common lifecycle
clean process-resources compile process-test-resources test-compile test package verify install deploy site
clean process-resources compile process-test-resources test-compile test integration-test package verify install deploy site
# common plugins
deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt
@ -126,6 +129,10 @@ function listMavenCompletions {
tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy
# tomcat7
tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy
# tomee
tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy
# spring-boot
spring-boot:run spring-boot:repackage
# exec
exec:exec exec:java
# versions

View File

@ -3,7 +3,7 @@
function node-docs {
# get the open command
local open_cmd
if [[ $(uname -s) == 'Darwin' ]]; then
if [[ "$OSTYPE" = darwin* ]]; then
open_cmd='open'
else
open_cmd='xdg-open'

View File

@ -139,7 +139,7 @@ function man-preview() {
function trash() {
local trash_dir="${HOME}/.Trash"
local temp_ifs=$IFS
local temp_ifs="$IFS"
IFS=$'\n'
for item in "$@"; do
if [[ -e "$item" ]]; then
@ -174,12 +174,16 @@ function itunes() {
next|previous)
opt="$opt track"
;;
vol)
opt="set sound volume to $1" #$1 Due to the shift
;;
""|-h|--help)
echo "Usage: itunes <option>"
echo "option:"
echo "\tlaunch|play|pause|stop|rewind|resume|quit"
echo "\tmute|unmute\tcontrol volume set"
echo "\tnext|previous\tplay next or previous track"
echo "\tvol\tSet the volume, takes an argument from 0 to 100"
echo "\thelp\tshow this message and exit"
return 0
;;
@ -190,4 +194,3 @@ function itunes() {
esac
osascript -e "tell application \"iTunes\" to $opt"
}

View File

@ -1,13 +1,16 @@
#compdef pass
#autoload
# Copyright (C) 2012:
# Copyright (C) 2012 - 2014:
# Johan Venant <jvenant@invicem.pro>
# Brian Mattern <rephorm@rephorm.com>
# Jason A. Donenfeld <Jason@zx2c4.com>.
# Santiago Borrazás <sanbor@gmail.com>
# All Rights Reserved.
# This file is licensed under the GPLv2+. Please see COPYING for more information.
#
# This file is licensed under the GPLv2+.
# Please visit http://git.zx2c4.com/password-store/tree/COPYING for more information.
#
# Oh my zsh plugin maintainer: Santiago Borrazás <sanbor@gmail.com>
_pass () {
@ -23,8 +26,8 @@ _pass () {
case "${cmd}" in
init)
_arguments : \
"-r[re-encrypt existing passwords]" \
"--reencrypt[re-encrypt existing passwords]"
"-p[gpg-id will only be applied to this subfolder]" \
"--path[gpg-id will only be applied to this subfolder]"
_pass_complete_keys
;;
ls|list|edit)
@ -43,9 +46,19 @@ _pass () {
"-n[don't include symbols in password]" \
"--no-symbols[don't include symbols in password]" \
"-c[copy password to the clipboard]" \
"--clip[copy password to the clipboard]"
"--clip[copy password to the clipboard]" \
"-f[force overwrite]" \
"--force[force overwrite]" \
"-i[replace first line]" \
"--in-place[replace first line]"
_pass_complete_entries_with_subdirs
;;
cp|copy|mv|rename)
_arguments : \
"-f[force rename]" \
"--force[force rename]"
_pass_complete_entries_with_subdirs
;;
rm)
_arguments : \
"-f[force deletion]" \
@ -75,10 +88,14 @@ _pass () {
subcommands=(
"init:Initialize new password storage"
"ls:List passwords"
"find:Find password files or directories based on pattern"
"grep:Search inside decrypted password files for matching pattern"
"show:Decrypt and print a password"
"insert:Insert a new password"
"generate:Generate a new password using pwgen"
"edit:Edit a password with \$EDITOR"
"mv:Rename the password"
"cp:Copy the password"
"rm:Remove the password"
"git:Call git on the password store"
"version:Output version information"
@ -101,7 +118,7 @@ _pass_cmd_show () {
_pass_complete_entries_helper () {
local IFS=$'\n'
local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
_values -C 'passwords' $(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort)
_values -C 'passwords' ${$(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print 2>/dev/null | sed -e "s#${prefix}/\{0,1\}##" -e 's#\.gpg##' | sort):-""}
}
_pass_complete_entries_with_subdirs () {
@ -117,3 +134,5 @@ _pass_complete_keys () {
# Extract names and email addresses from gpg --list-keys
_values 'gpg keys' $(gpg2 --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')
}
_pass

View File

@ -1,4 +1,4 @@
#compdef pip
#compdef pip pip2 pip-2.7 pip3 pip-3.2 pip-3.3 pip-3.4
#autoload
# pip zsh completion, based on homebrew completion

View File

@ -18,8 +18,11 @@ function pj() {
file=$1
if [[ "open" == "$file" ]] then
file=$2
shift
file=$*
cmd=(${(s: :)EDITOR})
else
file=$*
fi
for project in $PROJECT_PATHS; do
@ -36,7 +39,11 @@ function pj() {
alias pjo="pj open"
function _pj () {
compadd `/bin/ls -l $PROJECT_PATHS 2>/dev/null | awk '{ print $9 }'`
# might be possible to improve this using glob, without the basename trick
typeset -a projects
projects=($PROJECT_PATHS/*)
projects=$projects:t
_arguments "*:file:($projects)"
}
compdef _pj pj

View File

@ -1,6 +1,8 @@
# Aliases to stop, start and restart Postgres
# Paths noted below are for Postgress installed via Homebrew on OSX
# Aliases to control Postgres
# Paths noted below are for Postgres installed via Homebrew on OSX
alias startpost='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'
alias stoppost='pg_ctl -D /usr/local/var/postgres stop -s -m fast'
alias restartpost='stoppost && sleep 1 && startpost'
alias reloadpost='pg_ctl reload -D /usr/local/var/postgres -s'
alias statuspost='pg_ctl status -D /usr/local/var/postgres -s'

View File

@ -21,13 +21,13 @@
rack_root(){
setopt chaselinks
local orgdir="$(pwd)"
local basedir="$(pwd)"
local orgdir="$PWD"
local basedir="$PWD"
while [[ $basedir != '/' ]]; do
test -e "$basedir/config.ru" && break
builtin cd ".." 2>/dev/null
basedir="$(pwd)"
basedir="$PWD"
done
builtin cd "$orgdir" 2>/dev/null
@ -56,7 +56,7 @@ kapow(){
compctl -W ~/.pow -/ kapow
powit(){
local basedir="$(pwd)"
local basedir="$PWD"
local vhost=$1
[ ! -n "$vhost" ] && vhost=$(rack_root_detect)
if [ ! -h ~/.pow/$vhost ]

View File

@ -2,7 +2,7 @@
# This will look for a custom profile for the local machine and each domain or
# subdomain it belongs to. (e.g. com, example.com and foo.example.com)
parts=(${(s:.:)$(hostname)})
parts=(${(s:.:)HOST})
for i in {${#parts}..1}; do
profile=${(j:.:)${parts[$i,${#parts}]}}
file=$ZSH_CUSTOM/profiles/$profile

View File

@ -6,7 +6,7 @@ function _rails_command () {
elif [ -e "script/server" ]; then
ruby script/$@
else
rails $@
command rails $@
fi
}
@ -14,7 +14,7 @@ function _rake_command () {
if [ -e "bin/rake" ]; then
bin/rake $@
else
rake $@
command rake $@
fi
}

View File

@ -10,7 +10,7 @@ _rake_refresh () {
_rake_does_task_list_need_generating () {
if [ ! -f .rake_tasks ]; then return 0;
else
if [[ $(uname -s) == 'Darwin' ]]; then
if [[ "$OSTYPE" = darwin* ]]; then
accurate=$(stat -f%m .rake_tasks)
changed=$(stat -f%m Rakefile)
else

View File

@ -7,7 +7,7 @@ _rbenv-from-homebrew-installed() {
}
FOUND_RBENV=0
rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv")
rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" "/usr/local/opt/rbenv")
if _homebrew-installed && _rbenv-from-homebrew-installed ; then
rbenvdirs=($(brew --prefix rbenv) "${rbenvdirs[@]}")
fi

View File

@ -10,3 +10,9 @@ compdef _repo rs='repo sync'
alias rsrra='repo sync ; repo rebase --auto-stash'
compdef _repo rsrra='repo sync ; repo rebase --auto-stash'
alias ru='repo upload'
compdef _repo ru='repo upload'
alias rst='repo status'
compdef _repo rst='repo status'

View File

@ -1,4 +1,4 @@
alias rsync-copy="rsync -av --progress -h"
alias rsync-move="rsync -av --progress -h --remove-source-files"
alias rsync-update="rsync -avu --progress -h"
alias rsync-synchronize="rsync -avu --delete --progress -h"
alias rsync-copy="rsync -avz --progress -h"
alias rsync-move="rsync -avz --progress -h --remove-source-files"
alias rsync-update="rsync -avzu --progress -h"
alias rsync-synchronize="rsync -avzu --delete --progress -h"

View File

@ -6,6 +6,7 @@ alias gemsets='rvm gemset list'
local ruby18='ruby-1.8.7'
local ruby19='ruby-1.9.3'
local ruby20='ruby-2.0.0'
local ruby21='ruby-2.1.2'
function rb18 {
if [ -z "$1" ]; then
@ -40,6 +41,17 @@ function rb20 {
_rb20() {compadd `ls -1 $rvm_path/gems | grep "^$ruby20@" | sed -e "s/^$ruby20@//" | awk '{print $1}'`}
compdef _rb20 rb20
function rb21 {
if [ -z "$1" ]; then
rvm use "$ruby21"
else
rvm use "$ruby21@$1"
fi
}
_rb21() {compadd `ls -1 $rvm_path/gems | grep "^$ruby21@" | sed -e "s/^$ruby21@//" | awk '{print $1}'`}
compdef _rb21 rb21
function rvm-update {
rvm get head
}

View File

@ -11,12 +11,9 @@ the index. A selection menu is displayed in case of several matches, with a
preference given to recently visited paths. `scd` can create permanent
directory aliases, which appear as named directories in zsh session.
## INSTALLATION
## INSTALLATION NOTES
For oh-my-zsh, add `scd` to the `plugins` array in the ~/.zshrc file as in the
[template file](../../templates/zshrc.zsh-template#L45).
Besides zsh, `scd` can be used with *bash*, *dash* or *tcsh*
Besides oh-my-zsh, `scd` can be used with *bash*, *dash* or *tcsh*
shells and is also available as [Vim](http://www.vim.org/) plugin and
[IPython](http://ipython.org/) extension. For installation details, see
https://github.com/pavoljuhas/smart-change-directory.
@ -34,7 +31,7 @@ scd [options] [pattern1 pattern2 ...]
add specified directories to the directory index.</dd><dt>
--unindex</dt><dd>
remove specified directories from the index.</dd><dt>
remove current or specified directories from the index.</dd><dt>
-r, --recursive</dt><dd>
apply options <em>--add</em> or <em>--unindex</em> recursively.</dd><dt>
@ -47,6 +44,10 @@ scd [options] [pattern1 pattern2 ...]
remove ALIAS definition for the current or specified directory from
<em>~/.scdalias.zsh</em>.</dd><dt>
-A, --all</dt><dd>
include all matching directories. Disregard matching by directory
alias and filtering of less likely paths.</dd><dt>
--list</dt><dd>
show matching directories and exit.</dd><dt>
@ -70,7 +71,7 @@ scd doc
scd a b c
# Change to a directory path that ends with "ts"
scd "ts(#e)"
scd "ts$"
# Show selection menu and ranking of 20 most likely directories
scd -v

View File

@ -11,20 +11,22 @@ fi
local DOC='scd -- smart change to a recently used directory
usage: scd [options] [pattern1 pattern2 ...]
Go to a directory path that contains all fixed string patterns. Prefer
recently visited directories and directories with patterns in their tail
component. Display a selection menu in case of multiple matches.
recent or frequently visited directories as found in the directory index.
Display a selection menu in case of multiple matches.
Options:
-a, --add add specified directories to the directory index
--unindex remove specified directories from the index
-r, --recursive apply options --add or --unindex recursively
-a, --add add specified directories to the directory index.
--unindex remove current or specified directories from the index.
-r, --recursive apply options --add or --unindex recursively.
--alias=ALIAS create alias for the current or specified directory and
store it in ~/.scdalias.zsh
store it in ~/.scdalias.zsh.
--unalias remove ALIAS definition for the current or specified
directory from ~/.scdalias.zsh
--list show matching directories and exit
-v, --verbose display directory rank in the selection menu
-h, --help display this message and exit
directory from ~/.scdalias.zsh.
-A, --all include all matching directories. Disregard matching by
directory alias and filtering of less likely paths.
--list show matching directories and exit.
-v, --verbose display directory rank in the selection menu.
-h, --help display this message and exit.
'
local SCD_HISTFILE=${SCD_HISTFILE:-${HOME}/.scdhistory}
@ -35,9 +37,9 @@ local SCD_THRESHOLD=${SCD_THRESHOLD:-0.005}
local SCD_SCRIPT=${RUNNING_AS_COMMAND:+$SCD_SCRIPT}
local SCD_ALIAS=~/.scdalias.zsh
local ICASE a d m p i tdir maxrank threshold
local ICASE a d m p i maxrank threshold
local opt_help opt_add opt_unindex opt_recursive opt_verbose
local opt_alias opt_unalias opt_list
local opt_alias opt_unalias opt_all opt_list
local -A drank dalias
local dmatching
local last_directory
@ -56,7 +58,8 @@ zmodload -i zsh/zutil
zmodload -i zsh/datetime
zparseopts -D -- a=opt_add -add=opt_add -unindex=opt_unindex \
r=opt_recursive -recursive=opt_recursive \
-alias:=opt_alias -unalias=opt_unalias -list=opt_list \
-alias:=opt_alias -unalias=opt_unalias \
A=opt_all -all=opt_all -list=opt_list \
v=opt_verbose -verbose=opt_verbose h=opt_help -help=opt_help \
|| $EXIT $?
@ -68,6 +71,11 @@ fi
# load directory aliases if they exist
[[ -r $SCD_ALIAS ]] && source $SCD_ALIAS
# Private internal functions are prefixed with _scd_Y19oug_.
# Clean them up when the scd function returns.
setopt localtraps
trap 'unfunction -m "_scd_Y19oug_*"' EXIT
# works faster than the (:a) modifier and is compatible with zsh 4.2.6
_scd_Y19oug_abspath() {
set -A $1 ${(ps:\0:)"$(
@ -123,11 +131,52 @@ if [[ -n $opt_unalias ]]; then
$EXIT $?
fi
# The "compress" function collapses repeated directories to
# one entry with a time stamp that gives equivalent-probability.
_scd_Y19oug_compress() {
awk -v epochseconds=$EPOCHSECONDS -v meanlife=$SCD_MEANLIFE '
BEGIN { FS = "[:;]"; }
length($0) < 4096 && $2 > 0 {
tau = 1.0 * ($2 - epochseconds) / meanlife;
if (tau < -6.9078) tau = -6.9078;
prob = exp(tau);
sub(/^[^;]*;/, "");
if (NF) {
dlist[last[$0]] = "";
dlist[NR] = $0;
last[$0] = NR;
ptot[$0] += prob;
}
}
END {
for (i = 1; i <= NR; ++i) {
d = dlist[i];
if (d) {
ts = log(ptot[d]) * meanlife + epochseconds;
printf(": %.0f:0;%s\n", ts, d);
}
}
}
' $*
}
# Rewrite directory index if it is at least 20% oversized
if [[ -s $SCD_HISTFILE ]] && \
(( $(wc -l <$SCD_HISTFILE) > 1.2 * $SCD_HISTSIZE )); then
m=( ${(f)"$(<$SCD_HISTFILE)"} )
print -lr -- ${m[-$SCD_HISTSIZE,-1]} >| ${SCD_HISTFILE}
# compress repeated entries
m=( ${(f)"$(_scd_Y19oug_compress $SCD_HISTFILE)"} )
# purge non-existent directories
m=( ${(f)"$(
for a in $m; do
if [[ -d ${a#*;} ]]; then print -r -- $a; fi
done
)"}
)
# cut old entries if still oversized
if [[ $#m -gt $SCD_HISTSIZE ]]; then
m=( ${m[-$SCD_HISTSIZE,-1]} )
fi
print -lr -- $m >| ${SCD_HISTFILE}
fi
# Determine the last recorded directory
@ -135,7 +184,6 @@ if [[ -s ${SCD_HISTFILE} ]]; then
last_directory=${"$(tail -1 ${SCD_HISTFILE})"#*;}
fi
# Internal functions are prefixed with "_scd_Y19oug_".
# The "record" function adds its arguments to the directory index.
_scd_Y19oug_record() {
while [[ -n $last_directory && $1 == $last_directory ]]; do
@ -217,7 +265,7 @@ _scd_Y19oug_action() {
# set global arrays dmatching and drank
_scd_Y19oug_match() {
## single argument that is an existing directory or directory alias
if [[ $# == 1 ]] && \
if [[ -z $opt_all && $# == 1 ]] && \
[[ -d ${d::=$1} || -d ${d::=${nameddirs[$1]}} ]] && [[ -x $d ]];
then
_scd_Y19oug_abspath dmatching $d
@ -227,6 +275,8 @@ _scd_Y19oug_match() {
# ignore case unless there is an argument with an uppercase letter
[[ "$*" == *[[:upper:]]* ]] || ICASE='(#i)'
# support "$" as an anchor for the directory name ending
argv=( ${argv/(#m)?[$](#e)/${MATCH[1]}(#e)} )
# calculate rank of all directories in the SCD_HISTFILE and keep it as drank
# include a dummy entry for splitting of an empty string is buggy
@ -237,10 +287,10 @@ _scd_Y19oug_match() {
BEGIN { FS = "[:;]"; }
length($0) < 4096 && $2 > 0 {
tau = 1.0 * ($2 - epochseconds) / meanlife;
if (tau < -4.61) tau = -4.61;
prec = exp(tau);
if (tau < -6.9078) tau = -6.9078;
prob = exp(tau);
sub(/^[^;]*;/, "");
if (NF) ptot[$0] += prec;
if (NF) ptot[$0] += prob;
}
END { for (di in ptot) { print di; print ptot[di]; } }'
)"}
@ -249,9 +299,12 @@ _scd_Y19oug_match() {
# filter drank to the entries that match all arguments
for a; do
p=${ICASE}"*${a}*"
p=${ICASE}"*(${a})*"
drank=( ${(kv)drank[(I)${~p}]} )
done
# require at least one argument matches the directory name
p=${ICASE}"*(${(j:|:)argv})[^/]#"
drank=( ${(kv)drank[(I)${~p}]} )
# build a list of matching directories reverse-sorted by their probabilities
dmatching=( ${(f)"$(
@ -261,26 +314,6 @@ _scd_Y19oug_match() {
)"}
)
# if some directory paths match all patterns in order, discard all others
p=${ICASE}"*${(j:*:)argv}*"
m=( ${(M)dmatching:#${~p}} )
[[ -d ${m[1]} ]] && dmatching=( $m )
# if some directory names match last pattern, discard all others
p=${ICASE}"*${(j:*:)argv}[^/]#"
m=( ${(M)dmatching:#${~p}} )
[[ -d ${m[1]} ]] && dmatching=( $m )
# if some directory names match all patterns, discard all others
m=( $dmatching )
for a; do
p=${ICASE}"*/[^/]#${a}[^/]#"
m=( ${(M)m:#${~p}} )
done
[[ -d ${m[1]} ]] && dmatching=( $m )
# if some directory names match all patterns in order, discard all others
p=${ICASE}"/*${(j:[^/]#:)argv}[^/]#"
m=( ${(M)dmatching:#${~p}} )
[[ -d ${m[1]} ]] && dmatching=( $m )
# do not match $HOME or $PWD when run without arguments
if [[ $# == 0 ]]; then
dmatching=( ${dmatching:#(${HOME}|${PWD})} )
@ -302,6 +335,9 @@ _scd_Y19oug_match() {
# discard all directories below the rank threshold
threshold=$(( maxrank * SCD_THRESHOLD ))
if [[ -n ${opt_all} ]]; then
threshold=0
fi
dmatching=( ${^dmatching}(Ne:'(( ${drank[$REPLY]} >= threshold ))':) )
}
@ -339,6 +375,7 @@ fi
## here we have multiple matches - display selection menu
a=( {a-z} {A-Z} )
a=( ${a[1,${#dmatching}]} )
p=( )
for i in {1..${#dmatching}}; do
[[ -n ${a[i]} ]] || break

View File

@ -1,7 +1,7 @@
#
# INSTRUCTIONS
#
# To enabled agent forwarding support add the following to
# To enable agent forwarding support add the following to
# your .zshrc file:
#
# zstyle :omz:plugins:ssh-agent agent-forwarding on

3
plugins/sublime/sublime.plugin.zsh Executable file → Normal file
View File

@ -7,6 +7,7 @@ if [[ $('uname') == 'Linux' ]]; then
"/opt/sublime_text/sublime_text"
"/usr/bin/sublime_text"
"/usr/local/bin/sublime_text"
"/usr/bin/subl"
)
for _sublime_path in $_sublime_linux_paths; do
if [[ -a $_sublime_path ]]; then
@ -16,7 +17,7 @@ if [[ $('uname') == 'Linux' ]]; then
fi
done
elif [[ $('uname') == 'Darwin' ]]; then
elif [[ "$OSTYPE" = darwin* ]]; then
local _sublime_darwin_paths > /dev/null 2>&1
_sublime_darwin_paths=(
"/usr/local/bin/subl"

View File

@ -77,7 +77,7 @@ function svn_dirty() {
function svn_dirty_choose_pwd () {
if in_svn; then
root=`pwd`
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

View File

@ -1,21 +1,26 @@
# Symfony2 basic command completion
_symfony_console () {
echo "php $(find . -maxdepth 2 -mindepth 1 -name 'console' -type f | head -n 1)"
}
_symfony2_get_command_list () {
php app/console --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
`_symfony_console` --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
}
_symfony2 () {
if [ -f app/console ]; then
compadd `_symfony2_get_command_list`
fi
compadd `_symfony2_get_command_list`
}
compdef _symfony2 app/console
compdef _symfony2 '`_symfony_console`'
compdef _symfony2 'app/console'
compdef _symfony2 'bin/console'
compdef _symfony2 sf
#Alias
alias sf='php app/console'
alias sfcl='php app/console cache:clear'
alias sfroute='php app/console router:debug'
alias sfgb='php app/console generate:bundle'
alias sf='`_symfony_console`'
alias sfcl='sf cache:clear'
alias sfcw='sf cache:warmup'
alias sfroute='sf router:debug'
alias sfcontainer='sf container:debug'
alias sfgb='sf generate:bundle'

View File

@ -30,7 +30,7 @@ function retlog() {
}
alias ping='ping -c 5'
alias clr='clear;echo "Currently logged in on $(tty), as $(whoami) in directory $(pwd)."'
alias clr='clear;echo "Currently logged in on $(tty), as $USER in directory $PWD."'
alias path='echo -e ${PATH//:/\\n}'
alias mkdir='mkdir -pv'
# get top process eating memory

View File

@ -0,0 +1,15 @@
## textastic
Plugin for Textastic, a text and code editor for Mac OS X
### Requirements
* [Textastic](http://www.textasticapp.com/mac.html)
### Usage
* If `tt` command is called without an argument, launch Textastic
* If `tt` is passed a directory, cd to it and open it in Textastic
* If `tt` is passed a file, open it in Textastic

View File

@ -0,0 +1,17 @@
#
# If the tt command is called without an argument, launch Textastic
# If tt is passed a directory, cd to it and open it in Textastic
# If tt is passed a file, open it in Textastic
#
function tt() {
if [[ -z "$1" ]]
then
open -a "textastic.app"
else
open -a "textastic.app" "$1"
if [[ -d "$1" ]]
then
cd "$1"
fi
fi
}

View File

@ -11,10 +11,12 @@ _arguments -C \
case $state in
cmds)
_values "tmuxinator command" \
"new[create a new project file and open it in your editor]" \
"start[start a tmux session using project's tmuxinator config]" \
"open[create a new project file and open it in your editor]" \
"copy[copy source_project project file to a new project called new_project]" \
"delete[deletes the project called project_name]" \
"debug[output the shell commands generated by a projet]" \
"implode[deletes all existing projects!]" \
"list[list all existing projects]" \
"doctor[look for problems in your configuration]" \
@ -24,9 +26,9 @@ case $state in
;;
args)
case $line[1] in
start|open|copy|delete)
start|open|copy|delete|debug)
_configs=(`find ~/.tmuxinator -name \*.yml | cut -d/ -f5 | sed s:.yml::g`)
_values 'configs' $_configs
[[ -n "$_configs" ]] && _values 'configs' $_configs
ret=0
;;
esac

View File

@ -8,6 +8,8 @@ _1st_arguments=(
'box:Box commands'
'connect:Connects to a shared, remote Vagrant environment'
'destroy:Destroys the vagrant environment'
'docker-logs:Shows Docker logs'
'docker-run:Run one-off commands against a Docker container'
'global-status:Reports the status of all active Vagrant environments on the system'
'halt:Halts the currently running vagrant environment'
'init:[box_name] [box_url] Initializes current folder for Vagrant usage'
@ -54,7 +56,8 @@ __box_list ()
__vm_list ()
{
_wanted application expl 'command' compadd $(command grep Vagrantfile -oe '^[^#]*\.vm\.define *:\([a-zA-Z0-9]\+\)' 2>/dev/null | cut -d: -f2)
_wanted application expl 'command' compadd $(command grep Vagrantfile -oe '^[^#]*\.vm\.define *[:"]\([a-zA-Z0-9_-]\+\)' 2>/dev/null | awk '{print substr($2, 2)}')
_wanted application expl 'command' compadd $(command ls .vagrant/machines/ 2>/dev/null)
}
__vagrant-box ()

View File

@ -9,7 +9,7 @@ function resolveFile
if [ -f "$1" ]; then
echo $(readlink -f "$1")
elif [[ "${1#/}" == "$1" ]]; then
echo "$(pwd)/$1"
echo "$PWD/$1"
else
echo $1
fi

View File

@ -1,7 +1,6 @@
function virtualenv_prompt_info(){
if [[ -n $VIRTUAL_ENV ]]; then
printf "%s[%s] " "%{${fg[yellow]}%}" ${${VIRTUAL_ENV}:t}
fi
[[ -n ${VIRTUAL_ENV} ]] || return
echo "${ZSH_THEME_VIRTUALENV_PREFIX:=[}${VIRTUAL_ENV:t}${ZSH_THEME_VIRTUALENV_SUFFIX:=]}"
}
# disables prompt mangling in virtual_env/bin/activate

View File

@ -4,7 +4,7 @@ function vundle-init () {
mkdir -p ~/.vim/bundle/vundle/
fi
if [ ! -d ~/.vim/bundle/vundle/.git/ ]
if [ ! -d ~/.vim/bundle/vundle/.git ] && [ ! -f ~/.vim/bundle/vundle/.git ]
then
git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
echo "\n\tRead about vim configuration for vundle at https://github.com/gmarik/vundle\n"

21
plugins/wd/LICENSE Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Markus Færevaag
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,38 +1,140 @@
## wd
wd
==
[![Build Status](https://travis-ci.org/mfaerevaag/wd.png?branch=master)](https://travis-ci.org/mfaerevaag/wd)
`wd` (*warp directory*) lets you jump to custom directories in zsh, without using `cd`. Why? Because `cd` seems ineffecient when the folder is frequently visited or has a long path.
### Setup
### oh-my-zsh
`wd` comes bundles with [oh-my-zshell](https://github.com/robbyrussell/oh-my-zsh)!
Just add the plugin in your `~/.zshrc` file:
plugins=(... wd)
#### Automatic
Run either in terminal:
* `curl -L https://github.com/mfaerevaag/wd/raw/master/install.sh | sh`
* `wget --no-check-certificate https://github.com/mfaerevaag/wd/raw/master/install.sh -O - | sh`
#### Manual
* Clone this repo to your liking
* Add `wd` function to `.zshrc` (or `.profile` etc.):
wd() {
. ~/paht/to/wd/wd.sh
}
* Install manpage. From `wd`'s base directory (requires root permissions):
# cp wd.1 /usr/share/man/man1/wd.1
# chmod 644 /usr/share/man/man1/wd.1
Note, when pulling and updating `wd`, you'll need to do this again in case of changes to the manpage.
#### Completion
If you're NOT using [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) and you want to utelize the zsh-completion feature, you will also need to add the path to your `wd` installation (`~/bin/wd` if you used the automatic installer) to your `fpath`. E.g. in your `~/.zshrc`:
fpath=(~/path/to/wd $fpath)
Also, you may have to force a rebuild of `zcompdump` by running:
$ rm -f ~/.zcompdump; compinit
**Maintainer:** [mfaerevaag](https://github.com/mfaerevaag)
`wd` (warp directory) lets you jump to custom directories in zsh, without using cd. Why? Because cd seems ineffecient when the folder is frequently visited or has a long path. [Source](https://github.com/mfaerevaag/wd)
### Usage
* Add warp point to current working directory:
wd add test
$ wd add foo
If a warp point with the same name exists, use `add!` to overwrite it.
* From an other directory, warp to test with:
Note, a warp point cannot contain colons, or only consist of only spaces and dots. The first will conflict in how `wd` stores the warp points, and the second will conflict other features, as below.
wd test
* From an other directory (not necessarily), warp to `foo` with:
* You can warp back to previous directory, and so on, with the puncticulation syntax:
$ wd foo
wd ..
wd ...
* You can warp back to previous directory, and so on, with this dot syntax:
$ wd ..
$ wd ...
This is a wrapper for the zsh `dirs` function.
(You might need `setopt AUTO_PUSHD` in your `.zshrc` if you hare not using [oh-my-zshell](https://github.com/robbyrussell/oh-my-zsh)).
* Remove warp point test point:
wd rm test
* List warp points to current directory (stored in `~/.warprc`):
wd show
$ wd rm foo
* List all warp points (stored in `~/.warprc`):
wd ls
$ wd ls
* Print usage with no opts or the `help` argument.
* List warp points to current directory, or optionally, path to given warp point:
$ wd show
* Remove warp points to non-existent directories.
$ wd clean
Use `clean!` to not be prompted with confirmation (force).
* Print usage with no opts or the `help` argument:
$ wd help
* Print the running version of `wd`:
$ wd --version
* Specifically set the config file (default `~/.warprc`), which is useful when testing:
$ wd --config ./file <action>
* Force `exit` with return code after running. This is not default, as it will *exit your terminal*, though required when testing/debugging.
$ wd --debug <action>
* Silence all output:
$ wd --quiet <action>
### Testing
`wd` comes with a small test suite, run with [shunit2](https://code.google.com/p/shunit2/). This can be used to confirm that things are working as it should on your setup, or to demonstrate an issue.
To run, simply `cd` into the `test` directory and run the `tests.sh`.
$ ./tests.sh
### License
The project is licensed under the [MIT-license](https://github.com/mfaerevaag/wd/blob/master/LICENSE).
### Finally
If you have issues, feedback or improvements, don't hesitate to report it or submit a pull-request. In the case of an issue, we would much appreciate if you would include a failing test in `test/tests.sh`. Explanation on how to run the tests, read the section "Testing" in this README.
Credit to [altschuler](https://github.com/altschuler) for awesome idea.
Hope you enjoy!

View File

@ -5,30 +5,24 @@ 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 ret=1
local -a commands
local -a warp_points
warp_points=( "${(f)mapfile[$CONFIG]}" )
# LIST="${mapfile[$FNAME]}" # Not required unless stuff uses it
warp_points=( "${(f)mapfile[$CONFIG]//$HOME/~}" )
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'
'show:Outputs all warp points that point to the current directory or shows a specific target directory for a point'
'show:Outputs all warp points that point to the current directory or shows a specific target directory for a point'
'help:Show this extremely helpful text'
'..:Go back to last directory'
)
@ -50,6 +44,9 @@ function _wd() {
add)
_message 'Write the name of your warp point' && ret=0
;;
show)
_describe -t points "Warp points" warp_points && ret=0
;;
esac
;;
esac

4
plugins/wd/wd.plugin.zsh Executable file → Normal file
View File

@ -1,7 +1,7 @@
#!/bin/zsh
# WARP
# ====
# WARP DIRECTORY
# ==============
# oh-my-zsh plugin
#
# @github.com/mfaerevaag/wd

View File

@ -1,109 +1,245 @@
#!/bin/zsh
# WARP
# ====
# WARP DIRECTORY
# ==============
# Jump to custom directories in terminal
# because `cd` takes too long...
#
# @github.com/mfaerevaag/wd
# version
readonly WD_VERSION=0.4
## variables
CONFIG=$HOME/.warprc
## colors
BLUE="\033[96m"
GREEN="\033[92m"
YELLOW="\033[93m"
RED="\033[91m"
NOC="\033[m"
# check if config file exists
if [[ ! -a $CONFIG ]]
then
# if not: create config file
touch $CONFIG
fi
## load warp points
typeset -A points
while read line
do
arr=(${(s,:,)line})
key=${arr[1]}
val=${arr[2]}
points[$key]=$val
done < $CONFIG
# colors
readonly WD_BLUE="\033[96m"
readonly WD_GREEN="\033[92m"
readonly WD_YELLOW="\033[93m"
readonly WD_RED="\033[91m"
readonly WD_NOC="\033[m"
## functions
# prepended wd_ to not conflict with your environment (no sub shell)
# helpers
wd_yesorno()
{
# variables
local question="${1}"
local prompt="${question} "
local yes_RETVAL="0"
local no_RETVAL="3"
local RETVAL=""
local answer=""
# read-eval loop
while true ; do
printf $prompt
read -r answer
case ${answer:=${default}} in
Y|y|YES|yes|Yes )
RETVAL=${yes_RETVAL} && \
break
;;
N|n|NO|no|No )
RETVAL=${no_RETVAL} && \
break
;;
* )
echo "Please provide a valid answer (y or n)"
;;
esac
done
return ${RETVAL}
}
wd_print_msg()
{
if [[ -z $wd_quiet_mode ]]
then
local color=$1
local msg=$2
if [[ $color == "" || $msg == "" ]]
then
print " ${WD_RED}*${WD_NOC} Could not print message. Sorry!"
else
print " ${color}*${WD_NOC} ${msg}"
fi
fi
}
wd_print_usage()
{
cat <<- EOF
Usage: wd [command] <point>
Commands:
add <point> Adds the current working directory to your warp points
add! <point> Overwrites existing warp point
rm <point> Removes the given warp point
show Print warp points to current directory
show <point> Print path to given warp point
ls Print all stored warp points
clean! Remove points warping to nonexistent directories
-v | --version Print version
-d | --debug Exit after execution with exit codes (for testing)
-c | --config Specify config file (default ~/.warprc)
-q | --quiet Suppress all output
help Show this extremely helpful text
EOF
}
wd_exit_fail()
{
local msg=$1
wd_print_msg $WD_RED $1
WD_EXIT_CODE=1
}
wd_exit_warn()
{
local msg=$1
wd_print_msg $WD_YELLOW $msg
WD_EXIT_CODE=1
}
# core
wd_warp()
{
if [[ $1 =~ "^\.+$" ]]
local point=$1
if [[ $point =~ "^\.+$" ]]
then
if [[ $#1 < 2 ]]
if [ $#1 < 2 ]
then
wd_print_msg $YELLOW "Warping to current directory?"
wd_exit_warn "Warping to current directory?"
else
(( n = $#1 - 1 ))
#wd_print_msg $BLUE "Warping..."
cd -$n > /dev/null
fi
elif [[ ${points[$1]} != "" ]]
elif [[ ${points[$point]} != "" ]]
then
#wd_print_msg $BLUE "Warping..."
cd ${points[$1]}
cd ${points[$point]}
else
wd_print_msg $RED "Unkown warp point '$1'"
wd_exit_fail "Unknown warp point '${point}'"
fi
}
wd_add()
{
if [[ $2 =~ "^\.+$" || $2 =~ "^\s*$" ]]
local force=$1
local point=$2
if [[ $point =~ "^[\.]+$" ]]
then
wd_print_msg $RED "Illegal warp point (see README)."
elif [[ ${points[$2]} == "" ]] || $1
wd_exit_fail "Warp point cannot be just dots"
elif [[ $point =~ "[[:space:]]+" ]]
then
wd_remove $2 > /dev/null
print "$2:$PWD" >> $CONFIG
wd_print_msg $GREEN "Warp point added"
wd_exit_fail "Warp point should not contain whitespace"
elif [[ $point == *:* ]]
then
wd_exit_fail "Warp point cannot contain colons"
elif [[ $point == "" ]]
then
wd_exit_fail "Warp point cannot be empty"
elif [[ ${points[$2]} == "" ]] || $force
then
wd_remove $point > /dev/null
printf "%q:%s\n" "${point}" "${PWD}" >> $WD_CONFIG
wd_print_msg $WD_GREEN "Warp point added"
# override exit code in case wd_remove did not remove any points
# TODO: we should handle this kind of logic better
WD_EXIT_CODE=0
else
wd_print_msg $YELLOW "Warp point '$2' already exists. Use 'add!' to overwrite."
wd_exit_warn "Warp point '${point}' already exists. Use 'add!' to overwrite."
fi
}
wd_remove()
{
if [[ ${points[$1]} != "" ]]
local point=$1
if [[ ${points[$point]} != "" ]]
then
if wd_tmp=`sed "/^$1:/d" $CONFIG`
local config_tmp=$WD_CONFIG.tmp
if sed -n "/^${point}:.*$/!p" $WD_CONFIG > $config_tmp && mv $config_tmp $WD_CONFIG
then
# `>!` forces overwrite
# we need this if people use `setopt NO_CLOBBER`
echo $wd_tmp >! $CONFIG
wd_print_msg $GREEN "Warp point removed"
wd_print_msg $WD_GREEN "Warp point removed"
else
wd_print_msg $RED "Warp point unsuccessfully removed. Sorry!"
wd_exit_fail "Something bad happened! Sorry."
fi
else
wd_print_msg $RED "Warp point was not found"
wd_exit_fail "Warp point was not found"
fi
}
wd_show()
{
wd_print_msg $BLUE "Warp points to current directory:"
wd_list_all | grep $PWD$
}
wd_list_all()
{
wd_print_msg $BLUE "All warp points:"
wd_print_msg $WD_BLUE "All warp points:"
while IFS= read -r line
do
if [[ $line != "" ]]
then
arr=(${(s,:,)line})
key=${arr[1]}
val=${arr[2]}
if [[ -z $wd_quiet_mode ]]
then
printf "%20s -> %s\n" $key $val
fi
fi
done <<< $(sed "s:${HOME}:~:g" $WD_CONFIG)
}
wd_show()
{
local name_arg=$1
# if there's an argument we look up the value
if [[ ! -z $name_arg ]]
then
if [[ -z $points[$name_arg] ]]
then
wd_print_msg $WD_BLUE "No warp point named $name_arg"
else
wd_print_msg $WD_GREEN "Warp point: ${WD_GREEN}$name_arg${WD_NOC} -> $points[$name_arg]"
fi
else
# hax to create a local empty array
local wd_matches
wd_matches=()
# do a reverse lookup to check whether PWD is in $points
if [[ ${points[(r)$PWD]} == $PWD ]]
then
for name in ${(k)points}
do
if [[ $points[$name] == $PWD ]]
then
wd_matches[$(($#wd_matches+1))]=$name
fi
done
wd_print_msg $WD_BLUE "$#wd_matches warp point(s) to current directory: ${WD_GREEN}$wd_matches${WD_NOC}"
else
wd_print_msg $WD_YELLOW "No warp point to $(echo $PWD | sed "s:$HOME:~:")"
fi
fi
}
wd_clean() {
local force=$1
local count=0
local wd_tmp=""
while read line
do
if [[ $line != "" ]]
@ -112,58 +248,94 @@ wd_list_all()
key=${arr[1]}
val=${arr[2]}
print "\t" $key "\t -> \t" $val
if [ -d "$val" ]
then
wd_tmp=$wd_tmp"\n"`echo $line`
else
wd_print_msg $WD_YELLOW "Nonexistent directory: ${key} -> ${val}"
count=$((count+1))
fi
fi
done < $CONFIG
}
done < $WD_CONFIG
wd_print_msg()
{
if [[ $1 == "" || $2 == "" ]]
if [[ $count -eq 0 ]]
then
print " $RED*$NOC Could not print message. Sorry!"
wd_print_msg $WD_BLUE "No warp points to clean, carry on!"
else
print " $1*$NOC $2"
if $force || wd_yesorno "Removing ${count} warp points. Continue? (Y/n)"
then
echo $wd_tmp >! $WD_CONFIG
wd_print_msg $WD_GREEN "Cleanup complete. ${count} warp point(s) removed"
else
wd_print_msg $WD_BLUE "Cleanup aborted"
fi
fi
}
wd_print_usage()
{
print "Usage: wd [add|-a|--add] [rm|-r|--remove] [ls|-l|--list] <point>"
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 rm \t Removes the given warp point"
print "\t show \t Outputs warp points to current directory"
print "\t ls \t Outputs all stored warp points"
print "\t help \t Show this extremely helpful text"
}
local WD_CONFIG=$HOME/.warprc
local WD_QUIET=0
local WD_EXIT_CODE=0
local WD_DEBUG=0
# Parse 'meta' options first to avoid the need to have them before
# other commands. The `-D` flag consumes recognized options so that
# the actual command parsing won't be affected.
## run
zparseopts -D -E \
c:=wd_alt_config -config:=wd_alt_config \
q=wd_quiet_mode -quiet=wd_quiet_mode \
v=wd_print_version -version=wd_print_version \
d=wd_debug_mode -debug=wd_debug_mode
if [[ ! -z $wd_print_version ]]
then
echo "wd version $WD_VERSION"
fi
if [[ ! -z $wd_alt_config ]]
then
WD_CONFIG=$wd_alt_config[2]
fi
# check if config file exists
if [ ! -e $WD_CONFIG ]
then
# if not, create config file
touch $WD_CONFIG
fi
# load warp points
typeset -A points
while read -r line
do
arr=(${(s,:,)line})
key=${arr[1]}
val=${arr[2]}
points[$key]=$val
done < $WD_CONFIG
# get opts
args=`getopt -o a:r:lhs -l add:,rm:,ls,help,show -- $*`
args=$(getopt -o a:r:c:lhs -l add:,rm:,clean\!,ls,help,show -- $*)
# check if no arguments were given
if [[ $? -ne 0 || $#* -eq 0 ]]
# check if no arguments were given, and that version is not set
if [[ ($? -ne 0 || $#* -eq 0) && -z $wd_print_version ]]
then
wd_print_usage
# check if config file is writeable
elif [[ ! -w $CONFIG ]]
# check if config file is writeable
elif [ ! -w $WD_CONFIG ]
then
wd_print_msg $RED "\'$CONFIG\' is not writeable."
# do nothing => exit
# do nothing
# can't run `exit`, as this would exit the executing shell
# i.e. your terminal
wd_exit_fail "\'$WD_CONFIG\' is not writeable."
else
#set -- $args # WTF
for i
# parse rest of options
for o
do
case "$i"
case "$o"
in
-a|--add|add)
wd_add false $2
@ -186,11 +358,19 @@ else
break
;;
-s|--show|show)
wd_show
wd_show $2
break
;;
-c|--clean|clean)
wd_clean false
break
;;
-c!|--clean!|clean!)
wd_clean true
break
;;
*)
wd_warp $i
wd_warp $o
break
;;
--)
@ -200,10 +380,29 @@ else
done
fi
## garbage collection
# if not, next time warp will pick up variables from this run
# remember, there's no sub shell
unset points
unset wd_warp
unset wd_add
unset wd_remove
unset wd_show
unset wd_list_all
unset wd_print_msg
unset wd_yesorno
unset wd_print_usage
unset wd_alt_config
unset wd_quiet_mode
unset wd_print_version
unset args
unset points
unset val &> /dev/null # fixes issue #1
if [[ ! -z $wd_debug_mode ]]
then
exit $WD_EXIT_CODE
else
unset wd_debug_mode
fi

View File

@ -1,10 +1,9 @@
# web_search from terminal
function web_search() {
# get the open command
local open_cmd
if [[ $(uname -s) == 'Darwin' ]]; then
if [[ "$OSTYPE" = darwin* ]]; then
open_cmd='open'
else
open_cmd='xdg-open'
@ -38,8 +37,8 @@ function web_search() {
done
url="${url%?}" # remove the last '+'
$open_cmd "$url"
nohup $open_cmd "$url"
rm nohup.out
}

105
plugins/wp-cli/README.md Normal file
View File

@ -0,0 +1,105 @@
# WP-CLI
**Maintainer:** [joshmedeski](https://github.com/joshmedeski)
WordPress Command Line Interface (http://wp-cli.org/)
WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser.
## List of Aliases
### Core
- wpcc='wp core config'
- wpcd='wp core download'
- wpci='wp core install'
- wpcii='wp core is-installed'
- wpcmc='wp core multisite-convert'
- wpcmi='wp core multisite-install'
- wpcu='wp core update'
- wpcudb='wp core update-db'
- wpcvc='wp core verify-checksums'
### Cron
- wpcre='wp cron event'
- wpcrs='wp cron schedule'
- wpcrt='wp cron test'
### Menu
- wpmc='wp menu create'
- wpmd='wp menu delete'
- wpmi='wp menu item'
- wpml='wp menu list'
- wpmlo='wp menu location'
### Plugin
- wppa='activate'
- wppda='deactivate'
- wppd='delete'
- wppg='get'
- wppi='install'
- wppis='is-installed'
- wppl='list'
- wppp='path'
- wpps='search'
- wppst='status'
- wppt='toggle'
- wppu='uninstall'
- wppu='update'
### Post
- wppoc='wp post create'
- wppod='wp post delete'
- wppoe='wp post edit'
- wppogen='wp post generate'
- wppog='wp post get'
- wppol='wp post list'
- wppom='wp post meta'
- wppou='wp post update'
- wppou='wp post url'
### Sidebar
- wpsbl='wp sidebar list'
### Theme
- wpta='wp theme activate'
- wptd='wp theme delete'
- wptdis='wp theme disable'
- wpte='wp theme enable'
- wptg='wp theme get'
- wpti='wp theme install'
- wptis='wp theme is-installed'
- wptl='wp theme list'
- wptm='wp theme mod'
- wptp='wp theme path'
- wpts='wp theme search'
- wptst='wp theme status'
- wptu='wp theme updatet'
### User
- wpuac='wp user add-cap'
- wpuar='wp user add-role'
- wpuc='wp user create'
- wpud='wp user delete'
- wpugen='wp user generate'
- wpug='wp user get'
- wpui='wp user import-csv'
- wpul='wp user list'
- wpulc='wp user list-caps'
- wpum='wp user meta'
- wpurc='wp user remove-cap'
- wpurr='wp user remove-role'
- wpusr='wp user set-role'
- wpuu='wp user update'
### Widget
- wpwa='wp widget add'
- wpwda='wp widget deactivate'
- wpwd='wp widget delete'
- wpwl='wp widget list'
- wpwm='wp widget move'
- wpwu='wp widget update'
The entire list of wp-cli commands can be found here: http://wp-cli.org/commands/
I only included the commands that are most used. Please feel free to contribute to this project if you want more commands.

View File

@ -0,0 +1,138 @@
# WP-CLI
# A command line interface for WordPress
# http://wp-cli.org/
# Cache
# Cap
# CLI
# Comment
# Core
alias wpcc='wp core config'
alias wpcd='wp core download'
alias wpci='wp core install'
alias wpcii='wp core is-installed'
alias wpcmc='wp core multisite-convert'
alias wpcmi='wp core multisite-install'
alias wpcu='wp core update'
alias wpcudb='wp core update-db'
alias wpcvc='wp core verify-checksums'
# Cron
alias wpcre='wp cron event'
alias wpcrs='wp cron schedule'
alias wpcrt='wp cron test'
# Db
# Eval
# Eval-File
# Export
# Help
# Import
# Media
# Menu
alias wpmc='wp menu create'
alias wpmd='wp menu delete'
alias wpmi='wp menu item'
alias wpml='wp menu list'
alias wpmlo='wp menu location'
# Network
# Option
# Plugin
alias wppa='activate'
alias wppda='deactivate'
alias wppd='delete'
alias wppg='get'
alias wppi='install'
alias wppis='is-installed'
alias wppl='list'
alias wppp='path'
alias wpps='search'
alias wppst='status'
alias wppt='toggle'
alias wppu='uninstall'
alias wppu='update'
# Post
alias wppoc='wp post create'
alias wppod='wp post delete'
alias wppoe='wp post edit'
alias wppogen='wp post generate'
alias wppog='wp post get'
alias wppol='wp post list'
alias wppom='wp post meta'
alias wppou='wp post update'
alias wppou='wp post url'
# Rewrite
# Role
# Scaffold
# Search-Replace
# Shell
# Sidebar
alias wpsbl='wp sidebar list'
# Site
# Super-Admin
# Term
# Theme
alias wpta='wp theme activate'
alias wptd='wp theme delete'
alias wptdis='wp theme disable'
alias wpte='wp theme enable'
alias wptg='wp theme get'
alias wpti='wp theme install'
alias wptis='wp theme is-installed'
alias wptl='wp theme list'
alias wptm='wp theme mod'
alias wptp='wp theme path'
alias wpts='wp theme search'
alias wptst='wp theme status'
alias wptu='wp theme updatet'
# Transient
# User
alias wpuac='wp user add-cap'
alias wpuar='wp user add-role'
alias wpuc='wp user create'
alias wpud='wp user delete'
alias wpugen='wp user generate'
alias wpug='wp user get'
alias wpui='wp user import-csv'
alias wpul='wp user list'
alias wpulc='wp user list-caps'
alias wpum='wp user meta'
alias wpurc='wp user remove-cap'
alias wpurr='wp user remove-role'
alias wpusr='wp user set-role'
alias wpuu='wp user update'
# Widget
alias wpwa='wp widget add'
alias wpwda='wp widget deactivate'
alias wpwd='wp widget delete'
alias wpwl='wp widget list'
alias wpwm='wp widget move'
alias wpwu='wp widget update'

View File

@ -1,6 +1,6 @@
#xc function courtesy of http://gist.github.com/subdigital/5420709
function xc {
xcode_proj=`find . -name "*.xc*" -d 1 | sort -r | head -1`
xcode_proj=`ls | grep "\.xc" | sort -r | head -1`
if [[ `echo -n $xcode_proj | wc -m` == 0 ]]
then
echo "No xcworkspace/xcodeproj file found in the current directory."
@ -16,4 +16,9 @@ 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'
if [[ -d $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app ]]; then
alias simulator='open $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'
else
alias simulator='open $(xcode-select -p)/Applications/iOS\ Simulator.app'
fi

View File

@ -1,10 +1,11 @@
# reload zshrc
function src()
{
local cache="$ZSH/cache"
autoload -U compinit zrecompile
compinit -d "$ZSH/cache/zcomp-$HOST"
compinit -d "$cache/zcomp-$HOST"
for f in ~/.zshrc "$ZSH/cache/zcomp-$HOST"; do
for f in ~/.zshrc "$cache/zcomp-$HOST"; do
zrecompile -p $f && command rm -f $f.zwc.old
done

View File

@ -7,10 +7,6 @@ export ZSH=$HOME/.oh-my-zsh
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
@ -26,8 +22,8 @@ ZSH_THEME="robbyrussell"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to disable command auto-correction.
# DISABLE_CORRECTION="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
@ -48,15 +44,16 @@ ZSH_THEME="robbyrussell"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
source $ZSH/oh-my-zsh.sh
# User configuration
export PATH=$HOME/bin:/usr/local/bin:$PATH
# export MANPATH="/usr/local/man:$MANPATH"
source $ZSH/oh-my-zsh.sh
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
@ -72,3 +69,12 @@ export PATH=$HOME/bin:/usr/local/bin:$PATH
# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

View File

@ -32,11 +32,12 @@ function check_git_prompt_info() {
# Determine if we are using a gemset.
function rvm_gemset() {
GEMSET=`rvm gemset list | grep '=>' | cut -b4-`
if [[ -n $GEMSET ]]; then
echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|"
if hash rvm 2>/dev/null; then
GEMSET=`rvm gemset list | grep '=>' | cut -b4-`
if [[ -n $GEMSET ]]; then
echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|"
fi
fi
}
# Determine the time since last commit. If branch is clean,

View File

@ -89,9 +89,8 @@ function precmd {
# Context: user@directory or just directory
prompt_context () {
local user=`whoami`
if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
echo -n "${PR_RESET}${PR_RED}$user@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
echo -n "${PR_RESET}${PR_RED}$USER@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
else
echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
fi

View File

@ -60,10 +60,8 @@ prompt_end() {
# Context: user@hostname (who am I and where am I)
prompt_context() {
local user=`whoami`
if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)$user@%m"
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"
fi
}

View File

@ -70,7 +70,7 @@ bureau_git_prompt () {
_PATH="%{$fg_bold[white]%}%~%{$reset_color%}"
if [[ "%#" == "#" ]]; then
if [[ $EUID -eq 0 ]]; then
_USERNAME="%{$fg_bold[red]%}%n"
_LIBERTY="%{$fg[red]%}#"
else

View File

@ -13,7 +13,7 @@ patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset
}
function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || hostname -s
[ -f ~/.box-name ] && cat ~/.box-name || echo $SHORT_HOST || echo $HOST
}
PROMPT='

View File

@ -21,7 +21,7 @@ local user="%(!.%{$fg[blue]%}.%{$fg[blue]%})%n%{$reset_color%}"
# Hostname part. compressed and colorcoded per host_repr array
# if not found, regular hostname in default color
local host="@${host_repr[$(hostname)]:-$(hostname)}%{$reset_color%}"
local host="@${host_repr[$HOST]:-$HOST}%{$reset_color%}"
# Compacted $PWD
local pwd="%{$fg[blue]%}%c%{$reset_color%}"

View File

@ -21,7 +21,7 @@ function prompt_char {
}
function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || hostname -s
[ -f ~/.box-name ] && cat ~/.box-name || echo $SHORT_HOST || echo $HOST
}

View File

@ -17,7 +17,7 @@ function prompt_char {
}
function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || hostname -s
[ -f ~/.box-name ] && cat ~/.box-name || echo $SHORT_HOST || echo $HOST
}
local ruby_env=''
@ -35,7 +35,7 @@ local prompt_char='$(prompt_char)'
PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}using%{$FG[243]%}${ruby_env}
╰─${prompt_char} "
╰─${prompt_char}%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"

View File

@ -1,4 +1,4 @@
if [ "$(whoami)" = "root" ]
if [ "$USER" = "root" ]
then CARETCOLOR="red"
else CARETCOLOR="blue"
fi

View File

@ -11,19 +11,11 @@ git_custom_status() {
fi
}
#RVM and git settings
if [[ -s ~/.rvm/scripts/rvm ]] ; then
RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1'
else
if which rbenv &> /dev/null; then
RPS1='$(git_custom_status)%{$fg[red]%}[`rbenv version | sed -e "s/ (set.*$//"`]%{$reset_color%} $EPS1'
else
if [[ -n `which chruby_prompt_info` && -n `chruby_prompt_info` ]]; then
RPS1='$(git_custom_status)%{$fg[red]%}[`chruby_prompt_info`]%{$reset_color%} $EPS1'
else
RPS1='$(git_custom_status) $EPS1'
fi
fi
fi
# RVM component of prompt
ZSH_THEME_RVM_PROMPT_PREFIX="%{$fg[red]%}["
ZSH_THEME_RVM_PROMPT_SUFFIX="]%{$reset_color%}"
# Combine it all into a final right-side prompt
RPS1='$(git_custom_status)$(ruby_prompt_info) $EPS1'
PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '

Some files were not shown because too many files have changed in this diff Show More