feature: add symbol in tab when there are not saved changes on file.
Closed this issue · 1 comments
sergiornelas commented
Hello, would be amazing if the user has an edited non-saved file, then shows a symbol in the respective tab and window.
Thanks.
sergiornelas commented
Checking the docs, that requested feature is available.
In order to implement this (just for reference):
local modified_symbol = "[x]"
local function buf_modified(buf)
if vim.bo[buf].modified then
return modified_symbol
else
return ""
end
end
local function tab_modified(tab)
local wins = require("tabby.module.api").get_tab_wins(tab)
for _, x in pairs(wins) do
if vim.bo[vim.api.nvim_win_get_buf(x)].modified then
return modified_symbol
end
end
return ""
end
-- ...
line.wins_in_tab(line.api.get_current_tab()).foreach(function(win)
return {
-- ...
buf_modified(win.buf().id),
-- ...
}
end),
-- ...
line.tabs().foreach(function(tab)
return {
-- ...
tab_modified(tab.id),
-- ...
}
end),