feat(nvim): add coq-nvim
parent
526783f07a
commit
e2aff57d72
|
@ -222,7 +222,16 @@ in
|
|||
withNodeJs = true;
|
||||
withPython3 = true;
|
||||
extraLuaConfig = lib.concatLines [ (builtins.readFile ./options.lua) lazy ];
|
||||
extraPackages = with pkgs; [
|
||||
extraPython3Packages = ps:
|
||||
let
|
||||
plugins = map (getAttr "plugin") cfg.plugins;
|
||||
depAttrName = "python3Dependencies";
|
||||
filtered = filter (hasAttr depAttrName) plugins;
|
||||
funcs = map (getAttr depAttrName) filtered;
|
||||
in
|
||||
foldl (list: f: list ++ (f ps)) [ ] funcs;
|
||||
extraPackages = with pkgs;
|
||||
[
|
||||
alejandra
|
||||
black
|
||||
deadnix
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
-- dont show ghost text
|
||||
vim.g.codeium_render = false
|
|
@ -0,0 +1,3 @@
|
|||
vim.g.coq_settings = {
|
||||
auto_start = "shut-up",
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
require("coq_3p")({
|
||||
{ src = "orgmode", short_name = "ORG" },
|
||||
{ src = "codeium", short_name = "COD" },
|
||||
})
|
|
@ -82,28 +82,6 @@ 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" ];
|
||||
|
@ -281,5 +259,25 @@ with builtins;
|
|||
plugin = markdown-preview-nvim;
|
||||
lazy = false;
|
||||
}
|
||||
{
|
||||
plugin = coq_nvim;
|
||||
lazy = false;
|
||||
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;
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
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 },
|
||||
}),
|
||||
})
|
|
@ -5,9 +5,6 @@ vim.diagnostic.config({
|
|||
virtual_text = false,
|
||||
})
|
||||
|
||||
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
vim.o.foldcolumn = "1" -- '0' is not bad
|
||||
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
|
||||
vim.o.foldlevelstart = 99
|
||||
|
@ -47,6 +44,7 @@ require("which-key").register({
|
|||
M = { require("ufo").closeAllFolds, "Close all folds" },
|
||||
},
|
||||
})
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
-- Tell the server the capability of foldingRange,
|
||||
-- Neovim hasn't added foldingRange to default capabilities, users must add it manually
|
||||
capabilities.textDocument.foldingRange = {
|
||||
|
@ -107,9 +105,6 @@ end
|
|||
local lspconfig_default_options = {
|
||||
on_attach = on_attach_def,
|
||||
capabilities = capabilities,
|
||||
flags = {
|
||||
debounce_text_changes = 100,
|
||||
},
|
||||
}
|
||||
|
||||
---function to add default options to lspconfig
|
||||
|
@ -117,8 +112,9 @@ local lspconfig_default_options = {
|
|||
---@param options table
|
||||
---@return nil
|
||||
local function lspconfig_setup(lsp, options)
|
||||
local final_options = vim.tbl_deep_extend("force", lspconfig_default_options, options)
|
||||
lspconfig[lsp].setup(final_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)
|
||||
end
|
||||
|
||||
local servers = {
|
||||
|
|
Loading…
Reference in New Issue