autocmd! filetype on syntax on " SETTINGS set autoindent set autoindent set nobackup set background=dark set clipboard=autoselect set nocompatible set complete=.,b,u,w,t,i,d " buffers used for lookup in autocompletion set cinoptions=>3,e0,n0,}0,^0,:2,=3,p3,t0,(3,)30,*40,+3,f0,{0,c3,u3 set cinkeys=0{,0},!^F,o,O,e,*,0# set comments=s1:/*,mb:*,el:*/,://,b:#,:%,:XCOMM,nb:>,fb:- " set dictionary=/usr/share/dict/words set noerrorbells " set equalprg="indent" set esckeys set noexpandtab set fileformat=unix set formatoptions=cqrtl set helpheight=0 set hidden set highlight=8r,db,es,hs,mb,Mr,nu,rs,sr,tb,vr,ws set history=100 set nohlsearch set ignorecase set incsearch set iskeyword=@,48-57,_,192-255,-,.,@-@ set nojoinspaces set keywordprg=dict set laststatus=2 set lazyredraw set magic set modeline set modelines=4 set more set mouse=a set number set pastetoggle= set path=".,expand("~")" set report=0 set norestorescreen set t_ti= t_te= set ruler set scrolloff=0 set shell=/bin/bash set shiftwidth=4 set showbreak="+ " set noshowcmd set showmatch set showmode set softtabstop=4 set smartcase set smartindent set smarttab set nostartofline " suffixes: Ignore filename with any of these suffixes when using the ":edit" command. set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc set tabstop=8 set tildeop set textwidth=76 set title set ttyfast set undolevels=1000 " undoing 1000 changes should be enough :-) set updatecount=100 " write swap file to disk after each 100 characters set updatetime=6000 " write swap file to disk after 6 inactive seconds set viminfo=%,'20,\"500,:500,n~/.vim/viminfo set visualbell set whichwrap=<,>,b,s,[,] set wildmenu " ABBREVIATIONS source ~/.vim/abbr " MAPPING map :shell " disable the suspend for ^Z. " mistypings... ;-) nmap :W :w nmap :Q :q nmap :wQ :wq nmap :WQ :wq nmap :Wq :wq map Q gq " don't use ex mode, use Q for formatting let vimrc="~/.vimrc" let myabbr="~/.vim/abbr" nn ,vu :source =vimrc nn ,ve :edit =vimrc nn ,vy :edit =myabbr " GENERAL " ;rcm = remove "control-m"s - for those mails sent from DOS: cmap ;rcm %s///g " Sws = show whitespace nmap ,Sws :%s/ /_/g vmap ,Sws :%s/ /_/g " Stws = show trailing whitespace nmap ,Stws :%s/ *$/_/g vmap ,Stws :%s/ *$/_/g " ,cbl = "clear blank (whitespace) lines" map ,cbl :%s/^\s\+$// " ,dbl = "delete blank (whitespace) lines" map ,dbl :g/^\s\+$/d " ,cqel = "clear quoted blank lines" nmap ,cqel :%s/^[>]\+$// vmap ,cqel :s/^[> ]\+$// " ,ksr = "kill space runs" nmap ,ksr :%s/ \+/ /g vmap ,ksr :s/ \+/ /g " ,Sel = "squeeze empty lines" map ,Sel :g/^$/,/./-j " ,Sbl = "squeeze blank lines" map ,Sbl :g/^\s*$/,/\S/-j " " Editing of email replies and Usenet followups - using autocommands " " Part 3 - Change Quoting Level map ,dp vip:s/^> // vmap ,dp :s/^> // " " ,qp = "quote current inner paragraph" map ,qp vip:s/^/> / " ,qp = "quote current paragraph" vmap ,qp :s/^/> / " ,kpq = "kill power quote" vmap ,kpq :s/^> *[a-zA-Z]*>/> >/ " ,fq "fix quoting" vmap ,fq :s/^> \([-":}\|][ ]\)/> > / " " Part 5 - Reformatting Text " " Formatting the current paragraph according to " the current 'textwidth' with ^J (control-j): imap gqap map gqap " ,j = join line in commented text (can be used anywhere on the line) nmap ,j Vjgq " Editing your reply " " Put parentheses around "visual text" " " ,) and ,( : vmap ,( v``>a) vmap ,) v``>a) vmap ," c""" " " remove signatures " " ,kqs = kill quoted sig unto start of own signature: map ,kqs G?^> *-- $d/^-- $/ " " Indent a C file. nmap ,ci :w:!indent %:e! nmap ,cci :w:!astyle --style=ansi %:e! " WEB " This has become quite big - so I moved it out to another file: if filereadable(expand("~/.vim/web")) source . ~/.vim/web endif " Useful stuff. :-) " ,E = execute line map ,E 0/\$w"yy$:yr! " ,dr = decode/encode rot13 text vmap ,dr :!tr A-Za-z N-ZA-Mn-za-m " Mapping of special keys - arrow keys and function keys. " =================================================================== " Buffer commands (split,move,delete) - " this makes a little more easy to deal with buffers. map :split map :bp map :bn map :bd " is bound to `complete' " inoremap  " cycle fast thru buffers ... nnoremap :bn nnoremap :bp " cycle fast thru errors ... map :cn map :cp fun AllIndent() let oldLine=line('.') normal(gg=G) execute ':' . oldLine endfun map -- :call AllIndent() " AutoCommands so $VIMRUNTIME/syntax/syntax.vim augroup cprog au! " autocmd BufRead * set formatoptions=trcql autoindent nocindent comments& autocmd FileType c,cpp set noautoindent cindent formatoptions=croql shiftwidth=2 softtabstop=2 textwidth=78 wrapmargin=3 autocmd FileType c,cpp hi PreProc ctermfg=lightgrey augroup END augroup web au! autocmd FileType html,php3,php4,php set nocindent autoindent sw=2 ts=4 noexpandtab autocmd FileType html,php3,php4,php source ~/.vim/abbr.web augroup END augroup mail au! au BufNewFile,BufRead .letter,mutt*,nn.*,snd.* set tw=72 augroup END iab _PATHFILE =expand("%:p") iab _FILE =expand("%:t:r") iab _PATH =expand("%:h") " this means vim will always jump to the last edited line in a file if possible autocmd BufEnter *,.* :normal '" if filereadable(expand("~/.vim/wordlist")) source ~/.vim/wordlist endif source ~/.vim/bufexplorer " source ~/.vim/word_complete " source ~/.vim/my_syntax "vim:tw=78 et sw=2 comments=\:\"