obsidian.nvim icon indicating copy to clipboard operation
obsidian.nvim copied to clipboard

Function to return Telescope picker

Open DRKolev-code opened this issue 1 year ago • 2 comments

🚀 The feature, motivation and pitch

Hey. I like creating my mappings in a separate file. I find lazy's approach of opts and keys a nice organizational system. I would like to attack the mappings to the Telescope picker when I do this:

{ "<c-s-n>", function() vim.cmd("ObsidianSearch") end, mode = "n" }.

Is it possible to return the Telescope picker so that I can dynamically attach mappings?

Alternatives

No response

Additional context

No response

DRKolev-code avatar Apr 24 '24 06:04 DRKolev-code

Yea @DRKolev-code, there's not a good way to do this at the moment but I'm open to proposals.

epwalsh avatar Apr 30 '24 23:04 epwalsh

The only thing I can think of is a function that would return the picker. I am new to (n)vim as a whole and the only suggestion I can provide is what oil.nvim does. Inside oil.util there is this function:

M.get_preview_win = function()
  for _, winid in ipairs(vim.api.nvim_tabpage_list_wins(0)) do
    if vim.api.nvim_win_is_valid(winid) and vim.wo[winid].previewwindow then
      return winid
    end
  end
end

Maybe there could be a util function that returns the picker? I do not know how to dynamically add keymaps to an open telescope window but I guess even vim.api.nvim_buf_set_keymap would work.

DRKolev-code avatar May 01 '24 07:05 DRKolev-code