mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-13 14:03:51 -05:00
improve doc, option to disable tabline/statusline (close #33)
This commit is contained in:
@@ -724,7 +724,7 @@ let g:vimfiler_force_overwrite_statusline = 0
|
|||||||
let g:vimshell_force_overwrite_statusline = 0
|
let g:vimshell_force_overwrite_statusline = 0
|
||||||
```
|
```
|
||||||
|
|
||||||
### Note for other plugins
|
### Note for developers of other plugins
|
||||||
Appearance consistency matters.
|
Appearance consistency matters.
|
||||||
|
|
||||||
The statusline is an important space for Vim users.
|
The statusline is an important space for Vim users.
|
||||||
@@ -737,4 +737,4 @@ Firstly, give the users a clue to judge which buffer is the one your plugin crea
|
|||||||
The filename is a manner and the filetype is another.
|
The filename is a manner and the filetype is another.
|
||||||
Then, export a function which is useful to be shown in the statusline.
|
Then, export a function which is useful to be shown in the statusline.
|
||||||
Lastly, for advanced users, set important information in buffer variables.
|
Lastly, for advanced users, set important information in buffer variables.
|
||||||
So that the users can obtain the condition of the plugin freely.
|
So that the users can obtain the condition of the plugin easily.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
" Version: 0.0
|
" Version: 0.0
|
||||||
" Author: itchyny
|
" Author: itchyny
|
||||||
" License: MIT License
|
" License: MIT License
|
||||||
" Last Change: 2013/09/08 00:53:10.
|
" Last Change: 2013/09/10 20:38:31.
|
||||||
" =============================================================================
|
" =============================================================================
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
@@ -13,6 +13,7 @@ let s:_ = 1
|
|||||||
|
|
||||||
function! lightline#update()
|
function! lightline#update()
|
||||||
if s:_ | call lightline#init() | call lightline#colorscheme() | endif
|
if s:_ | call lightline#init() | call lightline#colorscheme() | endif
|
||||||
|
if !s:lightline.enable.statusline | return | endif
|
||||||
let s = [lightline#statusline(0), lightline#statusline(1)]
|
let s = [lightline#statusline(0), lightline#statusline(1)]
|
||||||
let w = winnr()
|
let w = winnr()
|
||||||
for n in range(1, winnr('$'))
|
for n in range(1, winnr('$'))
|
||||||
@@ -27,7 +28,7 @@ endfunction
|
|||||||
|
|
||||||
function! lightline#init()
|
function! lightline#init()
|
||||||
let s:lightline = deepcopy(get(g:, 'lightline', {}))
|
let s:lightline = deepcopy(get(g:, 'lightline', {}))
|
||||||
for k in ['active', 'inactive', 'tabline', 'tab', 'mode_map', 'mode_fallback',
|
for k in ['active', 'inactive', 'tabline', 'tab', 'mode_map', 'mode_fallback', 'enable',
|
||||||
\ 'component', 'component_visible_condition', 'component_function', 'component_expand', 'component_type',
|
\ 'component', 'component_visible_condition', 'component_function', 'component_expand', 'component_type',
|
||||||
\ 'tab_component', 'tab_component_function', 'separator', 'subseparator' ]
|
\ 'tab_component', 'tab_component_function', 'separator', 'subseparator' ]
|
||||||
if !has_key(s:lightline, k) | let s:lightline[k] = {} | endif
|
if !has_key(s:lightline, k) | let s:lightline[k] = {} | endif
|
||||||
@@ -69,7 +70,8 @@ function! lightline#init()
|
|||||||
call extend(s:lightline.separator, { 'left': '', 'right': '' }, 'keep')
|
call extend(s:lightline.separator, { 'left': '', 'right': '' }, 'keep')
|
||||||
call extend(s:lightline.subseparator, { 'left': '|', 'right': '|' }, 'keep')
|
call extend(s:lightline.subseparator, { 'left': '|', 'right': '|' }, 'keep')
|
||||||
call extend(s:lightline, { 'palette': {}, 'colorscheme': 'default' }, 'keep')
|
call extend(s:lightline, { 'palette': {}, 'colorscheme': 'default' }, 'keep')
|
||||||
set tabline=%!lightline#tabline()
|
call extend(s:lightline.enable, { 'statusline': 1, 'tabline': 1 }, 'keep')
|
||||||
|
if s:lightline.enable.tabline | set tabline=%!lightline#tabline() | endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! lightline#colorscheme()
|
function! lightline#colorscheme()
|
||||||
|
|||||||
@@ -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: 2013/09/07 16:27:13.
|
Last Change: 2013/09/10 20:40:34.
|
||||||
|
|
||||||
CONTENTS *lightline-contents*
|
CONTENTS *lightline-contents*
|
||||||
|
|
||||||
@@ -177,6 +177,8 @@ OPTIONS *lightline-option*
|
|||||||
|
|
||||||
g:lightline.tab_component_function *g:lightline.tab_component_function*
|
g:lightline.tab_component_function *g:lightline.tab_component_function*
|
||||||
Another dictionary for components in one tab.
|
Another dictionary for components in one tab.
|
||||||
|
A function specified as a tab component takes one argument:
|
||||||
|
the tab [count].
|
||||||
The default value is:
|
The default value is:
|
||||||
>
|
>
|
||||||
let g:lightline.tab_component_function = {
|
let g:lightline.tab_component_function = {
|
||||||
@@ -223,12 +225,21 @@ OPTIONS *lightline-option*
|
|||||||
|
|
||||||
g:lightline.separator *g:lightline.separator*
|
g:lightline.separator *g:lightline.separator*
|
||||||
g:lightline.subseparator *g:lightline.subseparator*
|
g:lightline.subseparator *g:lightline.subseparator*
|
||||||
A dictionaries to store separators.
|
Dictionaries to store separators.
|
||||||
The default value is
|
The default value is
|
||||||
>
|
>
|
||||||
let g:lightline.separator = { 'left': '', 'right': '' }
|
let g:lightline.separator = { 'left': '', 'right': '' }
|
||||||
let g:lightline.subseparator = { 'left': '|', 'right': '|' }
|
let g:lightline.subseparator = { 'left': '|', 'right': '|' }
|
||||||
<
|
<
|
||||||
|
g:lightline.enable *g:lightline.enable*
|
||||||
|
A dictionary to specify which feature is turned on.
|
||||||
|
The default value is
|
||||||
|
>
|
||||||
|
let g:lightline.enable = {
|
||||||
|
\ 'statusline': 1
|
||||||
|
\ 'tabline': 1
|
||||||
|
\ }
|
||||||
|
<
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
FONT *lightline-font*
|
FONT *lightline-font*
|
||||||
@@ -427,7 +438,7 @@ The type of the syntastic component is error, and the palette has error
|
|||||||
colors, the result is:
|
colors, the result is:
|
||||||
>
|
>
|
||||||
" Expanded result of Example B
|
" Expanded result of Example B
|
||||||
(error) [ 'syntastic' ] --- s:p.normal.error[0] = ['gray9', 'brightestred']
|
(error) [ syntastic_flag ] --- s:p.normal.error[0] = ['gray9', 'brightestred']
|
||||||
(0) [ 'lineinfo' ] --- s:p.normal.right[0] = ['gray5', 'gray10']
|
(0) [ 'lineinfo' ] --- s:p.normal.right[0] = ['gray5', 'gray10']
|
||||||
(1) [ 'percent' ] --- s:p.normal.right[1] = ['gray9', 'gray4']
|
(1) [ 'percent' ] --- s:p.normal.right[1] = ['gray9', 'gray4']
|
||||||
(2) [ 'fileformat', 'fileencoding', 'filetype' ] --- s:p.normal.right[2] = ['gray8', 'gray2']
|
(2) [ 'fileformat', 'fileencoding', 'filetype' ] --- s:p.normal.right[2] = ['gray8', 'gray2']
|
||||||
@@ -466,6 +477,10 @@ then the expanded result is:
|
|||||||
(tabsel) ['%2T%{lightline#onetab(2,1)}'] --- s:p.tabline.tabsel[0]
|
(tabsel) ['%2T%{lightline#onetab(2,1)}'] --- s:p.tabline.tabsel[0]
|
||||||
(0) ['%3T%{lightline#onetab(3,0)}%T', 'C', 'D'] --- s:p.tabline.left[0]
|
(0) ['%3T%{lightline#onetab(3,0)}%T', 'C', 'D'] --- s:p.tabline.left[0]
|
||||||
<
|
<
|
||||||
|
In summary, when a function in |g:lightline.component_expand| returns an
|
||||||
|
array of three elements, the first element and the last element remains as a
|
||||||
|
part of existing component group. And the middle element goes up to new
|
||||||
|
component group.
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
EXAMPLES *lightline-examples*
|
EXAMPLES *lightline-examples*
|
||||||
|
|||||||
Reference in New Issue
Block a user