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

@@ -109,7 +109,7 @@ M.nvdash = {
{ txt = " 󰈚 Recent Files", keys = "Spc f o", cmd = "Telescope oldfiles" },
{ txt = " 󰈭 Find Word", keys = "Spc f w", cmd = "Telescope live_grep" },
{ txt = "  Bookmarks", keys = "Spc m a", cmd = "Telescope marks" },
{ txt = "", hl = "NvDashLazy", no_gap = true, rep = true },
{ txt = "", hl = "NvDashFooter", no_gap = true, rep = true },
{
txt = function()
@@ -117,11 +117,11 @@ M.nvdash = {
local ms = math.floor(stats.startuptime) .. " ms"
return " Loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms
end,
hl = "NvDashLazy",
hl = "NvDashFooter",
no_gap = true,
},
{ txt = "", hl = "NvDashLazy", no_gap = true, rep = true },
{ txt = "", hl = "NvDashFooter", no_gap = true, rep = true },
},
}

View File

@@ -15,6 +15,7 @@ return {
"jdtls",
"clangd",
"json-lsp",
"pyright",
"ruff",

View File

@@ -16,7 +16,8 @@ local servers = {
"pyright",
"ruff",
"dockerls",
"ansiblels"
"ansiblels",
"jsonls"
}
for _, lsp in ipairs(servers) do

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,
}
}