diff options
| author | Robert Günzler <r@gnzler.io> | 2020-01-26 17:16:07 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2020-01-26 18:00:59 +0100 |
| commit | f5d56602df70950de6b7d40966b00c9939c81763 (patch) | |
| tree | b50ffeb5496fe3525cc1bab2629389ced95435b7 /.vim/plugin/line.vim | |
Intial commit of v2
See https://drewdevault.com/2019/12/30/dotfiles.html
Diffstat (limited to '.vim/plugin/line.vim')
| -rw-r--r-- | .vim/plugin/line.vim | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/.vim/plugin/line.vim b/.vim/plugin/line.vim new file mode 100644 index 0000000..66072c3 --- /dev/null +++ b/.vim/plugin/line.vim @@ -0,0 +1,159 @@ +let g:lightline = {} +let g:lightline.colorscheme = 'papercolor_dim' + +let g:lightline.enable = { 'statusline': 1, 'tabline': 1 } + +let g:lightline.mode_map = { +\ 'n' : 'N', +\ 'i' : 'I', +\ 'R' : 'R', +\ 'v' : 'V', +\ 'V' : 'V-LINE', +\ "\<C-v>": 'V-BLOCK', +\ 'c' : '>', +\ 's' : 'SELECT', +\ 'S' : 'S-LINE', +\ "\<C-s>": 'S-BLOCK', +\ 't': 'T', +\ } + +let g:lightline.active = { +\ 'left': [ +\ ['mode', 'paste'], +\ ['filename', 'vista'], +\ ['neomake', 'coc', 'ctags', 'obsession'], +\ ], +\ 'right': [ +\ ['filetype', 'fileencoding', 'fileformat'], +\ ['lineinfo', 'percent'], +\ ['tabstatus'], +\ ], +\ } + +set showtabline=2 +let g:lightline.tabline = { +\ 'right': [ +\ ['tabs'], +\ ['porcelain'], +\ ], +\ } + +let g:lightline.tab = { +\ 'active': ['tabnum'], +\ 'inactive': ['tabnum'], +\ } + +let g:lightline.component = { +\ 'lineinfo': ' %l:%v', +\ 'filetype': "%{winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''}", +\ 'dir': "%{substitute(expand('%:p:h'), $HOME, '~', '')}", +\ } + +let g:lightline.component_function = { +\ 'filename': 'LightLineFilename', +\ 'fileformat': 'LightLineFileformat', +\ 'fileencoding': 'LightLineFileencoding', +\ 'mode': 'LightLineMode', +\ 'vista': 'LightLineVista', +\ 'o': 'LightLineO', +\ 'porcelain': 'LightLinePorcelain', +\ } + +" \ 'separator': { 'left': "\ue0b8", 'right': "\ue0be" }, +" \ 'subseparator': { 'left': "\ue0b9", 'right': "\ue0b9" }, +" \ 'tabline_separator': { 'left': "\ue0bc", 'right': "\ue0ba" }, +" \ 'tabline_subseparator': { 'left': "\ue0bb", 'right': "\ue0bb" }, +" \ + +let g:lightline.component_expand = {} +let g:lightline.component_type = {} + + +" Modified {{{ +hi ModifiedColor ctermfg=196 guifg=#ff0000 gui=bold +function! LightLineModified() + return &modified ? '+' : &modifiable ? '' : '-' +endfunction +" }}} + +" Readonly {{{ +function! LightLineReadonly() + return &filetype !~? 'help\|vimfiler\|gundo' && &readonly ? '' : '' +endfunction +" }}} + +" Filename {{{ +function! LightLineFilename() + return ('' !=? LightLineReadonly() ? LightLineReadonly() . ' ' : '') . + \ (&filetype ==# 'vimfiler' ? vimfiler#get_status_string() : + \ &filetype ==# 'unite' ? unite#get_status_string() : + \ &filetype ==# 'vimshell' ? vimshell#get_status_string() : + \ '' !=? expand('%:t') ? expand('%:t') : '[No Name]') . + \ ('' !=? LightLineModified() ? ' ' . LightLineModified() : '') +endfunction +" }}} + +" Fileformat {{{ +function! LightLineFileformat() + if (&fileformat == 'unix') + return '' + endif + return winwidth(0) > 70 ? &fileformat : '' +endfunction +" }}} + +" Fileencoding {{{ +function! LightLineFileencoding() + if (&fileencoding == 'utf-8') + return '' + endif + return winwidth(0) > 70 ? (strlen(&fileencoding) ? &fileencoding : &encoding) : '' +endfunction +" }}} + +" Mode {{{ +function! LightLineMode() + return winwidth(0) > 60 ? ( + \ expand('%:t') ==# '__Tagbar__' ? 'Tagbar': + \ &filetype ==# 'vimfiler' ? 'VimFiler' : + \ &filetype ==# 'vimshell' ? 'VimShell' : + \ &filetype ==# 'dirvish' ? 'DIRVISH' : + \ lightline#mode() ) + \ : '' +endfunction +" }}} + +" Tabchar {{{ +function! LightLineTabchar() + return '[' + \ . &tabstop + \ . (&expandtab == 1 ? '->' : '<>') + \ . &shiftwidth + \ . ']' +endfunction +" }}} + +" Vista {{{ +function! LightLineVista() + let l:sym = get(b:, 'vista_nearest_method_or_function', '') + return empty(l:sym) ? '' : g:vista#renderer#icons.function . ' ' . l:sym +endfunction +" }}} + +" Porcelain {{{ +function! LightLinePorcelain() + if &buftype !=# 'terminal' + let gitinfo = system('porcelain -no-color -path=' . expand('%:h')) + return (v:shell_error ? '' : gitinfo) + endif +endfunction +" }}} + +function! LightLineO() + let l:circ_empty="\u25CB" + let l:circ_quart="\u25D4" + let l:circ_half="\u25D1" + let l:circ_threequart="\u25D5" + let l:circ_full="\u25CF" + return ('' != LightLineModified() ? l:circ_full : l:circ_empty) +endfunction |