junegunn / fzf

:cherry_blossom: A command-line fuzzy finder
https://junegunn.github.io/fzf/
MIT License
64.3k stars 2.38k forks source link

Neovim: Opening a file via `:FZF` clears messages (e.g. warning W325 for existing swapfile is not shown) #3818

Open camoz opened 4 months ago

camoz commented 4 months ago

Checklist

Output of fzf --version

0.52.0 (bcda25a5)

OS

Shell

Problem / Steps to reproduce

Neovim 0.10 changed how to handle files for which there already exists a running neovim process. From https://neovim.io/doc/user/news-0.10.html:

By default, the swapfile "ATTENTION" E325 dialog is skipped if the swapfile is owned by a running Nvim process, instead of prompting. If you always want the swapfile dialog, delete the default SwapExists handler: autocmd! nvim_swapfile. default-autocmds

Neovim will show a warning instead. This can be easily tested by:

However, when opening the second file with :FZF, the warning is not shown.

I think there are two reasons why it might be really nice to fix this:

Is there a way to fix this?

junegunn commented 4 months ago

Neovim actually prints the warning message, but the message is cleared from the screen after the file is open. You can see it from :messages. Not sure how I can prevent it from being cleared.

junegunn commented 4 months ago
function! Foo()
  let opts = {}
  function! opts.on_exit(...)
    bd
    echom 'This message will be cleared'
    sleep 1
  endfunction

  tabnew
  call termopen('sleep 1', opts)
  startinsert
endfunction

call Foo()
function! Bar()
  let opts = {}
  function! opts.on_exit(...)
    bd
    echom 'This message will not be cleared'
    sleep 1
  endfunction

  tabnew
  call termopen('sleep 1', opts)
endfunction

call Bar()