Commit Graph

414 Commits

Author SHA1 Message Date
shadmansaleh 8d8c538fb9 fixup: fix update_in_insert caching colors in diagnostics
- mention colored option in docs
- sort component option list alphabeticaly

close #402
2021-10-26 14:37:50 +06:00
Mark Story 61cd6e6ef8
feat: add fern extension (#398)
* 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>
2021-10-26 09:21:38 +06:00
André Augusto e917677a3a enhance: change method of getting file encoding
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
2021-10-22 21:18:27 +06:00
shadmansaleh 71f6fed3c3 chore: update readme 2021-10-22 19:10:33 +06:00
Mat Jones e909cc3caf feat: add option to always show diagnostics
* rename option and add to default config

* combine separate if statements using else if
2021-10-22 18:07:34 +06:00
shadmansaleh ad4f4ff751 chore: repo transfer to nvim-lualine 2021-10-22 10:57:04 +06:00
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
Dheepak Krishnamurthy b9e06deb33
fixup: fix missing `self` (#84) 2021-10-13 07:17:24 +06:00
Shadman 08d1340ec9
doc: improve code documentation (#82) 2021-10-12 20:04:47 +06:00
Charly Delay babc57c62b
fixup: fix diff component default colors (#83)
Rationalizes the default colors used by the `diff` component.  These colors are based of the original fork (https://github.com/hoob3rt/lualine.nvim/blob/master/lua/lualine/components/diff.lua#L17-L21), but the assignment differs (so that added defaults to green, modified defaults to orange, and removed defaults to red).
2021-10-12 11:37:32 +06:00
shadmansaleh 6b9e9352be refactor: split diff component (#81) 2021-10-11 19:07:38 +06:00
shadmansaleh cc64ec3f7c refactor: split branch component (#81) 2021-10-11 19:07:38 +06:00
shadmansaleh 0b599b0ace refactor: split diagnostics component (#81) 2021-10-11 17:43:49 +06:00
shadmansaleh 1e2b735aee chore: remove deprecation notices and deprecated options from #24
+ fix tests
2021-10-11 17:10:24 +06:00
shadmansaleh d25a37fea0 refactor: rename component type luae and vimf
- rename luae -> lua_expr
- rename vimf -> vim_fun
luae & vimf were too vague and hand to understand.

BREAKING_CHANGE
2021-10-11 17:09:07 +06:00
shadmansaleh 6e936efe06 refactor: allow components, extensions, themes to be multi file module
(#81)

utilize that to split tabs & buffers components into smaller files
2021-10-11 16:42:57 +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
zeertzjq a564019d95
feat: add support for mode nt (#79)
Following https://github.com/neovim/neovim/pull/15878
2021-10-10 08:43:50 +06:00
shadmansaleh 9bf5ecc2bb fixup: fix bugs in tabs component
- fix options nil error upon deleting and creating tab
- fix only single tab being rendered after deleting and recreating tabs
2021-10-08 20:30:05 +06:00
shadmansaleh 98b43ba3a1 fix: left sections taking over entire stl when xyz is absent
- now %= applied even when x,y,z is absent
- newly added always_divide_middle option cal be set to false to avood %=
2021-10-08 04:46:38 +06:00
shadmansaleh 6faaa05ae5 Revert "fix(extension): fix some extension showing a section in whole line"
This reverts commit 846e5bdabf.
2021-10-08 03:57:05 +06:00
zeertzjq 90e1dc074f
feat: add support for modes Rvc and Rvx (#75)
Following https://github.com/neovim/neovim/pull/15886
2021-10-04 07:36:20 +06:00
shadmansaleh b7c0a2aeb1 fix: handle nil error in diff component
closes #74
2021-10-02 15:08:33 +06:00
shadmansaleh 846e5bdabf fix(extension): fix some extension showing a section in whole line
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
2021-10-01 19:54:57 +06:00
github-actions[bot] 4353afd1de
chore: formated with stylua (#69)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-09-27 18:06:25 +06:00
CantoroMC 05d6a13369
enhance: improved notices.show_notices (#70)
- Prefer use of lua functions instead of vim.cmd
 - Added buffer and window options
 - Moved from append to appendbufline
2021-09-27 18:04:54 +06:00
shadmansaleh 20a87ac78c fix: typo + make notice buffer not modifiable
closes #68
2021-09-27 14:44:44 +06:00
shadmansaleh 69b5351147 enhance: use a smaller icon for modified buffer in buffers component 2021-09-26 06:22:26 +06:00
Glenn Waters 5785d4b47f
enhance: use table to map mode to hl group (#67)
I believe a hash is more efficient than a multiple comparison if. The code is also drier, no replication of the concatenation line of code.
2021-09-26 06:15:22 +06:00
shadmansaleh ceec01bc6c enhance: set default diagnostics source to nvim-lsp & coc
doc: update docs for options.
2021-09-21 12:30:19 +06:00
shadmansaleh cdc574c9b0 fix: nil error with Alpha on buffers component 2021-09-20 21:47:57 +06:00
shadmansaleh 904f9df637 refactor: replace rtp_searcher with nvim_get_runtime_file (#65) 2021-09-20 20:35:14 +06:00
Dheepak Krishnamurthy 4ca1a8fd00
Add buffers and tabs component (#42)
* 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>
2021-09-20 19:11:41 +06:00
shadmansaleh 9f556fdf37 chore: add license statements and update benchmarks 2021-09-20 17:48:22 +06:00
zeertzjq fa3f8c33ca
feat: add support for modes vs, Vs, CTRL-Vs (#62) 2021-09-20 09:57:41 +06:00
shadmansaleh 260133ce63 fix: wrong highlights on inactive mode with last commit 2021-09-19 12:20:07 +06:00
shadmansaleh 7147989f5f enhance: color middle of left and right statusline with lualine_c color even when section c and x are absent 2021-09-19 11:52:42 +06:00
shadmansaleh c5cb601a6a feat(diagnostics): Add support for nvims diagnostic API
- 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.
2021-09-17 18:50:32 +06:00
shadmansaleh f7702d8841 enhance: check for new diagnostics highlight groups
- 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
2021-09-17 15:28:30 +06:00
shadmansaleh b76c410dba fixup: fixes issues in diagnostics component
- typo diagnostic_color -> diagnostics_color
- typo hin -> hint
- warning -> warn since that's what's used everywhere
- change default diagnostics colors slightly

fixes #55
2021-09-17 15:27:57 +06:00
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
Matthew Toohey 1f4df948c4
fix: handle capitalized letters in pywal colors (#40)
Co-authored-by: mtoohey31 <mtoohey31@users.noreply.github.com>
2021-09-09 05:25:31 +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] a26ffaa8ed
chore: formated with stylua (#36)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-09-04 23:18:50 +06:00
Matthew Toohey 7185c61e9e
feat: pywal theme (#35)
* feat: pywal theme
* docs: add pywal screenshots

Co-authored-by: mtoohey31 <mtoohey31@users.noreply.github.com>
2021-09-04 23:17: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 4042e837f8
chore: use stylua for formating
* Switch to stylua for formating

* Change lua-format ignore to stylua ignore.

* Add workflow for formating with stylua
2021-09-04 00:20:34 +06:00
shadmansaleh b2fcf50742 enhance: Reload lualine for ColorScheme so auto can self update 2021-09-03 20:16:54 +06:00
shadmansaleh a643a24d94 enhance: improve function component
- provide self as 1st argument
- handle error in function call
- convert the result to string by default
2021-09-03 18:19:00 +06:00
shadmansaleh c0f53e4acd Refactor: better handle how default options are applied 2021-09-03 18:04:48 +06:00
shadmansaleh b3c5c4403c feat: add new filesize component 2021-09-03 16:16:10 +06:00
shadmansaleh 8b4f70817c Refactor: Rename lualine_conifg.lua -> lualine/config.lua
This is loaded by lualine require so the peroformence will not be effected.
2021-09-03 15:59:00 +06:00
shadmansaleh e409e9fc32 Enhace: add a faster fallback for lualine_require for requiring files out of repo
If that fails it still falls back to original require a last resort
2021-08-30 23:58:23 +06:00
shadmansaleh 70d925ab17 Perf: More optimizations 2021-08-30 20:52:49 +06:00
shadmansaleh ba1efb2a00 Remove deprecated feature: string color option bering treated as fg 2021-08-30 06:35:06 -07:00
shadmansaleh 85545bd192 Perf: move the files loaded at startup to &rtp/lua require is faster
renamed:    lualine/init.lua -> lualine.lua
renamed:    lualine/config.lua -> lualine_config.lua
2021-08-30 19:02:01 +06:00
shadmansaleh b0da16addd enhance:Don't load notice module when there are no notices 2021-08-30 19:02:01 +06:00
shadmansaleh 1afc45294a refactor: rename cterm_color.lua -> color_utils.lua 2021-08-30 19:02:01 +06: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 114a840a41 enhace: Allow transitional hl to be applied at begining and end of stl
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'.
2021-08-30 09:45:42 +06:00
shadmansaleh 649b7dd652 Skip right sep when %<left_sep is righr after it(lualine_b->c) 2021-08-30 09:41:26 +06:00
shadmansaleh 9be79955b8 Revert "enhace: Allow transitional hl to be applied at beginung and end of stl"
This reverts commit bae19db8d0.
2021-08-30 09:37:50 +06:00
shadmansaleh bae19db8d0 enhace: Allow transitional hl to be applied at beginung and end of stl
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
2021-08-29 17:59:13 +06:00
Ashish Panigrahi 09169739fa added powerline-dark theme
* added replace colorscheme

 * updated screenshots

 * added patched font screenshots
2021-08-28 23:29:51 +06:00
shadmansaleh 6c9330d240 Enhance: Truncate from section c this way a&b won't disapear when stl becomes wide 2021-08-28 01:06:19 +06:00
shadmansaleh 276ba5d19e feat: Support indexing dictionaries in var components 2021-08-28 00:32:44 +06:00
shadmansaleh 2348eaea2f enhace: Use nvim_call_function instead of vim.fn so vim.fn does not get populated 2021-08-28 00:13:50 +06:00
shadmansaleh 1c57d7e61c chore: update extensions to have empty section_c so transitional separators can work
closes #23
2021-08-27 01:02:32 +06:00
shadmansaleh cfb6e3db14 perf: remove ale diagnostics source from default config
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.
2021-08-27 01:02:20 +06:00
shadmansaleh d4f83afa7f Enhance: extract helper functions from apply_trans_sep() 2021-08-27 00:46:29 +06:00
shadmansaleh dd9e1b7bf0 fix: Section seperator disapearing when x section is empty
closes #22
2021-08-26 20:29:25 +06:00
shadmansaleh c9b5f364dc Fix various visual bugs in components transitional sep 2021-08-26 18:20:16 +06:00
shadmansaleh f728edd31d fix: odd situation of section separators with ayz/abz section configured 2021-08-26 18:20:16 +06:00
shadmansaleh 1c57497863 refactor: Improve section separators
- behaviour change now statusline won't be separated with %=
  if you don't have at lest one of lualine_x/y/z
- fixed some bugs
- simplified the transitional separators quite a bit. I think now
  it's understandable . Yay .
- Perf improvements too.
2021-08-26 18:20:16 +06:00
shadmansaleh fa1f001207 fix: branch assumes git file will be correctly formated 2021-08-26 17:09:18 +06:00
shadmansaleh 1cbf0686b4 fix: branch incorrectly assumes .git/ without .git/HEAD to be valid
fixes high cpu uses on windows in projects with empty .git folder.
2021-08-26 17:09:18 +06:00
Daniel Enrique 8648ee6d06 Add toggleterm extension.
Add # symbol.
2021-08-26 07:00:42 +06:00
shadmansaleh c5bd65d05b chore: Add focused arg to statusline function (To make debugging easier) 2021-08-22 14:06:46 +06:00
shadmansaleh c9c5e3f9d1 feat: Add type option to hint what type of component is the string
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.
2021-08-22 13:54:05 +06:00
Shadman be83cb947e
Merge pull request #14 from bluz71/moonfly-theme
feat: Add moonfly theme
2021-08-20 10:51:40 +06:00
shadmansaleh 15dcaababd fix: Add '-' to valid filename chars 2021-08-20 10:34:31 +06:00
Dennis B 7b7fe983f8 Add moonfly theme 2021-08-20 14:15:31 +10:00
shadmansaleh 6c99ba6ba7 Fix string component containging ['{] taking long to load 2021-08-20 09:54:18 +06:00
shadmansaleh 849d6acc66 feat: Allow (neo)vim's statusline items to be used as component directly 2021-08-20 08:15:57 +06:00
shadmansaleh 895fda9b91 fix: component highlight fall backs failing
Color/theme created with `highlight_group_name` are handled with link.
Because of that we don't have a table on bg/fg instead a name .
Currently component highlights doesn't take this into account.

After colors from those groups will be extracted to provide fall backs
for component highlight.
2021-08-20 01:40:14 +06:00
shadmansaleh bdc3073d31 fix: Partially process config when setup is called
Otherwise successive calls to setups before redraw are ignored.

closes #12
2021-08-17 13:26:44 +06:00
shadmansaleh fcb61280f2 config: Add diff and diagnostics components to default config 2021-08-17 00:30:33 +06:00
shadmansaleh 33defeffb5 feat: Allow function as diagnostics source 2021-08-17 00:17:56 +06:00
shadmansaleh 0126ac0cc0 perf: lazy load modules and dalay config loading till status redraw
This should make require'lualine' less expensive and make lualine
have less impact in startuptime
2021-08-16 23:40:27 +06:00
shadmansaleh d360039969 fix(filename): include window_width to space estimation & expose
shorting_target option

setting shorting target to 0 disables path shorting
closes #8

Co-authored-by: NullVoxPopuli <LPSego3+dev@gmail.com>
2021-08-14 21:24:48 +06:00
shadmansaleh ee5c56e911 enhance: Allow external sources to overwrite components and extensions
this is like the themes now . If some component/extension found in
both lualine repo and in some other rtp path then the one outside
the repo will be loaded.
+ Added better error handling for extensions.
2021-08-14 20:31:08 +06:00
shadmansaleh 32727039a9 |DEPRECATION| enhance(themes): Auto colorscheme detection and more
- `auto` theme now auto loads available theme for colorschme based on
  g:color_name . If that fails then it generates a theme for that
  colorschme like before.
- Theme from external source is preferred over bundled version in
  lualine . This means if user has a colorschme that provided the same
  theme as lualine the one from colorschme will be loaded.
- Default value of theme is changed to `auto` from `gruvbox`.
- Now when users theme from config fails lualine will fallbavk to
  `auto`. If `auto` fails then lualine will fallback to `gruvbox`
- Some themes have been renamed to their actual name (g:color_name).
  older names have been deprecated. [DEPRECATION]
    oceanicnext -> OceanicNext
    papercolor -> PaperColor
    tomorrow -> Tomorrow
    gruvbox_material -> gruvbox-material
    modus_vivendi -> modus-vivendi
- A few more adaptive themes added (aye, gruvbox, iceberg)
- Updated THEMES.md to reflect changes in theme name
2021-08-14 12:35:08 +06:00
shadmansaleh 967ddcb5ca fix: Reloading config causing extesions to disaprear 2021-08-13 07:29:28 +06:00
shadmansaleh fcb88aebba Fix: quickfix extention not apearing 2021-08-13 07:20:56 +06:00
shadmansaleh 0f3ad7e248 fix: Branch stuck in infinite loop in windows
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
2021-08-09 22:44:38 +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 d541574028 chore: fix lint error 2021-08-08 23:50:44 +06:00
shadmansaleh 1816bc8622 [Breaking] Refactor: Removed viml like g:lualine styled config
This was deprecated for a while .
2021-08-08 23:44:07 +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 66b0736fd4 fix: left section separator not displayed when component begins with a custom highlight 2021-08-05 21:44:22 +06:00
shadmansaleh 65464f7849 fix: component highlights fg defaulting to bg 2021-08-05 21:38:09 +06:00
shadmansaleh 0ad7145127 feat: reload lualine after bacground is set. So themes can adapt 2021-08-04 08:37:35 +06:00
shadmansaleh 46a86a9cca Fix: typo 2021-08-04 08:28:53 +06:00
shadmansaleh 6aecf4a341 feat: Expose current config with lualine.get_config() 2021-08-04 07:13:37 +06:00
alexfertel 7b98680316 fix: Typos 2021-08-03 18:03:26 +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 e7b8b42089 Fix: Branch not working on directory with whilespace 2021-08-03 15:28:05 +06:00
shadmansaleh ac9a9e0a8b fix: Possible fix to diff sometimws not apearing 2021-08-03 12:19:12 +06:00
shadmansaleh 62b53c854c feat: Allow extensions to spwcify inactive sections too 2021-08-03 12:08:17 +06:00
shadmansaleh 51daaf6f5a fix: Fixes bug diff somtimes doubled 2021-08-03 09:56:07 +06:00
shadmansaleh 486be4462f Remove new_async():send() pattern + restructure augroup
This does not load load lualine asyncronasly rather fools the profilers
In addition causes issues like intro disapearing
2021-08-02 21:16:17 +06:00
shadmansaleh 7a45a4f7fe feat: Add support for useing color_name like red and cterm values to set colors in lualine 2021-08-02 20:25:34 +06:00
shadmansaleh 74d23fbd0c Reload theme when setting it up so auto can pick up changes in coloracheme 2021-08-02 12:48:23 +06:00
shadmansaleh 6d153dac1f |BEAKING_CHNAGE| Fix :lualine disapearing on reload + Allow live updates
Breaking Change: Now subsequent call to lualine.setup modifies old setup
instead of configuring from scratch
2021-08-02 12:40:11 +06:00
J. Bromley f1dbb2f4a8 Fixed using 'auto' theme with default colorscheme.
When setting theme to 'auto' and using the default colorscheme, lualine
would report "theme not found, defaulting to gruvbox". Fixed by checking
that we get an actual color back when calling utils.extract_highlight_colors
before attempting to apply a brightness modifier.

* Fix brightness_modifier application.

The brightness_modifer() should only be applied when a normal color was
found.

* Apply brightness modifier when normal color not nil.

Moved application of brightness_modifier outside the if statement that
negates the brightness modifier. The modifier will now be applied when
get_color_brightness returns < 0.5.
2021-07-29 22:47:07 +06:00
shadmansaleh e544b47895 Load lualine after session load
closes #309
2021-07-27 13:25:10 +06:00
shadmansaleh f7c44efb6f Proritize color option then theme when creating comppnent_hl
closes #299
2021-07-27 13:18:25 +06:00
shadmansaleh 87b060f390 Fix create_component_highlight overwritting older highlight with same hl_tag
This is necessary so color option from inactive and active sections do not conflict
2021-07-27 12:57:51 +06:00
shadmansaleh f60bec0969 feat: Add update_in_insert option to diagnostics component 2021-07-25 13:48:50 +06:00
shadmansaleh c57cb43c4d feat:Add component evaluation for inactive sections 2021-07-25 12:52:52 +06:00
shadmansaleh 438ab4e468 Feat: Allow transitional separators to be set on component basis 2021-07-25 12:41:07 +06:00
shadmansaleh 1d40e34aef Refactor: filetype icon and add disable_text option 2021-07-25 12:39:20 +06:00
Tim Bedard 2aaf434094
feat: add separate hint diagnostic (#241)
* add separate hint diagnostic

* change to lightbulb icon
2021-05-25 22:13:43 +02:00
shadmansaleh d7f3168a55 Small tweek 2021-05-21 11:30:32 +06:00
shadmansaleh d8a2a640e0 refactor statusline() function 2021-05-21 11:25:14 +06:00
shadmansaleh f480db58fb Allow transitional separator to be set as component option 2021-05-21 11:25:13 +06:00
shadmansaleh a560209c24 Refractor filetype and add disable_text option 2021-05-21 11:23:09 +06:00
shadmansaleh 46eed19a11 Use %{%eval%} blocks 2021-05-21 11:14:54 +06:00
shadmansaleh ef47235330 Add component evaluation for inactive sections 2021-05-21 11:11:25 +06:00
John Hunter 0411f1c830
feat: horizon theme (#253)
* Added Horizon theme

* Tweaked a colour

* another tweak and updated readme with screenshots.

* Added copyright and luaformatter. Corrected THEMES.md

* fixed lint error
2021-05-21 00:07:27 +02:00
Alejandro Sanchez 2f0f1fc49d
feat: quickfix/locationlist extension(#248) 2021-05-19 22:36:55 +02:00
Duc Pham 8b2b825043
feat: gruvbox light theme (#250) 2021-05-19 12:57:57 +02:00
Hubert Pelczarski 3702e682ac
refactor: remove filename warning (#228) 2021-05-18 17:13:13 +02:00
hubert 9d9ee2d60e feat: user defined extensions 2021-05-14 20:24:54 +02:00
Hubert Pelczarski 354b76ed1a
perf: prevent rehashing in themes for slight performance increase (#244) 2021-05-14 02:09:34 +02:00
Hubert Pelczarski 292609e3ad
docs: vimscript removal prep (#243) 2021-05-13 23:19:11 +02:00
Shadman 634959f0e9
feat: allow x,y,z sections to be themed independently (#238)
If theme for x,y,z is unspecified the defaukt to c,b,a respectively
2021-05-13 18:39:30 +02:00
JL Bas 1ee99e0473
enhancement: show diff when component is loaded (#234) 2021-05-13 12:24:51 +02:00
Shadman 33aaabe672
Fix filename error message (#237) 2021-05-12 15:27:37 +06:00
Hubert Pelczarski f644841206
fix: extensions not loading properly (#232)
* refactor: removed inactive sections from extensions

* fix: extensions not loading properly
2021-05-11 21:40:54 +02:00
Hubert Pelczarski 31de50919a
feat: quickfix extension (#229)
* feat: quickfix extension
2021-05-11 21:22:58 +02:00
Jonathan Gin bfae320155
feat: color filetype icons when using nvim-devicons (#222) 2021-05-11 14:55:18 +02:00
Hubert Pelczarski 73a6c8fadf
feat: dynamic shortening for filetype (#224)
* feat: dynamic shortening for filetype

* feat: redraw statusline on VimResized

Co-authored-by: NullVoxPopuli <LPSego3+dev@gmail.com>
Co-authored-by: shadmansaleh <shadmansaleh3@gmail.com>
2021-05-11 12:47:09 +02:00
Hubert Pelczarski 11280b44f2
fix: extensions not working without deepcopy (#223) 2021-05-10 18:27:39 +02:00
Hubert Pelczarski 82826ef661
refactor: moved loading to new module (#182)
* 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
2021-05-09 23:11:18 +02:00
Folke Lemaitre c8b96850c9
fix: try LspDiagnostics colors first before fallling back to Diff colors (#216) 2021-05-07 13:03:11 +02:00
Shadman 141778c953
bugfix: perf improvements (#213)
* Revert "Revert "Performence improvments (#205)" (#212)"

This reverts commit d3cc343053.

* BugFix: All windows having same component state
2021-05-06 13:05:55 +02:00
Hubert Pelczarski d3cc343053
Revert "Performence improvments (#205)" (#212)
This reverts commit 141417de61.
2021-05-06 04:45:07 +02:00
Shadman 141417de61
Performence improvments (#205)
* Only load default config when needed

* Only load default cterm colors when needed

* Async load components and theme

* Rename: util_colors -> cterm_colors
2021-05-04 19:42:26 +02:00
Shadman 64ab49f55a
partially revert f08e8514 (#209)
Deepcopying default config is not reverted . And now user config is always applied on top of default_config. Functionaly it should be same as before f98e8514
2021-05-04 05:03:26 +06:00
Shadman 4c3d76d9cf
Feat: Disable lualine om specific buffer (#206)
Adding a new option in options table named `disabled_filetypes` .
It's a list of filetypes . If current filetyoe is on the list
statusline will be disabled.
2021-05-02 23:16:03 +06:00
shadmansaleh 39102109b8 Don't apply `g:lualine` config if config given to setup function 2021-05-02 10:51:42 +06:00
shadmansaleh f08e8514dd Clear old config before applying a new one
Options are reseted to defaults and other sections are cleared
2021-05-02 10:51:42 +06:00
Shadman f2f014e379
Fix: Transitional highlight not found error (#203)
Changes:
- transitional_highlight isn't created when both retrieval of fg or bg
  has failed
- Transitional highlight is not looked for when section separators are
  disabled
- empty section no longer returns highlight group as section data
2021-05-02 10:36:51 +06:00
agarof 6ba2b80b59
Fix themes incorrectly setting the bold attribute (#194) 2021-04-26 00:24:29 +02:00
Shadman e3a558bc1d
Fix component separator not removed for string color (#192) 2021-04-23 17:41:41 +06:00
Shadman 2f17e432ee
fix: typo functon -> function (#191) 2021-04-22 21:09:34 +02:00
Tim Bedard e6cc09c2e9
feat(filename): add support for custom filename symbols (modified, readonly) (#185)
* feat(filename): add support for custom filename symbols (modified, readonly)

* update docs
2021-04-20 22:25:25 +06:00
Tim Bedard 96938c5db2
style: Spell fix instence -> instance (#184) 2021-04-20 09:02:21 +06:00
ronnie@machine 2158095193
feat: modus_vivendi theme (#168)
* added the modus_vivendi theme

* Added screenshorts for modus_vivendi theme

* rearranged the themes to be alphabetical

* changed the a component's forground to lightgray

* changed screenshots to reflect the new foreground color for the a component

* lua-format and docstring added
2021-04-15 19:15:03 +02:00
Shadman 2a222d7ad6
Better fix to nil on vimfunc (#178) 2021-04-14 18:25:34 +06:00
Shadman dac7a290df
BugFix: fix vim functions displaying nil (#177) 2021-04-14 10:07:19 +06:00
Shadman aa844a9555
BugFix: Fix function component not working (#175)
When the provided function takes an optional argument the previous
implementation causes error.
2021-04-13 23:09:01 +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
shadmansaleh 77c4c47482 Enhance: Cleanup eval_lua component and document it 2021-04-12 21:59:55 +06:00
shadmansaleh 287e5def31 Enhance: Stop modifying global state.
v:lua.require is used insted of exposing function as global variable.
2021-04-12 21:59:55 +06:00
shadmansaleh 82f68c42df Enhance: Cterm colors only loaded when termguicolors = false 2021-04-12 21:59:55 +06:00
shadmansaleh 9e957e341e Feat: Allow color option to accept highlight group 2021-04-12 21:59:55 +06:00
shadmansaleh d6758af65b Feat: Add condition option 2021-04-12 21:51:31 +06:00
Shadman 7eacdb787f
fix: hostname component not working (#170) 2021-04-12 14:04:43 +02:00
Hubert Pelczarski 3e94f2786f
feat: addad chad&nnvim tree extensions (#167)
* feat: addad chad&nnvim tree extensions

* fix: updated all extensions

* applied suggestions
2021-04-12 14:03:25 +02:00
Shadman 1b81b0021f
Refactor: Components now use OOP style (#141) 2021-04-11 10:20:41 +02:00
Hubert Pelczarski 2b32fb090f
fix: theme type check fix (#165)
* fix: theme type check fix

* fix: string concat bug

* fix: removed semmicolon
2021-04-08 13:06:31 +02:00
John Sun 23e6bd5dd7
fix: Restore support for dictionary-typed theme setup parameter (#162)
* support passing in dictionary as theme definition

Allows setting up lualine with a theme dictionary like:
```lua
setup{
  theme = { normal = {...}; insert = { ... }; }
}
```
this was the original behaviour before 37a3b8cc.

* comment
2021-04-08 09:52:57 +02:00
Shadman 37a3b8cc82
feat: enhance theme (#153)
* Enhance Theme

- loaded theme table is nolonger stored in configs and thus not passed
  to components. Insted it's cached in highlights.lua
- Reintroducing clear_highlights turns out themes can still change if
  setup is called more than once

* Add error messege for invalid theme

It stops lualine from crashing in such incedent

* Apply lua-format

* Small tweeks
2021-04-07 02:34:36 +02:00
Jaekyeom Kim 7f1d7ba3fb
fix: displaying relative paths. (#155) 2021-03-31 16:47:38 +02:00
Evan Travers e057def23e
forest_night -> everforest (#152)
https://github.com/sainnhe/everforest/issues/43
2021-03-31 03:35:38 +02:00
hoob3rt 3f1939d78f refactor: removed unused local M 2021-03-30 15:42:38 +02:00
Yusei Ueno a2721e5ada
feat: add diagnostic sources option vim_lsp (#151) 2021-03-29 16:53:19 +02:00
Shadman 78b8260084
Feat: Adding readonly to filestatus (#149) 2021-03-28 03:38:47 +02:00
Shadman a3037fbf0b
BugFix: diagnostics highlight extraction (#144) 2021-03-26 13:51:48 +01:00
Hubert Pelczarski 62c22d0f05
refactor: completely moved to setup function (#133) 2021-03-25 12:03:43 +01:00
JayceFayne 7bf5076ece
fix: typo in warning message 2021-03-23 19:53:53 +01: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 c171d75797 feat: added hostname component 2021-03-22 15:17:27 +01:00
hoob3rt 0a7f268970 refactor: async.lua -> utils/async.lua 2021-03-18 02:24:44 +01:00
hoob3rt 21ea1acc61 refactor: config.lua -> defaults.lua 2021-03-18 02:13:40 +01:00
hoob3rt bfc9c744d7 refactor: moved section utils to new file 2021-03-18 01:57:59 +01:00
hoob3rt 1fea8b7fe5 refactor: moving to setup function 2021-03-17 01:02:13 +01:00
hoob3rt b31b66fa79 refactor: applied lua-format to all files 2021-03-16 00:37:46 +01:00
hoob3rt aec3bb9195 refactor: lualine.lua -> init.lua 2021-03-16 00:14:41 +01:00
Hubert Pelczarski 6e64822f50
Merge pull request #126 from hoob3rt/extensions 2021-03-16 00:06:06 +01:00
hoob3rt 74323eb08b refactor: simplified extension sections 2021-03-16 00:05:41 +01:00
Hubert Pelczarski d5150f481e
Merge pull request #129 from shadmansaleh/fix_bug_component_highlights_not_blending_with_bg
fix bug component highlights not blending with bg
2021-03-14 16:01:27 +01:00
shadmansaleh daa4cd45b3 Restructure mode conponent 2021-03-14 20:14:19 +06:00