nvim-tree / nvim-tree/nvim-tree.lua

Don't Close Window On fs.remove() When Last Buffer In Window

Open
#2,861 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
Lua
Stars
8.6k
Forks
639
Avg merge
1d 14h
Merged PRs (30d)
2

Description

Problem
When there's just 1 window opened along with nvimtree, then deleting its file from tree, would make nvimtree become fullscreen

Desired behavior
Nvimtree should open unamed buf ( enew ) and then delete, this will maintain the win layout!

 actions = {
    remove_file = {
      open_unamed_buf = true,
    },
  },

Possible solutions with edgecases

The code must be run only when the user presses "y"

Case 1

If there's just 1 listed buffer and its the active window

  • Add empty buffer i.e enew
  • delete

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the one-window case in nvim-tree and trace the fs.remove action reached when the user presses "y". Check the behavior when the last listed buffer is active, then verify that the window layout is preserved and the file is still deleted after handling the unnamed buffer case.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, neovim
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.