fix(#1639): ensure tree autocommands match filetype as well as name (#1640)

* fix(#1629): nvim start with file named *NvimTree* opens tree instead of buffer

* Revert "fix(#1629): nvim start with file named *NvimTree* opens tree instead of buffer"

This reverts commit e7136078f7.

* fix(#1629): nvim start with file named *NvimTree* treats file as tree

* fix(#1629): nvim start with file named *NvimTree* treats file as tree

* fix(#1639): ensure tree autocommands match filetype as well as name

* fix(#1639): fix bad merge

* fix(#1639): ensure tree autocommands match filetype as well as name
This commit is contained in:
Alexander Courtis
2022-10-17 12:31:41 +11:00
committed by GitHub
parent c995ce0878
commit 48992fd3e8
4 changed files with 51 additions and 10 deletions

View File

@@ -1,6 +1,7 @@
local a = vim.api
local view = require "nvim-tree.view"
local utils = require "nvim-tree.utils"
local Iterator = require "nvim-tree.iterators.node-iterator"
local M = {
@@ -30,7 +31,11 @@ local function remove_overlay()
a.nvim_create_autocmd("WinLeave", {
pattern = "NvimTree_*",
group = a.nvim_create_augroup("NvimTree", { clear = false }),
callback = view.close,
callback = function()
if utils.is_nvim_tree_buf(0) then
view.close()
end
end,
})
end