docs: vimscript removal prep (#243)

This commit is contained in:
Hubert Pelczarski 2021-05-13 23:19:11 +02:00 committed by GitHub
parent d43a459c06
commit 292609e3ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 169 deletions

View File

@ -58,8 +58,6 @@ use {
``` ```
## Usage and customization ## Usage and customization
Lualine can be configured with both lua and vimscript.
Click [here](#lua-config-example) if you want to see a config example in lua and [here](#vimscript-config-example) if you want to see a config example in vimscript.
Lualine has sections as shown below. Lualine has sections as shown below.
@ -71,12 +69,6 @@ Lualine has sections as shown below.
Each sections holds it's components e.g. current vim's mode. Each sections holds it's components e.g. current vim's mode.
---
### Starting lualine
```lua
require('lualine').setup()
```
<details><summary>Default config</summary> <details><summary>Default config</summary>
```lua ```lua
@ -111,6 +103,12 @@ require'lualine'.setup {
</details> </details>
---
### Starting lualine
```lua
require('lualine').setup()
```
--- ---
### Setting a theme ### Setting a theme
```lua ```lua
@ -406,82 +404,3 @@ You can disable lualine for specific filetypes
```lua ```lua
options = {disabled_filetypes = {'lua'}} options = {disabled_filetypes = {'lua'}}
``` ```
---
### Lua config example
<details>
<summary><b>packer config</b></summary>
```lua
use {
'hoob3rt/lualine.nvim',
requires = {'kyazdani42/nvim-web-devicons', opt = true},
config = function()
require('lualine').setup{
options = {
theme = 'gruvbox',
section_separators = {'', ''},
component_separators = {'', ''},
disabled_filetypes = {},
icons_enabled = true,
},
sections = {
lualine_a = { {'mode', upper = true} },
lualine_b = { {'branch', icon = ''} },
lualine_c = { {'filename', file_status = true} },
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' },
},
inactive_sections = {
lualine_a = { },
lualine_b = { },
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_y = { },
lualine_z = { }
},
extensions = { 'fzf' }
}
end
}
```
</details>
### Vimscript config example
<details>
<summary><b>vimrc config</b></summary>
```vim
let g:lualine = {
\'options' : {
\ 'theme' : 'gruvbox',
\ 'section_separators' : ['', ''],
\ 'component_separators' : ['', ''],
\ 'disabled_filetypes' : [],
\ 'icons_enabled' : v:true,
\},
\'sections' : {
\ 'lualine_a' : [ ['mode', {'upper': v:true,},], ],
\ 'lualine_b' : [ ['branch', {'icon': '',}, ], ],
\ 'lualine_c' : [ ['filename', {'file_status': v:true,},], ],
\ 'lualine_x' : [ 'encoding', 'fileformat', 'filetype' ],
\ 'lualine_y' : [ 'progress' ],
\ 'lualine_z' : [ 'location' ],
\},
\'inactive_sections' : {
\ 'lualine_a' : [ ],
\ 'lualine_b' : [ ],
\ 'lualine_c' : [ 'filename' ],
\ 'lualine_x' : [ 'location' ],
\ 'lualine_y' : [ ],
\ 'lualine_z' : [ ],
\},
\'extensions' : [ 'fzf' ],
\}
lua require("lualine").setup()
```
</details>

View File

@ -23,9 +23,7 @@ CONTENTS *lualine-contents*
1.1.6 Component options.......................|lualine-component_options| 1.1.6 Component options.......................|lualine-component_options|
1.1.7 Tabline...........................................|lualine-tabline| 1.1.7 Tabline...........................................|lualine-tabline|
1.1.8 Extensions.....................................|lualine-extensions| 1.1.8 Extensions.....................................|lualine-extensions|
1.2 Config examples..............................|lualine-config_examples| 1.1.8 Disabling lualine.................................|lualine-disable|
1.2.1 Lua config example...................|lualine-lua_config_example|
1.2.2 Vimscript config example.......|lualine-vimscript_config_example|
============================================================================== ==============================================================================
USAGE AND CUSTOMIZATION *lualine-usage_and_customization* USAGE AND CUSTOMIZATION *lualine-usage_and_customization*
@ -38,11 +36,6 @@ Lualine has sections as shown below.
Each sections holds it's components e.g. current vim's mode. Each sections holds it's components e.g. current vim's mode.
------------------------------------------------------------------------------
STARTING LUALINE *lualine-starting_lualine* *lualine.setup()*
>
require('lualine').setup()
Default config~ Default config~
> >
require'lualine'.setup { require'lualine'.setup {
@ -73,6 +66,11 @@ Default config~
extensions = {} extensions = {}
} }
------------------------------------------------------------------------------
STARTING LUALINE *lualine-starting_lualine* *lualine.setup()*
>
require('lualine').setup()
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
SETTING A THEME *lualine-theme* SETTING A THEME *lualine-theme*
> >
@ -323,83 +321,11 @@ Available extensions
* |nvim-tree| * |nvim-tree|
* |quickfix| * |quickfix|
============================================================================== ------------------------------------------------------------------------------
DISABLING LUALINE *lualine-disable* DISABLING LUALINE *lualine-disable*
You can disable lualine for specific filetypes You can disable lualine for specific filetypes
`options = {disabled_filetypes = {'lua'}}` `options = {disabled_filetypes = {'lua'}}`
==============================================================================
CONGIG EXAMPLES *lualine-config_examples*
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
LUA CONFIG EXAMPLE *lualine-lua_config_example*
>
use {
'hoob3rt/lualine.nvim',
requires = {'kyazdani42/nvim-web-devicons', opt = true},
config = function()
require('lualine').setup{
options = {
theme = 'gruvbox',
section_separators = {'', ''},
component_separators = {'', ''},
disabled_filetypes = {},
icons_enabled = true,
},
sections = {
lualine_a = { {'mode', upper = true} },
lualine_b = { {'branch', icon = ''} },
lualine_c = { {'filename', file_status = true} },
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' },
},
inactive_sections = {
lualine_a = { },
lualine_b = { },
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_y = { },
lualine_z = { }
},
extensions = { 'fzf' }
}
end
}
<
------------------------------------------------------------------------------
VIMSCRIPT CONFIG EXAMPLE *lualine-vimscript_config_example*
>
let g:lualine = {
\'options' : {
\ 'theme' : 'gruvbox',
\ 'section_separators' : ['', ''],
\ 'component_separators' : ['', ''],
\ 'disabled_filetypes' : [],
\ 'icons_enabled' : v:true,
\},
\'sections' : {
\ 'lualine_a' : [ ['mode', {'upper': v:true,},], ],
\ 'lualine_b' : [ ['branch', {'icon': '',}, ], ],
\ 'lualine_c' : [ ['filename', {'file_status': v:true,},], ],
\ 'lualine_x' : [ 'encoding', 'fileformat', 'filetype' ],
\ 'lualine_y' : [ 'progress' ],
\ 'lualine_z' : [ 'location' ],
\},
\'inactive_sections' : {
\ 'lualine_a' : [ ],
\ 'lualine_b' : [ ],
\ 'lualine_c' : [ 'filename' ],
\ 'lualine_x' : [ 'location' ],
\ 'lualine_y' : [ ],
\ 'lualine_z' : [ ],
\},
\'extensions' : [ 'fzf' ],
\}
lua require("lualine").setup()
<
-----------------------------------------------------------------------------
vim:tw=80:sw=4:ts=8:noet:ft=help:norl:et: vim:tw=80:sw=4:ts=8:noet:ft=help:norl:et:

View File

@ -27,7 +27,7 @@ FileName.new = function(self, options, child)
if new_instance.options.full_path or new_instance.options.shorten then if new_instance.options.full_path or new_instance.options.shorten then
vim.schedule(function() vim.schedule(function()
vim.api.nvim_err_writeln( vim.api.nvim_err_writeln(
[[Lualine: filename component configuration changed, see :h lualine_custom_options ]]) [[Lualine: filename component configuration changed, see :h lualine-component_options ]])
end) end)
end end

View File

@ -181,6 +181,10 @@ local function setup(user_config)
if user_config then if user_config then
config_module.apply_configuration(user_config) config_module.apply_configuration(user_config)
elseif vim.g.lualine then elseif vim.g.lualine then
vim.schedule(function()
vim.api.nvim_err_writeln(
[[Lualine: lualine will stop supporting vimscript soon, change your config to lua or wrap it around lua << EOF ... EOF]]) -- luacheck: ignore
end)
config_module.apply_configuration(vim.g.lualine) config_module.apply_configuration(vim.g.lualine)
end end
setup_theme() setup_theme()