express_line.nvim icon indicating copy to clipboard operation
express_line.nvim copied to clipboard

Set different element active and inactive window

Open sphynx79 opened this issue 4 years ago • 2 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

sphynx79 avatar Sep 28 '21 12:09 sphynx79

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

gegoune avatar Sep 28 '21 12:09 gegoune

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

smartding avatar Feb 04 '22 01:02 smartding