nvim: Fix zk commands always being created
They were under a conditional which would only have them be created if which-key plugin was found beforehand.
This commit is contained in:
parent
2eebe047f6
commit
15cf9b192b
1 changed files with 33 additions and 23 deletions
|
|
@ -168,13 +168,14 @@ 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({
|
||||
{ "<leader>n", group = "notes" },
|
||||
{ "<localleader>n", group = "note" },
|
||||
{ "<localleader>n", group = "note", mode = "v" },
|
||||
})
|
||||
end
|
||||
|
||||
require("zk.commands").add("ZkOrphans", function(opts)
|
||||
opts = vim.tbl_extend("force", { orphan = true }, opts or {})
|
||||
|
|
@ -188,19 +189,28 @@ local prose_plugs = {
|
|||
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_title = "Notes",
|
||||
search_dirs = { vim.env.ZK_NOTEBOOK_DIR },
|
||||
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 {})
|
||||
require("telescope.builtin").live_grep(options)
|
||||
-- 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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue