diff options
Diffstat (limited to 'ar/.config')
| -rw-r--r-- | ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/snippets.lua | 8 | ||||
| -rw-r--r-- | ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua | 33 | ||||
| -rw-r--r-- | ar/.config/lf/lfrc | 32 | ||||
| -rw-r--r-- | ar/.config/sesh/sesh.toml | 2 | ||||
| -rw-r--r-- | ar/.config/shell/aliasrc | 2 |
5 files changed, 59 insertions, 18 deletions
diff --git a/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/snippets.lua b/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/snippets.lua index 96c52a7..aff6f62 100644 --- a/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/snippets.lua +++ b/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/snippets.lua @@ -33,25 +33,25 @@ return { vim.cmd.runtime({ args = { "lua/TheSiahxyz/snippets/*.lua" }, bang = true }) -- load custom snippets - vim.keymap.set({ "i", "x" }, "<A-L>", function() + vim.keymap.set({ "i", "x" }, "<C-L>", function() if ls.expand_or_jumpable() then ls.expand_or_jump() end end, { silent = true, desc = "Expand snippet or jump to the next snippet node" }) - vim.keymap.set({ "i", "x" }, "<A-H>", function() + vim.keymap.set({ "i", "x" }, "<C-H>", function() if ls.jumpable(-1) then ls.jump(-1) end end, { silent = true, desc = "Previous spot in the snippet" }) - vim.keymap.set({ "i", "x" }, "<A-l>", function() + vim.keymap.set({ "i", "s" }, "<C-j>", function() if ls.choice_active() then ls.change_choice(1) end end, { silent = true, desc = "Next snippet choice" }) - vim.keymap.set({ "i", "x" }, "<A-h>", function() + vim.keymap.set({ "i", "s" }, "<C-k>", function() if ls.choice_active() then ls.change_choice(-1) end diff --git a/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua b/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua index 90528a1..4f233d1 100644 --- a/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua +++ b/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua @@ -3,15 +3,47 @@ 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 d = ls.dynamic_node +local sn = ls.snippet_node local fmt = require("luasnip.extras.fmt").fmta +local function bgm_node_generator() + return function() + local handle = io.popen("ssh root@thesiah.xyz 'ls /var/www/thesiah/bgm/' 2>/dev/null") + if not handle then + return sn(nil, { i(1, "bgm") }) + end + + local result = handle:read("*a") + handle:close() + + if not result or result == "" then + return sn(nil, { i(1, "bgm") }) + end + + local choices = {} + for filename in result:gmatch("[^\r\n]+") do + table.insert(choices, t(filename)) + end + + if #choices == 0 then + return sn(nil, { i(1, "bgm") }) + end + + return sn(nil, { c(1, choices) }) + end +end + local diary_snippet = s( "diary", fmt( [[--- title: <title> date: <date> +bgm: <bgm> --- <story> @@ -21,6 +53,7 @@ date: <date> date = f(function() return os.date("%Y-%m-%d") end, {}), + bgm = d(2, bgm_node_generator(), {}), story = i(3), } ) diff --git a/ar/.config/lf/lfrc b/ar/.config/lf/lfrc index 64416d3..becd52c 100644 --- a/ar/.config/lf/lfrc +++ b/ar/.config/lf/lfrc @@ -101,16 +101,24 @@ cmd yank-basename $basename -a -- $fx | head -c-1 | xclip -i -selection clipboar cmd yank-basename-without-extension &basename -a -- $fx | cut -d. -f1 | head -c-1 | xclip -i -selection clipboard # Create -cmd mkdir ${{ clear; tput cup $(($(tput lines)/3)); tput bold - printf "Directory Name: " - read ans - mkdir -p $ans -}} -cmd mkfile ${{ - clear; tput cup $(($(tput lines)/3)); tput bold - printf "File Name: " - read ans - $EDITOR $ans +cmd mkdir %{{ + IFS=" " + file="$*" + mkdir -p -- "$file" + lf -remote "send $id cd \"$(printf '%s' "$file" | sed 's/\\/\\\\/g;s/"/\\"/g')\"" +}} +cmd touch %{{ + IFS=" " + file="$*" + case "$file" in + /*) ;; + *) file="$PWD/$file" ;; + esac + dir="${file%/*}" + [ "$dir" != "$file" ] && mkdir -p -- "$dir" + touch -- "$file" + file="$(printf '%s' "$file" | sed 's/\\/\\\\/g;s/"/\\"/g')" + lf -remote "send $id :select \"$file\"; \$\$EDITOR \"$file\"" }} cmd link %{{ set -- $(cat ~/.local/share/lf/files) @@ -500,8 +508,8 @@ map yt $printf "%s" "$fx" | sed -E 's/^.+\[/https:\/\/www.youtube.com\/watch?v=/ map yy copy # Create -map Md mkdir -map Mf mkfile +map Md push :mkdir<space> +map Mf push :touch<space> map Ml link # Cut diff --git a/ar/.config/sesh/sesh.toml b/ar/.config/sesh/sesh.toml index 349c5ba..77f1b9f 100644 --- a/ar/.config/sesh/sesh.toml +++ b/ar/.config/sesh/sesh.toml @@ -30,7 +30,7 @@ name = "config" path = "~/.config" [[session]] -name = "dotfiles" +name = "_dotfiles" path = "~/.dotfiles" [[session]] 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 |
