diff options
Diffstat (limited to 'lua/denote/cmd.lua')
| -rw-r--r-- | lua/denote/cmd.lua | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lua/denote/cmd.lua b/lua/denote/cmd.lua index aa93637..9b8d9e6 100644 --- a/lua/denote/cmd.lua +++ b/lua/denote/cmd.lua @@ -1,17 +1,25 @@ -local M = {} +local M = { + commands = { "note", "search" }, +} local api = require("denote.api") function M.load_cmd() vim.api.nvim_create_user_command("Denote", function(opts) - if opts.fargs[1] == "note" then - api.note() - elseif opts.fargs[1] == "search" then - api.search() + if opts.fargs[1] then + if opts.fargs[1] == "note" then + api.note() + elseif opts.fargs[1] == "search" then + api.search() + else + error("Unsupported operation " .. opts.fargs[1]) + end else - error("Unsupported operation " .. opts.fargs[1]) + vim.ui.select(M.commands, { prompt = "Command: " }, function(choice) + api[choice]() + end) end end, { - nargs = 1, + -- nargs = 1, complete = function() return { "note", "search" } end, |
