Problem with auto-pairs

I have used auto-pairs for some time and mostly I like it. Especially the surround function to insert e.g. parenthesis around the selection.

Anyhow, every now and then (and usually quite quickly now), when I press ‘(’ in insert mode, I get

( ))))

and when using the surround function, the result may look like

(surrounded area))))

Does anybody here have a fix to this or know what this is about?

What is your version of Kakoune?

I’m using Kakoune v2019.07.01 and plug.kak plugin manager to get the latest versions from github (today I just updated all plugins to make sure they are the latest)

How to replicate:
Without any shortcuts, start editor, enable auto-pairs
Go to some line and apply surroundings once. Go to the end of that line. Add ‘(’. It will add the ‘)’ in to the beginning of next line.
Now, if I apply surroundings, it will look like (word)).

Actually, it looks like the second auto-pairs-surrounding is enough to see this behavior. (No need to do other actions in there.)

The plugin conforms to the new ModeChange signature (October 2019).

Thanks, this probably means that either I’ll have to compile or wait NixOs to provide newer one. Nixos probably will give it during 20-03, hopefully. (Several months but not too many.)

I use this on Nix:

git clone
cd kakoune
nix-shell --packages pkg-config ncurses --run '
  cd src
  make -j 8
  strip -s kak

Cool! And thanks! I have made some shell.nix / default.nix files for this and my workflow has been clumsy, but that one could actually work well enough. I’ll give it a try.

Got it compiled and auto-pairs works. Sadly, it looks like some other plugins won’t work with that new ModeChange signature, yet.

It’s a quick fix, you can open an issue or send a PR.

Wrapping in a kak-update script has been a good workflow to me.

Thanks & thanks for the kak-update script.

About the possible issue: I think that this is really hard problem as it involves kakoune-the-editor and its version and several different plugins and their versions and the plugin manager and its version. It would be really cool if the plugins used also tags or some other way to tell to the plugin manager, on what kakoune version they work. And the plugin manager could then also query for correct version from git if the plugin has several versions available… ok, time to wake up :slight_smile:

plug.kak usually supports latest stable release and development branch. I’ve decided not to support older versions of Kakoune because if done by branches, I have to backport many features using older methods, which I don’t remember, and because modules are thing now I would have to have separate code for versions that don’t have modules.

Some of my other plugins usually have tags for versions, but those don’t support specific Kakoune version, and are just plugin versions, though if you use old Kakoune build you might check out to older version of plugin, yet this may mean that some new features of the plugin will not be available.

plug.kak has ability to checkout to specific version/branch/tag, but doesn’t detect anything by itself. This is too smart to do. I think I could provide stable switch, that will look for latest tag and checkout to it before loading plugin, though this is not what you want.