dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | Submodules | README | LICENSE

appearance.vim (3374B)


      1 " highlight 81st column
      2 set colorcolumn=+1
      3 
      4 augroup GVimTweaks
      5     if has("gui_running")
      6         set guioptions-=T  " no toolbar
      7         set guioptions-=m  " no menubar
      8         set guioptions-=r  " no right-hand scroll bar
      9         set guioptions-=L  " no left-hand scroll bar
     10         if has("gui_gtk2") || has("gui_gtk3")
     11             set guifont=Pragmata\ Pro\ 10
     12         elseif has("gui_macvim")
     13             set guifont=Menlo\ Regular:h14
     14         elseif has("gui_win32")
     15             "set guifont=Consolas:h11:cANSI
     16             set guifont=PragmataPro:h11
     17         endif
     18     endif
     19 augroup end
     20 
     21 colorscheme adbasic
     22 
     23 " Show syntax highlighting groups for word under cursor
     24 nnoremap <C-S-P> :call <SID>SynStack()<CR>
     25 function! <SID>SynStack()
     26   if !exists("*synstack")
     27     return
     28   endif
     29   echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
     30 endfunc
     31 
     32 augroup AleAppearance
     33     let g:ale_sign_error = '✖'
     34     let g:ale_sign_warning = '⚠'
     35 
     36     highlight ALEErrorSign ctermbg=NONE ctermfg=Red
     37     highlight ALEWarningSign ctermbg=NONE ctermfg=Yellow
     38 
     39     highlight ALEError ctermbg=NONE ctermfg=Red
     40     highlight ALEWarning ctermbg=NONE ctermfg=Yellow
     41 augroup end
     42 
     43 " statusline helper functions
     44 function! StatuslineLinterWarnings() abort
     45     let l:counts = ale#statusline#Count(bufnr(''))
     46     let l:all_errors = l:counts.error + l:counts.style_error
     47     let l:all_non_errors = l:counts.total - l:all_errors
     48     return l:all_non_errors == 0 ? '' : printf(' %d ⚠ ', all_non_errors)
     49 endfunction
     50 "
     51 function! StatuslineLinterErrors() abort
     52     let l:counts = ale#statusline#Count(bufnr(''))
     53     let l:all_errors = l:counts.error + l:counts.style_error
     54     let l:all_non_errors = l:counts.total - l:all_errors
     55     return l:all_errors == 0 ? '' : printf(' %d ✖', all_errors)
     56 endfunction
     57 
     58 function! StatuslineLinterOK() abort
     59     let l:counts = ale#statusline#Count(bufnr(''))
     60     let l:all_errors = l:counts.error + l:counts.style_error
     61     let l:all_non_errors = l:counts.total - l:all_errors
     62     return l:counts.total == 0 ? '✓' : ''
     63 endfunction
     64 
     65 augroup StatuslineConfig
     66 
     67     " define custom highlight groups for statusline coloring
     68     highlight User1 ctermfg=NONE guifg=#d0d0d0 ctermbg=NONE guibg=#585858
     69     " highlight User2 ctermfg=NONE guifg=#969696 ctermbg=NONE guibg=#585858
     70     " highlight User3 ctermbg=NONE guibg=#808080 ctermfg=NONE guifg=#444444
     71     " highlight User4 ctermfg=NONE guifg=#d0d0d0 ctermbg=NONE guibg=#444444
     72 
     73     " empty statusline and populate later
     74     set statusline=
     75 
     76     " left
     77     set statusline+=%1*           " set User1 color
     78     set statusline+=\%t\         " tail of filename
     79     " set statusline+=%4*           " set User4 color
     80     set statusline+=\ %h%w%m%r\   " flags for help file, preview, modified, R/O
     81     "set statusline+=%#LineNr#     " set default background
     82 
     83     " center spacing
     84     set statusline+=%=            " add separation between left and right items
     85 
     86     " right
     87     " set statusline+=%4*           " set background color
     88     if &rtp =~ 'ale'
     89         set statusline+=%7*%{StatuslineLinterWarnings()}%4*   " ALE warnings
     90         set statusline+=%6*%{StatuslineLinterErrors()}%4*     " ALE errors
     91         set statusline+=%{StatuslineLinterOK()}               " ALE ok
     92     endif
     93     " set statusline+=%3*           " set User3 color
     94     set statusline+=\ %c:%l       " line and column view
     95 augroup END