2

I am using the above and editing new files using mvim <filename>. The first time after I installed mvim in the /usr/local/bin directory it seemed to open files in new tabs by default, this behaviour has now stopped.

I would like to know the .vimrc setting to turn it back on or mvim switch that I should use to open files so that they are tabbed instead of opened as new windows.

The .vimrc I am using currently is:

set number
set ruler
"folding settings
set foldmethod=indent   "fold based on indent
set foldnestmax=20      "deepest fold is 10 levels
set nofoldenable        "dont fold by default
set foldlevel=31        "this is just what i use
set ignorecase

I don't think any of the above should change the behaviour of mvim and the way it opens new files.

I've already read: MacVim -- switch to tab where file is opened if trying to open an already-opened file; and Use MacVim as standard Terminal?; and I am also in the middle of reading :help mvim

I am sure I have read the answer somewhere, however I cannot remember where and now cannot find it.

2

use the --remote-tab command line switch, as in:

mvim --remote-tab foobar.txt

The answer was obtained by reading help:mvim it is located in section 14 of the help file titled macvim-hints.

Extracted here is the relevant section of the MacVim 7.4 help file:

Scenario:

~ You want to open a file in a tab in an already opened window, but typing "mvim filename" in Terminal opens it up in a separate window.

Solution:

~ Use the |--remote-tab| switch. If you have several windows open you might have to specify which window you want the file to open in by using the |--servername| switch. The title of a window usually ends in something like "VIM" or "VIM3" --- this is the server name of that window. So to open a file named "foobar.txt" in a window whose title ends in "VIM3" you would type (the order of the arguments matters):

mvim --servername VIM3 --remote-tab foobar.txt

For more information, consult the |client-server| manual page.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .