{"id":50731376,"url":"https://github.com/beixiyo/vv-markdown.nvim","last_synced_at":"2026-06-10T09:01:16.128Z","repository":{"id":362861693,"uuid":"1254135668","full_name":"beixiyo/vv-markdown.nvim","owner":"beixiyo","description":"Smart Markdown list editing for Neovim: auto-continue, renumber, indent, checkboxes, zero required deps. 智能 Markdown 列表编辑（续行 / 自增 / 自动重排 / 缩进 / 勾选），零必需依赖","archived":false,"fork":false,"pushed_at":"2026-06-06T08:03:21.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-06T10:05:49.091Z","etag":null,"topics":["checkbox","list","lua","markdown","markdown-list","neovim","neovim-plugin","nvim","nvim-plugin","ordered-list"],"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-05-30T07:23:04.000Z","updated_at":"2026-06-06T08:03:25.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/beixiyo/vv-markdown.nvim","commit_stats":null,"previous_names":["beixiyo/vv-markdown.nvim"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/beixiyo/vv-markdown.nvim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beixiyo%2Fvv-markdown.nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beixiyo%2Fvv-markdown.nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beixiyo%2Fvv-markdown.nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beixiyo%2Fvv-markdown.nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beixiyo","download_url":"https://codeload.github.com/beixiyo/vv-markdown.nvim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beixiyo%2Fvv-markdown.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":["checkbox","list","lua","markdown","markdown-list","neovim","neovim-plugin","nvim","nvim-plugin","ordered-list"],"created_at":"2026-06-10T09:01:15.124Z","updated_at":"2026-06-10T09:01:16.115Z","avatar_url":"https://github.com/beixiyo.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vv-markdown.nvim\n\nMarkdown 列表智能编辑：续行 / 自增 / 自动重排 / 缩进 / 勾选。纯 Lua 行扫描，依赖 `vv-utils.nvim`，与 `mini.pairs` 共存，treesitter / LSP 仅作可选增强\n\n## 功能\n\n| 能力 | 说明 |\n|------|------|\n| **智能续行** | insert `\u003cCR\u003e`：有序自增（`1.`→`2.`）、无序复制（`- * +`）、缩进保持、光标后文本下移、`1)` 风格、checkbox 项续空 `[ ]` |\n| **o / O 续行** | normal `o` / `O` 新建列表项，等价 insert `\u003cCR\u003e`；非列表行回退原生 |\n| **自动重排** | 删除 / 粘贴 / 撤销 / 缩进后（`TextChanged`）自动把有序列表归一为 `1,2,3`，防抖、幂等、不卡输入 |\n| **缩进签名** | 嵌套列表各层独立编号；缩进成子列表自动从 `1` 重排；tab/space 按视觉宽度归一 |\n| **空项退出** | 空列表项上回车 → 反缩进一级，或退出列表 |\n| **冒号缩进** | 行尾 `:` 回车 → 新项自动缩进一级 |\n| **缩进增减** | insert `\u003cC-t\u003e` / `\u003cC-d\u003e` 缩进 / 反缩进当前项并重排（非列表行回退原生） |\n| **勾选切换** | `[ ]` ↔ `[x]`（可配置多状态循环），normal 单行 / visual 范围 |\n| **代码块守卫** | 围栏代码块内不续行、不重排（treesitter 优先，regex 回退，标记感知） |\n| **mini.pairs 共存** | 非列表行 `\u003cCR\u003e` 回退 `MiniPairs.cr()`，`{}` / 引号 自动配对换行不失效 |\n| **gf 导航增强** | `[text](path#anchor)` 链接解析跳转，支持锚点定位标题，LSP（marksman）优先 |\n\n## 要求\n\n- Neovim \u003e= 0.10\n- **[vv-utils.nvim](https://github.com/beixiyo/vv-utils.nvim)**（必需）—— 防抖计时器\n- 可选 treesitter `markdown` parser —— 代码块守卫更精确，无则 regex 围栏计数回退\n- 可选 `mini.pairs` —— 非列表行 `\u003cCR\u003e` 回退自动配对\n- 可选 `render-markdown.nvim` —— 见下方「与 render-markdown 共存」\n\n## 安装\n\n[lazy.nvim](https://github.com/folke/lazy.nvim)：\n\n```lua\n{\n  'beixiyo/vv-markdown.nvim',\n  ft = 'markdown',\n  dependencies = { 'beixiyo/vv-utils.nvim' },\n  opts = {},   -- 见下方「配置」\n}\n```\n\n`vim.pack`（Neovim 0.12+）：\n\n```lua\nvim.pack.add({ 'https://github.com/beixiyo/vv-markdown.nvim' })\nrequire('vv-markdown').setup({})\n```\n\n## 配置\n\n调用 `setup()` 即生效，以下为默认值：\n\n```lua\nrequire('vv-markdown').setup({\n  enabled = true,\n  filetypes = { 'markdown' },\n  continue = true,              -- insert \u003cCR\u003e 续行\n  auto_renumber = true,         -- TextChanged 后自动重排\n  renumber_debounce = 60,       -- 防抖 ms\n  colon_indent = true,          -- 行尾冒号缩进子项\n  dedent_empty = true,          -- 空项回车反缩进（否则清空退出）\n  mini_pairs_fallback = true,   -- 非列表行回退 mini.pairs\n  settle_treesitter = true,     -- 编辑后同步刷新 md 树（防 render-markdown 读过期树越界）\n  gf_navigation = true,                -- 增强 gf：解析 [text](path#anchor) 链接跳转\n  checkbox = { states = { ' ', 'x' } },  -- 勾选循环序列，可设 { ' ', '-', 'x' }\n  keymaps = {\n    continue = '\u003cCR\u003e',          -- insert\n    indent = '\u003cC-t\u003e',           -- insert\n    dedent = '\u003cC-d\u003e',           -- insert\n    open_below = 'o',           -- normal\n    open_above = 'O',           -- normal\n    toggle_checkbox = '\u003cleader\u003ex',  -- normal / visual\n    renumber = '\u003cleader\u003enn',    -- normal，整表重排\n  },\n})\n```\n\n任一 keymap 设为 `false` 即关闭。所有键均为 **buffer-local + ft=markdown**，不污染其它 filetype\n\n## 命令\n\n`:VVMarkdownEnable` / `Disable` / `Toggle`、`:VVMarkdownRenumber`、`:VVMarkdownToggleCheckbox`（支持 range）\n\n## 与 render-markdown.nvim 共存\n\nrender-markdown 默认 `bullet.ordered_icons` 会按 **treesitter 兄弟位置**重算有序序号的显示。本插件已在真实 buffer 维护正确编号，二者对「缩进多少算嵌套」判定可能不一致 —— 例如有序标记 `1. ` 宽度为 3，用 2 空格缩进的嵌套项 treesitter 视为扁平列表，会把 `1.` 显示成 `3.`\n\n建议让 render-markdown 直接显示原文（单一数据源）：\n\n```lua\nrequire('render-markdown').setup({\n  bullet = {\n    ordered_icons = function(ctx) return vim.trim(ctx.value) end,\n  },\n})\n```\n\n\u003e 若希望编号在 GitHub 等外部渲染器也正确嵌套，请用 **≥ 父标记宽度**的缩进（`1. ` → 3 格，`10. ` → 4 格）\n\n## 命令行测试\n\n```sh\nnvim --headless -c \"lua vim.bo.filetype='markdown'\" \\\n  -c \"luafile tests/test_smoke.lua\" -c \"qa!\"\n```\n\n## 已知限制\n\n- **blockquote 内列表**（`\u003e 1. a`）暂不解析续行 / 重排\n- 序号宽度变化（`9.`→`10.`）时，**内容对齐**的续行子行缩进不自动跟随（固定缩进不受影响）\n- 自动重排在编辑后以**光标附近 ±3 行**为锚定位列表块；若编辑使光标停在离列表更远处，需手动 `\u003cleader\u003enn` / `:VVMarkdownRenumber`\n\n## 设计\n\n- 续行热路径用 **regex 行扫描**（treesitter 当前编辑行 stale，不可靠）\n- 重排用**缩进签名**：以缩进视觉宽度为 key 各维护计数器，遇更浅缩进清空更深层级 → 嵌套天然独立\n- 重排**幂等**（只改差异数字片段），故由 `TextChanged` 触发也不会自激递归\n- `\u003cCR\u003e` 用 **buffer-local expr** 映射遮蔽 mini.pairs 全局映射，列表行走 `\u003cCmd\u003econtinue\u003cCR\u003e`、非列表行 `return MiniPairs.cr()`\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeixiyo%2Fvv-markdown.nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeixiyo%2Fvv-markdown.nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeixiyo%2Fvv-markdown.nvim/lists"}