vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit d6b84bb705ea03298b54cef469c467e30288f777 parent ca63a275923cb7a8a78b66d20b7a7a06d6b6cc37 Author: Marc André Tanner <mat@brain-dump.org> Date: Thu, 17 May 2018 21:50:18 +0200 vis: display count/input queue content in status bar Fix #695 Diffstat:
| M | lua/vis-std.lua | | | 8 | ++++++++ |
| M | vis-lua.c | | | 7 | +++++++ |
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/lua/vis-std.lua b/lua/vis-std.lua @@ -91,6 +91,14 @@ vis.events.subscribe(vis.events.WIN_STATUS, function(win) table.insert(left_parts, (file.name or '[No Name]') .. (file.modified and ' [+]' or '') .. (vis.recording and ' @' or '')) + local count = vis.count + local keys = vis.input_queue + if keys ~= '' then + table.insert(right_parts, keys) + elseif count then + table.insert(right_parts, count) + end + if #win.selections > 1 then table.insert(right_parts, selection.number..'/'..#win.selections) end diff --git a/vis-lua.c b/vis-lua.c @@ -79,6 +79,13 @@ static void window_status_update(Vis *vis, Win *win) { vis_macro_recording(vis) ? " @": ""); left_count++; + int count = vis_count_get(vis); + const char *keys = buffer_content0(&vis->input_queue); + if (keys && keys[0]) + snprintf(right_parts[right_count++], sizeof(right_parts[0]), "%s", keys); + else if (count != VIS_COUNT_UNKNOWN) + snprintf(right_parts[right_count++], sizeof(right_parts[0]), "%d", count); + int sel_count = view_selections_count(view); if (sel_count > 1) { Selection *s = view_selections_primary_get(view);