Skip to content

Opening nvim-tree in a split breaks vinegar-style #2227

Closed
@sstallion

Description

@sstallion

Description

I've been scratching my head over this one this evening. I've been experimenting with using nvim-tree in vinegar mode and for the most part everything works as expected, however attempting to open nvim-tree from within a split breaks terribly. This can most easily be seen by editing a directory (eg. :e .) from within a split. The result is the split is closed, and the nvim-tree window is opened in a vertical split rather than replacing the buffer as expected.

Screen Shot 2023-05-23 at 7 52 33 PM Screen Shot 2023-05-23 at 7 52 12 PM

Neovim version

NVIM v0.9.0
Build type: Release
LuaJIT 2.1.0-beta3

Operating system and version

macOS 12.5

nvim-tree version

b1e074d

Minimal config

call plug#begin()
Plug 'nvim-tree/nvim-tree.lua'
Plug 'nvim-tree/nvim-web-devicons'
call plug#end()

lua <<END
local api = require('nvim-tree.api')

require("nvim-tree").setup {
  disable_netrw = true,
  on_attach = function(bufnr)
    local function opts(desc)
      return {desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true}
    end
    vim.keymap.set('n', '<CR>', api.node.open.replace_tree_buffer, opts('Open: In Place'))
  end
}
END


### Steps to reproduce

1. `nvim`
2. `:split`
3. `:e .`

### Expected behavior

The nvim-tree window replaces the split buffer.

### Actual behavior

The nvim-tree window closes the split buffer and opens a vertical split for the tree.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions