mirror of https://github.com/NvChad/NvChad
replace compe with cmp
parent
59ec5a5fed
commit
475a4c5f38
@ -1,12 +0,0 @@
|
||||
local present1, autopairs = pcall(require, "nvim-autopairs")
|
||||
local present2, autopairs_completion = pcall(require, "nvim-autopairs.completion.compe")
|
||||
|
||||
if not (present1 or present2) then
|
||||
return
|
||||
end
|
||||
|
||||
autopairs.setup()
|
||||
autopairs_completion.setup {
|
||||
map_complete = true, -- insert () func completion
|
||||
map_cr = true,
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
-- autosave.nvim plugin disabled by default
|
||||
local present, autosave = pcall(require, "autosave")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
autosave.setup {
|
||||
enabled = vim.g.auto_save or false, -- takes boolean value from init.lua
|
||||
execution_message = "autosaved at : " .. vim.fn.strftime "%H:%M:%S",
|
||||
events = { "InsertLeave", "TextChanged" },
|
||||
conditions = {
|
||||
exists = true,
|
||||
filetype_is_not = {},
|
||||
modifiable = true,
|
||||
},
|
||||
clean_command_line_interval = 2500,
|
||||
on_off_commands = true,
|
||||
write_all_buffers = false,
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
vim.opt.completeopt = "menuone,noselect"
|
||||
|
||||
local lspkind = require "lspkind"
|
||||
local luasnip = require "luasnip"
|
||||
|
||||
-- nvim-cmp setup
|
||||
local cmp = require "cmp"
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
vim_item.kind = lspkind.presets.default[vim_item.kind] .. " " .. vim_item.kind
|
||||
|
||||
vim_item.menu = ({
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[Lua]",
|
||||
buffer = "[BUF]",
|
||||
})[entry.source.name]
|
||||
|
||||
return vim_item
|
||||
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.Replace,
|
||||
select = true,
|
||||
},
|
||||
["<Tab>"] = function(fallback)
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-n>", true, true, true), "n")
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<S-Tab>"] = function(fallback)
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-p>", true, true, true), "n")
|
||||
elseif luasnip.jumpable(-1) then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "nvim_lua" },
|
||||
},
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
local present, compe = pcall(require, "compe")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
compe.setup {
|
||||
enabled = true,
|
||||
|
||||
autocomplete = true,
|
||||
debug = false,
|
||||
documentation = true,
|
||||
incomplete_delay = 400,
|
||||
max_abbr_width = 100,
|
||||
max_kind_width = 100,
|
||||
max_menu_width = 100,
|
||||
min_length = 1,
|
||||
preselect = "enable",
|
||||
source_timeout = 200,
|
||||
source = {
|
||||
buffer = { kind = "", true },
|
||||
luasnip = { kind = "", true },
|
||||
nvim_lsp = true,
|
||||
nvim_lua = true,
|
||||
},
|
||||
throttle_time = 80,
|
||||
}
|
Loading…
Reference in New Issue