nvim: clean up snippets
it looks readable now
This commit is contained in:
parent
8edc4d84a8
commit
35ca0f7b7a
@ -86,16 +86,28 @@ return {
|
|||||||
-- date and timekeeping snippets
|
-- date and timekeeping snippets
|
||||||
--------------------------------
|
--------------------------------
|
||||||
--------------------------------
|
--------------------------------
|
||||||
s({ trig = "today", desc = "YYYY-MM-DD date of today" }, f(function()
|
s({
|
||||||
|
trig = "today",
|
||||||
|
name = "Today date format",
|
||||||
|
desc = "YYYY-MM-DD date of today"
|
||||||
|
}, f(function()
|
||||||
return os.date("%Y-%m-%d")
|
return os.date("%Y-%m-%d")
|
||||||
end)),
|
end)),
|
||||||
|
|
||||||
s({ trig = "yesterday", desc = "YYYY-MM-DD date of yesterday" }, f(function()
|
s({
|
||||||
|
trig = "yesterday",
|
||||||
|
name = "Yesterday date format",
|
||||||
|
desc = "YYYY-MM-DD date of yesterday"
|
||||||
|
}, f(function()
|
||||||
local t = os.date("*t")
|
local t = os.date("*t")
|
||||||
return os.date("%Y-%m-%d", os.time { year = t.year, month = t.month, day = t.day - 1 })
|
return os.date("%Y-%m-%d", os.time { year = t.year, month = t.month, day = t.day - 1 })
|
||||||
end)),
|
end)),
|
||||||
|
|
||||||
s({ trig = "timestamp", desc = "Unix day timestamp (locked to midnight)" }, f(function()
|
s({
|
||||||
|
trig = "timestamp",
|
||||||
|
name = "Unix day timestamp",
|
||||||
|
desc = "Unix time for today (locked to midnight)"
|
||||||
|
}, f(function()
|
||||||
local t = os.date("*t")
|
local t = os.date("*t")
|
||||||
return tostring(os.time { year = t.year, month = t.month, day = t.day, hour = 0 })
|
return tostring(os.time { year = t.year, month = t.month, day = t.day, hour = 0 })
|
||||||
end)),
|
end)),
|
||||||
@ -103,9 +115,10 @@ return {
|
|||||||
s(
|
s(
|
||||||
{
|
{
|
||||||
trig = "datestamp (%d-)-(%d-)-(%d-)",
|
trig = "datestamp (%d-)-(%d-)-(%d-)",
|
||||||
|
name = "Unix timestamp based on date",
|
||||||
regTrig = true,
|
regTrig = true,
|
||||||
desc =
|
desc =
|
||||||
"YYYY-MM-DD to Unix day timestamp (locked to midnight)"
|
"YYYY-MM-DD to Unix day timestamp conversion (locked to midnight)"
|
||||||
}, f(function(_, snip)
|
}, f(function(_, snip)
|
||||||
return tostring(os.time { year = snip.captures[1], month = snip.captures[2], day = snip.captures[3], hour = 0 })
|
return tostring(os.time { year = snip.captures[1], month = snip.captures[2], day = snip.captures[3], hour = 0 })
|
||||||
end)),
|
end)),
|
||||||
@ -115,14 +128,17 @@ return {
|
|||||||
-- miscellaneous snippets
|
-- miscellaneous snippets
|
||||||
--------------------------------
|
--------------------------------
|
||||||
--------------------------------
|
--------------------------------
|
||||||
s({ trig = "shrug", desc = "shrug emoticon (not escaped)" }, t("¯\\_(ツ)_/¯")),
|
s({
|
||||||
|
trig = "shrug",
|
||||||
|
desc = "shrug emoticon (not escaped)"
|
||||||
|
}, t("¯\\_(ツ)_/¯")),
|
||||||
|
|
||||||
s(
|
s(
|
||||||
{
|
{
|
||||||
trig = "(%d*)segm(%d-)",
|
trig = "(%d*)segm(%d-)",
|
||||||
regTrig = true,
|
regTrig = true,
|
||||||
|
name = "section/segment header title comment.",
|
||||||
desc = {
|
desc = {
|
||||||
"section/segment header title comment.", "",
|
|
||||||
"number in front is height (default 1), second number is width.",
|
"number in front is height (default 1), second number is width.",
|
||||||
"to use this, type the comment symbol (e.g. # or //) then TAB, then the section title.",
|
"to use this, type the comment symbol (e.g. # or //) then TAB, then the section title.",
|
||||||
"see also: https://www.pathsensitive.com/2023/12/should-you-split-that-file.html",
|
"see also: https://www.pathsensitive.com/2023/12/should-you-split-that-file.html",
|
||||||
@ -155,7 +171,12 @@ return {
|
|||||||
})),
|
})),
|
||||||
|
|
||||||
s(
|
s(
|
||||||
{ trig = "fbox(%a?)", regTrig = true, name = "format box", desc = { "draw a unicode box around some text.", "use fboxs for sharp corners (round default), fboxh for heavy" } },
|
{
|
||||||
|
trig = "fbox(%a?)",
|
||||||
|
regTrig = true,
|
||||||
|
name = "format box",
|
||||||
|
desc = { "draw a unicode box around some text.", "use fboxs for sharp corners (round default), fboxh for heavy" }
|
||||||
|
},
|
||||||
fmt([[
|
fmt([[
|
||||||
{surr1}
|
{surr1}
|
||||||
{content}
|
{content}
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
return {
|
return {
|
||||||
s({ trig = "snipf", desc = "meta snippet (snippet for making snippets)" }, fmt([[
|
s({
|
||||||
s({{trig="{}", desc="{}"}}, {}),
|
trig = "snipf",
|
||||||
]], { i(1, "trigger"), i(2, "human-readable description"), i(3, "<body nodes>") }))
|
desc = "meta snippet (snippet for making snippets)"
|
||||||
|
}, fmt([[
|
||||||
|
s({{
|
||||||
|
trig="{}",
|
||||||
|
name="{}",
|
||||||
|
desc="{}",
|
||||||
|
}},
|
||||||
|
{}
|
||||||
|
),
|
||||||
|
]], { i(1, "trigger"), i(2, "human-readable name"), i(3, "human-readable description"), i(4, "body") }))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user