Files
dotfiles/nvim/lua/snippets/markdown.lua
Nikolai Papin bc499db140 feat: updated neovim snippets;
feat: added gpg sign shortcut to neovim;
feat: yuck plugin;
refactor: my theme;
feat: tty color theme (for tty colors compatibility);
refactor: minor hyprland changes
2025-07-04 21:17:03 +03:00

52 lines
1.3 KiB
Lua

local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local extras = require("luasnip.extras")
local rep = extras.rep
local timestamp = function()
return tostring(os.time())
end
local get_date = function()
return os.date("%H:%M:%S %d.%m.%Y")
end
local get_name = function()
return "Nikolai Papin"
end
return {
-- Creates a frontmatter with markdown note metadata
s("frontmatter", {
t("---"),
t({ "", "Markdown note", "" }),
t({ "", "title: \"" }), i(1), t("\""),
t({ "", "date: \"" }), f(get_date, {}), t("\""),
t({ "", "author: \"" }), f(get_name, {}), t("\""),
t({ "", "keywords: ["}), i(2), t("]"),
t({ "", "tags: [["}), i(3), t("]]"),
t({ "", "id: " }), f(timestamp, {}),
t({ "", "---", "", "# " }),
rep(1), -- Reuses the first insert node
t({ "", ""}),
t({ "", ""}),
i(4) -- Final cursor position
}),
-- Creates a mood report template
s("wellbeingreport", {
t("---"),
t({ "", "Well-being report", "" }),
t({ "", "date: " }), f(get_date, {}),
t({ "", "sleep: " }), i(1), t("/5"),
t({ "", "emotions: [" }), i(2), t("]"),
t({ "", "comfort: " }), i(3), t("/5"),
t({ "", "complaints: ["}), i(4), t("]"),
t({ "", "mood: " }), i(5), t("/10"),
t({ "", "---" }),
}),
}