54 lines
1.5 KiB
Lua
54 lines
1.5 KiB
Lua
require("lz.n").load({
|
|
{
|
|
"zk-nvim",
|
|
cmd = { "ZkNew", "ZkNotes", "ZkTags", "ZkInsertLink", "ZkBacklinks", "ZkLinks" },
|
|
ft = "markdown",
|
|
keys = {
|
|
{
|
|
"<leader>nn",
|
|
function()
|
|
local title = vim.trim(vim.fn.input("Title: "))
|
|
if title ~= "" then
|
|
require("zk").new({ notebook_path = vim.env.ZK_NOTEBOOK_DIR, title = title })
|
|
end
|
|
end,
|
|
desc = "Create note",
|
|
},
|
|
{
|
|
"<leader>nf",
|
|
function()
|
|
require("zk").edit({ notebook_path = vim.env.ZK_NOTEBOOK_DIR }, { picker = "telescope" })
|
|
end,
|
|
desc = "Find notes",
|
|
},
|
|
{
|
|
"<leader>nt",
|
|
function()
|
|
require("zk.commands").get("ZkTags")({ notebook_path = vim.env.ZK_NOTEBOOK_DIR })
|
|
end,
|
|
desc = "Find note tags",
|
|
},
|
|
},
|
|
after = function()
|
|
require("zk").setup({
|
|
picker = "telescope",
|
|
lsp = { config = { root_dir = vim.env.ZK_NOTEBOOK_DIR } },
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
group = vim.api.nvim_create_augroup("lux-notes-maps", { clear = true }),
|
|
pattern = "markdown",
|
|
callback = function(args)
|
|
local path = vim.api.nvim_buf_get_name(args.buf)
|
|
if require("zk.util").notebook_root(path) then
|
|
vim.keymap.set("n", "<leader>ni", "<cmd>ZkInsertLink<cr>", {
|
|
buffer = args.buf,
|
|
desc = "Insert note link",
|
|
})
|
|
end
|
|
end,
|
|
})
|
|
end,
|
|
},
|
|
})
|