mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-02-04 19:05:55 +00:00
Merge branch 'main' into feat/jinja
This commit is contained in:
commit
96de3676e3
15 changed files with 182 additions and 17 deletions
|
|
@ -51,6 +51,7 @@ in {
|
|||
./yaml.nix
|
||||
./ruby.nix
|
||||
./just.nix
|
||||
./xml.nix
|
||||
|
||||
# This is now a hard deprecation.
|
||||
(mkRenamedOptionModule ["vim" "languages" "enableLSP"] ["vim" "lsp" "enable"])
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
inherit (lib.lists) isList;
|
||||
inherit (lib.attrsets) attrNames;
|
||||
inherit (lib.types) bool package str listOf either enum int;
|
||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption deprecatedSingleOrListOf;
|
||||
inherit (lib.nvim.dag) entryAfter entryAnywhere;
|
||||
|
|
@ -169,7 +169,7 @@ in {
|
|||
server = {
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
then toLuaObject cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
||||
},
|
||||
default_settings = {
|
||||
|
|
@ -228,10 +228,17 @@ in {
|
|||
(mkIf cfg.extensions.crates-nvim.enable {
|
||||
vim = mkMerge [
|
||||
{
|
||||
startPlugins = ["crates-nvim"];
|
||||
pluginRC.rust-crates = entryAnywhere ''
|
||||
require("crates").setup(${toLuaObject cfg.extensions.crates-nvim.setupOpts})
|
||||
'';
|
||||
lazy.plugins.crates-nvim = {
|
||||
package = "crates-nvim";
|
||||
setupModule = "crates";
|
||||
setupOpts = cfg.extensions.crates-nvim.setupOpts;
|
||||
event = [
|
||||
{
|
||||
event = "BufRead";
|
||||
pattern = "Cargo.toml";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
})
|
||||
|
|
|
|||
62
modules/plugins/languages/xml.nix
Normal file
62
modules/plugins/languages/xml.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum listOf;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
cfg = config.vim.languages.xml;
|
||||
|
||||
defaultServers = ["lemminx"];
|
||||
servers = {
|
||||
lemminx = {
|
||||
enable = true;
|
||||
cmd = [
|
||||
(getExe pkgs.lemminx)
|
||||
];
|
||||
filetypes = ["xml"];
|
||||
root_markers = [".git"];
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.xml = {
|
||||
enable = mkEnableOption "XML language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "XML treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "xml";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "XML LSP support" // {default = config.vim.lsp.enable;};
|
||||
servers = mkOption {
|
||||
type = listOf (enum (attrNames servers));
|
||||
default = defaultServers;
|
||||
description = "XML LSP server to use";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.servers =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = servers.${name};
|
||||
})
|
||||
cfg.lsp.servers;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.minimap.codewindow = {
|
||||
enable = mkEnableOption "codewindow plugin for minimap view";
|
||||
|
|
@ -11,5 +12,7 @@ in {
|
|||
toggle = mkMappingOption "Toggle minimap [codewindow]" "<leader>mm";
|
||||
toggleFocus = mkMappingOption "Toggle minimap focus [codewindow]" "<leader>mf";
|
||||
};
|
||||
|
||||
setupOpts = mkPluginSetupOption "codewindow" {};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding pushDownDefault;
|
||||
|
||||
cfg = config.vim.minimap.codewindow;
|
||||
|
|
@ -32,9 +33,7 @@ in {
|
|||
|
||||
pluginRC.codewindow = entryAnywhere ''
|
||||
local codewindow = require('codewindow')
|
||||
codewindow.setup({
|
||||
exclude_filetypes = { 'NvimTree', 'orgagenda', 'Alpha'},
|
||||
})
|
||||
codewindow.setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue