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>