0% found this document useful (0 votes)
30 views

Cursor AI入门指南

Cursor AI is an AI-powered code editor that integrates advanced AI capabilities to enhance software development, offering features like intelligent code suggestions, automated error detection, and dynamic code optimization. The guide covers installation on various operating systems and provides ten practical use cases to demonstrate its functionality. It also compares Cursor AI with GitHub Copilot, highlighting their unique features and integration capabilities.

Uploaded by

Carry Su
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Cursor AI入门指南

Cursor AI is an AI-powered code editor that integrates advanced AI capabilities to enhance software development, offering features like intelligent code suggestions, automated error detection, and dynamic code optimization. The guide covers installation on various operating systems and provides ten practical use cases to demonstrate its functionality. It also compares Cursor AI with GitHub Copilot, highlighting their unique features and integration capabilities.

Uploaded by

Carry Su
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

2025/3/7 15:17 Cursor AI: A Guide With 10 Practical Examples | DataCamp

Buy Now

EN

T U TO R I A L S category

Home Tutorials Artificial Intelligence

Cursor AI: A Guide With 10 Practical Examples


Learn how to install Cursor AI on Windows, macOS, and Linux, and discover
how to use it through 10 different use cases.

Contents Sep 2, 2024 · 10 min read

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.

Start Upskilling For Free

What Is Cursor AI and What Can It Do?


Cursor AI is an AI-powered code editor designed to make software development easier. As a
fork of Visual Studio Code (VS Code), it retains the user-friendly interface and extensive
ecosystem of VS Code, making it easier for developers already familiar with the platform to
transition.

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.

Key autocompletion features


Cursor offers key autocompletion and predictive code features:

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.

3. Multi-line edits: It can suggest edits that span multiple lines.

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.

6. Documentation integration: Reference popular libraries and add our own


documentation for quick access.

For a comprehensive list of features, for example, check Cursor’s feature page.

How to Install Cursor AI


Cursor AI provides an installation file for Linux, Windows, and MacOS that can be
downloaded for free on their website.

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:

chmod a+x cursor-0.40.3x86_64.AppImage

Explain code POWERED BY

Then, we can execute it with:

./cursor-0.40.3x86_64.AppImage

Explain code POWERED BY

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.

How to Use Cursor AI: 10 Use Cases


Throughout this guide, we’ll provide the MacOS shortcuts with the Cmd ⌘ key. The
shortcuts are the same if you use Cursor on Windows or Linux, except the Ctrl key is used
instead.

Inline code generation


We use the Cmd+K shortcut to open the inline code generator. This opens a small prompt
window where we insert a prompt to generate code:

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:

Interact with existing code


We can also use the inline chat to interact with existing code by selecting the relevant code
before using the Cmd+K shortcut. This can be used to make changes to the code, such as
refactoring, or to ask questions about the code. After typing the prompt, we click on the
Submit Edit button to get the modifications:

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

Asking questions about existing code


In the same way, we can ask questions about a piece of code by selecting it and using the
Cmd+K shortcut. In the case of a question, we click the quick question button to submit
the prompt:

After submitting the question, the system will generate the answer and display it in the
following manner:

Autocompletion with tab


While writing code, Cursor will suggest code completions generated using AI. Similar to
traditional code completion, we can use the Tab key to incorporate these suggestions into
our code.

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:

Chat interface overview


To open the chat window, use the Cmd+L shortcut. The chat window is more versatile than
the inline generator, as it allows us to not only generate code but also ask questions. Here’s
an overview of the chat interface:

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

Code generation with chat


Similarly to generating with the inline chat, we can also generate code using the chat
feature. The code generated in the chat can be integrated into the project by clicking the
Apply button at the top right corner of the code window.

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

Enhancing query context with @


Perhaps the most important feature of the chat window is the @ Mention option. This option
enables us to provide more data for the AI to generate the response. This ranges from simple
files and folders to web searches or giving the AI access to a GitHub repository.

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.

Global code base questions


One of the features that I find the most useful when working on bigger projects is the ability
to quickly find a piece of code by asking a question with the full codebase as scope.
Recently, I wanted to locate a function in a project that calculates the navigation direction
in an app. With Cursor, I could very simply locate it by describing what the function does:

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:

Cursor AI: Additional Features and Benefits


Language support
The examples we’ve shown in this article were in Python, HTML, and CSS. But Cursor is not
built with any specific language support in mind. Because its code generation is based on
general-purpose LLMs, Cursor can generate code in any programming language. It will use
the file extension to guess what language should be used.

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.

Collaboration with others


Using collaborative tools such as Git with Cursor is similar to using them with any code
editor. These tools are not dependent on how the code was written. There are extensions
specifically designed to assist with Git.

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.

Setting custom AI rules


Cursor allows us to guide the AI using specific rules. These are accessible under the general
settings menu:

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 vs GitHub Copilot


Cursor AI and GitHub Copilot are both AI-powered code assistants, each offering unique
features.

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.

From an integration perspective, Cursor AI offers significant customization within its


standalone VSCode-based environment, potentially enhancing workflow for some users. In
contrast, GitHub Copilot is noted for its easy setup and integration with widely-used IDEs,
which facilitates adoption for many developers.

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

What is Cursor AI?


Cursor AI is an innovative AI-powered code editor designed to streamline and enhance
the coding process. It uses artificial intelligence to provide advanced features like
intelligent code completion, code generation, and codebase understanding.

How to open the AI in the Cursor editor?

Is Cursor AI free?

Does Cursor use Claude?

Is Cursor based on VSCode?

Earn a Top AI Certification


Demonstrate you can effectively and responsibly use AI.

Get Certified, Get Hired

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

Develop AI applications with these courses!

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 Details Start Course

See More

Related
B LO G

ChatGPT Canvas: A Guide With


Examples

B LO G

What is AI? A Quick-Start Guide


For Beginners

B LO G
5 Projects You Can Build with
Generative AI Models (with…

See More

Grow your data skills with DataCamp for Mobile


Make progress on the go with our mobile courses and daily 5-minute coding challenges.

LEARN

Learn Python

Learn AI

Learn Power BI

Learn Data Engineering

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 Science Roadmap

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

Google Sheets Courses

Excel Courses

AI Courses

Data Analysis Courses

Data Visualization Courses

Machine Learning Courses

Data Engineering Courses

Probability & Statistics 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

Power BI Data Analyst

Tableau Certified Data Analyst

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

Book a Demo with DataCamp for Business

Data Portfolio

PLANS

Pricing

For Students

For Business

For Universities

Discounts, Promos & Sales

DataCamp Donates

FO R B U S I N E S S

Business Pricing

Teams Plan

Data & AI Unlimited 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

© 2025 DataCamp, Inc. All Rights Reserved.

https://www.datacamp.com/tutorial/cursor-ai-code-editor 17/17

You might also like