Some components like hostname, progress are so simple that
the component class setup is just unnecessary boilerplate.
Allowing them to be function simplifies things.
With this you can put your regular component functions in
~/.config/nvim/lua/lualine/components/ folder and treat then as
regular lualine components just like 'mode' or 'branch'.
Hopefully this will help lualine plugins grow.
- includes modified class implementation from https://github.com/rxi/classic/blob/master/classic.lua
- now base component class is created from classic.
- change to how component classes are created.
- Don't overwrite new method to initialize a component.
Overwrite the init method. new is responsible for
creating class object and calling init on it.
Unlike previous new overwrite you don't need to create
the class (table) and return it. Instead you will recive
the object as self and do required manipulation on that
just like any most other oop langs. Also don't need to
return anything from init. init's job is to initialize.
remember to call classes init before running your operations
unfortunately lua isn't full fledged oop lang and I don't
how to automate this.
- changes how super classes are accesed.
- rename Component._parent -> Component.super
- methods on super classes now ran through super class instead
of objects _parent self._parent as that can lead to recursive inf loop.
See branch, diff, tabs, buffer classes call to init for example
on pattern.
- All components updated to reflect current logic
- component loader updated to use new initialization procedure.
- updated tests
- updated BREAKING_CHANGES.md
- plus quite a bit of formatting changes in the components
- comp.method = function(self, ...) -> function M:method(...)
BREAKING_CHANGE
For now use a dummy component to lualine_x on extensions that only define
lualine_a. This will let the renderer know right sections do exist.
closes#73
* feat: Add tabs component ✨✨
* feat: Add buffers component ✨
Now you can have traditional tabline/bufferline directly with lualine.
Special thanks to @kdheepak for making it happen.
Co-authored-by: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com>
- neovim added new diagnostics api in https://github.com/neovim/neovim/pull/15585.
So I've added a new diagnostics source named `nvim` (Yes I couldn't
find a name for it :P) that shows diagnostics from that api.
In neovim nightly with vim.diagnostics you can consider source
`nvim_lsp` obsolete.
- Diagnostics source `vim_lsp` was removed in a mistake now it's
restored.
- Now DiagnosticError, DiagnosticWarn, DiagnosticInfo, DiagnosticHint
are also consider3d for default highlight in diagnostics component.
- Moved getHl from auto theme to utils as extract_color_from_hllist
closes#56
* Deprecate upper & lower option.
These does not make much sense and `format` option can provide same results
* Unify padding options
* Add persistent notices
* Make separators use left/right keys to specify left right instead of
sequence
* Rename format -> fmt
* Rename condition -> cond
* Rename disable_text -> icon_only
* Unify color_error,warning,info,hint under diagnostics_color
* Unify color_added,modified,removed hint under diff_color
functionally reverted commit 2b90200998
nvim gives first scratch buffer(when opened without a file) and the
first opened buffer bufnr 1 . That's why we can't relay completely
on bufnr being different to indicate file is different. So back to
BufEnter autocommands.
closes#38
Important: It's no longer guaranteed that if component/extension
of same name exists in multiple entries in rtp which one will be
loaded. The guarantee is still there for themes . Means other
plugins or users config can overwrite a lualines internal theme
with same file name . I'm droping the guarantee for components
and extensions because there isn't much usecase for it . It's simple
to have a unique name and droping that guarantee allows more
optimizations that speeds up lualine.
Since for left sep at left most location we will not find and prev_hl
We will use 'Normal' for right sep of right most position we will not
find a next_hl we will use 'Normal'.