Home > Unix > UNIX – Lesson 010 – vi editor – vi Modes, Cursor Movements

UNIX – Lesson 010 – vi editor – vi Modes, Cursor Movements


vi (pronounced “vi-ai“) is the Unix standard editor.
It is a screen-oriented text editor. It was designed to be terminal independent, commands have been mapped to almost every key of the standard keyboard.
Three modes:

  • Command mode (“beep mode”): keystrokes are interpreted as commands
  • Insert mode (“no beep mode”): keystrokes are entered into the file
  • Command line mode (“colon mode”)

ESC – puts you in command mode

================================================================================

To start vi editor run the following command:

$ vi test.txt

and appears the folowing window:

 

================================================================================
VI Editor – Cursor Movements

Cursor Movements:

  • arrow keys (depending on terminal)
  • w = move forward word by word
  • b = move backwards word by word
  • ^ = go to the beginning of the current line
  • $ = go to the end of the current line
  • G = go to the end of the file
  • CTRL + g = Reports the current line number
  • CTRL + b = Scroll back to previous window of text
  • CTRL + f = scroll forward to next window of text
  • H = Go home (first line, first character of the screen)
  • :# = Go the specific line (I.e. :3, go to the line number 3)

If you like to see line numbers while you are editing your file you can enter the command:
:set number

You can disable line numbers with:
:set nonumber

Categories: Unix
  1. 6 June 2011 at 06:52

    please tell how to enter into movement mode means

    • 21 June 2011 at 15:13

      The movement mode means the possibility to move UP/DOWN or LEFT/RIGHT on the rows.
      BR.
      T&T

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: