fzf.vim icon indicating copy to clipboard operation
fzf.vim copied to clipboard

Fzf.vim creates new buffers while switching to buffers opened in other tabbed window?

Open ampandey-1995 opened this issue 1 year ago • 4 comments

Checklist

  • [x] I have fzf 0.54.0 or later
  • [x] I have searched through the existing issues

Output of :echo system(fzf#exec() .. ' --version')

0.60.2 (c0d407f7)

OS

  • [x] Linux
  • [ ] macOS
  • [ ] Windows
  • [ ] Etc.

Problem / Steps to reproduce

Steps to reproduce

  • Install fzf and fzf.vim using vim-plug.
  • vim a.txt b.txt
  • In command mode :tabe d.txt then :e f.txt.
  • :Buffers select b.txt

The problem seem to persist even i have set up below settings

let g:fzf_vim = {}
let g:fzf_vim.buffers_jump = 1

Image

Image

Image

Image

ampandey-1995 avatar Feb 26 '25 06:02 ampandey-1995

I can't reproduce the problem. Can you check if you still have the issue with the following minimal vimrc?

vim -Nu <(curl https://gist.githubusercontent.com/junegunn/6936bf79fedd3a079aeb1dd2f3c81ef5/raw)

(https://gist.githubusercontent.com/junegunn/6936bf79fedd3a079aeb1dd2f3c81ef5/raw)

junegunn avatar Mar 03 '25 10:03 junegunn

Sorry in advance , I meant not new buffers new windows are created for the same buffer in different tabpages while that same buffer is opened in some other tabpage window previously, using vim-ctrlspace with fzf & fzf.vim.

With minimal .vimrc as requested and with settings.

vim -Nu <(curl https://gist.githubusercontent.com/junegunn/6936bf79fedd3a079aeb1dd2f3c81ef5/raw)

let g:fzf_vim = {}
let g:fzf_vim.buffers_jump = 1

Currently , What I am observing is the list buffers such a.txt b.txt which is opened in one tabpage and second list of buffers opened in another tab page d.txt f.txt. When I do :Buffers and select a buffer suppose a.txt which is in another tabpage 1 while I am in tabpage 2 , the current tabpage 2 will switch to the buffer while it should suppose to jump to tabpage 1 which is not happening.

ampandey-1995 avatar Mar 03 '25 15:03 ampandey-1995

Image

Image

Image

ampandey-1995 avatar Mar 03 '25 16:03 ampandey-1995

I see, but it's not how it's supposed to work. In Vim, buffers aren't tied to specific tabs, and there is no API to get a list of buffers that belong to a tab - because they don't. The only option is to look at every window on every tab, see if the buffer of our interest is open, and jump to it.

https://github.com/junegunn/fzf.vim/blob/245eaf8e50fe440729056ce8d4e7e2bb5b1ff9c9/autoload/fzf/vim.vim#L788-L801

If we wanted to implement the behavior you're expecting, we'd have to do the bookeeping ourselves, but it's not something I want to add to fzf.vim.

junegunn avatar Mar 04 '25 15:03 junegunn