Fixes bugs in vimrecover
This commit is contained in:
parent
d64d64082b
commit
4d87c0bde9
|
@ -1,16 +1,21 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Check recovery directory from vim
|
# Check recovery directory from vim
|
||||||
|
if [ $# -lt 1 ]; then
|
||||||
|
echo -e >&2 "\033[31;1merror:\033[0m vim-recover expects an argument"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f $1 ]; then
|
if [ -f $1 ]; then
|
||||||
echo >&2 Cannot recover an existing file...
|
echo -e >&2 "\033[31;1merror:\033[0m cannot recover an existing file"
|
||||||
return 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
backup_path=~/.nvim/backups/`echo $PWD/$1 | tr '/' '%'`
|
backup_path=~/.nvim/backups/`echo $PWD/$1 | tr '/' '%'`
|
||||||
|
|
||||||
if [ ! -f "$backup_path" ]; then
|
if [ ! -f "$backup_path" ]; then
|
||||||
echo >&2 Backup not found...
|
echo -e >&2 "\033[31;1merror:\033[0m backup not found"
|
||||||
return 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp $backup_path $1
|
cp $backup_path $1
|
||||||
|
|
Loading…
Reference in New Issue