" An example for a vimrc file. " " Maintainer: Bram Moolenaar " Last change: 2002 May 28 " " To use it, copy it to " for Unix and OS/2: ~/.vimrc " for Amiga: s:.vimrc " for MS-DOS and Win32: $VIM\_vimrc " for OpenVMS: sys$login:.vimrc " When started as "evim", evim.vim will already have done these settings. if v:progname =~? "evim" finish endif " Use Vim settings, rather then Vi settings (much better!). " This must be first, because it changes other options as a side effect. set nocompatible " allow backspacing over everything in insert mode set backspace=indent,eol,start set autoindent " always set autoindenting on set history=50 " keep 50 lines of command line history set ruler " show the cursor position all the time set showcmd " display incomplete commands set incsearch " do incremental searching set background=dark set showmatch set smartcase set hidden " don't tell me to save a buffer before when I " want to move out of it. set printexpr=PrintFile(v:fname_in) function PrintFile(fname) call system("lp " . a:fname) call delete(a:fname) return v:shell_error endfunc let g:showmarks_enable=0 " Disable showmarks by default - toggle with F4. " Don't use Ex mode, use Q for formatting map Q gq " This is an alternative that also works in block mode, but the deleted " text is lost and it only works for putting the current register. "vnoremap p "_dp " Switch syntax highlighting on, when the terminal has colors " Also switch on highlighting the last used search pattern. if &t_Co > 2 || has("gui_running") syntax on set hlsearch set tabstop=4 endif if $t_Co > 2 set background dark colors darkblue endif if has("gui_running") colorscheme biogoo set guifont=Lucida\ Console\ Semi-Condensed\ 7.5 set guioptions-=T endif map #2 :s/\([A-Z]\)\([A-Z][A-Z]*\)/\1\L\2/g map #3 :Tlist map #4 :ShowMarksToggle map ,,t :. rubydo $_.gsub!(/(\d+\.\d+)/) { sprintf("%.*f", 2, $1.to_f) } map ,,td :rubydo $_.gsub!(/(\d+\.\d+)/) { sprintf("%.*f", 2, $1.to_f) } "-------------------------------------------------- " map #6 :% call Truncate()i " map ,,t :. call Truncate()i " " function! Truncate () " let s:range = (a:firstline) . "," . (a:lastline) " :execute (s:range) . 'rubydo $_.gsub!(/(\d+\.\d+)/) { sprintf("%.*f", 2, $1.to_f) }' " let s:range = "" " endfunction " "-------------------------------------------------- map #5 :execute MatSkell() " Create a skeleton m file using the function prototype that is the current " line. function MatSkell() let s:line = getline(".") let s:output = system("matlabSkell.rb \'" . s:line . "\'") :execute ":e " . s:output endfunction " make return clean the current search hilight. :nnoremap :noh "Spelling - you need vimspell for this. set infercase let spell_auto_type="none" if has("autocmd") " Enable file type detection. " Use the default filetype settings, so that mail gets 'tw' set to 72, " 'cindent' is on in C files, etc. " Also load indent files, to automatically do language-dependent " indenting. filetype plugin indent on " Filetype overrides. "see header files as 'c' header, instead of cpp. au BufRead,BufNewFile *.h set filetype=c "and make sure html files shiftwdith is 2. autocmd FileType *html setlocal shiftwidth=2 autocmd FileType *xml setlocal shiftwidth=2 autocmd FileType matlab setlocal shiftwidth=4 au! BufRead,BufNewFile *.otl setfiletype vo_base au! BufRead,BufNewFile *.oln setfiletype xoutliner " 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 runtime scripts/set_utf8.vim endif " has("autocmd")