Cursor is a code editor designed that will help you write code quicker and extra successfully. It makes use of AI assistants that perceive your code, gives sensible tips, generates code snippets, or even is helping repair insects.

To benefit from Cursor, it’s vital to make use of it successfully. On this article, we’ll percentage sensible pointers and tips to spice up your workflow and get the most productive ends up in this AI-powered code editor.

Able to spice up your productiveness? Listed here are some sensible techniques to get probably the most out of Cursor.


1. Use the Cursor CLI

The cursor CLI is a command-line instrument for Home windows, macOS, and Linux that permits you to engage with the Cursor editor at once out of your terminal. To put in the CLI, you’ll be able to release the command palette with Cmd/Ctrl+P, and make a selection the Shell Command: Set up “cursor” command menu, as follows:

Installing Cursor CLI command through command palette

It really works in a similar fashion to the code CLI for VSCode. It lets in you, for instance, to create, set up, and open initiatives within the Cursor editor with out leaving the command line.

Along with venture control, the CLI additionally is helping you take care of extensions in Cursor. You’ll checklist put in extensions, replace them, or uninstall ones you now not want with easy instructions.

Listed here are a couple of examples of the way you’ll be able to use the cursor CLI:

Open present listing in Cursor editor:
cursor .
Upload folder to the ultimate energetic window:
cursor --add web page
Listing recently put in extensions:
cursor --list-extensions

The use of the CLI is especially helpful particularly in case you incessantly or want running within the Terminal, as it will assist making your building procedure extra environment friendly.


2. Use Context

The chat characteristic in Cursor means that you can engage with the AI assistant at once. You’ll ask questions, request code adjustments, and get tips that you’ll be able to follow with a unmarried click on.

One vital factor to keep in mind is that Cursor works highest while you give you the appropriate context. The extra related main points you come with, the easier its responses will probably be.

A good way to try this is via tagging related recordsdata the use of @. This is helping the AI perceive your code higher and provides extra exact tips.

As an example, if you wish to create a take a look at for a category, you’ll be able to tag the report.

Using @ symbol to tag files in Cursor chat for context

This manner it may possibly perceive higher what the code is ready and thus too can supply extra correct responses. Should you’re pleased with it, you’ll be able to merely click on at the Follow choice. It additionally understands the place to position it within the listing, as we will see beneath:

Applying AI-generated code suggestion in Cursor editor

3. Use Symbol for Context in Chat

Moreover, one of the most cool issues about Cursor chat is that you simply’re in a position to incorporate symbol as context. You’ll achieve this via drag-n-drop the picture at the chat field.

When a picture is integrated, it may possibly analyze it along the equipped textual content, enabling it to generate extra related and correct code. That is in particular helpful for duties that require visible cues, equivalent to updating consumer interfaces or replicating design components from mockups.

On this instance, we can use it to generate an SVG.

Using drag and drop image feature in Cursor chat

It’s lovely to hand!

However it’s vital to notice that effects would possibly range relying at the symbol’s complexity and the duty. It may possibly nonetheless battle with finer main points.


4. Use Customized Regulations

Cursor additionally ships with a characteristic known as Regulations for AI.

This option means that you can outline laws for the AI to apply when suggesting or producing codes. You’ll outline the layout, naming conventions, highest practices to your venture, or follow laws for particular recordsdata.

That is tremendous useful in case you’re running with a staff and want everybody to apply the similar coding laws, or in case you simply have a private means of doing issues. You can save time, steer clear of useless edits, and get tips that suit your workflow completely.

So, to arrange the principles, you’ll be able to cross to the Settings > Cursor Settings > Regulations. Click on at the + Upload new rule. Then, it is important to upload the identify, description, and optionally connect a report to the guideline.

Creating new AI rule in Cursor settings

Now, it’s time to arrange your laws.

Should you’re simply getting began, stay it easy. Don’t attempt to outline each rule without delay. Center of attention on crucial ones first. Then, take a look at how the AI responds and refine your laws as had to get the most productive effects.

Here’s an instance of the way we will describe the guideline:

Setting up PSR-12 coding standards in Cursor AI rules

This will likely ensure that the AI assistant would apply PSR-12 conference when producing PHP codes with few exceptions, and in addition follow particular rule to a one particular report.


5. Use Notepads

Some other characteristic in Cursor that may make your workflow much more environment friendly is Notepads. By way of default, this selection could be hidden within the editor, however you’ll be able to permit it via right-clicking at the Number one Sidebar at the appropriate aspect and settling on Notepads from the menu.

Enabling Notepads feature in Cursor sidebar

Now, you’ll be able to in finding Notepads within the Cursor sidebar. Create a brand new one with a transparent identify, upload your content material the use of undeniable textual content or markdown.

You’ll upload for instance the write down the venture structure selections, recording building pointers and highest practices, and serving to handle consistency throughout your codebase.

Should you incessantly use sure code snippets, Notepads can act as a to hand position to retailer reusable templates. It’s additionally nice for conserving incessantly referenced documentation, like API main points, troubleshooting steps, or inner workflows.

Here’s an instance the place we outline the structure selections for the Frontend initiatives:

Frontend architecture decisions documented in Cursor Notepad

Now, you’ll be able to refer your Notepads in Chat or in Composer (Agent) in Cursor, the use of @Notepads.

Referencing Notepad content in Cursor chat

6. Documentation Integration

Cursor, like all AI assistant or instrument, works highest when it has the appropriate context, equivalent to related documentation, to steer its responses.

In Cursor, you’ll be able to upload and reference exterior documentation at once within the editor to present the AI assistant get right of entry to to vital sources.

By way of default, Cursor already contains a variety of reliable documentation, overlaying frameworks like WordPress, Laravel, Vue, React, Angular, and plenty of extra. If the documentation you wish to have isn’t to be had, you’ll be able to simply upload it via offering a URL. That is particularly helpful for together with inner staff documentation. So long as the content material is publicly obtainable, Cursor can fetch and use it.

To contains documentation as reference, you’ll be able to sort @doctors within the chat field, after which you’ll be able to seek for the documentation you wish to have.

Searching for documentation using @docs command in Cursor

On this instance, I upload the connection with the WordPress reliable doctors and ask Cursor to create a submit sort.

Creating WordPress custom post type using documentation reference

Cursor is slightly sensible that it outlined the submit sort with a category with right kind identify, upload it in right kind listing, set the non-public strategy to false and upload all translatable labels with the right kind textual content area.


Wrapping Up

Cursor is an impressive AI assistant that assist you to write code quicker, and enhance your workflow. On this article, we’ve explored one of the most pointers and tips that assist you to get probably the most out of Cursor. Optimistically, you’ve discovered them helpful and will follow them on your personal initiatives.

The submit 6 Cursor AI Pointers You Will have to Know gave the impression first on Hongkiat.

WordPress Website Development Source: https://www.hongkiat.com/blog/essential-cursor-editor-tips/

[ continue ]