claude-code.nvim

作者 greggh已验证

Seamless integration between Claude Code AI assistant and Neovim

2,092
Stars
70
Forks
Lua
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/greggh/claude-code.nvim

快速入门

使用 claude-code.nvim 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

Claude Code Neovim Plugin

GitHub License GitHub Stars GitHub Issues CI Neovim Version Tests Version Discussions

A seamless integration between Claude Code AI assistant and Neovim

FeaturesRequirementsInstallationConfigurationUsageContributingDiscussions

Claude Code in Neovim

This plugin was built entirely with Claude Code in a Neovim terminal, and then inside itself using Claude Code for everything!

Features

  • 🚀 Toggle Claude Code in a terminal window with a single key press
  • 🧠 Support for command-line arguments like --continue and custom variants
  • 🔄 Automatically detect and reload files modified by Claude Code
  • ⚡ Real-time buffer updates when files are changed externally
  • 📱 Customizable window position and size (including floating windows)
  • 🤖 Integration with which-key (if available)
  • 📂 Automatically uses git project root as working directory (when available)
  • 🧩 Modular and maintainable code structure
  • 📋 Type annotations with LuaCATS for better IDE support
  • ✅ Configuration validation to prevent errors
  • 🧪 Testing framework for reliability (44 comprehensive tests)

Requirements

See CHANGELOG.md for version history and updates.

Installation

Using lazy.nvim

return {
  "greggh/claude-code.nvim",
  dependencies = {
    "nvim-lua/plenary.nvim", -- Required for git operations
  },
  config = function()
    require("claude-code").setup()
  end
}

Using packer.nvim

use {
  'greggh/claude-code.nvim',
  requires = {
    'nvim-lua/plenary.nvim', -- Required for git operations
  },
  config = function()
    require('claude-code').setup()
  end
}

Using vim-plug

Plug 'nvim-lua/plenary.nvim'
Plug 'greggh/claude-code.nvim'
" After installing, add this to your init.vim:
" lua require('claude-code').setup()

Configuration

The plugin can be configured by passing a table to the setup function. Here's the default configuration:

require("claude-code").setup({
  -- Terminal window settings
  window = {
    split_ratio = 0.3,      -- Percentage of screen for the terminal window (height for horizontal, width for vertical splits)
    position = "botright",  -- Position of the window: "botright", "topleft", "vertical", "float", etc.
    enter_insert = true,    -- Whether to enter insert mode when opening Claude Code
    hide_numbers = true,    -- Hide line numbers in the terminal window
    hide_signcolumn = true, -- Hide the sign column in the terminal window
    
    -- Floating window configuration (only applies when position = "float")
    float = {
      width = "80%",        -- Width: number of columns or percentage string
      height = "80%",       -- Height: number of rows or percentage string
      row = "center",       -- Row position: number, "center", or percentage string
      col = "center",       -- Column position: number, "center", or percentage string
      relative = "editor",  -- Relative to: "editor" or "cursor"
      border = "rounded",   -- Border style: "none", "single", "double", "rounded", "solid", "shadow"
    },
  },
  -- File refresh settings
  refresh = {
    enable = true,           -- Enable file change detection
    updatetime = 100,        -- updatetime when Claude Code is active (milliseconds)
    timer_interval = 1000,   -- How often to check for file changes (milliseconds)
    show_notifications = true, -- Show notification when files are reloaded
  },
  -- Git project settings
  git = {
    use_git_root = true,     -- Set CWD to git root when opening Claude Code (if in git project)
  },
  -- Shell-specific settings
  shell = {
    separator = '&&',        -- Command separator used in shell commands
    pushd_cmd = 'pushd',     -- Command to push directory onto stack (e.g., 'pushd' for bash/zsh, 'enter' for nushell)
    popd_cmd = 'popd',       -- Command to pop directory from stack (e.g., 'popd' for bash/zsh, 'exit' for nushell)
  },
  -- Command settings
  command = "claude",        -- Command used to launch Claude Code
  -- Command variants
  command_variants = {
    -- Conversation management
    continue = "--continue", -- Resume the most recent conversation
    resume = "--resume",     -- Display an interactive conversation picker

    -- Output options
    verbose = "--verbose",   -- Enable verbose logging with full turn-by-turn output
  },
  -- Keymaps
  keymaps = {
    toggle = {
      normal = "<C-,>",       -- Normal mode keymap for toggling Claude Code, false to disable
      terminal = "<C-,>",     -- Terminal mode keymap for toggling Claude Code, false to disable
      variants = {
        continue = "<leader>cC", -- Normal mode keymap for Claude Code with continue flag
        verbose = "<leader>cV",  -- Normal mode keymap for Claude Code with verbose flag
      },
    },
    window_navigation = true, -- Enable window navigation keymaps (<C-h/j/k/l>)
    scrolling = true,         -- Enable scrolling keymaps (<C-f/b>) for page up/down
  }
})

Usage

Quick Start

" In your Vim/Neovim commands or init file:
:ClaudeCode
-- Or from Lua:
vim.cmd[[ClaudeCode]]

-- Or map to a key:
vim.keymap.set('n', '<leader>cc', '<cmd>ClaudeCode<CR>', { desc = 'Toggle Claude Code' })

Commands

Basic command:

  • :ClaudeCode - Toggle the Claude Code terminal window

Conversation management commands:

  • :ClaudeCodeContinue - Resume the most recent conversation
  • :ClaudeCodeResume - Display an interactive conversation picker

Output options command:

  • :ClaudeCodeVerbose - Enable verbose logging with full turn-by-turn output

Note: Commands are automatically generated for each entry in your command_variants configuration.

Key Mappings

Default key mappings:

  • <leader>ac - Toggle Claude Code terminal window (normal mode)
  • <C-,> - Toggle Claude Code terminal window (both normal and terminal modes)

Variant mode mappings (if configured):

  • <leader>cC - Toggle Claude Code with --continue flag
  • <leader>cV - Toggle Claude Code with --verbose flag

Additionally, when in the Claude Code terminal:

  • <C-h> - Move to the window on the left
  • <C-j> - Move to the window below
  • <C-k> - Move to the window above
  • <C-l> - Move to the window on the right
  • <C-f> - Scroll full-page down
  • <C-b> - Scroll full-page up

Note: After scrolling with <C-f> or <C-b>, you'll need to press the i key to re-enter insert mode so you can continue typing to Claude Code.

When Claude Code modifies files that are open in Neovim, they'll be automatically reloaded.

Floating Window Example

To use Claude Code in a floating window:

require("claude-code").setup({
  window = {
    position = "float",
    float = {
      width = "90%",      -- Take up 90% of the editor width
      height = "90%",     -- Take up 90% of the editor height
      row = "center",     -- Center vertically
      col = "center",     -- Center horizontally
      relative = "editor",
      border = "double",  -- Use double border style
    },
  },
})

How it Works

This plugin:

  1. Creates a terminal buffer running the Claude Code CLI
  2. Sets up autocommands to detect file changes on disk
  3. Automatically reloads files when they're modified by Claude Code
  4. Provides convenient keymaps and commands for toggling the terminal
  5. Automatically detects git repositories and sets working directory to the git root

Contributing

Contributions are welcome! Please check out our contribution guidelines for details on how to get started.

License

MIT License - See LICENSE for more information.

Development

For a complete guide on setting up a development environment, installing all required tools, and understanding the project structure, please refer to DEVELOPMENT.md.

Development Setup

The project includes comprehensive setup for development:

  • Complete installation instructions for all platforms in DEVELOPMENT.md
  • Pre-commit hooks for code quality
  • Testing framework with 44 comprehensive tests
  • Linting and formatting tools
  • Weekly dependency updates workflow for Claude CLI and actions
# Run tests
make test

# Check code quality
make lint

# Set up pre-commit hooks
scripts/setup-hooks.sh

# Format code
make format

Community

Acknowledgements


Made with ❤️ by Gregg Housh

常见问题

What is claude-code.nvim?

claude-code.nvim is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by greggh. Seamless integration between Claude Code AI assistant and Neovim. It has 2,092 GitHub stars.

Is claude-code.nvim safe to use?

Yes. claude-code.nvim passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install claude-code.nvim?

Clone the repository with "git clone https://github.com/greggh/claude-code.nvim" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is claude-code.nvim written in?

claude-code.nvim is primarily written in Lua. It is open-source under greggh on GitHub, so you can review or fork the full source.

Are there alternatives to claude-code.nvim?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh claude-code.nvim against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情