pavement

Vi

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
 
Line 29: Line 29:
 
     /something
 
     /something
 
searches the file for the text "something"
 
searches the file for the text "something"
 +
 +
[[Category : Ports and Packages]]

Revision as of 22:48, 24 August 2004

vi, the most minimal of the text editors you're likely to run across. If it's installed on your system (and the default install includes it,) you can invoke it by running the command

   vi

Basic Commands in vi

vi has two modes: "command mode" and "editing mode". You can switch between them by hitting the Esc key on your keyboard. Command mode will let you do stuff to the file, like save it or do stuff with the program, like exit out of vi. Edit mode lets you make changes to the file itself. When first run, you're dropped into Edit mode.

Edit Mode

   i

lets you insert text where the cursor is

   o

lets you insert text into the line below where the cursor is

   r

lets you replace the character that the cursor is on

   x

deletes the charater that the cursor is on

   dw

deletes the word the cursor is on


Command Mode

If you hit Esc, you'll see your cursor moves to the bottom of the screen: you're in command mode. From here you can type in stuff like

   :q!

exits the editor without saving the file

   :wq!

writes the file to disk (saves it) and exits the program

   /something

searches the file for the text "something"

Personal tools