Skip to content

Commit

Permalink
vis: display count/input queue content in status bar
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed May 17, 2018
1 parent 50b49e6 commit 9cbe218
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lua/vis-std.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions vis-lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9cbe218

Please sign in to comment.