diff --git a/lib/functions.zsh b/lib/functions.zsh index 6f5d015f7..d0b931ea5 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -10,14 +10,16 @@ function upgrade_oh_my_zsh() { /bin/sh $ZSH/tools/upgrade.sh } -function take() { - mkdir -p $1 - cd $1 +function logview() { + ccze -A < $1 | less -R +} + +function logtail() { + tail -f $1 | ccze } function extract() { unset REMOVE_ARCHIVE - if test "$1" = "-r"; then REMOVE=1 shift @@ -49,4 +51,3 @@ function extract() { echo "'$1' is not a valid file" fi } - diff --git a/lib/misc.zsh b/lib/misc.zsh index 4c1743657..88732e664 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -10,4 +10,4 @@ setopt long_list_jobs ## pager export PAGER=less -export LC_CTYPE=en_US.UTF-8 +export LC_CTYPE=$LANG diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index bc340e86b..015bea18c 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -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 diff --git a/plugins/perl/perl.plugin.zsh b/plugins/perl/perl.plugin.zsh index f94c4195d..1d4a533ab 100644 --- a/plugins/perl/perl.plugin.zsh +++ b/plugins/perl/perl.plugin.zsh @@ -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" } - diff --git a/themes/mahewin.zsh-theme b/themes/mahewin.zsh-theme new file mode 100644 index 000000000..16c5995ab --- /dev/null +++ b/themes/mahewin.zsh-theme @@ -0,0 +1,19 @@ +# Author: Hobbestigrou +# Desc: Based on xiong-chiamiov-plus +# last_update: 14/10/2010 + +if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="white"; fi + +PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(git_prompt_info)>%{\e[0m%}%b ' +PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' + +# git theming +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}[%{$fg_no_bold[yellow]%}%B" +ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%}]%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_no_bold[green]%}●" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_no_bold[red]%}●" + +#ls colors +LS_COLORS='rs=0:di=01;37:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:'; +export LS_COLORS