nixos-configs/common/home/neovim/langs/default.nix

101 lines
2.3 KiB
Nix
Raw Normal View History

2024-05-08 23:04:16 -04:00
{
config,
lib,
pkgs,
...
}: let
inherit (config.vars) neovimIde;
inherit (pkgs) vimPlugins;
inherit (lib) fileContents;
2024-05-08 23:04:16 -04:00
in {
imports = [
./bash.nix
./clang.nix
./hyprlang.nix
./java.nix
2024-05-16 22:49:46 -04:00
./json.nix
./lua.nix
./markdown.nix
./nix.nix
./python.nix
2024-05-18 19:43:43 -04:00
./rust.nix
./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-06-09 22:49:30 -04:00
# lua
2024-05-08 23:04:16 -04:00
''
-- Start completion / snippet stuff
2024-05-11 15:07:24 -04:00
vim.g.coq_settings = {
2024-06-09 22:49:30 -04:00
auto_start = 'shut-up',
keymap = {
recommended = false,
},
-- https://github.com/NixOS/nixpkgs/issues/168928#issuecomment-1109581739
xdg = true,
2024-05-11 15:07:24 -04:00
};
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', {
2024-05-08 23:04:16 -04:00
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-08 23:04:16 -04:00
'';
2024-05-11 15:07:24 -04:00
plugins =
(with vimPlugins; [
nvim-lspconfig
lsp-status-nvim
lsp_lines-nvim
2024-05-09 09:12:01 -04:00
cmp-buffer
cmp-nvim-lsp
cmp-path
cmp-spell
vim-vsnip
])
++ [
{
plugin = vimPlugins.nvim-cmp;
type = "lua";
config = fileContents ../plugins/cmp.lua;
}
2024-05-11 15:07:24 -04:00
{
plugin = vimPlugins.nvim-autopairs;
type = "lua";
config =
# lua
"require('nvim-autopairs').setup({})";
}
];
2024-05-08 23:04:16 -04:00
};
};
}