-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvim
More file actions
executable file
·110 lines (84 loc) · 2.49 KB
/
vim
File metadata and controls
executable file
·110 lines (84 loc) · 2.49 KB
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
type a <num> before a motion repeats it
type a <num> with an operator repeats it
-MOVEMENT-
```
h j k l :moving cursor
w :to start of next word
b :to start of previous word
e :to end of next word
ge :to end of previous word
0 :to start of the line
^ :to first non-blank char of the line
$ :to end of the line
G :to bottom of the file
gg :to start of the file
W, B, E, gE :move white space separated WORDS
H, M, L :home, middle, last of current screen
<num>G :to line <num>
<num>% :to <num> percent of the the file
% :find matching parens
/ :search a phrase
? :search backward
n :next match, N :previous match
```
-EDITING-
```
i :insert before cursor
a :insert after the cursor
A :insert after end of line
o :open a line below
O :open a line above
r :replace current char
R :replace more char
y :copy
yy : copy current line
p :paste
x :delete
J :delete a line break, join two lines
d :delete operator
dw :to the start of the next word, excluding first char
de :to the end of the current word, including last char
d$ :to the end of the line, including last char
dd :delete current line
#dd :delete # of lines
c :change operator(delete then insert)
ce :change until the end of a word
c$ :change to the end of a line
u :undo
U :undo all changes on a line
```
-COMMAND-
```
ESC :return to normal mode
TAB :to use one completion
v :start visual selection mode
ZZ :save and close the file
:e <file> :edit file
:e! :reload original file
:w :save file
:w <file> :save to file
:wq :save and quit
:q! :quit without saving
:x :save and quit
:r <file> :insert content from another file
:tabe :open a new tab
:shell :open shell
:! :followed by an external command to execute that command
:help <cmd> :find help
:q :close help window
c-r :redo the undo
c-o :go back where you came
c-i :go forward
c-g :show your location in the file and file status
c-d :show possible command completion
:s/<old>/<new> :substitute new for the first old in a line type
:s/<old>/<new>/g :substitute new for all old's in a line type
:#,#s/old/new/g :substitute between two line #s
:%s/old/new/g :substitute all occurrences in the file type
:%s/old/new/gc :ask for confirmation each time add 'c'
:set <opt> :sets the option
'ic' 'ignorecase' - ignore upper/lower case when searching
'is' 'incsearch' - show partial matches for a search phrase
'hls' 'hlsearch' - highlight all matching phrases
prepend 'no' to switch option off - :set noic
```