summaryrefslogtreecommitdiffstats
path: root/plugin
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
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')
-rw-r--r--plugin/50-fzf.lua2
-rw-r--r--plugin/50-notes.lua29
2 files changed, 23 insertions, 8 deletions
diff --git a/plugin/50-fzf.lua b/plugin/50-fzf.lua
index 629cdb8..debe428 100644
--- a/plugin/50-fzf.lua
+++ b/plugin/50-fzf.lua
@@ -8,6 +8,7 @@
-- `<Leader>fg`: Grep picker
-- `<Leader>fb`: Buffer picker
-- `<Leader>fh`: Help tag picker
+-- `<Leader>ft`: Tag picker
-- `<Leader>fr`: Resume last picker
-- Avoid conflicts with the already existing fzf configuration at ~/.config/fzf/fzf.bash
@@ -70,4 +71,5 @@ vim.keymap.set("n", "<Leader>ff", fzf.files, { desc = "Fuzzy-find files" })
vim.keymap.set("n", "<Leader>fg", fzf.live_grep, { desc = "Fuzzy-find files content" })
vim.keymap.set("n", "<Leader>fb", fzf.buffers, { desc = "Fuzzy-find buffers" })
vim.keymap.set("n", "<Leader>fh", fzf.helptags, { desc = "Fuzzy-find help tags" })
+vim.keymap.set("n", "<Leader>ft", fzf.tags, { desc = "Fuzzy-find tags" })
vim.keymap.set("n", "<Leader>fr", fzf.resume, { desc = "Resume last fuzzy-find picker" })
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()