Add replay function

This commit is contained in:
David Todd 2020-03-24 14:55:38 -05:00
parent 3092e88e60
commit 9dc69b2e1c
2 changed files with 12 additions and 1 deletions

View File

@ -65,3 +65,14 @@ up() {
search () {
grep -r "$1" | fzf
}
# Usage: replay <number of commands> to repeat. Blank for 1
replay() {
from="${1:-2}"
to="${2:-1}"
if [ "$from" -ne "$to" ]; then
for i in `seq "$from" -1 "$(($to + 1))"`; do
printf "$(fc -ln -${i} -${i}) && "
done
fi
$(fc -ln -${to} -${to})
}

View File

@ -4,7 +4,7 @@ source ~/dotfiles/shell/aliases
source ~/dotfiles/shell/functions
# History Settings
export HISTIGNORE="&:ls:[bf]g:exit:reset:clear:cd:cd ..:cd.."
export HISTIGNORE="&:ls:[bf]g:exit:reset:clear:cd:cd ..:cd..:replay"
export HISTSIZE=25000
export HISTFILE=~/.zsh_history
export SAVEHIST=10000