itchyny/lightline.vim

How do I ignore certain filetypes?

fent opened this issue · 2 comments

fent commented

I'd like to not have lightline enabled on terminal buffers? I didn't see anything looking through the docs. Can this be configured?

This is not supported in this plugin by design. However, for terminal buffers, you can use the TerminalWinOpen event to override the local statusline (autocmd TerminalWinOpen * setlocal statusline=). I don't recommend this way though.

fent commented

That works initially, but when switching between splits, the lightline statusline is restored. I also with the FocusGained, FocusLost events, and setting a timeout. But it still didn't work :/

          vim.api.nvim_create_autocmd({ "FocusGained", "FocusLost" }, {
            buffer = term.bufnr,
            callback = function()
              vim.defer_fn(function()
                vim.api.nvim_buf_call(term.bufnr, function()
                  vim.opt_local.statusline = "my new statusline here"
                end)
              end, 50)
            end,
          })