1
00:00:07,000 --> 00:00:11,115
So let's demonstrate some more
VIM skills. I'm using vim demo

2
00:00:11,115 --> 00:00:15,230
demo file and then I'm
going to type some text.

3
00:00:25,410 --> 00:00:31,496
All right, here we have a little Linux history
file and let me show you some VIM operations

4
00:00:31,496 --> 00:00:37,583
on that. First I'm going to the top line
because I can see Linuxes with lowercase and oh

5
00:00:37,583 --> 00:00:43,670
boy, I'm not sure if there's any other
occurrences of Linux to lowercase in this file.

6
00:00:44,789 --> 00:00:50,820
So let me use colon percent s
for substitute and I'm going to substitute

7
00:00:50,820 --> 00:00:56,850
Linux lowercase with Linux uppercase and
doing that G. G is for global.

8
00:00:57,450 --> 00:01:03,829
There we can see that all occurrences, well, that
happens to be one only have now been changed.

9
00:01:05,250 --> 00:01:08,609
Now I'm going to use W.
Do you see how convenient that is?

10
00:01:09,329 --> 00:01:12,650
W to go to the next word and
B to go back to the previous word.

11
00:01:13,329 --> 00:01:16,579
You can also jump in one way
to the end of the command line.

12
00:01:17,079 --> 00:01:23,980
You can also jump using one command to the end of
line. That will be $ or or to the beginning using caret.

13
00:01:25,640 --> 00:01:31,219
Now how about delete the current word? Well,
that would be dw. Oops, now it is deleted.

14
00:01:32,879 --> 00:01:35,480
In fact, I didn't
want to delete that.

15
00:01:36,760 --> 00:01:42,260
Let me use U for undo,
one of my favorites. Every now and

16
00:01:42,260 --> 00:01:47,760
then you need to open a
line above the current cursor position.

17
00:01:48,510 --> 00:01:53,715
Let me open a
line and call it facts

18
00:01:53,715 --> 00:01:58,920
about Linux using Escape
again and using senumber.

19
00:01:59,700 --> 00:02:05,944
Not because that is so useful here in this
example, but mainly because in programming it is very

20
00:02:05,944 --> 00:02:12,189
useful if you can refer to line numbers. You
don't want them to be around all the time.

21
00:02:12,949 --> 00:02:15,229
But just for
once that would do.

22
00:02:16,030 --> 00:02:22,176
Now I'm going to use Escape. And
did you see that I'm using Escape

23
00:02:22,176 --> 00:02:28,323
all the time? In fact, because pressing
Escape makes sure that I'm in command

24
00:02:28,323 --> 00:02:34,469
mode and I'm using shift zz,
which is shortcut for write and quit.

25
00:02:35,430 --> 00:02:37,310
I did not want
to write and quit.

26
00:02:38,150 --> 00:02:41,110
In fact I wanted
to open more text.

27
00:02:44,439 --> 00:02:47,300
I am going to
add one more line.

28
00:02:48,300 --> 00:02:54,319
Linux comes forward of
the Unix operating system.

29
00:02:54,960 --> 00:02:59,730
Now I'm going to do something that people
who are new to Linux do frequently. What do

30
00:02:59,730 --> 00:03:04,500
you do in Windows when you are done
editing your file? You close the window, right?

31
00:03:05,139 --> 00:03:09,879
And that's asking. Close the window? Yeah, let's
close the window. And now my window is gone.

32
00:03:10,219 --> 00:03:11,810
I don't have
my terminal anymore.

33
00:03:12,310 --> 00:03:14,150
So I need to
get back to my terminal.

34
00:03:14,870 --> 00:03:18,889
And in my terminal I'm going
to use vim demo file again.

35
00:03:19,569 --> 00:03:22,150
And now we get what I
wanted you to be aware of.

36
00:03:22,830 --> 00:03:23,990
So what is
it telling us?

37
00:03:24,530 --> 00:03:27,870
It's telling us that
the Swap file was found.

38
00:03:31,069 --> 00:03:32,870
demophile SWP what
is this swap file?

39
00:03:33,490 --> 00:03:40,389
This swap file is a file that is opened
by the VIM editor when you are editing the file.

40
00:03:40,990 --> 00:03:45,055
And if the file was
closed in an unexpected way then

41
00:03:45,055 --> 00:03:49,120
the swap fail will be
found allowing you to recover it.

42
00:03:49,759 --> 00:03:55,739
And that is why we get this explanation and all
the different options. Well, the option that I want is

43
00:03:55,739 --> 00:04:01,719
R for recover but also keep in mind the other
options if you're sure you don't need it, you can

44
00:04:01,719 --> 00:04:07,699
as well delete it or open read only to
check what is going on. But I want to recover.

45
00:04:09,539 --> 00:04:16,462
Then I can see that the recovery is completed
and I'm pressing enter and there we can see

46
00:04:16,462 --> 00:04:23,384
that even the last line that I have added
was committed to the SOP file. So yeah, my

47
00:04:23,384 --> 00:04:30,307
beautiful facts about Linux history file is now complete.
I would say before you quit this video, press

48
00:04:30,307 --> 00:04:37,230
the pause button and make sure that you read
the file because nothing in this is a lie.
