vimrc

An example vim vimrc configuration file

vim/vimrc FAQ: Can you share an example vim vimrc configuration file?

Sure. I don't use vim for programming much these days, so I don't have the vimrc configuration commands I used to use with various programming languages, but I'll be glad to share my vimrc configuration file that I use every day, along with a few extra lines to demonstrate some of the vim configuration possibilities.

Example vim vimrc configuration file

Here's an example vimrc file:

vim tip: How to configure vim autoindent alvin July 9, 2010 - 1:12pm

vim autoindent FAQ: How do I configure vim to automatically indent newlines? That is, if my current line is indented three spaces, and I hit [Enter], I want the next line to autmatically be indented three spaces as well.

To configure vim autoindent, just use this vim command:

vim editor: How do I enable and disable vim syntax highlighting?

vim syntax faq: How do I turn on (enable) or turn off (disable) vim syntax highlighting?

Turning on syntax highlighting in your vim editor is usually pretty simple; you just need to issue a syntax on command, either in your current editor session, or in your vimrc configuration file. Here are a couple of quick examples.

Turn vim syntax highlighting on

To enable syntax highlighting in your current vim editor session just issue this command:

vim macros - how to create vim macros

vi/vim FAQ: Can you provide some examples of how to create vim macros?

Here's a quick example of how to define macros that you can use in the vim editor (or vi editor). As you can tell by looking at them, I use these particular vim macros when editing HTML files.

Define vim macros with the vim map command

Step 1 in the process or creating vim macros is to edit the vi/vim startup file in your home directory. On Unix, Linux, and Mac OS X systems, this file is named .vimrc.

So, move to your home directory like this:

gvim fonts - How to set the default gvim font

Having just downloaded and installed vim (gvim) on my Mac (Mac OS X 10.5.x to be precise), and then struggling for a while to set the default font, I thought I'd make a brief note here about how to set the default font properly.

Setting a default gvim font in the gvimrc file

To set a default font for the gvim editor (in my case on Mac OS X), edit a file named ~/.gvimrc (i.e., a file named .gvimrc in your home directory), and add this line to get a 12-point Monaco font:

gvim colors: How to set the default gvim colorscheme

I just finished downloading and installing vim (gvim) on my Mac (Mac OS X 10.5.x to be precise), and then struggling for a while to set the default colorscheme, I thought I'd make a brief note here about how to set the default colorscheme properly.

Setting a default gvim color scheme (colorscheme)

As a friend of mine once, said "It's easy to do, once you know how to do it." For me, that applies to setting a default colorscheme for gvim on Mac OS X.

To set your vim default colorscheme to a theme named "slate", just follow these simple steps: