mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-13 22:13:50 -05:00
improve README.md
This commit is contained in:
116
README.md
116
README.md
@@ -447,12 +447,12 @@ How cool!!!
|
|||||||
|
|
||||||
Of course, you can name your component as you wish.
|
Of course, you can name your component as you wish.
|
||||||
```vim
|
```vim
|
||||||
let g:lightline = {
|
let g:lightline = {
|
||||||
\ 'active': {
|
\ 'active': {
|
||||||
\ 'left': [ [ 'mode', 'paste' ],
|
\ 'left': [ [ 'mode', 'paste' ],
|
||||||
\ [ 'my_component' ] ] },
|
\ [ 'my_component' ] ] },
|
||||||
\ 'component_function': {
|
\ 'component_function': {
|
||||||
\ 'my_component': 'MyComponent', ...
|
\ 'my_component': 'MyComponent', ...
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
||||||
@@ -460,54 +460,62 @@ This is the end of the tutorial. For more information, see `:help lightline`. Go
|
|||||||
### My settings
|
### My settings
|
||||||
I show my settings. I use the patched font for vim-powerline.
|
I show my settings. I use the patched font for vim-powerline.
|
||||||
```vim
|
```vim
|
||||||
let g:lightline = {
|
let g:lightline = {
|
||||||
\ 'colorscheme': 'landscape',
|
\ 'colorscheme': 'landscape',
|
||||||
\ 'mode_map': { 'c': 'NORMAL' },
|
\ 'mode_map': { 'c': 'NORMAL' },
|
||||||
\ 'active': {
|
\ 'active': {
|
||||||
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
|
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
|
||||||
\ },
|
\ },
|
||||||
\ 'component_function': {
|
\ 'component_function': {
|
||||||
\ 'modified': 'MyModified',
|
\ 'modified': 'MyModified',
|
||||||
\ 'readonly': 'MyReadonly',
|
\ 'readonly': 'MyReadonly',
|
||||||
\ 'fugitive': 'MyFugitive',
|
\ 'fugitive': 'MyFugitive',
|
||||||
\ 'filename': 'MyFilename',
|
\ 'filename': 'MyFilename',
|
||||||
\ 'fileformat': 'MyFileformat',
|
\ 'fileformat': 'MyFileformat',
|
||||||
\ 'filetype': 'MyFiletype',
|
\ 'filetype': 'MyFiletype',
|
||||||
\ 'fileencoding': 'MyFileencoding',
|
\ 'fileencoding': 'MyFileencoding',
|
||||||
\ 'mode': 'MyMode',
|
\ 'mode': 'MyMode',
|
||||||
\ },
|
\ },
|
||||||
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
||||||
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
||||||
\ }
|
\ }
|
||||||
function! MyModified()
|
|
||||||
return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-'
|
function! MyModified()
|
||||||
endfunction
|
return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-'
|
||||||
function! MyReadonly()
|
endfunction
|
||||||
return &ft !~? 'help\|vimfiler\|gundo' && &ro ? '⭤' : ''
|
|
||||||
endfunction
|
function! MyReadonly()
|
||||||
function! MyFilename()
|
return &ft !~? 'help\|vimfiler\|gundo' && &ro ? '⭤' : ''
|
||||||
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
|
endfunction
|
||||||
\ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
|
|
||||||
\ &ft == 'unite' ? unite#get_status_string() :
|
function! MyFilename()
|
||||||
\ &ft == 'vimshell' ? substitute(b:vimshell.current_dir,expand('~'),'~','') :
|
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
|
||||||
\ '' != expand('%t') ? expand('%t') : '[No Name]') .
|
\ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
|
||||||
\ ('' != MyModified() ? ' ' . MyModified() : '')
|
\ &ft == 'unite' ? unite#get_status_string() :
|
||||||
endfunction
|
\ &ft == 'vimshell' ? substitute(b:vimshell.current_dir,expand('~'),'~','') :
|
||||||
function! MyFugitive()
|
\ '' != expand('%t') ? expand('%t') : '[No Name]') .
|
||||||
return &ft !~? 'vimfiler\|gundo' && exists('*fugitive#head') && len(fugitive#head()) ? '⭠ '.fugitive#head() : ''
|
\ ('' != MyModified() ? ' ' . MyModified() : '')
|
||||||
endfunction
|
endfunction
|
||||||
function! MyFileformat()
|
|
||||||
return winwidth('.') > 70 ? &fileformat : ''
|
function! MyFugitive()
|
||||||
endfunction
|
return &ft !~? 'vimfiler\|gundo' && exists('*fugitive#head') && len(fugitive#head()) ? '⭠ '.fugitive#head() : ''
|
||||||
function! MyFiletype()
|
endfunction
|
||||||
return winwidth('.') > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
|
|
||||||
endfunction
|
function! MyFileformat()
|
||||||
function! MyFileencoding()
|
return winwidth('.') > 70 ? &fileformat : ''
|
||||||
return winwidth('.') > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
|
endfunction
|
||||||
endfunction
|
|
||||||
function! MyMode()
|
function! MyFiletype()
|
||||||
return winwidth('.') > 60 ? lightline#mode() : ''
|
return winwidth('.') > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! MyFileencoding()
|
||||||
|
return winwidth('.') > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! MyMode()
|
||||||
|
return winwidth('.') > 60 ? lightline#mode() : ''
|
||||||
|
endfunction
|
||||||
```
|
```
|
||||||
When the current window width is narrow, the mode component and the file information component collapse.
|
When the current window width is narrow, the mode component and the file information component collapse.
|
||||||
For example, the [gundo](https://github.com/sjl/gundo.vim) buffer is narrow.
|
For example, the [gundo](https://github.com/sjl/gundo.vim) buffer is narrow.
|
||||||
|
|||||||
Reference in New Issue
Block a user