יום שני, 5 ביולי 2010

Vim CheatSheet

General commands

:vs #vertical split and open filename in new screen
:sb # horizontal split
:s/lala/foo/ #replaces the first instance of lala with foo
:%s/lala/foo/gc # replaces all instances of lala with foo and (due to the c) will ask for permission beforehand
:e #open file
:Explore #guess ;)
:.,.+22s/^// #remove spaces from the begining the next 22 lines
:.,.+11s/$/f/ #replace the end of the next 11 lines with

key binds

Ctrl-c #most of the times will throw you in command mode , closer than esc for the lazy ones
Esc # command mode
v # visual mode
V # visual mode per line
ctrl + v # visual block mode (per char)
y # yank (copy)
p # paste
P # paste before current
hjkl # try those in command mode , just hit the damn keys ! :P
u # undo
> # move to right
< # move to left (the entire line) [ # go to start of doc ] # got to end of doc ( # paragraph up ) # paragraph down . # the best of all , (repeat last command )

tab commands

:tabnew # new blank tab
:tabnew #newtab with open in it
:tabn #next tab
:tabp #previouse tab

clipboard magic

just "+ before you yank or paste , yup its the x clipboard :P (if it doesnt work for ya try to recompile vim with ./configure --with-x)

אין תגובות:

הוסף רשומת תגובה