Files
nvim/lua/nvchad/configs/cmp.lua
T
Sidhanth Rathod 7f055761ba Clean (#3006)
* refactor(cmp) : use cmp module from ui repo

https://github.com/NvChad/ui/commit/c4576d8b5bbb6305de53ec017cd6ffad863c98ee I moved it to the ui repo so non nvchad users could achieve the CMP look from NvChad

* remove: <leader>cc blankline mapping

* replace: nvim-colorizer plugin with ui.colorify (BREAKING CHANGE)

https://github.com/NvChad/ui/blob/v2.5/lua/nvconfig.lua#L106

* misc: load nvchad module in config func of ui

instead of plugin/ in ui repo

* clean up

* remove un-needed configs/lazy_nvim.lua file

* rm gitsigns mappings

as it gets frustrating for users to override them

* rm un-needed options var in plugin configs

* add branch name for ui plugin

* trim some loc!

* feat: use modern theme picker for <leader>th

* feat: add volt plugins
2024-10-01 21:50:38 +05:30

58 lines
1.3 KiB
Lua

dofile(vim.g.base46_cache .. "cmp")
local cmp = require "cmp"
local options = {
completion = { completeopt = "menu,menuone" },
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = {
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = true,
},
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
require("luasnip").expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
require("luasnip").jump(-1)
else
fallback()
end
end, { "i", "s" }),
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "nvim_lua" },
{ name = "path" },
},
}
return vim.tbl_deep_extend("force", options, require "nvchad.cmp")