" ~/.vimrc " Frank Shute 11Dec07 02:04:48 " " 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 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 " I put this in f.s syntax on " I put this in f.s 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+=<:> " Don't use Ex mode, use Q for formatting " Ctl-v to escape chars " Don't use Ex mode, use Q for formatting map Q gq " Map F2 to format paragraph in insert " & escape mode map! #2 {gq}A map #2 {gq}A map! #3 A map #3 A " map add :r! cat ~/address.txt "read in my address " omap (operator-pending) inoremap ;date :r! date +\%d\%b\%y\%t\%T inoremap ;num :%! nl -ba noremap ,s :source ~/.vimrc noremap ,e :e ~/.vimrc "map #4 i Jxr~ " inoremap (all) inoremap ;www http://www.shute.org.uk/ " inoremap ;bsd FreeBSD abbr FB FreeBSD " paste X-buffer into commandline cmap " pastetoggle set pastetoggle= " LaTeX macros inoremap ;eq \begin{eqnarray*}o\end{eqnarray*}ko  inoremap ;fr \frac{}{}hhha noremap :so ~/.vim/xdvi_source.vim " Cursor keys for Screen map  map!  map  map!  map  map!  map  map!  " omap (operator-pending) omap  omap  " 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 0!'apgp -sta :set nolz " fix backspace