Skip to content

Global variables for configuring plugin didn't work #6

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

Merged
merged 1 commit into from
May 14, 2023

Conversation

lnc3l0t
Copy link
Contributor

@lnc3l0t lnc3l0t commented May 14, 2023

This PR fixes an issue with pcall and nvim_get_var that caused the global variables for configuring the plugin to not work properly. The original code used a table with 2 strings in the pcall call, but nvim_get_var expected only a single string not a table (:h nvim_get_var).

If a table is passed as the second argument to pcall, its items are not treated as single argument to pass to multiple function calls. (though that would be cool)

pcall({f}, {arg1}, {...})                                       *luaref-pcall()*
        Calls function {f} with the given arguments in `protected mode`.

To fix this issue, I modified the code to read the 2 global variables (gist_is_private and gist_clipboard) in 2 separate calls to nvim_get_var.

I have tested this change on my local machine and verified that it works as expected.

nvim_get_var expected one string instead of a table, I converted the reading of the 2 global variables in 2 separate calls.
@rawnly
Copy link
Owner

rawnly commented May 14, 2023

Thank you very much! Appreciated

@rawnly rawnly merged commit af4714a into rawnly:main May 14, 2023
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

Successfully merging this pull request may close these issues.

2 participants