Commit Graph

382 Commits

Author SHA1 Message Date
shadmansaleh 030eb62bc4 chore: autogen (vimdocs+formating) 2022-04-30 10:11:22 +00:00
Daemon 1cdddc2456
feat: add option to invert component icon alignment (#666)
* feat: add option to invert component icon alignment

Invert component status icon if variable is set `icon_right = true`.

* refactor: use string for icon alignment

Change conditional variable for icon left/right alignment from Boolean
to `icon_alignment = 'right'`.

* refactor: check icon table for alignment variable

Determine component status output from icon_alignment variable.
Provides alignment variables for generic component and filetype
devicons.

`component = { 'name', icon = {'*', align = 'right'} }`
`component = { 'filetype', icon_alignment = 'right' }`

* style: restore previous formatting on line 79

* refactor: set `self.option.icon` as table

* fix: forgot non-color icon alignment

* fix: remove redundant variable assignment

* docs: add README examples for icon alignment

Include configuration examples for icon alignment to README file.

* test: add test for filetype components icon align

Ensure testability for filetype icons being aligned to right side.
2022-04-30 16:10:47 +06:00
zeertzjq de2c4beaf5
fix: make escape sequences compatible with Lua 5.1 (#663)
Escape sequences starting with `\x` are supported by Lua 5.2 and LuaJIT, but not by Lua 5.1
2022-04-24 13:12:03 +06:00
HE7086 43c69a3479
Use escape sequence instead of raw binaries (#662)
* Fix: use escape sequence instead of binary chars

binary data will confuse some programs e.g. file and treat the code as "data" instead of "text"

* Fix: remove redundant binary character "0x1a"
2022-04-24 11:29:53 +06:00
shadmansaleh 13ead784c4 enhace: add create&format_hl to make hl easier for componemet 2022-04-18 05:20:29 +06:00
David van Munster 63f74ac069
feat: live filesize (#649) 2022-04-14 10:41:59 +06:00
shadmansaleh 19cbf69b2e fix: default diff & diagnostics color not changing with colorscheme
fixes #647
2022-04-13 11:26:31 +06:00
Jinq Qian c2165540a8
feat: show index in buffers component instead of bufnr (#628)
Co-authored-by: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com>
2022-04-13 11:01:42 +06:00
Mudox c9a974d912
feat: hide filename extension for buffers component (#629) 2022-04-13 10:59:53 +06:00
shadmansaleh bb8dd4c1c5 chore: autogen (vimdocs+formating) 2022-04-13 04:59:06 +00:00
Camille Dejoye f3dc0dcd4c
feat(themes): add automatic theme for nvim-base16 colorschemes(#597) 2022-04-13 10:58:31 +06:00
shadmansaleh c8e5a69085 fix: theme colors not applied as default when color option is incomplete
fixes #631
2022-04-01 13:46:09 +06:00
shadmansaleh 7345986fb4 fix: use appropriate default color for transitional separators. 2022-04-01 09:18:23 +06:00
Camille Dejoye e9b935ccd6
feat: add windows component (#595)
Co-authored-by: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com>
2022-03-26 19:31:40 +06:00
shadmansaleh 4480d91e60 fix: transparent background throwing errors without termguicolors
fixes #623 #625
2022-03-26 10:00:51 +00:00
Fitrah Muhammad 181b14348f
fix(filename): use columns for shortening if using global statusline (#617) 2022-03-18 20:08:52 +06:00
shadmansaleh 7db1db3cd9 fix: icons from different filetype component shareing same highlight group
fixes #610
2022-03-18 07:52:41 +06:00
Shadman 60b1d5dce9
feat: add support for global statusline (#613) 2022-03-18 06:59:01 +06:00
shadmansaleh 1e3cfc691f fix: persistent notices getting wrongly triggered 2022-03-07 18:10:32 +06:00
shadmansaleh 531b2f8a4b fix: transitional hl throwing errors for nil fg/bg in colors
fixes #600
2022-03-07 17:39:09 +06:00
Camille Dejoye 91142983d0
feat(diagnostics): add padding when using different background colors (#594)
* feat(diagnostics): add padding when using different background colors

When each "sub-section" of the diagnostics components have a different background the rendering is off when
multiple more than one of them is shown.

* chore: fix typo and spelling
2022-03-06 08:10:34 +06:00
shadmansaleh a1304ea8b6 chore: autogen (vimdocs+formating) 2022-03-05 13:41:08 +00:00
Shadman 747ef49b98
tests: add statusline test module & update lualine_spec accordingly(#588)
* enhance: add statusline test module

* update old tests to use statusline test setup

* show diff in statusline:expect

* Revert "show diff in statusline:expect"

This reverts commit cea25185fde1b99110759f198ef1fc724626306c.

* autoformat

* fix testcov reports

* update statusline test module

* revert lualine_spec

* update lualine_spec using statusline module

* apply formater

* add tabline support to statusline test module

* re enable tabline tests

* fix inconsistency in buffers mode test due to bufnr changing

Should we be showing bufnr/buffer_position in buffers component

* autoformat

* minor tweeks to stl test module

* use nvim_eval_statusline in nvim-0.6+

* fix tabs component on nvim-0.5

* enable disabled branch test
2022-03-05 19:40:36 +06:00
shadmansaleh 21fdf7b9fa don't max xyz->cba in create_component_highlight it's done while generating default hl values 2022-03-05 17:52:00 +06:00
Shadman 09f749cbb1
handle cases where filetype icon highlight is not set (#589) 2022-03-03 06:37:52 +06:00
shadmansaleh 32c85cd214 feat: add custom color support for icons 2022-03-02 20:02:58 +06:00
Shadman 37a314b9e3
feat: add support for dynamic color with functions in color options (#566)
* 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>
2022-03-02 19:37:08 +06:00
Michael Lan 016a20711e
feat: ayu adaptive background (#584)
* feat: Enable adaptive theme for ayu theme

* Update description of ayu theme

* doc: make formatting consistent
2022-02-21 08:05:43 +06:00
shadmansaleh 605a30f2fe feat: support transitional seperators with transparent background 2022-02-20 14:55:03 +06:00
shadmansaleh 40849728b6 fix: % not properly escaped in other components too.
Now following components escapes results of external souces
- buffers
- tabs
- hostname
- branch
- filetype

fixes #579
2022-02-15 23:17:05 +06:00
shadmansaleh a69251d52b fix: % in filename not escaped properly.
fixes #579
2022-02-15 22:54:29 +06:00
yasudanaoya 6a3d367449
feat: add terminal mode color in onedark (#576)
* feat: add terminal mode color in onedark
2022-02-12 00:36:36 +06:00
shadmansaleh 98dc2dd3a2 fix: LualineRenameTab crashing lualine
fixes https://github.com/nvim-lualine/lualine.nvim/pull/574#pullrequestreview-874872853

Issue was neovim's tabpage handle used by rpc-api isn't same as tab no
in viml.
Now the tabpage handle is stores in self.tabId and tab no is stored in
self.tabnr in `Tab` so any can be used when necessary.
2022-02-07 22:13:42 +06:00
Tokubara d52ff470de
feature to rename tabs (#574)
* (feat) add rename

* remove tabname if LualineRenameTab is ran without args

* document LualineRenameTab

Co-authored-by: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com>
2022-02-07 21:26:25 +06:00
yasudanaoya 2bddaf0508
feat: add onedark/onelight command mode color (#575)
* feat: add onedark/onelight command mode color

* fix: typo
2022-02-07 20:55:33 +06:00
Rocky Zhang d3c513a3fa
Extension for aerial.nvim (#572)
* Extension for aerial.nvim
2022-02-06 13:23:59 +06:00
shadmansaleh 6f28adb21f chore: autogen (vimdocs+formating) 2022-02-01 08:04:03 +00:00
github-actions[bot] dc31077bc5
chore: formated with stylua (#564)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-01-31 23:36:06 +06:00
Shadman e6e75f5e92
fix: lualine crashing because of keyboard interrupt. (#534)
* fix: lualine crashing because of keyboard interrupt.

If keyboard interrupt occurs while lualine is evaluating statusline
lualine crashes completely. Since keyboard interrupt isn't something
we can handle try to mitigate the issue by retrying to evaluate the
statusline on error.Now lualine will retry 3 times before giving
up on an runtime error.

* Make last retry unprotected call
2022-01-31 23:34:53 +06:00
Illia Danko 9208bae98f
fix: use one theme colors from rakr/vim-one (#556)
* fix: use one theme colors from rakr/vim-one

Co-authored-by: Illia Danko <illia@aigent.com>
2022-01-24 22:36:25 +06:00
shadmansaleh 70691ae350 enhance: undeprecate nvim_lsp and completely remove `nvim` diagnostics source 😉
- 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.
2022-01-12 22:35:44 +06:00
shadmansaleh 750a94baef chore: remove older deprecation notices 2022-01-12 22:35:17 +06:00
shadmansaleh 52725d2ca8 fix: buffers component crash on unlisted buffers
Seems like get_buf_option doesn't work on unlosted buffers.
reverting back to using fn.buflisted()

fixes #532
2022-01-04 23:30:31 +06:00
kylo252 02e1f6cd5b
refactor: use nvim api directly for bufnr (#526) 2022-01-04 19:17:16 +06:00
kylo252 4b68b8dd2a
fix: use nvim-api to avoid win_getid exceptions (#525) 2022-01-04 07:22:52 +06:00
shadmansaleh b18b7ee8ac chore: Use paranthesis for function calls. No paran can trip new lua users 2022-01-02 17:38:39 +06:00
shadmansaleh 9e26823ea6 fixup: error on branch component when stray .git files exist
fixes #490
2021-12-25 16:13:39 +06:00
Tobias Schmitz 3a17c8f05a
fix: don't hide readonly symbol when modified (#497) 2021-12-18 19:04:09 +06:00
Tobias Schmitz d02658b34d
feat(filename): add unnamed option (#496)
* feat(filename): add unnamed option

* docs(filename): add documentation for symbols
2021-12-18 18:49:41 +06:00
Tom 5596c2a25a
fix: x, y, z hl group not setting correctly (#484)
Highlight groups for x, y, z would only set correctly if theme had normal mode
explicitly set
2021-12-11 06:33:18 +06:00
Shadman f4ab5b56da
fix: diagnostics component in nvim-0.5 (#476) 2021-12-10 06:00:06 +06:00
shadmansaleh 4231b63196 fix: lsp.diagnostics deprecation warning
- 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
2021-12-09 23:33:36 +06:00
YONG LI 1ae4f0aa74
Support symbols-outline extension (#456)
* Support symbols-outline extension.
2021-11-28 17:00:34 +06:00
shadmansaleh 49db98c856 fixup: fix diff component quiting properly
fixes #459
2021-11-28 16:46:37 +06:00
shadmansaleh b7cf506785 enhache: support inlined custom component in extensions too 2021-11-25 13:44:15 +06:00
shadmansaleh c030a380ef feat: add support for inline custom components 2021-11-25 12:57:00 +06:00
Shadman f286f0443d
tests: add more tests (#439)
* tests: add more tests

* fix: for now comment out tabline tests

will check later why some are passing locally but not in CI
2021-11-22 19:40:18 +06:00
shadmansaleh 8725c63941 enhance: add more fallback colors for diff component 2021-11-22 10:13:14 +06:00
shadmansaleh 93c934a641 fixup: fix padding, fmt options in tabs and buffers
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
2021-11-18 08:12:33 +06:00
Ilya Malyavin d2f5d6c8aa
feat(buffers): option to show buffer index (#433)
* feature(buffers): option to show buffer indices
2021-11-13 19:44:35 +06:00
shadmansaleh df46c1e70a enhance: add notice for invalid types of component 2021-11-11 16:52:27 +06:00
Anakael 3b1a367d76
doc: fix hint icon doc in diagnostics component (#426) 2021-11-09 10:03:03 +06:00
Fitrah Muhammad 9143f8a8d0
enhance(filetype): filetype option as fallback of file extension for icon detection (#415)
* 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`
2021-11-08 07:22:30 +06:00
Arthur Skobara 3f5cdc51a0
fixup: missing hint value inside vim_lsp source (#421) 2021-11-05 12:55:28 +06:00
github-actions[bot] 7eff9bbeb4
chore: formated with stylua (#410)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-10-29 19:13:17 +06:00
Shadman ecaa491c3c feat: add support for function in max_length option (tabs & buffers) 2021-10-29 19:07:11 +06:00
adrian5 96263bcef6
doc: fix a few typos (#407) 2021-10-28 21:22:15 +06:00
André Augusto 0b0233f808
feat: add symbols option to fileformat (#401)
* doc: add symbol to fileformat component specific option
2021-10-27 03:04:53 +06:00
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