Neovim, Add c language support

This commit is contained in:
Julia Lange 2024-04-17 20:59:21 -07:00
parent 92211cc1be
commit 14b3dab476
4 changed files with 11 additions and 1 deletions

View file

@ -5,6 +5,7 @@
enable = lib.mkEnableOption "Enables neovim";
languages = {
nix.enable = lib.mkEnableOption "Enables nix support";
c.enable = lib.mkEnableOption "Enables c support";
};
plugins = {
comments.enable = lib.mkEnableOption "Enables nvim-comment";
@ -45,6 +46,7 @@
extraPackages = with pkgs; [
(lib.mkIf config.neovim.languages.nix.enable nil)
(lib.mkIf config.neovim.languages.c.enable libclang)
];
# Additional packages are added through imports

View file

@ -37,6 +37,8 @@
local capabilities = vim.lsp.protocol.make_client_capabilities()
'' + lib.strings.optionalString cfgl.nix.enable ''
require('lspconfig').nil_ls.setup {}
'' + lib.strings.optionalString cfgl.c.enable ''
require('lspconfig').clangd.setup {}
'';
in with pkgs.vimPlugins; [
{

View file

@ -18,7 +18,12 @@ in {
}
'';
treeplugs = p: lib.lists.optional cfgl.nix.enable p.tree-sitter-nix;
# I've tried many things, and can't get treesitter plugins changing
# dynamically. For not just have them always loaded regardless of config
treeplugs = p: [
p.tree-sitter-nix
p.tree-sitter-c
];
in with pkgs.vimPlugins; [
{
plugin = (nvim-treesitter.withPlugins treeplugs);

View file

@ -29,6 +29,7 @@
neovim.enable = true;
neovim.languages = {
nix.enable = true;
c.enable = true;
};
neovim.plugins = {
comments.enable = true;