commit bea28699ef8a4f73793932f971d53c47f28c16cc
parent f6a75754f2f863693c13fc2e03dc119d9c754eea
Author: Anders Damsgaard <andersd@riseup.net>
Date: Mon, 26 Mar 2018 19:12:49 -0400
Use custom statusline configuration
Diffstat:
3 files changed, 75 insertions(+), 9 deletions(-)
diff --git a/links/.vim/ftplugin/tex.vim b/links/.vim/ftplugin/tex.vim
@@ -21,6 +21,10 @@ augroup latex_options
" or run in tmux pane:
nnoremap <leader>p :!tmux new-window -a -n "latexmk" "latexmk -pdf -pvc %" \; select-window -l<cr><cr>
+ " disable continuous and slow chktex linting
+ let g:ale_lint_on_text_changed = 'never'
+ let g:ale_lint_on_enter = 0
+
augroup END
augroup latex_typography
diff --git a/links/.vim/plugin/appearance.vim b/links/.vim/plugin/appearance.vim
@@ -29,5 +29,73 @@ augroup end
colorscheme tender
" configure bottom status line
-"set statusline=""
+function! StatuslineLinterWarnings() 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:all_non_errors == 0 ? '' : printf(' %d ◆ ', all_non_errors)
+endfunction
+"
+function! StatuslineLinterErrors() 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:all_errors == 0 ? '' : printf(' %d ✗ ', all_errors)
+endfunction
+
+function! StatuslineLinterOK() 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 ? ' ✓ ' : ''
+endfunction
+
+"set statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v]
+"" | | | | | | | | | | |
+"" | | | | | | | | | | +-- current column
+"" | | | | | | | | | +-- current line
+"" | | | | | | | | +-- current % into file
+"" | | | | | | | +-- current syntax
+"" | | | | | | +-- current fileformat
+"" | | | | | +-- number of lines
+"" | | | | +-- preview flag in square brackets
+"" | | | +-- help flag in square brackets
+"" | | +-- readonly flag in square brackets
+"" | +-- rodified flag in square brackets
+"" +-- full path to file in the buffer
+
+" default:
+" set statusline=%f\ %h%w%m%r\ %=%(%l,%c%V\ %=\ %P%)
+
+" define 3 custom highlight groups for statusline coloring
+highlight User1 ctermfg=252 guifg=#d0d0d0 ctermbg=240 guibg=#585858
+highlight User2 ctermfg=247 guifg=#969696 ctermbg=240 guibg=#585858
+highlight User3 ctermbg=244 guibg=#808080 ctermfg=238 guifg=#444444
+highlight User4 ctermfg=252 guifg=#d0d0d0 ctermbg=238 guibg=#444444
+highlight User5 ctermfg=252 guifg=#d0d0d0 ctermbg=238 guibg=#444444
+highlight User6 ctermfg=238 guifg=#444444 ctermbg=203 guibg=#e5786d
+highlight User7 ctermfg=238 guifg=#444444 ctermbg=173 guibg=#e5786d
+
+" empty statusline and populate later
+set statusline=
+
+" left
+set statusline+=%1* " set User1 color
+set statusline+=\ %t\ " tail of filename
+set statusline+=%4* " set User4 color
+set statusline+=\ %h%w%m%r\ " flags for help file, preview, modified, R/O
+set statusline+=%#LineNr# " set default background
+
+" center spacing
+set statusline+=%= " add separation between left and right items
+
+" right
+set statusline+=%4* " set background color
+set statusline+=%7*%{StatuslineLinterWarnings()}%4* " ALE warnings
+set statusline+=%6*%{StatuslineLinterErrors()}%4* " ALE errors
+set statusline+=%{StatuslineLinterOK()} " ALE ok
+set statusline+=%2* " set User2 color
+set statusline+=\ %{LineNoIndicator()}\ " show file position with single char
+set statusline+=%3* " set User3 color
+set statusline+=\ %2l:%-2c\ " line and column view
diff --git a/links/.vim/plugins.vim b/links/.vim/plugins.vim
@@ -10,7 +10,7 @@ Plug 'junegunn/vim-emoji' " autocomplete :smiley: with C-x C-u
Plug 'chrisbra/unicode.vim' " autocomplete unicode with C-x C-z
"""""" Appearance """"""
-Plug 'itchyny/lightline.vim' " lighter status line
+"Plug 'itchyny/lightline.vim' " lighter status line
Plug 'drzel/vim-line-no-indicator' " emphasize current line with bg color
Plug 'jacoborus/tender' " color scheme
Plug 'luochen1990/rainbow' " colorcode paranthesis pairs
@@ -53,7 +53,6 @@ Plug 'maxbrunsfeld/vim-yankstack'
"""""" Autocomplete """"""
"Plug 'ervandew/supertab' " complete with TAB in insert mode
-"Plug 'Valloric/YouCompleteMe' " tab complete menu
Plug 'honza/vim-snippets' " snippets are separate from ultisnips
Plug 'SirVer/ultisnips' " complete boilerplate code
@@ -110,11 +109,6 @@ let g:gitgutter_map_keys = 0
let g:go_version_warning = 0
-" make YouCompleteMe compatible with UltiSnips (using supertab)
-"let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
-"let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
-"let g:SuperTabDefaultCompletionType = '<C-n>'
-
" better key bindings for UltiSnipsExpandTrigger
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsJumpForwardTrigger = "<tab>"
@@ -157,7 +151,7 @@ augroup GoyoEvents
autocmd! User GoyoLeave nested call <SID>goyo_leave()
augroup END
-" Lightline (theme set in appearance.vim)
+" Lightline
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {