summaryrefslogtreecommitdiffstats
path: root/plugin/50-notes.lua
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-06-24 17:40:18 +0200
committerThomas Vanbesien <tvanbesi@proton.me>2026-06-24 17:40:18 +0200
commit7b355d982c23e566c9761bfb64e012d9c11d9072 (patch)
tree270724459eb4150395f3837f8bfc3a0c8d1a465c /plugin/50-notes.lua
parenta905605cdd128c0a0540096198a65781c6b23cd5 (diff)
downloadnvim-config-7b355d982c23e566c9761bfb64e012d9c11d9072.tar.gz
nvim-config-7b355d982c23e566c9761bfb64e012d9c11d9072.zip
nvim: scope notes find pickers to notes buffers, add global tag picker
Notes find pickers (<Leader>ft/ff/fg) are now set buffer-locally so they shadow the fzf defaults only inside notes buffers; add a global fzf tag picker on <Leader>ft, and move open-notes to <Leader>N.
Diffstat (limited to 'plugin/50-notes.lua')
-rw-r--r--plugin/50-notes.lua29
1 files changed, 21 insertions, 8 deletions
diff --git a/plugin/50-notes.lua b/plugin/50-notes.lua
index fa55743..ab90c8e 100644
--- a/plugin/50-notes.lua
+++ b/plugin/50-notes.lua
@@ -18,13 +18,13 @@
-- `NotesFindGrep`: fuzzy-find notes (content)
-- `NotesOpen`: move to the notes directory and open index
--
--- Keymaps (the find maps deliberately override the matching `<Leader>f…` defaults from 50-fzf.lua,
--- which loads earlier TODO proper fix):
--- `<Leader>fo`: open notes in current window
+-- Keymaps (global):
+-- `<Leader>N`: open notes in current window
+-- Keymaps (notes buffers only; shadow the matching `<Leader>f…` fzf defaults from 50-fzf.lua):
-- `<Leader>ft`: fuzzy-find notes by tags
-- `<Leader>ff`: fuzzy-find notes by file name
-- `<Leader>fg`: fuzzy-find notes by content
--- `<Tab>` / `<S-Tab>` (in notes buffers): go to next/previous followable entity
+-- `<Tab>` / `<S-Tab>`: go to next/previous followable entity
--
local notes_dir = require("dotfiles.notes").dir
@@ -427,6 +427,8 @@ end
-- * Include generated notes tags in 'tags' option
-- * Enable wikilink completion
-- * Map <Tab>/<S-Tab> to jump between followable entities
+-- * Shadow fzf's `<Leader>ft`/`<Leader>ff`/`<Leader>fg` with the notes pickers, buffer-locally so
+-- the global fzf defaults (50-fzf.lua) stay untouched everywhere else.
local function init_notes_buffer()
if not vim.tbl_contains(vim.opt_local.tags:get(), tagfile) then
vim.opt_local.tags:append(tagfile)
@@ -438,6 +440,18 @@ local function init_notes_buffer()
vim.keymap.set("n", "<S-Tab>", function()
follow.next(true)
end, { buffer = true, desc = "Go to previous followable entity" })
+ vim.keymap.set("n", "<Leader>ft", vim.cmd.NotesFindTags, {
+ buffer = true,
+ desc = "Fuzzy-find notes",
+ })
+ vim.keymap.set("n", "<Leader>ff", vim.cmd.NotesFindFile, {
+ buffer = true,
+ desc = "Fuzzy-find notes file name",
+ })
+ vim.keymap.set("n", "<Leader>fg", vim.cmd.NotesFindGrep, {
+ buffer = true,
+ desc = "Fuzzy-find notes content",
+ })
end
local function find_notes_by_tag()
@@ -536,9 +550,8 @@ vim.api.nvim_create_user_command(
)
vim.api.nvim_create_user_command("NotesOpen", open_notes, { desc = "Open notes" })
-vim.keymap.set("n", "<Leader>fo", vim.cmd.NotesOpen, { desc = "Open notes in current window" })
-vim.keymap.set("n", "<Leader>ft", vim.cmd.NotesFindTags, { desc = "Fuzzy-find notes" })
-vim.keymap.set("n", "<Leader>ff", vim.cmd.NotesFindFile, { desc = "Fuzzy-find notes file name" })
-vim.keymap.set("n", "<Leader>fg", vim.cmd.NotesFindGrep, { desc = "Fuzzy-find notes content" })
+-- Only the notes-open map is global; the find pickers (`ft`/`ff`/`fg`) are set buffer-locally in
+-- `init_notes_buffer` so they shadow the fzf defaults only inside notes buffers.
+vim.keymap.set("n", "<Leader>N", vim.cmd.NotesOpen, { desc = "Open notes in current window" })
generate_tags()