A Neovim plugin aiming to replicate the smooth, sexy, and visual diff experience of VS Code.
- Visual Fidelity: Match VS Code's diff colors and highlighting style.
- Smart Diffing: Use Neovim's
linematchfor precise intra-line comparisons. - Git Integration: Seamlessly compare working files against HEAD or other commits.
- Side-by-Side: Classic split view with synchronized scrolling.
- Jump Between Changes: Press
nfor next change,Nfor previous change - Quick Close: Press
Escorqto close the diff view - Git Blame: Press
bto show git blame info for the current line - Copy from Git: Press
gto copy the current hunk from the git version to your working copy - Custom Colors: Override the default VS Code colors with your own palette
- Diff Against Buffer: Compare your current file with any other open buffer
- Gutter Signs: Visual indicators (+/-/~) show additions, deletions, and changes in the gutter
- Hunk Actions: Apply or revert hunks with
a(apply from git) andr(revert to git) - Current Hunk Highlight: Automatically highlights the hunk under your cursor
- Diff Two Commits: Compare any two commits interactively with
:VscodeDiffCommits
Run :VscodeDiff to diff the current file against HEAD.
Run :VscodeDiff <commit_hash> to compare against a specific commit.
Run :VscodeDiffPick to select a commit from an interactive menu.
Run :VscodeDiffBuffer to compare the current file against another open buffer.
Run :VscodeDiffBlame to show git blame info for the current line (also works with b key in diff mode).
Run :VscodeDiffCopy to copy the current hunk from git version to working copy (also works with g key in diff mode).
Run :VscodeDiffCommits to interactively select two commits and compare them. First select the older commit, then select the newer commit.
Run :VscodeDiffApply to apply the current hunk from the git version to your working copy (also works with a key in diff mode).
Run :VscodeDiffRevert to revert the current hunk to the git version (also works with r key in diff mode).
n- Jump to next changeN- Jump to previous changeEsc/q- Close diff viewb- Show git blame for current lineg- Copy hunk from git to working copya- Apply current hunk from git version to working copyr- Revert current hunk to git version
Customize colors with the setup() function:
require("vscode-diff").setup({
colors = {
DiffAdd = { bg = "#your_color" },
DiffDelete = { bg = "#your_color" },
DiffChange = { bg = "#your_color" },
DiffText = { bg = "#your_color" },
}
}){
"bbuchanan/vscode-diff.nvim",
config = function()
require("vscode-diff").setup()
end,
}Plug 'bbuchanan/vscode-diff.nvim'use 'bbuchanan/vscode-diff.nvim'If you are developing this plugin locally, point your plugin manager to the local directory.
{
"vscode-diff",
dir = "~/projects/vscode-diff-nvim", -- Adjust path if needed
config = function()
require("vscode-diff").setup()
end,
}