1 [No Name] (5) ~/code/github/cmd-palette.nvim/lua/cmd-palette/init.lua ↲ local·callback·=·function(node)↲ ··if·not·node·then↲ ····return↲ ··end↲ ↲ ··if·node["cmd"]·then↲ ····vim.cmd(node["cmd"])↲ ··elseif·node["callback"]·then↲ ····node["callback"]()↲ ··else↲ ····print·"No·cmd·nor·callback·found"↲ ··end↲ end↲ ↲ function·M.setup(commands)↲ ··M.commands·=·vim.tbl_deep_extend("force",·{},·{},·commands·or·{})↲ end↲ ↲ function·M.show()↲ ··if·vim.ui.select·then↲ ····vim.ui.select(M.commands,·{↲ ······kind·=·nil,↲ ······format_item·=·format,↲ ······prompt·=·"Command·Palette",↲ ····},·callback)↲ ··else↲ ╭────────────────────────────── Command Palette ───────────────────────────────╮ ····print·"Could't·find·vim.ui.select"↲ │> 3 / 3│ ··end↲ ├──────────────────────────────────────────────────────────────────────────────┤ end↲ │> nonumber │ ↲ │ number │ │ M.setup({↲ │ Greeting │ │ ··{·label·=·"nonumber",·cmd·=·"set·nonumber"·},↲ │ │ │ ··{·label·=·"number",·cmd·=·"set·number"·},↲ │ │ │ ··{·label·=·"Greeting",·callback·=·function()·print("Hello,·World!")·en│ │ │ })↲ │ │ │ ↲ │ │ return·M↲ │ │ ~ │ │ ~ │ │ ~ ╰──────────────────────────────────────────────────────────────────────────────╯ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ [Insert] main [No Name][+] lsps: [TelescopePrompt] :CmdPalette