mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
nvim/luasnip: ruler snippet for time
This commit is contained in:
parent
8c63d777f1
commit
99d92483bd
1 changed files with 18 additions and 4 deletions
|
|
@ -5,12 +5,14 @@ local cr = function() return t { "", "" } end
|
|||
local i = luasnip.insert_node
|
||||
local f = luasnip.function_node
|
||||
|
||||
local function datetime() return os.date('"%Y-%m-%d %H:%M:%S"') end
|
||||
local function date() return os.date('"%Y-%m-%d"') end
|
||||
local function datetime() return os.date('%Y-%m-%d %H:%M:%S') end
|
||||
local function date() return os.date('%Y-%m-%d') end
|
||||
local function quoted(s) return '"' .. s .. '"' end
|
||||
|
||||
luasnip.add_snippets("typst", {
|
||||
s("entry", {
|
||||
t("#entry("),
|
||||
f(datetime),
|
||||
f(function() return quoted(datetime()) end),
|
||||
t { ")[", "" },
|
||||
t(" "),
|
||||
i(0),
|
||||
|
|
@ -18,7 +20,7 @@ luasnip.add_snippets("typst", {
|
|||
}),
|
||||
s("from-the-future", {
|
||||
t("#entries.from-the-future("),
|
||||
f(date),
|
||||
f(function() return quoted(date()) end),
|
||||
t { ")[", "" },
|
||||
t(" "),
|
||||
i(0),
|
||||
|
|
@ -43,5 +45,17 @@ luasnip.add_snippets("go", {
|
|||
}),
|
||||
})
|
||||
|
||||
luasnip.add_snippets("ruler", {
|
||||
s("begin", {
|
||||
f(datetime),
|
||||
t(" ... "),
|
||||
i(0),
|
||||
}),
|
||||
s("end", {
|
||||
f(datetime),
|
||||
i(0),
|
||||
}),
|
||||
})
|
||||
|
||||
local haskell_snippets = require("haskell-snippets").all
|
||||
luasnip.add_snippets("haskell", haskell_snippets, { key = "haskell" })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue