improve doc

This commit is contained in:
itchyny
2013-08-22 21:05:42 +09:00
parent cb830ca660
commit 3c3f186c4d

View File

@@ -4,12 +4,13 @@ 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/08/22 14:36:22. Last Change: 2013/08/22 21:07:54.
CONTENTS *lightline-contents* CONTENTS *lightline-contents*
Introduction |lightline-introduction| Introduction |lightline-introduction|
Options |lightline-options| Options |lightline-options|
Font |lightline-font|
Examples |lightline-examples| Examples |lightline-examples|
Nice Examples |lightline-nice-examples| Nice Examples |lightline-nice-examples|
Troubleshooting |lightline-troubleshooting| Troubleshooting |lightline-troubleshooting|
@@ -74,7 +75,8 @@ OPTIONS *lightline-options*
g:lightline.component_func *g:lightline.component_func* g:lightline.component_func *g:lightline.component_func*
Another dictionary for components. This is more convenient Another dictionary for components. This is more convenient
because the user does not have to set both component and because the user does not have to set both component and
component_flag. component_flag. If a component set to both component and
component_func, the setting of component_func has priority.
For example, if you want a component for readonly mark, which For example, if you want a component for readonly mark, which
disappears in help windows: disappears in help windows:
> >
@@ -113,9 +115,62 @@ OPTIONS *lightline-options*
\ 'S' : 'S-LINE', \ 'S' : 'S-LINE',
\ '': 'S-BLOCK', \ '': 'S-BLOCK',
\ '?': ' ' } \ '?': ' ' }
==============================================================================
FONT *lightline-font*
You can use the patched font you used for |vim-powerline| or |powerline|.
The patched font for |powerline| is available at
https://github.com/Lokaltog/powerline-fonts
How to create the patched font for |vim-powerline| is available at
https://github.com/Lokaltog/vim-powerline/tree/develop/fontpatcher
If you have installed the patched font for |powerline|, following settings look
nice.
>
let g:lightline = {
\ 'component': {
\ 'lineinfo': ' %3l:%-2v',
\ },
\ 'component_func': {
\ 'readonly': 'MyReadonly',
\ 'fugitive': 'MyFugitive'
\ },
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '', 'right': '' }
\ }
function! MyReadonly()
return &readonly ? '' : ''
endfunction
function! MyFugitive()
return exists("*fugitive#head") && len(fugitive#head()) ? ''.fugitive#head() : ''
endfunction
<
If you have installed the patched font for |vim-powerline|, following settings
look nice.
>
let g:lightline = {
\ 'component': {
\ 'lineinfo': '⭡ %3l:%-2v',
\ },
\ 'component_func': {
\ 'readonly': 'MyReadonly',
\ 'fugitive': 'MyFugitive'
\ },
\ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ }
function! MyReadonly()
return &readonly ? '⭤' : ''
endfunction
function! MyFugitive()
return exists("*fugitive#head") && len(fugitive#head()) ? '⭠ '.fugitive#head() : ''
endfunction
< <
------------------------------------------------------------------------------ ==============================================================================
EXAMPLES *lightline-examples* EXAMPLES *lightline-examples*
You can configure the appearance of statusline. You can configure the appearance of statusline.
Write the following examples in you .vimrc(_vimrc). Write the following examples in you .vimrc(_vimrc).
@@ -184,27 +239,26 @@ A nice example for |vim-powerline| font users:
let g:lightline = { let g:lightline = {
\ 'colorscheme': 'wombat', \ 'colorscheme': 'wombat',
\ 'active': { \ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'myfugitive', 'myfilename' ] ] \ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
\ }, \ },
\ 'component_func': { \ 'component_func': {
\ 'mymodified': 'MyModified', \ 'fugitive': 'MyFugitive',
\ 'myreadonly': 'MyReadonly', \ 'filename': 'MyFilename'
\ 'myfugitive': 'MyFugitive',
\ 'myfilename': 'MyFilename',
\ }, \ },
\ 'separator': { 'left': '⮀', 'right': '⮂' }, \ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' } \ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ } \ }
function! MyModified() function! MyModified()
return &modifiable && &modified ? '+' : '' return &ft =~ 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction endfunction
function! MyReadonly() function! MyReadonly()
return &ft !~? 'help' && &ro ? '⭤' : '' return &ft !~? 'help\|vimfiler' && &ro ? '⭤' : ''
endfunction endfunction
function! MyFilename() function! MyFilename()
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') . return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
\ (&ft == 'vimfiler' ? vimfiler#get_status_string() : \ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
\ &ft == 'unite' ? unite#get_status_string() : \ &ft == 'unite' ? unite#get_status_string() :
\ &ft == 'vimshell' ? vimshell#get_status_string() :
\ '' != expand('%t') ? expand('%t') : '[No Name]') . \ '' != expand('%t') ? expand('%t') : '[No Name]') .
\ ('' != MyModified() ? ' ' . MyModified() : '') \ ('' != MyModified() ? ' ' . MyModified() : '')
endfunction endfunction
@@ -212,7 +266,6 @@ A nice example for |vim-powerline| font users:
return &ft !~? 'vimfiler' && exists("*fugitive#head") && len(fugitive#head()) ? '⭠ '.fugitive#head() : '' return &ft !~? 'vimfiler' && exists("*fugitive#head") && len(fugitive#head()) ? '⭠ '.fugitive#head() : ''
endfunction endfunction
< <
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
TROUBLESHOOTING *lightline-troubleshooting* TROUBLESHOOTING *lightline-troubleshooting*