From 4c13c94bda0877e2b1506ffaf8e811b0a1d6deb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Tue, 19 Apr 2022 01:08:15 +0200 Subject: [PATCH] nvim: Added the new function check error --- .config/nvim/init.vim | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 0ccdbec..aa5b192 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -163,7 +163,6 @@ let g:vimspector_install_gadgets = [ 'debugpy', 'vscode-go', 'CodeLLDB', 'vscode " Theme """""""""""""""""""""""""""""""" "colorscheme gruvbox -"colorscheme default colorscheme dracula let g:gruvbox_invert_selection='0' let g:gruvbox_contrast_dark = 'hard' @@ -195,6 +194,19 @@ function! StatuslineGit() return strlen(l:branchname) > 0?' '.l:branchname.' ':'' endfunction +function! StatusDiagnostic() abort + let info = get(b:, 'coc_diagnostic_info', {}) + if empty(info) | return '' | endif + let msgs = [] + if get(info, 'error', 0) + call add(msgs, 'E' . info['error']) + endif + if get(info, 'warning', 0) + call add(msgs, 'W' . info['warning']) + endif + return join(msgs, ' '). ' ' . get(g:, 'coc_status', '') +endfunction + set statusline= set statusline+=%#IncSearch# set statusline+=%{&filetype!=#''?'\ \ ['.&filetype.']\ ':'\ '} @@ -202,6 +214,9 @@ set statusline+=%{&modified?'[+]\ ':''} set statusline+=%#CursorLineNr# set statusline+=\ %F set statusline+=%= "Right side settings +set statusline+=%#warningmsg# +set statusline+=%{StatusDiagnostic()!=#''?'\ '.StatusDiagnostic():''} +set statusline+=%#CursorLineNr# set statusline+=%{StatuslineGit()} set statusline+=%#Search# set statusline+=\ %l/%L