Knowledge Hub

Toolbox: Vim

TryHackMe35 answered prompts

Toolbox: Vim TryHackMe walkthrough with 35 answered prompts.

Prompts and answers

  • How do we enter "INSERT" mode?
    i
  • How do we start entering text into our new Vim document?
    typing
  • How do we return to command mode?
    esc
  • How do we move the cursor left?
    h
  • How do we move the cursor right?
    l
  • How do we move the cursor up?
    k
  • How do we move the cursor down?
    j
  • How do we jump to the start of a word?
    w
  • How do we jump to the end of a word?
    e
  • How do we insert (before the cursor)
    i
  • How do we insert (at the beginning of the line?)
    I
  • How do we append (after the cursor)
    a
  • How do we append (at the end of the line)
    A
  • How do we make a new line under the current line?
    o
  • How do we write the file, but don't exit?
    :w
  • How do we write the file, but don't exit- as root?
    :w !sudo tee %
  • How do we write and quit?
    :wq
  • How do we quit?
    :q
  • How do we force quit?
    :q!
  • How do we save and quit, for all active tabs?
    :wqa
  • How do we copy a line?
    yy
  • how do we copy 2 lines?
    2yy
  • How do we copy to the end of the line?
    y$
  • How do we paste the clipboard contents after the cursor?
    p
  • How do we paste the clipboard contents before the cursor?
    P
  • How do we cut a line?
    dd
  • How do we cut two lines?
    2dd
  • How do we cut to the end of the line?
    D
  • How do we cut a character?
    x
  • How do we search forwards for a pattern (use "pattern" for your answer)
    /pattern
  • How do we search backwards for a pattern (use "pattern" for your answer)
    ?pattern
  • How do we repeat this search in the same direction?
    n
  • How do we repeat this search in the opposite direction?
    N
  • How do we search for "old" and replace it with "new"
    :%s/old/new/g
  • How do we use "grep" to search for a pattern in multiple files?
    :vimgrep