feat(options): default statusline expression #33036

Problem:
Default 'statusline' is implemented in C and not representable as
a statusline expression. This makes it hard for user configs/plugins to
extend it.

Solution:
- Change the default 'statusline' slightly to a statusline expression.
- Remove the C implementation.
This commit is contained in:
Shadman
2025-04-22 04:05:34 +06:00
committed by GitHub
parent ab72799841
commit 28e31f5d3d
23 changed files with 167 additions and 151 deletions

View File

@@ -1792,6 +1792,16 @@ static const char *did_set_statustabline_rulerformat(optset_T *args, bool rulerf
}
const char *errmsg = NULL;
char *s = *varp;
// reset statusline to default when setting global option and empty string is being set
if (args->os_idx == kOptStatusline
&& ((args->os_flags & OPT_GLOBAL) || !(args->os_flags & OPT_LOCAL))
&& s[0] == NUL) {
xfree(*varp);
*varp = xstrdup(get_option_default(args->os_idx, args->os_flags).data.string.data);
s = *varp;
}
if (rulerformat && *s == '%') {
// set ru_wid if 'ruf' starts with "%99("
if (*++s == '-') { // ignore a '-'