From a89205c26b27df955dd9866fb37e04acd1ebb66e Mon Sep 17 00:00:00 2001 From: Alexei Robyn Date: Mon, 19 Apr 2021 23:30:33 +1000 Subject: [PATCH] apps/neovim: Hacky workaround for statusline bug vim/vim#3898 --- apps/neovim/extraConfig.moon | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/neovim/extraConfig.moon b/apps/neovim/extraConfig.moon index e77283e..fe1e808 100644 --- a/apps/neovim/extraConfig.moon +++ b/apps/neovim/extraConfig.moon @@ -196,7 +196,7 @@ map "", "", syntax_debug_map, {} -- }}} -- Status line setup {{{ -export setup_status_line, status_line, status_widget_functions, is_active_statusline +export setup_status_line, status_line, status_widget_functions, is_active_statusline, prefix_fixer status_widget_functions = {} is_active_statusline = (statusline_winid) -> @@ -225,6 +225,14 @@ setup_status_line = (widget_groups, base_highlights, highlights) -> widget_group_strs = {} + -- Hacky workaround for vim/vim#3898 + prefix_fixer = (fn_idx, statusline_winid) -> + widget_str = status_widget_functions[fn_idx](statusline_winid) + if (widget_str\sub 1, 1) == " " + " " .. widget_str + else + widget_str + for group_idx, widget_group in ipairs widget_groups widget_group_strs[group_idx] = {} for {:widget, :callable} in *widget_group @@ -232,7 +240,7 @@ setup_status_line = (widget_groups, base_highlights, highlights) -> output = if callable fn_idx = #status_widget_functions + 1 status_widget_functions[fn_idx] = widget - "%%{luaeval('status_widget_functions[#{fn_idx}](%i)')}" + "%%{luaeval('prefix_fixer(#{fn_idx}, %i)')}" else widget table.insert widget_group_strs[group_idx], {:callable, widget_str: output}