ojroques / nvim-lspfuzzy

A Neovim plugin to make the LSP client use FZF
BSD 2-Clause "Simplified" License
316 stars 11 forks source link

Feature request: Adding support for tab drop #26

Closed yolo2h closed 2 years ago

yolo2h commented 2 years ago

Hi, I like your plugin, and it's very useful. I found fzf can jump to the window/tab where the buffer is open(set ['ctrl-t'] = 'tab drop'), can nvim-lspfuzzy do this?

yolo2h commented 2 years ago

I write some code like:

-------------------- FZF FUNCTIONS -------------------------
local function jump(entries)
  ...
  -- A FZF action was used
  if opts.fzf_action[key] then
    if opts.fzf_action[key] == 'tab drop' then
      for _, buf_info in ipairs(vim.fn.getbufinfo()) do
        local uri = vim.uri_from_bufnr(buf_info.bufnr)
        if uri == locations[1]['uri'] then
          cmd('tab drop ' .. buf_info.name)
          break
        end
      end
    else
      cmd(opts.fzf_action[key])
    end
  end
  ...
end

It's ugly but works fine for me, could you add option(like callback) allow me rewrite that function?

ojroques commented 2 years ago

tab drop should work now in the latest commit (with ['ctrl-t'] = 'tab drop'). Can you try and report if it works ?

yolo2h commented 2 years ago

Thank you so much, it works great!