vimfiles / vimrc

" ==================================================================
" File:         $HOME/.vimrc
" Last update:  Sat Jul 28 23:02:24 MEST 2001
" Purpose:      *Personal* Setup file for the editor Vim (Vi IMproved)
"               It contains everything which I use *personally*.
" Author:       Sven Guckes (
"               <URL:>
" ==================================================================

" First set to use 256 colors
set t_Co=256

" ==================================================================
" Mind you, this file is only a setup file for *personal* use.
" The BIG setup file which I created for *all* users ("vimrc.forall")
" is available in my setup file directory:
"    (uncompressed)
" (compressed)
" Enjoy!  Feedback is very welcome!  :-)
" ==================================================================

" ======================================
" Loading general setup files first
" ======================================

" The PCs at run WindowsNT-4 and
" the home directory is mounted on drive Z: -
" so when you start up Vim on one of those machines
" if has("dos16") || has("dos32") || has("gui_win32")
" naaah.  I don't use that DOS version. ;-)
" if has("gui_win32")
"   " Source the setup file for all users:
"   source Z:\\.vimrc.forall
"   " About 42 lines fit nicely on that screen:
"   set lines=42
" endif

source $HOME/.vim/vimrc.forall
source $HOME/.vim/aspell.vim
"source $HOME/.vim/python_editing.vim

" ===================
" Settings of Options
" ===================

"     list & listchars
"set list   listchars=tab:��,trail:�
" set list   listchars=tab:��,trail:�
" TN3270 does not show high-bit characters:
" set listchars=tab:>.,trail:o

"    Turn on HighLightSearching:

 set t_kb=
 set t_kD=[3~
 set hls
 set is
" sometimes I need this, sometimes I dont...

"     wildmenu!  this makes use of the command lien to show
"     possible macthes on buffernames and filenames - yay!
  if version>=508
    set wildmenu

" ==============
" Autocommands
" ==============

" When editing HTML files (aka webpages)
" expand the "keywords" by characters "colon" and "slash"
" so you can expand URL prefixes as "words", eg
"  ;-)
  if version>=508
  au FileType html set isk+=:,/,~

" Silly test message to check the filepattern for message files:
" au BufRead .followup,.article,.letter,mutt* echo "Editing Messages\!"

" au BufCreate * set term=vt220
" au BufCreate * set term=ansi
" map ''' :set term=vt220<cr>:set term=ansi<cr>

" setting initial position after reading a file into a buffer:
" au BufReadPost * normal 2G10|

" ==============
" Abbreviations
" ==============

" ABbreviations
" personal addresses:
  ab MYUSERNAME mturk
  ab MYHP

" ==============
" Colorization
" ==============

" Colorize some default highlight groups
" see ":help highlight-default"

"    Comments: Colorizing the "comments" (see ":help comments").
"    cyan on white does not look good on a black background..
" hi comment                           ctermfg=cyan   ctermbg=black
" hi comment                           ctermfg=cyan   ctermbg=7

" hi Cursor
" hi Directory
" hi ErrorMsg
" hi FoldColumn
" hi Folded
" hi IncSearch

"    LineNr:  Colorize the line numbers (displayed with "set number").
"    Turn off default underlining of line numbers:
  hi LineNr       term=NONE cterm=NONE

" hi ModeMsg
" hi MoreMsg

" coloring "nontext", ie TABs, trailing spaces,  end-of-lines,
" and the "tilde lines" representing lines after end-of-buffer.
  hi NonText      term=NONE cterm=NONE ctermfg=blue   ctermbg=black

"    Normal text:    Use white on black.
" hi normal ctermfg=white ctermbg=black   guifg=white guibg=black
" Oops - this overrides the colors for the status line - DANG!

" hi Question

"    Search: Coloring "search matches".  Use white on red.
  hi search  ctermfg=white ctermbg=red     guifg=white guibg=red

" hi SpecialKey

"    statusline:  coloring the status line
  hi StatusLine   term=NONE cterm=NONE ctermfg=yellow ctermbg=red
  hi StatusLineNC term=NONE cterm=NONE ctermfg=black  ctermbg=white

" hi Title
" hi VertSplit
" hi Visual
" hi VisualNOS
" hi WarningMsg
" hi WildMenu

" Other Groups:

"    Normal:  Coloring the text with a default color.
  hi normal       term=NONE

" ==============
" Mappings
" ==============

" Attribution Fixing: from "Last, First" to "First Last":
  map ,ATT gg}jWdWWPX

" ============================================================
" Options() - used to display some important option values
" within the status line (see below at "set statusline".
" ============================================================
" Statusline without colors and display of options -
" but with percentage at end:
" set statusline=Vim-%{Version()} [%02n]\ %(%M%R%H%)\ %F\ %=<%l,%c%V>\ %P
" Damien WYART <> [000329]:
" set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ \ %-25(%3l,%c%03V\ \ %P\ (%L)%)%12o'%03b'
" hi  User1 term=inverse,bold cterm=inverse,bold ctermfg=red

fu! Options()
"           let opt="Opt:"
            let opt=""
  " autoindent
" if &ai|   let opt=opt." ai"   |else|let opt=opt." noai"   |endif
  if &ai|   let opt=opt." ai"   |endif
  "  expandtab
