nvim: Fully switch to zk-nvim

Removed my own plugin in favor of zk-nvim integration.
This commit is contained in:
Marty Oehme 2024-02-07 22:29:03 +01:00
parent 8512bbf2cf
commit fbceea242d
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
3 changed files with 23 additions and 57 deletions

View file

@ -1,6 +1,10 @@
local map = vim.keymap.set local map = vim.keymap.set
require('which-key').register({ ["<localleader>c" ] = { name = "+md-code"}}) require("which-key").register({ ["<localleader>c"] = { name = "+md-code" } })
require('which-key').register({ ["<localleader>e" ] = { name = "+criticmarkup"}}) require("which-key").register({ ["<localleader>e"] = { name = "+criticmarkup" } })
if require("zk.util").notebook_root(vim.fn.expand("%:p")) ~= nil then
map("n", "<CR>", "<cmd>lua vim.lsp.buf.definition()<cr>", { silent = true })
end
-- edit code cells with full lsp access -- edit code cells with full lsp access
map("n", "<localleader>ce", "<cmd>FeMaco<cr>", { silent = true, desc = "edit code block" }) map("n", "<localleader>ce", "<cmd>FeMaco<cr>", { silent = true, desc = "edit code block" })
@ -19,7 +23,7 @@ map("n", "<localleader>cO", "O```python<cr><cr>```<esc>k", { desc = "Insert quar
map("n", "<localleader>cp", "<Plug>MarkdownPreviewToggle", { desc = "show md preview" }) map("n", "<localleader>cp", "<Plug>MarkdownPreviewToggle", { desc = "show md preview" })
-- create mindmaps directly from markdown! requires external executable -- create mindmaps directly from markdown! requires external executable
if (vim.fn.executable("markmap")) then if vim.fn.executable("markmap") then
map("n", "<localleader>cm", "<cmd>MarkmapOpen<cr>", { desc = "open md mindmap" }) map("n", "<localleader>cm", "<cmd>MarkmapOpen<cr>", { desc = "open md mindmap" })
map("n", "<localleader>cM", "<cmd>MarkmapWatch<cr>", { desc = "watch for md mindmap" }) map("n", "<localleader>cM", "<cmd>MarkmapWatch<cr>", { desc = "watch for md mindmap" })
end end

View file

@ -87,6 +87,5 @@
"which-key.nvim": { "branch": "main", "commit": "ce741eb559c924d72e3a67d2189ad3771a231414" }, "which-key.nvim": { "branch": "main", "commit": "ce741eb559c924d72e3a67d2189ad3771a231414" },
"wrapping.nvim": { "branch": "master", "commit": "5e87f1424c86c50d3bc205830aa56ed1cad45467" }, "wrapping.nvim": { "branch": "master", "commit": "5e87f1424c86c50d3bc205830aa56ed1cad45467" },
"zen-mode.nvim": { "branch": "main", "commit": "cb73b8bd0ef9d765b942db09dc762c603a89ae44" }, "zen-mode.nvim": { "branch": "main", "commit": "cb73b8bd0ef9d765b942db09dc762c603a89ae44" },
"zettelkasten.nvim": { "branch": "main", "commit": "0e77624689b470410f5355b613d45219c9350264" },
"zk-nvim": { "branch": "main", "commit": "fb0962b75a680561f94cae0588b8da92ea8d2fae" } "zk-nvim": { "branch": "main", "commit": "fb0962b75a680561f94cae0588b8da92ea8d2fae" }
} }

View file

