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
This commit is contained in:
Daemon 2022-05-30 07:25:05 -07:00 committed by GitHub
parent c12b167310
commit b61afc44e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 189 additions and 141 deletions

View File

@ -3,36 +3,39 @@
Thanks for considering to contribute. Thanks for considering to contribute.
### Getting started ### Getting started
You're not sure where to help. You can try these
- You can look at the currently open [issues](https://github.com/nvim-lualine/lualine.nvim/issues) to see if some bug needs fixing or for If you're not sure where to help? You can try these:
cool feature idea. You should also look at currently open prs to see
if some abandoned pr interests you<br> - You can look at the currently open [issues](https://github.com/nvim-lualine/lualine.nvim/issues)
to see if some bug needs fixing or for cool feature ideas.<br>
You should also look at currently open PRs ([Pull requests](https://github.com/nvim-lualine/lualine.nvim/pulls)) to see if some abandoned PR interests you.<br>
*We could really use some help with tests & docs they are currently lacking :)* *We could really use some help with tests & docs they are currently lacking :)*
- You can add exciting new component, extension or theme. - You can add an exciting new component, extension or theme.
Note: Currently we aren't adding regular colorscheme based themes. Note: Currently we aren't adding regular colorscheme based themes.
We think they make more sense with colorschemes as they tend not to get We think they make more sense with colorschemes as they tend not to get
updated once added here. But if you have some unique themes idea like [auto](https://github.com/nvim-lualine/lualine.nvim/blob/master/THEMES.md#auto) or [pywal](https://github.com/nvim-lualine/lualine.nvim/blob/master/THEMES.md#pywal) feel free to open an pr or issue. updated once added here. But if you have some unique themes idea like [auto](https://github.com/nvim-lualine/lualine.nvim/blob/master/THEMES.md#auto) or [pywal](https://github.com/nvim-lualine/lualine.nvim/blob/master/THEMES.md#pywal) feel free to open an PR or issue.
- Feel free to open issues or unfinished pr for help. - Feel free to open issues or unfinished PRs for help.
I'd actually recommend you to open an issue first for bigging prs to discuss I'd actually recommend you to open an issue first for bigger PRs to discuss
the feature with maintainer beforehand. That way you'll can know if the the feature with a maintainer beforehand. That way you can know if the
feature is likely to be accepted or not before you get started also you'll feature is likely to be accepted or not before you get started.
get recommendation and help with implementation specially if you show You'll get recommendation and help with implementation specially if you show
willingness to implement it yourself. willingness to implement it yourself.
- Do add tests and docs for your changes. - Do add tests and docs for your changes.
Good luck. Good luck!
### Developer tools
### Devloper tools
*Let's introduce you to the tools we use.* *Let's introduce you to the tools we use.*
- Your pr need to pass tests & linter. We lint our codebase with [luacheck](https://github.com/mpeterv/luacheck) - Your PR needs to pass tests & linter. We lint our codebase with [luacheck](https://github.com/mpeterv/luacheck)
and run tests with [plenary-test](https://github.com/nvim-lua/plenary.nvim) and run tests with [plenary-test](https://github.com/nvim-lua/plenary.nvim)
these will be ran on CI. If you want you can run tests & linter locally with these will be ran on CI. If you want you can run tests & linter locally with
`make test` & `make lint` respectively. Or `make check` to run both linter & tests. `make test` & `make lint` respectively. Or `make check` to run both linter & tests.
For running tests you'll have to make sure both lualine.nvim and plenery.nvim are in same directory. For running tests you'll have to make sure both lualine.nvim and plenery.nvim are in same directory.
- lua codebase gets formatted with [stylua](https://github.com/JohnnyMorganz/StyLua) in CI. - Lua codebase gets formatted with [stylua](https://github.com/JohnnyMorganz/StyLua) in CI.
So you can ignore formatting. But if you want to submit formatted So you can ignore formatting. But if you want to submit formatted
pr you can run formatter locally with `make format`. PR you can run formatter locally with `make format`.
- VimDocs are auto generated with [panvimdoc](https://github.com/kdheepak/panvimdoc) from README.md. - VimDocs are auto generated with [panvimdoc](https://github.com/kdheepak/panvimdoc) from README.md.
So don't make changes to doc/lualine.txt . Instead add your docs to README or Wiki. So don't make changes to doc/lualine.txt . Instead add your docs to README or Wiki.
The docgen in ran by CI too. If you want to run it locally you can do so The docgen in ran by CI too. If you want to run it locally you can do so
@ -41,5 +44,5 @@ Good luck.
- You can check our test coverage with `make testcov`. - You can check our test coverage with `make testcov`.
You'll need to have [luacov](https://github.com/keplerproject/luacov) You'll need to have [luacov](https://github.com/keplerproject/luacov)
& [luacov-console](https://github.com/spacewander/luacov-console) installed for that. & [luacov-console](https://github.com/spacewander/luacov-console) installed for that.
If you want the luacovs detailed report files run the command with NOCLEAN env set. If you want luacov's detailed report files, run the command with the `NOCLEAN` env set.
For example `NOCLEAN=1 make testcov` For example `NOCLEAN=1 make testcov`

View File

@ -465,7 +465,7 @@ sections = {
symbols = { symbols = {
modified = ' ●', -- Text to show when the buffer is modified modified = ' ●', -- Text to show when the buffer is modified
alternate_file = '#', -- Text to show to indify the alternate file alternate_file = '#', -- Text to show to identify the alternate file
directory = '', -- Text to show when the buffer is a directory directory = '', -- Text to show when the buffer is a directory
}, },
} }
@ -685,29 +685,35 @@ tabline = {
``` ```
#### Buffers #### Buffers
Shows currently open buffers. Like bufferline . See Shows currently open buffers. Like bufferline . See
[buffers options](#buffers-component-options) [buffers options](#buffers-component-options)
for all builtin behaviors of buffers component. for all builtin behaviors of buffers component.
You can use `:LualineBuffersJump` to jump to buffer based on index You can use `:LualineBuffersJump` to jump to buffer based on index
of buffer in buffers component. of buffer in buffers component.
```vim ```vim
:LualineBuffersJump 2 " Jumps to 2nd buffer in buffers component. :LualineBuffersJump 2 " Jumps to 2nd buffer in buffers component.
:LualineBuffersJump $ " Jumps to last buffer in buffers component. :LualineBuffersJump $ " Jumps to last buffer in buffers component.
``` ```
#### Tabs #### Tabs
Shows currently open tab. Like usual tabline. See Shows currently open tab. Like usual tabline. See
[tabs options](#tabs-component-options) [tabs options](#tabs-component-options)
for all builtin behaviors of tabs component. for all builtin behaviors of tabs component.
You can also use `:LualineRenameTab` to set a name for a tabpage. You can also use `:LualineRenameTab` to set a name for a tabpage.
For example: For example:
```vim ```vim
:LualineRenameTab Project_K :LualineRenameTab Project_K
```` ```
It's useful when you're using rendering mode 2/3 in tabs. It's useful when you're using rendering mode 2/3 in tabs.
To unname a tablage run `:LualineRenameTab` without argument. To unname a tabpage run `:LualineRenameTab` without argument.
#### Tabline as statusline #### Tabline as statusline
You can also completely move your statusline to a tabline by configuring You can also completely move your statusline to a tabline by configuring
`lualine.tabline` and disabling `lualine.sections` and `lualine.inactive_sections`: `lualine.tabline` and disabling `lualine.sections` and `lualine.inactive_sections`:
@ -797,6 +803,7 @@ If you want to extend lualine with plugins or want to know
which ones already do, [wiki/plugins](https://github.com/nvim-lualine/lualine.nvim/wiki/Plugins) is for you. which ones already do, [wiki/plugins](https://github.com/nvim-lualine/lualine.nvim/wiki/Plugins) is for you.
### Support ### Support
If you appreciate my work you can buy me a coffee. If you appreciate my work you can buy me a coffee.
<a href="https://www.buymeacoffee.com/shadmansalJ" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-black.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;"></a> <a href="https://www.buymeacoffee.com/shadmansalJ" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-black.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;"></a>

View File

@ -3,11 +3,13 @@
All available themes are only best effort ports by myself/ other users. If you find a theme to be weird/ wrong please open an issue/ pr. All available themes are only best effort ports by myself/ other users. If you find a theme to be weird/ wrong please open an issue/ pr.
### auto ### auto
auto is a special theme. It will automatically load theme for your colorscheme. auto is a special theme. It will automatically load theme for your colorscheme.
If there's no theme available for your colorscheme then If there's no theme available for your colorscheme then
it'll try it's best to generate one. it'll try it's best to generate one.
### 16color ### 16color
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648240-02d2ae00-74bb-11eb-9ac1-495849621366.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648240-02d2ae00-74bb-11eb-9ac1-495849621366.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648219-f77f8280-74ba-11eb-84e4-978bf918c21f.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648219-f77f8280-74ba-11eb-84e4-978bf918c21f.png'/>
@ -16,6 +18,7 @@ it'll try it's best to generate one.
</p> </p>
### ayu_dark ### ayu_dark
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648314-357ca680-74bb-11eb-83de-ec94c3a75d99.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648314-357ca680-74bb-11eb-83de-ec94c3a75d99.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648329-3e6d7800-74bb-11eb-901b-41e1f01315f0.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648329-3e6d7800-74bb-11eb-901b-41e1f01315f0.png'/>
@ -24,6 +27,7 @@ it'll try it's best to generate one.
</p> </p>
### ayu_light ### ayu_light
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648508-b5a30c00-74bb-11eb-80f7-0bce969d35ea.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648508-b5a30c00-74bb-11eb-80f7-0bce969d35ea.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648511-b89dfc80-74bb-11eb-9868-f63d7752fe83.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648511-b89dfc80-74bb-11eb-9868-f63d7752fe83.png'/>
@ -32,6 +36,7 @@ it'll try it's best to generate one.
</p> </p>
### ayu_mirage ### ayu_mirage
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648535-c6538200-74bb-11eb-815b-53f4b3274602.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648535-c6538200-74bb-11eb-815b-53f4b3274602.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648537-c784af00-74bb-11eb-8da5-d91bfc61a967.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648537-c784af00-74bb-11eb-8da5-d91bfc61a967.png'/>
@ -40,6 +45,7 @@ it'll try it's best to generate one.
</p> </p>
### ayu ### ayu
It's a combination of ayu_light, ayu_dark & ayu_mirage. If `g:ayucolor` exists, It's a combination of ayu_light, ayu_dark & ayu_mirage. If `g:ayucolor` exists,
it loads one of these based on your `g:ayucolor` option. Otherwise, it will it loads one of these based on your `g:ayucolor` option. Otherwise, it will
load ayu_light when background=light and ayu_dark when background=dark load ayu_light when background=light and ayu_dark when background=dark
@ -59,6 +65,7 @@ The following example is using the `tomorrow-night` colorscheme:
</p> </p>
### codedark ### codedark
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648568-dff4c980-74bb-11eb-9d16-b68ac68f2ab2.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648568-dff4c980-74bb-11eb-9d16-b68ac68f2ab2.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648569-e125f680-74bb-11eb-8782-db9a6c2a3153.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648569-e125f680-74bb-11eb-8782-db9a6c2a3153.png'/>
@ -67,6 +74,7 @@ The following example is using the `tomorrow-night` colorscheme:
</p> </p>
### dracula ### dracula
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648594-f0a53f80-74bb-11eb-9018-9ee12260750e.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648594-f0a53f80-74bb-11eb-9018-9ee12260750e.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648600-f26f0300-74bb-11eb-82a4-f732b3e7eeff.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648600-f26f0300-74bb-11eb-82a4-f732b3e7eeff.png'/>
@ -75,6 +83,7 @@ The following example is using the `tomorrow-night` colorscheme:
</p> </p>
### everforest ### everforest
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648663-1cc0c080-74bc-11eb-8cc1-36266a0385e3.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648663-1cc0c080-74bc-11eb-8cc1-36266a0385e3.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648667-1df1ed80-74bc-11eb-9ef8-dfd2e8401f0c.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648667-1df1ed80-74bc-11eb-9ef8-dfd2e8401f0c.png'/>
@ -83,6 +92,7 @@ The following example is using the `tomorrow-night` colorscheme:
</p> </p>
### gruvbox_dark ### gruvbox_dark
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648685-2b0edc80-74bc-11eb-9ec9-9aac3677df43.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648685-2b0edc80-74bc-11eb-9ec9-9aac3677df43.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648693-2ea26380-74bc-11eb-831a-9ebbe4f3dd83.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648693-2ea26380-74bc-11eb-831a-9ebbe4f3dd83.png'/>
@ -91,6 +101,7 @@ The following example is using the `tomorrow-night` colorscheme:
</p> </p>
### gruvbox_light ### gruvbox_light
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/34294427/118757012-5d9b5c00-b896-11eb-8e4f-c0c28f774cf6.png'/> <img width='700' src='https://user-images.githubusercontent.com/34294427/118757012-5d9b5c00-b896-11eb-8e4f-c0c28f774cf6.png'/>
<img width='700' src='https://user-images.githubusercontent.com/34294427/118757009-5bd19880-b896-11eb-9846-d02b16653ab0.png'/> <img width='700' src='https://user-images.githubusercontent.com/34294427/118757009-5bd19880-b896-11eb-9846-d02b16653ab0.png'/>
@ -99,10 +110,12 @@ The following example is using the `tomorrow-night` colorscheme:
</p> </p>
### gruvbox ### gruvbox
It's a combination of gruvbox_light and gruvbox_dark. It loads either of It's a combination of gruvbox_light and gruvbox_dark. It loads either of
them based you your `background` option. them based you your `background` option.
### gruvbox-material ### gruvbox-material
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648725-3f52d980-74bc-11eb-8fa5-a77b0a21cdea.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648725-3f52d980-74bc-11eb-8fa5-a77b0a21cdea.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648728-41b53380-74bc-11eb-99cf-001eab6cc51b.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648728-41b53380-74bc-11eb-99cf-001eab6cc51b.png'/>
@ -111,6 +124,7 @@ them based you your `background` option.
</p> </p>
### horizon ### horizon
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/69089176/118903813-70527700-b910-11eb-9d45-1785790ce8e8.png'/> <img width='700' src='https://user-images.githubusercontent.com/69089176/118903813-70527700-b910-11eb-9d45-1785790ce8e8.png'/>
<img width='700' src='https://user-images.githubusercontent.com/69089176/118902058-bc9bb800-b90c-11eb-99b8-3b98cbdd01d7.png'/> <img width='700' src='https://user-images.githubusercontent.com/69089176/118902058-bc9bb800-b90c-11eb-99b8-3b98cbdd01d7.png'/>
@ -119,6 +133,7 @@ them based you your `background` option.
</p> </p>
### iceberg_dark ### iceberg_dark
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648796-614c5c00-74bc-11eb-8398-cde120ec7746.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648796-614c5c00-74bc-11eb-8398-cde120ec7746.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648813-64474c80-74bc-11eb-986b-432498dd6245.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648813-64474c80-74bc-11eb-986b-432498dd6245.png'/>
@ -127,6 +142,7 @@ them based you your `background` option.
</p> </p>
### iceberg_light ### iceberg_light
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648848-71fcd200-74bc-11eb-8910-e12ae9ce619f.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648848-71fcd200-74bc-11eb-8910-e12ae9ce619f.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648849-73c69580-74bc-11eb-93f9-d6f75a2bdd97.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648849-73c69580-74bc-11eb-93f9-d6f75a2bdd97.png'/>
@ -135,10 +151,12 @@ them based you your `background` option.
</p> </p>
### iceberg ### iceberg
It's a combination of iceberg_light and iceberg_dark. It loads either of It's a combination of iceberg_light and iceberg_dark. It loads either of
them based you your `background` option. them based you your `background` option.
### jellybeans ### jellybeans
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648882-82ad4800-74bc-11eb-91e8-4d38fcdec134.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648882-82ad4800-74bc-11eb-91e8-4d38fcdec134.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648883-850fa200-74bc-11eb-8d9b-54116accd2f8.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648883-850fa200-74bc-11eb-8d9b-54116accd2f8.png'/>
@ -147,6 +165,7 @@ them based you your `background` option.
</p> </p>
### material ### material
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648925-9e185300-74bc-11eb-9263-842fe2d56ba8.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648925-9e185300-74bc-11eb-9263-842fe2d56ba8.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648927-9f498000-74bc-11eb-8a15-4ba68403037a.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648927-9f498000-74bc-11eb-8a15-4ba68403037a.png'/>
@ -155,6 +174,7 @@ them based you your `background` option.
</p> </p>
### modus-vivendi ### modus-vivendi
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/9327361/114389966-58176b80-9b9e-11eb-944e-1e0079527d74.png'/> <img width='700' src='https://user-images.githubusercontent.com/9327361/114389966-58176b80-9b9e-11eb-944e-1e0079527d74.png'/>
<img width='700' src='https://user-images.githubusercontent.com/9327361/114390000-606fa680-9b9e-11eb-97dd-ef5bbc23049a.png'/> <img width='700' src='https://user-images.githubusercontent.com/9327361/114390000-606fa680-9b9e-11eb-97dd-ef5bbc23049a.png'/>
@ -163,6 +183,7 @@ them based you your `background` option.
</p> </p>
### molokai ### molokai
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648944-ab354200-74bc-11eb-85fd-71a40102384b.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648944-ab354200-74bc-11eb-85fd-71a40102384b.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648946-acff0580-74bc-11eb-9aae-36a869b855e5.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648946-acff0580-74bc-11eb-9aae-36a869b855e5.png'/>
@ -171,6 +192,7 @@ them based you your `background` option.
</p> </p>
### moonfly ### moonfly
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/11382509/129304429-cd2af22d-3b88-4c17-bf99-99f7608576d4.png'/> <img width='700' src='https://user-images.githubusercontent.com/11382509/129304429-cd2af22d-3b88-4c17-bf99-99f7608576d4.png'/>
<img width='700' src='https://user-images.githubusercontent.com/11382509/129304441-81a6c88e-364c-476a-9050-0ada4cae1e3b.png'/> <img width='700' src='https://user-images.githubusercontent.com/11382509/129304441-81a6c88e-364c-476a-9050-0ada4cae1e3b.png'/>
@ -179,6 +201,7 @@ them based you your `background` option.
</p> </p>
### nightfly ### nightfly
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648974-b9835e00-74bc-11eb-9c52-c5187aa3ff2c.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648974-b9835e00-74bc-11eb-9c52-c5187aa3ff2c.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648977-bab48b00-74bc-11eb-96b3-7f51fc73d8e8.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108648977-bab48b00-74bc-11eb-96b3-7f51fc73d8e8.png'/>
@ -187,6 +210,7 @@ them based you your `background` option.
</p> </p>
### nord ### nord
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649007-cbfd9780-74bc-11eb-87be-a9edc714e57a.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649007-cbfd9780-74bc-11eb-87be-a9edc714e57a.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649010-cd2ec480-74bc-11eb-9d9b-54fadee2abef.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649010-cd2ec480-74bc-11eb-9d9b-54fadee2abef.png'/>
@ -195,6 +219,7 @@ them based you your `background` option.
</p> </p>
### OceanicNext ### OceanicNext
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649039-d7e95980-74bc-11eb-9a33-df413936c645.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649039-d7e95980-74bc-11eb-9a33-df413936c645.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649043-d91a8680-74bc-11eb-9b1b-9c2e88ede3aa.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649043-d91a8680-74bc-11eb-9b1b-9c2e88ede3aa.png'/>
@ -203,6 +228,7 @@ them based you your `background` option.
</p> </p>
### onedark ### onedark
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/8293386/150810955-ef6bf575-4a96-439c-a708-37dd25c63a47.png'/> <img width='700' src='https://user-images.githubusercontent.com/8293386/150810955-ef6bf575-4a96-439c-a708-37dd25c63a47.png'/>
<img width='700' src='https://user-images.githubusercontent.com/8293386/150811104-31fbc04c-1500-4779-a079-98bd1e56701d.png'/> <img width='700' src='https://user-images.githubusercontent.com/8293386/150811104-31fbc04c-1500-4779-a079-98bd1e56701d.png'/>
@ -211,6 +237,7 @@ them based you your `background` option.
</p> </p>
### onelight ### onelight
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/8293386/150809518-b596f9bc-c351-4e71-9dec-e1856efaff8a.png'/> <img width='700' src='https://user-images.githubusercontent.com/8293386/150809518-b596f9bc-c351-4e71-9dec-e1856efaff8a.png'/>
<img width='700' src='https://user-images.githubusercontent.com/8293386/150809979-237c6414-4278-447d-a00f-0a32e2770195.png'/> <img width='700' src='https://user-images.githubusercontent.com/8293386/150809979-237c6414-4278-447d-a00f-0a32e2770195.png'/>
@ -219,6 +246,7 @@ them based you your `background` option.
</p> </p>
### palenight ### palenight
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/7190144/109406548-3e1d2300-797a-11eb-8fdb-c3882ae08625.png'/> <img width='700' src='https://user-images.githubusercontent.com/7190144/109406548-3e1d2300-797a-11eb-8fdb-c3882ae08625.png'/>
<img width='700' src='https://user-images.githubusercontent.com/7190144/109406547-3e1d2300-797a-11eb-9b72-43ba7145355d.png'/> <img width='700' src='https://user-images.githubusercontent.com/7190144/109406547-3e1d2300-797a-11eb-9b72-43ba7145355d.png'/>
@ -227,6 +255,7 @@ them based you your `background` option.
</p> </p>
### papercolor_dark ### papercolor_dark
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649104-fd766300-74bc-11eb-8c5c-40e7191a81f7.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649104-fd766300-74bc-11eb-8c5c-40e7191a81f7.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649106-fe0ef980-74bc-11eb-93f7-f98e0b89d5c9.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649106-fe0ef980-74bc-11eb-93f7-f98e0b89d5c9.png'/>
@ -235,6 +264,7 @@ them based you your `background` option.
</p> </p>
### papercolor_light ### papercolor_light
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649126-07986180-74bd-11eb-9a25-c6ce762d37d2.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649126-07986180-74bd-11eb-9a25-c6ce762d37d2.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649129-08c98e80-74bd-11eb-93d4-5bc109ac9ee9.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649129-08c98e80-74bd-11eb-93d4-5bc109ac9ee9.png'/>
@ -243,10 +273,12 @@ them based you your `background` option.
</p> </p>
### PaperColor ### PaperColor
It's a combination of papercolor_light and papercolor_dark. It loads either of It's a combination of papercolor_light and papercolor_dark. It loads either of
them based you your `background` option. them based you your `background` option.
### powerline ### powerline
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649147-14b55080-74bd-11eb-9670-713185342eb2.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649147-14b55080-74bd-11eb-9670-713185342eb2.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649150-15e67d80-74bd-11eb-8815-194c51d96016.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649150-15e67d80-74bd-11eb-8815-194c51d96016.png'/>
@ -255,6 +287,7 @@ them based you your `background` option.
</p> </p>
### powerline_dark ### powerline_dark
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/59497618/131224416-851aedd4-27bb-47fd-a9a6-5332aa42ce60.png'/> <img width='700' src='https://user-images.githubusercontent.com/59497618/131224416-851aedd4-27bb-47fd-a9a6-5332aa42ce60.png'/>
<img width='700' src='https://user-images.githubusercontent.com/59497618/131224418-7bec491b-1183-4ec7-8089-3dbe460cc1e4.png'/> <img width='700' src='https://user-images.githubusercontent.com/59497618/131224418-7bec491b-1183-4ec7-8089-3dbe460cc1e4.png'/>
@ -263,6 +296,7 @@ them based you your `background` option.
</p> </p>
### pywal ### pywal
pywal is another special theme. It will load the colors from your current [pywal](https://github.com/dylanaraps/pywal) cache, specifically `~/.cache/wal/colors.sh` and generate a theme. pywal is another special theme. It will load the colors from your current [pywal](https://github.com/dylanaraps/pywal) cache, specifically `~/.cache/wal/colors.sh` and generate a theme.
#### `wal --theme ashes` #### `wal --theme ashes`
@ -282,6 +316,7 @@ pywal is another special theme. It will load the colors from your current [pywal
<img width='700' src='https://user-images.githubusercontent.com/36740602/132101621-505e5bb6-d18a-434c-a0f8-a3904a5c71f2.png'/> <img width='700' src='https://user-images.githubusercontent.com/36740602/132101621-505e5bb6-d18a-434c-a0f8-a3904a5c71f2.png'/>
### seoul256 ### seoul256
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649194-2c8cd480-74bd-11eb-8fbc-935d7e0fe921.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649194-2c8cd480-74bd-11eb-8fbc-935d7e0fe921.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649198-2d256b00-74bd-11eb-9894-7ffdead0297c.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649198-2d256b00-74bd-11eb-9894-7ffdead0297c.png'/>
@ -290,6 +325,7 @@ pywal is another special theme. It will load the colors from your current [pywal
</p> </p>
### solarized_dark ### solarized_dark
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649216-37476980-74bd-11eb-8f3b-2a7fc368388d.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649216-37476980-74bd-11eb-8f3b-2a7fc368388d.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649217-38789680-74bd-11eb-8337-5e3005c5e261.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649217-38789680-74bd-11eb-8337-5e3005c5e261.png'/>
@ -298,6 +334,7 @@ pywal is another special theme. It will load the colors from your current [pywal
</p> </p>
### solarized_light ### solarized_light
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649246-44645880-74bd-11eb-92c9-120798dc0452.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649246-44645880-74bd-11eb-92c9-120798dc0452.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649251-462e1c00-74bd-11eb-953d-2857296997cc.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649251-462e1c00-74bd-11eb-953d-2857296997cc.png'/>
@ -306,6 +343,7 @@ pywal is another special theme. It will load the colors from your current [pywal
</p> </p>
### Tomorrow ### Tomorrow
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649275-51814780-74bd-11eb-881b-1e137a0cbfe0.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649275-51814780-74bd-11eb-881b-1e137a0cbfe0.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649297-59d98280-74bd-11eb-92a5-a8c4af150106.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649297-59d98280-74bd-11eb-92a5-a8c4af150106.png'/>
@ -314,6 +352,7 @@ pywal is another special theme. It will load the colors from your current [pywal
</p> </p>
### wombat ### wombat
<p> <p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649337-65c54480-74bd-11eb-9ea1-fab2e679c56b.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649337-65c54480-74bd-11eb-9ea1-fab2e679c56b.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649411-8db4a800-74bd-11eb-962a-8b73f9fb7124.png'/> <img width='700' src='https://user-images.githubusercontent.com/41551030/108649411-8db4a800-74bd-11eb-962a-8b73f9fb7124.png'/>

View File

@ -12,8 +12,8 @@ local modules = lualine_require.lazy_require {
local config -- Stores currently applied config local config -- Stores currently applied config
-- Helper for apply_transitional_separators() -- Helper for apply_transitional_separators()
--- finds first applied highlight group fter str_checked in status --- finds first applied highlight group after str_checked in status
---@param status string : unprossed statusline string ---@param status string : unprocessed statusline string
---@param str_checked number : position of how far status has been checked ---@param str_checked number : position of how far status has been checked
---@return string|nil the hl group name or nil ---@return string|nil the hl group name or nil
local function find_next_hl(status, str_checked) local function find_next_hl(status, str_checked)
@ -36,11 +36,11 @@ end
-- Helper for apply_transitional_separators() -- Helper for apply_transitional_separators()
--- applies transitional separator highlight + transitional separator --- applies transitional separator highlight + transitional separator
---@param status string : unprossed statusline string ---@param status string : unprocessed statusline string
---@param str_checked number : position of how far status has been checked ---@param str_checked number : position of how far status has been checked
---@param last_hl string : last applied hl group name before str_checked ---@param last_hl string : last applied hl group name before str_checked
---@param reverse boolean : reverse the hl group ( true for right separators ) ---@param reverse boolean : reverse the hl group ( true for right separators )
---@return string|nil concated separator highlight and transitional separator ---@return string|nil concatenate separator highlight and transitional separator
local function fill_section_separator(status, is_focused, str_checked, last_hl, sep, reverse) local function fill_section_separator(status, is_focused, str_checked, last_hl, sep, reverse)
-- Inserts transitional separator along with transitional highlight -- Inserts transitional separator along with transitional highlight
local next_hl = find_next_hl(status, str_checked) local next_hl = find_next_hl(status, str_checked)
@ -63,12 +63,12 @@ end
--- processes statusline string --- processes statusline string
--- replaces %s/S{sep} with proper left/right separator highlight + sep --- replaces %s/S{sep} with proper left/right separator highlight + sep
---@param status string : unprossed statusline string ---@param status string : unprocessed statusline string
---@return string : processed statusline string ---@return string : processed statusline string
local function apply_transitional_separators(status, is_focused) local function apply_transitional_separators(status, is_focused)
local status_applied = {} -- Collects all the pieces for concatation local status_applied = {} -- Collects all the pieces for concatenation
local last_hl -- Stores lash highligjt group that we found local last_hl -- Stores last highlight group that we found
local last_hl_reseted = false -- Whether last_hl is nil because we reseted local last_hl_reseted = false -- Whether last_hl is nil after reset
-- it after %= -- it after %=
local copied_pos = 1 -- Tracks how much we've copied over to status_applied local copied_pos = 1 -- Tracks how much we've copied over to status_applied
local str_checked = 1 -- Tracks where the searcher head is at local str_checked = 1 -- Tracks where the searcher head is at
@ -120,10 +120,10 @@ local function apply_transitional_separators(status, is_focused)
str_checked = str_checked + 2 -- Skip the following % too str_checked = str_checked + 2 -- Skip the following % too
elseif next_char == '=' and last_hl and (last_hl:find('^lualine_a') or last_hl:find('^lualine_b')) then elseif next_char == '=' and last_hl and (last_hl:find('^lualine_a') or last_hl:find('^lualine_b')) then
-- TODO: Fix this properly -- TODO: Fix this properly
-- This check for lualine_a and lualine_b is dumb. It doesn't garantee -- This check for lualine_a and lualine_b is dumb. It doesn't guarantee
-- c or x section isn't present. Worst case sinario after this patch -- c or x section isn't present. Worst case scenario after this patch
-- we have another visual bug that occurs less frequently. -- we have another visual bug that occurs less frequently.
-- Annoying Edge Cases............................................ -- Annoying Edge Cases
last_hl = nil last_hl = nil
last_hl_reseted = true last_hl_reseted = true
str_checked = str_checked + 1 -- Skip the following % too str_checked = str_checked + 1 -- Skip the following % too
@ -138,7 +138,7 @@ end
--- creates the statusline string --- creates the statusline string
---@param sections table : section config where components are replaced with ---@param sections table : section config where components are replaced with
--- component objects --- component objects
---@param is_focused boolean : whether being evsluated for focused window or not ---@param is_focused boolean : whether being evaluated for focused window or not
---@return string statusline string ---@return string statusline string
local statusline = modules.utils.retry_call_wrap(function(sections, is_focused) local statusline = modules.utils.retry_call_wrap(function(sections, is_focused)
-- The sequence sections should maintain [SECTION_SEQUENCE] -- The sequence sections should maintain [SECTION_SEQUENCE]
@ -176,10 +176,10 @@ end)
--- check if any extension matches the filetype and return proper sections --- check if any extension matches the filetype and return proper sections
---@param current_ft string : filetype name of current file ---@param current_ft string : filetype name of current file
---@param is_focused boolean : whether being evsluated for focused window or not ---@param is_focused boolean : whether being evaluated for focused window or not
---@return table : (section_table) section config where components are replaced with ---@return table : (section_table) section config where components are replaced with
--- component objects --- component objects
-- TODO: change this so it uses a hash table instead of iteration over lisr -- TODO: change this so it uses a hash table instead of iteration over list
-- to improve redraws. Add buftype / bufname for extensions -- to improve redraws. Add buftype / bufname for extensions
-- or some kind of cond ? -- or some kind of cond ?
local function get_extension_sections(current_ft, is_focused) local function get_extension_sections(current_ft, is_focused)
@ -217,13 +217,13 @@ Also provide what colorscheme you're using.
modules.utils_notices.add_notice(string.format(message_template, theme_name)) modules.utils_notices.add_notice(string.format(message_template, theme_name))
end end
--- sets up theme by defining hl groups and setting theme cache in highlight.lua --- Sets up theme by defining hl groups and setting theme cache in 'highlight.lua'.
--- uses options.theme option for theme if it's a string loads theme of that name --- Uses 'options.theme' variable to apply the theme:
--- if it's a table directlybuses it . --- - If the value is a string, it'll load a theme of that name.
--- when theme load fails this fallsback to 'auto' theme if even that fails --- - If it's a table, it's directly used as the theme.
--- this falls back to 'gruvbox' theme --- If loading the theme fails, this falls back to 'auto' theme.
--- also sets up auto command to reload lualine on ColorScheme or background --- If the 'auto' theme also fails, this falls back to 'gruvbox' theme.
--- change on --- Also sets up auto command to reload lualine on ColorScheme or background changes.
local function setup_theme() local function setup_theme()
local function get_theme_from_config() local function get_theme_from_config()
local theme_name = config.options.theme local theme_name = config.options.theme
@ -263,7 +263,7 @@ local function set_tabline()
end end
end end
--- Sets &ststusline option to lualine --- Sets &statusline option to lualine
--- adds auto command to redraw lualine on VimResized event --- adds auto command to redraw lualine on VimResized event
local function set_statusline() local function set_statusline()
if next(config.sections) ~= nil or next(config.inactive_sections) ~= nil then if next(config.sections) ~= nil or next(config.inactive_sections) ~= nil then
@ -282,7 +282,7 @@ end
-- lualine.statusline function -- lualine.statusline function
--- Draw correct statusline for current window --- Draw correct statusline for current window
---@param focused boolean : force the value of is_focused . useful for debugging ---@param focused boolean : force the value of is_focused . Useful for debugging
---@return string statusline string ---@return string statusline string
local function status_dispatch(focused) local function status_dispatch(focused)
local retval local retval
@ -313,12 +313,12 @@ end
-- lualine.setup function -- lualine.setup function
--- sets new user config --- sets new user config
--- This function doesn't load components/theme etc.. they are done before --- This function doesn't load components/theme etc... They are done before
--- first statusline redraw after new config. This is more efficient when --- first statusline redraw and after new config. This is more efficient when
--- lualine config is done in several setup calls in chunks. This way --- lualine config is done in several setup calls as chunks. This way
--- we don't intialize components just to throgh them away .Instead they are --- we don't initialize components just to throw them away. Instead they are
--- initialized when we know we will use them. --- initialized when we know we will use them.
--- sets &last_status tl 2 --- sets &last_status to 2
---@param user_config table table ---@param user_config table table
local function setup(user_config) local function setup(user_config)
if package.loaded['lualine.utils.notices'] then if package.loaded['lualine.utils.notices'] then

View File

@ -34,7 +34,7 @@ function M:init(options)
end end
---sets the default separator for component based on whether the component ---sets the default separator for component based on whether the component
---is in left sections or right sections when separator option is omited. ---is in left sections or right sections when separator option is omitted.
function M:set_separator() function M:set_separator()
if self.options.separator == nil then if self.options.separator == nil then
if self.options.component_separators then if self.options.component_separators then
@ -73,7 +73,7 @@ function M:apply_padding()
end end
if l_padding then if l_padding then
if self.status:find('%%#.*#') == 1 then if self.status:find('%%#.*#') == 1 then
-- When component has changed the highlight at begining -- When component has changed the highlight at beginning
-- we will add the padding after the highlight -- we will add the padding after the highlight
local pre_highlight = vim.fn.matchlist(self.status, [[\(%#.\{-\}#\)]])[2] local pre_highlight = vim.fn.matchlist(self.status, [[\(%#.\{-\}#\)]])[2]
self.status = pre_highlight .. string.rep(' ', l_padding) .. self.status:sub(#pre_highlight + 1, #self.status) self.status = pre_highlight .. string.rep(' ', l_padding) .. self.status:sub(#pre_highlight + 1, #self.status)
@ -95,10 +95,10 @@ function M:apply_highlights(default_highlight)
end end
if type(self.options.separator) ~= 'table' and self.status:find('%%#') then if type(self.options.separator) ~= 'table' and self.status:find('%%#') then
-- Apply default highlight only when we aren't applying trans sep and -- Apply default highlight only when we aren't applying trans sep and
-- the component has changed it's hl. since we won't be applying -- the component has changed it's hl. Since we won't be applying
-- regular sep in those cases so ending with default hl isn't neccessay -- regular sep in those cases so ending with default hl isn't necessary
self.status = self.status .. default_highlight self.status = self.status .. default_highlight
-- Also put it in applied sep so when sep get struped so does the hl -- Also put it in applied sep so when sep get striped so does the hl
self.applied_separator = default_highlight self.applied_separator = default_highlight
end end
-- Prepend default hl when the component doesn't start with hl otherwise -- Prepend default hl when the component doesn't start with hl otherwise
@ -108,7 +108,7 @@ function M:apply_highlights(default_highlight)
end end
end end
---apply icon to component (appends/prepemds component with icon) ---apply icon to component (appends/prepends component with icon)
function M:apply_icon() function M:apply_icon()
local icon = self.options.icon local icon = self.options.icon
if self.options.icons_enabled and icon then if self.options.icons_enabled and icon then
@ -202,15 +202,15 @@ end
---create a lualine highlight for color ---create a lualine highlight for color
---@param color table|string|function defined color for hl ---@param color table|string|function defined color for hl
---@param hint string|nil hint for hl name ---@param hint string|nil hint for hl name
---@return table an identifier to later retrive the hl for application ---@return table an identifier to later retrieve the hl for application
function M:create_hl(color, hint) function M:create_hl(color, hint)
hint = hint and self.options.component_name .. '_' .. hint or self.options.component_name hint = hint and self.options.component_name .. '_' .. hint or self.options.component_name
return highlight.create_component_highlight_group(color, hint, self.options, false) return highlight.create_component_highlight_group(color, hint, self.options, false)
end end
---Get stl formated hl group for hl_token ---Get stl formatted hl group for hl_token
---@param hl_token table indentifier received from create_hl or create_component_highlight_group ---@param hl_token table identifier received from create_hl or create_component_highlight_group
---@return string stl formated hl group for hl_token ---@return string stl formatted hl group for hl_token
function M:format_hl(hl_token) function M:format_hl(hl_token)
return highlight.component_format_highlight(hl_token) return highlight.component_format_highlight(hl_token)
end end
@ -223,7 +223,7 @@ function M:update_status(is_focused) end
---driver code of the class ---driver code of the class
---@param default_highlight string default hl group of section where component resides ---@param default_highlight string default hl group of section where component resides
---@param is_focused boolean|number whether drawing for active or inactive statusline. ---@param is_focused boolean|number whether drawing for active or inactive statusline.
---@return string stl formated rendering string for component ---@return string stl formatted rendering string for component
function M:draw(default_highlight, is_focused) function M:draw(default_highlight, is_focused)
self.status = '' self.status = ''
self.applied_separator = '' self.applied_separator = ''

View File

@ -7,7 +7,7 @@ local modules = require('lualine_require').lazy_require {
utils = 'lualine.utils.utils', utils = 'lualine.utils.utils',
} }
-- Initilizer -- Initializer
M.init = function(self, options) M.init = function(self, options)
M.super.init(self, options) M.super.init(self, options)
if not self.options.icon then if not self.options.icon then

View File

@ -5,7 +5,7 @@ local modules = require('lualine_require').lazy_require {
utils = 'lualine.utils.utils', utils = 'lualine.utils.utils',
} }
---intialize a new buffer from opts ---initialize a new buffer from opts
---@param opts table ---@param opts table
function Buffer:init(opts) function Buffer:init(opts)
assert(opts.bufnr, 'Cannot create Buffer without bufnr') assert(opts.bufnr, 'Cannot create Buffer without bufnr')
@ -72,7 +72,7 @@ function Buffer:render()
name = self.options.fmt(name or '') name = self.options.fmt(name or '')
end end
if self.ellipse then -- show elipsis if self.ellipse then -- show ellipsis
name = '...' name = '...'
else else
name = self:apply_mode(name) name = self:apply_mode(name)

View File

@ -30,7 +30,7 @@ local default_options = {
} }
-- This function is duplicated in tabs -- This function is duplicated in tabs
---returns the proper hl for buffer in section. used for setting default highlights ---returns the proper hl for buffer in section. Used for setting default highlights
---@param section string name of section buffers component is in ---@param section string name of section buffers component is in
---@param is_active boolean ---@param is_active boolean
---@return string hl name ---@return string hl name
@ -178,7 +178,7 @@ function M:update_status()
data[#data + 1] = rendered_after data[#data + 1] = rendered_after
end end
end end
-- draw elipsis (...) on relevent sides if all buffers don't fit in max_length -- draw ellipsis (...) on relevant sides if all buffers don't fit in max_length
if total_length > max_length then if total_length > max_length then
if before ~= nil then if before ~= nil then
before.ellipse = true before.ellipse = true

View File

@ -57,7 +57,7 @@ function M:init(options)
modules.git_diff.init(self.options) modules.git_diff.init(self.options)
end end
-- Function that runs everytime statusline is updated -- Function that runs every time statusline is updated
function M:update_status(is_focused) function M:update_status(is_focused)
local git_diff = modules.git_diff.get_sign_count((not is_focused and vim.api.nvim_get_current_buf())) local git_diff = modules.git_diff.get_sign_count((not is_focused and vim.api.nvim_get_current_buf()))
if git_diff == nil then if git_diff == nil then

View File

@ -17,7 +17,7 @@ function M:init(options)
self.symbols = vim.tbl_extend('keep', self.options.symbols or {}, symbols) self.symbols = vim.tbl_extend('keep', self.options.symbols or {}, symbols)
end end
-- Function that runs everytime statusline is updated -- Function that runs every time statusline is updated
function M:update_status() function M:update_status()
local format = vim.bo.fileformat local format = vim.bo.fileformat
if self.options.icons_enabled then if self.options.icons_enabled then

View File

@ -4,13 +4,13 @@ local M = require('lualine.component'):extend()
function M:update_status() function M:update_status()
local component = self.options[1] local component = self.options[1]
-- vim veriable component -- vim variable component
-- accepts g:, v:, t:, w:, b:, o, go:, vo:, to:, wo:, bo: -- accepts g:, v:, t:, w:, b:, o, go:, vo:, to:, wo:, bo:
-- filters g portion from g:var -- filters g portion from g:var
local scope = component:match('[gvtwb]?o?') local scope = component:match('[gvtwb]?o?')
-- filters var portion from g:var -- filters var portion from g:var
local var_name = component:sub(#scope + 2, #component) local var_name = component:sub(#scope + 2, #component)
-- Displays nothing when veriable aren't present -- Displays nothing when variable aren't present
if not (scope and var_name) then if not (scope and var_name) then
return '' return ''
end end

View File

@ -15,7 +15,7 @@ local default_options = {
} }
-- This function is duplicated in buffers -- This function is duplicated in buffers
---returns the proper hl for tab in section. used for setting default highlights ---returns the proper hl for tab in section. Used for setting default highlights
---@param section string name of section tabs component is in ---@param section string name of section tabs component is in
---@param is_active boolean ---@param is_active boolean
---@return string hl name ---@return string hl name
@ -84,7 +84,7 @@ function M:update_status()
local current_tab = tabs[current] local current_tab = tabs[current]
-- start drawing from current tab and draw left and right of it until -- start drawing from current tab and draw left and right of it until
-- all tabpages are drawn or max_length has been reached. -- all tabpages are drawn or max_length has been reached.
if current_tab == nil then -- maybe redundent code if current_tab == nil then -- maybe redundant code
local t = Tab { local t = Tab {
tabId = vim.api.nvim_get_current_tabpage(), tabId = vim.api.nvim_get_current_tabpage(),
tabnr = vim.fn.tabpagenr(), tabnr = vim.fn.tabpagenr(),
@ -126,7 +126,7 @@ function M:update_status()
data[#data + 1] = rendered_after data[#data + 1] = rendered_after
end end
end end
-- draw elipsis (...) on relevent sides if all tabs don't fit in max_length -- draw ellipsis (...) on relevant sides if all tabs don't fit in max_length
if total_length > max_length then if total_length > max_length then
if before ~= nil then if before ~= nil then
before.ellipse = true before.ellipse = true

View File

@ -5,7 +5,7 @@ local modules = require('lualine_require').lazy_require {
utils = 'lualine.utils.utils', utils = 'lualine.utils.utils',
} }
---intialize a new tab from opts ---initialize a new tab from opts
---@param opts table ---@param opts table
function Tab:init(opts) function Tab:init(opts)
assert(opts.tabnr, 'Cannot create Tab without tabnr') assert(opts.tabnr, 'Cannot create Tab without tabnr')
@ -15,7 +15,7 @@ function Tab:init(opts)
self.highlights = opts.highlights self.highlights = opts.highlights
end end
---returns name for tab. tabs name is the name of buffer in last active window ---returns name for tab. Tabs name is the name of buffer in last active window
--- of the tab. --- of the tab.
---@return string ---@return string
function Tab:label() function Tab:label()
@ -51,7 +51,7 @@ function Tab:render()
if self.options.fmt then if self.options.fmt then
name = self.options.fmt(name or '') name = self.options.fmt(name or '')
end end
if self.ellipse then -- show elipsis if self.ellipse then -- show ellipsis
name = '...' name = '...'
else else
-- different formats for different modes -- different formats for different modes

View File

@ -7,12 +7,12 @@ local default_options = {
} }
function M:init(options) function M:init(options)
options.buffers_color = nil -- bufers_color isn't windpws option. options.buffers_color = nil -- buffers_color isn't windows option.
M.super.init(self, options) M.super.init(self, options)
self.options = vim.tbl_deep_extend('keep', self.options or {}, default_options) self.options = vim.tbl_deep_extend('keep', self.options or {}, default_options)
self.options.windows_color = vim.tbl_deep_extend('keep', self.options.windows_color or {}, self.options.buffers_color) self.options.windows_color = vim.tbl_deep_extend('keep', self.options.windows_color or {}, self.options.buffers_color)
self.options.buffers_color = nil -- this is the default value of colors generated by parent bufferes component. self.options.buffers_color = nil -- this is the default value of colors generated by parent buffers component.
self.highlights = { self.highlights = {
active = self:create_hl(self.options.windows_color.active, 'active'), active = self:create_hl(self.options.windows_color.active, 'active'),

View File

@ -1,6 +1,6 @@
local Window = require('lualine.components.buffers.buffer'):extend() local Window = require('lualine.components.buffers.buffer'):extend()
---intialize a new buffer from opts ---initialize a new buffer from opts
---@param opts table ---@param opts table
function Window:init(opts) function Window:init(opts)
assert(opts.winnr, 'Cannot create Window without winnr') assert(opts.winnr, 'Cannot create Window without winnr')

View File

@ -48,7 +48,7 @@ local function fix_separators(separators)
return separators return separators
end end
---extends config based on configtable ---extends config based on config_table
---@param config_table table ---@param config_table table
---@return table copy of config ---@return table copy of config
local function apply_configuration(config_table) local function apply_configuration(config_table)

View File

@ -95,7 +95,7 @@ end
---@param name string ---@param name string
---@param foreground string|number: color ---@param foreground string|number: color
---@param background string|number: color ---@param background string|number: color
---@param gui table cterm/gui options like bold/italic ect ---@param gui table cterm/gui options like bold/italic etc.
---@param link string hl_group name to link new hl to ---@param link string hl_group name to link new hl to
function M.highlight(name, foreground, background, gui, link) function M.highlight(name, foreground, background, gui, link)
local command = { 'highlight!' } local command = { 'highlight!' }
@ -132,10 +132,10 @@ function M.highlight(name, foreground, background, gui, link)
local old_hl_def = loaded_highlights[name] local old_hl_def = loaded_highlights[name]
if old_hl_def and next(old_hl_def.attached) then if old_hl_def and next(old_hl_def.attached) then
-- Update attached hl groups as they announced to depend on hl_group 'name' -- Update attached hl groups as they announced to depend on hl_group 'name'
-- 'hl' being in 'name'a attached table means 'hl' -- 'hl' being in 'name's attached table means 'hl'
-- depends of 'name'. -- depends of 'name'.
-- 'hl' key in attached table will contain a table that -- 'hl' key in attached table will contain a table that
-- defines the reletaion between 'hl' & 'name'. -- defines the relation between 'hl' & 'name'.
-- name.attached.hl = { bg = 'fg' } means -- name.attached.hl = { bg = 'fg' } means
-- hl's fg is same as 'names' bg . So 'hl's fg should -- hl's fg is same as 'names' bg . So 'hl's fg should
-- be updated when ever 'name' changes it's 'bg' -- be updated when ever 'name' changes it's 'bg'
@ -182,7 +182,7 @@ function M.highlight(name, foreground, background, gui, link)
} }
end end
---Attach an hl to another so attachee auto updated on change to hl it's attached too. ---Attach a hl to another, so the attachee auto updates on change to hl that it's attached too.
---@param provider string the hl receiver is getting attached to ---@param provider string the hl receiver is getting attached to
---@param receiver string the hl that will be auto updated upon change to provider ---@param receiver string the hl that will be auto updated upon change to provider
---@param provider_el_type string (fg/bg) what element receiver relates to of provider ---@param provider_el_type string (fg/bg) what element receiver relates to of provider

View File

@ -1,6 +1,6 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Generated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- stylua: ignore -- stylua: ignore
local colors = { local colors = {

View File

@ -1,6 +1,6 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Generated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- stylua: ignore -- stylua: ignore
local colors = { local colors = {

View File

@ -11,7 +11,7 @@ if color_name then
end end
-- Check if there's a theme for current colorscheme -- Check if there's a theme for current colorscheme
-- If there is load that instead of genarating a new one -- If there is load that instead of generating a new one
local ok, theme = pcall(loader.load_theme, color_name) local ok, theme = pcall(loader.load_theme, color_name)
if ok and theme then if ok and theme then
return theme return theme
@ -19,14 +19,14 @@ if color_name then
end end
--------------- ---------------
-- Constents -- -- Constants --
--------------- ---------------
-- fg and bg must have this much contrast range 0 < contrast_threshold < 0.5 -- fg and bg must have this much contrast range 0 < contrast_threshold < 0.5
local contrast_threshold = 0.3 local contrast_threshold = 0.3
-- how much brightness is changed in percentage for light and dark themes -- how much brightness is changed in percentage for light and dark themes
local brightness_modifier_parameter = 10 local brightness_modifier_parameter = 10
-- truns #rrggbb -> { red, green, blue } -- Turns #rrggbb -> { red, green, blue }
local function rgb_str2num(rgb_color_str) local function rgb_str2num(rgb_color_str)
if rgb_color_str:find('#') == 1 then if rgb_color_str:find('#') == 1 then
rgb_color_str = rgb_color_str:sub(2, #rgb_color_str) rgb_color_str = rgb_color_str:sub(2, #rgb_color_str)
@ -37,14 +37,14 @@ local function rgb_str2num(rgb_color_str)
return { red = red, green = green, blue = blue } return { red = red, green = green, blue = blue }
end end
-- turns { red, green, blue } -> #rrggbb -- Turns { red, green, blue } -> #rrggbb
local function rgb_num2str(rgb_color_num) local function rgb_num2str(rgb_color_num)
local rgb_color_str = string.format('#%02x%02x%02x', rgb_color_num.red, rgb_color_num.green, rgb_color_num.blue) local rgb_color_str = string.format('#%02x%02x%02x', rgb_color_num.red, rgb_color_num.green, rgb_color_num.blue)
return rgb_color_str return rgb_color_str
end end
-- returns brightness lavel of color in range 0 to 1 -- Returns brightness level of color in range 0 to 1
-- arbitary value it's basicaly an weighted average -- arbitrary value it's basically an weighted average
local function get_color_brightness(rgb_color) local function get_color_brightness(rgb_color)
local color = rgb_str2num(rgb_color) local color = rgb_str2num(rgb_color)
local brightness = (color.red * 2 + color.green * 3 + color.blue) / 6 local brightness = (color.red * 2 + color.green * 3 + color.blue) / 6
@ -52,13 +52,13 @@ local function get_color_brightness(rgb_color)
end end
-- returns average of colors in range 0 to 1 -- returns average of colors in range 0 to 1
-- used to ditermine contrast lavel -- used to determine contrast level
local function get_color_avg(rgb_color) local function get_color_avg(rgb_color)
local color = rgb_str2num(rgb_color) local color = rgb_str2num(rgb_color)
return (color.red + color.green + color.blue) / 3 / 256 return (color.red + color.green + color.blue) / 3 / 256
end end
-- clamps the val between left and right -- Clamps the val between left and right
local function clamp(val, left, right) local function clamp(val, left, right)
if val > right then if val > right then
return right return right
@ -69,7 +69,7 @@ local function clamp(val, left, right)
return val return val
end end
-- changes braghtness of rgb_color by percentage -- Changes brightness of rgb_color by percentage
local function brightness_modifier(rgb_color, parcentage) local function brightness_modifier(rgb_color, parcentage)
local color = rgb_str2num(rgb_color) local color = rgb_str2num(rgb_color)
color.red = clamp(color.red + (color.red * parcentage / 100), 0, 255) color.red = clamp(color.red + (color.red * parcentage / 100), 0, 255)
@ -78,7 +78,7 @@ local function brightness_modifier(rgb_color, parcentage)
return rgb_num2str(color) return rgb_num2str(color)
end end
-- changes contrast of rgb_color by amount -- Changes contrast of rgb_color by amount
local function contrast_modifier(rgb_color, amount) local function contrast_modifier(rgb_color, amount)
local color = rgb_str2num(rgb_color) local color = rgb_str2num(rgb_color)
color.red = clamp(color.red + amount, 0, 255) color.red = clamp(color.red + amount, 0, 255)
@ -87,7 +87,7 @@ local function contrast_modifier(rgb_color, amount)
return rgb_num2str(color) return rgb_num2str(color)
end end
-- Changes brightness of foreground color to achive contrast -- Changes brightness of foreground color to achieve contrast
-- without changing the color -- without changing the color
local function apply_contrast(highlight) local function apply_contrast(highlight)
local hightlight_bg_avg = get_color_avg(highlight.bg) local hightlight_bg_avg = get_color_avg(highlight.bg)
@ -97,7 +97,7 @@ local function apply_contrast(highlight)
contranst_change_step = -contranst_change_step contranst_change_step = -contranst_change_step
end end
-- donn't waste too much time here max 25 interation should be more than enough -- Don't waste too much time here max 25 iteration should be more than enough
local iteration_count = 1 local iteration_count = 1
while while
math.abs(get_color_avg(highlight.fg) - hightlight_bg_avg) < contrast_threshold_config and iteration_count < 25 math.abs(get_color_avg(highlight.fg) - hightlight_bg_avg) < contrast_threshold_config and iteration_count < 25
@ -121,8 +121,7 @@ local colors = {
} }
-- Change brightness of colors -- Change brightness of colors
-- darken incase of light theme lighten incase of dark theme -- Darken if light theme (or) Lighten if dark theme
local normal_color = utils.extract_highlight_colors('Normal', 'bg') local normal_color = utils.extract_highlight_colors('Normal', 'bg')
if normal_color ~= nil then if normal_color ~= nil then
if get_color_brightness(normal_color) > 0.5 then if get_color_brightness(normal_color) > 0.5 then
@ -133,7 +132,7 @@ if normal_color ~= nil then
end end
end end
-- basic theme defination -- Basic theme definition
local M = { local M = {
normal = { normal = {
a = { bg = colors.normal, fg = colors.back1, gui = 'bold' }, a = { bg = colors.normal, fg = colors.back1, gui = 'bold' },
@ -165,7 +164,7 @@ local M = {
M.terminal = M.command M.terminal = M.command
M.inactive = M.normal M.inactive = M.normal
-- Apply prpper contrast so text is readable -- Apply proper contrast so text is readable
for _, section in pairs(M) do for _, section in pairs(M) do
for _, highlight in pairs(section) do for _, highlight in pairs(section) do
apply_contrast(highlight) apply_contrast(highlight)

View File

@ -1,6 +1,6 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Generated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- stylua: ignore -- stylua: ignore
local colors = { local colors = {

View File

@ -1,6 +1,6 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Generated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- stylua: ignore -- stylua: ignore
local colors = { local colors = {

View File

@ -1,6 +1,6 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Generated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- stylua: ignore -- stylua: ignore
local colors = { local colors = {

View File

@ -1,6 +1,6 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Generated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- stylua: ignore -- stylua: ignore
local colors = { local colors = {

View File

@ -1,6 +1,6 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Generated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- stylua: ignore -- stylua: ignore
local colors = { local colors = {

View File

@ -1,6 +1,6 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Generated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- stylua: ignore -- stylua: ignore
local colors = { local colors = {

View File

@ -1,6 +1,6 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter -- Generated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9 -- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- stylua: ignore -- stylua: ignore
local colors = { local colors = {

View File

@ -8,7 +8,7 @@ Object.__index = Object
function Object:init(...) end function Object:init(...) end
-- luacheck: pop -- luacheck: pop
---Extened base class to create a child class ---Extend base class to create a child class
function Object:extend() function Object:extend()
local cls = {} local cls = {}
for k, v in pairs(self) do for k, v in pairs(self) do

View File

@ -274,7 +274,7 @@ local color_table = {
} }
-- stylua: ignore end -- stylua: ignore end
---converts #rrggbb fomated color to cterm ('0'-'255') color ---converts #rrggbb formatted color to cterm ('0'-'255') color
---@param hex_color string ---@param hex_color string
---@return string ---@return string
function M.rgb2cterm(hex_color) function M.rgb2cterm(hex_color)
@ -306,7 +306,7 @@ function M.rgb2cterm(hex_color)
return closest_cterm_color return closest_cterm_color
end end
---converts color name (only ones supported by neovim) formated colors to #rrggbb ---converts color name (only ones supported by neovim) formatted colors to #rrggbb
---@param name string like red,green,grey ---@param name string like red,green,grey
---@return string ---@return string
function M.color_name2rgb(name) function M.color_name2rgb(name)

View File

@ -1,7 +1,7 @@
-- Copyright (c) 2020-2021 shadmansaleh -- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details. -- MIT license, see LICENSE for more details.
--- wrapper arround job api --- wrapper around job api
--- creates a job handler when called --- creates a job handler when called
local Job = setmetatable({ local Job = setmetatable({
--- start the job --- start the job
@ -9,7 +9,7 @@ local Job = setmetatable({
self.job_id = vim.fn.jobstart(self.args.cmd, self.args) self.job_id = vim.fn.jobstart(self.args.cmd, self.args)
return self.job_id > 0 return self.job_id > 0
end, end,
--- stop the job. also imidiately disables io from the job. --- stop the job. Also immediately disables io from the job.
stop = function(self) stop = function(self)
if self.killed then if self.killed then
return return

View File

@ -12,7 +12,7 @@ local sep = lualine_require.sep
--- function that loads specific type of component --- function that loads specific type of component
local component_types = { local component_types = {
-- loads custion component -- loads custom component
custom = function(component) custom = function(component)
return component[1](component) return component[1](component)
end, end,
@ -42,7 +42,7 @@ local component_types = {
end end
return require('lualine.components.special.function_component')(component) return require('lualine.components.special.function_component')(component)
end, end,
--- loads variables & options (g:,go:,b:,bo:...) as componenta --- loads variables & options (g:,go:,b:,bo:...) as components
var = function(component) var = function(component)
return require('lualine.components.special.vim_var_component')(component) return require('lualine.components.special.vim_var_component')(component)
end, end,
@ -52,7 +52,7 @@ local component_types = {
end, end,
} }
---load a component from component confif ---load a component from component config
---@param component table component + component options ---@param component table component + component options
---@return table the loaded & initialized component ---@return table the loaded & initialized component
local function component_loader(component) local function component_loader(component)
@ -110,7 +110,7 @@ Something like:
This commonly occurs when you forget to pass table with option for component. This commonly occurs when you forget to pass table with option for component.
When a component has option that component needs to be a table which holds When a component has option that component needs to be a table which holds
the component as first element and the options as key value paris. the component as first element and the options as key value pairs.
For example: For example:
```lua ```lua
lualine_c = { lualine_c = {
@ -159,7 +159,7 @@ local function load_components(config)
end end
---loads all the extensions ---loads all the extensions
---@param config table user confif ---@param config table user config
local function load_extensions(config) local function load_extensions(config)
local loaded_extensions = {} local loaded_extensions = {}
for _, extension in pairs(config.extensions) do for _, extension in pairs(config.extensions) do
@ -207,9 +207,9 @@ local function load_all(config)
end end
---loads a theme from lua module ---loads a theme from lua module
---priotizes external themes (from user config or other plugins) over the bundled ones ---prioritizes external themes (from user config or other plugins) over the bundled ones
---@param theme_name string ---@param theme_name string
---@return table theme defination from module ---@return table theme definition from module
local function load_theme(theme_name) local function load_theme(theme_name)
assert(is_valid_filename(theme_name), 'Invalid filename') assert(is_valid_filename(theme_name), 'Invalid filename')
local retval local retval

View File

@ -6,8 +6,8 @@ local M = {}
-- attr parameter like bold/italic/reverse -- attr parameter like bold/italic/reverse
---@param color_group string hl_group name ---@param color_group string hl_group name
---@param scope string bg | fg ---@param scope string bg | fg
---@return table|string returns #rrggbb formated color when scope is specified ---@return table|string returns #rrggbb formatted color when scope is specified
---- or comolete color table when scope isn't specified ---- or complete color table when scope isn't specified
function M.extract_highlight_colors(color_group, scope) function M.extract_highlight_colors(color_group, scope)
local color = require('lualine.highlight').get_lualine_hl(color_group) local color = require('lualine.highlight').get_lualine_hl(color_group)
if not color then if not color then
@ -30,7 +30,7 @@ function M.extract_highlight_colors(color_group, scope)
return color return color
end end
--- retrives color value from highlight group name in syntax_list --- retrieves color value from highlight group name in syntax_list
--- first present highlight is returned --- first present highlight is returned
---@param scope string ---@param scope string
---@param syntaxlist table ---@param syntaxlist table
@ -70,24 +70,24 @@ end
--- Check if a auto command is already defined --- Check if a auto command is already defined
---@param event string ---@param event string
---@param patern string ---@param pattern string
---@param command_str string ---@param command_str string
---@return boolean whether autocmd is already defined ---@return boolean whether autocmd is already defined
local function autocmd_is_defined(event, patern, command_str) local function autocmd_is_defined(event, pattern, command_str)
return vim.api.nvim_exec(string.format('au lualine %s %s', event, patern), true):find(command_str) ~= nil return vim.api.nvim_exec(string.format('au lualine %s %s', event, pattern), true):find(command_str) ~= nil
end end
--- Define a auto command if it's not already defined --- Define a auto command if it's not already defined
---@param event string event name ---@param event string event name
---@param patern string event patern ---@param pattern string event pattern
---@param cmd string command to run on event ---@param cmd string command to run on event
function M.define_autocmd(event, patern, cmd) function M.define_autocmd(event, pattern, cmd)
if not cmd then if not cmd then
cmd = patern cmd = pattern
patern = '*' pattern = '*'
end end
if not autocmd_is_defined(event, patern, cmd) then if not autocmd_is_defined(event, pattern, cmd) then
vim.cmd(string.format('autocmd lualine %s %s %s', event, patern, cmd)) vim.cmd(string.format('autocmd lualine %s %s %s', event, pattern, cmd))
end end
end end
@ -96,10 +96,10 @@ function M.is_focused()
return tonumber(vim.g.actual_curwin) == vim.api.nvim_get_current_win() return tonumber(vim.g.actual_curwin) == vim.api.nvim_get_current_win()
end end
--- Check what's the charecter at pos --- Check what's the character at pos
---@param str string ---@param str string
---@param pos number ---@param pos number
---@return string charecter at position pos in string str ---@return string character at position pos in string str
function M.charAt(str, pos) function M.charAt(str, pos)
return string.char(str:byte(pos)) return string.char(str:byte(pos))
end end
@ -166,7 +166,7 @@ end
--- Wrap a function in retry_call --- Wrap a function in retry_call
---@param fn function Function to call. ---@param fn function Function to call.
---@param times number Number of times to retry on error. ---@param times number Number of times to retry on error.
---@return function retry call wraped function ---@return function retry call wrapped function
function M.retry_call_wrap(fn, times) function M.retry_call_wrap(fn, times)
return function(...) return function(...)
return M.retry_call(fn, { ... }, times) return M.retry_call(fn, { ... }, times)

View File

@ -11,7 +11,7 @@ PANVIMDOC_VERSION="NVIM v0.5.0"
PANVIMDOC_TOC=true PANVIMDOC_TOC=true
PANDOC_OUTPUT="doc/lualine.txt" PANDOC_OUTPUT="doc/lualine.txt"
PANVIMDOC_INSTALLED=false # Whther panvimdoc was installed by this script PANVIMDOC_INSTALLED=false # Whether panvimdoc was installed by this script
if [ ! -d "panvimdoc/" ];then if [ ! -d "panvimdoc/" ];then
# Grab panvimdoc if not present # Grab panvimdoc if not present
@ -22,7 +22,7 @@ if [ ! -d "panvimdoc/" ];then
"https://github.com/kdheepak/panvimdoc" "panvimdoc" "https://github.com/kdheepak/panvimdoc" "panvimdoc"
fi fi
echo "Genarating docs" echo "Generating docs"
pandoc --metadata=project:"${PANVIMDOC_VIMDOC}"\ pandoc --metadata=project:"${PANVIMDOC_VIMDOC}"\
--metadata=toc:${PANVIMDOC_TOC}\ --metadata=toc:${PANVIMDOC_TOC}\
--metadata=vimversion:"${PANVIMDOC_VERSION}"\ --metadata=vimversion:"${PANVIMDOC_VERSION}"\

View File

@ -7,7 +7,7 @@ USAGE="Usage nvim_isolated_conf.sh [OPTIONS] Directory
A tool to easily test isolated neovim config A tool to easily test isolated neovim config
Options: Options:
-c Create a mimimal config tree at Directory -c Create a minimal config tree at Directory
-e Edit init.vim of config in Directory -e Edit init.vim of config in Directory
-h Show this message -h Show this message
-l Load neovim with config from Directory -l Load neovim with config from Directory

View File

@ -28,7 +28,7 @@ function M.init_component(component, opts)
return comp return comp
end end
-- Checks ouput of a component -- Checks output of a component
M.assert_component = function(component, opts, result, is_active) M.assert_component = function(component, opts, result, is_active)
local comp = M.init_component(component, opts) local comp = M.init_component(component, opts)
-- for testing global options -- for testing global options

View File

@ -16,9 +16,9 @@ describe('Utils', function()
eq(utils.extract_highlight_colors('hl2'), nil) eq(utils.extract_highlight_colors('hl2'), nil)
-- create highlight -- create highlight
vim.cmd(string.format('hi hl2 guifg=%s guibg=%s gui=reverse', hl2.fg, hl2.bg)) vim.cmd(string.format('hi hl2 guifg=%s guibg=%s gui=reverse', hl2.fg, hl2.bg))
-- Can retrive entire highlight table -- Can retrieve entire highlight table
eq(utils.extract_highlight_colors('hl2'), hl2) eq(utils.extract_highlight_colors('hl2'), hl2)
-- Can retrive specific parts of highlight -- Can retrieve specific parts of highlight
eq(utils.extract_highlight_colors('hl2', 'fg'), hl2.fg) eq(utils.extract_highlight_colors('hl2', 'fg'), hl2.fg)
-- clear hl2 -- clear hl2
vim.cmd('hi clear hl2') vim.cmd('hi clear hl2')