upgrade replace to a mode of its own.

This commit is contained in:
Bailey Ling 2013-07-11 03:03:27 +00:00
parent 150cd09d38
commit 78946af962
9 changed files with 77 additions and 58 deletions

View File

@ -143,8 +143,10 @@ let s:lastmode = ''
let g:airline_current_mode_text = ''
function! airline#update_highlight()
let l:m = mode()
if l:m ==# "i" || l:m ==# "R"
if l:m ==# "i"
let l:mode = ['insert']
elseif l:m ==# "R"
let l:mode = ['replace']
elseif l:m ==? "v" || l:m ==# ""
let l:mode = ['visual']
else
@ -157,12 +159,6 @@ function! airline#update_highlight()
if &paste
call add(l:mode, 'paste')
endif
if l:m ==# "R"
call add(l:mode, 'replace')
endif
if &previewwindow
call add(l:mode, 'preview')
endif
let mode_string = join(l:mode)
if s:lastmode != mode_string

View File

@ -1,5 +1,5 @@
" generates a hashtable which defines the colors for each highlight group
function! airline#themes#generate_color_map(section1, section2, section3)
function! airline#themes#generate_color_map(section1, section2, section3, file)
" guifg guibg ctermfg ctermbg gui/term
return {
\ 'mode': [ a:section1[0] , a:section1[1] , a:section1[2] , a:section1[3] , 'bold' ] ,
@ -7,5 +7,6 @@ function! airline#themes#generate_color_map(section1, section2, section3)
\ 'info': [ a:section2[0] , a:section2[1] , a:section2[2] , a:section2[3] , '' ] ,
\ 'info_separator': [ a:section2[1] , a:section3[1] , a:section2[3] , a:section3[3] , 'bold' ] ,
\ 'statusline': [ a:section3[0] , a:section3[1] , a:section3[2] , a:section3[3] , '' ] ,
\ 'file': [ a:file[0] , a:file[1] , a:file[2] , a:file[3] , '' ] ,
\ }
endfunction

View File

@ -15,9 +15,10 @@ let s:V4 = [ '#c7915b' , 173 ] " coffee
let s:PA = [ '#f4cf86' , 222 ] " dirtyblonde
let s:RE = [ 'ff9eb8' , 211 ] " dress
let g:airline#themes#badwolf#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
let g:airline#themes#badwolf#normal.file = [
\ '#ff2c4b' , s:N3[1] , 196 , s:N3[3] , '' ]
let s:file = [ '#ff2c4b' , s:N3[1] , 196 , s:N3[3] , '' ]
let g:airline#themes#badwolf#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file)
let g:airline#themes#badwolf#normal_modified = {
\ 'mode_separator' : [ s:N1[1] , s:N4[0] , s:N1[3] , s:N4[1] , 'bold' ] ,
\ 'info' : [ s:N2[0] , s:N4[0] , s:N2[2] , s:N4[1] , '' ] ,
@ -26,18 +27,23 @@ let g:airline#themes#badwolf#normal_modified = {
let g:airline#themes#badwolf#inactive = {
\ 'mode' : [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ] }
let g:airline#themes#badwolf#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
let g:airline#themes#badwolf#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file)
let g:airline#themes#badwolf#insert_modified = {
\ 'info_separator' : [ s:I2[1] , s:N2[1] , s:I2[3] , s:N2[3] , 'bold' ] ,
\ 'statusline' : [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] }
let g:airline#themes#badwolf#insert_paste = {
\ 'mode' : [ s:I1[0] , s:PA[0] , s:I1[2] , s:PA[1] , '' ] ,
\ 'mode_separator' : [ s:PA[0] , s:I2[1] , s:PA[1] , s:I2[3] , '' ] }
let g:airline#themes#badwolf#insert_replace = {
\ 'mode' : [ s:I1[0] , s:RE[0] , s:I1[2] , s:RE[1] , '' ] ,
\ 'mode_separator' : [ s:RE[0] , s:I2[1] , s:RE[1] , s:I2[3] , '' ] }
let g:airline#themes#badwolf#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
let g:airline#themes#badwolf#replace = copy(airline#themes#badwolf#insert)
let g:airline#themes#badwolf#replace.mode = [ s:I1[0] , s:RE[0] , s:I1[2] , s:RE[1] , '' ]
let g:airline#themes#badwolf#replace.mode_separator = [ s:RE[0] , s:I2[1] , s:RE[1] , s:I2[3] , '' ]
let g:airline#themes#badwolf#replace_modified = g:airline#themes#badwolf#insert_modified
let g:airline#themes#badwolf#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file)
let g:airline#themes#badwolf#visual_modified = {
\ 'info_separator' : [ s:V2[1] , s:V4[0] , s:V2[3] , s:V4[1] , 'bold' ] ,
\ 'statusline' : [ s:V3[0] , s:V4[0] , s:V3[2] , s:V4[1] , '' ] }

View File

@ -1,20 +1,20 @@
let g:airline#themes#dark#inactive = { 'mode': [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ] }
let s:file = [ '#ff0000' , '#1c1c1c' , 160 , 233 , '' ]
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ]
let g:airline#themes#dark#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
let g:airline#themes#dark#normal.file = [ '#ff0000' , '#1c1c1c' , 160 , 233 , '' ]
let g:airline#themes#dark#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file)
let g:airline#themes#dark#normal_modified = {
\ 'info_separator': [ '#444444' , '#5f005f' , 238 , 53 , '' ] ,
\ 'statusline': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
\ }
let s:I1 = [ '#00005f' , '#00dfff' , 17 , 45 ]
let s:I2 = [ '#ffffff' , '#005fff' , 255 , 27 ]
let s:I3 = [ '#ffffff' , '#000080' , 15 , 17 ]
let g:airline#themes#dark#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
let g:airline#themes#dark#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file)
let g:airline#themes#dark#insert_modified = {
\ 'info_separator': [ '#005fff' , '#5f005f' , 27 , 53 , '' ] ,
\ 'statusline': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
@ -23,20 +23,19 @@ let g:airline#themes#dark#insert_paste = {
\ 'mode': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] ,
\ 'mode_separator': [ '#d78700' , s:I2[1] , 172 , s:I2[3] , '' ] ,
\ }
let g:airline#themes#dark#insert_replace = {
\ 'mode': [ s:I2[0] , '#af0000' , s:I2[2] , 124 , '' ] ,
\ 'mode_separator': [ '#af0000' , s:I2[1] , 124 , s:I2[3] , '' ] ,
\ }
let g:airline#themes#dark#replace = copy(g:airline#themes#dark#insert)
let g:airline#themes#dark#replace.mode = [ s:I2[0] , '#af0000' , s:I2[2] , 124 , '' ]
let g:airline#themes#dark#replace.mode_separator = [ '#af0000' , s:I2[1] , 124 , s:I2[3] , '' ]
let g:airline#themes#dark#replace_modified = g:airline#themes#dark#insert_modified
let s:V1 = [ '#000000' , '#ffaf00' , 232 , 214 ]
let s:V2 = [ '#000000' , '#ff5f00' , 232 , 202 ]
let s:V3 = [ '#ffffff' , '#5f0000' , 15 , 52 ]
let g:airline#themes#dark#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
let g:airline#themes#dark#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file)
let g:airline#themes#dark#visual_modified = {
\ 'info_separator': [ '#ff5f00' , '#5f005f' , 202 , 53 , '' ] ,
\ 'statusline': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
\ }
function! airline#themes#dark#get(key, modes)
return g:airline#themes#dark#normal[key]
endfunction

View File

