alekg (alekg) wrote in lpi_help,

  • Mood:


        Vi is probabably one of the oldest Unix programs out there. Vi is command line screen editor used by many Unix admins and Hackers. It is important that you understand how to navigate vi and how to use it effectively since vi might the only text editor on some systems. Some people think it is very archaic program. I myself think is very powerful editor with rich sets of options. I will try not to go over all the options; just those that pertain to LPI.

        Vi has 2 modes of operation
           1. command
           2. Insert

        In Command mode you enter Commands that are case sensetive combination of one or more letters. They are to do some sort of action. Examples of command mode are saving, navigating, deleting and so on ..
        In Insert mode, you starting inserting words.
        To switch from the command mode to insert mode press the i key. To switch to command mode press the Esc key. Hence the defualt mode is the command mode

Exiting commands
:n        Next file
:q         quit without saving changes
:q!         same as :q and without confirmation
:wq      Write to the file(if changed) and quit
:x         same as wq
:ZZ         same as wq

Moving around commands
Ctrl-b        Move up one screen
Ctrl-f        Move down one screen
0        Move to the begininig of the current line
^        Move to the first non-whitespace character on the current line
$        Move to the end of current line
b        Move backward one word
G        Move to the end of the file
h        Move ahead or character
H        Move to the top of the screen

i     insert Mode to place text before the cursor
a    insert mode to append, or append, or place text after the cursor

c   Delete to the end-of-line and enter insert mode
r   Enter replace mode(a variant of insert mode)and overwrite existing characters

dl    Delete the next character
dw    Delete the current word
dG    Delete to the end of the file
dd    Delete the entire current line
D    Delete to end of line

Copy & Paste
yl    Yank forward one character
yw    Yank forward one owrd
yG    Yank to the end of the file
yy    Yank the entire current line
P    Paste text one line above the cursor
p    Paste text one line below the cursor

/pattern    search forward for pattern
?pattern    search backward for pattern
n    repeat the last search
N    Repeat the last search in the opposite direction

See Vim,Elvis
Tags: vi elvis vim command
  • Post a new comment


    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.