From b4957f567fa27fdbe772b555af37ab3cb33dea76 Mon Sep 17 00:00:00 2001 From: lnc3l0t Date: Fri, 12 May 2023 19:22:06 +0200 Subject: [PATCH] fix: unable to read global variables nvim_get_var expected one string instead of a table, I converted the reading of the 2 global variables in 2 separate calls. --- lua/gist/core/gh.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/gist/core/gh.lua b/lua/gist/core/gh.lua index 06d2a99..f362659 100644 --- a/lua/gist/core/gh.lua +++ b/lua/gist/core/gh.lua @@ -44,14 +44,14 @@ end -- -- @return table A table with the configuration properties function M.read_config() - local ok, values = pcall(vim.api.nvim_get_var, { "gist_is_private", "gist_clipboard" }) - - local is_private = ok and values[1] or false - local clipboard = ok and values[2] or "+" + local ok_private, private = pcall(vim.api.nvim_get_var, "gist_is_private") + local is_private = ok_private and private or false + local ok_clipboard, clipboard = pcall(vim.api.nvim_get_var, "gist_clipboard") + local clipboard_reg = ok_clipboard and clipboard or "+" local config = { is_private = is_private, - clipboard = clipboard, + clipboard = clipboard_reg, } return config