Upload
solomon-goodman
View
235
Download
0
Embed Size (px)
Citation preview
Introduction to viIntroduction to viIntroduction to viIntroduction to vi
(a Unix, Linux, and Windows text editor)(a Unix, Linux, and Windows text editor)
Intro to vi• vi is a ubiquitous text editor.• It is available for Linux, Unix, and
Windows (from http://www.winvi.de/en/ and others).• To run vi, simple type
– vi– vi test.cpp– (or by double-clicking or by right-clicking)
vi acronyms…• viSUAL• viSUAL EDITOR• vISUAL iNTERFACE
• vERY iDIOTIC
Intro to vivi has 3 modes:
1. edit mode2. insert mode3. command mode
vi mode: editEsc return to edit mode/search-string/ search againarrow keysRet next line^ beginning of line$ end of linex delete chardw delete worddddelete linen dd delete n linesu undoCtrl-b backwards a screenful of textCtrl-f forwards a screenful of textCtrl-r redo
vi mode: inserta start adding after cursorA start adding at end of linei insert in front of current cursor positionI start adding in front of lineo open a new line underneath current lineO open a new line above current line
Esc exit insert mode
vi mode: commandCommand mode is entered with : from
move/modify mode.:q quit (if changes haven’t been made):q! quit without saving changes:w save changes; don’t quit:x save changes and quit
Emacs commandcopy-paste steps:
1. Place cursor (anywhere) on line you wish to copy.
2. shift-y yank (makes a copy of the line)• or n shift-y to yank n lines
3. Move to location where you wish to paste line.
4. shift-p put
Emacs commandcut-paste steps:
1. Place cursor (anywhere) on line you wish to cut.
2. dd delete line• or n dd to delete n lines
3. Move to location where you wish to paste line.
4. shift-p put
Remember…Esc return to move/modify mode:x save changes; quit:q quit:q! quit without saving changesdd delete linedw delete wordi insertu undo