samer@3: " An example for a vimrc file. samer@3: " samer@3: " Maintainer: Bram Moolenaar samer@3: " Last change: 2001 Jul 18 samer@3: " samer@3: " To use it, copy it to samer@3: " for Unix and OS/2: ~/.vimrc samer@3: " for Amiga: s:.vimrc samer@3: " for MS-DOS and Win32: $VIM\_vimrc samer@3: " for OpenVMS: sys$login:.vimrc samer@3: samer@3: " samer: samer@3: set showmatch " show matching brackets samer@3: set ignorecase " case insensitive search... samer@3: set smartcase " ...except if string includes upper-case samer@3: samer@3: " When started as "evim", evim.vim will already have done these settings. samer@3: if v:progname =~? "evim" samer@3: finish samer@3: endif samer@3: samer@3: " Use Vim settings, rather then Vi settings (much better!). samer@3: " This must be first, because it changes other options as a side effect. samer@3: set nocompatible samer@3: samer@3: " allow backspacing over everything in insert mode samer@3: set backspace=indent,eol,start samer@3: samer@3: set autoindent " always set autoindenting on samer@3: if has("vms") samer@3: set nobackup " do not keep a backup file, use versions instead samer@3: else samer@3: set backup " keep a backup file samer@3: endif samer@3: set history=50 " keep 50 lines of command line history samer@3: set ruler " show the cursor position all the time samer@3: set showcmd " display incomplete commands samer@3: " set incsearch " do incremental searching samer@3: samer@3: " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries samer@3: " let &guioptions = substitute(&guioptions, "t", "", "g") samer@3: samer@3: " Don't use Ex mode, use Q for formatting samer@3: map Q gq samer@3: samer@3: " Make p in Visual mode replace the selected text with the "" register. samer@3: vnoremap p :let current_reg = @"gvs=current_reg samer@3: samer@3: " This is an alternative that also works in block mode, but the deleted samer@3: " text is lost and it only works for putting the current register. samer@3: "vnoremap p "_dp samer@3: samer@3: " Switch syntax highlighting on, when the terminal has colors samer@3: " Also switch on highlighting the last used search pattern. samer@3: " if &t_Co > 2 || has("gui_running") samer@3: syntax on samer@3: set hlsearch samer@3: " endif samer@3: samer@3: " Only do this part when compiled with support for autocommands. samer@3: if has("autocmd") samer@3: samer@3: " Enable file type detection. samer@3: " Use the default filetype settings, so that mail gets 'tw' set to 72, samer@3: " 'cindent' is on in C files, etc. samer@3: " Also load indent files, to automatically do language-dependent indenting. samer@3: filetype plugin indent on samer@3: samer@3: " For all text files set 'textwidth' to 78 characters. samer@3: autocmd FileType text setlocal textwidth=78 samer@3: autocmd FileType python setlocal tabstop=4|set shiftwidth=4|set expandtab samer@3: autocmd FileType cs setlocal tabstop=4|set shiftwidth=4|set expandtab samer@3: autocmd FileType scheme setlocal expandtab|set tabstop=2 samer@3: autocmd FileType ocaml setlocal tabstop=2|set shiftwidth=2|set expandtab samer@3: autocmd FileType haskell setlocal tabstop=2|set shiftwidth=2|set expandtab samer@3: autocmd FileType prolog setlocal tabstop=3|set shiftwidth=3|set expandtab samer@3: autocmd Syntax ocaml set commentstring=(*%s*) samer@3: autocmd Syntax scheme set commentstring=;%s samer@3: autocmd FileType matlab setlocal tabstop=2|set shiftwidth=2 samer@3: samer@3: " When editing a file, always jump to the last known cursor position. samer@3: " Don't do it when the position is invalid or when inside an event handler samer@3: " (happens when dropping a file on gvim). samer@3: autocmd BufReadPost * samer@3: \ if line("'\"") > 0 && line("'\"") <= line("$") | samer@3: \ exe "normal g`\"" | samer@3: \ endif samer@3: samer@3: endif " has("autocmd") samer@3: samer@3: " Original vimrc from Mac OS X bundle samer@3: " System vimrc file for Mac OS X samer@3: " Author: Benji Fisher samer@3: " Last modified: 5 April 2003 samer@3: samer@3: " Get a good value for $PATH. For example, if teTeX is installed, this samer@3: " should add the path to tex, pdflatex, etc. samer@3: " This should only make a difference when vim is started from the Finder or samer@3: " with open. samer@3: let $PATH = system("printenv PATH") samer@3: let $PATH = substitute($PATH, "\$", "", "") samer@3: samer@3: " If running in a Terminal window, set the terminal type to allow syntax samer@3: " highlighting. samer@3: " Otherwise, change directory on startup. samer@3: if !has("gui_running") samer@3: set term=xterm-color samer@3: else samer@3: autocmd VimEnter * if getcwd()=="/" | if strlen(@%) | cd %:p:h | else | cd | endif | endif samer@3: endif samer@3: samer@3: set title samer@3: set mouse=a samer@3: set mousefocus=on samer@3: set tabstop=3 samer@3: set softtabstop=3 samer@3: set shiftwidth=3 samer@3: set smarttab samer@3: " set ignorecase samer@3: samer@3: set nobackup " do not keep a backup file, use versions instead samer@3: " set backup " keep a backup file samer@3: samer@3: " Fix search highlighting colors and customise status bar and vertical split samer@3: hi clear Search samer@3: hi clear StatusLine samer@3: hi clear StatusLineNC samer@3: hi clear VertSplit samer@3: samer@3: hi Search term=underline cterm=underline gui=NONE samer@3: hi StatusLine term=bold,underline cterm=underline,bold gui=bold guifg=blue guibg=white samer@3: hi StatusLineNC term=underline cterm=underline guifg=white guibg=blue samer@3: hi VertSplit term=bold cterm=bold samer@3: hi MatchParen term=underline cterm=bold ctermbg=none gui=underline samer@3: samer@3: au BufWinEnter,BufNewFile,BufRead *.lytex set filetype=tex samer@3: au BufWinEnter,BufNewFile,BufRead *.icl set filetype=prolog samer@3: au BufWinEnter,BufNewFile,BufRead *.pha set filetype=prolog samer@3: au BufWinEnter,BufNewFile,BufRead *.psm set filetype=prolog samer@3: au BufWinEnter,BufNewFile,BufRead *.chr set filetype=prolog samer@3: au BufWinEnter,BufNewFile,BufRead *.yap set filetype=prolog samer@3: au BufWinEnter,BufNewFile,BufRead *.chrism set filetype=prolog samer@3: au BufWinEnter,BufNewFile,BufRead *.curry set filetype=haskell samer@3: au BufWinEnter,BufNewFile,BufRead *.kern set filetype=humdrum samer@3: au BufWinEnter,BufNewFile,BufRead *.krn set filetype=humdrum samer@3: au BufWinEnter,BufNewFile,BufRead *.church set filetype=scheme samer@3: au BufWinEnter,BufNewFile,BufRead .ocamlinit set filetype=ocaml samer@3: samer@3: " for vim-latex samer@3: set grepprg=grep\ -nH\ $* samer@3: set wildmenu samer@3: let g:Tex_AutoFolding=0 samer@3: let g:tex_flavor='latex' samer@3: let mapleader="\\" samer@3: samer@3: " for pasting code samer@3: set pastetoggle= samer@3: samer@3: cmap w!! w !sudo tee % >/dev/null:e! samer@3: " activate visual mode in normal mode samer@3: nmap V samer@3: nmap V samer@3: " " these are mapped in visual mode samer@3: vmap k samer@3: vmap j