A text editor is an application
that enables you to view, create, or modify
the contents of text files.
Text editors were originally created to write programs
in source code, but are now used to edit a wide variety
of text based files.
Previously, in examples we used Vim mostly,
sometimes Nano, G edit is another option
but we're going to go into depth
about all the different commands that you can use
while performing tasks with these editors.
So the first one I'm going to check out is the Vim.
Now, if you don't have a file named this already
it's going to automatically create it for you.
Now, when you first enter into the Vim
you're going to be in command mode.
Now there's two modes, execute mode and insert mode.
To get to insert mode, you simply press the I key.
Press escape to get out of there.
And to get into the execute mode,
you're going to hit the colon.
And this allows you to do multiple commands,
like right, quit and different save functions.
So, first thing we need to do is insert.
We want to create a software listing for this example.
We're going to simply use this as any other editor.
Your going to put in a few names of some softwares.
Okay.
Now, to escape out of the insert mode where
you're going to simply use the escape key.
And again, we're going to go to the execute mode,
so there's going to be a colon.
We're going to do, right
which saves the file and quit out of the application.
Okay.
Now, if we want to view this, we can simply go to cat
and we're going to make sure we use this tab command
make sure were using that as much as possible to save time.
All right, and we can see that we have the
text successfully saved there.
Next we're going to do is work on editing and actual text.
So I created a software listing earlier,
and so we're going to copy this.
So the dash A just means recursively, make sure we
using our tab as much as possible.
So we're going to copy it.
That's the source.
The designation is going to be our home directory.
All right.
So we're going to list it out.
We're going to see that there, we're going to see the new
information that was input there.
Now, if you look at this text, we see there's a few errors
here with the spelling.
This is going to be a good time to use the keys
and the shortcuts in the Vim editor to just to
see how they operate.
So we're going to open it up.
Just going to simply use the X key.
So I'm going to remove this I from here,
and I'm going to put it after the F.
And we're use the P, which is paste.
Need to say that again.
Put it back here.
So cut,
paste,
cut,
paste.
So it's always going to put it
after the letter that's selected with the cursor.
Next thing we're going to do is actually use example to search
for other texts.
So we're going to look for that mistake again and here.
We'll see it highlights it for us.
Also to use this search function,
we're just going to use the forward slash for this.
And now we're going to use the K key to go up
and the J go down.
Just other keys that we can use.
Just testing those out.
We're going to do the same thing.
I'm going to cut this.
I'm going to paste it here
to make a quick correction.
And since you have the
versions already in the separate column, we can delete this.
Let's delete key.
So you don't have to be in insert mode again
to actually delete and cut and paste different things.
So that's a good function of this.
So we can go through here
do a few more edits, delete the red hat.
Now, if you want to go to the beginning of a line
you could use the shift six, the carrot symbol
and to quickly delete a line
we can easily just do the double D.
So just say, we already have the window server
somewhere else or no longer need it.
Double D and see that's gone.
So let's get out of here
again, right quit.
Make sure those changes saved.
Simple as that.
Next thing we're going to do is edit the file.
But this time we're going to use the Nano.
Now, if you can see here, most of the commands are used
with the control key, just to know it shows 'em
all capitalized, but you're going to use the lower case version
of these letters.
Again, we're just going to go through and do a few things.
You can go through here, again, delete as needed.
The regular delete key.
Let's see, we have Firefox here twice.
So we just do is control K.
That's another way we can delete entire line.
And with Nano we go immediately into insert mode
so we can start typing.
We're do apache here, tomcat,
give it some type of version.
Okay.
And now in Nano, control O that's what's going to
save the file.
We going to put enter here.
And to exit out we'll simply do control X.
Just like last time, make sure these changes were saved.
So again, a text editor is very basic
so we just went through a few of the shortcuts
of how to quickly navigate through these text files
and make quick changes by deleting entire lines
cutting and pasting and things of that nature.
Now I'll see you in the next lesson.