Commit Graph

185 Commits

Author SHA1 Message Date
Dalius Dobravolskas 3497c6c6b3
Passing self as second arg to self.options.fmt (#915)
* Add `tabnr` to `fmt` function

* Passing self as second arg to `self.options.fmt`

* README updated.
2022-12-22 19:14:34 +06:00
shadmansaleh bfa0d99ba6 fixup: All tab names have prefix "fugitive: " if current buffer is
fugitive status buffer

fixes #901
2022-11-28 20:48:27 +06:00
shadmansaleh b6314ac556 fixup: tabs component doesn't show fugitive status name properly
fixes #900
2022-11-26 10:02:04 +06:00
zappolowski 9d177b668c
fix component(filetype) proper icon based on filetype (#810)
* Refactor tests to use stubs for nvim-web-devicons

* Simplify getting icon

`get_icon` does not need the 2nd parameter (`ext`) as it will derive it
from the given `name` (1st argument) itself.

* fix component(filetype) proper icon based on filetype

With https://github.com/kyazdani42/nvim-web-devicons/pull/125 a filetype
based lookup was implemented upstream which can be used to get an icon
when a file doesn't have an extension.

fixes #578
2022-10-23 20:41:12 +06:00
shadmansaleh abb03129e0 chore: autogen (vimdocs+formating) 2022-10-19 09:07:21 +00:00
BlakeJC94 1a6ab5f2f4
feat: added searchcount component (#869)
* feat: added searchcount component

* feat: added timeout and maxcount to vim.fn.searchcount

* docs: added searchcount to README

* style: sorted list of components
2022-10-19 15:06:45 +06:00
Antoine Cotten a52f078026 feat(utils): support extracting fallback color 2022-09-12 00:35:46 +06:00
Andrey Mishakin 2061fcbf3b
fix: display virtual column number in location component (#835) 2022-09-12 00:32:09 +06:00
zappolowski 5d133a1ef2
fix component(filename) add separator between filename and icons (#812)
This makes it behave like the default statusline.

fixes #794
2022-09-10 15:39:38 +06:00
zappolowski f10101ab04
feat(filename) Always use the first letter for hidden directories (#833)
Instead of shortening a path segment to just the dot, it is now always
using 2 characters.

E.g.

```
~/.config/nvim/lua/config/lualine.lua
```

is shortened to

```
~/.c/n/l/c/lualine.lua
```

This includes a rewrite of the shortening logic as it cannot be
expressed easily/readable using patterns. The current approach starts at
the beginning and replaces each segment by a shortened version and
keeping track of the overall length (basic book keeping on how many
characters were saved by the replacement).
2022-09-10 15:20:37 +06:00
matthewsia98 2176d85f39
corrected order returned by workspace diagnostic (#831) 2022-09-10 15:14:26 +06:00
shadmansaleh 9076378ac1 chore: autogen (vimdocs+formating) 2022-08-20 15:51:32 +00:00
John Fred Fadrigalan 5d8fbf2943
fix component(filetype) to return default icon instead of nothing (#800) 2022-08-20 21:50:53 +06:00
shadmansaleh c0510ddec8 chore: autogen (vimdocs+formating) 2022-08-09 07:08:23 +00:00
Hongbo Liu 7b4b864af7
[filename] avoid new file status for unnamed (#795) 2022-08-09 13:07:55 +06:00
Plato 03bcf015d1
More user-friendly LualineBuffersJump (#780)
* buffers: user friendly LualineBuffersJump version

LualineBuffersJump throws an error when an attempt to jump to a
non-existent buffer index is made. It's expected from users to
trigger this error by accident while attempting to switch buffers.
To deal with this add <bang> support to LualineBuffersJump.

Signed-off-by: Plato Kiorpelidis <kioplato@gmail.com>

* chore: autogen (vimdocs+formating)

Co-authored-by: kioplato <kioplato@users.noreply.github.com>
2022-08-08 21:52:28 +06:00
Hongbo Liu 679e9e71de
[filename] support detect new file status (#785)
* [filename] support detect new file status

* update readme about new file status

* add definition for new file
2022-08-08 11:59:33 +06:00
Shadman 6d11f9f508
feat: allow lualine to ignore focus on specific filetypes. (#767)
* feat: allow lualine to ignore focus on specific filetypes.

closes #710

* fix: extensions on ingnored_focus

* perf: reuse api call results & use local variables instead of vim.g

* make location & progress components behave in ingnored filetypes

* fix: crash when last_focused win gets closed

* fix: location & progress related broken tests
2022-07-29 16:54:31 +06:00
shadmansaleh 788805771c fixup: escape results of vim_var components 2022-07-28 13:30:17 +06:00
shadmansaleh b378660841 chore: autogen (vimdocs+formating) 2022-07-27 18:03:53 +00:00
Yohanes Bandung Bondowoso 0521ada344
feat: add workspace diagnostics source (#618)
* feat: add workspace diagnostics source

* doc: add nvim_workspace_diagnostics to list of sources

Co-authored-by: Shadman <13149513+shadmansaleh@users.noreply.github.com>
2022-07-28 00:02:58 +06:00
Daemon b61afc44e6
docs: cleanup formatting and comment typos (#696)
* docs: fix typo in component notice

* refactor: rename typo param 'pattern'

* docs: fix comments typos across project files

Cleanup misspellings and wording in comment lines.

* docs: improve readability of `CONTRIBUTING.md`

* docs: improve readability of `README.md`

- Minor typos
- Clarify information
- Separate sections from paragraphs

* docs: add newline below headers in `THEMES.md`

Aim's to be consistent with other documents.

* docs: fix unname tabpage command reference

* docs: reword 'directly bused' for `setup_theme()`

* docs: fix extra indent in contribution list

* docs: more separation in readme/tabs, remove extra backtick

* docs: further improve wording for `setup_theme`

* docs: improve wording for `setup` function

* docs: missing underscore in lualine/config
2022-05-30 20:25:05 +06:00
shadmansaleh d64152cf5c chore: autogen (vimdocs+formating) 2022-05-20 00:48:48 +00:00
Marc Jakobi 36bf6963ae
Add option to show buffer number + alternate file icon (#669)
* Add option to show buffer number + alternate file icon

* Address PR comments

* Adjust existing tests for buffer bufnr mode additions

* Revert "Adjust existing tests for buffer bufnr mode additions"

This reverts commit f8422d9f38b4b437a2330101e13c3a4bc50ed920.

* Add missing case for buffers mode == 0

* Fix some test cases for alternate file icon + modified icon

* Add test cases for modes 3 & 4

* Correct typo in README

* Fix buffers component mode can change layout specs

* Detect buffer numbers in lualine_spec bufnr tests

* Minor change to test descriptions

* Delete unnamed buffer for consistent test results between nvim versions

* Add test case for alternate buffer when switching buffers

* Extend switching buffers test

Co-authored-by: Marc Jakobi <marc.jakobi@tiko.energy>
Co-authored-by: Marc Jakobi <mrcjk@p40yoga.localdomain>
2022-05-20 06:48:18 +06:00
Jackson Cooper 180f5de5b8
Support tilde as home path in the absolute file paths (#676)
* Support tile as home path in the absolute file paths
2022-05-13 11:28:03 +06:00
David van Munster 619ededcff
fix: large file lag with filesize component (partially reverts #649) (#675) 2022-05-07 09:53:33 +06: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
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
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
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
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
Shadman 09f749cbb1
handle cases where filetype icon highlight is not set (#589) 2022-03-03 06:37:52 +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
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
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
shadmansaleh 6f28adb21f chore: autogen (vimdocs+formating) 2022-02-01 08:04:03 +00: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 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
shadmansaleh b18b7ee8ac chore: Use paranthesis for function calls. No paran can trip new lua users 2022-01-02 17:38:39 +06:00