DOC PREVIEW
FSU COP 4342 - Program Development 2

This preview shows page 1-2-3-4-5-6 out of 19 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Fall 2006 Program Development 2vi UPT 17.1☞ “vi” stands for the VIsual editor.☞ Newest forms such as vim and gvim are much morefeatureful than the original barebones editor.☞ It’s “standard” on all Unix machines, and a great wayto get emacs going!☞ While it doesn’t make automatic backups of filesedited, it also doesn’t leave tilde files all over the place.COP 4342Fall 2006 Program Development 2☞ It is generally quite efficient.COP 4342Fall 2006 Program Development 2Calling viThe vi editor is invoked by issuing the command in thefollowing form. The -r option is for recovering a file wherethe system crashed during a previous editing session. The-t option is to indicate the position within a file the editingshould start.vi [-t tag] [-r ] filenameCOP 4342Fall 2006 Program Development 2Modes in vi☞ It has has three main modes:➳ character input mode: where text can be entered➠ insert, append, replace, add lines➳ window mode: where regular commands can beissued➠ basic cursor motions➠ screen control➠ word commands➠ deletionsCOP 4342Fall 2006 Program Development 2➠ control commands➠ miscellaneous commadns➳ line mode: where ex or ed commands can be issuedCOP 4342Fall 2006 Program Development 2Character input/outputAfter invoking vi, the user is in the window commandmode.There are a few different commands to enter characterintput mode.At that point, a user types in any desired text. Theuser then uses the ESC key to return back to commandmode.COP 4342Fall 2006 Program Development 2Commands to enter Character Input Modea append text after the cursor positionA append text at the end of linei insert text before the cursor positionI insert text before the first nonblank character in the lineo add text after the current lineO add text before the current line (letter O)rchr replace the current character with ‘‘chr’’R replace text starting at the cursor positionCOP 4342Fall 2006 Program Development 2Basci cursor motionh go back one characterj go down one linek go up one linel go forward one character (space also works)0 go to the beginning of the line (zero)$ go to the end of the lineH go to the top line on the screenL go to the last line on the screenCOP 4342Fall 2006 Program Development 2Word movementw position the cursor at the beginning of the next wordb position the cursor at the beginning of the last worde position the cursor at the end of the current wordCOP 4342Fall 2006 Program Development 2Screen control^U scroll up one half page^D scroll down one half page^B scroll up one page^F scroll down one page^L redisplay the pageCOP 4342Fall 2006 Program Development 2Deletionsdd delete the current lineD delete text from the cursor to the end of the linex delete character at the cursorX delete character preceding the cursordw delete characters from the cursor to the end of the wordCOP 4342Fall 2006 Program Development 2Searching/pattern search forward for "pattern"/ search forward for last "pattern"?pattern search backward for "pattern"? search backward for last "pattern"n re-perform the last / or ? commandCOP 4342Fall 2006 Program Development 2Miscellaneousu undo previous commandU restore entire lineY save current line into bufferp put saved buffer after cursor positionP put saved buffer before cursor positionJ join current line with following line% position cursor over matching "(", ")", "{", or "}"ZZ save file and exit (same as :wq)COP 4342Fall 2006 Program Development 2RepetitionYou can specify how many times a command is to beperformed:3dd delete 3 lines4w advance 4 words7x delete 7 characters5n perform last search 5 timesCOP 4342Fall 2006 Program Development 2Working with tagsThe ctags and etags programs let you take in a setof source files as input and creates a tags/TAGS file asoutput.The tags file c ontains for each function and macro☞ Object name☞ File in which the object is defined.☞ Pattern describing the location of the object.COP 4342Fall 2006 Program Development 2The output of etags is also useful with emacs.COP 4342Fall 2006 Program Development 2Using a tags fileYou can use the -t option when invoking vi to find aparticular function.vi -t mainvi -t maxCOP 4342Fall 2006 Program Development 2gvimThere is a graphical version of vi called gvim.COP 4342Fall 2006 Program Development 2Multi-level undo in vim (not vi, though)Can use the u command t o undo multiple changes,as opposed to vi, which can only undo the last change.Each time you enter u , the previous change is undone.COP


View Full Document

FSU COP 4342 - Program Development 2

Download Program Development 2
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Program Development 2 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Program Development 2 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?