mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-16 07:23:49 -05:00
improve doc
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
" Version: 0.0
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2013/08/27 01:01:16.
|
||||
" Last Change: 2013/08/27 04:41:57.
|
||||
" =============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
@@ -14,7 +14,7 @@ let s:is_win32term = (has('win32') || has('win64')) && !has('gui_running')
|
||||
|
||||
function! lightline#update()
|
||||
try
|
||||
if s:_ | call lightline#init() | endif
|
||||
if s:_ | call lightline#init() | call lightline#colorscheme() | endif
|
||||
let s = [lightline#statusline(0), lightline#statusline(1)]
|
||||
let w = winnr()
|
||||
for n in range(1, winnr('$'))
|
||||
@@ -23,6 +23,7 @@ function! lightline#update()
|
||||
endfor
|
||||
catch
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
@@ -73,6 +74,9 @@ function! lightline#init()
|
||||
let g:lightline.subseparator = get(g:lightline, 'subseparator', {})
|
||||
call extend(g:lightline.subseparator, { 'left': '|', 'right': '|' }, 'keep')
|
||||
call extend(g:lightline, { 'palette': {}, 'colorscheme': 'default' }, 'keep')
|
||||
endfunction
|
||||
|
||||
function! lightline#colorscheme()
|
||||
try
|
||||
let g:lightline.palette = g:lightline#colorscheme#{g:lightline.colorscheme}#palette
|
||||
catch
|
||||
@@ -163,7 +167,7 @@ function! lightline#function(f)
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! lightline#subseparator(x, y, s)
|
||||
function! s:subseparator(x, y, s)
|
||||
let [c, f, v] = [ g:lightline.component, g:lightline.component_function, g:lightline.component_visible_condition ]
|
||||
return '%{('.(has_key(f,a:x)?'!!strlen(lightline#function("'.(f[a:x]).'"))':get(v,a:x,"1")).')*(('.join(map(copy(a:y),
|
||||
\'(has_key(f,v:val)?"!!strlen(lightline#function(\"".(f[v:val])."\"))":get(v,v:val,has_key(c,v:val)?"1":"0"))'),')+(')."))?('".a:s."'):''}"
|
||||
@@ -179,7 +183,7 @@ function! lightline#statusline(inactive)
|
||||
for j in range(len(left[i]))
|
||||
let _ .= '%( '.(has_key(f,left[i][j])?'%{lightline#function("'.f[left[i][j]].'")}':get(c,left[i][j],'')).' %)'
|
||||
if j < len(left[i]) - 1
|
||||
let _ .= lightline#subseparator(left[i][j], left[i][j+1:], g:lightline.subseparator.left)
|
||||
let _ .= s:subseparator(left[i][j], left[i][j+1:], g:lightline.subseparator.left)
|
||||
endif
|
||||
endfor
|
||||
let _ .= printf('%%#LightLineLeft_%s_%d_%d#', mode, i, i + 1) . (i < l ? g:lightline.separator.left : g:lightline.subseparator.left)
|
||||
@@ -190,7 +194,7 @@ function! lightline#statusline(inactive)
|
||||
let _ .= printf('%%#LightLineRight_%s_%d#', mode, i)
|
||||
for j in range(len(right[i]))
|
||||
if j
|
||||
let _ .= lightline#subseparator(right[i][j], right[i][:j-1], g:lightline.subseparator.right)
|
||||
let _ .= s:subseparator(right[i][j], right[i][:j-1], g:lightline.subseparator.right)
|
||||
endif
|
||||
let _ .= '%( '.(has_key(f,right[i][j])?'%{lightline#function("'.f[right[i][j]].'")}':get(c,right[i][j],'')).' %)'
|
||||
endfor
|
||||
|
||||
@@ -4,13 +4,14 @@ Version: 0.0
|
||||
Author: itchyny (https://github.com/itchyny)
|
||||
License: MIT License
|
||||
Repository: https://github.com/itchyny/lightline.vim
|
||||
Last Change: 2013/08/25 17:00:30.
|
||||
Last Change: 2013/08/27 04:42:21.
|
||||
|
||||
CONTENTS *lightline-contents*
|
||||
|
||||
Introduction |lightline-introduction|
|
||||
Options |lightline-options|
|
||||
Option |lightline-option|
|
||||
Font |lightline-font|
|
||||
Function |lightline-function|
|
||||
Examples |lightline-examples|
|
||||
Nice Examples |lightline-nice-examples|
|
||||
Troubleshooting |lightline-troubleshooting|
|
||||
@@ -22,7 +23,7 @@ INTRODUCTION *lightline-introduction*
|
||||
The *lightline* plugin is a light and configurable statusline for Vim.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
OPTIONS *lightline-options*
|
||||
OPTIONS *lightline-option*
|
||||
|
||||
g:lightline *g:lightline*
|
||||
All the options are stored into this global variable.
|
||||
@@ -30,7 +31,8 @@ OPTIONS *lightline-options*
|
||||
g:lightline.active *g:lightline.active*
|
||||
g:lightline.inactive *g:lightline.inactive*
|
||||
Dictionaries to specify the status components.
|
||||
The default values are:
|
||||
Note that right groups of components are stored from right to
|
||||
left. The default values are:
|
||||
>
|
||||
let g:lightline.active = {
|
||||
\ 'left': [ [ 'mode', 'paste' ],
|
||||
@@ -94,11 +96,15 @@ OPTIONS *lightline-options*
|
||||
<
|
||||
g:lightline.colorscheme *g:lightline.colorscheme*
|
||||
The colorscheme for lightline.vim.
|
||||
Currently, wombat, solarized, powerline, Tomorrow, jellybeans
|
||||
and landscape are available.
|
||||
Currently, wombat, solarized, powerline, jellybeans, Tomorrow,
|
||||
Tomorrow_Night, and landscape are available.
|
||||
The default value is:
|
||||
>
|
||||
let g:lightline.colorscheme = 'default'
|
||||
<
|
||||
Note that the default colorscheme is exactly the same as
|
||||
powerline theme.
|
||||
|
||||
g:lightline.mode_map *g:lightline.mode_map*
|
||||
A dictionary of names for mode.
|
||||
The default value is:
|
||||
@@ -115,6 +121,22 @@ OPTIONS *lightline-options*
|
||||
\ 'S' : 'S-LINE',
|
||||
\ '': 'S-BLOCK',
|
||||
\ '?': ' ' }
|
||||
<
|
||||
When you search a word, you get into the command mode. But you
|
||||
want to keep the mode indicator as 'NORMAL', add
|
||||
>
|
||||
let g:lightline.mode_map.c = 'NORMAL'
|
||||
<
|
||||
to your .vimrc.
|
||||
|
||||
g:lightline.separator *g:lightline.separator*
|
||||
g:lightline.subseparator *g:lightline.subseparator*
|
||||
A dictionaries to store separators.
|
||||
The default value is
|
||||
>
|
||||
let g:lightline.separator = { 'left': '', 'right': '' }
|
||||
let g:lightline.subseparator = { 'left': '|', 'right': '|' }
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
FONT *lightline-font*
|
||||
@@ -169,6 +191,35 @@ look nice.
|
||||
endfunction
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
FUNCTION *lightline-function*
|
||||
Exposed functions for lightline.vim.
|
||||
|
||||
lightline#mode() *lightline#mode()*
|
||||
Returns the mode of the Vim using |g:lightline.mode_map|.
|
||||
|
||||
lightline#init() *lightline#init()*
|
||||
Initializes |g:lightline| variable.
|
||||
|
||||
lightline#colorscheme() *lightline#colorscheme()*
|
||||
Initializes the colorscheme and highlight groups.
|
||||
|
||||
lightline#update() *lightline#update()*
|
||||
Updates all the statuslines of existing windows.
|
||||
|
||||
lightline#update_once() *lightline#update_once()*
|
||||
Updates the statuslines only once.
|
||||
|
||||
Following functions are exposed, but users may not need.
|
||||
|
||||
lightline#link() *lightline#link()*
|
||||
Creates links of highlight groups for the active window.
|
||||
|
||||
lightline#highlight(inactive) *lightline#highlight()*
|
||||
Returns |statusline| strings. If the argument is 0, it returns
|
||||
the statusline for active window, and the statusline for
|
||||
inactive window otherwise.
|
||||
|
||||
==============================================================================
|
||||
|
||||
EXAMPLES *lightline-examples*
|
||||
@@ -182,7 +233,7 @@ In order to change the colorscheme:
|
||||
\ }
|
||||
<
|
||||
|
||||
In order to define own component:
|
||||
In order to define your own component:
|
||||
>
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
|
||||
Reference in New Issue
Block a user