Welcome!

Welcome to Satlover forums, full of great people, ideas and excitement.

Please register if you would like to take part. link..

Register Now

Alert: Don't Use Hotmail Email Accounts for registration

Collapse

Before Access to all Forums and Trial accounts you must need to activate your account Email address

vi editor - useful commands

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sonc
    Experienced Board Member
    • Jun 2010
    • 1568

    vi editor - useful commands

    vi is a screen-based text editor, available on the Vu+ Duo (and other Linux based receivers). It's not the easiest thing to use, but can be useful to make small changes directly on the receiver, avoiding the need to ftp files between the reciever and PC.

    It operates in either 'normal' mode, where keystrokes move the cursor through the file or perform an action, or in 'insert' mode, where text is input into the file.

    The 'esc' key switches between modes.

    To edit a file, you would type, for example,

    vi /etc/CCcam.cfg

    This will display the first page of your CCcam.cfg file ready for editting.

    If you make a mess of editting a file, just press 'esc' followed by :q!
    This will exit vi leaving the file unchanged.

    You sometimes need to press 'esc' a couple of times to refresh the screen after inputting text.


    Below is a "cheat sheet" of the most useful commands.


    1) cursor movements:
    h - left one character
    l - right one character
    j - down one line
    k - up one line
    Ctrl-F - forward one page
    Ctrl-B - back one page
    G - go to (without arguments, go to end of file)

    2) deleting:
    x - delete character cursor is on
    d - delete
    then add one of the cursor movement symbols to
    show what should be deleted, i.e.:
    d$ - delete to end of line
    d0 - delete to the beginning of the line
    dw - delete word

    dd - delete delete (delete the whole line)

    3) inserting:
    i - insert before cursor
    I - insert at start of line
    a - add after cursor
    A - add at end of line
    o - insert new line below
    O - insert new line above

    4) changing text
    R - start overwriting current text
    r - repace current character
    cw - chnage word
    C - change to end of line

    5) corrections
    u - undo last command (not implemented)
    U - restore whole line

    6) all commands take numeric arguments
    5dd - delete 5 lines beginning with cursor line (or) d5d - same
    2dw - delete two words (or) d2w - delete two words
    c3w - change 3 words
    3Ctrl-B - move up three pages
    1G - go to the first line

    7) exit from vi
    :wq - end edit, saving changes
    :q! - end edit, without saving

    There are other options but I think these are probably the most useful
Working...