vim: improve nvim-tree behavior and add mappings

This commit is contained in:
Fernando Schauenburg 2022-10-14 09:47:19 +02:00
parent ef0a5effab
commit 77b7b4f3b7

View file

@ -1,13 +1,30 @@
local ok, plugin = pcall(require, 'nvim-tree')
local nt, callback
local ok, _ = pcall(function()
nt = require 'nvim-tree'
callback = require 'nvim-tree.config'.nvim_tree_callback
end)
if not ok then return end
plugin.setup {
nt.setup {
disable_netrw = true, -- replace netrw with nvim-tree
hijack_cursor = true, -- keep the cursor on begin of the filename
sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree
git = {
ignore = false, -- don't hide files from .gitignore
},
view = {
adaptive_size = true, -- resize the window based on the longest line
width = 35, -- a little wider than the default 30
mappings = {
list = {
{ key = { 'l', '<CR>', 'o' }, cb = callback 'edit' },
{ key = 'h', cb = callback 'close_node' },
},
},
},
filters = {
@ -19,9 +36,6 @@ plugin.setup {
add_trailing = true, -- add trailing / to folders
group_empty = true, -- folders that contain only one folder are grouped
highlight_git = true, -- enable highlight based on git attributes
indent_markers = {
enable = true, -- show indent markers
},
},
}