fix: do not display empty string or nil callbacks in help view
This commit is contained in:
@@ -354,7 +354,9 @@ local M = {}
|
|||||||
function M.draw_help()
|
function M.draw_help()
|
||||||
local help_lines = {'HELP'}
|
local help_lines = {'HELP'}
|
||||||
local help_hl = {{'NvimTreeRootFolder', 0, 0, #help_lines[1]}}
|
local help_hl = {{'NvimTreeRootFolder', 0, 0, #help_lines[1]}}
|
||||||
local mappings = view.View.mappings
|
local mappings = vim.tbl_filter(function(v)
|
||||||
|
return v.cb ~= nil and v.cb ~= ""
|
||||||
|
end, view.View.mappings)
|
||||||
local processed = {}
|
local processed = {}
|
||||||
for _, b in pairs(mappings) do
|
for _, b in pairs(mappings) do
|
||||||
local cb = b.cb
|
local cb = b.cb
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ local function create_buffer()
|
|||||||
for _, key in pairs(b.key) do
|
for _, key in pairs(b.key) do
|
||||||
a.nvim_buf_set_keymap(M.View.bufnr, b.mode or 'n', key, b.cb, { noremap = true, silent = true, nowait = true })
|
a.nvim_buf_set_keymap(M.View.bufnr, b.mode or 'n', key, b.cb, { noremap = true, silent = true, nowait = true })
|
||||||
end
|
end
|
||||||
else
|
elseif b.cb then
|
||||||
a.nvim_buf_set_keymap(M.View.bufnr, b.mode or 'n', b.key, b.cb, { noremap = true, silent = true, nowait = true })
|
a.nvim_buf_set_keymap(M.View.bufnr, b.mode or 'n', b.key, b.cb, { noremap = true, silent = true, nowait = true })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user