&sw = 1
var old_sw = &sw
echo exists('&newopt')
echo getcompletion('', 'option') # this might be capped though, at least 
for other completions it is
for opt in getcompletion('', 'option')
    echo opt
endfor
for opt in getcompletion('', 'option')
    if !empty(opt)
       exe "set " .. opt .. "?"
    endif
endfor



And there is also buffer local options, are you about to have 2 
dictionaries?

понедельник, 24 января 2022 г. в 09:38:27 UTC+3, [email protected]: 

> Hi all,
>
> Currently Vim options can be accessed from a Vim script by prefixing the
> option name with a '&':
>
> let &shiftwidth = 2
> let oldval = &shiftwidth
>
> The Python Vim interface supports a dictionary for accessing the Vim 
> options
> https://vimhelp.org/if_pyth.txt.html#python-options
>
> The Lua Vim interface in Neovim support this:
> https://github.com/neovim/neovim/blob/master/runtime/doc/lua.txt#L1022
>
> But this is currently not supported by Vim script.
>
> What do you think about adding support for a v:vim.opt dictionary to
> read/modify Vim options:
>
> let v:vim.opt.shiftwidth = 2
> let oldval = v:vim.opt.shiftwidth
> echo has_key(v:vim.opt, 'newopt')
> echo keys(v:vim.opt)
> echo items(v:vim.opt)
>
> The changes to support this are available at:
>
> https://github.com/yegappan/vim/commit/52beff56044e93c7bb982243ff593b461cd649c2
>
> Regards,
> Yegappan
>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/54bce5d3-beeb-44ed-9125-e5db49587c1an%40googlegroups.com.

Raspunde prin e-mail lui