:DiffviewClose
Error executing Lua callback: vim/_editor.lua:0: nvim_exec2(): Vim(tabclose):E784: Cannot close last tab page
stack traceback:
[C]: in function 'nvim_exec2'
vim/_editor.lua: in function 'cmd'
...nvim/lua/diffview/scene/views/standard/standard_view.lua:54: in function 'close'
...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:186: in function 'close'
...ocal/share/nvim/lazy/diffview.nvim/lua/diffview/init.lua:155: in function 'close'
....local/share/nvim/lazy/diffview.nvim/plugin/diffview.lua:38: in function <....local/share/nvim/lazy/diffview.nvim/plugin/diffview.lua:37>
Note that the error still occurs even if multiple tabs are open. Also note that the error does not occur if DiffviewClose is executed without having first executed gf
Expected behavior
DiffviewClose should behave the same way after running gf and closing the local file as it does without doing so.
Actual behavior
DiffviewClose throws an E784 when run after executing gf and closing the local file. See attached recording:
Output of :checkhealth diffview
```
diffview: require("diffview.health").check()
Checking plugin dependencies ~
- OK nvim-web-devicons installed.
Checking VCS tools ~
- The plugin requires at least one of the supported VCS tools to be valid.
- OK Git found.
- OK Git is up-to-date. (2.43.0)
- WARNING Configured `hg_cmd` is not executable: 'hg'
```
Log info
Relevant info from :DiffviewLog
```
Error executing Lua callback: vim/_editor.lua:0: nvim_exec2(): Vim(tabclose):E784: Cannot close last tab page
stack traceback:
[C]: in function 'nvim_exec2'
vim/_editor.lua: in function 'cmd'
...nvim/lua/diffview/scene/views/standard/standard_view.lua:54: in function 'close'
...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:186: in function 'close'
...ocal/share/nvim/lazy/diffview.nvim/lua/diffview/init.lua:155: in function 'close'
....local/share/nvim/lazy/diffview.nvim/plugin/diffview.lua:38: in function <....local/share/nvim/lazy/diffview.nvim/plugin/diffview.lua:37>
```
-- #######################################
-- ### USAGE: nvim --clean -u mini.lua ###
-- #######################################
local root = vim.fn.stdpath("run") .. "/nvim/diffview.nvim"
local plugin_dir = root .. "/plugins"
vim.fn.mkdir(plugin_dir, "p")
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
local plugins = {
{ "nvim-web-devicons", url = "https://github.com/nvim-tree/nvim-web-devicons.git" },
{ "diffview.nvim", url = "https://github.com/sindrets/diffview.nvim.git" },
-- ##################################################################
-- ### ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE ###
-- ##################################################################
}
for _, spec in ipairs(plugins) do
local install_path = plugin_dir .. "/" .. spec[1]
if vim.fn.isdirectory(install_path) ~= 1 then
if spec.url then
print(string.format("Installing '%s'...", spec[1]))
vim.fn.system({ "git", "clone", "--depth=1", spec.url, install_path })
end
end
vim.opt.runtimepath:append(spec.path or install_path)
end
require("diffview").setup({
-- ##############################################################################
-- ### ADD DIFFVIEW.NVIM CONFIG THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE ###
-- ##############################################################################
})
vim.opt.termguicolors = true
vim.cmd("colorscheme " .. (vim.fn.has("nvim-0.8") == 1 and "habamax" or "slate"))
-- ############################################################################
-- ### ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE ###
-- ############################################################################
print("Ready!")
Description
DiffviewOpen
gf
(Open the local version of the file)DiffviewClose
E784
error thrownNote that the error still occurs even if multiple tabs are open. Also note that the error does not occur if
DiffviewClose
is executed without having first executedgf
Expected behavior
DiffviewClose
should behave the same way after runninggf
and closing the local file as it does without doing so.Actual behavior
DiffviewClose
throws anE784
when run after executinggf
and closing the local file. See attached recording:https://github.com/sindrets/diffview.nvim/assets/28514482/571daccd-0b0d-4dd7-a87e-9991ac37b7eb
The below recording shows the close behaviour without having first executed
gf
:https://github.com/sindrets/diffview.nvim/assets/28514482/1ba5bb1e-72f6-4c7b-a8ef-aafc14fec6bc
Steps to reproduce
DiffviewOpen
gf
(Open the local version of the file)DiffviewClose
E784
error thrownHealth check
Output of
``` diffview: require("diffview.health").check() Checking plugin dependencies ~ - OK nvim-web-devicons installed. Checking VCS tools ~ - The plugin requires at least one of the supported VCS tools to be valid. - OK Git found. - OK Git is up-to-date. (2.43.0) - WARNING Configured `hg_cmd` is not executable: 'hg' ```:checkhealth diffview
Log info
Relevant info from
``` Error executing Lua callback: vim/_editor.lua:0: nvim_exec2(): Vim(tabclose):E784: Cannot close last tab page stack traceback: [C]: in function 'nvim_exec2' vim/_editor.lua: in function 'cmd' ...nvim/lua/diffview/scene/views/standard/standard_view.lua:54: in function 'close' ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:186: in function 'close' ...ocal/share/nvim/lazy/diffview.nvim/lua/diffview/init.lua:155: in function 'close' ....local/share/nvim/lazy/diffview.nvim/plugin/diffview.lua:38: in function <....local/share/nvim/lazy/diffview.nvim/plugin/diffview.lua:37> ```:DiffviewLog
Neovim version
Operating system and version
macOS 14.4.1 (23E224)
Minimal config