{"id":32674866,"url":"https://github.com/Kaiser-Yang/blink-cmp-git","last_synced_at":"2025-11-01T06:02:27.022Z","repository":{"id":271811685,"uuid":"914164684","full_name":"Kaiser-Yang/blink-cmp-git","owner":"Kaiser-Yang","description":"Git source for blink.cmp","archived":false,"fork":false,"pushed_at":"2025-09-20T04:30:51.000Z","size":890,"stargazers_count":68,"open_issues_count":7,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-20T06:20:11.294Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/Kaiser-Yang.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2025-01-09T04:17:45.000Z","updated_at":"2025-09-20T04:30:54.000Z","dependencies_parsed_at":"2025-02-22T06:18:36.516Z","dependency_job_id":"66db3a41-cc0d-4a1b-bc93-049ef7529857","html_url":"https://github.com/Kaiser-Yang/blink-cmp-git","commit_stats":null,"previous_names":["kaiser-yang/blink-cmp-git"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/Kaiser-Yang/blink-cmp-git","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaiser-Yang%2Fblink-cmp-git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaiser-Yang%2Fblink-cmp-git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaiser-Yang%2Fblink-cmp-git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaiser-Yang%2Fblink-cmp-git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kaiser-Yang","download_url":"https://codeload.github.com/Kaiser-Yang/blink-cmp-git/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaiser-Yang%2Fblink-cmp-git/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":282101880,"owners_count":26614352,"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","status":"online","status_checked_at":"2025-11-01T02:00:06.759Z","response_time":61,"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":[],"created_at":"2025-11-01T06:01:18.431Z","updated_at":"2025-11-01T06:02:27.016Z","avatar_url":"https://github.com/Kaiser-Yang.png","language":"Lua","readme":"# blink-cmp-git\n\nGit source for [blink.cmp](https://github.com/Saghen/blink.cmp)\ncompletion plugin. This makes it possible to query pull requests, issues,\nand users from GitHub or GitLab. This is very useful when you are writing a commit with `nvim`.\n\nUse `#` to search for issues and pull requests (`!` for `gitlab`'s merge requests):\n\n![blink-cmp-git pr and issues](./images/demo-prs-issues.png)\n\nUse `:` to search for commits:\n\n![blink-cmp-git commits](./images/demo-commits.png)\n\nUse `@` to search for users:\n\n![blink-cmp-git pr and issues](./images/demo-users.png)\n\n## Requirements\n\n`git` is required for default configurations.\n\n`gh` is required for the `github` related features.\n\n`glab` is required for the `gitlab` related features.\n\nRun `checkhealth blink-cmp-git` to check the requirements.\n\n## Installation\n\nAdd the plugin to your packer managers, and make sure it is loaded before `blink.cmp`.\n\n### `lazy.nvim`\n\n```lua\n{\n    'saghen/blink.cmp',\n    dependencies = {\n        {\n            'Kaiser-Yang/blink-cmp-git',\n        }\n        -- ... other dependencies\n    },\n    opts = {\n        sources = {\n            -- add 'git' to the list\n            default = { 'git', 'dictionary', 'lsp', 'path', 'luasnip', 'buffer' },\n            providers = {\n                git = {\n                    module = 'blink-cmp-git',\n                    name = 'Git',\n                    opts = {\n                        -- options for the blink-cmp-git\n                    },\n                },\n            }\n        }\n    }\n}\n```\n\n## Quick Start\n\n```lua\ngit = {\n    module = 'blink-cmp-git',\n    name = 'Git',\n    -- only enable this source when filetype is gitcommit, markdown, or 'octo'\n    enabled = function()\n        return vim.tbl_contains({ 'octo', 'gitcommit', 'markdown' }, vim.bo.filetype)\n    end,\n    --- @module 'blink-cmp-git'\n    --- @type blink-cmp-git.Options\n    opts = {\n        commit = {\n            -- You may want to customize when it should be enabled\n            -- The default will enable this when `git` is found and `cwd` is in a git repository\n            -- enable = function() end\n            -- You may want to change the triggers\n            -- triggers = { ':' },\n        }\n        git_centers = {\n            github = {\n                -- Those below have the same fields with `commit`\n                -- Those features will be enabled when `git` and `gh` (or `curl`) are found and\n                -- remote contains `github.com`\n                -- issue = {\n                --     get_token = function() return '' end,\n                -- },\n                -- pull_request = {\n                --     get_token = function() return '' end,\n                -- },\n                -- mention = {\n                --     get_token = function() return '' end,\n                --     get_documentation = function(item)\n                --         local default = require('blink-cmp-git.default.github')\n                --             .mention.get_documentation(item)\n                --         default.get_token = function() return '' end\n                --         return default\n                --     end\n                -- }\n            },\n            gitlab = {\n                -- Those below have the same fields with `commit`\n                -- Those features will be enabled when `git` and `glab` (or `curl`) are found and\n                -- remote contains `gitlab.com`\n                -- issue = {\n                --     get_token = function() return '' end,\n                -- },\n                -- NOTE:\n                -- Even for `gitlab`, you should use `pull_request` rather than`merge_request`\n                -- pull_request = {\n                --     get_token = function() return '' end,\n                -- },\n                -- mention = {\n                --     get_token = function() return '' end,\n                --     get_documentation = function(item)\n                --         local default = require('blink-cmp-git.default.gitlab')\n                --            .mention.get_documentation(item)\n                --         default.get_token = function() return '' end\n                --         return default\n                --     end\n                -- }\n            }\n        }\n    }\n},\n```\n\nThe configuration above will enable the `blink-cmp-git` for `blink.cmp` and show the items\nwhen the file's type is `gitcommit` or `markdown`. By default, `blink-cmp-git` will pre-cache\neverything when it is created. To enable `blink-cmp-git` all the time makes it possible to\npre-cache when you enter insert mode or other mode you can input\n(`blink.cmp` will create sources when you can input something).\n\n\u003e [!NOTE]\n\u003e The default configuration will use `curl` when `gh` or `glab` is not found.\n\u003e\n\u003e For `github` users, if you customize the `get_token`, you should see those below to know\n\u003e which permissions are required:\n\u003e\n\u003e - [commit (for `octo.nvim` users)](https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#list-commits)\n\u003e - [issue](https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#list-repository-issues)\n\u003e - [pull-request](https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#list-pull-requests)\n\u003e - [mention](https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-repository-contributors)\n\u003e\n\u003e For `gitlab` users, see [PAT](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)\n\u003e to know how to get the token.\n\n\u003e [!NOTE]\n\u003e For [octo.nvim](https://github.com/pwntester/octo.nvim) users, `blink-cmp-git` supports it.\n\u003e By default, when you are in a `octo` file, `blink-cmp-git` will use the `octo`'s\n\u003e path to get the `owner` and `repo` to fetch the items.\n\n## Reload Cache\n\nThere are many cases that will make the cache invalid. For example, if your\n`cwd` is in a repository, later you switch your `cwd` to another repository,\nthe cache will use the first repository's result. To solve this problem, there\nis a command to reload the cache: `BlinkCmpGitReloadCache`. This command will\nclear the cache.\n\n`blink-cmp-git` will create a auto command which uses `should_reload_cache` to determine\nwhether or not to reload cache when entering insert mode.\nThe default `should_reload_cache` will return `true` when detecting another `git` repository\nfrom `octo` or `cwd`.\n\n\u003e [!NOTE]\n\u003e\n\u003e The command will be available only when the `blink-cmp-git` source is created. Usually,\n\u003e the source will be created when it is enabled and you are in some mode you can input.\n\n## Default Configuration\n\nSee [default.lua](./lua/blink-cmp-git/default/init.lua).\n\n## FAQs\n\n### How to customize the completion items?\n\nBecause all features have same fields, I'll use `commit` as an example.\n\nThe `blink-cmp-git` will first run command from `get_command` and `get_command_args`. The standout\nof the command will be passed to `separate_output`. So if you want to customize the completion\nitems, you should be aware of what the output of your command looks like.\n\nIn most situations, you just need to customize\n`get_label`, `get_kind_name`, `get_insert_text` and `get_documentation`. Before you customize them,\nyou should be aware of what the item looks like. See [item](/doc/item/) to know what them look like.\nThe commit item looks like this below:\n\n```gitcommit\ncommit 0216336d8ff00d7b8c9304b23bcca31cbfcdf2c8\nAuthor:     Kaiser-Yang \u003c624626089@qq.com\u003e\nAuthorDate: Sun Jan 12 14:40:38 2025 +0800\nCommit:     Kaiser-Yang \u003c624626089@qq.com\u003e\nCommitDate: Sun Jan 12 14:43:15 2025 +0800\n\n    Cache empty documentations\n\n```\n\nThe default getters for `commit`:\n\n```lua\ngit_centers = {\n    commit = {\n        -- use the first 7 hash and the first line of the commit message as the label\n        get_label = function(item)\n            -- For `octo.nvim` users, the `item` is a table\n            if type(item) == 'table' then\n                return item.sha:sub(1, 7) .. ' ' .. item.commit.message:match('([^\\n]*)')\n            end\n            return item:match('commit ([^\\n]*)'):sub(1, 7) .. ' ' .. item:match('\\n\\n%s*([^\\n]*)')\n        end,\n        -- use 'Commit' as the kind name\n        get_kind_name = function(_)\n            return 'Commit'\n        end,\n        -- use the first 7 hash as the insert text\n        get_insert_text = function(item)\n            -- For `octo.nvim` users, the `item` is a table\n            if type(item) == 'table' then\n                return item.sha:sub(1, 7)\n            end\n            return item:match('commit ([^\\n]*)'):sub(1, 7)\n        end,\n        -- use the whole commit message as the documentation\n        get_documentation = function(item)\n            -- For `octo.nvim` users, the `item` is a table\n            if type(item) == 'table' then\n                return\n                    'commit ' .. item.sha .. '\\n' ..\n                    'Author:     ' .. item.commit.author.name ..\n                        ' \u003c' .. item.commit.author.email .. '\u003e\\n' ..\n                    'AuthorDate: ' .. item.commit.author.date .. '\\n' ..\n                    'Commit:     ' .. item.commit.committer.name ..\n                        ' \u003c' .. item.commit.committer.email .. '\u003e\\n' ..\n                    'CommitDate: ' .. item.commit.committer.date .. '\\n' ..\n                    item.commit.message\n            end\n            return item\n            -- or you can use `blink-cmp-git.DocumentationCommand` to get the documentation\n            -- return {\n            --     -- the command to get the documentation\n            --     get_command = '',\n            --     get_command_args = {}\n            --     -- how to resolve the output\n            --     resolve_documentation = function(output) return output end\n            -- }\n            -- or return nil to disable the documentation\n            -- return nil\n        end,\n    }\n}\n```\n\n\u003e [!NOTE]\n\u003e\n\u003e `kind_name` is used by those default options:\n\u003e\n\u003e - `kind_icons`\n\u003e\n\u003e Therefore, if you customize the `kind_name`, you should customize them too.\n\n### How to customize the error message?\n\nFrom the version `v0.2.0`, there is a configuration `on_error` for all the `GCSCompletionOptions`.\n`on_error` is a function like `func(return_value: number, standard_error: string): boolean`.\n\nWhen `blink-cmp-git` find a non-zero return value or a non-empty standard error, it will call\n`on_error` with the return value and the standard error. If `on_error` returns `false`, the error\nwill be ignored, which means `blink-cmp-git` will go on to the next step. When `on_error` returns\n`true`, `blink-cmp-git` will not go on to the next step. The default `on_error` is to show the\nerror message and return `true`.\n\nFor example, if you want to disable the error message for `commit`,\nyou just need to use those below:\n\n```lua\ncommit = {\n    on_error = function(_, _) return true end\n}\n```\n\n### How to add trailing white spaces?\n\nFor example, those below will add a trailing white space for `commit`:\n\n```lua\ncommit = {\n    -- or you can update it to other contents such as '\\n'\n    insert_text_trailing = ' '\n}\n```\n\n**NOTE**: If you enable pre-insert, switch between items with spaces may make the completion menu\ndisappear. This may be related with `treesitter`.\n\n### How to customize the highlight?\n\nSuppose the item in your completion list is like this below:\n\n```\n PR #1 Add a new feature\n```\n\n| Highlight Group Name              | Description             |\n| --------------------------------- | ----------------------- |\n| `BlinkCmpGitKind\u003ckind_name\u003e`      | For ``                 |\n| `BlinkCmpGitKindIcon\u003ckind_name\u003e`  | For `PR`                |\n| `BlinkCmpGitLabel\u003ckind_name\u003eId`   | For `#1`                |\n| `BlinkCmpGitLabel\u003ckind_name\u003eRest` | For `Add a new feature` |\n\n\u003e [!NOTE]\n\u003e The `Id` part is got by seperating the label by whitespaces, if you customize the `get_label`,\n\u003e you may need to customize the `label_highlight` too.\n\u003e See [default.lua](./lua/blink-cmp-git/default/init.lua) to learn how to customize it.\n\nThe default `\u003ckind_name\u003e` are `Commit`, `Issue`, `PR`, `MR`, and `Mention`.\n\nBesides, you can also customize different highlight for open, closed,\nlocked and merged pull requests or issues.\n\nBy default, `blink-cmp-git` will only fetch the open pull requests or issues. So you should\ncustomize the `api` parameters to fetch all states.\nSee [How to customize the APIs?](#how-to-customize-the-apis).\n\nFirstly, you should update the `get_kind_name` to customize the `kind_name`:\n\n```lua\ngit_centers = {\n    github = {\n        pull_request = {\n            get_kind_name = function(item)\n                -- openPR, closedPR, mergedPR, draftPR, lockedPR\n                return item.locked and 'lockedPR' or\n                    item.draft and 'draftPR' or\n                    item.merged_at and 'mergedPR' or\n                    item.state .. 'PR'\n            end,\n        },\n        issue = {\n            get_kind_name = function(item)\n                -- openIssue, reopenedIssue, completedIssue\n                -- not_plannedIssue, lockedIssue, duplicateIssue\n                return item.locked and 'lockedIssue' or\n                    (item.state_reason or item.state) .. 'Issue'\n            end,\n        },\n    },\n    gitlab = {\n        pull_request = {\n            get_kind_name = function(item)\n                -- openedPR, closedPR, mergedPR, draftPR, lockedPR\n                return item.discussion_locked and 'lockedPR' or\n                    item.draft and 'draftPR' or\n                    item.state .. 'PR'\n            end,\n        },\n        issue = {\n            get_kind_name = function(item)\n                -- openedIssue, closedIssue\n                return item.discussion_locked and 'lockedIssue' or\n                    item.state .. 'Issue'\n            end,\n        },\n    }\n}\n```\n\nThen, you can update the icons for the `kind_name`:\n\n```lua\nkind_icons = {\n    openPR = '',\n    openedPR = '',\n    closedPR = '',\n    mergedPR = '',\n    draftPR = '',\n    lockedPR = '',\n    openIssue = '',\n    openedIssue = '',\n    reopenedIssue = '',\n    completedIssue = '',\n    closedIssue = '',\n    not_plannedIssue = '',\n    duplicateIssue = '',\n    lockedIssue = '',\n}\n```\n\nHere is an example for `github`-like highlight:\n\n```lua\nlocal blink_cmp_kind_name_highlight = {\n    Commit = { default = false, fg = '#a6e3a1' },\n    Mention = { default = false, fg = '#a6e3a1' },\n    openPR = { default = false, fg = '#a6e3a1' },\n    openedPR = { default = false, fg = '#a6e3a1' },\n    closedPR = { default = false, fg = '#f38ba8' },\n    mergedPR = { default = false, fg = '#cba6f7' },\n    draftPR = { default = false, fg = '#9399b2' },\n    lockedPR = { default = false, fg = '#f5c2e7' },\n    openIssue = { default = false, fg = '#a6e3a1' },\n    openedIssue = { default = false, fg = '#a6e3a1' },\n    reopenedIssue = { default = false, fg = '#a6e3a1' },\n    completedIssue = { default = false, fg = '#cba6f7' },\n    closedIssue = { default = false, fg = '#cba6f7' },\n    not_plannedIssue = { default = false, fg = '#9399b2' },\n    duplicateIssue = { default = false, fg = '#9399b2' },\n    lockedIssue = { default = false, fg = '#f5c2e7' },\n}\nfor kind_name, hl in pairs(blink_cmp_kind_name_highlight) do\n    vim.api.nvim_set_hl(0, 'BlinkCmpGitKind' .. kind_name, hl)\n    vim.api.nvim_set_hl(0, 'BlinkCmpGitKindIcon' .. kind_name, hl)\n    vim.api.nvim_set_hl(0, 'BlinkCmpGitLabel' .. kind_name .. 'Id', hl)\nend\n```\n\nYou may also need to update the `configure_score_offset`, otherwise the default may not work as you\nexpected. There is an example:\n\n```lua\nlocal function pr_or_issue_configure_score_offset(items)\n    -- Bonus to make sure items sorted as below:\n    local keys = {\n        -- place `kind_name` here\n        { 'openIssue',     'openedIssue', 'reopenedIssue' },\n        { 'openPR',        'openedPR' },\n        { 'lockedIssue',   'lockedPR' },\n        { 'completedIssue' },\n        { 'draftPR' },\n        { 'mergedPR' },\n        { 'closedPR',      'closedIssue', 'not_plannedIssue', 'duplicateIssue' },\n    }\n    local bonus = 999999\n    local bonus_score = {}\n    for i = 1, #keys do\n        for _, key in ipairs(keys[i]) do\n            bonus_score[key] = bonus * (#keys - i)\n        end\n    end\n    for i = 1, #items do\n        local bonus_key = items[i].kind_name\n        if bonus_score[bonus_key] then\n            items[i].score_offset = bonus_score[bonus_key]\n        end\n        -- sort by number when having the same bonus score\n        local number = items[i].label:match('[#!](%d+)')\n        if number then\n            if items[i].score_offset == nil then\n                items[i].score_offset = 0\n            end\n            items[i].score_offset = items[i].score_offset + tonumber(number)\n        end\n    end\nend\n\ngit_centers = {\n    github = {\n        pull_request = {\n            configure_score_offset = pr_or_issue_configure_score_offset,\n        },\n        issue = {\n            configure_score_offset = pr_or_issue_configure_score_offset,\n        },\n    },\n    gitlab = {\n        pull_request = {\n            configure_score_offset = pr_or_issue_configure_score_offset,\n        },\n        issue = {\n            configure_score_offset = pr_or_issue_configure_score_offset,\n        },\n    }\n}\n```\n\n### How to customize for enterprise `github` or `gitlab`?\n\nFirstly, you should update the `enable` for each feature, the default `enable` will enable the\nplugin when `github.com` found for `github` repository and `gitlab.com` found for `gitlab`\nrepository in your remote URLs. I'll give you an example for `github`'s issue:\n\n```lua\ngit_centers = {\n    github = {\n        issue = {\n            enable = function()\n                -- Get the default enable result\n                local enable = require('blink-cmp-git.default.github')\n                    .issue\n                    .enable()\n                local utils = require('blink-cmp-git.utils')\n                -- Place your enterprise's domain here\n                -- When using `find` without parameters, escape special characters using '%'.\n                -- Escape characters: ( ) . % + - * ? [ ^ $\n                -- `find(pattern, start_index, plain)`\n                -- `start_index = 1` starts searching from the first character.\n                -- `plain = true` ensures an exact match instead of a pattern match.\n                return enable or utils.get_repo_remote_url():find('enterprise.example.com', 1, true)\n            end,\n        }\n    }\n}\n```\n\nThen, you should see [how to customize the APIs](#how-to-customize-the-apis) to customize the\nrequest domain.\n\n### How to customize the APIs?\n\nBy default, `blink-cmp-git` will request those endpoints below:\n\n| Feature                            | API Endpoint                         |\n| ---------------------------------- | ------------------------------------ |\n| `github.issue`                     | `repos/OWNER/REPO/issues`            |\n| `github.pull_request`              | `repos/OWNER/REPO/pulls`             |\n| `github.mention`                   | `repos/OWNER/REPO/contributors`      |\n| `github.mention.get_documentation` | `users/USERNAME`                     |\n| `gitlab.issue`                     | `projects/PROJECT_ID/issues`         |\n| `gitlab.pull_request`              | `projects/PROJECT_ID/merge_requests` |\n| `gitlab.mention`                   | `projects/PROJECT_ID/users`          |\n| `gitlab.mention.get_documentation` | `users/USERID`                       |\n\nYou can see\n[github rest API](https://docs.github.com/en/rest)\nand\n[gitlab rest API](https://docs.gitlab.com/ee/api/rest/) to know what the available parameters are.\n\nI'll give you an example for `github.issue` to customize `per_page` and `sort`:\n\n```lua\ngit_centers = {\n    github = {\n        issue = {\n            get_command_args = function(command, token)\n                -- Get the default args\n                local args = require('blink-cmp-git.default.github')\n                    .issue\n                    .get_command_args(command, token)\n                local utils = require('blink-cmp-git.utils')\n                -- The last element is the API endpoint, customize it\n                if command == 'curl' then\n                    -- You can update the `github.com` to your enterprise's domain\n                    args[#args] = 'https://api.github.com/repos/' ..\n                        -- NOTE:\n                        -- for `gitlab` users, you should use `utils.get_repo_owner_and_repo(true)`\n                        utils.get_repo_owner_and_repo() ..\n                        '/issues?state=all\u0026per_page=100\u0026sort=updated'\n                else\n                    args[#args] = 'repos/' ..\n                        -- NOTE:\n                        -- for `gitlab` users, you should use `utils.get_repo_owner_and_repo(true)`\n                        utils.get_repo_owner_and_repo() ..\n                        '/issues?state=all\u0026per_page=100\u0026sort=updated'\n                    -- use those below to customize the enterprise's domain\n                    -- table.insert(args, '--hostname')\n                    -- table.insert(args, 'github.com')\n                end\n                return args\n            end,\n        }\n    }\n}\n```\n\n\u003e [!NOTE]\n\u003e For `github`, the `per_page` has a maximum of `100`.\n\u003e See [github-discussion-comment](https://github.com/orgs/community/discussions/9868#discussioncomment-1943095).\n\n## How to auto reload cache when opening a file from a different repository?\n\nBy default, `blink-cmp-git` will reload the cache when the result of `get_cwd` is changed to\nanother repository.\n\nThe default `get_cwd` is `vim.fn.getcwd`. If you want to reload the cache\nwhen opening a file from a different repository, you just need to update the `get_cwd` function.\nFor example:\n\n```lua\nget_cwd = function()\n    -- return the directory of the current file\n    return vim.fn.expand('%:p:h')\nend\n```\n\n## How to add new git platforms?\n\nI've written a post to show you how to add new git platforms. You can see\n[Contributing to blink-cmp-git](https://kaiser-yang.github.io/blog/2025/blink-cmp-git-contribution/).\n\n## Performance\n\n`blink-cmp-git` is async. This means that completion won't block other\noperations. How long it will take to show results depends on the network speed\nand the response time of the git center. But, don't worry, the items will be\ncached when you first trigger the completion by inputting `@`, `#`, or `:` (You\ncan DIY the triggers). Furthermore, when the source is created, it will\npre-cache all the items. For the documentation of the `mention` feature, it\nwill be cached when you hover on one item.\n\n## Version Introduction\n\nThe release versions are something like `major.minor.patch`. When one of these numbers is increased:\n\n- `patch`: bugs are fixed or docs are added. This will not break the compatibility.\n- `minor`: compatible features are added. This may cause some configurations `deprecated`, but\n  not break the compatibility.\n- `major`: incompatible features are added. All the `deprecated` configurations will be removed.\n  This will break the compatibility.\n\n## Acknowledgment\n\nNice and fast completion plugin: [blink.cmp](https://github.com/Saghen/blink.cmp).\n\nInspired by [cmp-git](https://github.com/petertriho/cmp-git).\n","funding_links":[],"categories":["Completion","Lua"],"sub_categories":["Diagnostics"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKaiser-Yang%2Fblink-cmp-git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKaiser-Yang%2Fblink-cmp-git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKaiser-Yang%2Fblink-cmp-git/lists"}