diff options
Diffstat (limited to 'plugin/50-notes.lua')
| -rw-r--r-- | plugin/50-notes.lua | 29 |
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() |
