active/inactive statusline format

This commit is contained in:
ManjaroOne666 2018-03-05 21:27:09 +00:00
parent 0b818319fe
commit d4bc6393d3
1 changed files with 74 additions and 45 deletions

119
vimrc
View File

@ -255,57 +255,86 @@ iabbrev tehn then
" #statusline format
set statusline=%#LineNr#
set statusline+=\ \ \
set statusline+=%#StatusLineFile#
set statusline+=\
set statusline+=%#StatusLineMod#
set statusline+=%M " modified flag
set statusline+=%*
set statusline+=%#StatusLineDir#
set statusline+=\ %{expand('%:p:h:t')}/ " directory tail
set statusline+=%#StatusLineFile#
set statusline+=%{expand('%:t:r')}
set statusline+=%#StatusLineDot#
set statusline+=.
set statusline+=%#StatusLineExt#
set statusline+=%{expand('%:e')}\
function! ActiveStatus()
let l:statusline='%#StatusLineFile# '
let l:statusline.='%#StatusLineMod#'
let l:statusline.='%M'
let l:statusline.='%*'
let l:statusline.='%#StatusLineDir# '
let l:statusline.=expand('%:p:h:t') . '/'
let l:statusline.='%#StatusLineFile#'
let l:statusline.="%{expand('%:t:r')}"
let l:statusline.='%#StatusLineDot#'
let l:statusline.='%#StatusLineExt#'
let l:extension=expand('%:e')
if strlen(l:extension) > 0
let l:statusline.='.' . l:extension
endif
set statusline+=%*
set statusline+=%q " quickfix/location list flag
set statusline+=%h " help file flag
set statusline+=%w " preview window flag
set statusline+=%r " read only flag
set statusline+=%#StatusLineNC#
set statusline+=\
set statusline+=%*
set statusline+=\ %{strlen(&ft)?&ft:'none'}, " filetype
set statusline+=%{strlen(&fenc)?&fenc:&enc}, " encoding
set statusline+=%{&fileformat}\
set statusline+=%#StatusLineNC#
set statusline+=\
set statusline+=%*
set statusline+=\ %{&spelllang}\
set statusline+=%#StatusLineNC#
let l:statusline.=' %*'
let l:statusline.='%q%h%w%r'
let l:statusline.='%#StatusLineNC# '
let l:statusline.='%*'
let l:statusline.=" %{strlen(&ft)?&ft:'none'},"
let l:statusline.='%{strlen(&fenc)?&fenc:&enc},'
let l:statusline.='%{&fileformat} '
let l:statusline.='%#StatusLineNC# '
let l:statusline.='%*'
let l:statusline.=' %{&spelllang} '
let l:statusline.='%#StatusLineNC#'
set statusline+=%= " left/right separator
let l:statusline.='%='
set statusline+=%#StatusLineNC#
set statusline+=\
set statusline+=%*
set statusline+=\ \"%{v:register}\"\
set statusline+=%#StatusLineNC#
set statusline+=\
set statusline+=%*
set statusline+=\ %{ObsessionStatus(fnamemodify(v:this_session,':t'),'---')}\ " session status
let l:statusline.='%#StatusLineNC#'
let l:statusline.=' '
let l:statusline.='%*'
let l:statusline.=' "%{v:register}" '
let l:statusline.='%#StatusLineNC#'
let l:statusline.=' '
let l:statusline.='%*'
let l:statusline.=" %{ObsessionStatus(fnamemodify(v:this_session,':t'),'---')} "
set statusline+=%#InterfaceH2#
set statusline+=\ %{LinterStatus()}
let l:statusline.='%#InterfaceH2#'
let l:statusline.=' %{LinterStatus()}'
set statusline+=%#InterfaceNormalDark#
set statusline+=\ %P\ " percentage through file
set statusline+=%*
let l:statusline.='%#InterfaceNormalDark#'
let l:statusline.=' %P '
let l:statusline.='%*'
return l:statusline
endfunction
function! InactiveStatus()
let l:statusline='%#StatusLineFile# '
let l:statusline.='%#StatusLineMod#'
let l:statusline.='%M'
let l:statusline.='%*'
let l:statusline.='%#StatusLineDir# '
let l:statusline.=expand('%:p') . '/'
let l:statusline.='%#StatusLineFile#'
let l:statusline.="%{expand('%:t:r')}"
let l:statusline.='%#StatusLineDot#'
let l:statusline.='%#StatusLineExt#'
let l:extension=expand('%:e')
if strlen(l:extension) > 0
let l:statusline.='.' . l:extension
endif
let l:statusline.=' %*'
let l:statusline.='%=%#InterfaceH2#'
let l:statusline.='%{LinterStatus()}'
let l:statusline.='%#InterfaceNormalDark#'
let l:statusline.=' %P '
let l:statusline.='%*'
return l:statusline
endfunction
augroup status
autocmd!
autocmd WinEnter * setlocal statusline=%!ActiveStatus()
autocmd WinLeave * setlocal statusline=%!InactiveStatus()
augroup END
" #autocommands