Skip to content

BUG: New close_if_last_window implementation breaks smart-splits.nvim variable unsetting #1836

@mwojick

Description

@mwojick

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)

v0.11.2

Operating System / Version

WSL

Describe the Bug

A combination of these two commits breaks the unsetting of the IS_NVIM var in smart-splits when neo-tree is auto-closed:
https://github.com/nvim-neo-tree/neo-tree.nvim/pull/1830/files
https://github.com/nvim-neo-tree/neo-tree.nvim/pull/1831/files

These are the two autocmds that are setup by smart-splits that should trigger before exiting nvim:
https://github.com/mrjones2014/smart-splits.nvim/blob/67cbc412b83014ea5f92d617471d459714b5e6c7/lua/smart-splits/mux/utils.lua#L72

Seems like they are being bypassed by this new implementation. For now I am staying on commit "e858a443813097cba43524a6321e3976b14ec75d" until it's fixed.

Screenshots, Traceback

No response

Steps to Reproduce

  1. set close_if_last_window = true
  2. have smart-splits installed or just test the two autocmds ('VimSuspend', 'VimLeavePre'), e.g.:
vim.api.nvim_create_autocmd({ "VimSuspend", "VimLeavePre" }, {
	callback = function()
		vim.notify("Exiting Neovim...", vim.log.levels.INFO)
	end,
})
  1. try closing the last non-neo-tree window

Expected Behavior

setting close_if_last_window = true shouldn't bypass autocmds on close

Your Configuration

-- template from https://lazy.folke.io/developers#reprolua, feel free to replace if you have your own minimal init.lua
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    {
      "nvim-neo-tree/neo-tree.nvim",
      branch = "v3.x", -- or "main"
      dependencies = {
        "nvim-lua/plenary.nvim",
        "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
        "MunifTanjim/nui.nvim",
        -- { "3rd/image.nvim", opts = {} }, -- Optional image support
      },
      lazy = false,
      ---@module "neo-tree"
      ---@type neotree.Config?
      opts = {
        close_if_last_window = true
      },
    }
  },
})
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>e", "<Cmd>Neotree<CR>")
-- do anything else you need to do to reproduce the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions