1
00:00:00,050 --> 00:00:03,010
- [Instructor] When you start Vim with no filename,

2
00:00:03,010 --> 00:00:07,030
it will open a window into an empty buffer, Vim.

3
00:00:07,030 --> 00:00:09,080
If you'd like to edit a new file, you can use the

4
00:00:09,080 --> 00:00:15,030
:edit, or shorter, :e to open a file.

5
00:00:15,030 --> 00:00:18,070
So, :e tools.txt.

6
00:00:18,070 --> 00:00:20,040
When you'd like to edit another file,

7
00:00:20,040 --> 00:00:22,070
you can use :e again.

8
00:00:22,070 --> 00:00:25,060
:e new.txt.

9
00:00:25,060 --> 00:00:27,040
Where did the first file go?

10
00:00:27,040 --> 00:00:28,090
It is still there in the buffer

11
00:00:28,090 --> 00:00:31,020
but there is no window showing it.

12
00:00:31,020 --> 00:00:34,080
You can delete the current buffer with :bd for

13
00:00:34,080 --> 00:00:36,080
"buffer delete".

14
00:00:36,080 --> 00:00:39,000
And we're back in the first file.

15
00:00:39,000 --> 00:00:41,010
If you have several files on disk, you can use

16
00:00:41,010 --> 00:00:49,070
:e space and then tab, to go over the list of files.

17
00:00:49,070 --> 00:00:51,070
Lets do an Escape.

18
00:00:51,070 --> 00:00:54,060
Another option is to start with a prefix,

19
00:00:54,060 --> 00:01:00,000
So :e d and then tab will show us the files

20
00:01:00,000 --> 00:01:01,070
that starts with d.

21
00:01:01,070 --> 00:01:02,090
And Escape again.

22
00:01:02,090 --> 00:01:05,080
Another option is to open a directory.

23
00:01:05,080 --> 00:01:07,020
. is the current directory.

24
00:01:07,020 --> 00:01:10,090
So, :e and then .

25
00:01:10,090 --> 00:01:14,010
and we see a list of files in the current directory.

26
00:01:14,010 --> 00:01:18,000
You can use j and k to move between the files,

27
00:01:18,000 --> 00:01:21,050
and you can use / to search for files,

28
00:01:21,050 --> 00:01:25,020
/success.

29
00:01:25,020 --> 00:01:29,070
And once you are on a file, hit Enter to edit the file.

30
00:01:29,070 --> 00:01:31,060
Let's make some changes.

31
00:01:31,060 --> 00:01:34,000
Shift g to go to the end of the file.

32
00:01:34,000 --> 00:01:36,050
Dollar to go to the end of the line.

33
00:01:36,050 --> 00:01:40,090
and a to go to Insert mode after the current cursor.

34
00:01:40,090 --> 00:01:44,000
And then we'll write, it's "in" and we'll go

35
00:01:44,000 --> 00:01:46,090
searching for the origin of the quote.

36
00:01:46,090 --> 00:01:49,010
I can't find the origin of the quote.

37
00:01:49,010 --> 00:01:51,010
Let's undo all the changes that are not yet

38
00:01:51,010 --> 00:01:53,010
written to disk.

39
00:01:53,010 --> 00:01:56,050
:e without a name will open the current file.

40
00:01:56,050 --> 00:01:58,030
And if you add an exclamation mark,

41
00:01:58,030 --> 00:02:01,050
it will load the file even if there are changes.

42
00:02:01,050 --> 00:02:04,070
So back to Normal mode with Escape.

43
00:02:04,070 --> 00:02:07,080
And then :e! and Enter.

44
00:02:07,080 --> 00:02:12,000
And we're back to the original form of the file.

