mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
refactor(options): remove getoption_T
and introduce OptVal
(#23850)
Removes the `getoption_T` struct and also introduces the `OptVal` struct to unify the methods of getting/setting different option value types. This is the first of many PRs to reduce code duplication in the Vim option code as well as to make options easier to maintain. It also increases the flexibility and extensibility of options. Which opens the door for things like Array and Dictionary options.
This commit is contained in:
@@ -910,10 +910,10 @@ Buffer nvim_create_buf(Boolean listed, Boolean scratch, Error *err)
|
||||
if (scratch) {
|
||||
aco_save_T aco;
|
||||
aucmd_prepbuf(&aco, buf);
|
||||
set_option_value("bufhidden", 0L, "hide", OPT_LOCAL);
|
||||
set_option_value("buftype", 0L, "nofile", OPT_LOCAL);
|
||||
set_option_value("swapfile", 0L, NULL, OPT_LOCAL);
|
||||
set_option_value("modeline", 0L, NULL, OPT_LOCAL); // 'nomodeline'
|
||||
set_option_value("bufhidden", STATIC_CSTR_AS_OPTVAL("hide"), OPT_LOCAL);
|
||||
set_option_value("buftype", STATIC_CSTR_AS_OPTVAL("nofile"), OPT_LOCAL);
|
||||
set_option_value("swapfile", BOOLEAN_OPTVAL(false), OPT_LOCAL);
|
||||
set_option_value("modeline", BOOLEAN_OPTVAL(false), OPT_LOCAL); // 'nomodeline'
|
||||
aucmd_restbuf(&aco);
|
||||
}
|
||||
return buf->b_fnum;
|
||||
|
Reference in New Issue
Block a user