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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
local M = {}
local internal = require("simple-denote.internal")
function M.splitspace(str)
local chunks = {}
for substring in str:gmatch("%S+") do
table.insert(chunks, #chunks, substring)
end
return chunks
end
---@param options table
---@param name string|nil
---@param tags table|nil
function M.note(options, name, tags)
if not name then
vim.ui.input({ prompt = "Note title: " }, function(input)
name = input
end)
end
if not tags then
vim.ui.input({ prompt = "Tags: " }, function(input)
tags = input
end)
end
internal.note(options, name, tags)
end
---@param options table
---@param filename string|nil
---@param new_title string|nil
function M.retitle(options, filename, title)
if not filename then
filename = vim.fn.expand("%")
end
if not title then
vim.ui.input({ prompt = "New title: " }, function(input)
title = input
end)
end
internal.retitle(options, filename, title)
end
---@param options table
---@param filename string|nil
---@param new_tags table|nil
function M.retag(options, filename, tags)
if not filename then
filename = vim.fn.expand("%")
end
if not tags then
vim.ui.input({ prompt = "New tags: " }, function(input)
tags = input
end)
end
internal.retag(options, filename, tags)
end
return M
|