Reformat nix source file using nixfmt

This commit is contained in:
ulic-youthlic 2025-07-13 06:04:55 +08:00
parent 2e4a532958
commit 9201969c1b
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
220 changed files with 3169 additions and 2487 deletions

View file

@ -1 +1 @@
{...}: {}
{ ... }: { }

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
youthlic.plugins.blink-cmp = {
enable = true;
setupLspCapabilities = true;
@ -25,7 +26,7 @@
};
menu = {
draw = {
treesitter = ["lsp"];
treesitter = [ "lsp" ];
};
};
documentation = {
@ -41,8 +42,13 @@
};
};
sources = {
compat = [];
default = ["lsp" "path" "snippets" "buffer"];
compat = [ ];
default = [
"lsp"
"path"
"snippets"
"buffer"
];
};
cmdline = {
enabled = false;

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
youthlic.plugins = {
lazydev = {
enable = true;
@ -6,7 +7,7 @@
library = [
{
path = "$''{3rd}/luv/library";
words = ["vim%.uv"];
words = [ "vim%.uv" ];
}
];
};

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
youthlic.plugins.mini-ai = {
enable = true;
luaConfig.pre =

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
youthlic.plugins.mini-pairs = {
enable = true;
settings = {

View file

@ -1,3 +1,4 @@
{...}: {
{ ... }:
{
youthlic.plugins.ts-comments.enable = true;
}

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
youthlic.plugins = {
# grug-far = {
# enable = true;

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
youthlic.plugins.gitsigns = {
enable = true;
luaConfig.post =
@ -24,19 +25,41 @@
numhl = true;
linehl = false;
signs = {
add = {text = "";};
change = {text = "";};
delete = {text = "";};
topdelete = {text = "";};
changedelete = {text = "";};
untracked = {text = "";};
add = {
text = "";
};
change = {
text = "";
};
delete = {
text = "";
};
topdelete = {
text = "";
};
changedelete = {
text = "";
};
untracked = {
text = "";
};
};
signs_staged = {
add = {text = "";};
change = {text = "";};
delete = {text = "";};
topdelete = {text = "";};
changedelete = {text = "";};
add = {
text = "";
};
change = {
text = "";
};
delete = {
text = "";
};
topdelete = {
text = "";
};
changedelete = {
text = "";
};
};
on_attach = {
__raw =

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
youthlic.plugins.trouble = {
enable = true;
settings = {
@ -16,7 +17,10 @@
border = "rounded";
title = "Preview";
title_pos = "center";
position = [0 (-2)];
position = [
0
(-2)
];
size = {
width = 0.3;
height = 0.3;

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
youthlic.plugins = {
which-key = {
enable = true;

View file

@ -1,82 +1,85 @@
{...}: {
userCommands = let
formatCmd = {
desc = "Format all the buffer";
# conform.format function can deal with range by itself
range = "%";
bang = true;
bar = true;
nargs = "?";
complete = {
__raw =
#lua
''
function(ArgLead, CmdLine, CursorPos)
return vim.iter(require("conform").list_all_formatters()):filter(function(val)
return val.available
end):map(function(val)
{ ... }:
{
userCommands =
let
formatCmd = {
desc = "Format all the buffer";
# conform.format function can deal with range by itself
range = "%";
bang = true;
bar = true;
nargs = "?";
complete = {
__raw =
#lua
''
function(ArgLead, CmdLine, CursorPos)
return vim.iter(require("conform").list_all_formatters()):filter(function(val)
return val.available
end):map(function(val)
return val.name
end):filter(function(name)
return string.match(name, "^" .. ArgLead) ~= nil
end):totable()
end
'';
};
command = {
__raw =
#lua
''
function(opts)
local format = require("conform").format
if #(opts.fargs) == 0 then
return format()
else
return format({ formatters = { opts.fargs[1] } })
end
end
'';
};
};
in
{
Format = formatCmd;
Fmt = formatCmd;
Formatter = {
desc = "Show config of formatter";
nargs = "?";
bar = true;
complete = {
__raw =
#lua
''
function(ArgLead, CmdLine, CursorPos)
return vim.iter(require("conform").list_all_formatters()):map(function(val)
return val.name
end):filter(function(name)
return string.match(name, "^" .. ArgLead) ~= nil
end):totable()
end
'';
};
command = {
__raw =
#lua
''
function(opts)
local format = require("conform").format
if #(opts.fargs) == 0 then
return format()
else
return format({ formatters = { opts.fargs[1] } })
end):filter(function(name)
return string.match(name, "^" .. ArgLead) ~= nil
end):totable()
end
end
'';
'';
};
command = {
__raw =
#lua
''
function(opts)
local conform = require("conform")
if #(opts.fargs) == 0 then
local formatters = conform.list_all_formatters()
print(vim.inspect(formatters))
return formatters
else
local config = conform.get_formatter_config(opts.fargs[1])
print(vim.inspect(config))
return config
end
end
'';
};
};
};
in {
Format = formatCmd;
Fmt = formatCmd;
Formatter = {
desc = "Show config of formatter";
nargs = "?";
bar = true;
complete = {
__raw =
#lua
''
function(ArgLead, CmdLine, CursorPos)
return vim.iter(require("conform").list_all_formatters()):map(function(val)
return val.name
end):filter(function(name)
return string.match(name, "^" .. ArgLead) ~= nil
end):totable()
end
'';
};
command = {
__raw =
#lua
''
function(opts)
local conform = require("conform")
if #(opts.fargs) == 0 then
local formatters = conform.list_all_formatters()
print(vim.inspect(formatters))
return formatters
else
local config = conform.get_formatter_config(opts.fargs[1])
print(vim.inspect(config))
return config
end
end
'';
};
};
};
keymaps = [
{
action = {
@ -89,7 +92,10 @@
'';
};
key = "=";
mode = ["n" "v"];
mode = [
"n"
"v"
];
options = {
desc = "Format with conform";
};

View file

@ -1 +1 @@
{...}: {}
{ ... }: { }

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
youthlic.plugins.conform-nvim.settings = {
formatters_by_ft.c = {
__unkeyed-1 = "clang-format";

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
youthlic.plugins.conform-nvim.settings = {
formatters_by_ft.cpp = {
__unkeyed-1 = "clang-format";

View file

@ -1,5 +1,6 @@
{pkgs, ...}: {
extraPackagesAfter = with pkgs; [idris2Packages.idris2Lsp];
{ pkgs, ... }:
{
extraPackagesAfter = with pkgs; [ idris2Packages.idris2Lsp ];
lsp.servers.idris2 = {
enable = true;
};

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
youthlic.plugins.conform-nvim.settings = {
formatters_by_ft.json = {
__unkeyed-1 = "deno_fmt";

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
lsp.servers.lua_ls = {
enable = true;
};

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
youthlic.plugins.conform-nvim.settings = {
formatters_by_ft.markdown = {
__unkeyed-1 = "deno_fmt";

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
lsp.servers = {
nixd = {
enable = true;

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
youthlic.plugins.conform-nvim.settings = {
formatters_by_ft.python = {
__unkeyed-1 = "ruff_format";

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
youthlic.plugins.conform-nvim.settings = {
formatters_by_ft.rust = {
__unkeyed-1 = "rustfmt";

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
youthlic.plugins.conform-nvim.settings = {
formatters_by_ft.toml = {
__unkeyed-1 = "taplo";

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
youthlic.plugins.conform-nvim.settings = {
formatters_by_ft.yaml = {
__unkeyed-1 = "deno_fmt";

View file

@ -1 +1 @@
{...}: {}
{ ... }: { }

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
youthlic.plugins.lspconfig.enable = true;
lsp = {
inlayHints.enable = true;

View file

@ -3,27 +3,35 @@
config,
options,
...
}: let
}:
let
cfg = config.youthlic;
in {
in
{
options = {
youthlic.plugins = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule ({
name,
lib,
...
}: {
freeformType = lib.types.anything;
options = {
enable = lib.mkEnableOption "nvimPlugins.${name}";
};
}));
default = {};
type = lib.types.attrsOf (
lib.types.submodule (
{
name,
lib,
...
}:
{
freeformType = lib.types.anything;
options = {
enable = lib.mkEnableOption "nvimPlugins.${name}";
};
}
)
);
default = { };
};
};
config = let
enabledPlugins = lib.filterAttrs (_name: value: value.enable) cfg.plugins;
in
config =
let
enabledPlugins = lib.filterAttrs (_name: value: value.enable) cfg.plugins;
in
lib.mkMerge [
{
plugins = enabledPlugins;
@ -32,14 +40,16 @@ in {
plugins = lib.pipe enabledPlugins [
builtins.attrNames
(lib.filter (name: options.plugins.${name} ? luaConfig))
(map (name:
(map (
name:
lib.nameValuePair name {
luaConfig.post =
#lua
''
_M.load("${name}")
'';
}))
}
))
lib.listToAttrs
];
}

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
extraConfigLua =
#lua
''

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
globals = {
mapleader = {
__raw =
@ -11,7 +12,11 @@
opts = {
autoindent = true;
autoread = true;
backspace = ["indent" "eol" "start"];
backspace = [
"indent"
"eol"
"start"
];
backup = false;
breakindent = true;
@ -21,18 +26,33 @@
cdhome = true;
cedit = "<C-F>";
cmdheight = 1;
completeopt = ["fuzzy" "menuone" "noselect" "popup"];
completeopt = [
"fuzzy"
"menuone"
"noselect"
"popup"
];
concealcursor = "v";
confirm = true;
cursorline = true;
diffopt = ["algorithm:minimal" "closeoff" "context:20" "followwrap" "internal" "linematch:40"];
diffopt = [
"algorithm:minimal"
"closeoff"
"context:20"
"followwrap"
"internal"
"linematch:40"
];
errorbells = true;
expandtab = true;
exrc = true;
foldcolumn = "auto";
fsync = true;
gdefault = false;
helplang = ["zh" "en"];
helplang = [
"zh"
"en"
];
history = 10000;
hlsearch = true;
@ -66,11 +86,17 @@
termguicolors = true;
undofile = true;
undolevels = 100000;
virtualedit = ["block" "onemore"];
virtualedit = [
"block"
"onemore"
];
whichwrap = "b,s,<,>";
wildmenu = true;
wildmode = ["full"];
wildoptions = ["fuzzy" "pum"];
wildmode = [ "full" ];
wildoptions = [
"fuzzy"
"pum"
];
winborder = "rounded";
wrap = true;
};

View file

@ -11,7 +11,9 @@ makeNixvimWithModule {
inherit nixvimPlugins;
};
module = {
imports = with lib; youthlic.loadImports' ./. (filter (name: !hasSuffix "/package.nix" (toString name)));
imports =
with lib;
youthlic.loadImports' ./. (filter (name: !hasSuffix "/package.nix" (toString name)));
enableMan = true;
enablePrintInit = true;
package = neovim_git;

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
youthlic.plugins = {
treesitter = {
enable = true;

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
youthlic.plugins.bufferline = {
enable = true;
settings = {

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
colorschemes.gruvbox = {
enable = true;
settings = {

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
youthlic.plugins.lualine = {
enable = true;
luaConfig.pre =
@ -16,6 +17,6 @@
vim.o.laststatus = vim.g.lualine_laststatus
end
'';
settings = {};
settings = { };
};
}

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
extraConfigLuaPre =
#lua
''

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
youthlic.plugins.snacks = {
enable = true;
luaConfig.content =

View file

@ -1,4 +1,5 @@
{nixvimPlugins, ...}: {
{ nixvimPlugins, ... }:
{
extraPlugins = [
{
config =