1

I use fzf to find/open files, but it always creates a new tab or replaces the current buffer. I want instead to use :tab drop <filename> but I get

E319: Sorry, the command is not available in this version

When looking at the docs for :drop I see {only available when compiled with a GUI}.

Is there a way to enable :tab drop for the terminal version of Vim, or some other way to get the same functionality; i.e., Vim will switch to the existing tab if the file is already open, otherwise it will open the file in a new tab?

  • 1
    Welcome to Vi and Vim! I don't see anything about GUI only when I look at :h :drop. – Jake Grossman Sep 22 at 19:29
  • 1
    @JakeGrossman that message only shows up when the version of Vim is not compiled with GUI support. See the docs here: vimdoc.sourceforge.net/htmldoc/windows.html#:drop – Herb Sep 22 at 20:22
  • 1
    Can you install gVim? I'm not sure why the gui support is needed, but I am able to use :tab drop in a terminal Vim on Windows, with gVim installed. – Herb Sep 22 at 20:25
  • @HerbWolfe thanks! Installing gvim and then running it in terminal mode does indeed fix it. This seems like an issue with vim though, since it works in terminal it shouldn't be conditioned on gui support. – Gérard Depardieu Sep 22 at 21:20
  • You could write your own command or function that would search open tabs for the file (ie, behave like drop), and invoke that? – D. Ben Knoble Sep 23 at 1:06
3

vim built with gui support allows ":tab drop " even in terminal mode, for example the ubuntu vim-gtk3 package supports it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.