junegunn / junegunn/fzf.vim

Not possible to jump to existing open tab using :Lines

Open
#1,031 3 comments 3 reactions 0 assignees View on GitHub
Dominant language
Vim Script
Stars
10.3k
Forks
608
Avg merge
5d 8h
Merged PRs (30d)
2

Description

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`:

```vim
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?

- [x] I have read through https://github.com/junegunn/fzf.vim/blob/master/README.md
- [x] I have read through https://github.com/junegunn/fzf/blob/master/README-VIM.md
- [x] I have read through the manual page of fzf (`man fzf`)
- [x] I have searched through the existing issues

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.