5

I moved mvim to /usr/local/bin, so from Terminal if I type mvim file.html, then MacVim will open in a new window and open the file file.html.

But if I open another file from Terminal, then it will open another MacVim window.

Is it possible open the new file as a new tab on MacVim?

I currently have the MacVim setting as

Open files from application: in the current window
    with a tab for each file

But that only open new files in a new tab only if I open the file from MacVim (not running mvim from the Terminal).

romainl
  • 186,200
  • 21
  • 280
  • 313
hobbes3
  • 28,078
  • 24
  • 87
  • 116

1 Answers1

7

This hack should work, but it may be frustrating to maintain every time that MacVim is updated. It requires you to edit the mvim script. This seems to be a longstanding and known issue.

mvim `which mvim`

## Add the following line to the top of the file, below the commented section:

tabs=true

## Replace the `if` structure at the bottom of the file with the following:

# Last step:  fire up vim.
if [ "$gui" ]; then
  if $tabs && [[ `$binary --serverlist` = "VIM" ]]; then
    exec "$binary" -g $opts --remote-tab-silent ${1:+"$@"}
  else
    exec "$binary" -g $opts ${1:+"$@"}
  fi
else
  exec "$binary" $opts ${1:+"$@"}
fi
jibiel
  • 8,175
  • 7
  • 51
  • 74
Ted Kalaw
  • 474
  • 1
  • 3
  • 9