mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-29 20:04:28 +02:00
coq-nvim: init plugin
still need to add most options, but this is enough to be usable right now! This also sets up the work needed for other completion frameworks, notably things like nvim-cmp and compe.
This commit is contained in:
parent
6de23559d7
commit
f8b70a30ea
4 changed files with 140 additions and 14 deletions
|
@ -40,33 +40,49 @@ in
|
|||
default = "";
|
||||
};
|
||||
|
||||
capabilities = mkOption {
|
||||
setupWrappers = mkOption {
|
||||
type = with types; listOf (functionTo str);
|
||||
description = "Code to be run to wrap the setup args. Takes in an argument containing the previous results, and returns a new string of code.";
|
||||
default = [];
|
||||
};
|
||||
|
||||
preConfig = mkOption {
|
||||
type = types.lines;
|
||||
description = "A lua function defining the capabilities of a new LSP buffer.";
|
||||
description = "Code to be run before loading the LSP. Useful for requiring plugins";
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = let
|
||||
runWrappers = wrappers: s:
|
||||
if wrappers == [] then s
|
||||
else (head wrappers) (runWrappers (tail wrappers) s);
|
||||
in mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
extraPlugins = [ pkgs.vimPlugins.nvim-lspconfig ];
|
||||
|
||||
# Enable all LSP servers
|
||||
extraConfigLua = ''
|
||||
-- LSP {{{
|
||||
local __lspServers = ${helpers.toLuaObject cfg.enabledServers}
|
||||
local __lspOnAttach = function(client)
|
||||
${cfg.onAttach}
|
||||
end
|
||||
do
|
||||
${cfg.preConfig}
|
||||
local __lspServers = ${helpers.toLuaObject cfg.enabledServers}
|
||||
local __lspOnAttach = function(client)
|
||||
${cfg.onAttach}
|
||||
end
|
||||
|
||||
for i,server in ipairs(__lspServers) do
|
||||
if type(server) == "string" then
|
||||
require('lspconfig')[server].setup {
|
||||
on_attach = __lspOnAttach
|
||||
}
|
||||
else
|
||||
require('lspconfig')[server.name].setup(server.extraOptions)
|
||||
local __setup = ${runWrappers cfg.setupWrappers "{
|
||||
on_attach = __lspOnAttach
|
||||
}"}
|
||||
|
||||
for i,server in ipairs(__lspServers) do
|
||||
if type(server) == "string" then
|
||||
require('lspconfig')[server].setup(__setup)
|
||||
else
|
||||
local options = ${runWrappers cfg.setupWrappers "server.extraOptions"}
|
||||
require('lspconfig')[server.name].setup(options)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- }}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue