active/inactive statusline format
This commit is contained in:
parent
0b818319fe
commit
d4bc6393d3
119
vimrc
119
vimrc
|
@ -255,57 +255,86 @@ iabbrev tehn then
|
||||||
|
|
||||||
|
|
||||||
" #statusline format
|
" #statusline format
|
||||||
set statusline=%#LineNr#
|
function! ActiveStatus()
|
||||||
set statusline+=\ \ \
|
let l:statusline='%#StatusLineFile# '
|
||||||
set statusline+=%#StatusLineFile#
|
let l:statusline.='%#StatusLineMod#'
|
||||||
set statusline+=\
|
let l:statusline.='%M'
|
||||||
set statusline+=%#StatusLineMod#
|
let l:statusline.='%*'
|
||||||
set statusline+=%M " modified flag
|
let l:statusline.='%#StatusLineDir# '
|
||||||
set statusline+=%*
|
let l:statusline.=expand('%:p:h:t') . '/'
|
||||||
set statusline+=%#StatusLineDir#
|
let l:statusline.='%#StatusLineFile#'
|
||||||
set statusline+=\ %{expand('%:p:h:t')}/ " directory tail
|
let l:statusline.="%{expand('%:t:r')}"
|
||||||
set statusline+=%#StatusLineFile#
|
let l:statusline.='%#StatusLineDot#'
|
||||||
set statusline+=%{expand('%:t:r')}
|
let l:statusline.='%#StatusLineExt#'
|
||||||
set statusline+=%#StatusLineDot#
|
let l:extension=expand('%:e')
|
||||||
set statusline+=.
|
if strlen(l:extension) > 0
|
||||||
set statusline+=%#StatusLineExt#
|
let l:statusline.='.' . l:extension
|
||||||
set statusline+=%{expand('%:e')}\
|
endif
|
||||||
|
|
||||||
set statusline+=%*
|
let l:statusline.=' %*'
|
||||||
set statusline+=%q " quickfix/location list flag
|
let l:statusline.='%q%h%w%r'
|
||||||
set statusline+=%h " help file flag
|
let l:statusline.='%#StatusLineNC# '
|
||||||
set statusline+=%w " preview window flag
|
let l:statusline.='%*'
|
||||||
set statusline+=%r " read only flag
|
let l:statusline.=" %{strlen(&ft)?&ft:'none'},"
|
||||||
set statusline+=%#StatusLineNC#
|
let l:statusline.='%{strlen(&fenc)?&fenc:&enc},'
|
||||||
set statusline+=\
|
let l:statusline.='%{&fileformat} '
|
||||||
set statusline+=%*
|
let l:statusline.='%#StatusLineNC# '
|
||||||
set statusline+=\ %{strlen(&ft)?&ft:'none'}, " filetype
|
let l:statusline.='%*'
|
||||||
set statusline+=%{strlen(&fenc)?&fenc:&enc}, " encoding
|
let l:statusline.=' %{&spelllang} '
|
||||||
set statusline+=%{&fileformat}\
|
let l:statusline.='%#StatusLineNC#'
|
||||||
set statusline+=%#StatusLineNC#
|
|
||||||
set statusline+=\
|
|
||||||
set statusline+=%*
|
|
||||||
set statusline+=\ %{&spelllang}\
|
|
||||||
set statusline+=%#StatusLineNC#
|
|
||||||
|
|
||||||
set statusline+=%= " left/right separator
|
let l:statusline.='%='
|
||||||
|
|
||||||
set statusline+=%#StatusLineNC#
|
let l:statusline.='%#StatusLineNC#'
|
||||||
set statusline+=\
|
let l:statusline.=' '
|
||||||
set statusline+=%*
|
let l:statusline.='%*'
|
||||||
set statusline+=\ \"%{v:register}\"\
|
let l:statusline.=' "%{v:register}" '
|
||||||
set statusline+=%#StatusLineNC#
|
let l:statusline.='%#StatusLineNC#'
|
||||||
set statusline+=\
|
let l:statusline.=' '
|
||||||
set statusline+=%*
|
let l:statusline.='%*'
|
||||||
set statusline+=\ %{ObsessionStatus(fnamemodify(v:this_session,':t'),'---')}\ " session status
|
let l:statusline.=" %{ObsessionStatus(fnamemodify(v:this_session,':t'),'---')} "
|
||||||
|
|
||||||
set statusline+=%#InterfaceH2#
|
let l:statusline.='%#InterfaceH2#'
|
||||||
set statusline+=\ %{LinterStatus()}
|
let l:statusline.=' %{LinterStatus()}'
|
||||||
|
|
||||||
set statusline+=%#InterfaceNormalDark#
|
let l:statusline.='%#InterfaceNormalDark#'
|
||||||
set statusline+=\ %P\ " percentage through file
|
let l:statusline.=' %P '
|
||||||
set statusline+=%*
|
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
|
" #autocommands
|
||||||
|
|
Loading…
Reference in New Issue