diff options
| author | HumanEntity <human_entity@icloud.com> | 2023-12-25 12:54:37 +0100 |
|---|---|---|
| committer | HumanEntity <human_entity@icloud.com> | 2023-12-25 12:54:37 +0100 |
| commit | 4997cc9704883b7833372386b71ddc8bbb177a56 (patch) | |
| tree | d746e294b74a0a2dbd8a4cfec6e66369b0c6810f /lua/denote/cmd.lua | |
| parent | 9fb27f9c4f8258662b5642d0768c60f4b870bca2 (diff) | |
| download | simple-denote.nvim-4997cc9704883b7833372386b71ddc8bbb177a56.tar.gz | |
Little restructurization and cmd update
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, |
