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