function! MyModified() return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-' endfunction function! MyReadonly() return &ft !~? 'help' && &readonly ? 'RO' : '' endfunction function! MyFilename() let fname = expand('%:t') return fname == 'ControlP' ? g:lightline.ctrlp_item : \ fname == '__Tagbar__' ? g:lightline.fname : \ fname =~ '__Gundo\|NERD_tree' ? '' : \ &ft == 'vimfiler' ? vimfiler#get_status_string() : \ &ft == 'unite' ? unite#get_status_string() : \ &ft == 'vimshell' ? vimshell#get_status_string() : \ ('' != MyReadonly() ? MyReadonly() . ' ' : '') . \ ('' != fname ? fname : '[No Name]') . \ ('' != MyModified() ? ' ' . MyModified() : '') endfunction function! MyFugitive() try if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head') let mark = "\ue80a " " edit here for cool mark let _ = fugitive#head() return strlen(_) ? mark._ : '' endif catch endtry return '' endfunction function! MyFileformat() return winwidth(0) > 70 ? &fileformat : '' endfunction function! MyFiletype() return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : '' endfunction function! MyFileencoding() return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : '' endfunction function! MyMode() let fname = expand('%:t') return fname == '__Tagbar__' ? 'Tagbar' : \ fname == 'ControlP' ? 'CtrlP' : \ fname == '__Gundo__' ? 'Gundo' : \ fname == '__Gundo_Preview__' ? 'Gundo Preview' : \ fname =~ 'NERD_tree' ? 'NERDTree' : \ &ft == 'unite' ? 'Unite' : \ &ft == 'vimfiler' ? 'VimFiler' : \ &ft == 'vimshell' ? 'VimShell' : \ winwidth(0) > 60 ? lightline#mode() : '' endfunction function! MyGitGutter() if ! exists('*GitGutterGetHunkSummary') \ || ! get(g:, 'gitgutter_enabled', 0) \ || winwidth('.') <= 90 return '' endif let symbols = [ \ g:gitgutter_sign_added . ' ', \ g:gitgutter_sign_modified . ' ', \ g:gitgutter_sign_removed . ' ' \ ] let hunks = GitGutterGetHunkSummary() let ret = [] for i in [0, 1, 2] if hunks[i] > 0 call add(ret, symbols[i] . hunks[i]) endif endfor return join(ret, ' ') endfunction function! MyQfstatus() let qflist = getqflist() call filter(qflist, 'v:val.valid != 0') if len(qflist) == 0 return '' endif return "[ QF: " . len(qflist) . " item(s) ]" endfunction