-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathvimtut
More file actions
109 lines (91 loc) · 2.98 KB
/
vimtut
File metadata and controls
109 lines (91 loc) · 2.98 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
#################################################
##### Vim Tutorial ######
##### By: Rishi Goomar ######
#################################################
github.com/rgoomar/vim-tutorial
-----------------------------------
Primary VIM modes:
- Command
- Visual
- Insert
- Replace
Esc - To get back to command mode <-- VERY IMPORTANT
-----------------------------------
k
h l
j
j - move down
k - move up
h - move left
l - move right
e - move to end of word
b - move to beginning of word
w - move to next word
B - move to previous word
0 - beginning of line
$ - end of line
^ - first non-blank character in line
gg - top of file
G - bottom of file
==================================
line with indent spaces
==================================
f + (character) - Find the character to the right of the cursor
F + (character) - Find the character to the left of the cursor
; - Repeat movement action (for f and F)
: + (number) - Go to line number
(number) + k - Move up X amount of lines
(number) + j - Move down X amount of lines
(number) + e,b,w,B - Move X amount of words ahead / behind
r - replace character
R - replace from cursor on
o - insert line below (NOTE: goes to insert mode)
O - insert line above (NOTE: goes to insert mode)
a - insert after current character (NOTE: goes to insert mode)
A - insert at end of current line (NOTE: goes to insert mode)
==================================
This is at HackReactor and this is a random VIM tutorial by some guy.
VIM is the best and everyone should use it... or atleast a VIM plugin
==================================
% - Match parens / brackets
yy OR Y - "yank" line AKA copy
y(num)y - yank specified number of lines
v - visual mode (used for selecting)
V - visual mode on entire line
p - paste previously yanked characters / lines below
P - paste previously yanked characters / lines above
x - delete character
d + (direction) - delete character if direction is left or right, or line when direction is up or down
D - Delete content from cursor to end of line
dd - Delete entire line; also copies, like y -- Use p or P to paste line(s) elsewhere
d(num)d - delete specified number of lines, and copy them
u - undo
Ctrl + r - redo
Visual selection + = - indent
/ - search
-- n - go to next item in search
-- N - go to previous item in search
==================================
var test = function() {
console.log('test');
};
==================================
:vsp + (file path) - Vertical split and open
:sp + (file path) - Horizontal split and open
CTRL + w + h - Go to the window to the left
CTRL + w + l - Go to the window to the right
CTRL + w + k - Go to the window above
CTRL + w + j - Go to the window below
:tabnew + (file path) - open in new tab
gt - go to next tab in cycle
(num) + gt - go to X tab
H - go one tab to the left
L - go one tab to the right
:w - Write (Save)
:q - Quit
:wq - Write and Quit
:q! - force quit
:wa - Save all
:wqa - Save and quit all
ZZ - equivalent to :wq
==================================