MacVim takes vim and provides better integration with Apple’s OS X - I’ve only just started using it and I am already loving it. Provided along with the application is a wrapper-script written to handle calls from the command-line:
cd project
mvim project_file.php
MacVim supports tabs, but unfortunately calling mvim multiple times from the command-line results in multiple separate windows opening, instead of multiple tabs in one window. I made the following modifications to the mvim script to correct this.
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









Thank you! This tip was just what I was looking for. Much appreciated.
And the obvious addition to this is that starting multiple tabs from the command-line is to do mvim -p file1 file2 ..
It would be very useful to have a command-line option to specify whether the new file should be opened in an existing tab, or in a new window.
thanks for the tip! it works great.
cyboertoast, a quick fix would be to add the following right after tabs=true:
if [ "$1" = "-n" ]
then
tabs=false
fi
then, by default, “mvim foo” will open foo in a new tab, while “mvim -n foo” will open foo in a new window.
Thanks! Just what I was looking for. =)
75. ???? ???? ????? ????????? ?? ?????????? ??????. ?????, ????? ???????