Information Technology Services







Using vi Editor
 


The UNIX visual editor, vi, is a command-driven screen editor. It is case-sensitive.


Vi Command Summary

Mode-Changing

ESC escape from text append (insert) mode and return to vi command mode

:q
quit work on a file if no changes have been made

:q!
quit work on a file but do not write changes

:w
write the current file to filename

:wq
write changes and quit work on the file

 

Display Adjusting

Ctrl f Scroll forward one screen

Ctrl b Scroll backward one screen

Ctrl l Refresh the screen

 

Edit Commands


A append at end of line

a append after cursor

I insert at beginning of line

i insert before cursor

O open a line above current line

o open a line below current line

ESC terminate append (insert) mode

dd delete current line

ndd delete n number of lines

D delete remainder of line

x delete current cursor position

X delete back one character

Cursor Positioning

Move cursor one line up

Move cursor one line down

Move cursor one space left

Move cursor one space right

0 (zero) Move cursor to first position of current line

$ Move cursor to last position of current line

G Move cursor to last line in file

nG Move cursor to line number n

:n Move to line number n

- Move cursor to first character of previous line

+ Move cursor to first character of next line .

L Move cursor to last line displayed on screen

H Move cursor to top line displayed on screen



Searching Commands

/ word search forward for word

n repeat previous search

 

Miscellaneous Commands

:r file Read in contents of file

!! Repeat last system command

 

 

 
 

 

 

 



Webmaster Email: itweb@kennesaw.edu
This page last modified 12/11/2008 8:47 AM
Copyright © 2006 Information Technology Services