neovim, add rust language support

This commit is contained in:
Julia Lange 2024-04-23 23:17:10 -07:00
parent b16fb47719
commit 1b6627bcbe
4 changed files with 16 additions and 5 deletions

View file

@ -4,8 +4,9 @@
options.neovim = {
enable = lib.mkEnableOption "Enables neovim";
languages = {
nix.enable = lib.mkEnableOption "Enables nix support";
c.enable = lib.mkEnableOption "Enables c support";
nix.enable = lib.mkEnableOption "Enables nix support";
rust.enable = lib.mkEnableOption "Enables rust support";
};
plugins = {
comments.enable = lib.mkEnableOption "Enables nvim-comment";
@ -46,8 +47,9 @@
'';
extraPackages = with pkgs; [
(lib.mkIf config.neovim.languages.nix.enable nil)
(lib.mkIf config.neovim.languages.c.enable libclang)
(lib.mkIf config.neovim.languages.nix.enable nil)
(lib.mkIf config.neovim.languages.rust.enable rust-analyzer)
];
# Additional packages are added through imports
@ -91,6 +93,10 @@
vim-nix
]);
rust-pkg = lopts cfgl.rust.enable (with pkgs.vimPlugins; [
rustaceanvim
]);
wiki = lopts cfgp.wiki.enable (with pkgs.vimPlugins; [
{
plugin = vimwiki;
@ -107,7 +113,8 @@
'';
}
]);
in comments ++ fugitive ++ luasnip-pkg ++ lualine ++ nix-pkg ++ wiki;
in comments ++ fugitive ++ luasnip-pkg ++ lualine ++
nix-pkg ++ rust-pkg ++ wiki;
};
};
}

View file

@ -39,6 +39,8 @@
require('lspconfig').nil_ls.setup {}
'' + lib.strings.optionalString cfgl.c.enable ''
require('lspconfig').clangd.setup {}
'' + lib.strings.optionalString cfgl.rust.enable ''
require('lspconfig').rustaceanvim.setup {}
'';
in with pkgs.vimPlugins; [
{

View file

@ -21,8 +21,9 @@ in {
# 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
p.tree-sitter-nix
p.tree-sitter-rust
];
in with pkgs.vimPlugins; [
{