Add json LSP / nvimtree open and close when appropiriate

This commit is contained in:
2024-11-14 10:23:54 +01:00
parent ca321fd6a6
commit 7947e0a0d2
5 changed files with 53 additions and 27 deletions

View File

@@ -1,3 +1,24 @@
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 })
vim.api.nvim_create_autocmd({ "QuitPre" }, {
callback = function() vim.cmd("NvimTreeClose") end,
})
return {
renderer = {
icons = {
@@ -6,4 +27,7 @@ return {
},
},
},
filters = {
git_ignored = false,
}
}