Sunday, October 22, 2017

Re: batch swap file recovery

Not sure if this may be useful for some type of faq or something, but
this did take me a little bit to figure out:

for i in $(find -type f -not -path "./.git/*"); do f="${i/.\/}"; echo
$f; \vim --cmd 'set backupdir=/home/swilson/.vim/swpfiles/' --cmd 'set
dir=/home/swilson/.vim/swpfiles/' --cmd recover -c wq -N -u NONE "$f";
done

On Sun, Oct 15, 2017 at 3:21 PM, shawn wilson <ag4ve.us@gmail.com> wrote:
> On Sun, Oct 15, 2017 at 3:18 PM, Christian Brabandt <cblists@256bit.org> wrote:
>>
>> On So, 15 Okt 2017, shawn wilson wrote:
>>
>>> I lost some work in a git repo (it was deleted - I've recovered a
>>> point in time - but vim has newer data). So, is there a way to give
>>> vim a list of files and try to recover the newest version in the swap
>>> file and close? I know, it may give old data, but this should be
>>> pretty easy to pick out in git (based on additions/subtractions)?
>>>
>>> something like:
>>> find -type f -print0 | xargs -0 -i{} vim ..... {}
>>
>> Do you have those swapfiles still around?
>>
>
> Yes, every file probably doesn't have a swp/swo file, but everything I
> want does.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: