1
0
mirror of https://github.com/akelge/vim synced 2025-08-17 16:08:50 +00:00

Added function 'bak'. Splitted other functions

This commit is contained in:
2013-01-25 15:31:13 +00:00
parent 39f83930ab
commit 1915a3edf9
6 changed files with 158 additions and 22 deletions

View File

@ -2,33 +2,18 @@
# Functions
# cdb - Goes to folder by complete path
function cdb { cd `dirname $1` }
autoload -U cdb
# hist - Grep from history
function hist { grep -i $* $HISTFILE }
autoload -U hist
# hdu - Human readable report of files and directories sizes
# *Same behaviour as du*
function hdu () {
du -kc $* | 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);
autoload -U hdu
# Remove $1 (size), then removes " " at the start of $0
$1=""; thepath=$0; sub(/^ /,"",thepath);
# dust - list total size in . directory
autoload -U dust
# 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 * }
# bak - remove backup files
autoload -U bak
# vim: set ts=4 sw=4 tw=0 ft=zsh :