-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToolbox: Vim
118 lines (77 loc) · 1.75 KB
/
Toolbox: Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Task 2
- 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
# Task 3
- 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
# Task 4
- 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
# Task 5
- 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
____
https://vim.rtorr.com/
https://tryhackme.com/room/toolboxvim