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
|
-- bring zettelkasten commands
|
||||||
{
|
{
|
||||||
"zk-org/zk-nvim",
|
"zk-org/zk-nvim",
|
||||||
config = function()
|
opts = function()
|
||||||
if require("core.util").is_available("which-key") then
|
if require("core.util").is_available("which-key") then
|
||||||
require("which-key").add({
|
require("which-key").add({
|
||||||
{ "<leader>n", group = "notes" },
|
{ "<leader>n", group = "notes" },
|
||||||
{ "<localleader>n", group = "note" },
|
{ "<localleader>n", group = "note" },
|
||||||
{ "<localleader>n", group = "note", mode = "v" },
|
{ "<localleader>n", group = "note", mode = "v" },
|
||||||
})
|
})
|
||||||
|
end
|
||||||
|
|
||||||
require("zk.commands").add("ZkOrphans", function(opts)
|
require("zk.commands").add("ZkOrphans", function(opts)
|
||||||
opts = vim.tbl_extend("force", { orphan = true }, opts or {})
|
opts = vim.tbl_extend("force", { orphan = true }, opts or {})
|
||||||
|
|
@ -188,19 +189,28 @@ local prose_plugs = {
|
||||||
collection[note.absPath] = note.title or note.path
|
collection[note.absPath] = note.title or note.path
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
local search_dir = vim.env.ZK_NOTEBOOK_DIR
|
||||||
local options = vim.tbl_deep_extend("force", {
|
local options = vim.tbl_deep_extend("force", {
|
||||||
prompt_title = "Notes",
|
prompt = "Note Grep❯ ",
|
||||||
search_dirs = { vim.env.ZK_NOTEBOOK_DIR },
|
-- cmd = "cd " .. search_dir .. "; rg --vimgrep",
|
||||||
|
cwd = search_dir,
|
||||||
disable_coordinates = true,
|
disable_coordinates = true,
|
||||||
path_display = function(_, path)
|
path_display = function(_, path)
|
||||||
return collection[path]
|
return collection[path]
|
||||||
end,
|
end,
|
||||||
}, opts or {})
|
}, 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)
|
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
|
end
|
||||||
require("zk").setup({
|
require("zk").setup({
|
||||||
picker = "telescope",
|
picker = picker,
|
||||||
lsp = {
|
lsp = {
|
||||||
auto_attach = {
|
auto_attach = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue