1
00:00:00,050 --> 00:00:03,050
- [Instructor] I wrote my book, Forging Python, in vim.

2
00:00:03,050 --> 00:00:05,040
The book is written as a dialogue between

3
00:00:05,040 --> 00:00:07,050
Greybeard, a seasoned developer

4
00:00:07,050 --> 00:00:10,030
and Youngstar a bright young developer.

5
00:00:10,030 --> 00:00:11,040
As you can imagine,

6
00:00:11,040 --> 00:00:14,040
writing these names got old very quickly.

7
00:00:14,040 --> 00:00:17,050
To solve this, I used abbreviations.

8
00:00:17,050 --> 00:00:21,050
You can define an abbreviation with :abb command.

9
00:00:21,050 --> 00:00:23,010
So let's start vim

10
00:00:23,010 --> 00:00:28,070
and then :abb _ys, which is the abbreviation, space

11
00:00:28,070 --> 00:00:32,050
and then what it's going to expand to,

12
00:00:32,050 --> 00:00:36,040
Youngstar: and then enter.

13
00:00:36,040 --> 00:00:41,010
And now when I write, I for insert mode _ys

14
00:00:41,010 --> 00:00:43,090
and when I do space it will be replaced with Youngstar

15
00:00:43,090 --> 00:00:45,050
and now I can continue writing.

16
00:00:45,050 --> 00:00:48,030
And how do I do that?

17
00:00:48,030 --> 00:00:49,080
Try to pick an abbreviation

18
00:00:49,080 --> 00:00:52,020
that can't be part of a regular word.

19
00:00:52,020 --> 00:00:53,050
That's why I used underscore

20
00:00:53,050 --> 00:00:55,040
at the beginning of the abbreviation.

21
00:00:55,040 --> 00:00:57,090
However, if you'd like to stop an abbreviation

22
00:00:57,090 --> 00:01:00,050
from expanding, use Control + V.

23
00:01:00,050 --> 00:01:07,040
So, enter _ys and then Control + V and space,

24
00:01:07,040 --> 00:01:09,050
not expanded.

25
00:01:09,050 --> 00:01:13,000
Another use for abbreviation is to fix common typos.

26
00:01:13,000 --> 00:01:16,020
Let's say I often misspell receive as recieve.

27
00:01:16,020 --> 00:01:18,030
I can do, escape to normal mode,

28
00:01:18,030 --> 00:01:22,050
:abb recieve

29
00:01:22,050 --> 00:01:25,070
should be receive

30
00:01:25,070 --> 00:01:26,060
and enter.

31
00:01:26,060 --> 00:01:31,010
And now I can write. So O for new line in insert mode

32
00:01:31,010 --> 00:01:36,010
and then I'd like to recieve

33
00:01:36,010 --> 00:01:39,080
and when I do space, it will fix to the right spelling.

34
00:01:39,080 --> 00:01:42,070
Some recognition...

35
00:01:42,070 --> 00:01:44,070
And of course you should add these abbreviations

36
00:01:44,070 --> 00:01:47,000
to your vim RC so they will persist.

