mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-17 07:53:41 -05:00
update doc: add document for component_function_visible_condition, improve document for component_visible_condition (ref #173)
This commit is contained in:
10
README.md
10
README.md
@@ -272,7 +272,7 @@ set noshowmode
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
Now, let us get back to the tutorial (with the patched font for vim-powerline).
|
Now, let's get back to the tutorial (with the patched font for vim-powerline).
|
||||||
You look into a help file to find the marks annoying.
|
You look into a help file to find the marks annoying.
|
||||||
|
|
||||||

|

|
||||||
@@ -293,8 +293,8 @@ let g:lightline = {
|
|||||||

|

|
||||||
|
|
||||||
Huh? Weird!
|
Huh? Weird!
|
||||||
The components do not collapse even if they have no information!
|
The subseparators are visible even if the components are empty.
|
||||||
In order to avoid this situation, you set expressions to `g:lightline.component_visible_condition`, which should become 1 only when the corresponding components have information.
|
In order to hide the subseparators, you can set expressions to `g:lightline.component_visible_condition`, which should be 1 only when the corresponding component is not empty.
|
||||||
```vim
|
```vim
|
||||||
let g:lightline = {
|
let g:lightline = {
|
||||||
\ 'colorscheme': 'wombat',
|
\ 'colorscheme': 'wombat',
|
||||||
@@ -313,8 +313,8 @@ let g:lightline = {
|
|||||||

|

|
||||||
|
|
||||||
Okay. It works nice.
|
Okay. It works nice.
|
||||||
|
The configuration `component_visible_condition` is used to control the visibility of the subseparators.
|
||||||
|
You cannot use this variable to control the visibility of the components themselves.
|
||||||
|
|
||||||
How does lightline decide the components to show in the statusline?
|
How does lightline decide the components to show in the statusline?
|
||||||
It's very simple.
|
It's very simple.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Version: 0.0
|
|||||||
Author: itchyny (https://github.com/itchyny)
|
Author: itchyny (https://github.com/itchyny)
|
||||||
License: MIT License
|
License: MIT License
|
||||||
Repository: https://github.com/itchyny/lightline.vim
|
Repository: https://github.com/itchyny/lightline.vim
|
||||||
Last Change: 2016/08/09 06:22:39.
|
Last Change: 2016/08/20 16:36:03.
|
||||||
|
|
||||||
CONTENTS *lightline-contents*
|
CONTENTS *lightline-contents*
|
||||||
|
|
||||||
@@ -115,10 +115,13 @@ OPTIONS *lightline-option*
|
|||||||
\ 'column': '%c'
|
\ 'column': '%c'
|
||||||
\ 'close': '%999X X ' }
|
\ 'close': '%999X X ' }
|
||||||
<
|
<
|
||||||
g:lightline.component_visible_condition *g:lightline.component_visible_condition*
|
g:lightline.component_visible_condition
|
||||||
Dictionary of boolean expressions for the components.
|
*g:lightline.component_visible_condition*
|
||||||
|
Dictionary to store the visible condition of the components.
|
||||||
Each expression should correspond to the condition each
|
Each expression should correspond to the condition each
|
||||||
component have non-zero length.
|
component is not empty. This configuration is used to control
|
||||||
|
the visibility of the subseparators. You cannot use this
|
||||||
|
configuration to control the visibility of the components.
|
||||||
The default value is:
|
The default value is:
|
||||||
>
|
>
|
||||||
let g:lightline.component_visible_condition = {
|
let g:lightline.component_visible_condition = {
|
||||||
@@ -135,6 +138,11 @@ OPTIONS *lightline-option*
|
|||||||
because the user does not have to set both component and
|
because the user does not have to set both component and
|
||||||
component_visible_condition. If a component set to both component and
|
component_visible_condition. If a component set to both component and
|
||||||
component_function, the setting of component_function has priority.
|
component_function, the setting of component_function has priority.
|
||||||
|
|
||||||
|
The default value is:
|
||||||
|
>
|
||||||
|
let g:lightline.component_function = {}
|
||||||
|
<
|
||||||
For example, if you want a component for read-only mark, which
|
For example, if you want a component for read-only mark, which
|
||||||
disappears in help windows:
|
disappears in help windows:
|
||||||
>
|
>
|
||||||
@@ -150,6 +158,19 @@ OPTIONS *lightline-option*
|
|||||||
function! LightLineReadonly()
|
function! LightLineReadonly()
|
||||||
return &ft !~? 'help' && &readonly ? 'RO' : ''
|
return &ft !~? 'help' && &readonly ? 'RO' : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
<
|
||||||
|
g:lightline.component_function_visible_condition
|
||||||
|
*g:lightline.component_function_visible_condition*
|
||||||
|
Dictionary to store the visible conditions of the function
|
||||||
|
components. Each expression should correspond to the condition
|
||||||
|
each component is not empty. This configuration is used to
|
||||||
|
control the visibility of the subseparators. You can use this
|
||||||
|
configuration to reduce the number of function calls for
|
||||||
|
function components by setting the value 1 (to tell lightline
|
||||||
|
that the component is always visible).
|
||||||
|
The default value is:
|
||||||
|
>
|
||||||
|
let g:lightline.component_function_visible_condition = {}
|
||||||
<
|
<
|
||||||
g:lightline.component_expand *g:lightline.component_expand*
|
g:lightline.component_expand *g:lightline.component_expand*
|
||||||
Another dictionary for components. You can create a component
|
Another dictionary for components. You can create a component
|
||||||
|
|||||||
Reference in New Issue
Block a user