This commit is contained in:
GitHub Merge Button 2011-05-26 00:55:48 -07:00
commit ebf145bcd2
5 changed files with 94 additions and 19 deletions

View file

@ -2,14 +2,14 @@
alias g='git'
compdef g=git
alias gst='git status'
compdef _git gst=git-status
alias gsts='git status --short'
alias gl='git pull'
compdef _git gl=git-pull
alias gup='git fetch && git rebase'
compdef _git gup=git-fetch
alias gp='git push'
compdef _git gp=git-push
gdv() { git-diff -w "$@" | view - }
gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff
alias gc='git commit -v'
compdef _git gc=git-commit
@ -41,6 +41,47 @@ function current_branch() {
echo ${ref#refs/heads/}
}
function git-info() {
# author: Duane Johnson
# email: duane.johnson@gmail.com
# date: 2008 Jun 12
# license: MIT
#
# Based on discussion at http://kerneltrap.org/mailarchive/git/2007/11/12/406496
pushd . >/dev/null
# Find base of git directory
while [ ! -d .git ] && [ ! `pwd` = "/" ]; do cd ..; done
# Show various information about this git directory
if [ -d .git ]; then
echo "== Remote URL: `git remote -v`"
echo "== Remote Branches: "
git branch -r
echo
echo "== Local Branches:"
git branch
echo
echo "== Configuration (.git/config)"
cat .git/config
echo
echo "== Most Recent Commit"
git log --max-count=1
echo
echo "Type 'git log' for more commits, or 'git show' for full commit details."
else
echo "Not a git repository."
fi
popd >/dev/null
}
# these aliases take advantage of the previous function
alias ggpull='git pull origin $(current_branch)'
compdef ggpull=git

View file

@ -1,3 +1,18 @@
alias scpan='sudo cpan'
# Find perl file
alias pfind='find . -name *.pl | xargs grep -n'
#Check syntax perl file
alias psc='perl -c'
#French perldoc
alias perldoc-fr="perldoc -L FR"
#Trace query SQL
export DBIC_TRACE=1
export DBI_TRACE=1
# https://github.com/dbbolton
#
# Below are some useful Perl-related aliases/functions that I use with zsh.
@ -29,22 +44,22 @@ alias latest-perl='curl -s http://www.perl.org/get.html | perl -wlne '\''if (/pe
# 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
# set $EDITOR to 'vim' if it is undefined
[[ -z $EDITOR ]] && EDITOR=vim
# if the file exists, just open it
[[ -e $1 ]] && print "$1 exists; not modifying.\n" && $EDITOR $1
# if the file exists, just open it
[[ -e $1 ]] && print "$1 exists; not modifying.\n" && $EDITOR $1
# if it doesn't, make it, and open it
[[ ! -e $1 ]] && print '#!/usr/bin/perl'"\n"'use strict;'"\n"'use warnings;'\
"\n\n" > $1 && $EDITOR $1
# if it doesn't, make it, and open it
[[ ! -e $1 ]] && print '#!/usr/bin/perl'"\n"'use strict;'"\n"'use warnings;'\
"\n\n" > $1 && $EDITOR $1
}
# pgs - Perl Global Substitution
# find pattern = 1st arg
# replace pattern = 2nd arg
# filename = 3rd arg
# find pattern = 1st arg
# replace pattern = 2nd arg
# filename = 3rd arg
pgs() { # [find] [replace] [filename]
perl -i.orig -pe 's/'"$1"'/'"$2"'/g' "$3"
}
@ -59,4 +74,3 @@ prep() { # [pattern] [filename unless STDOUT]
say() {
print "$1\n"
}