Commit Graph

9 Commits

Author SHA1 Message Date
shadmansaleh 9433dbb762 enhance: use virtual column(%v) for location and line no (%p) for progress
closes #90
2021-10-22 09:45:26 +06:00
shadmansaleh c8750a35e0 enhance: allow components to be functions too (#81)
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.
2021-10-11 16:41:25 +06:00
shadmansaleh 61ac665774 refactor: separate the child creation and initialization (#81)
- 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
2021-10-11 16:41:19 +06:00
github-actions[bot] db448f41e6
chore: formated with stylua (#32)
Apply initial stylua format

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-09-04 00:28:20 +06:00
Shadman 1b81b0021f
Refactor: Components now use OOP style (#141) 2021-04-11 10:20:41 +02:00
hoob3rt b31b66fa79 refactor: applied lua-format to all files 2021-03-16 00:37:46 +01:00
Hubert Pelczarski 55c0f0fe9a docs: added license to all source files 2021-02-13 01:03:57 +01:00
hoob3rt 39dc034335 updated style to be inline with vim.api 2021-01-04 02:14:29 +01:00
hoob3rt fa6aa3c324 initial lualine setup 2020-12-30 15:48:51 +01:00