Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong directory name in plugin example #3553

Open
matthias314 opened this issue Nov 30, 2024 · 3 comments
Open

wrong directory name in plugin example #3553

matthias314 opened this issue Nov 30, 2024 · 3 comments

Comments

@matthias314
Copy link
Contributor

As far as I can tell, the name of a plugin directory has to match the name of the Lua script: If the script is called myscript.lua, then the directory has to be myscript, not myscript-plugin as indicated in the help file:

```
~/.config/micro/plug/go-plugin/
go.lua
repo.json
help/
go-plugin.md
```

With a wrong directory name the plugin won't work.

@Andriamanitra
Copy link
Contributor

The name doesn't need to match. The problem with the example is that a plugin name must match a regex that does not allow special characters (- in this case):

isID := regexp.MustCompile(`^[_A-Za-z0-9]+$`).MatchString

if !isID(p.Name) || len(p.Srcs) <= 0 {
log.Println(p.Name, "is not a plugin")
continue
}

@Andriamanitra
Copy link
Contributor

The directory name is not a problem for the go-plugin because it has a different (valid) name specified in its repo.json. That makes it a pretty bad choice for an example though, we should update it to something that has a valid directory name too.

@matthias314
Copy link
Contributor Author

matthias314 commented Jan 4, 2025

Yes, that would be good. However, the only plugin in micro-editor/updated-plugins without a hyphenated name is fzf, and that one doesn't have a help directory. Should one take an example from elsewhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants