change My prefix to LightLine prefix

This commit is contained in:
itchyny
2015-07-25 16:59:39 +09:00
parent 74a46a49f0
commit f954924668
2 changed files with 105 additions and 105 deletions

104
README.md
View File

@@ -426,15 +426,15 @@ let g:lightline = {
\ [ 'fugitive', 'readonly', 'filename', 'modified' ] ] \ [ 'fugitive', 'readonly', 'filename', 'modified' ] ]
\ }, \ },
\ 'component_function': { \ 'component_function': {
\ 'fugitive': 'MyFugitive', \ 'fugitive': 'LightLineFugitive',
\ 'readonly': 'MyReadonly', \ 'readonly': 'LightLineReadonly',
\ 'modified': 'MyModified' \ 'modified': 'LightLineModified'
\ }, \ },
\ 'separator': { 'left': '⮀', 'right': '⮂' }, \ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' } \ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ } \ }
function! MyModified() function! LightLineModified()
if &filetype == "help" if &filetype == "help"
return "" return ""
elseif &modified elseif &modified
@@ -446,7 +446,7 @@ function! MyModified()
endif endif
endfunction endfunction
function! MyReadonly() function! LightLineReadonly()
if &filetype == "help" if &filetype == "help"
return "" return ""
elseif &readonly elseif &readonly
@@ -456,7 +456,7 @@ function! MyReadonly()
endif endif
endfunction endfunction
function! MyFugitive() function! LightLineFugitive()
return exists('*fugitive#head') ? fugitive#head() : '' return exists('*fugitive#head') ? fugitive#head() : ''
endfunction endfunction
``` ```
@@ -475,16 +475,16 @@ let g:lightline = {
\ [ 'fugitive', 'filename' ] ] \ [ 'fugitive', 'filename' ] ]
\ }, \ },
\ 'component_function': { \ 'component_function': {
\ 'fugitive': 'MyFugitive', \ 'fugitive': 'LightLineFugitive',
\ 'readonly': 'MyReadonly', \ 'readonly': 'LightLineReadonly',
\ 'modified': 'MyModified', \ 'modified': 'LightLineModified',
\ 'filename': 'MyFilename' \ 'filename': 'LightLineFilename'
\ }, \ },
\ 'separator': { 'left': '⮀', 'right': '⮂' }, \ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' } \ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ } \ }
function! MyModified() function! LightLineModified()
if &filetype == "help" if &filetype == "help"
return "" return ""
elseif &modified elseif &modified
@@ -496,7 +496,7 @@ function! MyModified()
endif endif
endfunction endfunction
function! MyReadonly() function! LightLineReadonly()
if &filetype == "help" if &filetype == "help"
return "" return ""
elseif &readonly elseif &readonly
@@ -506,21 +506,21 @@ function! MyReadonly()
endif endif
endfunction endfunction
function! MyFugitive() function! LightLineFugitive()
return exists('*fugitive#head') ? fugitive#head() : '' return exists('*fugitive#head') ? fugitive#head() : ''
endfunction endfunction
function! MyFilename() function! LightLineFilename()
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') . return ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
\ ('' != expand('%:t') ? expand('%:t') : '[No Name]') . \ ('' != expand('%:t') ? expand('%:t') : '[No Name]') .
\ ('' != MyModified() ? ' ' . MyModified() : '') \ ('' != LightLineModified() ? ' ' . LightLineModified() : '')
endfunction endfunction
``` ```
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/14.png) ![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/14.png)
Oops! We forgot the cool mark for the branch component! (work with the patched font for vim-powerline) Oops! We forgot the cool mark for the branch component! (work with the patched font for vim-powerline)
```vim ```vim
function! MyFugitive() function! LightLineFugitive()
if exists("*fugitive#head") if exists("*fugitive#head")
let _ = fugitive#head() let _ = fugitive#head()
return strlen(_) ? '⭠ '._ : '' return strlen(_) ? '⭠ '._ : ''
@@ -539,7 +539,7 @@ let g:lightline = {
\ 'left': [ [ 'mode', 'paste' ], \ 'left': [ [ 'mode', 'paste' ],
\ [ 'my_component' ] ] }, \ [ 'my_component' ] ] },
\ 'component_function': { \ 'component_function': {
\ 'my_component': 'MyComponent', ... \ 'my_component': 'LightLineComponent', ...
``` ```
This is the end of the tutorial. For more information, see `:help lightline`. Good luck with your nice statuslines. This is the end of the tutorial. For more information, see `:help lightline`. Good luck with your nice statuslines.
@@ -566,37 +566,37 @@ let g:lightline = {
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ] \ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
\ }, \ },
\ 'component_function': { \ 'component_function': {
\ 'modified': 'MyModified', \ 'modified': 'LightLineModified',
\ 'readonly': 'MyReadonly', \ 'readonly': 'LightLineReadonly',
\ 'fugitive': 'MyFugitive', \ 'fugitive': 'LightLineFugitive',
\ 'filename': 'MyFilename', \ 'filename': 'LightLineFilename',
\ 'fileformat': 'MyFileformat', \ 'fileformat': 'LightLineFileformat',
\ 'filetype': 'MyFiletype', \ 'filetype': 'LightLineFiletype',
\ 'fileencoding': 'MyFileencoding', \ 'fileencoding': 'LightLineFileencoding',
\ 'mode': 'MyMode', \ 'mode': 'LightLineMode',
\ }, \ },
\ 'separator': { 'left': '⮀', 'right': '⮂' }, \ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' } \ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ } \ }
function! MyModified() function! LightLineModified()
return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-' return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction endfunction
function! MyReadonly() function! LightLineReadonly()
return &ft !~? 'help\|vimfiler\|gundo' && &readonly ? '⭤' : '' return &ft !~? 'help\|vimfiler\|gundo' && &readonly ? '⭤' : ''
endfunction endfunction
function! MyFilename() function! LightLineFilename()
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') . return ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
\ (&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() : \ &ft == 'vimshell' ? vimshell#get_status_string() :
\ '' != expand('%:t') ? expand('%:t') : '[No Name]') . \ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
\ ('' != MyModified() ? ' ' . MyModified() : '') \ ('' != LightLineModified() ? ' ' . LightLineModified() : '')
endfunction endfunction
function! MyFugitive() function! LightLineFugitive()
if &ft !~? 'vimfiler\|gundo' && exists("*fugitive#head") if &ft !~? 'vimfiler\|gundo' && exists("*fugitive#head")
let _ = fugitive#head() let _ = fugitive#head()
return strlen(_) ? '⭠ '._ : '' return strlen(_) ? '⭠ '._ : ''
@@ -604,19 +604,19 @@ function! MyFugitive()
return '' return ''
endfunction endfunction
function! MyFileformat() function! LightLineFileformat()
return winwidth(0) > 70 ? &fileformat : '' return winwidth(0) > 70 ? &fileformat : ''
endfunction endfunction
function! MyFiletype() function! LightLineFiletype()
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : '' return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
endfunction endfunction
function! MyFileencoding() function! LightLineFileencoding()
return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : '' return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
endfunction endfunction
function! MyMode() function! LightLineMode()
return winwidth(0) > 60 ? lightline#mode() : '' return winwidth(0) > 60 ? lightline#mode() : ''
endfunction endfunction
``` ```
@@ -651,12 +651,12 @@ let g:lightline = {
\ 'right': [ [ 'syntastic', 'lineinfo' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype' ] ] \ 'right': [ [ 'syntastic', 'lineinfo' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype' ] ]
\ }, \ },
\ 'component_function': { \ 'component_function': {
\ 'fugitive': 'MyFugitive', \ 'fugitive': 'LightLineFugitive',
\ 'filename': 'MyFilename', \ 'filename': 'LightLineFilename',
\ 'fileformat': 'MyFileformat', \ 'fileformat': 'LightLineFileformat',
\ 'filetype': 'MyFiletype', \ 'filetype': 'LightLineFiletype',
\ 'fileencoding': 'MyFileencoding', \ 'fileencoding': 'LightLineFileencoding',
\ 'mode': 'MyMode', \ 'mode': 'LightLineMode',
\ 'ctrlpmark': 'CtrlPMark', \ 'ctrlpmark': 'CtrlPMark',
\ }, \ },
\ 'component_expand': { \ 'component_expand': {
@@ -668,15 +668,15 @@ let g:lightline = {
\ 'subseparator': { 'left': '|', 'right': '|' } \ 'subseparator': { 'left': '|', 'right': '|' }
\ } \ }
function! MyModified() function! LightLineModified()
return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-' return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction endfunction
function! MyReadonly() function! LightLineReadonly()
return &ft !~? 'help' && &readonly ? 'RO' : '' return &ft !~? 'help' && &readonly ? 'RO' : ''
endfunction endfunction
function! MyFilename() function! LightLineFilename()
let fname = expand('%:t') let fname = expand('%:t')
return fname == 'ControlP' ? g:lightline.ctrlp_item : return fname == 'ControlP' ? g:lightline.ctrlp_item :
\ fname == '__Tagbar__' ? g:lightline.fname : \ fname == '__Tagbar__' ? g:lightline.fname :
@@ -684,12 +684,12 @@ function! MyFilename()
\ &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() : \ &ft == 'vimshell' ? vimshell#get_status_string() :
\ ('' != MyReadonly() ? MyReadonly() . ' ' : '') . \ ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
\ ('' != fname ? fname : '[No Name]') . \ ('' != fname ? fname : '[No Name]') .
\ ('' != MyModified() ? ' ' . MyModified() : '') \ ('' != LightLineModified() ? ' ' . LightLineModified() : '')
endfunction endfunction
function! MyFugitive() function! LightLineFugitive()
try try
if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head') if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head')
let mark = '' " edit here for cool mark let mark = '' " edit here for cool mark
@@ -701,19 +701,19 @@ function! MyFugitive()
return '' return ''
endfunction endfunction
function! MyFileformat() function! LightLineFileformat()
return winwidth(0) > 70 ? &fileformat : '' return winwidth(0) > 70 ? &fileformat : ''
endfunction endfunction
function! MyFiletype() function! LightLineFiletype()
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : '' return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
endfunction endfunction
function! MyFileencoding() function! LightLineFileencoding()
return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : '' return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
endfunction endfunction
function! MyMode() function! LightLineMode()
let fname = expand('%:t') let fname = expand('%:t')
return fname == '__Tagbar__' ? 'Tagbar' : return fname == '__Tagbar__' ? 'Tagbar' :
\ fname == 'ControlP' ? 'CtrlP' : \ fname == 'ControlP' ? 'CtrlP' :

