From b1728e2d68d2297437d982b74fe3ac0c331eef2c Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Sun, 28 Sep 2025 10:02:49 +0900 Subject: modified snippets/journal.lua, modified shell/bm-dirs, created snippets/journal.lua --- .../TheSiahxyz/lua/TheSiahxyz/snippets/journal.lua | 119 +++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/journal.lua (limited to 'ar') diff --git a/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/journal.lua b/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/journal.lua new file mode 100644 index 0000000..22e0dad --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/journal.lua @@ -0,0 +1,119 @@ +local ls = require("luasnip") + +local s = ls.snippet +local i = ls.insert_node +local t = ls.text_node +local c = ls.choice_node +local f = ls.function_node + +local fmt = require("luasnip.extras.fmt").fmta + +-- get weather from wttr.in +local function get_weather() + local q = os.getenv("JOURNAL_WEATHER_QUERY") + local url = q and ("wttr.in/" .. q .. "?format=1") or "wttr.in/?format=1" + local handle = io.popen(("curl -m 2 -s '%s'"):format(url)) + if not handle then + return "" + end + local result = handle:read("*a") or "" + handle:close() + return (result:gsub("[\r\n]", "")) +end + +local journal_snippet = s( + "journal", + fmt( + [[--- +title: