This commit is contained in:
Markus Dieckmann 2023-02-01 21:48:43 +01:00
parent 0546335cf2
commit c5e502f761
1 changed files with 93 additions and 80 deletions

View File

@ -1,66 +1,65 @@
require'nvim-tree'.setup { require 'nvim-tree'.setup {
renderer ={ renderer = {
icons = { icons = {
padding = ' ', padding = ' ',
symlink_arrow = ' >> ', symlink_arrow = ' >> ',
show = { show = {
git=true, git = true,
folder=true, folder = true,
file=true, file = true,
folder_arrow= false folder_arrow = false
}, },
glyphs = { glyphs = {
default= "", default = "",
symlink= "", symlink = "",
git= { git = {
unstaged= "", unstaged = "",
staged= "", staged = "",
unmerged= "", unmerged = "",
renamed= "", renamed = "",
untracked= "", untracked = "",
deleted= "", deleted = "",
ignored= "" ignored = ""
}, },
folder= { folder = {
arrow_open= "", arrow_open = "",
arrow_closed= "", arrow_closed = "",
default= "", default = "",
open= "", open = "",
empty= "", empty = "",
empty_open= "", empty_open = "",
symlink= "", symlink = "",
symlink_open= "", symlink_open = "",
} }
}, },
}, },
add_trailing = true, add_trailing = true,
highlight_opened_files = "all", highlight_opened_files = "all",
root_folder_modifier = ':~', root_folder_modifier = ':~',
special_files = { special_files = {
'README.md', 'README.md',
'Makefile', 'Makefile',
'MAKEFILE' 'MAKEFILE'
}, },
highlight_git = true, highlight_git = true,
indent_markers = { indent_markers = {
enable = true, enable = true,
icons = { icons = {
corner = "", corner = "",
edge = "", edge = "",
none = " ", none = " ",
} }
} }
}, },
respect_buf_cwd = true, respect_buf_cwd = true,
disable_netrw = true, disable_netrw = true,
hijack_netrw = true, hijack_netrw = true,
open_on_setup = false, ignore_ft_on_setup = {},
ignore_ft_on_setup = {}, open_on_tab = false,
open_on_tab = false, hijack_cursor = true,
hijack_cursor = true, auto_reload_on_write = true,
auto_reload_on_write = true, hijack_unnamed_buffer_when_opening = true,
update_cwd = false, diagnostics = {
diagnostics = {
enable = true, enable = true,
icons = { icons = {
hint = "", hint = "",
@ -69,36 +68,36 @@ require'nvim-tree'.setup {
error = "", error = "",
} }
}, },
update_focused_file = { update_focused_file = {
enable = true, enable = true,
update_cwd = true, update_cwd = true,
ignore_list = {} ignore_list = {}
}, },
system_open = { system_open = {
cmd = nil, cmd = nil,
args = {} args = {}
}, },
filters = { filters = {
dotfiles = false, dotfiles = false,
custom = {} custom = {}
}, },
git={ git = {
ignore = false, ignore = false,
enable= true, enable = true,
timeout=500, timeout = 500,
}, },
actions = { actions = {
open_file = { open_file = {
resize_window = false, resize_window = false,
window_picker = { window_picker = {
exclude = { exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" }, filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile","terminal","help" } buftype = { "nofile", "terminal", "help" }
} }
} }
} }
}, },
view = { view = {
width = 35, width = 35,
hide_root_folder = false, hide_root_folder = false,
side = 'left', side = 'left',
@ -108,3 +107,17 @@ require'nvim-tree'.setup {
} }
} }
} }
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 })