Merge branch 'v0.8' into v0.8

This commit is contained in:
raf 2025-08-21 09:04:10 +03:00 committed by GitHub
commit 085d161ca9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
55 changed files with 1652 additions and 732 deletions

View file

@ -5,11 +5,12 @@
}: let
inherit (lib.modules) mkIf;
inherit (lib.strings) optionalString;
inherit (lib.attrsets) optionalAttrs;
inherit (lib.generators) mkLuaInline;
inherit (lib.attrsets) attrValues filterAttrs mapAttrsToList;
inherit (lib.lists) map optional elem;
inherit (lib.lists) map optional optionals elem;
inherit (lib.nvim.lua) toLuaObject;
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs removeAttrs;
cfg = config.vim.autocomplete.blink-cmp;
cmpCfg = config.vim.autocomplete.nvim-cmp;
@ -55,7 +56,7 @@ in {
after =
# lua
''
${optionalString config.vim.lazy.enable
${optionalString (config.vim.lazy.enable && cmpCfg.enable)
(concatStringsSep "\n" (map
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
cmpCfg.sourcePlugins))}
@ -66,7 +67,10 @@ in {
autocomplete = {
enableSharedCmpSources = true;
blink-cmp.setupOpts = {
sources = {
sources = let
# We do not want nvim-cmp compat sources overriding built-in blink sources
filteredCmpSources = removeAttrs cmpCfg.sources blinkBuiltins;
in {
default =
[
"lsp"
@ -74,14 +78,16 @@ in {
"snippets"
"buffer"
]
++ (attrNames cmpCfg.sources)
++ optionals cmpCfg.enable (attrNames filteredCmpSources)
++ (attrNames enabledBlinkSources);
providers =
mapAttrs (name: _: {
inherit name;
module = "blink.compat.source";
})
cmpCfg.sources
optionalAttrs cmpCfg.enable (
mapAttrs (name: _: {
inherit name;
module = "blink.compat.source";
})
filteredCmpSources
)
// (mapAttrs (name: definition: {
inherit name;
inherit (definition) module;

View file

@ -3,46 +3,47 @@
inherit (lib.types) listOf attrs bool enum str oneOf int;
in {
options.vim.dashboard.startify = {
enable = mkEnableOption "dashboard via vim-startify";
enable = mkEnableOption "fancy start screen for Vim [vim-startify]";
bookmarks = mkOption {
default = [];
description = ''List of book marks to display on start page'';
type = listOf attrs;
default = [];
example = {"c" = "~/.vimrc";};
description = "List of book marks to display on start page";
};
changeToDir = mkOption {
default = true;
description = "Should vim change to the directory of the file you open";
type = bool;
default = true;
description = "Whether Vim should change to the directory of the file you open";
};
changeToVCRoot = mkOption {
default = false;
description = "Should vim change to the version control root when opening a file";
type = bool;
default = false;
description = "Whether Vim should change to the version control root when opening a file";
};
changeDirCmd = mkOption {
default = "lcd";
description = "Command to change the current window with. Can be cd, lcd or tcd";
type = enum ["cd" "lcd" "tcd"];
default = "lcd";
description = "Command to change the current window with.";
};
customHeader = mkOption {
type = listOf str;
default = [];
description = "Text to place in the header";
type = listOf str;
};
customFooter = mkOption {
type = listOf str;
default = [];
description = "Text to place in the footer";
type = listOf str;
};
lists = mkOption {
type = listOf attrs;
default = [
{
type = "files";
@ -66,121 +67,136 @@ in {
}
];
description = "Specify the lists and in what order they are displayed on startify.";
type = listOf attrs;
};
skipList = mkOption {
type = listOf str;
default = [];
description = "List of regex patterns to exclude from MRU lists";
type = listOf str;
};
updateOldFiles = mkOption {
type = bool;
default = false;
description = "Set if you want startify to always update and not just when neovim closes";
type = bool;
};
sessionAutoload = mkOption {
default = false;
description = "Make startify auto load Session.vim files from the current directory";
type = bool;
default = false;
description = "Make vim-startify auto load Session.vim files from the current directory";
};
commands = mkOption {
type = listOf (oneOf [str attrs (listOf str)]);
default = [];
description = "Commands that are presented to the user on startify page";
type = listOf (oneOf [str attrs (listOf str)]);
};
filesNumber = mkOption {
type = int;
default = 10;
description = "How many files to list";
type = int;
};
customIndices = mkOption {
type = listOf str;
default = [];
description = "Specify a list of default characters to use instead of numbers";
type = listOf str;
};
disableOnStartup = mkOption {
default = false;
description = "Prevent startify from opening on startup but can be called with :Startify";
type = bool;
default = false;
description = ''
Whether vim-startify should be disabled on startup.
This will prevent startify from opening on startup, but it can still
be called with `:Startify`
'';
};
unsafe = mkOption {
default = false;
description = "Turns on unsafe mode for Startify. Stops resolving links, checking files are readable and filtering bookmark list";
type = bool;
default = false;
description = ''
Whether to turn on unsafe mode for Startify.
While enabld, vim-startify will stops resolving links, checking files
are readable and filtering bookmark list
'';
};
paddingLeft = mkOption {
type = int;
default = 3;
description = "Number of spaces used for left padding.";
type = int;
};
useEnv = mkOption {
type = bool;
default = false;
description = "Show environment variables in path if name is shorter than value";
type = bool;
};
sessionBeforeSave = mkOption {
type = listOf str;
default = [];
description = "Commands to run before saving a session";
type = listOf str;
};
sessionPersistence = mkOption {
type = bool;
default = false;
description = "Persist session before leaving vim or switching session";
type = bool;
};
sessionDeleteBuffers = mkOption {
type = bool;
default = true;
description = "Delete all buffers when loading or closing a session";
type = bool;
};
sessionDir = mkOption {
type = str;
default = "~/.vim/session";
description = "Directory to save and load sessions from";
type = str;
};
skipListServer = mkOption {
type = listOf str;
default = [];
description = "List of vim servers to not load startify for";
type = listOf str;
};
sessionRemoveLines = mkOption {
type = listOf str;
default = [];
description = "Patterns to remove from session files";
type = listOf str;
};
sessionSavevars = mkOption {
type = listOf str;
default = [];
description = "List of variables to save into a session file.";
type = listOf str;
};
sessionSavecmds = mkOption {
type = listOf str;
default = [];
description = "List of commands to run when loading a session.";
type = listOf str;
};
sessionSort = mkOption {
default = false;
description = "Set if you want items sorted by date rather than alphabetically";
type = bool;
default = false;
example = true;
description = ''
While true, sessions will be sorted by date rather than alphabetically.
'';
};
};
}

View file

@ -3,6 +3,7 @@
in {
imports = [
./gitsigns
./hunk-nvim
./vim-fugitive
./git-conflict
./gitlinker-nvim
@ -14,7 +15,9 @@ in {
git integration suite.
Enabling this option will enable the following plugins:
* gitsigns
* hunk-nvim
* vim-fugitive
* git-conflict
* gitlinker-nvim

View file

@ -0,0 +1,27 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.git.hunk-nvim;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = [
# dependencies
"nui-nvim" # ui library
"nvim-web-devicons" # glyphs
];
lazy.plugins = {
"hunk-nvim" = {
package = "hunk-nvim";
setupModule = "hunk";
inherit (cfg) setupOpts;
};
};
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./hunk-nvim.nix
./config.nix
];
}

View file

@ -0,0 +1,13 @@
{
config,
lib,
...
}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.git.hunk-nvim = {
enable = mkEnableOption "tool for splitting diffs in Neovim [hunk-nvim]" // {default = config.vim.git.enable;};
setupOpts = mkPluginSetupOption "hunk-nvim" {};
};
}

View file

@ -30,6 +30,7 @@ in {
./ocaml.nix
./php.nix
./python.nix
./qml.nix
./r.nix
./rust.nix
./scala.nix

View file

@ -4,14 +4,44 @@
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.meta) getExe;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.types) bool;
inherit (lib.types) bool enum package;
inherit (lib.lists) optional;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.types) mkGrammarOption diagnostics singleOrListOf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.attrsets) mapListToAttrs;
cfg = config.vim.languages.html;
defaultServers = ["superhtml"];
servers = {
superhtml = {
cmd = [(getExe pkgs.superhtml) "lsp"];
filetypes = ["html" "shtml" "htm"];
root_markers = ["index.html" ".git"];
};
};
defaultFormat = "superhtml";
formats = {
superhtml = {
package = pkgs.writeShellApplication {
name = "superhtml_fmt";
runtimeInputs = [pkgs.superhtml];
text = "superhtml fmt -";
};
};
};
defaultDiagnosticsProvider = ["htmlhint"];
diagnosticsProviders = {
htmlhint = {
config.cmd = getExe pkgs.htmlhint;
};
};
in {
options.vim.languages.html = {
enable = mkEnableOption "HTML language support";
@ -19,9 +49,44 @@ in {
enable = mkEnableOption "HTML treesitter support" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "html";
autotagHtml = mkOption {
description = "Enable autoclose/autorename of html tags (nvim-ts-autotag)";
type = bool;
default = true;
description = "Enable autoclose/autorename of html tags (nvim-ts-autotag)";
};
};
lsp = {
enable = mkEnableOption "HTML LSP support" // {default = config.vim.lsp.enable;};
servers = mkOption {
type = singleOrListOf (enum (attrNames servers));
default = defaultServers;
description = "HTML LSP server to use";
};
};
format = {
enable = mkEnableOption "HTML formatting" // {default = config.vim.languages.enableFormat;};
type = mkOption {
type = enum (attrNames formats);
default = defaultFormat;
description = "HTML formatter to use";
};
package = mkOption {
type = package;
default = formats.${cfg.format.type}.package;
description = "HTML formatter package";
};
};
extraDiagnostics = {
enable = mkEnableOption "extra HTML diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
types = diagnostics {
langDesc = "HTML";
inherit diagnosticsProviders;
inherit defaultDiagnosticsProvider;
};
};
};
@ -41,5 +106,35 @@ in {
'');
};
})
(mkIf cfg.lsp.enable {
vim.lsp.servers =
mapListToAttrs (n: {
name = n;
value = servers.${n};
})
cfg.lsp.servers;
})
(mkIf (cfg.format.enable && !cfg.lsp.enable) {
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.html = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
})
(mkIf cfg.extraDiagnostics.enable {
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.html = cfg.extraDiagnostics.types;
linters = mkMerge (map (name: {
${name} = diagnosticsProviders.${name}.config;
})
cfg.extraDiagnostics.types);
};
})
]);
}

