diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-08-04 21:26:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-04 21:26:53 +0100 |
commit | 6fa17da39b270bf230764859a9537124b18d3ed5 (patch) | |
tree | 5b92ade39c691fd1c36fcfd9fb9eef49d8cf5870 /src/nvim/generators/gen_options.lua | |
parent | cc87dda31a5b5637ade7ddcfe5199f2df5fd47df (diff) | |
download | rneovim-6fa17da39b270bf230764859a9537124b18d3ed5.tar.gz rneovim-6fa17da39b270bf230764859a9537124b18d3ed5.tar.bz2 rneovim-6fa17da39b270bf230764859a9537124b18d3ed5.zip |
docs(options): take ownership of options.txt (#24528)
* docs(options): take ownership of options.txt
- `src/nvim/options.lua` is now the source of truth
- generate runtime/lua/vim/_meta/options.lua
* fixup! zeer comments
* fixup! zeer comments (2)
* fixup! re-enable luacheck
* fixup! regen
Diffstat (limited to 'src/nvim/generators/gen_options.lua')
-rw-r--r-- | src/nvim/generators/gen_options.lua | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/nvim/generators/gen_options.lua b/src/nvim/generators/gen_options.lua index 03b1fbec8a..cb6f9b6af9 100644 --- a/src/nvim/generators/gen_options.lua +++ b/src/nvim/generators/gen_options.lua @@ -1,6 +1,6 @@ local options_file = arg[1] -local opt_fd = io.open(options_file, 'w') +local opt_fd = assert(io.open(options_file, 'w')) local w = function(s) if s:match('^ %.') then @@ -10,6 +10,7 @@ local w = function(s) end end +--- @module 'nvim.options' local options = require('options') local cstr = options.cstr @@ -38,7 +39,10 @@ local list_flags={ flagscomma='P_COMMA|P_FLAGLIST', } -local get_flags = function(o) +--- @param o vim.option_meta +--- @return string +local function get_flags(o) + --- @type string[] local ret = {type_flags[o.type]} local add_flag = function(f) ret[1] = ret[1] .. '|' .. f @@ -81,8 +85,10 @@ local get_flags = function(o) return ret[1] end -local get_cond -get_cond = function(c, base_string) +--- @param c string|string[] +--- @param base_string? string +--- @return string +local function get_cond(c, base_string) local cond_string = base_string or '#if ' if type(c) == 'table' then cond_string = cond_string .. get_cond(c[1], '') @@ -118,9 +124,12 @@ local get_defaults = function(d,n) return get_value(d) end +--- @type {[1]:string,[2]:string}[] local defines = {} -local dump_option = function(i, o) +--- @param i integer +--- @param o vim.option_meta +local function dump_option(i, o) w(' [' .. ('%u'):format(i - 1) .. ']={') w(' .fullname=' .. cstr(o.full_name)) if o.abbreviation then |