"------------------------------------ " " AUTOR: Piotr Ożarowski " WWW: www.ozarowski.pl " " PLIK: .vimrc " WERSJA: 2.2 " MODYFIKACJA: śro 21-06-2006 16:01 " "------------------------------------ set nocompatible " niekompatybilny z VI => włącz bajery VIMa set nobackup " nie trzymaj kopii zapasowych, używaj wersji set backspace=indent,eol,start set viminfo='20,\"50 " read/write a .viminfo file, don't store more than 50 lines of registers 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 browsedir=buffer " To get the File / Open dialog box to default to the current file's directory set pastetoggle= " przełączanie w tryb wklejania (nie będzie automatycznych wcięć, ...) set nonumber " nie wyświetlaj nr linii setlocal number " pierwszy odpalony bufor ma nrki set wildmenu " wyświetlaj linie z menu podczas dopełniania set showmatch " pokaz otwierający nawias gdy wpisze zamykający set so=5 " przewijaj juz na 5 linii przed końcem set statusline=%y[%{&ff}]\ \ ASCII=\%03.3b,HEX=\%02.2B\ %=%m%r%h%w\ %1*%F%*\ %l:%v\ (%p%%) set laststatus=2 " zawsze pokazuj linię statusu set fo=tcrqn " opcje wklejania (jak maja być tworzone wcięcia itp.) set hidden " nie wymagaj zapisu gdy przechodzisz do nowego bufora set tags+=./stl_tags " tip 931 set foldtext=MojFoldText() " tekst po zwinięciu zakładki set foldminlines=3 " minimum 3 linie aby powstał fold "set wildmode=longest:full " dopełniaj jak w BASHu "set cpoptions="A" "set keymodel=startsel,stopsel " zaznaczanie z shiftem let php_sql_query = 1 " podkreślanie składni SQL w PHP let php_htmlInStrings = 1 " podkreślanie składni HTML w PHP let python_highlight_all = 1 if version >= 700 set ofu=syntaxcomplete#Complete " Default to omni completion using the syntax highlighting files set spelllang=pl,en set balloonexpr=BalloonExpr() " tip 1149 set ballooneval endif behave xterm if &t_Co > 2 || has("gui_running") syntax on " kolorowanie składni set hlsearch " zaznaczanie szukanego tekstu colorscheme POX " domyślny schemat kolorów endif if has("gui_running") set foldcolumn=2 " szerokość kolumny z zakładkami set guioptions=abegimrLtT " m.in: włącz poziomy scrollbar set nowrap set cursorline " zaznacz linię z kursorem "set cursorcolumn " zaznacz kolumnę z kursorem else "set ts=4 " jak odpalony w konsoli to znaki tabulacji o polowe mniejsze endif " automatyczne rozpoznawanie typu pliku, ladowanie specyficznego, dla danego typu, pluginu (ftplugin.vim, indent.vim): filetype plugin indent on """"""""""""""""""" AUTO COMMANDS: """"""""""""""""""""""""""""""""""{{{ if has("autocmd") autocmd BufEnter * :lcd %:p:h " cd na katalog, w którym znajduje się aktualny bufor " zaczynaj od ostatniej znanej pozycji kursora: autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | execute "normal g`\"" | endif " autouzupełnianie z plików syntax: autocmd FileType * execute "setlocal complete+="."k$VIMRUNTIME/syntax/".&ft.".vim" autocmd FileType text setlocal textwidth=78 " w plikach tekstowych zawijaj tekst po 78. znakach autocmd BufNewFile,Bufread *.php,*.php3,*.php4,*.php5 set keywordprg="help" "autocmd BufNewFile * startinsert " rozpoczyna w trybie INSERT " zapamiętuj zakładki, itp: "autocmd BufWinLeave *.* mkview "autocmd BufWinEnter *.* silent loadview "autocmd BufReadPost */stl_doc/*.html :silent execute ":!elinks ".expand("%:p") | bdelete " tip 931 autocmd BufNewFile,BufRead muttng-*-\w\+,muttng\w\{6\},ae\d setfiletype mail " MuttNG "autocmd BufRead *.py set foldmethod=indent " UWAGA: FileType pomija modeline, dlatego detekcja po rozszerzeniu else set autoindent " automatyczne wcięcia set mouse=a " myszka w konsoli endif "}}} """"""""""""""""""" KLAWISZOLOGIA: """"""""""""""""""""""""""""""""""{{{ map gb :bnext map gB :bprevious map :!php -l % " sprawdzanie składni PHP nnoremap :Tlist " Tag List map [{V%zf " \\ wewnatrz bloku {} tworzy fold i go zamyka inoremap =InsertTabWrapper("backward") inoremap =InsertTabWrapper("forward") map b GoZ:g/^$/.,/./-jGdd " Collapse multiple contiguous empty lines into a single line map n GoZ:g/^[ ]*$/.,/[^ ]/-jGdd " Collapse multiple contiguous blank lines into a single line "map c :%s/[[:cntrl:]]/\r/g " Replace control characters with a new line separator map d :%s/[-]//g " Delete extended characters (128-255) map e :%s/\(.*[^ ][^ ]*\) *$/\1/c " Remove trailing spaces at the end of a line map f :%s/^ *\(.*\)/\1/c " Remove leading spaces at the beginning of a line map g :%s/ */ /gc " Collapse multiple contiguous spaces into a single space map h ://+1,/<\/code>/-1s/&/\&/gc " Convert & to & between CODE tags map i ://+1,/<\/code>/-1s/j ://+1,/<\/code>/-1s/>/\>/gc " Convert > to > between CODE tags map :ZoomWin map :FirstExplorerWindow map :BottomExplorerWindow map :WMToggle " szukanie we wszystkich plikach: nmap :while !search( @/, "W") \| bnext \| endwhile " szukaj zaznaczonego tekstu z '*' i '#' (a nie tylko wyrazu pod kursorem): vnoremap * y/" vnoremap # y?" " wyszukiwanie TYLKO w zaznaczonym fragmencie: vnoremap / /\%>=line("'<")-1l\%<=line("'>")+1l vnoremap ? ?\%>=line("'<")-1l\%<=line("'>")+1l " Make shift-insert work like in Xterm: map map! " nie trać zaznaczenia przy < i > noremap < >gv if version >= 700 map N :tabnew imap N :tabnew "map :e # "imap :e # " sprawdzanie pisowni "map :w:!ispell -x -d polish %:e map :setlocal spell! imap :setlocal spell! " przemieszczanie zakładek (tabów) kombinacją ALT+, ALT+. nn :if tabpagenr() == tabpagenr("$")\|tabm 0\|el\|exe "tabm ".tabpagenr()\|en nn :if tabpagenr() == 1\|exe "tabm ".tabpagenr("$")\|el\|exe "tabm ".(tabpagenr()-2)\|en endif "}}} """"""""""""""""""" FUNKCJE: """"""""""""""""""""""""""""""""""""""""{{{ " tekst po zwinięciu zakładki: function! MojFoldText() let linia = getline(v:foldstart) let linia = substitute(linia, '/\*\|\*/\|{{{\d\=\|//\|', '', 'g') "}}} return v:folddashes.' '.v:foldend.' (ZWINIĘTO: '.(v:foldend-v:foldstart+1).') '.linia endfunction " Uzupełnianie wyrazów przez - TIP #102: function! InsertTabWrapper(direction) let col = col('.') - 1 if !col || getline('.')[col - 1] !~ '\k' return "\" elseif "backward" == a:direction return "\" else return "\" endif endfunction function! s:DiffWithSaved() let filetype=&ft diffthis " new | r # | normal 1Gdd - for horizontal split vnew | r # | normal 1Gdd diffthis execute "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype endfunction command! Diff call s:DiffWithSaved() " TIP #1149: Returns either the contents of a fold or spelling suggestions. if version >= 700 function! BalloonExpr() let foldStart = foldclosed(v:beval_lnum ) let foldEnd = foldclosedend(v:beval_lnum) let lines = [] " If we're not in a fold... if foldStart < 0 " If 'spell' is on and the word pointed to is incorrectly spelled, the tool tip will contain a few suggestions. let lines = spellsuggest( spellbadword( v:beval_text )[ 0 ], 5, 0 ) else let numLines = foldEnd - foldStart + 1 " Up to 31 lines get shown okay; beyond that, only 30 lines are shown with ellipsis in between to indicate too much. " The reason why 31 get shown okay is that 30 lines plus one of ellipsis is 31 anyway... if ( numLines > 31 ) let lines = getline( foldStart, foldStart + 14 ) let lines += [ '-- Snipped ' . ( numLines - 30 ) . ' lines --' ] let lines += getline( foldEnd - 14, foldEnd ) else let lines = getline( foldStart, foldEnd ) endif endif return join( lines, has( "balloon_multiline" ) ? "\n" : " " ) endfunction endif "}}} """"""""""""""""""" PLUGINY: """"""""""""""""""""""""""""""""""""""""{{{ " TOhtml: let html_use_css=1 " domyslnie uzywa CSS zamiast let use_xhtml=1 " domyslnie tworzy XHTML zamiast HTML " WinManager: let g:miniBufExplMapWindowNavVim = 1 let g:miniBufExplMapWindowNavArrows = 1 let g:miniBufExplMapCTabSwitchBuffs = 1 let g:persistentBehaviour = 1 " nie zamykaj VIMa jezeli zostanie tylko okno exploratora " TimeStamp: let g:timestamp_modelines=20 " przeszukuj pierwsze 20 linii let g:timestamp_regexp = '\v\C%(\s+MODYFIKACJA:\s+)@<=.*$' let g:timestamp_rep = '%a %d-%m-%Y %R' " BuffExplorer: let g:bufExplorerSortBy='number' let g:bufExplorerSplitType='v' let g:bufexplorersplitvertsize = 100 let g:bufExplorerOpenMode=1 " Open using current window let g:bufExplorerSplitOutPathName=1 let g:bufExplorerShowDirectories=1 " Enanced Commentify: let g:EnhCommentifyTraditionalMode = "No" "}}} " wczytaj ustawienia specyficzne dla danego komputera if filereadable($HOME."/.vim/vimrc.local") source $HOME/.vim/vimrc.local endif " vim: fdm=marker