Last active
March 13, 2023 03:43
-
-
Save alex-courtis/984e5b97cc2148778f5353305b911308 to your computer and use it in GitHub Desktop.
nvim-tree: reactively retrieve mappings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local api = require "nvim-tree.api" | |
local Event = api.events.Event | |
api.events.subscribe(Event.TreeAttachedPost, function(bufnr) | |
print(string.format("TreeAttachedPost bufnr=%s", vim.inspect(bufnr))) | |
local buf_keymaps = vim.api.nvim_buf_get_keymap(bufnr, "") | |
for i = 1, 4, 1 do | |
print(vim.inspect(buf_keymaps[i])) | |
end | |
end) | |
-- output | |
TreeAttachedPost bufnr=2 | |
{ | |
buffer = 2, | |
callback = <function 1>, | |
desc = "nvim-tree: Open Preview", | |
expr = 0, | |
lhs = "<Tab>", | |
lhsraw = "\t", | |
lnum = 0, | |
mode = "n", | |
noremap = 1, | |
nowait = 1, | |
script = 0, | |
sid = -8, | |
silent = 1 | |
} | |
{ | |
buffer = 2, | |
callback = <function 1>, | |
desc = "nvim-tree: Open", | |
expr = 0, | |
lhs = "<CR>", | |
lhsraw = "\r", | |
lnum = 0, | |
mode = "n", | |
noremap = 1, | |
nowait = 1, | |
script = 0, | |
sid = -8, | |
silent = 1 | |
} | |
{ | |
buffer = 2, | |
callback = <function 1>, | |
desc = "nvim-tree: Up", | |
expr = 0, | |
lhs = "-", | |
lhsraw = "-", | |
lnum = 0, | |
mode = "n", | |
noremap = 1, | |
nowait = 1, | |
script = 0, | |
sid = -8, | |
silent = 1 | |
} | |
{ | |
buffer = 2, | |
callback = <function 1>, | |
desc = "nvim-tree: Run Command", | |
expr = 0, | |
lhs = ".", | |
lhsraw = ".", | |
lnum = 0, | |
mode = "n", | |
noremap = 1, | |
nowait = 1, | |
script = 0, | |
sid = -8, | |
silent = 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment