cursor Usage 官网中文翻译双语版 | 少将全栈
  • 欢迎访问少将全栈,学会感恩,乐于付出,珍惜缘份,成就彼此、推荐使用最新版火狐浏览器和Chrome浏览器访问本网站。
  • 吐槽,投稿,删稿,交个朋友
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏少将全栈吧

cursor Usage 官网中文翻译双语版

开发笔记 admin 3个月前 (09-19) 778次浏览 已收录 扫描二维码

Cursor offers multiple subscription tiers to fit your needs.
Cursor 提供多个订阅级别以满足您的需求。

  • Hobby爱好
    • 14 days Pro trial
      14 天专业版试用
    • 50 slow premium model uses
      50 次慢速premium模型使用
    • 200 cursor-small uses
      200 种cursor-small用途
    • 2000 completions uses
      2000竣工使用
  • Pro专业版
    • 500 fast premium model uses per month
      每月 500 次快速premium型号使用
    • Unlimited slow premium model uses
      无限慢速premium模型使用
    • Unlimited cursor-small uses
      无限的cursor-small用途
    • Unlimited completions completions
      无限完成完成
    • 10 Claude Opus uses per month
      每月使用 10 次Claude Opus
  • Business商业
    • Usage information is the same as the Pro tier
      使用信息与Pro级别相同
    • Extra benefits, detailed on the pricing page
      额外优惠,详情请参阅定价页面

Premium models高级型号

GPT-4, GPT-4o, and Claude 3.5 Sonnet are all counted as premium models.
GPT-4、GPT-4o 和 Claude 3.5 Sonnet 都算作premium型号。

Pro Trial专业试用版

All new users receive a 14-day Pro trial, granting access to all Pro features. After the 14-day period, users who have not upgraded will revert to the Hobby plan.
所有新用户均可获得 14 天的 Pro 试用期,并有权使用所有 Pro 功能。 14 天后,尚未升级的用户将恢复到 Hobby 计划。

Fast and Slow Requests快速和慢速请求

By default, Cursor servers try to give all users fast premium model requests. However, during peak periods, users who run out of fast premium credits will be moved to a slow pool, which essentially is a queue of users waiting for a fast premium request to become available.
默认情况下,Cursor 服务器尝试向所有用户提供快速的premium模型请求。然而,在高峰期,用完快速premium积分的用户将被转移到慢速池,该池本质上是等待快速premium请求可用的用户队列。

This queue is fair, and Cursor will do everything possible to keep the queue as short as possible. However, if you need more fast premium credits and don’t want to wait, you can add more requests on the settings page.
这个队列是公平的,Cursor会尽一切可能让队列尽可能短。但是,如果您需要更快速的premium积分并且不想等待,您可以在设置页面添加更多请求。

Check Your Usage检查您的使用情况

You can check your usage on the Cursor Settings page. You can reach this page inside the Cursor application as well, under Cursor Settings > General > Account, and press “Manage Subscription” for pro users, or “Manage” for business users.
您可以在“光标设置”页面查看您的使用情况。您也可以在 Cursor 应用程序内访问此页面,在Cursor Settings > General > Account下,然后按专业用户的“管理订阅”或商业用户的“管理”。

Cursor usage resets monthly, based on your subscription start date.
光标使用情况每月根据您的订阅开始日期重置。

Optional Usage-based Pricing
可选的基于使用情况的定价

You may opt in to usage-based pricing for requests that go beyond what is included in your plan by visiting your settings page.
对于超出您的计划中包含的请求,您可以通过访问您的设置页面选择基于使用情况的定价。

Usage-based pricing details:
基于使用情况的定价详细信息:

  • Usage-based pricing is per calendar month (not necessarily same as your billing cycle, will be billed roughly on the 2nd-3rd day of the month)
    基于使用情况的定价按日历月计算(不一定与您的计费周期相同,大致在该月的 2-3 天计费)
  • If you immediately cancel a request or if it errors we do not count it
    如果您立即取消请求或出现错误,我们将不予计算
  • You can configure a hard limit, and you will never ever have to pay more than the hard limit per month (for the usage-based pricing)
    您可以配置硬性限制,并且您每月支付的费用永远不会超过硬性限制(对于基于使用情况的定价)
  • Right now, usage-based pricing only applies to Claude 3 Opus and a few models in long context chat.
    目前,基于使用情况的定价仅适用于 Claude 3 Opus 和长上下文聊天中的一些型号。

Cursor Tab is our native autocomplete feature. It’s a more powerful Copilot that suggests entire diffs with especially good memory.
光标选项卡是我们的原生自动完成功能。它是一个更强大的副驾驶,可以以特别好的记忆力建议整个差异。

Powered by a custom model, Cursor Tab can:
由自定义模型提供支持,光标选项卡可以:

  • Suggest edits around your cursor, not just insertions of additional code.
    建议在光标周围进行编辑,而不仅仅是插入附加代码。
  • Modify multiple lines at once.
    一次修改多行。
  • Make suggestions based on your recent changes and linter errors.
    根据您最近的更改和 linter 错误提出建议。

Free users receive 2000 suggestions at no cost. Pro and Business plans receive unlimited suggestions.
免费用户可以免费收到 2000 条建议。专业版和商业版计划会收到无限的建议。

UI用户界面

When Cursor is only adding additional text, completions will appear as grey text. If a suggestion modifies existing code, it will appear as a diff popup to the right of your current line.
当光标仅添加附加文本时,完成内容将显示为灰色文本。如果建议修改现有代码,它将以差异弹出窗口的形式显示在当前行的右侧。

cursor Usage 官网中文翻译双语版cursor Usage 官网中文翻译双语版

You can accept a suggestion by pressing Tab, or reject it by pressing Esc. To partially accept a suggestion word-by-word, press Ctrl/⌘ →. To reject a suggestion, just keep typing, or use Escape to cancel/hide the suggestion.
您可以按Tab接受建议,或按Esc拒绝建议。要逐字部分接受建议,请按Ctrl/⌘ → 。要拒绝建议,只需继续输入,或使用Escape取消/隐藏建议。

Every keystroke or cursor movement, Cursor will attempt to make a suggestion based on your recent changes. However, Cursor will not always show a suggestion; sometimes the model has predicted that there’s no change to be made.
每次击键或光标移动,光标都会尝试根据您最近的更改提出建议。然而,光标并不总是显示建议;有时模型会预测无需进行任何更改。

Cursor can make changes from one line above to two lines below your current line.
光标可以从当前行上方一行更改为下方两行。

Toggling切换

To turn the feature on or off, hover over “Cursor Tab” icon on the status bar in the bottom right of the application.
要打开或关闭该功能,请将鼠标悬停在应用程序右下角状态栏上的“光标选项卡”图标上。


Tab Improvements选项卡改进

The biggest difference is the way Cursor and GitHub Copilot complete code.
最大的区别在于 Cursor 和 GitHub Copilot 完成代码的方式。

GitHub Copilot can insert text at your cursor position. It cannot edit the code around your cursor or remove text.
GitHub Copilot 可以在光标位置插入文本。它无法编辑光标周围的代码或删除文本。

Cursor can insert text at your cursor, and much more:
光标可以在光标处插入文本,等等:

  • Multi-character edits多字符编辑
cursor Usage 官网中文翻译双语版
cursor Usage 官网中文翻译双语版

Further, Cursor has a history of your recent changes in the context window, so it knows what you are trying to do next.
此外,光标在上下文窗口中具有您最近更改的历史记录,因此它知道您下一步要做什么。

Migrate from GitHub Copilot
从 GitHub Copilot 迁移

Since Cursor comes by default with GitHub Copilot, you might have GitHub Copilot and Cursor installed at the same time. We recommend turning off GitHub Copilot when you want to use Cursor.
由于 Cursor 默认随 GitHub Copilot 一起提供,因此您可能同时安装了 GitHub Copilot 和 Cursor。我们建议您在想要使用 Cursor 时关闭 GitHub Copilot。

By default, Cursor takes precedence over GitHub Copilot. If you want to use GitHub Copilot, you can disable Cursor in the settings.
默认情况下,Cursor 优先于 GitHub Copilot。如果您想使用 GitHub Copilot,可以在设置中禁用 Cursor 。


Tab in Peek预览中的选项卡

You can also use Cursor Tab in the “Go to Definition” or “Go to Type Definition” peek views. This is useful, for example, when adding a new argument to a function call.
您还可以在“转到定义”或“转到类型定义”查看视图中使用光标选项卡。例如,当向函数调用添加新参数时,这很有用。

cursor Usage 官网中文翻译双语版

We especially enjoy using this in vim in conjunction with gd to, for example, modify a function definition, then fix all of its usages in one go.
我们特别喜欢在 vim 中将其与gd结合使用,例如修改函数定义,然后一次性修复其所有用法。

Cursor Prediction光标预测

Cursor can also predict where you will go to after an accepted edit. If available, you will be able to press tab to go to the next location, allowing you to tab-tab-tab through edits.
光标还可以预测接受编辑后您将前往的位置。如果可用,您将能够按 Tab 键转到下一个位置,从而允许您通过 Tab-Tab-Tab 进行编辑。

cursor Usage 官网中文翻译双语版

Cursor predicted the next location, and suggested an edit there.
光标预测下一个位置,并建议在那里进行编辑。

Partial Accepts部分接受

You can accept the next word of a suggestion by pressing Ctrl/⌘ and the right arrow (or by setting editor.action.inlineSuggest.acceptNextWord to your preferred keybinding).
您可以通过按Ctrl/⌘和向右箭头(或通过设置 editor.action.inlineSuggest.acceptNextWord 到您首选的键绑定)。

To enable partial accepts, navigate to Cursor Settings > Features > Cursor Tab.
要启用部分接受,请导航至Cursor Settings > Features > Cursor Tab 。


Cursor Chat lets you ask questions or solve problems in your codebase with the most capable language models, all in your editor.
Cursor Chat 可让您使用最强大的语言模型在代码库中提出问题或解决问题,所有这些都可以在编辑器中完成。

cursor Usage 官网中文翻译双语版

For language models to give good answers, they need to know specific things that are relevant to your codebase — context.
为了让语言模型给出好的答案,它们需要了解与代码库相关的特定事物——上下文。

Cursor has several built in features to provide context in chat, such as automatically including context across your entire codebase, searching the web, indexing documentation, and user-specified references to code blocks. They are built to eliminate the tedious copy-pasting otherwise necessary for working with language models on code.
Cursor 有几个内置功能可以在聊天中提供上下文,例如自动包含整个代码库的上下文、搜索网络、索引文档以及用户指定的代码块引用。它们的构建是为了消除在代码上使用语言模型所必需的繁琐的复制粘贴。

By default, Cursor Chat is in the AI pane, which is on the opposite side of your primary sidebar. You can toggle the AI pane by pressing Ctrl/⌘ + L, which focuses onto the chat when opened. To submit your query, press Enter.
默认情况下,光标聊天位于 AI 窗格中,位于主侧边栏的另一侧。您可以通过按Ctrl/⌘ + L来切换 AI 窗格,该窗格在打开时会聚焦于聊天。要提交查询,请按Enter 。

User and AI Messages用户和人工智能消息

User messages contain the text you type, along with the context you’ve referenced. You can go back to any previous user messages to edit and rerun your queries. This will overwrite any messages after that and regenerate new ones.
用户消息包含您键入的文本以及您引用的上下文。您可以返回到任何以前的用户消息来编辑并重新运行您的查询。这将覆盖此后的所有消息并重新生成新消息。

AI messages are the responses generated from the AI model you’ve picked. They are paired with the user message before them. AI messages may contain parsed code blocks which can be added to your codebase with instant apply.
AI 消息是您选择的 AI 模型生成的响应。它们与前面的用户消息配对。 AI 消息可能包含已解析的代码块,可以通过即时 apply将其添加到您的代码库中。

All user/AI messages together in the same thread are called a chat thread, and each chat thread is saved in your chat history.
同一线程中的所有用户/AI 消息称为聊天线程,每个聊天线程都保存在您的聊天历史记录中。

Chat History聊天记录

By pressing on the “Previous Chats” button on the top right of the AI pane, or by pressing Ctrl/⌘ + Alt/Option + L, you can see the chat history. You can click on any chat thread to go back and see the messages that make up that thread, and you can also modify the title of the thread by clicking the pen icon, or delete the thread by clicking the garbage can icon upon hovering over the thread in the history.
通过按 AI 窗格右上角的“以前的聊天”按钮,或按Ctrl/⌘ + Alt/Option + L ,您可以查看聊天记录。您可以单击任何聊天线程返回并查看组成该线程的消息,还可以通过单击钢笔图标来修改线程的标题,或者将鼠标悬停在聊天线程上时单击垃圾桶图标来删除线程。历史中的线索。

The title of a Cursor thread is just the first few words of the first user message.
游标线程的标题只是第一条用户消息的前几个单词。

Default Context默认上下文

By default, Cursor Chat includes the current file as context. You can submit a query without including any context by pressing Alt/Option Enter on submit, or turn on Default to no context under Cursor Settings > Features > Chat. Chats that begin with a no-context request will not add context for any messages.
默认情况下,光标聊天包含当前文件作为上下文。您可以通过在提交时按Alt/Option Enter来提交不包含任何上下文的查询,或者在Cursor Settings > Features > Chat下打开Default to no context 。以无上下文请求开始的聊天不会为任何消息添加上下文。

As you type, you can see what will be included in context in the pills below the input box.
当您键入时,您可以看到输入框下方的药丸上下文中将包含哪些内容。

Adding Context添加上下文

By default, user messages will contain the text you type, along with the context you’ve referenced. You can add more custom context to each bubble with @ symbols, and by default, the current viewing file will be used as context as well in the user message.
默认情况下,用户消息将包含您键入的文本以及您引用的上下文。您可以使用 @ 符号向每个气泡添加更多自定义上下文,默认情况下,当前查看文件也将在用户消息中用作上下文。

See the @ symbols pages for more information.
有关详细信息,请参阅@ 符号页面。

AI Fix in Chat聊天中的 AI 修复

A convenient feature to fix linter errors in your codebase is to use the AI fix in chat. To do this, hover over the error in the editor, and click the blue AI fix button that shows up.
修复代码库中的 linter 错误的一个便捷功能是在聊天中使用 AI 修复。为此,请将鼠标悬停在编辑器中的错误上,然后单击显示的蓝色 AI 修复按钮。

The keyboard shortcut for this would be to do Ctrl/⌘ + Shift + E.
键盘快捷键是Ctrl/⌘ + Shift + E 。

cursor Usage 官网中文翻译双语版

Long Context Chat (Beta)长上下文聊天(测试版)

You can enable long context chat by going to Cursor Settings > Beta > Long Context Chat. With this enabled, you can toggle different chat modes through Ctrl/⌘ ..
您可以通过转到Cursor SettingsBeta > Long Context Chat来启用长上下文聊天。启用此功能后,您可以通过Ctrl/⌘ . 。

Long context chat allows you to include entire folders as context, since the supported models have a larger context window. Check out more about the long context only models here.
长上下文聊天允许您将整个文件夹作为上下文包含在内,因为受支持的模型具有更大的上下文窗口。在此处查看有关仅长上下文模型的更多信息。


Choose an AI Model选择人工智能模型

Pick your preferred AI model through the model toggle, and Cursor Chat will use that model to generate responses. You can toggle between models by pressing Ctrl/⌘ /.
通过模型切换选择您喜欢的 AI 模型,光标聊天将使用该模型生成响应。您可以通过按Ctrl/⌘ /在模型之间切换。

By default, Cursor Chat uses OpenAI’s GPT-4 for its AI model (specifically, the gpt-4 label points to our instance of GPT4-Turbo).
默认情况下,Cursor Chat 使用 OpenAI 的GPT-4作为其 AI 模型(具体来说, gpt-4标签指向我们的 GPT4-Turbo 实例)。

The AI model you choose for Chat will be saved for future sessions, so you don’t have to change it every time you open Cursor Chat.
您为聊天选择的 AI 模型将被保存以供将来的会话使用,因此您不必每次打开光标聊天时都进行更改。

cursor Usage 官网中文翻译双语版

In-Editor编辑器内

Cursor Chat can also be used as an editor tab by clicking on the horizontal “More” button, and then clicking on the “Open Chat in Editor” button. Cursor Chat will then behave as a regular editor tab. Pressing Ctrl/⌘ + L will bring up the chat tab and focus onto it.
通过单击水平“更多”按钮,然后单击“在编辑器中打开聊天”按钮,光标聊天也可以用作编辑器选项卡。然后,光标聊天将充当常规编辑器选项卡。按Ctrl/⌘ + L将打开聊天选项卡并将焦点放在它上面。

Settings设置

You can customize the Cursor Chat under Cursor Settings > Features > Chat.
您可以在Cursor Settings > Features > Chat下自定义光标聊天。

These settings include:这些设置包括:

 


 

Default Codebase Chat默认代码库聊天

If a codebase isn’t indexed, Cursor Chat will first attempt to compute a few search queries to be used to search across your codebase. For better accuracy, it’s recommended to use embeddings search.
如果代码库未建立索引,Cursor Chat 将首先尝试计算一些搜索查询,用于在代码库中进行搜索。为了获得更高的准确性,建议使用嵌入搜索

cursor Usage 官网中文翻译双语版

With codebase indexing, Cursor Chat can accurately generate responses based on your codebase.
通过代码库索引,Cursor Chat 可以根据您的代码库准确生成响应。

By pressing Ctrl/⌘ + Enter after typing a message, Cursor Chat scans through your indexed codebase to find pieces of relevant code. This is generally good for quickly including code snippets to be taken into the context of the conversation. For more control over the codebase search and better accuracy, you can use @codebase.
输入消息后按Ctrl/⌘ + Enter ,光标聊天会扫描索引代码库以查找相关代码片段。这通常有利于快速将要纳入对话上下文的代码片段包含在内。为了更好地控制代码库搜索并提高准确性,您可以使用@codebase 。

cursor Usage 官网中文翻译双语版

Cursor codebase chat goes through a more detailed search when @Codebase is used.
当使用@Codebase时,光标代码库聊天会进行更详细的搜索。

See more about @Codebase here.
在此处查看有关@Codebase的更多信息。


Cursor’s Apply allows you to quickly integrate a codeblock suggestion from the chat into your code.
Cursor 的Apply允许您快速将聊天中的代码块建议集成到您的代码中。

Apply Code Blocks 应用代码块

To apply a code block suggestion, you can press on the play button in the top right corner of each chat code block.
要应用代码块建议,您可以按每个聊天代码块右上角的播放按钮。

cursor Usage 官网中文翻译双语版

This will edit your file to incorporate the code produced by Chat. Since you can add the most context and have the most back-and-forth with the model in Chat, we recommend Chat + Apply for more complex AI-driven code changes.
这将编辑您的文件以合并聊天生成的代码。由于您可以在 Chat 中添加最多的上下文并与模型进行最多的来回交互,因此我们建议使用 Chat + Apply 来进行更复杂的 AI 驱动的代码更改。

Accept or Reject 接受或拒绝

Once you have applied a code block, you can go through the diffs and accept or reject the changes. You can also click on the “Accept” or “Reject” buttons in the top right corner of the chat code block.
应用代码块后,您可以检查差异并接受或拒绝更改。您还可以单击聊天代码块右上角的“接受”或“拒绝”按钮。

Ctrl/⌘ Enter to accept, Ctrl/⌘ Backspace to reject.
Ctrl/⌘ Enter接受, Ctrl/⌘ Backspace拒绝。

cursor Usage 官网中文翻译双语版

Cmd K, also known or “Ctrl K” on Windows/Linux, allows you to generate new code or edit existing code in the editor window.
Cmd K,在 Windows/Linux 上也称为“Ctrl K”,允许您在编辑器窗口中生成新代码或编辑现有代码。

cursor Usage 官网中文翻译双语版

Prompt Bars提示栏

In Cursor, we call the bar that appears when you press Ctrl/Cmd K the “Prompt Bar”. It works similarly to the AI input box for chat, in which you can type normally, or use @ symbols to reference other context.
在光标中,我们将按Ctrl/Cmd K时出现的栏称为“提示栏”。它的工作原理类似于聊天的AI输入框,您可以在其中正常键入,或使用@符号来引用其他上下文。

Inline Generation内联生成

If no code is selected when you press Ctrl/Cmd K, Cursor will generate new code based on the prompt you type in the prompt bar.
如果按Ctrl/Cmd K时未选择任何代码,光标将根据您在提示栏中键入的提示生成新代码。

cursor Usage 官网中文翻译双语版

Inline Edits内联编辑

For in-place edits, you can simply select the code you want to edit and type into the prompt bar.
对于就地编辑,您只需选择要编辑的代码并在提示栏中输入即可。

cursor Usage 官网中文翻译双语版

Follow-up Instructions后续指示

After each generation, you can further refine the prompt by adding more instructions to the prompt bar, and pressing Enter so the AI regenerates based on your follow-up instructions.
每次生成后,您可以通过向提示栏添加更多指令来进一步细化提示,然后按Enter ,以便 AI 根据您的后续指令重新生成。

Default Context默认上下文

By default, Cursor will try to find different kinds of useful information to improve code generation, in addition to the manual @ symbols you include.
默认情况下,除了您包含的手动@ 符号之外,Cursor 还会尝试查找不同类型的有用信息来改进代码生成。

Additional context may include related files, recently viewed files, and more. After gathering, Cursor ranks the context items by relevance to your edit/generation and keeps the top items in context for the large language model.
其他上下文可能包括相关文件、最近查看的文件等。收集后,光标根据与您的编辑/生成的相关性对上下文项目进行排名,并将顶部项目保留在大型语言模型的上下文中。

Quick Question快速提问

If you press Option/Alt Enter while in the prompt bar, Cursor will respond to any questions you have about the selection, and the context you have attached.
如果您在提示栏中按Option/Alt Enter ,光标将回答您有关选择和附加上下文的任何问题。

The contents of this conversation could be further used in follow-up generations, so you could simply type “do it” after Cursor comes up with a response to generate the code after a quick question.
该对话的内容可以在后续世代中进一步使用,因此您可以在光标给出响应后简单地输入“do it”,以在快速提问后生成代码。


In the built-in Cursor terminal, you can press Ctrl/⌘ K to open a prompt bar on the bottom of the terminal. This prompt bar allows you to describe your desired action in the terminal, and terminal Cmd K will generate a command. You can accept the command by hitting esc or run the command immediately with Ctrl/⌘ + Enter.
在内置光标终端中,您可以按Ctrl/⌘ K在终端底部打开提示栏。这个提示栏允许您在终端中描述您想要的操作,终端 Cmd K 将生成一个命令。您可以通过按esc接受该命令或使用Ctrl/⌘ + Enter立即运行该命令。

cursor Usage 官网中文翻译双语版

By default, Terminal Cmd K sees your recent terminal history, your instructions, and anything else you put in the prompt bar as context.
默认情况下,终端 Cmd K 会查看您最近的终端历史记录、您的指令以及您在提示栏中作为上下文放置的任何其他内容。


Index your Codebase索引您的代码库

For better and more accurate codebase answers using @codebase or Ctrl/⌘ Enter, you can index your codebase. Behind the scenes, Cursor computes embeddings for each file in your codebase, and will use these to improve the accuracy of your codebase answers.
要使用@codebaseCtrl/⌘ Enter获得更好、更准确的代码库答案,您可以为代码库建立索引。在幕后,Cursor 计算代码库中每个文件的嵌入,并将使用它们来提高代码库答案的准确性。

Your codebase index will automatically synchronize with your latest codebase changes.
您的代码库索引将自动与最新的代码库更改同步。

The status of your codebase indexing is under Cursor Settings > Features > Codebase Indexing.
代码库索引的状态位于Cursor Settings > Features > Codebase Indexing下。

cursor Usage 官网中文翻译双语版

Advanced Settings高级设置

By default, Cursor will index all files in your codebase.
默认情况下,Cursor 将为代码库中的所有文件建立索引。

You can also expand the Show Settings section to access more advanced options. Here, you can decide whether you want to enable automatic indexing for new repositories and configure the files that Cursor will ignore during repository indexing, in addition to your .gitignore settings.
您还可以展开Show Settings部分以访问更多高级选项。在这里,除了 .gitignore 设置之外,您还可以决定是否要为新存储库启用自动索引,并配置 Cursor 在存储库索引期间将忽略的文件。

If you have any large content files in your project that the AI definitely doesn’t need to read, ignoring those files could improve the accuracy of the answers.
如果您的项目中有人工智能绝对不需要读取的大型内容文件,则忽略这些文件可以提高答案的准确性。


You can add custom instructions to Cursor by modifying the Rules for AI section under Cursor Settings > General > Rules for AI.
您可以通过修改Cursor Settings > General > Rules for AI下的Rules for AI规则”部分来向光标添加自定义指令。

This custom instruction will be included for features such as Cursor Chat and Ctrl/⌘ K.
此自定义指令将包含在光标聊天和 Ctrl/⌘ K 等功能中。

cursor Usage 官网中文翻译双语版

.cursorrules

For project-specific instructions, you can include the instructions in a .cursorrules file in the root of your project.
对于特定于项目的说明,您可以将说明包含在项目根目录下的.cursorrules文件中。

As the same as the “Rules for AI” section, the instructions in the .cursorrules file will be included for features such as Cursor Chat and Ctrl/⌘ K.
与“AI 规则”部分相同, .cursorrules文件中将包含针对光标聊天和 Ctrl/⌘ K 等功能的说明。


In Cursor’s AI input boxes, such as in Cmd K, Chat, or Terminal Cmd K, you can use @ symbols by typing @. A popup menu will appear with a list of suggestions, and it will automatically filter to only show the most relevant suggestions based on your input.
在 Cursor 的 AI 输入框中,例如在 Cmd K、Chat 或 Terminal Cmd K 中,您可以通过键入@来使用 @ 符号。将出现一个弹出菜单,其中包含建议列表,并且它会自动过滤以仅根据您的输入显示最相关的建议。

Keyboard Shortcuts键盘快捷键

You can navigate through the list of suggestions using the up/down arrow keys. You can hit Enter to select a suggestion. If the suggestion is a category, such as Files, the suggestions will be filtered to only show the most relevant items within that category.
您可以使用向上/向下箭头键浏览建议列表。您可以按Enter选择建议。如果建议是一个类别,例如Files ,则建议将被过滤以仅显示该类别中最相关的项目。

cursor Usage 官网中文翻译双语版

Cmd K Keyboard ShortcutCmd K 键盘快捷键

You can use the up/down arrow key to navigate through the list of selected Cmd K @ symbols, Enter to expand/collapse the selected context item. For file references, you can use Ctrl/⌘ M to toggle the file reading strategies. Read more about file reading strategies here.
您可以使用向上/向下箭头键浏览所选 Cmd K @ 符号的列表,按Enter展开/折叠所选上下文项。对于文件引用,您可以使用Ctrl/⌘ M切换文件读取策略。在此处阅读有关文件读取策略的更多信息。


@Files

In AI input boxes such as in Cursor Chat and Cmd K, you can reference entire files by using @Files. Also, if you continue to type after @, you will see your file search results after the @Code strategy.
在 AI 输入框中,例如 Cursor Chat 和 Cmd K,您可以使用@Files引用整个文件。另外,如果您继续在@之后输入,您将在@Code策略之后看到文件搜索结果。

In order to make sure the file you’re referencing is the correct file, Cursor will show a preview of the file’s path. This is especially useful when you have multiple files with the same name in different folders.
为了确保您引用的文件是正确的文件,光标将显示文件路径的预览。当不同文件夹中有多个同名文件时,这尤其有用。

cursor Usage 官网中文翻译双语版

Chat Long File References
聊天长文件参考

In Cursor’s Chat, if the contents of a file is too long, Cursor will chunk the file into smaller chunks and rerank them based on relevance to the query.
在 Cursor 的聊天中,如果文件的内容太长,Cursor 会将文件分成更小的块,并根据与查询的相关性对它们重新排序。

cursor Usage 官网中文翻译双语版

Cmd K Chunking StrategyCmd K 分块策略

For Cmd K, Cursor uses the file references differently based on the content length as well.
对于 Cmd K,光标也会根据内容长度使用不同的文件引用。

cursor Usage 官网中文翻译双语版

Drag and Drop拖放

You can drag and drop files from the primary sidebar into Chat or Cmd K to add them as context as well.
您可以将文件从主侧边栏拖放到 Chat 或 Cmd K 中,以将它们添加为上下文。


Currently, @Folders is only supported in the Cursor Chat.
目前, @Folders仅在光标聊天中受支持。

@Folders

You can also reference entire folders in Cursor as context. @Folders is especially useful for long context chat where you want to provide a lot of context to the AI.
您还可以将光标中的整个文件夹作为上下文引用。 @Folders对于您想要向 AI 提供大量上下文的长上下文聊天特别有用。

cursor Usage 官网中文翻译双语版

@Code

To reference specific sections of code, you can use the @Code symbol.
要引用代码的特定部分,可以使用@Code符号。

Code Preview代码预览

Similar to the @Files symbol, Cursor will show a preview of the code’s content so you can verify that the code you’re referencing is the correct one.
@Files符号类似,光标将显示代码内容的预览,以便您可以验证您引用的代码是否正确。

cursor Usage 官网中文翻译双语版

From the Editor来自编辑

Another way to add code snippets as context is to select the code you want to reference, and click on either “Add to Chat” (Ctrl/⌘ Shift L) or “Add to Edit” (Ctrl/⌘ Shift K).
将代码片段添加为上下文的另一种方法是选择要引用的代码,然后单击“添加到聊天”( Ctrl/⌘ Shift L ) 或“添加到编辑”( Ctrl/⌘ Shift K )。

These will add the selected code snippet to either the Chat input box or the currently active Cmd K prompt bar.
这些会将选定的代码片段添加到聊天输入框或当前活动的 Cmd K 提示栏。

cursor Usage 官网中文翻译双语版

To add a selected code to a new chat, you can press Ctrl/⌘ L.
要将选定的代码添加到新聊天中,您可以按Ctrl/⌘ L 。


@Docs

cursor Usage 官网中文翻译双语版

Cursor comes with a set of third party docs crawled, indexed, and ready to be used as context. You can access them by using the @Docs symbol.
Cursor 附带一组已爬网、索引并准备用作上下文的第三方文档。您可以使用@Docs符号来访问它们。

Add Custom Docs添加自定义文档

If you want to crawl and index custom docs that are not already provided, you can do so by @Docs > Add new doc. The following modal will appear after you’ve pasted in the URL of your desired doc:
如果您想抓取尚未提供的自定义文档并为其建立索引,可以通过@Docs > Add new doc来执行此操作。粘贴所需文档的 URL 后,将出现以下模式:

cursor Usage 官网中文翻译双语版

Cursor will then index and learn the doc, and you will be able to use it as context like any other doc.
然后,光标将索引并学习该文档,您将能够像任何其他文档一样将其用作上下文。

cursor Usage 官网中文翻译双语版

Manage Custom Docs管理自定义文档

Under Cursor Settings > Features > Docs, you will see the docs you have added. You can edit, delete, or add new docs here.
Cursor Settings > Features > Docs下,您将看到已添加的文档。您可以在此处编辑、删除或添加新文档。

cursor Usage 官网中文翻译双语版

Currently, @Git is only supported in the Cursor Chat.
目前, @Git仅在 Cursor Chat 中受支持。

@Git

In Cursor’s Chat, you can use @Git to add git commits, diffs, or pull requests to your prompt.
在 Cursor 的聊天中,您可以使用@Git将 git 提交、差异或拉取请求添加到提示中。

cursor Usage 官网中文翻译双语版

Common Use Cases常见用例

One common use case for @Git is to allow Cursor’s AI to scan the diff and look for bugs or issues that could be caused by the diff.
@Git的一种常见用例是允许 Cursor 的 AI 扫描差异并查找差异可能引起的错误或问题。

cursor Usage 官网中文翻译双语版

You could also use @Diff of Working State to generate a commit message from your current diffs.
您还可以使用@Diff of Working State从当前差异生成提交消息。

cursor Usage 官网中文翻译双语版

@Codebase

cursor Usage 官网中文翻译双语版

Through @Codebase, Cursor Chat goes through these steps until it finds the most important pieces of code to use.
通过@Codebase ,Cursor Chat 会执行这些步骤,直到找到要使用的最重要的代码片段。

Another way of submitting an advanced codebase query is to click on the dropdown next to the Ctrl/⌘ + Enter button and select reranker for the search behavior. This is only available when @Codebase isn’t used, otherwise @Codebase takes precedence.
提交高级代码库查询的另一种方法是单击Ctrl/⌘ + Enter按钮旁边的下拉列表,然后为搜索行为选择reranker 。仅当不使用@Codebase时才可用,否则@Codebase优先。

cursor Usage 官网中文翻译双语版

@Web

cursor Usage 官网中文翻译双语版

With @Web, Cursor constructs a search query based on the query and the context you’ve provided, and searches the web to find relevant information as additional context. This is particulary useful for finding the most up-to-date information.
使用@Web , Cursor 根据查询和您提供的上下文构建搜索查询,并搜索网络以查找相关信息作为附加上下文。这对于查找最新信息特别有用。

Always On永远在线

You can make Cursor search the web for chat on every query by turning on “Always search the web” under Cursor settings > Features > Chat. This is equivalent to using @web on every query.
您可以通过在Cursor settings > Features > Chat下启用“始终搜索网络”,让 Cursor 在每次查询时都在网络上搜索聊天。这相当于在每个查询上使用@web 。

This feature is currently only for Cmd K.
此功能目前仅适用于 Cmd K。

@Chat

You can add your current chat messages as context by using @Chat inside Cmd K. This is useful for when you have a conversation with the AI that you’d like to be applied to edit or generate code.
您可以使用 Cmd K 中的@Chat将当前的聊天消息添加为上下文。当您与希望应用于编辑或生成代码的 AI 进行对话时,这非常有用。

cursor Usage 官网中文翻译双语版

This feature is currently only for Cmd K.
此功能目前仅适用于 Cmd K。

@Definitions

The @Definitions symbol adds all nearby definitions to Cmd K as context.
@Definitions符号将所有附近的定义添加到 Cmd K 作为上下文。

cursor Usage 官网中文翻译双语版

In order for Cursor to visit a link before responding, type @ and then paste in the link.
为了让光标在响应之前访问链接,请键入@ ,然后粘贴链接。

cursor Usage 官网中文翻译双语版

By default, we automatically parse links and turn them into @Links in Cursor Chat. If you prefer to have the link as plain text, click on the link and then click Unlink.
默认情况下,我们会自动解析链接并将其转换为光标聊天中的@Links 。如果您希望链接为纯文本,请单击该链接,然后单击Unlink 。

cursor Usage 官网中文翻译双语版

To ignore files to be included in Cursor features such as codebase indexing, you can use a .cursorignore file in the root of your project. It works the same way as .gitignore works for git.
要忽略要包含在 Cursor 功能(例如代码库索引)中的文件,您可以在项目根目录中使用.cursorignore文件。它的工作方式与 git 的.gitignore的工作方式相同。

.cursorignore respects .gitignore. If you already have .gitignore, the files will be ignored by default. If you want to ignore additional files, you can add them to the .cursorignore file.
.cursorignore尊重.gitignore 。如果您已有.gitignore ,则默认情况下将忽略这些文件。如果您想忽略其他文件,可以将它们添加到.cursorignore文件中。

An Example .cursorignore file
.cursorignore文件示例

# Ignore all files in the `dist` directory
dist/

# Ignore all `.log` files
*.log

# Ignore specific file `config.json`
config.json

Troubleshooting故障排除

The ignore file syntax is sometimes a bit confusing. The .cursorignore file follows the exact same syntax as .gitignore, so if you are trying an ignore file and it doesn’t work the way you expect it to, we recommend a Google search for the issue, replacing cursorignore in your search query with gitignore. Probably someone will have had the same issue and StackOverflow will have a good answer.
忽略文件语法有时有点令人困惑。 .cursorignore文件遵循与.gitignore完全相同的语法,因此,如果您正在尝试忽略文件,但它没有按照您期望的方式工作,我们建议您使用 Google 搜索该问题,将搜索查询中的cursorignore替换为gitignore 。可能有人会遇到同样的问题,StackOverflow 会有一个很好的答案。

One common example: here is how you ignore all files except those with a .php extension (just adding * followed by !*.php does not work because the gitignore file discoverer will not descend into and discover any .php files in subdirectories).
一个常见的示例:以下是如何忽略除.php扩展名之外的所有文件(仅添加*后跟!*.php不起作用,因为 gitignore 文件发现器不会深入并发现子目录中的任何.php文件)。

Cursor Usage官方地址:https://docs.cursor.com/get-started/usage

全自动编程神器 Cursor

喜欢 (1)
[🍬谢谢你请我吃糖果🍬🍬~]
分享 (0)
关于作者:
少将,关注Web全栈开发、项目管理,持续不断的学习、努力成为一个更棒的开发,做最好的自己,让世界因你不同。