Skip to content

Not possible to jump to existing open tab using :Lines #1031

Description

@no-more-secrets

Hi,

After much searching and trying various solutions posted in forums, I have been unable to get the :Lines command to allow me to jump to an existing tab when the chosen file is already open in another tab. Is there any way to do this? I tried setting g:fzf_buffers_jump = 1 but that does not seem to help. I also tried various things with g:fzf_action but couldn't make that work given the implementation of s:line_handler. Can someone suggest a way? Here is the current implementation of the s:line_handler:

function! s:line_handler(lines)
  if len(a:lines) < 2
    return
  endif
  normal! m'
  let cmd = s:action_for(a:lines[0])
  if !empty(cmd) && stridx('edit', cmd) < 0
    execute 'silent' cmd
  endif

  let keys = split(a:lines[1], '\t')
  execute 'buffer' keys[0]
  execute keys[2]
  normal! ^zvzz
endfunction

but as can be seen, the execute 'silent' cmd, while it will execute a command that I put into g:fzf_action, does not allow passing the name of the file selected, so I can't write a custom function to e.g. find the tab and select it (by calling tab drop) since a filename is needed. Can someone help?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions