terokarvinen / micro-cheat

F1 Show cheatsheet for the language you're editing: Lua, Go, Python...
https://terokarvinen.com/2022/command-palette-cheatsheet-run-and-make-micro/
MIT License
2 stars 1 forks source link

Invalid escape sequence #1

Open Kapelul opened 4 months ago

Kapelul commented 4 months ago

After installing cheat, trying to edit file with micro gives


main line:26(column:33) near '\.':   Invalid escape sequence

Press enter to continue
Ismael-VC commented 2 weeks ago

I am also able to reproduce this:

➜  plug micro -plugin install cheat
Downloading "cheat" (0.0.4) from "https://github.com/terokarvinen/micro-cheat/archive/v0.0.4.zip"
One or more plugins installed.

➜  plug micro
main line:26(column:33) near '\.':   Invalid escape sequence

Press enter to continue

➜  plug micro -version
Version: 2.0.9
Ismael-VC commented 2 weeks ago

This was hot fixed by: https://github.com/terokarvinen/micro-cheat/commit/f0b42a741bae61e528e755fa9960a0cca8804f68

However the packaged version of cheat 0.0.4, that is installed by micro -plugin install cheat is not the same as this repository latest commit.

@terokarvinen: I have found the underlying issue is that you need to escape the regex \, like so "\\.org$" instead of ".org$":

elseif string.find(filename, "\\.org$") then -- not detected by micro

Doing this removes the error message.

Ismael-VC commented 2 weeks ago

Fixed by: https://github.com/terokarvinen/micro-cheat/pull/3