feat: Change nix formatter to alejandra

This commit is contained in:
ulic-youthlic 2025-11-09 06:25:03 +08:00
parent 0b8b647f05
commit b4c3dfec42
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
229 changed files with 2528 additions and 2884 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,85 +1,82 @@
{ ... }:
{
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)
{...}: {
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):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
'';
};
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
'';
};
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 = {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,11 +3,9 @@
config,
options,
...
}:
let
}: let
cfg = config.youthlic;
in
{
in {
options = {
youthlic.plugins = lib.mkOption {
type = lib.types.attrsOf (
@ -16,8 +14,7 @@ in
name,
lib,
...
}:
{
}: {
freeformType = lib.types.anything;
options = {
enable = lib.mkEnableOption "nvimPlugins.${name}";
@ -25,13 +22,12 @@ in
}
)
);
default = { };
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;
@ -42,13 +38,13 @@ in
(lib.filter (name: options.plugins.${name} ? luaConfig))
(map (
name:
lib.nameValuePair name {
luaConfig.post =
#lua
''
_M.load("${name}")
'';
}
lib.nameValuePair name {
luaConfig.post =
#lua
''
_M.load("${name}")
'';
}
))
lib.listToAttrs
];

View file

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

View file

@ -1,5 +1,4 @@
{ ... }:
{
{...}: {
globals = {
mapleader = {
__raw =
@ -92,7 +91,7 @@
];
whichwrap = "b,s,<,>";
wildmenu = true;
wildmode = [ "full" ];
wildmode = ["full"];
wildoptions = [
"fuzzy"
"pum"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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