返回 Skill 列表
extension
分类: 开发与工程无需 API Key

nvim-context

获取当前Neovim上下文作为JSON(光标位置、当前文件、可视选择和诊断信息),以帮助回答关于当前光标位置、可视选择和诊断信息的代码问题。当用户询问“这一行”、“当前文件”、“选中内容”或需要了解他们Neovim编辑器状态的上下文时使用。

person作者: jakexiaohubgithub

Neovim context provider

Purpose

Provides live context from the user's Neovim editor session to help answer context-aware questions about code.

How it works

  1. Executes the nvim-context tool to get the current editor state.
  2. Returns JSON data including cursor position, open file, visual selection and diagnostics.
  3. Use this information to understand references like "this line", "the selection", "current file", etc.

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

Technical details

To use this skill, execute the nvim-context CLI command which outputs JSON:

{
  "cursor": {
    "line": 43,
    "col": 3
  },
  "file": "/path/to/current/file.rb",
  "selection": null,
  "diagnostics": []
}

Implementation

When this skill is loaded, execute nvim-context via Bash and parse the JSON output to understand the current editor state. Use the returned data to answer user questions about their code.