Revert "feat(nvim): add coq-nvim"

This reverts commit e2aff57d72.
nixos
Moritz Böhme 2023-09-06 09:19:32 +02:00
parent c0112661ad
commit dfa93f98df
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
6 changed files with 93 additions and 37 deletions

View File

@ -1,2 +0,0 @@
-- dont show ghost text
vim.g.codeium_render = false

View File

@ -1,6 +0,0 @@
vim.g.coq_settings = {
auto_start = "shut-up",
keymap = {
jump_to_mark = "<c-n>",
},
}

View File

@ -1,4 +0,0 @@
require("coq_3p")({
{ src = "orgmode", short_name = "ORG" },
{ src = "codeium", short_name = "COD" },
})

View File

@ -74,6 +74,28 @@ with builtins;
{ plugin = nvim-web-devicons; }
];
}
{
plugin = nvim-cmp;
conf = readFile ./nvim-cmp.lua;
event = [ "InsertEnter" ];
dependencies = [
{ plugin = cmp-async-path; }
{ plugin = cmp-nvim-lsp; }
{ plugin = cmp_luasnip; }
{
plugin = copilot-cmp;
dependencies = [
{
plugin = copilot-lua;
conf = readFile ./copilot-lua.lua;
dependencies = [{ plugin = which-key-nvim; }];
}
];
}
{ plugin = friendly-snippets; }
{ plugin = luasnip; }
];
}
{
plugin = todo-comments-nvim;
event = [ "BufReadPost" "BufNewFile" ];
@ -241,26 +263,6 @@ with builtins;
plugin = markdown-preview-nvim;
ft = [ "md" ];
}
{
plugin = coq_nvim;
event = [ "BufReadPost" "BufNewFile" ];
init = builtins.readFile ./coq-nvim.lua;
dependencies = [
{
plugin = coq-thirdparty;
conf = builtins.readFile ./coq-thirdparty.lua;
dependencies = [
{
plugin = codeium-vim;
init = builtins.readFile ./codeium-vim.lua;
}
];
}
{
plugin = coq-artifacts;
}
];
}
{
plugin = nvim-surround;
event = [ "BufReadPost" "BufNewFile" ];

View File

@ -0,0 +1,63 @@
local cmp = require("cmp")
local luasnip = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load()
require("copilot_cmp").setup()
local default_sources = {
{ name = "async_path", priority = 1 },
{ name = "copilot", priority = 2 },
{ name = "luasnip", priority = 2 },
{ name = "nvim_lsp", priority = 3 },
}
cmp.setup({
formatting = {
format = require("lspkind").cmp_format({
mode = "symbol", -- show only symbol annotations
maxwidth = 50, -- prevent the popup from showing more than provided characters
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead
symbol_map = {
Copilot = "",
},
}),
},
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
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 luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = default_sources,
})
cmp.setup.filetype("org", {
sources = vim.tbl_deep_extend("force", default_sources, {
{ name = "buffer", priority = 1 },
{ name = "orgmode", priority = 3 },
}),
})

View File

@ -5,8 +5,9 @@ vim.diagnostic.config({
virtual_text = false,
})
local capabilities = vim.lsp.protocol.make_client_capabilities()
-- NOTE for nvim-ufo
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
local capabilities = require("cmp_nvim_lsp").default_capabilities()
-- Tell the server the capability of foldingRange,
-- Neovim hasn't added foldingRange to default capabilities, users must add it manually
capabilities.textDocument.foldingRange = {
@ -100,6 +101,9 @@ end
local lspconfig_default_options = {
on_attach = on_attach_def,
capabilities = capabilities,
flags = {
debounce_text_changes = 100,
},
}
---function to add default options to lspconfig
@ -107,9 +111,8 @@ local lspconfig_default_options = {
---@param options table
---@return nil
local function lspconfig_setup(lsp, options)
local coq_options = require("coq").lsp_ensure_capabilities({})
local merged_options = vim.tbl_deep_extend("force", coq_options, lspconfig_default_options, options)
lspconfig[lsp].setup(merged_options)
local final_options = vim.tbl_deep_extend("force", lspconfig_default_options, options)
lspconfig[lsp].setup(final_options)
end
local servers = {