Monday, March 29, 2010

Open MacVim tabs from command-line

Change the mvim script as follows to open files in new tabs instead of new windows when starting MacVim from the command line:

  1. Add the following line to the top of the file, below the commented section:
    tabs=true

  2. 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

Tip'o'the hat to Web Expose for this information.

No comments:

Post a Comment