forked from simplogical/zshkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'mat/master' into develop
Conflicts: 01_path 05_editor 05_ls 06_git 06_less 10_bindkey 10_prompt
- Loading branch information
Showing
30 changed files
with
779 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.swp | ||
*.swo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# See From Bash to Z Shell, Page: 101 | ||
if [[ $(whence -v run-help) == 'run-help is a shell function' ]]; then | ||
unalias run-help | ||
fi | ||
autoload -Uz run-help | ||
# From zsh-helpfiles (see fink) | ||
alias help=run-help | ||
|
||
# From zsh-lovers | ||
# Function Usage: doc packagename | ||
|
||
# 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# 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 aptitude='noglob sudo aptitude' | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,56 @@ | ||
export EDITOR | ||
export CVSEDITOR | ||
export GIT_EDITOR | ||
|
||
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 [[ -x `which mvim` && $(not_run_from_ssh) = 1 ]]; then | ||
EDITOR="mvim -f" | ||
else | ||
EDITOR=`which vi` | ||
# 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. | ||
[[ -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(){ | ||
osascript -e 'tell app "TextMate" to reload bundles' | ||
} | ||
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)) | ||
} | ||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Include GNU coreutils aliases if installed via homebrew | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
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:' | ||
# 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. | ||
alias ls='ls --color=auto' | ||
fi | ||
if [[ `uname -s` = "Darwin" ]]; then | ||
alias ls='ls -G' | ||
|
||
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 ll="ls -al" | ||
|
||
export CLICOLOR=1 | ||
export LSCOLORS=gxfxaxdxcxegedabagacad | ||
alias l='ls' | ||
alias ll='ls -al' | ||
alias lh='ls -Alh' | ||
alias lt='ls -Alt' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export PYTHONPATH=$HOME/.python_libraries | ||
typeset -U PYTHONPATH | ||
|
||
alias pylab='ipython -pylab -wthread' | ||
alias easy_install='sudo easy_install' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alias rsyncp='rsync -avz -e ssh --progress --partial ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,20 @@ | ||
alias irb='irb --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 $irb_options" | ||
fi | ||
|
||
export RI='-f ansi --width 70' | ||
|
||
if [[ -x `which fri` ]]; then | ||
alias ri=fri | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# See: http://omino.com/sw/qt_tools/ | ||
if [[ -x `which qt_export` ]]; then | ||
create_image_mov() { | ||
if [[ $# = 0 ]] | ||
then | ||
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)" | ||
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 | ||
|
||
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 |
Oops, something went wrong.