mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-12 21:43:50 -05:00
add my setting in README.md
This commit is contained in:
53
README.md
53
README.md
@@ -287,3 +287,56 @@ Of course, you can name your component as you wish.
|
||||
```
|
||||
|
||||
This is the end of the tutorial. For more information, see `:help lightline`. Good luck with your nice statuslines.
|
||||
|
||||
### My setting
|
||||
Here's my setting. I use the patched font for vim-powerline.
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'landscape',
|
||||
\ 'mode_map': { 'c': 'NORMAL' },
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
|
||||
\ },
|
||||
\ 'component_func': {
|
||||
\ 'modified': 'MyModified',
|
||||
\ 'readonly': 'MyReadonly',
|
||||
\ 'fugitive': 'MyFugitive',
|
||||
\ 'filename': 'MyFilename',
|
||||
\ 'fileformat': 'MyFileformat',
|
||||
\ 'filetype': 'MyFiletype',
|
||||
\ 'fileencoding': 'MyFileencoding',
|
||||
\ 'mode': 'MyMode',
|
||||
\ },
|
||||
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
||||
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
||||
\ }
|
||||
function! MyModified()
|
||||
return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-'
|
||||
endfunction
|
||||
function! MyReadonly()
|
||||
return &ft !~? 'help\|vimfiler\|gundo' && &ro ? '⭤' : ''
|
||||
endfunction
|
||||
function! MyFilename()
|
||||
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
|
||||
\ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
|
||||
\ &ft == 'unite' ? unite#get_status_string() :
|
||||
\ &ft == 'vimshell' ? substitute(b:vimshell.current_dir,expand('~'),'~','') :
|
||||
\ '' != expand('%t') ? expand('%t') : '[No Name]') .
|
||||
\ ('' != MyModified() ? ' ' . MyModified() : '')
|
||||
endfunction
|
||||
function! MyFugitive()
|
||||
return &ft !~? 'vimfiler\|gundo' && exists('*fugitive#head') && len(fugitive#head()) ? '⭠ '.fugitive#head() : ''
|
||||
endfunction
|
||||
function! MyFileformat()
|
||||
return winwidth('.') > 60 ? &fileformat : ''
|
||||
endfunction
|
||||
function! MyFiletype()
|
||||
return winwidth('.') > 60 ? &filetype: ''
|
||||
endfunction
|
||||
function! MyFileencoding()
|
||||
return winwidth('.') > 60 ? (strlen(&fenc) ? &fenc : &enc) : ''
|
||||
endfunction
|
||||
function! MyMode()
|
||||
return winwidth('.') > 60 ? lightline#mode() : ''
|
||||
endfunction
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user