vim Tutorial (revision 120920-r02KI)

Return to Lab 02

Tips

  • [Esc] means Escape button on your keyboard.
  • If you're not sure whether you're in insert or command mode, push Esc to make it certain that you're in command mode.
  • [Enter] means Enter button on your keyboard.
  • If you type wrong and want to delete per character, enter command mode by pushing Esc, navigate using arrow buttons and delete using Del button. Do NOT use backspace.
  • If you type wrong and want to delete a line, enter command mode by pushing Esc and delete by typing dd (d two times).

vim Tutorial

  • vim (abbreviation of vi improved) is the same text editor as vi, with some additional functions.
  • Create a new file named [student ID].txt, and then get into insert mode.
    $ vim 1202000818.txt
    i

    Change 1202000818 with your student ID.
  • Write this sentence:
    Saya akan belajar OS dengan rajin.
  • Get into command mode using [Esc], then save your work.
    [Esc]
    :w
  • Copy your previously made sentence and paste it so that there will be 1000 similar lines.
    yy
    999p
  • Move your cursor to line 20. Add the sentence to be "Saya akan belajar OS dengan lebih rajin."
    20G

    Direct your cursor to the space after word "dengan"
    i
    lebih
    [Esc]
  • Move your cursor to line 50. Add the sentence to be "Saya akan belajar OS dengan lebih rajin lagi."
    50G

    Direct your cursor to the space after word "dengan"
    i
    lebih
    [Esc]

    Direct your cursor the the space after word "rajin"
    i
    lagi
    [Esc]
  • Move your cursor to line 783. Change the current sentence to be "Tapi liburnya kapan??"
    783G
    dd
    i
    Tapi liburnya kapan??
    [Enter]
    [Esc]
  • Move your cursor to line 15. Delete the first 10 characters.
    15G
    10x
  • Move cursor to line 132. Direct your cursor just on the left of the first a letter in the work "akan". Delete the a letter.
    132G
    x
  • Save your work and exit from vim.
    :wq

Return to Lab 02
Return to Wiki