From bb73779107c589776740d5f2fed0740b3b25e5f8 Mon Sep 17 00:00:00 2001 From: bhagwan Date: Fri, 29 Jul 2022 23:29:27 -0400 Subject: [PATCH] fix(buffers): error "Process exited 0" on buf delete --- lua/fzf-lua/actions.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lua/fzf-lua/actions.lua b/lua/fzf-lua/actions.lua index 87ae54c..f24c474 100644 --- a/lua/fzf-lua/actions.lua +++ b/lua/fzf-lua/actions.lua @@ -238,12 +238,14 @@ M.vimcmd_buf = function(vimcmd, selected, opts) utils.warn(("':%s' failed: %s"):format(cmd, res)) end end - if curbuf ~= entry.bufnr or lnum ~= entry.line then - -- make sure we have valid column - entry.col = entry.col and entry.col>0 and entry.col or 1 - vim.api.nvim_win_set_cursor(0, {tonumber(entry.line), tonumber(entry.col)-1}) + if vimcmd ~= "bd" then + if curbuf ~= entry.bufnr or lnum ~= entry.line then + -- make sure we have valid column + entry.col = entry.col and entry.col>0 and entry.col or 1 + vim.api.nvim_win_set_cursor(0, {tonumber(entry.line), tonumber(entry.col)-1}) + end + if not is_term and not opts.no_action_zz then vim.cmd("norm! zvzz") end end - if not is_term and not opts.no_action_zz then vim.cmd("norm! zvzz") end end end