WEBVTT

00:00:00.300 --> 00:00:04.189
Now we'll start simple. I'm back in
that demo PY file, which I

00:00:04.240 --> 00:00:08.180
created before,
and let's say in there I wanna open a

00:00:08.220 --> 00:00:11.400
demo.txt,
which just has the text Hello World.

00:00:11.460 --> 00:00:15.459
Obviously, not too exciting,
but I wanna open that demo.txt

00:00:15.520 --> 00:00:19.280
file in demo PY. Now, of course,
you can do that with the

00:00:19.600 --> 00:00:23.500
width clause here, and then this code here

00:00:23.560 --> 00:00:25.940
on the right, I haven't typed this yet.

00:00:25.980 --> 00:00:29.820
This is suggested by Cursor,
and of course,

00:00:29.880 --> 00:00:32.189
from GitHub Copilot, for example.

00:00:32.220 --> 00:00:34.700
But Cursor has it as well,
and it's really fast.

00:00:34.760 --> 00:00:38.680
So yeah, here it even understands
that I have

00:00:38.740 --> 00:00:42.300
a file named demo.txt because it's in the
same

00:00:42.340 --> 00:00:46.020
project and I just created it.
So it has this context which

00:00:46.080 --> 00:00:50.000
is not just the line in
which you're currently typing, it's

00:00:50.020 --> 00:00:53.880
also the surrounding code
and some parts of the general project.

00:00:53.900 --> 00:00:57.860
It's not the entire code base of all your
files and your entire project

00:00:57.900 --> 00:01:01.820
necessarily, but the code pieces
or files you last worked

00:01:01.880 --> 00:01:05.840
in,
they are typically remembered by Cursor,

00:01:05.880 --> 00:01:09.210
and are used for generating these smart
completion

00:01:09.300 --> 00:01:13.250
suggestions. So by just hitting tab,
I can accept this, and

00:01:13.300 --> 00:01:16.350
now you see I'm getting more suggestions.

00:01:16.360 --> 00:01:20.170
And just to be clear, this is AI. This
is at the point of

00:01:20.200 --> 00:01:23.580
time where I'm recording this.
You might not get these same

00:01:23.700 --> 00:01:27.540
suggestions.
You might not be getting any suggestions

00:01:27.740 --> 00:01:31.030
suggestions, but Cursor
is capable of making

00:01:31.660 --> 00:01:35.520
complex multiline edits based on what you
just did in your overall code

00:01:35.580 --> 00:01:38.630
base like this. So here, it in the end is

00:01:38.640 --> 00:01:42.260
suggesting different ways of opening
that file.

00:01:42.320 --> 00:01:45.940
It suggests writing to it, and then, uh,
again

00:01:46.060 --> 00:01:49.540
opening it to reading it,
then to write but

00:01:49.720 --> 00:01:52.640
in append mode, and then again to read it.

00:01:52.680 --> 00:01:56.160
Now,
that's not necessarily what I want here,

00:01:56.200 --> 00:02:00.080
all by just hitting tab one more time
and all that code would've been

00:02:00.120 --> 00:02:04.040
accepted. But as mentioned,
I don't want that, so I'll revert it,

00:02:04.050 --> 00:02:07.770
type a colon again to get some suggestions
again, and if I just

00:02:07.800 --> 00:02:11.700
wanna accept the next line, for example,
I can do that by

00:02:11.740 --> 00:02:15.300
hitting command right arrow on MacOS and

00:02:15.340 --> 00:02:18.900
control right arrow on Windows, and
that allows me to

00:02:18.940 --> 00:02:22.400
accept the suggestion one word or one

00:02:22.580 --> 00:02:26.329
symbol at a time. So now I accepted

00:02:26.560 --> 00:02:30.250
just this line of code, and
if I hit escape, I discard the other

00:02:30.260 --> 00:02:33.980
suggestion. So that is pretty useful too.

00:02:34.020 --> 00:02:36.450
Now,
let's say I wanna put this code into a

00:02:36.480 --> 00:02:37.950
There are different ways of doing that.

00:02:38.020 --> 00:02:41.740
One quick way is to just add some new
lines and move my

00:02:41.780 --> 00:02:45.329
cursor there, and in my case,
it even already suggests that I

00:02:45.460 --> 00:02:49.390
might wanna create a function here,
giving me that nice preview in that

00:02:49.400 --> 00:02:52.220
window here.
So it also sometimes does that.

00:02:52.230 --> 00:02:56.060
And if I click view here,
I can view the suggested code change in

00:02:56.100 --> 00:02:59.820
greater detail.
So it suggests to delete these two empty

00:02:59.880 --> 00:03:03.580
lines and instead add this line,
and I can accept it by

00:03:03.620 --> 00:03:07.460
clicking this check mark
or close it to discard it.

00:03:07.500 --> 00:03:11.200
I'll accept it though. Here we go.
And then I got more

00:03:11.320 --> 00:03:15.140
suggestions,
and you can see it can also remove or

00:03:15.300 --> 00:03:19.280
change code, not just add code.
Here it's suggesting that

00:03:19.340 --> 00:03:22.940
it removes this demo text string

00:03:22.980 --> 00:03:26.829
here. That's why it's highlighted in red,
and instead, you can see it

00:03:26.900 --> 00:03:30.840
suggests using a variable here,
a variable filename.

00:03:30.920 --> 00:03:33.680
And it suggests all these changes I can
see here.

00:03:33.740 --> 00:03:37.480
Again, I could view them
or click accept or hit tab to

00:03:37.520 --> 00:03:41.180
accept it all in one go, and that's that.

00:03:41.200 --> 00:03:45.120
If I hit tab again, this is all confirmed,
and all this code here

00:03:45.200 --> 00:03:48.950
was now generated by Cursor.
It's giving me a write to

00:03:49.040 --> 00:03:52.880
file and a read from file function just
because I moved up there

00:03:53.380 --> 00:03:56.260
and added two empty lines, remember.

00:03:56.300 --> 00:03:59.269
So that's Cursor's tab completion feature
in a nutshell.

00:03:59.300 --> 00:04:01.710
It's really fast, really powerful.

00:04:01.740 --> 00:04:05.470
If I, for example,
change this here to F name,

00:04:05.480 --> 00:04:09.190
better, it suggests
that I can update it here with a tab, and

00:04:09.220 --> 00:04:12.650
then it suggests that next we jump here.

00:04:12.660 --> 00:04:16.600
So if I press tab, I move my cursor here,
and then it suggests these

00:04:16.720 --> 00:04:20.640
changes to rename these variables just
because I renamed them up

00:04:20.660 --> 00:04:24.090
there. So it's picking up on that,
and with another tab, this is

00:04:24.090 --> 00:04:27.840
accepted. And therefore,
this tab feature is pretty

00:04:27.900 --> 00:04:30.690
useful because it allows you to stay in
control.

00:04:30.760 --> 00:04:33.930
You make the general changes to your code,
or you

00:04:34.020 --> 00:04:37.540
initiate those changes, you could say,
but then by hitting tab, tab,

00:04:37.600 --> 00:04:41.180
tab, you can fly free your code base
and let Cursor do the

00:04:41.220 --> 00:04:43.380
rest.
