Skip to content

NvimTreeFindFile no longer keeps focus in tree buffer #2078

@drewbailey

Description

@drewbailey

Description

Introduced in #2039

:NvimTreeFindFile no longer keeps focus in the NvimTree view.

Neovim version

NVIM v0.9.0-dev-2079+g964ae205a-dirty
Build type: Release
LuaJIT 2.1.0-beta3

Operating system and version

macos

nvim-tree version

f0a1c6a

Minimal config

require('nvim-tree').setup()

local function open_nvim_tree(data)

  -- buffer is a directory
  local directory = vim.fn.isdirectory(data.file) == 1

  if not directory then
    return
  end

  -- change to the directory
  vim.cmd.cd(data.file)

  -- open the tree
  require("nvim-tree.api").tree.open()
end

vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })

Steps to reproduce

:NvimTreeFindFile

Expected behavior

focus / cursor highlights file in nvim tree

Actual behavior

Nvim tree directory opened to file, focus goes back to buffer

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