chore: update contribution instructions

This commit is contained in:
shadmansaleh 2021-11-16 09:06:15 +06:00
parent 93c934a641
commit 44e09a0a99
2 changed files with 50 additions and 71 deletions

View File

@ -2,3 +2,14 @@ globals = {
"vim",
"assert"
}
-- Don't report unused self arguments of methods.
self = false
-- Rerun tests only if their modification time changed.
cache = true
ignore = {
"631", -- max_line_length
"212/_.*", -- unused argument, for vars with "_" prefix
}

View File

@ -1,77 +1,45 @@
# Contributing to lualine.nvim
### Adding a theme
Thanks for considering to contribute.
* refer to example below to see how themes are defined
* take 4 screenshots showing a different vim modes (normal, insert, visual, replace)
* add your theme with screenshots attached to [THEMES.md](./THEMES.md) while maintaining alphabetical order
* If the colorscheme you're trying to add already support lightline. You can use
[lightline2lualine theme converter](https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9) to easily port the theme to lualine.
### 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>
*We could really use some help with tests & docs they are currently lacking :)*
- You can add exciting new component, extension or theme.
(Note: Currently we aren't accepting regular colorscheme based themes.
We think they make more sense with colorschemes as they tend not to get
updated once added hete. 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 issue or pr.
- 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
willingness to implement it yourself.
- Do add tests and docs for your changes.
**Note to colorscheme authors** : If you want to support lualine. You can put your
lualine theme at lua/lualine/themes/{your_colorscheme}.lua in you repo.
Good luck.
<details>
<summary><b>theme example</b></summary>
### Devloper tools
*Let's introduce you to the tools we use.*
To create a custom theme you need to define a colorscheme for each of vim's modes. Each mode has a `fg` and `bg` field for every lualine section.
To specify colors you can use #rrggbb/color_name(like: red)/cterm_color(0-255).
Instead of defining colors as table containing values you can define it as a
string. This string is considered a highlight group name and lualines highlight
is linked to that group.
You can add special effects with `gui`.
Though the example shows a,b,c being set you can specify theme for x, y, z too.
But if unspecified then they default to c, b, a sections theme respectively .
Also all modes theme defaults to normal modes theme.
Adding theme is really easy in lua. Here is and example of a gruvbox theme.
```lua
local colors = {
black = '#282828',
white = '#ebdbb2',
red = '#fb4934',
green = '#b8bb26',
blue = '#83a598',
yellow = '#fe8019',
gray = '#a89984',
darkgray = '#3c3836',
lightgray = '#504945',
inactivegray = '#7c6f64',
}
return {
normal = {
a = {bg = colors.gray, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.darkgray, fg = colors.gray}
},
insert = {
a = {bg = colors.blue, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.lightgray, fg = colors.white}
},
visual = {
a = {bg = colors.yellow, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.inactivegray, fg = colors.black}
},
replace = {
a = {bg = colors.red, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.black, fg = colors.white}
},
command = {
a = {bg = colors.green, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.inactivegray, fg = colors.black}
},
inactive = {
a = {bg = colors.darkgray, fg = colors.gray, gui = 'bold'},
b = {bg = colors.darkgray, fg = colors.gray},
c = {bg = colors.darkgray, fg = colors.gray}
}
}
require('lualine').setup {options = {theme = gruvbox}}
```
</details>
- Your pr need 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.
So you can ignore formatting if you want. But if you want to submit formatted
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. If you want to run it locally you can do so
with `make docgen`. Note: you'll need to have [pandoc](https://github.com/jgm/pandoc) installed.
- `make precommit_check` can come quite handy it'll run all the above mentioned tools
- 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.
like `NOCLEAN=1 make testcov`