mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-09 08:50:06 +08:00
fix(tabline): fix Ctrl-Shift-Left/Right
key
This commit is contained in:
parent
bee24ee792
commit
1d68f475f7
@ -241,6 +241,15 @@ end
|
||||
function M.add(bufnr) end
|
||||
|
||||
function M.move_to_previous()
|
||||
local ntp = vim.fn.tabpagenr('$')
|
||||
if ntp > 1 then
|
||||
local ctpn = vim.fn.tabpagenr()
|
||||
local idx = ctpn - 2
|
||||
if idx == -1 then
|
||||
idx = ntp
|
||||
end
|
||||
vim.cmd('tabmove ' .. idx)
|
||||
else
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
|
||||
local idx = index(visiable_bufs, bufnr)
|
||||
@ -254,11 +263,21 @@ function M.move_to_previous()
|
||||
table.insert(right_hide_bufs, 1, table.remove(visiable_bufs, #visiable_bufs))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vim.cmd('redrawtabline')
|
||||
end
|
||||
|
||||
function M.move_to_next()
|
||||
local ntp = vim.fn.tabpagenr('$')
|
||||
if ntp > 1 then
|
||||
local ctpn = vim.fn.tabpagenr()
|
||||
local idx = ctpn + 1
|
||||
if idx > ntp then
|
||||
idx = 0
|
||||
end
|
||||
vim.cmd('tabmove ' .. idx)
|
||||
else
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
|
||||
local idx = index(visiable_bufs, bufnr)
|
||||
@ -272,6 +291,7 @@ function M.move_to_next()
|
||||
table.insert(left_hide_bufs, table.remove(visiable_bufs, 1))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vim.cmd('redrawtabline')
|
||||
end
|
||||
@ -501,6 +521,9 @@ end
|
||||
|
||||
function M.jump(id)
|
||||
if id == 'next' then
|
||||
if vim.fn.tabpagenr('$') > 1 then
|
||||
vim.cmd('tabnext')
|
||||
else
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
|
||||
local idx = index(visiable_bufs, bufnr)
|
||||
@ -516,7 +539,11 @@ function M.jump(id)
|
||||
vim.cmd('b' .. visiable_bufs[1])
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif id == 'prev' then
|
||||
if vim.fn.tabpagenr('$') > 1 then
|
||||
vim.cmd('tabprevious')
|
||||
else
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
|
||||
local idx = index(visiable_bufs, bufnr)
|
||||
@ -532,6 +559,7 @@ function M.jump(id)
|
||||
vim.cmd('b' .. visiable_bufs[#visiable_bufs])
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif #shown_items >= id then
|
||||
if vim.fn.tabpagenr('$') > 1 then
|
||||
vim.cmd('tabnext' .. id)
|
||||
|
Loading…
Reference in New Issue
Block a user