{ ... }: { programs.nixvim = { plugins = { zk = { enable = true; settings = { picker = "telescope"; }; }; which-key.settings.spec = [ { __unkeyed-1 = "z"; group = "Zettelkasten"; icon = "󰝰 "; } ]; }; keymaps = [ { key = "zn"; action = "ZkNew { title = vim.fn.input('Title: ') }"; mode = [ "n" ]; options = { desc = "Create"; }; } { key = "zo"; action = "ZkNotes { sort = { 'modified' } }"; mode = [ "n" ]; options = { desc = "Open"; }; } { key = "zt"; action = "ZkTags"; mode = [ "n" ]; options = { desc = "Open Tags"; }; } { key = "zf"; action = "ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }"; mode = [ "n" ]; options = { desc = "Search"; }; } { key = "zf"; action = ":'<,'>ZkMatch"; mode = [ "v" ]; options = { desc = "Search (Matching the Selection)"; }; } ]; files = { # TODO: Add descriptions # TODO: Did the sytnax change? "ftplugin/markdown.lua" = { extraConfigLua = # lua '' -- Add the key mappings only for Markdown files in a zk notebook. if require("zk.util").notebook_root(vim.fn.expand('%:p')) ~= nil then local function map(...) vim.api.nvim_buf_set_keymap(0, ...) end local opts = { noremap=true, silent=false } -- Create a new note after asking for its title. -- This overrides the global `zn` mapping to create the note in the same directory as the current buffer. map("n", "zn", "ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }", opts) -- Create a new note in the same directory as the current buffer, using the current selection for title. map("v", "znt", ":'<,'>ZkNewFromTitleSelection { dir = vim.fn.expand('%:p:h') }", opts) -- Create a new note in the same directory as the current buffer, using the current selection for note content and asking for its title. map("v", "znc", ":'<,'>ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }", opts) -- Open notes linking to the current buffer. map("n", "zb", "ZkBacklinks", opts) -- Open notes linked by the current buffer. map("n", "zl", "ZkLinks", opts) -- Preview a linked note. map("n", "K", "lua vim.lsp.buf.hover()", opts) -- Open the code actions for a visual selection. map("v", "za", ":'<,'>lua vim.lsp.buf.range_code_action()", opts) end ''; }; }; }; }