Vous êtes sur la page 1sur 2

ViEditorCheatSheet

Character
h,j,k,l

MovementCommands
Left,down,up,right Forward,backwardbyword Endofword Beginningofnext,previoussentence Beginningofnext,previousparagraph Beginningofnext,previoussection First,lastpositionofcurrentline Firstnonblankcharacterofcurrentline Firstcharacterofnext,previousline Toplineofscreen Middlelineofscreen Lastlineofscreen Linen fromtop,bottomofscreen Scrollforward,backwardonescreen Scrolldown,uponehalfscreen Showonemorelineatbottom,topofwindow Scrolluntillinewithcursorisattopofscreen Scrolluntillinewithcursorisatmiddleofscreen Scrolluntillinewithcursorisatbottomofscreen Searchforwardforpattern Searchbackwardforpattern Repeatlastsearchinsame,oppositedirection Repeatprevioussearchforward,backward searchforwardforcharacterx incurrentline searchbackwardforcharacterx incurrentline searchforwardforcharacterbeforex incurrentline searchbackwardforcharacterafterx incurrentline Repeatpreviouscurrentlinesearch Repeatpreviouscurrentlinesearchinoppositedirection Displaycurrentlinenumber Movetolinenumbern Movetolastlineinfile movetolinenumbern Markcurrentpositionasx Movecursortox Returntopreviousmarkorcontext Movetobeginningoflinecontainingmarkx Returntobegginingoflinecontainingpreviousmark

Text

w,W,b,B e,E (,) {,} [[,]]

Lines

0,$ ^ +,H M L n H,n L

Scrolling
[Ctrl]F,[Ctrl]B [Ctrl]D,[Ctrl]U [Ctrl]E,[Ctrl]Y z[Enter] z. z-

Searches
/pattern ?pattern n,N /,? fx Fx tx Tx ; , [Ctrl]G nG G :n mx `x `` 'x ''

LineNumber

MarkingPosition

Insert
i,a I,A o,O r

EditingCommands
Inserttextbefore,aftercursor Inserttextatbeginning,endofline Opennewlinefortextbelow,abovecursor Replacewithnexttypedcharacer

Change

~ cm cc C R s S

Changebetweenuppercaseandlowercase Changetextblockdefinedbymovementcommandm (e.g.,cwchangesnextword) Changecurrentline Changetoendofline Typeovercharacters Deletecharacterandcontinuetyping Deletecurrentlineandcontinuetyping Deletecharacter Deletecharactertotheleftofthecursor Deletetextblockdefinedbymovementcommandm (e.g.,dwdeletesnextword) Deletecurrentline Deletetoendofline Putdeletedtextbefore,aftercursor Puttextfromdeletebuffernumbern aftercursor(forlastninedeletions) Yank(copy)textblockdefinedbymovementcommandm (e.g.,ywyanksnextword) Yankcurrentline Yankcurrentlineintonamedbuffera Putyankedtextbefore,aftercursor Puttextfrombuffera beforecursor Repeatlasteditcommand Undolastedit Undochangestocurrentline Jointwolines Redrawscreen

Delete,Move
x X dm dd D p,P "n p

Yank(copy)
ym yy,Y "a yy p,P "a P

OtherCommands
. u U J [Ctrl]L,[Ctrl]R

Invokingvi
vi file vi file1 file2 view file vi -R file vi -r file vi + file vi +n file vi +/pattern file Invokevieditoronfile Invokevieditoronfilessequentially Invokevieditoronfile inreadonlymode Invokevieditoronfile inreadonlymode Recoverfile andrecenteditsaftersystemcrash Openfile atlastline Openfile atlinenumbern Openfile atpattern

ExitandSaveCommands
ZZ :x :wq :w :w! :30,60w newfile :30,60w>> file :w %.new :q :q! Q :e file2 :e! file2 :n :e! :e# Savefileandquit Savefileandquit Save("write")fileandquit Savefile Savefile(overridingprotection) Savelines30through60asfilenewfile Appendlines30through60tofilefile Savecurrentbuffernamedfile asfile.new Quit Quit,discardinganychanges Quitviandinvokeex Editfile2 withoutleavingvi Discardchangestocurrentfile,theneditfile2 withoutleavingvi Editnextfile Discardallchangessincelastsave Editalternatefile

Vous aimerez peut-être aussi