aboutsummaryrefslogtreecommitdiff
path: root/vimrc-full
diff options
context:
space:
mode:
authorMax Christian Pohle2018-05-13 18:36:47 +0200
committerMax Christian Pohle2018-05-13 18:36:47 +0200
commit039bbf24263aa5782d290410206eedfb9354b237 (patch)
tree81610b56f64e0efa17a94e77286ee45c9706dcf6 /vimrc-full
parent8caea9124e170fbf475b4e38b8f9fe74549eb847 (diff)
downloadvim-karlmarks-039bbf24263aa5782d290410206eedfb9354b237.tar.bz2
vim-karlmarks-039bbf24263aa5782d290410206eedfb9354b237.zip
Dropped lightline, now using a custom statusline
It displays everything what lightline did before, but I took special care to make it compatible with all colorschemes I am using.
Diffstat (limited to 'vimrc-full')
-rw-r--r--vimrc-full176
1 files changed, 136 insertions, 40 deletions
diff --git a/vimrc-full b/vimrc-full
index 3b9cdd6..a4fb101 100644
--- a/vimrc-full
+++ b/vimrc-full
@@ -746,22 +746,7 @@ nnoremap <F9> :TagbarToggle<CR>| " bind TagBar to hotkey F9
746set noshowmode | " mode will be shown twice, in lightline and below, so we want to deactivate one 746set noshowmode | " mode will be shown twice, in lightline and below, so we want to deactivate one
747set laststatus=2 | " required by AirLine and Lightline, without status line does not appear until a window split 747set laststatus=2 | " required by AirLine and Lightline, without status line does not appear until a window split
748 748
749set statusline= 749" Plug 'itchyny/lightline.vim'
750set statusline+=%{(&modified?nr2char(0xF0C7):'')}
751set statusline+=%{(&readonly\ ?\ ''\ :\ '')}
752set statusline+=%{fnamemodify(getcwd(),':~')}
753set statusline+=%{nr2char(0x20)}
754set statusline+=%{nr2char(0xE0B1)}
755set statusline+=%{nr2char(0x20)}
756set statusline+=%f
757set statusline+=%*%=
758set statusline+=%l:%c(%p%%)
759" set statusline+=%t%m
760" set statusline+=%{TagInStatusLine()}
761" set statusline+=%#warningmsg#
762" set statusline+=%{SyntasticStatuslineFlag()}
763
764Plug 'itchyny/lightline.vim'
765 750
766" lightline-buffer ui settings 751" lightline-buffer ui settings
767" replace these symbols with ASCII characters if your environment does not support unicode 752" replace these symbols with ASCII characters if your environment does not support unicode
@@ -933,8 +918,8 @@ if has("python")
933 let g:ale_sign_warning = '' 918 let g:ale_sign_warning = ''
934 else 919 else
935 Plug 'scrooloose/syntastic' 920 Plug 'scrooloose/syntastic'
936 set statusline+=%#warningmsg# 921 " set statusline+=%#warningmsg#
937 set statusline+=%{SyntasticStatuslineFlag()} 922 " set statusline+=%{SyntasticStatuslineFlag()}
938 let g:LatexBox_latexmk_preview_continuously = 1 923 let g:LatexBox_latexmk_preview_continuously = 1
939 let g:LatexBox_viewer = "evince" 924 let g:LatexBox_viewer = "evince"
940 let g:syntastic_always_populate_loc_list = 1 925 let g:syntastic_always_populate_loc_list = 1
@@ -1011,6 +996,28 @@ let g:netrw_winsize = 20 | " window size in percent
1011" ====================================================================================================================== 996" ======================================================================================================================
1012 997
1013function! ExtendColorTheme() 998function! ExtendColorTheme()
999 " let g:status_fg=synIDattr(hlID('Cursor'), 'fg#')
1000 " let g:status_bg=synIDattr(hlID('Cursor'), 'bg#')
1001 " let g:status_sel=synIDattr(hlID('Text'), 'fg#')
1002 " let g:status_sel='#ffffff'
1003 let g:status_fg='#00aa00'
1004 let g:status_bg='#000000'
1005 let g:status_sel='#ffff00'
1006
1007 " execute 'highlight! StatusLine'
1008 " \ .' guibg=NONE'
1009 " \ .' guifg='.g:status_bg
1010 " \ .' gui=inverse'
1011
1012 " " execute 'highlight! User1 gui=NONE'
1013 " execute 'highlight! User1 guibg='.g:status_sel
1014 " execute 'highlight! User1 guifg='.g:status_fg
1015
1016 " execute 'highlight! User2 gui=NONE'
1017 " execute 'highlight! User2 guibg='.g:status_sel
1018 " execute 'highlight! User2 guifg=NONE'
1019
1020
1014 filetype on 1021 filetype on
1015 filetype plugin on 1022 filetype plugin on
1016 filetype indent on 1023 filetype indent on
@@ -1033,7 +1040,7 @@ function! ExtendColorTheme()
1033 highlight! PmenuThumb cterm=inverse 1040 highlight! PmenuThumb cterm=inverse
1034 highlight! MoreMsg cterm=inverse 1041 highlight! MoreMsg cterm=inverse
1035 highlight! link Folded LineNr 1042 highlight! link Folded LineNr
1036 highlight! Cursor guibg=#729fcf ctermbg=yellow 1043 " highlight! Cursor guibg=#729fcf ctermbg=yellow
1037 highlight! link VertSplit LineNr 1044 highlight! link VertSplit LineNr
1038 " highlight! SpellBad ctermbg=none 1045 " highlight! SpellBad ctermbg=none
1039 highlight! SpecialKey ctermfg=19 1046 highlight! SpecialKey ctermfg=19
@@ -1082,9 +1089,7 @@ function! ExtendColorTheme()
1082" if argc() == 0 1089" if argc() == 0
1083 " rv 1090 " rv
1084 " autocmd VimEnter * split +bro\ ol 1091 " autocmd VimEnter * split +bro\ ol
1085" endif 1092 " endif
1086"
1087
1088endfunction 1093endfunction
1089autocmd! ColorScheme * call ExtendColorTheme() 1094autocmd! ColorScheme * call ExtendColorTheme()
1090 1095
@@ -1092,24 +1097,6 @@ autocmd! ColorScheme * call ExtendColorTheme()
1092set termguicolors | " When on, uses highlight-guifg and highlight-guibg attributes in the terminal (=24bit color) incompatible with nvim 1097set termguicolors | " When on, uses highlight-guifg and highlight-guibg attributes in the terminal (=24bit color) incompatible with nvim
1093" set t_ut= 1098" set t_ut=
1094 1099
1095if filereadable(expand("~/.vimrc_background")) && filereadable(expand("~/.config/base16-shell/colortest"))
1096 let g:base16_shell_path="~/.config/base16-shell/scripts"
1097 let base16colorspace=256
1098 let syntax_cmd="skip" " vim internal, use base16 and no default colors
1099 set background=dark
1100 source ~/.vimrc_background
1101else
1102 let g:PaperColor_Theme_Options = {
1103 \ 'theme': {
1104 \ 'default': {
1105 \ 'transparent_background': 1
1106 \ }
1107 \ }
1108 \ }
1109 set background=dark
1110 colorscheme PaperColor
1111endif
1112
1113" ====================================================================================================================== 1100" ======================================================================================================================
1114" CONVENIENCE: 1101" CONVENIENCE:
1115" ====================================================================================================================== 1102" ======================================================================================================================
@@ -1163,3 +1150,112 @@ autocmd VimEnter,WinEnter * exec ':set scrolljump='.winheight(0)/2
1163map <leader>h :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')<CR> 1150map <leader>h :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')<CR>
1164 1151
1165" call setqflist( map(systemlist("git show --name-only --pretty=''"), {_, p->{'filename': fnamemodify(p, ':.')}})) 1152" call setqflist( map(systemlist("git show --name-only --pretty=''"), {_, p->{'filename': fnamemodify(p, ':.')}}))
1153"
1154if filereadable(expand("~/.vimrc_background")) && filereadable(expand("~/.config/base16-shell/colortest"))
1155 let g:base16_shell_path="~/.config/base16-shell/scripts"
1156 let base16colorspace=256
1157 let syntax_cmd="skip" " vim internal, use base16 and no default colors
1158 set background=dark
1159 source ~/.vimrc_background
1160else
1161 let g:PaperColor_Theme_Options = {
1162 \ 'theme': {
1163 \ 'default': {
1164 \ 'transparent_background': 1
1165 \ }
1166 \ }
1167 \ }
1168 set background=dark
1169 colorscheme PaperColor
1170endif
1171
1172augroup status
1173 function! CreateInvertGroup(highlight_group)
1174 if(synIDattr(hlID(a:highlight_group), "reverse")==1)
1175 let w:color=synIDattr(hlID(a:highlight_group), "fg#")
1176 else
1177 let w:color=synIDattr(hlID(a:highlight_group), "bg#")
1178 endif
1179
1180 let l:retval=a:highlight_group.'_invert'
1181 if(exists('w:color') && w:color == '')
1182 let w:color = 'NONE'
1183 endif
1184 exec 'highlight '.retval.' gui=NONE guifg='.w:color
1185 return l:retval
1186 endfunction
1187
1188 function! UpdateStatus(highlight_group)
1189 let l:invert_group = CreateInvertGroup(a:highlight_group)
1190 return
1191 \ "%#StatusLineHighlight#" .
1192 \ "%#".a:highlight_group."#" .
1193 \ "%{(&readonly\ ?\ '\ \ \ '\ :\ '')}" .
1194 \ "%{(&modified\ ?\ nr2char(0xF0C7).'\ '\ :\ '')}" .
1195 \ "%(%w%h%q\ %-8{mode(1)}%)" .
1196 \ "%{nr2char(0xe621)}" .
1197 \ "%(\ %{fnamemodify(getcwd(),\ ':~')}\ %)" .
1198 \ "%{nr2char(0xf44a)}" .
1199 \ "%(\ %f\ %)" .
1200 \ "%#".l:invert_group."#" .
1201 \ "%{nr2char(0xE0B4)\ }" .
1202 \ '' .
1203 \ "%=" .
1204 \ '' .
1205 \ "%#".l:invert_group."#" .
1206 \ "%{nr2char(0xE0B6)}" .
1207 \ "%#".a:highlight_group."#" .
1208 \ "%1(%)" .
1209 \ "%{\ &filetype}" .
1210 \ "%(\ %{nr2char(0xe621)}\ %)" .
1211 \ "%{&fileencoding}" .
1212 \ "%(\ %{nr2char(0xe621)}\ %)" .
1213 \ "%{&fileformat}" .
1214 \ "%(\ %{nr2char(0xe621)}\ %)" .
1215 \ "%4l:%-4c" .
1216 \ "%-3p%%" .
1217 \ '' " end ^
1218 endfunction
1219
1220 function! UpdateTabline(highlight_group)
1221 let l:invert_group = CreateInvertGroup(a:highlight_group)
1222 return
1223 \ "%#".a:highlight_group."#" .
1224 \ "%3(\ %)" .
1225 \ "%{nr2char(0xe621)}" .
1226 \ "%(%{v:servername}\ %{v:this_session}%)" .
1227 \ "%#".l:invert_group."#" .
1228 \ "%{nr2char(0xE0B4)\ }" .
1229 \ '' .
1230 \ "%=" .
1231 \ '' .
1232 \ "%#".l:invert_group."#" .
1233 \ "%{nr2char(0xE0B6)}" .
1234 \ "%#".a:highlight_group."#" .
1235 \ "%(\ \ %{fugitive#head()}\ %)" .
1236 \ "%{nr2char(0xe621)}" .
1237 \ "%(\ \ %{tabpagenr()}/%{tabpagenr('$')}\ %)" .
1238 \ "%##" .
1239 \ "" " end ^
1240 endfunction
1241
1242 let g:group_active = "StatusLine"
1243 let g:group_inactive = "StatusLineNC"
1244 let g:group_tabline = "TabLineSel"
1245
1246 function ApplyColorScheme()
1247 " set up statusline, global and current window individually
1248 set statusline=%!UpdateStatus(g:group_inactive)
1249 setlocal statusline=%!UpdateStatus(g:group_active)
1250 " set up the tabline (match colors)
1251 set tabline=%!UpdateTabline(g:group_tabline)
1252 endfunction
1253 " apply colors from the loaded colorscheme...
1254 call ApplyColorScheme()
1255
1256 " when changing the colorscheme also apply new colors to the statusbar...
1257 autocmd ColorScheme * call ApplyColorScheme()
1258
1259 autocmd WinEnter * setlocal statusline=%!UpdateStatus(g:group_active)
1260 autocmd WinLeave * setlocal statusline<
1261augroup END
..