10
Introduction to vi Introduction to vi (a Unix, Linux, and Windows text editor) (a Unix, Linux, and Windows text editor)

Introduction to vi (a Unix, Linux, and Windows text editor)

Embed Size (px)

Citation preview

Page 1: Introduction to vi (a Unix, Linux, and Windows text editor)

Introduction to viIntroduction to viIntroduction to viIntroduction to vi

(a Unix, Linux, and Windows text editor)(a Unix, Linux, and Windows text editor)

Page 2: Introduction to vi (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)

Page 3: Introduction to vi (a Unix, Linux, and Windows text editor)

vi acronyms…• viSUAL• viSUAL EDITOR• vISUAL iNTERFACE

• vERY iDIOTIC

Page 4: Introduction to vi (a Unix, Linux, and Windows text editor)

Intro to vivi has 3 modes:

1. edit mode2. insert mode3. command mode

Page 5: Introduction to vi (a Unix, Linux, and Windows text editor)

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

Page 6: Introduction to vi (a Unix, Linux, and Windows text editor)

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 7: Introduction to vi (a Unix, Linux, and Windows text editor)

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

Page 8: Introduction to vi (a Unix, Linux, and Windows text editor)

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

Page 9: Introduction to vi (a Unix, Linux, and Windows text editor)

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

Page 10: Introduction to vi (a Unix, Linux, and Windows text editor)

Remember…Esc return to move/modify mode:x save changes; quit:q quit:q! quit without saving changesdd delete linedw delete wordi insertu undo