diff --git a/.config/zsh/zshrc.d/30-alias.zsh b/.config/zsh/zshrc.d/30-alias.zsh index cb5725a..ce579aa 100644 --- a/.config/zsh/zshrc.d/30-alias.zsh +++ b/.config/zsh/zshrc.d/30-alias.zsh @@ -99,10 +99,6 @@ alias lowres='() { xrandr -s 1920x1080; $1 "${@[2,-1]}"; xrandr -s 3200x1800 }' - # Create copy with .bkp extension - alias bkp='() { for f; do command cp -i "$f"{,.bkp}; done }' - # Reverse bkp() - alias unbkp='() { for f; do command cp -i "$f" "${f%.bkp}; done }' # Grep in history file alias histgrep='() { grep "$@" "${HISTFILE:-$HOME/.zsh_history}" }' # URL-encode diff --git a/.config/zsh/zshrc.d/40-functions.zsh b/.config/zsh/zshrc.d/40-functions.zsh index 159df90..92631e0 100644 --- a/.config/zsh/zshrc.d/40-functions.zsh +++ b/.config/zsh/zshrc.d/40-functions.zsh @@ -432,3 +432,21 @@ git-rebase-add-stash() { git add -u && git rebase --continue } + +# Create copy with a .bkp extension +bkp() { + for f; do + command cp -i "$f"{,.bkp} + done +} + +# Reverse bkp() +unbkp() { + for f; do + if [[ ${f%.bkp} != $f ]]; then + command mv -i "$f" "${f%.bkp}" + elif [[ -e $f.bkp ]]; then + command mv -i "$f.bkp" "$f" + fi + done +}