feat: user defined extensions
This commit is contained in:
parent
a65168662e
commit
9d9ee2d60e
11
README.md
11
README.md
|
@ -398,6 +398,17 @@ extensions = {'quickfix'}
|
|||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Custom extensions</b></summary>
|
||||
|
||||
You can define your own extensions. If you think an extension might be useful for others then please submit a pr.
|
||||
```lua
|
||||
local my_extension = {sections = {lualine_a = 'mode'}, filetypes = {'lua'}}
|
||||
require'lualine'.setup {extensions = {my_extension}}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
---
|
||||
### Disabling lualine
|
||||
You can disable lualine for specific filetypes
|
||||
|
|
|
@ -313,13 +313,22 @@ You can load extensions with:
|
|||
>
|
||||
extensions = {'quickfix'}
|
||||
<
|
||||
Available extensions
|
||||
Available extensions~
|
||||
* |chadtree|
|
||||
* |fugitive|
|
||||
* |fzf|
|
||||
* |nerdtree|
|
||||
* |nvim-tree|
|
||||
* |quickfix|
|
||||
*
|
||||
|
||||
Custom extensions~
|
||||
|
||||
You can define your own extensions.
|
||||
If you think an extension might be useful for others then please submit a pr.
|
||||
>
|
||||
local my_extension = {sections = {lualine_a = 'mode'}, filetypes = {'lua'}}
|
||||
require'lualine'.setup {extensions = {my_extension}}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
DISABLING LUALINE *lualine-disable*
|
||||
|
|
|
@ -52,9 +52,14 @@ end
|
|||
|
||||
local function load_extensions(config)
|
||||
for index, extension in pairs(config.extensions) do
|
||||
if type(extension) == 'string' then
|
||||
local local_extension = require('lualine.extensions.' .. extension)
|
||||
load_sections(local_extension.sections, config.options)
|
||||
config.extensions[index] = local_extension
|
||||
elseif type(extension) == 'table' then
|
||||
load_sections(extension.sections, config.options)
|
||||
config.extensions[index] = extension
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue