update doc: add document for component_function_visible_condition, improve document for component_visible_condition (ref #173)

This commit is contained in:
itchyny
2016-08-21 11:31:13 +09:00
parent b5226c77a5
commit 2946ae2baf
2 changed files with 30 additions and 9 deletions

View File

@@ -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.
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/6.png) ![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/6.png)
@@ -293,8 +293,8 @@ let g:lightline = {
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/7.png) ![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/7.png)
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 = {
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/8.png) ![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/8.png)
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.

View File

@@ -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