introduction to vi. intro to vi vi is a ubiquitous text editor. it is available for linux, unix, mac...

9
Introduction to Introduction to vi vi

Upload: leona-craig

Post on 30-Dec-2015

214 views

Category:

Documents


2 download

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

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

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

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

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

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

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

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

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

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