33 lines
858 B
Lua
33 lines
858 B
Lua
return {
|
|
{
|
|
"mickael-menu/zk-nvim",
|
|
event = "VeryLazy",
|
|
opts = {
|
|
picker = "telescope",
|
|
},
|
|
config = function(_, opts)
|
|
require("zk").setup(opts)
|
|
|
|
local function yankName(options, picker_options)
|
|
require("zk").pick_notes(options, picker_options, function(notes)
|
|
local pos = vim.api.nvim_win_get_cursor(0)[2]
|
|
local line = vim.api.nvim_get_current_line()
|
|
|
|
if picker_options.multi_select == false then
|
|
notes = { notes }
|
|
end
|
|
for _, note in ipairs(notes) do
|
|
-- stylua: ignore
|
|
local nline = line:sub(0, pos) .. note.title .. " - " .. note.path .. line:sub(pos + 1)
|
|
vim.api.nvim_set_current_line(nline)
|
|
end
|
|
end)
|
|
end
|
|
|
|
require("zk.commands").add("ZkInsertLink", function(options)
|
|
yankName(options, { title = "Zk Yank" })
|
|
end)
|
|
end,
|
|
},
|
|
}
|