Lukáš Šabľa - Vim

Preview:

DESCRIPTION

 

Citation preview

:q!

[operator][count][motion]

(use text-objects) iw

i( / ib

iW

I i a A beginning of line

before cursor

after cursor

end of line

O o s

C

previous line

next line

substitute character

substitute line S

line from cursor

v V ^v select characters

select lines

select block

o gv I swich cursor start/end

reselect prev. area

prepend each line

searching

substitutions

:%s/foo/bar „foor“ -> „bar“ :s/foo/bar/g on the line :s/..k/ax/ wildcards :2,4s/foo/bar/g :s/\(.*\):\(.*\)/\2 : \1/ :g/foobar/d delete all lines containing „foobar“ \c \C – case (in)sensitive

registers :registers :echo @r

“a-“z “a-“z

qr @r macro record

macro playback

mm mM set mark m In file

set mark M across files

‘m `m jump to line m

jump to exact char

marks

:buffers :help :buffers :badd file :bnext :bprev :bdelete

buffers

vim -o / -O filename filename2 split,vsplit: filename :q - pokial je otvorenych viac okien, vim sa nestara o ulozenie suboru Ctrl + W + h,j,k,l / sipky - prepinanie okien Ctrl + W + r,R - rotacia okien Ctrl + W + x Ctrl + [+] / [-] Ctrl + W + <,> Ctrl + W + _ , Ctrl + W + |, Ctrl + W + =

windows

do dp ]c [c ^W ^W

get changes put changes next change witch window

vimdiff

insert: ^p ^x, ^f normal: ^a , ^x in/dekrement plugin Monday command: ^r^w,^d

vimscript

• Interny jazyk • .vimrc • Python, perl, ruby, .. • pluginy

let items=[1,2,3,4]

for item in items

echo item

endfor

plugins

git clone git://github.com/joonty/myvim.git ~/.vim vim +BundleInstall +qall

syntax checking :!php –l % php QA tools Tags auto-completion ^x^o NERDTree Ctags Codesniffer, mess detector PHPUnit Xdebug

Mapping map <F2> :NERDTreeToggle<CR> imap ,a <a href=""></a><Esc>F"i nmap vmap Kostry autocmd BufNewFile *.php 0r ~/.vim/skeletons/skeleton.php

:filetype plugin on

:set nobomb :syntax on :set number :set ignorecase, smartcase :set incsearch hlsearch

>> << :retab! N gu, gU, g~ - lower, uppercase ^R+= simplecalc :sh :r!cmd

zf (fold) - nasleduje pohybovy prikaz - kolko riadkov - prvy z nich zfap visual mode zo (open) zc, zd zr, zm :set foldopen=all zR, zM :set foldclose=all

Recommended