Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I force gVim to open dragged-in files in a new tab?

I'd like gVim to open files dragged into it to open in a new tab, instead of replacing the current file. This question is on the right track, but I'd like to be able to run multiple instances of gVim, just able to drag files to the window I want.

I'm running on Windows 7.

like image 418
wes Avatar asked Dec 11 '09 23:12

wes


3 Answers

No you cannot, the default action on drag and drop is specified in the implementation of a windows application (OLE DoDragDrop). It has not been implemented to open dropped files in a new tab and thus won't. But gVim is open source... so you could submit a patch if you really want this :)

like image 184
Pierre-Antoine LaFayette Avatar answered Nov 19 '22 19:11

Pierre-Antoine LaFayette


You can start by typing :tabe and then drag and drop your file. I can't fully confirm this (I only have a mac) but I think this will end up with :tabe filename displayed. You can then hit enter and off you go...

like image 29
Peter Avatar answered Nov 19 '22 19:11

Peter


You could add the following in your .vimrc

autocmd BufReadPost * tab ball

This will open tabs for all buffers, including the newly dropped file. Notice it does so for all buffers, so also the ones already opened in gvim.

like image 3
Vincent Traag Avatar answered Nov 19 '22 19:11

Vincent Traag