-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.txt
90 lines (69 loc) · 2.95 KB
/
test.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
=============================
Exiting Vim
==============================
:wq ->write and exit
:q! -> exit vim without saving the content
:q -> close the unmodified file
==========================================================
Inserting in vim
==========================================================
1. 'o' inserts on a new line
2. 'a' inserts after the position of the current cursor
3. 'i' inserts before the position of the cursor
4. 'O' Caps O -> opens the line above the current line
5. 'I' Caps I ->jumps to the beginning of the line
6. 'A' Caps A -> jumps to the end of the line and appends the content
==========================================================
Moving using arrow keys
===========================================================
k - goes up
j - goes down
h - goes left
l -goes right
Undo
u - undo
ctrl+r -> redo
=====================================================================
Copy & Paste
=====================================================================
y -> yankking / copying
p -> pasting
d ->deletion
dd- > delete the whole line
5 dd -> deletes 5 lines
Y -> copies whole line
C -> modifies the line from the current cursor pointer
D -> deletes the whole line from the current cursor pointer
exit visual mode -> esc*2
type in the visual mode -> 1. Enter the visual mode -> press v
2. select the line/word type 'cc'
=====================================================================================
JUMPING THROUGH WORDS
====================================================================================
w -> jump through words in a forward direction (note: this considers whitespaces as the gap between words)
b -> jump through words in a backward direction
e -> jumps to the end of the word
dw -> deletes a word
d2w -> deletes two words
NOTE :- If your cursor is pointing in between a word which you want to delete the above commad won't fetch the desired output , you need to write it as follows
diw (delete in a word)
ciw (change in a word)
0 -> goes to the beginning of the line
$ -> goes to the end of the line
===========================================================================
Write code in Vim :]:
==========================================================================
JUMPING from beginning of the parathesis '{' to the end -> use the '%'
delete everything in the bracket including the bracket -> d%
t -> Jumps before the specified symbol
f -> Jumps on the (finds) the position of the specified symbol
..................................................
Consider you have a statement as follows
switch asdsdkj ksd sdjh h sd;ksdlkjdsd ( )
->Now lets say you want to delete all the gibberish before the open parethesis you can type :
dt(
....................................................
f( -> will find the open parethesis
==================================================================
Jump to the beginning of the file -> gg
Jump to the end of the file -> Shift key+g