mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-13 03:12:21 +01:00
Merge much update from upstream
WARNING: this reverts the merge of plugin-git because it needs to be rebased
This commit is contained in:
commit
46beea6a57
87 changed files with 1309 additions and 544 deletions
4
cache/.easter-egg
vendored
Normal file
4
cache/.easter-egg
vendored
Normal 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.
|
||||||
|
|
||||||
|
|
@ -30,7 +30,6 @@ alias lsa='ls -lah'
|
||||||
alias l='ls -lah'
|
alias l='ls -lah'
|
||||||
alias ll='ls -lh'
|
alias ll='ls -lh'
|
||||||
alias la='ls -lAh'
|
alias la='ls -lAh'
|
||||||
alias sl=ls # often screw this up
|
|
||||||
|
|
||||||
alias afind='ack-grep -il'
|
alias afind='ack-grep -il'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,12 @@ bindkey -M menuselect '^o' accept-and-infer-next-history
|
||||||
|
|
||||||
zstyle ':completion:*:*:*:*:*' menu select
|
zstyle ':completion:*:*:*:*:*' menu select
|
||||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
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
|
# disable named-directories autocompletion
|
||||||
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
|
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
# Changing/making/removing directory
|
# Changing/making/removing directory
|
||||||
setopt auto_name_dirs
|
|
||||||
setopt auto_pushd
|
setopt auto_pushd
|
||||||
setopt pushd_ignore_dups
|
setopt pushd_ignore_dups
|
||||||
setopt pushdminus
|
setopt pushdminus
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@ function zsh_stats() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function uninstall_oh_my_zsh() {
|
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() {
|
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() {
|
function take() {
|
||||||
|
|
|
||||||
31
lib/git.zsh
31
lib/git.zsh
|
|
@ -10,23 +10,20 @@ function git_prompt_info() {
|
||||||
|
|
||||||
# Checks if working tree is dirty
|
# Checks if working tree is dirty
|
||||||
parse_git_dirty() {
|
parse_git_dirty() {
|
||||||
local SUBMODULE_SYNTAX=''
|
local STATUS=''
|
||||||
local GIT_STATUS=''
|
local FLAGS
|
||||||
local CLEAN_MESSAGE='nothing to commit (working directory clean)'
|
FLAGS=('--porcelain')
|
||||||
if [[ "$(command git config --get oh-my-zsh.hide-status)" != "1" ]]; then
|
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
|
||||||
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
|
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
|
||||||
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
|
FLAGS+='--ignore-submodules=dirty'
|
||||||
fi
|
fi
|
||||||
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
|
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
|
||||||
GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1)
|
FLAGS+='--untracked-files=no'
|
||||||
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"
|
|
||||||
fi
|
fi
|
||||||
|
STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
|
||||||
|
fi
|
||||||
|
if [[ -n $STATUS ]]; then
|
||||||
|
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||||
else
|
else
|
||||||
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||||
fi
|
fi
|
||||||
|
|
@ -135,17 +132,19 @@ function git_compare_version() {
|
||||||
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
|
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
|
||||||
|
|
||||||
for i in {1..3}; do
|
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
|
if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then
|
||||||
echo -1
|
echo -1
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo 1
|
echo 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#this is unlikely to change so make it all statically assigned
|
#this is unlikely to change so make it all statically assigned
|
||||||
POST_1_7_2_GIT=$(git_compare_version "1.7.2")
|
POST_1_7_2_GIT=$(git_compare_version "1.7.2")
|
||||||
#clean up the namespace slightly by removing the checker function
|
#clean up the namespace slightly by removing the checker function
|
||||||
unset -f git_compare_version
|
unset -f git_compare_version
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,5 @@ function omz_termsupport_preexec {
|
||||||
title '$CMD' '%100>...>$LINE%<<'
|
title '$CMD' '%100>...>$LINE%<<'
|
||||||
}
|
}
|
||||||
|
|
||||||
autoload -U add-zsh-hook
|
precmd_functions+=(omz_termsupport_precmd)
|
||||||
add-zsh-hook precmd omz_termsupport_precmd
|
preexec_functions+=(omz_termsupport_preexec)
|
||||||
add-zsh-hook preexec omz_termsupport_preexec
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Check for updates on initial load...
|
# Check for updates on initial load...
|
||||||
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
|
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
|
fi
|
||||||
|
|
||||||
# Initializes Oh My Zsh
|
# Initializes Oh My Zsh
|
||||||
|
|
@ -38,9 +38,9 @@ for plugin ($plugins); do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Figure out the SHORT hostname
|
# Figure out the SHORT hostname
|
||||||
if [ -n "$commands[scutil]" ]; then
|
if [[ "$OSTYPE" = darwin* ]]; then
|
||||||
# OS X
|
# OS X's $HOST changes with dhcp, etc. Use ComputerName if possible.
|
||||||
SHORT_HOST=$(scutil --get ComputerName)
|
SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/}
|
||||||
else
|
else
|
||||||
SHORT_HOST=${HOST/.*/}
|
SHORT_HOST=${HOST/.*/}
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
8
plugins/adb/README.md
Normal file
8
plugins/adb/README.md
Normal 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
39
plugins/adb/_adb
Normal 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
|
||||||
|
|
@ -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 yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local")
|
||||||
alias yaorph='yaourt -Qtd' # Remove orphans using yaourt
|
alias yaorph='yaourt -Qtd' # Remove orphans using yaourt
|
||||||
# Additional yaourt alias examples
|
# 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
|
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
|
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
|
fi
|
||||||
alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package
|
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
|
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 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
|
alias paclocs='pacman -Qs' # Search for package(s) in the local database
|
||||||
# Additional pacman alias examples
|
# Additional pacman alias examples
|
||||||
if [[ -x `which abs` ]]; then
|
if [[ -x `which abs` && -x `which aur` ]]; then
|
||||||
alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
|
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
|
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
|
fi
|
||||||
alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package
|
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
|
alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
if [ $commands[autojump] ]; then # check if autojump is installed
|
if [ $commands[autojump] ]; then # check if autojump is installed
|
||||||
if [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
|
if [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
|
||||||
. $HOME/.autojump/etc/profile.d/autojump.zsh
|
. $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
|
elif [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package
|
||||||
. /usr/share/autojump/autojump.zsh
|
. /usr/share/autojump/autojump.zsh
|
||||||
elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
|
elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,28 @@
|
||||||
|
_homebrew-installed() {
|
||||||
|
type brew &> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
_awscli-homebrew-installed() {
|
||||||
|
brew list awscli &> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
export AWS_HOME=~/.aws
|
export AWS_HOME=~/.aws
|
||||||
|
|
||||||
function agp {
|
function agp {
|
||||||
echo $AWS_DEFAULT_PROFILE
|
echo $AWS_DEFAULT_PROFILE
|
||||||
|
|
||||||
}
|
}
|
||||||
function asp {
|
function asp {
|
||||||
export AWS_DEFAULT_PROFILE=$1
|
export AWS_DEFAULT_PROFILE=$1
|
||||||
export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>"
|
export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>"
|
||||||
|
|
||||||
}
|
}
|
||||||
function aws_profiles {
|
function aws_profiles {
|
||||||
reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/'))
|
reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/'))
|
||||||
}
|
}
|
||||||
|
|
||||||
compctl -K aws_profiles asp
|
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
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
# Modified to add support for Apple Mac #
|
# Modified to add support for Apple Mac #
|
||||||
###########################################
|
###########################################
|
||||||
|
|
||||||
if [[ $(uname) == "Darwin" ]] ; then
|
if [[ "$OSTYPE" = darwin* ]] ; then
|
||||||
|
|
||||||
function battery_pct() {
|
function battery_pct() {
|
||||||
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
|
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
|
||||||
|
|
|
||||||
20
plugins/bbedit/README.md
Normal file
20
plugins/bbedit/README.md
Normal 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
|
||||||
21
plugins/bbedit/bbedit.plugin.zsh
Normal file
21
plugins/bbedit/bbedit.plugin.zsh
Normal 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
|
||||||
|
}
|
||||||
|
|
@ -50,6 +50,7 @@ _1st_arguments=(
|
||||||
'server:start a local web app that lets you browse formulae (requires Sinatra)'
|
'server:start a local web app that lets you browse formulae (requires Sinatra)'
|
||||||
'services:small wrapper around `launchctl` for supported formulae'
|
'services:small wrapper around `launchctl` for supported formulae'
|
||||||
'tap:tap a new formula repository from GitHub, or list existing taps'
|
'tap:tap a new formula repository from GitHub, or list existing taps'
|
||||||
|
'uninstall:uninstall a formula'
|
||||||
'unlink:unlink a formula'
|
'unlink:unlink a formula'
|
||||||
'unpin:unpin specified formulae'
|
'unpin:unpin specified formulae'
|
||||||
'untap:remove a tapped repository'
|
'untap:remove a tapped repository'
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ bundle_install() {
|
||||||
if _bundler-installed && _within-bundled-project; then
|
if _bundler-installed && _within-bundled-project; then
|
||||||
local bundler_version=`bundle version | cut -d' ' -f3`
|
local bundler_version=`bundle version | cut -d' ' -f3`
|
||||||
if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
|
if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
|
||||||
if [[ "$(uname)" == 'Darwin' ]]
|
if [[ "$OSTYPE" = darwin* ]]
|
||||||
then
|
then
|
||||||
local cores_num="$(sysctl hw.ncpu | awk '{print $2}')"
|
local cores_num="$(sysctl hw.ncpu | awk '{print $2}')"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -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() {
|
man() {
|
||||||
env \
|
env \
|
||||||
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
||||||
|
|
@ -7,5 +25,8 @@ man() {
|
||||||
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
|
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
|
||||||
LESS_TERMCAP_ue=$(printf "\e[0m") \
|
LESS_TERMCAP_ue=$(printf "\e[0m") \
|
||||||
LESS_TERMCAP_us=$(printf "\e[1;32m") \
|
LESS_TERMCAP_us=$(printf "\e[1;32m") \
|
||||||
|
PAGER=/usr/bin/less \
|
||||||
|
_NROFF_U=1 \
|
||||||
|
PATH=${HOME}/bin:${PATH} \
|
||||||
man "$@"
|
man "$@"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ alias ff='find . -type f -name'
|
||||||
alias h='history'
|
alias h='history'
|
||||||
alias hgrep="fc -El 0 | grep"
|
alias hgrep="fc -El 0 | grep"
|
||||||
alias help='man'
|
alias help='man'
|
||||||
alias j='jobs'
|
|
||||||
alias p='ps -f'
|
alias p='ps -f'
|
||||||
alias sortnr='sort -n -r'
|
alias sortnr='sort -n -r'
|
||||||
alias unexport='unset'
|
alias unexport='unset'
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT.
|
# that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT.
|
||||||
#
|
#
|
||||||
|
|
||||||
dirhistory_past=(`pwd`)
|
dirhistory_past=($PWD)
|
||||||
dirhistory_future=()
|
dirhistory_future=()
|
||||||
export dirhistory_past
|
export dirhistory_past
|
||||||
export dirhistory_future
|
export dirhistory_future
|
||||||
|
|
@ -50,7 +50,7 @@ function push_future() {
|
||||||
|
|
||||||
# Called by zsh when directory changes
|
# Called by zsh when directory changes
|
||||||
function chpwd() {
|
function chpwd() {
|
||||||
push_past `pwd`
|
push_past $PWD
|
||||||
# If DIRHISTORY_CD is not set...
|
# If DIRHISTORY_CD is not set...
|
||||||
if [[ -z "${DIRHISTORY_CD+x}" ]]; then
|
if [[ -z "${DIRHISTORY_CD+x}" ]]; then
|
||||||
# ... clear future.
|
# ... clear future.
|
||||||
|
|
@ -73,7 +73,7 @@ function dirhistory_back() {
|
||||||
pop_past cw
|
pop_past cw
|
||||||
if [[ "" == "$cw" ]]; then
|
if [[ "" == "$cw" ]]; then
|
||||||
# Someone overwrote our variable. Recover it.
|
# Someone overwrote our variable. Recover it.
|
||||||
dirhistory_past=(`pwd`)
|
dirhistory_past=($PWD)
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,21 +8,25 @@
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
function emoji-clock() {
|
function emoji-clock() {
|
||||||
hour=$(date '+%I')
|
# Add 15 minutes to the current time and save the value as $minutes.
|
||||||
minutes=$(date '+%M')
|
(( 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
|
case $hour in
|
||||||
01) clock="🕐"; [ $minutes -ge 30 ] && clock="🕜";;
|
0) clock="🕛"; [ $minutes -ge 30 ] && clock="🕧";;
|
||||||
02) clock="🕑"; [ $minutes -ge 30 ] && clock="🕝";;
|
1) clock="🕐"; [ $minutes -ge 30 ] && clock="🕜";;
|
||||||
03) clock="🕒"; [ $minutes -ge 30 ] && clock="🕞";;
|
2) clock="🕑"; [ $minutes -ge 30 ] && clock="🕝";;
|
||||||
04) clock="🕓"; [ $minutes -ge 30 ] && clock="🕟";;
|
3) clock="🕒"; [ $minutes -ge 30 ] && clock="🕞";;
|
||||||
05) clock="🕔"; [ $minutes -ge 30 ] && clock="🕠";;
|
4) clock="🕓"; [ $minutes -ge 30 ] && clock="🕟";;
|
||||||
06) clock="🕕"; [ $minutes -ge 30 ] && clock="🕡";;
|
5) clock="🕔"; [ $minutes -ge 30 ] && clock="🕠";;
|
||||||
07) clock="🕖"; [ $minutes -ge 30 ] && clock="🕢";;
|
6) clock="🕕"; [ $minutes -ge 30 ] && clock="🕡";;
|
||||||
08) clock="🕗"; [ $minutes -ge 30 ] && clock="🕣";;
|
7) clock="🕖"; [ $minutes -ge 30 ] && clock="🕢";;
|
||||||
09) clock="🕘"; [ $minutes -ge 30 ] && clock="🕤";;
|
8) clock="🕗"; [ $minutes -ge 30 ] && clock="🕣";;
|
||||||
|
9) clock="🕘"; [ $minutes -ge 30 ] && clock="🕤";;
|
||||||
10) clock="🕙"; [ $minutes -ge 30 ] && clock="🕥";;
|
10) clock="🕙"; [ $minutes -ge 30 ] && clock="🕥";;
|
||||||
11) clock="🕚"; [ $minutes -ge 30 ] && clock="🕦";;
|
11) clock="🕚"; [ $minutes -ge 30 ] && clock="🕦";;
|
||||||
12) clock="🕛"; [ $minutes -ge 30 ] && clock="🕧";;
|
|
||||||
*) clock="⌛";;
|
*) clock="⌛";;
|
||||||
esac
|
esac
|
||||||
echo $clock
|
echo $clock
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ function extract() {
|
||||||
file_name="$( basename "$1" )"
|
file_name="$( basename "$1" )"
|
||||||
extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )"
|
extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )"
|
||||||
case "$1" in
|
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.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
|
||||||
(*.tar.xz|*.txz) tar --xz --help &> /dev/null \
|
(*.tar.xz|*.txz) tar --xz --help &> /dev/null \
|
||||||
&& tar --xz -xvf "$1" \
|
&& tar --xz -xvf "$1" \
|
||||||
|
|
@ -47,7 +47,7 @@ function extract() {
|
||||||
&& tar --lzma -xvf "$1" \
|
&& tar --lzma -xvf "$1" \
|
||||||
|| lzcat "$1" | tar xvf - ;;
|
|| lzcat "$1" | tar xvf - ;;
|
||||||
(*.tar) tar xvf "$1" ;;
|
(*.tar) tar xvf "$1" ;;
|
||||||
(*.gz) gunzip "$1" ;;
|
(*.gz) [ -z $commands[pigz] ] && gunzip "$1" || pigz -d "$1" ;;
|
||||||
(*.bz2) bunzip2 "$1" ;;
|
(*.bz2) bunzip2 "$1" ;;
|
||||||
(*.xz) unxz "$1" ;;
|
(*.xz) unxz "$1" ;;
|
||||||
(*.lzma) unlzma "$1" ;;
|
(*.lzma) unlzma "$1" ;;
|
||||||
|
|
|
||||||
|
|
@ -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
|
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
|
||||||
# Updated to support ForkLift2 by Johan Kaving
|
# Updated to support ForkLift2 by Johan Kaving
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ alias jquery='frontend jquery'
|
||||||
alias mdn='frontend mdn'
|
alias mdn='frontend mdn'
|
||||||
|
|
||||||
# pre processors frameworks
|
# pre processors frameworks
|
||||||
alias compass='frontend compass'
|
alias compassdoc='frontend compass'
|
||||||
|
|
||||||
# important links
|
# important links
|
||||||
alias html5please='frontend html5please'
|
alias html5please='frontend html5please'
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,8 @@ case "$words[1]" in
|
||||||
build)
|
build)
|
||||||
_files -g "*.gemspec"
|
_files -g "*.gemspec"
|
||||||
;;
|
;;
|
||||||
|
install)
|
||||||
|
_files ;;
|
||||||
list)
|
list)
|
||||||
if [[ "$state" == forms ]]; then
|
if [[ "$state" == forms ]]; then
|
||||||
_gem_installed
|
_gem_installed
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 -*-
|
# -*- coding: UTF-8 -*-
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
import re
|
import re
|
||||||
|
|
|
||||||
|
|
@ -1,96 +1,37 @@
|
||||||
#
|
|
||||||
# Compatibility
|
|
||||||
#
|
|
||||||
|
|
||||||
# Check xargs flavor for -r flag
|
|
||||||
echo | xargs -r &>/dev/null && XARGS_OPTS="-r"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Functions
|
|
||||||
#
|
|
||||||
|
|
||||||
# The current branch name
|
|
||||||
# Usage example: git pull origin $(current_branch)
|
|
||||||
function current_branch() {
|
|
||||||
if [ ! -d .git ]; then return; fi
|
|
||||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
|
||||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
|
||||||
echo ${ref#refs/heads/}
|
|
||||||
}
|
|
||||||
# The list of remotes
|
|
||||||
function current_repository() {
|
|
||||||
if [ ! -d .git ]; then return; fi
|
|
||||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
|
||||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
|
||||||
echo $(git remote -v | cut -d':' -f 2)
|
|
||||||
}
|
|
||||||
# Pretty log messages
|
|
||||||
function _git_log_prettily(){
|
|
||||||
if ! [ -z $1 ]; then
|
|
||||||
git log --pretty=$1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
# This function return a warning if the current branch is a wip
|
|
||||||
function work_in_progress() {
|
|
||||||
if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then
|
|
||||||
echo "WIP!!"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Aliases
|
# Aliases
|
||||||
#
|
|
||||||
alias g='git'
|
alias g='git'
|
||||||
compdef g=git
|
compdef g=git
|
||||||
# Status
|
|
||||||
alias gst='git status'
|
alias gst='git status'
|
||||||
compdef _git gst=git-status
|
compdef _git gst=git-status
|
||||||
alias gss='git status -s'
|
|
||||||
compdef _git gss=git-status
|
|
||||||
alias gsb='git status -sb'
|
|
||||||
compdef _git gsb=git-status
|
|
||||||
# Diff
|
|
||||||
alias gd='git diff'
|
alias gd='git diff'
|
||||||
compdef _git gd=git-diff
|
compdef _git gd=git-diff
|
||||||
alias gdc='git diff --cached'
|
alias gdc='git diff --cached'
|
||||||
compdef _git gdc=git-diff
|
compdef _git gdc=git-diff
|
||||||
gdv() { git diff -w "$@" | view - }
|
alias gdt='git diff-tree --no-commit-id --name-only -r'
|
||||||
compdef _git gdv=git-diff
|
compdef _git gdc=git diff-tree --no-commit-id --name-only -r
|
||||||
alias gdw='git diff --word-diff'
|
|
||||||
compdef _git gdw=git-diff
|
|
||||||
alias gbl='git blame -b -w'
|
|
||||||
compdef _git gbl=git-blame
|
|
||||||
# Pull
|
|
||||||
alias gl='git pull'
|
alias gl='git pull'
|
||||||
compdef _git gl=git-pull
|
compdef _git gl=git-pull
|
||||||
alias gup='git pull --rebase'
|
alias gup='git pull --rebase'
|
||||||
compdef _git gup=git-fetch
|
compdef _git gup=git-fetch
|
||||||
# Push
|
|
||||||
alias gp='git push'
|
alias gp='git push'
|
||||||
compdef _git gp=git-push
|
compdef _git gp=git-push
|
||||||
alias gpf='git push --force'
|
alias gd='git diff'
|
||||||
compdef _git gpf=git-push
|
gdv() { git diff -w "$@" | view - }
|
||||||
alias gpd='git push --dry-run'
|
compdef _git gdv=git-diff
|
||||||
compdef _git gpd=git-push
|
alias gdt='git difftool'
|
||||||
alias gpoat='git push origin --all && git push origin --tags'
|
|
||||||
compdef _git gpoat=git-push
|
|
||||||
# Commit
|
|
||||||
alias gc='git commit -v'
|
alias gc='git commit -v'
|
||||||
compdef _git gc=git-commit
|
compdef _git gc=git-commit
|
||||||
alias gc!='git commit -v --amend'
|
alias gc!='git commit -v --amend'
|
||||||
compdef _git gc!=git-commit
|
compdef _git gc!=git-commit
|
||||||
alias gca='git commit -v -a'
|
alias gca='git commit -v -a'
|
||||||
compdef _git gca=git-commit
|
compdef _git gc=git-commit
|
||||||
alias gca!='git commit -v -a --amend'
|
alias gca!='git commit -v -a --amend'
|
||||||
compdef _git gca!=git-commit
|
compdef _git gca!=git-commit
|
||||||
alias gcmsg='git commit -m'
|
alias gcmsg='git commit -m'
|
||||||
compdef _git gcmsg=git-commit
|
compdef _git gcmsg=git-commit
|
||||||
# Checkout
|
|
||||||
alias gco='git checkout'
|
alias gco='git checkout'
|
||||||
compdef _git gco=git-checkout
|
compdef _git gco=git-checkout
|
||||||
alias gcm='git checkout master'
|
alias gcm='git checkout master'
|
||||||
compdef _git gcm=git-checkout
|
|
||||||
# Remote
|
|
||||||
alias gr='git remote'
|
alias gr='git remote'
|
||||||
compdef _git gr=git-remote
|
compdef _git gr=git-remote
|
||||||
alias grv='git remote -v'
|
alias grv='git remote -v'
|
||||||
|
|
@ -103,80 +44,25 @@ alias grset='git remote set-url'
|
||||||
compdef _git grset=git-remote
|
compdef _git grset=git-remote
|
||||||
alias grup='git remote update'
|
alias grup='git remote update'
|
||||||
compdef _git grset=git-remote
|
compdef _git grset=git-remote
|
||||||
# Rebase
|
|
||||||
alias grb='git rebase'
|
|
||||||
compdef _git grb=git-rebase
|
|
||||||
alias grbc='git rebase --continue'
|
|
||||||
compdef _git grbc=git-rebase
|
|
||||||
alias grbs='git rebase --skip'
|
|
||||||
compdef _git grbs=git-rebase
|
|
||||||
alias grba='git rebase --abort'
|
|
||||||
compdef _git grba=git-rebase
|
|
||||||
alias grbm='git rebase master'
|
|
||||||
compdef _git grbm=git-rebase
|
|
||||||
alias grbi='git rebase -i'
|
alias grbi='git rebase -i'
|
||||||
compdef _git grbi=git-rebase
|
compdef _git grbi=git-rebase
|
||||||
alias gr1='git rebase -i HEAD~'
|
alias grbc='git rebase --continue'
|
||||||
compdef _git gr1=git-rebase
|
compdef _git grbc=git-rebase
|
||||||
alias gr2='git rebase -i HEAD~2'
|
alias grba='git rebase --abort'
|
||||||
compdef _git gr2=git-rebase
|
compdef _git grba=git-rebase
|
||||||
alias gr3='git rebase -i HEAD~3'
|
|
||||||
compdef _git gr3=git-rebase
|
|
||||||
alias gr4='git rebase -i HEAD~4'
|
|
||||||
compdef _git gr4=git-rebase
|
|
||||||
alias gr5='git rebase -i HEAD~5'
|
|
||||||
compdef _git gr5=git-rebase
|
|
||||||
alias gr6='git rebase -i HEAD~6'
|
|
||||||
compdef _git gr6=git-rebase
|
|
||||||
alias gr7='git rebase -i HEAD~7'
|
|
||||||
compdef _git gr7=git-rebase
|
|
||||||
alias gr8='git rebase -i HEAD~8'
|
|
||||||
compdef _git gr8=git-rebase
|
|
||||||
alias gr9='git rebase -i HEAD~9'
|
|
||||||
compdef _git gr9=git-rebase
|
|
||||||
alias gr10='git rebase -i HEAD~10'
|
|
||||||
compdef _git gr10=git-rebase
|
|
||||||
# Cherry-pick
|
|
||||||
alias gcp='git cherry-pick'
|
|
||||||
compdef _git gcp=git-cherry-pick
|
|
||||||
# Branch
|
|
||||||
alias gb='git branch'
|
alias gb='git branch'
|
||||||
compdef _git gb=git-branch
|
compdef _git gb=git-branch
|
||||||
alias gba='git branch -a'
|
alias gba='git branch -a'
|
||||||
compdef _git gba=git-branch
|
compdef _git gba=git-branch
|
||||||
alias gbnm='git branch --no-merged'
|
alias gbr='git branch --remote'
|
||||||
compdef _git gbnm=git-branch
|
|
||||||
# Config
|
|
||||||
alias gcl='git config --list'
|
|
||||||
compdef _git gcl=git-config
|
|
||||||
# Add
|
|
||||||
alias ga='git add'
|
|
||||||
compdef _git ga=git-add
|
|
||||||
# Merge
|
|
||||||
alias gm='git merge'
|
|
||||||
compdef _git gm=git-merge
|
|
||||||
alias gmum='git merge upstream/master'
|
|
||||||
compdef _git gmum=git-merge
|
|
||||||
alias gmt='git mergetool --no-prompt'
|
|
||||||
compdef _git gmt=git-mergetool
|
|
||||||
alias gmtvim='git mergetool --no-prompt --tool=vimdiff'
|
|
||||||
compdef _git gmtvim=git-mergetool
|
|
||||||
# Reset
|
|
||||||
alias grh='git reset HEAD'
|
|
||||||
compdef _git grh=git-reset
|
|
||||||
alias grhh='git reset HEAD --hard'
|
|
||||||
compdef _git grhh=git-reset
|
|
||||||
alias gru='git reset --'
|
|
||||||
compdef _git gru=git-reset
|
|
||||||
alias gclean='git reset --hard && git clean -dfx'
|
|
||||||
# Log
|
|
||||||
alias gcount='git shortlog -sn'
|
alias gcount='git shortlog -sn'
|
||||||
compdef gcount=git
|
compdef gcount=git
|
||||||
alias glg='git log --stat --color'
|
alias gcl='git config --list'
|
||||||
|
alias gcp='git cherry-pick'
|
||||||
|
compdef _git gcp=git-cherry-pick
|
||||||
|
alias glg='git log --stat --max-count=10'
|
||||||
compdef _git glg=git-log
|
compdef _git glg=git-log
|
||||||
alias glgp='git log --stat --color -p'
|
alias glgg='git log --graph --max-count=10'
|
||||||
compdef _git glgp=git-log
|
|
||||||
alias glgg='git log --graph --color'
|
|
||||||
compdef _git glgg=git-log
|
compdef _git glgg=git-log
|
||||||
alias glgga='git log --graph --decorate --all'
|
alias glgga='git log --graph --decorate --all'
|
||||||
compdef _git glgga=git-log
|
compdef _git glgga=git-log
|
||||||
|
|
@ -184,93 +70,110 @@ alias glo='git log --oneline --decorate --color'
|
||||||
compdef _git glo=git-log
|
compdef _git glo=git-log
|
||||||
alias glog='git log --oneline --decorate --color --graph'
|
alias glog='git log --oneline --decorate --color --graph'
|
||||||
compdef _git glog=git-log
|
compdef _git glog=git-log
|
||||||
alias glgm='git log --graph --max-count=10'
|
alias gss='git status -s'
|
||||||
compdef _git glgm=git-log
|
compdef _git gss=git-status
|
||||||
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
|
alias ga='git add'
|
||||||
compdef _git gwch=git-whatchanged
|
compdef _git ga=git-add
|
||||||
alias glp="_git_log_prettily"
|
alias gap='git add --patch'
|
||||||
compdef _git glp=git-log
|
alias gm='git merge'
|
||||||
# GUI
|
compdef _git gm=git-merge
|
||||||
|
alias grh='git reset HEAD'
|
||||||
|
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'
|
||||||
|
|
||||||
|
alias gpoat='git push origin --all && git push origin --tags'
|
||||||
|
alias gmt='git mergetool --no-prompt'
|
||||||
|
compdef _git gm=git-mergetool
|
||||||
|
|
||||||
alias gg='git gui citool'
|
alias gg='git gui citool'
|
||||||
alias gga='git gui citool --amend'
|
alias gga='git gui citool --amend'
|
||||||
alias gk='gitk --all --branches'
|
alias gk='gitk --all --branches'
|
||||||
# Stash
|
|
||||||
alias gsts='git stash show --text'
|
alias gsts='git stash show --text'
|
||||||
compdef _git gsts='git-stash'
|
|
||||||
alias gsta='git stash'
|
alias gsta='git stash'
|
||||||
compdef _git gsta='git-stash'
|
|
||||||
alias gstp='git stash pop'
|
alias gstp='git stash pop'
|
||||||
compdef _git gstp='git-stash'
|
|
||||||
alias gstd='git stash drop'
|
alias gstd='git stash drop'
|
||||||
compdef _git gstd='git-stash'
|
|
||||||
alias gstl='git stash list'
|
# Will cd into the top of the current repository
|
||||||
compdef _git gstl='git-stash'
|
# or submodule.
|
||||||
alias gstaa='git stash apply'
|
|
||||||
compdef _git gstaa='git-stash'
|
|
||||||
# Gitk
|
|
||||||
alias gk='\gitk --all --branches'
|
|
||||||
compdef _git gk='gitk'
|
|
||||||
# show complete history, with dangling commits
|
|
||||||
# Note: if the commit has been cleaned by 'git gc', the dangling
|
|
||||||
# commits older than 2 weeks may have been deleted
|
|
||||||
alias gke='\gitk --all $(git log -g --pretty=format:%h)'
|
|
||||||
compdef _git gke='gitk'
|
|
||||||
# Remove all .orig, .BASE.*, .REMOTE.*, .LOCAL.*, *.BACKUP files
|
|
||||||
alias gclean="find . -name '*.orig' -or -name '*.REMOTE.*' -or \
|
|
||||||
-name '*.LOCAL.*' -or -name '*.BACKUP.*' -or -name '*.BASE.*' | \
|
|
||||||
xargs $XARGS_OPTS rm -v"
|
|
||||||
# cd into the top of the current repository or submodule
|
|
||||||
alias grt='cd $(git rev-parse --show-toplevel || echo ".")'
|
alias grt='cd $(git rev-parse --show-toplevel || echo ".")'
|
||||||
|
|
||||||
# Git and svn mix
|
# Git and svn mix
|
||||||
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
|
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
|
||||||
compdef git-svn-dcommit-push=git
|
compdef git-svn-dcommit-push=git
|
||||||
|
|
||||||
alias gsr='git svn rebase'
|
alias gsr='git svn rebase'
|
||||||
alias gsd='git svn dcommit'
|
alias gsd='git svn dcommit'
|
||||||
# Current branch
|
#
|
||||||
ggl() {
|
# Will return the current branch name
|
||||||
[[ "$#" != 1 ]] && b="$(current_branch)"
|
# Usage example: git pull origin $(current_branch)
|
||||||
git pull origin "${b:=$1}"
|
#
|
||||||
|
function current_branch() {
|
||||||
|
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||||
|
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||||
|
echo ${ref#refs/heads/}
|
||||||
}
|
}
|
||||||
compdef _git ggl=git-checkout
|
|
||||||
ggu() {
|
function current_repository() {
|
||||||
[[ "$#" != 1 ]] && b="$(current_branch)"
|
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||||
git pull --rebase origin "${b:=$1}"
|
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||||
|
echo $(git remote -v | cut -d':' -f 2)
|
||||||
}
|
}
|
||||||
compdef _git ggu=git-checkout
|
|
||||||
ggp() {
|
# these aliases take advantage of the previous function
|
||||||
[[ "$#" != 1 ]] && b="$(current_branch)"
|
alias ggpull='git pull origin $(current_branch)'
|
||||||
git push origin "${b:=$1}"
|
compdef ggpull=git
|
||||||
|
alias ggpur='git pull --rebase origin $(current_branch)'
|
||||||
|
compdef ggpur=git
|
||||||
|
alias ggpush='git push origin $(current_branch)'
|
||||||
|
compdef ggpush=git
|
||||||
|
alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'
|
||||||
|
compdef ggpnp=git
|
||||||
|
|
||||||
|
# Pretty log messages
|
||||||
|
function _git_log_prettily(){
|
||||||
|
if ! [ -z $1 ]; then
|
||||||
|
git log --pretty=$1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
compdef _git ggp=git-checkout
|
alias glp="_git_log_prettily"
|
||||||
ggf() {
|
compdef _git glp=git-log
|
||||||
[[ "$#" != 1 ]] && b="$(current_branch)"
|
|
||||||
git push --force origin "${b:=$1}"
|
|
||||||
}
|
|
||||||
compdef _git ggf=git-checkout
|
|
||||||
ggpnp() {
|
|
||||||
ggl "$1" && ggp "$1"
|
|
||||||
}
|
|
||||||
compdef _git ggpnp=git-checkout
|
|
||||||
# Work In Progress (wip)
|
# Work In Progress (wip)
|
||||||
# These features allow to pause a branch development and switch to another one
|
# These features allow to pause a branch development and switch to another one (wip)
|
||||||
# When you want to go back to work, just unwip it
|
# When you want to go back to work, just unwip it
|
||||||
alias gwip="git add -A; git ls-files --deleted -z | xargs ${XARGS_OPTS} -0 git rm 2>/dev/null; git commit -m \"--wip--\""
|
#
|
||||||
|
# This function return a warning if the current branch is a wip
|
||||||
|
function work_in_progress() {
|
||||||
|
if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then
|
||||||
|
echo "WIP!!"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
# these alias commit and uncomit wip branches
|
||||||
|
alias gwip='git add -A; git ls-files --deleted -z | xargs -r0 git rm; git commit -m "--wip--"'
|
||||||
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
|
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
|
||||||
# Ignore changes to file
|
|
||||||
|
# these alias ignore changes to file
|
||||||
alias gignore='git update-index --assume-unchanged'
|
alias gignore='git update-index --assume-unchanged'
|
||||||
alias gunignore='git update-index --no-assume-unchanged'
|
alias gunignore='git update-index --no-assume-unchanged'
|
||||||
# List temporarily ignored files
|
# list temporarily ignored files
|
||||||
alias gignored='git ls-files -v | grep "^[[:lower:]]"'
|
alias gignored='git ls-files -v | grep "^[[:lower:]]"'
|
||||||
# Grep list of files in the index
|
|
||||||
function gfg() { git ls-files | grep $@ }
|
|
||||||
compdef gfg=grep
|
|
||||||
# Submodules
|
|
||||||
alias gf='git fetch'
|
|
||||||
compdef _git gf=git-fetch
|
|
||||||
alias gsi='git submodule init'
|
|
||||||
compdef _git gsi=git-submodule
|
|
||||||
alias gsu='git submodule update'
|
|
||||||
compdef _git gsu=git-submodule
|
|
||||||
|
|
||||||
# Compatibility
|
|
||||||
unset XARGS_OPTS
|
|
||||||
|
|
|
||||||
|
|
@ -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() {
|
_gitignoreio_get_command_list() {
|
||||||
curl -s http://www.gitignore.io/api/list | tr "," "\n"
|
curl -sL https://www.gitignore.io/api/list | tr "," "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
_gitignireio () {
|
_gitignoreio () {
|
||||||
compset -P '*,'
|
compset -P '*,'
|
||||||
compadd -S '' `_gitignireio_get_command_list`
|
compadd -S '' `_gitignoreio_get_command_list`
|
||||||
}
|
}
|
||||||
|
|
||||||
compdef _gitignireio gi
|
compdef _gitignoreio gi
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
# jira ABC-123 # Opens an existing issue
|
# jira ABC-123 # Opens an existing issue
|
||||||
open_jira_issue () {
|
open_jira_issue () {
|
||||||
local open_cmd
|
local open_cmd
|
||||||
if [[ $(uname -s) == 'Darwin' ]]; then
|
if [[ "$OSTYPE" = darwin* ]]; then
|
||||||
open_cmd='open'
|
open_cmd='open'
|
||||||
else
|
else
|
||||||
open_cmd='xdg-open'
|
open_cmd='xdg-open'
|
||||||
|
|
@ -26,7 +26,7 @@ open_jira_issue () {
|
||||||
jira_url=$JIRA_URL
|
jira_url=$JIRA_URL
|
||||||
else
|
else
|
||||||
echo "JIRA url is not specified anywhere."
|
echo "JIRA url is not specified anywhere."
|
||||||
return 0
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f .jira-prefix ]; then
|
if [ -f .jira-prefix ]; then
|
||||||
|
|
@ -39,7 +39,9 @@ open_jira_issue () {
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "Opening new issue"
|
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
|
else
|
||||||
echo "Opening issue #$1"
|
echo "Opening issue #$1"
|
||||||
if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then
|
if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then
|
||||||
|
|
@ -50,4 +52,39 @@ open_jira_issue () {
|
||||||
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'
|
alias jira='open_jira_issue'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@ jump() {
|
||||||
|
|
||||||
mark() {
|
mark() {
|
||||||
if (( $# == 0 )); then
|
if (( $# == 0 )); then
|
||||||
MARK=$(basename "$(pwd)")
|
MARK=$(basename "$PWD")
|
||||||
else
|
else
|
||||||
MARK="$1"
|
MARK="$1"
|
||||||
fi
|
fi
|
||||||
if read -q \?"Mark $(pwd) as ${MARK}? (y/n) "; then
|
if read -q \?"Mark $PWD as ${MARK}? (y/n) "; then
|
||||||
mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$MARK"
|
mkdir -p "$MARKPATH"; ln -s "$PWD" "$MARKPATH/$MARK"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
13
plugins/marked2/README.md
Normal file
13
plugins/marked2/README.md
Normal 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
|
||||||
12
plugins/marked2/marked2.plugin.zsh
Normal file
12
plugins/marked2/marked2.plugin.zsh
Normal 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
|
||||||
|
}
|
||||||
|
|
@ -64,7 +64,7 @@ alias mvns='mvn site'
|
||||||
function listMavenCompletions {
|
function listMavenCompletions {
|
||||||
reply=(
|
reply=(
|
||||||
# common lifecycle
|
# 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
|
# 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
|
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
|
||||||
|
|
@ -129,6 +129,8 @@ function listMavenCompletions {
|
||||||
tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy
|
tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy
|
||||||
# tomcat7
|
# tomcat7
|
||||||
tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy
|
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
|
||||||
spring-boot:run spring-boot:repackage
|
spring-boot:run spring-boot:repackage
|
||||||
# exec
|
# exec
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
function node-docs {
|
function node-docs {
|
||||||
# get the open command
|
# get the open command
|
||||||
local open_cmd
|
local open_cmd
|
||||||
if [[ $(uname -s) == 'Darwin' ]]; then
|
if [[ "$OSTYPE" = darwin* ]]; then
|
||||||
open_cmd='open'
|
open_cmd='open'
|
||||||
else
|
else
|
||||||
open_cmd='xdg-open'
|
open_cmd='xdg-open'
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ function man-preview() {
|
||||||
|
|
||||||
function trash() {
|
function trash() {
|
||||||
local trash_dir="${HOME}/.Trash"
|
local trash_dir="${HOME}/.Trash"
|
||||||
local temp_ifs=$IFS
|
local temp_ifs="$IFS"
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
for item in "$@"; do
|
for item in "$@"; do
|
||||||
if [[ -e "$item" ]]; then
|
if [[ -e "$item" ]]; then
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,16 @@
|
||||||
#compdef pass
|
#compdef pass
|
||||||
#autoload
|
#autoload
|
||||||
|
|
||||||
# Copyright (C) 2012:
|
# Copyright (C) 2012 - 2014:
|
||||||
# Johan Venant <jvenant@invicem.pro>
|
# Johan Venant <jvenant@invicem.pro>
|
||||||
# Brian Mattern <rephorm@rephorm.com>
|
# Brian Mattern <rephorm@rephorm.com>
|
||||||
# Jason A. Donenfeld <Jason@zx2c4.com>.
|
# Jason A. Donenfeld <Jason@zx2c4.com>.
|
||||||
# Santiago Borrazás <sanbor@gmail.com>
|
|
||||||
# All Rights Reserved.
|
# 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 () {
|
_pass () {
|
||||||
|
|
@ -23,8 +26,8 @@ _pass () {
|
||||||
case "${cmd}" in
|
case "${cmd}" in
|
||||||
init)
|
init)
|
||||||
_arguments : \
|
_arguments : \
|
||||||
"-r[re-encrypt existing passwords]" \
|
"-p[gpg-id will only be applied to this subfolder]" \
|
||||||
"--reencrypt[re-encrypt existing passwords]"
|
"--path[gpg-id will only be applied to this subfolder]"
|
||||||
_pass_complete_keys
|
_pass_complete_keys
|
||||||
;;
|
;;
|
||||||
ls|list|edit)
|
ls|list|edit)
|
||||||
|
|
@ -43,9 +46,19 @@ _pass () {
|
||||||
"-n[don't include symbols in password]" \
|
"-n[don't include symbols in password]" \
|
||||||
"--no-symbols[don't include symbols in password]" \
|
"--no-symbols[don't include symbols in password]" \
|
||||||
"-c[copy password to the clipboard]" \
|
"-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
|
_pass_complete_entries_with_subdirs
|
||||||
;;
|
;;
|
||||||
|
cp|copy|mv|rename)
|
||||||
|
_arguments : \
|
||||||
|
"-f[force rename]" \
|
||||||
|
"--force[force rename]"
|
||||||
|
_pass_complete_entries_with_subdirs
|
||||||
|
;;
|
||||||
rm)
|
rm)
|
||||||
_arguments : \
|
_arguments : \
|
||||||
"-f[force deletion]" \
|
"-f[force deletion]" \
|
||||||
|
|
@ -75,10 +88,14 @@ _pass () {
|
||||||
subcommands=(
|
subcommands=(
|
||||||
"init:Initialize new password storage"
|
"init:Initialize new password storage"
|
||||||
"ls:List passwords"
|
"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"
|
"show:Decrypt and print a password"
|
||||||
"insert:Insert a new password"
|
"insert:Insert a new password"
|
||||||
"generate:Generate a new password using pwgen"
|
"generate:Generate a new password using pwgen"
|
||||||
"edit:Edit a password with \$EDITOR"
|
"edit:Edit a password with \$EDITOR"
|
||||||
|
"mv:Rename the password"
|
||||||
|
"cp:Copy the password"
|
||||||
"rm:Remove the password"
|
"rm:Remove the password"
|
||||||
"git:Call git on the password store"
|
"git:Call git on the password store"
|
||||||
"version:Output version information"
|
"version:Output version information"
|
||||||
|
|
@ -101,7 +118,7 @@ _pass_cmd_show () {
|
||||||
_pass_complete_entries_helper () {
|
_pass_complete_entries_helper () {
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
|
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 () {
|
_pass_complete_entries_with_subdirs () {
|
||||||
|
|
@ -117,3 +134,5 @@ _pass_complete_keys () {
|
||||||
# Extract names and email addresses from gpg --list-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')
|
_values 'gpg keys' $(gpg2 --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_pass
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,11 @@ function pj() {
|
||||||
file=$1
|
file=$1
|
||||||
|
|
||||||
if [[ "open" == "$file" ]] then
|
if [[ "open" == "$file" ]] then
|
||||||
file=$2
|
shift
|
||||||
|
file=$*
|
||||||
cmd=(${(s: :)EDITOR})
|
cmd=(${(s: :)EDITOR})
|
||||||
|
else
|
||||||
|
file=$*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for project in $PROJECT_PATHS; do
|
for project in $PROJECT_PATHS; do
|
||||||
|
|
@ -36,7 +39,11 @@ function pj() {
|
||||||
alias pjo="pj open"
|
alias pjo="pj open"
|
||||||
|
|
||||||
function _pj () {
|
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
|
compdef _pj pj
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,13 @@
|
||||||
|
|
||||||
rack_root(){
|
rack_root(){
|
||||||
setopt chaselinks
|
setopt chaselinks
|
||||||
local orgdir="$(pwd)"
|
local orgdir="$PWD"
|
||||||
local basedir="$(pwd)"
|
local basedir="$PWD"
|
||||||
|
|
||||||
while [[ $basedir != '/' ]]; do
|
while [[ $basedir != '/' ]]; do
|
||||||
test -e "$basedir/config.ru" && break
|
test -e "$basedir/config.ru" && break
|
||||||
builtin cd ".." 2>/dev/null
|
builtin cd ".." 2>/dev/null
|
||||||
basedir="$(pwd)"
|
basedir="$PWD"
|
||||||
done
|
done
|
||||||
|
|
||||||
builtin cd "$orgdir" 2>/dev/null
|
builtin cd "$orgdir" 2>/dev/null
|
||||||
|
|
@ -56,7 +56,7 @@ kapow(){
|
||||||
compctl -W ~/.pow -/ kapow
|
compctl -W ~/.pow -/ kapow
|
||||||
|
|
||||||
powit(){
|
powit(){
|
||||||
local basedir="$(pwd)"
|
local basedir="$PWD"
|
||||||
local vhost=$1
|
local vhost=$1
|
||||||
[ ! -n "$vhost" ] && vhost=$(rack_root_detect)
|
[ ! -n "$vhost" ] && vhost=$(rack_root_detect)
|
||||||
if [ ! -h ~/.pow/$vhost ]
|
if [ ! -h ~/.pow/$vhost ]
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# This will look for a custom profile for the local machine and each domain or
|
# 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)
|
# 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
|
for i in {${#parts}..1}; do
|
||||||
profile=${(j:.:)${parts[$i,${#parts}]}}
|
profile=${(j:.:)${parts[$i,${#parts}]}}
|
||||||
file=$ZSH_CUSTOM/profiles/$profile
|
file=$ZSH_CUSTOM/profiles/$profile
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ function _rails_command () {
|
||||||
elif [ -e "script/server" ]; then
|
elif [ -e "script/server" ]; then
|
||||||
ruby script/$@
|
ruby script/$@
|
||||||
else
|
else
|
||||||
rails $@
|
command rails $@
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@ function _rake_command () {
|
||||||
if [ -e "bin/rake" ]; then
|
if [ -e "bin/rake" ]; then
|
||||||
bin/rake $@
|
bin/rake $@
|
||||||
else
|
else
|
||||||
rake $@
|
command rake $@
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ _rake_refresh () {
|
||||||
_rake_does_task_list_need_generating () {
|
_rake_does_task_list_need_generating () {
|
||||||
if [ ! -f .rake_tasks ]; then return 0;
|
if [ ! -f .rake_tasks ]; then return 0;
|
||||||
else
|
else
|
||||||
if [[ $(uname -s) == 'Darwin' ]]; then
|
if [[ "$OSTYPE" = darwin* ]]; then
|
||||||
accurate=$(stat -f%m .rake_tasks)
|
accurate=$(stat -f%m .rake_tasks)
|
||||||
changed=$(stat -f%m Rakefile)
|
changed=$(stat -f%m Rakefile)
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ alias gemsets='rvm gemset list'
|
||||||
local ruby18='ruby-1.8.7'
|
local ruby18='ruby-1.8.7'
|
||||||
local ruby19='ruby-1.9.3'
|
local ruby19='ruby-1.9.3'
|
||||||
local ruby20='ruby-2.0.0'
|
local ruby20='ruby-2.0.0'
|
||||||
local ruby21='ruby-2.1.1'
|
local ruby21='ruby-2.1.2'
|
||||||
|
|
||||||
function rb18 {
|
function rb18 {
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
|
|
|
||||||
|
|
@ -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
|
preference given to recently visited paths. `scd` can create permanent
|
||||||
directory aliases, which appear as named directories in zsh session.
|
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
|
Besides oh-my-zsh, `scd` can be used with *bash*, *dash* or *tcsh*
|
||||||
[template file](../../templates/zshrc.zsh-template#L45).
|
|
||||||
|
|
||||||
Besides zsh, `scd` can be used with *bash*, *dash* or *tcsh*
|
|
||||||
shells and is also available as [Vim](http://www.vim.org/) plugin and
|
shells and is also available as [Vim](http://www.vim.org/) plugin and
|
||||||
[IPython](http://ipython.org/) extension. For installation details, see
|
[IPython](http://ipython.org/) extension. For installation details, see
|
||||||
https://github.com/pavoljuhas/smart-change-directory.
|
https://github.com/pavoljuhas/smart-change-directory.
|
||||||
|
|
@ -34,7 +31,7 @@ scd [options] [pattern1 pattern2 ...]
|
||||||
add specified directories to the directory index.</dd><dt>
|
add specified directories to the directory index.</dd><dt>
|
||||||
|
|
||||||
--unindex</dt><dd>
|
--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>
|
-r, --recursive</dt><dd>
|
||||||
apply options <em>--add</em> or <em>--unindex</em> recursively.</dd><dt>
|
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
|
remove ALIAS definition for the current or specified directory from
|
||||||
<em>~/.scdalias.zsh</em>.</dd><dt>
|
<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>
|
--list</dt><dd>
|
||||||
show matching directories and exit.</dd><dt>
|
show matching directories and exit.</dd><dt>
|
||||||
|
|
||||||
|
|
@ -70,7 +71,7 @@ scd doc
|
||||||
scd a b c
|
scd a b c
|
||||||
|
|
||||||
# Change to a directory path that ends with "ts"
|
# Change to a directory path that ends with "ts"
|
||||||
scd "ts(#e)"
|
scd "ts$"
|
||||||
|
|
||||||
# Show selection menu and ranking of 20 most likely directories
|
# Show selection menu and ranking of 20 most likely directories
|
||||||
scd -v
|
scd -v
|
||||||
|
|
|
||||||
119
plugins/scd/scd
119
plugins/scd/scd
|
|
@ -11,20 +11,22 @@ fi
|
||||||
local DOC='scd -- smart change to a recently used directory
|
local DOC='scd -- smart change to a recently used directory
|
||||||
usage: scd [options] [pattern1 pattern2 ...]
|
usage: scd [options] [pattern1 pattern2 ...]
|
||||||
Go to a directory path that contains all fixed string patterns. Prefer
|
Go to a directory path that contains all fixed string patterns. Prefer
|
||||||
recently visited directories and directories with patterns in their tail
|
recent or frequently visited directories as found in the directory index.
|
||||||
component. Display a selection menu in case of multiple matches.
|
Display a selection menu in case of multiple matches.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-a, --add add specified directories to the directory index
|
-a, --add add specified directories to the directory index.
|
||||||
--unindex remove specified directories from the index
|
--unindex remove current or specified directories from the index.
|
||||||
-r, --recursive apply options --add or --unindex recursively
|
-r, --recursive apply options --add or --unindex recursively.
|
||||||
--alias=ALIAS create alias for the current or specified directory and
|
--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
|
--unalias remove ALIAS definition for the current or specified
|
||||||
directory from ~/.scdalias.zsh
|
directory from ~/.scdalias.zsh.
|
||||||
--list show matching directories and exit
|
-A, --all include all matching directories. Disregard matching by
|
||||||
-v, --verbose display directory rank in the selection menu
|
directory alias and filtering of less likely paths.
|
||||||
-h, --help display this message and exit
|
--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}
|
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_SCRIPT=${RUNNING_AS_COMMAND:+$SCD_SCRIPT}
|
||||||
local SCD_ALIAS=~/.scdalias.zsh
|
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_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 -A drank dalias
|
||||||
local dmatching
|
local dmatching
|
||||||
local last_directory
|
local last_directory
|
||||||
|
|
@ -56,7 +58,8 @@ zmodload -i zsh/zutil
|
||||||
zmodload -i zsh/datetime
|
zmodload -i zsh/datetime
|
||||||
zparseopts -D -- a=opt_add -add=opt_add -unindex=opt_unindex \
|
zparseopts -D -- a=opt_add -add=opt_add -unindex=opt_unindex \
|
||||||
r=opt_recursive -recursive=opt_recursive \
|
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 \
|
v=opt_verbose -verbose=opt_verbose h=opt_help -help=opt_help \
|
||||||
|| $EXIT $?
|
|| $EXIT $?
|
||||||
|
|
||||||
|
|
@ -68,6 +71,11 @@ fi
|
||||||
# load directory aliases if they exist
|
# load directory aliases if they exist
|
||||||
[[ -r $SCD_ALIAS ]] && source $SCD_ALIAS
|
[[ -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
|
# works faster than the (:a) modifier and is compatible with zsh 4.2.6
|
||||||
_scd_Y19oug_abspath() {
|
_scd_Y19oug_abspath() {
|
||||||
set -A $1 ${(ps:\0:)"$(
|
set -A $1 ${(ps:\0:)"$(
|
||||||
|
|
@ -123,11 +131,52 @@ if [[ -n $opt_unalias ]]; then
|
||||||
$EXIT $?
|
$EXIT $?
|
||||||
fi
|
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
|
# Rewrite directory index if it is at least 20% oversized
|
||||||
if [[ -s $SCD_HISTFILE ]] && \
|
if [[ -s $SCD_HISTFILE ]] && \
|
||||||
(( $(wc -l <$SCD_HISTFILE) > 1.2 * $SCD_HISTSIZE )); then
|
(( $(wc -l <$SCD_HISTFILE) > 1.2 * $SCD_HISTSIZE )); then
|
||||||
m=( ${(f)"$(<$SCD_HISTFILE)"} )
|
# compress repeated entries
|
||||||
print -lr -- ${m[-$SCD_HISTSIZE,-1]} >| ${SCD_HISTFILE}
|
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
|
fi
|
||||||
|
|
||||||
# Determine the last recorded directory
|
# Determine the last recorded directory
|
||||||
|
|
@ -135,7 +184,6 @@ if [[ -s ${SCD_HISTFILE} ]]; then
|
||||||
last_directory=${"$(tail -1 ${SCD_HISTFILE})"#*;}
|
last_directory=${"$(tail -1 ${SCD_HISTFILE})"#*;}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Internal functions are prefixed with "_scd_Y19oug_".
|
|
||||||
# The "record" function adds its arguments to the directory index.
|
# The "record" function adds its arguments to the directory index.
|
||||||
_scd_Y19oug_record() {
|
_scd_Y19oug_record() {
|
||||||
while [[ -n $last_directory && $1 == $last_directory ]]; do
|
while [[ -n $last_directory && $1 == $last_directory ]]; do
|
||||||
|
|
@ -217,7 +265,7 @@ _scd_Y19oug_action() {
|
||||||
# set global arrays dmatching and drank
|
# set global arrays dmatching and drank
|
||||||
_scd_Y19oug_match() {
|
_scd_Y19oug_match() {
|
||||||
## single argument that is an existing directory or directory alias
|
## 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 ]];
|
[[ -d ${d::=$1} || -d ${d::=${nameddirs[$1]}} ]] && [[ -x $d ]];
|
||||||
then
|
then
|
||||||
_scd_Y19oug_abspath dmatching $d
|
_scd_Y19oug_abspath dmatching $d
|
||||||
|
|
@ -227,6 +275,8 @@ _scd_Y19oug_match() {
|
||||||
|
|
||||||
# ignore case unless there is an argument with an uppercase letter
|
# ignore case unless there is an argument with an uppercase letter
|
||||||
[[ "$*" == *[[:upper:]]* ]] || ICASE='(#i)'
|
[[ "$*" == *[[: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
|
# 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
|
# include a dummy entry for splitting of an empty string is buggy
|
||||||
|
|
@ -237,10 +287,10 @@ _scd_Y19oug_match() {
|
||||||
BEGIN { FS = "[:;]"; }
|
BEGIN { FS = "[:;]"; }
|
||||||
length($0) < 4096 && $2 > 0 {
|
length($0) < 4096 && $2 > 0 {
|
||||||
tau = 1.0 * ($2 - epochseconds) / meanlife;
|
tau = 1.0 * ($2 - epochseconds) / meanlife;
|
||||||
if (tau < -4.61) tau = -4.61;
|
if (tau < -6.9078) tau = -6.9078;
|
||||||
prec = exp(tau);
|
prob = exp(tau);
|
||||||
sub(/^[^;]*;/, "");
|
sub(/^[^;]*;/, "");
|
||||||
if (NF) ptot[$0] += prec;
|
if (NF) ptot[$0] += prob;
|
||||||
}
|
}
|
||||||
END { for (di in ptot) { print di; print ptot[di]; } }'
|
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
|
# filter drank to the entries that match all arguments
|
||||||
for a; do
|
for a; do
|
||||||
p=${ICASE}"*${a}*"
|
p=${ICASE}"*(${a})*"
|
||||||
drank=( ${(kv)drank[(I)${~p}]} )
|
drank=( ${(kv)drank[(I)${~p}]} )
|
||||||
done
|
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
|
# build a list of matching directories reverse-sorted by their probabilities
|
||||||
dmatching=( ${(f)"$(
|
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
|
# do not match $HOME or $PWD when run without arguments
|
||||||
if [[ $# == 0 ]]; then
|
if [[ $# == 0 ]]; then
|
||||||
dmatching=( ${dmatching:#(${HOME}|${PWD})} )
|
dmatching=( ${dmatching:#(${HOME}|${PWD})} )
|
||||||
|
|
@ -302,6 +335,9 @@ _scd_Y19oug_match() {
|
||||||
|
|
||||||
# discard all directories below the rank threshold
|
# discard all directories below the rank threshold
|
||||||
threshold=$(( maxrank * SCD_THRESHOLD ))
|
threshold=$(( maxrank * SCD_THRESHOLD ))
|
||||||
|
if [[ -n ${opt_all} ]]; then
|
||||||
|
threshold=0
|
||||||
|
fi
|
||||||
dmatching=( ${^dmatching}(Ne:'(( ${drank[$REPLY]} >= threshold ))':) )
|
dmatching=( ${^dmatching}(Ne:'(( ${drank[$REPLY]} >= threshold ))':) )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -339,6 +375,7 @@ fi
|
||||||
|
|
||||||
## here we have multiple matches - display selection menu
|
## here we have multiple matches - display selection menu
|
||||||
a=( {a-z} {A-Z} )
|
a=( {a-z} {A-Z} )
|
||||||
|
a=( ${a[1,${#dmatching}]} )
|
||||||
p=( )
|
p=( )
|
||||||
for i in {1..${#dmatching}}; do
|
for i in {1..${#dmatching}}; do
|
||||||
[[ -n ${a[i]} ]] || break
|
[[ -n ${a[i]} ]] || break
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ if [[ $('uname') == 'Linux' ]]; then
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
elif [[ $('uname') == 'Darwin' ]]; then
|
elif [[ "$OSTYPE" = darwin* ]]; then
|
||||||
local _sublime_darwin_paths > /dev/null 2>&1
|
local _sublime_darwin_paths > /dev/null 2>&1
|
||||||
_sublime_darwin_paths=(
|
_sublime_darwin_paths=(
|
||||||
"/usr/local/bin/subl"
|
"/usr/local/bin/subl"
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ function svn_dirty() {
|
||||||
|
|
||||||
function svn_dirty_choose_pwd () {
|
function svn_dirty_choose_pwd () {
|
||||||
if in_svn; then
|
if in_svn; then
|
||||||
root=`pwd`
|
root=$PWD
|
||||||
if $(svn status $root 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'); then
|
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".
|
# Grep exits with 0 when "One or more lines were selected", return "dirty".
|
||||||
echo $1
|
echo $1
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,26 @@
|
||||||
# Symfony2 basic command completion
|
# Symfony2 basic command completion
|
||||||
|
|
||||||
|
_symfony_console () {
|
||||||
|
echo "php $(find . -maxdepth 2 -mindepth 1 -name 'console' -type f | head -n 1)"
|
||||||
|
}
|
||||||
|
|
||||||
_symfony2_get_command_list () {
|
_symfony2_get_command_list () {
|
||||||
php $(find . -maxdepth 2 -mindepth 1 -name '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 () {
|
_symfony2 () {
|
||||||
if [ -f $(find . -maxdepth 2 -mindepth 1 -name 'console') ]; then
|
compadd `_symfony2_get_command_list`
|
||||||
compadd `_symfony2_get_command_list`
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
compdef _symfony2 $(find . -maxdepth 2 -mindepth 1 -name 'console')
|
compdef _symfony2 '`_symfony_console`'
|
||||||
|
compdef _symfony2 'app/console'
|
||||||
|
compdef _symfony2 'bin/console'
|
||||||
compdef _symfony2 sf
|
compdef _symfony2 sf
|
||||||
|
|
||||||
#Alias
|
#Alias
|
||||||
alias sf='php $(find . -maxdepth 2 -mindepth 1 -name 'console') '
|
alias sf='`_symfony_console`'
|
||||||
alias sfcl='php $(find . -maxdepth 2 -mindepth 1 -name 'console') cache:clear'
|
alias sfcl='sf cache:clear'
|
||||||
alias sfcw='php $(find . -maxdepth 2 -mindepth 1 -name 'console') cache:warmup'
|
alias sfcw='sf cache:warmup'
|
||||||
alias sfroute='php $(find . -maxdepth 2 -mindepth 1 -name 'console') router:debug'
|
alias sfroute='sf router:debug'
|
||||||
alias sfcontainer='php $(find . -maxdepth 2 -mindepth 1 -name 'console') container:debug'
|
alias sfcontainer='sf container:debug'
|
||||||
alias sfgb='php $(find . -maxdepth 2 -mindepth 1 -name 'console') generate:bundle'
|
alias sfgb='sf generate:bundle'
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ function retlog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
alias ping='ping -c 5'
|
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 path='echo -e ${PATH//:/\\n}'
|
||||||
alias mkdir='mkdir -pv'
|
alias mkdir='mkdir -pv'
|
||||||
# get top process eating memory
|
# get top process eating memory
|
||||||
|
|
|
||||||
15
plugins/textastic/README.md
Normal file
15
plugins/textastic/README.md
Normal 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
|
||||||
17
plugins/textastic/textastic.plugin.zsh
Normal file
17
plugins/textastic/textastic.plugin.zsh
Normal 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
|
||||||
|
}
|
||||||
|
|
@ -11,10 +11,12 @@ _arguments -C \
|
||||||
case $state in
|
case $state in
|
||||||
cmds)
|
cmds)
|
||||||
_values "tmuxinator command" \
|
_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]" \
|
"start[start a tmux session using project's tmuxinator config]" \
|
||||||
"open[create a new project file and open it in your editor]" \
|
"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]" \
|
"copy[copy source_project project file to a new project called new_project]" \
|
||||||
"delete[deletes the project called project_name]" \
|
"delete[deletes the project called project_name]" \
|
||||||
|
"debug[output the shell commands generated by a projet]" \
|
||||||
"implode[deletes all existing projects!]" \
|
"implode[deletes all existing projects!]" \
|
||||||
"list[list all existing projects]" \
|
"list[list all existing projects]" \
|
||||||
"doctor[look for problems in your configuration]" \
|
"doctor[look for problems in your configuration]" \
|
||||||
|
|
@ -24,9 +26,9 @@ case $state in
|
||||||
;;
|
;;
|
||||||
args)
|
args)
|
||||||
case $line[1] in
|
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`)
|
_configs=(`find ~/.tmuxinator -name \*.yml | cut -d/ -f5 | sed s:.yml::g`)
|
||||||
_values 'configs' $_configs
|
[[ -n "$_configs" ]] && _values 'configs' $_configs
|
||||||
ret=0
|
ret=0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,8 @@ __box_list ()
|
||||||
|
|
||||||
__vm_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 ()
|
__vagrant-box ()
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ function resolveFile
|
||||||
if [ -f "$1" ]; then
|
if [ -f "$1" ]; then
|
||||||
echo $(readlink -f "$1")
|
echo $(readlink -f "$1")
|
||||||
elif [[ "${1#/}" == "$1" ]]; then
|
elif [[ "${1#/}" == "$1" ]]; then
|
||||||
echo "$(pwd)/$1"
|
echo "$PWD/$1"
|
||||||
else
|
else
|
||||||
echo $1
|
echo $1
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
function virtualenv_prompt_info(){
|
function virtualenv_prompt_info(){
|
||||||
if [[ -n $VIRTUAL_ENV ]]; then
|
[[ -n ${VIRTUAL_ENV} ]] || return
|
||||||
printf "%s[%s] " "%{${fg[yellow]}%}" ${${VIRTUAL_ENV}:t}
|
echo "${ZSH_THEME_VIRTUALENV_PREFIX:=[}${VIRTUAL_ENV:t}${ZSH_THEME_VIRTUALENV_SUFFIX:=]}"
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# disables prompt mangling in virtual_env/bin/activate
|
# disables prompt mangling in virtual_env/bin/activate
|
||||||
|
|
|
||||||
21
plugins/wd/LICENSE
Normal file
21
plugins/wd/LICENSE
Normal 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.
|
||||||
|
|
@ -1,38 +1,140 @@
|
||||||
## wd
|
wd
|
||||||
|
==
|
||||||
|
|
||||||
|
[](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
|
### Usage
|
||||||
|
|
||||||
* Add warp point to current working directory:
|
* 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.
|
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 ..
|
* You can warp back to previous directory, and so on, with this dot syntax:
|
||||||
wd ...
|
|
||||||
|
$ wd ..
|
||||||
|
$ wd ...
|
||||||
|
|
||||||
This is a wrapper for the zsh `dirs` function.
|
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:
|
* Remove warp point test point:
|
||||||
|
|
||||||
wd rm test
|
$ wd rm foo
|
||||||
|
|
||||||
* List warp points to current directory (stored in `~/.warprc`):
|
|
||||||
|
|
||||||
wd show
|
|
||||||
|
|
||||||
* List all warp points (stored in `~/.warprc`):
|
* 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!
|
||||||
|
|
|
||||||
|
|
@ -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:*:warp_points' group-name warp_points
|
||||||
zstyle ':completion::complete:wd::' list-grouped
|
zstyle ':completion::complete:wd::' list-grouped
|
||||||
|
|
||||||
# Call `_wd()` when when trying to complete the command `wd`
|
|
||||||
|
|
||||||
zmodload zsh/mapfile
|
zmodload zsh/mapfile
|
||||||
|
|
||||||
function _wd() {
|
function _wd() {
|
||||||
local ret=1
|
|
||||||
local CONFIG=$HOME/.warprc
|
local CONFIG=$HOME/.warprc
|
||||||
|
local ret=1
|
||||||
# Stolen from
|
|
||||||
# http://stackoverflow.com/questions/9000698/completion-when-program-has-sub-commands
|
|
||||||
|
|
||||||
# local curcontext="$curcontext" state line
|
|
||||||
# typeset -A opt_args
|
|
||||||
|
|
||||||
local -a commands
|
local -a commands
|
||||||
local -a warp_points
|
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=(
|
commands=(
|
||||||
'add:Adds the current working directory to your warp points'
|
'add:Adds the current working directory to your warp points'
|
||||||
'add!:Overwrites existing warp point'
|
'add!:Overwrites existing warp point'
|
||||||
'rm:Removes the given warp point'
|
'rm:Removes the given warp point'
|
||||||
'ls:Outputs all stored warp points'
|
'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'
|
'help:Show this extremely helpful text'
|
||||||
'..:Go back to last directory'
|
'..:Go back to last directory'
|
||||||
)
|
)
|
||||||
|
|
@ -50,6 +44,9 @@ function _wd() {
|
||||||
add)
|
add)
|
||||||
_message 'Write the name of your warp point' && ret=0
|
_message 'Write the name of your warp point' && ret=0
|
||||||
;;
|
;;
|
||||||
|
show)
|
||||||
|
_describe -t points "Warp points" warp_points && ret=0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
# WARP
|
# WARP DIRECTORY
|
||||||
# ====
|
# ==============
|
||||||
# oh-my-zsh plugin
|
# oh-my-zsh plugin
|
||||||
#
|
#
|
||||||
# @github.com/mfaerevaag/wd
|
# @github.com/mfaerevaag/wd
|
||||||
|
|
|
||||||
393
plugins/wd/wd.sh
393
plugins/wd/wd.sh
|
|
@ -1,109 +1,245 @@
|
||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
# WARP
|
# WARP DIRECTORY
|
||||||
# ====
|
# ==============
|
||||||
# Jump to custom directories in terminal
|
# Jump to custom directories in terminal
|
||||||
# because `cd` takes too long...
|
# because `cd` takes too long...
|
||||||
#
|
#
|
||||||
# @github.com/mfaerevaag/wd
|
# @github.com/mfaerevaag/wd
|
||||||
|
|
||||||
|
# version
|
||||||
|
readonly WD_VERSION=0.4
|
||||||
|
|
||||||
## variables
|
# colors
|
||||||
CONFIG=$HOME/.warprc
|
readonly WD_BLUE="\033[96m"
|
||||||
|
readonly WD_GREEN="\033[92m"
|
||||||
## colors
|
readonly WD_YELLOW="\033[93m"
|
||||||
BLUE="\033[96m"
|
readonly WD_RED="\033[91m"
|
||||||
GREEN="\033[92m"
|
readonly WD_NOC="\033[m"
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
## functions
|
## 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()
|
wd_warp()
|
||||||
{
|
{
|
||||||
if [[ $1 =~ "^\.+$" ]]
|
local point=$1
|
||||||
|
|
||||||
|
if [[ $point =~ "^\.+$" ]]
|
||||||
then
|
then
|
||||||
if [[ $#1 < 2 ]]
|
if [ $#1 < 2 ]
|
||||||
then
|
then
|
||||||
wd_print_msg $YELLOW "Warping to current directory?"
|
wd_exit_warn "Warping to current directory?"
|
||||||
else
|
else
|
||||||
(( n = $#1 - 1 ))
|
(( n = $#1 - 1 ))
|
||||||
#wd_print_msg $BLUE "Warping..."
|
|
||||||
cd -$n > /dev/null
|
cd -$n > /dev/null
|
||||||
fi
|
fi
|
||||||
elif [[ ${points[$1]} != "" ]]
|
elif [[ ${points[$point]} != "" ]]
|
||||||
then
|
then
|
||||||
#wd_print_msg $BLUE "Warping..."
|
cd ${points[$point]}
|
||||||
cd ${points[$1]}
|
|
||||||
else
|
else
|
||||||
wd_print_msg $RED "Unknown warp point '$1'"
|
wd_exit_fail "Unknown warp point '${point}'"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
wd_add()
|
wd_add()
|
||||||
{
|
{
|
||||||
if [[ $2 =~ "^\.+$" || $2 =~ "^\s*$" ]]
|
local force=$1
|
||||||
|
local point=$2
|
||||||
|
|
||||||
|
if [[ $point =~ "^[\.]+$" ]]
|
||||||
then
|
then
|
||||||
wd_print_msg $RED "Illegal warp point (see README)."
|
wd_exit_fail "Warp point cannot be just dots"
|
||||||
elif [[ ${points[$2]} == "" ]] || $1
|
elif [[ $point =~ "[[:space:]]+" ]]
|
||||||
then
|
then
|
||||||
wd_remove $2 > /dev/null
|
wd_exit_fail "Warp point should not contain whitespace"
|
||||||
print "$2:$PWD" >> $CONFIG
|
elif [[ $point == *:* ]]
|
||||||
wd_print_msg $GREEN "Warp point added"
|
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
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
wd_remove()
|
wd_remove()
|
||||||
{
|
{
|
||||||
if [[ ${points[$1]} != "" ]]
|
local point=$1
|
||||||
|
|
||||||
|
if [[ ${points[$point]} != "" ]]
|
||||||
then
|
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
|
then
|
||||||
# `>!` forces overwrite
|
wd_print_msg $WD_GREEN "Warp point removed"
|
||||||
# we need this if people use `setopt NO_CLOBBER`
|
|
||||||
echo $wd_tmp >! $CONFIG
|
|
||||||
wd_print_msg $GREEN "Warp point removed"
|
|
||||||
else
|
else
|
||||||
wd_print_msg $RED "Warp point unsuccessfully removed. Sorry!"
|
wd_exit_fail "Something bad happened! Sorry."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
wd_print_msg $RED "Warp point was not found"
|
wd_exit_fail "Warp point was not found"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
wd_show()
|
|
||||||
{
|
|
||||||
wd_print_msg $BLUE "Warp points to current directory:"
|
|
||||||
wd_list_all | grep $PWD$
|
|
||||||
}
|
|
||||||
|
|
||||||
wd_list_all()
|
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
|
while read line
|
||||||
do
|
do
|
||||||
if [[ $line != "" ]]
|
if [[ $line != "" ]]
|
||||||
|
|
@ -112,58 +248,94 @@ wd_list_all()
|
||||||
key=${arr[1]}
|
key=${arr[1]}
|
||||||
val=${arr[2]}
|
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
|
fi
|
||||||
done < $CONFIG
|
done < $WD_CONFIG
|
||||||
}
|
|
||||||
|
|
||||||
wd_print_msg()
|
if [[ $count -eq 0 ]]
|
||||||
{
|
|
||||||
if [[ $1 == "" || $2 == "" ]]
|
|
||||||
then
|
then
|
||||||
print " $RED*$NOC Could not print message. Sorry!"
|
wd_print_msg $WD_BLUE "No warp points to clean, carry on!"
|
||||||
else
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
wd_print_usage()
|
local WD_CONFIG=$HOME/.warprc
|
||||||
{
|
local WD_QUIET=0
|
||||||
print "Usage: wd [add|-a|--add] [rm|-r|--remove] [ls|-l|--list] <point>"
|
local WD_EXIT_CODE=0
|
||||||
print "\nCommands:"
|
local WD_DEBUG=0
|
||||||
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"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
# 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
|
# 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
|
# check if no arguments were given, and that version is not set
|
||||||
if [[ $? -ne 0 || $#* -eq 0 ]]
|
if [[ ($? -ne 0 || $#* -eq 0) && -z $wd_print_version ]]
|
||||||
then
|
then
|
||||||
wd_print_usage
|
wd_print_usage
|
||||||
|
|
||||||
# check if config file is writeable
|
# check if config file is writeable
|
||||||
elif [[ ! -w $CONFIG ]]
|
elif [ ! -w $WD_CONFIG ]
|
||||||
then
|
then
|
||||||
wd_print_msg $RED "\'$CONFIG\' is not writeable."
|
# do nothing
|
||||||
# do nothing => exit
|
|
||||||
# can't run `exit`, as this would exit the executing shell
|
# can't run `exit`, as this would exit the executing shell
|
||||||
# i.e. your terminal
|
wd_exit_fail "\'$WD_CONFIG\' is not writeable."
|
||||||
|
|
||||||
else
|
else
|
||||||
#set -- $args # WTF
|
|
||||||
|
|
||||||
for i
|
# parse rest of options
|
||||||
|
for o
|
||||||
do
|
do
|
||||||
case "$i"
|
case "$o"
|
||||||
in
|
in
|
||||||
-a|--add|add)
|
-a|--add|add)
|
||||||
wd_add false $2
|
wd_add false $2
|
||||||
|
|
@ -186,11 +358,19 @@ else
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
-s|--show|show)
|
-s|--show|show)
|
||||||
wd_show
|
wd_show $2
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
-c|--clean|clean)
|
||||||
|
wd_clean false
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
-c!|--clean!|clean!)
|
||||||
|
wd_clean true
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
wd_warp $i
|
wd_warp $o
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
--)
|
--)
|
||||||
|
|
@ -200,10 +380,29 @@ else
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
## garbage collection
|
## garbage collection
|
||||||
# if not, next time warp will pick up variables from this run
|
# if not, next time warp will pick up variables from this run
|
||||||
# remember, there's no sub shell
|
# 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 args
|
||||||
|
unset points
|
||||||
unset val &> /dev/null # fixes issue #1
|
unset val &> /dev/null # fixes issue #1
|
||||||
|
|
||||||
|
if [[ ! -z $wd_debug_mode ]]
|
||||||
|
then
|
||||||
|
exit $WD_EXIT_CODE
|
||||||
|
else
|
||||||
|
unset wd_debug_mode
|
||||||
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
# web_search from terminal
|
# web_search from terminal
|
||||||
|
|
||||||
function web_search() {
|
function web_search() {
|
||||||
|
|
||||||
# get the open command
|
# get the open command
|
||||||
local open_cmd
|
local open_cmd
|
||||||
if [[ $(uname -s) == 'Darwin' ]]; then
|
if [[ "$OSTYPE" = darwin* ]]; then
|
||||||
open_cmd='open'
|
open_cmd='open'
|
||||||
else
|
else
|
||||||
open_cmd='xdg-open'
|
open_cmd='xdg-open'
|
||||||
|
|
@ -38,8 +37,8 @@ function web_search() {
|
||||||
done
|
done
|
||||||
|
|
||||||
url="${url%?}" # remove the last '+'
|
url="${url%?}" # remove the last '+'
|
||||||
|
nohup $open_cmd "$url"
|
||||||
$open_cmd "$url"
|
rm nohup.out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
105
plugins/wp-cli/README.md
Normal file
105
plugins/wp-cli/README.md
Normal 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.
|
||||||
|
|
||||||
138
plugins/wp-cli/wp-cli.plugin.zsh
Normal file
138
plugins/wp-cli/wp-cli.plugin.zsh
Normal 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'
|
||||||
|
|
@ -16,4 +16,9 @@ function xcsel {
|
||||||
|
|
||||||
alias xcb='xcodebuild'
|
alias xcb='xcodebuild'
|
||||||
alias xcp='xcode-select --print-path'
|
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
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
# reload zshrc
|
# reload zshrc
|
||||||
function src()
|
function src()
|
||||||
{
|
{
|
||||||
|
local cache="$ZSH/cache"
|
||||||
autoload -U compinit zrecompile
|
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
|
zrecompile -p $f && command rm -f $f.zwc.old
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,13 +47,13 @@ ZSH_THEME="robbyrussell"
|
||||||
# Add wisely, as too many plugins slow down shell startup.
|
# Add wisely, as too many plugins slow down shell startup.
|
||||||
plugins=(git)
|
plugins=(git)
|
||||||
|
|
||||||
source $ZSH/oh-my-zsh.sh
|
|
||||||
|
|
||||||
# User configuration
|
# User configuration
|
||||||
|
|
||||||
export PATH=$HOME/bin:/usr/local/bin:$PATH
|
export PATH=$HOME/bin:/usr/local/bin:$PATH
|
||||||
# export MANPATH="/usr/local/man:$MANPATH"
|
# export MANPATH="/usr/local/man:$MANPATH"
|
||||||
|
|
||||||
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
# You may need to manually set your language environment
|
# You may need to manually set your language environment
|
||||||
# export LANG=en_US.UTF-8
|
# export LANG=en_US.UTF-8
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,9 +89,8 @@ function precmd {
|
||||||
|
|
||||||
# Context: user@directory or just directory
|
# Context: user@directory or just directory
|
||||||
prompt_context () {
|
prompt_context () {
|
||||||
local user=`whoami`
|
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
|
||||||
if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
|
echo -n "${PR_RESET}${PR_RED}$USER@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
|
||||||
echo -n "${PR_RESET}${PR_RED}$user@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
|
|
||||||
else
|
else
|
||||||
echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
|
echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,8 @@ prompt_end() {
|
||||||
|
|
||||||
# Context: user@hostname (who am I and where am I)
|
# Context: user@hostname (who am I and where am I)
|
||||||
prompt_context() {
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset
|
||||||
}
|
}
|
||||||
|
|
||||||
function box_name {
|
function box_name {
|
||||||
[ -f ~/.box-name ] && cat ~/.box-name || hostname -s
|
[ -f ~/.box-name ] && cat ~/.box-name || echo $SHORT_HOST || echo $HOST
|
||||||
}
|
}
|
||||||
|
|
||||||
PROMPT='
|
PROMPT='
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ local user="%(!.%{$fg[blue]%}.%{$fg[blue]%})%n%{$reset_color%}"
|
||||||
|
|
||||||
# Hostname part. compressed and colorcoded per host_repr array
|
# Hostname part. compressed and colorcoded per host_repr array
|
||||||
# if not found, regular hostname in default color
|
# 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
|
# Compacted $PWD
|
||||||
local pwd="%{$fg[blue]%}%c%{$reset_color%}"
|
local pwd="%{$fg[blue]%}%c%{$reset_color%}"
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ function prompt_char {
|
||||||
}
|
}
|
||||||
|
|
||||||
function box_name {
|
function box_name {
|
||||||
[ -f ~/.box-name ] && cat ~/.box-name || hostname -s
|
[ -f ~/.box-name ] && cat ~/.box-name || echo $SHORT_HOST || echo $HOST
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ function prompt_char {
|
||||||
}
|
}
|
||||||
|
|
||||||
function box_name {
|
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=''
|
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="╭─%{$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_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}"
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
if [ "$(whoami)" = "root" ]
|
if [ "$USER" = "root" ]
|
||||||
then CARETCOLOR="red"
|
then CARETCOLOR="red"
|
||||||
else CARETCOLOR="blue"
|
else CARETCOLOR="blue"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -11,19 +11,11 @@ git_custom_status() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#RVM and git settings
|
# RVM component of prompt
|
||||||
if [[ -s ~/.rvm/scripts/rvm ]] ; then
|
ZSH_THEME_RVM_PROMPT_PREFIX="%{$fg[red]%}["
|
||||||
RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1'
|
ZSH_THEME_RVM_PROMPT_SUFFIX="]%{$reset_color%}"
|
||||||
else
|
|
||||||
if which rbenv &> /dev/null; then
|
# Combine it all into a final right-side prompt
|
||||||
RPS1='$(git_custom_status)%{$fg[red]%}[`rbenv version | sed -e "s/ (set.*$//"`]%{$reset_color%} $EPS1'
|
RPS1='$(git_custom_status)$(ruby_prompt_info) $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
|
|
||||||
|
|
||||||
PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '
|
PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@ zstyle ':vcs_info:*:prompt:*' check-for-changes true
|
||||||
PR_RST="%{${reset_color}%}"
|
PR_RST="%{${reset_color}%}"
|
||||||
FMT_BRANCH=" on %{$turquoise%}%b%u%c${PR_RST}"
|
FMT_BRANCH=" on %{$turquoise%}%b%u%c${PR_RST}"
|
||||||
FMT_ACTION=" performing a %{$limegreen%}%a${PR_RST}"
|
FMT_ACTION=" performing a %{$limegreen%}%a${PR_RST}"
|
||||||
FMT_UNSTAGED="%{$orange%}●"
|
FMT_UNSTAGED="%{$orange%} ●"
|
||||||
FMT_STAGED="%{$limegreen%}●"
|
FMT_STAGED="%{$limegreen%} ●"
|
||||||
|
|
||||||
zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}"
|
zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}"
|
||||||
zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}"
|
zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}"
|
||||||
|
|
@ -83,7 +83,7 @@ function steeef_precmd {
|
||||||
# check for untracked files or updated submodules, since vcs_info doesn't
|
# check for untracked files or updated submodules, since vcs_info doesn't
|
||||||
if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
|
if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
|
||||||
PR_GIT_UPDATE=1
|
PR_GIT_UPDATE=1
|
||||||
FMT_BRANCH="${PM_RST} on %{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST}"
|
FMT_BRANCH="${PM_RST} on %{$turquoise%}%b%u%c%{$hotpink%} ●${PR_RST}"
|
||||||
else
|
else
|
||||||
FMT_BRANCH="${PM_RST} on %{$turquoise%}%b%u%c${PR_RST}"
|
FMT_BRANCH="${PM_RST} on %{$turquoise%}%b%u%c${PR_RST}"
|
||||||
fi
|
fi
|
||||||
|
|
@ -95,5 +95,4 @@ function steeef_precmd {
|
||||||
}
|
}
|
||||||
add-zsh-hook precmd steeef_precmd
|
add-zsh-hook precmd steeef_precmd
|
||||||
|
|
||||||
PROMPT=$'
|
PROMPT=$'%{$purple%}%n%{$reset_color%} in %{$limegreen%}%~%{$reset_color%}$(ruby_prompt_info " with%{$fg[red]%} " v g "%{$reset_color%}")$vcs_info_msg_0_%{$orange%} λ%{$reset_color%} '
|
||||||
%{$purple%}%n%{$reset_color%} in %{$limegreen%}%~%{$reset_color%}$(rvm-prompt " with%{$fg[red]%} " v g "%{$reset_color%}")$vcs_info_msg_0_%{$orange%} λ%{$reset_color%} '
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# Simple theme based on my old zsh settings.
|
# Simple theme based on my old zsh settings.
|
||||||
|
|
||||||
function get_host {
|
function get_host {
|
||||||
echo '@'`hostname`''
|
echo '@'$HOST
|
||||||
}
|
}
|
||||||
|
|
||||||
PROMPT='> '
|
PROMPT='> '
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ USERNAME_NORMAL_COLOR=$WHITE
|
||||||
USERNAME_ROOT_COLOR=$RED
|
USERNAME_ROOT_COLOR=$RED
|
||||||
HOSTNAME_NORMAL_COLOR=$BLUE
|
HOSTNAME_NORMAL_COLOR=$BLUE
|
||||||
# uncomment next line if you want auto-generated hostname color
|
# uncomment next line if you want auto-generated hostname color
|
||||||
#for i in `hostname`; HOSTNAME_NORMAL_COLOR=$COLOR_ARRAY[$[((#i))%7+1]]
|
#for i in $HOST; HOSTNAME_NORMAL_COLOR=$COLOR_ARRAY[$[((#i))%7+1]]
|
||||||
HOSTNAME_ROOT_COLOR=$RED
|
HOSTNAME_ROOT_COLOR=$RED
|
||||||
HOSTNAME_COLOR=%(!.$HOSTNAME_ROOT_COLOR.$HOSTNAME_NORMAL_COLOR)
|
HOSTNAME_COLOR=%(!.$HOSTNAME_ROOT_COLOR.$HOSTNAME_NORMAL_COLOR)
|
||||||
CURRENT_DIR_COLOR=$CYAN
|
CURRENT_DIR_COLOR=$CYAN
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
|
if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
|
||||||
|
|
||||||
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ prompt_setup_pygmalion(){
|
||||||
base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
|
base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
|
||||||
post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g")
|
post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g")
|
||||||
|
|
||||||
add-zsh-hook precmd prompt_pygmalion_precmd
|
precmd_functions+=(prompt_pygmalion_precmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
prompt_pygmalion_precmd(){
|
prompt_pygmalion_precmd(){
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi
|
if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi
|
||||||
|
|
||||||
local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})"
|
local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@
|
||||||
# git untracked files modification from Brian Carper:
|
# git untracked files modification from Brian Carper:
|
||||||
# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt
|
# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt
|
||||||
|
|
||||||
|
export VIRTUAL_ENV_DISABLE_PROMPT=1
|
||||||
|
|
||||||
function virtualenv_info {
|
function virtualenv_info {
|
||||||
[ $VIRTUAL_ENV ] && echo '('$fg[blue]`basename $VIRTUAL_ENV`%{$reset_color%}') '
|
[ $VIRTUAL_ENV ] && echo '('$fg[blue]`basename $VIRTUAL_ENV`%{$reset_color%}') '
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ Y=$fg_no_bold[yellow]
|
||||||
B=$fg_no_bold[blue]
|
B=$fg_no_bold[blue]
|
||||||
RESET=$reset_color
|
RESET=$reset_color
|
||||||
|
|
||||||
if [ "$(whoami)" = "root" ]; then
|
if [ "$USER" = "root" ]; then
|
||||||
PROMPTCOLOR="%{$R%}" PREFIX="-!-";
|
PROMPTCOLOR="%{$R%}" PREFIX="-!-";
|
||||||
else
|
else
|
||||||
PROMPTCOLOR="" PREFIX="---";
|
PROMPTCOLOR="" PREFIX="---";
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,5 @@
|
||||||
# Grab the current version of ruby in use (via RVM): [ruby-1.8.7]
|
# Grab the current version of ruby in use: [ruby-1.8.7]
|
||||||
if [ -e ~/.rvm/bin/rvm-prompt ]; then
|
JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(ruby_prompt_info)%{$fg[white]%}]%{$reset_color%}"
|
||||||
JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
|
|
||||||
else
|
|
||||||
if which rbenv &> /dev/null; then
|
|
||||||
JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg[white]%}]%{$reset_color%}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Grab the current filepath, use shortcuts: ~/Desktop
|
# Grab the current filepath, use shortcuts: ~/Desktop
|
||||||
# Append the current git branch, if in a git repository
|
# Append the current git branch, if in a git repository
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
# Machine name.
|
# Machine name.
|
||||||
function box_name {
|
function box_name {
|
||||||
[ -f ~/.box-name ] && cat ~/.box-name || hostname
|
[ -f ~/.box-name ] && cat ~/.box-name || echo $HOST
|
||||||
}
|
}
|
||||||
|
|
||||||
# Directory info.
|
# Directory info.
|
||||||
|
|
@ -33,7 +33,7 @@ ${git_info} \
|
||||||
%{$fg[white]%}[%*]
|
%{$fg[white]%}[%*]
|
||||||
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
|
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
|
||||||
|
|
||||||
if [[ "$(whoami)" == "root" ]]; then
|
if [[ "$USER" == "root" ]]; then
|
||||||
PROMPT="
|
PROMPT="
|
||||||
%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
|
%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
|
||||||
%{$bg[yellow]%}%{$fg[cyan]%}%n%{$reset_color%} \
|
%{$bg[yellow]%}%{$fg[cyan]%}%n%{$reset_color%} \
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
#!/bin/sh
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
zmodload zsh/datetime
|
||||||
|
|
||||||
function _current_epoch() {
|
function _current_epoch() {
|
||||||
echo $(($(date +%s) / 60 / 60 / 24))
|
echo $(( $EPOCHSECONDS / 60 / 60 / 24 ))
|
||||||
}
|
}
|
||||||
|
|
||||||
function _update_zsh_update() {
|
function _update_zsh_update() {
|
||||||
|
|
@ -9,7 +11,7 @@ function _update_zsh_update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _upgrade_zsh() {
|
function _upgrade_zsh() {
|
||||||
/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
|
env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
|
||||||
# update the zsh file
|
# update the zsh file
|
||||||
_update_zsh_update
|
_update_zsh_update
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ if [ -d "$ZSH" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "\033[0;34mCloning Oh My Zsh...\033[0m"
|
echo "\033[0;34mCloning Oh My Zsh...\033[0m"
|
||||||
hash git >/dev/null 2>&1 && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
|
hash git >/dev/null 2>&1 && env git clone https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
|
||||||
echo "git not installed"
|
echo "git not installed"
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
@ -32,8 +32,10 @@ sed -i -e "/export PATH=/ c\\
|
||||||
export PATH=\"$PATH\"
|
export PATH=\"$PATH\"
|
||||||
" ~/.zshrc
|
" ~/.zshrc
|
||||||
|
|
||||||
echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
|
if [ "$SHELL" != "$(which zsh)" ]; then
|
||||||
chsh -s `which zsh`
|
echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
|
||||||
|
chsh -s `which zsh`
|
||||||
|
fi
|
||||||
|
|
||||||
echo "\033[0;32m"' __ __ '"\033[0m"
|
echo "\033[0;32m"' __ __ '"\033[0m"
|
||||||
echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"
|
echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"
|
||||||
|
|
@ -43,5 +45,6 @@ echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m
|
||||||
echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m"
|
echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m"
|
||||||
echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m"
|
echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m"
|
||||||
echo "\n\n \033[0;32mp.s. Follow us at http://twitter.com/ohmyzsh.\033[0m"
|
echo "\n\n \033[0;32mp.s. Follow us at http://twitter.com/ohmyzsh.\033[0m"
|
||||||
/usr/bin/env zsh
|
echo "\n\n \033[0;32mp.p.s. Get stickers and t-shirts at http://shop.planetargon.com.\033[0m"
|
||||||
|
env zsh
|
||||||
. ~/.zshrc
|
. ~/.zshrc
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ then
|
||||||
printf '\033[0;32m%s\033[0m\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
|
printf '\033[0;32m%s\033[0m\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
|
||||||
printf '\033[0;32m%s\033[0m\n' ' /____/ '
|
printf '\033[0;32m%s\033[0m\n' ' /____/ '
|
||||||
printf '\033[0;34m%s\033[0m\n' 'Hooray! Oh My Zsh has been updated and/or is at the current version.'
|
printf '\033[0;34m%s\033[0m\n' 'Hooray! Oh My Zsh has been updated and/or is at the current version.'
|
||||||
printf '\033[0;34m%s\033[1m%s\033[0m\n' 'To keep up on the latest, be sure to follow Oh My Zsh on twitter: ' 'http://twitter.com/ohmyzsh'
|
printf '\033[0;34m%s\033[1m%s\033[0m\n' 'To keep up on the latest news and updates, follow us on twitter: ' 'http://twitter.com/ohmyzsh'
|
||||||
|
printf '\033[0;34m%s\033[1m%s\033[0m\n' 'Get your Oh My Zsh swag at: ' 'http://shop.planetargon.com/'
|
||||||
else
|
else
|
||||||
printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?'
|
printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue