Skip to content

Is it possible to start :FzfLua tabs with the entry of the current tabpage auto-focused? #1870

Answered by ibhagwan
nyngwang asked this question in Q&A
Discussion options

You must be logged in to vote

@nyngwang, update fzf-lua to the latest commit and use fzf's load event to scroll to the selected tab, adjust your keybind to this function:

require("fzf-lua").tabs(function()
  local curtab = vim.fn.tabpagenr()
  local pos = 1
  for i, t in ipairs(vim.api.nvim_list_tabpages()) do
    if i < curtab then
      pos = pos + 1 + #vim.api.nvim_tabpage_list_wins(t)
    end
  end
  return {
    keymap = {
      fzf = { load = string.format("transform:echo 'pos(%d)'", pos) },
    }
  }
end)

As for your other questions, you're in the wrong thread and in any event you'll have to figure it out by yourself as unfortunately I don't have time for detailed answers ATM.

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@nyngwang
Comment options

@nyngwang
Comment options

@ibhagwan
Comment options

@nyngwang
Comment options

@phanen
Comment options

Answer selected by ibhagwan
Comment options

You must be logged in to vote
1 reply
@nyngwang
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants