{"id":13479032,"url":"https://github.com/neoclide/coc-git","last_synced_at":"2025-05-14T20:05:52.935Z","repository":{"id":34999240,"uuid":"184045811","full_name":"neoclide/coc-git","owner":"neoclide","description":"Git integration of coc.nvim","archived":false,"fork":false,"pushed_at":"2025-04-12T19:08:22.000Z","size":495,"stargazers_count":422,"open_issues_count":6,"forks_count":42,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-10T04:45:44.144Z","etag":null,"topics":["coc","git","neovim","vim"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neoclide.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"patreon":"chemzqm","custom":"https://www.paypal.com/paypalme/chezqm"}},"created_at":"2019-04-29T09:58:01.000Z","updated_at":"2025-04-12T19:08:25.000Z","dependencies_parsed_at":"2024-01-06T07:54:06.563Z","dependency_job_id":"177eab5e-d6fd-4bc8-a7ee-91c5c653eca6","html_url":"https://github.com/neoclide/coc-git","commit_stats":null,"previous_names":[],"tags_count":131,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoclide%2Fcoc-git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoclide%2Fcoc-git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoclide%2Fcoc-git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoclide%2Fcoc-git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neoclide","download_url":"https://codeload.github.com/neoclide/coc-git/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254219373,"owners_count":22034397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["coc","git","neovim","vim"],"created_at":"2024-07-31T16:02:08.066Z","updated_at":"2025-05-14T20:05:52.850Z","avatar_url":"https://github.com/neoclide.png","language":"TypeScript","funding_links":["https://patreon.com/chemzqm","https://www.paypal.com/paypalme/chezqm","https://www.patreon.com/chemzqm"],"categories":["TypeScript","Application"],"sub_categories":[],"readme":"# coc-git\n\nGit integration of [coc.nvim](https://github.com/neoclide/coc.nvim).\n\n**Note:** many useful features not implemented, it's recommended to\nuse plugin like [vim-fugitive](https://github.com/tpope/vim-fugitive) at the\nsame time.\n\n## Install\n\nIn your vim/neovim, run command:\n\n```\n:CocInstall coc-git\n```\n\n## Why\n\n- Always async.\n- Always refresh on TextChange.\n- Powerful list support.\n- Semantic commit and github issues completion support.\n\n## Features\n\n- Sign support for git status of current buffer.\n- Git status of current project, by `g:coc_git_status`.\n- Git status of current buffer, by`b:coc_git_status`.\n- Git status of current line, by`b:coc_git_blame` for statusline, and `addGBlameToVirtualText` for inline blames.\n- Git related lists, including `issues`, `gfiles`, `gstatus`, `commits`, `branches` \u0026 `bcommits`\n- Keymaps for git chunks, including `\u003cPlug\u003e(coc-git-chunkinfo)` `\u003cPlug\u003e(coc-git-nextchunk)` \u0026 `\u003cPlug\u003e(coc-git-prevchunk)` ,\n- Commands for chunks, including `git.chunkInfo` `git.chunkStage` `git.chunkUndo` and more.\n- Keymaps \u0026 commands for git conflicts.\n- Completion support for semantic commit.\n- Completion support for GitHub/GitLab issues.\n\n**Note** for GitHub issues completion support:\n\n- `GITHUB_API_TOKEN=xxx` needs to be set in env to fetch issues from private repositories\n\n**Note** for GitLab issues completion support:\n\n- current only API `v4` support, which availabled since GitLab 9.0\n- `GITLAB_PRIVATE_TOKEN=XXX` needs to be set in env, check [Personal access tokens](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)\n- GitLab host needs to be set in `coc-settings.json`, for example `\"git.gitlab.hosts\": [\"gitlab.example.com\", \"gitlab.com\"]`\n\n## Configuration\n\n- `git.command`: Command for git, could be absolute path of git executable., default: `\"git\"`\n\n- `git.remoteName`: Remote name for fetch github issues., default: `\"origin\"`\n\n- `git.diffOptions`: Options for git diff command, eg: `[\"--ignore-all-space\"]`, default: `[]`\n\n- `git.foldContext`: Line count to leave below and above the fold, default: `0`.\n\n- `git.browserRemoteName`: Remote name for browserOpen and copyUrl., default: `\"\"`\n\n- `git.browserBranchName`: Branch name for browserOpen and copyUrl., default: `\"\"`\n\n- `git.urlFix`: a object to configure the url style of copyUrl and browserOpen, make this two command support other git services like gitlab and gitea. default: `{}`\n\n- `git.issueFormat`: Formatting string for issue completion. Supported interpolation variables: %i - issue id. %r - repository name. %o - organization/owner name. %t - issue title. %b - issue body. %c - issue created at. %a - issue author. %u - issue url., default: `\"#%i\"`\n\n- `git.virtualTextPrefix`: Prefix of git blame infomation to virtual text, require virtual text feature of neovim., default: `\" \"`\n\n- `git.addGBlameToVirtualText`: Add git blame information to virtual text, require virtual text feature of neovim., default: `false`\n\n- `git.addGBlameToBufferVar`: Add git blame information to b:coc_git_blame., default: `false`\n\n- `git.branchCharacter`: Branch character used with g:coc_git_status, default: `\"\"`\n\n- `git.changedDecorator`: Git changed decorator used with g:coc_git_status, default: `\"*\"`\n\n- `git.conflictedDecorator`: Git conflicted decorator used with g:coc_git_status, default: `\"x\"`\n\n- `git.stagedDecorator`: Git staged decorator used with g:coc_git_status, default: `\"●\"`\n\n- `git.untrackedDecorator`: Git untracked decorator used with g:coc_git_status, default: `\"…\"`\n\n- `git.enableGlobalStatus`: Enable global g:coc_git_status., default: `true`\n\n- `git.enableGutters`: Enable gutters in sign column., default: `true`\n\n- `git.realtimeGutters`: Update gutters in realtime, default: true., default: `true`\n\n- `git.signPriority`: Priority of sign gutters, default to `10`.\n\n- `git.changedSign.text`: Text of changed sign., default: `\"~\"`\n\n- `git.changedSign.hlGroup`: Highlight group for changed sign., default: `\"DiffChange\"`\n\n- `git.addedSign.text`: Text of added sign., default: `\"+\"`\n\n- `git.addedSign.hlGroup`: Highlight group for added sign., default: `\"DiffAdd\"`\n\n- `git.removedSign.text`: Text of removed sign., default: `\"_\"`\n\n- `git.removedSign.hlGroup`: Highlight group for removed sign., default: `\"DiffDelete\"`\n\n- `git.topRemovedSign.text`: Text of top removed sign., default: `\"‾\"`\n\n- `git.topRemovedSign.hlGroup`: Highlight group for top removed sign., default: `\"DiffDelete\"`\n\n- `git.changeRemovedSign.text`: Text of change removed sign., default: `\"≃\"`\n\n- `git.changeRemovedSign.hlGroup`: Highlight group for change removed sign., default: `\"DiffChange\"`\n\n- `git.semanticCommit.filetypes`: Enabled filetypes, default: `[\"gitcommit\",\"gina-commit\"]`\n\n- `git.semanticCommit.scope`: Commit message with scope field, default: `true`\n\n- `git.splitWindowCommand`: Command used when split new window for show commit., default: `\"above sp\"`\n\n- `git.showCommitInFloating`: Show commit in floating or popup window, default: `false`\n\n- `git.floatConfig`: Configure style of float window/popup, extends from floatFactory.floatConfig\n\n- `git.gitlab.hosts`: Custom GitLab hosts, default: `[\"gitlab.com\"]`\n\n- `git.conflict.enabled`: Enable highlight conflict lines, default: `true`\n\n- `git.conflict.current.hlGroup`: Highlight group for the current version of a merge conflict, default: `\"DiffChange\"`\n\n- `git.conflict.incoming.hlGroup`: Highlight group for the incoming version of a merge conflict., default: `\"DiffAdd\"`\n\nmore information, see [package.json](https://github.com/neoclide/coc-git/blob/master/package.json)\n\n**Note** for user from [vim-gitgutter](https://github.com/airblade/vim-gitgutter),\nif your have highlight groups defined for vim-gitgutter, you can use:\n\n```json\n\"git.addedSign.hlGroup\": \"GitGutterAdd\",\n\"git.changedSign.hlGroup\": \"GitGutterChange\",\n\"git.removedSign.hlGroup\": \"GitGutterDelete\",\n\"git.topRemovedSign.hlGroup\": \"GitGutterDelete\",\n\"git.changeRemovedSign.hlGroup\": \"GitGutterChangeDelete\",\n```\n\nWhen you have `git.addGBlameToVirtualText` enabled, use command\n`let g:coc_git_hide_blame_virtual_text = !get(g:, 'coc_git_hide_blame_virtual_text', 0)` to dynamic toggle virtual text.\n\n## Usage\n\n### Statusline integration\n\n- `g:coc_git_status` including git branch and current project status.\n- `b:coc_git_status` including changed lines of current buffer.\n- `b:coc_git_blame` including blame info of current line.\n\nExample for lightline user:\n\n```viml\n\" lightline\nlet g:lightline = {\n  \\ 'active': {\n  \\   'left': [\n  \\     [ 'mode', 'paste' ],\n  \\     [ 'ctrlpmark', 'git', 'diagnostic', 'cocstatus', 'filename', 'method' ]\n  \\   ],\n  \\   'right':[\n  \\     [ 'filetype', 'fileencoding', 'lineinfo', 'percent' ],\n  \\     [ 'blame' ]\n  \\   ],\n  \\ },\n  \\ 'component_function': {\n  \\   'blame': 'LightlineGitBlame',\n  \\ }\n\\ }\n\nfunction! LightlineGitBlame() abort\n  let blame = get(b:, 'coc_git_blame', '')\n  \" return blame\n  return winwidth(0) \u003e 120 ? blame : ''\nendfunction\n```\n\nIf you're not using statusline plugin, you can add them to statusline by:\n\n```vim\nset statusline^=%{get(g:,'coc_git_status','')}%{get(b:,'coc_git_status','')}%{get(b:,'coc_git_blame','')}\n```\n\n### User autocmd\n\n```vim\nautocmd User CocGitStatusChange {command}\n```\n\nTriggered after the `g:coc_git_status` `b:coc_git_status` `b:coc_git_blame` has changed.\n\nCould be used for update the statusline.\n\n### Keymaps\n\nCreate keymappings like:\n\n```vim\n\" navigate chunks of current buffer\nnmap [g \u003cPlug\u003e(coc-git-prevchunk)\nnmap ]g \u003cPlug\u003e(coc-git-nextchunk)\n\" navigate conflicts of current buffer\nnmap [c \u003cPlug\u003e(coc-git-prevconflict)\nnmap ]c \u003cPlug\u003e(coc-git-nextconflict)\n\" show chunk diff at current position\nnmap gs \u003cPlug\u003e(coc-git-chunkinfo)\n\" show commit contains current position\nnmap gc \u003cPlug\u003e(coc-git-commit)\n\" create text object for git chunks\nomap ig \u003cPlug\u003e(coc-git-chunk-inner)\nxmap ig \u003cPlug\u003e(coc-git-chunk-inner)\nomap ag \u003cPlug\u003e(coc-git-chunk-outer)\nxmap ag \u003cPlug\u003e(coc-git-chunk-outer)\n```\n\n### Commands\n\nUse command `:CocCommand` to open commands and type `git.` to get all git\nrelated commands.\n\n- `:CocCommand git.copyUrl` Copy url of current line to clipboard.\n- `:CocCommand git.nextChunk` Navigate to the next chunk.\n- `:CocCommand git.prevChunk` Navigate to the previous chunk.\n- `:CocCommand git.chunkInfo` Show chunk info under cursor.\n- `:CocCommand git.chunkUndo` Undo current chunk.\n- `:CocCommand git.chunkStage` Stage current chunk.\n- `:CocCommand git.chunkUnstage` Unstage chunk that contains current line.\n- `:CocCommand git.diffCached` Show cached diff in preview window.\n- `:CocCommand git.showCommit` Show commit of current chunk.\n- `:CocCommand git.browserOpen` Open current line in browser\n- `:CocCommand git.foldUnchanged` Fold unchanged lines of current buffer.\n- `:CocCommand git.toggleGutters` Toggle git gutters in sign column.\n- `:CocCommand git.push` push code of current branch to remote.\n\n### Work with git lists\n\nTo open a specified coc list, you have different ways:\n\n- Run `:CocList` and select the list by `\u003cCR\u003e`.\n- Run `:CocList` and type name of list for completion.\n- Create keymap for open specified list with list options, like:\n\n  ```vim\n  nnoremap \u003csilent\u003e \u003cspace\u003eg  :\u003cC-u\u003eCocList --normal gstatus\u003cCR\u003e\n  ```\n\nTo toggle list mode, use `\u003cC-o\u003e` and `i`.\n\nTo move up\u0026down on insertmode, use `\u003cC-j\u003e` and `\u003cC-k\u003e`\n\nTo run a action, press `\u003ctab\u003e` and select the action.\n\nFor more advance usage, checkout `:h coc-list`.\n\n### Issue autocomplete from multiple GitHub repositories\n\nTo enable autocompletion of issues from multiple GitHub repositories, put a comma-separated list of issue repository specifiers in the git config variable `coc-git.issuesources`.\nAn issue repository specifier looks like this: `github/neoclide/coc-git`.\n\n- The first part specifies the issue provider, currently only \"github\" is supported\n- The second part specifies the organization or owner of the repository\n- The third part specifies the repository name\n\nMultiple repositories can be specified using comma separation, like this: `github/neoclide/coc-git,github/neoclide/coc.nvim`\n\n## F.A.Q\n\nQ: Virtual text not working.\n\nA: Make sure your neovim/vim support virtual text by command `:echo has('nvim-0.5.0') || has('patch-9.0.0067')`.\n\n## Supporting\n\nIf you like my extension, consider supporting me on Patreon or PayPal:\n\n\u003ca href=\"https://www.patreon.com/chemzqm\"\u003e\u003cimg src=\"https://c5.patreon.com/external/logo/become_a_patron_button.png\" alt=\"Patreon donate button\" /\u003e \u003c/a\u003e\n\u003ca href=\"https://www.paypal.com/paypalme/chezqm\"\u003e\u003cimg src=\"https://werwolv.net/assets/paypal_banner.png\" alt=\"PayPal donate button\" /\u003e \u003c/a\u003e\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneoclide%2Fcoc-git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneoclide%2Fcoc-git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneoclide%2Fcoc-git/lists"}