View File

@@ -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: 2015/03/29 07:25:53. Last Change: 2015/07/25 16:57:02.
CONTENTS *lightline-contents* CONTENTS *lightline-contents*
@@ -143,10 +143,10 @@ OPTIONS *lightline-option*
\ [ 'myreadonly', 'filename', 'modified' ] ], \ [ 'myreadonly', 'filename', 'modified' ] ],
\ }, \ },
\ 'component_function': { \ 'component_function': {
\ 'myreadonly': 'MyReadonly' \ 'myreadonly': 'LightLineReadonly'
\ }, \ },
\ } \ }
function! MyReadonly() function! LightLineReadonly()
return &ft !~? 'help' && &readonly ? 'RO' : '' return &ft !~? 'help' && &readonly ? 'RO' : ''
endfunction endfunction
< <
@@ -274,16 +274,16 @@ nice.
\ 'lineinfo': ' %3l:%-2v', \ 'lineinfo': ' %3l:%-2v',
\ }, \ },
\ 'component_function': { \ 'component_function': {
\ 'readonly': 'MyReadonly', \ 'readonly': 'LightLineReadonly',
\ 'fugitive': 'MyFugitive' \ 'fugitive': 'LightLineFugitive'
\ }, \ },
\ 'separator': { 'left': '', 'right': '' }, \ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '', 'right': '' } \ 'subseparator': { 'left': '', 'right': '' }
\ } \ }
function! MyReadonly() function! LightLineReadonly()
return &readonly ? '' : '' return &readonly ? '' : ''
endfunction endfunction
function! MyFugitive() function! LightLineFugitive()
if exists('*fugitive#head') if exists('*fugitive#head')
let _ = fugitive#head() let _ = fugitive#head()
return strlen(_) ? ''._ : '' return strlen(_) ? ''._ : ''
@@ -299,16 +299,16 @@ look nice.
\ 'lineinfo': '⭡ %3l:%-2v', \ 'lineinfo': '⭡ %3l:%-2v',
\ }, \ },
\ 'component_function': { \ 'component_function': {
\ 'readonly': 'MyReadonly', \ 'readonly': 'LightLineReadonly',
\ 'fugitive': 'MyFugitive' \ 'fugitive': 'LightLineFugitive'
\ }, \ },
\ 'separator': { 'left': '⮀', 'right': '⮂' }, \ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' } \ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ } \ }
function! MyReadonly() function! LightLineReadonly()
return &readonly ? '⭤' : '' return &readonly ? '⭤' : ''
endfunction endfunction
function! MyFugitive() function! LightLineFugitive()
if exists('*fugitive#head') if exists('*fugitive#head')
let _ = fugitive#head() let _ = fugitive#head()
return strlen(_) ? '⭠ '._ : '' return strlen(_) ? '⭠ '._ : ''
@@ -630,22 +630,22 @@ In order to define your own component:
\ 'left': [ [ 'mode', 'paste' ], [ 'myfilename' ] ] \ 'left': [ [ 'mode', 'paste' ], [ 'myfilename' ] ]
\ }, \ },
\ 'component_function': { \ 'component_function': {
\ 'myfilename': 'MyFilename', \ 'myfilename': 'LightLineFilename',
\ 'myreadonly': 'MyReadonly', \ 'myreadonly': 'LightLineReadonly',
\ 'mymodified': 'MyModified', \ 'mymodified': 'LightLineModified',
\ } \ }
\ } \ }
function! MyFilename() function! LightLineFilename()
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') . return ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
\ (&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]') .
\ ('' != MyModified() ? ' ' . MyModified() : '') \ ('' != LightLineModified() ? ' ' . LightLineModified() : '')
endfunction endfunction
function! MyReadonly() function! LightLineReadonly()
return &ft !~? 'help' && &readonly ? 'RO' : '' return &ft !~? 'help' && &readonly ? 'RO' : ''
endfunction endfunction
function! MyModified() function! LightLineModified()
return &modifiable && &modified ? '+' : '' return &modifiable && &modified ? '+' : ''
endfunction endfunction
< <
@@ -685,25 +685,25 @@ A nice example for non-patched font users.
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ] \ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
\ }, \ },
\ 'component_function': { \ 'component_function': {
\ 'fugitive': 'MyFugitive', \ 'fugitive': 'LightLineFugitive',
\ 'filename': 'MyFilename' \ 'filename': 'LightLineFilename'
\ } \ }
\ } \ }
function! MyModified() function! LightLineModified()
return &ft =~ 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-' return &ft =~ 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction endfunction
function! MyReadonly() function! LightLineReadonly()
return &ft !~? 'help\|vimfiler' && &readonly ? 'RO' : '' return &ft !~? 'help\|vimfiler' && &readonly ? 'RO' : ''
endfunction endfunction
function! MyFilename() function! LightLineFilename()
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') . return ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
\ (&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() : \ &ft == 'vimshell' ? vimshell#get_status_string() :
\ '' != expand('%:t') ? expand('%:t') : '[No Name]') . \ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
\ ('' != MyModified() ? ' ' . MyModified() : '') \ ('' != LightLineModified() ? ' ' . LightLineModified() : '')
endfunction endfunction
function! MyFugitive() function! LightLineFugitive()
if &ft !~? 'vimfiler' && exists('*fugitive#head') if &ft !~? 'vimfiler' && exists('*fugitive#head')
return fugitive#head() return fugitive#head()
endif endif
@@ -718,27 +718,27 @@ A nice example for |vim-powerline| font users:
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ] \ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
\ }, \ },
\ 'component_function': { \ 'component_function': {
\ 'fugitive': 'MyFugitive', \ 'fugitive': 'LightLineFugitive',
\ 'filename': 'MyFilename' \ 'filename': 'LightLineFilename'
\ }, \ },
\ 'separator': { 'left': '⮀', 'right': '⮂' }, \ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' } \ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ } \ }
function! MyModified() function! LightLineModified()
return &ft =~ 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-' return &ft =~ 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction endfunction
function! MyReadonly() function! LightLineReadonly()
return &ft !~? 'help\|vimfiler' && &readonly ? '⭤' : '' return &ft !~? 'help\|vimfiler' && &readonly ? '⭤' : ''
endfunction endfunction
function! MyFilename() function! LightLineFilename()
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') . return ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
\ (&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() : \ &ft == 'vimshell' ? vimshell#get_status_string() :
\ '' != expand('%:t') ? expand('%:t') : '[No Name]') . \ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
\ ('' != MyModified() ? ' ' . MyModified() : '') \ ('' != LightLineModified() ? ' ' . LightLineModified() : '')
endfunction endfunction
function! MyFugitive() function! LightLineFugitive()
if &ft !~? 'vimfiler' && exists('*fugitive#head') if &ft !~? 'vimfiler' && exists('*fugitive#head')
let _ = fugitive#head() let _ = fugitive#head()
return strlen(_) ? '⭠ '._ : '' return strlen(_) ? '⭠ '._ : ''
@@ -759,12 +759,12 @@ For users who uses lots of plugins:
\ 'right': [ [ 'syntastic', 'lineinfo' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype' ] ] \ 'right': [ [ 'syntastic', 'lineinfo' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype' ] ]
\ }, \ },
\ 'component_function': { \ 'component_function': {
\ 'fugitive': 'MyFugitive', \ 'fugitive': 'LightLineFugitive',
\ 'filename': 'MyFilename', \ 'filename': 'LightLineFilename',
\ 'fileformat': 'MyFileformat', \ 'fileformat': 'LightLineFileformat',
\ 'filetype': 'MyFiletype', \ 'filetype': 'LightLineFiletype',
\ 'fileencoding': 'MyFileencoding', \ 'fileencoding': 'LightLineFileencoding',
\ 'mode': 'MyMode', \ 'mode': 'LightLineMode',
\ 'ctrlpmark': 'CtrlPMark', \ 'ctrlpmark': 'CtrlPMark',
\ }, \ },
\ 'component_expand': { \ 'component_expand': {
@@ -776,15 +776,15 @@ For users who uses lots of plugins:
\ 'subseparator': { 'left': '|', 'right': '|' } \ 'subseparator': { 'left': '|', 'right': '|' }
\ } \ }
function! MyModified() function! LightLineModified()
return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-' return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction endfunction
function! MyReadonly() function! LightLineReadonly()
return &ft !~? 'help' && &readonly ? 'RO' : '' return &ft !~? 'help' && &readonly ? 'RO' : ''
endfunction endfunction
function! MyFilename() function! LightLineFilename()
let fname = expand('%:t') let fname = expand('%:t')
return fname == 'ControlP' ? g:lightline.ctrlp_item : return fname == 'ControlP' ? g:lightline.ctrlp_item :
\ fname == '__Tagbar__' ? g:lightline.fname : \ fname == '__Tagbar__' ? g:lightline.fname :
@@ -792,12 +792,12 @@ For users who uses lots of plugins:
\ &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() : \ &ft == 'vimshell' ? vimshell#get_status_string() :
\ ('' != MyReadonly() ? MyReadonly() . ' ' : '') . \ ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
\ ('' != fname ? fname : '[No Name]') . \ ('' != fname ? fname : '[No Name]') .
\ ('' != MyModified() ? ' ' . MyModified() : '') \ ('' != LightLineModified() ? ' ' . LightLineModified() : '')
endfunction endfunction
function! MyFugitive() function! LightLineFugitive()
try try
if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head') if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head')
let mark = '' " edit here for cool mark let mark = '' " edit here for cool mark
@@ -809,19 +809,19 @@ For users who uses lots of plugins:
return '' return ''
endfunction endfunction
function! MyFileformat() function! LightLineFileformat()
return winwidth(0) > 70 ? &fileformat : '' return winwidth(0) > 70 ? &fileformat : ''
endfunction endfunction
function! MyFiletype() function! LightLineFiletype()
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : '' return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
endfunction endfunction
function! MyFileencoding() function! LightLineFileencoding()
return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : '' return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
endfunction endfunction
function! MyMode() function! LightLineMode()
let fname = expand('%:t') let fname = expand('%:t')
return fname == '__Tagbar__' ? 'Tagbar' : return fname == '__Tagbar__' ? 'Tagbar' :
\ fname == 'ControlP' ? 'CtrlP' : \ fname == 'ControlP' ? 'CtrlP' :
@@ -1147,10 +1147,10 @@ Problem 12: *lightline-problem-12*
> >
let g:lightline = { let g:lightline = {
\ 'component': { \ 'component': {
\ 'modified': '%#ModifiedColor#%{MyModified()}', \ 'modified': '%#ModifiedColor#%{LightLineModified()}',
\ } \ }
\ } \ }
function! MyModified() function! LightLineModified()
let map = { 'V': 'n', "\<C-v>": 'n', 's': 'n', 'v': 'n', "\<C-s>": 'n', 'c': 'n', 'R': 'n'} let map = { 'V': 'n', "\<C-v>": 'n', 's': 'n', 'v': 'n', "\<C-s>": 'n', 'c': 'n', 'R': 'n'}
let mode = get(map, mode()[0], mode()[0]) let mode = get(map, mode()[0], mode()[0])
let bgcolor = {'n': [240, '#585858'], 'i': [31, '#0087af']} let bgcolor = {'n': [240, '#585858'], 'i': [31, '#0087af']}