aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorMax Christian Pohle2019-10-08 22:36:24 +0200
committerMax Christian Pohle2019-10-08 22:36:24 +0200
commiteccf27e61a9a2864f25a1bebb6383a30efab83d3 (patch)
treeb456bb073a34e75cefdd926294433bb34da1956e /plugin
parentbd4fa1331b6543ddee67324ade50419f2c036105 (diff)
downloadvim-karlmarks-eccf27e61a9a2864f25a1bebb6383a30efab83d3.tar.bz2
vim-karlmarks-eccf27e61a9a2864f25a1bebb6383a30efab83d3.zip
Refactord color scheme and statusbar
Diffstat (limited to 'plugin')
-rw-r--r--plugin/max-fix-colorschemes.vim83
-rw-r--r--plugin/statusline.vim67
2 files changed, 73 insertions, 77 deletions
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 @@
1"======================================================================================================================= 1"=======================================================================================================================
2" COLOR SCHEME: 2" COLOR SCHEME:
3"======================================================================================================================= 3"=======================================================================================================================
4function! ExtendColorTheme()
5 highlight! Bold cterm=bold gui=bold
6 highlight! Italic cterm=italic gui=italic
7 highlight! Underline cterm=underline gui=underline
8 highlight! BoldUnderline cterm=bold,underline gui=bold,underline
9 highlight! BoldItalic cterm=bold,Italic gui=bold,italic
10 highlight! Todo cterm=bold gui=bold guibg=#ffffaa guifg=#000000
11 highlight! Error cterm=NONE ctermbg=NONE gui=NONE guibg=NONE
12 highlight! SpellBad cterm=NONE gui=undercurl guibg=NONE guifg=red
13 highlight! Ignore cterm=NONE ctermbg=NONE ctermfg=NONE gui=NONE guibg=NONE guifg=NONE
14 highlight! LineNr cterm=italic gui=italic
15 highlight! PmenuThumb cterm=inverse
16 highlight! MoreMsg cterm=inverse
17
18 highlight! link qfSeparator Normal | " reserve one space
19 highlight! link qfLineNr Normal | " informational line numbers should look different
20 highlight! link SpecialKey NonText | " makes tab stop (see listchars) less disturbing
21 highlight! link WildMenu Search
22 highlight! link Convention Error
23 highlight! link PmenuSbar Pmenu
24 highlight! link Tabline StatusLine
25 highlight! link VertSplit LineNr
26 highlight! link SignColumn LineNr
27 highlight! link FoldColumn LineNr
28 highlight! link Folded LineNr
29 highlight! link EndOfBuffer LineNr
30endfunction
31autocmd ColorScheme * call ExtendColorTheme()
4 32
5if &term == "linux" 33if &term == "linux"
6 set notermguicolors 34 set notermguicolors
@@ -8,64 +36,19 @@ else
8 set termguicolors 36 set termguicolors
9endif 37endif
10 38
11 39if filereadable(expand('~/.vimrc_background')) && filereadable(expand('~/.config/base16-shell/colortest'))
12function! ExtendColorTheme() 40 let g:base16_shell_path = '~/.config/base16-shell/scripts'
13 highlight! Bold cterm=bold gui=bold
14 highlight! Italic cterm=italic gui=italic
15 highlight! Underline cterm=underline gui=underline
16 highlight! BoldUnderline cterm=bold,underline gui=bold,underline
17 highlight! BoldItalic cterm=bold,Italic gui=bold,italic
18 highlight! Todo cterm=bold gui=bold guibg=#ffffaa guifg=#000000
19 highlight! Error ctermbg=NONE cterm=NONE gui=NONE guibg=NONE
20 highlight! SpellBad cterm=NONE gui=undercurl guibg=NONE guifg=red
21 highlight! Ignore ctermbg=NONE ctermfg=NONE cterm=NONE gui=NONE guibg=NONE guifg=NONE
22 highlight! LineNr cterm=italic gui=italic
23
24 if has("gui_running")
25 highlight invisible gui=NONE guifg=background guibg=background
26 else
27 let w:color=synIDtrans(synIDattr(hlID("Normal"), "bg"))
28 silent! exec 'highlight invisible cterm=NONE ctermfg='.w:color.' ctermbg='.w:color
29 let w:color="NONE"
30 silent! exec 'highlight invisible cterm=NONE ctermbg='.w:color
31 endif
32
33 highlight! link EndOfBuffer Invisible
34
35 highlight! link qfSeparator Normal | " reserve one space
36 highlight! link qfLineNr Normal | " informational line numbers should look different
37
38 highlight! link SpecialKey NonText | " makes tab stop (see listchars) less disturbing
39 highlight! link WildMenu Search
40 highlight! link Convention Error
41
42 highlight! link VertSplit LineNr
43 highlight! link SignColumn LineNr
44 highlight! link FoldColumn LineNr
45 highlight! link Folded LineNr
46
47 highlight! link PmenuSbar Pmenu
48 highlight! PmenuThumb cterm=inverse
49 highlight! MoreMsg cterm=inverse
50
51 highlight! link Tabline StatusLine
52
53endfunction
54autocmd ColorScheme * call ExtendColorTheme()
55
56
57" set background=light
58if filereadable(expand("~/.vimrc_background")) && filereadable(expand("~/.config/base16-shell/colortest"))
59 let g:base16_shell_path = "~/.config/base16-shell/scripts"
60 let base16colorspace = 256 41 let base16colorspace = 256
61 source ~/.vimrc_background 42 source ~/.vimrc_background
62else 43else
63 let g:PaperColor_Theme_Options = { 44 let g:PaperColor_Theme_Options = {
64 \ 'theme': { 45 \ 'theme': {
65 \ 'default': { 46 \ 'default.dark': {
66 \ 'transparent_background': 1 47 \ 'transparent_background': 1
67 \ } 48 \ }
68 \ } 49 \ }
69 \ } 50 \ }
70 colorscheme PaperColor 51 colorscheme PaperColor
71endif 52endif
53
54
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 @@
1augroup MAX_FANCYLINE 1augroup MAX_FANCYLINE
2 set noshowmode | " mode will be shown twice, in lightline and below, so we want to deactivate one 2 set noshowmode | " mode would otherwise be shown twice- in lightline and below. We want to deactivate one.
3 set laststatus=2 | " required by AirLine and Lightline, without status line does not appear until a window split 3 set laststatus=2 | " required by AirLine and Lightline, without status line does not appear until a window split
4 4
5 let g:status_sym_start = '' 5 let g:status_sym_start = ''
6 let g:status_sym_end = '' 6 let g:status_sym_end = ''
7 let g:status_sym_sep_start = '' 7 let g:status_sym_sep_start = ''
8 let g:status_sym_sep_end = '' 8 let g:status_sym_sep_end = ''
9 let g:symbol_branch = '' 9 let g:symbol_branch = ''
10 let g:symbol_screen_edge = '░' 10 let g:symbol_screen_edge = '░'
11 11
@@ -33,7 +33,7 @@ augroup MAX_FANCYLINE
33 if(exists('w:color') && w:color == '') 33 if(exists('w:color') && w:color == '')
34 let w:color = 'NONE' 34 let w:color = 'NONE'
35 endif 35 endif
36 silent! exec 'highlight '.retval.' gui=NONE guifg='.w:color.' cterm=NONE ctermfg='.w:color 36 silent! exec 'highlight '.l:retval.' guifg='.w:color.' ctermfg='.w:color
37 return l:retval 37 return l:retval
38 endfunction 38 endfunction
39 39
@@ -52,60 +52,69 @@ augroup MAX_FANCYLINE
52 \ "\<C-s>" : 'select block', 52 \ "\<C-s>" : 'select block',
53 \ 't' : 'terminal' 53 \ 't' : 'terminal'
54 \ }, mode(), mode()) 54 \ }, mode(), mode())
55 let l:webdev_ft_icon = exists("*WebDevIconsGetFileTypeSymbol") ?
56 \ " ".WebDevIconsGetFileTypeSymbol('*.'.&filetype)." " : ""
57 return '' 55 return ''
58 \ ."%#StatusLineHighlight#" 56 \ ."%#StatusLineHighlight#"
59 \ ."%#".a:highlight_group."#" 57 \ ."%#".a:highlight_group."#"
60 \ .g:symbol_screen_edge.' ' 58 \ .g:symbol_screen_edge.' '
61 \ ."%{(&readonly\ ?\ '\ \ 🔒'\ :\ '')}" 59 \ ."%{(&readonly\ ?\ '\ \ 🔒'\ :\ '')}"
62 \ ."%{(&modified\ ?\ '\ \ 💾'\ :\ '')}" 60 \ ."%{(&modified\ ?\ '\ \ 💾'\ :\ '')}"
63 \ ."%(%w%h%q%)".' '.l:mode.' '.g:status_sym_sep_start 61 \ ."%(%w%h%q%)".l:mode.' '.g:status_sym_sep_start
64 \ ."%{(argc()>1\ ?\ ' '.(argidx()+1).':'.argc().' '.g:status_sym_sep_start:'')}" 62 \ ."%{(argc()>1\ ?\ ' '.(argidx()+1).':'.argc().' '.g:status_sym_sep_start:'')}"
65 \ ."%{(haslocaldir() ?\ fnamemodify(getcwd(),\ ':.').'/ '\ \:'')}\ " 63 \ ."%{(haslocaldir() ?\ fnamemodify(getcwd(),\ ':.').'/ '\ \:'')}\ "
66 \ ."%{bufname('%')==''?'':substitute(bufname('%'),\ '^'.getcwd(-1).'/*',\ '',\ '').' '}" 64 \ ."%{winbufnr(0).': '}"
65 \ ."%{bufname('%')==''?'':substitute(bufname('%'),\ '^'.getcwd(-1).'/*',\ '',\ '')}"
67 \ ."%{(&titlestring\ ?\ has('nvim')?b:term_title:expand(&titlestring):'')\ }" 66 \ ."%{(&titlestring\ ?\ has('nvim')?b:term_title:expand(&titlestring):'')\ }"
68 \ ."%{'['.winbufnr(0).']'}" 67 \ .' '
69 \ ."%#".l:invert_group."#" 68 \ ."%#".l:invert_group."#"
70 \ .g:status_sym_end 69 \ .g:status_sym_end
70 \ .'%<'
71 \ .'' 71 \ .''
72 \ ."%=" 72 \ ."%="
73 \ .'' 73 \ .''
74 \ ."%#".l:invert_group."#" 74 \ ."%#".l:invert_group."#"
75 \ .g:status_sym_start 75 \ .g:status_sym_start
76 \ ."%#".a:highlight_group."#" 76 \ ."%#".a:highlight_group."#".' '
77 \ ."%{&buftype==''?'':' '.&buftype.' '.g:status_sym_sep_end.' '}" 77 \ ."%{&buftype==''?'':&buftype.' '.g:status_sym_sep_end.' '}"
78 \ .l:webdev_ft_icon." %{&filetype==''?'':&filetype.' '.g:status_sym_sep_end.' '}" 78 \ ."%{&filetype==''?'':&filetype.' '.g:status_sym_sep_end.' '}"
79 \ ."%{(&spell\ ?\ &spelllang.' '.g:status_sym_sep_end\ :\ '')}" 79 \ ."%{(&spell\ ?\ &spelllang.' '.g:status_sym_sep_end\ :\ '')}"
80 \ ."%{(&fileencoding=~'^$\\|^utf\-8$'?'':&fileencoding.' '.g:status_sym_sep_end.' ')}" 80 \ ."%{(&fileencoding=~'^$\\|^utf\-8$'?'':&fileencoding.' '.g:status_sym_sep_end.' ')}"
81 \ ."%{(&fileformat=~'^$\\|^unix$'?'':&fileformat.' '.g:status_sym_sep_end)}" 81 \ ."%{(&fileformat=~'^$\\|^unix$'?'':&fileformat.' '.g:status_sym_sep_end)}"
82 \ ."%cx%-l: " 82 \ ."%cx%-l: "
83 \ ."%p%% " 83 \ .g:status_sym_sep_end
84 \ .' '
85 \ .'%p%% '
84 \ .g:symbol_screen_edge 86 \ .g:symbol_screen_edge
85 endfunction 87 endfunction
86 88
87 function! UpdateTabline(highlight_group) 89 function! UpdateTabline(highlight_group)
88 let l:invert_group = CreateInvertGroup(a:highlight_group) 90 let l:invert_group = CreateInvertGroup(a:highlight_group)
89 let l:git_branch = FugitiveHead() 91 let l:git_branch = FugitiveHead()
90" 
91 return '' 92 return ''
92 \ ."%#".a:highlight_group."#" 93 \ .'%#'.a:highlight_group.'#'
93 \ .g:symbol_screen_edge 94 \ .g:symbol_screen_edge
94 \ ."%3( \ %)\ " 95 \ .' '
95 \ ."%{getcwd(-1)}\ " 96 \ .'%#'.a:highlight_group.'#'
96 \ ."%{FugitiveHead()==''?'':g:status_sym_sep_start.' '.g:symbol_branch.' '.FugitiveHead().' '}" 97 \ .'%-2( %)'
97 \ ."%#".l:invert_group."#" 98 \ .'%{getcwd(-1)}'
99 \ .' '
100 \ ."%{FugitiveHead()==''?'':g:status_sym_sep_start.' '.g:symbol_branch.' '.FugitiveHead()}"
101 \ .' '
102 \ .'%#'.l:invert_group.'#'
98 \ .g:status_sym_end 103 \ .g:status_sym_end
99 \ .'' 104 \ .'%<'
100 \ ."%=" 105 \ .'%='
101 \ .'' 106 \ .'%#'.l:invert_group.'#'
102 \ ."%#".l:invert_group."#"
103 \ .g:status_sym_start 107 \ .g:status_sym_start
104 \ ."%#".a:highlight_group."#" 108 \ .'%(%#'.a:highlight_group.'#%)'
105 \ ."%3(\ %)" 109 \ .' '
106 \ ."%(%{v:servername}\ %{v:this_session}%)" 110 \ .'%-3(%)'
111 \ .'%(%#'.a:highlight_group.'#%)'
112 \ .'%(%{v:servername} %{v:this_session}%)'
107 \ .g:status_sym_sep_end.' ' 113 \ .g:status_sym_sep_end.' '
108 \ ."%(\ \ \ %{tabpagenr()}/%{tabpagenr('$')}\ %)" 114 \ .'%-3(%)'
115 \ .'%#'.a:highlight_group.'#'
116 \ .'%{tabpagenr()}/%{tabpagenr()}'
117 \ .' '
109 \ .g:symbol_screen_edge 118 \ .g:symbol_screen_edge
110 \ ."%##" 119 \ ."%##"
111 \ ."" " end 120 \ ."" " end
@@ -119,6 +128,10 @@ augroup MAX_FANCYLINE
119 setlocal statusline=%!UpdateStatus(g:group_active) 128 setlocal statusline=%!UpdateStatus(g:group_active)
120 " set up the tabline (match colors) 129 " set up the tabline (match colors)
121 set tabline=%!UpdateTabline(g:group_tabline) 130 set tabline=%!UpdateTabline(g:group_tabline)
131
132 " otherwise 'bold' can mess up icon sizes and I do not know why
133 highlight! StatusLine cterm=reverse
134 " exec 'highlight! User3 guifg=#D2A032 guibg='.l:fgcolor
122 endfunction 135 endfunction
123 " apply colors from the loaded colorscheme... 136 " apply colors from the loaded colorscheme...
124 " when changing the colorscheme also apply new colors to the statusbar... 137 " when changing the colorscheme also apply new colors to the statusbar...
..