dotfiles/zsh/bin/vim-recover

17 lines
298 B
Plaintext
Raw Normal View History

2019-02-11 16:40:33 +00:00
#!/usr/bin/env zsh
# Check recovery directory from vim
if [ -f $1 ]; then
echo >&2 Cannot recover an existing file...
return 1
fi
BACKUP_PATH=~/.vim/backups/`echo $PWD/$1 | tr '/' '%'`
if [ ! -f "$BACKUP_PATH" ]; then
echo >&2 Backup not found...
return 2
fi
cp $BACKUP_PATH $1