File available as a textfile with correct control codes.

" ~/.vimrc
" Frank Shute 30Jun09
"
" An example of a vimrc file
" To use it, copy it to
"     for Unix and OS/2:  ~/.vimrc
"  for MS-DOS and Win32:  $VIM\_vimrc
"  Ctrl-v to escape control chars

set nocompatible	" Use Vim defaults instead of vi
set bs=2		" allow backspacing over everything in insert mode
set ai			" always set autoindenting on
set tw=70		" always limit the width of text to 70
set backup		" keep a backup file
set viminfo='20,\"50	" read/write a .viminfo file, don't store more
			" than 50 lines of registers
set rulerformat=%-10.(%f%)\ %-6.(%h%m%r%y%)\ %=%04.(%l%)\ \ \ %P
set ruler		" ruler on
syntax on		" syntax highlighting on
set list
set listchars=tab:»·,trail:·
set laststatus=2	" 2 is always on
set ul=12		" Number of undolevels
set mouse=a		" Mouse support in all modes
set showmatch		" Match brackets
set nomodeline		" Security fix
set scrolloff=5		" Keep at least 5 lines above/below cursor
set matchpairs+=<:>     " Match < and >


" Don't use Ex mode, use Q for formatting

map Q gq


" Map F2 to format paragraph in insert
" and escape mode

map! #2 ^[{gq}A
map #2 {gq}A


" omap (operator-pending)

noremap ,d :r! date +\%d\%b\%y\%t\%T^M
noremap ,n :%! nl -ba
noremap ,s :source ~/.vimrc
noremap ,e :e ~/.vimrc


" inoremap (all)

inoremap  ;www http://www.shute.org.uk/


" Abbreviations

abbr FB FreeBSD	

" paste X-buffer into commandline

cmap <S-Insert> <S-MiddleMouse>	

" pastetoggle
set pastetoggle=<F9>


" LaTeX macros

inoremap  ;eq \begin{eqnarray*}^[o\end{eqnarray*}^[ko^M^H
inoremap  ;fr \frac{}{}^[hhha


" Launch xdvi from vim

noremap   :so ~/.vim/xdvi_source.vim^M


" Cursor keys for Screen

map ^[[A 
map! ^[[A 
map ^[[B 
map! ^[[B 
map ^[[D 
map! ^[[D 
map ^[[C 
map! ^[[C 

" omap (operator-pending)

omap ^[[A 
omap ^[[B 

" screen fix

" if $TERM == 'screen'
"  set term=xterm
" endif


" pgp mappings
"  ;px - encrypt and sign
"  ;pe - encrypt
"  ;ps - sign
"  ;pd - decrypt
"  ;pv - verify

map ;px :.,/^-- $/-2!/bin/sh -c 'pgp -feast 2>/dev/tty'
map ;pe :.,/^-- $/-2!/bin/sh -c 'pgp -feat 2>/dev/tty'
map ;ps :10,$!/bin/sh -c 'pgp -fast +verbose=0 +clear 2>/dev/tty'
map ;pd :/^-----BEG/,/^-----END/!/bin/sh -c 'pgp -f 2>/dev/tty'
map ;pv :/^-----BEG/,/^-----END/w !pgp -m


" Needed for HTML
" autocmd Filetype html source ~/vim/genutils.vim
" autocmd Filetype html source ~/vim/libList.vim
" autocmd Filetype html source ~/vim/EasyHtml.vim
" autocmd Filetype html source ~/vim/myhtml.vim
" autocmd Filetype tex source ~/vim/mylatex.vim

"source ~/vim/calendar.vim

augroup cprog
  " Remove all cprog autocommands
  au!
 
  "   For *.c and *.h files set formatting of comments and set C-indenting on.
  "   For other files switch it off.
  "   Don't change the order, it's important that the line with * comes first.
  autocmd BufRead *       set formatoptions=tcql nocindent comments&
  autocmd BufRead *.c,*.h set formatoptions=croql cindent comments=sr:/*,mb:*,el:*/,://
augroup END

augroup gzip
  " Remove all gzip autocommands
  au!

  " Enable editing of gzipped files
  "	  read:	set binary mode before reading the file
  "		uncompress text in buffer after reading
  "	 write:	compress file after writing
  "	append:	uncompress file, append, compress file
  autocmd BufReadPre,FileReadPre	*.gz set bin
  autocmd BufReadPost,FileReadPost	*.gz '[,']!gunzip
  autocmd BufReadPost,FileReadPost	*.gz set nobin
  autocmd BufReadPost,FileReadPost	*.gz execute ":doautocmd BufReadPost " . expand("%:r")

  autocmd BufWritePost,FileWritePost	*.gz !mv  :r
  autocmd BufWritePost,FileWritePost	*.gz !gzip :r

  autocmd FileAppendPre			*.gz !gunzip 
  autocmd FileAppendPre			*.gz !mv :r 
  autocmd FileAppendPost		*.gz !mv  :r
  autocmd FileAppendPost		*.gz !gzip :r
augroup END


augroup PGP
au!
  au BufReadPost *.pgp :%!pgp -f
  au BufWritePre *.pgp :%!pgp -fc
augroup END

" FreeBSD SGML

augroup sgmledit
  autocmd FileType sgml set formatoptions=cq2l " Special formatting options
  autocmd FileType sgml set textwidth=70       " Wrap lines at 70 columns
  autocmd FileType sgml set shiftwidth=2       " Automatically indent
  autocmd FileType sgml set softtabstop=2      " Tab key indents 2 spaces
  autocmd FileType sgml set tabstop=8          " Replace 8 spaces with a tab
  autocmd FileType sgml set autoindent         " Automatic indentation
augroup END


" 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

" Security (PGP) stuff -- Mark beginning of block (ma), go to end of
"                         block, then type one of the following:
"  \Pd: decrypt text, as filter
"  \Pe: encrypt text, ascii armor, as filter
"  \Pk: add public-key to my keyring
"  \Ps: digitally sign, text, ascii-armor, filter
" map \Pd   :set lz0!'apgp -f:set nolz
" map \Pe   :set lz0!'apgp -etaf:set nolz
" map \Pk   :set lz0!'apgp -kaf:set nolz
" map #5   :set lz^M0!'apgp -sta^M:set nolz^M