mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-13 17:40:25 +00:00
detect current by index
This commit is contained in:
parent
fef97d4439
commit
91666776ff
@ -32,20 +32,21 @@ end
|
||||
|
||||
function M.setup(opts)
|
||||
function _G.tabline()
|
||||
local original_tabs = require('harpoon').get_mark_config().marks
|
||||
local tabs = shorten_filenames(original_tabs)
|
||||
local tabs = shorten_filenames(require('harpoon').get_mark_config().marks)
|
||||
local tabline = ''
|
||||
|
||||
for i, tab in ipairs(original_tabs) do
|
||||
local is_current = string.match(vim.fn.bufname(), tab.filename) or vim.fn.bufname() == tab.filename
|
||||
local index = require('harpoon.mark').get_index_of(vim.fn.bufname())
|
||||
|
||||
for i, tab in ipairs(tabs) do
|
||||
local is_current = i == index
|
||||
|
||||
local label
|
||||
|
||||
if tabs[i].filename == "" or tabs[i].filename == "(empty)" then
|
||||
if tab.filename == "" or tab.filename == "(empty)" then
|
||||
label = "(empty)"
|
||||
is_current = false
|
||||
else
|
||||
label = tabs[i].filename
|
||||
label = tab.filename
|
||||
end
|
||||
|
||||
|
||||
@ -58,6 +59,7 @@ function M.setup(opts)
|
||||
end
|
||||
|
||||
tabline = tabline .. label .. (opts.tabline_suffix or ' ') .. '%*'
|
||||
|
||||
if i < #tabs then
|
||||
tabline = tabline .. '%T'
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user