Vi editor commands to edit files

AIX Text Editor (Vi Editor) Commands

  • Esc To switch between insert or command mode
  • Insert mode
    • a Insert text after the cursor
    • i Insert text before the cursor
    • I Insert text of the top of the line
    • A Insert text of the bottom of the line
    • x Supress a character
    • o Insert text in the next line
    • O insert text in the previous line
    • r Replace the current character
    • R Edit the current line in typeover
    • cc Change line
    • cw Change word
    • C Change from current position to the end of line
    • dw Delete a word from the cursor position
    • dd Delete the line and place to the buffer
    • yy Copy line in the buffer
    • p Copy the content of the buffer after the current line
    • P Copy the content of the buffer before the current line
  • Position command
    • l Go  right
    • h Go left
    • k Go  up
    • j Go down
    • b Go a word left
    • w Go a word right
    • $ Go to the end of the line
    • O Go to the top of the line
    • :24 Go to  line 24
    • gg or 1G  Go to the first line of the document
    • G Go the last line of the document
  • Global Comand
    • / Search string
    • :1,$s/a/b/g Replace character b from a, from the 1st line to the end of a file
    • :r Insert a file at the position of the cursor
    • :q!  Quit without saving a fle
    • :w  Write  a file
    • :wq Write and quit a file

# #
# #

0 Comment to "Vi editor commands to edit files"

Post a Comment