mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-03-05 08:22:54 +00:00
Merge branch 'main' into improve-terraformls
This commit is contained in:
commit
b05b9b1ee0
67 changed files with 1455 additions and 275 deletions
|
|
@ -4,13 +4,14 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) length;
|
||||
inherit (lib.modules) mkIf mkRenamedOptionModule;
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.strings) concatLines concatStringsSep optionalString;
|
||||
inherit (lib.strings) concatLines concatStringsSep;
|
||||
inherit (lib.attrsets) mapAttrsToList;
|
||||
inherit (lib.types) listOf str attrsOf;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
inherit (lib.types) listOf str attrsOf bool;
|
||||
inherit (lib.lists) optional;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
|
||||
cfg = config.vim.spellcheck;
|
||||
in {
|
||||
|
|
@ -86,6 +87,12 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
ignoreTerminal = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Disable spell checking in terminal.";
|
||||
};
|
||||
|
||||
programmingWordlist.enable = mkEnableOption ''
|
||||
vim-dirtytalk, a wordlist for programmers containing
|
||||
common programming terms.
|
||||
|
|
@ -144,20 +151,25 @@ in {
|
|||
spelllang = concatStringsSep "," cfg.languages;
|
||||
};
|
||||
|
||||
# Register an autocommand to disable spellchecking in buffers with given filetypes.
|
||||
# If the list is empty, the autocommand does not need to be registered.
|
||||
luaConfigRC.spellcheck = entryAfter ["basic"] (optionalString (cfg.ignoredFiletypes != []) ''
|
||||
-- Disable spellchecking for certain filetypes
|
||||
-- as configured by `vim.spellcheck.ignoredFiletypes`
|
||||
vim.api.nvim_create_augroup("nvf_autocmds", {clear = false})
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
group = "nvf_autocmds",
|
||||
pattern = ${toLuaObject cfg.ignoredFiletypes},
|
||||
callback = function()
|
||||
vim.opt_local.spell = false
|
||||
end,
|
||||
augroups = [{name = "nvf_spellcheck";}];
|
||||
autocmds =
|
||||
(optional cfg.ignoreTerminal {
|
||||
event = ["TermOpen"];
|
||||
group = "nvf_spellcheck";
|
||||
callback = mkLuaInline ''
|
||||
function() vim.opt_local.spell = false end
|
||||
'';
|
||||
})
|
||||
'');
|
||||
++ (optional (length cfg.ignoredFiletypes > 0) {
|
||||
event = ["FileType"];
|
||||
group = "nvf_spellcheck";
|
||||
pattern = cfg.ignoredFiletypes;
|
||||
callback = mkLuaInline ''
|
||||
function()
|
||||
vim.opt_local.spell = false
|
||||
end
|
||||
'';
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ in {
|
|||
};
|
||||
|
||||
provider = mkOption {
|
||||
type = enum ["default" "mini_diff"];
|
||||
default = "default";
|
||||
type = enum ["inline" "split" "mini_diff"];
|
||||
default = "inline";
|
||||
description = "The preferred kind of provider.";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,17 +4,14 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.autopairs.nvim-autopairs;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["nvim-autopairs"];
|
||||
pluginRC.autopairs = entryAnywhere ''
|
||||
require('nvim-autopairs').setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
vim.lazy.plugins.nvim-autopairs = {
|
||||
package = "nvim-autopairs";
|
||||
setupModule = "nvim-autopairs";
|
||||
setupOpts = cfg.setupOpts;
|
||||
event = ["InsertEnter"];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,21 +11,21 @@
|
|||
layoutDefined = cfg.layout != [];
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
"alpha-nvim"
|
||||
"nvim-web-devicons"
|
||||
];
|
||||
vim = {
|
||||
startPlugins = ["alpha-nvim"];
|
||||
visuals.nvim-web-devicons.enable = true;
|
||||
|
||||
vim.pluginRC.alpha = let
|
||||
setupOpts =
|
||||
if themeDefined
|
||||
then lib.generators.mkLuaInline "require'alpha.themes.${cfg.theme}'.config"
|
||||
else {
|
||||
inherit (cfg) layout opts;
|
||||
};
|
||||
in ''
|
||||
require('alpha').setup(${toLuaObject setupOpts})
|
||||
'';
|
||||
pluginRC.alpha = let
|
||||
setupOpts =
|
||||
if themeDefined
|
||||
then lib.generators.mkLuaInline "require'alpha.themes.${cfg.theme}'.config"
|
||||
else {
|
||||
inherit (cfg) layout opts;
|
||||
};
|
||||
in ''
|
||||
require('alpha').setup(${toLuaObject setupOpts})
|
||||
'';
|
||||
};
|
||||
|
||||
assertions = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,11 +9,8 @@
|
|||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
# dependencies
|
||||
"nui-nvim" # ui library
|
||||
"nvim-web-devicons" # glyphs
|
||||
];
|
||||
startPlugins = ["nui-nvim"];
|
||||
visuals.nvim-web-devicons.enable = true;
|
||||
|
||||
lazy.plugins = {
|
||||
"hunk-nvim" = {
|
||||
|
|
|
|||
95
modules/plugins/languages/arduino.nix
Normal file
95
modules/plugins/languages/arduino.nix
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.meta) getExe getExe';
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) enum listOf str;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
||||
cfg = config.vim.languages.arduino;
|
||||
|
||||
defaultServers = ["arduino-language-server"];
|
||||
servers = {
|
||||
arduino-language-server = {
|
||||
enable = true;
|
||||
cmd =
|
||||
[
|
||||
(getExe pkgs.arduino-language-server)
|
||||
"-clangd"
|
||||
(getExe' pkgs.clang-tools "clangd")
|
||||
"-cli"
|
||||
(getExe pkgs.arduino-cli)
|
||||
"-cli-config"
|
||||
"$HOME/.arduino15/arduino-cli.yaml"
|
||||
]
|
||||
++ cfg.lsp.extraArgs;
|
||||
filetypes = ["arduino"];
|
||||
root_dir =
|
||||
mkLuaInline
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
function(bufnr, on_dir)
|
||||
local fname = vim.api.nvim_buf_get_name(bufnr)
|
||||
on_dir(util.root_pattern("*.ino")(fname))
|
||||
end
|
||||
'';
|
||||
capabilities = {
|
||||
textDocument = {
|
||||
semanticTokens = mkLuaInline "vim.NIL";
|
||||
};
|
||||
workspace = {
|
||||
semanticTokens = mkLuaInline "vim.NIL";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.arduino = {
|
||||
enable = mkEnableOption "Arduino support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Arduino treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "arduino";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Arduino LSP support" // {default = config.vim.lsp.enable;};
|
||||
servers = mkOption {
|
||||
type = listOf (enum (attrNames servers));
|
||||
default = defaultServers;
|
||||
description = "Arduino LSP servers to use";
|
||||
};
|
||||
|
||||
extraArgs = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Extra arguments passed to the Arduino LSP";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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 (n: {
|
||||
name = n;
|
||||
value = servers.${n};
|
||||
})
|
||||
cfg.lsp.servers;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
local function symbol_info()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local clangd_client = vim.lsp.get_clients({ bufnr = bufnr, name = "clangd" })[1]
|
||||
if not clangd_client or not clangd_client.supports_method 'textDocument/symbolInfo' then
|
||||
if not clangd_client or not clangd_client:supports_method 'textDocument/symbolInfo' then
|
||||
return vim.notify('Clangd client not found', vim.log.levels.ERROR)
|
||||
end
|
||||
local win = vim.api.nvim_get_current_win()
|
||||
|
|
|
|||
96
modules/plugins/languages/cmake.nix
Normal file
96
modules/plugins/languages/cmake.nix
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.types) enum listOf package;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
||||
cfg = config.vim.languages.cmake;
|
||||
|
||||
defaultServers = ["neocmakelsp"];
|
||||
servers = {
|
||||
neocmakelsp = {
|
||||
enable = true;
|
||||
cmd = [(getExe pkgs.neocmakelsp) "--stdio"];
|
||||
filetypes = ["cmake"];
|
||||
root_markers = [".gersemirc" ".git" "build" "cmake"];
|
||||
capabilities = {
|
||||
textDocument.completion.completionItem.snippetSupport = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
defaultFormat = "gersemi";
|
||||
formats = {
|
||||
gersemi = {
|
||||
package = pkgs.gersemi;
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.cmake = {
|
||||
enable = mkEnableOption "CMake language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "CMake treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "cmake";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "CMake LSP support" // {default = config.vim.lsp.enable;};
|
||||
servers = mkOption {
|
||||
type = listOf (enum (attrNames servers));
|
||||
default = defaultServers;
|
||||
description = "CMake LSP servers to use";
|
||||
};
|
||||
};
|
||||
|
||||
format = {
|
||||
enable = mkEnableOption "CMake formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
description = "CMake formatter to use";
|
||||
type = enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "CMake formatter package";
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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 (n: {
|
||||
name = n;
|
||||
value = servers.${n};
|
||||
})
|
||||
cfg.lsp.servers;
|
||||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.cmake = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
inherit (lib.nvim.languages) mkEnable;
|
||||
in {
|
||||
imports = [
|
||||
./arduino.nix
|
||||
./asm.nix
|
||||
./astro.nix
|
||||
./bash.nix
|
||||
|
|
@ -10,17 +11,21 @@ in {
|
|||
./dart.nix
|
||||
./clang.nix
|
||||
./clojure.nix
|
||||
./cmake.nix
|
||||
./css.nix
|
||||
./elixir.nix
|
||||
./fsharp.nix
|
||||
./gleam.nix
|
||||
./glsl.nix
|
||||
./go.nix
|
||||
./hcl.nix
|
||||
./helm.nix
|
||||
./kotlin.nix
|
||||
./html.nix
|
||||
./tera.nix
|
||||
./haskell.nix
|
||||
./java.nix
|
||||
./jinja.nix
|
||||
./json.nix
|
||||
./lua.nix
|
||||
./markdown.nix
|
||||
|
|
@ -50,6 +55,8 @@ in {
|
|||
./yaml.nix
|
||||
./ruby.nix
|
||||
./just.nix
|
||||
./make.nix
|
||||
./xml.nix
|
||||
|
||||
# This is now a hard deprecation.
|
||||
(mkRenamedOptionModule ["vim" "languages" "enableLSP"] ["vim" "lsp" "enable"])
|
||||
|
|
|
|||
63
modules/plugins/languages/glsl.nix
Normal file
63
modules/plugins/languages/glsl.nix
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) enum listOf;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
cfg = config.vim.languages.glsl;
|
||||
|
||||
defaultServers = ["glsl_analyzer"];
|
||||
servers = {
|
||||
glsl_analyzer = {
|
||||
enable = true;
|
||||
cmd = [(getExe pkgs.glsl_analyzer)];
|
||||
filetypes = ["glsl" "vert" "tesc" "tese" "frag" "geom" "comp"];
|
||||
root_markers = [".git"];
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.glsl = {
|
||||
enable = mkEnableOption "GLSL language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "GLSL treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "glsl";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "GLSL LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
servers = mkOption {
|
||||
type = listOf (enum (attrNames servers));
|
||||
default = defaultServers;
|
||||
description = "GLSL LSP server to use";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter = {
|
||||
enable = true;
|
||||
grammars = [cfg.treesitter.package];
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.servers =
|
||||
mapListToAttrs (n: {
|
||||
name = n;
|
||||
value = servers.${n};
|
||||
})
|
||||
cfg.lsp.servers;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
inherit (lib.meta) getExe;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.types) bool enum package;
|
||||
inherit (lib.nvim.types) mkGrammarOption deprecatedSingleOrListOf;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics deprecatedSingleOrListOf;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
servers = {
|
||||
gopls = {
|
||||
cmd = [(getExe pkgs.gopls)];
|
||||
filetypes = ["go" "gomod" "gowork" "gotmpl"];
|
||||
filetypes = ["go" "gomod" "gosum" "gowork" "gotmpl"];
|
||||
root_dir = mkLuaInline ''
|
||||
function(bufnr, on_dir)
|
||||
local fname = vim.api.nvim_buf_get_name(bufnr)
|
||||
|
|
@ -78,6 +78,91 @@
|
|||
package = pkgs.delve;
|
||||
};
|
||||
};
|
||||
|
||||
defaultDiagnosticsProvider = ["golangci-lint"];
|
||||
diagnosticsProviders = {
|
||||
golangci-lint = let
|
||||
pkg = pkgs.golangci-lint;
|
||||
in {
|
||||
package = pkg;
|
||||
config = {
|
||||
cmd = getExe pkg;
|
||||
args = [
|
||||
"run"
|
||||
"--output.json.path=stdout"
|
||||
"--issues-exit-code=0"
|
||||
"--show-stats=false"
|
||||
"--fix=false"
|
||||
"--path-mode=abs"
|
||||
# Overwrite values that could be configured and result in unwanted writes
|
||||
"--output.text.path="
|
||||
"--output.tab.path="
|
||||
"--output.html.path="
|
||||
"--output.checkstyle.path="
|
||||
"--output.code-climate.path="
|
||||
"--output.junit-xml.path="
|
||||
"--output.teamcity.path="
|
||||
"--output.sarif.path="
|
||||
];
|
||||
parser = mkLuaInline ''
|
||||
function(output, bufnr)
|
||||
local SOURCE = "golangci-lint";
|
||||
|
||||
local function display_tool_error(msg)
|
||||
return{
|
||||
{
|
||||
bufnr = bufnr,
|
||||
lnum = 0,
|
||||
col = 0,
|
||||
message = string.format("[%s] %s", SOURCE, msg),
|
||||
severity = vim.diagnostic.severity.ERROR,
|
||||
source = SOURCE,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
if output == "" then
|
||||
return display_tool_error("no output provided")
|
||||
end
|
||||
|
||||
local ok, decoded = pcall(vim.json.decode, output)
|
||||
if not ok then
|
||||
return display_tool_error("failed to parse JSON output")
|
||||
end
|
||||
|
||||
if not decoded or not decoded.Issues then
|
||||
return display_tool_error("unexpected output format")
|
||||
end
|
||||
|
||||
local severity_map = {
|
||||
error = vim.diagnostic.severity.ERROR,
|
||||
warning = vim.diagnostic.severity.WARN,
|
||||
info = vim.diagnostic.severity.INFO,
|
||||
hint = vim.diagnostic.severity.HINT,
|
||||
}
|
||||
local diagnostics = {}
|
||||
for _, issue in ipairs(decoded.Issues) do
|
||||
local sev = vim.diagnostic.severity.ERROR
|
||||
if issue.Severity and issue.Severity ~= "" then
|
||||
local normalized = issue.Severity:lower()
|
||||
sev = severity_map[normalized] or vim.diagnostic.severity.ERROR
|
||||
end
|
||||
table.insert(diagnostics, {
|
||||
bufnr = bufnr,
|
||||
lnum = issue.Pos.Line - 1,
|
||||
col = issue.Pos.Column - 1,
|
||||
message = issue.Text,
|
||||
code = issue.FromLinter,
|
||||
severity = sev,
|
||||
source = SOURCE,
|
||||
})
|
||||
end
|
||||
return diagnostics
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.go = {
|
||||
enable = mkEnableOption "Go language support";
|
||||
|
|
@ -85,7 +170,11 @@ in {
|
|||
treesitter = {
|
||||
enable = mkEnableOption "Go treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
|
||||
package = mkGrammarOption pkgs "go";
|
||||
goPackage = mkGrammarOption pkgs "go";
|
||||
gomodPackage = mkGrammarOption pkgs "gomod";
|
||||
gosumPackage = mkGrammarOption pkgs "gosum";
|
||||
goworkPackage = mkGrammarOption pkgs "gowork";
|
||||
gotmplPackage = mkGrammarOption pkgs "gotmpl";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
|
|
@ -134,12 +223,26 @@ in {
|
|||
default = debuggers.${cfg.dap.debugger}.package;
|
||||
};
|
||||
};
|
||||
extraDiagnostics = {
|
||||
enable = mkEnableOption "extra Go diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||
types = diagnostics {
|
||||
langDesc = "Go";
|
||||
inherit diagnosticsProviders;
|
||||
inherit defaultDiagnosticsProvider;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
vim.treesitter.grammars = [
|
||||
cfg.treesitter.goPackage
|
||||
cfg.treesitter.gomodPackage
|
||||
cfg.treesitter.gosumPackage
|
||||
cfg.treesitter.goworkPackage
|
||||
cfg.treesitter.gotmplPackage
|
||||
];
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
|
|
@ -179,5 +282,15 @@ in {
|
|||
debugger.nvim-dap.enable = true;
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.go = cfg.extraDiagnostics.types;
|
||||
linters =
|
||||
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,9 +84,14 @@ in {
|
|||
end
|
||||
})
|
||||
|
||||
local ft = require('Comment.ft')
|
||||
ft
|
||||
.set('hcl', '#%s')
|
||||
${
|
||||
if config.vim.comments.comment-nvim.enable
|
||||
then ''
|
||||
local ft = require('Comment.ft')
|
||||
ft.set('hcl', '#%s')
|
||||
''
|
||||
else ""
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
||||
|
|
|
|||
65
modules/plugins/languages/jinja.nix
Normal file
65
modules/plugins/languages/jinja.nix
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) enum listOf;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
cfg = config.vim.languages.jinja;
|
||||
defaultServers = ["jinja-lsp"];
|
||||
servers = {
|
||||
jinja-lsp = {
|
||||
enable = true;
|
||||
cmd = [(getExe pkgs.jinja-lsp)];
|
||||
filetypes = ["jinja"];
|
||||
root_markers = [
|
||||
".git"
|
||||
];
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.jinja = {
|
||||
enable = mkEnableOption "Jinja template language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Jinja treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "jinja";
|
||||
inlinePackage = mkGrammarOption pkgs "jinja_inline";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Jinja LSP support" // {default = config.vim.lsp.enable;};
|
||||
servers = mkOption {
|
||||
description = "Jinja LSP server to use";
|
||||
type = listOf (enum (attrNames servers));
|
||||
default = defaultServers;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [
|
||||
cfg.treesitter.package
|
||||
cfg.treesitter.inlinePackage
|
||||
];
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.servers =
|
||||
mapListToAttrs (n: {
|
||||
name = n;
|
||||
value = servers.${n};
|
||||
})
|
||||
cfg.lsp.servers;
|
||||
})
|
||||
]);
|
||||
}
|
||||
93
modules/plugins/languages/make.nix
Normal file
93
modules/plugins/languages/make.nix
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.types) listOf enum;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
cfg = config.vim.languages.make;
|
||||
|
||||
defaultFormat = ["bake"];
|
||||
formats = {
|
||||
bake = {
|
||||
command = "${pkgs.mbake}/bin/mbake";
|
||||
};
|
||||
};
|
||||
|
||||
defaultDiagnosticsProvider = ["checkmake"];
|
||||
diagnosticsProviders = {
|
||||
checkmake = {
|
||||
config = {
|
||||
cmd = getExe pkgs.checkmake;
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.make = {
|
||||
enable = mkEnableOption "Make support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Make treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "make";
|
||||
};
|
||||
|
||||
format = {
|
||||
enable = mkEnableOption "Make formatting" // {default = config.vim.languages.enableFormat;};
|
||||
type = mkOption {
|
||||
description = "make formatter to use";
|
||||
type = listOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
};
|
||||
};
|
||||
|
||||
extraDiagnostics = {
|
||||
enable = mkEnableOption "extra Make diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||
types = diagnostics {
|
||||
langDesc = "Make";
|
||||
inherit diagnosticsProviders;
|
||||
inherit defaultDiagnosticsProvider;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter = {
|
||||
enable = true;
|
||||
grammars = [cfg.treesitter.package];
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
formatters_by_ft.make = cfg.format.type;
|
||||
formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.make = cfg.extraDiagnostics.types;
|
||||
linters =
|
||||
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.meta) getExe getExe';
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) bool enum listOf str nullOr;
|
||||
|
|
@ -55,6 +55,15 @@
|
|||
prettierd = {
|
||||
command = getExe pkgs.prettierd;
|
||||
};
|
||||
mdformat = {
|
||||
command = getExe' (pkgs.python313Packages.python.withPackages (p:
|
||||
with p; [
|
||||
mdformat
|
||||
mdformat-gfm
|
||||
mdformat-frontmatter
|
||||
mdformat-footnote
|
||||
])) "mdformat";
|
||||
};
|
||||
};
|
||||
defaultDiagnosticsProvider = ["markdownlint-cli2"];
|
||||
diagnosticsProviders = {
|
||||
|
|
|
|||
|
|
@ -7,12 +7,15 @@
|
|||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.types) enum package;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.nvim.types) mkGrammarOption deprecatedSingleOrListOf;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
cfg = config.vim.languages.odin;
|
||||
|
||||
defaultServers = ["ols"];
|
||||
servers = {
|
||||
ols = {
|
||||
|
|
@ -32,7 +35,19 @@
|
|||
};
|
||||
};
|
||||
|
||||
cfg = config.vim.languages.odin;
|
||||
defaultDebugger = "codelldb";
|
||||
debuggers = {
|
||||
codelldb = {
|
||||
package = pkgs.lldb;
|
||||
dapConfig = ''
|
||||
dap.adapters.codelldb = {
|
||||
type = 'executable',
|
||||
command = '${cfg.dap.package}/bin/lldb-dap',
|
||||
name = 'codelldb'
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.odin = {
|
||||
enable = mkEnableOption "Odin language support";
|
||||
|
|
@ -51,6 +66,22 @@ in {
|
|||
description = "Odin LSP server to use";
|
||||
};
|
||||
};
|
||||
|
||||
dap = {
|
||||
enable = mkEnableOption "Enable Odin Debug Adapter" // {default = config.vim.languages.enableDAP;};
|
||||
|
||||
debugger = mkOption {
|
||||
description = "Odin debugger to use";
|
||||
type = enum (attrNames debuggers);
|
||||
default = defaultDebugger;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Odin debugger package.";
|
||||
type = package;
|
||||
default = debuggers.${cfg.dap.debugger}.package;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
|
|
@ -67,5 +98,18 @@ in {
|
|||
})
|
||||
cfg.lsp.servers;
|
||||
})
|
||||
|
||||
(mkIf cfg.dap.enable {
|
||||
vim = {
|
||||
startPlugins = ["nvim-dap-odin"];
|
||||
debugger.nvim-dap.sources.odin-debugger = debuggers.${cfg.dap.debugger}.dapConfig;
|
||||
pluginRC.nvim-dap-odin = entryAfter ["nvim-dap"] ''
|
||||
require('nvim-dap-odin').setup({
|
||||
notifications = false -- contains no useful information
|
||||
})
|
||||
'';
|
||||
debugger.nvim-dap.enable = true;
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,12 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (builtins) attrNames toString;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.types) enum int attrs listOf;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.types) mkGrammarOption deprecatedSingleOrListOf;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
|
|
@ -64,6 +65,21 @@
|
|||
root_markers = ["composer.json" ".git"];
|
||||
};
|
||||
};
|
||||
|
||||
defaultFormat = ["php_cs_fixer"];
|
||||
formats = {
|
||||
php_cs_fixer = {
|
||||
/*
|
||||
Using 8.4 instead of 8.5 because of compatibility:
|
||||
```logs
|
||||
2026-02-08 00:42:23[ERROR] Formatter 'php_cs_fixer' error: PHP CS Fixer 3.87.2
|
||||
PHP runtime: 8.5.2
|
||||
PHP CS Fixer currently supports PHP syntax only up to PHP 8.4, current PHP version: 8.5.2.
|
||||
```
|
||||
*/
|
||||
command = "${pkgs.php84Packages.php-cs-fixer}/bin/php-cs-fixer";
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.php = {
|
||||
enable = mkEnableOption "PHP language support";
|
||||
|
|
@ -82,6 +98,38 @@ in {
|
|||
description = "PHP LSP server to use";
|
||||
};
|
||||
};
|
||||
|
||||
format = {
|
||||
enable = mkEnableOption "PHP formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
description = "PHP formatter to use";
|
||||
type = listOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
};
|
||||
};
|
||||
|
||||
dap = {
|
||||
enable = mkEnableOption "Enable PHP Debug Adapter" // {default = config.vim.languages.enableDAP;};
|
||||
xdebug = {
|
||||
adapter = mkOption {
|
||||
type = attrs;
|
||||
default = {
|
||||
type = "executable";
|
||||
command = "${pkgs.nodePackages_latest.nodejs}/bin/node";
|
||||
args = [
|
||||
"${pkgs.vscode-extensions.xdebug.php-debug}/share/vscode/extensions/xdebug.php-debug/out/phpDebug.js"
|
||||
];
|
||||
};
|
||||
description = "XDebug adapter to use for nvim-dap";
|
||||
};
|
||||
port = mkOption {
|
||||
type = int;
|
||||
default = 9003;
|
||||
description = "Port to use for XDebug";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
|
|
@ -98,5 +146,39 @@ in {
|
|||
})
|
||||
cfg.lsp.servers;
|
||||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
formatters_by_ft.php = cfg.format.type;
|
||||
formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.dap.enable {
|
||||
vim = {
|
||||
debugger.nvim-dap = {
|
||||
enable = true;
|
||||
sources.php-debugger = ''
|
||||
dap.adapters.xdebug = ${toLuaObject cfg.dap.xdebug.adapter}
|
||||
dap.configurations.php = {
|
||||
{
|
||||
type = 'xdebug',
|
||||
request = 'launch',
|
||||
name = 'Listen for XDebug',
|
||||
port = ${toString cfg.dap.xdebug.port},
|
||||
},
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum package bool;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.types) deprecatedSingleOrListOf;
|
||||
inherit (lib.nvim.types) deprecatedSingleOrListOf diagnostics;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.dag) entryBefore;
|
||||
inherit (lib.trivial) warn;
|
||||
|
|
@ -278,6 +278,14 @@
|
|||
'';
|
||||
};
|
||||
};
|
||||
defaultDiagnosticsProvider = ["mypy"];
|
||||
diagnosticsProviders = {
|
||||
mypy = {
|
||||
config = {
|
||||
cmd = getExe' pkgs.mypy "mypy";
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.python = {
|
||||
enable = mkEnableOption "Python language support";
|
||||
|
|
@ -335,6 +343,15 @@ in {
|
|||
'';
|
||||
};
|
||||
};
|
||||
|
||||
extraDiagnostics = {
|
||||
enable = mkEnableOption "extra Python diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||
types = diagnostics {
|
||||
langDesc = "Python";
|
||||
inherit diagnosticsProviders;
|
||||
inherit defaultDiagnosticsProvider;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
|
|
@ -404,5 +421,15 @@ in {
|
|||
vim.debugger.nvim-dap.enable = true;
|
||||
vim.debugger.nvim-dap.sources.python-debugger = debuggers.${cfg.dap.debugger}.dapConfig;
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.python = cfg.extraDiagnostics.types;
|
||||
linters =
|
||||
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
})
|
||||
|
|
|
|||
28
modules/plugins/languages/tera.nix
Normal file
28
modules/plugins/languages/tera.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
||||
cfg = config.vim.languages.tera;
|
||||
in {
|
||||
options.vim.languages.tera = {
|
||||
enable = mkEnableOption "Tera templating language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Tera treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "tera";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -8,12 +8,12 @@
|
|||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) bool enum;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.nvim.types) diagnostics mkGrammarOption deprecatedSingleOrListOf;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
cfg = config.vim.languages.toml;
|
||||
defaultServers = ["tombi"];
|
||||
defaultServers = ["taplo"];
|
||||
servers = {
|
||||
tombi = {
|
||||
enable = true;
|
||||
|
|
@ -27,9 +27,21 @@
|
|||
".git"
|
||||
];
|
||||
};
|
||||
taplo = {
|
||||
enable = true;
|
||||
cmd = [
|
||||
(getExe pkgs.taplo)
|
||||
"lsp"
|
||||
"stdio"
|
||||
];
|
||||
filetypes = ["toml"];
|
||||
root_markers = [
|
||||
".git"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
defaultFormat = ["tombi"];
|
||||
defaultFormat = ["taplo"];
|
||||
formats = {
|
||||
tombi = {
|
||||
command = getExe pkgs.tombi;
|
||||
|
|
@ -40,6 +52,15 @@
|
|||
"-"
|
||||
];
|
||||
};
|
||||
taplo = {
|
||||
command = getExe pkgs.taplo;
|
||||
args = [
|
||||
"format"
|
||||
"--stdin-filepath"
|
||||
"$FILENAME"
|
||||
"-"
|
||||
];
|
||||
};
|
||||
};
|
||||
defaultDiagnosticsProvider = ["tombi"];
|
||||
diagnosticsProviders = {
|
||||
|
|
|
|||
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;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -48,7 +48,7 @@ in {
|
|||
default_on_attach(client, bufnr)
|
||||
|
||||
${optionalString cfg.inlayHints.enable ''
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
||||
if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }), { bufnr = bufnr })
|
||||
end
|
||||
''}
|
||||
|
|
|
|||
|
|
@ -11,9 +11,47 @@
|
|||
in {
|
||||
config = mkIf (cfg.enable && cfg.harper-ls.enable) {
|
||||
vim.lsp.servers.harper-ls = {
|
||||
root_markers = [".git"];
|
||||
root_markers = [".git" ".harper-dictionary.txt"];
|
||||
cmd = [(getExe pkgs.harper) "--stdio"];
|
||||
settings = {harper-ls = cfg.harper-ls.settings;};
|
||||
filetypes =
|
||||
# <https://writewithharper.com/docs/integrations/language-server#Supported-Languages>
|
||||
[
|
||||
"asciidoc"
|
||||
"c"
|
||||
"clojure"
|
||||
"cmake"
|
||||
"cpp"
|
||||
"cs"
|
||||
"daml"
|
||||
"dart"
|
||||
"gitcommit"
|
||||
"go"
|
||||
"haskell"
|
||||
"html"
|
||||
"ink"
|
||||
"java"
|
||||
"javascript"
|
||||
"javascriptreact"
|
||||
"kotlin"
|
||||
"lhaskell"
|
||||
"lua"
|
||||
"mail"
|
||||
"markdown"
|
||||
"nix"
|
||||
"php"
|
||||
"python"
|
||||
"ruby"
|
||||
"rust"
|
||||
"scala"
|
||||
"sh"
|
||||
"swift"
|
||||
"text"
|
||||
"toml"
|
||||
"typescript"
|
||||
"typescriptreact"
|
||||
"typst"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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})
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@
|
|||
|
||||
mode = mkOption {
|
||||
description = "Set the display mode";
|
||||
type = nullOr (enum ["foreground" "background"]);
|
||||
type = nullOr (enum ["foreground" "background" "virtualtext"]);
|
||||
default = null;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@
|
|||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.lists) optionals;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.ui.noice;
|
||||
tscfg = config.vim.treesitter;
|
||||
|
|
@ -16,16 +14,15 @@
|
|||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"noice-nvim"
|
||||
"nui-nvim"
|
||||
];
|
||||
|
||||
startPlugins = ["nui-nvim"];
|
||||
treesitter.grammars = optionals tscfg.addDefaultGrammars defaultGrammars;
|
||||
|
||||
pluginRC.noice-nvim = entryAnywhere ''
|
||||
require("noice").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
lazy.plugins.noice-nvim = {
|
||||
package = "noice-nvim";
|
||||
setupModule = "noice";
|
||||
event = ["DeferredUIEnter"];
|
||||
inherit (cfg) setupOpts;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
./harpoon
|
||||
./icon-picker
|
||||
./images
|
||||
./grug-far-nvim
|
||||
./leetcode-nvim
|
||||
./mkdir
|
||||
./motion
|
||||
|
|
|
|||
21
modules/plugins/utility/grug-far-nvim/config.nix
Normal file
21
modules/plugins/utility/grug-far-nvim/config.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
|
||||
cfg = config.vim.utility.grug-far-nvim;
|
||||
in {
|
||||
config = {
|
||||
vim.lazy.plugins.grug-far-nvim = mkIf cfg.enable {
|
||||
package = "grug-far-nvim";
|
||||
cmd = [
|
||||
"GrugFar"
|
||||
"GrugFarWithin"
|
||||
];
|
||||
setupModule = "grug-far";
|
||||
setupOpts = cfg.setupOpts;
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/utility/grug-far-nvim/default.nix
Normal file
6
modules/plugins/utility/grug-far-nvim/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./grug-far-nvim.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
9
modules/plugins/utility/grug-far-nvim/grug-far-nvim.nix
Normal file
9
modules/plugins/utility/grug-far-nvim/grug-far-nvim.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.utility.grug-far-nvim = {
|
||||
enable = mkEnableOption "grug-far";
|
||||
setupOpts = mkPluginSetupOption "grug-far" {};
|
||||
};
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ in {
|
|||
"img-clip"
|
||||
];
|
||||
|
||||
pluginRC.image-nvim = entryAnywhere ''
|
||||
pluginRC.img-clip = entryAnywhere ''
|
||||
require("img-clip").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
9
modules/plugins/visuals/blink-indent/blink-indent.nix
Normal file
9
modules/plugins/visuals/blink-indent/blink-indent.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.visuals.blink-indent = {
|
||||
enable = mkEnableOption "indentation guides [blink-indent]";
|
||||
setupOpts = mkPluginSetupOption "blink-indent" {};
|
||||
};
|
||||
}
|
||||
19
modules/plugins/visuals/blink-indent/config.nix
Normal file
19
modules/plugins/visuals/blink-indent/config.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
|
||||
cfg = config.vim.visuals.blink-indent;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.lazy.plugins.blink-indent = {
|
||||
package = "blink-indent";
|
||||
setupModule = "blink.indent";
|
||||
inherit (cfg) setupOpts;
|
||||
|
||||
event = ["BufEnter"];
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/visuals/blink-indent/default.nix
Normal file
6
modules/plugins/visuals/blink-indent/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./blink-indent.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ in {
|
|||
toggles under individual options.
|
||||
'')
|
||||
|
||||
./blink-indent
|
||||
./cellular-automaton
|
||||
./cinnamon-nvim
|
||||
./fidget-nvim
|
||||
|
|
@ -18,5 +19,6 @@ in {
|
|||
./nvim-web-devicons
|
||||
./rainbow-delimiters
|
||||
./tiny-devicons-auto-colors
|
||||
./syntax-gaslighting
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,18 +4,17 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.visuals.nvim-web-devicons;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["nvim-web-devicons"];
|
||||
|
||||
pluginRC.nvim-web-devicons = entryAnywhere ''
|
||||
require("nvim-web-devicons").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
lazy.plugins.nvim-web-devicons = {
|
||||
package = "nvim-web-devicons";
|
||||
setupModule = "nvim-web-devicons";
|
||||
event = ["DeferredUIEnter"];
|
||||
inherit (cfg) setupOpts;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) nullOr attrsOf attrs enum;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
|
|
@ -16,27 +16,27 @@ in {
|
|||
variant = mkOption {
|
||||
type = nullOr (enum ["light" "dark"]);
|
||||
default = null;
|
||||
description = "Set the light or dark variant manually, instead of relying on `background`";
|
||||
description = ''
|
||||
Set the light or dark variant manually, instead of relying on `background`
|
||||
'';
|
||||
};
|
||||
|
||||
override = mkOption {
|
||||
type = attrsOf attrs;
|
||||
default = {};
|
||||
example = literalExpression ''
|
||||
{
|
||||
zsh = {
|
||||
name = "Zsh";
|
||||
icon = "";
|
||||
color = "#428850";
|
||||
cterm_color = "65";
|
||||
};
|
||||
}
|
||||
'';
|
||||
example = {
|
||||
zsh = {
|
||||
name = "Zsh";
|
||||
icon = "";
|
||||
color = "#428850";
|
||||
cterm_color = "65";
|
||||
};
|
||||
};
|
||||
description = ''
|
||||
Your personal icon overrides.
|
||||
|
||||
You can specify color or cterm_color instead of specifying
|
||||
both of them. DevIcon will be appended to `name`
|
||||
You can specify color or `cterm_color` instead of specifying both of
|
||||
them. `DevIcon` will be appended to `name`
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
|||
20
modules/plugins/visuals/syntax-gaslighting/config.nix
Normal file
20
modules/plugins/visuals/syntax-gaslighting/config.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.visuals.syntax-gaslighting;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["syntax-gaslighting"];
|
||||
pluginRC.colorful-menu-nvim = entryAnywhere ''
|
||||
require("syntax-gaslighting").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/visuals/syntax-gaslighting/default.nix
Normal file
6
modules/plugins/visuals/syntax-gaslighting/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./syntax-gaslighting.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) str nullOr listOf bool;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.visuals = {
|
||||
syntax-gaslighting = {
|
||||
enable = mkEnableOption "Thats no even a real option, you're crazy.";
|
||||
|
||||
setupOpts = mkPluginSetupOption "syntax-gaslighting" {
|
||||
messages = mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
description = "Custom messages for gaslighting.";
|
||||
};
|
||||
|
||||
merge_messages = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Merge user messages with the default ones.
|
||||
If disabled, the messages table will override default messages.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -11,7 +11,8 @@
|
|||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["tiny-devicons-auto-colors-nvim" "nvim-web-devicons"];
|
||||
startPlugins = ["tiny-devicons-auto-colors-nvim"];
|
||||
visuals.nvim-web-devicons.enable = true;
|
||||
|
||||
pluginRC.tiny-devicons-auto-colors = entryAnywhere ''
|
||||
require("tiny-devicons-auto-colors").setup(${toLuaObject cfg.setupOpts})
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
inherit (lib.trivial) flip;
|
||||
inherit (builtins) filter isString hasAttr getAttr;
|
||||
|
||||
getPin = flip getAttr (pkgs.callPackages ../../../npins/sources.nix {});
|
||||
getPin = flip getAttr (inputs.mnw.lib.npinsToPluginsAttrs pkgs ../../../npins/sources.json);
|
||||
|
||||
# Build a Vim plugin with the given name and arguments.
|
||||
buildPlug = attrs: let
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
nodeJs.enable = config.vim.withNodeJs;
|
||||
python3 = {
|
||||
enable = config.vim.withPython3;
|
||||
extraPackages = ps: map (flip builtins.getAttr ps) config.vim.python3Packages;
|
||||
extraPackages = ps: (map (flip builtins.getAttr ps) config.vim.python3Packages) ++ [ps.pynvim];
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -106,16 +106,9 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
# This defaults to `true` in the wrapper
|
||||
# and since we pass this value to the wrapper
|
||||
# with an inherit, it should be `true` here as well
|
||||
withRuby =
|
||||
mkEnableOption ''
|
||||
Ruby support in the Neovim wrapper.
|
||||
''
|
||||
// {
|
||||
default = true;
|
||||
};
|
||||
withRuby = mkEnableOption ''
|
||||
Ruby support in the Neovim wrapper
|
||||
'';
|
||||
|
||||
withNodeJs = mkEnableOption ''
|
||||
NodeJS support in the Neovim wrapper
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ in {
|
|||
|
||||
getOpts = keymap: {
|
||||
inherit (keymap) desc silent nowait script expr unique noremap;
|
||||
remap = !keymap.noremap;
|
||||
};
|
||||
|
||||
toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue