bccd8e4ab9
Misc * make more things configurable * use more generic variable names * handle some edgecases * cleanup * format files
85 lines
1.8 KiB
Lua
85 lines
1.8 KiB
Lua
local present, nvimtree = pcall(require, "nvim-tree")
|
|
if not present then
|
|
return
|
|
end
|
|
|
|
local g = vim.g
|
|
local default = {
|
|
conf = require("core.utils").load_config().plugins.options.nvimtree,
|
|
}
|
|
|
|
default = {
|
|
git_status = default.conf.enable_git,
|
|
ui = default.conf.ui,
|
|
}
|
|
|
|
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
|
|
g.nvim_tree_git_hl = default.git_status
|
|
g.nvim_tree_highlight_opened_files = 0
|
|
g.nvim_tree_indent_markers = 1
|
|
g.nvim_tree_quit_on_open = 0 -- closes tree when file's opened
|
|
g.nvim_tree_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" }
|
|
|
|
g.nvim_tree_window_picker_exclude = {
|
|
filetype = { "notify", "packer", "qf" },
|
|
buftype = { "terminal" },
|
|
}
|
|
|
|
g.nvim_tree_show_icons = {
|
|
folders = 1,
|
|
files = 1,
|
|
git = default.git_status,
|
|
}
|
|
|
|
g.nvim_tree_icons = {
|
|
default = "",
|
|
symlink = "",
|
|
git = {
|
|
deleted = "",
|
|
ignored = "◌",
|
|
renamed = "➜",
|
|
staged = "✓",
|
|
unmerged = "",
|
|
unstaged = "✗",
|
|
untracked = "★",
|
|
},
|
|
folder = {
|
|
default = "",
|
|
empty = "",
|
|
empty_open = "",
|
|
open = "",
|
|
symlink = "",
|
|
symlink_open = "",
|
|
},
|
|
}
|
|
|
|
default = {
|
|
filters = {
|
|
dotfiles = false,
|
|
},
|
|
disable_netrw = true,
|
|
hijack_netrw = true,
|
|
ignore_ft_on_setup = { "dashboard" },
|
|
auto_close = false,
|
|
open_on_tab = false,
|
|
hijack_cursor = true,
|
|
update_cwd = true,
|
|
update_focused_file = {
|
|
enable = true,
|
|
update_cwd = false,
|
|
},
|
|
view = default.ui,
|
|
git = {
|
|
ignore = false,
|
|
},
|
|
}
|
|
|
|
local M = {}
|
|
M.setup = function(override_flag)
|
|
if override_flag then
|
|
default = require("core.utils").tbl_override_req("nvim_tree", default)
|
|
end
|
|
nvimtree.setup(default)
|
|
end
|
|
|
|
return M
|