Chapter 2: 5 minutes to get started
Imagine that you just bought a "programming tool" but don't know how to control it? don’t worry! In this chapter, we will learn Cursor's quick guide to get started, so that you can master AI programming like playing games!
1 Start using Cursor
1. Select the project directory
To start Cursor for the first time, you need:
- Click "Open Folder"
- Select the project folder you want to develop
- Wait for Cursor to open the directory
💡 **Tip: **
- It is recommended to choose a clean working directory
- If it is an existing project, select the project root directory
- Large projects may have to wait for a while for the first time to load
Shortcut key efficiency revolution
2. MagicalCtrl+K
(Mac user isCmd+K
), anywhere the floating window calls the chat box
Are you still worried about writing code? Try this magic button:
🎯 Practical Scene One: Write a Love Letter
You: Press Ctrl+K, type "Help me write a love letter emphasizing the kindness of the other person"
Cursor:
Of course! Here is a love letter emphasizing the kindness of the other person:
---
Dear [name of the other person],
On this ordinary day, I would like to take this opportunity to express to you the feelings that I have hidden in my heart for a long time. Whenever I see you, my heart is always filled with warmth and touching. Your kindness is like the sun, illuminating every corner of my life.
I often think of the way you treat others. Whether it is the care for your friends or the smile to strangers, you are always so sincere and gentle. Your kindness is not only reflected in words, but also in the warmth you convey with your actions. I deeply admire you for always being willing to listen to the troubles of others and give them support and encouragement.
In this fast-paced world, people like you are so precious. Your kindness makes me believe that there is still innocence and beauty in the world. Whenever I see you helping others, my heart is deeply moved. I hope to share this beauty with you and become a part of your life.
I want to tell you that my feelings for you are not only admiration, but also deep admiration. I hope to have the opportunity to walk through every day of the future with you, and share the joys and challenges of life. I am willing to use my heart to care for you, accompany you, and create beautiful memories with you.
Please let me know your intentions. No matter what the result is, I will respect your choice. Thank you for your kindness and warmth all the time, which gives me the courage to express my heart.
Looking forward to your reply.
Love you forever,
[your name]
---
I hope this letter can convey your deep affection for each other and your praise for their kindness!
🎯 Practical Scenario 2: Generate Data Table
You: Ctrl+K "Help me generate a student performance statistics table"
Cursor:
Of course! The following is an example of a simple student performance statistics table, presented in Markdown format. You can adjust the content and format as needed.
# Student score statistics table
| Student name | Math score | English score | Chinese score | Total score | Average score |
|----------|----------|----------|----------|----------|
| Zhang San | 85 | 90 | 88 | 263 | 87.67 |
| Li Si | 78 | 85 | 80 | 243 | 81.00 |
| Wang Wu | 92 | 88 | 91 | 271 | 90.33 |
| Zhao Liu | 75 | 80 | 78 | 233 | 77.67 |
| Sun Qi | 88 | 92 | 85 | 265 | 88.33 |
## Statistical information
- **Total number of students**: 5
- **Highest score**: 271 (Wang Wu)
- **Lowest score**: 233 (Zhao Liu)
- **Average score**: 83.80
You can add more students or subjects, or adjust the score data according to the actual situation. I hope this table can meet your needs!
💡 Tips: When holding Ctrl+K, you can box to select text/code snippets, and the AI will provide suggestions for the selected content!
3. Powerful Ctrl+L (Mac user is Cmd+L), the chat box is opened on the right, and the file cannot be created automatically.
This is your AI programming instructor window. If you have any questions, ask it:
- 🔍 Code Diagnosis: Select the error report code, Ctrl+L, and get the repair plan immediately
- 📝 Code explanation: Can't understand code? Ctrl+L Let AI explain it in plain language
- 🚀 Performance optimization: The code is too slow? Ctrl+L helps you find the optimization space
4. Intelligent Ctrl+I (Mac user is Cmd+I) multi-file creation mode, which can automatically create multiple project files after chat
This is your AI multi-file creation assistant window to help you generate the complete project code:
🎯 Practical scene: Generate full functions
You: Press Ctrl+I, enter "Create a to-do management system, write in HTML, save as index.html and put it in the current directory"
Cursor: Start generating immediately:
Okay, I will create a simple to-do management system HTML code for you and save it as index.html. This system will allow users to add, view and delete to-do items. Here is the code:
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>To-do Management System</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
#todoList {
list-style-type: none;
padding: 0;
}
#todoList li {
padding: 10px;
border: 1px solid #ccc;
margin: 5px 0;
display: flex;
justify-content: space-between;
}
</style>
</head>
<body>
<h1>To-do Management System</h1>
<input type="text" id="todoInput" placeholder="Enter To-do">
<button onclick="addTodo()">Add</button>
<ul id="todoList"></ul>
<script>
function addTodo() {
const input = document.getElementById('todoInput');
const todoText = input.value.trim();
if (todoText === '') {
alert('Please enter to-do items');
return;
}
const li = document.createElement('li');
li.textContent = todoText;
const deleteButton = document.createElement('button');
deleteButton.textContent = 'Delete';
deleteButton.onclick = function() {
li.remove();
};
li.appendChild(deleteButton);
document.getElementById('todoList').appendChild(li);
input.value = '';
} </script>
</body>
</html>
Description:
1. HTML structure: contains an input box and a button for adding to-do items.
Style: Simple CSS style makes the to-do list look neater.
JavaScript function: implements the functions of adding and deleting to-do items.
You can copy the above code into a file called index.html and open it in a browser to see the effect.
You can click "accept all", "accept file" "accept Y" to save the generated file
You can double-click the index.html file to view the effect on the browser
💡 Usage tips:
- The more detailed the description, the more accurate the generated code
- Tech stacks and frameworks can be specified
- Support step-by-step generation and modification
- After generation, you can continue to communicate and optimize
What is html https://baike.sogou.com/v340826.htm?fromTitle=html
🔥 Composer vs Chat:
- Composer (Ctrl+I): Generate complete project code, and can automatically generate files
- Chat (Ctrl+K): Answer questions and small pieces of code, and cannot automatically generate files
5. Mysterious @ Summoning
Enter @ in the editor to summon a powerful context assistant:
🎯 Document context
@doc Python3 → Immediately use Python's official documentation content as context
🎯 Code context
@file index.html → Import the specified code file as a reference
🎯 Web link context
@https://docs.godotengine.org/en/stable/ → Import godot's API documentation for reference
🎯 Conversation support support network search
@Web What free clients are available for DeepSeek R1?
🎯 Take the entire project as context
@Codebase lists the directory structure of the current project
💡Practical Tips:
- When using @, you can search fuzzyly, and Cursor will intelligently match related files
- Multiple @ commands can be used in combination to build richer contexts
- @The file path is connected to the back to support automatic completion function
- Full use reference https://docs.cursor.com/context/@-symbols/basic
💡 Practical Tips:
- Ask more about AI when you are uncertain, it won't bother you
- Complex needs can be asked in steps
- Not satisfied with the result? Tell me directly "change a plan" Remember: Cursor is your AI programming partner, don’t be shy and talk to it boldly! In the next chapter, we will explore how to use it to manage your personal projects~