View file

@ -0,0 +1,98 @@
{
config,
pkgs,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.meta) getExe getExe';
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.types) enum package;
inherit (lib.nvim.types) mkGrammarOption singleOrListOf;
inherit (lib.nvim.attrsets) mapListToAttrs;
cfg = config.vim.languages.qml;
qmlPackage = pkgs.kdePackages.qtdeclarative;
defaultServers = ["qmlls"];
servers = {
qmlls = {
cmd = [(getExe' qmlPackage "qmlls")];
filetypes = ["qml" "qmljs"];
rootmarkers = [".git"];
};
};
defaultFormat = "qmlformat";
formats = {
qmlformat = {
package = pkgs.writeShellApplication {
name = "qmlformat";
runtimeInputs = [qmlPackage];
text = "qmlformat -";
};
};
};
in {
options.vim.languages.qml = {
enable = mkEnableOption "QML language support";
treesitter = {
enable = mkEnableOption "QML treesitter support" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "qmljs";
};
lsp = {
enable = mkEnableOption "QML LSP support" // {default = config.vim.lsp.enable;};
servers = mkOption {
type = singleOrListOf (enum (attrNames servers));
default = defaultServers;
description = "QML LSP server to use";
};
};
format = {
enable = mkEnableOption "QML formatting" // {default = config.vim.languages.enableFormat;};
type = mkOption {
type = enum (attrNames formats);
default = defaultFormat;
description = "QML formatter to use";
};
package = mkOption {
type = package;
default = formats.${cfg.format.type}.package;
description = "QML formatter package";
};
};
};
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;
})
(mkIf (cfg.format.enable && !cfg.lsp.enable) {
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.qml = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
})
]);
}

