" Hihihi: " a1 0qay$$pbalbq9998@a " Configuration file for gvim " Written for Debian GNU/Linux by W. Akkerman " Some modifications by J.H.M. Dassen " More modifications by N.C. Maatjes " " Installed plug-ins to Vim 7.3 (huge): " - snipMate " - added $VIM/vim73/after to runtimepath " - Rainbow Parenthsis " - removed ctermbg=LightGray from $VIM/vim73/autoload/rainbow_parenthsis.vim " - changed ctermfg=black to white " - SparkUp " - added leader to key binding in ftplugin/html/sparkup.vim " - Surround " - Repeat " - Project " - Matchit (copied from $VIM/vim73/macros) " " Reload help tags (as root) with: :helptags $VIM/doc " " Changes in Vim files themselves are in: " - $VIM/vim73/indent/php.vim: " - same comments (setlocal) as here " - $VIM/vim73/ftplugin/perl.vim: " - no override for comments (setlocal) " VIM SETTINGS set nocompatible set autoindent if has('gui') set background=light else set background=dark endif set backspace=indent,eol,start if has('win32') || has('win64') "Make sure GVim doesn't mess with hard links under Windows set backupcopy=yes endif set comments=s1:/*,mb:*,ex:*/,://,b:#,n:>,fb:- set completeopt=longest,menuone,preview set cpoptions=aABeEfFPs set cursorline set diffopt=iwhite,filler,vertical set expandtab set encoding=utf-8 set fileencodings=utf-8,default,latin1 " Add e.g. koi8-r to read as koi8-r first set formatoptions=tcroqnl1 set foldcolumn=1 set gdefault if has('gui') set guifont=DejaVu_Sans_Mono:h11:b:cANSI endif set history=500 set ignorecase set indentexpr= set laststatus=2 set list set listchars=tab:»·,trail:· set matchpairs=(:),{:},[:],<:> set mouse=a set nobackup set nocindent set nohlsearch set noincsearch set number set ruler set runtimepath+=$VIM/vim73/after set scrolloff=3 set shiftwidth=4 set showcmd set showmatch set showmode set smartcase set smartindent set softtabstop=4 set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc,.class set tabstop=4 set tags+=dev/tags; set textwidth=0 if has('unix') set viewdir=~/.vim/view else set viewdir=~/vimfiles/view end set visualbell set whichwrap=b,s,h,l,<,>,~,[,] " PLUG-IN SETTINGS " Disable weird parentheses highlighting let loaded_matchparen = 1 " Nicer options for Project plug-in let g:proj_flags="imstvcg" " Set snipMate author let g:snips_author = 'Nieko Maatjes' " LAYOUT FIXES " Different settings for diff " If you do :all in vimdiff it changes orientation if !&diff all windo set foldmethod=indent endif " (REDEFINED) SHORTCUTS " :help Y noremap Y y$ " Don't use Ex mode, use Q for formatting noremap Q gq " Make sure you can undo ^u and ^w inoremap u inoremap u " Don't stop visual mode after indenting vnoremap < >gv if has('gui') " Switch through tabs like in Windows nmap gt nmap gT nmap :tabnew nmap :tabclose endif " Move around in tabs and maximize them (escape |) map j_\| map k_\| map l_\| map h_\| " Typos, typos :) nnoremap inoremap vnoremap cnoremap W w cnoremap WQ wq cnoremap wQ wq cnoremap Q q cnoremap Tabe tabe cnoremap %S %s " Inverse paste mode nnoremap :set invpaste:set paste? " Inverse highlight nnoremap :set invhls:set hls? " Save as HTML nnoremap :let html_use_css=1:let use_xhtml=1:TOhtml " Toggle numbers/foldcolumn for easier c/p nnoremap :set invnu:let &foldcolumn=1-&foldcolumn:set invnu? " Fold to 1 level and back nnoremap :if &foldlevel==1 && exists("foldlevel")let &foldlevel=foldlevelelselet foldlevel=&foldlevellet &foldlevel=1endif " Fold less or more nnoremap zm:set foldlevel? nnoremap zr:set foldlevel? " SYNTAX HIGHLIGHTING " Always show syntax syntax on " Slower, but more reliable syntax sync fromstart " STATUS INFO " Show more in statusline if has("statusline") set statusline=%<%f\ %h%m%r%=%{\"[\".(&fenc==\"\"?&enc:&fenc).\"\,\"}%{\"\ \".&ff}%{(&eol==0?\",noeol\":\"\").\"]\ \"}%y%k\ %-14.(%l,%c%V%)\ %P endif " FILE TYPES " Reset filetypes filetype off filetype plugin indent on if has('unix') " Without this, crontab -e doesn't work autocmd FileType crontab :set backupcopy=yes endif " Function completion and auto indent on Perl/PHP/JavaScript files autocmd FileType c set omnifunc=ccomplete#Complete |set foldmethod=indent|set foldnestmax=12|set shiftwidth=4|set softtabstop=4|set tabstop=4 autocmd FileType css set omnifunc=csscomplete#CompleteCSS |set foldmethod=indent|set foldnestmax=12|set shiftwidth=4|set softtabstop=4|set tabstop=4 autocmd FileType html set omnifunc=htmlcomplete#CompleteTags |set foldmethod=indent|set foldnestmax=12|set shiftwidth=4|set softtabstop=4|set tabstop=4 autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS |set foldmethod=indent|set foldnestmax=12|set shiftwidth=4|set softtabstop=4|set tabstop=4 autocmd FileType perl set foldmethod=indent|set foldnestmax=12|set shiftwidth=4|set softtabstop=4|set tabstop=4 autocmd FileType php set omnifunc=phpcomplete#CompletePHP |set foldmethod=indent|set foldnestmax=12|set shiftwidth=4|set softtabstop=4|set tabstop=4 autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags |set foldmethod=indent|set foldnestmax=12|set shiftwidth=4|set softtabstop=4|set tabstop=4 if has('unix') " Show where the PHP/Perl errors are when running `make` autocmd FileType php set makeprg=php\ -l\ % autocmd FileType php set errorformat=%m\ in\ %f\ on\ line\ %l autocmd FileType perl set makeprg=$VIM/vim73/tools/efm_perl.pl\ %\ $* autocmd FileType perl set errorformat=%f:%l:%m endif " Show nicely colored parentheses autocmd FileType c call rainbow_parenthsis#LoadSquare () autocmd FileType c call rainbow_parenthsis#LoadBraces () autocmd FileType c call rainbow_parenthsis#LoadChevrons () autocmd FileType c call rainbow_parenthsis#LoadRound () autocmd FileType c call rainbow_parenthsis#Activate () autocmd FileType javascript call rainbow_parenthsis#LoadSquare () autocmd FileType javascript call rainbow_parenthsis#LoadBraces () autocmd FileType javascript call rainbow_parenthsis#LoadChevrons () autocmd FileType javascript call rainbow_parenthsis#LoadRound () autocmd FileType javascript call rainbow_parenthsis#Activate () autocmd FileType perl call rainbow_parenthsis#LoadSquare () autocmd FileType perl call rainbow_parenthsis#LoadBraces () autocmd FileType perl call rainbow_parenthsis#LoadChevrons () autocmd FileType perl call rainbow_parenthsis#LoadRound () autocmd FileType perl call rainbow_parenthsis#Activate () " MISCELLANEOUS " Automatic loading of views (mkview, loadview) autocmd BufWinLeave ?* silent! mkview autocmd BufWinEnter ?* silent! loadview " Automatically split when following a tag fun! SPLITTAG() range let oldfile=expand("%:p") "if &modified split "endif exe "tag ". expand("") let curfile=expand("%:p") if curfile == oldfile let pos=getpos(".") if &modified " if we have split before: quit endif call setpos('.', pos) endif endfun nmap :call SPLITTAG()z. if has('win32') || has('win64') " Fix diff under Windows set diffexpr=MyDiff() function MyDiff() let opt = '' if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif silent execute '!"$VIM\vim73\diff" -a ' . opt . v:fname_in . ' ' . v:fname_new . ' > ' . v:fname_out endfunction endif " Transparent editing of gpg encrypted files. " By Wouter Hanegraaff augroup encrypted au! " We don't want a swap file, as it writes unencrypted data to disk autocmd BufReadPre,FileReadPre *.gpg set noswapfile " Switch to binary mode to read the encrypted file autocmd BufReadPre,FileReadPre *.gpg set bin autocmd BufReadPre,FileReadPre *.gpg let ch_save = &ch|set ch=1 autocmd BufReadPre,FileReadPre *.gpg let shsave=&sh autocmd BufReadPre,FileReadPre *.gpg let &sh='sh' autocmd BufReadPre,FileReadPre *.gpg let ch_save = &ch|set ch=1 autocmd BufReadPost,FileReadPost *.gpg '[,']!gpg --decrypt --default-recipient-self 2> /dev/null autocmd BufReadPost,FileReadPost *.gpg let &sh=shsave " Switch to normal mode for editing autocmd BufReadPost,FileReadPost *.gpg set nobin autocmd BufReadPost,FileReadPost *.gpg let &ch = ch_save|unlet ch_save autocmd BufReadPost,FileReadPost *.gpg execute ":doautocmd BufReadPost " . expand("%:r") " Convert all text to encrypted text before writing autocmd BufWritePre,FileWritePre *.gpg mkview autocmd BufWritePre,FileWritePre *.gpg set bin autocmd BufWritePre,FileWritePre *.gpg let shsave=&sh autocmd BufWritePre,FileWritePre *.gpg let &sh='sh' autocmd BufWritePre,FileWritePre *.gpg '[,']!gpg --encrypt --default-recipient-self 2>/dev/null autocmd BufWritePre,FileWritePre *.gpg let &sh=shsave " Undo the encryption so we are back in the normal text, directly " after the file has been written. autocmd BufWritePost,FileWritePost *.gpg silent u autocmd BufWritePost,FileWritePost *.gpg set nobin augroup END