diff --git a/.config/kak/autoload/file-utils.kak b/.config/kak/autoload/file-utils.kak index 12068037..19caee69 100644 --- a/.config/kak/autoload/file-utils.kak +++ b/.config/kak/autoload/file-utils.kak @@ -56,5 +56,21 @@ define-command -docstring %{ } } +define-command -docstring %{ + mkdir []: create directory + If no arguments, parents of current file are ensured. + Else, all args passed to mkdir. +} mkdir -params 0.. %{ + evaluate-commands %sh{ + if [ "$#" -eq 0 ]; then + # ensure current file parent + mkdir -p "$(dirname -- "$kak_buffile")" + else + # pass to mkdir + mkdir $@ + fi + } +} + alias global rm remove-file complete-command remove-file file diff --git a/.config/kak/autoload/url.kak b/.config/kak/autoload/url.kak index 3f6e0850..741b6db3 100644 --- a/.config/kak/autoload/url.kak +++ b/.config/kak/autoload/url.kak @@ -9,10 +9,12 @@ provide-module url-open %∴ 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 'sb"ay' - nop %sh{ - eval "$(printf "$kak_opt_url_open_cmd" "$kak_reg_a")" + evaluate-commands %sh{ + # strip trailing punctuation + clean_url="$(echo "$kak_reg_a" | sed 's/[][(){}.,;!?]*$//')" + echo "info -title 'URL Opened' '$clean_url'" + eval "$(printf "$kak_opt_url_open_cmd" "$clean_url")" >/dev/null 2>&1 } - echo "Opened %reg{a}" } catch %{ fail 'Cursor is not on a URL!' } diff --git a/.config/kak/kakrc b/.config/kak/kakrc index 340010c7..8d508b3c 100644 --- a/.config/kak/kakrc +++ b/.config/kak/kakrc @@ -275,4 +275,4 @@ map -docstring 'add selection' global normal Y a # open URL require-module url-open -map -docstring "Open URL" global user ':url-open' +map -docstring "Open URL" global goto u ': url-open'