Woody Gilk edited this page Mar 23, 2014 · 12 revisions

How do I save configuration settings?

All settings should be saved in a file named .gvimrc which must be located in your home folder (abbreviated ~/). Note that you have to create this file if one does not already exist. Your home folder is the one called /Users/name where name is your login name. Type :h vimrc-intro for more information on Vim configuration files.

How can I change the default font?

Add the line set guifont=Monaco:h14 to your .gvimrc to set Monaco as the default font with a size of 14.

How can I set the default size of new windows?

Add the line set lines=40 to your .gvimrc to make 40 the default number of rows. To set the default number of columns to 100 add the line set columns=100.

If you want the window as big as possible, you can set these options to very large values or you can type :set lines? and :set columns? after having manually maximized the window to find out how big it is and then add these values to your .gvimrc.

Note that the dimensions of the first window you open are automatically saved and used for every window you open thereafter.

How do I maximize the window horizontally as well as vertically?

Hold down Cmd when clicking the green zoom button. If you want this to be the default behavior, open Terminal and enter

$ defaults write org.vim.MacVim MMZoomBoth 1

How do I configure Xcode to open files in MacVim?

In Xcode, open the Preferences and click the "File Types" tab, then expand "file -> text". Under the "text" item there is an entry called "sourcecode"; click the second column (Preferred Editor) of this entry and choose "External Editor -> Other". Navigate to MacVim in the dialog that pops up.

The "external editor" support in Xcode is very limited. Basically all the above change does is to open source code files in MacVim. You can also double click on build errors to open MacVim on the line where the error was reported.

How can I make the toolbar stay hidden after a restart?

Add the line set guioptions-=T to your .gvimrc file.

How can I prevent Finder file labels from disappearing when saving a file?

Add the line set backupcopy=yes to your .gvimrc file. Type :h 'backupcopy' for more information on why this is necessary.

How can I open files from Terminal?

Put the script mvim which comes bundled with the MacVim download somewhere in your path. Type :h macvim-start for more information.

How can I use MacVim to edit Git commit messages?

Add the following line to the file ~/.profile:

export EDITOR='mvim -f --nomru -c "au VimLeave * !open -a Terminal"'

The --nomru switch ensures that the commit message is not added to the Most Recently Used file menu (requires Snapshot 57 or later). The -c .. switch ensures that Terminal gets focus again after closing the commit message. (Note that you need to put the mvim script in your path for this to work.)

How can I force MacVim to use my shell PATH?

The problem is that MacOS uses zshenv incorrectly, forcing system paths for non-login shell calls. This can be fixed by moving zshenv to zprofile:

sudo mv /etc/zshenv /etc/zprofile 

My question is not answered in this FAQ. Where can I ask for help?

Please consult the Troubleshooting guide before asking for help! After doing so you may post your question to the vim_mac Google Group if it is MacVim related. General questions about using Vim should be posted to the vim_use Google Group.

Note that you do not need to subscribe to email notifications when signing up for either of these groups. You can read the groups online if you would rather keep your inbox clean. These groups are moderated so your first post may take up to a day before it arrives to the group (subsequent posts should show up within a few minutes).

Please read the guidelines before posting to either of these groups.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.