mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-13 03:01:32 +01:00
merge a lot of updates from upstream
This commit is contained in:
commit
c97cd389b7
25 changed files with 1437 additions and 59 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -1,8 +1,8 @@
|
|||
locals.zsh
|
||||
log/.zsh_history
|
||||
projects.zsh
|
||||
custom/*
|
||||
!custom/example
|
||||
custom
|
||||
!custom/plugins/example
|
||||
!custom/example.zsh
|
||||
*.swp
|
||||
!custom/example.zshcache
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ If you installed manually or changed the install location, check ZSH in ~/.zshrc
|
|||
|
||||
h2. Usage
|
||||
|
||||
* enable the plugins you want in your @~/.zshrc@ (take a look at @plugins/@ to see what's possible)
|
||||
* enable the plugins you want in your @~/.zshrc@ (take a look at the @plugins/@ directory and the "wiki":https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins to see what's possible)
|
||||
** example: @plugins=(git osx ruby)@
|
||||
* Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@.
|
||||
** Take a look at the "current themes":https://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with _Oh My Zsh_.
|
||||
|
|
|
|||
11
lib/grep.zsh
11
lib/grep.zsh
|
|
@ -2,5 +2,12 @@
|
|||
# Color grep results
|
||||
# Examples: http://rubyurl.com/ZXv
|
||||
#
|
||||
export GREP_OPTIONS='--color=auto'
|
||||
export GREP_COLOR='1;32'
|
||||
|
||||
# avoid VCS folders
|
||||
GREP_OPTIONS=
|
||||
for PATTERN in .cvs .git .hg .svn; do
|
||||
GREP_OPTIONS+="--exclude-dir=$PATTERN "
|
||||
done
|
||||
GREP_OPTIONS+="--color=auto"
|
||||
export GREP_OPTIONS="$GREP_OPTIONS"
|
||||
export GREP_COLOR='1;32'
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ fi
|
|||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
|
||||
setopt append_history
|
||||
setopt extended_history
|
||||
setopt hist_expire_dups_first
|
||||
setopt hist_ignore_dups # ignore duplication command history list
|
||||
|
|
|
|||
|
|
@ -15,29 +15,49 @@ if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
|
|||
zle -N zle-line-finish
|
||||
fi
|
||||
|
||||
bindkey -e # Use emacs key bindings
|
||||
bindkey -e # Use emacs key bindings
|
||||
|
||||
bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark
|
||||
bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls
|
||||
bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line.
|
||||
bindkey "${terminfo[kpp]}" up-line-or-history # [PageUp] - Up a line of history
|
||||
bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history
|
||||
bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark
|
||||
bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls
|
||||
bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line.
|
||||
if [[ "${terminfo[kpp]}" != "" ]]; then
|
||||
bindkey "${terminfo[kpp]}" up-line-or-history # [PageUp] - Up a line of history
|
||||
fi
|
||||
if [[ "${terminfo[knp]}" != "" ]]; then
|
||||
bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history
|
||||
fi
|
||||
|
||||
bindkey "${terminfo[kcuu1]}" up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward
|
||||
bindkey "${terminfo[kcud1]}" down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward
|
||||
if [[ "${terminfo[kcuu1]}" != "" ]]; then
|
||||
bindkey "${terminfo[kcuu1]}" up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward
|
||||
fi
|
||||
if [[ "${terminfo[kcud1]}" != "" ]]; then
|
||||
bindkey "${terminfo[kcud1]}" down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward
|
||||
fi
|
||||
|
||||
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
|
||||
bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
|
||||
if [[ "${terminfo[khome]}" != "" ]]; then
|
||||
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
|
||||
fi
|
||||
if [[ "${terminfo[kend]}" != "" ]]; then
|
||||
bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
|
||||
fi
|
||||
|
||||
bindkey ' ' magic-space # [Space] - do history expansion
|
||||
bindkey ' ' magic-space # [Space] - do history expansion
|
||||
|
||||
bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word
|
||||
bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word
|
||||
bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word
|
||||
bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word
|
||||
|
||||
bindkey "${terminfo[kcbt]}" reverse-menu-complete # [Shift-Tab] - move through the completion menu backwards
|
||||
if [[ "${terminfo[kdch1]}" != "" ]]; then
|
||||
bindkey "${terminfo[kdch1]}" reverse-menu-complete # [Shift-Tab] - move through the completion menu backwards
|
||||
fi
|
||||
|
||||
bindkey '^?' backward-delete-char # [Backspace] - delete backward
|
||||
bindkey "${terminfo[kdch1]}" delete-char # [Delete] - delete forward
|
||||
bindkey '^?' backward-delete-char # [Backspace] - delete backward
|
||||
if [[ "${terminfo[kdch1]}" != "" ]]; then
|
||||
bindkey "${terminfo[kdch1]}" delete-char # [Delete] - delete forward
|
||||
else
|
||||
bindkey "^[[3~" delete-char
|
||||
bindkey "^[3;5~" delete-char
|
||||
bindkey "\e[3~" delete-char
|
||||
fi
|
||||
|
||||
# Edit the current command line in $EDITOR
|
||||
autoload -U edit-command-line
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ if [[ $(uname) == "Darwin" ]] ; then
|
|||
function plugged_in() {
|
||||
[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ Yes') -eq 1 ]
|
||||
}
|
||||
|
||||
|
||||
function battery_pct_remaining() {
|
||||
if plugged_in ; then
|
||||
echo "External Power"
|
||||
|
|
@ -31,7 +31,7 @@ if [[ $(uname) == "Darwin" ]] ; then
|
|||
}
|
||||
|
||||
function battery_time_remaining() {
|
||||
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
|
||||
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
|
||||
if [[ $(echo $smart_battery_status | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
|
||||
timeremaining=$(echo $smart_battery_status | grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
|
||||
if [ $timeremaining -gt 720 ] ; then
|
||||
|
|
@ -59,9 +59,9 @@ if [[ $(uname) == "Darwin" ]] ; then
|
|||
echo "∞"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function battery_is_charging() {
|
||||
[[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]]
|
||||
[[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]]
|
||||
}
|
||||
|
||||
elif [[ $(uname) == "Linux" ]] ; then
|
||||
|
|
@ -71,7 +71,9 @@ elif [[ $(uname) == "Linux" ]] ; then
|
|||
}
|
||||
|
||||
function battery_pct() {
|
||||
echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')"
|
||||
if (( $+commands[acpi] )) ; then
|
||||
echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')"
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_pct_remaining() {
|
||||
|
|
@ -103,7 +105,7 @@ elif [[ $(uname) == "Linux" ]] ; then
|
|||
echo "∞"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
# Empty functions so we don't cause errors in prompts
|
||||
function battery_pct_remaining() {
|
||||
|
|
@ -136,7 +138,7 @@ function battery_level_gauge() {
|
|||
if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then
|
||||
local filled=$(((( $battery_remaining_percentage + $gauge_slots - 1) / $gauge_slots)));
|
||||
local empty=$(($gauge_slots - $filled));
|
||||
|
||||
|
||||
if [[ $filled -gt $green_threshold ]]; then local gauge_color=$color_green;
|
||||
elif [[ $filled -gt $yellow_threshold ]]; then local gauge_color=$color_yellow;
|
||||
else local gauge_color=$color_red;
|
||||
|
|
@ -144,10 +146,9 @@ function battery_level_gauge() {
|
|||
else
|
||||
local filled=$gauge_slots;
|
||||
local empty=0;
|
||||
filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'};
|
||||
filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'};
|
||||
fi
|
||||
|
||||
|
||||
local charging=' ' && battery_is_charging && charging=$charging_symbol;
|
||||
|
||||
printf ${charging_color//\%/\%\%}$charging${color_reset//\%/\%\%}${battery_prefix//\%/\%\%}${gauge_color//\%/\%\%}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ alias bu="bundle update"
|
|||
|
||||
# The following is based on https://github.com/gma/bundler-exec
|
||||
|
||||
bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard jekyll kitchen knife mailcatcher middleman nanoc rackup rainbows rake rspec ruby shotgun spec spin spork strainer tailor taps thin thor unicorn unicorn_rails puma)
|
||||
bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard irb jekyll kitchen knife mailcatcher middleman nanoc puma rackup rainbows rake rspec ruby shotgun spec spin spork strainer tailor taps thin thor unicorn unicorn_rails)
|
||||
|
||||
# Remove $UNBUNDLED_COMMANDS from the bundled_commands list
|
||||
for cmd in $UNBUNDLED_COMMANDS; do
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ case $state in
|
|||
cmds=(
|
||||
"version:Prints Gas's version"
|
||||
"use:Uses author"
|
||||
"ssh:Creates a new ssh key for an existing gas author"
|
||||
"show:Shows your current user"
|
||||
"list:Lists your authors"
|
||||
"import:Imports current user to gasconfig"
|
||||
|
|
@ -25,8 +26,12 @@ case $state in
|
|||
args)
|
||||
case $line[1] in
|
||||
(use|delete)
|
||||
_values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0
|
||||
;;
|
||||
VERSION=$(gas -v)
|
||||
if [[ $VERSION == <1->.*.* ]] || [[ $VERSION == 0.<2->.* ]] || [[ $VERSION == 0.1.<6-> ]] then
|
||||
_values -S , 'authors' $(cat ~/.gas/gas.authors | sed -n -e 's/^.*\[\(.*\)\]/\1/p') && ret=0
|
||||
else
|
||||
_values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0
|
||||
fi
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -56,6 +56,9 @@ if (( CURRENT == 1 )); then
|
|||
fi
|
||||
|
||||
case "$words[1]" in
|
||||
build)
|
||||
_files -g "*.gemspec"
|
||||
;;
|
||||
list)
|
||||
if [[ "$state" == forms ]]; then
|
||||
_gem_installed
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ function work_in_progress() {
|
|||
fi
|
||||
}
|
||||
# these alias commit and uncomit wip branches
|
||||
alias gwip='git add -A; git ls-files --deleted -z | xargs -0 git rm; git commit -m "--wip--"'
|
||||
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'
|
||||
|
||||
# these alias ignore changes to file
|
||||
|
|
|
|||
1150
plugins/glassfish/_asadmin
Normal file
1150
plugins/glassfish/_asadmin
Normal file
File diff suppressed because it is too large
Load diff
3
plugins/glassfish/glassfish.plugin.zsh
Normal file
3
plugins/glassfish/glassfish.plugin.zsh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# if there is a user named 'glassfish' on the system, we'll assume
|
||||
# that is the user asadmin should be run as
|
||||
# grep -e '^glassfish' /etc/passwd > /dev/null && alias asadmin='sudo -u glassfish asadmin'
|
||||
|
|
@ -59,6 +59,7 @@ case "$words[1]" in
|
|||
_arguments \
|
||||
'(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' \
|
||||
'(-f --find-links)'{-f,--find-links}'[URL for finding packages]' \
|
||||
'(-r --requirement)'{-r,--requirement}'[Requirements file for packages to install]:File:_files' \
|
||||
'(--no-deps --no-dependencies)'{--no-deps,--no-dependencies}'[iIgnore package dependencies]' \
|
||||
'(--no-install)--no-install[only download packages]' \
|
||||
'(--no-download)--no-download[only install downloaded packages]' \
|
||||
|
|
|
|||
|
|
@ -8,18 +8,18 @@
|
|||
# Supports command completion.
|
||||
#
|
||||
# If you are not already using completion you might need to enable it with
|
||||
#
|
||||
#
|
||||
# autoload -U compinit compinit
|
||||
#
|
||||
# Changes:
|
||||
#
|
||||
# Defaults to the current application, and will walk up the tree to find
|
||||
# Defaults to the current application, and will walk up the tree to find
|
||||
# a config.ru file and restart the corresponding app
|
||||
#
|
||||
# Will Detect if a app does not exist in pow and print a (slightly) helpful
|
||||
# Will Detect if a app does not exist in pow and print a (slightly) helpful
|
||||
# error message
|
||||
|
||||
rack_root_detect(){
|
||||
rack_root(){
|
||||
setopt chaselinks
|
||||
local orgdir=$(pwd)
|
||||
local basedir=$(pwd)
|
||||
|
|
@ -32,6 +32,11 @@ rack_root_detect(){
|
|||
|
||||
builtin cd $orgdir 2>/dev/null
|
||||
[[ ${basedir} == "/" ]] && return 1
|
||||
echo $basedir
|
||||
}
|
||||
|
||||
rack_root_detect(){
|
||||
basedir=$(rack_root)
|
||||
echo `basename $basedir | sed -E "s/.(com|net|org)//"`
|
||||
}
|
||||
|
||||
|
|
@ -51,16 +56,30 @@ kapow(){
|
|||
compctl -W ~/.pow -/ kapow
|
||||
|
||||
powit(){
|
||||
local basedir=$(pwd)
|
||||
local basedir=$(pwd)
|
||||
local vhost=$1
|
||||
[ ! -n "$vhost" ] && vhost=$(rack_root_detect)
|
||||
if [ ! -h ~/.pow/$vhost ]
|
||||
then
|
||||
echo "pow: Symlinking your app with pow. ${vhost}"
|
||||
[ ! -d ~/.pow/${vhost} ] && ln -s $basedir ~/.pow/$vhost
|
||||
then
|
||||
echo "pow: Symlinking your app with pow. ${vhost}"
|
||||
[ ! -d ~/.pow/${vhost} ] && ln -s $basedir ~/.pow/$vhost
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
powed(){
|
||||
local basedir=$(rack_root)
|
||||
find ~/.pow/ -type l -lname "*$basedir*" -exec basename {}'.dev' \;
|
||||
}
|
||||
|
||||
# Restart pow process
|
||||
# taken from http://www.matthewratzloff.com/blog/2011/12/23/restarting-pow-when-dns-stops-responding
|
||||
repow(){
|
||||
lsof | grep 20560 | awk '{print $2}' | xargs kill -9
|
||||
launchctl unload ~/Library/LaunchAgents/cx.pow.powd.plist
|
||||
launchctl load ~/Library/LaunchAgents/cx.pow.powd.plist
|
||||
echo "restarted pow"
|
||||
}
|
||||
|
||||
# View the standard out (puts) from any pow app
|
||||
alias kaput="tail -f ~/Library/Logs/Pow/apps/*"
|
||||
alias kaput="tail -f ~/Library/Logs/Pow/apps/*"
|
||||
|
|
@ -10,9 +10,6 @@ FOUND_RBENV=0
|
|||
rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv")
|
||||
if _homebrew-installed && _rbenv-from-homebrew-installed ; then
|
||||
rbenvdirs=($(brew --prefix rbenv) "${rbenvdirs[@]}")
|
||||
if [[ $RBENV_ROOT = '' ]]; then
|
||||
RBENV_ROOT="$HOME/.rbenv"
|
||||
fi
|
||||
fi
|
||||
|
||||
for rbenvdir in "${rbenvdirs[@]}" ; do
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ __task_list ()
|
|||
|
||||
__box_list ()
|
||||
{
|
||||
_wanted application expl 'command' compadd $(command ls -1 $HOME/.vagrant/boxes 2>/dev/null| sed -e 's/ /\\ /g')
|
||||
_wanted application expl 'command' compadd $(command vagrant box list | sed -e 's/ /\\ /g')
|
||||
}
|
||||
|
||||
__vm_list ()
|
||||
|
|
|
|||
|
|
@ -17,9 +17,15 @@ function zle-keymap-select zle-line-init zle-line-finish {
|
|||
zle -N zle-line-init
|
||||
zle -N zle-line-finish
|
||||
zle -N zle-keymap-select
|
||||
zle -N edit-command-line
|
||||
|
||||
|
||||
bindkey -v
|
||||
|
||||
# allow v to edit the command line (standard behaviour)
|
||||
autoload -Uz edit-command-line
|
||||
bindkey -M vicmd 'v' edit-command-line
|
||||
|
||||
# if mode indicator wasn't setup by theme, define default
|
||||
if [[ "$MODE_INDICATOR" == "" ]]; then
|
||||
MODE_INDICATOR="%{$fg_bold[red]%}<%{$fg[red]%}<<%{$reset_color%}"
|
||||
|
|
|
|||
82
plugins/vim-interaction/README.md
Normal file
82
plugins/vim-interaction/README.md
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
# Vim Interaction #
|
||||
|
||||
The plugin presents a function called `callvim` whose usage is:
|
||||
|
||||
usage: callvim [-b cmd] [-a cmd] [file ... fileN]
|
||||
|
||||
-b cmd Run this command in GVIM before editing the first file
|
||||
-a cmd Run this command in GVIM after editing the first file
|
||||
file The file to edit
|
||||
... fileN The other files to add to the argslist
|
||||
|
||||
## Rationale ##
|
||||
|
||||
The idea for this script is to give you some decent interaction with a running
|
||||
GVim session. Normally you'll be running around your filesystem doing any
|
||||
number of amazing things and you'll need to load some files into GVim for
|
||||
editing, inspecting, destruction, or other bits of mayhem. This script lets you
|
||||
do that.
|
||||
|
||||
## Aliases ##
|
||||
|
||||
There are a few aliases presented as well:
|
||||
|
||||
* `v` A shorthand for `callvim`
|
||||
* `vvsp` Edits the passed in file but first makes a vertical split
|
||||
* `vhsp` Edits the passed in file but first makes a horizontal split
|
||||
|
||||
## Post Callout ##
|
||||
|
||||
At the end of the `callvim` function we invoke the `postCallVim` function if it
|
||||
exists. If you're using MacVim, for example, you could define a function that
|
||||
brings window focus to it after the file is loaded:
|
||||
|
||||
function postCallVim
|
||||
{
|
||||
osascript -e 'tell application "MacVim" to activate'
|
||||
}
|
||||
|
||||
This'll be different depending on your OS / Window Manager.
|
||||
|
||||
## Examples ##
|
||||
|
||||
This will load `/tmp/myfile.scala` into the running GVim session:
|
||||
|
||||
> v /tmp/myfile.scala
|
||||
|
||||
This will load it after first doing a vertical split:
|
||||
|
||||
> vvsp /tmp/myfile.scala
|
||||
or
|
||||
> v -b':vsp' /tmp/myfile.scala
|
||||
|
||||
This will load it after doing a horizontal split, then moving to the bottom of
|
||||
the file:
|
||||
|
||||
> vhsp -aG /tmp/myfile.scala
|
||||
or
|
||||
> v -b':sp' -aG /tmp/myfile.scala
|
||||
|
||||
This will load the file and then copy the first line to the end (Why you would
|
||||
ever want to do this... I dunno):
|
||||
|
||||
> v -a':1t$' /tmp/myfile.scala
|
||||
|
||||
And this will load all of the `*.txt` files into the args list:
|
||||
|
||||
> v *.txt
|
||||
|
||||
If you want to load files into areas that are already split, use one of the
|
||||
aliases for that:
|
||||
|
||||
# Do a ':wincmd h' first
|
||||
> vh /tmp/myfile.scala
|
||||
|
||||
# Do a ':wincmd j' first
|
||||
> vj /tmp/myfile.scala
|
||||
|
||||
# Do a ':wincmd k' first
|
||||
> vk /tmp/myfile.scala
|
||||
|
||||
# Do a ':wincmd l' first
|
||||
> vl /tmp/myfile.scala
|
||||
72
plugins/vim-interaction/vim-interaction.plugin.zsh
Normal file
72
plugins/vim-interaction/vim-interaction.plugin.zsh
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
#
|
||||
# See README.md
|
||||
#
|
||||
# Derek Wyatt (derek@{myfirstnamemylastname}.org
|
||||
#
|
||||
|
||||
function resolveFile
|
||||
{
|
||||
if [ -f "$1" ]; then
|
||||
echo $(readlink -f "$1")
|
||||
elif [[ "${1#/}" == "$1" ]]; then
|
||||
echo "$(pwd)/$1"
|
||||
else
|
||||
echo $1
|
||||
fi
|
||||
}
|
||||
|
||||
function callvim
|
||||
{
|
||||
if [[ $# == 0 ]]; then
|
||||
cat <<EOH
|
||||
usage: callvim [-b cmd] [-a cmd] [file ... fileN]
|
||||
|
||||
-b cmd Run this command in GVIM before editing the first file
|
||||
-a cmd Run this command in GVIM after editing the first file
|
||||
file The file to edit
|
||||
... fileN The other files to add to the argslist
|
||||
EOH
|
||||
return 0
|
||||
fi
|
||||
|
||||
local cmd=""
|
||||
local before="<esc>"
|
||||
local after=""
|
||||
while getopts ":b:a:" option
|
||||
do
|
||||
case $option in
|
||||
a) after="$OPTARG"
|
||||
;;
|
||||
b) before="$OPTARG"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
if [[ ${after#:} != $after && ${after%<cr>} == $after ]]; then
|
||||
after="$after<cr>"
|
||||
fi
|
||||
if [[ ${before#:} != $before && ${before%<cr>} == $before ]]; then
|
||||
before="$before<cr>"
|
||||
fi
|
||||
local files=""
|
||||
for f in $@
|
||||
do
|
||||
files="$files $(resolveFile $f)"
|
||||
done
|
||||
if [[ -n $files ]]; then
|
||||
files=':args! '"$files<cr>"
|
||||
fi
|
||||
cmd="$before$files$after"
|
||||
gvim --remote-send "$cmd"
|
||||
if typeset -f postCallVim > /dev/null; then
|
||||
postCallVim
|
||||
fi
|
||||
}
|
||||
|
||||
alias v=callvim
|
||||
alias vvsp="callvim -b':vsp'"
|
||||
alias vhsp="callvim -b':sp'"
|
||||
alias vk="callvim -b':wincmd k'"
|
||||
alias vj="callvim -b':wincmd j'"
|
||||
alias vl="callvim -b':wincmd l'"
|
||||
alias vh="callvim -b':wincmd h'"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
virtualenvwrapper='virtualenvwrapper_lazy.sh'
|
||||
virtualenvwrapper='virtualenvwrapper.sh'
|
||||
if (( $+commands[$virtualenvwrapper] )); then
|
||||
source ${${virtualenvwrapper}:c}
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ if (( $+commands[$virtualenvwrapper] )); then
|
|||
# Check for virtualenv name override
|
||||
if [[ -f "$PROJECT_ROOT/.venv" ]]; then
|
||||
ENV_NAME=`cat "$PROJECT_ROOT/.venv"`
|
||||
elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]];then
|
||||
elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]];then
|
||||
ENV_NAME="$PROJECT_ROOT/.venv"
|
||||
elif [[ "$PROJECT_ROOT" != "." ]]; then
|
||||
ENV_NAME=`basename "$PROJECT_ROOT"`
|
||||
|
|
|
|||
13
plugins/zsh_reload/zsh_reload.plugin.zsh
Normal file
13
plugins/zsh_reload/zsh_reload.plugin.zsh
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
zsh_cache=$HOME/.zsh_cache
|
||||
mkdir -p $zsh_cache
|
||||
|
||||
# reload zshrc
|
||||
function src()
|
||||
{
|
||||
autoload -U compinit zrecompile
|
||||
compinit -d $zsh_cache/zcomp-$HOST
|
||||
for f in $HOME/.zshrc $zsh_cache/zcomp-$HOST; do
|
||||
zrecompile -p $f && rm -f $f.zwc.old
|
||||
done
|
||||
source ~/.zshrc
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
# Path to your oh-my-zsh configuration.
|
||||
ZSH=$HOME/.oh-my-zsh
|
||||
export ZSH=$HOME/.oh-my-zsh
|
||||
|
||||
# Set name of the theme to load.
|
||||
# Look in ~/.oh-my-zsh/themes/
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ else
|
|||
if which rbenv &> /dev/null; then
|
||||
RPS1='$(git_custom_status)%{$fg[red]%}[`rbenv version | sed -e "s/ (set.*$//"`]%{$reset_color%} $EPS1'
|
||||
else
|
||||
if which chruby_prompt_info &> /dev/null; then
|
||||
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'
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ autoload -U colors zsh/terminfo # Used in the colour alias below
|
|||
colors
|
||||
setopt prompt_subst
|
||||
|
||||
# make some aliases for the colours: (coud use normal escap.seq's too)
|
||||
# make some aliases for the colours: (could use normal escape sequences too)
|
||||
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
|
||||
eval PR_$color='%{$fg[${(L)color}]%}'
|
||||
done
|
||||
|
|
@ -25,7 +25,7 @@ elif [[ $UID -eq 0 ]]; then # root
|
|||
fi
|
||||
|
||||
# Check if we are on SSH or not
|
||||
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
|
||||
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
|
||||
eval PR_HOST='${PR_YELLOW}%M${PR_NO_COLOR}' #SSH
|
||||
else
|
||||
eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' # no SSH
|
||||
|
|
@ -36,12 +36,12 @@ local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
|
|||
local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}'
|
||||
local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}'
|
||||
local rvm_ruby=''
|
||||
if which rvm-prompt &> /dev/null; then
|
||||
if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect local user rvm installation
|
||||
rvm_ruby='%{$PR_RED%}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%{$PR_NO_COLOR%}'
|
||||
elif which rvm-prompt &> /dev/null; then # detect sysem-wide rvm installation
|
||||
rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}'
|
||||
else
|
||||
if which rbenv &> /dev/null; then
|
||||
rvm_ruby='%{$PR_RED%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$PR_NO_COLOR%}'
|
||||
fi
|
||||
elif which rbenv &> /dev/null; then # detect Simple Ruby Version management
|
||||
rvm_ruby='%{$PR_RED%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$PR_NO_COLOR%}'
|
||||
fi
|
||||
local git_branch='$(git_prompt_info)%{$PR_NO_COLOR%}'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue