hrsh7th / cmp-git

Git source for nvim-cmp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cmp-git

🚧 WORK IN PROGRESS 🚧

This is a work in prgress and breaking changes to the setup/config could occur in the future. Sorry for any inconveniences.

Git source for hrsh7th/nvim-cmp

  • # to trigger issues completion

  • @ to trigger mentions (contributors) completion

  • ! to trigger merge requests completion (GitLab only)

Requirements

GitHub Private Repositories

  • curl: Generate token with repo scope. Set GITHUB_API_TOKEN environment variable.
  • GitHub CLI: Run gh auth login

GitLab Private Repositories

  • curl Generate token with api scope. Set GITLAB_TOKEN environment variable.
  • GitLab CLI: Run glab auth login

Installation

vim-plug

Plug 'nvim-lua/plenary.nvim'
Plug 'petertriho/cmp-git'

packer.nvim

use("petertriho/cmp-git", requires = "nvim-lua/plenary.nvim")

Setup

require("cmp").setup({
    sources = {
        { name = "cmp_git" },
        -- more sources
    }
})

require("cmp_git").setup({
    -- defaults
    filetypes = { "gitcommit" },
    github = {
        issues = {
            filter = "all", -- assigned, created, mentioned, subscribed, all, repos
            limit = 100,
            state = "open", -- open, closed, all
        },
        mentions = {
            limit = 100,
        },
    },
    gitlab = {
        issues = {
            limit = 100,
            state = "opened", -- opened, closed, all
        },
        mentions = {
            limit = 100,
        },
        merge_requests = {
            limit = 100,
            state = "opened", -- opened, closed, locked, merged
        },
    },
})

Acknowledgements

Special thanks to tjdevries for their informative video and starting code.

Alternatives

License

MIT

About

Git source for nvim-cmp

License:MIT License


Languages

Language:Lua 100.0%