mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-13 22:13:50 -05:00
improve doc
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
" Version: 0.0
|
" Version: 0.0
|
||||||
" Author: itchyny
|
" Author: itchyny
|
||||||
" License: MIT License
|
" License: MIT License
|
||||||
" Last Change: 2013/08/22 13:34:47.
|
" Last Change: 2013/08/22 14:21:34.
|
||||||
" =============================================================================
|
" =============================================================================
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
@@ -82,18 +82,18 @@ function! lightline#init()
|
|||||||
for m in ['normal', 'insert', 'replace', 'visual', 'inactive']
|
for m in ['normal', 'insert', 'replace', 'visual', 'inactive']
|
||||||
let g:lightline.palette[m] = get(g:lightline.palette, m, {})
|
let g:lightline.palette[m] = get(g:lightline.palette, m, {})
|
||||||
endfor
|
endfor
|
||||||
" try
|
try
|
||||||
let g:lightline.palette = g:lightline#colorscheme#{g:lightline.colorscheme}#palette
|
let g:lightline.palette = g:lightline#colorscheme#{g:lightline.colorscheme}#palette
|
||||||
" catch
|
catch
|
||||||
" call lightline#error('Colorscheme ' . g:lightline.colorscheme . ' could not loaded.')
|
call lightline#error('Colorscheme ' . g:lightline.colorscheme . ' could not loaded.')
|
||||||
" let g:lightline.colorscheme = 'default'
|
let g:lightline.colorscheme = 'default'
|
||||||
" let g:lightline.palette = g:lightline#colorscheme#{g:lightline.colorscheme}#palette
|
let g:lightline.palette = g:lightline#colorscheme#{g:lightline.colorscheme}#palette
|
||||||
" finally
|
finally
|
||||||
for m in ['normal', 'insert', 'replace', 'visual', 'inactive', 'command']
|
for m in ['normal', 'insert', 'replace', 'visual', 'inactive', 'command']
|
||||||
call lightline#highlight(m)
|
call lightline#highlight(m)
|
||||||
endfor
|
endfor
|
||||||
" let s:_ = 0
|
let s:_ = 0
|
||||||
" endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! lightline#mode()
|
function! lightline#mode()
|
||||||
|
|||||||
@@ -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/08/22 10:37:17.
|
Last Change: 2013/08/22 14:36:22.
|
||||||
|
|
||||||
CONTENTS *lightline-contents*
|
CONTENTS *lightline-contents*
|
||||||
|
|
||||||
@@ -23,13 +23,107 @@ The *lightline* plugin is a light and configurable statusline for Vim.
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
OPTIONS *lightline-options*
|
OPTIONS *lightline-options*
|
||||||
|
|
||||||
|
g:lightline *g:lightline*
|
||||||
|
All the options are stored into this global variable.
|
||||||
|
|
||||||
|
g:lightline.active *g:lightline.active*
|
||||||
|
g:lightline.inactive *g:lightline.inactive*
|
||||||
|
Dictionaries to specify the status components.
|
||||||
|
The default values are:
|
||||||
|
>
|
||||||
|
let g:lightline.active = {
|
||||||
|
\ 'left': [ [ 'mode', 'paste' ],
|
||||||
|
\ [ 'fugitive', 'readonly', 'filename', 'modified' ] ],
|
||||||
|
\ 'right': [ [ 'lineinfo' ],
|
||||||
|
\ [ 'percent' ],
|
||||||
|
\ [ 'fileformat', 'fileencoding', 'filetype' ] ] }
|
||||||
|
let g:lightline.inactive = {
|
||||||
|
\ 'left': [ [ 'filename' ] ],
|
||||||
|
\ 'right': [ [ 'lineinfo' ],
|
||||||
|
\ [ 'percent' ] ] }
|
||||||
|
<
|
||||||
|
g:lightline.component *g:lightline.component*
|
||||||
|
Dictionary for statusline components.
|
||||||
|
The default value is:
|
||||||
|
>
|
||||||
|
let g:lightline.component = {
|
||||||
|
\ 'mode': '%{lightline#mode()}',
|
||||||
|
\ 'filename': '%t',
|
||||||
|
\ 'modified': '%M',
|
||||||
|
\ 'paste': '%{&paste?"PASTE":""}',
|
||||||
|
\ 'readonly': '%R',
|
||||||
|
\ 'fileencoding': '%{strlen(&fenc)?&fenc:&enc}',
|
||||||
|
\ 'fileformat': '%{&fileformat}',
|
||||||
|
\ 'filetype': '%{strlen(&filetype)?&filetype:"no ft"}',
|
||||||
|
\ 'percent': '%3p%%',
|
||||||
|
\ 'lineinfo': '%3l:%-2v',
|
||||||
|
\ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}' }
|
||||||
|
<
|
||||||
|
g:lightline.component_flag *g:lightline.component_flag*
|
||||||
|
Dictionary of boolean expressions for the components.
|
||||||
|
Each expression corresponds to if the component have non-zero
|
||||||
|
length.
|
||||||
|
For example, the flag for paste component is:
|
||||||
|
>
|
||||||
|
let g:lightline.component_flag = {
|
||||||
|
\ 'paste': '(&paste)' }
|
||||||
|
<
|
||||||
|
Users are recommended to set this option together with the
|
||||||
|
component itself.
|
||||||
|
|
||||||
|
g:lightline.component_func *g:lightline.component_func*
|
||||||
|
Another dictionary for components. This is more convenient
|
||||||
|
because the user does not have to set both component and
|
||||||
|
component_flag.
|
||||||
|
For example, if you want a component for readonly mark, which
|
||||||
|
disappears in help windows:
|
||||||
|
>
|
||||||
|
let g:lightline = {
|
||||||
|
\ 'active': {
|
||||||
|
\ 'left': [ [ 'mode', 'paste' ],
|
||||||
|
\ [ 'myreadonly', 'filename', 'modified' ] ],
|
||||||
|
\ },
|
||||||
|
\ 'component_func': {
|
||||||
|
\ 'myreadonly': 'MyReadonly'
|
||||||
|
\ },
|
||||||
|
\ }
|
||||||
|
function! MyReadonly()
|
||||||
|
return &ft !~? 'help' && &ro ? 'RO' : ''
|
||||||
|
endfunction
|
||||||
|
<
|
||||||
|
g:lightline.colorscheme *g:lightline.colorscheme*
|
||||||
|
The colorscheme for lightline.vim.
|
||||||
|
Currently, wombat, solarized and landscape are available.
|
||||||
|
>
|
||||||
|
let g:lightline.colorscheme = 'default'
|
||||||
|
<
|
||||||
|
g:lightline.mode_map *g:lightline.mode_map*
|
||||||
|
A dictionary of names for mode.
|
||||||
|
The default value is:
|
||||||
|
>
|
||||||
|
let g:lightline.mode_map = {
|
||||||
|
\ 'n' : 'NORMAL',
|
||||||
|
\ 'i' : 'INSERT',
|
||||||
|
\ 'R' : 'REPLACE',
|
||||||
|
\ 'v' : 'VISUAL',
|
||||||
|
\ 'V' : 'V-LINE',
|
||||||
|
\ 'c' : 'COMMAND',
|
||||||
|
\ '': 'V-BLOCK',
|
||||||
|
\ 's' : 'SELECT',
|
||||||
|
\ 'S' : 'S-LINE',
|
||||||
|
\ '': 'S-BLOCK',
|
||||||
|
\ '?': ' ' }
|
||||||
|
<
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
EXAMPLES *lightline-examples*
|
EXAMPLES *lightline-examples*
|
||||||
|
You can configure the appearance of statusline.
|
||||||
|
Write the following examples in you .vimrc(_vimrc).
|
||||||
|
|
||||||
In order to change the colorscheme:
|
In order to change the colorscheme:
|
||||||
>
|
>
|
||||||
let g:lightline = {
|
let g:lightline = {
|
||||||
\ 'colorscheme': 'landscape',
|
\ 'colorscheme': 'wombat',
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
In order to define own component:
|
In order to define own component:
|
||||||
@@ -88,7 +182,7 @@ NICE EXAMPLES *lightline-nice-examples*
|
|||||||
A nice example for |vim-powerline| font users:
|
A nice example for |vim-powerline| font users:
|
||||||
>
|
>
|
||||||
let g:lightline = {
|
let g:lightline = {
|
||||||
\ 'colorscheme': 'landscape',
|
\ 'colorscheme': 'wombat',
|
||||||
\ 'active': {
|
\ 'active': {
|
||||||
\ 'left': [ [ 'mode', 'paste' ], [ 'myfugitive', 'myfilename' ] ]
|
\ 'left': [ [ 'mode', 'paste' ], [ 'myfugitive', 'myfilename' ] ]
|
||||||
\ },
|
\ },
|
||||||
@@ -105,7 +199,7 @@ A nice example for |vim-powerline| font users:
|
|||||||
return &modifiable && &modified ? '+' : ''
|
return &modifiable && &modified ? '+' : ''
|
||||||
endfunction
|
endfunction
|
||||||
function! MyReadonly()
|
function! MyReadonly()
|
||||||
return &ft !~? 'help\|zcalendar' && &ro ? '⭤' : ''
|
return &ft !~? 'help' && &ro ? '⭤' : ''
|
||||||
endfunction
|
endfunction
|
||||||
function! MyFilename()
|
function! MyFilename()
|
||||||
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
|
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
|
||||||
|
|||||||
Reference in New Issue
Block a user