-
Notifications
You must be signed in to change notification settings - Fork 0
/
vim.txt
122 lines (83 loc) · 1.97 KB
/
vim.txt
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
114
115
116
117
118
119
120
121
122
#Default mode when opening file is command mode
#Alternative arrow keys in command mode
h #left
j #down
k #up
l #right
w #move from beginning word to next
e #move from end of word to next
b #move backwards from beginning word to previous
f<character> #Move forward to chacater
F<character> #Move backward to character
#To get to 1st character of active line (from command mode)
0
#Enter into Insert mode from command mode
i
#Enter into Command Mode (esc key)
Esc
#Write/save the file (from command mode). The ":" puts you into command-line mode
:w
#Save the file and exit (command mode)
:wq
#Exit the file when no changes are made (command mode)
:q
#Exit the file without saving changes (command mode)
:q!
#Goto a line (command mode)
<line number>G
#Goto the first line in test
gg
#Goto the last line in the text
G
#Delete the line you are on (command mode)
dd
#Delete from where you are to end of file (command mode)
dG
#Delete a character from command mode
x
#Delete two characters from command mode
2x
#Delete an entire word from command mode
dw
#Undo a change from command mode
u
#To redo
Ctrl + r
#paste recently deleted data
p
#To change a letter in command mode
r<new letter>
#Change a word from command mode
cw
#Change a line from command mode
c$ or C
#Delete word from command mode
dw
#Delete line
dd
#Delete line from where cursor is to end
d$ or D
#Yank, copy a line
yy
#Yank from cursor to end of line
y$ or Y
#Go to insert mode to append at the end of the line
A
#Go to insert mode on the next line
o
#Search forward in document
/<string>
#Go to the next instance of search
n
#Go to the previos instance of search
N
#Search and replace ever instance of string
:%s/<oldstring>/<newstring>/g
#Search and replace instance of string between lines 3 and 9
:3,9s/<oldstring>/<newstring>/g
#Execute a shell command from vim
:!<command>
#In command line mode use Ctrl + d to view every command in command mode like ? in cisco
:Ctrl+d
#To enter visual mode (from command mode)
v