78 lines
2.2 KiB
Lua
78 lines
2.2 KiB
Lua
-- local _, zk = pcall(require, "zk")
|
|
-- local _, commands = pcall(require, "zk.commands")
|
|
|
|
-- TODO: figure out what's wrong with these ....
|
|
-- local function dump(o)
|
|
-- if type(o) == 'table' then
|
|
-- local s = '{ '
|
|
-- for k, v in pairs(o) do
|
|
-- if type(k) ~= 'number' then k = '"' .. k .. '"' end
|
|
-- s = s .. '[' .. k .. '] = ' .. dump(v) .. ','
|
|
-- end
|
|
-- return s .. '} '
|
|
-- else
|
|
-- return tostring(o)
|
|
-- end
|
|
-- end
|
|
|
|
-- commands.add("ZkLinkTo", function(options)
|
|
-- zk.pick_notes(options, { title = "ZkLinkTo" }, function(notes)
|
|
-- local note = notes[1]
|
|
-- local title = ''
|
|
-- print(dump(note))
|
|
-- if note.title then
|
|
-- title = note.title
|
|
-- else
|
|
-- title = "Untitled"
|
|
-- end
|
|
-- local link = "[" .. title .. "](" .. note.absPath .. ")"
|
|
-- print(link)
|
|
-- -- notes = { notes }
|
|
-- for i, note in ipairs(notes) do
|
|
-- print(i)
|
|
-- print(note.title)
|
|
-- if note.title then
|
|
-- print("[" .. note.title .. "](" .. note.absPath .. ")")
|
|
-- link = "[" .. note.title .. "](" .. note.absPath .. ")"
|
|
-- else
|
|
-- print('no title brah')
|
|
-- link = 'other lin'
|
|
-- print(link)
|
|
-- end
|
|
-- print(link)
|
|
-- print(note.absPath)
|
|
-- -- -- vim.cmd("e " .. note.absPath)
|
|
-- end
|
|
-- end)
|
|
-- end)
|
|
|
|
-- commands.add("ZkListLin", function(options)
|
|
-- zk.pick_notes(options, { title = "ZkLinkTo" }, function(notes)
|
|
-- local note = notes[1]
|
|
-- local title = ''
|
|
-- print(dump(note))
|
|
-- if note.title then
|
|
-- title = note.title
|
|
-- else
|
|
-- title = "Untitled"
|
|
-- end
|
|
-- local link = "[" .. title .. "](" .. note.absPath .. ")"
|
|
-- print(link)
|
|
-- -- notes = { notes }
|
|
-- for i, note in ipairs(notes) do
|
|
-- print(i)
|
|
-- print(note.title)
|
|
-- if note.title then
|
|
-- print("[" .. note.title .. "](" .. note.absPath .. ")")
|
|
-- link = "[" .. note.title .. "](" .. note.absPath .. ")"
|
|
-- else
|
|
-- print('no title brah')
|
|
-- link = 'other lin'
|
|
-- print(link)
|
|
-- end
|
|
-- print(link)
|
|
-- print(note.absPath)
|
|
-- -- -- vim.cmd("e " .. note.absPath)
|
|
-- end
|
|
-- end)
|
|
-- end)
|