blob: 9b8d9e61370eb565e06fd3083d2bc0638260255c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
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] 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
vim.ui.select(M.commands, { prompt = "Command: " }, function(choice)
api[choice]()
end)
end
end, {
-- nargs = 1,
complete = function()
return { "note", "search" }
end,
})
end
return M
|