diff --git a/.config/kak/autoload/surround.kak b/.config/kak/autoload/surround.kak index 49e939a6..61d7ee1c 100644 --- a/.config/kak/autoload/surround.kak +++ b/.config/kak/autoload/surround.kak @@ -10,7 +10,7 @@ define-command -override surround-add-pair -params 2 %{ } # command surrounds with any arbitrary character -define-command -override surround-add -params 1 %{ +define-command -override -hidden surround-add-key -params 1 %{ evaluate-commands -draft -save-regs '"' %{ set-register '"' %arg{1} execute-keys -draft P @@ -18,11 +18,24 @@ define-command -override surround-add -params 1 %{ } } +define-command surround-add %{ + info -title surround "Enter character to add" + on-key %{ + nop %sh{ + if [ "$kak_key" != "" ]; then + printf '%s' 'surround-add-key %val{key}' + fi + } + + } +} + define-command -hidden surround-delete-key -params 1 %{ execute-keys -draft "%arg{1}ia" } define-command surround-delete %{ + info -title surround "Enter character to delete" on-key %{ surround-delete-key %val{key} } @@ -41,6 +54,7 @@ define-command -hidden surround-replace-sub -params 1 %{ } define-command surround-replace %{ + info -title surround "Enter character to replace" on-key %{ surround-replace-sub %val{key} } @@ -52,12 +66,13 @@ map global surround-add [ ':surround-add-pair [ ]' -docstring 'su map global surround-add ] ':surround-add-pair [ ]' -docstring 'surround with brackets' map global surround-add { ':surround-add-pair { }' -docstring 'surround with braces' map global surround-add } ':surround-add-pair { }' -docstring 'surround with braces' -map global surround-add < ':surround-add-pair "<" ">"' -docstring 'surround with angles' -map global surround-add > ':surround-add-pair < >' -docstring 'surround with angles' +map global surround-add < ':surround-add-pair ' -docstring 'surround with angles' +map global surround-add > ':surround-add-pair ' -docstring 'surround with angles' map global surround-add "'" ":surround-add-pair ""'"" ""'""" -docstring 'surround with quotes' map global surround-add '"' ":surround-add-pair '""' '""'" -docstring 'surround with double quotes' map global surround-add * ':surround-add-pair * *' -docstring 'surround with asteriks' map global surround-add _ ':surround-add-pair _ _' -docstring 'surround with undescores' +map global surround-add s ':surround-add' -docstring 'surround custom character' map -docstring 'surround' global normal k ': enter-user-mode surround' map -docstring 'add surrounding' global surround s ': enter-user-mode surround-add'