Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Buffer delete command closes Neovim when neo-tree is open #1580

Open
3 tasks done
JohnWilliston opened this issue Oct 12, 2024 · 0 comments
Open
3 tasks done

BUG: Buffer delete command closes Neovim when neo-tree is open #1580

JohnWilliston opened this issue Oct 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@JohnWilliston
Copy link

Did you check docs and existing issues?

  • I have read all the docs.
  • I have searched the existing issues.
  • I have searched the existing discussions.

Neovim Version (nvim -v)

NVIM v0.10.1 Build type: Release LuaJIT 2.1.1713484068 Run "nvim -V1 -v" for more info

Operating System / Version

Windows 11 Pro x64

Describe the Bug

I tend to toggle neo-tree open with a keyboard shortcut (F3 from my old CUA days is a hard habit to break). Here's the procedure I follow to evince what seems to me like a bug:

  1. Open nvim with a single file specified on the command line.
  2. Hit F3 to toggle neo-tree (it appears in a new left pane). Open a second file using neo-tree.
  3. Issue the :bd command.

With two files open like that, I would think deleting the buffer that's open in the right pane would leave neo-tree open on the left and the original file from the command line open on the right. What actually happens with close_if_last_window set to true is that Neovim exits completely. And I believe it's neo-tree doing that for two reasons: (1) changing close_if_last_window to false stops it from happening, as does (2) if I toggle the neo-tree pane closed before the :bd command. Serious question: am I wrong in that initial expectation? Seems like this might be a bug.

Screenshots, Traceback

No response

Steps to Reproduce

  1. Open nvim with a single file specified on the command line.
  2. Hit F3 to toggle neo-tree (it appears in a new left pane). Open a second file using neo-tree.
  3. Issue the :bd command.

Expected Behavior

I expected my :bd command to delete the buffer I'm seeing, leaving neo-tree open in the left pane but now showing the second file open in the right pane.
nvim-config-folder-2024-10-11_2012.zip

Your Configuration

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  -- add any other plugins here
}

local neotree_config = {
  "nvim-neo-tree/neo-tree.nvim",
  dependencies = { "MunifTanjim/nui.nvim", "nvim-tree/nvim-web-devicons", "nvim-lua/plenary.nvim" },
  cmd = { "Neotree" },
  keys = {
    { "<Leader>e", "<Cmd>Neotree<CR>" }, -- change or remove this line if relevant.
  },
  opts = {
    -- Your config here
    -- ...
  },
}

table.insert(plugins, neotree_config)
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

-- Sorry, gang, I don't know how to produce a "minimal init.lua to reproduce this issue". I'm attaching an archive of my entire %LOCALAPPDATA%\nvim folder instead.
@JohnWilliston JohnWilliston added the bug Something isn't working label Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant