You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
874 B
Lua

require('nvim-tree').setup({
open_on_tab = false,
filters = {
dotfiles = true,
},
actions = {
open_file = {
quit_on_open = true,
},
},
})
showHiddenFiles = false
local function open_nvim_tree(data)
-- buffer is a directory
local directory = vim.fn.isdirectory(data.file) == 1
local empty_file = data.file == ""
if not directory and not empty_file then
return
end
if directory then
vim.cmd.cd(data.file)
end
vim.cmd.enew()
vim.cmd.bw(data.buf)
-- change to directory and open
require("nvim-tree.api").tree.open()
end
-- toggle dotfiles visibility
vim.keymap.set("n", "<leader>d", ":lua require('nvim-tree.api').tree.toggle_hidden_filter()<CR>")
-- nvim-tree open at startup
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree, })