scriptencoding utf-8 " Use UTF-8 set encoding=utf-8 " Default encoding should always be UTF-8 set nocompatible " Don't emulate vi's limitations set tabstop=3 " Use 3 spaces for tabs set shiftwidth=3 " Use 3 spaces for next line indent set smarttab " Tab next line based on current line set expandtab " Use spaces for tabs set autoindent " Automatically indent next line if indented set smartindent " Indent next line based on current line set linebreak " Display long lines wrapped at word boundary set incsearch " Enable incremental search set ignorecase " Ignore case when searching set infercase " Try to figure out the case when searching set hlsearch " Highlight the search results set ve=block " Visual Edit Blocking set lazyredraw " Enable Lazy Redraw (faster macro execution) set showmode " Show the current mode set showmatch " Show matching brackets set mat=5 " Blink for 5 seconds set wildmenu " Enable wildmenu set wildmode=longest,full " Match the longest and full matches set wildignore=*.o,*~ " Always ignore these files set scrolloff=3 " Show 3 lines of context on vertical scroll set sidescrolloff=2 " Show 2 columns of context on horizontal scroll set whichwrap+=<,>,h,l " Backspace and cursor keys wrap set backspace=2 " Normal backspace behavior set nonumber " Do not display line numbers set textwidth=80 " Break lines at 80 characters set showfulltag " Show full tags when doing completion set hidden " Allow flipping of buffers without saving set magic " Regular expression characters have special meaning set mouse=a " Mouse enabled " MiniBufferExplorer Settings let g:miniBufExplMapWindowNavVim = 1 let g:miniBufExplMapWindowNavArrows = 1 let g:miniBufExplMapCTabSwitchBufs = 1 let g:miniBufExplModSelTarget = 1 "let g:miniBufExplForceSyntaxEnable = 1 if (v:version >= 700) set nospell " Disable spell checking by default set spelllang=en_us " Spelling check language endif set title " Set a title on the terminal set laststatus=2 " Always display the status line set shortmess=atI " Enable short messages (press a key is annoying) set statusline=Editing:\ %r%t%m\ %=Location:\ Line\ %l/%L\ \ Col:\ %c\ (%p%%) set antialias " Antialias font rendering set lsp=0 " Increase spacing (easier to read) " Set a nice bright colorscheme if has("gui") colorscheme inkpot " Set the colorscheme set background=light " We use a light background here else colorscheme zellner " Set the colorscheme set background=dark " We use a dark background here endif if has("syntax") syntax on " Enable syntax highlighting endif if has("folding") set nofoldenable " Require user to fold set fillchars=fold:- " Fold characters should be - " If window is greater than 90 characters, set a column for folds if has("eval") fun! WideFold() if winwidth(0) > 90 setlocal foldcolumn=1 else setlocal foldcolumn=0 endif endfun if has("autocmd") autocmd BufEnter * :call WideFold() endif endif endif if has("eval") filetype on " Detect filetype by extension filetype indent on " Enable indents based on extensions filetype plugin on " Load filetype plugins endif " Try to get more fancy % matching if has("eval") runtime! macros/matchit.vim endif " Enable modelines only on secure vim if (v:version == 603 && has("patch045")) || (v:version > 603) set modeline else set nomodeline endif " Turn off search hilite when idle if has("autocmd") autocmd CursorHold * nohls | redraw endif " Always refresh syntax from the start if has("autocmd") autocmd BufEnter * syntax sync fromstart endif " Mutt does not like UTF-8 :-( if has("autocmd") autocmd BufRead,BufNewFile * \ if &ft == 'mail' | \ set fileencoding=iso8859-1 | \ endif endif " subversion commit messages need not be backed up if has("autocmd") autocmd BufRead svn-commit.tmp :setlocal nobackup endif " Detect procmail rules if has("autocmd") autocmd BufRead procmailrc :setfiletype procmail endif " Disable case insensitivity for source files if has("autocmd") autocmd BufEnter * \ if &filetype == 'c' || \ &filetype == 'cs' || \ &filetype == 'cpp' || \ &filetype == 'java' | \ set noignorecase noinfercase | \ endif endif " Show trailing whitespace visually " Shamelessly stolen from Ciaran McCreesh if (&termencoding == "utf-8") || has("gui_running") if v:version >= 700 set list listchars=tab:»·,trail:·,extends:…,nbsp:‗ else set list listchars=tab:»·,trail:·,extends:… endif else if v:version >= 700 set list listchars=tab:>-,trail:.,extends:>,nbsp:_ else set list listchars=tab:>-,trail:.,extends:> endif endif " Get rid of the annoying UI if has("gui") set guioptions-=t " Disable Menu tear-offs set guioptions-=T " Disable the tool-bar set guioptions-=m " Disable the menu set guioptions-=l set guioptions-=L set guioptions-=r " Disable the scrollbar set guioptions-=R endif " Link the imports in JAVA sources " messes up minibufexplorer's coloring => commented out (i don't do much java " anyway if has("autocmd") autocmd BufRead *.java set include=^#\s*import autocmd BufRead *.java set includeexpr=substitute(v:fname,'\\.','/','g') endif " ---- Content Generation ---- if has("autocmd") augroup content autocmd BufNewFile configure.{ac,in} \ 0put = 'dnl Process this file with autoconf to produce a configure script' | \ $put = '' | \ call setline(line('$'), 'AC_INIT(['. substitute(expand('%:p:h'), \ '^.\{-}/\([^/]\+\)\(/trunk\)\?$', '\1', '') . '], [0.0])') | \ $put = 'AC_PREREQ([2.5])' | \ $put = '' | \ $put = 'AC_CANONICAL_BUILD' | \ $put = 'AC_CANONICAL_HOST' | \ $put = 'AC_CANONICAL_TARGET' | \ $put = '' | \ $put = 'AC_CONFIG_HEADERS([config.h])' | \ $put = 'AC_CONFIG_SRCDIR([Makefile.am])' | \ $put = '' | \ $put = 'AM_INIT_AUTOMAKE([1.9])' | \ $put = '' | \ $put = 'dnl check for required programs' | \ $put = 'AC_PROG_INSTALL' | \ $put = 'AC_PROG_LN_S' | \ $put = 'AC_PROG_MAKE_SET' | \ $put = '' | \ $put = '' | \ $put = '' | \ $put = 'dnl Output' | \ $put = 'AC_OUTPUT([' | \ $put = ' Makefile' | \ $put = ' src/Makefile' | \ $put = '])' | \ $put = 'dnl vim: set sw=8 sts=8 noet :' | \ set sw=8 sts=8 noet | \ norm gg19jf] autocmd BufNewFile *.py \ 0put = '#!/usr/bin/env python' | \ 1put = '#-*- coding: utf-8 -*-' | \ $put = '' | \ $put = '' | \ $put = '# vim: set sw=3 tw=80 :' | \ norm ggjjjf] autocmd BufNewFile Makefile \ 0put = 'SOURCES = $(wildcard *.cxx)' | \ $put = 'OBJECTS = $(SOURCES:.cxx=.o)' | \ $put = '' | \ $put = 'EXENAME = a.out' | \ $put = '' | \ $put = 'DEFINES = -DDEBUG' | \ $put = 'INCLUDES = -I/usr/include' | \ $put = 'LIBRARIES =' | \ $put = '' | \ $put = 'CXX = g++' | \ $put = 'LDFLAGS = -Wl,-O1, -Wl,--as-needed' | \ $put = 'CXXFLAGS = -g -Wall -Werror -Wno-non-template-friend -ffast-math' | \ $put = '' | \ $put = 'CSCOPE = cscope' | \ $put = '' | \ $put = 'all: $(EXENAME)' | \ $put = '$(EXENAME): $(OBJECTS)' | \ $put = ' $(CXX) $(CXXFLAGS) $(LDFLAGS) $(DEFINES) $(INCLUDES) $(OBJECTS) $(LIBRARIES) -o $@' | \ $put = '' | \ $put = 'tags:' | \ $put = ' $(CSCOPE) -b' | \ $put = '' | \ $put = 'clean:' | \ $put = ' -rm -f *.o' | \ $put = ' -rm -f $(EXENAME)' | \ $put = ' -rm -f Makefile.dep' | \ $put = '' | \ $put = 'Makefile.dep:' | \ $put = ' $(CXX) -M $(CXXFLAGS) $(SOURCES) > Makefile.dep' | \ $put = '' | \ $put = '.SUFFIXES: .o .cxx' | \ $put = '' | \ $put = '.cxx.o:' | \ $put = ' $(CXX) $(CXXFLAGS) $(DEFINES) -c $<' | \ $put = '' | \ $put = '-include Makefile.dep' | \ norm ggjjjwwwf] augroup END endif " ---- cscope setup ---- if has('cscope') && filereadable("/usr/bin/cscope") " Search cscope and ctags, in that order set cscopetag set cscopetagorder=0 set nocsverb if filereadable("cscope.out") cs add cscope.out endif set csverb endif " ---- Key Bindings ---- " Common building commands if has("autocmd") autocmd FileType c,cpp nmap :silent set makeprg=make:w:make autocmd FileType c,cpp imap :silent set makeprg=make:w:make autocmd FileType java nmap :silent set makeprg=ant:w:make autocmd FileType java imap :silent set makeprg=ant:w:make autocmd FileType cs nmap :silent set makeprg=nant:w:make autocmd FileType cs imap :silent set makeprg=nant:w:make autocmd FileType tex nmap :silent set makeprg=latex:w:make % autocmd FileType tex imap :silent set makeprg=latex:w:make % autocmd FileType tex nmap :silent set makeprg=pdflatex:w:make % autocmd FileType tex imap :silent set makeprg=pdflatex:w:make % endif " Map to reformat the current line if has("autocmd") autocmd FileType c,cs,cpp,java nmap =0 endif " Page using space noremap " Default annoying shift maps inoremap gk noremap gk inoremap gj noremap gj " Unhighlight on insert mode entry " The next line breaks NiniBufExplorer for some reason... disabled ~quad341 "noremap i :nohlsi " Map F3 to nohls nmap :silent nohls imap :silent nohls " Map F12 to numbering nmap :silent set number! imap :silent set number! " Spell check can be annoying at times nmap :silent set spell! imap :silent set spell! " Don't force Column 0 for # inoremap # X# " jj, oh you want to get out of edit mode inoremap jj " tab indents vmap >gv " shift-tab un-indents vmap