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

Jump to existing window/tab when using :Files

Open bpierre opened this issue 8 years ago • 4 comments

  • Category
    • [ ] Question
    • [ ] Bug
    • [x] Suggestion
  • Vim
    • [x] Vim
    • [x] Neovim

The same way #98 added an option to jump to already opened buffers, would it be possible to have the same for :Files?

bpierre avatar Aug 24 '17 13:08 bpierre

This suggestion is really helpful because I use :Files very often. Just like ctrlp, if we can jump to the already opened buffer/window, this could make my life better.

BorisChiou avatar Jul 12 '19 20:07 BorisChiou

BTW, someone posted a vim script to work around this, from reddit:

let g:fzf_buffers_jump = 1
function! s:GotoOrOpen(command, ...)
  for file in a:000
    if a:command == 'e'
      exec 'e ' . file
    else
      exec "tab drop " . file
    endif
  endfor
endfunction
command! -nargs=+ GotoOrOpen call s:GotoOrOpen(<f-args>)
let g:fzf_action = {
  \ 'ctrl-t': 'GotoOrOpen tab',
  \ 'ctrl-x': 'split',
  \ 'ctrl-v': 'vsplit' }

BorisChiou avatar Jul 12 '19 21:07 BorisChiou

However, an easier way is something like this:

let g:fzf_action = {
  \ 'ctrl-t': 'tab drop',
  \ 'ctrl-x': 'split',
  \ 'ctrl-v': 'vsplit' }

BorisChiou avatar Jul 12 '19 21:07 BorisChiou

Hi, after applying this configuration:

nmap <C-F> :Files<CR>
let g:fzf_action = {
    \ 'enter': 'tab drop',
    \ 'ctrl-t': 'tab split',
    \ 'ctrl-s': 'split',
    \ 'ctrl-v': 'vsplit'
    \ }

let g:fzf_layout = {'down':'30'}

I have a little problem with the :Buffers command

Error detected while processing function 286[30]..<SNR>44_callback[25]..function 286[30]..<SNR>44_callback:
line   23:
Vim(drop):E471: Argument required: silent tab drop
Error detected while processing function 293[30]..<SNR>44_callback[25]..function 293[30]..<SNR>44_callback:

I am a total vim script newbie and I find it hard to figure out what is wrong.

ObiWahn avatar May 26 '22 07:05 ObiWahn