* 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>
- 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.
- 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`
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
* 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.
String values for component are way too overloaded . This means lualine
has to make lots of checks to understand how to load a string value
as a component . With type option users can specify exactly what they
want.
Solution: Using poll-watch instead of event-watch on windows.
Additionally now gitdir paths are cached as optimization
Special thanks to @Shatur for raising the issue and for testing patches.
closes#2
I've added a workaround to re sync those components when they
go out of sync . Until upstream issue is addressed this should
prevent this issue from occurring in lualine.
- Now all color related options and themes color definition have same
semantics. They can either be a table containing values like bg,fg,gui
or a string. When it's a string it's treated as a highlight group name
and newly created group is linked to that group.
- Using string values to define foreground colors in options like
color_error/color_added in diagnostics and diff component has been
deprecated.
- Added a decent way of notifying affected users of deprecations and
breaking changes.
Huge change to internal mechanics.
- Now %{%expr%} blocks are used for evaluating statusline instead of
%!expr . Pros for this is statusline is evaluated on current win and
buf context instead of active win & bufs context.
- Now all components branch & diff(These two are cached) including users
function components updates on inactive status.
- now components update status and function components receive an
argument (is_focused) when called. It indicates whether it's running
for active or inactive statusline.
- Now lualine no longer aggrasively takes over 'statusline' option.
instead it sets the global version of statusline option. So it's
possible to unset it to hide lualine . Or set buffer local version
of that option to have different statusline then lualine on thay
buffer
- Switch vim.o to vim.go or vim.opt.
- BugFix autcommands being set everytime an instence of diff or branch
component is created
- Added new utils functions define_autocmd & is_focused
- Remove utils function lualine_eval
- Removed hacky require cache modification from component.lua
- Use neovims job api instead of uv.spawn (Probably a bit less
performent but should be more stable)
- Fix async jobs leaking pipes
- Fix wrong diff counts .Used to occur because job might not be dead
after closing it . And that still alive job may send data over stdout
corrupting the cache.
- lots of variable renames in diff.
- utils/async.lua has been replaced by utils/job.lua
It allows you to easily integrate external source for diff count.
If user has some other plugin keeping track of diff counts. There's
no reason for lualine to make same calculations again . It can just
reuse them. But lualine knows nothing about how other plugin exposes
their api so user will have to glue them together with this option.
* refactor: moved loading to new module
* refactor: check_single_separator
* refactor: simplified separator fixing
* refactor: tests/ -> lua/tests/
* refactor: moved to nvim_err_writeln for errors
* feat: moved config parsing to config.lua
* feat: get config directly from config module
* feat: added load_all function
* tests: config parsing tests
* added assert to luacheck globals