Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " Statusline
- function NormalHighlight()
- hi StatusMode ctermbg=148 ctermfg=22 term=bold cterm=bold
- hi StatusLeft ctermbg=240 ctermfg=231 term=none cterm=none
- hi StatusMiddle ctermbg=236 ctermfg=247 term=none cterm=none
- hi StatusRight1 ctermbg=252 ctermfg=241 term=none cterm=none
- hi StatusRight2 ctermbg=240 ctermfg=250 term=none cterm=none
- endfunction
- function InsertHighlight()
- hi StatusMode ctermbg=231 ctermfg=23 term=bold cterm=bold
- hi StatusLeft ctermbg=31 ctermfg=231 term=none cterm=none
- hi StatusMiddle ctermbg=24 ctermfg=117 term=none cterm=none
- hi StatusRight1 ctermbg=117 ctermfg=23 term=none cterm=none
- hi StatusRight2 ctermbg=31 ctermfg=117 term=none cterm=none
- endfunction
- function VisualHighlight()
- hi StatusMode ctermbg=208 ctermfg=88 term=bold cterm=bold
- hi StatusLeft ctermbg=240 ctermfg=231 term=none cterm=none
- hi StatusMiddle ctermbg=236 ctermfg=247 term=none cterm=none
- hi StatusRight1 ctermbg=252 ctermfg=241 term=none cterm=none
- hi StatusRight2 ctermbg=240 ctermfg=250 term=none cterm=none
- endfunction
- function ReplaceHighlight()
- hi StatusMode ctermbg=160 ctermfg=231 term=bold cterm=bold
- hi StatusLeft ctermbg=240 ctermfg=231 term=none cterm=none
- hi StatusMiddle ctermbg=236 ctermfg=247 term=none cterm=none
- hi StatusRight1 ctermbg=252 ctermfg=241 term=none cterm=none
- hi StatusRight2 ctermbg=240 ctermfg=250 term=none cterm=none
- endfunction
- hi StatusWarning ctermbg=136 ctermfg=235 term=none cterm=none
- hi InactiveStatusLeft ctermbg=235 ctermfg=240 term=none cterm=none
- hi InactiveStatusMiddle ctermbg=233 ctermfg=240 term=none cterm=none
- hi InactiveStatusRight1 ctermbg=241 ctermfg=235 term=none cterm=none
- hi InactiveStatusRight2 ctermbg=235 ctermfg=240 term=none cterm=none
- function HighlightStatusline(mode)
- if a:mode == 'n'
- call NormalHighlight()
- elseif a:mode == 'i'
- call InsertHighlight()
- elseif a:mode == 'R'
- call ReplaceHighlight()
- elseif a:mode == 'v' || a:mode == 'V' || a:mode == ''
- call VisualHighlight()
- endif
- return ""
- endfunction
- call NormalHighlight()
- function StatusMode()
- return mode() == 'n' ? 'NORMAL' :
- \ mode() == 'i' ? 'INSERT' :
- \ mode() == 'R' ? 'REPLACE' :
- \ mode() == 'v' ? 'VISUAL' :
- \ mode() == 'V' ? 'V-LINE' :
- \ mode() == '' ? 'V-BLOCK' :
- \ mode()
- endfunction
- function StatusGit()
- let symbols = ['+', '~', '-']
- let hunks = GitGutterGetHunkSummary()
- let ret = []
- for i in [0, 1, 2]
- if hunks[i] > 0
- call add(ret, symbols[i] . hunks[i])
- endif
- endfor
- let git = join(ret, ' ') . ' ⎇ ' . fugitive#head()
- return fugitive#head() != '' && winwidth('.') > 70 ? git : ''
- endfunction
- function ActiveStatusline()
- return expand('%:t') == 'ControlP' ? '%#StatusLeft# '.g:StatusCtrlP_prev.' %#StatusMode#'.g:StatusCtrlP_item.' %#StatusLeft# '.g:StatusCtrlP_next.' %#StatusMiddle# regex: '.g:StatusCtrlP_regex :
- \ expand('%:t') == '__Gundo__' ? '%#StatusMode# Gundo %#StatusMiddle#' :
- \ expand('%:t') == '__Gundo_Preview__' ? '%#StatusMode# Preview %#StatusMiddle#' :
- \ expand('%:t') == '[calendar]' ? '%#StatusMode# Calendar %#StatusMiddle#' :
- \ '%#StatusMode# %{StatusMode()} '
- \ .'%#StatusLeft# %w%q%h%r%<%{substitute(fnamemodify(expand(''%''), '':~:.''), ''/'', '' / '', ''g'')}%m '
- \ .'%#StatusMiddle# %{StatusGit()}'
- \ .'%='
- \ .'%{&filetype} | %{&fileencoding} | %{&fileformat} '
- \ .'%#StatusRight2# %p%% '
- \ .'%#StatusRight1# %l:%c '
- \ .'%{HighlightStatusline(mode())}'
- \ .'%#StatusWarning#%{substitute(SyntasticStatuslineFlag(), ''[\[\]]'', '' '', ''g'')}'
- endfunction
- function InactiveStatusline(name)
- let tail=fnamemodify(a:name, ':t')
- return tail == '__Gundo__' ? '%#InactiveStatusLeft# Gundo ' :
- \ tail == '__Gundo_Preview__' ? '%#InactiveStatusLeft# Preview ' :
- \ tail == '[calendar]' ? '%#InactiveStatusLeft# Calendar ' :
- \ '%#StatusLeft# %w%q%h%r%<%{substitute(fnamemodify(expand(''%''), '':~:.''), ''/'', '' / '', ''g'')}%m '
- \ .'%#InactiveStatusMiddle#'
- \ .'%='
- \ .'%#InactiveStatusRight2# %p%% '
- \ .'%#InactiveStatusRight1# %l:%c '
- endfunction
- let g:ctrlp_status_func = {
- \ 'main': 'CtrlPStatusFunc_1',
- \ 'prog': 'CtrlPStatusFunc_2',
- \ }
- function! CtrlPStatusFunc_1(focus, byfname, regex, prev, item, next, marked)
- let g:StatusCtrlP_regex = a:regex
- let g:StatusCtrlP_prev = a:prev
- let g:StatusCtrlP_item = a:item
- let g:StatusCtrlP_next = a:next
- return ActiveStatusline()
- endfunction
- function! CtrlPStatusFunc_2(str)
- return InactiveStatusline()
- endfunction
- function UpdateStatusline()
- let w = winnr()
- for n in range(1, winnr('$'))
- let f = getwinvar(n, 'netrw_prvfile')
- let s = winnr('$') == 1 ? [ActiveStatusline()] : [ActiveStatusline(), InactiveStatusline(f)]
- call setwinvar(n, '&statusline', s[n!=w])
- call setwinvar(n, 'lightline', n!=w)
- endfor
- endfunction
- autocmd WinEnter,BufWinEnter * call UpdateStatusline()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement