From 211ea5f862303b9510db28f8e99dba15de6619f5 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Thu, 29 Nov 2018 15:34:24 +0100 Subject: [PATCH] Added vim-recover --- zsh/functions.zsh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index e88c794..dde85f2 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -89,6 +89,23 @@ makelatex() { cp /home/thomas/.script/classgen/Makefile.latex ./Makefile } +# Check recovery directory from vim +vim-recover() { + 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 +} + source $HOME/.config/dotfiles/zsh/update.zsh source $HOME/.config/dotfiles/zsh/gclone.zsh