View file

@ -15,13 +15,6 @@
mappings = addDescriptionsToMappings cfg.otter-nvim.mappings mappingDefinitions;
in {
config = mkIf (cfg.enable && cfg.otter-nvim.enable) {
warnings = [
# TODO: remove warning when we update to nvim 0.11
(mkIf config.vim.utility.ccc.enable ''
ccc and otter occasionally have small conflicts that will disappear with nvim 0.11.
In the meantime, otter handles it by throwing a warning, but both plugins will work.
'')
];
vim = {
startPlugins = ["otter-nvim"];

View file

@ -25,7 +25,7 @@ in {
type = listOf package;
default = [];
example = literalExpression ''
pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
regex
kdl
];
@ -33,6 +33,7 @@ in {
description = ''
List of treesitter grammars to install. For grammars to be installed properly,
you must use grammars from `pkgs.vimPlugins.nvim-treesitter.builtGrammars`.
You can use `pkgs.vimPlugins.nvim-treesitter.allGrammars` to install all grammars.
For languages already supported by nvf, you may use
{option}`vim.language.<lang>.treesitter` options, which will automatically add

View file

@ -0,0 +1,9 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.ui.colorful-menu-nvim = {
enable = mkEnableOption "treesitter highlighted completion menus [colorful-menu.nvim]";
setupOpts = mkPluginSetupOption "colorful-menu-nvim" {};
};
}

View 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.ui.colorful-menu-nvim;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["colorful-menu-nvim"];
pluginRC.colorful-menu-nvim = entryAnywhere ''
require("colorful-menu").setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./colorful-menu-nvim.nix
];
}

View file

@ -1,14 +1,15 @@
{
imports = [
./noice
./modes
./nvim-ufo
./notifications
./smartcolumn
./colorizer
./illuminate
./breadcrumbs
./borders
./breadcrumbs
./colorful-menu-nvim
./colorizer
./fastaction
./illuminate
./modes
./noice
./notifications
./nvim-ufo
./smartcolumn
];
}

View file

@ -15,9 +15,11 @@
./multicursors
./new-file-template
./nix-develop
./nvim-biscuits
./oil-nvim
./outline
./preview
./qmk-nvim
./sleuth
./smart-splits
./snacks-nvim
@ -26,5 +28,6 @@
./wakatime
./yanky-nvim
./yazi-nvim
./undotree
];
}

