Recently, while mentoring Ma Su in programming, I found that he was always confused by the clutter of code files. Today, I want to share how to use Cursor’s grouping feature to organize code files and make programming work more structured!
Ma Su: Master, I am currently developing a mall project, and there are too many files. I keep switching between them and don’t even know which file I’m modifying…
Zhuge Liang: Hmm, that is indeed a common problem. However, with Cursor’s Tab grouping feature, these issues can be resolved.
Ma Su: Tab grouping? What a magical feature is that?
Zhuge Liang: Let me demonstrate. Suppose you are currently developing the user module of the mall…
Zhuge Liang: Let’s open all the files related to users:
# user.py
class User:
def __init__(self, name, email):
self.name = name
self.email = email
# auth.py
def login(username, password):
# Login logic
pass
# profile.py
def update_profile(user_id, data):
# Update user profile
pass
Ma Su: Wow, with all these files open, it’s overwhelming!
Zhuge Liang: Don’t worry, let me teach you a trick. Press <span>Ctrl + Alt + G</span>
(on Mac, it’s <span>Cmd + Alt + G</span>
), type “user module”, and these files will be grouped together.
Ma Su: Hey? These files really got automatically classified together! That’s amazing!
Zhuge Liang: Not only that, we can also create multiple groups. For example, put order-related files into another group:
# order.py
class Order:
def __init__(self, user_id, items):
self.user_id = user_id
self.items = items
# payment.py
def process_payment(order_id, amount):
# Process payment
pass
Ma Su: This way, there won’t be any confusion! How do I switch between different groups?
Zhuge Liang: You can use <span>Ctrl + Alt + Left/Right Arrow</span>
(on Mac, it’s <span>Cmd + Alt + Left/Right Arrow</span>
) to switch between groups, or simply click on the group name above to switch.
-
Right-click on the Tab to quickly add files to an existing group -
Drag and drop files onto the group name to quickly move files -
Double-click the group name to rename the group -
Press <span>Ctrl + W</span>
(on Mac, it’s<span>Cmd + W</span>
) to close the current file without affecting the group
Ma Su: Master, this trick is so useful! Now I can organize my related code files and won’t be flustered anymore.
Zhuge Liang: Exactly, managing your code files is as important as managing your army. Remember, to do a good job, you must first sharpen your tools.
With the Tab grouping feature, we can:
-
Organize related files together -
Quickly switch between different functional modules -
Improve development efficiency -
Keep the workspace tidy
Ma Su: Thank you for your guidance, Master! I will go organize my code files right away!
Zhuge Liang: Good, I believe you will master this skill soon. Remember, good tools combined with good habits will yield great results.
Finally, let me leave you with a saying: No matter how good the tools are, you need to practice more. Quickly open Cursor and try this useful feature!