From eccf27e61a9a2864f25a1bebb6383a30efab83d3 Mon Sep 17 00:00:00 2001
From: Max Christian Pohle
Date: Tue, 8 Oct 2019 22:36:24 +0200
Subject: Refactord color scheme and statusbar

---
 plugin/max-fix-colorschemes.vim | 83 ++++++++++++++++-------------------------
 plugin/statusline.vim           | 67 +++++++++++++++++++--------------
 2 files changed, 73 insertions(+), 77 deletions(-)

(limited to 'plugin')

diff --git a/plugin/max-fix-colorschemes.vim b/plugin/max-fix-colorschemes.vim
index 96b57e2..1535dc7 100644
--- a/plugin/max-fix-colorschemes.vim
+++ b/plugin/max-fix-colorschemes.vim
@@ -1,6 +1,34 @@
 "=======================================================================================================================
 " COLOR SCHEME:
 "=======================================================================================================================
+function! ExtendColorTheme()
+    highlight! Bold           cterm=bold                             gui=bold
+    highlight! Italic         cterm=italic                           gui=italic
+    highlight! Underline      cterm=underline                        gui=underline
+    highlight! BoldUnderline  cterm=bold,underline                   gui=bold,underline
+    highlight! BoldItalic     cterm=bold,Italic                      gui=bold,italic
+    highlight! Todo           cterm=bold                             gui=bold            guibg=#ffffaa guifg=#000000
+    highlight! Error          cterm=NONE  ctermbg=NONE               gui=NONE            guibg=NONE
+    highlight! SpellBad       cterm=NONE                             gui=undercurl       guibg=NONE guifg=red
+    highlight! Ignore         cterm=NONE  ctermbg=NONE ctermfg=NONE  gui=NONE            guibg=NONE guifg=NONE
+    highlight! LineNr         cterm=italic                           gui=italic
+    highlight! PmenuThumb     cterm=inverse
+    highlight! MoreMsg        cterm=inverse
+
+    highlight! link  qfSeparator  Normal     | " reserve one space
+    highlight! link  qfLineNr     Normal     | " informational line numbers should look different
+    highlight! link  SpecialKey   NonText    | " makes tab stop (see listchars) less disturbing
+    highlight! link  WildMenu     Search
+    highlight! link  Convention   Error
+    highlight! link  PmenuSbar    Pmenu
+    highlight! link  Tabline      StatusLine
+    highlight! link  VertSplit    LineNr
+    highlight! link  SignColumn   LineNr
+    highlight! link  FoldColumn   LineNr
+    highlight! link  Folded       LineNr
+    highlight! link  EndOfBuffer  LineNr
+endfunction
+autocmd ColorScheme * call ExtendColorTheme()
 
 if &term == "linux"
     set notermguicolors
@@ -8,64 +36,19 @@ else
     set termguicolors
 endif
 
-
-function! ExtendColorTheme()
-    highlight! Bold                                      cterm=bold            gui=bold
-    highlight! Italic                                    cterm=italic          gui=italic
-    highlight! Underline                                 cterm=underline       gui=underline
-    highlight! BoldUnderline                             cterm=bold,underline  gui=bold,underline
-    highlight! BoldItalic                                cterm=bold,Italic     gui=bold,italic
-    highlight! Todo                                      cterm=bold            gui=bold            guibg=#ffffaa guifg=#000000
-    highlight! Error          ctermbg=NONE               cterm=NONE            gui=NONE            guibg=NONE
-    highlight! SpellBad                                  cterm=NONE            gui=undercurl       guibg=NONE guifg=red
-    highlight! Ignore         ctermbg=NONE ctermfg=NONE  cterm=NONE            gui=NONE            guibg=NONE guifg=NONE
-    highlight! LineNr                                    cterm=italic          gui=italic
-
-    if has("gui_running")
-        highlight invisible gui=NONE guifg=background guibg=background
-    else
-        let w:color=synIDtrans(synIDattr(hlID("Normal"), "bg"))
-        silent! exec 'highlight invisible cterm=NONE ctermfg='.w:color.' ctermbg='.w:color
-        let w:color="NONE"
-        silent! exec 'highlight invisible cterm=NONE ctermbg='.w:color
-    endif
-
-        highlight! link        EndOfBuffer    Invisible
-
-    highlight! link        qfSeparator    Normal     | " reserve one space
-    highlight! link        qfLineNr       Normal     | " informational line numbers should look different
-
-    highlight! link        SpecialKey     NonText    | " makes tab stop (see listchars) less disturbing
-    highlight! link        WildMenu       Search
-    highlight! link        Convention     Error
-
-    highlight! link        VertSplit      LineNr
-    highlight! link        SignColumn     LineNr
-    highlight! link        FoldColumn     LineNr
-    highlight! link        Folded         LineNr
-
-    highlight! link        PmenuSbar      Pmenu
-    highlight! PmenuThumb  cterm=inverse
-    highlight! MoreMsg     cterm=inverse
-
-    highlight! link        Tabline        StatusLine
-
-endfunction
-autocmd ColorScheme * call ExtendColorTheme()
-
-
-" set background=light
-if filereadable(expand("~/.vimrc_background")) && filereadable(expand("~/.config/base16-shell/colortest"))
-    let g:base16_shell_path  =  "~/.config/base16-shell/scripts"
+if filereadable(expand('~/.vimrc_background')) && filereadable(expand('~/.config/base16-shell/colortest'))
+    let g:base16_shell_path  =  '~/.config/base16-shell/scripts'
     let base16colorspace     =  256
     source ~/.vimrc_background
 else
     let g:PaperColor_Theme_Options = {
                 \   'theme': {
-                \     'default': {
+                \     'default.dark': {
                 \       'transparent_background': 1
                 \     }
                 \   }
                 \ }
     colorscheme PaperColor
 endif
+
+
diff --git a/plugin/statusline.vim b/plugin/statusline.vim
index 20d6b7e..db2bc28 100644
--- a/plugin/statusline.vim
+++ b/plugin/statusline.vim
@@ -1,11 +1,11 @@
 augroup MAX_FANCYLINE
-    set noshowmode    | " mode will be shown twice, in lightline and below, so we want to deactivate one
+    set noshowmode    | " mode would otherwise be shown twice- in lightline and below. We want to deactivate one.
     set laststatus=2  | " required by AirLine and Lightline, without status line does not appear until a window split
 
     let g:status_sym_start         = ''
     let g:status_sym_end           = ''
-    let g:status_sym_sep_start     = ''
-    let g:status_sym_sep_end       = ''
+    let g:status_sym_sep_start     = '│'
+    let g:status_sym_sep_end       = '│'
     let g:symbol_branch            = ''
     let g:symbol_screen_edge       = '░'
 
@@ -33,7 +33,7 @@ augroup MAX_FANCYLINE
         if(exists('w:color') && w:color == '')
             let w:color = 'NONE'
         endif
-        silent! exec 'highlight '.retval.' gui=NONE guifg='.w:color.' cterm=NONE ctermfg='.w:color
+        silent! exec 'highlight '.l:retval.' guifg='.w:color.' ctermfg='.w:color
         return l:retval
     endfunction
 
@@ -52,60 +52,69 @@ augroup MAX_FANCYLINE
                     \  "\<C-s>" : 'select block',
                     \  't'      : 'terminal'
                     \ }, mode(), mode())
-        let l:webdev_ft_icon = exists("*WebDevIconsGetFileTypeSymbol") ? 
-                    \ " ".WebDevIconsGetFileTypeSymbol('*.'.&filetype)." " : ""
         return ''
                     \ ."%#StatusLineHighlight#"
                     \ ."%#".a:highlight_group."#"
                     \ .g:symbol_screen_edge.' '
                     \ ."%{(&readonly\ ?\ '\ \ 🔒'\ :\ '')}"
                     \ ."%{(&modified\ ?\ '\ \ 💾'\ :\ '')}"
-                    \ ."%(%w%h%q%)".' '.l:mode.' '.g:status_sym_sep_start
+                    \ ."%(%w%h%q%)".l:mode.' '.g:status_sym_sep_start
                     \ ."%{(argc()>1\ ?\ ' '.(argidx()+1).':'.argc().' '.g:status_sym_sep_start:'')}"
                     \ ."%{(haslocaldir() ?\ fnamemodify(getcwd(),\ ':.').'/ '\ \:'')}\ "
-                    \ ."%{bufname('%')==''?'':substitute(bufname('%'),\ '^'.getcwd(-1).'/*',\ '',\ '').' '}"
+                    \ ."%{winbufnr(0).': '}"
+                    \ ."%{bufname('%')==''?'':substitute(bufname('%'),\ '^'.getcwd(-1).'/*',\ '',\ '')}"
                     \ ."%{(&titlestring\ ?\ has('nvim')?b:term_title:expand(&titlestring):'')\ }"
