feat: added extension for lazy.nvim (#956)
* added extension for lazy.nvim * add lazy to the list of extensions in README --------- Co-authored-by: Shadman <13149513+shadmansaleh@users.noreply.github.com>
This commit is contained in:
parent
7bd381c68b
commit
5562281c60
16
README.md
16
README.md
|
@ -61,7 +61,7 @@ And measured time is complete startuptime of vim not time spent
|
||||||
on specific plugin. These numbers are the average of 20 runs.
|
on specific plugin. These numbers are the average of 20 runs.
|
||||||
|
|
||||||
| control | lualine | lightline | airline |
|
| control | lualine | lightline | airline |
|
||||||
| :------: | :-------: | :-------: | :-------: |
|
| :-----: | :-----: | :-------: | :-----: |
|
||||||
| 17.2 ms | 24.8 ms | 25.5 ms | 79.9 ms |
|
| 17.2 ms | 24.8 ms | 25.5 ms | 79.9 ms |
|
||||||
|
|
||||||
Last Updated On: 18-04-2022
|
Last Updated On: 18-04-2022
|
||||||
|
@ -292,6 +292,7 @@ sections = { lualine_a = { 'g:coc_status', 'bo:filetype' } }
|
||||||
##### Lua expressions as lualine component
|
##### Lua expressions as lualine component
|
||||||
|
|
||||||
You can use any valid lua expression as a component including:
|
You can use any valid lua expression as a component including:
|
||||||
|
|
||||||
- oneliners
|
- oneliners
|
||||||
- global variables
|
- global variables
|
||||||
- require statements
|
- require statements
|
||||||
|
@ -782,8 +783,10 @@ tabline = {
|
||||||
```
|
```
|
||||||
|
|
||||||
### Winbar
|
### Winbar
|
||||||
|
|
||||||
From neovim-0.8 you can customize your winbar with lualine.
|
From neovim-0.8 you can customize your winbar with lualine.
|
||||||
Winbar configuration is similar to statusline.
|
Winbar configuration is similar to statusline.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
winbar = {
|
winbar = {
|
||||||
lualine_a = {},
|
lualine_a = {},
|
||||||
|
@ -803,6 +806,7 @@ inactive_winbar = {
|
||||||
lualine_z = {}
|
lualine_z = {}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Just like statusline you can separately specify winbar for active and inactive
|
Just like statusline you can separately specify winbar for active and inactive
|
||||||
windows. Any lualine component can be placed in winbar. All kinds of custom
|
windows. Any lualine component can be placed in winbar. All kinds of custom
|
||||||
components supported in statusline are also supported for winbar too. In general
|
components supported in statusline are also supported for winbar too. In general
|
||||||
|
@ -884,6 +888,7 @@ extensions = {'quickfix'}
|
||||||
- fern
|
- fern
|
||||||
- fugitive
|
- fugitive
|
||||||
- fzf
|
- fzf
|
||||||
|
- lazy
|
||||||
- man
|
- man
|
||||||
- mundo
|
- mundo
|
||||||
- neo-tree
|
- neo-tree
|
||||||
|
@ -907,19 +912,23 @@ require('lualine').setup { extensions = { my_extension } }
|
||||||
---
|
---
|
||||||
|
|
||||||
### Refreshing lualine
|
### Refreshing lualine
|
||||||
|
|
||||||
By default lualine refreshes itself based on timer and some events. You can set
|
By default lualine refreshes itself based on timer and some events. You can set
|
||||||
the interval of the timer with refresh option. However you can also force
|
the interval of the timer with refresh option. However you can also force
|
||||||
lualine to refresh at any time by calling `lualine.refresh` function.
|
lualine to refresh at any time by calling `lualine.refresh` function.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
require('lualine').refresh({
|
require('lualine').refresh({
|
||||||
scope = 'tabpage', -- scope of refresh all/tabpage/window
|
scope = 'tabpage', -- scope of refresh all/tabpage/window
|
||||||
place = { 'statusline', 'winbar', 'tabline' }, -- lualine segment ro refresh.
|
place = { 'statusline', 'winbar', 'tabline' }, -- lualine segment ro refresh.
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
The arguments shown here are default values. So not passing any of them will be
|
The arguments shown here are default values. So not passing any of them will be
|
||||||
treated as if a default value was passed.
|
treated as if a default value was passed.
|
||||||
|
|
||||||
So you can simply do
|
So you can simply do
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
require('lualine').refresh()
|
require('lualine').refresh()
|
||||||
```
|
```
|
||||||
|
@ -937,21 +946,26 @@ options = { disabled_filetypes = {'lua'} }
|
||||||
|
|
||||||
You can also disable lualine completely.
|
You can also disable lualine completely.
|
||||||
Note that you need to call this after the setup
|
Note that you need to call this after the setup
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
require('lualine').hide({
|
require('lualine').hide({
|
||||||
place = {'statusline', 'tabline', 'winbar'}, -- The segment this change applies to.
|
place = {'statusline', 'tabline', 'winbar'}, -- The segment this change applies to.
|
||||||
unhide = false, -- whether to re-enable lualine again/
|
unhide = false, -- whether to re-enable lualine again/
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
The arguments show for hide above are default values.
|
The arguments show for hide above are default values.
|
||||||
Which means even if the hide function is called without
|
Which means even if the hide function is called without
|
||||||
arguments it'll work as if these were passed.
|
arguments it'll work as if these were passed.
|
||||||
|
|
||||||
So in short to disable lualine completely you can do
|
So in short to disable lualine completely you can do
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
require('lualine').hide()
|
require('lualine').hide()
|
||||||
```
|
```
|
||||||
|
|
||||||
To enable it again you can do
|
To enable it again you can do
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
require('lualine').hide({unhide=true})
|
require('lualine').hide({unhide=true})
|
||||||
```
|
```
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
-- lualine extension for lazy.nvim
|
||||||
|
|
||||||
|
local ok, lazy = pcall(require, 'lazy')
|
||||||
|
if not ok then
|
||||||
|
return ''
|
||||||
|
end
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.sections = {
|
||||||
|
lualine_a = {
|
||||||
|
function()
|
||||||
|
return 'lazy 💤'
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
lualine_b = {
|
||||||
|
function()
|
||||||
|
return 'loaded: ' .. lazy.stats().loaded .. '/' .. lazy.stats().count
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
lualine_c = {
|
||||||
|
{
|
||||||
|
require('lazy.status').updates,
|
||||||
|
cond = require('lazy.status').has_updates,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
M.filetypes = { 'lazy' }
|
||||||
|
|
||||||
|
return M
|
Loading…
Reference in New Issue