statusline mode/modified indicator
This commit is contained in:
parent
b6f44e7f4d
commit
fd0056c650
|
@ -202,8 +202,7 @@ hi StatusLineNC ctermfg=238 guifg=#444444 ctermbg=232 guibg=NONE term=none c
|
||||||
hi StatusLineNormal ctermfg=243 guifg=#777777 ctermbg=234 guibg=#1c1c1c term=none cterm=none
|
hi StatusLineNormal ctermfg=243 guifg=#777777 ctermbg=234 guibg=#1c1c1c term=none cterm=none
|
||||||
hi StatusLineActive ctermfg=255 guifg=#ffffff ctermbg=239 guibg=#4e4e4e term=none cterm=none
|
hi StatusLineActive ctermfg=255 guifg=#ffffff ctermbg=239 guibg=#4e4e4e term=none cterm=none
|
||||||
hi StatusLineActiveQuotes ctermfg=244 guifg=#888888 ctermbg=239 guibg=#4e4e4e term=none cterm=none
|
hi StatusLineActiveQuotes ctermfg=244 guifg=#888888 ctermbg=239 guibg=#4e4e4e term=none cterm=none
|
||||||
hi StatusLineDividerActive ctermfg=233 guifg=#111111 ctermbg=233 guibg=#111111 term=none cterm=none
|
|
||||||
hi StatusLineDivider ctermfg=234 guifg=#1c1c1c ctermbg=234 guibg=#1c1c1c term=none cterm=none
|
|
||||||
hi StatusLineSeparator ctermfg=255 guifg=#ffffff ctermbg=232 guibg=NONE
|
hi StatusLineSeparator ctermfg=255 guifg=#ffffff ctermbg=232 guibg=NONE
|
||||||
hi StatusLineDir ctermfg=241 guifg=#666666 ctermbg=234 guibg=#1c1c1c
|
hi StatusLineDir ctermfg=241 guifg=#666666 ctermbg=234 guibg=#1c1c1c
|
||||||
hi StatusLineDirActive ctermfg=243 guifg=#777777 ctermbg=237 guibg=#3a3a3a
|
hi StatusLineDirActive ctermfg=243 guifg=#777777 ctermbg=237 guibg=#3a3a3a
|
||||||
|
@ -213,7 +212,16 @@ hi StatusLineDot ctermfg=241 guifg=#606060 ctermbg=234 guibg=#1c1
|
||||||
hi StatusLineDotActive ctermfg=244 guifg=#808080 ctermbg=237 guibg=#3a3a3a
|
hi StatusLineDotActive ctermfg=244 guifg=#808080 ctermbg=237 guibg=#3a3a3a
|
||||||
hi StatusLineExt ctermfg=243 guifg=#777777 ctermbg=234 guibg=#1c1c1c
|
hi StatusLineExt ctermfg=243 guifg=#777777 ctermbg=234 guibg=#1c1c1c
|
||||||
hi StatusLineExtActive ctermfg=249 guifg=#bbbbbb ctermbg=239 guibg=#3a3a3a
|
hi StatusLineExtActive ctermfg=249 guifg=#bbbbbb ctermbg=239 guibg=#3a3a3a
|
||||||
hi StatusLineMod ctermfg=255 guifg=#ffffff ctermbg=88 guibg=#490000
|
" hi StatusLineMod ctermfg=255 guifg=#ffffff ctermbg=88 guibg=#490000
|
||||||
|
|
||||||
|
" TODO get cterm colors same as gui ones for following
|
||||||
|
hi StatusLineDiv ctermfg=233 guifg=#111111 ctermbg=233 guibg=#111111 term=none cterm=none
|
||||||
|
hi StatusLineDivActive ctermfg=234 guifg=#1c1c1c ctermbg=234 guibg=#1c1c1c term=none cterm=none
|
||||||
|
|
||||||
|
hi StatusLineDivMod ctermfg=234 guifg=#290000 ctermbg=234 guibg=#290000 term=none cterm=none
|
||||||
|
hi StatusLineDivModActive ctermfg=233 guifg=#450000 ctermbg=233 guibg=#450000 term=none cterm=none
|
||||||
|
|
||||||
|
hi StatusLineDivInput ctermfg=234 guifg=#1c1c1c ctermbg=234 guibg=#cccccc term=none cterm=none
|
||||||
|
|
||||||
function! DoInsertEnter()
|
function! DoInsertEnter()
|
||||||
set cursorline
|
set cursorline
|
||||||
|
@ -263,11 +271,17 @@ hi! def link VimGroupName CRIdentifier
|
||||||
hi! def link VimGroupList CRNormalDark
|
hi! def link VimGroupList CRNormalDark
|
||||||
hi! def link VimHiGroup TypeBright
|
hi! def link VimHiGroup TypeBright
|
||||||
hi! def link VimContinue CRNoise
|
hi! def link VimContinue CRNoise
|
||||||
|
hi! def link VimCommand CRNoiseBright
|
||||||
hi! def link vimFunction CRIdentifier
|
hi! def link vimFunction CRIdentifier
|
||||||
|
hi! def link vimUserFunc CRIdentifierBright
|
||||||
|
hi! def link vimNotFunc CRNoiseBright
|
||||||
|
hi! def link vimVar CRIdentifierDark
|
||||||
|
hi! def link vimOption CRIdentifierDark
|
||||||
hi! def link vimFuncSID CRIdentifierBright
|
hi! def link vimFuncSID CRIdentifierBright
|
||||||
hi! def link vimMapModKey CRSpecial
|
hi! def link vimMapModKey CRSpecial
|
||||||
hi! def link vimHiKeyList CRNoise
|
hi! def link vimHiKeyList CRNoise
|
||||||
hi! def link vimHiBang CRNoise
|
hi! def link vimHiBang CRNoise
|
||||||
|
hi! def link vimLet CRNoise
|
||||||
hi! def link vimSynRegOpt CRStatementDark
|
hi! def link vimSynRegOpt CRStatementDark
|
||||||
hi! def link vimSynMtchOpt vimSynRegOpt
|
hi! def link vimSynMtchOpt vimSynRegOpt
|
||||||
hi! def link vimSynKeyOpt vimSynRegOpt
|
hi! def link vimSynKeyOpt vimSynRegOpt
|
||||||
|
|
101
vimrc
101
vimrc
|
@ -249,19 +249,23 @@ iabbrev waht what
|
||||||
iabbrev tehn then
|
iabbrev tehn then
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" #statusline format{{{
|
|
||||||
|
" #statusline format
|
||||||
" isactive = 0 when inactive, 1 otherwise
|
" isactive = 0 when inactive, 1 otherwise
|
||||||
|
|
||||||
" get status line{{{
|
" get status line{{{
|
||||||
function! GetStatus(isactive)
|
function! GetStatus(isactive)
|
||||||
|
let l:divider='- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >'
|
||||||
let l:separator='%#StatusLineSeparator# '
|
let l:separator='%#StatusLineSeparator# '
|
||||||
let l:normal='%#StatusLineNormal#'
|
let l:normal='%#StatusLineNormal#'
|
||||||
let l:active='%#StatusLineActive#'
|
let l:active='%#StatusLineActive#'
|
||||||
let l:statusline=''
|
let l:statusline=''
|
||||||
"}}}
|
|
||||||
|
|
||||||
" linter status{{{
|
" linter status{{{
|
||||||
let l:statusline.='%#InterfaceH2# %{LinterStatus()} %*'
|
let l:statusline.='%#InterfaceH2# %{LinterStatus()} %*'
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" file info{{{
|
" file info{{{
|
||||||
if a:isactive == 1
|
if a:isactive == 1
|
||||||
let l:statusline.=l:active
|
let l:statusline.=l:active
|
||||||
|
@ -275,12 +279,14 @@ function! GetStatus(isactive)
|
||||||
let l:statusline.=l:separator
|
let l:statusline.=l:separator
|
||||||
endif
|
endif
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" current register{{{
|
" current register{{{
|
||||||
if a:isactive
|
if a:isactive
|
||||||
let l:statusline.=l:separator . l:active
|
let l:statusline.=l:separator . l:active
|
||||||
let l:statusline.=' %#StatusLineActiveQuotes#"' . l:active . '%{v:register}%#StatusLineActiveQuotes#" '
|
let l:statusline.=' %#StatusLineActiveQuotes#"' . l:active . '%{v:register}%#StatusLineActiveQuotes#" '
|
||||||
endif
|
endif
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" session status{{{
|
" session status{{{
|
||||||
if a:isactive
|
if a:isactive
|
||||||
let l:statusline.=l:separator . l:active
|
let l:statusline.=l:separator . l:active
|
||||||
|
@ -288,17 +294,33 @@ function! GetStatus(isactive)
|
||||||
let l:statusline.=l:separator . l:active
|
let l:statusline.=l:separator . l:active
|
||||||
endif
|
endif
|
||||||
"}}}
|
"}}}
|
||||||
" right/left separator{{{
|
|
||||||
if a:isactive
|
|
||||||
let l:statusline.='%#StatusLineDividerActive# %< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >' . l:separator . '%*'
|
|
||||||
else
|
|
||||||
let l:statusline.='%#StatusLineDivider# %< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >' . l:separator . '%*'
|
|
||||||
endif
|
|
||||||
let l:statusline.='%='
|
|
||||||
"}}}
|
|
||||||
" path/filename.extension{{{
|
|
||||||
|
|
||||||
|
" right/left divider{{{
|
||||||
|
|
||||||
|
" modified version
|
||||||
|
let l:color='StatusLineDivMod' . (a:isactive?'Active':'')
|
||||||
|
let l:statusline.=GetStatusFrag("&modified && mode() != 'i'", l:color, '%<', l:divider)
|
||||||
|
|
||||||
|
" unmodified version
|
||||||
|
let l:color='StatusLineDiv' . (a:isactive?'Active':'')
|
||||||
|
let l:statusline.=GetStatusFrag("!&modified && mode() != 'i'", l:color, '%<', l:divider)
|
||||||
|
|
||||||
|
" input mode version
|
||||||
if a:isactive
|
if a:isactive
|
||||||
|
let l:statusline.=GetStatusFrag("mode() == 'i'", 'StatusLineDivInput', '%<', l:divider)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:statusline.=l:separator . '%*%='
|
||||||
|
|
||||||
|
"}}}
|
||||||
|
|
||||||
|
" modified flag {{{
|
||||||
|
" let l:statusline.='%#StatusLineMod#%M' . l:separator . '%*'
|
||||||
|
"}}}
|
||||||
|
|
||||||
|
" path/filename.extension{{{
|
||||||
|
|
||||||
|
if a:isactive
|
||||||
let l:statusline.='%#StatusLineDirActive# '
|
let l:statusline.='%#StatusLineDirActive# '
|
||||||
let l:statusline.="%{expand('%:p:h:t')}/"
|
let l:statusline.="%{expand('%:p:h:t')}/"
|
||||||
let l:statusline.='%#StatusLineFileActive#'
|
let l:statusline.='%#StatusLineFileActive#'
|
||||||
|
@ -310,7 +332,7 @@ function! GetStatus(isactive)
|
||||||
let l:statusline.='%#StatusLineExtActive#'
|
let l:statusline.='%#StatusLineExtActive#'
|
||||||
let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')}"
|
let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')}"
|
||||||
let l:statusline.=' %*'
|
let l:statusline.=' %*'
|
||||||
else
|
else
|
||||||
let l:statusline.='%#StatusLineDir# '
|
let l:statusline.='%#StatusLineDir# '
|
||||||
let l:statusline.="%{expand('%:p:h')}/"
|
let l:statusline.="%{expand('%:p:h')}/"
|
||||||
let l:statusline.='%#StatusLineFile#'
|
let l:statusline.='%#StatusLineFile#'
|
||||||
|
@ -322,17 +344,16 @@ function! GetStatus(isactive)
|
||||||
let l:statusline.='%#StatusLineExt#'
|
let l:statusline.='%#StatusLineExt#'
|
||||||
let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')}"
|
let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')}"
|
||||||
let l:statusline.=' %*'
|
let l:statusline.=' %*'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"}}}
|
"}}}
|
||||||
" modified flag {{{
|
|
||||||
let l:statusline.=l:separator . '%#StatusLineMod#%M' . l:separator . '%*'
|
|
||||||
"}}}
|
|
||||||
" file percentage{{{
|
" file percentage{{{
|
||||||
let l:statusline.='%#InterfaceNormalDark#%P%*'
|
let l:statusline.=l:separator . '%#InterfaceNormalDark#%P%*'
|
||||||
return l:statusline
|
return l:statusline
|
||||||
endfunction
|
endfunction
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" status line autocommands{{{
|
" status line autocommands{{{
|
||||||
augroup status
|
augroup status
|
||||||
autocmd!
|
autocmd!
|
||||||
|
@ -342,6 +363,7 @@ augroup status
|
||||||
augroup END
|
augroup END
|
||||||
"}}}}}}
|
"}}}}}}
|
||||||
|
|
||||||
|
|
||||||
" #autocommands{{{
|
" #autocommands{{{
|
||||||
|
|
||||||
" persistent folds
|
" persistent folds
|
||||||
|
@ -389,24 +411,32 @@ augroup END
|
||||||
|
|
||||||
" #functions{{{
|
" #functions{{{
|
||||||
|
|
||||||
function! CheckLineEnding()
|
" TODO better name
|
||||||
|
function! GetStatusFrag(condition, colorname, conditionprefix, text) "{{{
|
||||||
|
let l:frag='%#' . a:colorname . '#'
|
||||||
|
let l:frag.=a:conditionprefix
|
||||||
|
let l:frag.='%{(' . a:condition . ")?'" . a:text . "':''}"
|
||||||
|
return l:frag
|
||||||
|
endfunction"}}}
|
||||||
|
|
||||||
|
function! CheckLineEnding() "{{{
|
||||||
:normal $
|
:normal $
|
||||||
if getline('.')[col('.')-1] == ';' || getline('.')[col('.')-1] == ','
|
if getline('.')[col('.')-1] == ';' || getline('.')[col('.')-1] == ','
|
||||||
:startinsert
|
:startinsert
|
||||||
else
|
else
|
||||||
:startinsert!
|
:startinsert!
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction"}}}
|
||||||
|
|
||||||
" get name of syntax item
|
" get name of syntax item
|
||||||
function! SyntaxItem()
|
function! SyntaxItem() "{{{
|
||||||
return synIDattr(synID(line('.'),col('.'),1),'name') . ' -> ' . synIDattr(synIDtrans(synID(line('.'),col('.'),1)), 'name' )
|
return synIDattr(synID(line('.'),col('.'),1),'name') . ' -> ' . synIDattr(synIDtrans(synID(line('.'),col('.'),1)), 'name' )
|
||||||
endfunction
|
endfunction
|
||||||
nnoremap <leader>p :echom SyntaxItem()<CR>
|
nnoremap <leader>p :echom SyntaxItem()<CR>"}}}
|
||||||
|
|
||||||
" devdocs DD
|
" devdocs DD
|
||||||
" https://gist.github.com/romainl/8d3b73428b4366f75a19be2dad2f0987#file-devdocs-vim
|
" https://gist.github.com/romainl/8d3b73428b4366f75a19be2dad2f0987#file-devdocs-vim
|
||||||
function! s:Get_env() abort
|
function! s:Get_env() abort "{{{
|
||||||
if has('win64') || has('win32') || has('win16')
|
if has('win64') || has('win32') || has('win16')
|
||||||
return 'WINDOWS'
|
return 'WINDOWS'
|
||||||
else
|
else
|
||||||
|
@ -422,10 +452,10 @@ let s:stub = s:cmds[<SID>Get_env()] . " 'http://devdocs.io/?q="
|
||||||
command! -nargs=* DD silent! call system(len(split(<q-args>, ' ')) == 0 ?
|
command! -nargs=* DD silent! call system(len(split(<q-args>, ' ')) == 0 ?
|
||||||
\ s:stub . &ft . ' ' . expand('<cword>') . "'" : len(split(<q-args>, ' ')) == 1 ?
|
\ s:stub . &ft . ' ' . expand('<cword>') . "'" : len(split(<q-args>, ' ')) == 1 ?
|
||||||
\ s:stub . &ft . ' ' . <q-args> . "'" : s:stub . <q-args> . "'")
|
\ s:stub . &ft . ' ' . <q-args> . "'" : s:stub . <q-args> . "'")
|
||||||
|
"}}}
|
||||||
|
|
||||||
" use ranger as file manager
|
" use ranger as file manager
|
||||||
if !exists('*RangerExplorer')
|
if !exists('*RangerExplorer')" {{{
|
||||||
function RangerExplorer()
|
function RangerExplorer()
|
||||||
exec 'silent !ranger --choosefile=/tmp/vim_ranger_current_file ' . expand('%:p:h')
|
exec 'silent !ranger --choosefile=/tmp/vim_ranger_current_file ' . expand('%:p:h')
|
||||||
if filereadable('/tmp/vim_ranger_current_file')
|
if filereadable('/tmp/vim_ranger_current_file')
|
||||||
|
@ -435,7 +465,17 @@ if !exists('*RangerExplorer')
|
||||||
redraw!
|
redraw!
|
||||||
endfun
|
endfun
|
||||||
map <Leader>ra :call RangerExplorer()<CR>
|
map <Leader>ra :call RangerExplorer()<CR>
|
||||||
endif
|
endif"}}}
|
||||||
|
|
||||||
|
function! LinterStatus() abort "{{{
|
||||||
|
let l:counts = ale#statusline#Count(bufnr(''))
|
||||||
|
|
||||||
|
let l:all_errors = l:counts.error + l:counts.style_error
|
||||||
|
let l:all_non_errors = l:counts.total - l:all_errors
|
||||||
|
|
||||||
|
return l:counts.total == 0 ? 'OK' : printf('%dW %dE', l:all_non_errors, l:all_errors)
|
||||||
|
endfunction
|
||||||
|
"}}}
|
||||||
|
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
|
@ -501,17 +541,6 @@ let g:ale_html_htmlhint_options = '-c ~/.htmlhintrc --format=unix'
|
||||||
let g:ale_fixers = {'javascript': ['eslint']}
|
let g:ale_fixers = {'javascript': ['eslint']}
|
||||||
|
|
||||||
|
|
||||||
function! LinterStatus() abort
|
|
||||||
let l:counts = ale#statusline#Count(bufnr(''))
|
|
||||||
|
|
||||||
let l:all_errors = l:counts.error + l:counts.style_error
|
|
||||||
let l:all_non_errors = l:counts.total - l:all_errors
|
|
||||||
|
|
||||||
return l:counts.total == 0 ? 'OK' : printf('%dW %dE', l:all_non_errors, l:all_errors)
|
|
||||||
endfunction
|
|
||||||
"nmap <silent> <C-k> <Plug>(ale_previous_wrap)
|
|
||||||
"nmap <silent> <C-j> <Plug>(ale_next_wrap)
|
|
||||||
|
|
||||||
" ultisnips
|
" ultisnips
|
||||||
let g:UltiSnipsSnippetsDir="~/.vim/UltiSnips"
|
let g:UltiSnipsSnippetsDir="~/.vim/UltiSnips"
|
||||||
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
|
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
|
||||||
|
|
Loading…
Reference in New Issue