Cmd K 命令 K - Overview 概述

Cmd K 命令 K - Overview 概述

Cmd K 命令 K Overview 概述 Cmd K 命令 K Overview 概述 Modified September 6, 2024 Overview 概述 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”,允许您在编辑器窗口中生成新代码或编辑现有代码。 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. 在 Cursor 中,我们将按 Ctrl/Cmd K 时出现的栏称为“Prompt Bar”。它的工作原理类似于用于聊天的 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 将根据您在提示栏中键入的提示生成新代码。 Inline Edits 内联编辑 For in place edits, you can simply select the code you want to edit and type into the prompt bar. 对于就地编辑,您只需选择要编辑的代码,然后在提示栏中键入即可。 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. 其他上下文可能包括相关文件、最近查看的文件等。收集后,Cursor 按与编辑/生成的相关性对上下文项进行排名,并将排名靠前的项目保留在大型语言模型的上下文中。 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,则 Cursor 将回答您关于选择和附加上下文的任何问题。 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. 此对话的内容可以在后续生成中进一步使用,因此您只需在 Cursor 提出响应后键入“do it”即可在快速提问后生成代码。 @ symbols @ 符号 @ symbols @ 符号 Overview 概述 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”,允许您在编辑器窗口中生成新代码或编辑现有代码。 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. 在 Cursor 中,我们将按 Ctrl/Cmd K 时出现的栏称为“Prompt Bar”。它的工作原理类似于用于聊天的 AI 输入框,您可以在其中正常键入,或使用 @ 符号引用其他上下文。 @ symbols @ 符号 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 将根据您在提示栏中键入的提示生成新代码。 Inline Edits 内联编辑 For in place edits, you can simply select the code you want to edit and type into the prompt bar. 对于就地编辑,您只需选择要编辑的代码,然后在提示栏中键入即可。 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 还将尝试查找不同类型的有用信息来改进代码生成。 @ symbols @ 符号 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. 其他上下文可能包括相关文件、最近查看的文件等。收集后,Cursor 按与编辑/生成的相关性对上下文项进行排名,并将排名靠前的项目保留在大型语言模型的上下文中。 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,则 Cursor 将回答您关于选择和附加上下文的任何问题。 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. 此对话的内容可以在后续生成中进一步使用,因此您只需在 Cursor 提出响应后键入“do it”即可在快速提问后生成代码。

在 小宇宙note 阅读完整内容