1
00:00:00,050 --> 00:00:02,040
- [Instructor] Let's open Vim with a new file

2
00:00:02,040 --> 00:00:07,060
and write some text, so Vim learn.txt.

3
00:00:07,060 --> 00:00:12,000
Hit i for insert mode, and then write some text.

4
00:00:12,000 --> 00:00:17,070
"The trick to learning is enjoying."

5
00:00:17,070 --> 00:00:21,060
This quote is attributed to the physicist Richard Feynman.

6
00:00:21,060 --> 00:00:23,070
Now that you're happy with what you wrote,

7
00:00:23,070 --> 00:00:25,030
you're glad to save it.

8
00:00:25,030 --> 00:00:27,040
This means switching back to normal mode

9
00:00:27,040 --> 00:00:30,020
by hitting escape or control + c,

10
00:00:30,020 --> 00:00:34,050
and then writing column w enter.

11
00:00:34,050 --> 00:00:37,000
If the file doesn't exist, Vim will create it

12
00:00:37,000 --> 00:00:38,070
while you write it.

13
00:00:38,070 --> 00:00:40,070
You'll see at the bottom a message

14
00:00:40,070 --> 00:00:42,070
that Vim wrote the file.

15
00:00:42,070 --> 00:00:45,020
This area is called the status line.

16
00:00:45,020 --> 00:00:46,000
That's it.

17
00:00:46,000 --> 00:00:47,030
You wrote the file.

18
00:00:47,030 --> 00:00:49,040
If you'd like to write to a different file,

19
00:00:49,040 --> 00:00:51,030
you could specify the file to write

20
00:00:51,030 --> 00:00:54,010
as a parameter to the w command.

21
00:00:54,010 --> 00:00:59,060
W stands for write, so column w learn-rf

22
00:00:59,060 --> 00:01:03,050
for Richard Feynman .txt and enter.

23
00:01:03,050 --> 00:01:07,070
This will create a file called learn-rf.txt.

24
00:01:07,070 --> 00:01:11,020
However, you're still editing learn.txt,

25
00:01:11,020 --> 00:01:14,010
and if you'd like to work on learn-rf.txt,

26
00:01:14,010 --> 00:01:16,060
you'll need to switch to it explicitly

27
00:01:16,060 --> 00:01:19,030
either by quitting Vim and opening the new file,

28
00:01:19,030 --> 00:01:22,000
or by telling Vim you'd like to edit the file

29
00:01:22,000 --> 00:01:23,030
with the e Command.

30
00:01:23,030 --> 00:01:25,010
E stands for edit.

31
00:01:25,010 --> 00:01:32,000
So column e learn-rf.txt and enter.

32
00:01:32,000 --> 00:01:34,040
You can use pad completion for filing,

33
00:01:34,040 --> 00:01:38,050
so fill column e space and then starting hitting tab,

34
00:01:38,050 --> 00:01:42,050
Vim will go over the variable files that you can open.

35
00:01:42,050 --> 00:01:43,040
Let's hit escape.

36
00:01:43,040 --> 00:01:45,020
We'll pull up this one.

37
00:01:45,020 --> 00:01:47,080
You can use event as file prefix.

38
00:01:47,080 --> 00:01:52,060
So e le for the start of learn, and then tab

39
00:01:52,060 --> 00:01:56,090
will give us just the file names that start with le.

40
00:01:56,090 --> 00:01:59,010
If you're not sure which file you're editing,

41
00:01:59,010 --> 00:02:01,000
you can use control + g,

42
00:02:01,000 --> 00:02:03,060
and at the status line, you'll see the name of the file

43
00:02:03,060 --> 00:02:05,030
you are currently editing.

44
00:02:05,030 --> 00:02:07,030
Hit escape or control + c to make sure

45
00:02:07,030 --> 00:02:09,030
that you're in normal mode.

46
00:02:09,030 --> 00:02:11,040
Once you're done for this writing session,

47
00:02:11,040 --> 00:02:14,010
you can write and quit in the same command.

48
00:02:14,010 --> 00:02:18,000
So column wq and enter.

