MacVim and gvimrc by example

It dawned on me that posting my .gvimrc file, which I use on Mac OS X exclusively with MacVim, might be instructive by example for people searching high and low on the interweb for this information (which I just did).

Let me back up a sec. The .gvimrc resource file is meant for the GUI version of the wonderful text editor vim. MacVim is a native GUI version of vim for Mac OS X folks. It is Sliced Bread. MacVim uses .gvimrc to tell it how to behave. MacVim also takes a peek at .vimrc (the general vim resource file), which I’ll post separately.

Without further ado, here is my .gvimrc for those of us who learn just as well by example:

" What a funny comment character
" .gvimrc
" v 0.1
" rev. 2009-03-18

" Turn on line numbers
set number

" Change colorscheme
" colorscheme slate

" Turns on the tab bar always
set showtabline=2

" Number of horizontal lines on the screen
set lines=60

" GUI Option to remove the Toolbar (T)
set guioptions-=T

" Sets the font and size
set guifont=Bitstream\ Vera\ Sans\ Mono:h12

" Sets the percent transparency
set transparency=10

To get this running, do the following:
1. copy the code above and paste it into your favorite text editor
2. save the file in your home directory as ‘.gvimrc’
3. run MacVim


7 thoughts on “MacVim and gvimrc by example

  1. Brian

    Thanks from me also! I created a similar file, it did not seem to work, but copy/pasting yours made all well in MacVim 🙂

  2. Daniel Balfour

    Yep… pretty cool post, thanks for the 411. I’m still trying to figure out how to offset the beginnings of my lines from the margin….

  3. idele

    I’m trying to figure out where to save custom color schemes for MacVim to find them.. Can anybody help?

  4. sc Post author

    Hi, you might try to create a directory for color schemes:


    and add your example.vim file to that directory. You probably need to make sure the permissions are okay, but now if you are in MacVim (also vim in the terminal), you can use the command:

    :colorscheme example

    to execute that colorscheme file. If you want to make this a permanent change, you can add to your gvimrc a line that says:

    colorscheme example

    Dropping the colon executes these commands in the rc file.

    Finally, I am not sure if the “colors” subdirectory is customizable, but this is one way that it works. Hope this helps.

  5. Pingback: Vim / Gvim / MacVim : vimrc / gvimrc « My Other Brain

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s