diff --git a/init.vim b/init.vim index ef0e0c4..e1e6958 100644 --- a/init.vim +++ b/init.vim @@ -17,7 +17,6 @@ function! SynStack()"{{{ endfunc nmap pp :call SynStack() "}}} - function! s:RunShellCommand(cmdline) abort"{{{ " Shell command " http://vim.wikia.com/wiki/VimTip1599 @@ -161,6 +160,34 @@ command! -nargs=1 -complete=command Redir silent call Redir() " :Redir hi ............. show the full output of command ':hi' in a scratch window " :Redir !ls -al ........ show the full output of command ':!ls -al' in a scratch window "}}} +function! AleLinterStatus() 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( + \ '[ %dW %dE ]', + \ all_non_errors, + \ all_errors + \) +endfunction +"}}} +function! ToggleHighlights() abort "{{{ + if ! exists('b:toggle_highlights_state') + " state 1 is normal, state 0 is faded + let b:toggle_highlights_state = 1 + else + let b:toggle_highlights_state = ! b:toggle_highlights_state + endif + + if b:toggle_highlights_state == 1 + hi Comment guifg=#9d9d9d + else + hi Comment guifg=#d6d6d6 + endif +endfunction +"}}} "----------------------------------------------------------------------------}}} "#commands{{{ " TrimWhitespace{{{ @@ -307,19 +334,6 @@ set statusline+=%y\ set statusline+=%r\ %m\ %f set statusline+=\ -function! AleLinterStatus() 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( - \ '[ %dW %dE ]', - \ all_non_errors, - \ all_errors - \) -endfunction - set conceallevel=0 "----------------------------------------------------------------------------}}} " #mappings {{{ @@ -334,6 +348,7 @@ nnoremap s :syntax on nnoremap S :syntax off " miscallaneous {{{ nnoremap l :colorscheme paper-custom +nnoremap c :call ToggleHighlights() nnoremap d :colorscheme monotonous-dark nnoremap 0 ^ nnoremap cs :let @/=""