diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-30 15:52:29 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-30 15:52:29 +0900 |
| commit | ca508cd237e3d103f998468c8b42b681ec58be8e (patch) | |
| tree | e9ca18467a7957f0e7476d05f5d55ba5af070bd4 /ar/.config | |
| parent | 5d468c92b51779874438900bd4042635deb0a8ff (diff) | |
modified snippets/diary.lua
Diffstat (limited to 'ar/.config')
| -rw-r--r-- | ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua b/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua index 4f233d1..065de2a 100644 --- a/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua +++ b/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua @@ -10,6 +10,8 @@ local sn = ls.snippet_node local fmt = require("luasnip.extras.fmt").fmta +local default_bgm = "darling.mp3" + local function bgm_node_generator() return function() local handle = io.popen("ssh root@thesiah.xyz 'ls /var/www/thesiah/bgm/' 2>/dev/null") @@ -24,9 +26,24 @@ local function bgm_node_generator() return sn(nil, { i(1, "bgm") }) end - local choices = {} + local filenames = {} for filename in result:gmatch("[^\r\n]+") do - table.insert(choices, t(filename)) + table.insert(filenames, filename) + end + + if default_bgm ~= "" then + for idx, name in ipairs(filenames) do + if name == default_bgm then + table.remove(filenames, idx) + table.insert(filenames, 1, name) + break + end + end + end + + local choices = {} + for _, name in ipairs(filenames) do + table.insert(choices, t(name)) end if #choices == 0 then |
