mirror of
https://github.com/Smaug123/nix-dotfiles
synced 2025-10-10 00:48:40 +00:00
Remove coq in favour of nvim-cmp (#112)
This commit is contained in:
@@ -205,21 +205,6 @@
|
|||||||
config = builtins.readFile ./nvim/roslyn-nvim.lua;
|
config = builtins.readFile ./nvim/roslyn-nvim.lua;
|
||||||
type = "lua";
|
type = "lua";
|
||||||
}
|
}
|
||||||
{
|
|
||||||
plugin = let
|
|
||||||
name = "coq.artifacts";
|
|
||||||
rev = "9c5067a471322c6bb866545e88e5b28c82511865";
|
|
||||||
in
|
|
||||||
nixpkgs.vimUtils.buildVimPlugin {
|
|
||||||
name = name;
|
|
||||||
src = nixpkgs.fetchFromGitHub {
|
|
||||||
owner = "ms-jpq";
|
|
||||||
repo = name;
|
|
||||||
rev = rev;
|
|
||||||
hash = "sha256-BHm7U3pINtYamY7m26I4lQee7ccJ6AcHmYx7j1MRFDA=";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
plugin = let
|
plugin = let
|
||||||
name = "venv-selector.nvim";
|
name = "venv-selector.nvim";
|
||||||
@@ -248,8 +233,12 @@
|
|||||||
type = "lua";
|
type = "lua";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
plugin = nixpkgs.vimPlugins.coq_nvim;
|
plugin = nixpkgs.vimPlugins.nvim-cmp;
|
||||||
config = ''let g:coq_settings = { 'auto_start': 'shut-up', 'xdg': v:true }'';
|
config = builtins.readFile ./nvim/nvim-cmp.lua;
|
||||||
|
type = "lua";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
plugin = nixpkgs.vimPlugins.cmp-nvim-lsp;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
plugin = nixpkgs.vimPlugins.rustaceanvim;
|
plugin = nixpkgs.vimPlugins.rustaceanvim;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
local coq = require("coq")
|
local nvim_cmp = require("cmp")
|
||||||
|
|
||||||
-- Using rustaceanvim means we shouldn't set up the LSP for Rust manually.
|
-- Using rustaceanvim means we shouldn't set up the LSP for Rust manually.
|
||||||
-- Similarly csharp_ls is unnecessary given roslyn.nvim
|
-- Similarly csharp_ls is unnecessary given roslyn.nvim
|
||||||
@@ -34,6 +34,8 @@ require("lspconfig")["yamlls"].setup({
|
|||||||
})
|
})
|
||||||
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
|
||||||
|
|
||||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
require("lspconfig")["jsonls"].setup({
|
require("lspconfig")["jsonls"].setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
@@ -87,7 +89,8 @@ require("lspconfig")["lua_ls"].setup({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
require("lspconfig").pyright.setup(coq.lsp_ensure_capabilities({
|
require("lspconfig").pyright.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
handlers = {
|
handlers = {
|
||||||
["textDocument/publishDiagnostics"] = function(...)
|
["textDocument/publishDiagnostics"] = function(...)
|
||||||
vim.lsp.diagnostic.on_publish_diagnostics(...)
|
vim.lsp.diagnostic.on_publish_diagnostics(...)
|
||||||
@@ -97,9 +100,10 @@ require("lspconfig").pyright.setup(coq.lsp_ensure_capabilities({
|
|||||||
vim.api.nvim_set_current_win(window)
|
vim.api.nvim_set_current_win(window)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}))
|
})
|
||||||
|
|
||||||
require("lspconfig").nil_ls.setup(coq.lsp_ensure_capabilities({
|
require("lspconfig").nil_ls.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
settings = {
|
settings = {
|
||||||
nix = {
|
nix = {
|
||||||
flake = {
|
flake = {
|
||||||
@@ -107,7 +111,7 @@ require("lspconfig").nil_ls.setup(coq.lsp_ensure_capabilities({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}))
|
})
|
||||||
|
|
||||||
function ToggleLocList()
|
function ToggleLocList()
|
||||||
local winid = vim.fn.getloclist(0, { winid = 0 }).winid
|
local winid = vim.fn.getloclist(0, { winid = 0 }).winid
|
||||||
|
45
home-manager/nvim/nvim-cmp.lua
Normal file
45
home-manager/nvim/nvim-cmp.lua
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
local cmp = require("cmp")
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
-- REQUIRED - you must specify a snippet engine
|
||||||
|
expand = function(args)
|
||||||
|
vim.snippet.expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
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 }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
}, {
|
||||||
|
{ name = "buffer" },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline({ "/", "?" }, {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = {
|
||||||
|
{ name = "buffer" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline(":", {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "path" },
|
||||||
|
}, {
|
||||||
|
{ name = "cmdline" },
|
||||||
|
}),
|
||||||
|
matching = { disallow_symbol_nonprefix_matching = false },
|
||||||
|
})
|
Reference in New Issue
Block a user