@ -1,20 +1,20 @@
let g:airline#themes#light#inactive = { 'mode': [ '#9e9e9e' , '#ffffff' , 247 , 255 , '' ] }
let s:file = [ '#df0000' , '#ffffff' , 160 , 255 ]
let s:N1 = [ '#ffffff' , '#005fff' , 255 , 27 ]
let s:N2 = [ '#000087' , '#00dfff' , 18 , 45 ]
let s:N3 = [ '#005fff' , '#afffff' , 27 , 159 ]
let g:airline#themes#light#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
let g:airline#themes#light#normal.file = [ '#df0000' , '#ffffff' , 160 , 255 , '' ]
let g:airline#themes#light#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file)
let g:airline#themes#light#normal_modified = {
\ 'info_separator': [ '#00dfff' , '#ffdfdf' , 45 , 224 , '' ] ,
\ 'statusline': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] ,
\ }
let s:I1 = [ '#ffffff' , '#00875f' , 255 , 29 ]
let s:I2 = [ '#005f00' , '#00df87' , 22 , 42 ]
let s:I3 = [ '#005f5f' , '#afff87' , 23 , 156 ]
let g:airline#themes#light#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
let g:airline#themes#light#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file)
let g:airline#themes#light#insert_modified = {
\ 'info_separator': [ '#00df87' , '#ffdfdf' , 42 , 224 , '' ] ,
\ 'statusline': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] ,
@ -23,15 +23,19 @@ let g:airline#themes#light#insert_paste = {
\ 'mode': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] ,
\ 'mode_separator': [ '#d78700' , s:I2[1] , 172 , s:I2[3] , '' ] ,
\ }
let g:airline#themes#light#insert_replace = {
\ 'mode': [ s:I2[0] , '#ff0000' , s:I1[2] , 196 , '' ] ,
\ 'mode_separator': [ '#ff0000' , s:I2[1] , 196 , s:I2[3] , '' ] ,
\ }
let g:airline#themes#light#replace = copy(g:airline#themes#light#insert)
let g:airline#themes#light#replace.mode = [ s:I2[0] , '#ff0000' , s:I1[2] , 196 , '' ]
let g:airline#themes#light#replace.mode_separator = [ '#ff0000' , s:I2[1] , 196 , s:I2[3] , '' ]
let g:airline#themes#light#replace_modified = g:airline#themes#light#insert_modified
let g:airline#themes#light#replace_paste = g:airline#themes#light#insert_paste
let s:V1 = [ '#ffffff' , '#ff5f00' , 255 , 202 ]
let s:V2 = [ '#5f0000' , '#ffaf00' , 52 , 214 ]
let s:V3 = [ '#df5f00' , '#ffff87' , 166 , 228 ]
let g:airline#themes#light#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
let g:airline#themes#light#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file)
let g:airline#themes#light#visual_modified = {
\ 'info_separator': [ '#ffaf00' , '#ffdfdf' , 214 , 224 , '' ] ,
\ 'statusline': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] ,

View File

@ -55,6 +55,7 @@ let g:airline#themes#simple#normal_modified = {
\ 'statusline': [ '#df0000' , s:guibg, 160 , s:termbg , '' ] ,
\ }
let s:I1 = s:swap ? [ s:guibg, '#5fff00' , s:termbg , 82 ] : [ '#5fff00' , s:guibg, 82 , s:termbg ]
let s:I2 = [ '#ff5f00' , s:guibg, 202 , s:termbg ]
let s:I3 = [ '#767676' , s:guibg, 243 , s:termbg ]
@ -72,10 +73,14 @@ let g:airline#themes#simple#insert_paste = {
\ 'mode': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] ,
\ 'mode_separator': [ '#d78700' , s:I2[1] , 172 , s:I2[3] , '' ] ,
\ }
let g:airline#themes#simple#insert_replace = {
let g:airline#themes#simple#replace = {
\ 'mode': [ s:I1[0] , '#af0000' , s:I1[2] , 124 , '' ] ,
\ 'mode_separator': [ '#af0000' , s:I2[1] , 124 , s:I2[3] , '' ] ,
\ }
let g:airline#themes#simple#replace_modified = copy(g:airline#themes#simple#normal_modified)
let s:V1 = s:swap ? [ s:guibg, '#dfdf00' , s:termbg , 184 ] : [ '#dfdf00' , s:guibg, 184 , s:termbg ]
let s:V2 = [ '#ff5f00' , s:guibg, 202 , s:termbg ]

View File

