Rename modules directory
All checks were successful
/ check (push) Successful in 55s

This commit is contained in:
Oliver Davies 2025-08-18 12:00:00 +01:00
parent a0575bdb2a
commit 703bf836de
210 changed files with 1 additions and 1 deletions

View file

@ -0,0 +1,57 @@
{
flake.modules.nixvim.custom.plugins.cmp = {
enable = true;
autoEnableSources = true;
settings = {
mapping = {
"<C-e>" = "cmp.mapping.close()";
"<C-h>" = ''
cmp.mapping(function()
if ls.locally_jumpable(-1) then
ls.jump(-1)
end
end)
'';
"<C-l>" = ''
cmp.mapping(function()
if ls.expand_or_locally_jumpable() then
ls.expand_or_jump()
end
end)
'';
"<C-n>" = "cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select })";
"<C-p>" = "cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select })";
"<C-y>" = "cmp.mapping.confirm({ select = true })";
"<CR>" = "nil";
"<S-Tab>" = "nil";
"<Tab>" = "nil";
};
snippet.expand = ''
function(args)
require('luasnip').lsp_expand(args.body)
end
'';
sources = [
{ name = "nvim_lsp"; }
{ name = "nvim_lua"; }
{
name = "luasnip";
keyword_length = 2;
}
{
name = "buffer";
keyword_length = 3;
}
];
};
};
}

View file

@ -0,0 +1,16 @@
{
flake.modules.nixvim.custom.plugins = {
cmp_luasnip.enable = true;
luasnip = {
enable = true;
fromLua = [
{
lazyLoad = true;
paths = ./snippets;
}
];
};
};
}

View file

@ -0,0 +1,10 @@
return {
s("dev", t("__Under development...__")),
s("source", fmta([[
[source<options>]
----
<finish>
----
]], { finish = i(0), options = i(1) })),
}

View file

@ -0,0 +1,3 @@
return {
s("log", fmta("console.log(<>);", { i(1, "value") })),
}

View file

@ -0,0 +1,13 @@
return {
s(
"req",
fmt([[local {} = require "{}"]], {
f(function(import_name)
local parts = vim.split(import_name[1][1], ".", true)
return parts[#parts] or ""
end, { 1 }),
i(1),
})
)
}

View file

@ -0,0 +1,111 @@
return {
s("home_packages", fmta("home.packages = with pkgs; [ <> ];", i(0))),
s(
"homepage_options",
fmta(
[[
homepage.name = mkOption {
default = "<name>";
type = types.str;
};
homepage.description = mkOption {
default = "<description>";
type = types.str;
};
homepage.icon = mkOption {
default = "<icon>";
type = types.str;
};
homepage.category = mkOption {
default = "<finish>";
type = types.str;
};
]],
{
description = i(2),
finish = i(0),
icon = i(3),
name = i(1),
}
)
),
s(
"imports",
fmta(
[[
{
imports = [
<>
];
}
]],
{ i(0) }
)
),
s(
"new_flake",
fmta(
[[
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";<inputs>
};
outputs =
{ nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) mkShell;
in
{
devShells.${system}.default = mkShell {
packages = with pkgs; [ <pkgs> ];
};<finish>
formatter.${system} = pkgs.nixfmt-classic;
};
}
]],
{ inputs = i(1), pkgs = i(2), finish = i(0) }
)
),
s(
"new_module",
fmta(
[[
{ config, lib, ... }:
let
name = "<name>";
cfg = config.<namespace>.${name};
in
{
options.<namespace>.${name} = {
enable = lib.mkEnableOption "Enable ${name}";<more_options>
};
config = lib.mkIf cfg.enable {
<finish>
};
}
]],
{
finish = i(0),
more_options = i(3),
name = i(1),
namespace = i(2),
},
{ repeat_duplicates = true }
)
),
s("system_packages", fmta("environment.systemPackages = with pkgs; [<>];", i(0))),
}

View file

@ -0,0 +1,55 @@
return {
s("func", fmta("function <>(<>)<> {\n <>\n}<>", { i(1), i(2), i(3), i(4), i(0) })),
s(
"met",
fmta(
[[
<> function <>(<>)<> {
<>
}<>
]],
{ c(1, { t "public", t "protected", t "private" }), i(2), i(3), i(4), i(5), i(0) }
)
),
s("pest", fmta("<>('<>', function() {\n <>\n});", { c(1, { t "it", t "test" }), i(2), i(0) })),
s(
"test",
fmta(
[[
public function test<>(): void {
<>
}<>
]],
{ i(1), i(2), i(0) }
)
),
s(
"testan",
fmta(
[[
/** @test */
public function <>(): void {
<>
}<>
]],
{ i(1), i(2), i(0) }
)
),
s(
"testat",
fmta(
[[
[#Test]
public function <>(): void {
<>
}<>
]],
{ i(1), i(2), i(0) }
)
)
}

View file

@ -0,0 +1,54 @@
local fmta = require("luasnip.extras.fmt").fmta
local fill_line = function(char)
return function()
local row = vim.api.nvim_win_get_cursor(0)[1]
local lines = vim.api.nvim_buf_get_lines(0, row - 2, row, false)
return string.rep(char, #lines[1])
end
end
return {
s("class", t(".. class:: ", i(1))),
s("footer", t(".. footer:: ", i(1))),
s("link", t(".. _", i(1), ":")),
s("raw", t(".. raw:: ", i(1))),
-- TODO: add an optional new line and ":width" property.
s("image", t(".. image:: ", i(1))),
s("head", f(fill_line "=", {})),
s("sub", f(fill_line "-", {})),
s("subsub", f(fill_line "^", {})),
-- Add a page break with an optional page template.
s(
"pb",
fmta(
[[
.. raw:: pdf
PageBreak<>
]],
{ i(0) }
)
),
-- Add a new speaker note.
s(
"ta",
fmta(
[[
.. raw:: pdf
TextAnnotation "<>"
]],
{ i(0) }
)
),
}

View file

@ -0,0 +1,19 @@
return {
s("do", fmta("{% <> %}<>", { i(1), i(0) })),
s("dump", fmta("{{ dump(<>) }}<>", { i(1), i(0) })),
s("echo", fmta("{{ <> }}<>", { i(1), i(0) })),
s(
"for",
fmta(
[[
{% for <> in <> %}
<>
{% endfor %}<>
]],
{ i(1), i(2), i(3), i(0) }
)
),
s("if", fmta("{% if <> %}<>{% endif %}<>", { i(1), i(2), i(0) })),
}