{"id":50731389,"url":"https://github.com/beixiyo/vv-git.nvim","last_synced_at":"2026-06-10T09:01:17.509Z","repository":{"id":353807826,"uuid":"1220666775","full_name":"beixiyo/vv-git.nvim","owner":"beixiyo","description":"VSCode-style git diff dual-pane viewer. VSCode 风格 git diff 双栏视图","archived":false,"fork":false,"pushed_at":"2026-05-29T03:10:54.000Z","size":320,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-29T05:10:55.271Z","etag":null,"topics":["diff","git","lua","neovim","neovim-plugin","nvim","nvim-plugin","version-control"],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beixiyo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-25T07:05:01.000Z","updated_at":"2026-05-29T03:10:58.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/beixiyo/vv-git.nvim","commit_stats":null,"previous_names":["beixiyo/vv-git.nvim"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/beixiyo/vv-git.nvim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beixiyo%2Fvv-git.nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beixiyo%2Fvv-git.nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beixiyo%2Fvv-git.nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beixiyo%2Fvv-git.nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beixiyo","download_url":"https://codeload.github.com/beixiyo/vv-git.nvim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beixiyo%2Fvv-git.nvim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34144680,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["diff","git","lua","neovim","neovim-plugin","nvim","nvim-plugin","version-control"],"created_at":"2026-06-10T09:01:15.711Z","updated_at":"2026-06-10T09:01:17.497Z","avatar_url":"https://github.com/beixiyo.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003evv-git.nvim\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cem\u003eVSCode 风格 git diff 双栏视图 — 专属 tab 隔离、自动折叠未改动代码\u003c/em\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Neovim-0.10+-57A143?style=flat-square\u0026logo=neovim\u0026logoColor=white\" alt=\"Requires Neovim 0.10+\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Lua-2C2D72?style=flat-square\u0026logo=lua\u0026logoColor=white\" alt=\"Lua\" /\u003e\n\u003c/p\u003e\n\n---\n\n## 安装\n\n```lua\n{\n  'beixiyo/vv-git.nvim',\n  dependencies = { 'beixiyo/vv-utils.nvim' },\n  cmd = { 'VVGit', 'VVGitToggle', 'VVGitClose' },\n  keys = { '\u003cleader\u003eb' },\n  ---@type VVGitConfig\n  opts = {\n    width = 30,                        -- 左栏宽度\n    single_col_threshold = 120,        -- 窗口列数 \u003c 此值时降级为单栏 + inline diff\n    keymap_toggle_panel = '\u003cleader\u003eb', -- 全局切换左栏的映射（false 禁用）\n    keymap_select = '\u003cTab\u003e',           -- 切换当前文件选中状态（多选）\n    fold_unchanged = true,             -- 折叠未改动代码\n    diff_fill = ' ',                   -- diff 空行填充符（Vim 默认 '-'）\n    preview = true,                    -- 光标移动到文件行时自动刷新右侧 diff\n    inline_diff_max_lines = 10000,     -- 单栏 inline diff 最大行数（超过跳过高亮）\n    diff_ratio = { 4, 6 },            -- 双栏 a_win:b_win 宽度比例（不填则 50:50）\n  },\n}\n```\n\n## 配置\n\n| 选项 | 类型 | 默认值 | 说明 |\n|------|------|--------|------|\n| `width` | `integer` | `30` | 左栏宽度（字符数） |\n| `single_col_threshold` | `integer` | `120` | 窗口列数低于此值时降级为单栏（仅 b 侧 + inline diff），≥ 此值双栏；resize 自动迁移 |\n| `keymap_toggle_panel` | `string \\| false` | `'\u003cleader\u003eb'` | 全局切换左栏可见性的映射；`false` 禁用 |\n| `fold_unchanged` | `boolean` | `true` | 未改动代码是否默认折叠（dual: `foldmethod=diff`；single: manual fold） |\n| `diff_fill` | `string` | `' '` | diff 空行填充符，映射到 `fillchars` 的 `diff:X` |\n| `preview` | `boolean` | `true` | 光标在左栏移动时自动刷新右侧 diff，无需手动 `\u003cCR\u003e` |\n| `inline_diff_max_lines` | `integer` | `10000` | 单栏模式下 `vim.diff` 最大支持行数，超过只显示文本不画高亮 |\n| `right_click` | `string \\| false` | `'toggle_stage'` | 右键触发的 action 名（如 `'yank_abs_path'`），`false` 禁用 |\n| `diff_ratio` | `integer[]` | 无（50:50） | 双栏模式下 a_win（旧版本）与 b_win（工作区）的宽度比例，如 `{4, 6}` 表示左窄右宽；不填则等宽 |\n| `diff_nowrap` | `boolean` | `true` | diff 视图强制关闭折行；`wrap` 在双栏模式下因两侧行高不一致会造成视觉错位，属于上游已知限制（[neovim/neovim#29518](https://github.com/neovim/neovim/issues/29518)、[diffview.nvim#198](https://github.com/sindrets/diffview.nvim/issues/198)），置为 `false` 可恢复默认折行行为 |\n| `highlights` | `table` | 无 | 覆盖任意 `VVGit*` 高亮组，叠加在自动计算值之上，切换主题后仍生效（见下方「自定义配色」）|\n| `keymap_select` | `string` | `'\u003cTab\u003e'` | 切换当前行选中状态（多选）；目录节点忽略 |\n| `select_move_down` | `boolean` | `false` | `\u003cTab\u003e` 切换选中后自动将光标下移一行 |\n| `binary.intercept` | `boolean` | `true` | 拦截二进制文件：预览时静默跳过，`\u003cCR\u003e`/`gf` 改用系统默认程序打开；`false` 禁用拦截 |\n| `binary.extensions` | `table\u003cstring, boolean\u003e` | 见下方 | 视为二进制的扩展名集合（小写 key）；`vim.tbl_deep_extend` 合并，只需写要覆盖的 key |\n\n\n## 二进制文件拦截\n\n默认开启。预览（光标移动）时静默跳过二进制文件；`\u003cCR\u003e`/`gf` 遇到二进制文件时改用系统默认程序打开，不在 nvim 内尝试渲染乱码 diff。\n\n内置扩展名覆盖：图片（png/jpg/gif/webp/heic/…）、视频（mp4/mkv/mov/…）、音频（mp3/wav/flac/…）、压缩包（zip/tar/gz/tgz/jar/deb/dmg/iso/…）、编译产物（exe/dll/so/wasm/bin/…）、字体（ttf/otf/woff/…）、二进制文档（pdf/docx/xlsx/…）、数据库（sqlite/db）。\n\n```lua\n-- 放行某类扩展名（未来 nvim 支持图片预览时）\nopts = {\n  binary = {\n    extensions = { png = false, jpg = false, jpeg = false },\n  },\n}\n\n-- 完全关闭拦截\nopts = { binary = { intercept = false } }\n\n-- 追加自定义扩展名\nopts = { binary = { extensions = { sketch = true, fig = true } } }\n```\n\n`binary.extensions` 走 `vim.tbl_deep_extend`，只需写要覆盖的 key，不必重写整张表。\n\n## 自定义配色\n\n`highlights` 字段接受任意 `VVGit*` 高亮组的覆盖，叠加在按 Normal 背景自动计算的默认色之上，切换 colorscheme 后依然生效：\n\n```lua\nopts = {\n  highlights = {\n    -- b 侧新增行（整行 / 词级）\n    VVGitDiffAdd          = { bg = '#1a3a1a' },\n    VVGitDiffChange       = { bg = '#152818' },\n    VVGitDiffText         = { bg = '#2a6a2a' },\n    -- a 侧对应填充行 / 删除行\n    VVGitDiffDeleteDim    = { fg = '#636b78', bg = '#1e1e2e' },\n    VVGitDiffAddAsDelete  = { bg = '#4a1a1a' },\n    VVGitDiffChangeDelete = { bg = '#2a1010' },\n    VVGitDiffTextDelete   = { bg = '#4a1a1a' },\n  },\n}\n```\n\n可覆盖的完整高亮组列表见 `lua/vv-git/hl.lua`。\n\n## 快捷键\n\n左栏面板内生效：\n\n| 键 | 说明 |\n|------|------|\n| `gf` | 跳转到文件 |\n| `Y` | 复制文件绝对路径 |\n| `\u003cTab\u003e` | 切换当前文件选中（多选；目录忽略，可配置 `keymap_select`） |\n| `\u003cEsc\u003e` | 选中非空时清空选中；否则关闭面板 |\n| `\u003cCR\u003e` / `l` | 文件：打开 diff；目录/**section 标题**：展开/折叠 |\n| `o` | 系统工具打开：文件→默认程序，目录→文件管理器 |\n| `X` | 按文件类型执行：解析运行器后确认，在底部分屏终端运行（仅文件节点） |\n| `h` | 折叠当前节点；光标在 **section 标题**（Staged / Changes / Merge Conflicts）上时折叠整个 section |\n| `-` | 单选：切换 stage/unstage；**多选**：批量 stage/unstage |\n| `d` | 单选—staged: unstage；unstaged: discard（确认）；**多选**：同单选规则批量执行 |\n| `c` | 提交（commit） |\n| `p` | 推送（push） |\n| `P` | 拉取（pull） |\n| `\u003cC-e\u003e` | 向下滚动 diff |\n| `\u003cC-y\u003e` | 向上滚动 diff |\n| `gc` | 查看 commit 本身的 diff：选分支 → 选 commit，展示该 commit 引入的变更（`commit^..commit`） |\n| `H` | 与 HEAD 比较：选分支 → 选 commit，展示 `commit..HEAD` 的差异 |\n| `g?` | 显示帮助 |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeixiyo%2Fvv-git.nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeixiyo%2Fvv-git.nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeixiyo%2Fvv-git.nvim/lists"}