Skip to content

Commit

Permalink
improve doc, option to disable tabline/statusline (close morhetz#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed Sep 10, 2013
1 parent 4aece63 commit a3ce07f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ let g:vimfiler_force_overwrite_statusline = 0
let g:vimshell_force_overwrite_statusline = 0
```

### Note for other plugins
### Note for developers of other plugins
Appearance consistency matters.

The statusline is an important space for Vim users.
Expand All @@ -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.
Then, export a function which is useful to be shown in the statusline.
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.
8 changes: 5 additions & 3 deletions autoload/lightline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
" Version: 0.0
" Author: itchyny
" License: MIT License
" Last Change: 2013/09/08 00:53:10.
" Last Change: 2013/09/10 20:38:31.
" =============================================================================

let s:save_cpo = &cpo
Expand All @@ -13,6 +13,7 @@ let s:_ = 1

function! lightline#update()
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 w = winnr()
for n in range(1, winnr('$'))
Expand All @@ -27,7 +28,7 @@ endfunction

function! lightline#init()
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',
\ 'tab_component', 'tab_component_function', 'separator', 'subseparator' ]
if !has_key(s:lightline, k) | let s:lightline[k] = {} | endif
Expand Down Expand Up @@ -69,7 +70,8 @@ function! lightline#init()
call extend(s:lightline.separator, { 'left': '', 'right': '' }, 'keep')
call extend(s:lightline.subseparator, { 'left': '|', 'right': '|' }, '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

function! lightline#colorscheme()
Expand Down
21 changes: 18 additions & 3 deletions doc/lightline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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: 2013/09/07 16:27:13.
Last Change: 2013/09/10 20:40:34.

CONTENTS *lightline-contents*

Expand Down Expand Up @@ -177,6 +177,8 @@ OPTIONS *lightline-option*

g:lightline.tab_component_function *g:lightline.tab_component_function*
Another dictionary for components in one tab.
A function specified as a tab component takes one argument:
the tab [count].
The default value is:
>
let g:lightline.tab_component_function = {
Expand Down Expand Up @@ -223,12 +225,21 @@ OPTIONS *lightline-option*

g:lightline.separator *g:lightline.separator*
g:lightline.subseparator *g:lightline.subseparator*
A dictionaries to store separators.
Dictionaries to store separators.
The default value is
>
let g:lightline.separator = { '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*
Expand Down Expand Up @@ -427,7 +438,7 @@ The type of the syntastic component is error, and the palette has error
colors, the result is:
>
" 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']
(1) [ 'percent' ] --- s:p.normal.right[1] = ['gray9', 'gray4']
(2) [ 'fileformat', 'fileencoding', 'filetype' ] --- s:p.normal.right[2] = ['gray8', 'gray2']
Expand Down Expand Up @@ -466,6 +477,10 @@ then the expanded result is:
(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]
<
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*
Expand Down

0 comments on commit a3ce07f

Please # to comment.