" if &et|   let opt=opt." et"   |else|let opt=opt." noet"   |endif
  if &et|   let opt=opt." et"   |endif
  "  hlsearch
" if &hls|  let opt=opt." hls"  |else|let opt=opt." noet"   |endif
  if &hls|  let opt=opt." hls"  |endif
  "  paste
" if &paste|let opt=opt." paste"|else|let opt=opt." nopaste"|endif
  if &paste|let opt=opt." paste"|endif
  "  shiftwidth
  if &shiftwidth!=8|let opt=opt." sw=".&shiftwidth|endif
  "  textwidth - show always!
                    let opt=opt." tw=".&tw
"   let opt=opt."\[".&lines.",".&columns."\]"
  return opt

" ============================================================
" Colorizing that status lines!  Whee!  :-)
" ============================================================
" Statusline without colors and display of options -
" but with percentage at end:
" set statusline=Vim-%{Version()} [%02n]\ %(%M%R%H%)\ %F\ %=<%l,%c%V>\ %P

" set   statusline=Vim-%{Version()}\ %{getcwd()}\ \ %1*[%02n]%*\ %(%M%R%H%)\ %2*%F%*\ %=%{Options()}\ %3*<%l,%c%V>%*
" Text between "%{" and "%}" is being evaluated and thus suited for functions.
" Here I will use the function "Options()" as defined below to show the
" values of some (local) options..
" The strings "%N*" unto "%*" correspond to the highlight group "UserN":
"       User1: color for buffer number
 hi    User1 cterm=NONE    ctermfg=red    ctermbg=white  guifg=red    guibg=white
"       User2: color for filename
 hi    User2 cterm=NONE    ctermfg=green  ctermbg=white  guifg=green  guibg=white
"       User3: color for position
 hi    User3 cterm=NONE    ctermfg=blue   ctermbg=white  guifg=blue   guibg=white

fu! Version()
	return version

" visual mode:  'p' to replace current text
" with previous copied/deleted text: [010126]
  vmap p d"0P

set tabstop=4
set expandtab

" ============================================================
" Final words...
" The last line is allowed to be a "modeline" with my setup.
" It gives vim commands for setting variable values that
" are specific for editing this file.  Used mostly for
" setting the textwidth (tw) and the "shiftwidth" (sw).
" Note that the colon within the value of "comments"
" needs to be escaped with a backslash!
"       vim:tw=70 et sw=4 comments=\:\"

" Matt's additions:

let mapleader=","

map <leader>T :tabnew<CR>
map <leader>t :tabn<CR>

map ,C  1G/@change:\s*/e+1<CR>CYDATE<ESC>,hl
map ,H  :r~/.vim/common/epy_header.txt<CR>
nnoremap <silent> <F5> :TlistToggle<CR>
nnoremap <silent> ,Td :TlistToggle<CR>
let Tlist_Ctags_Cmd="/usr/local/bin/ctags"
map ,Tp :TlistAddFilesRecursive . *.py <CR>
map ,Tc :TlistAddFilesRecursive . *.C *.c *.h <CR>
"map ,Tyl :TlistSessionLoad $HOME/Research/enzo/tools/yt/.tagsession <CR>
"map ,Tys :TlistSessionSave $HOME/Research/enzo/tools/yt/.tagsession <CR>
map ,Tys :TlistSessionSave .tagsession<CR>
map ,Tyl :TlistSessionLoad .tagsession<CR>

"map ,s <Esc>d/^-*$<CR>

au BufNewFile,BufRead *.src set ft=fortran
au BufNewFile,BufRead *.template.c set ft=c
au BufNewFile,BufRead *.glsl set ft=c
au BufNewFile,BufRead *.pxi set ft=pyrex

map ,h <Esc>:nohl<CR>
autocmd FileType python set omnifunc=pythoncomplete#Complete
"au FileType python source $HOME/.vim/syntax/python.vim
set ignorecase

let g:miniBufExplorerMoreThanOne = 0
let g:miniBufExplUseSingleClick = 1
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplVSplit = 25
let g:miniBufExplSplitBelow=1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1 

map <c-w><c-t> :WMToggle<cr>

map <leader>tn :tabnew %<cr>
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove 

set nodigraph

vmap gl :<C-U>!/opt/subversion/bin/svn blame <C-R>=expand("%:p") <CR> \| sed -n <C-R>=line("'<") <CR>,<C-R>=line("'>") <CR>p <CR>
let VCSCommandSVNExec="/opt/subversion/bin/svn"

map <leader>ds :r~/Development/yt/trunk/doc/docstring_example.txt<cr>

map <leader>ss :ScreenSend<cr>
set autoindent
map <leader>oc :w !xclip<cr>
map <leader>op :r!xclip -o<cr>
colorscheme xoria256

" NERD_tree config
let NERDTreeChDirMode=2
let NERDTreeIgnore=['\.vim$', '\~$', '\.pyc$', '\.swp$']
let NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$',  '\~$']
let NERDTreeShowBookmarks=1
map <F3> :NERDTreeToggle<CR>
" Viewport Controls
" ie moving between split panes
map <silent>,h <C-w>h
map <silent>,j <C-w>j
map <silent>,k <C-w>k
map <silent>,l <C-w>l

map <leader>hd :new<cr>:read !hg diff<cr>:set ft=diff buftype=nofile<CR>gg