dotfiles

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

commit b98d7f30edfb66f76d15b5fc83f4d5a3ffde520e
parent 92d86ac87b1180e931e8122f578eea011f277f4d
Author: Anders Damsgaard <andersd@riseup.net>
Date:   Thu, 19 Oct 2017 16:11:12 -0400

use lightline instead of airline, add ; for buffer navigation

Diffstat:
Mlinks/.vim/appearance.vim | 61+------------------------------------------------------------
Mlinks/.vim/keybinds.vim | 3++-
Mlinks/.vim/plugins.vim | 56+++++++++++++++++++++++++++++++++++++++++++++++++++++---
3 files changed, 56 insertions(+), 64 deletions(-)

diff --git a/links/.vim/appearance.vim b/links/.vim/appearance.vim @@ -1,5 +1,4 @@ -" terminal colors -"set t_Co=16 +" terminal colors "set t_Co=16 "set t_Co=256 " hilight column 80 @@ -9,64 +8,13 @@ highlight ColorColumn ctermbg=237 "" For Neovim 0.1.3 and 0.1.4 let $NVIM_TUI_ENABLE_TRUE_COLOR=1 colorscheme tender -let g:airline_theme = 'tender' -"let g:airline_theme = 'ubaryd' -"let g:airline_theme = 'solarized' -"let g:airline_theme = 'tomorrow' -"let g:airline_theme = 'wombat' -"let g:airline_theme = 'powerlineish' -"let g:airline_theme = 'bubblegum' highlight Normal cterm=NONE ctermfg=NONE ctermbg=NONE highlight Search cterm=NONE ctermfg=black ctermbg=2 highlight MatchParen cterm=NONE ctermfg=255 ctermbg=199 highlight SpecialKey ctermfg=250 ctermbg=NONE cterm=NONE highlight NonText ctermfg=250 ctermbg=NONE -" vim-airline symbols -if !exists('g:airline_symbols') - let g:airline_symbols = {} -endif - -" unicode symbols -"let g:airline_left_sep = '»' -"let g:airline_left_sep = '▶' -"let g:airline_right_sep = '«' -"let g:airline_right_sep = '◀' -"let g:airline_symbols.linenr = '␊' -"let g:airline_symbols.linenr = '␤' -"let g:airline_symbols.linenr = '¶' -"let g:airline_symbols.branch = '⎇' -"let g:airline_symbols.paste = 'ρ' -"let g:airline_symbols.paste = 'Þ' -"let g:airline_symbols.paste = '∥' -"let g:airline_symbols.whitespace = 'Ξ' - -" powerline symbols -let g:airline_left_sep = '' -let g:airline_left_alt_sep = '' -let g:airline_right_sep = '' -let g:airline_right_alt_sep = '' -let g:airline_symbols.branch = '' -let g:airline_symbols.readonly = '' -let g:airline_symbols.linenr = '' - -" Powerline symbols, fancy needs a patched/edited font -"let g:Powerline_symbols = 'unicode' -"let g:Powerline_symbols = 'fancy' - -" use airline decorations for tab line -let g:airline#extensions#tabline#enabled = 1 -let g:airline#extensions#tabline#left_sep = '' -let g:airline#extensions#tabline#left_alt_sep = '' -let g:airline#extensions#tabline#tab_min_count = 2 -let g:airline#extensions#tabline#buffer_min_count = 2 - -" minimal line indicator -let g:airline_section_y = '%{LineNoIndicator()}' -let g:airline_section_z = '%2c' " column number -"let g:airline_section_z = '%{LineNoIndicator()} %2c' - " Invisible character colors " chose ctermfg=10 if Tab and EOL characters should be brighter " chose ctermfg=0 if Tab and EOL characters should be darker @@ -83,10 +31,3 @@ let g:ctrlp_extensions = ['buffertag', 'tag', 'line', 'dir', 'tmux', 'mpc'] "hi! VertSplit ctermfg=15 ctermbg=NONE term=NONE hi! VertSplit ctermfg=238 ctermbg=NONE term=NONE -" Indent guides color and character┆│¦⦙ -"let g:indentLine_char = '┆' -" Vim -"let g:indentLine_color_term = 238 -"GVim -"let g:indentLine_color_gui = '#3A3A3A' - diff --git a/links/.vim/keybinds.vim b/links/.vim/keybinds.vim @@ -38,7 +38,7 @@ nmap <leader>Q :bd<CR> nmap <Leader>x :x<CR> " Jump to previous buffer -nmap <leader><tab> <C-^> +nmap <leader><tab> :e#<CR> " Explore buffers "nmap <leader>b :BufExplorer<CR> @@ -196,6 +196,7 @@ elseif executable("ag") end " using fzf.vim +nmap ; :Buffers<CR> nmap <leader>b :Buffers<CR> nmap <leader>O :History<CR> nmap <leader>o :Files<CR> diff --git a/links/.vim/plugins.vim b/links/.vim/plugins.vim @@ -9,8 +9,7 @@ call plug#begin('~/.vim/plugged') " Make sure you use single quotes """""" Appearance """""" -Plug 'bling/vim-airline' -Plug 'vim-airline/vim-airline-themes' +Plug 'itchyny/lightline.vim' " lighter status line Plug 'drzel/vim-line-no-indicator' Plug 'jacoborus/tender' " color scheme Plug 'luochen1990/rainbow' " colorcode paranthesis pairs @@ -28,7 +27,6 @@ Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' Plug 'majutsushi/tagbar' " ctags overview :TagBarToggle Plug 'ludovicchabant/vim-gutentags' " automatic tag generation -"Plug 'mileszs/ack.vim' " file search, using rg or ag (Note: use FZF's :Ag for now) """""" Syntax checking """""" Plug 'w0rp/ale' " asynchronous syntax check @@ -149,3 +147,55 @@ endfunction autocmd! User GoyoEnter nested call <SID>goyo_enter() autocmd! User GoyoLeave nested call <SID>goyo_leave() + +" Lightline (theme set in appearance.vim) +let g:lightline = { +\ 'colorscheme': 'wombat', +\ 'active': { +\ 'left': [['mode', 'paste'], ['filename', 'modified']], +\ 'right': [['lineinfo'], ['percent'], ['readonly', 'linter_warnings', 'linter_errors', 'linter_ok']] +\ }, +\ 'component_expand': { +\ 'linter_warnings': 'LightlineLinterWarnings', +\ 'linter_errors': 'LightlineLinterErrors', +\ 'linter_ok': 'LightlineLinterOK' +\ }, +\ 'component_type': { +\ 'readonly': 'error', +\ 'linter_warnings': 'warning', +\ 'linter_errors': 'error' +\ }, +\ } + +" Use bar instead of percentage +let g:lightline.component = { 'percent': '%{LineNoIndicator()}' } + +function! LightlineLinterWarnings() 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 ? '' : printf('%d ◆', all_non_errors) +endfunction + +function! LightlineLinterErrors() 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 ? '' : printf('%d ✗', all_errors) +endfunction + +function! LightlineLinterOK() 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 + +autocmd User ALELint call s:MaybeUpdateLightline() + +" Update and show lightline but only if it's visible (e.g., not in Goyo) +function! s:MaybeUpdateLightline() + if exists('#lightline') + call lightline#update() + end +endfunction