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