introduction to vi. intro to vi vi is a ubiquitous text editor. it is available for linux, unix, mac...
TRANSCRIPT
![Page 1: Introduction to vi. Intro to vi vi is a ubiquitous text editor. It is available for Linux, Unix, Mac OS X and Windows (from and](https://reader035.vdocuments.us/reader035/viewer/2022072014/56649ea25503460f94ba5513/html5/thumbnails/1.jpg)
Introduction to viIntroduction to viIntroduction to viIntroduction to vi
![Page 2: Introduction to vi. Intro to vi vi is a ubiquitous text editor. It is available for Linux, Unix, Mac OS X and Windows (from and](https://reader035.vdocuments.us/reader035/viewer/2022072014/56649ea25503460f94ba5513/html5/thumbnails/2.jpg)
Intro to vi vi is a ubiquitous text editor. It is available for Linux, Unix, Mac OS X and
Windows (from http://www.winvi.de/en/ and others). To run vi, simple type
vi vi test.cpp
![Page 3: Introduction to vi. Intro to vi vi is a ubiquitous text editor. It is available for Linux, Unix, Mac OS X and Windows (from and](https://reader035.vdocuments.us/reader035/viewer/2022072014/56649ea25503460f94ba5513/html5/thumbnails/3.jpg)
Intro to vivi has 3 modes:
1. edit mode
2. insert mode
3. command mode
![Page 4: Introduction to vi. Intro to vi vi is a ubiquitous text editor. It is available for Linux, Unix, Mac OS X and Windows (from and](https://reader035.vdocuments.us/reader035/viewer/2022072014/56649ea25503460f94ba5513/html5/thumbnails/4.jpg)
vi mode: editEsc return to edit mode/search-string/ search againarrow keysRet next line^ beginning of line$ end of linex delete chardwdelete worddd delete linen dd delete n linesu undoCtrl-b backwards a screenful of textCtrl-f forwards a screenful of textCtrl-r redo
![Page 5: Introduction to vi. Intro to vi vi is a ubiquitous text editor. It is available for Linux, Unix, Mac OS X and Windows (from and](https://reader035.vdocuments.us/reader035/viewer/2022072014/56649ea25503460f94ba5513/html5/thumbnails/5.jpg)
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
![Page 6: Introduction to vi. Intro to vi vi is a ubiquitous text editor. It is available for Linux, Unix, Mac OS X and Windows (from and](https://reader035.vdocuments.us/reader035/viewer/2022072014/56649ea25503460f94ba5513/html5/thumbnails/6.jpg)
vi mode: commandCommand mode is entered with : from edit/insert 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
![Page 7: Introduction to vi. Intro to vi vi is a ubiquitous text editor. It is available for Linux, Unix, Mac OS X and Windows (from and](https://reader035.vdocuments.us/reader035/viewer/2022072014/56649ea25503460f94ba5513/html5/thumbnails/7.jpg)
copy-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
![Page 8: Introduction to vi. Intro to vi vi is a ubiquitous text editor. It is available for Linux, Unix, Mac OS X and Windows (from and](https://reader035.vdocuments.us/reader035/viewer/2022072014/56649ea25503460f94ba5513/html5/thumbnails/8.jpg)
cut-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
![Page 9: Introduction to vi. Intro to vi vi is a ubiquitous text editor. It is available for Linux, Unix, Mac OS X and Windows (from and](https://reader035.vdocuments.us/reader035/viewer/2022072014/56649ea25503460f94ba5513/html5/thumbnails/9.jpg)
Remember…Esc return to move/modify mode
:x save changes; quit
:q quit
:q! quit without saving changes
dd delete line
dw delete word
i insert
u undo