@ -65,6 +65,11 @@ local prose_plugs = {
prefix({ ["<leader>n"] = { name = "+notes" } }) prefix({ ["<leader>n"] = { name = "+notes" } })
prefix({ ["<localleader>n"] = { name = "+note" } }) prefix({ ["<localleader>n"] = { name = "+note" } })
prefix({ ["<localleader>n"] = { name = "+note", mode = "v" } }) prefix({ ["<localleader>n"] = { name = "+note", mode = "v" } })
require("zk.commands").add("ZkOrphans", function(opts)
opts = vim.tbl_extend("force", { orphan = true }, opts or {})
require("zk").edit(opts, { title = "Zk Orphans" })
end)
end end
require("zk").setup({ picker = "telescope" }) require("zk").setup({ picker = "telescope" })
end, end,
@ -82,67 +87,25 @@ local prose_plugs = {
"ZkNewFromTitleSelection", "ZkNewFromTitleSelection",
"ZkNotes", "ZkNotes",
"ZkTags", "ZkTags",
"ZkOrphans",
}, },
keys = { keys = {
{ "<leader>ni", "<cmd>edit ~/documents/notes/index.md<cr>", desc = "open index", silent = true },
{ "<leader>nn", "<cmd>ZkNotes { sort = { 'modified' } }<cr>", desc = "note list" }, { "<leader>nn", "<cmd>ZkNotes { sort = { 'modified' } }<cr>", desc = "note list" },
{ {
"<leader>nf", "<leader>nf",
"<Cmd>ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }<CR>", "<Cmd>ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }<CR>",
desc = "note search", desc = "note search",
}, },
{ "<leader>nf", "<cmd>ZkMatch<cr>", desc = "find note from selection", mode = "v" },
{ "<leader>nt", "<cmd>ZkTags<cr>", desc = "note tags" }, { "<leader>nt", "<cmd>ZkTags<cr>", desc = "note tags" },
{ "<leader>nc", "<cmd>ZkCd<cr>", desc = "notes directory" }, { "<leader>nc", "<cmd>ZkCd<cr>", desc = "notedir cd" },
{ "<localleader>nl", "<cmd>ZkLinks<cr>", desc = "note links" }, { "<leader>no", "<cmd>ZkNotes { sort = { 'modified' } }<cr>", desc = "orphans list" },
{ "<localleader>nb", "<cmd>ZkLinks<cr>", desc = "note backlinks" }, { "<leader>nl", "<cmd>ZkLinks<cr>", desc = "note links" },
{ "<leader>nb", "<cmd>ZkBacklinks<cr>", desc = "note backlinks" },
{ "<localleader>nn", "<cmd>ZkNew { title = vim.fn.input('Title: ') }<cr>", desc = "new note" }, { "<localleader>nn", "<cmd>ZkNew { title = vim.fn.input('Title: ') }<cr>", desc = "new note" },
{ "<localleader>nn", ":ZkNewFromTitleSelection<cr>", desc = "title from selection", mode = "v" }, { "<localleader>nn", "<cmd>ZkNewFromTitleSelection<cr>", desc = "new note from selection", mode = "v" },
{ "<localleader>nN", ":ZkNewFromContentSelection<cr>", desc = "content from selection", mode = "v" }, { "<localleader>nN", "<cmd>ZkNewFromContentSelection<cr>", desc = "content from selection", mode = "v" },
{ "<localleader>nf", ":ZkMatch<cr>", desc = "find note from selection", mode = "v" },
},
},
-- simple static markdown linking and link following using zettel IDs
{
"marty-oehme/zettelkasten.nvim",
dependencies = {
"mickael-menu/zk-nvim", -- for the CD when opening index
},
ft = writing_ft,
keys = {
{
"<cr>",
function()
require("zettelkasten").link_follow()
end,
silent = true,
},
{
"<cr>",
function()
require("zettelkasten").link_follow(true)
end,
mode = "v",
},
{
"<leader>ni",
function()
require("zk.commands").get("ZkCd")()
require("zettelkasten").index_open()
end,
desc = "index page",
},
{
"<localleader>ni",
function()
require("zk.commands").get("ZkInsertLink")()
end,
desc = "insert link",
},
{
"<localleader>ni",
":'<,'>ZkInsertLinkAtSelection<cr>",
mode = "v",
desc = "insert link",
},
}, },
}, },