Skip to content

Commit

Permalink
feat: adds cmp copilot support
Browse files Browse the repository at this point in the history
  • Loading branch information
ixahmedxi committed Dec 5, 2022
1 parent f12e24e commit 2100ba5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require("config.colorschemes")
require("config.better-escape")
require("config.treesitter")
require("config.autopairs")
require("config.copilot")
require("config.cmp")
require("config.lsp")
require("config.neo-tree")
Expand Down
4 changes: 4 additions & 0 deletions lua/config/cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ import({ "cmp", "luasnip", "lspkind", "luasnip/loaders/from_vscode" }, function(
fields = { "abbr", "kind", "menu" },
format = modules.lspkind.cmp_format({
mode = "symbol_text",
symbol_map = {
Copilot = "",
},
before = function(entry, vim_item)
vim_item.menu = ({
nvim_lsp = "[LSP]",
Expand All @@ -70,6 +73,7 @@ import({ "cmp", "luasnip", "lspkind", "luasnip/loaders/from_vscode" }, function(
},
sources = {
{ name = "nvim_lsp" },
{ name = "copilot" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
Expand Down
6 changes: 6 additions & 0 deletions lua/config/copilot.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import({ "copilot", "copilot_cmp" }, function(modules)
local copilot_cmp = modules["copilot_cmp"]

modules.copilot.setup()
copilot_cmp.setup()
end)
8 changes: 5 additions & 3 deletions lua/config/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ return packer.startup(function(use)
use("yamatsum/nvim-cursorline")
use("brenoprata10/nvim-highlight-colors")
use("ThePrimeagen/harpoon")
use("akinsho/git-conflict.nvim")
use("akinsho/git-conflict.nvim")

-- Colorscheme
use({ "catppuccin/nvim", as = "catppuccin" })
Expand Down Expand Up @@ -90,6 +90,8 @@ return packer.startup(function(use)
use("L3MON4D3/LuaSnip")
use("rafamadriz/friendly-snippets")
use("onsails/lspkind.nvim")
use("zbirenbaum/copilot.lua")
use("zbirenbaum/copilot-cmp")

-- LSP
use("williamboman/mason.nvim")
Expand All @@ -112,7 +114,7 @@ return packer.startup(function(use)
use("folke/trouble.nvim")
use("smiteshp/nvim-navic")
use("utilyre/barbecue.nvim")
use("simrat39/rust-tools.nvim")
use("simrat39/rust-tools.nvim")

-- Editing
use("max397574/better-escape.nvim")
Expand All @@ -132,7 +134,7 @@ return packer.startup(function(use)
use("akinsho/toggleterm.nvim")
use("rcarriga/nvim-notify")
use("ThePrimeagen/vim-be-good")
use("aserowy/tmux.nvim")
use("aserowy/tmux.nvim")

if PACKER_BOOTSTRAP then
require("packer").sync()
Expand Down

0 comments on commit 2100ba5

Please sign in to comment.