diff --git a/vis/.config/vis/fast-jump.lua b/vis/.config/vis/fast-jump.lua index c801c33..a73b588 100644 --- a/vis/.config/vis/fast-jump.lua +++ b/vis/.config/vis/fast-jump.lua @@ -46,12 +46,34 @@ local function merge(a, b) end local function padding() + local l, r, t, n = 0, 0, 0, 0 local opt = vis.win.options - local l = 0 if opt.numbers or opt.relativenumbers then - l = #tostring(vis.win.viewport.lines.finish) + n = #tostring(vis.win.viewport.lines.finish) end - return '0,0,0,' .. l + if vis.ui.layout == vis.ui.layouts.HORIZONTAL then + for win in vis:windows() do + if win == vis.win then + break + end + t = t + win.height + end + elseif vis.ui.layout == vis.ui.layouts.VERTICAL then + local left = true + for win in vis:windows() do + if win == vis.win then + left = false + if opt.wrapcolumn ~= 0 then + r = r + win.width - n - opt.wrapcolumn + end + elseif left then + l = l + win.width + 1 + else + r = r + win.width + end + end + end + return t .. ',' .. r .. ',0,' .. (l + n) end local mu = #up_keys @@ -146,7 +168,7 @@ local function jump(keys) end input = input .. data:sub(k) - local code, out, err = vis:pipe(input, 'fzf --ansi --layout=reverse-list --no-info --no-separator --color gutter:-1 --marker="" --padding ' .. padding() .. ' --print-query --bind change:accept') + local code, out, err = vis:pipe(input, 'fzf --ansi --layout=reverse-list --no-info --no-separator --color gutter:-1 --marker="" --wrap --padding ' .. padding() .. ' --print-query --bind change:accept') if code ~= 0 then vis:info(err or ('fzf exit code ' .. code)) else