diff --git a/doc/lualine.txt b/doc/lualine.txt index 0bcfe5e..b1a26e5 100644 --- a/doc/lualine.txt +++ b/doc/lualine.txt @@ -465,6 +465,11 @@ General component options These are options that control behavior -- padding = { left = left_padding, right = right_padding } fmt = nil, -- Format function, formats the component's output. + -- This function receives two arguments: + -- - string that is going to be displayed and + -- that can be changed, enhanced and etc. + -- - context object with information you might + -- need. E.g. tabnr if used with tabs. on_click = nil, -- takes a function that is called when component is clicked with mouse. -- the function receives several arguments -- - number of clicks incase of multiple clicks @@ -673,6 +678,16 @@ Component specific options These are options that are available on active = 'lualine_{section}_normal', -- Color for active tab. inactive = 'lualine_{section}_inactive', -- Color for inactive tab. }, + + fmt = function(name, context) + -- Show + if buffer is modified in tab + local buflist = vim.fn.tabpagebuflist(context.tabnr) + local winnr = vim.fn.tabpagewinnr(context.tabnr) + local bufnr = buflist[winnr] + local mod = vim.fn.getbufvar(bufnr, '&mod') + + return name .. (mod == 1 and ' +' or '') + end } } }