Skip to content

Instantly share code, notes, and snippets.

@note103
Created April 14, 2016 17:17
Show Gist options
  • Save note103/4efce80fa78ec19111b7e12de3aaa000 to your computer and use it in GitHub Desktop.
Save note103/4efce80fa78ec19111b7e12de3aaa000 to your computer and use it in GitHub Desktop.
let g:lightline = {
\ 'colorscheme': 'seoul256',
\ 'mode_map': {'c': 'NORMAL'},
\ 'active': {
\ 'right': [ [ 'syntastic', 'lineinfo' ],
\ [ 'percent' ], [ 'winform' ],
\ [ 'fileformat', 'fileencoding', 'filetype' ] ],
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'branch', 'filename' ] ]
\ },
\ 'component_function': {
\ 'linetotal': 'LightLineTotal',
\ 'modified': 'LightLineModified',
\ 'readonly': 'LightLineReadonly',
\ 'fugitive': 'LightLineFugitive',
\ 'filename': 'LightLineFilename',
\ 'filepath': 'LightLineFilepath',
\ 'fileformat': 'LightLineFileformat',
\ 'filetype': 'LightLineFiletype',
\ 'fileencoding': 'LightLineFileencoding',
\ 'mode': 'LightLineMode',
\ 'winform': 'LightLineWinform'
\ },
\ 'separator': { 'left': "\u2b80", 'right': "\u2b82" },
\ 'subseparator': { 'left': "\u2b81", 'right': "\u2b83" },
\ 'component_expand': {
\ 'syntastic': 'SyntasticStatuslineFlag',
\ },
\ 'component_type': {
\ 'syntastic': 'error',
\ }
\ }
let g:lightline.component = {
\ 'lineinfo': '%3l[%L]:%-2v'}
function! LightLineWinform()
return winwidth(0) > 50 ? 'w' . winwidth(0) . ':' . 'h' . winheight(0) : ''
endfunction
function! LightLineModified()
return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction
function! LightLineReadonly()
return &ft !~? 'help\|vimfiler\|gundo' && &readonly ? "⭤" : ''
endfunction
function! LightLineFilename()
return ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
\ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
\ &ft == 'unite' ? unite#get_status_string() :
\ &ft == 'vimshell' ? vimshell#get_status_string() :
\ '' != expand('%') && winwidth(0) <=120 ? expand('%:t') : winwidth(0) >120 ? expand('%:p') : '[No Name]') .
\ ('' != LightLineModified() ? ' ' . LightLineModified() : '')
endfunction
function! LightLineFilepath()
return winwidth(0) <=120 ? expand('%:h') : ''
endfunction
function! LightLineFugitive()
try
if &ft !~? 'vimfiler\|gundo' && exists('*fugitive#head') && winwidth(0) > 55
let _ = fugitive#head()
return strlen(_) ? '⭠ '._ : ''
endif
catch
endtry
return ''
endfunction
function! LightLineFileformat()
return winwidth(0) > 80 ? &fileformat : ''
endfunction
function! LightLineFiletype()
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
endfunction
function! LightLineFileencoding()
return winwidth(0) > 60 ? (strlen(&fenc) ? &fenc : &enc) : ''
endfunction
function! LightLineMode()
return winwidth(0) > 30 ? lightline#mode() : ''
endfunction
function! s:syntastic()
SyntasticCheck
call lightline#update()
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment