Changing config after starting luapad instance?
fhill2 opened this issue · 2 comments
Hey @rafcamlet. Thank you for this plugin, it has saved me a lot of time.
Regarding the new v2 API, are we able to change the settings for the current luapad instance after it has been started with require('luapad').attach({})
or require('luapad/evaluator'):new{}:start()
??
The only way I've been able to change config values for eval_on_change
, eval_on_move
is at nvim startup with:
require 'luapad'.config{ eval_on_move = true }
Unless I'm missing something?
Hi! I'm glad you like it! :)
Currently, the settings are global, but in the next big update (hopefully) I will change that to global defaults and isolated settings for each instance.
You can change them at any time by calling this configuration function again, or you can even put it in luapad buffer! There is also undocumented global luapad
helper in every luapad buffer. Just put luapad.config { eval_on_move = true }
in it (the helper isn't finished yet, but config should work fine).
Does it cover your question?
Yes it does indeed, the global helper also works to change config too.
I must have been doing something else in my init.lua to make the default behaviour not work, as what you have described above is working with a clean init.lua:
Both of these can be called before or after luapad instances have been started, and both successfully change the global config settings:
require'luapad/helper' { eval_on_move = true }
require'luapad' { eval_on_move = true }
Great to know it works for both. Thank you for clarification.