It uses two configuration files _vimrc and _gvimrc.
You can put these in your vim program directory (in my case C:\Program Files\Vim), which will affect all user of vim on your computer. Or you can put them in your Documents and Settings directory (eg.
C:\Documents and Settings\phil) which will only affect you.
" Vim Configuration File
" By Philip Hagen
" 8 November 2004
"
" Name as _vimrc.
" Put in the VIM installation directory to affect all users:
" eg. C:\Program Files\Vim\
" or in your Documents and Settings directory to affect only you:
" eg. C:\Documents and Settings\phil\
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg4 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
if &sh =~ '\<cmd'
silent execute '!""D:\Program Files\Vim\vim63\diff" ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . '"'
else
silent execute '!D:\Program" Files\Vim\vim63\diff" ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
endif
endfunction
" expand tabs (to spaces)
set et
" set tab width to 2 spaces
set tabstop=2
set shiftwidth=2
" copy indentation to next line
set autoindent
" guess indentation of next line based on source code brackets
set smartindent
" briefly highlight matching bracket
set showmatch
" Makefiles need to have genuine tab character codes in them
autocmd FileType make set noexpandtab shiftwidth=8
" no word wrapping for source code files
autocmd FileType c,cpp,h,cxx,rc,cs,make,prm,def set nowrap
set background=dark
" USEFUL KEYS
"
" 0 or <HOME> = very start of line
" ^ = start of line (not inc whitespace)
" $ = end of line
" i = edit mode to left of cursor
" a = edit mode to right of cursor
" I = start of line and edit mode
" A = end of line and edit mode
" o = open new line below current line (and change to insert mode)
" O = open new line above current line (and change to insert mode)
" Make Ctrl+Tab and Ctrl+Shift+Tab switch between buffers.
map <C-Tab> :bn<CR>
map <S-C-Tab> :bp<CR>
map <C-S-Tab> :bp<CR>
" When in insert mode, save first.
map! <C-Tab> <ESC>:w<CR>:bn<CR>
map! <S-C-Tab> <ESC>:w<CR>:bp<CR>
map! <C-S-Tab> <ESC>:w<CR>:bp<CR>
" F2 = open
map <F2> :browse confirm e<CR>
map! <F2> <ESC>:browse confirm e<CR>
" F3 = save
map <F3> :w<CR>
map! <F3> <ESC>:w<CR>i
" Ctrl + F3 or Shift + F3 = save with Windows file dialog
map <S-F3> :browse confirm w<CR>
map! <S-F3> <ESC>:browse confirm w<CR>i
map <C-F3> :browse confirm w<CR>
map! <C-F3> <ESC>:browse confirm w<CR>i
" F4 = comment current line
map <F4> ^i//<ESC>
map! <F4> <ESC>^i//<ESC>
" Shift F4 = uncomment current line
map <S-F4> ^xx
map! <S-F4> <ESC>^xx
" Ctrl + F4 = open comment above current line
map <C-F4> O//
map! <C-F4> <ESC>O//
" F5 = insert comment separator line of //'s above the current line
"map <F5> O<ESC>"zcc<ESC>0i//////////////////////////////////////////////////////////////////////////////////<ESC>j^
"map! <F5> <ESC>O<ESC>"zcc<ESC>0i//////////////////////////////////////////////////////////////////////////////////<ESC>j^i
" F5 = insert comment separator line of //'s above the current line
map <F5> O<ESC>0d$i//////////////////////////////////////////////////////////////////////////////////<ESC>j^
map! <F5> <ESC>O<ESC>0d$i//////////////////////////////////////////////////////////////////////////////////<ESC>j^i
" Shift + F5 = insert comment separator line above the current line
map <S-F5> O<ESC>0d$i//--------------------------------------------------------------------------------<ESC>j^
map! <S-F5> <ESC>O<ESC>0d$i//--------------------------------------------------------------------------------<ESC>j^i
" Ctrl + F5 = insert separator line of hyphens above the current line
" This one isn't for use with source code; use with text documents.
map <C-F5> O<ESC>0d$i--------------------------------------------------------------------------------<ESC>j^
map! <C-F5> <ESC>O<ESC>0d$i--------------------------------------------------------------------------------<ESC>j^i
" Alt + F5 = insert thick comment separator line above the current line
map <M-F5> O<ESC>0d$i//================================================================================<ESC>j^
map! <M-F5> <ESC>O<ESC>0d$i//================================================================================<ESC>j^i
" F6 = insert comment block above the current line
map <F6> ^<F5><F5>kO<ESC>0d$i//
map! <F6> <ESC>^<F5><F5>kO<ESC>0d$i//
" Shift + F6 = insert C++ method comment block.
" Cursor must be over class of C++ function
" eg. for: void myclass::mymethod(void)
" the cursor should be on the m in myclass.
map <S-F6> "zy3eO// <ESC>p<ESC><F5>j<F5>kk$a
map! <S-F6> <ESC>"zy3eO// <ESC>p<ESC><F5>j<F5>kk$a
" Alt + F6 = insert comment block for C/C++ (non-member) function.
map <M-F6> "zyeO// <ESC>p<ESC><F5>j<F5>kk$a
map! <M-F6> <ESC>"zyeO// <ESC>p<ESC><F5>j<F5>kk$a
" Ctrl + Alt + F6 = insert comment block at start of file, with filename, author, and date
map <C-M-F6> <C-HOME><F5><F5>kO<ESC>0d$i// <CR><ESC>0d$i// <CR><ESC>0d$i// By Philip Hagen<CR><ESC>0d$i// phagen@micromine.com.au<CR><ESC>0d$i// <CR><ESC>0d$i// Created: <C-R>=strftime("%d %B %Y")<CR><ESC>kkkkk$a
map! <C-M-F6> <ESC><C-M-F6>
" F7 = jump to function declaration
map <F7> ?[[:alnum:]]\+[[:space:]]\+[[:alnum:]]\+[[:space:]]*::[[:space:]]*[[:alnum:]]\+[[:space:]]*(<CR><CR>
map! <F7> <ESC>?[[:alnum:]]\+[[:space:]]\+[[:alnum:]]\+::[[:alnum:]]\+[[:space:]]*(<CR>
map <S-F7> /[[:alnum:]]\+[[:space:]]\+[[:alnum:]]\+[[:space:]]*::[[:space:]]*[[:alnum:]]\+[[:space:]]*(<CR>
map! <S-F7> <ESC>/[[:alnum:]]\+[[:space:]]\+[[:alnum:]]\+::[[:alnum:]]\+[[:space:]]*(<CR>
" An example for a gvimrc file.
" The commands in this are executed when the GUI is started.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2001 Sep 02
"
" To use it, copy it to
" for Unix and OS/2: ~/.gvimrc
" for Amiga: s:.gvimrc
" for MS-DOS and Win32: $VIM\_gvimrc
" for OpenVMS: sys$login:.gvimrc
" Make external commands work through a pipe instead of a pseudo-tty
"set noguipty
" set the X11 font to use
" set guifont=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1
set ch=2 " Make command line two lines high
set mousehide " Hide the mouse when typing text
" Make shift-insert work like in Xterm
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
" Only do this for Vim version 5.0 and later.
if version >= 500
" I like highlighting strings inside C comments
"let c_comment_strings=1
" Switch on syntax highlighting if it wasn't on yet.
if !exists("syntax_on")
syntax on
endif
" Switch on search pattern highlighting.
set hlsearch
" For Win32 version, have "K" lookup the keyword in a help file
"if has("win32")
" let winhelpfile='windows.hlp'
" map K :execute "!start winhlp32 -k <cword> " . winhelpfile <CR>
"endif
" Set nice colors
" background for normal text is light grey
" Text below the last line is darker grey
" Cursor is green, Cyan when ":lmap" mappings are active
" Constants are not underlined but have a slightly lighter background
"highlight Normal guibg=grey90
"highlight Cursor guibg=Green guifg=NONE
"highlight lCursor guibg=Cyan guifg=NONE
"highlight NonText guibg=grey80
"highlight Constant gui=NONE guibg=grey95
"highlight Special gui=NONE guibg=grey95
" Set font
set guifont=Courier_New:h8:cANSI
" Set color scheme
colorscheme desert
endif