* feat(diagnostics): add padding when using different background colors
When each "sub-section" of the diagnostics components have a different background the rendering is off when
multiple more than one of them is shown.
* chore: fix typo and spelling
* enhance: add statusline test module
* update old tests to use statusline test setup
* show diff in statusline:expect
* Revert "show diff in statusline:expect"
This reverts commit cea25185fde1b99110759f198ef1fc724626306c.
* autoformat
* fix testcov reports
* update statusline test module
* revert lualine_spec
* update lualine_spec using statusline module
* apply formater
* add tabline support to statusline test module
* re enable tabline tests
* fix inconsistency in buffers mode test due to bufnr changing
Should we be showing bufnr/buffer_position in buffers component
* autoformat
* minor tweeks to stl test module
* use nvim_eval_statusline in nvim-0.6+
* fix tabs component on nvim-0.5
* enable disabled branch test
* feat: allow functions in color options.
* update_evilline
* docs: document color functions
* remove unnecesery stuff
* add dynamic color supoort for themes
* chore: autogen (vimdocs+formating)
* fix dynamic colors not working as color fallback
* fix transitional separators not updating for dynamic colors dynamic colors
* fix failing tests
* apply format
* Allow cases where theme doesn't even define nornal color for some mode
* allow color function to return nil
* some enhancements
* more enhancements
* code cleanup
* if we don't have even normal in theme we should just nvim highlight it with it's ususal stl colors
* not sure how it get here . It should be in different pr
* keep only c of lualine_c in component section name
* use sh to run docgen
* fix filetype component not respecting color option properly
* fix section x,y,z not falling back to correct colors
* auto format
* actually fix xyz not falling back to correct mode
* fix comp sep not correctly removed properly on function hl
* pass only section in color fn
* more enhancements
* update docs
* update create_comp_hl call locations
* enhancements+fixes
* fix broken hls in tabline
* Fix function color options not inheriting right colors
* some enhancements
* fix tests
* tweek docs
Co-authored-by: shadmansaleh <shadmansaleh@users.noreply.github.com>
* (feat) add rename
* remove tabname if LualineRenameTab is ran without args
* document LualineRenameTab
Co-authored-by: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com>
* fix: lualine crashing because of keyboard interrupt.
If keyboard interrupt occurs while lualine is evaluating statusline
lualine crashes completely. Since keyboard interrupt isn't something
we can handle try to mitigate the issue by retrying to evaluate the
statusline on error.Now lualine will retry 3 times before giving
up on an runtime error.
* Make last retry unprotected call
- Now `nvim_lsp` source shows diagnostics generated by vim.lsp only
avoids uses vim.diagnostic to avoid deprecation warning on nvim 0.6+
Why? `vim.lsp.diagnostic` deprecation warnings are way too aggressive.
And I'm annoyed by people complaining here even though the warning is
generated by some other plugin (After introduction of nvim_diagnostic
source lualine just can't produce that warning it used to switch users
to nvim_diagnostic source with a warning on nvim0.6+).
Forget it just let anyone that wants lsp specific diagnostics have
`nvim_lsp` . I'd still recommend using `nvim_diagnostic` over
`nvim_lsp` as diagnostics generayed by plugins like `null-ls` won't
showup in `nvim_lsp`
- Remove remanents of `nvim` diagnostics source.
* Schedule a redraw of tabline when setting tabline
The tabline isn't drawn until scrolling the window or opening another file. Opening multiple files at once (e.g. nvim a.txt b.txt) will only show the first.
By performing a deferred redraw of the tabline this fixes this startup behaviour problem.
* Changed to use vim.schedule
- change default diagnostics source from nvim_lsp to nvim_diagnostic
and deprecate nvim_lsp on neovim-0.6 and higher.
- rename diagnostics source nvim to nvim_diagnostic. nvim could be
confusing.
fixes#473
Previously these options were applied to entire tabs/buffers components.
Now they are applied to specific buffer/tab.
Note: Now icon, color options are no longer applicable to buffers & tabs
component. I can't see how they make sense here. Also cond stil applies
to entire component.
fixes#414
* enhance(filetype): filetype option precede extension for icon detection
Enhances icon detection for files without extension e.g. shebang or
modeline by using filetype option before the extension.
* fixup(filetype): filetype option as fallback of file extension
Some file icon keys defined by [nvim-web-devicons][1] using file
extension name instead of filetype option.
There's been an [issue][2] about this but no PR for it yet, so I think
for now we can handle it here.
[1]: https://github.com/kyazdani42/nvim-web-devicons
[2]: https://github.com/kyazdani42/nvim-web-devicons/issues/29
* refactor(filetype): `vim.api.nvim_buf_get_option` -> `vim.bo`
* Add fern extension
Fern[^1] is general purpose tree view that can browse and manipulate
file trees. This extension provides a simple and useful statusline for
fern buffers.
[^1]: https://github.com/lambdalisue/fern.vim
* Reuse nerdtree code for fern
* doc: mention fern in README
Co-authored-by: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com>
Currently, lualine gets the encoding using this:
[[%{strlen(&fenc)?&fenc:&enc}]] My suggestion is to change this string
to `vim.opt.fileencoding:get()` This suggestion is because I would like
to use the option "fmt = string.upper", and with the current string it
doesn't work, but using vim.opt function correctly
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'.
Since for left sep at left most location we will not find and prev_hl
We will use the next hl after component similarly for right sep of right most position
we will not find a next_hl we will use previous hl before component
It is too expensive to check if ale is installed or not when ale is not
instaled . It is not that expensive when is is installed. So anyone
useing ale can just add ale to sources option in their config.