rhysd / neovim-component

<neovim-editor> WebComponent to embed Neovim to your app with great ease
https://github.com/rhysd/NyaoVim
MIT License
193 stars 18 forks source link

Better swap file handling with 'SwapExists' autocmd event #20

Open rhysd opened 8 years ago

rhysd commented 8 years ago

Currently NyaoVim simply ignores swap files because message on detecting swap file is shown before Neovim opens screen and NyaoVim can't catch it yet.

But SwapExists auto command event may be available for this.

  1. Add below command as an argument of nvim
  2. Notify to NyaoVim that swap file is detected
  3. NyaoVim show dialog and user select a choice ('o', 'e', 'r', 'd', 'q', or 'a')
  4. Set v:swapchoice properly
augroup nyaovim-swap
    autocmd SwapExists * call SendSwapNotification(v:swapname) | autocmd! nyaovim-swap
augroup END