From 690282a5a035a5af6e4ef35117ba22560e4b4d27 Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Sun, 11 Feb 2024 18:34:46 +0530 Subject: [PATCH] cmp for gitcommit --- after/plugin/cmp.lua | 12 +++++++++++- lua/plugins.lua | 9 ++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/after/plugin/cmp.lua b/after/plugin/cmp.lua index cefbd0b..062839c 100644 --- a/after/plugin/cmp.lua +++ b/after/plugin/cmp.lua @@ -1,3 +1,4 @@ +require("cmp_git").setup() local cmp = require("cmp") cmp.setup({ @@ -9,8 +10,9 @@ cmp.setup({ sources = cmp.config.sources({ { name = "nvim_lsp" }, { name = "nvim_lsp_signature_help" }, - { name = "buffer" }, { name = "luasnip" }, + }, { + { name = "buffer" }, }), formatting = { format = require("lspkind").cmp_format({ @@ -18,3 +20,11 @@ cmp.setup({ }), }, }) + +cmp.setup.filetype("gitcommit", { + sources = cmp.config.sources({ + { name = "git" }, + }, { + { name = "buffer" }, + }), +}) diff --git a/lua/plugins.lua b/lua/plugins.lua index 246f8eb..74a7a84 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -51,13 +51,16 @@ return require("packer").startup(function(use) use({ "nvim-telescope/telescope.nvim", - requires = { - { "nvim-lua/plenary.nvim" }, - }, + requires = "nvim-lua/plenary.nvim", }) use({ "nvim-treesitter/nvim-treesitter", { run = ":TSUpdate" }, }) + + use({ + "petertriho/cmp-git", + requires = "nvim-lua/plenary.nvim", + }) end)