mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-13 22:13:50 -05:00
283 lines
8.4 KiB
Plaintext
283 lines
8.4 KiB
Plaintext
*lightline.txt* A light and configurable statusline for Vim
|
||
|
||
Version: 0.0
|
||
Author: itchyny (https://github.com/itchyny)
|
||
License: MIT License
|
||
Repository: https://github.com/itchyny/lightline.vim
|
||
Last Change: 2013/08/22 21:09:59.
|
||
|
||
CONTENTS *lightline-contents*
|
||
|
||
Introduction |lightline-introduction|
|
||
Options |lightline-options|
|
||
Font |lightline-font|
|
||
Examples |lightline-examples|
|
||
Nice Examples |lightline-nice-examples|
|
||
Troubleshooting |lightline-troubleshooting|
|
||
Changelog |lightline-changelog|
|
||
|
||
==============================================================================
|
||
INTRODUCTION *lightline-introduction*
|
||
|
||
The *lightline* plugin is a light and configurable statusline for Vim.
|
||
|
||
------------------------------------------------------------------------------
|
||
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. 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
|
||
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',
|
||
\ '?': ' ' }
|
||
|
||
==============================================================================
|
||
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*
|
||
You can configure the appearance of statusline.
|
||
Write the following examples in you .vimrc(_vimrc).
|
||
|
||
In order to change the colorscheme:
|
||
>
|
||
let g:lightline = {
|
||
\ 'colorscheme': 'wombat',
|
||
\ }
|
||
<
|
||
|
||
In order to define own component:
|
||
>
|
||
let g:lightline = {
|
||
\ 'active': {
|
||
\ 'left': [ [ 'mode', 'paste' ], [ 'myfilename' ] ]
|
||
\ },
|
||
\ 'component_func': {
|
||
\ 'myfilename': 'MyFilename',
|
||
\ 'myreadonly': 'MyReadonly',
|
||
\ 'mymodified': 'MyModified',
|
||
\ },
|
||
\ }
|
||
function! MyFilename()
|
||
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
|
||
\ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
|
||
\ &ft == 'unite' ? unite#get_status_string() :
|
||
\ '' != expand('%t') ? expand('%t') : '[No Name]') .
|
||
\ ('' != MyModified() ? ' ' . MyModified() : '')
|
||
endfunction
|
||
function! MyReadonly()
|
||
return &ft !~? 'help' && &ro ? 'RO' : ''
|
||
endfunction
|
||
function! MyModified()
|
||
return &modifiable && &modified ? '+' : ''
|
||
endfunction
|
||
<
|
||
|
||
Separators settings:
|
||
>
|
||
let g:lightline = {
|
||
\ 'separator': { 'left': '▶', 'right': '◀' },
|
||
\ 'subseparator': { 'left': '>', 'right': '<' }
|
||
\ }
|
||
<
|
||
|
||
For |powerline| font users:
|
||
>
|
||
let g:lightline = {
|
||
\ 'separator': { 'left': '', 'right': '' },
|
||
\ 'subseparator': { 'left': '', 'right': '' }
|
||
\ }
|
||
<
|
||
|
||
For |vim-powerline| font users:
|
||
>
|
||
let g:lightline = {
|
||
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
||
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
||
\ }
|
||
<
|
||
|
||
------------------------------------------------------------------------------
|
||
NICE EXAMPLES *lightline-nice-examples*
|
||
|
||
A nice example for |vim-powerline| font users:
|
||
>
|
||
let g:lightline = {
|
||
\ 'colorscheme': 'wombat',
|
||
\ 'active': {
|
||
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
|
||
\ },
|
||
\ 'component_func': {
|
||
\ 'fugitive': 'MyFugitive',
|
||
\ 'filename': 'MyFilename'
|
||
\ },
|
||
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
||
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
||
\ }
|
||
function! MyModified()
|
||
return &ft =~ 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-'
|
||
endfunction
|
||
function! MyReadonly()
|
||
return &ft !~? 'help\|vimfiler' && &ro ? '⭤' : ''
|
||
endfunction
|
||
function! MyFilename()
|
||
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
|
||
\ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
|
||
\ &ft == 'unite' ? unite#get_status_string() :
|
||
\ &ft == 'vimshell' ? vimshell#get_status_string() :
|
||
\ '' != expand('%t') ? expand('%t') : '[No Name]') .
|
||
\ ('' != MyModified() ? ' ' . MyModified() : '')
|
||
endfunction
|
||
function! MyFugitive()
|
||
return &ft !~? 'vimfiler' && exists("*fugitive#head") && len(fugitive#head()) ? '⭠ '.fugitive#head() : ''
|
||
endfunction
|
||
<
|
||
------------------------------------------------------------------------------
|
||
TROUBLESHOOTING *lightline-troubleshooting*
|
||
|
||
|
||
==============================================================================
|
||
CHANGELOG *lightline-changelog*
|
||
|
||
0.0 2013-08-21, ...
|
||
- Initial commit and implementation
|
||
|
||
==============================================================================
|
||
vim:tw=78:sw=4:ts=8:ft=help:norl:noet:
|