" " .vimrc " (tested with vim 6.3, 6.4, 7.0) " " Florian Fankhauser " florian@web-expires2009.flof.at " http://www.flof.at/ " " last update " Tue May 6 11:07:31 CEST 2008 " " " PLEASE NOTE: " Before you try out and use this file have a " look at the scripts in here, understand what " they are doing and decide on your own if they " fit your needs. " " HINT: " you can divide your .vimrc in multiple files " and then source these files in your .vimrc via " source $filename " " vi is cool, vim is better :-) set nocompatible " set language " language en " allow colors let color = "true" if has("syntax") if color == "true" " This will switch colors ON so $VIMRUNTIME/syntax/syntax.vim else " this switches colors OFF syntax off set t_Co=0 endif endif " for prettier html syntax highlighting... let html_no_rendering = 1 " obvious... " when pasting lines into vim this is annoying. " solution: :set paste " and afterwards: :set nopaste set autoindent " smart autoindenting, see :he 'smartindent' set smartindent " get more information with :help bs " (the following lines are from that help file) " indent allow backspacing over autondent " eol allow backspacing over line breaks (join lines) " start allow backspacing over the start of insert... set backspace=indent,eol,start " incremental search set incsearch " when searching, do not highlight search results set nohls " expand tab with spaces " unset within vim: " :set noexpandtab set expandtab " when editing Makefiles tabs must not be expanded to spaces autocmd BufRead,BufNewFile Makefile set noexpandtab " set tabulator width set tabstop=4 " set width for < and > set shiftwidth=4 " set formatting options for entering comments " r - insert comment leader in a comment when a new line is inserted " o - insert comment leader in a comment when a new line is created using O/o set formatoptions=ro " MAPPING " n -- normal mode mapping " noremap -- no remap " more info: :help map-modes " " the following mapping is from " Pete Goodliffe - http://www.vim.org/tips/tip.php?tip_id=724 " mapping underlines text in the current line nnoremap yyp^v$r-o " rot13 some text nnoremap ggg?G " renew syntax highlighting nnoremap :if exists("syntax_on") syntax off else syntax on endif " abbreviations ab yhtmldt ab yhtmlct ab yhtmlss " the following idea is from http://www.vim.org/tips/tip.php?tip_id=97 iab ydate =strftime("%c") " or, with some more text (e.g. author's name NAME) "iab ydate edited by NAME, =strftime("%c") " dictionary file --> type beginning of word, then - - and word " will be completed. words are listed in dictionary file, one word - one line "set dictionary=~/.vim/dictionary.txt " display cursor position set ruler " matching brackets set showmatch " show the mode (e.g. insert) set showmode " don't create backup files set nobackup " from the vimrc example file by bram moolenaar if has("autocmd") " 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 endif " has("autocmd") " switch off modelines " see: http://vimdoc.sourceforge.net/htmldoc/options.html#'modelines' " see: http://vimdoc.sourceforge.net/htmldoc/options.html#modeline set modelines=0 " word keyword completion " " see :he complete and :he completion " this specifies the order in which " different sources are searched for " a keyword set complete=.,w,k,b,u,t,i " . current buffer, w buffers from other windows, k dictionary file specified by " 'set dictionary', b other loaded buffers in buffer list, u unloaded buffers " in buffer list, t tag completion, i current and included files " nicer completion in vim7, see also http://www.vim.org/tips/tip.php?tip_id=1386 set completeopt=longest,menuone inoremap pumvisible() ? "\" : "\u\" " filename completion on command line set wildmode=longest,list " http://vimdoc.sourceforge.net/htmldoc/options.html#'linebreak' " If on Vim will wrap long lines at a character in 'breakat' rather " than at the last character that fits on the screen. Unlike " 'wrapmargin' and 'textwidth', this does not insert s in the file, " it only affects the way the file is displayed, not its contents. set linebreak "set showbreak=+ " within vim help files remap to to follow a link " from #vim on freenode.org, Wed 29 Jun 2005 12:35:42 AM CEST autocmd FileType help nmap " filetype plugins " see :he filetype-plugin-on " see :he filetype-overview " see :he filetype-plugin " see :he filetype-plugins filetype plugin on " quote from :he filetype-plugins: " Disable defining mappings for all filetypes by setting a variable: let no_plugin_maps = 1 " in insert mode map jj to . jj is quicker to type than " to get the to the key. " when there is the need to type a jj in the text, just wait a bit after " typing the first j " imap jj " ~/.vimrc ends here