dotfiles/nvim/lua/nvimtree.lua

124 lines
2.8 KiB
Lua

require 'nvim-tree'.setup {
renderer = {
icons = {
padding = ' ',
symlink_arrow = ' >> ',
show = {
git = true,
folder = true,
file = true,
folder_arrow = false
},
glyphs = {
default = "",
symlink = "",
git = {
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = ""
},
folder = {
arrow_open = "",
arrow_closed = "",
default = "",
open = "",
empty = "",
empty_open = "",
symlink = "",
symlink_open = "",
}
},
},
add_trailing = true,
highlight_opened_files = "all",
root_folder_modifier = ':~',
special_files = {
'README.md',
'Makefile',
'MAKEFILE'
},
highlight_git = true,
indent_markers = {
enable = true,
icons = {
corner = "",
edge = "",
none = " ",
}
}
},
respect_buf_cwd = true,
disable_netrw = true,
hijack_netrw = true,
open_on_tab = false,
hijack_cursor = true,
auto_reload_on_write = true,
hijack_unnamed_buffer_when_opening = true,
sync_root_with_cwd = true,
diagnostics = {
enable = true,
icons = {
hint = "",
info = "",
warning = "",
error = "",
}
},
update_focused_file = {
enable = true,
update_cwd = true,
ignore_list = {}
},
system_open = {
cmd = nil,
args = {}
},
filters = {
dotfiles = false,
custom = {}
},
git = {
ignore = false,
enable = true,
timeout = 500,
},
actions = {
open_file = {
resize_window = true,
window_picker = {
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" }
}
}
}
},
view = {
width = 35,
hide_root_folder = false,
side = 'left',
mappings = {
custom_only = false,
list = {}
}
}
}
local function open_nvim_tree(data)
local directory = vim.fn.isdirectory(data.file) == 1
if not directory then
return
end
vim.cmd.enew()
vim.cmd.bw(data.buf)
vim.cmd.cd(data.file)
require('nvim-tree.api').tree.open()
end
vim.api.nvim_create_autocmd({ 'VimEnter' }, { callback = open_nvim_tree })