diff options
Diffstat (limited to 'ar/.config')
| -rw-r--r-- | ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua | 32 | ||||
| -rw-r--r-- | ar/.config/lf/lfrc | 4 | ||||
| -rw-r--r-- | ar/.config/shell/aliasrc | 2 |
3 files changed, 37 insertions, 1 deletions
diff --git a/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua b/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua index 90528a1..f1c636b 100644 --- a/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua +++ b/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua @@ -3,15 +3,46 @@ local ls = require("luasnip") local s = ls.snippet local i = ls.insert_node local f = ls.function_node +local c = ls.choice_node +local t = ls.text_node local fmt = require("luasnip.extras.fmt").fmta +local function bgm_list() + local handle = io.popen("ssh root@thesiah.xyz 'ls /var/www/thesiah/bgm/' 2>/dev/null") + if not handle then + return nil + end + + local result = handle:read("*a") + handle:close() + + if not result or result == "" then + return nil + end + + local choices = {} + for filename in result:gmatch("[^\r\n]+") do + table.insert(choices, t(filename)) + end + + if #choices == 0 then + return nil + end + + return choices +end + +local bgm_choices = bgm_list() +local bgm_node = bgm_choices and c(2, bgm_choices) or i(2, "bgm") + local diary_snippet = s( "diary", fmt( [[--- title: <title> date: <date> +bgm: <bgm> --- <story> @@ -21,6 +52,7 @@ date: <date> date = f(function() return os.date("%Y-%m-%d") end, {}), + bgm = bgm_node, story = i(3), } ) diff --git a/ar/.config/lf/lfrc b/ar/.config/lf/lfrc index 0d866eb..becd52c 100644 --- a/ar/.config/lf/lfrc +++ b/ar/.config/lf/lfrc @@ -110,6 +110,10 @@ cmd mkdir %{{ cmd touch %{{ IFS=" " file="$*" + case "$file" in + /*) ;; + *) file="$PWD/$file" ;; + esac dir="${file%/*}" [ "$dir" != "$file" ] && mkdir -p -- "$dir" touch -- "$file" diff --git a/ar/.config/shell/aliasrc b/ar/.config/shell/aliasrc index 1e129f6..1cf6045 100644 --- a/ar/.config/shell/aliasrc +++ b/ar/.config/shell/aliasrc @@ -12,7 +12,7 @@ [ -f "$MBSYNCRC" ] && alias mbsync='mbsync -c $MBSYNCRC' # sudo not required for some system commands -for command in blkid lsblk mount umount pacman poweroff reboot shutdown su sv updatedb; do +for command in arp-scan blkid docker ecrypt lazydocker lsblk mount umount pacman poweroff reboot shutdown su sv updatedb; do alias $command="sudo $command" done unset command |
