diff --git a/.gitignore b/.gitignore index 0b3ea3f..79de770 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ wal_example-dark.vim wal_example-light.vim vim/autoload/plug.vim .is-dev +.vimrc-config +.vimrc-overrides diff --git a/vimrc b/vimrc index 5a76078..2651d01 100644 --- a/vimrc +++ b/vimrc @@ -1,5 +1,19 @@ " ● +if filereadable(expand('.vimrc-config'))"{{{ + source .vimrc-config +endif + +let g:vimrc_load_dev_plugins = exists('g:vimrc_load_dev_plugins') + \ ? g:vimrc_load_dev_plugins : 0 +let g:vimrc_enable_statusline = exists('g:vimrc_enable_statusline') + \ ? g:vimrc_enable_statusline : 0 +let g:vimrc_enable_tabline = exists('g:vimrc_enable_tabline') + \ ? g:vimrc_enable_tabline : 0 +let g:vimrc_auto_window_settings = exists('g:vimrc_auto_window_settings') + \ ? g:vimrc_auto_window_settings : 0 +"}}} + " #plugins {{{ if empty(glob('~/.vim/autoload/plug.vim'))"{{{ silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs @@ -13,7 +27,6 @@ if !has('nvim') Plug '~/.config/vim/vim/bundle/vim-learnxiny' - " #Ctrlp {{{ Plug 'ctrlpvim/ctrlp.vim' " :h ctrlp-commands @@ -70,22 +83,6 @@ let g:mta_filetypes = { \ ['relative', 'absolute', 'fixed'] \ ] - "}}} -" #switch {{{ - "https://github.com/AndrewRadev/switch.vim - Plug 'AndrewRadev/switch.vim' - - let g:switch_mapping = '-' - let g:switch_custom_definitions = [ - \ ['0', '1'], - \ ['ease-in', 'ease-out', 'ease-in-out', 'linear'], - \ ['auto', 'none'], - \ ['left', 'right'], - \ ['top', 'bottom'], - \ ['row', 'column'], - \ ['relative', 'absolute', 'fixed'] - \ ] - "}}} " #undotree {{{ Plug 'mbbill/undotree' @@ -139,7 +136,7 @@ Plug 'studio-vx/vim-qlist' "}}} -if filereadable(expand('.is-dev')) +if g:vimrc_load_dev_plugins " #ALE {{{ " https://github.com/w0rp/ale Plug 'w0rp/ale' @@ -537,18 +534,6 @@ runtime macros/matchit.vim "----------------------------------------------------------------------------}}} " #functions {{{ -function! DoInsertEnter() "{{{ - " call SetColor('LineNr', '#262626', '', '#cccccc', '', '') - " call SetColor('CursorLineNr', '#bcbcbc', '', '#999999', '', 'bold') -endfunction - -"}}} -function! DoInsertLeave() "{{{ - " call SetColor('LineNr', '#3a3a3a', '', '#999999', '', '') - " call SetColor('CursorLineNr', '#767676', '', '#777777', '', 'bold') -endfunction - -"}}} function! SetColor(name, fg, bg, fg_l, bg_l, style) abort"{{{ if &background ==? 'dark' @@ -972,14 +957,11 @@ command! ScratchVertical vnew | setlocal buftype=nofile | setlocal bufhidden=hid "}}} " #settings {{{ scriptencoding utf-8 -set ttyfast - if &term ==? 'xterm-256color' set termguicolors endif syntax on -set background=light " set fillchars=stl:\ ,stlnc:\ ,vert:│ set fillchars=stl:\ ,stlnc:\ ,vert:┃ colorscheme monotonous-dark @@ -991,14 +973,10 @@ set updatetime=100 set timeoutlen=500 set lazyredraw -set backupdir=~/.vimtmp -set directory=~/.vimtmp - " the ;/home/ray tells vim to stop searching at /home/ray set tags+=./.tags,.tags,./tags-py,.tags-py;/home/ray/ " persisitent undo file -set undodir=/home/ray/.vim/undodir set undofile set viewoptions-=options @@ -1027,8 +1005,6 @@ set completeopt=longest,menuone set nospell set spelllang=en_gb -set dictionary+=/usr/share/dict/brit-a-z.txt,/usr/share/dict/britcaps.txt -set thesaurus+=/usr/share/dict/mthesaur.txt set diffopt+=vertical @@ -1233,332 +1209,330 @@ iabbrev ct'' content-type: ''; "----------------------------------------------------------------------------}}} " #autocommands {{{ -" persistent folds {{{ -augroup AutoSaveFolds - autocmd! - " autocmd BufWinLeave ?* mkview - autocmd BufWrite ?* mkview - " autocmd BufWinEnter ?* silent loadview - autocmd BufRead ?* silent! loadview -augroup END - -"}}} -" Show trailing whitepace and spaces before a tab: {{{ -augroup whitespaceerrors - autocmd! - autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL -augroup END - -"}}} -" automatically reload if color scheme file written {{{ -" augroup coloreload -" autocmd! -" autocmd BufWritePost customred256.vim so $MYVIMRC -" augroup end -" - -"}}} -" line numbering {{{ -augroup linenumbering - autocmd! - autocmd InsertEnter * :set norelativenumber - autocmd InsertLeave * :set number relativenumber - autocmd WinEnter * :set number relativenumber - autocmd WinLeave * set norelativenumber - autocmd CmdlineEnter * :redraw | :set norelativenumber - autocmd CmdlineLeave * :set number relativenumber - " see 'mapping nnoremap :' for setting norelative number. -augroup END - -"}}} -" WinEnter, WinLeave {{{ -augroup windowenteringleaving - autocmd! - autocmd WinEnter * call SetColorColumn() - autocmd WinEnter * set cursorline | set cursorcolumn - autocmd WinLeave * setlocal colorcolumn=0 - autocmd WinLeave * set nocursorline | set nocursorcolumn -augroup END - -"}}} -" InsertEnter, InsertLeave {{{ -augroup insertenterleave - au! - au InsertEnter * call DoInsertEnter() - au InsertLeave * call DoInsertLeave() -augroup END - -"}}} -" Automatically reload .vimrc if chanaged {{{ -augroup myvimrc - autocmd! - autocmd BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif -augroup END - -"}}} -" " Open qfix after grepping {{{ -" augroup qfixopen -" autocmd! -" autocmd QuickFixCmdPost *grep* botright cwindow -" augroup END - -"}}} -"Open quickfix window{{{ -augroup QuickFixAutoload +" persistent folds {{{ + augroup AutoSaveFolds autocmd! - autocmd QuickFixCmdPost [^l]* nested botright cwindow - autocmd QuickFixCmdPost l* nested botright lwindow -augroup END + " autocmd BufWinLeave ?* mkview + autocmd BufWrite ?* mkview + " autocmd BufWinEnter ?* silent loadview + autocmd BufRead ?* silent! loadview + augroup END -"}}} +" }}} +" Show trailing whitepace and spaces before a tab: {{{ + augroup whitespaceerrors + autocmd! + autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL + augroup END + +" }}} +" automatically reload if color scheme file written {{{ +" augroup coloreload +" autocmd! +" autocmd BufWritePost customred256.vim so $MYVIMRC +" augroup end +" + +" }}} +" line numbering {{{ + augroup linenumbering + autocmd! + autocmd InsertEnter * :set norelativenumber + autocmd InsertLeave * :set number relativenumber + autocmd WinEnter * :set number relativenumber + autocmd WinLeave * set norelativenumber + autocmd CmdlineEnter * :redraw | :set norelativenumber + autocmd CmdlineLeave * :set number relativenumber + " see 'mapping nnoremap :' for setting norelative number. + augroup END + +" }}} +" auto_window_settings {{{ +if g:vimrc_auto_window_settings + augroup auto_window_settings + autocmd! + autocmd WinEnter * call SetColorColumn() + autocmd WinEnter * set cursorline | set cursorcolumn + autocmd WinLeave * setlocal colorcolumn=0 + autocmd WinLeave * set nocursorline | set nocursorcolumn + augroup END + +endif +" }}} +" Automatically reload .vimrc if changed {{{ + augroup myvimrc + autocmd! + autocmd BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif + augroup END + +" }}} +" Open qfix after grepping {{{ +" augroup qfixopen +" autocmd! +" autocmd QuickFixCmdPost *grep* botright cwindow +" augroup END + +" }}} +" Open quickfix window{{{ + augroup QuickFixAutoload + autocmd! + autocmd QuickFixCmdPost [^l]* nested botright cwindow + autocmd QuickFixCmdPost l* nested botright lwindow + augroup END + +" }}} "----------------------------------------------------------------------------}}} " #statusline {{{ -set statusline=%!GetStatus(1) +if g:vimrc_enable_statusline + set statusline=%!GetStatus(1) -function! GetStatus(isactive) abort "{{{ - " let l:linter = ale#statusline#Count(bufnr('')) - let l:divider = '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >' - let l:separator = '%#StatusLineSeparator# ' - let l:normal = '%#StatusLineNormal#' - let l:active = '%#StatusLineActive#' - let l:linterdash = '%#LinterDash#·' - let l:linterdashactive = '%#LinterDashActive#·' - let l:statusline = l:separator - - "buffer number {{{ - if a:isactive - let l:statusline .= '%#StatusLineBufferNrActive#' - else - let l:statusline .= '%#StatusLineBufferNr#' - endif - let l:statusline .= ' %n ' . l:separator + augroup status "{{{ + autocmd! + autocmd WinNew,WinEnter * setlocal statusline=%!GetStatus(1) + autocmd WinLeave * setlocal statusline=%!GetStatus(0) + " autocmd WinNew * setlocal statusline=%!GetStatus(1) + " autocmd InsertChange * setlocal statusline=%!GetStatus(1) + augroup END "}}} - " file percentage {{{ - if a:isactive - let l:statusline .= '%#StatusLinePercentActive#' - let l:statusline .= ' %P %#StatusLineNoiseActive#of %#StatusLineLinecountActive#%L ' - else - let l:statusline .= '%#StatusLinePercent#' - let l:statusline .= ' %P %#StatusLineNoise#of %#StatusLineLinecount#%L ' - endif"}}} + function! GetStatus(isactive) abort "{{{ + " let l:linter = ale#statusline#Count(bufnr('')) + let l:divider = '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >' + let l:separator = '%#StatusLineSeparator# ' + let l:normal = '%#StatusLineNormal#' + let l:active = '%#StatusLineActive#' + let l:linterdash = '%#LinterDash#·' + let l:linterdashactive = '%#LinterDashActive#·' + let l:statusline = l:separator - " non-empty buftype (help, quickfix, etc) {{{ - if a:isactive - let l:statusline .= l:active . "%{&buftype == '' ? '' : ' '}%q%h%w%#StatusLineActiveNoText#" - else - let l:statusline .= l:normal . "%{&buftype == '' ? '' : ' '}%q%h%w%#StatusLineNormalNoText#" - endif - let l:statusline .= "%{&buftype == '' ? '' : ' '}%s" -"}}} - - " right/left divider {{{ - let l:statusline.=l:separator - " 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 .= GetStatusFrag("mode() == 'i'", 'StatusLineDivInput', '%<', l:divider) - endif - - let l:statusline.= l:separator . '%*%=' - "}}} - - " file info{{{ - if a:isactive == 1 - " let l:statusline.=l:active - let l:statusline.='%#StatusLineFileInfo#' - " let l:statusline.=" %{strlen(&ft)?&ft:'none'} " - " let l:statusline.=l:separator . l:active - let l:statusline.='%{strlen(&fenc)?&fenc:&enc}' - " let l:statusline.=l:separator . l:active - let l:statusline.=' %{&fileformat}' - let l:statusline.="%{strlen(expand('%:e')) > 1?' ' . expand('%:e'):''}" - " let l:statusline.=l:separator . l:active - " let l:statusline.=' %{&spelllang} ' - let l:statusline .= l:separator - endif -"}}} - - " path/filename.extension {{{ - if a:isactive - if &readonly - let l:statusline .= '%#StatusLineWarningActive# %r ' - let l:statusline .= '%#StatusLineFileReadOnlyActive#' - " let l:statusline.='%#StatusLineDirActive# ' - let l:statusline.="%{expand('%:p:h:t')}/" - " let l:statusline.='%#StatusLineFileActive#' - - let l:statusline.="%{expand('%:t:r')}" - - " let l:statusline.='%#StatusLineDotActive#' - let l:statusline.="%{strlen(expand('%:e'))?'.':''}" - " let l:statusline.='%#StatusLineExtActive#' - let l:statusline.="%{expand('%:e')} " + "buffer number {{{ + if a:isactive + let l:statusline .= '%#StatusLineBufferNrActive#' else - let l:statusline.='%#StatusLineDirActive# ' - let l:statusline.="%{expand('%:p:h:t')}/" - let l:statusline.='%#StatusLineFileActive#' - - let l:statusline.="%{expand('%:t:r')}" - - let l:statusline.='%#StatusLineDotActive#' - let l:statusline.="%{strlen(expand('%:e'))?'.':''}" - let l:statusline.='%#StatusLineExtActive#' - let l:statusline.="%{expand('%:e')} " + let l:statusline .= '%#StatusLineBufferNr#' endif - else - let l:statusline .= ' %#StatusLineWarning#%r' - let l:statusline.='%#StatusLineDir# ' - let l:statusline.="%{fnamemodify(expand('%:p:h'),':~')}/" - let l:statusline.='%#StatusLineFile#' - - 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')} " - endif + let l:statusline .= ' %n ' . l:separator "}}} - let l:statusline.='%*' . l:separator + " file percentage {{{ + if a:isactive + let l:statusline .= '%#StatusLinePercentActive#' + let l:statusline .= ' %P %#StatusLineNoiseActive#of %#StatusLineLinecountActive#%L ' + else + let l:statusline .= '%#StatusLinePercent#' + let l:statusline .= ' %P %#StatusLineNoise#of %#StatusLineLinecount#%L ' + endif"}}} - " linter status {{{ - if a:isactive - " errors - let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('error') == 0?'-':'')}" - let l:statusline .= "%#LinterErrorActive#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}" - " style errors - let l:statusline .= l:linterdashactive - let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('style_error') == 0?'-':'')}" - let l:statusline .= "%#LinterErrorStyleActive#%{(GetLinterStatus('style_error') == 0?'':GetLinterStatus('style_error'))} " + " non-empty buftype (help, quickfix, etc) {{{ + if a:isactive + let l:statusline .= l:active . "%{&buftype == '' ? '' : ' '}%q%h%w%#StatusLineActiveNoText#" + else + let l:statusline .= l:normal . "%{&buftype == '' ? '' : ' '}%q%h%w%#StatusLineNormalNoText#" + endif + let l:statusline .= "%{&buftype == '' ? '' : ' '}%s" + "}}} - " warnings - let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('warning') == 0?'-':'')}" - let l:statusline .= "%#LinterWarningActive#%{(GetLinterStatus('warning') == 0?'':GetLinterStatus('warning'))}" - " style warnings - let l:statusline .= l:linterdashactive - let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('style_warning') == 0?'-':'')}" - let l:statusline .= "%#LinterWarningStyleActive#%{(GetLinterStatus('style_warning') == 0?'':GetLinterStatus('style_warning'))} " + " right/left divider {{{ + let l:statusline.=l:separator + " modified version + let l:color = 'StatusLineDivMod' . (a:isactive?'Active':'') + let l:statusline .= GetStatusFrag("&modified && mode() != 'i'", l:color, '%<', l:divider) - " info - let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('info') == 0?'-':'')}" - let l:statusline .= "%#LinterInfoActive#%{(GetLinterStatus('info') == 0?'':GetLinterStatus('info'))}" - else - " errors - let l:statusline .= "%#LinterDash#%{(GetLinterStatus('error') == 0?'-':'')}" - let l:statusline .= "%#LinterError#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}" - " style errors - let l:statusline .= l:linterdash - let l:statusline .= "%{(GetLinterStatus('style_error') == 0?'-':'')}" - let l:statusline .= "%#LinterErrorStyle#%{(GetLinterStatus('style_error') == 0?'':GetLinterStatus('style_error'))} " + " unmodified version + let l:color = 'StatusLineDiv' . (a:isactive?'Active':'') + let l:statusline .= GetStatusFrag("!&modified && mode() != 'i'", l:color, '%<', l:divider) - " warnings - let l:statusline .= "%#LinterDash#%{(GetLinterStatus('warning') == 0?'-':'')}" - let l:statusline .= "%#LinterWarning#%{(GetLinterStatus('warning') == 0?'':GetLinterStatus('warning'))}" - " style warnings - let l:statusline .= l:linterdash - let l:statusline .= "%{(GetLinterStatus('style_warning') == 0?'-':'')}" - let l:statusline .= "%#LinterWarningStyle#%{(GetLinterStatus('style_warning') == 0?'':GetLinterStatus('style_warning'))} " + " input mode version + if a:isactive + let l:statusline .= GetStatusFrag("mode() == 'i'", 'StatusLineDivInput', '%<', l:divider) + endif - " info - let l:statusline .= "%#LinterInfo#%{GetLinterStatus('info') == 0 ? '-' : GetLinterStatus('info')}" - endif -"}}} + let l:statusline.= l:separator . '%*%=' + "}}} - let l:statusline .= ' ' . l:separator + " file info{{{ + if a:isactive == 1 + " let l:statusline.=l:active + let l:statusline.='%#StatusLineFileInfo#' + " let l:statusline.=" %{strlen(&ft)?&ft:'none'} " + " let l:statusline.=l:separator . l:active + let l:statusline.='%{strlen(&fenc)?&fenc:&enc}' + " let l:statusline.=l:separator . l:active + let l:statusline.=' %{&fileformat}' + let l:statusline.="%{strlen(expand('%:e')) > 1?' ' . expand('%:e'):''}" + " let l:statusline.=l:separator . l:active + " let l:statusline.=' %{&spelllang} ' + let l:statusline .= l:separator + endif + "}}} - if exists('gutentags#statusline') - let l:statusline .= '%#StatusLineWarning#%{gutentags#statusline("", "", "☢")}' - endif + " path/filename.extension {{{ + if a:isactive + if &readonly + let l:statusline .= '%#StatusLineWarningActive# %r ' + let l:statusline .= '%#StatusLineFileReadOnlyActive#' + " let l:statusline.='%#StatusLineDirActive# ' + let l:statusline.="%{expand('%:p:h:t')}/" + " let l:statusline.='%#StatusLineFileActive#' - return l:statusline + let l:statusline.="%{expand('%:t:r')}" -endfunction -"}}} + " let l:statusline.='%#StatusLineDotActive#' + let l:statusline.="%{strlen(expand('%:e'))?'.':''}" + " let l:statusline.='%#StatusLineExtActive#' + let l:statusline.="%{expand('%:e')} " + else + let l:statusline.='%#StatusLineDirActive# ' + let l:statusline.="%{expand('%:p:h:t')}/" + let l:statusline.='%#StatusLineFileActive#' -" highlight groups {{{ -hi def link StatusLineSeparator Ignore -hi def link StatusLineNormal StatusLineNC -hi def link StatusLineActive StatusLine -hi def link StatusLineNormalNoText TabLineFill -hi def link StatusLineActiveNoText TabLineFill + let l:statusline.="%{expand('%:t:r')}" -hi def link StatusLineNoise StatusLineNormal -hi def link StatusLineNoiseActive StatusLineNormal + let l:statusline.='%#StatusLineDotActive#' + let l:statusline.="%{strlen(expand('%:e'))?'.':''}" + let l:statusline.='%#StatusLineExtActive#' + let l:statusline.="%{expand('%:e')} " + endif + else + let l:statusline .= ' %#StatusLineWarning#%r' + let l:statusline.='%#StatusLineDir# ' + let l:statusline.="%{fnamemodify(expand('%:p:h'),':~')}/" + let l:statusline.='%#StatusLineFile#' -hi def link StatusLineBufferNr StatusLineNormal -hi def link StatusLineBufferNrActive StatusLineActive + let l:statusline.="%{expand('%:t:r')}" -hi def link StatusLinePercent StatusLineNormal -hi def link StatusLinePercentActive StatusLineActive -hi def link StatusLineLinecount StatusLinePercent -hi def link StatusLineLinecountActive StatusLinePercentActive + let l:statusline.='%#StatusLineDot#' + let l:statusline.="%{strlen(expand('%:e'))?'.':''}" + let l:statusline.='%#StatusLineExt#' + let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')} " + endif + "}}} -hi DivActive ctermbg=darkgray ctermfg=darkgray guibg=#666666 guifg=#666666 -hi DivMod ctermbg=darkred ctermfg=darkred guibg=#660000 guifg=#660000 -hi DivModActive ctermbg=red ctermfg=red guibg=#aa0000 guifg=#aa0000 -hi DivInput ctermbg=darkblue ctermfg=darkblue guibg=#000022 guifg=#000022 -hi def link StatusLineDiv TabLineFill -hi def link StatusLineDivActive DivActive -hi def link StatusLineDivMod DivMod -hi def link StatusLineDivModActive DivModActive -hi def link StatusLineDivInput DivInput + let l:statusline.='%*' . l:separator -hi def link StatusLineFileInfo StatusLineActive + " linter status {{{ + if a:isactive + " errors + let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('error') == 0?'-':'')}" + let l:statusline .= "%#LinterErrorActive#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}" + " style errors + let l:statusline .= l:linterdashactive + let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('style_error') == 0?'-':'')}" + let l:statusline .= "%#LinterErrorStyleActive#%{(GetLinterStatus('style_error') == 0?'':GetLinterStatus('style_error'))} " -hi def link StatusLineFile StatusLineNormal -hi def link StatusLineFileActive StatusLineActive -hi def link StatusLineDir StatusLineFile -hi def link StatusLineDirActive StatusLineFileActive -hi def link StatusLineDot StatusLineDir -hi def link StatusLineDotActive StatusLineDirActive -hi def link StatusLineExt StatusLineDir -hi def link StatusLineExtActive StatusLineDirActive + " warnings + let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('warning') == 0?'-':'')}" + let l:statusline .= "%#LinterWarningActive#%{(GetLinterStatus('warning') == 0?'':GetLinterStatus('warning'))}" + " style warnings + let l:statusline .= l:linterdashactive + let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('style_warning') == 0?'-':'')}" + let l:statusline .= "%#LinterWarningStyleActive#%{(GetLinterStatus('style_warning') == 0?'':GetLinterStatus('style_warning'))} " -hi def link StatusLineFileReadOnlyActive WarningMsg -hi def link StatusLineWarning StatusLineNormal -hi def link StatusLineWarningActive WarningMsg + " info + let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('info') == 0?'-':'')}" + let l:statusline .= "%#LinterInfoActive#%{(GetLinterStatus('info') == 0?'':GetLinterStatus('info'))}" + else + " errors + let l:statusline .= "%#LinterDash#%{(GetLinterStatus('error') == 0?'-':'')}" + let l:statusline .= "%#LinterError#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}" + " style errors + let l:statusline .= l:linterdash + let l:statusline .= "%{(GetLinterStatus('style_error') == 0?'-':'')}" + let l:statusline .= "%#LinterErrorStyle#%{(GetLinterStatus('style_error') == 0?'':GetLinterStatus('style_error'))} " -hi def link LinterDash Normal -hi def link LinterDashActive Normal + " warnings + let l:statusline .= "%#LinterDash#%{(GetLinterStatus('warning') == 0?'-':'')}" + let l:statusline .= "%#LinterWarning#%{(GetLinterStatus('warning') == 0?'':GetLinterStatus('warning'))}" + " style warnings + let l:statusline .= l:linterdash + let l:statusline .= "%{(GetLinterStatus('style_warning') == 0?'-':'')}" + let l:statusline .= "%#LinterWarningStyle#%{(GetLinterStatus('style_warning') == 0?'':GetLinterStatus('style_warning'))} " -hi def link LinterError Normal -hi def link LinterErrorActive ErrorMsg + " info + let l:statusline .= "%#LinterInfo#%{GetLinterStatus('info') == 0 ? '-' : GetLinterStatus('info')}" + endif + "}}} -hi def link LinterErrorStyle Normal -hi def link LinterErrorStyleActive SpellBad + let l:statusline .= ' ' . l:separator -hi def link LinterWarning Normal -hi def link LinterWarningActive SpellCap + if exists('gutentags#statusline') + let l:statusline .= '%#StatusLineWarning#%{gutentags#statusline("", "", "☢")}' + endif -hi def link LinterWarningStyle Normal -hi def link LinterWarningStyleActive LinterWarningActive + return l:statusline -hi def link LinterInfo Normal -hi def link LinterInfoActive SpellRare -"}}} + endfunction + "}}} -augroup status "{{{ - autocmd! - autocmd WinNew,WinEnter * setlocal statusline=%!GetStatus(1) - autocmd WinLeave * setlocal statusline=%!GetStatus(0) - " autocmd WinNew * setlocal statusline=%!GetStatus(1) - " autocmd InsertChange * setlocal statusline=%!GetStatus(1) -augroup END -"}}} +" highlight groups {{{ + hi def link StatusLineSeparator Ignore + hi def link StatusLineNormal StatusLineNC + hi def link StatusLineActive StatusLine + hi def link StatusLineNormalNoText TabLineFill + hi def link StatusLineActiveNoText TabLineFill + + hi def link StatusLineNoise StatusLineNormal + hi def link StatusLineNoiseActive StatusLineNormal + + hi def link StatusLineBufferNr StatusLineNormal + hi def link StatusLineBufferNrActive StatusLineActive + + hi def link StatusLinePercent StatusLineNormal + hi def link StatusLinePercentActive StatusLineActive + hi def link StatusLineLinecount StatusLinePercent + hi def link StatusLineLinecountActive StatusLinePercentActive + + hi DivActive ctermbg=darkgray ctermfg=darkgray guibg=#666666 guifg=#666666 + hi DivMod ctermbg=darkred ctermfg=darkred guibg=#660000 guifg=#660000 + hi DivModActive ctermbg=red ctermfg=red guibg=#aa0000 guifg=#aa0000 + hi DivInput ctermbg=darkblue ctermfg=darkblue guibg=#000022 guifg=#000022 + hi def link StatusLineDiv TabLineFill + hi def link StatusLineDivActive DivActive + hi def link StatusLineDivMod DivMod + hi def link StatusLineDivModActive DivModActive + hi def link StatusLineDivInput DivInput + + hi def link StatusLineFileInfo StatusLineActive + + hi def link StatusLineFile StatusLineNormal + hi def link StatusLineFileActive StatusLineActive + hi def link StatusLineDir StatusLineFile + hi def link StatusLineDirActive StatusLineFileActive + hi def link StatusLineDot StatusLineDir + hi def link StatusLineDotActive StatusLineDirActive + hi def link StatusLineExt StatusLineDir + hi def link StatusLineExtActive StatusLineDirActive + + hi def link StatusLineFileReadOnlyActive WarningMsg + hi def link StatusLineWarning StatusLineNormal + hi def link StatusLineWarningActive WarningMsg + + hi def link LinterDash Normal + hi def link LinterDashActive Normal + + hi def link LinterError Normal + hi def link LinterErrorActive ErrorMsg + + hi def link LinterErrorStyle Normal + hi def link LinterErrorStyleActive SpellBad + + hi def link LinterWarning Normal + hi def link LinterWarningActive SpellCap + + hi def link LinterWarningStyle Normal + hi def link LinterWarningStyleActive LinterWarningActive + + hi def link LinterInfo Normal + hi def link LinterInfoActive SpellRare + "}}} + +endif +" TODO set statusline if not using custom statusline "----------------------------------------------------------------------------}}} " #tabline {{{ -if exists('+showtabline') +if exists('+showtabline') && g:vimrc_enable_tabline " Rename tabs to show tab number. " based on: @@ -1638,8 +1612,13 @@ if exists('+showtabline') hi def link TabLineNum TabLine hi def link TabLineNumSel TabLineSel -endif " exists("+showtabline") +endif "----------------------------------------------------------------------------}}} +if filereadable(expand('.vimrc-overrides'))"{{{ + source .vimrc-overrides +endif +"}}} + " vim: set foldmethod=marker: