8000 mini.nvim/lua/mini/jump2d.lua at main · CKolkey/mini.nvim · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
944 lines (824 loc) · 35 KB

jump2d.lua

File metadata and controls

944 lines (824 loc) · 35 KB
if wins_pos[a].zindex < wins_pos[b].zindex then return true end
if wins_pos[a].zindex > wins_pos[b].zindex then return false end
if wins_pos[a].col < wins_pos[b].col then return true end
if wins_pos[a].col > wins_pos[b].col then return false end
return wins_pos[a].row < wins_pos[b].row
end)
return wins
end
H.map = function(mode, key, rhs, opts)
if key == '' then return end
opts = vim.tbl_deep_extend('force', { noremap = true, silent = true }, opts or {})
-- Use mapping description only in Neovim>=0.7
if vim.fn.has('nvim-0.7') == 0 then opts.desc = nil end
vim.api.nvim_set_keymap(mode, key, rhs, opts)
end
H.merge_unique = function(tbl_1, tbl_2)
if not (type(tbl_1) == 'table' and type(tbl_2) == 'table') then return end
local n_1, n_2 = #tbl_1, #tbl_2
local res, i, j = {}, 1, 1
local to_add
while i <= n_1 and j <= n_2 do
if tbl_1[i] < tbl_2[j] then
to_add = tbl_1[i]
i = i + 1
else
to_add = tbl_2[j]
j = j + 1
end
if res[#res] ~= to_add then table.insert(res, to_add) end
end
while i <= n_1 do
to_add = tbl_1[i]
if res[#res] ~= to_add then table.insert(res, to_add) end
i = i + 1
end
while j <= n_2 do
to_add = tbl_2[j]
if res[#res] ~= to_add then table.insert(res, to_add) end
j = j + 1
end
return res
end
return MiniJump2d
0