WEBVTT

00:00:00.280 --> 00:00:04.140
Besides the very useful tab feature,
Cursor also has a built-in

00:00:04.260 --> 00:00:08.160
chat feature. It has a main chat,
the AI agent to which we'll get back

00:00:08.200 --> 00:00:12.130
later, but it also has the inline chat,
which you can open with

00:00:12.160 --> 00:00:15.380
command or control K,
depending on your operating

00:00:15.400 --> 00:00:19.210
system.
And the cool thing about this inline chat

00:00:19.280 --> 00:00:23.260
just highlight the code you want to change
and then

00:00:23.300 --> 00:00:27.200
press either quick edit to open it or

00:00:27.260 --> 00:00:30.280
this shortcut I mentioned, command
or control K.

00:00:30.320 --> 00:00:32.580
You can choose the AI model you want to
use here.

00:00:32.600 --> 00:00:36.000
Either let Cursor choose one
or choose one manually.

00:00:36.020 --> 00:00:39.940
You can control which models
are available here by clicking add models,

00:00:39.980 --> 00:00:43.960
takes you to the settings,
and there you can enable

00:00:44.000 --> 00:00:47.930
that are available in Cursor. Of course,
the model names will

00:00:47.940 --> 00:00:51.880
be different when you're viewing this
because they change all the time.

00:00:51.900 --> 00:00:55.640
But then once you made your decision,
and of course Cursor will memorize it and

00:00:55.760 --> 00:00:59.420
use that model for the future too until
you change it again, you can tell

00:00:59.460 --> 00:01:03.340
Cursor what you want to change.
For example, what if we don't want to

00:01:03.420 --> 00:01:06.880
have a function that takes a file name
and content as input?

00:01:06.920 --> 00:01:10.140
Instead, we want a function
that asks the user for that.

00:01:10.220 --> 00:01:13.720
So we could simply tell Cursor function
should ask

00:01:13.840 --> 00:01:17.290
user for filename and content,
something like this.

00:01:17.300 --> 00:01:20.820
If we hit enter,
it will analyze the highlighted code

00:01:20.830 --> 00:01:24.740
suggest changes. And as always,
if it does something like

00:01:24.780 --> 00:01:28.270
this, it gives us a preview.
Highlighted in red is the code that will

00:01:28.300 --> 00:01:31.520
disappear. And highlighted in green
is the code it wants to

00:01:31.620 --> 00:01:35.480
add. In this case,
it wants to change the function definition

00:01:35.580 --> 00:01:39.460
to no longer accept parameters,
and instead it wants to get these

00:01:39.520 --> 00:01:43.500
values by using Python's built-in input
function, which allows the user to

00:01:43.540 --> 00:01:45.240
enter these values in the command line.

00:01:46.060 --> 00:01:49.700
So I can then press keep
or use the shortcut that's shown here or

00:01:49.820 --> 00:01:53.560
click undo or click accept or reject here

00:01:53.620 --> 00:01:55.950
or use the appropriate shortcuts.

00:01:55.980 --> 00:01:59.640
The difference is
that it could be suggesting different

00:01:59.660 --> 00:02:03.520
affect some but not all lines.
Then you could accept them on a

00:02:03.560 --> 00:02:07.100
per line basis with these buttons,
or just accept or

00:02:07.160 --> 00:02:10.479
reject all suggested changes in one go
with these

00:02:10.500 --> 00:02:14.180
buttons. In this case for this example,
it's the same, so I'll just

00:02:14.220 --> 00:02:18.160
accept by using the accept shortcut,
and that gives me an updated

00:02:18.200 --> 00:02:21.960
function. Now, of course,
with this function changed,

00:02:22.020 --> 00:02:25.940
longer valid, which is why
when I highlight it

00:02:25.980 --> 00:02:29.840
for me,
I'm getting the tab suggestion to remove

00:02:29.980 --> 00:02:32.900
code, these two strings.
It's highlighted in red.

00:02:32.920 --> 00:02:36.750
So if I hit tab, that's accepted,
and now it even wants to continue

00:02:37.180 --> 00:02:39.900
and it assumes that for reading the file I
want to do the same.

00:02:39.960 --> 00:02:43.840
So I could hit tab again to also get rid
of the

00:02:43.880 --> 00:02:47.580
parameter here and read from file,
hit tab to jump here, and

00:02:47.620 --> 00:02:51.140
then accept this change and do
that for the entire

00:02:51.180 --> 00:02:53.320
file. So that's what I was referring to.

00:02:53.360 --> 00:02:56.710
You can really quickly make changes in
your

00:02:56.740 --> 00:03:00.680
file. But initially,
we started by using this inline chat to

00:03:00.760 --> 00:03:04.579
tell Cursor which code to change in
which way, which is another

00:03:04.620 --> 00:03:07.480
very powerful way of adjusting your code
with help of

00:03:07.540 --> 00:03:09.920
AI.
