AutoYADM commit: 2025-07-07 14:48:57

This commit is contained in:
Daniel Fichtinger 2025-07-07 14:48:57 -04:00
parent 013cce597b
commit 9e52556703
2 changed files with 23 additions and 8 deletions

View file

@ -1,10 +1,21 @@
define-command -override url-open %{
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()@:%_\+.~#?&//=]*)'
execute-keys -draft '<a-a><a-w>s<c-r>b<ret>"ay'
nop %sh{
xdg-open "$kak_reg_a"
provide-module url-open %∴
declare-option -docstring %{
Command for opening URLs.
} str url_open_cmd 'xdg-open %s'
define-command -docstring %{
Open the URL the cursor is on with url_open_cmd.
} url-open %{
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()@:%_\+.~#?&//=]*)'
try %{
execute-keys -draft '<a-a><a-w>s<c-r>b<ret>"ay'
nop %sh{
eval "$(printf "$kak_opt_url_open_cmd" "$kak_reg_a")"
}
echo "Opened %reg{a}"
} catch %{
fail 'Cursor is not on a URL!'
}
}
echo %reg{a}
}
}

View file

@ -159,6 +159,10 @@ hook global WinCreate .* %{
search-highlight-enable
}
# open URL
require-module url-open
map -docstring "URL" global goto U ':url-open<ret>'
# convenience mappings
# quitting & saving
map -docstring "quit" global user q ": q<ret>"