What is the difference between MacVim and regular Vim? [closed]
Asked Answered
S

4

244

I'm reasonably new to OS X, but I'm familiar with Vim from using it in various *nix systems. I've seen many people recommend running MacVim over Vim in the terminal. Can anyone tell me what differences there are between MacVim and regular Vim?

Sacrifice answered 5/5, 2011 at 4:2 Comment(1)
Probably has to do with mac friendly keybindings (ctrl vs command keys)Eda
P
248

MacVim is just Vim. Anything you are used to do in Vim will work exactly the same way in MacVim.

MacVim is more integrated in the whole OS than Vim in the Terminal or even GVim in Linux, it follows a lot of Mac OS X's conventions.

If you work mainly with GUI apps (YummyFTP + GitX + Charles, for example) you may prefer MacVim.

If you work mainly with CLI apps (ssh + svn + tcpdump, for example) you may prefer vim in the terminal.

Entering and leaving one realm (CLI) for the other (GUI) and vice-versa can be "expensive".

I use both MacVim and Vim depending on the task and the context: if I'm in CLI-land I'll just type vim filename and if I'm in GUI-land I'll just invoke Quicksilver and launch MacVim.

When I switched from TextMate I kind of liked the fact that MacVim supported almost all of the regular shortcuts Mac users are accustomed to. I added some of my own, mimiking TextMate but, since I was working in multiple environments I forced my self to learn the vim way. Now I use both MacVim and Vim almost exactly the same way. Using one or the other is just a question of context for me.

Also, like El Isra said, the default vim (CLI) in OS X is slightly outdated. You may install an up-to-date version via MacPorts or you can install MacVim and add an alias to your .profile:

alias vim='/path/to/MacVim.app/Contents/MacOS/Vim'

to have the same vim in MacVim and Terminal.app.

Another difference is that many great colorschemes out there work out of the box in MacVim but look terrible in the Terminal.app which only supports 8 colors (+ highlights) but you can use iTerm — which can be set up to support 256 colors — instead of Terminal.

So… basically my advice is to just use both.

EDIT: I didn't try it but the latest version of Terminal.app (in 10.7) is supposed to support 256 colors. I'm still on 10.6.x at work so I'll still use iTerm2 for a while.

EDIT: An even better way to use MacVim's CLI executable in your shell is to move the mvim script bundled with MacVim somewhere in your $PATH and use this command:

$ mvim -v

EDIT: Yes, Terminal.app now supports 256 colors. So if you don't need iTerm2's advanced features you can safely use the default terminal emulator.

Predecessor answered 5/5, 2011 at 7:19 Comment(8)
Homebrew is a painless package manager vs macports, once homebrew is installed simply brew install macvim and you're set. mxcl.github.com/homebrewSparklesparkler
+1 for homebrew. I've had way better luck with brew than I have with macports. Though macports still has more packages than homebrew.Mush
@Greg how is macports any harder sudo port install macvimDiandrous
@Diandrous Sure, installing one package isn't any more painful. But IMHO managing dependencies and OS-default packages vs. installed packages is a lot easier in Homebrew. Also, sudo is never required in homebrew.Ministry
Fun fact: when installing macvim via homebrew emacs is installed as one of dependencies :DPreposterous
I don't see anything to that effect in the recipe but one of the dependencies may have Emacs as dependency and Emacs is installed by default on Macs anyway.Predecessor
"MacVim is just Vim." Does that mean that MacVim relies on some form of terminal (which might be different for Mac and Win)? Or is it completely divorced from the terminal (i.e. stand alone)?Piccadilly
@someguyinafloppyhat, Vim is a terminal application and the GUI in GVim (Windows/Linux) and MacVim (Mac OS X) is, for all intent and purpose, a glorified terminal emulator.Predecessor
U
14

EDIT: See comment from @Luke Davis.

Old answer:

The one reason I have which made switching to MacVim worth it: Yank uses the system clipboard.

I can finally copy paste between MacVim on my terminal and the rest of my applications.

Untune answered 15/3, 2017 at 19:22 Comment(3)
You can also use the * register in terminal VIM to yank onto the system clipboard. Which IMO is better because I personally don't always want to sync to my system clipboard. So in VIM, when yanking a line for example, use "*yy to copy to the clipboard.Pelletier
vim.wikia.com/wiki/Accessing_the_system_clipboard - all you have to do is add a line to your .vimrc for this to be default as wellHendrika
If you want to yank to clipboard in terminal vim just add a +, for example if you'd like to copy the whole content to clipboard :%y+Wolves
G
3

unfortunately, with "mvim -v", ALT plus arrow windows still does not work. I have not found any way to enable it :-(

Gasconade answered 6/11, 2015 at 15:5 Comment(1)
Thanks for the mvim command, I installed MacVim via HomeBrew but didn't know there was a default symlinked command. Thanks!Ministry
M
3

It's all about the key bindings which one can simply achieve from .vimrc configurations. As far as clipboard is concerned you can use :set clipboard unnamed and the yank from vim will go to system clipboard. Anyways, whichever one you end up using I suggest using this vimrc config , it contains a whole lot of plugins and bindings which will make your experience smooth.

Mcmasters answered 16/4, 2020 at 3:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.