vim: use setup options for nvim-tree.lua instead of global variables

The helper function used to set global variables is also no longer
needed now that nvim-tree.lua has migrated all of its configuration from
global variables to setup options.
This commit is contained in:
Fernando Schauenburg 2022-07-04 15:06:41 +00:00
parent 10466e0391
commit 8420604bf4

View file

@ -1,26 +1,6 @@
local nmap = require'fs.util'.nmap
-- helper to set vim.g options that will be moved to setup() later
local function set_globals(tbl)
local g = vim.g
for k, v in pairs(tbl) do
g['nvim_tree_' .. k] = v
end
end
local config = function()
set_globals {
add_trailing = 1, -- add trailing / to folders
group_empty = 1, -- folders that contain only one folder are grouped
indent_markers = 1, -- show indent markers
git_hl = 1, -- enable highlight based on git attributes
icons = {
default = '', -- default icon for files
symlink = '', -- default icon for symlinks
},
}
require'nvim-tree'.setup {
git = {
ignore = false, -- don't hide files from .gitignore
@ -34,6 +14,15 @@ local config = function()
dotfiles = false, -- show files starting with a .
custom = { '.git' }, -- don't show .git directory
},
renderer = {
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
},
},
}
nmap { '<c-n>', '<cmd>NvimTreeToggle<cr>' }