View 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.utility.nvim-biscuits;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["nvim-biscuits"];
pluginRC.nvim-biscuits = entryAnywhere ''
require('nvim-biscuits').setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./nvim-biscuits.nix
];
}

View file

@ -0,0 +1,10 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.utility.nvim-biscuits = {
enable = mkEnableOption "a Neovim port of Assorted Biscuits [nvim-biscuits]";
setupOpts = mkPluginSetupOption "nvim-biscuits" {};
};
}

View file

@ -0,0 +1,36 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAfter;
cfg = config.vim.utility.qmk-nvim;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["qmk-nvim"];
pluginRC.qmk-nvim = entryAfter ["nvim-notify"] ''
require('qmk').setup(${toLuaObject cfg.setupOpts})
'';
};
assertions = [
{
assertion = cfg.setupOpts.variant == "qmk" && cfg.setupOpts.comment_preview.position != "inside";
message = "comment_preview.position can only be set to inside when using the qmk layoyt";
}
{
assertion = cfg.setupOpts.name != null;
message = "qmk-nvim requires 'vim.utility.qmk.setupOpts.name' to be set.";
}
{
assertion = cfg.setupOpts.layout != null;
message = "qmk-nvim requires 'vim.utility.qmk.setupOpts.layout' to be set.";
}
];
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./qmk-nvim.nix
];
}

View file

@ -0,0 +1,49 @@
{lib, ...}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) attrsOf nullOr enum lines str;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.utility.qmk-nvim = {
enable = mkEnableOption "QMK and ZMK keymaps in nvim";
setupOpts = mkPluginSetupOption "qmk.nvim" {
name = mkOption {
type = nullOr str;
default = null;
description = "The name of the layout";
};
layout = mkOption {
type = nullOr lines;
default = null;
description = ''
The keyboard key layout
see <https://github.com/codethread/qmk.nvim?tab=readme-ov-file#Layout> for more details
'';
};
variant = mkOption {
type = enum ["qmk" "zmk"];
default = "qmk";
description = "Chooses the expected hardware target";
};
comment_preview = {
position = mkOption {
type = enum ["top" "bottom" "inside" "none"];
default = "top";
description = "Controls the position of the preview";
};
keymap_overrides = mkOption {
type = attrsOf str;
default = {};
description = ''
Key codes to text replacements
see <https://github.com/codethread/qmk.nvim/blob/main/lua/qmk/config/key_map.lua> for more details
'';
};
};
};
};
}

View file

@ -0,0 +1,22 @@
{
lib,
config,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.utility.undotree;
in {
config = mkIf cfg.enable {
vim.lazy.plugins.undotree = {
package = "undotree";
cmd = [
"UndotreeToggle"
"UndotreeShow"
"UndotreeHide"
"UndotreePersistUndo"
"UndotreeFocus"
];
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./undotree.nix
./config.nix
];
}

View file

@ -0,0 +1,7 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
in {
options.vim.utility.undotree = {
enable = mkEnableOption "undo history visualizer for Vim [undotree]";
};
}