nvim-lualine / lualine.nvim

A blazing fast and easy to configure neovim statusline plugin written in pure lua.
MIT License
5.71k stars 455 forks source link

Feat: More flexible way to disable lualine or enable extensions #1217

Open 9ary opened 3 months ago

9ary commented 3 months ago

Requested feature

Currently lualine can only disable itself (or enable an extension) based on filetype. I'd like to be able to check for other things like variables, or even better, provide a custom filter function.

Motivation

Plugins don't always use their own filetypes for their buffers. For example, undotree uses diff for its diff panel, but it also sets b:isUndotreeBuffer, so those buffers can still be identified easily, but lualine is currently incapable of recognizing this. https://github.com/mbbill/undotree/blob/aa93a7e5890dbbebbc064cd22260721a6db1a196/autoload/undotree.vim#L559-L561

See also airline's extension for this plugin: https://github.com/vim-airline/vim-airline/blob/master/autoload/airline/extensions/undotree.vim It looks for t:undotree instead, but the idea is the same.