Effectively Using Cursor for 10x Coding


Image by Author | Ideogram.ai

 

Much of our work has changed tremendously in the era of generative AI. This includes coding work, where the large language model (LLM) tremendously boosts the process.

Recently, many code-assisting tools powered by generative AI have been launched. Many do the same things, but one tool that catches the public’s eye is Cursor. Cursor is an AI-powered Code Editor designed for developers to focus on improving their working experience rather than only fixing their code.

The cursor is helpful to developers, including data scientists. This article will explore how to use the IDE effectively for 10x coding.

How does it work? Let’s get into it.
 

Effectively Using Cursor

 
Cursor is an IDE that was initially a fork of VS Code, so it will be easy for you to jump into Cursor if you are already familiar with the latter.

As I mentioned above, Cursor is an IDE powered by Generative AI that helps us code. But how exactly does the Cursor help? There are many features available, but generally, Cursor helps you in three ways:

  1. Code Autocomplete
  2. Chatting with your Codebase
  3. Edit and Write your Code

Those are the general features you can expect from Cursor, but we will explore in more detail how to use Cursor effectively.

As a reminder, the code quality will depend on the LLM model you use. As of the time this article was written, Cursor only allows the GPT family, Claude family, and Cursor Small model. It’s also possible to use the Google model, but you need to assign your API key.

Speaking of assigning your API key, all the family models above can be accessed via your API key if you want to use expenses coming from your account. If not, you can access the premium model with a Cursor subscription. The Cursor Small model is always free, but the quality might be better than that of the other model.

Let’s start using Cursor for our work. Before we begin, ensure that you have installed Cursor in your environment.

 

Code Generation and Editing

 
We will try out the code generation feature. To do that, press the Ctrl + K button, and the text bar will appear.

For the example. We generate the script to read the CSV data and train the model. You can follow the prompt below.
 
Effectively Using Cursor for 10x CodingEffectively Using Cursor for 10x Coding
 
As you can see in the above image, the generated code is available instantly. You can choose to accept the code, reject it, or put a follow-up instruction in it.

Another example of code generation is using existing code and working based on that. In the image below, we will ask Cursor for further options for model evaluation, and Cursor will provide them.
 
Effectively Using Cursor for 10x CodingEffectively Using Cursor for 10x Coding
 

When you already have the code generated or have the script in your environment, Cursor can suggest appropriate code for our work. If you accept them, you only need to press the tab button, and the code will be generated.

 
Effectively Using Cursor for 10x CodingEffectively Using Cursor for 10x Coding
 

Even if you write the code carelessly, Cursor can help you fix it and gauge your intention.
 
Effectively Using Cursor for 10x CodingEffectively Using Cursor for 10x Coding
 

With all the features above, you will improve your work efficiency in developing your data science project.
 

Chat with Your Codebase

 
The other feature that Cursor is good at is to allow you to chat with your code. By chatting, you can specifically chat on your whole code script or a particular part of the code. Either way, press the Ctrl + L button to chat with your code.

For example, we chatted with our previously generated code as a reference, and we asked to improve the code.
 
Effectively Using Cursor for 10x CodingEffectively Using Cursor for 10x Coding
 

As the image above shows, the Cursor explains your instructions and code suggestions. It will not automatically apply the code to your code, as we need to press the Apply button to apply the suggestion.
 
Effectively Using Cursor for 10x CodingEffectively Using Cursor for 10x Coding
 

Then, you should accept the changes for each transformed code as well. The transformation will not remove your original code until you agree with the changes.

 
Effectively Using Cursor for 10x CodingEffectively Using Cursor for 10x Coding
 

Next, the chat feature allows you to mention additional files from your environment or even the internet. The cursor called it a “mention” feature.

 
Effectively Using Cursor for 10x CodingEffectively Using Cursor for 10x Coding
 
For example, we will ask Cursor to scour the web to improve our code, as in the image below.

 
Effectively Using Cursor for 10x CodingEffectively Using Cursor for 10x Coding
 
Just like the previous example, the code result needs to be applied manually.

Lastly, it’s possible to attach images in the chat features. By doing that, we can chat with our codes while also having image references.

For example, I want to produce a specific plot like the image I have from the current code I have. In this case, I could attach an example of my image and ask the Cursor to provide instructions on how to generate the plot.
 
Effectively Using Cursor for 10x CodingEffectively Using Cursor for 10x Coding
 
The mentioned feature is mighty as you can attach many things while you can keep following up with whatever you need.

That’s all you need to know to use Cursor effectively.
 

Conclusion

 
Cursor is a programming IDE that is designed to assist developers in coding works with Generative AI. Mainly there are three main features you can use to use Cursor effectively:

  1. Code Autocomplete
  2. Chatting with your Codebase
  3. Edit and Write your Code

By utilizing all the features above, you can improve your coding work by 10x. The IDE development is still in progress as well, so keep paying attention to the Cursor features that might help your work.

I hope this has helped!
 
 

Cornellius Yudha Wijaya is a data science assistant manager and data writer. While working full-time at Allianz Indonesia, he loves to share Python and data tips via social media and writing media. Cornellius writes on a variety of AI and machine learning topics.

Recent Articles

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here