-                    \ ."%{'['.winbufnr(0).']'}"
+                    \ .' '
                     \ ."%#".l:invert_group."#"
                     \ .g:status_sym_end
+                    \ .'%<'
                     \ .''
                     \ ."%="
                     \ .''
                     \ ."%#".l:invert_group."#"
                     \ .g:status_sym_start
-                    \ ."%#".a:highlight_group."#"
-                    \ ."%{&buftype==''?'':' '.&buftype.' '.g:status_sym_sep_end.' '}"
-                    \ .l:webdev_ft_icon." %{&filetype==''?'':&filetype.' '.g:status_sym_sep_end.' '}"
+                    \ ."%#".a:highlight_group."#".' '
+                    \ ."%{&buftype==''?'':&buftype.' '.g:status_sym_sep_end.' '}"
+                    \ ."%{&filetype==''?'':&filetype.' '.g:status_sym_sep_end.' '}"
                     \ ."%{(&spell\ ?\ &spelllang.' '.g:status_sym_sep_end\ :\ '')}"
                     \ ."%{(&fileencoding=~'^$\\|^utf\-8$'?'':&fileencoding.' '.g:status_sym_sep_end.' ')}"
                     \ ."%{(&fileformat=~'^$\\|^unix$'?'':&fileformat.' '.g:status_sym_sep_end)}"
                     \ ."%cx%-l: "
-                    \ ."%p%% "
+                    \ .g:status_sym_sep_end
+                    \ .' '
+                    \ .'%p%% '
                     \ .g:symbol_screen_edge
     endfunction
 
     function! UpdateTabline(highlight_group)
         let l:invert_group = CreateInvertGroup(a:highlight_group)
         let l:git_branch   = FugitiveHead()
-"  
         return ''
-                    \ ."%#".a:highlight_group."#"
+                    \ .'%#'.a:highlight_group.'#'
                     \ .g:symbol_screen_edge
-                    \ ."%3( \ %)\ "
-                    \ ."%{getcwd(-1)}\ "
-                    \ ."%{FugitiveHead()==''?'':g:status_sym_sep_start.' '.g:symbol_branch.' '.FugitiveHead().' '}"
-                    \ ."%#".l:invert_group."#"
+                    \ .' '
+                    \ .'%#'.a:highlight_group.'#'
+                    \ .'%-2( %)'
+                    \ .'%{getcwd(-1)}'
+                    \ .' '
+                    \ ."%{FugitiveHead()==''?'':g:status_sym_sep_start.' '.g:symbol_branch.' '.FugitiveHead()}"
+                    \ .' '
+                    \ .'%#'.l:invert_group.'#'
                     \ .g:status_sym_end
-                    \ .''
-                    \ ."%="
-                    \ .''
-                    \ ."%#".l:invert_group."#"
+                    \ .'%<'
+                    \ .'%='
+                    \ .'%#'.l:invert_group.'#'
                     \ .g:status_sym_start
-                    \ ."%#".a:highlight_group."#"
-                    \ ."%3(\ %)"
-                    \ ."%(%{v:servername}\ %{v:this_session}%)"
+                    \ .'%(%#'.a:highlight_group.'#%)'
+                    \ .' '
+                    \ .'%-3(%)'
+                    \ .'%(%#'.a:highlight_group.'#%)'
+                    \ .'%(%{v:servername} %{v:this_session}%)'
                     \ .g:status_sym_sep_end.' '
-                    \ ."%(\ \ \ %{tabpagenr()}/%{tabpagenr('$')}\ %)"
+                    \ .'%-3(%)'
+                    \ .'%#'.a:highlight_group.'#'
+                    \ .'%{tabpagenr()}/%{tabpagenr()}'
+                    \ .' '
                     \ .g:symbol_screen_edge
                     \ ."%##"
                     \ ."" " end
@@ -119,6 +128,10 @@ augroup MAX_FANCYLINE
         setlocal statusline=%!UpdateStatus(g:group_active)
         " set up the tabline (match colors)
         set tabline=%!UpdateTabline(g:group_tabline)
+
+        " otherwise 'bold' can mess up icon sizes and I do not know why
+        highlight! StatusLine cterm=reverse
+        " exec 'highlight! User3 guifg=#D2A032 guibg='.l:fgcolor
     endfunction
     " apply colors from the loaded colorscheme...
     " when changing the colorscheme also apply new colors to the statusbar...
-- 
cgit v1.2.3