diff options
author | Max Christian Pohle | 2019-10-08 22:36:24 +0200 |
---|---|---|
committer | Max Christian Pohle | 2019-10-08 22:36:24 +0200 |
commit | eccf27e61a9a2864f25a1bebb6383a30efab83d3 (patch) | |
tree | b456bb073a34e75cefdd926294433bb34da1956e /plugin/statusline.vim | |
parent | bd4fa1331b6543ddee67324ade50419f2c036105 (diff) | |
download | vim-karlmarks-eccf27e61a9a2864f25a1bebb6383a30efab83d3.tar.bz2 vim-karlmarks-eccf27e61a9a2864f25a1bebb6383a30efab83d3.zip |
Refactord color scheme and statusbar
Diffstat (limited to 'plugin/statusline.vim')
-rw-r--r-- | plugin/statusline.vim | 67 |
1 files changed, 40 insertions, 27 deletions
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 @@ | |||
1 | augroup MAX_FANCYLINE | 1 | augroup 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... |