AutoYADM commit: 2025-05-21 16:14:39
This commit is contained in:
parent
6e302b83e0
commit
3dba6d45c5
2 changed files with 46 additions and 24 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
provide-module surround %~
|
||||||
declare-user-mode surround
|
declare-user-mode surround
|
||||||
declare-user-mode surround-add
|
declare-user-mode surround-add
|
||||||
define-command -override surround-add-pair -params 2 %{
|
define-command -override surround-add-pair -params 2 %{
|
||||||
|
@ -21,12 +22,13 @@ define-command -override -hidden surround-add-key -params 1 %{
|
||||||
define-command surround-add %{
|
define-command surround-add %{
|
||||||
info -title surround "Enter character to add"
|
info -title surround "Enter character to add"
|
||||||
on-key %{
|
on-key %{
|
||||||
nop %sh{
|
eval %sh{
|
||||||
if [ "$kak_key" != "<esc>" ]; then
|
if [ "$kak_key" != "<esc>" ]; then
|
||||||
printf '%s' 'surround-add-key %val{key}'
|
printf '%s' 'surround-add-key %val{key}'
|
||||||
|
else
|
||||||
|
printf '%s' 'info -title surround "Canceled"'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,44 +39,64 @@ define-command -hidden surround-delete-key -params 1 %{
|
||||||
define-command surround-delete %{
|
define-command surround-delete %{
|
||||||
info -title surround "Enter character to delete"
|
info -title surround "Enter character to delete"
|
||||||
on-key %{
|
on-key %{
|
||||||
surround-delete-key %val{key}
|
eval %sh{
|
||||||
|
if [ "$kak_key" != "<esc>" ]; then
|
||||||
|
printf '%s' 'surround-delete-key %val{key}'
|
||||||
|
else
|
||||||
|
printf '%s' 'info -title surround "Canceled"'
|
||||||
|
fi
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command -hidden surround-replace-sub -params 1 %{
|
define-command -hidden surround-replace-sub -params 1 %{
|
||||||
|
info -title surround "Enter character to replace with"
|
||||||
on-key %{
|
on-key %{
|
||||||
evaluate-commands -no-hooks -draft %{
|
eval %sh{
|
||||||
execute-keys "<a-a>%arg{1}"
|
if [ "$kak_key" != "<esc>" ]; then
|
||||||
enter-user-mode surround-add
|
printf '%s' 'evaluate-commands -no-hooks -draft %{
|
||||||
execute-keys %val{key}
|
execute-keys "<a-a>%arg{1}"
|
||||||
|
enter-user-mode surround-add
|
||||||
|
execute-keys %val{key}
|
||||||
|
}
|
||||||
|
surround-delete-key %arg{1}
|
||||||
|
execute-keys H'
|
||||||
|
else
|
||||||
|
printf '%s' 'info -title surround "Canceled"'
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
surround-delete-key %arg{1}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command surround-replace %{
|
define-command surround-replace %{
|
||||||
info -title surround "Enter character to replace"
|
info -title surround "Enter character to replace"
|
||||||
on-key %{
|
on-key %{
|
||||||
surround-replace-sub %val{key}
|
eval %sh{
|
||||||
|
if [ "$kak_key" != "<esc>" ]; then
|
||||||
|
printf '%s' 'surround-replace-sub %val{key}'
|
||||||
|
else
|
||||||
|
printf '%s' 'info -title surround "Canceled"'
|
||||||
|
fi
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
map global surround-add ( ':surround-add-pair ( )<ret>' -docstring 'surround with parenthesis'
|
map global surround-add ( ':surround-add-pair ( )<ret>' -docstring 'surround with parenthesis'
|
||||||
map global surround-add ) ':surround-add-pair ( )<ret>' -docstring 'surround with parenthesis'
|
map global surround-add ) ':surround-add-pair ( )<ret>' -docstring 'surround with parenthesis'
|
||||||
map global surround-add [ ':surround-add-pair [ ]<ret>' -docstring 'surround with brackets'
|
map global surround-add [ ':surround-add-pair [ ]<ret>' -docstring 'surround with brackets'
|
||||||
map global surround-add ] ':surround-add-pair [ ]<ret>' -docstring 'surround with brackets'
|
map global surround-add ] ':surround-add-pair [ ]<ret>' -docstring 'surround with brackets'
|
||||||
map global surround-add { ':surround-add-pair { }<ret>' -docstring 'surround with braces'
|
map global surround-add { ':surround-add-pair { }<ret>' -docstring 'surround with braces'
|
||||||
map global surround-add } ':surround-add-pair { }<ret>' -docstring 'surround with braces'
|
map global surround-add } ':surround-add-pair { }<ret>' -docstring 'surround with braces'
|
||||||
map global surround-add < ':surround-add-pair <lt> <gt><ret>' -docstring 'surround with angles'
|
map global surround-add < ':surround-add-pair <lt> <gt><ret>' -docstring 'surround with angles'
|
||||||
map global surround-add > ':surround-add-pair <lt> <gt><ret>' -docstring 'surround with angles'
|
map global surround-add > ':surround-add-pair <lt> <gt><ret>' -docstring 'surround with angles'
|
||||||
map global surround-add "'" ":surround-add-pair ""'"" ""'""<ret>" -docstring 'surround with quotes'
|
map global surround-add "'" ":surround-add-pair ""'"" ""'""<ret>" -docstring 'surround with quotes'
|
||||||
map global surround-add '"' ":surround-add-pair '""' '""'<ret>" -docstring 'surround with double quotes'
|
map global surround-add '"' ":surround-add-pair '""' '""'<ret>" -docstring 'surround with double quotes'
|
||||||
map global surround-add * ':surround-add-pair * *<ret>' -docstring 'surround with asteriks'
|
map global surround-add * ':surround-add-pair * *<ret>' -docstring 'surround with asteriks'
|
||||||
map global surround-add _ ':surround-add-pair _ _<ret>' -docstring 'surround with undescores'
|
map global surround-add _ ':surround-add-pair _ _<ret>' -docstring 'surround with undescores'
|
||||||
map global surround-add s ':surround-add<ret>' -docstring 'surround custom character'
|
map global surround-add s ':surround-add<ret>' -docstring 'surround custom character'
|
||||||
|
|
||||||
map -docstring 'surround' global normal k ': enter-user-mode surround<ret>'
|
map -docstring 'surround' global normal k ': enter-user-mode surround<ret>'
|
||||||
map -docstring 'add surrounding' global surround s ': enter-user-mode surround-add<ret>'
|
map -docstring 'add surrounding' global surround s ': enter-user-mode surround-add<ret>'
|
||||||
map -docstring 'delete surrounding' global surround d ':surround-delete<ret>'
|
map -docstring 'delete surrounding' global surround d ':surround-delete<ret>'
|
||||||
map -docstring 'replace surrounding' global surround r ':surround-replace<ret>'
|
map -docstring 'replace surrounding' global surround r ':surround-replace<ret>'
|
||||||
|
~
|
||||||
|
|
|
@ -4,6 +4,7 @@ colorscheme ashen
|
||||||
# colorscheme one-dark
|
# colorscheme one-dark
|
||||||
# colorscheme mocha
|
# colorscheme mocha
|
||||||
require-module fishr
|
require-module fishr
|
||||||
|
require-module surround
|
||||||
|
|
||||||
try %{
|
try %{
|
||||||
set-option global ashen_dynamic_cursor true
|
set-option global ashen_dynamic_cursor true
|
||||||
|
@ -117,4 +118,3 @@ map -docstring %{
|
||||||
pick line in buffer
|
pick line in buffer
|
||||||
} global peneira '/' ': peneira-lines<ret>'
|
} global peneira '/' ': peneira-lines<ret>'
|
||||||
|
|
||||||
# source "%val{config}/autoload/surround.kak"
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue