tjdevries / express_line.nvim

WIP: Statusline written in pure lua. Supports co-routines, functions and jobs.
MIT License
293 stars 19 forks source link

Set different element active and inactive window #56

Open sphynx79 opened 2 years ago

sphynx79 commented 2 years ago

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

gegoune commented 2 years ago

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
smartding commented 2 years ago

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