tmux context start + some clfu functions

master
Sebastian Tramp 2010-12-20 10:45:27 +01:00
parent 1dd3cc3c26
commit dc513b5c70
3 changed files with 39 additions and 1 deletions

View File

@ -30,7 +30,12 @@ alias -g NO='&>|/dev/null'
# http://rayninfo.co.uk/tips/zshtips.html
alias -g G='| grep -'
alias -g P='| $PAGER'
alias -g L='| less'
# http://www.commandlinefu.com/commands/view/7284/zsh-suffix-to-inform-you-about-long-command-ending
# zsh suffix to inform you about long command ending make, Just add "R" (without quotes) suffix to it and you can do other things:
# zsh will inform you when you can see the results.
alias -g R=' &; jobs | tail -1 | read A0 A1 A2 cmd; echo "running $cmd"; fg "$cmd"; zenity --info --text "$cmd done"; unset A0 A1 A2 cmd'
##### suffix aliases (mostly mapped to xdg-open which runs the gnome/kde default app)

View File

@ -15,6 +15,12 @@ bindkey '^Xs' run-with-sudo
memtop() {ps -eorss,args | sort -nr | pr -TW$COLUMNS | head}
zle -N memtop
tmuxhglog() {
tmux kill-pane -t 1
tmux split-window -h -l 40 "while true; do clear; date; echo; hg xlog-small -l 5 || exit; sleep 600; done;"
tmux select-pane -t 0
}
# Escape potential tarbombs
# http://www.commandlinefu.com/commands/view/6824/escape-potential-tarbombs
atb() {
@ -25,6 +31,22 @@ atb() {
fi ;
}
# http://www.commandlinefu.com/commands/view/4792/a-function-to-find-the-newest-file-in-a-directory
newest () { find ${1:-\.} -type f |xargs ls -lrt ; }
# http://www.commandlinefu.com/commands/view/7294/backup-a-file-with-a-date-time-stamp
buf () {
oldname=$1;
if [ "$oldname" != "" ]; then
datepart=$(date +%Y-%m-%d);
firstpart=`echo $oldname | cut -d "." -f 1`;
newname=`echo $oldname | sed s/$firstpart/$firstpart.$datepart/`;
cp ${oldname} ${newname};
fi
}
atomtitles () { curl --silent $1 | xmlstarlet sel -N atom="http://www.w3.org/2005/Atom" -t -m /atom:feed/atom:entry -v atom:title -n}
# reloads all functions
# http://www.zsh.org/mla/users/2002/msg00232.html

13
prompt
View File

@ -35,7 +35,18 @@ function precmd {
###
# Get Mercurial info
PR_MESSAGE=`hg branch 2>/dev/null`
PR_HG_BRANCH=`hg branch 2>/dev/null`
if [ "$?" != "255" ]; then
#tmuxhglog
PR_HG_CHANGECOUNTER=`hg st 2>/dev/null | wc -l`
if [ "$PR_HG_CHANGECOUNTER" != "0" ]; then
PR_MESSAGE="$PR_HG_BRANCH ($PR_HG_CHANGECOUNTER)"
else
PR_MESSAGE="$PR_HG_BRANCH"
fi
else
PR_MESSAGE=""
fi
}
setopt extended_glob
preexec () {