-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Is there a possibility of accessing arguments of a plugin command from the lua plugin? #2906
Comments
The type of For example, I put this in my `init.lua to test:
When I run |
Thanks for the reply @zyedidia ! Actually, it works like a string that's right. But I run into another problem : when I pass no argument to the function, To give more context, I trying to add a functionality to the excellent plugin fzfinder, the possibility of execute fzf in a custom directory passed as an argument. So the code is the following: function fzfinder(bp, args)
-- if args then
bp:CdCmd({args[1]})
... PS: by the way, I think fzfinder, the fzf plugin of @MuratovAS should became the default fzf plugin in the micro plugin-channel repo. The actual fzf plugin listed, https://github.com/samdmarshall/micro-fzf-plugin, is archived since 2019, buggy and lacks many functionalities we added with @MuratovAS, like easy config via options, choose to open in new tab/split, or look in the current folder of the file open and not the root directory of the project. |
You can try using the length operator: |
I am writing a couple of small plugins for micro and for one of them I would like to get user arguments: in the prompt the user would write . I saw than the function creating the plugin details the action as a function containing bp and args. I know how to use bp from the lua plugin to call micro functions, but how to use args?
In lua, when I pass an argument to my plugin function, I saw it if I print
args[1]
, but its type is a userdata, and if I understood well (I don't know a lot of lua...), userdata are pure blocks of raw memory, and we can retrieves data from them, they just point to the C code. So is there a way to retrieve the argument I passed as a string? From micro?Thanks for any clues!
The text was updated successfully, but these errors were encountered: