" An example for a vimrc file. " " Maintainer: Bram Moolenaar " Last change: 2001 Jul 18 " " To use it, copy it to " for Unix and OS/2: ~/.vimrc " for Amiga: s:.vimrc " for MS-DOS and Win32: $VIM\_vimrc " for OpenVMS: sys$login:.vimrc " When started as "evim", evim.vim will already have done these settings. if v:progname =~? "evim" finish endif " Use Vim settings, rather then Vi settings (much better!). " This must be first, because it changes other options as a side effect. set nocompatible " allow backspacing over everything in insert mode set backspace=indent,eol,start set background=light set autoindent " always set autoindenting on set cul " highlights the current line you're on if has("vms") set nobackup " do not keep a backup file, use versions instead else set backup " keep a backup file endif set history=50 " keep 50 lines of command line history set ruler " show the cursor position all the time set showcmd " display incomplete commands set incsearch " do incremental searching set softtabstop=2 set tabstop=2 " set tabstop to 2 spaces (default 8) set shiftwidth=2 " set shiftwidth to 2 spaces (default 8) set expandtab let html_no_rendering=1 " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries " let &guioptions = substitute(&guioptions, "t", "", "g") " Don't use Ex mode, use Q for formatting map Q gq " Make p in Visual mode replace the selected text with the "" register. vnoremap p :let current_reg = @"gvs=current_reg " This is an alternative that also works in block mode, but the deleted " text is lost and it only works for putting the current register. "vnoremap p "_dp " Switch syntax highlighting on, when the terminal has colors " Also switch on highlighting the last used search pattern. if &t_Co > 2 || has("gui_running") syntax on " rh - comented out following line " set hlsearch colorscheme rh set gfn=Panic_Sans:h12 if v:progname =~? "gvim" set macatsui endif endif set encoding=utf-8 set nowrap set dictionary+=/Users/rhahn/.vim-html-tags set complete+=k set ignorecase set smartcase set backupdir=./.backup,.,/tmp set directory=.,./.backup,/tmp filetype on filetype plugin on " The following block of lines provides autocomplete for brackets and braces. " this code was found at: http://www.oreillynet.com/pub/wlg/7430 inoremap ( ()i inoremap ) =ClosePair(')') inoremap { {}i " autocmd Syntax html,vim inoremap < >i| inoremap > =ClosePair('>') inoremap } =ClosePair('}') inoremap [ []i inoremap ] =ClosePair(']') inoremap " =QuoteDelim('"') function ClosePair(char) if getline('.')[col('.') - 1] == a:char return "\" else return a:char endif endf function QuoteDelim(char) let line = getline('.') let col = col('.') if line[col - 2] == "\\" return a:char elseif line[col - 1] == a:char return "\" else return a:char.a:char."\i" endif endf " Now we're going to experiment with abbreviation mapping. " iab _isod :r !isodatekddA iab _sig Author: :r !echo $EMAIL iab _nowdate Date: =strftime("%d %B %Y, %X") iab _ Fi<pa>%pa>F%s:call getchar() iab ___ okddkyyp:s/./-/g iab ____ okddkyyp:s/./=/g iab _a %F%s:call getchar() iab _ab %F%s:call getchar() iab _ac %F%s:call getchar() iab _ad
%
F%s:call getchar() iab _an %F%s:call getchar() iab _ap %F%s:call getchar() iab _ar F%s:call getchar() iab _b %F%s:call getchar() iab _ba F%s:call getchar() iab _basef F%s:call getchar() iab _bd %F%s:call getchar() iab _bi %F%s:call getchar() iab _bl
O:call getchar() iab _bo O:call getchar() iab _br
iab _bu F%s:call getchar() iab _ca %F%s:call getchar() iab _ce
%
F%s:call getchar() iab _ci %F%s:call getchar() iab _co %F%s:call getchar() iab _col iab _colg %F%s:call getchar() iab _db alert('%');F%s:call getchar() iab _dd
%
F%s:call getchar() iab _de %F%s:call getchar() iab _df %F%s:call getchar() iab _dir %F%s:call getchar() iab _d
O:call getchar() iab _di
k0f%s:call getchar() iab _dc
k0f%s:call getchar() iab _dl
O:call getchar() iab _dt
%
F%s:call getchar() iab _e %F%s:call getchar() iab _fi
%
F%s:call getchar() iab _fo F%s:call getchar() iab _f
k0f%s/" i:call getchar() iab _h1

%

F%s:call getchar() iab _h2

%

F%s:call getchar() iab _h3

%

F%s:call getchar() iab _h4

%

F%s:call getchar() iab _h5
%
F%s:call getchar() iab _h6
%
F%s:call getchar() iab _he O:call getchar() iab _hr
iab _h "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">O:call getchar() iab _i %F%s:call getchar() iab _if F%s:call getchar() iab _im F%s/" i:call getchar() iab _in F%s/" i:call getchar() iab _ins %F%s:call getchar() iab _isi iab _kbd %F%s:call getchar() iab _lab F%s:call getchar() iab _le %F%s:call getchar() iab _li
  • %
  • F%s:call getchar() iab _la
  • %
  • F%s:call getchar() iab _l F%s:call getchar() iab _link F%s:call getchar() iab _ma k0f%s:call getchar() iab _me %F%s:call getchar() iab _menu kf%s:call getchar() iab _m F%s:call getchar() iab _msie iab _utf8 iab _nof %F%s:call getchar() iab _nos F%s:call getchar() iab _ob %F%s:call getchar() iab _ol
    O:call getchar() iab _optg O:call getchar() iab _opt F%s:call getchar() iab _p

    %

    F%s:call getchar() iab _pa F%s:call getchar() iab _pr
    %
    F%s:call getchar() iab _q %F%s:call getchar() iab _s %F%s:call getchar() iab _sa %F%s:call getchar() iab _sc kO iab _se k0f%s:call getchar() iab _sm %F%s:call getchar() iab _sp %F%s:call getchar() iab _stri %F%s:call getchar() iab _stro %F%s:call getchar() iab _st O:call getchar() iab _sub %F%s:call getchar() iab _sup %F%s:call getchar() iab _t
    O:call getchar() iab _tb %F%s:call getchar() iab _td %F%s:call getchar() iab _te F%s:call getchar() iab _tf %F%s:call getchar() iab _th %F%s:call getchar() iab _the %F%s:call getchar() iab _ti %F%s:call getchar() iab _tr O:call getchar() iab _tt %F%s:call getchar() iab _u %F%s:call getchar() iab _ul
    O:call getchar() iab __a alt="%" F%s:call getchar() iab __c class="%" F%s:call getchar() iab __h href="%" F%s:call getchar() iab __hs hspace="%" F%s:call getchar() iab __id id="%" F%s:call getchar() iab __n name="%" F%s:call getchar() iab __ob onblur="%" F%s:call getchar() iab __och onchange="%" F%s:call getchar() iab __ock onclick="%" F%s:call getchar() iab __od ondblclick="%" F%s:call getchar() iab __of onfocus="%" F%s:call getchar() iab __okd onkeydown="%" F%s:call getchar() iab __okp onkeypress="%" F%s:call getchar() iab __oku onkeyup="%" F%s:call getchar() iab __ol onload="%" F%s:call getchar() iab __omd onmousedown="%" F%s:call getchar() iab __omm onmousemove="%" F%s:call getchar() iab __omou onmouseout="%" F%s:call getchar() iab __omov onmouseover="%" F%s:call getchar() iab __omu onmouseup="%" F%s:call getchar() iab __or onreset="%" F%s:call getchar() iab __osel onselect="%" F%s:call getchar() iab __os onsubmit="%" F%s:call getchar() iab __ou onunload="%" F%s:call getchar() iab __sr src="%" F%s:call getchar() iab __st style="%" F%s:call getchar() iab __ta target="%" F%s:call getchar() iab __te text="%" F%s:call getchar() iab __ti title="%" F%s:call getchar() iab __ty type="%" F%s:call getchar() iab __v value="%" F%s:call getchar() iab __vs vspace="%" F%s:call getchar() " Only do this part when compiled with support for autocommands. if has("autocmd") " Enable file type detection. " Use the default filetype settings, so that mail gets 'tw' set to 72, " 'cindent' is on in C files, etc. " Also load indent files, to automatically do language-dependent indenting. filetype plugin indent on " For all text files set 'textwidth' to 78 characters. " "autocmd FileType text setlocal textwidth=78 " When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid or when inside an event handler " (happens when dropping a file on gvim). autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g`\"" | \ endif endif " has("autocmd")