Closed greenfork closed 1 year ago
Looks like this commit https://github.com/mawww/kakoune/commit/e49c0fb04095a2a1c546fd033ce2a1a6df3eb8d0 is responsible for this error. The version just before this commit works fine.
typing the opening (
adds this mapping
map -docstring 'insert a new indented line in pair' window insert <ret> '<a-;>: insert-new-line-in-pair<ret>'
which unmaps itself.
(insert-new-line-in-pair
triggers a hook that unmaps <ret>
).
We could allow the unmap to proceed. I don't see anything obviously wrong with the script.
I suppose it will be fixed in the kakoune then. Just in case, still the same error on the latest master.
if it's easy to rewrite the script to not rely on this behavior, we might want to keep the error.
This patch fixes your reproducer although there is a remaining issue when typing ())
diff --git a/rc/auto-pairs.kak b/rc/auto-pairs.kak
index 8583a56..fa932ac 100644
--- a/rc/auto-pairs.kak
+++ b/rc/auto-pairs.kak
@@ -103,20 +103,16 @@ define-command -override -hidden handle-inserted-opening-pair -params 2 %{
map -docstring 'insert a new indented line in pair' window insert <ret> '<a-;>: insert-new-line-in-pair<ret>'
map -docstring 'prompt a count for new indented lines in pair' window insert <c-ret> '<a-;>: prompt-insert-new-line-in-pair<ret>'
+ hook -group auto-pairs -once window InsertChar %exp{\Q%arg{2}} %exp{
+ unmap window insert %arg{2} # TODO quote
+ }
+
# Enter is only available on next key.
hook -group auto-pairs -once window InsertChar '.*' %{
unmap window insert <ret>
unmap window insert <c-ret>
}
- # Clean insert mappings and remove hooks
- hook -group auto-pairs -once window WinSetOption 'inserted_pairs=0' "
- unmap window insert %%🐈%arg{2}🐈
- unmap window insert <ret>
- unmap window insert <c-ret>
- remove-hooks window auto-pairs
- "
-
# Clean state when moving or leaving insert mode
hook -group auto-pairs -once window InsertMove '.*' %{
reset-inserted-pairs-count
this is fixed latest Kakoune master
I can confirm, thanks!
On the latest kakoune master this key sequence from the new line
(<enter>s
throws these errorsI checked it with clear
kak -n
only sourcing this plugin.Any workaround that comes to mind?