From 2946ae2baf1ab94a7fb931fb768e89000d7c4196 Mon Sep 17 00:00:00 2001 From: itchyny Date: Sun, 21 Aug 2016 11:31:13 +0900 Subject: [PATCH] update doc: add document for component_function_visible_condition, improve document for component_visible_condition (ref #173) --- README.md | 10 +++++----- doc/lightline.txt | 29 +++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 03f5da1..5230d65 100644 --- a/README.md +++ b/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. ![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) Huh? Weird! -The components do not collapse even if they have no information! -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. +The subseparators are visible even if the components are empty. +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 let g:lightline = { \ 'colorscheme': 'wombat', @@ -313,8 +313,8 @@ let g:lightline = { ![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/8.png) 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? It's very simple. diff --git a/doc/lightline.txt b/doc/lightline.txt index c151bdd..d279715 100644 --- a/doc/lightline.txt +++ b/doc/lightline.txt @@ -4,7 +4,7 @@ Version: 0.0 Author: itchyny (https://github.com/itchyny) License: MIT License 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* @@ -115,10 +115,13 @@ OPTIONS *lightline-option* \ 'column': '%c' \ 'close': '%999X X ' } < - g:lightline.component_visible_condition *g:lightline.component_visible_condition* - Dictionary of boolean expressions for the components. + g:lightline.component_visible_condition + *g:lightline.component_visible_condition* + Dictionary to store the visible condition of the components. 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: > let g:lightline.component_visible_condition = { @@ -135,6 +138,11 @@ OPTIONS *lightline-option* because the user does not have to set both component and component_visible_condition. If a component set to both component and 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 disappears in help windows: > @@ -150,6 +158,19 @@ OPTIONS *lightline-option* function! LightLineReadonly() return &ft !~? 'help' && &readonly ? 'RO' : '' 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* Another dictionary for components. You can create a component