Gavin Costello - Vim Configuration

Home
CV
Wexford
Liff
Links
Contact

Config files:
Bash
Vim
Mutt

set autowrite

" CURSOR OPTIONS
" set cursor for Command, Visual, Normal
" set gcr=n-c-v:nCursor
" turn on blink for insert:
" set gcr=i:blinkon1

" Use jikes to build Java source files
set makeprg=/usr/local/bin/jikes\ -nowarn\ -Xstdout\ +E\ %
" One line errorformat, for jikes +E option
set efm=%f:%l:%c:%*\\d:%*\\d:%*\\s%m
"set efm=%f:%l:%v:%*\\d:%*\\d:%*\\s%m

"set efm=%A%f:%l:%c:%*\\d:%*\\d:,
"       \%C%*\\s%trror:%m,
"      \%+C%*[^:]%trror:%m,
"      \%C%*\\s%tarning:%m,
"      \%C%m

" Set fileformat to Unix
set ff=unix
set nocompatible    " Use Vim defaults (much better!)
set bs=2        " allow backspacing over everything in insert mode
"set autoindent " always set autoindenting on
set smartindent
set backup      " keep a backup file
set backupdir=~/bak
set viminfo='20,\"50    " read/write a .viminfo file, don't store more
                        " than 50 lines of registers

" Show matching brackets
set showmatch
set showmode
set smartcase
set showcmd
set expandtab
set visualbell
set wildchar=<TAB>
" Ignore class files when listing files
set wildignore=*.class
set wildmode=list:full
set ruler

set guifont=-b&h-lucidatypewriter-medium-r-normal-*-*-120-*-*-m-*-iso8859-15
set encoding=iso-8859-15

" limit text width to 78 chars
set tw=78

"set tab space to 2
set sw=4 ts=4

"show tabs, spaces, end of lines
"set list
"set listchars=tab:>-,trail:.
"set shell=bash

" General Editing - Turning umlauts into ascii (for German keyboards)"
"imap  ae" imap  oe" imap  ue" imap  ss"
"&#196; ->   :%s/\&#196;//gc  -> D" &#214; ->   :%s/\&#214;//gc  -> V
"&#220; ->   :%s/\&#220;//gc  -> \" &#228; ->   :%s/\&#228;//gc  -> d
"&#246; ->   :%s/\&#246;//gc  -> v" &#252; ->   :%s/\&#252;//gc  -> |

" In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78

" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")

" Set abbreviations
if has("win32")
  ab soj so $VIM\vim60\syntax\javascript.vim
  ab soht so $VIM\vim60\syntax\html.vim
  ab sox so $VIM\vim60\syntax\xml.vim
  ab sojs so $VIM\vim60\syntax\jsp.vim
  ab 2html so $VIM\vim60\syntax\2html.vim
  ab rex so $VIM\vim60\RExplorer.vim
  iab pr System.out.println("
  iab stt e.printStackTrace();
  "WinManager
  "map <c-w><c-f>:FirstExplorerWindow<cr>
  "map <c-w><c-b>:BottomExplorerWindow<cr>
  "map <c-w><c-t>:WMToggle<cr>

else
  ab soj so $VIM/vim61/syntax/javascript.vim
  ab soht so $VIM/vim61/syntax/html.vim
  ab sox so $VIM/vim61/syntax/xml.vim
  ab sojs so $VIM/vim61/syntax/jsp.vim
  ab 2html so $VIM/vim61/syntax/2html.vim
  iab pr System.out.println("
  iab stt e.printStackTrace();
  " insert date in format "20-08-2002"
  "iab Idate =strftime("%d-%m-%Y")
  " insert date in format "20-Aug-2002"
  "iab IDate =strftime("%d-%b-%Y")

  " DATE FUNCTIONS
  " insert date in format "20 Aug, 2002"
  iab Idate <C-R>=strftime("%d %B %Y, %X")<CR>
  map ,L mz1G/Last
  Modified:\\s*/e+1CIdate`z

  "WinManager
  "map <c-w><c-f>:FirstExplorerWindow<cr>
  "map <c-w><c-b>:BottomExplorerWindow<cr>
  "map <c-w><c-t>:WMToggle<cr>
endif

" Set mappings
" Don't use Ex mode, use Q for formatting
map Q gq
map t 1G
map H :set nohls<cr>
" Map L -> Preview in Links browser
map L :!links file://%<cr>

"map wm :WMToggle<cr>

" For circling through buffers
map <F2> :bnext<CR>
" RExplorer
map <F3> :so $VIM\vim60\RExplorer.vim
" map Edit -> Select All
map <F5> ggVG
" map Edit -> Copy
vmap <F6> "+y
" map Edit -> Paste
map <F7> "+p
map <F11> !!date<cr>
map <M-j> :bn<cr>
map <M-k> :bp<cr>

" Switch syntax highlighting on, when the terminal has colors
    set background=dark
  syntax on
  set hlsearch

augroup cprog
  " Remove all cprog autocommands
  au!

  " When starting to edit a file:
  "   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:*/,:// autocmd BufWritePre *.c,*.h norm ,L augroup END augroup java au! autocmd BufWritePre *.java norm ,L augroup END augroup html au! autocmd BufWritePre *.html norm ,L 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 let ch_save = &ch|set ch=2 autocmd BufReadPost,FileReadPost *.gz '[,']!gunzip autocmd BufReadPost,FileReadPost *.gz set nobin autocmd BufReadPost,FileReadPost *.gz let &ch = ch_save|unlet ch_save autocmd BufReadPost,FileReadPost *.gz
execute ":doautocmd BufReadPost " . expand("%:r") autocmd BufWritePost,FileWritePost *.gz !mv <afile> <afile>:r autocmd BufWritePost,FileWritePost *.gz !gzip <afile>:r autocmd FileAppendPre *.gz !gunzip <afile> autocmd FileAppendPre *.gz !mv <afile>:r <afile> autocmd FileAppendPost *.gz !mv <afile> <afile>:r autocmd FileAppendPost *.gz !gzip <afile>:r augroup END " Colour statusline set statusline=%1*[%02n]%*\ %2*%F%*\ %(\ %M%R%H)%)%=%3*Pos=<%l,%c%V>%* "hi statusline term=inverse cterm=bold ctermfg=Cyan ctermbg=Red "hi statuslineNC term=inverse cterm=bold ctermfg=white ctermbg=blue " User1: color for buffer number hi User1 ctermfg=green ctermbg=black " User2: color for filename hi User2 ctermfg=black ctermbg=white hi User2 ctermfg=red ctermbg=white " User3: color for position hi User3 ctermfg=blue ctermbg=white " statusline always set laststatus=2 " Java highlighting of functions and debug statements "let java_highlight_functions=1 "let java_highlight_debug=1