tjdevries / express_line.nvim

WIP: Statusline written in pure lua. Supports co-routines, functions and jobs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set different element active and inactive window

sphynx79 opened this issue · comments

Please can you tell me how i can set different statusline for active and inactive status line,
This is my old status line, and i can see different element in active and inactive statusline
image

Thanks

I think you can check if status line is being drawn for current window in your generator function. TJ will probably know exactly how to do that or if there is better way. Only reason I am saying this is because I draw different status line for various filetypes and I have such conditional in may generator function:

  if ft ~= 'man' and (bufhidden ~= '' or bufhidden == 'wipe' or buftype == 'nofile') then
    return {
      -- 'short' status line here
    }
  end
commented

I found a way to check if the current window is focused or not:

  if win.win_id ~= vim.api.nvim_get_current_win() then
    --- not active
  else
    --- active
  end

the variable win is passed to every segment function by express_line