From 78e821e3866d95746020425f16a54458c6d865ed Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Tue, 6 Apr 2021 14:05:18 +0100 Subject: [PATCH] Add a call to coc#status() in statusline Don't miss out on the status of coc.nvim by insuring updates are rendered in the statusline. --- plugin/statusline.vim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/plugin/statusline.vim b/plugin/statusline.vim index 6a0949e..c729ae4 100644 --- a/plugin/statusline.vim +++ b/plugin/statusline.vim @@ -1,4 +1,5 @@ " Show the statusline above the commandline. +scriptencoding utf-8 set laststatus=2 " Define color variables. @@ -6,10 +7,11 @@ let g:statusline#light_green = {'fg': ['235', '#080808'], 'bg': [ '35', '#0087f let g:statusline#light_blue = {'fg': ['235', '#080808'], 'bg': [ '33', '#0087ff']} let g:statusline#light_orange = {'fg': ['235', '#080808'], 'bg': ['209', '#eb754d']} let g:statusline#light_red = {'fg': ['235', '#080808'], 'bg': ['124', '#af0000']} -let g:statusline#light_grey = {'fg': ['250', "#bcbcbc"], 'bg': ['236', "#303030"]} +let g:statusline#light_grey = {'fg': ['250', '#bcbcbc'], 'bg': ['236', '#303030']} let g:statusline#light_violet = {'fg': ['235', '#080808'], 'bg': [ '99', '#986fec']} let g:statusline#dark_white = {'fg': [ '15', '#ffffff'], 'bg': ['233', '#121212']} let g:statusline#dark_yellow = {'fg': ['179', '#dfaf5f'], 'bg': ['233', '#121212']} +let g:statusline#dark_grey = {'fg': ['244', '#808080'], 'bg': ['233', '#121212']} " Create highlight groups. function! s:hi(group, color) abort @@ -27,9 +29,12 @@ call s:hi('StatusLineDusk', g:statusline#light_grey) " StatusLineDark shows the filename and filetype and takes up most of the " statusline, give it a dark background. call s:hi('StatusLineDark', g:statusline#dark_white) -" StatusLineChange show changes in the file by changing the colour of the +" StatusLineChange shows changes in the file by changing the colour of the " filename, give if a dark background. call s:hi('StatusLineChange', g:statusline#dark_yellow) +" StatusLineFade shows the status of completion engines but using colors which +" fade into the background to avoid grabbing attention. +call s:hi('StatusLineDuskFade', g:statusline#dark_grey) " Construct a statusline for special buffer types. function! statusline#special(group, name, title) @@ -59,6 +64,8 @@ function! statusline#generic(group, mode) let l:state = '%#StatusLineDark#' \.'%{&readonly ? " 🔒" : ""}' \.'%{&modifiable ? "" : " ⛔"}' + " Display coc.nvim status. + let l:coc = '%#StatusLineDuskFade#%( %{coc#status()}%)' " Display filetype if set. let l:type = '%#StatusLineDark# %{&filetype} ' " Display fileencoding if not utf-8 and fileformat if not unix with dusk @@ -70,7 +77,7 @@ function! statusline#generic(group, mode) " Display current/total lines and column with dynamic highlights. let l:line = '%#'.a:group.'# ☰ %l/%L ㏑%2c ' " Combine the elements into a single string to be evaluated. - return l:mode.l:edit.l:file.l:state.'%='.l:type.l:format.l:line + return l:mode.l:edit.l:file.l:state.l:coc.'%='.l:type.l:format.l:line endfunction " Define active statusline, this statusline is dynamic with StatusLineLight