3

I want to have swap files for manual inspection if needed, i.e. I don't want ViM to ask me every time I have a swap file if I want to recover / edit, etc. but I do want to have the option to manually pop up this prompt when I want to (e.g. when I had a shutdown before saving)

Is it possible? Didn't find what I was looking when I read :help backup, :help swap

3
  • 2
    Does this answer your question? vim: (E)dit anyway without prompting
    – Biggybi
    Apr 28, 2022 at 10:35
  • Almost, thanks! The only issue is that even after hitting "e" it sometimes bugs out. I don't want it to even start the prompt Apr 28, 2022 at 12:28
  • 1
    If I add the autocmd from the answer Biggybi linked then I don't get any prompt nor do I need to press any key; I'm not sure what you mean with "after hitting e" or what prompt you still see @CIsForCookies? I'm using Vim 8.2.4827 by the way (which is very new), so maybe it has to do with your version? Apr 28, 2022 at 12:34

1 Answer 1

0

I think that I have already implemented this functionality.

set shortmess+=A

au SwapExists * nested call OnSwap() 
function! OnSwap()
    let swap_info = swapinfo(v:swapname)
    echo "Recovery exist " . strftime("%Y %b %d %X",swap_info['mtime']) 
    let v:swapcommand='e'
endfunction 

The first command doesn't display the message.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.