Closed ingolemo closed 1 year ago
Option introspection would be nice to have in general. I would like to see the ability to run :set ignorecase
and have the current value printed as an info message. We already have toggle capability via !
for non-visual boolean options like that, but e.g. for ignorecase, without testing a search pattern it is not easy to know what the result of :set ignorecase!
is.
There's a possible issue with a unified api, in that some options are tied to specific windows and other acting globally.
This should be fine, window-specific options can be at vis.win.option
where global options can be vis.option
, etc. Looks like that's already the case, with some other namespaces like file
and ui
as well:
http://martanne.github.io/vis/doc/
I guess we just need to decide where the remaining options should go. Could require some refactoring and new drawing logic if we want to make more things window-local (which can quickly get overcomplicated):
search_direction
-> global optiontabwidth
-> in vim, tabstop
et al. are buffer-local, but that seems weird. Window-local makes more sense to me, but even that might be overkill.expandtab
-> same as tabwidth
.autoindent
-> same as tabwidth
.change_colors
-> vis.ui.change_colors
ignorecase
-> global optionshell
-> global option, read-onlyThat's the most obvious stuff I could see in https://github.com/martanne/vis/blob/master/vis-core.h, although some of the other things may be interesting to expose for some advanced plugins, I suppose.
Plugins should be able to read the values of options from lua somehow. Currently options can be set with
vis:command
, but they cannot be read. I specifically want to be able to readexpandtab
andtabwidth
, but I think a more generic mechanism is needed. It's worth noting that vis already exposes thesyntax
option withvis.syntax
andvis:set_syntax
.There's a possible issue with a unified api, in that some options are tied to specific windows and other acting globally.