From 16fc6862a89eef0f02d32ab8b365887522719da8 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Mon, 11 Nov 2019 16:47:05 +0100 Subject: [PATCH] [nvim] Handle SIGHUP in exit handler (#1749) In recent Nvim versions, an "Error running ..." message is shown even for normal use cases, such as: :Files :close Closing the window will :bwipeout! the terminal buffer, because fzf sets bufhiden=wipe. When deleting the terminal buffer while fzf is still running, Nvim sends SIGHUP. This happens for quite some time already, but the bug only manifests since this commit: https://github.com/neovim/neovim/commit/939d9053b It's The Right Thing to do when the application exited due to a signal. Before that commit, no "Error running ..." message was shown, because 1 (instead of 128 + 1 == SIGHUP) was returned which the exit handler in fzf.vim treats as "NO MATCH". --- plugin/fzf.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 195bb8b2..7781ae5f 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -527,6 +527,10 @@ endif function! s:exit_handler(code, command, ...) if a:code == 130 return 0 + elseif has('nvim') && a:code == 129 + " When deleting the terminal buffer while fzf is still running, + " Nvim sends SIGHUP. + return 0 elseif a:code > 1 call s:error('Error running ' . a:command) if !empty(a:000)