diff --git a/vim/colors/customred256.vim b/vim/colors/customred256.vim index 00c76ce..b98d106 100644 --- a/vim/colors/customred256.vim +++ b/vim/colors/customred256.vim @@ -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 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 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 StatusLineDir ctermfg=241 guifg=#666666 ctermbg=234 guibg=#1c1c1c hi StatusLineDirActive ctermfg=243 guifg=#777777 ctermbg=237 guibg=#3a3a3a @@ -213,8 +212,17 @@ hi StatusLineDot ctermfg=241 guifg=#606060 ctermbg=234 guibg=#1c1 hi StatusLineDotActive ctermfg=244 guifg=#808080 ctermbg=237 guibg=#3a3a3a hi StatusLineExt ctermfg=243 guifg=#777777 ctermbg=234 guibg=#1c1c1c 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() set cursorline hi LineNr ctermfg=235 guifg=#262626 @@ -263,11 +271,17 @@ hi! def link VimGroupName CRIdentifier hi! def link VimGroupList CRNormalDark hi! def link VimHiGroup TypeBright hi! def link VimContinue CRNoise +hi! def link VimCommand CRNoiseBright 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 vimMapModKey CRSpecial hi! def link vimHiKeyList CRNoise hi! def link vimHiBang CRNoise +hi! def link vimLet CRNoise hi! def link vimSynRegOpt CRStatementDark hi! def link vimSynMtchOpt vimSynRegOpt hi! def link vimSynKeyOpt vimSynRegOpt diff --git a/vimrc b/vimrc index 1d319aa..1ec79d5 100644 --- a/vimrc +++ b/vimrc @@ -249,19 +249,23 @@ iabbrev waht what iabbrev tehn then "}}} -" #statusline format{{{ + +" #statusline format " isactive = 0 when inactive, 1 otherwise " get status line{{{ function! GetStatus(isactive) + let l:divider='- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >' let l:separator='%#StatusLineSeparator# ' let l:normal='%#StatusLineNormal#' let l:active='%#StatusLineActive#' let l:statusline='' -"}}} + + " linter status{{{ let l:statusline.='%#InterfaceH2# %{LinterStatus()} %*' "}}} + " file info{{{ if a:isactive == 1 let l:statusline.=l:active @@ -275,12 +279,14 @@ function! GetStatus(isactive) let l:statusline.=l:separator endif "}}} + " current register{{{ if a:isactive let l:statusline.=l:separator . l:active let l:statusline.=' %#StatusLineActiveQuotes#"' . l:active . '%{v:register}%#StatusLineActiveQuotes#" ' endif "}}} + " session status{{{ if a:isactive let l:statusline.=l:separator . l:active @@ -288,51 +294,66 @@ function! GetStatus(isactive) let l:statusline.=l:separator . l:active endif "}}} - " right/left separator{{{ + + " 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 - let l:statusline.='%#StatusLineDividerActive# %< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >' . l:separator . '%*' - else - let l:statusline.='%#StatusLineDivider# %< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >' . l:separator . '%*' + let l:statusline.=GetStatusFrag("mode() == 'i'", 'StatusLineDivInput', '%<', l:divider) endif - let l:statusline.='%=' + + let l:statusline.=l:separator . '%*%=' + "}}} - " path/filename.extension{{{ - if a:isactive - let l:statusline.='%#StatusLineDirActive# ' - let l:statusline.="%{expand('%:p:h:t')}/" - let l:statusline.='%#StatusLineFileActive#' +" modified flag {{{ +" let l:statusline.='%#StatusLineMod#%M' . l:separator . '%*' +"}}} - let l:statusline.="%{expand('%:t:r')}" +" path/filename.extension{{{ + +if a:isactive + let l:statusline.='%#StatusLineDirActive# ' + let l:statusline.="%{expand('%:p:h:t')}/" + let l:statusline.='%#StatusLineFileActive#' - let l:statusline.='%#StatusLineDotActive#' - let l:statusline.="%{strlen(expand('%:e'))?'.':''}" - let l:statusline.='%#StatusLineExtActive#' - let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')}" - let l:statusline.=' %*' - else - let l:statusline.='%#StatusLineDir# ' - let l:statusline.="%{expand('%:p:h')}/" - let l:statusline.='%#StatusLineFile#' + let l:statusline.="%{expand('%:t:r')}" - let l:statusline.="%{expand('%:t:r')}" + let l:statusline.='%#StatusLineDotActive#' + let l:statusline.="%{strlen(expand('%:e'))?'.':''}" + let l:statusline.='%#StatusLineExtActive#' + let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')}" + let l:statusline.=' %*' +else + let l:statusline.='%#StatusLineDir# ' + let l:statusline.="%{expand('%:p:h')}/" + let l:statusline.='%#StatusLineFile#' - let l:statusline.='%#StatusLineDot#' - let l:statusline.="%{strlen(expand('%:e'))?'.':''}" - let l:statusline.='%#StatusLineExt#' - let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')}" - let l:statusline.=' %*' - endif + let l:statusline.="%{expand('%:t:r')}" + + let l:statusline.='%#StatusLineDot#' + let l:statusline.="%{strlen(expand('%:e'))?'.':''}" + let l:statusline.='%#StatusLineExt#' + let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')}" + let l:statusline.=' %*' +endif "}}} - " modified flag {{{ - let l:statusline.=l:separator . '%#StatusLineMod#%M' . l:separator . '%*' -"}}} + " file percentage{{{ - let l:statusline.='%#InterfaceNormalDark#%P%*' + let l:statusline.=l:separator . '%#InterfaceNormalDark#%P%*' return l:statusline endfunction "}}} + " status line autocommands{{{ augroup status autocmd! @@ -342,6 +363,7 @@ augroup status augroup END "}}}}}} + " #autocommands{{{ " persistent folds @@ -389,24 +411,32 @@ augroup END " #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 $ if getline('.')[col('.')-1] == ';' || getline('.')[col('.')-1] == ',' :startinsert else :startinsert! endif -endfunction +endfunction"}}} " get name of syntax item -function! SyntaxItem() +function! SyntaxItem() "{{{ return synIDattr(synID(line('.'),col('.'),1),'name') . ' -> ' . synIDattr(synIDtrans(synID(line('.'),col('.'),1)), 'name' ) endfunction -nnoremap p :echom SyntaxItem() +nnoremap p :echom SyntaxItem()"}}} " devdocs DD " 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') return 'WINDOWS' else @@ -422,10 +452,10 @@ let s:stub = s:cmds[Get_env()] . " 'http://devdocs.io/?q=" command! -nargs=* DD silent! call system(len(split(, ' ')) == 0 ? \ s:stub . &ft . ' ' . expand('') . "'" : len(split(, ' ')) == 1 ? \ s:stub . &ft . ' ' . . "'" : s:stub . . "'") - +"}}} " use ranger as file manager -if !exists('*RangerExplorer') +if !exists('*RangerExplorer')" {{{ function RangerExplorer() exec 'silent !ranger --choosefile=/tmp/vim_ranger_current_file ' . expand('%:p:h') if filereadable('/tmp/vim_ranger_current_file') @@ -435,7 +465,17 @@ if !exists('*RangerExplorer') redraw! endfun map ra :call RangerExplorer() -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']} -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 (ale_previous_wrap) -"nmap (ale_next_wrap) - " ultisnips let g:UltiSnipsSnippetsDir="~/.vim/UltiSnips" " Trigger configuration. Do not use if you use https://github.com/Valloric/YouCompleteMe.