Now we'll start simple. I'm back in that demo PY file, which I
created before, and let's say in there I wanna open a
demo.txt, which just has the text Hello World.
Obviously, not too exciting, but I wanna open that demo.txt
file in demo PY. Now, of course, you can do that with the
width clause here, and then this code here
on the right, I haven't typed this yet.
This is suggested by Cursor, and of course,
from GitHub Copilot, for example.
But Cursor has it as well, and it's really fast.
So yeah, here it even understands that I have
a file named demo.txt because it's in the same
project and I just created it. So it has this context which
is not just the line in which you're currently typing, it's
also the surrounding code and some parts of the general project.
It's not the entire code base of all your files and your entire project
necessarily, but the code pieces or files you last worked
in, they are typically remembered by Cursor,
and are used for generating these smart completion
suggestions. So by just hitting tab, I can accept this, and
now you see I'm getting more suggestions.
And just to be clear, this is AI. This is at the point of
time where I'm recording this. You might not get these same
suggestions. You might not be getting any suggestions
suggestions, but Cursor is capable of making
complex multiline edits based on what you just did in your overall code
base like this. So here, it in the end is
suggesting different ways of opening that file.
It suggests writing to it, and then, uh, again
opening it to reading it, then to write but
in append mode, and then again to read it.
Now, that's not necessarily what I want here,
all by just hitting tab one more time and all that code would've been
accepted. But as mentioned, I don't want that, so I'll revert it,
type a colon again to get some suggestions again, and if I just
wanna accept the next line, for example, I can do that by
hitting command right arrow on MacOS and
control right arrow on Windows, and that allows me to
accept the suggestion one word or one
symbol at a time. So now I accepted
just this line of code, and if I hit escape, I discard the other
suggestion. So that is pretty useful too.
Now, let's say I wanna put this code into a
There are different ways of doing that.
One quick way is to just add some new lines and move my
cursor there, and in my case, it even already suggests that I
might wanna create a function here, giving me that nice preview in that
window here. So it also sometimes does that.
And if I click view here, I can view the suggested code change in
greater detail. So it suggests to delete these two empty
lines and instead add this line, and I can accept it by
clicking this check mark or close it to discard it.
I'll accept it though. Here we go. And then I got more
suggestions, and you can see it can also remove or
change code, not just add code. Here it's suggesting that
it removes this demo text string
here. That's why it's highlighted in red, and instead, you can see it
suggests using a variable here, a variable filename.
And it suggests all these changes I can see here.
Again, I could view them or click accept or hit tab to
accept it all in one go, and that's that.
If I hit tab again, this is all confirmed, and all this code here
was now generated by Cursor. It's giving me a write to
file and a read from file function just because I moved up there
and added two empty lines, remember.
So that's Cursor's tab completion feature in a nutshell.
It's really fast, really powerful.
If I, for example, change this here to F name,
better, it suggests that I can update it here with a tab, and
then it suggests that next we jump here.
So if I press tab, I move my cursor here, and then it suggests these
changes to rename these variables just because I renamed them up
there. So it's picking up on that, and with another tab, this is
accepted. And therefore, this tab feature is pretty
useful because it allows you to stay in control.
You make the general changes to your code, or you
initiate those changes, you could say, but then by hitting tab, tab,
tab, you can fly free your code base and let Cursor do the
rest.