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:
parent
c12b167310
commit
b61afc44e6
|
@ -3,36 +3,39 @@
|
|||
Thanks for considering to contribute.
|
||||
|
||||
### 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
|
||||
cool feature idea. You should also look at currently open prs to see
|
||||
if some abandoned pr interests you<br>
|
||||
|
||||
If 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 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 :)*
|
||||
- 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.
|
||||
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.
|
||||
- Feel free to open issues or unfinished pr for help.
|
||||
I'd actually recommend you to open an issue first for bigging prs to discuss
|
||||
the feature with maintainer beforehand. That way you'll can know if the
|
||||
feature is likely to be accepted or not before you get started also you'll
|
||||
get recommendation and help with implementation specially if you show
|
||||
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 PRs for help.
|
||||
I'd actually recommend you to open an issue first for bigger PRs to discuss
|
||||
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.
|
||||
You'll get recommendation and help with implementation specially if you show
|
||||
willingness to implement it yourself.
|
||||
- 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.*
|
||||
|
||||
- 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)
|
||||
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.
|
||||
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
|
||||
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.
|
||||
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
|
||||
|
@ -41,5 +44,5 @@ Good luck.
|
|||
- You can check our test coverage with `make testcov`.
|
||||
You'll need to have [luacov](https://github.com/keplerproject/luacov)
|
||||
& [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`
|
||||
|
|
13
README.md
13
README.md
|
@ -465,7 +465,7 @@ sections = {
|
|||
|
||||
symbols = {
|
||||
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
|
||||
},
|
||||
}
|
||||
|
@ -685,29 +685,35 @@ tabline = {
|
|||
```
|
||||
|
||||
#### Buffers
|
||||
|
||||
Shows currently open buffers. Like bufferline . See
|
||||
[buffers options](#buffers-component-options)
|
||||
for all builtin behaviors of buffers component.
|
||||
You can use `:LualineBuffersJump` to jump to buffer based on index
|
||||
of buffer in buffers component.
|
||||
|
||||
```vim
|
||||
:LualineBuffersJump 2 " Jumps to 2nd buffer in buffers component.
|
||||
:LualineBuffersJump $ " Jumps to last buffer in buffers component.
|
||||
```
|
||||
|
||||
#### Tabs
|
||||
|
||||
Shows currently open tab. Like usual tabline. See
|
||||
[tabs options](#tabs-component-options)
|
||||
for all builtin behaviors of tabs component.
|
||||
You can also use `:LualineRenameTab` to set a name for a tabpage.
|
||||
For example:
|
||||
|
||||
```vim
|
||||
:LualineRenameTab Project_K
|
||||
````
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
You can also completely move your statusline to a tabline by configuring
|
||||
`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.
|
||||
|
||||
### Support
|
||||
|
||||
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>
|
||||
|
|
39
THEMES.md
39
THEMES.md
|
@ -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.
|
||||
|
||||
### auto
|
||||
|
||||
auto is a special theme. It will automatically load theme for your colorscheme.
|
||||
If there's no theme available for your colorscheme then
|
||||
it'll try it's best to generate one.
|
||||
|
||||
### 16color
|
||||
|
||||
<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/108648219-f77f8280-74ba-11eb-84e4-978bf918c21f.png'/>
|
||||
|
@ -16,6 +18,7 @@ it'll try it's best to generate one.
|
|||
</p>
|
||||
|
||||
### ayu_dark
|
||||
|
||||
<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/108648329-3e6d7800-74bb-11eb-901b-41e1f01315f0.png'/>
|
||||
|
@ -24,6 +27,7 @@ it'll try it's best to generate one.
|
|||
</p>
|
||||
|
||||
### ayu_light
|
||||
|
||||
<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/108648511-b89dfc80-74bb-11eb-9868-f63d7752fe83.png'/>
|
||||
|
@ -32,6 +36,7 @@ it'll try it's best to generate one.
|
|||
</p>
|
||||
|
||||
### ayu_mirage
|
||||
|
||||
<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/108648537-c784af00-74bb-11eb-8da5-d91bfc61a967.png'/>
|
||||
|
@ -40,6 +45,7 @@ it'll try it's best to generate one.
|
|||
</p>
|
||||
|
||||
### ayu
|
||||
|
||||
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
|
||||
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>
|
||||
|
||||
### codedark
|
||||
|
||||
<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/108648569-e125f680-74bb-11eb-8782-db9a6c2a3153.png'/>
|
||||
|
@ -67,6 +74,7 @@ The following example is using the `tomorrow-night` colorscheme:
|
|||
</p>
|
||||
|
||||
### dracula
|
||||
|
||||
<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/108648600-f26f0300-74bb-11eb-82a4-f732b3e7eeff.png'/>
|
||||
|
@ -75,6 +83,7 @@ The following example is using the `tomorrow-night` colorscheme:
|
|||
</p>
|
||||
|
||||
### everforest
|
||||
|
||||
<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/108648667-1df1ed80-74bc-11eb-9ef8-dfd2e8401f0c.png'/>
|
||||
|
@ -83,6 +92,7 @@ The following example is using the `tomorrow-night` colorscheme:
|
|||
</p>
|
||||
|
||||
### gruvbox_dark
|
||||
|
||||
<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/108648693-2ea26380-74bc-11eb-831a-9ebbe4f3dd83.png'/>
|
||||
|
@ -91,6 +101,7 @@ The following example is using the `tomorrow-night` colorscheme:
|
|||
</p>
|
||||
|
||||
### gruvbox_light
|
||||
|
||||
<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/118757009-5bd19880-b896-11eb-9846-d02b16653ab0.png'/>
|
||||
|
@ -99,10 +110,12 @@ The following example is using the `tomorrow-night` colorscheme:
|
|||
</p>
|
||||
|
||||
### gruvbox
|
||||
|
||||
It's a combination of gruvbox_light and gruvbox_dark. It loads either of
|
||||
them based you your `background` option.
|
||||
|
||||
### gruvbox-material
|
||||
|
||||
<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/108648728-41b53380-74bc-11eb-99cf-001eab6cc51b.png'/>
|
||||
|
@ -111,6 +124,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### horizon
|
||||
|
||||
<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/118902058-bc9bb800-b90c-11eb-99b8-3b98cbdd01d7.png'/>
|
||||
|
@ -119,6 +133,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### iceberg_dark
|
||||
|
||||
<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/108648813-64474c80-74bc-11eb-986b-432498dd6245.png'/>
|
||||
|
@ -127,6 +142,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### iceberg_light
|
||||
|
||||
<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/108648849-73c69580-74bc-11eb-93f9-d6f75a2bdd97.png'/>
|
||||
|
@ -135,10 +151,12 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### iceberg
|
||||
|
||||
It's a combination of iceberg_light and iceberg_dark. It loads either of
|
||||
them based you your `background` option.
|
||||
|
||||
### jellybeans
|
||||
|
||||
<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/108648883-850fa200-74bc-11eb-8d9b-54116accd2f8.png'/>
|
||||
|
@ -147,6 +165,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### material
|
||||
|
||||
<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/108648927-9f498000-74bc-11eb-8a15-4ba68403037a.png'/>
|
||||
|
@ -155,6 +174,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### modus-vivendi
|
||||
|
||||
<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/114390000-606fa680-9b9e-11eb-97dd-ef5bbc23049a.png'/>
|
||||
|
@ -163,6 +183,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### molokai
|
||||
|
||||
<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/108648946-acff0580-74bc-11eb-9aae-36a869b855e5.png'/>
|
||||
|
@ -171,6 +192,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### moonfly
|
||||
|
||||
<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/129304441-81a6c88e-364c-476a-9050-0ada4cae1e3b.png'/>
|
||||
|
@ -179,6 +201,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### nightfly
|
||||
|
||||
<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/108648977-bab48b00-74bc-11eb-96b3-7f51fc73d8e8.png'/>
|
||||
|
@ -187,6 +210,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### nord
|
||||
|
||||
<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/108649010-cd2ec480-74bc-11eb-9d9b-54fadee2abef.png'/>
|
||||
|
@ -195,6 +219,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### OceanicNext
|
||||
|
||||
<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/108649043-d91a8680-74bc-11eb-9b1b-9c2e88ede3aa.png'/>
|
||||
|
@ -203,6 +228,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### onedark
|
||||
|
||||
<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/150811104-31fbc04c-1500-4779-a079-98bd1e56701d.png'/>
|
||||
|
@ -211,6 +237,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### onelight
|
||||
|
||||
<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/150809979-237c6414-4278-447d-a00f-0a32e2770195.png'/>
|
||||
|
@ -219,6 +246,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### palenight
|
||||
|
||||
<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/109406547-3e1d2300-797a-11eb-9b72-43ba7145355d.png'/>
|
||||
|
@ -227,6 +255,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### papercolor_dark
|
||||
|
||||
<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/108649106-fe0ef980-74bc-11eb-93f7-f98e0b89d5c9.png'/>
|
||||
|
@ -235,6 +264,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### papercolor_light
|
||||
|
||||
<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/108649129-08c98e80-74bd-11eb-93d4-5bc109ac9ee9.png'/>
|
||||
|
@ -243,10 +273,12 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### PaperColor
|
||||
|
||||
It's a combination of papercolor_light and papercolor_dark. It loads either of
|
||||
them based you your `background` option.
|
||||
|
||||
### powerline
|
||||
|
||||
<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/108649150-15e67d80-74bd-11eb-8815-194c51d96016.png'/>
|
||||
|
@ -255,6 +287,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### powerline_dark
|
||||
|
||||
<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/131224418-7bec491b-1183-4ec7-8089-3dbe460cc1e4.png'/>
|
||||
|
@ -263,6 +296,7 @@ them based you your `background` option.
|
|||
</p>
|
||||
|
||||
### 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.
|
||||
|
||||
#### `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'/>
|
||||
|
||||
### seoul256
|
||||
|
||||
<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/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>
|
||||
|
||||
### solarized_dark
|
||||
|
||||
<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/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>
|
||||
|
||||
### solarized_light
|
||||
|
||||
<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/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>
|
||||
|
||||
### Tomorrow
|
||||
|
||||
<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/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>
|
||||
|
||||
### wombat
|
||||
|
||||
<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/108649411-8db4a800-74bd-11eb-962a-8b73f9fb7124.png'/>
|
||||
|
|
|
@ -12,8 +12,8 @@ local modules = lualine_require.lazy_require {
|
|||
local config -- Stores currently applied config
|
||||
|
||||
-- Helper for apply_transitional_separators()
|
||||
--- finds first applied highlight group fter str_checked in status
|
||||
---@param status string : unprossed statusline string
|
||||
--- finds first applied highlight group after str_checked in status
|
||||
---@param status string : unprocessed statusline string
|
||||
---@param str_checked number : position of how far status has been checked
|
||||
---@return string|nil the hl group name or nil
|
||||
local function find_next_hl(status, str_checked)
|
||||
|
@ -36,11 +36,11 @@ end
|
|||
|
||||
-- Helper for apply_transitional_separators()
|
||||
--- 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 last_hl string : last applied hl group name before str_checked
|
||||
---@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)
|
||||
-- Inserts transitional separator along with transitional highlight
|
||||
local next_hl = find_next_hl(status, str_checked)
|
||||
|
@ -63,12 +63,12 @@ end
|
|||
|
||||
--- processes statusline string
|
||||
--- 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
|
||||
local function apply_transitional_separators(status, is_focused)
|
||||
local status_applied = {} -- Collects all the pieces for concatation
|
||||
local last_hl -- Stores lash highligjt group that we found
|
||||
local last_hl_reseted = false -- Whether last_hl is nil because we reseted
|
||||
local status_applied = {} -- Collects all the pieces for concatenation
|
||||
local last_hl -- Stores last highlight group that we found
|
||||
local last_hl_reseted = false -- Whether last_hl is nil after reset
|
||||
-- it after %=
|
||||
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
|
||||
|
@ -120,10 +120,10 @@ local function apply_transitional_separators(status, is_focused)
|
|||
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
|
||||
-- TODO: Fix this properly
|
||||
-- This check for lualine_a and lualine_b is dumb. It doesn't garantee
|
||||
-- c or x section isn't present. Worst case sinario after this patch
|
||||
-- This check for lualine_a and lualine_b is dumb. It doesn't guarantee
|
||||
-- c or x section isn't present. Worst case scenario after this patch
|
||||
-- we have another visual bug that occurs less frequently.
|
||||
-- Annoying Edge Cases............................................
|
||||
-- Annoying Edge Cases
|
||||
last_hl = nil
|
||||
last_hl_reseted = true
|
||||
str_checked = str_checked + 1 -- Skip the following % too
|
||||
|
@ -138,7 +138,7 @@ end
|
|||
--- creates the statusline string
|
||||
---@param sections table : section config where components are replaced with
|
||||
--- 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
|
||||
local statusline = modules.utils.retry_call_wrap(function(sections, is_focused)
|
||||
-- The sequence sections should maintain [SECTION_SEQUENCE]
|
||||
|
@ -176,10 +176,10 @@ end)
|
|||
|
||||
--- check if any extension matches the filetype and return proper sections
|
||||
---@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
|
||||
--- 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
|
||||
-- or some kind of cond ?
|
||||
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))
|
||||
end
|
||||
|
||||
--- 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
|
||||
--- if it's a table directlybuses it .
|
||||
--- when theme load fails this fallsback to 'auto' theme if even that fails
|
||||
--- this falls back to 'gruvbox' theme
|
||||
--- also sets up auto command to reload lualine on ColorScheme or background
|
||||
--- change on
|
||||
--- Sets up theme by defining hl groups and setting theme cache in 'highlight.lua'.
|
||||
--- Uses 'options.theme' variable to apply the theme:
|
||||
--- - If the value is a string, it'll load a theme of that name.
|
||||
--- - If it's a table, it's directly used as the theme.
|
||||
--- If loading the theme fails, this falls back to 'auto' theme.
|
||||
--- If the 'auto' theme also fails, this falls back to 'gruvbox' theme.
|
||||
--- Also sets up auto command to reload lualine on ColorScheme or background changes.
|
||||
local function setup_theme()
|
||||
local function get_theme_from_config()
|
||||
local theme_name = config.options.theme
|
||||
|
@ -263,7 +263,7 @@ local function set_tabline()
|
|||
end
|
||||
end
|
||||
|
||||
--- Sets &ststusline option to lualine
|
||||
--- Sets &statusline option to lualine
|
||||
--- adds auto command to redraw lualine on VimResized event
|
||||
local function set_statusline()
|
||||
if next(config.sections) ~= nil or next(config.inactive_sections) ~= nil then
|
||||
|
@ -282,7 +282,7 @@ end
|
|||
|
||||
-- lualine.statusline function
|
||||
--- 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
|
||||
local function status_dispatch(focused)
|
||||
local retval
|
||||
|
@ -313,12 +313,12 @@ end
|
|||
|
||||
-- lualine.setup function
|
||||
--- sets new user config
|
||||
--- This function doesn't load components/theme etc.. they are done before
|
||||
--- first statusline redraw after new config. This is more efficient when
|
||||
--- lualine config is done in several setup calls in chunks. This way
|
||||
--- we don't intialize components just to throgh them away .Instead they are
|
||||
--- This function doesn't load components/theme etc... They are done before
|
||||
--- first statusline redraw and after new config. This is more efficient when
|
||||
--- lualine config is done in several setup calls as chunks. This way
|
||||
--- we don't initialize components just to throw them away. Instead they are
|
||||
--- initialized when we know we will use them.
|
||||
--- sets &last_status tl 2
|
||||
--- sets &last_status to 2
|
||||
---@param user_config table table
|
||||
local function setup(user_config)
|
||||
if package.loaded['lualine.utils.notices'] then
|
||||
|
|
|
@ -34,7 +34,7 @@ function M:init(options)
|
|||
end
|
||||
|
||||
---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()
|
||||
if self.options.separator == nil then
|
||||
if self.options.component_separators then
|
||||
|
@ -73,7 +73,7 @@ function M:apply_padding()
|
|||
end
|
||||
if l_padding 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
|
||||
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)
|
||||
|
@ -95,10 +95,10 @@ function M:apply_highlights(default_highlight)
|
|||
end
|
||||
if type(self.options.separator) ~= 'table' and self.status:find('%%#') then
|
||||
-- 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
|
||||
-- regular sep in those cases so ending with default hl isn't neccessay
|
||||
-- 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 necessary
|
||||
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
|
||||
end
|
||||
-- Prepend default hl when the component doesn't start with hl otherwise
|
||||
|
@ -108,7 +108,7 @@ function M:apply_highlights(default_highlight)
|
|||
end
|
||||
end
|
||||
|
||||
---apply icon to component (appends/prepemds component with icon)
|
||||
---apply icon to component (appends/prepends component with icon)
|
||||
function M:apply_icon()
|
||||
local icon = self.options.icon
|
||||
if self.options.icons_enabled and icon then
|
||||
|
@ -202,15 +202,15 @@ end
|
|||
---create a lualine highlight for color
|
||||
---@param color table|string|function defined color for hl
|
||||
---@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)
|
||||
hint = hint and self.options.component_name .. '_' .. hint or self.options.component_name
|
||||
return highlight.create_component_highlight_group(color, hint, self.options, false)
|
||||
end
|
||||
|
||||
---Get stl formated hl group for hl_token
|
||||
---@param hl_token table indentifier received from create_hl or create_component_highlight_group
|
||||
---@return string stl formated hl group for hl_token
|
||||
---Get stl formatted hl group for hl_token
|
||||
---@param hl_token table identifier received from create_hl or create_component_highlight_group
|
||||
---@return string stl formatted hl group for hl_token
|
||||
function M:format_hl(hl_token)
|
||||
return highlight.component_format_highlight(hl_token)
|
||||
end
|
||||
|
@ -223,7 +223,7 @@ function M:update_status(is_focused) end
|
|||
---driver code of the class
|
||||
---@param default_highlight string default hl group of section where component resides
|
||||
---@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)
|
||||
self.status = ''
|
||||
self.applied_separator = ''
|
||||
|
|
|
@ -7,7 +7,7 @@ local modules = require('lualine_require').lazy_require {
|
|||
utils = 'lualine.utils.utils',
|
||||
}
|
||||
|
||||
-- Initilizer
|
||||
-- Initializer
|
||||
M.init = function(self, options)
|
||||
M.super.init(self, options)
|
||||
if not self.options.icon then
|
||||
|
|
|
@ -5,7 +5,7 @@ local modules = require('lualine_require').lazy_require {
|
|||
utils = 'lualine.utils.utils',
|
||||
}
|
||||
|
||||
---intialize a new buffer from opts
|
||||
---initialize a new buffer from opts
|
||||
---@param opts table
|
||||
function Buffer:init(opts)
|
||||
assert(opts.bufnr, 'Cannot create Buffer without bufnr')
|
||||
|
@ -72,7 +72,7 @@ function Buffer:render()
|
|||
name = self.options.fmt(name or '')
|
||||
end
|
||||
|
||||
if self.ellipse then -- show elipsis
|
||||
if self.ellipse then -- show ellipsis
|
||||
name = '...'
|
||||
else
|
||||
name = self:apply_mode(name)
|
||||
|
|
|
@ -30,7 +30,7 @@ local default_options = {
|
|||
}
|
||||
|
||||
-- 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 is_active boolean
|
||||
---@return string hl name
|
||||
|
@ -178,7 +178,7 @@ function M:update_status()
|
|||
data[#data + 1] = rendered_after
|
||||
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 before ~= nil then
|
||||
before.ellipse = true
|
||||
|
|
|
@ -4,13 +4,13 @@ local M = require('lualine.component'):extend()
|
|||
|
||||
function M:update_status()
|
||||
local component = self.options[1]
|
||||
-- vim veriable component
|
||||
-- vim variable component
|
||||
-- accepts g:, v:, t:, w:, b:, o, go:, vo:, to:, wo:, bo:
|
||||
-- filters g portion from g:var
|
||||
local scope = component:match('[gvtwb]?o?')
|
||||
-- filters var portion from g:var
|
||||
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
|
||||
return ''
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ local default_options = {
|
|||
}
|
||||
|
||||
-- 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 is_active boolean
|
||||
---@return string hl name
|
||||
|
@ -84,7 +84,7 @@ function M:update_status()
|
|||
local current_tab = tabs[current]
|
||||
-- start drawing from current tab and draw left and right of it until
|
||||
-- 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 {
|
||||
tabId = vim.api.nvim_get_current_tabpage(),
|
||||
tabnr = vim.fn.tabpagenr(),
|
||||
|
@ -126,7 +126,7 @@ function M:update_status()
|
|||
data[#data + 1] = rendered_after
|
||||
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 before ~= nil then
|
||||
before.ellipse = true
|
||||
|
|
|
@ -5,7 +5,7 @@ local modules = require('lualine_require').lazy_require {
|
|||
utils = 'lualine.utils.utils',
|
||||
}
|
||||
|
||||
---intialize a new tab from opts
|
||||
---initialize a new tab from opts
|
||||
---@param opts table
|
||||
function Tab:init(opts)
|
||||
assert(opts.tabnr, 'Cannot create Tab without tabnr')
|
||||
|
@ -15,7 +15,7 @@ function Tab:init(opts)
|
|||
self.highlights = opts.highlights
|
||||
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.
|
||||
---@return string
|
||||
function Tab:label()
|
||||
|
@ -51,7 +51,7 @@ function Tab:render()
|
|||
if self.options.fmt then
|
||||
name = self.options.fmt(name or '')
|
||||
end
|
||||
if self.ellipse then -- show elipsis
|
||||
if self.ellipse then -- show ellipsis
|
||||
name = '...'
|
||||
else
|
||||
-- different formats for different modes
|
||||
|
|
|
@ -7,12 +7,12 @@ local default_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)
|
||||
|
||||
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.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 = {
|
||||
active = self:create_hl(self.options.windows_color.active, 'active'),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
local Window = require('lualine.components.buffers.buffer'):extend()
|
||||
|
||||
---intialize a new buffer from opts
|
||||
---initialize a new buffer from opts
|
||||
---@param opts table
|
||||
function Window:init(opts)
|
||||
assert(opts.winnr, 'Cannot create Window without winnr')
|
||||
|
|
|
@ -48,7 +48,7 @@ local function fix_separators(separators)
|
|||
return separators
|
||||
end
|
||||
|
||||
---extends config based on configtable
|
||||
---extends config based on config_table
|
||||
---@param config_table table
|
||||
---@return table copy of config
|
||||
local function apply_configuration(config_table)
|
||||
|
|
|
@ -95,7 +95,7 @@ end
|
|||
---@param name string
|
||||
---@param foreground 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
|
||||
function M.highlight(name, foreground, background, gui, link)
|
||||
local command = { 'highlight!' }
|
||||
|
@ -132,10 +132,10 @@ function M.highlight(name, foreground, background, gui, link)
|
|||
local old_hl_def = loaded_highlights[name]
|
||||
if old_hl_def and next(old_hl_def.attached) then
|
||||
-- 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'.
|
||||
-- '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
|
||||
-- hl's fg is same as 'names' bg . So 'hl's fg should
|
||||
-- be updated when ever 'name' changes it's 'bg'
|
||||
|
@ -182,7 +182,7 @@ function M.highlight(name, foreground, background, gui, link)
|
|||
}
|
||||
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 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- Copyright (c) 2020-2021 shadmansaleh
|
||||
-- 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
|
||||
-- stylua: ignore
|
||||
local colors = {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- Copyright (c) 2020-2021 shadmansaleh
|
||||
-- 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
|
||||
-- stylua: ignore
|
||||
local colors = {
|
||||
|
|
|
@ -11,7 +11,7 @@ if color_name then
|
|||
end
|
||||
|
||||
-- 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)
|
||||
if ok and theme then
|
||||
return theme
|
||||
|
@ -19,14 +19,14 @@ if color_name then
|
|||
end
|
||||
|
||||
---------------
|
||||
-- Constents --
|
||||
-- Constants --
|
||||
---------------
|
||||
-- fg and bg must have this much contrast range 0 < contrast_threshold < 0.5
|
||||
local contrast_threshold = 0.3
|
||||
-- how much brightness is changed in percentage for light and dark themes
|
||||
local brightness_modifier_parameter = 10
|
||||
|
||||
-- truns #rrggbb -> { red, green, blue }
|
||||
-- Turns #rrggbb -> { red, green, blue }
|
||||
local function rgb_str2num(rgb_color_str)
|
||||
if rgb_color_str:find('#') == 1 then
|
||||
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 }
|
||||
end
|
||||
|
||||
-- turns { red, green, blue } -> #rrggbb
|
||||
-- Turns { red, green, blue } -> #rrggbb
|
||||
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)
|
||||
return rgb_color_str
|
||||
end
|
||||
|
||||
-- returns brightness lavel of color in range 0 to 1
|
||||
-- arbitary value it's basicaly an weighted average
|
||||
-- Returns brightness level of color in range 0 to 1
|
||||
-- arbitrary value it's basically an weighted average
|
||||
local function get_color_brightness(rgb_color)
|
||||
local color = rgb_str2num(rgb_color)
|
||||
local brightness = (color.red * 2 + color.green * 3 + color.blue) / 6
|
||||
|
@ -52,13 +52,13 @@ local function get_color_brightness(rgb_color)
|
|||
end
|
||||
|
||||
-- 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 color = rgb_str2num(rgb_color)
|
||||
return (color.red + color.green + color.blue) / 3 / 256
|
||||
end
|
||||
|
||||
-- clamps the val between left and right
|
||||
-- Clamps the val between left and right
|
||||
local function clamp(val, left, right)
|
||||
if val > right then
|
||||
return right
|
||||
|
@ -69,7 +69,7 @@ local function clamp(val, left, right)
|
|||
return val
|
||||
end
|
||||
|
||||
-- changes braghtness of rgb_color by percentage
|
||||
-- Changes brightness of rgb_color by percentage
|
||||
local function brightness_modifier(rgb_color, parcentage)
|
||||
local color = rgb_str2num(rgb_color)
|
||||
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)
|
||||
end
|
||||
|
||||
-- changes contrast of rgb_color by amount
|
||||
-- Changes contrast of rgb_color by amount
|
||||
local function contrast_modifier(rgb_color, amount)
|
||||
local color = rgb_str2num(rgb_color)
|
||||
color.red = clamp(color.red + amount, 0, 255)
|
||||
|
@ -87,7 +87,7 @@ local function contrast_modifier(rgb_color, amount)
|
|||
return rgb_num2str(color)
|
||||
end
|
||||
|
||||
-- Changes brightness of foreground color to achive contrast
|
||||
-- Changes brightness of foreground color to achieve contrast
|
||||
-- without changing the color
|
||||
local function apply_contrast(highlight)
|
||||
local hightlight_bg_avg = get_color_avg(highlight.bg)
|
||||
|
@ -97,7 +97,7 @@ local function apply_contrast(highlight)
|
|||
contranst_change_step = -contranst_change_step
|
||||
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
|
||||
while
|
||||
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
|
||||
-- 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')
|
||||
if normal_color ~= nil then
|
||||
if get_color_brightness(normal_color) > 0.5 then
|
||||
|
@ -133,7 +132,7 @@ if normal_color ~= nil then
|
|||
end
|
||||
end
|
||||
|
||||
-- basic theme defination
|
||||
-- Basic theme definition
|
||||
local M = {
|
||||
normal = {
|
||||
a = { bg = colors.normal, fg = colors.back1, gui = 'bold' },
|
||||
|
@ -165,7 +164,7 @@ local M = {
|
|||
M.terminal = M.command
|
||||
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 _, highlight in pairs(section) do
|
||||
apply_contrast(highlight)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- Copyright (c) 2020-2021 shadmansaleh
|
||||
-- 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
|
||||
-- stylua: ignore
|
||||
local colors = {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- Copyright (c) 2020-2021 shadmansaleh
|
||||
-- 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
|
||||
-- stylua: ignore
|
||||
local colors = {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- Copyright (c) 2020-2021 shadmansaleh
|
||||
-- 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
|
||||
-- stylua: ignore
|
||||
local colors = {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- Copyright (c) 2020-2021 shadmansaleh
|
||||
-- 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
|
||||
-- stylua: ignore
|
||||
local colors = {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- Copyright (c) 2020-2021 shadmansaleh
|
||||
-- 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
|
||||
-- stylua: ignore
|
||||
local colors = {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- Copyright (c) 2020-2021 shadmansaleh
|
||||
-- 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
|
||||
-- stylua: ignore
|
||||
local colors = {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- Copyright (c) 2020-2021 shadmansaleh
|
||||
-- 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
|
||||
-- stylua: ignore
|
||||
local colors = {
|
||||
|
|
|
@ -8,7 +8,7 @@ Object.__index = Object
|
|||
function Object:init(...) end
|
||||
-- luacheck: pop
|
||||
|
||||
---Extened base class to create a child class
|
||||
---Extend base class to create a child class
|
||||
function Object:extend()
|
||||
local cls = {}
|
||||
for k, v in pairs(self) do
|
||||
|
|
|
@ -274,7 +274,7 @@ local color_table = {
|
|||
}
|
||||
-- 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
|
||||
---@return string
|
||||
function M.rgb2cterm(hex_color)
|
||||
|
@ -306,7 +306,7 @@ function M.rgb2cterm(hex_color)
|
|||
return closest_cterm_color
|
||||
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
|
||||
---@return string
|
||||
function M.color_name2rgb(name)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
-- Copyright (c) 2020-2021 shadmansaleh
|
||||
-- MIT license, see LICENSE for more details.
|
||||
|
||||
--- wrapper arround job api
|
||||
--- wrapper around job api
|
||||
--- creates a job handler when called
|
||||
local Job = setmetatable({
|
||||
--- start the job
|
||||
|
@ -9,7 +9,7 @@ local Job = setmetatable({
|
|||
self.job_id = vim.fn.jobstart(self.args.cmd, self.args)
|
||||
return self.job_id > 0
|
||||
end,
|
||||
--- stop the job. also imidiately disables io from the job.
|
||||
--- stop the job. Also immediately disables io from the job.
|
||||
stop = function(self)
|
||||
if self.killed then
|
||||
return
|
||||
|
|
|
@ -12,7 +12,7 @@ local sep = lualine_require.sep
|
|||
|
||||
--- function that loads specific type of component
|
||||
local component_types = {
|
||||
-- loads custion component
|
||||
-- loads custom component
|
||||
custom = function(component)
|
||||
return component[1](component)
|
||||
end,
|
||||
|
@ -42,7 +42,7 @@ local component_types = {
|
|||
end
|
||||
return require('lualine.components.special.function_component')(component)
|
||||
end,
|
||||
--- loads variables & options (g:,go:,b:,bo:...) as componenta
|
||||
--- loads variables & options (g:,go:,b:,bo:...) as components
|
||||
var = function(component)
|
||||
return require('lualine.components.special.vim_var_component')(component)
|
||||
end,
|
||||
|
@ -52,7 +52,7 @@ local component_types = {
|
|||
end,
|
||||
}
|
||||
|
||||
---load a component from component confif
|
||||
---load a component from component config
|
||||
---@param component table component + component options
|
||||
---@return table the loaded & initialized 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.
|
||||
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:
|
||||
```lua
|
||||
lualine_c = {
|
||||
|
@ -159,7 +159,7 @@ local function load_components(config)
|
|||
end
|
||||
|
||||
---loads all the extensions
|
||||
---@param config table user confif
|
||||
---@param config table user config
|
||||
local function load_extensions(config)
|
||||
local loaded_extensions = {}
|
||||
for _, extension in pairs(config.extensions) do
|
||||
|
@ -207,9 +207,9 @@ local function load_all(config)
|
|||
end
|
||||
|
||||
---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
|
||||
---@return table theme defination from module
|
||||
---@return table theme definition from module
|
||||
local function load_theme(theme_name)
|
||||
assert(is_valid_filename(theme_name), 'Invalid filename')
|
||||
local retval
|
||||
|
|
|
@ -6,8 +6,8 @@ local M = {}
|
|||
-- attr parameter like bold/italic/reverse
|
||||
---@param color_group string hl_group name
|
||||
---@param scope string bg | fg
|
||||
---@return table|string returns #rrggbb formated color when scope is specified
|
||||
---- or comolete color table when scope isn't specified
|
||||
---@return table|string returns #rrggbb formatted color when scope is specified
|
||||
---- or complete color table when scope isn't specified
|
||||
function M.extract_highlight_colors(color_group, scope)
|
||||
local color = require('lualine.highlight').get_lualine_hl(color_group)
|
||||
if not color then
|
||||
|
@ -30,7 +30,7 @@ function M.extract_highlight_colors(color_group, scope)
|
|||
return color
|
||||
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
|
||||
---@param scope string
|
||||
---@param syntaxlist table
|
||||
|
@ -70,24 +70,24 @@ end
|
|||
|
||||
--- Check if a auto command is already defined
|
||||
---@param event string
|
||||
---@param patern string
|
||||
---@param pattern string
|
||||
---@param command_str string
|
||||
---@return boolean whether autocmd is already defined
|
||||
local function autocmd_is_defined(event, patern, command_str)
|
||||
return vim.api.nvim_exec(string.format('au lualine %s %s', event, patern), true):find(command_str) ~= nil
|
||||
local function autocmd_is_defined(event, pattern, command_str)
|
||||
return vim.api.nvim_exec(string.format('au lualine %s %s', event, pattern), true):find(command_str) ~= nil
|
||||
end
|
||||
|
||||
--- Define a auto command if it's not already defined
|
||||
---@param event string event name
|
||||
---@param patern string event patern
|
||||
---@param pattern string event pattern
|
||||
---@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
|
||||
cmd = patern
|
||||
patern = '*'
|
||||
cmd = pattern
|
||||
pattern = '*'
|
||||
end
|
||||
if not autocmd_is_defined(event, patern, cmd) then
|
||||
vim.cmd(string.format('autocmd lualine %s %s %s', event, patern, cmd))
|
||||
if not autocmd_is_defined(event, pattern, cmd) then
|
||||
vim.cmd(string.format('autocmd lualine %s %s %s', event, pattern, cmd))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -96,10 +96,10 @@ function M.is_focused()
|
|||
return tonumber(vim.g.actual_curwin) == vim.api.nvim_get_current_win()
|
||||
end
|
||||
|
||||
--- Check what's the charecter at pos
|
||||
--- Check what's the character at pos
|
||||
---@param str string
|
||||
---@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)
|
||||
return string.char(str:byte(pos))
|
||||
end
|
||||
|
@ -166,7 +166,7 @@ end
|
|||
--- Wrap a function in retry_call
|
||||
---@param fn function Function to call.
|
||||
---@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)
|
||||
return function(...)
|
||||
return M.retry_call(fn, { ... }, times)
|
||||
|
|
|
@ -11,7 +11,7 @@ PANVIMDOC_VERSION="NVIM v0.5.0"
|
|||
PANVIMDOC_TOC=true
|
||||
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
|
||||
# Grab panvimdoc if not present
|
||||
|
@ -22,7 +22,7 @@ if [ ! -d "panvimdoc/" ];then
|
|||
"https://github.com/kdheepak/panvimdoc" "panvimdoc"
|
||||
fi
|
||||
|
||||
echo "Genarating docs"
|
||||
echo "Generating docs"
|
||||
pandoc --metadata=project:"${PANVIMDOC_VIMDOC}"\
|
||||
--metadata=toc:${PANVIMDOC_TOC}\
|
||||
--metadata=vimversion:"${PANVIMDOC_VERSION}"\
|
||||
|
|
|
@ -7,7 +7,7 @@ USAGE="Usage nvim_isolated_conf.sh [OPTIONS] Directory
|
|||
A tool to easily test isolated neovim config
|
||||
|
||||
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
|
||||
-h Show this message
|
||||
-l Load neovim with config from Directory
|
||||
|
|
|
@ -28,7 +28,7 @@ function M.init_component(component, opts)
|
|||
return comp
|
||||
end
|
||||
|
||||
-- Checks ouput of a component
|
||||
-- Checks output of a component
|
||||
M.assert_component = function(component, opts, result, is_active)
|
||||
local comp = M.init_component(component, opts)
|
||||
-- for testing global options
|
||||
|
|
|
@ -16,9 +16,9 @@ describe('Utils', function()
|
|||
eq(utils.extract_highlight_colors('hl2'), nil)
|
||||
-- create highlight
|
||||
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)
|
||||
-- Can retrive specific parts of highlight
|
||||
-- Can retrieve specific parts of highlight
|
||||
eq(utils.extract_highlight_colors('hl2', 'fg'), hl2.fg)
|
||||
-- clear hl2
|
||||
vim.cmd('hi clear hl2')
|
||||
|
|
Loading…
Reference in New Issue