1
00:00:00,050 --> 00:00:01,040
- [Instructor] Sometimes we like

2
00:00:01,040 --> 00:00:03,050
to move to a specific line.

3
00:00:03,050 --> 00:00:04,090
This is common for example,

4
00:00:04,090 --> 00:00:06,090
when you have an error in your program.

5
00:00:06,090 --> 00:00:09,050
For example, assume you see the following error

6
00:00:09,050 --> 00:00:11,060
when trying to compile the code program.

7
00:00:11,060 --> 00:00:15,020
This is a very common output from compilers.

8
00:00:15,020 --> 00:00:16,060
We have the filename,

9
00:00:16,060 --> 00:00:17,060
we have the line,

10
00:00:17,060 --> 00:00:21,050
and, we have the column that the error happened.

11
00:00:21,050 --> 00:00:22,090
Another error is in line eight.

12
00:00:22,090 --> 00:00:24,080
So, I'd like to go quickly there.

13
00:00:24,080 --> 00:00:30,000
If you open the file, vim hello.go,

14
00:00:30,000 --> 00:00:35,010
and then you can type :8 + Enter.

15
00:00:35,010 --> 00:00:37,010
This will bring us to line eight.

16
00:00:37,010 --> 00:00:39,070
Here we can start fixing the code.

17
00:00:39,070 --> 00:00:41,090
Another way, is to type the line number,

18
00:00:41,090 --> 00:00:44,050
and then, copy the little g.

19
00:00:44,050 --> 00:00:47,040
Move back to the beginning of the file with g + g,

20
00:00:47,040 --> 00:00:51,030
and then, eight and Shift + g.

21
00:00:51,030 --> 00:00:53,060
And, we're back in line eight.

22
00:00:53,060 --> 00:00:56,090
You can use $ to move to the end of the line,

23
00:00:56,090 --> 00:01:01,000
and, zero to move to the beginning of the line.

24
00:01:01,000 --> 00:01:03,040
Use $ to move to the end of the line,

25
00:01:03,040 --> 00:01:05,070
then i to go into insert mode,

26
00:01:05,070 --> 00:01:07,030
and, we'll fix the problem.

27
00:01:07,030 --> 00:01:10,050
Change it to double quote, instead of single quote.

28
00:01:10,050 --> 00:01:13,020
Then, to save, hit Escape, or Control + C,

29
00:01:13,020 --> 00:01:14,060
if you don't have Escape.

30
00:01:14,060 --> 00:01:18,020
Then, :wq.

31
00:01:18,020 --> 00:01:21,000
And then, Enter.

32
00:01:21,000 --> 00:01:23,060
If you note the line number before you start Vim,

33
00:01:23,060 --> 00:01:27,020
you can tell Vim to start at the specific line with +.

34
00:01:27,020 --> 00:01:31,020
So, vim hello.go +8.

35
00:01:31,020 --> 00:01:34,080
And we start the editor in line number eight.

36
00:01:34,080 --> 00:01:37,040
+ actually execute any Vim command.

37
00:01:37,040 --> 00:01:40,000
In our case, it was to move to line number eight.

