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