From 2f9388a6500494c71b9447c195de8eff42516998 Mon Sep 17 00:00:00 2001 From: ray Date: Fri, 31 Jul 2020 15:22:03 +0100 Subject: [PATCH 1/2] move AleLinterStatus to functions section --- init.vim | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/init.vim b/init.vim index ef0e0c4..ee051ee 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,19 @@ 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 +"}}} "----------------------------------------------------------------------------}}} "#commands{{{ " TrimWhitespace{{{ @@ -307,19 +319,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 {{{ From fde3ddf2be95941c787cc235cadf703b70371dbd Mon Sep 17 00:00:00 2001 From: ray Date: Fri, 31 Jul 2020 15:42:06 +0100 Subject: [PATCH 2/2] add comment highlight visibility function --- init.vim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/init.vim b/init.vim index ee051ee..e1e6958 100644 --- a/init.vim +++ b/init.vim @@ -173,6 +173,21 @@ function! AleLinterStatus() abort "{{{ \) 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{{{ @@ -333,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 @/=""