improve the example in the document

This commit is contained in:
itchyny
2020-10-20 21:30:58 +09:00
parent ee972cd83b
commit 5226facff7

View File

@@ -4,7 +4,7 @@ Version: 0.1
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: 2020/10/20 21:23:32. Last Change: 2020/10/20 21:28:13.
CONTENTS *lightline-contents* CONTENTS *lightline-contents*
@@ -591,34 +591,27 @@ In order to change the colorscheme:
\ 'colorscheme': 'wombat', \ 'colorscheme': 'wombat',
\ } \ }
< <
In order to define your own component: In order to define your own component:
> >
let g:lightline = { let g:lightline = {
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'myfilename' ] ]
\ },
\ 'component_function': { \ 'component_function': {
\ 'myfilename': 'LightlineFilename', \ 'filename': 'LightlineFilename',
\ 'myreadonly': 'LightlineReadonly', \ 'readonly': 'LightlineReadonly',
\ 'mymodified': 'LightlineModified', \ 'modified': 'LightlineModified',
\ } \ }
\ } \ }
function! LightlineFilename() function! LightlineFilename()
return (LightlineReadonly() !=# '' ? LightlineReadonly() . ' ' : '') . return &ft ==# 'vimfiler' ? vimfiler#get_status_string() :
\ (&ft ==# 'vimfiler' ? vimfiler#get_status_string() :
\ &ft ==# 'unite' ? unite#get_status_string() : \ &ft ==# 'unite' ? unite#get_status_string() :
\ expand('%:t') !=# '' ? expand('%:t') : '[No Name]') . \ expand('%:t') !=# '' ? expand('%:t') : '[No Name]'
\ (LightlineModified() !=# '' ? ' ' . LightlineModified() : '')
endfunction endfunction
function! LightlineReadonly() function! LightlineReadonly()
return &ft !~? 'help' && &readonly ? 'RO' : '' return &ft !~? 'help\|vimfiler' && &readonly ? 'RO' : ''
endfunction endfunction
function! LightlineModified() function! LightlineModified()
return &modifiable && &modified ? '+' : '' return &modifiable && &modified ? '+' : ''
endfunction endfunction
< <
Separators settings: Separators settings:
> >
let g:lightline = { let g:lightline = {