" Maintainer: Markus Mottl " URL: http://www.ocaml.info/vimrc " I want Vim, not Vi set nocompatible " Don't want to type indention set autoindent " Automatically write buffer before special actions set autowrite " Tabs are evil set expandtab " set ng of text and comments set formatoptions=tn1 " My default format program set formatprg=fmt\ -w\ 80 " Only hide invisible buffers (keeps their editing state) set hidden " Command line history set history=1000 " Highlight matches set hlsearch " set options for autocompletion set noinfercase " assume /g flag on :s substitutions set gdefault " Always want statusline set laststatus=2 " when we do wrap visibly (by calling set wrap) break in " reasonable places set linebreak " Set statusline "set statusline=%<%f\ \ \|\ %o\ %h%m%r%=%-14.(%l,%c%V%)\ %P set statusline=%F%m%r%h%w\ %y\ [pos=%l,%v]\ [len=%L\ (%p%%)] " Don't display macro steps set lazyredraw " Don't move cursor to first line when scrolling set nostartofline " Need to find my generic makefiles set makeprg=make\ -I\ ~/archive/Makefiles " Want mouse support set mouse=a " Want to see cursor position set ruler " Maintain some more context around the cursor set scrolloff=3 set sidescrolloff=3 " indent/outdent to nearest tab stop set shiftround " Not too deep, not too shallow set shiftwidth=2 " Show size of visual selection set showcmd " show matching braces set showmatch " We want fancy tab handling set smarttab " Want better buffer handling in quickfix mode set switchbuf=useopen,usetab,split " Tabs are 2 characters set tabstop=2 " don't wrap words set textwidth=0 " Set the terminal title set title " remember some stuff after quiting vim: marks, registers, searches, buffer list set viminfo='20,<50,s10,h,% " No beeps - don't want to annoy neighbours set visualbell " Expand the command line using tab set wildmenu set wildmode=list:longest,full " Use UTF-8 set encoding=utf-8 set termencoding=utf-8 set fileencoding=utf-8 " Backspacing + deleting and wrapping of lines set backspace=start,eol,indent whichwrap=b,s,l,h,<,>,[,] map dh map  map!  map [3~ map! [3~ " File types :syntax on :filetype plugin indent on " set autoclose pairs for autoclose plugin let g:AutoClosePairs = {'(': ')', '{': '}', '[': ']', '"': '"'} " better syntax highlighting for shell scripts " syntax highlight shell scripts as per POSIX, " not the original Bourne shell which very few use let g:is_posix = 1 " Colors for color xterms if has("terminfo") set t_Co=8 set t_Sf=[3%p1%dm set t_Sb=[4%p1%dm else set t_Co=8 set t_Sf=[3%dm set t_Sb=[4%dm endif colorscheme markus " ex-mode is pretty dumb, remap Q to reformat the current " paragraph nnoremap Q gqip " Function key settings - 'make'-shortcuts map :w map :make map :cp map :cn map :make clean map :clist map :clist! " Turn off match highlighting map :nohlsearch " have toggle spelling mode nmap :setlocal invspell spelllang=en_us " have toggle paste set pastetoggle= " Format a paragraph map gqap " Leave editor quickly (when saved) map :q " , is a way easier leader than \ let maplocalleader = ",," let mapleader = "," " map u to show hg blame for the highlighted lines vnoremap u :!hg blame -fu =expand("%:p") \| sed -n =line("'<") ,=line("'>") p " map arrows to various window and tab movements map :tabnext map :tabprev imap :tabnext imap :tabprev map map imap imap " OCaml stuff let no_ocaml_comments = 1 set makeprg=omake " OMLet let omlet_indent_match = 0 let omlet_indent_function = 0 let omlet_indent_let = 0 " Tab mappings map :tabnew map :tabp map :tabn " Remove GUI-nonsense set guioptions-=T set guioptions-=m set guioptions-=r set guioptions-=R set guioptions-=l set guioptions-=L " Always show the menu, insert longest match set completeopt=menu,longest " Ignore irrelevant suffixes for filename completion set wildignore+=*.a,*.bak,*~,*.swp,*.o,*.info,*.aux,*.dvi,*.bbl,*.blg,*.brf,*.cb,*.ind,*.idx,*.ilg,*.inx,*.out,*.toc,*.cmi,*.cmo,*.cma,*.cmx,*.cmxa,*.omc,*.annot,*.exe,*.bc,*.sums,*.spit,*.spot " Change directories automatically autocmd BufEnter * lcd %:p:h " 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 " Our shell code looks like scheme programmer made up all the names autocmd FileType sh set iskeyword=~,@,48-57,_,192-255,- if filereadable(expand('~/.vimrc_local')) source ~/.vimrc_local endif