mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Merge branch 'plugin-git' into merge
Conflicts: custom/aliases.zsh plugins/git/git-aliases.plugin.zsh plugins/git/git-prompt-old.plugin.zsh plugins/git/git-prompt.plugin.zsh plugins/git/git.plugin.zsh themes/ashleydev.zsh-theme
This commit is contained in:
commit
415bdbfe6d
135 changed files with 2170 additions and 1523 deletions
26
plugins/ant/ant.plugin.zsh
Normal file
26
plugins/ant/ant.plugin.zsh
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
stat -f%m . > /dev/null 2>&1
|
||||
if [ "$?" = 0 ]; then
|
||||
stat_cmd=(stat -f%m)
|
||||
else
|
||||
stat_cmd=(stat -L --format=%y)
|
||||
fi
|
||||
|
||||
_ant_does_target_list_need_generating () {
|
||||
if [ ! -f .ant_targets ]; then return 0;
|
||||
else
|
||||
accurate=$($stat_cmd -f%m .ant_targets)
|
||||
changed=$($stat_cmd -f%m build.xml)
|
||||
return $(expr $accurate '>=' $changed)
|
||||
fi
|
||||
}
|
||||
|
||||
_ant () {
|
||||
if [ -f build.xml ]; then
|
||||
if _ant_does_target_list_need_generating; then
|
||||
sed -n '/<target/s/<target.*name="\([^"]*\).*$/\1/p' build.xml > .ant_targets
|
||||
fi
|
||||
compadd `cat .ant_targets`
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _ant ant
|
||||
3
plugins/autojump/autojump.plugin.zsh
Normal file
3
plugins/autojump/autojump.plugin.zsh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
if [ -f `brew --prefix`/etc/autojump ]; then
|
||||
. `brew --prefix`/etc/autojump
|
||||
fi
|
||||
|
|
@ -25,10 +25,12 @@ _1st_arguments=(
|
|||
'link:link a formula'
|
||||
'list:list files in a formula or not-installed formulae'
|
||||
'log:git commit log for a formula'
|
||||
'missing:check all installed formuale for missing dependencies.'
|
||||
'outdated:list formulas for which a newer version is available'
|
||||
'prune:remove dead links'
|
||||
'remove:remove a formula'
|
||||
'search:search for a formula (/regex/ or string)'
|
||||
'server:start a local web app that lets you browse formulae (requires Sinatra)'
|
||||
'unlink:unlink a formula'
|
||||
'update:freshen up links'
|
||||
'upgrade:upgrade outdated formulae'
|
||||
|
|
@ -36,10 +38,14 @@ _1st_arguments=(
|
|||
)
|
||||
|
||||
local expl
|
||||
local -a formula installed_formulae
|
||||
local -a formulae installed_formulae
|
||||
|
||||
_arguments \
|
||||
'(-v --verbose)'{-v,--verbose}'[verbose]' \
|
||||
'(-v)-v[verbose]' \
|
||||
'(--cellar)--cellar[brew cellar]' \
|
||||
'(--config)--config[brew configuration]' \
|
||||
'(--env)--env[brew environment]' \
|
||||
'(--repository)--repository[brew repository]' \
|
||||
'(--version)--version[version information]' \
|
||||
'(--prefix)--prefix[where brew lives on this system]' \
|
||||
'(--cache)--cache[brew cache]' \
|
||||
|
|
@ -51,20 +57,24 @@ if (( CURRENT == 1 )); then
|
|||
fi
|
||||
|
||||
case "$words[1]" in
|
||||
list)
|
||||
search|-S)
|
||||
_arguments \
|
||||
'(--macports)--macports[search the macports repository]' \
|
||||
'(--fink)--fink[search the fink repository]' ;;
|
||||
list|ls)
|
||||
_arguments \
|
||||
'(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
|
||||
'(--versions)--versions[list all installed versions of a formula]' \
|
||||
'1: :->forms' && return 0
|
||||
|
||||
if [[ "$state" == forms ]]; then
|
||||
_brew_installed_formulae
|
||||
_requested installed_formulae expl 'installed formulae' compadd -a installed_formulae
|
||||
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
|
||||
fi ;;
|
||||
install|home|log|info|uses|cat|deps)
|
||||
install|home|homepage|log|info|abv|uses|cat|deps|edit|options)
|
||||
_brew_all_formulae
|
||||
_wanted formulae expl 'all formulae' compadd -a formulae ;;
|
||||
remove|edit|xo)
|
||||
remove|rm|uninstall|unlink|cleanup|link|ln)
|
||||
_brew_installed_formulae
|
||||
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
|
||||
esac
|
||||
|
||||
|
|
|
|||
|
|
@ -18,4 +18,4 @@ function _cap () {
|
|||
fi
|
||||
}
|
||||
|
||||
compctl -K _cap cap
|
||||
compctl -K _cap cap
|
||||
|
|
|
|||
|
|
@ -5,10 +5,9 @@
|
|||
# VERSION: 1.0.0
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
if (( ${+commands[compleat]} )); then
|
||||
local prefix="${commands[compleat]:h:h}"
|
||||
local setup="${prefix}/share/compleat-1.0/compleat_setup"
|
||||
local setup="${prefix}/share/compleat-1.0/compleat_setup"
|
||||
|
||||
if [[ -f "$setup" ]]; then
|
||||
if ! bashcompinit >/dev/null 2>&1; then
|
||||
|
|
@ -16,7 +15,6 @@ if (( ${+commands[compleat]} )); then
|
|||
bashcompinit -i
|
||||
fi
|
||||
|
||||
source "$setup"
|
||||
source "$setup"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/zsh
|
||||
#
|
||||
#
|
||||
# Make the dirstack more persistant
|
||||
#
|
||||
#
|
||||
# Add dirpersist to $plugins in ~/.zshrc to load
|
||||
#
|
||||
#
|
||||
|
||||
# $zdirstore is the file used to persist the stack
|
||||
zdirstore=~/.zdirstore
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ function extract() {
|
|||
|
||||
remove_archive=1
|
||||
if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then
|
||||
remove_archive=0
|
||||
remove_archive=0
|
||||
shift
|
||||
fi
|
||||
|
||||
|
|
@ -64,10 +64,10 @@ function extract() {
|
|||
cd ..; rm *.tar.gz debian-binary
|
||||
cd ..
|
||||
;;
|
||||
(*)
|
||||
(*)
|
||||
echo "extract: '$1' cannot be extracted" 1>&2
|
||||
success=1
|
||||
;;
|
||||
success=1
|
||||
;;
|
||||
esac
|
||||
|
||||
(( success = $success > 0 ? $success : $? ))
|
||||
|
|
|
|||
|
|
@ -329,4 +329,4 @@ __git_command_successful () {
|
|||
return 0
|
||||
}
|
||||
|
||||
zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'
|
||||
zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ _git-archive () {
|
|||
'--format=-[format of the resulting archive]:archive format:__git_archive_formats' \
|
||||
'(- :)'{-l,--list}'[list available archive formats]' \
|
||||
'(-v --verbose)'{-v,--verbose}'[report progress to stderr]' \
|
||||
'--prefix=-[prepend the given path prefix to to each filename]:path prefix:_directories -r ""' \
|
||||
'--prefix=-[prepend the given path prefix to each filename]:path prefix:_directories -r ""' \
|
||||
'--output=[write archive to argument instead of stdout]:archive:_files' \
|
||||
'--worktree-attributes[look for attributes in .gitattributes in working directory too]' \
|
||||
$backend_args \
|
||||
|
|
@ -258,16 +258,22 @@ _git-branch () {
|
|||
d='-d -D'
|
||||
|
||||
declare -a dependent_creation_args
|
||||
dependent_creation_args=(
|
||||
"($l $m $d): :__git_branch_names"
|
||||
"::start-point:__git_revisions")
|
||||
if (( words[(I)-r] == 0 )); then
|
||||
dependent_creation_args=(
|
||||
"($l $m $d): :__git_branch_names"
|
||||
"::start-point:__git_revisions")
|
||||
fi
|
||||
|
||||
declare -a dependent_deletion_args
|
||||
if (( words[(I)-d] || words[(I)-D] )); then
|
||||
dependent_creation_args=
|
||||
dependent_deletion_args=(
|
||||
'-r[delete remote-tracking branches]'
|
||||
'*: :__git_ignore_line_inside_arguments __git_branch_names')
|
||||
'-r[delete only remote-tracking branches]')
|
||||
if (( words[(I)-r] )); then
|
||||
dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_remote_branch_names'
|
||||
else
|
||||
dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_branch_names'
|
||||
fi
|
||||
fi
|
||||
|
||||
declare -a dependent_modification_args
|
||||
|
|
@ -281,7 +287,7 @@ _git-branch () {
|
|||
_arguments -w -S -s \
|
||||
"($c $m $d --no-color :)--color=-[turn on branch coloring]:: :__git_color_whens" \
|
||||
"($c $m $d : --color)--no-color[turn off branch coloring]" \
|
||||
"($c $m $d : -a)-r[list only the remote-tracking branches]" \
|
||||
"($c $m -a)-r[list or delete only remote-tracking branches]" \
|
||||
"($c $m $d : -r)-a[list both remote-tracking branches and local branches]" \
|
||||
"($c $m $d : -v --verbose)"{-v,--verbose}'[show SHA1 and commit subject line for each head]' \
|
||||
"($c $m $d :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \
|
||||
|
|
@ -2941,7 +2947,7 @@ _git-rev-parse () {
|
|||
else
|
||||
# TODO: Parse option specification?
|
||||
_arguments -w -S -s \
|
||||
'(- *)'{-h,--help}'[display usage]'
|
||||
'(- *)'{-h,--help}'[display usage]' \
|
||||
'--keep-dashdash[do not skip first -- option]' \
|
||||
'--stop-at-non-option[stop parsing options at first non-option argument]' \
|
||||
'*:option specification' && ret=0
|
||||
|
|
@ -3958,7 +3964,7 @@ _git-name-rev () {
|
|||
'--refs=[only use refs matching given pattern]: :_guard "?#" "shell pattern"' \
|
||||
'(--stdin :)--all[list all commits reachable from all refs]' \
|
||||
'(--all :)--stdin[read from stdin and append revision-name]' \
|
||||
'--name-only[display only name of commits]'
|
||||
'--name-only[display only name of commits]' \
|
||||
'--no-undefined[die with non-zero return when a reference is undefined]' \
|
||||
'--always[show uniquely abbreviated commit object as fallback]' \
|
||||
'(--stdin --all)*: :__git_commits' && ret=0
|
||||
|
|
@ -4919,7 +4925,7 @@ __git_remote_branch_names () {
|
|||
local expl
|
||||
declare -a branch_names
|
||||
|
||||
branch_names=(${${(f)"$(_call_program remote-branch-refs git for-each-ref --format='%(refname)' refs/remotes 2>/dev/null)"}#refs/remotes/})
|
||||
branch_names=(${${(f)"$(_call_program remote-branch-refs git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}#refs/remotes/})
|
||||
__git_command_successful $pipestatus || return
|
||||
|
||||
_wanted remote-branch-names expl 'remote branch name' compadd $* - $branch_names
|
||||
|
|
@ -5162,7 +5168,7 @@ __git_files_relative () {
|
|||
|
||||
files=()
|
||||
|
||||
# Collapse "//" and "/./" into "/". Strip any remaining "/." and "/".
|
||||
# Collapse “//” and “/./” into “/”. Strip any remaining “/.” and “/”.
|
||||
for file in ${${${${${(0)1}//\/\///}//\/.\///}%/.}%/}; do
|
||||
integer i n
|
||||
(( n = $#file > $#prefix ? $#file : $#prefix ))
|
||||
|
|
@ -5413,6 +5419,10 @@ __git_guard_diff-stat-width () {
|
|||
|
||||
(( $+functions[__git_guard_number] )) ||
|
||||
__git_guard_number () {
|
||||
declare -A opts
|
||||
|
||||
zparseopts -K -D -A opts M: J: V: 1 2 n F: X:
|
||||
|
||||
_guard "[[:digit:]]#" ${1:-number}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Aliases
|
||||
alias g='git' ; compdef g=git
|
||||
# alias g='git' ; compdef g=git
|
||||
alias ga='git add' ; compdef _git ga=git-add
|
||||
alias gaa='git add --all' ; compdef _git gaa=git-add
|
||||
alias gs='git status' ; compdef _git gs=git-status
|
||||
|
|
@ -25,6 +25,7 @@ alias gcount='git shortlog -sn' ; compdef gcount=git
|
|||
alias gcp='git cherry-pick' ; compdef _git gcp=git-cherry-pick
|
||||
alias gm='git merge' ; compdef _git gm=git-merge
|
||||
alias glg='git log --stat --max-count=5'; compdef _git glg=git-log
|
||||
alias gls='git shortlog' ; compdef _git gls=shortlog
|
||||
|
||||
# Git history (pretty)
|
||||
local pretty_format_oneline='--pretty=format:"%C(yellow)%h %C(green)%cd %C(cyan)%an %C(bold cyan)%d%C(reset) %s" --date=short'
|
||||
|
|
|
|||
|
|
@ -1,79 +0,0 @@
|
|||
# Renders the name of the current branch.
|
||||
function git_prompt_info() {
|
||||
local branch=$(git_current_branch)
|
||||
if [[ -n "$branch" ]]; then
|
||||
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${branch}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Gets the current branch.
|
||||
function git_current_branch() {
|
||||
local ref=$(git symbolic-ref HEAD 2> /dev/null)
|
||||
if [[ -n "$ref" ]]; then
|
||||
echo "${ref#refs/heads/}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if the working tree is dirty.
|
||||
function parse_git_dirty() {
|
||||
if [[ -n $(git status -s 2> /dev/null) ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||
else
|
||||
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if there are commits ahead from remote.
|
||||
function git_prompt_ahead() {
|
||||
if $(echo "$(git log origin/$(git_current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||
fi
|
||||
}
|
||||
|
||||
# Formats the prompt string for current git commit short SHA.
|
||||
function git_prompt_short_sha() {
|
||||
local sha=$(git rev-parse --short HEAD 2> /dev/null)
|
||||
if [[ -n "$sha" ]]; then
|
||||
echo "${ZSH_THEME_GIT_PROMPT_SHA_BEFORE}${sha}${ZSH_THEME_GIT_PROMPT_SHA_AFTER}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Formats the prompt string for current git commit long SHA.
|
||||
function git_prompt_long_sha() {
|
||||
local sha=$(git rev-parse HEAD 2> /dev/null)
|
||||
if [[ -n "$sha" ]]; then
|
||||
echo "${ZSH_THEME_GIT_PROMPT_SHA_BEFORE}${sha}${ZSH_THEME_GIT_PROMPT_SHA_AFTER}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Gets the status of the working tree.
|
||||
function git_prompt_status() {
|
||||
local indicators line untracked added modified renamed deleted
|
||||
while IFS=$'\n' read line; do
|
||||
if [[ "$line" =~ '^\?\? ' ]]; then
|
||||
[[ -n $untracked ]] && continue || untracked='yes'
|
||||
indicators="${ZSH_THEME_GIT_PROMPT_UNTRACKED}${indicators}"
|
||||
fi
|
||||
if [[ "$line" =~ '^(((A|M|D|T) )|(AD|AM|AT|MM)) ' ]]; then
|
||||
[[ -n $added ]] && continue || added='yes'
|
||||
indicators="${ZSH_THEME_GIT_PROMPT_ADDED}${indicators}"
|
||||
fi
|
||||
if [[ "$line" =~ '^(( (M|T))|(AM|AT|MM)) ' ]]; then
|
||||
[[ -n $modified ]] && continue || modified='yes'
|
||||
indicators="${ZSH_THEME_GIT_PROMPT_MODIFIED}${indicators}"
|
||||
fi
|
||||
if [[ "$line" =~ '^R ' ]]; then
|
||||
[[ -n $renamed ]] && continue || renamed='yes'
|
||||
indicators="${ZSH_THEME_GIT_PROMPT_RENAMED}${indicators}"
|
||||
fi
|
||||
if [[ "$line" =~ '^( D|AD) ' ]]; then
|
||||
[[ -n $deleted ]] && continue || deleted='yes'
|
||||
indicators="${ZSH_THEME_GIT_PROMPT_DELETED}${indicators}"
|
||||
fi
|
||||
if [[ "$line" =~ '^UU ' ]]; then
|
||||
[[ -n $unmerged ]] && continue || unmerged='yes'
|
||||
indicators="${ZSH_THEME_GIT_PROMPT_UNMERGED}${indicators}"
|
||||
fi
|
||||
done < <(git status --porcelain 2> /dev/null)
|
||||
echo $indicators
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,3 +1,2 @@
|
|||
source $ZSH/plugins/git/git-aliases.plugin.zsh
|
||||
source $ZSH/plugins/git/git-prompt-old.plugin.zsh
|
||||
source $ZSH/plugins/git/git-prompt.plugin.zsh
|
||||
|
|
|
|||
|
|
@ -4,4 +4,3 @@ if [ "$commands[(I)hub]" ]; then
|
|||
# eval `hub alias -s zsh`
|
||||
function git(){hub "$@"}
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
if [[ -x "${commands[gwhoami]}" ]]; then
|
||||
if [[ -x "${commands[gwhoami]}" ]]; then
|
||||
__gnu_utils() {
|
||||
emulate -L zsh
|
||||
local gcmds
|
||||
|
|
@ -14,7 +14,7 @@ if [[ -x "${commands[gwhoami]}" ]]; then
|
|||
local cmd
|
||||
local prefix
|
||||
|
||||
# coreutils
|
||||
# coreutils
|
||||
gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
|
||||
'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
|
||||
'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
|
||||
|
|
@ -35,7 +35,7 @@ if [[ -x "${commands[gwhoami]}" ]]; then
|
|||
for gcmd in "${gcmds[@]}"; do
|
||||
#
|
||||
# This method allows for builtin commands to be primary but it's
|
||||
# lost if hash -r or rehash -f is executed. Thus, those two
|
||||
# lost if hash -r or rehash -f is executed. Thus, those two
|
||||
# functions have to be wrapped.
|
||||
#
|
||||
(( ${+commands[$gcmd]} )) && hash ${gcmd[2,-1]}=${commands[$gcmd]}
|
||||
|
|
|
|||
26
plugins/gpg-agent/gpg-agent.plugin.zsh
Normal file
26
plugins/gpg-agent/gpg-agent.plugin.zsh
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Based on ssh-agent code
|
||||
|
||||
local GPG_ENV=$HOME/.gnupg/gpg-agent.env
|
||||
|
||||
function start_agent {
|
||||
/usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file ${GPG_ENV} > /dev/null
|
||||
chmod 600 ${GPG_ENV}
|
||||
. ${GPG_ENV} > /dev/null
|
||||
}
|
||||
|
||||
# Source GPG agent settings, if applicable
|
||||
if [ -f "${GPG_ENV}" ]; then
|
||||
. ${GPG_ENV} > /dev/null
|
||||
ps -ef | grep ${SSH_AGENT_PID} | grep gpg-agent > /dev/null || {
|
||||
start_agent;
|
||||
}
|
||||
else
|
||||
start_agent;
|
||||
fi
|
||||
|
||||
export GPG_AGENT_INFO
|
||||
export SSH_AUTH_SOCK
|
||||
export SSH_AGENT_PID
|
||||
|
||||
GPG_TTY=$(tty)
|
||||
export GPG_TTY
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#compdef port
|
||||
|
||||
local subcmds
|
||||
local subcmds
|
||||
|
||||
# we cache the list of ports
|
||||
# we shall use some cache policy to avoid problems with new ports
|
||||
|
|
@ -31,8 +31,8 @@ subcmds=(
|
|||
'file'
|
||||
'help'
|
||||
'info'
|
||||
'install'
|
||||
'installed'
|
||||
'install'
|
||||
'installed'
|
||||
'list'
|
||||
'livecheck'
|
||||
'location'
|
||||
|
|
@ -48,7 +48,7 @@ subcmds=(
|
|||
'test'
|
||||
'unarchive'
|
||||
'uninstall'
|
||||
'upgrade'
|
||||
'upgrade'
|
||||
'variants'
|
||||
'version'
|
||||
)
|
||||
|
|
|
|||
5
plugins/node/node.plugin.zsh
Normal file
5
plugins/node/node.plugin.zsh
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Open the node api for your current version to the optional section.
|
||||
# TODO: Make the section part easier to use.
|
||||
function node-docs {
|
||||
open "http://nodejs.org/docs/$(node --version)/api/all.html#$1"
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ EOF
|
|||
}
|
||||
|
||||
function pfd() {
|
||||
osascript 2>/dev/null <<EOF
|
||||
osascript 2>/dev/null <<EOF
|
||||
tell application "Finder"
|
||||
return POSIX path of (target of window 1 as alias)
|
||||
end tell
|
||||
|
|
@ -52,14 +52,14 @@ EOF
|
|||
}
|
||||
|
||||
function pfs() {
|
||||
osascript 2>/dev/null <<EOF
|
||||
osascript 2>/dev/null <<EOF
|
||||
set output to ""
|
||||
tell application "Finder" to set the_selection to selection
|
||||
set item_count to count the_selection
|
||||
repeat with item_index from 1 to count the_selection
|
||||
if item_index is less than item_count then set the_delimiter to "\n"
|
||||
if item_index is item_count then set the_delimiter to ""
|
||||
set output to output & ((item item_index of the_selection as alias)'s POSIX path) & the_delimiter
|
||||
set output to output & ((item item_index of the_selection as alias)'s POSIX path) & the_delimiter
|
||||
end repeat
|
||||
EOF
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ alias latest-perl='curl -s http://www.perl.org/get.html | perl -wlne '\''if (/pe
|
|||
|
||||
# Functions #################################################################
|
||||
|
||||
# newpl - creates a basic Perl script file and opens it with $EDITOR
|
||||
# newpl - creates a basic Perl script file and opens it with $EDITOR
|
||||
newpl () {
|
||||
# set $EDITOR to 'vim' if it is undefined
|
||||
[[ -z $EDITOR ]] && EDITOR=vim
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ _phing_does_target_list_need_generating () {
|
|||
_phing () {
|
||||
if [ -f build.xml ]; then
|
||||
if _phing_does_target_list_need_generating; then
|
||||
echo "\nGenerating .phing_targets..." > /dev/stderr
|
||||
phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets
|
||||
fi
|
||||
compadd `cat .phing_targets`
|
||||
|
|
|
|||
10
plugins/pow/pow.plugin.zsh
Normal file
10
plugins/pow/pow.plugin.zsh
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Thanks to Christopher Sexton
|
||||
# https://gist.github.com/965032
|
||||
function kapow {
|
||||
touch ~/.pow/$1/tmp/restart.txt
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "$fg[yellow]Pow restarting $1...$reset_color"
|
||||
fi
|
||||
}
|
||||
|
||||
compctl -W ~/.pow -/ kapow
|
||||
|
|
@ -139,4 +139,4 @@ _arguments \
|
|||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "redis-cli subcommand" _1st_arguments
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
# TODO: Make this compatible with rvm.
|
||||
# Run sudo gem on the system ruby, not the active ruby.
|
||||
alias sgem='sudo gem'
|
||||
|
||||
# Find ruby file
|
||||
alias rfind='find . -name *.rb | xargs grep -n'
|
||||
alias rfind='find . -name *.rb | xargs grep -n'
|
||||
|
|
|
|||
147
plugins/rvm/_rvm
Normal file
147
plugins/rvm/_rvm
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
#compdef rvm
|
||||
|
||||
local curcontext="$curcontext" state line cmds ret=1
|
||||
|
||||
_arguments -C \
|
||||
'(- 1 *)'{-v,--version}'[display version information]' \
|
||||
'(-l|--level)'{-l,--level}'+[patch level to use with rvm use / install]:number' \
|
||||
'(--prefix)--prefix[path for all rvm files (~/.rvm/), with trailing slash!]:path:_files' \
|
||||
'(--bin)--bin[path for binaries to be placed (~/.rvm/bin/)]:path:_files' \
|
||||
'(--source)--source[src directory to use (~/.rvm/src/)]:path:_files' \
|
||||
'(--archives)--archives[directory for downladed files (~/.rvm/archives/)]:path:_files' \
|
||||
'-S[Specify a script file to attempt to load and run (rubydo)]:file:_files' \
|
||||
'-e[Execute code from the command line]:code' \
|
||||
'(-G)-G[root gem path to use]:path:_files' \
|
||||
'(--gems)--gems[Used to set the gems_flag, use with remove to remove gems]' \
|
||||
'(--archive)--archive[Used to set the archive_flag, use with remove to remove archive]' \
|
||||
'(--patch)--patch[With MRI Rubies you may specify one or more full paths to patches]' \
|
||||
'(-C|--configure)'{-C,--configure}'=[custom configure options]' \
|
||||
'(--nice)--nice[process niceness (for slow computers, default 0)]:number' \
|
||||
'(--ree)--ree-options[Options passed directly to ree ./installer on the command line]:options' \
|
||||
'(--head)--head[with update, updates rvm to git head version]' \
|
||||
'(--rubygems)--rubygems[with update, updates rubygems for selected ruby]' \
|
||||
'(--default)--default[with ruby select, sets a default ruby for new shells]' \
|
||||
'(--debug)--debug[Toggle debug mode on for very verbose output]' \
|
||||
'(--trace)--trace[Toggle trace mode on to see EVERYTHING rvm is doing]' \
|
||||
'(--force)--force[Force install, removes old install & source before install]' \
|
||||
'(--summary)--summary[Used with rubydo to print out a summary of the commands run]' \
|
||||
'(--latest)--latest[with gemset --dump skips version strings for latest gem]' \
|
||||
'(--gems)--gems[with uninstall/remove removes gems with the interpreter]' \
|
||||
'(--docs)--docs[with install, attempt to generate ri after installation]' \
|
||||
'(--reconfigure)--reconfigure[Force ./configure on install even if Makefile already exists]' \
|
||||
'1: :->cmds' \
|
||||
'*: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
cmds)
|
||||
cmds=(
|
||||
"version:show the rvm version installed in rvm_path"
|
||||
"use:setup current shell to use a specific ruby version"
|
||||
"reload:reload rvm source itself (useful after changing rvm source)"
|
||||
"implode:(seppuku) removes the rvm installation completely. This means everything in $rvm_path (~/.rvm)."
|
||||
"update:upgrades rvm to the latest version."
|
||||
"reset:remove current and stored default & system settings."
|
||||
"info :show the *current* environment information for current ruby"
|
||||
"current:print the *current* ruby version and the name of any gemset being used."
|
||||
"debug:show info plus additional information for common issues"
|
||||
"install:install one or many ruby versions"
|
||||
"uninstall:uninstall one or many ruby versions, leaves their sources"
|
||||
"remove:uninstall one or many ruby versions and remove their sources"
|
||||
"migrate:Lets you migrate all gemsets from one ruby to another."
|
||||
"upgrade:Lets you upgrade from one version of a ruby to another, including migrating your gemsets semi-automatically."
|
||||
"wrapper:generates a set of wrapper executables for a given ruby with the specified ruby and gemset combination. Used under the hood for passenger support and the like."
|
||||
"cleanup:Lets you remove stale source folders / archives and other miscellaneous data associated with rvm."
|
||||
"repair:Lets you repair parts of your environment e.g. wrappers, env files and and similar files (e.g. general maintenance)."
|
||||
"snapshot:Lets your backup / restore an rvm installation in a lightweight manner."
|
||||
"disk-usage:Tells you how much disk space rvm install is using."
|
||||
"tools:Provides general information about the ruby environment, primarily useful when scripting rvm."
|
||||
"docs:Tools to make installing ri and rdoc documentation easier."
|
||||
"rvmrc:Tools related to managing rvmrc trust and loading."
|
||||
"exec:runs an arbitrary command as a set operation."
|
||||
"ruby:runs a named ruby file against specified and/or all rubies"
|
||||
"gem:runs a gem command using selected ruby's 'gem'"
|
||||
"rake:runs a rake task against specified and/or all rubies"
|
||||
"tests:runs 'rake test' across selected ruby versions"
|
||||
"specs:runs 'rake spec' across selected ruby versions"
|
||||
"monitor:Monitor cwd for testing, run rake {spec,test} on changes."
|
||||
"gemset:gemsets: http://rvm.beginrescueend.com/gemsets/"
|
||||
"rubygems:Switches the installed version of rubygems for the current ruby."
|
||||
"gemdir:display the path to the current gem directory (GEM_HOME)."
|
||||
"srcdir:display the path to rvm source directory (may be yanked)"
|
||||
"fetch:Performs an archive / src fetch only of the selected ruby."
|
||||
"list:show currently installed rubies, interactive output."
|
||||
"package:Install a dependency package {readline,iconv,zlib,openssl}"
|
||||
"notes:Display notes, with operating system specifics."
|
||||
"export:Temporarily set an environment variable in the current shell."
|
||||
"unexport:Undo changes made to the environment by 'rvm export'."
|
||||
)
|
||||
_describe -t commands 'rvm command' cmds && ret=0
|
||||
;;
|
||||
args)
|
||||
case $line[1] in
|
||||
(use|uninstall|remove|list)
|
||||
_values -S , 'rubies' $(rvm list strings | sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') default system && ret=0
|
||||
;;
|
||||
(install|fetch)
|
||||
_values -S , 'rubies' $(rvm list known_strings) && ret=0
|
||||
;;
|
||||
gemset)
|
||||
if (( CURRENT == 3 )); then
|
||||
_values 'gemset_commands' \
|
||||
'import' \
|
||||
'export' \
|
||||
'create' \
|
||||
'copy' \
|
||||
'rename' \
|
||||
'empty' \
|
||||
'delete' \
|
||||
'name' \
|
||||
'dir' \
|
||||
'list' \
|
||||
'list_all' \
|
||||
'gemdir' \
|
||||
'install' \
|
||||
'pristine' \
|
||||
'clear' \
|
||||
'use' \
|
||||
'update' \
|
||||
'unpack' \
|
||||
'globalcache'
|
||||
else
|
||||
_values -S , 'gemsets' $(rvm gemset list | grep -v gemset 2>/dev/null)
|
||||
fi
|
||||
ret=0
|
||||
;;
|
||||
package)
|
||||
if (( CURRENT == 3 )); then
|
||||
_values 'package_commands' \
|
||||
'install' \
|
||||
'uninstall'
|
||||
else
|
||||
_values 'packages' \
|
||||
'readline' \
|
||||
'iconv' \
|
||||
'curl' \
|
||||
'openssl' \
|
||||
'zlib' \
|
||||
'autoconf' \
|
||||
'ncurses' \
|
||||
'pkgconfig' \
|
||||
'gettext' \
|
||||
'glib' \
|
||||
'mono' \
|
||||
'llvm' \
|
||||
'libxml2' \
|
||||
'libxslt' \
|
||||
'libyaml'
|
||||
fi
|
||||
ret=0
|
||||
;;
|
||||
*)
|
||||
(( ret )) && _message 'no more arguments'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
57
plugins/rvm/rvm.plugin.zsh
Normal file
57
plugins/rvm/rvm.plugin.zsh
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
# Get the name of the current branch.
|
||||
function rvm_prompt_info() {
|
||||
local ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null)
|
||||
if [[ -n "$ruby_version" ]]; then
|
||||
echo "($ruby_version)"
|
||||
fi
|
||||
}
|
||||
|
||||
alias rubies='rvm list rubies'
|
||||
alias gemsets='rvm gemset list'
|
||||
|
||||
local ruby18='ruby-1.8.7-p334'
|
||||
local ruby19='ruby-1.9.2-p180'
|
||||
|
||||
function rb18 {
|
||||
if [ -z "$1" ]; then
|
||||
rvm use "$ruby18"
|
||||
else
|
||||
rvm use "$ruby18@$1"
|
||||
fi
|
||||
}
|
||||
|
||||
_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`}
|
||||
compdef _rb18 rb18
|
||||
|
||||
function rb19 {
|
||||
if [ -z "$1" ]; then
|
||||
rvm use "$ruby19"
|
||||
else
|
||||
rvm use "$ruby19@$1"
|
||||
fi
|
||||
}
|
||||
|
||||
_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`}
|
||||
compdef _rb19 rb19
|
||||
|
||||
function rvm-update {
|
||||
rvm get head
|
||||
rvm reload # TODO: Reload rvm completion?
|
||||
}
|
||||
|
||||
function rvm-link-completion {
|
||||
ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official"
|
||||
}
|
||||
|
||||
# TODO: Make this usable w/o rvm.
|
||||
function gems {
|
||||
local current_ruby=`rvm-prompt i v p`
|
||||
local current_gemset=`rvm-prompt g`
|
||||
|
||||
gem list $@ | sed \
|
||||
-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
|
||||
-Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
|
||||
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
|
||||
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
|
||||
}
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ function in_svn() {
|
|||
function svn_get_repo_name {
|
||||
if [ is_svn ]; then
|
||||
svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT
|
||||
|
||||
|
||||
svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//"
|
||||
fi
|
||||
}
|
||||
|
|
@ -29,9 +29,9 @@ function svn_get_rev_nr {
|
|||
function svn_dirty_choose {
|
||||
if [ is_svn ]; then
|
||||
s=$(svn status 2>/dev/null)
|
||||
if [ $s ]; then
|
||||
if [ $s ]; then
|
||||
echo $1
|
||||
else
|
||||
else
|
||||
echo $2
|
||||
fi
|
||||
fi
|
||||
|
|
@ -39,4 +39,4 @@ function svn_dirty_choose {
|
|||
|
||||
function svn_dirty {
|
||||
svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
alias et='mate .'
|
||||
alias ett='mate app config lib db public spec test Rakefile Capfile Todo'
|
||||
alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
|
||||
alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
|
||||
|
||||
# TextMate
|
||||
alias et='mate . &'
|
||||
alias ett='mate app config lib db public spec test Rakefile Capfile Todo &'
|
||||
alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
|
||||
alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
|
||||
|
||||
# Editor Ruby file in TextMate
|
||||
# Edit Ruby app in TextMate
|
||||
alias mr='mate CHANGELOG app config db lib public script spec test'
|
||||
|
||||
function tm() {
|
||||
|
|
|
|||
4
plugins/thor/_thor
Normal file
4
plugins/thor/_thor
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#compdef thor
|
||||
#autoload
|
||||
|
||||
compadd `thor list | grep thor | cut -d " " -f 2`
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#compdef vagrant
|
||||
#compdef vagrant
|
||||
#autoload
|
||||
|
||||
# vagrant zsh completion
|
||||
|
|
@ -64,7 +64,7 @@ __vagrant-box ()
|
|||
(options)
|
||||
case $line[1] in
|
||||
(repackage|remove)
|
||||
_arguments ':feature:__box_list'
|
||||
_arguments ':feature:__box_list'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
|
@ -93,7 +93,7 @@ case $state in
|
|||
(options)
|
||||
case $line[1] in
|
||||
(help)
|
||||
_arguments ':feature:__task_list'
|
||||
_arguments ':feature:__task_list'
|
||||
;;
|
||||
|
||||
(box)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue