1
00:00:00,050 --> 00:00:02,080
- [Instructor] Sometimes you'd like to add similar text

2
00:00:02,080 --> 00:00:04,080
to another part of a document.

3
00:00:04,080 --> 00:00:07,050
You do it quickly by copy and paste.

4
00:00:07,050 --> 00:00:10,010
Can you guess what the command for copy is?

5
00:00:10,010 --> 00:00:13,050
It's "y" which stands for yank.

6
00:00:13,050 --> 00:00:16,010
See what's taken for change action.

7
00:00:16,010 --> 00:00:21,040
Open time dot text, vim time dot text.

8
00:00:21,040 --> 00:00:26,020
Now let's copy the first word, y w yank word.

9
00:00:26,020 --> 00:00:29,040
Not to have the word in a vim register, known as for as

10
00:00:29,040 --> 00:00:33,090
the clipboard, we can use p to paste it, p.

11
00:00:33,090 --> 00:00:36,060
This looks funny, p pastes the text

12
00:00:36,060 --> 00:00:38,060
right after where the cursor is.

13
00:00:38,060 --> 00:00:40,020
The cursor was on the t,

14
00:00:40,020 --> 00:00:42,070
so we paste it inside the initial there.

15
00:00:42,070 --> 00:00:45,040
Let's undo with u.

16
00:00:45,040 --> 00:00:49,050
Now let's try pasting with capital p, shift p.

17
00:00:49,050 --> 00:00:52,070
This time the text was pasted before the current cursor.

18
00:00:52,070 --> 00:00:58,050
To copy a whole line, use y y, and then paste it with p.

19
00:00:58,050 --> 00:01:01,080
You could use many other motions command with y.

20
00:01:01,080 --> 00:01:05,010
If you would like to delete one character, you can use x,

21
00:01:05,010 --> 00:01:07,080
which deletes the character under the cursor,

22
00:01:07,080 --> 00:01:09,070
and place it in a register.

23
00:01:09,070 --> 00:01:13,000
I tend to make typos when letters are in the wrong order.

24
00:01:13,000 --> 00:01:16,060
Move to the end of the file with shift g,

25
00:01:16,060 --> 00:01:19,050
and then enter insert mode with o.

26
00:01:19,050 --> 00:01:21,030
Now let's write some text.

27
00:01:21,030 --> 00:01:26,040
I'd like to receive notifications.

28
00:01:26,040 --> 00:01:29,090
Then we notice the spelling for receive is wrong.

29
00:01:29,090 --> 00:01:33,060
Vim has spellchecker integration, but it's not enabled

30
00:01:33,060 --> 00:01:35,090
by default since people use vim to

31
00:01:35,090 --> 00:01:37,080
edit code and configuration,

32
00:01:37,080 --> 00:01:41,040
where most of the content is not regular English words.

33
00:01:41,040 --> 00:01:43,090
Move to the error with backward search.

34
00:01:43,090 --> 00:01:50,070
First hit escape, and then question mark i e, and enter.

35
00:01:50,070 --> 00:01:55,050
And now, hit x p, we deleted the character and pasted it

36
00:01:55,050 --> 00:01:57,060
after the cursor.

37
00:01:57,060 --> 00:01:59,030
This swaps the current character

38
00:01:59,030 --> 00:02:02,000
with the next one, very handy.

