Code Preview.Nvim banner
Cannon07 Cannon07

Code Preview.Nvim

AI community

Description

A Neovim plugin that shows a live diff preview of AI coding agent's file edits before you accept or reject them.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

code-preview.nvim

A Neovim plugin that shows a **diff preview before your AI coding agent applies any file change** — letting you review exactly what's changing before accepting.

Supports [Claude Code](https://docs.anthropic.com/en/docs/claude-code) and [OpenCode](https://opencode.ai) as backends.


Demo

Claude Code

![Claude Code demo](docs/claude-preview-demo.gif)

OpenCode

![OpenCode demo](docs/claude-preview-opencode.gif)


Table of Contents


Features

  • Diff preview — side-by-side or inline diff opens in Neovim before any file is written
  • Multiple layouts — tab, vsplit, or GitHub-style inline diff with syntax highlighting
  • Neo-tree integration — file tree indicators show which files are being modified, created, or deleted
  • Multi-backend — works with Claude Code CLI and OpenCode
  • No Python dependency — file transformations use nvim --headless -l

Requirements

  • Neovim >= 0.9

**For Claude Code backend:**

**For OpenCode backend:**


Installation

lazy.nvim

{
  "Cannon07/code-preview.nvim",
  config = function()
    require("code-preview").setup()
  end,
}

Manual (path-based)

vim.opt.rtp:prepend("/path/to/code-preview.nvim")
require("code-preview").setup()

Quick Start

Claude Code

  1. Install the plugin and call setup()
  2. Open a proje