mirror of
https://github.com/ThePrimeagen/harpoon
synced 2024-09-16 13:34:03 +02:00
detect current by index
This commit is contained in:
parent
fef97d4439
commit
91666776ff
1 changed files with 8 additions and 6 deletions
|
@ -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…
Reference in a new issue