2024-05-08 23:04:16 -04:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit (config.vars) neovimIde;
|
|
|
|
inherit (pkgs) vimPlugins;
|
|
|
|
in {
|
2024-05-07 22:49:00 -04:00
|
|
|
imports = [
|
|
|
|
./bash.nix
|
|
|
|
./clang.nix
|
2024-05-08 20:26:57 -04:00
|
|
|
./hyprlang.nix
|
2024-05-07 22:49:00 -04:00
|
|
|
./java.nix
|
2024-05-16 22:49:46 -04:00
|
|
|
./json.nix
|
2024-05-07 22:49:00 -04:00
|
|
|
./lua.nix
|
|
|
|
./markdown.nix
|
|
|
|
./nix.nix
|
|
|
|
./python.nix
|
2024-05-18 19:43:43 -04:00
|
|
|
./rust.nix
|
2024-05-07 22:49:00 -04:00
|
|
|
./web.nix
|
|
|
|
];
|
2024-05-08 23:04:16 -04:00
|
|
|
|
|
|
|
programs = lib.mkIf neovimIde {
|
|
|
|
neovim = {
|
2024-05-10 14:18:50 -04:00
|
|
|
extraLuaConfig =
|
|
|
|
lib.mkBefore
|
2024-05-08 23:04:16 -04:00
|
|
|
/*
|
|
|
|
lua
|
|
|
|
*/
|
|
|
|
''
|
|
|
|
-- Start completion / snippet stuff
|
2024-05-11 15:07:24 -04:00
|
|
|
vim.g.coq_settings = {
|
|
|
|
auto_start = 'shut-up',
|
|
|
|
keymap = {
|
|
|
|
recommended = false,
|
|
|
|
},
|
|
|
|
};
|
2024-05-08 23:04:16 -04:00
|
|
|
|
|
|
|
-- Add formatting cmd
|
|
|
|
vim.api.nvim_create_user_command(
|
|
|
|
'Format',
|
|
|
|
function()
|
|
|
|
vim.lsp.buf.format({ async = true });
|
|
|
|
end,
|
|
|
|
{}
|
|
|
|
);
|
|
|
|
|
2024-05-08 23:56:56 -04:00
|
|
|
-- LSP-Status setup
|
|
|
|
local lsp_status = require('lsp-status');
|
|
|
|
lsp_status.register_progress();
|
|
|
|
|
2024-05-08 23:04:16 -04:00
|
|
|
-- Remove LSP highlighting to use Treesitter
|
|
|
|
vim.api.nvim_create_autocmd("LspAttach", {
|
|
|
|
callback = function(args)
|
2024-05-08 23:56:56 -04:00
|
|
|
local client = vim.lsp.get_client_by_id(args.data.client_id);
|
|
|
|
client.server_capabilities.semanticTokensProvider = nil;
|
|
|
|
lsp_status.on_attach(client);
|
2024-05-08 23:04:16 -04:00
|
|
|
end,
|
|
|
|
});
|
2024-05-09 09:12:01 -04:00
|
|
|
|
|
|
|
-- Disable virtual_text since it's redundant due to lsp_lines.
|
|
|
|
vim.diagnostic.config({
|
|
|
|
virtual_text = false,
|
|
|
|
});
|
|
|
|
|
|
|
|
require('lsp_lines').setup();
|
2024-05-11 15:07:24 -04:00
|
|
|
|
|
|
|
-- Autopairs with coq
|
|
|
|
local remap = vim.api.nvim_set_keymap
|
|
|
|
local npairs = require('nvim-autopairs')
|
|
|
|
|
|
|
|
npairs.setup({ map_bs = false, map_cr = false })
|
|
|
|
|
|
|
|
_G.MUtils= {}
|
|
|
|
|
|
|
|
MUtils.CR = function()
|
|
|
|
if vim.fn.pumvisible() ~= 0 then
|
|
|
|
if vim.fn.complete_info({ 'selected' }).selected ~= -1 then
|
|
|
|
return npairs.esc('<c-y>');
|
|
|
|
else
|
|
|
|
return npairs.esc('<c-e>') .. npairs.autopairs_cr();
|
|
|
|
end
|
|
|
|
else
|
|
|
|
return npairs.autopairs_cr();
|
|
|
|
end
|
|
|
|
end
|
|
|
|
remap('i', '<cr>', 'v:lua.MUtils.CR()', { expr = true, noremap = true });
|
|
|
|
|
|
|
|
MUtils.BS = function()
|
|
|
|
if vim.fn.pumvisible() ~= 0 and vim.fn.complete_info({ 'mode' }).mode == 'eval' then
|
|
|
|
return npairs.esc('<c-e>') .. npairs.autopairs_bs();
|
|
|
|
else
|
|
|
|
return npairs.autopairs_bs();
|
|
|
|
end
|
|
|
|
end
|
|
|
|
remap('i', '<bs>', 'v:lua.MUtils.BS()', { expr = true, noremap = true });
|
2024-05-08 23:04:16 -04:00
|
|
|
'';
|
2024-05-11 15:07:24 -04:00
|
|
|
|
2024-05-08 23:04:16 -04:00
|
|
|
plugins = [
|
|
|
|
vimPlugins.nvim-lspconfig
|
2024-05-09 09:12:01 -04:00
|
|
|
|
2024-05-08 23:04:16 -04:00
|
|
|
vimPlugins.coq_nvim
|
|
|
|
vimPlugins.coq-artifacts
|
|
|
|
vimPlugins.coq-thirdparty
|
2024-05-09 09:12:01 -04:00
|
|
|
|
2024-05-11 15:07:24 -04:00
|
|
|
vimPlugins.nvim-autopairs
|
|
|
|
|
2024-05-08 23:56:56 -04:00
|
|
|
vimPlugins.lsp-status-nvim
|
2024-05-09 09:12:01 -04:00
|
|
|
vimPlugins.lsp_lines-nvim
|
2024-05-08 23:04:16 -04:00
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2024-05-07 22:49:00 -04:00
|
|
|
}
|