Re: MacVIM help?

110 views
Skip to first unread message

Tim Gray

unread,
Jun 14, 2012, 11:54:21 AM6/14/12
to vim...@googlegroups.com
On Jun 14, 2012 at 08:05 AM -0700, Jason Slack-Moehrle wrote:
>In MacVim prefs I have checked: Open files from applications: in the
>current window
>as well as the pop-up below as: with a tab for each file.

That combination works here for me for files clicked in Finder.

For files opened from the command line, to open them up in a MacVim
window that is already open, you'll probably need to use the --remote
option. Also, perusing the command line options, it looks like the -p
option will open the files in tabs. From my playing around with these
options right now, --remote and -p don't work together. I had to use
--remote-tab to get the combination behavior (open in the current MacVim
instance, but in tabs).

björn

unread,
Jun 14, 2012, 4:14:38 PM6/14/12
to vim...@googlegroups.com
On Thu, Jun 14, 2012 at 5:05 PM, Jason Slack-Moehrle wrote:
>
> I have in my .vimrc:
>
> tabs=true

This is not a valid command. What did you intend to do?

> and in my .bash_profile:
>
> alias mvim="open -a "/Applications/MacVim-snapshot-64/MacVim.app""

This is also a bit strange. Usually "mvim" refers to the script that
comes bundled with MacVim (see ":h mvim").

> In MacVim prefs I have checked: Open files from applications: in the
> current window
> as well as the pop-up below as: with a tab for each file.
>
> I am still getting separate windows.

I can just say the same as Tim: this preference works fine for me.
Maybe you should try going through the troubleshooting guide:

https://github.com/b4winckler/macvim/wiki/Troubleshooting

Björn

Bee

unread,
Jun 14, 2012, 7:45:28 PM6/14/12
to vim_mac
On Jun 14, 8:05 am, Jason Slack-Moehrle <slackmoeh...@gmail.com>
wrote:
> I am trying to create a macVim environment that allows files when
> double clicked from the Finder and opened via a command-line to be
> opened in MacVim in tabs.
>
> I have in my .vimrc:
>
> tabs=true
>
> and in my .bash_profile:
>
> alias mvim="open -a "/Applications/MacVim-snapshot-64/MacVim.app""
>
> In MacVim prefs I have checked: Open files from applications: in the
> current window
> as well as the pop-up below as: with a tab for each file.
>
> I am still getting separate windows.
>
> Can anyone provide advice?
>
> -Jason

This works well to open files from the command line:

alias mvim='open -a macvim "$@"'

To have Finder open files with double click:
- find a file of the type (extension) you want to open in Finder
- in Finder highlight the file
- use "Finder > File > Get Info" --or-- command+I
- click the triangle next to "Open With"
- select MacVim, you may need to navigate using "Other..."
- finally select "Change All"

Then all files with that same extension will open with MacVim

-Bill

Bee

unread,
Jun 14, 2012, 7:55:05 PM6/14/12
to vim_mac
Oh... it can be simpler:

alias mvim="open -a macvim $@"

And it can be used to open several files at time:

mvim zzoom.css ccc.sh .v7z.sh

-Bill

Bee

unread,
Jun 14, 2012, 10:57:09 PM6/14/12
to vim_mac
Another possibility... to open each file in a tab:

macvimpath="/Applications/MacVim-snapshot-64"

alias vimm="$macvimpath/MacVim.app/Contents/MacOS/Vim -gp $@"

I like to separate the path from the app to make it clear where the
app is,
just in case, later, I move or rename it.

These are in my ~/.profile file.

Bill

zabouti

unread,
Jun 15, 2012, 12:25:41 PM6/15/12
to vim...@googlegroups.com
Thanks to everyone here - this is something I've wanted to do for a long time.

Now, thanks to the suggestions here and to vim's help messages, I've made a little shell script with these two lines:

#!/bin/sh
/Applications/MacVim.app/Contents/MacOS/Vim -gp --remote-tab $*

If I call it with something like 'myvim ~/temp.txt', it will open ~/temp.txt in an existing MacVim window in a new tab.

I love it!

Andy Todd

unread,
Jun 16, 2012, 3:33:27 AM6/16/12
to vim...@googlegroups.com
Or you could just switch to MacVim and type :tabe ~/temp.txt

Regards,
Andy
--
From the desk of Andrew J Todd esq - http://www.halfcooked.com/

zabouti

unread,
Jun 16, 2012, 7:27:15 AM6/16/12
to vim...@googlegroups.com

Or I can drag the file's icon from the finder and drop it into my MacVim window.

The point is that I can now do this right from the shell, where I tend to do lots of my work.

-- ge

Reply all
Reply to author
Forward
0 new messages