diff --git a/nvim/.config/nvim/lua/plugins/prose.lua b/nvim/.config/nvim/lua/plugins/prose.lua index a38a2d6..04a0844 100644 --- a/nvim/.config/nvim/lua/plugins/prose.lua +++ b/nvim/.config/nvim/lua/plugins/prose.lua @@ -168,39 +168,49 @@ local prose_plugs = { -- bring zettelkasten commands { "zk-org/zk-nvim", - config = function() + opts = function() if require("core.util").is_available("which-key") then require("which-key").add({ { "n", group = "notes" }, { "n", group = "note" }, { "n", group = "note", mode = "v" }, }) + end - require("zk.commands").add("ZkOrphans", function(opts) - opts = vim.tbl_extend("force", { orphan = true }, opts or {}) - require("zk").edit(opts, { title = "Zk Orphans" }) - end) - require("zk.commands").add("ZkGrep", function(opts) - local collection = {} - local list_opts = { select = { "title", "path", "absPath" } } - require("zk.api").list(vim.env.ZK_NOTEBOOK_DIR, list_opts, function(_, notes) - for _, note in ipairs(notes) do - collection[note.absPath] = note.title or note.path - end - end) - local options = vim.tbl_deep_extend("force", { - prompt_title = "Notes", - search_dirs = { vim.env.ZK_NOTEBOOK_DIR }, - disable_coordinates = true, - path_display = function(_, path) - return collection[path] - end, - }, opts or {}) - require("telescope.builtin").live_grep(options) + require("zk.commands").add("ZkOrphans", function(opts) + opts = vim.tbl_extend("force", { orphan = true }, opts or {}) + require("zk").edit(opts, { title = "Zk Orphans" }) + end) + require("zk.commands").add("ZkGrep", function(opts) + local collection = {} + local list_opts = { select = { "title", "path", "absPath" } } + require("zk.api").list(vim.env.ZK_NOTEBOOK_DIR, list_opts, function(_, notes) + for _, note in ipairs(notes) do + collection[note.absPath] = note.title or note.path + end end) + local search_dir = vim.env.ZK_NOTEBOOK_DIR + local options = vim.tbl_deep_extend("force", { + prompt = "Note Grep❯ ", + -- cmd = "cd " .. search_dir .. "; rg --vimgrep", + cwd = search_dir, + disable_coordinates = true, + path_display = function(_, path) + return collection[path] + end, + }, opts or {}) + -- FIXME: Don't hard-code this so much? + -- require("telescope.builtin").live_grep(options) + require("fzf-lua").live_grep(options) + end) + local picker = "select" + if require("core.util").is_available("fzf-lua") then + picker = "fzf_lua" + elseif require("core.util").is_available("telescope") then + picker = "telescope" end require("zk").setup({ - picker = "telescope", + picker = picker, lsp = { auto_attach = { enabled = true,