dotfiles/zsh/bin/vim-recover

17 lines
306 B
Plaintext
Raw Normal View History

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