forked from mrjones2014/legendary.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnvim_tree.lua
33 lines (32 loc) · 889 Bytes
/
nvim_tree.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
local function init()
local keymaps = require('nvim-tree.api').config.mappings.get_keymap()
local commands = require('nvim-tree.api').commands.get()
local legendary_keymaps = vim.tbl_map(function(keymap)
return {
keymap.lhs,
description = keymap.desc,
mode = keymap.mode,
filters = { filetype = 'NvimTree' },
}
end, keymaps)
local legendary_commands = vim.tbl_map(function(cmd)
return {
cmd.name,
description = cmd.opts.desc,
}
end, commands)
require('legendary').keymaps(legendary_keymaps)
require('legendary').commands(legendary_commands)
end
return function()
-- check if nvim-tree has already been loaded
if vim.g.NvimTreeRequired and vim.g.NvimTreeSetup then
init()
else
vim.api.nvim_create_autocmd('User', {
pattern = 'NvimTreeSetup',
callback = init,
once = true,
})
end
end