Bharath
Bharath

Reputation: 105

Open files in a new tab in gvim

I started using vim/gvim for windows few days ago. I use notepad++ until now but would like to start using gvim completly.

One thing i find is, on opening a file in gvim(by double clicking the file) always opens a new instance of gvim even if another gvim instance is already running. Is there any setting that i can turn on in gvim for it to open up the file in a new tab of an already running instance of gvim?

Upvotes: 4

Views: 3190

Answers (3)

NING Li
NING Li

Reputation: 621

I see the accepted answer gives a way to achieve the target via command line. In case you want to double click a file to open it in a new tab of the existing gvim/macvim window. Try to select "open files from applications -> in the current window -> with a tab for each file" in the preference panel of gvim/macvim.

Upvotes: 0

Benj
Benj

Reputation: 32398

Sure you can just run:

gvim --remote-tab-silent <file>

When you run:

gvim --remote-tab-silent <file2>

This will open in the same window in a new tab...

Additionally, if you installed gvim from the native windows installer, you should have a shell extension which allows you to "open in existing vim" from windows explorer. This will actually default to opening in a new buffer rather than a new tab. A buffer buffers can be navigated between by doing ":bn" (buffer next) or ":bp" (buffer previous). Personally I prefer them to tabs.

Upvotes: 5

Kent
Kent

Reputation: 195029

since you mentioned notepad++, I assume that you are using vim on windows. then try this out, see if it works for you.

http://vim.wikia.com/wiki/Launch_files_in_new_tabs_under_Windows

Upvotes: 2

Related Questions