AutoYADM commit: 2025-07-07 18:57:36

This commit is contained in:
Daniel Fichtinger 2025-07-07 18:57:36 -04:00
parent fef01ae393
commit 661b206717

View file

@ -7,16 +7,23 @@ provide-module url-open %∴
} url-open %{ } url-open %{
evaluate-commands -save-regs 'ab' %{ evaluate-commands -save-regs 'ab' %{
set-register b 'https?://(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)' set-register b 'https?://(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)'
try %{
try %{ try %{
execute-keys -draft '<a-a><a-w>s<c-r>b<ret>"ay' execute-keys -draft '<a-a><a-w>s<c-r>b<ret>"ay'
} catch %{
fail 'No URL found!'
}
evaluate-commands %sh{ evaluate-commands %sh{
# strip trailing punctuation # strip trailing punctuation
clean_url="$(echo "$kak_reg_a" | sed 's/[][(){}.,;!?]*$//')" clean_url="$(echo "$kak_reg_a" | sed 's/[][(){}.,;!?]*$//')"
if eval "$(printf "$kak_opt_url_open_cmd" "$clean_url")" >/dev/null 2>&1; then
echo "info -title 'URL Opened' '$clean_url'" echo "info -title 'URL Opened' '$clean_url'"
eval "$(printf "$kak_opt_url_open_cmd" "$clean_url")" >/dev/null 2>&1 else
echo "fail 'url_open_cmd failed!'"
fi
} }
} catch %{ } catch %{
fail 'Cursor is not on a URL!' info -title 'URL Open' "Couldn't open URL: %val{error}"
} }
} }
} }