From 4a56356fd690197f5d2ce949dbc95da1ca4417ed Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 2 Oct 2008 20:40:23 +0100 Subject: [PATCH 001/153] =?UTF-8?q?=E2=80=A2=20Added=20a=20test=20for=20gn?= =?UTF-8?q?u=20ls=20(not=20called=20gls)=20=E2=80=A2=20Added=20my=20own=20?= =?UTF-8?q?ls=5Fcolors=20=E2=80=A2=20Added=20various=20other=20useful=20ls?= =?UTF-8?q?=20aliases?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 05_ls | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/05_ls b/05_ls index 29aa3e6..b7d7628 100644 --- a/05_ls +++ b/05_ls @@ -1,6 +1,13 @@ if [[ -x `which gls` ]]; then alias rls=`which ls` alias ls='gls -h --color=auto ' - export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:' +elif [[ -n `ls --color` && $? == 0 ]]; then + # Check if ls can handle the --color option. If it can it's probably gnu. + alias ls='ls --color=auto' + export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=0;32:*.jpe=0;32:*.jpeg=0;32:*.gif=0;32:*.bmp=0;32:*.pbm=0;32:*.pgm=0;32:*.ppm=0;32:*.tga=0;32:*.xbm=0;32:*.xpm=0;32:*.tif=0;32:*.tiff=0;32:*.png=0;32:*.eps=0;32:*.mpg=0;32:*.mpeg=0;32:*.avi=0;32:*.fli=0;32:*.gl=0;32:*.dl=0;32:*.xcf=0;32:*.xwd=0;32:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:*.flac=01;35:*.m4a=01;35:*.mpc=01;35:*.o=01;33:*.c=01;35:*.m=01;35:*.h=01;35:*.rb=01;35:*.pl=01;35:*.py=01;35:*.sh=01;35:*.m=01;35:*akefile=0;35:*tags=01;32:*~=01;30:*.swp=01;30:*README=01;31:*README.*=01;31:*readme=00;31:*.tex=01;31:*.htm=01;31:*.html=01;31:*.pdf=00;31:*.PDF=00;31:*.ps=00;31:*.PS=00;31:*.png=00;31:*.PNG=00;31:*.jpg=00;31:*.JPG=00;31:*.jpeg=00;31:*.JPEG=00;31:'; fi -alias ll="ls -al" + +alias l='ls' +alias ll='ls -al' +alias lh='ls -Alh' +alias lt='ls -Alt' \ No newline at end of file From 2aed107b250d8e6e4408de3607e7c01dcd6c0c6f Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 2 Oct 2008 20:55:02 +0100 Subject: [PATCH 002/153] =?UTF-8?q?=E2=80=A2=20Added=20more=20directories?= =?UTF-8?q?=20to=20the=20path,=20using=20a=20loop.=20=E2=80=A2=20Added=20m?= =?UTF-8?q?ore=20directories=20to=20the=20manpath,=20again=20using=20a=20l?= =?UTF-8?q?oop.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01_path | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/01_path b/01_path index c070892..6968d86 100644 --- a/01_path +++ b/01_path @@ -1,5 +1,24 @@ -# I want /opt/local/bin to take precedence -path=(/opt/local/bin $path) +# Add some dirs to the path. +pathdirs=(/usr/local/git/bin + /usr/local/libexec/git-core + /var/lib/gems/1.8/bin + /opt/local/bin + ~/bin ) + +for dir ($pathdirs) + if [[ -x $dir ]]; then + path=($dir $path) + fi + +# This should remove possible dups +typeset -U path + +# Allow MacPorts man pages and others +dirs=( /usr/local/git/man /sw/share/man /opt/local/man ) +for dir ($dirs) + if [[ -x $dir ]]; then + manpath=($manpath $dir) + fi + +typeset -U manpath -# Allow MacPorts man pages -manpath=($manpath /opt/local/man) From 85bbc8bf9f8b921bdbb7aa46cf6dd42cdfb7c1e1 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 2 Oct 2008 20:56:47 +0100 Subject: [PATCH 003/153] added ipython alias --- 05_python | 1 + 1 file changed, 1 insertion(+) create mode 100644 05_python diff --git a/05_python b/05_python new file mode 100644 index 0000000..6e44290 --- /dev/null +++ b/05_python @@ -0,0 +1 @@ +alias pylab='ipython -pylab -wthread' From 3898b3c1142576b6a54e292be280e78bf4e18fc1 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 2 Oct 2008 21:00:19 +0100 Subject: [PATCH 004/153] added more filetypes to lists --- 05_editor | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/05_editor b/05_editor index 79bb3f5..7512b0d 100644 --- a/05_editor +++ b/05_editor @@ -7,6 +7,12 @@ function not_run_from_ssh () { if [[ -x `which mate` && $(not_run_from_ssh) = 1 ]]; then EDITOR="mate -w" +elif [[ -x `which gvim` ]]; then + EDITOR=gvim +elif [[ -x `which vim` ]]; then + EDITOR=vim +elif [[ -x `which vi` ]]; then + EDITOR=vi elif [[ -x `which nano` ]]; then EDITOR=nano elif [[ -x `which pico` ]]; then @@ -16,16 +22,16 @@ else fi # Set EDITOR as default for plaintext stuff -for s in txt c cc cxx cpp; do +for s in txt tex c cc cxx cpp gp m md markdown otl; do alias -s $s=$EDITOR done # Abuse the "open" command on OS X if [[ $OSTYPE[1,6] == "darwin" ]]; then for s in mp3 wav aac \ - avi mp4 m4v mov qt mpg mpeg \ - jpg png psd bmp gif tif tiff \ - ps pdf html dmg; do + ogg avi mp4 m4v mov qt mpg mpeg \ + jpg jpeg png psd bmp gif tif tiff \ + eps ps pdf html dmg; do alias -s $s=open done fi From 0fd72b57444aadfe6aff05ca27cac0c16840fe78 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 2 Oct 2008 21:04:17 +0100 Subject: [PATCH 005/153] Added grep environment var --- 05_grep | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/05_grep b/05_grep index f76413f..b4c06a9 100644 --- a/05_grep +++ b/05_grep @@ -2,3 +2,7 @@ if [[ -x `which ggrep` ]]; then alias rgrep=`which grep` alias grep='ggrep --color' fi +# I don't know how BSD's grep responds to this. +export GREP_OPTIONS='--color=auto' + + From 62023fc63d7b9d113b9bfff0a78700747f42d0d6 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 2 Oct 2008 21:04:31 +0100 Subject: [PATCH 006/153] added RI options var --- 05_ruby | 1 + 1 file changed, 1 insertion(+) diff --git a/05_ruby b/05_ruby index 9ac1ef8..d300db9 100644 --- a/05_ruby +++ b/05_ruby @@ -1 +1,2 @@ alias irb='irb --readline -r irb/completion' +export RI='-f ansi --width 70' From 3fb18bcc021da6575745456d69b2d183250718e8 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 2 Oct 2008 21:07:33 +0100 Subject: [PATCH 007/153] =?UTF-8?q?=E2=80=A2=20Added=20my=20history=20opti?= =?UTF-8?q?ons.=20(quite=20a=20few,=20see=20pp=20136=20From=20Bash=20to=20?= =?UTF-8?q?Z-Shell)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 06_history | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/06_history b/06_history index c250001..f154509 100644 --- a/06_history +++ b/06_history @@ -1,7 +1,12 @@ HISTFILE=~/.history HISTSIZE=10500 SAVEHIST=10000 -SHARE_HISTORY=1 -EXTENDED_HISTORY=1 -HIST_EXPIRE_DUPS_FIRST=1 - +setopt SHARE_HISTORY +setopt EXTENDED_HISTORY +setopt EXTENDED_GLOB +setopt HIST_VERIFY +setopt HIST_APPEND +setopt HIST_IGNORE_DUPS +setopt HIST_IGNORE_ALL_DUPS +setopt HIST_REDUCE_BLANKS +setopt HIST_IGNORE_SPACE \ No newline at end of file From 73158ee8832f49ca441c9ef455dc1dcb97c55a5e Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 3 Oct 2008 09:21:03 +0100 Subject: [PATCH 008/153] Added run-help/help stuff --- 03_help | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 03_help diff --git a/03_help b/03_help new file mode 100644 index 0000000..7630e9f --- /dev/null +++ b/03_help @@ -0,0 +1,6 @@ +# See From Bash to Z Shell, Page: 101 +# unalias run-help +autoload -Uz run-help +# From zsh-helpfiles (see fink) +export HELPDIR='/sw/share/zsh/zsh_help' +alias help=run-help \ No newline at end of file From 72e655583f583599ebca340953b5b84e8e63d71b Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 3 Oct 2008 09:24:18 +0100 Subject: [PATCH 009/153] added snippet to detect --color option to grep --- 05_grep | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/05_grep b/05_grep index b4c06a9..adc42bf 100644 --- a/05_grep +++ b/05_grep @@ -2,7 +2,9 @@ if [[ -x `which ggrep` ]]; then alias rgrep=`which grep` alias grep='ggrep --color' fi -# I don't know how BSD's grep responds to this. + +# From zsh-lovers: detect gnu grep: +(grep --help 2>/dev/null |grep -- --color) >/dev/null && \ export GREP_OPTIONS='--color=auto' From 18d26250eb2d534d635b604eb29c574e3548f27a Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 3 Oct 2008 09:24:41 +0100 Subject: [PATCH 010/153] added alias for quick history grepping --- 06_history | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/06_history b/06_history index f154509..6ae4629 100644 --- a/06_history +++ b/06_history @@ -3,10 +3,12 @@ HISTSIZE=10500 SAVEHIST=10000 setopt SHARE_HISTORY setopt EXTENDED_HISTORY -setopt EXTENDED_GLOB setopt HIST_VERIFY setopt HIST_APPEND setopt HIST_IGNORE_DUPS setopt HIST_IGNORE_ALL_DUPS setopt HIST_REDUCE_BLANKS -setopt HIST_IGNORE_SPACE \ No newline at end of file +setopt HIST_IGNORE_SPACE + +# Grep the history with 'h' +h () { history 0 | grep $1 } From 498727462c219bd5a8ceb16277e249fecef92df6 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 3 Oct 2008 09:24:58 +0100 Subject: [PATCH 011/153] added lots of options --- rc | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/rc b/rc index 70327ba..c454e4a 100644 --- a/rc +++ b/rc @@ -1,5 +1,69 @@ +setopt nobeep # No beeping +setopt AUTOPUSHD PUSHDMINUS PUSHDSILENT PUSHDTOHOME +setopt AUTOCD # cd by typing dirname +setopt cdablevars # Follow variables which are dirnames +setopt interactivecomments # allow comments on cmd line. +setopt SH_WORD_SPLIT # split up var in "for x in *" +setopt MULTIOS # Allow multiple redirection echo 'a'>b>c +setopt CORRECT CORRECT_ALL # Try to correct command line spelling +setopt BANG_HIST # Allow ! for accessing history +setopt NOHUP # Don't HUP running jobs on logout. +setopt EXTENDED_GLOB # Enable extended globbing + zstyle ':completion:*' completer _expand _complete +zstyle ':completion:*' use-cache on +zstyle ':completion:*' users resolve +# use dircolours in completion listings +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} + +# allow approximate matching +zstyle ':completion:*' completer _complete _match _approximate +zstyle ':completion:*:match:*' original only +zstyle ':completion:*:approximate:*' max-errors 1 numeric +zstyle ':completion:*' auto-description 'Specify: %d' +zstyle ':completion:*' format 'Completing %d' +zstyle ':completion:*' verbose true +zstyle ':completion:*:functions' ignored-patterns '_*' +zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns \ +'*?.(o|c~|zwc)' '*?~' + +# only java files for javac +zstyle ':completion:*:javac:*' files '*.java' + +# no binary files for vi or textmate +zstyle ':completion:*:vi:*' ignored-patterns '*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc|class|pdf|ps)' +zstyle ':completion:*:mate:*' ignored-patterns '*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc|class|pdf|ps)' +zstyle ':completion:*:vim:*' ignored-patterns '*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc|class|pdf|ps)' +zstyle ':completion:*:gvim:*' ignored-patterns '*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc|class|pdf|ps)' +# no binary files for less +zstyle ':completion:*:less:*' ignored-patterns '*.(o|a|so|dvi|fig|out|class|pdf|ps)' +zstyle ':completion:*:zless:*' ignored-patterns '*.(o|a|so|dvi|fig|out|class|pdf|ps)' +# pdf for xpdf +zstyle ':completion:*:xpdf:*' files '*.pdf' +# tar files +zstyle ':completion:*:tar:*' files '*.tar|*.tgz|*.tz|*.tar.Z|*.tar.bz2|*.tZ|*.tar.gz' +# latex to the fullest +# for printing +zstyle ':completion:*:xdvi:*' files '*.dvi' +zstyle ':completion:*:dvips:*' files '*.dvi' + +# Group relatex matches: +zstyle ':completion:*' group-name '' +zstyle ':completion:*:-command-:*:(commands|builtins|reserved-words-aliases)' group-name commands +# Separate man page sections +zstyle ':completion:*:manuals' seperate-sections true +# Separate comand line options and descriptions with # +zstyle ':completion:*' list-separator '#' +# Generate descriptions for arguments +zstyle ':completion:*' auto-description 'specify: %d' + +# Give long completion options in a list. tab to advance. +zstyle ':completion:*:default' list-prompt '%S%M matches%s' + +# Expand out ! when I press space. +bindkey ' ' magic-space + autoload -Uz compinit compinit From ba688942fe3db451101ef95923163e067c2cb492 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 3 Oct 2008 09:58:36 +0100 Subject: [PATCH 012/153] added apt functions --- 05_fink | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 05_fink diff --git a/05_fink b/05_fink new file mode 100644 index 0000000..96a7511 --- /dev/null +++ b/05_fink @@ -0,0 +1,19 @@ +# Look for apt, and add some useful functions if we have it. +if [[ -x `which apt` ]]; then + upgrade () { + if [ -z $1 ] ; then + sudo apt-get update + sudo apt-get -u upgrade + else + ssh $1 sudo apt-get update + # ask before the upgrade + local dummy + ssh $1 sudo apt-get --no-act upgrade + echo -n "Process the upgrade ?" + read -q dummy + if [[ $dummy == "y" ]] ; then + ssh $1 sudo apt-get -u upgrade --yes + fi + fi + } +fi \ No newline at end of file From 6d2e12920d525bf779250d2db7973e22ce7deeba Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 3 Oct 2008 15:09:00 +0100 Subject: [PATCH 013/153] added function paths --- 01_path | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/01_path b/01_path index 6968d86..71aec19 100644 --- a/01_path +++ b/01_path @@ -22,3 +22,11 @@ for dir ($dirs) typeset -U manpath +# Add function paths +funcdirs=( $HOME/.zsh/func /sw/share/zsh/ ) +for dir ($funcdirs) + if [[ -x $dir ]]; then + fpath=($fpath $dir) + fi + +typeset -U fpath From f2586cc2f6961e096b014ebd434ce449cb2fa380 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 3 Oct 2008 15:09:13 +0100 Subject: [PATCH 014/153] playing with title setting code --- 07_title | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/07_title b/07_title index 24515a4..b352152 100644 --- a/07_title +++ b/07_title @@ -1,8 +1,36 @@ -# Set the terminal title in OS X, stolen from http://tinyurl.com/5u9wfr -case $TERM in (*xterm*|ansi) - function settab { print -Pn "\e]1;%n@%m: %~\a" } - function settitle { print -Pn "\e]2;%n@%m: %~\a" } - function chpwd { settab; settitle } - settab; settitle - ;; + +# Set xterm/screen titles. These should run as hooks +case $TERM in + (*xterm*|ansi) + function title { + print -Pn "\e]1;$*\a" + print -Pn "\e]2;$*\a" + } + ;; + (screen) + # normal escape codes don't work here. + function title { } + ;; esac + +TITLE_FMT="%n@%m: %~" +title $TITLE_FMT + +# Available hook functions (see zshmisc(1)) +# * chpwd: exec when working dir changes +# * precmd: execute before each prompt +# * preexec: execute after a command has been read and is about to be run + +function chpwd { + title $TITLE_FMT +} + +function precmd { + title $TITLE_FMT +} + +function preexec { + emulate -L zsh + local -a cmd; cmd=(${(z)1}) + title $cmd[1]:t "$cmd[2,-1]" +} From 3d1c898687d83ffba437bac1407b859f520713af Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 3 Oct 2008 15:09:30 +0100 Subject: [PATCH 015/153] added command to activate my prompt --- 10_prompt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/10_prompt b/10_prompt index 2ccf776..eef9512 100644 --- a/10_prompt +++ b/10_prompt @@ -1,2 +1,14 @@ setopt prompt_subst -PROMPT='%{$reset_color%}%B%n%b@%m %~`git-prompt`%(!.#.>) ' +# PROMPT='%{$reset_color%}%B%n%b@%m %~`git-prompt`%(!.#.>) ' + +if [ "$SSH_CONNECTION" != "" ]; +then + # Not running locally... + local COLOUR='red' +else + #Running locally... + local COLOUR='green' +fi + +# Set up my prompt. +autoload promptinit && promptinit && prompt doom green $COLOUR From e1e14509d724f27f9eae737164ad43b1439815f9 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 3 Oct 2008 15:10:05 +0100 Subject: [PATCH 016/153] reformatted code --- 10_prompt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/10_prompt b/10_prompt index eef9512..75a9bcf 100644 --- a/10_prompt +++ b/10_prompt @@ -1,13 +1,12 @@ setopt prompt_subst # PROMPT='%{$reset_color%}%B%n%b@%m %~`git-prompt`%(!.#.>) ' -if [ "$SSH_CONNECTION" != "" ]; -then - # Not running locally... - local COLOUR='red' +if [ "$SSH_CONNECTION" != "" ]; then + # Not running locally... + local COLOUR='red' else - #Running locally... - local COLOUR='green' + #Running locally... + local COLOUR='green' fi # Set up my prompt. From d844effe4985f106aeebcaabbcfd281c0e5fe17c Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 3 Oct 2008 15:13:33 +0100 Subject: [PATCH 017/153] added some handy git aliases --- 06_git | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/06_git b/06_git index c1878d0..27720d6 100644 --- a/06_git +++ b/06_git @@ -43,4 +43,22 @@ if [[ -x `which git` ]]; then function nhgk () { nohup gitk --all & } -fi \ No newline at end of file +fi + +alias gb='git branch -a -v' +alias gs='git status' +alias gd='git diff' +alias gf='git fetch' +alias gr='git-rebase' +alias gsc='git-svn dcommit' +alias gsr='git-svn rebase' +alias gsf='git-svn fetch' +# gc => git checkout master +# gc bugs => git checkout bugs +function gc { + if [ -z "$1" ]; then + git checkout master + else + git checkout $1 + fi +} From d6eab30a443ac5628537113d51515b287bc4cbfc Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Tue, 7 Oct 2008 09:53:39 +0100 Subject: [PATCH 018/153] moved my themable prompt here --- 10_prompt | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/10_prompt b/10_prompt index 75a9bcf..cca3982 100644 --- a/10_prompt +++ b/10_prompt @@ -1,6 +1,48 @@ setopt prompt_subst # PROMPT='%{$reset_color%}%B%n%b@%m %~`git-prompt`%(!.#.>) ' +# Themable prompt of doom. +function prompt_doom_setup { + unset PS1 PS2 PS3 PS4 PROMPT RPROMPT + # Colours accepted as arguments + local u_col=${1:-'green'} + local h_col=${2:-'green'} + local d_col=${3:-'blue'} + local n_tru=${4:-'blue'} + local n_fal=${5:-'yellow'} + # looks like: ee1mpf@eepc-tsar16 ~ $ + ps1=( + "%{$fg_bold[$u_col]%}%n@" + "%{$fg_bold[$h_col]%}%m " + "%{$fg_bold[$d_col]%}%1~ " + "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%}$" + " %{$reset_color%}" + ) + ps2=( + "%_ %{$fg_bold[$d_col]%}-> " + "%{$reset_color%}" + ) + PS2="${(j::)ps2}" + PS1="${(j::)ps1}" +} + +# print information when user runs 'prompt -h doom' +prompt_doom_help () { + cat < Date: Tue, 7 Oct 2008 13:15:43 +0100 Subject: [PATCH 019/153] fixed a small problem with git-prompt --- 06_git | 1 + 10_prompt | 45 ++------------------------------------------- 2 files changed, 3 insertions(+), 43 deletions(-) diff --git a/06_git b/06_git index 27720d6..42492fe 100644 --- a/06_git +++ b/06_git @@ -14,6 +14,7 @@ if [[ -x `which git` ]]; then git rebase master } function git-prompt() { + emulate -L zsh gstatus=$(git status 2> /dev/null) branch=$(echo $gstatus | head -n 1 | sed 's/^# On branch //') dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -n 2 | grep 'nothing to commit (working directory clean)'; echo $?) diff --git a/10_prompt b/10_prompt index cca3982..66a4057 100644 --- a/10_prompt +++ b/10_prompt @@ -1,48 +1,7 @@ setopt prompt_subst # PROMPT='%{$reset_color%}%B%n%b@%m %~`git-prompt`%(!.#.>) ' -# Themable prompt of doom. -function prompt_doom_setup { - unset PS1 PS2 PS3 PS4 PROMPT RPROMPT - # Colours accepted as arguments - local u_col=${1:-'green'} - local h_col=${2:-'green'} - local d_col=${3:-'blue'} - local n_tru=${4:-'blue'} - local n_fal=${5:-'yellow'} - # looks like: ee1mpf@eepc-tsar16 ~ $ - ps1=( - "%{$fg_bold[$u_col]%}%n@" - "%{$fg_bold[$h_col]%}%m " - "%{$fg_bold[$d_col]%}%1~ " - "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%}$" - " %{$reset_color%}" - ) - ps2=( - "%_ %{$fg_bold[$d_col]%}-> " - "%{$reset_color%}" - ) - PS2="${(j::)ps2}" - PS1="${(j::)ps1}" -} - -# print information when user runs 'prompt -h doom' -prompt_doom_help () { - cat < Date: Tue, 7 Oct 2008 13:25:43 +0100 Subject: [PATCH 020/153] added func dir --- func/prompt_git_setup | 58 +++++++++++++++++++++++++++++++++++++++++++ install | 4 +++ 2 files changed, 62 insertions(+) create mode 100644 func/prompt_git_setup diff --git a/func/prompt_git_setup b/func/prompt_git_setup new file mode 100644 index 0000000..708ea8f --- /dev/null +++ b/func/prompt_git_setup @@ -0,0 +1,58 @@ +# Themable prompt with git support. +# No twiddly crap - just prompty goodness. +# Requires zshkit: http://github.com/mattfoster/zshkit/tree/master/06_git +# +# Instructions: +# 1) Put this somewhere +# 2) Make sure that it's in the fpath: +# fpath=( $HOME/.zsh/func "$fpath[@]" ) +# 3) Load up the prompt theme extension, and set the prompt: +# autoload promptinit && promptinit && prompt git + +# Prompt setup function +function prompt_git_setup { + unset PS1 PS2 PS3 PS4 PROMPT RPROMPT + # Colours accepted as arguments + local u_col=${1:-'green'} + local h_col=${2:-'green'} + local d_col=${3:-'blue'} + local n_tru=${4:-'blue'} + local n_fal=${5:-'yellow'} + # looks like: ee1mpf@eepc-tsar16 ~ $ + ps1=( + "%{$fg_bold[$u_col]%}%n@" + "%{$fg_bold[$h_col]%}%m " + "%{$fg_bold[$d_col]%}%1~" + "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%} " + '`git-prompt`' + "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%}$ " + "%{$reset_color%}" + ) + ps2=( + "%_ %{$fg_bold[$d_col]%}-> " + "%{$reset_color%}" + ) + PS2="${(j::)ps2}" + PS1="${(j::)ps1}" +} + +# print information when user runs 'prompt -h git' +prompt_git_help () { + cat < Date: Tue, 7 Oct 2008 13:26:04 +0100 Subject: [PATCH 021/153] modified git-prompt to work better with my prompt theme --- 06_git | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/06_git b/06_git index 42492fe..16b9e49 100644 --- a/06_git +++ b/06_git @@ -21,7 +21,7 @@ if [[ -x `which git` ]]; then if [[ x$branch != x ]]; then dirty_color=$fg[cyan] if [[ $dirty = 1 ]] { dirty_color=$fg[magenta] } - [ x$branch != x ] && echo " %{$dirty_color%}$branch%{$reset_color%} " + [ x$branch != x ] && echo "%{$dirty_color%}$branch%{$reset_color%} " fi } function git-scoreboard () { From 9336c322e93fd8eaa4dfa225457137fdabe8442d Mon Sep 17 00:00:00 2001 From: Ryan Baumann Date: Wed, 1 Oct 2008 21:55:35 -0400 Subject: [PATCH 022/153] Stupid manpage formatting tricks --- 06_man | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 06_man diff --git a/06_man b/06_man new file mode 100644 index 0000000..dfeefe9 --- /dev/null +++ b/06_man @@ -0,0 +1,7 @@ +# Open manpage with Preview.app +# Uses ps2pdf conversion because it's faster +if [[ $OSTYPE[1,6] == "darwin" ]]; then + function manp () { + man -t $* | ps2pdf - - | open -f -a Preview + } +fi From a14ade6be757e4978894351c167c1d5fc6712858 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 10 Oct 2008 14:06:36 +0100 Subject: [PATCH 023/153] more minimal prompt -- inspired by: http://dotfiles.org/~_why/.zshrc --- func/prompt_git_setup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/func/prompt_git_setup b/func/prompt_git_setup index 708ea8f..d19ecd5 100644 --- a/func/prompt_git_setup +++ b/func/prompt_git_setup @@ -20,8 +20,8 @@ function prompt_git_setup { local n_fal=${5:-'yellow'} # looks like: ee1mpf@eepc-tsar16 ~ $ ps1=( - "%{$fg_bold[$u_col]%}%n@" - "%{$fg_bold[$h_col]%}%m " + # "%{$fg_bold[$u_col]%}%n@" + # "%{$fg_bold[$h_col]%}%m " "%{$fg_bold[$d_col]%}%1~" "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%} " '`git-prompt`' From 478e024f83b3e79e3e284ba1a0da33e935d37784 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 10 Oct 2008 14:07:12 +0100 Subject: [PATCH 024/153] added git to path --- 01_path | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/01_path b/01_path index 71aec19..d950176 100644 --- a/01_path +++ b/01_path @@ -1,5 +1,6 @@ # Add some dirs to the path. -pathdirs=(/usr/local/git/bin +pathdirs=(/Library/Frameworks/Python.framework/Versions/Current/bin + /usr/local/git/bin /usr/local/libexec/git-core /var/lib/gems/1.8/bin /opt/local/bin From 1eaa6457209dbb403c30d1ca5a4f1f06d7542ca3 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 10 Oct 2008 14:10:03 +0100 Subject: [PATCH 025/153] Took title string from: http://dotfiles.org/~_why/.zshrc --- 07_title | 52 +++++++++++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/07_title b/07_title index b352152..1ce0664 100644 --- a/07_title +++ b/07_title @@ -1,36 +1,30 @@ +# From: http://dotfiles.org/~_why/.zshrc +# Really works with minimal prompt setup. -# Set xterm/screen titles. These should run as hooks -case $TERM in - (*xterm*|ansi) - function title { - print -Pn "\e]1;$*\a" - print -Pn "\e]2;$*\a" - } - ;; - (screen) - # normal escape codes don't work here. - function title { } - ;; -esac +# format titles for screen and rxvt +function title() { + # escape '%' chars in $1, make nonprintables visible + a=${(V)1//\%/\%\%} -TITLE_FMT="%n@%m: %~" -title $TITLE_FMT + # Truncate command, and join lines. + a=$(print -Pn "%40>...>$a" | tr -d "\n") -# Available hook functions (see zshmisc(1)) -# * chpwd: exec when working dir changes -# * precmd: execute before each prompt -# * preexec: execute after a command has been read and is about to be run - -function chpwd { - title $TITLE_FMT + case $TERM in + screen) + print -Pn "\ek$a:$3\e\\" # screen title (in ^A") + ;; + xterm*|rxvt|ansi) + print -Pn "\e]2;$2 | $a:$3\a" # plain xterm title + ;; + esac } -function precmd { - title $TITLE_FMT +# precmd is called just before the prompt is printed +function precmd() { + title "zsh" "$USER@%m" "%55<...<%~" } -function preexec { - emulate -L zsh - local -a cmd; cmd=(${(z)1}) - title $cmd[1]:t "$cmd[2,-1]" -} +# preexec is called just before any command line is executed +function preexec() { + title "$1" "$USER@%m" "%35<...<%~" +} \ No newline at end of file From 63d38051352965db063f7495818bef5905cfa7a4 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sat, 11 Oct 2008 20:32:30 +0100 Subject: [PATCH 026/153] updeated title to use _why's format. --- 07_title | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/07_title b/07_title index 1ce0664..a7e0bd1 100644 --- a/07_title +++ b/07_title @@ -13,8 +13,9 @@ function title() { screen) print -Pn "\ek$a:$3\e\\" # screen title (in ^A") ;; - xterm*|rxvt|ansi) - print -Pn "\e]2;$2 | $a:$3\a" # plain xterm title + xterm*|rxvt|ansi) + print -Pn "\e]1;$2 | $a:$3\a" # plain xterm title + print -Pn "\e]2;$2 | $a:$3\a" # tab title ;; esac } From d71983fba19792c00679d8a47fa932b4c9e92fda Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Tue, 14 Oct 2008 09:22:25 +0100 Subject: [PATCH 027/153] Moving some bits around --- 05_fink => 05_apt | 0 07_title => 10_title | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename 05_fink => 05_apt (100%) rename 07_title => 10_title (100%) diff --git a/05_fink b/05_apt similarity index 100% rename from 05_fink rename to 05_apt diff --git a/07_title b/10_title similarity index 100% rename from 07_title rename to 10_title From 195d4869d3a30b40d7fb375e5679973bd1c7e3b6 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 17 Oct 2008 13:22:44 +0100 Subject: [PATCH 028/153] Added awesome rc snippet from stackoverflow --- 10_title | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/10_title b/10_title index a7e0bd1..9134f60 100644 --- a/10_title +++ b/10_title @@ -28,4 +28,23 @@ function precmd() { # preexec is called just before any command line is executed function preexec() { title "$1" "$USER@%m" "%35<...<%~" +} + +# Loads up .env.rc or .env files if there in the current tree. +# http://stackoverflow.com/questions/171563/whats-in-your-zshrc#211917 +function chpwd; { + DIRECTORY="$PWD" + while true; do + if [ -f './.env.rc' ]; then + source './.env.rc' + break + fi + if [ -f './env' ]; then + source './env' + break + fi + [ $PWD = '/' ] && break + cd -q .. + done + cd -q "$DIRECTORY" } \ No newline at end of file From b2fc7b5db051fa93de18ef79649ac829d1a15ab6 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 17 Oct 2008 13:24:06 +0100 Subject: [PATCH 029/153] changed indentation --- func/prompt_git_setup | 66 +++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/func/prompt_git_setup b/func/prompt_git_setup index d19ecd5..6ccdfa6 100644 --- a/func/prompt_git_setup +++ b/func/prompt_git_setup @@ -11,47 +11,47 @@ # Prompt setup function function prompt_git_setup { - unset PS1 PS2 PS3 PS4 PROMPT RPROMPT - # Colours accepted as arguments - local u_col=${1:-'green'} - local h_col=${2:-'green'} - local d_col=${3:-'blue'} - local n_tru=${4:-'blue'} - local n_fal=${5:-'yellow'} - # looks like: ee1mpf@eepc-tsar16 ~ $ - ps1=( + unset PS1 PS2 PS3 PS4 PROMPT RPROMPT + # Colours accepted as arguments + local u_col=${1:-'green'} + local h_col=${2:-'green'} + local d_col=${3:-'blue'} + local n_tru=${4:-'blue'} + local n_fal=${5:-'yellow'} + # looks like: ee1mpf@eepc-tsar16 ~ $ + ps1=( # "%{$fg_bold[$u_col]%}%n@" # "%{$fg_bold[$h_col]%}%m " - "%{$fg_bold[$d_col]%}%1~" - "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%} " - '`git-prompt`' - "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%}$ " - "%{$reset_color%}" - ) - ps2=( - "%_ %{$fg_bold[$d_col]%}-> " - "%{$reset_color%}" - ) - PS2="${(j::)ps2}" - PS1="${(j::)ps1}" + "%{$fg_bold[$d_col]%}%1~" + "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%} " + '`git-prompt`' + "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%}$ " + "%{$reset_color%}" + ) + ps2=( + "%_ %{$fg_bold[$d_col]%}-> " + "%{$reset_color%}" + ) + PS2="${(j::)ps2}" + PS1="${(j::)ps1}" } # print information when user runs 'prompt -h git' prompt_git_help () { - cat < Date: Fri, 17 Oct 2008 13:25:36 +0100 Subject: [PATCH 030/153] added some ruby aliases --- 05_ruby | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/05_ruby b/05_ruby index d300db9..0f2e0fa 100644 --- a/05_ruby +++ b/05_ruby @@ -1,2 +1,10 @@ -alias irb='irb --readline -r irb/completion' +# Convenient. Also works in Gentoo or Ubuntu +if [[ -x `which irb1.8` ]]; then + alias irb='irb1.8 --readline -r irb/completion' +else + alias irb='irb --readline -r irb/completion' +fi export RI='-f ansi --width 70' +if [[ -x `which fri` ]]; then + alias ri=fri +fi \ No newline at end of file From c76f23ec6046b7a72e2e04817c77d428cce4919f Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 17 Oct 2008 13:34:44 +0100 Subject: [PATCH 031/153] =?UTF-8?q?=E2=80=A2=20Added=20some=20textmate=20f?= =?UTF-8?q?unctions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 05_textmate | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 05_textmate diff --git a/05_textmate b/05_textmate new file mode 100644 index 0000000..7ac63ab --- /dev/null +++ b/05_textmate @@ -0,0 +1,12 @@ +# Useful functions for bundle development +if [[ -x `which mate` ]]; then + function mate_reload(){ + osascript -e 'tell app "TextMate" to reload bundles' + } + function mate_bundle () { + cd "$HOME/Library/Application Support/TextMate/Bundles/$1.tmbundle" + } + function mate_pristine () { + cd "$HOME/Library/Application Support/TextMate/Pristine Copy/Bundles/$1.tmbundle" + } +fi From a0e49be3a01b00b81c4c34f9f70aa69837215855 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 19 Oct 2008 16:54:35 +0100 Subject: [PATCH 032/153] commented because of a problem. what is cd -q? --- 10_title | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/10_title b/10_title index 9134f60..ca1fd5c 100644 --- a/10_title +++ b/10_title @@ -32,19 +32,19 @@ function preexec() { # Loads up .env.rc or .env files if there in the current tree. # http://stackoverflow.com/questions/171563/whats-in-your-zshrc#211917 -function chpwd; { - DIRECTORY="$PWD" - while true; do - if [ -f './.env.rc' ]; then - source './.env.rc' - break - fi - if [ -f './env' ]; then - source './env' - break - fi - [ $PWD = '/' ] && break - cd -q .. - done - cd -q "$DIRECTORY" -} \ No newline at end of file +# function chpwd; { +# DIRECTORY="$PWD" +# while true; do +# if [ -f './.env.rc' ]; then +# source './.env.rc' +# break +# fi +# if [ -f './env' ]; then +# source './env' +# break +# fi +# [ $PWD = '/' ] && break +# cd -q .. +# done +# cd -q "$DIRECTORY" +# } \ No newline at end of file From ad2a1695f2f7dbe39271ceff0887127b23edace7 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 19 Oct 2008 18:47:36 +0100 Subject: [PATCH 033/153] commented out SO snippet, as I can't get it to work. --- 10_title | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/10_title b/10_title index ca1fd5c..f8b484b 100644 --- a/10_title +++ b/10_title @@ -32,6 +32,7 @@ function preexec() { # Loads up .env.rc or .env files if there in the current tree. # http://stackoverflow.com/questions/171563/whats-in-your-zshrc#211917 +# WTF is cd -q? # function chpwd; { # DIRECTORY="$PWD" # while true; do @@ -39,10 +40,10 @@ function preexec() { # source './.env.rc' # break # fi -# if [ -f './env' ]; then -# source './env' -# break -# fi +# # if [ -f './env' ]; then +# # source './env' +# # break +# # fi # [ $PWD = '/' ] && break # cd -q .. # done From 911f7103e1e451ad73e5d4b942fea6a579aafaa6 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 20 Oct 2008 14:06:15 +0100 Subject: [PATCH 034/153] Only enable the .env.rc loader in zsh versions > 4.3.4. --- 10_title | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/10_title b/10_title index f8b484b..068fac3 100644 --- a/10_title +++ b/10_title @@ -32,20 +32,24 @@ function preexec() { # Loads up .env.rc or .env files if there in the current tree. # http://stackoverflow.com/questions/171563/whats-in-your-zshrc#211917 -# WTF is cd -q? -# function chpwd; { -# DIRECTORY="$PWD" -# while true; do -# if [ -f './.env.rc' ]; then -# source './.env.rc' -# break -# fi -# # if [ -f './env' ]; then -# # source './env' -# # break -# # fi -# [ $PWD = '/' ] && break -# cd -q .. -# done -# cd -q "$DIRECTORY" -# } \ No newline at end of file +# cd -q is only available on new zsh versions. +# i.e. it's in finks (4.5.6), but not Apple's (4.3.4) +if [[ $ZSH_VERSION > 4.3.4 ]]; then + function chpwd; { + DIRECTORY="$PWD" + while true; do + if [ -f './.env.rc' ]; then + source './.env.rc' + break + fi + # Removed as it clashes with zshkit'szshenv. + # if [ -f './env' ]; then + # source './env' + # break + # fi + [ $PWD = '/' ] && break + cd -q .. + done + cd -q "$DIRECTORY" + } +fi \ No newline at end of file From 2fe99460a3906d6774afaf404f1a6503fcca1cb6 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 20 Oct 2008 14:08:11 +0100 Subject: [PATCH 035/153] renamed title to hooks (more appropriate) --- 10_title => 10_hooks | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename 10_title => 10_hooks (100%) diff --git a/10_title b/10_hooks similarity index 100% rename from 10_title rename to 10_hooks From 55dabec5369f9ba975cb6ba17b6a57b7a295c63e Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 20 Oct 2008 14:08:25 +0100 Subject: [PATCH 036/153] fixed help funcion --- 03_help | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/03_help b/03_help index 7630e9f..12ac38b 100644 --- a/03_help +++ b/03_help @@ -1,6 +1,57 @@ # See From Bash to Z Shell, Page: 101 -# unalias run-help +unalias run-help +export HELPDIR='/sw/share/zsh/zsh_help' autoload -Uz run-help # From zsh-helpfiles (see fink) -export HELPDIR='/sw/share/zsh/zsh_help' -alias help=run-help \ No newline at end of file +alias help=run-help + +# From zsh-lovers +# Function Usage: doc packagename +if [[ -d /sw/share/doc ]]; then + doc() { cd /sw/share/doc/$1 && ls } + gdoc() { cd /sw/share/doc/$1 && gvim . } + _doc() { _files -W /sw/share/doc -/ } +elif [[ -d /usr/share/doc ]]; then + doc() { cd /usr/share/doc/$1 && ls } + gdoc() { cd /usr/share/doc/$1 && gvim . } + _doc() { _files -W /usr/share/doc -/ } +fi + + # provide useful information on globbing + H-Glob() { + echo -e " + / directories + . plain files + @ symbolic links + = sockets + p named pipes (FIFOs) + * executable plain files (0100) + % device files (character or block special) + %b block special files + %c character special files + r owner-readable files (0400) + w owner-writable files (0200) + x owner-executable files (0100) + A group-readable files (0040) + I group-writable files (0020) + E group-executable files (0010) + R world-readable files (0004) + W world-writable files (0002) + X world-executable files (0001) + s setuid files (04000) + S setgid files (02000) + t files with the sticky bit (01000) + print *(m-1) # List files modified today. + print *(a1) # List files accessed one day ago. + print *(@) # Print links. + print *(Lk+50) # List files > 50 Kilobytes. + print *(Lk-50) # List files < 50 Kilobytes. + print **/*.c # Recursively list all c files. + print **/*.c~file.c # List all c files, except file.c + print (foo|bar).* # List files whos names start foo or bar. + print *~*.* # + chmod 644 *(.^x) # make all non-executable files publically readable + print -l *(.c|.h) # List all c and header files on their own lines. + print **/*(g:users:) # Recursively list files with the group 'users' + echo /proc/*/cwd(:h:t:s/self//) # Analogue of >ps ax | awk '{print $1}'<" + } \ No newline at end of file From 76deabe57f7ef2846bca27936cf12a677ad1f8bc Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 20 Oct 2008 14:08:39 +0100 Subject: [PATCH 037/153] added doc function completion stuff --- rc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rc b/rc index c454e4a..2a7a69f 100644 --- a/rc +++ b/rc @@ -68,4 +68,7 @@ autoload -Uz compinit compinit autoload -Uz colors -colors \ No newline at end of file +colors + +# Needed for doc function in 03_help. +compdef _doc doc \ No newline at end of file From 83805312c455ace4fbd489e149e073ba8ec6b08f Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Tue, 21 Oct 2008 12:04:05 +0100 Subject: [PATCH 038/153] Fixed a problem with the chpwd hook when in dirs with spaces. --- 10_hooks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10_hooks b/10_hooks index 068fac3..47b4c2e 100644 --- a/10_hooks +++ b/10_hooks @@ -47,7 +47,7 @@ if [[ $ZSH_VERSION > 4.3.4 ]]; then # source './env' # break # fi - [ $PWD = '/' ] && break + [ "$PWD" = '/' ] && break cd -q .. done cd -q "$DIRECTORY" From c2cca575ac1d44dd4a54b951f64dfa4341e005cd Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 22 Oct 2008 16:59:51 +0100 Subject: [PATCH 039/153] added simple (and maybe insecure) twitter function. --- 06_twitter | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 06_twitter diff --git a/06_twitter b/06_twitter new file mode 100644 index 0000000..2d3c8ae --- /dev/null +++ b/06_twitter @@ -0,0 +1,9 @@ +# Idea from http://www.sakana.fr/blog/2007/03/18/scripting-twitter-with-curl/ +function tweet() { + if [[ -z $TWITTER_USER || -z $TWITTER_PASSWD ]]; then + echo "Plese set TWITTER_USER and TWITTER_PASSWD" + else + curl --basic --user $TWITTER_USER:$TWITTER_PASSWD --data status="$*" \ + http://twitter.com/statuses/update.xml 2>&1 > /dev/null + fi +} From 89e4d340860c42ac2a0ee32c6bd1ee046ac34f00 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 22 Oct 2008 17:00:11 +0100 Subject: [PATCH 040/153] removed unused bits --- 10_prompt | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/10_prompt b/10_prompt index 66a4057..2853364 100644 --- a/10_prompt +++ b/10_prompt @@ -1,14 +1,4 @@ setopt prompt_subst -# PROMPT='%{$reset_color%}%B%n%b@%m %~`git-prompt`%(!.#.>) ' - -# Set prompt colours depending on whether this is a local or remote connection -if [ "$SSH_CONNECTION" != "" ]; then - # Not running locally... - local COLOUR='red' -else - #Running locally... - local COLOUR='green' -fi # Set up my prompt. autoload promptinit && promptinit && prompt git green $COLOUR From a27a1b57b1193ceb5a14605173c174e4eb3f7981 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 23 Oct 2008 10:22:55 +0100 Subject: [PATCH 041/153] removed more unused prompt stuff. --- 10_prompt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10_prompt b/10_prompt index 2853364..d485141 100644 --- a/10_prompt +++ b/10_prompt @@ -1,4 +1,4 @@ setopt prompt_subst # Set up my prompt. -autoload promptinit && promptinit && prompt git green $COLOUR +autoload promptinit && promptinit && prompt git From 15795e5e18327763c0f204d3c00e3a51d3fc22d0 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 24 Oct 2008 13:34:29 +0100 Subject: [PATCH 042/153] added indication of not being on any branch, due to merge conflict, or whatever. --- 06_git | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/06_git b/06_git index 16b9e49..90acbd8 100644 --- a/06_git +++ b/06_git @@ -17,10 +17,15 @@ if [[ -x `which git` ]]; then emulate -L zsh gstatus=$(git status 2> /dev/null) branch=$(echo $gstatus | head -n 1 | sed 's/^# On branch //') + if [[ $branch == '# Not currently on any branch.' ]]; then + no_branch=1 + branch='none' + fi dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -n 2 | grep 'nothing to commit (working directory clean)'; echo $?) if [[ x$branch != x ]]; then dirty_color=$fg[cyan] if [[ $dirty = 1 ]] { dirty_color=$fg[magenta] } + if [[ $no_branch = 1 ]] { dirty_color=$fg[red] } [ x$branch != x ] && echo "%{$dirty_color%}$branch%{$reset_color%} " fi } From 5db55fba1155f61f1ed350df0d24a9992e7532dd Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 31 Oct 2008 14:34:26 +0000 Subject: [PATCH 043/153] dont unalias run-help if it isnt set up --- 03_help | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/03_help b/03_help index 12ac38b..eb29839 100644 --- a/03_help +++ b/03_help @@ -1,5 +1,7 @@ # See From Bash to Z Shell, Page: 101 -unalias run-help +if [[ $(whence -v run-help) == 'run-help is a shell function' ]]; then + unalias run-help +fi export HELPDIR='/sw/share/zsh/zsh_help' autoload -Uz run-help # From zsh-helpfiles (see fink) @@ -54,4 +56,4 @@ fi print -l *(.c|.h) # List all c and header files on their own lines. print **/*(g:users:) # Recursively list files with the group 'users' echo /proc/*/cwd(:h:t:s/self//) # Analogue of >ps ax | awk '{print $1}'<" - } \ No newline at end of file + } From 4feb23f609fae2589484deec9320fbf72441ac38 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Tue, 4 Nov 2008 10:53:53 +0000 Subject: [PATCH 044/153] commented out rc loader, since it breaks cd. --- 10_hooks | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/10_hooks b/10_hooks index 47b4c2e..f21a844 100644 --- a/10_hooks +++ b/10_hooks @@ -34,22 +34,25 @@ function preexec() { # http://stackoverflow.com/questions/171563/whats-in-your-zshrc#211917 # cd -q is only available on new zsh versions. # i.e. it's in finks (4.5.6), but not Apple's (4.3.4) -if [[ $ZSH_VERSION > 4.3.4 ]]; then - function chpwd; { - DIRECTORY="$PWD" - while true; do - if [ -f './.env.rc' ]; then - source './.env.rc' - break - fi - # Removed as it clashes with zshkit'szshenv. - # if [ -f './env' ]; then - # source './env' - # break - # fi - [ "$PWD" = '/' ] && break - cd -q .. - done - cd -q "$DIRECTORY" - } -fi \ No newline at end of file +# +# WARNING: this breaks 'cd -', since it seems to change oldpwd to /. +# +# if [[ $ZSH_VERSION > 4.3.4 ]]; then +# function chpwd; { +# DIRECTORY="$PWD" +# while true; do +# if [ -f './.env.rc' ]; then +# source './.env.rc' +# break +# fi +# # Removed as it clashes with zshkit'szshenv. +# # if [ -f './env' ]; then +# # source './env' +# # break +# # fi +# [ "$PWD" = '/' ] && break +# cd -q .. +# done +# cd -q "$DIRECTORY" +# } +# fi \ No newline at end of file From f44638a6b59eb50e4893242401d19ef54770a721 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Tue, 4 Nov 2008 10:54:27 +0000 Subject: [PATCH 045/153] remote twitter commands --- 06_twitter | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 06_twitter diff --git a/06_twitter b/06_twitter deleted file mode 100644 index 2d3c8ae..0000000 --- a/06_twitter +++ /dev/null @@ -1,9 +0,0 @@ -# Idea from http://www.sakana.fr/blog/2007/03/18/scripting-twitter-with-curl/ -function tweet() { - if [[ -z $TWITTER_USER || -z $TWITTER_PASSWD ]]; then - echo "Plese set TWITTER_USER and TWITTER_PASSWD" - else - curl --basic --user $TWITTER_USER:$TWITTER_PASSWD --data status="$*" \ - http://twitter.com/statuses/update.xml 2>&1 > /dev/null - fi -} From a2d230b6137814676d3168bfee9f473516224af5 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 7 Nov 2008 11:03:30 +0000 Subject: [PATCH 046/153] added octave aliases --- 05_octave | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 05_octave diff --git a/05_octave b/05_octave new file mode 100644 index 0000000..979912c --- /dev/null +++ b/05_octave @@ -0,0 +1,5 @@ +if [[ -e /Applications/Octave.app/Contents/Resources/bin/octave ]]; then + alias octave='/Applications/Octave.app/Contents/Resources/bin/octave -q' +else + alias octave='octave -q' +fi \ No newline at end of file From d6f35826756ffbd18e5d701123ede02a5497acce Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 10 Nov 2008 11:19:14 +0000 Subject: [PATCH 047/153] fixed the switch controlling this, added some noglob commands --- 05_apt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/05_apt b/05_apt index 96a7511..4ee6152 100644 --- a/05_apt +++ b/05_apt @@ -1,5 +1,9 @@ # Look for apt, and add some useful functions if we have it. -if [[ -x `which apt` ]]; then +if [[ -x `which apt-get` ]]; then + alias apt-get='noglob sudo apt-get' + alias apt-cache='noglob sudo apt-cache' + alias aptitude='noglob sudo aptitude' + upgrade () { if [ -z $1 ] ; then sudo apt-get update @@ -16,4 +20,4 @@ if [[ -x `which apt` ]]; then fi fi } -fi \ No newline at end of file +fi From e86d8ab739471a285c0493299949430fbf57cb1f Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 10 Nov 2008 11:32:06 +0000 Subject: [PATCH 048/153] removed silly alias --- 05_apt | 1 - 1 file changed, 1 deletion(-) diff --git a/05_apt b/05_apt index 4ee6152..4ff4885 100644 --- a/05_apt +++ b/05_apt @@ -1,7 +1,6 @@ # Look for apt, and add some useful functions if we have it. if [[ -x `which apt-get` ]]; then alias apt-get='noglob sudo apt-get' - alias apt-cache='noglob sudo apt-cache' alias aptitude='noglob sudo aptitude' upgrade () { From c6b0aa735d4b11abf2650c9e3bacd6caf2b009fb Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Tue, 11 Nov 2008 11:11:34 +0000 Subject: [PATCH 049/153] added TextMate aliases I can't live without --- 05_editor | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/05_editor b/05_editor index 7512b0d..4e0956c 100644 --- a/05_editor +++ b/05_editor @@ -7,6 +7,13 @@ function not_run_from_ssh () { if [[ -x `which mate` && $(not_run_from_ssh) = 1 ]]; then EDITOR="mate -w" + # Useful functions for bundle development + function reload_textmate(){ + osascript -e 'tell app "TextMate" to reload bundles' + } + function bundle () { + cd "$HOME/Library/Application Support/TextMate/Bundles/$1.tmbundle" + } elif [[ -x `which gvim` ]]; then EDITOR=gvim elif [[ -x `which vim` ]]; then @@ -35,3 +42,4 @@ if [[ $OSTYPE[1,6] == "darwin" ]]; then alias -s $s=open done fi + From 908c66f4c537042952508a65b5d81e35d427f729 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 17 Nov 2008 10:24:04 +0000 Subject: [PATCH 050/153] merged in git-toggle from cherry-pick of ea226f2 --- 06_git | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/06_git b/06_git index 90acbd8..4e29fbb 100644 --- a/06_git +++ b/06_git @@ -1,4 +1,5 @@ if [[ -x `which git` ]]; then + git_enable=1 function git-branch-name () { git branch 2> /dev/null | grep '^\*' | sed 's/^\*\ //' } @@ -13,20 +14,32 @@ if [[ -x `which git` ]]; then git checkout "${branch}" git rebase master } + function git-toggle() { + if [[ $git_enable = 1 ]]; then + git_enable=0 + else + git_enable=1 + fi + } function git-prompt() { - emulate -L zsh - gstatus=$(git status 2> /dev/null) + emulate -L zsh + dirty_color=$fg[cyan] branch=$(echo $gstatus | head -n 1 | sed 's/^# On branch //') if [[ $branch == '# Not currently on any branch.' ]]; then no_branch=1 branch='none' - fi - dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -n 2 | grep 'nothing to commit (working directory clean)'; echo $?) - if [[ x$branch != x ]]; then - dirty_color=$fg[cyan] - if [[ $dirty = 1 ]] { dirty_color=$fg[magenta] } - if [[ $no_branch = 1 ]] { dirty_color=$fg[red] } - [ x$branch != x ] && echo "%{$dirty_color%}$branch%{$reset_color%} " + fi + if [[ $git_enable = 1 ]]; then + gstatus=$(git status 2> /dev/null) + branch=$(echo $gstatus | head -n 1 | sed 's/^# On branch //') + dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -n 2 | grep 'nothing to commit (working directory clean)'; echo $?) + if [[ x$branch != x ]]; then + if [[ $dirty = 1 ]] { dirty_color=$fg[magenta] } + if [[ $no_branch = 1 ]] { dirty_color=$fg[red] } + [ x$branch != x ] && echo "[%{$dirty_color%}$branch%{$reset_color%}]" + fi + else + echo "%{$dirty_color%}!%{$reset_color%}" fi } function git-scoreboard () { From 5ba6b6574c0b46edee99c0986d789625a7b34bf1 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 17 Nov 2008 10:24:54 +0000 Subject: [PATCH 051/153] removed square brackets from branch --- 06_git | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/06_git b/06_git index 4e29fbb..d26774c 100644 --- a/06_git +++ b/06_git @@ -36,7 +36,7 @@ if [[ -x `which git` ]]; then if [[ x$branch != x ]]; then if [[ $dirty = 1 ]] { dirty_color=$fg[magenta] } if [[ $no_branch = 1 ]] { dirty_color=$fg[red] } - [ x$branch != x ] && echo "[%{$dirty_color%}$branch%{$reset_color%}]" + [ x$branch != x ] && echo "%{$dirty_color%}$branch%{$reset_color%}" fi else echo "%{$dirty_color%}!%{$reset_color%}" From d13b65b0d14e6c6b546a4d7e4dbf2362e213bdb4 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 17 Nov 2008 10:25:39 +0000 Subject: [PATCH 052/153] added extra space to git-prompt output --- 06_git | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/06_git b/06_git index d26774c..9760479 100644 --- a/06_git +++ b/06_git @@ -36,7 +36,7 @@ if [[ -x `which git` ]]; then if [[ x$branch != x ]]; then if [[ $dirty = 1 ]] { dirty_color=$fg[magenta] } if [[ $no_branch = 1 ]] { dirty_color=$fg[red] } - [ x$branch != x ] && echo "%{$dirty_color%}$branch%{$reset_color%}" + [ x$branch != x ] && echo "%{$dirty_color%}$branch%{$reset_color%} " fi else echo "%{$dirty_color%}!%{$reset_color%}" From 1d478b5abeda56f7cfbaa3b2ec027ed37384e7c8 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 17 Nov 2008 16:23:37 +0000 Subject: [PATCH 053/153] initialise completion for bundle function. --- 07_completion | 2 ++ 1 file changed, 2 insertions(+) diff --git a/07_completion b/07_completion index 84399f9..2036acc 100644 --- a/07_completion +++ b/07_completion @@ -1,2 +1,4 @@ # Files to ignore during completion fignore=(DS_Store $fignore) +# Set up completion for bundle function in 05_editor. +compdef _bundle bundle \ No newline at end of file From c3668039d51914931c62f8770cb6af337fc80a0d Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 17 Nov 2008 16:23:52 +0000 Subject: [PATCH 054/153] added completion for bundle function. --- 05_editor | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/05_editor b/05_editor index 4e0956c..fa62bb7 100644 --- a/05_editor +++ b/05_editor @@ -14,6 +14,10 @@ if [[ -x `which mate` && $(not_run_from_ssh) = 1 ]]; then function bundle () { cd "$HOME/Library/Application Support/TextMate/Bundles/$1.tmbundle" } + _bundle() { + bundle_path="$HOME/Library/Application Support/TextMate/Bundles" + compadd $(print -l $bundle_path/*.tmbundle(:t:r)) + } elif [[ -x `which gvim` ]]; then EDITOR=gvim elif [[ -x `which vim` ]]; then From 6829901e40fc96772e40e37b3a096c86ce8b9592 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 17 Nov 2008 20:27:25 +0000 Subject: [PATCH 055/153] shifted compdef to correct place --- 07_completion | 4 +--- rc | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/07_completion b/07_completion index 2036acc..4207cfa 100644 --- a/07_completion +++ b/07_completion @@ -1,4 +1,2 @@ # Files to ignore during completion -fignore=(DS_Store $fignore) -# Set up completion for bundle function in 05_editor. -compdef _bundle bundle \ No newline at end of file +fignore=(DS_Store $fignore) \ No newline at end of file diff --git a/rc b/rc index 2a7a69f..71087fe 100644 --- a/rc +++ b/rc @@ -71,4 +71,6 @@ autoload -Uz colors colors # Needed for doc function in 03_help. -compdef _doc doc \ No newline at end of file +compdef _doc doc +# Set up completion for bundle function in 05_editor. +compdef _bundle bundle \ No newline at end of file From dee66832c9f31098d02350f7ba2e172fa0a8aa60 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 21 Nov 2008 12:31:34 +0000 Subject: [PATCH 056/153] fixed weird shlvl problem. --- env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env b/env index 8e524bb..92c3d64 100644 --- a/env +++ b/env @@ -1,4 +1,4 @@ -if [[ $SHLVL < 3 ]]; then +if [[ $SHLVL < 4 ]]; then mydir=`dirname $0` for f in $mydir/??_*; do From d5e3bd04ecc0a22139800f1f0d1be16585925626 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 28 Nov 2008 15:06:24 +0000 Subject: [PATCH 057/153] added function for quickly making quicktime movies from image sequences. --- 05_quicktime | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 05_quicktime diff --git a/05_quicktime b/05_quicktime new file mode 100644 index 0000000..7a6a5e8 --- /dev/null +++ b/05_quicktime @@ -0,0 +1,19 @@ +if [[ -x `which ggrep` ]]; then + create_image_mov() { + if [[ $# = 0 ]] + then + echo "Usage: $0 program" + echo "Create movie using png compression." + echo "Example: $0 watershed_01.png (outputs watershed.mov)" + echo "Example: $0 watershed_01.png out.mov (outputs out.mov)" + else + if [[ $# > 1 ]] + then + out=$2 + else + out=$(echo $aa:r | sed 's/_*[0-9]*//g').mov + fi + qt_export --sequencerate=1 $1 --video=png,1 --audio=0 --replacefile $out + fi + } +fi \ No newline at end of file From 88d216fc1c0965e8d3f055e85e22ea39d66e8035 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 28 Nov 2008 15:07:49 +0000 Subject: [PATCH 058/153] Added link to qt_tools. --- 05_quicktime | 1 + 1 file changed, 1 insertion(+) diff --git a/05_quicktime b/05_quicktime index 7a6a5e8..1a92b9a 100644 --- a/05_quicktime +++ b/05_quicktime @@ -1,3 +1,4 @@ +# See: http://omino.com/sw/qt_tools/ if [[ -x `which ggrep` ]]; then create_image_mov() { if [[ $# = 0 ]] From 534e710db2cae477f32f216b764ff102faa19b16 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 28 Nov 2008 15:09:39 +0000 Subject: [PATCH 059/153] Fixed test to actually have qt_export. --- 05_quicktime | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/05_quicktime b/05_quicktime index 1a92b9a..a083ff9 100644 --- a/05_quicktime +++ b/05_quicktime @@ -1,5 +1,5 @@ # See: http://omino.com/sw/qt_tools/ -if [[ -x `which ggrep` ]]; then +if [[ -x `which qt_export` ]]; then create_image_mov() { if [[ $# = 0 ]] then From e771b2e250129f10145cd543dc36c94517ba4907 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 28 Nov 2008 15:11:27 +0000 Subject: [PATCH 060/153] update usage instructions --- 05_quicktime | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/05_quicktime b/05_quicktime index a083ff9..e87acea 100644 --- a/05_quicktime +++ b/05_quicktime @@ -3,7 +3,7 @@ if [[ -x `which qt_export` ]]; then create_image_mov() { if [[ $# = 0 ]] then - echo "Usage: $0 program" + echo "Usage: $0 image_name move_name" echo "Create movie using png compression." echo "Example: $0 watershed_01.png (outputs watershed.mov)" echo "Example: $0 watershed_01.png out.mov (outputs out.mov)" From c797cf81f4ca7514f9591ede3fdedc7884d9d1d0 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 1 Dec 2008 16:25:57 +0000 Subject: [PATCH 061/153] removed repeated functionality --- 05_textmate | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 05_textmate diff --git a/05_textmate b/05_textmate deleted file mode 100644 index 7ac63ab..0000000 --- a/05_textmate +++ /dev/null @@ -1,12 +0,0 @@ -# Useful functions for bundle development -if [[ -x `which mate` ]]; then - function mate_reload(){ - osascript -e 'tell app "TextMate" to reload bundles' - } - function mate_bundle () { - cd "$HOME/Library/Application Support/TextMate/Bundles/$1.tmbundle" - } - function mate_pristine () { - cd "$HOME/Library/Application Support/TextMate/Pristine Copy/Bundles/$1.tmbundle" - } -fi From 92aa6344528638861f602cad6e7d37967737c628 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Tue, 30 Dec 2008 12:11:55 +0100 Subject: [PATCH 062/153] add .pyc to ignored files --- rc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rc b/rc index 71087fe..7588ab0 100644 --- a/rc +++ b/rc @@ -32,13 +32,13 @@ zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns \ zstyle ':completion:*:javac:*' files '*.java' # no binary files for vi or textmate -zstyle ':completion:*:vi:*' ignored-patterns '*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc|class|pdf|ps)' -zstyle ':completion:*:mate:*' ignored-patterns '*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc|class|pdf|ps)' -zstyle ':completion:*:vim:*' ignored-patterns '*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc|class|pdf|ps)' -zstyle ':completion:*:gvim:*' ignored-patterns '*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc|class|pdf|ps)' +zstyle ':completion:*:vi:*' ignored-patterns '*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc|class|pdf|ps|pyc)' +zstyle ':completion:*:mate:*' ignored-patterns '*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc|class|pdf|ps|pyc)' +zstyle ':completion:*:vim:*' ignored-patterns '*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc|class|pdf|ps|pyc)' +zstyle ':completion:*:gvim:*' ignored-patterns '*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc|class|pdf|ps|pyc)' # no binary files for less -zstyle ':completion:*:less:*' ignored-patterns '*.(o|a|so|dvi|fig|out|class|pdf|ps)' -zstyle ':completion:*:zless:*' ignored-patterns '*.(o|a|so|dvi|fig|out|class|pdf|ps)' +zstyle ':completion:*:less:*' ignored-patterns '*.(o|a|so|dvi|fig|out|class|pdf|ps|pyc)' +zstyle ':completion:*:zless:*' ignored-patterns '*.(o|a|so|dvi|fig|out|class|pdf|ps|pyc)' # pdf for xpdf zstyle ':completion:*:xpdf:*' files '*.pdf' # tar files From 76898dfb5bb931782d8130a400e9d60b80a7a6c3 Mon Sep 17 00:00:00 2001 From: Ryan Baumann Date: Mon, 29 Sep 2008 14:47:56 -0400 Subject: [PATCH 063/153] Add common rsync command alias --- 05_rsync | 1 + 1 file changed, 1 insertion(+) create mode 100644 05_rsync diff --git a/05_rsync b/05_rsync new file mode 100644 index 0000000..abf0fc4 --- /dev/null +++ b/05_rsync @@ -0,0 +1 @@ +alias rsyncp='rsync -avz -e ssh --progress --partial ' From b666ab87069a0433fcf01b361e67938041e9a59a Mon Sep 17 00:00:00 2001 From: Bryce Kerley Date: Wed, 14 Jan 2009 09:44:08 -0500 Subject: [PATCH 064/153] sam's git-track (cherry picked from commit e3f2b49519901c076fecfb7372b508476c9e0c2b) (cherry picked from commit 06248df075b3c3b4a0ba84bd0bacfe9df9c15c47) --- 06_git | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/06_git b/06_git index 9760479..ee4eae5 100644 --- a/06_git +++ b/06_git @@ -45,6 +45,12 @@ if [[ -x `which git` ]]; then function git-scoreboard () { git log | grep Author | sort | uniq -ci | sort -r } + function git-track () { + branch=$(git-branch-name) + git config branch.$branch.remote origin + git config branch.$branch.merge refs/heads/$branch + echo "tracking origin/$tracking" + } function github-init () { git config branch.$(git-branch-name).remote origin git config branch.$(git-branch-name).merge refs/heads/$(git-branch-name) From 1c0de57a9c3269795e79eee2b447913b90fcd83d Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 22 Jan 2009 11:33:51 +0000 Subject: [PATCH 065/153] put git aliases inside test --- 06_git | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/06_git b/06_git index ee4eae5..ff6e7e6 100644 --- a/06_git +++ b/06_git @@ -22,7 +22,7 @@ if [[ -x `which git` ]]; then fi } function git-prompt() { - emulate -L zsh + emulate -L zsh dirty_color=$fg[cyan] branch=$(echo $gstatus | head -n 1 | sed 's/^# On branch //') if [[ $branch == '# Not currently on any branch.' ]]; then @@ -68,22 +68,24 @@ if [[ -x `which git` ]]; then function nhgk () { nohup gitk --all & } -fi -alias gb='git branch -a -v' -alias gs='git status' -alias gd='git diff' -alias gf='git fetch' -alias gr='git-rebase' -alias gsc='git-svn dcommit' -alias gsr='git-svn rebase' -alias gsf='git-svn fetch' -# gc => git checkout master -# gc bugs => git checkout bugs -function gc { + + alias g='git' + alias gb='git branch -a -v' + alias gs='git status' + alias gd='git diff' + alias gf='git fetch' + alias gr='git-rebase' + alias gsc='git-svn dcommit' + alias gsr='git-svn rebase' + alias gsf='git-svn fetch' + # gc => git checkout master + # gc bugs => git checkout bugs + function gc { if [ -z "$1" ]; then git checkout master - else + else git checkout $1 fi -} + } +fi \ No newline at end of file From 0f35c8aaa03e65b190c9e77be1ac60b491733ca6 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 22 Jan 2009 11:40:01 +0000 Subject: [PATCH 066/153] added zmv aliases --- 06_zmv | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 06_zmv diff --git a/06_zmv b/06_zmv new file mode 100644 index 0000000..755c49d --- /dev/null +++ b/06_zmv @@ -0,0 +1,3 @@ +# See http://strcat.neessen.net/zsh/ for examples +autoload -Uz zmv +alias mmv='noglob zmv -W' From 012ec235bc5e4c19326916b635d12a54c1c2fade Mon Sep 17 00:00:00 2001 From: Bryce Kerley Date: Mon, 20 Oct 2008 14:16:59 -0400 Subject: [PATCH 067/153] seq alias for systems without it (mac) (cherry picked from commit 7a55a4a6a2200fce0e8e8010ae99d9ec21427498) --- 05_seq | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 05_seq diff --git a/05_seq b/05_seq new file mode 100644 index 0000000..fddd2e0 --- /dev/null +++ b/05_seq @@ -0,0 +1,3 @@ +if [[ ! ( -x `which seq` ) && ( -x `which gseq` ) ]]; then + alias seq=`which gseq` +fi From 92e3bffac53e2508729de3cdcf0d136463990d45 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 23 Jan 2009 15:04:25 +0000 Subject: [PATCH 068/153] added grml style abbreviations --- 10_abbreviations | 78 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 10_abbreviations diff --git a/10_abbreviations b/10_abbreviations new file mode 100644 index 0000000..c15b3f5 --- /dev/null +++ b/10_abbreviations @@ -0,0 +1,78 @@ +# Seen at: http://github.com/strcat/dotfiles/ and in grml. +# Robust replacement for global aliases, and you can edit them too. +# requires extended globbing. + +typeset -A abbrevs +abbrevs=( + '...' '../..' + '....' '../../..' + 'BG' '& exit' + 'C' '| wc -l' + 'G' '|& grep --color=auto' + 'H' '| head' + 'L' '| less' + 'LL' '|& less -r' + 'N' '&>/dev/null' + 'R' '| tr A-z N-za-m' + 'SL' '| sort | less' + 'S' '| sort -u' + 'T' '| tail' + 'da' 'du -sch' + 'j' 'jobs -l' + 'u' 'translate -i' + 'co' "./configure && make && sudo make install" + 'CH' "./configure --help" + 'dir' 'ls -lSrah' + 'lad' $'ls -d .*(/)\n# only show dot-directories' + 'lsa' $'ls -a .*(.)\n# only show dot-files' + 'lss' $'ls -l *(s,S,t)\n# only files with setgid/setuid/sticky flag' + 'lsl' $'ls -l *(@[1,10])\n# only symlinks' + 'lsx' $'ls -l *(*[1,10])\n# only executables' + 'lsw' $'ls -ld *(R,W,X.^ND/)\n# world-{readable,writable,executable} files' + 'lsbig' $'ls -flh *(.OL[1,10])\n# display the biggest files' + 'lsd' $'ls -d *(/)\n# only show directories' + 'lse' $'ls -d *(/^F)\n# only show empty directories' + 'lsnew' $'ls -rl *(D.om[1,10])\n# display the newest files' + 'lsold' $'ls -rtlh *(D.om[-11,-1])\n # display the oldest files' + 'lssmall' $'ls -Srl *(.oL[1,10])\n# display the smallest files' + 'rw-' 'chmod 600' + '600' 'chmod u+rw-x,g-rwx,o-rwx' + 'rwx' 'chmod u+rwx' + '700' 'chmod u+rwx,g-rwx,o-rwx' + 'r--' 'chmod u+r-wx,g-rwx,o-rwx' + '644' $'chmod u+rw-x,g+r-wx,o+r-wx\n # 4=r,2=w,1=x' + '755' 'chmod u+rwx,g+r-w+x,o+r-w+x' + 'md' 'mkdir -p ' + 'insecssh' 'ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"' + 'insecscp' 'scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"' + 'fori' 'for i ({..}) { }' + 'cx' 'chmod +x' + 'e' 'print -l' + 'se' 'setopt interactivecomments' +) + +globalias() { + local MATCH + + if (( NOABBREVIATION > 0 )) ; then + LBUFFER="${LBUFFER},." + return 0 + fi + + matched_chars='[.-|_a-zA-Z0-9]#' + LBUFFER=${LBUFFER%%(#m)[.-|_a-zA-Z0-9]#} + LBUFFER+=${abbrevs[$MATCH]:-$MATCH} +} + +zle -N globalias +bindkey ",." globalias + +# run command line as user root via sudo: +sudo-command-line() { + [[ -z $BUFFER ]] && zle up-history + [[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER" +} +zle -N sudo-command-line + +#k# Put the current command line into a \kbd{sudo} call +bindkey "^Os" sudo-command-line From f70f5bcaf4024789cfb1f6ad1f92b125baadd43b Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 25 Jan 2009 18:08:35 +0000 Subject: [PATCH 069/153] Added abbreviation help command in style of H-Glob --- 10_abbreviations | 101 +++++++++++++++++++++++++---------------------- rc | 2 +- 2 files changed, 55 insertions(+), 48 deletions(-) diff --git a/10_abbreviations b/10_abbreviations index c15b3f5..63179f4 100644 --- a/10_abbreviations +++ b/10_abbreviations @@ -3,53 +3,51 @@ # requires extended globbing. typeset -A abbrevs -abbrevs=( - '...' '../..' - '....' '../../..' - 'BG' '& exit' - 'C' '| wc -l' - 'G' '|& grep --color=auto' - 'H' '| head' - 'L' '| less' - 'LL' '|& less -r' - 'N' '&>/dev/null' - 'R' '| tr A-z N-za-m' - 'SL' '| sort | less' - 'S' '| sort -u' - 'T' '| tail' - 'da' 'du -sch' - 'j' 'jobs -l' - 'u' 'translate -i' - 'co' "./configure && make && sudo make install" - 'CH' "./configure --help" - 'dir' 'ls -lSrah' - 'lad' $'ls -d .*(/)\n# only show dot-directories' - 'lsa' $'ls -a .*(.)\n# only show dot-files' - 'lss' $'ls -l *(s,S,t)\n# only files with setgid/setuid/sticky flag' - 'lsl' $'ls -l *(@[1,10])\n# only symlinks' - 'lsx' $'ls -l *(*[1,10])\n# only executables' - 'lsw' $'ls -ld *(R,W,X.^ND/)\n# world-{readable,writable,executable} files' - 'lsbig' $'ls -flh *(.OL[1,10])\n# display the biggest files' - 'lsd' $'ls -d *(/)\n# only show directories' - 'lse' $'ls -d *(/^F)\n# only show empty directories' - 'lsnew' $'ls -rl *(D.om[1,10])\n# display the newest files' - 'lsold' $'ls -rtlh *(D.om[-11,-1])\n # display the oldest files' - 'lssmall' $'ls -Srl *(.oL[1,10])\n# display the smallest files' - 'rw-' 'chmod 600' - '600' 'chmod u+rw-x,g-rwx,o-rwx' - 'rwx' 'chmod u+rwx' - '700' 'chmod u+rwx,g-rwx,o-rwx' - 'r--' 'chmod u+r-wx,g-rwx,o-rwx' - '644' $'chmod u+rw-x,g+r-wx,o+r-wx\n # 4=r,2=w,1=x' - '755' 'chmod u+rwx,g+r-w+x,o+r-w+x' - 'md' 'mkdir -p ' - 'insecssh' 'ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"' - 'insecscp' 'scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"' - 'fori' 'for i ({..}) { }' - 'cx' 'chmod +x' - 'e' 'print -l' - 'se' 'setopt interactivecomments' -) +abbrevs=('...' '../..' + '....' '../../..' + 'BG' '& exit' + 'C' '| wc -l' + 'G' '|& grep --color=auto' + 'H' '| head' + 'L' '| less' + 'LL' '|& less -r' + 'N' '&>/dev/null' + 'R' '| tr A-z N-za-m' + 'SL' '| sort | less' + 'S' '| sort -u' + 'T' '| tail' + 'da' 'du -sch' + 'j' 'jobs -l' + 'u' 'translate -i' + 'co' "./configure && make && sudo make install" + 'CH' "./configure --help" + 'dir' 'ls -lSrah' + 'lad' $'ls -d .*(/)\n# only show dot-directories' + 'lsa' $'ls -a .*(.)\n# only show dot-files' + 'lss' $'ls -l *(s,S,t)\n# only files with setgid/setuid/sticky flag' + 'lsl' $'ls -l *(@[1,10])\n# only symlinks' + 'lsx' $'ls -l *(*[1,10])\n# only executables' + 'lsw' $'ls -ld *(R,W,X.^ND/)\n# world-{readable,writable,executable} files' + 'lsbig' $'ls -flh *(.OL[1,10])\n# display the biggest files' + 'lsd' $'ls -d *(/)\n# only show directories' + 'lse' $'ls -d *(/^F)\n# only show empty directories' + 'lsnew' $'ls -rl *(D.om[1,10])\n# display the newest files' + 'lsold' $'ls -rtlh *(D.om[-11,-1])\n# display the oldest files' + 'lssmall' $'ls -Srl *(.oL[1,10])\n# display the smallest files' + 'rw-' 'chmod 600' + '600' 'chmod u+rw-x,g-rwx,o-rwx' + 'rwx' 'chmod u+rwx' + '700' 'chmod u+rwx,g-rwx,o-rwx' + 'r--' 'chmod u+r-wx,g-rwx,o-rwx' + '644' $'chmod u+rw-x,g+r-wx,o+r-wx\n # 4=r,2=w,1=x' + '755' 'chmod u+rwx,g+r-w+x,o+r-w+x' + 'md' 'mkdir -p ' + 'insecssh' 'ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"' + 'insecscp' 'scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"' + 'cx' 'chmod +x' + 'e' 'print -l' + 'se' 'setopt interactivecomments' + ) globalias() { local MATCH @@ -67,6 +65,15 @@ globalias() { zle -N globalias bindkey ",." globalias +# List abbreviations and key binding +H-Abbrevs() { + echo "Displaying shell abbreviations" + echo "Keybinding is:" ${$(bindkey | grep globalias)[1]} + for key in ${(ok)abbrevs}; do + printf "%-20s: %s\n" $key $abbrevs[$key] + done +} + # run command line as user root via sudo: sudo-command-line() { [[ -z $BUFFER ]] && zle up-history diff --git a/rc b/rc index 7588ab0..7249585 100644 --- a/rc +++ b/rc @@ -3,7 +3,7 @@ setopt AUTOPUSHD PUSHDMINUS PUSHDSILENT PUSHDTOHOME setopt AUTOCD # cd by typing dirname setopt cdablevars # Follow variables which are dirnames setopt interactivecomments # allow comments on cmd line. -setopt SH_WORD_SPLIT # split up var in "for x in *" +# setopt SH_WORD_SPLIT # split up var in "for x in *" setopt MULTIOS # Allow multiple redirection echo 'a'>b>c setopt CORRECT CORRECT_ALL # Try to correct command line spelling setopt BANG_HIST # Allow ! for accessing history From cea4b6ad5c05702a5806af89dac4500bca1a7c0e Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 26 Jan 2009 10:25:14 +0000 Subject: [PATCH 070/153] =?UTF-8?q?Updated=20keybindings.=20=E2=80=A2=20`?= =?UTF-8?q?=E2=90=A3`:=20magic-space=20=E2=80=A2=20`=E2=90=A3=E2=90=A3`:?= =?UTF-8?q?=20expand=20abbreviation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10_abbreviations | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/10_abbreviations b/10_abbreviations index 63179f4..17dd5d0 100644 --- a/10_abbreviations +++ b/10_abbreviations @@ -50,20 +50,16 @@ abbrevs=('...' '../..' ) globalias() { - local MATCH - - if (( NOABBREVIATION > 0 )) ; then - LBUFFER="${LBUFFER},." - return 0 - fi - - matched_chars='[.-|_a-zA-Z0-9]#' - LBUFFER=${LBUFFER%%(#m)[.-|_a-zA-Z0-9]#} - LBUFFER+=${abbrevs[$MATCH]:-$MATCH} + local MATCH + LBUFFER=${LBUFFER%%(#m)[_a-zA-Z0-9]#} + LBUFFER+=${abbrevs[$MATCH]:-$MATCH} + zle self-insert } zle -N globalias -bindkey ",." globalias +bindkey " " globalias +bindkey " " magic-space + # List abbreviations and key binding H-Abbrevs() { From 944471b025104304e3dcfb8a3a8eb33967383df2 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 26 Jan 2009 10:25:33 +0000 Subject: [PATCH 071/153] moved keybindings --- rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc b/rc index 7249585..8757e3e 100644 --- a/rc +++ b/rc @@ -62,7 +62,7 @@ zstyle ':completion:*' auto-description 'specify: %d' zstyle ':completion:*:default' list-prompt '%S%M matches%s' # Expand out ! when I press space. -bindkey ' ' magic-space +# bindkey ' ' magic-space autoload -Uz compinit compinit From a525ed6059f3a4ce123ba0f35cfefecfad63772a Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 26 Jan 2009 10:34:22 +0000 Subject: [PATCH 072/153] A few more tweaks. --- 10_abbreviations | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/10_abbreviations b/10_abbreviations index 17dd5d0..a0450a6 100644 --- a/10_abbreviations +++ b/10_abbreviations @@ -18,7 +18,6 @@ abbrevs=('...' '../..' 'T' '| tail' 'da' 'du -sch' 'j' 'jobs -l' - 'u' 'translate -i' 'co' "./configure && make && sudo make install" 'CH' "./configure --help" 'dir' 'ls -lSrah' @@ -61,12 +60,14 @@ bindkey " " globalias bindkey " " magic-space -# List abbreviations and key binding +# List abbreviations and key binding, picks out help in green. H-Abbrevs() { echo "Displaying shell abbreviations" echo "Keybinding is:" ${$(bindkey | grep globalias)[1]} for key in ${(ok)abbrevs}; do - printf "%-20s: %s\n" $key $abbrevs[$key] + printf "%-20s: %s" $key ${abbrevs[$key]:s/ +/$fg[green] /} # Replaces newlines with spaces + print -l $reset_color done } From 37ea003f935f1a788a6963511b38f37a1fcc32f0 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Tue, 27 Jan 2009 13:02:53 +0000 Subject: [PATCH 073/153] added my own python library path. --- 05_python | 3 +++ 1 file changed, 3 insertions(+) diff --git a/05_python b/05_python index 6e44290..97faad7 100644 --- a/05_python +++ b/05_python @@ -1 +1,4 @@ +export PYTHONPATH=$HOME/.python_libraries +typeset -U PYTHONPATH + alias pylab='ipython -pylab -wthread' From ae029f89ed1076b0e1a173bb04dad7cb5941b6a3 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Tue, 27 Jan 2009 13:03:05 +0000 Subject: [PATCH 074/153] playing with paths --- 01_path | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/01_path b/01_path index d950176..6d1b4da 100644 --- a/01_path +++ b/01_path @@ -7,13 +7,10 @@ pathdirs=(/Library/Frameworks/Python.framework/Versions/Current/bin ~/bin ) for dir ($pathdirs) - if [[ -x $dir ]]; then + if [[ -d $dir ]]; then path=($dir $path) fi -# This should remove possible dups -typeset -U path - # Allow MacPorts man pages and others dirs=( /usr/local/git/man /sw/share/man /opt/local/man ) for dir ($dirs) @@ -21,13 +18,11 @@ for dir ($dirs) manpath=($manpath $dir) fi -typeset -U manpath - # Add function paths funcdirs=( $HOME/.zsh/func /sw/share/zsh/ ) for dir ($funcdirs) if [[ -x $dir ]]; then fpath=($fpath $dir) fi - -typeset -U fpath + +typeset -gU path cdpath manpath fpath From ac8769f51e562ef42429ae79c4e2730071ab85ce Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 29 Jan 2009 10:53:52 +0000 Subject: [PATCH 075/153] added noglob prefix function --- 10_abbreviations | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/10_abbreviations b/10_abbreviations index a0450a6..1b80b90 100644 --- a/10_abbreviations +++ b/10_abbreviations @@ -59,7 +59,6 @@ zle -N globalias bindkey " " globalias bindkey " " magic-space - # List abbreviations and key binding, picks out help in green. H-Abbrevs() { echo "Displaying shell abbreviations" @@ -77,6 +76,13 @@ sudo-command-line() { [[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER" } zle -N sudo-command-line - -#k# Put the current command line into a \kbd{sudo} call +# Put the current command line into a sudo call bindkey "^Os" sudo-command-line + +# run command line with noglob set: +noglob-command-line() { + [[ -z $BUFFER ]] && zle up-history + [[ $BUFFER != noglob\ * ]] && BUFFER="noglob $BUFFER" +} +zle -N noglob-command-line +bindkey "^Og" noglob-command-line From 8efb6b58ebfaecf38d9d5e0b591c8ea5a3a9c43a Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 29 Jan 2009 10:55:03 +0000 Subject: [PATCH 076/153] moved abbreviations so we can bind the keys in the correct place --- 10_abbreviations => 09_abbreviations | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename 10_abbreviations => 09_abbreviations (100%) diff --git a/10_abbreviations b/09_abbreviations similarity index 100% rename from 10_abbreviations rename to 09_abbreviations From 5b7d162557b4c6de1f8b5949c29720573e56b379 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 29 Jan 2009 11:13:01 +0000 Subject: [PATCH 077/153] Moved some keybindings. --- 09_abbreviations | 5 ----- 10_bindkey | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/09_abbreviations b/09_abbreviations index 1b80b90..120c278 100644 --- a/09_abbreviations +++ b/09_abbreviations @@ -56,8 +56,6 @@ globalias() { } zle -N globalias -bindkey " " globalias -bindkey " " magic-space # List abbreviations and key binding, picks out help in green. H-Abbrevs() { @@ -76,8 +74,6 @@ sudo-command-line() { [[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER" } zle -N sudo-command-line -# Put the current command line into a sudo call -bindkey "^Os" sudo-command-line # run command line with noglob set: noglob-command-line() { @@ -85,4 +81,3 @@ noglob-command-line() { [[ $BUFFER != noglob\ * ]] && BUFFER="noglob $BUFFER" } zle -N noglob-command-line -bindkey "^Og" noglob-command-line diff --git a/10_bindkey b/10_bindkey index 7774340..35036a3 100644 --- a/10_bindkey +++ b/10_bindkey @@ -1,2 +1,8 @@ bindkey "${key[Home]}" beginning-of-line bindkey "${key[End]}" end-of-line + +bindkey " " globalias +bindkey " " magic-space + +bindkey "^Og" noglob-command-line +bindkey "^Os" sudo-command-line From ff4c2a12ab7b18ba5e5c8a443ee1449f71045201 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 30 Jan 2009 13:02:44 +0000 Subject: [PATCH 078/153] added vcs_info path --- 01_path | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01_path b/01_path index 6d1b4da..22fddbf 100644 --- a/01_path +++ b/01_path @@ -19,7 +19,7 @@ for dir ($dirs) fi # Add function paths -funcdirs=( $HOME/.zsh/func /sw/share/zsh/ ) +funcdirs=( $HOME/.zsh/func /sw/share/zsh/ /sw/share/zsh/VCS_Info ) for dir ($funcdirs) if [[ -x $dir ]]; then fpath=($fpath $dir) From 381a88bfc892df2a5a38b747b44f833a786cb6ec Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 30 Jan 2009 19:33:29 +0000 Subject: [PATCH 079/153] playing with vcs_info --- 01_path | 2 +- 10_hooks | 12 ++++++++++++ func/prompt_git_setup | 12 ++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/01_path b/01_path index 22fddbf..59fa9d4 100644 --- a/01_path +++ b/01_path @@ -19,7 +19,7 @@ for dir ($dirs) fi # Add function paths -funcdirs=( $HOME/.zsh/func /sw/share/zsh/ /sw/share/zsh/VCS_Info ) +funcdirs=( $HOME/.zsh/func /sw/share/zsh/ /sw/share/zsh/VCS_Info /sw/share/zsh/VCS_Info/Backends) for dir ($funcdirs) if [[ -x $dir ]]; then fpath=($fpath $dir) diff --git a/10_hooks b/10_hooks index f21a844..e9c2fe6 100644 --- a/10_hooks +++ b/10_hooks @@ -20,8 +20,20 @@ function title() { esac } +function dirty() { + # check if repository is dirty + if (! ((git diff --cached --quiet) && (git diff --quiet))); then + return 1 + else + return 0 + fi +} + # precmd is called just before the prompt is printed function precmd() { + psvar=() + vcs_info + [[ -n $vcs_info_msg_0_ ]] && psvar[1]="${vcs_info_msg_0_}" title "zsh" "$USER@%m" "%55<...<%~" } diff --git a/func/prompt_git_setup b/func/prompt_git_setup index 6ccdfa6..5f264cd 100644 --- a/func/prompt_git_setup +++ b/func/prompt_git_setup @@ -12,6 +12,14 @@ # Prompt setup function function prompt_git_setup { unset PS1 PS2 PS3 PS4 PROMPT RPROMPT + + autoload -Uz vcs_info + zstyle ':vcs_info:*' formats '%b ' + zstyle ':vcs_info:*' actionformats '(%r) %b ' + zstyle ':vcs_info:*' enable git cvs svn hg bzr + # vcs_info also needs to be in precmd, see: 10_hooks + vcs_info + # Colours accepted as arguments local u_col=${1:-'green'} local h_col=${2:-'green'} @@ -23,8 +31,8 @@ function prompt_git_setup { # "%{$fg_bold[$u_col]%}%n@" # "%{$fg_bold[$h_col]%}%m " "%{$fg_bold[$d_col]%}%1~" - "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%} " - '`git-prompt`' + "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%} %{$reset_color%}" + "%1v%{$reset_color%}" # requires vcs_info "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%}$ " "%{$reset_color%}" ) From 3d813340ca8331320fed56ae133dabe82584cf8e Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 30 Jan 2009 23:11:40 +0000 Subject: [PATCH 080/153] Still playing with vcs_info --- 10_hooks | 7 ++++--- func/prompt_git_setup | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/10_hooks b/10_hooks index e9c2fe6..1ad6c91 100644 --- a/10_hooks +++ b/10_hooks @@ -20,7 +20,7 @@ function title() { esac } -function dirty() { +function git_dirty() { # check if repository is dirty if (! ((git diff --cached --quiet) && (git diff --quiet))); then return 1 @@ -31,9 +31,10 @@ function dirty() { # precmd is called just before the prompt is printed function precmd() { - psvar=() + # psvar=() vcs_info - [[ -n $vcs_info_msg_0_ ]] && psvar[1]="${vcs_info_msg_0_}" + # This loads the info messgage into %1v. + # [[ -n $vcs_info_msg_0_ ]] && psvar[1]="${vcs_info_msg_0_}" title "zsh" "$USER@%m" "%55<...<%~" } diff --git a/func/prompt_git_setup b/func/prompt_git_setup index 5f264cd..b70563f 100644 --- a/func/prompt_git_setup +++ b/func/prompt_git_setup @@ -14,8 +14,8 @@ function prompt_git_setup { unset PS1 PS2 PS3 PS4 PROMPT RPROMPT autoload -Uz vcs_info - zstyle ':vcs_info:*' formats '%b ' - zstyle ':vcs_info:*' actionformats '(%r) %b ' + zstyle ':vcs_info:*' formats '%{'${fg[yellow]}'%}%b ' + zstyle ':vcs_info:(svn|bzr):*' branchformat '%b%{'${fg[yellow]}'%}:%r' zstyle ':vcs_info:*' enable git cvs svn hg bzr # vcs_info also needs to be in precmd, see: 10_hooks vcs_info @@ -30,9 +30,9 @@ function prompt_git_setup { ps1=( # "%{$fg_bold[$u_col]%}%n@" # "%{$fg_bold[$h_col]%}%m " - "%{$fg_bold[$d_col]%}%1~" + "%{$fg_bold[$d_col]%}%1~%{$reset_color%}" # end of path "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%} %{$reset_color%}" - "%1v%{$reset_color%}" # requires vcs_info + '${vcs_info_msg_0_}' "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%}$ " "%{$reset_color%}" ) From 3a9bdf65250bac02e7a27268d354c3670f86c935 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 30 Jan 2009 23:20:32 +0000 Subject: [PATCH 081/153] Added support for git-toggle.. which should probably be renamed vcs_toggle --- 10_hooks | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/10_hooks b/10_hooks index 1ad6c91..cfa9128 100644 --- a/10_hooks +++ b/10_hooks @@ -31,10 +31,13 @@ function git_dirty() { # precmd is called just before the prompt is printed function precmd() { - # psvar=() - vcs_info + # This may not be the best way of doing this. + if [[ $git_enable == 1 ]]; then + vcs_info + else + vcs_info_msg_0_='' + fi # This loads the info messgage into %1v. - # [[ -n $vcs_info_msg_0_ ]] && psvar[1]="${vcs_info_msg_0_}" title "zsh" "$USER@%m" "%55<...<%~" } From 707e8672cd2a2d3e9d8d40e1120a8c828467e058 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 30 Jan 2009 23:21:01 +0000 Subject: [PATCH 082/153] commented git-prompt function. --- 06_git | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/06_git b/06_git index ff6e7e6..afa8045 100644 --- a/06_git +++ b/06_git @@ -14,6 +14,7 @@ if [[ -x `which git` ]]; then git checkout "${branch}" git rebase master } + function git-toggle() { if [[ $git_enable = 1 ]]; then git_enable=0 @@ -21,27 +22,29 @@ if [[ -x `which git` ]]; then git_enable=1 fi } - function git-prompt() { - emulate -L zsh - dirty_color=$fg[cyan] - branch=$(echo $gstatus | head -n 1 | sed 's/^# On branch //') - if [[ $branch == '# Not currently on any branch.' ]]; then - no_branch=1 - branch='none' - fi - if [[ $git_enable = 1 ]]; then - gstatus=$(git status 2> /dev/null) - branch=$(echo $gstatus | head -n 1 | sed 's/^# On branch //') - dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -n 2 | grep 'nothing to commit (working directory clean)'; echo $?) - if [[ x$branch != x ]]; then - if [[ $dirty = 1 ]] { dirty_color=$fg[magenta] } - if [[ $no_branch = 1 ]] { dirty_color=$fg[red] } - [ x$branch != x ] && echo "%{$dirty_color%}$branch%{$reset_color%} " - fi - else - echo "%{$dirty_color%}!%{$reset_color%}" - fi - } + + # function git-prompt() { + # emulate -L zsh + # dirty_color=$fg[cyan] + # branch=$(echo $gstatus | head -n 1 | sed 's/^# On branch //') + # if [[ $branch == '# Not currently on any branch.' ]]; then + # no_branch=1 + # branch='none' + # fi + # if [[ $git_enable = 1 ]]; then + # gstatus=$(git status 2> /dev/null) + # branch=$(echo $gstatus | head -n 1 | sed 's/^# On branch //') + # dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -n 2 | grep 'nothing to commit (working directory clean)'; echo $?) + # if [[ x$branch != x ]]; then + # if [[ $dirty = 1 ]] { dirty_color=$fg[magenta] } + # if [[ $no_branch = 1 ]] { dirty_color=$fg[red] } + # [ x$branch != x ] && echo "%{$dirty_color%}$branch%{$reset_color%} " + # fi + # else + # echo "%{$dirty_color%}!%{$reset_color%}" + # fi + # } + function git-scoreboard () { git log | grep Author | sort | uniq -ci | sort -r } From 01fcaedfcea5b395c7e235d0480c950e7977daa6 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Fri, 30 Jan 2009 23:21:19 +0000 Subject: [PATCH 083/153] Cleaning up --- 10_hooks | 9 --------- 1 file changed, 9 deletions(-) diff --git a/10_hooks b/10_hooks index cfa9128..1e8200f 100644 --- a/10_hooks +++ b/10_hooks @@ -20,15 +20,6 @@ function title() { esac } -function git_dirty() { - # check if repository is dirty - if (! ((git diff --cached --quiet) && (git diff --quiet))); then - return 1 - else - return 0 - fi -} - # precmd is called just before the prompt is printed function precmd() { # This may not be the best way of doing this. From ba350a0f430c8ef1c7ecb85659f5becc1cef93fb Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sat, 31 Jan 2009 13:01:55 +0000 Subject: [PATCH 084/153] Added mencoder utility functions. --- 05_quicktime | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/05_quicktime b/05_quicktime index e87acea..83a9a65 100644 --- a/05_quicktime +++ b/05_quicktime @@ -17,4 +17,20 @@ if [[ -x `which qt_export` ]]; then qt_export --sequencerate=1 $1 --video=png,1 --audio=0 --replacefile $out fi } +fi + +if [[ -x `which mencoder` ]]; then + function mkv_to_avi(){ + # Remux .mkv or .ogm to .avi with mp3 audio. + input='' + output=${input:r}.avi + mencoder $input -oac mp3lame -ovc copy -o $output + } + + function mkv_to_avi(){ + # Convert .mkv or .ogm to .avi with XViD and mp3 audio. + input='' + output=${input:r}.avi + mencoder $input -oac mp3lame -ovc xvid -xvidencopts pass=1 -o $output + } fi \ No newline at end of file From 8999706cf13adc631c92de31ea890c7785b372b7 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sat, 31 Jan 2009 13:02:39 +0000 Subject: [PATCH 085/153] renamed quicktime as video after adding some mencoder stuff --- 05_quicktime => 05_video | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename 05_quicktime => 05_video (100%) diff --git a/05_quicktime b/05_video similarity index 100% rename from 05_quicktime rename to 05_video From e42c235993a7ad3bbaecb2ec95f4b7e3d0805bfa Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sat, 31 Jan 2009 13:09:19 +0000 Subject: [PATCH 086/153] Added perfunctory readme --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..eef53f4 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +Matt Foster's zshkit fork +------------------------- + +An easily extensible collection of `stuff` for zsh. + +## Prompt info + +I'm currently playing with the prompt, using `vcs_info`. For this to work, you'll need a version zsh > 4.3.6 (IIRC). From 3e0ccfbd80553511fe1e424bf254f9d2948843a8 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sat, 31 Jan 2009 20:05:27 +0000 Subject: [PATCH 087/153] still playing with the prompt --- 01_path | 9 ++++++++- 10_hooks | 2 +- README.md | 7 +++++++ func/prompt_git_setup | 40 ++++++++++++---------------------------- rc | 9 +++++++++ 5 files changed, 37 insertions(+), 30 deletions(-) diff --git a/01_path b/01_path index 59fa9d4..a688cbc 100644 --- a/01_path +++ b/01_path @@ -1,5 +1,6 @@ # Add some dirs to the path. pathdirs=(/Library/Frameworks/Python.framework/Versions/Current/bin + /usr/local/bin /usr/local/git/bin /usr/local/libexec/git-core /var/lib/gems/1.8/bin @@ -19,7 +20,13 @@ for dir ($dirs) fi # Add function paths -funcdirs=( $HOME/.zsh/func /sw/share/zsh/ /sw/share/zsh/VCS_Info /sw/share/zsh/VCS_Info/Backends) +# funcdirs=( $HOME/.zsh/func /sw/share/zsh/ /sw/share/zsh/VCS_Info /sw/share/zsh/VCS_Info/Backends) +# I'm using a manually installed zsh 4.3.9 + +binary=$(which zsh) +install_path=$binary:h:h # Strip bin/zsh to find installation path. + +funcdirs=( $HOME/.zsh/func $install_path/share/zsh/4.3.9/functions) for dir ($funcdirs) if [[ -x $dir ]]; then fpath=($fpath $dir) diff --git a/10_hooks b/10_hooks index 1e8200f..73d525a 100644 --- a/10_hooks +++ b/10_hooks @@ -26,7 +26,7 @@ function precmd() { if [[ $git_enable == 1 ]]; then vcs_info else - vcs_info_msg_0_='' + vcs_info_msg_0_='' fi # This loads the info messgage into %1v. title "zsh" "$USER@%m" "%55<...<%~" diff --git a/README.md b/README.md index eef53f4..779c227 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,10 @@ An easily extensible collection of `stuff` for zsh. ## Prompt info I'm currently playing with the prompt, using `vcs_info`. For this to work, you'll need a version zsh > 4.3.6 (IIRC). + +## Current issues: + +* I haven't found a way to easily show when the repo is dirty. +* On my mac, opening additional zsh terminals doesn't give me coloured prompts. +* I keep seeing bits and bobs alluding to a 'new prompt colour' syntax, but I can't find any docs. + diff --git a/func/prompt_git_setup b/func/prompt_git_setup index b70563f..33bc02a 100644 --- a/func/prompt_git_setup +++ b/func/prompt_git_setup @@ -11,37 +11,21 @@ # Prompt setup function function prompt_git_setup { - unset PS1 PS2 PS3 PS4 PROMPT RPROMPT - autoload -Uz vcs_info - zstyle ':vcs_info:*' formats '%{'${fg[yellow]}'%}%b ' - zstyle ':vcs_info:(svn|bzr):*' branchformat '%b%{'${fg[yellow]}'%}:%r' - zstyle ':vcs_info:*' enable git cvs svn hg bzr - # vcs_info also needs to be in precmd, see: 10_hooks - vcs_info + unset PS1 PS2 PS3 PS4 PROMPT RPROMPT # Colours accepted as arguments - local u_col=${1:-'green'} - local h_col=${2:-'green'} - local d_col=${3:-'blue'} - local n_tru=${4:-'blue'} - local n_fal=${5:-'yellow'} - # looks like: ee1mpf@eepc-tsar16 ~ $ - ps1=( - # "%{$fg_bold[$u_col]%}%n@" - # "%{$fg_bold[$h_col]%}%m " - "%{$fg_bold[$d_col]%}%1~%{$reset_color%}" # end of path - "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%} %{$reset_color%}" - '${vcs_info_msg_0_}' - "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%}$ " - "%{$reset_color%}" - ) - ps2=( - "%_ %{$fg_bold[$d_col]%}-> " - "%{$reset_color%}" - ) - PS2="${(j::)ps2}" - PS1="${(j::)ps1}" + d_col=${3:-'blue'} + n_tru=${4:-'blue'} + n_fal=${5:-'red'} + # I've no idea why the %F style colours don't work whhen SHLVL == 1 + if [[ $SHLVL == 1 ]]; then + PS1='$fg_bold[$d_col]%1~ $fg_bold[yellow]${vcs_info_msg_0_}%(?.$fg_bold[$n_tru].$fg[$n_fal])$ $reset_color' + PS2='%_ $fg_bold{$d_col}-> %reset_color' + else + PS1='%B%F{$d_col}%1~ %F{yellow}${vcs_info_msg_0_}%(?.%F{$n_tru}.%F{$n_fal})$ %F{white}' + PS2='%_ %B%F{$d_col}-> %F{white}' + fi } # print information when user runs 'prompt -h git' diff --git a/rc b/rc index 8757e3e..892a9e0 100644 --- a/rc +++ b/rc @@ -69,6 +69,15 @@ compinit autoload -Uz colors colors + +autoload -Uz vcs_info +zstyle ':vcs_info:*' formats '%b ' +zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:%r' +zstyle ':vcs_info:*' enable git cvs svn hg bzr +# vcs_info also needs to be in precmd, see: 10_hooks +vcs_info + + # Needed for doc function in 03_help. compdef _doc doc From 4ecc3c16c1204fa6f0a88cf60cdef4ad5bf24619 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 1 Feb 2009 09:46:52 +0000 Subject: [PATCH 088/153] =?UTF-8?q?Added=20%{=E2=80=A6%}=20bits=20I'd=20fo?= =?UTF-8?q?rgotten.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These mark bits as literal escape sequences, so the cursor doesn't jump around on completion etc. --- func/prompt_git_setup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/func/prompt_git_setup b/func/prompt_git_setup index 33bc02a..1af1932 100644 --- a/func/prompt_git_setup +++ b/func/prompt_git_setup @@ -20,8 +20,8 @@ function prompt_git_setup { n_fal=${5:-'red'} # I've no idea why the %F style colours don't work whhen SHLVL == 1 if [[ $SHLVL == 1 ]]; then - PS1='$fg_bold[$d_col]%1~ $fg_bold[yellow]${vcs_info_msg_0_}%(?.$fg_bold[$n_tru].$fg[$n_fal])$ $reset_color' - PS2='%_ $fg_bold{$d_col}-> %reset_color' + PS1='%{$fg_bold[$d_col]%}%1~ %{$fg_bold[yellow]%}${vcs_info_msg_0_}%(?.%{$fg_bold[$n_tru]%}.%{$fg[$n_fal]%})$ %{$reset_color%}' + PS2='%_ %{$fg_bold{$d_col}%}-> %{%reset_color%}' else PS1='%B%F{$d_col}%1~ %F{yellow}${vcs_info_msg_0_}%(?.%F{$n_tru}.%F{$n_fal})$ %F{white}' PS2='%_ %B%F{$d_col}-> %F{white}' From 769977f9941a7a81063fa0036fd82784e1105fa0 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 1 Feb 2009 09:47:14 +0000 Subject: [PATCH 089/153] playing with cdpath --- 01_path | 2 ++ 1 file changed, 2 insertions(+) diff --git a/01_path b/01_path index a688cbc..cb5047f 100644 --- a/01_path +++ b/01_path @@ -12,6 +12,8 @@ for dir ($pathdirs) path=($dir $path) fi +cdpath=(~ ~/Projects) + # Allow MacPorts man pages and others dirs=( /usr/local/git/man /sw/share/man /opt/local/man ) for dir ($dirs) From 34495a7427d5900aec06759e231bab02558fec22 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 1 Feb 2009 09:49:26 +0000 Subject: [PATCH 090/153] fixed colour argument numbers --- func/prompt_git_setup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/func/prompt_git_setup b/func/prompt_git_setup index 1af1932..ebeb6fd 100644 --- a/func/prompt_git_setup +++ b/func/prompt_git_setup @@ -15,9 +15,9 @@ function prompt_git_setup { unset PS1 PS2 PS3 PS4 PROMPT RPROMPT # Colours accepted as arguments - d_col=${3:-'blue'} - n_tru=${4:-'blue'} - n_fal=${5:-'red'} + d_col=${1:-'blue'} + n_tru=${2:-'blue'} + n_fal=${3:-'red'} # I've no idea why the %F style colours don't work whhen SHLVL == 1 if [[ $SHLVL == 1 ]]; then PS1='%{$fg_bold[$d_col]%}%1~ %{$fg_bold[yellow]%}${vcs_info_msg_0_}%(?.%{$fg_bold[$n_tru]%}.%{$fg[$n_fal]%})$ %{$reset_color%}' From 6737d0b52d85f96ddb71c37545d8a86efe0da8dd Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 1 Feb 2009 10:06:06 +0000 Subject: [PATCH 091/153] adding help for the prompt. --- func/prompt_git_setup | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/func/prompt_git_setup b/func/prompt_git_setup index ebeb6fd..1a29371 100644 --- a/func/prompt_git_setup +++ b/func/prompt_git_setup @@ -16,14 +16,15 @@ function prompt_git_setup { # Colours accepted as arguments d_col=${1:-'blue'} - n_tru=${2:-'blue'} - n_fal=${3:-'red'} + b_col=${2-'yellow'} + n_tru=${3:-'blue'} + n_fal=${4:-'red'} # I've no idea why the %F style colours don't work whhen SHLVL == 1 if [[ $SHLVL == 1 ]]; then - PS1='%{$fg_bold[$d_col]%}%1~ %{$fg_bold[yellow]%}${vcs_info_msg_0_}%(?.%{$fg_bold[$n_tru]%}.%{$fg[$n_fal]%})$ %{$reset_color%}' + PS1='%{$fg_bold[$d_col]%}%1~ %{$fg_bold[$b_col]%}${vcs_info_msg_0_}%(?.%{$fg_bold[$n_tru]%}.%{$fg[$n_fal]%})%# %{$reset_color%}' PS2='%_ %{$fg_bold{$d_col}%}-> %{%reset_color%}' else - PS1='%B%F{$d_col}%1~ %F{yellow}${vcs_info_msg_0_}%(?.%F{$n_tru}.%F{$n_fal})$ %F{white}' + PS1='%B%F{$d_col}%1~ %F{$b_col}${vcs_info_msg_0_}%(?.%F{$n_tru}.%F{$n_fal})%# %F{white}' PS2='%_ %B%F{$d_col}-> %F{white}' fi } @@ -31,19 +32,34 @@ function prompt_git_setup { # print information when user runs 'prompt -h git' prompt_git_help () { cat < Date: Sun, 1 Feb 2009 10:09:14 +0000 Subject: [PATCH 092/153] Renamed prompt to minimal_vcs --- 10_prompt | 2 +- ...mpt_git_setup => prompt_minimal_vcs_setup} | 20 +++++++++---------- rc | 2 -- 3 files changed, 11 insertions(+), 13 deletions(-) rename func/{prompt_git_setup => prompt_minimal_vcs_setup} (86%) diff --git a/10_prompt b/10_prompt index d485141..3d6ac3f 100644 --- a/10_prompt +++ b/10_prompt @@ -1,4 +1,4 @@ setopt prompt_subst # Set up my prompt. -autoload promptinit && promptinit && prompt git +autoload promptinit && promptinit && prompt minimal_vcs diff --git a/func/prompt_git_setup b/func/prompt_minimal_vcs_setup similarity index 86% rename from func/prompt_git_setup rename to func/prompt_minimal_vcs_setup index 1a29371..1eae2eb 100644 --- a/func/prompt_git_setup +++ b/func/prompt_minimal_vcs_setup @@ -1,4 +1,4 @@ -# Themable prompt with git support. +# Themable prompt with vcs_info support. # No twiddly crap - just prompty goodness. # Requires zshkit: http://github.com/mattfoster/zshkit/tree/master/06_git # @@ -7,10 +7,10 @@ # 2) Make sure that it's in the fpath: # fpath=( $HOME/.zsh/func "$fpath[@]" ) # 3) Load up the prompt theme extension, and set the prompt: -# autoload promptinit && promptinit && prompt git +# autoload promptinit && promptinit && prompt minimal_vcs # Prompt setup function -function prompt_git_setup { +function prompt_minimal_vcs_setup { unset PS1 PS2 PS3 PS4 PROMPT RPROMPT @@ -30,7 +30,7 @@ function prompt_git_setup { } # print information when user runs 'prompt -h git' -prompt_git_help () { +prompt_minimal_vcs_help () { cat < Date: Sun, 1 Feb 2009 12:33:49 +0000 Subject: [PATCH 093/153] Fixed PS2 typo. --- func/prompt_minimal_vcs_setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/func/prompt_minimal_vcs_setup b/func/prompt_minimal_vcs_setup index 1eae2eb..9685e79 100644 --- a/func/prompt_minimal_vcs_setup +++ b/func/prompt_minimal_vcs_setup @@ -22,7 +22,7 @@ function prompt_minimal_vcs_setup { # I've no idea why the %F style colours don't work whhen SHLVL == 1 if [[ $SHLVL == 1 ]]; then PS1='%{$fg_bold[$d_col]%}%1~ %{$fg_bold[$b_col]%}${vcs_info_msg_0_}%(?.%{$fg_bold[$n_tru]%}.%{$fg[$n_fal]%})%# %{$reset_color%}' - PS2='%_ %{$fg_bold{$d_col}%}-> %{%reset_color%}' + PS2='%_ %{$fg_bold[$d_col]%}-> %{$reset_color%}' else PS1='%B%F{$d_col}%1~ %F{$b_col}${vcs_info_msg_0_}%(?.%F{$n_tru}.%F{$n_fal})%# %F{white}' PS2='%_ %B%F{$d_col}-> %F{white}' From 00f0623dd121749c4aa13b887b65c3af0dcb43cd Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 1 Feb 2009 13:32:19 +0000 Subject: [PATCH 094/153] Adding support back for zsh < 4.3.6 --- 01_path | 2 +- 06_git | 56 ++++++++++++++++++++--------------- 10_hooks | 10 +++++-- func/prompt_minimal_vcs_setup | 2 +- 4 files changed, 41 insertions(+), 29 deletions(-) diff --git a/01_path b/01_path index cb5047f..af7c1d8 100644 --- a/01_path +++ b/01_path @@ -15,7 +15,7 @@ for dir ($pathdirs) cdpath=(~ ~/Projects) # Allow MacPorts man pages and others -dirs=( /usr/local/git/man /sw/share/man /opt/local/man ) +dirs=( /usr/local/git/man /sw/share/man /opt/local/man /usr/local/man) for dir ($dirs) if [[ -x $dir ]]; then manpath=($manpath $dir) diff --git a/06_git b/06_git index afa8045..2120f29 100644 --- a/06_git +++ b/06_git @@ -3,9 +3,18 @@ if [[ -x `which git` ]]; then function git-branch-name () { git branch 2> /dev/null | grep '^\*' | sed 's/^\*\ //' } + # Return 1 if repository is dirty. 0 if it isn't a repostory, or is clean. function git-dirty () { - git status 2> /dev/null | grep "nothing to commit (working directory clean)" - echo $? + local code + gs=$(git status 2> /dev/null) + if [[ $? == 128 ]]; + then + code=0 + else + echo $gs | grep "nothing to commit (working directory clean)" | 2>&1 > /dev/null + code=$? + fi + echo $code } function gsrb () { branch=$(git-branch-name) @@ -23,27 +32,27 @@ if [[ -x `which git` ]]; then fi } - # function git-prompt() { - # emulate -L zsh - # dirty_color=$fg[cyan] - # branch=$(echo $gstatus | head -n 1 | sed 's/^# On branch //') - # if [[ $branch == '# Not currently on any branch.' ]]; then - # no_branch=1 - # branch='none' - # fi - # if [[ $git_enable = 1 ]]; then - # gstatus=$(git status 2> /dev/null) - # branch=$(echo $gstatus | head -n 1 | sed 's/^# On branch //') - # dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -n 2 | grep 'nothing to commit (working directory clean)'; echo $?) - # if [[ x$branch != x ]]; then - # if [[ $dirty = 1 ]] { dirty_color=$fg[magenta] } - # if [[ $no_branch = 1 ]] { dirty_color=$fg[red] } - # [ x$branch != x ] && echo "%{$dirty_color%}$branch%{$reset_color%} " - # fi - # else - # echo "%{$dirty_color%}!%{$reset_color%}" - # fi - # } + function git-prompt() { + emulate -L zsh + dirty_color=$fg[cyan] + branch=$(echo $gstatus | head -n 1 | sed 's/^# On branch //') + if [[ $branch == '# Not currently on any branch.' ]]; then + no_branch=1 + branch='none' + fi + if [[ $git_enable = 1 ]]; then + gstatus=$(git status 2> /dev/null) + branch=$(echo $gstatus | head -n 1 | sed 's/^# On branch //') + dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -n 2 | grep 'nothing to commit (working directory clean)'; echo $?) + if [[ x$branch != x ]]; then + if [[ $dirty = 1 ]] { dirty_color=$fg[magenta] } + if [[ $no_branch = 1 ]] { dirty_color=$fg[red] } + [ x$branch != x ] && echo "%{$dirty_color%}$branch%{$reset_color%} " + fi + else + echo "%{$dirty_color%}!%{$reset_color%}" + fi + } function git-scoreboard () { git log | grep Author | sort | uniq -ci | sort -r @@ -72,7 +81,6 @@ if [[ -x `which git` ]]; then nohup gitk --all & } - alias g='git' alias gb='git branch -a -v' alias gs='git status' diff --git a/10_hooks b/10_hooks index 73d525a..ed2517f 100644 --- a/10_hooks +++ b/10_hooks @@ -23,11 +23,15 @@ function title() { # precmd is called just before the prompt is printed function precmd() { # This may not be the best way of doing this. - if [[ $git_enable == 1 ]]; then + if [[ $ZSH_VERSION < 4.3.6 ]] + then + vcs_info_msg_0_=$(git-prompt) + elif [[ $git_enable == 1 ]] + then vcs_info else vcs_info_msg_0_='' - fi + fi # This loads the info messgage into %1v. title "zsh" "$USER@%m" "%55<...<%~" } @@ -62,4 +66,4 @@ function preexec() { # done # cd -q "$DIRECTORY" # } -# fi \ No newline at end of file +# fi diff --git a/func/prompt_minimal_vcs_setup b/func/prompt_minimal_vcs_setup index 9685e79..7b7cc89 100644 --- a/func/prompt_minimal_vcs_setup +++ b/func/prompt_minimal_vcs_setup @@ -20,7 +20,7 @@ function prompt_minimal_vcs_setup { n_tru=${3:-'blue'} n_fal=${4:-'red'} # I've no idea why the %F style colours don't work whhen SHLVL == 1 - if [[ $SHLVL == 1 ]]; then + if [[ $SHLVL == 1 || $ZSH_VERSION < 4.3.6 ]]; then PS1='%{$fg_bold[$d_col]%}%1~ %{$fg_bold[$b_col]%}${vcs_info_msg_0_}%(?.%{$fg_bold[$n_tru]%}.%{$fg[$n_fal]%})%# %{$reset_color%}' PS2='%_ %{$fg_bold[$d_col]%}-> %{$reset_color%}' else From 2e36007442406c9fc15a18e7f998838805e29480 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 2 Feb 2009 10:20:37 +0000 Subject: [PATCH 095/153] added another directory to my cdpath --- 01_path | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/01_path b/01_path index af7c1d8..55bf164 100644 --- a/01_path +++ b/01_path @@ -12,10 +12,10 @@ for dir ($pathdirs) path=($dir $path) fi -cdpath=(~ ~/Projects) +cdpath=(~ ~/Projects ~/Work) # Allow MacPorts man pages and others -dirs=( /usr/local/git/man /sw/share/man /opt/local/man /usr/local/man) +dirs=( /usr/local/git/man /sw/share/man /opt/local/man /usr/local/man ~/Docs/man) for dir ($dirs) if [[ -x $dir ]]; then manpath=($manpath $dir) From acb664f859e5d751d2ee97ad10b319ba20e11baf Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 2 Feb 2009 10:25:38 +0000 Subject: [PATCH 096/153] Changed version check -- vcs_info isn't in ubuntu's 4.3.6 --- 10_hooks | 2 +- func/prompt_minimal_vcs_setup | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/10_hooks b/10_hooks index ed2517f..5b36e1f 100644 --- a/10_hooks +++ b/10_hooks @@ -23,7 +23,7 @@ function title() { # precmd is called just before the prompt is printed function precmd() { # This may not be the best way of doing this. - if [[ $ZSH_VERSION < 4.3.6 ]] + if [[ $ZSH_VERSION < 4.3.7 ]] then vcs_info_msg_0_=$(git-prompt) elif [[ $git_enable == 1 ]] diff --git a/func/prompt_minimal_vcs_setup b/func/prompt_minimal_vcs_setup index 7b7cc89..6616a66 100644 --- a/func/prompt_minimal_vcs_setup +++ b/func/prompt_minimal_vcs_setup @@ -20,7 +20,7 @@ function prompt_minimal_vcs_setup { n_tru=${3:-'blue'} n_fal=${4:-'red'} # I've no idea why the %F style colours don't work whhen SHLVL == 1 - if [[ $SHLVL == 1 || $ZSH_VERSION < 4.3.6 ]]; then + if [[ $SHLVL == 1 || $ZSH_VERSION < 4.3.7 ]]; then PS1='%{$fg_bold[$d_col]%}%1~ %{$fg_bold[$b_col]%}${vcs_info_msg_0_}%(?.%{$fg_bold[$n_tru]%}.%{$fg[$n_fal]%})%# %{$reset_color%}' PS2='%_ %{$fg_bold[$d_col]%}-> %{$reset_color%}' else From d82049c4bd88f459a2eb81920cdd823ccecfcb9c Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 2 Feb 2009 10:30:12 +0000 Subject: [PATCH 097/153] wrapped vcs_info in version check --- rc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/rc b/rc index b80ef11..3efec7b 100644 --- a/rc +++ b/rc @@ -69,14 +69,15 @@ compinit autoload -Uz colors colors - -autoload -Uz vcs_info -zstyle ':vcs_info:*' formats '%b ' -zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:%r' -zstyle ':vcs_info:*' enable git cvs svn hg bzr -# vcs_info also needs to be in precmd, see: 10_hooks -vcs_info +if [[ $ZSH_VERSION > 4.3.6 ]]; then + autoload -Uz vcs_info + zstyle ':vcs_info:*' formats '%b ' + zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:%r' + zstyle ':vcs_info:*' enable git cvs svn hg bzr + # vcs_info also needs to be in precmd, see: 10_hooks + vcs_info +fi # Needed for doc function in 03_help. compdef _doc doc # Set up completion for bundle function in 05_editor. From cc73990698c1fd4146eb47cfa90d338397ebb4df Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 2 Feb 2009 14:39:03 +0000 Subject: [PATCH 098/153] Added completion menu. --- rc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rc b/rc index 3efec7b..c6cf471 100644 --- a/rc +++ b/rc @@ -16,6 +16,8 @@ zstyle ':completion:*' use-cache on zstyle ':completion:*' users resolve # use dircolours in completion listings zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} +# Enable menu completion +zstyle ':completion*:default' menu 'select=1' # allow approximate matching zstyle ':completion:*' completer _complete _match _approximate @@ -61,9 +63,6 @@ zstyle ':completion:*' auto-description 'specify: %d' # Give long completion options in a list. tab to advance. zstyle ':completion:*:default' list-prompt '%S%M matches%s' -# Expand out ! when I press space. -# bindkey ' ' magic-space - autoload -Uz compinit compinit From edf1c9fb6b7d1cbb316a164dbe434dbe8b576e35 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Tue, 3 Feb 2009 12:00:23 +0000 Subject: [PATCH 099/153] Added simple completion function for cheat. --- 07_completion | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/07_completion b/07_completion index 4207cfa..1e7f26f 100644 --- a/07_completion +++ b/07_completion @@ -1,2 +1,9 @@ # Files to ignore during completion -fignore=(DS_Store $fignore) \ No newline at end of file +fignore=(DS_Store $fignore) + +_cheat() { + compadd print -l ${(s. .)$(cheat sheets | tr -d ' ' | tr '\n' ' ' | sed -e 's/AllCheatSheets://')} +} + +compdef _cheat cheat + From 5ad1d62edb803776bbcd7d8decbb742fb238df8b Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Tue, 3 Feb 2009 12:00:50 +0000 Subject: [PATCH 100/153] Added some named directories. --- 01_path | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/01_path b/01_path index 55bf164..c782413 100644 --- a/01_path +++ b/01_path @@ -35,3 +35,10 @@ for dir ($funcdirs) fi typeset -gU path cdpath manpath fpath + +# A few named directories cd by doing cd ~D etc. +D=~/Documents +DL=~/Downloads +P=~/Projects +W=~/work +Z=~/Projects/zshkit From 4942f6a5db10d760ed9ad0e4cb6e7a06d997afd1 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Tue, 3 Feb 2009 13:30:24 +0000 Subject: [PATCH 101/153] moved completion function. --- 07_completion | 5 ----- rc | 8 +++++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/07_completion b/07_completion index 1e7f26f..487967e 100644 --- a/07_completion +++ b/07_completion @@ -1,9 +1,4 @@ # Files to ignore during completion fignore=(DS_Store $fignore) -_cheat() { - compadd print -l ${(s. .)$(cheat sheets | tr -d ' ' | tr '\n' ' ' | sed -e 's/AllCheatSheets://')} -} - -compdef _cheat cheat diff --git a/rc b/rc index c6cf471..aef770b 100644 --- a/rc +++ b/rc @@ -80,4 +80,10 @@ fi # Needed for doc function in 03_help. compdef _doc doc # Set up completion for bundle function in 05_editor. -compdef _bundle bundle \ No newline at end of file +compdef _bundle bundle + +_cheat() { + compadd print -l ${(s. .)$(cheat sheets | tr -d ' ' | tr '\n' ' ' | sed -e 's/AllCheatSheets://')} +} + +compdef _cheat cheat \ No newline at end of file From 31727ddcaab76e491f16755b6233191080eab142 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 4 Feb 2009 11:22:52 +0000 Subject: [PATCH 102/153] added easy_install alias --- 05_python | 1 + 1 file changed, 1 insertion(+) diff --git a/05_python b/05_python index 97faad7..c5b7622 100644 --- a/05_python +++ b/05_python @@ -2,3 +2,4 @@ export PYTHONPATH=$HOME/.python_libraries typeset -U PYTHONPATH alias pylab='ipython -pylab -wthread' +alias easy_install='sudo easy_install' \ No newline at end of file From 5f17a796f774a7e6273372681fe7a59bdb0e4a9e Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 4 Feb 2009 12:04:19 +0000 Subject: [PATCH 103/153] Create global aliases from the abbreviations --- 09_abbreviations | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/09_abbreviations b/09_abbreviations index 120c278..0b943ef 100644 --- a/09_abbreviations +++ b/09_abbreviations @@ -48,6 +48,11 @@ abbrevs=('...' '../..' 'se' 'setopt interactivecomments' ) +# Create global aliases from the abbreviations. +for key in ${(k)abbrevs}; do + alias -g $key="${abbrevs[$key]}" +done + globalias() { local MATCH LBUFFER=${LBUFFER%%(#m)[_a-zA-Z0-9]#} From a214f9aebd696430ff2cfdb186fc4d434ed5ccc9 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 4 Feb 2009 17:16:18 +0000 Subject: [PATCH 104/153] Use the simple (read not treacle-slow) bzr code. --- rc | 1 + 1 file changed, 1 insertion(+) diff --git a/rc b/rc index aef770b..4db76e8 100644 --- a/rc +++ b/rc @@ -73,6 +73,7 @@ if [[ $ZSH_VERSION > 4.3.6 ]]; then autoload -Uz vcs_info zstyle ':vcs_info:*' formats '%b ' zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:%r' + zstyle ':vcs_info:bzr:*' use-simple true zstyle ':vcs_info:*' enable git cvs svn hg bzr # vcs_info also needs to be in precmd, see: 10_hooks vcs_info From 8faea35c52f7085798c396bf5e5fd82c61b05751 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 5 Feb 2009 10:07:25 +0000 Subject: [PATCH 105/153] Renamed conflicting variable key. --- 09_abbreviations | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/09_abbreviations b/09_abbreviations index 0b943ef..0c012c1 100644 --- a/09_abbreviations +++ b/09_abbreviations @@ -49,8 +49,8 @@ abbrevs=('...' '../..' ) # Create global aliases from the abbreviations. -for key in ${(k)abbrevs}; do - alias -g $key="${abbrevs[$key]}" +for abbr in ${(k)abbrevs}; do + alias -g $abbr="${abbrevs[$abbr]}" done globalias() { @@ -62,12 +62,12 @@ globalias() { zle -N globalias -# List abbreviations and key binding, picks out help in green. +# List abbreviations and abbr binding, picks out help in green. H-Abbrevs() { echo "Displaying shell abbreviations" - echo "Keybinding is:" ${$(bindkey | grep globalias)[1]} - for key in ${(ok)abbrevs}; do - printf "%-20s: %s" $key ${abbrevs[$key]:s/ + echo "Keybinding is:" ${$(bindabbr | grep globalias)[1]} + for abbr in ${(ok)abbrevs}; do + printf "%-20s: %s" $abbr ${abbrevs[$abbr]:s/ /$fg[green] /} # Replaces newlines with spaces print -l $reset_color done From 058f05b20773911749535b8e308cdd4de960643c Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 12 Feb 2009 10:56:35 +0000 Subject: [PATCH 106/153] Added path to ActivePerl-5.10 --- 01_path | 1 + 1 file changed, 1 insertion(+) diff --git a/01_path b/01_path index c782413..c5d9874 100644 --- a/01_path +++ b/01_path @@ -1,5 +1,6 @@ # Add some dirs to the path. pathdirs=(/Library/Frameworks/Python.framework/Versions/Current/bin + /usr/local/ActivePerl-5.10/bin /usr/local/bin /usr/local/git/bin /usr/local/libexec/git-core From e8503d7a6b0c0b3798a2da23b0257d50220ccb56 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 16 Feb 2009 14:52:08 +0000 Subject: [PATCH 107/153] Added perl site directory, for CPAN executables. --- 01_path | 1 + 1 file changed, 1 insertion(+) diff --git a/01_path b/01_path index c5d9874..e381700 100644 --- a/01_path +++ b/01_path @@ -1,6 +1,7 @@ # Add some dirs to the path. pathdirs=(/Library/Frameworks/Python.framework/Versions/Current/bin /usr/local/ActivePerl-5.10/bin + /usr/local/ActivePerl-5.10/site/bin /usr/local/bin /usr/local/git/bin /usr/local/libexec/git-core From 2c051706348c7b783b5445c6fb86cad076f48e85 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 29 Apr 2009 09:03:50 +0100 Subject: [PATCH 108/153] Add terminal specific options. --- rc | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/rc b/rc index 4db76e8..40a23a1 100644 --- a/rc +++ b/rc @@ -1,15 +1,26 @@ -setopt nobeep # No beeping +setopt nobeep # No beeping setopt AUTOPUSHD PUSHDMINUS PUSHDSILENT PUSHDTOHOME -setopt AUTOCD # cd by typing dirname -setopt cdablevars # Follow variables which are dirnames +setopt AUTOCD # cd by typing dirname +setopt cdablevars # Follow variables which are dirnames setopt interactivecomments # allow comments on cmd line. -# setopt SH_WORD_SPLIT # split up var in "for x in *" -setopt MULTIOS # Allow multiple redirection echo 'a'>b>c +# setopt SH_WORD_SPLIT # split up var in "for x in *" +setopt MULTIOS # Allow multiple redirection echo 'a'>b>c setopt CORRECT CORRECT_ALL # Try to correct command line spelling -setopt BANG_HIST # Allow ! for accessing history -setopt NOHUP # Don't HUP running jobs on logout. +setopt BANG_HIST # Allow ! for accessing history +setopt NOHUP # Don't HUP running jobs on logout. +setopt NOBGNICE # Don't renice background jobs setopt EXTENDED_GLOB # Enable extended globbing +# TERM specific options + +case $TERM in +screen) + setopt ignore_eof + ;; +xterm*|rxvt|ansi) + ;; +esac + zstyle ':completion:*' completer _expand _complete zstyle ':completion:*' use-cache on @@ -73,6 +84,7 @@ if [[ $ZSH_VERSION > 4.3.6 ]]; then autoload -Uz vcs_info zstyle ':vcs_info:*' formats '%b ' zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:%r' + zstyle ':vcs_info:cvs:*' branchformat '%r ' zstyle ':vcs_info:bzr:*' use-simple true zstyle ':vcs_info:*' enable git cvs svn hg bzr # vcs_info also needs to be in precmd, see: 10_hooks From 0a6f8e89a5dc6472f3e1b615928887c6c4386f50 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 29 Apr 2009 09:04:16 +0100 Subject: [PATCH 109/153] remove some abbrevs which clash with CVS (urg) --- 09_abbreviations | 1 - 1 file changed, 1 deletion(-) diff --git a/09_abbreviations b/09_abbreviations index 0c012c1..aef8d35 100644 --- a/09_abbreviations +++ b/09_abbreviations @@ -18,7 +18,6 @@ abbrevs=('...' '../..' 'T' '| tail' 'da' 'du -sch' 'j' 'jobs -l' - 'co' "./configure && make && sudo make install" 'CH' "./configure --help" 'dir' 'ls -lSrah' 'lad' $'ls -d .*(/)\n# only show dot-directories' From 0c7c5968ea6cac93617cf197a598ab161650e0c1 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 29 Apr 2009 09:05:28 +0100 Subject: [PATCH 110/153] Search for more possible funcdirs. Hopefully there won't be more than one. --- 01_path | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/01_path b/01_path index e381700..702bd19 100644 --- a/01_path +++ b/01_path @@ -17,7 +17,7 @@ for dir ($pathdirs) cdpath=(~ ~/Projects ~/Work) # Allow MacPorts man pages and others -dirs=( /usr/local/git/man /sw/share/man /opt/local/man /usr/local/man ~/Docs/man) +dirs=( /usr/local/git/man /sw/share/man /opt/local/man /usr/local/man ~/Docs/man /usr/local/ActivePerl-5.10/man /usr/local/ActivePerl-5.10/site/man) for dir ($dirs) if [[ -x $dir ]]; then manpath=($manpath $dir) @@ -30,7 +30,12 @@ for dir ($dirs) binary=$(which zsh) install_path=$binary:h:h # Strip bin/zsh to find installation path. -funcdirs=( $HOME/.zsh/func $install_path/share/zsh/4.3.9/functions) +funcdirs=( $HOME/.zsh/func $install_path/share/zsh/4.3.9/functions + $install_path/share/zsh/4.3.6/functions + $install_path/share/zsh/4.2.6/functions + /usr/share/zsh/4.2.6/functions + /usr/share/zsh/4.3.6/functions +) for dir ($funcdirs) if [[ -x $dir ]]; then fpath=($fpath $dir) From b44043f1177c4f478bcb5579a00eac10010a2338 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 29 Apr 2009 09:08:32 +0100 Subject: [PATCH 111/153] Reformat manual paths. --- 01_path | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/01_path b/01_path index 702bd19..afb31a3 100644 --- a/01_path +++ b/01_path @@ -17,7 +17,13 @@ for dir ($pathdirs) cdpath=(~ ~/Projects ~/Work) # Allow MacPorts man pages and others -dirs=( /usr/local/git/man /sw/share/man /opt/local/man /usr/local/man ~/Docs/man /usr/local/ActivePerl-5.10/man /usr/local/ActivePerl-5.10/site/man) +dirs=( /usr/local/git/man + /sw/share/man + /opt/local/man /usr/local/man + ~/Docs/man + /usr/local/ActivePerl-5.10/man + /usr/local/ActivePerl-5.10/site/man) + for dir ($dirs) if [[ -x $dir ]]; then manpath=($manpath $dir) From ee7a4a162e4a5e7a84959278af907c449022a767 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 29 Apr 2009 15:30:53 +0100 Subject: [PATCH 112/153] Add freebsd overrides to ls. --- 05_ls | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/05_ls b/05_ls index b7d7628..9f3c121 100644 --- a/05_ls +++ b/05_ls @@ -1,10 +1,13 @@ if [[ -x `which gls` ]]; then alias rls=`which ls` alias ls='gls -h --color=auto ' +elif [[ $(uname) == 'FreeBSD' ]]; then + export CLICOLOR="yes" + export LSCOLORS='exfxcxdxbxegedabagacad' elif [[ -n `ls --color` && $? == 0 ]]; then # Check if ls can handle the --color option. If it can it's probably gnu. alias ls='ls --color=auto' - export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=0;32:*.jpe=0;32:*.jpeg=0;32:*.gif=0;32:*.bmp=0;32:*.pbm=0;32:*.pgm=0;32:*.ppm=0;32:*.tga=0;32:*.xbm=0;32:*.xpm=0;32:*.tif=0;32:*.tiff=0;32:*.png=0;32:*.eps=0;32:*.mpg=0;32:*.mpeg=0;32:*.avi=0;32:*.fli=0;32:*.gl=0;32:*.dl=0;32:*.xcf=0;32:*.xwd=0;32:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:*.flac=01;35:*.m4a=01;35:*.mpc=01;35:*.o=01;33:*.c=01;35:*.m=01;35:*.h=01;35:*.rb=01;35:*.pl=01;35:*.py=01;35:*.sh=01;35:*.m=01;35:*akefile=0;35:*tags=01;32:*~=01;30:*.swp=01;30:*README=01;31:*README.*=01;31:*readme=00;31:*.tex=01;31:*.htm=01;31:*.html=01;31:*.pdf=00;31:*.PDF=00;31:*.ps=00;31:*.PS=00;31:*.png=00;31:*.PNG=00;31:*.jpg=00;31:*.JPG=00;31:*.jpeg=00;31:*.JPEG=00;31:'; + export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=0;32:*.jpe=0;32:*.jpeg=0;32:*.gif=0;32:*.bmp=0;32:*.pbm=0;32:*.pgm=0;32:*.ppm=0;32:*.tga=0;32:*.xbm=0;32:*.xpm=0;32:*.tif=0;32:*.tiff=0;32:*.png=0;32:*.eps=0;32:*.mpg=0;32:*.mpeg=0;32:*.avi=0;32:*.fli=0;32:*.gl=0;32:*.dl=0;32:*.xcf=0;32:*.xwd=0;32:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:*.flac=01;35:*.m4a=01;35:*.mpc=01;35:*.o=01;33:*.c=01;35:*.m=01;35:*.h=01;35:*.rb=01;35:*.pl=01;35:*.py=01;35:*.sh=01;35:*.m=01;35:*akefile=0;35:*tags=01;32:*~=01;30:*.swp=01;30:*README=01;31:*README.*=01;31:*readme=00;31:*.tex=01;31:*.htm=01;31:*.html=01;31:*.pdf=00;31:*.PDF=00;31:*.ps=00;31:*.PS=00;31:*.png=00;31:*.PNG=00;31:*.jpg=00;31:*.JPG=00;31:*.jpeg=00;31:*.JPEG=00;31:'; fi alias l='ls' From 886d297f01ba70b20a7f87c817ccac0098a182bb Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sat, 9 May 2009 18:34:39 +0200 Subject: [PATCH 113/153] Slight modification of the bsd LS_COLORS line. Still to do: match the gnu one closer. --- 05_ls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/05_ls b/05_ls index 9f3c121..44830a0 100644 --- a/05_ls +++ b/05_ls @@ -3,7 +3,7 @@ if [[ -x `which gls` ]]; then alias ls='gls -h --color=auto ' elif [[ $(uname) == 'FreeBSD' ]]; then export CLICOLOR="yes" - export LSCOLORS='exfxcxdxbxegedabagacad' + export LSCOLORS='ExfxcxdxbxEgEdabagacad' elif [[ -n `ls --color` && $? == 0 ]]; then # Check if ls can handle the --color option. If it can it's probably gnu. alias ls='ls --color=auto' From 930833f395e333ed46e6ef100af800a3df5d19e4 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 18 Nov 2009 16:18:14 +0000 Subject: [PATCH 114/153] Set CVSEDITOR to gvim -f when appropriate --- 01_path | 2 +- 05_editor | 2 ++ 09_abbreviations | 1 + 10_bindkey | 4 ++++ func/prompt_minimal_vcs_setup | 4 ++-- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/01_path b/01_path index afb31a3..cbcbca2 100644 --- a/01_path +++ b/01_path @@ -20,7 +20,7 @@ cdpath=(~ ~/Projects ~/Work) dirs=( /usr/local/git/man /sw/share/man /opt/local/man /usr/local/man - ~/Docs/man + $HOME/Library/Documentation/Local/man /usr/local/ActivePerl-5.10/man /usr/local/ActivePerl-5.10/site/man) diff --git a/05_editor b/05_editor index fa62bb7..07482de 100644 --- a/05_editor +++ b/05_editor @@ -1,4 +1,5 @@ export EDITOR +export CVSEDITOR function not_run_from_ssh () { ps x|grep "${PPID}.*sshd"|grep -v grep @@ -20,6 +21,7 @@ if [[ -x `which mate` && $(not_run_from_ssh) = 1 ]]; then } elif [[ -x `which gvim` ]]; then EDITOR=gvim + CVSEDITOR='gvim -f' elif [[ -x `which vim` ]]; then EDITOR=vim elif [[ -x `which vi` ]]; then diff --git a/09_abbreviations b/09_abbreviations index aef8d35..d8878f6 100644 --- a/09_abbreviations +++ b/09_abbreviations @@ -45,6 +45,7 @@ abbrevs=('...' '../..' 'cx' 'chmod +x' 'e' 'print -l' 'se' 'setopt interactivecomments' + 'cvss' 'cvs -q -n update' ) # Create global aliases from the abbreviations. diff --git a/10_bindkey b/10_bindkey index 35036a3..2c6b32e 100644 --- a/10_bindkey +++ b/10_bindkey @@ -6,3 +6,7 @@ bindkey " " magic-space bindkey "^Og" noglob-command-line bindkey "^Os" sudo-command-line + +bindkey "^[^[[D" backward-word +bindkey "^[^[[C" forward-word + diff --git a/func/prompt_minimal_vcs_setup b/func/prompt_minimal_vcs_setup index 6616a66..d8d8327 100644 --- a/func/prompt_minimal_vcs_setup +++ b/func/prompt_minimal_vcs_setup @@ -22,10 +22,10 @@ function prompt_minimal_vcs_setup { # I've no idea why the %F style colours don't work whhen SHLVL == 1 if [[ $SHLVL == 1 || $ZSH_VERSION < 4.3.7 ]]; then PS1='%{$fg_bold[$d_col]%}%1~ %{$fg_bold[$b_col]%}${vcs_info_msg_0_}%(?.%{$fg_bold[$n_tru]%}.%{$fg[$n_fal]%})%# %{$reset_color%}' - PS2='%_ %{$fg_bold[$d_col]%}-> %{$reset_color%}' + PS2='%_ %{$fg_bold[$d_col]%}→ %{$reset_color%}' else PS1='%B%F{$d_col}%1~ %F{$b_col}${vcs_info_msg_0_}%(?.%F{$n_tru}.%F{$n_fal})%# %F{white}' - PS2='%_ %B%F{$d_col}-> %F{white}' + PS2='%_ %B%F{$d_col}→ %F{white}' fi } From 937f68024f9feb72680ef67d9a5b7a71593b812d Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Tue, 27 Apr 2010 14:37:44 +0100 Subject: [PATCH 115/153] Add less colouring. --- 06_less | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/06_less b/06_less index ebfad25..bff79e5 100644 --- a/06_less +++ b/06_less @@ -1,5 +1,13 @@ +export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking +export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold +export LESS_TERMCAP_me=$'\E[0m' # end mode +export LESS_TERMCAP_se=$'\E[0m' # end standout-mode +export LESS_TERMCAP_ue=$'\E[0m' # end underline +export LESS_TERMCAP_us=$'\E[04;38;5;146m' # begin underline +#export LESS_TERMCAP_so=$'\E[38;5;246m' # begin standout-mode - info box (This stops hilighting from working properly.) + if [[ -x `which lesspipe.sh` ]]; then export LESS="-R -M --shift 5" export LESSOPEN="|lesspipe.sh %s" export LESSCOLOR=1 -fi \ No newline at end of file +fi From 0e158ec7068d303d4070fa10d2ae71fbc073fcf4 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Tue, 27 Apr 2010 14:39:42 +0100 Subject: [PATCH 116/153] source some bash completion for stuff zsh doesn't have --- rc | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/rc b/rc index 40a23a1..c7a5b7a 100644 --- a/rc +++ b/rc @@ -77,13 +77,32 @@ zstyle ':completion:*:default' list-prompt '%S%M matches%s' autoload -Uz compinit compinit +bash_source() { + alias shopt=':' + alias _expand=_bash_expand + alias _complete=_bash_comp + emulate -L sh + setopt kshglob noshglob braceexpand + + source "$@" +} + +have() { + unset have + (( ${+commands[$1]} )) && have=yes +} + +autoload -Uz bashcompinit +bashcompinit +bash_source /etc/bash_completion.d/ack-grep + autoload -Uz colors colors if [[ $ZSH_VERSION > 4.3.6 ]]; then autoload -Uz vcs_info zstyle ':vcs_info:*' formats '%b ' - zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:%r' + zstyle ':vcs_info:(svn|bzr|csv):*' branchformat '%b:%r' zstyle ':vcs_info:cvs:*' branchformat '%r ' zstyle ':vcs_info:bzr:*' use-simple true zstyle ':vcs_info:*' enable git cvs svn hg bzr @@ -99,4 +118,4 @@ _cheat() { compadd print -l ${(s. .)$(cheat sheets | tr -d ' ' | tr '\n' ' ' | sed -e 's/AllCheatSheets://')} } -compdef _cheat cheat \ No newline at end of file +compdef _cheat cheat From de01fb69cff9de43853aed8358b605287e7860a8 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 30 May 2010 09:54:30 +0100 Subject: [PATCH 117/153] Fix typo. Thanks blueyed! --- rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc b/rc index c7a5b7a..f67ae2b 100644 --- a/rc +++ b/rc @@ -102,7 +102,7 @@ colors if [[ $ZSH_VERSION > 4.3.6 ]]; then autoload -Uz vcs_info zstyle ':vcs_info:*' formats '%b ' - zstyle ':vcs_info:(svn|bzr|csv):*' branchformat '%b:%r' + zstyle ':vcs_info:(svn|bzr|cvs):*' branchformat '%b:%r' zstyle ':vcs_info:cvs:*' branchformat '%r ' zstyle ':vcs_info:bzr:*' use-simple true zstyle ':vcs_info:*' enable git cvs svn hg bzr From 24869c0ad55728f7f271a1518d2a15e338fe17a9 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sat, 24 Jul 2010 15:11:29 +0100 Subject: [PATCH 118/153] Use is-at-least (thanks dreur) and remove some commented code. --- 10_hooks | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/10_hooks b/10_hooks index 5b36e1f..2450209 100644 --- a/10_hooks +++ b/10_hooks @@ -23,7 +23,7 @@ function title() { # precmd is called just before the prompt is printed function precmd() { # This may not be the best way of doing this. - if [[ $ZSH_VERSION < 4.3.7 ]] + if [[ ! is-at-least < 4.3.7 ]] then vcs_info_msg_0_=$(git-prompt) elif [[ $git_enable == 1 ]] @@ -40,30 +40,3 @@ function precmd() { function preexec() { title "$1" "$USER@%m" "%35<...<%~" } - -# Loads up .env.rc or .env files if there in the current tree. -# http://stackoverflow.com/questions/171563/whats-in-your-zshrc#211917 -# cd -q is only available on new zsh versions. -# i.e. it's in finks (4.5.6), but not Apple's (4.3.4) -# -# WARNING: this breaks 'cd -', since it seems to change oldpwd to /. -# -# if [[ $ZSH_VERSION > 4.3.4 ]]; then -# function chpwd; { -# DIRECTORY="$PWD" -# while true; do -# if [ -f './.env.rc' ]; then -# source './.env.rc' -# break -# fi -# # Removed as it clashes with zshkit'szshenv. -# # if [ -f './env' ]; then -# # source './env' -# # break -# # fi -# [ "$PWD" = '/' ] && break -# cd -q .. -# done -# cd -q "$DIRECTORY" -# } -# fi From 8bd7015f2838a1aa173a14bae56b992dbd6dad4a Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sat, 24 Jul 2010 15:14:57 +0100 Subject: [PATCH 119/153] autoload and use is-at-least. --- rc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rc b/rc index f67ae2b..08af569 100644 --- a/rc +++ b/rc @@ -99,7 +99,9 @@ bash_source /etc/bash_completion.d/ack-grep autoload -Uz colors colors -if [[ $ZSH_VERSION > 4.3.6 ]]; then +autoload -Uz is-at-least + +if is-at-least 4.3.6; then autoload -Uz vcs_info zstyle ':vcs_info:*' formats '%b ' zstyle ':vcs_info:(svn|bzr|cvs):*' branchformat '%b:%r' From 20f0a8f09bf07111ed22700e0937eb2fd4a0ca7a Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 29 Jul 2010 14:08:24 +0100 Subject: [PATCH 120/153] Make the rubygem directory dynamic by getting the ruby version from ruby, before building the path. --- 01_path | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/01_path b/01_path index cbcbca2..0830d97 100644 --- a/01_path +++ b/01_path @@ -1,3 +1,10 @@ +# Print ruby's version number (for adding gems to the path) +function get_ruby_version { + if [[ -x $(which ruby) ]]; then + print $(ruby -e 'puts RUBY_VERSION') + fi +} + # Add some dirs to the path. pathdirs=(/Library/Frameworks/Python.framework/Versions/Current/bin /usr/local/ActivePerl-5.10/bin @@ -5,7 +12,7 @@ pathdirs=(/Library/Frameworks/Python.framework/Versions/Current/bin /usr/local/bin /usr/local/git/bin /usr/local/libexec/git-core - /var/lib/gems/1.8/bin + /var/lib/gems/$(get_ruby_version)/bin /opt/local/bin ~/bin ) From 09aed8b550b103332a4bb4d979cf8626acd15c8e Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 29 Jul 2010 14:09:03 +0100 Subject: [PATCH 121/153] Add some more aliases. --- 05_ruby | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/05_ruby b/05_ruby index 0f2e0fa..39ada42 100644 --- a/05_ruby +++ b/05_ruby @@ -1,5 +1,7 @@ # Convenient. Also works in Gentoo or Ubuntu -if [[ -x `which irb1.8` ]]; then +if [[ -x $(which irb1.9.1) ]]; then + alias irb='irb1.9.1 --readline -r irb/completion' +elif [[ -x $(which irb1.8) ]]; then alias irb='irb1.8 --readline -r irb/completion' else alias irb='irb --readline -r irb/completion' @@ -7,4 +9,4 @@ fi export RI='-f ansi --width 70' if [[ -x `which fri` ]]; then alias ri=fri -fi \ No newline at end of file +fi From 2275335bf66bc4314af821d05b5e6720df6e27ae Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Thu, 29 Jul 2010 14:10:33 +0100 Subject: [PATCH 122/153] Make the irb alias more general using the get_ruby_version function. --- 05_ruby | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/05_ruby b/05_ruby index 39ada42..f4753c8 100644 --- a/05_ruby +++ b/05_ruby @@ -1,8 +1,6 @@ # Convenient. Also works in Gentoo or Ubuntu -if [[ -x $(which irb1.9.1) ]]; then +if [[ -x $(which irb$(get_ruby_version)) ]]; then alias irb='irb1.9.1 --readline -r irb/completion' -elif [[ -x $(which irb1.8) ]]; then - alias irb='irb1.8 --readline -r irb/completion' else alias irb='irb --readline -r irb/completion' fi From 9907f2bcd1421cf9a082e2f3a56a20f84d91ece3 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sat, 20 Nov 2010 16:20:25 +0000 Subject: [PATCH 123/153] Only set less' pretty colours on non-mac terminals. In iTerm and Terminal having these set causes everything to blink, which is distracting to say the least. --- 06_less | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/06_less b/06_less index bff79e5..0ff5b65 100644 --- a/06_less +++ b/06_less @@ -1,10 +1,16 @@ -export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking -export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold -export LESS_TERMCAP_me=$'\E[0m' # end mode -export LESS_TERMCAP_se=$'\E[0m' # end standout-mode -export LESS_TERMCAP_ue=$'\E[0m' # end underline -export LESS_TERMCAP_us=$'\E[04;38;5;146m' # begin underline -#export LESS_TERMCAP_so=$'\E[38;5;246m' # begin standout-mode - info box (This stops hilighting from working properly.) +# Setup some pretty colours for less. +# Unless we're using a terminal where everything just blinks. +if [[ $TERM_PROGRAM != 'iTerm.app' && + $TERM_PROGRAM != 'Apple_Terminal' + ]]; then + export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking + export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold + export LESS_TERMCAP_me=$'\E[0m' # end mode + export LESS_TERMCAP_se=$'\E[0m' # end standout-mode + export LESS_TERMCAP_ue=$'\E[0m' # end underline + export LESS_TERMCAP_us=$'\E[04;38;5;146m' # begin underline + export LESS_TERMCAP_so=$'\E[38;5;246m' # begin standout-mode - info box (This stops hilighting from working properly.) +fi if [[ -x `which lesspipe.sh` ]]; then export LESS="-R -M --shift 5" From cf9f51f5b8413ee2210160dcbd5477859ad8f0e5 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sat, 20 Nov 2010 16:21:37 +0000 Subject: [PATCH 124/153] Only load bash completion for ack if it exists. This should be made into a function. --- rc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rc b/rc index 08af569..00e356f 100644 --- a/rc +++ b/rc @@ -92,9 +92,13 @@ have() { (( ${+commands[$1]} )) && have=yes } +# Autoload some bash completion functions if they exist. autoload -Uz bashcompinit bashcompinit -bash_source /etc/bash_completion.d/ack-grep + +if [[ -e /etc/bash_completion.d/ack-grep ]];then + bash_source /etc/bash_completion.d/ack-grep +fi autoload -Uz colors colors From eaec74851dc4756cdfa268f70d60246bde07246e Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sat, 20 Nov 2010 17:09:09 +0000 Subject: [PATCH 125/153] Autoloadable function to test for iTerm/Terminal --- func/is-mac-terminal | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 func/is-mac-terminal diff --git a/func/is-mac-terminal b/func/is-mac-terminal new file mode 100644 index 0000000..c63c729 --- /dev/null +++ b/func/is-mac-terminal @@ -0,0 +1,11 @@ +# Small library of ZSH functions for detecting terminal programs. +# autoload is-mac-terminal + +mac_terminal_progs=(iTerm.app Apple_Terminal) +for prog ($mac_terminal_progs) { + if [[ "$TERM_PROGRAM" == "$prog" ]]; then + return 0 + fi +} + +return 1 From 6f4a9427221cbb412e1410d71a65035c6d779911 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sat, 20 Nov 2010 17:10:10 +0000 Subject: [PATCH 126/153] Update less termcap setting code to use new function. Use is-mac-terminal instead of hard-coding it. --- 06_less | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/06_less b/06_less index 0ff5b65..184672d 100644 --- a/06_less +++ b/06_less @@ -1,8 +1,8 @@ # Setup some pretty colours for less. # Unless we're using a terminal where everything just blinks. -if [[ $TERM_PROGRAM != 'iTerm.app' && - $TERM_PROGRAM != 'Apple_Terminal' - ]]; then +autoload is-mac-terminal + +if ! is-mac-terminal; then export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold export LESS_TERMCAP_me=$'\E[0m' # end mode From 88c687a017344862b2c8c9ad30cde6d07b4521d9 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sat, 20 Nov 2010 17:11:51 +0000 Subject: [PATCH 127/153] Use new is-mac-terminal function to decide on colour use. --- 06_less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/06_less b/06_less index 184672d..08c6550 100644 --- a/06_less +++ b/06_less @@ -1,6 +1,6 @@ # Setup some pretty colours for less. # Unless we're using a terminal where everything just blinks. -autoload is-mac-terminal +autoload -U is-mac-terminal if ! is-mac-terminal; then export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking From 48e90866c21d86a6c8c998eb4d1916ee5f107252 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Tue, 28 Dec 2010 19:16:29 +0000 Subject: [PATCH 128/153] Remove some empty lines --- 05_grep | 2 -- 1 file changed, 2 deletions(-) diff --git a/05_grep b/05_grep index adc42bf..7884feb 100644 --- a/05_grep +++ b/05_grep @@ -6,5 +6,3 @@ fi # From zsh-lovers: detect gnu grep: (grep --help 2>/dev/null |grep -- --color) >/dev/null && \ export GREP_OPTIONS='--color=auto' - - From 9f7883a63ae4395a848d4b591cd4bc4c6cbd1ea0 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 29 Dec 2010 15:29:24 +0000 Subject: [PATCH 129/153] Source GNU coreutils when installed with brew brew's formula comes with a file of shell aliases. Since the GNU coreutils can do sane things, like process files without newlines on the final line, let's source them. --- 05_gnu_coreutils | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 05_gnu_coreutils diff --git a/05_gnu_coreutils b/05_gnu_coreutils new file mode 100644 index 0000000..d9cd357 --- /dev/null +++ b/05_gnu_coreutils @@ -0,0 +1,6 @@ +# Include GNU coreutils aliases if installed via homebrew + +ALIASES=$(brew --prefix coreutils)/aliases +if [ -e $ALIASES ]; then + source $ALIASES +fi From 067e515d2dcadfe7202df6bd9accb9cff7c74817 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 29 Dec 2010 15:31:20 +0000 Subject: [PATCH 130/153] Ignore vim swap files. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3819313 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.swp +*.swo From 6c32a69b17ace3c243d55d335e4ee34e9d640e9a Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 29 Dec 2010 15:49:13 +0000 Subject: [PATCH 131/153] Don't include the alias for [ from coreutils. This gave me problems with my git prompt, so I'm excluding now. --- 05_gnu_coreutils | 2 ++ 1 file changed, 2 insertions(+) diff --git a/05_gnu_coreutils b/05_gnu_coreutils index d9cd357..5a967d9 100644 --- a/05_gnu_coreutils +++ b/05_gnu_coreutils @@ -3,4 +3,6 @@ ALIASES=$(brew --prefix coreutils)/aliases if [ -e $ALIASES ]; then source $ALIASES + # Whilst experimenting I had probes with my prompt and g[ + unalias [ fi From d847a0257a95418f52900a6dfc69069d2d171845 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sat, 1 Jan 2011 23:11:47 +0000 Subject: [PATCH 132/153] Fix typo in comment. --- 05_gnu_coreutils | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/05_gnu_coreutils b/05_gnu_coreutils index 5a967d9..1bed522 100644 --- a/05_gnu_coreutils +++ b/05_gnu_coreutils @@ -3,6 +3,6 @@ ALIASES=$(brew --prefix coreutils)/aliases if [ -e $ALIASES ]; then source $ALIASES - # Whilst experimenting I had probes with my prompt and g[ + # Whilst experimenting I had problems with my prompt and g[ unalias [ fi From c9c7145129f7647170fee0b517f62529153fc031 Mon Sep 17 00:00:00 2001 From: smix Date: Thu, 6 Jan 2011 04:36:42 +0300 Subject: [PATCH 133/153] using ls -G if possible --- 05_ls | 2 ++ 1 file changed, 2 insertions(+) diff --git a/05_ls b/05_ls index 44830a0..39755d0 100644 --- a/05_ls +++ b/05_ls @@ -4,6 +4,8 @@ if [[ -x `which gls` ]]; then elif [[ $(uname) == 'FreeBSD' ]]; then export CLICOLOR="yes" export LSCOLORS='ExfxcxdxbxEgEdabagacad' +elif [[ -n `ls -G` && $? == 0 ]]; then + alias ls='ls -G' elif [[ -n `ls --color` && $? == 0 ]]; then # Check if ls can handle the --color option. If it can it's probably gnu. alias ls='ls --color=auto' From ecaccb6cc1376ea817edc720e6736c30b7450303 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 9 Jan 2011 21:51:04 +0000 Subject: [PATCH 134/153] Tidy and update path setup script. Tidied the file. Update gem path to query gem directly. Removed some old perl directories. Removed cdpath and some named directories I no longer use. --- 01_path | 98 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/01_path b/01_path index 0830d97..f72839f 100644 --- a/01_path +++ b/01_path @@ -1,64 +1,64 @@ -# Print ruby's version number (for adding gems to the path) -function get_ruby_version { - if [[ -x $(which ruby) ]]; then - print $(ruby -e 'puts RUBY_VERSION') - fi -} +# +# Set up path variables +# +# Note: it doesn't matter if directories in the lists don't exist, as they +# won't be added to the path unless they do. +# -# Add some dirs to the path. -pathdirs=(/Library/Frameworks/Python.framework/Versions/Current/bin - /usr/local/ActivePerl-5.10/bin - /usr/local/ActivePerl-5.10/site/bin - /usr/local/bin - /usr/local/git/bin - /usr/local/libexec/git-core - /var/lib/gems/$(get_ruby_version)/bin - /opt/local/bin - ~/bin ) +# Create a list of directories to add to the path +pathdirs=( + /Library/Frameworks/Python.framework/Versions/Current/bin + /usr/local/bin + /usr/local/git/bin + /usr/local/libexec/git-core + /opt/local/bin + $HOME/bin +) -for dir ($pathdirs) - if [[ -d $dir ]]; then - path=($dir $path) - fi +# Query the gem configuration to get the correct path +# XXX: This might cause problems if you alias 'gem' to something else after the path has been setup. +if [[ -x $(which gem) ]]; then + # 's.:.' creates an array by splitting on ':'. + pathdirs+=(${(s.:.)"$(gem environment gempath)"}) +fi -cdpath=(~ ~/Projects ~/Work) +# Add directories which exist to the path +for dir ($pathdirs) + if [[ -d $dir ]]; then + path=($dir $path) + fi # Allow MacPorts man pages and others -dirs=( /usr/local/git/man - /sw/share/man - /opt/local/man /usr/local/man - $HOME/Library/Documentation/Local/man - /usr/local/ActivePerl-5.10/man - /usr/local/ActivePerl-5.10/site/man) - -for dir ($dirs) - if [[ -x $dir ]]; then - manpath=($manpath $dir) +dirs=( + /usr/local/git/man + /sw/share/man + /opt/local/man + /usr/local/man + $HOME/Library/Documentation/Local/man +) + +# Add directories which exist to the manpath +for dir ($dirs) + if [[ -x $dir ]]; then + manpath=($manpath $dir) fi # Add function paths -# funcdirs=( $HOME/.zsh/func /sw/share/zsh/ /sw/share/zsh/VCS_Info /sw/share/zsh/VCS_Info/Backends) -# I'm using a manually installed zsh 4.3.9 - binary=$(which zsh) install_path=$binary:h:h # Strip bin/zsh to find installation path. -funcdirs=( $HOME/.zsh/func $install_path/share/zsh/4.3.9/functions - $install_path/share/zsh/4.3.6/functions - $install_path/share/zsh/4.2.6/functions - /usr/share/zsh/4.2.6/functions - /usr/share/zsh/4.3.6/functions +funcdirs=( + $HOME/.zsh/func $install_path/share/zsh/4.3.9/functions + $install_path/share/zsh/4.3.6/functions + $install_path/share/zsh/4.2.6/functions + /usr/share/zsh/4.2.6/functions + /usr/share/zsh/4.3.6/functions ) -for dir ($funcdirs) - if [[ -x $dir ]]; then - fpath=($fpath $dir) + +# Add exxisting function directories to the fpath +for dir ($funcdirs) + if [[ -x $dir ]]; then + fpath=($fpath $dir) fi typeset -gU path cdpath manpath fpath - -# A few named directories cd by doing cd ~D etc. -D=~/Documents -DL=~/Downloads -P=~/Projects -W=~/work -Z=~/Projects/zshkit From 19364480fa857af8ee28ad8715bbfb75f5feb238 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 9 Jan 2011 22:12:06 +0000 Subject: [PATCH 135/153] Add autoloadable function to export ruby version. --- func/get-ruby-version | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 func/get-ruby-version diff --git a/func/get-ruby-version b/func/get-ruby-version new file mode 100644 index 0000000..b24501f --- /dev/null +++ b/func/get-ruby-version @@ -0,0 +1,10 @@ +# Determine ruby version and export it some useful variables. +# autoload get-ruby-version + +if [[ -x $(which ruby) ]]; then + RUBY_VERSION=$(ruby -e 'puts RUBY_VERSION') # e.g. 1.8.7 + RUBY_MAJOR_VERSION=$(ruby -e 'puts RUBY_VERSION.gsub(/[.]\d+$/, "")') # e.g. 1.8 + return 0; +fi + +return 1; From 76ba96282b2404fbe620e938f538f97bc8ed4968 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 9 Jan 2011 22:13:35 +0000 Subject: [PATCH 136/153] Update to use new get-ruby-version function. Also refactor to pull out common irb arguments. --- 05_ruby | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/05_ruby b/05_ruby index f4753c8..4d13a95 100644 --- a/05_ruby +++ b/05_ruby @@ -1,10 +1,20 @@ -# Convenient. Also works in Gentoo or Ubuntu -if [[ -x $(which irb$(get_ruby_version)) ]]; then - alias irb='irb1.9.1 --readline -r irb/completion' +# +# Set up ruby +# +autoload -U get-ruby-version && get-ruby-version + +# If you alias ruby to (say) ruby 1.9, this should update irb too. +# You might want to alias 'gem' here too, if you do, remember to update your path. +local irb_options="--readline -r irb/completion" + +if [[ -x $(which irb$RUBY_VERSION) ]]; then + alias irb='irb$RUBY_VERSION $irb_options' else - alias irb='irb --readline -r irb/completion' + alias irb="irb $irb_options" fi + export RI='-f ansi --width 70' + if [[ -x `which fri` ]]; then alias ri=fri fi From 3d9404f5bfb2226b7380af867da53711116381ad Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 9 Jan 2011 22:15:43 +0000 Subject: [PATCH 137/153] =?UTF-8?q?Localise=20some=20variables.=C2=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01_path | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/01_path b/01_path index f72839f..9967aef 100644 --- a/01_path +++ b/01_path @@ -44,8 +44,8 @@ for dir ($dirs) fi # Add function paths -binary=$(which zsh) -install_path=$binary:h:h # Strip bin/zsh to find installation path. +local binary=$(which zsh) +local install_path=$binary:h:h # Strip bin/zsh to find installation path. funcdirs=( $HOME/.zsh/func $install_path/share/zsh/4.3.9/functions From a47be07cc7505c22edfeaaa853a9a405f4c43e3b Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 9 Jan 2011 22:18:55 +0000 Subject: [PATCH 138/153] Update function paths to use $ZSH_VERSION. This should be better than using common versions. --- 01_path | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/01_path b/01_path index 9967aef..51c08e8 100644 --- a/01_path +++ b/01_path @@ -48,11 +48,9 @@ local binary=$(which zsh) local install_path=$binary:h:h # Strip bin/zsh to find installation path. funcdirs=( - $HOME/.zsh/func $install_path/share/zsh/4.3.9/functions - $install_path/share/zsh/4.3.6/functions - $install_path/share/zsh/4.2.6/functions - /usr/share/zsh/4.2.6/functions - /usr/share/zsh/4.3.6/functions + $HOME/.zsh/func + $install_path/share/zsh/$ZSH_VERSION/functions + /usr/share/zsh/$ZSH_VERSION/functions ) # Add exxisting function directories to the fpath From 8a736c25ed69b5c99f25a0477f5a59c6874fd17b Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 9 Jan 2011 22:34:32 +0000 Subject: [PATCH 139/153] Fix usage of is-at-least. --- 10_hooks | 2 +- func/prompt_minimal_vcs_setup | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/10_hooks b/10_hooks index 2450209..2eb93f4 100644 --- a/10_hooks +++ b/10_hooks @@ -23,7 +23,7 @@ function title() { # precmd is called just before the prompt is printed function precmd() { # This may not be the best way of doing this. - if [[ ! is-at-least < 4.3.7 ]] + if is-at-least 4.3.7 then vcs_info_msg_0_=$(git-prompt) elif [[ $git_enable == 1 ]] diff --git a/func/prompt_minimal_vcs_setup b/func/prompt_minimal_vcs_setup index d8d8327..f7d0333 100644 --- a/func/prompt_minimal_vcs_setup +++ b/func/prompt_minimal_vcs_setup @@ -9,6 +9,8 @@ # 3) Load up the prompt theme extension, and set the prompt: # autoload promptinit && promptinit && prompt minimal_vcs +autoload -U is-at-least + # Prompt setup function function prompt_minimal_vcs_setup { @@ -19,8 +21,8 @@ function prompt_minimal_vcs_setup { b_col=${2-'yellow'} n_tru=${3:-'blue'} n_fal=${4:-'red'} - # I've no idea why the %F style colours don't work whhen SHLVL == 1 - if [[ $SHLVL == 1 || $ZSH_VERSION < 4.3.7 ]]; then + # I've no idea why the %F style colours don't work when SHLVL == 1 + if is-at-least 4.3.7 || [[ $SHLVL == 1 ]]; then PS1='%{$fg_bold[$d_col]%}%1~ %{$fg_bold[$b_col]%}${vcs_info_msg_0_}%(?.%{$fg_bold[$n_tru]%}.%{$fg[$n_fal]%})%# %{$reset_color%}' PS2='%_ %{$fg_bold[$d_col]%}→ %{$reset_color%}' else From 2faf555bc61343f63c53107d88ce1866a9218dbb Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 9 Jan 2011 22:41:37 +0000 Subject: [PATCH 140/153] Updated README with more info on my prompt. --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 779c227..714c550 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,20 @@ An easily extensible collection of `stuff` for zsh. ## Prompt info -I'm currently playing with the prompt, using `vcs_info`. For this to work, you'll need a version zsh > 4.3.6 (IIRC). +I've included my prompt, 'Minimal VCS. As the name suggests this is a minimal +prompt with VCS information via `vcs_info`. For this to work, you'll need a +version zsh > 4.3.6 (IIRC). + +See `func/minimal_vcs_setup` for details, or run: + + autoload promptinit && promptinit + prompt -h minimal_vcs + +Proper functioning requires the 10_hooks to be loaded too, since `vcs_info` +must be run to update the prompt. It's also so minimal that you'll probably +want useful the useful information included in the title function. ## Current issues: * I haven't found a way to easily show when the repo is dirty. -* On my mac, opening additional zsh terminals doesn't give me coloured prompts. * I keep seeing bits and bobs alluding to a 'new prompt colour' syntax, but I can't find any docs. - From 0bf28b17355a8a98f4b5c67fe52f5ffd54cebd06 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 9 Jan 2011 23:04:32 +0000 Subject: [PATCH 141/153] Set LS_COLORS outside of tests. --- 05_ls | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/05_ls b/05_ls index 39755d0..c37115f 100644 --- a/05_ls +++ b/05_ls @@ -9,10 +9,11 @@ elif [[ -n `ls -G` && $? == 0 ]]; then elif [[ -n `ls --color` && $? == 0 ]]; then # Check if ls can handle the --color option. If it can it's probably gnu. alias ls='ls --color=auto' - export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=0;32:*.jpe=0;32:*.jpeg=0;32:*.gif=0;32:*.bmp=0;32:*.pbm=0;32:*.pgm=0;32:*.ppm=0;32:*.tga=0;32:*.xbm=0;32:*.xpm=0;32:*.tif=0;32:*.tiff=0;32:*.png=0;32:*.eps=0;32:*.mpg=0;32:*.mpeg=0;32:*.avi=0;32:*.fli=0;32:*.gl=0;32:*.dl=0;32:*.xcf=0;32:*.xwd=0;32:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:*.flac=01;35:*.m4a=01;35:*.mpc=01;35:*.o=01;33:*.c=01;35:*.m=01;35:*.h=01;35:*.rb=01;35:*.pl=01;35:*.py=01;35:*.sh=01;35:*.m=01;35:*akefile=0;35:*tags=01;32:*~=01;30:*.swp=01;30:*README=01;31:*README.*=01;31:*readme=00;31:*.tex=01;31:*.htm=01;31:*.html=01;31:*.pdf=00;31:*.PDF=00;31:*.ps=00;31:*.PS=00;31:*.png=00;31:*.PNG=00;31:*.jpg=00;31:*.JPG=00;31:*.jpeg=00;31:*.JPEG=00;31:'; fi +export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=0;32:*.jpe=0;32:*.jpeg=0;32:*.gif=0;32:*.bmp=0;32:*.pbm=0;32:*.pgm=0;32:*.ppm=0;32:*.tga=0;32:*.xbm=0;32:*.xpm=0;32:*.tif=0;32:*.tiff=0;32:*.png=0;32:*.eps=0;32:*.mpg=0;32:*.mpeg=0;32:*.avi=0;32:*.fli=0;32:*.gl=0;32:*.dl=0;32:*.xcf=0;32:*.xwd=0;32:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:*.flac=01;35:*.m4a=01;35:*.mpc=01;35:*.o=01;33:*.c=01;35:*.m=01;35:*.h=01;35:*.rb=01;35:*.pl=01;35:*.py=01;35:*.sh=01;35:*.m=01;35:*akefile=0;35:*tags=01;32:*~=01;30:*.swp=01;30:*README=01;31:*README.*=01;31:*readme=00;31:*.tex=01;31:*.htm=01;31:*.html=01;31:*.pdf=00;31:*.PDF=00;31:*.ps=00;31:*.PS=00;31:*.png=00;31:*.PNG=00;31:*.jpg=00;31:*.JPG=00;31:*.jpeg=00;31:*.JPEG=00;31:'; + alias l='ls' alias ll='ls -al' alias lh='ls -Alh' -alias lt='ls -Alt' \ No newline at end of file +alias lt='ls -Alt' From b2d5c2f4364ec8351cbd98062fb72903fbfaa650 Mon Sep 17 00:00:00 2001 From: smix Date: Mon, 10 Jan 2011 16:13:22 +0300 Subject: [PATCH 142/153] textmate & bundle gem conflicts fix --- 05_editor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/05_editor b/05_editor index 07482de..023642a 100644 --- a/05_editor +++ b/05_editor @@ -6,7 +6,7 @@ function not_run_from_ssh () { echo $? } -if [[ -x `which mate` && $(not_run_from_ssh) = 1 ]]; then +if [[ -n `bundle` && $? = 0 && -x `which mate` && $(not_run_from_ssh) = 1 ]]; then EDITOR="mate -w" # Useful functions for bundle development function reload_textmate(){ From 10fbea77a54ccb32a246f458fcfa988d56f5a68d Mon Sep 17 00:00:00 2001 From: smix Date: Mon, 10 Jan 2011 16:18:12 +0300 Subject: [PATCH 143/153] fixed ls colors --- 05_ls | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/05_ls b/05_ls index c37115f..f5278b5 100644 --- a/05_ls +++ b/05_ls @@ -1,9 +1,6 @@ if [[ -x `which gls` ]]; then alias rls=`which ls` alias ls='gls -h --color=auto ' -elif [[ $(uname) == 'FreeBSD' ]]; then - export CLICOLOR="yes" - export LSCOLORS='ExfxcxdxbxEgEdabagacad' elif [[ -n `ls -G` && $? == 0 ]]; then alias ls='ls -G' elif [[ -n `ls --color` && $? == 0 ]]; then @@ -11,7 +8,13 @@ elif [[ -n `ls --color` && $? == 0 ]]; then alias ls='ls --color=auto' fi -export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=0;32:*.jpe=0;32:*.jpeg=0;32:*.gif=0;32:*.bmp=0;32:*.pbm=0;32:*.pgm=0;32:*.ppm=0;32:*.tga=0;32:*.xbm=0;32:*.xpm=0;32:*.tif=0;32:*.tiff=0;32:*.png=0;32:*.eps=0;32:*.mpg=0;32:*.mpeg=0;32:*.avi=0;32:*.fli=0;32:*.gl=0;32:*.dl=0;32:*.xcf=0;32:*.xwd=0;32:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:*.flac=01;35:*.m4a=01;35:*.mpc=01;35:*.o=01;33:*.c=01;35:*.m=01;35:*.h=01;35:*.rb=01;35:*.pl=01;35:*.py=01;35:*.sh=01;35:*.m=01;35:*akefile=0;35:*tags=01;32:*~=01;30:*.swp=01;30:*README=01;31:*README.*=01;31:*readme=00;31:*.tex=01;31:*.htm=01;31:*.html=01;31:*.pdf=00;31:*.PDF=00;31:*.ps=00;31:*.PS=00;31:*.png=00;31:*.PNG=00;31:*.jpg=00;31:*.JPG=00;31:*.jpeg=00;31:*.JPEG=00;31:'; + +if [[ $(uname) == 'FreeBSD' || $(uname) == 'Darwin' ]]; then + export CLICOLOR="yes" + export LSCOLORS='ExfxcxdxbxEgEdabagacad' +else + export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=0;32:*.jpe=0;32:*.jpeg=0;32:*.gif=0;32:*.bmp=0;32:*.pbm=0;32:*.pgm=0;32:*.ppm=0;32:*.tga=0;32:*.xbm=0;32:*.xpm=0;32:*.tif=0;32:*.tiff=0;32:*.png=0;32:*.eps=0;32:*.mpg=0;32:*.mpeg=0;32:*.avi=0;32:*.fli=0;32:*.gl=0;32:*.dl=0;32:*.xcf=0;32:*.xwd=0;32:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:*.flac=01;35:*.m4a=01;35:*.mpc=01;35:*.o=01;33:*.c=01;35:*.m=01;35:*.h=01;35:*.rb=01;35:*.pl=01;35:*.py=01;35:*.sh=01;35:*.m=01;35:*akefile=0;35:*tags=01;32:*~=01;30:*.swp=01;30:*README=01;31:*README.*=01;31:*readme=00;31:*.tex=01;31:*.htm=01;31:*.html=01;31:*.pdf=00;31:*.PDF=00;31:*.ps=00;31:*.PS=00;31:*.png=00;31:*.PNG=00;31:*.jpg=00;31:*.JPG=00;31:*.jpeg=00;31:*.JPEG=00;31:'; +fi alias l='ls' alias ll='ls -al' From 67ff5daa48ccbd86a775459f0afb864f01b02e2f Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 10 Jan 2011 18:57:13 +0000 Subject: [PATCH 144/153] Updates to editor selection. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace backticks with $(…) for clarity. I don't have 'bundle' installed on my system -- is this a ruby gem? -- so check it exists before trying to run it. Also, remove the massive if/else and replace with a more compact loop. Still todo: editor specific arguments. --- 05_editor | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/05_editor b/05_editor index 023642a..0c37d97 100644 --- a/05_editor +++ b/05_editor @@ -1,12 +1,23 @@ export EDITOR export CVSEDITOR -function not_run_from_ssh () { - ps x|grep "${PPID}.*sshd"|grep -v grep - echo $? +# Define an order or preference for text editors +local editors +editors=(mate mvim gvim vim vi nano pico) + +# Look for the first of these editors which exists +for editor ($editors) { + if [[ -x $(which $editor) ]]; then + EDITOR=$editor + break + fi } -if [[ -n `bundle` && $? = 0 && -x `which mate` && $(not_run_from_ssh) = 1 ]]; then +# Print a warning if there's still no editor set. +[[ -z $EDITOR ]] && print 'No editor set.' + +# TextMate specific stuff: +if [[ $EDITOR == 'mate' && -x $(which bundle) && -n $(bundle) && $? = 0 && -z $SSH_CLIENT ]]; then EDITOR="mate -w" # Useful functions for bundle development function reload_textmate(){ @@ -19,19 +30,6 @@ if [[ -n `bundle` && $? = 0 && -x `which mate` && $(not_run_from_ssh) = 1 ]]; th bundle_path="$HOME/Library/Application Support/TextMate/Bundles" compadd $(print -l $bundle_path/*.tmbundle(:t:r)) } -elif [[ -x `which gvim` ]]; then - EDITOR=gvim - CVSEDITOR='gvim -f' -elif [[ -x `which vim` ]]; then - EDITOR=vim -elif [[ -x `which vi` ]]; then - EDITOR=vi -elif [[ -x `which nano` ]]; then - EDITOR=nano -elif [[ -x `which pico` ]]; then - EDITOR=pico -else - EDITOR=vi fi # Set EDITOR as default for plaintext stuff From 73b1ee5c31ca7199d6027f765b25a092644b7fee Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 10 Jan 2011 19:00:44 +0000 Subject: [PATCH 145/153] Add gvim/mvim specific options. --- 05_editor | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/05_editor b/05_editor index 0c37d97..5980c79 100644 --- a/05_editor +++ b/05_editor @@ -13,6 +13,11 @@ for editor ($editors) { fi } +# Some editors need specific arguments for VCS +if [[ $EDITOR == 'mvim' || $EDITOR == 'gvim' ]]; then + export CVSEDITOR="$EDITOR -f" # Don't fork. +fi + # Print a warning if there's still no editor set. [[ -z $EDITOR ]] && print 'No editor set.' From 3f427496a2ed09d0ddd203dc3fcaafa7919be5eb Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 10 Jan 2011 22:13:35 +0000 Subject: [PATCH 146/153] Update path setting code to add /bin to gem paths. This should now actually work. --- 01_path | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/01_path b/01_path index 51c08e8..749142d 100644 --- a/01_path +++ b/01_path @@ -19,7 +19,9 @@ pathdirs=( # XXX: This might cause problems if you alias 'gem' to something else after the path has been setup. if [[ -x $(which gem) ]]; then # 's.:.' creates an array by splitting on ':'. - pathdirs+=(${(s.:.)"$(gem environment gempath)"}) + gemdirs=(${(s.:.)"$(gem environment gempath)"}) + # The paths above don't end with /bin. + for dir ($gemdirs) { pathdirs=($pathdirs "$dir/bin") } fi # Add directories which exist to the path From 0556eba540ba5666d1919a16f9ad8038fac3d69d Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 12 Jan 2011 08:41:18 +0000 Subject: [PATCH 147/153] Fix indentation and add block delimiters to for loops. This should make things easier to read. --- 01_path | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/01_path b/01_path index 749142d..76e3d57 100644 --- a/01_path +++ b/01_path @@ -18,17 +18,18 @@ pathdirs=( # Query the gem configuration to get the correct path # XXX: This might cause problems if you alias 'gem' to something else after the path has been setup. if [[ -x $(which gem) ]]; then - # 's.:.' creates an array by splitting on ':'. - gemdirs=(${(s.:.)"$(gem environment gempath)"}) - # The paths above don't end with /bin. - for dir ($gemdirs) { pathdirs=($pathdirs "$dir/bin") } + # 's.:.' creates an array by splitting on ':'. + gemdirs=(${(s.:.)"$(gem environment gempath)"}) + # The paths above don't end with /bin. + for dir ($gemdirs) { pathdirs=($pathdirs "$dir/bin") } fi # Add directories which exist to the path -for dir ($pathdirs) +for dir ($pathdirs) { if [[ -d $dir ]]; then path=($dir $path) fi +} # Allow MacPorts man pages and others dirs=( @@ -40,10 +41,11 @@ dirs=( ) # Add directories which exist to the manpath -for dir ($dirs) +for dir ($dirs) { if [[ -x $dir ]]; then manpath=($manpath $dir) fi +} # Add function paths local binary=$(which zsh) @@ -56,9 +58,10 @@ funcdirs=( ) # Add exxisting function directories to the fpath -for dir ($funcdirs) +for dir ($funcdirs) { if [[ -x $dir ]]; then fpath=($fpath $dir) fi +} typeset -gU path cdpath manpath fpath From a752ba2e8e6ae2b188532fb69d74674202ca1e34 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 17 Jan 2011 23:07:31 +0000 Subject: [PATCH 148/153] Update help directory selection. I haven't managed to test this, as brew doesn't give an easy way to install the zsh help files. --- 01_path | 29 +++++++++++++--- 03_help | 100 +++++++++++++++++++++++++++++--------------------------- 2 files changed, 77 insertions(+), 52 deletions(-) diff --git a/01_path b/01_path index 76e3d57..1189981 100644 --- a/01_path +++ b/01_path @@ -5,6 +5,8 @@ # won't be added to the path unless they do. # +local pathdirs mandirs funcdirs helpdirs + # Create a list of directories to add to the path pathdirs=( /Library/Frameworks/Python.framework/Versions/Current/bin @@ -32,7 +34,7 @@ for dir ($pathdirs) { } # Allow MacPorts man pages and others -dirs=( +mandirs=( /usr/local/git/man /sw/share/man /opt/local/man @@ -41,7 +43,7 @@ dirs=( ) # Add directories which exist to the manpath -for dir ($dirs) { +for dir ($mandirs) { if [[ -x $dir ]]; then manpath=($manpath $dir) fi @@ -54,14 +56,33 @@ local install_path=$binary:h:h # Strip bin/zsh to find installation path. funcdirs=( $HOME/.zsh/func $install_path/share/zsh/$ZSH_VERSION/functions + $install_path/share/zsh/functions /usr/share/zsh/$ZSH_VERSION/functions + /usr/share/zsh/functions ) -# Add exxisting function directories to the fpath +# Add existing function directories to the fpath for dir ($funcdirs) { if [[ -x $dir ]]; then fpath=($fpath $dir) fi } -typeset -gU path cdpath manpath fpath +# Directories for run-help: see 03_help. +helpdirs=( + $HOME/.zsh/help + $install_path/share/zsh/$ZSH_VERSION/zsh_help + $install_path/share/zsh/zsh_help + /usr/share/zsh/$ZSH_VERSION/zsh_help + /usr/share/zsh/zsh_help +) + +for dir ($helpdirs) { + if [[ -x $dir ]]; then + helpdir=($fpath $dir) + fi +} + +typeset -gU path cdpath manpath fpath helpdir + +# vim: set syn=zsh: diff --git a/03_help b/03_help index eb29839..9ba45f9 100644 --- a/03_help +++ b/03_help @@ -2,58 +2,62 @@ if [[ $(whence -v run-help) == 'run-help is a shell function' ]]; then unalias run-help fi -export HELPDIR='/sw/share/zsh/zsh_help' autoload -Uz run-help # From zsh-helpfiles (see fink) alias help=run-help # From zsh-lovers # Function Usage: doc packagename -if [[ -d /sw/share/doc ]]; then - doc() { cd /sw/share/doc/$1 && ls } - gdoc() { cd /sw/share/doc/$1 && gvim . } - _doc() { _files -W /sw/share/doc -/ } -elif [[ -d /usr/share/doc ]]; then - doc() { cd /usr/share/doc/$1 && ls } - gdoc() { cd /usr/share/doc/$1 && gvim . } - _doc() { _files -W /usr/share/doc -/ } -fi - # provide useful information on globbing - H-Glob() { - echo -e " - / directories - . plain files - @ symbolic links - = sockets - p named pipes (FIFOs) - * executable plain files (0100) - % device files (character or block special) - %b block special files - %c character special files - r owner-readable files (0400) - w owner-writable files (0200) - x owner-executable files (0100) - A group-readable files (0040) - I group-writable files (0020) - E group-executable files (0010) - R world-readable files (0004) - W world-writable files (0002) - X world-executable files (0001) - s setuid files (04000) - S setgid files (02000) - t files with the sticky bit (01000) - print *(m-1) # List files modified today. - print *(a1) # List files accessed one day ago. - print *(@) # Print links. - print *(Lk+50) # List files > 50 Kilobytes. - print *(Lk-50) # List files < 50 Kilobytes. - print **/*.c # Recursively list all c files. - print **/*.c~file.c # List all c files, except file.c - print (foo|bar).* # List files whos names start foo or bar. - print *~*.* # - chmod 644 *(.^x) # make all non-executable files publically readable - print -l *(.c|.h) # List all c and header files on their own lines. - print **/*(g:users:) # Recursively list files with the group 'users' - echo /proc/*/cwd(:h:t:s/self//) # Analogue of >ps ax | awk '{print $1}'<" - } +# We can only easily use one documentation directory, so +# these are in priority order +docdirs=(/sw/share/doc /usr/local/share/doc /usr/share/doc) + +foreach dir ($docdirs) { + if [[ -d $dir ]] then + doc() { cd $dir/$1 && ls } + gdoc() { cd $dir/$1 && $EDITOR . } + _doc() { _files -W $dir -/ } + break + fi +} + +# provide useful information on globbing +H-Glob() { + echo -e " + / directories + . plain files + @ symbolic links + = sockets + p named pipes (FIFOs) + * executable plain files (0100) + % device files (character or block special) + %b block special files + %c character special files + r owner-readable files (0400) + w owner-writable files (0200) + x owner-executable files (0100) + A group-readable files (0040) + I group-writable files (0020) + E group-executable files (0010) + R world-readable files (0004) + W world-writable files (0002) + X world-executable files (0001) + s setuid files (04000) + S setgid files (02000) + t files with the sticky bit (01000) + print *(m-1) # List files modified today. + print *(a1) # List files accessed one day ago. + print *(@) # Print links. + print *(Lk+50) # List files > 50 Kilobytes. + print *(Lk-50) # List files < 50 Kilobytes. + print **/*.c # Recursively list all c files. + print **/*.c~file.c # List all c files, except file.c + print (foo|bar).* # List files whos names start foo or bar. + print *~*.* # + chmod 644 *(.^x) # make all non-executable files publically readable + print -l *(.c|.h) # List all c and header files on their own lines. + print **/*(g:users:) # Recursively list files with the group 'users' + echo /proc/*/cwd(:h:t:s/self//) # Analogue of >ps ax | awk '{print $1}'<" +} +# vim: set syn=zsh: From 237138c474d8cb87db7afbbe67d53d83d4cf4545 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Mon, 17 Jan 2011 23:09:35 +0000 Subject: [PATCH 149/153] Set GIT_EDITOR and CVSEDITOR when using g/mvim. --- 05_editor | 2 ++ 1 file changed, 2 insertions(+) diff --git a/05_editor b/05_editor index 5980c79..4c6a955 100644 --- a/05_editor +++ b/05_editor @@ -1,5 +1,6 @@ export EDITOR export CVSEDITOR +export GIT_EDITOR # Define an order or preference for text editors local editors @@ -16,6 +17,7 @@ for editor ($editors) { # Some editors need specific arguments for VCS if [[ $EDITOR == 'mvim' || $EDITOR == 'gvim' ]]; then export CVSEDITOR="$EDITOR -f" # Don't fork. + export GIT_EDITOR="$EDITOR -f" # Don't fork. fi # Print a warning if there's still no editor set. From 1d1e7a7c752df164f74de5a30f549ac5c96c9f99 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Sun, 20 Feb 2011 11:57:12 +0000 Subject: [PATCH 150/153] Check brew is available. --- 05_gnu_coreutils | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/05_gnu_coreutils b/05_gnu_coreutils index 1bed522..2a79b2a 100644 --- a/05_gnu_coreutils +++ b/05_gnu_coreutils @@ -1,8 +1,9 @@ # Include GNU coreutils aliases if installed via homebrew - -ALIASES=$(brew --prefix coreutils)/aliases -if [ -e $ALIASES ]; then - source $ALIASES - # Whilst experimenting I had problems with my prompt and g[ - unalias [ +if [[ -x brew ]]; then + ALIASES=$(brew --prefix coreutils)/aliases + if [ -e $ALIASES ]; then + source $ALIASES + # Whilst experimenting I had problems with my prompt and g[ + unalias [ + fi fi From 3d9e7e9526630d000b16a78a480cb8c566ce071d Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 16 Mar 2011 11:06:49 +0000 Subject: [PATCH 151/153] vcs_info works on CentOS with version 4.2.6 --- 10_hooks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10_hooks b/10_hooks index 2eb93f4..cb67aea 100644 --- a/10_hooks +++ b/10_hooks @@ -23,7 +23,7 @@ function title() { # precmd is called just before the prompt is printed function precmd() { # This may not be the best way of doing this. - if is-at-least 4.3.7 + if is-at-least 4.2.6 then vcs_info_msg_0_=$(git-prompt) elif [[ $git_enable == 1 ]] From b5601839dea296803454893837d859a1061804dd Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 16 Mar 2011 11:07:14 +0000 Subject: [PATCH 152/153] Add site-functions to the fpath. --- 01_path | 2 ++ 1 file changed, 2 insertions(+) diff --git a/01_path b/01_path index 1189981..e793528 100644 --- a/01_path +++ b/01_path @@ -57,8 +57,10 @@ funcdirs=( $HOME/.zsh/func $install_path/share/zsh/$ZSH_VERSION/functions $install_path/share/zsh/functions + $install_path/share/zsh/site-functions /usr/share/zsh/$ZSH_VERSION/functions /usr/share/zsh/functions + /usr/share/zsh/site-functions ) # Add existing function directories to the fpath From 6de8ac62d0dc81624edb3c4d9974ce9cfbd72051 Mon Sep 17 00:00:00 2001 From: Matt Foster Date: Wed, 16 Mar 2011 11:42:45 +0000 Subject: [PATCH 153/153] ls -G works with GNU ls so this check doens't work as-is. For now check we're not using linux. --- 05_ls | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/05_ls b/05_ls index f5278b5..8954bdd 100644 --- a/05_ls +++ b/05_ls @@ -1,7 +1,8 @@ if [[ -x `which gls` ]]; then alias rls=`which ls` alias ls='gls -h --color=auto ' -elif [[ -n `ls -G` && $? == 0 ]]; then +# Unfortunatly GNU ls support -G. +elif [[ $(uname) != 'Linux' && -n `ls -G` && $? == 0 ]]; then alias ls='ls -G' elif [[ -n `ls --color` && $? == 0 ]]; then # Check if ls can handle the --color option. If it can it's probably gnu.