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