Why?
I wrote this plugin after having lost a few hours re-writing a file I had deleted by accident (yes I was in a git repo, but I ran git clean -f
by accident - it happens)
I thought about several solutions and came up with this one, that you may find interesting.
Usage
- Download
kak-back
from my dotfiles repo - it’s a standalone Python3 script. - Make it executable and put it somewhere in your PATH
- Call
kak-back backup
in a WritePost hook:
hook global BufWritePost .* %{
nop %sh{ kak-back backup "${kak_hook_param}" }
}
- Restore a deleted file with :
kak-back restore PATH
Remember to run kak-back clean
from time to time, otherwise ~/.local/share/kak/backups
will grow indefinitely.
If you find this interesting, I may take the time to convert it to a proper kak plugin instead - but in its current form it’s easier to tweak should you have to.
Cheers!