Cursor AI入门指南
Cursor AI入门指南
Buy Now
EN
T U TO R I A L S category
François Aubry
Passionate teacher crafting engaging online courses for all learners.
TO P I C S
Artificial Intelligence
Generative AI
I have often copied and pasted code into ChatGPT to ask why it isn’t working, to refactor it,
or simply to explain it to me. However, switching between my code editor and ChatGPT can
get a bit tedious.
AI editors solve this problem by integrating GPTs directly into code editors. By integrating
directly with our code, GPTs gain more context about the overall project, which significantly
enhances their output.
In this article, we’ll explore one of the most popular code editors: Cursor AI. Trusted by
engineers at OpenAI and Perplexity, Cursor AI offers AI-assisted coding, intelligent code
suggestions, and integration with various development tools.
Develop AI Applications
Learn to build AI applications using the OpenAI API.
Cursor AI integrates advanced AI capabilities through OpenAI’s ChatGPT and Claude. This
integration allows Cursor AI to offer intelligent code suggestions, automated error detection,
and dynamic code optimization.
https://www.datacamp.com/tutorial/cursor-ai-code-editor 1/17
2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp
1. Autocomplete and code prediction: Cursor provides autocomplete functionality that
predicts multi-line edits and adjusts based on recent changes.
2. Code generation: Familiar with recent changes, Cursor predicts what we want to do
next and suggests code accordingly.
4. Smart rewrites: The editor can automatically correct and improve our code, even if
we type carelessly.
5. Cursor prediction: It predicts the next cursor position, allowing seamless navigation
through the code.
Chat features
Cursor also integrates advanced chat features to facilitate better interaction:
1. Codebase answers: Query Cursor about the codebase, and it will search through the
files to provide relevant answers.
2. Code reference: Reference specific blocks of code or files, integrating them into the
context of our queries.
3. Image support: Drag images into the chat or use buttons to add visual context.
4. Web search: Get the latest information from the internet directly into code queries.
5. Instant apply: Implement code suggestions from the chat directly into the codebase
with a click of a button.
For a comprehensive list of features, for example, check Cursor’s feature page.
To install it on Windows and MacOS, we download it from their home page and install the
download file as we’d install any other program.
In Linux, it comes as an AppImage file. Before executing it, we need to make it executable
using:
./cursor-0.40.3x86_64.AppImage
We may need to replace the version 0.40.3x86_64 in the above commands depending on
which version was downloaded. For more instructions on how to install app image files,
check out their website.
https://www.datacamp.com/tutorial/cursor-ai-code-editor 2/17
2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp
After installing, we’re prompted with the following configuration screen:
Keyboard: This option lets us configure the keyboard shortcuts. By default, it uses the
VS Code shortcuts, which I recommend unless you are familiar with another code
editor on the list.
Language for AI: Here, we have the option of using a non-English language to interact
with the AI.
Codebase-wide: Enabling this option allows the AI to understand the context of the
entire codebase.
Add terminal command: If installed, these allow the Cursor AI editor to run from the
terminal.
To generate code, we type a prompt and then click the generate button:
https://www.datacamp.com/tutorial/cursor-ai-code-editor 3/17
2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp
This will generate the code, and we add it to our project by clicking the accept button:
In this case, we used the cloude-3.5-sonnet model. We can select another model using the
model dropdown selector:
Code changes in the Cursor are presented as a diff. The red lines represent lines that will be
deleted by the change, while the green ones represent the new changes that will be added:
https://www.datacamp.com/tutorial/cursor-ai-code-editor 4/17
2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp
After submitting the question, the system will generate the answer and display it in the
following manner:
For example, let's say we start implementing a function named maximum() . Cursor will
recognize our intent and suggest an appropriate implementation. By pressing Tab , we can
add the suggested code:
https://www.datacamp.com/tutorial/cursor-ai-code-editor 5/17
2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp
Autocomplete also works with code written in natural language. For example, if we want to
create a double for loop to iterate over all pairs in a list, we can simply describe this in plain
text. Cursor will then provide the corresponding autocomplete suggestion, which can be
integrated by pressing the Tab key:
https://www.datacamp.com/tutorial/cursor-ai-code-editor 6/17
2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp
https://www.datacamp.com/tutorial/cursor-ai-code-editor 7/17
2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp
For example, we can use @Web to allow the AI to search the web for the answer.
https://www.datacamp.com/tutorial/cursor-ai-code-editor 8/17
2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp
Keep in mind that in some cases it might be problematic to share the whole code base or a
private GitHub repository with the AI. We should be mindful of what we share with the AI
and avoid sharing sensitive or private data.
Note that we use the codebase option in this case. Although Cursor didn’t display the
actual code for some reason, clicking the code box still opened the correct file and scrolled
to the function I was looking for:
Image support
The Cursor chat also supports image inputs. For example, we could sketch a UI design for a
website and ask it to generate the HTML and CSS code for it. To add an image, we can drag
and drop it into the chat window.
Adding documentation
A very useful feature of Cursor AI is the ability to add documentation references. This is
especially useful for lesser-known or private libraries whose documentation might not have
been used in the AI training process.
To add a documentation entry, we use the @ symbol and then select Docs from the
dropdown menu:
https://www.datacamp.com/tutorial/cursor-ai-code-editor 9/17
2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp
This will open a window requesting a URL for the documentation. Let’s add the PyTorch
documentation as an example:
After inserting the URL, we can give the documentation entry a name. In this case, we use
PyTorch . We can then use this name to refer to this documentation in the chat prompt
using @PyTorch .
Documentation references can also be managed in the Features tab from the Cursor
settings:
Extensions
https://www.datacamp.com/tutorial/cursor-ai-code-editor 10/17
2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp
Because Cursor is built on top of VS Code, it inherits from its rich extension ecosystem. We
can access these in the View menu.
To set up Cursor to work with Python, I recommended the VSCode Python setup tutorial, as
the same features should be available on both VSCode and Cursor.
Remember that Cursor’s chat allows you to use Git repositories within context using the @
operator. Be mindful that this should be used with caution if the repository contains private
data.
https://www.datacamp.com/tutorial/cursor-ai-code-editor 11/17
2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp
These rules can modify the AI's behavior without needing to prompt it repeatedly. For
example, we can ensure the AI always uses type hints in Python by adding a rule such as
"Always use type hints in Python function definitions."
Custom AI models
Another interesting feature of Cursor is the ability to add other AI models. This option can be
found under the Models settings:
Here we can add new models. These model settings also make it possible to add our API
keys if we want.
Cursor AI is built on VSCode and functions as a standalone editor. It integrates closely with
the coding environment to automate tasks and provide intuitive code suggestions, which
helps streamline code writing and refactoring. It is particularly suited for developers who
prefer a deep integration with a familiar IDE.
GitHub Copilot, developed by GitHub and OpenAI, integrates with various popular code
editors like Visual Studio Code. It provides context-aware code suggestions based on the
user’s coding style and project context. GitHub Copilot excels at predicting subsequent lines
of code and supports a wide range of programming languages and frameworks.
Both tools provide real-time code suggestions and support for multiple languages and
frameworks. Cursor AI may be advantageous for specialized tasks due to its deep
integration, while GitHub Copilot’s extensive IDE support and straightforward setup make it
accessible to a broader audience.
Ultimately, the choice between Cursor AI and GitHub Copilot may depend on factors like
customization needs, integration preferences, and budget. Both tools aim to enhance coding
https://www.datacamp.com/tutorial/cursor-ai-code-editor 12/17
2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp
efficiency in different ways.
Conclusion
Tools like ChatGPT have made programming much more accessible by allowing users to
write code simply by explaining their goals in natural language. Cursor takes this a step
further by directly integrating with the code editor, eliminating the need to switch between
the editor and a chat interface.
While Cursor AI offers a comprehensive standalone solution specifically designed for deep
integration within the VSCode environment, tools like GitHub Copilot provide versatility
across various popular IDEs. The choice between the two ultimately relies on individual
needs and preferences for customization and ease of setup.
In summary, Cursor AI is a powerful, AI-driven code editor that promises to change how
developers approach coding, refactoring, and debugging.
FAQs
Is Cursor AI free?
AUTHOR
François Aubry
Teaching has always been my passion. From my early days as a student, I eagerly sought
out opportunities to tutor and assist other students. This passion led me to pursue a PhD,
where I also served as a teaching assistant to support my academic endeavors. During
those years, I found immense fulfillment in the traditional classroom setting, fostering
connections and facilitating learning. However, with the advent of online learning platforms, I
recognized the transformative potential of digital education. In fact, I was actively involved
in the development of one such platform at our university. I am deeply committed to
integrating traditional teaching principles with innovative digital methodologies. My passion
is to create courses that are not only engaging and informative but also accessible to
learners in this digital age.
TO P I C S
https://www.datacamp.com/tutorial/cursor-ai-code-editor 13/17
2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp
Artificial Intelligence Generative AI
TRACK
Developing AI Applications
23hrs hr
Learn to create AI-powered applications with the latest AI developer tools, including the OpenAI API, Hugging Face, and LangChain.
See More
Related
B LO G
B LO G
B LO G
5 Projects You Can Build with
Generative AI Models (with…
See More
LEARN
Learn Python
Learn AI
Learn Power BI
Assessments
https://www.datacamp.com/tutorial/cursor-ai-code-editor 14/17
2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp
Career Tracks
Skill Tracks
Courses
DATA C O U R S E S
Python Courses
R Courses
SQL Courses
Power BI Courses
Tableau Courses
Alteryx Courses
Azure Courses
AWS Courses
Excel Courses
AI Courses
DATA L A B
Get Started
Pricing
Security
Documentation
C E R T I F I C AT I O N
Certifications
Data Scientist
Data Analyst
Data Engineer
SQL Associate
Azure Fundamentals
AI Fundamentals
https://www.datacamp.com/tutorial/cursor-ai-code-editor 15/17
2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp
RESOURCES
Resource Center
Upcoming Events
Blog
Code-Alongs
Tutorials
Docs
Open Source
RDocumentation
Data Portfolio
PLANS
Pricing
For Students
For Business
For Universities
DataCamp Donates
FO R B U S I N E S S
Business Pricing
Teams Plan
Customer Stories
Partner Program
ABOUT
About Us
Learner Stories
Careers
Become an Instructor
Press
Leadership
Contact Us
DataCamp Español
DataCamp Português
DataCamp Deutsch
DataCamp Français
https://www.datacamp.com/tutorial/cursor-ai-code-editor 16/17
2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp
S U P PO R T
Help Center
Become an Affiliate
Privacy Policy Cookie Notice Do Not Sell My Personal Information Accessibility Security Terms of Use
https://www.datacamp.com/tutorial/cursor-ai-code-editor 17/17