-
Notifications
You must be signed in to change notification settings - Fork 263
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
Lua API: access and set all available options #1114
Conversation
Note: I mostly made this patch to familize myself more with how the Lua-C I do think that the ability to read the options from Lua is useful and |
I like this. It's much more ergonomic to have a lua api for these settings. Code looks good on quick read as well. |
In that case I can also add the ability to set the options with a table. For example:
It will be a very minor modification. One other thing to note is that I had to rename some options to be valid |
I implemented the ability to set options from a table, for example:
This ended up being slightly more complicated than I originally thought Additionally the options I needed to rename were also changed in While this is a big patch I think its overall a net positive. It will also |
I am afraid this doesn't apply at all on the top of #675. |
Its applied fine in my local testing branch. I think the problem is that |
ff803ec
to
7a01ff3
Compare
The first point of this commit is to allow all options to be read from lua. This has a number of uses for plugin writers. They are grouped into a couple of tables depending on what they control: `vis.options`: table with global configuration `win.options`: table with window specific configuration The second point is to allow you to set all these options as if they were simply lua variables. Technically this is already possible by using `vis:command("set ...")` but personally I think this interface is cleaner. Note that this already possible for some things like the current mode (eg. vis.mode = vis.modes.VISUAL). Examples: `vis.options.ai = true` `win.options.brk = " !?."` `win.options = { showeof = true, showtabs = true } There are a number of related issues and pull requests: closes martanne#803: Lua API: let plugins read the values of options closes martanne#812: Window layout property supersedes/closes martanne#717: Add ability to access tabwidth from Lua supersedes/closes martanne#1066: expose UI layout and allow it to be set from lua API
7a01ff3
to
a35e7ea
Compare
For those that want this behavior in their current version of vis, see https://github.com/milhnl/vis-options-backport |
the first point of this commit is to allow all options to be read from lua. this has a number of uses for plugin writers. they are grouped into a couple of tables depending on what they control:
vis.options
: table with global configurationwin.options
: table with window specific configurationthe second point is to allow you to set all these options as if they were simply lua variables. technically this is already possible by using
vis:command("set ...")
but personally I think this interface is cleaner. Note that this already possible for some things like the current mode (eg. vis.mode = vis.modes.VISUAL). examples:vis.options.ai = true
vis.options.brk = " !?."
there are a number of related issues and pull requests:
closes #803: Lua API: let plugins read the values of options
closes #812: Window layout property
supersedes/closes #717: Add ability to access tabwidth from Lua
supersedes/closes #1066: expose UI layout and allow it to be set from lua API