-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpractive-vim.txt
233 lines (171 loc) · 10.2 KB
/
practive-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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 1.1: Moving the cursor
Instructions: Follow the line around the screen using h, j, k and l.
| Hint: if you accidentally start typing text, press Esc
| .-------. to leave insert mode and u to undo any changes.
| | |
\_______/ |
|
|
\____.
| .-----------------.
| | |
.---------+----+----. |
\_________/ | | |
| | |
| | |
| \________. \________ Well done! Now scroll
| | down to lesson 1.3
| | with j.
| |
\_____________/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lession 1.3: Text editing - deletion
Instructions: Correct the lines of text below by deleting the
unneccesary characters with x . Hint: use 0 to return to the left.
Faar ouxt inn trhe unchttarteed bakckwataers oof the unfashionable end of the
Weeestern sSpiral arrm ohf thze Gallaxy lies ae sm*all unregarded yellow syun.
Iti ijs aaa trufth universalllly acknowledgegeged, that a sxingle manr iin
possessibon of aw gopod fort^une muost bee in wantxxx of a) wife.&&
Int waes lourvve at first sighght.. The feeirst time Yossarian sa9w th$e
chaplain heee fell maaadly in lov*ve with himmmm.
Aaas Gregor Samsa awokke onne moorning frrom uneeasy ddreams hhe founnd
himmself trransformed inn hiis bbed intoo a giiigantic insecct.
It was a bright cold day in April, and the clocks were striking thirteen.
Twwo householllds, bothe alikee inf dignityyyy,
IIIn fair% Verrrrona, whereq wiie lay# ou987r sc"ene,
Frrom ++ancient grudddge brrrreak tto #new mutiny,,,
Where7 ciiviil blo*od mak^es civil h=ands uncclean.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 1.4: Text editing - insertion
Make the pairs of lines match up by inserting the missing text.
Hint: if you're having trouble with the escape key, try Ctrl-[ instead.
Oliver w the vim of matic course of trea decep.
Oliver was the victim of a systematic course of treachery and deception.
Now Bumble was at, and a choic;
Now, Mr. Bumble was a fat man, and a choleric;
Th as no great cons to the ch.
This was no very great consolation to the child.
'P, ir, I ome mo'
'Please, sir, I want some more.'
'We re o nction tse nture,' sd te old gntlmn
'We refuse to sanction these indentures,' said the old gentleman
ere poston of airs d n all impro.
Here the position of affairs had not at all improved.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 1.5: Text editing - appending
Complete the lines by filling in the missing word, then pressing A
to append to the line. Remember, return the cursor to the left with 0.
"I am afraid, my dear , that most of your conclusions we
"I am afraid, my dear Watson, that most of your conclusions were erroneous.
I laughed incredulously Sherlock Holmes leaned back in h
I laughed incredulously as Sherlock Holmes leaned back in his settee
"Mr. Holmes, they w the footprints of a gigantic h
"Mr. Holmes, they were the footprints of a gigantic hound!"
"Do you mean that wife and you wi
"Do you mean that your wife and you wish to leave?"
"I heard it distinctly, am sure that it was really the sob o
"I heard it distinctly, and I am sure that it was really the sob of a woman."
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 2.1: Deletion commands
Move the cursor to the first letter of the word to be deleted, then press
dw to delete the entire word. Rinse and repeat.
The rabbit-hole VIM went straight on like a IS tunnel for some way, and
then GOOD dipped suddenly down, IT so suddenly that Alice had not a moment
to WILL think MAKE about YOU stopping herself before she found herself falling
down a very deep HAPPY well.
Either the well was GIVE very deep, or she fell very ALL slowly, for she
had plenty of YOUR time as she went down to look about her MONEY and to
wonder TO what was going to happen VIM next. First, she tried to look down
and SAVE make out what THE she was coming to, but it was too dark to see
anything; CHILDREN then she looked at the sides of the well, IN and noticed
that UGANDA they were filled with cupboards STAY and book-shelves; here and
there she AWAY saw maps and pictures hung FROM upon pegs. She took down a
jar from EMACS one of the shelves as she passed; it was IT labelled
'ORANGE MARMALADE', but WILL to her great disappointment it BREAK was empty:
she did YOUR not like to drop the jar FINGERS for fear of killing somebody,
so AND managed to put it into one of the cupboards THUMBS as she fell past it.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 2.2: More deletion commands
Place the cursor on the first incorrect character of each line
and press d$ to delete to the end of the line.
The Owl and the Pussycat went to sea[this is a bit that you need to delete]
In a beautiful pea-green boat,IT WASN'T MADE OF PEAS
They took some honey, and plenty of money,***Always important to take money***
Wrapped up in a five pound note. #Or $8.07 USD on 14 Nov 2010
The Owl looked up to the stars above,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
And sang to a small guitar, /* With only 5 strings */
"O lovely Pussy! O Pussy, my love,(Owls are known to be very passionate)
What a beautiful Pussy you are, you are, you are,+++++++++++++
What a beautiful Pussy you are." {Delete me please, I don't belong here}
Pussy said to the Owl "You elegant fowl, http://flic.kr/p/6chRZS
How charmingly sweet you sing. @@Funfact - owls have the sweetest birdsong
O let us be married, too long we have tarried; A little TOO much tarrying
But what shall we do for a ring?" The eternal question.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 2.4: Using a count for a motion
Try to move from the point marked 'a' to the point marked 'b' using
one command (e.g. 3e or 2w).
a b
e stands for the end of the word.
a b
w means word, that is, move to the next word.
a b c d
punctation counts as a word, so this comma, and this one, count.
c a b
use 0 to jump to the first character of the line.
a b c
Zero One Two Three Four Five Six Seven Eight Nine Ten
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 2.5: Using a count to delete more
Delete the uppercase words using d{number}motion. To delete 2 words, use
d2w, to delete 3, use d3w, etc. Always start on the first letter of the word.
Jack and Jill UP GOT JACK went up AND HOME DID TROT the Hill
to fetch AS FAST AS HE COULD a pail of CAPER water
Jack HE WENT TO BED fell down and AND BOUND HIS HEAD broke his crown
And WITH VINEGAR Jill came AND BROWN PAPER tumbling after.
Old WHEN SHE GOT THERE Mother Hubbard
Went THE CUPBOARD to the WAS BARE cupboard
To SO THE POOR LITTLE DOGGIE get her poor HAD NONE doggie a bone,
Little Bo BUT WHEN SHE AWOKE peep has lost SHE FOUND IT A JOKE her sheep
And FOR THEY WERE doesn't know ALL STILL FLEETING where to find them.
Leave THEN UP SHE TOOK them alone and HER LITTLE CROOK they'll come home,
Bringing DETERMINED FOR their tails TO FIND THEM behind them.
Little Bo SHE FOUND THEM INDEED peep
fell fast BUT IT MADE HER HEART BLEED asleep
And FOR THEY LEFT dreamt she THEIR TAILS BEHIND THEM heard them bleating,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 2.6: Operating on lines
Delete the lines that don't belong below using dd. It's up to you to
pick which ones don't belong!
Hint: Precede the command with a count to delete multiple lines,
e.g. 2dd - delete two lines.
I said a hip hop, hippie to the hippie
I wandered lonely as a cloud
That floats on high o'er vales and hills,
When all at once I saw a crowd,
The hip, hip a hop, and you don't stop, a rock it
To the bang bang boogie, say, up jump the boogie
A host, of golden daffodils;
To the rhythm of the boogie, the beat
Beside the lake, beneath the trees,
Now, what you hear is not a test, I'm rapping to the beat
And me, the groove, and my friends are gonna try to move your feet
Fluttering and dancing in the breeze.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 2.7: The undo command
Fix the errors below. Undo the corrections one-by-one with u, then try
redoing them with CTRL-R. Also, try out undoing a whole line with U.
There on**ce was a bu()gg$$y AI
Who d%*ecided ^^^ her su""bject & should d+ie.
W^hen t{he pl}ot w~as unc#overed,
The su|b|j|e|cted disc\o/vered
That s_ad=ly the c&ake w@as @ a l-i-e.
There SOMEBODY once SET UP was a US man THE from BOMB deep space
And all MAIN you SCREEN could TURN see ON was his face
It ALL seemed YOUR that BASE ARE his BELONG gig TO US
Was YOU HAVE NO CHANCE to TO SURVIVE MAKE make YOUR TIME you move zig
Or FOR else he GREAT would take JUSTICE all your base
There ~once~ was (a) gal "from" [Peru]
whose #limericks# {stopped} on %%line%% two.
[Thanks to http://limerickdb.com/]