Commit Graph

25 Commits

Author SHA1 Message Date
Shadman 2f801ed622
Refactor: simplify options (#24)
* 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
2021-09-14 21:14:23 +06:00
shadmansaleh 0e0cf68eba Revert: enahce: sync diff&branch component to buffer based of bufnr instead of BufEnter
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
2021-09-06 18:20:36 +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
shadmansaleh c0f53e4acd Refactor: better handle how default options are applied 2021-09-03 18:04:48 +06:00
shadmansaleh ba1efb2a00 Remove deprecated feature: string color option bering treated as fg 2021-08-30 06:35:06 -07:00
shadmansaleh 1439ba6d37 perf: Improve startup by droping most of the requires + refactors
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.
2021-08-30 17:54:23 +06:00
shadmansaleh 2b90200998 enahce: sync diff&branch component to buffer based of bufnr instead of BufEnter 2021-08-30 12:18:08 +06:00
shadmansaleh 0a032cf43e fix: Properly disable internal diff when source is given 2021-08-30 12:03:07 +06:00
shadmansaleh edb8c344f7 Fix: branch and diff disappearing with diagnostics.goto_next())
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.
2021-08-09 15:11:50 +06:00
shadmansaleh f68d81d351 [Deprection] Enhance: Provide an uniform interface for color options
- 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.
2021-08-09 14:03:12 +06:00
shadmansaleh fac96d71cc [Breaking] Refactor: switch to %{%expr%} from %!expr
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
2021-08-08 22:50:17 +06:00
shadmansaleh cb5c4c031e Refactor: async jobs and diff component
- 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
2021-08-08 14:47:20 +06:00
shadmansaleh ea2432cc1e feat: Add source option to diff
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.
2021-08-03 17:41:37 +06:00
shadmansaleh ac9a9e0a8b fix: Possible fix to diff sometimws not apearing 2021-08-03 12:19:12 +06:00
shadmansaleh 51daaf6f5a fix: Fixes bug diff somtimes doubled 2021-08-03 09:56:07 +06:00
JL Bas 1ee99e0473
enhancement: show diff when component is loaded (#234) 2021-05-13 12:24:51 +02:00
Tim Bedard 96938c5db2
style: Spell fix instence -> instance (#184) 2021-04-20 09:02:21 +06:00
Shadman 4f53d053a1
Refactor: Remove cterm from hlighlight extractor (#174)
- remove cterm color extraction
- fix lint issues
- apply lua-format
2021-04-13 18:36:51 +06:00
Shadman 1b81b0021f
Refactor: Components now use OOP style (#141) 2021-04-11 10:20:41 +02:00
Shadman 7c8ddf307b
refactor: highlight improvements
* Refactor highlight restoring after ColorScheme

Previously custom highlights/ component highlights had to call
expand_set_theme to make them restored . That's unintuative . Now any
highlight created by lualine.highlight.highlight() will be restored :)

* Renamed component -> var_name | Proper BugFix
2021-03-22 15:29:37 +01:00
hoob3rt 0a7f268970 refactor: async.lua -> utils/async.lua 2021-03-18 02:24:44 +01:00
hoob3rt b31b66fa79 refactor: applied lua-format to all files 2021-03-16 00:37:46 +01:00
JINNOUCHI Yasushi e4723362c4
feat: enable to set symbols for diff component (#116)
Changes logic to store diffs in `git_diff` because the original has
stored them in a list:

```
{1, 2, 3} => {added = 1, modified = 2, removed = 3}
```
2021-03-02 01:10:23 +01:00
Shadman ec47bb0447
fix: wrong data displayed by diff component (#117)
Sometimes async process outputs partial data. Previously that data was
processed imediatly causing wrong results. Now the data is processed
after async processes finishes
2021-02-24 18:03:24 +01:00
Shadman f47f68cee6
feat: drop signify dependency (added diff component) (#87) 2021-02-23 13:54:04 +01:00