Skip to content
Discussion options

You must be logged in to vote

For the focusing issue you can add action = "show"

To only do it when neo-tree is open, the current way is basically to loop over open windows and check for vim.bo[bufnr].filetype = "neo-tree"

  local neo_tree_open = function()
    local wins = vim.api.nvim_tabpage_list_wins()
    for i, win in ipairs(wins) do
      local buf = vim.api.nvim_win_get_buf(win)
      if vim.bo[buf].filetype == "neo-tree" then
        return true
      end
    end
    return false
  end
  vim.api.nvim_create_autocmd("BufEnter", {
    callback = function()
      if not neo_tree_open() then
        return
      end
      local fp = vim.api.nvim_buf_get_name(0)
      local rootdir = vim.fs.root(fp, { "README.md", "…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pynappo
Comment options

Answer selected by qiine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants