nvim-context
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNeovim context provider
Neovim上下文提供器
Purpose
用途
Provides live context from the user's Neovim editor session to help answer
context-aware questions about code.
从用户的Neovim编辑器会话中提供实时上下文,帮助回答与代码相关的上下文感知类问题。
How it works
工作原理
- Executes the tool to get the current editor state.
nvim-context - Returns JSON data including cursor position, open file, visual selection and diagnostics.
- Use this information to understand references like "this line", "the selection", "current file", etc.
- 执行工具获取当前编辑器状态。
nvim-context - 返回包含光标位置、打开的文件、可视选区和诊断信息的JSON数据。
- 利用这些信息理解诸如“这一行”“该选区”“当前文件”等指代内容。
Usage examples
使用示例
- "What's wrong with this line?" → Check diagnostics at cursor
- "Explain the selected code" → Analyze visual selection
- "What file am I in?" → Return current file path
- "Show me all errors" → List all LSP diagnostics
- “这一行有什么问题?” → 检查光标位置的诊断信息
- “解释选中的代码” → 分析可视选区内容
- “我当前在哪个文件里?” → 返回当前文件路径
- “显示所有错误” → 列出所有LSP诊断信息
Technical details
技术细节
To use this skill, execute the CLI command which outputs JSON:
nvim-contextjson
{
"cursor": {
"line": 43,
"col": 3
},
"file": "/path/to/current/file.rb",
"selection": null,
"diagnostics": []
}要使用该技能,需执行 CLI命令,其输出为JSON格式:
nvim-contextjson
{
"cursor": {
"line": 43,
"col": 3
},
"file": "/path/to/current/file.rb",
"selection": null,
"diagnostics": []
}Implementation
实现方式
When this skill is loaded, execute via Bash and parse the JSON
output to understand the current editor state. Use the returned data to answer
user questions about their code.
nvim-context加载该技能后,通过Bash执行并解析JSON输出,以了解当前编辑器状态。利用返回的数据回答用户关于其代码的问题。
nvim-context