Closed joske closed 8 months ago
Hi @joske
It looks like issue similar to Stack thread: https://stackoverflow.com/questions/7787509/lua-gsub-special-replacement-producing-invalid-capture-index
Are you able to provide problematic snippet for futher inspection?
Best regards Oskar
Yes, on this file it failed consistently: https://github.com/joske/ripperx4/blob/master/src/musicbrainz.rs
Thanks for reporting, I can reproduce this with the following text:
%20
I'm not sure how to properly escape this.
Error executing vim.schedule lua callback: gen.nvim/lua/gen/init.lua:99: invalid capture index
Hi @David-Kunz
I'm unable to check it right now, but I found that calling content = string.gsub(content, "%%", "%%%%")
before substituting "%$text"
should do the trick. % is escape character for Lua gsub, so i every single '%' should be replaced with double '%%' to prevent it from trying generating any special tokens.
Cheers, Oskar
Thank you, @wishuuu , that works!
The issue is solved with #27 .
Hi,
I tried this plugin on go code, and it worked there, but when I try on some rust code, I get this:
On other rust snippets it did work.