1
0
mirror of https://github.com/akelge/zsh synced 2025-07-03 21:19:06 +00:00

New version of zsh startup files:

- Supports Darwin AND Linux
- No more .zshrc.local
- New completion (BETA)
This commit is contained in:
2010-11-18 08:49:41 +00:00
parent e031a7efc9
commit 5b09568680
16 changed files with 223 additions and 165 deletions

34
zsh.d/90-functions Normal file
View File

@ -0,0 +1,34 @@
#######################################################################################
# Functions
# cdb - Goes to folder by complete path
function cdb { cd `dirname $1` }
# hist - Grep from history
function hist { grep -i $* $HISTFILE }
# hdu - Human readable report of files and directories sizes
# *Same behaviour as du*
function hdu () {
du -k $* | sort -nr | awk '{
# Prepare human readable
if($1>=1024*1024) { size=$1/1024/1024; unit="G" }
else if($1>=1024) { size=$1/1024; unit="M" }
else { size=$1; unit="K" };
format="%10.2f%s";
hsize=sprintf(format,size,unit);
# Remove $1 (size), then removes " " at the start of $0
$1=""; thepath=$0; sub(/^ /,"",thepath);
# Print size and path (directories are bolded)
if ( system("[ -d \""thepath"\" ]") )
printf "%-8s %s\n",hsize,thepath;
else
printf "%-8s \033[1m%s\033[0m/\n",hsize,thepath;
}'
}
# list total size in . directory
function dust () { hdu -s * }
# vim: set ts=4 sw=4 tw=0 ft=zsh :