update nvimtree config

This commit is contained in:
LordMZTE 2023-02-13 19:02:47 +01:00
parent 44d060c036
commit b0ec5593b4
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6

View file

@ -1,8 +1,6 @@
local map = vim.api.nvim_set_keymap
require("nvim-tree").setup {
open_on_setup = not vim.g.started_by_vinput,
open_on_setup_file = false,
actions = {
change_dir = {
global = true,
@ -23,4 +21,19 @@ require("nvim-tree").setup {
},
}
vim.api.nvim_create_autocmd({ "VimEnter" }, {
callback = function(data)
local is_no_name = data.file == "" and vim.bo[data.buf].buftype == ""
local is_dir = vim.fn.isdirectory(data.file) == 1
if is_dir then
vim.cmd.cd(data.file)
end
if is_no_name or is_dir then
require("nvim-tree.api").tree.open()
end
end,
})
map("n", "TT", [[<cmd>NvimTreeToggle<CR>]], { noremap = true, silent = true })