@ -7,25 +7,31 @@ let s:NM = {
\ 'info_separator': [ '#d33682' , '#fdf6e3' , 125 , 230 , '' ] ,
\ 'statusline': [ '#d33682' , '#fdf6e3' , 125 , 230 , '' ] ,
\ }
let g:airline#themes#solarized#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
let s:file = [ '#cb4b16' , s:N3[1] , 166 , s:N3[3] ]
let g:airline#themes#solarized#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file)
let g:airline#themes#solarized#normal_modified = s:NM
let g:airline#themes#solarized#normal.file = [ '#cb4b16' , s:N3[1] , 166 , s:N3[3] , '' ]
let s:I1 = [ '#fdf6e3' , '#2aa198' , 230 , 37 ]
let g:airline#themes#solarized#insert = airline#themes#generate_color_map(s:I1, s:N2, s:N3)
let g:airline#themes#solarized#insert = airline#themes#generate_color_map(s:I1, s:N2, s:N3, s:file)
let g:airline#themes#solarized#insert_modified = s:NM
" I can't find how to customise the paste and replace colors without breaking
" the modified color. If someone knows how they can modify this below.
"let s:IP1 = [ s:I1[0] , '#268bd2' , s:I1[2] , 33 ]
"let g:airline#themes#solarized#insert_paste = airline#themes#generate_color_map(s:IP1, s:I2, s:I3)
"let g:airline#themes#solarized#insert_paste = airline#themes#generate_color_map(s:IP1, s:I2, s:I3, s:file)
"let g:airline#themes#solarized#insert_paste_modified = s:NM
"let s:IR1 = [ s:I1[0] , '#859900' , s:I1[2] , 64 ]
"let g:airline#themes#solarized#insert_replace = airline#themes#generate_color_map(s:IR1, s:I2, s:I3)
"let g:airline#themes#solarized#insert_replace_modified = s:NM
let s:IR1 = [ s:I1[0] , '#859900' , s:I1[2] , 64 ]
let g:airline#themes#solarized#replace = airline#themes#generate_color_map(s:IR1, s:N2, s:N3, s:file)
let g:airline#themes#solarized#replace_modified = s:NM
let s:V1 = [ '#fdf6e3' , '#6c71c4' , 230 , 61 ]
let g:airline#themes#solarized#visual = airline#themes#generate_color_map(s:V1, s:N2, s:N3)
let g:airline#themes#solarized#visual = airline#themes#generate_color_map(s:V1, s:N2, s:N3, s:file)
let g:airline#themes#solarized#visual_modified = s:NM

View File

@ -78,29 +78,30 @@ let g:airline#themes#solarized2#inactive = {
\ 'mode': [s:N3[0], s:N3[1], s:N3[2], s:N3[3], ''],
\ }
let g:airline#themes#solarized2#normal =
\ airline#themes#generate_color_map(s:N1, s:N2, s:N3)
\ airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:NF)
let g:airline#themes#solarized2#normal_modified =
\ s:NM
let g:airline#themes#solarized2#normal.file =
\ s:NF
let g:airline#themes#solarized2#insert =
\ airline#themes#generate_color_map(s:I1, s:I2, s:I3)
\ airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:NF)
let g:airline#themes#solarized2#insert_modified =
\ s:IM
let g:airline#themes#solarized2#insert.file =
\ s:NF
let g:airline#themes#solarized2#replace =
\ airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:NF)
let g:airline#themes#solarized2#replace_modified =
\ s:IM
let g:airline#themes#solarized2#visual =
\ airline#themes#generate_color_map(s:V1, s:V2, s:V3)
\ airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:NF)
let g:airline#themes#solarized2#visual_modified =
\ s:VM
let g:airline#themes#solarized2#visual.file =
\ s:NF

View File

@ -58,8 +58,9 @@ endfunction
function! s:airline_theme(...)
if a:0
call airline#load_theme(a:1)
else
echo g:airline_theme
endif
echo g:airline_theme
endfunction
command! -nargs=? -complete=customlist,<sid>get_airline_themes AirlineTheme call <sid>airline_theme(<f-args>)